freedreno/ir3: rework setup_{input,output} to make struct varyings work Rework setup_{input,output} to be called during emit_intrinsic, in a way which allows struct/array/matrix type varyings to work. This allows turnip to pass dEQP-VK.glsl.linkage.varying.struct.* Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6181>
freedreno/ir3: improve handling of aliased inputs This allows overlapping inputs, which is required for the next patch which makes it so setup_input may be called multiple times for each input. Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6181>
freedreno/ir3: remove indirect input load nir_intrinsic_load_input should only be used with VS and FS, indirect input shouldn't be possible for those. Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6181>
freedreno/ir3: Replace our custom vec4 UBO intrinsic with the shared lowering. This gets us fewer comparisons in the shaders that we need to optimize back out, and reduces backend code. total instructions in shared programs: 11547270 -> 7219930 (-37.48%) total full in shared programs: 334268 -> 319602 (-4.39%) Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Reviewed-by: Connor Abbott <cwabbott0@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6378>
nir: rename nir_op_fne to nir_op_fneu It was always fneu but naming it fne causes confusion from time to time. So lets rename it. Later we also want to add other unordered and fne, this is a smaller preparation for that. Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Connor Abbott <cwabbott0@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6377>
nir: Add an LOD parameter to image_*_size The OpenCL image_width/height/depth functions have variants which can take an LOD parameter. More importantly, LLVM-SPIRV-Translator always generates OpImageQuerySizeLod even if the LOD is guaranteed to be zero. Given that over half the hardware out there has an LOD field for image size queries (based on a rudimentary scan through their NIR -> whatever code), we may as well just add the source to the NIR intrinsic. If this is ever a problem for anyone, the lowering is pretty trivial. I've also added asserts to everyone's drivers that should alert them if they ever see an LOD other than zero. This will never happen with GL or Vulkan so there's no need for panic. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6396>
ir3: Add support for gl_ViewIndex in VS & FS Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5720>
freedreno/ir3: Fix the type of half-float indirect uniform loads. We would be making a MOV from a u32, when we should be loading from a 16-bit value. This likely didn't bite us because we only do mediump in FS and CS so far, and indirect uniforms are usually in a VS (and usually highp). Reviewed-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6179>
nir: Add nir_foreach_shader_in/out_variable helpers Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
freedreno/ir3: Fix SSBO size for bindless SSBO's We theoretically could push these sizes to the const file opportunistically, which appears to be what the blob does, but the maximum number of SSBO's is way too big to do that unconditionally. Just use resinfo to get the size for now. Fixes on turnip: dEQP-VK.ssbo.unsized_array_length.* Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6012>
freedreno/ir3: Fix duplicated fine derivatives instructions. legalize_block() can get run multiple times, which I didn't notice when adding fine derivs support. Other instruction clones change things such that the legalization won't trigger again, but that didn't apply to the DS.PP legalization. To keep someone else from tripping over this, split the one-shot legalization out of the iterative sync flag application. Fixes failures in dEQP-VK.glsl.derivate.dfdxfine.* Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3198 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5699>
ir3: Handle gl_FragStencilRefARB Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5936>
freedreno/ir3: fix setup_input for sparse vertex inputs With turnip we can have sparse input variables like: decl_var shader_in INTERP_MODE_NONE float @1 (VERT_ATTRIB_GENERIC1.x, 1, 0) decl_var shader_in INTERP_MODE_NONE float @2 (VERT_ATTRIB_GENERIC1.y, 1, 0) decl_var shader_in INTERP_MODE_NONE float @3 (VERT_ATTRIB_GENERIC1.w, 1, 0) Example of a test fixed: dEQP-VK.glsl.440.linkage.varying.component.vert_in.vec2.as_float_float_unused Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5818>
freedreno/ir3: add support for a650 tess shared storage A650 uses LDL/STL, and the "local_primitive_id" in tess ctrl shader comes from bits 16-21 in the header instead of 0-5. Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5764>
freedreno/ir3: add support for INTERP_MODE_NOPERSPECTIVE Check the interp mode and use SYSTEM_VALUE_BARYCENTRIC_LINEAR_* instead when it is INTERP_MODE_NOPERSPECTIVE. Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5582>
freedreno/ir3: add generic get_barycentric() This will be useful to support the missing barycentric sysvals. Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5582>
freedreno/ir3: add support for load_draw_id This is part of adding VK_KHR_shader_draw_parameters for turnip. IR3_DP_VTXID_BASE/IR3_DP_VTXCNT_MAX offsets are changed to match what CP_DRAW_INDIRECT_MULTI requires. Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5635>
freedreno/ir3: pass variant to ir3_create() Prep to convert over to ralloc. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5508>
freedreno/ir3: move ubo_state into const_state As with const_state, this will also need to move into the variant. To simplify that, just move it into the const_state itself, since after all it is related. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5508>
freedreno/ir3: add accessor for const_state We are going to want to move this back to the variant, and come up with a different strategy for binning/nonbinning to share the same constant layout, in order to implement shader-cache support. (Since then we can have a mix of dynamically compiled variants and cache hits, so there is no good place to serialize the const-state.) To reduce the churn as we re-arrange things, move direct access to the const-state to a helper fxn. This patch is the boring churny part. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5508>