summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
Commit message (Collapse)AuthorAgeFilesLines
* mesa: make _CurrentFragmentProgram a gl_program struct pointerTimothy Arceri2017-01-065-24/+20
| | | | | | | | Making this point to a gl_program struct rather than a gl_shader_program struct will allow use to later also make the CurrentProgram array hold gl_program structs which in turn will allow for code simpilifcation. Reviewed-by: Eric Anholt <[email protected]>
* st/mesa/glsl: add new is_arb_asm flag in gl_programTimothy Arceri2017-01-065-5/+7
| | | | | | | | | | | | | | | | Set the flag via the _mesa_init_gl_program() and NewProgram() helpers. In i965 we currently check for the existance of gl_shader_program to decide if this is an ARB assembly style program or not. Adding a flag makes the code clearer and will help removes a dependency on gl_shader_program in the i965 codegen functions. Also this will allow use to skip initialising sampler units for linked shaders, we currently memset it to zero again during linking. Reviewed-by: Eric Anholt <[email protected]>
* st/mesa/glsl/i965: move ShaderStorageBlocks to gl_programTimothy Arceri2017-01-061-2/+1
| | | | | | | | | | | | Having it here rather than in gl_linked_shader allows us to simplify the code. Also it is error prone to depend on the gl_linked_shader for programs in current use because a failed linking attempt will free infomation about the current program. In i965 we could be trying to recompile a shader variant but may have lost some required fields. Reviewed-by: Lionel Landwerlin <[email protected]>
* st/mesa/glsl/i965: set num_ssbos directly in shader_infoTimothy Arceri2017-01-061-1/+0
| | | | | | | Here we also remove the duplicate field in gl_linked_shader and always get the value from shader_info instead. Reviewed-by: Lionel Landwerlin <[email protected]>
* st/mesa/glsl/i965: move per stage UniformBlocks to gl_programTimothy Arceri2017-01-061-2/+2
| | | | | | | This will help allow us to store pointers to gl_program structs in the CurrentProgram array resulting in a bunch of code simplifications. Reviewed-by: Lionel Landwerlin <[email protected]>
* st/mesa/glsl/i965: set num_ubos directly in shader_infoTimothy Arceri2017-01-061-1/+0
| | | | | | | This also removes the duplicate field in gl_linked_shader, and gets num_ubos from shader_info instead. Reviewed-by: Lionel Landwerlin <[email protected]>
* st/mesa/glsl/i965: move ImageUnits and ImageAccess fields to gl_programTimothy Arceri2017-01-062-21/+21
| | | | | | | | | | | | | | | Having it here rather than in gl_linked_shader allows us to simplify the code. Also it is error prone to depend on the gl_linked_shader for programs in current use because a failed linking attempt will free infomation about the current program. In i965 we could be trying to recompile a shader variant but may have lost some required fields. We drop the memset on ImageUnits because gl_program is already created using rzalloc(). Reviewed-by: Lionel Landwerlin <[email protected]>
* mesa: add gl_constants::GLSLOptimizeConservativelyMarek Olšák2017-01-052-3/+14
| | | | | | to reduce the amount of GLSL optimizations for drivers that can do better. Reviewed-by: Eric Anholt <[email protected]>
* glsl/mesa: add reference to gl_shader_program_data from gl_programTimothy Arceri2016-12-311-0/+3
| | | | | | | | | We also add the stubs for the standalone compiler in this change. By adding a reference here we can now refactor some code to use gl_program where we were previously awkwardly using gl_shader_program. Reviewed-by: Eric Anholt <[email protected]>
* mesa: make union in gl_program a struct and add FIXMETimothy Arceri2016-12-311-1/+5
| | | | | | | | i915 is mixing the use of these fields, for now change this to a struct and add a FIXME. Reviewed-by: Kenneth Graunke <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99229
* mesa/glsl/i965: remove Driver.NewShader()Timothy Arceri2016-12-303-27/+0
| | | | | | | | | After removing brw_shader in the previous commit this is no longer needed. V2: remove use in src/compiler/glsl/test_optpass.cpp Reviewed-by: Eric Anholt <[email protected]>
* mesa/glsl: move BlendSupport bitfield to gl_programTimothy Arceri2016-12-302-6/+15
| | | | | | | | | | | | This will let us to make _CurrentFragmentProgram a gl_program pointer allowing for simpilifications to be made. We also need to add a field to gl_shader to hold it during parsing. In gl_program we put it inside a union in anticipation of moving more fields here that can be only fs or vertex stage fields. Reviewed-by: Eric Anholt <[email protected]>
* mesa: store gl_program in gl_transform_feedback_object rather than ↵Timothy Arceri2016-12-302-14/+13
| | | | | | | | | gl_shader_program This will allow us to make the CurrentProgram array store gl_program which allows us to do a bunch of simplifications. Reviewed-by: Eric Anholt <[email protected]>
* mesa/glsl: move LinkedTransformFeedback from gl_shader_program to gl_programTimothy Arceri2016-12-303-7/+9
| | | | | | | | | | | | This will help allow us to store gl_program in the CurrentProgram array rather than gl_shader_program which will allow a bunch of simplifications. Note that we make LinkedTransformFeedback a pointer so we don't waste memory creating a struct for each stage. We also store a pointer to the gl_program that will contain the pointer in gl_shader_program so we can get easy access to the correct stage. Reviewed-by: Eric Anholt <[email protected]>
* mesa: move _Used to gl_programTimothy Arceri2016-12-302-5/+6
| | | | | | We no longer need to initialise it because gl_program is never reused. Reviewed-by: Eric Anholt <[email protected]>
* mesa/compiler: add local_size_variable to shader_infoTimothy Arceri2016-12-301-0/+1
| | | | | | | | This will be used in api_validate.c in a following patch when we switch to using gl_program pointers for the pipelines CurrentProgram array. Reviewed-by: Eric Anholt <[email protected]>
* mesa: pass gl_program to _mesa_append_uniforms_to_file()Timothy Arceri2016-12-301-1/+1
| | | | | | This now contains everything we need. Reviewed-by: Eric Anholt <[email protected]>
* glsl/mesa: set separate_shader directly in shader_infoTimothy Arceri2016-12-301-0/+1
| | | | Reviewed-by: Eric Anholt <[email protected]>
* mesa/glsl: move subroutine metadata to gl_programTimothy Arceri2016-12-303-63/+66
| | | | | | | | This will allow us to store gl_program rather than gl_shader_program as the current program perstage which allows us to simplify code that makes use of the CurrentProgram list. Reviewed-by: Eric Anholt <[email protected]>
* mesa/shaderobj: Fix races on refcountsChad Versace2016-12-281-10/+4
| | | | | | | | | | | | | | | | | | | | | | Use atomic ops when updating gl_shader::RefCount. Fixes intermittent failures and crashes in 'dEQP-EGL.functional.sharing.gles2.multithread.*'. All tests in that group now pass except 'dEQP-EGL.functional.sharing.gles2.multithread.simple_egl_server_sync.textures.copyteximage2d_texsubimage2d_render'. Tested with: mesa: branch 'master' at d6545f2 deqp: branch 'nougat-cts-dev' at 4acf725 with additional local fixes DEQP_TARGET: x11_egl hw: Intel Broadwell 0x1616 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99085 Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Cc: [email protected] Cc: Mark Janes <[email protected]> Cc: Haixia Shi <[email protected]>
* mesa/texformat: Handle GL_RGBA + GL_UNSIGNED_SHORT_5_5_5_1Chad Versace2016-12-271-0/+2
| | | | | | | | | | | | | | | | _mesa_choose_tex_format() already handles GL_RGBA + GL_UNSIGNED_SHORT_1_5_5_5_REV by converting it to MESA_FORMAT_B5G5R5A1_UNORM. Teach it do the same for the non-reversed type. Otherwise, the switch's fallthrough converts it to an 8888 format, which has incompatible precision in the alpha channel. Patch 2/2 to fix dEQP-EGL.functional.image.modify.tex_rgb5_a1_tex_subimage_rgba8 on Intel. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99185 Cc: Haixia Shi <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Cc: "13.0" <[email protected]>
* mesa: don't attempt to unlock an unlocked debug state mutexJonathan Gray2016-12-201-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 929fcee47e46781c57f2a354ce0a013915c033d1 introduced code that attempts to unlock an unlocked mutex which is undefined behaviour. On OpenBSD this leads to an abort: 0 0x0000124dadfa96ba in thrkill () at <stdin>:2 1 0x0000124dadf3da39 in *_libc_abort () at /usr/src/lib/libc/stdlib/abort.c:52 2 0x0000124d2c1165b5 in *_libpthread_pthread_mutex_unlock (mutexp=<optimized out>) at /usr/src/lib/librthread/rthread_sync.c:221 3 0x0000124d279c02e4 in init_attrib_groups (ctx=0x124df0fda000) at main/context.c:825 4 _mesa_initialize_context (ctx=ctx@entry=0x124df0fda000, api=api@entry=API_OPENGL_CORE, visual=visual@entry=0x7f7ffffbdfd0, share_list=share_list@entry=0x0, driverFunctions=driverFunctions@entry=0x7f7ffffbda60) at main/context.c:1204 5 0x0000124d27b507ec in st_create_context (api=api@entry=API_OPENGL_CORE, pipe=pipe@entry=0x124dc4910000, visual=visual@entry=0x7f7ffffbdfd0, share=share@entry=0x0, options=options@entry=0x7f7ffffbe128) at state_tracker/st_context.c:545 6 0x0000124d27b8639f in st_api_create_context (stapi=<optimized out>, smapi=0x124d1b608800, attribs=0x7f7ffffbe100, error=0x7f7ffffbe0fc, shared_stctxi=0x0) at state_tracker/st_manager.c:669 7 0x0000124d27cc5b9c in dri_create_context (api=<optimized out>, visual=0x124d8a0f8a00, cPriv=0x124de473f240, major_version=<optimized out>, minor_version=<optimized out>, flags=<optimized out>, notify_reset=false, error=0x7f7ffffbe2b4, sharedContextPrivate=0x0) at dri_context.c:123 8 0x0000124d27cc5029 in driCreateContextAttribs (screen=0x124d8a0f8400, api=<optimized out>, config=0x124d8a0f8a00, shared=<optimized out>, num_attribs=<optimized out>, attribs=<optimized out>, error=0x7f7ffffbe2b4, data=0x124d77814a00) at dri_util.c:448 9 0x0000124d8e109b00 in drisw_create_context_attribs (base=0x124df3e08700, config_base=0x124d7a0e7300, shareList=<optimized out>, num_attribs=<optimized out>, attribs=<optimized out>, error=0x7f7ffffbe2b4) at drisw_glx.c:476 10 0x0000124d8e104b4a in glXCreateContextAttribsARB (dpy=0x124d533f0000, config=0x124d7a0e7300, share_context=0x0, direct=1, attrib_list=0x7f7ffffbe300) at create_context.c:78 Signed-off-by: Jonathan Gray <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* mesa: Silence numerous "unused parameter" warnings in dlist.cIan Romanick2016-12-191-33/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | main/dlist.c: In function ‘save_DrawArraysInstancedARB’: main/dlist.c:1748:36: warning: unused parameter ‘mode’ [-Wunused-parameter] save_DrawArraysInstancedARB(GLenum mode, ^~~~ main/dlist.c:1749:35: warning: unused parameter ‘first’ [-Wunused-parameter] GLint first, ^~~~~ main/dlist.c:1750:37: warning: unused parameter ‘count’ [-Wunused-parameter] GLsizei count, ^~~~~ main/dlist.c:1751:37: warning: unused parameter ‘primcount’ [-Wunused-parameter] GLsizei primcount) ^~~~~~~~~ main/dlist.c: In function ‘save_DrawElementsInstancedARB’: main/dlist.c:1759:38: warning: unused parameter ‘mode’ [-Wunused-parameter] save_DrawElementsInstancedARB(GLenum mode, ^~~~ main/dlist.c:1760:39: warning: unused parameter ‘count’ [-Wunused-parameter] GLsizei count, ^~~~~ main/dlist.c:1761:38: warning: unused parameter ‘type’ [-Wunused-parameter] GLenum type, ^~~~ main/dlist.c:1762:45: warning: unused parameter ‘indices’ [-Wunused-parameter] const GLvoid *indices, ^~~~~~~ main/dlist.c:1763:39: warning: unused parameter ‘primcount’ [-Wunused-parameter] GLsizei primcount) ^~~~~~~~~ main/dlist.c: In function ‘save_DrawElementsInstancedBaseVertexARB’: main/dlist.c:1771:48: warning: unused parameter ‘mode’ [-Wunused-parameter] save_DrawElementsInstancedBaseVertexARB(GLenum mode, ^~~~ main/dlist.c:1772:49: warning: unused parameter ‘count’ [-Wunused-parameter] GLsizei count, ^~~~~ main/dlist.c:1773:48: warning: unused parameter ‘type’ [-Wunused-parameter] GLenum type, ^~~~ main/dlist.c:1774:55: warning: unused parameter ‘indices’ [-Wunused-parameter] const GLvoid *indices, ^~~~~~~ main/dlist.c:1775:49: warning: unused parameter ‘primcount’ [-Wunused-parameter] GLsizei primcount, ^~~~~~~~~ main/dlist.c:1776:47: warning: unused parameter ‘basevertex’ [-Wunused-parameter] GLint basevertex) ^~~~~~~~~~ main/dlist.c: In function ‘save_DrawArraysInstancedBaseInstance’: main/dlist.c:1785:45: warning: unused parameter ‘mode’ [-Wunused-parameter] save_DrawArraysInstancedBaseInstance(GLenum mode, ^~~~ main/dlist.c:1786:44: warning: unused parameter ‘first’ [-Wunused-parameter] GLint first, ^~~~~ main/dlist.c:1787:46: warning: unused parameter ‘count’ [-Wunused-parameter] GLsizei count, ^~~~~ main/dlist.c:1788:46: warning: unused parameter ‘primcount’ [-Wunused-parameter] GLsizei primcount, ^~~~~~~~~ main/dlist.c:1789:45: warning: unused parameter ‘baseinstance’ [-Wunused-parameter] GLuint baseinstance) ^~~~~~~~~~~~ main/dlist.c: In function ‘save_DrawElementsInstancedBaseInstance’: main/dlist.c:1797:47: warning: unused parameter ‘mode’ [-Wunused-parameter] save_DrawElementsInstancedBaseInstance(GLenum mode, ^~~~ main/dlist.c:1798:48: warning: unused parameter ‘count’ [-Wunused-parameter] GLsizei count, ^~~~~ main/dlist.c:1799:47: warning: unused parameter ‘type’ [-Wunused-parameter] GLenum type, ^~~~ main/dlist.c:1800:52: warning: unused parameter ‘indices’ [-Wunused-parameter] const void *indices, ^~~~~~~ main/dlist.c:1801:48: warning: unused parameter ‘primcount’ [-Wunused-parameter] GLsizei primcount, ^~~~~~~~~ main/dlist.c:1802:47: warning: unused parameter ‘baseinstance’ [-Wunused-parameter] GLuint baseinstance) ^~~~~~~~~~~~ main/dlist.c: In function ‘save_DrawElementsInstancedBaseVertexBaseInstance’: main/dlist.c:1810:57: warning: unused parameter ‘mode’ [-Wunused-parameter] save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode, ^~~~ main/dlist.c:1811:58: warning: unused parameter ‘count’ [-Wunused-parameter] GLsizei count, ^~~~~ main/dlist.c:1812:57: warning: unused parameter ‘type’ [-Wunused-parameter] GLenum type, ^~~~ main/dlist.c:1813:62: warning: unused parameter ‘indices’ [-Wunused-parameter] const void *indices, ^~~~~~~ main/dlist.c:1814:58: warning: unused parameter ‘primcount’ [-Wunused-parameter] GLsizei primcount, ^~~~~~~~~ main/dlist.c:1815:56: warning: unused parameter ‘basevertex’ [-Wunused-parameter] GLint basevertex, ^~~~~~~~~~ main/dlist.c:1816:57: warning: unused parameter ‘baseinstance’ [-Wunused-parameter] GLuint baseinstance) ^~~~~~~~~~~~ Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Fix all the whitespace errors in dlist.cIan Romanick2016-12-191-187/+186
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Track the linearized array index for each UBO instance array elementIan Romanick2016-12-191-0/+15
| | | | | | | | | | v2: Set linearizer_array_index in process_block_array_leaf. Suggested by Timothy. Signed-off-by: Ian Romanick <[email protected]> Cc: [email protected] Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Fix program interface queries relating to interface blocks.Kenneth Graunke2016-12-191-73/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes 555 dEQP tests (using the nougat-cts-dev branch), Piglit's arb_program_interface_query/arb_program_interface_query-resource-query, and GL45-CTS.program_interface_query.separate-programs-{tess-control, tess-eval,geometry}. Only one dEQP program interface failure remains. I would have liked to split this up into several distinct changes, but I wasn't sure how to do that given thet tangled nature of these issues. So, the issues: * We need to treat interface blocks declared as an array of instances as a single block - removing the outer array. The resource list entry's name should not include the array length. Properties such as GL_ARRAY_SIZE should refer to the variable inside the block, not the interface block's array properties. * We need to do this prefixing even for structure variables. * We need to do this for built-ins (such as gl_PerVertex.gl_Position). * After interface array unwrapping, any variable which is an array should have [0] appended. It doesn't matter if it's a TCS/TES/GS input or TCS output - that looked like an attempt to unwrap for per-vertex variables, but that didn't consider per-patch variables, and as far as I can tell there's nothing to justify this. Several Mesa developers have suggested that Issue 16 contradicts the main specification, but I believe that it doesn't - the main spec just isn't terribly clear. The main ARB_program_interface query spec says: "* For an active interface block not declared as an array of block instances, a single entry will be generated, using the block name from the shader source. * For an active interface block declared as an array of instances, separate entries will be generated for each active instance. The name of the instance is formed by concatenating the block name, the "[" character, an integer identifying the instance number, and the "]" character." Issue 16 says that built-ins should be named "gl_PerVertex.gl_Position", but several people suggested the second bullet above means that it should be named "gl_PerVertex[array length].gl_Position". There are two important things to note. Those bullet points say "an active interface block", while the others say "variable" or "active shader storage block member". They also don't mention applying the rules recursively (unlike the other bullets). Both suggest that these rules apply to blocks themselves, not members of blocks. In fact, for GL_UNIFORM_BLOCK queries, we do have "block[0]", "block[1]", ... resource list entries - so those rules are real, and actually used. So if they don't apply to block members, then how should members be named? Unfortunately, I don't see any rules outside of issue 16 - where the rationale is very unclear. I hope to clarify the spec in the future. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa/get: Convert stencil values to TYPE_UINT.Kenneth Graunke2016-12-191-6/+6
| | | | | | | | | | | | | | | These are listed as Z+ in the GL spec, and often have values of 0xFFFFFFFF. For glGetFloat, we should return 4294967295.0 rather than -1.0. Similarly, for glGetInteger64v, we should return 0xFFFFFFFF, not the sign extended 0xFFFFFFFFFFFFFFFF. Fixes 6 dEQP tests matching the pattern dEQP-GLES3.functional.state_query.integers.stencil*value*mask*getfloat when run in a single process (with state reset code happening between tests, which makes dEQP set the stencil value mask to 0xFFFFFFFF). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* mesa/get: Add TYPE_UINT for casting through a GLuint.Kenneth Graunke2016-12-191-0/+80
| | | | | | | | | | | | | | | | | The "State Tables" section of the OpenGL specification lists many values as belonging to Z+ (non-negative integers), not Z (all integers). For ordinary glGetInteger queries, this doesn't matter. However, when accessing Z+ values via glGetFloat or glGetInteger64, we need to treat the source value as an unsigned value. Otherwise, we'll produce a negative number when bit 31 is set. This commit merely adds the plumbing. It doesn't convert any values. v2: Gotta catch 'em all (add missing cases caught by Ilia) Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* mesa/get: Make GetFloat/GetDouble of TYPE_INT_N not normalize things.Kenneth Graunke2016-12-191-3/+3
| | | | | | | | | | | | | | | | | GetFloat of integer valued things is supposed to perform a simple int -> float conversion. INT_TO_FLOAT is not that. Instead, it converts [-2147483648, 2147483647] to a normalized [-1.0, 1.0] float. This is only used for COMPRESSED_TEXTURE_FORMATS, which nobody in their right mind would try and access via glGetFloat(), but we may as well fix it. Found by inspection. v2: Gotta catch 'em all (fix another case of this caught by Ilia) Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* main: add INTEL_conservative_rasterization enum query supportLionel Landwerlin2016-12-132-0/+8
| | | | | | | v2: add extra parameter (Ilia) Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* extensions: update INTEL_conservative_rasterization dependenciesLionel Landwerlin2016-12-131-1/+1
| | | | | | | Suggested by Ilia. Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* main: don't error when enabling conservative rasterization on glesLionel Landwerlin2016-12-131-1/+1
| | | | | Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* main: use new driver flag for conservative rasterization stateLionel Landwerlin2016-12-132-1/+8
| | | | | | | | | | | Suggested by Marek. v2: Use new driver flag (Marek) v3: Fix i965 comments (Lionel) Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* treewide: s/comparitor/comparator/Ilia Mirkin2016-12-121-1/+1
| | | | | | | | | | git grep -l comparitor | xargs sed -i 's/comparitor/comparator/g' Just happened to notice this in a patch that was sent and included one of the tokens in question. Signed-off-by: Ilia Mirkin <[email protected]> Acked-by: Nicolai Hähnle <[email protected]>
* mesa: Return LINEAR encoding for winsys FBO depth/stencil.Kenneth Graunke2016-12-111-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | GetFramebufferAttachmentParameteriv should return GL_LINEAR for the window system default framebuffer's GL_DEPTH or GL_STENCIL attachments when there are zero depth or stencil bits. The GL 4.5 spec's GetFramebufferAttachmentParameteriv section says: "If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is not NONE, these queries apply to all other framebuffer types: [...] If attachment is not a color attachment, or no data storage or texture image has been specified for the attachment, then params will contain the value LINEAR." Note that we already return LINEAR for the case where there is an actual depth or stencil renderbuffer attached. In the case modified by this patch, FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE returns FRAMEBUFFER_DEFAULT rather than NONE. Fixes a CTS test when run in a visual without depth / stencil buffers: GL45-CTS.gtf30.GL3Tests.framebuffer_srgb.framebuffer_srgb_default_encoding Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* mesa: add support for GL_INTEL_conservative_rasterizationLionel Landwerlin2016-12-075-0/+59
| | | | | Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
* mesa: Add GL and GLSL plumbing for ARB_post_depth_coverage for i965 (gen9+).Plamena Manolova2016-12-073-0/+4
| | | | | | | | | This extension allows the fragment shader to control whether values in gl_SampleMaskIn[] reflect the coverage after application of the early depth and stencil tests. Signed-off-by: Plamena Manolova <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
* main: allow NEAREST_MIPMAP_NEAREST for stencil texturingRoland Scheidegger2016-12-061-15/+8
| | | | | | | | | | | | As per GL 4.5 rules, which fixed a spec mistake in GL_ARB_stencil_texturing. The extension spec wasn't updated, but just allow it with older GL versions as well, hoping there aren't any crazy tests which want to see an error there... (Compile tested only.) Reported by Józef Kucia <[email protected]> Acked-by: Józef Kucia <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* st/mesa/glsl: move Version to gl_shader_program_dataTimothy Arceri2016-12-022-2/+3
| | | | | | | | | | | This is mostly just used during linking however the st uses it when updating textures. In order to store gl_program in the CurrentProgram array rather than gl_shader_program we need to move this field to the shared gl_shader_program_data struct. Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: only verify that enabled arrays have backing buffersIlia Mirkin2016-12-011-1/+1
| | | | | | | | | | | | We were previously also verifying that no backing buffers were available when an array wasn't enabled. This is has no basis in the spec, and it causes GLupeN64 to fail as a result. Fixes: c2e146f487 ("mesa: error out in indirect draw when vertex bindings mismatch") Cc: [email protected] Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* mesa: reset linked_stages bitmask when re-linkingTimothy Arceri2016-12-011-0/+2
| | | | | | | | | | | | | | | 34953f8907fdd added this bitmask but it wasn't being reset when a program was relinked. If a stage was removed from the new program then it could case a crash as we expect the linked shader for that stage to not be null. Fixes crashes in: ESEXT-CTS.tessellation_shader.single.xfb_captures_data_from_correct_stage ES31-CTS.core.tessellation_shader.single.xfb_captures_data_from_correct_stage Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98917
* mesa: optimise interleaved sso validationTimothy Arceri2016-11-301-11/+14
| | | | | | | | | | Now that we have a linked_stages bitfield we can use this to check if the program is used at a later stage. This change is also required to be able to use gl_program rather than gl_shader_program in the CurrentProgram array. Reviewed-by: Ian Romanick <[email protected]>
* mesa/glsl: add bitmask to track stages a program was linked againstTimothy Arceri2016-11-301-0/+3
| | | | | | | | | | | | | | | | This will be used to enable us to store the current gl_program rather than gl_shader_program in the gl_pipline_object allowing us to simplify handing of validation. Also we should not be depending on _LinkedShader for this information as it may contain shaders from a failed linking attempt rather than the current program still in use. We could also use this mask to iterate over the stages during linking with _mesa_bit_scan() rather then the current method of NULL checking each stage. Reviewed-by: Ian Romanick <[email protected]>
* mesa: fix active subroutine uniforms properlyTimothy Arceri2016-11-291-103/+8
| | | | | | | | | | | | | | | | | | | | | | | | 07fe2d565b introduced a big hack in order to return NumSubroutineUniforms when querying ACTIVE_RESOURCES for <shader>_SUBROUTINE_UNIFORM interfaces. However this is the wrong fix we are meant to be returning the number of active resources i.e. the count of subroutine uniforms in the resource list which is what the code was previously doing, anything else will cause trouble when trying to retrieve the resource properties based on the ACTIVE_RESOURCES count. The real problem is that NumSubroutineUniforms was counting array elements as separate uniforms but the innermost array is always considered a single uniform so we fix that count instead which was counted incorrectly in 7fa0250f9. Idealy we could probably completely remove NumSubroutineUniforms and just compute its value when needed from the resource list but this works for now. Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Cc: 13.0 <[email protected]>
* mesa/getteximage: Add validation of target to glGetTextureImageEduardo Lima Mitev2016-11-241-0/+5
| | | | | | | | | | | | | | | | | | | | There is an specific list of texture targets that can be used with glGetTextureImage. From OpenGL 4.5 spec, section '8.11 Texture Queries', page 234 of the PDF: "An INVALID_ENUM error is generated if the effective target is not one of TEXTURE_1D , TEXTURE_2D , TEXTURE_3D , TEXTURE_1D_- ARRAY , TEXTURE_2D_ARRAY , TEXTURE_CUBE_MAP_ARRAY , TEXTURE_- RECTANGLE , one of the targets from table 8.19 (for GetTexImage and GetnTexImage only), or TEXTURE_CUBE_MAP (for GetTextureImage only)." We are currently not validating the target for glGetTextureImage. As an example, calling this function on a texture with target GL_TEXTURE_2D_MULTISAMPLE should return INVALID_ENUM, but instead it hits an assertion down the road in the i965 driver. Reviewed-by: Nicolai Hähnle <[email protected]>
* main/texobj: Check that texture id > 0 before looking it up in hash-tableEduardo Lima Mitev2016-11-241-2/+3
| | | | | | | | | | | | | _mesa_lookup_texture_err() is not currently checking that the texture-id can be zero, but _mesa_HashLookup() doesn't expect the key to be zero, and will fail an assertion. Considering that _mesa_lookup_texture_err() is called from _mesa_GetTextureImage and _mesa_GetTextureSubImage with user provided arguments, we must validate the texture-id before looking it up in the hash-table. Reviewed-by: Nicolai Hähnle <[email protected]>
* main/getteximage: Use the height argument to calculate memcpy copy sizeEduardo Lima Mitev2016-11-231-1/+1
| | | | | | | | | | | | | | | | | | In get_tex_memcpy, when copying texture data directly from source to destination (when row strides match for both src and dst), the copy size is currently calculated using the full texture height instead of the sub-region height parameter that was passed. This can cause a read past the end of the mapped buffer when y-offset is greater than zero, leading to a segfault. Fixes CTS test (from crash to pass): * GL45-CTS/get_texture_sub_image/functional_test v2: (Jason) Use the passed 'height' instead of copying til the end of the buffer (tex-height - yoffset). Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: use special checksums for unset checksums and fixed-func shadersMarek Olšák2016-11-222-0/+6
| | | | | | for debugging Reviewed-by: Timothy Arceri <[email protected]>
* glsl: add gl_linked_shader::SourceChecksumMarek Olšák2016-11-222-1/+13
| | | | | | | | for debugging v2: wrap all checksums in #ifdef DEBUG Reviewed-by: Timothy Arceri <[email protected]>
* mesa: use util_hash_crc32 instead of _mesa_str_checksumMarek Olšák2016-11-223-26/+2
| | | | Reviewed-by: Timothy Arceri <[email protected]>