[PATCH 1/6] wined3d: Add wined3d creation flag for selecting unbound resource color.
Józef Kucia
jkucia at codeweavers.com
Fri May 20 04:47:25 CDT 2016
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
dlls/dxgi/factory.c | 2 +-
dlls/wined3d/device.c | 18 +++++++++++-------
include/wine/wined3d.h | 1 +
3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c
index 1af7f72..1ea5791 100644
--- a/dlls/dxgi/factory.c
+++ b/dlls/dxgi/factory.c
@@ -314,7 +314,7 @@ static HRESULT dxgi_factory_init(struct dxgi_factory *factory, BOOL extended)
wined3d_private_store_init(&factory->private_store);
wined3d_mutex_lock();
- factory->wined3d = wined3d_create(0);
+ factory->wined3d = wined3d_create(WINED3D_UNBOUND_RESOURCE_COLOR_ZERO);
wined3d_mutex_unlock();
if (!factory->wined3d)
{
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index da83b56..b0c2d51 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_UNBOUND_RESOURCE_COLOR_ZERO)
+ color = 0x00000000;
+ else
+ color = 0x000000ff;
+
/* 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..79ac440 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_UNBOUND_RESOURCE_COLOR_ZERO 0x00000400
#define WINED3D_RESZ_CODE 0x7fa05000
--
2.7.3
More information about the wine-patches
mailing list