Commit ec0936c4 by Nicolas Capens

Make the number of vertex outputs configurable.

Change-Id: I17ae53e5274232e9e3b482daac56d507788e822c Reviewed-on: https://swiftshader-review.googlesource.com/5383Reviewed-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 2543bd73
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
#ifndef D3D9_Capabilities_hpp #ifndef D3D9_Capabilities_hpp
#define D3D9_Capabilities_hpp #define D3D9_Capabilities_hpp
#include "Config.hpp"
#include "MetaMacro.hpp"
#include <d3d9.h> #include <d3d9.h>
namespace D3D9 namespace D3D9
...@@ -465,6 +468,23 @@ namespace D3D9 ...@@ -465,6 +468,23 @@ namespace D3D9
extern unsigned int textureMemory; extern unsigned int textureMemory;
extern unsigned int maxAnisotropy; extern unsigned int maxAnisotropy;
enum
{
MAX_VERTEX_SHADER_CONST = 256,
MAX_PIXEL_SHADER_CONST = 224,
MAX_VERTEX_OUTPUTS = 12,
};
// Shader Model 3.0 requirements
META_ASSERT(MAX_VERTEX_SHADER_CONST >= 256);
META_ASSERT(MAX_PIXEL_SHADER_CONST == 224);
META_ASSERT(MAX_VERTEX_OUTPUTS == 12);
// Back-end minimum requirements
META_ASSERT(sw::VERTEX_UNIFORM_VECTORS >= MAX_VERTEX_SHADER_CONST);
META_ASSERT(sw::FRAGMENT_UNIFORM_VECTORS >= MAX_PIXEL_SHADER_CONST);
META_ASSERT(sw::MAX_VERTEX_OUTPUTS >= MAX_VERTEX_OUTPUTS);
} }
#endif // D3D9_Capabilities_hpp #endif // D3D9_Capabilities_hpp
...@@ -5800,7 +5800,7 @@ namespace D3D9 ...@@ -5800,7 +5800,7 @@ namespace D3D9
} }
else // Bind directly to the output else // Bind directly to the output
{ {
for(int i = 0; i < 12; i++) for(int i = 0; i < MAX_VERTEX_OUTPUTS; i++)
{ {
if((usage == shader->output[i][0].usage || (usage == D3DDECLUSAGE_POSITIONT && shader->output[i][0].usage == D3DDECLUSAGE_POSITION)) && if((usage == shader->output[i][0].usage || (usage == D3DDECLUSAGE_POSITIONT && shader->output[i][0].usage == D3DDECLUSAGE_POSITION)) &&
index == shader->output[i][0].index) index == shader->output[i][0].index)
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "Direct3D9.hpp" #include "Direct3D9.hpp"
#include "Direct3DSwapChain9.hpp" #include "Direct3DSwapChain9.hpp"
#include "Capabilities.hpp"
#include "Stream.hpp" #include "Stream.hpp"
...@@ -45,12 +46,6 @@ namespace D3D9 ...@@ -45,12 +46,6 @@ namespace D3D9
class Direct3DIndexBuffer9; class Direct3DIndexBuffer9;
class CriticalSection; class CriticalSection;
enum
{
MAX_VERTEX_SHADER_CONST = MIN(256, sw::VERTEX_UNIFORM_VECTORS),
MAX_PIXEL_SHADER_CONST = MIN(224, sw::FRAGMENT_UNIFORM_VECTORS),
};
class Direct3DDevice9 : public IDirect3DDevice9, public Unknown class Direct3DDevice9 : public IDirect3DDevice9, public Unknown
{ {
friend CriticalSection; friend CriticalSection;
......
...@@ -87,6 +87,7 @@ namespace sw ...@@ -87,6 +87,7 @@ namespace sw
TOTAL_IMAGE_UNITS = TEXTURE_IMAGE_UNITS + VERTEX_TEXTURE_IMAGE_UNITS, TOTAL_IMAGE_UNITS = TEXTURE_IMAGE_UNITS + VERTEX_TEXTURE_IMAGE_UNITS,
FRAGMENT_UNIFORM_VECTORS = 224, FRAGMENT_UNIFORM_VECTORS = 224,
VERTEX_UNIFORM_VECTORS = 256, VERTEX_UNIFORM_VECTORS = 256,
MAX_VERTEX_OUTPUTS = 12,
MAX_FRAGMENT_UNIFORM_BLOCKS = 12, MAX_FRAGMENT_UNIFORM_BLOCKS = 12,
MAX_VERTEX_UNIFORM_BLOCKS = 12, MAX_VERTEX_UNIFORM_BLOCKS = 12,
MAX_UNIFORM_BUFFER_BINDINGS = MAX_FRAGMENT_UNIFORM_BLOCKS + MAX_VERTEX_UNIFORM_BLOCKS, // Limited to 127 by SourceParameter.bufferIndex in Shader.hpp MAX_UNIFORM_BUFFER_BINDINGS = MAX_FRAGMENT_UNIFORM_BLOCKS + MAX_VERTEX_UNIFORM_BLOCKS, // Limited to 127 by SourceParameter.bufferIndex in Shader.hpp
......
...@@ -2787,7 +2787,7 @@ namespace glsl ...@@ -2787,7 +2787,7 @@ namespace glsl
} }
else if(vertexShader) else if(vertexShader)
{ {
if((var + registerCount) > sw::VertexShader::MAX_OUTPUT_VARYINGS) if((var + registerCount) > sw::MAX_VERTEX_OUTPUTS)
{ {
mContext.error(varying->getLine(), "Varyings packing failed: Too many varyings", "vertex shader"); mContext.error(varying->getLine(), "Varyings packing failed: Too many varyings", "vertex shader");
return 0; return 0;
......
...@@ -400,7 +400,7 @@ namespace sw ...@@ -400,7 +400,7 @@ namespace sw
draw->pUniformBuffers[i] = nullptr; draw->pUniformBuffers[i] = nullptr;
} }
} }
if(context->pixelShaderVersion() <= 0x0104) if(context->pixelShaderVersion() <= 0x0104)
{ {
for(int stage = 0; stage < 8; stage++) for(int stage = 0; stage < 8; stage++)
...@@ -736,7 +736,7 @@ namespace sw ...@@ -736,7 +736,7 @@ namespace sw
} }
} }
} }
// Find primitive tasks // Find primitive tasks
if(currentDraw == nextDraw) if(currentDraw == nextDraw)
{ {
...@@ -837,7 +837,7 @@ namespace sw ...@@ -837,7 +837,7 @@ namespace sw
case Task::PRIMITIVES: case Task::PRIMITIVES:
{ {
int unit = task[threadIndex].primitiveUnit; int unit = task[threadIndex].primitiveUnit;
int input = primitiveProgress[unit].firstPrimitive; int input = primitiveProgress[unit].firstPrimitive;
int count = primitiveProgress[unit].primitiveCount; int count = primitiveProgress[unit].primitiveCount;
DrawCall *draw = drawList[primitiveProgress[unit].drawCall % DRAW_COUNT]; DrawCall *draw = drawList[primitiveProgress[unit].drawCall % DRAW_COUNT];
...@@ -1571,7 +1571,7 @@ namespace sw ...@@ -1571,7 +1571,7 @@ namespace sw
return visible; return visible;
} }
int Renderer::setupVertexTriangle(Renderer *renderer, int unit, int count) int Renderer::setupVertexTriangle(Renderer *renderer, int unit, int count)
{ {
Triangle *triangle = renderer->triangleBatch[unit]; Triangle *triangle = renderer->triangleBatch[unit];
...@@ -1878,7 +1878,7 @@ namespace sw ...@@ -1878,7 +1878,7 @@ namespace sw
int pts = state.pointSizeRegister; int pts = state.pointSizeRegister;
if(state.pointSizeRegister != 0xF) if(state.pointSizeRegister != Unused)
{ {
pSize = v.v[pts].y; pSize = v.v[pts].y;
} }
...@@ -1937,7 +1937,7 @@ namespace sw ...@@ -1937,7 +1937,7 @@ namespace sw
return false; return false;
} }
} }
return setupRoutine(&primitive, &triangle, &polygon, &data); return setupRoutine(&primitive, &triangle, &polygon, &data);
} }
...@@ -2002,7 +2002,7 @@ namespace sw ...@@ -2002,7 +2002,7 @@ namespace sw
exitThreads = true; exitThreads = true;
resume[thread]->signal(); resume[thread]->signal();
worker[thread]->join(); worker[thread]->join();
delete worker[thread]; delete worker[thread];
worker[thread] = 0; worker[thread] = 0;
delete resume[thread]; delete resume[thread];
...@@ -2010,7 +2010,7 @@ namespace sw ...@@ -2010,7 +2010,7 @@ namespace sw
delete suspend[thread]; delete suspend[thread];
suspend[thread] = 0; suspend[thread] = 0;
} }
deallocate(vertexTask[thread]); deallocate(vertexTask[thread]);
vertexTask[thread] = 0; vertexTask[thread] = 0;
} }
...@@ -2137,7 +2137,7 @@ namespace sw ...@@ -2137,7 +2137,7 @@ namespace sw
return true; return true;
} }
} }
if(context->depthBuffer && context->texture[sampler] == context->depthBuffer->getResource()) if(context->depthBuffer && context->texture[sampler] == context->depthBuffer->getResource())
{ {
return true; return true;
...@@ -2145,7 +2145,7 @@ namespace sw ...@@ -2145,7 +2145,7 @@ namespace sw
return false; return false;
} }
void Renderer::updateClipper() void Renderer::updateClipper()
{ {
if(updateClipPlanes) if(updateClipPlanes)
...@@ -2185,7 +2185,7 @@ namespace sw ...@@ -2185,7 +2185,7 @@ namespace sw
void Renderer::setTextureLevel(unsigned int sampler, unsigned int face, unsigned int level, Surface *surface, TextureType type) void Renderer::setTextureLevel(unsigned int sampler, unsigned int face, unsigned int level, Surface *surface, TextureType type)
{ {
ASSERT(sampler < TOTAL_IMAGE_UNITS && face < 6 && level < MIPMAP_LEVELS); ASSERT(sampler < TOTAL_IMAGE_UNITS && face < 6 && level < MIPMAP_LEVELS);
context->sampler[sampler].setTextureLevel(face, level, surface, type); context->sampler[sampler].setTextureLevel(face, level, surface, type);
} }
...@@ -2530,7 +2530,7 @@ namespace sw ...@@ -2530,7 +2530,7 @@ namespace sw
{ {
queries.push_back(query); queries.push_back(query);
} }
void Renderer::removeQuery(Query *query) void Renderer::removeQuery(Query *query)
{ {
queries.remove(query); queries.remove(query);
...@@ -2541,7 +2541,7 @@ namespace sw ...@@ -2541,7 +2541,7 @@ namespace sw
{ {
return threadCount; return threadCount;
} }
int64_t Renderer::getVertexTime(int thread) int64_t Renderer::getVertexTime(int thread)
{ {
return vertexTime[thread]; return vertexTime[thread];
...@@ -2551,7 +2551,7 @@ namespace sw ...@@ -2551,7 +2551,7 @@ namespace sw
{ {
return setupTime[thread]; return setupTime[thread];
} }
int64_t Renderer::getPixelTime(int thread) int64_t Renderer::getPixelTime(int thread)
{ {
return pixelTime[thread]; return pixelTime[thread];
......
...@@ -89,7 +89,7 @@ namespace sw ...@@ -89,7 +89,7 @@ namespace sw
state.vFace = context->pixelShader && context->pixelShader->vFaceDeclared; state.vFace = context->pixelShader && context->pixelShader->vFaceDeclared;
state.positionRegister = Pos; state.positionRegister = Pos;
state.pointSizeRegister = 0xF; // No vertex point size state.pointSizeRegister = Unused;
state.multiSample = context->getMultiSampleCount(); state.multiSample = context->getMultiSampleCount();
state.rasterizerDiscard = context->rasterizerDiscard; state.rasterizerDiscard = context->rasterizerDiscard;
...@@ -133,7 +133,7 @@ namespace sw ...@@ -133,7 +133,7 @@ namespace sw
if(context->pixelShader->semantic[interpolant][component - project].active()) if(context->pixelShader->semantic[interpolant][component - project].active())
{ {
int input = interpolant; int input = interpolant;
for(int i = 0; i < 12; i++) for(int i = 0; i < MAX_VERTEX_OUTPUTS; i++)
{ {
if(context->pixelShader->semantic[interpolant][component - project] == context->vertexShader->output[i][component - project]) if(context->pixelShader->semantic[interpolant][component - project] == context->vertexShader->output[i][component - project])
{ {
......
...@@ -45,8 +45,8 @@ namespace sw ...@@ -45,8 +45,8 @@ namespace sw
bool interpolateW : 1; bool interpolateW : 1;
bool perspective : 1; bool perspective : 1;
bool pointSprite : 1; bool pointSprite : 1;
unsigned int positionRegister : 4; unsigned int positionRegister : BITS(VERTEX_OUTPUT_LAST);
unsigned int pointSizeRegister : 4; unsigned int pointSizeRegister : BITS(VERTEX_OUTPUT_LAST);
CullMode cullMode : BITS(CULL_LAST); CullMode cullMode : BITS(CULL_LAST);
bool twoSidedStencil : 1; bool twoSidedStencil : 1;
bool slopeDepthBias : 1; bool slopeDepthBias : 1;
...@@ -56,7 +56,7 @@ namespace sw ...@@ -56,7 +56,7 @@ namespace sw
struct Gradient struct Gradient
{ {
unsigned char attribute : BITS(Unused); unsigned char attribute : BITS(VERTEX_OUTPUT_LAST);
bool flat : 1; bool flat : 1;
bool wrap : 1; bool wrap : 1;
}; };
......
...@@ -18,11 +18,13 @@ ...@@ -18,11 +18,13 @@
#include "Color.hpp" #include "Color.hpp"
#include "Common/MetaMacro.hpp" #include "Common/MetaMacro.hpp"
#include "Common/Types.hpp" #include "Common/Types.hpp"
#include "Main/Config.hpp"
namespace sw namespace sw
{ {
enum Out // Default vertex output semantic enum Out
{ {
// Default vertex output semantics
Pos = 0, Pos = 0,
C0 = 1, // Diffuse C0 = 1, // Diffuse
C1 = 2, // Specular C1 = 2, // Specular
...@@ -36,7 +38,13 @@ namespace sw ...@@ -36,7 +38,13 @@ namespace sw
T7 = 10, T7 = 10,
Fog = 11, // x component Fog = 11, // x component
Pts = Fog, // y component Pts = Fog, // y component
Unused
// Variable semantics
V0 = 0,
Vn_1 = MAX_VERTEX_OUTPUTS - 1,
Unused,
VERTEX_OUTPUT_LAST = Unused,
}; };
struct UVWQ struct UVWQ
...@@ -72,7 +80,7 @@ namespace sw ...@@ -72,7 +80,7 @@ namespace sw
float pSize; // Point size float pSize; // Point size
}; };
float4 v[12]; // Generic components using semantic declaration float4 v[MAX_VERTEX_OUTPUTS]; // Generic components using semantic declaration
}; };
// Projected coordinates // Projected coordinates
......
...@@ -942,7 +942,7 @@ namespace sw ...@@ -942,7 +942,7 @@ namespace sw
if(context->vertexShader) // FIXME: Also when pre-transformed? if(context->vertexShader) // FIXME: Also when pre-transformed?
{ {
for(int i = 0; i < 12; i++) for(int i = 0; i < MAX_VERTEX_OUTPUTS; i++)
{ {
state.output[i].xWrite = context->vertexShader->output[i][0].active(); state.output[i].xWrite = context->vertexShader->output[i][0].active();
state.output[i].yWrite = context->vertexShader->output[i][1].active(); state.output[i].yWrite = context->vertexShader->output[i][1].active();
......
...@@ -52,8 +52,8 @@ namespace sw ...@@ -52,8 +52,8 @@ namespace sw
bool fixedFunction : 1; bool fixedFunction : 1;
bool textureSampling : 1; bool textureSampling : 1;
unsigned int positionRegister : 4; unsigned int positionRegister : BITS(MAX_VERTEX_OUTPUTS);
unsigned int pointSizeRegister : 4; // 0xF signifies no vertex point size unsigned int pointSizeRegister : BITS(MAX_VERTEX_OUTPUTS);
unsigned int vertexBlendMatrixCount : 3; unsigned int vertexBlendMatrixCount : 3;
bool indexedVertexBlendEnable : 1; bool indexedVertexBlendEnable : 1;
...@@ -134,7 +134,7 @@ namespace sw ...@@ -134,7 +134,7 @@ namespace sw
}; };
Input input[VERTEX_ATTRIBUTES]; Input input[VERTEX_ATTRIBUTES];
Output output[12]; Output output[MAX_VERTEX_OUTPUTS];
}; };
struct State : States struct State : States
......
...@@ -144,7 +144,7 @@ namespace sw ...@@ -144,7 +144,7 @@ namespace sw
If(m != 0 || Bool(!solidTriangle)) // Clipped triangle; reproject If(m != 0 || Bool(!solidTriangle)) // Clipped triangle; reproject
{ {
Pointer<Byte> V = polygon + OFFSET(Polygon,P) + m * sizeof(void*) * 16; Pointer<Byte> V = polygon + OFFSET(Polygon,P) + m * sizeof(void*) * 16;
Int i = 0; Int i = 0;
Do Do
...@@ -166,9 +166,9 @@ namespace sw ...@@ -166,9 +166,9 @@ namespace sw
// Vertical range // Vertical range
Int yMin = Y[0]; Int yMin = Y[0];
Int yMax = Y[0]; Int yMax = Y[0];
Int i = 1; Int i = 1;
Do Do
{ {
yMin = Min(Y[i], yMin); yMin = Min(Y[i], yMin);
...@@ -196,7 +196,7 @@ namespace sw ...@@ -196,7 +196,7 @@ namespace sw
yMin = Max(yMin, *Pointer<Int>(data + OFFSET(DrawData,scissorY0))); yMin = Max(yMin, *Pointer<Int>(data + OFFSET(DrawData,scissorY0)));
yMax = Min(yMax, *Pointer<Int>(data + OFFSET(DrawData,scissorY1))); yMax = Min(yMax, *Pointer<Int>(data + OFFSET(DrawData,scissorY1)));
For(Int q = 0, q < state.multiSample, q++) For(Int q = 0, q < state.multiSample, q++)
{ {
Array<Int> Xq(16); Array<Int> Xq(16);
...@@ -510,7 +510,7 @@ namespace sw ...@@ -510,7 +510,7 @@ namespace sw
if(component == 1) i.z = 1.0f; if(component == 1) i.z = 1.0f;
if(component == 2) i.z = 0.0f; if(component == 2) i.z = 0.0f;
if(component == 3) i.z = 1.0f; if(component == 3) i.z = 1.0f;
i.w = 0; i.w = 0;
} }
...@@ -597,7 +597,7 @@ namespace sw ...@@ -597,7 +597,7 @@ namespace sw
Int ceil = -d >> 31; // Ceiling division: remainder <= 0 Int ceil = -d >> 31; // Ceiling division: remainder <= 0
x -= ceil; x -= ceil;
d -= ceil & FDY12; d -= ceil & FDY12;
Int Q = FDX12 / FDY12; // Edge-step Int Q = FDX12 / FDY12; // Edge-step
Int R = FDX12 % FDY12; // Error-step Int R = FDX12 % FDY12; // Error-step
Int floor = R >> 31; // Flooring division: remainder >= 0 Int floor = R >> 31; // Flooring division: remainder >= 0
...@@ -615,7 +615,7 @@ namespace sw ...@@ -615,7 +615,7 @@ namespace sw
d += R; d += R;
Int overflow = -d >> 31; Int overflow = -d >> 31;
d -= D & overflow; d -= D & overflow;
x -= overflow; x -= overflow;
...@@ -632,7 +632,7 @@ namespace sw ...@@ -632,7 +632,7 @@ namespace sw
If(condition) If(condition)
{ {
Pointer<Byte> vX; Pointer<Byte> vX;
vX = v0; vX = v0;
v0 = v1; v0 = v1;
v1 = v2; v1 = v2;
...@@ -652,7 +652,7 @@ namespace sw ...@@ -652,7 +652,7 @@ namespace sw
If(condition) If(condition)
{ {
Pointer<Byte> vX; Pointer<Byte> vX;
vX = v2; vX = v2;
v2 = v1; v2 = v1;
v1 = v0; v1 = v0;
......
...@@ -119,7 +119,7 @@ namespace sw ...@@ -119,7 +119,7 @@ namespace sw
predicate = false; predicate = false;
predicateNot = false; predicateNot = false;
predicateSwizzle = 0xE4; predicateSwizzle = 0xE4;
coissue = false; coissue = false;
samplerType = SAMPLER_UNKNOWN; samplerType = SAMPLER_UNKNOWN;
usage = USAGE_POSITION; usage = USAGE_POSITION;
...@@ -162,7 +162,7 @@ namespace sw ...@@ -162,7 +162,7 @@ namespace sw
token++; token++;
size--; size--;
} }
token++; token++;
size--; size--;
} }
...@@ -173,7 +173,7 @@ namespace sw ...@@ -173,7 +173,7 @@ namespace sw
predicateNot = (Modifier)((*token & 0x0F000000) >> 24) == MODIFIER_NOT; predicateNot = (Modifier)((*token & 0x0F000000) >> 24) == MODIFIER_NOT;
predicateSwizzle = (unsigned char)((*token & 0x00FF0000) >> 16); predicateSwizzle = (unsigned char)((*token & 0x00FF0000) >> 16);
token++; token++;
size--; size--;
} }
...@@ -201,11 +201,11 @@ namespace sw ...@@ -201,11 +201,11 @@ namespace sw
std::string Shader::Instruction::string(ShaderType shaderType, unsigned short version) const std::string Shader::Instruction::string(ShaderType shaderType, unsigned short version) const
{ {
std::string instructionString; std::string instructionString;
if(opcode != OPCODE_DCL) if(opcode != OPCODE_DCL)
{ {
instructionString += coissue ? "+ " : ""; instructionString += coissue ? "+ " : "";
if(predicate) if(predicate)
{ {
instructionString += predicateNot ? "(!p0" : "(p0"; instructionString += predicateNot ? "(!p0" : "(p0";
...@@ -219,7 +219,7 @@ namespace sw ...@@ -219,7 +219,7 @@ namespace sw
{ {
instructionString += " " + dst.string(shaderType, version) + instructionString += " " + dst.string(shaderType, version) +
dst.relativeString() + dst.relativeString() +
dst.maskString(); dst.maskString();
} }
for(int i = 0; i < 4; i++) for(int i = 0; i < 4; i++)
...@@ -229,8 +229,8 @@ namespace sw ...@@ -229,8 +229,8 @@ namespace sw
instructionString += (dst.type != PARAMETER_VOID || i > 0) ? ", " : " "; instructionString += (dst.type != PARAMETER_VOID || i > 0) ? ", " : " ";
instructionString += src[i].preModifierString() + instructionString += src[i].preModifierString() +
src[i].string(shaderType, version) + src[i].string(shaderType, version) +
src[i].relativeString() + src[i].relativeString() +
src[i].postModifierString() + src[i].postModifierString() +
src[i].swizzleString(); src[i].swizzleString();
} }
} }
...@@ -351,10 +351,10 @@ namespace sw ...@@ -351,10 +351,10 @@ namespace sw
{ {
case 0: return ""; case 0: return "";
case 1: return "_x2"; case 1: return "_x2";
case 2: return "_x4"; case 2: return "_x4";
case 3: return "_x8"; case 3: return "_x8";
case -1: return "_d2"; case -1: return "_d2";
case -2: return "_d4"; case -2: return "_d4";
case -3: return "_d8"; case -3: return "_d8";
default: default:
return ""; return "";
...@@ -630,7 +630,7 @@ namespace sw ...@@ -630,7 +630,7 @@ namespace sw
src[i].rel.type = PARAMETER_VOID; src[i].rel.type = PARAMETER_VOID;
src[i].rel.swizzle = 0x00; src[i].rel.swizzle = 0x00;
src[i].rel.scale = 1; src[i].rel.scale = 1;
switch(opcode) switch(opcode)
{ {
case OPCODE_DEF: case OPCODE_DEF:
...@@ -1018,7 +1018,7 @@ namespace sw ...@@ -1018,7 +1018,7 @@ namespace sw
else if(type != PARAMETER_RASTOUT && !(type == PARAMETER_ADDR && shaderType == SHADER_VERTEX) && type != PARAMETER_LOOP && type != PARAMETER_PREDICATE && type != PARAMETER_MISCTYPE) else if(type != PARAMETER_RASTOUT && !(type == PARAMETER_ADDR && shaderType == SHADER_VERTEX) && type != PARAMETER_LOOP && type != PARAMETER_PREDICATE && type != PARAMETER_MISCTYPE)
{ {
buffer << index; buffer << index;
return typeString(shaderType, version) + buffer.str(); return typeString(shaderType, version) + buffer.str();
} }
else else
...@@ -1079,7 +1079,7 @@ namespace sw ...@@ -1079,7 +1079,7 @@ namespace sw
{ {
return opcode == OPCODE_IF || opcode == OPCODE_IFC; return opcode == OPCODE_IF || opcode == OPCODE_IFC;
} }
bool Shader::Instruction::isCall() const bool Shader::Instruction::isCall() const
{ {
return opcode == OPCODE_CALL || opcode == OPCODE_CALLNZ; return opcode == OPCODE_CALL || opcode == OPCODE_CALLNZ;
...@@ -1160,7 +1160,7 @@ namespace sw ...@@ -1160,7 +1160,7 @@ namespace sw
token += 1 + tokenCount; token += 1 + tokenCount;
} }
} }
int Shader::size(unsigned long opcode) const int Shader::size(unsigned long opcode) const
{ {
return size(opcode, version); return size(opcode, version);
...@@ -1633,7 +1633,7 @@ namespace sw ...@@ -1633,7 +1633,7 @@ namespace sw
{ {
containsLeave = true; containsLeave = true;
} }
if(instruction[i]->isBreak()) if(instruction[i]->isBreak())
{ {
containsBreak = true; containsBreak = true;
......
...@@ -594,7 +594,7 @@ namespace sw ...@@ -594,7 +594,7 @@ namespace sw
{ {
if(shader) if(shader)
{ {
for(int i = 0; i < 12; i++) for(int i = 0; i < MAX_VERTEX_OUTPUTS; i++)
{ {
unsigned char usage = shader->output[i][0].usage; unsigned char usage = shader->output[i][0].usage;
...@@ -1263,7 +1263,7 @@ namespace sw ...@@ -1263,7 +1263,7 @@ namespace sw
loopRepDepth--; loopRepDepth--;
llvm::BasicBlock *endBlock = loopRepEndBlock[loopRepDepth]; llvm::BasicBlock *endBlock = loopRepEndBlock[loopRepDepth];
Nucleus::createBr(loopRepEndBlock[loopRepDepth]); Nucleus::createBr(loopRepEndBlock[loopRepDepth]);
Nucleus::setInsertBlock(endBlock); Nucleus::setInsertBlock(endBlock);
......
...@@ -580,7 +580,7 @@ namespace sw ...@@ -580,7 +580,7 @@ namespace sw
{ {
Vector4f v; Vector4f v;
for(int i = 0; i < 12; i++) for(int i = 0; i < MAX_VERTEX_OUTPUTS; i++)
{ {
if(state.output[i].write) if(state.output[i].write)
{ {
...@@ -669,7 +669,7 @@ namespace sw ...@@ -669,7 +669,7 @@ namespace sw
void VertexRoutine::writeVertex(const Pointer<Byte> &vertex, Pointer<Byte> &cache) void VertexRoutine::writeVertex(const Pointer<Byte> &vertex, Pointer<Byte> &cache)
{ {
for(int i = 0; i < 12; i++) for(int i = 0; i < MAX_VERTEX_OUTPUTS; i++)
{ {
if(state.output[i].write) if(state.output[i].write)
{ {
......
...@@ -49,7 +49,7 @@ namespace sw ...@@ -49,7 +49,7 @@ namespace sw
Int clipFlags; Int clipFlags;
RegisterArray<16> v; // Varying registers RegisterArray<16> v; // Varying registers
RegisterArray<12> o; // Output registers RegisterArray<MAX_VERTEX_OUTPUTS> o; // Output registers
const VertexProcessor::State &state; const VertexProcessor::State &state;
......
...@@ -25,7 +25,7 @@ namespace sw ...@@ -25,7 +25,7 @@ namespace sw
{ {
version = 0x0300; version = 0x0300;
positionRegister = Pos; positionRegister = Pos;
pointSizeRegister = -1; // No vertex point size pointSizeRegister = Unused;
instanceIdDeclared = false; instanceIdDeclared = false;
for(int i = 0; i < MAX_INPUT_ATTRIBUTES; i++) for(int i = 0; i < MAX_INPUT_ATTRIBUTES; i++)
...@@ -57,7 +57,7 @@ namespace sw ...@@ -57,7 +57,7 @@ namespace sw
parse(token); parse(token);
positionRegister = Pos; positionRegister = Pos;
pointSizeRegister = -1; // No vertex point size pointSizeRegister = Unused;
instanceIdDeclared = false; instanceIdDeclared = false;
for(int i = 0; i < MAX_INPUT_ATTRIBUTES; i++) for(int i = 0; i < MAX_INPUT_ATTRIBUTES; i++)
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#define sw_VertexShader_hpp #define sw_VertexShader_hpp
#include "Shader.hpp" #include "Shader.hpp"
#include "Main/Config.hpp"
namespace sw namespace sw
{ {
...@@ -40,8 +41,7 @@ namespace sw ...@@ -40,8 +41,7 @@ namespace sw
enum {MAX_INPUT_ATTRIBUTES = 16}; enum {MAX_INPUT_ATTRIBUTES = 16};
Semantic input[MAX_INPUT_ATTRIBUTES]; // FIXME: Private Semantic input[MAX_INPUT_ATTRIBUTES]; // FIXME: Private
enum {MAX_OUTPUT_VARYINGS = 12}; Semantic output[MAX_VERTEX_OUTPUTS][4]; // FIXME: Private
Semantic output[MAX_OUTPUT_VARYINGS][4]; // FIXME: Private
private: private:
void analyzeInput(); void analyzeInput();
......
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