summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/glx/x11/dri2_glx.c13
-rw-r--r--src/mesa/drivers/windows/gdi/mesa.def4
-rw-r--r--src/mesa/drivers/windows/gdi/wmesa.c12
-rw-r--r--src/mesa/main/api_validate.c9
-rw-r--r--src/mesa/main/context.c4
-rw-r--r--src/mesa/state_tracker/st_draw.c3
-rw-r--r--src/mesa/tnl/t_draw.c3
-rw-r--r--src/mesa/vbo/vbo_exec_array.c32
8 files changed, 35 insertions, 45 deletions
diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c
index 7b0c52b50d4..22289581441 100644
--- a/src/glx/x11/dri2_glx.c
+++ b/src/glx/x11/dri2_glx.c
@@ -504,8 +504,10 @@ dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
psc->ext_list_first_time = GL_TRUE;
if (!DRI2Connect(psc->dpy, RootWindow(psc->dpy, screen),
- &driverName, &deviceName))
+ &driverName, &deviceName)) {
+ XFree(psp);
return NULL;
+ }
psc->driver = driOpenDriver(driverName);
if (psc->driver == NULL) {
@@ -534,17 +536,17 @@ dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
psc->fd = open(deviceName, O_RDWR);
if (psc->fd < 0) {
ErrorMessageF("failed to open drm device: %s\n", strerror(errno));
- return NULL;
+ goto handle_error;
}
if (drmGetMagic(psc->fd, &magic)) {
ErrorMessageF("failed to get magic\n");
- return NULL;
+ goto handle_error;
}
if (!DRI2Authenticate(psc->dpy, RootWindow(psc->dpy, screen), magic)) {
ErrorMessageF("failed to authenticate magic %d\n", magic);
- return NULL;
+ goto handle_error;
}
/* If the server does not support the protocol for
@@ -558,7 +560,7 @@ dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
if (psc->__driScreen == NULL) {
ErrorMessageF("failed to create dri screen\n");
- return NULL;
+ goto handle_error;
}
driBindCommonExtensions(psc);
@@ -602,6 +604,7 @@ dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
handle_error:
Xfree(driverName);
Xfree(deviceName);
+ XFree(psp);
/* FIXME: clean up here */
diff --git a/src/mesa/drivers/windows/gdi/mesa.def b/src/mesa/drivers/windows/gdi/mesa.def
index 62f75d9541f..700e3334295 100644
--- a/src/mesa/drivers/windows/gdi/mesa.def
+++ b/src/mesa/drivers/windows/gdi/mesa.def
@@ -870,7 +870,6 @@ EXPORTS
_mesa_bzero
_mesa_calloc
_mesa_choose_tex_format
- _mesa_compressed_texture_size
_mesa_create_framebuffer
_mesa_create_visual
_mesa_delete_array_object
@@ -932,6 +931,8 @@ EXPORTS
_mesa_update_framebuffer_visual
_mesa_use_program
_mesa_Viewport
+ _mesa_meta_init
+ _mesa_meta_free
_mesa_meta_CopyColorSubTable
_mesa_meta_CopyColorTable
_mesa_meta_CopyConvolutionFilter1D
@@ -941,7 +942,6 @@ EXPORTS
_mesa_meta_CopyTexSubImage1D
_mesa_meta_CopyTexSubImage2D
_mesa_meta_CopyTexSubImage3D
- _mesa_wait_query
_swrast_Accum
_swrast_Bitmap
_swrast_BlitFramebuffer
diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c
index 76c825a0904..ceeafd5f909 100644
--- a/src/mesa/drivers/windows/gdi/wmesa.c
+++ b/src/mesa/drivers/windows/gdi/wmesa.c
@@ -1286,9 +1286,6 @@ void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat,
rb->PutMonoValues = write_mono_rgba_pixels_16;
rb->GetRow = read_rgba_span_16;
rb->GetValues = read_rgba_pixels_16;
- rb->RedBits = 5;
- rb->GreenBits = 6;
- rb->BlueBits = 5;
break;
case PF_8R8G8B:
if (cColorBits == 24)
@@ -1300,9 +1297,6 @@ void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat,
rb->PutMonoValues = write_mono_rgba_pixels_24;
rb->GetRow = read_rgba_span_24;
rb->GetValues = read_rgba_pixels_24;
- rb->RedBits = 8;
- rb->GreenBits = 8;
- rb->BlueBits = 8;
}
else
{
@@ -1313,9 +1307,6 @@ void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat,
rb->PutMonoValues = write_mono_rgba_pixels_32;
rb->GetRow = read_rgba_span_32;
rb->GetValues = read_rgba_pixels_32;
- rb->RedBits = 8;
- rb->GreenBits = 8;
- rb->BlueBits = 8;
}
break;
default:
@@ -1331,9 +1322,6 @@ void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat,
rb->PutMonoValues = write_mono_rgba_pixels_front;
rb->GetRow = read_rgba_span_front;
rb->GetValues = read_rgba_pixels_front;
- rb->RedBits = 8; /* XXX fix these (565?) */
- rb->GreenBits = 8;
- rb->BlueBits = 8;
}
}
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index e71e5a6ce86..013048bbc16 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -190,9 +190,6 @@ _mesa_validate_DrawElements(GLcontext *ctx,
return GL_FALSE;
}
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
if (!check_valid_to_render(ctx, "glDrawElements"))
return GL_FALSE;
@@ -254,9 +251,6 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
return GL_FALSE;
}
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
if (!check_valid_to_render(ctx, "glDrawRangeElements"))
return GL_FALSE;
@@ -304,9 +298,6 @@ _mesa_validate_DrawArrays(GLcontext *ctx,
return GL_FALSE;
}
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
if (!check_valid_to_render(ctx, "glDrawArrays"))
return GL_FALSE;
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index a570506d57b..eb6bc8e4369 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1578,6 +1578,10 @@ _mesa_set_mvp_with_dp4( GLcontext *ctx,
GLboolean
_mesa_valid_to_render(GLcontext *ctx, const char *where)
{
+ /* This depends on having up to date derived state (shaders) */
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+
if (ctx->Shader.CurrentProgram) {
/* using shaders */
if (!ctx->Shader.CurrentProgram->LinkStatus) {
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index b0d5b993a77..381c68474d6 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -531,6 +531,9 @@ st_draw_vbo(GLcontext *ctx,
GLboolean userSpace = GL_FALSE;
GLboolean vertDataEdgeFlags;
+ /* Mesa core state should have been validated already */
+ assert(ctx->NewState == 0x0);
+
/* Gallium probably doesn't want this in some cases. */
if (!index_bounds_valid)
if (!vbo_all_varyings_in_vbos(arrays))
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index adc50485c1d..812d712b079 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -402,6 +402,9 @@ void _tnl_draw_prims( GLcontext *ctx,
GLint max_basevertex = prim->basevertex;
GLuint i;
+ /* Mesa core state should have been validated already */
+ assert(ctx->NewState == 0x0);
+
if (!_mesa_check_conditional_render(ctx))
return; /* don't draw */
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index d6452cb6640..88502f3d355 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -443,6 +443,13 @@ recalculate_input_bindings(GLcontext *ctx)
}
+/**
+ * Examine the enabled vertex arrays to set the exec->array.inputs[] values.
+ * These will point to the arrays to actually use for drawing. Some will
+ * be user-provided arrays, other will be zero-stride const-valued arrays.
+ * Note that this might set the _NEW_ARRAY dirty flag so state validation
+ * must be done after this call.
+ */
static void
bind_arrays(GLcontext *ctx)
{
@@ -484,9 +491,6 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
FLUSH_CURRENT( ctx, 0 );
- if (ctx->NewState)
- _mesa_update_state( ctx );
-
if (!_mesa_valid_to_render(ctx, "glDrawArrays")) {
return;
}
@@ -600,18 +604,16 @@ vbo_validated_drawrangeelements(GLcontext *ctx, GLenum mode,
FLUSH_CURRENT( ctx, 0 );
- if (ctx->NewState)
- _mesa_update_state( ctx );
-
if (!_mesa_valid_to_render(ctx, "glDraw[Range]Elements")) {
return;
}
+ bind_arrays( ctx );
+
+ /* check for dirty state again */
if (ctx->NewState)
_mesa_update_state( ctx );
- bind_arrays( ctx );
-
ib.count = count;
ib.type = type;
ib.obj = ctx->Array.ElementArrayBufferObj;
@@ -722,8 +724,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
#ifdef DEBUG
/* 'end' was out of bounds, but now let's check the actual array
- * indexes to see if any of them are out of bounds. If so, warn
- * and skip the draw to avoid potential segfault, etc.
+ * indexes to see if any of them are out of bounds.
*/
{
GLuint max = _mesa_max_buffer_index(ctx, count, type, indices,
@@ -740,7 +741,6 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
ctx->Array.ElementArrayBufferObj->Name,
ctx->Array.ElementArrayBufferObj->Size);
}
- return;
}
/* XXX we could also find the min index and compare to 'start'
* to see if start is correct. But it's more likely to get the
@@ -850,16 +850,10 @@ vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode,
FLUSH_CURRENT( ctx, 0 );
- if (ctx->NewState)
- _mesa_update_state( ctx );
-
if (!_mesa_valid_to_render(ctx, "glMultiDrawElements")) {
return;
}
- if (ctx->NewState)
- _mesa_update_state( ctx );
-
prim = _mesa_calloc(primcount * sizeof(*prim));
if (prim == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glMultiDrawElements");
@@ -871,6 +865,10 @@ vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode,
*/
bind_arrays( ctx );
+ /* check for dirty state again */
+ if (ctx->NewState)
+ _mesa_update_state( ctx );
+
switch (type) {
case GL_UNSIGNED_INT:
index_type_size = 4;