aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/drivers')
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c93
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast.c2
-rw-r--r--mesalib/src/mesa/drivers/windows/gdi/wmesa.c2
3 files changed, 43 insertions, 54 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index d0bb5e0ae..24d8d485a 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -78,7 +78,6 @@
#include "main/glformats.h"
#include "../glsl/ralloc.h"
-static void *mem_ctx;
/** Return offset in bytes of the field within a vertex struct */
#define OFFSET(FIELD) ((void *) offsetof(struct vertex, FIELD))
@@ -3048,7 +3047,6 @@ setup_glsl_generate_mipmap(struct gl_context *ctx,
};
struct glsl_sampler *sampler;
const char *vs_source;
- const char *fs_template;
static const char *vs_int_source =
"#version 130\n"
@@ -3071,49 +3069,8 @@ setup_glsl_generate_mipmap(struct gl_context *ctx,
" out_color = texture(tex2d, texCoords.xy);\n"
"}\n";
char *fs_source;
- const char *extension_mode;
GLuint vs, fs;
-
- if (ctx->Const.GLSLVersion < 130) {
- vs_source =
- "attribute vec2 position;\n"
- "attribute vec3 textureCoords;\n"
- "varying vec3 texCoords;\n"
- "void main()\n"
- "{\n"
- " texCoords = textureCoords;\n"
- " gl_Position = vec4(position, 0.0, 1.0);\n"
- "}\n";
- fs_template =
- "#extension GL_EXT_texture_array : %s\n"
- "uniform %s texSampler;\n"
- "varying vec3 texCoords;\n"
- "void main()\n"
- "{\n"
- " gl_FragColor = %s(texSampler, %s);\n"
- "}\n";
- } 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";
- fs_template =
- "#version 130\n"
- "uniform %s texSampler;\n"
- "in vec3 texCoords;\n"
- "out %s out_color;\n"
- "\n"
- "void main()\n"
- "{\n"
- " out_color = texture(texSampler, %s);\n"
- "}\n";
- }
+ void *mem_ctx;
/* Check if already initialized */
if (mipmap->ArrayObj == 0) {
@@ -3143,18 +3100,50 @@ setup_glsl_generate_mipmap(struct gl_context *ctx,
mem_ctx = ralloc_context(NULL);
- if (ctx->Const.GLSLVersion < 130) {
- extension_mode = ((target == GL_TEXTURE_1D_ARRAY) ||
- (target == GL_TEXTURE_2D_ARRAY)) ?
- "require" : "disable";
+ if (ctx->API == API_OPENGLES2 || ctx->Const.GLSLVersion < 130) {
+ vs_source =
+ "attribute vec2 position;\n"
+ "attribute vec3 textureCoords;\n"
+ "varying vec3 texCoords;\n"
+ "void main()\n"
+ "{\n"
+ " texCoords = textureCoords;\n"
+ " gl_Position = vec4(position, 0.0, 1.0);\n"
+ "}\n";
- fs_source = ralloc_asprintf(mem_ctx, fs_template,
- extension_mode, sampler->type,
+ fs_source = ralloc_asprintf(mem_ctx,
+ "#extension GL_EXT_texture_array : enable\n"
+ "uniform %s texSampler;\n"
+ "varying vec3 texCoords;\n"
+ "void main()\n"
+ "{\n"
+ " gl_FragColor = %s(texSampler, %s);\n"
+ "}\n",
+ sampler->type,
sampler->func, sampler->texcoords);
}
else {
- fs_source = ralloc_asprintf(mem_ctx, fs_template,
- sampler->type, "vec4",
+ 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";
+ fs_source = ralloc_asprintf(mem_ctx,
+ "#version 130\n"
+ "uniform %s texSampler;\n"
+ "in vec3 texCoords;\n"
+ "out vec4 out_color;\n"
+ "\n"
+ "void main()\n"
+ "{\n"
+ " out_color = texture(texSampler, %s);\n"
+ "}\n",
+ sampler->type,
sampler->texcoords);
}
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index dbd339bd8..5bdbe709b 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -761,7 +761,7 @@ dri_create_context(gl_api api,
mesaCtx = &ctx->Base;
/* basic context setup */
- if (!_mesa_initialize_context(mesaCtx, api, visual, sharedCtx, &functions, (void *) cPriv)) {
+ if (!_mesa_initialize_context(mesaCtx, api, visual, sharedCtx, &functions)) {
*error = __DRI_CTX_ERROR_NO_MEMORY;
goto context_fail;
}
diff --git a/mesalib/src/mesa/drivers/windows/gdi/wmesa.c b/mesalib/src/mesa/drivers/windows/gdi/wmesa.c
index c61020273..1580e5727 100644
--- a/mesalib/src/mesa/drivers/windows/gdi/wmesa.c
+++ b/mesalib/src/mesa/drivers/windows/gdi/wmesa.c
@@ -1085,7 +1085,7 @@ WMesaContext WMesaCreateContext(HDC hDC,
/* initialize the Mesa context data */
ctx = &c->gl_ctx;
_mesa_initialize_context(ctx, API_OPENGL, visual,
- NULL, &functions, (void *)c);
+ NULL, &functions);
/* visual no longer needed - it was copied by _mesa_initialize_context() */
_mesa_destroy_visual(visual);