OSDN Git Service

Add builtin interface to spirv shader
authorChris Forbes <chrisforbes@google.com>
Thu, 17 Jan 2019 18:10:09 +0000 (10:10 -0800)
committerChris Forbes <chrisforbes@google.com>
Thu, 17 Jan 2019 18:43:42 +0000 (18:43 +0000)
Initial structures to bridge the shader's use of particular builtins to
behavior of the "fixed function" logic wrapped around it.

Bug: b/120799499

Change-Id: I5cb360909c62615efab2e500f5c24109737e4ab7
Reviewed-on: https://swiftshader-review.googlesource.com/c/23709
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
src/Pipeline/SpirvShader.hpp

index 0d64a0e..8a91ebf 100644 (file)
@@ -127,6 +127,7 @@ namespace sw
                        bool DepthGreater : 1;
                        bool DepthLess : 1;
                        bool DepthUnchanged : 1;
+                       bool ContainsKill : 1;
 
                        // Compute workgroup dimensions
                        int LocalSizeX, LocalSizeY, LocalSizeZ;
@@ -146,11 +147,18 @@ namespace sw
                        ATTRIBTYPE_LAST = ATTRIBTYPE_UINT
                };
 
+               bool hasBuiltinInput(spv::BuiltIn b) const
+               {
+                       return inputBuiltins.find(b) != inputBuiltins.end();
+               }
+
        private:
                const int serialID;
                static volatile int serialCounter;
                Modes modes;
                std::unordered_map<uint32_t, Object> defs;
+               std::unordered_map<spv::BuiltIn, uint32_t> inputBuiltins;
+               std::unordered_map<spv::BuiltIn, uint32_t> outputBuiltins;
 
                void ProcessExecutionMode(InsnIterator it);