Commit d2fad90b by Nicolas Capens

Move parameter reading to a prototype constructor.

Bug 22652760 Change-Id: I317275cd2c15012da3a859735409af07ea9b2923 Reviewed-on: https://swiftshader-review.googlesource.com/4559Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent b4fb3678
......@@ -33,11 +33,6 @@ namespace sw
void VertexRoutine::generate()
{
Pointer<Byte> vertex(Arg<0>());
Pointer<Byte> batch(Arg<1>());
Pointer<Byte> task(Arg<2>());
Pointer<Byte> data(Arg<3>());
const bool texldl = state.shaderContainsTexldl;
Pointer<Byte> cache = task + OFFSET(VertexTask,vertexCache);
......@@ -47,7 +42,7 @@ namespace sw
UInt vertexCount = *Pointer<UInt>(task + OFFSET(VertexTask,vertexCount));
r.data = data;
r.constants = *Pointer<Pointer<Byte> >(data + OFFSET(DrawData,constants));
r.constants = *Pointer<Pointer<Byte>>(data + OFFSET(DrawData,constants));
if(shader && shader->instanceIdDeclared)
{
r.instanceID = *Pointer<Int>(data + OFFSET(DrawData, instanceID));
......@@ -89,7 +84,7 @@ namespace sw
{
for(int i = 0; i < VERTEX_ATTRIBUTES; i++)
{
Pointer<Byte> input = *Pointer<Pointer<Byte> >(r.data + OFFSET(DrawData,input) + sizeof(void*) * i);
Pointer<Byte> input = *Pointer<Pointer<Byte>>(r.data + OFFSET(DrawData,input) + sizeof(void*) * i);
UInt stride = *Pointer<UInt>(r.data + OFFSET(DrawData,stride) + sizeof(unsigned int) * i);
r.v[i] = readStream(input, stride, state.input[i], index);
......@@ -573,7 +568,7 @@ namespace sw
*Pointer<Float4>(cacheLine + OFFSET(Vertex,X) + sizeof(Vertex) * 3, 16) = v.w;
}
void VertexRoutine::writeVertex(Pointer<Byte> &vertex, Pointer<Byte> &cache)
void VertexRoutine::writeVertex(const Pointer<Byte> &vertex, Pointer<Byte> &cache)
{
for(int i = 0; i < 12; i++)
{
......
......@@ -19,8 +19,27 @@
namespace sw
{
class VertexRoutine : public Function<Void(Pointer<Byte>, Pointer<Byte>, Pointer<Byte>, Pointer<Byte>)>
class VertexRoutinePrototype : public Function<Void(Pointer<Byte>, Pointer<Byte>, Pointer<Byte>, Pointer<Byte>)>
{
public:
VertexRoutinePrototype() : vertex(Arg<0>()), batch(Arg<1>()), task(Arg<2>()), data(Arg<3>()) {}
virtual ~VertexRoutinePrototype() {};
protected:
const Pointer<Byte> vertex;
const Pointer<Byte> batch;
const Pointer<Byte> task;
const Pointer<Byte> data;
};
class VertexRoutine : public VertexRoutinePrototype
{
public:
VertexRoutine(const VertexProcessor::State &state, const VertexShader *shader);
virtual ~VertexRoutine();
void generate();
protected:
struct Registers
{
......@@ -73,14 +92,6 @@ namespace sw
Registers r;
public:
VertexRoutine(const VertexProcessor::State &state, const VertexShader *shader);
virtual ~VertexRoutine();
void generate();
protected:
const VertexProcessor::State &state;
const VertexShader *const shader;
......@@ -94,7 +105,7 @@ namespace sw
void computeClipFlags();
void postTransform();
void writeCache(Pointer<Byte> &cacheLine);
void writeVertex(Pointer<Byte> &vertex, Pointer<Byte> &cacheLine);
void writeVertex(const Pointer<Byte> &vertex, Pointer<Byte> &cacheLine);
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment