summaryrefslogtreecommitdiff
path: root/src/mesa/shader
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/nvfragparse.c8
-rw-r--r--src/mesa/shader/prog_parameter.c2
-rw-r--r--src/mesa/shader/program.c14
-rw-r--r--src/mesa/shader/programopt.c14
-rw-r--r--src/mesa/shader/slang/slang_compile_operation.h1
-rw-r--r--src/mesa/shader/slang/slang_simplify.c9
6 files changed, 29 insertions, 19 deletions
diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c
index 0fd55524ab..b739a6aa07 100644
--- a/src/mesa/shader/nvfragparse.c
+++ b/src/mesa/shader/nvfragparse.c
@@ -217,6 +217,12 @@ MatchInstruction(const GLubyte *token)
const struct instruction_pattern *inst;
struct instruction_pattern result;
+ result.name = NULL;
+ result.opcode = MAX_OPCODE; /* i.e. invalid instruction */
+ result.inputs = 0;
+ result.outputs = 0;
+ result.suffixes = 0;
+
for (inst = Instructions; inst->name; inst++) {
if (_mesa_strncmp((const char *) token, inst->name, 3) == 0) {
/* matched! */
@@ -247,7 +253,7 @@ MatchInstruction(const GLubyte *token)
return result;
}
}
- result.opcode = MAX_OPCODE; /* i.e. invalid instruction */
+
return result;
}
diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c
index 2f029b02e5..f22492e029 100644
--- a/src/mesa/shader/prog_parameter.c
+++ b/src/mesa/shader/prog_parameter.c
@@ -500,7 +500,7 @@ GLfloat *
_mesa_lookup_parameter_value(const struct gl_program_parameter_list *paramList,
GLsizei nameLen, const char *name)
{
- GLuint i = _mesa_lookup_parameter_index(paramList, nameLen, name);
+ GLint i = _mesa_lookup_parameter_index(paramList, nameLen, name);
if (i < 0)
return NULL;
else
diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c
index 532adf4d36..6b8d94e661 100644
--- a/src/mesa/shader/program.c
+++ b/src/mesa/shader/program.c
@@ -806,9 +806,17 @@ _mesa_find_free_register(const struct gl_program *prog, GLuint regFile)
const struct prog_instruction *inst = prog->Instructions + i;
const GLuint n = _mesa_num_inst_src_regs(inst->Opcode);
- for (k = 0; k < n; k++) {
- if (inst->SrcReg[k].File == regFile) {
- used[inst->SrcReg[k].Index] = GL_TRUE;
+ /* check dst reg first */
+ if (inst->DstReg.File == regFile) {
+ used[inst->DstReg.Index] = GL_TRUE;
+ }
+ else {
+ /* check src regs otherwise */
+ for (k = 0; k < n; k++) {
+ if (inst->SrcReg[k].File == regFile) {
+ used[inst->SrcReg[k].Index] = GL_TRUE;
+ break;
+ }
}
}
}
diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c
index a0daac1b80..9514545709 100644
--- a/src/mesa/shader/programopt.c
+++ b/src/mesa/shader/programopt.c
@@ -528,15 +528,11 @@ _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type)
/* look for instructions which write to the varying vars identified above */
for (i = 0; i < prog->NumInstructions; i++) {
struct prog_instruction *inst = prog->Instructions + i;
- const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode);
- GLuint j;
- for (j = 0; j < numSrc; j++) {
- if (inst->DstReg.File == type &&
- outputMap[inst->DstReg.Index] >= 0) {
- /* change inst to write to the temp reg, instead of the varying */
- inst->DstReg.File = PROGRAM_TEMPORARY;
- inst->DstReg.Index = outputMap[inst->DstReg.Index];
- }
+ if (inst->DstReg.File == type &&
+ outputMap[inst->DstReg.Index] >= 0) {
+ /* change inst to write to the temp reg, instead of the varying */
+ inst->DstReg.File = PROGRAM_TEMPORARY;
+ inst->DstReg.Index = outputMap[inst->DstReg.Index];
}
}
diff --git a/src/mesa/shader/slang/slang_compile_operation.h b/src/mesa/shader/slang/slang_compile_operation.h
index 58f1edeed8..1f15c19896 100644
--- a/src/mesa/shader/slang/slang_compile_operation.h
+++ b/src/mesa/shader/slang/slang_compile_operation.h
@@ -127,7 +127,6 @@ typedef struct slang_operation_
* indicate such. num_children indicates number of elements.
*/
GLboolean array_constructor;
- double x;
} slang_operation;
diff --git a/src/mesa/shader/slang/slang_simplify.c b/src/mesa/shader/slang/slang_simplify.c
index b8a21f642c..13b9ca3c87 100644
--- a/src/mesa/shader/slang/slang_simplify.c
+++ b/src/mesa/shader/slang/slang_simplify.c
@@ -84,10 +84,11 @@ _slang_lookup_constant(const char *name)
for (i = 0; info[i].Name; i++) {
if (strcmp(info[i].Name, name) == 0) {
/* found */
- GLint value = -1;
- _mesa_GetIntegerv(info[i].Token, &value);
- ASSERT(value >= 0); /* sanity check that glGetFloatv worked */
- return value;
+ GLint values[16];
+ values[0] = -1;
+ _mesa_GetIntegerv(info[i].Token, values);
+ ASSERT(values[0] >= 0); /* sanity check that glGetFloatv worked */
+ return values[0];
}
}
return -1;