diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2018-06-01 10:41:13 -0400 |
|---|---|---|
| committer | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-06-01 07:41:13 -0700 |
| commit | 698ba86962d10d927d7ac4eb781e05e33f08c9eb (patch) | |
| tree | 0c014c388a52c8eb571f548227696bd6e638178f /tools/render-test/render-vk.cpp | |
| parent | 8d77db3c4e357329c8693457d37b99fc1f48a9f7 (diff) | |
1st stage renderer binding refactor (#587)
* First pass at support for textures in vulkan.
* Binding state has first pass support for VkImageView VkSampler.
* Split out _calcImageViewType
* Fix bug in debug build around constant buffer being added but not part of the binding description for the test.
* Offset recalculated for vk texture construction just store the texture size for each mip level.
* When outputing a vector type with a size of 1 in GLSL, it needs to be output as the underlying type. For example vector<float,1> should be output as float in GLSL.
* Vulkan render-test produces right output for the test
tests/compute/textureSamplingTest.slang -slang -gcompute -o tests/compute/textureSamplingTest.slang.actual.txt -vk
* Small improvement around xml encoding a string.
* More generalized test synthesis.
* Fix image usage flags for Vulkan.
* Improvements to what gets synthesized vulkan tests.
* Do transition on all mip levels.
* Fixing problems appearing from vulkan debug layer.
* Disable Vulkan synthesized tests for now.
* Add Resource::Type member to Resource::DescBase.
* Removed the CompactIndexSlice from binding. Just bind the indices needed.
* BindingRegister -> RegisterSet
* RegisterSet -> RegisterRange
* Typo fix for debug build.
* Remove comment that no longer applied.
Diffstat (limited to 'tools/render-test/render-vk.cpp')
| -rw-r--r-- | tools/render-test/render-vk.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/tools/render-test/render-vk.cpp b/tools/render-test/render-vk.cpp index ba517be68..5be1f5684 100644 --- a/tools/render-test/render-vk.cpp +++ b/tools/render-test/render-vk.cpp @@ -39,7 +39,7 @@ public: virtual void setClearColor(const float color[4]) override; virtual void clearFrame() override; virtual void presentFrame() override; - virtual TextureResource* createTextureResource(Resource::Type type, Resource::Usage initialUsage, const TextureResource::Desc& desc, const TextureResource::Data* initData) override; + virtual TextureResource* createTextureResource(Resource::Usage initialUsage, const TextureResource::Desc& desc, const TextureResource::Data* initData) override; virtual BufferResource* createBufferResource(Resource::Usage initialUsage, const BufferResource::Desc& bufferDesc, const void* initData) override; virtual SlangResult captureScreenSurface(Surface& surface) override; virtual InputLayout* createInputLayout(const InputElementDesc* inputElements, UInt inputElementCount) override; @@ -129,8 +129,8 @@ public: public: typedef TextureResource Parent; - TextureResourceImpl(Type type, const Desc& desc, Usage initialUsage, const VulkanApi* api) : - Parent(type, desc), + TextureResourceImpl(const Desc& desc, Usage initialUsage, const VulkanApi* api) : + Parent(desc), m_initialUsage(initialUsage), m_api(api) { @@ -180,7 +180,6 @@ public: VkImageView m_srv = VK_NULL_HANDLE; VkBufferView m_uav = VK_NULL_HANDLE; VkSampler m_sampler = VK_NULL_HANDLE; - int m_binding = 0; }; class BindingStateImpl: public BindingState @@ -416,7 +415,7 @@ Slang::Result VKRenderer::_createPipeline(RefPtr<Pipeline>& pipelineOut) const auto& srcBinding = srcBindings[i]; VkDescriptorSetLayoutBinding dstBinding = {}; - dstBinding.binding = srcDetail.m_binding; + dstBinding.descriptorCount = 1; switch (srcBinding.bindingType) @@ -551,10 +550,12 @@ Slang::Result VKRenderer::_createPipeline(RefPtr<Pipeline>& pipelineOut) const auto& srcDetail = srcDetails[i]; const auto& srcBinding = srcBindings[i]; + const int bindingIndex = srcBinding.registerRange.getSingleIndex(); + VkWriteDescriptorSet writeInfo = { VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET }; writeInfo.descriptorCount = 1; writeInfo.dstSet = pipeline->m_descriptorSet; - writeInfo.dstBinding = srcDetail.m_binding; + writeInfo.dstBinding = bindingIndex; writeInfo.dstArrayElement = 0; switch (srcBinding.bindingType) @@ -1346,10 +1347,10 @@ void VKRenderer::_transitionImageLayout(VkImage image, VkFormat format, const Te m_api.vkCmdPipelineBarrier(commandBuffer, sourceStage, destinationStage, 0, 0, nullptr, 0, nullptr, 1, &barrier); } -TextureResource* VKRenderer::createTextureResource(Resource::Type type, Resource::Usage initialUsage, const TextureResource::Desc& descIn, const TextureResource::Data* initData) +TextureResource* VKRenderer::createTextureResource(Resource::Usage initialUsage, const TextureResource::Desc& descIn, const TextureResource::Data* initData) { TextureResource::Desc desc(descIn); - desc.setDefaults(type, initialUsage); + desc.setDefaults(initialUsage); const VkFormat format = VulkanUtil::getVkFormat(desc.format); if (format == VK_FORMAT_UNDEFINED) @@ -1358,15 +1359,15 @@ TextureResource* VKRenderer::createTextureResource(Resource::Type type, Resource return nullptr; } - const int arraySize = desc.calcEffectiveArraySize(type); + const int arraySize = desc.calcEffectiveArraySize(); - RefPtr<TextureResourceImpl> texture(new TextureResourceImpl(type, desc, initialUsage, &m_api)); + RefPtr<TextureResourceImpl> texture(new TextureResourceImpl(desc, initialUsage, &m_api)); // Create the image { VkImageCreateInfo imageInfo = {VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO}; - switch (type) + switch (desc.type) { case Resource::Type::Texture1D: { @@ -1872,9 +1873,6 @@ BindingState* VKRenderer::createBindingState(const BindingState::Desc& bindingSt auto& dstDetail = dstDetails[i]; const auto& srcBinding = srcBindings[i]; - // For now use Glsl binding - dstDetail.m_binding = bindingStateDesc.getFirst(BindingState::ShaderStyle::Glsl, srcBinding.shaderBindSet); - switch (srcBinding.bindingType) { case BindingType::Buffer: |
