summaryrefslogtreecommitdiff
path: root/src/mesa/slang/slang_codegen.c
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2010-07-09 22:40:04 -0400
committerZack Rusin <zackr@vmware.com>2010-07-09 22:40:04 -0400
commit9808308f9ad05c5fd6916cb808c66be23f21db60 (patch)
tree04a16000fd68c5e15ad77eb21dfea214076ff645 /src/mesa/slang/slang_codegen.c
parent7b8726a99da961fe0ace7c7ee567f82217715fe4 (diff)
mesa: initial support for emitting 2D registers from slang
Diffstat (limited to 'src/mesa/slang/slang_codegen.c')
-rw-r--r--src/mesa/slang/slang_codegen.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/mesa/slang/slang_codegen.c b/src/mesa/slang/slang_codegen.c
index 79072cb356..11a9074d1e 100644
--- a/src/mesa/slang/slang_codegen.c
+++ b/src/mesa/slang/slang_codegen.c
@@ -5155,7 +5155,7 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
/* fragment program input */
GLuint swizzle;
GLint index = _slang_input_index(varName, GL_FRAGMENT_PROGRAM_ARB,
- &swizzle);
+ &swizzle, NULL);
assert(index >= 0);
assert(index < FRAG_ATTRIB_MAX);
store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index,
@@ -5171,9 +5171,10 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
size, swizzle);
} else {
/* geometry program input */
+ GLboolean is_array = GL_FALSE;
GLuint swizzle;
GLint index = _slang_input_index(varName, MESA_GEOMETRY_PROGRAM,
- &swizzle);
+ &swizzle, &is_array);
if (index < 0) {
/* geometry program output */
index = _slang_output_index(varName, MESA_GEOMETRY_PROGRAM);
@@ -5187,8 +5188,12 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
} else {
assert(index >= 0);
/* assert(index < GEOM_ATTRIB_MAX); */
- store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index,
- size, swizzle);
+ if (is_array)
+ store = _slang_new_ir_storage_2d(PROGRAM_INPUT, 0, index,
+ size, swizzle);
+ else
+ store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index,
+ size, swizzle);
}
}
if (dbg) printf("V/F ");
@@ -5217,7 +5222,7 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
}
else {
/* pre-defined vertex attrib */
- index = _slang_input_index(varName, GL_VERTEX_PROGRAM_ARB, &swizzle);
+ index = _slang_input_index(varName, GL_VERTEX_PROGRAM_ARB, &swizzle, NULL);
assert(index >= 0);
}
store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, size, swizzle);
@@ -5227,12 +5232,16 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
GLuint swizzle = SWIZZLE_XYZW; /* silence compiler warning */
if (type == SLANG_UNIT_FRAGMENT_BUILTIN) {
GLint index = _slang_input_index(varName, GL_FRAGMENT_PROGRAM_ARB,
- &swizzle);
+ &swizzle, NULL);
store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, size, swizzle);
} else if (type == SLANG_UNIT_GEOMETRY_BUILTIN) {
+ GLboolean is_array;
GLint index = _slang_input_index(varName, MESA_GEOMETRY_PROGRAM,
- &swizzle);
- store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, size, swizzle);
+ &swizzle, &is_array);
+ if (is_array)
+ store = _slang_new_ir_storage_2d(PROGRAM_INPUT, 0, index, size, swizzle);
+ else
+ store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, size, swizzle);
}
if (dbg) printf("INPUT ");
}