wined3d: Introduce helper function for enabling common GLSL extensions.
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:
parent
3fa736e978
commit
4f946d87a2
|
@ -5813,6 +5813,21 @@ static void shader_glsl_generate_alpha_test(struct wined3d_string_buffer *buffer
|
||||||
shader_addline(buffer, " discard;\n");
|
shader_addline(buffer, " discard;\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void shader_glsl_enable_extensions(struct wined3d_string_buffer *buffer,
|
||||||
|
const struct wined3d_gl_info *gl_info)
|
||||||
|
{
|
||||||
|
if (gl_info->supported[ARB_SHADER_BIT_ENCODING])
|
||||||
|
shader_addline(buffer, "#extension GL_ARB_shader_bit_encoding : enable\n");
|
||||||
|
if (gl_info->supported[ARB_TEXTURE_QUERY_LEVELS])
|
||||||
|
shader_addline(buffer, "#extension GL_ARB_texture_query_levels : enable\n");
|
||||||
|
if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT])
|
||||||
|
shader_addline(buffer, "#extension GL_ARB_uniform_buffer_object : enable\n");
|
||||||
|
if (gl_info->supported[EXT_GPU_SHADER4])
|
||||||
|
shader_addline(buffer, "#extension GL_EXT_gpu_shader4 : enable\n");
|
||||||
|
if (gl_info->supported[EXT_TEXTURE_ARRAY])
|
||||||
|
shader_addline(buffer, "#extension GL_EXT_texture_array : enable\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* Context activation is done by the caller. */
|
/* Context activation is done by the caller. */
|
||||||
static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context,
|
static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context,
|
||||||
struct wined3d_string_buffer *buffer, struct wined3d_string_buffer_list *string_buffers,
|
struct wined3d_string_buffer *buffer, struct wined3d_string_buffer_list *string_buffers,
|
||||||
|
@ -5835,22 +5850,13 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
|
||||||
|
|
||||||
shader_addline(buffer, "%s\n", shader_glsl_get_version(gl_info, ®_maps->shader_version));
|
shader_addline(buffer, "%s\n", shader_glsl_get_version(gl_info, ®_maps->shader_version));
|
||||||
|
|
||||||
if (gl_info->supported[ARB_SHADER_BIT_ENCODING])
|
shader_glsl_enable_extensions(buffer, gl_info);
|
||||||
shader_addline(buffer, "#extension GL_ARB_shader_bit_encoding : enable\n");
|
|
||||||
if (gl_info->supported[ARB_SHADER_TEXTURE_LOD])
|
if (gl_info->supported[ARB_SHADER_TEXTURE_LOD])
|
||||||
shader_addline(buffer, "#extension GL_ARB_shader_texture_lod : enable\n");
|
shader_addline(buffer, "#extension GL_ARB_shader_texture_lod : enable\n");
|
||||||
if (gl_info->supported[ARB_TEXTURE_QUERY_LEVELS])
|
|
||||||
shader_addline(buffer, "#extension GL_ARB_texture_query_levels : enable\n");
|
|
||||||
/* The spec says that it doesn't have to be explicitly enabled, but the
|
/* The spec says that it doesn't have to be explicitly enabled, but the
|
||||||
* nvidia drivers write a warning if we don't do so. */
|
* nvidia drivers write a warning if we don't do so. */
|
||||||
if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
|
if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
|
||||||
shader_addline(buffer, "#extension GL_ARB_texture_rectangle : enable\n");
|
shader_addline(buffer, "#extension GL_ARB_texture_rectangle : enable\n");
|
||||||
if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT])
|
|
||||||
shader_addline(buffer, "#extension GL_ARB_uniform_buffer_object : enable\n");
|
|
||||||
if (gl_info->supported[EXT_GPU_SHADER4])
|
|
||||||
shader_addline(buffer, "#extension GL_EXT_gpu_shader4 : enable\n");
|
|
||||||
if (gl_info->supported[EXT_TEXTURE_ARRAY])
|
|
||||||
shader_addline(buffer, "#extension GL_EXT_texture_array : enable\n");
|
|
||||||
|
|
||||||
/* Base Declarations */
|
/* Base Declarations */
|
||||||
shader_generate_glsl_declarations(context, buffer, shader, reg_maps, &priv_ctx);
|
shader_generate_glsl_declarations(context, buffer, shader, reg_maps, &priv_ctx);
|
||||||
|
@ -5961,20 +5967,11 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context
|
||||||
|
|
||||||
shader_addline(buffer, "%s\n", shader_glsl_get_version(gl_info, ®_maps->shader_version));
|
shader_addline(buffer, "%s\n", shader_glsl_get_version(gl_info, ®_maps->shader_version));
|
||||||
|
|
||||||
|
shader_glsl_enable_extensions(buffer, gl_info);
|
||||||
if (gl_info->supported[ARB_DRAW_INSTANCED])
|
if (gl_info->supported[ARB_DRAW_INSTANCED])
|
||||||
shader_addline(buffer, "#extension GL_ARB_draw_instanced : enable\n");
|
shader_addline(buffer, "#extension GL_ARB_draw_instanced : enable\n");
|
||||||
if (gl_info->supported[ARB_EXPLICIT_ATTRIB_LOCATION])
|
if (gl_info->supported[ARB_EXPLICIT_ATTRIB_LOCATION])
|
||||||
shader_addline(buffer, "#extension GL_ARB_explicit_attrib_location : enable\n");
|
shader_addline(buffer, "#extension GL_ARB_explicit_attrib_location : enable\n");
|
||||||
if (gl_info->supported[ARB_SHADER_BIT_ENCODING])
|
|
||||||
shader_addline(buffer, "#extension GL_ARB_shader_bit_encoding : enable\n");
|
|
||||||
if (gl_info->supported[ARB_TEXTURE_QUERY_LEVELS])
|
|
||||||
shader_addline(buffer, "#extension GL_ARB_texture_query_levels : enable\n");
|
|
||||||
if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT])
|
|
||||||
shader_addline(buffer, "#extension GL_ARB_uniform_buffer_object : enable\n");
|
|
||||||
if (gl_info->supported[EXT_GPU_SHADER4])
|
|
||||||
shader_addline(buffer, "#extension GL_EXT_gpu_shader4 : enable\n");
|
|
||||||
if (gl_info->supported[EXT_TEXTURE_ARRAY])
|
|
||||||
shader_addline(buffer, "#extension GL_EXT_texture_array : enable\n");
|
|
||||||
|
|
||||||
memset(&priv_ctx, 0, sizeof(priv_ctx));
|
memset(&priv_ctx, 0, sizeof(priv_ctx));
|
||||||
priv_ctx.cur_vs_args = args;
|
priv_ctx.cur_vs_args = args;
|
||||||
|
@ -6057,18 +6054,9 @@ static GLuint shader_glsl_generate_geometry_shader(const struct wined3d_context
|
||||||
|
|
||||||
shader_addline(buffer, "%s\n", shader_glsl_get_version(gl_info, ®_maps->shader_version));
|
shader_addline(buffer, "%s\n", shader_glsl_get_version(gl_info, ®_maps->shader_version));
|
||||||
|
|
||||||
|
shader_glsl_enable_extensions(buffer, gl_info);
|
||||||
if (gl_info->supported[ARB_GEOMETRY_SHADER4])
|
if (gl_info->supported[ARB_GEOMETRY_SHADER4])
|
||||||
shader_addline(buffer, "#extension GL_ARB_geometry_shader4 : enable\n");
|
shader_addline(buffer, "#extension GL_ARB_geometry_shader4 : enable\n");
|
||||||
if (gl_info->supported[ARB_SHADER_BIT_ENCODING])
|
|
||||||
shader_addline(buffer, "#extension GL_ARB_shader_bit_encoding : enable\n");
|
|
||||||
if (gl_info->supported[ARB_TEXTURE_QUERY_LEVELS])
|
|
||||||
shader_addline(buffer, "#extension GL_ARB_texture_query_levels : enable\n");
|
|
||||||
if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT])
|
|
||||||
shader_addline(buffer, "#extension GL_ARB_uniform_buffer_object : enable\n");
|
|
||||||
if (gl_info->supported[EXT_GPU_SHADER4])
|
|
||||||
shader_addline(buffer, "#extension GL_EXT_gpu_shader4 : enable\n");
|
|
||||||
if (gl_info->supported[EXT_TEXTURE_ARRAY])
|
|
||||||
shader_addline(buffer, "#extension GL_EXT_texture_array : enable\n");
|
|
||||||
|
|
||||||
memset(&priv_ctx, 0, sizeof(priv_ctx));
|
memset(&priv_ctx, 0, sizeof(priv_ctx));
|
||||||
priv_ctx.string_buffers = string_buffers;
|
priv_ctx.string_buffers = string_buffers;
|
||||||
|
|
Loading…
Reference in New Issue