gallium: fix SSE shadow texture instructions

When sampling a 2D shadow map we need 3 texcoord components, not 2.
The third component (distance from light source) is compared against
the texture sample to return the result (visible vs. occluded).

Also, enable proper handling of TGSI_TEXTURE_SHADOW targets in Mesa->TGSI
translation.  There's a possibility for breakage in gallium drivers if
they fail to handle the TGSI_TEXTURE_SHADOW1D / TGSI_TEXTURE_SHADOW2D /
TGSI_TEXTURE_SHADOWRECT texture targets for TGSI_OPCODE_TEX/TXP instructions,
but that should be easy to fix.

With these changes, progs/demos/shadowtex.c renders properly again with
softpipe.
This commit is contained in:
Brian Paul 2009-07-29 16:27:03 -06:00
parent 9c4c9f2837
commit b9889517f5
2 changed files with 3 additions and 9 deletions

View File

@ -1467,15 +1467,15 @@ emit_tex( struct x86_function *func,
switch (inst->InstructionExtTexture.Texture) {
case TGSI_TEXTURE_1D:
case TGSI_TEXTURE_SHADOW1D:
count = 1;
break;
case TGSI_TEXTURE_2D:
case TGSI_TEXTURE_RECT:
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_SHADOWRECT:
count = 2;
break;
case TGSI_TEXTURE_SHADOW1D:
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_SHADOWRECT:
case TGSI_TEXTURE_3D:
case TGSI_TEXTURE_CUBE:
count = 3;

View File

@ -158,12 +158,6 @@ map_texture_target(
GLuint textarget,
GLboolean shadow )
{
#if 1
/* XXX remove this line after we've checked that the rest of gallium
* can handle the TGSI_TEXTURE_SHADOWx tokens.
*/
shadow = GL_FALSE;
#endif
switch( textarget ) {
case TEXTURE_1D_INDEX:
if (shadow)