diff options
author | Zack Rusin <[email protected]> | 2010-06-28 17:31:21 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2010-06-28 22:53:21 -0400 |
commit | da7bd6a90e1fee5c16327338fd251c0f6be34e36 (patch) | |
tree | 5f7e3d8f6d30799033afd78beec3e643ef4c7d6c /src/mesa/slang/slang_codegen.c | |
parent | 0b50fcbd556ead8d35c2b543f13de433996a5822 (diff) |
mesa: initial support for ARB_geometry_shader4
laying down the foundation for everything and implementing most of the
stuff.
linking, gl_VerticesIn and multidimensional inputs are left.
Diffstat (limited to 'src/mesa/slang/slang_codegen.c')
-rw-r--r-- | src/mesa/slang/slang_codegen.c | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/src/mesa/slang/slang_codegen.c b/src/mesa/slang/slang_codegen.c index 18a0932e4fc..494901dc1c8 100644 --- a/src/mesa/slang/slang_codegen.c +++ b/src/mesa/slang/slang_codegen.c @@ -503,6 +503,9 @@ static slang_asm_info AsmInfo[] = { { "float_noise3", IR_NOISE3, 1, 1}, { "float_noise4", IR_NOISE4, 1, 1}, + { "emit_vertex", IR_EMIT_VERTEX, 0, 0}, + { "end_primitive", IR_END_PRIMITIVE, 0, 0}, + { NULL, IR_NOP, 0, 0 } }; @@ -4239,7 +4242,8 @@ is_store_writable(const slang_assemble_ctx *A, const slang_ir_storage *store) if (!(store->File == PROGRAM_OUTPUT || store->File == PROGRAM_TEMPORARY || (store->File == PROGRAM_VARYING && - A->program->Target == GL_VERTEX_PROGRAM_ARB))) { + (A->program->Target == GL_VERTEX_PROGRAM_ARB || + A->program->Target == MESA_GEOMETRY_PROGRAM)))) { return GL_FALSE; } else { @@ -5148,8 +5152,7 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var, assert(index < FRAG_ATTRIB_MAX); store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, size, swizzle); - } - else { + } else if (type == SLANG_UNIT_VERTEX_BUILTIN) { /* vertex program output */ GLint index = _slang_output_index(varName, GL_VERTEX_PROGRAM_ARB); GLuint swizzle = _slang_var_swizzle(size, 0); @@ -5158,6 +5161,27 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var, assert(type == SLANG_UNIT_VERTEX_BUILTIN); store = _slang_new_ir_storage_swz(PROGRAM_OUTPUT, index, size, swizzle); + } else { + /* geometry program input */ + GLuint swizzle; + GLint index = _slang_input_index(varName, MESA_GEOMETRY_PROGRAM, + &swizzle); + if (index < 0) { + /* geometry program output */ + index = _slang_output_index(varName, MESA_GEOMETRY_PROGRAM); + swizzle = _slang_var_swizzle(size, 0); + + assert(index >= 0); + assert(index < GEOM_RESULT_MAX); + + store = _slang_new_ir_storage_swz(PROGRAM_OUTPUT, index, + size, swizzle); + } else { + assert(index >= 0); + /* assert(index < GEOM_ATTRIB_MAX); */ + store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, + size, swizzle); + } } if (dbg) printf("V/F "); } @@ -5193,21 +5217,31 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var, } else if (var->type.qualifier == SLANG_QUAL_FIXEDINPUT) { GLuint swizzle = SWIZZLE_XYZW; /* silence compiler warning */ - GLint index = _slang_input_index(varName, GL_FRAGMENT_PROGRAM_ARB, - &swizzle); - store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, size, swizzle); + if (type == SLANG_UNIT_FRAGMENT_BUILTIN) { + GLint index = _slang_input_index(varName, GL_FRAGMENT_PROGRAM_ARB, + &swizzle); + store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, size, swizzle); + } else if (type == SLANG_UNIT_GEOMETRY_BUILTIN) { + GLint index = _slang_input_index(varName, MESA_GEOMETRY_PROGRAM, + &swizzle); + store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, size, swizzle); + } if (dbg) printf("INPUT "); } else if (var->type.qualifier == SLANG_QUAL_FIXEDOUTPUT) { if (type == SLANG_UNIT_VERTEX_BUILTIN) { GLint index = _slang_output_index(varName, GL_VERTEX_PROGRAM_ARB); store = _slang_new_ir_storage(PROGRAM_OUTPUT, index, size); - } - else { + } else if (type == SLANG_UNIT_FRAGMENT_BUILTIN) { GLint index = _slang_output_index(varName, GL_FRAGMENT_PROGRAM_ARB); GLint specialSize = 4; /* treat all fragment outputs as float[4] */ assert(type == SLANG_UNIT_FRAGMENT_BUILTIN); store = _slang_new_ir_storage(PROGRAM_OUTPUT, index, specialSize); + } else { + GLint index = _slang_output_index(varName, MESA_GEOMETRY_PROGRAM); + GLint specialSize = 4; /* treat all fragment outputs as float[4] */ + assert(type == SLANG_UNIT_GEOMETRY_BUILTIN); + store = _slang_new_ir_storage(PROGRAM_OUTPUT, index, specialSize); } if (dbg) printf("OUTPUT "); } |