=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Implement ld2dms instruction.
Alexandre Julliard
julliard at winehq.org
Mon Feb 5 16:48:26 CST 2018
Module: wine
Branch: master
Commit: f2e614b1f898de74276bef8a612420b6fb2d5b5d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=f2e614b1f898de74276bef8a612420b6fb2d5b5d
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Mon Feb 5 13:13:39 2018 +0100
wined3d: Implement ld2dms instruction.
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wined3d/glsl_shader.c | 27 +++++++++++++++++++--------
dlls/wined3d/shader.c | 1 +
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 03684b6..6f54b31 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -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,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index e59b9e5..c775df0 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -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))
{
More information about the wine-cvs
mailing list