Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/context.c | 65 ++++++++++++++++++++++++++++++++++---------------- dlls/wined3d/directx.c | 2 ++ 2 files changed, 46 insertions(+), 21 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index ccfe630e1f25..9a69921b7a17 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -289,39 +289,62 @@ static void context_dump_fbo_attachment(const struct wined3d_gl_info *gl_info, G unsigned int i;
tex_type_str = NULL; - for (i = 0; i < ARRAY_SIZE(texture_type); ++i) + if (gl_info->gl_ops.ext.p_glGetTextureParameteriv) { - if (!gl_info->supported[texture_type[i].extension]) - continue; + GL_EXTCALL(glGetTextureParameteriv(name, GL_TEXTURE_TARGET, &tex_target));
- gl_info->gl_ops.gl.p_glGetIntegerv(texture_type[i].binding, &old_texture); - while (gl_info->gl_ops.gl.p_glGetError()); - - gl_info->gl_ops.gl.p_glBindTexture(texture_type[i].target, name); - if (!gl_info->gl_ops.gl.p_glGetError()) + for (i = 0; i < ARRAY_SIZE(texture_type); ++i) { - tex_target = texture_type[i].target; - tex_type_str = texture_type[i].str; - break; + if (texture_type[i].target == tex_target) + { + tex_type_str = texture_type[i].str; + break; + } } - gl_info->gl_ops.gl.p_glBindTexture(texture_type[i].target, old_texture); + if (i == ARRAY_SIZE(texture_type)) + tex_type_str = wine_dbg_sprintf("%#x", tex_target); + + GL_EXTCALL(glGetTextureLevelParameteriv(name, level, GL_TEXTURE_INTERNAL_FORMAT, &fmt)); + GL_EXTCALL(glGetTextureLevelParameteriv(name, level, GL_TEXTURE_WIDTH, &width)); + GL_EXTCALL(glGetTextureLevelParameteriv(name, level, GL_TEXTURE_HEIGHT, &height)); } - if (!tex_type_str) + else { - FIXME("Cannot find type of texture %d.\n", name); - return; - } + for (i = 0; i < ARRAY_SIZE(texture_type); ++i) + { + if (!gl_info->supported[texture_type[i].extension]) + continue; + + gl_info->gl_ops.gl.p_glGetIntegerv(texture_type[i].binding, &old_texture); + while (gl_info->gl_ops.gl.p_glGetError());
- gl_info->gl_ops.gl.p_glGetTexLevelParameteriv(tex_target, level, GL_TEXTURE_INTERNAL_FORMAT, &fmt); - gl_info->gl_ops.gl.p_glGetTexLevelParameteriv(tex_target, level, GL_TEXTURE_WIDTH, &width); - gl_info->gl_ops.gl.p_glGetTexLevelParameteriv(tex_target, level, GL_TEXTURE_HEIGHT, &height); + gl_info->gl_ops.gl.p_glBindTexture(texture_type[i].target, name); + if (!gl_info->gl_ops.gl.p_glGetError()) + { + tex_target = texture_type[i].target; + tex_type_str = texture_type[i].str; + break; + } + gl_info->gl_ops.gl.p_glBindTexture(texture_type[i].target, old_texture); + } + if (!tex_type_str) + { + FIXME("Cannot find type of texture %d.\n", name); + return; + } + + gl_info->gl_ops.gl.p_glGetTexLevelParameteriv(tex_target, level, GL_TEXTURE_INTERNAL_FORMAT, &fmt); + gl_info->gl_ops.gl.p_glGetTexLevelParameteriv(tex_target, level, GL_TEXTURE_WIDTH, &width); + gl_info->gl_ops.gl.p_glGetTexLevelParameteriv(tex_target, level, GL_TEXTURE_HEIGHT, &height); + + gl_info->gl_ops.gl.p_glBindTexture(tex_target, old_texture); + } }
FIXME(" %s: %s texture %d, %dx%d, format %#x.\n", debug_fboattachment(attachment), tex_type_str, name, width, height, fmt);
- gl_info->gl_ops.gl.p_glBindTexture(tex_target, old_texture); - checkGLcall("Guess texture type"); + checkGLcall("guess texture type"); } else if (type == GL_NONE) { diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 000d0b75469a..1be6d2bce9a9 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -3270,6 +3270,8 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info) USE_GL_FUNC(glGetShaderiv) /* OpenGL 2.0 */ USE_GL_FUNC(glGetShaderSource) /* OpenGL 2.0 */ USE_GL_FUNC(glGetStringi) /* OpenGL 3.0 */ + USE_GL_FUNC(glGetTextureLevelParameteriv) /* OpenGL 4.5 */ + USE_GL_FUNC(glGetTextureParameteriv) /* OpenGL 4.5 */ USE_GL_FUNC(glGetUniformfv) /* OpenGL 2.0 */ USE_GL_FUNC(glGetUniformiv) /* OpenGL 2.0 */ USE_GL_FUNC(glGetUniformLocation) /* OpenGL 2.0 */
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/context.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 9a69921b7a17..e3e48347c27f 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -238,9 +238,11 @@ static void context_dump_fbo_attachment(const struct wined3d_gl_info *gl_info, G } texture_type[] = { - {GL_TEXTURE_2D, GL_TEXTURE_BINDING_2D, "2d", WINED3D_GL_EXT_NONE}, - {GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_BINDING_RECTANGLE_ARB, "rectangle", ARB_TEXTURE_RECTANGLE}, - {GL_TEXTURE_2D_ARRAY, GL_TEXTURE_BINDING_2D_ARRAY, "2d-array", EXT_TEXTURE_ARRAY}, + {GL_TEXTURE_2D, GL_TEXTURE_BINDING_2D, "2d", WINED3D_GL_EXT_NONE}, + {GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_BINDING_RECTANGLE_ARB, "rectangle", ARB_TEXTURE_RECTANGLE}, + {GL_TEXTURE_2D_ARRAY, GL_TEXTURE_BINDING_2D_ARRAY, "2d-array" , EXT_TEXTURE_ARRAY}, + {GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_BINDING_2D_MULTISAMPLE, "2d-ms", ARB_TEXTURE_MULTISAMPLE}, + {GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY, "2d-array-ms", ARB_TEXTURE_MULTISAMPLE}, };
GLint type, name, samples, width, height, old_texture, level, face, fmt, tex_target; @@ -307,6 +309,7 @@ static void context_dump_fbo_attachment(const struct wined3d_gl_info *gl_info, G GL_EXTCALL(glGetTextureLevelParameteriv(name, level, GL_TEXTURE_INTERNAL_FORMAT, &fmt)); GL_EXTCALL(glGetTextureLevelParameteriv(name, level, GL_TEXTURE_WIDTH, &width)); GL_EXTCALL(glGetTextureLevelParameteriv(name, level, GL_TEXTURE_HEIGHT, &height)); + GL_EXTCALL(glGetTextureLevelParameteriv(name, level, GL_TEXTURE_SAMPLES, &samples)); } else { @@ -336,13 +339,17 @@ static void context_dump_fbo_attachment(const struct wined3d_gl_info *gl_info, G gl_info->gl_ops.gl.p_glGetTexLevelParameteriv(tex_target, level, GL_TEXTURE_INTERNAL_FORMAT, &fmt); gl_info->gl_ops.gl.p_glGetTexLevelParameteriv(tex_target, level, GL_TEXTURE_WIDTH, &width); gl_info->gl_ops.gl.p_glGetTexLevelParameteriv(tex_target, level, GL_TEXTURE_HEIGHT, &height); + if (gl_info->supported[ARB_TEXTURE_MULTISAMPLE]) + gl_info->gl_ops.gl.p_glGetTexLevelParameteriv(tex_target, level, GL_TEXTURE_SAMPLES, &samples); + else + samples = 1;
gl_info->gl_ops.gl.p_glBindTexture(tex_target, old_texture); } }
- FIXME(" %s: %s texture %d, %dx%d, format %#x.\n", debug_fboattachment(attachment), - tex_type_str, name, width, height, fmt); + FIXME(" %s: %s texture %d, %dx%d, %d samples, format %#x.\n", + debug_fboattachment(attachment), tex_type_str, name, width, height, samples, fmt);
checkGLcall("guess texture type"); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
The registry key helps to add multisample textures support incrementally without breaking the current support for multisample renderbuffers. It might be also useful to have a possibility to disable multisample textures when they are the default code path for multisampling in wined3d.
Signed-off-by: Józef Kucia jkucia@codeweavers.com ---
Multisample textures provide a superset of functionality in comparision to multisample renderbuffers. The plan is to use multisample textures by default, and prefer them to multisample renderbuffers.
--- dlls/wined3d/directx.c | 2 ++ dlls/wined3d/wined3d_main.c | 3 +++ dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 6 insertions(+)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 1be6d2bce9a9..6dee5ed234fe 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -4244,6 +4244,8 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, WARN("Disabling ARB_draw_indirect because ARB_base_instance is not supported.\n"); gl_info->supported[ARB_DRAW_INDIRECT] = FALSE; } + if (gl_info->supported[ARB_TEXTURE_MULTISAMPLE] && !wined3d_settings.multisample_textures) + gl_info->supported[ARB_TEXTURE_MULTISAMPLE] = FALSE;
wined3d_adapter_init_limits(gl_info);
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c index 28a34a71b6f4..d3d3f2d5a227 100644 --- a/dlls/wined3d/wined3d_main.c +++ b/dlls/wined3d/wined3d_main.c @@ -81,6 +81,7 @@ struct wined3d_settings wined3d_settings = PCI_DEVICE_NONE,/* PCI Device ID */ 0, /* The default of memory is set in init_driver_info */ NULL, /* No wine logo by default */ + FALSE, /* Prefer multisample renderbuffers to multisample textures by default. */ ~0u, /* Don't force a specific sample count by default. */ FALSE, /* No strict draw ordering. */ FALSE, /* Don't range check relative addressing indices in float constants. */ @@ -284,6 +285,8 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL) if (!wined3d_settings.logo) ERR("Failed to allocate logo path memory.\n"); else memcpy(wined3d_settings.logo, buffer, len); } + if (!get_config_key_dword(hkey, appkey, "MultisampleTextures", &wined3d_settings.multisample_textures)) + ERR_(winediag)("Setting multisample textures to %#x.\n", wined3d_settings.multisample_textures); if (!get_config_key_dword(hkey, appkey, "SampleCount", &wined3d_settings.sample_count)) ERR_(winediag)("Forcing sample count to %u. This may not be compatible with all applications.\n", wined3d_settings.sample_count); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index e2527f2a224a..915e10d42d4c 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -391,6 +391,7 @@ struct wined3d_settings /* Memory tracking and object counting. */ UINT64 emulated_textureram; char *logo; + unsigned int multisample_textures; unsigned int sample_count; BOOL strict_draw_ordering; BOOL check_float_constants;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com ---
Multisample textures are disabled when immutable storage is not available, because immutable storage is required for texture views. Multisample textures wouldn't be fully functional without immutable storage.
--- dlls/d3d11/texture.c | 3 --- dlls/wined3d/directx.c | 5 ++++ dlls/wined3d/resource.c | 14 ++++++++++- dlls/wined3d/texture.c | 64 +++++++++++++++++++++++++++++++++---------------- 4 files changed, 61 insertions(+), 25 deletions(-)
diff --git a/dlls/d3d11/texture.c b/dlls/d3d11/texture.c index 4d500c9847d9..39d71cd3d197 100644 --- a/dlls/d3d11/texture.c +++ b/dlls/d3d11/texture.c @@ -512,9 +512,6 @@ HRESULT d3d_texture2d_create(struct d3d_device *device, const D3D11_TEXTURE2D_DE wined3d_private_store_init(&texture->private_store); texture->desc = *desc;
- if (desc->SampleDesc.Count > 1) - FIXME("Multisampled textures not implemented.\n"); - wined3d_desc.resource_type = WINED3D_RTYPE_TEXTURE_2D; wined3d_desc.format = wined3dformat_from_dxgi_format(desc->Format); wined3d_desc.multisample_type = desc->SampleDesc.Count > 1 ? desc->SampleDesc.Count : WINED3D_MULTISAMPLE_NONE; diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 6dee5ed234fe..c8f42fe253a7 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -4246,6 +4246,11 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, } if (gl_info->supported[ARB_TEXTURE_MULTISAMPLE] && !wined3d_settings.multisample_textures) gl_info->supported[ARB_TEXTURE_MULTISAMPLE] = FALSE; + if (gl_info->supported[ARB_TEXTURE_MULTISAMPLE] && !gl_info->supported[ARB_TEXTURE_STORAGE_MULTISAMPLE]) + { + WARN("Disabling ARB_texture_multisample because immutable storage is not supported.\n"); + gl_info->supported[ARB_TEXTURE_MULTISAMPLE] = FALSE; + }
wined3d_adapter_init_limits(gl_info);
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 61ff20679bd4..e3188883205c 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -442,11 +442,23 @@ BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource) void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) { if (!wined3d_resource_is_offscreen(resource) || wined3d_settings.offscreen_rendering_mode != ORM_FBO) + { resource->draw_binding = WINED3D_LOCATION_DRAWABLE; + } else if (resource->multisample_type) - resource->draw_binding = WINED3D_LOCATION_RB_MULTISAMPLE; + { + const struct wined3d_gl_info *gl_info = &resource->device->adapter->gl_info; + if (gl_info->supported[ARB_TEXTURE_MULTISAMPLE]) + resource->draw_binding = WINED3D_LOCATION_TEXTURE_RGB; + else + resource->draw_binding = WINED3D_LOCATION_RB_MULTISAMPLE; + } else if (resource->gl_type == WINED3D_GL_RES_TYPE_RB) + { resource->draw_binding = WINED3D_LOCATION_RB_RESOLVED; + } else + { resource->draw_binding = WINED3D_LOCATION_TEXTURE_RGB; + } } diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index ed1ca21117f0..9a02c1936f7a 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -460,6 +460,13 @@ static unsigned int wined3d_texture_get_gl_sample_count(const struct wined3d_tex { const struct wined3d_format *format = texture->resource.format;
+ /* TODO: NVIDIA expose their Coverage Sample Anti-Aliasing (CSAA) + * feature through type == MULTISAMPLE_XX and quality != 0. This could + * be mapped to GL_NV_framebuffer_multisample_coverage. + * + * AMD have a similar feature called Enhanced Quality Anti-Aliasing + * (EQAA), but it does not have an equivalent OpenGL extension. */ + /* We advertise as many WINED3D_MULTISAMPLE_NON_MASKABLE quality * levels as the count of advertised multisample types for the texture * format. */ @@ -530,21 +537,31 @@ static void wined3d_texture_allocate_gl_mutable_storage(struct wined3d_texture * static void wined3d_texture_allocate_gl_immutable_storage(struct wined3d_texture *texture, GLenum gl_internal_format, const struct wined3d_gl_info *gl_info) { - GLsizei width = wined3d_texture_get_level_pow2_width(texture, 0); + unsigned int samples = wined3d_texture_get_gl_sample_count(texture); GLsizei height = wined3d_texture_get_level_pow2_height(texture, 0); + GLsizei width = wined3d_texture_get_level_pow2_width(texture, 0);
- if (texture->target == GL_TEXTURE_2D_ARRAY) - { - GL_EXTCALL(glTexStorage3D(texture->target, texture->level_count, gl_internal_format, - width, height, texture->layer_count)); - checkGLcall("glTexStorage3D"); - } - else + switch (texture->target) { - GL_EXTCALL(glTexStorage2D(texture->target, texture->level_count, gl_internal_format, - width, height)); - checkGLcall("glTexStorage2D"); + case GL_TEXTURE_2D_ARRAY: + GL_EXTCALL(glTexStorage3D(texture->target, texture->level_count, + gl_internal_format, width, height, texture->layer_count)); + break; + case GL_TEXTURE_2D_MULTISAMPLE: + GL_EXTCALL(glTexStorage2DMultisample(texture->target, samples, + gl_internal_format, width, height, GL_FALSE)); + break; + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + GL_EXTCALL(glTexStorage3DMultisample(texture->target, samples, + gl_internal_format, width, height, texture->layer_count, GL_FALSE)); + break; + default: + GL_EXTCALL(glTexStorage2D(texture->target, texture->level_count, + gl_internal_format, width, height)); + break; } + + checkGLcall("allocate immutable storage"); }
static void wined3d_texture_unload_gl_texture(struct wined3d_texture *texture) @@ -1502,13 +1519,6 @@ static void wined3d_texture_prepare_rb(struct wined3d_texture *texture, if (texture->rb_multisample) return;
- /* TODO: NVIDIA expose their Coverage Sample Anti-Aliasing (CSAA) - * feature through type == MULTISAMPLE_XX and quality != 0. This could - * be mapped to GL_NV_framebuffer_multisample_coverage. - * - * AMD have a similar feature called Enhanced Quality Anti-Aliasing - * (EQAA), but it does not have an equivalent OpenGL extension. */ - samples = wined3d_texture_get_gl_sample_count(texture);
gl_info->fbo_ops.glGenRenderbuffers(1, &texture->rb_multisample); @@ -2189,11 +2199,23 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 texture->pow2_matrix[5] = 1.0f; } if (desc->usage & WINED3DUSAGE_LEGACY_CUBEMAP) + { texture->target = GL_TEXTURE_CUBE_MAP_ARB; - else if (layer_count > 1) - texture->target = GL_TEXTURE_2D_ARRAY; + } + else if (desc->multisample_type && gl_info->supported[ARB_TEXTURE_MULTISAMPLE]) + { + if (layer_count > 1) + texture->target = GL_TEXTURE_2D_MULTISAMPLE_ARRAY; + else + texture->target = GL_TEXTURE_2D_MULTISAMPLE; + } else - texture->target = GL_TEXTURE_2D; + { + if (layer_count > 1) + texture->target = GL_TEXTURE_2D_ARRAY; + else + texture->target = GL_TEXTURE_2D; + } } texture->pow2_matrix[10] = 1.0f; texture->pow2_matrix[15] = 1.0f;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
This might be called from wined3d_device_reset().
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/texture.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 9a02c1936f7a..2c2ff63b24aa 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -1347,9 +1347,9 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT return WINED3DERR_INVALIDCALL; }
- if (texture->resource.type == WINED3D_RTYPE_TEXTURE_3D) + if (texture->resource.type != WINED3D_RTYPE_TEXTURE_2D) { - WARN("Not supported on 3D textures.\n"); + WARN("Not supported on %s.\n", debug_d3dresourcetype(texture->resource.type)); return WINED3DERR_INVALIDCALL; }
@@ -1403,6 +1403,12 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT sub_resource->size = texture->slice_pitch; sub_resource->locations = WINED3D_LOCATION_DISCARDED;
+ if (multisample_type && gl_info->supported[ARB_TEXTURE_MULTISAMPLE]) + texture->target = GL_TEXTURE_2D_MULTISAMPLE; + else + texture->target = GL_TEXTURE_2D; + texture->sub_resources[0].u.surface->texture_target = texture->target; + if (((width & (width - 1)) || (height & (height - 1))) && !gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] && !gl_info->supported[ARB_TEXTURE_RECTANGLE] && !gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]) {
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com ---
This is a test for the previous patch.
--- dlls/d3d9/tests/device.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index a9fd4e4d30fa..7c7017d528a7 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -12122,6 +12122,65 @@ static void test_clip_planes_limits(void) DestroyWindow(window); }
+static void test_swapchain_multisample_reset(void) +{ + IDirect3DSwapChain9 *swapchain; + D3DPRESENT_PARAMETERS d3dpp; + IDirect3DDevice9 *device; + DWORD quality_levels; + IDirect3D9 *d3d; + ULONG refcount; + HWND window; + HRESULT hr; + + window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + + if (IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES, &quality_levels) == D3DERR_NOTAVAILABLE) + { + skip("Multisampling not supported for D3DFMT_A8R8G8B8.\n"); + IDirect3D9_Release(d3d); + DestroyWindow(window); + return; + } + + if (!(device = create_device(d3d, window, NULL))) + { + skip("Failed to create a 3D device.\n"); + IDirect3D9_Release(d3d); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0); + ok(hr == D3D_OK, "Failed to clear, hr %#x.\n", hr); + + hr = IDirect3DDevice9_GetSwapChain(device, 0, &swapchain); + ok(hr == D3D_OK, "Failed to get the implicit swapchain, hr %#x.\n", hr); + hr = IDirect3DSwapChain9_GetPresentParameters(swapchain, &d3dpp); + ok(hr == D3D_OK, "Failed to get present parameters, hr %#x.\n", hr); + ok(d3dpp.MultiSampleType == D3DMULTISAMPLE_NONE, + "Got unexpected multisample type %#x.\n", d3dpp.MultiSampleType); + IDirect3DSwapChain9_Release(swapchain); + + d3dpp.MultiSampleType = D3DMULTISAMPLE_2_SAMPLES; + d3dpp.MultiSampleQuality = quality_levels - 1; + hr = IDirect3DDevice9_Reset(device, &d3dpp); + ok(hr == D3D_OK, "Failed to reset device, hr %#x.\n", hr); + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0); + ok(hr == D3D_OK, "Failed to clear, hr %#x.\n", hr); + + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D9_Release(d3d); + DestroyWindow(window); +} + START_TEST(device) { WNDCLASSA wc = {0}; @@ -12243,6 +12302,7 @@ START_TEST(device) test_destroyed_window(); test_lockable_backbuffer(); test_clip_planes_limits(); + test_swapchain_multisample_reset();
UnregisterClassA("d3d9_test_wc", GetModuleHandleA(NULL)); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
GLSL 1.50 is required for SM4+.
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/glsl_shader.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index b3c6404a4d5b..6f59cf15b81b 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -7481,8 +7481,6 @@ 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/utils.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index a31baa43a719..247f5da2afd8 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -4658,6 +4658,8 @@ const char *debug_d3dstate(DWORD state) return "STATE_COLOR_KEY"; if (STATE_IS_STREAM_OUTPUT(state)) return "STATE_STREAM_OUTPUT"; + if (STATE_IS_BLEND(state)) + return "STATE_BLEND";
return wine_dbg_sprintf("UNKNOWN_STATE(%#x)", state); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com