From b03ac7892e37968978a33c5b0fea9b0d4f404502 Mon Sep 17 00:00:00 2001 From: Philippe Sawicki Date: Wed, 25 Sep 2024 21:57:33 +0000 Subject: [PATCH 01/82] Expose bindings to `ArAsset`, to support performing `OpenAsset(resolvedPath)` from Python. --- pxr/usd/ar/CMakeLists.txt | 2 + pxr/usd/ar/module.cpp | 1 + pxr/usd/ar/testenv/testArOpenAsset.py | 185 ++++++++++++++++++++++++++ pxr/usd/ar/wrapAsset.cpp | 57 ++++++++ pxr/usd/ar/wrapResolver.cpp | 2 + 5 files changed, 247 insertions(+) create mode 100644 pxr/usd/ar/testenv/testArOpenAsset.py create mode 100644 pxr/usd/ar/wrapAsset.cpp diff --git a/pxr/usd/ar/CMakeLists.txt b/pxr/usd/ar/CMakeLists.txt index fcf1aa4489..1b9d268d31 100644 --- a/pxr/usd/ar/CMakeLists.txt +++ b/pxr/usd/ar/CMakeLists.txt @@ -57,6 +57,7 @@ pxr_library(ar PYMODULE_CPPFILES module.cpp + wrapAsset.cpp wrapAssetInfo.cpp wrapDefaultResolverContext.cpp wrapDefaultResolver.cpp @@ -83,6 +84,7 @@ pxr_test_scripts( testenv/testArAssetInfo.py testenv/testArAdvancedAPI.py testenv/testArDefaultResolver.py + testenv/testArOpenAsset.py testenv/testArPackageUtils.py testenv/testArResolvedPath.py testenv/testArResolverContext.py diff --git a/pxr/usd/ar/module.cpp b/pxr/usd/ar/module.cpp index 86ba4c27a7..e1e4216e84 100644 --- a/pxr/usd/ar/module.cpp +++ b/pxr/usd/ar/module.cpp @@ -12,6 +12,7 @@ PXR_NAMESPACE_USING_DIRECTIVE TF_WRAP_MODULE { + TF_WRAP(Asset); TF_WRAP(AssetInfo); TF_WRAP(ResolvedPath); TF_WRAP(Timestamp); diff --git a/pxr/usd/ar/testenv/testArOpenAsset.py b/pxr/usd/ar/testenv/testArOpenAsset.py new file mode 100644 index 0000000000..c4eb86b778 --- /dev/null +++ b/pxr/usd/ar/testenv/testArOpenAsset.py @@ -0,0 +1,185 @@ +#!/pxrpythonsubst +# +# Copyright 2024 Pixar +# +# Licensed under the terms set forth in the LICENSE.txt file available at +# https://openusd.org/license. +# +import json +import os +import tempfile +import unittest + +from pxr import Ar + +class TestArOpenAsset(unittest.TestCase): + + def setUp(self) -> None: + # Create a temporary directory containing a JSON test file, along with + # a binary file: + self._temp_dir = tempfile.TemporaryDirectory() + self._json_file_path = os.path.join(self._temp_dir.name, 'text.json') + self._binary_file_path = os.path.join(self._temp_dir.name, 'binary.bin') + + # Write some sample JSON data to the test file. + # + # NOTE: The included UTF-8 string is represented by the following byte + # sequence: + # * 'H', 'e', 'l', 'l', 'o', ',', and '!' are all 1-byte characters + # (ASCII). + # * 'δΈ–' and 'η•Œ' are 3-byte characters (East Asian characters). + # * '🌍' is a 4-byte character (emoji representing "Earth Globe + # Europe-Africa"). + # + # The overall byte sequence for this UTF-8 string is: + # * "Hello, \\u4e16\\u754c! \\ud83c\\udf0d" + self._json_data = { + 'name': 'example', + 'value': 1234, + 'utf-8': 'Hello, δΈ–η•Œ! 🌍', + 'child-object': { + 'key': 'value', + }, + } + with open(self._json_file_path, 'w') as json_file: + json.dump(self._json_data, json_file) + + # Write some sample binary data to the test file, including characters + # that would result in UTF-8 decoding errors such as: + # > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in + # > position 0: invalid continuation byte + # + # Equivalent string of the following byte representation: 'ÃÇéあ', + # where: + # * 'Γƒ' represents an 'A' with tilde in UTF-8, but can represent a + # different character in Latin-1. + # * 'Γ‡' represents a 'C' with cedilla in Latin-1, although would be + # different in UTF-8. + # * 'Γ©' represents the byte 0xE9 in ISO-8859-1 (Latin-1), although + # in UTF-8, 0xE9 is not a valid single byte but part of a + # multi-byte sequence. + # * 'あ' is represented by the byte 0x82A0 in Shift JIS. + self._binary_data = b'\xc3\xc7\xe9\x82A0' + with open(self._binary_file_path, 'wb') as binary_file: + binary_file.write(self._binary_data) + + def tearDown(self) -> None: + # Cleanup the temporary directory: + self._temp_dir.cleanup() + + def _get_resolved_text_filepath(self) -> Ar.ResolvedPath: + """ + Return the resolved path of the Attribute referencing the JSON file, + located in the in-memory test Stage. + """ + return Ar.ResolvedPath(self._json_file_path) + + def _get_resolved_binary_filepath(self) -> Ar.ResolvedPath: + """ + Return the resolved path of the Attribute referencing the JSON file, + located in the in-memory test Stage. + """ + return Ar.ResolvedPath(self._binary_file_path) + + def test_ar_asset_can_be_opened_from_resolver(self) -> None: + """ + Validate that the test attribute referencing a JSON file has the + interface of a `pxr.Ar.Asset`. + """ + json_file = self._get_resolved_text_filepath() + json_asset = Ar.GetResolver().OpenAsset(resolvedPath=json_file) + + self.assertIsInstance(json_asset, Ar.Asset) + + def test_ar_asset_has_expected_content_size(self) -> None: + """ + Validate that the referenced `pxr.Ar.Asset` has a size comparable + with the the content of the sample JSON data serialized to the + temporary directory. + """ + json_file = self._get_resolved_text_filepath() + json_asset = Ar.GetResolver().OpenAsset(resolvedPath=json_file) + + expected_json_content_size = len(json.dumps(self._json_data)) + self.assertEqual(json_asset.GetSize(), expected_json_content_size) + + def test_ar_asset_buffer_can_be_read_to_a_valid_buffer(self) -> None: + """ + Validate that the referenced `pxr.Ar.Asset` content matches the + actual JSON file in the temporary test directory, by reading it into a + valid buffer. + """ + json_file = self._get_resolved_text_filepath() + json_asset = Ar.GetResolver().OpenAsset(resolvedPath=json_file) + asset_size = json_asset.GetSize() + + buffer = bytearray(asset_size) + size_read = json_asset.Read(buffer, asset_size, 0) + + self.assertEqual(buffer.decode(), json.dumps(self._json_data)) + self.assertEqual(size_read, asset_size) + + def test_ar_asset_buffer_can_be_read_to_a_valid_buffer_of_the_given_length(self) -> None: + """ + Validate that the referenced `pxr.Ar.Asset` content matches the + actual JSON file in the temporary test directory, by reading it into a + valid buffer and reading it up to a given length. + """ + json_file = self._get_resolved_text_filepath() + json_asset = Ar.GetResolver().OpenAsset(resolvedPath=json_file) + asset_size = json_asset.GetSize() + + # Read the first half of the file content: + buffer_size = asset_size // 2 + buffer = bytearray(buffer_size) + size_read = json_asset.Read(buffer, buffer_size, 0) + + self.assertEqual(buffer.decode(), + json.dumps(self._json_data)[:buffer_size]) + self.assertEqual(size_read, buffer_size) + + # Read the second half of the file content: + buffer_size = asset_size - buffer_size + buffer = bytearray(buffer_size) + size_read = json_asset.Read(buffer, buffer_size, asset_size // 2) + + self.assertEqual(buffer.decode(), + json.dumps(self._json_data)[buffer_size:]) + self.assertEqual(size_read, buffer_size) + + def test_ar_asset_buffer_raises_an_error_when_reading_to_an_invalid_buffer(self) -> None: + """ + Validate that an Error is raised when attempting to read the + `pxr.Ar.Asset` into an invalid buffer. + """ + json_file = self._get_resolved_text_filepath() + json_asset = Ar.GetResolver().OpenAsset(resolvedPath=json_file) + + invalid_buffer = '' + + with self.assertRaises(TypeError) as e: + json_asset.Read(invalid_buffer, json_asset.GetSize(), 0) + self.assertEqual(str(e.exception), + 'Object does not support buffer interface') + + def test_ar_asset_buffer_raises_an_error_if_provided_buffer_is_of_insufficient_size(self) -> None: + """ + Validate that an Error is raised when attempting to read the + `pxr.Ar.Asset` into a buffer of insufficient size. + """ + json_file = self._get_resolved_text_filepath() + json_asset = Ar.GetResolver().OpenAsset(resolvedPath=json_file) + + # Create a buffer that is 1 element short of being able to hold the + # asset in its entirety, in order to ensure potential "off by 1" limits + # are correctly handled: + buffer = bytearray(json_asset.GetSize() - 1) + + with self.assertRaises(ValueError) as e: + json_asset.Read(buffer, json_asset.GetSize(), 0) + self.assertEqual(str(e.exception), + 'Provided buffer is of insufficient size to hold the requested data size') + + +if __name__ == '__main__': + unittest.main() diff --git a/pxr/usd/ar/wrapAsset.cpp b/pxr/usd/ar/wrapAsset.cpp new file mode 100644 index 0000000000..e3727335ea --- /dev/null +++ b/pxr/usd/ar/wrapAsset.cpp @@ -0,0 +1,57 @@ +// +// Copyright 2024 Pixar +// +// Licensed under the terms set forth in the LICENSE.txt file available at +// https://openusd.org/license. +// +#include +#include + +#include "pxr/pxr.h" +#include "pxr/base/tf/pyUtils.h" +#include "pxr/usd/ar/asset.h" + +using namespace boost::python; + +PXR_NAMESPACE_USING_DIRECTIVE + +static size_t +_Read(const ArAsset& self, boost::python::object& buffer, size_t count, size_t offset) +{ + // Extract the raw pointer from the Python buffer object, and confirm it supports the buffer interface: + PyObject* pyObject = buffer.ptr(); + if (!PyObject_CheckBuffer(pyObject)) { + TfPyThrowTypeError("Object does not support buffer interface"); + } + + // Confirm the provided Python buffer object can be written to: + Py_buffer pyBuffer; + if (PyObject_GetBuffer(pyObject, &pyBuffer, PyBUF_WRITABLE) < 0) { + TfPyThrowTypeError("Unable to get writable buffer from object"); + } + + // Validate that the provided Python buffer has sufficient size to hold the requested data: + if (size_t(pyBuffer.len) < count) { + PyBuffer_Release(&pyBuffer); + TfPyThrowValueError("Provided buffer is of insufficient size to hold the requested data size"); + } + + // Proceed to read the given number of elements from the ArAsset, starting at the given offset: + size_t result = self.Read(pyBuffer.buf, count, offset); + + PyBuffer_Release(&pyBuffer); + return result; +} + +void +wrapAsset() +{ + // Bindings for "ArAsset": + class_, boost::noncopyable> + ("Asset", no_init) + + .def("GetSize", &ArAsset::GetSize) + .def("Read", &_Read, + (arg("buffer"), arg("count"), arg("offset"))) + ; +} diff --git a/pxr/usd/ar/wrapResolver.cpp b/pxr/usd/ar/wrapResolver.cpp index d4b071d3b1..488264c4b9 100644 --- a/pxr/usd/ar/wrapResolver.cpp +++ b/pxr/usd/ar/wrapResolver.cpp @@ -95,6 +95,8 @@ wrapResolver() (args("assetPath"), args("resolvedPath"))) .def("GetModificationTimestamp", &This::GetModificationTimestamp, (args("assetPath"), args("resolvedPath"))) + .def("OpenAsset", &This::OpenAsset, + (args("resolvedPath"))) .def("GetExtension", &This::GetExtension, args("assetPath")) From 262b84a7029c9c9941c521c2da508a8a618e58aa Mon Sep 17 00:00:00 2001 From: Jerry Gamache Date: Tue, 1 Oct 2024 12:21:27 -0400 Subject: [PATCH 02/82] EMSUSD-1691 - Load mono EXR images --- pxr/imaging/hio/OpenEXR/openexr-c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pxr/imaging/hio/OpenEXR/openexr-c.c b/pxr/imaging/hio/OpenEXR/openexr-c.c index 5c39b5adb4..6cc2b79610 100644 --- a/pxr/imaging/hio/OpenEXR/openexr-c.c +++ b/pxr/imaging/hio/OpenEXR/openexr-c.c @@ -657,7 +657,8 @@ static exr_result_t _nanoexr_rgba_decoding_initialize( for (int c = 0; c < decoder->channel_count; ++c) { int channelIndex = -1; decoder->channels[c].decode_to_ptr = NULL; - if (strIsComponent(layerName, decoder->channels[c].channel_name, "red")) { + if (strIsComponent(layerName, decoder->channels[c].channel_name, "red") + || (rgba[0] == -1 && strIsComponent(layerName, decoder->channels[c].channel_name, "y"))) { rgba[0] = c; channelIndex = 0; } From ae5a4afd9610f5fdfafa77a8342144dff4c11db8 Mon Sep 17 00:00:00 2001 From: Jerry Gamache Date: Thu, 5 Sep 2024 16:51:21 -0400 Subject: [PATCH 03/82] EMSUSD-1616 - Fix crash referencing image NodeDef --- pxr/usd/usdMtlx/reader.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pxr/usd/usdMtlx/reader.cpp b/pxr/usd/usdMtlx/reader.cpp index 473a359ced..6df29518af 100644 --- a/pxr/usd/usdMtlx/reader.cpp +++ b/pxr/usd/usdMtlx/reader.cpp @@ -434,8 +434,12 @@ _TypeSupportsColorSpace(const mx::ConstValueElementPtr& mxElem) bool colorImageNode = false; if (type == "filename") { // verify the output is color3 or color4 - mx::ConstNodeDefPtr parentNodeDef = - _GetNodeDef(mxElem->getParent()->asA()); + mx::ConstNodeDefPtr parentNodeDef; + if (mxElem->getParent()->isA()) { + parentNodeDef = _GetNodeDef(mxElem->getParent()->asA()); + } else if (mxElem->getParent()->isA()) { + parentNodeDef = mxElem->getParent()->asA(); + } if (parentNodeDef) { for (const mx::OutputPtr& output : parentNodeDef->getOutputs()) { const std::string &type = output->getType(); From 7c603a9c88bd50120c24e17ad5cdfc11126d779a Mon Sep 17 00:00:00 2001 From: Andy Shiue Date: Wed, 25 Sep 2024 11:32:46 -0400 Subject: [PATCH 04/82] Added TF_VERIFY_VK_RESULT to verify the result of the Vulkan call and print the result string if it fails. --- pxr/imaging/hgiVulkan/buffer.cpp | 22 +++++------- pxr/imaging/hgiVulkan/commandBuffer.cpp | 42 +++++----------------- pxr/imaging/hgiVulkan/commandQueue.cpp | 17 ++++----- pxr/imaging/hgiVulkan/computePipeline.cpp | 8 ++--- pxr/imaging/hgiVulkan/device.cpp | 30 ++++++---------- pxr/imaging/hgiVulkan/diagnostic.cpp | 22 ++++++++++-- pxr/imaging/hgiVulkan/diagnostic.h | 18 ++++++++++ pxr/imaging/hgiVulkan/graphicsPipeline.cpp | 16 ++++----- pxr/imaging/hgiVulkan/instance.cpp | 25 ++++++------- pxr/imaging/hgiVulkan/resourceBindings.cpp | 12 +++---- pxr/imaging/hgiVulkan/sampler.cpp | 5 +-- pxr/imaging/hgiVulkan/shaderCompiler.cpp | 4 +-- pxr/imaging/hgiVulkan/shaderFunction.cpp | 4 +-- pxr/imaging/hgiVulkan/texture.cpp | 16 ++++----- 14 files changed, 115 insertions(+), 126 deletions(-) diff --git a/pxr/imaging/hgiVulkan/buffer.cpp b/pxr/imaging/hgiVulkan/buffer.cpp index 2d3c0618b6..04e268aed0 100644 --- a/pxr/imaging/hgiVulkan/buffer.cpp +++ b/pxr/imaging/hgiVulkan/buffer.cpp @@ -40,7 +40,7 @@ HgiVulkanBuffer::HgiVulkanBuffer( VkBufferCreateInfo bi = {VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO}; bi.size = desc.byteSize; bi.usage = HgiVulkanConversions::GetBufferUsage(desc.usage); - bi.usage |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT | + bi.usage |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT; bi.sharingMode = VK_SHARING_MODE_EXCLUSIVE; // gfx queue only @@ -52,9 +52,7 @@ HgiVulkanBuffer::HgiVulkanBuffer( VmaAllocationCreateInfo ai = {}; ai.preferredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; // GPU efficient - TF_VERIFY( - vmaCreateBuffer(vma,&bi,&ai,&_vkBuffer,&_vmaAllocation,0) == VK_SUCCESS - ); + TF_VERIFY_VK_RESULT(vmaCreateBuffer(vma,&bi,&ai,&_vkBuffer,&_vmaAllocation,0)); // Debug label if (!_descriptor.debugName.empty()) { @@ -150,11 +148,11 @@ HgiVulkanBuffer::GetCPUStagingAddress() } if (!_cpuStagingAddress) { - TF_VERIFY( + TF_VERIFY_VK_RESULT( vmaMapMemory( - _device->GetVulkanMemoryAllocator(), - _stagingBuffer->GetVulkanMemoryAllocation(), - &_cpuStagingAddress) == VK_SUCCESS + _device->GetVulkanMemoryAllocator(), + _stagingBuffer->GetVulkanMemoryAllocation(), + &_cpuStagingAddress) ); } @@ -210,7 +208,7 @@ HgiVulkanBuffer::CreateStagingBuffer( VkBufferCreateInfo bi = {VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO}; bi.size = desc.byteSize; bi.usage = HgiVulkanConversions::GetBufferUsage(desc.usage); - bi.usage |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT | + bi.usage |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT; bi.sharingMode = VK_SHARING_MODE_EXCLUSIVE; // gfx queue only @@ -221,14 +219,12 @@ HgiVulkanBuffer::CreateStagingBuffer( VkBuffer buffer = 0; VmaAllocation alloc = 0; - TF_VERIFY( - vmaCreateBuffer(vma, &bi, &ai, &buffer, &alloc, 0) == VK_SUCCESS - ); + TF_VERIFY_VK_RESULT(vmaCreateBuffer(vma, &bi, &ai, &buffer, &alloc, 0)); // Map the (HOST_VISIBLE) buffer and upload data if (desc.initialData) { void* map; - TF_VERIFY(vmaMapMemory(vma, alloc, &map) == VK_SUCCESS); + TF_VERIFY_VK_RESULT(vmaMapMemory(vma, alloc, &map)); memcpy(map, desc.initialData, desc.byteSize); vmaUnmapMemory(vma, alloc); } diff --git a/pxr/imaging/hgiVulkan/commandBuffer.cpp b/pxr/imaging/hgiVulkan/commandBuffer.cpp index 3662257b9e..44dadf4649 100644 --- a/pxr/imaging/hgiVulkan/commandBuffer.cpp +++ b/pxr/imaging/hgiVulkan/commandBuffer.cpp @@ -36,12 +36,7 @@ HgiVulkanCommandBuffer::HgiVulkanCommandBuffer( allocInfo.commandPool = pool; allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; - TF_VERIFY( - vkAllocateCommandBuffers( - vkDevice, - &allocInfo, - &_vkCommandBuffer) == VK_SUCCESS - ); + TF_VERIFY_VK_RESULT(vkAllocateCommandBuffers(vkDevice, &allocInfo, &_vkCommandBuffer)); // Assign a debug label to command buffer uint64_t cmdBufHandle = (uint64_t)_vkCommandBuffer; @@ -58,23 +53,13 @@ HgiVulkanCommandBuffer::HgiVulkanCommandBuffer( VkFenceCreateInfo fenceInfo = {VK_STRUCTURE_TYPE_FENCE_CREATE_INFO}; fenceInfo.flags = 0; // Unsignaled starting state - TF_VERIFY( - vkCreateFence( - vkDevice, - &fenceInfo, - HgiVulkanAllocator(), - &_vkFence) == VK_SUCCESS - ); + TF_VERIFY_VK_RESULT(vkCreateFence(vkDevice, &fenceInfo, HgiVulkanAllocator(), &_vkFence)); // Create semaphore for GPU-GPU synchronization VkSemaphoreCreateInfo semaCreateInfo = {VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO}; - TF_VERIFY( - vkCreateSemaphore( - vkDevice, - &semaCreateInfo, - HgiVulkanAllocator(), - &_vkSemaphore) == VK_SUCCESS + TF_VERIFY_VK_RESULT( + vkCreateSemaphore(vkDevice, &semaCreateInfo, HgiVulkanAllocator(), &_vkSemaphore) ); // Assign a debug label to fence. @@ -105,9 +90,7 @@ HgiVulkanCommandBuffer::BeginCommandBuffer(uint8_t inflightId) {VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO}; beginInfo.flags |= VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; - TF_VERIFY( - vkBeginCommandBuffer(_vkCommandBuffer, &beginInfo) == VK_SUCCESS - ); + TF_VERIFY_VK_RESULT(vkBeginCommandBuffer(_vkCommandBuffer, &beginInfo)); _inflightId = inflightId; _isInFlight = true; @@ -133,9 +116,7 @@ HgiVulkanCommandBuffer::EndCommandBuffer() TF_VERIFY(_isInFlight); TF_VERIFY(!_isSubmitted); - TF_VERIFY( - vkEndCommandBuffer(_vkCommandBuffer) == VK_SUCCESS - ); + TF_VERIFY_VK_RESULT(vkEndCommandBuffer(_vkCommandBuffer)); _isSubmitted = true; } @@ -163,8 +144,7 @@ HgiVulkanCommandBuffer::UpdateInFlightStatus(HgiSubmitWaitType wait) } static const uint64_t timeOut = 100000000000; - TF_VERIFY(vkWaitForFences( - vkDevice, 1, &_vkFence, VK_TRUE, timeOut) == VK_SUCCESS); + TF_VERIFY_VK_RESULT(vkWaitForFences(vkDevice, 1, &_vkFence, VK_TRUE, timeOut)); } _isInFlight = false; @@ -191,9 +171,7 @@ HgiVulkanCommandBuffer::ResetIfConsumedByGPU(HgiSubmitWaitType wait) VkDevice vkDevice = _device->GetVulkanDevice(); // GPU is done with command buffer, reset fence and command buffer. - TF_VERIFY( - vkResetFences(vkDevice, 1, &_vkFence) == VK_SUCCESS - ); + TF_VERIFY_VK_RESULT(vkResetFences(vkDevice, 1, &_vkFence)); // It might be more efficient to reset the cmd pool instead of individual // command buffers. But we may not have a clear 'StartFrame' / 'EndFrame' @@ -202,9 +180,7 @@ HgiVulkanCommandBuffer::ResetIfConsumedByGPU(HgiSubmitWaitType wait) // been consumed by the GPU. VkCommandBufferResetFlags flags = _GetCommandBufferResetFlags(); - TF_VERIFY( - vkResetCommandBuffer(_vkCommandBuffer, flags) == VK_SUCCESS - ); + TF_VERIFY_VK_RESULT(vkResetCommandBuffer(_vkCommandBuffer, flags)); // Command buffer may now be reused for new recordings / resource creation. _isSubmitted = false; diff --git a/pxr/imaging/hgiVulkan/commandQueue.cpp b/pxr/imaging/hgiVulkan/commandQueue.cpp index c70f479e8a..8928a79437 100644 --- a/pxr/imaging/hgiVulkan/commandQueue.cpp +++ b/pxr/imaging/hgiVulkan/commandQueue.cpp @@ -9,6 +9,7 @@ #include "pxr/imaging/hgiVulkan/device.h" #include "pxr/base/tf/diagnostic.h" +#include "pxr/imaging/hgiVulkan/diagnostic.h" PXR_NAMESPACE_OPEN_SCOPE @@ -27,12 +28,12 @@ _CreateCommandPool(HgiVulkanDevice* device) VkCommandPool pool = nullptr; - TF_VERIFY( + TF_VERIFY_VK_RESULT( vkCreateCommandPool( device->GetVulkanDevice(), &poolCreateInfo, HgiVulkanAllocator(), - &pool) == VK_SUCCESS + &pool) ); HgiVulkanCommandQueue::HgiVulkan_CommandPool* newPool = @@ -110,9 +111,7 @@ HgiVulkanCommandQueue::SubmitToQueue( resourceInfo.signalSemaphoreCount = 1; resourceInfo.pSignalSemaphores = &semaphore; - TF_VERIFY( - vkQueueSubmit(_vkGfxQueue, 1, &resourceInfo, rFence) == VK_SUCCESS - ); + TF_VERIFY_VK_RESULT(vkQueueSubmit(_vkGfxQueue, 1, &resourceInfo, rFence)); _resourceCommandBuffer = nullptr; } @@ -139,17 +138,13 @@ HgiVulkanCommandQueue::SubmitToQueue( // Record and submission order does not guarantee execution order. // VK docs: "Execution Model" & "Implicit Synchronization Guarantees". // The vulkan queue must be externally synchronized. - TF_VERIFY( - vkQueueSubmit(_vkGfxQueue, 1, &workInfo, wFence) == VK_SUCCESS - ); + TF_VERIFY_VK_RESULT(vkQueueSubmit(_vkGfxQueue, 1, &workInfo, wFence)); // Optional blocking wait if (wait == HgiSubmitWaitTypeWaitUntilCompleted) { static const uint64_t timeOut = 100000000000; VkDevice vkDevice = _device->GetVulkanDevice(); - TF_VERIFY( - vkWaitForFences(vkDevice, 1, &wFence, VK_TRUE, timeOut)==VK_SUCCESS - ); + TF_VERIFY_VK_RESULT(vkWaitForFences(vkDevice, 1, &wFence, VK_TRUE, timeOut)); // When the client waits for the cmd buf to finish on GPU they will // expect to have the CompletedHandlers run. For example when the // client wants to do a GPU->CPU read back (memcpy) diff --git a/pxr/imaging/hgiVulkan/computePipeline.cpp b/pxr/imaging/hgiVulkan/computePipeline.cpp index 20129e0966..4c94e9daee 100644 --- a/pxr/imaging/hgiVulkan/computePipeline.cpp +++ b/pxr/imaging/hgiVulkan/computePipeline.cpp @@ -72,12 +72,12 @@ HgiVulkanComputePipeline::HgiVulkanComputePipeline( pipeLayCreateInfo.setLayoutCount = (uint32_t)_vkDescriptorSetLayouts.size(); pipeLayCreateInfo.pSetLayouts = _vkDescriptorSetLayouts.data(); - TF_VERIFY( + TF_VERIFY_VK_RESULT( vkCreatePipelineLayout( _device->GetVulkanDevice(), &pipeLayCreateInfo, HgiVulkanAllocator(), - &_vkPipelineLayout) == VK_SUCCESS + &_vkPipelineLayout) ); // Debug label @@ -97,14 +97,14 @@ HgiVulkanComputePipeline::HgiVulkanComputePipeline( // HgiVulkanPipelineCache* pCache = device->GetPipelineCache(); - TF_VERIFY( + TF_VERIFY_VK_RESULT( vkCreateComputePipelines( _device->GetVulkanDevice(), pCache->GetVulkanPipelineCache(), 1, &pipeCreateInfo, HgiVulkanAllocator(), - &_vkPipeline) == VK_SUCCESS + &_vkPipeline) ); // Debug label diff --git a/pxr/imaging/hgiVulkan/device.cpp b/pxr/imaging/hgiVulkan/device.cpp index 7b38eec9ff..4fceaefe57 100644 --- a/pxr/imaging/hgiVulkan/device.cpp +++ b/pxr/imaging/hgiVulkan/device.cpp @@ -77,11 +77,11 @@ HgiVulkanDevice::HgiVulkanDevice(HgiVulkanInstance* instance) const uint32_t maxDevices = 64; VkPhysicalDevice physicalDevices[maxDevices]; uint32_t physicalDeviceCount = maxDevices; - TF_VERIFY( + TF_VERIFY_VK_RESULT( vkEnumeratePhysicalDevices( instance->GetVulkanInstance(), &physicalDeviceCount, - physicalDevices) == VK_SUCCESS + physicalDevices) ); for (uint32_t i = 0; i < physicalDeviceCount; i++) { @@ -123,22 +123,22 @@ HgiVulkanDevice::HgiVulkanDevice(HgiVulkanInstance* instance) // uint32_t extensionCount = 0; - TF_VERIFY( + TF_VERIFY_VK_RESULT( vkEnumerateDeviceExtensionProperties( _vkPhysicalDevice, nullptr, &extensionCount, - nullptr) == VK_SUCCESS + nullptr) ); _vkExtensions.resize(extensionCount); - TF_VERIFY( + TF_VERIFY_VK_RESULT( vkEnumerateDeviceExtensionProperties( _vkPhysicalDevice, nullptr, &extensionCount, - _vkExtensions.data()) == VK_SUCCESS + _vkExtensions.data()) ); // @@ -282,12 +282,8 @@ HgiVulkanDevice::HgiVulkanDevice(HgiVulkanInstance* instance) createInfo.enabledExtensionCount = (uint32_t) extensions.size(); createInfo.pNext = &features; - TF_VERIFY( - vkCreateDevice( - _vkPhysicalDevice, - &createInfo, - HgiVulkanAllocator(), - &_vkDevice) == VK_SUCCESS + TF_VERIFY_VK_RESULT( + vkCreateDevice(_vkPhysicalDevice, &createInfo, HgiVulkanAllocator(), &_vkDevice) ); HgiVulkanSetupDeviceDebug(instance, this); @@ -315,9 +311,7 @@ HgiVulkanDevice::HgiVulkanDevice(HgiVulkanInstance* instance) allocatorInfo.flags |= VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT; } - TF_VERIFY( - vmaCreateAllocator(&allocatorInfo, &_vmaAllocator) == VK_SUCCESS - ); + TF_VERIFY_VK_RESULT(vmaCreateAllocator(&allocatorInfo, &_vmaAllocator)); // // Command Queue @@ -335,7 +329,7 @@ HgiVulkanDevice::HgiVulkanDevice(HgiVulkanInstance* instance) HgiVulkanDevice::~HgiVulkanDevice() { // Make sure device is idle before destroying objects. - TF_VERIFY(vkDeviceWaitIdle(_vkDevice) == VK_SUCCESS); + TF_VERIFY_VK_RESULT(vkDeviceWaitIdle(_vkDevice)); delete _pipelineCache; delete _commandQueue; @@ -389,9 +383,7 @@ HgiVulkanDevice::GetPipelineCache() const void HgiVulkanDevice::WaitForIdle() { - TF_VERIFY( - vkDeviceWaitIdle(_vkDevice) == VK_SUCCESS - ); + TF_VERIFY_VK_RESULT(vkDeviceWaitIdle(_vkDevice)); } bool diff --git a/pxr/imaging/hgiVulkan/diagnostic.cpp b/pxr/imaging/hgiVulkan/diagnostic.cpp index 64ba485380..61cbd9658d 100644 --- a/pxr/imaging/hgiVulkan/diagnostic.cpp +++ b/pxr/imaging/hgiVulkan/diagnostic.cpp @@ -14,6 +14,8 @@ #include "pxr/base/tf/diagnostic.h" #include "pxr/base/tf/envSetting.h" +#include + #include @@ -21,7 +23,7 @@ PXR_NAMESPACE_OPEN_SCOPE TF_DEFINE_ENV_SETTING(HGIVULKAN_DEBUG, 0, "Enable debugging for HgiVulkan"); -TF_DEFINE_ENV_SETTING(HGIVULKAN_DEBUG_VERBOSE, 0, +TF_DEFINE_ENV_SETTING(HGIVULKAN_DEBUG_VERBOSE, 0, "Enable verbose debugging for HgiVulkan"); bool @@ -108,12 +110,12 @@ HgiVulkanCreateDebug(HgiVulkanInstance* instance) dbgMsgCreateInfo.pfnUserCallback = _VulkanDebugCallback; dbgMsgCreateInfo.pUserData = nullptr; - TF_VERIFY( + TF_VERIFY_VK_RESULT( instance->vkCreateDebugUtilsMessengerEXT( vkInstance, &dbgMsgCreateInfo, HgiVulkanAllocator(), - &instance->vkDebugMessenger) == VK_SUCCESS + &instance->vkDebugMessenger) ); } @@ -250,4 +252,18 @@ HgiVulkanEndQueueLabel(HgiVulkanDevice* device) device->vkQueueEndDebugUtilsLabelEXT(gfxQueue); } +const char* +HgiVulkanResultString(VkResult result) +{ + return string_VkResult(result); +} + +const char* +HgiVulkanCommandResultString(const char* cmd, VkResult result) +{ + static thread_local std::string buffer; + buffer = std::string(cmd) + ": " + string_VkResult(result); + return buffer.c_str(); +} + PXR_NAMESPACE_CLOSE_SCOPE diff --git a/pxr/imaging/hgiVulkan/diagnostic.h b/pxr/imaging/hgiVulkan/diagnostic.h index 84adc09cf7..9d00683a58 100644 --- a/pxr/imaging/hgiVulkan/diagnostic.h +++ b/pxr/imaging/hgiVulkan/diagnostic.h @@ -66,6 +66,24 @@ void HgiVulkanBeginQueueLabel( HGIVULKAN_API void HgiVulkanEndQueueLabel(HgiVulkanDevice* device); +/// Returns a string representation of VkResult +HGIVULKAN_API +const char* HgiVulkanResultString(VkResult result); + +/// Returns a string representation of the vulkan command and its result +HGIVULKAN_API +const char* HgiVulkanCommandResultString(const char* cmd, VkResult result); + +#define TF_VERIFY_VK_RESULT(cmd) \ + do { \ + const auto result = cmd; \ + if (ARCH_UNLIKELY(result != VK_SUCCESS)) { \ + Tf_PostErrorHelper(TF_CALL_CONTEXT, \ + TF_DIAGNOSTIC_CODING_ERROR_TYPE, \ + std::string{HgiVulkanCommandResultString(#cmd, result)}); \ + } \ + } while(0) + PXR_NAMESPACE_CLOSE_SCOPE #endif diff --git a/pxr/imaging/hgiVulkan/graphicsPipeline.cpp b/pxr/imaging/hgiVulkan/graphicsPipeline.cpp index 053d8d4e7d..88a9f67fd6 100755 --- a/pxr/imaging/hgiVulkan/graphicsPipeline.cpp +++ b/pxr/imaging/hgiVulkan/graphicsPipeline.cpp @@ -330,12 +330,12 @@ HgiVulkanGraphicsPipeline::HgiVulkanGraphicsPipeline( pipeLayCreateInfo.setLayoutCount= (uint32_t) _vkDescriptorSetLayouts.size(); pipeLayCreateInfo.pSetLayouts = _vkDescriptorSetLayouts.data(); - TF_VERIFY( + TF_VERIFY_VK_RESULT( vkCreatePipelineLayout( _device->GetVulkanDevice(), &pipeLayCreateInfo, HgiVulkanAllocator(), - &_vkPipelineLayout) == VK_SUCCESS + &_vkPipelineLayout) ); // Debug label @@ -362,14 +362,14 @@ HgiVulkanGraphicsPipeline::HgiVulkanGraphicsPipeline( // HgiVulkanPipelineCache* pCache = device->GetPipelineCache(); - TF_VERIFY( + TF_VERIFY_VK_RESULT( vkCreateGraphicsPipelines( _device->GetVulkanDevice(), pCache->GetVulkanPipelineCache(), 1, &pipeCreateInfo, HgiVulkanAllocator(), - &_vkPipeline) == VK_SUCCESS + &_vkPipeline) ); // Debug label @@ -503,12 +503,12 @@ HgiVulkanGraphicsPipeline::AcquireVulkanFramebuffer( fbCreateInfo.height = framebuffer.dimensions[1]; fbCreateInfo.layers = 1; - TF_VERIFY( + TF_VERIFY_VK_RESULT( vkCreateFramebuffer( _device->GetVulkanDevice(), &fbCreateInfo, HgiVulkanAllocator(), - &framebuffer.vkFramebuffer) == VK_SUCCESS + &framebuffer.vkFramebuffer) ); // Debug label @@ -766,12 +766,12 @@ HgiVulkanGraphicsPipeline::_CreateRenderPass() vkCreateRenderPass2KHR = (PFN_vkCreateRenderPass2KHR) vkGetDeviceProcAddr( _device->GetVulkanDevice(), "vkCreateRenderPass2KHR"); - TF_VERIFY( + TF_VERIFY_VK_RESULT( vkCreateRenderPass2KHR( _device->GetVulkanDevice(), &renderPassInfo, HgiVulkanAllocator(), - &_vkRenderPass) == VK_SUCCESS + &_vkRenderPass) ); // Debug label diff --git a/pxr/imaging/hgiVulkan/instance.cpp b/pxr/imaging/hgiVulkan/instance.cpp index a48d43297f..b304e4c51d 100755 --- a/pxr/imaging/hgiVulkan/instance.cpp +++ b/pxr/imaging/hgiVulkan/instance.cpp @@ -19,20 +19,20 @@ PXR_NAMESPACE_OPEN_SCOPE static bool _CheckInstanceValidationLayerSupport(const char * layerName) -{ - uint32_t layerCount; - vkEnumerateInstanceLayerProperties(&layerCount, nullptr); +{ + uint32_t layerCount; + vkEnumerateInstanceLayerProperties(&layerCount, nullptr); std::vector availableLayers(layerCount); - + vkEnumerateInstanceLayerProperties(&layerCount, availableLayers.data()); - for (const auto& layerProperties : availableLayers) { - if (strcmp(layerName, layerProperties.layerName) == 0) { + for (const auto& layerProperties : availableLayers) { + if (strcmp(layerName, layerProperties.layerName) == 0) { return true; - } - } + } + } - return false; + return false; } static @@ -133,12 +133,7 @@ HgiVulkanInstance::HgiVulkanInstance() } #endif - TF_VERIFY( - vkCreateInstance( - &createInfo, - HgiVulkanAllocator(), - &_vkInstance) == VK_SUCCESS - ); + TF_VERIFY_VK_RESULT(vkCreateInstance(&createInfo, HgiVulkanAllocator(), &_vkInstance)); HgiVulkanCreateDebug(this); } diff --git a/pxr/imaging/hgiVulkan/resourceBindings.cpp b/pxr/imaging/hgiVulkan/resourceBindings.cpp index 24e1cdd194..b5f9035335 100644 --- a/pxr/imaging/hgiVulkan/resourceBindings.cpp +++ b/pxr/imaging/hgiVulkan/resourceBindings.cpp @@ -35,12 +35,12 @@ _CreateDescriptorSetLayout( setCreateInfo.pNext = nullptr; VkDescriptorSetLayout layout = nullptr; - TF_VERIFY( + TF_VERIFY_VK_RESULT( vkCreateDescriptorSetLayout( device->GetVulkanDevice(), &setCreateInfo, HgiVulkanAllocator(), - &layout) == VK_SUCCESS + &layout) ); // Debug label @@ -170,12 +170,12 @@ HgiVulkanResourceBindings::HgiVulkanResourceBindings( pool_info.poolSizeCount = (uint32_t) poolSizes.size(); pool_info.pPoolSizes = poolSizes.data(); - TF_VERIFY( + TF_VERIFY_VK_RESULT( vkCreateDescriptorPool( _device->GetVulkanDevice(), &pool_info, HgiVulkanAllocator(), - &_vkDescriptorPool) == VK_SUCCESS + &_vkDescriptorPool) ); // Debug label @@ -198,11 +198,11 @@ HgiVulkanResourceBindings::HgiVulkanResourceBindings( allocateInfo.descriptorSetCount = _descriptorSetCnt; allocateInfo.pSetLayouts = &_vkDescriptorSetLayout; - TF_VERIFY( + TF_VERIFY_VK_RESULT( vkAllocateDescriptorSets( _device->GetVulkanDevice(), &allocateInfo, - &_vkDescriptorSet) == VK_SUCCESS + &_vkDescriptorSet) ); // Debug label diff --git a/pxr/imaging/hgiVulkan/sampler.cpp b/pxr/imaging/hgiVulkan/sampler.cpp index 3f99b1f0e4..fdf4bcb02e 100644 --- a/pxr/imaging/hgiVulkan/sampler.cpp +++ b/pxr/imaging/hgiVulkan/sampler.cpp @@ -10,6 +10,7 @@ #include "pxr/imaging/hgiVulkan/conversions.h" #include "pxr/imaging/hgiVulkan/device.h" #include "pxr/imaging/hgiVulkan/sampler.h" +#include "pxr/imaging/hgiVulkan/diagnostic.h" #include @@ -58,12 +59,12 @@ HgiVulkanSampler::HgiVulkanSampler( static_cast(TfGetEnvSetting(HGI_MAX_ANISOTROPY))}) : 1.0f; } - TF_VERIFY( + TF_VERIFY_VK_RESULT( vkCreateSampler( device->GetVulkanDevice(), &sampler, HgiVulkanAllocator(), - &_vkSampler) == VK_SUCCESS + &_vkSampler) ); } diff --git a/pxr/imaging/hgiVulkan/shaderCompiler.cpp b/pxr/imaging/hgiVulkan/shaderCompiler.cpp index 7f285e7a6c..94c4aaedd1 100644 --- a/pxr/imaging/hgiVulkan/shaderCompiler.cpp +++ b/pxr/imaging/hgiVulkan/shaderCompiler.cpp @@ -102,12 +102,12 @@ _CreateDescriptorSetLayout( std::string const& debugName) { VkDescriptorSetLayout layout = nullptr; - TF_VERIFY( + TF_VERIFY_VK_RESULT( vkCreateDescriptorSetLayout( device->GetVulkanDevice(), &createInfo, HgiVulkanAllocator(), - &layout) == VK_SUCCESS + &layout) ); // Debug label diff --git a/pxr/imaging/hgiVulkan/shaderFunction.cpp b/pxr/imaging/hgiVulkan/shaderFunction.cpp index 9c2bffd8c7..c3ebc68ca1 100644 --- a/pxr/imaging/hgiVulkan/shaderFunction.cpp +++ b/pxr/imaging/hgiVulkan/shaderFunction.cpp @@ -57,12 +57,12 @@ HgiVulkanShaderFunction::HgiVulkanShaderFunction( shaderCreateInfo.codeSize = _spirvByteSize; shaderCreateInfo.pCode = (uint32_t*) spirv.data(); - TF_VERIFY( + TF_VERIFY_VK_RESULT( vkCreateShaderModule( device->GetVulkanDevice(), &shaderCreateInfo, HgiVulkanAllocator(), - &_vkShaderModule) == VK_SUCCESS + &_vkShaderModule) ); // Debug label diff --git a/pxr/imaging/hgiVulkan/texture.cpp b/pxr/imaging/hgiVulkan/texture.cpp index 6a9cff0186..8fde509a56 100644 --- a/pxr/imaging/hgiVulkan/texture.cpp +++ b/pxr/imaging/hgiVulkan/texture.cpp @@ -107,14 +107,14 @@ HgiVulkanTexture::HgiVulkanTexture( // Equivalent to: vkCreateImage, vkAllocateMemory, vkBindImageMemory VmaAllocationCreateInfo allocInfo = {}; allocInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY; - TF_VERIFY( + TF_VERIFY_VK_RESULT( vmaCreateImage( device->GetVulkanMemoryAllocator(), &imageCreateInfo, &allocInfo, &_vkImage, &_vmaImageAllocation, - nullptr) == VK_SUCCESS + nullptr) ); TF_VERIFY(_vkImage, "Failed to create image"); @@ -164,12 +164,12 @@ HgiVulkanTexture::HgiVulkanTexture( view.subresourceRange.levelCount = desc.mipLevels; view.image = _vkImage; - TF_VERIFY( + TF_VERIFY_VK_RESULT( vkCreateImageView( device->GetVulkanDevice(), &view, HgiVulkanAllocator(), - &_vkImageView) == VK_SUCCESS + &_vkImageView) ); // Debug label @@ -286,12 +286,12 @@ HgiVulkanTexture::HgiVulkanTexture( view.subresourceRange.levelCount = desc.mipLevels; view.image = srcTexture->GetImage(); - TF_VERIFY( + TF_VERIFY_VK_RESULT( vkCreateImageView( device->GetVulkanDevice(), &view, HgiVulkanAllocator(), - &_vkImageView) == VK_SUCCESS + &_vkImageView) ); // Debug label @@ -358,11 +358,11 @@ HgiVulkanTexture::GetCPUStagingAddress() } if (!_cpuStagingAddress) { - TF_VERIFY( + TF_VERIFY_VK_RESULT( vmaMapMemory( _device->GetVulkanMemoryAllocator(), _stagingBuffer->GetVulkanMemoryAllocation(), - &_cpuStagingAddress) == VK_SUCCESS + &_cpuStagingAddress) ); } From 84338319322b74e26ba8c03c50d166a31512d127 Mon Sep 17 00:00:00 2001 From: pixar-oss Date: Mon, 7 Oct 2024 09:33:35 -0700 Subject: [PATCH 05/82] UsdNamespaceEditor now supports adding dependent stages and processing all edits necessary to fix up downstream namespace dependencies on those stages. Also fixed an issue in PcpGatherDependentNamespaceEdits that wasn't accounting for newly authored relocates when determining if unedited specs would be conflict in ancestor nodes. (Internal change: 2343533) --- pxr/usd/pcp/dependentNamespaceEditUtils.cpp | 103 +++++++- pxr/usd/pcp/dependentNamespaceEditUtils.h | 8 + pxr/usd/usd/namespaceEditor.cpp | 275 +++++++++++++------- pxr/usd/usd/namespaceEditor.h | 68 +++-- pxr/usd/usd/stage.h | 1 + pxr/usd/usd/wrapNamespaceEditor.cpp | 4 + 6 files changed, 336 insertions(+), 123 deletions(-) diff --git a/pxr/usd/pcp/dependentNamespaceEditUtils.cpp b/pxr/usd/pcp/dependentNamespaceEditUtils.cpp index 107e0dc872..d389531d05 100644 --- a/pxr/usd/pcp/dependentNamespaceEditUtils.cpp +++ b/pxr/usd/pcp/dependentNamespaceEditUtils.cpp @@ -235,8 +235,10 @@ class _PrimIndexDependentNodeEditProcessor void AddProcessEditsAtNodeTask( const PcpNodeRef &node, const SdfPath &oldPath, - const SdfPath &newPath) { - _InsertNodeTask({node, oldPath, newPath}); + const SdfPath &newPath, + bool willBeRelocated) { + _InsertNodeTask({node, oldPath, newPath, + /* isImpliedClassTask = */ false, willBeRelocated}); } // Processes all tasks producing all dependent edits for the prim index @@ -252,6 +254,7 @@ class _PrimIndexDependentNodeEditProcessor SdfPath oldPath; SdfPath newPath; bool isImpliedClassTask = false; + bool willBeRelocated = false; }; friend std::ostream & @@ -262,6 +265,9 @@ class _PrimIndexDependentNodeEditProcessor if (nodeTask.isImpliedClassTask) { out << " (isImpliedClassTask)"; } + if (nodeTask.willBeRelocated) { + out << " (willBeRelocated)"; + } return out; } @@ -658,7 +664,14 @@ _PrimIndexDependentNodeEditProcessor::_AddSpecMoveEdits( // move the specs at this node and log a warning as we only want to move // these specs if it constitutes moving the entire composed prim stack at // this node. - if (_HasUneditedUpstreamSpecConflicts(node, oldSpecPath)) { + // + // We ignore this check if the node has new relocates that will be applied + // to it by the initial edit. Relocates are used specifically for "moving" + // specs from weaker nodes without editing their specs so we actually expect + // unedited spec conflicts in this case and have used relocates to handle + // them. + if (!nodeTask.willBeRelocated && + _HasUneditedUpstreamSpecConflicts(node, oldSpecPath)) { return; } @@ -1552,6 +1565,8 @@ PcpGatherDependentNamespaceEdits( const SdfPath &oldPrimPath, const SdfPath &newPrimPath, const SdfLayerHandleVector &affectedLayers, + const PcpLayerStackRefPtr &affectedRelocatesLayerStack, + const SdfLayerHandle &addRelocatesToLayerStackEditLayer, const std::vector &dependentCaches) { TRACE_FUNCTION(); @@ -1562,6 +1577,75 @@ PcpGatherDependentNamespaceEdits( // Scratch space for spec move edits. _LayerSpecMovesScratch layerSpecMovesScratch; + // We don't author new relocates for the dependent prim indexes outside of + // the explicit new relocates that we will determine for the + // affectedRelocatesLayerStack if it is provided. Because of this, at each + // dependent node we look for conflicting specs in its subtree that will not + // be edited (and otherwise would require something like relocates) in order + // to log a warning that the composed prim stack won't be fully maintained + // by the edit. However, we won't have conflicting specs in nodes that are + // affected by the relocates edits above even if its subtree has unedited + // conflicting specs as the new relocates will effectively move those specs + // for us. All of this is to say that we need to pass the fact that the + // layer will have a relocates edit to the layer's dependent nodes so that + // they know to skip the conflicting subtree specs check. + // + // XXX: Note that this is actually a little simplified as what we really + // need to know at each node is whether its layer stack's compose relocates + // will, after the above relocates are applied, effectively relocate the + // subtree specs that would've otherwise had to be moved. But that is much + // more complex and this simpler method gets the job done for the vast + // majority of cases. + // + // Create a new list of each of the input affected layers paired with + // whether it has a relocates edit (which we initialize to false for all to + // start.) + std::vector> + affectedLayersAndHasRelocatesEdits; + affectedLayersAndHasRelocatesEdits.reserve(affectedLayers.size()); + for (const auto &layer : affectedLayers) { + affectedLayersAndHasRelocatesEdits.push_back({layer, false}); + } + + // If we were passed a layer stack to add relocates to, we'll use the + // relocates edit builder to process those now. + if (affectedRelocatesLayerStack) { + PcpLayerRelocatesEditBuilder builder( + affectedRelocatesLayerStack, addRelocatesToLayerStackEditLayer); + std::string error; + if (!builder.Relocate(oldPrimPath, newPrimPath, &error)) { + TF_CODING_ERROR("Cannot get relocates edits because: %s", + error.c_str()); + } + // For each initial relocates edit, we do three things: + // 1. Make sure the layer is put in the list of affected layers if it + // isn't already. Adding a relocate is the same as moving a spec as + // far as needing to update dependent prim indexes is concerned. + // 2. Marking the affected layer as having a relocates edit for when we + // add the initial dependent node tasks. + // 3. Move the edit into relocates edit results that is returned at the + // end. + for (auto &relocatesEdit : builder.GetEdits()) { + // Scoping for safety/clarity as the const reference of layer to + // relocatesEdit.first would become invalid after the relocatesEdit + // is inserted by rvalue reference. + { + const SdfLayerHandle &layer = relocatesEdit.first; + auto foundIt = std::find_if( + affectedLayersAndHasRelocatesEdits.begin(), + affectedLayersAndHasRelocatesEdits.end(), + [&](const auto &entry) { + return layer == entry.first;}); + if (foundIt == affectedLayersAndHasRelocatesEdits.end()) { + affectedLayersAndHasRelocatesEdits.push_back({layer, true}); + } else { + foundIt->second = true; + } + } + edits.dependentRelocatesEdits.insert(std::move(relocatesEdit)); + } + } + for (const PcpCache *cache : dependentCaches) { _PRINT_DEBUG_SCOPE( "Computing dependent namespace edits for PcpCache %s", @@ -1571,7 +1655,10 @@ PcpGatherDependentNamespaceEdits( // that depend on the old prim site in this layer and determine what // additional edits are necesssary to propagate edits to composition // dependencies as best as possible. - for (const auto &layer : affectedLayers) { + for (const auto &entry : affectedLayersAndHasRelocatesEdits) { + + const SdfLayerHandle &layer = entry.first; + const bool hasRelocatesEdits = entry.second; // Find all prim indexes which depend on the old prim path in this // layer. We recurse on site because moving or deleting a prim spec @@ -1637,8 +1724,14 @@ PcpGatherDependentNamespaceEdits( Pcp_ForEachDependentNode( dep.sitePath, layer, dep.indexPath, *cache, [&](const SdfPath &depIndexPath, const PcpNodeRef &node) { + // If the dependent layer is was affected by the + // initial relocates edit, indicate in the node task + // that the node task has a relocates edit. + // XXX: This is the part that is a little oversimplified + // as was mentioned earlier in this function. dependentNodeProcessor.AddProcessEditsAtNodeTask( - node, oldPrimPath, newPrimPath); + node, oldPrimPath, newPrimPath, + /*willBeRelocated = */ hasRelocatesEdits); }); dependentNodeProcessor.ProcessTasks(); } diff --git a/pxr/usd/pcp/dependentNamespaceEditUtils.h b/pxr/usd/pcp/dependentNamespaceEditUtils.h index 7d01aba877..92d492fb57 100644 --- a/pxr/usd/pcp/dependentNamespaceEditUtils.h +++ b/pxr/usd/pcp/dependentNamespaceEditUtils.h @@ -83,12 +83,20 @@ class PcpDependentNamespaceEdits { /// that would be affected by these edits and computes a full set of edits that /// would be required to maintain these dependent prim indexes' composed prim /// stacks, possibly moving the prim index to a new prim path if necessary. +/// If \p addRelocatesToLayerStack is provided, this will also add a new +/// relocates edit to the necessary layers in the layer stack that moves +/// oldPrimPath to newPrimPath. The layer \p addRelocatesToLayerStackEditLayer +/// provided is only relevant when the relocates layer stack is also provided as +/// it determines which specific layer in the layer stack will have a new +/// relocates entry added to it (see PcpLayerRelocatesEditBuilder). PCP_API PcpDependentNamespaceEdits PcpGatherDependentNamespaceEdits( const SdfPath &oldPrimPath, const SdfPath &newPrimPath, const SdfLayerHandleVector &affectedLayers, + const PcpLayerStackRefPtr &addRelocatesToLayerStack, + const SdfLayerHandle &addRelocatesToLayerStackEditLayer, const std::vector &dependentCaches); /// Gathers the list of layers that need to be edited to perform the spec move diff --git a/pxr/usd/usd/namespaceEditor.cpp b/pxr/usd/usd/namespaceEditor.cpp index ff2187a4df..922df3f5a4 100644 --- a/pxr/usd/usd/namespaceEditor.cpp +++ b/pxr/usd/usd/namespaceEditor.cpp @@ -294,6 +294,31 @@ UsdNamespaceEditor::UsdNamespaceEditor( { } +void +UsdNamespaceEditor::AddDependentStage(const UsdStageRefPtr &stage) +{ + if (!stage || stage == _stage) { + return; + } + _ClearProcessedEdits(); + _dependentStages.insert(stage); +} + +void +UsdNamespaceEditor::RemoveDependentStage(const UsdStageRefPtr &stage) +{ + _ClearProcessedEdits(); + _dependentStages.erase(stage); +} + +void +UsdNamespaceEditor::SetDependentStages(const UsdStageRefPtrVector &stages) +{ + for (const auto &stage : stages) { + AddDependentStage(stage); + } +} + bool UsdNamespaceEditor::DeletePrimAtPath( const SdfPath &path) @@ -560,12 +585,14 @@ class UsdNamespaceEditor::_EditProcessor { // Creates a processed edit from an edit description. static UsdNamespaceEditor::_ProcessedEdit ProcessEdit( const UsdStageRefPtr &stage, + const _StageSet &dependentStages, const UsdNamespaceEditor::_EditDescription &editDesc, const UsdNamespaceEditor::EditOptions &editOptions); private: _EditProcessor( const UsdStageRefPtr &stage, + const _StageSet &_dependentStages, const UsdNamespaceEditor::_EditDescription &editDesc, const UsdNamespaceEditor::EditOptions &editOptions, _ProcessedEdit *processedEdit); @@ -581,8 +608,11 @@ class UsdNamespaceEditor::_EditProcessor { void _GatherLayersToEdit(); void _GatherTargetListOpEdits(); - + + void _GatherDependentStageEdits(); + const UsdStageRefPtr & _stage; + const _StageSet &_dependentStages; const UsdNamespaceEditor::_EditDescription & _editDesc; const UsdEditTarget &_editTarget; const UsdNamespaceEditor::EditOptions & _editOptions; @@ -601,7 +631,7 @@ UsdNamespaceEditor::_ProcessEditsIfNeeded() const return; } _processedEdit = UsdNamespaceEditor::_EditProcessor::ProcessEdit( - _stage, _editDescription, _editOptions); + _stage, _dependentStages, _editDescription, _editOptions); } static @@ -747,20 +777,23 @@ _IsValidNewParentPath( UsdNamespaceEditor::_ProcessedEdit UsdNamespaceEditor::_EditProcessor::ProcessEdit( const UsdStageRefPtr &stage, + const _StageSet &dependentStages, const _EditDescription &editDesc, const EditOptions &editOptions) { _ProcessedEdit processedEdit; - _EditProcessor(stage, editDesc, editOptions, &processedEdit); + _EditProcessor(stage, dependentStages, editDesc, editOptions, &processedEdit); return processedEdit; } UsdNamespaceEditor::_EditProcessor::_EditProcessor( const UsdStageRefPtr &stage, + const _StageSet &dependentStages, const UsdNamespaceEditor::_EditDescription &editDesc, const UsdNamespaceEditor::EditOptions &editOptions, _ProcessedEdit *processedEdit) : _stage(stage) + , _dependentStages(dependentStages) , _editDesc(editDesc) , _editTarget(stage->GetEditTarget()) , _editOptions(editOptions) @@ -771,11 +804,8 @@ UsdNamespaceEditor::_EditProcessor::_EditProcessor( return; } - // Add the edit to the processed SdfBatchNamespaceEdit. We use the index of - // "Same" specifically so renames don't move the object (it has no effect - // for any edits other than rename) - _processedEdit->edits.Add( - editDesc.oldPath, editDesc.newPath, SdfNamespaceEdit::Same); + // Copy the edit description. + _processedEdit->editDescription = _editDesc; // Validate whether the stage has the prim or property at the original path // that can be namespace edited. @@ -813,6 +843,10 @@ UsdNamespaceEditor::_EditProcessor::_EditProcessor( // to be edited when the edits are applied. _GatherLayersToEdit(); + // Gather all edits that need to be performed on dependent stages for prim + // indexes that would be affected by the initial layer edits. + _GatherDependentStageEdits(); + // Gather all the edits that need to be made to target path listOps in // property specs in order to "fix up" properties that have connections or // relationship targets targeting the namespace edited object. @@ -837,19 +871,12 @@ UsdNamespaceEditor::_EditProcessor::_ProcessNewPath() // For reparenting we have additional behaviors and validation to perform. if (_editDesc.editType == _EditType::Reparent) { - // For each layer we edit, we may need to create new overs for the new - // parent path and delete inert ancestor overs after moving a prim or - // property from its original parent, so add this info to the processed - // edit. - _processedEdit->createParentSpecIfNeededPath = - _editDesc.newPath.GetParentPath(); - _processedEdit->removeInertAncestorOvers = true; // Validate that the stage does have a prim at the new parent path to // reparent to. std::string whyNot; if (!_IsValidNewParentPath(_stage, _editDesc.oldPath, - _processedEdit->createParentSpecIfNeededPath, &whyNot)) { + _editDesc.newPath.GetParentPath(), &whyNot)) { _processedEdit->errors.push_back(std::move(whyNot)); return false; } @@ -966,16 +993,9 @@ UsdNamespaceEditor::_EditProcessor::_ProcessPrimEditRequiresRelocates( return; } - // Otherwise, use the relocates builder to get all the relocates metadata - // that needs to be authored in each layer to move old path to new path. - PcpLayerRelocatesEditBuilder builder( - _nodeForEditTarget.GetLayerStack(), _editTarget.GetLayer()); - std::string error; - if (!builder.Relocate(_editDesc.oldPath, _editDesc.newPath, &error)) { - TF_CODING_ERROR("Cannot get relocates edits because: %s", - error.c_str()); - } - _processedEdit->relocatesEdits = builder.GetEdits(); + // Otherwise, log that we will author relocates so that this will be + // accounted for when we compute the dependent stage namespace edits. + _processedEdit->willAuthorRelocates = true; } void @@ -1063,35 +1083,9 @@ UsdNamespaceEditor::_EditProcessor::_GatherLayersToEdit() return; } - // Collect every prim spec that exists for this prim path in the layer - // stack's layers. - for (const SdfLayerRefPtr &layer : layers) { - if (layer->HasSpec(_editDesc.oldPath)) { - _processedEdit->layersToEdit.push_back(layer); - } - } - - // Validate whether the necessary spec edits can actually be performed on - // each layer that needs to be edited. - for (const auto &layer : _processedEdit->layersToEdit) { - // The layer itself needs to be editable - if (!layer->PermissionToEdit()) { - _processedEdit->errors.push_back(TfStringPrintf("The spec @%s@<%s> " - "cannot be edited because the layer is not editable", - layer->GetIdentifier().c_str(), - _editDesc.oldPath.GetText())); - } - // If we're moving an object to a new path, the layer cannot have a - // spec already at the new path. - if (!_editDesc.newPath.IsEmpty() && layer->HasSpec(_editDesc.newPath)) { - _processedEdit->errors.push_back(TfStringPrintf("The spec @%s@<%s> " - "cannot be moved to <%s> because a spec already exists at " - "the new path", - layer->GetIdentifier().c_str(), - _editDesc.oldPath.GetText(), - _editDesc.newPath.GetText())); - } - } + _processedEdit->layersToEdit = PcpGatherLayersToEditForSpecMove( + _nodeForEditTarget.GetLayerStack(), + _editDesc.oldPath, _editDesc.newPath, &_processedEdit->errors); } void @@ -1178,10 +1172,10 @@ UsdNamespaceEditor::_EditProcessor::_GatherTargetListOpEdits() } } - // If we added relocates for this edit already, then the target paths - // authored across composition arcs will also be mapped by the + // If the edit will author relocates for the primary edit, then the target + // paths authored across composition arcs will also be mapped by the // relocation. - if (!_processedEdit->relocatesEdits.empty()) { + if (_processedEdit->willAuthorRelocates) { continue; } @@ -1259,52 +1253,51 @@ UsdNamespaceEditor::_ProcessedEdit::CanApply(std::string *whyNot) const return true; } -bool -UsdNamespaceEditor::_ProcessedEdit::Apply() +static bool +_ApplyLayerSpecMove( + const SdfLayerHandle &layer, const SdfPath &oldPath, const SdfPath &newPath) { - // This is to try to preemptively prevent partial edits when if any of the - // necessary specs can't be renamed. - if (std::string errorMsg; !CanApply(&errorMsg)) { - TF_CODING_ERROR(TfStringPrintf("Failed to apply edits to the stage " - "because of the following errors: %s", errorMsg.c_str())); - return false; - } + // Create an SdfBatchNamespaceEdit for the path move. We use the index of + // "Same" specifically so renames don't move the object out of its original + // order (it has no effect for any edits other than rename) + SdfBatchNamespaceEdit batchEdit; + batchEdit.Add(oldPath, newPath, SdfNamespaceEdit::Same); // Implementation function as this is optionally called with a cleanup // enabler depending on the edit type. - auto applyEditsToLayersFn = [&]() { - for (const auto &layer : layersToEdit) { - // While we do require that the new parent exists on the composed - // stage when doing a reparent operation, that doesn't guarantee - // that parent spec exists on every layer in which we have to move - // the source spec. Thus we need to ensure the parent spec of the - // new location exists by adding required overs if necessary. - if (!createParentSpecIfNeededPath.IsEmpty() && - !SdfJustCreatePrimInLayer( - layer, createParentSpecIfNeededPath)) { - TF_CODING_ERROR("Failed to find or create new parent spec " - "at path '%s' on layer '%s' which is necessary to " - "apply edits. The edit will be incomplete.", - createParentSpecIfNeededPath.GetText(), - layer->GetIdentifier().c_str()); - return false; - } + auto applyEditsToLayersFn = [&](const SdfPath &createParentSpecIfNeededPath) { + // While we do require that the new parent exists on the composed + // stage when doing a reparent operation, that doesn't guarantee + // that parent spec exists on every layer in which we have to move + // the source spec. Thus we need to ensure the parent spec of the + // new location exists by adding required overs if necessary. + if (!createParentSpecIfNeededPath.IsEmpty() && + !SdfJustCreatePrimInLayer( + layer, createParentSpecIfNeededPath)) { + TF_CODING_ERROR("Failed to find or create new parent spec " + "at path '%s' on layer '%s' which is necessary to " + "apply edits. The edit will be incomplete.", + createParentSpecIfNeededPath.GetText(), + layer->GetIdentifier().c_str()); + return false; + } - // Apply the namespace edits to the layer. - if (!layer->Apply(edits)) { - TF_CODING_ERROR("Failed to apply batch edit '%s' on layer '%s' " - "which is necessary to apply edits. The edit will be " - "incomplete.", - TfStringify(edits.GetEdits()).c_str(), - layer->GetIdentifier().c_str()); - return false; - } + // Apply the namespace edits to the layer. + if (!layer->Apply(batchEdit)) { + TF_CODING_ERROR("Failed to apply batch edit '%s' on layer '%s' " + "which is necessary to apply edits. The edit will be " + "incomplete.", + TfStringify(batchEdit.GetEdits()).c_str(), + layer->GetIdentifier().c_str()); + return false; } + return true; }; - SdfChangeBlock changeBlock; - if (removeInertAncestorOvers) { + const bool isReparent = !newPath.IsEmpty() && + newPath.GetParentPath() != oldPath.GetParentPath(); + if (isReparent) { // Moving a spec may leave the ancnestor specs as an inert overs. This // could easily be caused by reparenting a prim back to its original // parent (essentially an "undo") after a reparent that needed to create @@ -1313,18 +1306,58 @@ UsdNamespaceEditor::_ProcessedEdit::Apply() // moved path so that a reparent plus an "undo" can effectively leave // layers in their original state. SdfCleanupEnabler cleanupEnabler; - if (!applyEditsToLayersFn()) { + if (!applyEditsToLayersFn(newPath.GetParentPath())) { return false; } } else { - if (!applyEditsToLayersFn()) { + if (!applyEditsToLayersFn(SdfPath::EmptyPath())) { return false; } } - // Set any necessary relocates. - for (const auto &[layer, relocatesValue] : relocatesEdits) { - layer->SetRelocates(relocatesValue); + return true; +} + +bool +UsdNamespaceEditor::_ProcessedEdit::Apply() +{ + // This is to try to preemptively prevent partial edits when if any of the + // necessary specs can't be renamed. + if (std::string errorMsg; !CanApply(&errorMsg)) { + TF_CODING_ERROR(TfStringPrintf("Failed to apply edits to the stage " + "because of the following errors: %s", errorMsg.c_str())); + return false; + } + + SdfChangeBlock changeBlock; + + if (editDescription.IsPropertyEdit()) { + // For a property edit, we just have to move the specs in the layers to + // edit. + for (const auto &layer : layersToEdit) { + _ApplyLayerSpecMove(layer, + editDescription.oldPath, editDescription.newPath); + } + } else { + // For prim edits, the dependent stage edits are always computed for + // at least the primary stage so all necessary edits will be contained + // in those computed edits. + for (const auto &[layer, editVec] : + dependentStageNamespaceEdits.layerSpecMoves) { + for (const auto &edit : editVec) { + _ApplyLayerSpecMove(layer, edit.oldPath, edit.newPath); + } + } + + for (const auto &edit : + dependentStageNamespaceEdits.compositionFieldEdits) { + edit.layer->SetField(edit.path, edit.fieldName, edit.newFieldValue); + } + + for (const auto &[layer, relocates] : + dependentStageNamespaceEdits.dependentRelocatesEdits) { + layer->SetRelocates(relocates); + } } // Perform any target path listOp fixups necessary now that the namespace @@ -1349,5 +1382,47 @@ UsdNamespaceEditor::_ProcessedEdit::Apply() return true; } +void +UsdNamespaceEditor::_EditProcessor::_GatherDependentStageEdits() +{ + // Composition dependencies are only relevant for prim namespace edits. + if (_editDesc.IsPropertyEdit()) { + return; + } + + // Get the PcpCaches for each dependent stage. The primary stage is always + // a dependent so put its cache at the front. Note that _dependentStages + // are a uniqued set and should never contain the primary stage. + std::vector dependentCaches; + dependentCaches.reserve(_dependentStages.size() + 1); + dependentCaches.push_back(_stage->_GetPcpCache()); + for (const auto &stage : _dependentStages) { + dependentCaches.push_back(stage->_GetPcpCache()); + } + + // If we need and allow relocates for the primary edit, then we pass the + // layer stack where we'll author them to the dependent edits function + // which will compute the layer stack's relocates edits for us. + const PcpLayerStackRefPtr &addRelocatesToLayerStack = + _processedEdit->willAuthorRelocates ? + _nodeForEditTarget.GetLayerStack() : PcpLayerStackRefPtr(); + + // Gather all the dependent edits for all stage PcpCaches. + _processedEdit->dependentStageNamespaceEdits = + PcpGatherDependentNamespaceEdits( + _editDesc.oldPath, _editDesc.newPath, _processedEdit->layersToEdit, + addRelocatesToLayerStack, _editTarget.GetLayer(), + dependentCaches); + + // XXX: We may want an option to allow users to treat warnings as errors or + // to return warning as part of calling CanApplyEdits. But for now we just + // emit the warnings. + if (!_processedEdit->dependentStageNamespaceEdits.warnings.empty()) { + TF_WARN("Encountered warnings processing dependent namespace edits: %s", + TfStringJoin(_processedEdit->dependentStageNamespaceEdits.warnings, + "\n ").c_str()); + } +} + PXR_NAMESPACE_CLOSE_SCOPE diff --git a/pxr/usd/usd/namespaceEditor.h b/pxr/usd/usd/namespaceEditor.h index 25a7e56beb..aebb2115a9 100644 --- a/pxr/usd/usd/namespaceEditor.h +++ b/pxr/usd/usd/namespaceEditor.h @@ -13,10 +13,9 @@ #include "pxr/usd/usd/api.h" #include "pxr/usd/usd/common.h" #include "pxr/usd/usd/stage.h" -#include "pxr/usd/pcp/layerRelocatesEditBuilder.h" +#include "pxr/usd/pcp/dependentNamespaceEditUtils.h" #include "pxr/usd/sdf/namespaceEdit.h" - PXR_NAMESPACE_OPEN_SCOPE /// @warning @@ -52,6 +51,41 @@ class UsdNamespaceEditor const UsdStageRefPtr &stage, const EditOptions &editOptions); + /// \name Dependent Stages + /// + /// Dependent stages are additional stages that may have composition + /// dependencies on the layer edits made for the editor's primary stage. + /// By adding dependent stages, the editor can make additional edits so that + /// affected composition arcs and specs that depend on affected composition + /// in composed prims on these stages are updated to compose with the moved + /// prim specs or, in the case of deletions, removed when the specs they + /// depend on are removed. + /// + /// Dependencies in the dependent stages are based only what is currently + /// loaded for those stages. In other words, the editor cannot find and + /// edit dependencies from unloaded payloads, inactive prim children, + /// prims that are load mask filtered, unselected variants, etc. The primary + /// stage of this editor is always a dependent stage, meaning that edits + /// will always be made to maintain affected composition dependencies in the + /// primary stage. + /// + /// @{ + + /// Adds the given \p stage as a dependent stage of this namespace editor. + USD_API + void AddDependentStage(const UsdStageRefPtr &stage); + + /// Removes the given \p stage as a dependent stage of this namespace editor. + USD_API + void RemoveDependentStage(const UsdStageRefPtr &stage); + + /// Sets the list of dependent stages for this namespace editor to + /// \p stages. + USD_API + void SetDependentStages(const UsdStageRefPtrVector &stages); + + /// @} + /// Adds an edit operation to delete the composed prim at the given \p path /// from this namespace editor's stage. /// @@ -243,17 +277,15 @@ class UsdNamespaceEditor // edit of the composed stage object from being completed successfully. std::vector errors; - // The Sdf batch namespace edit that needs to be applied to each layer - // with specs. - SdfBatchNamespaceEdit edits; - + // The edit description of the primary edit. + _EditDescription editDescription; + // The list of layers that have specs that need to have the Sdf // namespace edit applied. SdfLayerHandleVector layersToEdit; - // The list of relocates edits that need to be made to layers in order - // to relocate a prim. - PcpLayerRelocatesEditBuilder::LayerRelocatesEdits relocatesEdits; + // Whether performing the edit will author new relocates. + bool willAuthorRelocates = false; // Layer edits that need to be performed to update connection and // relationship targets of other properties in order to keep them @@ -274,20 +306,16 @@ class UsdNamespaceEditor }; std::vector targetPathListOpEdits; + // Full set of namespace edits that need to be performed for all the + // dependent stages of this editor as a result of dependencies on the + // initial spec move edits. + PcpDependentNamespaceEdits dependentStageNamespaceEdits; + // List of errors encountered that would prevent connection and // relationship target edits from being performed in response to the // namespace edits. std::vector targetPathListOpErrors; - // Reparent edits may require overs to be created for the new parent if - // a layer doesn't have any specs for the parent yet. This specifies the - // path of the parent specs to create if need. - SdfPath createParentSpecIfNeededPath; - - // Some edits want to remove inert ancestor overs after a prim is - // removed from its parent spec in a layer. - bool removeInertAncestorOvers = false; - // Applies this processed edit, performing the individual edits // necessary to each layer that needs to be updated. bool Apply(); @@ -321,6 +349,10 @@ class UsdNamespaceEditor class _EditProcessor; UsdStageRefPtr _stage; + // Dependent stage order should be arbitrary but we want don't want + // duplicates which can cause unnecessary work. + using _StageSet = std::unordered_set; + _StageSet _dependentStages; EditOptions _editOptions; _EditDescription _editDescription; mutable std::optional<_ProcessedEdit> _processedEdit; diff --git a/pxr/usd/usd/stage.h b/pxr/usd/usd/stage.h index d087278058..4aff716918 100644 --- a/pxr/usd/usd/stage.h +++ b/pxr/usd/usd/stage.h @@ -2362,6 +2362,7 @@ class UsdStage : public TfRefBase, public TfWeakBase { friend class UsdAttributeQuery; friend class UsdEditTarget; friend class UsdInherits; + friend class UsdNamespaceEditor; friend class UsdObject; friend class UsdPrim; friend class UsdProperty; diff --git a/pxr/usd/usd/wrapNamespaceEditor.cpp b/pxr/usd/usd/wrapNamespaceEditor.cpp index b02a0b04fa..5a03c4f2eb 100644 --- a/pxr/usd/usd/wrapNamespaceEditor.cpp +++ b/pxr/usd/usd/wrapNamespaceEditor.cpp @@ -57,6 +57,10 @@ void wrapUsdNamespaceEditor() .def(init()) .def(init()) + .def("AddDependentStage", &This::AddDependentStage) + .def("RemoveDependentStage", &This::RemoveDependentStage) + .def("SetDependentStages", &This::SetDependentStages) + .def("DeletePrimAtPath", &This::DeletePrimAtPath) .def("MovePrimAtPath", &This::MovePrimAtPath) From b720f73d42353f020377abc3bb11ec98d05967b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rob=20Piek=C3=A9?= Date: Tue, 8 Oct 2024 15:04:00 +0100 Subject: [PATCH 06/82] Ensuring the SceneDelegate pulls the "correct" (RenderDelegate-preferred) material binding. Note there still remain calls to the generic GetMaterialBinding() in: * collectionPredicateLibrary - hd * materialPrimvarTransferSceneIndex - hdSi * dependencySceneIndexPlugin - hdSt * retesselationSceneIndexPlugin - hdPrman --- .../hd/sceneIndexAdapterSceneDelegate.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pxr/imaging/hd/sceneIndexAdapterSceneDelegate.cpp b/pxr/imaging/hd/sceneIndexAdapterSceneDelegate.cpp index 8919d6a421..eeecf95417 100644 --- a/pxr/imaging/hd/sceneIndexAdapterSceneDelegate.cpp +++ b/pxr/imaging/hd/sceneIndexAdapterSceneDelegate.cpp @@ -477,11 +477,11 @@ _IsVisible(const HdContainerDataSourceHandle& primSource) } static SdfPath -_GetBoundMaterialPath(const HdContainerDataSourceHandle& ds) +_GetBoundMaterialPath(const HdContainerDataSourceHandle& ds, const TfToken& purpose) { if (const auto bindingsSchema = HdMaterialBindingsSchema::GetFromParent(ds)) { if (const HdMaterialBindingSchema bindingSchema = - bindingsSchema.GetMaterialBinding()) { + bindingsSchema.GetMaterialBinding(purpose)) { if (const HdPathDataSourceHandle ds = bindingSchema.GetPath()) { return ds->GetTypedValue(0.0f); } @@ -514,7 +514,8 @@ static void _GatherGeomSubsets( const SdfPath& parentPath, const HdSceneIndexBaseRefPtr& sceneIndex, - HdTopology* topology) + HdTopology* topology, + const TfToken& materialBindingPurpose) { TF_VERIFY(topology); HdGeomSubsets subsets; @@ -563,7 +564,7 @@ _GatherGeomSubsets( } continue; } - const SdfPath materialId = _GetBoundMaterialPath(child.dataSource); + const SdfPath materialId = _GetBoundMaterialPath(child.dataSource, materialBindingPurpose); if (materialId.IsEmpty()) { continue; } @@ -631,8 +632,9 @@ HdSceneIndexAdapterSceneDelegate::GetMeshTopology(SdfPath const &id) faceVertexCountsDataSource->GetTypedValue(0.0f), faceVertexIndicesDataSource->GetTypedValue(0.0f), holeIndices); - - _GatherGeomSubsets(id, _inputSceneIndex, &meshTopology); + + TfToken materialBindingPurpose = GetRenderIndex().GetRenderDelegate()->GetMaterialBindingPurpose(); + _GatherGeomSubsets(id, _inputSceneIndex, &meshTopology, materialBindingPurpose); return meshTopology; } @@ -916,8 +918,9 @@ HdSceneIndexAdapterSceneDelegate::GetMaterialId(SdfPath const & id) HdMaterialBindingsSchema materialBindings = HdMaterialBindingsSchema::GetFromParent( prim.dataSource); + TfToken purpose = GetRenderIndex().GetRenderDelegate()->GetMaterialBindingPurpose(); HdMaterialBindingSchema materialBinding = - materialBindings.GetMaterialBinding(); + materialBindings.GetMaterialBinding(purpose); if (HdPathDataSourceHandle const ds = materialBinding.GetPath()) { return ds->GetTypedValue(0.0f); } From d51366bb31e871d154606bf0f09bd3464688a1a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rob=20Piek=C3=A9?= Date: Tue, 8 Oct 2024 15:35:26 +0100 Subject: [PATCH 07/82] Missed two lines from the previous commit --- pxr/imaging/hd/sceneIndexAdapterSceneDelegate.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pxr/imaging/hd/sceneIndexAdapterSceneDelegate.cpp b/pxr/imaging/hd/sceneIndexAdapterSceneDelegate.cpp index eeecf95417..bf6271d5be 100644 --- a/pxr/imaging/hd/sceneIndexAdapterSceneDelegate.cpp +++ b/pxr/imaging/hd/sceneIndexAdapterSceneDelegate.cpp @@ -843,7 +843,8 @@ HdSceneIndexAdapterSceneDelegate::GetBasisCurvesTopology(SdfPath const &id) curveVertexCountsDataSource->GetTypedValue(0.0f), curveIndices); - _GatherGeomSubsets(id, _inputSceneIndex, &result); + TfToken materialBindingPurpose = GetRenderIndex().GetRenderDelegate()->GetMaterialBindingPurpose(); + _GatherGeomSubsets(id, _inputSceneIndex, &result, materialBindingPurpose); return result; } From aa32ba06744314102847d157444ebfdef4395da7 Mon Sep 17 00:00:00 2001 From: matthewcpp Date: Wed, 9 Oct 2024 13:47:38 -0700 Subject: [PATCH 08/82] This change provides additional performance improvements to the fined grained PCP changelists that were added in 2342828. When processing changes for large stages, the PcpChanges::_didChangeSpecsInternal set could grow very large. A performance gain can be realized by performing a more restrive dependency search and storing only topmost specs that changed in a new set. When applying changes to the cache, the prim index is used to determine the full set of specs to update. Additionally when muting and unmuting layers, we also perform a more restrive dependency search by only recusing on site paths. (Internal change: 2343722) --- pxr/usd/pcp/cache.cpp | 7 +++++ pxr/usd/pcp/changes.cpp | 67 +++++++++++++++++++++++++++++------------ pxr/usd/pcp/changes.h | 32 ++++++++++++++------ 3 files changed, 77 insertions(+), 29 deletions(-) diff --git a/pxr/usd/pcp/cache.cpp b/pxr/usd/pcp/cache.cpp index 00b771227b..0713a7cd8c 100644 --- a/pxr/usd/pcp/cache.cpp +++ b/pxr/usd/pcp/cache.cpp @@ -1073,6 +1073,13 @@ PcpCache::Apply(const PcpCacheChanges& changes, PcpLifeboat* lifeboat) updateSpecStacks(*i); } + TF_FOR_ALL(i, changes._didChangeSpecsAndChildrenInternal) { + auto range = _primIndexCache.FindSubtreeRange(*i); + for (auto i = range.first; i != range.second; ++i) { + updateSpecStacks(i->first); + } + } + // Fix the keys for any prim or property under any of the renamed // paths. // XXX: It'd be nice if this was a usd by just adjusting diff --git a/pxr/usd/pcp/changes.cpp b/pxr/usd/pcp/changes.cpp index face9b44bc..0ee2c19e30 100644 --- a/pxr/usd/pcp/changes.cpp +++ b/pxr/usd/pcp/changes.cpp @@ -1446,13 +1446,15 @@ void PcpChanges::DidMuteAndUnmuteLayers( } } -void PcpChanges::_ProcessLayerStackAndDependencyChanges( +void +PcpChanges::_MarkReferencingSitesAsSignificantlyChanged( const PcpCache* cache, - const PcpLayerStackPtrVector& layerStacks, - bool markRefsOrPayloadSitesAsChanged) + const PcpLayerStackPtrVector& layerStacks) { TRACE_FUNCTION(); + const PcpCacheChanges& cacheChanges = _GetCacheChanges(cache); + const auto refOrPayloadChangeFunc = [this, cache](const SdfPath &depIndexPath, const PcpNodeRef &node) @@ -1465,40 +1467,59 @@ void PcpChanges::_ProcessLayerStackAndDependencyChanges( } }; - for (const PcpLayerStackPtr& layerStack : layerStacks) { - _DidChangeLayerStack(cache, - layerStack, - /*requiresLayerStackChange*/ true, - /*requiresLayerStackOffsetsChange*/ false, - /*requiresSignificantChange*/ true); - PcpDependencyVector deps = cache->FindSiteDependencies( layerStack, SdfPath::AbsoluteRootPath(), PcpDependencyTypeAnyIncludingVirtual, /* recurseOnSite */ true, - /* recurseOnIndex */ true, + /* recurseOnIndex */ false, /* filter */ true); for(const PcpDependency &dep: deps) { // This ensures that all sites which reference this layer are // also marked as having changed significantly. - if (markRefsOrPayloadSitesAsChanged && - PcpComposeSiteHasPrimSpecs(layerStack, dep.sitePath)) + if (PcpComposeSiteHasPrimSpecs( + layerStack, dep.sitePath, cacheChanges.layersToMute)) { Pcp_ForEachDependentNode(dep.sitePath, layerStack, dep.indexPath, *cache, refOrPayloadChangeFunc); } + } + } +} + +void +PcpChanges::_ProcessLayerStackAndDependencyChanges( + const PcpCache* cache, + const PcpLayerStackPtrVector& layerStacks) +{ + TRACE_FUNCTION(); + for (const PcpLayerStackPtr& layerStack : layerStacks) { + _DidChangeLayerStack(cache, + layerStack, + /*requiresLayerStackChange*/ true, + /*requiresLayerStackOffsetsChange*/ false, + /*requiresSignificantChange*/ true); + + PcpDependencyVector deps = cache->FindSiteDependencies( + layerStack, + SdfPath::AbsoluteRootPath(), + PcpDependencyTypeAnyIncludingVirtual, + /* recurseOnSite */ false, + /* recurseOnIndex */ false, + /* filter */ true); + + for(const PcpDependency &dep: deps) { // We also need to mark dependencies spec stacks as changed due to // the fact that the addition or removal of layers will result in // the need of prim stack indicies to be updated. // Note that property indexes don't have to be updated because they // hold on to spec objects directly instead of being index-based. if (dep.indexPath.IsAbsoluteRootOrPrimPath()) { - _DidChangeSpecStackInternal(cache, dep.indexPath); + _DidChangeSpecStackAndChildrenInternal(cache, dep.indexPath); } } } @@ -1549,8 +1570,8 @@ PcpChanges::_DidMuteLayer( std::move(changes.front())); _lifeboat.Retain(mutedLayer); - _ProcessLayerStackAndDependencyChanges(cache, layerStacks, - /*markRefsOrPayloadSitesAsChanged*/ true); + _ProcessLayerStackAndDependencyChanges(cache, layerStacks); + _MarkReferencingSitesAsSignificantlyChanged(cache, layerStacks); } cacheChanges.didMuteOrUnmuteNonEmptyLayer |= @@ -1612,8 +1633,8 @@ PcpChanges::_DidUnmuteLayer( std::move(changes.front())); _lifeboat.Retain(unmutedLayer); - _ProcessLayerStackAndDependencyChanges(cache, layerStacks, - /*markRefsOrPayloadSitesAsChanged*/ true); + _ProcessLayerStackAndDependencyChanges(cache, layerStacks); + _MarkReferencingSitesAsSignificantlyChanged(cache, layerStacks); } cacheChanges.didMuteOrUnmuteNonEmptyLayer |= @@ -2218,8 +2239,7 @@ PcpChanges::_DidAddOrRemoveSublayer( empty, /*compareFieldValues*/ false))); } - _ProcessLayerStackAndDependencyChanges(cache, layerStacks, - /*markRefsOrPayloadSitesAsChanged*/ false); + _ProcessLayerStackAndDependencyChanges(cache, layerStacks); DidChange(cache, changes); @@ -2835,4 +2855,11 @@ PcpChanges::_DidChangeSpecStackInternal( _GetCacheChanges(cache)._didChangeSpecsInternal.insert(path); } +void +PcpChanges::_DidChangeSpecStackAndChildrenInternal( + const PcpCache* cache, const SdfPath& path) +{ + _GetCacheChanges(cache)._didChangeSpecsAndChildrenInternal.insert(path); +} + PXR_NAMESPACE_CLOSE_SCOPE diff --git a/pxr/usd/pcp/changes.h b/pxr/usd/pcp/changes.h index 777ac5b437..70298f6b64 100644 --- a/pxr/usd/pcp/changes.h +++ b/pxr/usd/pcp/changes.h @@ -150,6 +150,13 @@ class PcpCacheChanges { // not its contents. Because this causes no externally-observable // changes in state, clients do not need to be aware of these changes. SdfPathSet _didChangeSpecsInternal; + + // This set serves a similar purpose to _didChangeSpecsInternal above, + // however, during processing descendants of the specs in this set will also + // be marked as changed. A performance gain is accomplished by placing the + // ancestor specs in this set and marking children iteratively when applying + // changes to the cache. + SdfPathSet _didChangeSpecsAndChildrenInternal; }; /// Structure used to temporarily retain layers and layerStacks within @@ -436,17 +443,24 @@ class PcpChanges { void _DidChangeSpecStackInternal( const PcpCache* cache, const SdfPath& path); - // During change processing for added/removed or muted/unmuted layers, - // layer stacks and dependant paths need to be marked as having changed - // so that relevant data can be recalculated when the cache is applied. - // The \p markRefsOrPayloadSitesAsChanged parameter controls if, when - // traversing dependencies, if one is introduced via a reference or - // payload then that site will be marked as having changed significantly. - // This is set when processing changes for muted and unmuted layers. + void _DidChangeSpecStackAndChildrenInternal( + const PcpCache* cache, const SdfPath& path); + + // This method is used when processing layer operations. It ensures that + // affected layer stacks and their dependent spec stacks are marked as + // changed. void _ProcessLayerStackAndDependencyChanges( const PcpCache* cache, - const PcpLayerStackPtrVector& layerStacks, - bool markRefsOrPayloadSitesAsChanged); + const PcpLayerStackPtrVector& layerStacks); + + // When muting or unmuting a layer that is being referenced or payloaded, + // we need to ensure that all the relevant sites are recomposed. This + // function searches site dependencies of the provided layer stacks and + // marks those that are introduced via reference or payload arcs as + // significantly changed. + void _MarkReferencingSitesAsSignificantlyChanged( + const PcpCache* cache, + const PcpLayerStackPtrVector& layerStacks); private: LayerStackChanges _layerStackChanges; From a9518c5a23d53377d25747d66439d109d8fa8cb3 Mon Sep 17 00:00:00 2001 From: sunyab Date: Wed, 9 Oct 2024 13:49:48 -0700 Subject: [PATCH 09/82] docs: Fix incorrect formatting of Python code in tutorial (Internal change: 2343770) --- docs/tut_inspect_and_author_props.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tut_inspect_and_author_props.rst b/docs/tut_inspect_and_author_props.rst index 54b24027c2..a2535fc67f 100644 --- a/docs/tut_inspect_and_author_props.rst +++ b/docs/tut_inspect_and_author_props.rst @@ -79,7 +79,7 @@ Tutorial .. code-block:: pycon >>> radiusAttr = sphere.GetAttribute('radius') - >>> radiusAttr.Set(2) + >>> radiusAttr.Set(2) True >>> extentAttr.Set(extentAttr.Get() * 2) True From 9f2c7687db3bd809f8c276c9abcae5c5ba96012c Mon Sep 17 00:00:00 2001 From: pixar-oss Date: Thu, 10 Oct 2024 10:58:37 -0700 Subject: [PATCH 10/82] Doc fix for incorrect heading for new usdSemantics overview page (Internal change: 2344176) --- pxr/usd/usdSemantics/overview.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pxr/usd/usdSemantics/overview.md b/pxr/usd/usdSemantics/overview.md index ecefaffbee..1eb804b00d 100644 --- a/pxr/usd/usdSemantics/overview.md +++ b/pxr/usd/usdSemantics/overview.md @@ -1,3 +1,4 @@ +# UsdSemantics : Semantic Labeling for Model Hierarchy {#usd_semantics_overview} \if ( PIXAR_MFB_BUILD ) \mainpage UsdSemantics : Semantic Labeling for Model Hierarchy \endif @@ -110,7 +111,7 @@ of a car prim" could be modeled by filtering the scene graph by prims with direct label `wheel` and whose parent has an inherited label `car`. ## Relationship to Other Domains -### `UsdGeom` +### UsdGeom The most common application of semantic labels will be to `Gprim`s and their ancestral `Scope`s and `Xform`s. @@ -120,7 +121,7 @@ labels as well. For example `/Human/Face` `Mesh` prim may have a `/Human/Face/LeftEar` and `/Human/Face/RightEar` `GeomSubset`s with `["ear"]` labels applied. -### `UsdShade` +### UsdShade `Material`s may be semantically labeled as well. For example, a `RustyMetal` Material could be semantically labeled with both `metal` and `corroded` labels. As `usdSemantics` is a domain separate from `UsdGeom` and `UsdShade`, there are @@ -167,7 +168,7 @@ purposes, there's no specification for if or how labels should feed into render products, as shader nodes and node graphs (unlike `UsdGeomSubset`) generally don't yield discrete segmentations. -### `UsdRender` (To be proposed and implemented) +### UsdRender (To be proposed and implemented) A common application of semantics is for downstream labeling and segmentation of renderer output. Semantics may make their way into outputs as either additional metadata or as matte channels. \ No newline at end of file From ca0b7db8dc1742ade20a8e450be4196bb79693aa Mon Sep 17 00:00:00 2001 From: anwang2009 Date: Thu, 10 Oct 2024 10:59:12 -0700 Subject: [PATCH 11/82] Propagate performance data for the 24.11 release (Internal change: 2344182) --- docs/performance/24.11_linux_alab.yaml | 40 + docs/performance/24.11_linux_kitchenset.yaml | 40 + docs/performance/24.11_linux_moorelane.yaml | 40 + docs/performance/24.11_linux_shaderball.yaml | 40 + docs/performance/24.11_macos_alab.yaml | 40 + docs/performance/24.11_macos_kitchenset.yaml | 40 + docs/performance/24.11_macos_moorelane.yaml | 40 + docs/performance/24.11_macos_shaderball.yaml | 40 + docs/performance/24.11_windows_alab.yaml | 40 + .../performance/24.11_windows_kitchenset.yaml | 40 + docs/performance/24.11_windows_moorelane.yaml | 40 + .../performance/24.11_windows_shaderball.yaml | 40 + docs/performance/linux.svg | 1457 ++++++++++++++++ docs/performance/macos.svg | 1536 +++++++++++++++++ docs/performance/windows.svg | 1396 +++++++++++++++ docs/python/genPerformancePlots.py | 10 +- 16 files changed, 4878 insertions(+), 1 deletion(-) create mode 100644 docs/performance/24.11_linux_alab.yaml create mode 100644 docs/performance/24.11_linux_kitchenset.yaml create mode 100644 docs/performance/24.11_linux_moorelane.yaml create mode 100644 docs/performance/24.11_linux_shaderball.yaml create mode 100644 docs/performance/24.11_macos_alab.yaml create mode 100644 docs/performance/24.11_macos_kitchenset.yaml create mode 100644 docs/performance/24.11_macos_moorelane.yaml create mode 100644 docs/performance/24.11_macos_shaderball.yaml create mode 100644 docs/performance/24.11_windows_alab.yaml create mode 100644 docs/performance/24.11_windows_kitchenset.yaml create mode 100644 docs/performance/24.11_windows_moorelane.yaml create mode 100644 docs/performance/24.11_windows_shaderball.yaml create mode 100644 docs/performance/linux.svg create mode 100644 docs/performance/macos.svg create mode 100644 docs/performance/windows.svg diff --git a/docs/performance/24.11_linux_alab.yaml b/docs/performance/24.11_linux_alab.yaml new file mode 100644 index 0000000000..e663ce2e08 --- /dev/null +++ b/docs/performance/24.11_linux_alab.yaml @@ -0,0 +1,40 @@ +bring_up_the_ui: + max: 0.833684 + mean: 0.7791103 + min: 0.734001 +close_stage: + max: 0.090772 + mean: 0.0874594 + min: 0.084709 +configure_and_load_plugins: + max: 0.000148 + mean: 0.0001375 + min: 0.000131 +create_first_image: + max: 8.556198 + mean: 8.1684536 + min: 7.897517 +open_and_close_usdview: + max: 9.691212 + mean: 9.3458374 + min: 9.062105 +open_stage: + max: 0.516364 + mean: 0.4642872 + min: 0.39004 +reset_prim_browser: + max: 0.001795 + mean: 0.0017705 + min: 0.001751 +shut_down_hydra: + max: 0.165165 + mean: 0.1328269 + min: 0.12083 +tear_down_the_ui: + max: 0.038048 + mean: 0.032411 + min: 0.022262 +traverse_stage: + max: 0.007567 + mean: 0.007379999999999999 + min: 0.007251 diff --git a/docs/performance/24.11_linux_kitchenset.yaml b/docs/performance/24.11_linux_kitchenset.yaml new file mode 100644 index 0000000000..97ce174c34 --- /dev/null +++ b/docs/performance/24.11_linux_kitchenset.yaml @@ -0,0 +1,40 @@ +bring_up_the_ui: + max: 0.387106 + mean: 0.3487857 + min: 0.329509 +close_stage: + max: 0.007835 + mean: 0.0074928 + min: 0.007057 +configure_and_load_plugins: + max: 0.000144 + mean: 0.00013680000000000002 + min: 0.000129 +create_first_image: + max: 0.3028 + mean: 0.2903682 + min: 0.279229 +open_and_close_usdview: + max: 0.847958 + mean: 0.7911669 + min: 0.752613 +open_stage: + max: 0.107452 + mean: 0.0842476 + min: 0.069993 +reset_prim_browser: + max: 0.001205 + mean: 0.0011894 + min: 0.001163 +shut_down_hydra: + max: 0.009617 + mean: 0.0093791 + min: 0.009247 +tear_down_the_ui: + max: 0.009307 + mean: 0.0080869 + min: 0.006491 +traverse_stage: + max: 0.001312 + mean: 0.0012427 + min: 0.001213 diff --git a/docs/performance/24.11_linux_moorelane.yaml b/docs/performance/24.11_linux_moorelane.yaml new file mode 100644 index 0000000000..d8e463d34e --- /dev/null +++ b/docs/performance/24.11_linux_moorelane.yaml @@ -0,0 +1,40 @@ +bring_up_the_ui: + max: 0.617653 + mean: 0.603799 + min: 0.598502 +close_stage: + max: 0.02107 + mean: 0.0207992 + min: 0.020613 +configure_and_load_plugins: + max: 0.000177 + mean: 0.00014000000000000001 + min: 0.000131 +create_first_image: + max: 11.776089 + mean: 11.6368226 + min: 11.484618 +open_and_close_usdview: + max: 12.911434 + mean: 12.757864399999999 + min: 12.587016 +open_stage: + max: 0.094023 + mean: 0.0791025 + min: 0.075535 +reset_prim_browser: + max: 0.009577 + mean: 0.0094567 + min: 0.009369 +shut_down_hydra: + max: 0.138991 + mean: 0.1194904 + min: 0.103945 +tear_down_the_ui: + max: 0.117169 + mean: 0.113112 + min: 0.110088 +traverse_stage: + max: 0.001397 + mean: 0.0013728 + min: 0.001346 diff --git a/docs/performance/24.11_linux_shaderball.yaml b/docs/performance/24.11_linux_shaderball.yaml new file mode 100644 index 0000000000..bab10efdde --- /dev/null +++ b/docs/performance/24.11_linux_shaderball.yaml @@ -0,0 +1,40 @@ +bring_up_the_ui: + max: 0.43229 + mean: 0.4245096 + min: 0.419582 +close_stage: + max: 0.000754 + mean: 0.0006054 + min: 0.000499 +configure_and_load_plugins: + max: 0.000142 + mean: 0.0001347 + min: 0.000129 +create_first_image: + max: 2.904303 + mean: 2.8882178 + min: 2.870519 +open_and_close_usdview: + max: 3.479013 + mean: 3.464824 + min: 3.44698 +open_stage: + max: 0.150255 + mean: 0.1480813 + min: 0.144294 +reset_prim_browser: + max: 0.001618 + mean: 0.0015671 + min: 0.001534 +shut_down_hydra: + max: 0.022668 + mean: 0.0223569 + min: 0.022082 +tear_down_the_ui: + max: 0.011874 + mean: 0.0116779 + min: 0.011499 +traverse_stage: + max: 0.000408 + mean: 0.000371 + min: 0.000353 diff --git a/docs/performance/24.11_macos_alab.yaml b/docs/performance/24.11_macos_alab.yaml new file mode 100644 index 0000000000..379a2294c3 --- /dev/null +++ b/docs/performance/24.11_macos_alab.yaml @@ -0,0 +1,40 @@ +bring_up_the_ui: + max: 0.697076 + mean: 0.6728786999999999 + min: 0.659187 +close_stage: + max: 0.041104 + mean: 0.037702 + min: 0.034878 +configure_and_load_plugins: + max: 0.000113 + mean: 8.23e-05 + min: 7.6e-05 +create_first_image: + max: N/A + mean: N/A + min: N/A +open_and_close_usdview: + max: 5.956596 + mean: 5.824605200000001 + min: 5.66041 +open_stage: + max: 0.44761 + mean: 0.4308989 + min: 0.419115 +reset_prim_browser: + max: 0.00096 + mean: 0.0008801 + min: 0.000856 +shut_down_hydra: + max: 0.120492 + mean: 0.10805630000000001 + min: 0.100348 +tear_down_the_ui: + max: 0.01839 + mean: 0.0158125 + min: 0.013213 +traverse_stage: + max: 0.003488 + mean: 0.003359 + min: 0.003253 diff --git a/docs/performance/24.11_macos_kitchenset.yaml b/docs/performance/24.11_macos_kitchenset.yaml new file mode 100644 index 0000000000..48b059ae13 --- /dev/null +++ b/docs/performance/24.11_macos_kitchenset.yaml @@ -0,0 +1,40 @@ +bring_up_the_ui: + max: 0.330342 + mean: 0.2986121 + min: 0.285973 +close_stage: + max: 0.002519 + mean: 0.0023587 + min: 0.002246 +configure_and_load_plugins: + max: 0.000102 + mean: 8.19e-05 + min: 7.6e-05 +create_first_image: + max: N/A + mean: N/A + min: N/A +open_and_close_usdview: + max: 0.730075 + mean: 0.6935303 + min: 0.674505 +open_stage: + max: 0.09047 + mean: 0.0732717 + min: 0.06026 +reset_prim_browser: + max: 0.000624 + mean: 0.0005443 + min: 0.000491 +shut_down_hydra: + max: 0.013024 + mean: 0.0102488 + min: 0.006481 +tear_down_the_ui: + max: 0.015206 + mean: 0.0131009 + min: 0.01074 +traverse_stage: + max: 0.000696 + mean: 0.0005692 + min: 0.000534 diff --git a/docs/performance/24.11_macos_moorelane.yaml b/docs/performance/24.11_macos_moorelane.yaml new file mode 100644 index 0000000000..dac595425f --- /dev/null +++ b/docs/performance/24.11_macos_moorelane.yaml @@ -0,0 +1,40 @@ +bring_up_the_ui: + max: 0.47858 + mean: 0.4695382 + min: 0.45761 +close_stage: + max: 0.00522 + mean: 0.0036797 + min: 0.003298 +configure_and_load_plugins: + max: 7.9e-05 + mean: 7.47e-05 + min: 7.2e-05 +create_first_image: + max: N/A + mean: N/A + min: N/A +open_and_close_usdview: + max: 8.820797 + mean: 8.5296113 + min: 8.308413 +open_stage: + max: 0.086856 + mean: 0.0859231 + min: 0.085466 +reset_prim_browser: + max: 0.005902 + mean: 0.0055684 + min: 0.005406 +shut_down_hydra: + max: 0.28412 + mean: 0.2741197 + min: 0.222393 +tear_down_the_ui: + max: 0.045497 + mean: 0.0383143 + min: 0.035085 +traverse_stage: + max: 0.000605 + mean: 0.0005794 + min: 0.000564 diff --git a/docs/performance/24.11_macos_shaderball.yaml b/docs/performance/24.11_macos_shaderball.yaml new file mode 100644 index 0000000000..d39901392b --- /dev/null +++ b/docs/performance/24.11_macos_shaderball.yaml @@ -0,0 +1,40 @@ +bring_up_the_ui: + max: 0.343762 + mean: 0.3297607 + min: 0.317855 +close_stage: + max: 0.000296 + mean: 0.0002641 + min: 0.000241 +configure_and_load_plugins: + max: 9.8e-05 + mean: 8.26e-05 + min: 7.6e-05 +create_first_image: + max: N/A + mean: N/A + min: N/A +open_and_close_usdview: + max: 1.152715 + mean: 1.1196469 + min: 1.096133 +open_stage: + max: 0.098122 + mean: 0.0901067 + min: 0.088529 +reset_prim_browser: + max: 0.000821 + mean: 0.0006841 + min: 0.000646 +shut_down_hydra: + max: 0.014153 + mean: 0.0116556 + min: 0.009064 +tear_down_the_ui: + max: 0.016629 + mean: 0.014055 + min: 0.01147 +traverse_stage: + max: 0.000291 + mean: 0.0002508 + min: 0.000229 diff --git a/docs/performance/24.11_windows_alab.yaml b/docs/performance/24.11_windows_alab.yaml new file mode 100644 index 0000000000..165b55d245 --- /dev/null +++ b/docs/performance/24.11_windows_alab.yaml @@ -0,0 +1,40 @@ +bring_up_the_ui: + max: 4.316167 + mean: 4.2385264 + min: 4.20729 +close_stage: + max: 0.364083 + mean: 0.35308 + min: 0.337716 +configure_and_load_plugins: + max: 0.000995 + mean: 0.0009473 + min: 0.000878 +create_first_image: + max: 11.738015 + mean: 11.290158 + min: 11.070572 +open_and_close_usdview: + max: 17.118413 + mean: 16.5591656 + min: 16.291877 +open_stage: + max: 0.465223 + mean: 0.4604347 + min: 0.453708 +reset_prim_browser: + max: 0.004434 + mean: 0.0042978 + min: 0.004152 +shut_down_hydra: + max: 0.384717 + mean: 0.2734629 + min: 0.219807 +tear_down_the_ui: + max: 0.309065 + mean: 0.2477569 + min: 0.122124 +traverse_stage: + max: 0.009832 + mean: 0.0080616 + min: 0.007263 diff --git a/docs/performance/24.11_windows_kitchenset.yaml b/docs/performance/24.11_windows_kitchenset.yaml new file mode 100644 index 0000000000..80a34d5e87 --- /dev/null +++ b/docs/performance/24.11_windows_kitchenset.yaml @@ -0,0 +1,40 @@ +bring_up_the_ui: + max: 4.095108 + mean: 3.9744485999999997 + min: 3.868397 +close_stage: + max: 0.024004 + mean: 0.0215864 + min: 0.019616 +configure_and_load_plugins: + max: 0.001014 + mean: 0.0009288 + min: 0.000885 +create_first_image: + max: 3.086248 + mean: 2.9800833 + min: 2.862769 +open_and_close_usdview: + max: 7.451705 + mean: 7.1910904 + min: 6.959639 +open_stage: + max: 0.177268 + mean: 0.1491912 + min: 0.13587 +reset_prim_browser: + max: 0.006285 + mean: 0.0041532 + min: 0.003499 +shut_down_hydra: + max: 0.023532 + mean: 0.0217044 + min: 0.020476 +tear_down_the_ui: + max: 0.110098 + mean: 0.060470300000000005 + min: 0.050172 +traverse_stage: + max: 0.002 + mean: 0.0019016 + min: 0.001795 diff --git a/docs/performance/24.11_windows_moorelane.yaml b/docs/performance/24.11_windows_moorelane.yaml new file mode 100644 index 0000000000..3ca24a90d3 --- /dev/null +++ b/docs/performance/24.11_windows_moorelane.yaml @@ -0,0 +1,40 @@ +bring_up_the_ui: + max: N/A + mean: N/A + min: N/A +close_stage: + max: N/A + mean: N/A + min: N/A +configure_and_load_plugins: + max: N/A + mean: N/A + min: N/A +create_first_image: + max: N/A + mean: N/A + min: N/A +open_and_close_usdview: + max: N/A + mean: N/A + min: N/A +open_stage: + max: N/A + mean: N/A + min: N/A +reset_prim_browser: + max: N/A + mean: N/A + min: N/A +shut_down_hydra: + max: N/A + mean: N/A + min: N/A +tear_down_the_ui: + max: N/A + mean: N/A + min: N/A +traverse_stage: + max: N/A + mean: N/A + min: N/A diff --git a/docs/performance/24.11_windows_shaderball.yaml b/docs/performance/24.11_windows_shaderball.yaml new file mode 100644 index 0000000000..fc6496fca1 --- /dev/null +++ b/docs/performance/24.11_windows_shaderball.yaml @@ -0,0 +1,40 @@ +bring_up_the_ui: + max: 4.444394 + mean: 4.0969829 + min: 4.007564 +close_stage: + max: 0.002616 + mean: 0.0017503 + min: 0.001371 +configure_and_load_plugins: + max: 0.00118 + mean: 0.0009801 + min: 0.00086 +create_first_image: + max: 4.963428 + mean: 4.7824023 + min: 4.546317 +open_and_close_usdview: + max: 9.518625 + mean: 9.09599 + min: 8.81436 +open_stage: + max: 0.320872 + mean: 0.2995894 + min: 0.284833 +reset_prim_browser: + max: 0.004614 + mean: 0.0041768 + min: 0.003919 +shut_down_hydra: + max: 0.04744 + mean: 0.0423858 + min: 0.040305 +tear_down_the_ui: + max: 0.057904 + mean: 0.0550358 + min: 0.050231 +traverse_stage: + max: 0.001217 + mean: 0.0011315 + min: 0.001047 diff --git a/docs/performance/linux.svg b/docs/performance/linux.svg new file mode 100644 index 0000000000..72324c5b8b --- /dev/null +++ b/docs/performance/linux.svg @@ -0,0 +1,1457 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/performance/macos.svg b/docs/performance/macos.svg new file mode 100644 index 0000000000..f338f5f484 --- /dev/null +++ b/docs/performance/macos.svg @@ -0,0 +1,1536 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/performance/windows.svg b/docs/performance/windows.svg new file mode 100644 index 0000000000..ae18c642e8 --- /dev/null +++ b/docs/performance/windows.svg @@ -0,0 +1,1396 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/python/genPerformancePlots.py b/docs/python/genPerformancePlots.py index 2c6ff08435..a8e3f59160 100644 --- a/docs/python/genPerformancePlots.py +++ b/docs/python/genPerformancePlots.py @@ -41,6 +41,8 @@ def collectData(dataDir: str): with open(os.path.join(dataDir, yamlname)) as f: metrics = yaml.safe_load(f) time = metrics[METRIC_ID]["min"] + if type(time) is not float: + continue if asset not in data[platform]: data[platform][asset] = [] @@ -51,6 +53,12 @@ def collectData(dataDir: str): def exportCharts(data, outputDir: str): + markers = { + "alab": "d", + "kitchenset": "s", + "moorelane": "^", + "shaderball": "o" + } for platform, platformData in data.items(): fig, _ = plt.subplots() plt.close(fig) @@ -61,7 +69,7 @@ def exportCharts(data, outputDir: str): for asset, assetData in platformData.items(): releases = [d[0] for d in assetData] times = [d[1] for d in assetData] - plt.plot(releases, times, label=asset, marker='o') + plt.plot(releases, times, label=asset, marker=markers[asset]) plt.title(f"{platform} time to open and close usdview", fontweight="bold") From 2bcc9ab2e9c8ca2e6ad9594da61ecefca5843eb5 Mon Sep 17 00:00:00 2001 From: pixar-oss Date: Thu, 10 Oct 2024 10:59:50 -0700 Subject: [PATCH 12/82] Updating perf metrics page for latest metrics (Internal change: 2344231) --- docs/ref_performance_metrics.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/ref_performance_metrics.rst b/docs/ref_performance_metrics.rst index c60e0dbc74..d4b1ad055f 100644 --- a/docs/ref_performance_metrics.rst +++ b/docs/ref_performance_metrics.rst @@ -103,6 +103,13 @@ The following graphs show the time (in seconds) to open and close :program:`usdview` for each asset. Graphs are provided for Linux, macOS, and Windows platforms (as described in :ref:`perf_environments`). +.. note:: + + For the 24.11 release, there are known issues with obtaining metrics for + the Moore Lane asset on Windows, and the create_first_image metric on + macOS. We are actively investigating these issues and will update + published metrics when these issues are resolved. + .. image:: performance/linux.svg :width: 500 From 2a1eb063c783ebf385cb27978d262196b62465c5 Mon Sep 17 00:00:00 2001 From: sunyab Date: Fri, 11 Oct 2024 13:26:26 -0700 Subject: [PATCH 13/82] OpenUSD: Update pch.h to ensure BOOST_PYTHON_* macros are defined The precompiled headers throughout the tree still contain boost::python headers as part of the (temporary) support for reverting to boost::python for Python bindings. We need to include pxr/external/boost/python/common.hpp before these headers to ensure that the BOOST_PYTHON_* macros are set up properly based on the corresponding PXR_BOOST_PYTHON_* macros that are now used in the build. In particular, this fix is needed in ar/pch.h is needed to avoid build errors with the recent ArAsset wrappings in change 2343666 on Windows. The other libraries were updated for consistency. (Internal change: 2344479) --- extras/usd/examples/usdObj/pch.h | 1 + extras/usd/examples/usdSchemaExamples/pch.h | 1 + pxr/base/gf/pch.h | 1 + pxr/base/plug/pch.h | 1 + pxr/base/tf/pch.h | 1 + pxr/base/trace/pch.h | 1 + pxr/base/ts/pch.h | 1 + pxr/base/vt/pch.h | 1 + pxr/base/work/pch.h | 1 + pxr/imaging/cameraUtil/pch.h | 1 + pxr/imaging/garch/pch.h | 1 + pxr/imaging/geomUtil/pch.h | 1 + pxr/imaging/glf/pch.h | 1 + pxr/imaging/hd/pch.h | 1 + pxr/imaging/hdGp/pch.h | 1 + pxr/imaging/hdMtlx/pch.h | 1 + pxr/imaging/hdSt/pch.h | 1 + pxr/imaging/hdar/pch.h | 1 + pxr/imaging/hdsi/pch.h | 1 + pxr/imaging/hdx/pch.h | 1 + pxr/imaging/hgi/pch.h | 1 + pxr/imaging/hgiInterop/pch.h | 1 + pxr/imaging/hio/pch.h | 1 + pxr/imaging/hioOpenVDB/pch.h | 1 + pxr/imaging/plugin/hdEmbree/pch.h | 1 + pxr/imaging/plugin/hdStorm/pch.h | 1 + pxr/imaging/plugin/hioAvif/pch.h | 1 + pxr/imaging/plugin/hioOiio/pch.h | 1 + pxr/imaging/pxOsd/pch.h | 1 + pxr/usd/ar/pch.h | 1 + pxr/usd/kind/pch.h | 1 + pxr/usd/ndr/pch.h | 1 + pxr/usd/pcp/pch.h | 1 + pxr/usd/plugin/sdrOsl/pch.h | 1 + pxr/usd/plugin/usdAbc/pch.h | 1 + pxr/usd/plugin/usdDraco/pch.h | 1 + pxr/usd/sdf/pch.h | 1 + pxr/usd/sdr/pch.h | 1 + pxr/usd/usd/pch.h | 1 + pxr/usd/usdGeom/pch.h | 1 + pxr/usd/usdHydra/pch.h | 1 + pxr/usd/usdLux/pch.h | 1 + pxr/usd/usdMedia/pch.h | 1 + pxr/usd/usdMtlx/pch.h | 1 + pxr/usd/usdPhysics/pch.h | 1 + pxr/usd/usdProc/pch.h | 1 + pxr/usd/usdRender/pch.h | 1 + pxr/usd/usdRi/pch.h | 1 + pxr/usd/usdSemantics/pch.h | 1 + pxr/usd/usdShade/pch.h | 1 + pxr/usd/usdSkel/pch.h | 1 + pxr/usd/usdUI/pch.h | 1 + pxr/usd/usdUtils/pch.h | 1 + pxr/usd/usdVol/pch.h | 1 + pxr/usdImaging/plugin/sdrGlslfx/pch.h | 1 + pxr/usdImaging/plugin/usdShaders/pch.h | 1 + pxr/usdImaging/usdAppUtils/pch.h | 1 + pxr/usdImaging/usdImaging/pch.h | 1 + pxr/usdImaging/usdImagingGL/pch.h | 1 + pxr/usdImaging/usdProcImaging/pch.h | 1 + pxr/usdImaging/usdRiPxrImaging/pch.h | 1 + pxr/usdImaging/usdSkelImaging/pch.h | 1 + pxr/usdImaging/usdVolImaging/pch.h | 1 + pxr/usdImaging/usdviewq/pch.h | 1 + third_party/renderman-26/plugin/rmanArgsParser/pch.h | 1 + 65 files changed, 65 insertions(+) diff --git a/extras/usd/examples/usdObj/pch.h b/extras/usd/examples/usdObj/pch.h index 0050ec378e..88470ee57d 100644 --- a/extras/usd/examples/usdObj/pch.h +++ b/extras/usd/examples/usdObj/pch.h @@ -74,6 +74,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/extras/usd/examples/usdSchemaExamples/pch.h b/extras/usd/examples/usdSchemaExamples/pch.h index 6d53e8bfe4..4852335387 100644 --- a/extras/usd/examples/usdSchemaExamples/pch.h +++ b/extras/usd/examples/usdSchemaExamples/pch.h @@ -69,6 +69,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/base/gf/pch.h b/pxr/base/gf/pch.h index 7f010fc480..c47bc475e6 100644 --- a/pxr/base/gf/pch.h +++ b/pxr/base/gf/pch.h @@ -54,6 +54,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/base/plug/pch.h b/pxr/base/plug/pch.h index 61a25c286b..01267ce3ab 100644 --- a/pxr/base/plug/pch.h +++ b/pxr/base/plug/pch.h @@ -82,6 +82,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/base/tf/pch.h b/pxr/base/tf/pch.h index a7cf61b8b5..0a1e479030 100644 --- a/pxr/base/tf/pch.h +++ b/pxr/base/tf/pch.h @@ -109,6 +109,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/base/trace/pch.h b/pxr/base/trace/pch.h index 3f55f620a5..a284f34fcf 100644 --- a/pxr/base/trace/pch.h +++ b/pxr/base/trace/pch.h @@ -76,6 +76,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/base/ts/pch.h b/pxr/base/ts/pch.h index 4e45f17d93..727470bbff 100644 --- a/pxr/base/ts/pch.h +++ b/pxr/base/ts/pch.h @@ -67,6 +67,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/base/vt/pch.h b/pxr/base/vt/pch.h index 460eeb04cb..28b7999399 100644 --- a/pxr/base/vt/pch.h +++ b/pxr/base/vt/pch.h @@ -72,6 +72,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/base/work/pch.h b/pxr/base/work/pch.h index 25bfece657..0a10f750ff 100644 --- a/pxr/base/work/pch.h +++ b/pxr/base/work/pch.h @@ -61,6 +61,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/imaging/cameraUtil/pch.h b/pxr/imaging/cameraUtil/pch.h index d4afe14ccd..732f9191ad 100644 --- a/pxr/imaging/cameraUtil/pch.h +++ b/pxr/imaging/cameraUtil/pch.h @@ -48,6 +48,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/imaging/garch/pch.h b/pxr/imaging/garch/pch.h index b92e863912..65911b2f89 100644 --- a/pxr/imaging/garch/pch.h +++ b/pxr/imaging/garch/pch.h @@ -67,6 +67,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/imaging/geomUtil/pch.h b/pxr/imaging/geomUtil/pch.h index f67c870717..c619cdeb70 100644 --- a/pxr/imaging/geomUtil/pch.h +++ b/pxr/imaging/geomUtil/pch.h @@ -50,6 +50,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/imaging/glf/pch.h b/pxr/imaging/glf/pch.h index 381a5b9b56..72eaafa515 100644 --- a/pxr/imaging/glf/pch.h +++ b/pxr/imaging/glf/pch.h @@ -87,6 +87,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/imaging/hd/pch.h b/pxr/imaging/hd/pch.h index 3736acbf23..7d86a2b6b3 100644 --- a/pxr/imaging/hd/pch.h +++ b/pxr/imaging/hd/pch.h @@ -75,6 +75,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #if defined(__APPLE__) // Fix breakage caused by Python's pyport.h. diff --git a/pxr/imaging/hdGp/pch.h b/pxr/imaging/hdGp/pch.h index d09b508520..042a1c5a5a 100644 --- a/pxr/imaging/hdGp/pch.h +++ b/pxr/imaging/hdGp/pch.h @@ -65,6 +65,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #if defined(__APPLE__) // Fix breakage caused by Python's pyport.h. diff --git a/pxr/imaging/hdMtlx/pch.h b/pxr/imaging/hdMtlx/pch.h index 93019ca153..ce52394a65 100644 --- a/pxr/imaging/hdMtlx/pch.h +++ b/pxr/imaging/hdMtlx/pch.h @@ -88,6 +88,7 @@ #include #endif // PXR_MATERIALX_SUPPORT_ENABLED #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/imaging/hdSt/pch.h b/pxr/imaging/hdSt/pch.h index 8b268216ef..35272f1c78 100644 --- a/pxr/imaging/hdSt/pch.h +++ b/pxr/imaging/hdSt/pch.h @@ -109,6 +109,7 @@ #include #endif // PXR_MATERIALX_SUPPORT_ENABLED #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #if defined(__APPLE__) // Fix breakage caused by Python's pyport.h. diff --git a/pxr/imaging/hdar/pch.h b/pxr/imaging/hdar/pch.h index 85c01c4d1f..ef87858394 100644 --- a/pxr/imaging/hdar/pch.h +++ b/pxr/imaging/hdar/pch.h @@ -64,6 +64,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #if defined(__APPLE__) // Fix breakage caused by Python's pyport.h. diff --git a/pxr/imaging/hdsi/pch.h b/pxr/imaging/hdsi/pch.h index 75c86405bf..dab0bbd08b 100644 --- a/pxr/imaging/hdsi/pch.h +++ b/pxr/imaging/hdsi/pch.h @@ -69,6 +69,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #if defined(__APPLE__) // Fix breakage caused by Python's pyport.h. diff --git a/pxr/imaging/hdx/pch.h b/pxr/imaging/hdx/pch.h index 20bc190c30..ddaab1a0a9 100644 --- a/pxr/imaging/hdx/pch.h +++ b/pxr/imaging/hdx/pch.h @@ -96,6 +96,7 @@ #include #endif // PXR_OCIO_PLUGIN_ENABLED #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #if defined(__APPLE__) // Fix breakage caused by Python's pyport.h. diff --git a/pxr/imaging/hgi/pch.h b/pxr/imaging/hgi/pch.h index 75803135c6..f61e1899f3 100644 --- a/pxr/imaging/hgi/pch.h +++ b/pxr/imaging/hgi/pch.h @@ -69,6 +69,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #if defined(__APPLE__) // Fix breakage caused by Python's pyport.h. diff --git a/pxr/imaging/hgiInterop/pch.h b/pxr/imaging/hgiInterop/pch.h index f6e968984d..ce02a5f4eb 100644 --- a/pxr/imaging/hgiInterop/pch.h +++ b/pxr/imaging/hgiInterop/pch.h @@ -49,6 +49,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #if defined(__APPLE__) // Fix breakage caused by Python's pyport.h. diff --git a/pxr/imaging/hio/pch.h b/pxr/imaging/hio/pch.h index 14c08f5b55..da47e2a153 100644 --- a/pxr/imaging/hio/pch.h +++ b/pxr/imaging/hio/pch.h @@ -84,6 +84,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #if defined(__APPLE__) // Fix breakage caused by Python's pyport.h. diff --git a/pxr/imaging/hioOpenVDB/pch.h b/pxr/imaging/hioOpenVDB/pch.h index 8dd4026506..b4fcc8e16a 100644 --- a/pxr/imaging/hioOpenVDB/pch.h +++ b/pxr/imaging/hioOpenVDB/pch.h @@ -68,6 +68,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #if defined(__APPLE__) // Fix breakage caused by Python's pyport.h. diff --git a/pxr/imaging/plugin/hdEmbree/pch.h b/pxr/imaging/plugin/hdEmbree/pch.h index c64644c545..0369fea3a1 100644 --- a/pxr/imaging/plugin/hdEmbree/pch.h +++ b/pxr/imaging/plugin/hdEmbree/pch.h @@ -76,6 +76,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #if defined(__APPLE__) // Fix breakage caused by Python's pyport.h. diff --git a/pxr/imaging/plugin/hdStorm/pch.h b/pxr/imaging/plugin/hdStorm/pch.h index ecb4ddd72e..fe3470d7dc 100644 --- a/pxr/imaging/plugin/hdStorm/pch.h +++ b/pxr/imaging/plugin/hdStorm/pch.h @@ -68,6 +68,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #if defined(__APPLE__) // Fix breakage caused by Python's pyport.h. diff --git a/pxr/imaging/plugin/hioAvif/pch.h b/pxr/imaging/plugin/hioAvif/pch.h index e58f2fab51..d0f85b38eb 100644 --- a/pxr/imaging/plugin/hioAvif/pch.h +++ b/pxr/imaging/plugin/hioAvif/pch.h @@ -49,6 +49,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/imaging/plugin/hioOiio/pch.h b/pxr/imaging/plugin/hioOiio/pch.h index df1a527a70..22a057d7e7 100644 --- a/pxr/imaging/plugin/hioOiio/pch.h +++ b/pxr/imaging/plugin/hioOiio/pch.h @@ -54,6 +54,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #if defined(__APPLE__) // Fix breakage caused by Python's pyport.h. diff --git a/pxr/imaging/pxOsd/pch.h b/pxr/imaging/pxOsd/pch.h index 2a2dc83f66..de88f453d5 100644 --- a/pxr/imaging/pxOsd/pch.h +++ b/pxr/imaging/pxOsd/pch.h @@ -65,6 +65,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/ar/pch.h b/pxr/usd/ar/pch.h index 8e41c1fc78..0e35cab3be 100644 --- a/pxr/usd/ar/pch.h +++ b/pxr/usd/ar/pch.h @@ -81,6 +81,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/kind/pch.h b/pxr/usd/kind/pch.h index c50e72fb3a..38b7a8ff72 100644 --- a/pxr/usd/kind/pch.h +++ b/pxr/usd/kind/pch.h @@ -48,6 +48,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/ndr/pch.h b/pxr/usd/ndr/pch.h index f536d7f398..a20e8053dd 100644 --- a/pxr/usd/ndr/pch.h +++ b/pxr/usd/ndr/pch.h @@ -83,6 +83,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/pcp/pch.h b/pxr/usd/pcp/pch.h index b222a3116d..326f2183f0 100644 --- a/pxr/usd/pcp/pch.h +++ b/pxr/usd/pcp/pch.h @@ -72,6 +72,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/plugin/sdrOsl/pch.h b/pxr/usd/plugin/sdrOsl/pch.h index d13d856709..3de9911464 100644 --- a/pxr/usd/plugin/sdrOsl/pch.h +++ b/pxr/usd/plugin/sdrOsl/pch.h @@ -64,6 +64,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/plugin/usdAbc/pch.h b/pxr/usd/plugin/usdAbc/pch.h index 96df913797..8611200586 100644 --- a/pxr/usd/plugin/usdAbc/pch.h +++ b/pxr/usd/plugin/usdAbc/pch.h @@ -113,6 +113,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/plugin/usdDraco/pch.h b/pxr/usd/plugin/usdDraco/pch.h index 3871793678..096c66376a 100644 --- a/pxr/usd/plugin/usdDraco/pch.h +++ b/pxr/usd/plugin/usdDraco/pch.h @@ -72,6 +72,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/sdf/pch.h b/pxr/usd/sdf/pch.h index 22d1798dde..fbbb06112a 100644 --- a/pxr/usd/sdf/pch.h +++ b/pxr/usd/sdf/pch.h @@ -94,6 +94,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/sdr/pch.h b/pxr/usd/sdr/pch.h index a2df6b7950..37c417c9d1 100644 --- a/pxr/usd/sdr/pch.h +++ b/pxr/usd/sdr/pch.h @@ -69,6 +69,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/usd/pch.h b/pxr/usd/usd/pch.h index 8aed2f8be8..e3bad40a52 100644 --- a/pxr/usd/usd/pch.h +++ b/pxr/usd/usd/pch.h @@ -91,6 +91,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/usdGeom/pch.h b/pxr/usd/usdGeom/pch.h index 8771c52e41..8fd0de332c 100644 --- a/pxr/usd/usdGeom/pch.h +++ b/pxr/usd/usdGeom/pch.h @@ -72,6 +72,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/usdHydra/pch.h b/pxr/usd/usdHydra/pch.h index bc6c47f91b..fdb618c79c 100644 --- a/pxr/usd/usdHydra/pch.h +++ b/pxr/usd/usdHydra/pch.h @@ -70,6 +70,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/usdLux/pch.h b/pxr/usd/usdLux/pch.h index c03cc80544..b240b8f188 100644 --- a/pxr/usd/usdLux/pch.h +++ b/pxr/usd/usdLux/pch.h @@ -72,6 +72,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/usdMedia/pch.h b/pxr/usd/usdMedia/pch.h index 95efd0e603..cd456ff152 100644 --- a/pxr/usd/usdMedia/pch.h +++ b/pxr/usd/usdMedia/pch.h @@ -71,6 +71,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/usdMtlx/pch.h b/pxr/usd/usdMtlx/pch.h index 4856d3e163..80c90a4b84 100644 --- a/pxr/usd/usdMtlx/pch.h +++ b/pxr/usd/usdMtlx/pch.h @@ -92,6 +92,7 @@ #include #endif // PXR_MATERIALX_SUPPORT_ENABLED #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/usdPhysics/pch.h b/pxr/usd/usdPhysics/pch.h index 0a1efa7d7e..86afdf3d24 100644 --- a/pxr/usd/usdPhysics/pch.h +++ b/pxr/usd/usdPhysics/pch.h @@ -71,6 +71,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/usdProc/pch.h b/pxr/usd/usdProc/pch.h index 217de22bb6..394c8a5b41 100644 --- a/pxr/usd/usdProc/pch.h +++ b/pxr/usd/usdProc/pch.h @@ -71,6 +71,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/usdRender/pch.h b/pxr/usd/usdRender/pch.h index 563904359b..ef74172525 100644 --- a/pxr/usd/usdRender/pch.h +++ b/pxr/usd/usdRender/pch.h @@ -72,6 +72,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/usdRi/pch.h b/pxr/usd/usdRi/pch.h index e231b17831..c1bc921d0d 100644 --- a/pxr/usd/usdRi/pch.h +++ b/pxr/usd/usdRi/pch.h @@ -71,6 +71,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/usdSemantics/pch.h b/pxr/usd/usdSemantics/pch.h index 7bb0332472..dac396816e 100644 --- a/pxr/usd/usdSemantics/pch.h +++ b/pxr/usd/usdSemantics/pch.h @@ -88,6 +88,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/usdShade/pch.h b/pxr/usd/usdShade/pch.h index 3dcf3fcf01..9ef32c84e0 100644 --- a/pxr/usd/usdShade/pch.h +++ b/pxr/usd/usdShade/pch.h @@ -87,6 +87,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/usdSkel/pch.h b/pxr/usd/usdSkel/pch.h index 3e5bf6fd80..ba7cba856f 100644 --- a/pxr/usd/usdSkel/pch.h +++ b/pxr/usd/usdSkel/pch.h @@ -71,6 +71,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/usdUI/pch.h b/pxr/usd/usdUI/pch.h index 6d53e8bfe4..4852335387 100644 --- a/pxr/usd/usdUI/pch.h +++ b/pxr/usd/usdUI/pch.h @@ -69,6 +69,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/usdUtils/pch.h b/pxr/usd/usdUtils/pch.h index 7bb0332472..dac396816e 100644 --- a/pxr/usd/usdUtils/pch.h +++ b/pxr/usd/usdUtils/pch.h @@ -88,6 +88,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usd/usdVol/pch.h b/pxr/usd/usdVol/pch.h index 217de22bb6..394c8a5b41 100644 --- a/pxr/usd/usdVol/pch.h +++ b/pxr/usd/usdVol/pch.h @@ -71,6 +71,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usdImaging/plugin/sdrGlslfx/pch.h b/pxr/usdImaging/plugin/sdrGlslfx/pch.h index a53809377e..be073fae4b 100644 --- a/pxr/usdImaging/plugin/sdrGlslfx/pch.h +++ b/pxr/usdImaging/plugin/sdrGlslfx/pch.h @@ -50,6 +50,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usdImaging/plugin/usdShaders/pch.h b/pxr/usdImaging/plugin/usdShaders/pch.h index 3b0ab0f0de..7b302515a7 100644 --- a/pxr/usdImaging/plugin/usdShaders/pch.h +++ b/pxr/usdImaging/plugin/usdShaders/pch.h @@ -70,6 +70,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usdImaging/usdAppUtils/pch.h b/pxr/usdImaging/usdAppUtils/pch.h index 7fab44a81d..71dc34e16c 100644 --- a/pxr/usdImaging/usdAppUtils/pch.h +++ b/pxr/usdImaging/usdAppUtils/pch.h @@ -88,6 +88,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usdImaging/usdImaging/pch.h b/pxr/usdImaging/usdImaging/pch.h index 51930588b8..cd106809e2 100644 --- a/pxr/usdImaging/usdImaging/pch.h +++ b/pxr/usdImaging/usdImaging/pch.h @@ -91,6 +91,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usdImaging/usdImagingGL/pch.h b/pxr/usdImaging/usdImagingGL/pch.h index 91cbdfc51a..8a04b4f360 100644 --- a/pxr/usdImaging/usdImagingGL/pch.h +++ b/pxr/usdImaging/usdImagingGL/pch.h @@ -78,6 +78,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usdImaging/usdProcImaging/pch.h b/pxr/usdImaging/usdProcImaging/pch.h index 879863bf3c..fb9999de96 100644 --- a/pxr/usdImaging/usdProcImaging/pch.h +++ b/pxr/usdImaging/usdProcImaging/pch.h @@ -74,6 +74,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usdImaging/usdRiPxrImaging/pch.h b/pxr/usdImaging/usdRiPxrImaging/pch.h index 879863bf3c..fb9999de96 100644 --- a/pxr/usdImaging/usdRiPxrImaging/pch.h +++ b/pxr/usdImaging/usdRiPxrImaging/pch.h @@ -74,6 +74,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usdImaging/usdSkelImaging/pch.h b/pxr/usdImaging/usdSkelImaging/pch.h index ec4b6c1131..9cfed39912 100644 --- a/pxr/usdImaging/usdSkelImaging/pch.h +++ b/pxr/usdImaging/usdSkelImaging/pch.h @@ -74,6 +74,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usdImaging/usdVolImaging/pch.h b/pxr/usdImaging/usdVolImaging/pch.h index 879863bf3c..fb9999de96 100644 --- a/pxr/usdImaging/usdVolImaging/pch.h +++ b/pxr/usdImaging/usdVolImaging/pch.h @@ -74,6 +74,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/pxr/usdImaging/usdviewq/pch.h b/pxr/usdImaging/usdviewq/pch.h index 4aceb8b756..c71797a837 100644 --- a/pxr/usdImaging/usdviewq/pch.h +++ b/pxr/usdImaging/usdviewq/pch.h @@ -72,6 +72,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include diff --git a/third_party/renderman-26/plugin/rmanArgsParser/pch.h b/third_party/renderman-26/plugin/rmanArgsParser/pch.h index 0c374855de..8b77628f49 100644 --- a/third_party/renderman-26/plugin/rmanArgsParser/pch.h +++ b/third_party/renderman-26/plugin/rmanArgsParser/pch.h @@ -59,6 +59,7 @@ #include #include #if defined(PXR_PYTHON_SUPPORT_ENABLED) && !defined(PXR_USE_INTERNAL_BOOST_PYTHON) +#include "pxr/external/boost/python/common.hpp" #include #include #include From 2c85cba5996208ef3da915528ab81e6f2ef47d1b Mon Sep 17 00:00:00 2001 From: anwang2009 Date: Fri, 11 Oct 2024 13:26:43 -0700 Subject: [PATCH 14/82] Fix dropped items in metadata tab display in usdview (Internal change: 2344491) --- .../testUsdviewMetadatatabSelect/test.usda | 3 ++ .../testUsdviewMetadatatabSelect.py | 28 ++++++++++++-- pxr/usdImaging/usdviewq/appController.py | 37 ++++++++----------- 3 files changed, 42 insertions(+), 26 deletions(-) diff --git a/pxr/usdImaging/bin/testusdview/testenv/testUsdviewMetadatatabSelect/test.usda b/pxr/usdImaging/bin/testusdview/testenv/testUsdviewMetadatatabSelect/test.usda index 1bfacda570..f5579cc4cf 100644 --- a/pxr/usdImaging/bin/testusdview/testenv/testUsdviewMetadatatabSelect/test.usda +++ b/pxr/usdImaging/bin/testusdview/testenv/testUsdviewMetadatatabSelect/test.usda @@ -1,4 +1,7 @@ #usda 1.0 +( + upAxis = 'Z' +) def Xform "Implicits" ( add variantSets = "shapeVariant" diff --git a/pxr/usdImaging/bin/testusdview/testenv/testUsdviewMetadatatabSelect/testUsdviewMetadatatabSelect.py b/pxr/usdImaging/bin/testusdview/testenv/testUsdviewMetadatatabSelect/testUsdviewMetadatatabSelect.py index 0ec88809cc..0d45732491 100644 --- a/pxr/usdImaging/bin/testusdview/testenv/testUsdviewMetadatatabSelect/testUsdviewMetadatatabSelect.py +++ b/pxr/usdImaging/bin/testusdview/testenv/testUsdviewMetadatatabSelect/testUsdviewMetadatatabSelect.py @@ -10,6 +10,7 @@ from pxr.Usdviewq.qt import QtWidgets class MetadataKeys(ConstantsGroup): + ROOT_METADATA_KEY = "upAxis" APPLIED_API_SCHEMAS_FIELD = "[applied API schemas]" AUTHORED_API_SCHEMAS_FIELD = 'apiSchemas' @@ -62,12 +63,31 @@ def _testBasic(appController): assert inspectorView.tabText(inspectorView.currentIndex()) == 'Composition' def _testAPISchemaMetadata(appController): + # Check root metadata is visible inspectorView = appController._ui.propertyInspector + appController.selectPseudoroot() inspectorView.setCurrentIndex(1) - appController._ui.primViewLineEdit.setText('RectLight') - appController._primViewFindNext() - appController._mainWindow.repaint() assert inspectorView.tabText(inspectorView.currentIndex()) == 'Meta Data' + appController._mainWindow.repaint() + metadataTable = inspectorView.currentWidget().findChildren( + QtWidgets.QTableWidget)[0] + + foundRootMetadata = False + for i in range(metadataTable.rowCount()): + fieldName = str(metadataTable.item(i, 0).text()) + value = str(metadataTable.item(i, 1).text()) + if fieldName == MetadataKeys.ROOT_METADATA_KEY: + foundRootMetadata = True + break + + assert foundRootMetadata + + # Check Applied API schemas are set and correct + inspectorView = appController._ui.propertyInspector + inspectorView.setCurrentIndex(1) + appController._ui.primViewLineEdit.setText('Light') + appController._primViewFindNext() + appController._updateMetadataView() metadataTable = inspectorView.currentWidget().findChildren( QtWidgets.QTableWidget)[0] @@ -84,7 +104,7 @@ def _testAPISchemaMetadata(appController): prim = appController._dataModel.selection.getFocusPrim() UsdLux.MeshLightAPI.Apply(prim) - appController._mainWindow.repaint() + appController._updateMetadataView() apiDef = reg.FindAppliedAPIPrimDefinition("MeshLightAPI") additionalAppliedSchemas = primDef.GetAppliedAPISchemas() diff --git a/pxr/usdImaging/usdviewq/appController.py b/pxr/usdImaging/usdviewq/appController.py index 30b9d8658f..6e60a3acd5 100644 --- a/pxr/usdImaging/usdviewq/appController.py +++ b/pxr/usdImaging/usdviewq/appController.py @@ -4236,21 +4236,12 @@ def _updateMetadataView(self, obj=None): "references", "specializes", "payload", "subLayers"] - for k in compKeys: v = obj.GetMetadata(k) if not v is None: m[k] = v - clipMetadata = obj.GetMetadata("clips") - if clipMetadata is None: - clipMetadata = {} - numClipRows = 0 - for (clip, data) in clipMetadata.items(): - numClipRows += len(data) - m["clips"] = clipMetadata - - numMetadataRows = (len(m) - 1) + numClipRows + m["clips"] = obj.GetMetadata("clips") or {} # Variant selections that don't have a defined variant set will be # displayed as well to aid debugging. Collect them separately from @@ -4285,9 +4276,6 @@ def _updateMetadataView(self, obj=None): # Remove found variant set from setless. setlessVariantSelections.pop(variantSetName, None) - tableWidget.setRowCount(numMetadataRows + len(variantSets) + - len(setlessVariantSelections) + 2) - rowIndex = 0 # Although most metadata should be presented alphabetically,the most @@ -4295,6 +4283,7 @@ def _updateMetadataView(self, obj=None): # list, these consist of [object type], [path], variant sets, active, # assetInfo, and kind. def populateMetadataTable(key, val, rowIndex): + tableWidget.insertRow(rowIndex) attrName = QtWidgets.QTableWidgetItem(str(key)) tableWidget.setItem(rowIndex, 0, attrName) @@ -4304,6 +4293,12 @@ def populateMetadataTable(key, val, rowIndex): tableWidget.setItem(rowIndex, 1, attrVal) + def populateMetadataTableVariant(key, val, rowIndex): + tableWidget.insertRow(rowIndex) + attrName = QtWidgets.QTableWidgetItem(str(key + ' variant')) + tableWidget.setItem(rowIndex, 0, attrName) + tableWidget.setCellWidget(rowIndex, 1, val) + sortedKeys = sorted(m.keys()) reorderedKeys = ["kind", "assetInfo", "active"] @@ -4330,9 +4325,7 @@ def populateMetadataTable(key, val, rowIndex): rowIndex += 1 for variantSetName, combo in variantSets.items(): - attrName = QtWidgets.QTableWidgetItem(str(variantSetName+ ' variant')) - tableWidget.setItem(rowIndex, 0, attrName) - tableWidget.setCellWidget(rowIndex, 1, combo) + populateMetadataTableVariant(variantSetName, combo, rowIndex) combo.currentIndexChanged.connect( lambda i, combo=combo: combo.updateVariantSelection(i, self._makeTimer)) @@ -4341,15 +4334,12 @@ def populateMetadataTable(key, val, rowIndex): # Add all the setless variant selections directly after the variant # combo boxes for variantSetName, variantSelection in setlessVariantSelections.items(): - attrName = QtWidgets.QTableWidgetItem(str(variantSetName+ ' variant')) - tableWidget.setItem(rowIndex, 0, attrName) - valStr, ttStr = self._formatMetadataValueView(variantSelection) # Italicized label to stand out when debugging a scene. label = QtWidgets.QLabel('' + valStr + '') label.setIndent(3) label.setToolTip(ttStr) - tableWidget.setCellWidget(rowIndex, 1, label) + populateMetadataTableVariant(variantSetName, label, rowIndex) rowIndex += 1 @@ -4357,8 +4347,11 @@ def populateMetadataTable(key, val, rowIndex): if key == "clips": for (clip, metadataGroup) in m[key].items(): attrName = QtWidgets.QTableWidgetItem(str('clips:' + clip)) - tableWidget.setItem(rowIndex, 0, attrName) - for metadata in metadataGroup.keys(): + for i, metadata in enumerate(metadataGroup.keys()): + tableWidget.insertRow(rowIndex) + if i == 0: + tableWidget.setItem(rowIndex, 0, attrName) + dataPair = (metadata, metadataGroup[metadata]) valStr, ttStr = self._formatMetadataValueView(dataPair) attrVal = QtWidgets.QTableWidgetItem(valStr) From c54af29f50119a3a257b49b5eded681ff35d00e0 Mon Sep 17 00:00:00 2001 From: sunyab Date: Fri, 11 Oct 2024 14:48:20 -0700 Subject: [PATCH 15/82] docs: Update tutorial badge for 24.11 (Internal change: 2344526) --- docs/tut_setup_version_badge.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tut_setup_version_badge.rst b/docs/tut_setup_version_badge.rst index e4b5ca917b..0e4f9f69d4 100644 --- a/docs/tut_setup_version_badge.rst +++ b/docs/tut_setup_version_badge.rst @@ -2,4 +2,4 @@ :fa:`cogs` :ref:`Configure your Environment ` - :fa:`check` Tested with `USD 24.08 `_ + :fa:`check` Tested with `USD 24.11 `_ From 633e4689c0d3e6934b969674e0f52d203b018b6e Mon Sep 17 00:00:00 2001 From: LiamGFX Date: Mon, 14 Oct 2024 22:24:04 -0700 Subject: [PATCH 16/82] OpenUSD: Remove support for Python 3.6 and 3.7 in PyPi builds and switch to Python 3.8 for Windows BuildUSD builds. (Internal change: 2344653) --- .github/workflows/pypi.yml | 20 ----------------- azure-pipelines.yml | 2 +- azure-pypi-pipeline.yml | 44 -------------------------------------- 3 files changed, 1 insertion(+), 65 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 7342f27792..1f28413346 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -25,9 +25,6 @@ jobs: strategy: matrix: PYTHON: - - TAG: cp37 - INTERPRETER: /opt/python/cp37-cp37m/bin/python - VERSION_SPEC: '3.7' - TAG: cp38 INTERPRETER: /opt/python/cp38-cp38/bin/python VERSION_SPEC: '3.8' @@ -100,9 +97,6 @@ jobs: strategy: matrix: PYTHON: - - VERSION_SPEC: '3.7' - INTERPRETER: python3.7 - TAG: cp37 - VERSION_SPEC: '3.8' INTERPRETER: python3.8 TAG: cp38 @@ -174,8 +168,6 @@ jobs: strategy: matrix: PYTHON: - - VERSION_SPEC: '3.7' - TAG: cp37 - VERSION_SPEC: '3.8' TAG: cp38 - VERSION_SPEC: '3.9' @@ -253,10 +245,6 @@ jobs: strategy: matrix: BUILD_CONFIG: - - NAME: Linux_Python37 - PYTHON_VERSION_SPEC: '3.7' - IMAGE: ubuntu-20.04 - PYTHON_INTERPRETER: python3 - NAME: Linux_Python38 PYTHON_VERSION_SPEC: '3.8' IMAGE: ubuntu-20.04 @@ -273,10 +261,6 @@ jobs: PYTHON_VERSION_SPEC: '3.11' IMAGE: ubuntu-20.04 PYTHON_INTERPRETER: python3 - - NAME: Mac_Python37 - PYTHON_VERSION_SPEC: '3.7' - IMAGE: macos-12 - PYTHON_INTERPRETER: python3 - NAME: Mac_Python38 PYTHON_VERSION_SPEC: '3.8' IMAGE: macos-12 @@ -293,10 +277,6 @@ jobs: PYTHON_VERSION_SPEC: '3.11' IMAGE: macos-12 PYTHON_INTERPRETER: python3 - - NAME: Windows_Python37 - PYTHON_VERSION_SPEC: '3.7' - IMAGE: windows-2019 - PYTHON_INTERPRETER: python3 - NAME: Windows_Python38 PYTHON_VERSION_SPEC: '3.8' IMAGE: windows-2019 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 57364f62f7..6734c3587d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -51,7 +51,7 @@ jobs: steps: - script: | call C:\"Program Files (x86)"\"Microsoft Visual Studio"\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat - call set PYTHONLOCATION=C:\hostedtoolcache\windows\Python\3.7.9\x64 + call set PYTHONLOCATION=C:\hostedtoolcache\windows\Python\3.9.13\x64 call set PYTHONBIN=%PYTHONLOCATION%\python.exe call set PATH=%PYTHONLOCATION%;%PYTHONLOCATION%\Scripts;%PATH% call set BOOST_ROOT= diff --git a/azure-pypi-pipeline.yml b/azure-pypi-pipeline.yml index 23a20bfad7..307c4445b7 100644 --- a/azure-pypi-pipeline.yml +++ b/azure-pypi-pipeline.yml @@ -45,12 +45,6 @@ stages: - job: Linux strategy: matrix: - Python36: - PYTHON_INTERPRETER: /opt/python/cp36-cp36m/bin/python - PYTHON_TAG: cp36 - Python37: - PYTHON_INTERPRETER: /opt/python/cp37-cp37m/bin/python - PYTHON_TAG: cp37 Python38: PYTHON_INTERPRETER: /opt/python/cp38-cp38/bin/python PYTHON_TAG: cp38 @@ -119,12 +113,6 @@ stages: - job: Windows strategy: matrix: - Python36: - PYTHON_VERSION_SPEC: 3.6 - PYTHON_TAG: cp36 - Python37: - PYTHON_VERSION_SPEC: 3.7 - PYTHON_TAG: cp37 Python38: PYTHON_VERSION_SPEC: 3.8 PYTHON_TAG: cp38 @@ -179,14 +167,6 @@ stages: - job: Mac strategy: matrix: - Python36: - PYTHON_VERSION_SPEC: 3.6 - PYTHON_INTERPRETER: python3.6 - PYTHON_TAG: cp36 - Python37: - PYTHON_VERSION_SPEC: 3.7 - PYTHON_INTERPRETER: python3.7 - PYTHON_TAG: cp37 Python38: PYTHON_VERSION_SPEC: 3.8 PYTHON_INTERPRETER: python3.8 @@ -284,14 +264,6 @@ stages: - job: Test_Install strategy: matrix: - Linux_Python36: - PYTHON_VERSION_SPEC: 3.6 - IMAGE: 'Ubuntu-20.04' - PYTHON_INTERPRETER: python3 - Linux_Python37: - PYTHON_VERSION_SPEC: 3.7 - IMAGE: 'Ubuntu-20.04' - PYTHON_INTERPRETER: python3 Linux_Python38: PYTHON_VERSION_SPEC: 3.8 IMAGE: 'Ubuntu-20.04' @@ -312,14 +284,6 @@ stages: PYTHON_VERSION_SPEC: 3.12 IMAGE: 'Ubuntu-20.04' PYTHON_INTERPRETER: python3 - Windows_Python36: - PYTHON_VERSION_SPEC: 3.6 - IMAGE: 'windows-2019' - PYTHON_INTERPRETER: python - Windows_Python37: - PYTHON_VERSION_SPEC: 3.7 - IMAGE: 'windows-2019' - PYTHON_INTERPRETER: python Windows_Python38: PYTHON_VERSION_SPEC: 3.8 IMAGE: 'windows-2019' @@ -340,14 +304,6 @@ stages: PYTHON_VERSION_SPEC: 3.12 IMAGE: 'windows-2019' PYTHON_INTERPRETER: python - Mac_Python36: - PYTHON_VERSION_SPEC: 3.6 - IMAGE: 'macOS-12' - PYTHON_INTERPRETER: python3 - Mac_Python37: - PYTHON_VERSION_SPEC: 3.7 - IMAGE: 'macOS-12' - PYTHON_INTERPRETER: python3 Mac_Python38: PYTHON_VERSION_SPEC: 3.8 IMAGE: 'macOS-12' From 0b6dd837e546825ef2fab963ee42c25f00ca6086 Mon Sep 17 00:00:00 2001 From: LiamGFX Date: Mon, 14 Oct 2024 22:24:23 -0700 Subject: [PATCH 17/82] OpenUSD: Change to macOS-13 and Xcode 14 (Due to deprecation of macOS-12 builder) (Internal change: 2344660) --- .github/workflows/buildusd.yml | 4 ++-- .github/workflows/pypi.yml | 12 ++++++------ azure-pipelines.yml | 4 ++-- azure-pypi-pipeline.yml | 14 +++++++------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/buildusd.yml b/.github/workflows/buildusd.yml index a90a903aa5..0f0cfe6606 100644 --- a/.github/workflows/buildusd.yml +++ b/.github/workflows/buildusd.yml @@ -70,7 +70,7 @@ jobs: macOS: needs: [GetUser] if: ${{ (github.event.issue.pull_request && contains(github.event.comment.body, '/AzurePipelines run') && needs.GetUser.outputs.require-result == 'true' ) || github.event_name == 'push' }} - runs-on: macos-12 + runs-on: macos-13 timeout-minutes: 120 steps: - run: echo ${{ needs.GetUser.outputs.require-result }} @@ -91,7 +91,7 @@ jobs: - name: Install dependencies run: | export PATH=/Applications/CMake.app/Contents/bin:$PATH - sudo xcode-select -s /Applications/Xcode_13.3.app/Contents/Developer + sudo xcode-select -s /Applications/Xcode_14.1.app/Contents/Developer # Set SYSTEM_VERSION_COMPAT while installing Python packages to # accommodate the macOS version numbering change from 10.x to 11 export SYSTEM_VERSION_COMPAT=1 diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 1f28413346..1c662a8fcf 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -109,7 +109,7 @@ jobs: - VERSION_SPEC: '3.11' INTERPRETER: python3.11 TAG: cp311 - runs-on: macos-12 + runs-on: macos-13 timeout-minutes: 120 steps: - name: Checkout code @@ -125,7 +125,7 @@ jobs: ${{ matrix.PYTHON.INTERPRETER }} -m pip install delocate~=0.10.2 wheel - name: Build USD run: | - sudo xcode-select -s /Applications/Xcode_13.3.app/Contents/Developer + sudo xcode-select -s /Applications/Xcode_14.1.app/Contents/Developer ${{ matrix.PYTHON.INTERPRETER }} build_scripts/build_usd.py --build-args USD,"-DPXR_PY_UNDEFINED_DYNAMIC_LOOKUP=ON -DPXR_BUILD_USD_TOOLS=OFF -DPXR_INSTALL_LOCATION=../pluginfo" --no-materialx --no-imaging --no-examples --no-tutorials --generator Xcode --build-target universal --build $GITHUB_WORKSPACE/USDgen/build --src $GITHUB_WORKSPACE/USDgen/src $GITHUB_WORKSPACE/USDinst -v - name: Packaging USD run: | @@ -263,19 +263,19 @@ jobs: PYTHON_INTERPRETER: python3 - NAME: Mac_Python38 PYTHON_VERSION_SPEC: '3.8' - IMAGE: macos-12 + IMAGE: macos-13 PYTHON_INTERPRETER: python3 - NAME: Mac_Python39 PYTHON_VERSION_SPEC: '3.9' - IMAGE: macos-12 + IMAGE: macos-13 PYTHON_INTERPRETER: python3 - NAME: Mac_Python310 PYTHON_VERSION_SPEC: '3.10' - IMAGE: macos-12 + IMAGE: macos-13 PYTHON_INTERPRETER: python3 - NAME: Mac_Python311 PYTHON_VERSION_SPEC: '3.11' - IMAGE: macos-12 + IMAGE: macos-13 PYTHON_INTERPRETER: python3 - NAME: Windows_Python38 PYTHON_VERSION_SPEC: '3.8' diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6734c3587d..6d36618ee5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,12 +25,12 @@ jobs: - job: macOS timeoutInMinutes: 120 pool: - vmImage: 'macOS-12' + vmImage: 'macOS-13' steps: - script: | # Update PATH to ensure that pyside2-uic can be found export PATH=/Library/Frameworks/Python.framework/Versions/3.11/bin:$PATH - sudo xcode-select -s /Applications/Xcode_13.3.app/Contents/Developer + sudo xcode-select -s /Applications/Xcode_14.1.app/Contents/Developer # Set SYSTEM_VERSION_COMPAT while installing Python packages to # accommodate the macOS version numbering change from 10.x to 11 export SYSTEM_VERSION_COMPAT=1 diff --git a/azure-pypi-pipeline.yml b/azure-pypi-pipeline.yml index 307c4445b7..38080877c4 100644 --- a/azure-pypi-pipeline.yml +++ b/azure-pypi-pipeline.yml @@ -189,14 +189,14 @@ stages: PYTHON_TAG: cp312 timeoutInMinutes: 180 pool: - vmImage: 'macOS-12' + vmImage: 'macOS-13' steps: - task: UsePythonVersion@0 inputs: versionSpec: $(PYTHON_VERSION_SPEC) addToPath: true - script: | - sudo xcode-select -s /Applications/Xcode_13.2.app/Contents/Developer + sudo xcode-select -s /Applications/Xcode_14.1.app/Contents/Developer $(PYTHON_INTERPRETER) build_scripts/build_usd.py --build-args USD,"-DPXR_PY_UNDEFINED_DYNAMIC_LOOKUP=ON -DPXR_BUILD_USD_TOOLS=OFF -DPXR_INSTALL_LOCATION=../pluginfo" --no-materialx --no-imaging --no-examples --no-tutorials --generator Xcode --build-target universal --build $HOME/USDgen/build --src $HOME/USDgen/src $HOME/USDinst -v displayName: 'Building USD' - bash: | @@ -306,23 +306,23 @@ stages: PYTHON_INTERPRETER: python Mac_Python38: PYTHON_VERSION_SPEC: 3.8 - IMAGE: 'macOS-12' + IMAGE: 'macOS-13' PYTHON_INTERPRETER: python3 Mac_Python39: PYTHON_VERSION_SPEC: 3.9 - IMAGE: 'macOS-12' + IMAGE: 'macOS-13' PYTHON_INTERPRETER: python3 Mac_Python310: PYTHON_VERSION_SPEC: 3.10 - IMAGE: 'macOS-12' + IMAGE: 'macOS-13' PYTHON_INTERPRETER: python3 Mac_Python311: PYTHON_VERSION_SPEC: 3.11 - IMAGE: 'macOS-12' + IMAGE: 'macOS-13' PYTHON_INTERPRETER: python3 Mac_Python312: PYTHON_VERSION_SPEC: 3.12 - IMAGE: 'macOS-12' + IMAGE: 'macOS-13' PYTHON_INTERPRETER: python3 timeoutInMinutes: 10 pool: From 1141751dc730c0f3f05f7a8eb8407ebbca31e4c6 Mon Sep 17 00:00:00 2001 From: LiamGFX Date: Mon, 14 Oct 2024 22:24:40 -0700 Subject: [PATCH 18/82] OpenUSD: BuildUSD workflow: Fix issue_comment ref (Internal change: 2344661) --- .github/workflows/buildusd.yml | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/.github/workflows/buildusd.yml b/.github/workflows/buildusd.yml index 0f0cfe6606..a5d8485e81 100644 --- a/.github/workflows/buildusd.yml +++ b/.github/workflows/buildusd.yml @@ -24,8 +24,29 @@ jobs: with: require: 'write' username: ${{ github.event.comment.user.login }} + GetGitRef: + runs-on: ubuntu-20.04 + timeout-minutes: 5 + outputs: + ref: ${{ steps.setter.outputs.ref }} + steps: + - name: Get push ref + if: ${{ github.event_name == 'push' }} + run: | + echo "REF=${{ github.ref }}" >> $GITHUB_ENV + - name: Get PR ref + if: ${{ github.event.issue.pull_request }} + run: | + echo "REF=refs/pull/${{ github.event.issue.number }}/merge" >> $GITHUB_ENV + - name: Print ENV_VAR + run: | + echo "The value of REF is $REF" + - name: Set ENV_VAR + id: setter + run: | + echo "ref=$REF" >> "$GITHUB_OUTPUT" Linux: - needs: [GetUser] + needs: [GetUser, GetGitRef] if: ${{ (github.event.issue.pull_request && contains(github.event.comment.body, '/AzurePipelines run') && needs.GetUser.outputs.require-result == 'true' ) || github.event_name == 'push' }} runs-on: ubuntu-20.04 timeout-minutes: 120 @@ -33,6 +54,8 @@ jobs: - run: echo ${{ needs.GetUser.outputs.require-result }} - name: Checkout code uses: actions/checkout@v4 + with: + ref: ${{needs.GetGitRef.outputs.ref}} - name: Restore cached artifacts id: cache-usd-build-dependency uses: actions/cache/restore@v4 @@ -68,7 +91,7 @@ jobs: path: USDinst macOS: - needs: [GetUser] + needs: [GetUser, GetGitRef] if: ${{ (github.event.issue.pull_request && contains(github.event.comment.body, '/AzurePipelines run') && needs.GetUser.outputs.require-result == 'true' ) || github.event_name == 'push' }} runs-on: macos-13 timeout-minutes: 120 @@ -76,6 +99,8 @@ jobs: - run: echo ${{ needs.GetUser.outputs.require-result }} - name: Checkout code uses: actions/checkout@v4 + with: + ref: ${{needs.GetGitRef.outputs.ref}} - name: Restore cached artifacts id: cache-usd-build-dependency uses: actions/cache/restore@v4 @@ -115,7 +140,7 @@ jobs: path: USDinst Windows: - needs: [GetUser] + needs: [GetUser, GetGitRef] if: ${{ (github.event.issue.pull_request && contains(github.event.comment.body, '/AzurePipelines run') && needs.GetUser.outputs.require-result == 'true' ) || github.event_name == 'push' }} runs-on: windows-2019 timeout-minutes: 120 @@ -123,6 +148,8 @@ jobs: - run: echo ${{ needs.GetUser.outputs.require-result }} - name: Checkout code uses: actions/checkout@v4 + with: + ref: ${{needs.GetGitRef.outputs.ref}} - name: Restore cached artifacts id: cache-usd-build-dependency uses: actions/cache/restore@v4 From 7929cf80b1a682ab1a25bf422ae3d6afd3867dc1 Mon Sep 17 00:00:00 2001 From: sunyab Date: Wed, 16 Oct 2024 09:12:28 -0700 Subject: [PATCH 19/82] pcp: Disable incremental changes for layer operations by default Flip PCP_ENABLE_MINIMAL_CHANGES_FOR_LAYER_OPERATIONS to off by default while we continue development. In the meantime, this can be reenabled for testing/experimentation by setting this environment variable to 1. (Internal change: 2344776) --- pxr/usd/pcp/changes.cpp | 2 +- pxr/usd/pcp/testenv/testPcpChanges.py | 12 ++++++-- .../testenv/testPcpExpressionComposition.py | 30 +++++++++++++++---- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/pxr/usd/pcp/changes.cpp b/pxr/usd/pcp/changes.cpp index 0ee2c19e30..56db6b26a0 100644 --- a/pxr/usd/pcp/changes.cpp +++ b/pxr/usd/pcp/changes.cpp @@ -26,7 +26,7 @@ PXR_NAMESPACE_OPEN_SCOPE TF_DEFINE_ENV_SETTING( - PCP_ENABLE_MINIMAL_CHANGES_FOR_LAYER_OPERATIONS, true, + PCP_ENABLE_MINIMAL_CHANGES_FOR_LAYER_OPERATIONS, false, "If enabled, pcp will compute a minimal amount of targeted change entries " "for layer operations. This can result in a significant performance " "improvement when muting/unmuting layer or adding/removing sublayers."); diff --git a/pxr/usd/pcp/testenv/testPcpChanges.py b/pxr/usd/pcp/testenv/testPcpChanges.py index a003950b40..41ba6a5125 100644 --- a/pxr/usd/pcp/testenv/testPcpChanges.py +++ b/pxr/usd/pcp/testenv/testPcpChanges.py @@ -9,6 +9,9 @@ import unittest from contextlib import contextmanager +INCREMENTAL_CHANGES = Tf.GetEnvSetting( + 'PCP_ENABLE_MINIMAL_CHANGES_FOR_LAYER_OPERATIONS') + class TestPcpChanges(unittest.TestCase): def test_EmptySublayerChanges(self): subLayer1 = Sdf.Layer.CreateAnonymous() @@ -153,8 +156,13 @@ def "B" # With incremental changes these changes should only cause a resync # of /A and /B. - self.assertEqual(cp.GetSignificantChanges(), - [Sdf.Path('/A'), Sdf.Path('/B')]) + if INCREMENTAL_CHANGES: + self.assertEqual(cp.GetSignificantChanges(), + [Sdf.Path('/A'), Sdf.Path('/B')]) + else: + self.assertEqual(cp.GetSignificantChanges(), + [Sdf.Path('/')]) + self.assertEqual(cp.GetSpecChanges(), []) self.assertEqual(cp.GetPrimChanges(), []) diff --git a/pxr/usd/pcp/testenv/testPcpExpressionComposition.py b/pxr/usd/pcp/testenv/testPcpExpressionComposition.py index 93d724928d..4810511eff 100644 --- a/pxr/usd/pcp/testenv/testPcpExpressionComposition.py +++ b/pxr/usd/pcp/testenv/testPcpExpressionComposition.py @@ -7,7 +7,10 @@ import unittest -from pxr import Pcp, Sdf +from pxr import Pcp, Sdf, Tf + +INCREMENTAL_CHANGES = Tf.GetEnvSetting( + 'PCP_ENABLE_MINIMAL_CHANGES_FOR_LAYER_OPERATIONS') def LoadPcpCache(rootLayer, sessionLayer = None): l = Sdf.Layer.FindOrOpen(rootLayer) @@ -208,7 +211,12 @@ def test_SublayerAuthoring(self): # Since B.sdf is not empty, this should incur a significant resync. with Pcp._TestChangeProcessor(pcpCache) as changes: rootLayer.subLayerPaths.append('`"./B.sdf"`') - self.assertEqual(changes.GetSignificantChanges(), ['/Test']) + + if INCREMENTAL_CHANGES: + self.assertEqual(changes.GetSignificantChanges(), ['/Test']) + else: + self.assertEqual(changes.GetSignificantChanges(), ['/']) + self.assertEqual(changes.GetSpecChanges(), []) pi, err = pcpCache.ComputePrimIndex('/Test') @@ -232,7 +240,12 @@ def test_SublayerAuthoring(self): # Remove the sublayer we just added to reverse the changes. with Pcp._TestChangeProcessor(pcpCache) as changes: del rootLayer.subLayerPaths[-1] - self.assertEqual(changes.GetSignificantChanges(), ['/Test']) + + if INCREMENTAL_CHANGES: + self.assertEqual(changes.GetSignificantChanges(), ['/Test']) + else: + self.assertEqual(changes.GetSignificantChanges(), ['/']) + self.assertEqual(changes.GetSpecChanges(), []) pi, err = pcpCache.ComputePrimIndex('/Test') @@ -319,7 +332,11 @@ def test_SublayerAuthoringAndVariableChange(self): rootLayer.expressionVariables = {'X':'B'} rootLayer.subLayerPaths.append('`"./${X}.sdf"`') - self.assertEqual(changes.GetSignificantChanges(), ['/BaseRef']) + if INCREMENTAL_CHANGES: + self.assertEqual(changes.GetSignificantChanges(), ['/BaseRef']) + else: + self.assertEqual(changes.GetSignificantChanges(), ['/']) + self.assertEqual(changes.GetSpecChanges(), []) pi, err = pcpCache.ComputePrimIndex('/BaseRef') @@ -1017,7 +1034,10 @@ def test_ExpressionVarChanges_SignificantLayerStackChanges(self): rootLayer.expressionVariables = {'A':'C'} rootLayer.subLayerPaths.append('sig_changes/sub.sdf') - self.assertEqual(changes.GetSignificantChanges(), ['/Dummy']) + if INCREMENTAL_CHANGES: + self.assertEqual(changes.GetSignificantChanges(), ['/Dummy']) + else: + self.assertEqual(changes.GetSignificantChanges(), ['/']) self.AssertVariables( pcpCache, '/Root1', From 34ea96a89a94e7fc7a50ffd5bd4ca1fedf357740 Mon Sep 17 00:00:00 2001 From: sunyab Date: Wed, 16 Oct 2024 21:41:01 -0700 Subject: [PATCH 20/82] docs: Remove boost from dependencies and build instructions (Internal change: 2344867) --- BUILDING.md | 12 +----------- README.md | 1 - VERSIONS.md | 1 - docs/doxygen/externalOverview.dox | 7 +++---- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 6ff8de46ca..c2c16b0a04 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -36,7 +36,6 @@ Some examples: cmake \ -DTBB_ROOT_DIR=/path/to/tbb \ -DOPENSUBDIV_ROOT_DIR=/path/to/opensubdiv \ --DBOOST_ROOT=/path/to/boost \ /path/to/USD/source cmake --build . --target install -- -j @@ -51,7 +50,6 @@ cmake \ -G "Xcode" \ -DTBB_ROOT_DIR=/path/to/tbb \ -DOPENSUBDIV_ROOT_DIR=/path/to/opensubdiv \ --DBOOST_ROOT=/path/to/boost \ /path/to/USD/source cmake --build . --target install -- -j @@ -67,7 +65,6 @@ build USD. -G "Visual Studio 15 2017 Win64" ^ -DTBB_ROOT_DIR=C:\path\to\tbb ^ -DOPENSUBDIV_ROOT_DIR=C:\path\to\opensubdiv ^ --DBOOST_ROOT=C:\path\to\boost ^ \path\to\USD\source cmake --build . --target install -- /m:%NUMBER_OF_PROCESSORS% @@ -722,14 +719,7 @@ Client code can also override the default as needed. ## Build Issues FAQ -1. Boost_NO_BOOST_CMAKE: -We currently set Boost_NO_BOOST_CMAKE=ON explicitly in USD builds for all -platforms to avoid issues with Boost config files (introduced in Boost version -1.70) and python, program options component requirements. If the user wants -to use Boost specified config files for their USD build, specify --DBoost_NO_BOOST_CMAKE=OFF when running cmake. - -2. Windows and Python 3.8+ (non-Anaconda) +1. Windows and Python 3.8+ (non-Anaconda) Python 3.8 and later on Windows will no longer search PATH for DLL dependencies. Instead, clients can call `os.add_dll_directory(p)` to set paths to search. By default on that platform USD will iterate over PATH and add all paths using diff --git a/README.md b/README.md index 4d5a294507..3ae449e39b 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,6 @@ Optional: Required: - [Python](https://python.org) - - [Boost](https://boost.org) **usdview** diff --git a/VERSIONS.md b/VERSIONS.md index c3caf2ed56..5783e3f99d 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -17,7 +17,6 @@ Our test machines have the following software versions installed. | C++ Compiler | gcc 9.3.1 | Apple clang 13.1.6 (Xcode 13.3)
Apple clang 15.0.0 (Xcode 15.4) for visionOS | Visual Studio 2017 15.9 | | CMake | 3.17.5 | 3.19.5 | 3.25.3 | | Python | 3.9.16 | 3.9.13 | 3.9.13 | -| Boost | 1.76.0 | 1.78.0 | 1.76.0 | | Intel TBB | 2020 Update 3 | 2018 Update 1, 2020 Update 3 | 2020 Update 3 | | OpenSubdiv | 3.6.0 | 3.6.0 | 3.6.0 | | OpenImageIO | 2.3.21.0 | 2.3.21.0 | 2.3.21.0 | diff --git a/docs/doxygen/externalOverview.dox b/docs/doxygen/externalOverview.dox index 3f410a5d85..d70985e248 100644 --- a/docs/doxygen/externalOverview.dox +++ b/docs/doxygen/externalOverview.dox @@ -105,7 +105,7 @@ Following is a deeper indexing of the four packages. - \ref tf_page_front module is a catch-all for low-level, commonly used services developed at Pixar, including facilities for memory - tracking, error reporting and debugging, string utilities, boost python + tracking, error reporting and debugging, string utilities, Python wrapping aids, threading/synchronization tools, registry and singleton management, smart pointers, and "observer pattern" support, which we call "notification". @@ -128,9 +128,8 @@ Following is a deeper indexing of the four packages. is able to recognize and serialize. It provides a copy-on-write array-type, VtArray, which is used for all array types in Usd, and an efficient type-erasure wrapper class, VtValue, that also provides datatype - conversion facilities and support for unboxing python objects from boost - python. VtValue is supported in all Usd API for getting and setting - values. + conversion facilities and support for unboxing Python objects. + VtValue is supported in all Usd API for getting and setting values. - \ref work_page_front module provides a thin abstraction layer on top of Intel's TBB (Thread Building Blocks), and is leveraged extensively in Usd From 899c19efdc20786bc6cfc2c8202b8d32c3a5c794 Mon Sep 17 00:00:00 2001 From: pixar-oss Date: Thu, 17 Oct 2024 12:34:54 -0700 Subject: [PATCH 21/82] 24.11 release notes (Internal change: 2344964) --- CHANGELOG.md | 527 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 525 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68e0ca21cf..bdad3f9870 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,530 @@ # Change Log +## [24.11] - 2024-10-23 + +### Build + +- Removed boost dependency from OpenUSD. Note that boost must still be supplied + when OpenVDB support is enabled due to its use of boost in headers. + +- OpenUSD now uses its own internal pxr_boost::python library for generating + Python bindings instead of boost::python. + - Types from OpenUSD like Usd.Stage will no longer interoperate with other C++ + code that have been wrapped with boost::python. Client code with Python + bindings that interoperate with OpenUSD types must be updated to use the new + pxr_boost::python library. In particular, schema libraries should be + regenerated to pick up the new library. + - Users can revert to the old behavior of using boost::python by specifying + `PXR_USE_BOOST_PYTHON=ON` when running CMake. This option is for testing and + transition purposes; it is deprecated and will be removed in a future release. + +- Added "--boost-python" option for building OpenUSD's Python bindings with + boost::python. This option is for testing and transition purposes; it is + deprecated and will be removed in a future release. + +- Enabled support for imaging and usdImaging on Apple embedded platforms. + (PR: [#3215](https://github.com/PixarAnimationStudios/OpenUSD/pull/3215)) + +- OpenUSD's internal namespace now includes the patch version to help + distinguish releases within the same year. + (PR: [#3167](https://github.com/PixarAnimationStudios/OpenUSD/pull/3167)) + +- Removed support for usd-core PyPI package for Python 3.6 and deprecated + support for Python 3.7. + +### USD + +- Updated Tf file utilities to ignore reparse points on network file systems on + Windows. Reparse points on these systems are unlikely to be accessible from + the remote machines. + (PR: [#2934](https://github.com/PixarAnimationStudios/OpenUSD/pull/2934)) + +- Updated pxrTslRobinMap to latest release, 1.3.0, using erase_fast instead + of erase when the returned iterator is not needed. + (PR: [#3253](https://github.com/PixarAnimationStudios/OpenUSD/pull/3253), + [#3255](https://github.com/PixarAnimationStudios/OpenUSD/pull/3255)) + +- Added support for named color spaces from the Color Interchange Forum to + GfColorSpace. + +- Added Gf.Color and Gf.ColorSpace Python bindings. + +- Removed overloads of GfMatrix4d::Transform, GfMatrix4d::TransformAffine, + GfMatrix4d::TransformDir, and GfRotation::TransformDir that take and return + GfVec3f, as they can potentially result in loss of precision. Matrix-vector + multiplication operators for double precision matrix types and single + precision vector types have also been removed. These were deprecated in 24.05. + +- Exposed Python bindings for ArAsset, enabling operations such as + ArResolver.OpenAsset(resolvedPath) to allow reading ArAsset buffers from + Python. + (PR: [#3318](https://github.com/PixarAnimationStudios/OpenUSD/pull/3318)) + +- Various updates and fixes made for relocates. + - Fixed a bug where ancestral relocates weren't properly elided, leading to + verification failures and crashes. + - Fixed a bug with Pcp dependencies where some prim indexes from nested + relocates aren't invalidated when one of the ancestral relocates is + updated. + +- Improved how Pcp generates changelists for muting/unmuting layers and + adding/removing sublayers, improving performance especially in large stages. + Change notifications to external clients remain unaffected, and legacy + behavior is retained for layers that may contain relocates. This optimization + is still in development and is disabled by default. It can be enabled + by setting the environment variable + PCP_ENABLE_MINIMAL_CHANGES_FOR_LAYER_OPERATIONS = 1. + +- Deprecated time sample related methods on SdfLayer, to be removed in the next + release. SdfAttributeSpec now owns these time sample related methods. + +- Converted NdrSdfTypeIndicator from a std::pair to a full class. + +- Removed residual member function declaration for SdfPath. + (PR: [#3254](https://github.com/PixarAnimationStudios/OpenUSD/pull/3254)) + +- Enhanced SdfCopySpec() to handle overlapping source/destination by copying the + source to a temporary anonymous layer first, then copying that temporary to + the destination. + (Issue: [#3095](https://github.com/PixarAnimationStudios/OpenUSD/issues/3095)) + +- Initial work done on animation curves in USD. + +- Fixed performance issue writing .usdc files with high time sample counts. + (Issue: [#3249](https://github.com/PixarAnimationStudios/OpenUSD/issues/3249)) + +- Reimplemented .usda text file parser using PEGTL. This removes a dependency on + lex/yacc and also provides some performance improvements. + (PR: [#3005](https://github.com/PixarAnimationStudios/OpenUSD/pull/3005), + [#3293](https://github.com/PixarAnimationStudios/OpenUSD/pull/3293), + [#3294](https://github.com/PixarAnimationStudios/OpenUSD/pull/3294)) + +- Fixed bugs in the namespace-editing code that caused unnecessary and incorrect + edits to children defined by upstream composition dependencies. + +- Various updates for new Validation framework: + - Updated UsdValidationError to include a name property, used along with the + validator name to create an error identifier. This identifier can be used to + categorize and filter errors, especially when a validator can generate + multiple errors of different types. The error identifier is of the form + "validatorName"."ErrorName" or "plugName":"validatorName"."ErrorName". + - Added UsdValidationContext concept, which can be constructed by selecting + validators using keywords, plugins, validator metadata, schema types, or + pre-selected sets of validators. Validators for ancestor schema types are + also considered when selecting validators for a validation context. Clients + can use Validate() API to validate a layer, stage, or a set of prims with + parallel execution and error collection. UsdValidationContext initialization + may load plugins in order to load the validators. UsdValidationContext is a + stateless context, which means that clients handle validation input and + result tracking. + - Updated UsdValidationRegistry to be immortal, which means that any + registered validators and validator suites are also immortal. + - Added schema validators using the new Validation framework: + - Added StageMetadata Validator for usdGeom domain. + (PR: [#3134](https://github.com/PixarAnimationStudios/OpenUSD/pull/3134)) + - Added StageMetadata Validator for core USD. + (PR: [#3125](https://github.com/PixarAnimationStudios/OpenUSD/pull/3125)) + - Added SkelBindingApiAppliedValidator and SkelBindingApiValidator for + usdSkel domain. + (PR: [#3166](https://github.com/PixarAnimationStudios/OpenUSD/pull/3166)) + - Added MaterialBindingApiAppliedValidator, EncapsulationRulesValidator for + usdShade domain. + (PR: [#3154](https://github.com/PixarAnimationStudios/OpenUSD/pull/3154)) + (PR: [#3227](https://github.com/PixarAnimationStudios/OpenUSD/pull/3227)) + - Added a Usdz Package Encapsulation Validator for usdUtils domain. + (PR: [#3206](https://github.com/PixarAnimationStudios/OpenUSD/pull/3206)) + - Added validators for UsdGeomSubsets + (PR: [#3123](https://github.com/PixarAnimationStudios/OpenUSD/pull/3123)) + - Updated UsdValidationErrorType to be registered as TfEnum. + (PR: [#3223](https://github.com/PixarAnimationStudios/OpenUSD/pull/3223)) + - Added Python bindings for UsdValidatorMetadata, UsdValidator, + UsdValidatorSuite, UsdValidationError, UsdValidationErrorSite, + UsdValidationErrorType and UsdValidationRegistry. + (PR: [#3232](https://github.com/PixarAnimationStudios/OpenUSD/pull/3232)) + (PR: [#3236](https://github.com/PixarAnimationStudios/OpenUSD/pull/3236)) + (PR: [#3242](https://github.com/PixarAnimationStudios/OpenUSD/pull/3242)) + +- Added support for `BlockCollection()` and `ResetCollection()` to + `UsdCollectionAPI` for expression-mode collections. Also added + `IsInExpressionMode()` and `IsInRelationshipsMode()` convenience APIs. + +- usdGenSchema now adds a schemaIdentifier field to schema plugInfo metadata. + When present, this field will be used as the schema's identifier in the schema + registry. If not, the alias under UsdSchemaBase will be used. + +- Updated usdGenSchema to generate helper files used in the build so that when + adding a new schema class to a schema library, users will just need to re-run + usdGenSchema instead of having to name the generated files manually in + CMakeLists.txt + +- Updated sdrOslParser to provide metadata (usdSchemaDef_* and + sdrGlobalConfig_*) used for schema generation via usdgenschemafromsdr. This + allows clients to generate USD schema from OSL shader definitions which are + registered via sdr. + +- Added a new usdSemantics module which includes a SemanticsLabelsAPI schema + for labeling prims with tokens. The implementation diverges slightly with + [the proposal](https://github.com/PixarAnimationStudios/OpenUSD-proposals/tree/main/proposals/semantic_schema) + with the taxonomy being after "labels" instead of before in the property name + (e.g., `semantics:labels:` instead of `semantics::labels`). + In addition to the schema, UsdSemanticsLabelsQuery provides a reference for + how ancestor labeling is expected to work and inherit. + (PR: [#3103](https://github.com/PixarAnimationStudios/OpenUSD/pull/3103)) + +- Added support for elementType "segment" to UsdGeomSubset, where "segment" + refers to a segment of a UsdGeomBasisCurves object. + +- Updated UsdLuxCylinderLight bounds computation to use X axis as major axis. + (Issue: [#3233](https://github.com/PixarAnimationStudios/OpenUSD/issues/3233), + PR: [#3246](https://github.com/PixarAnimationStudios/OpenUSD/pull/3246)) + +- Removed RenderDenoisePass from usdRender schemas. + +- Fixed crash in UsdSkelAnimQuery::ComputeJointLocalTransformComponents when + translate, rotate, or scale attributes are not present. + +- Updated UsdUtils.UpdateSchemaWithSdrNode to populate the shaderId attribute + for all shaderNodes across sourceTypes for the same identifier. + +- Added Python performance module under extras directory in support of local + performance testing and for tracking performance over OpenUSD releases. See + usdmeasureperformance.py and + [documentation](https://openusd.org/release/ref_performance_metrics.html) + for more details. + +### Hydra + +- Storm and HdPrman lighting/shading have been updated to be more consistent + when combining different material types and light types. Physically based + lighting and physically based materials have not changed; nor have camera + lights and fallback materials. However, camera lights and physically based + materials will appear brighter, and physically based lights and fallback + materials will appear darker, in order to produce correct lighting response. + +- Made change to allow the generative procedural resolving scene index to be + more easily toggled (via a new switchingSceneIndex). + +- Added a new filtering scene index: HdsiPrimTypeAndPathPruningSceneIndex. One + use case is to switch between camera and scene lights by changing the path + predicate. + +- Fixed a problem with motion blur when using HdRenderIndex::InsertSceneIndex, + where the shutter interval was not communicated from the render delegate to + emulation. Hence, emulation called GetContributingSampleTimesForInterval on an + HdSampledDataSource returned by the inserted scene index with a bad + startTime/endTime. + +- Overhauled HdExtComputationSchema and related schemas. In particular, + introduced HdExtComputationCpuCallback and changed the CPU callback data + source to return the new type. + +- Added typed getters and setters to HdExtComputationContext. + +- Introduced HdsiExtComputationDependencySceneIndex which clients can use + together with the HdsiExtComputationPrimvarPruningSceneIndex to evaluate and + invalidate ext computation primvars. + +- Added the WithOrientation method to PxOsdMeshTopology which behaves similar to + the WithScheme and WithHoleIndices methods. It returns a copy of the mesh + topology object except with the orientation set to the given orientation. + +- Added GeomUtilDiskMeshGenerator for generating disk-shaped meshes. + +- Fixed the GeomUtilCapsuleMeshGenerator so that the height, bottom radius, and + top radius of the cylindrical portion of the capsule is retained and the + spheres are adjusted to maintain continuity with the cylinder sides, as + defined in the documentation for UsdGeomCapsule. + +- Altered how the numCapAxial parameter works for GeomUtilCapsuleMeshGenerator + when the radii are different. When the radii differ, the numCapAxial parameter + is doubled and the number of cross-sections are divided between the top and + bottom hemispheres relative to the angle that each portion uses. This makes + the density of the mesh more even between the bottom and top when the radii + difference is large. + +- Added normals generation to the various mesh generation utility classes. + Similar to the point generation, the classes provide a method that returns the + number of normals and a method for generating the normals into a provided + container iterator. In addition, the interpolation mode of the normals can be + requested. + +- Made improvements to the light linking scene index. Added support for + non-nested native and point instancers and significantly improved invalidation + performance. + +- Prefixed predicate expressions with "hd" for clarity and deprecated existing + predicates. + +- Added render index API to allow batching of notices sent by the merging scene + index. + +- Fixed a subtle bug in the generative procedural resolving scene index to not + cook procedurals in response to scene queries. + +- Added RecipeMaterialOverride schema. + +- Added HdsiMaterialOverrideResolvingSceneIndex to resolve material overrides. + +- Fixed bug with loading monochrome .exr images. + (PR: [#3343](https://github.com/PixarAnimationStudios/OpenUSD/pull/3343)) + +### UsdImaging + +- Added support for UsdGeomPlane in Scene Index mode. + +- Added UsdImagingModelSchema for any prim that has UsdModelAPI data in Scene + Index mode, including models demoted to act as subcomponents within other + models. + +- Fixed a bug causing spurious warnings about "implementationSource" for lights. + +- Fixed an invalidation bug so that when a material is edited, prims with + that material bound will have their primvars correctly invalidated. + (Issue: [#2382](https://github.com/PixarAnimationStudios/OpenUSD/issues/2382)) + +- Fixed DeprecationWarning in usdviewq/appController.py caused by a regex + containing an invalid escape sequence. + (PR: [#2955](https://github.com/PixarAnimationStudios/OpenUSD/pull/2955)) + +- Added AOV light adapter for transporting USD AOV lights to Hydra. + +### Storm + +- Fixed Vulkan buffer leaks in HdSt_PipelineDrawBatch. + (PR: [#3313](https://github.com/PixarAnimationStudios/OpenUSD/pull/3313)) + +- Improved Lavapipe support, enabling the Vulkan driver as a software rasterizer + on macOS. + (PR: [#3121](https://github.com/PixarAnimationStudios/OpenUSD/pull/3121)) + +- Added support for configurable anisotropic filtering in Storm and Hgi. We now + disable anisotropy for certain texture/sampler uses such as dome light + textures and AOVs. + (PR: [#3216](https://github.com/PixarAnimationStudios/OpenUSD/pull/3216)) + +- Fixed deadlock when Vulkan command buffers are consumed faster than they are + executed. + (PR: [#3170](https://github.com/PixarAnimationStudios/OpenUSD/pull/3170)) + +- Updated simpleLights to increase the brightness when used with physically + based materials (for example, UsdPreviewSurface or MaterialX). + +- Updated fallback shading to decrease the brightness when used with physically + based lights (like UsdLux), for consistency with physically based materials. + +- Fixed displacement shading when using vertex or varying displacement + parameterization with Metal. + (Issue: [#3248](https://github.com/PixarAnimationStudios/OpenUSD/issues/3248)) + +- Updated drawing of selected mesh edges to eliminate the need to apply a depth + offset in the geometry shader. + +- Exposed an option in HdMeshReprDesc to enable generation of surface edge ids + for surface and hull geom styles which do not otherwise draw edges. This + option is disabled by default which avoids enabling geometry shader stages for + more use cases. + (PR: [#3071](https://github.com/PixarAnimationStudios/OpenUSD/pull/3071)) + +- Shaders for basis curves rprims that are rendered as ribbons are now provided + with a texture coordinate that varies over the width of the curve, via the + patchCoord argument to the shader terminal. + +- Fixed potential texture memory leak by explicitly calling garbage collection + of the necessary subsystem from resource registry's garbage collection. + +- Storm draw target clients no longer need to call + HdChangeTracker::MarkStateDirty when a draw target gets disabled and enabled. + Storm automatically does the necessary invalidation by tracking the version + number of the active draw target set in HdStRenderParam. + +- Fixed the deep selection resolve mode for the "pickPointsAndInstances" pick + target. + +- Fixed missing include in glslProgram. + (PR: [#3283](https://github.com/PixarAnimationStudios/OpenUSD/pull/3283)) + +### RenderMan Hydra Plugin + +- **Important**: Removed hdPrman for RenderMan 25. This was deprecated in USD + 24.08 + +- usdRiPxr schemas for rman26.3 are not bundled with OpenUSD and instead will be + installed during a OpenUSD build from the specified RenderMan location. + +- Added support for the official RenderMan PxrPrimvarAPI schema in HdPrman. + +- Fixed a bug with missing invalidation of time-varying primvars in Scene Index + mode. This would manifest as a stale primvar value after changing the input + scene time during a render. + +- Added HD_PRMAN_INTERACTIVE_RENDER_WITH_RENDER_SETTINGS which adds the render + settings' products to the task's AOV bindings in the render view. + +- Updated simpleLights (that is, lights set via + HdxTaskController::SetLightingState) to increase the brightness when used with + or without materials. + +- Added many preprocessor directives as needed to support compiling against USD + versions back to 22.05. + +- hdPrman now respects an env var called RMAN_XPU_GPUGCONFIG that can be set + with a comma delimited list of the indexes of the selected GPUs. + +- Updated the use of ri:checkpoint:exitat to work independently of + ri:checkpoint:interval being set. + +- Updated to use "Shutter settings" on the camera and ignore ri:shutter render + setting. + +- Updated PxrBakeTexture to correctly write to non tex files which exist on disk. + +- Fixed a bug where switching between VDB volumes that kept the same path name + would not update in the interactive render. + +- Fixed a bug where interactively editing the Material Sync Mode of a + PxrMeshLight would not trigger the expected update of the mesh light + geometry's visibility. Note that mesh light support is still in active + development and will be enabled in a future release. + +- Fixed a crash that could happen when switching between RenderMan Hydra + delegates in Katana. + +- Added support for environment variable HD_PRMAN_TEX_EXTS that accepts a + colon-separated list of extensions known to be tex compatible, e.g. "tex:txr". + +- Fixed a bug where UDIM textures used by the USDUvTexture node would be flipped + incorrectly. + +- Updated Volume prims with primvar named "vel" or "velocity" to infer the type + to be vector rather than float. + +- Support for the PRMAN_OSL_BEFORE_RIXPLUGINS environment variable to allow + resolving OSL shaders before C++. + +- Support finding MaterialX search paths at runtime based on a DCC install + location. + +- Support naming the hdPrman delegate something other than "Prman". + +- Support Ri:PixelFilterName and Ri:PixelFilterWidth options. + +- Various updates to SideFX Solaris support. + - Enabled the use of interactive denoiser from within Solaris. + - Fixed a bug where background renders in Solaris could lead to a crash if a + RIS render was already running interactively or if the output type of the + render was not set to "raster". + - Fixed a bug where pixelAspectRatio wasn't having the expected effect. + - Fixed some issues with MaterialX in Solaris. + - Fixed problem where hdPrman would keep rendering in the background when the + viewport switched to the GL renderer in Solaris. + - Improved data/display window calculation and removed clamp on overscan. + - Added support for aggregate volumes in Solaris. + - Added HD_PRMAN_HIDE_DEFAULT_DOMELIGHT_TEXTURE environment variable, which, + when set, forces any textured dome lights with a prefix of `` + or `` to be camera-invisible, as a temporary measure to + support Solaris. + +- Improved hdPrman compatibility with the Hush SideFX command line rendering + utility. + +- More work on hdPrman Hydra 2.0 transition. The following assumes a recent USD + version but does not require HD_PRMAN_EXPERIMENTAL_RILEY_SCENE_INDEX_OBSERVER. + The HdPrman_RileyGlobalsSceneIndex filtering scene index now computes some of + the Riley options to add a riley:globals prim. hdPrman's + HdsiPrimManagingSceneIndexObserver picks up the options on the riley:globals + prim and makes them contribute to the Riley::SetOptions call. + +- Fixed a bug where rendering a product without vars led to a crash in RenderMan. + +- Added support for PxrEnvDayLight. + +- Small performance cleanup for purpose-based visibility. + +### MaterialX + +- Made a change to how MaterialX node names are constructed from material + network node paths to support Solaris. This change only affects hdPrman built + as part of a DCC. + +- Fixed issue with Storm when rendering custom nodes that use the + node in their defining nodegraph, and either re-use that node's output or are + a multi-output node. + +- Fixed divide by zero issue in the calculation of a light's intensity value + inside Storm's MaterialX glslfx shader. + +- Added support for custom texture nodes in hdPrman. + +- Switched the USD name of surface shader nodes to use the MaterialX node name + instead of the NodeDef name. + (Issue: [#3100](https://github.com/PixarAnimationStudios/OpenUSD/issues/3100), + PR: [#3147](https://github.com/PixarAnimationStudios/OpenUSD/pull/3147)) + +- Fixed shadow support for MaterialX materials in Metal. + (Issue: [#3176](https://github.com/PixarAnimationStudios/OpenUSD/issues/3176), + PR: [#3264](https://github.com/PixarAnimationStudios/OpenUSD/pull/3264)) + +- Fixed testUsdMtlxFileFormat.py. + (PR: [#3147](https://github.com/PixarAnimationStudios/OpenUSD/pull/3147)) + +- Added more function tracing in UsdMtlx. + (PR: [#2806](https://github.com/PixarAnimationStudios/OpenUSD/pull/2806)) + +### Embree Hydra Plugin + +- Fixed a bug in HdEmbree random number generation. + (PR: [#3211](https://github.com/PixarAnimationStudios/OpenUSD/pull/3211)) + +- Added HDEMBREE_RANDOM_NUMBER_SEED to facilitate stable image testing. + (PR: [#3183](https://github.com/PixarAnimationStudios/OpenUSD/pull/3183)) + +- Typo fix and refactoring of ray hit code. + (PR: [#3185](https://github.com/PixarAnimationStudios/OpenUSD/pull/3185)) + +### usdview + +- Made a fix to correctly handle device pixel ratio with multi-display setups. + +- Added applied API schema data to the usdview "Meta Data" tab. + (Issue: [#1431](https://github.com/PixarAnimationStudios/OpenUSD/issues/1431)) + +### Documentation + +- Added new [performance metrics page](https://openusd.org/release/ref_performance_metrics.html) + to docs, used to publish metrics for each release, and describe how metrics + are measured. + +- Various documentation updates: + - Improvements to Hydra prim schema documentation. + - Updated docs to clarify schema strength ordering. + - Additional doc fixes. + (PR: [#2695](https://github.com/PixarAnimationStudios/OpenUSD/pull/2695), + [#3287](https://github.com/PixarAnimationStudios/OpenUSD/pull/3287)) + +- SIGGRAPH 2024 BoF slides PDF added to [Downloads page](https://openusd.org/release/dl_downloads.html). + +- [Contributing to USD](https://openusd.org/release/contributing_to_usd.html) + page updated with instructions to use when making major changes. + +- Added [Security Policy](https://github.com/PixarAnimationStudios/OpenUSD/blob/release/SECURITY.md) + with details on reporting security vulnerabilities with USD. + +- Switched .dox files in pxr/usd/usd to Markdown files (which addressed some + formatting issues), and renamed enclosing directory to "docs". We recommend + Markdown for new modules, as this makes the documentation more portable. + +- Updated URL to USD Assets Working Group "Primvar Interpolation" asset in the + Rendering with USD user guide. + (PR: [#3110](https://github.com/PixarAnimationStudios/OpenUSD/pull/3110)) + +### Security + +- Fixed crash when reading .usdc file with corrupt SdfSpecType values, see + [security advisory on github](https://github.com/PixarAnimationStudios/OpenUSD/security/advisories/GHSA-4j7j-gm3f-m63w). + +
+ Previous Releases + ## [24.08] - 2024-07-25 OpenUSD is now licensed under the Tomorrow Open Source Technology license. This @@ -621,8 +1146,6 @@ validators were also added: in relationship-mode vs expression-mode, and how the built-in properties affect membership determination in each mode. -
- Previous Releases ## [24.05] - 2024-04-19 From bc2e5a8813d129f962b6e71e7e49244a065e9cf2 Mon Sep 17 00:00:00 2001 From: pixar-oss Date: Wed, 23 Oct 2024 08:25:44 -0700 Subject: [PATCH 22/82] Adding note about optional dependencies still potentially needing to build with boost (Internal change: 2345226) --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bdad3f9870..28d5e60928 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,9 @@ - Added "--boost-python" option for building OpenUSD's Python bindings with boost::python. This option is for testing and transition purposes; it is - deprecated and will be removed in a future release. + deprecated and will be removed in a future release. + Note that the build script will continue to build boost if it's needed by + optional dependencies. These include OpenImageIO and OpenVDB. - Enabled support for imaging and usdImaging on Apple embedded platforms. (PR: [#3215](https://github.com/PixarAnimationStudios/OpenUSD/pull/3215)) From a1fdf9167c3c8c88734d866cce569488ca79aef9 Mon Sep 17 00:00:00 2001 From: pixar-oss Date: Wed, 23 Oct 2024 08:25:54 -0700 Subject: [PATCH 23/82] Adding missing build option from release note (Internal change: 2345229) --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28d5e60928..a56e9631a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,9 +18,9 @@ `PXR_USE_BOOST_PYTHON=ON` when running CMake. This option is for testing and transition purposes; it is deprecated and will be removed in a future release. -- Added "--boost-python" option for building OpenUSD's Python bindings with - boost::python. This option is for testing and transition purposes; it is - deprecated and will be removed in a future release. +- Added "--boost-python" option to build_usd.py for building OpenUSD's Python + bindings with boost::python. This option is for testing and transition + purposes; it is deprecated and will be removed in a future release. Note that the build script will continue to build boost if it's needed by optional dependencies. These include OpenImageIO and OpenVDB. From 7eb1af862d6cb99ac2d1c1a16ad5c1a6204380dc Mon Sep 17 00:00:00 2001 From: pixar-oss Date: Wed, 23 Oct 2024 08:26:27 -0700 Subject: [PATCH 24/82] doc fixes for tutorial errors (Internal change: 2345344) --- docs/tut_authoring_variants.rst | 2 +- docs/tut_traversing_stage.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tut_authoring_variants.rst b/docs/tut_authoring_variants.rst index 25ec7a34d6..5f053cbc6c 100644 --- a/docs/tut_authoring_variants.rst +++ b/docs/tut_authoring_variants.rst @@ -344,7 +344,7 @@ these files to a working directory and make them writable. .. image:: http://openusd.org/images/tut_authoring_variants_helloworld2.png #. In the interpreter you can see the variant selections that usdview authors to - the `session layer <#usdglossary-sessionlayer>`_ . This is the same sparse + the :ref:`session layer `. This is the same sparse override you would see if you referenced this layer into another one and authored the variant selection in the referencing layer. diff --git a/docs/tut_traversing_stage.rst b/docs/tut_traversing_stage.rst index 75b584fbb8..e697ef1473 100644 --- a/docs/tut_traversing_stage.rst +++ b/docs/tut_traversing_stage.rst @@ -78,7 +78,7 @@ folder to a working directory and make its contents writable. .. image:: http://openusd.org/images/tut_traversing_stage_refexample.png You can inspect the contents of the - `session layer <#usdglossary-sessionlayer>`_ in the interpreter to see + :ref:`session layer ` in the interpreter to see the authored deactivation opinion. .. code-block:: pycon From 85c7f1084a07a6835e993d24bb99421d6216bbc9 Mon Sep 17 00:00:00 2001 From: sunyab Date: Wed, 23 Oct 2024 11:17:44 -0700 Subject: [PATCH 25/82] pcp: Fix bug when muting layers/removing sublayers with sublayers When computing incremental changes, Pcp needs to ignore the layers being muted/removed *and* any of the sublayers they bring in when recomputing state because these layers should no longer contribute opinions to the composed scene. The latter was not happening, which caused prim indexes to not be invalidated as expected. This fix just ensures we do track all of those layers. Fixing this issue revealed a separate bug when invalidating indexes for prims that reference a muted layer. The logic for determining when this invalidation was necessary was flipped and also did not account for culled dependencies. This has been fixed and new unit tests added to cover this case. (Internal change: 2345458) --- pxr/usd/pcp/cache.cpp | 4 +- pxr/usd/pcp/changes.cpp | 114 +++++++++--------- pxr/usd/pcp/changes.h | 6 +- pxr/usd/pcp/composeSite.cpp | 10 +- pxr/usd/pcp/composeSite.h | 4 +- pxr/usd/pcp/dependencies.cpp | 3 +- pxr/usd/pcp/dependency.h | 3 + pxr/usd/pcp/primIndex.cpp | 18 ++- pxr/usd/pcp/primIndex.h | 3 +- pxr/usd/pcp/testenv/testPcpChanges.py | 102 +++++++++++++++- .../TestMuteCulledAncestralReference/ref.sdf | 8 ++ .../TestMuteCulledAncestralReference/root.sdf | 37 ++++++ .../root.sdf | 17 +++ .../TestMuteRemoveWithNestedSublayers/sub.sdf | 6 + .../sub2.sdf | 25 ++++ .../sub3.sdf | 12 ++ .../root.sdf | 17 +++ .../sub.sdf | 7 ++ .../sub2.sdf | 20 +++ .../sub3.sdf | 12 ++ pxr/usd/pcp/testenv/testPcpLayerMuting.py | 88 +++++++------- .../testPcpLayerMuting.testenv/refs/ref.sdf | 6 +- .../testPcpLayerMuting.testenv/refs/root.sdf | 10 +- 23 files changed, 409 insertions(+), 123 deletions(-) create mode 100644 pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteCulledAncestralReference/ref.sdf create mode 100644 pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteCulledAncestralReference/root.sdf create mode 100644 pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithNestedSublayers/root.sdf create mode 100644 pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithNestedSublayers/sub.sdf create mode 100644 pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithNestedSublayers/sub2.sdf create mode 100644 pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithNestedSublayers/sub3.sdf create mode 100644 pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithSiblingSublayers/root.sdf create mode 100644 pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithSiblingSublayers/sub.sdf create mode 100644 pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithSiblingSublayers/sub2.sdf create mode 100644 pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithSiblingSublayers/sub3.sdf diff --git a/pxr/usd/pcp/cache.cpp b/pxr/usd/pcp/cache.cpp index 0713a7cd8c..e07a52fdcb 100644 --- a/pxr/usd/pcp/cache.cpp +++ b/pxr/usd/pcp/cache.cpp @@ -1037,8 +1037,8 @@ PcpCache::Apply(const PcpCacheChanges& changes, PcpLifeboat* lifeboat) // we may have blown the prim index so check that it exists. if (PcpPrimIndex* primIndex = _GetPrimIndex(path)) { Pcp_RescanForSpecs(primIndex, IsUsd(), - /* updateHasSpecs */ true, - changes.layersToMute); + /* updateHasSpecs */ true, + &changes); // If there are no specs left then we can discard the // prim index. diff --git a/pxr/usd/pcp/changes.cpp b/pxr/usd/pcp/changes.cpp index 56db6b26a0..016edbb9df 100644 --- a/pxr/usd/pcp/changes.cpp +++ b/pxr/usd/pcp/changes.cpp @@ -1411,30 +1411,6 @@ void PcpChanges::DidMuteAndUnmuteLayers( const std::vector& layersToMute, const std::vector& layersToUnmute) { - PcpCacheChanges& changes = _GetCacheChanges(cache); - - // We first want to grab all layers that will be muted and unmuted and - // store them off. We may need to refer to these vectors when processing - // changes to account for a layer's future state once these changes have - // been applied - for (const auto& layerId : layersToMute) { - SdfLayerRefPtr layerToMute = - _LoadSublayerForChange(cache, layerId, _SublayerRemoved); - if (layerToMute) { - _lifeboat.Retain(layerToMute); - changes.layersToMute.emplace_back(layerToMute); - } - } - - for (const auto& layerId : layersToUnmute) { - SdfLayerRefPtr layerToUnmute = - _LoadSublayerForChange(cache, layerId, _SublayerAdded); - if (layerToUnmute) { - _lifeboat.Retain(layerToUnmute); - changes.layersToUnmute.emplace_back(layerToUnmute); - } - } - // Register changes for all computed layer stacks that are // affected by the newly muted/unmuted layers. for (const auto& layerToMute : layersToMute) { @@ -1455,14 +1431,11 @@ PcpChanges::_MarkReferencingSitesAsSignificantlyChanged( const PcpCacheChanges& cacheChanges = _GetCacheChanges(cache); - const auto refOrPayloadChangeFunc = - [this, cache](const SdfPath &depIndexPath, - const PcpNodeRef &node) + const auto refOrPayloadChangeFunc = + [this, cache](const SdfPath& depIndexPath, PcpArcType arcType) { - PcpArcType arcType = node.GetArcType(); - if (arcType == PcpArcTypeReference || - arcType == PcpArcTypePayload) - { + if (arcType == PcpArcTypeReference || + arcType == PcpArcTypePayload) { DidChangeSignificantly(cache, depIndexPath); } }; @@ -1477,15 +1450,26 @@ PcpChanges::_MarkReferencingSitesAsSignificantlyChanged( /* filter */ true); for(const PcpDependency &dep: deps) { - // This ensures that all sites which reference this layer are - // also marked as having changed significantly. + // If this layer stack no longer has any opinions at dep.sitePath, + // composed prims that reference this site must be recomputed to + // detect the broken reference. if (PcpComposeSiteHasPrimSpecs( - layerStack, dep.sitePath, cacheChanges.layersToMute)) - { - Pcp_ForEachDependentNode(dep.sitePath, layerStack, - dep.indexPath, - *cache, refOrPayloadChangeFunc); + layerStack, dep.sitePath, + cacheChanges.layersAffectedByMutingOrRemoval)) { + continue; } + + Pcp_ForEachDependentNode( + dep.sitePath, layerStack, dep.indexPath, *cache, + [&](const SdfPath &depIndexPath, const PcpNodeRef &node) + { + refOrPayloadChangeFunc(depIndexPath, node.GetArcType()); + }, + [&](const SdfPath& depIndexPath, const PcpCulledDependency& dep) + { + refOrPayloadChangeFunc(depIndexPath, dep.arcType); + } + ); } } } @@ -1534,13 +1518,25 @@ PcpChanges::_DidMuteLayer( std::string summary; std::string* debugSummary = TfDebug::IsEnabled(PCP_CHANGES) ? &summary : 0; - PcpCacheChanges& cacheChanges = _GetCacheChanges(cache); - const SdfLayerRefPtr mutedLayer = _LoadSublayerForChange(cache, layerId, _SublayerRemoved); const PcpLayerStackPtrVector& layerStacks = cache->FindAllLayerStacksUsingLayer(mutedLayer); + PcpCacheChanges& cacheChanges = _GetCacheChanges(cache); + if (mutedLayer) { + _lifeboat.Retain(mutedLayer); + cacheChanges.didMuteOrUnmuteNonEmptyLayer |= !mutedLayer->IsEmpty(); + + // Track sublayers that have been muted separately. These + // layers should no longer contribute opinions to the composed + // scene; during change processing, clients that need to + // recompute state (e.g. prim stacks) must explicitly ignore + // these layers. This is because these layers won't be removed + // from layer stacks until change processing is complete. + cacheChanges.layersAffectedByMutingOrRemoval.insert(mutedLayer); + } + PCP_APPEND_DEBUG(" Did mute layer @%s@\n", layerId.c_str()); // XXX: Computing proper changes for layers containing relocates at this @@ -1568,15 +1564,11 @@ PcpChanges::_DidMuteLayer( DidChange(cache, changes); cacheChanges.layerChangeListVec.emplace_back( std::move(changes.front())); - _lifeboat.Retain(mutedLayer); _ProcessLayerStackAndDependencyChanges(cache, layerStacks); _MarkReferencingSitesAsSignificantlyChanged(cache, layerStacks); } - cacheChanges.didMuteOrUnmuteNonEmptyLayer |= - mutedLayer ? !mutedLayer->IsEmpty() : false; - if (debugSummary && !debugSummary->empty()) { TfDebug::Helper().Msg("PcpChanges::_DidMuteLayer\n%s", debugSummary->c_str()); @@ -1592,13 +1584,17 @@ PcpChanges::_DidUnmuteLayer( std::string summary; std::string* debugSummary = TfDebug::IsEnabled(PCP_CHANGES) ? &summary : 0; - PcpCacheChanges& cacheChanges = _GetCacheChanges(cache); - const SdfLayerRefPtr unmutedLayer = _LoadSublayerForChange(cache, layerId, _SublayerAdded); const PcpLayerStackPtrVector& layerStacks = cache->_layerStackCache->FindAllUsingMutedLayer(layerId); + PcpCacheChanges& cacheChanges = _GetCacheChanges(cache); + if (unmutedLayer) { + _lifeboat.Retain(unmutedLayer); + cacheChanges.didMuteOrUnmuteNonEmptyLayer |= !unmutedLayer->IsEmpty(); + } + PCP_APPEND_DEBUG(" Did unmute layer @%s@\n", layerId.c_str()); // XXX: Computing proper changes for layers containing relocates at this @@ -1631,15 +1627,11 @@ PcpChanges::_DidUnmuteLayer( DidChange(cache, changes); cacheChanges.layerChangeListVec.emplace_back( std::move(changes.front())); - _lifeboat.Retain(unmutedLayer); _ProcessLayerStackAndDependencyChanges(cache, layerStacks); _MarkReferencingSitesAsSignificantlyChanged(cache, layerStacks); } - cacheChanges.didMuteOrUnmuteNonEmptyLayer |= - unmutedLayer ? !unmutedLayer->IsEmpty() : false; - if (debugSummary && !debugSummary->empty()) { TfDebug::Helper().Msg("PcpChanges::_DidUnmuteLayer\n%s", debugSummary->c_str()); @@ -1783,7 +1775,9 @@ static bool _NoLongerHasAnySpecs(const PcpCacheChanges& changes, const PcpPrimIndex& primIndex) { for (const PcpNodeRef &node: primIndex.GetNodeRange()) { - if (PcpComposeSiteHasPrimSpecs(node.GetLayerStack(), node.GetPath(), changes.layersToMute)) { + if (PcpComposeSiteHasPrimSpecs( + node.GetLayerStack(), node.GetPath(), + changes.layersAffectedByMutingOrRemoval)) { return false; } } @@ -2203,8 +2197,21 @@ PcpChanges::_DidAddOrRemoveSublayer( _SublayerChangeType sublayerChange) { PcpCacheChanges& cacheChanges = _GetCacheChanges(cache); - cacheChanges.didAddOrRemoveNonEmptySublayer |= - sublayer && !sublayer->IsEmpty(); + if (sublayer) { + _lifeboat.Retain(sublayer); + cacheChanges.didAddOrRemoveNonEmptySublayer |= !sublayer->IsEmpty(); + + // Track sublayers that have been removed separately. These + // layers should no longer contribute opinions to the composed + // scene; during change processing, clients that need to + // recompute state (e.g. prim stacks) must explicitly ignore + // these layers. This is because these layers won't be removed + // from layer stacks until change processing is complete. + if (sublayerChange == _SublayerRemoved) { + cacheChanges.layersAffectedByMutingOrRemoval + .insert(sublayer); + } + } if (!TfGetEnvSetting( PCP_ENABLE_MINIMAL_CHANGES_FOR_LAYER_OPERATIONS) || @@ -2245,7 +2252,6 @@ PcpChanges::_DidAddOrRemoveSublayer( cacheChanges.layerChangeListVec.emplace_back( std::move(changes.front())); - _lifeboat.Retain(sublayer); return true; }; diff --git a/pxr/usd/pcp/changes.h b/pxr/usd/pcp/changes.h index 70298f6b64..ad7b5cc9f6 100644 --- a/pxr/usd/pcp/changes.h +++ b/pxr/usd/pcp/changes.h @@ -21,6 +21,7 @@ #include #include +#include PXR_NAMESPACE_OPEN_SCOPE @@ -134,8 +135,9 @@ class PcpCacheChanges { /// Will be true if a non empty sublayer was added or removed. bool didAddOrRemoveNonEmptySublayer = false; - /// Lists of layers that will be muted or unmuted during change processing. - std::vector layersToMute, layersToUnmute; + /// Set of layers that were explicitly muted or removed from a sublayer + /// list and all sublayers of those layers, recursively. + std::unordered_set layersAffectedByMutingOrRemoval; // Holds all the diff changelists that were computed when adding/removing // sublayers or muting/unmuting layers. diff --git a/pxr/usd/pcp/composeSite.cpp b/pxr/usd/pcp/composeSite.cpp index 7fb57f42c2..c487e8dadb 100644 --- a/pxr/usd/pcp/composeSite.cpp +++ b/pxr/usd/pcp/composeSite.cpp @@ -187,16 +187,14 @@ PcpComposeSitePermission(PcpLayerStackRefPtr const &layerStack, bool PcpComposeSiteHasPrimSpecs(PcpLayerStackRefPtr const &layerStack, SdfPath const &path, - const std::vector& layersToIgnore) + const std::unordered_set& + layersToIgnore) { for (auto const &layer: layerStack->GetLayers()) { // if a spec was found in this layer, ensure that it is currently not // being ignored. - if (layer->HasSpec(path)) { - if (std::find( layersToIgnore.begin(), layersToIgnore.end(), layer) - == layersToIgnore.end()) { - return true; - } + if (layer->HasSpec(path) && layersToIgnore.count(layer) == 0) { + return true; } } return false; diff --git a/pxr/usd/pcp/composeSite.h b/pxr/usd/pcp/composeSite.h index 2459d13ebe..02ccd95e30 100644 --- a/pxr/usd/pcp/composeSite.h +++ b/pxr/usd/pcp/composeSite.h @@ -206,8 +206,10 @@ PCP_API bool PcpComposeSiteHasPrimSpecs(PcpLayerStackRefPtr const &layerStack, SdfPath const &path, - const std::vector& layersToIgnore); + const std::unordered_set& + layersToIgnore); +PCP_API bool PcpComposeSiteHasPrimSpecs(PcpLayerStackRefPtr const &layerStack, SdfPath const &path); diff --git a/pxr/usd/pcp/dependencies.cpp b/pxr/usd/pcp/dependencies.cpp index 8edf6e21da..1fe32fb73f 100644 --- a/pxr/usd/pcp/dependencies.cpp +++ b/pxr/usd/pcp/dependencies.cpp @@ -537,9 +537,10 @@ Pcp_AddCulledDependency( PcpCulledDependency dep; dep.flags = depFlags; + dep.arcType = node.GetArcType(); dep.layerStack = node.GetLayerStack(); dep.sitePath = node.GetPath(); - if (node.GetArcType() == PcpArcTypeRelocate) { + if (dep.arcType == PcpArcTypeRelocate) { // See _ProcessDependentNode in pcp/cache.cpp for the similar code // we use to handle non-culled dependency // diff --git a/pxr/usd/pcp/dependency.h b/pxr/usd/pcp/dependency.h index 72c9f87b66..c50cd9e8ee 100644 --- a/pxr/usd/pcp/dependency.h +++ b/pxr/usd/pcp/dependency.h @@ -10,6 +10,7 @@ #include "pxr/pxr.h" #include "pxr/usd/pcp/api.h" #include "pxr/usd/pcp/mapFunction.h" +#include "pxr/usd/pcp/types.h" #include "pxr/usd/sdf/path.h" #include "pxr/base/tf/declarePtrs.h" @@ -121,6 +122,8 @@ struct PcpCulledDependency { /// Flag representing the type of dependency. PcpDependencyFlags flags = PcpDependencyTypeNone; + /// Arc type for this dependency. + PcpArcType arcType = PcpArcTypeRoot; /// Layer stack containing the specs the prim index depends on. PcpLayerStackRefPtr layerStack; /// Path of the dependency specs in the layer stack. diff --git a/pxr/usd/pcp/primIndex.cpp b/pxr/usd/pcp/primIndex.cpp index 353aa664b2..b41a875c51 100644 --- a/pxr/usd/pcp/primIndex.cpp +++ b/pxr/usd/pcp/primIndex.cpp @@ -9,6 +9,7 @@ #include "pxr/usd/pcp/primIndex.h" #include "pxr/usd/pcp/arc.h" #include "pxr/usd/pcp/cache.h" +#include "pxr/usd/pcp/changes.h" #include "pxr/usd/pcp/dynamicFileFormatContext.h" #include "pxr/usd/pcp/composeSite.h" #include "pxr/usd/pcp/debugCodes.h" @@ -4718,19 +4719,12 @@ _EnforcePermissions( } } -void -Pcp_RescanForSpecs(PcpPrimIndex *index, bool usd, bool updateHasSpecs) -{ - const std::vector layersToIgnore; - Pcp_RescanForSpecs(index, usd, updateHasSpecs, layersToIgnore); -} - void Pcp_RescanForSpecs( PcpPrimIndex *index, bool usd, bool updateHasSpecs, - const std::vector& layersToIgnore) + const PcpCacheChanges *cacheChanges = nullptr) { TfAutoMallocTag2 tag("Pcp", "Pcp_RescanForSpecs"); @@ -4741,7 +4735,8 @@ Pcp_RescanForSpecs( TF_FOR_ALL(nodeIt, index->GetNodeRange()) { auto node = *nodeIt; nodeIt->SetHasSpecs(PcpComposeSiteHasPrimSpecs( - node.GetLayerStack(), node.GetPath(), layersToIgnore)); + node.GetLayerStack(), node.GetPath(), + cacheChanges->layersAffectedByMutingOrRemoval)); } } } else { @@ -4755,7 +4750,10 @@ Pcp_RescanForSpecs( node.GetLayerStack()->GetLayers(); const SdfPath& path = node.GetPath(); for (size_t i = 0, n = layers.size(); i != n; ++i) { - if (layers[i]->HasSpec(path)) { + if (layers[i]->HasSpec(path) && + (!cacheChanges || + cacheChanges->layersAffectedByMutingOrRemoval + .count(layers[i]) == 0)) { nodeHasSpecs = true; primSites.push_back(node.GetCompressedSdSite(i)); } diff --git a/pxr/usd/pcp/primIndex.h b/pxr/usd/pcp/primIndex.h index 00cb9730d9..4d7c259817 100644 --- a/pxr/usd/pcp/primIndex.h +++ b/pxr/usd/pcp/primIndex.h @@ -40,6 +40,7 @@ TF_DECLARE_WEAK_AND_REF_PTRS(PcpPrimIndex_Graph); class ArResolver; class PcpCache; +class PcpCacheChanges; class PcpPrimIndex; class PcpPrimIndexInputs; class PcpPrimIndexOutputs; @@ -281,7 +282,7 @@ class PcpPrimIndex friend void Pcp_RescanForSpecs( PcpPrimIndex*, bool usd, bool updateHasSpecs, - const std::vector& layersToIgnore); + const PcpCacheChanges *cacheChanges); // The node graph representing the compositional structure of this prim. PcpPrimIndex_GraphRefPtr _graph; diff --git a/pxr/usd/pcp/testenv/testPcpChanges.py b/pxr/usd/pcp/testenv/testPcpChanges.py index 41ba6a5125..c036edfc91 100644 --- a/pxr/usd/pcp/testenv/testPcpChanges.py +++ b/pxr/usd/pcp/testenv/testPcpChanges.py @@ -6,7 +6,7 @@ # https://openusd.org/license. from pxr import Sdf, Pcp, Tf -import unittest +import os, unittest from contextlib import contextmanager INCREMENTAL_CHANGES = Tf.GetEnvSetting( @@ -1035,6 +1035,106 @@ def test_ChangesToCulledAncestralNodes(self): self.assertEqual(cp.GetPrimChanges(), ['/FSToyCarA/Looks/PaintedWood_PaintedYellow']) + def test_MuteCulledAncestralReferences(self): + """Tests that muting an ancestrally-referenced layer and invalidates + affected prim indexes when the corresponding node is culled.""" + + rootLayer = Sdf.Layer.FindOrOpen( + 'TestMuteCulledAncestralReference/root.sdf') + refLayer = Sdf.Layer.FindOrOpenRelativeToLayer(rootLayer, 'ref.sdf') + pcp = Pcp.Cache(Pcp.LayerStackIdentifier(rootLayer)) + + # Compute the initial prim index and verify that all reference + # nodes pointing to ref.sdf have been culled from the graph. + # All nodes should be in the root layer stack. + pi, err = pcp.ComputePrimIndex( + '/FSToyCarA/Looks/PaintedWood_PaintedYellow') + + nodes = [pi.rootNode] + while nodes: + node = nodes[0] + nodes = nodes[1:] + node.children + self.assertEqual(node.layerStack.layers[0], rootLayer) + + # However, we should have a dependency registered on ref.sdf. + refLayerStack = pcp.FindAllLayerStacksUsingLayer(refLayer)[0] + self.assertEqual( + [dep.indexPath for dep in pcp.FindSiteDependencies( + refLayerStack, '/FSToyCarA_defaultShadingVariant')], + ['/FSToyCarA']) + + # Mute ref.sdf and verify that the prim index is invalidated + # and that recomputing the prim index results in a composition + # error due to the muted reference layer. + pcp.RequestLayerMuting([refLayer.identifier], []) + self.assertTrue(pcp.IsLayerMuted(refLayer.identifier)) + + self.assertFalse(pcp.FindPrimIndex( + '/FSToyCarA/Looks/PaintedWood_PaintedYellow')) + pi, err = pcp.ComputePrimIndex( + '/FSToyCarA/Looks/PaintedWood_PaintedYellow') + + self.assertTrue(err) + + def test_MuteRemoveSublayerWithSublayers(self): + """Tests that muting/removing sublayers that also have sublayers + invalidate affected cache prim indexes.""" + + def _Test(rootLayerId, layerOperationFn): + rootLayer = Sdf.Layer.FindOrOpen(rootLayerId) + pcp = Pcp.Cache(Pcp.LayerStackIdentifier(rootLayer)) + + def _ComputePrimIndex(path): + pi, err = pcp.ComputePrimIndex(path) + self.assertFalse(err, f"Unexpected errors for {path}: {err}") + return (pi, path) + + def _FindPrimIndex(indexAndPath): + return True if pcp.FindPrimIndex(indexAndPath[1]) else False + + # These prim indexes either have all of their opinions or a def + # in the sublayers that will be removed from composition. + overInSublayers = _ComputePrimIndex('/Parent/OverInSublayers') + overAndDefInSublayers = _ComputePrimIndex('/Parent/OverAndDefInSublayers') + overInRootDefInSublayer = _ComputePrimIndex('/Parent/OverInRootDefInSublayer') + + # This prim index has an over in the root layer and another over in + # a sublayer that will be removed from composition. + overInSublayerAndRoot = _ComputePrimIndex('/Parent/OverInSublayerAndRoot') + + layerOperationFn(pcp) + + # After the layer operation, all of these prim indexes should be + # resync'd. + self.assertFalse(_FindPrimIndex(overInSublayers)) + self.assertFalse(_FindPrimIndex(overAndDefInSublayers)) + self.assertFalse(_FindPrimIndex(overInRootDefInSublayer)) + + # This prim index does not need to be recomputed, it just has an + # updated prim stack. + self.assertTrue(_FindPrimIndex(overInSublayerAndRoot)) + self.assertEqual( + overInSublayerAndRoot[0].primStack, + [rootLayer.GetPrimAtPath('/Parent/OverInSublayerAndRoot')]) + + # Test cases for muting a sublayer that itself has sublayers. + def _MuteSublayer(pcp): + subLayer = pcp.layerStack.layers[1] + self.assertEqual(os.path.basename(subLayer.identifier), 'sub.sdf') + pcp.RequestLayerMuting([subLayer.identifier], []) + + _Test('TestMuteRemoveWithNestedSublayers/root.sdf', _MuteSublayer) + _Test('TestMuteRemoveWithSiblingSublayers/root.sdf', _MuteSublayer) + + # Test cases for removing a sublayer that itself has sublayers. + def _RemoveSublayer(pcp): + with Pcp._TestChangeProcessor(pcp): + rootLayer = pcp.GetLayerStackIdentifier().rootLayer + rootLayer.subLayerPaths.clear() + + _Test('TestMuteRemoveWithNestedSublayers/root.sdf', _RemoveSublayer) + _Test('TestMuteRemoveWithSiblingSublayers/root.sdf', _RemoveSublayer) + def test_AddMuteRemoveSublayerWithRelocates(self): """Tests that adding/muting/removing sublayers that only define layer relocates will invalidate affected cached prim indexes.""" diff --git a/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteCulledAncestralReference/ref.sdf b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteCulledAncestralReference/ref.sdf new file mode 100644 index 0000000000..0951e460b0 --- /dev/null +++ b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteCulledAncestralReference/ref.sdf @@ -0,0 +1,8 @@ +#sdf 1.4.32 + +def "FSToyCarA_defaultShadingVariant" +{ + def "Looks" + { + } +} diff --git a/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteCulledAncestralReference/root.sdf b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteCulledAncestralReference/root.sdf new file mode 100644 index 0000000000..d9994d51e9 --- /dev/null +++ b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteCulledAncestralReference/root.sdf @@ -0,0 +1,37 @@ +#sdf 1.4.32 + +def "FSToyCarA_geom" +{ + def "Looks" + { + def "PaintedWood" + { + custom float inputs:wood_diffuseK + } + + def "PaintedWood_PaintedYellow" ( + inherits = + ) + { + } + } +} + +over "FSToyCarA" ( + references = [ + @./ref.sdf@, + + ] +) +{ + over "Looks" + { + over "PaintedWood" + { + } + + over "PaintedWood_PaintedYellow" + { + } + } +} diff --git a/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithNestedSublayers/root.sdf b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithNestedSublayers/root.sdf new file mode 100644 index 0000000000..f63cd99ff6 --- /dev/null +++ b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithNestedSublayers/root.sdf @@ -0,0 +1,17 @@ +#sdf 1.4.32 +( + subLayers = [ + @./sub.sdf@ + ] +) + +def "Parent" +{ + over "OverInSublayerAndRoot" + { + } + + over "OverInRootDefInSublayer" + { + } +} diff --git a/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithNestedSublayers/sub.sdf b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithNestedSublayers/sub.sdf new file mode 100644 index 0000000000..a9bf1f6aff --- /dev/null +++ b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithNestedSublayers/sub.sdf @@ -0,0 +1,6 @@ +#sdf 1.4.32 +( + subLayers = [ + @./sub2.sdf@ + ] +) diff --git a/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithNestedSublayers/sub2.sdf b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithNestedSublayers/sub2.sdf new file mode 100644 index 0000000000..56dea6230c --- /dev/null +++ b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithNestedSublayers/sub2.sdf @@ -0,0 +1,25 @@ +#sdf 1.4.32 +( + subLayers = [ + @./sub3.sdf@ + ] +) + +over "Parent" +{ + over "OverInSublayerAndRoot" + { + } + + def "OverInRootDefInSublayer" + { + } + + over "OverInSublayers" + { + } + + over "OverAndDefInSublayers" + { + } +} diff --git a/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithNestedSublayers/sub3.sdf b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithNestedSublayers/sub3.sdf new file mode 100644 index 0000000000..2178853dc2 --- /dev/null +++ b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithNestedSublayers/sub3.sdf @@ -0,0 +1,12 @@ +#sdf 1.4.32 + +over "Parent" +{ + over "OverInSublayers" + { + } + + def "OverAndDefInSublayers" + { + } +} diff --git a/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithSiblingSublayers/root.sdf b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithSiblingSublayers/root.sdf new file mode 100644 index 0000000000..f63cd99ff6 --- /dev/null +++ b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithSiblingSublayers/root.sdf @@ -0,0 +1,17 @@ +#sdf 1.4.32 +( + subLayers = [ + @./sub.sdf@ + ] +) + +def "Parent" +{ + over "OverInSublayerAndRoot" + { + } + + over "OverInRootDefInSublayer" + { + } +} diff --git a/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithSiblingSublayers/sub.sdf b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithSiblingSublayers/sub.sdf new file mode 100644 index 0000000000..998848ae34 --- /dev/null +++ b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithSiblingSublayers/sub.sdf @@ -0,0 +1,7 @@ +#sdf 1.4.32 +( + subLayers = [ + @./sub2.sdf@, + @./sub3.sdf@ + ] +) diff --git a/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithSiblingSublayers/sub2.sdf b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithSiblingSublayers/sub2.sdf new file mode 100644 index 0000000000..7449c7c97e --- /dev/null +++ b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithSiblingSublayers/sub2.sdf @@ -0,0 +1,20 @@ +#sdf 1.4.32 + +over "Parent" +{ + over "OverInSublayerAndRoot" + { + } + + def "OverInRootDefInSublayer" + { + } + + over "OverInSublayers" + { + } + + over "OverAndDefInSublayers" + { + } +} diff --git a/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithSiblingSublayers/sub3.sdf b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithSiblingSublayers/sub3.sdf new file mode 100644 index 0000000000..2178853dc2 --- /dev/null +++ b/pxr/usd/pcp/testenv/testPcpChanges.testenv/TestMuteRemoveWithSiblingSublayers/sub3.sdf @@ -0,0 +1,12 @@ +#sdf 1.4.32 + +over "Parent" +{ + over "OverInSublayers" + { + } + + def "OverAndDefInSublayers" + { + } +} diff --git a/pxr/usd/pcp/testenv/testPcpLayerMuting.py b/pxr/usd/pcp/testenv/testPcpLayerMuting.py index 76f50eee5e..c86bbaa9c9 100644 --- a/pxr/usd/pcp/testenv/testPcpLayerMuting.py +++ b/pxr/usd/pcp/testenv/testPcpLayerMuting.py @@ -185,48 +185,52 @@ def test_MutingReferencedLayers(self): rootLayer = self._LoadLayer(os.path.join(os.getcwd(), 'refs/root.sdf')) refLayer = self._LoadLayer(os.path.join(os.getcwd(), 'refs/ref.sdf')) - pcp = self._LoadPcpCache(rootLayer.identifier) - pcp2 = self._LoadPcpCache(rootLayer.identifier) - - (pi, err) = pcp.ComputePrimIndex('/Root') - self.assertTrue(not err) - self.assertEqual(pi.rootNode.children[0].arcType, Pcp.ArcTypeReference) - self.assertEqual(pi.rootNode.children[0].layerStack.layers[0], refLayer) - - (pi2, err2) = pcp2.ComputePrimIndex('/Root') - self.assertTrue(not err2) - self.assertEqual(pi2.rootNode.children[0].arcType, Pcp.ArcTypeReference) - self.assertEqual(pi2.rootNode.children[0].layerStack.layers[0], refLayer) - - # Mute the root layer of the referenced layer stack. This should - # result in change processing, a composition error when recomposing - # /Root, and no reference node on the prim index. - pcp.RequestLayerMuting([refLayer.identifier], []) - self.assertEqual(pcp.GetMutedLayers(), [refLayer.identifier]) - - (pi, err) = pcp.ComputePrimIndex('/Root') - self.assertTrue(err) - self.assertEqual(len(pi.rootNode.children), 0) - - (pi2, err2) = pcp2.ComputePrimIndex('/Root') - self.assertTrue(not err2) - self.assertEqual(pi2.rootNode.children[0].arcType, Pcp.ArcTypeReference) - self.assertEqual(pi2.rootNode.children[0].layerStack.layers[0], refLayer) - - # Unmute the layer and verify that the composition error is resolved - # and the reference is restored to the prim index. - pcp.RequestLayerMuting([], [refLayer.identifier]) - self.assertEqual(pcp.GetMutedLayers(), []) - - (pi, err) = pcp.ComputePrimIndex('/Root') - self.assertTrue(not err) - self.assertEqual(pi.rootNode.children[0].arcType, Pcp.ArcTypeReference) - self.assertEqual(pi.rootNode.children[0].layerStack.layers[0], refLayer) - - (pi2, err2) = pcp2.ComputePrimIndex('/Root') - self.assertTrue(not err2) - self.assertEqual(pi2.rootNode.children[0].arcType, Pcp.ArcTypeReference) - self.assertEqual(pi2.rootNode.children[0].layerStack.layers[0], refLayer) + def _Test(path): + pcp = self._LoadPcpCache(rootLayer.identifier) + pcp2 = self._LoadPcpCache(rootLayer.identifier) + + (pi, err) = pcp.ComputePrimIndex(path) + self.assertTrue(not err) + self.assertEqual(pi.rootNode.children[0].arcType, Pcp.ArcTypeReference) + self.assertEqual(pi.rootNode.children[0].layerStack.layers[0], refLayer) + + (pi2, err2) = pcp2.ComputePrimIndex(path) + self.assertTrue(not err2) + self.assertEqual(pi2.rootNode.children[0].arcType, Pcp.ArcTypeReference) + self.assertEqual(pi2.rootNode.children[0].layerStack.layers[0], refLayer) + + # Mute the root layer of the referenced layer stack. This should + # result in change processing, a composition error when recomposing + # /Root, and no reference node on the prim index. + pcp.RequestLayerMuting([refLayer.identifier], []) + self.assertEqual(pcp.GetMutedLayers(), [refLayer.identifier]) + + (pi, err) = pcp.ComputePrimIndex(path) + self.assertTrue(err) + self.assertEqual(len(pi.rootNode.children), 0) + + (pi2, err2) = pcp2.ComputePrimIndex(path) + self.assertTrue(not err2) + self.assertEqual(pi2.rootNode.children[0].arcType, Pcp.ArcTypeReference) + self.assertEqual(pi2.rootNode.children[0].layerStack.layers[0], refLayer) + + # Unmute the layer and verify that the composition error is resolved + # and the reference is restored to the prim index. + pcp.RequestLayerMuting([], [refLayer.identifier]) + self.assertEqual(pcp.GetMutedLayers(), []) + + (pi, err) = pcp.ComputePrimIndex(path) + self.assertTrue(not err) + self.assertEqual(pi.rootNode.children[0].arcType, Pcp.ArcTypeReference) + self.assertEqual(pi.rootNode.children[0].layerStack.layers[0], refLayer) + + (pi2, err2) = pcp2.ComputePrimIndex(path) + self.assertTrue(not err2) + self.assertEqual(pi2.rootNode.children[0].arcType, Pcp.ArcTypeReference) + self.assertEqual(pi2.rootNode.children[0].layerStack.layers[0], refLayer) + + _Test('/ReferenceToDef') + _Test('/ReferenceToOver') def test_MutingWithFileFormatTarget(self): """Tests layer muting for a Pcp.Cache with a file format target.""" diff --git a/pxr/usd/pcp/testenv/testPcpLayerMuting.testenv/refs/ref.sdf b/pxr/usd/pcp/testenv/testPcpLayerMuting.testenv/refs/ref.sdf index 8d259c99e0..fc07ac4102 100644 --- a/pxr/usd/pcp/testenv/testPcpLayerMuting.testenv/refs/ref.sdf +++ b/pxr/usd/pcp/testenv/testPcpLayerMuting.testenv/refs/ref.sdf @@ -1,5 +1,9 @@ #sdf 1.4.32 -def "Ref" +def "Def" +{ +} + +over "Over" { } diff --git a/pxr/usd/pcp/testenv/testPcpLayerMuting.testenv/refs/root.sdf b/pxr/usd/pcp/testenv/testPcpLayerMuting.testenv/refs/root.sdf index 58ee5066f6..c01ee828d7 100644 --- a/pxr/usd/pcp/testenv/testPcpLayerMuting.testenv/refs/root.sdf +++ b/pxr/usd/pcp/testenv/testPcpLayerMuting.testenv/refs/root.sdf @@ -1,7 +1,13 @@ #sdf 1.4.32 -def "Root" ( - references = @./ref.sdf@ +def "ReferenceToDef" ( + references = @./ref.sdf@ +) +{ +} + +def "ReferenceToOver" ( + references = @./ref.sdf@ ) { } From 8dda86f83f073f1f412757dbc2ac15b8a99f453f Mon Sep 17 00:00:00 2001 From: pixar-oss Date: Thu, 24 Oct 2024 13:15:15 -0700 Subject: [PATCH 26/82] Doc update: Bumping usdz ver to 1.3 with AVIF support (Internal change: 2345635) --- docs/spec_usdz.rst | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/spec_usdz.rst b/docs/spec_usdz.rst index 1d2ef2f6fc..05a73580d3 100644 --- a/docs/spec_usdz.rst +++ b/docs/spec_usdz.rst @@ -5,7 +5,7 @@ Usdz File Format Specification .. include:: rolesAndUtils.rst .. include:: -Copyright |copy| 2018, Pixar Animation Studios, *version 1.2* +Copyright |copy| 2018, Pixar Animation Studios, *version 1.3* .. contents:: :local: @@ -198,6 +198,7 @@ Clients wishing to deliver "streamable content" `may wish to consider other layo * Otherwise, the packaging API will fail to run unless the Default Layer is manually specified. +.. _spec_usdz_file_types: File Types ---------- @@ -408,3 +409,13 @@ constraints. The toolset also includes: enforce stricter "web-compliant" rules that disallow certain advanced USD features that web-browsers do not yet support. +Changes, by Version +=================== + +Version 1.3 - Current Head +-------------------------- + +From version 1.2: + + * :ref:`Adds AV1 Image (AVIF) file support `. + AVIF is now a supported file type for images/textures. \ No newline at end of file From d4318290fab5e4a44ed071bda7011dd1a554d5e6 Mon Sep 17 00:00:00 2001 From: tallytalwar Date: Thu, 24 Oct 2024 13:15:22 -0700 Subject: [PATCH 27/82] Update 24.11 Release Date (Internal change: 2345638) --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a56e9631a0..084e873cbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## [24.11] - 2024-10-23 +## [24.11] - 2024-10-25 ### Build From 238f0b7732061ffdd1d11693f7118e814753d946 Mon Sep 17 00:00:00 2001 From: sunyab Date: Fri, 25 Oct 2024 11:12:47 -0700 Subject: [PATCH 28/82] pcp: Fix test when incremental changes for layer ops are disabled When incremental changes are disabled, sublayer muting and removal result in a full resync. (Internal change: 2345744) --- pxr/usd/pcp/testenv/testPcpChanges.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pxr/usd/pcp/testenv/testPcpChanges.py b/pxr/usd/pcp/testenv/testPcpChanges.py index c036edfc91..2d9550d02c 100644 --- a/pxr/usd/pcp/testenv/testPcpChanges.py +++ b/pxr/usd/pcp/testenv/testPcpChanges.py @@ -1110,12 +1110,15 @@ def _FindPrimIndex(indexAndPath): self.assertFalse(_FindPrimIndex(overAndDefInSublayers)) self.assertFalse(_FindPrimIndex(overInRootDefInSublayer)) - # This prim index does not need to be recomputed, it just has an - # updated prim stack. - self.assertTrue(_FindPrimIndex(overInSublayerAndRoot)) - self.assertEqual( - overInSublayerAndRoot[0].primStack, - [rootLayer.GetPrimAtPath('/Parent/OverInSublayerAndRoot')]) + if INCREMENTAL_CHANGES: + # This prim index does not need to be recomputed, it just has an + # updated prim stack. + self.assertTrue(_FindPrimIndex(overInSublayerAndRoot)) + self.assertEqual( + overInSublayerAndRoot[0].primStack, + [rootLayer.GetPrimAtPath('/Parent/OverInSublayerAndRoot')]) + else: + self.assertFalse(_FindPrimIndex(overInSublayerAndRoot)) # Test cases for muting a sublayer that itself has sublayers. def _MuteSublayer(pcp): From 143629deb18b4f92618a60d53cefc335628592ab Mon Sep 17 00:00:00 2001 From: tallytalwar Date: Fri, 25 Oct 2024 14:45:43 -0700 Subject: [PATCH 29/82] Bump USD version to next anticipated release 25.02 (Internal change: 2345782) --- cmake/defaults/Version.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/defaults/Version.cmake b/cmake/defaults/Version.cmake index e9657e399e..6dd5d5f2d9 100644 --- a/cmake/defaults/Version.cmake +++ b/cmake/defaults/Version.cmake @@ -6,7 +6,7 @@ # # Versioning information set(PXR_MAJOR_VERSION "0") -set(PXR_MINOR_VERSION "24") -set(PXR_PATCH_VERSION "11") # NOTE: Must not have leading 0 for single digits +set(PXR_MINOR_VERSION "25") +set(PXR_PATCH_VERSION "2") # NOTE: Must not have leading 0 for single digits math(EXPR PXR_VERSION "${PXR_MAJOR_VERSION} * 10000 + ${PXR_MINOR_VERSION} * 100 + ${PXR_PATCH_VERSION}") From d369b980e5fcc5bc6969fa34ff85d7fe597c05f8 Mon Sep 17 00:00:00 2001 From: katpet Date: Mon, 14 Oct 2024 11:34:46 -0700 Subject: [PATCH 30/82] Fix a bug where the code that maps common USD names of AOVs like 'normal' to RenderMan style names, like 'Nn', would inadvertently happen even when the AOV already had an associated 'lpe'. Only do the mapping if the sourceType wasn't already specified to be 'lpe' or 'primvar'. (Internal change: 2343773) --- .../plugin/hdPrman/renderParam.cpp | 57 +++++++++---------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/third_party/renderman-26/plugin/hdPrman/renderParam.cpp b/third_party/renderman-26/plugin/hdPrman/renderParam.cpp index 31fd4977aa..f8f3a68ce2 100644 --- a/third_party/renderman-26/plugin/hdPrman/renderParam.cpp +++ b/third_party/renderman-26/plugin/hdPrman/renderParam.cpp @@ -3420,46 +3420,43 @@ _UpdateRmanAovAndSourceName( // If the sourceType hints that the source is an lpe or primvar, make sure // it starts with "lpe:" or "primvars:" as required by prman. - if(sourceType == "lpe") - { + if(sourceType == "lpe") { std::string sn = rmanSourceName->CStr(); if(sn.rfind("lpe:", 0) == std::string::npos) sn = "lpe:" + sn; *rmanSourceName = RtUString(sn.c_str()); - } - else if(sourceType == "primvar") - { + } else if(sourceType == "primvar") { std::string sn = rmanSourceName->CStr(); if(sn.rfind("primvars:", 0) == std::string::npos) sn = "primvars:" + sn; *rmanSourceName = RtUString(sn.c_str()); } - // Update the Aov and Source names by mapping the HdAovName to an - // equivalent Prman name - if (hdAovName == HdAovTokens->color || hdAovName.GetString() == "ci") { - *rmanAovName = RixStr.k_Ci; - *rmanSourceName = RixStr.k_Ci; - } else if (hdAovName == HdAovTokens->depth) { - *rmanSourceName = RixStr.k_z; - } else if (hdAovName == HdAovTokens->normal) { - *rmanSourceName= RixStr.k_Nn; - } else if (hdAovName == HdAovTokens->primId) { - *rmanAovName = RixStr.k_id; - *rmanSourceName = RixStr.k_id; - } else if (hdAovName == HdAovTokens->instanceId) { - *rmanAovName = RixStr.k_id2; - *rmanSourceName = RixStr.k_id2; - } else if (hdAovName == HdAovTokens->elementId) { - *rmanAovName = RixStr.k_faceindex; - *rmanSourceName = RixStr.k_faceindex; - } else if (*rmanAovName == us_primvars_st) { - *rmanSourceName = us_st; - } - - // If no sourceName is specified, assume name is a standard prman aov - if (rmanSourceName->Empty()) { - *rmanSourceName = *rmanAovName; + if(rmanSourceName->Empty()) { + // Update the Aov and Source names by mapping the HdAovName to an + // equivalent Prman name + if (hdAovName == HdAovTokens->color || hdAovName.GetString() == "ci") { + *rmanAovName = RixStr.k_Ci; + *rmanSourceName = RixStr.k_Ci; + } else if (hdAovName == HdAovTokens->depth) { + *rmanSourceName = RixStr.k_z; + } else if (hdAovName == HdAovTokens->normal) { + *rmanSourceName= RixStr.k_Nn; + } else if (hdAovName == HdAovTokens->primId) { + *rmanAovName = RixStr.k_id; + *rmanSourceName = RixStr.k_id; + } else if (hdAovName == HdAovTokens->instanceId) { + *rmanAovName = RixStr.k_id2; + *rmanSourceName = RixStr.k_id2; + } else if (hdAovName == HdAovTokens->elementId) { + *rmanAovName = RixStr.k_faceindex; + *rmanSourceName = RixStr.k_faceindex; + } else if (*rmanAovName == us_primvars_st) { + *rmanSourceName = us_st; + } else { + // If no sourceName is specified, assume name is a standard prman aov + *rmanSourceName = *rmanAovName; + } } } From ab98317e6588af5475865a4dde56c36ac922a338 Mon Sep 17 00:00:00 2001 From: clach Date: Mon, 14 Oct 2024 11:35:24 -0700 Subject: [PATCH 31/82] [hdSt, hgiVulkan] One piece of Autodesk pull request #3170, a change meant to fix failing HdSt tests when using Lavapipe. From PR description: Autodesk: Fix HdSt tests failing under HgiVulkan with Lavapipe Note: This PR is for feature-hgi-vulkan branch. The goal of this PR is to fix various issue with HgiVulkan to enable Lavapipe (software rasterizer) compatibility. This was done by fixing bugs found when running the HdSt tests. Lavapipe is a conformant Vulkan 1.3 implementation: all issues encountered are actually Vulkan API usage problems, and could very well be encountered on actual hardware device. No special code is required for supporting Lavapipe as long as HgiVulkan uses the Vulkan API correctly. Most fixes fall into two categories: - Device limits are ignored, mostly max memory size and alignment requirements - Tests are OpenGL specific and should explicitly disable Vulkan - testHgiVulkan - Problem: assumes Vulkan debugging is enabled - Fix: add HGI_ENABLE_VULKAN=1 and HGIVULKAN_DEBUG=1 to pxr_register_test ENV argument - testHdStBufferAggregation - Problem: assumes that VkPhysicalDeviceLimits::minUniformBufferOffsetAlignment is 256 - Fix: use HgiCapabilities::GetUniformBufferOffsetAlignment() - Problem: can generate more than 2GB of log files on failure - Fix: limit log to first 300 incorrect values in the huge buffer test - testHdStBufferArray - Problem: output is device dependent (uboSize depends on VkPhysicalDeviceLimits::minUniformBufferOffsetAlignment) and diff'd against a constant baseline - Fix: ignore uboSize in diff. ssboSize is also ignored for the same reason as uboSize (depends on minStorageBufferOffsetAlignment) - testHdStBarAllocationLimit - Problem: assumes that VkPhysicalDeviceLimits::maxStorageBufferRange is 2^30 (default value of setting HD_MAX_VBO_SIZE) - Fix: use the smallest of HgiCapabilities::GetMaxShaderStorageBlockSize() and HD_MAX_VBO_SIZE - testHdStBufferAggregation - Problem: assumes that VkPhysicalDeviceLimits::maxStorageBufferRange is 2^30 (default value of setting HD_MAX_VBO_SIZE) when checking the vboRelocated performance counter (expects it to be 9) - Fix: use the smallest of HgiCapabilities::GetMaxShaderStorageBlockSize() and HD_MAX_VBO_SIZE to compute the correct expected value of vboRelocated. - testHdStHWFaceCulling - Problem: output is device dependent (uboSize depends on VkPhysicalDeviceLimits::minUniformBufferOffsetAlignment) and diff'd against a constant baseline - Fix: ignore uboSize in diff. ssboSize is also ignored for the same reason as uboSize (depends on minStorageBufferOffsetAlignment) - testHdStPrimvars - Problem: output is device dependent (uboSize depends on VkPhysicalDeviceLimits::minUniformBufferOffsetAlignment) and diff'd against a constant baseline - Fix: ignore uboSize in diff. ssboSize is also ignored for the same reason as uboSize (depends on minStorageBufferOffsetAlignment) - N/A See github pull request #3170. Fixes #3170 (Internal change: 2343821) --- pxr/imaging/hdSt/CMakeLists.txt | 10 ++-- .../testenv/testHdStBarAllocationLimit.cpp | 12 +++-- .../testenv/testHdStBufferAggregation.cpp | 50 ++++++++++++++----- .../hdSt/testenv/testHdStDrawItemsCache.cpp | 4 +- pxr/imaging/hdSt/unitTestHelper.h | 5 ++ pxr/imaging/hdSt/vboMemoryManager.cpp | 6 ++- pxr/imaging/hdSt/vboSimpleMemoryManager.cpp | 6 ++- pxr/imaging/hgiVulkan/CMakeLists.txt | 3 ++ pxr/imaging/hgiVulkan/graphicsPipeline.cpp | 2 +- 9 files changed, 72 insertions(+), 26 deletions(-) diff --git a/pxr/imaging/hdSt/CMakeLists.txt b/pxr/imaging/hdSt/CMakeLists.txt index 320036d5da..0e62a6a9f1 100644 --- a/pxr/imaging/hdSt/CMakeLists.txt +++ b/pxr/imaging/hdSt/CMakeLists.txt @@ -2324,8 +2324,7 @@ pxr_register_test(testHdStBufferArray COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStBufferArray" EXPECTED_RETURN_CODE 0 STDOUT_REDIRECT testHdStBufferArray-Run1-stdout.txt - POST_COMMAND "diff -I drawingShader -I computeShader -I gpuMemoryUsed -I meshTopology -I basisCurvesTopology testHdStBufferArray-Run1-stdout.txt ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStBufferArray/baseline/testHdStBufferArray-Run1-stdout.txt" - TESTENV testHdStBufferArray + POST_COMMAND "diff -I drawingShader -I computeShader -I gpuMemoryUsed -I meshTopology -I basisCurvesTopology -I uboSize -I ssboSize testHdStBufferArray-Run1-stdout.txt ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStBufferArray/baseline/testHdStBufferArray-Run1-stdout.txt" TESTENV testHdStBufferArray ENV TF_DEBUG=HD_SAFE_MODE HD_ENABLE_DOUBLE_MATRIX=1 @@ -2335,7 +2334,7 @@ pxr_register_test(testHdStBufferArrayInstancingDisabled COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStBufferArray" EXPECTED_RETURN_CODE 0 STDOUT_REDIRECT testHdStBufferArrayInstancingDisabled-Run1-stdout.txt - POST_COMMAND "diff -I drawingShader -I computeShader -I gpuMemoryUsed -I meshTopology -I basisCurvesTopology testHdStBufferArrayInstancingDisabled-Run1-stdout.txt ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStBufferArrayInstancingDisabled/baseline/testHdStBufferArrayInstancingDisabled-Run1-stdout.txt" + POST_COMMAND "diff -I drawingShader -I computeShader -I gpuMemoryUsed -I meshTopology -I basisCurvesTopology -I uboSize -I ssboSize testHdStBufferArrayInstancingDisabled-Run1-stdout.txt ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStBufferArrayInstancingDisabled/baseline/testHdStBufferArrayInstancingDisabled-Run1-stdout.txt" TESTENV testHdStBufferArrayInstancingDisabled ENV HDST_ENABLE_RESOURCE_INSTANCING=0 @@ -2740,6 +2739,7 @@ pxr_register_test(testHdStDrawBatching HD_ENABLE_DOUBLE_MATRIX=1 HD_ENABLE_GPU_COUNT_VISIBLE_INSTANCES=1 HD_ENABLE_PACKED_NORMALS=0 + HGI_ENABLE_VULKAN=0 ) pxr_register_test(testHdStDrawItemIntegrity COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStDrawItemIntegrity --offscreen" @@ -2895,7 +2895,7 @@ pxr_register_test(testHdStHWFaceCulling COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStHWFaceCulling" EXPECTED_RETURN_CODE 0 STDOUT_REDIRECT testHdStHWFaceCulling-Run1-stdout.txt - POST_COMMAND "diff -I computeShader -I drawingShader -I gpuMemoryUsed testHdStHWFaceCulling-Run1-stdout.txt ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStHWFaceCulling/baseline/testHdStHWFaceCulling-Run1-stdout.txt" + POST_COMMAND "diff -I computeShader -I drawingShader -I gpuMemoryUsed -I uboSize -I ssboSize testHdStHWFaceCulling-Run1-stdout.txt ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStHWFaceCulling/baseline/testHdStHWFaceCulling-Run1-stdout.txt" TESTENV testHdStHWFaceCulling ) pxr_register_test(testHdStIndirectDrawBatchCodeGen @@ -3155,7 +3155,7 @@ pxr_register_test(testHdStPrimvars COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStPrimvars" EXPECTED_RETURN_CODE 0 STDOUT_REDIRECT testHdStPrimvars-Run1-stdout.txt - POST_COMMAND "diff -I computeShader -I drawingShader -I gpuMemoryUsed testHdStPrimvars-Run1-stdout.txt ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStPrimvars/baseline/testHdStPrimvars-Run1-stdout.txt" + POST_COMMAND "diff -I computeShader -I drawingShader -I gpuMemoryUsed -I uboSize -I ssboSize testHdStPrimvars-Run1-stdout.txt ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStPrimvars/baseline/testHdStPrimvars-Run1-stdout.txt" TESTENV testHdStPrimvars ENV HDST_ENABLE_MATERIAL_PRIMVAR_FILTERING=0 diff --git a/pxr/imaging/hdSt/testenv/testHdStBarAllocationLimit.cpp b/pxr/imaging/hdSt/testenv/testHdStBarAllocationLimit.cpp index ec181a4e0e..62fd5f07c4 100644 --- a/pxr/imaging/hdSt/testenv/testHdStBarAllocationLimit.cpp +++ b/pxr/imaging/hdSt/testenv/testHdStBarAllocationLimit.cpp @@ -9,6 +9,8 @@ #include "pxr/imaging/hdSt/unitTestGLDrawing.h" #include "pxr/imaging/hdSt/unitTestHelper.h" +#include "pxr/imaging/hgi/capabilities.h" + #include "pxr/base/gf/matrix4d.h" #include "pxr/base/gf/rotation.h" #include "pxr/base/gf/vec3d.h" @@ -119,11 +121,13 @@ My_TestGLDrawing::AddLargeCurve(HdUnitTestDelegate *delegate) HdInterpolation colorInterp, widthInterp, opacityInterp; colorInterp = widthInterp = opacityInterp = HdInterpolationConstant; - const size_t vboSizeLimit = 1 << 30; // see HD_MAX_VBO_SIZE - const size_t maxPointsInVBO = vboSizeLimit / sizeof(GfVec3f); - const size_t numControlVertsPerCurve = 1 << 2; + static constexpr size_t vboMaxSize = 1 << 30; // default for HD_MAX_VBO_SIZE + const size_t storageMaxSize = _driver->GetHgi()->GetCapabilities()-> + GetMaxShaderStorageBlockSize(); + const size_t maxPointsInVBO = std::min(storageMaxSize, vboMaxSize) / sizeof(GfVec3f); + static constexpr size_t numControlVertsPerCurve = 1 << 2; const size_t numCurves = maxPointsInVBO / numControlVertsPerCurve + 1; - + std::vector curveVertexCounts(numCurves, numControlVertsPerCurve); GfVec3f basePoints[] = { diff --git a/pxr/imaging/hdSt/testenv/testHdStBufferAggregation.cpp b/pxr/imaging/hdSt/testenv/testHdStBufferAggregation.cpp index a54842a164..ce52d47289 100644 --- a/pxr/imaging/hdSt/testenv/testHdStBufferAggregation.cpp +++ b/pxr/imaging/hdSt/testenv/testHdStBufferAggregation.cpp @@ -832,9 +832,10 @@ OverAggregationTest(HdStResourceRegistry *registry) // * 50 // 8 entries = 915MB // split into 7 buffers. - int count = 50; + static constexpr size_t count = 50; + static constexpr size_t countPerCommit = count / 2; std::vector ranges; - for (int i = 0; i < count/2; ++i) { + for (size_t i = 0; i < countPerCommit; ++i) { HdBufferSourceSharedPtrVector sources; sources.push_back( std::make_shared( @@ -854,9 +855,9 @@ OverAggregationTest(HdStResourceRegistry *registry) registry->Commit(); - // Schedule some more resources which will aggregate with the + // Schedule some more resources which will aggregate with the // previously committed resources. - for (int i = count/2; i < count; ++i) { + for (size_t i = countPerCommit; i < count; ++i) { HdBufferSourceSharedPtrVector sources; sources.push_back( std::make_shared( @@ -877,26 +878,36 @@ OverAggregationTest(HdStResourceRegistry *registry) registry->Commit(); // read - for (int i = 0; i < count; ++i) { + for (size_t i = 0; i < count; ++i) { VtValue const& rangeData = ranges[i]->ReadData(HdTokens->points); if (points != rangeData) { // XXX The below code is added for debugging why this test // sometimes fails. We suspect a floating-point compare issue where // we may need to have a small epsilon for comparing floats? TF_VERIFY(rangeData.IsHolding>()); - VtArray const& vec3fArray = + VtArray const& vec3fArray = rangeData.UncheckedGet>(); std::cerr << "point size: " << points.size() << std::endl; std::cerr << "rangeData size: " << vec3fArray.size() << std::endl; - for (size_t x=0; x maxFailureCountPrint) { + std::cerr << "And " << (failureCount - maxFailureCountPrint) << + " more failures omitted (" << (static_cast(failureCount) / + points.size() * 100) << "% failed)" << std::endl; + } + TF_VERIFY(false); } } @@ -905,8 +916,24 @@ OverAggregationTest(HdStResourceRegistry *registry) std::cerr << perfLog.GetCounter(HdStPerfTokens->copyBufferCpuToGpu) << "\n"; std::cerr << perfLog.GetCounter(HdStPerfTokens->copyBufferGpuToGpu) << "\n"; + // Relocation count depends on the VBO max size. Smaller size means more relocations. + // If it's the default 2^30, there will be 9 relocations. But smaller can have much more: + // For example Lavapipe limits the size to 2^27 and has 51 relocations. + static constexpr size_t vboMaxSize = 1 << 30; // default for HD_MAX_VBO_SIZE + const size_t storageMaxSize = + registry->GetHgi()->GetCapabilities()->GetMaxShaderStorageBlockSize(); + const size_t rangesPerBuffer = std::min(storageMaxSize, vboMaxSize) / + (points.size() * sizeof(GfVec3f)); + const size_t relocationsFirstCommit = + (countPerCommit - 1) / rangesPerBuffer + 1; + const size_t relocationsSecondCommit = + (countPerCommit - 1 + rangesPerBuffer) / rangesPerBuffer + 1; + const size_t totalRelocations = + relocationsFirstCommit + relocationsSecondCommit; + // check perf counters - TF_VERIFY(perfLog.GetCounter(HdPerfTokens->vboRelocated) == 9); + TF_VERIFY(perfLog.GetCounter( + HdPerfTokens->vboRelocated) == totalRelocations); TF_VERIFY(perfLog.GetCounter(HdStPerfTokens->copyBufferCpuToGpu) == 50); TF_VERIFY(perfLog.GetCounter(HdStPerfTokens->copyBufferGpuToGpu) == 1); @@ -1063,5 +1090,4 @@ int main(int argc, char *argv[]) std::cout << "FAILED" << std::endl; return EXIT_FAILURE; } -} - +} \ No newline at end of file diff --git a/pxr/imaging/hdSt/testenv/testHdStDrawItemsCache.cpp b/pxr/imaging/hdSt/testenv/testHdStDrawItemsCache.cpp index ac647f271f..add2da504d 100644 --- a/pxr/imaging/hdSt/testenv/testHdStDrawItemsCache.cpp +++ b/pxr/imaging/hdSt/testenv/testHdStDrawItemsCache.cpp @@ -136,7 +136,7 @@ class HdSt_MyTestDriver : public HdSt_TestDriverBase public: HdSt_MyTestDriver(); - void Draw(std::vector viewerIds); + void Draw(const std::vector &viewerIds); const HdStRenderPassStateSharedPtr &GetRenderPassState() const { return _renderPassStates[0]; @@ -211,7 +211,7 @@ HdSt_MyTestDriver::HdSt_MyTestDriver() } void -HdSt_MyTestDriver::Draw(std::vector viewerIds) +HdSt_MyTestDriver::Draw(const std::vector &viewerIds) { for (size_t const &vidx : viewerIds) { if (vidx < _viewers.size()) { diff --git a/pxr/imaging/hdSt/unitTestHelper.h b/pxr/imaging/hdSt/unitTestHelper.h index 1ce3405017..6cdc6567aa 100644 --- a/pxr/imaging/hdSt/unitTestHelper.h +++ b/pxr/imaging/hdSt/unitTestHelper.h @@ -550,6 +550,11 @@ class HdSt_TestDriver final : public HdSt_TestDriverBase HDST_API const HdRenderPassSharedPtr &GetRenderPass(); + + HDST_API + Hgi* GetHgi() { + return _GetHgi(); + } private: void _CreateRenderPassState(); diff --git a/pxr/imaging/hdSt/vboMemoryManager.cpp b/pxr/imaging/hdSt/vboMemoryManager.cpp index 41a2f0fa62..145bedaf94 100644 --- a/pxr/imaging/hdSt/vboMemoryManager.cpp +++ b/pxr/imaging/hdSt/vboMemoryManager.cpp @@ -20,6 +20,7 @@ #include "pxr/imaging/hgi/blitCmds.h" #include "pxr/imaging/hgi/blitCmdsOps.h" #include "pxr/imaging/hgi/buffer.h" +#include "pxr/imaging/hgi/capabilities.h" #include "pxr/base/arch/hash.h" #include "pxr/base/tf/diagnostic.h" @@ -440,7 +441,10 @@ size_t HdStVBOMemoryManager::_StripedBufferArray::GetMaxNumElements() const { static size_t vboMaxSize = TfGetEnvSetting(HD_MAX_VBO_SIZE); - return vboMaxSize / _maxBytesPerElement; + Hgi* hgi = _resourceRegistry->GetHgi(); + const size_t storageMaxSize = hgi->GetCapabilities()-> + GetMaxShaderStorageBlockSize(); + return std::min(storageMaxSize, vboMaxSize) / _maxBytesPerElement; } void diff --git a/pxr/imaging/hdSt/vboSimpleMemoryManager.cpp b/pxr/imaging/hdSt/vboSimpleMemoryManager.cpp index 40a2f1fe8a..678ae12b0e 100644 --- a/pxr/imaging/hdSt/vboSimpleMemoryManager.cpp +++ b/pxr/imaging/hdSt/vboSimpleMemoryManager.cpp @@ -22,6 +22,7 @@ #include "pxr/imaging/hgi/blitCmds.h" #include "pxr/imaging/hgi/blitCmdsOps.h" #include "pxr/imaging/hgi/buffer.h" +#include "pxr/imaging/hgi/capabilities.h" #include "pxr/imaging/hf/perfLog.h" @@ -342,7 +343,10 @@ size_t HdStVBOSimpleMemoryManager::_SimpleBufferArray::GetMaxNumElements() const { static size_t vboMaxSize = TfGetEnvSetting(HD_MAX_VBO_SIZE); - return vboMaxSize / _maxBytesPerElement; + Hgi* hgi = _resourceRegistry->GetHgi(); + const size_t storageMaxSize = hgi->GetCapabilities()-> + GetMaxShaderStorageBlockSize(); + return std::min(storageMaxSize, vboMaxSize) / _maxBytesPerElement; } void diff --git a/pxr/imaging/hgiVulkan/CMakeLists.txt b/pxr/imaging/hgiVulkan/CMakeLists.txt index 97e4228944..00ad754480 100644 --- a/pxr/imaging/hgiVulkan/CMakeLists.txt +++ b/pxr/imaging/hgiVulkan/CMakeLists.txt @@ -92,6 +92,9 @@ pxr_register_test(testHgiVulkan FAIL_PERCENT 0.001 PERCEPTUAL EXPECTED_RETURN_CODE 0 + ENV + HGI_ENABLE_VULKAN=1 + HGIVULKAN_DEBUG=1 ) # This test is not currently supported on static builds as it relies on diff --git a/pxr/imaging/hgiVulkan/graphicsPipeline.cpp b/pxr/imaging/hgiVulkan/graphicsPipeline.cpp index 053d8d4e7d..dcce492acc 100755 --- a/pxr/imaging/hgiVulkan/graphicsPipeline.cpp +++ b/pxr/imaging/hgiVulkan/graphicsPipeline.cpp @@ -702,7 +702,7 @@ HgiVulkanGraphicsPipeline::_CreateRenderPass() if (hasDepth && _descriptor.resolveAttachments) { depthResolve.pDepthStencilResolveAttachment = &vkDepthResolveReference; depthResolve.depthResolveMode = VK_RESOLVE_MODE_SAMPLE_ZERO_BIT; - depthResolve.stencilResolveMode = VK_RESOLVE_MODE_NONE; + depthResolve.stencilResolveMode = VK_RESOLVE_MODE_SAMPLE_ZERO_BIT; subpassDesc.pNext = &depthResolve; } From d9323e54dfef30e8f5f0eab4ee9aa9946d79bc3f Mon Sep 17 00:00:00 2001 From: samwarring Date: Mon, 14 Oct 2024 11:35:56 -0700 Subject: [PATCH 32/82] Add more test cases for UsdNotice::ObjectsChanged To design scene change handling for OpenExec, we want to know how USD communicates different types of scene changes. Specifically, we want more clarity as to which scene changes are Resyncs and which are only field changes. These test cases document the existing behavior, and they capture assumptions about scene change processing used in OpenExec. (Internal change: 2343945) --- pxr/usd/usd/CMakeLists.txt | 7 + .../testenv/testUsdObjectsChangedNotices.py | 496 ++++++++++++++++++ 2 files changed, 503 insertions(+) create mode 100644 pxr/usd/usd/testenv/testUsdObjectsChangedNotices.py diff --git a/pxr/usd/usd/CMakeLists.txt b/pxr/usd/usd/CMakeLists.txt index 2915831ddc..87c8a01bba 100644 --- a/pxr/usd/usd/CMakeLists.txt +++ b/pxr/usd/usd/CMakeLists.txt @@ -236,6 +236,7 @@ pxr_test_scripts( testenv/testUsdNamespaceEditor.py testenv/testUsdNamespaceEditorProperties.py testenv/testUsdNotices.py + testenv/testUsdObjectsChangedNotices.py testenv/testUsdOpaqueAttributes.py testenv/testUsdPathExpressionAttrs.py testenv/testUsdPayloads.py @@ -1261,6 +1262,12 @@ pxr_register_test(testUsdNotices EXPECTED_RETURN_CODE 0 ) +pxr_register_test(testUsdObjectsChangedNotices + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdObjectsChangedNotices" + EXPECTED_RETURN_CODE 0 +) + pxr_register_test(testUsdNamespaceEditor PYTHON COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdNamespaceEditor" diff --git a/pxr/usd/usd/testenv/testUsdObjectsChangedNotices.py b/pxr/usd/usd/testenv/testUsdObjectsChangedNotices.py new file mode 100644 index 0000000000..7a91d65bc5 --- /dev/null +++ b/pxr/usd/usd/testenv/testUsdObjectsChangedNotices.py @@ -0,0 +1,496 @@ +#!/pxrpythonsubst +# +# Copyright 2024 Pixar +# +# Licensed under the terms set forth in the LICENSE.txt file available at +# https://openusd.org/license. + +import unittest +from pxr import Kind, Sdf, Tf, Usd + +_LAYER_CONTENTS = '''#usda 1.0 +def Sphere "Ref1" ( + prepend apiSchemas = ["CollectionAPI:Ref1Collection"] +){ + def Scope "Ref1Child" { + } +} + +def Scope "Ref2" { +} + +def Scope "Parent1" { + + int attr1 = 1 + int attr2 = 2 + int attr2.connect = + int attr3 = 3 + + rel rel1 = + + def Sphere "Child1" { + } + + def Sphere "Child2" { + } +} +def "Parent2" ( + references = +){ +} +''' + +class TestUsdObjectsChangedNotices(unittest.TestCase): + def setUp(self): + self._layer = Sdf.Layer.CreateAnonymous('layer.usda') + self._layer.ImportFromString(_LAYER_CONTENTS) + self._stage = Usd.Stage.Open(self._layer) + self.assertTrue(self._stage) + self._editor = Usd.NamespaceEditor(self._stage) + + self._parent1 = self._stage.GetPrimAtPath('/Parent1') + self._parent2 = self._stage.GetPrimAtPath('/Parent2') + self._child1 = self._stage.GetPrimAtPath('/Parent1/Child1') + self._child2 = self._stage.GetPrimAtPath('/Parent1/Child2') + self._attr1 = self._parent1.GetAttribute('attr1') + self._attr2 = self._parent1.GetAttribute('attr2') + self._attr3 = self._parent1.GetAttribute('attr3') + self._rel1 = self._parent1.GetRelationship('rel1') + + self.assertTrue(self._parent1) + self.assertTrue(self._parent2) + self.assertTrue(self._child1) + self.assertTrue(self._child2) + self.assertTrue(self._attr1) + self.assertTrue(self._attr2) + self.assertTrue(self._attr3) + self.assertTrue(self._rel1) + + # Each ObjectsChanged notice is converted to a dictionary and appended + # to self._notices. The list of notices is reset before each test. + self._notices = [] + self._noticeKey = Tf.Notice.Register( + Usd.Notice.ObjectsChanged, + self._onObjectsChanged, + self._stage) + + def _onObjectsChanged(self, notice, sender): + asDict = {} + resynced = notice.GetResyncedPaths() + changedInfoOnly = notice.GetChangedInfoOnlyPaths() + resolvedAssetPathsResynced = notice.GetResolvedAssetPathsResyncedPaths() + if resynced: + asDict['Resynced'] = { + str(path): notice.GetChangedFields(path) + for path in resynced + } + if changedInfoOnly: + asDict['ChangedInfoOnly'] = { + str(path): notice.GetChangedFields(path) + for path in changedInfoOnly + } + if resolvedAssetPathsResynced: + asDict['ResolvedAssetPathsResynced'] = { + str(path): notice.GetChangedFields(path) + for path in resolvedAssetPathsResynced + } + self._notices.append(asDict) + + def test_ObjectSetMetadata(self): + self._parent1.SetMetadata('comment', 'test') + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'ChangedInfoOnly': { + '/Parent1': ['comment'] + } + }) + + def test_ObjectSetMetadataByDictKey(self): + self._parent1.SetMetadataByDictKey('customData', 'a:b', 42) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'ChangedInfoOnly': { + '/Parent1': ['customData'] + } + }) + + def test_StageDefinePrim(self): + self._stage.DefinePrim('/Parent3', 'Sphere') + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent3': [ + 'specifier', + 'typeName', + ] + } + }) + + def test_PrimSetSpecifier(self): + self._parent1.SetSpecifier(Sdf.SpecifierClass) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent1': ['specifier'] + } + }) + + def test_PrimSetTypeName(self): + self._parent1.SetTypeName('Cylinder') + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent1': ['typeName'] + } + }) + + def test_PrimClearTypeName(self): + self._parent1.ClearTypeName() + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent1': ['typeName'] + } + }) + + def test_PrimSetActive(self): + self._parent1.SetActive(False) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent1': ['active'] + } + }) + + def test_PrimSetPropertyOrder(self): + self._parent1.SetPropertyOrder(['attr2', 'attr1', 'attr3']) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'ChangedInfoOnly': { + # XXX:USD-10220: Shouldn't this be ['propertyOrder']? + '/Parent1': [] + } + }) + + def test_PrimRemoveProperty(self): + self._parent1.RemoveProperty('attr2') + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + # Note: attr2 had connections, but the connectionPaths field + # is omitted. + '/Parent1.attr2': [] + } + }) + + def test_PrimSetKind(self): + self._parent1.SetKind(Kind.Tokens.model) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent1': ['kind'] + } + }) + + def test_PrimAddAppliedSchema(self): + self._parent1.AddAppliedSchema('CollectionAPI:myCollection') + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent1': ['apiSchemas'] + } + }) + + def test_PrimSetChildrenReorder(self): + self._parent1.SetChildrenReorder(['Child2', 'Child1']) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent1': ['primOrder'] + } + }) + + def test_PrimChangeReferences(self): + # In this case, the referenced prim has apiSchemas that are added to + # the referencing prim. Even though the 'apiSchemas' field will change, + # only the 'references' field is reported to have changed. + self._parent1.GetReferences().AddReference( + self._layer.identifier, '/Ref1') + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent1': ['references'] + } + }) + self.assertTrue(self._stage.GetPrimAtPath('/Parent1/Ref1Child')) + self.assertTrue(self._stage.GetRelationshipAtPath( + '/Parent1.collection:Ref1Collection:includes')) + + def test_PrimChangeReferencesChangesTypeName(self): + self.assertEqual(self._parent2.GetTypeName(), 'Scope') + self._parent2.GetReferences().SetReferences([ + Sdf.Reference(self._layer.identifier, '/Ref1') + ]) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent2': ['references'] + } + }) + self.assertEqual(self._parent2.GetTypeName(), 'Sphere') + + def test_PropertySetDisplayGroup(self): + self._attr1.SetDisplayGroup('test') + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'ChangedInfoOnly': { + '/Parent1.attr1': ['displayGroup'] + } + }) + + def test_PropertySetNestedDisplayGroups(self): + self._attr1.SetNestedDisplayGroups(['test', 'test2']) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'ChangedInfoOnly': { + '/Parent1.attr1': ['displayGroup'] + } + }) + + def test_PropertySetCustom(self): + self._attr1.SetCustom(True) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'ChangedInfoOnly': { + '/Parent1.attr1': ['custom'] + } + }) + + def test_AttributeSetVariability(self): + self._attr1.SetVariability(Sdf.VariabilityUniform) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'ChangedInfoOnly': { + '/Parent1.attr1': ['variability'] + } + }) + + def test_AttributeSetTypename(self): + self._attr1.SetTypeName(Sdf.ValueTypeNames.Double) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'ChangedInfoOnly': { + '/Parent1.attr1': ['typeName'] + } + }) + + def test_AttributeSet(self): + self._attr1.Set(42) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'ChangedInfoOnly': { + '/Parent1.attr1': ['default'] + } + }) + + def test_AttributeAddConnection(self): + self._attr1.AddConnection(self._attr2.GetPath()) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'ChangedInfoOnly': { + '/Parent1.attr1': ['connectionPaths'] + } + }) + + def test_AttributeClearConnections(self): + self._attr2.ClearConnections() + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'ChangedInfoOnly': { + '/Parent1.attr2': ['connectionPaths'] + } + }) + + def test_RelationshipAddTarget(self): + self._rel1.AddTarget(self._parent2.GetPath()) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'ChangedInfoOnly': { + '/Parent1.rel1': ['targetPaths'] + } + }) + + def test_RelationshipRemoveTarget(self): + self._rel1.RemoveTarget(self._child1.GetPath()) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'ChangedInfoOnly': { + '/Parent1.rel1': ['targetPaths'] + } + }) + + # Removing target that does not exist should not trigger a notice. + self._rel1.RemoveTarget(self._child1.GetPath()) + self.assertEqual(len(self._notices), 1) + + def test_RelationshipSetTargets(self): + self._rel1.SetTargets([self._child1.GetPath(), self._child2.GetPath()]) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'ChangedInfoOnly': { + '/Parent1.rel1': ['targetPaths'] + } + }) + + def test_RelationshipClearTargets(self): + self._rel1.ClearTargets(removeSpec = False) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'ChangedInfoOnly': { + '/Parent1.rel1': ['targetPaths'] + } + }) + + self._rel1.ClearTargets(removeSpec = True) + self.assertEqual(len(self._notices), 2) + self.assertDictEqual(self._notices[1], { + 'Resynced': { + '/Parent1.rel1': [] + } + }) + + def test_NamespaceEditorDeletePrimAtPath(self): + self._editor.DeletePrimAtPath('/Parent1') + self._editor.ApplyEdits() + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent1': [] + } + }) + + def test_NamespaceEditorMovePrimAtPath(self): + self._editor.MovePrimAtPath('/Parent2', '/Parent1/Parent3') + self._editor.ApplyEdits() + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent2': [], + '/Parent1/Parent3': [] + } + }) + + def test_NamespaceEditorRenamePrim(self): + self._editor.RenamePrim(self._child1, 'Child3') + self._editor.ApplyEdits() + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent1/Child1': [], + '/Parent1/Child3': [] + }, + 'ChangedInfoOnly': { + '/Parent1.rel1': ['targetPaths'] + } + }) + + def test_NamespaceEditorReparentPrim(self): + self._editor.ReparentPrim(self._child1, self._parent2) + self._editor.ApplyEdits() + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent1/Child1': [], + '/Parent2/Child1': [] + }, + 'ChangedInfoOnly': { + '/Parent1.rel1': ['targetPaths'] + } + }) + + def test_NamespaceEditorDeleteProperty(self): + self._editor.DeleteProperty(self._attr3) + self._editor.ApplyEdits() + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent1.attr3': [] + }, + 'ChangedInfoOnly': { + '/Parent1.attr2': ['connectionPaths'] + } + }) + + def test_NamespaceEditorMovePropertyAtPath(self): + self._editor.MovePropertyAtPath( + self._attr3.GetPath(), + '/Parent2.newName') + self._editor.ApplyEdits() + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent1.attr3': [], + '/Parent2.newName': [] + }, + 'ChangedInfoOnly': { + '/Parent1.attr2': ['connectionPaths'] + } + }) + + def test_NamespaceEditorReparentProperty(self): + self._editor.ReparentProperty(self._attr3, self._parent2) + self._editor.ApplyEdits() + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent1.attr3': [], + '/Parent2.attr3': [] + }, + 'ChangedInfoOnly': { + '/Parent1.attr2': ['connectionPaths'] + } + }) + + def test_SdfChangeBlockChangeTypeThenDelete(self): + with Sdf.ChangeBlock(): + parentSpec = self._layer.GetPrimAtPath('/Parent1') + parentSpec.typeName = 'Cylinder' + del(self._layer.rootPrims['Parent1']) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent1': ['typeName'] + } + }) + self.assertFalse(self._stage.GetPrimAtPath('/Parent1')) + + def test_SdfChangeBlockAppendAPISchemaThenDelete(self): + with Sdf.ChangeBlock(): + parentSpec = self._layer.GetPrimAtPath('/Parent1') + schemas = Sdf.TokenListOp.Create(['CollectionAPI:myCollection']) + parentSpec.SetInfo('apiSchemas', schemas) + del(self._layer.rootPrims['Parent1']) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent1': ['apiSchemas'] + } + }) + self.assertFalse(self._stage.GetPrimAtPath('/Parent1')) + + def test_SdfChangeBlockReorderChildrenThenDelete(self): + with Sdf.ChangeBlock(): + parentSpec = self._layer.GetPrimAtPath('/Parent1') + parentSpec.nameChildrenOrder = ['Child2', 'Child1'] + del(self._layer.rootPrims['Parent1']) + self.assertEqual(len(self._notices), 1) + self.assertDictEqual(self._notices[0], { + 'Resynced': { + '/Parent1': ['primOrder'] + } + }) + self.assertFalse(self._stage.GetPrimAtPath('/Parent1')) + + +if __name__ == "__main__": + unittest.main() \ No newline at end of file From 689110d7d925364b4c88b80326795e57be349316 Mon Sep 17 00:00:00 2001 From: diyajoy Date: Mon, 14 Oct 2024 11:53:10 -0700 Subject: [PATCH 33/82] Ensure usdGenSchema does not write out an alias if the alias would be the same as the class name. (Internal change: 2344166) --- pxr/usd/usd/codegenTemplates/schemaClass.cpp | 4 + .../basic/generatedSchema.classes.txt | 2 + .../baseline/basic/generatedSchema.module.h | 1 + .../baseline/basic/generatedSchema.usda | 4 + .../baseline/basic/noAlias.cpp | 107 +++++++++++++ .../testUsdGenSchema/baseline/basic/noAlias.h | 147 ++++++++++++++++++ .../baseline/basic/plugInfo.json | 8 + .../baseline/basic/tokens.cpp | 4 +- .../testUsdGenSchema/baseline/basic/tokens.h | 4 + .../baseline/basic/wrapNoAlias.cpp | 107 +++++++++++++ .../baseline/basic/wrapTokens.cpp | 1 + .../baseline/codeless/plugInfo.json | 8 + .../testUsdGenSchema/codeless_schema.usda | 9 ++ .../usd/testenv/testUsdGenSchema/schema.usda | 9 ++ pxr/usd/usd/usdGenSchema.py | 6 +- pxr/usd/usdMtlx/reader.cpp | 6 +- 16 files changed, 422 insertions(+), 5 deletions(-) create mode 100644 pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/noAlias.cpp create mode 100644 pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/noAlias.h create mode 100644 pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/wrapNoAlias.cpp diff --git a/pxr/usd/usd/codegenTemplates/schemaClass.cpp b/pxr/usd/usd/codegenTemplates/schemaClass.cpp index 885c8a05ec..19b072ec39 100644 --- a/pxr/usd/usd/codegenTemplates/schemaClass.cpp +++ b/pxr/usd/usd/codegenTemplates/schemaClass.cpp @@ -22,12 +22,16 @@ TF_REGISTRY_FUNCTION(TfType) TfType::Bases< {{ cls.parentCppClassName }} > >(); {% if cls.isConcrete %} +{% if cls.cppClassName != cls.usdPrimTypeName %} // Register the usd prim typename as an alias under UsdSchemaBase. This // enables one to call // TfType::Find().FindDerivedByName("{{ cls.usdPrimTypeName }}") // to find TfType<{{ cls.cppClassName }}>, which is how IsA queries are // answered. TfType::AddAlias("{{ cls.usdPrimTypeName }}"); +{% else %} + // Skip registering an alias as it would be the same as the class name. +{% endif %} {% endif %} } diff --git a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/generatedSchema.classes.txt b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/generatedSchema.classes.txt index b83a90a9d5..de709a2b70 100644 --- a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/generatedSchema.classes.txt +++ b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/generatedSchema.classes.txt @@ -7,6 +7,7 @@ derivedNonAppliedAPI emptyMultipleApplyAPI multipleApplyAPI multipleApplyAPI_1 +noAlias nonAppliedAPI publicMultipleApplyAPI singleApplyAPI @@ -24,6 +25,7 @@ wrapDerivedNonAppliedAPI.cpp wrapEmptyMultipleApplyAPI.cpp wrapMultipleApplyAPI.cpp wrapMultipleApplyAPI_1.cpp +wrapNoAlias.cpp wrapNonAppliedAPI.cpp wrapPublicMultipleApplyAPI.cpp wrapSingleApplyAPI.cpp diff --git a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/generatedSchema.module.h b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/generatedSchema.module.h index 0a7079f947..585f6647d7 100644 --- a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/generatedSchema.module.h +++ b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/generatedSchema.module.h @@ -19,4 +19,5 @@ TF_WRAP(UsdContrivedTestHairman_1); TF_WRAP(UsdContrivedTestNoVersion0_2); TF_WRAP(UsdContrivedSingleApplyAPI_1); TF_WRAP(UsdContrivedMultipleApplyAPI_1); +TF_WRAP(UsdContrivedNoAlias); TF_WRAP(UsdContrivedTokens); diff --git a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/generatedSchema.usda b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/generatedSchema.usda index 6e34a74280..dd9c0ee1aa 100644 --- a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/generatedSchema.usda +++ b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/generatedSchema.usda @@ -415,3 +415,7 @@ class "MultipleApplyAPI_1" double testNewVersion:__INSTANCE_NAME__:testAttrTwo } +class UsdContrivedNoAlias "UsdContrivedNoAlias" +{ +} + diff --git a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/noAlias.cpp b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/noAlias.cpp new file mode 100644 index 0000000000..fad4ee7466 --- /dev/null +++ b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/noAlias.cpp @@ -0,0 +1,107 @@ +// +// Copyright 2016 Pixar +// +// Licensed under the terms set forth in the LICENSE.txt file available at +// https://openusd.org/license. +// +#include "pxr/usd/usdContrived/noAlias.h" +#include "pxr/usd/usd/schemaRegistry.h" +#include "pxr/usd/usd/typed.h" + +#include "pxr/usd/sdf/types.h" +#include "pxr/usd/sdf/assetPath.h" + +PXR_NAMESPACE_OPEN_SCOPE + +// Register the schema with the TfType system. +TF_REGISTRY_FUNCTION(TfType) +{ + TfType::Define >(); + + // Skip registering an alias as it would be the same as the class name. +} + +/* virtual */ +UsdContrivedNoAlias::~UsdContrivedNoAlias() +{ +} + +/* static */ +UsdContrivedNoAlias +UsdContrivedNoAlias::Get(const UsdStagePtr &stage, const SdfPath &path) +{ + if (!stage) { + TF_CODING_ERROR("Invalid stage"); + return UsdContrivedNoAlias(); + } + return UsdContrivedNoAlias(stage->GetPrimAtPath(path)); +} + +/* static */ +UsdContrivedNoAlias +UsdContrivedNoAlias::Define( + const UsdStagePtr &stage, const SdfPath &path) +{ + static TfToken usdPrimTypeName("UsdContrivedNoAlias"); + if (!stage) { + TF_CODING_ERROR("Invalid stage"); + return UsdContrivedNoAlias(); + } + return UsdContrivedNoAlias( + stage->DefinePrim(path, usdPrimTypeName)); +} + +/* virtual */ +UsdSchemaKind UsdContrivedNoAlias::_GetSchemaKind() const +{ + return UsdContrivedNoAlias::schemaKind; +} + +/* static */ +const TfType & +UsdContrivedNoAlias::_GetStaticTfType() +{ + static TfType tfType = TfType::Find(); + return tfType; +} + +/* static */ +bool +UsdContrivedNoAlias::_IsTypedSchema() +{ + static bool isTyped = _GetStaticTfType().IsA(); + return isTyped; +} + +/* virtual */ +const TfType & +UsdContrivedNoAlias::_GetTfType() const +{ + return _GetStaticTfType(); +} + +/*static*/ +const TfTokenVector& +UsdContrivedNoAlias::GetSchemaAttributeNames(bool includeInherited) +{ + static TfTokenVector localNames; + static TfTokenVector allNames = + UsdTyped::GetSchemaAttributeNames(true); + + if (includeInherited) + return allNames; + else + return localNames; +} + +PXR_NAMESPACE_CLOSE_SCOPE + +// ===================================================================== // +// Feel free to add custom code below this line. It will be preserved by +// the code generator. +// +// Just remember to wrap code in the appropriate delimiters: +// 'PXR_NAMESPACE_OPEN_SCOPE', 'PXR_NAMESPACE_CLOSE_SCOPE'. +// ===================================================================== // +// --(BEGIN CUSTOM CODE)-- diff --git a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/noAlias.h b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/noAlias.h new file mode 100644 index 0000000000..102c1722f6 --- /dev/null +++ b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/noAlias.h @@ -0,0 +1,147 @@ +// +// Copyright 2016 Pixar +// +// Licensed under the terms set forth in the LICENSE.txt file available at +// https://openusd.org/license. +// +#ifndef USDCONTRIVED_GENERATED_NOALIAS_H +#define USDCONTRIVED_GENERATED_NOALIAS_H + +/// \file usdContrived/noAlias.h + +#include "pxr/pxr.h" +#include "pxr/usd/usdContrived/api.h" +#include "pxr/usd/usd/typed.h" +#include "pxr/usd/usd/prim.h" +#include "pxr/usd/usd/stage.h" + +#include "pxr/base/vt/value.h" + +#include "pxr/base/gf/vec3d.h" +#include "pxr/base/gf/vec3f.h" +#include "pxr/base/gf/matrix4d.h" + +#include "pxr/base/tf/token.h" +#include "pxr/base/tf/type.h" + +PXR_NAMESPACE_OPEN_SCOPE + +class SdfAssetPath; + +// -------------------------------------------------------------------------- // +// USDCONTRIVEDNOALIAS // +// -------------------------------------------------------------------------- // + +/// \class UsdContrivedNoAlias +/// +/// +class UsdContrivedNoAlias : public UsdTyped +{ +public: + /// Compile time constant representing what kind of schema this class is. + /// + /// \sa UsdSchemaKind + static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped; + + /// Construct a UsdContrivedNoAlias on UsdPrim \p prim . + /// Equivalent to UsdContrivedNoAlias::Get(prim.GetStage(), prim.GetPath()) + /// for a \em valid \p prim, but will not immediately throw an error for + /// an invalid \p prim + explicit UsdContrivedNoAlias(const UsdPrim& prim=UsdPrim()) + : UsdTyped(prim) + { + } + + /// Construct a UsdContrivedNoAlias on the prim held by \p schemaObj . + /// Should be preferred over UsdContrivedNoAlias(schemaObj.GetPrim()), + /// as it preserves SchemaBase state. + explicit UsdContrivedNoAlias(const UsdSchemaBase& schemaObj) + : UsdTyped(schemaObj) + { + } + + /// Destructor. + USDCONTRIVED_API + virtual ~UsdContrivedNoAlias(); + + /// Return a vector of names of all pre-declared attributes for this schema + /// class and all its ancestor classes. Does not include attributes that + /// may be authored by custom/extended methods of the schemas involved. + USDCONTRIVED_API + static const TfTokenVector & + GetSchemaAttributeNames(bool includeInherited=true); + + /// Return a UsdContrivedNoAlias holding the prim adhering to this + /// schema at \p path on \p stage. If no prim exists at \p path on + /// \p stage, or if the prim at that path does not adhere to this schema, + /// return an invalid schema object. This is shorthand for the following: + /// + /// \code + /// UsdContrivedNoAlias(stage->GetPrimAtPath(path)); + /// \endcode + /// + USDCONTRIVED_API + static UsdContrivedNoAlias + Get(const UsdStagePtr &stage, const SdfPath &path); + + /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path + /// is defined (according to UsdPrim::IsDefined()) on this stage. + /// + /// If a prim adhering to this schema at \p path is already defined on this + /// stage, return that prim. Otherwise author an \a SdfPrimSpec with + /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for + /// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s + /// with \p specifier == \a SdfSpecifierDef and empty typeName at the + /// current EditTarget for any nonexistent, or existing but not \a Defined + /// ancestors. + /// + /// The given \a path must be an absolute prim path that does not contain + /// any variant selections. + /// + /// If it is impossible to author any of the necessary PrimSpecs, (for + /// example, in case \a path cannot map to the current UsdEditTarget's + /// namespace) issue an error and return an invalid \a UsdPrim. + /// + /// Note that this method may return a defined prim whose typeName does not + /// specify this schema class, in case a stronger typeName opinion overrides + /// the opinion at the current EditTarget. + /// + USDCONTRIVED_API + static UsdContrivedNoAlias + Define(const UsdStagePtr &stage, const SdfPath &path); + +protected: + /// Returns the kind of schema this class belongs to. + /// + /// \sa UsdSchemaKind + USDCONTRIVED_API + UsdSchemaKind _GetSchemaKind() const override; + +private: + // needs to invoke _GetStaticTfType. + friend class UsdSchemaRegistry; + USDCONTRIVED_API + static const TfType &_GetStaticTfType(); + + static bool _IsTypedSchema(); + + // override SchemaBase virtuals. + USDCONTRIVED_API + const TfType &_GetTfType() const override; + +public: + // ===================================================================== // + // Feel free to add custom code below this line, it will be preserved by + // the code generator. + // + // Just remember to: + // - Close the class declaration with }; + // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE + // - Close the include guard with #endif + // ===================================================================== // + // --(BEGIN CUSTOM CODE)-- +}; + +PXR_NAMESPACE_CLOSE_SCOPE + +#endif diff --git a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/plugInfo.json b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/plugInfo.json index 8529488299..95df9a061d 100644 --- a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/plugInfo.json +++ b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/plugInfo.json @@ -116,6 +116,14 @@ "schemaIdentifier": "MultipleApplyAPI_1", "schemaKind": "multipleApplyAPI" }, + "UsdContrivedNoAlias": { + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "schemaIdentifier": "UsdContrivedNoAlias", + "schemaKind": "concreteTyped" + }, "UsdContrivedNonAppliedAPI": { "alias": { "UsdSchemaBase": "NonAppliedAPI" diff --git a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/tokens.cpp b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/tokens.cpp index 15c2541c23..e6567983a7 100644 --- a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/tokens.cpp +++ b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/tokens.cpp @@ -163,6 +163,7 @@ UsdContrivedTokensType::UsdContrivedTokensType() : TestNoVersion0_2("TestNoVersion0_2", TfToken::Immortal), TestPxHairman("TestPxHairman", TfToken::Immortal), TestPxHairman_1("TestPxHairman_1", TfToken::Immortal), + UsdContrivedNoAlias("UsdContrivedNoAlias", TfToken::Immortal), allTokens({ asset, assetArray, @@ -317,7 +318,8 @@ UsdContrivedTokensType::UsdContrivedTokensType() : TestNoVersion0, TestNoVersion0_2, TestPxHairman, - TestPxHairman_1 + TestPxHairman_1, + UsdContrivedNoAlias }) { } diff --git a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/tokens.h b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/tokens.h index be293e0378..f2b56cd2df 100644 --- a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/tokens.h +++ b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/tokens.h @@ -661,6 +661,10 @@ struct UsdContrivedTokensType { /// /// Schema identifer for UsdContrivedTestHairman_1 const TfToken TestPxHairman_1; + /// \brief "UsdContrivedNoAlias" + /// + /// Schema identifer and family for UsdContrivedNoAlias + const TfToken UsdContrivedNoAlias; /// A vector of all of the tokens listed above. const std::vector allTokens; }; diff --git a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/wrapNoAlias.cpp b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/wrapNoAlias.cpp new file mode 100644 index 0000000000..964f685f99 --- /dev/null +++ b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/wrapNoAlias.cpp @@ -0,0 +1,107 @@ +// +// Copyright 2016 Pixar +// +// Licensed under the terms set forth in the LICENSE.txt file available at +// https://openusd.org/license. +// +#include "pxr/usd/usdContrived/noAlias.h" +#include "pxr/usd/usd/schemaBase.h" + +#include "pxr/usd/sdf/primSpec.h" + +#include "pxr/usd/usd/pyConversions.h" +#include "pxr/base/tf/pyContainerConversions.h" +#include "pxr/base/tf/pyResultConversions.h" +#include "pxr/base/tf/pyUtils.h" +#include "pxr/base/tf/wrapTypeHelpers.h" + +#include "pxr/external/boost/python.hpp" + +#include + +PXR_NAMESPACE_USING_DIRECTIVE + +using namespace pxr_boost::python; + +namespace { + +#define WRAP_CUSTOM \ + template static void _CustomWrapCode(Cls &_class) + +// fwd decl. +WRAP_CUSTOM; + + +static std::string +_Repr(const UsdContrivedNoAlias &self) +{ + std::string primRepr = TfPyRepr(self.GetPrim()); + return TfStringPrintf( + "UsdContrived.NoAlias(%s)", + primRepr.c_str()); +} + +} // anonymous namespace + +void wrapUsdContrivedNoAlias() +{ + typedef UsdContrivedNoAlias This; + + class_ > + cls("NoAlias"); + + cls + .def(init(arg("prim"))) + .def(init(arg("schemaObj"))) + .def(TfTypePythonClass()) + + .def("Get", &This::Get, (arg("stage"), arg("path"))) + .staticmethod("Get") + + .def("Define", &This::Define, (arg("stage"), arg("path"))) + .staticmethod("Define") + + .def("GetSchemaAttributeNames", + &This::GetSchemaAttributeNames, + arg("includeInherited")=true, + return_value_policy()) + .staticmethod("GetSchemaAttributeNames") + + .def("_GetStaticTfType", (TfType const &(*)()) TfType::Find, + return_value_policy()) + .staticmethod("_GetStaticTfType") + + .def(!self) + + + .def("__repr__", ::_Repr) + ; + + _CustomWrapCode(cls); +} + +// ===================================================================== // +// Feel free to add custom code below this line, it will be preserved by +// the code generator. The entry point for your custom code should look +// minimally like the following: +// +// WRAP_CUSTOM { +// _class +// .def("MyCustomMethod", ...) +// ; +// } +// +// Of course any other ancillary or support code may be provided. +// +// Just remember to wrap code in the appropriate delimiters: +// 'namespace {', '}'. +// +// ===================================================================== // +// --(BEGIN CUSTOM CODE)-- + +namespace { + +WRAP_CUSTOM { +} + +} diff --git a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/wrapTokens.cpp b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/wrapTokens.cpp index 1663971066..793acd567b 100644 --- a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/wrapTokens.cpp +++ b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/basic/wrapTokens.cpp @@ -171,4 +171,5 @@ void wrapUsdContrivedTokens() _ADD_TOKEN(cls, TestNoVersion0_2); _ADD_TOKEN(cls, TestPxHairman); _ADD_TOKEN(cls, TestPxHairman_1); + _ADD_TOKEN(cls, UsdContrivedNoAlias); } diff --git a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/codeless/plugInfo.json b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/codeless/plugInfo.json index a397c7765b..7e47925508 100644 --- a/pxr/usd/usd/testenv/testUsdGenSchema/baseline/codeless/plugInfo.json +++ b/pxr/usd/usd/testenv/testUsdGenSchema/baseline/codeless/plugInfo.json @@ -116,6 +116,14 @@ "schemaIdentifier": "MultipleApplyAPI_1", "schemaKind": "multipleApplyAPI" }, + "UsdContrivedNoAlias": { + "autoGenerated": true, + "bases": [ + "UsdTyped" + ], + "schemaIdentifier": "UsdContrivedNoAlias", + "schemaKind": "concreteTyped" + }, "UsdContrivedNonAppliedAPI": { "alias": { "UsdSchemaBase": "NonAppliedAPI" diff --git a/pxr/usd/usd/testenv/testUsdGenSchema/codeless_schema.usda b/pxr/usd/usd/testenv/testUsdGenSchema/codeless_schema.usda index 9270bf6bbf..857c4df614 100644 --- a/pxr/usd/usd/testenv/testUsdGenSchema/codeless_schema.usda +++ b/pxr/usd/usd/testenv/testUsdGenSchema/codeless_schema.usda @@ -553,3 +553,12 @@ class "MultipleApplyAPI_1" ( int testAttrOne double testAttrTwo } + +class UsdContrivedNoAlias "UsdContrivedNoAlias" ( + inherits = + customData = { + string className = "NoAlias" + } +) +{ +} \ No newline at end of file diff --git a/pxr/usd/usd/testenv/testUsdGenSchema/schema.usda b/pxr/usd/usd/testenv/testUsdGenSchema/schema.usda index 48ba508962..bd1a040dc8 100644 --- a/pxr/usd/usd/testenv/testUsdGenSchema/schema.usda +++ b/pxr/usd/usd/testenv/testUsdGenSchema/schema.usda @@ -552,3 +552,12 @@ class "MultipleApplyAPI_1" ( int testAttrOne double testAttrTwo } + +class UsdContrivedNoAlias "UsdContrivedNoAlias" ( + inherits = + customData = { + string className = "NoAlias" + } +) +{ +} \ No newline at end of file diff --git a/pxr/usd/usd/usdGenSchema.py b/pxr/usd/usd/usdGenSchema.py index b89ada0d55..aa456ab75b 100644 --- a/pxr/usd/usd/usdGenSchema.py +++ b/pxr/usd/usd/usdGenSchema.py @@ -1508,8 +1508,10 @@ def GeneratePlugInfo(templatePath, codeGenPath, classes, validate, env, # for multiple apply schemas. _UpdatePlugInfoWithAPISchemaApplyInfo(clsDict, cls) - # Write out alias/primdefs for all schemas - clsDict['alias'] = {'UsdSchemaBase': cls.usdPrimTypeName} + # Write out aliases for schemas where the cpp class name and + # prim type name do not match. + if cls.usdPrimTypeName != cls.cppClassName: + clsDict['alias'] = {'UsdSchemaBase': cls.usdPrimTypeName} # Write out schema identifier clsDict['schemaIdentifier'] = cls.usdPrimTypeName diff --git a/pxr/usd/usdMtlx/reader.cpp b/pxr/usd/usdMtlx/reader.cpp index b62f5bfd72..6a3a91b12f 100644 --- a/pxr/usd/usdMtlx/reader.cpp +++ b/pxr/usd/usdMtlx/reader.cpp @@ -433,13 +433,15 @@ _TypeSupportsColorSpace(const mx::ConstValueElementPtr& mxElem) bool colorImageNode = false; if (type == "filename") { - // verify the output is color3 or color4 mx::ConstNodeDefPtr parentNodeDef; if (mxElem->getParent()->isA()) { parentNodeDef = _GetNodeDef(mxElem->getParent()->asA()); - } else if (mxElem->getParent()->isA()) { + } + else if (mxElem->getParent()->isA()) { parentNodeDef = mxElem->getParent()->asA(); } + + // Verify the output is color3 or color4 if (parentNodeDef) { for (const mx::OutputPtr& output : parentNodeDef->getOutputs()) { const std::string &type = output->getType(); From 9c1a75d4f3f909bb85ff4718e5c33239f02b5ce3 Mon Sep 17 00:00:00 2001 From: unhyperbolic Date: Mon, 14 Oct 2024 11:53:20 -0700 Subject: [PATCH 34/82] Add helpers for getting data source locators for members (Internal change: 2344175) --- pxr/imaging/hd/hdSchemaDefs.py | 1 + pxr/imaging/hd/renderBufferSchema.cpp | 30 +++++++++++++++++++++++++++ pxr/imaging/hd/renderBufferSchema.h | 22 ++++++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/pxr/imaging/hd/hdSchemaDefs.py b/pxr/imaging/hd/hdSchemaDefs.py index 302f89dec4..3bdb4aeefc 100644 --- a/pxr/imaging/hd/hdSchemaDefs.py +++ b/pxr/imaging/hd/hdSchemaDefs.py @@ -866,6 +866,7 @@ SCHEMA_NAME = 'RenderBuffer', SCHEMA_TOKEN = 'renderBuffer', MEMBERS = [ + ('ALL_MEMBERS', '', dict(ADD_LOCATOR = True)), ('dimensions', T_VEC3I, {}), ('format', T_FORMAT, {}), ('multiSampled', T_BOOL, {}), diff --git a/pxr/imaging/hd/renderBufferSchema.cpp b/pxr/imaging/hd/renderBufferSchema.cpp index 6b8e3e7e3d..ab65a3c3f6 100644 --- a/pxr/imaging/hd/renderBufferSchema.cpp +++ b/pxr/imaging/hd/renderBufferSchema.cpp @@ -142,6 +142,36 @@ HdRenderBufferSchema::GetDefaultLocator() { static const HdDataSourceLocator locator(GetSchemaToken()); return locator; +} + +/* static */ +const HdDataSourceLocator & +HdRenderBufferSchema::GetDimensionsLocator() +{ + static const HdDataSourceLocator locator = + GetDefaultLocator().Append( + HdRenderBufferSchemaTokens->dimensions); + return locator; +} + +/* static */ +const HdDataSourceLocator & +HdRenderBufferSchema::GetFormatLocator() +{ + static const HdDataSourceLocator locator = + GetDefaultLocator().Append( + HdRenderBufferSchemaTokens->format); + return locator; +} + +/* static */ +const HdDataSourceLocator & +HdRenderBufferSchema::GetMultiSampledLocator() +{ + static const HdDataSourceLocator locator = + GetDefaultLocator().Append( + HdRenderBufferSchemaTokens->multiSampled); + return locator; } PXR_NAMESPACE_CLOSE_SCOPE \ No newline at end of file diff --git a/pxr/imaging/hd/renderBufferSchema.h b/pxr/imaging/hd/renderBufferSchema.h index c355843223..2a8a5a43d5 100644 --- a/pxr/imaging/hd/renderBufferSchema.h +++ b/pxr/imaging/hd/renderBufferSchema.h @@ -94,6 +94,28 @@ class HdRenderBufferSchema : public HdSchema HD_API static const HdDataSourceLocator &GetDefaultLocator(); + /// @} + + /// \name Data source locators for members + /// + /// The following methods return an HdDataSourceLocator (relative to the + /// prim-level data source) where the data source for a member can be found. + /// + /// This is often useful for checking intersection against the + /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied. + /// @{ + + /// Prim-level relative data source locator to locate dimensions. + HD_API + static const HdDataSourceLocator &GetDimensionsLocator(); + + /// Prim-level relative data source locator to locate format. + HD_API + static const HdDataSourceLocator &GetFormatLocator(); + + /// Prim-level relative data source locator to locate multiSampled. + HD_API + static const HdDataSourceLocator &GetMultiSampledLocator(); /// @} /// \name Schema construction From 303b2ae7119c05647a91d75461c133ca993fba05 Mon Sep 17 00:00:00 2001 From: clach Date: Mon, 14 Oct 2024 11:57:29 -0700 Subject: [PATCH 35/82] [hdSt] One piece of Autodesk pull request #3170, a change meant to fix failing HdSt tests when using Lavapipe. From PR description: testHdStBasicDrawing Problem: geometry shaders with more than VkPhysicalDeviceLimits::maxGeometryInputComponents input locations are being generated. Fix: Inputs are passed as arrays of int, consuming one location per int. Instead pack them into ivec4 (for array sizes smaller or equal to 4, which is the max right now for quads), to pass up to 4 values per location. See #3170. (Internal change: 2344215) --- pxr/imaging/hdSt/codeGen.cpp | 384 ++++++++++++------ pxr/imaging/hdSt/codeGen.h | 29 +- .../baseline/codegen_curves_bindless.out | 204 ++++------ .../baseline/codegen_curves_indirect.out | 204 ++++------ .../codegen_mesh_bindless_indirect.out | 272 +++++-------- ...gen_mesh_bindless_indirect_doubleSided.out | 272 +++++-------- ...gen_mesh_bindless_indirect_faceVarying.out | 272 +++++-------- ...odegen_mesh_bindless_indirect_instance.out | 328 ++++++--------- ...n_mesh_bindless_indirect_smoothNormals.out | 272 +++++-------- .../baseline/codegen_mesh_edgeonly.out | 272 +++++-------- .../codegen_mesh_edgeonly_blendwireframe.out | 272 +++++-------- .../baseline/codegen_mesh_indirect.out | 272 +++++-------- .../codegen_mesh_indirect_instance.out | 328 ++++++--------- .../baseline/codegen_points_bindless.out | 68 ++-- .../baseline/codegen_points_indirect.out | 68 ++-- .../baseline/codegen_curves_indirect.out | 220 ++++------ .../baseline/codegen_mesh_edgeonly.out | 296 ++++++-------- .../codegen_mesh_edgeonly_blendwireframe.out | 296 ++++++-------- .../baseline/codegen_mesh_indirect.out | 296 ++++++-------- .../codegen_mesh_indirect_doubleSided.out | 296 ++++++-------- .../codegen_mesh_indirect_faceVarying.out | 296 ++++++-------- .../codegen_mesh_indirect_instance.out | 352 +++++++--------- .../codegen_mesh_indirect_smoothNormals.out | 296 ++++++-------- .../baseline/codegen_points_indirect.out | 80 ++-- 24 files changed, 2428 insertions(+), 3517 deletions(-) diff --git a/pxr/imaging/hdSt/codeGen.cpp b/pxr/imaging/hdSt/codeGen.cpp index 15a40a3185..2f41936567 100644 --- a/pxr/imaging/hdSt/codeGen.cpp +++ b/pxr/imaging/hdSt/codeGen.cpp @@ -35,7 +35,7 @@ #include "pxr/base/tf/hash.h" #include -#include +#include #if defined(__APPLE__) #include @@ -129,6 +129,7 @@ TF_DEFINE_PRIVATE_TOKENS( (triangle_strip) (early_fragment_tests) (OsdPerPatchVertexBezier) + (interstageDrawingCoord) ); TF_DEFINE_ENV_SETTING(HDST_ENABLE_HGI_RESOURCE_GENERATION, false, @@ -1589,67 +1590,174 @@ HdSt_CodeGen::_GetShaderResourceLayouts( } void -HdSt_CodeGen::_PlumbInterstageElements( - TfToken const &name, - TfToken const &dataType) +HdSt_CodeGen::_PlumbInterstageElements() { - // Add resource elements to plumb interstage elements, e.g. - // drawingCoord and interpolated primvar through active stages. + // Graphics devices impose limits on the number of input/output locations + // available. We can quickly exceeed such limits on low spec devices if we + // naively use one location per drawing coord. This is because arrays take + // one location per item, regardless of the item size. This means that: + // layout(location = 0) in int someCoord[gl_MaxPatchVertices] + // consumes as many locations (gl_MaxPatchVertices) as: + // layout(location = 0) in ivec4 someCoord[gl_MaxPatchVertices] + // while holding 4x fewer values. Instead if we do: + // layout(location = 0) in ivec4 someCoord[ + // divRoundUp(gl_MaxPatchVertices, 4)] + // and pack the coord values into the vector elements, we can use 4x fewer + // locations. In practice, since we have many coord in/out fields, it's + // simpler to pack across fields instead of within a field, but the idea is + // the same. This means that: + // flat layout(location = 0) in int someCoord1[gl_MaxPatchVertices]; + // flat layout(location = 1) in int someCoord2[gl_MaxPatchVertices]; + // < 7 more fields omitted > + // flat layout(location = 9) in int someCoord10[gl_MaxPatchVertices]; + // becomes: + // flat layout(location = 0) in ivec4 someCoord1To4[gl_MaxPatchVertices]; + // flat layout(location = 1) in ivec4 someCoord5to8[gl_MaxPatchVertices]; + // flat layout(location = 2) in ivec4 someCoord8to10[gl_MaxPatchVertices]; + // where someCoord1To4[i].x is someCoord1[i], someCoord1To4[i].y is + // someCoord2[i], someCoord1To4[i].z is someCoord3[i], someCoord1To4[i].w + // is someCoord4[i]. + // + // Ref: https://docs.vulkan.org/spec/latest/chapters/interfaces.html#interfaces-iointerfaces-locations - std::string const &baseName = name.GetString(); - TfToken const vs_outName( "vs_" + baseName); - TfToken const tcs_outName("tcs_" + baseName); - TfToken const tes_outName("tes_" + baseName); - TfToken const gs_outName( "gs_" + baseName); + // This code automates such packing. It identifies fields with the same + // scalar type, and groups them into 4 element vectors. It also generates + // mapping data, so the original field can be mapped to its vector + // component. - // Empty token for variables with no array size - TfToken const noArraySize; + struct _ProcessedElement { + TfToken name; + TfToken dataType; + }; + using _ProcessedElementVector = std::vector<_ProcessedElement>; - // Interstage variables of type "int" require "flat" interpolation - TfToken const &qualifier = - (dataType == _tokens->_int) ? _tokens->flat : _tokens->_default; + struct _ElementGroup { + TfToken commonDataType; + ElementVector elements; + }; + + _ProcessedElementVector processedElements; + std::vector<_ElementGroup> packedElementGroups; + std::map elementGroupsToFill; + for (auto const& element : _resInterstage) { + TfToken const& dataType = element.dataType; + if (dataType != _tokens->_int && dataType != _tokens->_float) { + processedElements.push_back({element.name, dataType}); + continue; + } - // Vertex attrib input for VS, PTCS, PTVS - _resAttrib.emplace_back(InOut::STAGE_OUT, Kind::VALUE, dataType, - vs_outName, noArraySize, qualifier); + // Add to an existing group, or create a new one. + _ElementGroup* group; + if (const auto iter = elementGroupsToFill.find(dataType); + iter != elementGroupsToFill.end()) { + group = &iter->second; + } else { + group = &elementGroupsToFill.try_emplace( + dataType, _ElementGroup{dataType}).first->second; + } - if (_hasTCS) { - _resTCS.emplace_back(InOut::STAGE_IN, Kind::VALUE, dataType, - vs_outName, _tokens->gl_MaxPatchVertices, qualifier); - _resTCS.emplace_back(InOut::STAGE_OUT, Kind::VALUE, dataType, - tcs_outName, _tokens->HD_NUM_PATCH_EVAL_VERTS, qualifier); + // When a group is full, move it to the fully packed groups list. + TF_VERIFY(group->elements.size() < 4); + group->elements.push_back(element); + if (group->elements.size() == 4) { + packedElementGroups.push_back(std::move(*group)); + elementGroupsToFill.erase(dataType); + } } - if (_hasTES) { - _resTES.emplace_back(InOut::STAGE_IN, Kind::VALUE, dataType, - tcs_outName, _tokens->gl_MaxPatchVertices, qualifier); - _resTES.emplace_back(InOut::STAGE_OUT, Kind::VALUE, dataType, - tes_outName, noArraySize, qualifier); + // Some groups won't be full if the number of elements is not cleanly + // divisible by 4. + for (auto& [_, group] : elementGroupsToFill) { + packedElementGroups.push_back(std::move(group)); } - // Geometry shader inputs come from previous active stage - if (_hasGS && _hasTES) { - _resGS.emplace_back(InOut::STAGE_IN, Kind::VALUE, dataType, - tes_outName, _tokens->HD_NUM_PRIMITIVE_VERTS, qualifier); - _resGS.emplace_back(InOut::STAGE_OUT, Kind::VALUE, dataType, - gs_outName, noArraySize, qualifier); - } else if (_hasGS) { - _resGS.emplace_back(InOut::STAGE_IN, Kind::VALUE, dataType, - vs_outName, _tokens->HD_NUM_PRIMITIVE_VERTS, qualifier); - _resGS.emplace_back(InOut::STAGE_OUT, Kind::VALUE, dataType, - gs_outName, noArraySize, qualifier); + // Generate the mapping data. + _resInterstagePackedMappings.clear(); + size_t packedElementGroup = 0; + for (const auto& [commonDataType, elements] : packedElementGroups) { + std::stringstream groupNameBuffer; + TfToken const groupName = TfToken( + _tokens->interstageDrawingCoord.GetString() + + std::to_string(packedElementGroup++)); + + for (size_t i = 0; i < elements.size(); i++) { + _PackedResourceMapping mapping; + mapping.groupName = groupName; + mapping.component = '[' + std::to_string(i) + ']'; + _resInterstagePackedMappings.try_emplace( + elements[i].name.GetString(), std::move(mapping)); + } + + if (commonDataType == _tokens->_int) { + processedElements.push_back({groupName, _tokens->ivec4}); + } else if (commonDataType == _tokens->_float) { + processedElements.push_back({groupName, _tokens->vec4}); + } else { + TF_CODING_ERROR("Invalid element group data type"); + } } - // Fragment shader inputs come from previous active stage - if (_hasGS) { - _resFS.emplace_back(InOut::STAGE_IN, Kind::VALUE, dataType, - gs_outName, noArraySize, qualifier); - } else if (_hasTES) { - _resFS.emplace_back(InOut::STAGE_IN, Kind::VALUE, dataType, - tes_outName, noArraySize, qualifier); - } else { - _resFS.emplace_back(InOut::STAGE_IN, Kind::VALUE, dataType, - vs_outName, noArraySize, qualifier); + for (auto const& [name, dataType] : processedElements) { + bool const isInteger = (dataType == _tokens->ivec4); + + // Add resource elements to plumb interstage elements, e.g. + // drawingCoord and interpolated primvar through active stages. + + std::string const &baseName = name.GetString(); + TfToken const vs_outName( "vs_" + baseName); + TfToken const tcs_outName("tcs_" + baseName); + TfToken const tes_outName("tes_" + baseName); + TfToken const gs_outName( "gs_" + baseName); + + // Empty token for variables with no array size + TfToken const noArraySize; + + // Interstage variables of base type "int" require "flat" interpolation + TfToken const &qualifier = isInteger ? + _tokens->flat : _tokens->_default; + + // Vertex attrib input for VS, PTCS, PTVS + _resAttrib.emplace_back(InOut::STAGE_OUT, Kind::VALUE, dataType, + vs_outName, noArraySize, qualifier); + + if (_hasTCS) { + _resTCS.emplace_back(InOut::STAGE_IN, Kind::VALUE, dataType, + vs_outName, _tokens->gl_MaxPatchVertices, qualifier); + _resTCS.emplace_back(InOut::STAGE_OUT, Kind::VALUE, dataType, + tcs_outName, _tokens->HD_NUM_PATCH_EVAL_VERTS, qualifier); + } + + if (_hasTES) { + _resTES.emplace_back(InOut::STAGE_IN, Kind::VALUE, dataType, + tcs_outName, _tokens->gl_MaxPatchVertices, qualifier); + _resTES.emplace_back(InOut::STAGE_OUT, Kind::VALUE, dataType, + tes_outName, noArraySize, qualifier); + } + + // Geometry shader inputs come from previous active stage + if (_hasGS && _hasTES) { + _resGS.emplace_back(InOut::STAGE_IN, Kind::VALUE, dataType, + tes_outName, _tokens->HD_NUM_PRIMITIVE_VERTS, qualifier); + _resGS.emplace_back(InOut::STAGE_OUT, Kind::VALUE, dataType, + gs_outName, noArraySize, qualifier); + } else if (_hasGS) { + _resGS.emplace_back(InOut::STAGE_IN, Kind::VALUE, dataType, + vs_outName, _tokens->HD_NUM_PRIMITIVE_VERTS, qualifier); + _resGS.emplace_back(InOut::STAGE_OUT, Kind::VALUE, dataType, + gs_outName, noArraySize, qualifier); + } + + // Fragment shader inputs come from previous active stage + if (_hasGS) { + _resFS.emplace_back(InOut::STAGE_IN, Kind::VALUE, dataType, + gs_outName, noArraySize, qualifier); + } else if (_hasTES) { + _resFS.emplace_back(InOut::STAGE_IN, Kind::VALUE, dataType, + tes_outName, noArraySize, qualifier); + } else { + _resFS.emplace_back(InOut::STAGE_IN, Kind::VALUE, dataType, + vs_outName, noArraySize, qualifier); + } } } @@ -2500,11 +2608,6 @@ HdSt_CodeGen::_CompileWithGeneratedGLSLResources( // Generator assigns attribute and binding locations _ResourceGenerator resourceGen; - // Create additional resource elements needed by interstage elements - for (auto const &element : _resInterstage) { - _PlumbInterstageElements(element.name, element.dataType); - } - // create GLSL program. HdStGLSLProgramSharedPtr glslProgram = std::make_shared(HdTokens->drawingShader, registry); @@ -2696,12 +2799,6 @@ HdSt_CodeGen::_CompileWithGeneratedHgiResources( // Generator assigns attribute and binding locations _ResourceGenerator resourceGen; - // Create additional resource elements needed by interstage elements. - // For compute-only shaders, we don't have a HdSt_GeometricShader. - for (auto const &element : _resInterstage) { - _PlumbInterstageElements(element.name, element.dataType); - } - // create GLSL program. HdStGLSLProgramSharedPtr glslProgram = std::make_shared(HdTokens->drawingShader, registry); @@ -4104,58 +4201,82 @@ static void _EmitFVarAccessor( << " { return HdGet_" << name << "(0); }\n"; } -// Helper function to generate the implementation of "GetDrawingCoord()". -static void -_GetDrawingCoord(std::stringstream &ss, - std::vector const &drawingCoordParams, - int const instanceIndexWidth, - char const *inputPrefix, - char const *inArraySize) +HdSt_CodeGen::_PackedResourceMapping +HdSt_CodeGen::_GetDrawingCoordMapping(std::string const& name) +{ + // Given a drawing coord un-prefixed name, return a mapping to + // a component in a vector of packed interstage drawing coords. + if (const auto iter = _resInterstagePackedMappings.find("dc_" + name); + iter != _resInterstagePackedMappings.end()) + { + return iter->second; + } + + return {TfToken(name), TfToken()}; +} + +void +HdSt_CodeGen::_GetDrawingCoord( + std::stringstream &ss, + std::vector const &drawingCoordParams, + int instanceIndexWidth, + char const *inputPrefix, + char const *inArraySize) { ss << "hd_drawingCoord GetDrawingCoord() { \n" << " hd_drawingCoord dc; \n"; for (std::string const & param : drawingCoordParams) { + const auto [groupName, component] = _GetDrawingCoordMapping(param); + ss << " dc." << param - << " = " << inputPrefix << param << inArraySize << ";\n"; + << " = " << inputPrefix << groupName << inArraySize << component + << ";\n"; } for(int i = 0; i < instanceIndexWidth; ++i) { - ss << " dc.instanceIndex[" << std::to_string(i) << "]" - << " = " << inputPrefix - << "instanceIndexI" << std::to_string(i) << inArraySize << ";\n"; + const auto [groupName, component] = _GetDrawingCoordMapping( + "instanceIndexI" + std::to_string(i)); + ss << " dc.instanceIndex[" << i << "]" + << " = " << inputPrefix << groupName << inArraySize << component + << ";\n"; } for(int i = 0; i < instanceIndexWidth-1; ++i) { - ss << " dc.instanceCoords[" << std::to_string(i) << "]" - << " = " << inputPrefix - << "instanceCoordsI" << std::to_string(i) << inArraySize << ";\n"; + const auto [groupName, component] = _GetDrawingCoordMapping( + "instanceCoordsI" + std::to_string(i)); + ss << " dc.instanceCoords[" << i << "]" + << " = " << inputPrefix << groupName << inArraySize << component + << ";\n"; } ss << " return dc; \n" << "}\n"; } -// Helper function to generate drawingCoord interstage processing. -static void -_ProcessDrawingCoord(std::stringstream &ss, - std::vector const &drawingCoordParams, - int const instanceIndexWidth, - char const *outputPrefix, - char const *outArraySize) +void +HdSt_CodeGen::_ProcessDrawingCoord( + std::stringstream &ss, + std::vector const &drawingCoordParams, + int instanceIndexWidth, + char const *outputPrefix, + char const *outArraySize) { ss << " hd_drawingCoord dc = GetDrawingCoord();\n"; for (std::string const & param : drawingCoordParams) { - ss << " " << outputPrefix << param << outArraySize - << " = " << "dc." << param << ";\n"; + const auto [groupName, component] = _GetDrawingCoordMapping(param); + ss << " " << outputPrefix << groupName << outArraySize << component + << " = " << "dc." << param << ";\n"; } for(int i = 0; i < instanceIndexWidth; ++i) { - std::string const index = std::to_string(i); - ss << " " << outputPrefix << "instanceIndexI" << index << outArraySize - << " = " << "dc.instanceIndex[" << index << "]" << ";\n"; + const auto [groupName, component] = _GetDrawingCoordMapping( + "instanceIndexI" + std::to_string(i)); + ss << " " << outputPrefix << groupName << outArraySize << component + << " = " << "dc.instanceIndex[" << i << "]" << ";\n"; } for(int i = 0; i < instanceIndexWidth-1; ++i) { - std::string const index = std::to_string(i); - ss << " " << outputPrefix << "instanceCoordsI" << index << outArraySize - << " = " << "dc.instanceCoords[" << index << "]" << ";\n"; + const auto [groupName, component] = _GetDrawingCoordMapping( + "instanceCoordsI" + std::to_string(i)); + ss << " " << outputPrefix << groupName << outArraySize << component + << " = " << "dc.instanceCoords[" << i << "]" << ";\n"; } } @@ -4276,6 +4397,34 @@ HdSt_CodeGen::_GenerateDrawingCoord( "varyingCoord" }; + const int instanceIndexWidth = _metaData->instancerNumLevels + 1; + + if (!_hasCS) { + for (std::string const & param : drawingCoordParams) { + TfToken const drawingCoordParamName("dc_" + param); + _AddInterstageElement(&_resInterstage, + HioGlslfxResourceLayout::InOut::NONE, + /*name=*/drawingCoordParamName, + /*dataType=*/_tokens->_int); + } + for (int i = 0; i < instanceIndexWidth; ++i) { + TfToken const name(TfStringPrintf("dc_instanceIndexI%d", i)); + _AddInterstageElement(&_resInterstage, + HioGlslfxResourceLayout::InOut::NONE, + /*name=*/name, + /*dataType=*/_tokens->_int); + } + for (int i = 0; i < instanceIndexWidth; ++i) { + TfToken const name(TfStringPrintf("dc_instanceCoordsI%d", i)); + _AddInterstageElement(&_resInterstage, + HioGlslfxResourceLayout::InOut::NONE, + /*name=*/name, + /*dataType=*/_tokens->_int); + } + + _PlumbInterstageElements(); + } + // common // // note: instanceCoords should be [HD_INSTANCER_NUM_LEVELS], but since @@ -4293,8 +4442,6 @@ HdSt_CodeGen::_GenerateDrawingCoord( _genDecl << "FORWARD_DECL(hd_drawingCoord GetDrawingCoord());\n" "FORWARD_DECL(int HgiGetBaseVertex());\n"; - int instanceIndexWidth = _metaData->instancerNumLevels + 1; - // vertex shader // [immediate] @@ -4324,7 +4471,10 @@ HdSt_CodeGen::_GenerateDrawingCoord( // patch instance offset exists on Apple Silicon. Use primitiveCoord // subtracted from the primitive ID for those cases if (requiresBasePrimitiveOffset) { - primitiveID << "int GetBasePrimitiveOffset() { return vs_dc_primitiveCoord; }\n"; + const auto [groupName, component] = + _GetDrawingCoordMapping("primitiveCoord"); + primitiveID << "int GetBasePrimitiveOffset() { return vs_" + << groupName << component << "; }\n"; _genPTCS << "int GetBasePrimitiveOffset() { return drawingCoord0[0].w; }\n"; _genPTVS << "int GetBasePrimitiveOffset() { return drawingCoord0[0].w; }\n"; } else { @@ -4589,30 +4739,6 @@ HdSt_CodeGen::_GenerateDrawingCoord( << " hd_instanceIndex r; r.indices[0] = 0; return r; }\n"; } - if (!_hasCS) { - for (std::string const & param : drawingCoordParams) { - TfToken const drawingCoordParamName("dc_" + param); - _AddInterstageElement(&_resInterstage, - HioGlslfxResourceLayout::InOut::NONE, - /*name=*/drawingCoordParamName, - /*dataType=*/_tokens->_int); - } - for (int i = 0; i < instanceIndexWidth; ++i) { - TfToken const name(TfStringPrintf("dc_instanceIndexI%d", i)); - _AddInterstageElement(&_resInterstage, - HioGlslfxResourceLayout::InOut::NONE, - /*name=*/name, - /*dataType=*/_tokens->_int); - } - for (int i = 0; i < instanceIndexWidth; ++i) { - TfToken const name(TfStringPrintf("dc_instanceCoordsI%d", i)); - _AddInterstageElement(&_resInterstage, - HioGlslfxResourceLayout::InOut::NONE, - /*name=*/name, - /*dataType=*/_tokens->_int); - } - } - _genVS << genAttr.str(); _genPTCS << genAttr.str(); _genPTVS << genAttr.str(); @@ -4715,52 +4841,52 @@ HdSt_CodeGen::_GenerateDrawingCoord( // VS/PTVS from attributes _ProcessDrawingCoord(_procVS, drawingCoordParams, instanceIndexWidth, - "vs_dc_", ""); + "vs_", ""); _ProcessDrawingCoord(_procPTVSOut, drawingCoordParams, instanceIndexWidth, - "vs_dc_", ""); + "vs_", ""); // TCS from VS if (_hasTCS) { _GetDrawingCoord(_genTCS, drawingCoordParams, instanceIndexWidth, - "vs_dc_", "[0]"); + "vs_", "[0]"); _ProcessDrawingCoord(_procTCS, drawingCoordParams, instanceIndexWidth, - "tcs_dc_", "[gl_InvocationID]"); + "tcs_", "[gl_InvocationID]"); } // TES from TCS if (_hasTES) { _GetDrawingCoord(_genTES, drawingCoordParams, instanceIndexWidth, - "tcs_dc_", "[0]"); + "tcs_", "[0]"); _ProcessDrawingCoord(_procTES, drawingCoordParams, instanceIndexWidth, - "tes_dc_", ""); + "tes_", ""); } // GS if (_hasGS && _hasTES) { // from TES _GetDrawingCoord(_genGS, drawingCoordParams, instanceIndexWidth, - "tes_dc_", "[0]"); + "tes_", "[0]"); } else if (_hasGS) { // from VS _GetDrawingCoord(_genGS, drawingCoordParams, instanceIndexWidth, - "vs_dc_", "[0]"); + "vs_", "[0]"); } _ProcessDrawingCoord(_procGS, drawingCoordParams, instanceIndexWidth, - "gs_dc_", ""); + "gs_", ""); // FS if (_hasGS) { // from GS _GetDrawingCoord(_genFS, drawingCoordParams, instanceIndexWidth, - "gs_dc_", ""); + "gs_", ""); } else if (_hasTES) { // from TES _GetDrawingCoord(_genFS, drawingCoordParams, instanceIndexWidth, - "tes_dc_", ""); + "tes_", ""); } else { // from VS/PTVS _GetDrawingCoord(_genFS, drawingCoordParams, instanceIndexWidth, - "vs_dc_", ""); + "vs_", ""); } } diff --git a/pxr/imaging/hdSt/codeGen.h b/pxr/imaging/hdSt/codeGen.h index b2fcb99865..fef9b6d2d4 100644 --- a/pxr/imaging/hdSt/codeGen.h +++ b/pxr/imaging/hdSt/codeGen.h @@ -14,7 +14,7 @@ #include "pxr/imaging/hdSt/glslProgram.h" #include "pxr/imaging/hio/glslfxResourceLayout.h" -#include +#include #include #include @@ -129,7 +129,30 @@ class HdSt_CodeGen std::string _GetFallbackScalarSwizzleString(TfToken const &returnType, TfToken const ¶mName); - void _PlumbInterstageElements(TfToken const &name, TfToken const &dataType); + void _PlumbInterstageElements(); + + // The packed field name (grouping vector) and name of its component that + // holds the resource. + struct _PackedResourceMapping { + TfToken groupName; + std::string component; + }; + + _PackedResourceMapping _GetDrawingCoordMapping(std::string const &name); + + void _GetDrawingCoord( + std::stringstream &ss, + std::vector const &drawingCoordParams, + int instanceIndexWidth, + char const *inputPrefix, + char const *inArraySize); + + void _ProcessDrawingCoord( + std::stringstream &ss, + std::vector const &drawingCoordParams, + int instanceIndexWidth, + char const *outputPrefix, + char const *outArraySize); void _GenerateComputeParameters(HgiShaderFunctionDesc *csDesc); @@ -171,6 +194,8 @@ class HdSt_CodeGen ElementVector _resCS; ElementVector _resInterstage; + std::unordered_map + _resInterstagePackedMappings; ElementVector _resCommon; ElementVector _resAttrib; diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_curves_bindless.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_curves_bindless.out index 1379eaaab9..e3ec0a77c9 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_curves_bindless.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_curves_bindless.out @@ -164,22 +164,14 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceCoordsI0; layout(location = 0) uniform ConstantData10 *constantPrimvars; layout(location = 1) uniform float *faceVisibility; out CurveVertexData { @@ -255,16 +247,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -829,6 +821,12 @@ in CurveVertexData { out CurveVertexData { vec4 Peye; } outData[HD_NUM_PATCH_EVAL_VERTS]; +in flat ivec4 vs_interstageDrawingCoord0[gl_MaxPatchVertices]; +out flat ivec4 tcs_interstageDrawingCoord0[HD_NUM_PATCH_EVAL_VERTS]; +in flat ivec4 vs_interstageDrawingCoord1[gl_MaxPatchVertices]; +out flat ivec4 tcs_interstageDrawingCoord1[HD_NUM_PATCH_EVAL_VERTS]; +in flat ivec4 vs_interstageDrawingCoord2[gl_MaxPatchVertices]; +out flat ivec4 tcs_interstageDrawingCoord2[HD_NUM_PATCH_EVAL_VERTS]; in PrimvarData { vec3 points; vec3 normals; @@ -837,28 +835,6 @@ out PrimvarData { vec3 points; vec3 normals; } outPrimvars[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_modelCoord[gl_MaxPatchVertices]; -out flat int tcs_dc_modelCoord[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_constantCoord[gl_MaxPatchVertices]; -out flat int tcs_dc_constantCoord[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_elementCoord[gl_MaxPatchVertices]; -out flat int tcs_dc_elementCoord[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_primitiveCoord[gl_MaxPatchVertices]; -out flat int tcs_dc_primitiveCoord[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_fvarCoord[gl_MaxPatchVertices]; -out flat int tcs_dc_fvarCoord[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_shaderCoord[gl_MaxPatchVertices]; -out flat int tcs_dc_shaderCoord[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_vertexCoord[gl_MaxPatchVertices]; -out flat int tcs_dc_vertexCoord[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_topologyVisibilityCoord[gl_MaxPatchVertices]; -out flat int tcs_dc_topologyVisibilityCoord[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_varyingCoord[gl_MaxPatchVertices]; -out flat int tcs_dc_varyingCoord[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_instanceIndexI0[gl_MaxPatchVertices]; -out flat int tcs_dc_instanceIndexI0[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_instanceCoordsI0[gl_MaxPatchVertices]; -out flat int tcs_dc_instanceCoordsI0[HD_NUM_PATCH_EVAL_VERTS]; // //////// Codegen Accessors //////// mat4 HdGet_transform(int localIndex) { @@ -902,16 +878,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int GetElementID() { @@ -966,16 +942,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc TCS //////// void ProcessPrimvarsOut() { hd_drawingCoord dc = GetDrawingCoord(); - tcs_dc_modelCoord[gl_InvocationID] = dc.modelCoord; - tcs_dc_constantCoord[gl_InvocationID] = dc.constantCoord; - tcs_dc_elementCoord[gl_InvocationID] = dc.elementCoord; - tcs_dc_primitiveCoord[gl_InvocationID] = dc.primitiveCoord; - tcs_dc_fvarCoord[gl_InvocationID] = dc.fvarCoord; - tcs_dc_shaderCoord[gl_InvocationID] = dc.shaderCoord; - tcs_dc_vertexCoord[gl_InvocationID] = dc.vertexCoord; - tcs_dc_topologyVisibilityCoord[gl_InvocationID] = dc.topologyVisibilityCoord; - tcs_dc_varyingCoord[gl_InvocationID] = dc.varyingCoord; - tcs_dc_instanceIndexI0[gl_InvocationID] = dc.instanceIndex[0]; + tcs_interstageDrawingCoord0[gl_InvocationID][0] = dc.modelCoord; + tcs_interstageDrawingCoord0[gl_InvocationID][1] = dc.constantCoord; + tcs_interstageDrawingCoord0[gl_InvocationID][2] = dc.elementCoord; + tcs_interstageDrawingCoord0[gl_InvocationID][3] = dc.primitiveCoord; + tcs_interstageDrawingCoord1[gl_InvocationID][0] = dc.fvarCoord; + tcs_interstageDrawingCoord1[gl_InvocationID][1] = dc.shaderCoord; + tcs_interstageDrawingCoord1[gl_InvocationID][2] = dc.vertexCoord; + tcs_interstageDrawingCoord1[gl_InvocationID][3] = dc.topologyVisibilityCoord; + tcs_interstageDrawingCoord2[gl_InvocationID][0] = dc.varyingCoord; + tcs_interstageDrawingCoord2[gl_InvocationID][1] = dc.instanceIndex[0]; outPrimvars[gl_InvocationID].points = inPrimvars[gl_InvocationID].points; outPrimvars[gl_InvocationID].normals = inPrimvars[gl_InvocationID].normals; } @@ -1360,6 +1336,12 @@ in CurveVertexData { out CurveVertexData { vec4 Peye; } outData; +in flat ivec4 tcs_interstageDrawingCoord0[gl_MaxPatchVertices]; +out flat ivec4 tes_interstageDrawingCoord0; +in flat ivec4 tcs_interstageDrawingCoord1[gl_MaxPatchVertices]; +out flat ivec4 tes_interstageDrawingCoord1; +in flat ivec4 tcs_interstageDrawingCoord2[gl_MaxPatchVertices]; +out flat ivec4 tes_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; @@ -1368,28 +1350,6 @@ out PrimvarData { vec3 points; vec3 normals; } outPrimvars; -in flat int tcs_dc_modelCoord[gl_MaxPatchVertices]; -out flat int tes_dc_modelCoord; -in flat int tcs_dc_constantCoord[gl_MaxPatchVertices]; -out flat int tes_dc_constantCoord; -in flat int tcs_dc_elementCoord[gl_MaxPatchVertices]; -out flat int tes_dc_elementCoord; -in flat int tcs_dc_primitiveCoord[gl_MaxPatchVertices]; -out flat int tes_dc_primitiveCoord; -in flat int tcs_dc_fvarCoord[gl_MaxPatchVertices]; -out flat int tes_dc_fvarCoord; -in flat int tcs_dc_shaderCoord[gl_MaxPatchVertices]; -out flat int tes_dc_shaderCoord; -in flat int tcs_dc_vertexCoord[gl_MaxPatchVertices]; -out flat int tes_dc_vertexCoord; -in flat int tcs_dc_topologyVisibilityCoord[gl_MaxPatchVertices]; -out flat int tes_dc_topologyVisibilityCoord; -in flat int tcs_dc_varyingCoord[gl_MaxPatchVertices]; -out flat int tes_dc_varyingCoord; -in flat int tcs_dc_instanceIndexI0[gl_MaxPatchVertices]; -out flat int tes_dc_instanceIndexI0; -in flat int tcs_dc_instanceCoordsI0[gl_MaxPatchVertices]; -out flat int tes_dc_instanceCoordsI0; // //////// Codegen Accessors //////// mat4 HdGet_transform(int localIndex) { @@ -1433,16 +1393,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = tcs_dc_modelCoord[0]; - dc.constantCoord = tcs_dc_constantCoord[0]; - dc.elementCoord = tcs_dc_elementCoord[0]; - dc.primitiveCoord = tcs_dc_primitiveCoord[0]; - dc.fvarCoord = tcs_dc_fvarCoord[0]; - dc.shaderCoord = tcs_dc_shaderCoord[0]; - dc.vertexCoord = tcs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = tcs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = tcs_dc_varyingCoord[0]; - dc.instanceIndex[0] = tcs_dc_instanceIndexI0[0]; + dc.modelCoord = tcs_interstageDrawingCoord0[0][0]; + dc.constantCoord = tcs_interstageDrawingCoord0[0][1]; + dc.elementCoord = tcs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = tcs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = tcs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = tcs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = tcs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = tcs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = tcs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = tcs_interstageDrawingCoord2[0][1]; return dc; } int GetElementID() { @@ -1501,16 +1461,16 @@ vec3 InterpolatePrimvar(vec3 inPv0, vec3 inPv1, vec3 inPv2, vec3 inPv3, vec4 bas vec4 InterpolatePrimvar(vec4 inPv0, vec4 inPv1, vec4 inPv3, vec4 inPv3, vec4 basis, vec2 uv); void ProcessPrimvarsOut(vec4 basis, int i0, int i1, int i2, int i3, vec2 uv) { hd_drawingCoord dc = GetDrawingCoord(); - tes_dc_modelCoord = dc.modelCoord; - tes_dc_constantCoord = dc.constantCoord; - tes_dc_elementCoord = dc.elementCoord; - tes_dc_primitiveCoord = dc.primitiveCoord; - tes_dc_fvarCoord = dc.fvarCoord; - tes_dc_shaderCoord = dc.shaderCoord; - tes_dc_vertexCoord = dc.vertexCoord; - tes_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - tes_dc_varyingCoord = dc.varyingCoord; - tes_dc_instanceIndexI0 = dc.instanceIndex[0]; + tes_interstageDrawingCoord0[0] = dc.modelCoord; + tes_interstageDrawingCoord0[1] = dc.constantCoord; + tes_interstageDrawingCoord0[2] = dc.elementCoord; + tes_interstageDrawingCoord0[3] = dc.primitiveCoord; + tes_interstageDrawingCoord1[0] = dc.fvarCoord; + tes_interstageDrawingCoord1[1] = dc.shaderCoord; + tes_interstageDrawingCoord1[2] = dc.vertexCoord; + tes_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + tes_interstageDrawingCoord2[0] = dc.varyingCoord; + tes_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = basis[0] * inPrimvars[i0].points + basis[1] * inPrimvars[i1].points + basis[2] * inPrimvars[i2].points + basis[3] * inPrimvars[i3].points; outPrimvars.normals = basis[0] * inPrimvars[i0].normals + basis[1] * inPrimvars[i1].normals + basis[2] * inPrimvars[i2].normals + basis[3] * inPrimvars[i3].normals; } @@ -2126,21 +2086,13 @@ in CurveVertexData { vec4 Peye; } inData; layout (location = 0) out vec4 colorOut; +in flat ivec4 tes_interstageDrawingCoord0; +in flat ivec4 tes_interstageDrawingCoord1; +in flat ivec4 tes_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; } inPrimvars; -in flat int tes_dc_modelCoord; -in flat int tes_dc_constantCoord; -in flat int tes_dc_elementCoord; -in flat int tes_dc_primitiveCoord; -in flat int tes_dc_fvarCoord; -in flat int tes_dc_shaderCoord; -in flat int tes_dc_vertexCoord; -in flat int tes_dc_topologyVisibilityCoord; -in flat int tes_dc_varyingCoord; -in flat int tes_dc_instanceIndexI0; -in flat int tes_dc_instanceCoordsI0; // //////// Codegen Accessors //////// mat4 HdGet_transform(int localIndex) { @@ -2189,16 +2141,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = tes_dc_modelCoord; - dc.constantCoord = tes_dc_constantCoord; - dc.elementCoord = tes_dc_elementCoord; - dc.primitiveCoord = tes_dc_primitiveCoord; - dc.fvarCoord = tes_dc_fvarCoord; - dc.shaderCoord = tes_dc_shaderCoord; - dc.vertexCoord = tes_dc_vertexCoord; - dc.topologyVisibilityCoord = tes_dc_topologyVisibilityCoord; - dc.varyingCoord = tes_dc_varyingCoord; - dc.instanceIndex[0] = tes_dc_instanceIndexI0; + dc.modelCoord = tes_interstageDrawingCoord0[0]; + dc.constantCoord = tes_interstageDrawingCoord0[1]; + dc.elementCoord = tes_interstageDrawingCoord0[2]; + dc.primitiveCoord = tes_interstageDrawingCoord0[3]; + dc.fvarCoord = tes_interstageDrawingCoord1[0]; + dc.shaderCoord = tes_interstageDrawingCoord1[1]; + dc.vertexCoord = tes_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = tes_interstageDrawingCoord1[3]; + dc.varyingCoord = tes_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = tes_interstageDrawingCoord2[1]; return dc; } int GetElementID() { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_curves_indirect.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_curves_indirect.out index 1379eaaab9..e3ec0a77c9 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_curves_indirect.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_curves_indirect.out @@ -164,22 +164,14 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceCoordsI0; layout(location = 0) uniform ConstantData10 *constantPrimvars; layout(location = 1) uniform float *faceVisibility; out CurveVertexData { @@ -255,16 +247,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -829,6 +821,12 @@ in CurveVertexData { out CurveVertexData { vec4 Peye; } outData[HD_NUM_PATCH_EVAL_VERTS]; +in flat ivec4 vs_interstageDrawingCoord0[gl_MaxPatchVertices]; +out flat ivec4 tcs_interstageDrawingCoord0[HD_NUM_PATCH_EVAL_VERTS]; +in flat ivec4 vs_interstageDrawingCoord1[gl_MaxPatchVertices]; +out flat ivec4 tcs_interstageDrawingCoord1[HD_NUM_PATCH_EVAL_VERTS]; +in flat ivec4 vs_interstageDrawingCoord2[gl_MaxPatchVertices]; +out flat ivec4 tcs_interstageDrawingCoord2[HD_NUM_PATCH_EVAL_VERTS]; in PrimvarData { vec3 points; vec3 normals; @@ -837,28 +835,6 @@ out PrimvarData { vec3 points; vec3 normals; } outPrimvars[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_modelCoord[gl_MaxPatchVertices]; -out flat int tcs_dc_modelCoord[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_constantCoord[gl_MaxPatchVertices]; -out flat int tcs_dc_constantCoord[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_elementCoord[gl_MaxPatchVertices]; -out flat int tcs_dc_elementCoord[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_primitiveCoord[gl_MaxPatchVertices]; -out flat int tcs_dc_primitiveCoord[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_fvarCoord[gl_MaxPatchVertices]; -out flat int tcs_dc_fvarCoord[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_shaderCoord[gl_MaxPatchVertices]; -out flat int tcs_dc_shaderCoord[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_vertexCoord[gl_MaxPatchVertices]; -out flat int tcs_dc_vertexCoord[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_topologyVisibilityCoord[gl_MaxPatchVertices]; -out flat int tcs_dc_topologyVisibilityCoord[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_varyingCoord[gl_MaxPatchVertices]; -out flat int tcs_dc_varyingCoord[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_instanceIndexI0[gl_MaxPatchVertices]; -out flat int tcs_dc_instanceIndexI0[HD_NUM_PATCH_EVAL_VERTS]; -in flat int vs_dc_instanceCoordsI0[gl_MaxPatchVertices]; -out flat int tcs_dc_instanceCoordsI0[HD_NUM_PATCH_EVAL_VERTS]; // //////// Codegen Accessors //////// mat4 HdGet_transform(int localIndex) { @@ -902,16 +878,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int GetElementID() { @@ -966,16 +942,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc TCS //////// void ProcessPrimvarsOut() { hd_drawingCoord dc = GetDrawingCoord(); - tcs_dc_modelCoord[gl_InvocationID] = dc.modelCoord; - tcs_dc_constantCoord[gl_InvocationID] = dc.constantCoord; - tcs_dc_elementCoord[gl_InvocationID] = dc.elementCoord; - tcs_dc_primitiveCoord[gl_InvocationID] = dc.primitiveCoord; - tcs_dc_fvarCoord[gl_InvocationID] = dc.fvarCoord; - tcs_dc_shaderCoord[gl_InvocationID] = dc.shaderCoord; - tcs_dc_vertexCoord[gl_InvocationID] = dc.vertexCoord; - tcs_dc_topologyVisibilityCoord[gl_InvocationID] = dc.topologyVisibilityCoord; - tcs_dc_varyingCoord[gl_InvocationID] = dc.varyingCoord; - tcs_dc_instanceIndexI0[gl_InvocationID] = dc.instanceIndex[0]; + tcs_interstageDrawingCoord0[gl_InvocationID][0] = dc.modelCoord; + tcs_interstageDrawingCoord0[gl_InvocationID][1] = dc.constantCoord; + tcs_interstageDrawingCoord0[gl_InvocationID][2] = dc.elementCoord; + tcs_interstageDrawingCoord0[gl_InvocationID][3] = dc.primitiveCoord; + tcs_interstageDrawingCoord1[gl_InvocationID][0] = dc.fvarCoord; + tcs_interstageDrawingCoord1[gl_InvocationID][1] = dc.shaderCoord; + tcs_interstageDrawingCoord1[gl_InvocationID][2] = dc.vertexCoord; + tcs_interstageDrawingCoord1[gl_InvocationID][3] = dc.topologyVisibilityCoord; + tcs_interstageDrawingCoord2[gl_InvocationID][0] = dc.varyingCoord; + tcs_interstageDrawingCoord2[gl_InvocationID][1] = dc.instanceIndex[0]; outPrimvars[gl_InvocationID].points = inPrimvars[gl_InvocationID].points; outPrimvars[gl_InvocationID].normals = inPrimvars[gl_InvocationID].normals; } @@ -1360,6 +1336,12 @@ in CurveVertexData { out CurveVertexData { vec4 Peye; } outData; +in flat ivec4 tcs_interstageDrawingCoord0[gl_MaxPatchVertices]; +out flat ivec4 tes_interstageDrawingCoord0; +in flat ivec4 tcs_interstageDrawingCoord1[gl_MaxPatchVertices]; +out flat ivec4 tes_interstageDrawingCoord1; +in flat ivec4 tcs_interstageDrawingCoord2[gl_MaxPatchVertices]; +out flat ivec4 tes_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; @@ -1368,28 +1350,6 @@ out PrimvarData { vec3 points; vec3 normals; } outPrimvars; -in flat int tcs_dc_modelCoord[gl_MaxPatchVertices]; -out flat int tes_dc_modelCoord; -in flat int tcs_dc_constantCoord[gl_MaxPatchVertices]; -out flat int tes_dc_constantCoord; -in flat int tcs_dc_elementCoord[gl_MaxPatchVertices]; -out flat int tes_dc_elementCoord; -in flat int tcs_dc_primitiveCoord[gl_MaxPatchVertices]; -out flat int tes_dc_primitiveCoord; -in flat int tcs_dc_fvarCoord[gl_MaxPatchVertices]; -out flat int tes_dc_fvarCoord; -in flat int tcs_dc_shaderCoord[gl_MaxPatchVertices]; -out flat int tes_dc_shaderCoord; -in flat int tcs_dc_vertexCoord[gl_MaxPatchVertices]; -out flat int tes_dc_vertexCoord; -in flat int tcs_dc_topologyVisibilityCoord[gl_MaxPatchVertices]; -out flat int tes_dc_topologyVisibilityCoord; -in flat int tcs_dc_varyingCoord[gl_MaxPatchVertices]; -out flat int tes_dc_varyingCoord; -in flat int tcs_dc_instanceIndexI0[gl_MaxPatchVertices]; -out flat int tes_dc_instanceIndexI0; -in flat int tcs_dc_instanceCoordsI0[gl_MaxPatchVertices]; -out flat int tes_dc_instanceCoordsI0; // //////// Codegen Accessors //////// mat4 HdGet_transform(int localIndex) { @@ -1433,16 +1393,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = tcs_dc_modelCoord[0]; - dc.constantCoord = tcs_dc_constantCoord[0]; - dc.elementCoord = tcs_dc_elementCoord[0]; - dc.primitiveCoord = tcs_dc_primitiveCoord[0]; - dc.fvarCoord = tcs_dc_fvarCoord[0]; - dc.shaderCoord = tcs_dc_shaderCoord[0]; - dc.vertexCoord = tcs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = tcs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = tcs_dc_varyingCoord[0]; - dc.instanceIndex[0] = tcs_dc_instanceIndexI0[0]; + dc.modelCoord = tcs_interstageDrawingCoord0[0][0]; + dc.constantCoord = tcs_interstageDrawingCoord0[0][1]; + dc.elementCoord = tcs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = tcs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = tcs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = tcs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = tcs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = tcs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = tcs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = tcs_interstageDrawingCoord2[0][1]; return dc; } int GetElementID() { @@ -1501,16 +1461,16 @@ vec3 InterpolatePrimvar(vec3 inPv0, vec3 inPv1, vec3 inPv2, vec3 inPv3, vec4 bas vec4 InterpolatePrimvar(vec4 inPv0, vec4 inPv1, vec4 inPv3, vec4 inPv3, vec4 basis, vec2 uv); void ProcessPrimvarsOut(vec4 basis, int i0, int i1, int i2, int i3, vec2 uv) { hd_drawingCoord dc = GetDrawingCoord(); - tes_dc_modelCoord = dc.modelCoord; - tes_dc_constantCoord = dc.constantCoord; - tes_dc_elementCoord = dc.elementCoord; - tes_dc_primitiveCoord = dc.primitiveCoord; - tes_dc_fvarCoord = dc.fvarCoord; - tes_dc_shaderCoord = dc.shaderCoord; - tes_dc_vertexCoord = dc.vertexCoord; - tes_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - tes_dc_varyingCoord = dc.varyingCoord; - tes_dc_instanceIndexI0 = dc.instanceIndex[0]; + tes_interstageDrawingCoord0[0] = dc.modelCoord; + tes_interstageDrawingCoord0[1] = dc.constantCoord; + tes_interstageDrawingCoord0[2] = dc.elementCoord; + tes_interstageDrawingCoord0[3] = dc.primitiveCoord; + tes_interstageDrawingCoord1[0] = dc.fvarCoord; + tes_interstageDrawingCoord1[1] = dc.shaderCoord; + tes_interstageDrawingCoord1[2] = dc.vertexCoord; + tes_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + tes_interstageDrawingCoord2[0] = dc.varyingCoord; + tes_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = basis[0] * inPrimvars[i0].points + basis[1] * inPrimvars[i1].points + basis[2] * inPrimvars[i2].points + basis[3] * inPrimvars[i3].points; outPrimvars.normals = basis[0] * inPrimvars[i0].normals + basis[1] * inPrimvars[i1].normals + basis[2] * inPrimvars[i2].normals + basis[3] * inPrimvars[i3].normals; } @@ -2126,21 +2086,13 @@ in CurveVertexData { vec4 Peye; } inData; layout (location = 0) out vec4 colorOut; +in flat ivec4 tes_interstageDrawingCoord0; +in flat ivec4 tes_interstageDrawingCoord1; +in flat ivec4 tes_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; } inPrimvars; -in flat int tes_dc_modelCoord; -in flat int tes_dc_constantCoord; -in flat int tes_dc_elementCoord; -in flat int tes_dc_primitiveCoord; -in flat int tes_dc_fvarCoord; -in flat int tes_dc_shaderCoord; -in flat int tes_dc_vertexCoord; -in flat int tes_dc_topologyVisibilityCoord; -in flat int tes_dc_varyingCoord; -in flat int tes_dc_instanceIndexI0; -in flat int tes_dc_instanceCoordsI0; // //////// Codegen Accessors //////// mat4 HdGet_transform(int localIndex) { @@ -2189,16 +2141,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = tes_dc_modelCoord; - dc.constantCoord = tes_dc_constantCoord; - dc.elementCoord = tes_dc_elementCoord; - dc.primitiveCoord = tes_dc_primitiveCoord; - dc.fvarCoord = tes_dc_fvarCoord; - dc.shaderCoord = tes_dc_shaderCoord; - dc.vertexCoord = tes_dc_vertexCoord; - dc.topologyVisibilityCoord = tes_dc_topologyVisibilityCoord; - dc.varyingCoord = tes_dc_varyingCoord; - dc.instanceIndex[0] = tes_dc_instanceIndexI0; + dc.modelCoord = tes_interstageDrawingCoord0[0]; + dc.constantCoord = tes_interstageDrawingCoord0[1]; + dc.elementCoord = tes_interstageDrawingCoord0[2]; + dc.primitiveCoord = tes_interstageDrawingCoord0[3]; + dc.fvarCoord = tes_interstageDrawingCoord1[0]; + dc.shaderCoord = tes_interstageDrawingCoord1[1]; + dc.vertexCoord = tes_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = tes_interstageDrawingCoord1[3]; + dc.varyingCoord = tes_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = tes_interstageDrawingCoord2[1]; return dc; } int GetElementID() { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect.out index 59998b24c6..7ee8a125f8 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect.out @@ -162,22 +162,14 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceCoordsI0; layout(location = 0) uniform ConstantData10 *constantPrimvars; layout(location = 1) uniform int *primitiveParam; layout(location = 2) uniform int *edgeIndices; @@ -256,16 +248,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -851,6 +843,12 @@ out VertexData { } outData; out vec4 gsPatchCoord; out noperspective vec3 hd_barycentricCoord; +in flat ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; @@ -860,28 +858,6 @@ out PrimvarData { vec3 normals; vec2 dispTextureCoord; } outPrimvars; -in flat int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_modelCoord; -in flat int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_constantCoord; -in flat int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_elementCoord; -in flat int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_fvarCoord; -in flat int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_shaderCoord; -in flat int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI0; -in flat int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; // //////// Codegen Accessors //////// @@ -926,16 +902,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -1028,16 +1004,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -1662,22 +1638,14 @@ in VertexData { } inData; layout (location = 0) out vec4 colorOut; in noperspective vec3 hd_barycentricCoord; +in flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; } inPrimvars; -in flat int gs_dc_modelCoord; -in flat int gs_dc_constantCoord; -in flat int gs_dc_elementCoord; -in flat int gs_dc_primitiveCoord; -in flat int gs_dc_fvarCoord; -in flat int gs_dc_shaderCoord; -in flat int gs_dc_vertexCoord; -in flat int gs_dc_topologyVisibilityCoord; -in flat int gs_dc_varyingCoord; -in flat int gs_dc_instanceIndexI0; -in flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) { @@ -1736,16 +1704,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -2838,22 +2806,14 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceCoordsI0; layout(location = 0) uniform ConstantData10 *constantPrimvars; layout(location = 1) uniform int *primitiveParam; layout(location = 2) uniform ivec2 *edgeIndices; @@ -2932,16 +2892,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -3527,6 +3487,12 @@ out VertexData { } outData; out vec4 gsPatchCoord; out noperspective vec3 hd_barycentricCoord; +in flat ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; @@ -3536,28 +3502,6 @@ out PrimvarData { vec3 normals; vec2 dispTextureCoord; } outPrimvars; -in flat int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_modelCoord; -in flat int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_constantCoord; -in flat int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_elementCoord; -in flat int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_fvarCoord; -in flat int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_shaderCoord; -in flat int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI0; -in flat int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; // //////// Codegen Accessors //////// @@ -3602,16 +3546,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -3704,16 +3648,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -4367,22 +4311,14 @@ in VertexData { } inData; layout (location = 0) out vec4 colorOut; in noperspective vec3 hd_barycentricCoord; +in flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; } inPrimvars; -in flat int gs_dc_modelCoord; -in flat int gs_dc_constantCoord; -in flat int gs_dc_elementCoord; -in flat int gs_dc_primitiveCoord; -in flat int gs_dc_fvarCoord; -in flat int gs_dc_shaderCoord; -in flat int gs_dc_vertexCoord; -in flat int gs_dc_topologyVisibilityCoord; -in flat int gs_dc_varyingCoord; -in flat int gs_dc_instanceIndexI0; -in flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) { @@ -4441,16 +4377,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_doubleSided.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_doubleSided.out index d0d438b400..5776e78e69 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_doubleSided.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_doubleSided.out @@ -162,22 +162,14 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceCoordsI0; layout(location = 0) uniform ConstantData10 *constantPrimvars; layout(location = 1) uniform int *primitiveParam; layout(location = 2) uniform int *edgeIndices; @@ -256,16 +248,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -851,6 +843,12 @@ out VertexData { } outData; out vec4 gsPatchCoord; out noperspective vec3 hd_barycentricCoord; +in flat ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; @@ -860,28 +858,6 @@ out PrimvarData { vec3 normals; vec2 dispTextureCoord; } outPrimvars; -in flat int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_modelCoord; -in flat int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_constantCoord; -in flat int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_elementCoord; -in flat int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_fvarCoord; -in flat int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_shaderCoord; -in flat int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI0; -in flat int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; // //////// Codegen Accessors //////// @@ -926,16 +902,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -1028,16 +1004,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -1662,22 +1638,14 @@ in VertexData { } inData; layout (location = 0) out vec4 colorOut; in noperspective vec3 hd_barycentricCoord; +in flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; } inPrimvars; -in flat int gs_dc_modelCoord; -in flat int gs_dc_constantCoord; -in flat int gs_dc_elementCoord; -in flat int gs_dc_primitiveCoord; -in flat int gs_dc_fvarCoord; -in flat int gs_dc_shaderCoord; -in flat int gs_dc_vertexCoord; -in flat int gs_dc_topologyVisibilityCoord; -in flat int gs_dc_varyingCoord; -in flat int gs_dc_instanceIndexI0; -in flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) { @@ -1736,16 +1704,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -2837,22 +2805,14 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceCoordsI0; layout(location = 0) uniform ConstantData10 *constantPrimvars; layout(location = 1) uniform int *primitiveParam; layout(location = 2) uniform ivec2 *edgeIndices; @@ -2931,16 +2891,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -3526,6 +3486,12 @@ out VertexData { } outData; out vec4 gsPatchCoord; out noperspective vec3 hd_barycentricCoord; +in flat ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; @@ -3535,28 +3501,6 @@ out PrimvarData { vec3 normals; vec2 dispTextureCoord; } outPrimvars; -in flat int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_modelCoord; -in flat int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_constantCoord; -in flat int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_elementCoord; -in flat int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_fvarCoord; -in flat int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_shaderCoord; -in flat int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI0; -in flat int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; // //////// Codegen Accessors //////// @@ -3601,16 +3545,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -3703,16 +3647,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -4366,22 +4310,14 @@ in VertexData { } inData; layout (location = 0) out vec4 colorOut; in noperspective vec3 hd_barycentricCoord; +in flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; } inPrimvars; -in flat int gs_dc_modelCoord; -in flat int gs_dc_constantCoord; -in flat int gs_dc_elementCoord; -in flat int gs_dc_primitiveCoord; -in flat int gs_dc_fvarCoord; -in flat int gs_dc_shaderCoord; -in flat int gs_dc_vertexCoord; -in flat int gs_dc_topologyVisibilityCoord; -in flat int gs_dc_varyingCoord; -in flat int gs_dc_instanceIndexI0; -in flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) { @@ -4440,16 +4376,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_faceVarying.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_faceVarying.out index 59998b24c6..7ee8a125f8 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_faceVarying.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_faceVarying.out @@ -162,22 +162,14 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceCoordsI0; layout(location = 0) uniform ConstantData10 *constantPrimvars; layout(location = 1) uniform int *primitiveParam; layout(location = 2) uniform int *edgeIndices; @@ -256,16 +248,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -851,6 +843,12 @@ out VertexData { } outData; out vec4 gsPatchCoord; out noperspective vec3 hd_barycentricCoord; +in flat ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; @@ -860,28 +858,6 @@ out PrimvarData { vec3 normals; vec2 dispTextureCoord; } outPrimvars; -in flat int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_modelCoord; -in flat int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_constantCoord; -in flat int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_elementCoord; -in flat int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_fvarCoord; -in flat int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_shaderCoord; -in flat int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI0; -in flat int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; // //////// Codegen Accessors //////// @@ -926,16 +902,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -1028,16 +1004,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -1662,22 +1638,14 @@ in VertexData { } inData; layout (location = 0) out vec4 colorOut; in noperspective vec3 hd_barycentricCoord; +in flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; } inPrimvars; -in flat int gs_dc_modelCoord; -in flat int gs_dc_constantCoord; -in flat int gs_dc_elementCoord; -in flat int gs_dc_primitiveCoord; -in flat int gs_dc_fvarCoord; -in flat int gs_dc_shaderCoord; -in flat int gs_dc_vertexCoord; -in flat int gs_dc_topologyVisibilityCoord; -in flat int gs_dc_varyingCoord; -in flat int gs_dc_instanceIndexI0; -in flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) { @@ -1736,16 +1704,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -2838,22 +2806,14 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceCoordsI0; layout(location = 0) uniform ConstantData10 *constantPrimvars; layout(location = 1) uniform int *primitiveParam; layout(location = 2) uniform ivec2 *edgeIndices; @@ -2932,16 +2892,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -3527,6 +3487,12 @@ out VertexData { } outData; out vec4 gsPatchCoord; out noperspective vec3 hd_barycentricCoord; +in flat ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; @@ -3536,28 +3502,6 @@ out PrimvarData { vec3 normals; vec2 dispTextureCoord; } outPrimvars; -in flat int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_modelCoord; -in flat int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_constantCoord; -in flat int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_elementCoord; -in flat int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_fvarCoord; -in flat int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_shaderCoord; -in flat int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI0; -in flat int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; // //////// Codegen Accessors //////// @@ -3602,16 +3546,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -3704,16 +3648,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -4367,22 +4311,14 @@ in VertexData { } inData; layout (location = 0) out vec4 colorOut; in noperspective vec3 hd_barycentricCoord; +in flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; } inPrimvars; -in flat int gs_dc_modelCoord; -in flat int gs_dc_constantCoord; -in flat int gs_dc_elementCoord; -in flat int gs_dc_primitiveCoord; -in flat int gs_dc_fvarCoord; -in flat int gs_dc_shaderCoord; -in flat int gs_dc_vertexCoord; -in flat int gs_dc_topologyVisibilityCoord; -in flat int gs_dc_varyingCoord; -in flat int gs_dc_instanceIndexI0; -in flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) { @@ -4441,16 +4377,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_instance.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_instance.out index 63f827af51..9960bc8fe8 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_instance.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_instance.out @@ -164,25 +164,16 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; +out flat ivec4 vs_interstageDrawingCoord3; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 5) in int drawingCoordI0; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceIndexI1; -out flat int vs_dc_instanceCoordsI0; -out flat int vs_dc_instanceCoordsI1; layout(location = 6) uniform int *instanceIndices; layout(location = 7) uniform int *culledInstanceIndices; layout(location = 0) uniform ConstantData10 *constantPrimvars; @@ -305,18 +296,18 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; - vs_dc_instanceIndexI1 = dc.instanceIndex[1]; - vs_dc_instanceCoordsI0 = dc.instanceCoords[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; + vs_interstageDrawingCoord2[2] = dc.instanceIndex[1]; + vs_interstageDrawingCoord2[3] = dc.instanceCoords[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -907,6 +898,14 @@ out VertexData { } outData; out vec4 gsPatchCoord; out noperspective vec3 hd_barycentricCoord; +in flat ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord2; +in flat ivec4 vs_interstageDrawingCoord3[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord3; in PrimvarData { vec3 points; vec3 normals; @@ -916,32 +915,6 @@ out PrimvarData { vec3 normals; vec2 dispTextureCoord; } outPrimvars; -in flat int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_modelCoord; -in flat int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_constantCoord; -in flat int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_elementCoord; -in flat int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_fvarCoord; -in flat int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_shaderCoord; -in flat int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI0; -in flat int vs_dc_instanceIndexI1[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI1; -in flat int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI0; -in flat int vs_dc_instanceCoordsI1[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI1; layout(location = 5) uniform vec2 *dispTextureCoord; // //////// Codegen Accessors //////// @@ -1004,18 +977,18 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; - dc.instanceIndex[1] = vs_dc_instanceIndexI1[0]; - dc.instanceCoords[0] = vs_dc_instanceCoordsI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; + dc.instanceIndex[1] = vs_interstageDrawingCoord2[0][2]; + dc.instanceCoords[0] = vs_interstageDrawingCoord2[0][3]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -1108,18 +1081,18 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; - gs_dc_instanceIndexI1 = dc.instanceIndex[1]; - gs_dc_instanceCoordsI0 = dc.instanceCoords[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; + gs_interstageDrawingCoord2[2] = dc.instanceIndex[1]; + gs_interstageDrawingCoord2[3] = dc.instanceCoords[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -1749,24 +1722,15 @@ in VertexData { } inData; layout (location = 0) out vec4 colorOut; in noperspective vec3 hd_barycentricCoord; +in flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 gs_interstageDrawingCoord2; +in flat ivec4 gs_interstageDrawingCoord3; in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; } inPrimvars; -in flat int gs_dc_modelCoord; -in flat int gs_dc_constantCoord; -in flat int gs_dc_elementCoord; -in flat int gs_dc_primitiveCoord; -in flat int gs_dc_fvarCoord; -in flat int gs_dc_shaderCoord; -in flat int gs_dc_vertexCoord; -in flat int gs_dc_topologyVisibilityCoord; -in flat int gs_dc_varyingCoord; -in flat int gs_dc_instanceIndexI0; -in flat int gs_dc_instanceIndexI1; -in flat int gs_dc_instanceCoordsI0; -in flat int gs_dc_instanceCoordsI1; layout(location = 5) uniform vec2 *dispTextureCoord; vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) { @@ -1843,18 +1807,18 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; - dc.instanceIndex[1] = gs_dc_instanceIndexI1; - dc.instanceCoords[0] = gs_dc_instanceCoordsI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; + dc.instanceIndex[1] = gs_interstageDrawingCoord2[2]; + dc.instanceCoords[0] = gs_interstageDrawingCoord2[3]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -2949,25 +2913,16 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; +out flat ivec4 vs_interstageDrawingCoord3; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 5) in int drawingCoordI0; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceIndexI1; -out flat int vs_dc_instanceCoordsI0; -out flat int vs_dc_instanceCoordsI1; layout(location = 6) uniform int *instanceIndices; layout(location = 7) uniform int *culledInstanceIndices; layout(location = 0) uniform ConstantData10 *constantPrimvars; @@ -3090,18 +3045,18 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; - vs_dc_instanceIndexI1 = dc.instanceIndex[1]; - vs_dc_instanceCoordsI0 = dc.instanceCoords[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; + vs_interstageDrawingCoord2[2] = dc.instanceIndex[1]; + vs_interstageDrawingCoord2[3] = dc.instanceCoords[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -3692,6 +3647,14 @@ out VertexData { } outData; out vec4 gsPatchCoord; out noperspective vec3 hd_barycentricCoord; +in flat ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord2; +in flat ivec4 vs_interstageDrawingCoord3[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord3; in PrimvarData { vec3 points; vec3 normals; @@ -3701,32 +3664,6 @@ out PrimvarData { vec3 normals; vec2 dispTextureCoord; } outPrimvars; -in flat int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_modelCoord; -in flat int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_constantCoord; -in flat int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_elementCoord; -in flat int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_fvarCoord; -in flat int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_shaderCoord; -in flat int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI0; -in flat int vs_dc_instanceIndexI1[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI1; -in flat int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI0; -in flat int vs_dc_instanceCoordsI1[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI1; layout(location = 5) uniform vec2 *dispTextureCoord; // //////// Codegen Accessors //////// @@ -3789,18 +3726,18 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; - dc.instanceIndex[1] = vs_dc_instanceIndexI1[0]; - dc.instanceCoords[0] = vs_dc_instanceCoordsI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; + dc.instanceIndex[1] = vs_interstageDrawingCoord2[0][2]; + dc.instanceCoords[0] = vs_interstageDrawingCoord2[0][3]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -3893,18 +3830,18 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; - gs_dc_instanceIndexI1 = dc.instanceIndex[1]; - gs_dc_instanceCoordsI0 = dc.instanceCoords[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; + gs_interstageDrawingCoord2[2] = dc.instanceIndex[1]; + gs_interstageDrawingCoord2[3] = dc.instanceCoords[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -4563,24 +4500,15 @@ in VertexData { } inData; layout (location = 0) out vec4 colorOut; in noperspective vec3 hd_barycentricCoord; +in flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 gs_interstageDrawingCoord2; +in flat ivec4 gs_interstageDrawingCoord3; in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; } inPrimvars; -in flat int gs_dc_modelCoord; -in flat int gs_dc_constantCoord; -in flat int gs_dc_elementCoord; -in flat int gs_dc_primitiveCoord; -in flat int gs_dc_fvarCoord; -in flat int gs_dc_shaderCoord; -in flat int gs_dc_vertexCoord; -in flat int gs_dc_topologyVisibilityCoord; -in flat int gs_dc_varyingCoord; -in flat int gs_dc_instanceIndexI0; -in flat int gs_dc_instanceIndexI1; -in flat int gs_dc_instanceCoordsI0; -in flat int gs_dc_instanceCoordsI1; layout(location = 5) uniform vec2 *dispTextureCoord; vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) { @@ -4657,18 +4585,18 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; - dc.instanceIndex[1] = gs_dc_instanceIndexI1; - dc.instanceCoords[0] = gs_dc_instanceCoordsI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; + dc.instanceIndex[1] = gs_interstageDrawingCoord2[2]; + dc.instanceCoords[0] = gs_interstageDrawingCoord2[3]; return dc; } int HdGet_primitiveParam(int localIndex) { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_smoothNormals.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_smoothNormals.out index d546ea62b4..3b23416cb3 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_smoothNormals.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_smoothNormals.out @@ -162,22 +162,14 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 0) in vec3 points; layout (location = 1) in vec3 smoothNormals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceCoordsI0; layout(location = 0) uniform ConstantData10 *constantPrimvars; layout(location = 1) uniform int *primitiveParam; layout(location = 2) uniform int *edgeIndices; @@ -256,16 +248,16 @@ float HdGetScalar_smoothNormals() { return HdGet_smoothNormals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.smoothNormals = smoothNormals; } @@ -864,6 +856,12 @@ out VertexData { } outData; out vec4 gsPatchCoord; out noperspective vec3 hd_barycentricCoord; +in flat ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 smoothNormals; @@ -873,28 +871,6 @@ out PrimvarData { vec3 smoothNormals; vec2 dispTextureCoord; } outPrimvars; -in flat int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_modelCoord; -in flat int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_constantCoord; -in flat int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_elementCoord; -in flat int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_fvarCoord; -in flat int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_shaderCoord; -in flat int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI0; -in flat int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; // //////// Codegen Accessors //////// @@ -939,16 +915,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -1041,16 +1017,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.smoothNormals = inPrimvars[index].smoothNormals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -1662,22 +1638,14 @@ in VertexData { } inData; layout (location = 0) out vec4 colorOut; in noperspective vec3 hd_barycentricCoord; +in flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 smoothNormals; vec2 dispTextureCoord; } inPrimvars; -in flat int gs_dc_modelCoord; -in flat int gs_dc_constantCoord; -in flat int gs_dc_elementCoord; -in flat int gs_dc_primitiveCoord; -in flat int gs_dc_fvarCoord; -in flat int gs_dc_shaderCoord; -in flat int gs_dc_vertexCoord; -in flat int gs_dc_topologyVisibilityCoord; -in flat int gs_dc_varyingCoord; -in flat int gs_dc_instanceIndexI0; -in flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) { @@ -1736,16 +1704,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -2838,22 +2806,14 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 0) in vec3 points; layout (location = 1) in vec3 smoothNormals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceCoordsI0; layout(location = 0) uniform ConstantData10 *constantPrimvars; layout(location = 1) uniform int *primitiveParam; layout(location = 2) uniform ivec2 *edgeIndices; @@ -2932,16 +2892,16 @@ float HdGetScalar_smoothNormals() { return HdGet_smoothNormals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.smoothNormals = smoothNormals; } @@ -3540,6 +3500,12 @@ out VertexData { } outData; out vec4 gsPatchCoord; out noperspective vec3 hd_barycentricCoord; +in flat ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 smoothNormals; @@ -3549,28 +3515,6 @@ out PrimvarData { vec3 smoothNormals; vec2 dispTextureCoord; } outPrimvars; -in flat int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_modelCoord; -in flat int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_constantCoord; -in flat int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_elementCoord; -in flat int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_fvarCoord; -in flat int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_shaderCoord; -in flat int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI0; -in flat int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; // //////// Codegen Accessors //////// @@ -3615,16 +3559,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -3717,16 +3661,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.smoothNormals = inPrimvars[index].smoothNormals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -4367,22 +4311,14 @@ in VertexData { } inData; layout (location = 0) out vec4 colorOut; in noperspective vec3 hd_barycentricCoord; +in flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 smoothNormals; vec2 dispTextureCoord; } inPrimvars; -in flat int gs_dc_modelCoord; -in flat int gs_dc_constantCoord; -in flat int gs_dc_elementCoord; -in flat int gs_dc_primitiveCoord; -in flat int gs_dc_fvarCoord; -in flat int gs_dc_shaderCoord; -in flat int gs_dc_vertexCoord; -in flat int gs_dc_topologyVisibilityCoord; -in flat int gs_dc_varyingCoord; -in flat int gs_dc_instanceIndexI0; -in flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) { @@ -4441,16 +4377,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_edgeonly.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_edgeonly.out index cb6007195a..294b7071e9 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_edgeonly.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_edgeonly.out @@ -162,22 +162,14 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceCoordsI0; layout(location = 0) uniform ConstantData10 *constantPrimvars; layout(location = 1) uniform int *primitiveParam; layout(location = 2) uniform int *edgeIndices; @@ -256,16 +248,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -851,6 +843,12 @@ out VertexData { } outData; out vec4 gsPatchCoord; out noperspective vec3 hd_barycentricCoord; +in flat ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; @@ -860,28 +858,6 @@ out PrimvarData { vec3 normals; vec2 dispTextureCoord; } outPrimvars; -in flat int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_modelCoord; -in flat int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_constantCoord; -in flat int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_elementCoord; -in flat int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_fvarCoord; -in flat int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_shaderCoord; -in flat int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI0; -in flat int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; // //////// Codegen Accessors //////// @@ -926,16 +902,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -1028,16 +1004,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -1662,22 +1638,14 @@ in VertexData { } inData; layout (location = 0) out vec4 colorOut; in noperspective vec3 hd_barycentricCoord; +in flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; } inPrimvars; -in flat int gs_dc_modelCoord; -in flat int gs_dc_constantCoord; -in flat int gs_dc_elementCoord; -in flat int gs_dc_primitiveCoord; -in flat int gs_dc_fvarCoord; -in flat int gs_dc_shaderCoord; -in flat int gs_dc_vertexCoord; -in flat int gs_dc_topologyVisibilityCoord; -in flat int gs_dc_varyingCoord; -in flat int gs_dc_instanceIndexI0; -in flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) { @@ -1736,16 +1704,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -2887,22 +2855,14 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceCoordsI0; layout(location = 0) uniform ConstantData10 *constantPrimvars; layout(location = 1) uniform int *primitiveParam; layout(location = 2) uniform ivec2 *edgeIndices; @@ -2981,16 +2941,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -3576,6 +3536,12 @@ out VertexData { } outData; out vec4 gsPatchCoord; out noperspective vec3 hd_barycentricCoord; +in flat ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; @@ -3585,28 +3551,6 @@ out PrimvarData { vec3 normals; vec2 dispTextureCoord; } outPrimvars; -in flat int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_modelCoord; -in flat int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_constantCoord; -in flat int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_elementCoord; -in flat int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_fvarCoord; -in flat int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_shaderCoord; -in flat int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI0; -in flat int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; // //////// Codegen Accessors //////// @@ -3651,16 +3595,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -3753,16 +3697,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -4416,22 +4360,14 @@ in VertexData { } inData; layout (location = 0) out vec4 colorOut; in noperspective vec3 hd_barycentricCoord; +in flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; } inPrimvars; -in flat int gs_dc_modelCoord; -in flat int gs_dc_constantCoord; -in flat int gs_dc_elementCoord; -in flat int gs_dc_primitiveCoord; -in flat int gs_dc_fvarCoord; -in flat int gs_dc_shaderCoord; -in flat int gs_dc_vertexCoord; -in flat int gs_dc_topologyVisibilityCoord; -in flat int gs_dc_varyingCoord; -in flat int gs_dc_instanceIndexI0; -in flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) { @@ -4490,16 +4426,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_edgeonly_blendwireframe.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_edgeonly_blendwireframe.out index ac23cf5bda..d962cc16e9 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_edgeonly_blendwireframe.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_edgeonly_blendwireframe.out @@ -162,22 +162,14 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceCoordsI0; layout(location = 0) uniform ConstantData10 *constantPrimvars; layout(location = 1) uniform int *primitiveParam; layout(location = 2) uniform int *edgeIndices; @@ -256,16 +248,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -851,6 +843,12 @@ out VertexData { } outData; out vec4 gsPatchCoord; out noperspective vec3 hd_barycentricCoord; +in flat ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; @@ -860,28 +858,6 @@ out PrimvarData { vec3 normals; vec2 dispTextureCoord; } outPrimvars; -in flat int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_modelCoord; -in flat int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_constantCoord; -in flat int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_elementCoord; -in flat int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_fvarCoord; -in flat int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_shaderCoord; -in flat int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI0; -in flat int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; // //////// Codegen Accessors //////// @@ -926,16 +902,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -1028,16 +1004,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -1662,22 +1638,14 @@ in VertexData { } inData; layout (location = 0) out vec4 colorOut; in noperspective vec3 hd_barycentricCoord; +in flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; } inPrimvars; -in flat int gs_dc_modelCoord; -in flat int gs_dc_constantCoord; -in flat int gs_dc_elementCoord; -in flat int gs_dc_primitiveCoord; -in flat int gs_dc_fvarCoord; -in flat int gs_dc_shaderCoord; -in flat int gs_dc_vertexCoord; -in flat int gs_dc_topologyVisibilityCoord; -in flat int gs_dc_varyingCoord; -in flat int gs_dc_instanceIndexI0; -in flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) { @@ -1736,16 +1704,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -2893,22 +2861,14 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceCoordsI0; layout(location = 0) uniform ConstantData10 *constantPrimvars; layout(location = 1) uniform int *primitiveParam; layout(location = 2) uniform ivec2 *edgeIndices; @@ -2987,16 +2947,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -3582,6 +3542,12 @@ out VertexData { } outData; out vec4 gsPatchCoord; out noperspective vec3 hd_barycentricCoord; +in flat ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; @@ -3591,28 +3557,6 @@ out PrimvarData { vec3 normals; vec2 dispTextureCoord; } outPrimvars; -in flat int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_modelCoord; -in flat int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_constantCoord; -in flat int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_elementCoord; -in flat int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_fvarCoord; -in flat int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_shaderCoord; -in flat int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI0; -in flat int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; // //////// Codegen Accessors //////// @@ -3657,16 +3601,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -3759,16 +3703,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -4422,22 +4366,14 @@ in VertexData { } inData; layout (location = 0) out vec4 colorOut; in noperspective vec3 hd_barycentricCoord; +in flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; } inPrimvars; -in flat int gs_dc_modelCoord; -in flat int gs_dc_constantCoord; -in flat int gs_dc_elementCoord; -in flat int gs_dc_primitiveCoord; -in flat int gs_dc_fvarCoord; -in flat int gs_dc_shaderCoord; -in flat int gs_dc_vertexCoord; -in flat int gs_dc_topologyVisibilityCoord; -in flat int gs_dc_varyingCoord; -in flat int gs_dc_instanceIndexI0; -in flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) { @@ -4496,16 +4432,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect.out index 59998b24c6..7ee8a125f8 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect.out @@ -162,22 +162,14 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceCoordsI0; layout(location = 0) uniform ConstantData10 *constantPrimvars; layout(location = 1) uniform int *primitiveParam; layout(location = 2) uniform int *edgeIndices; @@ -256,16 +248,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -851,6 +843,12 @@ out VertexData { } outData; out vec4 gsPatchCoord; out noperspective vec3 hd_barycentricCoord; +in flat ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; @@ -860,28 +858,6 @@ out PrimvarData { vec3 normals; vec2 dispTextureCoord; } outPrimvars; -in flat int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_modelCoord; -in flat int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_constantCoord; -in flat int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_elementCoord; -in flat int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_fvarCoord; -in flat int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_shaderCoord; -in flat int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI0; -in flat int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; // //////// Codegen Accessors //////// @@ -926,16 +902,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -1028,16 +1004,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -1662,22 +1638,14 @@ in VertexData { } inData; layout (location = 0) out vec4 colorOut; in noperspective vec3 hd_barycentricCoord; +in flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; } inPrimvars; -in flat int gs_dc_modelCoord; -in flat int gs_dc_constantCoord; -in flat int gs_dc_elementCoord; -in flat int gs_dc_primitiveCoord; -in flat int gs_dc_fvarCoord; -in flat int gs_dc_shaderCoord; -in flat int gs_dc_vertexCoord; -in flat int gs_dc_topologyVisibilityCoord; -in flat int gs_dc_varyingCoord; -in flat int gs_dc_instanceIndexI0; -in flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) { @@ -1736,16 +1704,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -2838,22 +2806,14 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceCoordsI0; layout(location = 0) uniform ConstantData10 *constantPrimvars; layout(location = 1) uniform int *primitiveParam; layout(location = 2) uniform ivec2 *edgeIndices; @@ -2932,16 +2892,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -3527,6 +3487,12 @@ out VertexData { } outData; out vec4 gsPatchCoord; out noperspective vec3 hd_barycentricCoord; +in flat ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; @@ -3536,28 +3502,6 @@ out PrimvarData { vec3 normals; vec2 dispTextureCoord; } outPrimvars; -in flat int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_modelCoord; -in flat int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_constantCoord; -in flat int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_elementCoord; -in flat int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_fvarCoord; -in flat int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_shaderCoord; -in flat int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI0; -in flat int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; // //////// Codegen Accessors //////// @@ -3602,16 +3546,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -3704,16 +3648,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -4367,22 +4311,14 @@ in VertexData { } inData; layout (location = 0) out vec4 colorOut; in noperspective vec3 hd_barycentricCoord; +in flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 gs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; } inPrimvars; -in flat int gs_dc_modelCoord; -in flat int gs_dc_constantCoord; -in flat int gs_dc_elementCoord; -in flat int gs_dc_primitiveCoord; -in flat int gs_dc_fvarCoord; -in flat int gs_dc_shaderCoord; -in flat int gs_dc_vertexCoord; -in flat int gs_dc_topologyVisibilityCoord; -in flat int gs_dc_varyingCoord; -in flat int gs_dc_instanceIndexI0; -in flat int gs_dc_instanceCoordsI0; layout(location = 4) uniform vec2 *dispTextureCoord; vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) { @@ -4441,16 +4377,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_instance.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_instance.out index 63f827af51..9960bc8fe8 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_instance.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_instance.out @@ -164,25 +164,16 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; +out flat ivec4 vs_interstageDrawingCoord3; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 5) in int drawingCoordI0; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceIndexI1; -out flat int vs_dc_instanceCoordsI0; -out flat int vs_dc_instanceCoordsI1; layout(location = 6) uniform int *instanceIndices; layout(location = 7) uniform int *culledInstanceIndices; layout(location = 0) uniform ConstantData10 *constantPrimvars; @@ -305,18 +296,18 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; - vs_dc_instanceIndexI1 = dc.instanceIndex[1]; - vs_dc_instanceCoordsI0 = dc.instanceCoords[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; + vs_interstageDrawingCoord2[2] = dc.instanceIndex[1]; + vs_interstageDrawingCoord2[3] = dc.instanceCoords[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -907,6 +898,14 @@ out VertexData { } outData; out vec4 gsPatchCoord; out noperspective vec3 hd_barycentricCoord; +in flat ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord2; +in flat ivec4 vs_interstageDrawingCoord3[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord3; in PrimvarData { vec3 points; vec3 normals; @@ -916,32 +915,6 @@ out PrimvarData { vec3 normals; vec2 dispTextureCoord; } outPrimvars; -in flat int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_modelCoord; -in flat int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_constantCoord; -in flat int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_elementCoord; -in flat int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_fvarCoord; -in flat int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_shaderCoord; -in flat int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI0; -in flat int vs_dc_instanceIndexI1[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI1; -in flat int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI0; -in flat int vs_dc_instanceCoordsI1[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI1; layout(location = 5) uniform vec2 *dispTextureCoord; // //////// Codegen Accessors //////// @@ -1004,18 +977,18 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; - dc.instanceIndex[1] = vs_dc_instanceIndexI1[0]; - dc.instanceCoords[0] = vs_dc_instanceCoordsI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; + dc.instanceIndex[1] = vs_interstageDrawingCoord2[0][2]; + dc.instanceCoords[0] = vs_interstageDrawingCoord2[0][3]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -1108,18 +1081,18 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; - gs_dc_instanceIndexI1 = dc.instanceIndex[1]; - gs_dc_instanceCoordsI0 = dc.instanceCoords[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; + gs_interstageDrawingCoord2[2] = dc.instanceIndex[1]; + gs_interstageDrawingCoord2[3] = dc.instanceCoords[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -1749,24 +1722,15 @@ in VertexData { } inData; layout (location = 0) out vec4 colorOut; in noperspective vec3 hd_barycentricCoord; +in flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 gs_interstageDrawingCoord2; +in flat ivec4 gs_interstageDrawingCoord3; in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; } inPrimvars; -in flat int gs_dc_modelCoord; -in flat int gs_dc_constantCoord; -in flat int gs_dc_elementCoord; -in flat int gs_dc_primitiveCoord; -in flat int gs_dc_fvarCoord; -in flat int gs_dc_shaderCoord; -in flat int gs_dc_vertexCoord; -in flat int gs_dc_topologyVisibilityCoord; -in flat int gs_dc_varyingCoord; -in flat int gs_dc_instanceIndexI0; -in flat int gs_dc_instanceIndexI1; -in flat int gs_dc_instanceCoordsI0; -in flat int gs_dc_instanceCoordsI1; layout(location = 5) uniform vec2 *dispTextureCoord; vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) { @@ -1843,18 +1807,18 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; - dc.instanceIndex[1] = gs_dc_instanceIndexI1; - dc.instanceCoords[0] = gs_dc_instanceCoordsI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; + dc.instanceIndex[1] = gs_interstageDrawingCoord2[2]; + dc.instanceCoords[0] = gs_interstageDrawingCoord2[3]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -2949,25 +2913,16 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; +out flat ivec4 vs_interstageDrawingCoord3; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 5) in int drawingCoordI0; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceIndexI1; -out flat int vs_dc_instanceCoordsI0; -out flat int vs_dc_instanceCoordsI1; layout(location = 6) uniform int *instanceIndices; layout(location = 7) uniform int *culledInstanceIndices; layout(location = 0) uniform ConstantData10 *constantPrimvars; @@ -3090,18 +3045,18 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; - vs_dc_instanceIndexI1 = dc.instanceIndex[1]; - vs_dc_instanceCoordsI0 = dc.instanceCoords[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; + vs_interstageDrawingCoord2[2] = dc.instanceIndex[1]; + vs_interstageDrawingCoord2[3] = dc.instanceCoords[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -3692,6 +3647,14 @@ out VertexData { } outData; out vec4 gsPatchCoord; out noperspective vec3 hd_barycentricCoord; +in flat ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord2; +in flat ivec4 vs_interstageDrawingCoord3[HD_NUM_PRIMITIVE_VERTS]; +out flat ivec4 gs_interstageDrawingCoord3; in PrimvarData { vec3 points; vec3 normals; @@ -3701,32 +3664,6 @@ out PrimvarData { vec3 normals; vec2 dispTextureCoord; } outPrimvars; -in flat int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_modelCoord; -in flat int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_constantCoord; -in flat int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_elementCoord; -in flat int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_fvarCoord; -in flat int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_shaderCoord; -in flat int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI0; -in flat int vs_dc_instanceIndexI1[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceIndexI1; -in flat int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI0; -in flat int vs_dc_instanceCoordsI1[HD_NUM_PRIMITIVE_VERTS]; -out flat int gs_dc_instanceCoordsI1; layout(location = 5) uniform vec2 *dispTextureCoord; // //////// Codegen Accessors //////// @@ -3789,18 +3726,18 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; - dc.instanceIndex[1] = vs_dc_instanceIndexI1[0]; - dc.instanceCoords[0] = vs_dc_instanceCoordsI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; + dc.instanceIndex[1] = vs_interstageDrawingCoord2[0][2]; + dc.instanceCoords[0] = vs_interstageDrawingCoord2[0][3]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -3893,18 +3830,18 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; - gs_dc_instanceIndexI1 = dc.instanceIndex[1]; - gs_dc_instanceCoordsI0 = dc.instanceCoords[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; + gs_interstageDrawingCoord2[2] = dc.instanceIndex[1]; + gs_interstageDrawingCoord2[3] = dc.instanceCoords[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -4563,24 +4500,15 @@ in VertexData { } inData; layout (location = 0) out vec4 colorOut; in noperspective vec3 hd_barycentricCoord; +in flat ivec4 gs_interstageDrawingCoord0; +in flat ivec4 gs_interstageDrawingCoord1; +in flat ivec4 gs_interstageDrawingCoord2; +in flat ivec4 gs_interstageDrawingCoord3; in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; } inPrimvars; -in flat int gs_dc_modelCoord; -in flat int gs_dc_constantCoord; -in flat int gs_dc_elementCoord; -in flat int gs_dc_primitiveCoord; -in flat int gs_dc_fvarCoord; -in flat int gs_dc_shaderCoord; -in flat int gs_dc_vertexCoord; -in flat int gs_dc_topologyVisibilityCoord; -in flat int gs_dc_varyingCoord; -in flat int gs_dc_instanceIndexI0; -in flat int gs_dc_instanceIndexI1; -in flat int gs_dc_instanceCoordsI0; -in flat int gs_dc_instanceCoordsI1; layout(location = 5) uniform vec2 *dispTextureCoord; vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) { @@ -4657,18 +4585,18 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; - dc.instanceIndex[1] = gs_dc_instanceIndexI1; - dc.instanceCoords[0] = gs_dc_instanceCoordsI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; + dc.instanceIndex[1] = gs_interstageDrawingCoord2[2]; + dc.instanceCoords[0] = gs_interstageDrawingCoord2[3]; return dc; } int HdGet_primitiveParam(int localIndex) { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_points_bindless.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_points_bindless.out index fe4aba326c..ebd462d16f 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_points_bindless.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_points_bindless.out @@ -159,22 +159,14 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceCoordsI0; layout(location = 0) uniform ConstantData10 *constantPrimvars; out VertexData { vec4 Peye; @@ -250,16 +242,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -1248,21 +1240,13 @@ in VertexData { } inData; in flat int vsPointId; layout (location = 0) out vec4 colorOut; +in flat ivec4 vs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; } inPrimvars; -in flat int vs_dc_modelCoord; -in flat int vs_dc_constantCoord; -in flat int vs_dc_elementCoord; -in flat int vs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord; -in flat int vs_dc_shaderCoord; -in flat int vs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0; -in flat int vs_dc_instanceCoordsI0; // //////// Codegen Accessors //////// mat4 HdGet_transform(int localIndex) { @@ -1311,16 +1295,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord; - dc.constantCoord = vs_dc_constantCoord; - dc.elementCoord = vs_dc_elementCoord; - dc.primitiveCoord = vs_dc_primitiveCoord; - dc.fvarCoord = vs_dc_fvarCoord; - dc.shaderCoord = vs_dc_shaderCoord; - dc.vertexCoord = vs_dc_vertexCoord; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord; - dc.varyingCoord = vs_dc_varyingCoord; - dc.instanceIndex[0] = vs_dc_instanceIndexI0; + dc.modelCoord = vs_interstageDrawingCoord0[0]; + dc.constantCoord = vs_interstageDrawingCoord0[1]; + dc.elementCoord = vs_interstageDrawingCoord0[2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0]; + dc.shaderCoord = vs_interstageDrawingCoord1[1]; + dc.vertexCoord = vs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[1]; return dc; } int GetElementID() { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_points_indirect.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_points_indirect.out index fe4aba326c..ebd462d16f 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_points_indirect.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_points_indirect.out @@ -159,22 +159,14 @@ FORWARD_DECL(int GetElementID()); FORWARD_DECL(int GetAggregatedElementID()); FORWARD_DECL(int GetPrimitiveEdgeId()); FORWARD_DECL(float GetSelectedEdgeOpacity()); +out flat ivec4 vs_interstageDrawingCoord0; +out flat ivec4 vs_interstageDrawingCoord1; +out flat ivec4 vs_interstageDrawingCoord2; layout (location = 2) in ivec4 drawingCoord0; layout (location = 3) in ivec4 drawingCoord1; layout (location = 4) in ivec2 drawingCoord2; layout (location = 0) in vec3 points; layout (location = 1) in vec3 normals; -out flat int vs_dc_modelCoord; -out flat int vs_dc_constantCoord; -out flat int vs_dc_elementCoord; -out flat int vs_dc_primitiveCoord; -out flat int vs_dc_fvarCoord; -out flat int vs_dc_shaderCoord; -out flat int vs_dc_vertexCoord; -out flat int vs_dc_topologyVisibilityCoord; -out flat int vs_dc_varyingCoord; -out flat int vs_dc_instanceIndexI0; -out flat int vs_dc_instanceCoordsI0; layout(location = 0) uniform ConstantData10 *constantPrimvars; out VertexData { vec4 Peye; @@ -250,16 +242,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -1248,21 +1240,13 @@ in VertexData { } inData; in flat int vsPointId; layout (location = 0) out vec4 colorOut; +in flat ivec4 vs_interstageDrawingCoord0; +in flat ivec4 vs_interstageDrawingCoord1; +in flat ivec4 vs_interstageDrawingCoord2; in PrimvarData { vec3 points; vec3 normals; } inPrimvars; -in flat int vs_dc_modelCoord; -in flat int vs_dc_constantCoord; -in flat int vs_dc_elementCoord; -in flat int vs_dc_primitiveCoord; -in flat int vs_dc_fvarCoord; -in flat int vs_dc_shaderCoord; -in flat int vs_dc_vertexCoord; -in flat int vs_dc_topologyVisibilityCoord; -in flat int vs_dc_varyingCoord; -in flat int vs_dc_instanceIndexI0; -in flat int vs_dc_instanceCoordsI0; // //////// Codegen Accessors //////// mat4 HdGet_transform(int localIndex) { @@ -1311,16 +1295,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord; - dc.constantCoord = vs_dc_constantCoord; - dc.elementCoord = vs_dc_elementCoord; - dc.primitiveCoord = vs_dc_primitiveCoord; - dc.fvarCoord = vs_dc_fvarCoord; - dc.shaderCoord = vs_dc_shaderCoord; - dc.vertexCoord = vs_dc_vertexCoord; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord; - dc.varyingCoord = vs_dc_varyingCoord; - dc.instanceIndex[0] = vs_dc_instanceIndexI0; + dc.modelCoord = vs_interstageDrawingCoord0[0]; + dc.constantCoord = vs_interstageDrawingCoord0[1]; + dc.elementCoord = vs_interstageDrawingCoord0[2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0]; + dc.shaderCoord = vs_interstageDrawingCoord1[1]; + dc.vertexCoord = vs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[1]; return dc; } int GetElementID() { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_curves_indirect.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_curves_indirect.out index 071379f20f..c7b6f0e0d5 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_curves_indirect.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_curves_indirect.out @@ -166,21 +166,13 @@ layout(location = 1) in vec3 normals; uint hd_VertexID = gl_VertexIndex; uint hd_InstanceID = gl_InstanceIndex; uint hd_BaseInstance = HgiGetBaseInstance(); -flat layout(location = 0) out int vs_dc_modelCoord; -flat layout(location = 1) out int vs_dc_constantCoord; -flat layout(location = 2) out int vs_dc_elementCoord; -flat layout(location = 3) out int vs_dc_primitiveCoord; -flat layout(location = 4) out int vs_dc_fvarCoord; -flat layout(location = 5) out int vs_dc_shaderCoord; -flat layout(location = 6) out int vs_dc_vertexCoord; -flat layout(location = 7) out int vs_dc_topologyVisibilityCoord; -flat layout(location = 8) out int vs_dc_varyingCoord; -flat layout(location = 9) out int vs_dc_instanceIndexI0; -flat layout(location = 10) out int vs_dc_instanceCoordsI0; -layout(location = 11) out CurveVertexData { +flat layout(location = 0) out ivec4 vs_interstageDrawingCoord0; +flat layout(location = 1) out ivec4 vs_interstageDrawingCoord1; +flat layout(location = 2) out ivec4 vs_interstageDrawingCoord2; +layout(location = 3) out CurveVertexData { vec4 Peye; } outData; -layout(location = 12) out PrimvarData { +layout(location = 4) out PrimvarData { vec3 points; vec3 normals; } outPrimvars; @@ -252,16 +244,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -812,39 +804,23 @@ layout (vertices = HD_NUM_PATCH_EVAL_VERTS) out; // //////// Global Member Declarations //////// layout(std430, binding = 0) readonly buffer ssbo_constantPrimvars { ConstantData7 constantPrimvars[]; }; layout(std430, binding = 1) readonly buffer ssbo_faceVisibility { float faceVisibility[]; }; -flat layout(location = 0) in int vs_dc_modelCoord[gl_MaxPatchVertices]; -flat layout(location = 1) in int vs_dc_constantCoord[gl_MaxPatchVertices]; -flat layout(location = 2) in int vs_dc_elementCoord[gl_MaxPatchVertices]; -flat layout(location = 3) in int vs_dc_primitiveCoord[gl_MaxPatchVertices]; -flat layout(location = 4) in int vs_dc_fvarCoord[gl_MaxPatchVertices]; -flat layout(location = 5) in int vs_dc_shaderCoord[gl_MaxPatchVertices]; -flat layout(location = 6) in int vs_dc_vertexCoord[gl_MaxPatchVertices]; -flat layout(location = 7) in int vs_dc_topologyVisibilityCoord[gl_MaxPatchVertices]; -flat layout(location = 8) in int vs_dc_varyingCoord[gl_MaxPatchVertices]; -flat layout(location = 9) in int vs_dc_instanceIndexI0[gl_MaxPatchVertices]; -flat layout(location = 10) in int vs_dc_instanceCoordsI0[gl_MaxPatchVertices]; -layout(location = 11) in CurveVertexData { +flat layout(location = 0) in ivec4 vs_interstageDrawingCoord0[gl_MaxPatchVertices]; +flat layout(location = 1) in ivec4 vs_interstageDrawingCoord1[gl_MaxPatchVertices]; +flat layout(location = 2) in ivec4 vs_interstageDrawingCoord2[gl_MaxPatchVertices]; +layout(location = 3) in CurveVertexData { vec4 Peye; } inData[gl_MaxPatchVertices]; -layout(location = 12) in PrimvarData { +layout(location = 4) in PrimvarData { vec3 points; vec3 normals; } inPrimvars[gl_MaxPatchVertices]; -flat layout(location = 3) out int tcs_dc_modelCoord[HD_NUM_PATCH_EVAL_VERTS]; -flat layout(location = 4) out int tcs_dc_constantCoord[HD_NUM_PATCH_EVAL_VERTS]; -flat layout(location = 5) out int tcs_dc_elementCoord[HD_NUM_PATCH_EVAL_VERTS]; -flat layout(location = 6) out int tcs_dc_primitiveCoord[HD_NUM_PATCH_EVAL_VERTS]; -flat layout(location = 7) out int tcs_dc_fvarCoord[HD_NUM_PATCH_EVAL_VERTS]; -flat layout(location = 8) out int tcs_dc_shaderCoord[HD_NUM_PATCH_EVAL_VERTS]; -flat layout(location = 9) out int tcs_dc_vertexCoord[HD_NUM_PATCH_EVAL_VERTS]; -flat layout(location = 10) out int tcs_dc_topologyVisibilityCoord[HD_NUM_PATCH_EVAL_VERTS]; -flat layout(location = 11) out int tcs_dc_varyingCoord[HD_NUM_PATCH_EVAL_VERTS]; -flat layout(location = 12) out int tcs_dc_instanceIndexI0[HD_NUM_PATCH_EVAL_VERTS]; -flat layout(location = 13) out int tcs_dc_instanceCoordsI0[HD_NUM_PATCH_EVAL_VERTS]; +flat layout(location = 1) out ivec4 tcs_interstageDrawingCoord0[HD_NUM_PATCH_EVAL_VERTS]; +flat layout(location = 2) out ivec4 tcs_interstageDrawingCoord1[HD_NUM_PATCH_EVAL_VERTS]; +flat layout(location = 3) out ivec4 tcs_interstageDrawingCoord2[HD_NUM_PATCH_EVAL_VERTS]; layout(location = 0) out CurveVertexData { vec4 Peye; } outData[HD_NUM_PATCH_EVAL_VERTS]; -layout(location = 1) out PrimvarData { +layout(location = 4) out PrimvarData { vec3 points; vec3 normals; } outPrimvars[HD_NUM_PATCH_EVAL_VERTS]; @@ -894,16 +870,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int GetElementID() { @@ -958,16 +934,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc TCS //////// void ProcessPrimvarsOut() { hd_drawingCoord dc = GetDrawingCoord(); - tcs_dc_modelCoord[gl_InvocationID] = dc.modelCoord; - tcs_dc_constantCoord[gl_InvocationID] = dc.constantCoord; - tcs_dc_elementCoord[gl_InvocationID] = dc.elementCoord; - tcs_dc_primitiveCoord[gl_InvocationID] = dc.primitiveCoord; - tcs_dc_fvarCoord[gl_InvocationID] = dc.fvarCoord; - tcs_dc_shaderCoord[gl_InvocationID] = dc.shaderCoord; - tcs_dc_vertexCoord[gl_InvocationID] = dc.vertexCoord; - tcs_dc_topologyVisibilityCoord[gl_InvocationID] = dc.topologyVisibilityCoord; - tcs_dc_varyingCoord[gl_InvocationID] = dc.varyingCoord; - tcs_dc_instanceIndexI0[gl_InvocationID] = dc.instanceIndex[0]; + tcs_interstageDrawingCoord0[gl_InvocationID][0] = dc.modelCoord; + tcs_interstageDrawingCoord0[gl_InvocationID][1] = dc.constantCoord; + tcs_interstageDrawingCoord0[gl_InvocationID][2] = dc.elementCoord; + tcs_interstageDrawingCoord0[gl_InvocationID][3] = dc.primitiveCoord; + tcs_interstageDrawingCoord1[gl_InvocationID][0] = dc.fvarCoord; + tcs_interstageDrawingCoord1[gl_InvocationID][1] = dc.shaderCoord; + tcs_interstageDrawingCoord1[gl_InvocationID][2] = dc.vertexCoord; + tcs_interstageDrawingCoord1[gl_InvocationID][3] = dc.topologyVisibilityCoord; + tcs_interstageDrawingCoord2[gl_InvocationID][0] = dc.varyingCoord; + tcs_interstageDrawingCoord2[gl_InvocationID][1] = dc.instanceIndex[0]; outPrimvars[gl_InvocationID].points = inPrimvars[gl_InvocationID].points; outPrimvars[gl_InvocationID].normals = inPrimvars[gl_InvocationID].normals; } @@ -1338,39 +1314,23 @@ layout (cw) in; // //////// Global Member Declarations //////// layout(std430, binding = 0) readonly buffer ssbo_constantPrimvars { ConstantData7 constantPrimvars[]; }; layout(std430, binding = 1) readonly buffer ssbo_faceVisibility { float faceVisibility[]; }; -flat layout(location = 3) in int tcs_dc_modelCoord[gl_MaxPatchVertices]; -flat layout(location = 4) in int tcs_dc_constantCoord[gl_MaxPatchVertices]; -flat layout(location = 5) in int tcs_dc_elementCoord[gl_MaxPatchVertices]; -flat layout(location = 6) in int tcs_dc_primitiveCoord[gl_MaxPatchVertices]; -flat layout(location = 7) in int tcs_dc_fvarCoord[gl_MaxPatchVertices]; -flat layout(location = 8) in int tcs_dc_shaderCoord[gl_MaxPatchVertices]; -flat layout(location = 9) in int tcs_dc_vertexCoord[gl_MaxPatchVertices]; -flat layout(location = 10) in int tcs_dc_topologyVisibilityCoord[gl_MaxPatchVertices]; -flat layout(location = 11) in int tcs_dc_varyingCoord[gl_MaxPatchVertices]; -flat layout(location = 12) in int tcs_dc_instanceIndexI0[gl_MaxPatchVertices]; -flat layout(location = 13) in int tcs_dc_instanceCoordsI0[gl_MaxPatchVertices]; +flat layout(location = 1) in ivec4 tcs_interstageDrawingCoord0[gl_MaxPatchVertices]; +flat layout(location = 2) in ivec4 tcs_interstageDrawingCoord1[gl_MaxPatchVertices]; +flat layout(location = 3) in ivec4 tcs_interstageDrawingCoord2[gl_MaxPatchVertices]; layout(location = 0) in CurveVertexData { vec4 Peye; } inData[gl_MaxPatchVertices]; -layout(location = 1) in PrimvarData { +layout(location = 4) in PrimvarData { vec3 points; vec3 normals; } inPrimvars[gl_MaxPatchVertices]; -flat layout(location = 3) out int tes_dc_modelCoord; -flat layout(location = 4) out int tes_dc_constantCoord; -flat layout(location = 5) out int tes_dc_elementCoord; -flat layout(location = 6) out int tes_dc_primitiveCoord; -flat layout(location = 7) out int tes_dc_fvarCoord; -flat layout(location = 8) out int tes_dc_shaderCoord; -flat layout(location = 9) out int tes_dc_vertexCoord; -flat layout(location = 10) out int tes_dc_topologyVisibilityCoord; -flat layout(location = 11) out int tes_dc_varyingCoord; -flat layout(location = 12) out int tes_dc_instanceIndexI0; -flat layout(location = 13) out int tes_dc_instanceCoordsI0; +flat layout(location = 1) out ivec4 tes_interstageDrawingCoord0; +flat layout(location = 2) out ivec4 tes_interstageDrawingCoord1; +flat layout(location = 3) out ivec4 tes_interstageDrawingCoord2; layout(location = 0) out CurveVertexData { vec4 Peye; } outData; -layout(location = 1) out PrimvarData { +layout(location = 4) out PrimvarData { vec3 points; vec3 normals; } outPrimvars; @@ -1420,16 +1380,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = tcs_dc_modelCoord[0]; - dc.constantCoord = tcs_dc_constantCoord[0]; - dc.elementCoord = tcs_dc_elementCoord[0]; - dc.primitiveCoord = tcs_dc_primitiveCoord[0]; - dc.fvarCoord = tcs_dc_fvarCoord[0]; - dc.shaderCoord = tcs_dc_shaderCoord[0]; - dc.vertexCoord = tcs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = tcs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = tcs_dc_varyingCoord[0]; - dc.instanceIndex[0] = tcs_dc_instanceIndexI0[0]; + dc.modelCoord = tcs_interstageDrawingCoord0[0][0]; + dc.constantCoord = tcs_interstageDrawingCoord0[0][1]; + dc.elementCoord = tcs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = tcs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = tcs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = tcs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = tcs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = tcs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = tcs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = tcs_interstageDrawingCoord2[0][1]; return dc; } int GetElementID() { @@ -1488,16 +1448,16 @@ vec3 InterpolatePrimvar(vec3 inPv0, vec3 inPv1, vec3 inPv2, vec3 inPv3, vec4 bas vec4 InterpolatePrimvar(vec4 inPv0, vec4 inPv1, vec4 inPv3, vec4 inPv3, vec4 basis, vec2 uv); void ProcessPrimvarsOut(vec4 basis, int i0, int i1, int i2, int i3, vec2 uv) { hd_drawingCoord dc = GetDrawingCoord(); - tes_dc_modelCoord = dc.modelCoord; - tes_dc_constantCoord = dc.constantCoord; - tes_dc_elementCoord = dc.elementCoord; - tes_dc_primitiveCoord = dc.primitiveCoord; - tes_dc_fvarCoord = dc.fvarCoord; - tes_dc_shaderCoord = dc.shaderCoord; - tes_dc_vertexCoord = dc.vertexCoord; - tes_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - tes_dc_varyingCoord = dc.varyingCoord; - tes_dc_instanceIndexI0 = dc.instanceIndex[0]; + tes_interstageDrawingCoord0[0] = dc.modelCoord; + tes_interstageDrawingCoord0[1] = dc.constantCoord; + tes_interstageDrawingCoord0[2] = dc.elementCoord; + tes_interstageDrawingCoord0[3] = dc.primitiveCoord; + tes_interstageDrawingCoord1[0] = dc.fvarCoord; + tes_interstageDrawingCoord1[1] = dc.shaderCoord; + tes_interstageDrawingCoord1[2] = dc.vertexCoord; + tes_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + tes_interstageDrawingCoord2[0] = dc.varyingCoord; + tes_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = basis[0] * inPrimvars[i0].points + basis[1] * inPrimvars[i1].points + basis[2] * inPrimvars[i2].points + basis[3] * inPrimvars[i3].points; outPrimvars.normals = basis[0] * inPrimvars[i0].normals + basis[1] * inPrimvars[i1].normals + basis[2] * inPrimvars[i2].normals + basis[3] * inPrimvars[i3].normals; } @@ -2101,21 +2061,13 @@ FORWARD_DECL(float GetSelectedEdgeOpacity()); // //////// Global Member Declarations //////// layout(std430, binding = 0) readonly buffer ssbo_constantPrimvars { ConstantData7 constantPrimvars[]; }; layout(std430, binding = 1) readonly buffer ssbo_faceVisibility { float faceVisibility[]; }; -flat layout(location = 3) in int tes_dc_modelCoord; -flat layout(location = 4) in int tes_dc_constantCoord; -flat layout(location = 5) in int tes_dc_elementCoord; -flat layout(location = 6) in int tes_dc_primitiveCoord; -flat layout(location = 7) in int tes_dc_fvarCoord; -flat layout(location = 8) in int tes_dc_shaderCoord; -flat layout(location = 9) in int tes_dc_vertexCoord; -flat layout(location = 10) in int tes_dc_topologyVisibilityCoord; -flat layout(location = 11) in int tes_dc_varyingCoord; -flat layout(location = 12) in int tes_dc_instanceIndexI0; -flat layout(location = 13) in int tes_dc_instanceCoordsI0; +flat layout(location = 1) in ivec4 tes_interstageDrawingCoord0; +flat layout(location = 2) in ivec4 tes_interstageDrawingCoord1; +flat layout(location = 3) in ivec4 tes_interstageDrawingCoord2; layout(location = 0) in CurveVertexData { vec4 Peye; } inData; -layout(location = 1) in PrimvarData { +layout(location = 4) in PrimvarData { vec3 points; vec3 normals; } inPrimvars; @@ -2170,16 +2122,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = tes_dc_modelCoord; - dc.constantCoord = tes_dc_constantCoord; - dc.elementCoord = tes_dc_elementCoord; - dc.primitiveCoord = tes_dc_primitiveCoord; - dc.fvarCoord = tes_dc_fvarCoord; - dc.shaderCoord = tes_dc_shaderCoord; - dc.vertexCoord = tes_dc_vertexCoord; - dc.topologyVisibilityCoord = tes_dc_topologyVisibilityCoord; - dc.varyingCoord = tes_dc_varyingCoord; - dc.instanceIndex[0] = tes_dc_instanceIndexI0; + dc.modelCoord = tes_interstageDrawingCoord0[0]; + dc.constantCoord = tes_interstageDrawingCoord0[1]; + dc.elementCoord = tes_interstageDrawingCoord0[2]; + dc.primitiveCoord = tes_interstageDrawingCoord0[3]; + dc.fvarCoord = tes_interstageDrawingCoord1[0]; + dc.shaderCoord = tes_interstageDrawingCoord1[1]; + dc.vertexCoord = tes_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = tes_interstageDrawingCoord1[3]; + dc.varyingCoord = tes_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = tes_interstageDrawingCoord2[1]; return dc; } int GetElementID() { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_edgeonly.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_edgeonly.out index d2f21a241a..b9234ebf1a 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_edgeonly.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_edgeonly.out @@ -166,22 +166,14 @@ layout(location = 1) in vec3 normals; uint hd_VertexID = gl_VertexIndex; uint hd_InstanceID = gl_InstanceIndex; uint hd_BaseInstance = HgiGetBaseInstance(); -flat layout(location = 0) out int vs_dc_modelCoord; -flat layout(location = 1) out int vs_dc_constantCoord; -flat layout(location = 2) out int vs_dc_elementCoord; -flat layout(location = 3) out int vs_dc_primitiveCoord; -flat layout(location = 4) out int vs_dc_fvarCoord; -flat layout(location = 5) out int vs_dc_shaderCoord; -flat layout(location = 6) out int vs_dc_vertexCoord; -flat layout(location = 7) out int vs_dc_topologyVisibilityCoord; -flat layout(location = 8) out int vs_dc_varyingCoord; -flat layout(location = 9) out int vs_dc_instanceIndexI0; -flat layout(location = 10) out int vs_dc_instanceCoordsI0; -layout(location = 11) out VertexData { +flat layout(location = 0) out ivec4 vs_interstageDrawingCoord0; +flat layout(location = 1) out ivec4 vs_interstageDrawingCoord1; +flat layout(location = 2) out ivec4 vs_interstageDrawingCoord2; +layout(location = 3) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 13) out PrimvarData { +layout(location = 5) out PrimvarData { vec3 points; vec3 normals; } outPrimvars; @@ -253,16 +245,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -831,43 +823,27 @@ layout(std430, binding = 1) readonly buffer ssbo_primitiveParam { int primitiveP layout(std430, binding = 2) readonly buffer ssbo_edgeIndices { int edgeIndices[]; }; layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisibility[]; }; layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; -flat layout(location = 0) in int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 1) in int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 2) in int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 3) in int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 4) in int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 5) in int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 6) in int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 7) in int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 8) in int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 9) in int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 10) in int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -layout(location = 11) in VertexData { +flat layout(location = 0) in ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 1) in ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 2) in ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +layout(location = 3) in VertexData { vec4 Peye; vec3 Neye; } inData[3]; -layout(location = 13) in PrimvarData { +layout(location = 5) in PrimvarData { vec3 points; vec3 normals; } inPrimvars[HD_NUM_PRIMITIVE_VERTS]; layout(location = 2) out vec4 gsPatchCoord; noperspective layout(location = 3) out vec3 hd_barycentricCoord; -flat layout(location = 7) out int gs_dc_modelCoord; -flat layout(location = 8) out int gs_dc_constantCoord; -flat layout(location = 9) out int gs_dc_elementCoord; -flat layout(location = 10) out int gs_dc_primitiveCoord; -flat layout(location = 11) out int gs_dc_fvarCoord; -flat layout(location = 12) out int gs_dc_shaderCoord; -flat layout(location = 13) out int gs_dc_vertexCoord; -flat layout(location = 14) out int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) out int gs_dc_varyingCoord; -flat layout(location = 16) out int gs_dc_instanceIndexI0; -flat layout(location = 17) out int gs_dc_instanceCoordsI0; +flat layout(location = 4) out ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) out ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) out ivec4 gs_interstageDrawingCoord2; layout(location = 0) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 4) out PrimvarData { +layout(location = 7) out PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -918,16 +894,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -1020,16 +996,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -1651,22 +1627,14 @@ layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisi layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; layout(location = 2) in vec4 gsPatchCoord; noperspective layout(location = 3) in vec3 hd_barycentricCoord; -flat layout(location = 7) in int gs_dc_modelCoord; -flat layout(location = 8) in int gs_dc_constantCoord; -flat layout(location = 9) in int gs_dc_elementCoord; -flat layout(location = 10) in int gs_dc_primitiveCoord; -flat layout(location = 11) in int gs_dc_fvarCoord; -flat layout(location = 12) in int gs_dc_shaderCoord; -flat layout(location = 13) in int gs_dc_vertexCoord; -flat layout(location = 14) in int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) in int gs_dc_varyingCoord; -flat layout(location = 16) in int gs_dc_instanceIndexI0; -flat layout(location = 17) in int gs_dc_instanceCoordsI0; +flat layout(location = 4) in ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) in ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) in ivec4 gs_interstageDrawingCoord2; layout(location = 0) in VertexData { vec4 Peye; vec3 Neye; } inData; -layout(location = 4) in PrimvarData { +layout(location = 7) in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -1722,16 +1690,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -2877,22 +2845,14 @@ layout(location = 1) in vec3 normals; uint hd_VertexID = gl_VertexIndex; uint hd_InstanceID = gl_InstanceIndex; uint hd_BaseInstance = HgiGetBaseInstance(); -flat layout(location = 0) out int vs_dc_modelCoord; -flat layout(location = 1) out int vs_dc_constantCoord; -flat layout(location = 2) out int vs_dc_elementCoord; -flat layout(location = 3) out int vs_dc_primitiveCoord; -flat layout(location = 4) out int vs_dc_fvarCoord; -flat layout(location = 5) out int vs_dc_shaderCoord; -flat layout(location = 6) out int vs_dc_vertexCoord; -flat layout(location = 7) out int vs_dc_topologyVisibilityCoord; -flat layout(location = 8) out int vs_dc_varyingCoord; -flat layout(location = 9) out int vs_dc_instanceIndexI0; -flat layout(location = 10) out int vs_dc_instanceCoordsI0; -layout(location = 11) out VertexData { +flat layout(location = 0) out ivec4 vs_interstageDrawingCoord0; +flat layout(location = 1) out ivec4 vs_interstageDrawingCoord1; +flat layout(location = 2) out ivec4 vs_interstageDrawingCoord2; +layout(location = 3) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 13) out PrimvarData { +layout(location = 5) out PrimvarData { vec3 points; vec3 normals; } outPrimvars; @@ -2964,16 +2924,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -3542,43 +3502,27 @@ layout(std430, binding = 1) readonly buffer ssbo_primitiveParam { int primitiveP layout(std430, binding = 2) readonly buffer ssbo_edgeIndices { ivec2 edgeIndices[]; }; layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisibility[]; }; layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; -flat layout(location = 0) in int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 1) in int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 2) in int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 3) in int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 4) in int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 5) in int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 6) in int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 7) in int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 8) in int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 9) in int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 10) in int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -layout(location = 11) in VertexData { +flat layout(location = 0) in ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 1) in ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 2) in ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +layout(location = 3) in VertexData { vec4 Peye; vec3 Neye; } inData[4]; -layout(location = 13) in PrimvarData { +layout(location = 5) in PrimvarData { vec3 points; vec3 normals; } inPrimvars[HD_NUM_PRIMITIVE_VERTS]; layout(location = 2) out vec4 gsPatchCoord; noperspective layout(location = 3) out vec3 hd_barycentricCoord; -flat layout(location = 7) out int gs_dc_modelCoord; -flat layout(location = 8) out int gs_dc_constantCoord; -flat layout(location = 9) out int gs_dc_elementCoord; -flat layout(location = 10) out int gs_dc_primitiveCoord; -flat layout(location = 11) out int gs_dc_fvarCoord; -flat layout(location = 12) out int gs_dc_shaderCoord; -flat layout(location = 13) out int gs_dc_vertexCoord; -flat layout(location = 14) out int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) out int gs_dc_varyingCoord; -flat layout(location = 16) out int gs_dc_instanceIndexI0; -flat layout(location = 17) out int gs_dc_instanceCoordsI0; +flat layout(location = 4) out ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) out ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) out ivec4 gs_interstageDrawingCoord2; layout(location = 0) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 4) out PrimvarData { +layout(location = 7) out PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -3629,16 +3573,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -3731,16 +3675,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -4391,22 +4335,14 @@ layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisi layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; layout(location = 2) in vec4 gsPatchCoord; noperspective layout(location = 3) in vec3 hd_barycentricCoord; -flat layout(location = 7) in int gs_dc_modelCoord; -flat layout(location = 8) in int gs_dc_constantCoord; -flat layout(location = 9) in int gs_dc_elementCoord; -flat layout(location = 10) in int gs_dc_primitiveCoord; -flat layout(location = 11) in int gs_dc_fvarCoord; -flat layout(location = 12) in int gs_dc_shaderCoord; -flat layout(location = 13) in int gs_dc_vertexCoord; -flat layout(location = 14) in int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) in int gs_dc_varyingCoord; -flat layout(location = 16) in int gs_dc_instanceIndexI0; -flat layout(location = 17) in int gs_dc_instanceCoordsI0; +flat layout(location = 4) in ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) in ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) in ivec4 gs_interstageDrawingCoord2; layout(location = 0) in VertexData { vec4 Peye; vec3 Neye; } inData; -layout(location = 4) in PrimvarData { +layout(location = 7) in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -4462,16 +4398,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_edgeonly_blendwireframe.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_edgeonly_blendwireframe.out index 97c1426762..bf10479360 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_edgeonly_blendwireframe.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_edgeonly_blendwireframe.out @@ -166,22 +166,14 @@ layout(location = 1) in vec3 normals; uint hd_VertexID = gl_VertexIndex; uint hd_InstanceID = gl_InstanceIndex; uint hd_BaseInstance = HgiGetBaseInstance(); -flat layout(location = 0) out int vs_dc_modelCoord; -flat layout(location = 1) out int vs_dc_constantCoord; -flat layout(location = 2) out int vs_dc_elementCoord; -flat layout(location = 3) out int vs_dc_primitiveCoord; -flat layout(location = 4) out int vs_dc_fvarCoord; -flat layout(location = 5) out int vs_dc_shaderCoord; -flat layout(location = 6) out int vs_dc_vertexCoord; -flat layout(location = 7) out int vs_dc_topologyVisibilityCoord; -flat layout(location = 8) out int vs_dc_varyingCoord; -flat layout(location = 9) out int vs_dc_instanceIndexI0; -flat layout(location = 10) out int vs_dc_instanceCoordsI0; -layout(location = 11) out VertexData { +flat layout(location = 0) out ivec4 vs_interstageDrawingCoord0; +flat layout(location = 1) out ivec4 vs_interstageDrawingCoord1; +flat layout(location = 2) out ivec4 vs_interstageDrawingCoord2; +layout(location = 3) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 13) out PrimvarData { +layout(location = 5) out PrimvarData { vec3 points; vec3 normals; } outPrimvars; @@ -253,16 +245,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -831,43 +823,27 @@ layout(std430, binding = 1) readonly buffer ssbo_primitiveParam { int primitiveP layout(std430, binding = 2) readonly buffer ssbo_edgeIndices { int edgeIndices[]; }; layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisibility[]; }; layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; -flat layout(location = 0) in int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 1) in int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 2) in int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 3) in int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 4) in int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 5) in int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 6) in int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 7) in int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 8) in int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 9) in int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 10) in int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -layout(location = 11) in VertexData { +flat layout(location = 0) in ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 1) in ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 2) in ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +layout(location = 3) in VertexData { vec4 Peye; vec3 Neye; } inData[3]; -layout(location = 13) in PrimvarData { +layout(location = 5) in PrimvarData { vec3 points; vec3 normals; } inPrimvars[HD_NUM_PRIMITIVE_VERTS]; layout(location = 2) out vec4 gsPatchCoord; noperspective layout(location = 3) out vec3 hd_barycentricCoord; -flat layout(location = 7) out int gs_dc_modelCoord; -flat layout(location = 8) out int gs_dc_constantCoord; -flat layout(location = 9) out int gs_dc_elementCoord; -flat layout(location = 10) out int gs_dc_primitiveCoord; -flat layout(location = 11) out int gs_dc_fvarCoord; -flat layout(location = 12) out int gs_dc_shaderCoord; -flat layout(location = 13) out int gs_dc_vertexCoord; -flat layout(location = 14) out int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) out int gs_dc_varyingCoord; -flat layout(location = 16) out int gs_dc_instanceIndexI0; -flat layout(location = 17) out int gs_dc_instanceCoordsI0; +flat layout(location = 4) out ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) out ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) out ivec4 gs_interstageDrawingCoord2; layout(location = 0) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 4) out PrimvarData { +layout(location = 7) out PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -918,16 +894,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -1020,16 +996,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -1651,22 +1627,14 @@ layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisi layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; layout(location = 2) in vec4 gsPatchCoord; noperspective layout(location = 3) in vec3 hd_barycentricCoord; -flat layout(location = 7) in int gs_dc_modelCoord; -flat layout(location = 8) in int gs_dc_constantCoord; -flat layout(location = 9) in int gs_dc_elementCoord; -flat layout(location = 10) in int gs_dc_primitiveCoord; -flat layout(location = 11) in int gs_dc_fvarCoord; -flat layout(location = 12) in int gs_dc_shaderCoord; -flat layout(location = 13) in int gs_dc_vertexCoord; -flat layout(location = 14) in int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) in int gs_dc_varyingCoord; -flat layout(location = 16) in int gs_dc_instanceIndexI0; -flat layout(location = 17) in int gs_dc_instanceCoordsI0; +flat layout(location = 4) in ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) in ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) in ivec4 gs_interstageDrawingCoord2; layout(location = 0) in VertexData { vec4 Peye; vec3 Neye; } inData; -layout(location = 4) in PrimvarData { +layout(location = 7) in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -1722,16 +1690,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -2883,22 +2851,14 @@ layout(location = 1) in vec3 normals; uint hd_VertexID = gl_VertexIndex; uint hd_InstanceID = gl_InstanceIndex; uint hd_BaseInstance = HgiGetBaseInstance(); -flat layout(location = 0) out int vs_dc_modelCoord; -flat layout(location = 1) out int vs_dc_constantCoord; -flat layout(location = 2) out int vs_dc_elementCoord; -flat layout(location = 3) out int vs_dc_primitiveCoord; -flat layout(location = 4) out int vs_dc_fvarCoord; -flat layout(location = 5) out int vs_dc_shaderCoord; -flat layout(location = 6) out int vs_dc_vertexCoord; -flat layout(location = 7) out int vs_dc_topologyVisibilityCoord; -flat layout(location = 8) out int vs_dc_varyingCoord; -flat layout(location = 9) out int vs_dc_instanceIndexI0; -flat layout(location = 10) out int vs_dc_instanceCoordsI0; -layout(location = 11) out VertexData { +flat layout(location = 0) out ivec4 vs_interstageDrawingCoord0; +flat layout(location = 1) out ivec4 vs_interstageDrawingCoord1; +flat layout(location = 2) out ivec4 vs_interstageDrawingCoord2; +layout(location = 3) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 13) out PrimvarData { +layout(location = 5) out PrimvarData { vec3 points; vec3 normals; } outPrimvars; @@ -2970,16 +2930,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -3548,43 +3508,27 @@ layout(std430, binding = 1) readonly buffer ssbo_primitiveParam { int primitiveP layout(std430, binding = 2) readonly buffer ssbo_edgeIndices { ivec2 edgeIndices[]; }; layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisibility[]; }; layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; -flat layout(location = 0) in int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 1) in int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 2) in int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 3) in int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 4) in int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 5) in int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 6) in int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 7) in int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 8) in int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 9) in int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 10) in int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -layout(location = 11) in VertexData { +flat layout(location = 0) in ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 1) in ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 2) in ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +layout(location = 3) in VertexData { vec4 Peye; vec3 Neye; } inData[4]; -layout(location = 13) in PrimvarData { +layout(location = 5) in PrimvarData { vec3 points; vec3 normals; } inPrimvars[HD_NUM_PRIMITIVE_VERTS]; layout(location = 2) out vec4 gsPatchCoord; noperspective layout(location = 3) out vec3 hd_barycentricCoord; -flat layout(location = 7) out int gs_dc_modelCoord; -flat layout(location = 8) out int gs_dc_constantCoord; -flat layout(location = 9) out int gs_dc_elementCoord; -flat layout(location = 10) out int gs_dc_primitiveCoord; -flat layout(location = 11) out int gs_dc_fvarCoord; -flat layout(location = 12) out int gs_dc_shaderCoord; -flat layout(location = 13) out int gs_dc_vertexCoord; -flat layout(location = 14) out int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) out int gs_dc_varyingCoord; -flat layout(location = 16) out int gs_dc_instanceIndexI0; -flat layout(location = 17) out int gs_dc_instanceCoordsI0; +flat layout(location = 4) out ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) out ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) out ivec4 gs_interstageDrawingCoord2; layout(location = 0) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 4) out PrimvarData { +layout(location = 7) out PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -3635,16 +3579,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -3737,16 +3681,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -4397,22 +4341,14 @@ layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisi layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; layout(location = 2) in vec4 gsPatchCoord; noperspective layout(location = 3) in vec3 hd_barycentricCoord; -flat layout(location = 7) in int gs_dc_modelCoord; -flat layout(location = 8) in int gs_dc_constantCoord; -flat layout(location = 9) in int gs_dc_elementCoord; -flat layout(location = 10) in int gs_dc_primitiveCoord; -flat layout(location = 11) in int gs_dc_fvarCoord; -flat layout(location = 12) in int gs_dc_shaderCoord; -flat layout(location = 13) in int gs_dc_vertexCoord; -flat layout(location = 14) in int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) in int gs_dc_varyingCoord; -flat layout(location = 16) in int gs_dc_instanceIndexI0; -flat layout(location = 17) in int gs_dc_instanceCoordsI0; +flat layout(location = 4) in ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) in ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) in ivec4 gs_interstageDrawingCoord2; layout(location = 0) in VertexData { vec4 Peye; vec3 Neye; } inData; -layout(location = 4) in PrimvarData { +layout(location = 7) in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -4468,16 +4404,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect.out index ccc3bbfadc..f95f474377 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect.out @@ -166,22 +166,14 @@ layout(location = 1) in vec3 normals; uint hd_VertexID = gl_VertexIndex; uint hd_InstanceID = gl_InstanceIndex; uint hd_BaseInstance = HgiGetBaseInstance(); -flat layout(location = 0) out int vs_dc_modelCoord; -flat layout(location = 1) out int vs_dc_constantCoord; -flat layout(location = 2) out int vs_dc_elementCoord; -flat layout(location = 3) out int vs_dc_primitiveCoord; -flat layout(location = 4) out int vs_dc_fvarCoord; -flat layout(location = 5) out int vs_dc_shaderCoord; -flat layout(location = 6) out int vs_dc_vertexCoord; -flat layout(location = 7) out int vs_dc_topologyVisibilityCoord; -flat layout(location = 8) out int vs_dc_varyingCoord; -flat layout(location = 9) out int vs_dc_instanceIndexI0; -flat layout(location = 10) out int vs_dc_instanceCoordsI0; -layout(location = 11) out VertexData { +flat layout(location = 0) out ivec4 vs_interstageDrawingCoord0; +flat layout(location = 1) out ivec4 vs_interstageDrawingCoord1; +flat layout(location = 2) out ivec4 vs_interstageDrawingCoord2; +layout(location = 3) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 13) out PrimvarData { +layout(location = 5) out PrimvarData { vec3 points; vec3 normals; } outPrimvars; @@ -253,16 +245,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -831,43 +823,27 @@ layout(std430, binding = 1) readonly buffer ssbo_primitiveParam { int primitiveP layout(std430, binding = 2) readonly buffer ssbo_edgeIndices { int edgeIndices[]; }; layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisibility[]; }; layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; -flat layout(location = 0) in int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 1) in int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 2) in int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 3) in int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 4) in int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 5) in int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 6) in int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 7) in int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 8) in int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 9) in int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 10) in int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -layout(location = 11) in VertexData { +flat layout(location = 0) in ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 1) in ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 2) in ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +layout(location = 3) in VertexData { vec4 Peye; vec3 Neye; } inData[3]; -layout(location = 13) in PrimvarData { +layout(location = 5) in PrimvarData { vec3 points; vec3 normals; } inPrimvars[HD_NUM_PRIMITIVE_VERTS]; layout(location = 2) out vec4 gsPatchCoord; noperspective layout(location = 3) out vec3 hd_barycentricCoord; -flat layout(location = 7) out int gs_dc_modelCoord; -flat layout(location = 8) out int gs_dc_constantCoord; -flat layout(location = 9) out int gs_dc_elementCoord; -flat layout(location = 10) out int gs_dc_primitiveCoord; -flat layout(location = 11) out int gs_dc_fvarCoord; -flat layout(location = 12) out int gs_dc_shaderCoord; -flat layout(location = 13) out int gs_dc_vertexCoord; -flat layout(location = 14) out int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) out int gs_dc_varyingCoord; -flat layout(location = 16) out int gs_dc_instanceIndexI0; -flat layout(location = 17) out int gs_dc_instanceCoordsI0; +flat layout(location = 4) out ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) out ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) out ivec4 gs_interstageDrawingCoord2; layout(location = 0) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 4) out PrimvarData { +layout(location = 7) out PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -918,16 +894,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -1020,16 +996,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -1651,22 +1627,14 @@ layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisi layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; layout(location = 2) in vec4 gsPatchCoord; noperspective layout(location = 3) in vec3 hd_barycentricCoord; -flat layout(location = 7) in int gs_dc_modelCoord; -flat layout(location = 8) in int gs_dc_constantCoord; -flat layout(location = 9) in int gs_dc_elementCoord; -flat layout(location = 10) in int gs_dc_primitiveCoord; -flat layout(location = 11) in int gs_dc_fvarCoord; -flat layout(location = 12) in int gs_dc_shaderCoord; -flat layout(location = 13) in int gs_dc_vertexCoord; -flat layout(location = 14) in int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) in int gs_dc_varyingCoord; -flat layout(location = 16) in int gs_dc_instanceIndexI0; -flat layout(location = 17) in int gs_dc_instanceCoordsI0; +flat layout(location = 4) in ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) in ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) in ivec4 gs_interstageDrawingCoord2; layout(location = 0) in VertexData { vec4 Peye; vec3 Neye; } inData; -layout(location = 4) in PrimvarData { +layout(location = 7) in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -1722,16 +1690,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -2828,22 +2796,14 @@ layout(location = 1) in vec3 normals; uint hd_VertexID = gl_VertexIndex; uint hd_InstanceID = gl_InstanceIndex; uint hd_BaseInstance = HgiGetBaseInstance(); -flat layout(location = 0) out int vs_dc_modelCoord; -flat layout(location = 1) out int vs_dc_constantCoord; -flat layout(location = 2) out int vs_dc_elementCoord; -flat layout(location = 3) out int vs_dc_primitiveCoord; -flat layout(location = 4) out int vs_dc_fvarCoord; -flat layout(location = 5) out int vs_dc_shaderCoord; -flat layout(location = 6) out int vs_dc_vertexCoord; -flat layout(location = 7) out int vs_dc_topologyVisibilityCoord; -flat layout(location = 8) out int vs_dc_varyingCoord; -flat layout(location = 9) out int vs_dc_instanceIndexI0; -flat layout(location = 10) out int vs_dc_instanceCoordsI0; -layout(location = 11) out VertexData { +flat layout(location = 0) out ivec4 vs_interstageDrawingCoord0; +flat layout(location = 1) out ivec4 vs_interstageDrawingCoord1; +flat layout(location = 2) out ivec4 vs_interstageDrawingCoord2; +layout(location = 3) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 13) out PrimvarData { +layout(location = 5) out PrimvarData { vec3 points; vec3 normals; } outPrimvars; @@ -2915,16 +2875,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -3493,43 +3453,27 @@ layout(std430, binding = 1) readonly buffer ssbo_primitiveParam { int primitiveP layout(std430, binding = 2) readonly buffer ssbo_edgeIndices { ivec2 edgeIndices[]; }; layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisibility[]; }; layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; -flat layout(location = 0) in int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 1) in int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 2) in int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 3) in int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 4) in int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 5) in int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 6) in int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 7) in int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 8) in int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 9) in int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 10) in int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -layout(location = 11) in VertexData { +flat layout(location = 0) in ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 1) in ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 2) in ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +layout(location = 3) in VertexData { vec4 Peye; vec3 Neye; } inData[4]; -layout(location = 13) in PrimvarData { +layout(location = 5) in PrimvarData { vec3 points; vec3 normals; } inPrimvars[HD_NUM_PRIMITIVE_VERTS]; layout(location = 2) out vec4 gsPatchCoord; noperspective layout(location = 3) out vec3 hd_barycentricCoord; -flat layout(location = 7) out int gs_dc_modelCoord; -flat layout(location = 8) out int gs_dc_constantCoord; -flat layout(location = 9) out int gs_dc_elementCoord; -flat layout(location = 10) out int gs_dc_primitiveCoord; -flat layout(location = 11) out int gs_dc_fvarCoord; -flat layout(location = 12) out int gs_dc_shaderCoord; -flat layout(location = 13) out int gs_dc_vertexCoord; -flat layout(location = 14) out int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) out int gs_dc_varyingCoord; -flat layout(location = 16) out int gs_dc_instanceIndexI0; -flat layout(location = 17) out int gs_dc_instanceCoordsI0; +flat layout(location = 4) out ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) out ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) out ivec4 gs_interstageDrawingCoord2; layout(location = 0) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 4) out PrimvarData { +layout(location = 7) out PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -3580,16 +3524,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -3682,16 +3626,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -4342,22 +4286,14 @@ layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisi layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; layout(location = 2) in vec4 gsPatchCoord; noperspective layout(location = 3) in vec3 hd_barycentricCoord; -flat layout(location = 7) in int gs_dc_modelCoord; -flat layout(location = 8) in int gs_dc_constantCoord; -flat layout(location = 9) in int gs_dc_elementCoord; -flat layout(location = 10) in int gs_dc_primitiveCoord; -flat layout(location = 11) in int gs_dc_fvarCoord; -flat layout(location = 12) in int gs_dc_shaderCoord; -flat layout(location = 13) in int gs_dc_vertexCoord; -flat layout(location = 14) in int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) in int gs_dc_varyingCoord; -flat layout(location = 16) in int gs_dc_instanceIndexI0; -flat layout(location = 17) in int gs_dc_instanceCoordsI0; +flat layout(location = 4) in ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) in ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) in ivec4 gs_interstageDrawingCoord2; layout(location = 0) in VertexData { vec4 Peye; vec3 Neye; } inData; -layout(location = 4) in PrimvarData { +layout(location = 7) in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -4413,16 +4349,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_doubleSided.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_doubleSided.out index d5bfce162e..3ca7b27104 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_doubleSided.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_doubleSided.out @@ -166,22 +166,14 @@ layout(location = 1) in vec3 normals; uint hd_VertexID = gl_VertexIndex; uint hd_InstanceID = gl_InstanceIndex; uint hd_BaseInstance = HgiGetBaseInstance(); -flat layout(location = 0) out int vs_dc_modelCoord; -flat layout(location = 1) out int vs_dc_constantCoord; -flat layout(location = 2) out int vs_dc_elementCoord; -flat layout(location = 3) out int vs_dc_primitiveCoord; -flat layout(location = 4) out int vs_dc_fvarCoord; -flat layout(location = 5) out int vs_dc_shaderCoord; -flat layout(location = 6) out int vs_dc_vertexCoord; -flat layout(location = 7) out int vs_dc_topologyVisibilityCoord; -flat layout(location = 8) out int vs_dc_varyingCoord; -flat layout(location = 9) out int vs_dc_instanceIndexI0; -flat layout(location = 10) out int vs_dc_instanceCoordsI0; -layout(location = 11) out VertexData { +flat layout(location = 0) out ivec4 vs_interstageDrawingCoord0; +flat layout(location = 1) out ivec4 vs_interstageDrawingCoord1; +flat layout(location = 2) out ivec4 vs_interstageDrawingCoord2; +layout(location = 3) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 13) out PrimvarData { +layout(location = 5) out PrimvarData { vec3 points; vec3 normals; } outPrimvars; @@ -253,16 +245,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -831,43 +823,27 @@ layout(std430, binding = 1) readonly buffer ssbo_primitiveParam { int primitiveP layout(std430, binding = 2) readonly buffer ssbo_edgeIndices { int edgeIndices[]; }; layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisibility[]; }; layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; -flat layout(location = 0) in int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 1) in int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 2) in int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 3) in int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 4) in int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 5) in int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 6) in int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 7) in int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 8) in int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 9) in int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 10) in int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -layout(location = 11) in VertexData { +flat layout(location = 0) in ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 1) in ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 2) in ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +layout(location = 3) in VertexData { vec4 Peye; vec3 Neye; } inData[3]; -layout(location = 13) in PrimvarData { +layout(location = 5) in PrimvarData { vec3 points; vec3 normals; } inPrimvars[HD_NUM_PRIMITIVE_VERTS]; layout(location = 2) out vec4 gsPatchCoord; noperspective layout(location = 3) out vec3 hd_barycentricCoord; -flat layout(location = 7) out int gs_dc_modelCoord; -flat layout(location = 8) out int gs_dc_constantCoord; -flat layout(location = 9) out int gs_dc_elementCoord; -flat layout(location = 10) out int gs_dc_primitiveCoord; -flat layout(location = 11) out int gs_dc_fvarCoord; -flat layout(location = 12) out int gs_dc_shaderCoord; -flat layout(location = 13) out int gs_dc_vertexCoord; -flat layout(location = 14) out int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) out int gs_dc_varyingCoord; -flat layout(location = 16) out int gs_dc_instanceIndexI0; -flat layout(location = 17) out int gs_dc_instanceCoordsI0; +flat layout(location = 4) out ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) out ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) out ivec4 gs_interstageDrawingCoord2; layout(location = 0) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 4) out PrimvarData { +layout(location = 7) out PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -918,16 +894,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -1020,16 +996,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -1651,22 +1627,14 @@ layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisi layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; layout(location = 2) in vec4 gsPatchCoord; noperspective layout(location = 3) in vec3 hd_barycentricCoord; -flat layout(location = 7) in int gs_dc_modelCoord; -flat layout(location = 8) in int gs_dc_constantCoord; -flat layout(location = 9) in int gs_dc_elementCoord; -flat layout(location = 10) in int gs_dc_primitiveCoord; -flat layout(location = 11) in int gs_dc_fvarCoord; -flat layout(location = 12) in int gs_dc_shaderCoord; -flat layout(location = 13) in int gs_dc_vertexCoord; -flat layout(location = 14) in int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) in int gs_dc_varyingCoord; -flat layout(location = 16) in int gs_dc_instanceIndexI0; -flat layout(location = 17) in int gs_dc_instanceCoordsI0; +flat layout(location = 4) in ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) in ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) in ivec4 gs_interstageDrawingCoord2; layout(location = 0) in VertexData { vec4 Peye; vec3 Neye; } inData; -layout(location = 4) in PrimvarData { +layout(location = 7) in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -1722,16 +1690,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -2827,22 +2795,14 @@ layout(location = 1) in vec3 normals; uint hd_VertexID = gl_VertexIndex; uint hd_InstanceID = gl_InstanceIndex; uint hd_BaseInstance = HgiGetBaseInstance(); -flat layout(location = 0) out int vs_dc_modelCoord; -flat layout(location = 1) out int vs_dc_constantCoord; -flat layout(location = 2) out int vs_dc_elementCoord; -flat layout(location = 3) out int vs_dc_primitiveCoord; -flat layout(location = 4) out int vs_dc_fvarCoord; -flat layout(location = 5) out int vs_dc_shaderCoord; -flat layout(location = 6) out int vs_dc_vertexCoord; -flat layout(location = 7) out int vs_dc_topologyVisibilityCoord; -flat layout(location = 8) out int vs_dc_varyingCoord; -flat layout(location = 9) out int vs_dc_instanceIndexI0; -flat layout(location = 10) out int vs_dc_instanceCoordsI0; -layout(location = 11) out VertexData { +flat layout(location = 0) out ivec4 vs_interstageDrawingCoord0; +flat layout(location = 1) out ivec4 vs_interstageDrawingCoord1; +flat layout(location = 2) out ivec4 vs_interstageDrawingCoord2; +layout(location = 3) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 13) out PrimvarData { +layout(location = 5) out PrimvarData { vec3 points; vec3 normals; } outPrimvars; @@ -2914,16 +2874,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -3492,43 +3452,27 @@ layout(std430, binding = 1) readonly buffer ssbo_primitiveParam { int primitiveP layout(std430, binding = 2) readonly buffer ssbo_edgeIndices { ivec2 edgeIndices[]; }; layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisibility[]; }; layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; -flat layout(location = 0) in int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 1) in int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 2) in int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 3) in int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 4) in int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 5) in int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 6) in int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 7) in int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 8) in int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 9) in int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 10) in int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -layout(location = 11) in VertexData { +flat layout(location = 0) in ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 1) in ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 2) in ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +layout(location = 3) in VertexData { vec4 Peye; vec3 Neye; } inData[4]; -layout(location = 13) in PrimvarData { +layout(location = 5) in PrimvarData { vec3 points; vec3 normals; } inPrimvars[HD_NUM_PRIMITIVE_VERTS]; layout(location = 2) out vec4 gsPatchCoord; noperspective layout(location = 3) out vec3 hd_barycentricCoord; -flat layout(location = 7) out int gs_dc_modelCoord; -flat layout(location = 8) out int gs_dc_constantCoord; -flat layout(location = 9) out int gs_dc_elementCoord; -flat layout(location = 10) out int gs_dc_primitiveCoord; -flat layout(location = 11) out int gs_dc_fvarCoord; -flat layout(location = 12) out int gs_dc_shaderCoord; -flat layout(location = 13) out int gs_dc_vertexCoord; -flat layout(location = 14) out int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) out int gs_dc_varyingCoord; -flat layout(location = 16) out int gs_dc_instanceIndexI0; -flat layout(location = 17) out int gs_dc_instanceCoordsI0; +flat layout(location = 4) out ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) out ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) out ivec4 gs_interstageDrawingCoord2; layout(location = 0) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 4) out PrimvarData { +layout(location = 7) out PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -3579,16 +3523,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -3681,16 +3625,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -4341,22 +4285,14 @@ layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisi layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; layout(location = 2) in vec4 gsPatchCoord; noperspective layout(location = 3) in vec3 hd_barycentricCoord; -flat layout(location = 7) in int gs_dc_modelCoord; -flat layout(location = 8) in int gs_dc_constantCoord; -flat layout(location = 9) in int gs_dc_elementCoord; -flat layout(location = 10) in int gs_dc_primitiveCoord; -flat layout(location = 11) in int gs_dc_fvarCoord; -flat layout(location = 12) in int gs_dc_shaderCoord; -flat layout(location = 13) in int gs_dc_vertexCoord; -flat layout(location = 14) in int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) in int gs_dc_varyingCoord; -flat layout(location = 16) in int gs_dc_instanceIndexI0; -flat layout(location = 17) in int gs_dc_instanceCoordsI0; +flat layout(location = 4) in ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) in ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) in ivec4 gs_interstageDrawingCoord2; layout(location = 0) in VertexData { vec4 Peye; vec3 Neye; } inData; -layout(location = 4) in PrimvarData { +layout(location = 7) in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -4412,16 +4348,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_faceVarying.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_faceVarying.out index ccc3bbfadc..f95f474377 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_faceVarying.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_faceVarying.out @@ -166,22 +166,14 @@ layout(location = 1) in vec3 normals; uint hd_VertexID = gl_VertexIndex; uint hd_InstanceID = gl_InstanceIndex; uint hd_BaseInstance = HgiGetBaseInstance(); -flat layout(location = 0) out int vs_dc_modelCoord; -flat layout(location = 1) out int vs_dc_constantCoord; -flat layout(location = 2) out int vs_dc_elementCoord; -flat layout(location = 3) out int vs_dc_primitiveCoord; -flat layout(location = 4) out int vs_dc_fvarCoord; -flat layout(location = 5) out int vs_dc_shaderCoord; -flat layout(location = 6) out int vs_dc_vertexCoord; -flat layout(location = 7) out int vs_dc_topologyVisibilityCoord; -flat layout(location = 8) out int vs_dc_varyingCoord; -flat layout(location = 9) out int vs_dc_instanceIndexI0; -flat layout(location = 10) out int vs_dc_instanceCoordsI0; -layout(location = 11) out VertexData { +flat layout(location = 0) out ivec4 vs_interstageDrawingCoord0; +flat layout(location = 1) out ivec4 vs_interstageDrawingCoord1; +flat layout(location = 2) out ivec4 vs_interstageDrawingCoord2; +layout(location = 3) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 13) out PrimvarData { +layout(location = 5) out PrimvarData { vec3 points; vec3 normals; } outPrimvars; @@ -253,16 +245,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -831,43 +823,27 @@ layout(std430, binding = 1) readonly buffer ssbo_primitiveParam { int primitiveP layout(std430, binding = 2) readonly buffer ssbo_edgeIndices { int edgeIndices[]; }; layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisibility[]; }; layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; -flat layout(location = 0) in int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 1) in int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 2) in int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 3) in int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 4) in int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 5) in int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 6) in int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 7) in int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 8) in int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 9) in int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 10) in int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -layout(location = 11) in VertexData { +flat layout(location = 0) in ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 1) in ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 2) in ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +layout(location = 3) in VertexData { vec4 Peye; vec3 Neye; } inData[3]; -layout(location = 13) in PrimvarData { +layout(location = 5) in PrimvarData { vec3 points; vec3 normals; } inPrimvars[HD_NUM_PRIMITIVE_VERTS]; layout(location = 2) out vec4 gsPatchCoord; noperspective layout(location = 3) out vec3 hd_barycentricCoord; -flat layout(location = 7) out int gs_dc_modelCoord; -flat layout(location = 8) out int gs_dc_constantCoord; -flat layout(location = 9) out int gs_dc_elementCoord; -flat layout(location = 10) out int gs_dc_primitiveCoord; -flat layout(location = 11) out int gs_dc_fvarCoord; -flat layout(location = 12) out int gs_dc_shaderCoord; -flat layout(location = 13) out int gs_dc_vertexCoord; -flat layout(location = 14) out int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) out int gs_dc_varyingCoord; -flat layout(location = 16) out int gs_dc_instanceIndexI0; -flat layout(location = 17) out int gs_dc_instanceCoordsI0; +flat layout(location = 4) out ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) out ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) out ivec4 gs_interstageDrawingCoord2; layout(location = 0) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 4) out PrimvarData { +layout(location = 7) out PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -918,16 +894,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -1020,16 +996,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -1651,22 +1627,14 @@ layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisi layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; layout(location = 2) in vec4 gsPatchCoord; noperspective layout(location = 3) in vec3 hd_barycentricCoord; -flat layout(location = 7) in int gs_dc_modelCoord; -flat layout(location = 8) in int gs_dc_constantCoord; -flat layout(location = 9) in int gs_dc_elementCoord; -flat layout(location = 10) in int gs_dc_primitiveCoord; -flat layout(location = 11) in int gs_dc_fvarCoord; -flat layout(location = 12) in int gs_dc_shaderCoord; -flat layout(location = 13) in int gs_dc_vertexCoord; -flat layout(location = 14) in int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) in int gs_dc_varyingCoord; -flat layout(location = 16) in int gs_dc_instanceIndexI0; -flat layout(location = 17) in int gs_dc_instanceCoordsI0; +flat layout(location = 4) in ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) in ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) in ivec4 gs_interstageDrawingCoord2; layout(location = 0) in VertexData { vec4 Peye; vec3 Neye; } inData; -layout(location = 4) in PrimvarData { +layout(location = 7) in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -1722,16 +1690,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -2828,22 +2796,14 @@ layout(location = 1) in vec3 normals; uint hd_VertexID = gl_VertexIndex; uint hd_InstanceID = gl_InstanceIndex; uint hd_BaseInstance = HgiGetBaseInstance(); -flat layout(location = 0) out int vs_dc_modelCoord; -flat layout(location = 1) out int vs_dc_constantCoord; -flat layout(location = 2) out int vs_dc_elementCoord; -flat layout(location = 3) out int vs_dc_primitiveCoord; -flat layout(location = 4) out int vs_dc_fvarCoord; -flat layout(location = 5) out int vs_dc_shaderCoord; -flat layout(location = 6) out int vs_dc_vertexCoord; -flat layout(location = 7) out int vs_dc_topologyVisibilityCoord; -flat layout(location = 8) out int vs_dc_varyingCoord; -flat layout(location = 9) out int vs_dc_instanceIndexI0; -flat layout(location = 10) out int vs_dc_instanceCoordsI0; -layout(location = 11) out VertexData { +flat layout(location = 0) out ivec4 vs_interstageDrawingCoord0; +flat layout(location = 1) out ivec4 vs_interstageDrawingCoord1; +flat layout(location = 2) out ivec4 vs_interstageDrawingCoord2; +layout(location = 3) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 13) out PrimvarData { +layout(location = 5) out PrimvarData { vec3 points; vec3 normals; } outPrimvars; @@ -2915,16 +2875,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -3493,43 +3453,27 @@ layout(std430, binding = 1) readonly buffer ssbo_primitiveParam { int primitiveP layout(std430, binding = 2) readonly buffer ssbo_edgeIndices { ivec2 edgeIndices[]; }; layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisibility[]; }; layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; -flat layout(location = 0) in int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 1) in int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 2) in int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 3) in int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 4) in int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 5) in int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 6) in int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 7) in int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 8) in int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 9) in int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 10) in int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -layout(location = 11) in VertexData { +flat layout(location = 0) in ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 1) in ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 2) in ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +layout(location = 3) in VertexData { vec4 Peye; vec3 Neye; } inData[4]; -layout(location = 13) in PrimvarData { +layout(location = 5) in PrimvarData { vec3 points; vec3 normals; } inPrimvars[HD_NUM_PRIMITIVE_VERTS]; layout(location = 2) out vec4 gsPatchCoord; noperspective layout(location = 3) out vec3 hd_barycentricCoord; -flat layout(location = 7) out int gs_dc_modelCoord; -flat layout(location = 8) out int gs_dc_constantCoord; -flat layout(location = 9) out int gs_dc_elementCoord; -flat layout(location = 10) out int gs_dc_primitiveCoord; -flat layout(location = 11) out int gs_dc_fvarCoord; -flat layout(location = 12) out int gs_dc_shaderCoord; -flat layout(location = 13) out int gs_dc_vertexCoord; -flat layout(location = 14) out int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) out int gs_dc_varyingCoord; -flat layout(location = 16) out int gs_dc_instanceIndexI0; -flat layout(location = 17) out int gs_dc_instanceCoordsI0; +flat layout(location = 4) out ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) out ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) out ivec4 gs_interstageDrawingCoord2; layout(location = 0) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 4) out PrimvarData { +layout(location = 7) out PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -3580,16 +3524,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -3682,16 +3626,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -4342,22 +4286,14 @@ layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisi layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; layout(location = 2) in vec4 gsPatchCoord; noperspective layout(location = 3) in vec3 hd_barycentricCoord; -flat layout(location = 7) in int gs_dc_modelCoord; -flat layout(location = 8) in int gs_dc_constantCoord; -flat layout(location = 9) in int gs_dc_elementCoord; -flat layout(location = 10) in int gs_dc_primitiveCoord; -flat layout(location = 11) in int gs_dc_fvarCoord; -flat layout(location = 12) in int gs_dc_shaderCoord; -flat layout(location = 13) in int gs_dc_vertexCoord; -flat layout(location = 14) in int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) in int gs_dc_varyingCoord; -flat layout(location = 16) in int gs_dc_instanceIndexI0; -flat layout(location = 17) in int gs_dc_instanceCoordsI0; +flat layout(location = 4) in ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) in ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) in ivec4 gs_interstageDrawingCoord2; layout(location = 0) in VertexData { vec4 Peye; vec3 Neye; } inData; -layout(location = 4) in PrimvarData { +layout(location = 7) in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -4413,16 +4349,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_instance.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_instance.out index 067d4f433a..607e326867 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_instance.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_instance.out @@ -172,24 +172,15 @@ layout(location = 1) in vec3 normals; uint hd_VertexID = gl_VertexIndex; uint hd_InstanceID = gl_InstanceIndex; uint hd_BaseInstance = HgiGetBaseInstance(); -flat layout(location = 0) out int vs_dc_modelCoord; -flat layout(location = 1) out int vs_dc_constantCoord; -flat layout(location = 2) out int vs_dc_elementCoord; -flat layout(location = 3) out int vs_dc_primitiveCoord; -flat layout(location = 4) out int vs_dc_fvarCoord; -flat layout(location = 5) out int vs_dc_shaderCoord; -flat layout(location = 6) out int vs_dc_vertexCoord; -flat layout(location = 7) out int vs_dc_topologyVisibilityCoord; -flat layout(location = 8) out int vs_dc_varyingCoord; -flat layout(location = 9) out int vs_dc_instanceIndexI0; -flat layout(location = 10) out int vs_dc_instanceIndexI1; -flat layout(location = 11) out int vs_dc_instanceCoordsI0; -flat layout(location = 12) out int vs_dc_instanceCoordsI1; -layout(location = 13) out VertexData { +flat layout(location = 0) out ivec4 vs_interstageDrawingCoord0; +flat layout(location = 1) out ivec4 vs_interstageDrawingCoord1; +flat layout(location = 2) out ivec4 vs_interstageDrawingCoord2; +flat layout(location = 3) out ivec4 vs_interstageDrawingCoord3; +layout(location = 4) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 15) out PrimvarData { +layout(location = 6) out PrimvarData { vec3 points; vec3 normals; } outPrimvars; @@ -302,18 +293,18 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; - vs_dc_instanceIndexI1 = dc.instanceIndex[1]; - vs_dc_instanceCoordsI0 = dc.instanceCoords[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; + vs_interstageDrawingCoord2[2] = dc.instanceIndex[1]; + vs_interstageDrawingCoord2[3] = dc.instanceCoords[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -887,47 +878,29 @@ layout(std430, binding = 2) readonly buffer ssbo_primitiveParam { int primitiveP layout(std430, binding = 3) readonly buffer ssbo_edgeIndices { int edgeIndices[]; }; layout(std430, binding = 4) readonly buffer ssbo_faceVisibility { float faceVisibility[]; }; layout(std430, binding = 5) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; -flat layout(location = 0) in int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 1) in int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 2) in int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 3) in int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 4) in int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 5) in int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 6) in int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 7) in int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 8) in int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 9) in int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 10) in int vs_dc_instanceIndexI1[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 11) in int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 12) in int vs_dc_instanceCoordsI1[HD_NUM_PRIMITIVE_VERTS]; -layout(location = 13) in VertexData { +flat layout(location = 0) in ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 1) in ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 2) in ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 3) in ivec4 vs_interstageDrawingCoord3[HD_NUM_PRIMITIVE_VERTS]; +layout(location = 4) in VertexData { vec4 Peye; vec3 Neye; } inData[3]; -layout(location = 15) in PrimvarData { +layout(location = 6) in PrimvarData { vec3 points; vec3 normals; } inPrimvars[HD_NUM_PRIMITIVE_VERTS]; layout(location = 2) out vec4 gsPatchCoord; noperspective layout(location = 3) out vec3 hd_barycentricCoord; -flat layout(location = 7) out int gs_dc_modelCoord; -flat layout(location = 8) out int gs_dc_constantCoord; -flat layout(location = 9) out int gs_dc_elementCoord; -flat layout(location = 10) out int gs_dc_primitiveCoord; -flat layout(location = 11) out int gs_dc_fvarCoord; -flat layout(location = 12) out int gs_dc_shaderCoord; -flat layout(location = 13) out int gs_dc_vertexCoord; -flat layout(location = 14) out int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) out int gs_dc_varyingCoord; -flat layout(location = 16) out int gs_dc_instanceIndexI0; -flat layout(location = 17) out int gs_dc_instanceIndexI1; -flat layout(location = 18) out int gs_dc_instanceCoordsI0; -flat layout(location = 19) out int gs_dc_instanceCoordsI1; +flat layout(location = 4) out ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) out ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) out ivec4 gs_interstageDrawingCoord2; +flat layout(location = 7) out ivec4 gs_interstageDrawingCoord3; layout(location = 0) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 4) out PrimvarData { +layout(location = 8) out PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -996,18 +969,18 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; - dc.instanceIndex[1] = vs_dc_instanceIndexI1[0]; - dc.instanceCoords[0] = vs_dc_instanceCoordsI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; + dc.instanceIndex[1] = vs_interstageDrawingCoord2[0][2]; + dc.instanceCoords[0] = vs_interstageDrawingCoord2[0][3]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -1100,18 +1073,18 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; - gs_dc_instanceIndexI1 = dc.instanceIndex[1]; - gs_dc_instanceCoordsI0 = dc.instanceCoords[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; + gs_interstageDrawingCoord2[2] = dc.instanceIndex[1]; + gs_interstageDrawingCoord2[3] = dc.instanceCoords[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -1738,24 +1711,15 @@ layout(std430, binding = 4) readonly buffer ssbo_faceVisibility { float faceVisi layout(std430, binding = 5) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; layout(location = 2) in vec4 gsPatchCoord; noperspective layout(location = 3) in vec3 hd_barycentricCoord; -flat layout(location = 7) in int gs_dc_modelCoord; -flat layout(location = 8) in int gs_dc_constantCoord; -flat layout(location = 9) in int gs_dc_elementCoord; -flat layout(location = 10) in int gs_dc_primitiveCoord; -flat layout(location = 11) in int gs_dc_fvarCoord; -flat layout(location = 12) in int gs_dc_shaderCoord; -flat layout(location = 13) in int gs_dc_vertexCoord; -flat layout(location = 14) in int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) in int gs_dc_varyingCoord; -flat layout(location = 16) in int gs_dc_instanceIndexI0; -flat layout(location = 17) in int gs_dc_instanceIndexI1; -flat layout(location = 18) in int gs_dc_instanceCoordsI0; -flat layout(location = 19) in int gs_dc_instanceCoordsI1; +flat layout(location = 4) in ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) in ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) in ivec4 gs_interstageDrawingCoord2; +flat layout(location = 7) in ivec4 gs_interstageDrawingCoord3; layout(location = 0) in VertexData { vec4 Peye; vec3 Neye; } inData; -layout(location = 4) in PrimvarData { +layout(location = 8) in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -1829,18 +1793,18 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; - dc.instanceIndex[1] = gs_dc_instanceIndexI1; - dc.instanceCoords[0] = gs_dc_instanceCoordsI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; + dc.instanceIndex[1] = gs_interstageDrawingCoord2[2]; + dc.instanceCoords[0] = gs_interstageDrawingCoord2[3]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -2943,24 +2907,15 @@ layout(location = 1) in vec3 normals; uint hd_VertexID = gl_VertexIndex; uint hd_InstanceID = gl_InstanceIndex; uint hd_BaseInstance = HgiGetBaseInstance(); -flat layout(location = 0) out int vs_dc_modelCoord; -flat layout(location = 1) out int vs_dc_constantCoord; -flat layout(location = 2) out int vs_dc_elementCoord; -flat layout(location = 3) out int vs_dc_primitiveCoord; -flat layout(location = 4) out int vs_dc_fvarCoord; -flat layout(location = 5) out int vs_dc_shaderCoord; -flat layout(location = 6) out int vs_dc_vertexCoord; -flat layout(location = 7) out int vs_dc_topologyVisibilityCoord; -flat layout(location = 8) out int vs_dc_varyingCoord; -flat layout(location = 9) out int vs_dc_instanceIndexI0; -flat layout(location = 10) out int vs_dc_instanceIndexI1; -flat layout(location = 11) out int vs_dc_instanceCoordsI0; -flat layout(location = 12) out int vs_dc_instanceCoordsI1; -layout(location = 13) out VertexData { +flat layout(location = 0) out ivec4 vs_interstageDrawingCoord0; +flat layout(location = 1) out ivec4 vs_interstageDrawingCoord1; +flat layout(location = 2) out ivec4 vs_interstageDrawingCoord2; +flat layout(location = 3) out ivec4 vs_interstageDrawingCoord3; +layout(location = 4) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 15) out PrimvarData { +layout(location = 6) out PrimvarData { vec3 points; vec3 normals; } outPrimvars; @@ -3073,18 +3028,18 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; - vs_dc_instanceIndexI1 = dc.instanceIndex[1]; - vs_dc_instanceCoordsI0 = dc.instanceCoords[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; + vs_interstageDrawingCoord2[2] = dc.instanceIndex[1]; + vs_interstageDrawingCoord2[3] = dc.instanceCoords[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -3658,47 +3613,29 @@ layout(std430, binding = 2) readonly buffer ssbo_primitiveParam { int primitiveP layout(std430, binding = 3) readonly buffer ssbo_edgeIndices { ivec2 edgeIndices[]; }; layout(std430, binding = 4) readonly buffer ssbo_faceVisibility { float faceVisibility[]; }; layout(std430, binding = 5) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; -flat layout(location = 0) in int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 1) in int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 2) in int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 3) in int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 4) in int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 5) in int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 6) in int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 7) in int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 8) in int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 9) in int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 10) in int vs_dc_instanceIndexI1[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 11) in int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 12) in int vs_dc_instanceCoordsI1[HD_NUM_PRIMITIVE_VERTS]; -layout(location = 13) in VertexData { +flat layout(location = 0) in ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 1) in ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 2) in ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 3) in ivec4 vs_interstageDrawingCoord3[HD_NUM_PRIMITIVE_VERTS]; +layout(location = 4) in VertexData { vec4 Peye; vec3 Neye; } inData[4]; -layout(location = 15) in PrimvarData { +layout(location = 6) in PrimvarData { vec3 points; vec3 normals; } inPrimvars[HD_NUM_PRIMITIVE_VERTS]; layout(location = 2) out vec4 gsPatchCoord; noperspective layout(location = 3) out vec3 hd_barycentricCoord; -flat layout(location = 7) out int gs_dc_modelCoord; -flat layout(location = 8) out int gs_dc_constantCoord; -flat layout(location = 9) out int gs_dc_elementCoord; -flat layout(location = 10) out int gs_dc_primitiveCoord; -flat layout(location = 11) out int gs_dc_fvarCoord; -flat layout(location = 12) out int gs_dc_shaderCoord; -flat layout(location = 13) out int gs_dc_vertexCoord; -flat layout(location = 14) out int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) out int gs_dc_varyingCoord; -flat layout(location = 16) out int gs_dc_instanceIndexI0; -flat layout(location = 17) out int gs_dc_instanceIndexI1; -flat layout(location = 18) out int gs_dc_instanceCoordsI0; -flat layout(location = 19) out int gs_dc_instanceCoordsI1; +flat layout(location = 4) out ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) out ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) out ivec4 gs_interstageDrawingCoord2; +flat layout(location = 7) out ivec4 gs_interstageDrawingCoord3; layout(location = 0) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 4) out PrimvarData { +layout(location = 8) out PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -3767,18 +3704,18 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; - dc.instanceIndex[1] = vs_dc_instanceIndexI1[0]; - dc.instanceCoords[0] = vs_dc_instanceCoordsI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; + dc.instanceIndex[1] = vs_interstageDrawingCoord2[0][2]; + dc.instanceCoords[0] = vs_interstageDrawingCoord2[0][3]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -3871,18 +3808,18 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; - gs_dc_instanceIndexI1 = dc.instanceIndex[1]; - gs_dc_instanceCoordsI0 = dc.instanceCoords[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; + gs_interstageDrawingCoord2[2] = dc.instanceIndex[1]; + gs_interstageDrawingCoord2[3] = dc.instanceCoords[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.normals = inPrimvars[index].normals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -4538,24 +4475,15 @@ layout(std430, binding = 4) readonly buffer ssbo_faceVisibility { float faceVisi layout(std430, binding = 5) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; layout(location = 2) in vec4 gsPatchCoord; noperspective layout(location = 3) in vec3 hd_barycentricCoord; -flat layout(location = 7) in int gs_dc_modelCoord; -flat layout(location = 8) in int gs_dc_constantCoord; -flat layout(location = 9) in int gs_dc_elementCoord; -flat layout(location = 10) in int gs_dc_primitiveCoord; -flat layout(location = 11) in int gs_dc_fvarCoord; -flat layout(location = 12) in int gs_dc_shaderCoord; -flat layout(location = 13) in int gs_dc_vertexCoord; -flat layout(location = 14) in int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) in int gs_dc_varyingCoord; -flat layout(location = 16) in int gs_dc_instanceIndexI0; -flat layout(location = 17) in int gs_dc_instanceIndexI1; -flat layout(location = 18) in int gs_dc_instanceCoordsI0; -flat layout(location = 19) in int gs_dc_instanceCoordsI1; +flat layout(location = 4) in ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) in ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) in ivec4 gs_interstageDrawingCoord2; +flat layout(location = 7) in ivec4 gs_interstageDrawingCoord3; layout(location = 0) in VertexData { vec4 Peye; vec3 Neye; } inData; -layout(location = 4) in PrimvarData { +layout(location = 8) in PrimvarData { vec3 points; vec3 normals; vec2 dispTextureCoord; @@ -4629,18 +4557,18 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; - dc.instanceIndex[1] = gs_dc_instanceIndexI1; - dc.instanceCoords[0] = gs_dc_instanceCoordsI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; + dc.instanceIndex[1] = gs_interstageDrawingCoord2[2]; + dc.instanceCoords[0] = gs_interstageDrawingCoord2[3]; return dc; } int HdGet_primitiveParam(int localIndex) { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_smoothNormals.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_smoothNormals.out index 5fc79148e0..e5807d1ad8 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_smoothNormals.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_smoothNormals.out @@ -166,22 +166,14 @@ layout(location = 1) in vec3 smoothNormals; uint hd_VertexID = gl_VertexIndex; uint hd_InstanceID = gl_InstanceIndex; uint hd_BaseInstance = HgiGetBaseInstance(); -flat layout(location = 0) out int vs_dc_modelCoord; -flat layout(location = 1) out int vs_dc_constantCoord; -flat layout(location = 2) out int vs_dc_elementCoord; -flat layout(location = 3) out int vs_dc_primitiveCoord; -flat layout(location = 4) out int vs_dc_fvarCoord; -flat layout(location = 5) out int vs_dc_shaderCoord; -flat layout(location = 6) out int vs_dc_vertexCoord; -flat layout(location = 7) out int vs_dc_topologyVisibilityCoord; -flat layout(location = 8) out int vs_dc_varyingCoord; -flat layout(location = 9) out int vs_dc_instanceIndexI0; -flat layout(location = 10) out int vs_dc_instanceCoordsI0; -layout(location = 11) out VertexData { +flat layout(location = 0) out ivec4 vs_interstageDrawingCoord0; +flat layout(location = 1) out ivec4 vs_interstageDrawingCoord1; +flat layout(location = 2) out ivec4 vs_interstageDrawingCoord2; +layout(location = 3) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 13) out PrimvarData { +layout(location = 5) out PrimvarData { vec3 points; vec3 smoothNormals; } outPrimvars; @@ -253,16 +245,16 @@ float HdGetScalar_smoothNormals() { return HdGet_smoothNormals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.smoothNormals = smoothNormals; } @@ -844,43 +836,27 @@ layout(std430, binding = 1) readonly buffer ssbo_primitiveParam { int primitiveP layout(std430, binding = 2) readonly buffer ssbo_edgeIndices { int edgeIndices[]; }; layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisibility[]; }; layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; -flat layout(location = 0) in int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 1) in int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 2) in int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 3) in int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 4) in int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 5) in int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 6) in int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 7) in int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 8) in int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 9) in int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 10) in int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -layout(location = 11) in VertexData { +flat layout(location = 0) in ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 1) in ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 2) in ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +layout(location = 3) in VertexData { vec4 Peye; vec3 Neye; } inData[3]; -layout(location = 13) in PrimvarData { +layout(location = 5) in PrimvarData { vec3 points; vec3 smoothNormals; } inPrimvars[HD_NUM_PRIMITIVE_VERTS]; layout(location = 2) out vec4 gsPatchCoord; noperspective layout(location = 3) out vec3 hd_barycentricCoord; -flat layout(location = 7) out int gs_dc_modelCoord; -flat layout(location = 8) out int gs_dc_constantCoord; -flat layout(location = 9) out int gs_dc_elementCoord; -flat layout(location = 10) out int gs_dc_primitiveCoord; -flat layout(location = 11) out int gs_dc_fvarCoord; -flat layout(location = 12) out int gs_dc_shaderCoord; -flat layout(location = 13) out int gs_dc_vertexCoord; -flat layout(location = 14) out int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) out int gs_dc_varyingCoord; -flat layout(location = 16) out int gs_dc_instanceIndexI0; -flat layout(location = 17) out int gs_dc_instanceCoordsI0; +flat layout(location = 4) out ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) out ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) out ivec4 gs_interstageDrawingCoord2; layout(location = 0) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 4) out PrimvarData { +layout(location = 7) out PrimvarData { vec3 points; vec3 smoothNormals; vec2 dispTextureCoord; @@ -931,16 +907,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -1033,16 +1009,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.smoothNormals = inPrimvars[index].smoothNormals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -1651,22 +1627,14 @@ layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisi layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; layout(location = 2) in vec4 gsPatchCoord; noperspective layout(location = 3) in vec3 hd_barycentricCoord; -flat layout(location = 7) in int gs_dc_modelCoord; -flat layout(location = 8) in int gs_dc_constantCoord; -flat layout(location = 9) in int gs_dc_elementCoord; -flat layout(location = 10) in int gs_dc_primitiveCoord; -flat layout(location = 11) in int gs_dc_fvarCoord; -flat layout(location = 12) in int gs_dc_shaderCoord; -flat layout(location = 13) in int gs_dc_vertexCoord; -flat layout(location = 14) in int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) in int gs_dc_varyingCoord; -flat layout(location = 16) in int gs_dc_instanceIndexI0; -flat layout(location = 17) in int gs_dc_instanceCoordsI0; +flat layout(location = 4) in ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) in ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) in ivec4 gs_interstageDrawingCoord2; layout(location = 0) in VertexData { vec4 Peye; vec3 Neye; } inData; -layout(location = 4) in PrimvarData { +layout(location = 7) in PrimvarData { vec3 points; vec3 smoothNormals; vec2 dispTextureCoord; @@ -1722,16 +1690,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -2828,22 +2796,14 @@ layout(location = 1) in vec3 smoothNormals; uint hd_VertexID = gl_VertexIndex; uint hd_InstanceID = gl_InstanceIndex; uint hd_BaseInstance = HgiGetBaseInstance(); -flat layout(location = 0) out int vs_dc_modelCoord; -flat layout(location = 1) out int vs_dc_constantCoord; -flat layout(location = 2) out int vs_dc_elementCoord; -flat layout(location = 3) out int vs_dc_primitiveCoord; -flat layout(location = 4) out int vs_dc_fvarCoord; -flat layout(location = 5) out int vs_dc_shaderCoord; -flat layout(location = 6) out int vs_dc_vertexCoord; -flat layout(location = 7) out int vs_dc_topologyVisibilityCoord; -flat layout(location = 8) out int vs_dc_varyingCoord; -flat layout(location = 9) out int vs_dc_instanceIndexI0; -flat layout(location = 10) out int vs_dc_instanceCoordsI0; -layout(location = 11) out VertexData { +flat layout(location = 0) out ivec4 vs_interstageDrawingCoord0; +flat layout(location = 1) out ivec4 vs_interstageDrawingCoord1; +flat layout(location = 2) out ivec4 vs_interstageDrawingCoord2; +layout(location = 3) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 13) out PrimvarData { +layout(location = 5) out PrimvarData { vec3 points; vec3 smoothNormals; } outPrimvars; @@ -2915,16 +2875,16 @@ float HdGetScalar_smoothNormals() { return HdGet_smoothNormals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.smoothNormals = smoothNormals; } @@ -3506,43 +3466,27 @@ layout(std430, binding = 1) readonly buffer ssbo_primitiveParam { int primitiveP layout(std430, binding = 2) readonly buffer ssbo_edgeIndices { ivec2 edgeIndices[]; }; layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisibility[]; }; layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; -flat layout(location = 0) in int vs_dc_modelCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 1) in int vs_dc_constantCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 2) in int vs_dc_elementCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 3) in int vs_dc_primitiveCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 4) in int vs_dc_fvarCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 5) in int vs_dc_shaderCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 6) in int vs_dc_vertexCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 7) in int vs_dc_topologyVisibilityCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 8) in int vs_dc_varyingCoord[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 9) in int vs_dc_instanceIndexI0[HD_NUM_PRIMITIVE_VERTS]; -flat layout(location = 10) in int vs_dc_instanceCoordsI0[HD_NUM_PRIMITIVE_VERTS]; -layout(location = 11) in VertexData { +flat layout(location = 0) in ivec4 vs_interstageDrawingCoord0[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 1) in ivec4 vs_interstageDrawingCoord1[HD_NUM_PRIMITIVE_VERTS]; +flat layout(location = 2) in ivec4 vs_interstageDrawingCoord2[HD_NUM_PRIMITIVE_VERTS]; +layout(location = 3) in VertexData { vec4 Peye; vec3 Neye; } inData[4]; -layout(location = 13) in PrimvarData { +layout(location = 5) in PrimvarData { vec3 points; vec3 smoothNormals; } inPrimvars[HD_NUM_PRIMITIVE_VERTS]; layout(location = 2) out vec4 gsPatchCoord; noperspective layout(location = 3) out vec3 hd_barycentricCoord; -flat layout(location = 7) out int gs_dc_modelCoord; -flat layout(location = 8) out int gs_dc_constantCoord; -flat layout(location = 9) out int gs_dc_elementCoord; -flat layout(location = 10) out int gs_dc_primitiveCoord; -flat layout(location = 11) out int gs_dc_fvarCoord; -flat layout(location = 12) out int gs_dc_shaderCoord; -flat layout(location = 13) out int gs_dc_vertexCoord; -flat layout(location = 14) out int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) out int gs_dc_varyingCoord; -flat layout(location = 16) out int gs_dc_instanceIndexI0; -flat layout(location = 17) out int gs_dc_instanceCoordsI0; +flat layout(location = 4) out ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) out ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) out ivec4 gs_interstageDrawingCoord2; layout(location = 0) out VertexData { vec4 Peye; vec3 Neye; } outData; -layout(location = 4) out PrimvarData { +layout(location = 7) out PrimvarData { vec3 points; vec3 smoothNormals; vec2 dispTextureCoord; @@ -3593,16 +3537,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord[0]; - dc.constantCoord = vs_dc_constantCoord[0]; - dc.elementCoord = vs_dc_elementCoord[0]; - dc.primitiveCoord = vs_dc_primitiveCoord[0]; - dc.fvarCoord = vs_dc_fvarCoord[0]; - dc.shaderCoord = vs_dc_shaderCoord[0]; - dc.vertexCoord = vs_dc_vertexCoord[0]; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord[0]; - dc.varyingCoord = vs_dc_varyingCoord[0]; - dc.instanceIndex[0] = vs_dc_instanceIndexI0[0]; + dc.modelCoord = vs_interstageDrawingCoord0[0][0]; + dc.constantCoord = vs_interstageDrawingCoord0[0][1]; + dc.elementCoord = vs_interstageDrawingCoord0[0][2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[0][3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0][0]; + dc.shaderCoord = vs_interstageDrawingCoord1[0][1]; + dc.vertexCoord = vs_interstageDrawingCoord1[0][2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[0][3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0][0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[0][1]; return dc; } int HdGet_primitiveParam(int localIndex) { @@ -3695,16 +3639,16 @@ void ProcessPrimvarsOut(int index) { ); hd_barycentricCoord = coords[index]; hd_drawingCoord dc = GetDrawingCoord(); - gs_dc_modelCoord = dc.modelCoord; - gs_dc_constantCoord = dc.constantCoord; - gs_dc_elementCoord = dc.elementCoord; - gs_dc_primitiveCoord = dc.primitiveCoord; - gs_dc_fvarCoord = dc.fvarCoord; - gs_dc_shaderCoord = dc.shaderCoord; - gs_dc_vertexCoord = dc.vertexCoord; - gs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - gs_dc_varyingCoord = dc.varyingCoord; - gs_dc_instanceIndexI0 = dc.instanceIndex[0]; + gs_interstageDrawingCoord0[0] = dc.modelCoord; + gs_interstageDrawingCoord0[1] = dc.constantCoord; + gs_interstageDrawingCoord0[2] = dc.elementCoord; + gs_interstageDrawingCoord0[3] = dc.primitiveCoord; + gs_interstageDrawingCoord1[0] = dc.fvarCoord; + gs_interstageDrawingCoord1[1] = dc.shaderCoord; + gs_interstageDrawingCoord1[2] = dc.vertexCoord; + gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + gs_interstageDrawingCoord2[0] = dc.varyingCoord; + gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = inPrimvars[index].points; outPrimvars.smoothNormals = inPrimvars[index].smoothNormals; outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); @@ -4342,22 +4286,14 @@ layout(std430, binding = 3) readonly buffer ssbo_faceVisibility { float faceVisi layout(std430, binding = 4) readonly buffer ssbo_dispTextureCoord { vec2 dispTextureCoord[]; }; layout(location = 2) in vec4 gsPatchCoord; noperspective layout(location = 3) in vec3 hd_barycentricCoord; -flat layout(location = 7) in int gs_dc_modelCoord; -flat layout(location = 8) in int gs_dc_constantCoord; -flat layout(location = 9) in int gs_dc_elementCoord; -flat layout(location = 10) in int gs_dc_primitiveCoord; -flat layout(location = 11) in int gs_dc_fvarCoord; -flat layout(location = 12) in int gs_dc_shaderCoord; -flat layout(location = 13) in int gs_dc_vertexCoord; -flat layout(location = 14) in int gs_dc_topologyVisibilityCoord; -flat layout(location = 15) in int gs_dc_varyingCoord; -flat layout(location = 16) in int gs_dc_instanceIndexI0; -flat layout(location = 17) in int gs_dc_instanceCoordsI0; +flat layout(location = 4) in ivec4 gs_interstageDrawingCoord0; +flat layout(location = 5) in ivec4 gs_interstageDrawingCoord1; +flat layout(location = 6) in ivec4 gs_interstageDrawingCoord2; layout(location = 0) in VertexData { vec4 Peye; vec3 Neye; } inData; -layout(location = 4) in PrimvarData { +layout(location = 7) in PrimvarData { vec3 points; vec3 smoothNormals; vec2 dispTextureCoord; @@ -4413,16 +4349,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = gs_dc_modelCoord; - dc.constantCoord = gs_dc_constantCoord; - dc.elementCoord = gs_dc_elementCoord; - dc.primitiveCoord = gs_dc_primitiveCoord; - dc.fvarCoord = gs_dc_fvarCoord; - dc.shaderCoord = gs_dc_shaderCoord; - dc.vertexCoord = gs_dc_vertexCoord; - dc.topologyVisibilityCoord = gs_dc_topologyVisibilityCoord; - dc.varyingCoord = gs_dc_varyingCoord; - dc.instanceIndex[0] = gs_dc_instanceIndexI0; + dc.modelCoord = gs_interstageDrawingCoord0[0]; + dc.constantCoord = gs_interstageDrawingCoord0[1]; + dc.elementCoord = gs_interstageDrawingCoord0[2]; + dc.primitiveCoord = gs_interstageDrawingCoord0[3]; + dc.fvarCoord = gs_interstageDrawingCoord1[0]; + dc.shaderCoord = gs_interstageDrawingCoord1[1]; + dc.vertexCoord = gs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; + dc.varyingCoord = gs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; return dc; } int HdGet_primitiveParam(int localIndex) { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_points_indirect.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_points_indirect.out index 73823268af..17c0dd2246 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_points_indirect.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_points_indirect.out @@ -160,22 +160,14 @@ layout(location = 1) in vec3 normals; uint hd_VertexID = gl_VertexIndex; uint hd_InstanceID = gl_InstanceIndex; uint hd_BaseInstance = HgiGetBaseInstance(); -flat layout(location = 0) out int vs_dc_modelCoord; -flat layout(location = 1) out int vs_dc_constantCoord; -flat layout(location = 2) out int vs_dc_elementCoord; -flat layout(location = 3) out int vs_dc_primitiveCoord; -flat layout(location = 4) out int vs_dc_fvarCoord; -flat layout(location = 5) out int vs_dc_shaderCoord; -flat layout(location = 6) out int vs_dc_vertexCoord; -flat layout(location = 7) out int vs_dc_topologyVisibilityCoord; -flat layout(location = 8) out int vs_dc_varyingCoord; -flat layout(location = 9) out int vs_dc_instanceIndexI0; -flat layout(location = 10) out int vs_dc_instanceCoordsI0; -flat layout(location = 12) out int vsPointId; -layout(location = 11) out VertexData { +flat layout(location = 0) out ivec4 vs_interstageDrawingCoord0; +flat layout(location = 1) out ivec4 vs_interstageDrawingCoord1; +flat layout(location = 2) out ivec4 vs_interstageDrawingCoord2; +flat layout(location = 4) out int vsPointId; +layout(location = 3) out VertexData { vec4 Peye; } outData; -layout(location = 13) out PrimvarData { +layout(location = 5) out PrimvarData { vec3 points; vec3 normals; } outPrimvars; @@ -247,16 +239,16 @@ float HdGetScalar_normals() { return HdGet_normals(0).x; } // //////// Codegen Proc VS //////// void ProcessPrimvarsIn() { hd_drawingCoord dc = GetDrawingCoord(); - vs_dc_modelCoord = dc.modelCoord; - vs_dc_constantCoord = dc.constantCoord; - vs_dc_elementCoord = dc.elementCoord; - vs_dc_primitiveCoord = dc.primitiveCoord; - vs_dc_fvarCoord = dc.fvarCoord; - vs_dc_shaderCoord = dc.shaderCoord; - vs_dc_vertexCoord = dc.vertexCoord; - vs_dc_topologyVisibilityCoord = dc.topologyVisibilityCoord; - vs_dc_varyingCoord = dc.varyingCoord; - vs_dc_instanceIndexI0 = dc.instanceIndex[0]; + vs_interstageDrawingCoord0[0] = dc.modelCoord; + vs_interstageDrawingCoord0[1] = dc.constantCoord; + vs_interstageDrawingCoord0[2] = dc.elementCoord; + vs_interstageDrawingCoord0[3] = dc.primitiveCoord; + vs_interstageDrawingCoord1[0] = dc.fvarCoord; + vs_interstageDrawingCoord1[1] = dc.shaderCoord; + vs_interstageDrawingCoord1[2] = dc.vertexCoord; + vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; + vs_interstageDrawingCoord2[0] = dc.varyingCoord; + vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; outPrimvars.points = points; outPrimvars.normals = normals; } @@ -1232,22 +1224,14 @@ FORWARD_DECL(float GetSelectedEdgeOpacity()); // //////// Global Member Declarations //////// layout(std430, binding = 0) readonly buffer ssbo_constantPrimvars { ConstantData7 constantPrimvars[]; }; -flat layout(location = 12) in int vsPointId; -flat layout(location = 0) in int vs_dc_modelCoord; -flat layout(location = 1) in int vs_dc_constantCoord; -flat layout(location = 2) in int vs_dc_elementCoord; -flat layout(location = 3) in int vs_dc_primitiveCoord; -flat layout(location = 4) in int vs_dc_fvarCoord; -flat layout(location = 5) in int vs_dc_shaderCoord; -flat layout(location = 6) in int vs_dc_vertexCoord; -flat layout(location = 7) in int vs_dc_topologyVisibilityCoord; -flat layout(location = 8) in int vs_dc_varyingCoord; -flat layout(location = 9) in int vs_dc_instanceIndexI0; -flat layout(location = 10) in int vs_dc_instanceCoordsI0; -layout(location = 11) in VertexData { +flat layout(location = 4) in int vsPointId; +flat layout(location = 0) in ivec4 vs_interstageDrawingCoord0; +flat layout(location = 1) in ivec4 vs_interstageDrawingCoord1; +flat layout(location = 2) in ivec4 vs_interstageDrawingCoord2; +layout(location = 3) in VertexData { vec4 Peye; } inData; -layout(location = 13) in PrimvarData { +layout(location = 5) in PrimvarData { vec3 points; vec3 normals; } inPrimvars; @@ -1302,16 +1286,16 @@ int GetPrimitiveIndex() { } hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = vs_dc_modelCoord; - dc.constantCoord = vs_dc_constantCoord; - dc.elementCoord = vs_dc_elementCoord; - dc.primitiveCoord = vs_dc_primitiveCoord; - dc.fvarCoord = vs_dc_fvarCoord; - dc.shaderCoord = vs_dc_shaderCoord; - dc.vertexCoord = vs_dc_vertexCoord; - dc.topologyVisibilityCoord = vs_dc_topologyVisibilityCoord; - dc.varyingCoord = vs_dc_varyingCoord; - dc.instanceIndex[0] = vs_dc_instanceIndexI0; + dc.modelCoord = vs_interstageDrawingCoord0[0]; + dc.constantCoord = vs_interstageDrawingCoord0[1]; + dc.elementCoord = vs_interstageDrawingCoord0[2]; + dc.primitiveCoord = vs_interstageDrawingCoord0[3]; + dc.fvarCoord = vs_interstageDrawingCoord1[0]; + dc.shaderCoord = vs_interstageDrawingCoord1[1]; + dc.vertexCoord = vs_interstageDrawingCoord1[2]; + dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[3]; + dc.varyingCoord = vs_interstageDrawingCoord2[0]; + dc.instanceIndex[0] = vs_interstageDrawingCoord2[1]; return dc; } int GetElementID() { From a41ecb04d7189db637b8bdc94004491b963bd7de Mon Sep 17 00:00:00 2001 From: clach Date: Mon, 14 Oct 2024 13:10:15 -0700 Subject: [PATCH 36/82] [hdSt] Remove "bindless" arg from testHdStCodeGen, as it hasn't done anything in years. (Internal change: 2344495) --- pxr/imaging/hdSt/CMakeLists.txt | 76 +- pxr/imaging/hdSt/testenv/testHdStCodeGen.cpp | 19 +- .../baseline/codegen_curves_bindless.out | 2648 -------- ...gen_mesh_bindless_indirect_faceVarying.out | 5321 ---------------- ...odegen_mesh_bindless_indirect_instance.out | 5531 ----------------- ... => codegen_mesh_indirect_doubleSided.out} | 0 ... => codegen_mesh_indirect_faceVarying.out} | 0 ...> codegen_mesh_indirect_smoothNormals.out} | 0 .../baseline/codegen_points_bindless.out | 1760 ------ 9 files changed, 19 insertions(+), 15336 deletions(-) delete mode 100644 pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_curves_bindless.out delete mode 100644 pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_faceVarying.out delete mode 100644 pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_instance.out rename pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/{codegen_mesh_bindless_indirect_doubleSided.out => codegen_mesh_indirect_doubleSided.out} (100%) rename pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/{codegen_mesh_bindless_indirect.out => codegen_mesh_indirect_faceVarying.out} (100%) rename pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/{codegen_mesh_bindless_indirect_smoothNormals.out => codegen_mesh_indirect_smoothNormals.out} (100%) delete mode 100644 pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_points_bindless.out diff --git a/pxr/imaging/hdSt/CMakeLists.txt b/pxr/imaging/hdSt/CMakeLists.txt index 0e62a6a9f1..b5d4156117 100644 --- a/pxr/imaging/hdSt/CMakeLists.txt +++ b/pxr/imaging/hdSt/CMakeLists.txt @@ -2386,24 +2386,11 @@ pxr_register_test(testHdStCodeGen_GL_Mesh_Indirect HGIGL_GLSL_VERSION=450 HGI_ENABLE_VULKAN=0 ) -pxr_register_test(testHdStCodeGen_GL_Mesh_Bindless_Indirect - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --bindless | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_bindless_indirect.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_bindless_indirect.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect.out" - TESTENV testHdStCodeGen_GL - ENV - TF_DEBUG=HD_SAFE_MODE - HGIGL_ENABLE_BINDLESS_BUFFER=1 - HGIGL_ENABLE_BINDLESS_TEXTURE=1 - HGIGL_GLSL_VERSION=450 - HGI_ENABLE_VULKAN=0 -) -pxr_register_test(testHdStCodeGen_GL_Mesh_Bindless_Indirect_SmoothNormals - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --bindless --smoothNormals | grep -v '// line'" +pxr_register_test(testHdStCodeGen_GL_Mesh_Indirect_SmoothNormals + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --smoothNormals | grep -v '// line'" EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_bindless_indirect_smoothNormals.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_bindless_indirect_smoothNormals.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_smoothNormals.out" + STDOUT_REDIRECT codegen_mesh_indirect_smoothNormals.out + POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_smoothNormals.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_smoothNormals.out" TESTENV testHdStCodeGen_GL ENV TF_DEBUG=HD_SAFE_MODE @@ -2412,11 +2399,11 @@ pxr_register_test(testHdStCodeGen_GL_Mesh_Bindless_Indirect_SmoothNormals HGIGL_GLSL_VERSION=450 HGI_ENABLE_VULKAN=0 ) -pxr_register_test(testHdStCodeGen_GL_Mesh_Bindless_Indirect_DoubleSided - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --bindless --doubleSided | grep -v '// line'" +pxr_register_test(testHdStCodeGen_GL_Mesh_Indirect_DoubleSided + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --doubleSided | grep -v '// line'" EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_bindless_indirect_doubleSided.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_bindless_indirect_doubleSided.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_doubleSided.out" + STDOUT_REDIRECT codegen_mesh_indirect_doubleSided.out + POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_doubleSided.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_doubleSided.out" TESTENV testHdStCodeGen_GL ENV TF_DEBUG=HD_SAFE_MODE @@ -2425,11 +2412,11 @@ pxr_register_test(testHdStCodeGen_GL_Mesh_Bindless_Indirect_DoubleSided HGIGL_GLSL_VERSION=450 HGI_ENABLE_VULKAN=0 ) -pxr_register_test(testHdStCodeGen_GL_Mesh_Bindless_Indirect_FaceVarying - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --bindless --faceVarying | grep -v '// line'" +pxr_register_test(testHdStCodeGen_GL_Mesh_Indirect_FaceVarying + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --faceVarying | grep -v '// line'" EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_bindless_indirect_faceVarying.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_bindless_indirect_faceVarying.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_faceVarying.out" + STDOUT_REDIRECT codegen_mesh_indirect_faceVarying.out + POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_faceVarying.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_faceVarying.out" TESTENV testHdStCodeGen_GL ENV TF_DEBUG=HD_SAFE_MODE @@ -2451,19 +2438,6 @@ pxr_register_test(testHdStCodeGen_GL_Mesh_Indirect_Instance HGIGL_GLSL_VERSION=450 HGI_ENABLE_VULKAN=0 ) -pxr_register_test(testHdStCodeGen_GL_Mesh_Bindless_Indirect_Instance - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --bindless --instance | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_bindless_indirect_instance.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_bindless_indirect_instance.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_instance.out" - TESTENV testHdStCodeGen_GL - ENV - TF_DEBUG=HD_SAFE_MODE - HGIGL_ENABLE_BINDLESS_BUFFER=1 - HGIGL_ENABLE_BINDLESS_TEXTURE=1 - HGIGL_GLSL_VERSION=450 - HGI_ENABLE_VULKAN=0 -) pxr_register_test(testHdStCodeGen_GL_Mesh_EdgeOnly COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --edgeOnly | grep -v '// line'" EXPECTED_RETURN_CODE 0 @@ -2490,19 +2464,6 @@ pxr_register_test(testHdStCodeGen_GL_Mesh_EdgeOnly_BlendWireframe HGIGL_GLSL_VERSION=450 HGI_ENABLE_VULKAN=0 ) -pxr_register_test(testHdStCodeGen_GL_Curves_Bindless - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --curves --bindless | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_curves_bindless.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_curves_bindless.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_curves_bindless.out" - TESTENV testHdStCodeGen_GL - ENV - TF_DEBUG=HD_SAFE_MODE - HGIGL_ENABLE_BINDLESS_BUFFER=1 - HGIGL_ENABLE_BINDLESS_TEXTURE=1 - HGIGL_GLSL_VERSION=450 - HGI_ENABLE_VULKAN=0 -) pxr_register_test(testHdStCodeGen_GL_Curves_Indirect COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --curves | grep -v '// line'" EXPECTED_RETURN_CODE 0 @@ -2516,19 +2477,6 @@ pxr_register_test(testHdStCodeGen_GL_Curves_Indirect HGIGL_GLSL_VERSION=450 HGI_ENABLE_VULKAN=0 ) -pxr_register_test(testHdStCodeGen_GL_Points_Bindless - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --points --bindless | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_points_bindless.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_points_bindless.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_points_bindless.out" - TESTENV testHdStCodeGen_GL - ENV - TF_DEBUG=HD_SAFE_MODE - HGIGL_ENABLE_BINDLESS_BUFFER=1 - HGIGL_ENABLE_BINDLESS_TEXTURE=1 - HGIGL_GLSL_VERSION=450 - HGI_ENABLE_VULKAN=0 -) pxr_register_test(testHdStCodeGen_GL_Points_Indirect COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --points | grep -v '// line'" EXPECTED_RETURN_CODE 0 diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen.cpp b/pxr/imaging/hdSt/testenv/testHdStCodeGen.cpp index c20dcc256b..c968776adc 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen.cpp +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen.cpp @@ -60,8 +60,7 @@ TF_DEFINE_PRIVATE_TOKENS( ); static bool -CodeGenTest(HdSt_ShaderKey const &key, bool useBindlessBuffer, - bool instance, bool smoothNormals) +CodeGenTest(HdSt_ShaderKey const &key, bool instance, bool smoothNormals) { TfErrorMark mark; @@ -300,11 +299,10 @@ CodeGenTest(HdSt_ShaderKey const &key, bool useBindlessBuffer, } bool -TestShader(HdSt_ShaderKey const &key, bool bindless, - bool instance, bool smoothNormals) +TestShader(HdSt_ShaderKey const &key, bool instance, bool smoothNormals) { bool success = true; - success &= CodeGenTest(key, bindless, instance, smoothNormals); + success &= CodeGenTest(key, instance, smoothNormals); return success; } @@ -324,7 +322,6 @@ int main(int argc, char *argv[]) bool mesh = false; bool curves = false; bool points = false; - bool bindless = false; HdMeshGeomStyle geomStyle = HdMeshGeomStyleSurf; for (int i=0; isurfaceShader, topologicalVisibility, /* isWidget */ false, false), - bindless, instance, false); + instance, false); } // points if (points) { success &= TestShader(HdSt_PointsShaderKey(), - bindless, instance, false); + instance, false); } if (success) { diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_curves_bindless.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_curves_bindless.out deleted file mode 100644 index e3ec0a77c9..0000000000 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_curves_bindless.out +++ /dev/null @@ -1,2648 +0,0 @@ -------------------------------------------------------- --- glslfx version 0.1 -#import $TOOLS/hdSt/shaders/basisCurves.glslfx --- configuration -{"techniques": {"default": { -"vertexShader" : { "source" : ["Instancing.Transform", "Curves.Vertex.Wire", "Curves.Vertex.Normal.Implicit", "PointId.Vertex.None"] } -, "tessControlShader" : { "source" : ["Curves.CommonData", "Curves.TessFactorsGLSL", "Curves.CommonControl", "Curves.Tess.CurveData.Wire", "Curves.TessControl.Cubic.Wire"] } -, "tessEvalShader" : { "source" : ["Curves.CommonData", "Instancing.Transform", "Curves.Tess.CurveData.Wire", "Curves.TessEval.Cubic.Wire", "Curves.BezierBasis", "Curves.Cubic.VaryingInterpolation"] } -, "fragmentShader" : { "source" : ["Fragment.CommonTerminals", "Fragment.Surface", "Fragment.ScalarOverride", "PointId.Fragment.Fallback", "Visibility.Fragment.Fallback", "Curves.Fragment.Wire"] } -}}} -------------------------------------------------------- -======================================================= - VERTEX SHADER -======================================================= -#version 450 -#extension GL_NV_shader_buffer_load : require -#extension GL_NV_gpu_shader5 : require -#extension GL_ARB_bindless_texture : require -#extension GL_ARB_shader_draw_parameters : require -int HgiGetBaseVertex() { - return gl_BaseVertexARB; -} -#define REF(space,type) inout type -#define FORWARD_DECL(func_decl) func_decl; -#define ATOMIC_LOAD(a) (a) -#define ATOMIC_STORE(a, v) (a) = (v) -#define ATOMIC_ADD(a, v) atomicAdd(a, v) -#define ATOMIC_EXCHANGE(a, v) atomicExchange(a, v) -#define ATOMIC_COMP_SWAP(a, expected, desired) atomicCompSwap(a, expected, desired) -#define atomic_int int -#define atomic_uint uint - -#define HGI_HAS_DOUBLE_TYPE 1 - - -struct hgi_ivec3 { int x, y, z; }; -struct hgi_vec3 { float x, y, z; }; -struct hgi_dvec3 { double x, y, z; }; -struct hgi_mat3 { float m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; -struct hgi_dmat3 { double m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; - - -// //////// Codegen Defines //////// -#define HD_SHADER_API 2 -#define MAT4 mat4 -// Alias hgi vec and matrix types to hd. -#define hd_ivec3 hgi_ivec3 -#define hd_vec3 hgi_vec3 -#define hd_dvec3 hgi_dvec3 -#define hd_mat3 hgi_mat3 -#define hd_dmat3 hgi_dmat3 - -ivec3 hd_ivec3_get(hd_ivec3 v) { return ivec3(v.x, v.y, v.z); } -ivec3 hd_ivec3_get(ivec3 v) { return v; } -vec3 hd_vec3_get(hd_vec3 v) { return vec3(v.x, v.y, v.z); } -vec3 hd_vec3_get(vec3 v) { return v; } -dvec3 hd_dvec3_get(hd_dvec3 v) { return dvec3(v.x, v.y, v.z); } -dvec3 hd_dvec3_get(dvec3 v) { return v; } -mat3 hd_mat3_get(hd_mat3 v) { return mat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -mat3 hd_mat3_get(mat3 v) { return v; } -dmat3 hd_dmat3_get(hd_dmat3 v) { return dmat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -dmat3 hd_dmat3_get(dmat3 v) { return v; } -hd_ivec3 hd_ivec3_set(hd_ivec3 v) { return v; } -hd_ivec3 hd_ivec3_set(ivec3 v) { return hd_ivec3(v.x, v.y, v.z); } -hd_vec3 hd_vec3_set(hd_vec3 v) { return v; } -hd_vec3 hd_vec3_set(vec3 v) { return hd_vec3(v.x, v.y, v.z); } -hd_dvec3 hd_dvec3_set(hd_dvec3 v) { return v; } -hd_dvec3 hd_dvec3_set(dvec3 v) { return hd_dvec3(v.x, v.y, v.z); } -hd_mat3 hd_mat3_set(hd_mat3 v) { return v; } -hd_mat3 hd_mat3_set(mat3 v) { return hd_mat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -hd_dmat3 hd_dmat3_set(hd_dmat3 v) { return v; } -hd_dmat3 hd_dmat3_set(dmat3 v) { return hd_dmat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -int hd_int_get(int v) { return v; } -int hd_int_get(ivec2 v) { return v.x; } -int hd_int_get(ivec3 v) { return v.x; } -int hd_int_get(ivec4 v) { return v.x; } -vec3 hd_sample_udim(vec2 v) { -vec2 vf = floor(v); -return vec3(v.x - vf.x, v.y - vf.y, clamp(vf.x, 0.0, 10.0) + 10.0 * vf.y); -} -vec4 hd_vec4_2_10_10_10_get(int v) { - ivec4 unpacked = ivec4((v & 0x3ff) << 22, (v & 0xffc00) << 12, - (v & 0x3ff00000) << 2, (v & 0xc0000000)); - return vec4(unpacked) / 2147483647.0; } -int hd_vec4_2_10_10_10_set(vec4 v) { - return ( (int(v.x * 511.0) & 0x3ff) | - ((int(v.y * 511.0) & 0x3ff) << 10) | - ((int(v.z * 511.0) & 0x3ff) << 20) | - ((int(v.w) & 0x1) << 30)); } -vec2 hd_half2_get(uint v) { - return unpackHalf2x16(v); } -uint hd_half2_set(vec2 v) { - return packHalf2x16(v); } -vec4 hd_half4_get(uvec2 v) { - return vec4(unpackHalf2x16(v.x), unpackHalf2x16(v.y)); } -uvec2 hd_half4_set(vec4 v) { - return uvec2(packHalf2x16(v.xy), packHalf2x16(v.zw)); } -#define HD_NUM_PATCH_VERTS 4 -#define HD_NUM_PATCH_EVAL_VERTS 4 -#define HD_NUM_PRIMITIVE_VERTS 3 -#define HD_HAS_transform 1 -#define HD_HAS_transformInverse 1 -#define HD_HAS_color 1 -#define HD_HAS_primID 1 -#define HD_HAS_widths 1 -#define HD_INSTANCER_NUM_LEVELS 0 -#define HD_INSTANCE_INDEX_WIDTH 1 -#define HD_HAS_faceVisibility 1 -#define HD_HAS_points 1 -#define HD_HAS_normals 1 - - -// //////// Global Includes //////// - -// //////// Global Macros //////// - -// //////// Global Structs //////// - -// //////// Global Member Declarations //////// -uint hd_VertexID = gl_VertexID; -uint hd_InstanceID = gl_InstanceID; -uint hd_BaseInstance = 0; - -// //////// Global Function Definitions //////// - - -// //////// Codegen Decl //////// -struct hd_drawingCoord { - int modelCoord; - int constantCoord; - int elementCoord; - int primitiveCoord; - int fvarCoord; - int shaderCoord; - int vertexCoord; - int topologyVisibilityCoord; - int varyingCoord; - int instanceIndex[HD_INSTANCE_INDEX_WIDTH]; - int instanceCoords[HD_INSTANCE_INDEX_WIDTH]; -}; -FORWARD_DECL(hd_drawingCoord GetDrawingCoord()); -FORWARD_DECL(int HgiGetBaseVertex()); -struct hd_instanceIndex { int indices[HD_INSTANCE_INDEX_WIDTH]; }; -struct ConstantData10 { - mat4 transform; - mat4 transformInverse; - vec4 color; - vec4 primID; - float widths; -}; -FORWARD_DECL(int GetElementID()); -FORWARD_DECL(int GetAggregatedElementID()); -FORWARD_DECL(int GetPrimitiveEdgeId()); -FORWARD_DECL(float GetSelectedEdgeOpacity()); -out flat ivec4 vs_interstageDrawingCoord0; -out flat ivec4 vs_interstageDrawingCoord1; -out flat ivec4 vs_interstageDrawingCoord2; -layout (location = 2) in ivec4 drawingCoord0; -layout (location = 3) in ivec4 drawingCoord1; -layout (location = 4) in ivec2 drawingCoord2; -layout (location = 0) in vec3 points; -layout (location = 1) in vec3 normals; -layout(location = 0) uniform ConstantData10 *constantPrimvars; -layout(location = 1) uniform float *faceVisibility; -out CurveVertexData { - vec4 Peye; -} outData; -out PrimvarData { - vec3 points; - vec3 normals; -} outPrimvars; - -// //////// Codegen Accessors //////// -mat4 HdGet_transform(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transform); -} -mat4 HdGet_transform() { return HdGet_transform(0); } -mat4 HdGet_transformInverse(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transformInverse); -} -mat4 HdGet_transformInverse() { return HdGet_transformInverse(0); } -vec4 HdGet_color(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].color); -} -vec4 HdGet_color() { return HdGet_color(0); } -float HdGetScalar_color(int localIndex) { return HdGet_color(localIndex).x; } -float HdGetScalar_color() { return HdGet_color(0).x; } -vec4 HdGet_primID(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].primID); -} -vec4 HdGet_primID() { return HdGet_primID(0); } -float HdGetScalar_primID(int localIndex) { return HdGet_primID(localIndex).x; } -float HdGetScalar_primID() { return HdGet_primID(0).x; } -float HdGet_widths(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return float(constantPrimvars[index].widths); -} -float HdGet_widths() { return HdGet_widths(0); } -float HdGetScalar_widths(int localIndex) { return HdGet_widths(localIndex); } -float HdGetScalar_widths() { return HdGet_widths(0); } - -// //////// Codegen VS Source //////// -#define HD_BINDLESS_BUFFERS_ENABLED -int GetBaseVertexOffset() { - return HgiGetBaseVertex(); -} -hd_instanceIndex GetInstanceIndex() { hd_instanceIndex r; r.indices[0] = 0; return r; } -hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = drawingCoord0.x; - dc.constantCoord = drawingCoord0.y; - dc.elementCoord = drawingCoord0.z; - dc.primitiveCoord = drawingCoord0.w; - dc.fvarCoord = drawingCoord1.x; - dc.shaderCoord = drawingCoord1.z; - dc.vertexCoord = drawingCoord1.w; - dc.topologyVisibilityCoord = drawingCoord2.x; - dc.varyingCoord = drawingCoord2.y; - hd_instanceIndex r = GetInstanceIndex(); - dc.instanceIndex[0] = r.indices[0]; - return dc; -} -vec3 HdGet_points(int localIndex) { return hd_vec3_get(points);} -vec3 HdGet_points() { return HdGet_points(0); } -float HdGetScalar_points(int localIndex) { return HdGet_points(localIndex).x; } -float HdGetScalar_points() { return HdGet_points(0).x; } -vec3 HdGet_normals(int localIndex) { return hd_vec3_get(normals);} -vec3 HdGet_normals() { return HdGet_normals(0); } -float HdGetScalar_normals(int localIndex) { return HdGet_normals(localIndex).x; } -float HdGetScalar_normals() { return HdGet_normals(0).x; } - -// //////// Codegen Proc VS //////// -void ProcessPrimvarsIn() { - hd_drawingCoord dc = GetDrawingCoord(); - vs_interstageDrawingCoord0[0] = dc.modelCoord; - vs_interstageDrawingCoord0[1] = dc.constantCoord; - vs_interstageDrawingCoord0[2] = dc.elementCoord; - vs_interstageDrawingCoord0[3] = dc.primitiveCoord; - vs_interstageDrawingCoord1[0] = dc.fvarCoord; - vs_interstageDrawingCoord1[1] = dc.shaderCoord; - vs_interstageDrawingCoord1[2] = dc.vertexCoord; - vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; - vs_interstageDrawingCoord2[0] = dc.varyingCoord; - vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; - outPrimvars.points = points; - outPrimvars.normals = normals; -} - -// --------------------------------------------------------------------------- -// global defines -// --------------------------------------------------------------------------- -// codeGen can override this range (currently not). -// quadro 4000's max is 189. -#ifndef HD_GL_POINT_SIZE_MAX -#define HD_GL_POINT_SIZE_MAX 100.0 -#endif -#ifndef HD_GL_POINT_SIZE_MIN -#define HD_GL_POINT_SIZE_MIN .45 -#endif - -// --------------------------------------------------------------------------- -// render pass states -// --------------------------------------------------------------------------- - -MAT4 GetWorldToViewMatrix() { -#if defined(HD_HAS_worldToViewMatrix) - return MAT4(HdGet_worldToViewMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetWorldToViewInverseMatrix() { -#if defined(HD_HAS_worldToViewInverseMatrix) - return MAT4(HdGet_worldToViewInverseMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetProjectionMatrix() { -#if defined(HD_HAS_projectionMatrix) - return MAT4(HdGet_projectionMatrix()); -#else - return MAT4(1); -#endif -} -vec3 GetPositionInWorldSpace(vec3 windowRelativeCoord) -{ -#if defined(HD_HAS_imageToWorldMatrix) - vec4 pImage = vec4(windowRelativeCoord, 1.0); - vec4 pWorld = vec4(HdGet_imageToWorldMatrix() * pImage); - return (pWorld / pWorld.w).xyz; -#else - return windowRelativeCoord; -#endif -} -float GetLightingBlendAmount() { -#if defined(HD_HAS_lightingBlendAmount) - return HdGet_lightingBlendAmount(); -#else - return 1; -#endif -} -vec4 GetViewport() { -#if defined(HD_HAS_viewport) - return HdGet_viewport(); -#else - return vec4(0,0,1,1); -#endif -} -float GetTessLevel() { -#if defined(HD_HAS_tessLevel) - return HdGet_tessLevel(); -#else - return 1; -#endif -} -float GetPointSize() { -#if defined(HD_HAS_pointSize) - return HdGet_pointSize(); -#else - return 3.0; -#endif -} -float GetPointSelectedSize() { -#if defined(HD_HAS_pointSelectedSize) - return HdGet_pointSelectedSize(); -#else - return 5.0; -#endif -} -vec4 GetWireframeColor() { -// Individual prims can specify an alternative wireframe color -// to one specified in the render pass. This is used in cases were -// there is not enough contrast with the normal one. -#if defined(HD_HAS_overrideWireframeColor) - return HdGet_overrideWireframeColor(); -#elif defined(HD_HAS_wireframeColor) - return HdGet_wireframeColor(); -#else - return vec4(0,0,0,0); -#endif -} -vec4 GetMaskColor() { -#if defined(HD_HAS_maskColor) - return HdGet_maskColor(); -#else - return vec4(0.5,0,0,1); -#endif -} -vec4 GetIndicatorColor() { -#if defined(HD_HAS_indicatorColor) - return HdGet_indicatorColor(); -#else - return vec4(0,0.5,0,1); -#endif -} - -bool ShouldDiscardByAlpha(vec4 color) -{ -#if defined(HD_HAS_alphaThreshold) - float alphaThreshold = HdGet_alphaThreshold(); -#else - float alphaThreshold = 0; -#endif - return (color.a < alphaThreshold); -} - -vec2 ApplyAxisAlignedAffineTransform(vec4 t, vec2 pt) -{ - return t.xy * pt + t.zw; -} - - - -void ApplyClipPlanes(vec4 Peye) -{ -#if defined(HD_HAS_numClipPlanes) -#if defined(HD_HAS_clipPlanes) - for (int i=0; i> 2); -} -int GetAggregatedElementID() { - return GetElementID() - + GetDrawingCoord().elementCoord; -} -int HdGet_edgeIndices(int localIndex) { - int index = GetPrimitiveIndex(); - return int(edgeIndices[index]); -} -int HdGet_edgeIndices() { return HdGet_edgeIndices(0); } -int HdGetScalar_edgeIndices(int localIndex) { return HdGet_edgeIndices(localIndex); } -int HdGetScalar_edgeIndices() { return HdGet_edgeIndices(0); } -int GetAuthoredEdgeId(int primitiveEdgeId) { - return primitiveEdgeId; -} -float HdGet_faceVisibility(int localIndex) { - int index = GetAggregatedElementID(); - return float(faceVisibility[index]); -} -float HdGet_faceVisibility() { return HdGet_faceVisibility(0); } -float HdGetScalar_faceVisibility(int localIndex) { return HdGet_faceVisibility(localIndex); } -float HdGetScalar_faceVisibility() { return HdGet_faceVisibility(0); } -vec3 HdGet_points(int localIndex) { - int index = localIndex; - return vec3(inPrimvars[index].points); -} -vec3 HdGet_points() { return HdGet_points(0); } -float HdGetScalar_points(int localIndex) { return HdGet_points(localIndex).x; } -float HdGetScalar_points() { return HdGet_points(0).x; } -vec3 HdGet_normals(int localIndex) { - int index = localIndex; - return vec3(inPrimvars[index].normals); -} -vec3 HdGet_normals() { return HdGet_normals(0); } -float HdGetScalar_normals(int localIndex) { return HdGet_normals(localIndex).x; } -float HdGetScalar_normals() { return HdGet_normals(0).x; } -vec2 HdGet_dispTextureCoord_Coarse(int localIndex) { - int fvarIndex = GetFVarIndex(localIndex); - return vec2(dispTextureCoord[fvarIndex]); -} -vec2 HdGet_dispTextureCoord(int localIndex, vec2 st) { - return (HdGet_dispTextureCoord_Coarse(0) * (1-st.x-st.y) + HdGet_dispTextureCoord_Coarse(1) * st.x + HdGet_dispTextureCoord_Coarse(2) * st.y); -} -FORWARD_DECL(vec4 GetPatchCoord(int index)); -FORWARD_DECL(vec2 GetPatchCoordLocalST()); -vec2 HdGet_dispTextureCoord(int localIndex) { - vec2 localST = GetPatchCoord(localIndex).xy; - return HdGet_dispTextureCoord(localIndex, localST); -} -vec2 HdGet_dispTextureCoord() { return HdGet_dispTextureCoord(0); } -FORWARD_DECL(vec4 GetPatchCoord(int localIndex)); -void ProcessSamplingTransforms(MAT4 instanceModelViewInverse) { -} - -// //////// Codegen Proc GS //////// -FORWARD_DECL(vec4 GetPatchCoord(int index)); -void ProcessPrimvarsOut(int index) { - vec2 localST = GetPatchCoord(index).xy; - const vec3 coords[3] = vec3[]( - vec3(1,0,0), vec3(0,1,0), vec3(0,0,1) - ); - hd_barycentricCoord = coords[index]; - hd_drawingCoord dc = GetDrawingCoord(); - gs_interstageDrawingCoord0[0] = dc.modelCoord; - gs_interstageDrawingCoord0[1] = dc.constantCoord; - gs_interstageDrawingCoord0[2] = dc.elementCoord; - gs_interstageDrawingCoord0[3] = dc.primitiveCoord; - gs_interstageDrawingCoord1[0] = dc.fvarCoord; - gs_interstageDrawingCoord1[1] = dc.shaderCoord; - gs_interstageDrawingCoord1[2] = dc.vertexCoord; - gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; - gs_interstageDrawingCoord2[0] = dc.varyingCoord; - gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; - outPrimvars.points = inPrimvars[index].points; - outPrimvars.normals = inPrimvars[index].normals; - outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); -} - -// --------------------------------------------------------------------------- -// global defines -// --------------------------------------------------------------------------- -// codeGen can override this range (currently not). -// quadro 4000's max is 189. -#ifndef HD_GL_POINT_SIZE_MAX -#define HD_GL_POINT_SIZE_MAX 100.0 -#endif -#ifndef HD_GL_POINT_SIZE_MIN -#define HD_GL_POINT_SIZE_MIN .45 -#endif - -// --------------------------------------------------------------------------- -// render pass states -// --------------------------------------------------------------------------- - -MAT4 GetWorldToViewMatrix() { -#if defined(HD_HAS_worldToViewMatrix) - return MAT4(HdGet_worldToViewMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetWorldToViewInverseMatrix() { -#if defined(HD_HAS_worldToViewInverseMatrix) - return MAT4(HdGet_worldToViewInverseMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetProjectionMatrix() { -#if defined(HD_HAS_projectionMatrix) - return MAT4(HdGet_projectionMatrix()); -#else - return MAT4(1); -#endif -} -vec3 GetPositionInWorldSpace(vec3 windowRelativeCoord) -{ -#if defined(HD_HAS_imageToWorldMatrix) - vec4 pImage = vec4(windowRelativeCoord, 1.0); - vec4 pWorld = vec4(HdGet_imageToWorldMatrix() * pImage); - return (pWorld / pWorld.w).xyz; -#else - return windowRelativeCoord; -#endif -} -float GetLightingBlendAmount() { -#if defined(HD_HAS_lightingBlendAmount) - return HdGet_lightingBlendAmount(); -#else - return 1; -#endif -} -vec4 GetViewport() { -#if defined(HD_HAS_viewport) - return HdGet_viewport(); -#else - return vec4(0,0,1,1); -#endif -} -float GetTessLevel() { -#if defined(HD_HAS_tessLevel) - return HdGet_tessLevel(); -#else - return 1; -#endif -} -float GetPointSize() { -#if defined(HD_HAS_pointSize) - return HdGet_pointSize(); -#else - return 3.0; -#endif -} -float GetPointSelectedSize() { -#if defined(HD_HAS_pointSelectedSize) - return HdGet_pointSelectedSize(); -#else - return 5.0; -#endif -} -vec4 GetWireframeColor() { -// Individual prims can specify an alternative wireframe color -// to one specified in the render pass. This is used in cases were -// there is not enough contrast with the normal one. -#if defined(HD_HAS_overrideWireframeColor) - return HdGet_overrideWireframeColor(); -#elif defined(HD_HAS_wireframeColor) - return HdGet_wireframeColor(); -#else - return vec4(0,0,0,0); -#endif -} -vec4 GetMaskColor() { -#if defined(HD_HAS_maskColor) - return HdGet_maskColor(); -#else - return vec4(0.5,0,0,1); -#endif -} -vec4 GetIndicatorColor() { -#if defined(HD_HAS_indicatorColor) - return HdGet_indicatorColor(); -#else - return vec4(0,0.5,0,1); -#endif -} - -bool ShouldDiscardByAlpha(vec4 color) -{ -#if defined(HD_HAS_alphaThreshold) - float alphaThreshold = HdGet_alphaThreshold(); -#else - float alphaThreshold = 0; -#endif - return (color.a < alphaThreshold); -} - -vec2 ApplyAxisAlignedAffineTransform(vec4 t, vec2 pt) -{ - return t.xy * pt + t.zw; -} - - - -void ApplyClipPlanes(vec4 Peye) -{ -#if defined(HD_HAS_numClipPlanes) -#if defined(HD_HAS_clipPlanes) - for (int i=0; i 0.0) - normal = normalize(normal); - return normal; -} - -vec3 GetNormal(vec3 Neye, int index, vec2 localST) -{ - return GetNormal(Neye, index); -} - - - -vec3 GetTriGeometryNormal(vec3 Neye, vec4 Peye0, vec4 Peye1, vec4 Peye2, - bool isFlipped) -{ - return Neye; -} - -vec3 GetQuadGeometryNormal(vec3 Neye, - vec4 Peye0, vec4 Peye1, vec4 Peye2, vec4 Peye3, - bool isFlipped) -{ - return Neye; -} - - - -vec4 DisplacementTerminal(int index, vec4 Peye, vec3 Neye, vec4 patchCoord) -{ - return Peye; -} - - - -vec4 GetPatchCoord(int index) -{ - vec2 uv[3]; - uv[0] = vec2(0, 0); // (0, 0, 1); - uv[1] = vec2(1, 0); // (1, 0, 0); - uv[2] = vec2(0, 1); // (0, 1, 0); - - ivec3 patchParam = GetPatchParam(); - return InterpolatePatchCoordTriangle(uv[index], patchParam); -} - -void emit(int index, vec4 Peye, vec3 Neye) -{ - outData.Peye = Peye; - outData.Neye = Neye; - - gsPatchCoord = GetPatchCoord(index); - - gl_Position = vec4(GetProjectionMatrix() * outData.Peye); - ApplyClipPlanes(outData.Peye); - - ProcessPrimvarsOut(index); - - EmitVertex(); -} - -void main(void) -{ - gl_PrimitiveID = gl_PrimitiveIDIn; - - bool isFlipped = IsFlipped(); // consider handedness AND negative-scale - - vec3 Neye0 = GetNormal(inData[0].Neye, 0); - Neye0 = GetTriGeometryNormal(Neye0, inData[0].Peye, inData[1].Peye, - inData[2].Peye, isFlipped); - vec3 Neye1 = GetNormal(inData[1].Neye, 1); - Neye1 = GetTriGeometryNormal(Neye1, inData[0].Peye, inData[1].Peye, - inData[2].Peye, isFlipped); - vec3 Neye2 = GetNormal(inData[2].Neye, 2); - Neye2 = GetTriGeometryNormal(Neye2, inData[0].Peye, inData[1].Peye, - inData[2].Peye, isFlipped); - - vec4 Peye0 = DisplacementTerminal( - 0, inData[0].Peye, Neye0, GetPatchCoord(0)); - vec4 Peye1 = DisplacementTerminal( - 1, inData[1].Peye, Neye1, GetPatchCoord(1)); - vec4 Peye2 = DisplacementTerminal( - 2, inData[2].Peye, Neye2, GetPatchCoord(2)); - - // triangle 0: vertices (0,1,2) - emit(0, Peye0, Neye0); - emit(1, Peye1, Neye1); - emit(2, Peye2, Neye2); - - EndPrimitive(); -} - - -======================================================= - FRAGMENT SHADER -======================================================= -#version 450 -#extension GL_NV_shader_buffer_load : require -#extension GL_NV_gpu_shader5 : require -#extension GL_ARB_bindless_texture : require -#define REF(space,type) inout type -#define FORWARD_DECL(func_decl) func_decl; -#define ATOMIC_LOAD(a) (a) -#define ATOMIC_STORE(a, v) (a) = (v) -#define ATOMIC_ADD(a, v) atomicAdd(a, v) -#define ATOMIC_EXCHANGE(a, v) atomicExchange(a, v) -#define ATOMIC_COMP_SWAP(a, expected, desired) atomicCompSwap(a, expected, desired) -#define atomic_int int -#define atomic_uint uint - -#define HGI_HAS_DOUBLE_TYPE 1 - - -struct hgi_ivec3 { int x, y, z; }; -struct hgi_vec3 { float x, y, z; }; -struct hgi_dvec3 { double x, y, z; }; -struct hgi_mat3 { float m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; -struct hgi_dmat3 { double m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; - - - -// //////// Global Includes //////// - -// //////// Global Macros //////// - -// //////// Global Structs //////// - -// //////// Global Member Declarations //////// - -// //////// Global Function Definitions //////// - - -// //////// Codegen Defines //////// -#define HD_SHADER_API 2 -#define MAT4 mat4 -// Alias hgi vec and matrix types to hd. -#define hd_ivec3 hgi_ivec3 -#define hd_vec3 hgi_vec3 -#define hd_dvec3 hgi_dvec3 -#define hd_mat3 hgi_mat3 -#define hd_dmat3 hgi_dmat3 - -ivec3 hd_ivec3_get(hd_ivec3 v) { return ivec3(v.x, v.y, v.z); } -ivec3 hd_ivec3_get(ivec3 v) { return v; } -vec3 hd_vec3_get(hd_vec3 v) { return vec3(v.x, v.y, v.z); } -vec3 hd_vec3_get(vec3 v) { return v; } -dvec3 hd_dvec3_get(hd_dvec3 v) { return dvec3(v.x, v.y, v.z); } -dvec3 hd_dvec3_get(dvec3 v) { return v; } -mat3 hd_mat3_get(hd_mat3 v) { return mat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -mat3 hd_mat3_get(mat3 v) { return v; } -dmat3 hd_dmat3_get(hd_dmat3 v) { return dmat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -dmat3 hd_dmat3_get(dmat3 v) { return v; } -hd_ivec3 hd_ivec3_set(hd_ivec3 v) { return v; } -hd_ivec3 hd_ivec3_set(ivec3 v) { return hd_ivec3(v.x, v.y, v.z); } -hd_vec3 hd_vec3_set(hd_vec3 v) { return v; } -hd_vec3 hd_vec3_set(vec3 v) { return hd_vec3(v.x, v.y, v.z); } -hd_dvec3 hd_dvec3_set(hd_dvec3 v) { return v; } -hd_dvec3 hd_dvec3_set(dvec3 v) { return hd_dvec3(v.x, v.y, v.z); } -hd_mat3 hd_mat3_set(hd_mat3 v) { return v; } -hd_mat3 hd_mat3_set(mat3 v) { return hd_mat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -hd_dmat3 hd_dmat3_set(hd_dmat3 v) { return v; } -hd_dmat3 hd_dmat3_set(dmat3 v) { return hd_dmat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -int hd_int_get(int v) { return v; } -int hd_int_get(ivec2 v) { return v.x; } -int hd_int_get(ivec3 v) { return v.x; } -int hd_int_get(ivec4 v) { return v.x; } -vec3 hd_sample_udim(vec2 v) { -vec2 vf = floor(v); -return vec3(v.x - vf.x, v.y - vf.y, clamp(vf.x, 0.0, 10.0) + 10.0 * vf.y); -} -vec4 hd_vec4_2_10_10_10_get(int v) { - ivec4 unpacked = ivec4((v & 0x3ff) << 22, (v & 0xffc00) << 12, - (v & 0x3ff00000) << 2, (v & 0xc0000000)); - return vec4(unpacked) / 2147483647.0; } -int hd_vec4_2_10_10_10_set(vec4 v) { - return ( (int(v.x * 511.0) & 0x3ff) | - ((int(v.y * 511.0) & 0x3ff) << 10) | - ((int(v.z * 511.0) & 0x3ff) << 20) | - ((int(v.w) & 0x1) << 30)); } -vec2 hd_half2_get(uint v) { - return unpackHalf2x16(v); } -uint hd_half2_set(vec2 v) { - return packHalf2x16(v); } -vec4 hd_half4_get(uvec2 v) { - return vec4(unpackHalf2x16(v.x), unpackHalf2x16(v.y)); } -uvec2 hd_half4_set(vec4 v) { - return uvec2(packHalf2x16(v.xy), packHalf2x16(v.zw)); } -#define HD_NUM_PRIMITIVE_VERTS 3 -#define HD_HAS_transform 1 -#define HD_HAS_transformInverse 1 -#define HD_HAS_color 1 -#define HD_HAS_primID 1 -#define HD_HAS_widths 1 -#define HD_INSTANCER_NUM_LEVELS 0 -#define HD_INSTANCE_INDEX_WIDTH 1 -#define HD_HAS_faceVisibility 1 -#define HD_HAS_dispTextureCoord 1 -#define HD_HAS_points 1 -#define HD_HAS_normals 1 - -// //////// Codegen Decl //////// -struct hd_drawingCoord { - int modelCoord; - int constantCoord; - int elementCoord; - int primitiveCoord; - int fvarCoord; - int shaderCoord; - int vertexCoord; - int topologyVisibilityCoord; - int varyingCoord; - int instanceIndex[HD_INSTANCE_INDEX_WIDTH]; - int instanceCoords[HD_INSTANCE_INDEX_WIDTH]; -}; -FORWARD_DECL(hd_drawingCoord GetDrawingCoord()); -FORWARD_DECL(int HgiGetBaseVertex()); -struct hd_instanceIndex { int indices[HD_INSTANCE_INDEX_WIDTH]; }; -struct ConstantData10 { - mat4 transform; - mat4 transformInverse; - vec4 color; - vec4 primID; - float widths; -}; -FORWARD_DECL(int GetElementID()); -FORWARD_DECL(int GetAggregatedElementID()); -FORWARD_DECL(int GetPrimitiveEdgeId()); -FORWARD_DECL(float GetSelectedEdgeOpacity()); -layout(location = 0) uniform ConstantData10 *constantPrimvars; -layout(location = 1) uniform int *primitiveParam; -layout(location = 2) uniform int *edgeIndices; -layout(location = 3) uniform float *faceVisibility; -in vec4 gsPatchCoord; -in VertexData { - vec4 Peye; - vec3 Neye; -} inData; -layout (location = 0) out vec4 colorOut; -in noperspective vec3 hd_barycentricCoord; -in flat ivec4 gs_interstageDrawingCoord0; -in flat ivec4 gs_interstageDrawingCoord1; -in flat ivec4 gs_interstageDrawingCoord2; -in PrimvarData { - vec3 points; - vec3 normals; - vec2 dispTextureCoord; -} inPrimvars; -layout(location = 4) uniform vec2 *dispTextureCoord; -vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) -{ - // add 0.5 to integer values for more robust interpolation - return vec4(uv.x, uv.y, 0, patchParam.x+0.5f); -} -vec4 InterpolatePatchCoordTriangle(vec2 uv, ivec3 patchParam) -{ - return InterpolatePatchCoord(uv, patchParam); -} - -// //////// Codegen Accessors //////// -mat4 HdGet_transform(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transform); -} -mat4 HdGet_transform() { return HdGet_transform(0); } -mat4 HdGet_transformInverse(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transformInverse); -} -mat4 HdGet_transformInverse() { return HdGet_transformInverse(0); } -vec4 HdGet_color(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].color); -} -vec4 HdGet_color() { return HdGet_color(0); } -float HdGetScalar_color(int localIndex) { return HdGet_color(localIndex).x; } -float HdGetScalar_color() { return HdGet_color(0).x; } -vec4 HdGet_primID(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].primID); -} -vec4 HdGet_primID() { return HdGet_primID(0); } -float HdGetScalar_primID(int localIndex) { return HdGet_primID(localIndex).x; } -float HdGetScalar_primID() { return HdGet_primID(0).x; } -float HdGet_widths(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return float(constantPrimvars[index].widths); -} -float HdGet_widths() { return HdGet_widths(0); } -float HdGetScalar_widths(int localIndex) { return HdGet_widths(localIndex); } -float HdGetScalar_widths() { return HdGet_widths(0); } - -// //////// Codegen FS Source //////// -#define HD_SHADER_SUPPORTS_DOUBLE_PRECISION -#define HD_MINUS_ONE_TO_ONE_DEPTH_RANGE -vec3 GetBarycentricCoord() { - return hd_barycentricCoord; -} -int GetPrimitiveID() { - return gl_PrimitiveID; -} -int GetPrimitiveIndex() { - return GetDrawingCoord().primitiveCoord + GetPrimitiveID(); -} -hd_drawingCoord GetDrawingCoord() { - hd_drawingCoord dc; - dc.modelCoord = gs_interstageDrawingCoord0[0]; - dc.constantCoord = gs_interstageDrawingCoord0[1]; - dc.elementCoord = gs_interstageDrawingCoord0[2]; - dc.primitiveCoord = gs_interstageDrawingCoord0[3]; - dc.fvarCoord = gs_interstageDrawingCoord1[0]; - dc.shaderCoord = gs_interstageDrawingCoord1[1]; - dc.vertexCoord = gs_interstageDrawingCoord1[2]; - dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; - dc.varyingCoord = gs_interstageDrawingCoord2[0]; - dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; - return dc; -} -int HdGet_primitiveParam(int localIndex) { - int index = GetPrimitiveIndex(); - return int(primitiveParam[index]); -} -int HdGet_primitiveParam() { return HdGet_primitiveParam(0); } -int HdGetScalar_primitiveParam(int localIndex) { return HdGet_primitiveParam(localIndex); } -int HdGetScalar_primitiveParam() { return HdGet_primitiveParam(0); } -#if defined(HD_HAS_coarseFaceIndex) -FORWARD_DECL(int HdGetScalar_coarseFaceIndex()); -#endif -ivec3 GetPatchParam() { -#if defined(HD_HAS_coarseFaceIndex) - return ivec3(HdGetScalar_coarseFaceIndex(), 0, 0); -#else - return ivec3(GetPrimitiveID(), 0, 0); -#endif -} -int GetEdgeFlag() { - return (HdGet_primitiveParam() & 3); -} -int GetFVarIndex(int localIndex) { - int fvarCoord = GetDrawingCoord().fvarCoord; - int ptexIndex = GetPatchParam().x & 0xfffffff; - return fvarCoord + ptexIndex * 3 + localIndex; -} -int GetElementID() { - return (hd_int_get(HdGet_primitiveParam()) >> 2); -} -int GetAggregatedElementID() { - return GetElementID() - + GetDrawingCoord().elementCoord; -} -int HdGet_edgeIndices(int localIndex) { - int index = GetPrimitiveIndex(); - return int(edgeIndices[index]); -} -int HdGet_edgeIndices() { return HdGet_edgeIndices(0); } -int HdGetScalar_edgeIndices(int localIndex) { return HdGet_edgeIndices(localIndex); } -int HdGetScalar_edgeIndices() { return HdGet_edgeIndices(0); } -int GetAuthoredEdgeId(int primitiveEdgeId) { - return primitiveEdgeId; -} -float HdGet_faceVisibility(int localIndex) { - int index = GetAggregatedElementID(); - return float(faceVisibility[index]); -} -float HdGet_faceVisibility() { return HdGet_faceVisibility(0); } -float HdGetScalar_faceVisibility(int localIndex) { return HdGet_faceVisibility(localIndex); } -float HdGetScalar_faceVisibility() { return HdGet_faceVisibility(0); } -vec3 HdGet_points(int localIndex) { return vec3(inPrimvars.points);} -vec3 HdGet_points() { return HdGet_points(0); } -float HdGetScalar_points(int localIndex) { return HdGet_points(localIndex).x; } -float HdGetScalar_points() { return HdGet_points(0).x; } -vec3 HdGet_normals(int localIndex) { return vec3(inPrimvars.normals);} -vec3 HdGet_normals() { return HdGet_normals(0); } -float HdGetScalar_normals(int localIndex) { return HdGet_normals(localIndex).x; } -float HdGetScalar_normals() { return HdGet_normals(0).x; } -vec2 HdGet_dispTextureCoord(int localIndex) { return vec2(inPrimvars.dispTextureCoord);} -vec2 HdGet_dispTextureCoord() { return HdGet_dispTextureCoord(0); } -float HdGetScalar_dispTextureCoord(int localIndex) { return HdGet_dispTextureCoord(localIndex).x; } -float HdGetScalar_dispTextureCoord() { return HdGet_dispTextureCoord(0).x; } -FORWARD_DECL(vec4 GetPatchCoord(int index)); -void ProcessSamplingTransforms(MAT4 instanceModelViewInverse) { -} - -// --------------------------------------------------------------------------- -// global defines -// --------------------------------------------------------------------------- -// codeGen can override this range (currently not). -// quadro 4000's max is 189. -#ifndef HD_GL_POINT_SIZE_MAX -#define HD_GL_POINT_SIZE_MAX 100.0 -#endif -#ifndef HD_GL_POINT_SIZE_MIN -#define HD_GL_POINT_SIZE_MIN .45 -#endif - -// --------------------------------------------------------------------------- -// render pass states -// --------------------------------------------------------------------------- - -MAT4 GetWorldToViewMatrix() { -#if defined(HD_HAS_worldToViewMatrix) - return MAT4(HdGet_worldToViewMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetWorldToViewInverseMatrix() { -#if defined(HD_HAS_worldToViewInverseMatrix) - return MAT4(HdGet_worldToViewInverseMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetProjectionMatrix() { -#if defined(HD_HAS_projectionMatrix) - return MAT4(HdGet_projectionMatrix()); -#else - return MAT4(1); -#endif -} -vec3 GetPositionInWorldSpace(vec3 windowRelativeCoord) -{ -#if defined(HD_HAS_imageToWorldMatrix) - vec4 pImage = vec4(windowRelativeCoord, 1.0); - vec4 pWorld = vec4(HdGet_imageToWorldMatrix() * pImage); - return (pWorld / pWorld.w).xyz; -#else - return windowRelativeCoord; -#endif -} -float GetLightingBlendAmount() { -#if defined(HD_HAS_lightingBlendAmount) - return HdGet_lightingBlendAmount(); -#else - return 1; -#endif -} -vec4 GetViewport() { -#if defined(HD_HAS_viewport) - return HdGet_viewport(); -#else - return vec4(0,0,1,1); -#endif -} -float GetTessLevel() { -#if defined(HD_HAS_tessLevel) - return HdGet_tessLevel(); -#else - return 1; -#endif -} -float GetPointSize() { -#if defined(HD_HAS_pointSize) - return HdGet_pointSize(); -#else - return 3.0; -#endif -} -float GetPointSelectedSize() { -#if defined(HD_HAS_pointSelectedSize) - return HdGet_pointSelectedSize(); -#else - return 5.0; -#endif -} -vec4 GetWireframeColor() { -// Individual prims can specify an alternative wireframe color -// to one specified in the render pass. This is used in cases were -// there is not enough contrast with the normal one. -#if defined(HD_HAS_overrideWireframeColor) - return HdGet_overrideWireframeColor(); -#elif defined(HD_HAS_wireframeColor) - return HdGet_wireframeColor(); -#else - return vec4(0,0,0,0); -#endif -} -vec4 GetMaskColor() { -#if defined(HD_HAS_maskColor) - return HdGet_maskColor(); -#else - return vec4(0.5,0,0,1); -#endif -} -vec4 GetIndicatorColor() { -#if defined(HD_HAS_indicatorColor) - return HdGet_indicatorColor(); -#else - return vec4(0,0.5,0,1); -#endif -} - -bool ShouldDiscardByAlpha(vec4 color) -{ -#if defined(HD_HAS_alphaThreshold) - float alphaThreshold = HdGet_alphaThreshold(); -#else - float alphaThreshold = 0; -#endif - return (color.a < alphaThreshold); -} - -vec2 ApplyAxisAlignedAffineTransform(vec4 t, vec2 pt) -{ - return t.xy * pt + t.zw; -} - - - -vec2 HorizontallyNormalizedFilmbackCoordinates() -{ - const vec4 transform = -#ifdef HD_HAS_imageToHorizontallyNormalizedFilmback - HdGet_imageToHorizontallyNormalizedFilmback(); -#else - vec4(vec2(1.0), vec2(0.0)); -#endif - return ApplyAxisAlignedAffineTransform(transform, gl_FragCoord.xy); -} - - - -vec4 ApplySelectionColor(vec4 color) -{ - return color; -} - - - -// Forward declare selection functionality. -// XXX: Currently, the non-empty implementation of this is in hdx. -FORWARD_DECL(vec4 ApplySelectionColor(vec4 color)); - -// XXX: Make sure to update hdx/shaders/renderPass.glslfx when editing these -// color override methods, since they're currently duplicated. This is because -// we don't have a mixin token for color overrides in a render pass yet. -vec4 ApplyColorOverrides(vec4 color) -{ -#if defined(HD_HAS_overrideColor) - // Mix in override color - vec4 overrideColor = HdGet_overrideColor(); - color.rgb = mix(color.rgb, overrideColor.rgb, overrideColor.a); -#endif - return ApplySelectionColor(color); -} - -vec3 ApplyMaskColor(vec3 color, float weight, vec4 maskColor) -{ - float strength = maskColor.a * clamp(weight, 0.0, 1.0); - return mix(color, maskColor.rgb, strength); -} - -vec4 ApplyColorOverridesPostLighting(vec4 color) -{ - #if defined(HD_HAS_maskWeight) - float maskWeight = HdGet_maskWeight(); - vec4 maskColor = GetMaskColor(); - color.rgb = ApplyMaskColor(color.rgb, maskWeight, maskColor); - #endif - #if defined(HD_HAS_indicatorWeight) - float indicatorWeight = HdGet_indicatorWeight(); - vec4 indicatorColor = GetIndicatorColor(); - color.rgb = ApplyMaskColor(color.rgb, indicatorWeight, indicatorColor); - #endif - return color; -} - - - -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) -{ - colorOut = color; -} - - -#ifndef HD_HAS_integrateLights -#define HD_HAS_integrateLights -#endif - -struct LightingContribution { - vec3 diffuse; -}; - -struct LightingInterfaceProperties { - float unused; -}; - -LightingContribution -integrateLightsDefault(vec4 Peye, vec3 Neye, LightingInterfaceProperties props) -{ - vec3 n = normalize(Neye); - - LightingContribution result; - result.diffuse = vec3(dot(n, vec3(0,0,1))); - - return result; -} - -LightingContribution -integrateLightsConstant(vec4 Peye, vec3 Neye, LightingInterfaceProperties props) -{ - LightingContribution result; - //pefectly diffuse white hemisphere contribution - result.diffuse = vec3(1); - - return result; -} - - - -FORWARD_DECL( - LightingContribution integrateLights(vec4 Peye, vec3 Neye, - LightingInterfaceProperties props)); - -vec3 FallbackLighting(in vec3 Peye, in vec3 Neye, in vec3 color) -{ - LightingInterfaceProperties props; - LightingContribution light = integrateLights(vec4(Peye, 1), Neye, props); - return color * light.diffuse; -} - - -vec4 surfaceShader(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) -{ - // lighting - color.rgb = FallbackLighting(Peye.xyz, Neye, color.rgb); - return color; -} - - -// quaternion to matrix. xyz = imaginary, w = real -MAT4 GetRotationMatrix(vec4 q) -{ - MAT4 r; - r[0].xyzw = vec4(1 - 2 * (q.y * q.y + q.z * q.z), - 2 * (q.x * q.y + q.z * q.w), - 2 * (q.x * q.z - q.y * q.w), - 0); - r[1].xyzw = vec4( 2 * (q.x * q.y - q.z * q.w), - 1 - 2 * (q.x * q.x + q.z * q.z), - 2 * (q.y * q.z + q.x * q.w), - 0); - r[2].xyzw = vec4( 2 * (q.x * q.z + q.y * q.w), - 2 * (q.y * q.z - q.x * q.w), - 1 - 2 * (q.x * q.x + q.y * q.y), - 0); - r[3] = vec4(0, 0, 0, 1); - return r; -} - -// --------------------------------------------------------------------------- - -MAT4 GetInstanceTransform(int level) -{ - MAT4 m = MAT4(1); -#ifdef HD_HAS_INSTANCE_hydra_instanceTransforms - m = HdGetInstance_hydra_instanceTransforms(level, MAT4(1)) * m; -#elif defined(HD_HAS_INSTANCE_instanceTransform) - m = HdGetInstance_instanceTransform(level, MAT4(1)) * m; -#endif - - // instance transform elements are applied: - // scale then rotate then translate - // i.e. (T * R * S) * position - -#ifdef HD_HAS_INSTANCE_hydra_instanceScales - vec3 s = HdGetInstance_hydra_instanceScales(level, /*default=*/vec3(1)); - m = MAT4(s.x, 0, 0, 0, - 0, s.y, 0, 0, - 0, 0, s.z, 0, - 0, 0, 0, 1) * m; -#elif defined(HD_HAS_INSTANCE_instanceScale) - vec3 s = HdGetInstance_scale(level, /*default=*/vec3(1)); - m = MAT4(s.x, 0, 0, 0, - 0, s.y, 0, 0, - 0, 0, s.z, 0, - 0, 0, 0, 1) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceRotations // GfQuat(ix, iy, iz, real) - vec4 q = HdGetInstance_hydra_instanceRotations(level, /*default=*/vec4(0)); - m = GetRotationMatrix(q) * m; -#elif defined(HD_HAS_INSTANCE_rotate) - vec4 q = HdGetInstance_rotate(level, /*default=*/vec4(0)); - m = GetRotationMatrix(q) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceTranslations - vec3 t = HdGetInstance_hydra_instanceTranslations(level, /*default=*/vec3(0)); - m = MAT4( 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - t.x, t.y, t.z, 1) * m; -#elif defined(HD_HAS_INSTANCE_translate) - vec3 t = HdGetInstance_translate(level, /*default=*/vec3(0)); - m = MAT4( 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - t.x, t.y, t.z, 1) * m; -#endif - return m; -} - -MAT4 GetInstanceTransformInverse(int level) -{ - MAT4 m = MAT4(1); - -#ifdef HD_HAS_INSTANCE_hydra_instanceTransforms - m = inverse(HdGetInstance_hydra_instanceTransforms(level, MAT4(1))) * m; -#elif defined(HD_HAS_INSTANCE_instanceTransform) - m = inverse(HdGetInstance_instanceTransform(level, MAT4(1))) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceTranslations - vec3 it = -HdGetInstance_hydra_instanceTranslations(level, /*default=*/vec3(0)); // negate - m = MAT4( 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - it.x, it.y, it.z, 1) * m; -#elif defined(HD_HAS_INSTANCE_translate) - vec3 it = -HdGetInstance_translate(level, /*default=*/vec3(0)); // negate - m = MAT4( 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - it.x, it.y, it.z, 1) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceRotations - vec4 q = HdGetInstance_hydra_instanceRotations(level, /*default=*/vec4(0)); - q.xyz = -q.xyz; // inverse rotataion axis - m = GetRotationMatrix(q) * m; -#elif defined(HD_HAS_INSTANCE_rotate) - vec4 q = HdGetInstance_rotate(level, /*default=*/vec4(0)); - q.xyz = -q.xyz; // inverse rotataion axis - m = GetRotationMatrix(q) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceScales - vec3 is = 1.0/HdGetInstance_hydra_instanceScales(level, /*default=*/vec3(1)); // inverse scale - m = MAT4(is.x, 0, 0, 0, - 0, is.y, 0, 0, - 0, 0, is.z, 0, - 0, 0, 0, 1) * m; -#elif defined(HD_HAS_INSTANCE_scale) - vec3 is = 1.0/HdGetInstance_scale(level, /*default=*/vec3(1)); // inverse scale - m = MAT4(is.x, 0, 0, 0, - 0, is.y, 0, 0, - 0, 0, is.z, 0, - 0, 0, 0, 1) * m; -#endif - return m; -} - -// --------------------------------------------------------------------------- - -MAT4 GetInstanceTransform() -{ - MAT4 m = MAT4(1); -#ifdef HD_INSTANCER_NUM_LEVELS - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - m = GetInstanceTransform(i) * m; -#ifdef HD_HAS_instancerTransform - m = HdGet_instancerTransform(i) * m; -#endif - } -#endif - return m; -} - -MAT4 GetInstanceTransformInverse() -{ - MAT4 m = MAT4(1); -#ifdef HD_INSTANCER_NUM_LEVELS - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - m = m * GetInstanceTransformInverse(i); -#ifdef HD_HAS_instancerTransformInverse - m = m * HdGet_instancerTransformInverse(i); -#endif - } -#endif - return m; -} - -// --------------------------------------------------------------------------- - -MAT4 ApplyInstanceTransform(MAT4 m) -{ - return GetInstanceTransform() * m; -} - -MAT4 ApplyInstanceTransformInverse(MAT4 m) -{ - return m * GetInstanceTransformInverse(); -} - -bool IsFlipped() -{ -#if defined(HD_HAS_isFlipped) - bool flip = (HdGet_isFlipped() != 0); -#elif defined(HD_HAS_transform) - // The sign of the determinant indicates whether m flips handedness - bool flip = (determinant(HdGet_transform()) < 0.0); -#else - bool flip = false; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceScales - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - vec3 scale = HdGetInstance_hydra_instanceScales(i, /*default=*/vec3(1)); - flip = flip != ((sign(scale.x) * sign(scale.y) * sign(scale.z)) < 0); - } -#elif defined(HD_HAS_INSTANCE_scale) - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - vec3 scale = HdGetInstance_scale(i, /*default=*/vec3(1)); - flip = flip != ((sign(scale.x) * sign(scale.y) * sign(scale.z)) < 0); - } -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceTransforms - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - MAT4 m = HdGetInstance_hydra_instanceTransforms(i, MAT4(1)); - flip = flip != (determinant(m) < 0.0); - } -#elif defined(HD_HAS_INSTANCE_instanceTransform) - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - MAT4 m = HdGetInstance_instanceTransform(i, MAT4(1)); - flip = flip != (determinant(m) < 0.0); - } -#endif - - return flip; -} - - -vec3 GetNormal(vec3 Neye, int index) -{ - return Neye; -} - -vec3 GetNormal(vec3 Neye, int index, vec2 localST) -{ - return GetNormal(Neye, index); -} - - - -vec3 GetShadingNormal(vec3 N, bool isFlipped) -{ - // the fragment shader takes already-flipped-normals. - // no need to flip here. - return N; -} - - - -void DiscardBasedOnShading(bool frontFacing, bool isFlipped) -{ - // Nothing to do since h/w face culling is used. -} - - - -vec4 ApplyEdgeColor(vec4 Cfill, vec4 patchCoord) -{ - return Cfill; -} - -// Return a large value, signifying that the fragment isn't near an edge. -float GetMinEdgeDistance() -{ - return 1000.0; -} - - - -vec3 GetEdgeParamTriangle() -{ - // Expand barycentric coordinates - vec2 param = GetPatchCoord(0).xy; - vec3 barycentric = vec3(param.x, param.y, 1 - param.x - param.y); - - // Match triangle edge order - return barycentric.yzx; -} - -vec3 GetEdgeDistanceTriangle() -{ - vec3 param = GetEdgeParamTriangle(); - return max(vec3(0.0), param / fwidth(param)); -} - -vec4 GetEdgeParamQuad() -{ - // Expand coordinates to opposite corners of quad - vec2 leftBottom = GetPatchCoord(0).xy; - vec2 rightTop = vec2(1.0) - leftBottom; - - // Match quad edge order - return vec4(leftBottom.y, rightTop.x, rightTop.y, leftBottom.x); -} - -vec4 GetEdgeDistanceQuad() -{ - vec4 param = GetEdgeParamQuad(); - return max(vec4(0.0), param / fwidth(param)); -} - - - -struct ReprStyle -{ - vec4 color; - bool usePrimvarColor; - bool usePrimvarAlpha; - bool applyColorOverride; - bool useSurfaceShaderColor; - bool useSurfaceShaderAlpha; -}; - -struct ScalarOverride -{ - bool enabled; - vec3 color; -}; - -FORWARD_DECL(ReprStyle GetReprStyle()); -FORWARD_DECL(ScalarOverride GetScalarOverride()); -FORWARD_DECL( - vec4 surfaceShader(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord)); -FORWARD_DECL(vec4 postSurfaceShader(vec4 Peye, vec3 Neye, vec4 color)); - -vec4 ShadingTerminal(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) -{ - ReprStyle reprStyle = GetReprStyle(); - - // Apply scalar override. - ScalarOverride scalarOverride = GetScalarOverride(); - if (scalarOverride.enabled) { - vec4 result; - - result.rgb = scalarOverride.color; - result.a = reprStyle.usePrimvarAlpha ? color.a: reprStyle.color.a; - - vec4 colorOverride = ApplyColorOverrides(result); - result = reprStyle.applyColorOverride ? colorOverride : result; - - return result; - } - - // Draw mode can override face color - vec4 reprColor; - - reprColor.rgb = reprStyle.usePrimvarColor ? color.rgb : reprStyle.color.rgb; - reprColor.a = reprStyle.usePrimvarAlpha ? color.a : reprStyle.color.a; - - // Compute color overrides - vec4 colorOverride = ApplyColorOverrides(reprColor); - reprColor = reprStyle.applyColorOverride ? colorOverride : reprColor; - - - // Surface shading can be expensive and also can contain undesirable - // side effects (like discards). So only run it for reprs that require it. - - if (reprStyle.useSurfaceShaderColor || - reprStyle.useSurfaceShaderAlpha) { - vec4 shadingColor; - - shadingColor = surfaceShader(Peye, - Neye, - reprColor, - patchCoord); - -#ifdef HD_HAS_postSurfaceShader - shadingColor = postSurfaceShader(Peye, - Neye, - shadingColor); -#endif - - reprColor.rgb = reprStyle.useSurfaceShaderColor ? - shadingColor.rgb : - reprColor.rgb; - - reprColor.a = reprStyle.useSurfaceShaderAlpha ? - shadingColor.a : - reprColor.a; - } - - vec4 baseColor = color; - baseColor = ApplyColorOverrides(baseColor); - - vec4 litColor = mix(baseColor, - reprColor, - GetLightingBlendAmount()); - - // Final overrides. - - return ApplyColorOverridesPostLighting(litColor); -} - - - -#ifdef HD_HAS_integrateLights -#ifndef HD_HAS_definedIntegrateLights -#define HD_HAS_definedIntegrateLights - -LightingContribution -integrateLights(vec4 Peye, vec3 Neye, LightingInterfaceProperties props) -{ - return integrateLightsDefault(Peye, Neye, props); -} - -#endif // HD_HAS_definedIntegrateLights -#endif - -ReprStyle GetReprStyle() -{ - ReprStyle reprStyle; - - reprStyle.color = vec4(0.0, 0.0, 0.0, 1.0); - reprStyle.usePrimvarColor = true; - reprStyle.usePrimvarAlpha = true; - reprStyle.applyColorOverride = true; - reprStyle.useSurfaceShaderColor = true; - reprStyle.useSurfaceShaderAlpha = true; - - return reprStyle; -} - - - -ScalarOverride GetScalarOverride() -{ - ScalarOverride result; - -#if defined(HD_HAS_scalarOverride) - result.enabled = true; - - // Allow a scalar value to override the color from the surface - // for previewing heatmaps. This is useful for editing workflows. -#if defined(HD_HAS_scalarOverrideColorRamp) - int rampCount = constantPrimvars[GetDrawingCoord().constantCoord]. - scalarOverrideColorRamp.length(); - float scalar = HdGet_scalarOverride() * float(rampCount - 1); - float baseIndex = floor(scalar); - float nextIndex = min(float(rampCount - 1), baseIndex + 1.0); - float interp = scalar - baseIndex; - result.color = mix(HdGet_scalarOverrideColorRamp(int(baseIndex)).rgb, - HdGet_scalarOverrideColorRamp(int(nextIndex)).rgb, - interp); -#else - // If no ramp is given just gamma correct the scalar as greyscale. - result.color = vec3(pow(HdGet_scalarOverride(), 2.2)); -#endif // HD_HAS_scalarOverrideColorRamp - -#else // HD_HAS_scalarOverride - result.enabled = false; - result.color = vec3(0.0, 0.0, 0.0); -#endif - - return result; -} - - - -// Determines whether a fragment is on or close to an unhidden triangle edge. -const float edgePickRadius = 2; // in viewport pixels -const float edgePickParametricRadius = 0.02; // in parametric space - -// For smooth looking edges, use an exponential falloff for the opacity. -// Note: We use a slower falloff fn than in meshWire.glslfx to make the -// selected edges stand out. -float SelectedEdgeFalloff(float d) { - return exp2(-1 * d * d); -} - - - -FORWARD_DECL(vec3 GetEdgeDistanceTriangle()); - -vec3 ComputeBaseFaceEdgeDistanceTriangle() -{ - return GetEdgeDistanceTriangle(); -} - -bool SelectWireframeFaceEdges() -{ - return false; -} - - - -float GetSelectedEdgeOpacity() -{ - float closestEdgeDistance = 0.0; - - // The sequence of comparisons should match GetPrimitiveEdgeId() - vec3 dist = ComputeBaseFaceEdgeDistanceTriangle(); - if (dist.x < edgePickRadius) { - closestEdgeDistance = dist.x; - } else if (dist.y < edgePickRadius) { - closestEdgeDistance = dist.y; - } else if (dist.z < edgePickRadius) { - closestEdgeDistance = dist.z; - } else { - return 0; - } - - return SelectedEdgeFalloff(closestEdgeDistance); -} - -// called from hdx/renderPass.glslfx and selection.glslfx -int GetPrimitiveEdgeId() -{ - // 2 (0,1,0) - // ^ - // e2 / \ e1 - // / \' - // (0,0,1) 0 ----- 1 (1,0,0) - // e0 - - int edgeId = -1; - - vec3 dist = ComputeBaseFaceEdgeDistanceTriangle(); - if (dist.x < edgePickRadius) { - edgeId = 0; - } else if (dist.y < edgePickRadius) { - edgeId = 1; - } else if (dist.z < edgePickRadius) { - edgeId = 2; - } else { - return -1; // Not on a mesh edge - } - - const int edgeFlag = GetEdgeFlag(); - const int meshEdgeIndex = HdGetScalar_edgeIndices(); - - // Translate face-edge to authored mesh-edge - if (edgeFlag == 0) { - edgeId = meshEdgeIndex + edgeId; // regular triangle face. - } else if ((bool(edgeFlag & 1) && edgeId == 2) || - (bool(edgeFlag & 2) && edgeId == 0)) { - edgeId = -1; // Not an authored mesh edge - } else { - edgeId = meshEdgeIndex + edgeId - 1; - } - return edgeId; -} - - - -int GetPointId() -{ - return -1; -} - - -void DiscardBasedOnTopologicalVisibility() -{ - // Nothing to do, since there's no authored opinion. -} - - - -vec4 GetInterpolatedPatchCoord() -{ - return gsPatchCoord; -} - - - -#ifndef HD_HAS_ptexFaceOffset -#define HD_HAS_ptexFaceOffset -int HdGet_ptexFaceOffset() -{ - return 0; -} -#endif - -vec4 GetPatchCoord(int localIndex) -{ - vec4 patchCoord = GetInterpolatedPatchCoord(); - return vec4(patchCoord.xyz, patchCoord.w + HdGet_ptexFaceOffset()); -} - -vec4 GetPatchCoord() -{ - return GetPatchCoord(0); -} - -vec3 ComputeScreenSpacePeye() -{ - return inData.Peye.xyz / inData.Peye.w; -} - -vec3 ComputeScreenSpaceNeye() -{ - vec3 Peye = ComputeScreenSpacePeye(); - vec3 Neye = normalize(cross(dFdx(Peye), dFdy(Peye))); - return (gl_FrontFacing ? Neye : -Neye); -} - -void main(void) -{ - bool isFlipped = IsFlipped(); - - DiscardBasedOnShading(gl_FrontFacing, isFlipped); - - DiscardBasedOnTopologicalVisibility(); - - vec4 color = vec4(0.5, 0.5, 0.5, 1); -#ifdef HD_HAS_displayColor - color.rgb = HdGet_displayColor().rgb; -#endif -#ifdef HD_HAS_displayOpacity - color.a = HdGet_displayOpacity(); -#endif - - vec3 Peye = ComputeScreenSpacePeye(); - - vec3 Neye = inData.Neye; - // Normalize Neye after rasterizer interpolation. - if (length(Neye) > 0.0) { - Neye = normalize(Neye); - } - // Give the shader key a chance to override the normal. - Neye = GetNormal(Neye, 0); - // Orient the normal for shading. - Neye = GetShadingNormal(Neye, isFlipped); - - vec4 patchCoord = GetPatchCoord(); - color = ShadingTerminal(vec4(Peye, 1), Neye, color, patchCoord); - - color = ApplyEdgeColor(color, patchCoord); - -#ifdef HD_MATERIAL_TAG_MASKED - if (ShouldDiscardByAlpha(color)) { - discard; - return; - } -#endif - - RenderOutput(vec4(Peye, 1), Neye, color, patchCoord); -} - -------------------------------------------------------- --- glslfx version 0.1 -#import $TOOLS/hdSt/shaders/mesh.glslfx --- configuration -{"techniques": {"default": { -"vertexShader" : { "source" : ["Instancing.Transform", "MeshNormal.Pass", "PointId.Vertex.None", "Mesh.Vertex"] } -, "geometryShader" : { "source" : ["Instancing.Transform", "MeshNormal.Flat", "MeshNormal.Geometry.NoFlat", "Geometry.NoCustomDisplacement", "Mesh.Geometry.Quad"] } -, "fragmentShader" : { "source" : ["Instancing.Transform", "MeshNormal.Pass", "MeshNormal.Fragment.SingleSided", "MeshFaceCull.Fragment.None", "MeshWire.Fragment.NoEdge", "MeshWire.Fragment.EdgeParam", "Fragment.CommonTerminals", "Fragment.Surface", "Fragment.ScalarOverride", "EdgeId.Fragment.Common", "EdgeId.Fragment.QuadSurface", "EdgeId.Fragment.QuadParam", "PointId.Fragment.Fallback", "Visibility.Fragment.Fallback", "Mesh.Fragment.PatchCoord", "Mesh.Fragment"] } -}}} -------------------------------------------------------- -======================================================= - VERTEX SHADER -======================================================= -#version 450 -#extension GL_NV_shader_buffer_load : require -#extension GL_NV_gpu_shader5 : require -#extension GL_ARB_bindless_texture : require -#extension GL_ARB_shader_draw_parameters : require -int HgiGetBaseVertex() { - return gl_BaseVertexARB; -} -#define REF(space,type) inout type -#define FORWARD_DECL(func_decl) func_decl; -#define ATOMIC_LOAD(a) (a) -#define ATOMIC_STORE(a, v) (a) = (v) -#define ATOMIC_ADD(a, v) atomicAdd(a, v) -#define ATOMIC_EXCHANGE(a, v) atomicExchange(a, v) -#define ATOMIC_COMP_SWAP(a, expected, desired) atomicCompSwap(a, expected, desired) -#define atomic_int int -#define atomic_uint uint - -#define HGI_HAS_DOUBLE_TYPE 1 - - -struct hgi_ivec3 { int x, y, z; }; -struct hgi_vec3 { float x, y, z; }; -struct hgi_dvec3 { double x, y, z; }; -struct hgi_mat3 { float m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; -struct hgi_dmat3 { double m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; - - -// //////// Codegen Defines //////// -#define HD_SHADER_API 2 -#define MAT4 mat4 -// Alias hgi vec and matrix types to hd. -#define hd_ivec3 hgi_ivec3 -#define hd_vec3 hgi_vec3 -#define hd_dvec3 hgi_dvec3 -#define hd_mat3 hgi_mat3 -#define hd_dmat3 hgi_dmat3 - -ivec3 hd_ivec3_get(hd_ivec3 v) { return ivec3(v.x, v.y, v.z); } -ivec3 hd_ivec3_get(ivec3 v) { return v; } -vec3 hd_vec3_get(hd_vec3 v) { return vec3(v.x, v.y, v.z); } -vec3 hd_vec3_get(vec3 v) { return v; } -dvec3 hd_dvec3_get(hd_dvec3 v) { return dvec3(v.x, v.y, v.z); } -dvec3 hd_dvec3_get(dvec3 v) { return v; } -mat3 hd_mat3_get(hd_mat3 v) { return mat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -mat3 hd_mat3_get(mat3 v) { return v; } -dmat3 hd_dmat3_get(hd_dmat3 v) { return dmat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -dmat3 hd_dmat3_get(dmat3 v) { return v; } -hd_ivec3 hd_ivec3_set(hd_ivec3 v) { return v; } -hd_ivec3 hd_ivec3_set(ivec3 v) { return hd_ivec3(v.x, v.y, v.z); } -hd_vec3 hd_vec3_set(hd_vec3 v) { return v; } -hd_vec3 hd_vec3_set(vec3 v) { return hd_vec3(v.x, v.y, v.z); } -hd_dvec3 hd_dvec3_set(hd_dvec3 v) { return v; } -hd_dvec3 hd_dvec3_set(dvec3 v) { return hd_dvec3(v.x, v.y, v.z); } -hd_mat3 hd_mat3_set(hd_mat3 v) { return v; } -hd_mat3 hd_mat3_set(mat3 v) { return hd_mat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -hd_dmat3 hd_dmat3_set(hd_dmat3 v) { return v; } -hd_dmat3 hd_dmat3_set(dmat3 v) { return hd_dmat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -int hd_int_get(int v) { return v; } -int hd_int_get(ivec2 v) { return v.x; } -int hd_int_get(ivec3 v) { return v.x; } -int hd_int_get(ivec4 v) { return v.x; } -vec3 hd_sample_udim(vec2 v) { -vec2 vf = floor(v); -return vec3(v.x - vf.x, v.y - vf.y, clamp(vf.x, 0.0, 10.0) + 10.0 * vf.y); -} -vec4 hd_vec4_2_10_10_10_get(int v) { - ivec4 unpacked = ivec4((v & 0x3ff) << 22, (v & 0xffc00) << 12, - (v & 0x3ff00000) << 2, (v & 0xc0000000)); - return vec4(unpacked) / 2147483647.0; } -int hd_vec4_2_10_10_10_set(vec4 v) { - return ( (int(v.x * 511.0) & 0x3ff) | - ((int(v.y * 511.0) & 0x3ff) << 10) | - ((int(v.z * 511.0) & 0x3ff) << 20) | - ((int(v.w) & 0x1) << 30)); } -vec2 hd_half2_get(uint v) { - return unpackHalf2x16(v); } -uint hd_half2_set(vec2 v) { - return packHalf2x16(v); } -vec4 hd_half4_get(uvec2 v) { - return vec4(unpackHalf2x16(v.x), unpackHalf2x16(v.y)); } -uvec2 hd_half4_set(vec4 v) { - return uvec2(packHalf2x16(v.xy), packHalf2x16(v.zw)); } -#define HD_NUM_PRIMITIVE_VERTS 4 -#define HD_HAS_transform 1 -#define HD_HAS_transformInverse 1 -#define HD_HAS_color 1 -#define HD_HAS_primID 1 -#define HD_HAS_widths 1 -#define HD_INSTANCER_NUM_LEVELS 0 -#define HD_INSTANCE_INDEX_WIDTH 1 -#define HD_HAS_faceVisibility 1 -#define HD_HAS_dispTextureCoord 1 -#define HD_HAS_points 1 -#define HD_HAS_normals 1 - - -// //////// Global Includes //////// - -// //////// Global Macros //////// - -// //////// Global Structs //////// - -// //////// Global Member Declarations //////// -uint hd_VertexID = gl_VertexID; -uint hd_InstanceID = gl_InstanceID; -uint hd_BaseInstance = 0; - -// //////// Global Function Definitions //////// - - -// //////// Codegen Decl //////// -struct hd_drawingCoord { - int modelCoord; - int constantCoord; - int elementCoord; - int primitiveCoord; - int fvarCoord; - int shaderCoord; - int vertexCoord; - int topologyVisibilityCoord; - int varyingCoord; - int instanceIndex[HD_INSTANCE_INDEX_WIDTH]; - int instanceCoords[HD_INSTANCE_INDEX_WIDTH]; -}; -FORWARD_DECL(hd_drawingCoord GetDrawingCoord()); -FORWARD_DECL(int HgiGetBaseVertex()); -struct hd_instanceIndex { int indices[HD_INSTANCE_INDEX_WIDTH]; }; -struct ConstantData10 { - mat4 transform; - mat4 transformInverse; - vec4 color; - vec4 primID; - float widths; -}; -FORWARD_DECL(int GetElementID()); -FORWARD_DECL(int GetAggregatedElementID()); -FORWARD_DECL(int GetPrimitiveEdgeId()); -FORWARD_DECL(float GetSelectedEdgeOpacity()); -out flat ivec4 vs_interstageDrawingCoord0; -out flat ivec4 vs_interstageDrawingCoord1; -out flat ivec4 vs_interstageDrawingCoord2; -layout (location = 2) in ivec4 drawingCoord0; -layout (location = 3) in ivec4 drawingCoord1; -layout (location = 4) in ivec2 drawingCoord2; -layout (location = 0) in vec3 points; -layout (location = 1) in vec3 normals; -layout(location = 0) uniform ConstantData10 *constantPrimvars; -layout(location = 1) uniform int *primitiveParam; -layout(location = 2) uniform ivec2 *edgeIndices; -layout(location = 3) uniform float *faceVisibility; -out VertexData { - vec4 Peye; - vec3 Neye; -} outData; -out PrimvarData { - vec3 points; - vec3 normals; -} outPrimvars; - -// //////// Codegen Accessors //////// -mat4 HdGet_transform(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transform); -} -mat4 HdGet_transform() { return HdGet_transform(0); } -mat4 HdGet_transformInverse(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transformInverse); -} -mat4 HdGet_transformInverse() { return HdGet_transformInverse(0); } -vec4 HdGet_color(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].color); -} -vec4 HdGet_color() { return HdGet_color(0); } -float HdGetScalar_color(int localIndex) { return HdGet_color(localIndex).x; } -float HdGetScalar_color() { return HdGet_color(0).x; } -vec4 HdGet_primID(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].primID); -} -vec4 HdGet_primID() { return HdGet_primID(0); } -float HdGetScalar_primID(int localIndex) { return HdGet_primID(localIndex).x; } -float HdGetScalar_primID() { return HdGet_primID(0).x; } -float HdGet_widths(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return float(constantPrimvars[index].widths); -} -float HdGet_widths() { return HdGet_widths(0); } -float HdGetScalar_widths(int localIndex) { return HdGet_widths(localIndex); } -float HdGetScalar_widths() { return HdGet_widths(0); } - -// //////// Codegen VS Source //////// -#define HD_BINDLESS_BUFFERS_ENABLED -int GetBaseVertexOffset() { - return HgiGetBaseVertex(); -} -hd_instanceIndex GetInstanceIndex() { hd_instanceIndex r; r.indices[0] = 0; return r; } -hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = drawingCoord0.x; - dc.constantCoord = drawingCoord0.y; - dc.elementCoord = drawingCoord0.z; - dc.primitiveCoord = drawingCoord0.w; - dc.fvarCoord = drawingCoord1.x; - dc.shaderCoord = drawingCoord1.z; - dc.vertexCoord = drawingCoord1.w; - dc.topologyVisibilityCoord = drawingCoord2.x; - dc.varyingCoord = drawingCoord2.y; - hd_instanceIndex r = GetInstanceIndex(); - dc.instanceIndex[0] = r.indices[0]; - return dc; -} -vec3 HdGet_points(int localIndex) { return hd_vec3_get(points);} -vec3 HdGet_points() { return HdGet_points(0); } -float HdGetScalar_points(int localIndex) { return HdGet_points(localIndex).x; } -float HdGetScalar_points() { return HdGet_points(0).x; } -vec3 HdGet_normals(int localIndex) { return hd_vec3_get(normals);} -vec3 HdGet_normals() { return HdGet_normals(0); } -float HdGetScalar_normals(int localIndex) { return HdGet_normals(localIndex).x; } -float HdGetScalar_normals() { return HdGet_normals(0).x; } - -// //////// Codegen Proc VS //////// -void ProcessPrimvarsIn() { - hd_drawingCoord dc = GetDrawingCoord(); - vs_interstageDrawingCoord0[0] = dc.modelCoord; - vs_interstageDrawingCoord0[1] = dc.constantCoord; - vs_interstageDrawingCoord0[2] = dc.elementCoord; - vs_interstageDrawingCoord0[3] = dc.primitiveCoord; - vs_interstageDrawingCoord1[0] = dc.fvarCoord; - vs_interstageDrawingCoord1[1] = dc.shaderCoord; - vs_interstageDrawingCoord1[2] = dc.vertexCoord; - vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; - vs_interstageDrawingCoord2[0] = dc.varyingCoord; - vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; - outPrimvars.points = points; - outPrimvars.normals = normals; -} - -// --------------------------------------------------------------------------- -// global defines -// --------------------------------------------------------------------------- -// codeGen can override this range (currently not). -// quadro 4000's max is 189. -#ifndef HD_GL_POINT_SIZE_MAX -#define HD_GL_POINT_SIZE_MAX 100.0 -#endif -#ifndef HD_GL_POINT_SIZE_MIN -#define HD_GL_POINT_SIZE_MIN .45 -#endif - -// --------------------------------------------------------------------------- -// render pass states -// --------------------------------------------------------------------------- - -MAT4 GetWorldToViewMatrix() { -#if defined(HD_HAS_worldToViewMatrix) - return MAT4(HdGet_worldToViewMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetWorldToViewInverseMatrix() { -#if defined(HD_HAS_worldToViewInverseMatrix) - return MAT4(HdGet_worldToViewInverseMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetProjectionMatrix() { -#if defined(HD_HAS_projectionMatrix) - return MAT4(HdGet_projectionMatrix()); -#else - return MAT4(1); -#endif -} -vec3 GetPositionInWorldSpace(vec3 windowRelativeCoord) -{ -#if defined(HD_HAS_imageToWorldMatrix) - vec4 pImage = vec4(windowRelativeCoord, 1.0); - vec4 pWorld = vec4(HdGet_imageToWorldMatrix() * pImage); - return (pWorld / pWorld.w).xyz; -#else - return windowRelativeCoord; -#endif -} -float GetLightingBlendAmount() { -#if defined(HD_HAS_lightingBlendAmount) - return HdGet_lightingBlendAmount(); -#else - return 1; -#endif -} -vec4 GetViewport() { -#if defined(HD_HAS_viewport) - return HdGet_viewport(); -#else - return vec4(0,0,1,1); -#endif -} -float GetTessLevel() { -#if defined(HD_HAS_tessLevel) - return HdGet_tessLevel(); -#else - return 1; -#endif -} -float GetPointSize() { -#if defined(HD_HAS_pointSize) - return HdGet_pointSize(); -#else - return 3.0; -#endif -} -float GetPointSelectedSize() { -#if defined(HD_HAS_pointSelectedSize) - return HdGet_pointSelectedSize(); -#else - return 5.0; -#endif -} -vec4 GetWireframeColor() { -// Individual prims can specify an alternative wireframe color -// to one specified in the render pass. This is used in cases were -// there is not enough contrast with the normal one. -#if defined(HD_HAS_overrideWireframeColor) - return HdGet_overrideWireframeColor(); -#elif defined(HD_HAS_wireframeColor) - return HdGet_wireframeColor(); -#else - return vec4(0,0,0,0); -#endif -} -vec4 GetMaskColor() { -#if defined(HD_HAS_maskColor) - return HdGet_maskColor(); -#else - return vec4(0.5,0,0,1); -#endif -} -vec4 GetIndicatorColor() { -#if defined(HD_HAS_indicatorColor) - return HdGet_indicatorColor(); -#else - return vec4(0,0.5,0,1); -#endif -} - -bool ShouldDiscardByAlpha(vec4 color) -{ -#if defined(HD_HAS_alphaThreshold) - float alphaThreshold = HdGet_alphaThreshold(); -#else - float alphaThreshold = 0; -#endif - return (color.a < alphaThreshold); -} - -vec2 ApplyAxisAlignedAffineTransform(vec4 t, vec2 pt) -{ - return t.xy * pt + t.zw; -} - - - -void ApplyClipPlanes(vec4 Peye) -{ -#if defined(HD_HAS_numClipPlanes) -#if defined(HD_HAS_clipPlanes) - for (int i=0; i> 2); -} -int GetAggregatedElementID() { - return GetElementID() - + GetDrawingCoord().elementCoord; -} -ivec2 HdGet_edgeIndices(int localIndex) { - int index = GetPrimitiveIndex(); - return ivec2(edgeIndices[index]); -} -ivec2 HdGet_edgeIndices() { return HdGet_edgeIndices(0); } -int HdGetScalar_edgeIndices(int localIndex) { return HdGet_edgeIndices(localIndex).x; } -int HdGetScalar_edgeIndices() { return HdGet_edgeIndices(0).x; } -int GetAuthoredEdgeId(int primitiveEdgeId) { - return primitiveEdgeId; -} -float HdGet_faceVisibility(int localIndex) { - int index = GetAggregatedElementID(); - return float(faceVisibility[index]); -} -float HdGet_faceVisibility() { return HdGet_faceVisibility(0); } -float HdGetScalar_faceVisibility(int localIndex) { return HdGet_faceVisibility(localIndex); } -float HdGetScalar_faceVisibility() { return HdGet_faceVisibility(0); } -vec3 HdGet_points(int localIndex) { - int index = localIndex; - return vec3(inPrimvars[index].points); -} -vec3 HdGet_points() { return HdGet_points(0); } -float HdGetScalar_points(int localIndex) { return HdGet_points(localIndex).x; } -float HdGetScalar_points() { return HdGet_points(0).x; } -vec3 HdGet_normals(int localIndex) { - int index = localIndex; - return vec3(inPrimvars[index].normals); -} -vec3 HdGet_normals() { return HdGet_normals(0); } -float HdGetScalar_normals(int localIndex) { return HdGet_normals(localIndex).x; } -float HdGetScalar_normals() { return HdGet_normals(0).x; } -vec2 HdGet_dispTextureCoord_Coarse(int localIndex) { - int fvarIndex = GetFVarIndex(localIndex); - return vec2(dispTextureCoord[fvarIndex]); -} -vec2 HdGet_dispTextureCoord(int localIndex, vec2 st) { - return mix(mix(HdGet_dispTextureCoord_Coarse(0),HdGet_dispTextureCoord_Coarse(1), st.x),mix(HdGet_dispTextureCoord_Coarse(3),HdGet_dispTextureCoord_Coarse(2), st.x), st.y); -} -FORWARD_DECL(vec4 GetPatchCoord(int index)); -FORWARD_DECL(vec2 GetPatchCoordLocalST()); -vec2 HdGet_dispTextureCoord(int localIndex) { - vec2 localST = GetPatchCoord(localIndex).xy; - return HdGet_dispTextureCoord(localIndex, localST); -} -vec2 HdGet_dispTextureCoord() { return HdGet_dispTextureCoord(0); } -FORWARD_DECL(vec4 GetPatchCoord(int localIndex)); -void ProcessSamplingTransforms(MAT4 instanceModelViewInverse) { -} - -// //////// Codegen Proc GS //////// -FORWARD_DECL(vec4 GetPatchCoord(int index)); -void ProcessPrimvarsOut(int index) { - vec2 localST = GetPatchCoord(index).xy; - const vec3 coords[4] = vec3[]( - vec3(1,0,0), vec3(0,1,0), vec3(0,0,1), vec3(0,1,0) - ); - hd_barycentricCoord = coords[index]; - hd_drawingCoord dc = GetDrawingCoord(); - gs_interstageDrawingCoord0[0] = dc.modelCoord; - gs_interstageDrawingCoord0[1] = dc.constantCoord; - gs_interstageDrawingCoord0[2] = dc.elementCoord; - gs_interstageDrawingCoord0[3] = dc.primitiveCoord; - gs_interstageDrawingCoord1[0] = dc.fvarCoord; - gs_interstageDrawingCoord1[1] = dc.shaderCoord; - gs_interstageDrawingCoord1[2] = dc.vertexCoord; - gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; - gs_interstageDrawingCoord2[0] = dc.varyingCoord; - gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; - outPrimvars.points = inPrimvars[index].points; - outPrimvars.normals = inPrimvars[index].normals; - outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); -} - -// --------------------------------------------------------------------------- -// global defines -// --------------------------------------------------------------------------- -// codeGen can override this range (currently not). -// quadro 4000's max is 189. -#ifndef HD_GL_POINT_SIZE_MAX -#define HD_GL_POINT_SIZE_MAX 100.0 -#endif -#ifndef HD_GL_POINT_SIZE_MIN -#define HD_GL_POINT_SIZE_MIN .45 -#endif - -// --------------------------------------------------------------------------- -// render pass states -// --------------------------------------------------------------------------- - -MAT4 GetWorldToViewMatrix() { -#if defined(HD_HAS_worldToViewMatrix) - return MAT4(HdGet_worldToViewMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetWorldToViewInverseMatrix() { -#if defined(HD_HAS_worldToViewInverseMatrix) - return MAT4(HdGet_worldToViewInverseMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetProjectionMatrix() { -#if defined(HD_HAS_projectionMatrix) - return MAT4(HdGet_projectionMatrix()); -#else - return MAT4(1); -#endif -} -vec3 GetPositionInWorldSpace(vec3 windowRelativeCoord) -{ -#if defined(HD_HAS_imageToWorldMatrix) - vec4 pImage = vec4(windowRelativeCoord, 1.0); - vec4 pWorld = vec4(HdGet_imageToWorldMatrix() * pImage); - return (pWorld / pWorld.w).xyz; -#else - return windowRelativeCoord; -#endif -} -float GetLightingBlendAmount() { -#if defined(HD_HAS_lightingBlendAmount) - return HdGet_lightingBlendAmount(); -#else - return 1; -#endif -} -vec4 GetViewport() { -#if defined(HD_HAS_viewport) - return HdGet_viewport(); -#else - return vec4(0,0,1,1); -#endif -} -float GetTessLevel() { -#if defined(HD_HAS_tessLevel) - return HdGet_tessLevel(); -#else - return 1; -#endif -} -float GetPointSize() { -#if defined(HD_HAS_pointSize) - return HdGet_pointSize(); -#else - return 3.0; -#endif -} -float GetPointSelectedSize() { -#if defined(HD_HAS_pointSelectedSize) - return HdGet_pointSelectedSize(); -#else - return 5.0; -#endif -} -vec4 GetWireframeColor() { -// Individual prims can specify an alternative wireframe color -// to one specified in the render pass. This is used in cases were -// there is not enough contrast with the normal one. -#if defined(HD_HAS_overrideWireframeColor) - return HdGet_overrideWireframeColor(); -#elif defined(HD_HAS_wireframeColor) - return HdGet_wireframeColor(); -#else - return vec4(0,0,0,0); -#endif -} -vec4 GetMaskColor() { -#if defined(HD_HAS_maskColor) - return HdGet_maskColor(); -#else - return vec4(0.5,0,0,1); -#endif -} -vec4 GetIndicatorColor() { -#if defined(HD_HAS_indicatorColor) - return HdGet_indicatorColor(); -#else - return vec4(0,0.5,0,1); -#endif -} - -bool ShouldDiscardByAlpha(vec4 color) -{ -#if defined(HD_HAS_alphaThreshold) - float alphaThreshold = HdGet_alphaThreshold(); -#else - float alphaThreshold = 0; -#endif - return (color.a < alphaThreshold); -} - -vec2 ApplyAxisAlignedAffineTransform(vec4 t, vec2 pt) -{ - return t.xy * pt + t.zw; -} - - - -void ApplyClipPlanes(vec4 Peye) -{ -#if defined(HD_HAS_numClipPlanes) -#if defined(HD_HAS_clipPlanes) - for (int i=0; i 0.0) - normal = normalize(normal); - return normal; -} - -vec3 GetNormal(vec3 Neye, int index, vec2 localST) -{ - return GetNormal(Neye, index); -} - - - -vec3 GetTriGeometryNormal(vec3 Neye, vec4 Peye0, vec4 Peye1, vec4 Peye2, - bool isFlipped) -{ - return Neye; -} - -vec3 GetQuadGeometryNormal(vec3 Neye, - vec4 Peye0, vec4 Peye1, vec4 Peye2, vec4 Peye3, - bool isFlipped) -{ - return Neye; -} - - - -vec4 DisplacementTerminal(int index, vec4 Peye, vec3 Neye, vec4 patchCoord) -{ - return Peye; -} - - - -vec4 GetPatchCoord(int index) -{ - vec2 uv[4]; - uv[0] = vec2(0, 0); - uv[1] = vec2(1, 0); - uv[2] = vec2(1, 1); - uv[3] = vec2(0, 1); - - ivec3 patchParam = GetPatchParam(); - return InterpolatePatchCoord(uv[index], patchParam); -} - -void emit(int index, vec4 Peye, vec3 Neye) -{ - outData.Peye = Peye; - outData.Neye = Neye; - - gsPatchCoord = GetPatchCoord(index); - - gl_Position = vec4(GetProjectionMatrix() * outData.Peye); - ApplyClipPlanes(outData.Peye); - - ProcessPrimvarsOut(index); - - EmitVertex(); -} - -void main(void) -{ - gl_PrimitiveID = gl_PrimitiveIDIn; - - bool isFlipped = IsFlipped(); // consider handedness AND negative-scale - - vec3 Neye0 = GetNormal(inData[0].Neye, 0); - Neye0 = GetQuadGeometryNormal(Neye0, inData[0].Peye, inData[1].Peye, - inData[2].Peye, inData[3].Peye, isFlipped); - vec3 Neye1 = GetNormal(inData[1].Neye, 1); - Neye1 = GetQuadGeometryNormal(Neye1, inData[0].Peye, inData[1].Peye, - inData[2].Peye, inData[3].Peye, isFlipped); - vec3 Neye2 = GetNormal(inData[2].Neye, 2); - Neye2 = GetQuadGeometryNormal(Neye2, inData[0].Peye, inData[1].Peye, - inData[2].Peye, inData[3].Peye, isFlipped); - vec3 Neye3 = GetNormal(inData[3].Neye, 3); - Neye3 = GetQuadGeometryNormal(Neye3, inData[0].Peye, inData[1].Peye, - inData[2].Peye, inData[3].Peye, isFlipped); - - vec4 Peye0 = DisplacementTerminal( - 0, inData[0].Peye, Neye0, GetPatchCoord(0)); - vec4 Peye1 = DisplacementTerminal( - 1, inData[1].Peye, Neye1, GetPatchCoord(1)); - vec4 Peye2 = DisplacementTerminal( - 2, inData[2].Peye, Neye2, GetPatchCoord(2)); - vec4 Peye3 = DisplacementTerminal( - 3, inData[3].Peye, Neye3, GetPatchCoord(3)); - - // Generate triangles (0,1,2) and (2,3,0) - // 3---2 - // | .| - // | . | - // |. | - // 0---1 - // The indices post-quadrangulation/subdivision follow the convention: - // 0 -> original (hull) vertex - // 1,3 -> edge vertices - // 2 -> center vertex - // - // By having index 2 in both the triangles, we ensure the pre-quadrangulated - // face's normal (at the center) is part of the rasterizer interpolation, - // which matters when we use smooth/limit normals. - // In the case of flat normals, we use the vertex positions, so it doesn't - // matter. - - // triangle 0: vertices (0,1,2) - emit(0, Peye0, Neye0); - emit(1, Peye1, Neye1); - emit(2, Peye2, Neye2); - EndPrimitive(); - - // triangle 1: vertices (2,3,0) - gl_PrimitiveID = gl_PrimitiveIDIn; - emit(2, Peye2, Neye2); - emit(3, Peye3, Neye3); - emit(0, Peye0, Neye0); - EndPrimitive(); -} - - -======================================================= - FRAGMENT SHADER -======================================================= -#version 450 -#extension GL_NV_shader_buffer_load : require -#extension GL_NV_gpu_shader5 : require -#extension GL_ARB_bindless_texture : require -#define REF(space,type) inout type -#define FORWARD_DECL(func_decl) func_decl; -#define ATOMIC_LOAD(a) (a) -#define ATOMIC_STORE(a, v) (a) = (v) -#define ATOMIC_ADD(a, v) atomicAdd(a, v) -#define ATOMIC_EXCHANGE(a, v) atomicExchange(a, v) -#define ATOMIC_COMP_SWAP(a, expected, desired) atomicCompSwap(a, expected, desired) -#define atomic_int int -#define atomic_uint uint - -#define HGI_HAS_DOUBLE_TYPE 1 - - -struct hgi_ivec3 { int x, y, z; }; -struct hgi_vec3 { float x, y, z; }; -struct hgi_dvec3 { double x, y, z; }; -struct hgi_mat3 { float m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; -struct hgi_dmat3 { double m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; - - - -// //////// Global Includes //////// - -// //////// Global Macros //////// - -// //////// Global Structs //////// - -// //////// Global Member Declarations //////// - -// //////// Global Function Definitions //////// - - -// //////// Codegen Defines //////// -#define HD_SHADER_API 2 -#define MAT4 mat4 -// Alias hgi vec and matrix types to hd. -#define hd_ivec3 hgi_ivec3 -#define hd_vec3 hgi_vec3 -#define hd_dvec3 hgi_dvec3 -#define hd_mat3 hgi_mat3 -#define hd_dmat3 hgi_dmat3 - -ivec3 hd_ivec3_get(hd_ivec3 v) { return ivec3(v.x, v.y, v.z); } -ivec3 hd_ivec3_get(ivec3 v) { return v; } -vec3 hd_vec3_get(hd_vec3 v) { return vec3(v.x, v.y, v.z); } -vec3 hd_vec3_get(vec3 v) { return v; } -dvec3 hd_dvec3_get(hd_dvec3 v) { return dvec3(v.x, v.y, v.z); } -dvec3 hd_dvec3_get(dvec3 v) { return v; } -mat3 hd_mat3_get(hd_mat3 v) { return mat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -mat3 hd_mat3_get(mat3 v) { return v; } -dmat3 hd_dmat3_get(hd_dmat3 v) { return dmat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -dmat3 hd_dmat3_get(dmat3 v) { return v; } -hd_ivec3 hd_ivec3_set(hd_ivec3 v) { return v; } -hd_ivec3 hd_ivec3_set(ivec3 v) { return hd_ivec3(v.x, v.y, v.z); } -hd_vec3 hd_vec3_set(hd_vec3 v) { return v; } -hd_vec3 hd_vec3_set(vec3 v) { return hd_vec3(v.x, v.y, v.z); } -hd_dvec3 hd_dvec3_set(hd_dvec3 v) { return v; } -hd_dvec3 hd_dvec3_set(dvec3 v) { return hd_dvec3(v.x, v.y, v.z); } -hd_mat3 hd_mat3_set(hd_mat3 v) { return v; } -hd_mat3 hd_mat3_set(mat3 v) { return hd_mat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -hd_dmat3 hd_dmat3_set(hd_dmat3 v) { return v; } -hd_dmat3 hd_dmat3_set(dmat3 v) { return hd_dmat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -int hd_int_get(int v) { return v; } -int hd_int_get(ivec2 v) { return v.x; } -int hd_int_get(ivec3 v) { return v.x; } -int hd_int_get(ivec4 v) { return v.x; } -vec3 hd_sample_udim(vec2 v) { -vec2 vf = floor(v); -return vec3(v.x - vf.x, v.y - vf.y, clamp(vf.x, 0.0, 10.0) + 10.0 * vf.y); -} -vec4 hd_vec4_2_10_10_10_get(int v) { - ivec4 unpacked = ivec4((v & 0x3ff) << 22, (v & 0xffc00) << 12, - (v & 0x3ff00000) << 2, (v & 0xc0000000)); - return vec4(unpacked) / 2147483647.0; } -int hd_vec4_2_10_10_10_set(vec4 v) { - return ( (int(v.x * 511.0) & 0x3ff) | - ((int(v.y * 511.0) & 0x3ff) << 10) | - ((int(v.z * 511.0) & 0x3ff) << 20) | - ((int(v.w) & 0x1) << 30)); } -vec2 hd_half2_get(uint v) { - return unpackHalf2x16(v); } -uint hd_half2_set(vec2 v) { - return packHalf2x16(v); } -vec4 hd_half4_get(uvec2 v) { - return vec4(unpackHalf2x16(v.x), unpackHalf2x16(v.y)); } -uvec2 hd_half4_set(vec4 v) { - return uvec2(packHalf2x16(v.xy), packHalf2x16(v.zw)); } -#define HD_NUM_PRIMITIVE_VERTS 4 -#define HD_HAS_transform 1 -#define HD_HAS_transformInverse 1 -#define HD_HAS_color 1 -#define HD_HAS_primID 1 -#define HD_HAS_widths 1 -#define HD_INSTANCER_NUM_LEVELS 0 -#define HD_INSTANCE_INDEX_WIDTH 1 -#define HD_HAS_faceVisibility 1 -#define HD_HAS_dispTextureCoord 1 -#define HD_HAS_points 1 -#define HD_HAS_normals 1 - -// //////// Codegen Decl //////// -struct hd_drawingCoord { - int modelCoord; - int constantCoord; - int elementCoord; - int primitiveCoord; - int fvarCoord; - int shaderCoord; - int vertexCoord; - int topologyVisibilityCoord; - int varyingCoord; - int instanceIndex[HD_INSTANCE_INDEX_WIDTH]; - int instanceCoords[HD_INSTANCE_INDEX_WIDTH]; -}; -FORWARD_DECL(hd_drawingCoord GetDrawingCoord()); -FORWARD_DECL(int HgiGetBaseVertex()); -struct hd_instanceIndex { int indices[HD_INSTANCE_INDEX_WIDTH]; }; -struct ConstantData10 { - mat4 transform; - mat4 transformInverse; - vec4 color; - vec4 primID; - float widths; -}; -FORWARD_DECL(int GetElementID()); -FORWARD_DECL(int GetAggregatedElementID()); -FORWARD_DECL(int GetPrimitiveEdgeId()); -FORWARD_DECL(float GetSelectedEdgeOpacity()); -layout(location = 0) uniform ConstantData10 *constantPrimvars; -layout(location = 1) uniform int *primitiveParam; -layout(location = 2) uniform ivec2 *edgeIndices; -layout(location = 3) uniform float *faceVisibility; -in vec4 gsPatchCoord; -in VertexData { - vec4 Peye; - vec3 Neye; -} inData; -layout (location = 0) out vec4 colorOut; -in noperspective vec3 hd_barycentricCoord; -in flat ivec4 gs_interstageDrawingCoord0; -in flat ivec4 gs_interstageDrawingCoord1; -in flat ivec4 gs_interstageDrawingCoord2; -in PrimvarData { - vec3 points; - vec3 normals; - vec2 dispTextureCoord; -} inPrimvars; -layout(location = 4) uniform vec2 *dispTextureCoord; -vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) -{ - // add 0.5 to integer values for more robust interpolation - return vec4(uv.x, uv.y, 0, patchParam.x+0.5f); -} -vec4 InterpolatePatchCoordTriangle(vec2 uv, ivec3 patchParam) -{ - return InterpolatePatchCoord(uv, patchParam); -} - -// //////// Codegen Accessors //////// -mat4 HdGet_transform(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transform); -} -mat4 HdGet_transform() { return HdGet_transform(0); } -mat4 HdGet_transformInverse(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transformInverse); -} -mat4 HdGet_transformInverse() { return HdGet_transformInverse(0); } -vec4 HdGet_color(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].color); -} -vec4 HdGet_color() { return HdGet_color(0); } -float HdGetScalar_color(int localIndex) { return HdGet_color(localIndex).x; } -float HdGetScalar_color() { return HdGet_color(0).x; } -vec4 HdGet_primID(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].primID); -} -vec4 HdGet_primID() { return HdGet_primID(0); } -float HdGetScalar_primID(int localIndex) { return HdGet_primID(localIndex).x; } -float HdGetScalar_primID() { return HdGet_primID(0).x; } -float HdGet_widths(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return float(constantPrimvars[index].widths); -} -float HdGet_widths() { return HdGet_widths(0); } -float HdGetScalar_widths(int localIndex) { return HdGet_widths(localIndex); } -float HdGetScalar_widths() { return HdGet_widths(0); } - -// //////// Codegen FS Source //////// -#define HD_SHADER_SUPPORTS_DOUBLE_PRECISION -#define HD_MINUS_ONE_TO_ONE_DEPTH_RANGE -vec3 GetBarycentricCoord() { - return hd_barycentricCoord; -} -int GetPrimitiveID() { - return gl_PrimitiveID; -} -int GetPrimitiveIndex() { - return GetDrawingCoord().primitiveCoord + GetPrimitiveID(); -} -hd_drawingCoord GetDrawingCoord() { - hd_drawingCoord dc; - dc.modelCoord = gs_interstageDrawingCoord0[0]; - dc.constantCoord = gs_interstageDrawingCoord0[1]; - dc.elementCoord = gs_interstageDrawingCoord0[2]; - dc.primitiveCoord = gs_interstageDrawingCoord0[3]; - dc.fvarCoord = gs_interstageDrawingCoord1[0]; - dc.shaderCoord = gs_interstageDrawingCoord1[1]; - dc.vertexCoord = gs_interstageDrawingCoord1[2]; - dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; - dc.varyingCoord = gs_interstageDrawingCoord2[0]; - dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; - return dc; -} -int HdGet_primitiveParam(int localIndex) { - int index = GetPrimitiveIndex(); - return int(primitiveParam[index]); -} -int HdGet_primitiveParam() { return HdGet_primitiveParam(0); } -int HdGetScalar_primitiveParam(int localIndex) { return HdGet_primitiveParam(localIndex); } -int HdGetScalar_primitiveParam() { return HdGet_primitiveParam(0); } -#if defined(HD_HAS_coarseFaceIndex) -FORWARD_DECL(int HdGetScalar_coarseFaceIndex()); -#endif -ivec3 GetPatchParam() { -#if defined(HD_HAS_coarseFaceIndex) - return ivec3(HdGetScalar_coarseFaceIndex(), 0, 0); -#else - return ivec3(GetPrimitiveID(), 0, 0); -#endif -} -int GetEdgeFlag() { - return (HdGet_primitiveParam() & 3); -} -int GetFVarIndex(int localIndex) { - int fvarCoord = GetDrawingCoord().fvarCoord; - int ptexIndex = GetPatchParam().x & 0xfffffff; - return fvarCoord + ptexIndex * 4 + localIndex; -} -int GetElementID() { - return (hd_int_get(HdGet_primitiveParam()) >> 2); -} -int GetAggregatedElementID() { - return GetElementID() - + GetDrawingCoord().elementCoord; -} -ivec2 HdGet_edgeIndices(int localIndex) { - int index = GetPrimitiveIndex(); - return ivec2(edgeIndices[index]); -} -ivec2 HdGet_edgeIndices() { return HdGet_edgeIndices(0); } -int HdGetScalar_edgeIndices(int localIndex) { return HdGet_edgeIndices(localIndex).x; } -int HdGetScalar_edgeIndices() { return HdGet_edgeIndices(0).x; } -int GetAuthoredEdgeId(int primitiveEdgeId) { - return primitiveEdgeId; -} -float HdGet_faceVisibility(int localIndex) { - int index = GetAggregatedElementID(); - return float(faceVisibility[index]); -} -float HdGet_faceVisibility() { return HdGet_faceVisibility(0); } -float HdGetScalar_faceVisibility(int localIndex) { return HdGet_faceVisibility(localIndex); } -float HdGetScalar_faceVisibility() { return HdGet_faceVisibility(0); } -vec3 HdGet_points(int localIndex) { return vec3(inPrimvars.points);} -vec3 HdGet_points() { return HdGet_points(0); } -float HdGetScalar_points(int localIndex) { return HdGet_points(localIndex).x; } -float HdGetScalar_points() { return HdGet_points(0).x; } -vec3 HdGet_normals(int localIndex) { return vec3(inPrimvars.normals);} -vec3 HdGet_normals() { return HdGet_normals(0); } -float HdGetScalar_normals(int localIndex) { return HdGet_normals(localIndex).x; } -float HdGetScalar_normals() { return HdGet_normals(0).x; } -vec2 HdGet_dispTextureCoord(int localIndex) { return vec2(inPrimvars.dispTextureCoord);} -vec2 HdGet_dispTextureCoord() { return HdGet_dispTextureCoord(0); } -float HdGetScalar_dispTextureCoord(int localIndex) { return HdGet_dispTextureCoord(localIndex).x; } -float HdGetScalar_dispTextureCoord() { return HdGet_dispTextureCoord(0).x; } -FORWARD_DECL(vec4 GetPatchCoord(int index)); -void ProcessSamplingTransforms(MAT4 instanceModelViewInverse) { -} - -// --------------------------------------------------------------------------- -// global defines -// --------------------------------------------------------------------------- -// codeGen can override this range (currently not). -// quadro 4000's max is 189. -#ifndef HD_GL_POINT_SIZE_MAX -#define HD_GL_POINT_SIZE_MAX 100.0 -#endif -#ifndef HD_GL_POINT_SIZE_MIN -#define HD_GL_POINT_SIZE_MIN .45 -#endif - -// --------------------------------------------------------------------------- -// render pass states -// --------------------------------------------------------------------------- - -MAT4 GetWorldToViewMatrix() { -#if defined(HD_HAS_worldToViewMatrix) - return MAT4(HdGet_worldToViewMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetWorldToViewInverseMatrix() { -#if defined(HD_HAS_worldToViewInverseMatrix) - return MAT4(HdGet_worldToViewInverseMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetProjectionMatrix() { -#if defined(HD_HAS_projectionMatrix) - return MAT4(HdGet_projectionMatrix()); -#else - return MAT4(1); -#endif -} -vec3 GetPositionInWorldSpace(vec3 windowRelativeCoord) -{ -#if defined(HD_HAS_imageToWorldMatrix) - vec4 pImage = vec4(windowRelativeCoord, 1.0); - vec4 pWorld = vec4(HdGet_imageToWorldMatrix() * pImage); - return (pWorld / pWorld.w).xyz; -#else - return windowRelativeCoord; -#endif -} -float GetLightingBlendAmount() { -#if defined(HD_HAS_lightingBlendAmount) - return HdGet_lightingBlendAmount(); -#else - return 1; -#endif -} -vec4 GetViewport() { -#if defined(HD_HAS_viewport) - return HdGet_viewport(); -#else - return vec4(0,0,1,1); -#endif -} -float GetTessLevel() { -#if defined(HD_HAS_tessLevel) - return HdGet_tessLevel(); -#else - return 1; -#endif -} -float GetPointSize() { -#if defined(HD_HAS_pointSize) - return HdGet_pointSize(); -#else - return 3.0; -#endif -} -float GetPointSelectedSize() { -#if defined(HD_HAS_pointSelectedSize) - return HdGet_pointSelectedSize(); -#else - return 5.0; -#endif -} -vec4 GetWireframeColor() { -// Individual prims can specify an alternative wireframe color -// to one specified in the render pass. This is used in cases were -// there is not enough contrast with the normal one. -#if defined(HD_HAS_overrideWireframeColor) - return HdGet_overrideWireframeColor(); -#elif defined(HD_HAS_wireframeColor) - return HdGet_wireframeColor(); -#else - return vec4(0,0,0,0); -#endif -} -vec4 GetMaskColor() { -#if defined(HD_HAS_maskColor) - return HdGet_maskColor(); -#else - return vec4(0.5,0,0,1); -#endif -} -vec4 GetIndicatorColor() { -#if defined(HD_HAS_indicatorColor) - return HdGet_indicatorColor(); -#else - return vec4(0,0.5,0,1); -#endif -} - -bool ShouldDiscardByAlpha(vec4 color) -{ -#if defined(HD_HAS_alphaThreshold) - float alphaThreshold = HdGet_alphaThreshold(); -#else - float alphaThreshold = 0; -#endif - return (color.a < alphaThreshold); -} - -vec2 ApplyAxisAlignedAffineTransform(vec4 t, vec2 pt) -{ - return t.xy * pt + t.zw; -} - - - -vec2 HorizontallyNormalizedFilmbackCoordinates() -{ - const vec4 transform = -#ifdef HD_HAS_imageToHorizontallyNormalizedFilmback - HdGet_imageToHorizontallyNormalizedFilmback(); -#else - vec4(vec2(1.0), vec2(0.0)); -#endif - return ApplyAxisAlignedAffineTransform(transform, gl_FragCoord.xy); -} - - - -vec4 ApplySelectionColor(vec4 color) -{ - return color; -} - - - -// Forward declare selection functionality. -// XXX: Currently, the non-empty implementation of this is in hdx. -FORWARD_DECL(vec4 ApplySelectionColor(vec4 color)); - -// XXX: Make sure to update hdx/shaders/renderPass.glslfx when editing these -// color override methods, since they're currently duplicated. This is because -// we don't have a mixin token for color overrides in a render pass yet. -vec4 ApplyColorOverrides(vec4 color) -{ -#if defined(HD_HAS_overrideColor) - // Mix in override color - vec4 overrideColor = HdGet_overrideColor(); - color.rgb = mix(color.rgb, overrideColor.rgb, overrideColor.a); -#endif - return ApplySelectionColor(color); -} - -vec3 ApplyMaskColor(vec3 color, float weight, vec4 maskColor) -{ - float strength = maskColor.a * clamp(weight, 0.0, 1.0); - return mix(color, maskColor.rgb, strength); -} - -vec4 ApplyColorOverridesPostLighting(vec4 color) -{ - #if defined(HD_HAS_maskWeight) - float maskWeight = HdGet_maskWeight(); - vec4 maskColor = GetMaskColor(); - color.rgb = ApplyMaskColor(color.rgb, maskWeight, maskColor); - #endif - #if defined(HD_HAS_indicatorWeight) - float indicatorWeight = HdGet_indicatorWeight(); - vec4 indicatorColor = GetIndicatorColor(); - color.rgb = ApplyMaskColor(color.rgb, indicatorWeight, indicatorColor); - #endif - return color; -} - - - -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) -{ - colorOut = color; -} - - -#ifndef HD_HAS_integrateLights -#define HD_HAS_integrateLights -#endif - -struct LightingContribution { - vec3 diffuse; -}; - -struct LightingInterfaceProperties { - float unused; -}; - -LightingContribution -integrateLightsDefault(vec4 Peye, vec3 Neye, LightingInterfaceProperties props) -{ - vec3 n = normalize(Neye); - - LightingContribution result; - result.diffuse = vec3(dot(n, vec3(0,0,1))); - - return result; -} - -LightingContribution -integrateLightsConstant(vec4 Peye, vec3 Neye, LightingInterfaceProperties props) -{ - LightingContribution result; - //pefectly diffuse white hemisphere contribution - result.diffuse = vec3(1); - - return result; -} - - - -FORWARD_DECL( - LightingContribution integrateLights(vec4 Peye, vec3 Neye, - LightingInterfaceProperties props)); - -vec3 FallbackLighting(in vec3 Peye, in vec3 Neye, in vec3 color) -{ - LightingInterfaceProperties props; - LightingContribution light = integrateLights(vec4(Peye, 1), Neye, props); - return color * light.diffuse; -} - - -vec4 surfaceShader(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) -{ - // lighting - color.rgb = FallbackLighting(Peye.xyz, Neye, color.rgb); - return color; -} - - -// quaternion to matrix. xyz = imaginary, w = real -MAT4 GetRotationMatrix(vec4 q) -{ - MAT4 r; - r[0].xyzw = vec4(1 - 2 * (q.y * q.y + q.z * q.z), - 2 * (q.x * q.y + q.z * q.w), - 2 * (q.x * q.z - q.y * q.w), - 0); - r[1].xyzw = vec4( 2 * (q.x * q.y - q.z * q.w), - 1 - 2 * (q.x * q.x + q.z * q.z), - 2 * (q.y * q.z + q.x * q.w), - 0); - r[2].xyzw = vec4( 2 * (q.x * q.z + q.y * q.w), - 2 * (q.y * q.z - q.x * q.w), - 1 - 2 * (q.x * q.x + q.y * q.y), - 0); - r[3] = vec4(0, 0, 0, 1); - return r; -} - -// --------------------------------------------------------------------------- - -MAT4 GetInstanceTransform(int level) -{ - MAT4 m = MAT4(1); -#ifdef HD_HAS_INSTANCE_hydra_instanceTransforms - m = HdGetInstance_hydra_instanceTransforms(level, MAT4(1)) * m; -#elif defined(HD_HAS_INSTANCE_instanceTransform) - m = HdGetInstance_instanceTransform(level, MAT4(1)) * m; -#endif - - // instance transform elements are applied: - // scale then rotate then translate - // i.e. (T * R * S) * position - -#ifdef HD_HAS_INSTANCE_hydra_instanceScales - vec3 s = HdGetInstance_hydra_instanceScales(level, /*default=*/vec3(1)); - m = MAT4(s.x, 0, 0, 0, - 0, s.y, 0, 0, - 0, 0, s.z, 0, - 0, 0, 0, 1) * m; -#elif defined(HD_HAS_INSTANCE_instanceScale) - vec3 s = HdGetInstance_scale(level, /*default=*/vec3(1)); - m = MAT4(s.x, 0, 0, 0, - 0, s.y, 0, 0, - 0, 0, s.z, 0, - 0, 0, 0, 1) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceRotations // GfQuat(ix, iy, iz, real) - vec4 q = HdGetInstance_hydra_instanceRotations(level, /*default=*/vec4(0)); - m = GetRotationMatrix(q) * m; -#elif defined(HD_HAS_INSTANCE_rotate) - vec4 q = HdGetInstance_rotate(level, /*default=*/vec4(0)); - m = GetRotationMatrix(q) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceTranslations - vec3 t = HdGetInstance_hydra_instanceTranslations(level, /*default=*/vec3(0)); - m = MAT4( 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - t.x, t.y, t.z, 1) * m; -#elif defined(HD_HAS_INSTANCE_translate) - vec3 t = HdGetInstance_translate(level, /*default=*/vec3(0)); - m = MAT4( 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - t.x, t.y, t.z, 1) * m; -#endif - return m; -} - -MAT4 GetInstanceTransformInverse(int level) -{ - MAT4 m = MAT4(1); - -#ifdef HD_HAS_INSTANCE_hydra_instanceTransforms - m = inverse(HdGetInstance_hydra_instanceTransforms(level, MAT4(1))) * m; -#elif defined(HD_HAS_INSTANCE_instanceTransform) - m = inverse(HdGetInstance_instanceTransform(level, MAT4(1))) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceTranslations - vec3 it = -HdGetInstance_hydra_instanceTranslations(level, /*default=*/vec3(0)); // negate - m = MAT4( 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - it.x, it.y, it.z, 1) * m; -#elif defined(HD_HAS_INSTANCE_translate) - vec3 it = -HdGetInstance_translate(level, /*default=*/vec3(0)); // negate - m = MAT4( 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - it.x, it.y, it.z, 1) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceRotations - vec4 q = HdGetInstance_hydra_instanceRotations(level, /*default=*/vec4(0)); - q.xyz = -q.xyz; // inverse rotataion axis - m = GetRotationMatrix(q) * m; -#elif defined(HD_HAS_INSTANCE_rotate) - vec4 q = HdGetInstance_rotate(level, /*default=*/vec4(0)); - q.xyz = -q.xyz; // inverse rotataion axis - m = GetRotationMatrix(q) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceScales - vec3 is = 1.0/HdGetInstance_hydra_instanceScales(level, /*default=*/vec3(1)); // inverse scale - m = MAT4(is.x, 0, 0, 0, - 0, is.y, 0, 0, - 0, 0, is.z, 0, - 0, 0, 0, 1) * m; -#elif defined(HD_HAS_INSTANCE_scale) - vec3 is = 1.0/HdGetInstance_scale(level, /*default=*/vec3(1)); // inverse scale - m = MAT4(is.x, 0, 0, 0, - 0, is.y, 0, 0, - 0, 0, is.z, 0, - 0, 0, 0, 1) * m; -#endif - return m; -} - -// --------------------------------------------------------------------------- - -MAT4 GetInstanceTransform() -{ - MAT4 m = MAT4(1); -#ifdef HD_INSTANCER_NUM_LEVELS - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - m = GetInstanceTransform(i) * m; -#ifdef HD_HAS_instancerTransform - m = HdGet_instancerTransform(i) * m; -#endif - } -#endif - return m; -} - -MAT4 GetInstanceTransformInverse() -{ - MAT4 m = MAT4(1); -#ifdef HD_INSTANCER_NUM_LEVELS - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - m = m * GetInstanceTransformInverse(i); -#ifdef HD_HAS_instancerTransformInverse - m = m * HdGet_instancerTransformInverse(i); -#endif - } -#endif - return m; -} - -// --------------------------------------------------------------------------- - -MAT4 ApplyInstanceTransform(MAT4 m) -{ - return GetInstanceTransform() * m; -} - -MAT4 ApplyInstanceTransformInverse(MAT4 m) -{ - return m * GetInstanceTransformInverse(); -} - -bool IsFlipped() -{ -#if defined(HD_HAS_isFlipped) - bool flip = (HdGet_isFlipped() != 0); -#elif defined(HD_HAS_transform) - // The sign of the determinant indicates whether m flips handedness - bool flip = (determinant(HdGet_transform()) < 0.0); -#else - bool flip = false; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceScales - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - vec3 scale = HdGetInstance_hydra_instanceScales(i, /*default=*/vec3(1)); - flip = flip != ((sign(scale.x) * sign(scale.y) * sign(scale.z)) < 0); - } -#elif defined(HD_HAS_INSTANCE_scale) - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - vec3 scale = HdGetInstance_scale(i, /*default=*/vec3(1)); - flip = flip != ((sign(scale.x) * sign(scale.y) * sign(scale.z)) < 0); - } -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceTransforms - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - MAT4 m = HdGetInstance_hydra_instanceTransforms(i, MAT4(1)); - flip = flip != (determinant(m) < 0.0); - } -#elif defined(HD_HAS_INSTANCE_instanceTransform) - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - MAT4 m = HdGetInstance_instanceTransform(i, MAT4(1)); - flip = flip != (determinant(m) < 0.0); - } -#endif - - return flip; -} - - -vec3 GetNormal(vec3 Neye, int index) -{ - return Neye; -} - -vec3 GetNormal(vec3 Neye, int index, vec2 localST) -{ - return GetNormal(Neye, index); -} - - - -vec3 GetShadingNormal(vec3 N, bool isFlipped) -{ - // the fragment shader takes already-flipped-normals. - // no need to flip here. - return N; -} - - - -void DiscardBasedOnShading(bool frontFacing, bool isFlipped) -{ - // Nothing to do since h/w face culling is used. -} - - - -vec4 ApplyEdgeColor(vec4 Cfill, vec4 patchCoord) -{ - return Cfill; -} - -// Return a large value, signifying that the fragment isn't near an edge. -float GetMinEdgeDistance() -{ - return 1000.0; -} - - - -vec3 GetEdgeParamTriangle() -{ - // Expand barycentric coordinates - vec2 param = GetPatchCoord(0).xy; - vec3 barycentric = vec3(param.x, param.y, 1 - param.x - param.y); - - // Match triangle edge order - return barycentric.yzx; -} - -vec3 GetEdgeDistanceTriangle() -{ - vec3 param = GetEdgeParamTriangle(); - return max(vec3(0.0), param / fwidth(param)); -} - -vec4 GetEdgeParamQuad() -{ - // Expand coordinates to opposite corners of quad - vec2 leftBottom = GetPatchCoord(0).xy; - vec2 rightTop = vec2(1.0) - leftBottom; - - // Match quad edge order - return vec4(leftBottom.y, rightTop.x, rightTop.y, leftBottom.x); -} - -vec4 GetEdgeDistanceQuad() -{ - vec4 param = GetEdgeParamQuad(); - return max(vec4(0.0), param / fwidth(param)); -} - - - -struct ReprStyle -{ - vec4 color; - bool usePrimvarColor; - bool usePrimvarAlpha; - bool applyColorOverride; - bool useSurfaceShaderColor; - bool useSurfaceShaderAlpha; -}; - -struct ScalarOverride -{ - bool enabled; - vec3 color; -}; - -FORWARD_DECL(ReprStyle GetReprStyle()); -FORWARD_DECL(ScalarOverride GetScalarOverride()); -FORWARD_DECL( - vec4 surfaceShader(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord)); -FORWARD_DECL(vec4 postSurfaceShader(vec4 Peye, vec3 Neye, vec4 color)); - -vec4 ShadingTerminal(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) -{ - ReprStyle reprStyle = GetReprStyle(); - - // Apply scalar override. - ScalarOverride scalarOverride = GetScalarOverride(); - if (scalarOverride.enabled) { - vec4 result; - - result.rgb = scalarOverride.color; - result.a = reprStyle.usePrimvarAlpha ? color.a: reprStyle.color.a; - - vec4 colorOverride = ApplyColorOverrides(result); - result = reprStyle.applyColorOverride ? colorOverride : result; - - return result; - } - - // Draw mode can override face color - vec4 reprColor; - - reprColor.rgb = reprStyle.usePrimvarColor ? color.rgb : reprStyle.color.rgb; - reprColor.a = reprStyle.usePrimvarAlpha ? color.a : reprStyle.color.a; - - // Compute color overrides - vec4 colorOverride = ApplyColorOverrides(reprColor); - reprColor = reprStyle.applyColorOverride ? colorOverride : reprColor; - - - // Surface shading can be expensive and also can contain undesirable - // side effects (like discards). So only run it for reprs that require it. - - if (reprStyle.useSurfaceShaderColor || - reprStyle.useSurfaceShaderAlpha) { - vec4 shadingColor; - - shadingColor = surfaceShader(Peye, - Neye, - reprColor, - patchCoord); - -#ifdef HD_HAS_postSurfaceShader - shadingColor = postSurfaceShader(Peye, - Neye, - shadingColor); -#endif - - reprColor.rgb = reprStyle.useSurfaceShaderColor ? - shadingColor.rgb : - reprColor.rgb; - - reprColor.a = reprStyle.useSurfaceShaderAlpha ? - shadingColor.a : - reprColor.a; - } - - vec4 baseColor = color; - baseColor = ApplyColorOverrides(baseColor); - - vec4 litColor = mix(baseColor, - reprColor, - GetLightingBlendAmount()); - - // Final overrides. - - return ApplyColorOverridesPostLighting(litColor); -} - - - -#ifdef HD_HAS_integrateLights -#ifndef HD_HAS_definedIntegrateLights -#define HD_HAS_definedIntegrateLights - -LightingContribution -integrateLights(vec4 Peye, vec3 Neye, LightingInterfaceProperties props) -{ - return integrateLightsDefault(Peye, Neye, props); -} - -#endif // HD_HAS_definedIntegrateLights -#endif - -ReprStyle GetReprStyle() -{ - ReprStyle reprStyle; - - reprStyle.color = vec4(0.0, 0.0, 0.0, 1.0); - reprStyle.usePrimvarColor = true; - reprStyle.usePrimvarAlpha = true; - reprStyle.applyColorOverride = true; - reprStyle.useSurfaceShaderColor = true; - reprStyle.useSurfaceShaderAlpha = true; - - return reprStyle; -} - - - -ScalarOverride GetScalarOverride() -{ - ScalarOverride result; - -#if defined(HD_HAS_scalarOverride) - result.enabled = true; - - // Allow a scalar value to override the color from the surface - // for previewing heatmaps. This is useful for editing workflows. -#if defined(HD_HAS_scalarOverrideColorRamp) - int rampCount = constantPrimvars[GetDrawingCoord().constantCoord]. - scalarOverrideColorRamp.length(); - float scalar = HdGet_scalarOverride() * float(rampCount - 1); - float baseIndex = floor(scalar); - float nextIndex = min(float(rampCount - 1), baseIndex + 1.0); - float interp = scalar - baseIndex; - result.color = mix(HdGet_scalarOverrideColorRamp(int(baseIndex)).rgb, - HdGet_scalarOverrideColorRamp(int(nextIndex)).rgb, - interp); -#else - // If no ramp is given just gamma correct the scalar as greyscale. - result.color = vec3(pow(HdGet_scalarOverride(), 2.2)); -#endif // HD_HAS_scalarOverrideColorRamp - -#else // HD_HAS_scalarOverride - result.enabled = false; - result.color = vec3(0.0, 0.0, 0.0); -#endif - - return result; -} - - - -// Determines whether a fragment is on or close to an unhidden triangle edge. -const float edgePickRadius = 2; // in viewport pixels -const float edgePickParametricRadius = 0.02; // in parametric space - -// For smooth looking edges, use an exponential falloff for the opacity. -// Note: We use a slower falloff fn than in meshWire.glslfx to make the -// selected edges stand out. -float SelectedEdgeFalloff(float d) { - return exp2(-1 * d * d); -} - - - -vec4 ComputeBaseFaceEdgeDistanceQuad() -{ - return GetEdgeDistanceQuad(); -} - -bool SelectWireframeFaceEdges() -{ - return false; -} - - - -float GetSelectedEdgeOpacity() -{ - float closestEdgeDistance = 0.0; - - // The sequence of comparisons should match GetPrimitiveEdgeId() - vec4 dist = ComputeBaseFaceEdgeDistanceQuad(); - if (dist.x < edgePickRadius) { - closestEdgeDistance = dist.x; - } else if (dist.y < edgePickRadius) { - closestEdgeDistance = dist.y; - } else if (dist.z < edgePickRadius) { - closestEdgeDistance = dist.z; - } else if (dist.w < edgePickRadius) { - closestEdgeDistance = dist.w; - } else { - return 0; - } - - return SelectedEdgeFalloff(closestEdgeDistance); -} - -// called from hdx/renderPass.glslfx and selection.glslfx -int GetPrimitiveEdgeId() -{ - // e2 - // (0,1) 3 ------ 2 (1,1) - // | | - // e3 | | e1 - // | | - // (0,0) 0 ------ 1 (1,0) - // e0 - - int edgeId = -1; - - vec4 dist = ComputeBaseFaceEdgeDistanceQuad(); - if (dist.x < edgePickRadius) { - edgeId = 0; - } else if (dist.y < edgePickRadius) { - edgeId = 1; - } else if (dist.z < edgePickRadius) { - edgeId = 2; - } else if (dist.w < edgePickRadius) { - edgeId = 3; - } else { - return -1; // Not on a mesh edge - } - - const int edgeFlag = GetEdgeFlag(); - const ivec2 meshEdgeIndices = HdGet_edgeIndices(); - - // Translate face-edge to authored mesh-edge - if (edgeFlag == 0) { - edgeId = meshEdgeIndices[0] + edgeId; // regular quad face - } else if (edgeId == 0) { - edgeId = meshEdgeIndices[0]; - } else if (edgeId == 3) { - edgeId = meshEdgeIndices[1]; - } else { - edgeId = -1; // Not an authored mesh edge - } - return edgeId; -} - - -int GetPointId() -{ - return -1; -} - - -void DiscardBasedOnTopologicalVisibility() -{ - // Nothing to do, since there's no authored opinion. -} - - - -vec4 GetInterpolatedPatchCoord() -{ - return gsPatchCoord; -} - - - -#ifndef HD_HAS_ptexFaceOffset -#define HD_HAS_ptexFaceOffset -int HdGet_ptexFaceOffset() -{ - return 0; -} -#endif - -vec4 GetPatchCoord(int localIndex) -{ - vec4 patchCoord = GetInterpolatedPatchCoord(); - return vec4(patchCoord.xyz, patchCoord.w + HdGet_ptexFaceOffset()); -} - -vec4 GetPatchCoord() -{ - return GetPatchCoord(0); -} - -vec3 ComputeScreenSpacePeye() -{ - return inData.Peye.xyz / inData.Peye.w; -} - -vec3 ComputeScreenSpaceNeye() -{ - vec3 Peye = ComputeScreenSpacePeye(); - vec3 Neye = normalize(cross(dFdx(Peye), dFdy(Peye))); - return (gl_FrontFacing ? Neye : -Neye); -} - -void main(void) -{ - bool isFlipped = IsFlipped(); - - DiscardBasedOnShading(gl_FrontFacing, isFlipped); - - DiscardBasedOnTopologicalVisibility(); - - vec4 color = vec4(0.5, 0.5, 0.5, 1); -#ifdef HD_HAS_displayColor - color.rgb = HdGet_displayColor().rgb; -#endif -#ifdef HD_HAS_displayOpacity - color.a = HdGet_displayOpacity(); -#endif - - vec3 Peye = ComputeScreenSpacePeye(); - - vec3 Neye = inData.Neye; - // Normalize Neye after rasterizer interpolation. - if (length(Neye) > 0.0) { - Neye = normalize(Neye); - } - // Give the shader key a chance to override the normal. - Neye = GetNormal(Neye, 0); - // Orient the normal for shading. - Neye = GetShadingNormal(Neye, isFlipped); - - vec4 patchCoord = GetPatchCoord(); - color = ShadingTerminal(vec4(Peye, 1), Neye, color, patchCoord); - - color = ApplyEdgeColor(color, patchCoord); - -#ifdef HD_MATERIAL_TAG_MASKED - if (ShouldDiscardByAlpha(color)) { - discard; - return; - } -#endif - - RenderOutput(vec4(Peye, 1), Neye, color, patchCoord); -} - -OK diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_instance.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_instance.out deleted file mode 100644 index 9960bc8fe8..0000000000 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_instance.out +++ /dev/null @@ -1,5531 +0,0 @@ -------------------------------------------------------- --- glslfx version 0.1 -#import $TOOLS/hdSt/shaders/mesh.glslfx --- configuration -{"techniques": {"default": { -"vertexShader" : { "source" : ["Instancing.Transform", "MeshNormal.Pass", "PointId.Vertex.None", "Mesh.Vertex"] } -, "geometryShader" : { "source" : ["Instancing.Transform", "MeshNormal.Flat", "MeshNormal.Geometry.NoFlat", "Geometry.NoCustomDisplacement", "Mesh.Geometry.Triangle"] } -, "fragmentShader" : { "source" : ["Instancing.Transform", "MeshNormal.Pass", "MeshNormal.Fragment.SingleSided", "MeshFaceCull.Fragment.None", "MeshWire.Fragment.NoEdge", "MeshWire.Fragment.EdgeParam", "Fragment.CommonTerminals", "Fragment.Surface", "Fragment.ScalarOverride", "EdgeId.Fragment.Common", "EdgeId.Fragment.TriangleSurface", "EdgeId.Fragment.TriangleParam", "PointId.Fragment.Fallback", "Visibility.Fragment.Fallback", "Mesh.Fragment.PatchCoord", "Mesh.Fragment"] } -}}} -------------------------------------------------------- -======================================================= - VERTEX SHADER -======================================================= -#version 450 -#extension GL_NV_shader_buffer_load : require -#extension GL_NV_gpu_shader5 : require -#extension GL_ARB_bindless_texture : require -#extension GL_ARB_shader_draw_parameters : require -int HgiGetBaseVertex() { - return gl_BaseVertexARB; -} -#define REF(space,type) inout type -#define FORWARD_DECL(func_decl) func_decl; -#define ATOMIC_LOAD(a) (a) -#define ATOMIC_STORE(a, v) (a) = (v) -#define ATOMIC_ADD(a, v) atomicAdd(a, v) -#define ATOMIC_EXCHANGE(a, v) atomicExchange(a, v) -#define ATOMIC_COMP_SWAP(a, expected, desired) atomicCompSwap(a, expected, desired) -#define atomic_int int -#define atomic_uint uint - -#define HGI_HAS_DOUBLE_TYPE 1 - - -struct hgi_ivec3 { int x, y, z; }; -struct hgi_vec3 { float x, y, z; }; -struct hgi_dvec3 { double x, y, z; }; -struct hgi_mat3 { float m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; -struct hgi_dmat3 { double m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; - - -// //////// Codegen Defines //////// -#define HD_SHADER_API 2 -#define MAT4 mat4 -// Alias hgi vec and matrix types to hd. -#define hd_ivec3 hgi_ivec3 -#define hd_vec3 hgi_vec3 -#define hd_dvec3 hgi_dvec3 -#define hd_mat3 hgi_mat3 -#define hd_dmat3 hgi_dmat3 - -ivec3 hd_ivec3_get(hd_ivec3 v) { return ivec3(v.x, v.y, v.z); } -ivec3 hd_ivec3_get(ivec3 v) { return v; } -vec3 hd_vec3_get(hd_vec3 v) { return vec3(v.x, v.y, v.z); } -vec3 hd_vec3_get(vec3 v) { return v; } -dvec3 hd_dvec3_get(hd_dvec3 v) { return dvec3(v.x, v.y, v.z); } -dvec3 hd_dvec3_get(dvec3 v) { return v; } -mat3 hd_mat3_get(hd_mat3 v) { return mat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -mat3 hd_mat3_get(mat3 v) { return v; } -dmat3 hd_dmat3_get(hd_dmat3 v) { return dmat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -dmat3 hd_dmat3_get(dmat3 v) { return v; } -hd_ivec3 hd_ivec3_set(hd_ivec3 v) { return v; } -hd_ivec3 hd_ivec3_set(ivec3 v) { return hd_ivec3(v.x, v.y, v.z); } -hd_vec3 hd_vec3_set(hd_vec3 v) { return v; } -hd_vec3 hd_vec3_set(vec3 v) { return hd_vec3(v.x, v.y, v.z); } -hd_dvec3 hd_dvec3_set(hd_dvec3 v) { return v; } -hd_dvec3 hd_dvec3_set(dvec3 v) { return hd_dvec3(v.x, v.y, v.z); } -hd_mat3 hd_mat3_set(hd_mat3 v) { return v; } -hd_mat3 hd_mat3_set(mat3 v) { return hd_mat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -hd_dmat3 hd_dmat3_set(hd_dmat3 v) { return v; } -hd_dmat3 hd_dmat3_set(dmat3 v) { return hd_dmat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -int hd_int_get(int v) { return v; } -int hd_int_get(ivec2 v) { return v.x; } -int hd_int_get(ivec3 v) { return v.x; } -int hd_int_get(ivec4 v) { return v.x; } -vec3 hd_sample_udim(vec2 v) { -vec2 vf = floor(v); -return vec3(v.x - vf.x, v.y - vf.y, clamp(vf.x, 0.0, 10.0) + 10.0 * vf.y); -} -vec4 hd_vec4_2_10_10_10_get(int v) { - ivec4 unpacked = ivec4((v & 0x3ff) << 22, (v & 0xffc00) << 12, - (v & 0x3ff00000) << 2, (v & 0xc0000000)); - return vec4(unpacked) / 2147483647.0; } -int hd_vec4_2_10_10_10_set(vec4 v) { - return ( (int(v.x * 511.0) & 0x3ff) | - ((int(v.y * 511.0) & 0x3ff) << 10) | - ((int(v.z * 511.0) & 0x3ff) << 20) | - ((int(v.w) & 0x1) << 30)); } -vec2 hd_half2_get(uint v) { - return unpackHalf2x16(v); } -uint hd_half2_set(vec2 v) { - return packHalf2x16(v); } -vec4 hd_half4_get(uvec2 v) { - return vec4(unpackHalf2x16(v.x), unpackHalf2x16(v.y)); } -uvec2 hd_half4_set(vec4 v) { - return uvec2(packHalf2x16(v.xy), packHalf2x16(v.zw)); } -#define HD_NUM_PRIMITIVE_VERTS 3 -#define HD_HAS_transform 1 -#define HD_HAS_transformInverse 1 -#define HD_HAS_color 1 -#define HD_HAS_primID 1 -#define HD_HAS_widths 1 -#define HD_HAS_INSTANCE_hydra_instanceTranslations 1 -#define HD_HAS_hydra_instanceTranslations_0 1 -#define HD_INSTANCER_NUM_LEVELS 1 -#define HD_INSTANCE_INDEX_WIDTH 2 -#define HD_HAS_faceVisibility 1 -#define HD_HAS_dispTextureCoord 1 -#define HD_HAS_points 1 -#define HD_HAS_normals 1 - - -// //////// Global Includes //////// - -// //////// Global Macros //////// - -// //////// Global Structs //////// - -// //////// Global Member Declarations //////// -uint hd_VertexID = gl_VertexID; -uint hd_InstanceID = gl_InstanceID; -uint hd_BaseInstance = 0; - -// //////// Global Function Definitions //////// - - -// //////// Codegen Decl //////// -struct hd_drawingCoord { - int modelCoord; - int constantCoord; - int elementCoord; - int primitiveCoord; - int fvarCoord; - int shaderCoord; - int vertexCoord; - int topologyVisibilityCoord; - int varyingCoord; - int instanceIndex[HD_INSTANCE_INDEX_WIDTH]; - int instanceCoords[HD_INSTANCE_INDEX_WIDTH]; -}; -FORWARD_DECL(hd_drawingCoord GetDrawingCoord()); -FORWARD_DECL(int HgiGetBaseVertex()); -struct hd_instanceIndex { int indices[HD_INSTANCE_INDEX_WIDTH]; }; -struct ConstantData10 { - mat4 transform; - mat4 transformInverse; - vec4 color; - vec4 primID; - float widths; -}; -FORWARD_DECL(int GetElementID()); -FORWARD_DECL(int GetAggregatedElementID()); -FORWARD_DECL(int GetPrimitiveEdgeId()); -FORWARD_DECL(float GetSelectedEdgeOpacity()); -out flat ivec4 vs_interstageDrawingCoord0; -out flat ivec4 vs_interstageDrawingCoord1; -out flat ivec4 vs_interstageDrawingCoord2; -out flat ivec4 vs_interstageDrawingCoord3; -layout (location = 2) in ivec4 drawingCoord0; -layout (location = 3) in ivec4 drawingCoord1; -layout (location = 4) in ivec2 drawingCoord2; -layout (location = 5) in int drawingCoordI0; -layout (location = 0) in vec3 points; -layout (location = 1) in vec3 normals; -layout(location = 6) uniform int *instanceIndices; -layout(location = 7) uniform int *culledInstanceIndices; -layout(location = 0) uniform ConstantData10 *constantPrimvars; -layout(location = 1) uniform hd_vec3 *hydra_instanceTranslations_0; -layout(location = 2) uniform int *primitiveParam; -layout(location = 3) uniform int *edgeIndices; -layout(location = 4) uniform float *faceVisibility; -out VertexData { - vec4 Peye; - vec3 Neye; -} outData; -out PrimvarData { - vec3 points; - vec3 normals; -} outPrimvars; - -// //////// Codegen Accessors //////// -mat4 HdGet_transform(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transform); -} -mat4 HdGet_transform() { return HdGet_transform(0); } -mat4 HdGet_transformInverse(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transformInverse); -} -mat4 HdGet_transformInverse() { return HdGet_transformInverse(0); } -vec4 HdGet_color(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].color); -} -vec4 HdGet_color() { return HdGet_color(0); } -float HdGetScalar_color(int localIndex) { return HdGet_color(localIndex).x; } -float HdGetScalar_color() { return HdGet_color(0).x; } -vec4 HdGet_primID(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].primID); -} -vec4 HdGet_primID() { return HdGet_primID(0); } -float HdGetScalar_primID(int localIndex) { return HdGet_primID(localIndex).x; } -float HdGetScalar_primID() { return HdGet_primID(0).x; } -float HdGet_widths(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return float(constantPrimvars[index].widths); -} -float HdGet_widths() { return HdGet_widths(0); } -float HdGetScalar_widths(int localIndex) { return HdGet_widths(localIndex); } -float HdGetScalar_widths() { return HdGet_widths(0); } -vec3 HdGet_hydra_instanceTranslations_0(int localIndex) { - int index = GetDrawingCoord().instanceCoords[0]; - return hd_vec3_get(hydra_instanceTranslations_0[index]); -} -vec3 HdGet_hydra_instanceTranslations_0() { return HdGet_hydra_instanceTranslations_0(0); } -float HdGetScalar_hydra_instanceTranslations_0(int localIndex) { return HdGet_hydra_instanceTranslations_0(localIndex).x; } -float HdGetScalar_hydra_instanceTranslations_0() { return HdGet_hydra_instanceTranslations_0(0).x; } -vec3 HdGetInstance_hydra_instanceTranslations(int level, vec3 defaultValue) { - if (level == 0) return HdGet_hydra_instanceTranslations_0(); - return defaultValue; -} -#if !defined(HD_HAS_hydra_instanceTranslations) -#define HD_HAS_hydra_instanceTranslations 1 -vec3 HdGet_hydra_instanceTranslations(int localIndex) { - return HdGet_hydra_instanceTranslations_0(); -} -vec3 HdGet_hydra_instanceTranslations() { return HdGet_hydra_instanceTranslations(0); } -#endif - -// //////// Codegen VS Source //////// -#define HD_BINDLESS_BUFFERS_ENABLED -int GetBaseInstanceIndexCoord() { - return drawingCoord1.y; -} -int GetCurrentInstance() { - return int(hd_InstanceID - hd_BaseInstance); -} -int GetInstanceIndexCoord() { - return GetBaseInstanceIndexCoord() + GetCurrentInstance() * HD_INSTANCE_INDEX_WIDTH; -} -int HdGet_culledInstanceIndices(int localIndex) { - int index = GetInstanceIndexCoord()+localIndex + 1; - return int(culledInstanceIndices[index]); -} -int HdGet_culledInstanceIndices() { return HdGet_culledInstanceIndices(0); } -int HdGetScalar_culledInstanceIndices(int localIndex) { return HdGet_culledInstanceIndices(localIndex); } -int HdGetScalar_culledInstanceIndices() { return HdGet_culledInstanceIndices(0); } -int GetBaseVertexOffset() { - return HgiGetBaseVertex(); -} -hd_instanceIndex GetInstanceIndex() { - hd_instanceIndex r; - for (int i = 0; i < HD_INSTANCE_INDEX_WIDTH; ++i) - r.indices[i] = HdGet_culledInstanceIndices(/*localIndex=*/i); - return r; -} -hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = drawingCoord0.x; - dc.constantCoord = drawingCoord0.y; - dc.elementCoord = drawingCoord0.z; - dc.primitiveCoord = drawingCoord0.w; - dc.fvarCoord = drawingCoord1.x; - dc.shaderCoord = drawingCoord1.z; - dc.vertexCoord = drawingCoord1.w; - dc.topologyVisibilityCoord = drawingCoord2.x; - dc.varyingCoord = drawingCoord2.y; - hd_instanceIndex r = GetInstanceIndex(); - dc.instanceIndex[0] = r.indices[0]; - dc.instanceIndex[1] = r.indices[1]; - dc.instanceCoords[0] = drawingCoordI0 + dc.instanceIndex[1]; - return dc; -} -vec3 HdGet_points(int localIndex) { return hd_vec3_get(points);} -vec3 HdGet_points() { return HdGet_points(0); } -float HdGetScalar_points(int localIndex) { return HdGet_points(localIndex).x; } -float HdGetScalar_points() { return HdGet_points(0).x; } -vec3 HdGet_normals(int localIndex) { return hd_vec3_get(normals);} -vec3 HdGet_normals() { return HdGet_normals(0); } -float HdGetScalar_normals(int localIndex) { return HdGet_normals(localIndex).x; } -float HdGetScalar_normals() { return HdGet_normals(0).x; } - -// //////// Codegen Proc VS //////// -void ProcessPrimvarsIn() { - hd_drawingCoord dc = GetDrawingCoord(); - vs_interstageDrawingCoord0[0] = dc.modelCoord; - vs_interstageDrawingCoord0[1] = dc.constantCoord; - vs_interstageDrawingCoord0[2] = dc.elementCoord; - vs_interstageDrawingCoord0[3] = dc.primitiveCoord; - vs_interstageDrawingCoord1[0] = dc.fvarCoord; - vs_interstageDrawingCoord1[1] = dc.shaderCoord; - vs_interstageDrawingCoord1[2] = dc.vertexCoord; - vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; - vs_interstageDrawingCoord2[0] = dc.varyingCoord; - vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; - vs_interstageDrawingCoord2[2] = dc.instanceIndex[1]; - vs_interstageDrawingCoord2[3] = dc.instanceCoords[0]; - outPrimvars.points = points; - outPrimvars.normals = normals; -} - -// --------------------------------------------------------------------------- -// global defines -// --------------------------------------------------------------------------- -// codeGen can override this range (currently not). -// quadro 4000's max is 189. -#ifndef HD_GL_POINT_SIZE_MAX -#define HD_GL_POINT_SIZE_MAX 100.0 -#endif -#ifndef HD_GL_POINT_SIZE_MIN -#define HD_GL_POINT_SIZE_MIN .45 -#endif - -// --------------------------------------------------------------------------- -// render pass states -// --------------------------------------------------------------------------- - -MAT4 GetWorldToViewMatrix() { -#if defined(HD_HAS_worldToViewMatrix) - return MAT4(HdGet_worldToViewMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetWorldToViewInverseMatrix() { -#if defined(HD_HAS_worldToViewInverseMatrix) - return MAT4(HdGet_worldToViewInverseMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetProjectionMatrix() { -#if defined(HD_HAS_projectionMatrix) - return MAT4(HdGet_projectionMatrix()); -#else - return MAT4(1); -#endif -} -vec3 GetPositionInWorldSpace(vec3 windowRelativeCoord) -{ -#if defined(HD_HAS_imageToWorldMatrix) - vec4 pImage = vec4(windowRelativeCoord, 1.0); - vec4 pWorld = vec4(HdGet_imageToWorldMatrix() * pImage); - return (pWorld / pWorld.w).xyz; -#else - return windowRelativeCoord; -#endif -} -float GetLightingBlendAmount() { -#if defined(HD_HAS_lightingBlendAmount) - return HdGet_lightingBlendAmount(); -#else - return 1; -#endif -} -vec4 GetViewport() { -#if defined(HD_HAS_viewport) - return HdGet_viewport(); -#else - return vec4(0,0,1,1); -#endif -} -float GetTessLevel() { -#if defined(HD_HAS_tessLevel) - return HdGet_tessLevel(); -#else - return 1; -#endif -} -float GetPointSize() { -#if defined(HD_HAS_pointSize) - return HdGet_pointSize(); -#else - return 3.0; -#endif -} -float GetPointSelectedSize() { -#if defined(HD_HAS_pointSelectedSize) - return HdGet_pointSelectedSize(); -#else - return 5.0; -#endif -} -vec4 GetWireframeColor() { -// Individual prims can specify an alternative wireframe color -// to one specified in the render pass. This is used in cases were -// there is not enough contrast with the normal one. -#if defined(HD_HAS_overrideWireframeColor) - return HdGet_overrideWireframeColor(); -#elif defined(HD_HAS_wireframeColor) - return HdGet_wireframeColor(); -#else - return vec4(0,0,0,0); -#endif -} -vec4 GetMaskColor() { -#if defined(HD_HAS_maskColor) - return HdGet_maskColor(); -#else - return vec4(0.5,0,0,1); -#endif -} -vec4 GetIndicatorColor() { -#if defined(HD_HAS_indicatorColor) - return HdGet_indicatorColor(); -#else - return vec4(0,0.5,0,1); -#endif -} - -bool ShouldDiscardByAlpha(vec4 color) -{ -#if defined(HD_HAS_alphaThreshold) - float alphaThreshold = HdGet_alphaThreshold(); -#else - float alphaThreshold = 0; -#endif - return (color.a < alphaThreshold); -} - -vec2 ApplyAxisAlignedAffineTransform(vec4 t, vec2 pt) -{ - return t.xy * pt + t.zw; -} - - - -void ApplyClipPlanes(vec4 Peye) -{ -#if defined(HD_HAS_numClipPlanes) -#if defined(HD_HAS_clipPlanes) - for (int i=0; i> 2); -} -int GetAggregatedElementID() { - return GetElementID() - + GetDrawingCoord().elementCoord; -} -int HdGet_edgeIndices(int localIndex) { - int index = GetPrimitiveIndex(); - return int(edgeIndices[index]); -} -int HdGet_edgeIndices() { return HdGet_edgeIndices(0); } -int HdGetScalar_edgeIndices(int localIndex) { return HdGet_edgeIndices(localIndex); } -int HdGetScalar_edgeIndices() { return HdGet_edgeIndices(0); } -int GetAuthoredEdgeId(int primitiveEdgeId) { - return primitiveEdgeId; -} -float HdGet_faceVisibility(int localIndex) { - int index = GetAggregatedElementID(); - return float(faceVisibility[index]); -} -float HdGet_faceVisibility() { return HdGet_faceVisibility(0); } -float HdGetScalar_faceVisibility(int localIndex) { return HdGet_faceVisibility(localIndex); } -float HdGetScalar_faceVisibility() { return HdGet_faceVisibility(0); } -vec3 HdGet_points(int localIndex) { - int index = localIndex; - return vec3(inPrimvars[index].points); -} -vec3 HdGet_points() { return HdGet_points(0); } -float HdGetScalar_points(int localIndex) { return HdGet_points(localIndex).x; } -float HdGetScalar_points() { return HdGet_points(0).x; } -vec3 HdGet_normals(int localIndex) { - int index = localIndex; - return vec3(inPrimvars[index].normals); -} -vec3 HdGet_normals() { return HdGet_normals(0); } -float HdGetScalar_normals(int localIndex) { return HdGet_normals(localIndex).x; } -float HdGetScalar_normals() { return HdGet_normals(0).x; } -vec2 HdGet_dispTextureCoord_Coarse(int localIndex) { - int fvarIndex = GetFVarIndex(localIndex); - return vec2(dispTextureCoord[fvarIndex]); -} -vec2 HdGet_dispTextureCoord(int localIndex, vec2 st) { - return (HdGet_dispTextureCoord_Coarse(0) * (1-st.x-st.y) + HdGet_dispTextureCoord_Coarse(1) * st.x + HdGet_dispTextureCoord_Coarse(2) * st.y); -} -FORWARD_DECL(vec4 GetPatchCoord(int index)); -FORWARD_DECL(vec2 GetPatchCoordLocalST()); -vec2 HdGet_dispTextureCoord(int localIndex) { - vec2 localST = GetPatchCoord(localIndex).xy; - return HdGet_dispTextureCoord(localIndex, localST); -} -vec2 HdGet_dispTextureCoord() { return HdGet_dispTextureCoord(0); } -FORWARD_DECL(vec4 GetPatchCoord(int localIndex)); -void ProcessSamplingTransforms(MAT4 instanceModelViewInverse) { -} - -// //////// Codegen Proc GS //////// -FORWARD_DECL(vec4 GetPatchCoord(int index)); -void ProcessPrimvarsOut(int index) { - vec2 localST = GetPatchCoord(index).xy; - const vec3 coords[3] = vec3[]( - vec3(1,0,0), vec3(0,1,0), vec3(0,0,1) - ); - hd_barycentricCoord = coords[index]; - hd_drawingCoord dc = GetDrawingCoord(); - gs_interstageDrawingCoord0[0] = dc.modelCoord; - gs_interstageDrawingCoord0[1] = dc.constantCoord; - gs_interstageDrawingCoord0[2] = dc.elementCoord; - gs_interstageDrawingCoord0[3] = dc.primitiveCoord; - gs_interstageDrawingCoord1[0] = dc.fvarCoord; - gs_interstageDrawingCoord1[1] = dc.shaderCoord; - gs_interstageDrawingCoord1[2] = dc.vertexCoord; - gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; - gs_interstageDrawingCoord2[0] = dc.varyingCoord; - gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; - gs_interstageDrawingCoord2[2] = dc.instanceIndex[1]; - gs_interstageDrawingCoord2[3] = dc.instanceCoords[0]; - outPrimvars.points = inPrimvars[index].points; - outPrimvars.normals = inPrimvars[index].normals; - outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); -} - -// --------------------------------------------------------------------------- -// global defines -// --------------------------------------------------------------------------- -// codeGen can override this range (currently not). -// quadro 4000's max is 189. -#ifndef HD_GL_POINT_SIZE_MAX -#define HD_GL_POINT_SIZE_MAX 100.0 -#endif -#ifndef HD_GL_POINT_SIZE_MIN -#define HD_GL_POINT_SIZE_MIN .45 -#endif - -// --------------------------------------------------------------------------- -// render pass states -// --------------------------------------------------------------------------- - -MAT4 GetWorldToViewMatrix() { -#if defined(HD_HAS_worldToViewMatrix) - return MAT4(HdGet_worldToViewMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetWorldToViewInverseMatrix() { -#if defined(HD_HAS_worldToViewInverseMatrix) - return MAT4(HdGet_worldToViewInverseMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetProjectionMatrix() { -#if defined(HD_HAS_projectionMatrix) - return MAT4(HdGet_projectionMatrix()); -#else - return MAT4(1); -#endif -} -vec3 GetPositionInWorldSpace(vec3 windowRelativeCoord) -{ -#if defined(HD_HAS_imageToWorldMatrix) - vec4 pImage = vec4(windowRelativeCoord, 1.0); - vec4 pWorld = vec4(HdGet_imageToWorldMatrix() * pImage); - return (pWorld / pWorld.w).xyz; -#else - return windowRelativeCoord; -#endif -} -float GetLightingBlendAmount() { -#if defined(HD_HAS_lightingBlendAmount) - return HdGet_lightingBlendAmount(); -#else - return 1; -#endif -} -vec4 GetViewport() { -#if defined(HD_HAS_viewport) - return HdGet_viewport(); -#else - return vec4(0,0,1,1); -#endif -} -float GetTessLevel() { -#if defined(HD_HAS_tessLevel) - return HdGet_tessLevel(); -#else - return 1; -#endif -} -float GetPointSize() { -#if defined(HD_HAS_pointSize) - return HdGet_pointSize(); -#else - return 3.0; -#endif -} -float GetPointSelectedSize() { -#if defined(HD_HAS_pointSelectedSize) - return HdGet_pointSelectedSize(); -#else - return 5.0; -#endif -} -vec4 GetWireframeColor() { -// Individual prims can specify an alternative wireframe color -// to one specified in the render pass. This is used in cases were -// there is not enough contrast with the normal one. -#if defined(HD_HAS_overrideWireframeColor) - return HdGet_overrideWireframeColor(); -#elif defined(HD_HAS_wireframeColor) - return HdGet_wireframeColor(); -#else - return vec4(0,0,0,0); -#endif -} -vec4 GetMaskColor() { -#if defined(HD_HAS_maskColor) - return HdGet_maskColor(); -#else - return vec4(0.5,0,0,1); -#endif -} -vec4 GetIndicatorColor() { -#if defined(HD_HAS_indicatorColor) - return HdGet_indicatorColor(); -#else - return vec4(0,0.5,0,1); -#endif -} - -bool ShouldDiscardByAlpha(vec4 color) -{ -#if defined(HD_HAS_alphaThreshold) - float alphaThreshold = HdGet_alphaThreshold(); -#else - float alphaThreshold = 0; -#endif - return (color.a < alphaThreshold); -} - -vec2 ApplyAxisAlignedAffineTransform(vec4 t, vec2 pt) -{ - return t.xy * pt + t.zw; -} - - - -void ApplyClipPlanes(vec4 Peye) -{ -#if defined(HD_HAS_numClipPlanes) -#if defined(HD_HAS_clipPlanes) - for (int i=0; i 0.0) - normal = normalize(normal); - return normal; -} - -vec3 GetNormal(vec3 Neye, int index, vec2 localST) -{ - return GetNormal(Neye, index); -} - - - -vec3 GetTriGeometryNormal(vec3 Neye, vec4 Peye0, vec4 Peye1, vec4 Peye2, - bool isFlipped) -{ - return Neye; -} - -vec3 GetQuadGeometryNormal(vec3 Neye, - vec4 Peye0, vec4 Peye1, vec4 Peye2, vec4 Peye3, - bool isFlipped) -{ - return Neye; -} - - - -vec4 DisplacementTerminal(int index, vec4 Peye, vec3 Neye, vec4 patchCoord) -{ - return Peye; -} - - - -vec4 GetPatchCoord(int index) -{ - vec2 uv[3]; - uv[0] = vec2(0, 0); // (0, 0, 1); - uv[1] = vec2(1, 0); // (1, 0, 0); - uv[2] = vec2(0, 1); // (0, 1, 0); - - ivec3 patchParam = GetPatchParam(); - return InterpolatePatchCoordTriangle(uv[index], patchParam); -} - -void emit(int index, vec4 Peye, vec3 Neye) -{ - outData.Peye = Peye; - outData.Neye = Neye; - - gsPatchCoord = GetPatchCoord(index); - - gl_Position = vec4(GetProjectionMatrix() * outData.Peye); - ApplyClipPlanes(outData.Peye); - - ProcessPrimvarsOut(index); - - EmitVertex(); -} - -void main(void) -{ - gl_PrimitiveID = gl_PrimitiveIDIn; - - bool isFlipped = IsFlipped(); // consider handedness AND negative-scale - - vec3 Neye0 = GetNormal(inData[0].Neye, 0); - Neye0 = GetTriGeometryNormal(Neye0, inData[0].Peye, inData[1].Peye, - inData[2].Peye, isFlipped); - vec3 Neye1 = GetNormal(inData[1].Neye, 1); - Neye1 = GetTriGeometryNormal(Neye1, inData[0].Peye, inData[1].Peye, - inData[2].Peye, isFlipped); - vec3 Neye2 = GetNormal(inData[2].Neye, 2); - Neye2 = GetTriGeometryNormal(Neye2, inData[0].Peye, inData[1].Peye, - inData[2].Peye, isFlipped); - - vec4 Peye0 = DisplacementTerminal( - 0, inData[0].Peye, Neye0, GetPatchCoord(0)); - vec4 Peye1 = DisplacementTerminal( - 1, inData[1].Peye, Neye1, GetPatchCoord(1)); - vec4 Peye2 = DisplacementTerminal( - 2, inData[2].Peye, Neye2, GetPatchCoord(2)); - - // triangle 0: vertices (0,1,2) - emit(0, Peye0, Neye0); - emit(1, Peye1, Neye1); - emit(2, Peye2, Neye2); - - EndPrimitive(); -} - - -======================================================= - FRAGMENT SHADER -======================================================= -#version 450 -#extension GL_NV_shader_buffer_load : require -#extension GL_NV_gpu_shader5 : require -#extension GL_ARB_bindless_texture : require -#define REF(space,type) inout type -#define FORWARD_DECL(func_decl) func_decl; -#define ATOMIC_LOAD(a) (a) -#define ATOMIC_STORE(a, v) (a) = (v) -#define ATOMIC_ADD(a, v) atomicAdd(a, v) -#define ATOMIC_EXCHANGE(a, v) atomicExchange(a, v) -#define ATOMIC_COMP_SWAP(a, expected, desired) atomicCompSwap(a, expected, desired) -#define atomic_int int -#define atomic_uint uint - -#define HGI_HAS_DOUBLE_TYPE 1 - - -struct hgi_ivec3 { int x, y, z; }; -struct hgi_vec3 { float x, y, z; }; -struct hgi_dvec3 { double x, y, z; }; -struct hgi_mat3 { float m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; -struct hgi_dmat3 { double m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; - - - -// //////// Global Includes //////// - -// //////// Global Macros //////// - -// //////// Global Structs //////// - -// //////// Global Member Declarations //////// - -// //////// Global Function Definitions //////// - - -// //////// Codegen Defines //////// -#define HD_SHADER_API 2 -#define MAT4 mat4 -// Alias hgi vec and matrix types to hd. -#define hd_ivec3 hgi_ivec3 -#define hd_vec3 hgi_vec3 -#define hd_dvec3 hgi_dvec3 -#define hd_mat3 hgi_mat3 -#define hd_dmat3 hgi_dmat3 - -ivec3 hd_ivec3_get(hd_ivec3 v) { return ivec3(v.x, v.y, v.z); } -ivec3 hd_ivec3_get(ivec3 v) { return v; } -vec3 hd_vec3_get(hd_vec3 v) { return vec3(v.x, v.y, v.z); } -vec3 hd_vec3_get(vec3 v) { return v; } -dvec3 hd_dvec3_get(hd_dvec3 v) { return dvec3(v.x, v.y, v.z); } -dvec3 hd_dvec3_get(dvec3 v) { return v; } -mat3 hd_mat3_get(hd_mat3 v) { return mat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -mat3 hd_mat3_get(mat3 v) { return v; } -dmat3 hd_dmat3_get(hd_dmat3 v) { return dmat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -dmat3 hd_dmat3_get(dmat3 v) { return v; } -hd_ivec3 hd_ivec3_set(hd_ivec3 v) { return v; } -hd_ivec3 hd_ivec3_set(ivec3 v) { return hd_ivec3(v.x, v.y, v.z); } -hd_vec3 hd_vec3_set(hd_vec3 v) { return v; } -hd_vec3 hd_vec3_set(vec3 v) { return hd_vec3(v.x, v.y, v.z); } -hd_dvec3 hd_dvec3_set(hd_dvec3 v) { return v; } -hd_dvec3 hd_dvec3_set(dvec3 v) { return hd_dvec3(v.x, v.y, v.z); } -hd_mat3 hd_mat3_set(hd_mat3 v) { return v; } -hd_mat3 hd_mat3_set(mat3 v) { return hd_mat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -hd_dmat3 hd_dmat3_set(hd_dmat3 v) { return v; } -hd_dmat3 hd_dmat3_set(dmat3 v) { return hd_dmat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -int hd_int_get(int v) { return v; } -int hd_int_get(ivec2 v) { return v.x; } -int hd_int_get(ivec3 v) { return v.x; } -int hd_int_get(ivec4 v) { return v.x; } -vec3 hd_sample_udim(vec2 v) { -vec2 vf = floor(v); -return vec3(v.x - vf.x, v.y - vf.y, clamp(vf.x, 0.0, 10.0) + 10.0 * vf.y); -} -vec4 hd_vec4_2_10_10_10_get(int v) { - ivec4 unpacked = ivec4((v & 0x3ff) << 22, (v & 0xffc00) << 12, - (v & 0x3ff00000) << 2, (v & 0xc0000000)); - return vec4(unpacked) / 2147483647.0; } -int hd_vec4_2_10_10_10_set(vec4 v) { - return ( (int(v.x * 511.0) & 0x3ff) | - ((int(v.y * 511.0) & 0x3ff) << 10) | - ((int(v.z * 511.0) & 0x3ff) << 20) | - ((int(v.w) & 0x1) << 30)); } -vec2 hd_half2_get(uint v) { - return unpackHalf2x16(v); } -uint hd_half2_set(vec2 v) { - return packHalf2x16(v); } -vec4 hd_half4_get(uvec2 v) { - return vec4(unpackHalf2x16(v.x), unpackHalf2x16(v.y)); } -uvec2 hd_half4_set(vec4 v) { - return uvec2(packHalf2x16(v.xy), packHalf2x16(v.zw)); } -#define HD_NUM_PRIMITIVE_VERTS 3 -#define HD_HAS_transform 1 -#define HD_HAS_transformInverse 1 -#define HD_HAS_color 1 -#define HD_HAS_primID 1 -#define HD_HAS_widths 1 -#define HD_HAS_INSTANCE_hydra_instanceTranslations 1 -#define HD_HAS_hydra_instanceTranslations_0 1 -#define HD_INSTANCER_NUM_LEVELS 1 -#define HD_INSTANCE_INDEX_WIDTH 2 -#define HD_HAS_faceVisibility 1 -#define HD_HAS_dispTextureCoord 1 -#define HD_HAS_points 1 -#define HD_HAS_normals 1 - -// //////// Codegen Decl //////// -struct hd_drawingCoord { - int modelCoord; - int constantCoord; - int elementCoord; - int primitiveCoord; - int fvarCoord; - int shaderCoord; - int vertexCoord; - int topologyVisibilityCoord; - int varyingCoord; - int instanceIndex[HD_INSTANCE_INDEX_WIDTH]; - int instanceCoords[HD_INSTANCE_INDEX_WIDTH]; -}; -FORWARD_DECL(hd_drawingCoord GetDrawingCoord()); -FORWARD_DECL(int HgiGetBaseVertex()); -struct hd_instanceIndex { int indices[HD_INSTANCE_INDEX_WIDTH]; }; -struct ConstantData10 { - mat4 transform; - mat4 transformInverse; - vec4 color; - vec4 primID; - float widths; -}; -FORWARD_DECL(int GetElementID()); -FORWARD_DECL(int GetAggregatedElementID()); -FORWARD_DECL(int GetPrimitiveEdgeId()); -FORWARD_DECL(float GetSelectedEdgeOpacity()); -layout(location = 6) uniform int *instanceIndices; -layout(location = 7) uniform int *culledInstanceIndices; -layout(location = 0) uniform ConstantData10 *constantPrimvars; -layout(location = 1) uniform hd_vec3 *hydra_instanceTranslations_0; -layout(location = 2) uniform int *primitiveParam; -layout(location = 3) uniform int *edgeIndices; -layout(location = 4) uniform float *faceVisibility; -in vec4 gsPatchCoord; -in VertexData { - vec4 Peye; - vec3 Neye; -} inData; -layout (location = 0) out vec4 colorOut; -in noperspective vec3 hd_barycentricCoord; -in flat ivec4 gs_interstageDrawingCoord0; -in flat ivec4 gs_interstageDrawingCoord1; -in flat ivec4 gs_interstageDrawingCoord2; -in flat ivec4 gs_interstageDrawingCoord3; -in PrimvarData { - vec3 points; - vec3 normals; - vec2 dispTextureCoord; -} inPrimvars; -layout(location = 5) uniform vec2 *dispTextureCoord; -vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) -{ - // add 0.5 to integer values for more robust interpolation - return vec4(uv.x, uv.y, 0, patchParam.x+0.5f); -} -vec4 InterpolatePatchCoordTriangle(vec2 uv, ivec3 patchParam) -{ - return InterpolatePatchCoord(uv, patchParam); -} - -// //////// Codegen Accessors //////// -mat4 HdGet_transform(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transform); -} -mat4 HdGet_transform() { return HdGet_transform(0); } -mat4 HdGet_transformInverse(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transformInverse); -} -mat4 HdGet_transformInverse() { return HdGet_transformInverse(0); } -vec4 HdGet_color(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].color); -} -vec4 HdGet_color() { return HdGet_color(0); } -float HdGetScalar_color(int localIndex) { return HdGet_color(localIndex).x; } -float HdGetScalar_color() { return HdGet_color(0).x; } -vec4 HdGet_primID(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].primID); -} -vec4 HdGet_primID() { return HdGet_primID(0); } -float HdGetScalar_primID(int localIndex) { return HdGet_primID(localIndex).x; } -float HdGetScalar_primID() { return HdGet_primID(0).x; } -float HdGet_widths(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return float(constantPrimvars[index].widths); -} -float HdGet_widths() { return HdGet_widths(0); } -float HdGetScalar_widths(int localIndex) { return HdGet_widths(localIndex); } -float HdGetScalar_widths() { return HdGet_widths(0); } -vec3 HdGet_hydra_instanceTranslations_0(int localIndex) { - int index = GetDrawingCoord().instanceCoords[0]; - return hd_vec3_get(hydra_instanceTranslations_0[index]); -} -vec3 HdGet_hydra_instanceTranslations_0() { return HdGet_hydra_instanceTranslations_0(0); } -float HdGetScalar_hydra_instanceTranslations_0(int localIndex) { return HdGet_hydra_instanceTranslations_0(localIndex).x; } -float HdGetScalar_hydra_instanceTranslations_0() { return HdGet_hydra_instanceTranslations_0(0).x; } -vec3 HdGetInstance_hydra_instanceTranslations(int level, vec3 defaultValue) { - if (level == 0) return HdGet_hydra_instanceTranslations_0(); - return defaultValue; -} -#if !defined(HD_HAS_hydra_instanceTranslations) -#define HD_HAS_hydra_instanceTranslations 1 -vec3 HdGet_hydra_instanceTranslations(int localIndex) { - return HdGet_hydra_instanceTranslations_0(); -} -vec3 HdGet_hydra_instanceTranslations() { return HdGet_hydra_instanceTranslations(0); } -#endif - -// //////// Codegen FS Source //////// -#define HD_SHADER_SUPPORTS_DOUBLE_PRECISION -#define HD_MINUS_ONE_TO_ONE_DEPTH_RANGE -vec3 GetBarycentricCoord() { - return hd_barycentricCoord; -} -int GetPrimitiveID() { - return gl_PrimitiveID; -} -int GetPrimitiveIndex() { - return GetDrawingCoord().primitiveCoord + GetPrimitiveID(); -} -hd_drawingCoord GetDrawingCoord() { - hd_drawingCoord dc; - dc.modelCoord = gs_interstageDrawingCoord0[0]; - dc.constantCoord = gs_interstageDrawingCoord0[1]; - dc.elementCoord = gs_interstageDrawingCoord0[2]; - dc.primitiveCoord = gs_interstageDrawingCoord0[3]; - dc.fvarCoord = gs_interstageDrawingCoord1[0]; - dc.shaderCoord = gs_interstageDrawingCoord1[1]; - dc.vertexCoord = gs_interstageDrawingCoord1[2]; - dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; - dc.varyingCoord = gs_interstageDrawingCoord2[0]; - dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; - dc.instanceIndex[1] = gs_interstageDrawingCoord2[2]; - dc.instanceCoords[0] = gs_interstageDrawingCoord2[3]; - return dc; -} -int HdGet_primitiveParam(int localIndex) { - int index = GetPrimitiveIndex(); - return int(primitiveParam[index]); -} -int HdGet_primitiveParam() { return HdGet_primitiveParam(0); } -int HdGetScalar_primitiveParam(int localIndex) { return HdGet_primitiveParam(localIndex); } -int HdGetScalar_primitiveParam() { return HdGet_primitiveParam(0); } -#if defined(HD_HAS_coarseFaceIndex) -FORWARD_DECL(int HdGetScalar_coarseFaceIndex()); -#endif -ivec3 GetPatchParam() { -#if defined(HD_HAS_coarseFaceIndex) - return ivec3(HdGetScalar_coarseFaceIndex(), 0, 0); -#else - return ivec3(GetPrimitiveID(), 0, 0); -#endif -} -int GetEdgeFlag() { - return (HdGet_primitiveParam() & 3); -} -int GetFVarIndex(int localIndex) { - int fvarCoord = GetDrawingCoord().fvarCoord; - int ptexIndex = GetPatchParam().x & 0xfffffff; - return fvarCoord + ptexIndex * 3 + localIndex; -} -int GetElementID() { - return (hd_int_get(HdGet_primitiveParam()) >> 2); -} -int GetAggregatedElementID() { - return GetElementID() - + GetDrawingCoord().elementCoord; -} -int HdGet_edgeIndices(int localIndex) { - int index = GetPrimitiveIndex(); - return int(edgeIndices[index]); -} -int HdGet_edgeIndices() { return HdGet_edgeIndices(0); } -int HdGetScalar_edgeIndices(int localIndex) { return HdGet_edgeIndices(localIndex); } -int HdGetScalar_edgeIndices() { return HdGet_edgeIndices(0); } -int GetAuthoredEdgeId(int primitiveEdgeId) { - return primitiveEdgeId; -} -float HdGet_faceVisibility(int localIndex) { - int index = GetAggregatedElementID(); - return float(faceVisibility[index]); -} -float HdGet_faceVisibility() { return HdGet_faceVisibility(0); } -float HdGetScalar_faceVisibility(int localIndex) { return HdGet_faceVisibility(localIndex); } -float HdGetScalar_faceVisibility() { return HdGet_faceVisibility(0); } -vec3 HdGet_points(int localIndex) { return vec3(inPrimvars.points);} -vec3 HdGet_points() { return HdGet_points(0); } -float HdGetScalar_points(int localIndex) { return HdGet_points(localIndex).x; } -float HdGetScalar_points() { return HdGet_points(0).x; } -vec3 HdGet_normals(int localIndex) { return vec3(inPrimvars.normals);} -vec3 HdGet_normals() { return HdGet_normals(0); } -float HdGetScalar_normals(int localIndex) { return HdGet_normals(localIndex).x; } -float HdGetScalar_normals() { return HdGet_normals(0).x; } -vec2 HdGet_dispTextureCoord(int localIndex) { return vec2(inPrimvars.dispTextureCoord);} -vec2 HdGet_dispTextureCoord() { return HdGet_dispTextureCoord(0); } -float HdGetScalar_dispTextureCoord(int localIndex) { return HdGet_dispTextureCoord(localIndex).x; } -float HdGetScalar_dispTextureCoord() { return HdGet_dispTextureCoord(0).x; } -FORWARD_DECL(vec4 GetPatchCoord(int index)); -void ProcessSamplingTransforms(MAT4 instanceModelViewInverse) { -} - -// --------------------------------------------------------------------------- -// global defines -// --------------------------------------------------------------------------- -// codeGen can override this range (currently not). -// quadro 4000's max is 189. -#ifndef HD_GL_POINT_SIZE_MAX -#define HD_GL_POINT_SIZE_MAX 100.0 -#endif -#ifndef HD_GL_POINT_SIZE_MIN -#define HD_GL_POINT_SIZE_MIN .45 -#endif - -// --------------------------------------------------------------------------- -// render pass states -// --------------------------------------------------------------------------- - -MAT4 GetWorldToViewMatrix() { -#if defined(HD_HAS_worldToViewMatrix) - return MAT4(HdGet_worldToViewMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetWorldToViewInverseMatrix() { -#if defined(HD_HAS_worldToViewInverseMatrix) - return MAT4(HdGet_worldToViewInverseMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetProjectionMatrix() { -#if defined(HD_HAS_projectionMatrix) - return MAT4(HdGet_projectionMatrix()); -#else - return MAT4(1); -#endif -} -vec3 GetPositionInWorldSpace(vec3 windowRelativeCoord) -{ -#if defined(HD_HAS_imageToWorldMatrix) - vec4 pImage = vec4(windowRelativeCoord, 1.0); - vec4 pWorld = vec4(HdGet_imageToWorldMatrix() * pImage); - return (pWorld / pWorld.w).xyz; -#else - return windowRelativeCoord; -#endif -} -float GetLightingBlendAmount() { -#if defined(HD_HAS_lightingBlendAmount) - return HdGet_lightingBlendAmount(); -#else - return 1; -#endif -} -vec4 GetViewport() { -#if defined(HD_HAS_viewport) - return HdGet_viewport(); -#else - return vec4(0,0,1,1); -#endif -} -float GetTessLevel() { -#if defined(HD_HAS_tessLevel) - return HdGet_tessLevel(); -#else - return 1; -#endif -} -float GetPointSize() { -#if defined(HD_HAS_pointSize) - return HdGet_pointSize(); -#else - return 3.0; -#endif -} -float GetPointSelectedSize() { -#if defined(HD_HAS_pointSelectedSize) - return HdGet_pointSelectedSize(); -#else - return 5.0; -#endif -} -vec4 GetWireframeColor() { -// Individual prims can specify an alternative wireframe color -// to one specified in the render pass. This is used in cases were -// there is not enough contrast with the normal one. -#if defined(HD_HAS_overrideWireframeColor) - return HdGet_overrideWireframeColor(); -#elif defined(HD_HAS_wireframeColor) - return HdGet_wireframeColor(); -#else - return vec4(0,0,0,0); -#endif -} -vec4 GetMaskColor() { -#if defined(HD_HAS_maskColor) - return HdGet_maskColor(); -#else - return vec4(0.5,0,0,1); -#endif -} -vec4 GetIndicatorColor() { -#if defined(HD_HAS_indicatorColor) - return HdGet_indicatorColor(); -#else - return vec4(0,0.5,0,1); -#endif -} - -bool ShouldDiscardByAlpha(vec4 color) -{ -#if defined(HD_HAS_alphaThreshold) - float alphaThreshold = HdGet_alphaThreshold(); -#else - float alphaThreshold = 0; -#endif - return (color.a < alphaThreshold); -} - -vec2 ApplyAxisAlignedAffineTransform(vec4 t, vec2 pt) -{ - return t.xy * pt + t.zw; -} - - - -vec2 HorizontallyNormalizedFilmbackCoordinates() -{ - const vec4 transform = -#ifdef HD_HAS_imageToHorizontallyNormalizedFilmback - HdGet_imageToHorizontallyNormalizedFilmback(); -#else - vec4(vec2(1.0), vec2(0.0)); -#endif - return ApplyAxisAlignedAffineTransform(transform, gl_FragCoord.xy); -} - - - -vec4 ApplySelectionColor(vec4 color) -{ - return color; -} - - - -// Forward declare selection functionality. -// XXX: Currently, the non-empty implementation of this is in hdx. -FORWARD_DECL(vec4 ApplySelectionColor(vec4 color)); - -// XXX: Make sure to update hdx/shaders/renderPass.glslfx when editing these -// color override methods, since they're currently duplicated. This is because -// we don't have a mixin token for color overrides in a render pass yet. -vec4 ApplyColorOverrides(vec4 color) -{ -#if defined(HD_HAS_overrideColor) - // Mix in override color - vec4 overrideColor = HdGet_overrideColor(); - color.rgb = mix(color.rgb, overrideColor.rgb, overrideColor.a); -#endif - return ApplySelectionColor(color); -} - -vec3 ApplyMaskColor(vec3 color, float weight, vec4 maskColor) -{ - float strength = maskColor.a * clamp(weight, 0.0, 1.0); - return mix(color, maskColor.rgb, strength); -} - -vec4 ApplyColorOverridesPostLighting(vec4 color) -{ - #if defined(HD_HAS_maskWeight) - float maskWeight = HdGet_maskWeight(); - vec4 maskColor = GetMaskColor(); - color.rgb = ApplyMaskColor(color.rgb, maskWeight, maskColor); - #endif - #if defined(HD_HAS_indicatorWeight) - float indicatorWeight = HdGet_indicatorWeight(); - vec4 indicatorColor = GetIndicatorColor(); - color.rgb = ApplyMaskColor(color.rgb, indicatorWeight, indicatorColor); - #endif - return color; -} - - - -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) -{ - colorOut = color; -} - - -#ifndef HD_HAS_integrateLights -#define HD_HAS_integrateLights -#endif - -struct LightingContribution { - vec3 diffuse; -}; - -struct LightingInterfaceProperties { - float unused; -}; - -LightingContribution -integrateLightsDefault(vec4 Peye, vec3 Neye, LightingInterfaceProperties props) -{ - vec3 n = normalize(Neye); - - LightingContribution result; - result.diffuse = vec3(dot(n, vec3(0,0,1))); - - return result; -} - -LightingContribution -integrateLightsConstant(vec4 Peye, vec3 Neye, LightingInterfaceProperties props) -{ - LightingContribution result; - //pefectly diffuse white hemisphere contribution - result.diffuse = vec3(1); - - return result; -} - - - -FORWARD_DECL( - LightingContribution integrateLights(vec4 Peye, vec3 Neye, - LightingInterfaceProperties props)); - -vec3 FallbackLighting(in vec3 Peye, in vec3 Neye, in vec3 color) -{ - LightingInterfaceProperties props; - LightingContribution light = integrateLights(vec4(Peye, 1), Neye, props); - return color * light.diffuse; -} - - -vec4 surfaceShader(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) -{ - // lighting - color.rgb = FallbackLighting(Peye.xyz, Neye, color.rgb); - return color; -} - - -// quaternion to matrix. xyz = imaginary, w = real -MAT4 GetRotationMatrix(vec4 q) -{ - MAT4 r; - r[0].xyzw = vec4(1 - 2 * (q.y * q.y + q.z * q.z), - 2 * (q.x * q.y + q.z * q.w), - 2 * (q.x * q.z - q.y * q.w), - 0); - r[1].xyzw = vec4( 2 * (q.x * q.y - q.z * q.w), - 1 - 2 * (q.x * q.x + q.z * q.z), - 2 * (q.y * q.z + q.x * q.w), - 0); - r[2].xyzw = vec4( 2 * (q.x * q.z + q.y * q.w), - 2 * (q.y * q.z - q.x * q.w), - 1 - 2 * (q.x * q.x + q.y * q.y), - 0); - r[3] = vec4(0, 0, 0, 1); - return r; -} - -// --------------------------------------------------------------------------- - -MAT4 GetInstanceTransform(int level) -{ - MAT4 m = MAT4(1); -#ifdef HD_HAS_INSTANCE_hydra_instanceTransforms - m = HdGetInstance_hydra_instanceTransforms(level, MAT4(1)) * m; -#elif defined(HD_HAS_INSTANCE_instanceTransform) - m = HdGetInstance_instanceTransform(level, MAT4(1)) * m; -#endif - - // instance transform elements are applied: - // scale then rotate then translate - // i.e. (T * R * S) * position - -#ifdef HD_HAS_INSTANCE_hydra_instanceScales - vec3 s = HdGetInstance_hydra_instanceScales(level, /*default=*/vec3(1)); - m = MAT4(s.x, 0, 0, 0, - 0, s.y, 0, 0, - 0, 0, s.z, 0, - 0, 0, 0, 1) * m; -#elif defined(HD_HAS_INSTANCE_instanceScale) - vec3 s = HdGetInstance_scale(level, /*default=*/vec3(1)); - m = MAT4(s.x, 0, 0, 0, - 0, s.y, 0, 0, - 0, 0, s.z, 0, - 0, 0, 0, 1) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceRotations // GfQuat(ix, iy, iz, real) - vec4 q = HdGetInstance_hydra_instanceRotations(level, /*default=*/vec4(0)); - m = GetRotationMatrix(q) * m; -#elif defined(HD_HAS_INSTANCE_rotate) - vec4 q = HdGetInstance_rotate(level, /*default=*/vec4(0)); - m = GetRotationMatrix(q) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceTranslations - vec3 t = HdGetInstance_hydra_instanceTranslations(level, /*default=*/vec3(0)); - m = MAT4( 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - t.x, t.y, t.z, 1) * m; -#elif defined(HD_HAS_INSTANCE_translate) - vec3 t = HdGetInstance_translate(level, /*default=*/vec3(0)); - m = MAT4( 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - t.x, t.y, t.z, 1) * m; -#endif - return m; -} - -MAT4 GetInstanceTransformInverse(int level) -{ - MAT4 m = MAT4(1); - -#ifdef HD_HAS_INSTANCE_hydra_instanceTransforms - m = inverse(HdGetInstance_hydra_instanceTransforms(level, MAT4(1))) * m; -#elif defined(HD_HAS_INSTANCE_instanceTransform) - m = inverse(HdGetInstance_instanceTransform(level, MAT4(1))) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceTranslations - vec3 it = -HdGetInstance_hydra_instanceTranslations(level, /*default=*/vec3(0)); // negate - m = MAT4( 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - it.x, it.y, it.z, 1) * m; -#elif defined(HD_HAS_INSTANCE_translate) - vec3 it = -HdGetInstance_translate(level, /*default=*/vec3(0)); // negate - m = MAT4( 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - it.x, it.y, it.z, 1) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceRotations - vec4 q = HdGetInstance_hydra_instanceRotations(level, /*default=*/vec4(0)); - q.xyz = -q.xyz; // inverse rotataion axis - m = GetRotationMatrix(q) * m; -#elif defined(HD_HAS_INSTANCE_rotate) - vec4 q = HdGetInstance_rotate(level, /*default=*/vec4(0)); - q.xyz = -q.xyz; // inverse rotataion axis - m = GetRotationMatrix(q) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceScales - vec3 is = 1.0/HdGetInstance_hydra_instanceScales(level, /*default=*/vec3(1)); // inverse scale - m = MAT4(is.x, 0, 0, 0, - 0, is.y, 0, 0, - 0, 0, is.z, 0, - 0, 0, 0, 1) * m; -#elif defined(HD_HAS_INSTANCE_scale) - vec3 is = 1.0/HdGetInstance_scale(level, /*default=*/vec3(1)); // inverse scale - m = MAT4(is.x, 0, 0, 0, - 0, is.y, 0, 0, - 0, 0, is.z, 0, - 0, 0, 0, 1) * m; -#endif - return m; -} - -// --------------------------------------------------------------------------- - -MAT4 GetInstanceTransform() -{ - MAT4 m = MAT4(1); -#ifdef HD_INSTANCER_NUM_LEVELS - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - m = GetInstanceTransform(i) * m; -#ifdef HD_HAS_instancerTransform - m = HdGet_instancerTransform(i) * m; -#endif - } -#endif - return m; -} - -MAT4 GetInstanceTransformInverse() -{ - MAT4 m = MAT4(1); -#ifdef HD_INSTANCER_NUM_LEVELS - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - m = m * GetInstanceTransformInverse(i); -#ifdef HD_HAS_instancerTransformInverse - m = m * HdGet_instancerTransformInverse(i); -#endif - } -#endif - return m; -} - -// --------------------------------------------------------------------------- - -MAT4 ApplyInstanceTransform(MAT4 m) -{ - return GetInstanceTransform() * m; -} - -MAT4 ApplyInstanceTransformInverse(MAT4 m) -{ - return m * GetInstanceTransformInverse(); -} - -bool IsFlipped() -{ -#if defined(HD_HAS_isFlipped) - bool flip = (HdGet_isFlipped() != 0); -#elif defined(HD_HAS_transform) - // The sign of the determinant indicates whether m flips handedness - bool flip = (determinant(HdGet_transform()) < 0.0); -#else - bool flip = false; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceScales - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - vec3 scale = HdGetInstance_hydra_instanceScales(i, /*default=*/vec3(1)); - flip = flip != ((sign(scale.x) * sign(scale.y) * sign(scale.z)) < 0); - } -#elif defined(HD_HAS_INSTANCE_scale) - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - vec3 scale = HdGetInstance_scale(i, /*default=*/vec3(1)); - flip = flip != ((sign(scale.x) * sign(scale.y) * sign(scale.z)) < 0); - } -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceTransforms - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - MAT4 m = HdGetInstance_hydra_instanceTransforms(i, MAT4(1)); - flip = flip != (determinant(m) < 0.0); - } -#elif defined(HD_HAS_INSTANCE_instanceTransform) - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - MAT4 m = HdGetInstance_instanceTransform(i, MAT4(1)); - flip = flip != (determinant(m) < 0.0); - } -#endif - - return flip; -} - - -vec3 GetNormal(vec3 Neye, int index) -{ - return Neye; -} - -vec3 GetNormal(vec3 Neye, int index, vec2 localST) -{ - return GetNormal(Neye, index); -} - - - -vec3 GetShadingNormal(vec3 N, bool isFlipped) -{ - // the fragment shader takes already-flipped-normals. - // no need to flip here. - return N; -} - - - -void DiscardBasedOnShading(bool frontFacing, bool isFlipped) -{ - // Nothing to do since h/w face culling is used. -} - - - -vec4 ApplyEdgeColor(vec4 Cfill, vec4 patchCoord) -{ - return Cfill; -} - -// Return a large value, signifying that the fragment isn't near an edge. -float GetMinEdgeDistance() -{ - return 1000.0; -} - - - -vec3 GetEdgeParamTriangle() -{ - // Expand barycentric coordinates - vec2 param = GetPatchCoord(0).xy; - vec3 barycentric = vec3(param.x, param.y, 1 - param.x - param.y); - - // Match triangle edge order - return barycentric.yzx; -} - -vec3 GetEdgeDistanceTriangle() -{ - vec3 param = GetEdgeParamTriangle(); - return max(vec3(0.0), param / fwidth(param)); -} - -vec4 GetEdgeParamQuad() -{ - // Expand coordinates to opposite corners of quad - vec2 leftBottom = GetPatchCoord(0).xy; - vec2 rightTop = vec2(1.0) - leftBottom; - - // Match quad edge order - return vec4(leftBottom.y, rightTop.x, rightTop.y, leftBottom.x); -} - -vec4 GetEdgeDistanceQuad() -{ - vec4 param = GetEdgeParamQuad(); - return max(vec4(0.0), param / fwidth(param)); -} - - - -struct ReprStyle -{ - vec4 color; - bool usePrimvarColor; - bool usePrimvarAlpha; - bool applyColorOverride; - bool useSurfaceShaderColor; - bool useSurfaceShaderAlpha; -}; - -struct ScalarOverride -{ - bool enabled; - vec3 color; -}; - -FORWARD_DECL(ReprStyle GetReprStyle()); -FORWARD_DECL(ScalarOverride GetScalarOverride()); -FORWARD_DECL( - vec4 surfaceShader(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord)); -FORWARD_DECL(vec4 postSurfaceShader(vec4 Peye, vec3 Neye, vec4 color)); - -vec4 ShadingTerminal(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) -{ - ReprStyle reprStyle = GetReprStyle(); - - // Apply scalar override. - ScalarOverride scalarOverride = GetScalarOverride(); - if (scalarOverride.enabled) { - vec4 result; - - result.rgb = scalarOverride.color; - result.a = reprStyle.usePrimvarAlpha ? color.a: reprStyle.color.a; - - vec4 colorOverride = ApplyColorOverrides(result); - result = reprStyle.applyColorOverride ? colorOverride : result; - - return result; - } - - // Draw mode can override face color - vec4 reprColor; - - reprColor.rgb = reprStyle.usePrimvarColor ? color.rgb : reprStyle.color.rgb; - reprColor.a = reprStyle.usePrimvarAlpha ? color.a : reprStyle.color.a; - - // Compute color overrides - vec4 colorOverride = ApplyColorOverrides(reprColor); - reprColor = reprStyle.applyColorOverride ? colorOverride : reprColor; - - - // Surface shading can be expensive and also can contain undesirable - // side effects (like discards). So only run it for reprs that require it. - - if (reprStyle.useSurfaceShaderColor || - reprStyle.useSurfaceShaderAlpha) { - vec4 shadingColor; - - shadingColor = surfaceShader(Peye, - Neye, - reprColor, - patchCoord); - -#ifdef HD_HAS_postSurfaceShader - shadingColor = postSurfaceShader(Peye, - Neye, - shadingColor); -#endif - - reprColor.rgb = reprStyle.useSurfaceShaderColor ? - shadingColor.rgb : - reprColor.rgb; - - reprColor.a = reprStyle.useSurfaceShaderAlpha ? - shadingColor.a : - reprColor.a; - } - - vec4 baseColor = color; - baseColor = ApplyColorOverrides(baseColor); - - vec4 litColor = mix(baseColor, - reprColor, - GetLightingBlendAmount()); - - // Final overrides. - - return ApplyColorOverridesPostLighting(litColor); -} - - - -#ifdef HD_HAS_integrateLights -#ifndef HD_HAS_definedIntegrateLights -#define HD_HAS_definedIntegrateLights - -LightingContribution -integrateLights(vec4 Peye, vec3 Neye, LightingInterfaceProperties props) -{ - return integrateLightsDefault(Peye, Neye, props); -} - -#endif // HD_HAS_definedIntegrateLights -#endif - -ReprStyle GetReprStyle() -{ - ReprStyle reprStyle; - - reprStyle.color = vec4(0.0, 0.0, 0.0, 1.0); - reprStyle.usePrimvarColor = true; - reprStyle.usePrimvarAlpha = true; - reprStyle.applyColorOverride = true; - reprStyle.useSurfaceShaderColor = true; - reprStyle.useSurfaceShaderAlpha = true; - - return reprStyle; -} - - - -ScalarOverride GetScalarOverride() -{ - ScalarOverride result; - -#if defined(HD_HAS_scalarOverride) - result.enabled = true; - - // Allow a scalar value to override the color from the surface - // for previewing heatmaps. This is useful for editing workflows. -#if defined(HD_HAS_scalarOverrideColorRamp) - int rampCount = constantPrimvars[GetDrawingCoord().constantCoord]. - scalarOverrideColorRamp.length(); - float scalar = HdGet_scalarOverride() * float(rampCount - 1); - float baseIndex = floor(scalar); - float nextIndex = min(float(rampCount - 1), baseIndex + 1.0); - float interp = scalar - baseIndex; - result.color = mix(HdGet_scalarOverrideColorRamp(int(baseIndex)).rgb, - HdGet_scalarOverrideColorRamp(int(nextIndex)).rgb, - interp); -#else - // If no ramp is given just gamma correct the scalar as greyscale. - result.color = vec3(pow(HdGet_scalarOverride(), 2.2)); -#endif // HD_HAS_scalarOverrideColorRamp - -#else // HD_HAS_scalarOverride - result.enabled = false; - result.color = vec3(0.0, 0.0, 0.0); -#endif - - return result; -} - - - -// Determines whether a fragment is on or close to an unhidden triangle edge. -const float edgePickRadius = 2; // in viewport pixels -const float edgePickParametricRadius = 0.02; // in parametric space - -// For smooth looking edges, use an exponential falloff for the opacity. -// Note: We use a slower falloff fn than in meshWire.glslfx to make the -// selected edges stand out. -float SelectedEdgeFalloff(float d) { - return exp2(-1 * d * d); -} - - - -FORWARD_DECL(vec3 GetEdgeDistanceTriangle()); - -vec3 ComputeBaseFaceEdgeDistanceTriangle() -{ - return GetEdgeDistanceTriangle(); -} - -bool SelectWireframeFaceEdges() -{ - return false; -} - - - -float GetSelectedEdgeOpacity() -{ - float closestEdgeDistance = 0.0; - - // The sequence of comparisons should match GetPrimitiveEdgeId() - vec3 dist = ComputeBaseFaceEdgeDistanceTriangle(); - if (dist.x < edgePickRadius) { - closestEdgeDistance = dist.x; - } else if (dist.y < edgePickRadius) { - closestEdgeDistance = dist.y; - } else if (dist.z < edgePickRadius) { - closestEdgeDistance = dist.z; - } else { - return 0; - } - - return SelectedEdgeFalloff(closestEdgeDistance); -} - -// called from hdx/renderPass.glslfx and selection.glslfx -int GetPrimitiveEdgeId() -{ - // 2 (0,1,0) - // ^ - // e2 / \ e1 - // / \' - // (0,0,1) 0 ----- 1 (1,0,0) - // e0 - - int edgeId = -1; - - vec3 dist = ComputeBaseFaceEdgeDistanceTriangle(); - if (dist.x < edgePickRadius) { - edgeId = 0; - } else if (dist.y < edgePickRadius) { - edgeId = 1; - } else if (dist.z < edgePickRadius) { - edgeId = 2; - } else { - return -1; // Not on a mesh edge - } - - const int edgeFlag = GetEdgeFlag(); - const int meshEdgeIndex = HdGetScalar_edgeIndices(); - - // Translate face-edge to authored mesh-edge - if (edgeFlag == 0) { - edgeId = meshEdgeIndex + edgeId; // regular triangle face. - } else if ((bool(edgeFlag & 1) && edgeId == 2) || - (bool(edgeFlag & 2) && edgeId == 0)) { - edgeId = -1; // Not an authored mesh edge - } else { - edgeId = meshEdgeIndex + edgeId - 1; - } - return edgeId; -} - - - -int GetPointId() -{ - return -1; -} - - -void DiscardBasedOnTopologicalVisibility() -{ - // Nothing to do, since there's no authored opinion. -} - - - -vec4 GetInterpolatedPatchCoord() -{ - return gsPatchCoord; -} - - - -#ifndef HD_HAS_ptexFaceOffset -#define HD_HAS_ptexFaceOffset -int HdGet_ptexFaceOffset() -{ - return 0; -} -#endif - -vec4 GetPatchCoord(int localIndex) -{ - vec4 patchCoord = GetInterpolatedPatchCoord(); - return vec4(patchCoord.xyz, patchCoord.w + HdGet_ptexFaceOffset()); -} - -vec4 GetPatchCoord() -{ - return GetPatchCoord(0); -} - -vec3 ComputeScreenSpacePeye() -{ - return inData.Peye.xyz / inData.Peye.w; -} - -vec3 ComputeScreenSpaceNeye() -{ - vec3 Peye = ComputeScreenSpacePeye(); - vec3 Neye = normalize(cross(dFdx(Peye), dFdy(Peye))); - return (gl_FrontFacing ? Neye : -Neye); -} - -void main(void) -{ - bool isFlipped = IsFlipped(); - - DiscardBasedOnShading(gl_FrontFacing, isFlipped); - - DiscardBasedOnTopologicalVisibility(); - - vec4 color = vec4(0.5, 0.5, 0.5, 1); -#ifdef HD_HAS_displayColor - color.rgb = HdGet_displayColor().rgb; -#endif -#ifdef HD_HAS_displayOpacity - color.a = HdGet_displayOpacity(); -#endif - - vec3 Peye = ComputeScreenSpacePeye(); - - vec3 Neye = inData.Neye; - // Normalize Neye after rasterizer interpolation. - if (length(Neye) > 0.0) { - Neye = normalize(Neye); - } - // Give the shader key a chance to override the normal. - Neye = GetNormal(Neye, 0); - // Orient the normal for shading. - Neye = GetShadingNormal(Neye, isFlipped); - - vec4 patchCoord = GetPatchCoord(); - color = ShadingTerminal(vec4(Peye, 1), Neye, color, patchCoord); - - color = ApplyEdgeColor(color, patchCoord); - -#ifdef HD_MATERIAL_TAG_MASKED - if (ShouldDiscardByAlpha(color)) { - discard; - return; - } -#endif - - RenderOutput(vec4(Peye, 1), Neye, color, patchCoord); -} - -------------------------------------------------------- --- glslfx version 0.1 -#import $TOOLS/hdSt/shaders/mesh.glslfx --- configuration -{"techniques": {"default": { -"vertexShader" : { "source" : ["Instancing.Transform", "MeshNormal.Pass", "PointId.Vertex.None", "Mesh.Vertex"] } -, "geometryShader" : { "source" : ["Instancing.Transform", "MeshNormal.Flat", "MeshNormal.Geometry.NoFlat", "Geometry.NoCustomDisplacement", "Mesh.Geometry.Quad"] } -, "fragmentShader" : { "source" : ["Instancing.Transform", "MeshNormal.Pass", "MeshNormal.Fragment.SingleSided", "MeshFaceCull.Fragment.None", "MeshWire.Fragment.NoEdge", "MeshWire.Fragment.EdgeParam", "Fragment.CommonTerminals", "Fragment.Surface", "Fragment.ScalarOverride", "EdgeId.Fragment.Common", "EdgeId.Fragment.QuadSurface", "EdgeId.Fragment.QuadParam", "PointId.Fragment.Fallback", "Visibility.Fragment.Fallback", "Mesh.Fragment.PatchCoord", "Mesh.Fragment"] } -}}} -------------------------------------------------------- -======================================================= - VERTEX SHADER -======================================================= -#version 450 -#extension GL_NV_shader_buffer_load : require -#extension GL_NV_gpu_shader5 : require -#extension GL_ARB_bindless_texture : require -#extension GL_ARB_shader_draw_parameters : require -int HgiGetBaseVertex() { - return gl_BaseVertexARB; -} -#define REF(space,type) inout type -#define FORWARD_DECL(func_decl) func_decl; -#define ATOMIC_LOAD(a) (a) -#define ATOMIC_STORE(a, v) (a) = (v) -#define ATOMIC_ADD(a, v) atomicAdd(a, v) -#define ATOMIC_EXCHANGE(a, v) atomicExchange(a, v) -#define ATOMIC_COMP_SWAP(a, expected, desired) atomicCompSwap(a, expected, desired) -#define atomic_int int -#define atomic_uint uint - -#define HGI_HAS_DOUBLE_TYPE 1 - - -struct hgi_ivec3 { int x, y, z; }; -struct hgi_vec3 { float x, y, z; }; -struct hgi_dvec3 { double x, y, z; }; -struct hgi_mat3 { float m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; -struct hgi_dmat3 { double m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; - - -// //////// Codegen Defines //////// -#define HD_SHADER_API 2 -#define MAT4 mat4 -// Alias hgi vec and matrix types to hd. -#define hd_ivec3 hgi_ivec3 -#define hd_vec3 hgi_vec3 -#define hd_dvec3 hgi_dvec3 -#define hd_mat3 hgi_mat3 -#define hd_dmat3 hgi_dmat3 - -ivec3 hd_ivec3_get(hd_ivec3 v) { return ivec3(v.x, v.y, v.z); } -ivec3 hd_ivec3_get(ivec3 v) { return v; } -vec3 hd_vec3_get(hd_vec3 v) { return vec3(v.x, v.y, v.z); } -vec3 hd_vec3_get(vec3 v) { return v; } -dvec3 hd_dvec3_get(hd_dvec3 v) { return dvec3(v.x, v.y, v.z); } -dvec3 hd_dvec3_get(dvec3 v) { return v; } -mat3 hd_mat3_get(hd_mat3 v) { return mat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -mat3 hd_mat3_get(mat3 v) { return v; } -dmat3 hd_dmat3_get(hd_dmat3 v) { return dmat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -dmat3 hd_dmat3_get(dmat3 v) { return v; } -hd_ivec3 hd_ivec3_set(hd_ivec3 v) { return v; } -hd_ivec3 hd_ivec3_set(ivec3 v) { return hd_ivec3(v.x, v.y, v.z); } -hd_vec3 hd_vec3_set(hd_vec3 v) { return v; } -hd_vec3 hd_vec3_set(vec3 v) { return hd_vec3(v.x, v.y, v.z); } -hd_dvec3 hd_dvec3_set(hd_dvec3 v) { return v; } -hd_dvec3 hd_dvec3_set(dvec3 v) { return hd_dvec3(v.x, v.y, v.z); } -hd_mat3 hd_mat3_set(hd_mat3 v) { return v; } -hd_mat3 hd_mat3_set(mat3 v) { return hd_mat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -hd_dmat3 hd_dmat3_set(hd_dmat3 v) { return v; } -hd_dmat3 hd_dmat3_set(dmat3 v) { return hd_dmat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -int hd_int_get(int v) { return v; } -int hd_int_get(ivec2 v) { return v.x; } -int hd_int_get(ivec3 v) { return v.x; } -int hd_int_get(ivec4 v) { return v.x; } -vec3 hd_sample_udim(vec2 v) { -vec2 vf = floor(v); -return vec3(v.x - vf.x, v.y - vf.y, clamp(vf.x, 0.0, 10.0) + 10.0 * vf.y); -} -vec4 hd_vec4_2_10_10_10_get(int v) { - ivec4 unpacked = ivec4((v & 0x3ff) << 22, (v & 0xffc00) << 12, - (v & 0x3ff00000) << 2, (v & 0xc0000000)); - return vec4(unpacked) / 2147483647.0; } -int hd_vec4_2_10_10_10_set(vec4 v) { - return ( (int(v.x * 511.0) & 0x3ff) | - ((int(v.y * 511.0) & 0x3ff) << 10) | - ((int(v.z * 511.0) & 0x3ff) << 20) | - ((int(v.w) & 0x1) << 30)); } -vec2 hd_half2_get(uint v) { - return unpackHalf2x16(v); } -uint hd_half2_set(vec2 v) { - return packHalf2x16(v); } -vec4 hd_half4_get(uvec2 v) { - return vec4(unpackHalf2x16(v.x), unpackHalf2x16(v.y)); } -uvec2 hd_half4_set(vec4 v) { - return uvec2(packHalf2x16(v.xy), packHalf2x16(v.zw)); } -#define HD_NUM_PRIMITIVE_VERTS 4 -#define HD_HAS_transform 1 -#define HD_HAS_transformInverse 1 -#define HD_HAS_color 1 -#define HD_HAS_primID 1 -#define HD_HAS_widths 1 -#define HD_HAS_INSTANCE_hydra_instanceTranslations 1 -#define HD_HAS_hydra_instanceTranslations_0 1 -#define HD_INSTANCER_NUM_LEVELS 1 -#define HD_INSTANCE_INDEX_WIDTH 2 -#define HD_HAS_faceVisibility 1 -#define HD_HAS_dispTextureCoord 1 -#define HD_HAS_points 1 -#define HD_HAS_normals 1 - - -// //////// Global Includes //////// - -// //////// Global Macros //////// - -// //////// Global Structs //////// - -// //////// Global Member Declarations //////// -uint hd_VertexID = gl_VertexID; -uint hd_InstanceID = gl_InstanceID; -uint hd_BaseInstance = 0; - -// //////// Global Function Definitions //////// - - -// //////// Codegen Decl //////// -struct hd_drawingCoord { - int modelCoord; - int constantCoord; - int elementCoord; - int primitiveCoord; - int fvarCoord; - int shaderCoord; - int vertexCoord; - int topologyVisibilityCoord; - int varyingCoord; - int instanceIndex[HD_INSTANCE_INDEX_WIDTH]; - int instanceCoords[HD_INSTANCE_INDEX_WIDTH]; -}; -FORWARD_DECL(hd_drawingCoord GetDrawingCoord()); -FORWARD_DECL(int HgiGetBaseVertex()); -struct hd_instanceIndex { int indices[HD_INSTANCE_INDEX_WIDTH]; }; -struct ConstantData10 { - mat4 transform; - mat4 transformInverse; - vec4 color; - vec4 primID; - float widths; -}; -FORWARD_DECL(int GetElementID()); -FORWARD_DECL(int GetAggregatedElementID()); -FORWARD_DECL(int GetPrimitiveEdgeId()); -FORWARD_DECL(float GetSelectedEdgeOpacity()); -out flat ivec4 vs_interstageDrawingCoord0; -out flat ivec4 vs_interstageDrawingCoord1; -out flat ivec4 vs_interstageDrawingCoord2; -out flat ivec4 vs_interstageDrawingCoord3; -layout (location = 2) in ivec4 drawingCoord0; -layout (location = 3) in ivec4 drawingCoord1; -layout (location = 4) in ivec2 drawingCoord2; -layout (location = 5) in int drawingCoordI0; -layout (location = 0) in vec3 points; -layout (location = 1) in vec3 normals; -layout(location = 6) uniform int *instanceIndices; -layout(location = 7) uniform int *culledInstanceIndices; -layout(location = 0) uniform ConstantData10 *constantPrimvars; -layout(location = 1) uniform hd_vec3 *hydra_instanceTranslations_0; -layout(location = 2) uniform int *primitiveParam; -layout(location = 3) uniform ivec2 *edgeIndices; -layout(location = 4) uniform float *faceVisibility; -out VertexData { - vec4 Peye; - vec3 Neye; -} outData; -out PrimvarData { - vec3 points; - vec3 normals; -} outPrimvars; - -// //////// Codegen Accessors //////// -mat4 HdGet_transform(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transform); -} -mat4 HdGet_transform() { return HdGet_transform(0); } -mat4 HdGet_transformInverse(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transformInverse); -} -mat4 HdGet_transformInverse() { return HdGet_transformInverse(0); } -vec4 HdGet_color(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].color); -} -vec4 HdGet_color() { return HdGet_color(0); } -float HdGetScalar_color(int localIndex) { return HdGet_color(localIndex).x; } -float HdGetScalar_color() { return HdGet_color(0).x; } -vec4 HdGet_primID(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].primID); -} -vec4 HdGet_primID() { return HdGet_primID(0); } -float HdGetScalar_primID(int localIndex) { return HdGet_primID(localIndex).x; } -float HdGetScalar_primID() { return HdGet_primID(0).x; } -float HdGet_widths(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return float(constantPrimvars[index].widths); -} -float HdGet_widths() { return HdGet_widths(0); } -float HdGetScalar_widths(int localIndex) { return HdGet_widths(localIndex); } -float HdGetScalar_widths() { return HdGet_widths(0); } -vec3 HdGet_hydra_instanceTranslations_0(int localIndex) { - int index = GetDrawingCoord().instanceCoords[0]; - return hd_vec3_get(hydra_instanceTranslations_0[index]); -} -vec3 HdGet_hydra_instanceTranslations_0() { return HdGet_hydra_instanceTranslations_0(0); } -float HdGetScalar_hydra_instanceTranslations_0(int localIndex) { return HdGet_hydra_instanceTranslations_0(localIndex).x; } -float HdGetScalar_hydra_instanceTranslations_0() { return HdGet_hydra_instanceTranslations_0(0).x; } -vec3 HdGetInstance_hydra_instanceTranslations(int level, vec3 defaultValue) { - if (level == 0) return HdGet_hydra_instanceTranslations_0(); - return defaultValue; -} -#if !defined(HD_HAS_hydra_instanceTranslations) -#define HD_HAS_hydra_instanceTranslations 1 -vec3 HdGet_hydra_instanceTranslations(int localIndex) { - return HdGet_hydra_instanceTranslations_0(); -} -vec3 HdGet_hydra_instanceTranslations() { return HdGet_hydra_instanceTranslations(0); } -#endif - -// //////// Codegen VS Source //////// -#define HD_BINDLESS_BUFFERS_ENABLED -int GetBaseInstanceIndexCoord() { - return drawingCoord1.y; -} -int GetCurrentInstance() { - return int(hd_InstanceID - hd_BaseInstance); -} -int GetInstanceIndexCoord() { - return GetBaseInstanceIndexCoord() + GetCurrentInstance() * HD_INSTANCE_INDEX_WIDTH; -} -int HdGet_culledInstanceIndices(int localIndex) { - int index = GetInstanceIndexCoord()+localIndex + 1; - return int(culledInstanceIndices[index]); -} -int HdGet_culledInstanceIndices() { return HdGet_culledInstanceIndices(0); } -int HdGetScalar_culledInstanceIndices(int localIndex) { return HdGet_culledInstanceIndices(localIndex); } -int HdGetScalar_culledInstanceIndices() { return HdGet_culledInstanceIndices(0); } -int GetBaseVertexOffset() { - return HgiGetBaseVertex(); -} -hd_instanceIndex GetInstanceIndex() { - hd_instanceIndex r; - for (int i = 0; i < HD_INSTANCE_INDEX_WIDTH; ++i) - r.indices[i] = HdGet_culledInstanceIndices(/*localIndex=*/i); - return r; -} -hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = drawingCoord0.x; - dc.constantCoord = drawingCoord0.y; - dc.elementCoord = drawingCoord0.z; - dc.primitiveCoord = drawingCoord0.w; - dc.fvarCoord = drawingCoord1.x; - dc.shaderCoord = drawingCoord1.z; - dc.vertexCoord = drawingCoord1.w; - dc.topologyVisibilityCoord = drawingCoord2.x; - dc.varyingCoord = drawingCoord2.y; - hd_instanceIndex r = GetInstanceIndex(); - dc.instanceIndex[0] = r.indices[0]; - dc.instanceIndex[1] = r.indices[1]; - dc.instanceCoords[0] = drawingCoordI0 + dc.instanceIndex[1]; - return dc; -} -vec3 HdGet_points(int localIndex) { return hd_vec3_get(points);} -vec3 HdGet_points() { return HdGet_points(0); } -float HdGetScalar_points(int localIndex) { return HdGet_points(localIndex).x; } -float HdGetScalar_points() { return HdGet_points(0).x; } -vec3 HdGet_normals(int localIndex) { return hd_vec3_get(normals);} -vec3 HdGet_normals() { return HdGet_normals(0); } -float HdGetScalar_normals(int localIndex) { return HdGet_normals(localIndex).x; } -float HdGetScalar_normals() { return HdGet_normals(0).x; } - -// //////// Codegen Proc VS //////// -void ProcessPrimvarsIn() { - hd_drawingCoord dc = GetDrawingCoord(); - vs_interstageDrawingCoord0[0] = dc.modelCoord; - vs_interstageDrawingCoord0[1] = dc.constantCoord; - vs_interstageDrawingCoord0[2] = dc.elementCoord; - vs_interstageDrawingCoord0[3] = dc.primitiveCoord; - vs_interstageDrawingCoord1[0] = dc.fvarCoord; - vs_interstageDrawingCoord1[1] = dc.shaderCoord; - vs_interstageDrawingCoord1[2] = dc.vertexCoord; - vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; - vs_interstageDrawingCoord2[0] = dc.varyingCoord; - vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; - vs_interstageDrawingCoord2[2] = dc.instanceIndex[1]; - vs_interstageDrawingCoord2[3] = dc.instanceCoords[0]; - outPrimvars.points = points; - outPrimvars.normals = normals; -} - -// --------------------------------------------------------------------------- -// global defines -// --------------------------------------------------------------------------- -// codeGen can override this range (currently not). -// quadro 4000's max is 189. -#ifndef HD_GL_POINT_SIZE_MAX -#define HD_GL_POINT_SIZE_MAX 100.0 -#endif -#ifndef HD_GL_POINT_SIZE_MIN -#define HD_GL_POINT_SIZE_MIN .45 -#endif - -// --------------------------------------------------------------------------- -// render pass states -// --------------------------------------------------------------------------- - -MAT4 GetWorldToViewMatrix() { -#if defined(HD_HAS_worldToViewMatrix) - return MAT4(HdGet_worldToViewMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetWorldToViewInverseMatrix() { -#if defined(HD_HAS_worldToViewInverseMatrix) - return MAT4(HdGet_worldToViewInverseMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetProjectionMatrix() { -#if defined(HD_HAS_projectionMatrix) - return MAT4(HdGet_projectionMatrix()); -#else - return MAT4(1); -#endif -} -vec3 GetPositionInWorldSpace(vec3 windowRelativeCoord) -{ -#if defined(HD_HAS_imageToWorldMatrix) - vec4 pImage = vec4(windowRelativeCoord, 1.0); - vec4 pWorld = vec4(HdGet_imageToWorldMatrix() * pImage); - return (pWorld / pWorld.w).xyz; -#else - return windowRelativeCoord; -#endif -} -float GetLightingBlendAmount() { -#if defined(HD_HAS_lightingBlendAmount) - return HdGet_lightingBlendAmount(); -#else - return 1; -#endif -} -vec4 GetViewport() { -#if defined(HD_HAS_viewport) - return HdGet_viewport(); -#else - return vec4(0,0,1,1); -#endif -} -float GetTessLevel() { -#if defined(HD_HAS_tessLevel) - return HdGet_tessLevel(); -#else - return 1; -#endif -} -float GetPointSize() { -#if defined(HD_HAS_pointSize) - return HdGet_pointSize(); -#else - return 3.0; -#endif -} -float GetPointSelectedSize() { -#if defined(HD_HAS_pointSelectedSize) - return HdGet_pointSelectedSize(); -#else - return 5.0; -#endif -} -vec4 GetWireframeColor() { -// Individual prims can specify an alternative wireframe color -// to one specified in the render pass. This is used in cases were -// there is not enough contrast with the normal one. -#if defined(HD_HAS_overrideWireframeColor) - return HdGet_overrideWireframeColor(); -#elif defined(HD_HAS_wireframeColor) - return HdGet_wireframeColor(); -#else - return vec4(0,0,0,0); -#endif -} -vec4 GetMaskColor() { -#if defined(HD_HAS_maskColor) - return HdGet_maskColor(); -#else - return vec4(0.5,0,0,1); -#endif -} -vec4 GetIndicatorColor() { -#if defined(HD_HAS_indicatorColor) - return HdGet_indicatorColor(); -#else - return vec4(0,0.5,0,1); -#endif -} - -bool ShouldDiscardByAlpha(vec4 color) -{ -#if defined(HD_HAS_alphaThreshold) - float alphaThreshold = HdGet_alphaThreshold(); -#else - float alphaThreshold = 0; -#endif - return (color.a < alphaThreshold); -} - -vec2 ApplyAxisAlignedAffineTransform(vec4 t, vec2 pt) -{ - return t.xy * pt + t.zw; -} - - - -void ApplyClipPlanes(vec4 Peye) -{ -#if defined(HD_HAS_numClipPlanes) -#if defined(HD_HAS_clipPlanes) - for (int i=0; i> 2); -} -int GetAggregatedElementID() { - return GetElementID() - + GetDrawingCoord().elementCoord; -} -ivec2 HdGet_edgeIndices(int localIndex) { - int index = GetPrimitiveIndex(); - return ivec2(edgeIndices[index]); -} -ivec2 HdGet_edgeIndices() { return HdGet_edgeIndices(0); } -int HdGetScalar_edgeIndices(int localIndex) { return HdGet_edgeIndices(localIndex).x; } -int HdGetScalar_edgeIndices() { return HdGet_edgeIndices(0).x; } -int GetAuthoredEdgeId(int primitiveEdgeId) { - return primitiveEdgeId; -} -float HdGet_faceVisibility(int localIndex) { - int index = GetAggregatedElementID(); - return float(faceVisibility[index]); -} -float HdGet_faceVisibility() { return HdGet_faceVisibility(0); } -float HdGetScalar_faceVisibility(int localIndex) { return HdGet_faceVisibility(localIndex); } -float HdGetScalar_faceVisibility() { return HdGet_faceVisibility(0); } -vec3 HdGet_points(int localIndex) { - int index = localIndex; - return vec3(inPrimvars[index].points); -} -vec3 HdGet_points() { return HdGet_points(0); } -float HdGetScalar_points(int localIndex) { return HdGet_points(localIndex).x; } -float HdGetScalar_points() { return HdGet_points(0).x; } -vec3 HdGet_normals(int localIndex) { - int index = localIndex; - return vec3(inPrimvars[index].normals); -} -vec3 HdGet_normals() { return HdGet_normals(0); } -float HdGetScalar_normals(int localIndex) { return HdGet_normals(localIndex).x; } -float HdGetScalar_normals() { return HdGet_normals(0).x; } -vec2 HdGet_dispTextureCoord_Coarse(int localIndex) { - int fvarIndex = GetFVarIndex(localIndex); - return vec2(dispTextureCoord[fvarIndex]); -} -vec2 HdGet_dispTextureCoord(int localIndex, vec2 st) { - return mix(mix(HdGet_dispTextureCoord_Coarse(0),HdGet_dispTextureCoord_Coarse(1), st.x),mix(HdGet_dispTextureCoord_Coarse(3),HdGet_dispTextureCoord_Coarse(2), st.x), st.y); -} -FORWARD_DECL(vec4 GetPatchCoord(int index)); -FORWARD_DECL(vec2 GetPatchCoordLocalST()); -vec2 HdGet_dispTextureCoord(int localIndex) { - vec2 localST = GetPatchCoord(localIndex).xy; - return HdGet_dispTextureCoord(localIndex, localST); -} -vec2 HdGet_dispTextureCoord() { return HdGet_dispTextureCoord(0); } -FORWARD_DECL(vec4 GetPatchCoord(int localIndex)); -void ProcessSamplingTransforms(MAT4 instanceModelViewInverse) { -} - -// //////// Codegen Proc GS //////// -FORWARD_DECL(vec4 GetPatchCoord(int index)); -void ProcessPrimvarsOut(int index) { - vec2 localST = GetPatchCoord(index).xy; - const vec3 coords[4] = vec3[]( - vec3(1,0,0), vec3(0,1,0), vec3(0,0,1), vec3(0,1,0) - ); - hd_barycentricCoord = coords[index]; - hd_drawingCoord dc = GetDrawingCoord(); - gs_interstageDrawingCoord0[0] = dc.modelCoord; - gs_interstageDrawingCoord0[1] = dc.constantCoord; - gs_interstageDrawingCoord0[2] = dc.elementCoord; - gs_interstageDrawingCoord0[3] = dc.primitiveCoord; - gs_interstageDrawingCoord1[0] = dc.fvarCoord; - gs_interstageDrawingCoord1[1] = dc.shaderCoord; - gs_interstageDrawingCoord1[2] = dc.vertexCoord; - gs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; - gs_interstageDrawingCoord2[0] = dc.varyingCoord; - gs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; - gs_interstageDrawingCoord2[2] = dc.instanceIndex[1]; - gs_interstageDrawingCoord2[3] = dc.instanceCoords[0]; - outPrimvars.points = inPrimvars[index].points; - outPrimvars.normals = inPrimvars[index].normals; - outPrimvars.dispTextureCoord = HdGet_dispTextureCoord(index); -} - -// --------------------------------------------------------------------------- -// global defines -// --------------------------------------------------------------------------- -// codeGen can override this range (currently not). -// quadro 4000's max is 189. -#ifndef HD_GL_POINT_SIZE_MAX -#define HD_GL_POINT_SIZE_MAX 100.0 -#endif -#ifndef HD_GL_POINT_SIZE_MIN -#define HD_GL_POINT_SIZE_MIN .45 -#endif - -// --------------------------------------------------------------------------- -// render pass states -// --------------------------------------------------------------------------- - -MAT4 GetWorldToViewMatrix() { -#if defined(HD_HAS_worldToViewMatrix) - return MAT4(HdGet_worldToViewMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetWorldToViewInverseMatrix() { -#if defined(HD_HAS_worldToViewInverseMatrix) - return MAT4(HdGet_worldToViewInverseMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetProjectionMatrix() { -#if defined(HD_HAS_projectionMatrix) - return MAT4(HdGet_projectionMatrix()); -#else - return MAT4(1); -#endif -} -vec3 GetPositionInWorldSpace(vec3 windowRelativeCoord) -{ -#if defined(HD_HAS_imageToWorldMatrix) - vec4 pImage = vec4(windowRelativeCoord, 1.0); - vec4 pWorld = vec4(HdGet_imageToWorldMatrix() * pImage); - return (pWorld / pWorld.w).xyz; -#else - return windowRelativeCoord; -#endif -} -float GetLightingBlendAmount() { -#if defined(HD_HAS_lightingBlendAmount) - return HdGet_lightingBlendAmount(); -#else - return 1; -#endif -} -vec4 GetViewport() { -#if defined(HD_HAS_viewport) - return HdGet_viewport(); -#else - return vec4(0,0,1,1); -#endif -} -float GetTessLevel() { -#if defined(HD_HAS_tessLevel) - return HdGet_tessLevel(); -#else - return 1; -#endif -} -float GetPointSize() { -#if defined(HD_HAS_pointSize) - return HdGet_pointSize(); -#else - return 3.0; -#endif -} -float GetPointSelectedSize() { -#if defined(HD_HAS_pointSelectedSize) - return HdGet_pointSelectedSize(); -#else - return 5.0; -#endif -} -vec4 GetWireframeColor() { -// Individual prims can specify an alternative wireframe color -// to one specified in the render pass. This is used in cases were -// there is not enough contrast with the normal one. -#if defined(HD_HAS_overrideWireframeColor) - return HdGet_overrideWireframeColor(); -#elif defined(HD_HAS_wireframeColor) - return HdGet_wireframeColor(); -#else - return vec4(0,0,0,0); -#endif -} -vec4 GetMaskColor() { -#if defined(HD_HAS_maskColor) - return HdGet_maskColor(); -#else - return vec4(0.5,0,0,1); -#endif -} -vec4 GetIndicatorColor() { -#if defined(HD_HAS_indicatorColor) - return HdGet_indicatorColor(); -#else - return vec4(0,0.5,0,1); -#endif -} - -bool ShouldDiscardByAlpha(vec4 color) -{ -#if defined(HD_HAS_alphaThreshold) - float alphaThreshold = HdGet_alphaThreshold(); -#else - float alphaThreshold = 0; -#endif - return (color.a < alphaThreshold); -} - -vec2 ApplyAxisAlignedAffineTransform(vec4 t, vec2 pt) -{ - return t.xy * pt + t.zw; -} - - - -void ApplyClipPlanes(vec4 Peye) -{ -#if defined(HD_HAS_numClipPlanes) -#if defined(HD_HAS_clipPlanes) - for (int i=0; i 0.0) - normal = normalize(normal); - return normal; -} - -vec3 GetNormal(vec3 Neye, int index, vec2 localST) -{ - return GetNormal(Neye, index); -} - - - -vec3 GetTriGeometryNormal(vec3 Neye, vec4 Peye0, vec4 Peye1, vec4 Peye2, - bool isFlipped) -{ - return Neye; -} - -vec3 GetQuadGeometryNormal(vec3 Neye, - vec4 Peye0, vec4 Peye1, vec4 Peye2, vec4 Peye3, - bool isFlipped) -{ - return Neye; -} - - - -vec4 DisplacementTerminal(int index, vec4 Peye, vec3 Neye, vec4 patchCoord) -{ - return Peye; -} - - - -vec4 GetPatchCoord(int index) -{ - vec2 uv[4]; - uv[0] = vec2(0, 0); - uv[1] = vec2(1, 0); - uv[2] = vec2(1, 1); - uv[3] = vec2(0, 1); - - ivec3 patchParam = GetPatchParam(); - return InterpolatePatchCoord(uv[index], patchParam); -} - -void emit(int index, vec4 Peye, vec3 Neye) -{ - outData.Peye = Peye; - outData.Neye = Neye; - - gsPatchCoord = GetPatchCoord(index); - - gl_Position = vec4(GetProjectionMatrix() * outData.Peye); - ApplyClipPlanes(outData.Peye); - - ProcessPrimvarsOut(index); - - EmitVertex(); -} - -void main(void) -{ - gl_PrimitiveID = gl_PrimitiveIDIn; - - bool isFlipped = IsFlipped(); // consider handedness AND negative-scale - - vec3 Neye0 = GetNormal(inData[0].Neye, 0); - Neye0 = GetQuadGeometryNormal(Neye0, inData[0].Peye, inData[1].Peye, - inData[2].Peye, inData[3].Peye, isFlipped); - vec3 Neye1 = GetNormal(inData[1].Neye, 1); - Neye1 = GetQuadGeometryNormal(Neye1, inData[0].Peye, inData[1].Peye, - inData[2].Peye, inData[3].Peye, isFlipped); - vec3 Neye2 = GetNormal(inData[2].Neye, 2); - Neye2 = GetQuadGeometryNormal(Neye2, inData[0].Peye, inData[1].Peye, - inData[2].Peye, inData[3].Peye, isFlipped); - vec3 Neye3 = GetNormal(inData[3].Neye, 3); - Neye3 = GetQuadGeometryNormal(Neye3, inData[0].Peye, inData[1].Peye, - inData[2].Peye, inData[3].Peye, isFlipped); - - vec4 Peye0 = DisplacementTerminal( - 0, inData[0].Peye, Neye0, GetPatchCoord(0)); - vec4 Peye1 = DisplacementTerminal( - 1, inData[1].Peye, Neye1, GetPatchCoord(1)); - vec4 Peye2 = DisplacementTerminal( - 2, inData[2].Peye, Neye2, GetPatchCoord(2)); - vec4 Peye3 = DisplacementTerminal( - 3, inData[3].Peye, Neye3, GetPatchCoord(3)); - - // Generate triangles (0,1,2) and (2,3,0) - // 3---2 - // | .| - // | . | - // |. | - // 0---1 - // The indices post-quadrangulation/subdivision follow the convention: - // 0 -> original (hull) vertex - // 1,3 -> edge vertices - // 2 -> center vertex - // - // By having index 2 in both the triangles, we ensure the pre-quadrangulated - // face's normal (at the center) is part of the rasterizer interpolation, - // which matters when we use smooth/limit normals. - // In the case of flat normals, we use the vertex positions, so it doesn't - // matter. - - // triangle 0: vertices (0,1,2) - emit(0, Peye0, Neye0); - emit(1, Peye1, Neye1); - emit(2, Peye2, Neye2); - EndPrimitive(); - - // triangle 1: vertices (2,3,0) - gl_PrimitiveID = gl_PrimitiveIDIn; - emit(2, Peye2, Neye2); - emit(3, Peye3, Neye3); - emit(0, Peye0, Neye0); - EndPrimitive(); -} - - -======================================================= - FRAGMENT SHADER -======================================================= -#version 450 -#extension GL_NV_shader_buffer_load : require -#extension GL_NV_gpu_shader5 : require -#extension GL_ARB_bindless_texture : require -#define REF(space,type) inout type -#define FORWARD_DECL(func_decl) func_decl; -#define ATOMIC_LOAD(a) (a) -#define ATOMIC_STORE(a, v) (a) = (v) -#define ATOMIC_ADD(a, v) atomicAdd(a, v) -#define ATOMIC_EXCHANGE(a, v) atomicExchange(a, v) -#define ATOMIC_COMP_SWAP(a, expected, desired) atomicCompSwap(a, expected, desired) -#define atomic_int int -#define atomic_uint uint - -#define HGI_HAS_DOUBLE_TYPE 1 - - -struct hgi_ivec3 { int x, y, z; }; -struct hgi_vec3 { float x, y, z; }; -struct hgi_dvec3 { double x, y, z; }; -struct hgi_mat3 { float m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; -struct hgi_dmat3 { double m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; - - - -// //////// Global Includes //////// - -// //////// Global Macros //////// - -// //////// Global Structs //////// - -// //////// Global Member Declarations //////// - -// //////// Global Function Definitions //////// - - -// //////// Codegen Defines //////// -#define HD_SHADER_API 2 -#define MAT4 mat4 -// Alias hgi vec and matrix types to hd. -#define hd_ivec3 hgi_ivec3 -#define hd_vec3 hgi_vec3 -#define hd_dvec3 hgi_dvec3 -#define hd_mat3 hgi_mat3 -#define hd_dmat3 hgi_dmat3 - -ivec3 hd_ivec3_get(hd_ivec3 v) { return ivec3(v.x, v.y, v.z); } -ivec3 hd_ivec3_get(ivec3 v) { return v; } -vec3 hd_vec3_get(hd_vec3 v) { return vec3(v.x, v.y, v.z); } -vec3 hd_vec3_get(vec3 v) { return v; } -dvec3 hd_dvec3_get(hd_dvec3 v) { return dvec3(v.x, v.y, v.z); } -dvec3 hd_dvec3_get(dvec3 v) { return v; } -mat3 hd_mat3_get(hd_mat3 v) { return mat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -mat3 hd_mat3_get(mat3 v) { return v; } -dmat3 hd_dmat3_get(hd_dmat3 v) { return dmat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -dmat3 hd_dmat3_get(dmat3 v) { return v; } -hd_ivec3 hd_ivec3_set(hd_ivec3 v) { return v; } -hd_ivec3 hd_ivec3_set(ivec3 v) { return hd_ivec3(v.x, v.y, v.z); } -hd_vec3 hd_vec3_set(hd_vec3 v) { return v; } -hd_vec3 hd_vec3_set(vec3 v) { return hd_vec3(v.x, v.y, v.z); } -hd_dvec3 hd_dvec3_set(hd_dvec3 v) { return v; } -hd_dvec3 hd_dvec3_set(dvec3 v) { return hd_dvec3(v.x, v.y, v.z); } -hd_mat3 hd_mat3_set(hd_mat3 v) { return v; } -hd_mat3 hd_mat3_set(mat3 v) { return hd_mat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -hd_dmat3 hd_dmat3_set(hd_dmat3 v) { return v; } -hd_dmat3 hd_dmat3_set(dmat3 v) { return hd_dmat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -int hd_int_get(int v) { return v; } -int hd_int_get(ivec2 v) { return v.x; } -int hd_int_get(ivec3 v) { return v.x; } -int hd_int_get(ivec4 v) { return v.x; } -vec3 hd_sample_udim(vec2 v) { -vec2 vf = floor(v); -return vec3(v.x - vf.x, v.y - vf.y, clamp(vf.x, 0.0, 10.0) + 10.0 * vf.y); -} -vec4 hd_vec4_2_10_10_10_get(int v) { - ivec4 unpacked = ivec4((v & 0x3ff) << 22, (v & 0xffc00) << 12, - (v & 0x3ff00000) << 2, (v & 0xc0000000)); - return vec4(unpacked) / 2147483647.0; } -int hd_vec4_2_10_10_10_set(vec4 v) { - return ( (int(v.x * 511.0) & 0x3ff) | - ((int(v.y * 511.0) & 0x3ff) << 10) | - ((int(v.z * 511.0) & 0x3ff) << 20) | - ((int(v.w) & 0x1) << 30)); } -vec2 hd_half2_get(uint v) { - return unpackHalf2x16(v); } -uint hd_half2_set(vec2 v) { - return packHalf2x16(v); } -vec4 hd_half4_get(uvec2 v) { - return vec4(unpackHalf2x16(v.x), unpackHalf2x16(v.y)); } -uvec2 hd_half4_set(vec4 v) { - return uvec2(packHalf2x16(v.xy), packHalf2x16(v.zw)); } -#define HD_NUM_PRIMITIVE_VERTS 4 -#define HD_HAS_transform 1 -#define HD_HAS_transformInverse 1 -#define HD_HAS_color 1 -#define HD_HAS_primID 1 -#define HD_HAS_widths 1 -#define HD_HAS_INSTANCE_hydra_instanceTranslations 1 -#define HD_HAS_hydra_instanceTranslations_0 1 -#define HD_INSTANCER_NUM_LEVELS 1 -#define HD_INSTANCE_INDEX_WIDTH 2 -#define HD_HAS_faceVisibility 1 -#define HD_HAS_dispTextureCoord 1 -#define HD_HAS_points 1 -#define HD_HAS_normals 1 - -// //////// Codegen Decl //////// -struct hd_drawingCoord { - int modelCoord; - int constantCoord; - int elementCoord; - int primitiveCoord; - int fvarCoord; - int shaderCoord; - int vertexCoord; - int topologyVisibilityCoord; - int varyingCoord; - int instanceIndex[HD_INSTANCE_INDEX_WIDTH]; - int instanceCoords[HD_INSTANCE_INDEX_WIDTH]; -}; -FORWARD_DECL(hd_drawingCoord GetDrawingCoord()); -FORWARD_DECL(int HgiGetBaseVertex()); -struct hd_instanceIndex { int indices[HD_INSTANCE_INDEX_WIDTH]; }; -struct ConstantData10 { - mat4 transform; - mat4 transformInverse; - vec4 color; - vec4 primID; - float widths; -}; -FORWARD_DECL(int GetElementID()); -FORWARD_DECL(int GetAggregatedElementID()); -FORWARD_DECL(int GetPrimitiveEdgeId()); -FORWARD_DECL(float GetSelectedEdgeOpacity()); -layout(location = 6) uniform int *instanceIndices; -layout(location = 7) uniform int *culledInstanceIndices; -layout(location = 0) uniform ConstantData10 *constantPrimvars; -layout(location = 1) uniform hd_vec3 *hydra_instanceTranslations_0; -layout(location = 2) uniform int *primitiveParam; -layout(location = 3) uniform ivec2 *edgeIndices; -layout(location = 4) uniform float *faceVisibility; -in vec4 gsPatchCoord; -in VertexData { - vec4 Peye; - vec3 Neye; -} inData; -layout (location = 0) out vec4 colorOut; -in noperspective vec3 hd_barycentricCoord; -in flat ivec4 gs_interstageDrawingCoord0; -in flat ivec4 gs_interstageDrawingCoord1; -in flat ivec4 gs_interstageDrawingCoord2; -in flat ivec4 gs_interstageDrawingCoord3; -in PrimvarData { - vec3 points; - vec3 normals; - vec2 dispTextureCoord; -} inPrimvars; -layout(location = 5) uniform vec2 *dispTextureCoord; -vec4 InterpolatePatchCoord(vec2 uv, ivec3 patchParam) -{ - // add 0.5 to integer values for more robust interpolation - return vec4(uv.x, uv.y, 0, patchParam.x+0.5f); -} -vec4 InterpolatePatchCoordTriangle(vec2 uv, ivec3 patchParam) -{ - return InterpolatePatchCoord(uv, patchParam); -} - -// //////// Codegen Accessors //////// -mat4 HdGet_transform(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transform); -} -mat4 HdGet_transform() { return HdGet_transform(0); } -mat4 HdGet_transformInverse(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transformInverse); -} -mat4 HdGet_transformInverse() { return HdGet_transformInverse(0); } -vec4 HdGet_color(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].color); -} -vec4 HdGet_color() { return HdGet_color(0); } -float HdGetScalar_color(int localIndex) { return HdGet_color(localIndex).x; } -float HdGetScalar_color() { return HdGet_color(0).x; } -vec4 HdGet_primID(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].primID); -} -vec4 HdGet_primID() { return HdGet_primID(0); } -float HdGetScalar_primID(int localIndex) { return HdGet_primID(localIndex).x; } -float HdGetScalar_primID() { return HdGet_primID(0).x; } -float HdGet_widths(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return float(constantPrimvars[index].widths); -} -float HdGet_widths() { return HdGet_widths(0); } -float HdGetScalar_widths(int localIndex) { return HdGet_widths(localIndex); } -float HdGetScalar_widths() { return HdGet_widths(0); } -vec3 HdGet_hydra_instanceTranslations_0(int localIndex) { - int index = GetDrawingCoord().instanceCoords[0]; - return hd_vec3_get(hydra_instanceTranslations_0[index]); -} -vec3 HdGet_hydra_instanceTranslations_0() { return HdGet_hydra_instanceTranslations_0(0); } -float HdGetScalar_hydra_instanceTranslations_0(int localIndex) { return HdGet_hydra_instanceTranslations_0(localIndex).x; } -float HdGetScalar_hydra_instanceTranslations_0() { return HdGet_hydra_instanceTranslations_0(0).x; } -vec3 HdGetInstance_hydra_instanceTranslations(int level, vec3 defaultValue) { - if (level == 0) return HdGet_hydra_instanceTranslations_0(); - return defaultValue; -} -#if !defined(HD_HAS_hydra_instanceTranslations) -#define HD_HAS_hydra_instanceTranslations 1 -vec3 HdGet_hydra_instanceTranslations(int localIndex) { - return HdGet_hydra_instanceTranslations_0(); -} -vec3 HdGet_hydra_instanceTranslations() { return HdGet_hydra_instanceTranslations(0); } -#endif - -// //////// Codegen FS Source //////// -#define HD_SHADER_SUPPORTS_DOUBLE_PRECISION -#define HD_MINUS_ONE_TO_ONE_DEPTH_RANGE -vec3 GetBarycentricCoord() { - return hd_barycentricCoord; -} -int GetPrimitiveID() { - return gl_PrimitiveID; -} -int GetPrimitiveIndex() { - return GetDrawingCoord().primitiveCoord + GetPrimitiveID(); -} -hd_drawingCoord GetDrawingCoord() { - hd_drawingCoord dc; - dc.modelCoord = gs_interstageDrawingCoord0[0]; - dc.constantCoord = gs_interstageDrawingCoord0[1]; - dc.elementCoord = gs_interstageDrawingCoord0[2]; - dc.primitiveCoord = gs_interstageDrawingCoord0[3]; - dc.fvarCoord = gs_interstageDrawingCoord1[0]; - dc.shaderCoord = gs_interstageDrawingCoord1[1]; - dc.vertexCoord = gs_interstageDrawingCoord1[2]; - dc.topologyVisibilityCoord = gs_interstageDrawingCoord1[3]; - dc.varyingCoord = gs_interstageDrawingCoord2[0]; - dc.instanceIndex[0] = gs_interstageDrawingCoord2[1]; - dc.instanceIndex[1] = gs_interstageDrawingCoord2[2]; - dc.instanceCoords[0] = gs_interstageDrawingCoord2[3]; - return dc; -} -int HdGet_primitiveParam(int localIndex) { - int index = GetPrimitiveIndex(); - return int(primitiveParam[index]); -} -int HdGet_primitiveParam() { return HdGet_primitiveParam(0); } -int HdGetScalar_primitiveParam(int localIndex) { return HdGet_primitiveParam(localIndex); } -int HdGetScalar_primitiveParam() { return HdGet_primitiveParam(0); } -#if defined(HD_HAS_coarseFaceIndex) -FORWARD_DECL(int HdGetScalar_coarseFaceIndex()); -#endif -ivec3 GetPatchParam() { -#if defined(HD_HAS_coarseFaceIndex) - return ivec3(HdGetScalar_coarseFaceIndex(), 0, 0); -#else - return ivec3(GetPrimitiveID(), 0, 0); -#endif -} -int GetEdgeFlag() { - return (HdGet_primitiveParam() & 3); -} -int GetFVarIndex(int localIndex) { - int fvarCoord = GetDrawingCoord().fvarCoord; - int ptexIndex = GetPatchParam().x & 0xfffffff; - return fvarCoord + ptexIndex * 4 + localIndex; -} -int GetElementID() { - return (hd_int_get(HdGet_primitiveParam()) >> 2); -} -int GetAggregatedElementID() { - return GetElementID() - + GetDrawingCoord().elementCoord; -} -ivec2 HdGet_edgeIndices(int localIndex) { - int index = GetPrimitiveIndex(); - return ivec2(edgeIndices[index]); -} -ivec2 HdGet_edgeIndices() { return HdGet_edgeIndices(0); } -int HdGetScalar_edgeIndices(int localIndex) { return HdGet_edgeIndices(localIndex).x; } -int HdGetScalar_edgeIndices() { return HdGet_edgeIndices(0).x; } -int GetAuthoredEdgeId(int primitiveEdgeId) { - return primitiveEdgeId; -} -float HdGet_faceVisibility(int localIndex) { - int index = GetAggregatedElementID(); - return float(faceVisibility[index]); -} -float HdGet_faceVisibility() { return HdGet_faceVisibility(0); } -float HdGetScalar_faceVisibility(int localIndex) { return HdGet_faceVisibility(localIndex); } -float HdGetScalar_faceVisibility() { return HdGet_faceVisibility(0); } -vec3 HdGet_points(int localIndex) { return vec3(inPrimvars.points);} -vec3 HdGet_points() { return HdGet_points(0); } -float HdGetScalar_points(int localIndex) { return HdGet_points(localIndex).x; } -float HdGetScalar_points() { return HdGet_points(0).x; } -vec3 HdGet_normals(int localIndex) { return vec3(inPrimvars.normals);} -vec3 HdGet_normals() { return HdGet_normals(0); } -float HdGetScalar_normals(int localIndex) { return HdGet_normals(localIndex).x; } -float HdGetScalar_normals() { return HdGet_normals(0).x; } -vec2 HdGet_dispTextureCoord(int localIndex) { return vec2(inPrimvars.dispTextureCoord);} -vec2 HdGet_dispTextureCoord() { return HdGet_dispTextureCoord(0); } -float HdGetScalar_dispTextureCoord(int localIndex) { return HdGet_dispTextureCoord(localIndex).x; } -float HdGetScalar_dispTextureCoord() { return HdGet_dispTextureCoord(0).x; } -FORWARD_DECL(vec4 GetPatchCoord(int index)); -void ProcessSamplingTransforms(MAT4 instanceModelViewInverse) { -} - -// --------------------------------------------------------------------------- -// global defines -// --------------------------------------------------------------------------- -// codeGen can override this range (currently not). -// quadro 4000's max is 189. -#ifndef HD_GL_POINT_SIZE_MAX -#define HD_GL_POINT_SIZE_MAX 100.0 -#endif -#ifndef HD_GL_POINT_SIZE_MIN -#define HD_GL_POINT_SIZE_MIN .45 -#endif - -// --------------------------------------------------------------------------- -// render pass states -// --------------------------------------------------------------------------- - -MAT4 GetWorldToViewMatrix() { -#if defined(HD_HAS_worldToViewMatrix) - return MAT4(HdGet_worldToViewMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetWorldToViewInverseMatrix() { -#if defined(HD_HAS_worldToViewInverseMatrix) - return MAT4(HdGet_worldToViewInverseMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetProjectionMatrix() { -#if defined(HD_HAS_projectionMatrix) - return MAT4(HdGet_projectionMatrix()); -#else - return MAT4(1); -#endif -} -vec3 GetPositionInWorldSpace(vec3 windowRelativeCoord) -{ -#if defined(HD_HAS_imageToWorldMatrix) - vec4 pImage = vec4(windowRelativeCoord, 1.0); - vec4 pWorld = vec4(HdGet_imageToWorldMatrix() * pImage); - return (pWorld / pWorld.w).xyz; -#else - return windowRelativeCoord; -#endif -} -float GetLightingBlendAmount() { -#if defined(HD_HAS_lightingBlendAmount) - return HdGet_lightingBlendAmount(); -#else - return 1; -#endif -} -vec4 GetViewport() { -#if defined(HD_HAS_viewport) - return HdGet_viewport(); -#else - return vec4(0,0,1,1); -#endif -} -float GetTessLevel() { -#if defined(HD_HAS_tessLevel) - return HdGet_tessLevel(); -#else - return 1; -#endif -} -float GetPointSize() { -#if defined(HD_HAS_pointSize) - return HdGet_pointSize(); -#else - return 3.0; -#endif -} -float GetPointSelectedSize() { -#if defined(HD_HAS_pointSelectedSize) - return HdGet_pointSelectedSize(); -#else - return 5.0; -#endif -} -vec4 GetWireframeColor() { -// Individual prims can specify an alternative wireframe color -// to one specified in the render pass. This is used in cases were -// there is not enough contrast with the normal one. -#if defined(HD_HAS_overrideWireframeColor) - return HdGet_overrideWireframeColor(); -#elif defined(HD_HAS_wireframeColor) - return HdGet_wireframeColor(); -#else - return vec4(0,0,0,0); -#endif -} -vec4 GetMaskColor() { -#if defined(HD_HAS_maskColor) - return HdGet_maskColor(); -#else - return vec4(0.5,0,0,1); -#endif -} -vec4 GetIndicatorColor() { -#if defined(HD_HAS_indicatorColor) - return HdGet_indicatorColor(); -#else - return vec4(0,0.5,0,1); -#endif -} - -bool ShouldDiscardByAlpha(vec4 color) -{ -#if defined(HD_HAS_alphaThreshold) - float alphaThreshold = HdGet_alphaThreshold(); -#else - float alphaThreshold = 0; -#endif - return (color.a < alphaThreshold); -} - -vec2 ApplyAxisAlignedAffineTransform(vec4 t, vec2 pt) -{ - return t.xy * pt + t.zw; -} - - - -vec2 HorizontallyNormalizedFilmbackCoordinates() -{ - const vec4 transform = -#ifdef HD_HAS_imageToHorizontallyNormalizedFilmback - HdGet_imageToHorizontallyNormalizedFilmback(); -#else - vec4(vec2(1.0), vec2(0.0)); -#endif - return ApplyAxisAlignedAffineTransform(transform, gl_FragCoord.xy); -} - - - -vec4 ApplySelectionColor(vec4 color) -{ - return color; -} - - - -// Forward declare selection functionality. -// XXX: Currently, the non-empty implementation of this is in hdx. -FORWARD_DECL(vec4 ApplySelectionColor(vec4 color)); - -// XXX: Make sure to update hdx/shaders/renderPass.glslfx when editing these -// color override methods, since they're currently duplicated. This is because -// we don't have a mixin token for color overrides in a render pass yet. -vec4 ApplyColorOverrides(vec4 color) -{ -#if defined(HD_HAS_overrideColor) - // Mix in override color - vec4 overrideColor = HdGet_overrideColor(); - color.rgb = mix(color.rgb, overrideColor.rgb, overrideColor.a); -#endif - return ApplySelectionColor(color); -} - -vec3 ApplyMaskColor(vec3 color, float weight, vec4 maskColor) -{ - float strength = maskColor.a * clamp(weight, 0.0, 1.0); - return mix(color, maskColor.rgb, strength); -} - -vec4 ApplyColorOverridesPostLighting(vec4 color) -{ - #if defined(HD_HAS_maskWeight) - float maskWeight = HdGet_maskWeight(); - vec4 maskColor = GetMaskColor(); - color.rgb = ApplyMaskColor(color.rgb, maskWeight, maskColor); - #endif - #if defined(HD_HAS_indicatorWeight) - float indicatorWeight = HdGet_indicatorWeight(); - vec4 indicatorColor = GetIndicatorColor(); - color.rgb = ApplyMaskColor(color.rgb, indicatorWeight, indicatorColor); - #endif - return color; -} - - - -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) -{ - colorOut = color; -} - - -#ifndef HD_HAS_integrateLights -#define HD_HAS_integrateLights -#endif - -struct LightingContribution { - vec3 diffuse; -}; - -struct LightingInterfaceProperties { - float unused; -}; - -LightingContribution -integrateLightsDefault(vec4 Peye, vec3 Neye, LightingInterfaceProperties props) -{ - vec3 n = normalize(Neye); - - LightingContribution result; - result.diffuse = vec3(dot(n, vec3(0,0,1))); - - return result; -} - -LightingContribution -integrateLightsConstant(vec4 Peye, vec3 Neye, LightingInterfaceProperties props) -{ - LightingContribution result; - //pefectly diffuse white hemisphere contribution - result.diffuse = vec3(1); - - return result; -} - - - -FORWARD_DECL( - LightingContribution integrateLights(vec4 Peye, vec3 Neye, - LightingInterfaceProperties props)); - -vec3 FallbackLighting(in vec3 Peye, in vec3 Neye, in vec3 color) -{ - LightingInterfaceProperties props; - LightingContribution light = integrateLights(vec4(Peye, 1), Neye, props); - return color * light.diffuse; -} - - -vec4 surfaceShader(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) -{ - // lighting - color.rgb = FallbackLighting(Peye.xyz, Neye, color.rgb); - return color; -} - - -// quaternion to matrix. xyz = imaginary, w = real -MAT4 GetRotationMatrix(vec4 q) -{ - MAT4 r; - r[0].xyzw = vec4(1 - 2 * (q.y * q.y + q.z * q.z), - 2 * (q.x * q.y + q.z * q.w), - 2 * (q.x * q.z - q.y * q.w), - 0); - r[1].xyzw = vec4( 2 * (q.x * q.y - q.z * q.w), - 1 - 2 * (q.x * q.x + q.z * q.z), - 2 * (q.y * q.z + q.x * q.w), - 0); - r[2].xyzw = vec4( 2 * (q.x * q.z + q.y * q.w), - 2 * (q.y * q.z - q.x * q.w), - 1 - 2 * (q.x * q.x + q.y * q.y), - 0); - r[3] = vec4(0, 0, 0, 1); - return r; -} - -// --------------------------------------------------------------------------- - -MAT4 GetInstanceTransform(int level) -{ - MAT4 m = MAT4(1); -#ifdef HD_HAS_INSTANCE_hydra_instanceTransforms - m = HdGetInstance_hydra_instanceTransforms(level, MAT4(1)) * m; -#elif defined(HD_HAS_INSTANCE_instanceTransform) - m = HdGetInstance_instanceTransform(level, MAT4(1)) * m; -#endif - - // instance transform elements are applied: - // scale then rotate then translate - // i.e. (T * R * S) * position - -#ifdef HD_HAS_INSTANCE_hydra_instanceScales - vec3 s = HdGetInstance_hydra_instanceScales(level, /*default=*/vec3(1)); - m = MAT4(s.x, 0, 0, 0, - 0, s.y, 0, 0, - 0, 0, s.z, 0, - 0, 0, 0, 1) * m; -#elif defined(HD_HAS_INSTANCE_instanceScale) - vec3 s = HdGetInstance_scale(level, /*default=*/vec3(1)); - m = MAT4(s.x, 0, 0, 0, - 0, s.y, 0, 0, - 0, 0, s.z, 0, - 0, 0, 0, 1) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceRotations // GfQuat(ix, iy, iz, real) - vec4 q = HdGetInstance_hydra_instanceRotations(level, /*default=*/vec4(0)); - m = GetRotationMatrix(q) * m; -#elif defined(HD_HAS_INSTANCE_rotate) - vec4 q = HdGetInstance_rotate(level, /*default=*/vec4(0)); - m = GetRotationMatrix(q) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceTranslations - vec3 t = HdGetInstance_hydra_instanceTranslations(level, /*default=*/vec3(0)); - m = MAT4( 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - t.x, t.y, t.z, 1) * m; -#elif defined(HD_HAS_INSTANCE_translate) - vec3 t = HdGetInstance_translate(level, /*default=*/vec3(0)); - m = MAT4( 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - t.x, t.y, t.z, 1) * m; -#endif - return m; -} - -MAT4 GetInstanceTransformInverse(int level) -{ - MAT4 m = MAT4(1); - -#ifdef HD_HAS_INSTANCE_hydra_instanceTransforms - m = inverse(HdGetInstance_hydra_instanceTransforms(level, MAT4(1))) * m; -#elif defined(HD_HAS_INSTANCE_instanceTransform) - m = inverse(HdGetInstance_instanceTransform(level, MAT4(1))) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceTranslations - vec3 it = -HdGetInstance_hydra_instanceTranslations(level, /*default=*/vec3(0)); // negate - m = MAT4( 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - it.x, it.y, it.z, 1) * m; -#elif defined(HD_HAS_INSTANCE_translate) - vec3 it = -HdGetInstance_translate(level, /*default=*/vec3(0)); // negate - m = MAT4( 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - it.x, it.y, it.z, 1) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceRotations - vec4 q = HdGetInstance_hydra_instanceRotations(level, /*default=*/vec4(0)); - q.xyz = -q.xyz; // inverse rotataion axis - m = GetRotationMatrix(q) * m; -#elif defined(HD_HAS_INSTANCE_rotate) - vec4 q = HdGetInstance_rotate(level, /*default=*/vec4(0)); - q.xyz = -q.xyz; // inverse rotataion axis - m = GetRotationMatrix(q) * m; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceScales - vec3 is = 1.0/HdGetInstance_hydra_instanceScales(level, /*default=*/vec3(1)); // inverse scale - m = MAT4(is.x, 0, 0, 0, - 0, is.y, 0, 0, - 0, 0, is.z, 0, - 0, 0, 0, 1) * m; -#elif defined(HD_HAS_INSTANCE_scale) - vec3 is = 1.0/HdGetInstance_scale(level, /*default=*/vec3(1)); // inverse scale - m = MAT4(is.x, 0, 0, 0, - 0, is.y, 0, 0, - 0, 0, is.z, 0, - 0, 0, 0, 1) * m; -#endif - return m; -} - -// --------------------------------------------------------------------------- - -MAT4 GetInstanceTransform() -{ - MAT4 m = MAT4(1); -#ifdef HD_INSTANCER_NUM_LEVELS - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - m = GetInstanceTransform(i) * m; -#ifdef HD_HAS_instancerTransform - m = HdGet_instancerTransform(i) * m; -#endif - } -#endif - return m; -} - -MAT4 GetInstanceTransformInverse() -{ - MAT4 m = MAT4(1); -#ifdef HD_INSTANCER_NUM_LEVELS - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - m = m * GetInstanceTransformInverse(i); -#ifdef HD_HAS_instancerTransformInverse - m = m * HdGet_instancerTransformInverse(i); -#endif - } -#endif - return m; -} - -// --------------------------------------------------------------------------- - -MAT4 ApplyInstanceTransform(MAT4 m) -{ - return GetInstanceTransform() * m; -} - -MAT4 ApplyInstanceTransformInverse(MAT4 m) -{ - return m * GetInstanceTransformInverse(); -} - -bool IsFlipped() -{ -#if defined(HD_HAS_isFlipped) - bool flip = (HdGet_isFlipped() != 0); -#elif defined(HD_HAS_transform) - // The sign of the determinant indicates whether m flips handedness - bool flip = (determinant(HdGet_transform()) < 0.0); -#else - bool flip = false; -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceScales - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - vec3 scale = HdGetInstance_hydra_instanceScales(i, /*default=*/vec3(1)); - flip = flip != ((sign(scale.x) * sign(scale.y) * sign(scale.z)) < 0); - } -#elif defined(HD_HAS_INSTANCE_scale) - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - vec3 scale = HdGetInstance_scale(i, /*default=*/vec3(1)); - flip = flip != ((sign(scale.x) * sign(scale.y) * sign(scale.z)) < 0); - } -#endif - -#ifdef HD_HAS_INSTANCE_hydra_instanceTransforms - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - MAT4 m = HdGetInstance_hydra_instanceTransforms(i, MAT4(1)); - flip = flip != (determinant(m) < 0.0); - } -#elif defined(HD_HAS_INSTANCE_instanceTransform) - for (int i = 0; i < HD_INSTANCER_NUM_LEVELS; ++i) { - MAT4 m = HdGetInstance_instanceTransform(i, MAT4(1)); - flip = flip != (determinant(m) < 0.0); - } -#endif - - return flip; -} - - -vec3 GetNormal(vec3 Neye, int index) -{ - return Neye; -} - -vec3 GetNormal(vec3 Neye, int index, vec2 localST) -{ - return GetNormal(Neye, index); -} - - - -vec3 GetShadingNormal(vec3 N, bool isFlipped) -{ - // the fragment shader takes already-flipped-normals. - // no need to flip here. - return N; -} - - - -void DiscardBasedOnShading(bool frontFacing, bool isFlipped) -{ - // Nothing to do since h/w face culling is used. -} - - - -vec4 ApplyEdgeColor(vec4 Cfill, vec4 patchCoord) -{ - return Cfill; -} - -// Return a large value, signifying that the fragment isn't near an edge. -float GetMinEdgeDistance() -{ - return 1000.0; -} - - - -vec3 GetEdgeParamTriangle() -{ - // Expand barycentric coordinates - vec2 param = GetPatchCoord(0).xy; - vec3 barycentric = vec3(param.x, param.y, 1 - param.x - param.y); - - // Match triangle edge order - return barycentric.yzx; -} - -vec3 GetEdgeDistanceTriangle() -{ - vec3 param = GetEdgeParamTriangle(); - return max(vec3(0.0), param / fwidth(param)); -} - -vec4 GetEdgeParamQuad() -{ - // Expand coordinates to opposite corners of quad - vec2 leftBottom = GetPatchCoord(0).xy; - vec2 rightTop = vec2(1.0) - leftBottom; - - // Match quad edge order - return vec4(leftBottom.y, rightTop.x, rightTop.y, leftBottom.x); -} - -vec4 GetEdgeDistanceQuad() -{ - vec4 param = GetEdgeParamQuad(); - return max(vec4(0.0), param / fwidth(param)); -} - - - -struct ReprStyle -{ - vec4 color; - bool usePrimvarColor; - bool usePrimvarAlpha; - bool applyColorOverride; - bool useSurfaceShaderColor; - bool useSurfaceShaderAlpha; -}; - -struct ScalarOverride -{ - bool enabled; - vec3 color; -}; - -FORWARD_DECL(ReprStyle GetReprStyle()); -FORWARD_DECL(ScalarOverride GetScalarOverride()); -FORWARD_DECL( - vec4 surfaceShader(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord)); -FORWARD_DECL(vec4 postSurfaceShader(vec4 Peye, vec3 Neye, vec4 color)); - -vec4 ShadingTerminal(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) -{ - ReprStyle reprStyle = GetReprStyle(); - - // Apply scalar override. - ScalarOverride scalarOverride = GetScalarOverride(); - if (scalarOverride.enabled) { - vec4 result; - - result.rgb = scalarOverride.color; - result.a = reprStyle.usePrimvarAlpha ? color.a: reprStyle.color.a; - - vec4 colorOverride = ApplyColorOverrides(result); - result = reprStyle.applyColorOverride ? colorOverride : result; - - return result; - } - - // Draw mode can override face color - vec4 reprColor; - - reprColor.rgb = reprStyle.usePrimvarColor ? color.rgb : reprStyle.color.rgb; - reprColor.a = reprStyle.usePrimvarAlpha ? color.a : reprStyle.color.a; - - // Compute color overrides - vec4 colorOverride = ApplyColorOverrides(reprColor); - reprColor = reprStyle.applyColorOverride ? colorOverride : reprColor; - - - // Surface shading can be expensive and also can contain undesirable - // side effects (like discards). So only run it for reprs that require it. - - if (reprStyle.useSurfaceShaderColor || - reprStyle.useSurfaceShaderAlpha) { - vec4 shadingColor; - - shadingColor = surfaceShader(Peye, - Neye, - reprColor, - patchCoord); - -#ifdef HD_HAS_postSurfaceShader - shadingColor = postSurfaceShader(Peye, - Neye, - shadingColor); -#endif - - reprColor.rgb = reprStyle.useSurfaceShaderColor ? - shadingColor.rgb : - reprColor.rgb; - - reprColor.a = reprStyle.useSurfaceShaderAlpha ? - shadingColor.a : - reprColor.a; - } - - vec4 baseColor = color; - baseColor = ApplyColorOverrides(baseColor); - - vec4 litColor = mix(baseColor, - reprColor, - GetLightingBlendAmount()); - - // Final overrides. - - return ApplyColorOverridesPostLighting(litColor); -} - - - -#ifdef HD_HAS_integrateLights -#ifndef HD_HAS_definedIntegrateLights -#define HD_HAS_definedIntegrateLights - -LightingContribution -integrateLights(vec4 Peye, vec3 Neye, LightingInterfaceProperties props) -{ - return integrateLightsDefault(Peye, Neye, props); -} - -#endif // HD_HAS_definedIntegrateLights -#endif - -ReprStyle GetReprStyle() -{ - ReprStyle reprStyle; - - reprStyle.color = vec4(0.0, 0.0, 0.0, 1.0); - reprStyle.usePrimvarColor = true; - reprStyle.usePrimvarAlpha = true; - reprStyle.applyColorOverride = true; - reprStyle.useSurfaceShaderColor = true; - reprStyle.useSurfaceShaderAlpha = true; - - return reprStyle; -} - - - -ScalarOverride GetScalarOverride() -{ - ScalarOverride result; - -#if defined(HD_HAS_scalarOverride) - result.enabled = true; - - // Allow a scalar value to override the color from the surface - // for previewing heatmaps. This is useful for editing workflows. -#if defined(HD_HAS_scalarOverrideColorRamp) - int rampCount = constantPrimvars[GetDrawingCoord().constantCoord]. - scalarOverrideColorRamp.length(); - float scalar = HdGet_scalarOverride() * float(rampCount - 1); - float baseIndex = floor(scalar); - float nextIndex = min(float(rampCount - 1), baseIndex + 1.0); - float interp = scalar - baseIndex; - result.color = mix(HdGet_scalarOverrideColorRamp(int(baseIndex)).rgb, - HdGet_scalarOverrideColorRamp(int(nextIndex)).rgb, - interp); -#else - // If no ramp is given just gamma correct the scalar as greyscale. - result.color = vec3(pow(HdGet_scalarOverride(), 2.2)); -#endif // HD_HAS_scalarOverrideColorRamp - -#else // HD_HAS_scalarOverride - result.enabled = false; - result.color = vec3(0.0, 0.0, 0.0); -#endif - - return result; -} - - - -// Determines whether a fragment is on or close to an unhidden triangle edge. -const float edgePickRadius = 2; // in viewport pixels -const float edgePickParametricRadius = 0.02; // in parametric space - -// For smooth looking edges, use an exponential falloff for the opacity. -// Note: We use a slower falloff fn than in meshWire.glslfx to make the -// selected edges stand out. -float SelectedEdgeFalloff(float d) { - return exp2(-1 * d * d); -} - - - -vec4 ComputeBaseFaceEdgeDistanceQuad() -{ - return GetEdgeDistanceQuad(); -} - -bool SelectWireframeFaceEdges() -{ - return false; -} - - - -float GetSelectedEdgeOpacity() -{ - float closestEdgeDistance = 0.0; - - // The sequence of comparisons should match GetPrimitiveEdgeId() - vec4 dist = ComputeBaseFaceEdgeDistanceQuad(); - if (dist.x < edgePickRadius) { - closestEdgeDistance = dist.x; - } else if (dist.y < edgePickRadius) { - closestEdgeDistance = dist.y; - } else if (dist.z < edgePickRadius) { - closestEdgeDistance = dist.z; - } else if (dist.w < edgePickRadius) { - closestEdgeDistance = dist.w; - } else { - return 0; - } - - return SelectedEdgeFalloff(closestEdgeDistance); -} - -// called from hdx/renderPass.glslfx and selection.glslfx -int GetPrimitiveEdgeId() -{ - // e2 - // (0,1) 3 ------ 2 (1,1) - // | | - // e3 | | e1 - // | | - // (0,0) 0 ------ 1 (1,0) - // e0 - - int edgeId = -1; - - vec4 dist = ComputeBaseFaceEdgeDistanceQuad(); - if (dist.x < edgePickRadius) { - edgeId = 0; - } else if (dist.y < edgePickRadius) { - edgeId = 1; - } else if (dist.z < edgePickRadius) { - edgeId = 2; - } else if (dist.w < edgePickRadius) { - edgeId = 3; - } else { - return -1; // Not on a mesh edge - } - - const int edgeFlag = GetEdgeFlag(); - const ivec2 meshEdgeIndices = HdGet_edgeIndices(); - - // Translate face-edge to authored mesh-edge - if (edgeFlag == 0) { - edgeId = meshEdgeIndices[0] + edgeId; // regular quad face - } else if (edgeId == 0) { - edgeId = meshEdgeIndices[0]; - } else if (edgeId == 3) { - edgeId = meshEdgeIndices[1]; - } else { - edgeId = -1; // Not an authored mesh edge - } - return edgeId; -} - - -int GetPointId() -{ - return -1; -} - - -void DiscardBasedOnTopologicalVisibility() -{ - // Nothing to do, since there's no authored opinion. -} - - - -vec4 GetInterpolatedPatchCoord() -{ - return gsPatchCoord; -} - - - -#ifndef HD_HAS_ptexFaceOffset -#define HD_HAS_ptexFaceOffset -int HdGet_ptexFaceOffset() -{ - return 0; -} -#endif - -vec4 GetPatchCoord(int localIndex) -{ - vec4 patchCoord = GetInterpolatedPatchCoord(); - return vec4(patchCoord.xyz, patchCoord.w + HdGet_ptexFaceOffset()); -} - -vec4 GetPatchCoord() -{ - return GetPatchCoord(0); -} - -vec3 ComputeScreenSpacePeye() -{ - return inData.Peye.xyz / inData.Peye.w; -} - -vec3 ComputeScreenSpaceNeye() -{ - vec3 Peye = ComputeScreenSpacePeye(); - vec3 Neye = normalize(cross(dFdx(Peye), dFdy(Peye))); - return (gl_FrontFacing ? Neye : -Neye); -} - -void main(void) -{ - bool isFlipped = IsFlipped(); - - DiscardBasedOnShading(gl_FrontFacing, isFlipped); - - DiscardBasedOnTopologicalVisibility(); - - vec4 color = vec4(0.5, 0.5, 0.5, 1); -#ifdef HD_HAS_displayColor - color.rgb = HdGet_displayColor().rgb; -#endif -#ifdef HD_HAS_displayOpacity - color.a = HdGet_displayOpacity(); -#endif - - vec3 Peye = ComputeScreenSpacePeye(); - - vec3 Neye = inData.Neye; - // Normalize Neye after rasterizer interpolation. - if (length(Neye) > 0.0) { - Neye = normalize(Neye); - } - // Give the shader key a chance to override the normal. - Neye = GetNormal(Neye, 0); - // Orient the normal for shading. - Neye = GetShadingNormal(Neye, isFlipped); - - vec4 patchCoord = GetPatchCoord(); - color = ShadingTerminal(vec4(Peye, 1), Neye, color, patchCoord); - - color = ApplyEdgeColor(color, patchCoord); - -#ifdef HD_MATERIAL_TAG_MASKED - if (ShouldDiscardByAlpha(color)) { - discard; - return; - } -#endif - - RenderOutput(vec4(Peye, 1), Neye, color, patchCoord); -} - -OK diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_doubleSided.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_doubleSided.out similarity index 100% rename from pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_doubleSided.out rename to pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_doubleSided.out diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_faceVarying.out similarity index 100% rename from pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect.out rename to pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_faceVarying.out diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_smoothNormals.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_smoothNormals.out similarity index 100% rename from pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_bindless_indirect_smoothNormals.out rename to pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_smoothNormals.out diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_points_bindless.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_points_bindless.out deleted file mode 100644 index ebd462d16f..0000000000 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_points_bindless.out +++ /dev/null @@ -1,1760 +0,0 @@ -------------------------------------------------------- --- glslfx version 0.1 -#import $TOOLS/hdSt/shaders/points.glslfx --- configuration -{"techniques": {"default": { -"vertexShader" : { "source" : ["Instancing.Transform", "Point.Vertex", "PointId.Vertex.PointParam", "Selection.DecodeUtils", "Selection.Vertex.PointSel"] } -, "fragmentShader" : { "source" : ["Fragment.CommonTerminals", "Fragment.Surface", "Fragment.NoScalarOverride", "Point.Fragment", "PointId.Fragment.PointParam"] } -}}} -------------------------------------------------------- -======================================================= - VERTEX SHADER -======================================================= -#version 450 -#extension GL_NV_shader_buffer_load : require -#extension GL_NV_gpu_shader5 : require -#extension GL_ARB_bindless_texture : require -#extension GL_ARB_shader_draw_parameters : require -int HgiGetBaseVertex() { - return gl_BaseVertexARB; -} -#define REF(space,type) inout type -#define FORWARD_DECL(func_decl) func_decl; -#define ATOMIC_LOAD(a) (a) -#define ATOMIC_STORE(a, v) (a) = (v) -#define ATOMIC_ADD(a, v) atomicAdd(a, v) -#define ATOMIC_EXCHANGE(a, v) atomicExchange(a, v) -#define ATOMIC_COMP_SWAP(a, expected, desired) atomicCompSwap(a, expected, desired) -#define atomic_int int -#define atomic_uint uint - -#define HGI_HAS_DOUBLE_TYPE 1 - - -struct hgi_ivec3 { int x, y, z; }; -struct hgi_vec3 { float x, y, z; }; -struct hgi_dvec3 { double x, y, z; }; -struct hgi_mat3 { float m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; -struct hgi_dmat3 { double m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; - - -// //////// Codegen Defines //////// -#define HD_SHADER_API 2 -#define MAT4 mat4 -// Alias hgi vec and matrix types to hd. -#define hd_ivec3 hgi_ivec3 -#define hd_vec3 hgi_vec3 -#define hd_dvec3 hgi_dvec3 -#define hd_mat3 hgi_mat3 -#define hd_dmat3 hgi_dmat3 - -ivec3 hd_ivec3_get(hd_ivec3 v) { return ivec3(v.x, v.y, v.z); } -ivec3 hd_ivec3_get(ivec3 v) { return v; } -vec3 hd_vec3_get(hd_vec3 v) { return vec3(v.x, v.y, v.z); } -vec3 hd_vec3_get(vec3 v) { return v; } -dvec3 hd_dvec3_get(hd_dvec3 v) { return dvec3(v.x, v.y, v.z); } -dvec3 hd_dvec3_get(dvec3 v) { return v; } -mat3 hd_mat3_get(hd_mat3 v) { return mat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -mat3 hd_mat3_get(mat3 v) { return v; } -dmat3 hd_dmat3_get(hd_dmat3 v) { return dmat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -dmat3 hd_dmat3_get(dmat3 v) { return v; } -hd_ivec3 hd_ivec3_set(hd_ivec3 v) { return v; } -hd_ivec3 hd_ivec3_set(ivec3 v) { return hd_ivec3(v.x, v.y, v.z); } -hd_vec3 hd_vec3_set(hd_vec3 v) { return v; } -hd_vec3 hd_vec3_set(vec3 v) { return hd_vec3(v.x, v.y, v.z); } -hd_dvec3 hd_dvec3_set(hd_dvec3 v) { return v; } -hd_dvec3 hd_dvec3_set(dvec3 v) { return hd_dvec3(v.x, v.y, v.z); } -hd_mat3 hd_mat3_set(hd_mat3 v) { return v; } -hd_mat3 hd_mat3_set(mat3 v) { return hd_mat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -hd_dmat3 hd_dmat3_set(hd_dmat3 v) { return v; } -hd_dmat3 hd_dmat3_set(dmat3 v) { return hd_dmat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -int hd_int_get(int v) { return v; } -int hd_int_get(ivec2 v) { return v.x; } -int hd_int_get(ivec3 v) { return v.x; } -int hd_int_get(ivec4 v) { return v.x; } -vec3 hd_sample_udim(vec2 v) { -vec2 vf = floor(v); -return vec3(v.x - vf.x, v.y - vf.y, clamp(vf.x, 0.0, 10.0) + 10.0 * vf.y); -} -vec4 hd_vec4_2_10_10_10_get(int v) { - ivec4 unpacked = ivec4((v & 0x3ff) << 22, (v & 0xffc00) << 12, - (v & 0x3ff00000) << 2, (v & 0xc0000000)); - return vec4(unpacked) / 2147483647.0; } -int hd_vec4_2_10_10_10_set(vec4 v) { - return ( (int(v.x * 511.0) & 0x3ff) | - ((int(v.y * 511.0) & 0x3ff) << 10) | - ((int(v.z * 511.0) & 0x3ff) << 20) | - ((int(v.w) & 0x1) << 30)); } -vec2 hd_half2_get(uint v) { - return unpackHalf2x16(v); } -uint hd_half2_set(vec2 v) { - return packHalf2x16(v); } -vec4 hd_half4_get(uvec2 v) { - return vec4(unpackHalf2x16(v.x), unpackHalf2x16(v.y)); } -uvec2 hd_half4_set(vec4 v) { - return uvec2(packHalf2x16(v.xy), packHalf2x16(v.zw)); } -#define HD_NUM_PRIMITIVE_VERTS 1 -#define HD_HAS_transform 1 -#define HD_HAS_transformInverse 1 -#define HD_HAS_color 1 -#define HD_HAS_primID 1 -#define HD_HAS_widths 1 -#define HD_INSTANCER_NUM_LEVELS 0 -#define HD_INSTANCE_INDEX_WIDTH 1 -#define HD_HAS_points 1 -#define HD_HAS_normals 1 - - -// //////// Global Includes //////// - -// //////// Global Macros //////// - -// //////// Global Structs //////// - -// //////// Global Member Declarations //////// -uint hd_VertexID = gl_VertexID; -uint hd_InstanceID = gl_InstanceID; -uint hd_BaseInstance = 0; - -// //////// Global Function Definitions //////// - - -// //////// Codegen Decl //////// -struct hd_drawingCoord { - int modelCoord; - int constantCoord; - int elementCoord; - int primitiveCoord; - int fvarCoord; - int shaderCoord; - int vertexCoord; - int topologyVisibilityCoord; - int varyingCoord; - int instanceIndex[HD_INSTANCE_INDEX_WIDTH]; - int instanceCoords[HD_INSTANCE_INDEX_WIDTH]; -}; -FORWARD_DECL(hd_drawingCoord GetDrawingCoord()); -FORWARD_DECL(int HgiGetBaseVertex()); -struct hd_instanceIndex { int indices[HD_INSTANCE_INDEX_WIDTH]; }; -struct ConstantData10 { - mat4 transform; - mat4 transformInverse; - vec4 color; - vec4 primID; - float widths; -}; -FORWARD_DECL(int GetElementID()); -FORWARD_DECL(int GetAggregatedElementID()); -FORWARD_DECL(int GetPrimitiveEdgeId()); -FORWARD_DECL(float GetSelectedEdgeOpacity()); -out flat ivec4 vs_interstageDrawingCoord0; -out flat ivec4 vs_interstageDrawingCoord1; -out flat ivec4 vs_interstageDrawingCoord2; -layout (location = 2) in ivec4 drawingCoord0; -layout (location = 3) in ivec4 drawingCoord1; -layout (location = 4) in ivec2 drawingCoord2; -layout (location = 0) in vec3 points; -layout (location = 1) in vec3 normals; -layout(location = 0) uniform ConstantData10 *constantPrimvars; -out VertexData { - vec4 Peye; -} outData; -out flat int vsPointId; -out PrimvarData { - vec3 points; - vec3 normals; -} outPrimvars; - -// //////// Codegen Accessors //////// -mat4 HdGet_transform(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transform); -} -mat4 HdGet_transform() { return HdGet_transform(0); } -mat4 HdGet_transformInverse(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transformInverse); -} -mat4 HdGet_transformInverse() { return HdGet_transformInverse(0); } -vec4 HdGet_color(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].color); -} -vec4 HdGet_color() { return HdGet_color(0); } -float HdGetScalar_color(int localIndex) { return HdGet_color(localIndex).x; } -float HdGetScalar_color() { return HdGet_color(0).x; } -vec4 HdGet_primID(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].primID); -} -vec4 HdGet_primID() { return HdGet_primID(0); } -float HdGetScalar_primID(int localIndex) { return HdGet_primID(localIndex).x; } -float HdGetScalar_primID() { return HdGet_primID(0).x; } -float HdGet_widths(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return float(constantPrimvars[index].widths); -} -float HdGet_widths() { return HdGet_widths(0); } -float HdGetScalar_widths(int localIndex) { return HdGet_widths(localIndex); } -float HdGetScalar_widths() { return HdGet_widths(0); } - -// //////// Codegen VS Source //////// -#define HD_BINDLESS_BUFFERS_ENABLED -int GetBaseVertexOffset() { - return HgiGetBaseVertex(); -} -hd_instanceIndex GetInstanceIndex() { hd_instanceIndex r; r.indices[0] = 0; return r; } -hd_drawingCoord GetDrawingCoord() { hd_drawingCoord dc; - dc.modelCoord = drawingCoord0.x; - dc.constantCoord = drawingCoord0.y; - dc.elementCoord = drawingCoord0.z; - dc.primitiveCoord = drawingCoord0.w; - dc.fvarCoord = drawingCoord1.x; - dc.shaderCoord = drawingCoord1.z; - dc.vertexCoord = drawingCoord1.w; - dc.topologyVisibilityCoord = drawingCoord2.x; - dc.varyingCoord = drawingCoord2.y; - hd_instanceIndex r = GetInstanceIndex(); - dc.instanceIndex[0] = r.indices[0]; - return dc; -} -vec3 HdGet_points(int localIndex) { return hd_vec3_get(points);} -vec3 HdGet_points() { return HdGet_points(0); } -float HdGetScalar_points(int localIndex) { return HdGet_points(localIndex).x; } -float HdGetScalar_points() { return HdGet_points(0).x; } -vec3 HdGet_normals(int localIndex) { return hd_vec3_get(normals);} -vec3 HdGet_normals() { return HdGet_normals(0); } -float HdGetScalar_normals(int localIndex) { return HdGet_normals(localIndex).x; } -float HdGetScalar_normals() { return HdGet_normals(0).x; } - -// //////// Codegen Proc VS //////// -void ProcessPrimvarsIn() { - hd_drawingCoord dc = GetDrawingCoord(); - vs_interstageDrawingCoord0[0] = dc.modelCoord; - vs_interstageDrawingCoord0[1] = dc.constantCoord; - vs_interstageDrawingCoord0[2] = dc.elementCoord; - vs_interstageDrawingCoord0[3] = dc.primitiveCoord; - vs_interstageDrawingCoord1[0] = dc.fvarCoord; - vs_interstageDrawingCoord1[1] = dc.shaderCoord; - vs_interstageDrawingCoord1[2] = dc.vertexCoord; - vs_interstageDrawingCoord1[3] = dc.topologyVisibilityCoord; - vs_interstageDrawingCoord2[0] = dc.varyingCoord; - vs_interstageDrawingCoord2[1] = dc.instanceIndex[0]; - outPrimvars.points = points; - outPrimvars.normals = normals; -} - -// --------------------------------------------------------------------------- -// global defines -// --------------------------------------------------------------------------- -// codeGen can override this range (currently not). -// quadro 4000's max is 189. -#ifndef HD_GL_POINT_SIZE_MAX -#define HD_GL_POINT_SIZE_MAX 100.0 -#endif -#ifndef HD_GL_POINT_SIZE_MIN -#define HD_GL_POINT_SIZE_MIN .45 -#endif - -// --------------------------------------------------------------------------- -// render pass states -// --------------------------------------------------------------------------- - -MAT4 GetWorldToViewMatrix() { -#if defined(HD_HAS_worldToViewMatrix) - return MAT4(HdGet_worldToViewMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetWorldToViewInverseMatrix() { -#if defined(HD_HAS_worldToViewInverseMatrix) - return MAT4(HdGet_worldToViewInverseMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetProjectionMatrix() { -#if defined(HD_HAS_projectionMatrix) - return MAT4(HdGet_projectionMatrix()); -#else - return MAT4(1); -#endif -} -vec3 GetPositionInWorldSpace(vec3 windowRelativeCoord) -{ -#if defined(HD_HAS_imageToWorldMatrix) - vec4 pImage = vec4(windowRelativeCoord, 1.0); - vec4 pWorld = vec4(HdGet_imageToWorldMatrix() * pImage); - return (pWorld / pWorld.w).xyz; -#else - return windowRelativeCoord; -#endif -} -float GetLightingBlendAmount() { -#if defined(HD_HAS_lightingBlendAmount) - return HdGet_lightingBlendAmount(); -#else - return 1; -#endif -} -vec4 GetViewport() { -#if defined(HD_HAS_viewport) - return HdGet_viewport(); -#else - return vec4(0,0,1,1); -#endif -} -float GetTessLevel() { -#if defined(HD_HAS_tessLevel) - return HdGet_tessLevel(); -#else - return 1; -#endif -} -float GetPointSize() { -#if defined(HD_HAS_pointSize) - return HdGet_pointSize(); -#else - return 3.0; -#endif -} -float GetPointSelectedSize() { -#if defined(HD_HAS_pointSelectedSize) - return HdGet_pointSelectedSize(); -#else - return 5.0; -#endif -} -vec4 GetWireframeColor() { -// Individual prims can specify an alternative wireframe color -// to one specified in the render pass. This is used in cases were -// there is not enough contrast with the normal one. -#if defined(HD_HAS_overrideWireframeColor) - return HdGet_overrideWireframeColor(); -#elif defined(HD_HAS_wireframeColor) - return HdGet_wireframeColor(); -#else - return vec4(0,0,0,0); -#endif -} -vec4 GetMaskColor() { -#if defined(HD_HAS_maskColor) - return HdGet_maskColor(); -#else - return vec4(0.5,0,0,1); -#endif -} -vec4 GetIndicatorColor() { -#if defined(HD_HAS_indicatorColor) - return HdGet_indicatorColor(); -#else - return vec4(0,0.5,0,1); -#endif -} - -bool ShouldDiscardByAlpha(vec4 color) -{ -#if defined(HD_HAS_alphaThreshold) - float alphaThreshold = HdGet_alphaThreshold(); -#else - float alphaThreshold = 0; -#endif - return (color.a < alphaThreshold); -} - -vec2 ApplyAxisAlignedAffineTransform(vec4 t, vec2 pt) -{ - return t.xy * pt + t.zw; -} - - - -void ApplyClipPlanes(vec4 Peye) -{ -#if defined(HD_HAS_numClipPlanes) -#if defined(HD_HAS_clipPlanes) - for (int i=0; i> 1; // bits 31:1 -} - -// --------- subprim decoding ---------- -// Each subprims offsets' buffer encoding is: -// [subprim-type][min][max][ selOffsets ] -// <----------3 ----------><--- max - min + 1 --> -struct SubprimHeader { - int type; - int min; - int max; -}; -SubprimHeader DecodeSubprimHeader(int offset) -{ - SubprimHeader header; - header.type = HdGet_hdxSelectionBuffer(offset ); - header.min = HdGet_hdxSelectionBuffer(offset + 1); - header.max = HdGet_hdxSelectionBuffer(offset + 2); - return header; -} - -bool IsSubprimSelected(int id, int min, int max, int headerStart, - REF(thread, int) nextSubprimOffset) -{ - const int SUBPRIM_SELOFFSETS_HEADER_SIZE = 3; - - nextSubprimOffset = 0; // initialize - bool isSelected = false; - - if (id >= min && id < max) { - int netSubprimIndex = - headerStart + SUBPRIM_SELOFFSETS_HEADER_SIZE + id - min; - int selOffset = HdGet_hdxSelectionBuffer(netSubprimIndex); - - DecodeSelOffset(selOffset, /*out*/isSelected, /*out*/nextSubprimOffset); - } else { - // The subprim id does not fall in the selected id range, so the subprim - // in question isn't selected. However, we can still have other - // subprim(s) selected. To get the offset to jump to, we mimic decoding - // the "min" subprim id. - int minSubprimIndex = headerStart + SUBPRIM_SELOFFSETS_HEADER_SIZE; - DecodeSelOffset(HdGet_hdxSelectionBuffer(minSubprimIndex), - /*out*/isSelected, /*out*/nextSubprimOffset); - isSelected = false; - } - - return isSelected; -} -#endif // HD_HAS_hdxSelectionBuffer - -// Keep the result struct definition outside guards. -struct SubprimSelectionResult { - bool elementSelected; - bool elementEdgeSelected; - bool edgeSelected; - bool pointSelected; - int pointColorId; -}; - -SubprimSelectionResult InitSubprimSelectionResult( - bool elementSelected, - bool elementEdgeSelected, - bool edgeSelected, - bool pointSelected, - int pointColorId) -{ - SubprimSelectionResult res; - - res.elementSelected = elementSelected; - res.elementEdgeSelected = elementEdgeSelected; - res.edgeSelected = edgeSelected; - res.pointSelected = pointSelected; - res.pointColorId = pointColorId; - - return res; -} - -bool IsAnySubprimSelected(SubprimSelectionResult s) -{ - return (s.elementSelected || - s.elementEdgeSelected || - s.edgeSelected || - s.pointSelected); -} - -bool HasCustomizedPointColor(SubprimSelectionResult s) -{ - // Use -1 to encode selected points that don't have a custom point color. - return (s.pointColorId != -1); -} - -#if defined(HD_HAS_hdxSelectionBuffer) -// Note: These should match the SubprimType enum in hdx/SelectionTracker.cpp -#define SUBPRIM_TYPE_ELEMENT 0 -#define SUBPRIM_TYPE_ELEMENT_EDGE 1 -#define SUBPRIM_TYPE_EDGE 2 -#define SUBPRIM_TYPE_POINT 3 -#define SUBPRIM_TYPE_INSTANCE 4 - -SubprimSelectionResult GetSubprimSel(int offset, - int elementId, int edgeId, int pointId) -{ - SubprimSelectionResult s = - InitSubprimSelectionResult(false, false, false, false, 0); - - int nextSubprimOffset = 0; - SubprimHeader header = DecodeSubprimHeader(offset); - - if (header.type == SUBPRIM_TYPE_ELEMENT) { - s.elementSelected = - IsSubprimSelected(elementId, header.min, header.max, - offset, /*out*/nextSubprimOffset); - - if (nextSubprimOffset != 0) { - // fragment has additional subprim(s) selected. update header. - header = DecodeSubprimHeader(nextSubprimOffset); - offset = nextSubprimOffset; - } - } - - if (header.type == SUBPRIM_TYPE_ELEMENT_EDGE) { - s.elementEdgeSelected = - IsSubprimSelected(edgeId, header.min, header.max, - offset, /*out*/nextSubprimOffset); - - if (nextSubprimOffset != 0) { - // fragment has additional subprim(s) selected. update header. - header = DecodeSubprimHeader(nextSubprimOffset); - offset = nextSubprimOffset; - } - } - if (header.type == SUBPRIM_TYPE_EDGE) { - s.edgeSelected = - IsSubprimSelected(edgeId, header.min, header.max, - offset, /*out*/nextSubprimOffset); - - if (nextSubprimOffset != 0) { - // fragment has points selected. update header. - header = DecodeSubprimHeader(nextSubprimOffset); - offset = nextSubprimOffset; - } - } - - if (header.type == SUBPRIM_TYPE_POINT) { - s.pointSelected = - IsSubprimSelected(pointId, header.min, header.max, - offset, /*unused*/nextSubprimOffset); - // For points alone, since there isn't any subprim to follow it, the - // offset field is overriden to represent the index into the - // selectedPointColors buffer to support customized coloring of a set of - // selected points. - s.pointColorId = nextSubprimOffset; - } - - return s; -} - -// --------- instance decoding ---------- -bool IsInstanceSelected(int offset, REF(thread, int) nextOffset) -{ - // If we don't find an instance subprim block, pass the same offset to - // GetSubprimSel. - nextOffset = offset; - bool sel = false; - - int instanceId = GetDrawingCoord().instanceIndex[0]; - - SubprimHeader header = DecodeSubprimHeader(offset); - if (header.type == SUBPRIM_TYPE_INSTANCE) { - sel = - IsSubprimSelected(instanceId, header.min, header.max, - offset, /*out*/nextOffset); - } - - return sel; -} -#endif // HD_HAS_hdxSelectionBuffer - -// --------- selection buffer decoding entry point ---------- -struct SelectionResult { - bool primOrInstanceSel; - SubprimSelectionResult subprimSel; -}; - -SelectionResult InitSelectionResult( - bool primOrInstanceSel, - bool elementSelected, - bool elementEdgeSelected, - bool edgeSelected, - bool pointSelected, - int pointColorId) -{ - SelectionResult res; - - res.primOrInstanceSel = primOrInstanceSel; - res.subprimSel = InitSubprimSelectionResult( - elementSelected, - elementEdgeSelected, - edgeSelected, - pointSelected, - pointColorId); - - return res; -} - - -// Decodes the selection buffer encoding scheme for a given mode, and returns -// the selection result. -SelectionResult GetSelectionResult(int mode, - int elementId, int edgeId, int pointId) -{ - SelectionResult res = - InitSelectionResult(false, false, false, false, false, 0); - -#if defined(HD_HAS_hdxSelectionBuffer) - // The hdxSelectionBuffer layout is: - // [#modes] [per-mode offset] [data mode0] ... [data modeM] - // [---------header---------] - // Each mode's data is laid out as: - // [ prims | points | edges | elementEdges | elements | instances ] - // <----------- subprims -------------------> - // <------------------ per prim ------------------------> - // See hdx/SelectionTracker.cpp for details on the encoding scheme. - int modeOffset = GetIndexOffsetForHighlightMode(mode); - if (!HighlightModeHasSelection(modeOffset)) { - // highlight mode has no selected objects (prims/instances/elements) - return res; - } - - const int PRIM_SELOFFSETS_HEADER_SIZE = 2; - const int primId = HdGet_primID(); - int smin = HdGet_hdxSelectionBuffer(modeOffset); - int smax = HdGet_hdxSelectionBuffer(modeOffset + 1); - - if (primId >= smin && primId < smax) { - int offset = modeOffset + PRIM_SELOFFSETS_HEADER_SIZE + primId - smin; - int nextOffset = 0; - bool sel = false; - DecodeSelOffset(HdGet_hdxSelectionBuffer(offset), - /*out*/sel, /*out*/nextOffset); - - // At this point, sel indicates whether the fragment corresponds to - // a prim that needs to be fully highlighted, while a non-zero - // nextOffset indicates whether additional decoding may be done. - - // We don't currently differentiate between prim, instance and - // subprim selection highlighting (i.e., visually, they look the - // same), and thus can skip additional decoding if sel is true. - // We choose not to, for ease of future customization. - if (nextOffset != 0) { - // check if instance (or) subprim(s) are selected - offset = nextOffset; - sel = sel || IsInstanceSelected(offset, /*out*/nextOffset); - - if (nextOffset != 0) { - res.subprimSel = - GetSubprimSel(nextOffset, elementId, edgeId, pointId); - } - } - res.primOrInstanceSel = sel; - } -#endif // HD_HAS_hdxSelectionBuffer - - return res; -} - -// Returns the logical OR of the inputs -SelectionResult -_CombineWithOr(SelectionResult a, SelectionResult b) -{ - SelectionResult res = - InitSelectionResult(false, false, false, false, false, 0); - - res.primOrInstanceSel = a.primOrInstanceSel || b.primOrInstanceSel; - res.subprimSel.elementSelected = a.subprimSel.elementSelected || - b.subprimSel.elementSelected; - res.subprimSel.elementEdgeSelected = a.subprimSel.elementEdgeSelected || - b.subprimSel.elementEdgeSelected; - res.subprimSel.edgeSelected = a.subprimSel.edgeSelected || - b.subprimSel.edgeSelected; - res.subprimSel.pointSelected = a.subprimSel.pointSelected || - b.subprimSel.pointSelected; - // pointColorIndex is ignored. - return res; -} - -// Returns the net selection result aggregating the result of each selection -// mode. -SelectionResult GetNetSelectionResult(int elementId, int edgeId, int pointId) -{ - SelectionResult netResult = - InitSelectionResult(false, false, false, false, false, 0); - -#if defined(HD_HAS_hdxSelectionBuffer) - const int numSelectionModes = GetNumSelectionHighlightModes(); - for (int mode = 0; mode < numSelectionModes; mode++) { - SelectionResult modeResult = - GetSelectionResult(mode, elementId, edgeId, pointId); - netResult = _CombineWithOr(modeResult, netResult); - } -#endif - return netResult; -} - - -// Mixin for use in the vertex shader stage. -// Decodes the selection buffer to find out if the current vertex (point) is -// selected. This is called from hdSt/shaders/pointId.glslfx -bool IsPointSelected(int pointId) -{ - bool sel = false; - #if defined(HD_HAS_hdxSelectionBuffer) - const int numSelectionModes = GetNumSelectionHighlightModes(); - for (int mode = 0; mode < numSelectionModes; mode++) { - // At the VS stage, we don't carry enough state to determine the - // elementId and edgeId. So, use fallback values instead. - SelectionResult res = - GetSelectionResult(mode, /*elementId*/-1, /*edgeId*/-1, pointId); - if (res.subprimSel.pointSelected && - !HasCustomizedPointColor(res.subprimSel)) { - sel = true; - break; - } - } // for each highlight mode - #endif - return sel; -} - - -======================================================= - TESS CONTROL SHADER -======================================================= -======================================================= - TESS EVAL SHADER -======================================================= -======================================================= - GEOMETRY SHADER -======================================================= -======================================================= - FRAGMENT SHADER -======================================================= -#version 450 -#extension GL_NV_shader_buffer_load : require -#extension GL_NV_gpu_shader5 : require -#extension GL_ARB_bindless_texture : require -#define REF(space,type) inout type -#define FORWARD_DECL(func_decl) func_decl; -#define ATOMIC_LOAD(a) (a) -#define ATOMIC_STORE(a, v) (a) = (v) -#define ATOMIC_ADD(a, v) atomicAdd(a, v) -#define ATOMIC_EXCHANGE(a, v) atomicExchange(a, v) -#define ATOMIC_COMP_SWAP(a, expected, desired) atomicCompSwap(a, expected, desired) -#define atomic_int int -#define atomic_uint uint - -#define HGI_HAS_DOUBLE_TYPE 1 - - -struct hgi_ivec3 { int x, y, z; }; -struct hgi_vec3 { float x, y, z; }; -struct hgi_dvec3 { double x, y, z; }; -struct hgi_mat3 { float m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; -struct hgi_dmat3 { double m00, m01, m02, - m10, m11, m12, - m20, m21, m22; }; - - - -// //////// Global Includes //////// - -// //////// Global Macros //////// - -// //////// Global Structs //////// - -// //////// Global Member Declarations //////// - -// //////// Global Function Definitions //////// - - -// //////// Codegen Defines //////// -#define HD_SHADER_API 2 -#define MAT4 mat4 -// Alias hgi vec and matrix types to hd. -#define hd_ivec3 hgi_ivec3 -#define hd_vec3 hgi_vec3 -#define hd_dvec3 hgi_dvec3 -#define hd_mat3 hgi_mat3 -#define hd_dmat3 hgi_dmat3 - -ivec3 hd_ivec3_get(hd_ivec3 v) { return ivec3(v.x, v.y, v.z); } -ivec3 hd_ivec3_get(ivec3 v) { return v; } -vec3 hd_vec3_get(hd_vec3 v) { return vec3(v.x, v.y, v.z); } -vec3 hd_vec3_get(vec3 v) { return v; } -dvec3 hd_dvec3_get(hd_dvec3 v) { return dvec3(v.x, v.y, v.z); } -dvec3 hd_dvec3_get(dvec3 v) { return v; } -mat3 hd_mat3_get(hd_mat3 v) { return mat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -mat3 hd_mat3_get(mat3 v) { return v; } -dmat3 hd_dmat3_get(hd_dmat3 v) { return dmat3(v.m00, v.m01, v.m02, - v.m10, v.m11, v.m12, - v.m20, v.m21, v.m22); } -dmat3 hd_dmat3_get(dmat3 v) { return v; } -hd_ivec3 hd_ivec3_set(hd_ivec3 v) { return v; } -hd_ivec3 hd_ivec3_set(ivec3 v) { return hd_ivec3(v.x, v.y, v.z); } -hd_vec3 hd_vec3_set(hd_vec3 v) { return v; } -hd_vec3 hd_vec3_set(vec3 v) { return hd_vec3(v.x, v.y, v.z); } -hd_dvec3 hd_dvec3_set(hd_dvec3 v) { return v; } -hd_dvec3 hd_dvec3_set(dvec3 v) { return hd_dvec3(v.x, v.y, v.z); } -hd_mat3 hd_mat3_set(hd_mat3 v) { return v; } -hd_mat3 hd_mat3_set(mat3 v) { return hd_mat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -hd_dmat3 hd_dmat3_set(hd_dmat3 v) { return v; } -hd_dmat3 hd_dmat3_set(dmat3 v) { return hd_dmat3(v[0][0], v[0][1], v[0][2], - v[1][0], v[1][1], v[1][2], - v[2][0], v[2][1], v[2][2]); } -int hd_int_get(int v) { return v; } -int hd_int_get(ivec2 v) { return v.x; } -int hd_int_get(ivec3 v) { return v.x; } -int hd_int_get(ivec4 v) { return v.x; } -vec3 hd_sample_udim(vec2 v) { -vec2 vf = floor(v); -return vec3(v.x - vf.x, v.y - vf.y, clamp(vf.x, 0.0, 10.0) + 10.0 * vf.y); -} -vec4 hd_vec4_2_10_10_10_get(int v) { - ivec4 unpacked = ivec4((v & 0x3ff) << 22, (v & 0xffc00) << 12, - (v & 0x3ff00000) << 2, (v & 0xc0000000)); - return vec4(unpacked) / 2147483647.0; } -int hd_vec4_2_10_10_10_set(vec4 v) { - return ( (int(v.x * 511.0) & 0x3ff) | - ((int(v.y * 511.0) & 0x3ff) << 10) | - ((int(v.z * 511.0) & 0x3ff) << 20) | - ((int(v.w) & 0x1) << 30)); } -vec2 hd_half2_get(uint v) { - return unpackHalf2x16(v); } -uint hd_half2_set(vec2 v) { - return packHalf2x16(v); } -vec4 hd_half4_get(uvec2 v) { - return vec4(unpackHalf2x16(v.x), unpackHalf2x16(v.y)); } -uvec2 hd_half4_set(vec4 v) { - return uvec2(packHalf2x16(v.xy), packHalf2x16(v.zw)); } -#define HD_NUM_PRIMITIVE_VERTS 1 -#define HD_HAS_transform 1 -#define HD_HAS_transformInverse 1 -#define HD_HAS_color 1 -#define HD_HAS_primID 1 -#define HD_HAS_widths 1 -#define HD_INSTANCER_NUM_LEVELS 0 -#define HD_INSTANCE_INDEX_WIDTH 1 -#define HD_HAS_points 1 -#define HD_HAS_normals 1 - -// //////// Codegen Decl //////// -struct hd_drawingCoord { - int modelCoord; - int constantCoord; - int elementCoord; - int primitiveCoord; - int fvarCoord; - int shaderCoord; - int vertexCoord; - int topologyVisibilityCoord; - int varyingCoord; - int instanceIndex[HD_INSTANCE_INDEX_WIDTH]; - int instanceCoords[HD_INSTANCE_INDEX_WIDTH]; -}; -FORWARD_DECL(hd_drawingCoord GetDrawingCoord()); -FORWARD_DECL(int HgiGetBaseVertex()); -struct hd_instanceIndex { int indices[HD_INSTANCE_INDEX_WIDTH]; }; -struct ConstantData10 { - mat4 transform; - mat4 transformInverse; - vec4 color; - vec4 primID; - float widths; -}; -FORWARD_DECL(int GetElementID()); -FORWARD_DECL(int GetAggregatedElementID()); -FORWARD_DECL(int GetPrimitiveEdgeId()); -FORWARD_DECL(float GetSelectedEdgeOpacity()); -layout(location = 0) uniform ConstantData10 *constantPrimvars; -in VertexData { - vec4 Peye; -} inData; -in flat int vsPointId; -layout (location = 0) out vec4 colorOut; -in flat ivec4 vs_interstageDrawingCoord0; -in flat ivec4 vs_interstageDrawingCoord1; -in flat ivec4 vs_interstageDrawingCoord2; -in PrimvarData { - vec3 points; - vec3 normals; -} inPrimvars; - -// //////// Codegen Accessors //////// -mat4 HdGet_transform(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transform); -} -mat4 HdGet_transform() { return HdGet_transform(0); } -mat4 HdGet_transformInverse(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return mat4(constantPrimvars[index].transformInverse); -} -mat4 HdGet_transformInverse() { return HdGet_transformInverse(0); } -vec4 HdGet_color(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].color); -} -vec4 HdGet_color() { return HdGet_color(0); } -float HdGetScalar_color(int localIndex) { return HdGet_color(localIndex).x; } -float HdGetScalar_color() { return HdGet_color(0).x; } -vec4 HdGet_primID(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return vec4(constantPrimvars[index].primID); -} -vec4 HdGet_primID() { return HdGet_primID(0); } -float HdGetScalar_primID(int localIndex) { return HdGet_primID(localIndex).x; } -float HdGetScalar_primID() { return HdGet_primID(0).x; } -float HdGet_widths(int localIndex) { - int index = GetDrawingCoord().constantCoord; - return float(constantPrimvars[index].widths); -} -float HdGet_widths() { return HdGet_widths(0); } -float HdGetScalar_widths(int localIndex) { return HdGet_widths(localIndex); } -float HdGetScalar_widths() { return HdGet_widths(0); } - -// //////// Codegen FS Source //////// -#define HD_SHADER_SUPPORTS_DOUBLE_PRECISION -#define HD_MINUS_ONE_TO_ONE_DEPTH_RANGE -vec3 GetBarycentricCoord() { - return vec3(0); -} -int GetPrimitiveID() { - return gl_PrimitiveID; -} -int GetPrimitiveIndex() { - return GetDrawingCoord().primitiveCoord + GetPrimitiveID(); -} -hd_drawingCoord GetDrawingCoord() { - hd_drawingCoord dc; - dc.modelCoord = vs_interstageDrawingCoord0[0]; - dc.constantCoord = vs_interstageDrawingCoord0[1]; - dc.elementCoord = vs_interstageDrawingCoord0[2]; - dc.primitiveCoord = vs_interstageDrawingCoord0[3]; - dc.fvarCoord = vs_interstageDrawingCoord1[0]; - dc.shaderCoord = vs_interstageDrawingCoord1[1]; - dc.vertexCoord = vs_interstageDrawingCoord1[2]; - dc.topologyVisibilityCoord = vs_interstageDrawingCoord1[3]; - dc.varyingCoord = vs_interstageDrawingCoord2[0]; - dc.instanceIndex[0] = vs_interstageDrawingCoord2[1]; - return dc; -} -int GetElementID() { - return -1; -} -int GetAggregatedElementID() { - return GetElementID(); -} -int GetEdgeFlag() { - return 0; -} -ivec3 GetPatchParam() { - return ivec3(0, 0, 0); -} -int GetFVarIndex(int localIndex) { - return 0; -} -int GetAuthoredEdgeId(int primitiveEdgeId) { - return -1; -} -int GetPrimitiveEdgeId() { - return -1; -} -float GetSelectedEdgeOpacity() { - return 0.0; -} -bool SelectWireframeFaceEdges() { - return false; -} -vec3 HdGet_points(int localIndex) { return vec3(inPrimvars.points);} -vec3 HdGet_points() { return HdGet_points(0); } -float HdGetScalar_points(int localIndex) { return HdGet_points(localIndex).x; } -float HdGetScalar_points() { return HdGet_points(0).x; } -vec3 HdGet_normals(int localIndex) { return vec3(inPrimvars.normals);} -vec3 HdGet_normals() { return HdGet_normals(0); } -float HdGetScalar_normals(int localIndex) { return HdGet_normals(localIndex).x; } -float HdGetScalar_normals() { return HdGet_normals(0).x; } -FORWARD_DECL(vec4 GetPatchCoord(int index)); -void ProcessSamplingTransforms(MAT4 instanceModelViewInverse) { -} - -// --------------------------------------------------------------------------- -// global defines -// --------------------------------------------------------------------------- -// codeGen can override this range (currently not). -// quadro 4000's max is 189. -#ifndef HD_GL_POINT_SIZE_MAX -#define HD_GL_POINT_SIZE_MAX 100.0 -#endif -#ifndef HD_GL_POINT_SIZE_MIN -#define HD_GL_POINT_SIZE_MIN .45 -#endif - -// --------------------------------------------------------------------------- -// render pass states -// --------------------------------------------------------------------------- - -MAT4 GetWorldToViewMatrix() { -#if defined(HD_HAS_worldToViewMatrix) - return MAT4(HdGet_worldToViewMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetWorldToViewInverseMatrix() { -#if defined(HD_HAS_worldToViewInverseMatrix) - return MAT4(HdGet_worldToViewInverseMatrix()); -#else - return MAT4(1); -#endif -} -MAT4 GetProjectionMatrix() { -#if defined(HD_HAS_projectionMatrix) - return MAT4(HdGet_projectionMatrix()); -#else - return MAT4(1); -#endif -} -vec3 GetPositionInWorldSpace(vec3 windowRelativeCoord) -{ -#if defined(HD_HAS_imageToWorldMatrix) - vec4 pImage = vec4(windowRelativeCoord, 1.0); - vec4 pWorld = vec4(HdGet_imageToWorldMatrix() * pImage); - return (pWorld / pWorld.w).xyz; -#else - return windowRelativeCoord; -#endif -} -float GetLightingBlendAmount() { -#if defined(HD_HAS_lightingBlendAmount) - return HdGet_lightingBlendAmount(); -#else - return 1; -#endif -} -vec4 GetViewport() { -#if defined(HD_HAS_viewport) - return HdGet_viewport(); -#else - return vec4(0,0,1,1); -#endif -} -float GetTessLevel() { -#if defined(HD_HAS_tessLevel) - return HdGet_tessLevel(); -#else - return 1; -#endif -} -float GetPointSize() { -#if defined(HD_HAS_pointSize) - return HdGet_pointSize(); -#else - return 3.0; -#endif -} -float GetPointSelectedSize() { -#if defined(HD_HAS_pointSelectedSize) - return HdGet_pointSelectedSize(); -#else - return 5.0; -#endif -} -vec4 GetWireframeColor() { -// Individual prims can specify an alternative wireframe color -// to one specified in the render pass. This is used in cases were -// there is not enough contrast with the normal one. -#if defined(HD_HAS_overrideWireframeColor) - return HdGet_overrideWireframeColor(); -#elif defined(HD_HAS_wireframeColor) - return HdGet_wireframeColor(); -#else - return vec4(0,0,0,0); -#endif -} -vec4 GetMaskColor() { -#if defined(HD_HAS_maskColor) - return HdGet_maskColor(); -#else - return vec4(0.5,0,0,1); -#endif -} -vec4 GetIndicatorColor() { -#if defined(HD_HAS_indicatorColor) - return HdGet_indicatorColor(); -#else - return vec4(0,0.5,0,1); -#endif -} - -bool ShouldDiscardByAlpha(vec4 color) -{ -#if defined(HD_HAS_alphaThreshold) - float alphaThreshold = HdGet_alphaThreshold(); -#else - float alphaThreshold = 0; -#endif - return (color.a < alphaThreshold); -} - -vec2 ApplyAxisAlignedAffineTransform(vec4 t, vec2 pt) -{ - return t.xy * pt + t.zw; -} - - - -vec2 HorizontallyNormalizedFilmbackCoordinates() -{ - const vec4 transform = -#ifdef HD_HAS_imageToHorizontallyNormalizedFilmback - HdGet_imageToHorizontallyNormalizedFilmback(); -#else - vec4(vec2(1.0), vec2(0.0)); -#endif - return ApplyAxisAlignedAffineTransform(transform, gl_FragCoord.xy); -} - - - -vec4 ApplySelectionColor(vec4 color) -{ - return color; -} - - - -// Forward declare selection functionality. -// XXX: Currently, the non-empty implementation of this is in hdx. -FORWARD_DECL(vec4 ApplySelectionColor(vec4 color)); - -// XXX: Make sure to update hdx/shaders/renderPass.glslfx when editing these -// color override methods, since they're currently duplicated. This is because -// we don't have a mixin token for color overrides in a render pass yet. -vec4 ApplyColorOverrides(vec4 color) -{ -#if defined(HD_HAS_overrideColor) - // Mix in override color - vec4 overrideColor = HdGet_overrideColor(); - color.rgb = mix(color.rgb, overrideColor.rgb, overrideColor.a); -#endif - return ApplySelectionColor(color); -} - -vec3 ApplyMaskColor(vec3 color, float weight, vec4 maskColor) -{ - float strength = maskColor.a * clamp(weight, 0.0, 1.0); - return mix(color, maskColor.rgb, strength); -} - -vec4 ApplyColorOverridesPostLighting(vec4 color) -{ - #if defined(HD_HAS_maskWeight) - float maskWeight = HdGet_maskWeight(); - vec4 maskColor = GetMaskColor(); - color.rgb = ApplyMaskColor(color.rgb, maskWeight, maskColor); - #endif - #if defined(HD_HAS_indicatorWeight) - float indicatorWeight = HdGet_indicatorWeight(); - vec4 indicatorColor = GetIndicatorColor(); - color.rgb = ApplyMaskColor(color.rgb, indicatorWeight, indicatorColor); - #endif - return color; -} - - - -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) -{ - colorOut = color; -} - - -#ifndef HD_HAS_integrateLights -#define HD_HAS_integrateLights -#endif - -struct LightingContribution { - vec3 diffuse; -}; - -struct LightingInterfaceProperties { - float unused; -}; - -LightingContribution -integrateLightsDefault(vec4 Peye, vec3 Neye, LightingInterfaceProperties props) -{ - vec3 n = normalize(Neye); - - LightingContribution result; - result.diffuse = vec3(dot(n, vec3(0,0,1))); - - return result; -} - -LightingContribution -integrateLightsConstant(vec4 Peye, vec3 Neye, LightingInterfaceProperties props) -{ - LightingContribution result; - //pefectly diffuse white hemisphere contribution - result.diffuse = vec3(1); - - return result; -} - - - -FORWARD_DECL( - LightingContribution integrateLights(vec4 Peye, vec3 Neye, - LightingInterfaceProperties props)); - -vec3 FallbackLighting(in vec3 Peye, in vec3 Neye, in vec3 color) -{ - LightingInterfaceProperties props; - LightingContribution light = integrateLights(vec4(Peye, 1), Neye, props); - return color * light.diffuse; -} - - -vec4 surfaceShader(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) -{ - // lighting - color.rgb = FallbackLighting(Peye.xyz, Neye, color.rgb); - return color; -} - - -struct ReprStyle -{ - vec4 color; - bool usePrimvarColor; - bool usePrimvarAlpha; - bool applyColorOverride; - bool useSurfaceShaderColor; - bool useSurfaceShaderAlpha; -}; - -struct ScalarOverride -{ - bool enabled; - vec3 color; -}; - -FORWARD_DECL(ReprStyle GetReprStyle()); -FORWARD_DECL(ScalarOverride GetScalarOverride()); -FORWARD_DECL( - vec4 surfaceShader(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord)); -FORWARD_DECL(vec4 postSurfaceShader(vec4 Peye, vec3 Neye, vec4 color)); - -vec4 ShadingTerminal(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) -{ - ReprStyle reprStyle = GetReprStyle(); - - // Apply scalar override. - ScalarOverride scalarOverride = GetScalarOverride(); - if (scalarOverride.enabled) { - vec4 result; - - result.rgb = scalarOverride.color; - result.a = reprStyle.usePrimvarAlpha ? color.a: reprStyle.color.a; - - vec4 colorOverride = ApplyColorOverrides(result); - result = reprStyle.applyColorOverride ? colorOverride : result; - - return result; - } - - // Draw mode can override face color - vec4 reprColor; - - reprColor.rgb = reprStyle.usePrimvarColor ? color.rgb : reprStyle.color.rgb; - reprColor.a = reprStyle.usePrimvarAlpha ? color.a : reprStyle.color.a; - - // Compute color overrides - vec4 colorOverride = ApplyColorOverrides(reprColor); - reprColor = reprStyle.applyColorOverride ? colorOverride : reprColor; - - - // Surface shading can be expensive and also can contain undesirable - // side effects (like discards). So only run it for reprs that require it. - - if (reprStyle.useSurfaceShaderColor || - reprStyle.useSurfaceShaderAlpha) { - vec4 shadingColor; - - shadingColor = surfaceShader(Peye, - Neye, - reprColor, - patchCoord); - -#ifdef HD_HAS_postSurfaceShader - shadingColor = postSurfaceShader(Peye, - Neye, - shadingColor); -#endif - - reprColor.rgb = reprStyle.useSurfaceShaderColor ? - shadingColor.rgb : - reprColor.rgb; - - reprColor.a = reprStyle.useSurfaceShaderAlpha ? - shadingColor.a : - reprColor.a; - } - - vec4 baseColor = color; - baseColor = ApplyColorOverrides(baseColor); - - vec4 litColor = mix(baseColor, - reprColor, - GetLightingBlendAmount()); - - // Final overrides. - - return ApplyColorOverridesPostLighting(litColor); -} - - - -#ifdef HD_HAS_integrateLights -#ifndef HD_HAS_definedIntegrateLights -#define HD_HAS_definedIntegrateLights - -LightingContribution -integrateLights(vec4 Peye, vec3 Neye, LightingInterfaceProperties props) -{ - return integrateLightsDefault(Peye, Neye, props); -} - -#endif // HD_HAS_definedIntegrateLights -#endif - -ReprStyle GetReprStyle() -{ - ReprStyle reprStyle; - - reprStyle.color = vec4(0.0, 0.0, 0.0, 1.0); - reprStyle.usePrimvarColor = true; - reprStyle.usePrimvarAlpha = true; - reprStyle.applyColorOverride = true; - reprStyle.useSurfaceShaderColor = true; - reprStyle.useSurfaceShaderAlpha = true; - - return reprStyle; -} - - - -ScalarOverride GetScalarOverride() -{ - ScalarOverride result; - - result.enabled = false; - result.color = vec3(0.0, 0.0, 0.0); - - return result; -} - - -void main(void) -{ - vec3 Peye = inData.Peye.xyz / inData.Peye.w; - // camera facing. - vec3 Neye = vec3(0, 0, 1); - - vec4 color = vec4(0.5, 0.5, 0.5, 1); -#ifdef HD_HAS_displayColor - color.rgb = HdGet_displayColor().rgb; -#endif -#ifdef HD_HAS_displayOpacity - color.a = HdGet_displayOpacity(); -#endif - - vec4 patchCoord = vec4(0); - color = ShadingTerminal(vec4(Peye, 1), Neye, color, patchCoord); - -#ifdef HD_MATERIAL_TAG_MASKED - if (ShouldDiscardByAlpha(color)) { - discard; - } -#endif - - RenderOutput(vec4(Peye, 1), Neye, color, patchCoord); -} - - -int GetPointId() -{ - return vsPointId; -} - -OK From e1966fe2b325d92f75d397612238f7e7ccc8c75b Mon Sep 17 00:00:00 2001 From: pixar-oss Date: Mon, 14 Oct 2024 13:10:24 -0700 Subject: [PATCH 37/82] Updated our CMake pxr_test_scripts macro to allow us to install test files using a specified destination name so that python test files can be installed with their .py extension to be importable as modules for other tests. An explicit destination is specified by appending ':' to the file in the pxr_test_scripts entry like: pxr_test_scripts( testenv/test1.py testenv/test2.py:explicitDestinationName.py ) (Internal change: 2344517) --- cmake/macros/Public.cmake | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/cmake/macros/Public.cmake b/cmake/macros/Public.cmake index 1b809e738d..da4b0e2cb0 100644 --- a/cmake/macros/Public.cmake +++ b/cmake/macros/Public.cmake @@ -658,7 +658,24 @@ function(pxr_test_scripts) endif() foreach(file ${ARGN}) - get_filename_component(destFile ${file} NAME_WE) + # Perform regex match to extract both source resource path and + # destination resource path. + # Regex match appropriately takes care of windows drive letter followed + # by a ":", which is also the token we use to separate the source and + # destination resource paths. + string(REGEX MATCHALL "([A-Za-z]:)?([^:]+)" file "${file}") + + list(LENGTH file n) + if (n EQUAL 1) + get_filename_component(destFile ${file} NAME_WE) + elseif (n EQUAL 2) + list(GET file 1 destFile) + list(GET file 0 file) + else() + message(FATAL_ERROR + "Failed to parse test file path ${file}") + endif() + # XXX -- We shouldn't have to install to run tests. install( PROGRAMS ${file} From d1a5807cb1196469dbaedc03f4977c752b08cab8 Mon Sep 17 00:00:00 2001 From: pixar-oss Date: Mon, 14 Oct 2024 13:10:43 -0700 Subject: [PATCH 38/82] Adding missing test testUsdNamespaceEditorTargetPathFixup to CMakelist (Internal change: 2344522) --- pxr/usd/usd/CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pxr/usd/usd/CMakeLists.txt b/pxr/usd/usd/CMakeLists.txt index 87c8a01bba..df3c383bf2 100644 --- a/pxr/usd/usd/CMakeLists.txt +++ b/pxr/usd/usd/CMakeLists.txt @@ -235,6 +235,7 @@ pxr_test_scripts( testenv/testUsdModel.py testenv/testUsdNamespaceEditor.py testenv/testUsdNamespaceEditorProperties.py + testenv/testUsdNamespaceEditorTargetPathFixup.py testenv/testUsdNotices.py testenv/testUsdObjectsChangedNotices.py testenv/testUsdOpaqueAttributes.py @@ -662,6 +663,11 @@ pxr_install_test_dir( DEST testUsdNamespaceEditorProperties ) +pxr_install_test_dir( + SRC testenv/testUsdNamespaceEditorTargetPathFixup + DEST testUsdNamespaceEditorTargetPathFixup +) + pxr_install_test_dir( SRC testenv/testUsdPrims.testenv DEST testUsdPrims @@ -1280,6 +1286,12 @@ pxr_register_test(testUsdNamespaceEditorProperties EXPECTED_RETURN_CODE 0 ) +pxr_register_test(testUsdNamespaceEditorTargetPathFixup + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdNamespaceEditorTargetPathFixup" + EXPECTED_RETURN_CODE 0 +) + pxr_register_test(testUsdReadOutOfBounds PYTHON COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdReadOutOfBounds" From 94b0c792f5d157ec0c90d017c05f64345c0ef310 Mon Sep 17 00:00:00 2001 From: unhyperbolic Date: Mon, 14 Oct 2024 13:11:11 -0700 Subject: [PATCH 39/82] Changing the hydra schema template to not include the api.h if the respective library does not require symbol visibility attributes for its functions. (Internal change: 2344572) --- pxr/imaging/hd/codegenTemplates/schemaClass.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pxr/imaging/hd/codegenTemplates/schemaClass.h b/pxr/imaging/hd/codegenTemplates/schemaClass.h index aff00a12fe..15254941e5 100644 --- a/pxr/imaging/hd/codegenTemplates/schemaClass.h +++ b/pxr/imaging/hd/codegenTemplates/schemaClass.h @@ -19,11 +19,12 @@ #define {{ HEADER_GUARD|snake }}_{{ FILE_NAME|snake }}_H /// \file - +{% if LIBRARY_API %} #include "{{ INCLUDE_PATH }}/api.h" +{%- endif -%} {%- if SCHEMA_INCLUDES is defined -%} -{%- for t in SCHEMA_INCLUDES %} +{% for t in SCHEMA_INCLUDES %} #include "{{ t | expand }}.h" {%- endfor -%} {%- endif %} @@ -75,7 +76,7 @@ PXR_NAMESPACE_OPEN_SCOPE {%- endfor -%} {%- endif %} -TF_DECLARE_PUBLIC_TOKENS({{SCHEMA_CLASS_NAME}}Tokens, {{ LIBRARY_API }}, +TF_DECLARE_PUBLIC_TOKENS({{SCHEMA_CLASS_NAME}}Tokens,{% if LIBRARY_API%} {{ LIBRARY_API }},{% endif %} {{ SCHEMA_CLASS_NAME|snake }}_TOKENS); //----------------------------------------------------------------------------- From eb7c7c6bd7b9570a20025cf21583ca16106a1911 Mon Sep 17 00:00:00 2001 From: rajabala Date: Mon, 14 Oct 2024 15:59:20 -0700 Subject: [PATCH 40/82] [usdImaging] Transport additional USD prim info to Hydra. (Internal change: 2344616) --- .../usdImaging/dataSourceUsdPrimInfo.cpp | 37 +++- pxr/usdImaging/usdImaging/hdSchemaDefs.py | 13 +- .../baseline/basic.txt | 16 ++ .../usdImaging/usdPrimInfoSchema.cpp | 160 +++++++++++++----- pxr/usdImaging/usdImaging/usdPrimInfoSchema.h | 63 +++++-- 5 files changed, 215 insertions(+), 74 deletions(-) diff --git a/pxr/usdImaging/usdImaging/dataSourceUsdPrimInfo.cpp b/pxr/usdImaging/usdImaging/dataSourceUsdPrimInfo.cpp index f74b2186e1..63e2351de8 100644 --- a/pxr/usdImaging/usdImaging/dataSourceUsdPrimInfo.cpp +++ b/pxr/usdImaging/usdImaging/dataSourceUsdPrimInfo.cpp @@ -59,8 +59,11 @@ TfTokenVector UsdImagingDataSourceUsdPrimInfo::GetNames() { TfTokenVector result = { + UsdImagingUsdPrimInfoSchemaTokens->specifier, + UsdImagingUsdPrimInfoSchemaTokens->typeName, UsdImagingUsdPrimInfoSchemaTokens->isLoaded, - UsdImagingUsdPrimInfoSchemaTokens->specifier + UsdImagingUsdPrimInfoSchemaTokens->apiSchemas, + UsdImagingUsdPrimInfoSchemaTokens->kind, }; if (_usdPrim.IsInstance()) { @@ -77,13 +80,35 @@ UsdImagingDataSourceUsdPrimInfo::GetNames() HdDataSourceBaseHandle UsdImagingDataSourceUsdPrimInfo::Get(const TfToken &name) { - if (name == UsdImagingUsdPrimInfoSchemaTokens->isLoaded) { - return HdRetainedTypedSampledDataSource::New( - _usdPrim.IsLoaded()); - } + using BoolDataSource = HdRetainedTypedSampledDataSource; + using TokenDataSource = HdRetainedTypedSampledDataSource; + using TokenArrayDataSource = + HdRetainedTypedSampledDataSource>; + if (name == UsdImagingUsdPrimInfoSchemaTokens->specifier) { return _SpecifierToDataSource(_usdPrim.GetSpecifier()); } + if (name == UsdImagingUsdPrimInfoSchemaTokens->typeName) { + return TokenDataSource::New(_usdPrim.GetTypeName()); + } + if (name == UsdImagingUsdPrimInfoSchemaTokens->isLoaded) { + return BoolDataSource::New(_usdPrim.IsLoaded()); + } + if (name == UsdImagingUsdPrimInfoSchemaTokens->apiSchemas) { + const TfTokenVector appliedSchemas = _usdPrim.GetAppliedSchemas(); + if (!appliedSchemas.empty()) { + return TokenArrayDataSource::New( + VtArray(appliedSchemas.begin(), appliedSchemas.end())); + } + return nullptr; + } + if (name == UsdImagingUsdPrimInfoSchemaTokens->kind) { + TfToken kind; + if (_usdPrim.GetKind(&kind)) { + return TokenDataSource::New(kind); + } + return nullptr; + } if (name == UsdImagingUsdPrimInfoSchemaTokens->niPrototypePath) { if (!_usdPrim.IsInstance()) { return nullptr; @@ -99,7 +124,7 @@ UsdImagingDataSourceUsdPrimInfo::Get(const TfToken &name) if (!_usdPrim.IsPrototype()) { return nullptr; } - return HdRetainedTypedSampledDataSource::New(true); + return BoolDataSource::New(true); } return nullptr; } diff --git a/pxr/usdImaging/usdImaging/hdSchemaDefs.py b/pxr/usdImaging/usdImaging/hdSchemaDefs.py index df0160f3d1..c7e5417a8a 100644 --- a/pxr/usdImaging/usdImaging/hdSchemaDefs.py +++ b/pxr/usdImaging/usdImaging/hdSchemaDefs.py @@ -17,11 +17,18 @@ SCHEMA_TOKEN = '__usdPrimInfo', ADD_DEFAULT_LOCATOR = True, MEMBERS = [ + ('specifier', T_TOKEN, {}), + ('typeName', T_TOKEN, {}), + ('isLoaded', T_BOOL, {}), + # Skipping isModel and isGroup, which can be inferred from 'kind'. + ('apiSchemas', T_TOKENARRAY, {}), + ('kind', T_TOKEN, {}), + # XXX Add variantSets. Is it a token array, or a container of token + # to token array? ('niPrototypePath', T_PATH, dict(ADD_LOCATOR=True)), ('isNiPrototype', T_BOOL, {}), - ('specifier', T_TOKEN, {}), ('piPropagatedPrototypes', T_CONTAINER, {}), - ('isLoaded', T_BOOL, {}), + ], STATIC_TOKEN_DATASOURCE_BUILDERS = [ ('specifier', ['def', 'over', '(class_, "class")']), @@ -196,4 +203,4 @@ ('namespacedSettings', T_CONTAINER, dict(ADD_LOCATOR=True)), ], ), -] +] diff --git a/pxr/usdImaging/usdImaging/testenv/testUsdImagingStageSceneIndexContents/baseline/basic.txt b/pxr/usdImaging/usdImaging/testenv/testUsdImagingStageSceneIndexContents/baseline/basic.txt index febc141946..3240de58f7 100644 --- a/pxr/usdImaging/usdImaging/testenv/testUsdImagingStageSceneIndexContents/baseline/basic.txt +++ b/pxr/usdImaging/usdImaging/testenv/testUsdImagingStageSceneIndexContents/baseline/basic.txt @@ -14,6 +14,8 @@ 1 [specifier] def + [typeName] + Xform [primOrigin] [scenePath] HdPrimOriginSchema::OriginPath(/CoordSys) @@ -24,6 +26,8 @@ 1 [specifier] def + [typeName] + Xform [primOrigin] [scenePath] HdPrimOriginSchema::OriginPath(/CoordSys/modelSpace) @@ -34,6 +38,8 @@ 1 [specifier] def + [typeName] + Xform [primOrigin] [scenePath] HdPrimOriginSchema::OriginPath(/CoordSys/worldSpace) @@ -49,16 +55,22 @@ 1 [specifier] def + [typeName] + Xform [primOrigin] [scenePath] HdPrimOriginSchema::OriginPath(/Geom) [primvars] type = mesh [__usdPrimInfo] + [apiSchemas] + [MaterialBindingAPI, CoordSysAPI:worldSpace, CoordSysAPI:modelSpace] [isLoaded] 1 [specifier] def + [typeName] + Mesh [coordSysBinding] [modelSpace] /CoordSys/modelSpace @@ -137,6 +149,8 @@ 1 [specifier] def + [typeName] + Scope [primOrigin] [scenePath] HdPrimOriginSchema::OriginPath(/Materials) @@ -147,6 +161,8 @@ 1 [specifier] def + [typeName] + Material [material] [] [interfaceMappings] diff --git a/pxr/usdImaging/usdImaging/usdPrimInfoSchema.cpp b/pxr/usdImaging/usdImaging/usdPrimInfoSchema.cpp index aa75095fdc..a575d84452 100644 --- a/pxr/usdImaging/usdImaging/usdPrimInfoSchema.cpp +++ b/pxr/usdImaging/usdImaging/usdPrimInfoSchema.cpp @@ -32,56 +32,105 @@ TF_DEFINE_PUBLIC_TOKENS(UsdImagingUsdPrimInfoSchemaTokens, // --(BEGIN CUSTOM CODE: Schema Methods)-- // --(END CUSTOM CODE: Schema Methods)-- -HdPathDataSourceHandle -UsdImagingUsdPrimInfoSchema::GetNiPrototypePath() const +HdTokenDataSourceHandle +UsdImagingUsdPrimInfoSchema::GetSpecifier() const { - return _GetTypedDataSource( - UsdImagingUsdPrimInfoSchemaTokens->niPrototypePath); + return _GetTypedDataSource( + UsdImagingUsdPrimInfoSchemaTokens->specifier); +} + +HdTokenDataSourceHandle +UsdImagingUsdPrimInfoSchema::GetTypeName() const +{ + return _GetTypedDataSource( + UsdImagingUsdPrimInfoSchemaTokens->typeName); } HdBoolDataSourceHandle -UsdImagingUsdPrimInfoSchema::GetIsNiPrototype() const +UsdImagingUsdPrimInfoSchema::GetIsLoaded() const { return _GetTypedDataSource( - UsdImagingUsdPrimInfoSchemaTokens->isNiPrototype); + UsdImagingUsdPrimInfoSchemaTokens->isLoaded); +} + +HdTokenArrayDataSourceHandle +UsdImagingUsdPrimInfoSchema::GetApiSchemas() const +{ + return _GetTypedDataSource( + UsdImagingUsdPrimInfoSchemaTokens->apiSchemas); } HdTokenDataSourceHandle -UsdImagingUsdPrimInfoSchema::GetSpecifier() const +UsdImagingUsdPrimInfoSchema::GetKind() const { return _GetTypedDataSource( - UsdImagingUsdPrimInfoSchemaTokens->specifier); + UsdImagingUsdPrimInfoSchemaTokens->kind); } -HdContainerDataSourceHandle -UsdImagingUsdPrimInfoSchema::GetPiPropagatedPrototypes() const +HdPathDataSourceHandle +UsdImagingUsdPrimInfoSchema::GetNiPrototypePath() const { - return _GetTypedDataSource( - UsdImagingUsdPrimInfoSchemaTokens->piPropagatedPrototypes); + return _GetTypedDataSource( + UsdImagingUsdPrimInfoSchemaTokens->niPrototypePath); } HdBoolDataSourceHandle -UsdImagingUsdPrimInfoSchema::GetIsLoaded() const +UsdImagingUsdPrimInfoSchema::GetIsNiPrototype() const { return _GetTypedDataSource( - UsdImagingUsdPrimInfoSchemaTokens->isLoaded); + UsdImagingUsdPrimInfoSchemaTokens->isNiPrototype); +} + +HdContainerDataSourceHandle +UsdImagingUsdPrimInfoSchema::GetPiPropagatedPrototypes() const +{ + return _GetTypedDataSource( + UsdImagingUsdPrimInfoSchemaTokens->piPropagatedPrototypes); } /*static*/ HdContainerDataSourceHandle UsdImagingUsdPrimInfoSchema::BuildRetained( + const HdTokenDataSourceHandle &specifier, + const HdTokenDataSourceHandle &typeName, + const HdBoolDataSourceHandle &isLoaded, + const HdTokenArrayDataSourceHandle &apiSchemas, + const HdTokenDataSourceHandle &kind, const HdPathDataSourceHandle &niPrototypePath, const HdBoolDataSourceHandle &isNiPrototype, - const HdTokenDataSourceHandle &specifier, - const HdContainerDataSourceHandle &piPropagatedPrototypes, - const HdBoolDataSourceHandle &isLoaded + const HdContainerDataSourceHandle &piPropagatedPrototypes ) { - TfToken _names[5]; - HdDataSourceBaseHandle _values[5]; + TfToken _names[8]; + HdDataSourceBaseHandle _values[8]; size_t _count = 0; + if (specifier) { + _names[_count] = UsdImagingUsdPrimInfoSchemaTokens->specifier; + _values[_count++] = specifier; + } + + if (typeName) { + _names[_count] = UsdImagingUsdPrimInfoSchemaTokens->typeName; + _values[_count++] = typeName; + } + + if (isLoaded) { + _names[_count] = UsdImagingUsdPrimInfoSchemaTokens->isLoaded; + _values[_count++] = isLoaded; + } + + if (apiSchemas) { + _names[_count] = UsdImagingUsdPrimInfoSchemaTokens->apiSchemas; + _values[_count++] = apiSchemas; + } + + if (kind) { + _names[_count] = UsdImagingUsdPrimInfoSchemaTokens->kind; + _values[_count++] = kind; + } + if (niPrototypePath) { _names[_count] = UsdImagingUsdPrimInfoSchemaTokens->niPrototypePath; _values[_count++] = niPrototypePath; @@ -92,60 +141,74 @@ UsdImagingUsdPrimInfoSchema::BuildRetained( _values[_count++] = isNiPrototype; } - if (specifier) { - _names[_count] = UsdImagingUsdPrimInfoSchemaTokens->specifier; - _values[_count++] = specifier; - } - if (piPropagatedPrototypes) { _names[_count] = UsdImagingUsdPrimInfoSchemaTokens->piPropagatedPrototypes; _values[_count++] = piPropagatedPrototypes; } - - if (isLoaded) { - _names[_count] = UsdImagingUsdPrimInfoSchemaTokens->isLoaded; - _values[_count++] = isLoaded; - } return HdRetainedContainerDataSource::New(_count, _names, _values); } UsdImagingUsdPrimInfoSchema::Builder & -UsdImagingUsdPrimInfoSchema::Builder::SetNiPrototypePath( - const HdPathDataSourceHandle &niPrototypePath) +UsdImagingUsdPrimInfoSchema::Builder::SetSpecifier( + const HdTokenDataSourceHandle &specifier) { - _niPrototypePath = niPrototypePath; + _specifier = specifier; return *this; } UsdImagingUsdPrimInfoSchema::Builder & -UsdImagingUsdPrimInfoSchema::Builder::SetIsNiPrototype( - const HdBoolDataSourceHandle &isNiPrototype) +UsdImagingUsdPrimInfoSchema::Builder::SetTypeName( + const HdTokenDataSourceHandle &typeName) { - _isNiPrototype = isNiPrototype; + _typeName = typeName; return *this; } UsdImagingUsdPrimInfoSchema::Builder & -UsdImagingUsdPrimInfoSchema::Builder::SetSpecifier( - const HdTokenDataSourceHandle &specifier) +UsdImagingUsdPrimInfoSchema::Builder::SetIsLoaded( + const HdBoolDataSourceHandle &isLoaded) { - _specifier = specifier; + _isLoaded = isLoaded; return *this; } UsdImagingUsdPrimInfoSchema::Builder & -UsdImagingUsdPrimInfoSchema::Builder::SetPiPropagatedPrototypes( - const HdContainerDataSourceHandle &piPropagatedPrototypes) +UsdImagingUsdPrimInfoSchema::Builder::SetApiSchemas( + const HdTokenArrayDataSourceHandle &apiSchemas) { - _piPropagatedPrototypes = piPropagatedPrototypes; + _apiSchemas = apiSchemas; return *this; } UsdImagingUsdPrimInfoSchema::Builder & -UsdImagingUsdPrimInfoSchema::Builder::SetIsLoaded( - const HdBoolDataSourceHandle &isLoaded) +UsdImagingUsdPrimInfoSchema::Builder::SetKind( + const HdTokenDataSourceHandle &kind) { - _isLoaded = isLoaded; + _kind = kind; + return *this; +} + +UsdImagingUsdPrimInfoSchema::Builder & +UsdImagingUsdPrimInfoSchema::Builder::SetNiPrototypePath( + const HdPathDataSourceHandle &niPrototypePath) +{ + _niPrototypePath = niPrototypePath; + return *this; +} + +UsdImagingUsdPrimInfoSchema::Builder & +UsdImagingUsdPrimInfoSchema::Builder::SetIsNiPrototype( + const HdBoolDataSourceHandle &isNiPrototype) +{ + _isNiPrototype = isNiPrototype; + return *this; +} + +UsdImagingUsdPrimInfoSchema::Builder & +UsdImagingUsdPrimInfoSchema::Builder::SetPiPropagatedPrototypes( + const HdContainerDataSourceHandle &piPropagatedPrototypes) +{ + _piPropagatedPrototypes = piPropagatedPrototypes; return *this; } @@ -153,11 +216,14 @@ HdContainerDataSourceHandle UsdImagingUsdPrimInfoSchema::Builder::Build() { return UsdImagingUsdPrimInfoSchema::BuildRetained( + _specifier, + _typeName, + _isLoaded, + _apiSchemas, + _kind, _niPrototypePath, _isNiPrototype, - _specifier, - _piPropagatedPrototypes, - _isLoaded + _piPropagatedPrototypes ); } diff --git a/pxr/usdImaging/usdImaging/usdPrimInfoSchema.h b/pxr/usdImaging/usdImaging/usdPrimInfoSchema.h index 4b98f599bb..e9afbb476b 100644 --- a/pxr/usdImaging/usdImaging/usdPrimInfoSchema.h +++ b/pxr/usdImaging/usdImaging/usdPrimInfoSchema.h @@ -34,11 +34,14 @@ PXR_NAMESPACE_OPEN_SCOPE #define USD_IMAGING_USD_PRIM_INFO_SCHEMA_TOKENS \ (__usdPrimInfo) \ + (specifier) \ + (typeName) \ + (isLoaded) \ + (apiSchemas) \ + (kind) \ (niPrototypePath) \ (isNiPrototype) \ - (specifier) \ (piPropagatedPrototypes) \ - (isLoaded) \ (def) \ (over) \ ((class_, "class")) \ @@ -76,19 +79,28 @@ class UsdImagingUsdPrimInfoSchema : public HdSchema /// @{ USDIMAGING_API - HdPathDataSourceHandle GetNiPrototypePath() const; + HdTokenDataSourceHandle GetSpecifier() const; USDIMAGING_API - HdBoolDataSourceHandle GetIsNiPrototype() const; + HdTokenDataSourceHandle GetTypeName() const; USDIMAGING_API - HdTokenDataSourceHandle GetSpecifier() const; + HdBoolDataSourceHandle GetIsLoaded() const; USDIMAGING_API - HdContainerDataSourceHandle GetPiPropagatedPrototypes() const; + HdTokenArrayDataSourceHandle GetApiSchemas() const; USDIMAGING_API - HdBoolDataSourceHandle GetIsLoaded() const; + HdTokenDataSourceHandle GetKind() const; + + USDIMAGING_API + HdPathDataSourceHandle GetNiPrototypePath() const; + + USDIMAGING_API + HdBoolDataSourceHandle GetIsNiPrototype() const; + + USDIMAGING_API + HdContainerDataSourceHandle GetPiPropagatedPrototypes() const; /// @} @@ -134,11 +146,14 @@ class UsdImagingUsdPrimInfoSchema : public HdSchema USDIMAGING_API static HdContainerDataSourceHandle BuildRetained( + const HdTokenDataSourceHandle &specifier, + const HdTokenDataSourceHandle &typeName, + const HdBoolDataSourceHandle &isLoaded, + const HdTokenArrayDataSourceHandle &apiSchemas, + const HdTokenDataSourceHandle &kind, const HdPathDataSourceHandle &niPrototypePath, const HdBoolDataSourceHandle &isNiPrototype, - const HdTokenDataSourceHandle &specifier, - const HdContainerDataSourceHandle &piPropagatedPrototypes, - const HdBoolDataSourceHandle &isLoaded + const HdContainerDataSourceHandle &piPropagatedPrototypes ); /// \class UsdImagingUsdPrimInfoSchema::Builder @@ -151,31 +166,43 @@ class UsdImagingUsdPrimInfoSchema : public HdSchema { public: USDIMAGING_API + Builder &SetSpecifier( + const HdTokenDataSourceHandle &specifier); + USDIMAGING_API + Builder &SetTypeName( + const HdTokenDataSourceHandle &typeName); + USDIMAGING_API + Builder &SetIsLoaded( + const HdBoolDataSourceHandle &isLoaded); + USDIMAGING_API + Builder &SetApiSchemas( + const HdTokenArrayDataSourceHandle &apiSchemas); + USDIMAGING_API + Builder &SetKind( + const HdTokenDataSourceHandle &kind); + USDIMAGING_API Builder &SetNiPrototypePath( const HdPathDataSourceHandle &niPrototypePath); USDIMAGING_API Builder &SetIsNiPrototype( const HdBoolDataSourceHandle &isNiPrototype); USDIMAGING_API - Builder &SetSpecifier( - const HdTokenDataSourceHandle &specifier); - USDIMAGING_API Builder &SetPiPropagatedPrototypes( const HdContainerDataSourceHandle &piPropagatedPrototypes); - USDIMAGING_API - Builder &SetIsLoaded( - const HdBoolDataSourceHandle &isLoaded); /// Returns a container data source containing the members set thus far. USDIMAGING_API HdContainerDataSourceHandle Build(); private: + HdTokenDataSourceHandle _specifier; + HdTokenDataSourceHandle _typeName; + HdBoolDataSourceHandle _isLoaded; + HdTokenArrayDataSourceHandle _apiSchemas; + HdTokenDataSourceHandle _kind; HdPathDataSourceHandle _niPrototypePath; HdBoolDataSourceHandle _isNiPrototype; - HdTokenDataSourceHandle _specifier; HdContainerDataSourceHandle _piPropagatedPrototypes; - HdBoolDataSourceHandle _isLoaded; }; From 329bda16be896716b43491eb70d0b060267d3ad0 Mon Sep 17 00:00:00 2001 From: pixar-oss Date: Tue, 15 Oct 2024 10:12:57 -0700 Subject: [PATCH 41/82] Adding basic reference and payload tests for dependent namespace edits in UsdNamespaceEditor. (Internal change: 2344687) --- pxr/usd/usd/CMakeLists.txt | 8 + ...estUsdNamespaceEditorDependentEditsBase.py | 155 ++ ...ependentEditsBasicReferencesAndPayloads.py | 1611 +++++++++++++++++ 3 files changed, 1774 insertions(+) create mode 100644 pxr/usd/usd/testenv/testUsdNamespaceEditorDependentEditsBase.py create mode 100644 pxr/usd/usd/testenv/testUsdNamespaceEditorDependentEditsBasicReferencesAndPayloads.py diff --git a/pxr/usd/usd/CMakeLists.txt b/pxr/usd/usd/CMakeLists.txt index df3c383bf2..2efc40ffd4 100644 --- a/pxr/usd/usd/CMakeLists.txt +++ b/pxr/usd/usd/CMakeLists.txt @@ -234,6 +234,8 @@ pxr_test_scripts( testenv/testUsdMetadata.py testenv/testUsdModel.py testenv/testUsdNamespaceEditor.py + testenv/testUsdNamespaceEditorDependentEditsBase.py:testUsdNamespaceEditorDependentEditsBase.py + testenv/testUsdNamespaceEditorDependentEditsBasicReferencesAndPayloads.py testenv/testUsdNamespaceEditorProperties.py testenv/testUsdNamespaceEditorTargetPathFixup.py testenv/testUsdNotices.py @@ -1280,6 +1282,12 @@ pxr_register_test(testUsdNamespaceEditor EXPECTED_RETURN_CODE 0 ) +pxr_register_test(testUsdNamespaceEditorDependentEditsBasicReferencesAndPayloads + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdNamespaceEditorDependentEditsBasicReferencesAndPayloads" + EXPECTED_RETURN_CODE 0 +) + pxr_register_test(testUsdNamespaceEditorProperties PYTHON COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdNamespaceEditorProperties" diff --git a/pxr/usd/usd/testenv/testUsdNamespaceEditorDependentEditsBase.py b/pxr/usd/usd/testenv/testUsdNamespaceEditorDependentEditsBase.py new file mode 100644 index 0000000000..7d86d3d73d --- /dev/null +++ b/pxr/usd/usd/testenv/testUsdNamespaceEditorDependentEditsBase.py @@ -0,0 +1,155 @@ +#!/pxrpythonsubst +# +# Copyright 2024 Pixar +# +# Licensed under the terms set forth in the LICENSE.txt file available at +# https://openusd.org/license. + +import contextlib, inspect, sys, unittest +from pxr import Sdf, Usd + +class TestUsdNamespaceEditorDependentEditsBase(unittest.TestCase): + '''Base class for testUsdNamespaceEditDependentEditsXXX tests which + provides share utilities for verifying outcomes of edits. + ''' + + @contextlib.contextmanager + def ApplyEdits(self, editor, label, expectWarnings = False): + '''Context manager for adding a namespace edit on a Usd.NameespaceEditor + that will automatically verify that it can be applied and will apply it + verifying a successful apply. It also prints out useful information to + help keep test output organized. + + Example Usage: + editor = Usd.NamespaceEditor(stage) + with self.ApplyEdits(editor, "Move /Foo to /Bar"): + self.assertTrue(editor.MovePrimAtPath('/Foo', '/Bar')) + ''' + + # The enclosing test case function name to output with the begin and + # end messages. + testFunctionName = next((x.function for x in inspect.stack() + if x.function.startswith("test_")), "") + msg = testFunctionName + " : " + label + print("\n==== Begin ApplyEdits : {} ====".format(msg)) + print("\n==== Begin ApplyEdits : {} ====".format(msg), file=sys.stderr) + + yield + + if expectWarnings: + print("\n=== EXPECT WARNINGS ===", file=sys.stderr) + self.assertTrue(editor.CanApplyEdits()) + self.assertTrue(editor.ApplyEdits()) + if expectWarnings: + print("\n=== END EXPECTED WARNINGS ===", file=sys.stderr) + + print("==== End ApplyEdits : {} ====".format(msg)) + print("==== End ApplyEdits : {} ====".format(msg), file=sys.stderr) + + def _VerifyPrimContents(self, prim, expectedContentsDict): + '''Helper that verifies the contents of a USD prim, specifically its + child prims and properties, match the given expected contents. + + A prims expected contents are expressed as a dictionary of the form + + { + '.' : ['propName1', 'propName2'], + 'Child1' : {...child prim expected contents...}, + 'Child2' : {...child prim expected contents...} + } + ''' + + # '.' is used to key the list of expected property names for the prim + expectedPropertyNameSet = set(expectedContentsDict.get('.', [])) + + # Get the actual property names and compare against the expected set. + propertyNameSet = set(prim.GetPropertyNames()) + self.assertEqual(propertyNameSet, expectedPropertyNameSet, + "The actual property set {} does not match the expected property " + "set {} for the prim at path {}".format( + list(propertyNameSet), + list(expectedPropertyNameSet), + prim.GetPath())) + + # Expected children names are all the expected contents keys except '.' + expectedChildNameSet = set( + [k for k in expectedContentsDict.keys() if k != '.']) + + # Get the actual child prim names and compare against the expected set. + # We specifically want all children so we get unloaded prims and prims + # that aren't defined (they are just overs) + childrenNameSet = set(prim.GetAllChildrenNames()) + self.assertEqual(childrenNameSet, expectedChildNameSet, + "The actual child prim set {} does not match the expected children " + "set {} for the prim at path {}".format( + list(childrenNameSet), + list(expectedChildNameSet), + prim.GetPath())) + + # Verify the expected contents of each expected child prim. + for childName in expectedChildNameSet: + childPath = prim.GetPath().AppendChild(childName) + primChild = prim.GetPrimAtPath(childPath) + self._VerifyPrimContents(primChild, expectedContentsDict[childName]) + + def _VerifyStageContents(self, stage, expectedContentsDict): + '''Helper that verifies the contents of every USD prim on the given + stage, specifically each's child prims and properties, match the given + expected contents dictionary.''' + + self._VerifyPrimContents(stage.GetPseudoRoot(), expectedContentsDict) + + def _GetCompositionFieldsInLayer(self, layer): + '''Helper that finds all prims specs with composition fields set in the + given layer and returns a dictionary of prim paths to the fields and + their values. + + Example output: + + { + '/' : { + relocates : (('/Prim/Foo', '/Prim/Bar), ) + }, + '/Prim' : { + references : [Sdf.Refence(layer, '/RefPath')], + payload : [Sdf.Payload(layer, '/PayloadPath)] + }, + '/PrimA/ChildA' : { + inherits : ['/GlobalClass', '/PrimA/LocalClass'] + } + } + ''' + + compositionFields = {} + + # Relocates are only in layer metadata so add them as belonging to the + # pseudoroot if there are any. + if layer.HasRelocates(): + compositionFields ['/'] = {'relocates' : layer.relocates} + + def _GetCompositonFieldsForPrimAtPath(path) : + if not path.IsPrimPath() and not path.IsPrimVariantSelectionPath(): + return + + def _AddListOpValueForField(fieldName, listOp): + if not path in compositionFields: + compositionFields[str(path)] = {} + compositionFields[str(path)][fieldName] = listOp.GetAppliedItems() + + prim = layer.GetPrimAtPath(path) + if prim is None: + return + if prim.hasReferences: + _AddListOpValueForField('references', prim.referenceList) + if prim.hasPayloads: + _AddListOpValueForField('payload', prim.payloadList) + if prim.hasInheritPaths: + _AddListOpValueForField('inherits', prim.inheritPathList) + if prim.hasSpecializes: + _AddListOpValueForField('specializes', prim.specializesList) + + layer.Traverse("/", _GetCompositonFieldsForPrimAtPath) + return compositionFields + +if __name__ == '__main__': + unittest.main() diff --git a/pxr/usd/usd/testenv/testUsdNamespaceEditorDependentEditsBasicReferencesAndPayloads.py b/pxr/usd/usd/testenv/testUsdNamespaceEditorDependentEditsBasicReferencesAndPayloads.py new file mode 100644 index 0000000000..59372709ec --- /dev/null +++ b/pxr/usd/usd/testenv/testUsdNamespaceEditorDependentEditsBasicReferencesAndPayloads.py @@ -0,0 +1,1611 @@ +#!/pxrpythonsubst +# +# Copyright 2024 Pixar +# +# Licensed under the terms set forth in the LICENSE.txt file available at +# https://openusd.org/license. + +import sys, unittest +from pxr import Sdf, Usd +from testUsdNamespaceEditorDependentEditsBase \ + import TestUsdNamespaceEditorDependentEditsBase + +class TestUsdNamespaceEditorDependentEditsBasicReferencesAndPayloads( + TestUsdNamespaceEditorDependentEditsBase): + '''Tests downstream dependency namespace edits across references and + payloads.''' + + def test_BasicDependentReferences(self): + """Test downstream dependency namespace edits across basic single + references, both internal and in separate layers """ + + # Setup: + # Layer 1 has simple hierarchy of /Ref, Child, and GrandChild that is + # referenced and will be namespace edited. It also has three prims + # that internally reference /Ref, /Ref/Child, and /Ref/Child/GrandChild + # respectively. These internally referencing prims will be affected by + # downstream dependency edits. + layer1 = Sdf.Layer.CreateAnonymous("layer1.usda") + layer1ImportString = '''#usda 1.0 + def "Ref" { + int refAttr + + def "Child" { + int childAttr + + def "GrandChild" { + int grandChildAttr + } + } + } + + def "InternalRef1" ( + references = + ) { + over "Child" { + int overChildAttr + over "GrandChild" { + int overGrandChildAttr + } + } + def "LocalChild" {} + int localAttr + } + + def "InternalRef2" ( + references = + ) { + over "GrandChild" { + int overGrandChildAttr + } + def "LocalChild" {} + int localAttr + } + + def "InternalRef3" ( + references = + ) { + def "LocalChild" {} + int localAttr + } + ''' + layer1.ImportFromString(layer1ImportString) + + # Layer 2 has three prims that reference /Ref, /Ref/Child, and + # /Ref/Child/GrandChild from layer 1 respectively. These prims will be + # affected by downstream dependency edits. + layer2 = Sdf.Layer.CreateAnonymous("layer2.usda") + layer2ImportString = '''#usda 1.0 + def "Prim1" ( + references = @''' + layer1.identifier + '''@ + ) { + over "Child" { + int overChildAttr + over "GrandChild" { + int overGrandChildAttr + } + } + def "LocalChild" {} + int localAttr + } + + def "Prim2" ( + references = @''' + layer1.identifier + '''@ + ) { + over "GrandChild" { + int overGrandChildAttr + } + def "LocalChild" {} + int localAttr + } + + def "Prim3" ( + references = @''' + layer1.identifier + '''@ + ) { + def "LocalChild" {} + int localAttr + } + ''' + layer2.ImportFromString(layer2ImportString) + + # Open both layers as stages. + stage1 = Usd.Stage.Open(layer1, Usd.Stage.LoadAll) + stage2 = Usd.Stage.Open(layer2, Usd.Stage.LoadAll) + + # Create an editor for stage 1 with stage 2 as an addtional dependent + # stage. + editor = Usd.NamespaceEditor(stage1) + editor.AddDependentStage(stage2) + + # Verify the initial composition fields for both layers. + self.assertEqual(self._GetCompositionFieldsInLayer(layer1), { + '/InternalRef1' : { + 'references' : (Sdf.Reference(primPath='/Ref'),) + }, + '/InternalRef2' : { + 'references' : (Sdf.Reference(primPath='/Ref/Child'),) + }, + '/InternalRef3' : { + 'references' : (Sdf.Reference(primPath='/Ref/Child/GrandChild'),) + }, + }) + + self.assertEqual(self._GetCompositionFieldsInLayer(layer2), { + '/Prim1' : { + 'references' : (Sdf.Reference(layer1.identifier, '/Ref'),) + }, + '/Prim2' : { + 'references' : (Sdf.Reference(layer1.identifier, '/Ref/Child'),) + }, + '/Prim3' : { + 'references' : (Sdf.Reference(layer1.identifier, + '/Ref/Child/GrandChild'),) + }, + }) + + # Both the internal reference prims in stage 1 and the "regular" + # reference prims in stage 2 will have same contents since they + # reference the same prims and define identical local specs. So, + # we create expected contents dictionaries that we can share for + # verification. + refToRefContents = { + '.' : ['refAttr', 'localAttr'], + 'Child' : { + '.' : ['childAttr', 'overChildAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'overGrandChildAttr'], + }, + }, + 'LocalChild' : {} + } + + refToChildContents = { + '.' : ['childAttr', 'localAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'overGrandChildAttr'], + }, + 'LocalChild' : {}, + } + + refToGrandChildContents = { + '.' : ['grandChildAttr', 'localAttr'], + 'LocalChild' : {}, + } + + # Verify the expected contents of stage 1 + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + 'Child' : { + '.' : ['childAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr'], + } + } + }, + 'InternalRef1' : refToRefContents, + 'InternalRef2' : refToChildContents, + 'InternalRef3' : refToGrandChildContents + }) + + # Verify the expected contents of stage 2. + self._VerifyStageContents(stage2, { + 'Prim1' : refToRefContents, + 'Prim2' : refToChildContents, + 'Prim3' : refToGrandChildContents + }) + + # Edit: Rename /Ref/Child to /Ref/RenamedChild + with self.ApplyEdits(editor, "Move /Ref/Child -> /Ref/RenamedChild"): + self.assertTrue(editor.MovePrimAtPath( + '/Ref/Child', '/Ref/RenamedChild')) + + # Verify the updated composition fields in layer1. The internal + # reference fields to /Ref/Child and its descendant + # /Ref/Child/GrandChild have been updated to use the renamed paths. + self.assertEqual(self._GetCompositionFieldsInLayer(layer1), { + '/InternalRef1' : { + 'references' : (Sdf.Reference(primPath='/Ref'),) + }, + '/InternalRef2' : { + 'references' : (Sdf.Reference(primPath='/Ref/RenamedChild'),) + }, + '/InternalRef3' : { + 'references' : (Sdf.Reference( + primPath='/Ref/RenamedChild/GrandChild'),) + }, + }) + + # Verify the udpated composition fields in layer2. The reference fields + # to /Ref/Child and its descendant /Ref/Child/GrandChild have been + # similarly updated to use the renamed paths. + self.assertEqual(self._GetCompositionFieldsInLayer(layer2), { + '/Prim1' : { + 'references' : (Sdf.Reference(layer1.identifier, '/Ref'),) + }, + '/Prim2' : { + 'references' : (Sdf.Reference(layer1.identifier, + '/Ref/RenamedChild'),) + }, + '/Prim3' : { + 'references' : (Sdf.Reference(layer1.identifier, + '/Ref/RenamedChild/GrandChild'),) + }, + }) + + # Verify the updated stage contents for both stages. + # + # For the both prims that directly reference /Ref, the child prim is + # renamed to RenamedChild. Note that this means the local override specs + # for the referencing prims have been renamed to RenamedChild too which + # is why the composed RenamedChild prim still has both childAttr and + # overChildAttr and the composed GrandChild remains unchanged + # + # The contents of the other two prims in each stage remain unchanged + # as the update to the reference fields allow those prims to remain the + # same. + refToRefContents = { + '.' : ['refAttr', 'localAttr'], + 'RenamedChild' : { + '.' : ['childAttr', 'overChildAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'overGrandChildAttr'], + }, + }, + 'LocalChild' : {}, + } + + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + 'RenamedChild' : { + '.' : ['childAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr'], + } + } + }, + 'InternalRef1' : refToRefContents, + 'InternalRef2' : refToChildContents, + 'InternalRef3' : refToGrandChildContents + }) + + self._VerifyStageContents(stage2, { + 'Prim1' : refToRefContents, + 'Prim2' : refToChildContents, + 'Prim3' : refToGrandChildContents + }) + + # Edit: Reparent and rename /Ref/RenamedChild to /MovedChild + with self.ApplyEdits(editor, "Move /Ref/RenamedChild -> /MovedChild"): + self.assertTrue(editor.MovePrimAtPath( + '/Ref/RenamedChild', '/MovedChild')) + + # Verify the udpated composition fields in layer1. The internal + # reference fields to /Ref/RenamedChild and its descendant + # /Ref/RenamedChild/GrandChild have been updated to use the moved paths. + self.assertEqual(self._GetCompositionFieldsInLayer(layer1), { + '/InternalRef1' : { + 'references' : (Sdf.Reference(primPath='/Ref'),) + }, + '/InternalRef2' : { + 'references' : (Sdf.Reference(primPath='/MovedChild'),) + }, + '/InternalRef3' : { + 'references' : (Sdf.Reference(primPath='/MovedChild/GrandChild'),) + }, + }) + + # Verify the udpated composition fields in layer2. The reference fields + # to /Ref/RenamedChild and its descendant /Ref/RenamedChild/GrandChild + # have been similarly updated to use the moved paths. + self.assertEqual(self._GetCompositionFieldsInLayer(layer2), { + '/Prim1' : { + 'references' : (Sdf.Reference(layer1.identifier, '/Ref'),) + }, + '/Prim2' : { + 'references' : (Sdf.Reference(layer1.identifier, '/MovedChild'),) + }, + '/Prim3' : { + 'references' : (Sdf.Reference(layer1.identifier, + '/MovedChild/GrandChild'),) + }, + }) + + # Verify the updated stage contents for both stages. + # + # For both prims that directly reference /Ref, since RenamedChild has + # been moved out of /Ref, it is no longer a composed child of the + # referencing prims. Note that the over to RenamedChild (which brought + # in the attributes overChildAttr and GrandChild.overChildAttr) has been + # deleted to prevent the reintroduction of a partially specced + # RenamedChild. + # + # The contents of the other two prims in each stage remain unchanged + # as the update to the reference fields allow those prims to remain the + # same. + refToRefContents = { + '.' : ['refAttr', 'localAttr'], + 'LocalChild' : {}, + } + + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + }, + 'MovedChild' : { + '.' : ['childAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr'], + } + }, + 'InternalRef1' : refToRefContents, + 'InternalRef2' : refToChildContents, + 'InternalRef3' : refToGrandChildContents + }) + + self._VerifyStageContents(stage2, { + 'Prim1' : refToRefContents, + 'Prim2' : refToChildContents, + 'Prim3' : refToGrandChildContents + }) + + # Edit: Reparent and rename /MovedChild back to its original path + # /Ref/Child + with self.ApplyEdits(editor, "Move /MovedChild -> /Ref/Child"): + self.assertTrue(editor.MovePrimAtPath('/MovedChild', '/Ref/Child')) + + # Verify the udpated composition fields in layer1 and layer2. All the + # reference fields have been updated to their original paths. + self.assertEqual(self._GetCompositionFieldsInLayer(layer1), { + '/InternalRef1' : { + 'references' : (Sdf.Reference(primPath='/Ref'),) + }, + '/InternalRef2' : { + 'references' : (Sdf.Reference(primPath='/Ref/Child'),) + }, + '/InternalRef3' : { + 'references' : (Sdf.Reference(primPath='/Ref/Child/GrandChild'),) + }, + }) + + self.assertEqual(self._GetCompositionFieldsInLayer(layer2), { + '/Prim1' : { + 'references' : (Sdf.Reference(layer1.identifier, '/Ref'),) + }, + '/Prim2' : { + 'references' : (Sdf.Reference(layer1.identifier, '/Ref/Child'),) + }, + '/Prim3' : { + 'references' : (Sdf.Reference(layer1.identifier, + '/Ref/Child/GrandChild'),) + }, + }) + + # Verify the updated stage contents for both stages. + # + # For both prims that directly reference /Ref, they are returned to + # their original contents with one notable exception: the overs on + # Child that introduced overChildAttr and GrandChild.overGrandChildAttr + # are NOT restored from being deleted so these attributes are not + # present like they were in the initial state of the stages. + # + # The contents of the other two prims in each stage remain unchanged + # (which matches their initial state) as the update to the reference + # fields allow those prims to remain the same. + refToRefContents = { + '.' : ['refAttr', 'localAttr'], + 'Child' : { + '.' : ['childAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr'] + } + }, + 'LocalChild' : {}, + } + + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + 'Child' : { + '.' : ['childAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr'], + } + } + }, + 'InternalRef1' : refToRefContents, + 'InternalRef2' : refToChildContents, + 'InternalRef3' : refToGrandChildContents + }) + + self._VerifyStageContents(stage2, { + 'Prim1' : refToRefContents, + 'Prim2' : refToChildContents, + 'Prim3' : refToGrandChildContents + }) + + # Reset both layers before the next operation to return the overs on the + # prims that reference /Ref + layer1.ImportFromString(layer1ImportString) + layer2.ImportFromString(layer2ImportString) + + # Verify the stage contents which again have the initial overs. + refToRefContents = { + '.' : ['refAttr', 'localAttr'], + 'Child' : { + '.' : ['childAttr', 'overChildAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'overGrandChildAttr'] + } + }, + 'LocalChild' : {}, + } + + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + 'Child' : { + '.' : ['childAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr'], + } + } + }, + 'InternalRef1' : refToRefContents, + 'InternalRef2' : refToChildContents, + 'InternalRef3' : refToGrandChildContents + }) + + self._VerifyStageContents(stage2, { + 'Prim1' : refToRefContents, + 'Prim2' : refToChildContents, + 'Prim3' : refToGrandChildContents + }) + + # Edit: Delete the prim at /Ref/Child + with self.ApplyEdits(editor, "Delete /Ref/Child"): + self.assertTrue(editor.DeletePrimAtPath('/Ref/Child')) + + # Verify the udpated composition fields in layer1 and layer2. All the + # reference fields that reference /Ref/Child or its descendants have + # had those references removed. Note the reference fields remain but the + # values are empty. + self.assertEqual(self._GetCompositionFieldsInLayer(layer1), { + '/InternalRef1' : { + 'references' : (Sdf.Reference(primPath='/Ref'),) + }, + '/InternalRef2' : { + 'references' : () + }, + '/InternalRef3' : { + 'references' : () + }, + }) + + self.assertEqual(self._GetCompositionFieldsInLayer(layer2), { + '/Prim1' : { + 'references' : (Sdf.Reference(layer1.identifier, '/Ref'),) + }, + '/Prim2' : { + 'references' : () + }, + '/Prim3' : { + 'references' : () + }, + }) + + # Verify the updated stage contents for both stages. + # + # For both prims that directly reference /Ref, since Child has been + # deleted as a child of from /Ref, it is no longer a composed child of + # these referencing prims. Note that the overs to Child (which brought + # in the attributes overChildAttr and GrandChild.overChildAttr) have + # been deleted to prevent the reintroduction of a partially specced + # Child. + # + # Unlike all the prior edits in this test case, the contents of the + # other two prims in each stage DO change because the references have + # been deleted and can no longer compose contents from across them. + # Addtionally any child specs in the referencing prims that would've + # comosed over the now deleted referenced prim's children are also + # deleted to "truly delete" all composed prims from the deleted + # reference. + # + # XXX: There is an open question as to whether this is the correct + # behavior or if we should go a step further and delete the specs that + # introduced the now deleted reference prims (instead of just removing + # the reference but not the referencing prim itself like we do now). + # This expanded approach would result in the InternalRef2, InternalRef3, + # Prim2, and Prim3 prims being completely deleted from their stages. + refToRefContents = { + '.' : ['refAttr', 'localAttr'], + 'LocalChild' : {}, + } + + refToChildContents = { + '.' : ['localAttr'], + 'LocalChild' : {}, + } + + refToGrandChildContents = { + '.' : ['localAttr'], + 'LocalChild' : {}, + } + + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + }, + 'InternalRef1' : refToRefContents, + 'InternalRef2' : refToChildContents, + 'InternalRef3' : refToGrandChildContents + }) + + self._VerifyStageContents(stage2, { + 'Prim1' : refToRefContents, + 'Prim2' : refToChildContents, + 'Prim3' : refToGrandChildContents + }) + + def test_BasicDependentPayloads(self): + """Test downstream dependency namespace edits across basic single + payloads.""" + + # Setup: + # Layer 1 has simple hierarchy of /Ref, Child, GrandChild that is + # referenced and will be namespace edited. + layer1 = Sdf.Layer.CreateAnonymous("layer1.usda") + layer1.ImportFromString('''#usda 1.0 + def "Ref" { + int refAttr + + def "Child" { + int childAttr + + def "GrandChild" { + int grandChildAttr + } + } + } + ''') + + # Layer 2 has three prims that payload /Ref, /Ref/Child, and + # /Ref/Child/GrandChild from layer 1 respectively. These will be + # affected by downstream dependency edits. + layer2 = Sdf.Layer.CreateAnonymous("layer2.usda") + layer2.ImportFromString('''#usda 1.0 + def "Prim1" ( + payload = @''' + layer1.identifier + '''@ + ) { + over "Child" { + int overChildAttr + over "GrandChild" { + int overGrandChildAttr + } + } + def "LocalChild" {} + int localAttr + } + + def "Prim2" ( + payload = @''' + layer1.identifier + '''@ + ) { + int overChildAttr + over "GrandChild" { + int overGrandChildAttr + } + def "LocalChild" {} + int localAttr + } + + def "Prim3" ( + payload = @''' + layer1.identifier + '''@ + ) { + def "LocalChild" {} + int localAttr + } + ''') + + # Open both layers as stages. + stage1 = Usd.Stage.Open(layer1, Usd.Stage.LoadAll) + stage2 = Usd.Stage.Open(layer2, Usd.Stage.LoadAll) + + # Create an editor for stage 1 with stage 2 as an addtional dependent + # stage. + editor = Usd.NamespaceEditor(stage1) + editor.AddDependentStage(stage2) + + # Verify the initial composition fields for both layer 2 (layer 1 has + # no composition fields). + self.assertEqual(self._GetCompositionFieldsInLayer(layer1), {}) + self.assertEqual(self._GetCompositionFieldsInLayer(layer2), { + '/Prim1' : { + 'payload' : (Sdf.Payload(layer1.identifier, '/Ref'),) + }, + '/Prim2' : { + 'payload' : (Sdf.Payload(layer1.identifier, '/Ref/Child'),) + }, + '/Prim3' : { + 'payload' : (Sdf.Payload(layer1.identifier, + '/Ref/Child/GrandChild'),) + }, + }) + + # Verify the initial simple hierarchy in stage 1. + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + 'Child' : { + '.' : ['childAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr'] + } + } + } + }) + + # Verify the initial composed prim contents for each prim in stage 2. + # Note that all prims are loaded at the start so all payload contents + # are composed with local prim specs. + prim1Contents = { + '.' : ['refAttr', 'localAttr'], + 'Child' : { + '.' : ['childAttr', 'overChildAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'overGrandChildAttr'] + }, + }, + 'LocalChild' : {}, + } + + prim2Contents = { + '.' : ['childAttr', 'overChildAttr', 'localAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'overGrandChildAttr'] + }, + 'LocalChild' : {}, + } + + prim3Contents = { + '.' : ['grandChildAttr', 'localAttr'], + 'LocalChild' : {}, + } + + self._VerifyStageContents(stage2, { + 'Prim1' : prim1Contents, + 'Prim2' : prim2Contents, + 'Prim3' : prim3Contents + }) + + # Edit: Rename /Ref/Child to /Ref/RenamedChild + with self.ApplyEdits(editor, "Move /Ref/Child -> /Ref/RenamedChild"): + self.assertTrue(editor.MovePrimAtPath( + '/Ref/Child', '/Ref/RenamedChild')) + + # Verify the udpated composition fields in layer2. The payload fields to + # /Ref/Child and its descendant /Ref/Child/GrandChild have been updated + # to use the renamed paths because all prims are currently loaded. + self.assertEqual(self._GetCompositionFieldsInLayer(layer2), { + '/Prim1' : { + 'payload' : (Sdf.Payload(layer1.identifier, '/Ref'),) + }, + '/Prim2' : { + 'payload' : (Sdf.Payload(layer1.identifier, '/Ref/RenamedChild'),) + }, + '/Prim3' : { + 'payload' : (Sdf.Payload(layer1.identifier, + '/Ref/RenamedChild/GrandChild'),) + }, + }) + + # Verify the expected simple rename in stage 1. + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + 'RenamedChild' : { + '.' : ['childAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr'] + } + } + }, + }) + + # Verify the updated contents for stage 2. + # + # For /Prim1 which directly references /Ref, the child prim is renamed + # to RenamedChild. And just like with references, this means the local + # override specs for the prims introducing the payloads have been + # renamed to RenamedChild. + # + # The contents of the other two prims in each stage remain unchanged + # as the update to the payload fields allow those prims to remain the + # same. + prim1Contents = { + '.' : ['refAttr', 'localAttr'], + 'RenamedChild' : { + '.' : ['childAttr', 'overChildAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'overGrandChildAttr'] + }, + }, + 'LocalChild' : {}, + } + + self._VerifyStageContents(stage2, { + 'Prim1' : prim1Contents, + 'Prim2' : prim2Contents, + 'Prim3' : prim3Contents + }) + + # Now unload /Prim1 and /Prim3 so that we can demonstrate the one way + # that payload dependencies deviate from references. + stage2.Unload('/Prim1') + stage2.Unload('/Prim3') + + # Verify the contents of stage 2 with the prims unloaded. + # + # /Prim1 and /Prim3 are only composed from the their local opinions + # without the opinions from their payloads in layer 1 + prim1Contents = { + '.' : ['localAttr'], + 'RenamedChild' : { + '.' : ['overChildAttr'], + 'GrandChild' : { + '.' : ['overGrandChildAttr'], + }, + }, + 'LocalChild' : {}, + } + + prim3Contents = { + '.' : ['localAttr'], + 'LocalChild' : {}, + } + + self._VerifyStageContents(stage2, { + 'Prim1' : prim1Contents, + 'Prim2' : prim2Contents, + 'Prim3' : prim3Contents + }) + + # Edit: Rename /Ref/RenamedChild back to /Ref/Child + with self.ApplyEdits(editor, "Move /Ref/RenamedChild -> /Ref/Child"): + self.assertTrue(editor.MovePrimAtPath( + '/Ref/RenamedChild', '/Ref/Child')) + + # Verify the udpated composition fields in layer2. ONLY the payload for + # the still loaded /Prim2 is updated. The payload for /Prim1 would've + # been unaffected regardless of the load state, but /Prim3's payload + # can't be updated solely because it is unloaded. + self.assertEqual(self._GetCompositionFieldsInLayer(layer2), { + '/Prim1' : { + 'payload' : (Sdf.Payload(layer1.identifier, '/Ref'),) + }, + '/Prim2' : { + 'payload' : (Sdf.Payload(layer1.identifier, '/Ref/Child'),) + }, + '/Prim3' : { + 'payload' : (Sdf.Payload(layer1.identifier, + '/Ref/RenamedChild/GrandChild'),) + }, + }) + + # Verify the contents for stage 2 + # + # NONE of the prim contents have changed but for a different reasons. + # /Prim1 and /Prim3 have not changed because the payloads are unloaded + # and there is no dependency on the payload path for which to propagate + # dependent edits. + # /Prim2 is unchanged because the loaded payload's path has been updated + # to the new path. + self._VerifyStageContents(stage2, { + 'Prim1' : prim1Contents, + 'Prim2' : prim2Contents, + 'Prim3' : prim3Contents + }) + + # Now load /Prim1 and /Prim3 again. Loading /Prim3 will emit warnings + # because of the payload points to path that no longer exists in layer1. + stage2.Load('/Prim1') + print("\n=== EXPECT WARNINGS ===", file=sys.stderr) + stage2.Load('/Prim3') + print("\n=== END EXPECTED WARNINGS ===", file=sys.stderr) + + # Verify the post-edit contents for stage 2 now with all prims loaded. + # + # The contents of /Prim1 and /Prim3 with payloads loaded show how we + # couldn't correctly update the dependent paths for the unloaded + # payloads when doing the prior rename back. + # + # The now loaded /Prim1 is in a partially edited state as we weren't + # able to move the the local RenamedChild specs back to Child while the + # prim was unloaded. + # + # The now loaded /Prim3 is unchanged from its unloaded state as the + # payload path still points to /Ref/RenamedChild/GrandChild which no + # longer exists at that path (and we have an unresolved payload + # composition error on this prim now). + prim1Contents = { + '.' : ['refAttr', 'localAttr'], + 'Child' : { + '.' : ['childAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr'] + }, + }, + 'RenamedChild' : { + '.' : ['overChildAttr'], + 'GrandChild' : { + '.' : ['overGrandChildAttr'], + }, + }, + 'LocalChild' : {}, + } + + self._VerifyStageContents(stage2, { + 'Prim1' : prim1Contents, + 'Prim2' : prim2Contents, + 'Prim3' : prim3Contents + }) + + def test_BasicNestedReferences(self): + """Test downstream dependency name space edits across chains of + references.""" + + # Setup: + # Layer 1 has simple hierarchy of /Ref, Child, GrandChild that is + # referenced and will be namespace edited. + layer1 = Sdf.Layer.CreateAnonymous("layer1.usda") + layer1.ImportFromString('''#usda 1.0 + def "Ref" { + int refAttr + + def "Child" { + int childAttr + + def "GrandChild" { + int grandChildAttr + } + } + } + ''') + + # Layer 2 has three prims that reference /Ref, /Ref/Child, and + # /Ref/Child/GrandChild from layer 1 respectively. These will be + # affected by downstream dependency edits. + layer2 = Sdf.Layer.CreateAnonymous("layer2.usda") + layer2.ImportFromString('''#usda 1.0 + def "Prim1" ( + references = @''' + layer1.identifier + '''@ + ) { + over "Child" { + int over1ChildAttr + over "GrandChild" { + int over1GrandChildAttr + } + } + def "Prim1_LocalChild" {} + int prim1_localAttr + } + + def "Prim2" ( + references = @''' + layer1.identifier + '''@ + ) { + over "GrandChild" { + int over2GrandChildAttr + } + def "Prim2_LocalChild" {} + int prim2_localAttr + } + + def "Prim3" ( + references = @''' + layer1.identifier + '''@ + ) { + def "Prim3_LocalChild" {} + int prim3_LocalAttr + } + ''') + + # Layer3 has multiple prims that each reference the possible + # prims in layer2 in order to test the various permutations of direct + # and ancestral reference chains. + # /Prim4 : References /Prim1 which directly references /Ref + # /Prim4_A : References /Prim1/Child which ancestrally references + # /Ref/Child + # /Prim4_B : References /Prim1/Child/GrandChild which ancestrally + # references /Ref/Child/GrandChild + # /Prim5 : References /Prim2 which directly references /Ref/Child + # /Prim5_A : References /Prim2/GrandChild which ancestrally references + # /Ref/Child/GrandChild + # /Prim6 : References /Prim3 which directly references + # /Ref/Child/GrandChild + layer3 = Sdf.Layer.CreateAnonymous("layer3.usda") + layer3.ImportFromString('''#usda 1.0 + def "Prim4" ( + references = @''' + layer2.identifier + '''@ + ) { + over "Child" { + int over4ChildAttr + over "GrandChild" { + int over4GrandChildAttr + } + } + def "LocalChild" {} + int localAttr + } + + def "Prim4_A" ( + references = @''' + layer2.identifier + '''@ + ) { + over "GrandChild" { + int over4_AGrandChildAttr + } + def "LocalChild" {} + int localAttr + } + + def "Prim4_B" ( + references = @''' + layer2.identifier + '''@ + ) { + def "LocalChild" {} + int localAttr + } + + def "Prim5" ( + references = @''' + layer2.identifier + '''@ + ) { + over "GrandChild" { + int over5GrandChildAttr + } + def "LocalChild" {} + int localAttr + } + + def "Prim5_A" ( + references = @''' + layer2.identifier + '''@ + ) { + def "LocalChild" {} + int localAttr + } + + def "Prim6" ( + references = @''' + layer2.identifier + '''@ + ) { + def "LocalChild" {} + int localAttr + } + ''') + + # Open all three layers as stages. + stage1 = Usd.Stage.Open(layer1, Usd.Stage.LoadAll) + stage2 = Usd.Stage.Open(layer2, Usd.Stage.LoadAll) + stage3 = Usd.Stage.Open(layer3, Usd.Stage.LoadAll) + + # Create an editor for stage1 with ONLY stage 3 as a dependent stage + # (i.e. excluding stage 2). This will still cause edits to layer2 when + # layer1 is edited as stage3 has dependencies on layer 2 and thus, these + # changes will be reflected in stage 2. + editor = Usd.NamespaceEditor(stage1) + editor.AddDependentStage(stage3) + + # Verify the initial composition fields for each layer. + self.assertEqual(self._GetCompositionFieldsInLayer(layer1), {}) + + self.assertEqual(self._GetCompositionFieldsInLayer(layer2), { + '/Prim1' : { + 'references' : (Sdf.Reference(layer1.identifier, '/Ref'),) + }, + '/Prim2' : { + 'references' : (Sdf.Reference(layer1.identifier, '/Ref/Child'),) + }, + '/Prim3' : { + 'references' : (Sdf.Reference(layer1.identifier, + '/Ref/Child/GrandChild'),) + }, + }) + + self.assertEqual(self._GetCompositionFieldsInLayer(layer3), { + '/Prim4' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Prim1'),) + }, + '/Prim4_A' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Prim1/Child'),) + }, + '/Prim4_B' : { + 'references' : (Sdf.Reference(layer2.identifier, + '/Prim1/Child/GrandChild'),) + }, + '/Prim5' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Prim2'),) + }, + '/Prim5_A' : { + 'references' : (Sdf.Reference(layer2.identifier, + '/Prim2/GrandChild'),) + }, + '/Prim6' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Prim3'),) + }, + }) + + # Verify the initial contents of stage 1. + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + 'Child' : { + '.' : ['childAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr'] + } + } + }, + }) + + # Verify the initial contents of stage 2 with its three single + # reference composed prims + prim1Contents = { + '.' : ['refAttr', 'prim1_localAttr'], + 'Child' : { + '.' : ['childAttr', 'over1ChildAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'over1GrandChildAttr'] + }, + }, + 'Prim1_LocalChild' : {}, + } + + prim2Contents = { + '.' : ['childAttr', 'prim2_localAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'over2GrandChildAttr'] + }, + 'Prim2_LocalChild' : {}, + } + + prim3Contents = { + '.' : ['grandChildAttr', 'prim3_LocalAttr'], + 'Prim3_LocalChild' : {}, + } + + self._VerifyStageContents(stage2, { + 'Prim1' : prim1Contents, + 'Prim2' : prim2Contents, + 'Prim3' : prim3Contents + }) + + # Verify the initial contents of stage 3 with its all its prims composed + # from 2-chain references + prim4Contents = { + '.' : ['refAttr', 'prim1_localAttr', 'localAttr'], + 'Child' : { + '.' : ['childAttr', 'over1ChildAttr', 'over4ChildAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'over1GrandChildAttr', + 'over4GrandChildAttr'] + }, + }, + 'Prim1_LocalChild' : {}, + 'LocalChild' : {}, + } + + prim4_AContents = { + '.' : ['childAttr', 'over1ChildAttr', 'localAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'over1GrandChildAttr', + 'over4_AGrandChildAttr'] + }, + 'LocalChild' : {}, + } + + prim4_BContents = { + '.' : ['grandChildAttr', 'over1GrandChildAttr', 'localAttr'], + 'LocalChild' : {}, + } + + prim5Contents = { + '.' : ['childAttr', 'prim2_localAttr', 'localAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'over2GrandChildAttr', + 'over5GrandChildAttr'] + }, + 'Prim2_LocalChild' : {}, + 'LocalChild' : {}, + } + + prim5_AContents = { + '.' : ['grandChildAttr', 'over2GrandChildAttr', 'localAttr'], + 'LocalChild' : {}, + } + + prim6Contents = { + '.' : ['grandChildAttr', 'prim3_LocalAttr', 'localAttr'], + 'Prim3_LocalChild' : {}, + 'LocalChild' : {}, + } + + self._VerifyStageContents(stage3, { + 'Prim4' : prim4Contents, + 'Prim4_A' : prim4_AContents, + 'Prim4_B' : prim4_BContents, + 'Prim5' : prim5Contents, + 'Prim5_A' : prim5_AContents, + 'Prim6' : prim6Contents + }) + + # Edit: Rename /Ref/Child to /Ref/RenamedChild on stage 1. + with self.ApplyEdits(editor, "Move /Ref/Child -> /Ref/RenamedChild"): + self.assertTrue(editor.MovePrimAtPath( + '/Ref/Child', '/Ref/RenamedChild')) + + # Verify the udpated composition fields in layer2. The reference fields + # to /Ref/Child and its descendant /Ref/Child/GrandChild have been + # updated to use the renamed paths. + self.assertEqual(self._GetCompositionFieldsInLayer(layer2), { + '/Prim1' : { + 'references' : (Sdf.Reference(layer1.identifier, '/Ref'),) + }, + '/Prim2' : { + 'references' : (Sdf.Reference(layer1.identifier, + '/Ref/RenamedChild'),) + }, + '/Prim3' : { + 'references' : (Sdf.Reference(layer1.identifier, + '/Ref/RenamedChild/GrandChild'),) + }, + }) + + # Verify the udpated composition fields in layer3. The reference + # fields to /Prim1/Child and its descendant /Prim1/Child/GrandChild have + # to be updated as all the specs composing /Prim1/Child are renamed to + # RenamedChild by the dependent edits. + self.assertEqual(self._GetCompositionFieldsInLayer(layer3), { + '/Prim4' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Prim1'),) + }, + '/Prim4_A' : { + 'references' : (Sdf.Reference(layer2.identifier, + '/Prim1/RenamedChild'),) + }, + '/Prim4_B' : { + 'references' : (Sdf.Reference(layer2.identifier, + '/Prim1/RenamedChild/GrandChild'),) + }, + '/Prim5' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Prim2'),) + }, + '/Prim5_A' : { + 'references' : (Sdf.Reference(layer2.identifier, + '/Prim2/GrandChild'),) + }, + '/Prim6' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Prim3'),) + }, + }) + + # Verify the simple prim rename is reflected in contents of stage 1. + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + 'RenamedChild' : { + '.' : ['childAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr'] + } + } + }, + }) + + # Verify the udpated contents of stage 2. + # + # There are prims in stage 3 that reference /Prim1/Child on layer2 so + # which ancestrally references /Ref/Child. So the specs for /Prim1/Child + # on layer 2 are renamed to RenamedChild for this dependency. This + # change is reflected in the contents of stage 2. + # + # Stage 3 also has prims with dependencies on /Prim2 and /Prim3, but + # the contents of those two prims remain the same as the reference paths + # are just updated to /Ref/RenamedChild and /Ref/RenamedChild/GrandChild. + prim1Contents = { + '.' : ['refAttr', 'prim1_localAttr'], + 'RenamedChild' : { + '.' : ['childAttr', 'over1ChildAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'over1GrandChildAttr'] + }, + }, + 'Prim1_LocalChild' : {}, + } + + self._VerifyStageContents(stage2, { + 'Prim1' : prim1Contents, + 'Prim2' : prim2Contents, + 'Prim3' : prim3Contents + }) + + # Verify the updated contents of stage 3. + # + # /Prim4 references /Prim1 which references /Ref so /Prim4/Child is also + # renamed to /Prim4/RenamedChild. + # No other prims' contents change as they each had one of their nested + # references arcs updated to the new path. + prim4Contents = { + '.' : ['refAttr', 'prim1_localAttr', 'localAttr'], + 'RenamedChild' : { + '.' : ['childAttr', 'over1ChildAttr', 'over4ChildAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'over1GrandChildAttr', + 'over4GrandChildAttr'] + }, + }, + 'Prim1_LocalChild' : {}, + 'LocalChild' : {}, + } + + self._VerifyStageContents(stage3, { + 'Prim4' : prim4Contents, + 'Prim4_A' : prim4_AContents, + 'Prim4_B' : prim4_BContents, + 'Prim5' : prim5Contents, + 'Prim5_A' : prim5_AContents, + 'Prim6' : prim6Contents + }) + + # Edit: Reparent and rename /Ref/RenamedChild to /MovedChild + with self.ApplyEdits(editor, "Move /Ref/RenamedChild -> /MovedChild"): + self.assertTrue(editor.MovePrimAtPath( + '/Ref/RenamedChild', '/MovedChild')) + + # Verify the udpated composition fields in layer2. The reference fields + # to /Ref/RenamedChild and its descendant /Ref/RenamedChild/GrandChild + # have been updated to use the moved paths. + self.assertEqual(self._GetCompositionFieldsInLayer(layer2), { + '/Prim1' : { + 'references' : (Sdf.Reference(layer1.identifier, '/Ref'),) + }, + '/Prim2' : { + 'references' : (Sdf.Reference(layer1.identifier, '/MovedChild'),) + }, + '/Prim3' : { + 'references' : (Sdf.Reference(layer1.identifier, + '/MovedChild/GrandChild'),) + }, + }) + + # Verify the udpated composition fields in layer3. Like with the + # previous edit, the reference fields to /Prim1/RenamedChild and + # its descendant /Prim1/RenamedChild/GrandChild have to be updated as + # all the specs composing /Prim1/RenameChild have been moved by the + # dependent edits. However, since RenamedChild was moved out /Ref, it no + # longer maps across the reference to /Prim1 which results in the + # deletion of the composed /Prim1/RenamedChild. So the reference fields + # for /Prim4_A and /Prim4_B are updated to delete these references to + # prims that no longer exist in layer2. + self.assertEqual(self._GetCompositionFieldsInLayer(layer3), { + '/Prim4' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Prim1'),) + }, + '/Prim4_A' : { + 'references' : () + }, + '/Prim4_B' : { + 'references' : () + }, + '/Prim5' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Prim2'),) + }, + '/Prim5_A' : { + 'references' : (Sdf.Reference(layer2.identifier, + '/Prim2/GrandChild'),) + }, + '/Prim6' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Prim3'),) + }, + }) + + # Verify the simple reparent and rename is reflected in contents of + # stage 1. + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + }, + 'MovedChild' : { + '.' : ['childAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr'] + } + } + }) + + # Verify the udpated contents of stage 2. + # + # There are prims in stage 3 that reference /Prim1/RenamedChild on + # layer2 which ancestrally references /Ref/RenamedChild. So the specs + # for /Prim1/RenamedChild on layer 2 are deleted for this dependency + # (since the RenamedChild was moved out of the reference). This change + # is reflected in the contents of stage 2. + # + # Stage 3 also has prims with dependencies on /Prim2 and /Prim3, but + # these contents remain the same as the reference paths are + # just updated to /MovedChild and /MovedChild/GrandChild. + prim1Contents = { + '.' : ['refAttr', 'prim1_localAttr'], + 'Prim1_LocalChild' : {}, + } + + self._VerifyStageContents(stage2, { + 'Prim1' : prim1Contents, + 'Prim2' : prim2Contents, + 'Prim3' : prim3Contents + }) + + # Verify the updated contents of stage 3. + # + # /Prim4 references /Prim1 which references /Ref so /Prim4/RenamedChild + # is also deleted. /Prim4_A and /Prim4_B have lost their references so + # these also only have the contents of their local specs. + # + # The rest of the prims have no contents change as they each had one of + # their nested references arcs updated to the new path. + prim4Contents = { + '.' : ['refAttr', 'prim1_localAttr', 'localAttr'], + 'Prim1_LocalChild' : {}, + 'LocalChild' : {}, + } + + prim4_AContents = { + '.' : ['localAttr'], + 'LocalChild' : {}, + } + + prim4_BContents = { + '.' : ['localAttr'], + 'LocalChild' : {}, + } + + self._VerifyStageContents(stage3, { + 'Prim4' : prim4Contents, + 'Prim4_A' : prim4_AContents, + 'Prim4_B' : prim4_BContents, + 'Prim5' : prim5Contents, + 'Prim5_A' : prim5_AContents, + 'Prim6' : prim6Contents + }) + + # Edit: Reparent and rename /MovedChild back to its original path + # /Ref/Child + with self.ApplyEdits(editor, "Move /MovedChild -> /Ref/Child"): + self.assertTrue(editor.MovePrimAtPath('/MovedChild', '/Ref/Child')) + + # Verify the udpated composition fields in layer2. The reference fields + # have all been updated to their original paths. + self.assertEqual(self._GetCompositionFieldsInLayer(layer2), { + '/Prim1' : { + 'references' : (Sdf.Reference(layer1.identifier, '/Ref'),) + }, + '/Prim2' : { + 'references' : (Sdf.Reference(layer1.identifier, '/Ref/Child'),) + }, + '/Prim3' : { + 'references' : (Sdf.Reference(layer1.identifier, + '/Ref/Child/GrandChild'),) + }, + }) + + # Verify the udpated composition fields in layer3 which have NOT changed + # because the prior edit deleted both references that initially + # referred to /Prim1/Child. + self.assertEqual(self._GetCompositionFieldsInLayer(layer3), { + '/Prim4' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Prim1'),) + }, + '/Prim4_A' : { + 'references' : () + }, + '/Prim4_B' : { + 'references' : () + }, + '/Prim5' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Prim2'),) + }, + '/Prim5_A' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Prim2/GrandChild'),) + }, + '/Prim6' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Prim3'),) + }, + }) + + # Verify the return to the the original contents in stage 1. + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + 'Child' : { + '.' : ['childAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr'] + } + } + }, + }) + + # Verify the udpated contents of stage 2. + # + # The contents of /Prim1 have returned to the original contents with + # the exception that the local opinions for Child and GrandChild in + # layer2 were deleted in the prior edit and cannot be restored. + # + # /Prim2 and /Prim3 remain unchanged. + prim1Contents = { + '.' : ['refAttr', 'prim1_localAttr'], + 'Child' : { + '.' : ['childAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr'] + }, + }, + 'Prim1_LocalChild' : {}, + } + + self._VerifyStageContents(stage2, { + 'Prim1' : prim1Contents, + 'Prim2' : prim2Contents, + 'Prim3' : prim3Contents + }) + + # Verify the updated contents of stage 3. + # + # /Prim4 returns to its original contents with the exception that + # deleted local opinions on layer3 for Child and the deleted opinions + # from /Prim1/Child on layer2 cannot be restored. + # + # /Prim4_A and /Prim4_B remain unchanged (and therefore unrestored) + # because their references were deleted by the previous edit. + # + # The rest of the prims continue to have no contents change as they each + # had one of their nested references arcs updated to the original path. + prim4Contents = { + '.' : ['refAttr', 'prim1_localAttr', 'localAttr'], + 'Child' : { + '.' : ['childAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr'] + }, + }, + 'Prim1_LocalChild' : {}, + 'LocalChild' : {}, + } + + self._VerifyStageContents(stage3, { + 'Prim4' : prim4Contents, + 'Prim4_A' : prim4_AContents, + 'Prim4_B' : prim4_BContents, + 'Prim5' : prim5Contents, + 'Prim5_A' : prim5_AContents, + 'Prim6' : prim6Contents + }) + + # Edit: Delete /Ref/Child + with self.ApplyEdits(editor, "Delete /Ref/Child"): + self.assertTrue(editor.DeletePrimAtPath('/Ref/Child')) + + # Verify the udpated composition fields in layer2. The reference fields + # to /Ref/Child and its descendant /Ref/Child/GrandChild have been + # set to empty now that those prims don't exist on layer1 + self.assertEqual(self._GetCompositionFieldsInLayer(layer2), { + '/Prim1' : { + 'references' : (Sdf.Reference(layer1.identifier, '/Ref'),) + }, + '/Prim2' : { + 'references' : () + }, + '/Prim3' : { + 'references' : () + }, + }) + + # Verify the udpated composition fields in layer3. The only change now + # is that /Prim5_A's reference to /Prim2/GrandChild has been deleted as + # /Prim2/GrandChild is no a valid composed prim of layer2. + self.assertEqual(self._GetCompositionFieldsInLayer(layer3), { + '/Prim4' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Prim1'),) + }, + '/Prim4_A' : { + 'references' : () + }, + '/Prim4_B' : { + 'references' : () + }, + '/Prim5' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Prim2'),) + }, + '/Prim5_A' : { + 'references' : () + }, + '/Prim6' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Prim3'),) + }, + }) + + # Verify the deletion of Child on stage 1. + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + }, + }) + + # Verify the udpated contents of stage 2. + # + # The contents of /Prim1 no longer have the child Child. + # + # /Prim2 and /Prim3 have lost their references so only have local + # opinions from layer2. + prim1Contents = { + '.' : ['refAttr', 'prim1_localAttr'], + 'Prim1_LocalChild' : {}, + } + + prim2Contents = { + '.' : ['prim2_localAttr'], + 'Prim2_LocalChild' : {}, + } + + prim3Contents = { + '.' : ['prim3_LocalAttr'], + 'Prim3_LocalChild' : {}, + } + + self._VerifyStageContents(stage2, { + 'Prim1' : prim1Contents, + 'Prim2' : prim2Contents, + 'Prim3' : prim3Contents + }) + + # Verify the updated contents of stage 3. + # + # /Prim4 loses all opinions about Child. + # + # /Prim4_A and /Prim4_B remain unchanged still because of the prior + # deleted references. + # + # /Prim5 and /Prim6 are affected by the deletion of the references on + # /Prim2 and /Prim3 respectively, but they still composed the layer2 + # local opinions from /Prim2 and /Prim3 + # + # /Prim5_A only has its own local opinions because its own reference + # has also been deleted. + prim4Contents = { + '.' : ['refAttr', 'prim1_localAttr', 'localAttr'], + 'Prim1_LocalChild' : {}, + 'LocalChild' : {}, + } + + prim5Contents = { + '.' : ['prim2_localAttr', 'localAttr'], + 'Prim2_LocalChild' : {}, + 'LocalChild' : {}, + } + + prim5_AContents = { + '.' : ['localAttr'], + 'LocalChild' : {}, + } + + prim6Contents = { + '.' : ['prim3_LocalAttr', 'localAttr'], + 'Prim3_LocalChild' : {}, + 'LocalChild' : {}, + } + + self._VerifyStageContents(stage3, { + 'Prim4' : prim4Contents, + 'Prim4_A' : prim4_AContents, + 'Prim4_B' : prim4_BContents, + 'Prim5' : prim5Contents, + 'Prim5_A' : prim5_AContents, + 'Prim6' : prim6Contents + }) + +if __name__ == '__main__': + unittest.main() From 7596547caf00f96ece963a6d72d0efd57010159c Mon Sep 17 00:00:00 2001 From: matthewcpp Date: Tue, 15 Oct 2024 13:17:44 -0700 Subject: [PATCH 42/82] This changes addresses a behavorial difference that appeared in 23.11 relating to UsdUtils.ExtractExternalReferences. In previous versions, udim paths would not be resolved during this function call. This change restores that behavior by disabling udim resolution for ExtractExternalReferences. Fixes #3173 (Internal change: 2344689) --- pxr/usd/usdUtils/CMakeLists.txt | 24 +++++++++++++++++ pxr/usd/usdUtils/assetLocalization.cpp | 6 +++-- pxr/usd/usdUtils/assetLocalization.h | 17 +++++++++--- pxr/usd/usdUtils/dependencies.cpp | 5 ++-- pxr/usd/usdUtils/dependencies.h | 26 ++++++++++++++++++- .../testUsdUtilsDependencyExtractor.py | 7 ++++- .../baseline/udims-resolved.txt | 4 +++ .../baseline/udims.txt | 3 +++ .../udims/root.usda | 5 ++++ .../udims/test.1001.txt | 1 + .../udims/test.1002.txt | 1 + pxr/usd/usdUtils/usdzPackage.cpp | 10 ++++++- pxr/usd/usdUtils/wrapDependencies.cpp | 14 +++++++--- 13 files changed, 110 insertions(+), 13 deletions(-) create mode 100644 pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/baseline/udims-resolved.txt create mode 100644 pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/baseline/udims.txt create mode 100644 pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/udims/root.usda create mode 100644 pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/udims/test.1001.txt create mode 100644 pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/udims/test.1002.txt diff --git a/pxr/usd/usdUtils/CMakeLists.txt b/pxr/usd/usdUtils/CMakeLists.txt index dd0605106f..e358361d5d 100644 --- a/pxr/usd/usdUtils/CMakeLists.txt +++ b/pxr/usd/usdUtils/CMakeLists.txt @@ -246,6 +246,16 @@ pxr_install_test_dir( DEST testUsdUtilsDependencyExtractor5 ) +pxr_install_test_dir( + SRC testenv/testUsdUtilsDependencyExtractor + DEST testUsdUtilsDependencyExtractor6 +) + +pxr_install_test_dir( + SRC testenv/testUsdUtilsDependencyExtractor + DEST testUsdUtilsDependencyExtractor7 +) + pxr_install_test_dir( SRC testenv/testUsdUtilsFlattenLayerStack DEST testUsdUtilsFlattenLayerStack @@ -590,6 +600,20 @@ pxr_register_test(testUsdUtilsDependencyExtractor5 EXPECTED_RETURN_CODE 0 ) +pxr_register_test(testUsdUtilsDependencyExtractor6 + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdUtilsDependencyExtractor udims/root.usda udims.txt" + DIFF_COMPARE udims.txt + EXPECTED_RETURN_CODE 0 +) + +pxr_register_test(testUsdUtilsDependencyExtractor7 + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdUtilsDependencyExtractor --resolve-udim-paths udims/root.usda udims-resolved.txt" + DIFF_COMPARE udims-resolved.txt + EXPECTED_RETURN_CODE 0 +) + pxr_register_test(testUsdUtilsFlattenLayerStack PYTHON COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdUtilsFlattenLayerStack" diff --git a/pxr/usd/usdUtils/assetLocalization.cpp b/pxr/usd/usdUtils/assetLocalization.cpp index 1df66c4fdb..9e830681cd 100644 --- a/pxr/usd/usdUtils/assetLocalization.cpp +++ b/pxr/usd/usdUtils/assetLocalization.cpp @@ -527,7 +527,7 @@ UsdUtils_LocalizationContext::_GetUdimTiles( { std::vector additionalPaths; - if (!UsdShadeUdimUtils::IsUdimIdentifier(assetPath)) { + if (!_resolveUdimPaths || !UsdShadeUdimUtils::IsUdimIdentifier(assetPath)) { return additionalPaths; } @@ -631,7 +631,8 @@ void UsdUtils_ExtractExternalReferences( const UsdUtils_LocalizationContext::ReferenceType refTypesToInclude, std::vector* outSublayers, std::vector* outReferences, - std::vector* outPayloads) + std::vector* outPayloads, + const UsdUtilsExtractExternalReferencesParams& params) { TRACE_FUNCTION(); @@ -643,6 +644,7 @@ void UsdUtils_ExtractExternalReferences( UsdUtils_LocalizationContext context(&delegate); context.SetRefTypesToInclude(refTypesToInclude); context.SetRecurseLayerDependencies(false); + context.SetResolveUdimPaths(params.GetResolveUdimPaths()); context.Process(SdfLayer::FindOrOpen(filePath)); client.SortAndRemoveDuplicates(); diff --git a/pxr/usd/usdUtils/assetLocalization.h b/pxr/usd/usdUtils/assetLocalization.h index 4150879698..d579fbfdbd 100644 --- a/pxr/usd/usdUtils/assetLocalization.h +++ b/pxr/usd/usdUtils/assetLocalization.h @@ -88,6 +88,13 @@ class UsdUtils_LocalizationContext { dependenciesToSkip.end()); } + // Controls udim path resolution. + // If this value is set to false, asset paths containing udim patterns + // be re returned untouched. + inline void SetResolveUdimPaths(bool resolveUdimPaths) { + _resolveUdimPaths = resolveUdimPaths; + } + private: void _ProcessLayer(const SdfLayerRefPtr& layer); void _ProcessSublayers(const SdfLayerRefPtr& layer); @@ -111,11 +118,11 @@ class UsdUtils_LocalizationContext { bool processingMetadata = false); // Searches for udim tiles associated with the given asset path. - static std::vector _GetUdimTiles(const SdfLayerRefPtr& layer, + std::vector _GetUdimTiles(const SdfLayerRefPtr& layer, const std::string &assetPath); // Discovers all dependencies for the supplied asset path - static std::vector _GetDependencies(const SdfLayerRefPtr& layer, + std::vector _GetDependencies(const SdfLayerRefPtr& layer, const std::string &assetPath); // Searches for the clips of a given templated string @@ -158,6 +165,9 @@ class UsdUtils_LocalizationContext { // Specifies if metadata filtering should be enabled bool _metadataFilteringEnabled = false; + // Specifies if udim paths should be resolved during processing. + bool _resolveUdimPaths = true; + // user supplied list of dependencies that will be skipped when // processing the asset std::unordered_set _dependenciesToSkip; @@ -168,7 +178,8 @@ void UsdUtils_ExtractExternalReferences( const UsdUtils_LocalizationContext::ReferenceType refTypesToInclude, std::vector* subLayers, std::vector* references, - std::vector* payloads); + std::vector* payloads, + const UsdUtilsExtractExternalReferencesParams& params = {}); PXR_NAMESPACE_CLOSE_SCOPE diff --git a/pxr/usd/usdUtils/dependencies.cpp b/pxr/usd/usdUtils/dependencies.cpp index 56c92f8e60..0eec2a94a5 100644 --- a/pxr/usd/usdUtils/dependencies.cpp +++ b/pxr/usd/usdUtils/dependencies.cpp @@ -34,11 +34,12 @@ UsdUtilsExtractExternalReferences( const std::string& filePath, std::vector* subLayers, std::vector* references, - std::vector* payloads) + std::vector* payloads, + const UsdUtilsExtractExternalReferencesParams& params) { UsdUtils_ExtractExternalReferences(filePath, UsdUtils_LocalizationContext::ReferenceType::All, - subLayers, references, payloads); + subLayers, references, payloads, params); } struct UsdUtils_ComputeAllDependenciesClient diff --git a/pxr/usd/usdUtils/dependencies.h b/pxr/usd/usdUtils/dependencies.h index 648dbffed4..3ddf40ca37 100644 --- a/pxr/usd/usdUtils/dependencies.h +++ b/pxr/usd/usdUtils/dependencies.h @@ -28,11 +28,34 @@ PXR_NAMESPACE_OPEN_SCOPE +/// Structure which controls aspects of the +/// \ref UsdUtilsExtractExternalReferences function. +class UsdUtilsExtractExternalReferencesParams { +public: + /// Specifies whether UDIM template paths should be resolved when extracting + /// references. If true, the resolved paths for all discovered UDIM tiles + /// will be included in the references bucket and the template path will be + /// discarded. If false, no resolution will take place and the template path + /// will appear in the references bucket. + inline void SetResolveUdimPaths(bool resolveUdimPaths) { + _resolveUdimPaths = resolveUdimPaths; + } + + + inline bool GetResolveUdimPaths() const { return _resolveUdimPaths; } + +private: + bool _resolveUdimPaths = false; +}; + /// Parses the file at \p filePath, identifying external references, and /// sorting them into separate type-based buckets. Sublayers are returned in /// the \p sublayers vector, references, whether prim references, value clip /// references or values from asset path attributes, are returned in the /// \p references vector. Payload paths are returned in \p payloads. +/// The \p params parameter controls various settings that affect the +/// extraction process. See \ref UsdUtilsExtractExternalReferencesParams for +/// additional details. /// /// \note No recursive chasing of dependencies is performed; that is the /// client's responsibility, if desired. @@ -45,7 +68,8 @@ void UsdUtilsExtractExternalReferences( const std::string& filePath, std::vector* subLayers, std::vector* references, - std::vector* payloads); + std::vector* payloads, + const UsdUtilsExtractExternalReferencesParams& params = {}); /// Recursively computes all the dependencies of the given asset and populates /// \p layers with all the dependencies that can be opened as an SdfLayer. diff --git a/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor.py b/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor.py index 95a9e27320..f421accfb4 100644 --- a/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor.py +++ b/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor.py @@ -28,6 +28,7 @@ def presult(ostr, fileName, refType, refs): parser.add_argument('infile') parser.add_argument('outfile', default='-') parser.add_argument('--open-as-anon', dest='openAsAnon', action='store_true') + parser.add_argument('--resolve-udim-paths', dest="resolveUdimPaths", action='store_true') args = parser.parse_args() if not os.path.exists(args.infile): @@ -46,8 +47,12 @@ def presult(ostr, fileName, refType, refs): layer.SetPermissionToEdit(False) identifier = args.infile + extractionParams = UsdUtils.ExtractExternalReferencesParams() + if (args.resolveUdimPaths): + extractionParams.SetResolveUdimPaths(True) + sublayers, references, payloads = \ - UsdUtils.ExtractExternalReferences(identifier) + UsdUtils.ExtractExternalReferences(identifier, extractionParams) with stream(args.outfile, 'w') as ofp: presult(ofp, args.infile, 'sublayers', sublayers) diff --git a/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/baseline/udims-resolved.txt b/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/baseline/udims-resolved.txt new file mode 100644 index 0000000000..2606fd2a8f --- /dev/null +++ b/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/baseline/udims-resolved.txt @@ -0,0 +1,4 @@ +udims/root.usda no sublayers +udims/root.usda references[001]: ./test.1001.txt +udims/root.usda references[002]: ./test.1002.txt +udims/root.usda no payloads diff --git a/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/baseline/udims.txt b/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/baseline/udims.txt new file mode 100644 index 0000000000..d5a5bec0e2 --- /dev/null +++ b/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/baseline/udims.txt @@ -0,0 +1,3 @@ +udims/root.usda no sublayers +udims/root.usda references[001]: ./test..txt +udims/root.usda no payloads diff --git a/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/udims/root.usda b/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/udims/root.usda new file mode 100644 index 0000000000..181d94d03f --- /dev/null +++ b/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/udims/root.usda @@ -0,0 +1,5 @@ +#usda 1.0 + +def "Test" { + asset udims = @./test..txt@ +} \ No newline at end of file diff --git a/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/udims/test.1001.txt b/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/udims/test.1001.txt new file mode 100644 index 0000000000..7cebf7db5f --- /dev/null +++ b/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/udims/test.1001.txt @@ -0,0 +1 @@ +1001 \ No newline at end of file diff --git a/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/udims/test.1002.txt b/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/udims/test.1002.txt new file mode 100644 index 0000000000..5ed13cbaef --- /dev/null +++ b/pxr/usd/usdUtils/testenv/testUsdUtilsDependencyExtractor/udims/test.1002.txt @@ -0,0 +1 @@ +1002 \ No newline at end of file diff --git a/pxr/usd/usdUtils/usdzPackage.cpp b/pxr/usd/usdUtils/usdzPackage.cpp index f53cb45153..a3c7031147 100644 --- a/pxr/usd/usdUtils/usdzPackage.cpp +++ b/pxr/usd/usdUtils/usdzPackage.cpp @@ -117,9 +117,17 @@ UsdUtilsCreateNewARKitUsdzPackage( // the composition of the stage. std::vector sublayers, references, payloads; + // We are explicitly setting the UDIM path resolution option to false + // here because the following logic only cares if the root layer contains + // any external references and does reason about the contents of the + // results. UDIM path resolution has the potential to be expensive, for + // example in the case of network filesystem paths. + UsdUtilsExtractExternalReferencesParams params; + params.SetResolveUdimPaths(false); + UsdUtils_ExtractExternalReferences(resolvedPath, UsdUtils_LocalizationContext::ReferenceType::CompositionOnly, - &sublayers, &references, &payloads); + &sublayers, &references, &payloads, params); // Ensure that the root layer has the ".usdc" extension. std::string targetBaseName = firstLayerName.empty() ? diff --git a/pxr/usd/usdUtils/wrapDependencies.cpp b/pxr/usd/usdUtils/wrapDependencies.cpp index 4fc906f26a..fefed2c59f 100644 --- a/pxr/usd/usdUtils/wrapDependencies.cpp +++ b/pxr/usd/usdUtils/wrapDependencies.cpp @@ -27,11 +27,12 @@ namespace { static bp::tuple _ExtractExternalReferences( - const std::string& filePath) + const std::string& filePath, + const UsdUtilsExtractExternalReferencesParams& params = {}) { std::vector subLayers, references, payloads; UsdUtilsExtractExternalReferences(filePath, - &subLayers, &references, &payloads); + &subLayers, &references, &payloads, params); return bp::make_tuple(subLayers, references, payloads); } @@ -65,8 +66,15 @@ _ComputeAllDependencies( void wrapDependencies() { + typedef UsdUtilsExtractExternalReferencesParams ExtractRefParams; + bp::class_("ExtractExternalReferencesParams") + .def("SetResolveUdimPaths", &ExtractRefParams::SetResolveUdimPaths) + .def("GetResolveUdimPaths", &ExtractRefParams::GetResolveUdimPaths) + ; + bp::def("ExtractExternalReferences", _ExtractExternalReferences, - bp::arg("filePath")); + (bp::arg("filePath"), + bp::arg("parameters") = ExtractRefParams())); bp::def("CreateNewUsdzPackage", UsdUtilsCreateNewUsdzPackage, (bp::arg("assetPath"), From c89138d79caebe76958d5dcc28e5bcc3a6c4725f Mon Sep 17 00:00:00 2001 From: tallytalwar Date: Tue, 15 Oct 2024 21:53:34 -0700 Subject: [PATCH 43/82] UsdValidatonContext::Validate(stage) should also validate instance proxy prims, when it traverses the stage for prims to validate. The Validate(stage) API now validates all prims, including instance proxies, by default. Clients can also use the overload that takes a traversal predicate to be used for stage traversal when validating the stage. The default behavior matches the behavior we currently have in usdchecker / UsdUtils.ComplianceChecker. (Internal change: 2344766) --- pxr/usd/usd/validationContext.cpp | 30 ++++++++++++++++++++---------- pxr/usd/usd/validationContext.h | 19 +++++++++++++++++-- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/pxr/usd/usd/validationContext.cpp b/pxr/usd/usd/validationContext.cpp index f93da721a8..b515b6a419 100644 --- a/pxr/usd/usd/validationContext.cpp +++ b/pxr/usd/usd/validationContext.cpp @@ -8,9 +8,10 @@ #include "pxr/base/tf/type.h" #include "pxr/base/work/dispatcher.h" #include "pxr/base/work/withScopedParallelism.h" -#include "pxr/usd/usd/validationContext.h" +#include "pxr/usd/usd/primFlags.h" #include "pxr/usd/usd/schemaRegistry.h" #include "pxr/usd/usd/stage.h" +#include "pxr/usd/usd/validationContext.h" #include "pxr/usd/usd/validator.h" #include "pxr/usd/usd/validationRegistry.h" @@ -298,7 +299,8 @@ UsdValidationContext::Validate(const SdfLayerHandle &layer) const } UsdValidationErrorVector -UsdValidationContext::Validate(const UsdStagePtr &stage) const +UsdValidationContext::Validate(const UsdStagePtr &stage, + const Usd_PrimFlagsPredicate &predicate) const { if (!stage) { TF_CODING_ERROR("Invalid stage provided to validate."); @@ -308,12 +310,20 @@ UsdValidationContext::Validate(const UsdStagePtr &stage) const UsdValidationErrorVector errors; std::mutex errorsMutex; WorkWithScopedDispatcher( - [this, &stage, &errors, &errorsMutex](WorkDispatcher &dispatcher) { - _ValidateStage(dispatcher, stage, &errors, &errorsMutex); - }); + [this, &stage, &errors, &errorsMutex, &predicate]( + WorkDispatcher &dispatcher) { + _ValidateStage(dispatcher, stage, &errors, &errorsMutex, + predicate); + }); return errors; } +UsdValidationErrorVector +UsdValidationContext::Validate(const UsdStagePtr &stage) const +{ + return Validate(stage, UsdTraverseInstanceProxies(UsdPrimDefaultPredicate)); +} + UsdValidationErrorVector UsdValidationContext::Validate(const std::vector &prims) const { @@ -373,10 +383,10 @@ UsdValidationContext::_ValidateLayer(WorkDispatcher &dispatcher, } void -UsdValidationContext::_ValidateStage(WorkDispatcher &dispatcher, - const UsdStagePtr &stage, - UsdValidationErrorVector *errors, - std::mutex *errorsMutex) const +UsdValidationContext::_ValidateStage( + WorkDispatcher &dispatcher, const UsdStagePtr &stage, + UsdValidationErrorVector *errors, std::mutex *errorsMutex, + const Usd_PrimFlagsPredicate &predicate) const { // If we reached here via Validate(const UsdStagePtr&), then the stage // must be valid. @@ -393,7 +403,7 @@ UsdValidationContext::_ValidateStage(WorkDispatcher &dispatcher, _AddErrors(validator->Validate(stage), errors, errorsMutex); }); } - _ValidatePrims(dispatcher, stage->Traverse(), errors, errorsMutex); + _ValidatePrims(dispatcher, stage->Traverse(predicate), errors, errorsMutex); } template diff --git a/pxr/usd/usd/validationContext.h b/pxr/usd/usd/validationContext.h index 47157b097f..46ca8bce06 100644 --- a/pxr/usd/usd/validationContext.h +++ b/pxr/usd/usd/validationContext.h @@ -25,6 +25,7 @@ PXR_NAMESPACE_OPEN_SCOPE class TfType; class WorkDispatcher; +class Usd_PrimFlagsPredicate; /// \class UsdValidationContext /// @@ -181,7 +182,7 @@ class UsdValidationContext /// the layers reachable from the stage. In addition to that any Stage /// validators will also be run on the given stage. The stage will also be /// traversed to run prim and schema type validators on all the prims in the - /// stage. + /// stage. \p predicate will be used to traverse the prims to be validated. /// /// All the validators run in parallel. Any resulting errors are collected /// in the returned vector. @@ -193,6 +194,19 @@ class UsdValidationContext /// /// A coding error is issued if the stage being validated is not valid. USD_API + UsdValidationErrorVector Validate( + const UsdStageWeakPtr &stage, + const Usd_PrimFlagsPredicate &predicate) const; + + /// Run validation on the given valid \p stage by executing the selected + /// validators for this UsdValidationContext; Returns a vector of errors + /// + /// \ref UsdTraverseInstanceProxies "Instance Proxy predicate" is used to + /// traverse the prims to be validated in this overload. + /// + /// \sa UsdValidationContext::Validate(const UsdStageWeakPtr &stage, + /// const Usd_PrimFlagsPredicate &predicate) const + USD_API UsdValidationErrorVector Validate(const UsdStagePtr &stage) const; /// Run validation on the given valid \p prims by executing the selected @@ -253,7 +267,8 @@ class UsdValidationContext void _ValidateStage(WorkDispatcher &dispatcher, const UsdStagePtr &stage, UsdValidationErrorVector *errors, - std::mutex *errorsMutex) const; + std::mutex *errorsMutex, + const Usd_PrimFlagsPredicate &predicate) const; // Helper function to validate prims. Generalized for UsdPrimRange and // vector of UsdPrims. From af65a82ab111cd3615c23188f2e837940b713dad Mon Sep 17 00:00:00 2001 From: diyajoy Date: Wed, 16 Oct 2024 21:35:46 -0700 Subject: [PATCH 44/82] Throw a coding error in the USD schema registry if a schema is registered without an identifier. USD uses aliases under UsdSchemaBase as identifiers if no "schemaIdentifier" field is defined in the metadata to be backwards compatible with external USD users with their own schema libraries. (Internal change: 2344778) --- pxr/usd/usd/schemaRegistry.cpp | 16 ++++++++++++---- pxr/usd/usd/testenv/testUsdSchemaRegistry.py | 10 ++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/pxr/usd/usd/schemaRegistry.cpp b/pxr/usd/usd/schemaRegistry.cpp index cf88e580c9..d3238e9447 100644 --- a/pxr/usd/usd/schemaRegistry.cpp +++ b/pxr/usd/usd/schemaRegistry.cpp @@ -163,14 +163,22 @@ struct _TypeMapCache { } // The schema's identifier is the "schemaIdentifier" field. - // If not present, we use the type's alias under UsdSchemaBase. + // If not present, we use the type's alias under UsdSchemaBase + // to maintain backwards compatibility. string identifier = _GetSchemaIdentifierFromMetadata(metadata); if(identifier.empty()) { const vector aliases = schemaBaseType.GetAliases(type); - if (aliases.size() != 1) { - continue; + if (aliases.size() == 1) { + identifier = aliases.front(); } - identifier = aliases.front(); + } + + // Check if a valid identifier was found + if (identifier.empty()) { + TF_CODING_ERROR("Registration failed for schema type %s. " + "Schema types must have a single valid identifier.", + type.GetTypeName().c_str()); + continue; } // Generate all the components of the schema info. diff --git a/pxr/usd/usd/testenv/testUsdSchemaRegistry.py b/pxr/usd/usd/testenv/testUsdSchemaRegistry.py index fb67de2f56..8ae941e633 100644 --- a/pxr/usd/usd/testenv/testUsdSchemaRegistry.py +++ b/pxr/usd/usd/testenv/testUsdSchemaRegistry.py @@ -18,6 +18,16 @@ def setUpClass(cls): assert testPlugins[0].name == "testUsdSchemaRegistry", \ "Failed to load expected test plugin" + # This checks an invalid case for test_SchemaIdentifier that throws a + # coding error on schema registry construction + try: + Usd.SchemaRegistry() + assert False, "Coding error expected on schema registry initialization." + except Tf.ErrorException as e: + assert 'Registration failed for schema type ' \ + 'TestUsdSchemaRegistryNoIdentifierAndNoAlias.' in str(e) + assert len(str(e).strip().split('\n')) == 1 + def test_PrimMetadata(self): primDef = Usd.SchemaRegistry().FindConcretePrimDefinition( "MetadataTest") From 937443364a8c5089e74cea7776bd977820a3da24 Mon Sep 17 00:00:00 2001 From: sunyab Date: Wed, 16 Oct 2024 21:40:09 -0700 Subject: [PATCH 45/82] pcp: Reenable incremental changes for layer operations This was disabled by default for the OpenUSD 24.11 release in change 2344776. This change reenables the optimization to continue development and pick up additional testing. (Internal change: 2344802) --- pxr/usd/pcp/changes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pxr/usd/pcp/changes.cpp b/pxr/usd/pcp/changes.cpp index 016edbb9df..99528bc1b5 100644 --- a/pxr/usd/pcp/changes.cpp +++ b/pxr/usd/pcp/changes.cpp @@ -26,7 +26,7 @@ PXR_NAMESPACE_OPEN_SCOPE TF_DEFINE_ENV_SETTING( - PCP_ENABLE_MINIMAL_CHANGES_FOR_LAYER_OPERATIONS, false, + PCP_ENABLE_MINIMAL_CHANGES_FOR_LAYER_OPERATIONS, true, "If enabled, pcp will compute a minimal amount of targeted change entries " "for layer operations. This can result in a significant performance " "improvement when muting/unmuting layer or adding/removing sublayers."); From 36264902bf969bc5fd05c59083d20b8a9c91047a Mon Sep 17 00:00:00 2001 From: katpet Date: Thu, 17 Oct 2024 12:34:26 -0700 Subject: [PATCH 46/82] The rileyGlobalsSceneIndexPlugin has the effect of applying render settings from the schema early enough that non-editable settings like hider:incremental are applied in time to affect the render. This causes hider:incremental to be set to false, since that is the default in the schema. Interactive renders need incremental to be enabled, so added a conditional in UpdateLegacySettings which forces incrmental to be enabled for interactive renders. (Internal change: 2344936) --- third_party/renderman-26/plugin/hdPrman/renderParam.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/third_party/renderman-26/plugin/hdPrman/renderParam.cpp b/third_party/renderman-26/plugin/hdPrman/renderParam.cpp index f8f3a68ce2..6ee733ea10 100644 --- a/third_party/renderman-26/plugin/hdPrman/renderParam.cpp +++ b/third_party/renderman-26/plugin/hdPrman/renderParam.cpp @@ -1211,6 +1211,12 @@ HdPrman_RenderParam::UpdateLegacyOptions() // SetRileyShutterIntervalFromCameraContextCameraPath. } } + + // Force incremental to be enabled for interacive renders + if (_renderDelegate->IsInteractive() && !_usingHusk) { + options.SetInteger(RixStr.k_hider_incremental, 1); + } + // Apply the batch command line settings last, so that they can // either intentionally override render settings, or sometimes be skipped // if the equivalent render setting exists, like for checkpointinterval. From cb467553369f9af45e0e0c67ff7aa673434bf4bf Mon Sep 17 00:00:00 2001 From: unhyperbolic Date: Thu, 17 Oct 2024 15:51:31 -0700 Subject: [PATCH 47/82] Adding emulation support for tasks to HdSceneIndexAdapterSceneDelegate. The scene index uses the HdLegacyTaskSchema to specify a task. The primitive type is always task and the schema includes a task factory, in lieu of the templated HdRenderIndex::InsertTask. (Internal change: 2344995) --- pxr/imaging/hd/CMakeLists.txt | 2 + pxr/imaging/hd/dirtyBitsTranslator.cpp | 39 ++++ pxr/imaging/hd/dirtyBitsTranslator.h | 5 +- pxr/imaging/hd/hdSchemaDefs.py | 20 ++ pxr/imaging/hd/legacyTaskFactory.cpp | 14 ++ pxr/imaging/hd/legacyTaskFactory.h | 59 +++++ pxr/imaging/hd/legacyTaskSchema.cpp | 209 ++++++++++++++++++ pxr/imaging/hd/legacyTaskSchema.h | 207 +++++++++++++++++ pxr/imaging/hd/renderIndex.cpp | 21 +- pxr/imaging/hd/renderIndex.h | 3 + .../hd/sceneIndexAdapterSceneDelegate.cpp | 88 +++++++- .../hd/sceneIndexAdapterSceneDelegate.h | 3 +- pxr/imaging/hd/tokens.h | 3 +- 13 files changed, 665 insertions(+), 8 deletions(-) create mode 100644 pxr/imaging/hd/legacyTaskFactory.cpp create mode 100644 pxr/imaging/hd/legacyTaskFactory.h create mode 100644 pxr/imaging/hd/legacyTaskSchema.cpp create mode 100644 pxr/imaging/hd/legacyTaskSchema.h diff --git a/pxr/imaging/hd/CMakeLists.txt b/pxr/imaging/hd/CMakeLists.txt index 84bd7f4afa..a79becac8c 100644 --- a/pxr/imaging/hd/CMakeLists.txt +++ b/pxr/imaging/hd/CMakeLists.txt @@ -103,6 +103,8 @@ pxr_library(hd legacyDisplayStyleSchema legacyGeomSubsetSceneIndex legacyPrimSceneIndex + legacyTaskFactory + legacyTaskSchema lensDistortionSchema light lightSchema diff --git a/pxr/imaging/hd/dirtyBitsTranslator.cpp b/pxr/imaging/hd/dirtyBitsTranslator.cpp index 6bffdebe75..7be39fe128 100644 --- a/pxr/imaging/hd/dirtyBitsTranslator.cpp +++ b/pxr/imaging/hd/dirtyBitsTranslator.cpp @@ -44,6 +44,7 @@ #include "pxr/imaging/hd/instanceSchema.h" #include "pxr/imaging/hd/integratorSchema.h" #include "pxr/imaging/hd/legacyDisplayStyleSchema.h" +#include "pxr/imaging/hd/legacyTaskSchema.h" #include "pxr/imaging/hd/lightSchema.h" #include "pxr/imaging/hd/materialBindingsSchema.h" #include "pxr/imaging/hd/materialConnectionSchema.h" @@ -954,6 +955,44 @@ HdDirtyBitsTranslator::InstancerLocatorSetToDirtyBits( return bits; } +/*static*/ +HdDirtyBits +HdDirtyBitsTranslator::TaskLocatorSetToDirtyBits( + HdDataSourceLocatorSet const& set) +{ + HdDataSourceLocatorSet::const_iterator it = set.begin(); + + const HdDataSourceLocatorSet::const_iterator end = set.end(); + + if (it == end) { + return HdChangeTracker::Clean; + } + + // Note, for efficiency we search for locators in the set in order, so that + // we only end up making one trip through the set. If you add to this + // function, make sure you sort the addition by locator name, or + // _FindLocator won't work. + // Also note, this should match InstancerDirtyBitsToLocatorSet + + if (*it == HdDataSourceLocator::EmptyLocator()) { + return HdChangeTracker::AllDirty; + } + + HdDirtyBits bits = HdChangeTracker::Clean; + + if (_FindLocator(HdLegacyTaskSchema::GetCollectionLocator(), end, &it)) { + bits |= HdChangeTracker::DirtyCollection; + } + if (_FindLocator(HdLegacyTaskSchema::GetParametersLocator(), end, &it)) { + bits |= HdChangeTracker::DirtyParams; + } + if (_FindLocator(HdLegacyTaskSchema::GetRenderTagsLocator(), end, &it)) { + bits |= HdChangeTracker::DirtyRenderTags; + } + + return bits; +} + /*static*/ HdDirtyBits HdDirtyBitsTranslator::BprimLocatorSetToDirtyBits( diff --git a/pxr/imaging/hd/dirtyBitsTranslator.h b/pxr/imaging/hd/dirtyBitsTranslator.h index 22e2bd19af..e9a6f2a744 100644 --- a/pxr/imaging/hd/dirtyBitsTranslator.h +++ b/pxr/imaging/hd/dirtyBitsTranslator.h @@ -48,7 +48,10 @@ class HdDirtyBitsTranslator HD_API static HdDirtyBits InstancerLocatorSetToDirtyBits(TfToken const& primType, HdDataSourceLocatorSet const& set); - + HD_API + static HdDirtyBits TaskLocatorSetToDirtyBits( + HdDataSourceLocatorSet const& set); + using LocatorSetToDirtyBitsFnc = std::function; diff --git a/pxr/imaging/hd/hdSchemaDefs.py b/pxr/imaging/hd/hdSchemaDefs.py index 3bdb4aeefc..a4cc0ebfda 100644 --- a/pxr/imaging/hd/hdSchemaDefs.py +++ b/pxr/imaging/hd/hdSchemaDefs.py @@ -1383,5 +1383,25 @@ ], ADD_DEFAULT_LOCATOR = True, ), + #-------------------------------------------------------------------------- + # legacyTask + dict( + SCHEMA_NAME = 'LegacyTask', + DOC = '''The {{ SCHEMA_CLASS_NAME }} specifies a Hydra task by providing + a task factory and data.''', + SCHEMA_TOKEN = 'task', + ADD_DEFAULT_LOCATOR = True, + MEMBERS = [ + ('ALL_MEMBERS', '', dict(ADD_LOCATOR = True)), + ('factory', 'HdLegacyTaskFactoryDataSource', {}), + ('parameters', T_SAMPLED, + dict(DOC = ''' + Parameters for task. Type depends on task type. + E.g. HdxRenderTaskParams if the factory produces HdxRenderTask + instances.''')), + ('collection', 'HdRprimCollectionDataSource', {}), + ('renderTags', 'HdTokenVectorDataSource', {}), + ], + ), ] diff --git a/pxr/imaging/hd/legacyTaskFactory.cpp b/pxr/imaging/hd/legacyTaskFactory.cpp new file mode 100644 index 0000000000..cec97b37d8 --- /dev/null +++ b/pxr/imaging/hd/legacyTaskFactory.cpp @@ -0,0 +1,14 @@ +// +// Copyright 2024 Pixar +// +// Licensed under the terms set forth in the LICENSE.txt file available at +// https://openusd.org/license. +// + +#include "pxr/imaging/hd/legacyTaskFactory.h" + +PXR_NAMESPACE_OPEN_SCOPE + +HdLegacyTaskFactory::~HdLegacyTaskFactory() = default; + +PXR_NAMESPACE_CLOSE_SCOPE diff --git a/pxr/imaging/hd/legacyTaskFactory.h b/pxr/imaging/hd/legacyTaskFactory.h new file mode 100644 index 0000000000..ad07f9469a --- /dev/null +++ b/pxr/imaging/hd/legacyTaskFactory.h @@ -0,0 +1,59 @@ +// +// Copyright 2024 Pixar +// +// Licensed under the terms set forth in the LICENSE.txt file available at +// https://openusd.org/license. +// +#ifndef PXR_IMAGING_HD_LEGACY_TASK_FACTORY_H +#define PXR_IMAGING_HD_LEGACY_TASK_FACTORY_H + +#include "pxr/pxr.h" +#include "pxr/imaging/hd/api.h" + +#include "pxr/usd/sdf/path.h" + +#include + +PXR_NAMESPACE_OPEN_SCOPE + +class HdSceneDelegate; +using HdTaskSharedPtr = std::shared_ptr; +using HdLegacyTaskFactorySharedPtr = std::shared_ptr; + +/// +/// \class HdLegacyTaskFactory +/// +/// An abstract base class to create implementations of HdTask. +/// +class HdLegacyTaskFactory +{ +public: + virtual HdTaskSharedPtr Create( + HdSceneDelegate * delegate, const SdfPath &id) = 0; + + HD_API + virtual ~HdLegacyTaskFactory(); +}; + +template +class HdLegacyTaskFactory_Impl : public HdLegacyTaskFactory +{ +public: + HdTaskSharedPtr Create( + HdSceneDelegate * const delegate, const SdfPath &id) override + { + return std::make_shared(delegate, id); + } +}; + +/// Given a subclass implementing HdTask, create a factory for that +/// subclass. +template +HdLegacyTaskFactorySharedPtr HdMakeLegacyTaskFactory() +{ + return std::make_shared>(); +} + +PXR_NAMESPACE_CLOSE_SCOPE + +#endif diff --git a/pxr/imaging/hd/legacyTaskSchema.cpp b/pxr/imaging/hd/legacyTaskSchema.cpp new file mode 100644 index 0000000000..55e6abcaa0 --- /dev/null +++ b/pxr/imaging/hd/legacyTaskSchema.cpp @@ -0,0 +1,209 @@ +// +// Copyright 2023 Pixar +// +// Licensed under the terms set forth in the LICENSE.txt file available at +// https://openusd.org/license. +// +//////////////////////////////////////////////////////////////////////// + +/* ************************************************************************** */ +/* ** ** */ +/* ** This file is generated by a script. ** */ +/* ** ** */ +/* ** Do not edit it directly (unless it is within a CUSTOM CODE section)! ** */ +/* ** Edit hdSchemaDefs.py instead to make changes. ** */ +/* ** ** */ +/* ************************************************************************** */ + +#include "pxr/imaging/hd/legacyTaskSchema.h" + +#include "pxr/imaging/hd/retainedDataSource.h" + +#include "pxr/base/trace/trace.h" + +// --(BEGIN CUSTOM CODE: Includes)-- +// --(END CUSTOM CODE: Includes)-- + +PXR_NAMESPACE_OPEN_SCOPE + +TF_DEFINE_PUBLIC_TOKENS(HdLegacyTaskSchemaTokens, + HD_LEGACY_TASK_SCHEMA_TOKENS); + +// --(BEGIN CUSTOM CODE: Schema Methods)-- +// --(END CUSTOM CODE: Schema Methods)-- + +HdLegacyTaskFactoryDataSourceHandle +HdLegacyTaskSchema::GetFactory() const +{ + return _GetTypedDataSource( + HdLegacyTaskSchemaTokens->factory); +} + +HdSampledDataSourceHandle +HdLegacyTaskSchema::GetParameters() const +{ + return _GetTypedDataSource( + HdLegacyTaskSchemaTokens->parameters); +} + +HdRprimCollectionDataSourceHandle +HdLegacyTaskSchema::GetCollection() const +{ + return _GetTypedDataSource( + HdLegacyTaskSchemaTokens->collection); +} + +HdTokenVectorDataSourceHandle +HdLegacyTaskSchema::GetRenderTags() const +{ + return _GetTypedDataSource( + HdLegacyTaskSchemaTokens->renderTags); +} + +/*static*/ +HdContainerDataSourceHandle +HdLegacyTaskSchema::BuildRetained( + const HdLegacyTaskFactoryDataSourceHandle &factory, + const HdSampledDataSourceHandle ¶meters, + const HdRprimCollectionDataSourceHandle &collection, + const HdTokenVectorDataSourceHandle &renderTags +) +{ + TfToken _names[4]; + HdDataSourceBaseHandle _values[4]; + + size_t _count = 0; + + if (factory) { + _names[_count] = HdLegacyTaskSchemaTokens->factory; + _values[_count++] = factory; + } + + if (parameters) { + _names[_count] = HdLegacyTaskSchemaTokens->parameters; + _values[_count++] = parameters; + } + + if (collection) { + _names[_count] = HdLegacyTaskSchemaTokens->collection; + _values[_count++] = collection; + } + + if (renderTags) { + _names[_count] = HdLegacyTaskSchemaTokens->renderTags; + _values[_count++] = renderTags; + } + return HdRetainedContainerDataSource::New(_count, _names, _values); +} + +HdLegacyTaskSchema::Builder & +HdLegacyTaskSchema::Builder::SetFactory( + const HdLegacyTaskFactoryDataSourceHandle &factory) +{ + _factory = factory; + return *this; +} + +HdLegacyTaskSchema::Builder & +HdLegacyTaskSchema::Builder::SetParameters( + const HdSampledDataSourceHandle ¶meters) +{ + _parameters = parameters; + return *this; +} + +HdLegacyTaskSchema::Builder & +HdLegacyTaskSchema::Builder::SetCollection( + const HdRprimCollectionDataSourceHandle &collection) +{ + _collection = collection; + return *this; +} + +HdLegacyTaskSchema::Builder & +HdLegacyTaskSchema::Builder::SetRenderTags( + const HdTokenVectorDataSourceHandle &renderTags) +{ + _renderTags = renderTags; + return *this; +} + +HdContainerDataSourceHandle +HdLegacyTaskSchema::Builder::Build() +{ + return HdLegacyTaskSchema::BuildRetained( + _factory, + _parameters, + _collection, + _renderTags + ); +} + +/*static*/ +HdLegacyTaskSchema +HdLegacyTaskSchema::GetFromParent( + const HdContainerDataSourceHandle &fromParentContainer) +{ + return HdLegacyTaskSchema( + fromParentContainer + ? HdContainerDataSource::Cast(fromParentContainer->Get( + HdLegacyTaskSchemaTokens->task)) + : nullptr); +} + +/*static*/ +const TfToken & +HdLegacyTaskSchema::GetSchemaToken() +{ + return HdLegacyTaskSchemaTokens->task; +} + +/*static*/ +const HdDataSourceLocator & +HdLegacyTaskSchema::GetDefaultLocator() +{ + static const HdDataSourceLocator locator(GetSchemaToken()); + return locator; +} + +/* static */ +const HdDataSourceLocator & +HdLegacyTaskSchema::GetFactoryLocator() +{ + static const HdDataSourceLocator locator = + GetDefaultLocator().Append( + HdLegacyTaskSchemaTokens->factory); + return locator; +} + +/* static */ +const HdDataSourceLocator & +HdLegacyTaskSchema::GetParametersLocator() +{ + static const HdDataSourceLocator locator = + GetDefaultLocator().Append( + HdLegacyTaskSchemaTokens->parameters); + return locator; +} + +/* static */ +const HdDataSourceLocator & +HdLegacyTaskSchema::GetCollectionLocator() +{ + static const HdDataSourceLocator locator = + GetDefaultLocator().Append( + HdLegacyTaskSchemaTokens->collection); + return locator; +} + +/* static */ +const HdDataSourceLocator & +HdLegacyTaskSchema::GetRenderTagsLocator() +{ + static const HdDataSourceLocator locator = + GetDefaultLocator().Append( + HdLegacyTaskSchemaTokens->renderTags); + return locator; +} + +PXR_NAMESPACE_CLOSE_SCOPE \ No newline at end of file diff --git a/pxr/imaging/hd/legacyTaskSchema.h b/pxr/imaging/hd/legacyTaskSchema.h new file mode 100644 index 0000000000..acd2f53edb --- /dev/null +++ b/pxr/imaging/hd/legacyTaskSchema.h @@ -0,0 +1,207 @@ +// +// Copyright 2023 Pixar +// +// Licensed under the terms set forth in the LICENSE.txt file available at +// https://openusd.org/license. +// +//////////////////////////////////////////////////////////////////////// + +/* ************************************************************************** */ +/* ** ** */ +/* ** This file is generated by a script. ** */ +/* ** ** */ +/* ** Do not edit it directly (unless it is within a CUSTOM CODE section)! ** */ +/* ** Edit hdSchemaDefs.py instead to make changes. ** */ +/* ** ** */ +/* ************************************************************************** */ + +#ifndef PXR_IMAGING_HD_LEGACY_TASK_SCHEMA_H +#define PXR_IMAGING_HD_LEGACY_TASK_SCHEMA_H + +/// \file + +#include "pxr/imaging/hd/api.h" + +#include "pxr/imaging/hd/schema.h" + +// --(BEGIN CUSTOM CODE: Includes)-- +#include "pxr/imaging/hd/rprimCollection.h" +// --(END CUSTOM CODE: Includes)-- + +PXR_NAMESPACE_OPEN_SCOPE + +// --(BEGIN CUSTOM CODE: Declares)-- + +using HdRprimCollectionDataSource = HdTypedSampledDataSource; +using HdRprimCollectionDataSourceHandle = HdRprimCollectionDataSource::Handle; + +using HdTokenVectorDataSource = HdTypedSampledDataSource; +using HdTokenVectorDataSourceHandle = HdTokenVectorDataSource::Handle; + +using HdLegacyTaskFactorySharedPtr = std::shared_ptr; +using HdLegacyTaskFactoryDataSource = + HdTypedSampledDataSource; +using HdLegacyTaskFactoryDataSourceHandle = + HdLegacyTaskFactoryDataSource::Handle; + + +// --(END CUSTOM CODE: Declares)-- + +#define HD_LEGACY_TASK_SCHEMA_TOKENS \ + (task) \ + (factory) \ + (parameters) \ + (collection) \ + (renderTags) \ + +TF_DECLARE_PUBLIC_TOKENS(HdLegacyTaskSchemaTokens, HD_API, + HD_LEGACY_TASK_SCHEMA_TOKENS); + +//----------------------------------------------------------------------------- + +// The HdLegacyTaskSchema specifies a Hydra task by providing a task factory +// and data. +// + +class HdLegacyTaskSchema : public HdSchema +{ +public: + /// \name Schema retrieval + /// @{ + + HdLegacyTaskSchema(HdContainerDataSourceHandle container) + : HdSchema(container) {} + + /// Retrieves a container data source with the schema's default name token + /// "task" from the parent container and constructs a + /// HdLegacyTaskSchema instance. + /// Because the requested container data source may not exist, the result + /// should be checked with IsDefined() or a bool comparison before use. + HD_API + static HdLegacyTaskSchema GetFromParent( + const HdContainerDataSourceHandle &fromParentContainer); + + /// @} + +// --(BEGIN CUSTOM CODE: Schema Methods)-- +// --(END CUSTOM CODE: Schema Methods)-- + + /// \name Member accessor + /// @{ + + HD_API + HdLegacyTaskFactoryDataSourceHandle GetFactory() const; + + /// Parameters for task. Type depends on task type. E.g. + /// HdxRenderTaskParams if the factory produces HdxRenderTask instances. + HD_API + HdSampledDataSourceHandle GetParameters() const; + + HD_API + HdRprimCollectionDataSourceHandle GetCollection() const; + + HD_API + HdTokenVectorDataSourceHandle GetRenderTags() const; + + /// @} + + /// \name Schema location + /// @{ + + /// Returns a token where the container representing this schema is found in + /// a container by default. + HD_API + static const TfToken &GetSchemaToken(); + + /// Returns an HdDataSourceLocator (relative to the prim-level data source) + /// where the container representing this schema is found by default. + HD_API + static const HdDataSourceLocator &GetDefaultLocator(); + + /// @} + + /// \name Data source locators for members + /// + /// The following methods return an HdDataSourceLocator (relative to the + /// prim-level data source) where the data source for a member can be found. + /// + /// This is often useful for checking intersection against the + /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied. + /// @{ + + /// Prim-level relative data source locator to locate factory. + HD_API + static const HdDataSourceLocator &GetFactoryLocator(); + + /// Prim-level relative data source locator to locate parameters. + HD_API + static const HdDataSourceLocator &GetParametersLocator(); + + /// Prim-level relative data source locator to locate collection. + HD_API + static const HdDataSourceLocator &GetCollectionLocator(); + + /// Prim-level relative data source locator to locate renderTags. + HD_API + static const HdDataSourceLocator &GetRenderTagsLocator(); + /// @} + + /// \name Schema construction + /// @{ + + /// \deprecated Use Builder instead. + /// + /// Builds a container data source which includes the provided child data + /// sources. Parameters with nullptr values are excluded. This is a + /// low-level interface. For cases in which it's desired to define + /// the container with a sparse set of child fields, the Builder class + /// is often more convenient and readable. + HD_API + static HdContainerDataSourceHandle + BuildRetained( + const HdLegacyTaskFactoryDataSourceHandle &factory, + const HdSampledDataSourceHandle ¶meters, + const HdRprimCollectionDataSourceHandle &collection, + const HdTokenVectorDataSourceHandle &renderTags + ); + + /// \class HdLegacyTaskSchema::Builder + /// + /// Utility class for setting sparse sets of child data source fields to be + /// filled as arguments into BuildRetained. Because all setter methods + /// return a reference to the instance, this can be used in the "builder + /// pattern" form. + class Builder + { + public: + HD_API + Builder &SetFactory( + const HdLegacyTaskFactoryDataSourceHandle &factory); + HD_API + Builder &SetParameters( + const HdSampledDataSourceHandle ¶meters); + HD_API + Builder &SetCollection( + const HdRprimCollectionDataSourceHandle &collection); + HD_API + Builder &SetRenderTags( + const HdTokenVectorDataSourceHandle &renderTags); + + /// Returns a container data source containing the members set thus far. + HD_API + HdContainerDataSourceHandle Build(); + + private: + HdLegacyTaskFactoryDataSourceHandle _factory; + HdSampledDataSourceHandle _parameters; + HdRprimCollectionDataSourceHandle _collection; + HdTokenVectorDataSourceHandle _renderTags; + + }; + + /// @} +}; + +PXR_NAMESPACE_CLOSE_SCOPE + +#endif \ No newline at end of file diff --git a/pxr/imaging/hd/renderIndex.cpp b/pxr/imaging/hd/renderIndex.cpp index 503a8fc27e..dea05765bc 100644 --- a/pxr/imaging/hd/renderIndex.cpp +++ b/pxr/imaging/hd/renderIndex.cpp @@ -348,6 +348,7 @@ HdRenderIndex::_RemoveSubtree( _sprimIndex.RemoveSubtree(root, sceneDelegate, _tracker, _renderDelegate); _bprimIndex.RemoveSubtree(root, sceneDelegate, _tracker, _renderDelegate); _RemoveInstancerSubtree(root, sceneDelegate); + _RemoveTaskSubtree(root, sceneDelegate); } @@ -587,6 +588,7 @@ HdRenderIndex::_Clear() // Clear instancers. _RemoveInstancerSubtree(SdfPath::AbsoluteRootPath(), nullptr); + _RemoveTaskSubtree(SdfPath::AbsoluteRootPath(), nullptr); _instancerMap.clear(); } @@ -606,9 +608,20 @@ HdRenderIndex::_TrackDelegateTask(HdSceneDelegate* delegate, return; } - HdTaskSharedPtr task = taskCreateFnc(delegate, taskId); - _tracker.TaskInserted(taskId, task->GetInitialDirtyBitsMask()); - _taskMap.emplace(taskId, _TaskInfo{delegate, task}); + HdTaskSharedPtr const task = taskCreateFnc(delegate, taskId); + _InsertTask(delegate, taskId, task); +} + +void +HdRenderIndex::_InsertTask(HdSceneDelegate* delegate, + SdfPath const &id, + HdTaskSharedPtr const &task) +{ + HD_TRACE_FUNCTION(); + HF_MALLOC_TAG_FUNCTION(); + + _tracker.TaskInserted(id, task->GetInitialDirtyBitsMask()); + _taskMap.emplace(id, _TaskInfo{delegate, task}); } HdTaskSharedPtr const& @@ -650,7 +663,7 @@ HdRenderIndex::_RemoveTaskSubtree(const SdfPath &root, const SdfPath &id = it->first; const _TaskInfo &taskInfo = it->second; - if ((taskInfo.sceneDelegate == sceneDelegate) && + if ((sceneDelegate == nullptr || taskInfo.sceneDelegate == sceneDelegate ) && (id.HasPrefix(root))) { _tracker.TaskRemoved(id); diff --git a/pxr/imaging/hd/renderIndex.h b/pxr/imaging/hd/renderIndex.h index a718c77269..97b85d82b1 100644 --- a/pxr/imaging/hd/renderIndex.h +++ b/pxr/imaging/hd/renderIndex.h @@ -485,6 +485,9 @@ class HdRenderIndex final SdfPath const& bprimId); void _InsertInstancer(HdSceneDelegate* delegate, SdfPath const &id); + void _InsertTask(HdSceneDelegate* delegate, + SdfPath const &id, + HdTaskSharedPtr const &task); void _RemoveRprim(SdfPath const& id); void _RemoveSprim(TfToken const& typeId, SdfPath const& id); diff --git a/pxr/imaging/hd/sceneIndexAdapterSceneDelegate.cpp b/pxr/imaging/hd/sceneIndexAdapterSceneDelegate.cpp index 85915b9cd7..ec00c7a70a 100644 --- a/pxr/imaging/hd/sceneIndexAdapterSceneDelegate.cpp +++ b/pxr/imaging/hd/sceneIndexAdapterSceneDelegate.cpp @@ -19,6 +19,8 @@ #include "pxr/imaging/hd/extComputationCpuCallback.h" #include "pxr/imaging/hd/field.h" #include "pxr/imaging/hd/geomSubset.h" +#include "pxr/imaging/hd/legacyTaskFactory.h" +#include "pxr/imaging/hd/legacyTaskSchema.h" #include "pxr/imaging/hd/light.h" #include "pxr/imaging/hd/material.h" #include "pxr/imaging/hd/meshTopology.h" @@ -194,6 +196,40 @@ HdSceneIndexAdapterSceneDelegate::_GetInputPrim(SdfPath const& id) // ---------------------------------------------------------------------------- // HdSceneIndexObserver interfaces +static +HdTaskSharedPtr _CreateTask(const HdSceneIndexPrim &prim, + HdSceneDelegate * const delegate, + const SdfPath &indexPath) +{ + const HdLegacyTaskSchema taskSchema = + HdLegacyTaskSchema::GetFromParent(prim.dataSource); + HdLegacyTaskFactoryDataSourceHandle const ds = + taskSchema.GetFactory(); + if (!ds) { + TF_CODING_ERROR( + "When adding task %s in HdSceneIndexAdapterSceneDelegate: " + "No factory data source in HdLegacyTaskSchema.", + indexPath.GetText()); + return nullptr; + } + HdLegacyTaskFactorySharedPtr const factory = ds->GetTypedValue(0.0f); + if (!factory) { + TF_CODING_ERROR( + "When adding task %s in HdSceneIndexAdapterSceneDelegate: " + "No factory in HdLegacyTaskSchema.", + indexPath.GetText()); + return nullptr; + } + HdTaskSharedPtr const task = factory->Create(delegate, indexPath); + if (!task) { + TF_CODING_ERROR( + "When adding task %s in HdSceneIndexAdapterSceneDelegate: " + "No task from factory in HdLegacyTaskSchema.", + indexPath.GetText()); + } + return task; +} + void HdSceneIndexAdapterSceneDelegate::_PrimAdded( const SdfPath &primPath, @@ -208,12 +244,13 @@ HdSceneIndexAdapterSceneDelegate::_PrimAdded( // and re-insert with the correct type. // (3) The prim exists, and has the right type; in this case, we don't // remove the prim but we should invalidate all of its properties. + // Note that we make an exception for tasks - which we handle like (2). bool isResync = false; if (it != _primCache.end()) { _PrimCacheEntry &entry = (*it).second; const TfToken &existingType = entry.primType; - if (primType != existingType) { + if (primType != existingType || primType == HdPrimTypeTokens->task) { if (GetRenderIndex().IsRprimTypeSupported(existingType)) { GetRenderIndex()._RemoveRprim(indexPath); } else if (GetRenderIndex().IsSprimTypeSupported(existingType)) { @@ -243,6 +280,11 @@ HdSceneIndexAdapterSceneDelegate::_PrimAdded( } else if (primType == HdPrimTypeTokens->geomSubset) { GetRenderIndex().GetChangeTracker()._MarkRprimDirty( indexPath.GetParentPath(), HdChangeTracker::DirtyTopology); + } else if (primType == HdPrimTypeTokens->task) { + if (HdTaskSharedPtr const task = + _CreateTask(_GetInputPrim(indexPath), this, indexPath)) { + GetRenderIndex()._InsertTask(this, indexPath, task); + } } } @@ -362,6 +404,8 @@ HdSceneIndexAdapterSceneDelegate::PrimsRemoved( GetRenderIndex().GetChangeTracker()._MarkRprimDirty( entry.primPath.GetParentPath(), HdChangeTracker::DirtyTopology); + } else if (primType == HdPrimTypeTokens->task) { + GetRenderIndex().RemoveTask(entry.primPath); } } else { // Otherwise, there's a subtree and we need to call _RemoveSubtree. @@ -439,6 +483,14 @@ HdSceneIndexAdapterSceneDelegate::PrimsDirtied( } else if (primType == HdPrimTypeTokens->geomSubset) { GetRenderIndex().GetChangeTracker()._MarkRprimDirty( indexPath.GetParentPath(), HdChangeTracker::DirtyTopology); + } else if (primType == HdPrimTypeTokens->task) { + const HdDirtyBits dirtyBits = + HdDirtyBitsTranslator::TaskLocatorSetToDirtyBits( + entry.dirtyLocators); + if (dirtyBits != HdChangeTracker::Clean) { + GetRenderIndex().GetChangeTracker().MarkTaskDirty( + indexPath, dirtyBits); + } } if (entry.dirtyLocators.Intersects( @@ -2043,6 +2095,26 @@ HdSceneIndexAdapterSceneDelegate::Get(SdfPath const &id, TfToken const &key) } } + // For tasks. + if (const HdLegacyTaskSchema task = + HdLegacyTaskSchema::GetFromParent(prim.dataSource)) { + if (key == HdTokens->params) { + if (HdSampledDataSourceHandle const ds = task.GetParameters()) { + return ds->GetValue(0.0f); + } + } + if (key == HdTokens->collection) { + if (HdRprimCollectionDataSourceHandle const ds = task.GetCollection()) { + return ds->GetValue(0.0f); + } + } + if (key == HdTokens->renderTags) { + if (HdTokenVectorDataSourceHandle const ds = task.GetRenderTags()) { + return ds->GetValue(0.0f); + } + } + } + // Fallback for unknown prim conventions provided by emulated scene // delegate. if (HdTypedSampledDataSource::Handle sdDs = @@ -2732,6 +2804,20 @@ HdSceneIndexAdapterSceneDelegate::InvokeExtComputation( callback->Compute(context); } +TfTokenVector +HdSceneIndexAdapterSceneDelegate::GetTaskRenderTags(SdfPath const &taskId) +{ + TRACE_FUNCTION(); + HF_MALLOC_TAG_FUNCTION(); + const HdSceneIndexPrim prim = _GetInputPrim(taskId); + const HdLegacyTaskSchema task = HdLegacyTaskSchema::GetFromParent(prim.dataSource); + HdTokenVectorDataSourceHandle const ds = task.GetRenderTags(); + if (!ds) { + return {}; + } + return ds->GetTypedValue(0.0f); +} + void HdSceneIndexAdapterSceneDelegate::Sync(HdSyncRequestVector* request) { diff --git a/pxr/imaging/hd/sceneIndexAdapterSceneDelegate.h b/pxr/imaging/hd/sceneIndexAdapterSceneDelegate.h index ab112c11c3..7f497927a3 100644 --- a/pxr/imaging/hd/sceneIndexAdapterSceneDelegate.h +++ b/pxr/imaging/hd/sceneIndexAdapterSceneDelegate.h @@ -199,11 +199,12 @@ class HdSceneIndexAdapterSceneDelegate void InvokeExtComputation(SdfPath const &computationId, HdExtComputationContext *context) override; + TfTokenVector GetTaskRenderTags(SdfPath const &taskId) override; + void Sync(HdSyncRequestVector* request) override; void PostSyncCleanup() override; // NOTE: The remaining scene delegate functions aren't used for emulation: - // - GetTaskRenderTags // - GetScenePrimPath // - IsEnabled diff --git a/pxr/imaging/hd/tokens.h b/pxr/imaging/hd/tokens.h index 06eb28fdec..26438478b2 100644 --- a/pxr/imaging/hd/tokens.h +++ b/pxr/imaging/hd/tokens.h @@ -327,7 +327,8 @@ PXR_NAMESPACE_OPEN_SCOPE HD_SPRIMTYPE_TOKENS \ HD_BPRIMTYPE_TOKENS \ /* Scene-index-only prim types */ \ - (renderPass) + (renderPass) \ + (task) HD_API bool HdPrimTypeIsGprim(TfToken const& primType); From 9f2f90690cab78d4044a8c9d7e65a7ad34a24eae Mon Sep 17 00:00:00 2001 From: sarahsunnysideup Date: Thu, 17 Oct 2024 15:54:14 -0700 Subject: [PATCH 48/82] This changes adds an "exposureAdjust" parameter to portal lights. This exposure is added atop the dome light exposure to allow lighters to update the exposure on a portal light. (Internal change: 2345005) --- .../plugin/hdPrman/portalLightResolvingSceneIndexPlugin.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/third_party/renderman-26/plugin/hdPrman/portalLightResolvingSceneIndexPlugin.cpp b/third_party/renderman-26/plugin/hdPrman/portalLightResolvingSceneIndexPlugin.cpp index 74c13dfdb0..609348cad7 100644 --- a/third_party/renderman-26/plugin/hdPrman/portalLightResolvingSceneIndexPlugin.cpp +++ b/third_party/renderman-26/plugin/hdPrman/portalLightResolvingSceneIndexPlugin.cpp @@ -52,6 +52,7 @@ TF_DEFINE_PRIVATE_TOKENS( (exposure) (intensity) ((intensityMult, "ri:light:intensityMult")) + ((exposureAdjust, "ri:light:exposureAdjust")) ((portalName, "ri:light:portalName")) ((portalToDome, "ri:light:portalToDome")) ((tint, "ri:light:tint")) @@ -313,9 +314,11 @@ _BuildPortalLightDataSource( const VtValue portalTintVal = getPortalMatVal(_tokens->tint); const VtValue portalIntMultVal = getPortalMatVal(_tokens->intensityMult); + const VtValue portalExpAdjtVal = getPortalMatVal(_tokens->exposureAdjust); const auto portalTint = portalTintVal.GetWithDefault(GfVec3f(1.0f)); const auto portalIntMult = portalIntMultVal.GetWithDefault(1.0f); + const auto portalExpAdj = portalExpAdjtVal.GetWithDefault(0.0f); GfMatrix4d portalXform; if (const auto origPortalXform = portalXformSchema.GetMatrix()) { @@ -346,7 +349,7 @@ _BuildPortalLightDataSource( const auto computedPortalColor = GfCompMult(portalTint, domeColor); const auto computedPortalIntensity = portalIntMult * domeIntensity * - powf(2.0f, domeExposure); + powf(2.0f, domeExposure+portalExpAdj); const auto computedPortalToDome = portalXform * domeXform.GetInverse(); const auto computedPortalName = _GetPortalName(domeColorMap, domeXform, portalXform); From a652faa09d36732b86d49368de7900a2c8d04097 Mon Sep 17 00:00:00 2001 From: sarahsunnysideup Date: Thu, 17 Oct 2024 15:55:47 -0700 Subject: [PATCH 49/82] Updating the versions specified in the #ifdefs to the actual versions that these features were supported in. (Internal change: 2345006) --- .../renderman-26/plugin/hdPrman/renderPassSceneIndex.cpp | 4 ++-- .../renderman-26/plugin/hdPrman/renderPassSceneIndex.h | 4 ++-- .../plugin/hdPrman/renderPassSceneIndexPlugin.cpp | 4 ++-- .../plugin/hdPrman/renderPassSceneIndexPlugin.h | 4 ++-- third_party/renderman-26/plugin/hdPrman/renderSettings.cpp | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/third_party/renderman-26/plugin/hdPrman/renderPassSceneIndex.cpp b/third_party/renderman-26/plugin/hdPrman/renderPassSceneIndex.cpp index 0e736e301d..7fdaeac183 100644 --- a/third_party/renderman-26/plugin/hdPrman/renderPassSceneIndex.cpp +++ b/third_party/renderman-26/plugin/hdPrman/renderPassSceneIndex.cpp @@ -4,7 +4,7 @@ // https://openusd.org/license. #include "hdPrman/renderPassSceneIndex.h" -#if PXR_VERSION >= 2405 +#if PXR_VERSION >= 2408 #include "hdPrman/tokens.h" #include "pxr/imaging/hd/version.h" @@ -547,4 +547,4 @@ HdPrman_RenderPassSceneIndex::_UpdateActiveRenderPassState( } PXR_NAMESPACE_CLOSE_SCOPE -#endif //PXR_VERSION >= 2405 +#endif //PXR_VERSION >= 2408 diff --git a/third_party/renderman-26/plugin/hdPrman/renderPassSceneIndex.h b/third_party/renderman-26/plugin/hdPrman/renderPassSceneIndex.h index 776a0b6e71..eca7d9342e 100644 --- a/third_party/renderman-26/plugin/hdPrman/renderPassSceneIndex.h +++ b/third_party/renderman-26/plugin/hdPrman/renderPassSceneIndex.h @@ -7,7 +7,7 @@ #define EXT_RMANPKG_25_0_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_RENDER_PASS_SCENE_INDEX_H #include "pxr/pxr.h" -#if PXR_VERSION >= 2405 +#if PXR_VERSION >= 2408 #include "pxr/imaging/hd/collectionExpressionEvaluator.h" #include "pxr/imaging/hd/filteringSceneIndex.h" #include @@ -92,4 +92,4 @@ class HdPrman_RenderPassSceneIndex : PXR_NAMESPACE_CLOSE_SCOPE #endif -#endif // PXR_VERSION >= 2405 +#endif // PXR_VERSION >= 2408 diff --git a/third_party/renderman-26/plugin/hdPrman/renderPassSceneIndexPlugin.cpp b/third_party/renderman-26/plugin/hdPrman/renderPassSceneIndexPlugin.cpp index e25c1ce62b..18a0cb2a05 100644 --- a/third_party/renderman-26/plugin/hdPrman/renderPassSceneIndexPlugin.cpp +++ b/third_party/renderman-26/plugin/hdPrman/renderPassSceneIndexPlugin.cpp @@ -6,7 +6,7 @@ #include "hdPrman/renderPassSceneIndexPlugin.h" -#if PXR_VERSION >= 2405 +#if PXR_VERSION >= 2408 #include "hdPrman/tokens.h" @@ -56,4 +56,4 @@ HdPrman_RenderPassSceneIndexPlugin::_AppendSceneIndex( PXR_NAMESPACE_CLOSE_SCOPE -#endif // PXR_VERSION >= 2405 +#endif // PXR_VERSION >= 2408 diff --git a/third_party/renderman-26/plugin/hdPrman/renderPassSceneIndexPlugin.h b/third_party/renderman-26/plugin/hdPrman/renderPassSceneIndexPlugin.h index 0297ab05ef..d9a5190493 100644 --- a/third_party/renderman-26/plugin/hdPrman/renderPassSceneIndexPlugin.h +++ b/third_party/renderman-26/plugin/hdPrman/renderPassSceneIndexPlugin.h @@ -8,7 +8,7 @@ #define EXT_RMANPKG_25_0_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_RENDER_PASS_SCENE_INDEX_PLUGIN_H #include "pxr/pxr.h" -#if PXR_VERSION >= 2405 +#if PXR_VERSION >= 2408 #include "pxr/imaging/hd/sceneIndexPlugin.h" #include "hdPrman/api.h" @@ -33,4 +33,4 @@ class HdPrman_RenderPassSceneIndexPlugin : public HdSceneIndexPlugin PXR_NAMESPACE_CLOSE_SCOPE #endif -#endif //PXR_VERSION >= 2405 +#endif //PXR_VERSION >= 2408 diff --git a/third_party/renderman-26/plugin/hdPrman/renderSettings.cpp b/third_party/renderman-26/plugin/hdPrman/renderSettings.cpp index 69fe636b5e..bd3e8c5183 100644 --- a/third_party/renderman-26/plugin/hdPrman/renderSettings.cpp +++ b/third_party/renderman-26/plugin/hdPrman/renderSettings.cpp @@ -231,7 +231,7 @@ _UpdateRileyCamera( } } -#if PXR_VERSION >= 2405 +#if PXR_VERSION >= 2407 // Update the Frame number from the Stage Global Scene Index void _UpdateFrame( @@ -563,7 +563,7 @@ void HdPrman_RenderSettings::_Sync( } #endif -#if PXR_VERSION >= 2405 +#if PXR_VERSION >= 2407 if (*dirtyBits & HdRenderSettings::DirtyFrameNumber || *dirtyBits & HdRenderSettings::DirtyNamespacedSettings) { _UpdateFrame(terminalSi, &_settingsOptions); @@ -587,7 +587,7 @@ void HdPrman_RenderSettings::_Sync( param->SetDrivingRenderSettingsPrimPath(GetId()); -#if PXR_VERSION >= 2405 +#if PXR_VERSION >= 2407 if (*dirtyBits & HdRenderSettings::DirtyNamespacedSettings || *dirtyBits & HdRenderSettings::DirtyActive || *dirtyBits & HdRenderSettings::DirtyShutterInterval || From 8d26aaf3dac5a458b3c1e0e36755abe4757c2a2b Mon Sep 17 00:00:00 2001 From: klucknav Date: Tue, 22 Oct 2024 10:20:02 -0700 Subject: [PATCH 50/82] Update UsdPreviewSurface spec to remove statement that when opacity = 0 we still get a specular reflection. (Internal change: 2345159) --- docs/spec_usdpreviewsurface.rst | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/spec_usdpreviewsurface.rst b/docs/spec_usdpreviewsurface.rst index 56038a7997..6b0ff67717 100644 --- a/docs/spec_usdpreviewsurface.rst +++ b/docs/spec_usdpreviewsurface.rst @@ -151,12 +151,14 @@ and :usda:`opacity`. Roughness for the second specular lobe. Clearcoat results are calculated using the same normal map data used by the primary specular lobe. +.. _updateopacity: + * **opacity - float - 1.0** When *opacity* is 1.0 then the gprim is fully opaque, if it is smaller than - 1.0 then the prim is translucent, when it is 0 the gprim is transparent. Note - that even a fully transparent object still receives lighting as, for example, - perfectly clear glass still has a specular response. + 1.0 then the prim is translucent, when it is 0 the gprim is fully transparent. + Fully transparent objects receive no lighting response, thus they always + serve as cutouts, even in "transparency mode". .. _addopacitythreshold: @@ -1073,10 +1075,20 @@ From version 2.3... of specular components, including the clearcoat when :math:`UsdPreviewSurface.clearcoat > 0`. -Version 2.5 - Current Head -########################## +Version 2.5 +########### From version 2.4... * :ref:`Updates UDIM specification to include tile 1100.` Changes the baseline UDIM tile support from 1001-1099, inclusive, to 1001-1100. This allows for a 10x10 grid of UDIM tiles. + +Version 2.6 - Current Head +########################## + +From version 2.5... + * :ref:`Updates description of UsdPreviewSurface behavior when opacity is 0. + ` + Removes the statement that materials with opacity = 0 still receive a + specular reflection, instead indicating that fully transparent materials + receive no lighting response. From d0a02f65b192a7b88122de76296c2bc46ffe4295 Mon Sep 17 00:00:00 2001 From: sunyab Date: Tue, 22 Oct 2024 10:22:16 -0700 Subject: [PATCH 51/82] python: Avoid std::tuple template instantiations Construct the arg_from_python wrappers as arguments to an immediately-invoked generic lambda instead of storing them in a std::tuple. The time to instantiate these std::tuples showed up as a hotspot when profiling compile times. With this change, a test OpenUSD build on an M1 Mac was reduced from ~13:00 to ~12:30 (~4%). As part of this, copy operations were disabled for arg_from_python implementation classes that managed objects in referent_storage. These operations were unsafe since each copy would invoke the d'tor of the same managed object. pxr_boost::python (and the original boost::python code) never actually invoked these copy operations, but conceptually this is more correct. This also avoids what seems to be a bug in Visual Studio related to C++17 copy elision and destructors being called too many times. See: https://developercommunity.visualstudio.com/t/MSVC-produces-extra-destructor-call-even/10152483 (Internal change: 2345201) --- .../converter/obj_mgr_arg_from_python.hpp | 7 +++ .../converter/rvalue_from_python_data.hpp | 4 ++ pxr/external/boost/python/detail/caller.hpp | 57 +++++++++---------- 3 files changed, 39 insertions(+), 29 deletions(-) diff --git a/pxr/external/boost/python/converter/obj_mgr_arg_from_python.hpp b/pxr/external/boost/python/converter/obj_mgr_arg_from_python.hpp index 8751e92d36..7ad954c92e 100644 --- a/pxr/external/boost/python/converter/obj_mgr_arg_from_python.hpp +++ b/pxr/external/boost/python/converter/obj_mgr_arg_from_python.hpp @@ -58,6 +58,13 @@ struct object_manager_ref_arg_from_python typedef Ref result_type; object_manager_ref_arg_from_python(PyObject*); + + // Disallow copies to avoid double-destruction of object in m_result. + object_manager_ref_arg_from_python( + object_manager_ref_arg_from_python const&) = delete; + object_manager_ref_arg_from_python& operator=( + object_manager_ref_arg_from_python const&) = delete; + bool convertible() const; Ref operator()() const; ~object_manager_ref_arg_from_python(); diff --git a/pxr/external/boost/python/converter/rvalue_from_python_data.hpp b/pxr/external/boost/python/converter/rvalue_from_python_data.hpp index 24c1f61d58..64f8407198 100644 --- a/pxr/external/boost/python/converter/rvalue_from_python_data.hpp +++ b/pxr/external/boost/python/converter/rvalue_from_python_data.hpp @@ -118,6 +118,10 @@ struct rvalue_from_python_data : rvalue_from_python_storage // conversion, where the construct() function is already known. rvalue_from_python_data(void* convertible); + // Disallow copies to avoid double-destruction of object in storage. + rvalue_from_python_data(rvalue_from_python_data const&) = delete; + rvalue_from_python_data& operator=(rvalue_from_python_data const&) = delete; + // Destroys any object constructed in the storage. ~rvalue_from_python_data(); private: diff --git a/pxr/external/boost/python/detail/caller.hpp b/pxr/external/boost/python/detail/caller.hpp index c0e762c47d..0cabb30287 100644 --- a/pxr/external/boost/python/detail/caller.hpp +++ b/pxr/external/boost/python/detail/caller.hpp @@ -218,12 +218,17 @@ struct caller }; -template +template struct caller_arity> { template - struct impl + struct impl; + + template + struct impl> { + using Sig = python::type_list; + impl(F f, Policies p) : m_data(f,p) {} PyObject* operator()(PyObject* args_, PyObject*) // eliminate @@ -231,39 +236,33 @@ struct caller_arity> // trailing // keyword dict { - typedef typename detail::mpl2::front::type result_t; + typedef Ret result_t; typedef typename select_result_converter::type result_converter; typedef typename Policies::argument_package argument_package; argument_package inner_args(args_); - // N... is a 0-based sequence of indexes corresponding to the - // expected arguments in args_. However, this must be offset by - // 1 to retrieve the corresponding argument type from Sig, since - // that type sequence begins with an additional entry representing - // the function's return type. - using arg_from_python_tuple = std::tuple< - arg_from_python::type>... - >; - arg_from_python_tuple t{ get(detail::mpl2::int_(), inner_args)... }; - - if ( (... || !std::get(t).convertible()) ) { - return 0; - } - - // all converters have been checked. Now we can do the - // precall part of the policy - if (!m_data.second().precall(inner_args)) - return 0; - - PyObject* result = detail::invoke( - detail::invoke_tag() - , create_result_converter(args_, (result_converter*)0, (result_converter*)0) - , m_data.first() - , std::get(t)... - ); + return [&](auto... arg) -> PyObject* + { + if ((!arg.convertible() || ...)) { + return 0; + } + + // all converters have been checked. Now we can do the + // precall part of the policy + if (!m_data.second().precall(inner_args)) + return 0; + + PyObject* result = detail::invoke( + detail::invoke_tag() + , create_result_converter(args_, (result_converter*)0, (result_converter*)0) + , m_data.first() + , arg... + ); - return m_data.second().postcall(inner_args, result); + return m_data.second().postcall(inner_args, result); + + }(arg_from_python(get(detail::mpl2::int_(), inner_args))...); } static unsigned min_arity() { return sizeof...(N); } From c162ebbd17763d2d2082316de5438368e31aae5a Mon Sep 17 00:00:00 2001 From: pixar-oss Date: Wed, 23 Oct 2024 08:26:38 -0700 Subject: [PATCH 52/82] Adding the UsdNamespaceEditor for downstream dependent edits involving sublayers. (Internal change: 2345367) --- pxr/usd/usd/CMakeLists.txt | 7 + ...spaceEditorDependentEditsBasicSublayers.py | 894 ++++++++++++++++++ 2 files changed, 901 insertions(+) create mode 100644 pxr/usd/usd/testenv/testUsdNamespaceEditorDependentEditsBasicSublayers.py diff --git a/pxr/usd/usd/CMakeLists.txt b/pxr/usd/usd/CMakeLists.txt index 2efc40ffd4..872e470716 100644 --- a/pxr/usd/usd/CMakeLists.txt +++ b/pxr/usd/usd/CMakeLists.txt @@ -236,6 +236,7 @@ pxr_test_scripts( testenv/testUsdNamespaceEditor.py testenv/testUsdNamespaceEditorDependentEditsBase.py:testUsdNamespaceEditorDependentEditsBase.py testenv/testUsdNamespaceEditorDependentEditsBasicReferencesAndPayloads.py + testenv/testUsdNamespaceEditorDependentEditsBasicSublayers.py testenv/testUsdNamespaceEditorProperties.py testenv/testUsdNamespaceEditorTargetPathFixup.py testenv/testUsdNotices.py @@ -1288,6 +1289,12 @@ pxr_register_test(testUsdNamespaceEditorDependentEditsBasicReferencesAndPayloads EXPECTED_RETURN_CODE 0 ) +pxr_register_test(testUsdNamespaceEditorDependentEditsBasicSublayers + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdNamespaceEditorDependentEditsBasicSublayers" + EXPECTED_RETURN_CODE 0 +) + pxr_register_test(testUsdNamespaceEditorProperties PYTHON COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdNamespaceEditorProperties" diff --git a/pxr/usd/usd/testenv/testUsdNamespaceEditorDependentEditsBasicSublayers.py b/pxr/usd/usd/testenv/testUsdNamespaceEditorDependentEditsBasicSublayers.py new file mode 100644 index 0000000000..7de3777c2a --- /dev/null +++ b/pxr/usd/usd/testenv/testUsdNamespaceEditorDependentEditsBasicSublayers.py @@ -0,0 +1,894 @@ +#!/pxrpythonsubst +# +# Copyright 2024 Pixar +# +# Licensed under the terms set forth in the LICENSE.txt file available at +# https://openusd.org/license. + +import unittest +from pxr import Sdf, Usd +from testUsdNamespaceEditorDependentEditsBase \ + import TestUsdNamespaceEditorDependentEditsBase + +class TestUsdNamespaceEditorDependentEditsBasicRelocates( + TestUsdNamespaceEditorDependentEditsBase): + '''Tests downstream dependency namespace edits across sublayers. + ''' + + def test_BasicDependentSublayers(self): + """Tests downstream dependency namespace edits across sublayers from + other dependent stages.""" + + # Setup: + # Layer1 is a simple base layer with a prim hierarchy of /Ref, + # Child, and GrandChild. This layer will be opened as the base stage + # that direct namespace edits will be performed on. + layer1 = Sdf.Layer.CreateAnonymous("layer1.usda") + layer1.ImportFromString('''#usda 1.0 + def "Ref" ( + ) { + int refAttr + + def "Child" { + int childAttr + + def "GrandChild" { + int grandChildAttr + } + } + } + ''') + + # Layer2 includes layer1 as a sublayer and provides opinions for Ref + # Child and GrandChild. + layer2 = Sdf.Layer.CreateAnonymous("layer2.usda") + layer2.ImportFromString('''#usda 1.0 + ( + subLayers = [@''' + layer1.identifier + '''@] + ) + + over "Ref" ( + ) { + int over2RefAttr + + over "Child" { + int over2ChildAttr + + over "GrandChild" { + int over2GrandChildAttr + } + } + } + ''') + + # Layer3Sub will be a sublayer of the next layer, layer3 and provides + # opinions for Ref Child and GrandChild. + layer3Sub = Sdf.Layer.CreateAnonymous("layer3-sub.usda") + layer3Sub.ImportFromString('''#usda 1.0 + over "Ref" ( + ) { + int overSub3RefAttr + + over "Child" { + int overSub3ChildAttr + + over "GrandChild" { + int overSub3GrandChildAttr + } + } + } + ''') + + # Layer3 includes layer2 (which includes layer1) and layer3Sub as + # sublayer and also includes local opionion for the prims. + layer3 = Sdf.Layer.CreateAnonymous("layer3.usda") + layer3.ImportFromString('''#usda 1.0 + ( + subLayers = [ + @''' + layer2.identifier + '''@, + @''' + layer3Sub.identifier + '''@ + ] + ) + + over "Ref" ( + ) { + int over3RefAttr + + over "Child" { + int over3ChildAttr + + over "GrandChild" { + int over3GrandChildAttr + } + } + } + ''') + + # Layer4 includes layer3 as a sublayer as well as its own local + # opinions for the same prims. + layer4 = Sdf.Layer.CreateAnonymous("layer4.usda") + layer4.ImportFromString('''#usda 1.0 + ( + subLayers = [@''' + layer3.identifier + '''@] + ) + + over "Ref" ( + ) { + int over4RefAttr + + over "Child" { + int over4ChildAttr + + over "GrandChild" { + int over4GrandChildAttr + } + } + } + ''') + + # Open stages for the 4 main layers (excludes layer3Sub) + stage1 = Usd.Stage.Open(layer1) + stage2 = Usd.Stage.Open(layer2) + stage3 = Usd.Stage.Open(layer3) + stage4 = Usd.Stage.Open(layer4) + + # Create a namespace editor for stage1 which only includes layer1. + editor = Usd.NamespaceEditor(stage1) + + # Add ONLY stage3 as a dependent stage. This is to specifically show + # how layer2 will be affected by edits because stage3 depends on it + # but layer4 will not be affected as stage4 would've needed to be added + # to introduce any dependencies on layer4. + editor.AddDependentStage(stage3) + + # Verify initial contents of each stage. + + # Stage1 only includes opinions from layer1 + stage1ChildContents = { + '.' : ['childAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr'], + } + } + + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + 'Child' : stage1ChildContents + }, + }) + + # Stage2's contents come from layer1 and layer2. + stage2ChildContents = { + '.' : ['childAttr', 'over2ChildAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'over2GrandChildAttr'], + } + } + + self._VerifyStageContents(stage2, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr'], + 'Child' : stage2ChildContents + }, + }) + + # Stage3's contents come from layers 1, 2, 3, and 3Sub. + stage3ChildContents = { + '.' : ['childAttr', 'over2ChildAttr', 'over3ChildAttr', + 'overSub3ChildAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'over2GrandChildAttr', + 'over3GrandChildAttr', 'overSub3GrandChildAttr'], + } + } + + self._VerifyStageContents(stage3, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr', + 'overSub3RefAttr'], + 'Child' : stage3ChildContents + }, + }) + + # Stage4's contents come from all layers: 1, 2 3, 3Sub, and 4 + stage4CombinedChildContents = { + '.' : ['childAttr', 'over2ChildAttr', 'over3ChildAttr', + 'overSub3ChildAttr', 'over4ChildAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'over2GrandChildAttr', + 'over3GrandChildAttr', 'overSub3GrandChildAttr', + 'over4GrandChildAttr'], + } + } + + self._VerifyStageContents(stage4, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr', + 'overSub3RefAttr', 'over4RefAttr'], + 'Child' : stage4CombinedChildContents + }, + }) + + # Edit: Rename /Ref/Child to /Ref/RenamedChild + with self.ApplyEdits(editor, "Move /Ref/Child -> /Ref/RenamedChild"): + self.assertTrue(editor.MovePrimAtPath( + '/Ref/Child', '/Ref/RenamedChild')) + + # Verify the direct rename on stage1 + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + 'RenamedChild' : stage1ChildContents + }, + }) + + # Stage2 was not added as a dependent stage, but layer2 is dependent on + # layer1 edits via stage3 so stage2 reflects the rename in layer1 and + # layer2. + self._VerifyStageContents(stage2, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr'], + 'RenamedChild' : stage2ChildContents + }, + }) + + # Stage3 is a dependent stage of the editor and depends on layer1 edits + # through sublayers, so all sublayers in the dependent layer stack of + # layer3 (this includes layer3Sub) are affected by the rename and Child + # is fully renamed in stage3. + self._VerifyStageContents(stage3, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr', + 'overSub3RefAttr'], + 'RenamedChild' : stage3ChildContents + }, + }) + + # Stage4 is not a dependent stage so layer4 is not updated even though + # all its other sublayers have been edited. Thus stage4 has both Child + # and RenamedChild where Child has only opinions from layer4 while + # RenamedChild has the opinions from all other layers. + layer4OnlyChildContents = { + '.' : ['over4ChildAttr'], + 'GrandChild' : { + '.' : ['over4GrandChildAttr'], + } + } + + self._VerifyStageContents(stage4, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr', + 'overSub3RefAttr', 'over4RefAttr'], + 'Child' : layer4OnlyChildContents, + 'RenamedChild' : stage3ChildContents + }, + }) + + # Edit: Reparent and rename /Ref/RenamedChild to /MovedChild + with self.ApplyEdits(editor, "Move /Ref/RenamedChild -> /MovedChild"): + self.assertTrue(editor.MovePrimAtPath( + '/Ref/RenamedChild', '/MovedChild')) + + # Verify the direct reparent and rename on stage1 + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + }, + 'MovedChild' : stage1ChildContents + }) + + # Like with the rename edit previously, RenamedChild is moved to + # /MovedChild in all layers and is reflected as a move in both stage2 + # and stage3. + self._VerifyStageContents(stage2, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr'], + }, + 'MovedChild' : stage2ChildContents + }) + + self._VerifyStageContents(stage3, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr', 'overSub3RefAttr'], + }, + 'MovedChild' : stage3ChildContents + }) + + # And RenamedChild is also fully moved to /MovedChild in stage4. But + # note that the specs for Child in layer4 were not renamed in the first + # edit so Child still exists with the same "layer4 only" contents as + # before. + self._VerifyStageContents(stage4, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr', + 'overSub3RefAttr', 'over4RefAttr'], + 'Child' : layer4OnlyChildContents, + }, + 'MovedChild' : stage3ChildContents + }) + + # Edit: Reparent and rename /MovedChild back to its original path + # /Ref/Child + with self.ApplyEdits(editor, "Move /MovedChild -> /Ref/Child"): + self.assertTrue(editor.MovePrimAtPath('/MovedChild', '/Ref/Child')) + + # All stages return to their exact original contents. + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + 'Child' : stage1ChildContents + }, + }) + + self._VerifyStageContents(stage2, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr'], + 'Child' : stage2ChildContents + }, + }) + + self._VerifyStageContents(stage3, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr', + 'overSub3RefAttr'], + 'Child' : stage3ChildContents + }, + }) + + # This includes stage4 where layer4's Child opinions are once again + # composed with the Child opinions from the other sublayers. + self._VerifyStageContents(stage4, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr', + 'overSub3RefAttr', 'over4RefAttr'], + 'Child' : stage4CombinedChildContents + }, + }) + + # Edit: Delete the prim at /Ref/Child + with self.ApplyEdits(editor, "Delete /Ref/Child"): + self.assertTrue(editor.DeletePrimAtPath('/Ref/Child')) + + # Verify the direct delete on stage1 + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + }, + }) + + # Stage2 was not added as a dependent stage, but layer2 is dependent on + # layer1 edits via stage3 so stage2 reflects the delete of Child in + # layer1 and layer2. + self._VerifyStageContents(stage2, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr'], + }, + }) + + # Stage3 is a dependent stage of the editor and depends on layer1 edits + # through sublayers, so all sublayers in the dependent layer stack of + # layer3 are affected by the deletion and Child is fully deleted in + # stage3. + self._VerifyStageContents(stage3, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr', + 'overSub3RefAttr'], + }, + }) + + # Stage4 is not a dependent stage so layer4 is not updated even though + # all its other sublayers have been edited. Thus stage4 still has Child + # which now only has opinions from layer4 as the Child opinions from all + # other sublayers have been deleted. + self._VerifyStageContents(stage4, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr', + 'overSub3RefAttr', 'over4RefAttr'], + 'Child' : layer4OnlyChildContents + }, + }) + + def test_DependentSublayersAcrossArcs(self): + """Tests downstream dependency namespace edits across sublayers from + within composition arcs.""" + + # Setup: + # Layer1 is a simple base layer with a prim hierarchy of /Ref, + # Child, and GrandChild. This layer will be opened as the base stage + # that direct namespace edits will be performed on. + layer1 = Sdf.Layer.CreateAnonymous("layer1.usda") + layer1.ImportFromString('''#usda 1.0 + def "Ref" ( + ) { + int refAttr + + def "Child" { + int childAttr + + def "GrandChild" { + int grandChildAttr + } + } + } + ''') + + # Layer2 includes layer1 as a sublayer and provides opinions for Ref + # Child and GrandChild. + layer2 = Sdf.Layer.CreateAnonymous("layer2.usda") + layer2.ImportFromString('''#usda 1.0 + ( + subLayers = [@''' + layer1.identifier + '''@] + ) + + over "Ref" ( + ) { + int over2RefAttr + + over "Child" { + int over2ChildAttr + + over "GrandChild" { + int over2GrandChildAttr + } + } + } + ''') + + # Layer3 has three prims that reference /Ref, /Ref/Child, and + # /Ref/Child/GrandChild from layer2 respectively. These will be + # affected by downstream dependency edits. + layer3 = Sdf.Layer.CreateAnonymous("layer3.usda") + layer3.ImportFromString('''#usda 1.0 + def "Prim1" ( + references = @''' + layer2.identifier + '''@ + ) { + int over3RefAttr + over "Child" { + int over3ChildAttr + over "GrandChild" { + int over3GrandChildAttr + } + } + } + + def "Prim2" ( + references = @''' + layer2.identifier + '''@ + ) { + int over3ChildAttr + over "GrandChild" { + int over3GrandChildAttr + } + } + + def "Prim3" ( + references = @''' + layer2.identifier + '''@ + ) { + int over3GrandChildAttr + } + ''') + + # Layer4Sub will be a sublayer of the next layer, layer4, which holds + # overs for all the prims that are defined in layer3. + layer4Sub = Sdf.Layer.CreateAnonymous("layer4-sub.usda") + layer4Sub.ImportFromString('''#usda 1.0 + over "Prim1" { + int over4RefAttr + over "Child" { + int over4ChildAttr + over "GrandChild" { + int over4GrandChildAttr + } + } + } + + over "Prim2" { + int over4ChildAttr + over "GrandChild" { + int over4GrandChildAttr + } + } + + over "Prim3" { + int over4GrandChildAttr + } + ''') + + # Layer4 just has two sublayers, layer3 which defines prims with + # references and layer4Sub which provides local opinions for those + # prims. This layer has no specs of its own. + layer4 = Sdf.Layer.CreateAnonymous("layer4.usda") + layer4.ImportFromString('''#usda 1.0 + ( + subLayers = [ + @''' + layer3.identifier + '''@, + @''' + layer4Sub.identifier + '''@ + ] + ) + ''') + + # Open stages for the 4 main layers (excludes layer4Sub) + stage1 = Usd.Stage.Open(layer1) + stage2 = Usd.Stage.Open(layer2) + stage3 = Usd.Stage.Open(layer3) + stage4 = Usd.Stage.Open(layer4) + + # Create a namespace editor for stage1 which only includes layer1. + editor = Usd.NamespaceEditor(stage1) + + # Add ONLY stage4 as a dependent stage. This is to specifically show + # how all layers will be affected by edits because stage4 introduces + # dependencies on all layers through a combination of sublayers and + # references. + editor.AddDependentStage(stage4) + + # Verify the initial composition fields for layer3 which is the only + # layer with non-sublayer composition fields. + self.assertEqual(self._GetCompositionFieldsInLayer(layer3), { + '/Prim1' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Ref'),) + }, + '/Prim2' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Ref/Child'),) + }, + '/Prim3' : { + 'references' : (Sdf.Reference(layer2.identifier, + '/Ref/Child/GrandChild'),) + }, + }) + + # Verify initial contents of each stage. + + # Stage1 has just the contents of layer1 + stage1ChildContents = { + '.' : ['childAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr'], + } + } + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + 'Child' : stage1ChildContents + }, + }) + + # Stage2 composes layer2 with its only sublayer, layer1. + stage2ChildContents = { + '.' : ['childAttr', 'over2ChildAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'over2GrandChildAttr'], + } + } + self._VerifyStageContents(stage2, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr'], + 'Child' : stage2ChildContents + }, + }) + + # Stage3 has each prim composed with the referenced opinions from layer2 + # (which includes sublayer layer1) and the local opinions in layer3. + stage3Prim1ChildContents = { + '.' : ['childAttr', 'over2ChildAttr', 'over3ChildAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'over2GrandChildAttr', + 'over3GrandChildAttr'], + } + } + stage3Prim2Contents = { + '.' : ['childAttr', 'over2ChildAttr', 'over3ChildAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'over2GrandChildAttr', + 'over3GrandChildAttr'], + } + } + stage3Prim3Contents = { + '.' : ['grandChildAttr', 'over2GrandChildAttr', + 'over3GrandChildAttr'], + } + + self._VerifyStageContents(stage3, { + 'Prim1': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr'], + 'Child' : stage3Prim1ChildContents + }, + 'Prim2' : stage3Prim2Contents, + 'Prim3' : stage3Prim3Contents + }) + + # Stage4 has the same prims from stage3 composed with local opinions + # from sublayer layer4Sub + stage4Prim1ChildContents = { + '.' : ['childAttr', 'over2ChildAttr', 'over3ChildAttr', + 'over4ChildAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'over2GrandChildAttr', + 'over3GrandChildAttr', 'over4GrandChildAttr'], + } + } + stage4Prim2Contents = { + '.' : ['childAttr', 'over2ChildAttr', 'over3ChildAttr', + 'over4ChildAttr'], + 'GrandChild' : { + '.' : ['grandChildAttr', 'over2GrandChildAttr', + 'over3GrandChildAttr', 'over4GrandChildAttr'], + } + } + stage4Prim3Contents = { + '.' : ['grandChildAttr', 'over2GrandChildAttr', + 'over3GrandChildAttr', 'over4GrandChildAttr'], + } + + self._VerifyStageContents(stage4, { + 'Prim1': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr', + 'over4RefAttr'], + 'Child' : stage4Prim1ChildContents + }, + 'Prim2' : stage4Prim2Contents, + 'Prim3' : stage4Prim3Contents + }) + + # Edit: Rename /Ref/Child to /Ref/RenamedChild + with self.ApplyEdits(editor, "Move /Ref/Child -> /Ref/RenamedChild"): + self.assertTrue(editor.MovePrimAtPath( + '/Ref/Child', '/Ref/RenamedChild')) + + # Verify the updated composition fields for layer3 where Prim2 and Prim3 + # reference paths are updated to the renamed path. + self.assertEqual(self._GetCompositionFieldsInLayer(layer3), { + '/Prim1' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Ref'),) + }, + '/Prim2' : { + 'references' : (Sdf.Reference(layer2.identifier, + '/Ref/RenamedChild'),) + }, + '/Prim3' : { + 'references' : (Sdf.Reference(layer2.identifier, + '/Ref/RenamedChild/GrandChild'),) + }, + }) + + # Verify the direct rename of Child on stage1. + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + 'RenamedChild' : stage1ChildContents + }, + }) + + # On stage2, Child is also fully renamed because layer2's specs were + # updated for the sublayer dependency on layer1. Note that stage4 is the + # only dependent stage added to the namespace editor so this update + # only occurs because stage4 has dependencies on these layer2 specs. + self._VerifyStageContents(stage2, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr'], + 'RenamedChild' : stage2ChildContents + }, + }) + + # On stage3, the rename of Child is propagated across the reference for + # Prim1 where the specs from layer3 are also renamed resulting in a full + # rename of /Prim1/Child. Prim2 and Prim3's composed contents are + # unchanged as their reference fields were updated to the new paths. + # Note that, like with stage2, these updates only occur because stage4 + # has dependencies on layer3 specs. + self._VerifyStageContents(stage3, { + 'Prim1': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr'], + 'RenamedChild' : stage3Prim1ChildContents + }, + 'Prim2' : stage3Prim2Contents, + 'Prim3' : stage3Prim3Contents + }) + + # On stage4, the rename of Child is propagated across the reference for + # Prim1 as in stage3. The sublayer layer4Sub has its specs updated for + # the rename resulting in /Prim1/RenamedChild having all the same + # opinions as /Prim1/Child did prior. + # + # Prim2 and Prim3's composed contents are unchanged as their reference + # fields were updated to the new paths (no changes are necessary to the + # overs in sublayer layer4Sub). + self._VerifyStageContents(stage4, { + 'Prim1': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr', 'over4RefAttr'], + 'RenamedChild' : stage4Prim1ChildContents + }, + 'Prim2' : stage4Prim2Contents, + 'Prim3' : stage4Prim3Contents + }) + + # Edit: Reparent and rename /Ref/RenamedChild to /MovedChild + with self.ApplyEdits(editor, "Move /Ref/RenamedChild -> /MovedChild"): + self.assertTrue(editor.MovePrimAtPath( + '/Ref/RenamedChild', '/MovedChild')) + + # Verify the updated composition fields for layer3 where Prim2 and Prim3 + # reference paths are updated to the moved path. + self.assertEqual(self._GetCompositionFieldsInLayer(layer3), { + '/Prim1' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Ref'),) + }, + '/Prim2' : { + 'references' : (Sdf.Reference(layer2.identifier, + '/MovedChild'),) + }, + '/Prim3' : { + 'references' : (Sdf.Reference(layer2.identifier, + '/MovedChild/GrandChild'),) + }, + }) + + # Verify updated contents of stage1 and stage2. /Ref/RenamedChild is + # fully moved to /MovedChild on both stages. + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + }, + 'MovedChild' : stage1ChildContents + }) + + self._VerifyStageContents(stage2, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr'], + }, + 'MovedChild' : stage2ChildContents + }) + + # On stage3 and stage4, RenamedChild has been moved out from under the + # referenced prim for Prim1 resulting in an effective deletion of + # RenamedChild. All specs in layer3 and layer4Sub referring to + # /Prim1/RenamedChild are deleted too resulting in a full deletion of + # this prim on these stages. + # + # Prim2 and Prim3's composed contents are unchanged as their reference + # fields were updated to the new paths and no changes are necessary to + # the local specs in layer3 and layer4Sub). + self._VerifyStageContents(stage3, { + 'Prim1': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr'], + }, + 'Prim2' : stage3Prim2Contents, + 'Prim3' : stage3Prim3Contents + }) + + self._VerifyStageContents(stage4, { + 'Prim1': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr', 'over4RefAttr'], + }, + 'Prim2' : stage4Prim2Contents, + 'Prim3' : stage4Prim3Contents + }) + + # Edit: Reparent and rename /MovedChild back to its original path + # /Ref/Child + with self.ApplyEdits(editor, "Move /MovedChild -> /Ref/Child"): + self.assertTrue(editor.MovePrimAtPath('/MovedChild', '/Ref/Child')) + + # Verify the updated composition fields for layer3 where Prim2 and Prim3 + # reference paths are updated to the original paths. + self.assertEqual(self._GetCompositionFieldsInLayer(layer3), { + '/Prim1' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Ref'),) + }, + '/Prim2' : { + 'references' : (Sdf.Reference(layer2.identifier, + '/Ref/Child'),) + }, + '/Prim3' : { + 'references' : (Sdf.Reference(layer2.identifier, + '/Ref/Child/GrandChild'),) + }, + }) + + # Verify updated contents of stage1 and stage2 where /Ref/Child has + # been returned to its original contents. + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + 'Child' : stage1ChildContents + }, + }) + + self._VerifyStageContents(stage2, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr'], + 'Child' : stage2ChildContents + }, + }) + + # On stage3 and stage4, Child has returned under Prim1 but now only + # matches the contents of /Ref/Child as seen on stage2. This is because + # the local specs on layer3 and layer4Sub for this prim were deleted + # by the prior edit and are not able to restored via this namespace + # edit. Thus /Prim1/Child only consists of specs from layer1 and layer2. + # + # Prim2 and Prim3's composed contents remain unchanged as their + # reference fields were updated to the original paths. + self._VerifyStageContents(stage3, { + 'Prim1': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr'], + 'Child' : stage2ChildContents + }, + 'Prim2' : stage3Prim2Contents, + 'Prim3' : stage3Prim3Contents + }) + + self._VerifyStageContents(stage4, { + 'Prim1': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr', 'over4RefAttr'], + 'Child' : stage2ChildContents + }, + 'Prim2' : stage4Prim2Contents, + 'Prim3' : stage4Prim3Contents + }) + + # Edit: Delete the prim at /Ref/Child + with self.ApplyEdits(editor, "Delete /Ref/Child"): + self.assertTrue(editor.DeletePrimAtPath('/Ref/Child')) + + # Verify the updated composition fields for layer3 where Prim2 and Prim3 + # references are deleted because prims at those paths have been deleted. + self.assertEqual(self._GetCompositionFieldsInLayer(layer3), { + '/Prim1' : { + 'references' : (Sdf.Reference(layer2.identifier, '/Ref'),) + }, + '/Prim2' : { + 'references' : () + }, + '/Prim3' : { + 'references' : () + }, + }) + + # Verify updated contents of stage1 and stage2. /Ref/Child is fully + # deleted on both stages. + self._VerifyStageContents(stage1, { + 'Ref': { + '.' : ['refAttr'], + }, + }) + + self._VerifyStageContents(stage2, { + 'Ref': { + '.' : ['refAttr', 'over2RefAttr'], + }, + }) + + # On stage3 and stage4, Child is fully deleted from under Prim1 again. + # + # This time Prim2 and Prim3's composed contents have changed as they + # no longer have references to layer2. Local opinions for /Prim2 and + # /Prim3 in layer3 and layer4Sub remain but opinions for + # /Prim2/GrandChild (which is considered an over for the deleted + # ancestral reference to /Ref/Child/GrandChild) are deleted. + self._VerifyStageContents(stage3, { + 'Prim1': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr'], + }, + 'Prim2' : { + '.' : ['over3ChildAttr'], + }, + 'Prim3' : { + '.' : ['over3GrandChildAttr'], + } + }) + + self._VerifyStageContents(stage4, { + 'Prim1': { + '.' : ['refAttr', 'over2RefAttr', 'over3RefAttr', 'over4RefAttr'], + }, + 'Prim2' : { + '.' : ['over3ChildAttr', 'over4ChildAttr'], + }, + 'Prim3' : { + '.' : ['over3GrandChildAttr', 'over4GrandChildAttr'], + } + }) + +if __name__ == '__main__': + unittest.main() From 1abb3631e298505cd1e0387b04cadd3819aa7715 Mon Sep 17 00:00:00 2001 From: tallytalwar Date: Wed, 23 Oct 2024 08:26:53 -0700 Subject: [PATCH 53/82] UsdStage.Open could result in a TF_RUNTIME_ERROR Example from usdAbc plugin, which should be appropriately handled. Note that couple of tests in usdchecker were "passing" because of an expected exception from usdAbc raise tf runtime error. But instead it should be reported as an error from the ComplianceChecker. (Internal change: 2345379) --- pxr/usd/usdUtils/complianceChecker.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/pxr/usd/usdUtils/complianceChecker.py b/pxr/usd/usdUtils/complianceChecker.py index fec233e58c..1ad43063a7 100644 --- a/pxr/usd/usdUtils/complianceChecker.py +++ b/pxr/usd/usdUtils/complianceChecker.py @@ -1073,7 +1073,16 @@ def CheckCompliance(self, inputFile): # Collect all warnings using a diagnostic delegate. delegate = UsdUtils.CoalescingDiagnosticDelegate() - usdStage = Usd.Stage.Open(inputFile) + from pxr import Tf + try: + # It is possible Usd.Stage.Open will raise a TF_RUNTIME_ERROR + # (example via usdAbc plugin) which should be appropriately handled. + usdStage = Usd.Stage.Open(inputFile) + except Tf.ErrorException as e: + self._AddError("Failed to open USD stage from file '%s': %s" % + (inputFile, str(e))) + return + stageOpenDiagnostics = delegate.TakeUncoalescedDiagnostics() for rule in self._rules: @@ -1083,8 +1092,15 @@ def CheckCompliance(self, inputFile): with Ar.ResolverContextBinder(usdStage.GetPathResolverContext()): # This recursively computes all of inputFiles's external # dependencies. - (allLayers, allAssets, unresolvedPaths) = \ + from pxr import Tf + try: + (allLayers, allAssets, unresolvedPaths) = \ UsdUtils.ComputeAllDependencies(Sdf.AssetPath(inputFile)) + except Tf.ErrorException as e: + self._AddError( + "Failed to compute dependencies for file '%s': %s" % + (inputFile, str(e))) + return for rule in self._rules: rule.CheckUnresolvedPaths(unresolvedPaths) rule.CheckDependencies(usdStage, allLayers, allAssets) From 26e89def17170907bed763c002c10349929c6cff Mon Sep 17 00:00:00 2001 From: clach Date: Wed, 23 Oct 2024 08:27:04 -0700 Subject: [PATCH 54/82] [hdSt] One more piece Autodesk PR #3170. Removes CMake script duplication for GL and Vulkan versions of testHdStCodeGen. Adds some missing test directories. See github pull request #3170. (Internal change: 2345394) --- pxr/imaging/hdSt/CMakeLists.txt | 314 +++++++++++--------------------- 1 file changed, 103 insertions(+), 211 deletions(-) diff --git a/pxr/imaging/hdSt/CMakeLists.txt b/pxr/imaging/hdSt/CMakeLists.txt index b5d4156117..1aca8b0eb6 100644 --- a/pxr/imaging/hdSt/CMakeLists.txt +++ b/pxr/imaging/hdSt/CMakeLists.txt @@ -2325,6 +2325,7 @@ pxr_register_test(testHdStBufferArray EXPECTED_RETURN_CODE 0 STDOUT_REDIRECT testHdStBufferArray-Run1-stdout.txt POST_COMMAND "diff -I drawingShader -I computeShader -I gpuMemoryUsed -I meshTopology -I basisCurvesTopology -I uboSize -I ssboSize testHdStBufferArray-Run1-stdout.txt ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStBufferArray/baseline/testHdStBufferArray-Run1-stdout.txt" TESTENV testHdStBufferArray + TESTENV testHdStBufferArray ENV TF_DEBUG=HD_SAFE_MODE HD_ENABLE_DOUBLE_MATRIX=1 @@ -2373,217 +2374,106 @@ pxr_register_test(testHdStClipPlanes2 ENV TF_DEBUG=HD_SAFE_MODE ) -pxr_register_test(testHdStCodeGen_GL_Mesh_Indirect - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_indirect.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_mesh_indirect.out" - TESTENV testHdStCodeGen_GL - ENV - TF_DEBUG=HD_SAFE_MODE - HGIGL_ENABLE_BINDLESS_BUFFER=1 - HGIGL_ENABLE_BINDLESS_TEXTURE=1 - HGIGL_GLSL_VERSION=450 - HGI_ENABLE_VULKAN=0 -) -pxr_register_test(testHdStCodeGen_GL_Mesh_Indirect_SmoothNormals - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --smoothNormals | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_indirect_smoothNormals.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_smoothNormals.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_smoothNormals.out" - TESTENV testHdStCodeGen_GL - ENV - TF_DEBUG=HD_SAFE_MODE - HGIGL_ENABLE_BINDLESS_BUFFER=1 - HGIGL_ENABLE_BINDLESS_TEXTURE=1 - HGIGL_GLSL_VERSION=450 - HGI_ENABLE_VULKAN=0 -) -pxr_register_test(testHdStCodeGen_GL_Mesh_Indirect_DoubleSided - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --doubleSided | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_indirect_doubleSided.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_doubleSided.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_doubleSided.out" - TESTENV testHdStCodeGen_GL - ENV - TF_DEBUG=HD_SAFE_MODE - HGIGL_ENABLE_BINDLESS_BUFFER=1 - HGIGL_ENABLE_BINDLESS_TEXTURE=1 - HGIGL_GLSL_VERSION=450 - HGI_ENABLE_VULKAN=0 -) -pxr_register_test(testHdStCodeGen_GL_Mesh_Indirect_FaceVarying - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --faceVarying | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_indirect_faceVarying.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_faceVarying.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_faceVarying.out" - TESTENV testHdStCodeGen_GL - ENV - TF_DEBUG=HD_SAFE_MODE - HGIGL_ENABLE_BINDLESS_BUFFER=1 - HGIGL_ENABLE_BINDLESS_TEXTURE=1 - HGIGL_GLSL_VERSION=450 - HGI_ENABLE_VULKAN=0 -) -pxr_register_test(testHdStCodeGen_GL_Mesh_Indirect_Instance - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --instance | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_indirect_instance.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_instance.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_instance.out" - TESTENV testHdStCodeGen_GL - ENV - TF_DEBUG=HD_SAFE_MODE - HGIGL_ENABLE_BINDLESS_BUFFER=1 - HGIGL_ENABLE_BINDLESS_TEXTURE=1 - HGIGL_GLSL_VERSION=450 - HGI_ENABLE_VULKAN=0 -) -pxr_register_test(testHdStCodeGen_GL_Mesh_EdgeOnly - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --edgeOnly | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_edgeonly.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_edgeonly.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_mesh_edgeonly.out" - TESTENV testHdStCodeGen_GL - ENV - TF_DEBUG=HD_SAFE_MODE - HGIGL_ENABLE_BINDLESS_BUFFER=1 - HGIGL_ENABLE_BINDLESS_TEXTURE=1 - HGIGL_GLSL_VERSION=450 - HGI_ENABLE_VULKAN=0 -) -pxr_register_test(testHdStCodeGen_GL_Mesh_EdgeOnly_BlendWireframe - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --edgeOnly --blendWireframe | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_edgeonly_blendwireframe.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_edgeonly_blendwireframe.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_mesh_edgeonly_blendwireframe.out" - TESTENV testHdStCodeGen_GL - ENV - TF_DEBUG=HD_SAFE_MODE - HGIGL_ENABLE_BINDLESS_BUFFER=1 - HGIGL_ENABLE_BINDLESS_TEXTURE=1 - HGIGL_GLSL_VERSION=450 - HGI_ENABLE_VULKAN=0 -) -pxr_register_test(testHdStCodeGen_GL_Curves_Indirect - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --curves | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_curves_indirect.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_curves_indirect.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_curves_indirect.out" - TESTENV testHdStCodeGen_GL - ENV - TF_DEBUG=HD_SAFE_MODE - HGIGL_ENABLE_BINDLESS_BUFFER=1 - HGIGL_ENABLE_BINDLESS_TEXTURE=1 - HGIGL_GLSL_VERSION=450 - HGI_ENABLE_VULKAN=0 -) -pxr_register_test(testHdStCodeGen_GL_Points_Indirect - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --points | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_points_indirect.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_points_indirect.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_GL/baseline/codegen_points_indirect.out" - TESTENV testHdStCodeGen_GL - ENV - TF_DEBUG=HD_SAFE_MODE - HGIGL_ENABLE_BINDLESS_BUFFER=1 - HGIGL_ENABLE_BINDLESS_TEXTURE=1 - HGIGL_GLSL_VERSION=450 - HGI_ENABLE_VULKAN=0 -) -# Skip Vulkan codegen tests if not supported by build. -if (${PXR_ENABLE_VULKAN_SUPPORT}) -pxr_register_test(testHdStCodeGen_Vulkan_Mesh_Indirect - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_indirect.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect.out" - TESTENV testHdStCodeGen_Vulkan - ENV - TF_DEBUG=HD_SAFE_MODE - HGI_ENABLE_VULKAN=1 -) -pxr_register_test(testHdStCodeGen_Vulkan_Mesh_Indirect_SmoothNormals - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --smoothNormals | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_indirect_smoothNormals.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_smoothNormals.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_smoothNormals.out" - TESTENV testHdStCodeGen_Vulkan - ENV - TF_DEBUG=HD_SAFE_MODE - HGI_ENABLE_VULKAN=1 -) -pxr_register_test(testHdStCodeGen_Vulkan_Mesh_Indirect_DoubleSided - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --doubleSided | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_indirect_doubleSided.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_doubleSided.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_doubleSided.out" - TESTENV testHdStCodeGen_Vulkan - ENV - TF_DEBUG=HD_SAFE_MODE - HGI_ENABLE_VULKAN=1 -) -pxr_register_test(testHdStCodeGen_Vulkan_Mesh_Indirect_FaceVarying - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --faceVarying | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_indirect_faceVarying.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_faceVarying.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_faceVarying.out" - TESTENV testHdStCodeGen_Vulkan - ENV - TF_DEBUG=HD_SAFE_MODE - HGI_ENABLE_VULKAN=1 -) -pxr_register_test(testHdStCodeGen_Vulkan_Mesh_Indirect_Instance - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --instance | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_indirect_instance.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_instance.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_instance.out" - TESTENV testHdStCodeGen_Vulkan - ENV - TF_DEBUG=HD_SAFE_MODE - HGI_ENABLE_VULKAN=1 -) -pxr_register_test(testHdStCodeGen_Vulkan_Mesh_EdgeOnly - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --edgeOnly | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_edgeonly.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_edgeonly.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_Vulkan/baseline/codegen_mesh_edgeonly.out" - TESTENV testHdStCodeGen_Vulkan - ENV - TF_DEBUG=HD_SAFE_MODE - HGI_ENABLE_VULKAN=1 -) -pxr_register_test(testHdStCodeGen_Vulkan_Mesh_EdgeOnly_BlendWireframe - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --edgeOnly --blendWireframe | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_mesh_edgeonly_blendwireframe.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_edgeonly_blendwireframe.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_Vulkan/baseline/codegen_mesh_edgeonly_blendwireframe.out" - TESTENV testHdStCodeGen_Vulkan - ENV - TF_DEBUG=HD_SAFE_MODE - HGI_ENABLE_VULKAN=1 -) -pxr_register_test(testHdStCodeGen_Vulkan_Curves_Indirect - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --curves | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_curves_indirect.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_curves_indirect.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_Vulkan/baseline/codegen_curves_indirect.out" - TESTENV testHdStCodeGen_Vulkan - ENV - TF_DEBUG=HD_SAFE_MODE - HGI_ENABLE_VULKAN=1 -) -pxr_register_test(testHdStCodeGen_Vulkan_Points_Indirect - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --points | grep -v '// line'" - EXPECTED_RETURN_CODE 0 - STDOUT_REDIRECT codegen_points_indirect.out - POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_points_indirect.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen_Vulkan/baseline/codegen_points_indirect.out" - TESTENV testHdStCodeGen_Vulkan - ENV - TF_DEBUG=HD_SAFE_MODE - HGI_ENABLE_VULKAN=1 -) -endif() # PXR_ENABLE_VULKAN_SUPPORT +function(register_codegen_tests suffix hgi_env) + pxr_register_test(testHdStCodeGen${suffix}_Mesh_Indirect + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh | grep -v '// line'" + EXPECTED_RETURN_CODE 0 + STDOUT_REDIRECT codegen_mesh_indirect.out + POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen${suffix}/baseline/codegen_mesh_indirect.out" + TESTENV testHdStCodeGen${suffix} + ENV + TF_DEBUG=HD_SAFE_MODE + ${hgi_env} + ) + pxr_register_test(testHdStCodeGen${suffix}_Mesh_Indirect_SmoothNormals + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --smoothNormals | grep -v '// line'" + EXPECTED_RETURN_CODE 0 + STDOUT_REDIRECT codegen_mesh_indirect_smoothNormals.out + POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_smoothNormals.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen${suffix}/baseline/codegen_mesh_indirect_smoothNormals.out" + TESTENV testHdStCodeGen${suffix} + ENV + TF_DEBUG=HD_SAFE_MODE + ${hgi_env} + ) + pxr_register_test(testHdStCodeGen${suffix}_Mesh_Indirect_DoubleSided + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --doubleSided | grep -v '// line'" + EXPECTED_RETURN_CODE 0 + STDOUT_REDIRECT codegen_mesh_indirect_doubleSided.out + POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_doubleSided.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen${suffix}/baseline/codegen_mesh_indirect_doubleSided.out" + TESTENV testHdStCodeGen${suffix} + ENV + TF_DEBUG=HD_SAFE_MODE + ${hgi_env} + ) + pxr_register_test(testHdStCodeGen${suffix}_Mesh_Indirect_FaceVarying + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --faceVarying | grep -v '// line'" + EXPECTED_RETURN_CODE 0 + STDOUT_REDIRECT codegen_mesh_indirect_faceVarying.out + POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_faceVarying.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen${suffix}/baseline/codegen_mesh_indirect_faceVarying.out" + TESTENV testHdStCodeGen${suffix} + ENV + TF_DEBUG=HD_SAFE_MODE + ${hgi_env} + ) + pxr_register_test(testHdStCodeGen${suffix}_Mesh_Indirect_Instance + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --instance | grep -v '// line'" + EXPECTED_RETURN_CODE 0 + STDOUT_REDIRECT codegen_mesh_indirect_instance.out + POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_indirect_instance.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen${suffix}/baseline/codegen_mesh_indirect_instance.out" + TESTENV testHdStCodeGen${suffix} + ENV + TF_DEBUG=HD_SAFE_MODE + ${hgi_env} + ) + pxr_register_test(testHdStCodeGen${suffix}_Mesh_EdgeOnly + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --edgeOnly | grep -v '// line'" + EXPECTED_RETURN_CODE 0 + STDOUT_REDIRECT codegen_mesh_edgeonly.out + POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_edgeonly.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen${suffix}/baseline/codegen_mesh_edgeonly.out" + TESTENV testHdStCodeGen${suffix} + ENV + TF_DEBUG=HD_SAFE_MODE + ${hgi_env} + ) + pxr_register_test(testHdStCodeGen${suffix}_Mesh_EdgeOnly_BlendWireframe + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --mesh --edgeOnly --blendWireframe | grep -v '// line'" + EXPECTED_RETURN_CODE 0 + STDOUT_REDIRECT codegen_mesh_edgeonly_blendwireframe.out + POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_mesh_edgeonly_blendwireframe.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen${suffix}/baseline/codegen_mesh_edgeonly_blendwireframe.out" + TESTENV testHdStCodeGen${suffix} + ENV + TF_DEBUG=HD_SAFE_MODE + ${hgi_env} + ) + pxr_register_test(testHdStCodeGen${suffix}_Curves_Indirect + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --curves | grep -v '// line'" + EXPECTED_RETURN_CODE 0 + STDOUT_REDIRECT codegen_curves_indirect.out + POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_curves_indirect.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen${suffix}/baseline/codegen_curves_indirect.out" + TESTENV testHdStCodeGen${suffix} + ENV + TF_DEBUG=HD_SAFE_MODE + ${hgi_env} + ) + pxr_register_test(testHdStCodeGen${suffix}_Points_Indirect + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCodeGen --points | grep -v '// line'" + EXPECTED_RETURN_CODE 0 + STDOUT_REDIRECT codegen_points_indirect.out + POST_COMMAND "diff -I '\".*\.glslfx\"' codegen_points_indirect.out ${CMAKE_INSTALL_PREFIX}/tests/ctest/testHdStCodeGen${suffix}/baseline/codegen_points_indirect.out" + TESTENV testHdStCodeGen${suffix} + ENV + TF_DEBUG=HD_SAFE_MODE + ${hgi_env} + ) +endfunction() +# OpenGL codegen tests require X11 to create a context +if(PXR_ENABLE_GL_SUPPORT AND X11_FOUND) + register_codegen_tests(_GL "HGI_ENABLE_VULKAN=0;HGIGL_ENABLE_BINDLESS_BUFFER=1;HGIGL_ENABLE_BINDLESS_TEXTURE=1;HGIGL_GLSL_VERSION=450") +endif() +if(PXR_ENABLE_VULKAN_SUPPORT) + register_codegen_tests(_Vulkan "HGI_ENABLE_VULKAN=1;") +endif() pxr_register_test(testHdStCurveDrawing_lv0_refined COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStCurveDrawing --offscreen --repr refined --refineLevel 0 --write testHdStCurveDrawing_lv0_refined.png" @@ -2773,12 +2663,14 @@ pxr_register_test(testHdStFaceCulling_FrontUnlessDoubleSided pxr_register_test(testHdStFrustumCullingCPU COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStFrustumCulling --offscreen" EXPECTED_RETURN_CODE 0 + TESTENV testHdStFrustumCulling ENV HD_ENABLE_GPU_FRUSTUM_CULLING=0 ) pxr_register_test(testHdStFrustumCullingGPU COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdStFrustumCulling --offscreen" EXPECTED_RETURN_CODE 0 + TESTENV testHdStFrustumCulling ENV HD_ENABLE_GPU_FRUSTUM_CULLING=1 HD_ENABLE_GPU_COUNT_VISIBLE_INSTANCES=1 @@ -3469,4 +3361,4 @@ pxr_register_test(testHdStShaders ENV TF_DEBUG=HD_SAFE_MODE ) -endif() # TARGET shared_libs +endif() # TARGET shared_libs \ No newline at end of file From 7044166b26a40aed4b3ea6be9dee83966fb9cf0d Mon Sep 17 00:00:00 2001 From: anwang2009 Date: Wed, 23 Oct 2024 11:18:25 -0700 Subject: [PATCH 55/82] Remove flag PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS; time scaling by layer has been performed by PCP for a while now. This disables any legacy behavior. (Internal change: 2345511) --- pxr/usd/pcp/CMakeLists.txt | 54 --- pxr/usd/pcp/layerStack.cpp | 26 +- pxr/usd/pcp/layerStack.h | 8 - pxr/usd/pcp/primIndex.cpp | 28 +- pxr/usd/pcp/testenv/testPcpChanges.py | 3 - ...tionResults_TimeCodesPerSecond1_Legacy.txt | 395 ------------------ ...tionResults_TimeCodesPerSecond2_Legacy.txt | 395 ------------------ ...tionResults_TimeCodesPerSecond3_Legacy.txt | 395 ------------------ ...tionResults_TimeCodesPerSecond4_Legacy.txt | 395 ------------------ pxr/usd/usd/CMakeLists.txt | 6 - 10 files changed, 16 insertions(+), 1689 deletions(-) delete mode 100644 pxr/usd/pcp/testenv/testPcpMuseum_TimeCodesPerSecond.testenv/baseline/compositionResults_TimeCodesPerSecond1_Legacy.txt delete mode 100644 pxr/usd/pcp/testenv/testPcpMuseum_TimeCodesPerSecond.testenv/baseline/compositionResults_TimeCodesPerSecond2_Legacy.txt delete mode 100644 pxr/usd/pcp/testenv/testPcpMuseum_TimeCodesPerSecond.testenv/baseline/compositionResults_TimeCodesPerSecond3_Legacy.txt delete mode 100644 pxr/usd/pcp/testenv/testPcpMuseum_TimeCodesPerSecond.testenv/baseline/compositionResults_TimeCodesPerSecond4_Legacy.txt diff --git a/pxr/usd/pcp/CMakeLists.txt b/pxr/usd/pcp/CMakeLists.txt index 0fa527db03..5232becd8e 100644 --- a/pxr/usd/pcp/CMakeLists.txt +++ b/pxr/usd/pcp/CMakeLists.txt @@ -1399,8 +1399,6 @@ pxr_register_test(testPcpMuseum_TimeCodesPerSecond1 COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults --usd TimeCodesPerSecond/root.sdf" STDOUT_REDIRECT compositionResults_TimeCodesPerSecond1.txt DIFF_COMPARE compositionResults_TimeCodesPerSecond1.txt - ENV - PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS=0 ) pxr_register_test(testPcpMuseum_TimeCodesPerSecond2 @@ -1408,8 +1406,6 @@ pxr_register_test(testPcpMuseum_TimeCodesPerSecond2 COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults --usd TimeCodesPerSecond/root_48tcps.sdf" STDOUT_REDIRECT compositionResults_TimeCodesPerSecond2.txt DIFF_COMPARE compositionResults_TimeCodesPerSecond2.txt - ENV - PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS=0 ) pxr_register_test(testPcpMuseum_TimeCodesPerSecond3 @@ -1417,8 +1413,6 @@ pxr_register_test(testPcpMuseum_TimeCodesPerSecond3 COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults --usd TimeCodesPerSecond/root_24tcps_12fps.sdf" STDOUT_REDIRECT compositionResults_TimeCodesPerSecond3.txt DIFF_COMPARE compositionResults_TimeCodesPerSecond3.txt - ENV - PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS=0 ) pxr_register_test(testPcpMuseum_TimeCodesPerSecond4 @@ -1426,44 +1420,6 @@ pxr_register_test(testPcpMuseum_TimeCodesPerSecond4 COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults --usd TimeCodesPerSecond/root_12fps.sdf" STDOUT_REDIRECT compositionResults_TimeCodesPerSecond4.txt DIFF_COMPARE compositionResults_TimeCodesPerSecond4.txt - ENV - PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS=0 -) - -pxr_register_test(testPcpMuseum_TimeCodesPerSecond_Legacy1 - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults --usd TimeCodesPerSecond/root.sdf" - STDOUT_REDIRECT compositionResults_TimeCodesPerSecond1_Legacy.txt - DIFF_COMPARE compositionResults_TimeCodesPerSecond1_Legacy.txt - ENV - PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS=1 -) - -pxr_register_test(testPcpMuseum_TimeCodesPerSecond_Legacy2 - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults --usd TimeCodesPerSecond/root_48tcps.sdf" - STDOUT_REDIRECT compositionResults_TimeCodesPerSecond2_Legacy.txt - DIFF_COMPARE compositionResults_TimeCodesPerSecond2_Legacy.txt - ENV - PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS=1 -) - -pxr_register_test(testPcpMuseum_TimeCodesPerSecond_Legacy3 - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults --usd TimeCodesPerSecond/root_24tcps_12fps.sdf" - STDOUT_REDIRECT compositionResults_TimeCodesPerSecond3_Legacy.txt - DIFF_COMPARE compositionResults_TimeCodesPerSecond3_Legacy.txt - ENV - PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS=1 -) - -pxr_register_test(testPcpMuseum_TimeCodesPerSecond_Legacy4 - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults --usd TimeCodesPerSecond/root_12fps.sdf" - STDOUT_REDIRECT compositionResults_TimeCodesPerSecond4_Legacy.txt - DIFF_COMPARE compositionResults_TimeCodesPerSecond4_Legacy.txt - ENV - PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS=1 ) pxr_register_test(testPcpMuseum_TimeCodesPerSecondWithSessionLayer1 @@ -1471,8 +1427,6 @@ pxr_register_test(testPcpMuseum_TimeCodesPerSecondWithSessionLayer1 COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults --usd TimeCodesPerSecond/root_24tcps_12fps.sdf --session TimeCodesPerSecond/session_48tcps.sdf" STDOUT_REDIRECT compositionResults_TimeCodesPerSecondWithSessionLayer1.txt DIFF_COMPARE compositionResults_TimeCodesPerSecondWithSessionLayer1.txt - ENV - PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS=0 ) pxr_register_test(testPcpMuseum_TimeCodesPerSecondWithSessionLayer2 @@ -1480,8 +1434,6 @@ pxr_register_test(testPcpMuseum_TimeCodesPerSecondWithSessionLayer2 COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults --usd TimeCodesPerSecond/root_48tcps.sdf --session TimeCodesPerSecond/session_24fps.sdf" STDOUT_REDIRECT compositionResults_TimeCodesPerSecondWithSessionLayer2.txt DIFF_COMPARE compositionResults_TimeCodesPerSecondWithSessionLayer2.txt - ENV - PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS=0 ) pxr_register_test(testPcpMuseum_TimeCodesPerSecondWithSessionLayer3 @@ -1489,8 +1441,6 @@ pxr_register_test(testPcpMuseum_TimeCodesPerSecondWithSessionLayer3 COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults --usd TimeCodesPerSecond/root_12fps.sdf --session TimeCodesPerSecond/session_24fps.sdf" STDOUT_REDIRECT compositionResults_TimeCodesPerSecondWithSessionLayer3.txt DIFF_COMPARE compositionResults_TimeCodesPerSecondWithSessionLayer3.txt - ENV - PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS=0 ) pxr_register_test(testPcpMuseum_TimeCodesPerSecondWithSessionLayer4 @@ -1498,8 +1448,6 @@ pxr_register_test(testPcpMuseum_TimeCodesPerSecondWithSessionLayer4 COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults --usd TimeCodesPerSecond/root_12fps.sdf --session TimeCodesPerSecond/session.sdf" STDOUT_REDIRECT compositionResults_TimeCodesPerSecondWithSessionLayer4.txt DIFF_COMPARE compositionResults_TimeCodesPerSecondWithSessionLayer4.txt - ENV - PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS=0 ) pxr_register_test(testPcpMuseum_TypicalReferenceToRiggedModel @@ -2041,8 +1989,6 @@ pxr_register_test(testPcpChanges PYTHON COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpChanges" EXPECTED_RETURN_CODE 0 - ENV - PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS=0 ) pxr_register_test(testPcpDependencies diff --git a/pxr/usd/pcp/layerStack.cpp b/pxr/usd/pcp/layerStack.cpp index fc16312f7b..53a346c906 100644 --- a/pxr/usd/pcp/layerStack.cpp +++ b/pxr/usd/pcp/layerStack.cpp @@ -44,11 +44,6 @@ TF_DEFINE_ENV_SETTING( PCP_ENABLE_PARALLEL_LAYER_PREFETCH, true, "Enables parallel, threaded pre-fetch of sublayers."); -TF_DEFINE_ENV_SETTING( - PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS, false, - "Disables automatic layer offset scaling from time codes per second " - "metadata in layers."); - TF_DEFINE_ENV_SETTING( PCP_ENABLE_LEGACY_RELOCATES_BEHAVIOR, true, "Enables the legacy behavior of ignoring composition errors that would " @@ -57,12 +52,6 @@ TF_DEFINE_ENV_SETTING( "non-USD caches/layer stacks; the legacy behavior cannot be enabled in USD " "mode"); -bool -PcpIsTimeScalingForLayerTimeCodesPerSecondDisabled() -{ - return TfGetEnvSetting(PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS); -} - struct Pcp_SublayerInfo { Pcp_SublayerInfo() = default; Pcp_SublayerInfo(const SdfLayerRefPtr& layer_, const SdfLayerOffset& offset_, @@ -1557,10 +1546,6 @@ PcpLayerStack::_Compute(const std::string &fileFormatTarget, // Build the layer stack. std::set seenLayers; - // Env setting for disabling TCPS scaling. - const bool scaleLayerOffsetByTcps = - !PcpIsTimeScalingForLayerTimeCodesPerSecondDisabled(); - const double rootTcps = _identifier.rootLayer->GetTimeCodesPerSecond(); SdfLayerOffset rootLayerOffset; @@ -1599,13 +1584,9 @@ PcpLayerStack::_Compute(const std::string &fileFormatTarget, if (_ShouldUseSessionTcps(_identifier.sessionLayer, _identifier.rootLayer)) { _timeCodesPerSecond = sessionTcps; - if (scaleLayerOffsetByTcps) { - rootLayerOffset.SetScale(_timeCodesPerSecond / rootTcps); - } + rootLayerOffset.SetScale(_timeCodesPerSecond / rootTcps); } else { - if (scaleLayerOffsetByTcps) { - sessionLayerOffset.SetScale(_timeCodesPerSecond / sessionTcps); - } + sessionLayerOffset.SetScale(_timeCodesPerSecond / sessionTcps); } _sessionLayerTree = @@ -1821,8 +1802,7 @@ PcpLayerStack::_BuildLayerStack( // Apply the scale from computed layer TCPS to sublayer TCPS to sublayer // layer offset. const double sublayerTcps = sublayerRefPtrs[i]->GetTimeCodesPerSecond(); - if (!PcpIsTimeScalingForLayerTimeCodesPerSecondDisabled() && - layerTcps != sublayerTcps) { + if (layerTcps != sublayerTcps) { sublayerOffset.SetScale(sublayerOffset.GetScale() * layerTcps / sublayerTcps); } diff --git a/pxr/usd/pcp/layerStack.h b/pxr/usd/pcp/layerStack.h index 8ae318b2ba..35b0014d0b 100644 --- a/pxr/usd/pcp/layerStack.h +++ b/pxr/usd/pcp/layerStack.h @@ -381,14 +381,6 @@ bool Pcp_NeedToRecomputeLayerStackTimeCodesPerSecond( const PcpLayerStackPtr& layerStack, const SdfLayerHandle &changedLayer); -/// Returns true when the environment variable has been set to disable the -/// behavior where differing time codes per second metadata in layers sublayered -/// or referenced by another layer are used to apply a layer offset scale to the -/// map function. -PCP_API -bool -PcpIsTimeScalingForLayerTimeCodesPerSecondDisabled(); - PXR_NAMESPACE_CLOSE_SCOPE #endif // PXR_USD_PCP_LAYER_STACK_H diff --git a/pxr/usd/pcp/primIndex.cpp b/pxr/usd/pcp/primIndex.cpp index b41a875c51..44c3aee332 100644 --- a/pxr/usd/pcp/primIndex.cpp +++ b/pxr/usd/pcp/primIndex.cpp @@ -2277,21 +2277,19 @@ _EvalRefOrPayloadArcs(PcpNodeRef node, layerStack = indexer->inputs.cache->ComputeLayerStack( layerStackIdentifier, &indexer->outputs->allErrors); - if (!PcpIsTimeScalingForLayerTimeCodesPerSecondDisabled()) { - // If the referenced or payloaded layer has a different TCPS - // than the source layer that introduces it, we apply the time - // scale between these TCPS values to the layer offset. - // Note that if the introducing layer is a layer stack sublayer, - // any TCPS scaling from the layer stack will already have been - // applied to the layer offset for the reference/payload. - const double srcTimeCodesPerSecond = - srcLayer->GetTimeCodesPerSecond(); - const double destTimeCodesPerSecond = - layerStack->GetTimeCodesPerSecond(); - if (srcTimeCodesPerSecond != destTimeCodesPerSecond) { - layerOffset.SetScale(layerOffset.GetScale() * - srcTimeCodesPerSecond / destTimeCodesPerSecond); - } + // If the referenced or payloaded layer has a different TCPS + // than the source layer that introduces it, we apply the time + // scale between these TCPS values to the layer offset. + // Note that if the introducing layer is a layer stack sublayer, + // any TCPS scaling from the layer stack will already have been + // applied to the layer offset for the reference/payload. + const double srcTimeCodesPerSecond = + srcLayer->GetTimeCodesPerSecond(); + const double destTimeCodesPerSecond = + layerStack->GetTimeCodesPerSecond(); + if (srcTimeCodesPerSecond != destTimeCodesPerSecond) { + layerOffset.SetScale(layerOffset.GetScale() * + srcTimeCodesPerSecond / destTimeCodesPerSecond); } } diff --git a/pxr/usd/pcp/testenv/testPcpChanges.py b/pxr/usd/pcp/testenv/testPcpChanges.py index 2d9550d02c..e2094b1ac4 100644 --- a/pxr/usd/pcp/testenv/testPcpChanges.py +++ b/pxr/usd/pcp/testenv/testPcpChanges.py @@ -378,9 +378,6 @@ def _ChangeAndVerify(newValDict, expectSignificantChange, expectedTcps): _ChangeAndVerify({'tcps' : 24.0, 'fps' : 24.0}, True, 24.0) _ChangeAndVerify({'tcps' : None, 'fps' : None}, False, 24.0) - @unittest.skipIf( - Tf.GetEnvSetting('PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS'), - "Test requires layer TCPS time scaling enabled") def test_TcpsChanges(self): """ Tests change processing for changes that affect the time codes per diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_TimeCodesPerSecond.testenv/baseline/compositionResults_TimeCodesPerSecond1_Legacy.txt b/pxr/usd/pcp/testenv/testPcpMuseum_TimeCodesPerSecond.testenv/baseline/compositionResults_TimeCodesPerSecond1_Legacy.txt deleted file mode 100644 index 2c29b44719..0000000000 --- a/pxr/usd/pcp/testenv/testPcpMuseum_TimeCodesPerSecond.testenv/baseline/compositionResults_TimeCodesPerSecond1_Legacy.txt +++ /dev/null @@ -1,395 +0,0 @@ -Loading @TimeCodesPerSecond/root.sdf@ - ------------------------------------------------------------------------- -Layer Stack: - root.sdf - s.sdf - ss.sdf - ss_48tcps.sdf - ss_24tcps_12fps.sdf - ss_12fps.sdf - s_48tcps.sdf - ss.sdf - ss_48tcps.sdf - ss_24tcps_12fps.sdf - ss_12fps.sdf - s_24tcps_12fps.sdf - ss.sdf - ss_48tcps.sdf - ss_24tcps_12fps.sdf - ss_12fps.sdf - s_12fps.sdf - ss.sdf - ss_48tcps.sdf - ss_24tcps_12fps.sdf - ss_12fps.sdf - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - ss_12fps.sdf /SS4 - ss_12fps.sdf /SS4 - ss_12fps.sdf /SS4 - ss_12fps.sdf /SS4 - ref.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_48tcps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_24tcps_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - -Time Offsets: - root.sdf /SS4 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ref.sdf /Ref reference (offset=70.00, scale=8.00) - ref_48tcps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_24tcps_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - ss_24tcps_12fps.sdf /SS3 - ss_24tcps_12fps.sdf /SS3 - ss_24tcps_12fps.sdf /SS3 - ss_24tcps_12fps.sdf /SS3 - ref.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_48tcps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_24tcps_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - -Time Offsets: - root.sdf /SS3 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ref.sdf /Ref reference (offset=70.00, scale=8.00) - ref_48tcps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_24tcps_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - ss_48tcps.sdf /SS2 - ss_48tcps.sdf /SS2 - ss_48tcps.sdf /SS2 - ss_48tcps.sdf /SS2 - ref.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_48tcps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_24tcps_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - -Time Offsets: - root.sdf /SS2 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ref.sdf /Ref reference (offset=70.00, scale=8.00) - ref_48tcps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_24tcps_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - ss.sdf /SS1 - ss.sdf /SS1 - ss.sdf /SS1 - ss.sdf /SS1 - ref.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_48tcps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_24tcps_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - -Time Offsets: - root.sdf /SS1 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ref.sdf /Ref reference (offset=70.00, scale=8.00) - ref_48tcps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_24tcps_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - s_12fps.sdf /S4 - -Time Offsets: - root.sdf /S4 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - s_24tcps_12fps.sdf /S3 - -Time Offsets: - root.sdf /S3 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - s_48tcps.sdf /S2 - -Time Offsets: - root.sdf /S2 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - s.sdf /S1 - -Time Offsets: - root.sdf /S1 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - root.sdf /Root - -Time Offsets: - root.sdf /Root root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_TimeCodesPerSecond.testenv/baseline/compositionResults_TimeCodesPerSecond2_Legacy.txt b/pxr/usd/pcp/testenv/testPcpMuseum_TimeCodesPerSecond.testenv/baseline/compositionResults_TimeCodesPerSecond2_Legacy.txt deleted file mode 100644 index a926dac4c7..0000000000 --- a/pxr/usd/pcp/testenv/testPcpMuseum_TimeCodesPerSecond.testenv/baseline/compositionResults_TimeCodesPerSecond2_Legacy.txt +++ /dev/null @@ -1,395 +0,0 @@ -Loading @TimeCodesPerSecond/root_48tcps.sdf@ - ------------------------------------------------------------------------- -Layer Stack: - root_48tcps.sdf - s.sdf - ss.sdf - ss_48tcps.sdf - ss_24tcps_12fps.sdf - ss_12fps.sdf - s_48tcps.sdf - ss.sdf - ss_48tcps.sdf - ss_24tcps_12fps.sdf - ss_12fps.sdf - s_24tcps_12fps.sdf - ss.sdf - ss_48tcps.sdf - ss_24tcps_12fps.sdf - ss_12fps.sdf - s_12fps.sdf - ss.sdf - ss_48tcps.sdf - ss_24tcps_12fps.sdf - ss_12fps.sdf - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - ss_12fps.sdf /SS4 - ss_12fps.sdf /SS4 - ss_12fps.sdf /SS4 - ss_12fps.sdf /SS4 - ref.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_48tcps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_24tcps_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - -Time Offsets: - root_48tcps.sdf /SS4 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ref.sdf /Ref reference (offset=70.00, scale=8.00) - ref_48tcps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_24tcps_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - ss_24tcps_12fps.sdf /SS3 - ss_24tcps_12fps.sdf /SS3 - ss_24tcps_12fps.sdf /SS3 - ss_24tcps_12fps.sdf /SS3 - ref.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_48tcps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_24tcps_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - -Time Offsets: - root_48tcps.sdf /SS3 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ref.sdf /Ref reference (offset=70.00, scale=8.00) - ref_48tcps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_24tcps_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - ss_48tcps.sdf /SS2 - ss_48tcps.sdf /SS2 - ss_48tcps.sdf /SS2 - ss_48tcps.sdf /SS2 - ref.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_48tcps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_24tcps_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - -Time Offsets: - root_48tcps.sdf /SS2 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ref.sdf /Ref reference (offset=70.00, scale=8.00) - ref_48tcps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_24tcps_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - ss.sdf /SS1 - ss.sdf /SS1 - ss.sdf /SS1 - ss.sdf /SS1 - ref.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_48tcps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_24tcps_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - -Time Offsets: - root_48tcps.sdf /SS1 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ref.sdf /Ref reference (offset=70.00, scale=8.00) - ref_48tcps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_24tcps_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - s_12fps.sdf /S4 - -Time Offsets: - root_48tcps.sdf /S4 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - s_24tcps_12fps.sdf /S3 - -Time Offsets: - root_48tcps.sdf /S3 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - s_48tcps.sdf /S2 - -Time Offsets: - root_48tcps.sdf /S2 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - s.sdf /S1 - -Time Offsets: - root_48tcps.sdf /S1 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - root_48tcps.sdf /Root - -Time Offsets: - root_48tcps.sdf /Root root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_TimeCodesPerSecond.testenv/baseline/compositionResults_TimeCodesPerSecond3_Legacy.txt b/pxr/usd/pcp/testenv/testPcpMuseum_TimeCodesPerSecond.testenv/baseline/compositionResults_TimeCodesPerSecond3_Legacy.txt deleted file mode 100644 index ae2edf1fd3..0000000000 --- a/pxr/usd/pcp/testenv/testPcpMuseum_TimeCodesPerSecond.testenv/baseline/compositionResults_TimeCodesPerSecond3_Legacy.txt +++ /dev/null @@ -1,395 +0,0 @@ -Loading @TimeCodesPerSecond/root_24tcps_12fps.sdf@ - ------------------------------------------------------------------------- -Layer Stack: - root_24tcps_12fps.sdf - s.sdf - ss.sdf - ss_48tcps.sdf - ss_24tcps_12fps.sdf - ss_12fps.sdf - s_48tcps.sdf - ss.sdf - ss_48tcps.sdf - ss_24tcps_12fps.sdf - ss_12fps.sdf - s_24tcps_12fps.sdf - ss.sdf - ss_48tcps.sdf - ss_24tcps_12fps.sdf - ss_12fps.sdf - s_12fps.sdf - ss.sdf - ss_48tcps.sdf - ss_24tcps_12fps.sdf - ss_12fps.sdf - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - ss_12fps.sdf /SS4 - ss_12fps.sdf /SS4 - ss_12fps.sdf /SS4 - ss_12fps.sdf /SS4 - ref.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_48tcps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_24tcps_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - -Time Offsets: - root_24tcps_12fps.sdf /SS4 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ref.sdf /Ref reference (offset=70.00, scale=8.00) - ref_48tcps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_24tcps_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - ss_24tcps_12fps.sdf /SS3 - ss_24tcps_12fps.sdf /SS3 - ss_24tcps_12fps.sdf /SS3 - ss_24tcps_12fps.sdf /SS3 - ref.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_48tcps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_24tcps_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - -Time Offsets: - root_24tcps_12fps.sdf /SS3 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ref.sdf /Ref reference (offset=70.00, scale=8.00) - ref_48tcps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_24tcps_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - ss_48tcps.sdf /SS2 - ss_48tcps.sdf /SS2 - ss_48tcps.sdf /SS2 - ss_48tcps.sdf /SS2 - ref.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_48tcps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_24tcps_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - -Time Offsets: - root_24tcps_12fps.sdf /SS2 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ref.sdf /Ref reference (offset=70.00, scale=8.00) - ref_48tcps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_24tcps_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - ss.sdf /SS1 - ss.sdf /SS1 - ss.sdf /SS1 - ss.sdf /SS1 - ref.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_48tcps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_24tcps_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - -Time Offsets: - root_24tcps_12fps.sdf /SS1 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ref.sdf /Ref reference (offset=70.00, scale=8.00) - ref_48tcps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_24tcps_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - s_12fps.sdf /S4 - -Time Offsets: - root_24tcps_12fps.sdf /S4 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - s_24tcps_12fps.sdf /S3 - -Time Offsets: - root_24tcps_12fps.sdf /S3 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - s_48tcps.sdf /S2 - -Time Offsets: - root_24tcps_12fps.sdf /S2 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - s.sdf /S1 - -Time Offsets: - root_24tcps_12fps.sdf /S1 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - root_24tcps_12fps.sdf /Root - -Time Offsets: - root_24tcps_12fps.sdf /Root root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_TimeCodesPerSecond.testenv/baseline/compositionResults_TimeCodesPerSecond4_Legacy.txt b/pxr/usd/pcp/testenv/testPcpMuseum_TimeCodesPerSecond.testenv/baseline/compositionResults_TimeCodesPerSecond4_Legacy.txt deleted file mode 100644 index 755e328558..0000000000 --- a/pxr/usd/pcp/testenv/testPcpMuseum_TimeCodesPerSecond.testenv/baseline/compositionResults_TimeCodesPerSecond4_Legacy.txt +++ /dev/null @@ -1,395 +0,0 @@ -Loading @TimeCodesPerSecond/root_12fps.sdf@ - ------------------------------------------------------------------------- -Layer Stack: - root_12fps.sdf - s.sdf - ss.sdf - ss_48tcps.sdf - ss_24tcps_12fps.sdf - ss_12fps.sdf - s_48tcps.sdf - ss.sdf - ss_48tcps.sdf - ss_24tcps_12fps.sdf - ss_12fps.sdf - s_24tcps_12fps.sdf - ss.sdf - ss_48tcps.sdf - ss_24tcps_12fps.sdf - ss_12fps.sdf - s_12fps.sdf - ss.sdf - ss_48tcps.sdf - ss_24tcps_12fps.sdf - ss_12fps.sdf - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - ss_12fps.sdf /SS4 - ss_12fps.sdf /SS4 - ss_12fps.sdf /SS4 - ss_12fps.sdf /SS4 - ref.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_48tcps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_24tcps_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - -Time Offsets: - root_12fps.sdf /SS4 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ref.sdf /Ref reference (offset=70.00, scale=8.00) - ref_48tcps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_24tcps_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - ss_24tcps_12fps.sdf /SS3 - ss_24tcps_12fps.sdf /SS3 - ss_24tcps_12fps.sdf /SS3 - ss_24tcps_12fps.sdf /SS3 - ref.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_48tcps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_24tcps_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - -Time Offsets: - root_12fps.sdf /SS3 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ref.sdf /Ref reference (offset=70.00, scale=8.00) - ref_48tcps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_24tcps_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - ss_48tcps.sdf /SS2 - ss_48tcps.sdf /SS2 - ss_48tcps.sdf /SS2 - ss_48tcps.sdf /SS2 - ref.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_48tcps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_24tcps_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - -Time Offsets: - root_12fps.sdf /SS2 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ref.sdf /Ref reference (offset=70.00, scale=8.00) - ref_48tcps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_24tcps_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - ss.sdf /SS1 - ss.sdf /SS1 - ss.sdf /SS1 - ss.sdf /SS1 - ref.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_48tcps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_24tcps_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - ref_12fps.sdf /Ref - ref_s.sdf /Ref - ref_s_48tcps.sdf /Ref - ref_s_24tcps_12fps.sdf /Ref - ref_s_12fps.sdf /Ref - -Time Offsets: - root_12fps.sdf /SS1 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ref.sdf /Ref reference (offset=70.00, scale=8.00) - ref_48tcps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_24tcps_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ref_12fps.sdf /Ref reference (offset=70.00, scale=8.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - s_12fps.sdf /S4 - -Time Offsets: - root_12fps.sdf /S4 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - s_24tcps_12fps.sdf /S3 - -Time Offsets: - root_12fps.sdf /S3 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - s_48tcps.sdf /S2 - -Time Offsets: - root_12fps.sdf /S2 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - s.sdf /S1 - -Time Offsets: - root_12fps.sdf /S1 root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - ------------------------------------------------------------------------- -Results for composing - -Prim Stack: - root_12fps.sdf /Root - -Time Offsets: - root_12fps.sdf /Root root (offset=0.00, scale=1.00) - s.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_48tcps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_24tcps_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - s_12fps.sdf sublayer (offset=10.00, scale=2.00) - ss.sdf sublayer (offset=30.00, scale=4.00) - ss_48tcps.sdf sublayer (offset=30.00, scale=4.00) - ss_24tcps_12fps.sdf sublayer (offset=30.00, scale=4.00) - ss_12fps.sdf sublayer (offset=30.00, scale=4.00) - diff --git a/pxr/usd/usd/CMakeLists.txt b/pxr/usd/usd/CMakeLists.txt index 872e470716..da880016e8 100644 --- a/pxr/usd/usd/CMakeLists.txt +++ b/pxr/usd/usd/CMakeLists.txt @@ -1130,8 +1130,6 @@ pxr_register_test(testUsdTimeOffsets PYTHON COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdTimeOffsets" EXPECTED_RETURN_CODE 0 - ENV - PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS=0 ) pxr_register_test(testUsdPrimRange @@ -1357,15 +1355,11 @@ pxr_register_test(testUsdTimeValueAuthoring PYTHON COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdTimeValueAuthoring" EXPECTED_RETURN_CODE 0 - ENV - PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS=0 ) pxr_register_test(testUsdTimeValueAuthoringCpp COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdTimeValueAuthoringCpp" EXPECTED_RETURN_CODE 0 - ENV - PCP_DISABLE_TIME_SCALING_BY_LAYER_TCPS=0 ) pxr_register_test(testUsdUsdzFileFormat From 2ca3703be1b517158dbd75d14ae1d648b5a47f58 Mon Sep 17 00:00:00 2001 From: blevin Date: Thu, 24 Oct 2024 13:11:54 -0700 Subject: [PATCH 56/82] testUsdImagingGLBasicDrawing now verifies that the expected error does occur. (Internal change: 2345524) --- .../usdImagingGL/testenv/testUsdImagingGLBasicDrawing.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pxr/usdImaging/usdImagingGL/testenv/testUsdImagingGLBasicDrawing.cpp b/pxr/usdImaging/usdImagingGL/testenv/testUsdImagingGLBasicDrawing.cpp index 8fb7b634fa..d89ac8b74d 100644 --- a/pxr/usdImaging/usdImagingGL/testenv/testUsdImagingGLBasicDrawing.cpp +++ b/pxr/usdImaging/usdImagingGL/testenv/testUsdImagingGLBasicDrawing.cpp @@ -293,7 +293,9 @@ My_TestGLDrawing::DrawTest(bool offscreen) renderTime.Stop(); } - TF_VERIFY(mark.IsClean(), "Errors occurred while rendering!"); + // Note that we do not confirm that mark.IsClear() here, since + // in some tests we do expect to encounter broken materials + // that will fail to compile, ex: testUsdImagingGLInvalidMaterial std::cout << "Iterations to convergence: " << convergenceIterations << std::endl; std::cout << "itemsDrawn " << perfLog.GetCounter(HdTokens->itemsDrawn) << std::endl; From 7af4351e177add2bdb4f43e607db84ee281a6718 Mon Sep 17 00:00:00 2001 From: davvid Date: Thu, 24 Oct 2024 13:12:12 -0700 Subject: [PATCH 57/82] assetLocalization: retain AssetPath metadata in UsdUtilsModifyAssetPaths UsdUtilsModifyAssetPaths was removing SdfAssetPath instances in metadata, which was a change in behavior introduced in 23.11. Retain the processed value when processing metadata fields. (Internal change: 2345531) --- pxr/usd/usdUtils/CMakeLists.txt | 4 +++- pxr/usd/usdUtils/assetLocalization.cpp | 18 ++++++++++++------ pxr/usd/usdUtils/assetLocalization.h | 6 ++++-- pxr/usd/usdUtils/assetLocalizationDelegate.cpp | 13 ++++++++++--- pxr/usd/usdUtils/assetLocalizationDelegate.h | 12 +++++++++--- .../testenv/testUsdUtilsModifyAssetPaths.py | 9 +++++++++ .../baseline/preserve_metadata.usda | 11 +++++++++++ .../testUsdUtilsModifyAssetPaths/metadata.usda | 11 +++++++++++ 8 files changed, 69 insertions(+), 15 deletions(-) create mode 100644 pxr/usd/usdUtils/testenv/testUsdUtilsModifyAssetPaths/baseline/preserve_metadata.usda create mode 100644 pxr/usd/usdUtils/testenv/testUsdUtilsModifyAssetPaths/metadata.usda diff --git a/pxr/usd/usdUtils/CMakeLists.txt b/pxr/usd/usdUtils/CMakeLists.txt index e358361d5d..5e27b27b4c 100644 --- a/pxr/usd/usdUtils/CMakeLists.txt +++ b/pxr/usd/usdUtils/CMakeLists.txt @@ -643,7 +643,9 @@ pxr_register_test(testUsdUtilsLocalizeAssetUdims pxr_register_test(testUsdUtilsModifyAssetPaths PYTHON COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdUtilsModifyAssetPaths layer.usda modified.usda" - DIFF_COMPARE modified.usda duplicates.usda removal.usda removal_preserve_length.usda ref_layer_mod.usda ref_unmodified.usda + DIFF_COMPARE + modified.usda duplicates.usda removal.usda removal_preserve_length.usda + ref_layer_mod.usda ref_unmodified.usda preserve_metadata.usda EXPECTED_RETURN_CODE 0 ) diff --git a/pxr/usd/usdUtils/assetLocalization.cpp b/pxr/usd/usdUtils/assetLocalization.cpp index 9e830681cd..3ae5e2f092 100644 --- a/pxr/usd/usdUtils/assetLocalization.cpp +++ b/pxr/usd/usdUtils/assetLocalization.cpp @@ -229,7 +229,8 @@ UsdUtils_LocalizationContext::_ProcessMetadata( _delegate->BeginProcessValue(layer, value); _ProcessAssetValue(layer, infoKey, value, - /*processingMetadata*/ true); + /*processingMetadata*/ true, + /*processingDictionary*/ false); _delegate->EndProcessValue( layer, primSpec->GetPath(), infoKey, value); } @@ -440,9 +441,10 @@ void UsdUtils_LocalizationContext::_ProcessAssetValue( const SdfLayerRefPtr& layer, const VtValue &val, - bool processingMetadata) + bool processingMetadata, + bool processingDictionary) { - _ProcessAssetValue(layer, std::string(), val, processingMetadata); + _ProcessAssetValue(layer, std::string(), val, processingMetadata, processingDictionary); } void @@ -450,7 +452,8 @@ UsdUtils_LocalizationContext::_ProcessAssetValue( const SdfLayerRefPtr& layer, const std::string &keyPath, const VtValue &val, - bool processingMetadata) + bool processingMetadata, + bool processingDictionary) { if (_ShouldFilterAssetPath(keyPath, processingMetadata)) { return; @@ -465,7 +468,8 @@ UsdUtils_LocalizationContext::_ProcessAssetValue( const std::vector processedDeps = _delegate->ProcessValuePath( - layer, keyPath, rawAssetPath, dependencies); + layer, keyPath, rawAssetPath, dependencies, + processingMetadata, processingDictionary); _EnqueueDependency(layer, rawAssetPath); _EnqueueDependencies(layer, processedDeps); @@ -504,7 +508,9 @@ UsdUtils_LocalizationContext::_ProcessAssetValue( for (const auto& p : originalDict) { const std::string dictKey = keyPath.empty() ? p.first : keyPath + ':' + p.first; - _ProcessAssetValue(layer, dictKey, p.second, processingMetadata); + _ProcessAssetValue( + layer, dictKey, p.second, + processingMetadata, /*processingDictionary*/true); } } diff --git a/pxr/usd/usdUtils/assetLocalization.h b/pxr/usd/usdUtils/assetLocalization.h index d579fbfdbd..87c8c54173 100644 --- a/pxr/usd/usdUtils/assetLocalization.h +++ b/pxr/usd/usdUtils/assetLocalization.h @@ -112,10 +112,12 @@ class UsdUtils_LocalizationContext { void _ProcessAssetValue(const SdfLayerRefPtr& layer, const std::string &key, const VtValue &val, - bool processingMetadata = false); + bool processingMetadata = false, + bool processingDictionary = false); void _ProcessAssetValue(const SdfLayerRefPtr& layer, const VtValue &val, - bool processingMetadata = false); + bool processingMetadata = false, + bool processingDictionary = false); // Searches for udim tiles associated with the given asset path. std::vector _GetUdimTiles(const SdfLayerRefPtr& layer, diff --git a/pxr/usd/usdUtils/assetLocalizationDelegate.cpp b/pxr/usd/usdUtils/assetLocalizationDelegate.cpp index 8495271b37..9464b725ec 100644 --- a/pxr/usd/usdUtils/assetLocalizationDelegate.cpp +++ b/pxr/usd/usdUtils/assetLocalizationDelegate.cpp @@ -216,7 +216,9 @@ UsdUtils_WritableLocalizationDelegate::ProcessValuePath( const SdfLayerRefPtr &layer, const std::string &keyPath, const std::string &authoredPath, - const std::vector &dependencies) + const std::vector &dependencies, + const bool processingMetadata, + const bool processingDictionary) { if (authoredPath.empty()) { return {}; @@ -228,7 +230,10 @@ UsdUtils_WritableLocalizationDelegate::ProcessValuePath( const std::string relativeKeyPath = _GetRelativeKeyPath(keyPath); - if (relativeKeyPath.empty()) { + if (relativeKeyPath.empty() || ( + processingMetadata && + !processingDictionary && + !info.GetAssetPath().empty())) { _currentValuePath = SdfAssetPath(info.GetAssetPath()); } else if (info.GetAssetPath().empty()){ @@ -567,7 +572,9 @@ UsdUtils_ReadOnlyLocalizationDelegate::ProcessValuePath( const SdfLayerRefPtr &layer, const std::string &keyPath, const std::string &authoredPath, - const std::vector &dependencies) + const std::vector &dependencies, + const bool processingMetadata, + const bool processingDictionary) { if (authoredPath.empty()) { return {}; diff --git a/pxr/usd/usdUtils/assetLocalizationDelegate.h b/pxr/usd/usdUtils/assetLocalizationDelegate.h index 4a36dcb48e..afe0cde0f1 100644 --- a/pxr/usd/usdUtils/assetLocalizationDelegate.h +++ b/pxr/usd/usdUtils/assetLocalizationDelegate.h @@ -66,7 +66,9 @@ struct UsdUtils_LocalizationDelegate const SdfLayerRefPtr &layer, const std::string &keyPath, const std::string &authoredPath, - const std::vector &dependencies) { return {}; } + const std::vector &dependencies, + const bool processingMetadata = false, + const bool processingDictionary = false) { return {}; } virtual std::vector ProcessValuePathArrayElement( const SdfLayerRefPtr &layer, @@ -157,7 +159,9 @@ class UsdUtils_WritableLocalizationDelegate const SdfLayerRefPtr &layer, const std::string &keyPath, const std::string &authoredPath, - const std::vector &dependencies) override; + const std::vector &dependencies, + const bool processingMetadata = false, + const bool processingDictionary = false) override; virtual std::vector ProcessValuePathArrayElement( const SdfLayerRefPtr &layer, @@ -283,7 +287,9 @@ class UsdUtils_ReadOnlyLocalizationDelegate const SdfLayerRefPtr &layer, const std::string &keyPath, const std::string &authoredPath, - const std::vector &dependencies) override; + const std::vector &dependencies, + const bool processingMetadata = false, + const bool processingDictionary = false) override; virtual std::vector ProcessValuePathArrayElement( const SdfLayerRefPtr &layer, diff --git a/pxr/usd/usdUtils/testenv/testUsdUtilsModifyAssetPaths.py b/pxr/usd/usdUtils/testenv/testUsdUtilsModifyAssetPaths.py index e1e06b2621..fe6853a671 100644 --- a/pxr/usd/usdUtils/testenv/testUsdUtilsModifyAssetPaths.py +++ b/pxr/usd/usdUtils/testenv/testUsdUtilsModifyAssetPaths.py @@ -62,3 +62,12 @@ def fn(s): refLayer.Export("ref_unmodified.usda") TestDoesNotRecurseDeps() + +def TestDoesNotStripMetadata(): + # Ensure that metadata is retained. + def fn(s): + return s + + Test('metadata.usda', 'preserve_metadata.usda', fn) + +TestDoesNotStripMetadata() diff --git a/pxr/usd/usdUtils/testenv/testUsdUtilsModifyAssetPaths/baseline/preserve_metadata.usda b/pxr/usd/usdUtils/testenv/testUsdUtilsModifyAssetPaths/baseline/preserve_metadata.usda new file mode 100644 index 0000000000..fd8c13b9af --- /dev/null +++ b/pxr/usd/usdUtils/testenv/testUsdUtilsModifyAssetPaths/baseline/preserve_metadata.usda @@ -0,0 +1,11 @@ +#usda 1.0 + +def "Model" ( + high = @example:geo/high.usd@ + lod = "low" + low = @example:geo/low.usd@ + payload = @example:geo/payload.usdc@ +) +{ +} + diff --git a/pxr/usd/usdUtils/testenv/testUsdUtilsModifyAssetPaths/metadata.usda b/pxr/usd/usdUtils/testenv/testUsdUtilsModifyAssetPaths/metadata.usda new file mode 100644 index 0000000000..fd8c13b9af --- /dev/null +++ b/pxr/usd/usdUtils/testenv/testUsdUtilsModifyAssetPaths/metadata.usda @@ -0,0 +1,11 @@ +#usda 1.0 + +def "Model" ( + high = @example:geo/high.usd@ + lod = "low" + low = @example:geo/low.usd@ + payload = @example:geo/payload.usdc@ +) +{ +} + From 4b977ab6ba3e01c820ad92669daeff1986c45ce9 Mon Sep 17 00:00:00 2001 From: comand Date: Thu, 24 Oct 2024 13:12:31 -0700 Subject: [PATCH 58/82] Fix GCC 11 mismatched new/delete warnings. GCC 11 reports -Werror=mismatched-new-delete seemingly due to an inlining bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103993 Marking the affected methods as alway_inline to work around this. (Internal change: 2345573) --- pxr/base/arch/attributes.h | 2 ++ pxr/base/tf/mallocTag.h | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pxr/base/arch/attributes.h b/pxr/base/arch/attributes.h index 1d2820d1e7..42f9a6e875 100644 --- a/pxr/base/arch/attributes.h +++ b/pxr/base/arch/attributes.h @@ -159,6 +159,7 @@ PXR_NAMESPACE_OPEN_SCOPE # define ARCH_SCANF_FUNCTION(_fmt, _firstArg) \ __attribute__((format(scanf, _fmt, _firstArg))) # define ARCH_NOINLINE __attribute__((noinline)) +# define ARCH_ALWAYS_INLINE __attribute__((always_inline)) # define ARCH_UNUSED_ARG __attribute__ ((unused)) # define ARCH_UNUSED_FUNCTION __attribute__((unused)) # define ARCH_USED_FUNCTION __attribute__((used)) @@ -169,6 +170,7 @@ PXR_NAMESPACE_OPEN_SCOPE # define ARCH_PRINTF_FUNCTION(_fmt, _firstArg) # define ARCH_SCANF_FUNCTION(_fmt, _firstArg) # define ARCH_NOINLINE // __declspec(noinline) +# define ARCH_ALWAYS_INLINE # define ARCH_UNUSED_ARG # define ARCH_UNUSED_FUNCTION # define ARCH_USED_FUNCTION diff --git a/pxr/base/tf/mallocTag.h b/pxr/base/tf/mallocTag.h index e4b326c9c0..d28522c01e 100644 --- a/pxr/base/tf/mallocTag.h +++ b/pxr/base/tf/mallocTag.h @@ -474,28 +474,28 @@ PXR_NAMESPACE_CLOSE_SCOPE #define TF_MALLOC_TAG_NEW(name1, name2) \ /* this is for STL purposes */ \ - inline void* operator new(::std::size_t, void* ptr) { \ + ARCH_ALWAYS_INLINE inline void* operator new(::std::size_t, void* ptr) { \ return ptr; \ } \ \ - inline void* operator new(::std::size_t s) { \ + ARCH_ALWAYS_INLINE inline void* operator new(::std::size_t s) { \ PXR_NS::TfAutoMallocTag tag(name1, name2); \ return malloc(s); \ } \ \ - inline void* operator new[](::std::size_t s) { \ + ARCH_ALWAYS_INLINE inline void* operator new[](::std::size_t s) { \ PXR_NS::TfAutoMallocTag tag(name1, name2); \ return malloc(s); \ } \ \ /* Required due to the placement-new override above. */ \ - inline void operator delete(void* ptr, void* place) {} \ + ARCH_ALWAYS_INLINE inline void operator delete(void* ptr, void* place) {} \ \ - inline void operator delete(void* ptr, size_t) { \ + ARCH_ALWAYS_INLINE inline void operator delete(void* ptr, size_t) { \ free(ptr); \ } \ \ - inline void operator delete[] (void* ptr, size_t) { \ + ARCH_ALWAYS_INLINE inline void operator delete[] (void* ptr, size_t) { \ free(ptr); \ } \ From 88da603cc15062a821b8a95c466d90eb0121bdee Mon Sep 17 00:00:00 2001 From: pixar-oss Date: Thu, 24 Oct 2024 13:14:05 -0700 Subject: [PATCH 59/82] Update schema generation to use 'full' shader doc (Internal change: 2345578) --- .../baseline/schemaConcrete.usda | 9 ++++++++- pxr/usd/usdUtils/updateSchemaWithSdrNode.py | 14 ++------------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/pxr/usd/usdUtils/testenv/testUsdUtilsUpdateSchemaWithSdrNode/baseline/schemaConcrete.usda b/pxr/usd/usdUtils/testenv/testUsdUtilsUpdateSchemaWithSdrNode/baseline/schemaConcrete.usda index 5b22e6c0a4..800b1734ea 100644 --- a/pxr/usd/usdUtils/testenv/testUsdUtilsUpdateSchemaWithSdrNode/baseline/schemaConcrete.usda +++ b/pxr/usd/usdUtils/testenv/testUsdUtilsUpdateSchemaWithSdrNode/baseline/schemaConcrete.usda @@ -20,7 +20,14 @@ class TestSchemaConcrete "TestSchemaConcrete" ( photographic measurements. """ string userDocBrief = """ - exposure: Specify the intensity of the light source as a power of 2 (in stops).""" + exposure: Specify the intensity of the light source as a power of 2 (in stops). + Increasing the exposure by 1 will double the energy emitted by the light source. + A value of 0 produces an intensity of 1, -1 produces .5. You may wonder why you + might use Exposure, and the answer is that real world lighting has high energies + and typical exposures are low values while you may have to type a really large + number for equivalent Intensity. This is also comfortable to artists familiar with + photographic measurements. + """ } displayGroup = "Basic" displayName = "Exposure" diff --git a/pxr/usd/usdUtils/updateSchemaWithSdrNode.py b/pxr/usd/usdUtils/updateSchemaWithSdrNode.py index 2ed04141fb..9e998c865d 100644 --- a/pxr/usd/usdUtils/updateSchemaWithSdrNode.py +++ b/pxr/usd/usdUtils/updateSchemaWithSdrNode.py @@ -46,7 +46,6 @@ class PropertyDefiningKeys(ConstantsGroup): class UserDocConstants(ConstantsGroup): USERDOC_FULL = "userDoc" USERDOC_BRIEF = "userDocBrief" - MAX_LENGTH_FOR_BRIEF = 500 def _IsNSPrefixConnectableAPICompliant(nsPrefix): return (nsPrefix == UsdShade.Tokens.inputs[:1] or \ @@ -177,17 +176,8 @@ def _SetSchemaUserDocFields(spec, doc): and attribute specs. """ # Set the "brief" user doc, used for in-context help, e.g. in DCC tools. - # If the doc string exceeds a certain length, just use the first sentence. - workDoc = "" - if len(doc) > UserDocConstants.MAX_LENGTH_FOR_BRIEF: - workDoc = doc.partition('.')[0] + '.' - # If '.' wasn't found, workDoc will be the entire doc string, so - # instead use the first MAX_LENGTH_FOR_BRIEF chars and append '...' - if len(workDoc) > UserDocConstants.MAX_LENGTH_FOR_BRIEF: - workDoc = workDoc[:UserDocConstants.MAX_LENGTH_FOR_BRIEF] + "..." - else: - workDoc = doc - spec.customData[UserDocConstants.USERDOC_BRIEF] = workDoc + # We currently want the full content, so we don't shorten userDocBrief. + spec.customData[UserDocConstants.USERDOC_BRIEF] = doc # Set the "long-form" user doc, used when generating HTML schema docs # (example: https://openusd.org/release/user_guides/schemas/index.html) spec.customData[UserDocConstants.USERDOC_FULL] = doc From f037c0e6257b2a41cc1c7545b79d9a63e9c7f791 Mon Sep 17 00:00:00 2001 From: gitamohr Date: Thu, 24 Oct 2024 13:14:24 -0700 Subject: [PATCH 60/82] tf: Rework the script module loader code to be thread-safe. Also simplify the code: we don't have to load modules in top-down dependency order; we can let them load bottom-up, protected by the recursive Python GIL. Improve TF_DEBUG output. Remove the unused `GetModuleNames()` and add notes about the what, why, and how this code works. (Internal change: 2345579) --- pxr/base/tf/scriptModuleLoader.cpp | 529 ++++++++---------- pxr/base/tf/scriptModuleLoader.h | 65 +-- .../scriptModuleLoader.out | 62 +- pxr/base/tf/wrapScriptModuleLoader.cpp | 2 - 4 files changed, 301 insertions(+), 357 deletions(-) diff --git a/pxr/base/tf/scriptModuleLoader.cpp b/pxr/base/tf/scriptModuleLoader.cpp index e1472ce7b6..b5590eac3e 100644 --- a/pxr/base/tf/scriptModuleLoader.cpp +++ b/pxr/base/tf/scriptModuleLoader.cpp @@ -11,11 +11,10 @@ #include "pxr/base/tf/debug.h" #include "pxr/base/tf/debugCodes.h" #include "pxr/base/tf/instantiateSingleton.h" -#include "pxr/base/tf/iterator.h" +#include "pxr/base/tf/pyError.h" +#include "pxr/base/tf/pyExceptionState.h" #include "pxr/base/tf/pyUtils.h" #include "pxr/base/tf/registryManager.h" -#include "pxr/base/tf/stackTrace.h" -#include "pxr/base/tf/staticData.h" #include "pxr/base/tf/stringUtils.h" #include "pxr/base/arch/fileSystem.h" @@ -24,13 +23,103 @@ #include "pxr/external/boost/python/dict.hpp" #include "pxr/external/boost/python/handle.hpp" -#include +/* + +Notes for those who venture into this dark crevice: + +We build C++ libs that have python bindings into two shared libraries: 1, the +shared library with the compiled C++ code (`libFoo.so`), and 2, a shared library +with the C++/Python bindings (`_foo.so`). We do this so that we can write pure +C++ programs that link `libFoo.so` and do not pay to load the Python bindings. +The bindings libraries (`_foo.so`) have a shared library link dependency on +their corresponding C++ library (`libFoo.so`) so whenever a bindings lib loads, +the shared library loader automatically loads the main C++ lib. + +The job of the code in this file is to ensure that the Python bindings for +loaded C++ libraries are loaded whenever they are needed. + +When are they needed? There are a few scenarios. + +The most obvious is when a Python module is imported. Suppose libFoo depends on +libBar, and both have Python bindings. If we do `import Foo` in Python, we need +to ensure that the `Bar` module is imported and registers its bindings before +Foo registers its bindings, since Foo's bindings may depend on Bar's. For +example, if Foo wraps a class that derives a base class from Bar, that base +class must be wrapped first. This scenario could in principle be handled by +manually writing `import Bar` in Foo's __init__.py. But, that is prone both to +being forgotten, and to going undetected if Bar happens to be already loaded in +most of the scenarios when Foo is imported. And, as we'll see, that doesn't +solve the other main scenario. + +The other main scenario is when a C++ program initializes Python at some point +during its execution. In this case all currently loaded C++ libraries that have +Python bindings must load them immediately. Further, any C++ library that loads +in the future (via dlopen()) must also immediately import its bindings at load +time. This might sound surprising. Why should we need to eagerly import all +bindings like this? Surely if Python code needs to use the bindings it will +`import` those modules itself, no? Yes this is true, but there can be hidden, +indirect, undetectable dependencies that this does not handle due to +type-erasure. + +Consider a type-erased opaque 'box' container, analogous to `std::any`. Let's +call it `Any`. When an Any is converted to Python, it unboxes its held object +and converts that object to Python. So for example if an Any holding a string +is returned to Python, Python gets a string. An Any holding a double unboxes as +a Python float. An Any holding a FooObject unboxes it and uses its bindings to +convert it to Python. + +Now suppose we have libFoo and libBar. Bar has an Any-valued variable, and +provides a Python binding to access it: `Bar.GetAny()`. Foo depends on Bar, and +stores an Any holding a FooObject to Bar's Any. Now suppose a Python script +does `import Bar; Bar.GetAny()`. The call to `Bar.GetAny()` will fail unless +the bindings for the held FooObject have been imported. + +Whose responsibility is it to ensure they have been imported? Bar cannot know +to import them, since Bar does not depend on Foo -- it has no knowledge of Foo's +existence. The Python code that imported Bar similarly cannot have done it -- +there's no way for it to know ahead of time what type of object is stored in the +Any, and it may not know of Foo's existence either. The answer is that the +_only_ place that we can know for sure the bindings are needed is at the very +moment that a FooObject is requested to be converted to Python. Unfortunately, +we do not have a hook available for this today. It might be possible to build +one now that we have our own copy of boost.python interred, but that's not the +world we currently live in. + +In the meantime, we must do as we said above and load _all_ bindings when Python +is initialized, and then continue to load any bindings for any later-loaded C++ +libraries when they are loaded. + +The Mechanism: + +We build a small bit of initialization code into each C++ library with bindings +to advertise themselves to the TfScriptModuleLoader. These are the +`moduleDeps.cpp` files in `pxr/...`. The initializer calls +TfScriptModuleLoader::RegisterLibrary(), passing the lib name, its python module +name (suitable for `import`), and a list of the lib's direct dependencies. This +way the the loader knows both which libraries have bindings, and what they +directly depend on. + +Then, in a few key places, code calls LoadModules() or LoadModulesForLibrary() +to achieve the goals above. + +- Tf_PyInitWrapModule(), in tf/pyModule.cpp calls LoadModulesForLibrary(). This + function is called by Python when a bindings library is imported. This covers + the "import" scenario above. + +- TfPyInitialize(), in tf/pyInterpreter.cpp calls LoadModules() to ensure that + all bindings are loaded if a C++ program starts up the Python interpreter at + some point. + +- TfDlopen(), in tf/dl.cpp calls LoadModules() to ensure that all bindings are + loaded for any newly loaded C++ libraries if Python is already initialized. + +*/ PXR_NAMESPACE_OPEN_SCOPE TF_INSTANTIATE_SINGLETON(TfScriptModuleLoader); -using std::deque; +using std::pair; using std::string; using std::vector; @@ -39,85 +128,74 @@ using pxr_boost::python::dict; using pxr_boost::python::handle; using pxr_boost::python::object; - -TfScriptModuleLoader::TfScriptModuleLoader() -{ -} - -// CODE_COVERAGE_OFF_GCOV_BUG -TfScriptModuleLoader::~TfScriptModuleLoader() -// CODE_COVERAGE_ON_GCOV_BUG -{ -} +TfScriptModuleLoader::TfScriptModuleLoader() = default; +TfScriptModuleLoader::~TfScriptModuleLoader() = default; void TfScriptModuleLoader:: -RegisterLibrary(TfToken const &name, TfToken const &moduleName, +RegisterLibrary(TfToken const &lib, TfToken const &moduleName, vector const &predecessors) { - if (TfDebug::IsEnabled(TF_SCRIPT_MODULE_LOADER)) { TF_DEBUG(TF_SCRIPT_MODULE_LOADER) - .Msg("Registering library %s with predecessors: ", name.GetText()); - TF_FOR_ALL(pred, predecessors) { - TF_DEBUG(TF_SCRIPT_MODULE_LOADER).Msg("%s, ", pred->GetText()); - } - TF_DEBUG(TF_SCRIPT_MODULE_LOADER).Msg("\n"); + .Msg("SML: Registering lib %s with %spredecessors%s%s\n", + lib.GetText(), + predecessors.empty() ? "no " : "", + predecessors.empty() ? "" : " ", + TfStringJoin(predecessors.begin(), + predecessors.end(), ", ").c_str()); } + vector mutablePreds = predecessors; + std::sort(mutablePreds.begin(), mutablePreds.end()); + // Add library with predecessors. - vector &predsInTable = _libInfo[name].predecessors; - predsInTable = predecessors; - std::sort(predsInTable.begin(), predsInTable.end()); - _libsToModules[name] = moduleName; - - // Add this library as a successor to all predecessors. - TF_FOR_ALL(pred, predecessors) - _AddSuccessor(*pred, name); -} - -vector -TfScriptModuleLoader::GetModuleNames() const -{ - vector order; - vector ret; - _TopologicalSort(&order); - ret.reserve(order.size()); - TF_FOR_ALL(lib, order) { - _TokenToTokenMap::const_iterator i = _libsToModules.find(*lib); - if (i != _libsToModules.end()) - ret.push_back(i->second.GetString()); + TfSpinRWMutex::ScopedLock lock(_mutex); + bool success = _libInfo.emplace( + std::piecewise_construct, + std::make_tuple(lib), + std::make_tuple(moduleName, std::move(mutablePreds))).second; + lock.Release(); + + if (!success) { + TF_WARN("Library %s (with module '%s') already registered, repeated " + "registration ignored", lib.GetText(), moduleName.GetText()); } - return ret; } dict TfScriptModuleLoader::GetModulesDict() const { if (!TfPyIsInitialized()) { - TF_CODING_ERROR("Python is not initialized!"); + TF_CODING_ERROR("Python is not initialized."); return dict(); } - // Kick the registry function so any loaded libraries with script - // bindings register themselves with the script module loading system. + // Subscribe to the registry function so any loaded libraries with script + // bindings publish to this singleton. TfRegistryManager::GetInstance().SubscribeTo(); - TfPyLock lock; + // Collect the libs & module names, then release the lock. + TfSpinRWMutex::ScopedLock lock(_mutex, /*write=*/false); + // Make paired lib & module names. + vector> libAndModNames; + libAndModNames.reserve(_libInfo.size()); + for (auto const &[lib, info]: _libInfo) { + libAndModNames.emplace_back(lib, info.moduleName); + } + lock.Release(); + + // Take the python lock and build a dict. + TfPyLock pyLock; // Get the sys.modules dict from python, so we can see if modules are // already loaded. dict modulesDict(handle<>(borrowed(PyImport_GetModuleDict()))); - - vector order; dict ret; - _TopologicalSort(&order); - TF_FOR_ALL(lib, order) { - _TokenToTokenMap::const_iterator i = _libsToModules.find(*lib); - if (i != _libsToModules.end() && - modulesDict.has_key(i->second.GetText())) { - handle<> modHandle(PyImport_ImportModule(const_cast - (i->second.GetText()))); + + for (auto const &[lib, mod]: libAndModNames) { + if (modulesDict.has_key(mod.GetText())) { + handle<> modHandle(PyImport_ImportModule(mod.GetText())); // Use the upper-cased form of the library name as // the Python module name. @@ -142,9 +220,7 @@ TfScriptModuleLoader::GetModulesDict() const // // For now, we just upper-case the library name. // - string moduleName = TfStringCapitalize(lib->GetString()); - - ret[moduleName] = object(modHandle); + ret[TfStringCapitalize(lib.GetString())] = object(modHandle); } } return ret; @@ -158,16 +234,13 @@ TfScriptModuleLoader::WriteDotFile(string const &file) const TF_RUNTIME_ERROR("Could not open '%s' for writing.\n", file.c_str()); return; } - fprintf(out, "digraph Modules {\n"); - - TF_FOR_ALL(info, _libInfo) { - TF_FOR_ALL(successor, info->second.successors) { - fprintf(out, "\t%s -> %s;\n", info->first.GetText(), - successor->GetText()); + TfSpinRWMutex::ScopedLock lock(_mutex, /*write=*/false); + for (auto const &[lib, info]: _libInfo) { + for (TfToken const &pred: info.predecessors) { + fprintf(out, "\t%s -> %s;\n", lib.GetText(), pred.GetText()); } } - fprintf(out, "}\n"); fclose(out); } @@ -175,257 +248,141 @@ TfScriptModuleLoader::WriteDotFile(string const &file) const void TfScriptModuleLoader::LoadModules() { - _LoadModulesFor(TfToken()); -} + // Do nothing if Python is not initialized. + if (!TfPyIsInitialized()) { + return; + } + + // Subscribe to the registry function so any loaded libraries with script + // bindings publish to this singleton. + TfRegistryManager::GetInstance().SubscribeTo(); -void -TfScriptModuleLoader::LoadModulesForLibrary(TfToken const &name) { - _LoadModulesFor(name); -} + TF_DEBUG(TF_SCRIPT_MODULE_LOADER).Msg("SML: Begin loading all modules\n"); -bool -TfScriptModuleLoader::_HasTransitiveSuccessor(TfToken const &predecessor, - TfToken const &successor) const -{ - // This function does a simple DFS of the dependency dag, to determine if \a - // predecessor has \a successor somewhere in the transitive closure. - - vector predStack(1, predecessor); - TfToken::HashSet seenPreds; - - while (!predStack.empty()) { - TfToken pred = predStack.back(); - predStack.pop_back(); - - // A name counts as its own successor. - if (pred == successor) - return true; - - // Look up successors, and push ones not yet visted as possible - // predecessors. - _TokenToInfoMap::const_iterator i = _libInfo.find(pred); - if (i != _libInfo.end()) { - // Walk all the successors. - TF_FOR_ALL(j, i->second.successors) { - // Push those that haven't yet been visited on the stack. - if (seenPreds.insert(pred).second) - predStack.push_back(pred); - } + // Take the lock, then collect all the modules that aren't yet loaded into a + // vector. Then release the lock and call _LoadLibModules() to do the work. + TfSpinRWMutex::ScopedLock lock(_mutex); + vector<_LibAndInfo const *> toLoad; + for (auto iter = _libInfo.begin(), end = _libInfo.end(); + iter != end; ++iter) { + if (!iter->second.isLoaded) { + toLoad.push_back(std::addressof(*iter)); + } + else { + TF_DEBUG(TF_SCRIPT_MODULE_LOADER) + .Msg("SML: Skipping already-loaded %s\n", + iter->first.GetText()); } } - return false; -} + lock.Release(); -static bool _DidPyErrorOccur() -{ - TfPyLock pyLock; - return PyErr_Occurred(); + _LoadLibModules(toLoad); + + TF_DEBUG(TF_SCRIPT_MODULE_LOADER).Msg("SML: End loading all modules\n"); } void -TfScriptModuleLoader::_LoadUpTo(TfToken const &name) +TfScriptModuleLoader +::_LoadLibModules(vector<_LibAndInfo const *> const &toLoad) const { - static size_t indent = 0; - string indentString; - char const *indentTxt = 0; - - if (TfDebug::IsEnabled(TF_SCRIPT_MODULE_LOADER)) { - indentString = std::string(indent * 2, ' '); - indentTxt = indentString.c_str(); - } - - // Don't do anything if the name isn't empty and it's not a name we know - // about. - if (!name.IsEmpty() && !_libInfo.count(name)) { - TF_DEBUG(TF_SCRIPT_MODULE_LOADER) - .Msg("%s*** Not loading modules for unknown lib '%s'\n", - indentTxt, name.GetText()); + if (toLoad.empty()) { return; } + + TfPyLock pyLock; + + for (_LibAndInfo const *libAndInfo: toLoad) { + auto const &[lib, info] = *libAndInfo; - // Otherwise load modules in topological dependency order until we - // encounter the requested module. - vector order; - if (name.IsEmpty()) { - _TopologicalSort(&order); - } else { - _GetOrderedDependencies(vector(1, name), &order); - } - - TF_DEBUG(TF_SCRIPT_MODULE_LOADER) - .Msg("%s_LoadUpTo('%s') {\n", indentTxt, name.GetText()); - TF_FOR_ALL(lib, order) { - // If we encounter the library we're loading on behalf of, quit. - // Mostly this is the last library in the order, but it may not be. - if (*lib == name) - break; - - if (_libsToModules.count(*lib) && !_loadedSet.count(*lib)) { + if (info.moduleName.IsEmpty()) { TF_DEBUG(TF_SCRIPT_MODULE_LOADER) - .Msg("%s Load('%s');\n", indentTxt, lib->GetText()); - _loadedSet.insert(*lib); - ++indent; - Tf_PyLoadScriptModule(_libsToModules[*lib]); - --indent; + .Msg("SML: Not loading unknown module for lib %s\n", + lib.GetText()); + continue; } + if (info.isLoaded) { + TF_DEBUG(TF_SCRIPT_MODULE_LOADER) + .Msg("SML: Lib %s's module '%s' is already loaded\n", + lib.GetText(), info.moduleName.GetText()); + continue; + } + + TF_DEBUG(TF_SCRIPT_MODULE_LOADER) + .Msg("SML: Loading lib %s's module '%s'\n", + lib.GetText(), info.moduleName.GetText()); - if (_DidPyErrorOccur()) { - TF_DEBUG(TF_SCRIPT_MODULE_LOADER).Msg("%s *error*\n", indentTxt); - break; + // Try to load the module. + if (!PyImport_ImportModule(info.moduleName.GetText())) { + // If an error occurred, warn about it with the python traceback, + // and continue. + TF_DEBUG(TF_SCRIPT_MODULE_LOADER) + .Msg("SML: Error loading lib %s's module '%s'\n", + lib.GetText(), info.moduleName.GetText()); + TfPyExceptionState exc = TfPyExceptionState::Fetch(); + string traceback = exc.GetExceptionString(); + TF_WARN("Error loading lib %s's module '%s':\n%s", + lib.GetText(), info.moduleName.GetText(), + traceback.c_str()); } + + // Mark the module loaded, even if there was an error. Otherwise we'll + // keep trying to load it and keep generating the same error. + info.isLoaded = true; } - - TF_DEBUG(TF_SCRIPT_MODULE_LOADER).Msg("%s}\n", indentTxt); } -void -TfScriptModuleLoader::_LoadModulesFor(TfToken const &inName) +TfScriptModuleLoader::_LibInfo const * +TfScriptModuleLoader::_FindInfo(TfToken const &lib) const { - // Don't load anything if python isn't initialized. - if (!TfPyIsInitialized()) - return; - if (_DidPyErrorOccur()) - return; - - ////////////////////////////////////////////////////////////////////////// - // This function handles requests to load modules in topological dependency - // order up to \a inName. Doing so may cause reentrant calls to this - // function. Handling reentrancy works as follows. There are two cases to - // consider. - // - // ----------------------------------------------------------------------- - // Case 1: The reentrant request is for a module that depends (transitively) - // on the module we're currently loading (or is a request to load all - // modules). - // - // In this case, we defer until after the current request is completed. - // We do this because the dependent library may attempt to load the - // library we're currently loading, which would fail. - // - // ------------------------------------------------------------------------ - // Case 2: The reentrant request is for a module that does not depend on the - // module we're currently loading. - // - // In this case, we immediately load the module and its dependencies. - // This is a dynamically discovered dependency of the module we're - // currently loading. - // - // We achieve this by keeping a queue of requests. We always push the - // request on the back of the queue. If we're the outermost call (i.e. not - // reentrant) we loop, processing the queue from the front to the back. For - // a reentrant call, in case 1 (above), we return immediately, deferring the - // work. In case 2 (above) we process the element on the back of the queue - // immediately and pop it. - // - - // Add this request to the remaining work to do. - _remainingLoadWork.push_back(inName); - - // Kick the registry function so any loaded libraries with script bindings - // register themselves with the script module loading system. - TfRegistryManager::GetInstance().SubscribeTo(); - - // If this is the outermost caller initiating loading, start processing the - // queue. - if (_remainingLoadWork.size() == 1) { - while (!_remainingLoadWork.empty() && !_DidPyErrorOccur()) { - // Note: we copy the front of the deque here, since _LoadUpTo may - // add items into the deque. _LoadUpTo currently doesn't access the - // reference-to-token it's passed after it might have modified the - // deque, but this is good defensive coding in case it's changed in - // the future to do so. - TfToken name = _remainingLoadWork.front(); - _LoadUpTo(name); - // We must pop the queue *after* processing, since reentrant calls - // need to see \a name on the front of the queue. See the access of - // _remainingLoadWork.front() below. - _remainingLoadWork.pop_front(); - } - - // Otherwise, this is a reentrant load request. If the reentrant - // request is not to load everything (empty token) and it's also not a - // (transitive) dependency of the library we're currently working on, - // then load it immediately. - } else if (!_remainingLoadWork.back().IsEmpty() && - !_HasTransitiveSuccessor(_remainingLoadWork.front(), - _remainingLoadWork.back())) { - TfToken name = _remainingLoadWork.back(); - _remainingLoadWork.pop_back(); - _LoadUpTo(name); - } + auto iter = _libInfo.find(lib); + return iter != _libInfo.end() ? &iter->second : nullptr; } void -TfScriptModuleLoader:: -_AddSuccessor(TfToken const &lib, TfToken const &successor) +TfScriptModuleLoader::LoadModulesForLibrary(TfToken const &lib) { - if (ARCH_UNLIKELY(lib == successor)) { - // CODE_COVERAGE_OFF Can only happen if there's a bug. - TF_FATAL_ERROR("Library '%s' cannot depend on itself.", lib.GetText()); + // Do nothing if Python is not running. + if (!TfPyIsInitialized()) { return; - // CODE_COVERAGE_ON } - // Add dependent as a dependent of lib. - vector *successors = &(_libInfo[lib].successors); - successors->insert(std::lower_bound(successors->begin(), - successors->end(), successor), - successor); -} - -void -TfScriptModuleLoader -::_GetOrderedDependenciesRecursive(TfToken const &lib, - TfToken::HashSet *seenLibs, - vector *result) const -{ - // If we've not yet visited this library, then visit its predecessors, and - // finally add it to the order. - if (seenLibs->insert(lib).second) { - TF_FOR_ALL(i, _libInfo.find(lib)->second.predecessors) - _GetOrderedDependenciesRecursive(*i, seenLibs, result); - - result->push_back(lib); + // Special-case calling LoadModulesForLibrary with empty token means all. + if (lib.IsEmpty()) { + TF_DEBUG(TF_SCRIPT_MODULE_LOADER).Msg( + "SML: Request to load modules for empty lib name -> load all\n"); + return LoadModules(); } -} -void -TfScriptModuleLoader:: -_GetOrderedDependencies(vector const &input, - vector *result) const -{ - TfToken::HashSet seenLibs; - TF_FOR_ALL(i, input) { - // If we haven't seen the current input yet, add its predecessors (and - // their dependencies) to the result. - if (seenLibs.insert(*i).second) { - TF_FOR_ALL(j, _libInfo.find(*i)->second.predecessors) - _GetOrderedDependenciesRecursive(*j, &seenLibs, result); + // Subscribe to the registry function so any loaded libraries with script + // bindings publish to this singleton. + TfRegistryManager::GetInstance().SubscribeTo(); + + // We only load direct dependencies, since when we run the initializer for + // the python bindings lib, it will call back into here to load _its_ + // dependencies, and we get the transitive loading that way. + + TF_DEBUG(TF_SCRIPT_MODULE_LOADER).Msg( + "SML: Begin loading %s's predecessors\n", lib.GetText()); + + // Take the lock, then collect all the modules that this lib directly + // depends on that aren't already loaded, add them to `toLoad`, then release + // the lock and load all the modules. + TfSpinRWMutex::ScopedLock lock(_mutex); + vector<_LibAndInfo const *> toLoad; + if (_LibInfo const *libInfo = _FindInfo(lib)) { + for (TfToken const &pred: libInfo->predecessors) { + auto iter = _libInfo.find(pred); + if (iter != _libInfo.end() && !iter->second.isLoaded) { + toLoad.push_back(std::addressof(*iter)); + } } } -} - - -void -TfScriptModuleLoader:: -_TopologicalSort(vector *result) const -{ - // Find all libs with no successors, then produce all ordered dependencies - // from them. - vector leaves; - TF_FOR_ALL(i, _libInfo) { - if (i->second.successors.empty()) - leaves.push_back(i->first); - } - - // Sort to ensure determinism. - std::sort(leaves.begin(), leaves.end()); - - // Find all the leaves' dependencies. - _GetOrderedDependencies(leaves, result); + lock.Release(); + + _LoadLibModules(toLoad); - // Add the leaves themselves, at the end. - result->insert(result->end(), leaves.begin(), leaves.end()); + TF_DEBUG(TF_SCRIPT_MODULE_LOADER).Msg( + "SML: End loading %s's predecessors\n", lib.GetText()); } PXR_NAMESPACE_CLOSE_SCOPE diff --git a/pxr/base/tf/scriptModuleLoader.h b/pxr/base/tf/scriptModuleLoader.h index d8d48e8eaa..2779c2b16e 100644 --- a/pxr/base/tf/scriptModuleLoader.h +++ b/pxr/base/tf/scriptModuleLoader.h @@ -12,6 +12,7 @@ #include "pxr/base/tf/api.h" #include "pxr/base/tf/hash.h" #include "pxr/base/tf/singleton.h" +#include "pxr/base/tf/spinRWMutex.h" #include "pxr/base/tf/token.h" #include "pxr/base/tf/weakBase.h" @@ -21,9 +22,8 @@ #include "pxr/external/boost/python/dict.hpp" #include -#include "pxr/base/tf/hashmap.h" -#include "pxr/base/tf/hashset.h" #include +#include #include PXR_NAMESPACE_OPEN_SCOPE @@ -67,61 +67,46 @@ class TfScriptModuleLoader : public TfWeakBase { /// RegisterLibrary that depend on library \a name. TF_API void LoadModulesForLibrary(TfToken const &name); - - /// Return a list of all currently known modules in a valid dependency - /// order. - TF_API - std::vector GetModuleNames() const; - + /// Return a python dict containing all currently known modules under /// their canonical names. TF_API pxr_boost::python::dict GetModulesDict() const; - /// Write a graphviz dot-file for the dependency graph of all. currently - /// known libraries/modules to \a file. + /// Write a graphviz dot-file for the dependency graph of all currently + /// registered libraries/modules to \a file. TF_API void WriteDotFile(std::string const &file) const; private: + friend class TfSingleton; struct _LibInfo { - _LibInfo() {} - std::vector predecessors, successors; + _LibInfo() = default; + _LibInfo(TfToken const &moduleName, + std::vector &&predecessors) + : moduleName(moduleName) + , predecessors(predecessors) { } + + TfToken moduleName; + std::vector predecessors; + mutable std::atomic isLoaded = false; }; - typedef TfHashMap - _TokenToInfoMap; + using _LibInfoMap = + std::unordered_map; + + using _LibAndInfo = _LibInfoMap::value_type; - typedef TfHashMap - _TokenToTokenMap; - - typedef TfHashSet - _TokenSet; - TfScriptModuleLoader(); virtual ~TfScriptModuleLoader(); - friend class TfSingleton; + + _LibInfo const *_FindInfo(TfToken const &lib) const; + + void _LoadLibModules(std::vector<_LibAndInfo const *> const &toLoad) const; - void _AddSuccessor(TfToken const &lib, TfToken const &successor); - void _LoadModulesFor(TfToken const &name); - void _LoadUpTo(TfToken const &name); - void _GetOrderedDependenciesRecursive(TfToken const &lib, - TfToken::HashSet *seenLibs, - std::vector *result) const; - void _GetOrderedDependencies(std::vector const &input, - std::vector *result) const; - void _TopologicalSort(std::vector *result) const; - - bool _HasTransitiveSuccessor(TfToken const &predecessor, - TfToken const &successor) const; - - _TokenToInfoMap _libInfo; - _TokenToTokenMap _libsToModules; - _TokenSet _loadedSet; - - // This is only used to handle reentrant loading requests. - std::deque _remainingLoadWork; + _LibInfoMap _libInfo; + mutable TfSpinRWMutex _mutex; }; TF_API_TEMPLATE_CLASS(TfSingleton); diff --git a/pxr/base/tf/testenv/baseline/testTfScriptModuleLoader/scriptModuleLoader.out b/pxr/base/tf/testenv/baseline/testTfScriptModuleLoader/scriptModuleLoader.out index d68d118571..c517705788 100644 --- a/pxr/base/tf/testenv/baseline/testTfScriptModuleLoader/scriptModuleLoader.out +++ b/pxr/base/tf/testenv/baseline/testTfScriptModuleLoader/scriptModuleLoader.out @@ -1,45 +1,49 @@ # Test case: loading one library generates a request to load all # libraries, one of which attemps to import the library we're # currently loading. -Registering library LoadsAll with predecessors: -Registering library DepLoadsAll with predecessors: LoadsAll, -Registering library Other with predecessors: LoadsAll, +SML: Registering lib LoadsAll with no predecessors +SML: Registering lib DepLoadsAll with predecessors LoadsAll +SML: Registering lib Other with predecessors LoadsAll # This should attempt to (forwardly) load Other, which in turn tries # to import LoadsAll, which would fail, but we defer loading Other # until after LoadsAll is finished loading. -_LoadUpTo('DepLoadsAll') { - Load('LoadsAll'); - _LoadUpTo('LoadsAll') { - } -} -_LoadUpTo('') { - Load('DepLoadsAll'); - _LoadUpTo('DepLoadsAll') { - } - Load('Other'); - _LoadUpTo('Other') { - } -} +SML: Begin loading DepLoadsAll's predecessors +SML: Loading lib LoadsAll's module 'pxr.Tf.testenv.testTfScriptModuleLoader_LoadsAll' +SML: Begin loading LoadsAll's predecessors +SML: End loading LoadsAll's predecessors +SML: Request to load modules for empty lib name -> load all +SML: Begin loading all modules +SML: Skipping already-loaded tf +SML: Loading lib Other's module 'pxr.Tf.testenv.testTfScriptModuleLoader_Other' +SML: Begin loading Other's predecessors +SML: Loading lib LoadsAll's module 'pxr.Tf.testenv.testTfScriptModuleLoader_LoadsAll' +SML: End loading Other's predecessors +SML: Loading lib DepLoadsAll's module 'pxr.Tf.testenv.testTfScriptModuleLoader_DepLoadsAll' +SML: Begin loading DepLoadsAll's predecessors +SML: End loading DepLoadsAll's predecessors +SML: Lib LoadsAll's module 'pxr.Tf.testenv.testTfScriptModuleLoader_LoadsAll' is already loaded +SML: End loading all modules +SML: End loading DepLoadsAll's predecessors # Registering a library that is totally independent, and raises an # error when loaded, but whose name comes first in dependency order. # Since there is no real dependency, the SML should not try to load # this module, which would cause an exception. -Registering library AAA_RaisesError with predecessors: +SML: Registering lib AAA_RaisesError with no predecessors # Test case: loading one library dynamically imports a new, # previously unknown dependent library, which registers further # dependencies, and expects them to load. -Registering library LoadsUnknown with predecessors: -Registering library Test with predecessors: LoadsUnknown, +SML: Registering lib LoadsUnknown with no predecessors +SML: Registering lib Test with predecessors LoadsUnknown # This should load LoadsUnknown, which loads Unknown dynamically, # which should request for Unknown's dependencies (NewDependency) to # load, which should work. -_LoadUpTo('Test') { - Load('LoadsUnknown'); - _LoadUpTo('LoadsUnknown') { - } -Registering library Unknown with predecessors: NewDynamicDependency, -Registering library NewDynamicDependency with predecessors: - _LoadUpTo('Unknown') { - Load('NewDynamicDependency'); - } -} +SML: Begin loading Test's predecessors +SML: Loading lib LoadsUnknown's module 'pxr.Tf.testenv.testTfScriptModuleLoader_LoadsUnknown' +SML: Begin loading LoadsUnknown's predecessors +SML: End loading LoadsUnknown's predecessors +SML: Registering lib Unknown with predecessors NewDynamicDependency +SML: Registering lib NewDynamicDependency with no predecessors +SML: Begin loading Unknown's predecessors +SML: Loading lib NewDynamicDependency's module 'sys' +SML: End loading Unknown's predecessors +SML: End loading Test's predecessors diff --git a/pxr/base/tf/wrapScriptModuleLoader.cpp b/pxr/base/tf/wrapScriptModuleLoader.cpp index f35a54a045..1099f097ee 100644 --- a/pxr/base/tf/wrapScriptModuleLoader.cpp +++ b/pxr/base/tf/wrapScriptModuleLoader.cpp @@ -24,8 +24,6 @@ void wrapScriptModuleLoader() { class_, noncopyable>("ScriptModuleLoader", no_init) .def(TfPySingleton()) - .def("GetModuleNames", &This::GetModuleNames, - return_value_policy()) .def("GetModulesDict", &This::GetModulesDict) .def("WriteDotFile", &This::WriteDotFile) From 804e8b9c0590ba377abdf81a33db45279d0ffe11 Mon Sep 17 00:00:00 2001 From: tallytalwar Date: Thu, 24 Oct 2024 13:14:43 -0700 Subject: [PATCH 61/82] Correct UsdUI schema.usda file description (Internal change: 2345606) --- pxr/usd/usdUI/schema.usda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pxr/usd/usdUI/schema.usda b/pxr/usd/usdUI/schema.usda index 88d022c67f..c8b9571883 100644 --- a/pxr/usd/usdUI/schema.usda +++ b/pxr/usd/usdUI/schema.usda @@ -1,6 +1,6 @@ #usda 1.0 ( - "This file describes the USD Shader schemata for code generation." + "This file describes the USD User Interface schemata for code generation." subLayers = [ @usd/schema.usda@ ] From 89407621c2244754d47e2e75fe746ef252ffe0b8 Mon Sep 17 00:00:00 2001 From: klucknav Date: Thu, 24 Oct 2024 13:14:56 -0700 Subject: [PATCH 62/82] Remove 'glass' references in Preview Surface Spec This change removes the glass references made in OpacityThreshold paragraph since we have now specified that fully transparent materials essentially disappear. (Internal change: 2345615) --- docs/spec_usdpreviewsurface.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/spec_usdpreviewsurface.rst b/docs/spec_usdpreviewsurface.rst index 6b0ff67717..f3f5204cba 100644 --- a/docs/spec_usdpreviewsurface.rst +++ b/docs/spec_usdpreviewsurface.rst @@ -178,8 +178,8 @@ and :usda:`opacity`. interpreted; this "translucent or masked" behavior is common in engines and renderers, and makes the UsdPreviewSurface easier to interchange. It does imply, however, that it is not possible to faithfully recreate a - glassy/translucent material that also provides an opacity-based mask... so no - single-polygon glass leaves. + translucent material that also provides an opacity-based mask... so no + single-polygon translucent leaves. .. _updateior: From a337d3834390c023b589d326130337eb2657ef02 Mon Sep 17 00:00:00 2001 From: tallytalwar Date: Fri, 25 Oct 2024 09:00:55 -0700 Subject: [PATCH 63/82] Fix issues where type alias of usdSchema were not getting queried correctly. (Internal change: 2345733) --- pxr/usd/usd/validationContext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pxr/usd/usd/validationContext.cpp b/pxr/usd/usd/validationContext.cpp index b515b6a419..0f7aba863a 100644 --- a/pxr/usd/usd/validationContext.cpp +++ b/pxr/usd/usd/validationContext.cpp @@ -67,7 +67,7 @@ _CollectAncestorTypeValidators( // This is done before filtering the validators by schema types, so that // validators for all ancestor types are collected. for (const TfToken &schemaType : schemaTypeNames) { - const TfType type = TfType::FindByName(schemaType.GetString()); + const TfType type = UsdSchemaRegistry::GetTypeFromName(schemaType); std::vector ancestorTypes; type.GetAllAncestorTypes(&ancestorTypes); for (const TfType &ancestorType : ancestorTypes) { From cc3941f75e619b0d797436ce8b2a21b330a292e5 Mon Sep 17 00:00:00 2001 From: diyajoy Date: Fri, 25 Oct 2024 11:13:03 -0700 Subject: [PATCH 64/82] Make all SdfListOp setter methods enforce uniqueness by removing duplicates in explicit setter methods. Deprecate ModifyOperations(callback, removeDuplicates) as removeDuplicates is now assumed true. (Internal change: 2345750) --- pxr/usd/sdf/listOp.cpp | 137 ++++++++++++------ pxr/usd/sdf/listOp.h | 101 +++++++++---- pxr/usd/sdf/listOpListEditor.h | 2 +- pxr/usd/sdf/testenv/testSdfAttribute.py | 5 +- pxr/usd/sdf/testenv/testSdfListOp.py | 34 ++++- pxr/usd/sdf/vectorListEditor.h | 2 +- .../usdUtils/assetLocalizationDelegate.cpp | 4 +- 7 files changed, 203 insertions(+), 82 deletions(-) diff --git a/pxr/usd/sdf/listOp.cpp b/pxr/usd/sdf/listOp.cpp index 8a31c5adb4..1bb19a0838 100644 --- a/pxr/usd/sdf/listOp.cpp +++ b/pxr/usd/sdf/listOp.cpp @@ -160,12 +160,35 @@ SdfListOp::GetAppliedItems() const return result; } +template +std::vector _MakeUnique(const std::vector items, bool reverse=false) +{ + TfDenseHashSet existingSet; + std::vector uniqueItems; + + if (reverse) { + for (auto it = items.rbegin(); it != items.rend(); it++) { + if (existingSet.insert(*it).second) { + uniqueItems.push_back(*it); + } + } + std::reverse(uniqueItems.begin(), uniqueItems.end()); + } else { + for (auto it = items.cbegin(); it != items.cend(); it++) { + if (existingSet.insert(*it).second) { + uniqueItems.push_back(*it); + } + } + } + return uniqueItems; +} + template void SdfListOp::SetExplicitItems(const ItemVector &items) { _SetExplicit(true); - _explicitItems = items; + _explicitItems = _MakeUnique(items); } template @@ -181,7 +204,7 @@ void SdfListOp::SetPrependedItems(const ItemVector &items) { _SetExplicit(false); - _prependedItems = items; + _prependedItems = _MakeUnique(items); } template @@ -189,7 +212,7 @@ void SdfListOp::SetAppendedItems(const ItemVector &items) { _SetExplicit(false); - _appendedItems = items; + _appendedItems = _MakeUnique(items, true); } template @@ -197,7 +220,7 @@ void SdfListOp::SetDeletedItems(const ItemVector &items) { _SetExplicit(false); - _deletedItems = items; + _deletedItems = _MakeUnique(items); } template @@ -312,11 +335,11 @@ SdfListOp::ApplyOperations(ItemVector* vec, const ApplyCallback& cb) const search[*i] = i; } - _DeleteKeys (SdfListOpTypeDeleted, cb, &result, &search); + _DeleteKeys (cb, &result, &search); _AddKeys(SdfListOpTypeAdded, cb, &result, &search); - _PrependKeys(SdfListOpTypePrepended, cb, &result, &search); - _AppendKeys(SdfListOpTypeAppended, cb, &result, &search); - _ReorderKeys(SdfListOpTypeOrdered, cb, &result, &search); + _PrependKeys(cb, &result, &search); + _AppendKeys(cb, &result, &search); + _ReorderKeys(cb, &result, &search); } // Copy the result back to vec. @@ -463,15 +486,14 @@ SdfListOp::_AddKeys( template void SdfListOp::_PrependKeys( - SdfListOpType op, const ApplyCallback& callback, _ApplyList* result, _ApplyMap* search) const { - const ItemVector& items = GetItems(op); + const ItemVector& items = GetItems(SdfListOpTypePrepended); if (callback) { for (auto i = items.rbegin(), iEnd = items.rend(); i != iEnd; ++i) { - if (std::optional mappedItem = callback(op, *i)) { + if (std::optional mappedItem = callback(SdfListOpTypePrepended, *i)) { _InsertOrMove(*mappedItem, result->begin(), result, search); } } @@ -485,15 +507,14 @@ SdfListOp::_PrependKeys( template void SdfListOp::_AppendKeys( - SdfListOpType op, const ApplyCallback& callback, _ApplyList* result, _ApplyMap* search) const { - const ItemVector& items = GetItems(op); + const ItemVector& items = GetItems(SdfListOpTypeAppended); if (callback) { for (const T& item: items) { - if (std::optional mappedItem = callback(op, item)) { + if (std::optional mappedItem = callback(SdfListOpTypeAppended, item)) { _InsertOrMove(*mappedItem, result->end(), result, search); } } @@ -507,14 +528,13 @@ SdfListOp::_AppendKeys( template void SdfListOp::_DeleteKeys( - SdfListOpType op, const ApplyCallback& callback, _ApplyList* result, _ApplyMap* search) const { - TF_FOR_ALL(i, GetItems(op)) { + TF_FOR_ALL(i, GetItems(SdfListOpTypeDeleted)) { if (callback) { - if (std::optional item = callback(op, *i)) { + if (std::optional item = callback(SdfListOpTypeDeleted, *i)) { _RemoveIfPresent(*item, result, search); } } @@ -527,29 +547,36 @@ SdfListOp::_DeleteKeys( template void SdfListOp::_ReorderKeys( - SdfListOpType op, const ApplyCallback& callback, _ApplyList* result, _ApplyMap* search) const { + _ReorderKeysHelper(GetItems(SdfListOpTypeOrdered), callback, result, search); +} + +template +void +SdfListOp::_ReorderKeysHelper(ItemVector order, const ApplyCallback& callback, + _ApplyList* result, _ApplyMap* search) { + // Make a vector and set of the source items. - ItemVector order; + ItemVector uniqueOrder; std::set orderSet; - TF_FOR_ALL(i, GetItems(op)) { + TF_FOR_ALL(i, order) { if (callback) { - if (std::optional item = callback(op, *i)) { + if (std::optional item = callback(SdfListOpTypeOrdered, *i)) { if (orderSet.insert(*item).second) { - order.push_back(*item); + uniqueOrder.push_back(*item); } } } else { if (orderSet.insert(*i).second) { - order.push_back(*i); + uniqueOrder.push_back(*i); } } } - if (order.empty()) { + if (uniqueOrder.empty()) { return; } @@ -559,9 +586,9 @@ SdfListOp::_ReorderKeys( // Find each item from the order vector in the scratch list. // Then find the next item in the scratch list that's also in - // in the order vector. All of these items except the last + // in the uniqueOrder vector. All of these items except the last // form the next continuous sequence in the result. - TF_FOR_ALL(i, order) { + TF_FOR_ALL(i, uniqueOrder) { typename _ApplyMap::const_iterator j = search->find(*i); if (j != search->end()) { // Find the next item in both scratch and order. @@ -585,16 +612,17 @@ template static inline bool _ModifyCallbackHelper(const typename SdfListOp::ModifyCallback& cb, - std::vector* itemVector, bool removeDuplicates) + std::vector* itemVector) { bool didModify = false; std::vector modifiedVector; + modifiedVector.reserve(itemVector->size()); TfDenseHashSet existingSet; for (const T& item : *itemVector) { std::optional modifiedItem = cb(item); - if (removeDuplicates && modifiedItem) { + if (modifiedItem) { if (!existingSet.insert(*modifiedItem).second) { modifiedItem = std::nullopt; } @@ -620,29 +648,36 @@ _ModifyCallbackHelper(const typename SdfListOp::ModifyCallback& cb, template bool -SdfListOp::ModifyOperations(const ModifyCallback& callback, - bool removeDuplicates) +SdfListOp::ModifyOperations(const ModifyCallback& callback) { bool didModify = false; if (callback) { didModify |= _ModifyCallbackHelper( - callback, &_explicitItems, removeDuplicates); + callback, &_explicitItems); didModify |= _ModifyCallbackHelper( - callback, &_addedItems, removeDuplicates); + callback, &_addedItems); didModify |= _ModifyCallbackHelper( - callback, &_prependedItems, removeDuplicates); + callback, &_prependedItems); didModify |= _ModifyCallbackHelper( - callback, &_appendedItems, removeDuplicates); + callback, &_appendedItems); didModify |= _ModifyCallbackHelper( - callback, &_deletedItems, removeDuplicates); + callback, &_deletedItems); didModify |= _ModifyCallbackHelper( - callback, &_orderedItems, removeDuplicates); + callback, &_orderedItems); } return didModify; } +template +bool +SdfListOp::ModifyOperations(const ModifyCallback& callback, + bool unusedRemoveDuplicates) +{ + return ModifyOperations(callback); +} + template bool SdfListOp::ReplaceOperations(const SdfListOpType op, size_t index, size_t n, @@ -713,7 +748,7 @@ SdfListOp::ComposeOperations(const SdfListOp& stronger, SdfListOpType op) if (op == SdfListOpTypeOrdered) { stronger._AddKeys(op, ApplyCallback(), &weakerList, &weakerSearch); - stronger._ReorderKeys(op, ApplyCallback(), + stronger._ReorderKeys(ApplyCallback(), &weakerList, &weakerSearch); } else if (op == SdfListOpTypeAdded) { stronger._AddKeys(op, @@ -726,13 +761,11 @@ SdfListOp::ComposeOperations(const SdfListOp& stronger, SdfListOpType op) &weakerList, &weakerSearch); } else if (op == SdfListOpTypePrepended) { - stronger._PrependKeys(op, - ApplyCallback(), + stronger._PrependKeys(ApplyCallback(), &weakerList, &weakerSearch); } else if (op == SdfListOpTypeAppended) { - stronger._AppendKeys(op, - ApplyCallback(), + stronger._AppendKeys(ApplyCallback(), &weakerList, &weakerSearch); } @@ -749,10 +782,24 @@ void SdfApplyListOrdering(std::vector* v, const std::vector& order) { if (!order.empty() && !v->empty()) { - // XXX: This is lame, but just for now... - SdfListOp tmp; - tmp.SetOrderedItems(order); - tmp.ApplyOperations(v); + // Make a list of the inputs. We can efficiently (O(1)) splice + // these elements later. + typename SdfListOp::_ApplyList result; + result.insert(result.end(), v->begin(), v->end()); + + // Make a map of keys to list iterators. This avoids O(n) + // searches within O(n) loops below. + typename SdfListOp::_ApplyMap search; + typename SdfListOp::_ApplyList::iterator i = result.begin(); + for (; + i != result.end(); ++i) { + search[*i] = i; + } + SdfListOp::_ReorderKeysHelper(order, nullptr, &result, &search); + + // Copy the result back to vec. + v->clear(); + v->insert(v->end(), result.begin(), result.end()); } } diff --git a/pxr/usd/sdf/listOp.h b/pxr/usd/sdf/listOp.h index 19b24e087c..e930674a78 100644 --- a/pxr/usd/sdf/listOp.h +++ b/pxr/usd/sdf/listOp.h @@ -48,11 +48,23 @@ struct Sdf_ListOpTraits /// \class SdfListOp /// -/// Value type representing a list-edit operation. -/// /// SdfListOp is a value type representing an operation that edits a list. -/// It may add or remove items, reorder them, or replace the list entirely. +/// It may append or prepend items, delete them, or replace the list entirely. +/// +/// SdfListOp maintains lists of items to be prepended, appended, deleted, or +/// used explicitly. If used in explicit mode, the ApplyOperations method replaces the given list +/// with the set explicit items. Otherwise, the ApplyOperations +/// method is used to apply the list-editing options in the input list in the +/// following order: +/// - Delete +/// - Prepend +/// - Append /// +/// Lists are meant to contain unique values, and all list operations +/// will remove duplicates if encountered. Prepending items and using +/// explicit mode will preserve the position of the first of the duplicates +/// to be encountered, while appending items will preserve the last. + template class SdfListOp { public: @@ -111,12 +123,6 @@ class SdfListOp { return _explicitItems; } - /// Returns the explicit items. - const ItemVector& GetAddedItems() const - { - return _addedItems; - } - /// Returns the explicit items. const ItemVector& GetPrependedItems() const { @@ -135,12 +141,6 @@ class SdfListOp { return _deletedItems; } - /// Returns the ordered items. - const ItemVector& GetOrderedItems() const - { - return _orderedItems; - } - /// Return the item vector identified by \p type. SDF_API const ItemVector& GetItems(SdfListOpType type) const; @@ -152,14 +152,24 @@ class SdfListOp { /// This is equivalent to calling ApplyOperations on an empty item vector. SDF_API ItemVector GetAppliedItems() const; + /// Sets the explicit items. If duplicates are present in \p items, + /// preserves the first occurence. SDF_API void SetExplicitItems(const ItemVector &items); - SDF_API void SetAddedItems(const ItemVector &items); + + /// Sets the prepended items. If duplicates are present in \p items, + /// preserves the first occurence. SDF_API void SetPrependedItems(const ItemVector &items); + + /// Sets the appended items. If duplicates are present in \p items, + /// preserves the last occurence. SDF_API void SetAppendedItems(const ItemVector &items); + + /// Sets the deleted items. If duplicates are present in \p items, + /// preserves the first occurence. SDF_API void SetDeletedItems(const ItemVector &items); - SDF_API void SetOrderedItems(const ItemVector &items); /// Sets the item vector for the given operation \p type. + /// Removes duplicates in \p items if present. SDF_API void SetItems(const ItemVector &items, SdfListOpType type); /// Removes all items and changes the list to be non-explicit. @@ -206,14 +216,19 @@ class SdfListOp { /// returned key is empty then the key is removed, otherwise it's replaced /// with the returned key. /// - /// If \p removeDuplicates is \c true and \p callback returns a key that was - /// previously returned for the current operation vector being processed, - /// the returned key will be removed. + /// If \p callback returns a key that was previously returned for the + /// current operation vector being processed, the returned key will be + /// removed. /// /// Returns true if a change was made, false otherwise. SDF_API + bool ModifyOperations(const ModifyCallback& callback); + + /// \deprecated Please use ModifyOperations(const ModifyCallback& callback) + /// instead. + SDF_API bool ModifyOperations(const ModifyCallback& callback, - bool removeDuplicates = false); + bool unusedRemoveDuplicates); /// Replaces the items in the specified operation vector in the range /// (index, index + n] with the given \p newItems. If \p newItems is empty @@ -227,6 +242,27 @@ class SdfListOp { SDF_API void ComposeOperations(const SdfListOp& stronger, SdfListOpType op); + /// \deprecated The add and reorder operations have been deprecated in favor + /// of the append and prepend operations. + const ItemVector& GetAddedItems() const + { + return _addedItems; + } + + /// \deprecated The add and reorder operations have been deprecated in favor + /// of the append and prepend operations. + const ItemVector& GetOrderedItems() const + { + return _orderedItems; + } + /// \deprecated The add and reorder operations have been deprecated in favor + /// of the append and prepend operations. + SDF_API void SetAddedItems(const ItemVector &items); + + /// \deprecated The add and reorder operations have been deprecated in favor + /// of the append and prepend operations. + SDF_API void SetOrderedItems(const ItemVector &items); + friend inline size_t hash_value(const SdfListOp &op) { return TfHash::Combine( op._isExplicit, @@ -261,16 +297,27 @@ class SdfListOp { typedef std::map _ApplyMap; - void _AddKeys(SdfListOpType, const ApplyCallback& cb, - _ApplyList* result, _ApplyMap* search) const; - void _PrependKeys(SdfListOpType, const ApplyCallback& cb, + void _PrependKeys(const ApplyCallback& cb, _ApplyList* result, _ApplyMap* search) const; - void _AppendKeys(SdfListOpType, const ApplyCallback& cb, + void _AppendKeys(const ApplyCallback& cb, _ApplyList* result, _ApplyMap* search) const; - void _DeleteKeys(SdfListOpType, const ApplyCallback& cb, + void _DeleteKeys(const ApplyCallback& cb, _ApplyList* result, _ApplyMap* search) const; - void _ReorderKeys(SdfListOpType, const ApplyCallback& cb, + + /// \deprecated + /// Use _PrependKeys or _AppendKeys instead. + void _AddKeys(SdfListOpType, const ApplyCallback& cb, + _ApplyList* result, _ApplyMap* search) const; + + /// \deprecated + /// Use _PrependKeys or _AppendKeys instead. + void _ReorderKeys(const ApplyCallback& cb, _ApplyList* result, _ApplyMap* search) const; + static void _ReorderKeysHelper(ItemVector order, const ApplyCallback& cb, + _ApplyList *result, _ApplyMap *search); + template + friend void SdfApplyListOrdering(std::vector *v, + const std::vector &order); private: bool _isExplicit; diff --git a/pxr/usd/sdf/listOpListEditor.h b/pxr/usd/sdf/listOpListEditor.h index 3e1a3740b6..8856daf18b 100644 --- a/pxr/usd/sdf/listOpListEditor.h +++ b/pxr/usd/sdf/listOpListEditor.h @@ -238,7 +238,7 @@ Sdf_ListOpListEditor::ModifyItemEdits(const ModifyCallback& cb) modifiedListOp.ModifyOperations( [this, &cb](const value_type &t) { return _ModifyCallbackHelper(cb, _GetTypePolicy(), t); - }, /* removeDuplicates = */ true); + }); _UpdateListOp(modifiedListOp); } diff --git a/pxr/usd/sdf/testenv/testSdfAttribute.py b/pxr/usd/sdf/testenv/testSdfAttribute.py index d6cee7e166..c4cf5888d6 100644 --- a/pxr/usd/sdf/testenv/testSdfAttribute.py +++ b/pxr/usd/sdf/testenv/testSdfAttribute.py @@ -315,12 +315,11 @@ def test_Connections(self): self.assertTrue( testPath_dead not in attr.connectionPathList.explicitItems) - # adding duplicate connection path: error expected + # adding duplicate connection path testPath = attr.connectionPathList.explicitItems[0] self.assertEqual( attr.connectionPathList.explicitItems.count(testPath), 1) - with self.assertRaises(Tf.ErrorException): - attr.connectionPathList.explicitItems.append(testPath) + attr.connectionPathList.explicitItems.append(testPath) self.assertEqual( attr.connectionPathList.explicitItems.count(testPath), 1) diff --git a/pxr/usd/sdf/testenv/testSdfListOp.py b/pxr/usd/sdf/testenv/testSdfListOp.py index 9cec8858ff..5a9a2674fd 100644 --- a/pxr/usd/sdf/testenv/testSdfListOp.py +++ b/pxr/usd/sdf/testenv/testSdfListOp.py @@ -59,8 +59,30 @@ def test_BasicSemantics(self): _ExplicitItems([1,2,3]) .ApplyOperations([0,3]), [1,2,3]) + self.assertEqual( + _ExplicitItems([1,2,1,3]) + .ApplyOperations([]), + [1,2,3]) - # "Add" leaves existing values in place and appends any new values. + # Ensure duplicates are removed when using setter methods. + self.assertEqual( + _ExplicitItems([1,2,1,3]) + .explicitItems, + [1,2,3]) + self.assertEqual( + _DeletedItems([1,2,1,3]) + .deletedItems, + [1,2,3]) + self.assertEqual( + _AppendedItems([1,2,1,3]) + .appendedItems, + [2,1,3]) + self.assertEqual( + _PrependedItems([1,2,1,3]) + .prependedItems, + [1,2,3]) + + # (deprecated)"Add" leaves existing values in place and appends any new values. self.assertEqual( _AddedItems([1,2,3]) .ApplyOperations([]), @@ -102,6 +124,10 @@ def test_BasicSemantics(self): _AppendedItems([1,2,3]) .ApplyOperations([3,4]), [4,1,2,3]) + self.assertEqual( + _AppendedItems([1,2,1,3]) + .ApplyOperations([]), + [2,1,3]) # "Prepend" is similar, but for the front of the list. self.assertEqual( @@ -116,8 +142,12 @@ def test_BasicSemantics(self): _PrependedItems([1,2,3]) .ApplyOperations([0,1]), [1,2,3,0]) + self.assertEqual( + _PrependedItems([1,2,1,3]) + .ApplyOperations([]), + [1,2,3]) - # "Order" is the most subtle. + # (deprecated) "Order" is the most subtle. self.assertEqual( _OrderedItems([1,2,3]) .ApplyOperations([]), diff --git a/pxr/usd/sdf/vectorListEditor.h b/pxr/usd/sdf/vectorListEditor.h index 2403175b00..ee45d63785 100644 --- a/pxr/usd/sdf/vectorListEditor.h +++ b/pxr/usd/sdf/vectorListEditor.h @@ -256,7 +256,7 @@ Sdf_VectorListEditor::ModifyItemEdits(const ModifyCallback& cb) valueListOp.ModifyOperations( [this, &cb](const value_type &t) { return _ModifyCallbackHelper(cb, _GetTypePolicy(), t); - }, /* removeDuplicates = */ true); + }); _UpdateFieldData(valueListOp.GetItems(_op)); } diff --git a/pxr/usd/usdUtils/assetLocalizationDelegate.cpp b/pxr/usd/usdUtils/assetLocalizationDelegate.cpp index 9464b725ec..d993100065 100644 --- a/pxr/usd/usdUtils/assetLocalizationDelegate.cpp +++ b/pxr/usd/usdUtils/assetLocalizationDelegate.cpp @@ -137,9 +137,7 @@ UsdUtils_WritableLocalizationDelegate::_ProcessReferencesOrPayloads( return _ProcessRefOrPayload ( layer, item, &dependencies); - }, - /*removeDuplicates*/ true - ); + }); if (!modified) { return dependencies; From 7bbb6367a72de521aa19a26ba081d347af8a67f2 Mon Sep 17 00:00:00 2001 From: rajabala Date: Fri, 25 Oct 2024 14:45:29 -0700 Subject: [PATCH 65/82] [hd, hdsi] Fix emulation propagation of light linking dirty bits for instancers. - For hydra instancer prims, both instanceCategories and categories data source locators are relevant and map to the legacy DirtyCategories bit. This missing piece of invalidation forwarding resulted in incorrect light linking edits to point instancer prims. (Internal change: 2345763) --- pxr/imaging/hd/dirtyBitsTranslator.cpp | 11 ++++++++++- pxr/imaging/hdsi/lightLinkingSceneIndex.cpp | 20 +++++++++++++------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/pxr/imaging/hd/dirtyBitsTranslator.cpp b/pxr/imaging/hd/dirtyBitsTranslator.cpp index 7be39fe128..fda98cf58b 100644 --- a/pxr/imaging/hd/dirtyBitsTranslator.cpp +++ b/pxr/imaging/hd/dirtyBitsTranslator.cpp @@ -397,7 +397,12 @@ HdDirtyBitsTranslator::InstancerDirtyBitsToLocatorSet(TfToken const& primType, set->append(HdXformSchema::GetDefaultLocator()); } if (bits & HdChangeTracker::DirtyCategories) { + // Note: We don't have a DirtyInstanceCategories bit. + // For point instancers, instance categories is not relevant (i.e. all + // instances are affected), so we invalidate both categories and + // instanceCategories locators. set->append(HdInstanceCategoriesSchema::GetDefaultLocator()); + set->append(HdCategoriesSchema::GetDefaultLocator()); } } @@ -935,8 +940,13 @@ HdDirtyBitsTranslator::InstancerLocatorSetToDirtyBits( HdDataSourceLocatorSet::const_iterator end = set.end(); HdDirtyBits bits = HdChangeTracker::Clean; + if (_FindLocator(HdCategoriesSchema::GetDefaultLocator(), end, &it)) { + // This is relevant for point instancers. + bits |= HdChangeTracker::DirtyCategories; + } if (_FindLocator(HdInstanceCategoriesSchema::GetDefaultLocator(), end, &it)) { // We don't have an instance categories dirty bit. + // This is relevant for native instancers. bits |= HdChangeTracker::DirtyCategories; } if (_FindLocator(HdInstancedBySchema::GetDefaultLocator(), end, &it)) { @@ -972,7 +982,6 @@ HdDirtyBitsTranslator::TaskLocatorSetToDirtyBits( // we only end up making one trip through the set. If you add to this // function, make sure you sort the addition by locator name, or // _FindLocator won't work. - // Also note, this should match InstancerDirtyBitsToLocatorSet if (*it == HdDataSourceLocator::EmptyLocator()) { return HdChangeTracker::AllDirty; diff --git a/pxr/imaging/hdsi/lightLinkingSceneIndex.cpp b/pxr/imaging/hdsi/lightLinkingSceneIndex.cpp index 1853733c20..d28daf8005 100644 --- a/pxr/imaging/hdsi/lightLinkingSceneIndex.cpp +++ b/pxr/imaging/hdsi/lightLinkingSceneIndex.cpp @@ -755,10 +755,11 @@ _BuildDependenciesDataSource( const HdPathArrayDataSourceHandle instancePathsDs = topologySchema.GetInstanceLocations(); - if (!instancePathsDs) { - // XXX Point instancer. Per-instance categories does not make sense for - // point instancers. Should we use categories to reflect that they - // apply to all instances (of all prototypes)? + const bool isPointInstancer = + !instancePathsDs || instancePathsDs->GetTypedValue(0.0).empty(); + + if (isPointInstancer) { + // instanceCategories is not relevant to point instancers. return nullptr; } @@ -781,7 +782,9 @@ _BuildDependenciesDataSource( // on all prims targeted by the collection, including instance prims. // // We publish categories only for geometry prims and not instance - // prims. See HdsiLightLinkingSceneIndex::GetPrim. + // prims. See HdsiLightLinkingSceneIndex::GetPrim. + // Note: categories is relevant for instancer prims corresponding + // to point instancers. // size_t idx = 0; for (const SdfPath &instancePath : instancePaths) { @@ -964,7 +967,7 @@ class _LightDataSource : public HdContainerDataSource : name; // Note: Since this scene index relies on linking collections to - // be transported, use an overlay only when we have a + // be transported, provide an override only when we have a // collections data source on the prim to provide the category // ID for the collections, including an empty token for the // trivial case. @@ -1025,7 +1028,10 @@ class _LightPrimDataSource : public HdContainerDataSource TfTokenVector GetNames() override { - return _inputPrimDs->GetNames(); + // 'light' may be absent. + TfTokenVector names = _inputPrimDs->GetNames(); + _AddIfAbsent(HdLightSchemaTokens->light, &names); + return names; } HdDataSourceBaseHandle Get(const TfToken &name) override From 94d81995c6efb717630b6d3ed09f100c0e702807 Mon Sep 17 00:00:00 2001 From: tallytalwar Date: Fri, 25 Oct 2024 14:45:37 -0700 Subject: [PATCH 66/82] Add Error identifier information to GetErrorAsString. (Internal change: 2345778) --- pxr/usd/usd/validationError.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pxr/usd/usd/validationError.cpp b/pxr/usd/usd/validationError.cpp index 4471f5a304..a448004fc4 100644 --- a/pxr/usd/usd/validationError.cpp +++ b/pxr/usd/usd/validationError.cpp @@ -77,8 +77,17 @@ UsdValidationError::GetIdentifier() const std::string UsdValidationError::GetErrorAsString() const { - return _errorType == UsdValidationErrorType::None ? _errorMsg : TfStringPrintf( - "%s: %s", TfEnum::GetDisplayName(_errorType).c_str(), _errorMsg.c_str()); + if (_validator) { + return _errorType == UsdValidationErrorType::None ? _errorMsg : + TfStringPrintf( + "%s: (%s) %s", TfEnum::GetDisplayName(_errorType).c_str(), + GetIdentifier().GetString().c_str(), _errorMsg.c_str()); + } else { + return _errorType == UsdValidationErrorType::None ? _errorMsg : + TfStringPrintf( + "%s: %s", TfEnum::GetDisplayName(_errorType).c_str(), + _errorMsg.c_str()); + } } void From fef828d6c6aa275294f17e064fe6cd9a45aabcf3 Mon Sep 17 00:00:00 2001 From: klucknav Date: Mon, 28 Oct 2024 15:18:19 -0700 Subject: [PATCH 67/82] Update HdPrman's implementation of PreviewSurface to match the updated spec The preview surface spec was recently updated to state that there is no lighting response for fully transparent materials. This change removes the refractionGain connection between the adapter and pxrSurface nodes that appears to be resulting in that additional lighting response. Previously this connection was only added when in cutout mode. This meant that when opacityThreshold was non-zero OR not authored we would get additional lighting response for fully transparent materials. This change means that HdPrman will match the new spec and fully transparent materials (opacity = 0) will not have any lighting response regardless of if we are in cutout or transparent mode. (Internal change: 2345815) --- .../hdPrman/matfiltConvertPreviewMaterial.cpp | 18 +++--------------- .../shaders/UsdPreviewSurfaceParameters.osl | 12 +++++------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/third_party/renderman-26/plugin/hdPrman/matfiltConvertPreviewMaterial.cpp b/third_party/renderman-26/plugin/hdPrman/matfiltConvertPreviewMaterial.cpp index 9e1e1dcc41..8bc55e74d4 100644 --- a/third_party/renderman-26/plugin/hdPrman/matfiltConvertPreviewMaterial.cpp +++ b/third_party/renderman-26/plugin/hdPrman/matfiltConvertPreviewMaterial.cpp @@ -66,13 +66,13 @@ TF_DEFINE_PRIVATE_TOKENS( (dispScalarOut) (glassIor) (glassIorOut) + (glassRoughness) + (glassRoughnessOut) (glowGain) (glowGainOut) (glowColor) (glowColorOut) (normalIn) - (refractionGain) - (refractionGainOut) (specularEdgeColor) (specularEdgeColorOut) (specularFaceColor) @@ -225,6 +225,7 @@ _ProcessPreviewSurfaceNode( {_tokens->diffuseColor, _tokens->diffuseColorOut}, {_tokens->diffuseGain, _tokens->diffuseGainOut}, {_tokens->glassIor, _tokens->glassIorOut}, + {_tokens->glassRoughness, _tokens->glassRoughnessOut}, {_tokens->glowColor, _tokens->glowColorOut}, {_tokens->glowGain, _tokens->glowGainOut}, {_tokens->specularFaceColor, _tokens->specularFaceColorOut}, @@ -242,19 +243,6 @@ _ProcessPreviewSurfaceNode( pxrSurfaceNodeName, inOutPair.first, {{nodeName, inOutPair.second}}); } - - // If opacityThreshold is > 0, do *not* use refraction. - VtValue vtOpThres; - if (_GetParameter( - netInterface, nodeName, _tokens->opacityThreshold, - &vtOpThres)) { - - if (vtOpThres.Get() <= 0.0f) { - netInterface->SetNodeInputConnection( - pxrSurfaceNodeName, _tokens->refractionGain, - {{nodeName, _tokens->refractionGainOut}}); - } - } } // Check for non-zero displacement param or connection diff --git a/third_party/renderman-26/shaders/UsdPreviewSurfaceParameters.osl b/third_party/renderman-26/shaders/UsdPreviewSurfaceParameters.osl index a7e6b9ba30..11b3e8d921 100644 --- a/third_party/renderman-26/shaders/UsdPreviewSurfaceParameters.osl +++ b/third_party/renderman-26/shaders/UsdPreviewSurfaceParameters.osl @@ -56,17 +56,15 @@ shader UsdPreviewSurfaceParameters output normal bumpNormalOut = normal(0.0,0.0,0.0) [[ string widget = "null" ]], - // Opacity - output float refractionGainOut = 0.0 - [[ string widget = "null" ]], + // Opacity & Presence outputs output float glassIorOut= 0.0 [[ string widget = "null" ]], - - // Presence output + output float glassRoughnessOut = 0.0 + [[ string widget = "null" ]], output float presenceOut = 1.0 [[ string widget = "null" ]], - // Displacement output + // Displacement outputs output float dispAmountOut = 0.0 [[ string widget = "null" ]], output float dispScalarOut = 0.0 @@ -145,7 +143,7 @@ shader UsdPreviewSurfaceParameters // Opacity if (opacityAdjusted < 1.0) { glassIorOut = ior; - refractionGainOut = 1.0 - opacityAdjusted; + glassRoughnessOut = 0.0; diffuseGainOut *= opacityAdjusted; presenceOut = opacityAdjusted; } From d6353ccba60ba2a984d825fa159c6d7e11c27107 Mon Sep 17 00:00:00 2001 From: klucknav Date: Mon, 28 Oct 2024 15:19:10 -0700 Subject: [PATCH 68/82] Update wording around opacityThreshold. (Internal change: 2345853) --- docs/spec_usdpreviewsurface.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/spec_usdpreviewsurface.rst b/docs/spec_usdpreviewsurface.rst index f3f5204cba..81e5c7082c 100644 --- a/docs/spec_usdpreviewsurface.rst +++ b/docs/spec_usdpreviewsurface.rst @@ -178,8 +178,8 @@ and :usda:`opacity`. interpreted; this "translucent or masked" behavior is common in engines and renderers, and makes the UsdPreviewSurface easier to interchange. It does imply, however, that it is not possible to faithfully recreate a - translucent material that also provides an opacity-based mask... so no - single-polygon translucent leaves. + translucent material that also provides an opacity-based mask with a + non-zero opacityThreshold. .. _updateior: From 2602568ea0cd8af8e5ea21f6b9dea3fd851871af Mon Sep 17 00:00:00 2001 From: tgvarik Date: Mon, 28 Oct 2024 15:19:29 -0700 Subject: [PATCH 69/82] Check prototypes before creating gprim instances HdPrmanInstancer::Populate() expects to receive invalid geometry prototype ids when instancing analytic lights, so it checks to make sure it has a light shader id whenever it sees an invalid geometry prototype id and fails a verify if both are invalid. We want to keep that behavior, but avoid hitting the failed verify when we expected to have valid geometry prototype ids. So we add a check in Gprim::Sync() to ensure we have valid ids before calling Populate() and issue a better (and non-fatal) warning if we do not. (Internal change: 2345857) --- .../renderman-26/plugin/hdPrman/gprim.h | 41 +++++++++++++------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/third_party/renderman-26/plugin/hdPrman/gprim.h b/third_party/renderman-26/plugin/hdPrman/gprim.h index aa74251f84..3dc0c4e436 100644 --- a/third_party/renderman-26/plugin/hdPrman/gprim.h +++ b/third_party/renderman-26/plugin/hdPrman/gprim.h @@ -473,19 +473,34 @@ HdPrman_Gprim::Sync(HdSceneDelegate* sceneDelegate, "size mismatch (%lu, %lu, %lu)\n", _prototypeIds.size(), subsetMaterialIds.size(), subsetPaths.size()); - // next, tell the hdprman instancer to sync the riley instances - HdPrmanInstancer *instancer = static_cast( - renderIndex.GetInstancer(instancerId)); - if (instancer) { - instancer->Populate( - renderParam, - dirtyBits, - id, - _prototypeIds, - coordSysList, - attrs, xf, - subsetMaterialIds, - subsetPaths); + // XXX: To avoid a failed verify inside Populate(), we will check the + // prototype ids for validity here. We don't usually do this, relying on + // Riley to report invalid prototype ids on instance creation. But + // Populate() allows and expects an invalid prototype id when instancing + // lights, so doing this check here lets us make a more informative + // warning. HYD-3206 + if (std::any_of(_prototypeIds.begin(), _prototypeIds.end(), + [](const auto& id){ + return id == riley::GeometryPrototypeId::InvalidId(); + })) { + TF_WARN("Riley geometry prototype creation failed for " + "instanced gprim <%s>; the prim will not be instanced.", + id.GetText()); + } else { + // next, tell the hdprman instancer to sync the riley instances + HdPrmanInstancer *instancer = static_cast( + renderIndex.GetInstancer(instancerId)); + if (instancer) { + instancer->Populate( + renderParam, + dirtyBits, + id, + _prototypeIds, + coordSysList, + attrs, xf, + subsetMaterialIds, + subsetPaths); + } } } *dirtyBits &= ~HdChangeTracker::AllSceneDirtyBits; From 3a70f7cd87699ebefe8e1fdd8ebca826d5c93d88 Mon Sep 17 00:00:00 2001 From: tallytalwar Date: Mon, 28 Oct 2024 15:20:30 -0700 Subject: [PATCH 70/82] Updated PlugPlugin python wrapper to allow stl sequence of pluginPtr - Added a TfPyRegisterStlSequencesFromPython call to wrapPlugin.cpp - Added a test case to testPlug.py to test the new functionality (Internal change: 2345868) --- pxr/base/plug/testPlug.py | 5 +++++ pxr/base/plug/testPlugBase.h | 5 +++++ pxr/base/plug/wrapPlugin.cpp | 1 + pxr/base/plug/wrapTestPlugBase.cpp | 5 +++++ 4 files changed, 16 insertions(+) diff --git a/pxr/base/plug/testPlug.py b/pxr/base/plug/testPlug.py index ba8feed7da..578e9cc62e 100644 --- a/pxr/base/plug/testPlug.py +++ b/pxr/base/plug/testPlug.py @@ -327,5 +327,10 @@ def test_DebugCodeExistence(self): self.assertTrue('PLUG_INFO_SEARCH' in debugCodes) self.assertTrue('PLUG_REGISTRATION' in debugCodes) + def test_StlSequencesForPlugPluginPtr(self): + pd1 = Plug.Registry().GetPluginForType('TestPlugDerived1') + td1 = Plug._TestPlugBase1('TestPlugDerived1') + self.assertTrue(td1.TestAcceptPluginSequence([pd1])) + if __name__ == '__main__': unittest.main() diff --git a/pxr/base/plug/testPlugBase.h b/pxr/base/plug/testPlugBase.h index 9b17ae5aaa..2bd210cd69 100644 --- a/pxr/base/plug/testPlugBase.h +++ b/pxr/base/plug/testPlugBase.h @@ -13,6 +13,7 @@ #include "pxr/base/tf/stringUtils.h" #include "pxr/base/tf/type.h" #include "pxr/base/tf/weakBase.h" +#include "pxr/base/plug/plugin.h" #include @@ -36,6 +37,10 @@ class _TestPlugBase : public TfRefBase, public TfWeakBase { return TfCreateRefPtr(new This()); } + bool TestAcceptPluginSequence(const PlugPluginPtrVector &plugins) { + return true; + } + PLUG_API static RefPtr Manufacture(const std::string & subclass); diff --git a/pxr/base/plug/wrapPlugin.cpp b/pxr/base/plug/wrapPlugin.cpp index 07929dbc5b..2c87ed069a 100644 --- a/pxr/base/plug/wrapPlugin.cpp +++ b/pxr/base/plug/wrapPlugin.cpp @@ -87,6 +87,7 @@ void wrapPlugin() (arg("path"), arg("verify") = true)) ; + TfPyRegisterStlSequencesFromPython(); // The call to JsConvertToContainerType in _ConvertDict creates // vectors of pxr_boost::python::objects for array values, so register diff --git a/pxr/base/plug/wrapTestPlugBase.cpp b/pxr/base/plug/wrapTestPlugBase.cpp index ea6f172535..5037ec7c7e 100644 --- a/pxr/base/plug/wrapTestPlugBase.cpp +++ b/pxr/base/plug/wrapTestPlugBase.cpp @@ -7,6 +7,8 @@ #include "pxr/pxr.h" #include "pxr/base/plug/testPlugBase.h" +#include "pxr/external/boost/python/def.hpp" +#include "pxr/external/boost/python/args.hpp" #include "pxr/base/tf/makePyConstructor.h" #include "pxr/base/tf/pyPtrHelpers.h" #include "pxr/base/tf/pyContainerConversions.h" @@ -33,6 +35,9 @@ void wrap_TestPlugBase(const std::string & name) .def("GetTypeName", &This::GetTypeName) + .def("TestAcceptPluginSequence", &This::TestAcceptPluginSequence, + (arg("plugins"))); + ; } From 82e8f2c6a4d49df9fd338179ae86c5114d819f57 Mon Sep 17 00:00:00 2001 From: tallytalwar Date: Mon, 28 Oct 2024 15:20:48 -0700 Subject: [PATCH 71/82] test plugin library for testing ValidationContext APIs - The test validators registered here can now be shared between cpp and python test, which is introduced in a subsequent change (Internal change: 2345871) --- pxr/usd/usd/CMakeLists.txt | 10 + ...dValidationContextValidators_plugInfo.json | 52 +++++ .../usd/testenv/testUsdValidationContext.cpp | 182 +++--------------- .../resources/plugInfo.json | 39 ---- .../testUsdValidationContextValidators.cpp | 169 ++++++++++++++++ 5 files changed, 253 insertions(+), 199 deletions(-) create mode 100644 pxr/usd/usd/testenv/TestUsdValidationContextValidators_plugInfo.json create mode 100644 pxr/usd/usd/testenv/testUsdValidationContextValidators.cpp diff --git a/pxr/usd/usd/CMakeLists.txt b/pxr/usd/usd/CMakeLists.txt index da880016e8..6bb5caa018 100644 --- a/pxr/usd/usd/CMakeLists.txt +++ b/pxr/usd/usd/CMakeLists.txt @@ -300,6 +300,16 @@ pxr_build_test_shared_lib(TestUsdResolverChangedResolver testenv/TestUsdResolverChangedResolver.cpp ) +pxr_build_test_shared_lib(TestUsdValidationContextValidators + INSTALL_PREFIX UsdPlugins + LIBRARIES + tf + usd + + CPPFILES + testenv/testUsdValidationContextValidators.cpp +) + pxr_build_test_shared_lib(TestUsdValidationRegistryPy INSTALL_PREFIX UsdPlugins LIBRARIES diff --git a/pxr/usd/usd/testenv/TestUsdValidationContextValidators_plugInfo.json b/pxr/usd/usd/testenv/TestUsdValidationContextValidators_plugInfo.json new file mode 100644 index 0000000000..a43029c8c2 --- /dev/null +++ b/pxr/usd/usd/testenv/TestUsdValidationContextValidators_plugInfo.json @@ -0,0 +1,52 @@ +{ + "Plugins": [ + { + "Type": "library", + "Name": "testUsdValidationContextValidatorsPlugin", + "Root": "@TEST_PLUG_INFO_ROOT@", + "ResourcePath": "@TEST_PLUG_INFO_RESOURCE_PATH@", + "LibraryPath": "@TEST_PLUG_INFO_LIBRARY_PATH@", + "Info": { + "Validators": { + "Test1": { + "doc": "Stage Validator", + "keywords": ["Keyword1"] + }, + "Test2": { + "doc": "Layer Validator", + "keywords": ["Keyword2"] + }, + "Test3": { + "doc": "A generic prim validator", + "keywords": ["Keyword1"] + }, + "Test4": { + "doc": "validator for testBaseType", + "keywords": ["Keyword2"], + "schemaTypes": ["testBaseType"] + }, + "Test5": { + "doc": "validator for testDerivedType", + "keywords": ["Keyword1"], + "schemaTypes": ["testDerivedType"] + }, + "Test6": { + "doc": "validator for testNestedDerivedType", + "keywords": ["Keyword2"], + "schemaTypes": ["testNestedDerivedType"] + }, + "Test7": { + "doc": "validator for testAPISchema", + "keywords": ["Keyword1"], + "schemaTypes": ["testAPISchemaAPI"] + }, + "TestSuite": { + "doc": "A suite of validators for Test1, Test2 and Test3", + "isSuite": true, + "keywords": ["Keyword2"] + } + } + } + } + ] +} diff --git a/pxr/usd/usd/testenv/testUsdValidationContext.cpp b/pxr/usd/usd/testenv/testUsdValidationContext.cpp index c7e66b76a5..db83eacbef 100644 --- a/pxr/usd/usd/testenv/testUsdValidationContext.cpp +++ b/pxr/usd/usd/testenv/testUsdValidationContext.cpp @@ -15,154 +15,6 @@ PXR_NAMESPACE_USING_DIRECTIVE -TF_REGISTRY_FUNCTION(UsdValidationRegistry) -{ - UsdValidationRegistry& registry = UsdValidationRegistry::GetInstance(); - - // Register test plugin validators here - // Test validators simply just return errors, we need to make sure various - // UsdValidationContext APIs work and get the expected errors back, when - // Validate is called in various scenarios on a validation context instance. - { - const TfToken validatorName("testUsdValidationContext:Test1"); - const UsdValidateStageTaskFn stageTaskFn = []( - const UsdStagePtr & usdStage) - { - const TfToken validationErrorId("Test1Error"); - return UsdValidationErrorVector{ - UsdValidationError( - validationErrorId, UsdValidationErrorType::Error, - {UsdValidationErrorSite(usdStage, - SdfPath::AbsoluteRootPath())}, - "A stage validator error")}; - }; - - TfErrorMark m; - registry.RegisterPluginValidator(validatorName, stageTaskFn); - TF_AXIOM(m.IsClean()); - } - { - const TfToken validatorName("testUsdValidationContext:Test2"); - const UsdValidateLayerTaskFn layerTaskFn = []( - const SdfLayerHandle & layer) - { - const TfToken validationErrorId("Test2Error"); - return UsdValidationErrorVector{ - UsdValidationError( - validationErrorId, UsdValidationErrorType::Error, - {UsdValidationErrorSite(layer, - SdfPath::AbsoluteRootPath())}, - "A layer validator error")}; - }; - - TfErrorMark m; - registry.RegisterPluginValidator(validatorName, layerTaskFn); - TF_AXIOM(m.IsClean()); - } - { - const TfToken validatorName("testUsdValidationContext:Test3"); - const UsdValidatePrimTaskFn primTaskFn = []( - const UsdPrim & prim) - { - const TfToken validationErrorId("Test3Error"); - return UsdValidationErrorVector{ - UsdValidationError( - validationErrorId, UsdValidationErrorType::Error, - {UsdValidationErrorSite(prim.GetStage(), - prim.GetPath())}, - "A generic prim validator error")}; - }; - - TfErrorMark m; - registry.RegisterPluginValidator(validatorName, primTaskFn); - TF_AXIOM(m.IsClean()); - } - { - const TfToken validatorName("testUsdValidationContext:Test4"); - const UsdValidatePrimTaskFn primTaskFn = []( - const UsdPrim & prim) - { - const TfToken validationErrorId("Test4Error"); - return UsdValidationErrorVector{ - UsdValidationError( - validationErrorId, UsdValidationErrorType::Error, - {UsdValidationErrorSite(prim.GetStage(), - prim.GetPath())}, - "A testBaseType prim type validator error")}; - }; - - TfErrorMark m; - registry.RegisterPluginValidator(validatorName, primTaskFn); - TF_AXIOM(m.IsClean()); - } - { - const TfToken validatorName("testUsdValidationContext:Test5"); - const UsdValidatePrimTaskFn primTaskFn = []( - const UsdPrim & prim) - { - const TfToken validationErrorId("Test5Error"); - return UsdValidationErrorVector{ - UsdValidationError( - validationErrorId, UsdValidationErrorType::Error, - {UsdValidationErrorSite(prim.GetStage(), - prim.GetPath())}, - "A testDerivedType prim type validator error")}; - }; - - TfErrorMark m; - registry.RegisterPluginValidator(validatorName, primTaskFn); - TF_AXIOM(m.IsClean()); - } - { - const TfToken validatorName("testUsdValidationContext:Test6"); - const UsdValidatePrimTaskFn primTaskFn = []( - const UsdPrim & prim) - { - const TfToken validationErrorId("Test6Error"); - return UsdValidationErrorVector{ - UsdValidationError( - validationErrorId, UsdValidationErrorType::Error, - {UsdValidationErrorSite(prim.GetStage(), - prim.GetPath())}, - "A testNestedDerivedType prim type validator error")}; - }; - - TfErrorMark m; - registry.RegisterPluginValidator(validatorName, primTaskFn); - TF_AXIOM(m.IsClean()); - } - { - const TfToken validatorName("testUsdValidationContext:Test7"); - const UsdValidatePrimTaskFn primTaskFn = []( - const UsdPrim & prim) - { - const TfToken validationErrorId("Test7Error"); - return UsdValidationErrorVector{ - UsdValidationError( - validationErrorId, UsdValidationErrorType::Error, - {UsdValidationErrorSite(prim.GetStage(), - prim.GetPath())}, - "A testAPISchema prim type validator error")}; - }; - - TfErrorMark m; - registry.RegisterPluginValidator(validatorName, primTaskFn); - TF_AXIOM(m.IsClean()); - } - { - const TfToken suiteName("testUsdValidationContext:TestSuite"); - const std::vector containedValidators = - registry.GetOrLoadValidatorsByName( - {TfToken("testUsdValidationContext:Test1"), - TfToken("testUsdValidationContext:Test2"), - TfToken("testUsdValidationContext:Test3")}); - - TfErrorMark m; - registry.RegisterPluginValidatorSuite(suiteName, containedValidators); - TF_AXIOM(m.IsClean()); - } -} - static std::string _LayerContents() { @@ -202,7 +54,7 @@ void _TestError1(const UsdValidationError &error) { TF_AXIOM( error.GetValidator()->GetMetadata().name == - TfToken("testUsdValidationContext:Test1")); + TfToken("testUsdValidationContextValidatorsPlugin:Test1")); TF_AXIOM(error.GetSites().size() == 1); TF_AXIOM(error.GetSites()[0].IsPrim()); TF_AXIOM(error.GetSites()[0].GetPrim().GetPath() == @@ -214,7 +66,7 @@ void _TestError2(const UsdValidationError &error) { TF_AXIOM( error.GetValidator()->GetMetadata().name == - TfToken("testUsdValidationContext:Test2")); + TfToken("testUsdValidationContextValidatorsPlugin:Test2")); TF_AXIOM(error.GetSites().size() == 1); TF_AXIOM(error.GetSites()[0].IsValidSpecInLayer()); } @@ -224,7 +76,7 @@ void _TestError3(const UsdValidationError &error) { TF_AXIOM( error.GetValidator()->GetMetadata().name == - TfToken("testUsdValidationContext:Test3")); + TfToken("testUsdValidationContextValidatorsPlugin:Test3")); const std::set expectedPrimPaths = { SdfPath("/World"), SdfPath("/World/baseType"), @@ -241,7 +93,7 @@ void _TestError4(const UsdValidationError &error) { TF_AXIOM( error.GetValidator()->GetMetadata().name == - TfToken("testUsdValidationContext:Test4")); + TfToken("testUsdValidationContextValidatorsPlugin:Test4")); const std::set expectedPrimPaths = { SdfPath("/World/baseType"), SdfPath("/World/derivedType"), @@ -256,7 +108,7 @@ void _TestError5(const UsdValidationError &error) { TF_AXIOM( error.GetValidator()->GetMetadata().name == - TfToken("testUsdValidationContext:Test5")); + TfToken("testUsdValidationContextValidatorsPlugin:Test5")); const std::set expectedPrimPaths = { SdfPath("/World/derivedType"), SdfPath("/World/nestedDerivedType")}; @@ -270,7 +122,7 @@ void _TestError6(const UsdValidationError &error) { TF_AXIOM( error.GetValidator()->GetMetadata().name == - TfToken("testUsdValidationContext:Test6")); + TfToken("testUsdValidationContextValidatorsPlugin:Test6")); TF_AXIOM(error.GetSites().size() == 1); TF_AXIOM(error.GetSites()[0].IsPrim()); TF_AXIOM(error.GetSites()[0].GetPrim().GetName() == @@ -283,7 +135,7 @@ _TestError7(const UsdValidationError &error) { TF_AXIOM(error.GetName() == TfToken("Test7Error")); TF_AXIOM( error.GetValidator()->GetMetadata().name == - TfToken("testUsdValidationContext:Test7")); + TfToken("testUsdValidationContextValidatorsPlugin:Test7")); TF_AXIOM(error.GetSites().size() == 1); TF_AXIOM(error.GetSites()[0].IsPrim()); TF_AXIOM(error.GetSites()[0].GetPrim().GetName() == @@ -309,7 +161,7 @@ _TestUsdValidationContext() // Create a ValidationContext with a suite const UsdValidatorSuite* suite = UsdValidationRegistry::GetInstance().GetOrLoadValidatorSuiteByName( - TfToken("testUsdValidationContext:TestSuite")); + TfToken("testUsdValidationContextValidatorsPlugin:TestSuite")); UsdValidationContext context({suite}); SdfLayerRefPtr testLayer = _CreateTestLayer(); // Run Validate(layer) @@ -494,7 +346,7 @@ _TestUsdValidationContext() // Create a ValidationContext with plugins UsdValidationContext context({ PlugRegistry::GetInstance().GetPluginWithName( - "testUsdValidationContext")}); + "testUsdValidationContextValidatorsPlugin")}); SdfLayerRefPtr testLayer = _CreateTestLayer(); UsdStageRefPtr stage = UsdStage::Open(testLayer); UsdValidationErrorVector errors = context.Validate(stage); @@ -536,9 +388,19 @@ _TestUsdValidationContext() int main() { - // Register the test plugin - const std::string pluginPath = ArchGetCwd() + "/resources"; - TF_AXIOM(!PlugRegistry::GetInstance().RegisterPlugins(pluginPath).empty()); + // Register the test plugins + // Plugin which provides test usd schema types + const std::string testTypePluginPath = ArchGetCwd() + "/resources"; + TF_AXIOM(!PlugRegistry::GetInstance().RegisterPlugins( + testTypePluginPath).empty()); + // Plugin which provides test validators + const std::string testValidatorPluginPath = + TfStringCatPaths( + TfGetPathName(ArchGetExecutablePath()), + "UsdPlugins/lib/TestUsdValidationContextValidators*/Resources/") + + "/"; + TF_AXIOM(!PlugRegistry::GetInstance().RegisterPlugins( + testValidatorPluginPath).empty()); // Add a non-plugin based validator here. { diff --git a/pxr/usd/usd/testenv/testUsdValidationContext/resources/plugInfo.json b/pxr/usd/usd/testenv/testUsdValidationContext/resources/plugInfo.json index 1ed9b05b62..2b64e63ab9 100644 --- a/pxr/usd/usd/testenv/testUsdValidationContext/resources/plugInfo.json +++ b/pxr/usd/usd/testenv/testUsdValidationContext/resources/plugInfo.json @@ -34,45 +34,6 @@ }, "bases": ["UsdAPISchemaBase"] } - }, - "Validators": { - "Test1": { - "doc": "Stage Validator", - "keywords": ["Keyword1"] - }, - "Test2": { - "doc": "Layer Validator", - "keywords": ["Keyword2"] - }, - "Test3": { - "doc": "A generic prim validator", - "keywords": ["Keyword1"] - }, - "Test4": { - "doc": "validator for testBaseType", - "keywords": ["Keyword2"], - "schemaTypes": ["testBaseType"] - }, - "Test5": { - "doc": "validator for testDerivedType", - "keywords": ["Keyword1"], - "schemaTypes": ["testDerivedType"] - }, - "Test6": { - "doc": "validator for testNestedDerivedType", - "keywords": ["Keyword2"], - "schemaTypes": ["testNestedDerivedType"] - }, - "Test7": { - "doc": "validator for testAPISchema", - "keywords": ["Keyword1"], - "schemaTypes": ["testAPISchemaAPI"] - }, - "TestSuite": { - "doc": "A suite of validators for Test1, Test2 and Test3", - "isSuite": true, - "keywords": ["Keyword2"] - } } } } diff --git a/pxr/usd/usd/testenv/testUsdValidationContextValidators.cpp b/pxr/usd/usd/testenv/testUsdValidationContextValidators.cpp new file mode 100644 index 0000000000..66615018d2 --- /dev/null +++ b/pxr/usd/usd/testenv/testUsdValidationContextValidators.cpp @@ -0,0 +1,169 @@ +// +// Copyright 2024 Pixar +// +// Licensed under the terms set forth in the LICENSE.txt file available at +// https://openusd.org/license. +// + +#include "pxr/pxr.h" +#include "pxr/usd/usd/validationError.h" +#include "pxr/usd/usd/validationRegistry.h" +#include "pxr/usd/usd/validator.h" + +PXR_NAMESPACE_USING_DIRECTIVE + +TF_REGISTRY_FUNCTION(UsdValidationRegistry) +{ + UsdValidationRegistry& registry = UsdValidationRegistry::GetInstance(); + + // Register test plugin validators here + // Test validators simply just return errors, we need to make sure various + // UsdValidationContext APIs work and get the expected errors back, when + // Validate is called in various scenarios on a validation context instance. + { + const TfToken validatorName( + "testUsdValidationContextValidatorsPlugin:Test1"); + const UsdValidateStageTaskFn stageTaskFn = []( + const UsdStagePtr & usdStage) + { + const TfToken validationErrorId("Test1Error"); + return UsdValidationErrorVector{ + UsdValidationError( + validationErrorId, UsdValidationErrorType::Error, + {UsdValidationErrorSite(usdStage, + SdfPath::AbsoluteRootPath())}, + "A stage validator error")}; + }; + + TfErrorMark m; + registry.RegisterPluginValidator(validatorName, stageTaskFn); + TF_AXIOM(m.IsClean()); + } + { + const TfToken validatorName( + "testUsdValidationContextValidatorsPlugin:Test2"); + const UsdValidateLayerTaskFn layerTaskFn = []( + const SdfLayerHandle & layer) + { + const TfToken validationErrorId("Test2Error"); + return UsdValidationErrorVector{ + UsdValidationError( + validationErrorId, UsdValidationErrorType::Error, + {UsdValidationErrorSite(layer, + SdfPath::AbsoluteRootPath())}, + "A layer validator error")}; + }; + + TfErrorMark m; + registry.RegisterPluginValidator(validatorName, layerTaskFn); + TF_AXIOM(m.IsClean()); + } + { + const TfToken validatorName( + "testUsdValidationContextValidatorsPlugin:Test3"); + const UsdValidatePrimTaskFn primTaskFn = []( + const UsdPrim & prim) + { + const TfToken validationErrorId("Test3Error"); + return UsdValidationErrorVector{ + UsdValidationError( + validationErrorId, UsdValidationErrorType::Error, + {UsdValidationErrorSite(prim.GetStage(), + prim.GetPath())}, + "A generic prim validator error")}; + }; + + TfErrorMark m; + registry.RegisterPluginValidator(validatorName, primTaskFn); + TF_AXIOM(m.IsClean()); + } + { + const TfToken validatorName( + "testUsdValidationContextValidatorsPlugin:Test4"); + const UsdValidatePrimTaskFn primTaskFn = []( + const UsdPrim & prim) + { + const TfToken validationErrorId("Test4Error"); + return UsdValidationErrorVector{ + UsdValidationError( + validationErrorId, UsdValidationErrorType::Error, + {UsdValidationErrorSite(prim.GetStage(), + prim.GetPath())}, + "A testBaseType prim type validator error")}; + }; + + TfErrorMark m; + registry.RegisterPluginValidator(validatorName, primTaskFn); + TF_AXIOM(m.IsClean()); + } + { + const TfToken validatorName( + "testUsdValidationContextValidatorsPlugin:Test5"); + const UsdValidatePrimTaskFn primTaskFn = []( + const UsdPrim & prim) + { + const TfToken validationErrorId("Test5Error"); + return UsdValidationErrorVector{ + UsdValidationError( + validationErrorId, UsdValidationErrorType::Error, + {UsdValidationErrorSite(prim.GetStage(), + prim.GetPath())}, + "A testDerivedType prim type validator error")}; + }; + + TfErrorMark m; + registry.RegisterPluginValidator(validatorName, primTaskFn); + TF_AXIOM(m.IsClean()); + } + { + const TfToken validatorName( + "testUsdValidationContextValidatorsPlugin:Test6"); + const UsdValidatePrimTaskFn primTaskFn = []( + const UsdPrim & prim) + { + const TfToken validationErrorId("Test6Error"); + return UsdValidationErrorVector{ + UsdValidationError( + validationErrorId, UsdValidationErrorType::Error, + {UsdValidationErrorSite(prim.GetStage(), + prim.GetPath())}, + "A testNestedDerivedType prim type validator error")}; + }; + + TfErrorMark m; + registry.RegisterPluginValidator(validatorName, primTaskFn); + TF_AXIOM(m.IsClean()); + } + { + const TfToken validatorName( + "testUsdValidationContextValidatorsPlugin:Test7"); + const UsdValidatePrimTaskFn primTaskFn = []( + const UsdPrim & prim) + { + const TfToken validationErrorId("Test7Error"); + return UsdValidationErrorVector{ + UsdValidationError( + validationErrorId, UsdValidationErrorType::Error, + {UsdValidationErrorSite(prim.GetStage(), + prim.GetPath())}, + "A testAPISchema prim type validator error")}; + }; + + TfErrorMark m; + registry.RegisterPluginValidator(validatorName, primTaskFn); + TF_AXIOM(m.IsClean()); + } + { + const TfToken suiteName( + "testUsdValidationContextValidatorsPlugin:TestSuite"); + const std::vector containedValidators = + registry.GetOrLoadValidatorsByName( + {TfToken("testUsdValidationContextValidatorsPlugin:Test1"), + TfToken("testUsdValidationContextValidatorsPlugin:Test2"), + TfToken("testUsdValidationContextValidatorsPlugin:Test3")}); + + TfErrorMark m; + registry.RegisterPluginValidatorSuite(suiteName, containedValidators); + TF_AXIOM(m.IsClean()); + } +} From 4ca1dff19c435a67ff0b9360aa20d9108c4bff16 Mon Sep 17 00:00:00 2001 From: tallytalwar Date: Mon, 28 Oct 2024 15:21:27 -0700 Subject: [PATCH 72/82] Add python wrappings for UsdValidationContext - The python test for these python wrappings is the exact same test as the cpp version and also shares the test validators and types registered for the test. - The only thing missing is the registration of a non-plugin validator, that is because validator registration is not exposed to python at the moment. Other things to note here: - For appropriate UsdValidationContext's constructor to be initialized, TfPyRegisterStlSequencesFromPython is added to python wrappings of UsdValidatorMetadata, UsdValidator* and UsdValidatorSuite*. This makes sure python list to std::vector conversion happens appropriately and correct constructors are called. (Internal change: 2345872) --- pxr/usd/usd/CMakeLists.txt | 14 + pxr/usd/usd/module.cpp | 1 + .../usd/testenv/testUsdValidationContextPy.py | 327 ++++++++++++++++++ pxr/usd/usd/wrapValidationContext.cpp | 81 +++++ pxr/usd/usd/wrapValidator.cpp | 3 + 5 files changed, 426 insertions(+) create mode 100644 pxr/usd/usd/testenv/testUsdValidationContextPy.py create mode 100644 pxr/usd/usd/wrapValidationContext.cpp diff --git a/pxr/usd/usd/CMakeLists.txt b/pxr/usd/usd/CMakeLists.txt index 6bb5caa018..7c77c2dea7 100644 --- a/pxr/usd/usd/CMakeLists.txt +++ b/pxr/usd/usd/CMakeLists.txt @@ -146,6 +146,7 @@ pxr_library(usd wrapTimeCode.cpp wrapUsdFileFormat.cpp wrapUtils.cpp + wrapValidationContext.cpp wrapValidationError.cpp wrapValidationRegistry.cpp wrapValidator.cpp @@ -268,6 +269,7 @@ pxr_test_scripts( testenv/testUsdTimeSamples.py testenv/testUsdTimeValueAuthoring.py testenv/testUsdUsdzFileFormat.py + testenv/testUsdValidationContextPy.py testenv/testUsdValidationError.py testenv/testUsdValidationRegistryPy.py testenv/testUsdValidatorMetadata.py @@ -806,6 +808,11 @@ pxr_install_test_dir( DEST testUsdValidationContext ) +pxr_install_test_dir( + SRC testenv/testUsdValidationContext + DEST testUsdValidationContextPy +) + pxr_install_test_dir( SRC testenv/testUsdValidationRegistry DEST testUsdValidationRegistry @@ -1428,11 +1435,18 @@ pxr_register_test(testUsdValidationError EXPECTED_RETURN_CODE 0 ) +pxr_register_test(testUsdValidationContextPy + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdValidationContextPy" + EXPECTED_RETURN_CODE 0 +) + pxr_register_test(testUsdValidationRegistryPy PYTHON COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdValidationRegistryPy" EXPECTED_RETURN_CODE 0 ) + pxr_register_test(testUsdUsdzBugGHSA01 COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdUsdzBugGHSA01" EXPECTED_RETURN_CODE 0 diff --git a/pxr/usd/usd/module.cpp b/pxr/usd/usd/module.cpp index 544ffacfcf..c68763c61b 100644 --- a/pxr/usd/usd/module.cpp +++ b/pxr/usd/usd/module.cpp @@ -37,6 +37,7 @@ TF_WRAP_MODULE TF_WRAP(UsdSpecializes); TF_WRAP(UsdPrimRange); TF_WRAP(UsdVariantSets); + TF_WRAP(UsdValidationContext); TF_WRAP(UsdValidationError); TF_WRAP(UsdValidationRegistry); TF_WRAP(UsdValidator); diff --git a/pxr/usd/usd/testenv/testUsdValidationContextPy.py b/pxr/usd/usd/testenv/testUsdValidationContextPy.py new file mode 100644 index 0000000000..4d04077d9b --- /dev/null +++ b/pxr/usd/usd/testenv/testUsdValidationContextPy.py @@ -0,0 +1,327 @@ +#!/pxrpythonsubst +# +# Copyright 2024 Pixar +# +# Licensed under the terms set forth in the LICENSE.txt file available at +# https://openusd.org/license. + +import os, unittest + +from pxr import Plug, Sdf, Tf, Usd + +class TestUsdValidationContextPy(unittest.TestCase): + + @classmethod + def setUpClass(cls) -> None: + testTypePluginPath = os.path.abspath( + os.path.join(os.path.curdir, "resources")) + assert os.path.exists(testTypePluginPath) + testValidatorPluginPath = os.path.join( + os.path.dirname(__file__), + "UsdPlugins/lib/TestUsdValidationContextValidators*/Resources/") + try: + typePlugins = Plug.Registry().RegisterPlugins(testTypePluginPath) + assert typePlugins + assert len(typePlugins) == 1 + assert typePlugins[0].name == "testUsdValidationContext" + validatorPlugins = Plug.Registry().RegisterPlugins( + testValidatorPluginPath) + assert validatorPlugins + assert len(validatorPlugins) == 1 + assert validatorPlugins[0].name == \ + "testUsdValidationContextValidatorsPlugin" + except RuntimeError: + pass + + def _LayerContents(self): + layerContents = """#usda 1.0 + def "World" + { + def BaseTypeTest "baseType" + { + } + def DerivedTypeTest "derivedType" + { + } + def NestedDerivedTypeTest "nestedDerivedType" + { + } + def "somePrim" ( + prepend apiSchemas = ["APISchemaTestAPI"] + ) + { + } + } + """ + return layerContents + + def _CreateTestLayer(self): + layer = Sdf.Layer.CreateAnonymous(".usda") + layer.ImportFromString(self._LayerContents()) + return layer + + def _TestError1(self, error): + self.assertEqual( + error.GetValidator().GetMetadata().name, + "testUsdValidationContextValidatorsPlugin:Test1") + self.assertEqual(len(error.GetSites()), 1) + self.assertTrue(error.GetSites()[0].IsPrim()) + self.assertEqual( + error.GetSites()[0].GetPrim().GetPath(), + Sdf.Path.absoluteRootPath) + + def _TestError2(self, error): + self.assertEqual( + error.GetValidator().GetMetadata().name, + "testUsdValidationContextValidatorsPlugin:Test2") + self.assertEqual(len(error.GetSites()), 1) + self.assertTrue(error.GetSites()[0].IsValidSpecInLayer()) + + def _TestError3(self, error): + self.assertEqual( + error.GetValidator().GetMetadata().name, + "testUsdValidationContextValidatorsPlugin:Test3") + expectedPrimPaths = { + Sdf.Path("/World"), + Sdf.Path("/World/baseType"), + Sdf.Path("/World/derivedType"), + Sdf.Path("/World/nestedDerivedType"), + Sdf.Path("/World/somePrim")} + self.assertTrue( + error.GetSites()[0].GetPrim().GetPath() in expectedPrimPaths) + + def _TestError4(self, error): + self.assertEqual( + error.GetValidator().GetMetadata().name, + "testUsdValidationContextValidatorsPlugin:Test4") + expectedPrimPaths = { + Sdf.Path("/World/baseType"), + Sdf.Path("/World/derivedType"), + Sdf.Path("/World/nestedDerivedType")} + self.assertTrue( + error.GetSites()[0].GetPrim().GetPath() in expectedPrimPaths) + + def _TestError5(self, error): + self.assertEqual( + error.GetValidator().GetMetadata().name, + "testUsdValidationContextValidatorsPlugin:Test5") + expectedPrimPaths = { + Sdf.Path("/World/derivedType"), + Sdf.Path("/World/nestedDerivedType")} + self.assertTrue( + error.GetSites()[0].GetPrim().GetPath() in expectedPrimPaths) + + def _TestError6(self, error): + self.assertEqual( + error.GetValidator().GetMetadata().name, + "testUsdValidationContextValidatorsPlugin:Test6") + self.assertEqual(len(error.GetSites()), 1) + self.assertTrue(error.GetSites()[0].IsPrim()) + self.assertEqual( + error.GetSites()[0].GetPrim().GetName(), + "nestedDerivedType") + + def _TestError7(self, error): + self.assertEqual(error.GetName(), "Test7Error") + self.assertEqual( + error.GetValidator().GetMetadata().name, + "testUsdValidationContextValidatorsPlugin:Test7") + self.assertEqual(len(error.GetSites()), 1) + self.assertTrue(error.GetSites()[0].IsPrim()) + self.assertEqual( + error.GetSites()[0].GetPrim().GetName(), + "somePrim") + + + def test_UsdValidationContext(self): + # Create a ValidationContext with a suite + suite = Usd.ValidationRegistry().GetOrLoadValidatorSuiteByName( + "testUsdValidationContextValidatorsPlugin:TestSuite") + context = Usd.ValidationContext([suite]) + testLayer = self._CreateTestLayer() + # Run Validate(layer) + errors = context.Validate(testLayer) + # 1 error for Test2 validator - root layer of the stage + self.assertEqual(len(errors), 1) + self._TestError2(errors[0]) + # Run Validate(stage) + stage = Usd.Stage.Open(testLayer) + errors = context.Validate(stage) + # 1 error for Test1 validator (stage) + # 2 error for Test2 validator - root layer and session layer + # 5 errors for Test3 generic prim validator which runs on all 5 prims + self.assertEqual(len(errors), 8) + for error in errors: + if error.GetName() == "Test1Error": + self._TestError1(error) + elif error.GetName() == "Test2Error": + self._TestError2(error) + elif error.GetName() == "Test3Error": + self._TestError3(error) + else: + self.assertFalse(True) + + # Create a ValidationContext with explicit schemaTypes + context = Usd.ValidationContext( + [Tf.Type.FindByName("testBaseType")]) + testLayer = self._CreateTestLayer() + # Run Validate(layer) + errors = context.Validate(testLayer) + # 0 errors as we do not have any layer validators selected in this + # context. + self.assertTrue(not errors) + # Run Validate(stage) + stage = Usd.Stage.Open(testLayer) + errors = context.Validate(stage) + # 3 errors for Test4 testBaseType prim type validator which runs on + # the baseType, derivedType and nestedDerivedType prims + self.assertEqual(len(errors), 3) + for error in errors: + self._TestError4(error) + + # Create a ValidationContext with explicit schemaType - apiSchema + context = Usd.ValidationContext( + [Tf.Type.FindByName("testAPISchemaAPI")]) + testLayer = self._CreateTestLayer() + # Run Validate(layer) + errors = context.Validate(testLayer) + # 0 errors as we do not have any layer validators selected in this + # context. + self.assertTrue(not errors) + # Run Validate(stage) + stage = Usd.Stage.Open(testLayer) + errors = context.Validate(stage) + # 1 error for Test7 testAPISchema prim type validator which runs on + # the somePrim prim + self.assertEqual(len(errors), 1) + self._TestError7(errors[0]) + + # Create a ValidationContext with keywords API and have + # includeAllAncestors set to true + context = Usd.ValidationContext(["Keyword1"], True) + testLayer = self._CreateTestLayer() + # Run Validate(layer) + errors = context.Validate(testLayer) + # 0 errors as we do not have any layer validators selected in this + # context. + self.assertTrue(not errors) + # Run Validate(stage) + stage = Usd.Stage.Open(testLayer) + errors = context.Validate(stage) + # 1 error for Test1 validator + # 5 errors for Test3 generic prim validator which runs on all 5 prims + # 2 errors for Test5 testDerivedType prim type validator which runs on + # the derivedType and nestedDerivedType prims + # 3 errors for Test4 testBaseType prim type validator which runs on + # the baseType, derivedType and nestedDerivedType prims (This gets + # includes as an ancestor type of derivedType) + # 1 error for Test7 testAPISchema prim type validator which runs on + # the somePrim prim + self.assertEqual(len(errors), 12) + for error in errors: + if error.GetName() == "Test1Error": + self._TestError1(error) + elif error.GetName() == "Test3Error": + self._TestError3(error) + elif error.GetName() == "Test4Error": + self._TestError4(error) + elif error.GetName() == "Test5Error": + self._TestError5(error) + elif error.GetName() == "Test7Error": + self._TestError7(error) + else: + self.assertFalse(True) + + # Create a ValidationContext with keywords API and have + # includeAllAncestors set to false + context = Usd.ValidationContext(["Keyword2"], False) + testLayer = self._CreateTestLayer() + # Run Validate(layer) + errors = context.Validate(testLayer) + # 1 error for Test2 validator - root layer of the stage + self.assertEqual(len(errors), 1) + self._TestError2(errors[0]) + # Run Validate(prims) + stage = Usd.Stage.Open(testLayer) + errors = context.Validate(stage.Traverse()) + # 3 errors for Test4 testBaseType prim type validator which runs on + # the baseType, derivedType and nestedDerivedType prims + # 1 error for Test6 testNestedDerivedType prim type validator which + # runs on the nestedDerivedType prim + # 5 errors for Test3 generic prim validator which runs on all 5 prims + self.assertEqual(len(errors), 9) + for error in errors: + if error.GetName() == "Test3Error": + self._TestError3(error) + elif error.GetName() == "Test4Error": + self._TestError4(error) + elif error.GetName() == "Test6Error": + self._TestError6(error) + else: + self.assertFalse(True) + + # Run Validate(stage) + errors = context.Validate(stage) + # 2 error for Test2 validator - root layer and session layer + # 3 errors for Test4 testBaseType prim type validator which runs on + # the baseType, derivedType and nestedDerivedType prims + # 1 error for Test6 testNestedDerivedType prim type validator which + # runs on the nestedDerivedType prim + # Because of TestSuite: + # 1 error for Test1 validator + # 5 errors for Test3 generic prim validator which runs on all 5 prims + self.assertEqual(len(errors), 12) + for error in errors: + if error.GetName() == "Test1Error": + self._TestError1(error) + elif error.GetName() == "Test2Error": + self._TestError2(error) + elif error.GetName() == "Test3Error": + self._TestError3(error) + elif error.GetName() == "Test4Error": + self._TestError4(error) + elif error.GetName() == "Test6Error": + self._TestError6(error) + else: + self.assertFalse(True) + + # Create a ValidationContext with plugins + context = Usd.ValidationContext( + [Plug.Registry().GetPluginWithName( + "testUsdValidationContextValidatorsPlugin")], True) + testLayer = self._CreateTestLayer() + stage = Usd.Stage.Open(testLayer) + errors = context.Validate(stage) + # 1 error for Test1 validator + # 2 error for Test2 validator - root layer and session layer + # 5 errors for Test3 generic prim validator which runs on all 5 prims + # 3 errors for Test4 testBaseType prim type validator which runs on + # the baseType, derivedType and nestedDerivedType prims + # 2 error for Test5 testDerivedType prim type validator which runs on + # the derivedType and nestedDerivedType prims + # 1 error for Test6 testNestedDerivedType prim type validator which + # runs on the nestedDerivedType prim + # 1 error for Test7 testAPISchema prim type validator which runs on + # the somePrim prim + self.assertEqual(len(errors), 15) + for error in errors: + if error.GetName() == "Test1Error": + self._TestError1(error) + elif error.GetName() == "Test2Error": + self._TestError2(error) + elif error.GetName() == "Test3Error": + self._TestError3(error) + elif error.GetName() == "Test4Error": + self._TestError4(error) + elif error.GetName() == "Test5Error": + self._TestError5(error) + elif error.GetName() == "Test6Error": + self._TestError6(error) + elif error.GetName() == "Test7Error": + self._TestError7(error) + else: + self.assertFalse(True) + +if __name__ == "__main__": + unittest.main() + diff --git a/pxr/usd/usd/wrapValidationContext.cpp b/pxr/usd/usd/wrapValidationContext.cpp new file mode 100644 index 0000000000..d6f63d3883 --- /dev/null +++ b/pxr/usd/usd/wrapValidationContext.cpp @@ -0,0 +1,81 @@ +// +// Copyright 2024 Pixar +// +// Licensed under the terms set forth in the LICENSE.txt file available at +// https:/(); + class_("ValidationContext", no_init) + .def(init( + (arg("keywords"), arg("includeAllAncestors") = true))) + .def(init( + (arg("plugins"), arg("includeAllAncestors") = true))) + .def(init( + (arg("metadata"), arg("includeAllAncestors") = true))) + .def(init &>(arg("schemaTypes"))) + .def(init &>(arg("validators"))) + .def(init &>(arg("suites"))) + .def("Validate", + +[](const UsdValidationContext &ctx, const SdfLayerHandle &layer) + -> UsdValidationErrorVector { + return ctx.Validate(layer); + }, + return_value_policy(), + (arg("layer"))) + .def("Validate", + +[](const UsdValidationContext &ctx, const UsdStagePtr &stage) + -> UsdValidationErrorVector { + return ctx.Validate(stage); + }, + return_value_policy(), + (arg("stage"))) + .def("Validate", + +[](const UsdValidationContext &ctx, const UsdStagePtr &stage, + const Usd_PrimFlagsPredicate &predicate) + -> UsdValidationErrorVector { + return ctx.Validate(stage, predicate); + }, + return_value_policy(), + (arg("stage"), arg("predicate"))) + .def("Validate", + +[](const UsdValidationContext &ctx, + const std::vector &prims) + -> UsdValidationErrorVector { + return ctx.Validate(prims); + }, + return_value_policy(), + (arg("prims"))) + .def("Validate", + +[](const UsdValidationContext &ctx, const UsdPrimRange &prims) + -> UsdValidationErrorVector { + return ctx.Validate(prims); + }, + return_value_policy(), + (arg("prims"))); +} diff --git a/pxr/usd/usd/wrapValidator.cpp b/pxr/usd/usd/wrapValidator.cpp index 1654115918..19aa0f6e35 100644 --- a/pxr/usd/usd/wrapValidator.cpp +++ b/pxr/usd/usd/wrapValidator.cpp @@ -84,6 +84,7 @@ void wrapUsdValidator() +[](const UsdValidatorMetadata &self) { return self.schemaTypes; }); + TfPyRegisterStlSequencesFromPython(); TfPyRegisterStlSequencesFromPython(); class_("Validator", no_init) @@ -118,6 +119,7 @@ void wrapUsdValidator() return left == right; }) .def("__repr__", &_Repr); + TfPyRegisterStlSequencesFromPython(); class_("ValidatorSuite", no_init) .def("GetMetadata", @@ -130,4 +132,5 @@ void wrapUsdValidator() +[](const UsdValidatorSuite *left, const UsdValidatorSuite *right) { return left == right; }); + TfPyRegisterStlSequencesFromPython(); } From 4e088c90399f9a34233121c75c25839c12e46098 Mon Sep 17 00:00:00 2001 From: tgvarik Date: Mon, 28 Oct 2024 15:25:03 -0700 Subject: [PATCH 73/82] [hdPrman] Role Lookup in SdrRegistry Riley requires accurate role information for certain integrator, projection, and display and sample filter parameters, Previously these were (partially, in the case of integrator params) retrieved with lookup tables in projectionParams.h/cpp. To reduce reliance on lookup tables, we change to using the SdrRegistry to look up the shader node and input associated with the object type and parameter name and retrieve role information from there. Also extends role setting for integrator params to those set via render settings prim. Deletes the now redundant projectionParams.h/cpp. (Internal change: 2345909) --- .../plugin/hdPrman/CMakeLists.txt | 3 +- .../plugin/hdPrman/projectionParams.cpp | 128 ----- .../plugin/hdPrman/projectionParams.h | 32 -- .../plugin/hdPrman/renderParam.cpp | 514 ++++++++++-------- 4 files changed, 302 insertions(+), 375 deletions(-) delete mode 100644 third_party/renderman-26/plugin/hdPrman/projectionParams.cpp delete mode 100644 third_party/renderman-26/plugin/hdPrman/projectionParams.h diff --git a/third_party/renderman-26/plugin/hdPrman/CMakeLists.txt b/third_party/renderman-26/plugin/hdPrman/CMakeLists.txt index bb04189919..9bb2dc8c9d 100644 --- a/third_party/renderman-26/plugin/hdPrman/CMakeLists.txt +++ b/third_party/renderman-26/plugin/hdPrman/CMakeLists.txt @@ -1,4 +1,4 @@ -# To be sure our VtVisitValue polyfill works correctly, the preprocessor must +# To be sure our VtVisitValue polyfill works correctly, the preprocessor must # resolve the #include in our identically-named # polyfill to the real one in libpxr. But CMAKE_INCLUDE_CURRENT_DIR injects the # cpp source directory as the first include search path. The preprocessor @@ -155,7 +155,6 @@ pxr_plugin(${PXR_PACKAGE} matfiltSceneIndexPlugins motionBlurSceneIndexPlugin pinnedCurveExpandingSceneIndexPlugin - projectionParams renderBuffer renderParam renderPass diff --git a/third_party/renderman-26/plugin/hdPrman/projectionParams.cpp b/third_party/renderman-26/plugin/hdPrman/projectionParams.cpp deleted file mode 100644 index 96c8e2940c..0000000000 --- a/third_party/renderman-26/plugin/hdPrman/projectionParams.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// -// Copyright 2019 Pixar -// -// Licensed under the terms set forth in the LICENSE.txt file available at -// https://openusd.org/license. -// -#include "hdPrman/projectionParams.h" -#include - -PXR_NAMESPACE_OPEN_SCOPE - -namespace HdPrman_ProjectionParams { - - void GetIntegratorParamRole(const TfToken& paramName, TfToken& role) -{ - static std::map _integratorParamMap = { - {TfToken("ri:integrator:PxrUnified:photonVisibilityRodMin"), TfToken("point")}, - {TfToken("ri:integrator:PxrUnified:photonVisibilityRodMax"), TfToken("point")}, - - {TfToken("ri:integrator:PxrVCM:photonGuidingBBoxMin"), TfToken("point")}, - {TfToken("ri:integrator:PxrVCM:photonGuidingBBoxMax"), TfToken("point")}, - - {TfToken("ri:integrator:PxrVisualizer:wireframeColor"), TfToken("color")} - }; - - const auto it = _integratorParamMap.find(paramName); - if (it != _integratorParamMap.end()) - { - role = it->second; - } -} - -void GetProjectionParamRole(TfToken& paramName, TfToken& role) -{ - static std::map _ProjectionParamMap = { - //// PxrPerspective - {TfToken("ri:projection:PxrPerspective:fovEnd"), TfToken("float")}, - - //// PxrCamera - {TfToken("ri:projection:PxrCamera:fovEnd"), TfToken("float")}, - // Tilt shift - {TfToken("ri:projection:PxrCamera:tilt"), TfToken("float")}, - {TfToken("ri:projection:PxrCamera:roll"), TfToken("float")}, - {TfToken("ri:projection:PxrCamera:focus1"), TfToken("point")}, - {TfToken("ri:projection:PxrCamera:focus2"), TfToken("point")}, - {TfToken("ri:projection:PxrCamera:focus3"), TfToken("point")}, - {TfToken("ri:projection:PxrCamera:shiftX"), TfToken("float")}, - {TfToken("ri:projection:PxrCamera:shiftY"), TfToken("float")}, - // Lens Distortion - {TfToken("ri:projection:PxrCamera:radial1"), TfToken("float")}, - {TfToken("ri:projection:PxrCamera:radial2"), TfToken("float")}, - {TfToken("ri:projection:PxrCamera:assymX"), TfToken("float")}, - {TfToken("ri:projection:PxrCamera:assymY"), TfToken("float")}, - {TfToken("ri:projection:PxrCamera:squeeze"), TfToken("float")}, - // Chromatic Aberration - {TfToken("ri:projection:PxrCamera:axial"), TfToken("color")}, - {TfToken("ri:projection:PxrCamera:transverse"), TfToken("color")}, - // Vignetting - {TfToken("ri:projection:PxrCamera:natural"), TfToken("float")}, - {TfToken("ri:projection:PxrCamera:optical"), TfToken("float")}, - // Shutter - {TfToken("ri:projection:PxrCamera:sweep"), TfToken("string")}, - {TfToken("ri:projection:PxrCamera:duration"), TfToken("float")}, - // Advanced - {TfToken("ri:projection:PxrCamera:detail"), TfToken("float")}, - {TfToken("ri:projection:PxrCamera:enhance"), TfToken("vector")}, - {TfToken("ri:projection:PxrCamera:matte"), TfToken("string")}, - - //// PxrCylinderCamera - {TfToken("ri:projection:PxrCylinderCamera:hsweep"), TfToken("float")}, - {TfToken("ri:projection:PxrCylinderCamera:vsweep"), TfToken("float")}, - - //// PxrSphereCamera - {TfToken("ri:projection:PxrSphereCamera:hsweep"), TfToken("float")}, - {TfToken("ri:projection:PxrSphereCamera:vsweep"), TfToken("float")}, - - //// OmnidirectionalStereo - {TfToken("ri:projection:OmnidirectionalStereo:interpupilaryDistance"), TfToken("float")} - }; - - const auto it = _ProjectionParamMap.find(paramName); - if (it != _ProjectionParamMap.end()) - { - role = it->second; - } -} - -void GetFilterParamRole(TfToken& paramName, TfToken& role) -{ - // color params won't work unless set in the param list as color - // rather than float3 - static const std::map _filterParamMap = { - {TfToken("PxrBackgroundSampleFilter:backgroundColor"), TfToken("color")}, - {TfToken("PxrGradeSampleFilter:blackPoint"), TfToken("color")}, - {TfToken("PxrGradeSampleFilter:whitePoint"), TfToken("color")}, - {TfToken("PxrGradeSampleFilter:lift"), TfToken("color")}, - {TfToken("PxrGradeSampleFilter:gain"), TfToken("color")}, - {TfToken("PxrGradeSampleFilter:multiply"), TfToken("color")}, - {TfToken("PxrGradeSampleFilter:gamma"), TfToken("color")}, - {TfToken("PxrGradeSampleFilter:offset"), TfToken("color")}, - {TfToken("PxrGradeSampleFilter:mask"), TfToken("color")}, - {TfToken("PxrBackgroundDisplayFilter:backgroundColor"), TfToken("color")}, - {TfToken("PxrImagePlaneFilter:colorGain"), TfToken("color")}, - {TfToken("PxrImagePlaneFilter:colorOffset"), TfToken("color")}, - {TfToken("PxrWhitePointSampleFilter:manualWhitePoint"), TfToken("color")}, - {TfToken("PxrGradeDisplayFilter:blackPoint"), TfToken("color")}, - {TfToken("PxrGradeDisplayFilter:whitePoint"), TfToken("color")}, - {TfToken("PxrGradeDisplayFilter:lift"), TfToken("color")}, - {TfToken("PxrGradeDisplayFilter:gain"), TfToken("color")}, - {TfToken("PxrGradeDisplayFilter:multiply"), TfToken("color")}, - {TfToken("PxrGradeDisplayFilter:gamma"), TfToken("color")}, - {TfToken("PxrGradeDisplayFilter:offset"), TfToken("color")}, - {TfToken("PxrGradeDisplayFilter:mask"), TfToken("color")}, - {TfToken("PxrImageDisplayFilter:colorGain"), TfToken("color")}, - {TfToken("PxrImageDisplayFilter:colorOffset"), TfToken("color")}, - {TfToken("PxrWhitePointDisplayFilter:manualWhitePoint"), TfToken("color")} - }; - - const auto it = _filterParamMap.find(paramName); - if (it != _filterParamMap.end()) - { - role = it->second; - } -} - -} // namespace HdPrman_ProjectionParams - -PXR_NAMESPACE_CLOSE_SCOPE diff --git a/third_party/renderman-26/plugin/hdPrman/projectionParams.h b/third_party/renderman-26/plugin/hdPrman/projectionParams.h deleted file mode 100644 index b253816d8a..0000000000 --- a/third_party/renderman-26/plugin/hdPrman/projectionParams.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// Copyright 2019 Pixar -// -// Licensed under the terms set forth in the LICENSE.txt file available at -// https://openusd.org/license. -// -#ifndef EXT_RMANPKG_25_0_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_PROJECTION_PARAMS_H -#define EXT_RMANPKG_25_0_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_PROJECTION_PARAMS_H - -#include "pxr/base/tf/token.h" - -PXR_NAMESPACE_OPEN_SCOPE - -// This file should be considered temporary and only exists -// because we currently are unable to ascertain parameter value -// roles from an HdRenderSettingsMap -// -// TODO: Stop setting these on RenderSettings prim. They should be set on -// the integrator/camera/filter prims to which they apply. If they are not -// in usdRiPxr schema, they should be added there. - -namespace HdPrman_ProjectionParams { - - void GetIntegratorParamRole(const TfToken& paramName, TfToken& role); - void GetProjectionParamRole(TfToken& paramName, TfToken& role); - void GetFilterParamRole(TfToken& paramName, TfToken& role); - -} // namespace HdPrman_ProjectionParams - -PXR_NAMESPACE_CLOSE_SCOPE - -#endif // EXT_RMANPKG_25_0_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_PROJECTION_PARAMS_H diff --git a/third_party/renderman-26/plugin/hdPrman/renderParam.cpp b/third_party/renderman-26/plugin/hdPrman/renderParam.cpp index 6ee733ea10..dcd43c1206 100644 --- a/third_party/renderman-26/plugin/hdPrman/renderParam.cpp +++ b/third_party/renderman-26/plugin/hdPrman/renderParam.cpp @@ -16,48 +16,103 @@ #include "hdPrman/material.h" #include "hdPrman/motionBlurSceneIndexPlugin.h" #include "hdPrman/prmanArchDefs.h" // required for stats/Session.h -#include "hdPrman/projectionParams.h" #include "hdPrman/renderDelegate.h" -#if PXR_VERSION >= 2308 -#include "hdPrman/renderSettings.h" -#endif +#include "hdPrman/renderViewContext.h" #include "hdPrman/rixStrings.h" -#include "hdPrman/tokens.h" #include "hdPrman/utils.h" +#include "pxr/imaging/hd/aov.h" +#include "pxr/imaging/hd/enums.h" #include "pxr/imaging/hd/extComputationUtils.h" +#include "pxr/imaging/hd/material.h" #include "pxr/imaging/hd/renderBuffer.h" +#include "pxr/imaging/hd/renderDelegate.h" #include "pxr/imaging/hd/renderThread.h" #include "pxr/imaging/hd/rprim.h" #include "pxr/imaging/hd/sceneDelegate.h" -#include "pxr/imaging/hd/sceneIndexPluginRegistry.h" +#include "pxr/imaging/hd/sprim.h" +#include "pxr/imaging/hd/timeSampleArray.h" +#include "pxr/imaging/hd/tokens.h" +#include "pxr/imaging/hd/types.h" #include "pxr/imaging/hd/version.h" #include "pxr/usd/sdf/path.h" +#include "pxr/usd/sdr/declare.h" +#include "pxr/usd/sdr/registry.h" +#include "pxr/usd/sdr/shaderNode.h" +#include "pxr/usd/sdr/shaderProperty.h" #include "pxr/base/arch/library.h" +#include "pxr/base/gf/vec2d.h" +#include "pxr/base/gf/vec2f.h" +#include "pxr/base/gf/vec2i.h" #include "pxr/base/plug/plugin.h" #include "pxr/base/plug/registry.h" #include "pxr/base/tf/debug.h" +#include "pxr/base/tf/diagnostic.h" +#include "pxr/base/tf/enum.h" #include "pxr/base/tf/envSetting.h" #include "pxr/base/tf/getenv.h" +#include "pxr/base/tf/iterator.h" #include "pxr/base/tf/pathUtils.h" // Extract extension from tf token +#include "pxr/base/tf/registryManager.h" #include "pxr/base/tf/scopeDescription.h" +#include "pxr/base/tf/staticData.h" +#include "pxr/base/tf/staticTokens.h" #include "pxr/base/tf/stringUtils.h" - -#if PXR_VERSION >= 2302 -#include "pxr/imaging/hd/retainedDataSource.h" -#include "pxr/imaging/hd/containerDataSourceEditor.h" -#endif - +#include "pxr/base/tf/token.h" +#include "pxr/base/trace/trace.h" +#include "pxr/base/vt/array.h" +#include "pxr/base/vt/dictionary.h" +#include "pxr/base/vt/types.h" +#include "pxr/pxr.h" + +#include +#include +#include #include #include +#include +#include +#include #include #include +#include +#include #include - +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include +#include +#include +#include +#include +#include + +#if PXR_VERSION >= 2302 +#include "pxr/imaging/hd/retainedDataSource.h" +#include "pxr/imaging/hd/containerDataSourceEditor.h" +#endif + +#if PXR_VERSION >= 2308 +#include "hdPrman/renderSettings.h" +#include "pxr/imaging/hd/renderSettings.h" +#endif PXR_NAMESPACE_OPEN_SCOPE @@ -80,11 +135,13 @@ TF_DEFINE_PRIVATE_TOKENS( ((riDisplayChannelNamespace, "ri:displayChannel:")) // See PxrDisplayDriverAPI ((riDisplayDriverNamespace, "ri:displayDriver:")) - + ((renderTagPrefix, "rendertag_")) (renderCameraPath) ((displayfilterPrefix, "ri:displayfilter")) ((samplefilterPrefix, "ri:samplefilter")) + + (PxrCryptomatte) ); TF_DEFINE_PRIVATE_TOKENS( @@ -182,7 +239,7 @@ HdPrman_RenderParam::HdPrman_RenderParam( TfRegistryManager::GetInstance().SubscribeTo(); _CreateRiley(rileyVariant, xpuCpuConfig, xpuGpuConfig, extraArgs); - + // Register RenderMan display driver HdPrmanFramebuffer::Register(_rix); @@ -211,7 +268,7 @@ HdPrman_RenderParam::IncrementLightLinkCount(TfToken const& name) ++_lightLinkRefs[name]; } -void +void HdPrman_RenderParam::DecrementLightLinkCount(TfToken const& name) { std::lock_guard lock(_lightLinkMutex); @@ -220,7 +277,7 @@ HdPrman_RenderParam::DecrementLightLinkCount(TfToken const& name) } } -bool +bool HdPrman_RenderParam::IsLightLinkUsed(TfToken const& name) { std::lock_guard lock(_lightLinkMutex); @@ -234,7 +291,7 @@ HdPrman_RenderParam::IncrementLightFilterCount(TfToken const& name) ++_lightFilterRefs[name]; } -void +void HdPrman_RenderParam::DecrementLightFilterCount(TfToken const& name) { std::lock_guard lock(_lightFilterMutex); @@ -243,7 +300,7 @@ HdPrman_RenderParam::DecrementLightFilterCount(TfToken const& name) } } -bool +bool HdPrman_RenderParam::IsLightFilterUsed(TfToken const& name) { std::lock_guard lock(_lightFilterMutex); @@ -277,7 +334,7 @@ _ConvertPointsPrimvar( #if HD_API_VERSION >= 68 shutterInterval[0], shutterInterval[1], -#endif +#endif &boxedPoints); } else { HdExtComputationUtils::SampledValueStore @@ -516,11 +573,11 @@ _Convert(HdSceneDelegate *sceneDelegate, SdfPath const& id, std::is_same, std::is_same>::value, "params must be RtParamList or RtPrimVarList"); - + // XXX:TODO: To support array-valued types, we need more // shaping information. Currently we assume arrays are // simply N scalar values, according to the detail. - + std::string label; if constexpr (std::is_same()) { label = "primvar"; @@ -541,14 +598,14 @@ _Convert(HdSceneDelegate *sceneDelegate, SdfPath const& id, // XXX: Prman doesn't seem to check dirtyness before pulling a value. // Passing AllDirty until we plumb/respect change tracking. HdExtComputationPrimvarDescriptorVector computedPrimvars = - _GetComputedPrimvars(sceneDelegate, id, hdInterp, + _GetComputedPrimvars(sceneDelegate, id, hdInterp, HdChangeTracker::AllDirty); if (!computedPrimvars.empty()) { // Execute the computations HdExtComputationUtils::ValueStore valueStore = HdExtComputationUtils::GetComputedPrimvarValues( computedPrimvars, sceneDelegate); - + for (auto const& compPrimvar : computedPrimvars) { auto const it = valueStore.find(compPrimvar.name); if (!TF_VERIFY(it != valueStore.end())) { @@ -571,7 +628,7 @@ _Convert(HdSceneDelegate *sceneDelegate, SdfPath const& id, name.CStr(), TfStringify(val).c_str()); - if (val.IsArrayValued() && + if (val.IsArrayValued() && val.GetArraySize() != static_cast(expectedSize)) { TF_WARN("<%s> primvar '%s' size (%zu) did not match " "expected (%d)", id.GetText(), @@ -703,7 +760,7 @@ _Convert(HdSceneDelegate *sceneDelegate, SdfPath const& id, TF_WARN("<%s> provided multiple representations of the primvar " "'%s'", id.GetText(), name.CStr()); } - // When both ri:attributes and primvar:ri:attributes versions of + // When both ri:attributes and primvar:ri:attributes versions of // the same primvars exist, the primvar:ri:attributes version should // win out. if (hasRiAttributesPrefix && !hasPrimvarsPrefix && @@ -749,7 +806,7 @@ _Convert(HdSceneDelegate *sceneDelegate, SdfPath const& id, // For non-constant primvars, check array size to make sure it // matches the expected topology size. if (hdInterp != HdInterpolationConstant && - val.IsArrayValued() && + val.IsArrayValued() && val.GetArraySize() != static_cast(expectedSize)) { TF_WARN("<%s> %s '%s' size (%zu) did not match " "expected (%d)", id.GetText(), label.c_str(), @@ -817,14 +874,14 @@ HdPrman_TransferMaterialPrimvarOpinions(HdSceneDelegate *sceneDelegate, const HdPrmanMaterial *material = dynamic_cast(sprim); if (material && material->IsValid()) { - const HdMaterialNetwork2 & matNetwork = + const HdMaterialNetwork2 & matNetwork = material->GetMaterialNetwork(); for (const auto & nodeIt : matNetwork.nodes) { const HdMaterialNode2 & node = nodeIt.second; if (node.nodeTypeId == _tokens->PrimvarPass) { for (const auto ¶m : node.parameters) { uint32_t paramId; - RtUString paramName = + RtUString paramName = RtUString(param.first.GetText()); if (!primvars.GetParamId(paramName, paramId)) { HdPrman_Utils::SetPrimVarFromVtValue(paramName, @@ -892,7 +949,7 @@ HdPrman_RenderParam::ConvertAttributes(HdSceneDelegate *sceneDelegate, // e.g., the cards drawmode adapter. // TODO: (tgvarik) Check how Ri:ReverseOrientation interacts with - // displacement. What is intended when front-face culling is applied + // displacement. What is intended when front-face culling is applied // to a surface with displacement? Should be vanishingly rare. const HdCullStyle cullStyle = sceneDelegate->GetCullStyle(id); @@ -907,11 +964,11 @@ HdPrman_RenderParam::ConvertAttributes(HdSceneDelegate *sceneDelegate, attrs.SetInteger(RixStr.k_Ri_Sides, 1); break; case HdCullStyleFrontUnlessDoubleSided: - attrs.SetInteger(RixStr.k_Ri_ReverseOrientation, + attrs.SetInteger(RixStr.k_Ri_ReverseOrientation, sceneDelegate->GetDoubleSided(id) ? 0 : 1); // fallthrough case HdCullStyleBackUnlessDoubleSided: - attrs.SetInteger(RixStr.k_Ri_Sides, + attrs.SetInteger(RixStr.k_Ri_Sides, sceneDelegate->GetDoubleSided(id) ? 2 : 1); break; case HdCullStyleDontCare: @@ -919,7 +976,7 @@ HdPrman_RenderParam::ConvertAttributes(HdSceneDelegate *sceneDelegate, // defer to Prman default by not setting Ri:Sides. break; } - + // Double-sidedness in usd is a property of the gprim for legacy reasons. // Double-sidedness in prman is a property of the material. To achieve @@ -935,7 +992,7 @@ HdPrman_RenderParam::ConvertAttributes(HdSceneDelegate *sceneDelegate, sceneDelegate->GetDoubleSided(id) ? 1 : 0 ); } - + return attrs; } @@ -1153,12 +1210,12 @@ HdPrman_RenderParam::UpdateLegacyOptions() RtUString riName; riName = RtUString(token.GetText()+3); - // XXX there is currently no way to distinguish the type of a + // XXX there is currently no way to distinguish the type of a // float3 setting (color, point, vector). All float3 settings are - // treated as float[3] until we have a way to determine the type. + // treated as float[3] until we have a way to determine the type. HdPrman_Utils::SetParamFromVtValue(riName, val, TfToken(), &options); } else { - + // ri: namespaced settings win over custom settings tokens when // present. if (token == HdRenderSettingsTokens->convergedSamplesPerPixel) { @@ -1183,7 +1240,7 @@ HdPrman_RenderParam::UpdateLegacyOptions() } else if (token == HdPrmanRenderSettingsTokens->pixelAspectRatio) { if (!_Contains(renderSettingsMap, _riOptionsTokens->riRiFormatPixelAspectRatio)) { - options.SetFloat(RixStr.k_Ri_FormatPixelAspectRatio, + options.SetFloat(RixStr.k_Ri_FormatPixelAspectRatio, val.UncheckedGet()); } @@ -1191,7 +1248,7 @@ HdPrman_RenderParam::UpdateLegacyOptions() if (!_Contains(renderSettingsMap, _riOptionsTokens->riRiFormatResolution)) { const GfVec2i& res = val.UncheckedGet(); - options.SetIntegerArray(RixStr.k_Ri_FormatResolution, + options.SetIntegerArray(RixStr.k_Ri_FormatResolution, res.data(), 2); } } else if (token == HdRenderSettingsTokens->threadLimit) { @@ -1208,7 +1265,7 @@ HdPrman_RenderParam::UpdateLegacyOptions() batchCommandLine = val; } // Note: HdPrmanRenderSettingsTokens->disableMotionBlur is handled in - // SetRileyShutterIntervalFromCameraContextCameraPath. + // SetRileyShutterIntervalFromCameraContextCameraPath. } } @@ -1225,23 +1282,49 @@ HdPrman_RenderParam::UpdateLegacyOptions() SetBatchCommandLineArgs(batchCommandLine, &options); } +static TfToken _GetShaderInputParamRole( + const TfToken& shader, + const TfToken& param) +{ + SdrRegistry& registry = SdrRegistry::GetInstance(); + const SdrShaderNode* entry = registry.GetShaderNodeByIdentifier(shader); + if (!entry) { + return TfToken(); + } + const SdrShaderProperty* input = entry->GetShaderInput(param); + if (!input) { + return TfToken(); + } + return input->GetType(); +} + void HdPrman_RenderParam::SetIntegratorParamsFromRenderSettingsMap( HdPrmanRenderDelegate *renderDelegate, const std::string& integratorName, RtParamList& params) { + // An integrator param in the render settings map looks like this: + // ri:integrator:: + // When asking Sdr for the param, the param name will look like this: + // ri: + // Finally, RenderMan expects to get the param name like this: + // + HdRenderSettingsMap renderSettings = renderDelegate->GetRenderSettingsMap(); - TfToken prefix(std::string("ri:integrator:") + integratorName + ":"); - for (auto const& entry : renderSettings) { + const TfToken prefix(std::string("ri:integrator:") + integratorName + ":"); + for (const auto& entry : renderSettings) { if (TfStringStartsWith(entry.first.GetText(), prefix.GetText())) { - // Strip namespace prefix from USD. - RtUString riName(entry.first.GetText() + prefix.size()); - TfToken role; - HdPrman_ProjectionParams::GetIntegratorParamRole(entry.first, role); - HdPrman_Utils::SetParamFromVtValue(riName, entry.second, - role, ¶ms); + // For RenderMan, strip the whole prefix + const RtUString riName(entry.first.GetText() + prefix.size()); + // for SdrRegistry, strip the prefix but re-prepend 'ri:' + const TfToken inputName( + "ri:" + entry.first.GetString().substr(prefix.size())); + const TfToken role = _GetShaderInputParamRole( + TfToken(integratorName), inputName); + HdPrman_Utils::SetParamFromVtValue( + riName, entry.second, role, ¶ms); } } } @@ -1252,22 +1335,27 @@ HdPrman_RenderParam::SetProjectionParamsFromRenderSettings( std::string& projectionName, RtParamList& params) { - HdRenderSettingsMap renderSettings = renderDelegate->GetRenderSettingsMap(); + // A projection param in the render settings map looks like this: + // ri:projection:: + // When asking Sdr for the param, the param name will look like this: + // ri: + // Finally, RenderMan expects to get the param name like this: + // - TfToken preFix(std::string("ri:projection:") + projectionName); - for (auto const& entry : renderSettings) { - TfToken token = entry.first; - VtValue val = entry.second; + HdRenderSettingsMap renderSettings = renderDelegate->GetRenderSettingsMap(); - bool hasRiPrefix = TfStringStartsWith(token.GetText(), - preFix.GetText()); - if (hasRiPrefix) { - // Strip namespace from USD. - RtUString riName; - riName = RtUString(token.GetText()+preFix.size()+1); - TfToken role; - HdPrman_ProjectionParams::GetProjectionParamRole(token, role); - HdPrman_Utils::SetParamFromVtValue(riName, val, role, ¶ms); + const TfToken prefix(std::string("ri:projection:") + projectionName + ":"); + for (const auto& entry : renderSettings) { + if (TfStringStartsWith(entry.first.GetText(), prefix.GetText())) { + // For RenderMan, strip the whole prefix + const RtUString riName(entry.first.GetText() + prefix.size()); + // for SdrRegistry, strip the prefix but re-prepend 'ri:' + const TfToken inputName( + "ri:" + entry.first.GetString().substr(prefix.size())); + const TfToken role = _GetShaderInputParamRole( + TfToken(projectionName), inputName); + HdPrman_Utils::SetParamFromVtValue( + riName, entry.second, role, ¶ms); } } } @@ -1646,26 +1734,21 @@ HdPrman_RenderParam::SetFiltersFromRenderSettings( return; } - for(auto const& prefix : prefixes) - { - - // Create shading nodes for each sample filter + for (auto const& prefix : prefixes) { + // Create shading nodes for each sample/display filter // They're numbered starting with 1 std::vector nodes; int nodeIdx = 0; bool isSample = (prefix == _tokens->samplefilterPrefix); - while(true) - { - std::string defaultFilterName("None"); + while (true) { + const std::string defaultFilterName("None"); std::string nmStr = prefix.GetText(); nmStr += std::to_string(nodeIdx); nmStr += ":name"; - std::string filterName = - renderDelegate->GetRenderSetting( - TfToken(nmStr.c_str()), - defaultFilterName); - if(!filterName.empty() && filterName != "None") - { + auto filterName = + renderDelegate->GetRenderSetting( + TfToken(nmStr.c_str()), defaultFilterName); + if (!filterName.empty() && filterName != "None") { riley::ShadingNode sn; sn.name = RtUString(filterName.c_str()); std::string handle = filterName += std::to_string(nodeIdx); @@ -1674,9 +1757,7 @@ HdPrman_RenderParam::SetFiltersFromRenderSettings( riley::ShadingNode::Type::k_SampleFilter : riley::ShadingNode::Type::k_DisplayFilter; nodes.push_back(sn); - } - else - { + } else { break; } nodeIdx++; @@ -1685,65 +1766,66 @@ HdPrman_RenderParam::SetFiltersFromRenderSettings( // Append filters collected from shading nodes, // which is not currently the primary workflow, // but they may be present - if(isSample) - { - for(auto it = _sampleFilters.begin(); - it != _sampleFilters.end(); ++it) - { - nodes.push_back(it->second); + if (isSample) { + for (const auto& sampleFilter : _sampleFilters) { + nodes.push_back(sampleFilter.second); } - } - else - { - for(auto it = _displayFilters.begin(); - it != _displayFilters.end(); ++it) - { - nodes.push_back(it->second); + } else { + for (const auto& displayFilter : _displayFilters) { + nodes.push_back(displayFilter.second); } } _sampleFiltersDirty = false; _displayFiltersDirty = false; - if(!nodes.empty()) - { + if (!nodes.empty()) { for (auto const& entry : renderSettings) { - TfToken token = entry.first; - VtValue val = entry.second; - bool hasRiPrefix = TfStringStartsWith(token.GetText(), - prefix.GetText()); - if (hasRiPrefix) { - std::vector toks = TfStringSplit(token, ":"); + // Filter params in render settings map look like this: + // ri::: + // Note that 'prefix' (set above for outer loop) will be: + // ri: + // So we can extract the index, filter name, and param name + // by first stripping the prefix, then splitting on ':' + + if (TfStringStartsWith( + entry.first.GetString(), prefix.GetText())) { + const std::vector toks = TfStringSplit( + entry.first.GetString().substr(prefix.size()), ":"); + // toks[0] : index + // toks[1] : filter name + // toks[2] : param name unsigned long idx = 0; - // strip off the index - // eg. ri:samplefilter0:PxrBackgroundSampleFilter:name - // eg. ri:displayfilter0:PxrBackgroundSampleFilter:name - RtUString riName;; - if(toks.size() == 4) - { - int offset = isSample ? 12 : 13; - std::string idxStr(toks[1].begin()+offset, toks[1].end()); - if(!idxStr.empty()) - idx = std::stoi(idxStr); + RtUString riName; + if (toks.size() == 3 && !toks[0].empty()) { + try { + idx = std::stoi(toks[0]); + } catch (const std::logic_error& e) { + TF_WARN("Malformed sample/display filter param " + "name in render settings: '%s'", + entry.first.GetText()); + continue; + } } - if(toks.size() != 4 || - idx >= nodes.size()) + if (toks.size() != 3 || idx >= nodes.size()) { continue; - std::vector toks2; - toks2.push_back(toks[2]); - toks2.push_back(toks[3]); - riName = RtUString(toks2[1].c_str()); - token = TfToken(TfStringJoin(toks2, ":")); + } + riName = RtUString(toks[2].c_str()); + const TfToken inputName("ri:" + toks[2]); + const TfToken shaderName(toks[1]); + + // copy the value + VtValue value = entry.second; // Some specific fixes for cryptomatte sample filter - if (isSample && toks[2] == "PxrCryptomatte") { - _AddCryptomatteFixes(riName, val); + if (isSample && shaderName == _tokens->PxrCryptomatte) { + _AddCryptomatteFixes(riName, value); } - TfToken role; - HdPrman_ProjectionParams::GetFilterParamRole(token, role); + const TfToken role = _GetShaderInputParamRole( + shaderName, inputName); - HdPrman_Utils::SetParamFromVtValue(riName, val, - role, &nodes[idx].params); + HdPrman_Utils::SetParamFromVtValue( + riName, value, role, &nodes[idx].params); } } @@ -1791,7 +1873,7 @@ HdPrman_RenderParam::SetIntegratorParamsFromCamera( } } -void +void HdPrman_RenderParam::RegisterIntegratorCallbackForCamera( IntegratorCameraCallback const& callback) { @@ -1882,7 +1964,7 @@ HdPrman_RenderParam::_CreateStatsSession(void) HdRetainedTypedSampledDataSource::New(serverId)); // Finalize addition of scene index information - _statsSceneIndex->AddPrims({{SdfPath("/globals"), TfToken("globals"), + _statsSceneIndex->AddPrims({{SdfPath("/globals"), TfToken("globals"), editor.Finish()}}); #endif #endif @@ -2058,7 +2140,7 @@ HdPrman_RenderParam::_CreateRiley(const std::string &rileyVariant, } } -struct RenderOutputDataTypeDesc +struct RenderOutputDataTypeDesc { riley::RenderOutputType rileyType; RtUString fileDataType; @@ -2205,7 +2287,7 @@ _GetOutputDisplayDriverType(const std::string &extension) { std::string("tiff"), TfToken("tiff") }, { std::string("png"), TfToken("png") } }; - + const auto it = extToDisplayDriver.find(extension); if (it != extToDisplayDriver.end()) { return RtUString(it->second.GetText()); @@ -2305,7 +2387,7 @@ _ComputeRenderViewDesc( VtDictionaryGet>( renderSpec, HdPrmanExperimentalRenderSpecTokens->renderVars); - + for (const VtValue &renderVarVal : renderVars) { const VtDictionary renderVar = renderVarVal.Get(); @@ -2351,7 +2433,7 @@ _ComputeRenderViewDesc( _tokens->riDisplayChannelNamespace); renderViewDesc.renderOutputDescs.push_back(renderOutputDesc); } - + const std::vector & renderProducts = VtDictionaryGet>( renderSpec, @@ -2395,8 +2477,8 @@ _ComputeRenderViewDesc( // Forward declaration of helper to create Render Output in the RenderViewDesc static RtUString -_AddRenderOutput(RtUString aovName, - const TfToken &dataType, HdFormat aovFormat, +_AddRenderOutput(RtUString aovName, + const TfToken &dataType, HdFormat aovFormat, RtUString sourceName, const RtParamList ¶ms, const RtUString& filter, const GfVec2f& filterWidth, std::vector *renderOutputDescs, @@ -2454,7 +2536,7 @@ _ComputeRenderViewDesc( if (renderVarIt != seenRenderVars.end()) { displayDesc.renderOutputIndices.push_back(renderVarIt->second); continue; - } + } seenRenderVars.insert( std::pair(renderVar.varPath, renderVarIndex)); displayDesc.renderOutputIndices.push_back(renderVarIndex); @@ -2466,21 +2548,21 @@ _ComputeRenderViewDesc( std::string aovNameStr = (renderVar.sourceType == _tokens->lpe) ? renderVar.varPath.GetName() : renderVar.sourceName; - std::string sourceNameStr = (renderVar.sourceType == _tokens->lpe) + std::string sourceNameStr = (renderVar.sourceType == _tokens->lpe) ? "lpe:" + renderVar.sourceName : renderVar.sourceName; const RtUString aovName(aovNameStr.c_str()); const RtUString sourceName(sourceNameStr.c_str()); - // Create a RenderOutputDesc for this RenderVar and add it to the + // Create a RenderOutputDesc for this RenderVar and add it to the // renderViewDesc. - // Note that we are not using the renderOutputIndices passed into + // Note that we are not using the renderOutputIndices passed into // this function, we are instead relying on the indices stored above std::vector renderOutputIndices; - _AddRenderOutput(aovName, - renderVar.dataType, + _AddRenderOutput(aovName, + renderVar.dataType, HdFormatInvalid, // using renderVar.dataType - sourceName, + sourceName, _ToRtParamList(renderVar.namespacedSettings, _tokens->riDisplayChannelNamespace), defaultPixelFilter, defaultPixelFilterWidth, @@ -2508,13 +2590,13 @@ HdPrman_RenderParam::CreateRenderViewFromRenderSpec( TF_DEBUG(HDPRMAN_RENDER_PASS) .Msg("Create Riley RenderView from the RenderSpec.\n"); - + GetRenderViewContext().CreateRenderView(renderViewDesc, AcquireRiley()); } #if PXR_VERSION >= 2308 /// XXX This should eventually replace the above use of the RenderSpec -void +void HdPrman_RenderParam::CreateRenderViewFromRenderSettingsProducts( HdRenderSettings::RenderProducts const &products, HdPrman_RenderViewContext *renderViewContext) @@ -2524,8 +2606,8 @@ HdPrman_RenderParam::CreateRenderViewFromRenderSettingsProducts( const HdPrman_RenderViewDesc renderViewDesc = _ComputeRenderViewDesc( products, - GetCameraContext().GetCameraId(), - GetActiveIntegratorId(), + GetCameraContext().GetCameraId(), + GetActiveIntegratorId(), GetSampleFilterList(), GetDisplayFilterList()); @@ -2717,7 +2799,7 @@ HdPrman_RenderParam::_ComputeIntegratorNode( const HdPrmanCamera * const cam) { #if PXR_VERSION >= 2308 - // Use the integrator node from a terminal connection on the + // Use the integrator node from a terminal connection on the // renderSettingsPrim if we can if (!GetRenderSettingsIntegratorPath().IsEmpty()) { @@ -2729,14 +2811,16 @@ HdPrman_RenderParam::_ComputeIntegratorNode( rileyIntegratorNode.name = RtUString(integratorNodeType.GetText()); rileyIntegratorNode.handle = RtUString(integratorNodeType.GetText()); - // Initialize the Integrator parameters + // Initialize the Integrator parameters const TfToken prefix("ri:"); for (const auto ¶m : GetRenderSettingsIntegratorNode().parameters) { // Strip the 'ri' namespace before setting the param if (TfStringStartsWith(param.first.GetText(), prefix.GetText())) { - RtUString riName(param.first.GetText() + prefix.size()); - HdPrman_Utils::SetParamFromVtValue(riName, param.second, - TfToken(), &rileyIntegratorNode.params); + const RtUString riName(param.first.GetText() + prefix.size()); + const TfToken role = _GetShaderInputParamRole( + integratorNodeType, param.first); + HdPrman_Utils::SetParamFromVtValue( + riName, param.second, role, &rileyIntegratorNode.params); } } @@ -2747,7 +2831,7 @@ HdPrman_RenderParam::_ComputeIntegratorNode( integratorNodeType.GetString(), rileyIntegratorNode.params); } - + // TODO: Adjust when PxrPathTracer adds support for excludeSubset if (integratorNodeType == HdPrmanIntegratorTokens->PbsPathTracer || integratorNodeType == HdPrmanIntegratorTokens->PxrUnified) { @@ -2783,7 +2867,7 @@ HdPrman_RenderParam::_ComputeIntegratorNode( integratorName, _integratorParams); } - + // TODO: Adjust when PxrPathTracer adds support for excludeSubset if (integratorName == HdPrmanIntegratorTokens->PbsPathTracer.GetString() || integratorName == HdPrmanIntegratorTokens->PxrUnified.GetString()) { @@ -2812,7 +2896,7 @@ HdPrman_RenderParam::_CreateIntegrator(HdRenderDelegate * const renderDelegate) riley::UserId( stats::AddDataLocation(integratorNode.name.CStr()).GetValue()), integratorNode); - + TF_VERIFY(_integratorId != riley::IntegratorId::InvalidId()); _activeIntegratorId = _integratorId; @@ -2826,17 +2910,17 @@ HdPrman_RenderParam::SetActiveRenderTags( // sort the active tags for set_difference TfTokenVector sortedTags(activeRenderTags); std::sort(sortedTags.begin(), sortedTags.end()); - + // set for uniqueness, ordered for set_difference - std::set rprimTags; + std::set rprimTags; for (const SdfPath& id : renderIndex->GetRprimIds()) { const HdRprim* rprim = renderIndex->GetRprim(id); rprimTags.insert(rprim->GetRenderTag()); } - + // fast set for comparison with cached TfToken::Set excludedTags; - + // All rprim tags not in activeTags should be excluded (rprim - active) std::set_difference( rprimTags.begin(), rprimTags.end(), @@ -2859,10 +2943,10 @@ HdPrman_RenderParam::AddRenderTagToGroupingMembership( if (!renderTag.IsEmpty()) { const std::string renderTagString = TfStringPrintf("%s%s", _tokens->renderTagPrefix.GetText(), renderTag.GetText()); - + RtUString membership; params.GetString(RixStr.k_grouping_membership, membership); - + if (membership.Empty()) { membership = RtUString(renderTagString.c_str()); } else { @@ -2910,16 +2994,16 @@ HdPrman_RenderParam::UpdateIntegrator(const HdRenderIndex * const renderIndex) AcquireRiley()->ModifyIntegrator(_integratorId, &node); } -void +void HdPrman_RenderParam::_RenderThreadCallback() { static RtUString const US_RENDERMODE = RtUString("renderMode"); static RtUString const US_INTERACTIVE = RtUString("interactive"); static RtUString const US_PROGRESSMODE = RtUString("progressMode"); - // Note: this is currently hard-coded because hdprman currently + // Note: this is currently hard-coded because hdprman currently // creates only one single camera (via the camera context). - // When this changes, we will need to make sure + // When this changes, we will need to make sure // the correct name is used here. RtUString const &defaultReferenceCamera = GetCameraContext().GetCameraName(); @@ -2927,7 +3011,7 @@ HdPrman_RenderParam::_RenderThreadCallback() RtParamList renderOptions; renderOptions.SetString(US_RENDERMODE, US_INTERACTIVE); renderOptions.SetString( - RixStr.k_dice_referencecamera, + RixStr.k_dice_referencecamera, defaultReferenceCamera); renderOptions.SetInteger(US_PROGRESSMODE, _progressMode); @@ -2940,7 +3024,7 @@ HdPrman_RenderParam::_RenderThreadCallback() renderOptions); } -void +void HdPrman_RenderParam::_ProgressCallback(RixEventCallbacks::Event, RtConstPointer data, RtPointer clientData) { @@ -2956,18 +3040,18 @@ HdPrman_RenderParam::_ProgressCallback(RixEventCallbacks::Event, } } -bool +bool HdPrman_RenderParam::IsValid() const { return _riley; } -void +void HdPrman_RenderParam::Begin(HdPrmanRenderDelegate *renderDelegate) { // Initialize legacy options from the render settings map. UpdateLegacyOptions(); - + // Force initialization of Riley scene options. // (see related comments in SetRileyOptions) #if PXR_VERSION >= 2311 // avoid deferring for now because can cause crash @@ -2977,7 +3061,7 @@ HdPrman_RenderParam::Begin(HdPrmanRenderDelegate *renderDelegate) { SetRileyOptions(); } - + // Set the camera path before the first sync so that // HdPrmanCamera::Sync can detect whether it is syncing the // current camera and needs to set the riley shutter interval @@ -3170,7 +3254,7 @@ HdPrman_RenderParam::SetRileyOptions() _envOptions, _rileySceneIndexObserverOptions, #if PXR_VERSION >= 2311 // causes issues for houdini 20, eg. bad shutter interval - _renderSettingsPrimOptions, + _renderSettingsPrimOptions, #endif GetLegacyOptions(), _fallbackOptions); @@ -3204,7 +3288,7 @@ HdPrman_RenderParam::SetRileyOptions() } } -void +void HdPrman_RenderParam::SetActiveIntegratorId(const riley::IntegratorId id) { _activeIntegratorId = id; @@ -3214,7 +3298,7 @@ HdPrman_RenderParam::SetActiveIntegratorId(const riley::IntegratorId id) GetRenderViewContext().SetIntegratorId(id, riley); } -void +void HdPrman_RenderParam::StartRender() { // Last chance to set Ri options before starting riley! @@ -3242,7 +3326,7 @@ HdPrman_RenderParam::StartRender() _renderThread->StartRender(); } -void +void HdPrman_RenderParam::End() { DeleteRenderThread(); @@ -3324,7 +3408,7 @@ HdPrman_RenderParam::_UpdatePixelFilter() // Riley API is modified to set filter and filter width as an option, we // need to get the render setting ourselves and set it for each AOV. - // WARNING: Defaults are hardcoded. + // WARNING: Defaults are hardcoded. // Make sure they match the values in PRManOptions.args. #if _PRMANAPI_VERSION_MAJOR_ >= 26 static const std::string defaultPixelFilter("gaussian"); @@ -3353,14 +3437,14 @@ HdPrman_RenderParam::_UpdatePixelFilter() bool HdPrman_RenderParam::_UpdateQNSettings() -{ +{ // look for QN settings const HdRenderSettingsMap renderSettingsMap = _renderDelegate->GetRenderSettingsMap(); - const bool useQN = _renderDelegate->GetRenderSetting(TfToken("rmanEnableQNDenoise"), false); - const bool qnCheapPass = _renderDelegate->GetRenderSetting(TfToken("rmanQNCheapPass"), false); - const int qnMinSamples = _renderDelegate->GetRenderSetting(TfToken("rmanQNMinSamples"), 2); - const int qnInterval = _renderDelegate->GetRenderSetting(TfToken("rmanQNInterval"), 4); + const bool useQN = _renderDelegate->GetRenderSetting(TfToken("rmanEnableQNDenoise"), false); + const bool qnCheapPass = _renderDelegate->GetRenderSetting(TfToken("rmanQNCheapPass"), false); + const int qnMinSamples = _renderDelegate->GetRenderSetting(TfToken("rmanQNMinSamples"), 2); + const int qnInterval = _renderDelegate->GetRenderSetting(TfToken("rmanQNInterval"), 4); if (useQN != _useQN || qnCheapPass != _qnCheapPass || qnMinSamples != _qnMinSamples || qnInterval != _qnInterval) { @@ -3374,7 +3458,7 @@ HdPrman_RenderParam::_UpdateQNSettings() } static riley::RenderOutputType -_ToRenderOutputTypeFromHdFormat(const HdFormat aovFormat) +_ToRenderOutputTypeFromHdFormat(const HdFormat aovFormat) { // Prman only supports float, color, and integer if(aovFormat == HdFormatFloat32) { @@ -3391,7 +3475,7 @@ _ToRenderOutputTypeFromHdFormat(const HdFormat aovFormat) // If the aovFormat has 3 or 4 channels, make format Float32 static void -_AdjustColorFormat(HdFormat* aovFormat) +_AdjustColorFormat(HdFormat* aovFormat) { // Prman always renders colors as float, so for types with 3 or 4 // components, always set the format in our framebuffer to float. @@ -3406,9 +3490,9 @@ _AdjustColorFormat(HdFormat* aovFormat) } } -// Update the given Rman AOV and Source names +// Update the given Rman AOV and Source names // - aovName: Map the given hdAovName to the Prman equivalent -// - SourceName: Add 'lpe:' prefix as needed +// - SourceName: Add 'lpe:' prefix as needed static void _UpdateRmanAovAndSourceName( const TfToken &hdAovName, @@ -3439,7 +3523,7 @@ _UpdateRmanAovAndSourceName( } if(rmanSourceName->Empty()) { - // Update the Aov and Source names by mapping the HdAovName to an + // Update the Aov and Source names by mapping the HdAovName to an // equivalent Prman name if (hdAovName == HdAovTokens->color || hdAovName.GetString() == "ci") { *rmanAovName = RixStr.k_Ci; @@ -3496,8 +3580,8 @@ _GetOutputParamsAndUpdateRmanNames( settingVal.GetWithDefault().GetString(); } - // Gather all properties with the 'driver:parameters:aov' prefix - // into the RtParamList, updating the hdAovName if needed. + // Gather all properties with the 'driver:parameters:aov' prefix + // into the RtParamList, updating the hdAovName if needed. else if (TfStringStartsWith( settingName.GetText(), "driver:parameters:aov:") || TfStringStartsWith( @@ -3564,12 +3648,12 @@ HdPrman_RenderParam::_CreateRileyDisplay( PlugRegistry::GetInstance().GetPluginWithName("hdPrman")) { const std::string path = TfGetPathName(plugin->GetPath()); if (!path.empty()) { - hdPrmanPath = + hdPrmanPath = TfStringCatPaths(path, "hdPrman" ARCH_LIBRARY_SUFFIX); } driver = RtUString("quicklyNoiseless"); displayParams.SetString(RtUString("dspyDSOPath"), RtUString(hdPrmanPath.c_str())); - displayParams.SetInteger(RtUString("cheaPass"), (int) _qnCheapPass); + displayParams.SetInteger(RtUString("cheaPass"), (int) _qnCheapPass); displayParams.SetInteger(RtUString("minSamples"), _qnMinSamples); displayParams.SetInteger(RtUString("interval"), _qnInterval); displayParams.SetInteger(RtUString("normalAsColor"), 1); @@ -3642,7 +3726,11 @@ _AddRenderOutput( } // Get the relativePixelVariance and remap from the given RtParamList +#if _PRMANAPI_VERSION_MAJOR_ >= 26 + float relativePixelVariance = 0.0f; +#else float relativePixelVariance = 1.0f; +#endif params.GetFloat(RixStr.k_relativepixelvariance, relativePixelVariance); RtParamList extraParams; @@ -3681,7 +3769,7 @@ _AddRenderOutput( TF_DEBUG(HDPRMAN_RENDER_PASS) .Msg("Add RenderOutputDesc: \n - name: '%s'\n - type: '%d'\n" " - sourceName: '%s'\n - rule: '%s'\n - filter: '%s'\n\n", - aovName.CStr(), int(rType), sourceName.CStr(), + aovName.CStr(), int(rType), sourceName.CStr(), rule.CStr(), filter.CStr()); renderOutputDescs->push_back(std::move(renderOutputDesc)); @@ -3855,8 +3943,8 @@ HdPrman_RenderParam::CreateFramebufferAndRenderViewFromAovs( // isn't the intent in case it becomes a problem. auto rsrvd = _ComputeRenderViewDesc(renderSettings->GetRenderProducts(), - renderViewDesc.cameraId, - renderViewDesc.integratorId, + renderViewDesc.cameraId, + renderViewDesc.integratorId, renderViewDesc.sampleFilterList, renderViewDesc.displayFilterList); @@ -3897,7 +3985,7 @@ HdPrman_RenderParam::CreateRenderViewFromLegacyProducts( const VtArray& renderProducts, int frame) { // Display edits are not currently supported in HdPrman - // RenderMan Display drivers are inteded for use in batch rendering, + // RenderMan Display drivers are inteded for use in batch rendering, // so bail here if Riley has already been started, since this means that // the Displays already exist. if (renderProducts.empty() || @@ -3913,12 +4001,12 @@ HdPrman_RenderParam::CreateRenderViewFromLegacyProducts( // Here we loop over the Render Products (a USD concept which corresponds // to a Riley Display), make a list of Riley Displays, and collect a list // of all the outputs (AOVs) used by the Displays. - // One Target will be used for all Displays, it needs to be created + // One Target will be used for all Displays, it needs to be created // before the Displays, and takes a list of all possible outputs (AOVs). - // + // // The View and Displays are created, each referencing the Target's id. - // - // XXX In the future, when xpu supports it, we may want to change this to + // + // XXX In the future, when xpu supports it, we may want to change this to // allow for a different Target/View for each Display. HdPrman_RenderViewDesc renderViewDesc; @@ -3945,7 +4033,7 @@ HdPrman_RenderParam::CreateRenderViewFromLegacyProducts( } else if (settingName == HdPrmanRenderProductTokens->orderedVars) { VtArray orderedVars = settingVal.UncheckedGet>(); - + // Find Ci and a Outputs in the RenderVar list int Ci_idx = -1; int a_idx = -1; @@ -3971,7 +4059,7 @@ HdPrman_RenderParam::CreateRenderViewFromLegacyProducts( } // Populate the AOVs Array from the RenderVar list making sure - // that the Ci and a RenderVars are first. + // that the Ci and a RenderVars are first. aovs.reserve(orderedVars.size()); if (Ci_idx >= 0 && Ci_idx < static_cast(orderedVars.size())) { aovs.push_back(orderedVars[Ci_idx]); @@ -3998,8 +4086,8 @@ HdPrman_RenderParam::CreateRenderViewFromLegacyProducts( // If an --output or -o has been specified on command line, override the // product's name and expand variables: - // : source prim (render product node name) - // , , , , , : frame number with padding + // : source prim (render product node name) + // , , , , , : frame number with padding // : the ordinial frame number // Vars can also use dollar style (braces optional) eg. $F4 // ${F4} $OS or printf style formatting: %04d @@ -4028,7 +4116,7 @@ HdPrman_RenderParam::CreateRenderViewFromLegacyProducts( productName = TfToken(outputName); } - // Build Display Settings ParamList using the driverParameters gathered + // Build Display Settings ParamList using the driverParameters gathered // above from the Render Product Settings RtParamList displayParams; for (const TfToken& paramName : driverParameters) { @@ -4057,7 +4145,7 @@ HdPrman_RenderParam::CreateRenderViewFromLegacyProducts( } } - // Keep a list of the indices for the Render Outputs (AOVs/RenderVars) + // Keep a list of the indices for the Render Outputs (AOVs/RenderVars) // of this Display (RenderProduct) // renderViewDesc.renderOutputDescs is a list of all Render Outputs // across all Displays, these renderOutputIndices index into that list. @@ -4075,7 +4163,7 @@ HdPrman_RenderParam::CreateRenderViewFromLegacyProducts( HdFormatFloat32); _AdjustColorFormat(&aovFormat); - // RmanSourceName + // RmanSourceName RtUString rmanSourceName = _GetAsRtUString(aov, HdPrmanAovSettingsTokens->sourceName); @@ -4191,7 +4279,7 @@ HdPrman_RenderParam::_ComputeQuickIntegratorNode( static const RtUString numBxdfSamples("numBxdfSamples"); _quickIntegratorParams.SetInteger(numLightSamples, 1); - _quickIntegratorParams.SetInteger(numBxdfSamples, 1); + _quickIntegratorParams.SetInteger(numBxdfSamples, 1); return riley::ShadingNode{ riley::ShadingNode::Type::k_Integrator, @@ -4233,7 +4321,7 @@ HdPrman_RenderParam::UpdateQuickIntegrator( _ComputeQuickIntegratorNode( renderIndex->GetRenderDelegate(), _cameraContext.GetCamera(renderIndex)); - + AcquireRiley()->ModifyIntegrator( _quickIntegratorId, &node); @@ -4337,7 +4425,7 @@ HdPrman_RenderParam::SetRenderSettingsIntegratorPath( if (! HdRenderIndex::IsSceneIndexEmulationEnabled()) { // Mark the Integrator Prim Dirty sceneDelegate->GetRenderIndex().GetChangeTracker() - .MarkSprimDirty(renderSettingsIntegratorPath, + .MarkSprimDirty(renderSettingsIntegratorPath, HdChangeTracker::DirtyParams); } _renderSettingsIntegratorPath = renderSettingsIntegratorPath; @@ -4349,7 +4437,7 @@ HdPrman_RenderParam::SetRenderSettingsIntegratorPath( } } -void +void HdPrman_RenderParam::SetRenderSettingsIntegratorNode( HdRenderIndex *renderIndex, HdMaterialNode2 const &integratorNode) { @@ -4453,16 +4541,16 @@ HdPrman_RenderParam::CreateSampleFilterNetwork(HdSceneDelegate *sceneDelegate) filterArrayName, filterRefs.data(), filterRefs.size()); shadingNodes.push_back(combinerNode); } - + // Create or update the Riley SampleFilters riley::ShadingNetwork const sampleFilterNetwork = { static_cast(shadingNodes.size()), &shadingNodes[0] }; - + if (_sampleFiltersId == riley::SampleFilterId::InvalidId()) { _sampleFiltersId = AcquireRiley()->CreateSampleFilter( riley::UserId(stats::AddDataLocation("/sampleFilters"). GetValue()), - sampleFilterNetwork, + sampleFilterNetwork, RtParamList()); } else { @@ -4510,16 +4598,16 @@ HdPrman_RenderParam::CreateDisplayFilterNetwork(HdSceneDelegate *sceneDelegate) filterArrayName, filterRefs.data(), filterRefs.size()); shadingNodes.push_back(combinerNode); } - + // Create or update the Riley DisplayFilters riley::ShadingNetwork const displayFilterNetwork = { static_cast(shadingNodes.size()), &shadingNodes[0] }; - + if (_displayFiltersId == riley::DisplayFilterId::InvalidId()) { _displayFiltersId = AcquireRiley()->CreateDisplayFilter( riley::UserId(stats::AddDataLocation("/displayFilters"). GetValue()), - displayFilterNetwork, + displayFilterNetwork, RtParamList()); } else { @@ -4562,7 +4650,7 @@ HdPrman_RenderParam::AddDisplayFilter( filterIt.first->second = node; } - // If we have all the Shading Nodes, creat the DisplayFilters in Riley + // If we have all the Shading Nodes, creat the DisplayFilters in Riley if (_displayFilterNodes.size() == _connectedDisplayFilterPaths.size()) { CreateDisplayFilterNetwork(sceneDelegate); } @@ -4571,7 +4659,7 @@ HdPrman_RenderParam::AddDisplayFilter( riley::SampleFilterList HdPrman_RenderParam::GetSampleFilterList() { - return (_sampleFiltersId == riley::SampleFilterId::InvalidId()) + return (_sampleFiltersId == riley::SampleFilterId::InvalidId()) ? riley::SampleFilterList({ 0, nullptr }) : riley::SampleFilterList({ 1, &_sampleFiltersId }); } @@ -4588,7 +4676,7 @@ void HdPrman_RenderParam::_CreateFallbackLight() { static const RtUString us_PxrDomeLight("PxrDomeLight"); - static const RtUString us_lightA("lightA"); + static const RtUString us_lightA("lightA"); static const RtUString us_traceLightPaths("traceLightPaths"); static const RtUString us_lightGroup("lightGroup"); static const RtUString us_A("A"); @@ -4607,9 +4695,9 @@ HdPrman_RenderParam::_CreateFallbackLight() }; _fallbackLightShader = _riley->CreateLightShader( riley::UserId::DefaultId(), {1, &lightNode}, {0, nullptr}); - + riley::CoordinateSystemList const k_NoCoordsys = { 0, nullptr }; - + // Constant identity transform const float zerotime[1] = { 0.0f }; const RtMatrix4x4 matrix[1] = { RixConstants::k_IdentityMatrix }; From 324f17e7a89bbb28fe73e0d7ec75ca70fd1b2588 Mon Sep 17 00:00:00 2001 From: sunyab Date: Tue, 29 Oct 2024 11:07:04 -0700 Subject: [PATCH 74/82] build: Set /Zc:__cplusplus for Visual Studio builds This ensures the __cplusplus preprocessor symbol is set to the correct value for the C++ standard being used. Otherwise, Visual Studio sets __cplusplus to 199711L for backwards compatibility reasons. (Internal change: 2345929) --- cmake/defaults/msvcdefaults.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/defaults/msvcdefaults.cmake b/cmake/defaults/msvcdefaults.cmake index 13d77d0ae7..e8823599ae 100644 --- a/cmake/defaults/msvcdefaults.cmake +++ b/cmake/defaults/msvcdefaults.cmake @@ -11,6 +11,13 @@ set(_PXR_CXX_FLAGS "${_PXR_CXX_FLAGS} /EHsc") # Standards compliant. set(_PXR_CXX_FLAGS "${_PXR_CXX_FLAGS} /Zc:rvalueCast /Zc:strictStrings") +# Visual Studio sets the value of __cplusplus to 199711L regardless of +# the C++ standard actually being used, unless /Zc:__cplusplus is enabled. +# +# For more details, see: +# https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus +set(_PXR_CXX_FLAGS "${_PXR_CXX_FLAGS} /Zc:__cplusplus") + # The /Zc:inline option strips out the "arch_ctor_" symbols used for # library initialization by ARCH_CONSTRUCTOR starting in Visual Studio 2019, # causing release builds to fail. Disable the option for this and later From 9814aca097639b2ee82cb1b9bbf17f42e276f0d8 Mon Sep 17 00:00:00 2001 From: clach Date: Tue, 29 Oct 2024 11:07:26 -0700 Subject: [PATCH 75/82] [usdviewq] Remove ability to set "enableIdRender" param from usdview, which hasn't been exposed for a while now. If users wish to view prim ids, they should switch to viewing the primId AOV. (Internal change: 2345966) --- pxr/usdImaging/usdviewq/appController.py | 9 --------- pxr/usdImaging/usdviewq/mainWindowUI.ui | 8 -------- pxr/usdImaging/usdviewq/stageView.py | 4 ++-- pxr/usdImaging/usdviewq/viewSettingsDataModel.py | 11 ----------- 4 files changed, 2 insertions(+), 30 deletions(-) diff --git a/pxr/usdImaging/usdviewq/appController.py b/pxr/usdImaging/usdviewq/appController.py index 6e60a3acd5..e09297b8c7 100644 --- a/pxr/usdImaging/usdviewq/appController.py +++ b/pxr/usdImaging/usdviewq/appController.py @@ -897,9 +897,6 @@ def __init__(self, parserData, resolverContextFn): self._ui.actionDisplay_Camera_Oracles.triggered.connect( self._toggleDisplayCameraOracles) - self._ui.actionDisplay_PrimId.triggered.connect( - self._toggleDisplayPrimId) - self._ui.actionEnable_Scene_Materials.triggered.connect( self._toggleEnableSceneMaterials) @@ -2648,10 +2645,6 @@ def _toggleDisplayCameraOracles(self): self._dataModel.viewSettings.displayCameraOracles = ( self._ui.actionDisplay_Camera_Oracles.isChecked()) - def _toggleDisplayPrimId(self): - self._dataModel.viewSettings.displayPrimId = ( - self._ui.actionDisplay_PrimId.isChecked()) - def _toggleEnableSceneMaterials(self): self._dataModel.viewSettings.enableSceneMaterials = ( self._ui.actionEnable_Scene_Materials.isChecked()) @@ -5370,8 +5363,6 @@ def _refreshViewMenu(self): self._dataModel.viewSettings.enableSceneMaterials) self._ui.actionEnable_Scene_Lights.setChecked( self._dataModel.viewSettings.enableSceneLights) - self._ui.actionDisplay_PrimId.setChecked( - self._dataModel.viewSettings.displayPrimId) self._ui.actionCull_Backfaces.setChecked( self._dataModel.viewSettings.cullBackfaces) self._ui.actionDomeLightTexturesVisible.setChecked( diff --git a/pxr/usdImaging/usdviewq/mainWindowUI.ui b/pxr/usdImaging/usdviewq/mainWindowUI.ui index 94c7a01586..69de7637cf 100644 --- a/pxr/usdImaging/usdviewq/mainWindowUI.ui +++ b/pxr/usdImaging/usdviewq/mainWindowUI.ui @@ -2414,14 +2414,6 @@ Render - - - true - - - Display Prim Id - - true diff --git a/pxr/usdImaging/usdviewq/stageView.py b/pxr/usdImaging/usdviewq/stageView.py index 782760b15e..dc620a0880 100644 --- a/pxr/usdImaging/usdviewq/stageView.py +++ b/pxr/usdImaging/usdviewq/stageView.py @@ -1452,8 +1452,8 @@ def renderSinglePass(self, renderMode, renderSelHighlights): if self._dataModel.viewSettings.cullBackfaces else UsdImagingGL.CullStyle.CULL_STYLE_NOTHING) self._renderParams.gammaCorrectColors = False - self._renderParams.enableIdRender = self._dataModel.viewSettings.displayPrimId - self._renderParams.enableSampleAlphaToCoverage = not self._dataModel.viewSettings.displayPrimId + self._renderParams.enableIdRender = False + self._renderParams.enableSamlpeAlphaToCoverage = True self._renderParams.highlight = renderSelHighlights self._renderParams.enableSceneMaterials = self._dataModel.viewSettings.enableSceneMaterials self._renderParams.domeLightCameraVisibility = self._dataModel.viewSettings.domeLightTexturesVisible diff --git a/pxr/usdImaging/usdviewq/viewSettingsDataModel.py b/pxr/usdImaging/usdviewq/viewSettingsDataModel.py index f0493e4e8a..319dd33c2c 100644 --- a/pxr/usdImaging/usdviewq/viewSettingsDataModel.py +++ b/pxr/usdImaging/usdviewq/viewSettingsDataModel.py @@ -165,7 +165,6 @@ def __init__(self, rootDataModel, parent): self._displayGuide = self.stateProperty("displayGuide", default=False) self._displayProxy = self.stateProperty("displayProxy", default=True) self._displayRender = self.stateProperty("displayRender", default=False) - self._displayPrimId = self.stateProperty("displayPrimId", default=False) self._enableSceneMaterials = self.stateProperty("enableSceneMaterials", default=True) self._enableSceneLights = self.stateProperty("enableSceneLights", default=True) self._cullBackfaces = self.stateProperty("cullBackfaces", default=False) @@ -238,7 +237,6 @@ def onSaveState(self, state): state["displayGuide"] = self._displayGuide state["displayProxy"] = self._displayProxy state["displayRender"] = self._displayRender - state["displayPrimId"] = self._displayPrimId state["enableSceneMaterials"] = self._enableSceneMaterials state["enableSceneLights"] = self._enableSceneLights state["cullBackfaces"] = self._cullBackfaces @@ -552,15 +550,6 @@ def displayCameraOracles(self): def displayCameraOracles(self, value): self._displayCameraOracles = value - @property - def displayPrimId(self): - return self._displayPrimId - - @displayPrimId.setter - @visibleViewSetting - def displayPrimId(self, value): - self._displayPrimId = value - @property def enableSceneMaterials(self): return self._enableSceneMaterials From 524ad40d6d6b69998b11f03b85138cc5940feef5 Mon Sep 17 00:00:00 2001 From: clach Date: Tue, 29 Oct 2024 11:11:04 -0700 Subject: [PATCH 76/82] Improvements to prim id rendering in Storm. One goal of this change is to move away from using "enableIdRender" in UsdImagingGLRenderParams and HdxRenderTaskParams to indicate prim id rendering, and instead move to requesting primId as a separate AOV. Currently, when one wants to do id rendering and sets enableIdRender to true, Storm will render prim ids to the default/color AOV. We instead want to use a primId AOV, which has an int32 format. This change adds support for rendering to an int32 format AOV. This change also introduces the renderPassShaderKey, which is used to flexibly generate a renderPassShader based on the desired AOVs. The AOVs currently supported by this in Storm are color, primId and instanceId, and Neye. There is still support for rendering primIds using the previous method i.e. requesting it via "enableIdRender". This support will be deprecated in the coming months, which will clean up some of the logic required to support both xodepaths. (Internal change: 2345969) --- pxr/imaging/hdSt/CMakeLists.txt | 1 + pxr/imaging/hdSt/renderDelegate.cpp | 2 +- pxr/imaging/hdSt/renderPassShader.cpp | 46 +++++ pxr/imaging/hdSt/renderPassShader.h | 9 + pxr/imaging/hdSt/renderPassShaderKey.cpp | 161 ++++++++++++++++++ pxr/imaging/hdSt/renderPassShaderKey.h | 54 ++++++ pxr/imaging/hdSt/renderPassState.cpp | 8 +- pxr/imaging/hdSt/resourceRegistry.cpp | 10 ++ pxr/imaging/hdSt/resourceRegistry.h | 11 ++ pxr/imaging/hdSt/shaderKey.cpp | 5 +- pxr/imaging/hdSt/shaderKey.h | 19 ++- pxr/imaging/hdSt/shaders/renderPass.glslfx | 76 ++++++++- .../hdSt/shaders/renderPassShader.glslfx | 5 +- pxr/imaging/hdSt/testenv/testHdStCodeGen.cpp | 14 +- .../baseline/codegen_curves_indirect.out | 27 ++- .../baseline/codegen_mesh_edgeonly.out | 54 +++++- .../codegen_mesh_edgeonly_blendwireframe.out | 54 +++++- .../baseline/codegen_mesh_indirect.out | 54 +++++- .../codegen_mesh_indirect_doubleSided.out | 54 +++++- .../codegen_mesh_indirect_faceVarying.out | 54 +++++- .../codegen_mesh_indirect_instance.out | 54 +++++- .../codegen_mesh_indirect_smoothNormals.out | 54 +++++- .../baseline/codegen_points_indirect.out | 27 ++- .../baseline/codegen_curves_indirect.out | 27 ++- .../baseline/codegen_mesh_edgeonly.out | 54 +++++- .../codegen_mesh_edgeonly_blendwireframe.out | 54 +++++- .../baseline/codegen_mesh_indirect.out | 54 +++++- .../codegen_mesh_indirect_doubleSided.out | 54 +++++- .../codegen_mesh_indirect_faceVarying.out | 54 +++++- .../codegen_mesh_indirect_instance.out | 54 +++++- .../codegen_mesh_indirect_smoothNormals.out | 54 +++++- .../baseline/codegen_points_indirect.out | 27 ++- .../hdSt/testenv/testHdStCurvesPrimvars.cpp | 19 ++- .../hdSt/testenv/testHdStDrawBatching.cpp | 14 +- .../hdSt/testenv/testHdStDynamicUvTexture.cpp | 6 +- .../hdSt/testenv/testHdStMeshTopology.cpp | 14 +- .../hdSt/testenv/testHdStPrimitiveParam.cpp | 15 +- .../hdSt/testenv/testHdStQuadrangulation.cpp | 13 +- .../testenv/testHdStSamplerObjectRegistry.cpp | 7 +- .../hdSt/testenv/testHdStSubdivision.cpp | 13 +- .../testenv/testHdStTextureHandleRegistry.cpp | 7 +- .../testenv/testHdStTextureObjectRegistry.cpp | 6 +- pxr/imaging/hdSt/unitTestHelper.cpp | 11 ++ pxr/imaging/hdSt/unitTestHelper.h | 8 + pxr/imaging/hdx/pickTask.cpp | 4 +- pxr/imaging/hdx/renderSetupTask.cpp | 95 ++++++++--- pxr/imaging/hdx/renderSetupTask.h | 5 +- pxr/imaging/hdx/shaders/renderPass.glslfx | 28 ++- .../hdx/shaders/renderPassColorShader.glslfx | 6 +- .../hdx/shaders/renderPassIdShader.glslfx | 3 +- .../hdx/shaders/renderPassShadowShader.glslfx | 6 +- pxr/imaging/hdx/testenv/testHdxIdRender.cpp | 1 - pxr/imaging/hgiGL/ops.cpp | 24 ++- pxr/imaging/hgiVulkan/graphicsCmds.cpp | 27 ++- pxr/usdImaging/usdImagingGL/engine.cpp | 36 +++- pxr/usdImaging/usdImagingGL/engine.h | 17 +- ...sdImagingGLAovVisualization_Storm_Neye.png | Bin 0 -> 55568 bytes ...ImagingGLAovVisualization_Storm_primId.png | Bin 0 -> 16470 bytes .../testenv/testUsdImagingGLBasicDrawing.cpp | 1 - .../testUsdImagingGLBasicDrawing_id.png | Bin 14572 -> 14623 bytes .../testenv/testUsdImagingGLHighlight.cpp | 1 - .../testUsdImagingGLPickAndHighlight.cpp | 2 - 62 files changed, 1523 insertions(+), 151 deletions(-) create mode 100644 pxr/imaging/hdSt/renderPassShaderKey.cpp create mode 100644 pxr/imaging/hdSt/renderPassShaderKey.h create mode 100644 pxr/usdImaging/usdImagingGL/testenv/testUsdImagingGLAovVisualization/baseline/testUsdImagingGLAovVisualization_Storm_Neye.png create mode 100644 pxr/usdImaging/usdImagingGL/testenv/testUsdImagingGLAovVisualization/baseline/testUsdImagingGLAovVisualization_Storm_primId.png diff --git a/pxr/imaging/hdSt/CMakeLists.txt b/pxr/imaging/hdSt/CMakeLists.txt index 1aca8b0eb6..407f022a3e 100644 --- a/pxr/imaging/hdSt/CMakeLists.txt +++ b/pxr/imaging/hdSt/CMakeLists.txt @@ -170,6 +170,7 @@ pxr_library(hdSt pipelineDrawBatch pointsShaderKey quadrangulate + renderPassShaderKey resourceBinder shaderKey subdivision diff --git a/pxr/imaging/hdSt/renderDelegate.cpp b/pxr/imaging/hdSt/renderDelegate.cpp index 37d22c5127..d35c0cf1c1 100644 --- a/pxr/imaging/hdSt/renderDelegate.cpp +++ b/pxr/imaging/hdSt/renderDelegate.cpp @@ -321,7 +321,7 @@ HdStRenderDelegate::GetDefaultAovDescriptor(TfToken const& name) const VtValue(HdDepthStencilType(1.0f, 0))); } else if (_AovHasIdSemantic(name)) { return HdAovDescriptor( - HdFormatUNorm8Vec4, colorDepthMSAA, VtValue(GfVec4f(0))); + HdFormatInt32, colorDepthMSAA, VtValue(-1)); } else if (name == HdAovTokens->Neye) { return HdAovDescriptor( HdFormatUNorm8Vec4, colorDepthMSAA, VtValue(GfVec4f(0))); diff --git a/pxr/imaging/hdSt/renderPassShader.cpp b/pxr/imaging/hdSt/renderPassShader.cpp index a6f3fc9dd2..d3ba975e56 100644 --- a/pxr/imaging/hdSt/renderPassShader.cpp +++ b/pxr/imaging/hdSt/renderPassShader.cpp @@ -13,6 +13,7 @@ #include "pxr/imaging/hdSt/materialParam.h" #include "pxr/imaging/hdSt/renderBuffer.h" #include "pxr/imaging/hdSt/renderPassShader.h" +#include "pxr/imaging/hdSt/renderPassShaderKey.h" #include "pxr/imaging/hdSt/resourceBinder.h" #include "pxr/imaging/hdSt/textureBinder.h" #include "pxr/imaging/hdSt/textureHandle.h" @@ -327,4 +328,49 @@ HdStRenderPassShader::UpdateAovInputTextures( } } +namespace { +size_t +_GetRenderPassShaderHash( + HdRenderPassAovBindingVector const &aovBindings, + const HdStRenderPassState * const renderPassState) +{ + size_t hash = 0; + + // Aov binding names determine the configuration of the render pass shader + // key. + for (const auto& aovBinding : aovBindings) { + hash = TfHash::Combine(hash, aovBinding.aovName); + } + + // We want each renderPassState to have its own renderPassShader, so + // include renderPassState in the hash. + hash = TfHash::Combine(hash, renderPassState); + + return hash; +} +} + +// static +HdStRenderPassShaderSharedPtr +HdStRenderPassShader::CreateRenderPassShaderFromAovs( + HdStRenderPassState *renderPassState, + HdStResourceRegistrySharedPtr const &resourceRegistry, + HdRenderPassAovBindingVector const &aovBindings) +{ + HdInstance renderPassShaderInstance = + resourceRegistry->RegisterRenderPassShader( + _GetRenderPassShaderHash(aovBindings, renderPassState)); + + if (renderPassShaderInstance.IsFirstInstance()) { + HdSt_RenderPassShaderKey shaderKey(aovBindings); + std::istringstream s(shaderKey.GetGlslfxString()); + HioGlslfxSharedPtr glslfx = std::make_shared(s); + + renderPassShaderInstance.SetValue( + std::make_shared(glslfx)); + } + + return renderPassShaderInstance.GetValue(); +} + PXR_NAMESPACE_CLOSE_SCOPE diff --git a/pxr/imaging/hdSt/renderPassShader.h b/pxr/imaging/hdSt/renderPassShader.h index 3b1dd3f3af..34e4ef7b72 100644 --- a/pxr/imaging/hdSt/renderPassShader.h +++ b/pxr/imaging/hdSt/renderPassShader.h @@ -23,6 +23,7 @@ PXR_NAMESPACE_OPEN_SCOPE using HdStRenderPassShaderSharedPtr = std::shared_ptr; +class HdStRenderPassState; class HdRenderIndex; using HdRenderPassAovBindingVector = std::vector; @@ -84,6 +85,14 @@ class HdStRenderPassShader : public HdStShaderCode { HdRenderPassAovBindingVector const &aovInputBindings, HdRenderIndex * const renderIndex); + HDST_API + static + HdStRenderPassShaderSharedPtr + CreateRenderPassShaderFromAovs( + HdStRenderPassState *renderPassState, + HdStResourceRegistrySharedPtr const &resourceRegistry, + HdRenderPassAovBindingVector const &aovBindings); + private: HioGlslfxSharedPtr _glslfx; mutable size_t _hash; diff --git a/pxr/imaging/hdSt/renderPassShaderKey.cpp b/pxr/imaging/hdSt/renderPassShaderKey.cpp new file mode 100644 index 0000000000..3e08168cb8 --- /dev/null +++ b/pxr/imaging/hdSt/renderPassShaderKey.cpp @@ -0,0 +1,161 @@ +// +// Copyright 2024 Pixar +// +// Licensed under the terms set forth in the LICENSE.txt file available at +// https://openusd.org/license. +// +#include "pxr/pxr.h" +#include "pxr/imaging/hdSt/renderPassShaderKey.h" +#include "pxr/imaging/hd/tokens.h" + +#include "pxr/base/tf/staticTokens.h" + +PXR_NAMESPACE_OPEN_SCOPE + + +TF_DEFINE_PRIVATE_TOKENS( + _tokens, + // Glslfx files to include + ((renderPassGlslfx, "renderPass.glslfx")) + ((selectionGlslfx, "selection.glslfx")) + + // render pass mixins + ((renderPassCamera, "RenderPass.Camera")) + ((renderPassCameraFS, "RenderPass.CameraFS")) + ((renderPassApplyClipPlanes, "RenderPass.ApplyClipPlanes")) + ((renderPassApplyColorOverrides, "RenderPass.ApplyColorOverrides")) + ((renderPassRenderOutput, "RenderPass.RenderOutput")) + ((renderPassNoSelection, "RenderPass.NoSelection")) + ((renderPassNoColorOverrides, "RenderPass.NoColorOverrides")) + + // selection mixins + ((selectionDecodeUtils, "Selection.DecodeUtils")) + ((selectionComputeColor, "Selection.ComputeColor")) + + // Render AOV outputs mixins + ((renderPassRenderColor, "RenderPass.RenderColor")) + ((renderPassRenderColorNoOp, "RenderPass.RenderColorNoOp")) + + ((renderPassRenderId, "RenderPass.RenderId")) + ((renderPassRenderIdNoOp, "RenderPass.RenderIdNoOp")) + + ((renderPassRenderNeye, "RenderPass.RenderNeye")) + ((renderPassRenderNeyeNoOp, "RenderPass.RenderNeyeNoOp")) +); + +static +bool +_AovHasIdSemantic(TfToken const & name) +{ + // For now id render only means primId or instanceId. + return name == HdAovTokens->primId || + name == HdAovTokens->instanceId; +} + +HdSt_RenderPassShaderKey::HdSt_RenderPassShaderKey( + const HdRenderPassAovBindingVector& aovBindings) + : glslfx(_tokens->renderPassGlslfx) +{ + bool renderColor = false; + bool renderId = false; + bool renderNeye = false; + + for (size_t i = 0; i < aovBindings.size(); ++i) { + if (!renderColor && aovBindings[i].aovName == HdAovTokens->color) { + renderColor = true; + } + if (!renderId && _AovHasIdSemantic(aovBindings[i].aovName)) { + renderId = true; + } + if (!renderNeye && aovBindings[i].aovName == HdAovTokens->Neye) { + renderNeye = true; + } + } + + VS[0] = _tokens->renderPassCamera; + VS[1] = _tokens->renderPassApplyClipPlanes; + VS[2] = TfToken(); + + PTCS[0] = _tokens->renderPassCamera; + PTCS[1] = TfToken(); + + PTVS[0] = _tokens->renderPassCamera; + PTVS[1] = _tokens->renderPassApplyClipPlanes; + PTVS[2] = TfToken(); + + TCS[0] = _tokens->renderPassCamera; + TCS[1] = TfToken(); + + TES[0] = _tokens->renderPassCamera; + TES[1] = _tokens->renderPassApplyClipPlanes; + TES[2] = TfToken(); + + GS[0] = _tokens->renderPassCamera; + GS[1] = _tokens->renderPassApplyClipPlanes; + GS[2] = TfToken(); + + uint8_t fsIndex = 0; + FS[fsIndex++] = _tokens->renderPassCamera; + FS[fsIndex++] = _tokens->renderPassCameraFS; + + if (renderColor) { + FS[fsIndex++] = _tokens->selectionDecodeUtils; + FS[fsIndex++] = _tokens->selectionComputeColor; + FS[fsIndex++] = _tokens->renderPassApplyColorOverrides; + FS[fsIndex++] = _tokens->renderPassRenderColor; + } else { + FS[fsIndex++] = _tokens->renderPassNoSelection; + FS[fsIndex++] = _tokens->renderPassNoColorOverrides; + FS[fsIndex++] = _tokens->renderPassRenderColorNoOp; + } + + if (renderId) { + FS[fsIndex++] = _tokens->renderPassRenderId; + } else { + FS[fsIndex++] = _tokens->renderPassRenderIdNoOp; + } + + if (renderNeye) { + FS[fsIndex++] = _tokens->renderPassRenderNeye; + } else { + FS[fsIndex++] = _tokens->renderPassRenderNeyeNoOp; + } + + FS[fsIndex++] = _tokens->renderPassRenderOutput; + FS[fsIndex++] = TfToken(); +} + +HdSt_RenderPassShaderKey::~HdSt_RenderPassShaderKey() = default; + +std::string +HdSt_RenderPassShaderKey::GetGlslfxString() const +{ + std::stringstream ss; + + ss << "-- glslfx version 0.1\n"; + + if (!GetGlslfxFilename().IsEmpty()) { + ss << "#import $TOOLS/hdSt/shaders/" + << GetGlslfxFilename().GetText() << "\n"; + } + // Additionally need one more import. + ss << "#import $TOOLS/hdx/shaders/" << _tokens->selectionGlslfx << "\n"; + + ss << "-- configuration\n" + << "{\"techniques\": {\"default\": {\n"; + + bool firstStage = true; + ss << _JoinTokens("vertexShader", GetVS(), &firstStage); + ss << _JoinTokens("tessControlShader", GetTCS(), &firstStage); + ss << _JoinTokens("tessEvalShader", GetTES(), &firstStage); + ss << _JoinTokens("postTessControlShader", GetPTCS(), &firstStage); + ss << _JoinTokens("postTessVertexShader", GetPTVS(), &firstStage); + ss << _JoinTokens("geometryShader", GetGS(), &firstStage); + ss << _JoinTokens("fragmentShader", GetFS(), &firstStage); + ss << "}}}\n"; + + return ss.str(); +} + + +PXR_NAMESPACE_CLOSE_SCOPE \ No newline at end of file diff --git a/pxr/imaging/hdSt/renderPassShaderKey.h b/pxr/imaging/hdSt/renderPassShaderKey.h new file mode 100644 index 0000000000..151dbb19ca --- /dev/null +++ b/pxr/imaging/hdSt/renderPassShaderKey.h @@ -0,0 +1,54 @@ +// +// Copyright 2024 Pixar +// +// Licensed under the terms set forth in the LICENSE.txt file available at +// https://openusd.org/license. +// +#ifndef PXR_IMAGING_HD_ST_RENDER_PASS_SHADER_KEY_H +#define PXR_IMAGING_HD_ST_RENDER_PASS_SHADER_KEY_H + +#include "pxr/pxr.h" +#include "pxr/imaging/hdSt/geometricShader.h" +#include "pxr/imaging/hdSt/shaderKey.h" +#include "pxr/imaging/hd/aov.h" +#include "pxr/base/tf/token.h" + +PXR_NAMESPACE_OPEN_SCOPE + +struct HdSt_RenderPassShaderKey : public HdSt_ShaderKey +{ + HDST_API + HdSt_RenderPassShaderKey(const HdRenderPassAovBindingVector& aovBindings); + HDST_API + ~HdSt_RenderPassShaderKey(); + + TfToken const &GetGlslfxFilename() const override { return glslfx; } + TfToken const *GetVS() const override { return VS; } + TfToken const *GetPTCS() const override { return PTCS; } + TfToken const *GetPTVS() const override { return PTVS; } + TfToken const *GetTCS() const override { return TCS; } + TfToken const *GetTES() const override { return TES; } + TfToken const *GetGS() const override { return GS; } + TfToken const *GetFS() const override { return FS; } + + HDST_API + std::string GetGlslfxString() const override; + + // Unused for HdSt_RenderPassShaderKey. + HdSt_GeometricShader::PrimitiveType GetPrimitiveType() const override { + return HdSt_GeometricShader::PrimitiveType::PRIM_POINTS; + } + + TfToken glslfx; + TfToken VS[3]; + TfToken PTCS[2]; + TfToken PTVS[3]; + TfToken TCS[2]; + TfToken TES[3]; + TfToken GS[3]; + TfToken FS[10]; +}; + +PXR_NAMESPACE_CLOSE_SCOPE + +#endif // PXR_IMAGING_HD_ST_RENDER_PASS_SHADER_KEY_H \ No newline at end of file diff --git a/pxr/imaging/hdSt/renderPassState.cpp b/pxr/imaging/hdSt/renderPassState.cpp index 1cd4918f4d..189a0a7ee7 100644 --- a/pxr/imaging/hdSt/renderPassState.cpp +++ b/pxr/imaging/hdSt/renderPassState.cpp @@ -490,11 +490,11 @@ HdStRenderPassState::SetLightingShader(HdStLightingShaderSharedPtr const &lighti } void -HdStRenderPassState::SetRenderPassShader(HdStRenderPassShaderSharedPtr const &renderPassShader) +HdStRenderPassState::SetRenderPassShader( + HdStRenderPassShaderSharedPtr const &renderPassShader) { _renderPassShader = renderPassShader; if (_renderPassStateBar) { - HdStBufferArrayRangeSharedPtr _renderPassStateBar_ = std::static_pointer_cast (_renderPassStateBar); @@ -856,6 +856,10 @@ GfVec4f _ToVec4f(const VtValue &v) const double val = v.UncheckedGet(); return GfVec4f(val); } + if (v.IsHolding()) { + const double val = v.UncheckedGet(); + return GfVec4f(val); + } if (v.IsHolding()) { const GfVec2f val = v.UncheckedGet(); return GfVec4f(val[0], val[1], 0.0, 1.0); diff --git a/pxr/imaging/hdSt/resourceRegistry.cpp b/pxr/imaging/hdSt/resourceRegistry.cpp index b4a06ded12..cc62846c3c 100644 --- a/pxr/imaging/hdSt/resourceRegistry.cpp +++ b/pxr/imaging/hdSt/resourceRegistry.cpp @@ -11,6 +11,7 @@ #include "pxr/imaging/hdSt/dispatchBuffer.h" #include "pxr/imaging/hdSt/glslProgram.h" #include "pxr/imaging/hdSt/interleavedMemoryManager.h" +#include "pxr/imaging/hdSt/renderPassShader.h" #include "pxr/imaging/hdSt/resourceRegistry.h" #include "pxr/imaging/hdSt/stagingBuffer.h" #include "pxr/imaging/hdSt/vboMemoryManager.h" @@ -137,6 +138,7 @@ HdStResourceRegistry::~HdStResourceRegistry() void HdStResourceRegistry::InvalidateShaderRegistry() { _geometricShaderRegistry.Invalidate(); + _renderPassShaderRegistry.Invalidate(); _glslfxFileRegistry.Invalidate(); #ifdef PXR_MATERIALX_SUPPORT_ENABLED _materialXShaderRegistry.Invalidate(); @@ -633,6 +635,13 @@ HdStResourceRegistry::RegisterGeometricShader( return _geometricShaderRegistry.GetInstance(id); } +HdInstance +HdStResourceRegistry::RegisterRenderPassShader( + HdInstance::ID id) +{ + return _renderPassShaderRegistry.GetInstance(id); +} + HdInstance HdStResourceRegistry::RegisterGLSLProgram( HdInstance::ID id) @@ -1097,6 +1106,7 @@ HdStResourceRegistry::_GarbageCollect() // Cleanup Shader registries _geometricShaderRegistry.GarbageCollect(); + _renderPassShaderRegistry.GarbageCollect(); _glslProgramRegistry.GarbageCollect(); _glslfxFileRegistry.GarbageCollect(); #ifdef PXR_MATERIALX_SUPPORT_ENABLED diff --git a/pxr/imaging/hdSt/resourceRegistry.h b/pxr/imaging/hdSt/resourceRegistry.h index d6f2b7e15c..ae2e10a6b3 100644 --- a/pxr/imaging/hdSt/resourceRegistry.h +++ b/pxr/imaging/hdSt/resourceRegistry.h @@ -49,6 +49,8 @@ using HdStShaderCodePtr = std::weak_ptr; using HdSt_GeometricShaderSharedPtr = std::shared_ptr; +using HdStRenderPassShaderSharedPtr = + std::shared_ptr; using HdStTextureHandleSharedPtr = std::shared_ptr; @@ -396,6 +398,11 @@ class HdStResourceRegistry final : public HdResourceRegistry HdInstance RegisterGeometricShader(HdInstance::ID id); + /// Register a render pass shader. + HDST_API + HdInstance + RegisterRenderPassShader(HdInstance::ID id); + /// Register a GLSL program into the program registry. HDST_API HdInstance @@ -661,6 +668,10 @@ class HdStResourceRegistry final : public HdResourceRegistry // geometric shader registry HdInstanceRegistry _geometricShaderRegistry; + + // render pass shader registry + HdInstanceRegistry + _renderPassShaderRegistry; // glsl shader program registry HdInstanceRegistry diff --git a/pxr/imaging/hdSt/shaderKey.cpp b/pxr/imaging/hdSt/shaderKey.cpp index 2b9dbeec5f..364ed9791c 100644 --- a/pxr/imaging/hdSt/shaderKey.cpp +++ b/pxr/imaging/hdSt/shaderKey.cpp @@ -96,9 +96,10 @@ HdSt_ShaderKey::ComputeHash() const return hash; } -static +/*static*/ std::string -_JoinTokens(const char *stage, TfToken const *tokens, bool *firstStage) +HdSt_ShaderKey::_JoinTokens( + const char *stage, TfToken const *tokens, bool *firstStage) { if ((!tokens) || tokens->IsEmpty()) return std::string(); diff --git a/pxr/imaging/hdSt/shaderKey.h b/pxr/imaging/hdSt/shaderKey.h index fe2d3c699c..36af8b254c 100644 --- a/pxr/imaging/hdSt/shaderKey.h +++ b/pxr/imaging/hdSt/shaderKey.h @@ -20,7 +20,7 @@ PXR_NAMESPACE_OPEN_SCOPE // Abstract interface for geometric shader keys that may be used to // construct a geometric shader. struct HdSt_ShaderKey { - typedef size_t ID; + using ID = size_t; HDST_API virtual ~HdSt_ShaderKey(); @@ -30,11 +30,6 @@ struct HdSt_ShaderKey { HDST_API ID ComputeHash() const; - // Stitches the glslfx filename and the shader stage mixin names into - // a string for consumption by HioGlslfx. - HDST_API - std::string GetGlslfxString() const; - // ------------------------------------------------------------------------- // Virtual interface // ------------------------------------------------------------------------- @@ -45,6 +40,11 @@ struct HdSt_ShaderKey { // define any functions it uses. virtual TfToken const &GetGlslfxFilename() const = 0; + // Stitches the glslfx filename and the shader stage mixin names into + // a string for consumption by HioGlslfx. + HDST_API + virtual std::string GetGlslfxString() const; + // Each shader stage specifies the various mixins to stitch together // via their token names. The Get* flavor of methods return the first // token in the array. @@ -96,8 +96,13 @@ struct HdSt_ShaderKey { // of the face-varying primvar accessors. Only relevant for mesh prims with // face-varying primvars. HDST_API - virtual HdSt_GeometricShader::FvarPatchType GetFvarPatchType() const; + virtual HdSt_GeometricShader::FvarPatchType GetFvarPatchType() const; +protected: + + HDST_API + static std::string _JoinTokens( + const char *stage, TfToken const *tokens, bool *firstStage); }; diff --git a/pxr/imaging/hdSt/shaders/renderPass.glslfx b/pxr/imaging/hdSt/shaders/renderPass.glslfx index 95433df404..c1d180b4fe 100644 --- a/pxr/imaging/hdSt/shaders/renderPass.glslfx +++ b/pxr/imaging/hdSt/shaders/renderPass.glslfx @@ -233,6 +233,17 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) return color; } +-- glsl RenderPass.RenderOutput + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + -- layout RenderPass.RenderColor [ @@ -241,23 +252,76 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -- glsl RenderPass.RenderColor -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } +-- glsl RenderPass.RenderColorNoOp + +void RenderColor(vec4 color) +{ + // do nothing +} + -- layout RenderPass.RenderId +[ + ["out", "int", "primIdOut"], + ["out", "int", "instanceIdOut"] +] + +-- glsl RenderPass.RenderId + +void RenderId() +{ + primIdOut = HdGet_primID(); + + // instanceIndex is a tuple of integers (num nested levels). + // for picking, we store global instanceId (instanceIndex[0]) in the + // selection framebuffer and then reconstruct the tuple in postprocess. + instanceIdOut = GetDrawingCoord().instanceIndex[0]; +} + +-- glsl RenderPass.RenderIdNoOp + +void RenderId() +{ + // do nothing +} + +-- layout RenderPass.RenderNeye + +[ + ["out", "vec4", "NeyeOut"] +] + +-- glsl RenderPass.RenderNeye + +void RenderNeye(vec3 Neye) +{ + NeyeOut = vec4(Neye, 1.0); +} + +-- glsl RenderPass.RenderNeyeNoOp + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + +-- layout RenderPass.RenderIdNoIdAov + [ ["out", "vec4", "primIdOut"], ["out", "vec4", "instanceIdOut"] ] --- glsl RenderPass.RenderId +-- glsl RenderPass.RenderIdNoIdAov -// XXX: This whole snippet is a little sketchy and should ideally be replaced -// with AoVs. We generate "primId" and "instanceId", and depending on how -// the client called glDrawBuffers, they will get one or both. +// XXX: This snippet is legacy code soon to be deprecated. It is used when the +// client asks for an id render using HdxRenderTaskParams rather than via an id +// aov. vec4 IntToVec4(int id) { @@ -282,4 +346,4 @@ void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) // selection framebuffer and then reconstruct the tuple in postprocess. int instanceId = GetDrawingCoord().instanceIndex[0]; instanceIdOut = IntToVec4(instanceId); -} +} \ No newline at end of file diff --git a/pxr/imaging/hdSt/shaders/renderPassShader.glslfx b/pxr/imaging/hdSt/shaders/renderPassShader.glslfx index cae3277529..dc1961135d 100644 --- a/pxr/imaging/hdSt/shaders/renderPassShader.glslfx +++ b/pxr/imaging/hdSt/shaders/renderPassShader.glslfx @@ -43,7 +43,10 @@ "RenderPass.CameraFS", "RenderPass.NoSelection", "RenderPass.ApplyColorOverrides", - "RenderPass.RenderColor" ] + "RenderPass.RenderColor", + "RenderPass.RenderIdNoOp", + "RenderPass.RenderNeyeNoOp", + "RenderPass.RenderOutput"] } } } diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen.cpp b/pxr/imaging/hdSt/testenv/testHdStCodeGen.cpp index c968776adc..9cffd2b109 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen.cpp +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen.cpp @@ -16,15 +16,20 @@ #include "pxr/imaging/hdSt/meshShaderKey.h" #include "pxr/imaging/hdSt/package.h" #include "pxr/imaging/hdSt/pointsShaderKey.h" +#include "pxr/imaging/hdSt/renderDelegate.h" #include "pxr/imaging/hdSt/renderPassShader.h" #include "pxr/imaging/hdSt/resourceBinder.h" #include "pxr/imaging/hdSt/resourceRegistry.h" #include "pxr/imaging/hd/drawingCoord.h" +#include "pxr/imaging/hd/driver.h" #include "pxr/imaging/hd/basisCurves.h" +#include "pxr/imaging/hd/renderIndex.h" #include "pxr/imaging/hd/rprimSharedData.h" #include "pxr/imaging/hd/tokens.h" +#include "pxr/imaging/hgi/tokens.h" + #include "pxr/imaging/glf/testGLContext.h" #include "pxr/imaging/hio/glslfx.h" #include "pxr/base/tf/errorMark.h" @@ -70,8 +75,13 @@ CodeGenTest(HdSt_ShaderKey const &key, bool instance, bool smoothNormals) HdStDrawItem drawItem(&sharedData); static HgiUniquePtr hgi = Hgi::CreatePlatformDefaultHgi(); - static HdStResourceRegistrySharedPtr registry( - new HdStResourceRegistry(hgi.get())); + static HdDriver driver{HgiTokens->renderDriver, VtValue(hgi.get())}; + static HdStRenderDelegate renderDelegate; + static std::unique_ptr index( + HdRenderIndex::New(&renderDelegate, {&driver})); + HdStResourceRegistrySharedPtr const & registry = + std::static_pointer_cast( + index->GetResourceRegistry()); HdDrawingCoord *drawingCoord = drawItem.GetDrawingCoord(); diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_curves_indirect.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_curves_indirect.out index e3ec0a77c9..955e677491 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_curves_indirect.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_curves_indirect.out @@ -2385,12 +2385,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_edgeonly.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_edgeonly.out index 294b7071e9..86d45a5143 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_edgeonly.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_edgeonly.out @@ -1967,12 +1967,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif @@ -4689,12 +4714,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_edgeonly_blendwireframe.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_edgeonly_blendwireframe.out index d962cc16e9..abbd8a00e8 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_edgeonly_blendwireframe.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_edgeonly_blendwireframe.out @@ -1967,12 +1967,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif @@ -4695,12 +4720,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect.out index 7ee8a125f8..250423a51c 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect.out @@ -1967,12 +1967,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif @@ -4640,12 +4665,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_doubleSided.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_doubleSided.out index 5776e78e69..531ef99eea 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_doubleSided.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_doubleSided.out @@ -1967,12 +1967,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif @@ -4639,12 +4664,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_faceVarying.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_faceVarying.out index 7ee8a125f8..250423a51c 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_faceVarying.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_faceVarying.out @@ -1967,12 +1967,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif @@ -4640,12 +4665,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_instance.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_instance.out index 9960bc8fe8..30328f80d7 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_instance.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_instance.out @@ -2072,12 +2072,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif @@ -4850,12 +4875,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_smoothNormals.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_smoothNormals.out index 3b23416cb3..abaa7580fd 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_smoothNormals.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_mesh_indirect_smoothNormals.out @@ -1967,12 +1967,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif @@ -4640,12 +4665,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_points_indirect.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_points_indirect.out index ebd462d16f..074b689687 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_points_indirect.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_GL/baseline/codegen_points_indirect.out @@ -1532,12 +1532,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_curves_indirect.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_curves_indirect.out index c7b6f0e0d5..5b7c6b3359 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_curves_indirect.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_curves_indirect.out @@ -2366,12 +2366,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_edgeonly.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_edgeonly.out index b9234ebf1a..2a3b4cf9c2 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_edgeonly.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_edgeonly.out @@ -1953,12 +1953,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif @@ -4661,12 +4686,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_edgeonly_blendwireframe.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_edgeonly_blendwireframe.out index bf10479360..ac333842a2 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_edgeonly_blendwireframe.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_edgeonly_blendwireframe.out @@ -1953,12 +1953,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif @@ -4667,12 +4692,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect.out index f95f474377..27706fa6cd 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect.out @@ -1953,12 +1953,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif @@ -4612,12 +4637,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_doubleSided.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_doubleSided.out index 3ca7b27104..fbb7744dce 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_doubleSided.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_doubleSided.out @@ -1953,12 +1953,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif @@ -4611,12 +4636,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_faceVarying.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_faceVarying.out index f95f474377..27706fa6cd 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_faceVarying.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_faceVarying.out @@ -1953,12 +1953,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif @@ -4612,12 +4637,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_instance.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_instance.out index 607e326867..ae48e42cba 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_instance.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_instance.out @@ -2058,12 +2058,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif @@ -4822,12 +4847,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_smoothNormals.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_smoothNormals.out index e5807d1ad8..e544b38e41 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_smoothNormals.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_mesh_indirect_smoothNormals.out @@ -1953,12 +1953,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif @@ -4612,12 +4637,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif diff --git a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_points_indirect.out b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_points_indirect.out index 17c0dd2246..3dae5bf8e6 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_points_indirect.out +++ b/pxr/imaging/hdSt/testenv/testHdStCodeGen_Vulkan/baseline/codegen_points_indirect.out @@ -1523,12 +1523,37 @@ vec4 ApplyColorOverridesPostLighting(vec4 color) -void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +void RenderColor(vec4 color) { colorOut = color; } + +void RenderId() +{ + // do nothing +} + + + +void RenderNeye(vec3 Neye) +{ + // do nothing +} + + + +void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) +{ + // Write to any desired AOVs here. The render pass shader configuation + // decides if any of these are no-ops. + RenderColor(color); + RenderId(); + RenderNeye(Neye); +} + + #ifndef HD_HAS_integrateLights #define HD_HAS_integrateLights #endif diff --git a/pxr/imaging/hdSt/testenv/testHdStCurvesPrimvars.cpp b/pxr/imaging/hdSt/testenv/testHdStCurvesPrimvars.cpp index 04c9bd3c6b..dd9c9fd0bb 100644 --- a/pxr/imaging/hdSt/testenv/testHdStCurvesPrimvars.cpp +++ b/pxr/imaging/hdSt/testenv/testHdStCurvesPrimvars.cpp @@ -27,8 +27,6 @@ PXR_NAMESPACE_USING_DIRECTIVE -HdStResourceRegistrySharedPtr registry; - template static VtArray _BuildArray(T values[], int numValues) @@ -58,6 +56,7 @@ _CompareArrays(VtArray const & result, static bool _ComparePoints(std::string const & name, + HdStResourceRegistrySharedPtr const & registry, VtIntArray numVerts, VtIntArray indices, VtVec3fArray points, VtVec3fArray expected) { @@ -100,6 +99,7 @@ _ComparePoints(std::string const & name, static bool _CompareVertexPrimvar(std::string const & name, + HdStResourceRegistrySharedPtr const & registry, VtIntArray numVerts, VtIntArray indices, VtFloatArray primvar, VtFloatArray expected) { @@ -140,7 +140,7 @@ _CompareVertexPrimvar(std::string const & name, } bool -TopologyWithIndicesTest() +TopologyWithIndicesTest(HdStResourceRegistrySharedPtr const & registry) { { int numVerts[] = { 11 }; @@ -163,6 +163,7 @@ TopologyWithIndicesTest() GfVec3f(0, 0, 6) }; if (!_ComparePoints("topology_w_indices_points_small", + registry, _BuildArray(numVerts, sizeof(numVerts)/sizeof(int)), _BuildArray(indices, sizeof(indices)/sizeof(int)), _BuildArray(points, sizeof(points)/sizeof(GfVec3f)), @@ -187,6 +188,7 @@ TopologyWithIndicesTest() GfVec3f(0, 0, 10) }; if (!_ComparePoints("topology_w_indices_points_equal", + registry, _BuildArray(numVerts, sizeof(numVerts)/sizeof(int)), _BuildArray(indices, sizeof(indices)/sizeof(int)), _BuildArray(points, sizeof(points)/sizeof(GfVec3f)), @@ -224,6 +226,7 @@ TopologyWithIndicesTest() GfVec3f(0, 0, 9) }; if (!_ComparePoints("topology_w_indices_points_big", + registry, _BuildArray(numVerts, sizeof(numVerts)/sizeof(int)), _BuildArray(indices, sizeof(indices)/sizeof(int)), _BuildArray(points, sizeof(points)/sizeof(GfVec3f)), @@ -248,6 +251,7 @@ TopologyWithIndicesTest() std::fill_n(expected, 10, GfVec3f(1, 0, 0)); if (!_ComparePoints("topology_w_indices_points_insufficient", + registry, _BuildArray(numVerts, sizeof(numVerts)/sizeof(int)), _BuildArray(indices, sizeof(indices)/sizeof(int)), _BuildArray(points, sizeof(points)/sizeof(GfVec3f)), @@ -262,6 +266,7 @@ TopologyWithIndicesTest() float primvar[] = { 0, 1, 2, 3, 4, 5, 6}; float expected[] = { 0, 1, 2, 3, 4, 5, 6}; if (!_CompareVertexPrimvar("topology_w_indices_primvar_small", + registry, _BuildArray(numVerts, sizeof(numVerts)/sizeof(int)), _BuildArray(indices, sizeof(indices)/sizeof(int)), _BuildArray(primvar, sizeof(primvar)/sizeof(float)), @@ -275,6 +280,7 @@ TopologyWithIndicesTest() int indices[] = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; float primvar[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; if (!_CompareVertexPrimvar("topology_w_indices_primvar_equal", + registry, _BuildArray(numVerts, sizeof(numVerts)/sizeof(int)), _BuildArray(indices, sizeof(indices)/sizeof(int)), _BuildArray(primvar, sizeof(primvar)/sizeof(float)), @@ -289,6 +295,7 @@ TopologyWithIndicesTest() float primvar[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; float expected[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; if (!_CompareVertexPrimvar("topology_w_indices_primvar_big", + registry, _BuildArray(numVerts, sizeof(numVerts)/sizeof(int)), _BuildArray(indices, sizeof(indices)/sizeof(int)), _BuildArray(primvar, sizeof(primvar)/sizeof(float)), @@ -307,6 +314,7 @@ TopologyWithIndicesTest() float expected[9]; std::fill_n(expected, 9, 0); if (!_CompareVertexPrimvar("topology_w_indices_primvar_insufficient", + registry, _BuildArray(numVerts, sizeof(numVerts)/sizeof(int)), _BuildArray(indices, sizeof(indices)/sizeof(int)), _BuildArray(primvar, sizeof(primvar)/sizeof(float)), @@ -326,10 +334,11 @@ int main() TfErrorMark mark; static HgiUniquePtr _hgi = Hgi::CreatePlatformDefaultHgi(); - registry = std::make_shared(_hgi.get()); + HdStResourceRegistrySharedPtr registry = + std::make_shared(_hgi.get()); bool success = true; - success &= TopologyWithIndicesTest(); + success &= TopologyWithIndicesTest(registry); registry->GarbageCollect(); registry.reset(); diff --git a/pxr/imaging/hdSt/testenv/testHdStDrawBatching.cpp b/pxr/imaging/hdSt/testenv/testHdStDrawBatching.cpp index 75bfc5c78e..3c86714807 100644 --- a/pxr/imaging/hdSt/testenv/testHdStDrawBatching.cpp +++ b/pxr/imaging/hdSt/testenv/testHdStDrawBatching.cpp @@ -15,17 +15,22 @@ #include "pxr/imaging/hdSt/renderPass.h" #include "pxr/imaging/hdSt/renderPassShader.h" #include "pxr/imaging/hdSt/resourceRegistry.h" +#include "pxr/imaging/hdSt/renderDelegate.h" #include "pxr/imaging/hdSt/tokens.h" #include "pxr/imaging/hdSt/unitTestHelper.h" #include "pxr/imaging/hdSt/geometricShader.h" +#include "pxr/imaging/hd/driver.h" #include "pxr/imaging/hd/mesh.h" #include "pxr/imaging/hd/perfLog.h" +#include "pxr/imaging/hd/renderIndex.h" #include "pxr/imaging/hd/renderPassState.h" #include "pxr/imaging/hd/rprimSharedData.h" #include "pxr/imaging/hd/tokens.h" #include "pxr/imaging/hd/vtBufferSource.h" +#include "pxr/imaging/hgi/tokens.h" + #include "pxr/imaging/hio/glslfx.h" #include "pxr/imaging/glf/testGLContext.h" @@ -55,10 +60,13 @@ static HdSt_MaterialNetworkShaderSharedPtr _GetFallbackShader() static HdStResourceRegistrySharedPtr _GetResourceRegistry() { static HgiUniquePtr _hgi = Hgi::CreatePlatformDefaultHgi(); - static HdStResourceRegistrySharedPtr _resourceRegistry = - std::make_shared(_hgi.get()); + static HdDriver _driver{HgiTokens->renderDriver, VtValue(_hgi.get())}; + static HdStRenderDelegate _renderDelegate; + static std::unique_ptr _index( + HdRenderIndex::New(&_renderDelegate, {&_driver})); - return _resourceRegistry; + return std::static_pointer_cast( + _index->GetResourceRegistry()); } template diff --git a/pxr/imaging/hdSt/testenv/testHdStDynamicUvTexture.cpp b/pxr/imaging/hdSt/testenv/testHdStDynamicUvTexture.cpp index a899def894..59b135617b 100644 --- a/pxr/imaging/hdSt/testenv/testHdStDynamicUvTexture.cpp +++ b/pxr/imaging/hdSt/testenv/testHdStDynamicUvTexture.cpp @@ -40,8 +40,6 @@ class My_TestGLDrawing : public HdSt_UnitTestGLDrawing private: std::unique_ptr _driver; - - std::unique_ptr _hdStRegistry; std::unique_ptr _textureHandleRegistry; }; @@ -49,9 +47,9 @@ void My_TestGLDrawing::InitTest() { _driver = std::make_unique(); - _hdStRegistry = std::make_unique(_driver->GetHgi()); _textureHandleRegistry = - std::make_unique(_hdStRegistry.get()); + std::make_unique( + _driver->GetResourceRegistry().get()); } template diff --git a/pxr/imaging/hdSt/testenv/testHdStMeshTopology.cpp b/pxr/imaging/hdSt/testenv/testHdStMeshTopology.cpp index 145488da61..a24387c41f 100644 --- a/pxr/imaging/hdSt/testenv/testHdStMeshTopology.cpp +++ b/pxr/imaging/hdSt/testenv/testHdStMeshTopology.cpp @@ -8,19 +8,24 @@ #include "pxr/imaging/hdSt/flatNormals.h" #include "pxr/imaging/hdSt/meshTopology.h" #include "pxr/imaging/hdSt/quadrangulate.h" +#include "pxr/imaging/hdSt/renderDelegate.h" +#include "pxr/imaging/hdSt/resourceRegistry.h" #include "pxr/imaging/hdSt/smoothNormals.h" #include "pxr/imaging/hdSt/triangulate.h" #include "pxr/imaging/hdSt/vertexAdjacency.h" #include "pxr/imaging/hd/bufferSource.h" +#include "pxr/imaging/hd/driver.h" #include "pxr/imaging/hd/smoothNormals.h" #include "pxr/imaging/hd/flatNormals.h" +#include "pxr/imaging/hd/renderIndex.h" #include "pxr/imaging/hd/tokens.h" #include "pxr/imaging/hd/vertexAdjacency.h" #include "pxr/imaging/hd/vtBufferSource.h" -#include "pxr/imaging/hdSt/resourceRegistry.h" #include "pxr/imaging/glf/testGLContext.h" +#include "pxr/imaging/hgi/tokens.h" + #include "pxr/usd/sdf/path.h" #include "pxr/base/gf/math.h" @@ -977,7 +982,12 @@ int main() TfErrorMark mark; static HgiUniquePtr _hgi = Hgi::CreatePlatformDefaultHgi(); - registry = std::make_shared(_hgi.get()); + HdDriver driver{HgiTokens->renderDriver, VtValue(_hgi.get())}; + HdStRenderDelegate renderDelegate; + std::unique_ptr index( + HdRenderIndex::New(&renderDelegate, {&driver})); + registry = std::static_pointer_cast( + index->GetResourceRegistry()); bool success = true; success &= BasicTest(); diff --git a/pxr/imaging/hdSt/testenv/testHdStPrimitiveParam.cpp b/pxr/imaging/hdSt/testenv/testHdStPrimitiveParam.cpp index 8534141911..a12555a4ef 100644 --- a/pxr/imaging/hdSt/testenv/testHdStPrimitiveParam.cpp +++ b/pxr/imaging/hdSt/testenv/testHdStPrimitiveParam.cpp @@ -7,15 +7,19 @@ #include "pxr/imaging/hdSt/meshTopology.h" #include "pxr/imaging/hdSt/quadrangulate.h" +#include "pxr/imaging/hdSt/renderDelegate.h" +#include "pxr/imaging/hdSt/resourceRegistry.h" #include "pxr/imaging/hd/bufferSource.h" +#include "pxr/imaging/hd/driver.h" #include "pxr/imaging/hd/meshUtil.h" #include "pxr/imaging/hd/perfLog.h" +#include "pxr/imaging/hd/renderIndex.h" #include "pxr/imaging/hd/tokens.h" #include "pxr/imaging/hd/vtBufferSource.h" -#include "pxr/imaging/hdSt/resourceRegistry.h" #include "pxr/imaging/glf/testGLContext.h" #include "pxr/imaging/hgi/hgi.h" +#include "pxr/imaging/hgi/tokens.h" #include "pxr/base/gf/math.h" #include "pxr/base/gf/vec2i.h" @@ -349,8 +353,13 @@ int main() TfErrorMark mark; - std::unique_ptr hgi = Hgi::CreatePlatformDefaultHgi(); - registry = std::make_shared(hgi.get()); + HgiUniquePtr hgi = Hgi::CreatePlatformDefaultHgi(); + HdDriver driver{HgiTokens->renderDriver, VtValue(hgi.get())}; + HdStRenderDelegate renderDelegate; + std::unique_ptr index( + HdRenderIndex::New(&renderDelegate, {&driver})); + registry = std::static_pointer_cast( + index->GetResourceRegistry()); bool success = true; success &= PrimitiveIDMapTest(); diff --git a/pxr/imaging/hdSt/testenv/testHdStQuadrangulation.cpp b/pxr/imaging/hdSt/testenv/testHdStQuadrangulation.cpp index 569d7ad69c..9fc247972e 100644 --- a/pxr/imaging/hdSt/testenv/testHdStQuadrangulation.cpp +++ b/pxr/imaging/hdSt/testenv/testHdStQuadrangulation.cpp @@ -9,12 +9,16 @@ #include "pxr/imaging/hdSt/meshTopology.h" #include "pxr/imaging/hd/bufferSource.h" +#include "pxr/imaging/hd/driver.h" #include "pxr/imaging/hd/perfLog.h" #include "pxr/imaging/hd/tokens.h" #include "pxr/imaging/hd/types.h" +#include "pxr/imaging/hd/renderIndex.h" #include "pxr/imaging/hd/vtBufferSource.h" #include "pxr/imaging/hdSt/resourceRegistry.h" +#include "pxr/imaging/hdSt/renderDelegate.h" #include "pxr/imaging/glf/testGLContext.h" +#include "pxr/imaging/hgi/tokens.h" #include "pxr/base/gf/math.h" #include "pxr/base/gf/vec3d.h" @@ -75,8 +79,13 @@ _CompareQuadPoints(std::string const & name, std::cout << "GPU quadrangulate = " << gpu << "\n"; static HgiUniquePtr _hgi = Hgi::CreatePlatformDefaultHgi(); - static HdStResourceRegistrySharedPtr registry( - new HdStResourceRegistry(_hgi.get())); + static HdDriver driver{HgiTokens->renderDriver, VtValue(_hgi.get())}; + static HdStRenderDelegate renderDelegate; + static std::unique_ptr index( + HdRenderIndex::New(&renderDelegate, {&driver})); + HdStResourceRegistrySharedPtr const& registry = + std::static_pointer_cast( + index->GetResourceRegistry()); HdMeshTopology m(_tokens->bilinear, TfToken(orientation), numVerts, verts); diff --git a/pxr/imaging/hdSt/testenv/testHdStSamplerObjectRegistry.cpp b/pxr/imaging/hdSt/testenv/testHdStSamplerObjectRegistry.cpp index 4386fe78d5..6c3e0c34fe 100644 --- a/pxr/imaging/hdSt/testenv/testHdStSamplerObjectRegistry.cpp +++ b/pxr/imaging/hdSt/testenv/testHdStSamplerObjectRegistry.cpp @@ -45,11 +45,12 @@ void My_TestGLDrawing::InitTest() { _driver = std::make_unique(); - _hdStRegistry = std::make_unique(_driver->GetHgi()); _textureRegistry = - std::make_unique(_hdStRegistry.get()); + std::make_unique( + _driver->GetResourceRegistry().get()); _samplerRegistry = - std::make_unique(_hdStRegistry.get()); + std::make_unique( + _driver->GetResourceRegistry().get()); } template diff --git a/pxr/imaging/hdSt/testenv/testHdStSubdivision.cpp b/pxr/imaging/hdSt/testenv/testHdStSubdivision.cpp index 52c3b2c0e3..7662359005 100644 --- a/pxr/imaging/hdSt/testenv/testHdStSubdivision.cpp +++ b/pxr/imaging/hdSt/testenv/testHdStSubdivision.cpp @@ -7,10 +7,13 @@ #include "pxr/imaging/hdSt/subdivision.h" #include "pxr/imaging/hdSt/meshTopology.h" +#include "pxr/imaging/hdSt/renderDelegate.h" #include "pxr/imaging/hd/bufferSource.h" +#include "pxr/imaging/hd/driver.h" #include "pxr/imaging/hd/meshUtil.h" #include "pxr/imaging/hd/perfLog.h" +#include "pxr/imaging/hd/renderIndex.h" #include "pxr/imaging/hd/tokens.h" #include "pxr/imaging/hd/vtBufferSource.h" #include "pxr/imaging/hdSt/resourceRegistry.h" @@ -18,6 +21,7 @@ #include "pxr/imaging/pxOsd/tokens.h" #include "pxr/imaging/glf/testGLContext.h" #include "pxr/imaging/hgi/hgi.h" +#include "pxr/imaging/hgi/tokens.h" #include "pxr/base/gf/math.h" #include "pxr/base/gf/vec3d.h" @@ -840,8 +844,13 @@ int main() TfErrorMark mark; - std::unique_ptr hgi = Hgi::CreatePlatformDefaultHgi(); - registry = std::make_shared(hgi.get()); + HgiUniquePtr hgi = Hgi::CreatePlatformDefaultHgi(); + HdDriver driver{HgiTokens->renderDriver, VtValue(hgi.get())}; + HdStRenderDelegate renderDelegate; + std::unique_ptr index( + HdRenderIndex::New(&renderDelegate, {&driver})); + registry = std::static_pointer_cast( + index->GetResourceRegistry()); bool success = true; success &= SubdivisionTest(PxOsdOpenSubdivTokens->catmullClark); diff --git a/pxr/imaging/hdSt/testenv/testHdStTextureHandleRegistry.cpp b/pxr/imaging/hdSt/testenv/testHdStTextureHandleRegistry.cpp index 1cf09a6c4e..7587051a97 100644 --- a/pxr/imaging/hdSt/testenv/testHdStTextureHandleRegistry.cpp +++ b/pxr/imaging/hdSt/testenv/testHdStTextureHandleRegistry.cpp @@ -39,8 +39,6 @@ class My_TestGLDrawing : public HdSt_UnitTestGLDrawing { private: std::unique_ptr _driver; - - std::unique_ptr _hdStRegistry; std::unique_ptr _textureHandleRegistry; }; @@ -48,10 +46,9 @@ void My_TestGLDrawing::InitTest() { _driver = std::make_unique(); - _hdStRegistry = std::make_unique(_driver->GetHgi()); _textureHandleRegistry = - std::make_unique(_hdStRegistry.get()); - + std::make_unique( + _driver->GetResourceRegistry().get()); } template diff --git a/pxr/imaging/hdSt/testenv/testHdStTextureObjectRegistry.cpp b/pxr/imaging/hdSt/testenv/testHdStTextureObjectRegistry.cpp index 0913ebe992..21f48790b6 100644 --- a/pxr/imaging/hdSt/testenv/testHdStTextureObjectRegistry.cpp +++ b/pxr/imaging/hdSt/testenv/testHdStTextureObjectRegistry.cpp @@ -33,8 +33,6 @@ class My_TestGLDrawing : public HdSt_UnitTestGLDrawing { private: std::unique_ptr _driver; - - std::unique_ptr _hdStRegistry; std::unique_ptr _registry; }; @@ -42,9 +40,9 @@ void My_TestGLDrawing::InitTest() { _driver = std::make_unique(); - _hdStRegistry = std::make_unique(_driver->GetHgi()); _registry = - std::make_unique(_hdStRegistry.get()); + std::make_unique( + _driver->GetResourceRegistry().get()); } void diff --git a/pxr/imaging/hdSt/unitTestHelper.cpp b/pxr/imaging/hdSt/unitTestHelper.cpp index 584e3ab940..31f1328ee8 100644 --- a/pxr/imaging/hdSt/unitTestHelper.cpp +++ b/pxr/imaging/hdSt/unitTestHelper.cpp @@ -325,6 +325,11 @@ HdSt_TestLightingShader::SetLight(int light, HdSt_TextureTestDriver::HdSt_TextureTestDriver() : _hgi(Hgi::CreatePlatformDefaultHgi()) + , _hgiDriver{HgiTokens->renderDriver, VtValue(_hgi.get())} + , _renderDelegate() + , _renderIndex(HdRenderIndex::New(&_renderDelegate, {&_hgiDriver})) + , _resourceRegistry(std::static_pointer_cast( + _renderIndex->GetResourceRegistry())) , _indexBuffer() , _vertexBuffer() , _shaderProgram() @@ -353,6 +358,12 @@ HdSt_TextureTestDriver::~HdSt_TextureTestDriver() } } +HdStResourceRegistrySharedPtr const & +HdSt_TextureTestDriver::GetResourceRegistry() +{ + return _resourceRegistry; +} + void HdSt_TextureTestDriver::Draw(HgiTextureHandle const &colorDst, HgiTextureHandle const &inputTexture, diff --git a/pxr/imaging/hdSt/unitTestHelper.h b/pxr/imaging/hdSt/unitTestHelper.h index 6cdc6567aa..61fdc6de45 100644 --- a/pxr/imaging/hdSt/unitTestHelper.h +++ b/pxr/imaging/hdSt/unitTestHelper.h @@ -636,6 +636,9 @@ class HdSt_TextureTestDriver HDST_API Hgi * GetHgi() { return _hgi.get(); } + + HDST_API + HdStResourceRegistrySharedPtr const & GetResourceRegistry(); private: void _CreateShaderProgram(); @@ -648,6 +651,11 @@ class HdSt_TextureTestDriver void _PrintCompileErrors(); HgiUniquePtr _hgi; + HdDriver _hgiDriver; + HdStRenderDelegate _renderDelegate; + std::unique_ptr _renderIndex; + HdStResourceRegistrySharedPtr _resourceRegistry; + HgiBufferHandle _indexBuffer; HgiBufferHandle _vertexBuffer; HgiShaderProgramHandle _shaderProgram; diff --git a/pxr/imaging/hdx/pickTask.cpp b/pxr/imaging/hdx/pickTask.cpp index 55d2e917da..ffa03df24e 100644 --- a/pxr/imaging/hdx/pickTask.cpp +++ b/pxr/imaging/hdx/pickTask.cpp @@ -217,9 +217,7 @@ HdxPickTask::_CreateAovBindings() binding.renderBufferId = aovId; binding.aovSettings = aovDesc.aovSettings; binding.renderBuffer = _pickableAovBuffers.back().get(); - // Clear all color channels to 1, so when cast as int, an unwritten - // pixel is encoded as -1. - binding.clearValue = VtValue(GfVec4f(1)); + binding.clearValue = aovDesc.clearValue; _pickableAovBindings.push_back(binding); diff --git a/pxr/imaging/hdx/renderSetupTask.cpp b/pxr/imaging/hdx/renderSetupTask.cpp index 83c3f679e2..9baea7e93a 100644 --- a/pxr/imaging/hdx/renderSetupTask.cpp +++ b/pxr/imaging/hdx/renderSetupTask.cpp @@ -18,13 +18,12 @@ #include "pxr/imaging/hd/camera.h" #include "pxr/imaging/hdSt/renderPassShader.h" #include "pxr/imaging/hdSt/renderPassState.h" +#include "pxr/imaging/hdSt/resourceRegistry.h" #include "pxr/imaging/hdSt/tokens.h" #include "pxr/imaging/hdSt/volume.h" #include "pxr/imaging/cameraUtil/conformWindow.h" -#include - PXR_NAMESPACE_OPEN_SCOPE static const HioGlslfxSharedPtr & @@ -43,13 +42,15 @@ _GetRenderPassIdGlslfx() return glslfx; } -HdxRenderSetupTask::HdxRenderSetupTask(HdSceneDelegate* delegate, SdfPath const& id) +HdxRenderSetupTask::HdxRenderSetupTask( + HdSceneDelegate* delegate, SdfPath const& id) : HdTask(id) , _colorRenderPassShader( std::make_shared(_GetRenderPassColorGlslfx())) , _idRenderPassShader( std::make_shared(_GetRenderPassIdGlslfx())) , _viewport(0) + , _enableIdRenderFromParams(false) { } @@ -96,6 +97,12 @@ HdxRenderSetupTask::Prepare(HdTaskContext* ctx, HdStVolume::defaultStepSizeLighting); renderPassState->SetVolumeRenderingConstants(stepSize, stepSizeLighting); + if (HdStRenderPassState * const hdStRenderPassState = + dynamic_cast(renderPassState.get())) { + _SetRenderpassShadersForStorm(hdStRenderPassState, + renderIndex->GetResourceRegistry()); + } + renderPassState->Prepare(renderIndex->GetResourceRegistry()); (*ctx)[HdxTokens->renderPassState] = VtValue(_renderPassState); } @@ -110,23 +117,67 @@ HdxRenderSetupTask::Execute(HdTaskContext* ctx) (*ctx)[HdxTokens->renderPassState] = VtValue(_renderPassState); } +static +bool +_AovHasIdSemantic(TfToken const &name) +{ + // For now id render only means primId or instanceId. + return name == HdAovTokens->primId || + name == HdAovTokens->instanceId; +} + void HdxRenderSetupTask::_SetRenderpassShadersForStorm( - HdxRenderTaskParams const ¶ms, - HdStRenderPassState *renderPassState) + HdStRenderPassState *renderPassState, + HdResourceRegistrySharedPtr const &resourceRegistry) { - renderPassState->SetUseSceneMaterials(params.enableSceneMaterials); - if (params.enableIdRender) { + // XXX: This id render codepath will be deprecated soon. + if (_enableIdRenderFromParams) { renderPassState->SetRenderPassShader(_idRenderPassShader); - } else { + return; + // If no aovs are bound, use pre-assembled color render pass shader. + } else if (_aovBindings.empty()) { renderPassState->SetRenderPassShader(_colorRenderPassShader); + return; } + + HdStResourceRegistrySharedPtr const& hdStResourceRegistry = + std::static_pointer_cast(resourceRegistry); + + renderPassState->SetRenderPassShader( + HdStRenderPassShader::CreateRenderPassShaderFromAovs( + renderPassState, + hdStResourceRegistry, + _aovBindings)); } void HdxRenderSetupTask::SyncParams(HdSceneDelegate* delegate, HdxRenderTaskParams const ¶ms) { + _viewport = params.viewport; + _framing = params.framing; + _overrideWindowPolicy = params.overrideWindowPolicy; + _cameraId = params.camera; + _aovBindings = params.aovBindings; + _aovInputBindings = params.aovInputBindings; + + // Inspect aovs to see if we're doing an id render. + bool usingIdAov = false; + for (size_t i = 0; i < _aovBindings.size(); ++i) { + if (_AovHasIdSemantic(_aovBindings[i].aovName)) { + usingIdAov = true; + break; + } + } + + // XXX: For now, we track enabling an id render via params vs. AOV bindings + // as two slightly different states regarding MSAA. We will soon deprecate + // "enableIdRender" as an option, though. + _enableIdRenderFromParams = params.enableIdRender; + const bool enableIdRender = params.enableIdRender || usingIdAov; + const bool enableIdRenderNoIdAov = params.enableIdRender && !usingIdAov; + HdRenderIndex &renderIndex = delegate->GetRenderIndex(); HdRenderPassStateSharedPtr &renderPassState = _GetRenderPassState(&renderIndex); @@ -167,34 +218,34 @@ HdxRenderSetupTask::SyncParams(HdSceneDelegate* delegate, renderPassState->SetBlendConstantColor(params.blendConstantColor); // Don't enable alpha to coverage for id renders. + // XXX: If the list of aovs includes both color and an id aov (such as + // primdId), we still disable alpha to coverage for the render pass, + // which may result in different behavior for the color output compared + // to if the user didn't request an id aov at the same time. + // If this becomes an issue, we'll need to reconsider this approach. renderPassState->SetAlphaToCoverageEnabled( params.enableAlphaToCoverage && - !params.enableIdRender && + !enableIdRender && !TfDebug::IsEnabled(HDX_DISABLE_ALPHA_TO_COVERAGE)); + // For id renders that use an id aov (which use an int format), it's ok + // to have multi-sampling enabled. During the MSAA resolve for integer + // types, a single sample will be selected. renderPassState->SetMultiSampleEnabled( - params.useAovMultiSample && !params.enableIdRender); + params.useAovMultiSample && !enableIdRenderNoIdAov); if (HdStRenderPassState * const hdStRenderPassState = dynamic_cast(renderPassState.get())) { - + hdStRenderPassState->SetUseSceneMaterials( + params.enableSceneMaterials); + // Don't enable multisample for id renders. hdStRenderPassState->SetUseAovMultiSample( - params.useAovMultiSample && !params.enableIdRender); + params.useAovMultiSample && !enableIdRenderNoIdAov); hdStRenderPassState->SetResolveAovMultiSample( params.resolveAovMultiSample); - - _SetRenderpassShadersForStorm( - params, hdStRenderPassState); } } - - _viewport = params.viewport; - _framing = params.framing; - _overrideWindowPolicy = params.overrideWindowPolicy; - _cameraId = params.camera; - _aovBindings = params.aovBindings; - _aovInputBindings = params.aovInputBindings; } void diff --git a/pxr/imaging/hdx/renderSetupTask.h b/pxr/imaging/hdx/renderSetupTask.h index 396b57bfb1..6268917da2 100644 --- a/pxr/imaging/hdx/renderSetupTask.h +++ b/pxr/imaging/hdx/renderSetupTask.h @@ -97,10 +97,11 @@ class HdxRenderSetupTask : public HdTask GfVec4d _viewport; HdRenderPassAovBindingVector _aovBindings; HdRenderPassAovBindingVector _aovInputBindings; + bool _enableIdRenderFromParams; void _SetRenderpassShadersForStorm( - HdxRenderTaskParams const& params, - HdStRenderPassState *renderPassState); + HdStRenderPassState *renderPassState, + HdResourceRegistrySharedPtr const &resourceRegistry); HdRenderPassStateSharedPtr &_GetRenderPassState(HdRenderIndex* renderIndex); diff --git a/pxr/imaging/hdx/shaders/renderPass.glslfx b/pxr/imaging/hdx/shaders/renderPass.glslfx index 9b9e515f79..be46118ac9 100644 --- a/pxr/imaging/hdx/shaders/renderPass.glslfx +++ b/pxr/imaging/hdx/shaders/renderPass.glslfx @@ -125,11 +125,11 @@ void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) -- layout HdxRenderPass.RenderPick [ - ["out", "vec4", "primIdOut"], - ["out", "vec4", "instanceIdOut"], - ["out", "vec4", "elementIdOut"], - ["out", "vec4", "edgeIdOut"], - ["out", "vec4", "pointIdOut"], + ["out", "int", "primIdOut"], + ["out", "int", "instanceIdOut"], + ["out", "int", "elementIdOut"], + ["out", "int", "edgeIdOut"], + ["out", "int", "pointIdOut"], ["out", "vec4", "neyeOut"], ["buffer readWrite", "CounterBuffer", "PickBuffer", ["atomic_int", "PickBuffer"]] ] @@ -156,27 +156,21 @@ FORWARD_DECL(void RenderDeepPicks(int primId, int instanceId, int elementId, int void RenderOutput(vec4 Peye, vec3 Neye, vec4 color, vec4 patchCoord) { - int primId = HdGet_primID(); - primIdOut = IntToVec4(primId); + primIdOut = HdGet_primID(); // instanceIndex is a tuple of integers (num nested levels). // for picking, we store global instanceId (instanceIndex[0]) in the // selection framebuffer and then reconstruct the tuple in postprocess. - int instanceId = GetDrawingCoord().instanceIndex[0]; - instanceIdOut = IntToVec4(instanceId); + instanceIdOut = GetDrawingCoord().instanceIndex[0]; - int elementId = GetElementID(); - int edgeId = GetPrimitiveEdgeId(); - int pointId = GetPointId(); - - elementIdOut = IntToVec4(elementId); - edgeIdOut = IntToVec4(edgeId); - pointIdOut = IntToVec4(pointId); + elementIdOut = GetElementID(); + edgeIdOut = GetPrimitiveEdgeId(); + pointIdOut = GetPointId(); neyeOut = IntToVec4(hd_vec4_2_10_10_10_set(vec4(Neye,0))); #if defined(HD_HAS_PickBuffer) - RenderDeepPicks(primId, instanceId, elementId, edgeId, pointId); + RenderDeepPicks(primIdOut, instanceIdOut, elementIdOut, edgeIdOut, pointIdOut); #endif } diff --git a/pxr/imaging/hdx/shaders/renderPassColorShader.glslfx b/pxr/imaging/hdx/shaders/renderPassColorShader.glslfx index bb05ce38ff..d4b6075937 100644 --- a/pxr/imaging/hdx/shaders/renderPassColorShader.glslfx +++ b/pxr/imaging/hdx/shaders/renderPassColorShader.glslfx @@ -11,7 +11,6 @@ --- #import $TOOLS/hdx/shaders/renderPassColorShader.glslfx #import $TOOLS/hdSt/shaders/renderPass.glslfx -#import $TOOLS/hdx/shaders/renderPass.glslfx #import $TOOLS/hdx/shaders/selection.glslfx -- configuration @@ -46,7 +45,10 @@ "Selection.DecodeUtils", "Selection.ComputeColor", "RenderPass.ApplyColorOverrides", - "RenderPass.RenderColor" ] + "RenderPass.RenderColor", + "RenderPass.RenderIdNoOp", + "RenderPass.RenderNeyeNoOp", + "RenderPass.RenderOutput" ] } } } diff --git a/pxr/imaging/hdx/shaders/renderPassIdShader.glslfx b/pxr/imaging/hdx/shaders/renderPassIdShader.glslfx index 67495226ea..ea45bd8498 100644 --- a/pxr/imaging/hdx/shaders/renderPassIdShader.glslfx +++ b/pxr/imaging/hdx/shaders/renderPassIdShader.glslfx @@ -11,7 +11,6 @@ --- #import $TOOLS/hdx/shaders/renderPassIdShader.glslfx #import $TOOLS/hdSt/shaders/renderPass.glslfx -#import $TOOLS/hdx/shaders/renderPass.glslfx -- configuration { @@ -44,7 +43,7 @@ "RenderPass.CameraFS", "RenderPass.NoSelection", "RenderPass.NoColorOverrides", - "RenderPass.RenderId" ] + "RenderPass.RenderIdNoIdAov"] } } } diff --git a/pxr/imaging/hdx/shaders/renderPassShadowShader.glslfx b/pxr/imaging/hdx/shaders/renderPassShadowShader.glslfx index 967a419f3e..67219ef8df 100644 --- a/pxr/imaging/hdx/shaders/renderPassShadowShader.glslfx +++ b/pxr/imaging/hdx/shaders/renderPassShadowShader.glslfx @@ -11,7 +11,6 @@ --- #import $TOOLS/hdx/shaders/renderPassShadowShader.glslfx #import $TOOLS/hdSt/shaders/renderPass.glslfx -#import $TOOLS/hdx/shaders/renderPass.glslfx -- configuration { @@ -44,7 +43,10 @@ "RenderPass.CameraFS", "RenderPass.NoSelection", "RenderPass.NoColorOverrides", - "RenderPass.RenderColor" ] + "RenderPass.RenderColor", + "RenderPass.RenderIdNoOp", + "RenderPass.RenderNeyeNoOp", + "RenderPass.RenderOutput" ] } } } diff --git a/pxr/imaging/hdx/testenv/testHdxIdRender.cpp b/pxr/imaging/hdx/testenv/testHdxIdRender.cpp index f92b86e503..2678526d23 100644 --- a/pxr/imaging/hdx/testenv/testHdxIdRender.cpp +++ b/pxr/imaging/hdx/testenv/testHdxIdRender.cpp @@ -90,7 +90,6 @@ Hdx_TestDriver::Draw(GfVec4d const &viewport, PickParam const * pickParam) HdxRenderTaskParams param = delegate.GetTaskParam( renderSetupTask, HdTokens->params).Get(); - param.enableIdRender = (pickParam != nullptr); param.viewport = viewport; param.aovBindings = pickParam ? _pickableAovBindings : _aovBindings; delegate.SetTaskParam(renderSetupTask, HdTokens->params, VtValue(param)); diff --git a/pxr/imaging/hgiGL/ops.cpp b/pxr/imaging/hgiGL/ops.cpp index a0473c4797..1f69ecd8b5 100644 --- a/pxr/imaging/hgiGL/ops.cpp +++ b/pxr/imaging/hgiGL/ops.cpp @@ -740,6 +740,16 @@ HgiGLOps::Dispatch(int dimX, int dimY) }; } +static +bool +_IsInt32Format(HgiFormat format) +{ + return (format == HgiFormatInt32) || + (format == HgiFormatInt32Vec2) || + (format == HgiFormatInt32Vec3) || + (format == HgiFormatInt32Vec4); +} + HgiGLOpsFn HgiGLOps::BindFramebufferOp( HgiGLDevice* device, @@ -769,7 +779,19 @@ HgiGLOps::BindFramebufferOp( } if (colorAttachment.loadOp == HgiAttachmentLoadOpClear) { - glClearBufferfv(GL_COLOR, i, colorAttachment.clearValue.data()); + // Special handling for int format used by id renders. + if (_IsInt32Format(colorAttachment.format)) { + GLint clearValue[4] = { + static_cast(colorAttachment.clearValue[0]), + static_cast(colorAttachment.clearValue[1]), + static_cast(colorAttachment.clearValue[2]), + static_cast(colorAttachment.clearValue[3]) + }; + glClearBufferiv(GL_COLOR, i, clearValue); + } else { + glClearBufferfv( + GL_COLOR, i, colorAttachment.clearValue.data()); + } } blendEnabled |= colorAttachment.blendEnabled; diff --git a/pxr/imaging/hgiVulkan/graphicsCmds.cpp b/pxr/imaging/hgiVulkan/graphicsCmds.cpp index 6e76681e5e..d6669206d1 100644 --- a/pxr/imaging/hgiVulkan/graphicsCmds.cpp +++ b/pxr/imaging/hgiVulkan/graphicsCmds.cpp @@ -19,6 +19,16 @@ PXR_NAMESPACE_OPEN_SCOPE +static +bool +_IsInt32Format(HgiFormat format) +{ + return (format == HgiFormatInt32) || + (format == HgiFormatInt32Vec2) || + (format == HgiFormatInt32Vec3) || + (format == HgiFormatInt32Vec4); +} + HgiVulkanGraphicsCmds::HgiVulkanGraphicsCmds( HgiVulkan* hgi, HgiGraphicsCmdsDesc const& desc) @@ -38,10 +48,19 @@ HgiVulkanGraphicsCmds::HgiVulkanGraphicsCmds( for (HgiAttachmentDesc const& attachmentDesc : _descriptor.colorAttachmentDescs) { VkClearValue vkClearValue; - vkClearValue.color.float32[0] = attachmentDesc.clearValue[0]; - vkClearValue.color.float32[1] = attachmentDesc.clearValue[1]; - vkClearValue.color.float32[2] = attachmentDesc.clearValue[2]; - vkClearValue.color.float32[3] = attachmentDesc.clearValue[3]; + + // Special handling for int format used by id renders. + if (_IsInt32Format(attachmentDesc.format)) { + vkClearValue.color.int32[0] = attachmentDesc.clearValue[0]; + vkClearValue.color.int32[1] = attachmentDesc.clearValue[1]; + vkClearValue.color.int32[2] = attachmentDesc.clearValue[2]; + vkClearValue.color.int32[3] = attachmentDesc.clearValue[3]; + } else { + vkClearValue.color.float32[0] = attachmentDesc.clearValue[0]; + vkClearValue.color.float32[1] = attachmentDesc.clearValue[1]; + vkClearValue.color.float32[2] = attachmentDesc.clearValue[2]; + vkClearValue.color.float32[3] = attachmentDesc.clearValue[3]; + } _vkClearValues.push_back(vkClearValue); } diff --git a/pxr/usdImaging/usdImagingGL/engine.cpp b/pxr/usdImaging/usdImagingGL/engine.cpp index 12b4bc6610..bc822e8d1b 100644 --- a/pxr/usdImaging/usdImagingGL/engine.cpp +++ b/pxr/usdImaging/usdImagingGL/engine.cpp @@ -867,15 +867,28 @@ UsdImagingGLEngine::DecodeIntersection( SdfPath *outHitInstancerPath, int *outHitInstanceIndex, HdInstancerContext *outInstancerContext) +{ + const int primIdx = HdxPickTask::DecodeIDRenderColor(primIdColor); + const int instanceIdx = HdxPickTask::DecodeIDRenderColor(instanceIdColor); + + return DecodeIntersection(primIdx, instanceIdx, outHitPrimPath, + outHitInstancerPath, outHitInstanceIndex, outInstancerContext); +} + +bool +UsdImagingGLEngine::DecodeIntersection( + int primIdx, + int instanceIdx, + SdfPath *outHitPrimPath, + SdfPath *outHitInstancerPath, + int *outHitInstanceIndex, + HdInstancerContext *outInstancerContext) { if (ARCH_UNLIKELY(!_renderDelegate)) { return false; } - const int primId = HdxPickTask::DecodeIDRenderColor(primIdColor); - const int instanceIdx = HdxPickTask::DecodeIDRenderColor(instanceIdColor); - - SdfPath primPath = _renderIndex->GetRprimPathFromPrimId(primId); + SdfPath primPath = _renderIndex->GetRprimPathFromPrimId(primIdx); if (primPath.IsEmpty()) { return false; } @@ -1267,6 +1280,7 @@ UsdImagingGLEngine::GetRendererAovs() const { HdAovTokens->primId, HdAovTokens->depth, HdAovTokens->normal, + HdAovTokens->Neye, HdAovTokensMakePrimvar(TfToken("st")) }; TfTokenVector aovs = { HdAovTokens->color }; @@ -1295,6 +1309,20 @@ UsdImagingGLEngine::SetRendererAov(TfToken const &id) return false; } +bool +UsdImagingGLEngine::SetRendererAovs(TfTokenVector const &ids) +{ + if (ARCH_UNLIKELY(!_renderDelegate)) { + return false; + } + + if (_renderIndex->IsBprimTypeSupported(HdPrimTypeTokens->renderBuffer)) { + _taskController->SetRenderOutputs(ids); + return true; + } + return false; +} + HgiTextureHandle UsdImagingGLEngine::GetAovTexture( TfToken const& name) const diff --git a/pxr/usdImaging/usdImagingGL/engine.h b/pxr/usdImaging/usdImagingGL/engine.h index e90410f3cd..1a7ff92e3d 100644 --- a/pxr/usdImaging/usdImagingGL/engine.h +++ b/pxr/usdImaging/usdImagingGL/engine.h @@ -379,7 +379,7 @@ class UsdImagingGLEngine IntersectionResultVector* outResults); /// Decodes a pick result given hydra prim ID/instance ID (like you'd get - /// from an ID render). + /// from an ID render), where ID is represented as a vec4 color. USDIMAGINGGL_API bool DecodeIntersection( unsigned char const primIdColor[4], @@ -389,6 +389,17 @@ class UsdImagingGLEngine int *outHitInstanceIndex = NULL, HdInstancerContext *outInstancerContext = NULL); + /// Decodes a pick result given hydra prim ID/instance ID (like you'd get + /// from an ID render), where ID is represented as a int. + USDIMAGINGGL_API + bool DecodeIntersection( + int primIdx, + int instanceIdx, + SdfPath *outHitPrimPath = NULL, + SdfPath *outHitInstancerPath = NULL, + int *outHitInstanceIndex = NULL, + HdInstancerContext *outInstancerContext = NULL); + /// @} // --------------------------------------------------------------------- @@ -432,6 +443,10 @@ class UsdImagingGLEngine USDIMAGINGGL_API bool SetRendererAov(TfToken const& id); + /// Set the current renderer AOVs to a list of \p ids. + USDIMAGINGGL_API + bool SetRendererAovs(TfTokenVector const &ids); + /// Returns an AOV texture handle for the given token. USDIMAGINGGL_API HgiTextureHandle GetAovTexture(TfToken const& name) const; diff --git a/pxr/usdImaging/usdImagingGL/testenv/testUsdImagingGLAovVisualization/baseline/testUsdImagingGLAovVisualization_Storm_Neye.png b/pxr/usdImaging/usdImagingGL/testenv/testUsdImagingGLAovVisualization/baseline/testUsdImagingGLAovVisualization_Storm_Neye.png new file mode 100644 index 0000000000000000000000000000000000000000..9ce3d5b9872285e7603896e292e17442394b864c GIT binary patch literal 55568 zcmeFY`&UwH*fk6+SfDNhH5KpxMx|{l@oZ@VT4?P`JKIq_wow7;# zfi+}liMt6!=0H$2%g%v#!`qO^#Xd8UG=c#tgeAxs2H=q?k&7H!BTOZlFv>R3B3AHk z#s|CuJp;nFS}I=HMkF0~VZ1^(E*|}#CuKb+Mk4)Q`3UiWkv30oD$uuWhQP-aIQI$M zeD50TC5<9Je)h?n_4p7e-DSStW`Nj%GZ4}cA(VXn*#SN@1TjegB%>G4%YbaB85}g+ z{I+^hCh4AcS7Jb}z^3Zk9OZ4mo_xhQ9=tgBJ}_N^NWv9~ z5ieb6P^xAD(qYej)>@~%yM@z)41%;z96O8l#O%JT(%}k7V@BdFR=#f(^f-txO8YuI zD@{g86JLe8SUc8pZ=MlI?zcjTfb!q}xm^L`aZ*w7|J>}p z3%6CPz-_r_2v#w?C>A5o2!x&QNV4o_JLL9?Cs&|5ul z3Xpqd$8xu-Gjs_71Gu8+Z5(aVQcns>>4xSw2r3@#{`dXW5Z&HiOym+{x$?;ETn45% zYXZAu>vhz5TmCk0oR=w{$Tc)5GCp@AH}<`Ne%(p)y%#jLJ=4!|^GXMj5l{*zcQ zl8@oeAYJoUd*i${-r3y9IQ`-~^G(8vV|!Nq@|Jf^+tsW(+gqYCR@l7tar_>abZ*^F zi}m-;#N?cNpY+rDpI5DLMpfVyZAU!4LS<1mPoGs)A+H;qqpo^-g}iv>{YUj}?B%!b z3~+UoE8go(XOK;Odh9uqCqs}_%rAmcgA&Qb`nNl?bK=oO*|y;w-sfKWFbs#V-!>qw zY#ld;Tp|IThXX)=&j&e`(NIeflZ?KJc0?N|;v=K0dUPL#KLCl-y0&EVhJNWb<8q%R zaP{~_j(&VHsaRSrVNG91s@f--HTvC*_n~_kxD~`|e-a7e7gJvDZZZ!jzzO)3`&NBmuZFMKYb zD+~~2P2r<#e%OfZ!%S4i(w^hf*0(aAjUq&)mjPwqOi)Z!lw3`p3_;OCy*JLnQ=ao7 zPHSj>tQb92D6|OQj!Z5-_ztrE;}7#y_x><*guau%ot&7H-RMe}2^;1e5xPVPgbmi3 zW0n}Z^ARjkM-{LIA&k-7VG{AbZM!dAFb}o&Q@1G>G4QAhSYmMkc%N5*tXb1b;AQLl zCz()w1h(E)*^x(uTxS@)(N}sC17cA{-BgyL|1}`CIjGuK4+h7q!OYIt0alvoplzi= zmZkS0yop@z6*T)P>%_43sP7qJH>Y8FXGf22ALgG5*_`HsCjC>u`?ymIS$87mDto&C zXs5L$#1!I5L?eFv9*nYHfNzYZ1?MNAuD?{2oe|G8DGy`3#r>>=aUOA}o)ag*b&V#bqxsrfPa%lEn?y1VO{U~c z^-01lyb;KVdhX9)?Dte%H^j+Je;w=TIJ^rRW?_QcDjwNEB%MMzFSer7(bqe^kiBM7 zNXDGPqO}u9zx6CUQ{CZV(>{p-WSEyBx6N@#YO~Sz`e}zfc;drCt8i}tgGVVV!PIt2 zjvp149G3|9?X%tclGOWrgJXw%^!9)`AGRsann9ubUYDqQryE|}5%vJQj?eb;o*{y! zKMuV(I%LV2I6Wa%YXI!%{3yY*dc~*6KBnS=wwqP#RHtX zdvRfv)PLl0XAo&D=7&S;@RrF8*Nbe^UN!o^7v~W?x+XeGqr7giY1COXM&(b)v?f`u6Iz;No%OZ@hUm>Ml|BQ_}>rl zH09~FYAp3n)!w=lKyvcry`$?9wbKi!1D&gj9HG;lNAd10AHC#=!>(vkqCR72uwmEv z(?w~U$(K!>3>>4l*_4EX#)^cWN|%Q=wY zZ5&r`$iMRFqaw2R+L<0E@9%CZ7wB{44ez%KSZN8v-TB!jWT;ubiQ%ndm=cMxV?aYu zJqb_&O)<7?vG>!^ee92pSGf0GLWGYu~vSan2o zA}=nb)Vy5e5a5)W#5*3dz_i_vR>%8_2#v9s{b{tmx|9-{x!f55Ya*aEh?nJj&MPmq4a_xuLn^=JoLkZjguN$O>kHd~sfE}X_cRC3j`f=p?tC%iT z10qE)tkmTq9R#vwY8IgLcLyG)C&dvYVjsOgQePhlIZnim-ftAVCB{!En`pCWm$dy4 zfw#16?}L=;HHGmPmbJ=aOAyHhWSB7+b)FxCum7$Vcl&eclrBBsce4JPm)yiH@HYh9 z^A6Q?v+yip0@@EvCI_(b3aaA7^jv`-Et~Qv<;En^K#&b7Um&^5luqY?@mc%k0HJ?Q zl@C7f%@}$ym0R%%#an*ht2+p$=4KiDkV@m5bAAY00aB{_^kg0A@I4X)Bj0~#dIQx+ zTsqFU347%!F;-9LN^R61qrM{c?vkS}TlrY=GKYS*ycS3eiZxLiu?4eI(WZy%K=BQQ zUXO+LOjA!{1Ook1Cr@qoTzk3Ac_`@BSn(u(J!S4H?YA6K=Wyo&m?ED!wI}G#5?)QP zVbA>M`q^EYtMJu!-Ef%3LA7w3`8?>L>Evb<37AY2t%M zwq6TrJ(B3e4#oHrRO%$uAXObsts2DsX<~Q@!T`Rf=mQ(i?Ch3Xv1N|Drlk?fU$MLO zN0pcCnbdo^vsGchRKc?kc26xx_W*~SXdyl?UBMY%%`F(S33!F=>TN)D4K(O%H2veq zMumI~**F6lU>+yc=6ZVaP@XR$VDd@T=}*Gg|ASfEgWYV{Y8t~kBGISG`u7CUDO|ns zxcx!P;L)Ktx8i$l42^yY1NVsQSGvm0n^C>Wv3&HiEu+{2_#x3!L9n5|DtFJ|7*cuG zDc%>s7RG#aMyBb7oj~3TbVwM=O2XFer7;LbjHI1!k4dw$LR_?umnM!kaqsV$REv9W zqdd$E$Fsq6e>%`Ce!_KBk2wF@gme(LD3)&4j;%PyLVEQce+~n(Vj}p&Gwu_30OO`xQIx4gZ3(KFO0yUf%Dm+Ee<4- zfSwaAz}uB}IJAo!=Kh{}I;wX6I78Dmuj5=#U@0)5h!_bOyejcMI4EZzUWk#gG0HH*# z_Xm^`qzdco->5fvDES=i8sUrqsEF0l(qtLrA(b>NWHlM}2MD3t@tqOe%5m6zsxrRxJCA~a!lDQfe-x%el1$@5OBx*)ltl%ZL-vdx?U$h zX~9kWKqZQXoCD^fUSCx>jdcrlkGR`7D7S-C!TM(pNIxk^|Ff(^zX6)r3Jz`WDzqQ! z`JP^<;u!($a{j}%wu(5;m*yDizYS_$a8QVX5b)s(X8jaP%7rmPwL~;rDox#@y(Cat0&*%f9i|F|9D|^I(Za2=%#DOaWf}?clGM&L-p!r zD&1{>6$3WO80aM*Jq0>uKV=3NkRtu&W6j;0>lF<21N$`@B!P&OFQSeNm0U#H0JlM z*9J^e61Zaq)IfI7IQX`TQ2qI#C3?e2xPAY8hZLeg9E`J)6 zH8Rw;ZXV~$gBYiO7aSd26RN;x-a4~*As|vc~A!nRbX67~Y0QbS$E02R93%^on;EDU_6;B{X zM-i9%7^|6qF0Rf#wkf>kS1RK$^DAS|lzXB8;vG*gXqmZ%N2JJ7 zWjt6!ZcAH+Ts5p%8leqxW-x?3O^9}j4s4KLp|Aj-eE>)2t!Snst@c+wIXn9ms(g%- zjxcVb1W$d$(XRMy8$I&XE1`AkgvoNV!35mACs+fMYILj)M@wBn)T}}Hny;bV%_j>a zOwcY#B>mv8rGrr6y_}$jHUGU5Ss6(n$ zh&e_54)Px(CBhRu_zFkS$K#Ko!jUP82aSx-Fq1-}sF(fe2yxw?`)+cotp07Bc_H`q z`^#S{?&gPGde{S#qkpF9x$wfb*<@yln|FEuf+QOYK0#Dbq{}Kx|-Q81!+mUeDr(mBSnP%t0rl3n$B#W zoCl2B_`LZ^rEJvl5Km5oDzPdPA=S{}$;2LPhn_-j0EomT}qAUA#oVYbPP-%3);2VpFr5|6JTfqYd zc9Dudc?n>0QNfq(oaTP+vf299acUP1y)pesVTCO)$;3eplUYzJ~rvI#L79=B$V{>6(hMc!!If? z=Y{8Tx#JYHkp73Ft(~uUq^H7IRxK5t5B1idz6KdSPN>&m^*}$r7i{11t!HJqBcizK zc+Q{YXPn>s-9mGXQy_vL6JSzJNW&Sie>IU}B*7XAn`UBWOp#j6F~>R21{YfZ>k{DG zvO#S^bv^So$ymP{?d(3BFC2WZSX^<8^~K}3_S2w;THmb*8U@N;)FY31)J?dz=uWTP z-|)#WSM0sk8q$fWykSD4k>H$(_BFD;MszYw!eiPf|9cjdP^dk;}UM7-B8EoZL7BV4{ z#jfPDT^^$xx5XGOQl|hZ8>c-jgiMK!vE2SvSZX?$U?*>!AT%nLPAgs8oYgl0X{X;l zgC&cXgz8+Ykb7%9Q9h`Eu1ALfh0}0Cbk%!zZld-^z}jC z8LxA)Gkkb8ZyoLaqot})e>A$3sOnsIQN9H_Dw}h*@xfR|;G;f|y z(Wk2j(NUlC%6Rej;ma$kg_61Jz&+qJuIBjy)UG9f`&d0In?y?3P){NiHy*-Foa(+~n_BOPE(>Ph7^oN9oHKI-U%KtZcQ5lDqMeO3Yywto{TnP+r3zhf8-wSL4QvdzyE7d!vQ~5g+Q^QS!Yw$or^rbmua+**EhK} zaCdx|u3Wik0T@X?h}Y=j#wVzm>OkFI68HT<+a_@THAHd(5$}^v*3gP})uh&DjX!KS zK;VR-!Y(~M`yUHh5#$pJW2|5lle)to@-wo&Jm)U2GsWQ9nj;=nD3Qd_LqX>IXi4f$ zcyl<+FtKMk(8NAtByNSk%>|q6*3fLuro&K1?N^besXaXv$q_u5`s}u!A#YH)skk%2 zaxgcfKGQA!QljdwbS}cF)S?<9pGKX3%Fjy+?}_0O0l&{#f+e%D)tFXbBCrtYm36G{ zkgx%(2{0hmr;K7X2m`+3hkfl^{3}Ghzl{k9OA**k1-`7-p1OJxnlZx>Dtfmb8o*kR zNIyhm($h-ne7 z0nf*84fZ@_Yl!HtTq8I$q;M!LA$$6F6r=b#fBDocMy$AvuNC&dvuY-q2)DP`3Lo5Y zcA&_l3_~y735gu|iVQR7a$uGxVz41}7fb_ndQwuHdhM{8XvPbBG5+I8vf!`f-U1Gi zj|$9{-4sv-FW9-UwlV5EBS(5}1<`@m>5&!RnMcI(HEg<|p8c#rIz0xaL78JVx{WCu z5SUFKZv(YS_h&nXaBGkO<;8^wIMSnkx=96}W+1%k2hRMCO+kbtgXi8{g47`Gkr-5i z*rq!!8gmv$UpJLEh0tZ4zhsvetxbMPsg2C9&WJ<%64{bq-K?1Y*#dP1mqcP$2v{xX z6JTE~7c55Eod~}0eeUA-$=VE1n{)9M9%81FN#8c366L~}29&vjT4gK6zx`yf<g!_BG0?1^dTBF8+peZDH=*O?$Znl}{9qRWttGrcRvCSx?JW_}O2l>{g zj~Wy$hGOC1VP_!h!&0ykf1X_G73etwZy$@;NGJ;5qh$cAw2(DqG8%wyr;QJFA59V9 z?D_Mt%GrrdmJxHG$#X!Zwmb`P&VHhkklz*l?x_50%5G>8wUIylXSXR@YQ+L0l?1Vn zE;Jpd(LX@yrEGN)t(J{*HZu@jdO~y0e_+PnodxuF*>TR5u+*{lOfoAr5xmvUst^vP zGD$7*SG|L>Djy-%VsQ=_0~lmKY@@5H@+kTP0{zc;21!fveT=zmhrD_kT_~H*)!=A0 zy3|F}xI{sJyu}xBK_Tb7@c-U#S_fSvMm@$H{uHghoiRfS>~FZcm3<;u$}y^6n1s8o z$5N5;ESUCi^V19hUqp$>vOPQ=P0faaexl#%fu~eYb}?J%XsUo>LKv%JY_Dr*bw!;N;$SW z-Qns+%9IMB?9%WhmXPFP-8c++FyQdEXdkz_&1&F1xYWOT4R=V?OVK1tKYj z24r>+TEr1np<$@wriv?8=ydB*?CcwuAamTwX$b{a2>CPn06+9){TXi^f^anVNn;}{ zK%CW&oTSz|OON+h=uWCzTN)vALNp@?`!gj#;O?M-L5U)XdzG-CLW!)8>O~iOHLOQ8ld46XZY>H4Zdl{%+ zlW8IskbZl9pK_;_`R5bdYLOuq+(gBS&%a}RM>z0IEc~3bdGI8d{MUDW)%o06o4A=4 zCqHiz`xymyUCGA0ooj%Db4Fpl@JY*8mxT7$%#Od~m|=sHH^-w--vfu-)!lqy#dXt~ zC>V6O74{lUN7myeh9n0NNn|r8e-%;$G8a2dzLOjt8LQ>T1u3`6gng#m#Aey_$sf2I zws$so5BR*7h1bZY;+TR@UlA!Wptxt{^LuVaE z?s5}cvgE?Ax!J`#X%g{VB%c z=K-#gOjs5SR>B=Y%I)iCp&@b?Z7I>Y-qGvU`kykZxdG<|X6}3HwA>4*B^(dC|cYQP`OxS+<$W$%-7#__*JY#&3O&$(UUM0$%1UJ^adlg|R%x%*%>L-5fD! zzl)??#^mb`sSko`T~xT2D+ms@Xn!b15`un$EB6vd;7y5w=pN);H6i0fS)-`J5U*bWWg8(k*lAWB*` zoDSK`S8PGvd7H^cmpOA`)IIRonZOhYK8B?8S9}%u(;6IEwkb{C$U7m>>nxcObh^3 zNL&q2+e{3SKElmeI7S8Bc{wrHxAK73zve^Fb`o^uESOe0aBFiCD8@fkfimVA)6(7u z)g*?E&xwh`M1S>YnRL@lSt*4M0PR(@pgmsfbz8NcVk1AAzj8xwA;pXmg4Yr2b`mwj zpwGDnkagvG_y|I1lk9&QA+MZw7b{J?74UbotLVo56HPd3RTPALlECCL#Itvs2f4tZWyOIh7 zi2mw1Ij~769~>miL5)x^4`PEmF;NE;4!a|N^80c2ndLT9z>CSG5?H|TY`p}$SR{Mm zB;(L)Q1SWCBjJu8znW1M3wJ2?OD*t6jD#g6NuMCjn!K+G&d+0?2q6g^LX1dWkkw-qN= z4hv(Dsk#Z|#c^P>TV7>0oAl2tdv^oo))i|?vHZj`*-gKySgaHD1YP&>=sv3&f=w;G ztl+TFOoNC=Iy09K=eR24OS4sTSRB}$Wy&ij2rDesi(7Tnx`${D8hel^tb8tfwnq_K zc|1x_9vV66Q2F(3pu9p*&ow$D3smmhS6Wj8||B`yid3Tea{>vk!II>8zu&nyi;ESm6!DgptY;Nd6Nci zC9u-DU%XRvKSp9bMH3~ZX04wAI4|w7a{AUqUK0=xL2sB=WPGZ>h7i2msn%&F`84ZGy7&1q%r_osG`;PTf$f${F!PVV<|2j;&lBaO0m%0CB#Y|A|Ea;`S zgATg3IgvS9E2i`?`$=$k8N2f78b#O>M&k?Mx|adC5@;X?E50zx=w-k>eJ~M+daFmAd_CU!$O4)bES^jr7oWcI8oYu6pDyz@ zIKnRA)gyigGHtibY>T`@__d|+O^4?9Naky+Xz?~?jLQvSII`k^p?Kfvm`sCx=IK5g zjtWOha$@jYb*r6Mfx+5G=KFpXL5HrIJaP9%;UrDTJ|VuJnxHOkf@1|H4Mwob0{G$N z$~#wXlR0hbF9NvAnH#F3Qmt6DtP$9Ta(%xikoJ!PJ*_ui@#6X5uVM_ zjHHL(B+>Pa0hvl-Mg#-x9kO{kCyGwYoJJXPqw$UmcpRpM&iyMq)LUus$idg->!|pb zL{+&wKsbFBojQz5SFjy+$ZsApjgv|DP+0*=aB2+eea(AC_By5d;WBf`LwcI8ZdM6x4>H#k9#&gNrl`Y3lR4G09)PEh5g>IR8oee##FhY?|6$goRoXa7e}56lP=gw~$!ah3OiS7YKt zscQur-it#-b?D2sT1jx!d&1w%!Yu0BE6U{$dk)3sJCmQ_ZXUCGmnCW$UCxzz>weqwlOQ6PdIabh)MIav{1+#&HBP zKHKHe{Ji5c`i{*3fd1ljy!V8fw}hw*jg%Z6L;SoJ(p}gQr8X4$?kCf115!JFP;Fv| ze|V^_Dw?}tG}QUua16Cw?X8@mP1wZg-|8g;QTm|!CfSck?B$QuBOJWcw<(((E7+(**EWo134K<;@YDN%bMoBMdTaCD>5v|Vgb zG!4=oB`T)B=gSsPO=X#>>pUM&!Gy?A=|@+3Uzd%9u^K3~=R@ZG}{JpKHVcWeK z@L(!#OXiA~GA8}U8q*4wz^w7@M&zqn#Kv)Kd1?OT(NJel@SM{BHt(j+c=&ttA2&lb z`$@O$wF?KVY7XkD%jh~PZw2%gm%rq&aU9cyH()ygDrC1XPiXat1wKz%^jTVvMvvX> zcxwT8>%R4^*#EXc+HIbk`jN$6n0`!V!Zw_V(rHV zk93FGu-YA1<%zxYoNSfiMkY1fy~M_c#s!&M&C#db^+2topl3X3mb1BwKt-H) z+wMmF{k?Ox?d=f6qo)dgDe?)9&qdK%;NA#U)Bf7yF%PU25HwA|TjUV-kR3b6!H;_n z9XsnnE3|CcFY?Cqn2pPE8C0xrA)+;XzP`0kGsDp9{Jy zhXDE0F+xy;Wk$qjrgr`){~q$Z&}88sImy*@`z!gaH_J{5yqN2$U?f?Y!eqZQkspHT zJsvDSl8CZT<}xXArg@`mews||HY4>~f#-}Cmu<2*t|F{Kp(M5s6m&^ZOO;U206EhG zV9dxxy6#|lX>tS2yLPk)6uiIKZ_L*pQsFWJ>FS80NWSMiz|T@>yl$ErAowD;WE7#^ zg(41lvrb{m89t8z{}C^Qe|{)~L6|!>dPIoKp#I=%%2#RDuJw}x5vb*_=W_3iBT^^j zeFKcZonxe0Vd3BtrubM_9)!BnO6s+};>idG(#&_G9CzfR9dmLKj_LQXO}hlkoBh|2 zqpn={maj)U$7CEj(_?a;E@r0GkjqNTJvG@~?b4;&2I|+$(q*@|q5pw`|4HcXNXkcK zMx&GVP^*@r%J%>(u(~qiRWI*QI%ShX@Sxv0C92(TMvQdHi_1y#RJGCdUnTRJT;#Fc4ILry$ ztP#bVLd%cP%%p9!dgQ4jlVlG9j`-*(3nU7YNLH;lU3!_^LLx=_(S_|Zs;yLwI+WWu zLZjbWm;`XuSb z{2*R?5wb%8w3*J1nY>wPdM^6b5;B>!Qs>Y0HI(--L{30|k;DX<7)hGFlk+)6j!1$y z1~F*ql}*vwl}+G&W4moZ7!zr8nbudsO4-&Yb6KbGP1a(QBDot*!wD~Zuw^8|(XgBe z#G=Azp@GVJ{@^lu*J5v2IvY?-diao*xZSqQTo~9Y+-z(ZOs9RZpJYPpJa|udqJ-a| z9EcEBZp7|)+7!^BeJMZ5K2p+Sr|efVlx`$*7sefs=X1*PEU^~IxI_Ya%lK-dnwlge zI243Xt@2kotDYTMq+Zxh?dWC%&mgg~xHfm>=7e^gqPkA{Wd4d3>TAD&y+`>n(2{PD z_3|NUiKnWHN(VBA2^vOhtlqqOZt(Ibq2QvQ8s}WS^%wO*Y<_`l^&s@aJ?V|hUi{ic z7zzgcR@#d2!sg$WHaf0|rxg-ZLBumw&R1j{_&@b)6T{;snEm~BZV70@Vk2U8eGx8KkO!0qk?lCcV?>HiUOyi)$!xvyz?H4UKvu4!YJ@KjNQ@^L5q+x{W}80_J0iCG zDXy9!LM!7yttSJL`Qlt7QZ;SiNvM9Xi>DKaCE8w*o*7dlgo2$md0`k`>^D#XG23xXeEQVprP4#Mi&ymSPd+d{IpFNr3VlZ=sTOAsR>&LGQTTyVFN%zbuS zeqlRIM_%vUh+)h{yjU(&k~(TpF`6oOm1ER<>x5~GEZL!y-Apo#o8 zS}|Oeut?#}dz^p`omPX?pFsMA;FPkqVAucnx?=+n4v_2N+r`jP)Lpi9zFHZd|Oq6&kI3}*d zOFPEY_EYJZXeniRxGXRiRwN>o*1NX`dHXz#!IOr8Q-E+tW=_Zu;b2K;^YAs=%4!vT zKRk}YGs8I-XvjeoEepsiYHy(A(8gfV@~3?lF8c{0xl7m~^lMRYIP4yP%#H^mY(H+t6>D(5a<#`X*&plk$#Owf`8OhF4K9Zok%^3at+DGnf+%uWUEkvJ5EFjwAb}%~m zAUVZD{NTFclD7DC0>a;GQ!m-b+>JVkGCt-lUj^1tKV#sG0Jeo+2h}&cnHBkT+#;y- zldFz5d`59oz$DKWN`hvAGfzBLRQ9BZZ#;M|gvnU8j#8U2GD&`R^ms#FgSqBNO|0OE z83g4(uADFviPI2i@$Zyb?zGSa;rJD~7!XyumW18pN|+gxP6g8U8yD}HYD?Z$LD&Tl zy*3M9%0f5Z6>BgD9xvuEt>n8rJ0k;as!B#M8rj*-@>_8Vxz~0<>Sb7GU`u?XMEDiS zd6Zc)@#HLk=(A04UN$SA#HvVzAS#JS_hXnu!+ATS@*3@G>dB==tRdN#uH4Wt1Fa%= z5hMd&yK?7`;nyEG0_D4pu#0<0ybkbsC-EHBIzc*ptJ*q8o$-1XH#0{RD`nCu&Y6UL z6Tp>*IV}o?f-az$P#YSwUPZrKN1a^WH^1ZN4NXf(y2g|B%xTfgdCu3alp;^hI-@cs zMv*a#9%#4E{F6kA7oH;Z-#!{mZh_ka!So(@w@cxU85K;|dFWam)+@Y2*gm!H;0lX0 zgqPggU}!a~(-s^MPB8sNSDwQ#rn7*LOIVAn7`7plTxl1=#pT2Ot>On2UyT3fO2@kJ zr~&xYw}_V~5hr#wb!r-)>qFDD6NRg2stP`FcW)bJ-p%}%`Z(6hT0xMlq}s0L3cj&$ zOEIfDE`RZs+)W5cs;{S^vOT=fiCb{a{GU|VR#{0;PxVy}POV;Mz-~}t*O{=C+ae!hnIOf;(t7|^R==#H z@S@6n^`gavzE{X(+Ou}~$SN7=MhDKdJwW^khb#GfVS-a)ZII$99D-GED?2t>R%-~u zFheT0xPTL3-h_riA03IL_FogTKXmB3=NA+7pnA>V9fI9*sb_-9&nkR1bjQ{r0Hw!j zG7T_7#P@O$i!r9y-UL0q>20Y$DZcnML$DBxbYrcm3we4EeJ!HM&&Ww>bAb=c!fB{; zflVP=Y6hk3un>9Aj(DpS-^mcR$*nwy)Z0DS6R3%UD;~1;?`T?ZLk{B4P0m|vnp`Q2 zk<6X<-sW1I?M=3M@-W-apLNk$1KNeZCtMG-tMM4LP`Z4UB>9FES!4W4*@k7q9C5;+H^57e7ug&|`oqO~NoEE1`?qAFKCMJWEs2 z<78IJKV#OG8!GqL({_LK04BS_Ga-(`e@~cQKN*f#d?J?Pu|&0V zM(=%4o}-s1Yop;dP)}k#Q?Oc8_i3B&x9WZcocogRHkIaIATo5cGO}zPVODVHKXI@& zbS7H%Ofi|Y%ak7*S%Lg}5WDb|Tuh={GT)^mCi^sW2!G3t3dP)j+hLcB|4-W8H7;p_ zYb9Zbn7eUg#R;E#j7U@X;qMBteK(xq@-fHVor&pl*G!s~YEJUQLl*Ap{_X{`cNVPb z2KZFrx@XvwGGzL9F2XmH);BrC`qr}_fk1q(WsT*ajePKD3DW25<3=9UE%#WArN~>E z4B~0y78hmBJK>m(PEz=`=M^ z_Q=itG^r&{s*m05oi~k}1Ygq%7Ec%x1+bx#q;`9;S}Ro5Co%rmK_;zw$Et1;z-i=B z%XkkM@v7WlR~aoatVE8iKn+f(b;b&+SLbgTKorc*s<4`rB;QZ*LFqBCGGPI|8xdwq z0~~n%Bs)*E*NiyaCP9(87p=hO92@g;V*CX1`gXm0W{1ur6FrDg7bPmh?>_*`$)IxL zlKjF}sr@2x@&Z(OuIYE%dUpAGz9PZp>7)E}I~UL(b=Z?C2QsP%hOS@fZT9 z3|p}lxrR2U#EcJGJy{BGD;4&N#k@rT;2==gpxJa`s$wb2&s|%tdA|&z*$Y-LUjJ3rv4XW{izgu~C69 z2s@{=@b%>Zsx1E~5#f3+zGjbYUP;&l5q2$~Siy%yyOPk0({p12LQYuC=u{bzn#udThN0Zy}pA+b10r9;~9T|bB&4x8D5u+ht z2G*n*d%R`Es6Waqdj*xE2H5cxeedQ+g%Y>9wlcMAS!y?0Jf#enW3DoD#Pr5;Z)P{^ zzSm9xRL|ucZByH)Xqb&={3oVl6~^Kad*194eghY8X@nDI^tG~PD0Mrk+L|@X$R1(@ zr@qGyy$a}9iq6bw6m-eiZ(EQlHLT){7_PvHk9w^UX5Dg%pG3Sph+T$#HFX@5N%NYS zUZXcJHwV*jqqs%|?=TR%l?FPU2R6?WF{<1UF~ie+)D5pWteblT0oc8*sB09Wg*S^c z$tngkn+m&L@pteU?_T9_w~spW4h7;eY3bHLQrK1>dEQ3zt|sA09qkKf3W3i)2zL=h zegcMf9m>zZ3TqEasBPq#6rlL3WHkwVyx2ls1O9jzOj90=(IXXp?+09 z?-x0pvwWSj13t_-l-Ph=u&byj>C-{0tAQrEzkx*bU#>haAam_)QGZck1%nR^dT>;3 z+H^1pP=Cf}Q1nbqnpAS0<1b(o<(+l-7j8NN=Y?u#@#a0QL0-?b?8KoZkRgHPh(53- z9(kmf{Z7{A9tl|bE!*3r58e1DIvJeo$7gZ=;{LUYRmm^eb)}Jlk#0AKr$z}`oiS}7 zX;LHr*F}TOdyw_z)g4l9duFIIJq#3|P=MM(I5603-@kEF)^NfK5IQg0`LhmQ!b2{hn64Z(O1493rB?SjN z1)OKOD2F{v0erUC#|8+Wu#nA+Ao+O)rD>k(_|j81VftJZ*s{NirUTa-FSv|BA4MgGo#%(8w7UFvAb3j9yiml7fOM0*i-xK=DZO);E(TMaml-az#&Rg?MJ zW~xuU*JRk4Ngd|U+$R3G>J}f*V(xUTvC&h3ci|+pk1m~~N|1KLxFTDsV8TDD6-yP} z52iNscx}oU+g0<^@!fw7u`$#aEvR72ypb3(twJCZ168pINm2u4rb@!plsGXcejgTO z!jOBxjQkvR-0bxRD8;}zu_W~s&>2g|^C`eb zd!CQZuWH$?L@pQG9;9xj!L!etj}f@v%UPDo-DN@HfkQ6s^7&CFGB@S#G7>jXyw%n7 zcP_oXyl0k@464N?-yzwFkhfmhvvo&$J|cH&HQj%*ue}70jmHd1W}NX|v~ZHTk1+hH z``M%|nSzsF_Xam&dz76o8s|jGzoGZm2fbq|r2ZQiMlLnGOUG>!OaSn@A31gOZ5kRN^!~H9}yEFJ5izVTo|~=Dy+-^9?TVT6mS{^p7lE; zz;L?G0rvF+O8TDFM^%tk90xp;K9ha&9%&Ivr{cOs&VEO{epw`o>DjwpsMOF-$>pIl zG+{+I45F)d@`|r9XkQ!98!wM&6;|S1*wfw&N5_-&oZ9QSTUH7Q>;6U70Hf)5J57#S z^;VWKhjb)@_6hK8EIb|I^1!{pZ>`f!Bew1pzV=!l^_Ek8(Y!)Wm0d@rYlahTfJ2Ph zAD>^THc8>45uN1&FHm`&IFOOK1j4gMi!v%IFNSF zvpkM>z|TuV=W#C6PWY1)FPcOh^av!K;w>!!V25d00V|UjNKEWxcm5Jma`z^`jV4K$ zs+*go)0e1l+C*`^_ERg{3ZpjvI#+6(pn4YIPrMQrkhke4pP9M03z5I#ok|kkbRk75 z@shRCIQ>fl{y+Bq`>Uz!egDUkoa7|H2?Rk%p#-CXm4q&qB%;8~Sg?#>C3F?$EM(X|GAvUfs(u#a8JbbaoqK=dubIJGL!a?hL32%ZrmvU#B{O zE#|#X^zmfHwkBo&hfr93r##{r_GMxiN1~V%N{<$t?tj1=L-~p?>PwF$p55e%dcr^? zYPlj(Cx}EtT2|6X?h{0K z{f!n2Sq#Cq$}3#xHZ{%Z)^09tQ?)2O$-HRSN*;#*Zy(w%>7Ot z{Y~ES_Tv{I&jj;q(of1LaayNP+28?TZpTROLQqo%c{^1!E}a^rccRTSpOpWA&^(># zK9%TYh}^9E=)K2)PBRg7%?L_C!vfoe@#|o1V9!kDqd-kzyQF*QkkMp;(ct{aBM_oJ z)5$&)2J`V}ZT$Tv|CNt)Q~4Cfrjx?5 zyEcv8BNppA;W0*>-Cf+mtFuWfN-WG5IOe?%C2Th6aUa&!D)zCiKV>xH(y~k|t8#}x z?CnEXbHrQko=h^AKY$GMJ*1Rk)2YxfVqvsvq5pdZ-w*?mm24!T6}CKwAGX30Vn zxEZE!2}|e5Ifv?4t(3Hla99j3i(tSfm=2lQk?Q_g{#VQo3RT+AYAHE=Cj~bpFBqGw z8IxOPK2WvR#|NEJ#4Ob zpvx82Zl9irx?l&FHD?Mu)L(E;wZ)=1Tv$O`uACR^?BOondDi)euubGp3K=aG z+7wFgX@w=`nAC6KGW(kF4Hfn1)}5RYWWc-#v!&ieNjz!KO_F`V0JVh}86Hxp%@VBC z?oYi=XjI8O_3XRJMydC&JP^muUMY$3iKhCdQc8a@yV;Y2zvE}*m-N+0r(6y1Ep?h{ zv-!Q9%e&NP__?uF-?&w)1TBZOq1|m;lQ^_HPQ)e(@hVwgUjamQyN$T)6=y*K<9|^a z@U%y4h8HQ{xECMTYUwj3iQ4V0Re z&o}+ozEoj2vzbA8PL))rY`dF^nW%8H79U%&OQgFOQ>rTdiam6?Yp}3h^efWhjbi?b zu6nd>^USTs8INi@4j%<0!vV` zG*w?%^3D~Tz?(><%&~0J_*E+wvUOe(cFq8AjO}Tor?pBLvY4p41;UruM?o zVLIp@)7*_(SB>*!Gw<2ZeC=o5u@RSyu?M$cUxLr^ZRzVN`aL}~19EB%yfzMgslXMS z3I2^I3JplxO{7_`Del9{k=%wk>f0%~ewjwJehBhRUMC9}HMrdiYr(Xa!fF-Zjd`3X z?I7P7Y$niCilKbrVP5PZ*y|3N#YoF;;!16rWtBv)QL|&;M#-(eJf_$UL0NJ`OcFU> ze;=BD!C0q$sNI~g_*4gr2kl|lX5Wjd#?45jBu2COxeN0f1T2xA520pQ;H@rp6D@i- z5g*VRg4&-vhDbJ-p3qMc1%1h}EVVgedD4d6JUaW&(aPd+1Yn$4G~_0&H1irJpE5l7 z=gZLp2fEzM{<)T(Tu;gVyMxXK~lluv&QNV;&1YZ*E8%r zmclDP-a6P3rF4*&`;{K}g6rPq3Pf8fbgqJM*O`8E2)d0|)!}AxEO&rMs*n7f{pB>i zQMb#?!EbGK@r{oDT!&HUeA@Pqesh;;efS46_Nszmf#*du$(DAPr#1})yQYPZY4#@2S>aO*gjm28!VCDEXixxt zr4*24nhD=^DEg1fYUIpTKb+6Tuha}zKkp0|!swJr+>HI^O;X{NdBs=pX|LAeSc86Q z#l(6?81(XDiP~w!2fn~QDgDR8T$Oj_etw&pEPh)RLX5|~5C-7G$e;o1ttj?Oz@_dR z6PP5;-iLY+!dUz=^v7-^EpjW1DSaZ=W2s@5UYl|&%?|x4O}BB^{+X9QmBG&X$Yj5o z`}JO7eK9NP>ApFTGZa5=!$7-*<1l5pebXsM4zSHy_`DjSls0sFD08Zv{ZbOmj!Z4{n0xPa zo786=xk(By%vUne+(#^+_iV9ni#$lQf@1AESYrCxsL~YCY~{=9jsx9-kG}~g;jGQ? zS?|0=D|9RklH!|6s~gp5PPOpD{$pstPDN09)`@EbKU*6!+BGA_^NfT2U=9qQTy{ry zDxQ>ZeRp&>Y0;~jGVkG_>t^&4gViC2GM?QvB6y@KeJuhx5>@&fqciYkPii+f+YP8d zG)PVp{oU)x>6#?~*WumM9}n4u<^$FQwL8QouuxDHOmb}MRe>j@z$9aBYVm{4;<%3>M>WO( zPN7{&vApAVB}s0~Qo0Jt@uMXUElJOC*=Ha5aHZS(OriUG*X)%|-tygvH(;^lU;DyJ z2{}PGif=o8eNTr-`6P_jPu|}Vtme|rEIsrR_c%-*u8y68$Qs9gNSSS;`S-D6^!Z6l zy+qR=OYe`1v7&_J*p*ri@9Q{FCz01|86(*4v~bkzb)F$g z&^~I`Z$2FBxFzD)0T<(0FW53m&~<>XdI1m)P`(~hC9VbvTw<=tlHx1x?w`0ycQw`j zI&MXmw^TQW+nOltm}t73U4=VVM*Lm#Ne%P5W9`&v8FMP8)6{jMJ|p6W{UWjvEl|8J7aRqiOVcL&712nADEn(qXb2PM*%i8U=^{H_ zz4isZWS61vyc-08k7CZ~ey^`1-CpC199|J_)(N&K{MqsE@tM>&d_uxf0_k5#d53t?7u3!&6k^jPoHwWOTH`Qv*WZLV90XWgLP9hu{-U5{ser# zAMSQVoP{U6GTy}_BP?!2-K?wFHtL{QNA22V(;sCUW<|JZXO7%V{e}S45k0Sr%LQ;wk~u&^^_0G7uV3uk>lcjBE+KNcf~OxO_=EVyFX}=x(X~=`xp%+r`YSo zc@901+e9K72_}_{X;Cs`)M#d z-Jcze>u^QZ7|Y$nhLK0wAx#d{>}&9H8#UHzRQF=$kja z{OXP=oCz)HTn zV+OcC|IRfBaC7A5&&&J61{!XUlu-aFx4a)k7N|jpNTYJJ0;bDsnIw23TqPe+= z0q5|x0a`DT?c4v}8S-{7wA7tKPgpk6x(J>`VU~afdl7OL?rbdH^k~-$FF0IUkiuI> zMKZA^OL9ozUoQ# z5w{;VOxbi|UO*?1?){S~dBr~5y5RPDt%c9r0ak{Dz%u)eTTb~hmzO(grZSMu0cB*V zvDlr9=e^uy4u5O^gv7JIEnWmabG!$BH*9MQu}t4ai$)$lP$aNFVf{vL<*OU{7LDWU zASp+3`WHa{P6OdPVBZI9O{^DNa?4S$T|y31%q-i?6HDGiYKAHvVP;jc+E>z(%G}+> zyWfJ0{ZM|z(o@gT(e^mGnRm*vZhwG0@z~8I#p~Bwety-PGbE+XSt7qUu`RN~X zkvdHLd(&toMnIO)o_+PH(dzDvQC_s2ixfAMU!4Rx`sY4HCw<&}8pYEMpD!Ij?!@ew zv`wyF=>+c>U5vb}H+#+dt@+IT-8YnN_siLR?_GKM!trxa^p`ZD*416+BYw0tf3v-^ z&$;}28ngE04@pI6^+UL>@^SNH&%JZnsj>v^IEs8vu66bT6n3vg>|eGfMxxhA0lfv_ zA%+3wEPx1FF0{vljkxQn%w6RnXMnetlQVWaykTGzpjEK=i6WV$%J`s;JxO&{bZ+ov zSbN#6L*9f5QqH0e$EZj-1!#z=p=b);Q(uTu1i4!zmlL)njxgU(A~|fnYR+Z zZBIttOY{1?lqvUC{IyslB4*RwzPJHdY|Yr`WnAKvVxPJhJEIfbRk1r}{-_AP57U6a z-V-^|&V|&|V!=UyXQi|Yv-p~l-c2Rd?XF<;$hJxL3}9xVY|`UvPD--`HX_KPRRwt) zLNMw~klA6EG}OQwbbzadNc@<)K!zS>PD$P zTd8)VokM;5QDcp>qLnN^nxD`2>HjvoJqYNa#jCM#YcnL&K%v*`xeqHMRyZ8+$?ae<~VT0fYBT6Wv|7n21E25O?!Oqy&! z?8bHb1HbrHXSis%`q%JA+~v`Ng&PQ-gy*~4-MNC`##f~3iqZB3E=T^^{>ZJnO>=hT zmh9By_mFgIks`~}v6McsaH=RzX*?MAMn=%|HD&_Z`TO_O0-E2wQ``O8_Z|i+cftIg zAGL#mf;LRjG^F`#nTsvFf4YJM;2KoB2|s_Weo3~Q1byxqrJj?Z++ruv>2G@$4W(Y( zjb?EG85**_G56x`l@h;a!`BS{3wr0au;*AoA6+NHHsEhx0)!0L@PM+$f>JTHT+m;K z>?0tiNB+vU_c}E!YztIKM+x#xlR+K{eR{fGN(X2NYDo_`;K)_&(gbq0o|gbv zW~e9g?n|IG+f9&wt>;5E4cHB=p>8H$O5LEKL$q6ikGS1!ug~pRRqZ_{>07obAe>po zUP;OqhHAzs7iYI47H!9P8NAUj8h#^XxK_nB7{@F3I)7if2S1k%OaGzsPPSt>XLL?g8p6KOuCfE3F#Azt}L z&LLcv2H+UqO*>N_(9we5a~r%ecIK|4MGsrp?Tyex=xSV)qKQL~!!|#vAHDWR*#WOH zD#9A$puagiUD4nRvUsWlb*y7<^t?GUEwfi0Q)|a?CtdVf)u; zL?pRUQS5YGc)sW@CVtwAJ~LTgW8(z#FS?52JftZteYU;?N~F8q-tI&^z(y|Z8C;{u znsO}pH~NCiC%jL0eD-#@ixanP|)7NtAwYkV|%-!^Ma$N%B3 za>V{gN6MWNUc-0Lk$MU2pm^0la6zn-kL|7eBWnp)3obuX_JHxEpQYH}Qr z?GE>6>oj~ci`{$Pn%;KTS$VkE^Vd-hm(l|5o{7Ue8d9KeifPbs#UKV3s- z#Qwvu6?f&Zd(rM^?1v? z)2O|V+qPZdF3OS4VI+6Tzj<`Q92@A)GV3Joo^<_T#M{hE5HJs2R&DfQgrxN2H<52B(2cI!As=92tQ|*kGSmJ%1+rq$>ufaGxK{NgPYNHChLXIS;fB#j=D>WdpIlP z-^S__7uL)n#@}7tRHZ%f&Rgl)mXEX(%iNR43_lWo-ew{jnBoAheY+K5zS`wq+tzS> z`;Ssq;P)f3i8nXWihmEmw5uIT0a~pa0({fYx={!K_x)G(4(_KWXHo#VE@}X2p%8Nv z6|oaxT|!%X?$+cY&DUgX$s9GaoS*4ZAc-%hOFu9az?%gux5JJ>h=-|;9B9PfI3_`_ z9NSeV)|0ZAV9PZd9c{wRkxFs34cslC(SjW>!banBv)FU&C9nwiW9YxR>p7L>Y)>amN&Ebbw5YH0*$9u_ zn@hTU2D*F-YEXZb0F0vm1{H|4I~z`*GX(qV1!f-v9%7<-$s*d#W%Mh^S-9vMKlT(m z_LPJ8GMf{5Q7h2|+Qkk|=ZLLy`uJk!8#3C;aQ0~_e<0+2TjVbG6BKUy21VAuflhzuOUntaMhub33-z}GlS-lu7pL`*(6yzCSHjqPCN-?%a1*_lXbS(`UD) z0u~jGxX|Q=J`$gOg}_Q3m(FO@?sAJHG#7l!_wo5|2-5#-7Z%g#_Q0H%tei#(FXPmZPN#=N3x)B0aosxbY{ug`fxaVRESWlywAx1~G z+jH+5yxsEAfb3X>+&BZW;$G%L0lCM}IG*rswNWgINUBxVv-|sox?MD}LqBV0(NC9^ zPQINYHU9(7!KM1|1zvfDS(PAegnp(V1yQfPp#^Uw3cKH2bZ%`)pi{NZ5jd7sI#O0o zP~lki#9njw7l+xXLIkIF4=Ig)9(kcY`)Yr}elQ2FWf}4>4lvW3$$86&RuQ-?~1d zvvQf%KT5&JV#W|ySw`u!LL(;U#u5*ZT+C+;(q5-1Dkbdg21533Lj8XH=_r*7Iet7^ zq|uKYM@O#CRyI|UM>bAo*pVmqaS5!}1prHx$mdcstU|6r0l)oj(EM}4q}%^UP7z`( zbB8WITS?DDsatF`&-WFj<};X$MEcasu}u1>=~>x?>?0LFuDZ~eAGftM?|XhyzeYgc za~vp+0fCmCDtFF{<-L-D^`WtyIryE2O#8ow@V{i70lLKcF!d5wO>Wv=lsS=oKNo&2 z5zDN6zSiQb0yYv25mLMRm6SwVGp$Zz%8(CdJFC~P_(L=WpOB~A^OpFtdSGeQ7F+H?yeKkh(^?2(DId|^Tn1{Q{*L(fW6xl$T@rfwJf>vg)9dAXdBMcU=47JPA*fn*U{HK-0#-a z`fjLv_NPOgubxWGGi~PoSg!&nLH$o5?p6njFssNMQTQD&LaZ5?>JvPyK!U+moM9Ko zq6%`H;!K0~>+aYJ(z@nB$F;N;acVZ5@O6~zJ#suc4-x0e>ui}cKGzxLPN0!-VSpQ3dLbF(W_1RamXM84wsk_ zlzCB5RHLo?Ks>v6*@(Z|6=A4+ zM7#EWw$d)xPd?Jxh(yQDAFSQ}Ij+U~&6n<2P3(?Y-*2;mTR+WwH^B-K#(hOXg`6mb zGCzze=uULyfTdv#rDhNCG-tyO-c@lHDXOhw|4>O(&uIQyEpussx!1lC?nftRI)pc(V5wZfnEx#Nv>DQjF=@yR*EX z@G=*f)NQ^dKe$&P5F^G#YfEuqEhOMCYrZS2s`=jX=H=jRHT z7LxfX7Zg{D_lrUz$iA;?r5-P8q;r_*tsydx^FgfSOtqHK00shd-jzFqcY(D!gYsUbsT3&j{(&I2vovFPP74$_s zw&kjd8j$!!ltLb&G~FRA#B*LMLBLelN?z3j)LB>PX*nM{m;#1pEa8*qyayv`j&7a- zb^Gfy+*y;jsaO7t_SsS^MLVVk(R`*M2~TBLHg*slYL!#!wZi2`!%k$chPEe6R5m|M z_h+HNf%m;~m;N`OAXw>6G~9UUu6Kaf6`XZUlvZrs)6EVWUpS_*F3LVvP=?s~K%Vy! z$$wb;EizQ}RK6qHmF)|&{?Qo$V_z5g0a8{nC|Z-`n6pOpFh)Aa1Pc8h=juxWr`?=(=y>4Z#NP=P+U$La3CWaW<&!Cqgrdw(7|r zQX;o2TlfDe^V-GcitkwZ5J|6%U^t>2(X8OrElB)A3#(A!X5OMb*Oz0PAMg>7&f`j3 zLa_@L^M)ByspYlfcRAQtC=yLt$JJ>`v6Z{nDJE5esLn%%Q~nCO!mq&4*#c0Q{S{(Hv9WX*0(-7foChFT+Sv+Hxq{wB?t+~%sb?yh9|8On_IIoF6R0{~@LkOD z-XF?1$M&>x{XO@i_^^p8B<*=QdS#UAVbWC{EI3GxCI*qa_eE*M_N86FmG*($5F?e@ zQT(=qs$?jX?SwuvHoW$7@?jLrMbJimJ_3zF_GG`L`!^f2Y<@n+B|o2IQ&zQ;)}{sb z9bm!qRb{yVUw7fJ{*Gg-o@xCuX&@>8upozdHhc28rV9VvYSvLzL0mEHbgpA-UWa9@ ztqaX@6E5o}SX}>1!TvS@y~{Szt8No*m=6^m_-5Aqs2ziu6eGToR)^u1LT+Z!4s}!0 z7{K|*V0Qp6G@s`5&8npk|9q6>GJN#R-ijEkad8*U8)ve^&gNxCh=1neRlGI04HBg4 z7K6x`?%vI_i^z+*FAq!TvrT6q1v8}q``>&QLGUktAjHHPmV0IT;hKU_09axAv|LCP zQl|%bNf)N4#s-yB=5f5{3$nN3fy=T)o9Y2CVeK+1o?cc_XSK$wD6IHoidX+P(uVq( z>`~C^xqB?^sa&zdyM;MBcbA|i{p%aSH)$QNjYx?1aQm*0Jx{@ByQIKgEdm4i5_#e5 zN-vqT4)sh0++FsG)of0R;)EatFov2Wke5rjtWN^x?pRFE#?=&MbCJ5psqxFVGSu^z zAkfpC`&Br`jR!|j(IotlEu!STlo@hsQD*Xvfz!ev;~((+>RreNufLFT|;s+$!MlbF=-=6 zN7IBU^<^?Np-_g-=tmH=VCxi{8{}p``omi#5MXZa*`n7CdPDulcI>{lNfTAD@?wi?!E~ z6^;!T7aVAQdgiLcZ_|L&VoOeK1ye%f1xA?Px1_j@xF&ZJ&s9*CS;Qf!<_QLq_%*x9 zS1(5pyc$J4T+hOiy^>fjcYAS{>v^ZBmaQ@p@Fp9p>a3@fq#1K5vn-XL9Lg zGIKuh64~>UU}u=exoaQ>6DO*y8%7eX3N1}GB$wfje}!9hGwX^!W0SN@F!^_m0#?|l zqmEW&35M@>0BUd4o6vhU%9|R&iU)e{s_j*L@v4@e6I1sn05ptp6rmPXhvrX_Cio>KB?0w0ttmz{ zZXnxjmf$XlkQgvkyqF7liz6vXyIIN3uCZ0LZN=`Y&$;U()jRKlS6_8ku*m(5nYwzh zW^+ZT$hBfPnOzQklpwectxH=l#V^@(oYUhY63r4YL8O10x+oZ%*kvI)80D&50K*zp z*BkuZ%X7`{T_ZIj5h8kCmP;^Q>v%Zgp_T|zf6T!Vv&Ym5CYIet32z#k4iP|~)%;H=%QW?ZJRkpHU24Fv0e^A5k#~>emD48ea|8~K zd{k?ubQX11(n>ef=c6)w65kC9Z09KE(BNyryGw+e-NNWr{w+v8*5Uf7Asi@5c|lwKB%45ELf z5Kav6>Cvl)c||u(0kVh$v{_%8m_zdzL$Sl_&8qm)0zj=2WC>E_?F$IsCG@B--ya_E zYW|_kq2IR-HQr};ytHUL^vX0942yV4L6cp%TkuAC z)4JS(W$bX(%xwn(3@JF)y7r2vrS?duI7^Rv(CiQ?@(Hd7=6$<=iEH1(%=@xdE4`!7 zJ|c5tYUX~_|5zD5Ag|0#I&sfp_fnjN1Ad(=l6Z&iH>;Re3b-ChbGF4fM}WC8Wtl5R zi;&zuAS22;o{7QZA>|ZB%M|%%+wW0(qF>-!>EjZOD>Fz^eZ&CP3oEJt%(2VNGlBnKN>e_;;?a^K4gW zO_Gdsfd?yZG#&4MgTQj8=~*s0nG(VfKUce*J;I_%;6;Q~?P~VO96w8C&AeHg39~$U zlyhPEQ%ufwS1*>J^pcd`3F@&qC?}b%&qY~2;oDDDAW1Lth{^;xK^}wrg(&vF7L>h% zz21#y9HMtI&e0v*~3zp%my9<#i<{Y>u3T&)H~$71xHfknM&>Nb#{oQS8^L zA{}6uV(`6B$Ly29nED&|SC1c2e&H)TstB1NBJ!%XC=*MpqWtR2XT*1f*o7E&NBZ=2 zy{l+gy5TmoYkn>yf8+CURW)B?9|o3?}`WoB5pBfg#g6M?^om& zoN(HXQ#Or83E~Oh_04(WsIQkMZ~Lyc$;*{MDMX*j0~iigx3BcL2ED?w-@@6joDiUK zAawRwiqAHaeO}i*6d!hCsmNJ99S-xygsDZ^Xchj$j2hgFRP2G)u0?#Wo{c~0Zv%Oa z5YYn3Z;aDE4kF!rY+?TUBl2V^D6rN+4>2)x2kv##sW+tDxs9sv>KVu`G(y4$sP25^ zY0)^w^oLBY)*w4)qqfv&*Nb2hF@w$5$neMu|#4xT#|vS%*TjlAgtmU~IFr=hz1O2gOyB z_oB9Rl96$S43Co6UMI)vcyn12z^k9Aji#x6u~6f4dWzv4VVi9!YUqkm-CVI=qzApx zfi+k|>dqgF17^qEF^Tk8n3YSzZ9MDKj$zVdGq~p^7w{8A1>007JlOF;e&*NXY_DIS zRi*{1#3S3v8# z;D=-%Owvj$B zn&UrAXVA#5V1~%4`{e6J4pazc*>^laBjtnHT>({_MV)3hZ!kuyt@L+K82xe%p_wb@ zZgcU|6TUcJyK)>!{zu9F2M&w>bwqf z*+k`7O~?mt`R!+WW5L6hH}#w)_lh`2F-gtmn;1=L~MIMVi7yXN*q^BlD{NhXRPyCYGVTC{|eL|p7Han zR!7hpL~~m|npr|wOXps=AWY7^TaIr&w>!p1rA4cj+_wo>HDMxI6fznq5X^)F>3+-) zx$w>j%4xt6X!f|#y|C{VlJmX~IZ=^SzVg{-B>2q&-f{z&Vc`wC^_Z@+pv;0{0P?b( z2OK=gUSkmkvx_Y$YmN=EN+*A@;8=jS!p4$wOmJQLe#`hvj&)DhG!Q)rei}&p%C6gs zx~Lo9P`tLR+dEaNQ>*MpHh55;c;Gn8vLcpR4+isA5}ZSZ9>F-&dgUHpmqvXJn6>m%x#&G5>oZ&vq) zWL7QM8$!4_chsS!E6HTd!ofpl@;erFM##%80vEHJURh4Hi1&Gk+y2ZDCBSweTd?YN zbHqolPZe8#^$dFJ37D*>?qi&|M1~HHqhGq~prwchHv67FRSjd+F)qpt^4F?K2ze{S zpo4VqeBt=Q_wdVIPv93rX024@0=ge3@-TzOC*+|XW3)`{1z3G>7OdrL~CH1Ir8yfgP0c|E4A{eNU=={`Z`Iz4TRp;!ot7KeI5~v9OY6p zp1=L}ZMrPD%S6U7=YSYVOf!Hd|m-&l`w7t+@`eXdv!J8 z>yPT{@XzY%mn;oU2iut>n^(n~K2@fuwhS+^a7u4U!uh&d_$;ZBV&!OoXL$w3 zs|Y+M<*r(HLkNQ%Gs=VB-^B{n`7)+2-En8YRqePBY|c+D%plp=v?Uf7qDj53qb7E5 zM&Mav`^<6;1Ur(RSUn4CaCgu=L_Z<70H^QDq@_o=h3=*M~g7HQkv*Q^hz6Hhtdg{GLq7Fi~)Vr`400u$C3 zs48oXX7&ZZ7mSJR?B$5JeBl%elNA8E`{b@oen9j(jK7c%VpdhWuCa~ zgR9(660YiJKGc}TH%{Wl6CE~;9uv~-0#sCi%IC90`-mN#oiC~meIst&v3Vm9=V4gmSYg`?44K+@FD(P1*xFrN)|*T?fw>WhiSKdERu`)4`S>%U_=KlfUOCe(8C`b zV>w!HD3WR$-${Heh-n$SDFbH5zxr-a?6fbwHfSCwOBld)cnb_HP4|;H?i`i)?=TDH z-~LS4M{O}Et^SSk>JffJF6OmIPrTDf2A{pXPk(x>ezRLL?#lUHq^j-oXZWkTUMjU) zo!%rQlaQzP1%C*3MW2`USWb8m_&X?AqitQ%Zc7K(A97nG(vq^@ub1-TH`-@ZgE`b$ z#e3Zg@x4Av2v?Y`P&}~>=S4UV+;HpuyfYJyXV?K> z%PF?hG4DN>nI$Eg+KS_|(gBWWy1an;k=HYPzG?kcDVjv+w)sUNEcQH-7yT>l#LiIq z0_m;XlX$PzKc!B8QLB6fdlm%JwVW{4!up_cB0q*uj+lN(~fQ?Cqx_P*!Y5T;bM3i= zM4A(>bpYqP^o^Ie>ccecK2HXlYWE)B&cz>BK^tlKMT7X727}BsWrR?4vmDYmO(F)_9Q2Nz(Jhi zh8WTYou4;(Hr!|wF7yQq+8oQhbdeX5v>e6sde1sy3%Fe$y6yI$GmwuE%@n zQg{Z^3%zaWIB@2+@e$hgQBosls*fl!gVCF2B-}lC!lX%*zToK%Xe+RGMHJ_TZO64) zCW}12WdA42-2NWBPW-XPy17y)WV4JZS%Yo7sBnLa6-dcWzt02(5|vbFf-4Yyavj+C z$5# zOKc@Gq_9B3U98Lr#&5cytH-rP;$Ot#eZxtaM#9AoBjEwazhD#fjtZY{m;6v{BgfX9 zu(&+}xA0nO>_pAZyME*IQJ>@c{})*M@5=hWh4|k>{6Cf4`+xl7p0@`C7n6TnSwPED zVTvx5?}Vcj`!_I{^bo0sJ2NjmK1O4>Zb#PxG$)X=P|{J5Uj+xhape2JH#R`EHr#9N&cx z;8iBY!bjt(FcGI06FI-fs#KM1YJ7aZLrS8ct9_Sz=CsAE{8M(3)VXAsd?;`>_l3y* z@!KCSrNWm*^~Ju~jv? zbTt3H?O8l!BeCDT3_t*Pq?E^m(7v|zwXK}&vGe*4Y0vddBGI3zr5_z#A&d|)7-?dkLhXx3tp z^3VbDtT7K&dLZ=c0liTFnEiEdrp)ep)i*dvdGU`L^O8fYTgLOb&(VTyaxnVs97B4r zP7slX(tS)f80mpG=JH|}oh1E#?Y(JOQt2Q64;(m<9t5)zLjHGbfMYR#{>-MdgCoVvC7ZN{aBiwfX*^{C`h> z&!+2|uCAE}WA{1dbAPt?`&Ezar$Pl-xzpyOgrM%!kf|OB{UZ z;us)tCH*F9)V;MI3WI$U@1n%@Y!3tU&_qj-I38j*K?z?r zdl;gqeEkFAg+vP=Lk*G5%vr6S4@TH7QX0q~Z&GHIgbTt-SDpgR(AxbFWtXdW!0f)? zPklYeUF&Nbhk8tR8CQ7S!tzSI@7E73VZlU!(}izlA2Ed~+xeb{#@?f_@9foS-y78Y zKvv+X;|`5x5B1T3>kX2UG}C4r@dj6J&$rC-1h|up7x09F;Q0YnI!IyFP-__6g)1>7 zEa1>@j|^9%(I>QuTfq;jUw8P)LXO2Vj@z43bZ>5o^bCOkv2gvN=u>=wgFJ0=OU`{s zcfsz+K2 z``>Y(UMCo4UiPsVIo(cu%5^)K#Mc}U7Io&GfPzlWY-!PTxiN)b7E7uxBon1)>K4jE z&iBw*kE+oYcl|at1SQz+vjZdXnvNNl-2EwYn}iorAZgjhDYB1=Yv49Vv+$m_eB<#G zo2ngU_u_2PzMw{YKL?(wn7@F_D4?agUvbkt`)Q7bpqx_hK6ShPOZTAasVm){@744) z(#UM#W_?`yGd-7M+G9h}))&>J>*|@Bp~X6Pj5?G}3VJHZc!(FwJhQI^Qi=HgY#$h? zZYdmFv*o6bNwAkTk3E;PAXIwoc=f#sNvEGMv&Tm$XKVoiHRZmnRvqL$05p9J5m4Ky z77IZAsfWDvz6yCjm}7nq(FH=T;-1YwWezT3_A>_d@2w78Qrp>oaTl@Z?}iqxBn#tr z6em3siBnlm9Njs-mI8FQRjyp0G}wDy0L1vAXf};jg<+(x1qgM{B)((*I8AqS6jk3( z$reF%>F&bRSA5^kFKenBI3x|>%GH`(0V=Clf-E8Wk1p*CtB5fT@R9UE+T^B0x74)h zcXb5N^|KM@)Zd`r{&p;;+#}vyWnOd@`9*ZwZNZ*vaq79Ve*fn|?6@l0xznjpLGPrN7tMq?7$B=5hB0RX-bEoN;q##crt|eNq(dW6M>oYcV4A z+g+?O-rGx+cTunJl&#xiPAlLY6)6fVJ=-ic8b%1)VR5Gg2(!^z(hPMoGBn2m+|%;5 z&pu#Vs`&L&0V)4G>hhGw*otKpRfzetWjlQ7+wh47FyYmd50Ni?6k%PAMO*_E{!AJ? z4A?s+E*K{PiMXpa{0RkY_4+;}CTK64@bUpHBdud4(0tE85;%wHzUdxrLPJ!P7C-A= zmtlkw3ib6?A+{V7z=r1_k??Qh-hTSqSN}z2BKpp~!162VES2F@D+s`_)<<#cHm2<> z!PjeCg24^L5ap}|!x7ge#IUwNOyLn>Y8=gY+1RaDyM z$4iBLJ>wCoJ{z2*ukxQ#kHQFJO>+qHyggp>NQ)qgo3T%42Kq?BMl0vix_JF1Q4xUW z3V#}*mGio@pBp5S60u_bS6COk3W}+W%5V(I`E-jJ1m4G&`ll@R=1v+ch`n z)_CDtA2yi{xmlg*B-Ws8lX)iXn>yz`ow}^NJAgyka%r zd0BopaQyzfim3V6S^a~{R-?M5OpV?O8wK*8$K6n_&Vch)^5s=)^WR0Nvzbsi*s3sK z-GH{|o8PI<1|y`=4c8%wIte2k7|}x@M_@X`r$hkjiZ#V+!4kFPvy*W5htjp&As6ZR z!ChHiD?~GD-$lmV!OMzPnIT}vfx4nCcU-wQB;cEbA6YAIi5QwwC|gf>K_Wx!q)Jk0;_+xAwV@{1K}sg^lW9M&@t@S&qV3T2aZ4^ zOhgPXnKb(~%cAs8=N{^;(pmGvp{Kv#7@~^!O!~=5ce~2A1X`G@TrBz5Fg9x-Z=(_F zW3r6o1Ox!!Oe+<|88Z-5elVW5zox1{LyOo#a?5s6I;WJU|5Pq|*<8J%R4hlcuRzEJ z8$|K-@E()NL;urR-wU3^MB>@y0zSsaz}+xIqUW&Z8X#Z=LD@*h{4$!N=%b;i<$Tql zphqMPDJDk0_3J}{qp-}DLB@{%o+ihPrODk^xK{MtuRrd^gZHK$Z2mm2=s+!xuSMY} zi>Yw#7qN}lxi}qdIbHy>#`^=WqU%Tgiwiq6&^w)O3TCzs_rF1+{chgz$!jX(%qc{M);htKF>5}>Vv=Cp zKOW+erS!;K{t~iFuzJ~Ksz=79UD7C+HNx~=bBFYtfcTl=w@pB{LGMKBS-yEr zWqlGrA2QaGTIJ@2Ir!sNK!-W!Bq3AMP-}RLUnJXtN&bKf=@l3Mya1IJZmcb^&8-Z4 zacxy?cyrjfhp2ipw*153G~x8G7^pX3DICd{?xv(HyZcxEa^08dzKXDc%kJ*}*DCG` zAHA8N`t;HdVeGZXG{Z4*I)6p4cB8(bv$>i>FOlI?8^-#zSu@9=` z<8M8+OA&ls1oo9;B^6I^(try3Wm(c;Yj(tKNX0m1pYp^3y0;dFC-HqfqynwQs}3ON zSgE1izB&@6ufAKav+}jOhdn7NuyQsY%{tcUh?|O zi-6nn*=z$YHw>3|JaQ@V(!1!Pde+xoinRVUP6qw{BT~9(gOstHxipDwAbNB2;uA)h z7!?yWy2zBoX5CvRL%9BnkLpKxDe?Ux#WXS-hiZdupbx234<(beUT;SYd3?h=kT%4E65qFo|4*SR^CV4gb!q7%xEO@l0t*>$r@@* zY`p#sT+6ZnnIfUiXYpL%DRUl5n1@phaAK~!^HW|nj@Pgr@A#`ef3tRm3Snq>)^UIf zFxyW2WT^V|P6<%a$^%$&SzbmlfXPSa5uRgWjH+79It*y0!t@4Pp`)&@{oN=d*nOiX zJ{xq`0a@Ptf8ULA{v5VA>0!o$WXRqDpkX(Dtk!4&!=3g;9UUCjhu?sy$@Rf{4RXmg zp-{dA+v1#wv;d!Q?(QNn_+sgx7Fn2#1F3^&x9w~#NioeyN3)b&l_OYmA&Ce6=@2*k z4K6JsO)RgfLZ{7No_!2#MFdZM(~JI@2+CkndQ5iWnrhvbj2~3LoBxF5;TF56;*JsY zaM^JS-(L|=>uqb=L`mvuHP>MB)7jRPA|2_WZq8@s`*|jBYG1qB%x>I)f0V?c(gnp~ z@wi2KSJPt�ERv;Vct8TiL=Zn=v7r^(5hhy%PGXsZ#~J#%na-#xV{LW=SX-(u6M4UEKpkW-ACmKe4!m%TreUVA!ulXw7|_b^giKgbDI`T@(2%~fu09+ktcjnt&$MUe-m3aqHz zl_5#+RNYX3H|(tj+QyB{Gc656j23+~?1PaMr&T#PrY}H&v_zoF>vLttil5~a-~7J& z)c9R7@#nuw+8CFjxhkim#vXe>z5vMTRZ6dPKuo9{l^#jGF?35uvG(A7(JLur!t zmdRuy*e^pWdj>e&^{W9XqC*rKq-*9hR@dBJeqp#beYrGYfDa$vJ;?O^r4Bg&waux< zuM&~`bu_^%Qx#g@TGfHVZSjhmg+NBjVGAI}iCtU(01Vp83poUG2orDVGcHHm`n8v% zs;Ux+ZyZj;o{Iskj~J{sUgUnNV75=IzVA_|hVb0`m&AaWXrQZHcH6>iJnKo?-5SNP zm>h5G>VeBmO~+pR3V9h71%$J1q(r^MM#M%ECV+xU0kfQK!FJ#oHxk%#g@#;&o?ySP z{LyglYHjEbf+1_0S=>#~idc68roNA;-RR1s{YZbfxGJ{b;>mITtw+g~`wxToDCM78 zQneQB_k^kP4r3p7gIZ22=gd=49)c_?-)q(xQEF06x2H~U6I=xN?@qS!#xf}Z6KBc- z;*bQj#~z;CZ*r5^^S*gvH}5qqKg1Nq5SvUvHcL>e52(*l1FUaDR)8LTBZc0YFuiykNNc?437 zPn7b$dR&=>@AU@M;x|fpm#cDLEq($Yx9F%lua^{uTevl2&r*ecZT^OIZ1No(LxHe- z*lq?R}$WhxqPfs_`kvv0qVc-fw+dwLH;w5dhLEpDk8dsdoc zH?zF>i1kA~^eHNi@Tnh;oCHi9&UAvTu^aNzi)rm(lszzl1zRSa31!Pj96!avKRs_g?x8Lk z13qG(CE_F}5Al;bJfI$Yv4>8VIPNg9l1JRJA=WF6(2C0=@TERz?MfKnn@dDsZ+%p- zCRl%je8#RD=Br-03U&^e7Rx$J;txob@Zpqel3;Ad|KTj9rh87OfiSQ-7=hvg?ELh9nw6ak}DNtm2;>6HCr>NN4Qc zjieQW_0ZSP1tjYCt8)DR4izNs&$(nvAXwPhMfsg_>p_m?%@zQH2_E4;JvQocwM*1V zdrmT#pBm*K^S&@auag7bfv{+5Y>@{ z+$dPRlN(lS;d^c{Z#VC4Z@laS@Ws&HOhUBL3F4hJ2M~nz%~!vns=KG8m`(ESC$9Iz zod(8*N5hP5FHiowJ{m8(VWBJe<3mS*?s@WIE8iiazta(Hs|@ziiSP1?#S1`T8yDjp zMn1zM*^}{?c}uI=$T1t(%Q(50&F;oN#o7db?+8gqD0+&$)pbB_SavMS|1j-myiNJP|C1^1pr z{$F3vAW|i4f2&`Gy>b=T>W*_a1(hSFeIHGWGgd3!aKC!EvyNmea2{L+b^}JZdh2}S z1K}4}p|sXRy>p&3`2V#_yf?E0lUdSWOS&;=Aztns_=IYN5~oJOiJ$o5jZxT*;gS!M zMOdf@zV(q43OX90ESDHZGhzIUuEkR;PF?>sIhH9Vq3e1?~_)30Jq7oIsKW`(;%+iUEJ9~ z+K9=3`G3aV{m>im&UVzM=tXc4X7O0#Y(D^3fpvJhK_Wcw^y>A|sl3`%L0V@A=&>IHKy+VZtRa%a1zxuQ+`{G6r~>y` z{|`x{vx?*!W}v8f3o)Tc^}w9jl4sgRgd`;CN9aKi#&4QydS%}ao zd-lGj(>U4gIuQt+0sU;D2zQ*K&pIZVm{QMj)J?B)0;2Ux|3DX2uiz4*b`JWqmq3d! z&vpwPx7V!_NvYSKJKiAtD|rr-QcIaI7bNKO`Z1+np*_<0?&=oeHrpH%^W>t;J5M?- zf*QI>EMT%v#Ov{8JH`J`K_Rs@BB&K3Ed4${z|mLhsW^-gXg)+>}pE1ydJWS@T&Rjok~?Kmwb z{}_toTh5!Rn0>GMs6T%oBIt?J=&Q9tnlmbAqt)WC#J{)Ic=XDMfgN%JJwIC~I8P6BwU zm!iI%!Xg*$jL|o$YcLfDdyMI@cAa|E+3HQkE1qYJV|{mGq25r=G+|d!G5^S4ViLc zLZxLRD)x5IK4sx;b7pI{w-)MHY+Eg|^(SCg^moNjgf1u5?AtahG0_ z_Hgax_-B+Cc$_=&m8*8U5DjK}sECSVMYIL?J~e z>cS#xiC-ztQKHb|2!7=tqxMMR7jD7%5i8NNF_t@IjQ%-@&%<7~QwhiK>*6A(Lo?oY zJ{Zb-b=y>6OtG;25X<*`2ZIMSgfs3oF^kBP-Wx*F}JS{bRk~OMnAt(1fySu^wtW z96A5y!Z4~hcmnT@*uqt|V77_)yzl!=dA0$ntrC-Y1Xxo!JzJ)^hwf;H?&ts3RCL6tR_$~n2%vSZlC`B@8@(vq^s-S!^b)5myE z8?dE8(JAA$-J2*|i8zS|zWwva<>rsLjcY8f=UC?bX}YuJ0Ri@snIl{28p&?K&$xzp zS@cZtLjEE})k;ZMIWU@J-N7f0cXulsXR6Uf*t~?pa?CWT(D4fW(at+d)Fk#6N9Gd@ zG3#B3;+8$YccM`pvi{i@L+49cW&yOh0xdGn^9To@5q$(b|BN4LSkk*m2oLWUXSr z_}6MkH~t`O6*sTg2V>f=4qt$gRa?r42$6mqr;`84!)X>+MPWXT#A-1zs+Er0^TAR? z54eM2)SJSq-()Nx)?GODl>)DO=870h>24oa5%xr@m(6v)z=5_05EixfV<_)76HC=G z7-pZe_3?0CtRH!veaZVCLD#0TWuS?i@%@IJJa&j*5Ulo0(@MT$7%=?uy@2|2}Ke~i|}l#>gyV=&(9xwELzp^;iBS27Y`ZdORU4JBZX zLGL4p0C_FvhIza-S51*clT(ouv|Kkf%WIA+c4SlN=V^R9{uu$ZMl`W?SyYWxl_~#~ z(#xp452lwhR#Mq>XU^ z4(L8GU`fR^(+|4Y3c#-XAv7^e-8fkwKZ#N6l2Kh4F|jQl&gI^5Z-o|xr^hPAGRwxq zP>;+!-cjBW9>Mq1S8{oCBn1*a{+*ZENys-5G`_9d75SZhll)ddbtf4t^4jMFKf$qA zX21%?%L@B5m&{F&`{#SVlG#Ilm?F1ucWltk`RT(3l)jCkotiLC#+jkmweP0n1Z9qx zn)VYjX^Ugbf?ii$`C%~TIZ-gfFDM7cl+ubl*#-?g(^wUy9ZK65IXsToT@lzgJt({j z6bCoqzavRGdt1JW{w*GXOq2RQiO$e&l*1>CU<4Qag`P;+fW>1fRt~PPQ|jhtQrm_a z#P)tPG0H+{)kTCdjkr@BsE^2wBj(=eWBW&G61A(o%RTNT+@m?jqn5uobg0u;^@*^X zP7`_ta^>#N6Y+O&y}udFTYLKR9QH^io*q2p7V5@2604Mb70rlh?1SWt^S>g9x07VO z+vE@L$ z_^*rk0#Yi*yU79*qT>2&73+Rhctl|P7%bRsBJ|uDSEIN;i7AfK=onh(mJPrzqaHy@ z#a4HHBp+Rn53~WV3o$9rLyvTDZ%H{pJ-d5!gqFtmNhgo51w$UcWU9N_9g_c0EC;~N z(*lQFg)v{5(5vjiScJ2Al}#PS=IcC84r3%WINuaW+c|LJbs)bBaHwvW3u^~B!p9WN zmpFdr#n+j3r^x3cXq~5r#77TuUoss9HnfzTj@fX;=|OW%sNrjoyz{9jiNE!TwA0$r zNqX^_m4cG)CN9yLz)<3<38xyOObF75!~s8QMcnomE$=#7aHEZSv#~~f;8^#8hEmIk z2?{%+H?9cVhIxK$7oaRC&cR-Bd?%M6i{E7l{@(zJ(|HJ(A3W_1k+Y!sE=r{D?MSZxoZ* z;@oPim&S-mb~Ryhe@`b~B1}NnADboYYI2A3ZTl;J{$k1N-k#=eEe1YkSnsLYBOL8P zvdokLv={d8!94d1cI_~6wTal)Hp1MQNm0&hL{>qhZ3MppBQfWO2-OcaphL_?_!1No zZGc_@OR-T=*B9(jDbmXk#rS>>pXh&f#9H&%)F2k*M_r;Ah^=Ky11gN0$`*jj{Rc21 z#tS_UkLA+HNh+qNkPxZH-W}w93Y_i!+Eto4;-d|3=J2=f{aw<~IahTa0!AY@{1E0D z--|;;P0eh?w$3U++^WMKG0U>kH(@s-84p-^d0@takzIgqy9;SO*l(Yr`JDbk+h)3; z!Cmof$uj0l19aSTgkX=Y9M>L8{=GdGow{YhnHJfU>&3JPV42B#`Z<#ERl4y3_TloQ zEO0cBz-a7NF+KmZXw*Yg{9%a3Uy7bNeU*)th#g)m6o0_*HegIa-5sdxV;<4pFc-s%#(PLZaJC*3PGOJ232gG)jBQTYsYFDP;5RRrijT9)W6O37Zv4k{sHWz z(wuNyYma$lbAe?FL8ykhy`_bJBPZHJN-MK&?o8Z>pkY9kPXZSk+e! zS1Y&9QDPf$8}aVZqkQl}Kb_d&{$|ga-}~d%xZ!HGUj)2CTULswf@OGE?fIU=0&RfnH>DDub!&cI97Ax9Hre9Xr&w`|x=n5GGKx67 z=o_rISqMUf@VTC;T!I`Kip4D&b`LzAPT$v@h+pnz;_YMsV6jxHn0V|XS`29C3`hVB z)`WKlIVm;;Ofvob~wT?G8z(62eBOiB7|mGI;5Q=u3eT3PcqS192py^HD@v{*vc zwPb!b<4GmufM}RS!-4f98(>I%@3^IAawoxiZi+;H=`>Pw*7NHEW2nMY zXct3OtE(g7{y7~iP@48hfc;P7z_7J+#_)JJ>p=v- zNt#0mGj!IfE3#f>FC)aNZ>(*)?z_il)L1%uuP!EvcB%5ziyX4Py<>M*kFP^7a39E>L>DH$fW3Kddalqdlu#V-xfn_J1ck3@6 zE$JHbl{NuZPo)Mww&Z%V4#_R&^fzFNB}aK&#|-5Xu2x2E3}xwrK>xI813!BI{!V{@ zJD%tp0G8Z`h+xI557aE4#5@^>{=H`L9=i^}Z_a_*Ny?Rz$F zIkO}L1B@gUk8OeoKStfr(Dud zujD2pd!ghFzEH!6t+?Ti0dK!~>!T5>ipdLeq-b=}nP99{EHX*nn%pF{Cmh8Jm$$Ti zAtr^7lywmsBla?I9mVQ>96fkYt9&OZXf8s0{>1J{z}E(BkYOvRnJeic3`5$4B$zg_ z3sbg0<+I~Ik3P4z0OUzeH2|7AW-G+$B4kr z5WJs*w$$f|9@EVd4za&5MV#k)#(jV`;evW55l3Gb_`g>zArQ6Kg!_g5eN`72JK*8m z=*MQ`Hkn1@!H^K5h>et10#GPUqHg%vUj^F-V1ymu%DA`@81MJB@a{#vi5%~25{L6$4R7*=aT4;f!%=3Vf-f@ zL2h&tCkqd z5`E93{U{?M-9rgAV=GPim%KOy%_FSsb;DrrrXkwG^Z$DsqnG*r2x0&I>A%zX?`8P! zgZM8V{1*xTi-iA0!v7-Sf06LNNcjIe5=tHLm|2N`l3%=3zQ%xG^M714?@}N?XK!tEnU@mBJvD2C;2^pL33W_Pg%i?~nU+|9AJ#c{Rs5pNH$ZKG$`< z-`92Q5iH>m$5Y2+Fc{(@{sMmt1}DZ~uw4XwaK}Z{-iyJoEfy{CUcPPZ`sFj)hJFd2 zlp$4%2>-rhlY~^+3k``vl>Fn)`K*uJy~7YJ7w$tb1I7u4q}R-XFL8S zH1KmJA;T5JJ23q9Jm7ZIe_7JeMYh7VY|a9&kJS-#SB{ za!*rh30C*E#5V2Nc z?gX5Y2Xegac78tI^+wnTS)Zn0z+ljHx{RG|2Fa>5Go8VMv+&&GVqU;o*sEafGxGMX zZ+`ANj=7XGeQsRM0t#h`;8kFt>j?X_Ue3~RCaL$H-LDUoFYgaVvdoM)r<+_Nl5Tc} z2!ASZ&Ao`Y;Mf$zyN74Ak}7%ExO+{B#jo`vua=m0uLyNv<~#A11chsyZmavMTrtGW zf*zAe^Br>^600@S5LblRLC9EwRTO8C&2aBU0HrR>Frw1yQvj4v156-hGY($^OScGgYAwu_JAAdhLRoe zM@Fbih~D4Na9b(;j!9alN6IQ~ph*IgV{U zH!3b0J<5}7=i^@y8>A`S4TR-I%b*SJES#YWCKDcEo6PnknO}k>yfK+0V+RGOE5};~ zF?Tmk+>t)xS4%6u)wL{JVNO9(?mFkdkHA}|1E&tcu0ExO5gQ{;fQ%ml5y@!woJ(ZB zuUpViAn8ttWNfkTttlaQ+;ltgL_}#r++HUAz7a#cVi(+2WNEuPGBe~1g zR7ra!6El}_%gJE`qoO)`{oCZ*m+~?>B%AXCyp7btiVx8C^(?%8Bocv|o|H|HRJUrW z5i<7obA4BxFz$giO9OjMejpfe6Jj!t-Ne+SjGqw|aHT%6|AxX9$NRP>lY#_@c(0Q_ zLPs|hm#4?$hS5&QyaHLcMQc8#%}OObAX&Q|lu#uQu!ZrPtkERllF82`$_ywfx#Q>w zrdALc@y$s7!y(!&ro{2L;7Ecg_3z|o)43fYW~|EJ+zyrX3(kDJ^ih4Awu;R^M~jY< zPhs~;G4?z>56s&1m`^~&H<#YXaLl6lLjg5VP7DigYl01FF_`wir%%M--_eS?MB^<$ z4g-h%(X4}=N}@P4T`9|>EFQVg_+n`}YhD|{+}=_eNhr(Uz65E?T@vLe*CIPRfYJT% zfyYYY#}>CY0YlnH!nokJ>~%BUz!FUoNK)dBBJuKLX70IL(*n>`mqxEr6gsTeSr z@Pl%GRHFAgVfnt+I<2Ut=qIqI@aPb##DvQ`&MR*qm>`>^Xa=w$_ z=WJlbR&FTCpI>Fz)`zWyQaca_G!4&90HaQa|8f2OM z3bBdattIrRc)@XnM3QAuZI$fZq=r0p^S-^4Z;2QgYaVcG?s#cWvt9ktPrLx2m@Wb~ zNamFtw{pEnbAR${>LKnCCZGRFqz1<+)=;9c>(Z#eTgle=63=ssHufmiG6S<(XII%M zFYnpvE|1$y-Q7yvq53^!qpHk;D5;)=Or&!!^by8?Okh%f3C+7&#fWchrL3}LSt;8Ux!>ykQbMCgLDjJNGgz^CEMcl6H^X6WClV^5$Bt~ zWV%XfG(rBuM2M*P;*$U!aI>7M9O4n=?7R(k?BlUzEej0{PU`e$hv; zzAur)l!Iv|;lrImE9X;Uq#!NcB@_U`)t0Cxbbb$ z+-tNO?{0i>$u+W?mrDVDv;?)c+u$vrOQ0y%LMaz#ero_vlQF-s4mRKfG!pRlJ=#d- z_I%z~`JbHQyMMHPnBUMaeG8RxPfIT$^P@N<)jLuOFF{Z7 z1C!%~NbK3x`V>qN5z>^P8S6s^+m}gd?q`NQpSq4oYUxi-ebO|%UsLEp#c>?)T!qBU zPxU3m2X2H!boDy%VO;2wgKLv2x2vk6Ls=hWQZ*YW0wls!G@`_N5-vG7YjgY>TDW0I zW!gPKKfTCfo8dM0kLjJF{5il98R%NJ@l(}Wmg6Rk%cPb%+38O-`<*3ZoND7R**OWe zAqx}OdEhMlE`k;K0<{rB&1D@xlf?}73m}ymGoqv$7&rh2;UKE(FCrKfYy29t=Jv-& zqz|;6u}AeSPmUBM^eEb%j+0NR0;5n+Xk?rg1Y)Y*MEZuTCF44u4MGtgF*$B?-+BaU z1*W*<@ZK1BetVP02wExb1am%Nuw`5;7wT@u*~@L+pT_FiuVfxwV{mT34V>)2?~Q&# zAAJTM#e?N7^NXV{(Gp$aXcDWRw23#u@y74!I%9vFNW=BOxWG9H{ zH5Jv*9YPM&$L8o;dK#H0WGGI9EWug&9qND|!)FF7m6(UqEFRPR#Fak6GWm#X$tQX7 z{caM9$+p!?)!I#t(4GWGsainyq|JOqzZG!h%HtSW*k$nk8`Ng60?~`XpXnCIZp7HS z;=DInMi0xTq=DOUs7Bh-;t67^fKx$sX&a(F%!zSyDIuilgb`)N2mR;}B!&(?6`-D) zYB`1B*h~#bzJKXAUc!n1`=#}hqeCiP(`zU8p0Dn`tg*NPO>Pts8bBTg4qj<=Yl>PR z!W%y(e-~(-mD$*89!0bl1Wj`rW)ts990<~oo|yPau_~O!ALweY)Xu=`Z`O;9|05xE zgKL!RM747pSME`KGLchGFt_+XJC)Amh)2+ex70f0^;fTtEO8mpIyt-fAI~+2W08L8 z&~qA3h!`Tit?Pt6-1NE2QC)9MizXOJx%ULe-dL=ez+c;faVbm>_torRDJg$x?}Opr z(oXFJ1|j4KbyixAP8XFyJT9|TiAspS)zQx~cMUmHPjU6^ zoDNe*YMwmpZXKe5<8q3h7J|O>fIJbWqY%yI(5^iFpJyE8mPpt4C<4tyWtLO*A_)HL zS+S}T)UgJkyv8(M5TW5jrt6X8JH3f+i>WbL&*`^|YngcIVDoEO2o4s&g~1F+7%!BN zarzE(R@)6TqIrj}b71`_#nFZGDkscgmu+Q-Z=l6%n`$BA-L)_I)UBGmGj^H3BC=c3BA`_w7GAm>3A_{gJ~IUk z?m%gr%s|=P2>l1bC@Z<^bM8JV%rt<|^Z(!mKolP1Eyj3@F`5i#)<%AMSxMp@$2%*|F`C(cBb|qX8E206V@xUrSx;F!|%hSCqMxWwR?XcdLJn8v!4EX_D{QvBun=%(;caLzrS~;sncWY z+P&t3nv(zzBg;v4MxvkLW)?n=!Tz<5K2!YcF2TBDfcHXbRf0`F)6M%;YE??~3Qee= z5==j+!nzv$wX1@B@JBY0t*p^-yF}#K$XFB<5IFES7zzw}t8qCkGWKF>lB1jdW>$Y! zc-Y>isdJdgS*#JEaot@)%Ju2TmU*uPQ~=gJ@OL!Yw4k8#HkppoMGR}I$b4BHy@D!f z77cYT&Q77GG>e9-`_?i%59hOj@G+LvuAUj~7<{-Tpo8s22sy34nvn4dVC)0Txp-~I zklr{~`@X`k9z`SG`zD}0qbrLKcoV%M0NuTH;XJ=E?b;9eG0JSaJy1R5Hp1PPJu2=D z6b>C`y5jW#r#_)iqWU?T@Xc@Di(b^xU4LsT=uV3=0jz}WEx-|LpYv#`&^SOtfqe); z%D-O7ZR$-ol2kWf^e#xKkvM}UE&Y<|MA0OmEVGLC!OAZ<7>wjhn zual<&%&v6HWyIf z(l#yCj>hp{+!-wMa+!9)IC zFl->8UZ{X&gLxiXJe%m{BlC)S=)IA&o4RXpXogTi-L2hf()(wpB*=iTjTHqg8t*!N zUe%OXRVzSWKt5X3^s0j`aGXt>$2qtiXzJ(4g9J?F5pcT9ESK&#v)yuCbO;baqtYBg zU#S7VaWI=QwPb)xJR^6-nNe(4B@w9OvT$;>T#l1Z@kGR=XNJNtP%}uLhc9t?beiPa~6I<{HGtQ@8c=-ic~sRD3F|gghRK?BV4QvFA8euD$kX_mp%k!DKH3j(Xi z1@sZ14RJteWK&#o)UZsaxuWq!JtQzqPgF$P0K2!HaO>F=YP^Ga#zyLR!<=l5m(pum z@e%XehY@1|@V^NWl}#B~3~XQeQ!BVH*#TFWo*Lz5BjQ=v6^#*KACaeZpDP};7I0ec z=v{prwwNY~P*?o;UVPE_^|G?2NtXtGjQNWhkYK*S#}_hbCeaMtHfMxo!P; z!c4Aia@2Fd@&6c@)tvp&!qYTNr9>#*yoG4B@K?b3aDwf-1edR5Ka`!#cl_I<>Q#&? z7Igr(P;dPU(*|L>Y~4oKhT84wlbRzblMpokCeSYs6)a4z0t2%J-nq4bdQ#>Uay%(` zna>@IYQ2gl%Ka}oxwBt?#z01Z^oN^L6if%aen4_$iDH--`e;tmQ{IXfd%}k$+!2w} zTMw8p6(B)bfYxNgBNl)#AlkO#(XEOWJ%c56hc?Gy`EHz)1$@-cttL zRywy!_{+N@)d272GIo^AODDB*naC3LnslC`t8(91*dIa;6i^#5jznY7%|jz%g@lF| zN7#XGBPE+`tXz1XY(42pL9)q;M=p#GIX7gh9s6^ zPSGSf>IbNh%->hqd3@_?$}8Q+iAVpekJbg3i`%7Er|UX}?hlaI9*TGexUmK9U}>#X+Q((A)qs*1f*I9chpCb>o`iwpFNc{v6ko^=sIk>sI@U|CwK7LsB~YThp2zl48OQ< z&zJ1(@w?|#@ebfb`-A~?RT$byI($o7kXrqBl zRUo@SCJc4s)XN|;|BTeKlsv!9 z(cIn|gtsA({yTJOmZM#e0LktHSdWvH{ar+lNhp0zqJBW*#d}Y$i!;t%IJIf+1JOn_ z>9;}gP!@_DXW~V7hdA#@bC{AW){}Y*L)PZu`mQ(DW=w}yZ$He&+>2N*V=B#yG7Tbh z-LpBRqKU~iQxYV)<{w9O#}yp=lF9qmt++ zdetfz?T6(n^b3}Lsu^k)sbw%KIRi>zUPvZf`s3$xzr-AOHN)C}eXq&S<-w37>!e8` zH@1sLEDWoS2J6lJiN_KDj_&ygy5|(Na7~)Q;PA&431*=ZkF~+s&FndiFYaJ!tuC2A zwTPuIE227U{ViO$pBg+yTL_wU=8dy8~K z+$Pj>!Ds3{aq2%ZPbbE?43&+uTp5(;!0G)EDy2&exB(OkA5gtF_na2SDg}ZZK+Px+ z&9jyhtP~4ss7Y7xn7Cxp_Ck|i9zIrct?K2~mTDE{?*O|tenN~w4x|_cB>&H*W3d~a zA3j`dgmb}dl6~whH@ZM}ryNf*m{uy-LEXl>faI7;0E|EuWQVW@;wKEp)|OA1O+(4! zOhr}MM=-RLObM8UcH19OYw~9~$0KsSnu@s~a~H5B#anI=9b2pK=m`Cu&YO7wh*5#; ztjh=iosZB{xQvm9X@BNHeXJx=cXcJ7E(#|{s5BUveL*T_deaqXQEDu~ecqxP0scY1q}_Hw*!rf~)D~p5 zDv+IlX68u{m`#bJfVG(De!XqS!n8$X^m3O#+Q; z2HCLL>*=ggfTx)u+zBOM)PMGw=h=b+ zbAB%iM}Pkzvriw8Ywm0AaDAEmhVt6HJ>mFA9zTS!Xb9IPKpRa;K{5@bvytJbgv6D7 zHs{Hp%3n=Qa=k{|V_e?NdXx4leCN+D$4Hfi_-4Y@yQISS<~x_S)QL_b=*)_Q%UHaS z_DLZH4GPG(fJFHCt?C)I>#FO#b=TiH)rVa8HoKvuGjnZ{(WkD6q3=tj%HH=o)Y2?d zvwOwl*=>B;Me+Bd_#)c$71v|{B-{je-U?)&E2?G1`$yedi8uEQ*Qykf_xcVLCZv0W#0fKQ;A9#g|S#7Hjvd^@3Ohj zx5MAGTLIgQ2LuzatVrM~M&mz;fDMf4%d5*}2Qhc$al1U7U(Mng z@7Jtf$1Sf1q{9^yW8XzQ0Jso*#QQVZK24YMxK>6zgU6Cj0g4OLR+$4K6yi-GqM4fb)4MClkeFL(Fo5hbOvuRgh^_lVjH z(hsJ_%{R26NTGdw3<}?h9E4z)_9Tox&BBWrn233&`(;IeD`!4#pKn{c1%99%jQoZ~ zS)=EkyLa^2>=cX(Eh%{pUq7-op2Y-+RWM$naRDECY(Z2FUoeq`JcWuFUmFQ`GUbD2 z%D1Td${igAXbQZg-zxHfo53dHpa3;g3iS8o-_gIuYLa6$Nzi#X_Fi;Q`7<%u?vgE5=2E#h-I-jIu?uF!gGdi0?BK)SuEw9s0rcmSs%}g zAJWwMb)tKL!GiN%|0oe^#KxaVp-7;A?PKj59713r-N%bLge;)z2cP&U9ag z`daY%E-7pHcZDJ^wlw+%W2<9JKSXHEY^CXT_jRbRo&U75%@D(UUO^$NaNDETyaxYF zlm#@gq|uMNuS0$9)ctEQr+PFOQ?u0d&$!{wdrxA-FB=4uc-JAr$t&tp{#B>_(AZ54-gg z)1G2V*VzB5nCfOJvKbBJtMc92(TsChD$SI?*WpT`8z=evL86t**T?0!78$B>UW_}3 zh_euVa7X=*%(LLP(iLTe2G$cqJ0^#Ea$XAR;}2}WJ-9WPmJWkc9k()nb(bimpg_pu zBsWCNX>g@gyAa`X-XVuWW%8BW`LdwX0;JmsZWMmp+no2iB7B;EcwK-zCpo*;U zq>LzyrX^Ke<6am2_Jtp=d|K2Y`Ev4~x?ZLiFeQ+i6mk2~ko z5R^WM`-`c@LP|juCFQe*iE{!@kL?9_5XqFSx`n9tf28u~;-t0u&hxd6LaCNp=)uVi zggxnrl=%uS{w5v1%Gq`Ktiy5N6=(C4A7y+c_SSY9lb213&}|@ch!LY`lYc|fc~))+ z*Lg>KzI2d0aYBZ9gfcr`D}{5Vvl7N_+E>@YR1;Z_iQhKLfh`ccJJj zj(7CQ+#y`&CAVBXrm9YUb$Q^T%#QTVPqN#lWl!CmDA67=dUVpt8m0KQ72yLos$K5~ z7EAPp1}-(vRgM(rt7D?0~2(Ls7d}%F~xMm55UxdTU#Z$(?qU&5ofjsISuH zTVi~oBy;3?!gzv=NVH+Wkb@rZ9I!0o8Y1Kw=EPuAL%1w#m(jO_UrWwz#p)lzkK<_! zRi=iiG)m)U!Q00Rf;{pURt30A784WODILyQs-oMEn-I9wvVf@&9>I~d8_(|x&EDIAw~i2VRFI(1 zk;GBA_;Q`k4QjDkZ`4FyKO~-^I;IZ_c@dm2w#dMGfRg-()te)q_25QE`(0c<&%DO+ z2FEN-lxklZw;cs%Ymu)mLon+B{D+MG+Uz`w69eIj*1j{Kczx5O)mOIB%(cj}cuNdIB$)GFOLg!&X32NNL2iFp}s z7gq(m@ouFAljIO9NZ8DOaj_!3XS5bBIuFK|1=#0jd@tG3X-y zK|-#izY;a|nbR@dLUM913oVyKfin+!32JDZumR13TSz~pn4{>&&JM~}t6yR3f3^2k ztP#kdw`qg?z##d2MHSPV*4cIiols(bpymB!`B;046_$qJca{#*8F53Bym(!%FSkyzv}Q`g28otm=zj^~aD_IvmQ6Ej>B%ek01)DgM<}-~@a5hW9+9EP z#Cnl@EkBfhVWLDWpGzk&RJBY&3;q}&1^AoDckDiTQW9R{`jj*@;@h?+^XhiEMeaOI7@F ze=^8>^tgc+qp54Qq${{qAG$%WoCE%+cxErQ{+(eFI+L-c>awp_bRg}q5)_6voIE)4 zL~)kilm$gWvFg5`GZgg_{k|10o&Z2j3^c{(!%$+1QxP?kC{0HmyrzQ=-diR)Bl!rE zd_(j)XNxocA=*wIJdOiTDiud>s}AL2KLMBD0$1KZKObVd>RXkuLD}a8PSrTEz??xB zJ($*1N$9OMj23fp#{!&UiKya6Sy-(k9NSYOiQWTdDG)it_MXV&Z+F{IlH(_=6KlV_ zFm8$9l=GXFbHrc$;k9ceu-+eND+_XgoFr39-XGDV6W5lSslmfhQUMepw^2k+%nD0P zI=3)rhFY@EX>FO|G0jW(TM9A9X#i&^LGfVjFm9N!0%|e#>4^g1zdO;f5v&HD-*cCP zFZ-LEN6xEuzoI3K-;-t-X*k(Jkr89C#7LtgUcXm=Rg6jYcbrKsFW_ES(jZLo;TL%v zr9)!BxDGBB_bFd^E8SeBFpW4PU{5FJ`2LDr`pvlQ8!A9-q+;rS0PRv%$CG+Jmk;lw z7ax$FyHs>X83MWk%Hm;Kf3&#JEMgvERcQi(_u{PwDc+k5ex=uhSp1A)u}|j4DK#`| zQhEJ?p7B3V8ryWpYgh)j@3Bz%q%7iZSoZJ{iV5Pb;Oy};^w?Lzc)%J3=A zH@L1MaELObNqsd*KhA}h%H3N0y`B8g$Wdxac-iRdF66I8LSk;OM91LOBJR96S%w zbSh7HwPefP8rcDHR>Njz@8M%sGrhdpW8-^oL?2Y)Ab@o%%nxz6j?y_fEqj&(T$Cm z*3@^Z4wl6JPLNP#z-ynPvEv5X71RfNH4uj&xMUhZ=!sQeDh`PW)4#!8RO>HL<_}1s z$HJ}@C^qvLnXlm1xUdsI@Jcq=?*`-D86UtcgWwi7r6~X^ETb!JPKHwAN7aWk1qt<` z4v9OLE~7n4o7YJhZB7j=ciIiNk1k1wLT+4Y!B z$2nRBYBstX^%qPZty6Ur_n3)2Ddi@I0gdESZOs&0!;9J99xP5gDz=affplivROvj31x^RB zwVRFp2~D*ADghokh{z|=wrv()um5;YaJ)PbRF-Kecp3-Zql8r<-FI1qqWf{jb7hY! znt4)fe4)oAupc@N%KmR@U$}wOjpOf63_TzQ!ah!NQlNGYptGwO0d$~B=Y2F&-85}Q z@uuL&RoBU(G)BU*c?A!lXF!!y4t?CE-%0=biA2^3Y4oU&o52Yz;9f@Op*HXkv>7k9 zzE@ln^bqU25!U|>P9LC~3_+<9&#ODy9-KX^8FxkrT7Y)Dk>0J`pKDz_<~05-)0kEv z66ioQz6GM!d;?!@JN#ff8z`b1f`Zv7V|}^Y%eo+kAc_c2Ee*^71m{rXsg*)e&D!JS z`=`mtXxo=jW%YMtF@xhj9gOg)zD+NQzHN($4#GzzH|TrYH-Kbh|GzoP{~*J0%z#Td zPII|}-Al66dp?mwKcpXAisG5eq&+6nebd_e*MXClnPp1TFR%ehVFD<6GYT_+$Bqz; z&-||o`(-O@wS=IKOamr$Liy)Tv!E^iv@gkXM?0?thV&n8dH@d4fT(-34R?`J+zGyQ zlXA@X*yZQ_8n0C~WqH-QgGJYDwTbZ@FP{}Cj&W+{NuWJWt^(m?YwVhBi3k1JMez2B zU=u)GgCkkJ6~%>yvF+oZ95}Rr_eV>k^8nV2oTBZLNjL`CCC{+@p+#7$W0@2Ls1df% zgjEYgD?bb~%*ZR;+*fH50R4WCu9$1P0^AS}DQvig&j8q!xuL{>DGB|%oKj_4Vj6V} z^Dz>Gzcb>mRVXSj2FErlnpj@7%fY@^C`?C~Fx`}eMLDIK+XGE6sSp_~){iX2;2b+? z>h8-}v!~u1bA6V%eYB|!Jkx?8`GNtWD34V!V&eU2*&Vn}c9lKv22P|ajzX%n@aQT( z2}S8KkiUnopUW!G1x}UH3hXkBkIZ|aI#;1QZ$JSrSFtih9k}}z@V08UVj>L|At-@p zUm_*RZkGMXsrwL#@$YZ?e{NFo+?n z1-GB;%AqZ$I>Kc&2G#-bvO^rrq4zvaT2yln!%e@Y{)K>2uc|LeUOmWm(HZ z($I`2J08F&4!#NMm^`IA#V^CWPni(F@K~Eo4*9st0;Y@K%f09WV;!e zu#TF`8Hql$6a*L>Z2j9am_KD)oiO6^%TY~hB()5a!#!3+1_S71R|2iID@{tq`Yhz3 zS*{>2PFEL)vqPr73~bU#YFixKVJjlT>3iDX2KhXN-flh820OfAp0=CF*~{|6Um1h0 zVWS*J)U4eoN=Aw_*vrA35^1y_^Zf4+A8hIE$2I(B^%)w|`|Q_*;2>GxI7ikY(A`7w zw*sCPU+7=VP>^k!QwtA7gBnvgL)r>14@J*d2QBN_jz<}j6A0rul4JLtZGP|=20luz z^-7DEw$$isuDLnL;Wp0?3W`#+n? zP%k;8!Yt|Owj8x;(ZT87!6GLxQ)Q{fW}4)pw>u|6QJWpR@<7Sh0u9Gy%jx? zYBP-fR~@dNgj~Ihc2NaPx{MddJp0{mBi>m+w^#*1W^Da0cIIMjMG#lf3sI%+)IGY? z(GO?p-K1wiQPdcH<%3J4b0cnm!IW+7Qp5rEF!h5X{sBa4ZHTFqiBy{{zoBV1f;#I+ zSEL{v2%F_mQ*BCy)>6YBr?UJ-KS*H6J!~p-a|XJ3MZc-=S_wvtM)6aO@`KgSBfGz* z?N-1e-nWo>NIS!L!Zv)HPfdiOWu+#xFp*~1v&x$WpMoyqVf#Tsz(i&`6AUWPAzCAQ zkL4Qb(d@&}WnmYz@OG%^Tj4C^N>{Wl*N(ri?nj(hNLO}xulDkeqp8QegQVdCzKxM?pu-l>3|@a3CMZ>nJn0Z( zeQsc^TJm?I*N@C@3ej#(g!^!E%iJRO7;fNBDGHTCoYl!u#-&B(v39btN2gk>D}A1< zKaI;5nd_Kz*V_iM(s{D5J(%Y)$(MwHAkQ;O6MVS`t#bf`n;GZzYlyrR`L2O5Hj~R? zOhRMAIfy$IlT*B%%@c|%$7Gp2Pkxp=cTqc@iz|G(7=#8{_q3PcSV6gG&*YK%#Bv2E ze3@76LMFzqiQTYYVf7B9KWd4J{PU7&9^14v(D&lUh*;+2E*E%#Z)#l^>>kmJj5f zFFvvF#jg#=Hp+u~Mb3$=Zu{+5-85qK3_FQxxS*z>p-dV#RK@yhuItyI-lu z+rex1* z5E&w{0tU{b>8UKeiV#f-GDrHsFi<|9h&x^qHPfsgouFZiXtRwRyuX!&opWxAne&p| zu{MZ0HXh0t(UqsF_m zb@od<;T*~h4n?bFT#Ye!)LV1c9UHaj(u*o_#yZJ`NSBQy$dtoOL9Mpc>QASxV9lFZ z7&9}&Py5*SpiJ4+CK)DVtV^eEXxA_@sSlZams|<5t`-y4eOj-+W-In literal 14572 zcmeHOYgAKb)=okU0SP8b5fUzm;H_1Q67GUPFhQp{h>kNd?HCm4k&8sd>mVi|0h9!= zw$;>D@E~eiEsoJDRt@3>FLXFctD@DQRO6)A3Mc2h zm%X3;>}T)yP?9)J!E+WmGZ+lsl=!$L27{$$Fqmd82d)GW*V-A3(0x z8D0sG`_4mNcIbOq$Z7~<%M}d8#b5h6sFv@M#n6v<)^{GbT+`cW)Lm^}EZk3x-~D?p zqrsnl;g$w76d!c;od+&od<{OdCY7s(5SR#Sq}^V&Z+>Iga*-OJlGk@0xV)gZdX zi%b@-8GG*22L=Ln3UB^>@kYW;`dYYcL2z5$7Y6-sLn!QrTR+_T*^MN1s(y>x30&dE$Gooc=R{)=;!uF z>2IK{>YP%0s=j7__QB%IwU2bBG%Z0KBTj?~Sw<&n^t1NSE7Q5EirN`NYux`TQyCwH z7y=YB^)i$o-?QtnnNG}c&U!2+o2w6gAs_N1#%&I!6wc_(ZiS=1$v1Di@GMunL_SFC zl~4}r{TEvAKT?LUSgEt3edU8@dN&P#AEt9v)1Rr*noBO@IuOj{($L18MHeLE=)!f5 zS4xRfW=!kBV_t|=ua}1`DGg>RX50jIW+SZ1wQ2_MtNi@Ukx9b*+~(RYX}EK^;anq^ zIZim|TyQJbE8!!U=`fPE@5zR-*_Pawcj7a+`m_RqFAicKl>glBogjr>R?8@rt9D$< z<+`Yb2W}DN=fD@U6<3WNl6&J}}k6_EQS)K{A3xe5f4#6!jS+LXCG*7#u zwDZ5Aez>WImVv6!PZoU#fq#{%jd##wG`W!v|3sa%PYv zR#{tiKyxi5d|0Sq5$Eq*Wk$7b&s9;v*OVJjeAX1k3}MN3rv%LuX>wQ8?0Y8PQCBp% zMEzA&2yA$)m4awAa-U*UV4tdO6s8Nt~y*!BBxv>_>}={ZIWO4Cc#l+x~b~Z z;l-Y9B3S6yr%2XQO4TG&hL&#A>Dl_U>iWT~8}dQF_#~84ONv`dRT`U1wTus8@gb}! zo>$1{uV0yKtO!khfaav!r3SGq3KMxdc{L^4Q6-a57`mHdf;_x8?pWo>_v5m2+*B5K z*GfTDCZ2ongkpU?1@VfZEZi}stmZkadNEfmJm4$8l%lKoB8JaunE(05i=;u+Y>AQ7 zh$ZRKvC154Szi6LGx66gKZ#{K)TRUbKAy#kEa+|V=yx|L7m08-XVs3k$3F1Q>eAi*1h&7L3V|6{pl)m6SDq~X0j6tyXOtBa zCq2onCx@z-C}dets81EypegZT9TY09KHk+WN6C9;dGVOf3r&_VHNGoL%Er7{)+i6d zM}AB3J1p0S4<>lH=4lUUHa3mMdB=#kE2L}-kQ7uKGZmNk9`6kaF_-})scRWWPmNmM z@Pr7yfytpzWx`%Yn+g9=u-7QIW$!f7Uf4%;d{o)Sfc4o?Kz-{`Flnc7o0p_6BzJ$6 zu2!32T%bkgnhb6(MpABjujd^^s3a#R7PC2X8NSwJd3c9N4Ysdg z6Ow^G00dV_^toL>YrIM*-$c=~ND)CSrc*#S=_z}Z+k96|eE=&Y+&R=xh$2X)w19~d z#Q3g{9!eMnS8vjA9deoasYIRUef4YNy-xhhLUJ$$tOl%G4Yiz1%H~{b6g7_BDi;kc z7&g4^aKX^o3ytGLldXX9Mq~+Bx+{<}nDwszwY>wA{_vGtTz6RhHp{1JF)X_S5&}mh zeM7G`@m)0a2Olm3PnbsdCkfXCe7pfKa+{NX{&bq7MY_VnXRMl9E(gdBVt#Zs1qb}= zt)(NzCl@h>^TLvYSS3Nrt?89S7eoRoI`hG3)8q0|2i>kXKunK*{{Gx_sd?uQT>tOB zA>?N4mk_|9joaWWZAjaUn z5n=cS^JKMbsoVaGww&0A3g3gsd&3;Tj-vPzjxQ61vnd+;3+)6|5eh54mZ5{27eyG1 z^iN>x43tuCtKlwLiOS98q+mbrA#r@Z&C8r@6mfTe|HUxJe*DZjA4zo6CllpgX+;V9 zU~m6GYq;q+8E)OAQZyv`Od;2>a)8Sr-WlS4oBS;tLf1CXHH@1GZ4J>rd`h|+4#@2c4<3yZ2bwdB)|=*i+71&Pi&S%Pc6`Yb~rDE7xOOfII%I1bYt{OzS5It1tR@Y!bnea zl1}us2F4k&PTpxjVENXlpm_b?o=v^wQgp3WcI^63SFz4A_f852%~S>&Q5fURDmWqt z4Zjy+&~Tt@6x=Dl2u6l{vIjWEA=D7eSqgPsSxK5cP-&F zf(~$I$W%G)+0t87#JkMo=6Zj6);A${CYO2YCGNC9D&f`hJsS6GjG0}!je-f*{pyJ_ z|m}p`Dk-ThFijldSwR-m!`UQThwhO_NL;BfM7C&XJqPoVRerFXk>c5+TXsFZ!WA z)|FZ=)2bD22Qvze5v34L1%d1rrRw68k#pB|-LX90O^lhELILiB=2{n^y=&NUA7@F& zeB)qWQa=Ld9o!IEKwK60vzvFs72V$$u&1FiMko1ACxZWTGL$VmBrP&p9Xv!<9kGM(xm&T z%MS&-CDUkXJ@Qs9_Xv z`~egbDfTH+3mLmb3rH!tmXxCQJZ+QL;xM-5yHHUUTR-Ak2;&6GJu|-V+bZl+MKL!3 zPG&BY)&qK)fes5Q6*C@D&(-pn&0!k9XJeuP4po6qIT^8xXY+Q}tv0TJbXkvR)(Fd? zmf0|dtY;WNsXx%kmX0UMNquG{2>a;SFy;HF&pZ8qV8CWCG*KA}Dek4O$51JyB#z^nTXh zzR1FhNtQpv{FWFyV5%ylLs}wieuFSr#%=x_NbdM+z~>jv)?T#Sh@R}fUz9=0#MlMB z!8=!`{$4j})mIK)jm6co@GPj&lEsh@SH~)?9-D}b2;##)Ew-0ECtNeWsaO@^)Hs|} zZTT3eHk&T8r{L)C_~Px7(AEx7LN08ZP7ss@{Kl~@Vb2{u;nZAe5*Lh~pb#y`3(tY& zt|LAUr!1>o%B}pWLGntylFrB(k!{m`Yj?hwHOEu@tr+Pi1B8Y!6?7D)vVlB5PAIH4@9Ic%;f8=*ruyedG>9OCJtc*OUTXk2@D#S-P+WKB&~{@IIq3570<3VgoHm2F$@6Wc!99D zw5QcMZo7qZPHY;O6iBMCJoqUeiXSHV;nZbss zln2U@JA7z&fGx3xY}@Ih5;zx%lDl(lJEU)dKYI~5P1&%lTE4PtQe9q}l<0e;RP0PO zG1z?%sCpZ-$5b|<+2e}s7?V5*8y^6NbeD@5YZ{iwGe7GJt$VRF@kC^xzSDET>?dz0 zuS)ge4OI<}p0nfIaN#(!>RDuRp6>hW(0C*3XD8k#eDlb?b3L*=CIocEHavKO&7Y7w znBEMzT8j8#)D!Pe`WoS}1;S8lA*2&`%9OQ1FUlP<0uJ-$R6oACAn}RoKTbWx zo>GkpYOro$QVEHu*>ux4D?oRd=-N%YU7(3Xz4Lfvtex2yi)vLyLavN<+TOHXqhZK$na1Y6rMs?`z? zT|9fg(Zd=2yaSq3a?v!SjJsyt$=z6 zFFavmH5X8=JU|=%MqJsE^R}?KZOQA#{}qT1z823y8A7orawtfzZKna+rDM`oBi-S`WCJ~l$J+iyUT2pjsBlX~?^n-Qi!6P|5O+}rKMB5GS=vR;N>2$}bQo@*+;CLho2e%zMNmf1st{$^)T7pOQ({T7n` zolVD(b{Zo3`_M}WWy>!`>PPIQ4Fc#!2mMk|{jxD^&Xf47)HEk1}LpLa1DxK2F7LJN`Q@u?U)76Z90p0l_8v4wDEBy<} zh8A+uOqv6sJf=Lcgf_7KWf$7iAVXBb0bbs}HM}#8il*~)L>xsCaW+Q4YN!%~u4*`g zrP0;|v%iT9@&(CNiyhXvFZ4z25qv-sJpyzhNIGbYd4na}3o`z3h@pgz48TS*WtEE$ zDhFz+S}M1F_}8La#aGDnr*yA>BtqJvM6D?iW9#)@y0p*iF0TUnL*vgFfytBsA+^}u z18ozNf=Na*(1t&q5g&Og%rQ{ff9%J~h#^BST^;r% zpy%@AT+ha`ts?)IWw*bv->DFUpWg}B-PncKl(Q?UNsuw*AxLuc7z#H7qLw0N6T5jK62_^ z=sa^`xa#1^rEBG8%k47a0bQ~eK)-|xKxk!frf^*@$;}v^EnQD@sTpnIa|qiQH88wE7H&GvX%=F=E%*wdHv;-Gr` zlL~k0D_DP5B2itd_98e&60BU)aadqSUIUqnrci%dp|4RMauGYI#yfqJ57z3m14G}<(=EFo&&YO$ zVh?J6C*Bu){q@`xi~NI0U^JC z>Iw#}N>evg+vMNGRI(>%s%mZY%Bt3-L8W55gBeTq8{#NS>;(F+E8aXzF8UBZL>Hyn zKciQ3EfQ~5%fc^tAD{9K5@k}2N4giFor7+@ksHGcOA;+12hFFOx>^vAU|hU6DimUdSu-Pfjutw|7!_(F1i-#i8Si2ez^6+jqEM<*IoT}7r>xL l^V_acsc-)`?Z#jf7`LyldsDpz{)>?@W%9JRJ+aFCe*;l7OKboD diff --git a/pxr/usdImaging/usdImagingGL/testenv/testUsdImagingGLHighlight.cpp b/pxr/usdImaging/usdImagingGL/testenv/testUsdImagingGLHighlight.cpp index 3b642b3766..8e1d1fe0bb 100644 --- a/pxr/usdImaging/usdImagingGL/testenv/testUsdImagingGLHighlight.cpp +++ b/pxr/usdImaging/usdImagingGL/testenv/testUsdImagingGLHighlight.cpp @@ -338,7 +338,6 @@ My_TestGLDrawing::Pick(GfVec2i const &startPos, GfVec2i const &endPos) frustum.SetWindow(GfRange2d(min, max)); UsdImagingGLRenderParams params; - params.enableIdRender = true; GfVec3d outHitPoint; GfVec3d outHitNormal; diff --git a/pxr/usdImaging/usdImagingGL/testenv/testUsdImagingGLPickAndHighlight.cpp b/pxr/usdImaging/usdImagingGL/testenv/testUsdImagingGLPickAndHighlight.cpp index 46f86a494a..19b1138cd2 100644 --- a/pxr/usdImaging/usdImagingGL/testenv/testUsdImagingGLPickAndHighlight.cpp +++ b/pxr/usdImaging/usdImagingGL/testenv/testUsdImagingGLPickAndHighlight.cpp @@ -454,7 +454,6 @@ My_TestGLDrawing::DeepSelect(GfVec2i const& startPos, GfVec2i const& endPos, // XXX: For a timevarying test need to set timecode for frame param UsdImagingGLRenderParams params; - params.enableIdRender = true; SdfPathVector selection; @@ -505,7 +504,6 @@ My_TestGLDrawing::Pick(GfVec2i const &startPos, GfVec2i const &endPos, // XXX: For a timevarying test need to set timecode for frame param UsdImagingGLRenderParams params; - params.enableIdRender = true; UsdImagingGLEngine::IntersectionResultVector outResults; From 6120e2581c45eaa907a6a39fea428b212915f6ab Mon Sep 17 00:00:00 2001 From: gitamohr Date: Tue, 29 Oct 2024 11:15:36 -0700 Subject: [PATCH 77/82] tf: Sort libs by name when the SML is requested to load all libs to eliminate a source of nondeterminism. We already sort individual lib predecessors by name for the same reason. Also separate the "already loaded" SML debug messages to a new TF_SCRIPT_MODULE_LOADER_EXTRA debug code. These messages can vary by build configuration, causing test output differences. E.g. in monolithic builds, "modules" load in coarse-grained groups, while in shared library builds, they load individually. (Internal change: 2345975) --- pxr/base/tf/debugCodes.cpp | 7 +++++-- pxr/base/tf/debugCodes.h | 1 + pxr/base/tf/scriptModuleLoader.cpp | 10 ++++++++-- .../TfDebugTestEnv/non-specific/debugTestEnv.out | 2 ++ .../testTfScriptModuleLoader/scriptModuleLoader.out | 10 ++++------ pxr/base/tf/testenv/testTfScriptModuleLoader.py | 2 -- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/pxr/base/tf/debugCodes.cpp b/pxr/base/tf/debugCodes.cpp index 936ca5c6ec..8328112627 100644 --- a/pxr/base/tf/debugCodes.cpp +++ b/pxr/base/tf/debugCodes.cpp @@ -13,8 +13,11 @@ PXR_NAMESPACE_OPEN_SCOPE TF_REGISTRY_FUNCTION(TfDebug) { TF_DEBUG_ENVIRONMENT_SYMBOL(TF_SCRIPT_MODULE_LOADER, - "show script module loading activity"); - TF_DEBUG_ENVIRONMENT_SYMBOL(TF_TYPE_REGISTRY, "show changes to the TfType registry"); + "show script module loading activity"); + TF_DEBUG_ENVIRONMENT_SYMBOL(TF_SCRIPT_MODULE_LOADER_EXTRA, + "show more script module loading activity"); + TF_DEBUG_ENVIRONMENT_SYMBOL(TF_TYPE_REGISTRY, + "show changes to the TfType registry"); TF_DEBUG_ENVIRONMENT_SYMBOL(TF_ATTACH_DEBUGGER_ON_ERROR, "attach/stop in a debugger for all errors"); TF_DEBUG_ENVIRONMENT_SYMBOL(TF_ATTACH_DEBUGGER_ON_FATAL_ERROR, diff --git a/pxr/base/tf/debugCodes.h b/pxr/base/tf/debugCodes.h index 7025b0c1a7..e6d0aa3eb8 100644 --- a/pxr/base/tf/debugCodes.h +++ b/pxr/base/tf/debugCodes.h @@ -26,6 +26,7 @@ TF_DEBUG_CODES( TF_DLCLOSE, TF_SCRIPT_MODULE_LOADER, + TF_SCRIPT_MODULE_LOADER_EXTRA, TF_TYPE_REGISTRY, diff --git a/pxr/base/tf/scriptModuleLoader.cpp b/pxr/base/tf/scriptModuleLoader.cpp index b5590eac3e..399a6d2309 100644 --- a/pxr/base/tf/scriptModuleLoader.cpp +++ b/pxr/base/tf/scriptModuleLoader.cpp @@ -269,13 +269,19 @@ TfScriptModuleLoader::LoadModules() toLoad.push_back(std::addressof(*iter)); } else { - TF_DEBUG(TF_SCRIPT_MODULE_LOADER) + TF_DEBUG(TF_SCRIPT_MODULE_LOADER_EXTRA) .Msg("SML: Skipping already-loaded %s\n", iter->first.GetText()); } } lock.Release(); + // Sort modules by lib name to provide a consistent load order. This isn't + // required for correctness but eliminates a source of nondeterminism. + std::sort(toLoad.begin(), toLoad.end(), + [](_LibAndInfo const *l, _LibAndInfo const *r) { + return l->first < r->first; + }); _LoadLibModules(toLoad); TF_DEBUG(TF_SCRIPT_MODULE_LOADER).Msg("SML: End loading all modules\n"); @@ -301,7 +307,7 @@ ::_LoadLibModules(vector<_LibAndInfo const *> const &toLoad) const continue; } if (info.isLoaded) { - TF_DEBUG(TF_SCRIPT_MODULE_LOADER) + TF_DEBUG(TF_SCRIPT_MODULE_LOADER_EXTRA) .Msg("SML: Lib %s's module '%s' is already loaded\n", lib.GetText(), info.moduleName.GetText()); continue; diff --git a/pxr/base/tf/testenv/baseline/TfDebugTestEnv/non-specific/debugTestEnv.out b/pxr/base/tf/testenv/baseline/TfDebugTestEnv/non-specific/debugTestEnv.out index d14ee35e96..bfe77dbc3f 100644 --- a/pxr/base/tf/testenv/baseline/TfDebugTestEnv/non-specific/debugTestEnv.out +++ b/pxr/base/tf/testenv/baseline/TfDebugTestEnv/non-specific/debugTestEnv.out @@ -23,5 +23,7 @@ TF_LOG_STACK_TRACE_ON_WARNING: TF_PRINT_ALL_POSTED_ERRORS_TO_STDERR: print all posted errors immediately, meaning that even errors that are expected and handled will be printed, producing possibly confusing output TF_SCRIPT_MODULE_LOADER : show script module loading activity +TF_SCRIPT_MODULE_LOADER_EXTRA: + show more script module loading activity TF_TYPE_REGISTRY : show changes to the TfType registry diff --git a/pxr/base/tf/testenv/baseline/testTfScriptModuleLoader/scriptModuleLoader.out b/pxr/base/tf/testenv/baseline/testTfScriptModuleLoader/scriptModuleLoader.out index c517705788..aec6b56480 100644 --- a/pxr/base/tf/testenv/baseline/testTfScriptModuleLoader/scriptModuleLoader.out +++ b/pxr/base/tf/testenv/baseline/testTfScriptModuleLoader/scriptModuleLoader.out @@ -13,15 +13,13 @@ SML: Begin loading LoadsAll's predecessors SML: End loading LoadsAll's predecessors SML: Request to load modules for empty lib name -> load all SML: Begin loading all modules -SML: Skipping already-loaded tf -SML: Loading lib Other's module 'pxr.Tf.testenv.testTfScriptModuleLoader_Other' -SML: Begin loading Other's predecessors -SML: Loading lib LoadsAll's module 'pxr.Tf.testenv.testTfScriptModuleLoader_LoadsAll' -SML: End loading Other's predecessors SML: Loading lib DepLoadsAll's module 'pxr.Tf.testenv.testTfScriptModuleLoader_DepLoadsAll' SML: Begin loading DepLoadsAll's predecessors +SML: Loading lib LoadsAll's module 'pxr.Tf.testenv.testTfScriptModuleLoader_LoadsAll' SML: End loading DepLoadsAll's predecessors -SML: Lib LoadsAll's module 'pxr.Tf.testenv.testTfScriptModuleLoader_LoadsAll' is already loaded +SML: Loading lib Other's module 'pxr.Tf.testenv.testTfScriptModuleLoader_Other' +SML: Begin loading Other's predecessors +SML: End loading Other's predecessors SML: End loading all modules SML: End loading DepLoadsAll's predecessors # Registering a library that is totally independent, and raises an diff --git a/pxr/base/tf/testenv/testTfScriptModuleLoader.py b/pxr/base/tf/testenv/testTfScriptModuleLoader.py index a88f7a00ce..092f9e7429 100644 --- a/pxr/base/tf/testenv/testTfScriptModuleLoader.py +++ b/pxr/base/tf/testenv/testTfScriptModuleLoader.py @@ -5,8 +5,6 @@ # Licensed under the terms set forth in the LICENSE.txt file available at # https://openusd.org/license. # -from __future__ import print_function - from pxr import Tf import sys From 65472cf5bb3358e3101abc1f81913d15eca95224 Mon Sep 17 00:00:00 2001 From: tallytalwar Date: Tue, 29 Oct 2024 15:04:39 -0700 Subject: [PATCH 78/82] Add UsdzValidator keyword to usdUtils:PackageEncapsulationValidator (Internal change: 2346021) --- pxr/usd/usdUtils/plugInfo.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pxr/usd/usdUtils/plugInfo.json b/pxr/usd/usdUtils/plugInfo.json index 4d429b639a..1962a094a6 100644 --- a/pxr/usd/usdUtils/plugInfo.json +++ b/pxr/usd/usdUtils/plugInfo.json @@ -4,7 +4,10 @@ "Info": { "Validators": { "PackageEncapsulationValidator": { - "doc": "If the root layer is a package, then its recommended for the composed stage to not contain references to files outside the package. The package should be self-contained, warn if not." + "doc": "If the root layer is a package, then its recommended for the composed stage to not contain references to files outside the package. The package should be self-contained, warn if not.", + "keywords": [ + "UsdzValidators" + ] }, "keywords": [ "UsdUtilsValidators" From d1ac1d0d1fd401cfd67d6cf8647e2c472d9a5f10 Mon Sep 17 00:00:00 2001 From: tallytalwar Date: Tue, 29 Oct 2024 15:04:46 -0700 Subject: [PATCH 79/82] Prevent processing of invalid layers in a package. usdz could contain invalid layers (like abc files), which is invalid, and we should guard against processing them. The code here will issue a validation error if an invalid layer is encountered. (Internal change: 2346022) --- pxr/usd/usdUtils/validatorTokens.h | 3 ++- pxr/usd/usdUtils/validators.cpp | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pxr/usd/usdUtils/validatorTokens.h b/pxr/usd/usdUtils/validatorTokens.h index ac5424e131..cc0b7ac1df 100644 --- a/pxr/usd/usdUtils/validatorTokens.h +++ b/pxr/usd/usdUtils/validatorTokens.h @@ -25,7 +25,8 @@ PXR_NAMESPACE_OPEN_SCOPE #define USD_UTILS_VALIDATION_ERROR_NAME_TOKENS \ ((layerNotInPackage, "LayerNotInPackage")) \ - ((assetNotInPackage, "AssetNotInPackage")) + ((assetNotInPackage, "AssetNotInPackage")) \ + ((invalidLayerInPackage, "InvalidLayerInPackage")) ///\def /// Tokens representing validator names. Note that for plugin provided diff --git a/pxr/usd/usdUtils/validators.cpp b/pxr/usd/usdUtils/validators.cpp index 513f2aa5fc..64e4cd33c3 100644 --- a/pxr/usd/usdUtils/validators.cpp +++ b/pxr/usd/usdUtils/validators.cpp @@ -45,6 +45,19 @@ _PackageEncapsulationValidator(const UsdStagePtr& usdStage) { if (!packagePath.empty()) { for (const SdfLayerRefPtr& referencedLayer : layers) { + if (!referencedLayer) { + errors.emplace_back( + UsdUtilsValidationErrorNameTokens->invalidLayerInPackage, + UsdValidationErrorType::Error, + UsdValidationErrorSites { + UsdValidationErrorSite( + rootLayer, SdfPath()) + }, + "Found invalid layer reference in package. This could be " + "due to a layer that failed to load or a layer that is not " + "a valid layer to be bundled in a package."); + continue; + } const std::string& realPath = referencedLayer->GetRealPath(); // We don't want to validate in-memory or session layers From f03094691a20521ad34fccb418997a4e40078bd7 Mon Sep 17 00:00:00 2001 From: tcauchois Date: Tue, 29 Oct 2024 15:04:59 -0700 Subject: [PATCH 80/82] [Hdx] Add missing API tag to HdxSelectionTracker. (Internal change: 2346030) --- pxr/imaging/hdx/selectionTracker.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pxr/imaging/hdx/selectionTracker.h b/pxr/imaging/hdx/selectionTracker.h index c8fcb865b3..7233dfd046 100644 --- a/pxr/imaging/hdx/selectionTracker.h +++ b/pxr/imaging/hdx/selectionTracker.h @@ -94,6 +94,8 @@ class HdxSelectionTracker public: HDX_API HdxSelectionTracker(); + + HDX_API virtual ~HdxSelectionTracker(); /// Optional override to update the selection (either compute HdSelection and From 1930e0b44e9972f10dfc6f3cc609a4e8a39e9b2d Mon Sep 17 00:00:00 2001 From: tallytalwar Date: Tue, 29 Oct 2024 15:05:09 -0700 Subject: [PATCH 81/82] Disable testUsdValidationContext for static builds, as these rely on test plugin build specifically for the test, and build system currently does not support this for static builds. (Internal change: 2346048) --- pxr/usd/usd/CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pxr/usd/usd/CMakeLists.txt b/pxr/usd/usd/CMakeLists.txt index 7c77c2dea7..02793db940 100644 --- a/pxr/usd/usd/CMakeLists.txt +++ b/pxr/usd/usd/CMakeLists.txt @@ -1078,24 +1078,24 @@ pxr_register_test(testUsdValidator EXPECTED_RETURN_CODE 0 ) -pxr_register_test(testUsdValidationContext - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdValidationContext" - EXPECTED_RETURN_CODE 0 -) - pxr_register_test(testUsdValidationRegistry COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdValidationRegistry" EXPECTED_RETURN_CODE 0 ) -# This test relies on a plugin built specifically for this test. -# The build system currently doesn't support this for static library -# builds, so we only enable this test on shared library builds. +#The following tests rely on plugins built specifically for them. +#The build system currently doesn't support test-specific plugins +#for static library builds, so we only enable these tests for +#shared library builds. if (BUILD_SHARED_LIBS) pxr_register_test(testUsdResolverChanged COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdResolverChanged" EXPECTED_RETURN_CODE 0 ) + pxr_register_test(testUsdValidationContext + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdValidationContext" + EXPECTED_RETURN_CODE 0 + ) endif() pxr_register_test(testUsdStageNoPython From e45ffe68575b67017c682816f75a4cf5b51a94e8 Mon Sep 17 00:00:00 2001 From: pixar-oss Date: Tue, 29 Oct 2024 15:05:33 -0700 Subject: [PATCH 82/82] Doc updates for namespace editor for 24.11 changes (Internal change: 2346056) --- docs/user_guides/namespace_editing.rst | 312 ++++++++++++++++++++++--- 1 file changed, 276 insertions(+), 36 deletions(-) diff --git a/docs/user_guides/namespace_editing.rst b/docs/user_guides/namespace_editing.rst index ec201d3ffa..c5ca55dd26 100644 --- a/docs/user_guides/namespace_editing.rst +++ b/docs/user_guides/namespace_editing.rst @@ -10,19 +10,26 @@ A namespace edit is an operation that removes or changes the namespace path of a **composed** prim or property on a stage. Edit operations currently include deleting and moving (renaming and/or reparenting) a composed prim or property. -While it is possible to do some of these operations using Sdf or UsdStage APIs, -these APIs can only edit prims or properties on a single layer. Namespace -editing handles edits for prims and properties that are composed from multiple -layers or other composition arcs. Using namespace editing lets you robustly -delete and move prims that have opinions throughout a LayerStack that you have -the authority to edit. Namespace editing also allows "non-destructive" -deletion and moving of prims defined in LayerStacks that you don't have the -authority to edit. +While it is possible to do some of these operations using Sdf or UsdStage APIs, +these APIs can only edit prims or properties on a single layer. Additionally, +any paths targeting the moved or deleted objects will need to be manually fixed. +Use namespace editing to easily and safely delete or move prims and properties +across the :ref:`LayerStack `. Namespace editing handles +edits for objects composed from multiple layers and handles changing +:ref:`EditTargets ` or fixing paths targeting the +edited objects, automatically. + +Namespace also provides non-destructive editing of prims defined across +composition arcs by adding the **relocates** composition arc if needed. +By using relocates, namespace editing ensures non-destructive edits by *not* +modifying the source of a composition arc. This is necessary for workflows where +you might not be able to make changes to the source of the composition +arc directly (e.g. you're referencing prims from assets maintained by a +different department that are also being referenced elsewhere). As a simple example, if you had :filename:`model.usda` with various prims: .. code-block:: usda - :caption: model.usda #usda 1.0 ( @@ -39,10 +46,9 @@ As a simple example, if you had :filename:`model.usda` with various prims: } And :filename:`main.usda`, which has :filename:`model.usda` as a sublayer and -overs for :sdfpath:`/modelScope` and :sdfpath:`/modelScope/model1`: +overrides for :sdfpath:`/modelScope` and :sdfpath:`/modelScope/model1`: .. code-block:: usda - :caption: main.usda #usda 1.0 ( @@ -60,15 +66,16 @@ overs for :sdfpath:`/modelScope` and :sdfpath:`/modelScope/model1`: } After loading :filename:`main.usda` into your stage, if you wanted to fully -remove :sdfpath:`/modelScope/model1` from your composed stage, using UsdStage +remove :sdfpath:`/modelScope/model1` from your composed stage using UsdStage APIs, you'd have to delete it twice: once in :filename:`main.usda`, and then, -after changing edit targets, again in the :filename:`model.usda` layer: +after changing :ref:`EditTargets `, again in the +:filename:`model.usda` layer: .. code-block:: python stage = Usd.Stage.Open("main.usda") - # This only removes model1 in model.usda, not + # This only removes model1 in main.usda, not # model1 in the model.usda layer removeResult = stage.RemovePrim("/modelScope/model1") @@ -77,8 +84,8 @@ after changing edit targets, again in the :filename:`model.usda` layer: # set the edit target to the model.usda layer and call RemovePrim() again Whereas using namespace editing will properly handle removing the prim from -both :filename:`main.usda` and :filename:`model.usda`, handling edit target -changes for you: +both :filename:`main.usda` and :filename:`model.usda` in a single edit +operation, handling edit target changes for you: .. code-block:: python @@ -86,19 +93,19 @@ changes for you: removeResult = editor.DeletePrimAtPath("/modelScope/model1") editor.ApplyEdits() -Namespace editing also handles issues such as making sure that paths to -and overrides of edited objects are still valid after renaming or reparenting +Namespace editing handles issues such as making sure that paths targeting +edited objects and overrides are still valid after renaming or reparenting prims. Namespace editing tries to fix any existing composition arcs, relationship targets, attribute connections, and overrides that used paths to renamed or reparented prims to use the new paths. -Namespace editing in a future update will also use **relocates** for more -complex edit scenarios. Relocates are another composition arc that maps a prim -path in a namespace to a new path location. For example, if you were referencing -a prim from :filename:`refModel.usda`: +Namespace editing will also use **relocates** for more complex edit scenarios. +Relocates are another composition arc that maps a prim path defined in a remote +:ref:`LayerStack ` (i.e. across a composition arc) to a +new path location in the local namespace. For an example of how namespace +editing uses relocates, if you had :filename:`refModel.usda`: .. code-block:: usda - :caption: refModel.usda def "modelA" () { @@ -107,16 +114,19 @@ a prim from :filename:`refModel.usda`: } } +Which is referenced in :filename:`main.usda`: + .. code-block:: usda - :caption: main.usda def "mainModelA" ( prepend references = @refModel.usda@ ) { -You will be able to use namespace editing to move or rename -:sdfpath:`/mainModelA/modelAChild` using relocates. +You might want to use namespace editing to move or rename +:sdfpath:`/mainModelA/modelAChild`. Because :sdfpath:`/mainModelA/modelAChild` +is composed across a reference composition arc, it can't be directly edited, +so namespace editing will use relocates to create the edit. .. code-block:: python @@ -125,6 +135,30 @@ You will be able to use namespace editing to move or rename removeResult = editor.MovePrimAtPath("/mainModelA/modelAChild", "/mainModelA/renamedChild") editor.ApplyEdits() +The resulting stage root layer for :file:`main.usda` will look like: + +.. code-block:: usda + + #usda 1.0 + ( + relocates = { + : + } + ) + + def "mainModelA" ( + prepend references = @refModel.usda@ + ) + { + } + +.. note:: + + **relocates** is a new composition arc for USD that is a separate feature + from namespace editing, and can be used independently of namespace editing. + +.. _nsedit_using_usdnamespaceeditor: + ************************ Using UsdNamespaceEditor ************************ @@ -147,7 +181,7 @@ rename or reparent prims and properties using :usdcpp:`UsdPrim` and When you call a :usdcpp:`UsdNamespaceEditor` edit operation, the operation paths are validated (e.g. the paths passed to :code:`MovePrimAtPath()` are checked to make sure they are valid paths), and then the operation is queued (to support -batches of operations, see :ref:`namespace_editing_batch_edits` below). To +batches of operations, see :ref:`nsedit_batch_edits` below). To execute individual edit operations, as the following examples do, call :code:`ApplyEdits()` after each operation call. @@ -204,6 +238,82 @@ Note that after renaming or reparenting a :usdcpp:`UsdPrim` or :usdcpp:`UsdProperty`, the :usdcpp:`UsdPrim` or :usdcpp:`UsdProperty` reference used in the operation will no longer be valid, as the path has changed. +.. _nsedit_setting_editor_options: + +Setting Editor Options +====================== + +When you create a namespace editor, you can optionally provide edit options +that control editor behavior. The current set of options are: + +* **allowRelocatesAuthoring**: If :code:`True` the namespace editor will use + relocates when needed to make edits. If :code:`False`, the namespace editor + will not use relocates and will issue errors when applying or validating edits + that require relocates. The default is :code:`True`. + +The following example creates the :code:`noRelocatesEditOptions` edit options, +disables :code:`noRelocatesEditOptions.allowRelocatesAuthoring`, and creates +a namespace editor for :code:`stage` with these options. + +.. code-block:: python + + noRelocatesEditOptions = Usd.NamespaceEditor.EditOptions() + noRelocatesEditOptions.allowRelocatesAuthoring = False + + # Create/use namespace editor that will not use relocates + noRelocatesEditor = Usd.NamespaceEditor(stage, noRelocatesEditOptions) + +.. _nsedit_working_with_relocates: + +Working With Relocates +====================== + +As mentioned earlier, namespace editing will use **relocates** if necessary +for edit operations across composition arcs. Namespace editing will add or +update relocates in the appropriate layer's metadata relocates list. The +following example shows layer metadata with a relocate added by a namespace +editing operation to rename :sdfpath:`/mainModelA/modelAChild` to +:sdfpath:`/mainModelA/renamedChild`: + +.. code-block:: usda + + #usda 1.0 + ( + relocates = { + : + } + ) + +For delete operations that require using relocates, namespace editing will +create a relocates mapping that maps a prim or property to a "deleted" target: + +.. code-block:: python + + # Delete a referenced prim, which will add a new relocates + editor.DeletePrimAtPath('/RootPrim/ChildInRef') + editor.ApplyEdits() + +.. code-block:: + + #usda 1.0 + ( + relocates = { + : <> + } + ) + +Note that the way in which relocates must "transfer" composed opinions prevents +you from re-defining a new prim at the deleted or moved target location: + +.. code-block:: python + + # Continuing from the earlier Python code, now try and define a prim at the + # deleted /RootPrim/ChildInRef path. This will result in a + # "Failed to define UsdPrim" error. + stage.DefinePrim('/RootPrim/ChildInRef') + +.. _nsedit_fixing_paths_for_moved_objects: + Fixing Paths For Moved Objects ============================== @@ -318,16 +428,108 @@ With the flattened results looking like: } } -.. note:: - Currently, direct edits across composition arcs, such as renaming just - :sdfpath:`/Shot1/shotAsset/assetChild` in the above example, is not supported - via namespace editing and will result in the following error (from - :code:`CanApplyEdits()` or :code:`ApplyEdits()`): "The prim to move requires - authoring relocates since it composes opinions introduced by ancestral - composition arcs; authoring relocates is not yet supported". Relocates will - be available in a future update. +.. _nsedit_fixing_edits_with_dependent_stages: -.. _namespace_editing_batch_edits: +Applying Edits to Dependent Stages +================================== + +In some situations, a namespace edit applied to one stage can impact other +**dependent stages**. A dependent stage is any additional stage open in the +current session that has a composition dependency on any layer edits made for +the editor's primary stage. For example, you might have a stage that has +references to prims in the editor's primary stage, and you might have edits +that rename or delete the referenced prims. + +By default, an editor only makes edits and fixes to the editor's primary stage. +However, you can add dependent stages to an editor via +:code:`AddDependentStage()` and the editor will make any necessary additional +edits in those dependent stages to update the composition dependencies +appropriately. + +For example, we might have the layer :filename:`layer1.usda`, which will get +composed into the stage for which we'll create a namespace editor. + +.. code-block:: usda + + #usda 1.0 + ( + ) + + def "Prim1" { + def "Child" { + } + } + + def "InternalRef1" ( + references = + ) { + over "Child" { + int overChildAttr + } + } + +We also have an additional layer :filename:`layer2.usda` that references prims +in :filename:`layer1.usda`: + +.. code-block:: usda + + #usda 1.0 + ( + ) + + def "OtherStageRef2" ( + references = @layer1.usda@ + ) { + int overChildAttr + } + +We can open both layers in separate stages, create a namespace editor for the +stage containing layer1, and add the stage containing layer2 as a dependent +stage. + +.. code-block:: python + + stage1 = Usd.Stage.Open("layer1.usda") + stage2 = Usd.Stage.Open("layer2.usda") + + # Create a namespace editor for stage1 + editor = Usd.NamespaceEditor(stage1) + + # Add stage2 as a dependent stage for our stage1 editor + editor.AddDependentStage(stage2) + + # Move /Prim1/Child to /Prim1/RenamedChild. This will not only + # update the prims and references in stage1, but also update the + # OtherStageRef2 reference in stage2 + editor.MovePrimAtPath('/Prim1/Child', '/Prim1/RenamedChild') + editor.ApplyEdits() + +After the edit, the root layer of stage2 looks like: + +.. code-block:: usda + + #usda 1.0 + + def "OtherStageRef2" ( + references = @layer1.usda@ + ) + { + int overChildAttr + } + +You can use :code:`RemoveDependentStage()` to remove any added dependent stages +before making a namespace edit, when you do not want the dependent stage +dependencies updated. + +If you have several dependent stages, you can set a list of dependent stages on +an editor using :code:`SetDependentStages()`. + +Note that namespace editing finds dependencies in dependent stages based on +what is currently loaded in those stages. If a stage has dependencies in +unloaded payloads, load mask filtered prims, unselected variants, or children of +inactive prims, the namespace editor cannot find and update those dependencies. + +.. _nsedit_batch_edits: Batch Edits =========== @@ -370,12 +572,16 @@ Executing batches of edits will usually be more efficient than applying each edit individually. USD will process the list of edits in a batch to determine the most efficient way to apply them. +.. _nsedit_editing_best_practices: + ******************************** Namespace Editing Best Practices ******************************** The following are some general best practices and caveats for namespace editing. +.. _nsedit_canapplyedits_validate_operations: + Use CanApplyEdits() To Validate Edit Operations =============================================== @@ -404,6 +610,8 @@ indicating the path does not resolve to a valid prim. else: # Handle error, using canApplyResult.whyNot as needed, etc. +.. _nsedit_builtin_properties_not_editable: + Built-In Properties From Schemas Are Not Editable ================================================= @@ -429,3 +637,35 @@ would fail. editor.DeletePropertyAtPath("/testSphere/customProp") # This is allowed editor.DeletePropertyAtPath("/testSphere/radius") # This is not allowed and will cause an error + +.. _nsedit_relocates_performance_impact: + +Be Aware of Relocates Performance Impact +======================================== + +If your namespace editing operations result in adding **relocates** to your +stage, this can increase the number of composition arcs in your stage, which +could impact stage composition performance. + +If you want to test whether a namespace edit will add relocates, you can +use an editor configured to disallow authoring relocates, and use +:code:`CanApplyEdits()` looking for any errors that indicate relocates would +be needed. + +.. code-block:: python + + # Create/use namespace editor that will not use relocates + noRelocatesEditOptions = Usd.NamespaceEditor.EditOptions() + noRelocatesEditOptions.allowRelocatesAuthoring = False + noRelocatesEditor = Usd.NamespaceEditor(stage, noRelocatesEditOptions) + + # Rename /mainModelA/modelAChild to /mainModelA/renamedChild + # This editor is configured to not use relocates, so an error will be shown + removeResult = noRelocatesEditor.MovePrimAtPath("/mainModelA/modelAChild", "/mainModelA/renamedChild") + applyResult = noRelocatesEditor.CanApplyEdits() + if applyResult is not True: + # We should get a "The prim to edit requires authoring relocates since + # it composes opinions introduced by ancestral composition arcs; + # relocates authoring must be enabled to perform this edit" error + print ("noRelocatesEditor: Cannot apply edits, reason: " + applyResult.whyNot) + \ No newline at end of file