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>
This commit is contained in:
Józef Kucia 2016-05-23 00:41:51 +02:00 committed by Alexandre Julliard
parent 7372e704d0
commit e47a735f76
5 changed files with 17 additions and 10 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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
{

View File

@ -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));

View File

@ -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