1 // Copyright 2016 The SwiftShader Authors. All Rights Reserved.
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 #ifndef sw_VertexRoutine_hpp
16 #define sw_VertexRoutine_hpp
18 #include "Renderer/Color.hpp"
19 #include "Renderer/VertexProcessor.hpp"
20 #include "ShaderCore.hpp"
21 #include "VertexShader.hpp"
25 class VertexRoutinePrototype : public Function<Void(Pointer<Byte>, Pointer<Byte>, Pointer<Byte>, Pointer<Byte>)>
28 VertexRoutinePrototype() : vertex(Arg<0>()), batch(Arg<1>()), task(Arg<2>()), data(Arg<3>()) {}
29 virtual ~VertexRoutinePrototype() {};
32 const Pointer<Byte> vertex;
33 const Pointer<Byte> batch;
34 const Pointer<Byte> task;
35 const Pointer<Byte> data;
38 class VertexRoutine : public VertexRoutinePrototype
41 VertexRoutine(const VertexProcessor::State &state, const VertexShader *shader);
42 virtual ~VertexRoutine();
47 Pointer<Byte> constants;
51 RegisterArray<MAX_VERTEX_INPUTS> v; // Input registers
52 RegisterArray<MAX_VERTEX_OUTPUTS> o; // Output registers
54 const VertexProcessor::State &state;
57 virtual void pipeline() = 0;
59 typedef VertexProcessor::State::Input Stream;
61 Vector4f readStream(Pointer<Byte> &buffer, UInt &stride, const Stream &stream, const UInt &index);
62 void readInput(UInt &index);
63 void computeClipFlags();
65 void writeCache(Pointer<Byte> &cacheLine);
66 void writeVertex(const Pointer<Byte> &vertex, Pointer<Byte> &cacheLine);
70 #endif // sw_VertexRoutine_hpp