wined3d: Implement primitive restart.

Based on a patch by Andrew Wesie.

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-12-07 12:43:01 +01:00 committed by Alexandre Julliard
parent 49f6aa32ef
commit ffcea8af77
7 changed files with 23 additions and 5 deletions

View File

@ -432,7 +432,7 @@ BOOL d3d8_init(struct d3d8 *d3d8)
{
DWORD flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING
| WINED3D_HANDLE_RESTORE | WINED3D_PIXEL_CENTER_INTEGER
| WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR;
| WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR | WINED3D_NO_PRIMITIVE_RESTART;
d3d8->IDirect3D8_iface.lpVtbl = &d3d8_vtbl;
d3d8->refcount = 1;

View File

@ -664,7 +664,8 @@ 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_LEGACY_UNBOUND_RESOURCE_COLOR;
| WINED3D_SRGB_READ_WRITE_CONTROL | WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR
| WINED3D_NO_PRIMITIVE_RESTART;
if (!extended)
flags |= WINED3D_VIDMEM_ACCOUNTING;

View File

@ -61,7 +61,7 @@ struct FvfToDecl
#define DDRAW_WINED3D_FLAGS (WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING \
| WINED3D_RESTORE_MODE_ON_ACTIVATE | WINED3D_FOCUS_MESSAGES | WINED3D_PIXEL_CENTER_INTEGER \
| WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR)
| WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR | WINED3D_NO_PRIMITIVE_RESTART)
enum ddraw_device_state
{

View File

@ -1634,16 +1634,17 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
struct wined3d_texture *target, const struct wined3d_format *ds_format)
{
struct wined3d_device *device = swapchain->device;
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_format *color_format;
struct wined3d_context *ret;
BOOL hdc_is_private = FALSE;
BOOL auxBuffers = FALSE;
HGLRC ctx, share_ctx;
int pixel_format;
unsigned int s;
DWORD state;
HDC hdc = 0;
BOOL hdc_is_private = FALSE;
TRACE("swapchain %p, target %p, window %p.\n", swapchain, target, swapchain->win_handle);
@ -1823,7 +1824,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
goto out;
}
ret->d3d_info = &device->adapter->d3d_info;
ret->d3d_info = d3d_info;
ret->state_table = device->StateTable;
/* Mark all states dirty to force a proper initialization of the states
@ -1979,6 +1980,18 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
{
GL_EXTCALL(glProvokingVertexEXT(GL_FIRST_VERTEX_CONVENTION_EXT));
}
if (!(d3d_info->wined3d_creation_flags & WINED3D_NO_PRIMITIVE_RESTART))
{
if (gl_info->supported[ARB_ES3_COMPATIBILITY])
{
gl_info->gl_ops.gl.p_glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX);
checkGLcall("Enable GL_PRIMITIVE_RESTART_FIXED_INDEX");
}
else
{
FIXME("OpenGL implementation does not support GL_PRIMITIVE_RESTART_FIXED_INDEX.\n");
}
}
if (gl_info->supported[ARB_CLIP_CONTROL])
GL_EXTCALL(glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT));
device->shader_backend->shader_init_context_state(ret);

View File

@ -122,6 +122,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
{"GL_ARB_draw_elements_base_vertex", ARB_DRAW_ELEMENTS_BASE_VERTEX },
{"GL_ARB_draw_instanced", ARB_DRAW_INSTANCED },
{"GL_ARB_ES2_compatibility", ARB_ES2_COMPATIBILITY },
{"GL_ARB_ES3_compatibility", ARB_ES3_COMPATIBILITY },
{"GL_ARB_explicit_attrib_location", ARB_EXPLICIT_ATTRIB_LOCATION },
{"GL_ARB_fragment_coord_conventions", ARB_FRAGMENT_COORD_CONVENTIONS},
{"GL_ARB_fragment_program", ARB_FRAGMENT_PROGRAM },
@ -3635,6 +3636,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, DWORD
{ARB_TEXTURE_STORAGE, MAKEDWORD_VERSION(4, 2)},
{ARB_DEBUG_OUTPUT, MAKEDWORD_VERSION(4, 3)},
{ARB_ES3_COMPATIBILITY, MAKEDWORD_VERSION(4, 3)},
{ARB_INTERNALFORMAT_QUERY2, MAKEDWORD_VERSION(4, 3)},
{ARB_SHADER_IMAGE_SIZE, MAKEDWORD_VERSION(4, 3)},
{ARB_STENCIL_TEXTURING, MAKEDWORD_VERSION(4, 3)},

View File

@ -55,6 +55,7 @@ enum wined3d_gl_extension
ARB_DRAW_ELEMENTS_BASE_VERTEX,
ARB_DRAW_INSTANCED,
ARB_ES2_COMPATIBILITY,
ARB_ES3_COMPATIBILITY,
ARB_EXPLICIT_ATTRIB_LOCATION,
ARB_FRAGMENT_COORD_CONVENTIONS,
ARB_FRAGMENT_PROGRAM,

View File

@ -1267,6 +1267,7 @@ enum wined3d_display_rotation
#define WINED3D_LEGACY_FFP_LIGHTING 0x00000100
#define WINED3D_SRGB_READ_WRITE_CONTROL 0x00000200
#define WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR 0x00000400
#define WINED3D_NO_PRIMITIVE_RESTART 0x00000800
#define WINED3D_RESZ_CODE 0x7fa05000