From 6f5a2f58477cc64e06183196a6caafac55fece20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Fri, 31 Mar 2017 13:11:51 +0200 Subject: [PATCH] wined3d: Fix transform feedback primitive mode. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/device.c | 8 ++++---- dlls/wined3d/drawprim.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 1e4011c63d3..3b50e48ef44 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -57,7 +57,7 @@ const struct wined3d_light WINED3D_default_light = * actually have the same values in GL and D3D. */ GLenum gl_primitive_type_from_d3d(enum wined3d_primitive_type primitive_type) { - switch(primitive_type) + switch (primitive_type) { case WINED3D_PT_POINTLIST: return GL_POINTS; @@ -90,7 +90,7 @@ GLenum gl_primitive_type_from_d3d(enum wined3d_primitive_type primitive_type) return GL_TRIANGLE_STRIP_ADJACENCY_ARB; default: - FIXME("Unhandled primitive type %s\n", debug_d3dprimitivetype(primitive_type)); + FIXME("Unhandled primitive type %s.\n", debug_d3dprimitivetype(primitive_type)); case WINED3D_PT_UNDEFINED: return ~0u; } @@ -98,7 +98,7 @@ GLenum gl_primitive_type_from_d3d(enum wined3d_primitive_type primitive_type) static enum wined3d_primitive_type d3d_primitive_type_from_gl(GLenum primitive_type) { - switch(primitive_type) + switch (primitive_type) { case GL_POINTS: return WINED3D_PT_POINTLIST; @@ -131,7 +131,7 @@ static enum wined3d_primitive_type d3d_primitive_type_from_gl(GLenum primitive_t return WINED3D_PT_TRIANGLESTRIP_ADJ; default: - FIXME("Unhandled primitive type %s\n", debug_d3dprimitivetype(primitive_type)); + FIXME("Unhandled primitive type %s.\n", debug_d3dprimitivetype(primitive_type)); case ~0u: return WINED3D_PT_UNDEFINED; } diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index 13357070ea2..c6d345035c3 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -435,6 +435,32 @@ static void context_pause_transform_feedback(struct wined3d_context *context, BO context_end_transform_feedback(context); } +static GLenum gl_tfb_primitive_type_from_d3d(enum wined3d_primitive_type primitive_type) +{ + GLenum gl_primitive_type = gl_primitive_type_from_d3d(primitive_type); + switch (gl_primitive_type) + { + case GL_POINTS: + return GL_POINTS; + + case GL_LINE_STRIP: + case GL_LINE_STRIP_ADJACENCY: + case GL_LINES_ADJACENCY: + case GL_LINES: + return GL_LINES; + + case GL_TRIANGLE_FAN: + case GL_TRIANGLE_STRIP: + case GL_TRIANGLE_STRIP_ADJACENCY: + case GL_TRIANGLES_ADJACENCY: + case GL_TRIANGLES: + return GL_TRIANGLES; + + default: + return gl_primitive_type; + } +} + /* Routine common to the draw primitive and draw indexed primitive routines */ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *state, int base_vertex_idx, unsigned int start_idx, unsigned int index_count, @@ -584,7 +610,6 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s if (use_transform_feedback(state)) { 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) { @@ -601,7 +626,8 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s } else if (!context->transform_feedback_active) { - GL_EXTCALL(glBeginTransformFeedback(primitive_mode)); + GLenum mode = gl_tfb_primitive_type_from_d3d(shader->u.gs.output_type); + GL_EXTCALL(glBeginTransformFeedback(mode)); checkGLcall("glBeginTransformFeedback"); context->transform_feedback_active = 1; }