aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
Commit message (Collapse)AuthorAgeFilesLines
...
* mesa/fbobject: Update CubeMapFace when reusing texturesNanley Chery2016-11-181-0/+1
| | | | | | | | | | | | | | | | | | | | | Framebuffer attachments can be specified through FramebufferTexture* calls. Upon specifying a depth (or stencil) framebuffer attachment that internally reuses a texture, the cube map face of the new attachment would not be updated (defaulting to TEXTURE_CUBE_MAP_POSITIVE_X). Fix this issue by actually updating the CubeMapFace field. This bug manifested itself in BindFramebuffer calls performed on framebuffers whose stencil attachments internally reused a depth texture. When binding a framebuffer, we walk through the framebuffer's attachments and update each one's corresponding gl_renderbuffer. Since the framebuffer's depth and stencil attachments may share a gl_renderbuffer and the walk visits the stencil attachment after the depth attachment, the uninitialized CubeMapFace forced rendering to TEXTURE_CUBE_MAP_POSITIVE_X. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77662 Signed-off-by: Nanley Chery <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: add NV_image_formats extension supportLionel Landwerlin2016-11-182-6/+17
| | | | | | | | | | | | | | | This extension can be enabled automatically as it is a subset of ARB_shader_image_load_store. v2: Replace helper function by qualifier struct field (Ilia) Enable NV_image_formats using ARB_shader_image_load_store (Ilia) v3: Drop extension field from gl_extensions (Ilia) Release notes (Ilia) Signed-off-by: Lionel Landwerlin <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98480 Reviewed-by: Ilia Mirkin <[email protected]>
* mesa/main: consider multisampling enabled when number of samples == 1Nicolai Hähnle2016-11-181-1/+1
| | | | | | | | | | | | | | | There are some differences between how non-multisampled framebuffers (i.e. samples == 0) and multisampled framebuffers with a single sample should be treated. For example, alpha to coverage and writing to gl_SampleMask has an effect with single-sample multisample framebuffers, but not on non-multisample framebuffers. This fixes GL45-CTS.sample_variables.mask.*.samples_1.* at least for Gallium drivers (and possibly others, though at least radeonsi needs an additional fix). Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* mesa: fix empty program log lengthTapani Pälli2016-11-182-3/+6
| | | | | | | | | | | | | | | | | | | In case we have empty log (""), we should return 0. This fixes Khronos WebGL conformance test 'program-infolog'. From OpenGL ES 3.1 (and OpenGL 4.5 Core) spec: "If pname is INFO_LOG_LENGTH , the length of the info log, including a null terminator, is returned. If there is no info log, zero is returned." v2: apply same fix for get_shaderiv and _mesa_GetProgramPipelineiv (Ian) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> (v1) Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97321 Cc: "13.0" <[email protected]>
* mesa: Drop PATH_MAX usage.Kenneth Graunke2016-11-172-34/+15
| | | | | | | | | | | | | | | | | | | | | | | | GNU/Hurd does not define PATH_MAX since it doesn't have such arbitrary limitation, so this failed to compile. Apparently glibc does not enforce PATH_MAX restrictions anyway, so it's kind of a hoax: https://www.gnu.org/software/libc/manual/html_node/Limits-for-Files.html MSVC uses a different name (_MAX_PATH) as well, which is annoying. We don't really need it. We can simply asprintf() the filenames. If the filename exceeds an OS path limit, presumably fopen() will fail, and we already check that. (We actually use ralloc_asprintf because Mesa provides that everywhere, and it doesn't look like we've provided an implementation of GNU's asprintf() for all platforms.) Fixes the build on GNU/Hurd. Cc: "13.0" <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98632 Signed-off-by: Samuel Thibault <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* mesa: Add missing call to _mesa_unlock_debug_state(ctx); v2Tom Stellard2016-11-171-1/+3
| | | | | | | | | | | | cd724208d3e1e3307f84a794f2c1fc83b69ccf8a added a call to _mesa_lock_debug_state(ctx) but wasn't unlocking the debug state. This fixes a hang in glsl-fs-loop piglit test with MESA_DEBUG=context. v2: - Remove unrelated changes. Reviewed-by: Brian Paul <[email protected]>
* st/mesa/r200/i915/i965: move ARB program fields into a unionTimothy Arceri2016-11-174-82/+86
| | | | | | | | | | | It's common for games to compile 2000 programs or more so at 32bits x 2000 programs x 22 fields x 2 (at least) stages This should give us something like 352 kilobytes in savings once we add some more glsl only fields. Reviewed-by: Emil Velikov <[email protected]>
* mesa: make use of ralloc when creating ARB asm gl_program fieldsTimothy Arceri2016-11-172-5/+8
| | | | | | | | | | | This will allow us to move the ARB asm fields in gl_program into a union as we will be able call ralloc_free() on the entire struct when destroying the context. In this change we switch over to using ralloc for the Instructions, String and LocalParams fields of gl_program. Reviewed-by: Emil Velikov <[email protected]>
* mesa/glsl: copy num_abos to gl_programTimothy Arceri2016-11-171-0/+1
| | | | | | | We should be able to free gl_linked_shader after linking in order to do so we need to switch to getting values from gl_program instead. Reviewed-by: Emil Velikov <[email protected]>
* mesa/glsl: copy num_images to gl_programTimothy Arceri2016-11-171-0/+2
| | | | | | | We should be able to free gl_linked_shader after linking in order to do so we need to switch to getting values from gl_program instead. Reviewed-by: Emil Velikov <[email protected]>
* mesa: if MESA_DEBUG=context, create a debug contextBrian Paul2016-11-163-2/+25
| | | | | | | | | | | | | | | | | | | A number of drivers report useful debug/perf information accessible through GL_ARB_debug_output and with debug contexts (i.e. setting the GLX_CONTEXT_DEBUG_BIT_ARB flag). But few applications actually use the GL_ARB_debug_output extension. This change lets one set the MESA_DEBUG env var to "context" to force-set a debug context and report debug/perf messages to stderr (or whatever file MESA_LOG_FILE is set to). This is a useful debugging tool. The small change in st_api_create_context() is needed so that st_update_debug_callback() gets called to hook up the driver debug callbacks when ST_CONTEXT_FLAG_DEBUG was not set, but MESA_DEBUG=context. v2: use %.*s format string instead of allocating temporary buffer. Reviewed-by: Nicolai Hähnle <[email protected]>
* main: return error if asking for GL_TEXTURE_BORDER_COLOR in ↵Samuel Iglesias Gonsálvez2016-11-151-0/+12
| | | | | | | | | | | | | | | | | | | | | TEXTURE_2D_MULTISAMPLE{_ARRAY} through TexParameter{i,Ii,Iui}v() OpenGL ES 3.2 says in section 8.10. "TEXTURE PARAMETERS", at the end of the section: "An INVALID_ENUM error is generated if target is TEXTURE_2D_- MULTISAMPLE or TEXTURE_2D_MULTISAMPLE_ARRAY , and pname is any sampler state from table 21.12." GL_TEXTURE_BORDER_COLOR is present in that table. v2: - Add check to _mesa_texture_parameteriv() (Kenneth) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98250 Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* Fix races during _mesa_HashWalk().Steinar H. Gunderson2016-11-121-11/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is currently no protection against walking a hash (using _mesa_HashWalk()) and modifying it at the same time, for instance by inserting or deleting elements. This leads to segfaults in multithreaded code if e.g. someone calls glTexImage2D (which may have to walk the list of FBOs) while another thread is calling glDeleteFramebuffers on another thread with the two contexts sharing lists. The reason for this is that _mesa_HashWalk() doesn't actually take the mutex that normally protects the hash; it takes an entirely different mutex. Thus, walks are only protected against other walks, and there is also no outer lock taking this. There is an old comment saying that this is to fix problems with deadlock if the callback needs to take a mutex; we solve this by changing the mutex to be recursive. A demonstration Helgrind hit from a real application: ==13412== Possible data race during write of size 8 at 0x3498C6A8 by thread #1 ==13412== Locks held: 2, at addresses 0x1AF09530 0x2B3DF400 ==13412== at 0x1F040C99: _mesa_hash_table_remove (hash_table.c:395) ==13412== by 0x1EE98174: _mesa_HashRemove_unlocked (hash.c:350) ==13412== by 0x1EE98174: _mesa_HashRemove (hash.c:365) ==13412== by 0x1EE2372D: _mesa_DeleteFramebuffers (fbobject.c:2669) ==13412== by 0x6105AA4: movit::ResourcePool::cleanup_unlinked_fbos(void*) (resource_pool.cpp:473) ==13412== by 0x610615B: movit::ResourcePool::release_fbo(unsigned int) (resource_pool.cpp:442) [...] ==13412== This conflicts with a previous read of size 8 by thread #20 ==13412== Locks held: 2, at addresses 0x1AF09558 0x1AF73318 ==13412== at 0x1F040CD9: _mesa_hash_table_next_entry (hash_table.c:415) ==13412== by 0x1EE982A8: _mesa_HashWalk (hash.c:426) ==13412== by 0x1EED6DFD: _mesa_update_fbo_texture.part.33 (teximage.c:2683) ==13412== by 0x1EED9410: _mesa_update_fbo_texture (teximage.c:3043) ==13412== by 0x1EED9410: teximage (teximage.c:3073) ==13412== by 0x1EEDA28F: _mesa_TexImage2D (teximage.c:3105) ==13412== by 0x166A68: operator() (mixer.cpp:454) There are many more interactions than just these two possible. Cc: 11.2 12.0 13.0 <[email protected]> Signed-off-by: Steinar H. Gunderson <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: fix comment indentation in bind_buffers_check_offset_and_size()Brian Paul2016-11-111-10/+10
| | | | Trivial.
* mesa/compiler: move MAX_VARYING to shader_enums.hKenneth Graunke2016-11-111-1/+0
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* mesa: remove LowerShaderSharedVariablesMarek Olšák2016-11-101-3/+0
| | | | | | always true for compute shaders Reviewed-by: Kenneth Graunke <[email protected]>
* mesa/extensions: expose OES_vertex_half_float for ES2Kevin Strasser2016-11-093-2/+7
| | | | | | | | | Half float support already exists for desktop GL. Reuse the ARB_half_float_vertex enable bit and account for the different enum to enable the extension for ES2. Signed-off-by: Kevin Strasser <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Add helper function _mesa_is_alpha_to_coverage_enabled()Anuj Phogat2016-11-072-0/+16
| | | | | | Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ben Widawsky <[email protected]>
* mesa: Add helper function _mesa_is_alpha_test_enabled()Anuj Phogat2016-11-072-0/+14
| | | | | | Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ben Widawsky <[email protected]>
* mesa: Use separate line for function return typeAnuj Phogat2016-11-071-1/+2
| | | | | | Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ben Widawsky <[email protected]>
* mesa: drop current draw/read buffer when ctx is releasedRob Clark2016-11-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a problem seen with gallium drivers vs android wallpaper. Basically, what happens is: EGLSurface tmpSurface = mEgl.eglCreatePbufferSurface(mEglDisplay, mEglConfig, attribs); mEgl.eglMakeCurrent(mEglDisplay, tmpSurface, tmpSurface, mEglContext); int[] maxSize = new int[1]; Rect frame = surfaceHolder.getSurfaceFrame(); glGetIntegerv(GL_MAX_TEXTURE_SIZE, maxSize, 0); mEgl.eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); mEgl.eglDestroySurface(mEglDisplay, tmpSurface); ... check maxSize vs frame size and bail if needed ... mEglSurface = mEgl.eglCreateWindowSurface(mEglDisplay, mEglConfig, surfaceHolder, null); ... error checking ... mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext); When the window-surface is created, it ends up with the same ptr address as the recently freed tmpSurface pbuffer surface. Which after many levels of indirection, results in st_framebuffer_validate() ending up with the same/old framebuffer object, and in the end never calling the DRIimageLoaderExtension::getBuffers(). Then in droid_swap_buffers(), the dri2_surf is still the old pbuffer surface (with dri2_surf->buffer being NULL, obviously, so when wallpaper app calls eglSwapBuffers() nothing gets enqueued to the compositor). Resulting in a black/blank background layer. Note that at the EGL layer, when the context is unbound, EGL drops it's references to the draw and read buffer as well. Signed-off-by: Rob Clark <[email protected]> Tested-by: Robert Foss <[email protected]> Acked-by: Tapani Pälli <[email protected]>
* mesa: Add linear ETC2/EAC to the compressed format list with ES3 compat.Kenneth Graunke2016-11-041-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | GL_ARB_ES3_compatibility brings ETC2/EAC formats to desktop GL. The meaning of the GL compressed format list is pretty vague - it's supposed to return formats for "general-purpose usage". (GL 4.2 deprecates the list because of this.) Basically everyone interprets this as "linear RGB/RGBA". ETC2/EAC meets that criteria, so while we shouldn't be required to add it to the list, there's also little harm in doing so, at least on platforms with native support. I doubt anyone is using this list for much anyway, so even on platforms without native support, it's probably not a big deal. Makes the following GL45-CTS.gtf43 tests pass: * GL3Tests.eac_compression_r11.gl_compressed_r11_eac * GL3Tests.eac_compression_rg11.gl_compressed_rg11_eac * GL3Tests.eac_compression_signed_r11.gl_compressed_signed_r11_eac * GL3Tests.eac_compression_signed_rg11.gl_compressed_signed_rg11_eac * GL3Tests.etc2_compression_rgb8.gl_compressed_rgb8_etc2 * GL3Tests.etc2_compression_rgb8_pt_alpha1.gl_compressed_rgb8_pt_alpha1_etc2 * GL3Tests.etc2_compression_rgba8.gl_compressed_rgba8_etc2 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* mesa/glsl: delete previously linked shaders earlier when linkingTimothy Arceri2016-11-032-14/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This moves the delete linked shaders call to _mesa_clear_shader_program_data() which makes sure we delete them before returning due to any validation problems. It also reduces some code duplication. From the OpenGL 4.5 Core spec: "If LinkProgram failed, any information about a previous link of that program object is lost. Thus, a failed link does not restore the old state of program. ... If one of these commands is called with a program for which LinkProgram failed, no error is generated unless otherwise noted. Implementations may return information on variables and interface blocks that would have been active had the program been linked successfully. In cases where the link failed because the program required too many resources, these commands may help applications determine why limits were exceeded." Therefore it's expected that we shouldn't be able to query the program that failed to link and retrieve information about a previously successful link. Before this change the linker was doing validation before freeing the previously linked shaders and therefore could exit on failure before they were freed. This change also fixes an issue in compat profile where a program with no shaders attached is expect to fall back to fixed function but was instead trying to relink IR from a previous link. Reviewed-by: Tapani Pälli <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97715 Cc: "13.0" <[email protected]>
* mesa: move shader_info to the start of gl_programTimothy Arceri2016-11-031-2/+3
| | | | | | | | | | This will allow use to use ralloc_parent() on the info field and fix a regression in nir_sweep() caused by e1af20f18a8. This is intended to be a temporary requirement that will be removed when we finish separating shader_info from nir_shader. Reviewed-by: Eric Anholt <[email protected]>
* mesa: rename gl_client_array -> gl_vertex_arrayBrian Paul2016-10-284-13/+15
| | | | | | | | | | | The term "client array" is a legacy thing dating back to the pre-VBO era when _all_ vertex arrays lived in client memory. Nowadays, it only contains vertex array state which is derived from gl_array_attributes and gl_vertex_buffer_binding. It's used by the VBO module and some drivers. Reviewed-by: Anuj Phogat <[email protected]>
* mesa: code clean-up in _mesa_update_vao_client_arrays()Brian Paul2016-10-281-8/+5
| | | | | | Init vars where declared, use const qualifiers. Reviewed-by: Anuj Phogat <[email protected]>
* mesa: update comment on vertex_attrib_binding()Brian Paul2016-10-281-1/+2
| | | | | | Was missed in an earlier renaming patch. Reviewed-by: Anuj Phogat <[email protected]>
* mesa: rename gl_vertex_array_object::VertexBinding to BufferBindingBrian Paul2016-10-288-51/+51
| | | | | | To be a little more understandable. Reviewed-by: Anuj Phogat <[email protected]>
* mesa: expose GL_EXT_robustnessTapani Pälli2016-10-271-0/+1
| | | | | | | | | | | Fixes 8 failing dEQP tests: dEQP-EGL.functional.create_context_ext.robust_gles* (now 42 tests pass in dEQP-EGL*robust*, 0 fail and rest are skipped) Signed-off-by: Tapani Pälli <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98343 Reviewed-by: Eric Engestrom <[email protected]>
* mesa: add missing CONTEXT_ROBUST_ACCESS enumTapani Pälli2016-10-274-0/+8
| | | | | | | | commit 85008db1d51f923113832394d7f8d6b1868be882 missed this enum for GL_KHR_robustness implementation Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* compiler: remove copy_shader_info()Timothy Arceri2016-10-261-2/+0
| | | | | | | This temporary helper is no longer needed now that we have finished refactoring common shader metadata. Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: set uses texture gather directly in shader_infoTimothy Arceri2016-10-261-2/+0
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* glsl/st/mesa: use common system values read fieldTimothy Arceri2016-10-261-1/+0
| | | | | | | | | And set system values read directly in shader_info. st/mesa changes where: Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: set patch outputs written directly in shader_infoTimothy Arceri2016-10-261-1/+0
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: set patch inputs read directly in shader_infoTimothy Arceri2016-10-261-1/+0
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: set outputs read directly in shader_infoTimothy Arceri2016-10-261-1/+0
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* r200/glsl/st/mesa: use common outputs written fieldTimothy Arceri2016-10-264-5/+4
| | | | | | | | | And set outputs written directly in shader_info. st/mesa changes where: Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa/glsl: set double inputs read directly in shader_infoTimothy Arceri2016-10-261-1/+0
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* r200/i915/st/mesa/compiler: use common inputs read fieldTimothy Arceri2016-10-265-8/+7
| | | | | | | | | | | | And set set inputs_read directly in shader_info. To avoid regressions between changes this change is a squashed version of the following patches. st/mesa changes where: Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa/compiler: copy early fragment tests to shader_info in ↵Timothy Arceri2016-10-261-0/+1
| | | | | | _mesa_copy_linked_program_data() Reviewed-by: Jason Ekstrand <[email protected]>
* st/mesa/r200/i915/i965: eliminate gl_fragment_programTimothy Arceri2016-10-268-88/+64
| | | | | | | | | | Here we move OriginUpperLeft and PixelCenterInteger into gl_program all other fields have been replace by shader_info. V2: Don't use anonymous union/structs to hold vertex/fragment fields suggested by Ian. Reviewed-by: Jason Ekstrand <[email protected]>
* i965/mesa/st/swrast: set fs shader_info directly and switch to using itTimothy Arceri2016-10-261-2/+1
| | | | | | | Note we access shader_info from the program struct rather than the nir_shader pointer because shader cache won't create a nir_shader. Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: remove now unused IsCentroid from gl_fragment_programTimothy Arceri2016-10-261-6/+0
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: remove now unused InterpQualifierTimothy Arceri2016-10-261-7/+0
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* i965/mesa/st: eliminate gl_compute_programTimothy Arceri2016-10-262-24/+7
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: set cs shader_info metadata directlyTimothy Arceri2016-10-261-5/+3
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* mesa/i965/i915/r200: eliminate gl_vertex_programTimothy Arceri2016-10-269-81/+74
| | | | | | | Here we move the only field in gl_vertex_program to the ARB program fields in gl_program. Reviewed-by: Jason Ekstrand <[email protected]>
* i965/mesa/st: eliminate gl_geometry_programTimothy Arceri2016-10-263-25/+9
| | | | | | We now get all the gs metadata from shader_info. Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: set gs shader_info metadata directlyTimothy Arceri2016-10-261-9/+7
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* i965/mesa/st: eliminate gl_tess_eval_programTimothy Arceri2016-10-263-22/+8
| | | | | | We now get all the tes metadata from shader_info. Reviewed-by: Jason Ekstrand <[email protected]>