Commit 2ca19030 by Nicolas Capens

Derive VertexRoutine from Function<>.

Bug 22652760 Change-Id: I48e9e1f3ff677429eff1aea2f80b1e384a537a14 Reviewed-on: https://swiftshader-review.googlesource.com/4557Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 060a2d3f
......@@ -968,7 +968,7 @@ namespace sw
}
generator->generate();
routine = generator->getRoutine();
routine = (*generator)(L"VertexRoutine_%0.8X", state.shaderID);
delete generator;
routineCache->add(state, routine);
......
......@@ -23,9 +23,8 @@ namespace sw
extern bool halfIntegerCoordinates; // Pixel centers are not at integer coordinates
extern bool symmetricNormalizedDepth; // [-1, 1] instead of [0, 1]
VertexRoutine::VertexRoutine(const VertexProcessor::State &state, const VertexShader *shader) : state(state), shader(shader)
VertexRoutine::VertexRoutine(const VertexProcessor::State &state, const VertexShader *shader) : r(shader), state(state), shader(shader)
{
routine = 0;
}
VertexRoutine::~VertexRoutine()
......@@ -34,12 +33,10 @@ namespace sw
void VertexRoutine::generate()
{
Function<Void(Pointer<Byte>, Pointer<Byte>, Pointer<Byte>, Pointer<Byte>)> function;
{
Pointer<Byte> vertex(function.Arg<0>());
Pointer<Byte> batch(function.Arg<1>());
Pointer<Byte> task(function.Arg<2>());
Pointer<Byte> data(function.Arg<3>());
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;
......@@ -49,7 +46,6 @@ namespace sw
UInt vertexCount = *Pointer<UInt>(task + OFFSET(VertexTask,vertexCount));
Registers r(shader);
r.data = data;
r.constants = *Pointer<Pointer<Byte> >(data + OFFSET(DrawData,constants));
if(shader && shader->instanceIdDeclared)
......@@ -89,14 +85,6 @@ namespace sw
Return();
}
routine = function(L"VertexRoutine_%0.8X", state.shaderID);
}
Routine *VertexRoutine::getRoutine()
{
return routine;
}
void VertexRoutine::readInput(Registers &r, UInt &index)
{
for(int i = 0; i < VERTEX_ATTRIBUTES; i++)
......
......@@ -19,7 +19,7 @@
namespace sw
{
class VertexRoutine
class VertexRoutine : public Function<Void(Pointer<Byte>, Pointer<Byte>, Pointer<Byte>, Pointer<Byte>)>
{
protected:
struct Registers
......@@ -71,13 +71,14 @@ namespace sw
Int instanceID;
};
Registers r;
public:
VertexRoutine(const VertexProcessor::State &state, const VertexShader *shader);
virtual ~VertexRoutine();
void generate();
Routine *getRoutine();
protected:
const VertexProcessor::State &state;
......@@ -94,8 +95,6 @@ namespace sw
void postTransform(Registers &r);
void writeCache(Pointer<Byte> &cacheLine, Registers &r);
void writeVertex(Pointer<Byte> &vertex, Pointer<Byte> &cacheLine);
Routine *routine;
};
}
......
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