Commit 059bece5 by Nicolas Capens

Fixed reading back gl_PointSize.

parent 4677a5f7
#define MAJOR_VERSION 3 #define MAJOR_VERSION 3
#define MINOR_VERSION 1 #define MINOR_VERSION 1
#define BUILD_VERSION 0 #define BUILD_VERSION 0
#define BUILD_REVISION 5171 #define BUILD_REVISION 5172
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x) #define MACRO_STRINGIFY(x) STRINGIFY(x)
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
namespace sh namespace sh
{ {
static const unsigned char swizzleSize[5] = {0x00, 0x00, 0x54, 0xA4, 0xE4}; // (void), xxxx, xyyy, xyzz, xyzw
// Integer to TString conversion // Integer to TString conversion
TString str(int i) TString str(int i)
{ {
...@@ -875,7 +873,7 @@ namespace sh ...@@ -875,7 +873,7 @@ namespace sh
Instruction *mov = emit(sw::Shader::OPCODE_MOV, result, argi); Instruction *mov = emit(sw::Shader::OPCODE_MOV, result, argi);
mov->dst.mask = (0xF << component) & 0xF; mov->dst.mask = (0xF << component) & 0xF;
mov->src[0].swizzle = swizzleSize[size] << (component * 2); mov->src[0].swizzle = readSwizzle(argi, size) << (component * 2);
component += size; component += size;
} }
...@@ -926,7 +924,7 @@ namespace sh ...@@ -926,7 +924,7 @@ namespace sh
Instruction *mov = emit(sw::Shader::OPCODE_MOV, result, argi); Instruction *mov = emit(sw::Shader::OPCODE_MOV, result, argi);
mov->dst.index += column; mov->dst.index += column;
mov->dst.mask = (0xF << row) & 0xF; mov->dst.mask = (0xF << row) & 0xF;
mov->src[0].swizzle = (swizzleSize[size] << (row * 2)) + 0x55 * element; mov->src[0].swizzle = (readSwizzle(argi, size) << (row * 2)) + 0x55 * element;
int end = row + size - element; int end = row + size - element;
column = end >= dim ? column + 1 : column; column = end >= dim ? column + 1 : column;
...@@ -1444,7 +1442,7 @@ namespace sh ...@@ -1444,7 +1442,7 @@ namespace sh
if(!IsSampler(arg->getBasicType())) if(!IsSampler(arg->getBasicType()))
{ {
parameter.swizzle = swizzleSize[size]; parameter.swizzle = readSwizzle(arg, size);
} }
} }
} }
...@@ -1762,6 +1760,18 @@ namespace sh ...@@ -1762,6 +1760,18 @@ namespace sh
return 0xF >> (4 - registerSize(destination->getType(), index)); return 0xF >> (4 - registerSize(destination->getType(), index));
} }
int OutputASM::readSwizzle(TIntermTyped *argument, int size)
{
if(argument->getQualifier() == EvqPointSize)
{
return 0x55; // Point size stored in the y component
}
static const unsigned char swizzleSize[5] = {0x00, 0x00, 0x54, 0xA4, 0xE4}; // (void), xxxx, xyyy, xyzz, xyzw
return swizzleSize[size];
}
// Conservatively checks whether an expression is fast to compute and has no side effects // Conservatively checks whether an expression is fast to compute and has no side effects
bool OutputASM::trivial(TIntermTyped *expression, int budget) bool OutputASM::trivial(TIntermTyped *expression, int budget)
{ {
......
...@@ -117,6 +117,7 @@ namespace sh ...@@ -117,6 +117,7 @@ namespace sh
sw::Shader::ParameterType registerType(TIntermTyped *operand); sw::Shader::ParameterType registerType(TIntermTyped *operand);
int registerIndex(TIntermTyped *operand); int registerIndex(TIntermTyped *operand);
int writeMask(TIntermTyped *destination, int index = 0); int writeMask(TIntermTyped *destination, int index = 0);
int readSwizzle(TIntermTyped *argument, int size);
bool trivial(TIntermTyped *expression, int budget); // Fast to compute and no side effects bool trivial(TIntermTyped *expression, int budget); // Fast to compute and no side effects
int cost(TIntermNode *expression, int budget); int cost(TIntermNode *expression, int budget);
const Function &findFunction(const TString &name); const Function &findFunction(const TString &name);
......
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