diff options
author | Zack Rusin <[email protected]> | 2010-07-13 21:54:14 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2010-07-13 21:54:14 -0400 |
commit | 582132aaef3fa6fa912f27c75c3b3e5bd89d3714 (patch) | |
tree | 2c6cb9a4c6b0558b1741430c5a6aa727cf73b261 /src/mesa/program | |
parent | 9fa64ea67544d252c6713e21d3b9c17a2bbb0603 (diff) | |
parent | 1491c6aa2de17760ab157a3fe71e45006e4eecf6 (diff) |
Merge branch 'mesa-2d-registers'
Diffstat (limited to 'src/mesa/program')
-rw-r--r-- | src/mesa/program/prog_instruction.h | 16 | ||||
-rw-r--r-- | src/mesa/program/prog_print.c | 14 | ||||
-rw-r--r-- | src/mesa/program/prog_uniform.c | 18 |
3 files changed, 40 insertions, 8 deletions
diff --git a/src/mesa/program/prog_instruction.h b/src/mesa/program/prog_instruction.h index bc980c6a7f6..dacbc33704b 100644 --- a/src/mesa/program/prog_instruction.h +++ b/src/mesa/program/prog_instruction.h @@ -271,6 +271,22 @@ struct prog_src_register * instruction which allows per-component negation. */ GLuint Negate:4; + + /** + * Is the register two-dimensional. + * Two dimensional registers are of the + * REGISTER[index][index2] format. + * They are used by the geometry shaders where + * the first index is the index within an array + * and the second index is the semantic of the + * array, e.g. gl_PositionIn[index] would become + * INPUT[index][gl_PositionIn] + */ + GLuint HasIndex2:1; + GLuint RelAddr2:1; + GLint Index2:(INST_INDEX_BITS+1); /**< Extra bit here for sign bit. + * May be negative for relative + * addressing. */ }; diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c index 80c9203e31f..6ab199aa02b 100644 --- a/src/mesa/program/prog_print.c +++ b/src/mesa/program/prog_print.c @@ -265,7 +265,8 @@ arb_output_attrib_string(GLint index, GLenum progType) */ static const char * reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode, - GLboolean relAddr, const struct gl_program *prog) + GLboolean relAddr, const struct gl_program *prog, + GLboolean hasIndex2, GLboolean relAddr2, GLint index2) { static char str[100]; const char *addr = relAddr ? "ADDR+" : ""; @@ -275,6 +276,11 @@ reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode, switch (mode) { case PROG_PRINT_DEBUG: sprintf(str, "%s[%s%d]", file_string(f, mode), addr, index); + if (hasIndex2) { + int offset = strlen(str); + const char *addr2 = relAddr2 ? "ADDR+" : ""; + sprintf(str+offset, "[%s%d]", addr2, index2); + } break; case PROG_PRINT_ARB: @@ -478,7 +484,8 @@ fprint_dst_reg(FILE * f, { fprintf(f, "%s%s", reg_string((gl_register_file) dstReg->File, - dstReg->Index, mode, dstReg->RelAddr, prog), + dstReg->Index, mode, dstReg->RelAddr, prog, + GL_FALSE, GL_FALSE, 0), _mesa_writemask_string(dstReg->WriteMask)); if (dstReg->CondMask != COND_TR) { @@ -508,7 +515,8 @@ fprint_src_reg(FILE *f, fprintf(f, "%s%s%s%s", abs, reg_string((gl_register_file) srcReg->File, - srcReg->Index, mode, srcReg->RelAddr, prog), + srcReg->Index, mode, srcReg->RelAddr, prog, + srcReg->HasIndex2, srcReg->RelAddr2, srcReg->Index2), _mesa_swizzle_string(srcReg->Swizzle, srcReg->Negate, GL_FALSE), abs); diff --git a/src/mesa/program/prog_uniform.c b/src/mesa/program/prog_uniform.c index c408a8492c6..5aa9878d43c 100644 --- a/src/mesa/program/prog_uniform.c +++ b/src/mesa/program/prog_uniform.c @@ -61,7 +61,8 @@ _mesa_append_uniform(struct gl_uniform_list *list, GLint index; assert(target == GL_VERTEX_PROGRAM_ARB || - target == GL_FRAGMENT_PROGRAM_ARB); + target == GL_FRAGMENT_PROGRAM_ARB || + target == MESA_GEOMETRY_PROGRAM); index = _mesa_lookup_uniform(list, name); if (index < 0) { @@ -90,6 +91,7 @@ _mesa_append_uniform(struct gl_uniform_list *list, uniform->Name = _mesa_strdup(name); uniform->VertPos = -1; uniform->FragPos = -1; + uniform->GeomPos = -1; uniform->Initialized = GL_FALSE; list->NumUniforms++; @@ -106,13 +108,18 @@ _mesa_append_uniform(struct gl_uniform_list *list, return GL_FALSE; } uniform->VertPos = progPos; - } - else { + } else if (target == GL_FRAGMENT_PROGRAM_ARB) { if (uniform->FragPos != -1) { /* this uniform is already in the list - that shouldn't happen */ return GL_FALSE; } uniform->FragPos = progPos; + } else { + if (uniform->GeomPos != -1) { + /* this uniform is already in the list - that shouldn't happen */ + return GL_FALSE; + } + uniform->GeomPos = progPos; } return uniform; @@ -156,10 +163,11 @@ _mesa_print_uniforms(const struct gl_uniform_list *list) GLuint i; printf("Uniform list %p:\n", (void *) list); for (i = 0; i < list->NumUniforms; i++) { - printf("%d: %s %d %d\n", + printf("%d: %s %d %d %d\n", i, list->Uniforms[i].Name, list->Uniforms[i].VertPos, - list->Uniforms[i].FragPos); + list->Uniforms[i].FragPos, + list->Uniforms[i].GeomPos); } } |