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
}
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;
unsigned int mul = 1;
if(color && alpha) dstmask = "";
else if(color) dstmask = ".xyz";
else dstmask = ".w";
if (color && alpha)
dstmask = "";
else if (color)
dstmask = ".xyz";
else
dstmask = ".w";
if(dst == tempreg) dstreg = "tempreg";
else dstreg = "ret";
dstreg = tmp_dst ? "tempreg" : "ret";
arg0 = get_argreg(buffer, 0, stage, dw_arg0);
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
if (arg0 == WINED3DTA_TEXTURE || arg1 == WINED3DTA_TEXTURE || arg2 == WINED3DTA_TEXTURE)
tex_read |= 1u << stage;
if (settings->op[stage].dst == tempreg)
if (settings->op[stage].tmp_dst)
tempreg_used = TRUE;
if (arg0 == WINED3DTA_TEMP || arg1 == WINED3DTA_TEMP || arg2 == WINED3DTA_TEMP)
tempreg_used = TRUE;
......@@ -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)
{
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].carg1, settings->op[stage].carg2);
}
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].carg1, settings->op[stage].carg2);
}
else if (settings->op[stage].cop != WINED3D_TOP_BUMPENVMAP
&& 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].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].aarg1, settings->op[stage].aarg2);
}
......
......@@ -341,9 +341,8 @@ static GLuint find_tmpreg(const struct texture_stage_op op[MAX_TEXTURES])
lowest_read = i;
}
if(lowest_write == -1 && op[i].dst == tempreg) {
if (lowest_write == -1 && op[i].tmp_dst)
lowest_write = i;
}
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) {
......@@ -620,14 +619,18 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES],
break;
}
if(op[stage].dst == tempreg) {
/* 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(tmparg == GL_NONE) continue;
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 (tmparg == GL_NONE)
continue;
dstreg = tmparg;
} else {
}
else
{
dstreg = GL_REG_0_ATI;
}
......
......@@ -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,
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;
......@@ -9127,10 +9127,7 @@ static void shader_glsl_ffp_fragment_op(struct wined3d_string_buffer *buffer, un
else
dstmask = ".w";
if (dst == tempreg)
dstreg = "temp_reg";
else
dstreg = "ret";
dstreg = tmp_dst ? "temp_reg" : "ret";
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);
......@@ -9299,7 +9296,7 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv *
tfactor_used = TRUE;
if (arg0 == WINED3DTA_TEMP || arg1 == WINED3DTA_TEMP || arg2 == WINED3DTA_TEMP)
tempreg_used = TRUE;
if (settings->op[stage].dst == tempreg)
if (settings->op[stage].tmp_dst)
tempreg_used = TRUE;
if (arg0 == WINED3DTA_CONSTANT || arg1 == WINED3DTA_CONSTANT || arg2 == WINED3DTA_CONSTANT)
tss_const_map |= 1u << stage;
......@@ -9665,23 +9662,23 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv *
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].carg1, settings->op[stage].carg2);
}
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].carg1, settings->op[stage].carg2);
}
else if (settings->op[stage].cop != WINED3D_TOP_BUMPENVMAP
&& 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].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].aarg1, settings->op[stage].aarg2);
}
......
......@@ -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].aarg0 = settings->op[i].aarg1 = settings->op[i].aarg2 = ARG_UNUSED;
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].projected = WINED3D_PROJECTION_NONE;
i++;
......@@ -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].aarg1 = aarg1;
settings->op[i].aarg2 = aarg2;
if (state->texture_states[i][WINED3D_TSS_RESULT_ARG] == WINED3DTA_TEMP)
settings->op[i].dst = tempreg;
else
settings->op[i].dst = resultreg;
settings->op[i].tmp_dst = state->texture_states[i][WINED3D_TSS_RESULT_ARG] == WINED3DTA_TEMP;
}
/* Clear unsupported stages */
......
......@@ -2641,12 +2641,6 @@ enum wined3d_projection_type
WINED3D_PROJECTION_COUNT4 = 2
};
enum dst_arg
{
resultreg = 0,
tempreg = 1
};
/*****************************************************************************
* Fixed function pipeline replacements
*/
......@@ -2665,7 +2659,7 @@ struct texture_stage_op
struct color_fixup_desc color_fixup;
unsigned tex_type : 3;
unsigned dst : 1;
unsigned tmp_dst : 1;
unsigned projected : 2;
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