diff options
author | Brian <brian@yutani.localnet.net> | 2006-12-13 14:48:36 -0700 |
---|---|---|
committer | Brian <brian@yutani.localnet.net> | 2006-12-13 14:48:36 -0700 |
commit | aff8e204d205b5d424d2c39a5d9e004caaa1eab1 (patch) | |
tree | 91d06d422f8900af461233186bcc79351c3025f6 /src/mesa/shader/slang/slang_assemble_constructor.c | |
parent | 5b35132b41427798e02a66a8e39583fffbe9d232 (diff) |
Checkpoint new GLSL compiler back-end to produce fp/vp-style assembly instructions.
Diffstat (limited to 'src/mesa/shader/slang/slang_assemble_constructor.c')
-rw-r--r-- | src/mesa/shader/slang/slang_assemble_constructor.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/mesa/shader/slang/slang_assemble_constructor.c b/src/mesa/shader/slang/slang_assemble_constructor.c index 6cd320d446..a411597130 100644 --- a/src/mesa/shader/slang/slang_assemble_constructor.c +++ b/src/mesa/shader/slang/slang_assemble_constructor.c @@ -46,6 +46,10 @@ _slang_is_swizzle(const char *field, GLuint rows, slang_swizzle * swz) GLuint i; GLboolean xyzw = GL_FALSE, rgba = GL_FALSE, stpq = GL_FALSE; + /* init to default */ + for (i = 0; i < 4; i++) + swz->swizzle[i] = i; + /* the swizzle can be at most 4-component long */ swz->num_components = slang_string_length(field); if (swz->num_components > 4) @@ -109,6 +113,12 @@ _slang_is_swizzle(const char *field, GLuint rows, slang_swizzle * swz) if ((xyzw && rgba) || (xyzw && stpq) || (rgba && stpq)) return GL_FALSE; + if (swz->num_components == 1) { + /* smear */ + swz->swizzle[3] = + swz->swizzle[2] = + swz->swizzle[1] = swz->swizzle[0]; + } return GL_TRUE; } @@ -301,6 +311,18 @@ _slang_assemble_constructor(slang_assemble_ctx * A, const slang_operation * op) /* check if there are too few arguments */ if (arg_sums[1] < size) { /* TODO: info log: too few arguments in constructor list */ + /* DEBUG */ + { + if (!slang_storage_aggregate_construct(&agg)) + goto end1; + if (!_slang_aggregate_variable(&agg, &ti.spec, 0, A->space.funcs, + A->space.structs, A->space.vars, + A->mach, A->file, A->atoms)) + goto end2; + + /* calculate size of the constructor */ + size = _slang_sizeof_aggregate(&agg); + } goto end; } @@ -316,8 +338,7 @@ _slang_assemble_constructor(slang_assemble_ctx * A, const slang_operation * op) else garbage_size = 0; - if (!constructor_aggregate - (A, &flat, &op->children[i - 1], garbage_size)) + if (!constructor_aggregate(A, &flat, &op->children[i - 1], garbage_size)) goto end; } |