wined3d: Fix transform feedback primitive mode.

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-31 13:11:51 +02:00 committed by Alexandre Julliard
parent acb337492d
commit 6f5a2f5847
2 changed files with 32 additions and 6 deletions

View File

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

View File

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