diff options
-rw-r--r-- | mesalib/docs/relnotes-7.10.3.html | 303 | ||||
-rw-r--r-- | mesalib/src/mesa/main/buffers.c | 21 | ||||
-rw-r--r-- | mesalib/src/mesa/main/buffers.h | 118 | ||||
-rw-r--r-- | mesalib/src/mesa/main/context.c | 26 | ||||
-rw-r--r-- | mesalib/src/mesa/main/fbobject.c | 60 |
5 files changed, 434 insertions, 94 deletions
diff --git a/mesalib/docs/relnotes-7.10.3.html b/mesalib/docs/relnotes-7.10.3.html new file mode 100644 index 000000000..9ac5ef28e --- /dev/null +++ b/mesalib/docs/relnotes-7.10.3.html @@ -0,0 +1,303 @@ +<HTML> + +<head> +<TITLE>Mesa Release Notes</TITLE> +<link rel="stylesheet" type="text/css" href="mesa.css"> +<meta http-equiv="content-type" content="text/html; charset=utf-8" /> +</head> + +<BODY> + +<body bgcolor="#eeeeee"> + +<H1>Mesa 7.10.3 Release Notes / June 13, 2011</H1> + +<p> +Mesa 7.10.3 is a bug fix release which fixes bugs found since the 7.10.2 release. +</p> +<p> +Mesa 7.10.3 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +</p> +<p> +See the <a href="install.html">Compiling/Installing page</a> for prerequisites +for DRI hardware acceleration. +</p> + + +<h2>MD5 checksums</h2> +<pre> +d77b02034c11d6c2a55c07f82367d780 MesaLib-7.10.3.tar.gz +8c38fe8266be8e1ed1d84076ba5a703b MesaLib-7.10.3.tar.bz2 +614d063ecd170940d9ae7b355d365d59 MesaLib-7.10.3.zip +8768fd562ede7ed763d92b2d22232d7a MesaGLUT-7.10.3.tar.gz +1496415b89da9549f0f3b34d9622e2e2 MesaGLUT-7.10.3.tar.bz2 +1f29d0e7398fd3bf9f36f5db02941198 MesaGLUT-7.10.3.zip +</pre> + + +<h2>New features</h2> +<p>None.</p> + + +<h2>Bug fixes</h2> +<p>This list is likely incomplete.</p> +<ul> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29162">Bug 29162</a> - mesa/darwin is severly broken</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31590">Bug 31590</a> - Black space between colors on mole hill example</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32395">Bug 32395</a> - [glsl] Incorrect code generation for shadow2DProj() with bias</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32564">Bug 32564</a> - [llvmpipe] prog: Unknown command line argument '-disable-mmx'. Try: 'prog -help' with llvm-2.9svn</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32835">Bug 32835</a> - [glsl] recursive #define results in infinite stack recursion</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33303">Bug 33303</a> - [glsl] ir_constant_expression.cpp:72: virtual ir_constant* ir_expression::constant_expression_value(): Assertion `op[0]->type->base_type == op[1]->type->base_type' failed.</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33314">Bug 33314</a> - [glsl] ir_constant_expression.cpp:122: virtual ir_constant* ir_expression::constant_expression_value(): Assertion `op[0]->type->base_type == GLSL_TYPE_BOOL' failed.</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=33512">Bug 33512</a> - [SNB] case ogles2conform/GL/gl_FragCoord/gl_FragCoord_xy_frag.test and gl_FragCoord_w_frag.test fail</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34280">Bug 34280</a> - r200 mesa-7.10 font distortion</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34321">Bug 34321</a> - The ARB_fragment_program subset of ARB_draw_buffers not implemented</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=35603">Bug 35603</a> - GLSL compiler freezes compiling shaders</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=36173">Bug 36173</a> - struct renderbuffer's 'format' field never set when using FBO</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=36238">Bug 36238</a> - Mesa release files don't contain scons control files</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=36410">Bug 36410</a> - [SNB] Rendering errors in 3DMMES subtest taiji</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=36527">Bug 36527</a> - [wine] Wolfenstein: Failed to translate rgb instruction.</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=36651">Bug 36651</a> - mesa requires bison and flex to build but configure does not check for them</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=36738">Bug 36738</a> - Openarena crash with r300g, swrastg + llvm > 2.8</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=37648">Bug 37648</a> - Logic error in mesa/main/teximage.c:texsubimage</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=37739">Bug 37739</a> - Color clear of FBO without color buffer crashes</li> + +<!-- <li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=">Bug </a> - </li> --> +</ul> + + +<h2>Changes</h2> +<p>The full set of changes can be viewed by using the following GIT command:</p> + +<pre> + git log mesa-7.10.2..mesa-7.10.3 +</pre> + +<p>Alan Hourihane (1): +<ul> + <li>Check for out of memory when creating fence</li> +</ul></p> + +<p>Alex Buell (1): +<ul> + <li>configure: bump LIBDRM_REQUIRED to 2.4.24</li> +</ul></p> + +<p>Alex Deucher (2): +<ul> + <li>r600c: add new pci ids</li> + <li>r600g: add new pci ids</li> +</ul></p> + +<p>Brian Paul (19): +<ul> + <li>docs: add link to 7.10.2 release notes</li> + <li>scons: remove dangling reference to state_trackers/python/SConscript</li> + <li>Makefile: add missing Scons files</li> + <li>llvmpipe: document issue with LLVM 2.8 and earlier with AVX</li> + <li>docs: replace llvmpipe/README with docs/llvmpipe.html</li> + <li>glsl: add static qualifier to silence warning</li> + <li>glsl: add cast to silence signed/unsigned comparison warning</li> + <li>mesa: s/height/depth/ in texsubimage()</li> + <li>mesa: fix void pointer arithmetic warnings</li> + <li>mesa: add some missing GLAPIENTRY keywords</li> + <li>mesa: check that flex/bison are installed</li> + <li>st/mesa: fix incorrect texture level/face/slice accesses</li> + <li>draw: fix edge flag handling in clipper (for unfilled tris/quads/polygons)</li> + <li>vbo: check array indexes to prevent negative indexing</li> + <li>vbo: remove node->count > 0 test in vbo_save_playback_vertex_list()</li> + <li>st/mesa: fix software accum buffer format bug</li> + <li>mesa: add include/c99/inttypes.h include/c99/stdbool.h include/c99/stdint.h files to tarballs</li> + <li>docs: 7.10.3 release notes skeleton file, links</li> + <li>mesa: bump version to 7.10.3</li> +</ul></p> + +<p>Carl Worth (2): +<ul> + <li>glcpp: Simplify calling convention of parser's active_list functions</li> + <li>glcpp: Fix attempts to expand recursive macros infinitely (bug #32835).</li> +</ul></p> + +<p>Dave Airlie (1): +<ul> + <li>st/mesa: fix compressed mipmap generation.</li> +</ul></p> + +<p>Eric Anholt (19): +<ul> + <li>i965: Fix the VS thread limits for GT1, and clarify the WM limits on both.</li> + <li>glsl: Avoid cascading errors when looking for a scalar boolean and failing.</li> + <li>glsl: Semantically check the RHS of `&&' even when short-circuiting.</li> + <li>glsl: Semantically check the RHS of `||' even when short-circuiting.</li> + <li>glsl: When we've emitted a semantic error for ==, return a bool constant.</li> + <li>glsl: Perform type checking on "^^" operands.</li> + <li>intel: Use _mesa_base_tex_format for FBO texture attachments.</li> + <li>swrast: Don't assert against glReadPixels of GL_RED and GL_RG.</li> + <li>mesa: Add a gl_renderbuffer.RowStride field like textures have.</li> + <li>mesa: Add a function to set up the default renderbuffer accessors.</li> + <li>intel: Use Mesa core's renderbuffer accessors for depth.</li> + <li>mesa: Use _mesa_get_format_bytes to refactor out the RB get_pointer_*</li> + <li>mesa: Use _mesa_get_format_bytes to refactor out the RB get_row_*</li> + <li>mesa: Add renderbuffer accessors for R8/RG88/R16/RG1616.</li> + <li>swrast: Don't try to adjust_colors for <8bpc when handling R16, RG1616.</li> + <li>intel: Use mesa core's R8, RG88, R16, RG1616 RB accessors.</li> + <li>Revert "intel: Add spans code for the ARB_texture_rg support."</li> + <li>mesa: Add support for the ARB_fragment_program part of ARB_draw_buffers.</li> + <li>mesa: Add support for OPTION ATI_draw_buffers to ARB_fp.</li> +</ul></p> + +<p>Hans de Goede (1): +<ul> + <li>texstore: fix regression stricter check for memcpy path for unorm88 and unorm1616</li> +</ul></p> + +<p>Henri Verbeet (3): +<ul> + <li>mesa: Also update the color draw buffer if it's explicitly set to GL_NONE.</li> + <li>glx: Destroy dri2Hash on DRI2 display destruction.</li> + <li>glx: Only remove the glx_display from the list after it's destroyed.</li> +</ul></p> + +<p>Ian Romanick (9): +<ul> + <li>docs: Add 7.10.2 md5sums</li> + <li>glsl: Fix off-by-one error setting max_array_access for non-constant indexing</li> + <li>ir_to_mesa: Handle shadow compare w/projection and LOD bias correctly</li> + <li>intel: Fix ROUND_DOWN_TO macro</li> + <li>glsl: Regenerate compiler and glcpp files from cherry picks</li> + <li>i965: Remove hint_gs_always and resulting dead code</li> + <li>mesa: Don't try to clear a NULL renderbuffer</li> + <li>mesa: Ignore blits to/from missing buffers</li> + <li>docs: Add list of bugs fixed in 7.10.3 release</li> +</ul></p> + +<p>Jeremy Huddleston (18): +<ul> + <li>apple: Update GL specs</li> + <li>apple: Rename glcontextmodes.[ch] to glxconfig.[ch]</li> + <li>apple: Rename __GLcontextModes to struct glx_config</li> + <li>apple: Rename GLXcontext</li> + <li>apple: Re-add driContext and do_destroy</li> + <li>apple: Rename _gl_context_modes_find_visual to glx_config_find_visual</li> + <li>apple: Rename GLXcontext</li> + <li>apple: Change from XExtDisplayInfo to struct glx_display</li> + <li>apple: ifdef out come glapi-foo on darwin</li> + <li>glx: Dead code removal</li> + <li>apple: Build darwin using applegl rather than indirect</li> + <li>apple: Fix build failures in applegl_glx.c</li> + <li>darwin: Define GALLIUM_DRIVERS_DIRS in darwin config</li> + <li>apple: Package applegl source into MesaLib tarball</li> + <li>darwin: Set VG_LIB_{NAME,GLOB} to fix make install</li> + <li>darwin: Don't link against libGL when building libOSMesa</li> + <li>darwin: Fix VG_LIB_GLOB to also match the unversioned symlink</li> + <li>osmesa: Fix missing symbols when GLX_INDIRECT_RENDERING is defined.</li> +</ul></p> + +<p>José Fonseca (13): +<ul> + <li>llvmpipe: Update readme.</li> + <li>mesa: GL_PROVOKING_VERTEX_EXT is a GLenum, not GLboolean.</li> + <li>mesa: Fix GetVertexAttrib* inside display lists.</li> + <li>draw: Fix draw_variant_output::format's type.</li> + <li>gallivm: Tell LLVM to not assume a 16-byte aligned stack on x86.</li> + <li>gallivm: Fix for dynamically linked LLVM 2.8 library.</li> + <li>st/wgl: Adjust the pbuffer invisible window size.</li> + <li>st/wgl: Fix debug output format specifiers of stw_framebuffer_get_size().</li> + <li>st/wgl: Prevent spurious framebuffer sizes when the window is minimized.</li> + <li>st/wgl: Cope with zero width/height windows.</li> + <li>st/wgl: Allow to create pbuffers bigger than the desktop.</li> + <li>st/wgl: Remove buggy assertion.</li> + <li>wgl: Don't hold on to user supplied HDC.</li> +</ul></p> + +<p>Kenneth Graunke (10): +<ul> + <li>i965/fs: Switch W and 1/W in Sandybridge interpolation setup.</li> + <li>i965: Refactor Sandybridge implied move handling.</li> + <li>i965: Resolve implied moves in brw_dp_READ_4_vs_relative.</li> + <li>intel: Add IS_GT2 macro for recognizing Sandybridge GT2 systems.</li> + <li>i965: Allocate the whole URB to the VS and fix calculations for Gen6.</li> + <li>intel: Support glCopyTexImage() from ARGB8888 to XRGB8888.</li> + <li>glsl: Fix memory error when creating the supported version string.</li> + <li>glsl: Regenerate autogenerated file builtin_function.cpp.</li> + <li>i965: Rename various gen6 #defines to match the documentation.</li> + <li>i965: Never enable the GS on Gen6.</li> +</ul></p> + +<p>Kostas Georgiou (1): +<ul> + <li>r600c/g: Add pci id for FirePro 2270</li> +</ul></p> + +<p>Marek Olšák (18): +<ul> + <li>tgsi/ureg: bump the limit of immediates</li> + <li>st/mesa: fix changing internal format via RenderbufferStorage</li> + <li>st/mesa: GenerateMipmap should not be killed by conditional rendering</li> + <li>swrast: BlitFramebuffer should not be killed by conditional rendering</li> + <li>st/mesa: BlitFramebuffer should not be killed by conditional rendering</li> + <li>st/mesa: CopyTex(Sub)Image should not be killed by conditional rendering</li> + <li>st/mesa: conditional rendering should not kill texture decompression via blit</li> + <li>mesa: forbid UseProgram to be called inside Begin/End</li> + <li>mesa: UseShaderProgramEXT and Uniform* shouldn't be allowed inside Begin/End</li> + <li>mesa: queries of non-existent FBO attachments should return INVALID_OPERATION</li> + <li>r300g: fix draw_vbo splitting on r3xx-r4xx</li> + <li>r300g: fix texturing with non-3D textures and wrap R mode set to sample border</li> + <li>r300g: fix occlusion queries when depth test is disabled or zbuffer is missing</li> + <li>r300g: clear can be killed by render condition</li> + <li>st/mesa: remove asserts in st_texture_image_copy</li> + <li>mesa: fix up assertion in _mesa_source_buffer_exists</li> + <li>mesa: invalidate framebuffer if internal format of renderbuffer is changed</li> + <li>mesa: return after invalidating renderbuffer</li> +</ul></p> + +<p>Matt Turner (1): +<ul> + <li>r300/compiler: align memory allocations to 8-bytes</li> +</ul></p> + +<p>Tom Stellard (3): +<ul> + <li>r300/compiler: Fix incorrect presubtract conversion</li> + <li>r300/compiler: Fix dataflow analysis bug with ELSE blocks</li> + <li>r300/compiler: Limit instructions to 3 source selects</li> +</ul></p> + +<p>Vinson Lee (1): +<ul> + <li>gallivm: Disable MMX-disabling code on llvm-2.9.</li> +</ul></p> + +<p>Zou Nan hai (1): +<ul> + <li>i965: Align interleaved URB write length to 2</li> +</ul></p> + +<p>pepp (1): +<ul> + <li>st/mesa: assign renderbuffer's format field when allocating storage</li> +</ul></p> + +</body> +</html> diff --git a/mesalib/src/mesa/main/buffers.c b/mesalib/src/mesa/main/buffers.c index 63f53e2b0..a75c9c2e7 100644 --- a/mesalib/src/mesa/main/buffers.c +++ b/mesalib/src/mesa/main/buffers.c @@ -462,6 +462,27 @@ _mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers, /** + * Update the current drawbuffer's _ColorDrawBufferIndex[] list, etc. + * from the context's Color.DrawBuffer[] state. + * Use when changing contexts. + */ +void +_mesa_update_draw_buffers(struct gl_context *ctx) +{ + GLenum buffers[MAX_DRAW_BUFFERS]; + GLuint i; + + /* should be a window system FBO */ + assert(ctx->DrawBuffer->Name == 0); + + for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) + buffers[i] = ctx->Color.DrawBuffer[i]; + + _mesa_drawbuffers(ctx, ctx->Const.MaxDrawBuffers, buffers, NULL); +} + + +/** * Like \sa _mesa_drawbuffers(), this is a helper function for setting * GL_READ_BUFFER state in the context and current FBO. * \param ctx the rendering context diff --git a/mesalib/src/mesa/main/buffers.h b/mesalib/src/mesa/main/buffers.h index cf684c5fe..8083bc3d3 100644 --- a/mesalib/src/mesa/main/buffers.h +++ b/mesalib/src/mesa/main/buffers.h @@ -1,57 +1,61 @@ -/**
- * \file buffers.h
- * Frame buffer management functions declarations.
- */
-
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-
-#ifndef BUFFERS_H
-#define BUFFERS_H
-
-
-#include "glheader.h"
-
-struct gl_context;
-
-extern void GLAPIENTRY
-_mesa_DrawBuffer( GLenum mode );
-
-extern void GLAPIENTRY
-_mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers);
-
-extern void
-_mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers,
- const GLbitfield *destMask);
-
-extern void
-_mesa_readbuffer(struct gl_context *ctx, GLenum buffer, GLint bufferIndex);
-
-extern void GLAPIENTRY
-_mesa_ReadBuffer( GLenum mode );
-
-
-#endif
+/** + * \file buffers.h + * Frame buffer management functions declarations. + */ + +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + + +#ifndef BUFFERS_H +#define BUFFERS_H + + +#include "glheader.h" + +struct gl_context; + +extern void GLAPIENTRY +_mesa_DrawBuffer( GLenum mode ); + +extern void GLAPIENTRY +_mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers); + +extern void +_mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers, + const GLbitfield *destMask); + +extern void +_mesa_readbuffer(struct gl_context *ctx, GLenum buffer, GLint bufferIndex); + +extern void +_mesa_update_draw_buffers(struct gl_context *ctx); + + +extern void GLAPIENTRY +_mesa_ReadBuffer( GLenum mode ); + + +#endif diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index ea13bdd68..b83a5d621 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -1430,7 +1430,8 @@ _mesa_make_current( struct gl_context *newCtx, } if (curCtx && - (curCtx->WinSysDrawBuffer || curCtx->WinSysReadBuffer) && /* make sure this context is valid for flushing */ + (curCtx->WinSysDrawBuffer || curCtx->WinSysReadBuffer) && + /* make sure this context is valid for flushing */ curCtx != newCtx) _mesa_flush(curCtx); @@ -1445,8 +1446,6 @@ _mesa_make_current( struct gl_context *newCtx, _glapi_set_dispatch(newCtx->CurrentDispatch); if (drawBuffer && readBuffer) { - /* TODO: check if newCtx and buffer's visual match??? */ - ASSERT(drawBuffer->Name == 0); ASSERT(readBuffer->Name == 0); _mesa_reference_framebuffer(&newCtx->WinSysDrawBuffer, drawBuffer); @@ -1457,23 +1456,12 @@ _mesa_make_current( struct gl_context *newCtx, * or not bound to a user-created FBO. */ if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) { - /* KW: merge conflict here, revisit. - */ - /* fix up the fb fields - these will end up wrong otherwise - * if the DRIdrawable changes, and everything relies on them. - * This is a bit messy (same as needed in _mesa_BindFramebufferEXT) - */ - unsigned int i; - GLenum buffers[MAX_DRAW_BUFFERS]; - _mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer); - - for(i = 0; i < newCtx->Const.MaxDrawBuffers; i++) { - buffers[i] = newCtx->Color.DrawBuffer[i]; - } - - _mesa_drawbuffers(newCtx, newCtx->Const.MaxDrawBuffers, - buffers, NULL); + /* Update the FBO's list of drawbuffers/renderbuffers. + * For winsys FBOs this comes from the GL state (which may have + * changed since the last time this FBO was bound). + */ + _mesa_update_draw_buffers(newCtx); } if (!newCtx->ReadBuffer || newCtx->ReadBuffer->Name == 0) { _mesa_reference_framebuffer(&newCtx->ReadBuffer, readBuffer); diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index 2230b2623..07853e03c 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -78,9 +78,32 @@ static struct gl_renderbuffer DummyRenderbuffer; static struct gl_framebuffer IncompleteFramebuffer; -#define IS_CUBE_FACE(TARGET) \ - ((TARGET) >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && \ - (TARGET) <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) +static INLINE GLboolean +is_cube_face(GLenum target) +{ + return (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z); +} + + +/** + * Is the given FBO a user-created FBO? + */ +static INLINE GLboolean +is_user_fbo(const struct gl_framebuffer *fb) +{ + return fb->Name != 0; +} + + +/** + * Is the given FBO a window system FBO (like an X window)? + */ +static INLINE GLboolean +is_winsys_fbo(const struct gl_framebuffer *fb) +{ + return fb->Name == 0; +} static void @@ -196,7 +219,7 @@ _mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb, { GLuint i; - assert(fb->Name > 0); + assert(is_user_fbo(fb)); switch (attachment) { case GL_COLOR_ATTACHMENT0_EXT: @@ -244,7 +267,7 @@ static struct gl_renderbuffer_attachment * _mesa_get_fb0_attachment(struct gl_context *ctx, struct gl_framebuffer *fb, GLenum attachment) { - assert(fb->Name == 0); + assert(is_winsys_fbo(fb)); switch (attachment) { case GL_FRONT_LEFT: @@ -669,7 +692,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, GLint i; GLuint j; - assert(fb->Name != 0); + assert(is_user_fbo(fb)); numImages = 0; fb->Width = 0; @@ -968,10 +991,11 @@ _mesa_DeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers) _mesa_BindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); } - if (ctx->DrawBuffer->Name) { + if (is_user_fbo(ctx->DrawBuffer)) { detach_renderbuffer(ctx, ctx->DrawBuffer, rb); } - if (ctx->ReadBuffer->Name && ctx->ReadBuffer != ctx->DrawBuffer) { + if (is_user_fbo(ctx->ReadBuffer) + && ctx->ReadBuffer != ctx->DrawBuffer) { detach_renderbuffer(ctx, ctx->ReadBuffer, rb); } @@ -1203,7 +1227,7 @@ invalidate_rb(GLuint key, void *data, void *userData) struct gl_renderbuffer *rb = (struct gl_renderbuffer *) userData; /* If this is a user-created FBO */ - if (fb->Name) { + if (is_user_fbo(fb)) { GLuint i; for (i = 0; i < BUFFER_COUNT; i++) { struct gl_renderbuffer_attachment *att = fb->Attachment + i; @@ -1532,7 +1556,7 @@ check_begin_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb) GLuint i; ASSERT(ctx->Driver.RenderTexture); - if (fb->Name == 0) + if (is_winsys_fbo(fb)); return; /* can't render to texture with winsys framebuffers */ for (i = 0; i < BUFFER_COUNT; i++) { @@ -1552,7 +1576,7 @@ check_begin_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb) static void check_end_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb) { - if (fb->Name == 0) + if (is_winsys_fbo(fb)); return; /* can't render to texture with winsys framebuffers */ if (ctx->Driver.FinishRenderTexture) { @@ -1805,7 +1829,7 @@ _mesa_CheckFramebufferStatusEXT(GLenum target) return 0; } - if (buffer->Name == 0) { + if (is_winsys_fbo(buffer)) { /* The window system / default framebuffer is always complete */ return GL_FRAMEBUFFER_COMPLETE_EXT; } @@ -1843,7 +1867,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, } /* check framebuffer binding */ - if (fb->Name == 0) { + if (is_winsys_fbo(fb)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glFramebufferTexture%sEXT", caller); return; @@ -1866,7 +1890,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, } else { err = (texObj->Target == GL_TEXTURE_CUBE_MAP) - ? !IS_CUBE_FACE(textarget) + ? !is_cube_face(textarget) : (texObj->Target != textarget); } } @@ -1970,7 +1994,7 @@ _mesa_FramebufferTexture2DEXT(GLenum target, GLenum attachment, if ((texture != 0) && (textarget != GL_TEXTURE_2D) && (textarget != GL_TEXTURE_RECTANGLE_ARB) && - (!IS_CUBE_FACE(textarget))) { + (!is_cube_face(textarget))) { _mesa_error(ctx, GL_INVALID_OPERATION, "glFramebufferTexture2DEXT(textarget=0x%x)", textarget); return; @@ -2034,7 +2058,7 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment, return; } - if (fb->Name == 0) { + if (is_winsys_fbo(fb)) { /* Can't attach new renderbuffers to a window system framebuffer */ _mesa_error(ctx, GL_INVALID_OPERATION, "glFramebufferRenderbufferEXT"); return; @@ -2111,7 +2135,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, return; } - if (buffer->Name == 0) { + if (is_winsys_fbo(buffer)) { /* the default / window-system FBO */ att = _mesa_get_fb0_attachment(ctx, buffer, attachment); } @@ -2143,7 +2167,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, switch (pname) { case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT: - *params = buffer->Name == 0 ? GL_FRAMEBUFFER_DEFAULT : att->Type; + *params = is_winsys_fbo(buffer) ? GL_FRAMEBUFFER_DEFAULT : att->Type; return; case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT: if (att->Type == GL_RENDERBUFFER_EXT) { |