Rename version to shaderModel
In order to avoid creating confusion between shader model and
the actual shader's version, as specified by the #version
token in a glsl shader, version was renamed to shaderModel.
Change-Id: I481b6e3fc43168b504c2f2d9506422a697abc3a2
Reviewed-on: https://swiftshader-review.googlesource.com/14629
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Renderer/Context.cpp b/src/Renderer/Context.cpp
index c325de9..f9d72a9 100644
--- a/src/Renderer/Context.cpp
+++ b/src/Renderer/Context.cpp
@@ -484,7 +484,7 @@
{
if(!colorUsed()) return false;
- if(pixelShaderVersion() >= 0x0300) return false;
+ if(pixelShaderModel() >= 0x0300) return false;
return fogEnable;
}
@@ -616,7 +616,7 @@
bool Context::isProjectionComponent(unsigned int coordinate, int component)
{
- if(pixelShaderVersion() <= 0x0103 && coordinate < 8 && textureTransformProject[coordinate])
+ if(pixelShaderModel() <= 0x0103 && coordinate < 8 && textureTransformProject[coordinate])
{
if(textureTransformCount[coordinate] == 2)
{
@@ -1382,7 +1382,7 @@
return false;
}
- if(textureTransformProject[coordinate] && pixelShaderVersion() <= 0x0103)
+ if(textureTransformProject[coordinate] && pixelShaderModel() <= 0x0103)
{
if(textureTransformCount[coordinate] == 2)
{
@@ -1435,14 +1435,14 @@
return false;
}
- unsigned short Context::pixelShaderVersion() const
+ unsigned short Context::pixelShaderModel() const
{
- return pixelShader ? pixelShader->getVersion() : 0x0000;
+ return pixelShader ? pixelShader->getShaderModel() : 0x0000;
}
- unsigned short Context::vertexShaderVersion() const
+ unsigned short Context::vertexShaderModel() const
{
- return vertexShader ? vertexShader->getVersion() : 0x0000;
+ return vertexShader ? vertexShader->getShaderModel() : 0x0000;
}
int Context::getMultiSampleCount() const
diff --git a/src/Renderer/Context.hpp b/src/Renderer/Context.hpp
index 6116794..a41d03b 100644
--- a/src/Renderer/Context.hpp
+++ b/src/Renderer/Context.hpp
@@ -399,8 +399,8 @@
bool textureActive(int coordinate);
bool textureActive(int coordinate, int component);
- unsigned short pixelShaderVersion() const;
- unsigned short vertexShaderVersion() const;
+ unsigned short pixelShaderModel() const;
+ unsigned short vertexShaderModel() const;
int getMultiSampleCount() const;
int getSuperSampleCount() const;
diff --git a/src/Renderer/PixelProcessor.cpp b/src/Renderer/PixelProcessor.cpp
index 003cfb3..f76c387 100644
--- a/src/Renderer/PixelProcessor.cpp
+++ b/src/Renderer/PixelProcessor.cpp
@@ -1062,7 +1062,7 @@
const bool sprite = context->pointSpriteActive();
const bool flatShading = (context->shadingMode == SHADING_FLAT) || point;
- if(context->pixelShaderVersion() < 0x0300)
+ if(context->pixelShaderModel() < 0x0300)
{
for(int coordinate = 0; coordinate < 8; coordinate++)
{
@@ -1079,7 +1079,7 @@
}
}
- if(context->textureTransformProject[coordinate] && context->pixelShaderVersion() <= 0x0103)
+ if(context->textureTransformProject[coordinate] && context->pixelShaderModel() <= 0x0103)
{
if(context->textureTransformCount[coordinate] == 2)
{
@@ -1173,7 +1173,7 @@
if(!routine)
{
- const bool integerPipeline = (context->pixelShaderVersion() <= 0x0104);
+ const bool integerPipeline = (context->pixelShaderModel() <= 0x0104);
QuadRasterizer *generator = nullptr;
if(integerPipeline)
diff --git a/src/Renderer/Renderer.cpp b/src/Renderer/Renderer.cpp
index b09c414..fd0c340 100644
--- a/src/Renderer/Renderer.cpp
+++ b/src/Renderer/Renderer.cpp
@@ -401,7 +401,7 @@
}
}
- if(context->pixelShaderVersion() <= 0x0104)
+ if(context->pixelShaderModel() <= 0x0104)
{
for(int stage = 0; stage < 8; stage++)
{
@@ -415,7 +415,7 @@
if(context->vertexShader)
{
- if(context->vertexShader->getVersion() >= 0x0300)
+ if(context->vertexShader->getShaderModel() >= 0x0300)
{
for(int sampler = 0; sampler < VERTEX_TEXTURE_IMAGE_UNITS; sampler++)
{
diff --git a/src/Renderer/SetupProcessor.cpp b/src/Renderer/SetupProcessor.cpp
index 7588810..c5c2a16 100644
--- a/src/Renderer/SetupProcessor.cpp
+++ b/src/Renderer/SetupProcessor.cpp
@@ -183,7 +183,7 @@
}
}
}
- else if(context->pixelShaderVersion() < 0x0300)
+ else if(context->pixelShaderModel() < 0x0300)
{
for(int coordinate = 0; coordinate < 8; coordinate++)
{
diff --git a/src/Renderer/VertexProcessor.cpp b/src/Renderer/VertexProcessor.cpp
index 3d364ac..cc9bd25 100644
--- a/src/Renderer/VertexProcessor.cpp
+++ b/src/Renderer/VertexProcessor.cpp
@@ -925,7 +925,7 @@
state.shaderID = 0;
}
- state.fixedFunction = !context->vertexShader && context->pixelShaderVersion() < 0x0300;
+ state.fixedFunction = !context->vertexShader && context->pixelShaderModel() < 0x0300;
state.textureSampling = context->vertexShader ? context->vertexShader->containsTextureSampling() : false;
state.positionRegister = context->vertexShader ? context->vertexShader->getPositionRegister() : Pos;
state.pointSizeRegister = context->vertexShader ? context->vertexShader->getPointSizeRegister() : Pts;
@@ -1010,7 +1010,7 @@
state.output[i].wWrite = context->vertexShader->getOutput(i, 3).active();
}
}
- else if(!context->preTransformed || context->pixelShaderVersion() < 0x0300)
+ else if(!context->preTransformed || context->pixelShaderModel() < 0x0300)
{
state.output[Pos].write = 0xF;
@@ -1068,7 +1068,7 @@
}
}
- if(context->vertexShaderVersion() < 0x0300)
+ if(context->vertexShaderModel() < 0x0300)
{
state.output[C0].clamp = 0xF;
state.output[C1].clamp = 0xF;
diff --git a/src/Shader/PixelPipeline.cpp b/src/Shader/PixelPipeline.cpp
index f983b8f..5d4df97 100644
--- a/src/Shader/PixelPipeline.cpp
+++ b/src/Shader/PixelPipeline.cpp
@@ -88,7 +88,7 @@
const Src &src1 = instruction->src[1];
const Src &src2 = instruction->src[2];
- unsigned short version = shader->getVersion();
+ unsigned short shaderModel = shader->getShaderModel();
bool pairing = i + 1 < shader->getLength() && shader->getInstruction(i + 1)->coissue; // First instruction of pair
bool coissue = instruction->coissue; // Second instruction of pair
@@ -101,10 +101,10 @@
if(src1.type != Shader::PARAMETER_VOID) s1 = fetchRegister(src1);
if(src2.type != Shader::PARAMETER_VOID) s2 = fetchRegister(src2);
- Float4 x = version < 0x0104 ? v[2 + dst.index].x : v[2 + src0.index].x;
- Float4 y = version < 0x0104 ? v[2 + dst.index].y : v[2 + src0.index].y;
- Float4 z = version < 0x0104 ? v[2 + dst.index].z : v[2 + src0.index].z;
- Float4 w = version < 0x0104 ? v[2 + dst.index].w : v[2 + src0.index].w;
+ Float4 x = shaderModel < 0x0104 ? v[2 + dst.index].x : v[2 + src0.index].x;
+ Float4 y = shaderModel < 0x0104 ? v[2 + dst.index].y : v[2 + src0.index].y;
+ Float4 z = shaderModel < 0x0104 ? v[2 + dst.index].z : v[2 + src0.index].z;
+ Float4 w = shaderModel < 0x0104 ? v[2 + dst.index].w : v[2 + src0.index].w;
switch(opcode)
{
@@ -126,7 +126,7 @@
case Shader::OPCODE_DP4: DP4(d, s0, s1); break;
case Shader::OPCODE_LRP: LRP(d, s0, s1, s2); break;
case Shader::OPCODE_TEXCOORD:
- if(version < 0x0104)
+ if(shaderModel < 0x0104)
{
TEXCOORD(d, x, y, z, dst.index);
}
@@ -143,11 +143,11 @@
}
break;
case Shader::OPCODE_TEXKILL:
- if(version < 0x0104)
+ if(shaderModel < 0x0104)
{
TEXKILL(cMask, x, y, z);
}
- else if(version == 0x0104)
+ else if(shaderModel == 0x0104)
{
if(dst.type == Shader::PARAMETER_TEXTURE)
{
@@ -161,11 +161,11 @@
else ASSERT(false);
break;
case Shader::OPCODE_TEX:
- if(version < 0x0104)
+ if(shaderModel < 0x0104)
{
TEX(d, x, y, z, dst.index, false);
}
- else if(version == 0x0104)
+ else if(shaderModel == 0x0104)
{
if(src0.type == Shader::PARAMETER_TEXTURE)
{
diff --git a/src/Shader/PixelProgram.cpp b/src/Shader/PixelProgram.cpp
index 4c5c5643..b55bf34 100644
--- a/src/Shader/PixelProgram.cpp
+++ b/src/Shader/PixelProgram.cpp
@@ -27,7 +27,7 @@
void PixelProgram::setBuiltins(Int &x, Int &y, Float4(&z)[4], Float4 &w)
{
- if(shader->getVersion() >= 0x0300)
+ if(shader->getShaderModel() >= 0x0300)
{
if(shader->isVPosDeclared())
{
diff --git a/src/Shader/PixelRoutine.cpp b/src/Shader/PixelRoutine.cpp
index 7694bd2..c6341e0 100644
--- a/src/Shader/PixelRoutine.cpp
+++ b/src/Shader/PixelRoutine.cpp
@@ -31,7 +31,7 @@
PixelRoutine::PixelRoutine(const PixelProcessor::State &state, const PixelShader *shader) : QuadRasterizer(state, shader), v(shader && shader->dynamicallyIndexedInput)
{
- if(!shader || shader->getVersion() < 0x0200 || forceClearRegisters)
+ if(!shader || shader->getShaderModel() < 0x0200 || forceClearRegisters)
{
for(int i = 0; i < MAX_FRAGMENT_INPUTS; i++)
{
diff --git a/src/Shader/PixelShader.cpp b/src/Shader/PixelShader.cpp
index 26908bc..954fff3 100644
--- a/src/Shader/PixelShader.cpp
+++ b/src/Shader/PixelShader.cpp
@@ -22,7 +22,7 @@
{
PixelShader::PixelShader(const PixelShader *ps) : Shader()
{
- version = 0x0300;
+ shaderModel = 0x0300;
vPosDeclared = false;
vFaceDeclared = false;
centroid = false;
@@ -198,7 +198,7 @@
void PixelShader::analyzeInterpolants()
{
- if(version < 0x0300)
+ if(shaderModel < 0x0300)
{
// Set default mapping; disable unused interpolants below
input[0][0] = Semantic(Shader::USAGE_COLOR, 0);
@@ -288,7 +288,7 @@
case Shader::OPCODE_DCL:
break; // Ignore
default: // Arithmetic instruction
- if(version >= 0x0104)
+ if(shaderModel >= 0x0104)
{
ASSERT(false);
}
@@ -329,7 +329,7 @@
switch(samplerType[sampler])
{
case Shader::SAMPLER_UNKNOWN:
- if(version == 0x0104)
+ if(shaderModel == 0x0104)
{
if((inst->src[0].swizzle & 0x30) == 0x20) // .xyz
{
@@ -380,7 +380,7 @@
interpolant[index][3] = true;
}
- if(version == 0x0104 && inst->opcode == Shader::OPCODE_TEX)
+ if(shaderModel == 0x0104 && inst->opcode == Shader::OPCODE_TEX)
{
if(inst->src[0].modifier == Shader::MODIFIER_DZ)
{
@@ -717,7 +717,7 @@
}
}
- if(version >= 0x0200)
+ if(shaderModel >= 0x0200)
{
for(const auto &inst : instruction)
{
diff --git a/src/Shader/Shader.cpp b/src/Shader/Shader.cpp
index 34a10f0..f7ce731 100644
--- a/src/Shader/Shader.cpp
+++ b/src/Shader/Shader.cpp
@@ -1183,12 +1183,12 @@
int Shader::size(unsigned long opcode) const
{
- return size(opcode, version);
+ return size(opcode, shaderModel);
}
- int Shader::size(unsigned long opcode, unsigned short version)
+ int Shader::size(unsigned long opcode, unsigned short shaderModel)
{
- if(version > 0x0300)
+ if(shaderModel > 0x0300)
{
ASSERT(false);
}
@@ -1335,7 +1335,7 @@
opcode != OPCODE_PHASE &&
opcode != OPCODE_END)
{
- if(version >= 0x0200)
+ if(shaderModel >= 0x0200)
{
length = (opcode & 0x0F000000) >> 24;
}
@@ -1350,7 +1350,7 @@
ASSERT(false);
}
- if(version == 0x0104)
+ if(shaderModel == 0x0104)
{
switch(opcode & 0x0000FFFF)
{
@@ -1438,9 +1438,9 @@
return shaderType;
}
- unsigned short Shader::getVersion() const
+ unsigned short Shader::getShaderModel() const
{
- return version;
+ return shaderModel;
}
void Shader::print(const char *fileName, ...) const
@@ -1456,7 +1456,7 @@
for(const auto &inst : instruction)
{
- file << inst->string(shaderType, version) << std::endl;
+ file << inst->string(shaderType, shaderModel) << std::endl;
}
}
@@ -1464,7 +1464,7 @@
{
std::ofstream file(fileName, std::ofstream::out | std::ofstream::app);
- file << instruction[index]->string(shaderType, version) << std::endl;
+ file << instruction[index]->string(shaderType, shaderModel) << std::endl;
}
void Shader::append(Instruction *instruction)
diff --git a/src/Shader/Shader.hpp b/src/Shader/Shader.hpp
index 695f72e..6755cd4 100644
--- a/src/Shader/Shader.hpp
+++ b/src/Shader/Shader.hpp
@@ -560,14 +560,14 @@
int getSerialID() const;
size_t getLength() const;
ShaderType getShaderType() const;
- unsigned short getVersion() const;
+ unsigned short getShaderModel() const;
void append(Instruction *instruction);
void declareSampler(int i);
const Instruction *getInstruction(size_t i) const;
int size(unsigned long opcode) const;
- static int size(unsigned long opcode, unsigned short version);
+ static int size(unsigned long opcode, unsigned short shaderModel);
void print(const char *fileName, ...) const;
void printInstruction(int index, const char *fileName) const;
@@ -634,7 +634,7 @@
union
{
- unsigned short version;
+ unsigned short shaderModel;
struct
{
diff --git a/src/Shader/ShaderCore.cpp b/src/Shader/ShaderCore.cpp
index 5b2c1ae..58e535c 100644
--- a/src/Shader/ShaderCore.cpp
+++ b/src/Shader/ShaderCore.cpp
@@ -1605,9 +1605,9 @@
dst.w = arctanh(src.w, pp);
}
- void ShaderCore::expp(Vector4f &dst, const Vector4f &src, unsigned short version)
+ void ShaderCore::expp(Vector4f &dst, const Vector4f &src, unsigned short shaderModel)
{
- if(version < 0x0200)
+ if(shaderModel < 0x0200)
{
Float4 frc = Frac(src.x);
Float4 floor = src.x - frc;
@@ -1623,9 +1623,9 @@
}
}
- void ShaderCore::logp(Vector4f &dst, const Vector4f &src, unsigned short version)
+ void ShaderCore::logp(Vector4f &dst, const Vector4f &src, unsigned short shaderModel)
{
- if(version < 0x0200)
+ if(shaderModel < 0x0200)
{
Float4 tmp0;
Float4 tmp1;
diff --git a/src/Shader/ShaderCore.hpp b/src/Shader/ShaderCore.hpp
index b0ad3a0..249e058 100644
--- a/src/Shader/ShaderCore.hpp
+++ b/src/Shader/ShaderCore.hpp
@@ -334,8 +334,8 @@
void acosh(Vector4f &dst, const Vector4f &src, bool pp = false);
void asinh(Vector4f &dst, const Vector4f &src, bool pp = false);
void atanh(Vector4f &dst, const Vector4f &src, bool pp = false);
- void expp(Vector4f &dst, const Vector4f &src, unsigned short version);
- void logp(Vector4f &dst, const Vector4f &src, unsigned short version);
+ void expp(Vector4f &dst, const Vector4f &src, unsigned short shaderModel);
+ void logp(Vector4f &dst, const Vector4f &src, unsigned short shaderModel);
void cmp0(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2);
void cmp(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, Control control);
void icmp(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, Control control);
diff --git a/src/Shader/VertexProgram.cpp b/src/Shader/VertexProgram.cpp
index d95025c..53f3692 100644
--- a/src/Shader/VertexProgram.cpp
+++ b/src/Shader/VertexProgram.cpp
@@ -76,7 +76,7 @@
{
// shader->print("VertexShader-%0.8X.txt", state.shaderID);
- unsigned short version = shader->getVersion();
+ unsigned short shaderModel = shader->getShaderModel();
enableIndex = 0;
stackIndex = 0;
@@ -192,7 +192,7 @@
case Shader::OPCODE_ATT: att(d, s0, s1); break;
case Shader::OPCODE_EXP2X: exp2x(d, s0, pp); break;
case Shader::OPCODE_EXP2: exp2(d, s0, pp); break;
- case Shader::OPCODE_EXPP: expp(d, s0, version); break;
+ case Shader::OPCODE_EXPP: expp(d, s0, shaderModel); break;
case Shader::OPCODE_EXP: exp(d, s0, pp); break;
case Shader::OPCODE_FRC: frc(d, s0); break;
case Shader::OPCODE_TRUNC: trunc(d, s0); break;
@@ -203,7 +203,7 @@
case Shader::OPCODE_LIT: lit(d, s0); break;
case Shader::OPCODE_LOG2X: log2x(d, s0, pp); break;
case Shader::OPCODE_LOG2: log2(d, s0, pp); break;
- case Shader::OPCODE_LOGP: logp(d, s0, version); break;
+ case Shader::OPCODE_LOGP: logp(d, s0, shaderModel); break;
case Shader::OPCODE_LOG: log(d, s0, pp); break;
case Shader::OPCODE_LRP: lrp(d, s0, s1, s2); break;
case Shader::OPCODE_STEP: step(d, s0, s1); break;
@@ -411,7 +411,7 @@
break;
case Shader::PARAMETER_TEXCRDOUT:
// case Shader::PARAMETER_OUTPUT:
- if(version < 0x0300)
+ if(shaderModel < 0x0300)
{
if(dst.x) pDst.x = o[T0 + dst.index].x;
if(dst.y) pDst.y = o[T0 + dst.index].y;
@@ -542,7 +542,7 @@
break;
case Shader::PARAMETER_TEXCRDOUT:
// case Shader::PARAMETER_OUTPUT:
- if(version < 0x0300)
+ if(shaderModel < 0x0300)
{
if(dst.x) o[T0 + dst.index].x = d.x;
if(dst.y) o[T0 + dst.index].y = d.y;
diff --git a/src/Shader/VertexShader.cpp b/src/Shader/VertexShader.cpp
index ebdfc97..33c2241 100644
--- a/src/Shader/VertexShader.cpp
+++ b/src/Shader/VertexShader.cpp
@@ -23,7 +23,7 @@
{
VertexShader::VertexShader(const VertexShader *vs) : Shader()
{
- version = 0x0300;
+ shaderModel = 0x0300;
positionRegister = Pos;
pointSizeRegister = Unused;
instanceIdDeclared = false;
@@ -226,7 +226,7 @@
void VertexShader::analyzeOutput()
{
- if(version < 0x0300)
+ if(shaderModel < 0x0300)
{
output[Pos][0] = Semantic(Shader::USAGE_POSITION, 0);
output[Pos][1] = Semantic(Shader::USAGE_POSITION, 0);