diff options
author | Brian Paul <brianp@vmware.com> | 2009-02-20 14:06:25 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-02-20 14:06:25 -0700 |
commit | 776971218ef6c6749fcb882a95ae5fc3a1ff5059 (patch) | |
tree | 2797869ef743a854409e057cd5d57251186bfc1a /src/mesa | |
parent | e0d907308150b4863cc4f24543e70e14207e966a (diff) |
gallium: use the TGSI_TEXTURE_SHADOW1D/2D/RECT texture types for TEX instructions
These texture types were defined but never put to use.
For the time being though, the Mesa->TGSI translater isn't emitting these
targets. See the XXX comment in map_texture_target().
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_mesa_to_tgsi.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 862d29fb1b..8ce0b20113 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -132,19 +132,35 @@ map_register_file_index( */ static GLuint map_texture_target( - GLuint textarget ) + 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: - return TGSI_TEXTURE_1D; + if (shadow) + return TGSI_TEXTURE_SHADOW1D; + else + return TGSI_TEXTURE_1D; case TEXTURE_2D_INDEX: - return TGSI_TEXTURE_2D; + if (shadow) + return TGSI_TEXTURE_SHADOW2D; + else + return TGSI_TEXTURE_2D; case TEXTURE_3D_INDEX: return TGSI_TEXTURE_3D; case TEXTURE_CUBE_INDEX: return TGSI_TEXTURE_CUBE; case TEXTURE_RECT_INDEX: - return TGSI_TEXTURE_RECT; + if (shadow) + return TGSI_TEXTURE_SHADOWRECT; + else + return TGSI_TEXTURE_RECT; default: assert( 0 ); } @@ -514,7 +530,8 @@ compile_instruction( /* ordinary texture lookup */ fullinst->Instruction.Opcode = TGSI_OPCODE_TEX; fullinst->Instruction.NumSrcRegs = 2; - fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget ); + fullinst->InstructionExtTexture.Texture = + map_texture_target( inst->TexSrcTarget, inst->TexShadow ); fullinst->FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER; fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit; break; @@ -522,7 +539,8 @@ compile_instruction( /* texture lookup with LOD bias */ fullinst->Instruction.Opcode = TGSI_OPCODE_TXB; fullinst->Instruction.NumSrcRegs = 2; - fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget ); + fullinst->InstructionExtTexture.Texture = + map_texture_target( inst->TexSrcTarget, inst->TexShadow ); fullinst->FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER; fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit; break; @@ -530,7 +548,8 @@ compile_instruction( /* texture lookup with explicit partial derivatives */ fullinst->Instruction.Opcode = TGSI_OPCODE_TXD; fullinst->Instruction.NumSrcRegs = 4; - fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget ); + fullinst->InstructionExtTexture.Texture = + map_texture_target( inst->TexSrcTarget, inst->TexShadow ); /* src[0] = coord, src[1] = d[strq]/dx, src[2] = d[strq]/dy */ fullinst->FullSrcRegisters[3].SrcRegister.File = TGSI_FILE_SAMPLER; fullinst->FullSrcRegisters[3].SrcRegister.Index = inst->TexSrcUnit; @@ -539,7 +558,8 @@ compile_instruction( /* texture lookup with explicit LOD */ fullinst->Instruction.Opcode = TGSI_OPCODE_TXL; fullinst->Instruction.NumSrcRegs = 2; - fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget ); + fullinst->InstructionExtTexture.Texture = + map_texture_target( inst->TexSrcTarget, inst->TexShadow ); fullinst->FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER; fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit; break; @@ -548,7 +568,8 @@ compile_instruction( /* convert to TEX w/ special flag for division */ fullinst->Instruction.Opcode = TGSI_OPCODE_TXP; fullinst->Instruction.NumSrcRegs = 2; - fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget ); + fullinst->InstructionExtTexture.Texture = + map_texture_target( inst->TexSrcTarget, inst->TexShadow ); fullinst->FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER; fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit; break; |