Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/directx.c | 7 +++++++ dlls/wined3d/wined3d_gl.h | 1 + 2 files changed, 8 insertions(+)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 1586bdc82147..4a69b287e226 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -184,6 +184,7 @@ static const struct wined3d_extension_map gl_extension_map[] = {"GL_ARB_texture_gather", ARB_TEXTURE_GATHER }, {"GL_ARB_texture_mirrored_repeat", ARB_TEXTURE_MIRRORED_REPEAT }, {"GL_ARB_texture_mirror_clamp_to_edge", ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE}, + {"GL_ARB_texture_multisample", ARB_TEXTURE_MULTISAMPLE }, {"GL_ARB_texture_non_power_of_two", ARB_TEXTURE_NON_POWER_OF_TWO }, {"GL_ARB_texture_query_levels", ARB_TEXTURE_QUERY_LEVELS }, {"GL_ARB_texture_rectangle", ARB_TEXTURE_RECTANGLE }, @@ -2888,6 +2889,11 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info) USE_GL_FUNC(glCompressedTexSubImage2DARB) USE_GL_FUNC(glCompressedTexSubImage3DARB) USE_GL_FUNC(glGetCompressedTexImageARB) + /* GL_ARB_texture_multisample */ + USE_GL_FUNC(glGetMultisamplefv); + USE_GL_FUNC(glSampleMaski); + USE_GL_FUNC(glTexImage2DMultisample); + USE_GL_FUNC(glTexImage3DMultisample); /* GL_ARB_texture_storage */ USE_GL_FUNC(glTexStorage1D) USE_GL_FUNC(glTexStorage2D) @@ -3868,6 +3874,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, {ARB_PROVOKING_VERTEX, MAKEDWORD_VERSION(3, 2)}, {ARB_SEAMLESS_CUBE_MAP, MAKEDWORD_VERSION(3, 2)}, {ARB_SYNC, MAKEDWORD_VERSION(3, 2)}, + {ARB_TEXTURE_MULTISAMPLE, MAKEDWORD_VERSION(3, 2)}, {ARB_VERTEX_ARRAY_BGRA, MAKEDWORD_VERSION(3, 2)},
{ARB_BLEND_FUNC_EXTENDED, MAKEDWORD_VERSION(3, 3)}, diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index 0894c946db83..1bbdaa20c7cb 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -117,6 +117,7 @@ enum wined3d_gl_extension ARB_TEXTURE_GATHER, ARB_TEXTURE_MIRRORED_REPEAT, ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE, + ARB_TEXTURE_MULTISAMPLE, ARB_TEXTURE_NON_POWER_OF_TWO, ARB_TEXTURE_QUERY_LEVELS, ARB_TEXTURE_RECTANGLE,
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/directx.c | 5 +++++ dlls/wined3d/wined3d_gl.h | 1 + 2 files changed, 6 insertions(+)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 4a69b287e226..000d0b75469a 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -191,6 +191,7 @@ static const struct wined3d_extension_map gl_extension_map[] = {"GL_ARB_texture_rg", ARB_TEXTURE_RG }, {"GL_ARB_texture_rgb10_a2ui", ARB_TEXTURE_RGB10_A2UI }, {"GL_ARB_texture_storage", ARB_TEXTURE_STORAGE }, + {"GL_ARB_texture_storage_multisample", ARB_TEXTURE_STORAGE_MULTISAMPLE}, {"GL_ARB_texture_swizzle", ARB_TEXTURE_SWIZZLE }, {"GL_ARB_texture_view", ARB_TEXTURE_VIEW }, {"GL_ARB_timer_query", ARB_TIMER_QUERY }, @@ -2898,6 +2899,9 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info) USE_GL_FUNC(glTexStorage1D) USE_GL_FUNC(glTexStorage2D) USE_GL_FUNC(glTexStorage3D) + /* GL_ARB_texture_storage_multisample */ + USE_GL_FUNC(glTexStorage2DMultisample); + USE_GL_FUNC(glTexStorage3DMultisample); /* GL_ARB_texture_view */ USE_GL_FUNC(glTextureView) /* GL_ARB_timer_query */ @@ -3921,6 +3925,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, {ARB_STENCIL_TEXTURING, MAKEDWORD_VERSION(4, 3)}, {ARB_TEXTURE_BUFFER_RANGE, MAKEDWORD_VERSION(4, 3)}, {ARB_TEXTURE_QUERY_LEVELS, MAKEDWORD_VERSION(4, 3)}, + {ARB_TEXTURE_STORAGE_MULTISAMPLE, MAKEDWORD_VERSION(4, 2)}, {ARB_TEXTURE_VIEW, MAKEDWORD_VERSION(4, 3)},
{ARB_CLEAR_TEXTURE, MAKEDWORD_VERSION(4, 4)}, diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index 1bbdaa20c7cb..a3dee2435953 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -124,6 +124,7 @@ enum wined3d_gl_extension ARB_TEXTURE_RG, ARB_TEXTURE_RGB10_A2UI, ARB_TEXTURE_STORAGE, + ARB_TEXTURE_STORAGE_MULTISAMPLE, ARB_TEXTURE_SWIZZLE, ARB_TEXTURE_VIEW, ARB_TIMER_QUERY,
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/glsl_shader.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index e18a99f066a0..03684b6fa330 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -2591,6 +2591,14 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont sampler_type = "samplerCubeArray"; break;
+ case WINED3D_SHADER_RESOURCE_TEXTURE_2DMS: + sampler_type = "sampler2DMS"; + break; + + case WINED3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY: + sampler_type = "sampler2DMSArray"; + break; + default: sampler_type = "unsupported_sampler"; FIXME("Unhandled resource type %#x.\n", reg_maps->resource_info[entry->resource_idx].type); @@ -7446,6 +7454,8 @@ static void shader_glsl_enable_extensions(struct wined3d_string_buffer *buffer, shader_addline(buffer, "#extension GL_ARB_texture_cube_map_array : enable\n"); if (gl_info->supported[ARB_TEXTURE_GATHER]) shader_addline(buffer, "#extension GL_ARB_texture_gather : enable\n"); + if (gl_info->supported[ARB_TEXTURE_MULTISAMPLE]) + shader_addline(buffer, "#extension GL_ARB_texture_multisample : enable\n"); if (gl_info->supported[ARB_TEXTURE_QUERY_LEVELS]) shader_addline(buffer, "#extension GL_ARB_texture_query_levels : enable\n"); if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT])
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- 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 03684b6fa330..6f54b3177fe9 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 e59b9e5bfbe1..c775df0cc24e 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)) {
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
It's validated in wined3d_texture_blt().
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/device.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 0c415d1c68df..2d1603f0b097 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1931,8 +1931,7 @@ static void resolve_depth_buffer(struct wined3d_state *state) struct wined3d_rendertarget_view *src_view; RECT src_rect, dst_rect;
- if (!dst_texture || dst_texture->resource.type != WINED3D_RTYPE_TEXTURE_2D - || !(dst_texture->resource.format_flags & WINED3DFMT_FLAG_DEPTH)) + if (!dst_texture || !(dst_texture->resource.format_flags & WINED3DFMT_FLAG_DEPTH)) return;
if (!(src_view = state->fb->depth_stencil))
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com