OSDN Git Service

Remove asserts blocking specialization constant use
authorChris Forbes <chrisforbes@google.com>
Thu, 14 Mar 2019 20:07:08 +0000 (13:07 -0700)
committerChris Forbes <chrisforbes@google.com>
Fri, 15 Mar 2019 18:49:47 +0000 (18:49 +0000)
These have been fully implemented for some time.

Bug: b/124058197
Change-Id: I8146c0902aa0c4caa974e5af5b1a36104846934c
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/27268
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Presubmit-Ready: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

src/Vulkan/VkPipeline.cpp

index d05ba16..dcaba8b 100644 (file)
@@ -252,26 +252,6 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn
                UNIMPLEMENTED();
        }
 
-       const VkPipelineShaderStageCreateInfo& vertexStage = pCreateInfo->pStages[0];
-       if((vertexStage.stage != VK_SHADER_STAGE_VERTEX_BIT) ||
-          (vertexStage.flags != 0) ||
-          !((vertexStage.pSpecializationInfo == nullptr) ||
-            ((vertexStage.pSpecializationInfo->mapEntryCount == 0) &&
-             (vertexStage.pSpecializationInfo->dataSize == 0))))
-       {
-               UNIMPLEMENTED();
-       }
-
-       const VkPipelineShaderStageCreateInfo& fragmentStage = pCreateInfo->pStages[1];
-       if((fragmentStage.stage != VK_SHADER_STAGE_FRAGMENT_BIT) ||
-          (fragmentStage.flags != 0) ||
-          !((fragmentStage.pSpecializationInfo == nullptr) ||
-            ((fragmentStage.pSpecializationInfo->mapEntryCount == 0) &&
-             (fragmentStage.pSpecializationInfo->dataSize == 0))))
-       {
-               UNIMPLEMENTED();
-       }
-
        const VkPipelineVertexInputStateCreateInfo* vertexInputState = pCreateInfo->pVertexInputState;
        if(vertexInputState->flags != 0)
        {
@@ -460,8 +440,12 @@ void GraphicsPipeline::compileShaders(const VkAllocationCallbacks* pAllocator, c
 {
        for (auto pStage = pCreateInfo->pStages; pStage != pCreateInfo->pStages + pCreateInfo->stageCount; pStage++)
        {
-               auto module = Cast(pStage->module);
+               if (pStage->flags != 0)
+               {
+                       UNIMPLEMENTED();
+               }
 
+               auto module = Cast(pStage->module);
                auto code = preprocessSpirv(module->getCode(), pStage->pSpecializationInfo);
 
                // TODO: also pass in any pipeline state which will affect shader compilation