From 4815c187b7faf48ebf38ac9efb0ed7b126f2a460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 9 Mar 2015 20:05:48 +0100 Subject: [PATCH] r300g: remove the broken SNORM->UNORM shader lowering pass Not used anymore. --- .../drivers/r300/compiler/radeon_code.h | 6 --- .../r300/compiler/radeon_program_tex.c | 47 ------------------- src/gallium/drivers/r300/r300_fs.c | 1 - 3 files changed, 54 deletions(-) diff --git a/src/gallium/drivers/r300/compiler/radeon_code.h b/src/gallium/drivers/r300/compiler/radeon_code.h index beafc26ffec..47f46d0791c 100644 --- a/src/gallium/drivers/r300/compiler/radeon_code.h +++ b/src/gallium/drivers/r300/compiler/radeon_code.h @@ -175,12 +175,6 @@ struct r300_fragment_program_external_state { * and right before texture fetch. The scaling factor is given by * RC_STATE_R300_TEXSCALE_FACTOR. */ unsigned clamp_and_scale_before_fetch : 1; - - /** - * Fetch RGTC1_SNORM or LATC1_SNORM as UNORM and convert UNORM -> SNORM - * in the shader. - */ - unsigned convert_unorm_to_snorm:1; } unit[16]; unsigned alpha_to_one:1; diff --git a/src/gallium/drivers/r300/compiler/radeon_program_tex.c b/src/gallium/drivers/r300/compiler/radeon_program_tex.c index 8dfcd54d238..17d6ee9aebb 100644 --- a/src/gallium/drivers/r300/compiler/radeon_program_tex.c +++ b/src/gallium/drivers/r300/compiler/radeon_program_tex.c @@ -434,53 +434,6 @@ int radeonTransformTEX( scale_texcoords(compiler, inst, RC_STATE_R300_TEXSCALE_FACTOR); } - /* Convert SNORM-encoded ATI1N sampled as UNORM to SNORM. - * Formula: dst = tex > 0.5 ? tex*2-2 : tex*2 - */ - if (inst->U.I.Opcode != RC_OPCODE_KIL && - compiler->state.unit[inst->U.I.TexSrcUnit].convert_unorm_to_snorm) { - unsigned two, two_swizzle; - struct rc_instruction *inst_mul, *inst_mad, *inst_cnd; - - two = rc_constants_add_immediate_scalar(&c->Program.Constants, 2.35, &two_swizzle); - - inst_mul = rc_insert_new_instruction(c, inst); - inst_mul->U.I.Opcode = RC_OPCODE_MUL; - inst_mul->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_mul->U.I.DstReg.Index = rc_find_free_temporary(c); - inst_mul->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst_mul->U.I.SrcReg[0].Index = rc_find_free_temporary(c); /* redirected TEX output */ - inst_mul->U.I.SrcReg[1].File = RC_FILE_CONSTANT; /* 2 */ - inst_mul->U.I.SrcReg[1].Index = two; - inst_mul->U.I.SrcReg[1].Swizzle = two_swizzle; - - inst_mad = rc_insert_new_instruction(c, inst_mul); - inst_mad->U.I.Opcode = RC_OPCODE_MAD; - inst_mad->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_mad->U.I.DstReg.Index = rc_find_free_temporary(c); - inst_mad->U.I.SrcReg[0] = inst_mul->U.I.SrcReg[0]; /* redirected TEX output */ - inst_mad->U.I.SrcReg[1] = inst_mul->U.I.SrcReg[1]; /* 2 */ - inst_mad->U.I.SrcReg[2] = inst_mul->U.I.SrcReg[1]; /* 2 */ - inst_mad->U.I.SrcReg[2].Negate = RC_MASK_XYZW; - - inst_cnd = rc_insert_new_instruction(c, inst_mad); - inst_cnd->U.I.Opcode = RC_OPCODE_CND; - inst_cnd->U.I.SaturateMode = inst->U.I.SaturateMode; - inst_cnd->U.I.DstReg = inst->U.I.DstReg; - inst_cnd->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst_cnd->U.I.SrcReg[0].Index = inst_mad->U.I.DstReg.Index; - inst_cnd->U.I.SrcReg[0].Swizzle = compiler->state.unit[inst->U.I.TexSrcUnit].texture_swizzle; - inst_cnd->U.I.SrcReg[1].File = RC_FILE_TEMPORARY; - inst_cnd->U.I.SrcReg[1].Index = inst_mul->U.I.DstReg.Index; - inst_cnd->U.I.SrcReg[1].Swizzle = compiler->state.unit[inst->U.I.TexSrcUnit].texture_swizzle; - inst_cnd->U.I.SrcReg[2] = inst_mul->U.I.SrcReg[0]; /* redirected TEX output */ - - inst->U.I.SaturateMode = 0; - inst->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst->U.I.DstReg.Index = inst_mul->U.I.SrcReg[0].Index; - inst->U.I.DstReg.WriteMask = RC_MASK_XYZW; - } - /* Cannot write texture to output registers or with saturate (all chips), * or with masks (non-r500). */ if (inst->U.I.Opcode != RC_OPCODE_KIL && diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index 79eee73e236..429543a5746 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -170,7 +170,6 @@ static void get_external_state( } state->unit[i].non_normalized_coords = !s->state.normalized_coords; - state->unit[i].convert_unorm_to_snorm = 0; /* Pass texture swizzling to the compiler, some lowering passes need it. */ if (state->unit[i].compare_mode_enabled) {