summaryrefslogtreecommitdiffstats
path: root/src/mesa
Commit message (Collapse)AuthorAgeFilesLines
* mesa/st: rewrite src var when lowering tex_src_planePierre-Eric Pelloux-Prayer2019-07-231-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | The assign_extra_samplers() adds the needed extra samplers but they need to be used in the nir_tex_instr. Otherwise the plane information is simply lost and all nir_tex_instr use the same sampler. Here's an example of the bug: NIR before st_nir_lower_tex_src_plane: vec1 32 ssa_8 = load_const (0x00000000 /* 0.000000 */) vec4 32 ssa_9 = tex ssa_0 (texture_deref), ssa_0 (sampler_deref), ssa_5 (coord), ssa_8 (plane) vec1 32 ssa_10 = load_const (0x00000001 /* 0.000000 */) vec4 32 ssa_11 = tex ssa_0 (texture_deref), ssa_0 (sampler_deref), ssa_5 (coord), ssa_10 (plane) After: vec4 32 ssa_9 = tex ssa_0 (texture_deref), ssa_0 (sampler_deref), ssa_5 (coord) vec4 32 ssa_11 = tex ssa_0 (texture_deref), ssa_0 (sampler_deref), ssa_5 (coord) This fixes the following piglit test for radeonsi + NIR: - ext_image_dma_buf_import-sample_nv12 - ext_image_dma_buf_import-sample_yuv420 - ext_image_dma_buf_import-sample_yvu420 Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
* st/mesa: Try re-importing resource if necessary in st_vdpau_map_surfaceMichel Dänzer2019-07-231-6/+18
| | | | | | | | | | | | | | This can be the case if the resource was obtained from st_vdpau_output/video_surface_gallium. st_vdpau_output/video_surface_dma_buf do a similar dance internally. v2: * Pass PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE instead of 0 for usage. Bugzilla: https://bugs.freedesktop.org/111099 Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> # v1 Reviewed-by: Marek Olšák <[email protected]>
* st/nir: use asprintf() wrapper to fix MSVC issuesEric Engestrom2019-07-231-0/+1
| | | | | | Fixes: 856e84083eee9b22408a ("mesa/st: add sampler uniforms") Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* gallium: remove boolean from state tracker APIsIlia Mirkin2019-07-222-26/+26
| | | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* gallium: switch boolean -> bool at the interface definitionsIlia Mirkin2019-07-221-1/+1
| | | | | | | | | | | | | | | | | | This is a relatively minimal change to adjust all the gallium interfaces to use bool instead of boolean. I tried to avoid making unrelated changes inside of drivers to flip boolean -> bool to reduce the risk of regressions (the compiler will much more easily allow "dirty" values inside a char-based boolean than a C99 _Bool). This has been build-tested on amd64 with: Gallium drivers: nouveau r300 r600 radeonsi freedreno swrast etnaviv v3d vc4 i915 svga virgl swr panfrost iris lima kmsro Gallium st: mesa xa xvmc xvmc vdpau va Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Acked-by: Alyssa Rosenzweig <[email protected]>
* st/nir: fix arb fragment stage conversionDave Airlie2019-07-231-1/+1
| | | | | | | | | | | The comment even justifies the wrongness wrongly. We should be translating to pipe values properly here or else fragment maps to tess ctrl. Fixes: 3d7611e9a6c ("st/nir: use NIR for asm programs") Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa: Fix ReadBuffers with pbuffersKenneth Graunke2019-07-221-18/+17
| | | | | | | | | | | | pbuffers are internally single-buffered. Marek fixed DrawBuffers to handle this case, but we need to fix ReadBuffers too. Otherwise, pretty much every conformance test fails because glReadPixels breaks. v2: Refactor the switch into a helper (suggested by Eric Anholt) Fixes: 35294f2eca8 ("mesa: fix pbuffers because internally they are front buffers") Acked-by: Eric Engestrom <[email protected]> (v1) Reviewed-by: Eric Anholt <[email protected]>
* mesa: fix assertion failure in TexImageMarek Olšák2019-07-221-8/+6
| | | | | | | | | | Check the assertion after error checking. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111194 Fixes: 9dd1f7cec01 ("mesa: pass gl_texture_object as arg to not depend on state") Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* 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]>