summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2010-05-12 16:11:42 -0400
committerKristian Høgsberg <krh@bitplanet.net>2010-05-12 16:11:42 -0400
commit4784a5030aeebebfcce120cfab39935ce55e53e1 (patch)
tree64ca4038adb3160894d5d779c74a8e8189666233
parentbf3b9187f02155d9c6bb9e7b9cb499b881316c68 (diff)
parentf3b55494f33e8c6569f8a1ca7dacc9e0f0dd1228 (diff)
Merge remote branch 'origin/7.8' into 7.8-gles
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c1
-rw-r--r--src/glx/glxcmds.c13
-rw-r--r--src/mesa/drivers/osmesa/osmesa.c37
-rw-r--r--src/mesa/shader/slang/slang_codegen.c3
-rw-r--r--src/mesa/shader/slang/slang_compile_variable.h2
5 files changed, 43 insertions, 13 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 96fa1340ba..6270f1a235 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1380,6 +1380,7 @@ _eglMain(const char *args)
if (!dri2_drv)
return NULL;
+ memset(dri2_drv, 0, sizeof *dri2_drv);
_eglInitDriverFallbacks(&dri2_drv->base);
dri2_drv->base.API.Initialize = dri2_initialize;
dri2_drv->base.API.Terminate = dri2_terminate;
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 9e4e194d44..90fc59aa8c 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -1766,6 +1766,15 @@ static int __glXQueryContextInfo(Display * dpy, GLXContext ctx)
unsigned i;
_XRead(dpy, (char *) propList, nPropListBytes);
+
+ /* Look up screen first so we can look up visuals/fbconfigs later */
+ pProp = propList;
+ for (i = 0; i < numValues; i++, pProp += 2)
+ if (pProp[0] == GLX_SCREEN) {
+ ctx->screen = pProp[1];
+ ctx->psc = GetGLXScreenConfigs(dpy, ctx->screen);
+ }
+
pProp = propList;
for (i = 0; i < numValues; i++) {
switch (*pProp++) {
@@ -1776,9 +1785,6 @@ static int __glXQueryContextInfo(Display * dpy, GLXContext ctx)
ctx->mode =
_gl_context_modes_find_visual(ctx->psc->visuals, *pProp++);
break;
- case GLX_SCREEN:
- ctx->screen = *pProp++;
- break;
case GLX_FBCONFIG_ID:
ctx->mode =
_gl_context_modes_find_fbconfig(ctx->psc->configs,
@@ -1787,6 +1793,7 @@ static int __glXQueryContextInfo(Display * dpy, GLXContext ctx)
case GLX_RENDER_TYPE:
ctx->renderType = *pProp++;
break;
+ case GLX_SCREEN:
default:
pProp++;
continue;
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index e20507ae92..e376f12bc3 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -1004,7 +1004,20 @@ new_osmesa_renderbuffer(GLcontext *ctx, GLenum format, GLenum type)
rb->AllocStorage = osmesa_renderbuffer_storage;
rb->InternalFormat = GL_RGBA;
- rb->Format = MESA_FORMAT_RGBA8888;
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ rb->Format = MESA_FORMAT_RGBA8888;
+ break;
+ case GL_UNSIGNED_SHORT:
+ rb->Format = MESA_FORMAT_SIGNED_RGBA_16;
+ break;
+ case GL_FLOAT:
+ rb->Format = MESA_FORMAT_RGBA_FLOAT32;
+ break;
+ default:
+ assert(0 && "Unexpected type in new_osmesa_renderbuffer()");
+ rb->Format = MESA_FORMAT_RGBA8888;
+ }
rb->_BaseFormat = GL_RGBA;
rb->DataType = type;
}
@@ -1167,11 +1180,9 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
return NULL;
}
- /* create front color buffer in user-provided memory (no back buffer) */
- osmesa->rb = new_osmesa_renderbuffer(&osmesa->mesa, format, type);
- _mesa_add_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT, osmesa->rb);
- assert(osmesa->rb->RefCount == 2);
-
+ /* Create depth/stencil/accum buffers. We'll create the color
+ * buffer later in OSMesaMakeCurrent().
+ */
_mesa_add_soft_renderbuffers(osmesa->gl_buffer,
GL_FALSE, /* color */
osmesa->gl_visual->haveDepthBuffer,
@@ -1308,11 +1319,23 @@ OSMesaMakeCurrent( OSMesaContext osmesa, void *buffer, GLenum type,
*/
_glapi_check_multithread();
+
+ /* Create a front/left color buffer which wraps the user-provided buffer.
+ * There is no back color buffer.
+ * If the user tries to use a 8, 16 or 32-bit/channel buffer that
+ * doesn't match what Mesa was compiled for (CHAN_BITS) the
+ * _mesa_add_renderbuffer() function will create a "wrapper" renderbuffer
+ * that converts rendering from CHAN_BITS to the user-requested channel
+ * size.
+ */
+ osmesa->rb = new_osmesa_renderbuffer(&osmesa->mesa, osmesa->format, type);
+ _mesa_add_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT, osmesa->rb);
+ assert(osmesa->rb->RefCount == 2);
+
/* Set renderbuffer fields. Set width/height = 0 to force
* osmesa_renderbuffer_storage() being called by _mesa_resize_framebuffer()
*/
osmesa->rb->Data = buffer;
- osmesa->rb->DataType = type;
osmesa->rb->Width = osmesa->rb->Height = 0;
/* Set the framebuffer's size. This causes the
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index ecb2f6d5c1..7d5e5eb293 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -4187,11 +4187,10 @@ _slang_gen_variable(slang_assemble_ctx * A, slang_operation *oper)
slang_atom name = oper->var ? oper->var->a_name : oper->a_id;
slang_variable *var = _slang_variable_locate(oper->locals, name, GL_TRUE);
slang_ir_node *n;
- if (!var) {
+ if (!var || !var->declared) {
slang_info_log_error(A->log, "undefined variable '%s'", (char *) name);
return NULL;
}
- assert(var->declared);
n = new_var(A, var);
return n;
}
diff --git a/src/mesa/shader/slang/slang_compile_variable.h b/src/mesa/shader/slang/slang_compile_variable.h
index b4585599f2..5c9d248b35 100644
--- a/src/mesa/shader/slang/slang_compile_variable.h
+++ b/src/mesa/shader/slang/slang_compile_variable.h
@@ -41,7 +41,7 @@ typedef struct slang_variable_
GLuint size; /**< Variable's size in bytes */
GLboolean is_global;
GLboolean isTemp; /**< a named temporary (__resultTmp) */
- GLboolean declared; /**< for debug */
+ GLboolean declared; /**< has the var been declared? */
struct slang_ir_storage_ *store; /**< Storage for this var */
} slang_variable;