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: General HgiVulkan stability #2852

Conversation

erikaharrison-adsk
Copy link
Contributor

Description of Change(s)

This PR provides the following support to the hgiVulkan backend

  1. Fixes Color Correction
  2. Provides Layout Transition infrastructure
  3. Fixes most Vulkan validation errors
  4. Fixes debug layer struct issue
  5. Fixes Pipeline Vertex Divisor struct issue

Fixes Issue(s)

  • N/A
  • I have verified that all unit tests pass with the proposed changes
  • I have submitted a signed Contributor License Agreement

1. Fixes Color Correction
2. Provides Layout Transition infrastructure
3. Fixes most Vulkan validation errors
4. Fixes debug layer struct issue

(cherry picked from commit d10ea20a202458727ae5d667dae5dd9bf9bdfbf7)
{ { -1, 3, 0, 1, 0, 2 },
{ -1, -1, 0, 1, 0, 0 },
{ 3, -1, 0, 1, 2, 0 } };

// Vulkan back-end needs the UVs inverted along the y axis
Copy link
Contributor

@schevrel schevrel Dec 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of fixing this here, it might be better to bring in the fix at the shader generation level. See #2504

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My PR had some issues with HdStorm, I have updated it to remove some shader compilation errors.

@jesschimein
Copy link
Contributor

Filed as internal issue #USD-9060

// The following cases are based on few initial assumptions to provide
// an infrastructure for access mask selection based on layouts.
// Feel free to update depending on need and use cases.
switch (GetImageLayout()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the following switch statement need a default case, otherwise they fail to compile for me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -132,21 +132,19 @@ HgiVulkanGraphicsPipeline::HgiVulkanGraphicsPipeline(
vertBufs.push_back(std::move(vib));
}

VkPipelineVertexInputDivisorStateCreateInfoEXT vertexInputDivisor =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this work was done on an earlier version of the dev/feature branch, since I believe this change is no longer needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. This will be undone in the oncoming push

@@ -67,15 +67,15 @@ HgiVulkanInstance::HgiVulkanInstance()
VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME,
};

std::vector<const char*> instanceLayerList;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This I think is also unneeded now.

bufDesc.usage = HgiBufferUsageUniform;
// Vulkan Validation layer is raising an error here because
// a usage flag of Uniform is applied to a buffer bound as storage
bufDesc.usage = HgiBufferUsageUniform | HgiBufferUsageStorage;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want this to run with HgiGL, too, then can you add a Vulkan-specific check here like you did for vboMemoryManger.cpp?

bufDesc.usage = HgiBufferUsageUniform | HgiBufferUsageVertex;
// Vulkan Validation layer is raising an error here because
// a usage flag of Uniform is applied to a buffer bound as storage
bufDesc.usage = HgiBufferUsageUniform | HgiBufferUsageStorage;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here re: a Vulkan-specific check so this works for HgiGL too.

(cherry picked from commit 173d02c573ed820e4d79aa3aebe5610298963d04)
@@ -147,8 +147,14 @@ TF_DEFINE_PRIVATE_TOKENS(
(early_fragment_tests)
);

// For now, looks like for Vulkan path, we require HGI Resource Generation path enabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This too is already fixed in the current branch, just FYI.

1. VkPipelineVertexInputStateCreateInfo (following latest fixes proposed by Pixar)
2. Instance Layer Extensions (following latest fixes proposed by Pixar)
3. UV flipping fix in shader selection for Vulkan (following latest fixes proposed by Adobe)
4. Undoing temp code aound flipping color correction UVs flip

(cherry picked from commit db0a46bede5b9504bb6954dc8ac7b1b5d6e5f364)
@@ -253,7 +254,7 @@ HgiVulkanDevice::HgiVulkanDevice(HgiVulkanInstance* instance)

VkPhysicalDeviceFeatures2 features =
{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2};
features.pNext = &vulkan11Features;
features.pNext = (instance->GetVulkanVersion() >= VK_API_VERSION_1_2) ? &vulkan11Features : nullptr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on the need for this change? I'm assuming this is because you're potentially targeting Vulkan versions < 1.2 for Android support. Do you have an idea of what other changes will be needed for that goal?

Right now we use vulkan11Features here to potentially enable shaderDrawParameters (you can see the associated hgi capability flag set in HgiVulkanCapabilities). If we potentially disapply vulkan11Features here, would that need a corresponding modification to HgiVulkanCapabilities?

@clach clach merged commit 97b5aad into PixarAnimationStudios:feature-hgi-vulkan Feb 16, 2024
2 of 5 checks passed
pixar-oss pushed a commit that referenced this pull request Mar 1, 2024
…ly expects

one aspect when copying an image to buffer, so if the image is a depth-stencil
image, assume we wish to copy the depth aspect.

See #2852

(Internal change: 2316631)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants