OSDN Git Service

gl_VertexID implementation
[android-x86/external-swiftshader.git] / src / Shader / VertexRoutine.hpp
index 3eec924..905118b 100644 (file)
@@ -1,13 +1,16 @@
-// SwiftShader Software Renderer
+// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
 //
-// Copyright(c) 2005-2013 TransGaming Inc.
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
 //
-// All rights reserved. No part of this software may be copied, distributed, transmitted,
-// transcribed, stored in a retrieval system, translated into any human or computer
-// language by any means, or disclosed to third parties without the explicit written
-// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
-// or implied, including but not limited to any patent rights, are granted to you.
+//    http://www.apache.org/licenses/LICENSE-2.0
 //
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 
 #ifndef sw_VertexRoutine_hpp
 #define sw_VertexRoutine_hpp
@@ -26,10 +29,10 @@ namespace sw
                virtual ~VertexRoutinePrototype() {};
 
        protected:
-               const Pointer<Byte> vertex;
-               const Pointer<Byte> batch;
-               const Pointer<Byte> task;
-               const Pointer<Byte> data;
+               Pointer<Byte> vertex;
+               Pointer<Byte> batch;
+               Pointer<Byte> task;
+               Pointer<Byte> data;
        };
 
        class VertexRoutine : public VertexRoutinePrototype
@@ -41,62 +44,17 @@ namespace sw
                void generate();
 
        protected:
-               struct Registers
-               {
-                       Registers(const VertexShader *shader) :
-                               v(shader && shader->dynamicallyIndexedInput),
-                               r(shader && shader->dynamicallyIndexedTemporaries),
-                               o(shader && shader->dynamicallyIndexedOutput)
-                       {
-                               loopDepth = -1;
-                               enableStack[0] = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
+               Pointer<Byte> constants;
 
-                               if(shader && shader->containsBreakInstruction())
-                               {
-                                       enableBreak = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
-                               }
+               Int clipFlags;
 
-                               if(shader && shader->containsContinueInstruction())
-                               {
-                                       enableContinue = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
-                               }
-                       }
-
-                       Pointer<Byte> data;
-                       Pointer<Byte> constants;
-
-                       Int clipFlags;
-
-                       RegisterArray<16> v;
-                       RegisterArray<4096> r;
-                       RegisterArray<12> o;
-                       Vector4f a0;
-                       Array<Int, 4> aL;
-                       Vector4f p0;
-
-                       Array<Int, 4> increment;
-                       Array<Int, 4> iteration;
-
-                       Int loopDepth;
-                       Int stackIndex;   // FIXME: Inc/decrement callStack
-                       Array<UInt, 16> callStack;
-
-                       Int enableIndex;
-                       Array<Int4, 1 + 24> enableStack;
-                       Int4 enableBreak;
-                       Int4 enableContinue;
-                       Int4 enableLeave;
-
-                       Int instanceID;
-               };
-
-               Registers r;
+               RegisterArray<MAX_VERTEX_INPUTS> v;    // Input registers
+               RegisterArray<MAX_VERTEX_OUTPUTS> o;   // Output registers
 
                const VertexProcessor::State &state;
-               const VertexShader *const shader;
 
        private:
-               virtual void pipeline() = 0;
+               virtual void pipeline(UInt &index) = 0;
 
                typedef VertexProcessor::State::Input Stream;
 
@@ -106,6 +64,7 @@ namespace sw
                void postTransform();
                void writeCache(Pointer<Byte> &cacheLine);
                void writeVertex(const Pointer<Byte> &vertex, Pointer<Byte> &cacheLine);
+               void transformFeedback(const Pointer<Byte> &vertex, const UInt &primitiveNumber, const UInt &indexInPrimitive);
        };
 }