summaryrefslogtreecommitdiffstats
path: root/src/mesa
Commit message (Collapse)AuthorAgeFilesLines
* i965: free object labels when deletingSergii Romantsov2019-07-223-0/+3
| | | | | | | | Some leaks detected with GL_KHR_debug on i965. CC: Timothy Arceri <[email protected]> Signed-off-by: Sergii Romantsov <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* mesa: add EXT_dsa glEnabledIndexedEXTPierre-Eric Pelloux-Prayer2019-07-192-0/+74
| | | | | | | | | | | | The implementation uses _mesa_ActiveTexture to change the active texture unit and then reset it. It causes an unnecessary _NEW_TEXTURE_STATE but: - adding an index argument to _mesa_set_enable causes a lot of changes (~140 callers) - enable_texture (called by _mesa_set_enable) might cause a _NEW_TEXTURE_STATE anyway. Reviewed-by: Marek Olšák <[email protected]>
* mesa: add EXT_dsa glGetTextureLevelParameter*vEXT functionsPierre-Eric Pelloux-Prayer2019-07-193-2/+53
| | | | Reviewed-by: Marek Olšák <[email protected]>
* mesa: add EXT_dsa gl(Copy)Texture(Sub)Image1D/2D/3DEXT functionsPierre-Eric Pelloux-Prayer2019-07-196-11/+726
| | | | | | | | | | | | | | | | | | | Added functions: - glTextureImage1DEXT - glTextureImage2DEXT - glTextureImage3DEXT - glTextureSubImage1DEXT - glTextureSubImage3DEXT - glCopyTextureImage1DEXT - glCopyTextureImage2DEXT - glCopyTextureSubImage1DEXT - glCopyTextureSubImage2DEXT - glCopyTextureSubImage3DEXT - glGetTextureImageEXT All but the last one can be compiled in a display list. Reviewed-by: Marek Olšák <[email protected]>
* mesa: move lookup_texture_ext_dsa up in teximage.cPierre-Eric Pelloux-Prayer2019-07-191-63/+60
| | | | Reviewed-by: Marek Olšák <[email protected]>
* mesa: pass gl_texture_object as arg to not depend on statePierre-Eric Pelloux-Prayer2019-07-191-28/+32
| | | | | | This will allow to use the same functions for EXT_dsa implementation. Reviewed-by: Marek Olšák <[email protected]>
* mesa: refactor get_texture_image to remove duplicate codePierre-Eric Pelloux-Prayer2019-07-191-50/+32
| | | | | | | | Move shared code in a new function (_get_texture_image) and use it instead of duplicating the same lines. Will be also used by the EXT_dsa functions (GetTextureImageEXT and GetMultiTexImageEXT). Reviewed-by: Marek Olšák <[email protected]>
* mesa/tests: add missing dep_threadEric Engestrom2019-07-191-0/+1
| | | | | | | Fixes: f8c27c277585141f2d27 ("state_tracker: Move the format test out to be an actual unit test.") Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Tested-by: Vinson Lee <[email protected]>
* util: use standard name for strdup()Eric Engestrom2019-07-191-2/+2
| | | | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* main: Destroy static hash tableYevhenii Kolesnikov2019-07-191-0/+8
| | | | | | | | | format_array_format_table has a static lifetime - it will be destroyed by an atexit handler. Signed-off-by: Yevhenii Kolesnikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* gallium: Add PIPE_CAP_TGSI_FS_POINT_IS_SYSVALAndreas Baierl2019-07-181-0/+2
| | | | | | | | This adds an option to treat gl_PointCoord as a system value. Signed-off-by: Andreas Baierl <[email protected]> Reviewed-by: Qiang Yu <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: Optionally declare gl_PointCoord as a system valueAndreas Baierl2019-07-182-1/+7
| | | | | | Signed-off-by: Andreas Baierl <[email protected]> Reviewed-by: Qiang Yu <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* spirv_extensions: i965: initialize SPIR-V extensionsAlejandro Piñeiro2019-07-172-1/+12
| | | | | | v2: Rebase update after changes on previous patches. Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* spirv_extensions: add spirv_supported_extensions on gl_constantsAlejandro Piñeiro2019-07-172-1/+21
| | | | | | | | | We can use it to get real values for ARB_spirv_extensions methods. Signed-off-by: Alejandro Piñeiro <[email protected]> Signed-off-by: Arcady Goldmints-Orlov <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* spirv_extensions: define spirv_extensions_supportedAlejandro Piñeiro2019-07-172-0/+43
| | | | | | | | | | | | | | | | | | | | | | Add a struct to maintain which SPIR-V extensions are supported, and an utility method to initialize it based on nir_spirv_supported_capabilities. v2: * Fixing code style (Ian Romanick) * Adding a prefix (spirv) to fill_supported_spirv_extensions (Ian Romanick) v3: rebase update (nir_spirv_supported_extensions renamed) v4: include AMD_gcn_shader support v5: move spirv_fill_supported_spirv_extensions to src/mesa/main/spirv_extensions.c Signed-off-by: Alejandro Piñeiro <[email protected]> Signed-off-by: Arcady Goldmints-Orlov <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* spirv_extensions: add list of extensions and to_string methodAlejandro Piñeiro2019-07-172-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ideally this should be generated somehow. One option would be gather all the extension dependencies listed on the core grammar, but there would be the possibility of not including some of the extensions. Note that spirv-tools is doing it just slightly better, as it has a hardcoded list of extensions manually took from the registry, that they parse to get the enum and the to_string method (see generate_grammar_tables.py). v2: * Use a macro to improve readability. (Tapani Pälli) * Add unreachable on the switch, no default (Eric Engestrom) * No typedef enum (Ian Romanick) * Sort extensions names (Ian Romanick) * Don't add extensions unlikely to be supported by Mesa at any point (Ian Romanick) v3: rebase update v4: Include AMD_gcn_shader v5: move spirv_extensions_to_string to src/mesa/main/spirv_extensions.c Signed-off-by: Alejandro Piñeiro <[email protected]> Signed-off-by: Arcady Goldmints-Orlov <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* spirv_extensions: add GL_ARB_spirv_extensions boilerplateAlejandro Piñeiro2019-07-179-0/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | v2: * Mention extension gap at gl_API.xml (Emil Velikov) * Bail with INVALID_ENUM if extension not available on getStringi (Emil Velikov) * Use EXTRA_EXT macro when defining the extension at get.c/get_hash_params.py (Emil Velikov) * Rename source files (spirvextensions.[ch] -> spirv_extensions.[ch]) (Ian) v3: * Fix GL_PROGRAM_BINARY_FORMATS glGet query, broken by error on a previous rebase v4: * Fix rebase conflicts on getstring.c after GL_SHADING_LANGUAGE_VERSION query was added v5: * Remove src/mapi/glapi/gen/Makefile.am as it no longer exists in master Signed-off-by: Alejandro Piñeiro <[email protected]> Signed-off-by: Arcady Goldmints-Orlov <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* meta: leaking of BO with DrawPixelsYevhenii Kolesnikov2019-07-161-0/+2
| | | | | | | | | | ctx->Unpack.BufferObj wasn't unreferenced. Fixes: d492e7b0171 (meta: Fix invalid PBO access from DrawPixels when trying to just alloc.) CC: Eric Anholt <[email protected]> Signed-off-by: Yevhenii Kolesnikov <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* swrast: Move _mesa_format_pack_colormask() to the only caller.Eric Anholt2019-07-163-78/+72
| | | | | | | | | This avoids needing format_pack to have access to the GLenum return functions for mesa_format. It seems like an odd function and unlikely to be reused. Reviewed-by: Thomas Helland <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
* mesa: Give _mesa_format_get_color_encoding a clearer name.Eric Anholt2019-07-1614-35/+22
| | | | | | | It only returned one of two values. Reviewed-by: Thomas Helland <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
* mesa: Drop redundant checks for sRGB before sRGB to linear conversion.Eric Anholt2019-07-162-6/+4
| | | | | | | | _mesa_get_srgb_format_linear() just returns the original format if it wasn't sRGB. Reviewed-by: Thomas Helland <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
* mesa: Fold _mesa_unpack_depth_stencil_row() into its only caller.Eric Anholt2019-07-163-34/+14
| | | | | | | This was the last bit of gl.h usage in format packing. Reviewed-by: Thomas Helland <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
* mesa: Convert format_pack/unpack off of GL types.Eric Anholt2019-07-164-353/+352
| | | | | Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
* mesa: Port format_pack/unpack off of _mesa_problem().Eric Anholt2019-07-162-47/+17
| | | | | | | unreachable() should be plenty of debug for these. Reviewed-by: Thomas Helland <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
* mesa: Mostly switch Mesa format info off of GL types other than GLenum.Eric Anholt2019-07-162-142/+144
| | | | | | | | I'm considering moving most of this code to src/util/, and I want that code to not expose GL types in its interfaces. Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
* mesa: Rename gl_pack typedefs to mesa_pack.Eric Anholt2019-07-165-20/+20
| | | | | | | These are packing mesa formats, not a GL format/type. Reviewed-by: Thomas Helland <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
* mesa: Rename gl_format_info to mesa_format_info.Eric Anholt2019-07-162-29/+29
| | | | | | | It's about MESA_FORMATs, after all. Reviewed-by: Thomas Helland <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
* state_tracker: Move the format test out to be an actual unit test.Eric Anholt2019-07-163-51/+117
| | | | | | | | We want errors in the table to show up as unit test failures in MRs. Also keeps unit test code out of the built drivers. Reviewed-by: Thomas Helland <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
* mesa/st: add sampler uniformsRob Clark2019-07-161-6/+45
| | | | | | | | | | | Add sampler uniforms for the UV plane(s), so driver can count the uniforms and get the correct sampler count. Fixes lowered YUV on a6xx which actually wants to know # of samplers. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* st,i965: Stop looping on 64-bit loweringJason Ekstrand2019-07-161-17/+8
| | | | | | | | | Now that the 64-bit lowering passes do a complete lowering in one go, we don't need to loop anymore. We do, however, have to ensure that int64 lowering happens after double lowering because double lowering can produce int64 ops. Reviewed-by: Eric Anholt <[email protected]>
* meta: memory leak of CopyPixels usageSergii Romantsov2019-07-161-0/+14
| | | | | | | | | Meta of CopyPixel generates a buffer object but does not free it on cleanup. Fixes: 37d11b13ce1d (meta: Don't pollute the buffer object namespace in _mesa_meta_setup_vertex_objects) Signed-off-by: Sergii Romantsov <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* st/mesa: verify that vertex buffer offset isn't negativePierre-Eric Pelloux-Prayer2019-07-153-0/+15
| | | | | | | | | | | | | | | | | | | | | | For drivers supporting PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET the buffer_offset value will be interpreted as an signed int. An example of application code causing a negative offset: float b[] = { ... }; // 3 float for pos, 3 for color glBufferData(GL_ARRAY_BUFFER, ..., b, ...); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), 0); glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), &b[3]); ^ should be 3 * sizeof(float) The offset is a ptr so when interpreted as a signed int it can be negative. This commit adds a verification that (int) buffer_offset is not negative - this would indicate an application bug. Since it's too late to emit a GL_INVALID_VALUE error, we replace the negative offset by 0 and emit a debug message. Signed-off-by: Marek Olšák <[email protected]>
* st/mesa: don't invalidate a buffer range that is mappedMarek Olšák2019-07-151-6/+21
| | | | | This is needed to fix an issue with OpenGL when a buffer is mapped and BufferSubData is called. In this case, we can't invalidate the buffer range.
* mesa: Port errors.c to util/list.h instead of simple_list.Kenneth Graunke2019-07-121-31/+18
| | | | | | | There is widespread consensus that simple_list should go away. This patch converts one more use to the modern kernel-style list. Reviewed-by: Kristian H. Kristensen <[email protected]>
* mesa/glspirv: Validate that compute shaders are not linked with other stagesNeil Roberts2019-07-121-0/+10
| | | | | | | | | | The test is based on link_shaders(). For example, it allows the following test (when run on SPIR-V mode) to pass: spec/arb_compute_shader/linker/mix_compute_and_non_compute.shader_test Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* mesa/glspirv: Validate that there is a VS when there is a TCS, TES or GSNeil Roberts2019-07-121-0/+25
| | | | | | | | | | | | | The shader combination tests are copied from link_shaders(). For example, it allows the following tests (when run on SPIR-V mode) to pass: spec/arb_tessellation_shader/linker/no-vs spec/arb_tessellation_shader/linker/tcs-no-vs spec/arb_tessellation_shader/linker/tes-no-vs spec/glsl-1.50/linker/gs-without-vs Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* i965: don't use disk cache with SPIR-V shadersAlejandro Piñeiro2019-07-121-2/+16
| | | | | | | | Right now we don't support disk cache for SPIR-V shaders (from ARB_gl_spirv), so let's avoid writing the program data to or reading it from the disk if any in-use shaders use SPIR-V. Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* mesa/main: Fix UBO/SSBO ACTIVE_VARIABLES query (ARB_gl_spirv)Antia Puentes2019-07-123-15/+149
| | | | | | | | | | | | | | | | | | | | | | | | | When querying MAX_NUM_ACTIVE_VARIABLES, NUM_ACTIVE_VARIABLES and ACTIVE_VARIABLES over SSBO and UBO interfaces, we filter the variables which are active using the variable's name and looking for it in the program resource list. If it is in the program resource list, the variable will be considered active. However due to ARB_gl_spirv where name reflection information is not mandatory, we can use the UBO/SSBO binding and variable offset to filter which variables which are active. v2: use RESOURCE_UBO/UNI macros instead of direct castings, update comment (Alejandro) v3: Change signature of _mesa_program_resource_find_active_variable to simplify calling it. Also, squash the fix for find_binding_offset for arrays of blocks (Arcady) Signed-off-by: Antia Puentes <[email protected]> Signed-off-by: Alejandro Piñeiro <[email protected]> Signed-off-by: Arcady Goldmints-Orlov <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* mesa/shader_query: Fix LOCATION_INDEX query (ARB_gl_spirv)Antia Puentes2019-07-121-12/+17
| | | | | | | | | When querying GL_LOCATION_INDEX using glGetProgramResourceiv we already know the index of the resource, we do not need to find it using the name, which is convenient for shaders coming from SPIR-V binaries where names are optional. Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* mesa/shaderapi: Fix TRANSFORM_FEEDBACK_VARYING program queryAntia Puentes2019-07-121-5/+34
| | | | | | | | | | | | | | | | | | | Fixes the program queries API (glGetProgramiv): TRANSFORM_FEEDBACK_VARYINGS and TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH in two cases: 1. ARB_enhaced_layouts: The queries were not working for GLSL shaders which specify the varyings using enhanced layouts. We were returning the info as if the varyings could only be specified using the API. 2. ARB_gl_spirv: TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH should return 1 if there is no name reflection information available. Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* mesa/uniforms: Fix GetUniformLocation (ARB_gl_spirv)Antia Puentes2019-07-121-1/+1
| | | | | | | From the ARB_gl_spirv specification, glGetUniformLocation should return -1 when no name reflection is available. Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* mesa/shader_query: Fix NAME_LENGTH queries (ARB_gl_spirv)Antia Puentes2019-07-121-2/+14
| | | | | | | | | | | | | | | For shaders constructed from SPIR-V binaries, it is possible that no name reflection information is available. In that case, - glGetProgramInterfaceiv(.., pname=MAX_NAME_LENGTH, ..) - gletProgramResourceiv(.., props=NAME_LENGTH, ..) should return 1. Signed-off-by: Antia Puentes <[email protected]> Signed-off-by: Andres Gomez <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* mesa: Fix ACTIVE_*_MAX_LENGTH program queries (ARB_gl_spirv)Alejandro Piñeiro2019-07-122-7/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Since ARB_gl_spirv it is possible to miss a lot of name reflection information, so it is needed to add NULL name checks for several queries, and return a specific value on those cases. This commit add them for ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, ACTIVE_ATTRIBUTE_MAX_LENGTH and ACTIVE_UNIFORM_MAX_LENGTH. From ARB_gl_spirv spec: "If pname is ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, the length of the longest active uniform block name, including the null terminator, is returned. If no active uniform blocks exist, zero is returned. If no name reflection information is available, one is returned. If pname is ACTIVE_ATTRIBUTE_MAX_LENGTH, the length of the longest active attribute name, including a null terminator, is returned. If no active attributes exist, zero is returned. If no name reflection information is available, one is returned. If pname is ACTIVE_UNIFORM_MAX_LENGTH, the length of the longest active uniform name, including a null terminator, is returned. If no active uniforms exist, zero is returned. If no name reflection information is available, one is returned." Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* mesa: save/restore SSO flag when using ARB_get_program_binaryTimothy Arceri2019-07-121-0/+4
| | | | | | | | | | Without this the restored program will fail the pipeline validation checks when we attempt to use an SSO program. Fixes: c20fd744fef1 ("mesa: Add Mesa ARB_get_program_binary helper functions") Reviewed-by: Jordan Justen <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111010
* compiler: Save a single copy of the softfp64 shader in the context.Kenneth Graunke2019-07-104-11/+14
| | | | | | | | | | | | | | | | | | We were recompiling the softfp64 library of functions from GLSL to NIR every time we compiled a shader that used fp64. Worse, we were ralloc stealing it to the GL context. This meant that we'd accumulate lots of copies for the lifetime of the context, which was a big space leak. Instead, we can simply stash a single copy in the GL context, and use it for subsequent compiles. Having a single copy should be fine from a memory context point of view: nir_inline_function_impl already clones the necessary nir_function_impl's as it inlines. KHR-GL45.enhanced_layouts.ssb_member_align_non_power_of_2 was previously OOM'ing a system with 16GB of RAM when using softfp64. Now it finishes much more quickly and uses only ~200MB of RAM. Reviewed-by: Jordan Justen <[email protected]>
* intel/compiler: Add a "base class" for program keysJason Ekstrand2019-07-1011-95/+75
| | | | | | | | | Right now, all keys have two things in common: a program string ID and a sampler_prog_key_data. I'd like to add another thing or two and need a place to put it. This commit adds a new brw_base_prog_key struct which contains those two common bits. Reviewed-by: Kenneth Graunke <[email protected]>
* i965/program_cache: Cast the key to char * before adding key_sizeJason Ekstrand2019-07-101-1/+1
| | | | | | | | We're about to change the type of key to be brw_base_prog_key and that will mean blindly adding the key size without a cast will lead to the wrong calculation. It's safer to cast to char * first anyway. Reviewed-by: Kenneth Graunke <[email protected]>
* gallium: give vertex-shader saturate its own capErik Faye-Lund2019-07-101-1/+1
| | | | | | | | | | Shader Model 3.0 is a big promise to make to the state-tracker, and for instance mobile hardware might support vertex-shader saturate but not some of the other features of SM3. So let's give this its own cap for simplicity. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* gallium: give fragment-shader derivatives its own capErik Faye-Lund2019-07-101-1/+1
| | | | | | | | | | Shader Model 3.0 is a big promise to make to the state-tracker, and for instance mobile hardware might support fragment-shader derivatives but not some of the other features of SM3. So let's give this its own cap for simplicity. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* gallium: give fragment-shader texture-lod its own capErik Faye-Lund2019-07-101-1/+1
| | | | | | | | | | Shader Model 3.0 is a big promise to make to the state-tracker, and for instance mobile hardware might support texture lod but not some of the other features of SM3. So let's give this its own cap for simplicity. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-by: Marek Olšák <[email protected]>