wined3d: Implement ld2dms instruction.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
780ec0c1f9
commit
f2e614b1f8
|
@ -5975,15 +5975,14 @@ static void shader_glsl_resinfo(const struct wined3d_shader_instruction *ins)
|
|||
shader_addline(ins->ctx->buffer, ")%s);\n", dst_swizzle);
|
||||
}
|
||||
|
||||
/* FIXME: The current implementation does not handle multisample textures correctly. */
|
||||
static void shader_glsl_ld(const struct wined3d_shader_instruction *ins)
|
||||
{
|
||||
const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps;
|
||||
struct glsl_src_param coord_param, lod_param, sample_param;
|
||||
unsigned int resource_idx, sampler_idx, sampler_bind_idx;
|
||||
struct glsl_src_param coord_param, lod_param;
|
||||
struct glsl_sample_function sample_function;
|
||||
DWORD flags = WINED3D_GLSL_SAMPLE_LOAD;
|
||||
BOOL has_lod_param;
|
||||
BOOL has_lod_param, multisample;
|
||||
|
||||
if (wined3d_shader_instruction_has_texel_offset(ins))
|
||||
flags |= WINED3D_GLSL_SAMPLE_OFFSET;
|
||||
|
@ -5996,15 +5995,27 @@ static void shader_glsl_ld(const struct wined3d_shader_instruction *ins)
|
|||
ERR("Invalid resource index %u.\n", resource_idx);
|
||||
return;
|
||||
}
|
||||
has_lod_param = reg_maps->resource_info[resource_idx].type != WINED3D_SHADER_RESOURCE_BUFFER;
|
||||
multisample = reg_maps->resource_info[resource_idx].type == WINED3D_SHADER_RESOURCE_TEXTURE_2DMS
|
||||
|| reg_maps->resource_info[resource_idx].type == WINED3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY;
|
||||
has_lod_param = reg_maps->resource_info[resource_idx].type != WINED3D_SHADER_RESOURCE_BUFFER
|
||||
&& !multisample;
|
||||
|
||||
shader_glsl_get_sample_function(ins->ctx, resource_idx, sampler_idx, flags, &sample_function);
|
||||
shader_glsl_add_src_param(ins, &ins->src[0], sample_function.coord_mask, &coord_param);
|
||||
shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_3, &lod_param);
|
||||
sampler_bind_idx = shader_glsl_find_sampler(®_maps->sampler_map, resource_idx, sampler_idx);
|
||||
shader_glsl_gen_sample_code(ins, sampler_bind_idx, &sample_function, ins->src[1].swizzle,
|
||||
NULL, NULL, has_lod_param ? lod_param.param_str : NULL, &ins->texel_offset,
|
||||
"%s", coord_param.param_str);
|
||||
if (multisample)
|
||||
{
|
||||
shader_glsl_add_src_param(ins, &ins->src[2], WINED3DSP_WRITEMASK_0, &sample_param);
|
||||
shader_glsl_gen_sample_code(ins, sampler_bind_idx, &sample_function, ins->src[1].swizzle,
|
||||
NULL, NULL, NULL, &ins->texel_offset, "%s, %s", coord_param.param_str, sample_param.param_str);
|
||||
}
|
||||
else
|
||||
{
|
||||
shader_glsl_gen_sample_code(ins, sampler_bind_idx, &sample_function, ins->src[1].swizzle,
|
||||
NULL, NULL, has_lod_param ? lod_param.param_str : NULL, &ins->texel_offset,
|
||||
"%s", coord_param.param_str);
|
||||
}
|
||||
shader_glsl_release_sample_function(ins->ctx, &sample_function);
|
||||
}
|
||||
|
||||
|
@ -11149,7 +11160,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
|
|||
/* WINED3DSIH_ITOF */ shader_glsl_to_float,
|
||||
/* WINED3DSIH_LABEL */ shader_glsl_label,
|
||||
/* WINED3DSIH_LD */ shader_glsl_ld,
|
||||
/* WINED3DSIH_LD2DMS */ NULL,
|
||||
/* WINED3DSIH_LD2DMS */ shader_glsl_ld,
|
||||
/* WINED3DSIH_LD_RAW */ shader_glsl_ld_raw_structured,
|
||||
/* WINED3DSIH_LD_STRUCTURED */ shader_glsl_ld_raw_structured,
|
||||
/* WINED3DSIH_LD_UAV_TYPED */ shader_glsl_ld_uav,
|
||||
|
|
|
@ -1676,6 +1676,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
|
|||
WINED3D_SAMPLER_DEFAULT, reg_maps->sampler_map.count);
|
||||
}
|
||||
else if (ins.handler_idx == WINED3DSIH_LD
|
||||
|| ins.handler_idx == WINED3DSIH_LD2DMS
|
||||
|| (ins.handler_idx == WINED3DSIH_LD_RAW && ins.src[1].reg.type == WINED3DSPR_RESOURCE)
|
||||
|| (ins.handler_idx == WINED3DSIH_RESINFO && ins.src[1].reg.type == WINED3DSPR_RESOURCE))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue