mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-28 22:40:24 +01:00
r300/compiler: generalize depth texture mode to support arbitrary swizzles
This commit is contained in:
parent
c637f38e70
commit
eb9dc2595f
4 changed files with 9 additions and 13 deletions
|
|
@ -147,8 +147,8 @@ static void get_external_state(
|
|||
|
||||
if (s->state.compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) {
|
||||
/* XXX Gallium doesn't provide us with any information regarding
|
||||
* this mode, so we are screwed. I'm setting 0 = LUMINANCE. */
|
||||
state->unit[i].depth_texture_mode = 0;
|
||||
* this mode, so we are screwed. Let's set INTENSITY for now. */
|
||||
state->unit[i].depth_texture_swizzle = RC_SWIZZLE_XYZW;
|
||||
|
||||
/* Fortunately, no need to translate this. */
|
||||
state->unit[i].texture_compare_func = s->state.compare_func;
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ struct r300_fragment_program_external_state {
|
|||
* 2 - GL_ALPHA
|
||||
* depending on the depth texture mode.
|
||||
*/
|
||||
unsigned depth_texture_mode : 2;
|
||||
unsigned depth_texture_swizzle:12;
|
||||
|
||||
/**
|
||||
* If the sampler is used as a shadow sampler,
|
||||
|
|
|
|||
|
|
@ -113,7 +113,6 @@ int radeonTransformTEX(
|
|||
return 1;
|
||||
} else {
|
||||
rc_compare_func comparefunc = compiler->state.unit[inst->U.I.TexSrcUnit].texture_compare_func;
|
||||
unsigned int depthmode = compiler->state.unit[inst->U.I.TexSrcUnit].depth_texture_mode;
|
||||
struct rc_instruction * inst_rcp = rc_insert_new_instruction(c, inst);
|
||||
struct rc_instruction * inst_mad = rc_insert_new_instruction(c, inst_rcp);
|
||||
struct rc_instruction * inst_cmp = rc_insert_new_instruction(c, inst_mad);
|
||||
|
|
@ -141,10 +140,7 @@ int radeonTransformTEX(
|
|||
inst_mad->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_WWWW;
|
||||
inst_mad->U.I.SrcReg[2].File = RC_FILE_TEMPORARY;
|
||||
inst_mad->U.I.SrcReg[2].Index = inst->U.I.DstReg.Index;
|
||||
if (depthmode == 0) /* GL_LUMINANCE */
|
||||
inst_mad->U.I.SrcReg[2].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_Z);
|
||||
else if (depthmode == 2) /* GL_ALPHA */
|
||||
inst_mad->U.I.SrcReg[2].Swizzle = RC_SWIZZLE_WWWW;
|
||||
inst_mad->U.I.SrcReg[2].Swizzle = compiler->state.unit[inst->U.I.TexSrcUnit].depth_texture_swizzle;
|
||||
|
||||
/* Recall that SrcReg[0] is tex, SrcReg[2] is r and:
|
||||
* r < tex <=> -tex+r < 0
|
||||
|
|
|
|||
|
|
@ -46,13 +46,13 @@
|
|||
#include "radeon_mesa_to_rc.h"
|
||||
|
||||
|
||||
static GLuint build_dtm(GLuint depthmode)
|
||||
static GLuint build_dts(GLuint depthmode)
|
||||
{
|
||||
switch(depthmode) {
|
||||
default:
|
||||
case GL_LUMINANCE: return 0;
|
||||
case GL_INTENSITY: return 1;
|
||||
case GL_ALPHA: return 2;
|
||||
case GL_LUMINANCE: return RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_Z);
|
||||
case GL_INTENSITY: return RC_SWIZZLE_XYZW;
|
||||
case GL_ALPHA: return RC_SWIZZLE_WWWW;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ static void build_state(
|
|||
if (fp->Base.ShadowSamplers & (1 << unit)) {
|
||||
struct gl_texture_object* tex = r300->radeon.glCtx->Texture.Unit[unit]._Current;
|
||||
|
||||
state->unit[unit].depth_texture_mode = build_dtm(tex->DepthMode);
|
||||
state->unit[unit].depth_texture_swizzle = build_dts(tex->DepthMode);
|
||||
state->unit[unit].texture_compare_func = build_func(tex->CompareFunc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue