Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autodesk: Fixes Vulkan pick task validation failures #3507

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions pxr/imaging/hdSt/renderBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ HgiTextureUsage _GetTextureUsage(HdFormat format, TfToken const &name)
// We are assuming at some point in a render buffer's lifetime it could be
// used to read from, so provide that ability to the render buffer. This is
// especially useful for the HgiVulkan backend.

if (HdAovHasDepthSemantic(name)) {
return HgiTextureUsageBitsDepthTarget | HgiTextureUsageBitsShaderRead;
} else if (HdAovHasDepthStencilSemantic(name)) {
if (HdAovHasDepthStencilSemantic(name)) {
return HgiTextureUsageBitsDepthTarget |
HgiTextureUsageBitsStencilTarget |
HgiTextureUsageBitsShaderRead;
HgiTextureUsageBitsStencilTarget |
HgiTextureUsageBitsShaderRead;
} else if (HdAovHasDepthSemantic(name)) {
return HgiTextureUsageBitsDepthTarget | HgiTextureUsageBitsShaderRead;
}

return HgiTextureUsageBitsColorTarget | HgiTextureUsageBitsShaderRead;
Expand Down
8 changes: 4 additions & 4 deletions pxr/imaging/hdSt/renderDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,13 @@ HdStRenderDelegate::GetDefaultAovDescriptor(TfToken const& name) const
if (name == HdAovTokens->color) {
return HdAovDescriptor(
HdFormatFloat16Vec4, colorDepthMSAA, VtValue(GfVec4f(0)));
} else if (HdAovHasDepthStencilSemantic(name)) {
return HdAovDescriptor(
HdFormatFloat32UInt8, colorDepthMSAA,
VtValue(HdDepthStencilType(1.0f, 0)));
} else if (HdAovHasDepthSemantic(name)) {
return HdAovDescriptor(
HdFormatFloat32, colorDepthMSAA, VtValue(1.0f));
} else if (HdAovHasDepthStencilSemantic(name)) {
return HdAovDescriptor(
HdFormatFloat32UInt8, colorDepthMSAA,
VtValue(HdDepthStencilType(1.0f, 0)));
} else if (_AovHasIdSemantic(name)) {
return HdAovDescriptor(
HdFormatInt32, colorDepthMSAA, VtValue(-1));
Expand Down
2 changes: 1 addition & 1 deletion pxr/imaging/hdx/pickTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ HdxPickTask::_CreateAovBindings()
_GetAovPath(_tokens->widgetDepthStencil));

HdAovDescriptor depthDesc = renderDelegate->GetDefaultAovDescriptor(
HdAovTokens->depth);
_depthToken);

_widgetAovBindings = _pickableAovBindings;
for (auto& binding : _widgetAovBindings) {
Expand Down
8 changes: 6 additions & 2 deletions pxr/imaging/hgiVulkan/conversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,12 @@ HgiVulkanConversions::GetFormat(HgiFormat inFormat, bool depthFormat)

// Special case for float32 depth format not properly handled by
// _FormatTable
if (depthFormat && inFormat == HgiFormatFloat32) {
vkFormat = VK_FORMAT_D32_SFLOAT;
if (depthFormat) {
if (inFormat == HgiFormatFloat32) {
vkFormat = VK_FORMAT_D32_SFLOAT;
} else if (inFormat == HgiFormatFloat32UInt8) {
vkFormat = VK_FORMAT_D32_SFLOAT_S8_UINT;
}
}

return vkFormat;
Expand Down
14 changes: 9 additions & 5 deletions pxr/imaging/hgiVulkan/texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ HgiVulkanTexture::HgiVulkanTexture(
{
GfVec3i const& dimensions = desc.dimensions;
bool const isDepthBuffer = desc.usage & HgiTextureUsageBitsDepthTarget;
bool const isStencilBuffer = desc.usage & HgiTextureUsageBitsStencilTarget;

//
// Gather image create info
Expand Down Expand Up @@ -152,11 +153,14 @@ HgiVulkanTexture::HgiVulkanTexture(
// that can be accessed through this image view.
// It's possible to create multiple image views for a single image
// referring to different (and/or overlapping) ranges of the image.
// A 'view' must be either depth or stencil, not both, especially when used
// in a descriptor set. For now we assume we always want the 'depth' aspect.
view.subresourceRange.aspectMask = isDepthBuffer ?
VK_IMAGE_ASPECT_DEPTH_BIT /*| VK_IMAGE_ASPECT_STENCIL_BIT*/ :
VK_IMAGE_ASPECT_COLOR_BIT;
if (isDepthBuffer) {
view.subresourceRange.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT;
if (isStencilBuffer) {
view.subresourceRange.aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT;
}
} else {
view.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
}

view.subresourceRange.baseMipLevel = 0;
view.subresourceRange.baseArrayLayer = 0;
Expand Down