diff options
author | Marek Olšák <maraeo@gmail.com> | 2009-11-14 22:14:42 +0100 |
---|---|---|
committer | Corbin Simpson <MostAwesomeDude@gmail.com> | 2009-11-20 14:47:31 -0800 |
commit | f4041b37e2d305cff0a97eb836250e9f8b1840a8 (patch) | |
tree | 7531327dfeca472f5a32b728eee665b1ae783a03 /src/gallium/drivers/r300/r300_emit.c | |
parent | 06ec216d191e160494dd0a922ab0395418a78402 (diff) |
r300g: fix rectangle textures on r3xx
Adapted from Maciej Cencora's patch.
Diffstat (limited to 'src/gallium/drivers/r300/r300_emit.c')
-rw-r--r-- | src/gallium/drivers/r300/r300_emit.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index c50c989f01..0bdf58202f 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -129,7 +129,9 @@ static const float * get_shader_constant( struct rc_constant * constant, struct r300_constant_buffer * externals) { - static const float zero[4] = { 0.0, 0.0, 0.0, 0.0 }; + static float vec[4] = { 0.0, 0.0, 0.0, 0.0 }; + struct pipe_texture *tex; + switch(constant->Type) { case RC_CONSTANT_EXTERNAL: return externals->constants[constant->u.External]; @@ -137,10 +139,26 @@ static const float * get_shader_constant( case RC_CONSTANT_IMMEDIATE: return constant->u.Immediate; + case RC_CONSTANT_STATE: + switch (constant->u.State[0]) + { + /* R3xx-specific */ + case RC_STATE_R300_TEXRECT_FACTOR: + tex = &r300->textures[constant->u.State[1]]->tex; + vec[0] = 1.0 / tex->width[0]; + vec[1] = 1.0 / tex->height[0]; + vec[2] = vec[3] = 1; + break; + + default: + assert(0); + } + return vec; + default: debug_printf("r300: Implementation error: Unhandled constant type %i\n", constant->Type); - return zero; + return vec; } } |