Commit f4d9f8c2 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

wined3d: Fully initialize partially written varyings in SM3 shaders.

parent a385c9ea
......@@ -4317,7 +4317,7 @@ static GLuint shader_arb_generate_vshader(const struct wined3d_shader *shader,
const char *one = arb_get_helper_value(WINED3D_SHADER_TYPE_VERTEX, ARB_ONE);
for(i = 0; i < MAX_REG_TEXCRD; i++)
{
if (reg_maps->texcoord_mask[i] && reg_maps->texcoord_mask[i] != WINED3DSP_WRITEMASK_ALL)
if (reg_maps->u.texcoord_mask[i] && reg_maps->u.texcoord_mask[i] != WINED3DSP_WRITEMASK_ALL)
shader_addline(buffer, "MOV result.texcoord[%u].w, %s\n", i, one);
}
}
......
......@@ -4858,9 +4858,8 @@ static void handle_ps3_input(struct shader_glsl_priv *priv,
continue;
if (set[in_idx] == ~0u)
set[in_idx] = mask;
else
set[in_idx] |= mask;
set[in_idx] = 0;
set[in_idx] |= mask & reg_maps_out->u.output_registers_mask[output->register_idx];
shader_glsl_write_mask_to_str(mask, reg_mask);
shader_addline(buffer, "%s%s = vs_out[%u]%s;\n",
......
......@@ -889,16 +889,15 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
shader_version.type, constf_size))
return WINED3DERR_INVALIDCALL;
/* WINED3DSPR_TEXCRDOUT is the same as WINED3DSPR_OUTPUT. _OUTPUT can be > MAX_REG_TEXCRD and
* is used in >= 3.0 shaders. Filter 3.0 shaders to prevent overflows, and also filter pixel
* shaders because TECRDOUT isn't used in them, but future register types might cause issues */
if (shader_version.type == WINED3D_SHADER_TYPE_VERTEX && shader_version.major < 3)
if (shader_version.type == WINED3D_SHADER_TYPE_VERTEX)
{
UINT idx = ins.dst[i].reg.idx[0].offset;
switch (ins.dst[i].reg.type)
{
case WINED3DSPR_RASTOUT:
if (shader_version.major >= 3)
break;
switch (idx)
{
case 0: /* oPos */
......@@ -922,6 +921,8 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
break;
case WINED3DSPR_ATTROUT:
if (shader_version.major >= 3)
break;
if (idx < 2)
{
idx += 8;
......@@ -939,8 +940,12 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
break;
case WINED3DSPR_TEXCRDOUT:
reg_maps->texcoord_mask[idx] |= ins.dst[i].write_mask;
if (shader_version.major >= 3)
{
reg_maps->u.output_registers_mask[idx] |= ins.dst[i].write_mask;
break;
}
reg_maps->u.texcoord_mask[idx] |= ins.dst[i].write_mask;
if (reg_maps->output_registers & (1u << idx))
{
output_signature_elements[idx].mask |= ins.dst[i].write_mask;
......
......@@ -609,24 +609,28 @@ struct wined3d_shader_sampler_map
struct wined3d_shader_reg_maps
{
struct wined3d_shader_version shader_version;
BYTE texcoord; /* MAX_REG_TEXCRD, 8 */
BYTE address; /* MAX_REG_ADDR, 1 */
WORD labels; /* MAX_LABELS, 16 */
DWORD temporary; /* MAX_REG_TEMP, 32 */
DWORD *constf; /* pixel, vertex */
DWORD texcoord_mask[MAX_REG_TEXCRD]; /* vertex < 3.0 */
DWORD input_registers; /* max(MAX_REG_INPUT, MAX_ATTRIBS), 32 */
DWORD output_registers; /* MAX_REG_OUTPUT, 32 */
WORD integer_constants; /* MAX_CONST_I, 16 */
WORD boolean_constants; /* MAX_CONST_B, 16 */
WORD local_int_consts; /* MAX_CONST_I, 16 */
WORD local_bool_consts; /* MAX_CONST_B, 16 */
BYTE texcoord; /* MAX_REG_TEXCRD, 8 */
BYTE address; /* MAX_REG_ADDR, 1 */
WORD labels; /* MAX_LABELS, 16 */
DWORD temporary; /* MAX_REG_TEMP, 32 */
DWORD *constf; /* pixel, vertex */
union
{
DWORD texcoord_mask[MAX_REG_TEXCRD]; /* vertex < 3.0 */
BYTE output_registers_mask[MAX_REG_OUTPUT]; /* vertex >= 3.0 */
} u;
DWORD input_registers; /* max(MAX_REG_INPUT, MAX_ATTRIBS), 32 */
DWORD output_registers; /* MAX_REG_OUTPUT, 32 */
WORD integer_constants; /* MAX_CONST_I, 16 */
WORD boolean_constants; /* MAX_CONST_B, 16 */
WORD local_int_consts; /* MAX_CONST_I, 16 */
WORD local_bool_consts; /* MAX_CONST_B, 16 */
UINT cb_sizes[WINED3D_MAX_CBS];
struct wined3d_shader_resource_info resource_info[max(MAX_FRAGMENT_SAMPLERS, MAX_VERTEX_SAMPLERS)];
struct wined3d_shader_sampler_map sampler_map;
BYTE bumpmat; /* MAX_TEXTURES, 8 */
BYTE luminanceparams; /* MAX_TEXTURES, 8 */
BYTE bumpmat; /* MAX_TEXTURES, 8 */
BYTE luminanceparams; /* MAX_TEXTURES, 8 */
WORD usesnrm : 1;
WORD vpos : 1;
......
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