1 // SwiftShader Software Renderer
3 // Copyright(c) 2005-2013 TransGaming Inc.
5 // All rights reserved. No part of this software may be copied, distributed, transmitted,
6 // transcribed, stored in a retrieval system, translated into any human or computer
7 // language by any means, or disclosed to third parties without the explicit written
8 // agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
9 // or implied, including but not limited to any patent rights, are granted to you.
12 #ifndef sw_VertexRoutine_hpp
13 #define sw_VertexRoutine_hpp
15 #include "Renderer/Color.hpp"
16 #include "Renderer/VertexProcessor.hpp"
17 #include "ShaderCore.hpp"
18 #include "VertexShader.hpp"
22 class VertexRoutinePrototype : public Function<Void(Pointer<Byte>, Pointer<Byte>, Pointer<Byte>, Pointer<Byte>)>
25 VertexRoutinePrototype() : vertex(Arg<0>()), batch(Arg<1>()), task(Arg<2>()), data(Arg<3>()) {}
26 virtual ~VertexRoutinePrototype() {};
29 const Pointer<Byte> vertex;
30 const Pointer<Byte> batch;
31 const Pointer<Byte> task;
32 const Pointer<Byte> data;
35 class VertexRoutine : public VertexRoutinePrototype
38 VertexRoutine(const VertexProcessor::State &state, const VertexShader *shader);
39 virtual ~VertexRoutine();
44 Pointer<Byte> constants;
48 RegisterArray<16> v; // Varying registers
49 RegisterArray<12> o; // Output registers
51 const VertexProcessor::State &state;
54 virtual void pipeline() = 0;
56 typedef VertexProcessor::State::Input Stream;
58 Vector4f readStream(Pointer<Byte> &buffer, UInt &stride, const Stream &stream, const UInt &index);
59 void readInput(UInt &index);
60 void computeClipFlags();
62 void writeCache(Pointer<Byte> &cacheLine);
63 void writeVertex(const Pointer<Byte> &vertex, Pointer<Byte> &cacheLine);
67 #endif // sw_VertexRoutine_hpp