Module: wine Branch: master Commit: 591b17838e63d693d0fb57e085f6af8f9edec14c URL: http://source.winehq.org/git/wine.git/?a=commit;h=591b17838e63d693d0fb57e085...
Author: Józef Kucia jkucia@codeweavers.com Date: Thu Mar 30 14:09:22 2017 +0200
wined3d: Add support for rasterizer discard.
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/d3d11/tests/d3d11.c | 6 +++--- dlls/wined3d/drawprim.c | 15 ++++++++++++++- include/wine/wined3d.h | 1 + 3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index c44afb4..1e7b5df 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -16833,7 +16833,7 @@ static void test_stream_output_resume(void) check_texture_color(test_context.backbuffer, 0xffffffff, 0);
draw_color_quad(&test_context, &red); - todo_wine check_texture_color(test_context.backbuffer, 0xffffffff, 0); + check_texture_color(test_context.backbuffer, 0xffffffff, 0);
ID3D11DeviceContext_GSSetShader(context, NULL, NULL, 0); draw_color_quad(&test_context, &green); @@ -16842,7 +16842,7 @@ static void test_stream_output_resume(void) ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &constants[1], 0, 0); ID3D11DeviceContext_GSSetShader(context, gs, NULL, 0); draw_color_quad(&test_context, &red); - todo_wine check_texture_color(test_context.backbuffer, 0xff00ff00, 0); + check_texture_color(test_context.backbuffer, 0xff00ff00, 0);
ID3D11DeviceContext_GSSetShader(context, NULL, NULL, 0); draw_color_quad(&test_context, &red); @@ -16851,7 +16851,7 @@ static void test_stream_output_resume(void) ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &constants[2], 0, 0); ID3D11DeviceContext_GSSetShader(context, gs, NULL, 0); draw_color_quad(&test_context, &white); - todo_wine check_texture_color(test_context.backbuffer, 0xff0000ff, 0); + check_texture_color(test_context.backbuffer, 0xff0000ff, 0);
ID3D11DeviceContext_GSSetShader(context, NULL, NULL, 0); draw_color_quad(&test_context, &green); diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index e055361..b5537a8 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -419,6 +419,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s int base_vertex_idx, unsigned int start_idx, unsigned int index_count, unsigned int start_instance, unsigned int instance_count, BOOL indexed) { + BOOL emulation = FALSE, rasterizer_discard = FALSE; const struct wined3d_fb_state *fb = state->fb; const struct wined3d_stream_info *stream_info; struct wined3d_event_query *ib_query = NULL; @@ -428,7 +429,6 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s struct wined3d_context *context; unsigned int i, idx_size = 0; const void *idx_data = NULL; - BOOL emulation = FALSE;
if (!index_count) return; @@ -569,6 +569,13 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s const struct wined3d_shader *shader = state->shader[WINED3D_SHADER_TYPE_GEOMETRY]; GLenum primitive_mode = gl_primitive_type_from_d3d(shader->u.gs.output_type);
+ if (shader->u.gs.so_desc.rasterizer_stream_idx == WINED3D_NO_RASTERIZER_STREAM) + { + glEnable(GL_RASTERIZER_DISCARD); + checkGLcall("enable rasterizer discard"); + rasterizer_discard = TRUE; + } + GL_EXTCALL(glBeginTransformFeedback(primitive_mode)); checkGLcall("glBeginTransformFeedback"); context->transform_feedback_active = 1; @@ -587,6 +594,12 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s checkGLcall("glMemoryBarrier"); }
+ if (rasterizer_discard) + { + glDisable(GL_RASTERIZER_DISCARD); + checkGLcall("disable rasterizer discard"); + } + if (ib_query) wined3d_event_query_issue(ib_query, device); for (i = 0; i < context->num_buffer_queries; ++i) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 4e2c800..f575547 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -1518,6 +1518,7 @@ enum wined3d_shader_byte_code_format
#define WINED3D_MAX_STREAM_OUTPUT_BUFFERS 4 #define WINED3D_STREAM_OUTPUT_GAP 0xffffffff +#define WINED3D_NO_RASTERIZER_STREAM 0xffffffff
#define WINED3D_VIEW_BUFFER_RAW 0x00000001 #define WINED3D_VIEW_BUFFER_APPEND 0x00000002