aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-09-20 10:36:45 -0600
committerBrian Paul <[email protected]>2009-09-20 10:36:45 -0600
commitebf2710b2fd21ae9a6604c015ca7a948589f5a8c (patch)
treedd6b9da40b44824a1a4bdcfb4b3b2fc7edef3233 /src/mesa/state_tracker
parented4076b5b8c5d3c024e291f42a8730b4f71226c9 (diff)
parent82c2f7756af19f0a19aeda7ea1f627262e4561c0 (diff)
Merge branch 'mesa_7_6_branch'
Conflicts: src/mesa/drivers/dri/intel/intel_clear.c
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c1
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c18
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c18
3 files changed, 29 insertions, 8 deletions
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index a96602878e4..fe0a1214933 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -258,6 +258,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw)
strb->Base.ClassID = 0x4242; /* just a unique value */
strb->Base.NumSamples = samples;
strb->format = format;
+ init_renderbuffer_bits(strb, format);
strb->software = sw;
switch (format) {
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index c0ace3b9eac..3520c986b47 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -658,8 +658,10 @@ st_TexImage(GLcontext * ctx,
format, type,
pixels, unpack, "glTexImage");
}
- if (!pixels)
- return;
+
+ /* Note: we can't check for pixels==NULL until after we've allocated
+ * memory for the texture.
+ */
/* See if we can do texture compression with a blit/render.
*/
@@ -670,6 +672,9 @@ st_TexImage(GLcontext * ctx,
stImage->pt->format,
stImage->pt->target,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) {
+ if (!pixels)
+ goto done;
+
if (compress_with_blit(ctx, target, level, 0, 0, 0, width, height, depth,
format, type, pixels, unpack, texImage)) {
goto done;
@@ -711,6 +716,9 @@ st_TexImage(GLcontext * ctx,
return;
}
+ if (!pixels)
+ goto done;
+
DBG("Upload image %dx%dx%d row_len %x pitch %x\n",
width, height, depth, width * texelBytes, dstRowStride);
@@ -753,9 +761,9 @@ st_TexImage(GLcontext * ctx,
}
}
+done:
_mesa_unmap_teximage_pbo(ctx, unpack);
-done:
if (stImage->pt && texImage->Data) {
st_texture_image_unmap(ctx->st, stImage);
texImage->Data = NULL;
@@ -1092,7 +1100,7 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
if (!texImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage");
- return;
+ goto done;
}
src = (const GLubyte *) pixels;
@@ -1123,9 +1131,9 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
}
}
+done:
_mesa_unmap_teximage_pbo(ctx, packing);
-done:
if (stImage->pt) {
st_texture_image_unmap(ctx->st, stImage);
texImage->Data = NULL;
diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
index ca32b2e573c..5c0d335d62d 100644
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ b/src/mesa/state_tracker/st_framebuffer.c
@@ -66,7 +66,7 @@ st_create_framebuffer( const __GLcontextModes *visual,
else {
/* Only allocate front buffer right now if we're single buffered.
* If double-buffered, allocate front buffer on demand later.
- * See check_create_front_buffers().
+ * See check_create_front_buffers() and st_set_framebuffer_surface().
*/
struct gl_renderbuffer *rb
= st_new_renderbuffer_fb(colorFormat, samples, FALSE);
@@ -170,8 +170,20 @@ st_set_framebuffer_surface(struct st_framebuffer *stfb,
strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer);
- /* fail */
- if (!strb) return;
+ if (!strb) {
+ if (surfIndex == ST_SURFACE_FRONT_LEFT) {
+ /* Delayed creation when the window system supplies a fake front buffer */
+ struct st_renderbuffer *strb_back
+ = st_renderbuffer(stfb->Base.Attachment[ST_SURFACE_BACK_LEFT].Renderbuffer);
+ struct gl_renderbuffer *rb
+ = st_new_renderbuffer_fb(surf->format, strb_back->Base.NumSamples, FALSE);
+ _mesa_add_renderbuffer(&stfb->Base, BUFFER_FRONT_LEFT, rb);
+ strb = st_renderbuffer(rb);
+ } else {
+ /* fail */
+ return;
+ }
+ }
/* replace the renderbuffer's surface/texture pointers */
pipe_surface_reference( &strb->surface, surf );