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>
This commit is contained in:
Józef Kucia 2017-03-30 14:09:22 +02:00 committed by Alexandre Julliard
parent 2e3300fa59
commit 591b17838e
3 changed files with 18 additions and 4 deletions

View file

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

View file

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

View file

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