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)
{ 3, -1, 0, 1, 2, 0 } };
// Vulkan back-end needs the UVs inverted along the y axis
- if (_GetHgi()->GetAPIName() == HgiTokens->Vulkan)
- {
- vertData[0][5] = 1.0f - vertData[0][5];
- vertData[1][5] = 1.0f - vertData[1][5];
- vertData[2][5] = 1.0f - vertData[2][5];
- }
+ //if (_GetHgi()->GetAPIName() == HgiTokens->Vulkan)
+ //{
+ // vertData[0][5] = 1.0f - vertData[0][5];
+ // vertData[1][5] = 1.0f - vertData[1][5];
+ // vertData[2][5] = 1.0f - vertData[2][5];
+ //}
HgiBufferDesc vboDesc;
vboDesc.debugName = "HdxColorCorrectionTask VertexBuffer";
vertBufs.push_back(std::move(vib));
}
- VkPipelineVertexInputDivisorStateCreateInfoEXT vertexInputDivisor =
- {VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT};
- vertexInputDivisor.pVertexBindingDivisors = vertBindingDivisors.data();
- vertexInputDivisor.vertexBindingDivisorCount =
- (uint32_t) vertBindingDivisors.size();
-
VkPipelineVertexInputStateCreateInfo vertexInput =
{VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO};
vertexInput.pVertexAttributeDescriptions = vertAttrs.data();
vertexInput.vertexAttributeDescriptionCount = (uint32_t) vertAttrs.size();
vertexInput.pVertexBindingDescriptions = vertBufs.data();
vertexInput.vertexBindingDescriptionCount = (uint32_t) vertBufs.size();
- vertexInput.pNext = (vertBindingDivisors.size() > 0) ? &vertexInputDivisor : nullptr;
pipeCreateInfo.pVertexInputState = &vertexInput;
VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME,
};
- std::vector<const char*> instanceLayerList;
// Enable validation layers extension.
// Requires VK_LAYER_PATH to be set.
if (HgiVulkanIsDebugEnabled()) {
extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
- instanceLayerList.push_back("VK_LAYER_KHRONOS_validation");
-
- createInfo.ppEnabledLayerNames = instanceLayerList.data();
- createInfo.enabledLayerCount = (uint32_t)instanceLayerList.size();
}
createInfo.ppEnabledExtensionNames = extensions.data();
if (_writable) {
// Write a function that lets you write to the texture with
// HgiSet_texName(uv, data).
+ const std::string arrayIndex = (_arraySize > 0) ? "[index]" : "";
ss << "void HgiSet_";
WriteIdentifier(ss);
ss << "(" << intCoordType << " uv, vec4 data) {\n";
- ss << " ";
+
+ if (sizeDim >= 2) {
+ ss << sizeType << " texSize = imageSize("; WriteIdentifier(ss);
+ ss << ");\n";
+ ss << "uv.y = texSize.y - 1 - uv.y;\n";
+ }
ss << "imageStore(";
WriteIdentifier(ss);
ss << ", uv, data);\n";
ss << " HgiGet_";
WriteIdentifier(ss);
ss << "(" << arrayInput << floatCoordType << " uv) {\n";
- ss << " ";
+
+ if (sizeDim >= 2) {
+ ss << "uv.y = 1.0 - uv.y;\n";
+ }
+
_WriteSampledDataType(ss);
ss << " result = texture(";
WriteIdentifier(ss);
ss << " HgiTextureLod_";
WriteIdentifier(ss);
ss << "(" << arrayInput << floatCoordType << " coord, float lod) {\n";
- ss << " ";
+ if (sizeDim >= 2) {
+ ss << sizeType << " texSize = textureSize("; WriteIdentifier(ss);
+ ss << arrayIndex << ", 0);\n";
+ ss << " coord.y = float(texSize.y-1) - coord.y;\n";
+ }
ss << "return textureLod(";
WriteIdentifier(ss);
ss << arrayIndex << ", coord, lod);\n";
ss << " HgiTexelFetch_";
WriteIdentifier(ss);
ss << "(" << arrayInput << intCoordType << " coord) {\n";
- ss << " ";
+ if (sizeDim >= 2) {
+ ss << sizeType << " texSize = textureSize("; WriteIdentifier(ss);
+ ss << arrayIndex << ", 0);\n";
+ ss << "coord.y = texSize.y - 1 - coord.y;\n";
+ }
_WriteSampledDataType(ss);
ss << " result = texelFetch(";
WriteIdentifier(ss);