If the instruction is TEX/TXP/TXL/etc the TexShadow field will be true if
the instruction is a texture fetch with shadow compare.
GLuint destmask,
GLuint tex_unit,
GLuint tex_idx,
GLuint destmask,
GLuint tex_unit,
GLuint tex_idx,
struct ureg coord )
{
struct prog_instruction *inst = emit_op( p, op,
struct ureg coord )
{
struct prog_instruction *inst = emit_op( p, op,
inst->TexSrcTarget = tex_idx;
inst->TexSrcUnit = tex_unit;
inst->TexSrcTarget = tex_idx;
inst->TexSrcUnit = tex_unit;
+ inst->TexShadow = tex_shadow;
p->program->Base.NumTexInstructions++;
p->program->Base.NumTexInstructions++;
static void load_texture( struct texenv_fragment_program *p, GLuint unit )
{
if (is_undef(p->src_texture[unit])) {
static void load_texture( struct texenv_fragment_program *p, GLuint unit )
{
if (is_undef(p->src_texture[unit])) {
- GLuint dim = p->state->unit[unit].source_index;
+ GLuint texTarget = p->state->unit[unit].source_index;
struct ureg texcoord = register_input(p, FRAG_ATTRIB_TEX0+unit);
struct ureg tmp = get_tex_temp( p );
struct ureg texcoord = register_input(p, FRAG_ATTRIB_TEX0+unit);
struct ureg tmp = get_tex_temp( p );
- if (dim == TEXTURE_UNKNOWN_INDEX)
+ if (texTarget == TEXTURE_UNKNOWN_INDEX)
program_error(p, "TexSrcBit");
/* TODO: Use D0_MASK_XY where possible.
*/
if (p->state->unit[unit].enabled) {
program_error(p, "TexSrcBit");
/* TODO: Use D0_MASK_XY where possible.
*/
if (p->state->unit[unit].enabled) {
- p->src_texture[unit] = emit_texld( p, OPCODE_TXP,
- tmp, WRITEMASK_XYZW,
- unit, dim, texcoord );
+ GLboolean shadow = GL_FALSE;
- if (p->state->unit[unit].shadow)
+ if (p->state->unit[unit].shadow) {
p->program->Base.ShadowSamplers |= 1 << unit;
p->program->Base.ShadowSamplers |= 1 << unit;
+ shadow = GL_TRUE;
+ }
+
+ p->src_texture[unit] = emit_texld( p, OPCODE_TXP,
+ tmp, WRITEMASK_XYZW,
+ unit, texTarget, shadow,
+ texcoord );
p->program->Base.SamplersUsed |= (1 << unit);
/* This identity mapping should already be in place
p->program->Base.SamplersUsed |= (1 << unit);
/* This identity mapping should already be in place
+ if (shadow_tex)
+ fp->TexShadow = 1;
+
/* Don't test the first time a particular sampler is seen. Each time
* after that, make sure the shadow state is the same.
*/
/* Don't test the first time a particular sampler is seen. Each time
* after that, make sure the shadow state is the same.
*/
/** Source texture target, one of TEXTURE_{1D,2D,3D,CUBE,RECT}_INDEX */
GLuint TexSrcTarget:3;
/** Source texture target, one of TEXTURE_{1D,2D,3D,CUBE,RECT}_INDEX */
GLuint TexSrcTarget:3;
+
+ /** True if tex instruction should do shadow comparison */
+ GLuint TexShadow:1;
+ if (inst->TexShadow)
+ _mesa_fprintf(f, " SHADOW");
fprint_comment(f, inst);
break;
fprint_comment(f, inst);
break;