Module: wine Branch: master Commit: e47a735f762ebe1545bb366c7e9e2b90db7c7f80 URL: http://source.winehq.org/git/wine.git/?a=commit;h=e47a735f762ebe1545bb366c7e...
Author: Józef Kucia jkucia@codeweavers.com Date: Mon May 23 00:41:51 2016 +0200
wined3d: Add wined3d creation flag for selecting unbound resource color.
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
---
dlls/d3d8/directx.c | 3 ++- dlls/d3d9/directx.c | 2 +- dlls/ddraw/ddraw_private.h | 3 ++- dlls/wined3d/device.c | 18 +++++++++++------- include/wine/wined3d.h | 1 + 5 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c index 3f42c5e..18753cd 100644 --- a/dlls/d3d8/directx.c +++ b/dlls/d3d8/directx.c @@ -431,7 +431,8 @@ static const struct IDirect3D8Vtbl d3d8_vtbl = BOOL d3d8_init(struct d3d8 *d3d8) { DWORD flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING - | WINED3D_HANDLE_RESTORE | WINED3D_PIXEL_CENTER_INTEGER; + | WINED3D_HANDLE_RESTORE | WINED3D_PIXEL_CENTER_INTEGER + | WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR;
d3d8->IDirect3D8_iface.lpVtbl = &d3d8_vtbl; d3d8->refcount = 1; diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c index f6d32b0..8f5f143 100644 --- a/dlls/d3d9/directx.c +++ b/dlls/d3d9/directx.c @@ -664,7 +664,7 @@ static const struct IDirect3D9ExVtbl d3d9_vtbl = BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended) { DWORD flags = WINED3D_PRESENT_CONVERSION | WINED3D_HANDLE_RESTORE | WINED3D_PIXEL_CENTER_INTEGER - | WINED3D_SRGB_READ_WRITE_CONTROL; + | WINED3D_SRGB_READ_WRITE_CONTROL | WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR;
if (!extended) flags |= WINED3D_VIDMEM_ACCOUNTING; diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index 26bc242..b3b171a 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -60,7 +60,8 @@ struct FvfToDecl #define DDRAW_STRIDE_ALIGNMENT 8
#define DDRAW_WINED3D_FLAGS (WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING \ - | WINED3D_RESTORE_MODE_ON_ACTIVATE | WINED3D_FOCUS_MESSAGES | WINED3D_PIXEL_CENTER_INTEGER) + | WINED3D_RESTORE_MODE_ON_ACTIVATE | WINED3D_FOCUS_MESSAGES | WINED3D_PIXEL_CENTER_INTEGER \ + | WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR)
enum ddraw_device_state { diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 967a831..5bac3d0 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -682,19 +682,23 @@ out: /* Context activation is done by the caller. */ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context) { + const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; unsigned int i, j, count; + DWORD color; + + if (d3d_info->wined3d_creation_flags & WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR) + color = 0x000000ff; + else + color = 0x00000000; + /* Under DirectX you can sample even if no texture is bound, whereas * OpenGL will only allow that when a valid texture is bound. * We emulate this by creating dummy textures and binding them * to each texture stage when the currently set D3D texture is NULL. */ - count = min(MAX_COMBINED_SAMPLERS, gl_info->limits.combined_samplers); for (i = 0; i < count; ++i) { - static const DWORD d3d10_color = 0x00000000; - static const DWORD color = 0x000000ff; - /* Make appropriate texture active */ context_active_texture(context, gl_info, i);
@@ -732,7 +736,8 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_ gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_3D, device->dummy_texture_3d[i]); checkGLcall("glBindTexture");
- GL_EXTCALL(glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA8, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &color)); + GL_EXTCALL(glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA8, 1, 1, 1, 0, + GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &color)); checkGLcall("glTexImage3D"); }
@@ -763,7 +768,7 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_ checkGLcall("glBindTexture");
GL_EXTCALL(glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA8, 1, 1, 1, 0, - GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &d3d10_color)); + GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &color)); checkGLcall("glTexImage3D"); } } @@ -820,7 +825,6 @@ static void create_default_sampler(struct wined3d_device *device) * sampler object is used to emulate the direct resource access when there is no sampler state * to use. */ - if (gl_info->supported[ARB_SAMPLER_OBJECTS]) { GL_EXTCALL(glGenSamplers(1, &device->default_sampler)); diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 8429bea..e31f9ca 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -1237,6 +1237,7 @@ enum wined3d_display_rotation #define WINED3D_PIXEL_CENTER_INTEGER 0x00000080 #define WINED3D_LEGACY_FFP_LIGHTING 0x00000100 #define WINED3D_SRGB_READ_WRITE_CONTROL 0x00000200 +#define WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR 0x00000400
#define WINED3D_RESZ_CODE 0x7fa05000