wined3d: Remove rcp special handling of 0 from the ARB shader backend.

oldstable
Matteo Bruni 2011-04-21 18:51:31 +02:00 committed by Alexandre Julliard
parent 0210a8384a
commit db8d681a5b
3 changed files with 2 additions and 23 deletions

View File

@ -340,7 +340,6 @@ static BOOL need_helper_const(const struct arb_vshader_private *shader_data,
if (gl_info->quirks & WINED3D_QUIRK_SET_TEXCOORD_W) return TRUE; /* Have to init texcoords. */
if (!use_nv_clip(gl_info)) return TRUE; /* Init the clip texcoord */
if (reg_maps->usesnrm) return TRUE; /* 0.0 */
if (reg_maps->usesrcp) return TRUE; /* EPS */
return FALSE;
}
@ -2424,8 +2423,6 @@ static void shader_hw_mnxn(const struct wined3d_shader_instruction *ins)
static void shader_hw_rcp(const struct wined3d_shader_instruction *ins)
{
struct wined3d_shader_buffer *buffer = ins->ctx->buffer;
struct shader_arb_ctx_priv *priv = ins->ctx->backend_data;
const char *flt_eps = arb_get_helper_value(ins->ctx->reg_maps->shader_version.type, ARB_EPS);
char dst[50];
char src[50];
@ -2440,23 +2437,7 @@ static void shader_hw_rcp(const struct wined3d_shader_instruction *ins)
strcat(src, ".w");
}
/* TODO: If the destination is readable, and not the same as the source, the destination
* can be used instead of TA
*/
if (priv->target_version >= NV2)
{
shader_addline(buffer, "MOVC TA.x, %s;\n", src);
shader_addline(buffer, "MOV TA.x (EQ.x), %s;\n", flt_eps);
shader_addline(buffer, "RCP%s %s, TA.x;\n", shader_arb_get_modifier(ins), dst);
}
else
{
const char *zero = arb_get_helper_value(ins->ctx->reg_maps->shader_version.type, ARB_ZERO);
shader_addline(buffer, "ABS TA.x, %s;\n", src);
shader_addline(buffer, "SGE TA.y, -TA.x, %s;\n", zero);
shader_addline(buffer, "MAD TA.x, TA.y, %s, %s;\n", flt_eps, src);
shader_addline(buffer, "RCP%s %s, TA.x;\n", shader_arb_get_modifier(ins), dst);
}
shader_addline(buffer, "RCP%s %s, %s;\n", shader_arb_get_modifier(ins), dst, src);
}
static void shader_hw_scalar_op(const struct wined3d_shader_instruction *ins)

View File

@ -788,7 +788,6 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
else if (ins.handler_idx == WINED3DSIH_MOVA) reg_maps->usesmova = 1;
else if (ins.handler_idx == WINED3DSIH_IFC) reg_maps->usesifc = 1;
else if (ins.handler_idx == WINED3DSIH_CALL) reg_maps->usescall = 1;
else if (ins.handler_idx == WINED3DSIH_RCP) reg_maps->usesrcp = 1;
limit = ins.src_count + (ins.predicate ? 1 : 0);
for (i = 0; i < limit; ++i)

View File

@ -559,8 +559,7 @@ struct wined3d_shader_reg_maps
WORD usestexldl : 1;
WORD usesifc : 1;
WORD usescall : 1;
WORD usesrcp : 1;
WORD padding : 3;
WORD padding : 4;
/* Whether or not loops are used in this shader, and nesting depth */
unsigned loop_depth;