From: Józef Kucia Subject: [PATCH 07/11] wined3d: Implement primitive restart. Message-Id: <1481110985-1006-7-git-send-email-jkucia@codeweavers.com> Date: Wed, 7 Dec 2016 12:43:01 +0100 In-Reply-To: <1481110985-1006-1-git-send-email-jkucia@codeweavers.com> References: <1481110985-1006-1-git-send-email-jkucia@codeweavers.com> Based on a patch by Andrew Wesie. Signed-off-by: Józef Kucia --- dlls/d3d8/directx.c | 2 +- dlls/d3d9/directx.c | 3 ++- dlls/ddraw/ddraw_private.h | 2 +- dlls/wined3d/context.c | 17 +++++++++++++++-- dlls/wined3d/directx.c | 2 ++ dlls/wined3d/wined3d_gl.h | 1 + include/wine/wined3d.h | 1 + 7 files changed, 23 insertions(+), 5 deletions(-) diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c index 18753cd..d307265 100644 --- a/dlls/d3d8/directx.c +++ b/dlls/d3d8/directx.c @@ -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; diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c index 5772c11..c377992 100644 --- a/dlls/d3d9/directx.c +++ b/dlls/d3d9/directx.c @@ -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; diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index fe4603b..731d441 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -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 { diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 727f074..2ce99cb 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -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); diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 5787c22..34c42be 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -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)}, diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index 26089ad..cb1647c 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -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, diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 6a720d0..6bbb672 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -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 -- 2.7.3