In order to avoid GL errors when glBeginTransformFeedback() is called. This is required only because we do not fully support stream output component ranges.
Signed-off-by: Józef Kucia jkucia@codeweavers.com ---
This isn't pretty, and it should be reverted when we fully support component ranges.
--- dlls/wined3d/glsl_shader.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index e29730cce24b..5d1f11865865 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -804,11 +804,12 @@ static void append_transform_feedback_skip_components(const char **varyings, } }
-static void shader_glsl_generate_transform_feedback_varyings(const struct wined3d_stream_output_desc *so_desc, +static BOOL shader_glsl_generate_transform_feedback_varyings(const struct wined3d_stream_output_desc *so_desc, struct wined3d_string_buffer *buffer, const char **varyings, unsigned int *varying_count, char *strings, unsigned int *strings_length, GLenum buffer_mode) { unsigned int i, buffer_idx, count, length, highest_output_slot, stride; + BOOL have_varyings_to_record = FALSE;
count = length = 0; highest_output_slot = 0; @@ -858,6 +859,8 @@ static void shader_glsl_generate_transform_feedback_varyings(const struct wined3 string_buffer_sprintf(buffer, "shader_in_out.reg%u", e->register_idx); append_transform_feedback_varying(varyings, &count, &strings, &length, buffer); } + + have_varyings_to_record = TRUE; }
if (buffer_idx < so_desc->buffer_stride_count @@ -882,10 +885,12 @@ static void shader_glsl_generate_transform_feedback_varyings(const struct wined3 *varying_count = count; if (strings_length) *strings_length = length; + + return have_varyings_to_record; }
static void shader_glsl_init_transform_feedback(const struct wined3d_context *context, - struct shader_glsl_priv *priv, GLuint program_id, const struct wined3d_shader *shader) + struct shader_glsl_priv *priv, GLuint program_id, struct wined3d_shader *shader) { const struct wined3d_stream_output_desc *so_desc = &shader->u.gs.so_desc; const struct wined3d_gl_info *gl_info = context->gl_info; @@ -941,7 +946,12 @@ static void shader_glsl_init_transform_feedback(const struct wined3d_context *co
buffer = string_buffer_get(&priv->string_buffers);
- shader_glsl_generate_transform_feedback_varyings(so_desc, buffer, NULL, &count, NULL, &length, mode); + if (!shader_glsl_generate_transform_feedback_varyings(so_desc, buffer, NULL, &count, NULL, &length, mode)) + { + FIXME("No varyings to record, disabling transform feedback.\n"); + shader->u.gs.so_desc.element_count = 0; + return; + }
if (!(varyings = heap_calloc(count, sizeof(*varyings)))) {