aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
Commit message (Collapse)AuthorAgeFilesLines
* gallium: Add the ASTC 3D formats.Eric Anholt2019-08-261-0/+82
| | | | | | | No driver implements them yet, but this is a long way toward gallium having matching format enums for Mesa formats. Reviewed-by: Marek Olšák <[email protected]>
* st/nir: Fix num_inputs for VS inputsConnor Abbott2019-08-231-3/+2
| | | | Reviewed-by: Marek Olšák <[email protected]>
* mesa/compiler: rework tear down of builtin/typesLionel Landwerlin2019-08-211-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The issue we're running into when running CTS is that glsl types are deleted while builtins depending on them are not. This happens because on one hand we have glsl types ref counted, but builtins are not. Instead builtins are destroyed when unloading libGL or explicitly calling glReleaseShaderCompiler(). This change removes almost entirely any dealing with glsl types ref/unref by letting the builtins deal with it instead. In turn we introduce a builtin ref count mechanism. Each GL context takes a reference on the builtins when compiling a shader for the first time. It releases the reference when the context is destroyed. It can also explicitly release those when glReleaseShaderCompiler() is called. Finally we also take a reference on the glsl types when loading libGL to avoid recreating glsl types too often. v2: Ensure we take a reference if we don't have one in link step (Lionel) Signed-off-by: Lionel Landwerlin <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110796 Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* st/mesa: don't allocate mipmapped texture for NEAREST_MIPMAP_LINEARMarek Olšák2019-08-121-0/+12
| | | | Reviewed-by: Brian Paul <[email protected]>
* st/mesa: eliminate unnecessary redirectionMark Janes2019-08-071-1/+1
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* gallium: redefine ATOMINC_WRAP to be more hardware-friendlyIlia Mirkin2019-08-071-1/+10
| | | | | | | | Both AMD and NVIDIA hardware define it this way. Instead of replicating the logic everywhere, just fix it up in one place. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: relax EXT_shader_image_load_store enableIlia Mirkin2019-08-071-3/+0
| | | | | | | | | | | | | | | | | | | | | There's no reason to bring format-less load requirement into this extension. It requires a size to be provided, and a compatible format is computed from the size + data type. For example layout(size1x32) uniform iimage1D image; becomes DCL IMAGE[0], 1D, PIPE_FORMAT_R32_SINT, WR whereas PIPE_CAP_IMAGE_LOAD_FORMATTED is designed to allow PIPE_FORMAT_NONE to be provided as a format and still enable LOAD operations to be performed. So the shader has all the information it needs about the format. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa: Use _mesa_delete_transform_feedback_object in driversYevhenii Kolesnikov2019-08-071-6/+1
| | | | | | | | | | | | | Function _mesa_delete_transform_feedback_object called from within drivers once driver-specific clean-up has been done. Brings into conformity with how other GL objects are handled. CC: Eric Anholt <[email protected]> CC: Kenneth Graunke <[email protected]> Signed-off-by: Yevhenii Kolesnikov <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* mesa: use _mesa_delete_query in driversYevhenii Kolesnikov2019-08-071-2/+2
| | | | | | | | | | | | | | Now drivers can call _mesa_delete_query once driver-specific clean-up has been done. Brings into conformity with how other GL objects are handled. CC: Eric Anholt <[email protected]> CC: Kenneth Graunke <[email protected]> Suggested-by: Eric Anholt <[email protected]> Signed-off-by: Yevhenii Kolesnikov <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* mesa/gallium: add dric option to allow overriding GL vendor stringTimothy Arceri2019-08-071-0/+2
| | | | | | | Will be used in the following patch. Reviewed-by: Marek Olšák <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93551
* glsl: add EXT_shader_image_load_store new image functionsPierre-Eric Pelloux-Prayer2019-08-061-0/+8
| | | | | | | | This extension has 2 functions that are missing from the ARB versions: - imageAtomicIncWrap - imageAtomicDecWrap Reviewed-by: Marek Olšák <[email protected]>
* glapi: add EXT_shader_image_load_storePierre-Eric Pelloux-Prayer2019-08-061-0/+4
| | | | Reviewed-by: Marek Olšák <[email protected]>
* tgsi: add ATOMICINC_WRAP/ATOMICDEC_WRAP opcodePierre-Eric Pelloux-Prayer2019-08-062-0/+4
| | | | Reviewed-by: Marek Olšák <[email protected]>
* meson: drop unused dep_{thread,dl}Eric Engestrom2019-08-031-4/+4
| | | | | | | | Unused as of last commit. Signed-off-by: Eric Engestrom <[email protected]> Acked-by: Eric Anholt <[email protected]> Tested-by: Vinson Lee <[email protected]>
* meson: replace libmesa_util with idep_mesautilEric Engestrom2019-08-031-6/+3
| | | | | | | | | | | This automates the include_directories and dependencies tracking so that all users of libmesa_util don't need to add them manually. Next commit will remove the ones that were only added for that reason. Signed-off-by: Eric Engestrom <[email protected]> Acked-by: Eric Anholt <[email protected]> Tested-by: Vinson Lee <[email protected]>
* gallium: Implement GL_EXT_shader_samples_identical via a new capabilityKenneth Graunke2019-08-011-0/+1
| | | | | | | | | This exposes the textureSamplesIdenticalEXT function in GLSL. We enable it for iris and radeonsi, because their compilers already have support for this. Tested on Intel Kabylake and AMD Vega 64. Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: fix MSVC compile breakageBrian Paul2019-08-011-2/+2
| | | | Trivial.
* gallium: Make PIPE_CAP_DEPTH_CLIP_DISABLE a tri-state value and use itGert Wollny2019-08-011-0/+3
| | | | | | | | | | | Use value "2" to signal that lowering is needed and supported and enable it accordingly. v2: - Note in CAP description that this lowering currently requires TGSI - use "true" instead of GL_TRUE (both Erik) Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Reviewed-by: Marek Olšák <[email protected]>
* mesa/st: Signal state changes when depth_clamp is emulatedGert Wollny2019-08-011-1/+25
| | | | | | | | | | | | | v1 implemented by Erik Faye-Lund <[email protected]> v2: - Add GS and TES - fix constants state update flags (Erik) v3: don't update rasterizer when depth_clamp is lowered (Erik) v4: Correct NewDepthClamp and also set flags for NewClipControl (Erik) v5: Also set shader_has_one_variant property acording to possible depth_clamp lowering (Marek) Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Reviewed-by: Marek Olšák <[email protected]>
* mesa/st: Add depth clamping to rasterizer codeGert Wollny2019-08-012-6/+39
| | | | | | | | | | implemented by Erik Faye-Lund <[email protected]> v2: Use current depth range values for clamping (Erik) v3: fix scons-win64 build Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Reviewed-by: Marek Olšák <[email protected]>
* mesa/st: Tie depth_clamp code into other shaders (GS and TES)Gert Wollny2019-08-013-1/+36
| | | | | | | | | | | | v2: Use file scope defined depth_range_state in common v3: - don't use the one_shader_variant property, as this is not correct (Marek) - also use tests on available shader stages to enable depth_clamp lowering v4: Don't use key.st, use st directly (Marek) Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Reviewed-by: Marek Olšák <[email protected]>
* mesa/st: Tie depth_clamp lowering into the FSGert Wollny2019-08-013-0/+18
| | | | | | | | | v1 implemented by Erik Faye-Lund <[email protected]> v2: Use different call for FS v3: Use file scope defined depth_range_state Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Reviewed-by: Marek Olšák <[email protected]>
* mesa/st: Tie depth clamp lowering in to the VP codeGert Wollny2019-08-014-0/+32
| | | | | | | | | | | | v1: implemented by Erik Faye-Lund <[email protected]> v2: Add handling of the ARB_clip_control depth mode v3: Move depth_range_state to file scope and remove training zeros (Erik) v4: - don't use the one_shader_variant property, as this is not correct (Marek) - also use tests on available shader stages to enable depth_clamp lowering V5: Don't use key.st, use st directly (Marek) Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Reviewed-by: Marek Olšák <[email protected]>
* mesa/st: add tgsi-lowering code for depth-clampErik Faye-Lund2019-08-012-0/+447
| | | | | | | | | | | | | | | | | This is a TGSI pass that lowers depth-clamping into shader-operations, by replacing the depth-value with 0 (a z-coordinate of zero will always pass the OpenGL depth test conditions), and using a dedicated varying to interpolate the real depth-value instead. Finally we replace the depth-output in the fragment shader. v1 implemented by Erik Faye-Lund <[email protected]> v2: Add support for handling depth clip mode, and refactor code v3: - Rename *_vs functions to *_last_vertex_stage (Erik) - Use 0.0 depth to avoid clipping (Erik) v4: Fix inversion of bool value for clip control property Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Reviewed-by: Marek Olšák <[email protected]>
* mesa/st: replace boolean declarations by boolGert Wollny2019-08-011-2/+2
| | | | | Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Reviewed-by: Marek Olšák <[email protected]>
* state_tracker: Free Labels for querry and tranform_feedbackYevhenii Kolesnikov2019-07-312-0/+2
| | | | | | | Memory leaks were observed on iris with GL_KHR_debug. Signed-off-by: Yevhenii Kolesnikov <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* gallium: add handling for YUV planar surfacesMike Blumenkrantz2019-07-316-7/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | st/dri: this adds a table (similar to the one in i965) which provides mappings for turning various planar formats into multiple sampler views. whereas only NV12 and IYUV were supported, now many more formats are supported here: * P0XX * YUV4XX * YVU4XX * AYUV * XYUV * YUYV * UYVY the table is used directly to handle image creation, simplifying a lot of code and resolving related TODO/FIXME items where workarounds were previously in place to manage NV12 and IYUV formats exclusively st/mesa: the changes here relate to setting up samplers for the planar formats. this requires: * checking for driver support for all the sampler formats * creating the samplers with the corresponding formats and swizzling * running nir_lower_tex with the appropriate options to trigger the lowering for each plane->sampler fixes kwg/mesa#36 Reviewed-by: Kenneth Graunke <[email protected]>
* st/mesa: Skip scissor rect updates when scissor is entirely disabled.Kenneth Graunke2019-07-311-0/+3
| | | | | | | | | | | | | | | | | If any scissor rectangles are enabled, then we need to set proper scissor rectangles for all viewports. But if the scissor test is entirely disabled, then we can skip updating any scissor rectangles. Without this step, we were updating the scissor rectangles based on the current framebuffer size. So if an app rendered to a variety of render targets at different sizes, with scissor test disabled each time, we'd still be continually updating the scissor rectangles, even though it's not necessary. In Civilization VI, this drops us from 310-350 set_scissor_state calls per frame to 0, as it doesn't appear to use scissor testing. Reviewed-by: Marek Olšák <[email protected]>
* tree-wide: replace MAYBE_UNUSED with ASSERTEDEric Engestrom2019-07-314-7/+7
| | | | | | Suggested-by: Jason Ekstrand <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* st/tests: drop incorrect MAYBE_UNUSEDEric Engestrom2019-07-311-2/+2
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* gallium: Add PIPE_CAP_TEXTURE_SHADOW_LODSagar Ghuge2019-07-301-0/+1
| | | | | | | | v2: Line wrap to 80 char (Marek Olsak) Signed-off-by: Sagar Ghuge <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* state_tracker: Add destroying routine for feedback and select stagesYevhenii Kolesnikov2019-07-261-2/+2
| | | | | | | Fixes leaking memory on iris. Signed-off-by: Yevhenii Kolesnikov <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* gallium+mesa: fix tgsi_semantic array typeEric Engestrom2019-07-243-8/+12
| | | | | | Fixes: ed23335a313dfc9cec26 ("gallium: use enums in p_shader_tokens.h (v2)") Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* 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/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]>
* 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-181-0/+2
| | | | | | Signed-off-by: Andreas Baierl <[email protected]> Reviewed-by: Qiang Yu <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Give _mesa_format_get_color_encoding a clearer name.Eric Anholt2019-07-163-5/+4
| | | | | | | It only returned one of two values. 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]>
* 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.
* compiler: Save a single copy of the softfp64 shader in the context.Kenneth Graunke2019-07-101-5/+3
| | | | | | | | | | | | | | | | | | 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]>
* 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]>