diff options
author | marha <marha@users.sourceforge.net> | 2012-12-10 08:55:36 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-12-10 08:55:36 +0100 |
commit | a0124a5e8e70979d2c24ef55285da989fdad766a (patch) | |
tree | 5cea5c9804a8edf67bc7260e0851a20d21324547 /mesalib/src/mesa/drivers/common/meta.c | |
parent | 514b4afb64ccbf8e954270105ed5064272a2be68 (diff) | |
parent | 0328076efb5ff6e62152c09e38d0d11f7931d07b (diff) | |
download | vcxsrv-a0124a5e8e70979d2c24ef55285da989fdad766a.tar.gz vcxsrv-a0124a5e8e70979d2c24ef55285da989fdad766a.tar.bz2 vcxsrv-a0124a5e8e70979d2c24ef55285da989fdad766a.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
fontconfig libX11 mesa pixman git update 10 dec 2012
Conflicts:
fontconfig/src/fcxml.c
Diffstat (limited to 'mesalib/src/mesa/drivers/common/meta.c')
-rw-r--r-- | mesalib/src/mesa/drivers/common/meta.c | 80 |
1 files changed, 52 insertions, 28 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index d5e8af3c0..ac036eaac 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -133,6 +133,7 @@ struct save_state struct gl_vertex_program *VertexProgram; GLboolean FragmentProgramEnabled; struct gl_fragment_program *FragmentProgram; + GLboolean ATIFragmentShaderEnabled; struct gl_shader_program *VertexShader; struct gl_shader_program *GeometryShader; struct gl_shader_program *FragmentShader; @@ -594,6 +595,11 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) _mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_FALSE); } + if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ATI_fragment_shader) { + save->ATIFragmentShaderEnabled = ctx->ATIFragmentShader.Enabled; + _mesa_set_enable(ctx, GL_FRAGMENT_SHADER_ATI, GL_FALSE); + } + if (ctx->Extensions.ARB_shader_objects) { _mesa_reference_shader_program(ctx, &save->VertexShader, ctx->Shader.CurrentVertexProgram); @@ -914,6 +920,11 @@ _mesa_meta_end(struct gl_context *ctx) _mesa_reference_fragprog(ctx, &save->FragmentProgram, NULL); } + if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ATI_fragment_shader) { + _mesa_set_enable(ctx, GL_FRAGMENT_SHADER_ATI, + save->ATIFragmentShaderEnabled); + } + if (ctx->Extensions.ARB_vertex_shader) _mesa_use_shader_program(ctx, GL_VERTEX_SHADER, save->VertexShader); @@ -1844,23 +1855,8 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear) "{\n" " gl_FragColor = color;\n" "}\n"; - const char *vs_int_source = - "#version 130\n" - "in vec4 position;\n" - "void main()\n" - "{\n" - " gl_Position = position;\n" - "}\n"; - const char *fs_int_source = - "#version 130\n" - "uniform ivec4 color;\n" - "out ivec4 out_color;\n" - "\n" - "void main()\n" - "{\n" - " out_color = color;\n" - "}\n"; GLuint vs, fs; + bool has_integer_textures; if (clear->ArrayObj != 0) return; @@ -1896,9 +1892,35 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear) clear->ColorLocation = _mesa_GetUniformLocation(clear->ShaderProg, "color"); - if (_mesa_is_desktop_gl(ctx) && ctx->Const.GLSLVersion >= 130) { + has_integer_textures = _mesa_is_gles3(ctx) || + (_mesa_is_desktop_gl(ctx) && ctx->Const.GLSLVersion >= 130); + + if (has_integer_textures) { + void *shader_source_mem_ctx = ralloc_context(NULL); + const char *vs_int_source = + ralloc_asprintf(shader_source_mem_ctx, + "#version %s\n" + "in vec4 position;\n" + "void main()\n" + "{\n" + " gl_Position = position;\n" + "}\n", + _mesa_is_desktop_gl(ctx) ? "130" : "300 es"); + const char *fs_int_source = + ralloc_asprintf(shader_source_mem_ctx, + "#version %s\n" + "uniform ivec4 color;\n" + "out ivec4 out_color;\n" + "\n" + "void main()\n" + "{\n" + " out_color = color;\n" + "}\n", + _mesa_is_desktop_gl(ctx) ? "130" : "300 es"); + vs = compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_int_source); fs = compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_int_source); + ralloc_free(shader_source_mem_ctx); clear->IntegerShaderProg = _mesa_CreateProgramObjectARB(); _mesa_AttachShader(clear->IntegerShaderProg, fs); @@ -3101,18 +3123,19 @@ setup_glsl_generate_mipmap(struct gl_context *ctx, sampler->func, sampler->texcoords); } else { - vs_source = - "#version 130\n" - "in vec2 position;\n" - "in vec3 textureCoords;\n" - "out vec3 texCoords;\n" - "void main()\n" - "{\n" - " texCoords = textureCoords;\n" - " gl_Position = vec4(position, 0.0, 1.0);\n" - "}\n"; + vs_source = ralloc_asprintf(mem_ctx, + "#version %s\n" + "in vec2 position;\n" + "in vec3 textureCoords;\n" + "out vec3 texCoords;\n" + "void main()\n" + "{\n" + " texCoords = textureCoords;\n" + " gl_Position = vec4(position, 0.0, 1.0);\n" + "}\n", + _mesa_is_desktop_gl(ctx) ? "130" : "300 es"); fs_source = ralloc_asprintf(mem_ctx, - "#version 130\n" + "#version %s\n" "uniform %s texSampler;\n" "in vec3 texCoords;\n" "out vec4 out_color;\n" @@ -3121,6 +3144,7 @@ setup_glsl_generate_mipmap(struct gl_context *ctx, "{\n" " out_color = texture(texSampler, %s);\n" "}\n", + _mesa_is_desktop_gl(ctx) ? "130" : "300 es", sampler->type, sampler->texcoords); } |