aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src')
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_gentable.py2
-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
-rw-r--r--mesalib/src/mesa/main/api_exec.c2
-rw-r--r--mesalib/src/mesa/main/context.c13
-rw-r--r--mesalib/src/mesa/main/context.h6
-rw-r--r--mesalib/src/mesa/main/mtypes.h2
-rw-r--r--mesalib/src/mesa/main/state.c3
-rw-r--r--mesalib/src/mesa/main/teximage.c16
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c2
-rw-r--r--mesalib/src/mesa/x86/gen_matypes.c1
12 files changed, 61 insertions, 83 deletions
diff --git a/mesalib/src/mapi/glapi/gen/gl_gentable.py b/mesalib/src/mapi/glapi/gen/gl_gentable.py
index 5657e3277..edaabdbac 100644
--- a/mesalib/src/mapi/glapi/gen/gl_gentable.py
+++ b/mesalib/src/mapi/glapi/gen/gl_gentable.py
@@ -42,7 +42,7 @@ header = """/* GLXEXT is the define used in the xserver when the GLX extension i
#endif
#if (defined(GLXEXT) && defined(HAVE_BACKTRACE)) \\
- || (!defined(GLXEXT) && defined(DEBUG) && !defined(_WIN32_WCE))
+ || (!defined(GLXEXT) && defined(DEBUG) && !defined(_WIN32_WCE) && !defined(__CYGWIN__))
#define USE_BACKTRACE
#endif
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 5ce1eb029..82dd7abf8 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -756,7 +756,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);
diff --git a/mesalib/src/mesa/main/api_exec.c b/mesalib/src/mesa/main/api_exec.c
index ddf7c7fc1..f42da9438 100644
--- a/mesalib/src/mesa/main/api_exec.c
+++ b/mesalib/src/mesa/main/api_exec.c
@@ -335,8 +335,6 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_NormalPointer(exec, _mesa_NormalPointer);
SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures);
SET_TexCoordPointer(exec, _mesa_TexCoordPointer);
- }
- if (ctx->API != API_OPENGL_CORE) {
SET_VertexPointer(exec, _mesa_VertexPointer);
}
#endif
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index c50504d19..d3fced946 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -897,20 +897,17 @@ _mesa_alloc_dispatch_table(int size)
* etc with, or NULL
* \param driverFunctions table of device driver functions for this context
* to use
- * \param driverContext pointer to driver-specific context data
*/
GLboolean
_mesa_initialize_context(struct gl_context *ctx,
gl_api api,
const struct gl_config *visual,
struct gl_context *share_list,
- const struct dd_function_table *driverFunctions,
- void *driverContext)
+ const struct dd_function_table *driverFunctions)
{
struct gl_shared_state *shared;
int i;
- /*ASSERT(driverContext);*/
assert(driverFunctions->NewTextureObject);
assert(driverFunctions->FreeTextureImageBuffer);
@@ -934,7 +931,6 @@ _mesa_initialize_context(struct gl_context *ctx,
* textures.
*/
ctx->Driver = *driverFunctions;
- ctx->DriverCtx = driverContext;
if (share_list) {
/* share state with another context */
@@ -1049,7 +1045,6 @@ _mesa_initialize_context(struct gl_context *ctx,
* \param share_list another context to share display lists with or NULL
* \param driverFunctions points to the dd_function_table into which the
* driver has plugged in all its special functions.
- * \param driverContext points to the device driver's private context state
*
* \return pointer to a new __struct gl_contextRec or NULL if error.
*/
@@ -1057,20 +1052,18 @@ struct gl_context *
_mesa_create_context(gl_api api,
const struct gl_config *visual,
struct gl_context *share_list,
- const struct dd_function_table *driverFunctions,
- void *driverContext)
+ const struct dd_function_table *driverFunctions)
{
struct gl_context *ctx;
ASSERT(visual);
- /*ASSERT(driverContext);*/
ctx = calloc(1, sizeof(struct gl_context));
if (!ctx)
return NULL;
if (_mesa_initialize_context(ctx, api, visual, share_list,
- driverFunctions, driverContext)) {
+ driverFunctions)) {
return ctx;
}
else {
diff --git a/mesalib/src/mesa/main/context.h b/mesalib/src/mesa/main/context.h
index f0b4471b1..a5f770a6e 100644
--- a/mesalib/src/mesa/main/context.h
+++ b/mesalib/src/mesa/main/context.h
@@ -109,15 +109,13 @@ _mesa_initialize_context( struct gl_context *ctx,
gl_api api,
const struct gl_config *visual,
struct gl_context *share_list,
- const struct dd_function_table *driverFunctions,
- void *driverContext );
+ const struct dd_function_table *driverFunctions);
extern struct gl_context *
_mesa_create_context(gl_api api,
const struct gl_config *visual,
struct gl_context *share_list,
- const struct dd_function_table *driverFunctions,
- void *driverContext);
+ const struct dd_function_table *driverFunctions);
extern void
_mesa_free_context_data( struct gl_context *ctx );
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index e790e18c4..40a802f52 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -3403,8 +3403,6 @@ struct gl_context
*/
struct dd_function_table Driver;
- void *DriverCtx; /**< Points to device driver context/state */
-
/** Core/Driver constants */
struct gl_constants Const;
diff --git a/mesalib/src/mesa/main/state.c b/mesalib/src/mesa/main/state.c
index 76946bd93..fb8b71cfe 100644
--- a/mesalib/src/mesa/main/state.c
+++ b/mesalib/src/mesa/main/state.c
@@ -627,7 +627,8 @@ _mesa_set_varying_vp_inputs( struct gl_context *ctx,
*
* It's okay to check the VP pointer here, because this is called after
* _mesa_update_state in the vbo module. */
- if (ctx->VertexProgram._TnlProgram) {
+ if (ctx->VertexProgram._TnlProgram ||
+ ctx->FragmentProgram._TexEnvProgram) {
ctx->NewState |= _NEW_VARYING_VP_INPUTS;
}
/*printf("%s %x\n", __FUNCTION__, varying_inputs);*/
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 019516f00..225081578 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -2871,13 +2871,15 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
border, internalFormat, texFormat);
/* Give the texture to the driver. <pixels> may be null. */
- if (compressed) {
- ctx->Driver.CompressedTexImage(ctx, dims, texImage,
- imageSize, pixels);
- }
- else {
- ctx->Driver.TexImage(ctx, dims, texImage, format,
- type, pixels, unpack);
+ if (width > 0 && height > 0 && depth > 0) {
+ if (compressed) {
+ ctx->Driver.CompressedTexImage(ctx, dims, texImage,
+ imageSize, pixels);
+ }
+ else {
+ ctx->Driver.TexImage(ctx, dims, texImage, format,
+ type, pixels, unpack);
+ }
}
check_gen_mipmap(ctx, target, texObj, level);
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index aa3534125..da361d887 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -225,7 +225,7 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
memset(&funcs, 0, sizeof(funcs));
st_init_driver_functions(&funcs);
- ctx = _mesa_create_context(api, visual, shareCtx, &funcs, NULL);
+ ctx = _mesa_create_context(api, visual, shareCtx, &funcs);
if (!ctx) {
return NULL;
}
diff --git a/mesalib/src/mesa/x86/gen_matypes.c b/mesalib/src/mesa/x86/gen_matypes.c
index a1d8ee67d..61f181cd9 100644
--- a/mesalib/src/mesa/x86/gen_matypes.c
+++ b/mesalib/src/mesa/x86/gen_matypes.c
@@ -93,7 +93,6 @@ int main( int argc, char **argv )
*/
OFFSET_HEADER( "struct gl_context" );
- OFFSET( "CTX_DRIVER_CTX ", struct gl_context, DriverCtx );
printf( "\n" );
OFFSET( "CTX_LIGHT_ENABLED ", struct gl_context, Light.Enabled );
OFFSET( "CTX_LIGHT_SHADE_MODEL ", struct gl_context, Light.ShadeModel );