Commit 0f25090e by Nicolas Capens

Fix vertex attribute count constant.

Change-Id: Ic0e4831bf3459d54b51e63ebe50b7394fb54e14c Reviewed-on: https://swiftshader-review.googlesource.com/3562Reviewed-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 42c00882
...@@ -69,6 +69,7 @@ enum ...@@ -69,6 +69,7 @@ enum
OUTLINE_RESOLUTION = 4096, // Maximum vertical resolution of the render target OUTLINE_RESOLUTION = 4096, // Maximum vertical resolution of the render target
MIPMAP_LEVELS = 14, MIPMAP_LEVELS = 14,
MAX_COLOR_ATTACHMENTS = 8, MAX_COLOR_ATTACHMENTS = 8,
VERTEX_ATTRIBUTES = 16,
TEXTURE_IMAGE_UNITS = 16, TEXTURE_IMAGE_UNITS = 16,
VERTEX_TEXTURE_IMAGE_UNITS = 16, VERTEX_TEXTURE_IMAGE_UNITS = 16,
TOTAL_IMAGE_UNITS = TEXTURE_IMAGE_UNITS + VERTEX_TEXTURE_IMAGE_UNITS, TOTAL_IMAGE_UNITS = TEXTURE_IMAGE_UNITS + VERTEX_TEXTURE_IMAGE_UNITS,
......
...@@ -60,7 +60,7 @@ class IndexDataManager; ...@@ -60,7 +60,7 @@ class IndexDataManager;
enum enum
{ {
MAX_VERTEX_ATTRIBS = 16, MAX_VERTEX_ATTRIBS = VERTEX_ATTRIBUTES,
MAX_VARYING_VECTORS = 10, MAX_VARYING_VECTORS = 10,
MAX_TEXTURE_UNITS = 2, MAX_TEXTURE_UNITS = 2,
MAX_DRAW_BUFFERS = 1, MAX_DRAW_BUFFERS = 1,
......
...@@ -71,7 +71,7 @@ class VertexArray; ...@@ -71,7 +71,7 @@ class VertexArray;
enum enum
{ {
MAX_VERTEX_ATTRIBS = 16, MAX_VERTEX_ATTRIBS = VERTEX_ATTRIBUTES,
MAX_UNIFORM_VECTORS = 256, // Device limit MAX_UNIFORM_VECTORS = 256, // Device limit
MAX_VERTEX_UNIFORM_VECTORS = VERTEX_UNIFORM_VECTORS - 3, // Reserve space for gl_DepthRange MAX_VERTEX_UNIFORM_VECTORS = VERTEX_UNIFORM_VECTORS - 3, // Reserve space for gl_DepthRange
MAX_VARYING_VECTORS = 10, MAX_VARYING_VECTORS = 10,
......
...@@ -201,7 +201,7 @@ namespace sw ...@@ -201,7 +201,7 @@ namespace sw
} }
// Set vertex streams to null stream // Set vertex streams to null stream
for(int i = 0; i < TEXTURE_IMAGE_UNITS; i++) for(int i = 0; i < VERTEX_ATTRIBUTES; i++)
{ {
input[i].defaults(); input[i].defaults();
} }
......
...@@ -404,7 +404,7 @@ namespace sw ...@@ -404,7 +404,7 @@ namespace sw
bool colorUsed(); bool colorUsed();
Resource *texture[TOTAL_IMAGE_UNITS]; Resource *texture[TOTAL_IMAGE_UNITS];
Stream input[TEXTURE_IMAGE_UNITS]; Stream input[VERTEX_ATTRIBUTES];
Resource *indexBuffer; Resource *indexBuffer;
bool preTransformed; // FIXME: Private bool preTransformed; // FIXME: Private
......
...@@ -322,7 +322,7 @@ namespace sw ...@@ -322,7 +322,7 @@ namespace sw
draw->setupPrimitives = setupPrimitives; draw->setupPrimitives = setupPrimitives;
draw->setupState = setupState; draw->setupState = setupState;
for(int i = 0; i < 16; i++) for(int i = 0; i < VERTEX_ATTRIBUTES; i++)
{ {
draw->vertexStream[i] = context->input[i].resource; draw->vertexStream[i] = context->input[i].resource;
data->input[i] = context->input[i].buffer; data->input[i] = context->input[i].buffer;
...@@ -926,7 +926,7 @@ namespace sw ...@@ -926,7 +926,7 @@ namespace sw
} }
} }
for(int i = 0; i < TEXTURE_IMAGE_UNITS; i++) for(int i = 0; i < VERTEX_ATTRIBUTES; i++)
{ {
if(draw.vertexStream[i]) if(draw.vertexStream[i])
{ {
......
...@@ -100,8 +100,8 @@ namespace sw ...@@ -100,8 +100,8 @@ namespace sw
{ {
const void *constants; const void *constants;
const void *input[TEXTURE_IMAGE_UNITS]; const void *input[VERTEX_ATTRIBUTES];
unsigned int stride[TEXTURE_IMAGE_UNITS]; unsigned int stride[VERTEX_ATTRIBUTES];
Texture mipmap[TOTAL_IMAGE_UNITS]; Texture mipmap[TOTAL_IMAGE_UNITS];
const void *indices; const void *indices;
...@@ -200,7 +200,7 @@ namespace sw ...@@ -200,7 +200,7 @@ namespace sw
int (*setupPrimitives)(Renderer *renderer, int batch, int count); int (*setupPrimitives)(Renderer *renderer, int batch, int count);
SetupProcessor::State setupState; SetupProcessor::State setupState;
Resource *vertexStream[TEXTURE_IMAGE_UNITS]; Resource *vertexStream[VERTEX_ATTRIBUTES];
Resource *indexBuffer; Resource *indexBuffer;
Surface *renderTarget[4]; Surface *renderTarget[4];
Surface *depthStencil; Surface *depthStencil;
......
...@@ -116,7 +116,7 @@ namespace sw ...@@ -116,7 +116,7 @@ namespace sw
void VertexProcessor::resetInputStreams(bool preTransformed) void VertexProcessor::resetInputStreams(bool preTransformed)
{ {
for(int i = 0; i < TEXTURE_IMAGE_UNITS; i++) for(int i = 0; i < VERTEX_ATTRIBUTES; i++)
{ {
context->input[i].defaults(); context->input[i].defaults();
} }
...@@ -806,7 +806,7 @@ namespace sw ...@@ -806,7 +806,7 @@ namespace sw
state.superSampling = context->getSuperSampleCount() > 1; state.superSampling = context->getSuperSampleCount() > 1;
state.multiSampling = context->getMultiSampleCount() > 1; state.multiSampling = context->getMultiSampleCount() > 1;
for(int i = 0; i < TEXTURE_IMAGE_UNITS; i++) for(int i = 0; i < VERTEX_ATTRIBUTES; i++)
{ {
state.input[i].type = context->input[i].type; state.input[i].type = context->input[i].type;
state.input[i].count = context->input[i].count; state.input[i].count = context->input[i].count;
......
...@@ -126,7 +126,7 @@ namespace sw ...@@ -126,7 +126,7 @@ namespace sw
}; };
}; };
Input input[TEXTURE_IMAGE_UNITS]; Input input[VERTEX_ATTRIBUTES];
Output output[12]; Output output[12];
}; };
......
...@@ -99,7 +99,7 @@ namespace sw ...@@ -99,7 +99,7 @@ namespace sw
void VertexRoutine::readInput(Registers &r, UInt &index) void VertexRoutine::readInput(Registers &r, UInt &index)
{ {
for(int i = 0; i < TEXTURE_IMAGE_UNITS; i++) 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); UInt stride = *Pointer<UInt>(r.data + OFFSET(DrawData,stride) + sizeof(unsigned int) * i);
......
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