aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
Commit message (Collapse)AuthorAgeFilesLines
* mesa: fix _mesa_free_pipeline_data() use-after-free bugBrian Paul2014-09-121-2/+2
| | | | | | | | | | | | | Unreference the ctx->_Shader object before we delete all the pipeline objects in the hash table. Before, ctx->_Shader could point to freed memory when _mesa_reference_pipeline_object(ctx, &ctx->_Shader, NULL) was called. Fixes crash when exiting the piglit rendezvous_by_location test on Windows. Cc: [email protected] Reviewed-by: Ian Romanick <[email protected]>
* st/mesa: handle failed context creation for core profileBrian Paul2014-09-111-1/+4
| | | | | | | | | | | | If the glx/wgl state tracker requested a core profile but the gallium driver did not support some feature of GL 3.1 or later, we were setting ctx->Version=0 and then failing the assertion in _mesa_initialize_exec_table(). With this change we check for ctx->Version=0 and tear down the context and return NULL from st_create_context(). Reviewed-by: Marek Olšák <[email protected]>
* mesa: fix UNCLAMPED_FLOAT_TO_UBYTE() macro for MSVCBrian Paul2014-09-101-4/+4
| | | | | | | | | | MSVC replaces the "F" in "255.0F" with the macro argument which leads to an error. s/F/FLT/ to avoid that. It turns out we weren't using this macro at all on MSVC until the recent "mesa: Drop USE_IEEE define." change. Reviewed-by: Roland Scheidegger <[email protected]>
* mesa: trim down some #includesBrian Paul2014-09-107-12/+2
|
* mesa: Fix glGetActiveAttribute for gl_VertexID when lowered.Kenneth Graunke2014-09-101-1/+13
| | | | | | | | | | | | | The lower_vertex_id pass converts uses of the gl_VertexID system value to the gl_BaseVertex and gl_VertexIDMESA system values. Since gl_VertexID is no longer accessed, it would not be considered active. Of course, it should be, since the shader uses gl_VertexID. v2: Move the var->name dereference past the var != NULL check. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Replace string comparisons with SYSTEM_VALUE enum checks.Kenneth Graunke2014-09-101-2/+2
| | | | | | | This is more efficient. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add a lowering pass for gl_VertexIDIan Romanick2014-09-102-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | Converts gl_VertexID to (gl_VertexIDMESA + gl_BaseVertex). gl_VertexIDMESA is backed by SYSTEM_VALUE_VERTEX_ID_ZERO_BASE, and gl_BaseVertex is backed by SYSTEM_VALUE_BASE_VERTEX. v2: Put the enum in struct gl_constants and propoerly resolve the scope in C++ code. Fix suggested by Marek. v3: Reabase on Matt's foreach_in_list changes (was using foreach_list). v4 (Ken): Use a systemvalue instead of a uniform because STATE_BASE_VERTEX has been removed. v5: Use a boolean to select lowering, and only allow one lowering method. Suggested by Ken. v6 (Ken): Replace strcmp against literal "gl_BaseVertex"/"gl_VertexID" with SYSTEM_VALUE enum checks, for efficiency. v7: Rebase on context constant initialization work. Signed-off-by: Ian Romanick <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]>
* mesa: Add SYSTEM_VALUE_BASE_VERTEXIan Romanick2014-09-101-1/+14
| | | | | | | | | This system value represents the basevertex value passed to glDrawElementsBaseVertex and related functions. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* mesa: Add SYSTEM_VALUE_VERTEX_ID_ZERO_BASEIan Romanick2014-09-101-0/+12
| | | | | | | | | | | | There exists hardware, such as i965, that does not implement the OpenGL semantic for gl_VertexID. Instead, that hardware does not include the value of basevertex in the gl_VertexID value. SYSTEM_VALUE_VERTEX_ID_ZERO_BASE is the system value that represents this semantic. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* mesa: Document SYSTEM_VALUE_VERTEX_ID and SYSTEM_VALUE_INSTANCE_IDIan Romanick2014-09-101-0/+57
| | | | | | | | | v2: Additions to the documentation for SYSTEM_VALUE_VERTEX_ID. Quote the GL_ARB_shader_draw_parameters spec and mention DirectX SV_VertexID. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* mesa: set UniformBooleanTrue = 1.0f by defaultMarek Olšák2014-09-052-0/+10
| | | | | | | | | | because NativeIntegers is 0 by default. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82882 Cc: 10.2 10.3 [email protected] Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa: s/INLINE/inline/Brian Paul2014-09-043-5/+5
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: invalidate draw state in glPopClientAttribMarek Olšák2014-09-041-0/+4
| | | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82538 Cc: [email protected] Reviewed-by: Brian Paul <[email protected]>
* Eliminate several cases of multiplication in arguments to callocCarl Worth2014-09-031-4/+4
| | | | | | | | | | | | | | | | | | | | | | In commit 32f2fd1c5d6088692551c80352b7d6fa35b0cd09, several calls to _mesa_calloc(x) were replaced with calls to calloc(1, x). This is strictly equivalent to what the code was doing previously. But for cases where "x" involves multiplication, now that we are explicitly using the two-argument calloc, we can do one step better and replace: calloc(1, A * B); with: calloc(A, B); The advantage of the latter is that calloc will detect any overflow that would have resulted from the multiplication and will fail the allocation, (whereas the former would return a small allocation). So this fix can change potentially exploitable buffer overruns into segmentation faults. Reviewed-by: Matt Turner <[email protected]>
* main: Don't leak temporary texture rowsJason Ekstrand2014-09-021-0/+4
| | | | | Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* main/cs: Add gl_context::ComputeProgramPaul Berry2014-09-011-0/+15
| | | | Reviewed-by: Jordan Justen <[email protected]>
* mesa: Convert NewDriverState to 64-bitsJordan Justen2014-09-011-8/+8
| | | | | | | i965 will have more than 32 bits when BRW_STATE_COMPUTE_PROGRAM is added. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa: force height of 1D textures to be 1 in texture viewsIlia Mirkin2014-09-011-0/+3
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
* mesa: Delete ctx->GeometryProgram.Cache.Kenneth Graunke2014-08-291-3/+0
| | | | | | | | | | The VertexProgram and FragmentProgram have a Cache member for dealing with fixed function programs. There are no fixed function geometry programs, so this should never have existed, and was just copy and pasted. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: fix fallback texture for cube map arrayRoland Scheidegger2014-08-301-6/+10
| | | | | | | | | | | | mesa was creating a cube map array texture with just one layer, which is not legal. This caused an assertion failure when using that texture later in llvmpipe (when enabling cube map arrays) since it verifies the number of layers in the view is divisible by 6 (the sampling code might well crash randomly otherwise) with piglit glsl-resource-not-bound CubeArray -fbo -auto. v2: use appropriately sized texel array... Reviewed-by: Ian Romanick <[email protected]> (v1)
* mesa: implement GL_MAX_VERTEX_ATTRIB_STRIDETimothy Arceri2014-08-274-0/+31
| | | | | | | | V2: moved test for the VertexAttrib*Pointer() functions to update_array(), and made constant available for drivers to set Signed-off-by: Timothy Arceri <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Use a recursive mutex for the texture lock.Kenneth Graunke2014-08-201-1/+1
| | | | | | | | | | | | | | | This avoids problems with things like meta operations calling functions that want to take the lock while the lock is already held. Basically, the point is to guard against API reentrancy across threads...not to guard against ourselves. Dave Airlie opposed this change, but it makes master usable again and no one proposed a better solution. We can revert this if/when someone does. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]> Tested-by: Chris Forbes <[email protected]>
* mesa: Add support for inverted s/w conditional renderingChris Forbes2014-08-201-0/+13
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* mesa: fix NULL pointer deref bug in _mesa_drawbuffers()Brian Paul2014-08-191-1/+1
| | | | | | | | | This is a follow-on fix to commit 39b40ad144. Fixes a crash if the user calls glDrawBuffers(0, NULL). Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82814 Cc: "10.2" <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* mesa: add ARB_conditional_render_inverted flagsTobias Klausmann2014-08-193-2/+10
| | | | | | | | | Also add an extension bit so we can safely enable Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Chris Forbes <[email protected]> Signed-off-by: Tobias Klausmann <[email protected]>
* glapi: add GL_ARB_conditional_render_invertedTobias Klausmann2014-08-191-0/+4
| | | | | | Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Chris Forbes <[email protected]> Signed-off-by: Tobias Klausmann <[email protected]>
* mesa: Upload boolean uniforms using UniformBooleanTrue.Matt Turner2014-08-181-2/+2
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* mesa: fix copy and paste errors in glBindVertexBuffersTimothy Arceri2014-08-191-2/+2
| | | | | Signed-off-by: Timothy Arceri <[email protected]> Reviewed-by: Fredrik Höglund <[email protected]>
* mesa: fix compressed_subtexture_error_check() return valueBrian Paul2014-08-161-3/+3
| | | | | | | | | The function should return GLboolean, not GLenum. If we detect invalid compressed pixel storage parameters, we should return GL_TRUE, not GL_FALSE so that the function is no-op'd. An update to the piglit s3tc-errors test will check this. Reviewed-by: Matt Turner <[email protected]>
* mesa: move _mesa_compressed_texture_pixel_storage_error_check()Brian Paul2014-08-165-46/+61
| | | | | | | to pixelstore.c, add const qualifier to the 'packing' parameter. Add comments. Reviewed-by: Matt Turner <[email protected]>
* mesa: minor improvements to _mesa_compute_compressed_pixelstore()Brian Paul2014-08-163-12/+23
| | | | | | | | | Replace the gl_texture_image parameter with mesa_format since we only used the image's format. Add some comments. Reviewed-by: Matt Turner <[email protected]>
* mesa: Expose vbo_exec_DrawArraysInstanced as _mesa_DrawArraysInstanced.Kenneth Graunke2014-08-151-0/+4
| | | | | | | So we can use it in meta.c. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* mesa: Use _mesa_lock_context_textures in _mesa_GetTexParameterfv()Kristian Høgsberg2014-08-151-3/+3
| | | | | | | | | | | | | | | | | | | GetTexParamterfv() doesnt change texture state, so instead of _mesa_lock_texture() we can use _mesa_lock_context_textures(), which doesn't increase the texture stamp. With this change, _mesa_update_state_locked() is now only called from under _mesa_lock_context_textures(), which is right thing to do. Right now it's the same mutex, but if we made texture locking more fine grained locking one day, just locking one texture here would be wrong. This all ignores the fact that texture locking seem a bit flaky and broken, but we're trying to not blatantly make it worse. This change allows us to reliably unlock the context textures in the dd::UpdateState callback as is necessary for meta color resolves. Signed-off-by: Kristian Høgsberg <[email protected]> Acked-by: Kenneth Graunke <[email protected]>
* mesa: check if GL_ARB_copy_image is enabled in _mesa_CopyImageSubData()Brian Paul2014-08-151-1/+7
| | | | | | | | | | Generate a GL error and return rather than crashing on a null ctx->Driver.CopyImageSubData pointer (gallium). This allows apitraces with glCopyImageSubData() calls to continue rather than crash. Plus, fix a comment typo. Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: add ARB_derivative_control extension bitIlia Mirkin2014-08-142-0/+2
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa: add ARB_texture_barrier supportIlia Mirkin2014-08-141-0/+1
| | | | | | | | | This extension is identical to NV_texture_barrier. Alias glTextureBarrier to the existing glTextureBarrierNV and use the existing NV_texture_barrier extension bit. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa: Make ARB_gpu_shader5 core-profile-onlyChris Forbes2014-08-141-1/+1
| | | | | | | | | Requires GLSL 1.50 or higher, which we only support in the core profile. V2: Fix broken alignment Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa/texstore: Don't use the _mesa_swizzle_and_convert if we need transfer opsJason Ekstrand2014-08-131-0/+3
| | | | | | | | The _mesa_swizzle_and_convert path can't do transfer ops, so we should bail if they're needed. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* mesa: fix texstore with GL_COLOR_INDEX dataRoland Scheidegger2014-08-141-0/+3
| | | | | | | | | | | | | This got broken by 3dbf5bf6571e0c9d3e4febce01dea82be190d9d2. GL_COLOR_INDEX data is still supported (in legacy contexts), but the new texstore_swizzle path cannot handle it (and didn't detect this). Unfortunately there's no piglit test trying to specify textures with a GL_COLOR_INDEX source format, and I don't really understand how all the color map stuff which is used by this works, but this caused conform failures (with a reported mesa implementation error when trying to figure out the color mapping). Reviewed-by: Jason Ekstrand <[email protected]>
* swrast: Enable GL_ARB_texture_compression_bptcNeil Roberts2014-08-121-0/+1
| | | | | | Enables BPTC texture compression on the software rasterizer. Reviewed-by: Ian Romanick <[email protected]>
* mesa/main: Modify generate_mipmap_compressed to cope with float texturesNeil Roberts2014-08-121-5/+8
| | | | | | | | | Once we add BPTC texture support we will need to generate mipmaps for compressed floating point textures too. Most of the code seems to already be there but it just needs a few extra lines to get it to use GL_FLOAT instead of GL_UNSIGNED_BYTE as the type for the temporary buffers. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add texstore functions for BPTC-compressed texturesNeil Roberts2014-08-123-0/+709
| | | | | | | | | | | | | | | | | | | | | | This adds compressors for all four of the BPTC compressed-texture formats. The compressor is written from scratch and takes a very simple approach. It always uses a single mode of the BPTC format (4 for unorm and 3 for half-floats) and picks the two endpoints by dividing the texels into those which have more or less than the average luminance of the block and then calculating an average color of the texels within each division. It's probably not really sensible to try to use BPTC compression at runtime because for example with the Nvidia offline compression tool it can take in the order of an hour to compress a full-screen image. With that in mind I don't think it's worth having a proper compressor in Mesa and this approach gives reasonable results for a usage that is basically a corner case. v2: Always use the custom compressor, even for the unorm formats. Fix the quantization step for the half-float format compressor. Fixed a typo which was breaking the right-hand edge of half-float textures with a width that isn't a multiple of four. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add texel fetch functions for BPTC-compressed texturesNeil Roberts2014-08-123-0/+1000
| | | | | | | | | | Adds functions to fetch from any of the four BPTC-compressed formats. v2: Set the alpha component to 1.0 when fetching from the half-float formats instead of leaving it uninitialised. Don't linearize the alpha component when fetching from sRGB. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add the format enums for BPTC-compressed imagesNeil Roberts2014-08-127-0/+88
| | | | | | | | | | | | | | | | | | This adds the following four Mesa image format enums which correspond to the four BPTC compressed texture formats: MESA_FORMAT_BPTC_RGBA_UNORM MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT It also updates the format information functions to handle these and the corresponding GL enums. v2: Also modify _mesa_get_format_color_encoding, _mesa_get_srgb_format_linear and _mesa_get_uncompressed_format Reviewed-by: Ian Romanick <[email protected]>
* mesa/format_info: Add support for the BPTC layoutNeil Roberts2014-08-121-0/+3
| | | | | | | | | | | | | | | | | | Adds the ‘bptc’ layout to get_channel_bits. The channel bits for BPTC depend on the mode but as it only has to be an approximation this sets it to 8 for the two UNORM formats and 16 for the two half-float formats. These represent the minimum number of bits of variation that can be generated by the interpolation of the two formats. This doesn't quite match what we do for S3TC which only returns 4 even though it can similarly generate 8 bits from the interpolation. However it does match what we return for ETC2. For reference, NVidia seems to return 8 bits for the UNORM formats and 32 bits for the half-float formats. v2: Change the number of bits to 8/8/8/8 for the UNORM formats and 16/16/16 for the half-float formats. Reviewed-by: Jason Ekstrand <[email protected]>
* mesa/format_info: Add support for compressed floating-point formatsNeil Roberts2014-08-121-1/+3
| | | | | | | | | If the name of a compressed texture format has ‘FLOAT’ in it it will now set the data type of the format to GL_FLOAT. This will be needed for the BPTC half-float formats. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Fix the base format for GL_COMPRESSED_RGB_BPTC_*_FLOAT_ARBNeil Roberts2014-08-121-2/+2
| | | | | | | | The signed and unsigned half-float BPTC-compressed formats were being reported as having a base format of GL_RGBA but they don't store an alpha channel so it should be GL_RGB. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add the GL_ARB_texture_compression_bptc extensionNeil Roberts2014-08-122-0/+2
| | | | | | | This adds a boolean in the gl_extensions struct for GL_ARB_texture_compression_bptc as well as an entry in extension_table. Reviewed-by: Ian Romanick <[email protected]>
* mesa: return version 0 if the computed core profile version is too lowMarek Olšák2014-08-111-2/+7
| | | | Reviewed-by: Ilia Mirkin <[email protected]>
* mesa: add _mesa_get_version, a ctx-independent variant of _mesa_compute_versionMarek Olšák2014-08-112-126/+152
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>