aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/common
Commit message (Collapse)AuthorAgeFilesLines
* meta: Move loop declaration to top of block.José Fonseca2015-01-221-2/+4
| | | | | | Fixes MSVC build. Trvial.
* meta: Add an implementation of GetTexSubImage for PBOsJason Ekstrand2015-01-222-0/+125
| | | | Reviewed-by: Neil Roberts <[email protected]>
* meta: Add a BlitFramebuffers-based implementation of TexSubImageJason Ekstrand2015-01-222-0/+247
| | | | | | | | | | | | | | This meta path, designed for use with PBO's, creates a temporary texture out of the PBO and uses BlitFramebuffers to do the actual texture upload. v2 Jason Ekstrand <[email protected]>: - Add support for handling simple packing options v3 Jason Ekstrand <[email protected]>: - Refactor to split out the texture-from-pbo code - Rename to _mesa_meta_pbo_TexSubImage Reviewed-by: Neil Roberts <[email protected]>
* meta: Put _mesa_meta_in_progress in the header fileIan Romanick2015-01-142-12/+5
| | | | | | | | | | | | | | | ...so that it can be inlined in the two places that call it. On Bay Trail-D using Fedora 20 compile flags (-m64 -O2 -mtune=generic for 64-bit and -m32 -march=i686 -mtune=atom for 32-bit), affects Gl32Batch7: 32-bit: No difference proven at 95.0% confidence (n=120) 64-bit: Difference at 95.0% confidence 1.24042% +/- 0.382277% (n=40) Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* main: Renamed _mesa_get_compressed_teximage to _mesa_GetCompressedTexImage_sw.Laura Ekstrand2015-01-081-1/+1
| | | | | | | | This reflects the new naming convention for software fallbacks. To avoid confusion with ARB_DIRECT_STATE_ACCESS backend functions, software fallbacks now have the form _mesa_[Driver function name]_sw. Reviewed-by: Anuj Phogat <[email protected]>
* main: Renamed _mesa_get_teximage to _mesa_GetTexImage_sw.Laura Ekstrand2015-01-081-1/+1
| | | | | | | | This reflects the new naming convention for software fallbacks. To avoid confusion with ARB_DIRECT_STATE_ACCESS backend functions, software fallbacks now have the form _mesa_[Driver function name]_sw. Reviewed-by: Anuj Phogat <[email protected]>
* main: Changed _mesa_alloc_texture_storage to _mesa_AllocTextureStorage_sw.Laura Ekstrand2015-01-081-1/+1
| | | | | | | | | | | | | | In order to implement ARB_DIRECT_STATE_ACCESS, many GL API functions must now rely on a backend that both traditional and DSA functions can use. For instance, _mesa_TexStorage2D and _mesa_TextureStorage2D both call a backend function _mesa_texture_storage that takes a context and a texture object as arguments. The backend is named _mesa_texture_storage so that Meta can call it and avoid looking up the context and the texture object. However, backend names often look very close to the names of software fallbacks (ie. _mesa_alloc_texture_storage). For this reason, software fallbacks have been renamed for clarity to have the form _mesa_[Driver function name]_sw. Reviewed-by: Anuj Phogat <[email protected]>
* mesa: remove unused ctx parameter for _mesa_select_tex_image()Brian Paul2015-01-052-4/+4
| | | | Reviewed-by: Eric Anholt <[email protected]>
* meta: init var to silence uninitialized variable warningBrian Paul2015-01-051-1/+1
|
* meta: Only use _mesa_ClipControl if the extension is supportedIan Romanick2014-10-241-4/+7
| | | | | | | | | Fixes many piglit failures on IVB since 85edaa8. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85425 Reviewed-by: Jason Ekstrand <[email protected]> Cc: Mathias Fröhlich <[email protected]>
* mesa: Handle clip control in meta operations.Mathias Fröhlich2014-10-242-0/+9
| | | | | | | | | | | Restore clip control to the default state if MESA_META_VIEWPORT or MESA_META_DEPTH_TEST is requested. v3: Handle clip control state with MESA_META_TRANSFORM. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Froehlich <[email protected]>
* meta/msaa-blit: consider weird sample count case unreachableChris Forbes2014-10-181-0/+1
| | | | | | | | Suppresses a bunch of warning noise about sample_map possibly being used uninitialized. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* meta: Fix make check failures in setup_glsl_msaa_blit_scaled_shader()Anuj Phogat2014-10-011-8/+9
| | | | | | | introduced by commit 68ee950. Signed-off-by: Anuj Phogat <[email protected]> Reported-by: Mark Janes <[email protected]>
* meta: (trivial) remove accidental double semicolonRoland Scheidegger2014-10-011-1/+1
|
* meta: Implement ext_framebuffer_multisample_blit_scaled extensionAnuj Phogat2014-10-012-13/+199
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extension enables doing a multisample buffer resolve and buffer scaling using a single glBlitFrameBuffer() call. Currently, we have this extension implemented in BLORP which is only used by SNB and IVB. This patch implements the extension in meta path which makes it available to Broadwell. Implementation features: - Supports scaled resolves of 2X, 4X and 8X multisample buffers. - Avoids unnecessary shader compilations by storing the pre compiled shaders for each supported sample count. - Uses bilinear filtering for both GL_SCALED_RESOLVE_FASTEST_EXT and GL_SCALED_RESOLVE_NICEST_EXT filter options. This is an allowed behavior in the extension's spec. - I tried doing bicubic filtering for GL_SCALED_RESOLVE_NICEST_EXT filter. It made the edges in the image look little smoother but the image gets blurred causing no overall quality improvement. For now I have dropped the idea of doing different filtering for nicest filter. V2: - Minor changes to simplify the fragment shader. - Refactor the code to move i965 specific sample_map computation out of Meta. We now use ctx->Const.SampleMap{2,4,8}x variables initialized by the driver. - Use a simple msaa resolve shader for scaled resolves with scaling factor = 1.0. V3: - Make changes to create a string out of ctx->Const.SampleMap{2,4,8}x variables and use it in fragment shader. V4: - Make changes to use uint8_t type ctx->Const.SampleMap{2,4,8}x variables. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* meta: Fix error paths in meta_copy_image.cJuha-Pekka Heikkila2014-09-231-0/+9
| | | | | | | | If _mesa_get_tex_image() return NULL there is already error set in context. Other error pats free allocated texture. Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* meta: Avoid null access on setup_glsl_msaa_blit_shader()Juha-Pekka Heikkila2014-09-231-11/+13
| | | | | | | On default fallback path there was null access on src_rb Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* i965: in set_read_rb_tex_image() check _mesa_meta_bind_rb_as_tex_image() did ↵Juha-Pekka Heikkila2014-09-231-1/+8
| | | | | | | | | | | succeed Check if _mesa_meta_bind_rb_as_tex_image() did give the texture. If no texture was given there is already either GL_INVALID_VALUE or GL_OUT_OF_MEMORY error set in context. Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]>
* meta: Store precompiled msaa shaders for all supported sample countsAnuj Phogat2014-09-052-22/+55
| | | | | | | | | | | | | | | | | | | | | | | | | Currently, BLIT_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE* and BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE* shaders in setup_glsl_msaa_blit_shader() are not recompiled when the source buffer sample count changes. For example, implementation continued using a 4X msaa shader, even if source buffer changes from 4X msaa to 8x msaa. It causes incorrect rendering. This patch adds new enums in blit_msaa_shader, one for each supported sample count, and uses them to store msaa shaders. Fixes following piglit tests on Broadwell: ext_framebuffer_multisample-accuracy all_samples color ext_framebuffer_multisample-accuracy all_samples depth_draw ext_framebuffer_multisample-accuracy all_samples depth_resolve ext_framebuffer_multisample-accuracy all_samples stencil_draw ext_framebuffer_multisample-accuracy all_samples stencil_resolve ext_framebuffer_multisample-formats all_samples Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Jason Ekstarnd <[email protected]>
* meta: s/INLINE/inline/Brian Paul2014-09-041-1/+1
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* meta/copy_image: Use the correct texture level when creating viewsJason Ekstrand2014-09-031-1/+1
| | | | | | | | | | | | | | Previously, we were accidentally assuming that the level of both textures was 0. Now we actually use the correct level in our hacked texture view. This doesn't 100% fix the meta path because the texture type is getting lost somewhere in the pipeline. However, it actually copies to/from the correct layer now. Signed-off-by: Jason Ekstrand <[email protected]> Cc: "10.3" <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82804 Tested-by: Tapani Pälli <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* meta: Make MESA_META_DRAW_BUFFERS restore properlyKristian Høgsberg2014-09-021-34/+4
| | | | | | | | | | | | | | | | | | | | A meta begin/end pair with MESA_META_DRAW_BUFFERS will change visible GL state. We recreate the draw buffer enums from the buffer bitfield, which changes GL_BACK to GL_BACK_LEFT (and GL_FRONT to GL_FRONT_LEFT). This commit modifes the save/restore logic to instead copy the buffer enums from the gl_framebuffer and then set them on restore using _mesa_drawbuffers(). It's not clear how this breaks the benchmark in 82796, but fixing meta to not leak the state change fixes the regression. No piglit regressions. Reviewed-by: Kenneth Graunke <[email protected]> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=82796 Signed-off-by: Kristian Høgsberg <[email protected]> Cc: [email protected]
* i965,meta: Stop unlocking the texture to try and prevent deadlocks.Kenneth Graunke2014-08-201-18/+0
| | | | | | | | | | Unlocking the texture is not safe: another thread could come in and grab it. Now that we use a recursive mutex, this should work. This also fixes texture lock deadlocks in the new meta fast clear path. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]> Tested-by: Chris Forbes <[email protected]>
* meta: Use instanced rendering for layered clears.Kenneth Graunke2014-08-151-16/+5
| | | | | | | | | Layered rendering is part of OpenGL 3.2; GL_ARB_draw_instanced is part of OpenGL 3.1. As such, all drivers supporting layered rendering already support gl_InstanceID. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* meta: Export _mesa_meta_drawbuffers_from_bitfield()Kristian Høgsberg2014-08-152-3/+6
| | | | | | | We'll use this in the i965 fast clear implementation. Signed-off-by: Kristian Høgsberg <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* mesa/meta: Support decompressing floating-point formatsNeil Roberts2014-08-122-33/+78
| | | | | | | | | | | | | Previously the Meta implementation of glGetTexImage would fall back to _mesa_get_teximage if the texturing is not using an unsigned normalised format. However in order to support the half-float formats of BPTC textures we can make it render to a floating-point renderbuffer instead. This patch makes decompression_state have two FBOs, one for the GL_RGBA format and one for GL_RGBA32F. If a floating-point texture is encountered it will try setting up a floating-point FBO. It will now also check the status of the FBO and fall back to _mesa_get_teximage if the FBO is not complete. Reviewed-by: Ian Romanick <[email protected]>
* mesa/meta: Add a partial implementation of CopyImageSubDataJason Ekstrand2014-08-112-0/+207
| | | | | | | | | | | | | | | | This provides an implementation of CopyImageSubData that works if both textures are uncompressed. This implementation works by using a combination of texture views and BlitFramebuffer. If one of the textures is compressed, it returns false and the driver is expected to provide a fallback. v2: Don't leak fbo's Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Neil Roberts <[email protected]> v3: Change glGen/DeleteTextures to _mesa_Gen/DeleteTextures
* mesa/meta: Make _mesa_meta_bind_fbo_image also take a framebuffer targetJason Ekstrand2014-08-113-19/+25
| | | | | | Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Neil Roberts <[email protected]>
* meta: Disable dithering during glBlitFramebufferNeil Roberts2014-08-051-0/+3
| | | | | | | | | | | | | | | According to the GL spec the only fragment operations that should affect glBlitFramebuffer are “the pixel ownership test, the scissor test, and sRGB conversion”. That implies that dithering should not be performed so we need to disable it when implementing the blit with a render. Before commit 05b52efbc97731 the dithering state would be left as whatever the application picks (the default being GL_TRUE) and after that commit it was explicitly enabled. Neither of these were correct. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81828 Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]>
* meta: Fix datatype computation in get_temp_image_type()Anuj Phogat2014-08-041-5/+4
| | | | | | | | | | | | | | Changes in the patch will cause datatype to be computed correctly for 8 and 16 bit integer formats. For example: GL_RG8I, GL_RG16I etc. Fixes many failures in gles3 Khronos CTS test: copy_tex_image_conversions_required copy_tex_image_conversions_forbidden Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]>
* meta: Move the call to _mesa_get_format_datatype() out of switchAnuj Phogat2014-08-041-7/+3
| | | | | Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]>
* meta: Use _mesa_get_format_bits() to get the GL_RED_BITSAnuj Phogat2014-08-041-2/+3
| | | | | | | | | | | | | We currently get red bits from ctx->DrawBuffer->Visual.redBits by making a false assumption that the texture we're writing to (in glCopyTexImage2D()) is used as a DrawBuffer. Fixes many failures in gles3 Khronos CTS test: copy_tex_image_conversions_required Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]>
* meta: Initialize the variable in declaration statementAnuj Phogat2014-08-041-3/+1
| | | | | | | Saves one line of code :) Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]>
* util: Move ralloc to a new src/util directory.Kenneth Graunke2014-08-042-2/+2
| | | | | | | | | | | | | | | | | | For a long time, we've wanted a place to put utility code which isn't directly tied to Mesa or Gallium internals. This patch creates a new src/util directory for exactly that purpose, and builds the contents as libmesautil.la. ralloc seemed like a good first candidate. These days, it's directly used by mesa/main, i965, i915, and r300g, so keeping it in src/glsl didn't make much sense. Signed-off-by: Kenneth Graunke <[email protected]> v2 (Jason Ekstrand): More realloc uses and some scons fixes Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* meta: Add a meta implementation of GL_ARB_clear_textureNeil Roberts2014-07-233-0/+197
| | | | | | | | | | | | | | | | | | | | Adds an implementation of the ClearTexSubImage driver entry point that tries to set up an FBO to render to the texture and then calls glClearBuffer with a scissor to perform the actual clear. If an FBO can't be created for the texture then it will fall back to using _mesa_store_ClearTexSubImage. When used in combination with _mesa_store_ClearTexSubImage this should provide an implementation that works for all DRI-based drivers. However as this has only been tested with the i965 driver it is currently only enabled there. v2: Only enable the extension for the i965 driver instead of all DRI drivers. Remove an unnecessary goto. Don't require GL_ARB_framebuffer_object. Add some more comments. v3: Use glClearBuffer* to avoid having to modify glClearColor and friends. Handle sRGB textures. Explicitly disable dithering. Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
* meta: Add a state flag for the GL_DITHERNeil Roberts2014-07-232-0/+12
| | | | | | | | | The Meta implementation of glClearTexSubImage is going to want to ensure that dithering is disabled so that it can get a consistent color across the whole texture when clearing. This adds a state flag to easily save it and set it to the default value when performing meta operations. Reviewed-by: Topi Pohjolainen <[email protected]>
* meta: Call glObjectLabel before linking.Kenneth Graunke2014-07-091-1/+1
| | | | | | | | | | | i965 precompiles shaders at link time, and prints a disassembly if INTEL_DEBUG=vs,gs,fs, including the shader name. However, blit shaders were showing up as "unnamed" since we hadn't set a name prior to linking. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa: Make unreachable macro take a string argument.Matt Turner2014-07-011-2/+1
| | | | | | To aid in debugging. Reviewed-by: Ian Romanick <[email protected]>
* meta: Use AMD_vertex_shader_layer instead of a GS for layered clears.Kenneth Graunke2014-06-301-37/+16
| | | | | | | | | | | | | | | | | | | | | | | On i965, enabling and disabling the GS is not free: you have to do a full pipeline stall, reconfigure the URB and push constant space, and emit a bunch of state. Most clears aren't layered, so the GS isn't needed in the common case. But we turned it on universally. Using AMD_vertex_shader_layer allows us to skip setting up the GS altogether, while achieving the same effect. According to Ilia, current nVidia GPUs can't do AMD_vertex_shader_layer. However, since nouveau is Gallium-based, they're unlikely to ever care about this path. Intel and AMD GPUs both support the extension. Since i965 is the only driver using this path which does layered rendering, we may as well target it at that. v2: Improve commit message. No code changes. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Chris Forbes <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* meta: Respect the driver's maximum number of draw buffersIan Romanick2014-06-181-2/+2
| | | | | | | | | | | | | | | Commit c1c1cf5f9 added infrastructure for saving and restoring draw buffer state. However, it universially used MAX_DRAW_BUFFERS, but many drivers support far fewer than that at limit. For example, the radeon and i915 drivers only support 1. Using MAX_DRAW_BUFFERS causes meta to generate GL errors. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80115 Reviewed-by: Kenneth Graunke <[email protected]> Tested-by: Kenneth Graunke <[email protected]> [on Broadwell] Tested-by: [email protected] Cc: "10.2" <[email protected]>
* mesa: Mark default case unreachable to silence warning.Matt Turner2014-06-171-0/+1
| | | | | | | | Warned about 'coord' being undefined in the default case, which is unreachable. Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* meta_blit: properly compute texture width for the CopyTexSubImage fallbackJason Ekstrand2014-06-131-1/+1
| | | | | | | Cc: "10.2" <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* meta: save and restore swizzle for _GenerateMipmapRobert Bragg2014-06-111-0/+12
| | | | | | | | | | This makes sure to use a no-op swizzle while iteratively rendering each level of a mipmap otherwise we may loose components and effectively apply the swizzle twice by the time these levels are sampled. Signed-off-by: Robert Bragg <[email protected]> Reviewed-by: Chris Forbes <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* meta: Label the meta GLSL clear program.Kenneth Graunke2014-06-101-0/+1
| | | | | | | | | Giving the meta clear program a meaningful name makes it easier to find in output such as INTEL_DEBUG=fs or INTEL_DEBUG=shader_time. We already did so for integer programs, but neglected to label the primary program. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa/drivers: Add extra null check in blitframebuffer_texture()Juha-Pekka Heikkila2014-05-301-0/+3
| | | | | | | | If texObj == NULL here it mean there is already GL_INVALID_VALUE or GL_OUT_OF_MEMORY error set to context. Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* meta/blit: Use gl_FragColor also in the msaa blit shaderTopi Pohjolainen2014-05-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes framebuffer_blit_functionality_multisampled_to_singlesampled_blit es3 cts test on bdw. Also fixes this on ivb when ivb is forced to use the meta path. No piglit regressions on IVB. Further input from Ken: "Unfortunately, this doesn't fix MRT for integer data. In the single-sampled case, since we're directly copying data, we were read/copy/write data as "float" values, which actually contained the integer bits. Here, we can't do that since we need to process the actual integer data. I do wonder if we could use intBitsToFloat/uintBitsToFloat to stuff the integer bits in the float gl_FragColor output. Just a crazy idea. In the long term (post 10.2), I think we should draft an extension that allows you to do "layout(location = all)" on user-defined fragment shader outputs. (Or some similar syntax.)" Signed-off-by: Topi Pohjolainen <[email protected]> Cc: "10.2" <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* meta/blit: Add stencil texturing mode save and restoreTopi Pohjolainen2014-05-272-3/+14
| | | | | | | | v2 (Ken): Only restore the mode if it has changed. Signed-off-by: Topi Pohjolainen <[email protected]> Cc: "10.2" <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Move declaration to top of block.José Fonseca2014-05-231-1/+3
| | | | To fix MSVC build. Trivial.
* meta blit: Set Z texcoord during meta blit to sample the correct layerJordan Justen2014-05-231-1/+8
| | | | | | | | | | | | If the source renderbuffer has a depth > 0, then send a Z texcoord which is set to the source attachment Z offset. This fixes piglit's gl-3.2-layered-rendering-gl-layer-render with the GL_TEXTURE_2D_MULTISAMPLE_ARRAY case test on i965/gen8. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Cc: "10.2" <[email protected]>
* meta: Use gl_FragColor to output color values to all the draw buffersAnuj Phogat2014-05-211-11/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _mesa_meta_setup_blit_shader() currently generates a fragment shader which, irrespective of the number of draw buffers, writes the color to only one 'out' variable. Current shader rely on an undefined behavior and possibly works by chance. From OpenGL 4.0 spec, page 256: "If a fragment shader writes to gl_FragColor, DrawBuffers specifies a set of draw buffers into which the single fragment color defined by gl_FragColor is written. If a fragment shader writes to gl_FragData, or a user-defined varying out variable, DrawBuffers specifies a set of draw buffers into which each of the multiple output colors defined by these variables are separately written. If a fragment shader writes to none of gl_FragColor, gl_FragData, nor any user defined varying out variables, the values of the fragment colors following shader execution are undefined, and may differ for each fragment color." OpenGL 4.4 spec, page 463, added an additional line in this section: "If some, but not all user-defined output variables are written, the values of fragment colors corresponding to unwritten variables are similarly undefined." V2: Write color output to gl_FragColor instead of writing to multiple 'out' variables. This'll avoid recompiling the shader every time draw buffers count is updated. Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>