aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/common
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-10-08 08:09:46 +0200
committermarha <marha@users.sourceforge.net>2012-10-08 08:09:46 +0200
commitde8397bc3d010bba24ec0c4d2e6249a769a86fc7 (patch)
treea65adde1a897bd07e6009b14a23ec87f14793cf9 /mesalib/src/mesa/drivers/common
parent0130346adbce7e6b2422429887fc46c76806d845 (diff)
downloadvcxsrv-de8397bc3d010bba24ec0c4d2e6249a769a86fc7.tar.gz
vcxsrv-de8397bc3d010bba24ec0c4d2e6249a769a86fc7.tar.bz2
vcxsrv-de8397bc3d010bba24ec0c4d2e6249a769a86fc7.zip
pixman libxcb mesa xserver xkeyboard-config git update 8 oct 2012
xserver: 09f1e5b15b769e1122f0a8d7cae0820038992312 libxcb: 4ffe54f69049e6792a35a287fd9ff83abbd4fd8d mesa: 86de501f14f11f1e993c8703c0d69bdf1f6c7835 xkeyboard-config: 0a21bb5a28018902a6252fccb620d7dff7e67175 pixman: 3d81d89c292058522cce91338028d9b4c4a23c24
Diffstat (limited to 'mesalib/src/mesa/drivers/common')
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c93
1 files changed, 41 insertions, 52 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);
}