Commit 4aaf9ebe authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of the dst_arg enum.

parent 06a4f978
...@@ -6072,17 +6072,19 @@ static const char *get_argreg(struct wined3d_string_buffer *buffer, DWORD argnum ...@@ -6072,17 +6072,19 @@ static const char *get_argreg(struct wined3d_string_buffer *buffer, DWORD argnum
} }
static void gen_ffp_instr(struct wined3d_string_buffer *buffer, unsigned int stage, BOOL color, static void gen_ffp_instr(struct wined3d_string_buffer *buffer, unsigned int stage, BOOL color,
BOOL alpha, DWORD dst, DWORD op, DWORD dw_arg0, DWORD dw_arg1, DWORD dw_arg2) BOOL alpha, BOOL tmp_dst, DWORD op, DWORD dw_arg0, DWORD dw_arg1, DWORD dw_arg2)
{ {
const char *dstmask, *dstreg, *arg0, *arg1, *arg2; const char *dstmask, *dstreg, *arg0, *arg1, *arg2;
unsigned int mul = 1; unsigned int mul = 1;
if(color && alpha) dstmask = ""; if (color && alpha)
else if(color) dstmask = ".xyz"; dstmask = "";
else dstmask = ".w"; else if (color)
dstmask = ".xyz";
else
dstmask = ".w";
if(dst == tempreg) dstreg = "tempreg"; dstreg = tmp_dst ? "tempreg" : "ret";
else dstreg = "ret";
arg0 = get_argreg(buffer, 0, stage, dw_arg0); arg0 = get_argreg(buffer, 0, stage, dw_arg0);
arg1 = get_argreg(buffer, 1, stage, dw_arg1); arg1 = get_argreg(buffer, 1, stage, dw_arg1);
...@@ -6261,7 +6263,7 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con ...@@ -6261,7 +6263,7 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con
if (arg0 == WINED3DTA_TEXTURE || arg1 == WINED3DTA_TEXTURE || arg2 == WINED3DTA_TEXTURE) if (arg0 == WINED3DTA_TEXTURE || arg1 == WINED3DTA_TEXTURE || arg2 == WINED3DTA_TEXTURE)
tex_read |= 1u << stage; tex_read |= 1u << stage;
if (settings->op[stage].dst == tempreg) if (settings->op[stage].tmp_dst)
tempreg_used = TRUE; tempreg_used = TRUE;
if (arg0 == WINED3DTA_TEMP || arg1 == WINED3DTA_TEMP || arg2 == WINED3DTA_TEMP) if (arg0 == WINED3DTA_TEMP || arg1 == WINED3DTA_TEMP || arg2 == WINED3DTA_TEMP)
tempreg_used = TRUE; tempreg_used = TRUE;
...@@ -6493,23 +6495,23 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con ...@@ -6493,23 +6495,23 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con
if (settings->op[stage].aop == WINED3D_TOP_DISABLE) if (settings->op[stage].aop == WINED3D_TOP_DISABLE)
{ {
gen_ffp_instr(&buffer, stage, TRUE, FALSE, settings->op[stage].dst, gen_ffp_instr(&buffer, stage, TRUE, FALSE, settings->op[stage].tmp_dst,
settings->op[stage].cop, settings->op[stage].carg0, settings->op[stage].cop, settings->op[stage].carg0,
settings->op[stage].carg1, settings->op[stage].carg2); settings->op[stage].carg1, settings->op[stage].carg2);
} }
else if (op_equal) else if (op_equal)
{ {
gen_ffp_instr(&buffer, stage, TRUE, TRUE, settings->op[stage].dst, gen_ffp_instr(&buffer, stage, TRUE, TRUE, settings->op[stage].tmp_dst,
settings->op[stage].cop, settings->op[stage].carg0, settings->op[stage].cop, settings->op[stage].carg0,
settings->op[stage].carg1, settings->op[stage].carg2); settings->op[stage].carg1, settings->op[stage].carg2);
} }
else if (settings->op[stage].cop != WINED3D_TOP_BUMPENVMAP else if (settings->op[stage].cop != WINED3D_TOP_BUMPENVMAP
&& settings->op[stage].cop != WINED3D_TOP_BUMPENVMAP_LUMINANCE) && settings->op[stage].cop != WINED3D_TOP_BUMPENVMAP_LUMINANCE)
{ {
gen_ffp_instr(&buffer, stage, TRUE, FALSE, settings->op[stage].dst, gen_ffp_instr(&buffer, stage, TRUE, FALSE, settings->op[stage].tmp_dst,
settings->op[stage].cop, settings->op[stage].carg0, settings->op[stage].cop, settings->op[stage].carg0,
settings->op[stage].carg1, settings->op[stage].carg2); settings->op[stage].carg1, settings->op[stage].carg2);
gen_ffp_instr(&buffer, stage, FALSE, TRUE, settings->op[stage].dst, gen_ffp_instr(&buffer, stage, FALSE, TRUE, settings->op[stage].tmp_dst,
settings->op[stage].aop, settings->op[stage].aarg0, settings->op[stage].aop, settings->op[stage].aarg0,
settings->op[stage].aarg1, settings->op[stage].aarg2); settings->op[stage].aarg1, settings->op[stage].aarg2);
} }
......
...@@ -341,9 +341,8 @@ static GLuint find_tmpreg(const struct texture_stage_op op[MAX_TEXTURES]) ...@@ -341,9 +341,8 @@ static GLuint find_tmpreg(const struct texture_stage_op op[MAX_TEXTURES])
lowest_read = i; lowest_read = i;
} }
if(lowest_write == -1 && op[i].dst == tempreg) { if (lowest_write == -1 && op[i].tmp_dst)
lowest_write = i; lowest_write = i;
}
if(op[i].carg1 == WINED3DTA_TEXTURE || op[i].carg2 == WINED3DTA_TEXTURE || op[i].carg0 == WINED3DTA_TEXTURE || if(op[i].carg1 == WINED3DTA_TEXTURE || op[i].carg2 == WINED3DTA_TEXTURE || op[i].carg0 == WINED3DTA_TEXTURE ||
op[i].aarg1 == WINED3DTA_TEXTURE || op[i].aarg2 == WINED3DTA_TEXTURE || op[i].aarg0 == WINED3DTA_TEXTURE) { op[i].aarg1 == WINED3DTA_TEXTURE || op[i].aarg2 == WINED3DTA_TEXTURE || op[i].aarg0 == WINED3DTA_TEXTURE) {
...@@ -620,14 +619,18 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], ...@@ -620,14 +619,18 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES],
break; break;
} }
if(op[stage].dst == tempreg) { if (op[stage].tmp_dst)
/* If we're writing to D3DTA_TEMP, but never reading from it we don't have to write there in the first place. {
* skip the entire stage, this saves some GPU time /* If we're writing to D3DTA_TEMP, but never reading from it we
*/ * don't have to write there in the first place. Skip the entire
if(tmparg == GL_NONE) continue; * stage, this saves some GPU time. */
if (tmparg == GL_NONE)
continue;
dstreg = tmparg; dstreg = tmparg;
} else { }
else
{
dstreg = GL_REG_0_ATI; dstreg = GL_REG_0_ATI;
} }
......
...@@ -9116,7 +9116,7 @@ static const char *shader_glsl_get_ffp_fragment_op_arg(struct wined3d_string_buf ...@@ -9116,7 +9116,7 @@ static const char *shader_glsl_get_ffp_fragment_op_arg(struct wined3d_string_buf
} }
static void shader_glsl_ffp_fragment_op(struct wined3d_string_buffer *buffer, unsigned int stage, BOOL color, static void shader_glsl_ffp_fragment_op(struct wined3d_string_buffer *buffer, unsigned int stage, BOOL color,
BOOL alpha, DWORD dst, DWORD op, DWORD dw_arg0, DWORD dw_arg1, DWORD dw_arg2) BOOL alpha, BOOL tmp_dst, DWORD op, DWORD dw_arg0, DWORD dw_arg1, DWORD dw_arg2)
{ {
const char *dstmask, *dstreg, *arg0, *arg1, *arg2; const char *dstmask, *dstreg, *arg0, *arg1, *arg2;
...@@ -9127,10 +9127,7 @@ static void shader_glsl_ffp_fragment_op(struct wined3d_string_buffer *buffer, un ...@@ -9127,10 +9127,7 @@ static void shader_glsl_ffp_fragment_op(struct wined3d_string_buffer *buffer, un
else else
dstmask = ".w"; dstmask = ".w";
if (dst == tempreg) dstreg = tmp_dst ? "temp_reg" : "ret";
dstreg = "temp_reg";
else
dstreg = "ret";
arg0 = shader_glsl_get_ffp_fragment_op_arg(buffer, 0, stage, dw_arg0); arg0 = shader_glsl_get_ffp_fragment_op_arg(buffer, 0, stage, dw_arg0);
arg1 = shader_glsl_get_ffp_fragment_op_arg(buffer, 1, stage, dw_arg1); arg1 = shader_glsl_get_ffp_fragment_op_arg(buffer, 1, stage, dw_arg1);
...@@ -9299,7 +9296,7 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv * ...@@ -9299,7 +9296,7 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv *
tfactor_used = TRUE; tfactor_used = TRUE;
if (arg0 == WINED3DTA_TEMP || arg1 == WINED3DTA_TEMP || arg2 == WINED3DTA_TEMP) if (arg0 == WINED3DTA_TEMP || arg1 == WINED3DTA_TEMP || arg2 == WINED3DTA_TEMP)
tempreg_used = TRUE; tempreg_used = TRUE;
if (settings->op[stage].dst == tempreg) if (settings->op[stage].tmp_dst)
tempreg_used = TRUE; tempreg_used = TRUE;
if (arg0 == WINED3DTA_CONSTANT || arg1 == WINED3DTA_CONSTANT || arg2 == WINED3DTA_CONSTANT) if (arg0 == WINED3DTA_CONSTANT || arg1 == WINED3DTA_CONSTANT || arg2 == WINED3DTA_CONSTANT)
tss_const_map |= 1u << stage; tss_const_map |= 1u << stage;
...@@ -9665,23 +9662,23 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv * ...@@ -9665,23 +9662,23 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv *
if (settings->op[stage].aop == WINED3D_TOP_DISABLE) if (settings->op[stage].aop == WINED3D_TOP_DISABLE)
{ {
shader_glsl_ffp_fragment_op(buffer, stage, TRUE, FALSE, settings->op[stage].dst, shader_glsl_ffp_fragment_op(buffer, stage, TRUE, FALSE, settings->op[stage].tmp_dst,
settings->op[stage].cop, settings->op[stage].carg0, settings->op[stage].cop, settings->op[stage].carg0,
settings->op[stage].carg1, settings->op[stage].carg2); settings->op[stage].carg1, settings->op[stage].carg2);
} }
else if (op_equal) else if (op_equal)
{ {
shader_glsl_ffp_fragment_op(buffer, stage, TRUE, TRUE, settings->op[stage].dst, shader_glsl_ffp_fragment_op(buffer, stage, TRUE, TRUE, settings->op[stage].tmp_dst,
settings->op[stage].cop, settings->op[stage].carg0, settings->op[stage].cop, settings->op[stage].carg0,
settings->op[stage].carg1, settings->op[stage].carg2); settings->op[stage].carg1, settings->op[stage].carg2);
} }
else if (settings->op[stage].cop != WINED3D_TOP_BUMPENVMAP else if (settings->op[stage].cop != WINED3D_TOP_BUMPENVMAP
&& settings->op[stage].cop != WINED3D_TOP_BUMPENVMAP_LUMINANCE) && settings->op[stage].cop != WINED3D_TOP_BUMPENVMAP_LUMINANCE)
{ {
shader_glsl_ffp_fragment_op(buffer, stage, TRUE, FALSE, settings->op[stage].dst, shader_glsl_ffp_fragment_op(buffer, stage, TRUE, FALSE, settings->op[stage].tmp_dst,
settings->op[stage].cop, settings->op[stage].carg0, settings->op[stage].cop, settings->op[stage].carg0,
settings->op[stage].carg1, settings->op[stage].carg2); settings->op[stage].carg1, settings->op[stage].carg2);
shader_glsl_ffp_fragment_op(buffer, stage, FALSE, TRUE, settings->op[stage].dst, shader_glsl_ffp_fragment_op(buffer, stage, FALSE, TRUE, settings->op[stage].tmp_dst,
settings->op[stage].aop, settings->op[stage].aarg0, settings->op[stage].aop, settings->op[stage].aarg0,
settings->op[stage].aarg1, settings->op[stage].aarg2); settings->op[stage].aarg1, settings->op[stage].aarg2);
} }
......
...@@ -5493,7 +5493,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d ...@@ -5493,7 +5493,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
settings->op[i].carg0 = settings->op[i].carg1 = settings->op[i].carg2 = ARG_UNUSED; settings->op[i].carg0 = settings->op[i].carg1 = settings->op[i].carg2 = ARG_UNUSED;
settings->op[i].aarg0 = settings->op[i].aarg1 = settings->op[i].aarg2 = ARG_UNUSED; settings->op[i].aarg0 = settings->op[i].aarg1 = settings->op[i].aarg2 = ARG_UNUSED;
settings->op[i].color_fixup = COLOR_FIXUP_IDENTITY; settings->op[i].color_fixup = COLOR_FIXUP_IDENTITY;
settings->op[i].dst = resultreg; settings->op[i].tmp_dst = 0;
settings->op[i].tex_type = WINED3D_GL_RES_TYPE_TEX_1D; settings->op[i].tex_type = WINED3D_GL_RES_TYPE_TEX_1D;
settings->op[i].projected = WINED3D_PROJECTION_NONE; settings->op[i].projected = WINED3D_PROJECTION_NONE;
i++; i++;
...@@ -5638,11 +5638,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d ...@@ -5638,11 +5638,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
settings->op[i].aarg0 = aarg0; settings->op[i].aarg0 = aarg0;
settings->op[i].aarg1 = aarg1; settings->op[i].aarg1 = aarg1;
settings->op[i].aarg2 = aarg2; settings->op[i].aarg2 = aarg2;
settings->op[i].tmp_dst = state->texture_states[i][WINED3D_TSS_RESULT_ARG] == WINED3DTA_TEMP;
if (state->texture_states[i][WINED3D_TSS_RESULT_ARG] == WINED3DTA_TEMP)
settings->op[i].dst = tempreg;
else
settings->op[i].dst = resultreg;
} }
/* Clear unsupported stages */ /* Clear unsupported stages */
......
...@@ -2641,12 +2641,6 @@ enum wined3d_projection_type ...@@ -2641,12 +2641,6 @@ enum wined3d_projection_type
WINED3D_PROJECTION_COUNT4 = 2 WINED3D_PROJECTION_COUNT4 = 2
}; };
enum dst_arg
{
resultreg = 0,
tempreg = 1
};
/***************************************************************************** /*****************************************************************************
* Fixed function pipeline replacements * Fixed function pipeline replacements
*/ */
...@@ -2665,7 +2659,7 @@ struct texture_stage_op ...@@ -2665,7 +2659,7 @@ struct texture_stage_op
struct color_fixup_desc color_fixup; struct color_fixup_desc color_fixup;
unsigned tex_type : 3; unsigned tex_type : 3;
unsigned dst : 1; unsigned tmp_dst : 1;
unsigned projected : 2; unsigned projected : 2;
unsigned padding : 10; unsigned padding : 10;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment