OSDN Git Service

Formatting-only change: conform better with swiftshader style
authorChris Forbes <chrisforbes@google.com>
Thu, 17 Jan 2019 17:36:46 +0000 (09:36 -0800)
committerChris Forbes <chrisforbes@google.com>
Thu, 17 Jan 2019 17:45:36 +0000 (17:45 +0000)
Change-Id: I5241cb398aa294a702c0f70980b80d399dfbc5b0
Reviewed-on: https://swiftshader-review.googlesource.com/c/23689
Tested-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
src/Pipeline/SpirvShader.cpp
src/Pipeline/SpirvShader.hpp

index 5436aeb..4c5a03d 100644 (file)
@@ -29,49 +29,53 @@ namespace sw
                // - Input / Output interface blocks, builtin or otherwise, have been split.
                // - The only input/output OpVariables present are those used by the entrypoint
 
-               for (auto insn : *this) {
-                       switch (insn.opcode()) {
-                               case spv::OpExecutionMode:
-                                       ProcessExecutionMode(insn);
-                                       break;
+               for (auto insn : *this)
+               {
+                       switch (insn.opcode())
+                       {
+                       case spv::OpExecutionMode:
+                               ProcessExecutionMode(insn);
+                               break;
 
-                               case spv::OpTypeVoid:
-                               case spv::OpTypeBool:
-                               case spv::OpTypeInt:
-                               case spv::OpTypeFloat:
-                               case spv::OpTypeVector:
-                               case spv::OpTypeMatrix:
-                               case spv::OpTypeImage:
-                               case spv::OpTypeSampler:
-                               case spv::OpTypeSampledImage:
-                               case spv::OpTypeArray:
-                               case spv::OpTypeRuntimeArray:
-                               case spv::OpTypeStruct:
-                               case spv::OpTypePointer:
-                               case spv::OpTypeFunction: {
-                                       auto resultId = insn.word(1);
-                                       auto &object = defs[resultId];
-                                       object.kind = Object::Kind::Type;
-                                       object.definition = insn;
-                                       break;
-                               }
+                       case spv::OpTypeVoid:
+                       case spv::OpTypeBool:
+                       case spv::OpTypeInt:
+                       case spv::OpTypeFloat:
+                       case spv::OpTypeVector:
+                       case spv::OpTypeMatrix:
+                       case spv::OpTypeImage:
+                       case spv::OpTypeSampler:
+                       case spv::OpTypeSampledImage:
+                       case spv::OpTypeArray:
+                       case spv::OpTypeRuntimeArray:
+                       case spv::OpTypeStruct:
+                       case spv::OpTypePointer:
+                       case spv::OpTypeFunction:
+                       {
+                               auto resultId = insn.word(1);
+                               auto &object = defs[resultId];
+                               object.kind = Object::Kind::Type;
+                               object.definition = insn;
+                               break;
+                       }
 
-                               case spv::OpVariable: {
-                                       auto typeId = insn.word(1);
-                                       auto resultId = insn.word(2);
-                                       auto storageClass = static_cast<spv::StorageClass>(insn.word(3));
-                                       if (insn.wordCount() > 4)
-                                               UNIMPLEMENTED("Variable initializers not yet supported");
+                       case spv::OpVariable:
+                       {
+                               auto typeId = insn.word(1);
+                               auto resultId = insn.word(2);
+                               auto storageClass = static_cast<spv::StorageClass>(insn.word(3));
+                               if (insn.wordCount() > 4)
+                                       UNIMPLEMENTED("Variable initializers not yet supported");
 
-                                       auto &object = defs[resultId];
-                                       object.kind = Object::Kind::Variable;
-                                       object.definition = insn;
-                                       object.storageClass = storageClass;
-                                       break;
-                               }
+                               auto &object = defs[resultId];
+                               object.kind = Object::Kind::Variable;
+                               object.definition = insn;
+                               object.storageClass = storageClass;
+                               break;
+                       }
 
-                               default:
-                                       break;    // This is OK, these passes are intentionally partial
+                       default:
+                               break;    // This is OK, these passes are intentionally partial
                        }
                }
        }
@@ -79,32 +83,33 @@ namespace sw
        void SpirvShader::ProcessExecutionMode(InsnIterator insn)
        {
                auto mode = static_cast<spv::ExecutionMode>(insn.word(2));
-               switch (mode) {
-                       case spv::ExecutionModeEarlyFragmentTests:
-                               modes.EarlyFragmentTests = true;
-                               break;
-                       case spv::ExecutionModeDepthReplacing:
-                               modes.DepthReplacing = true;
-                               break;
-                       case spv::ExecutionModeDepthGreater:
-                               modes.DepthGreater = true;
-                               break;
-                       case spv::ExecutionModeDepthLess:
-                               modes.DepthLess = true;
-                               break;
-                       case spv::ExecutionModeDepthUnchanged:
-                               modes.DepthUnchanged = true;
-                               break;
-                       case spv::ExecutionModeLocalSize:
-                               modes.LocalSizeX = insn.word(3);
-                               modes.LocalSizeZ = insn.word(5);
-                               modes.LocalSizeY = insn.word(4);
-                               break;
-                       case spv::ExecutionModeOriginUpperLeft:
-                               // This is always the case for a Vulkan shader. Do nothing.
-                               break;
-                       default:
-                               UNIMPLEMENTED("No other execution modes are permitted");
+               switch (mode)
+               {
+               case spv::ExecutionModeEarlyFragmentTests:
+                       modes.EarlyFragmentTests = true;
+                       break;
+               case spv::ExecutionModeDepthReplacing:
+                       modes.DepthReplacing = true;
+                       break;
+               case spv::ExecutionModeDepthGreater:
+                       modes.DepthGreater = true;
+                       break;
+               case spv::ExecutionModeDepthLess:
+                       modes.DepthLess = true;
+                       break;
+               case spv::ExecutionModeDepthUnchanged:
+                       modes.DepthUnchanged = true;
+                       break;
+               case spv::ExecutionModeLocalSize:
+                       modes.LocalSizeX = insn.word(3);
+                       modes.LocalSizeZ = insn.word(5);
+                       modes.LocalSizeY = insn.word(4);
+                       break;
+               case spv::ExecutionModeOriginUpperLeft:
+                       // This is always the case for a Vulkan shader. Do nothing.
+                       break;
+               default:
+                       UNIMPLEMENTED("No other execution modes are permitted");
                }
        }
 }
\ No newline at end of file
index 2c5b86e..7e3b1cb 100644 (file)
@@ -44,7 +44,9 @@ namespace sw
                        }
 
                        uint32_t wordCount() const
-                       { return *iter >> spv::WordCountShift; }
+                       {
+                               return *iter >> spv::WordCountShift;
+                       }
 
                        uint32_t word(uint32_t n) const
                        {
@@ -58,7 +60,9 @@ namespace sw
                        }
 
                        InsnIterator operator*() const
-                       { return *this; }
+                       {
+                               return *this;
+                       }
 
                        InsnIterator &operator++()
                        {
@@ -78,15 +82,20 @@ namespace sw
                        InsnIterator() = default;
 
                        explicit InsnIterator(InsnStore::const_iterator iter) : iter{iter}
-                       {}
+                       {
+                       }
                };
 
                /* range-based-for interface */
                InsnIterator begin() const
-               { return InsnIterator{insns.cbegin() + 5}; }
+               {
+                       return InsnIterator{insns.cbegin() + 5};
+               }
 
                InsnIterator end() const
-               { return InsnIterator{insns.cend()}; }
+               {
+                       return InsnIterator{insns.cend()};
+               }
 
                class Object
                {
@@ -104,7 +113,9 @@ namespace sw
                };
 
                int getSerialID() const
-               { return serialID; }
+               {
+                       return serialID;
+               }
 
                explicit SpirvShader(InsnStore const &insns);
 
@@ -121,7 +132,9 @@ namespace sw
                };
 
                Modes const &getModes() const
-               { return modes; }
+               {
+                       return modes;
+               }
 
        private:
                const int serialID;