aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* nir: Set the alignment for SSBO loweringIcecream952020-07-171-0/+3
| | | | | | | | | | | The alignment can just be copied from the source intrinsic. Fixes the assertion nir_intrinsic_align_offset(instr) < nir_intrinsic_align_mul(instr) Reviewed-by: Karol Herbst <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5949>
* nir: Fix lower_two_sided_color when the face is an inputIcecream952020-07-171-1/+35
| | | | | | | | | | | | Fixes the two-sided-lighting and vertex-program-two-side piglit tests on Panfrost. v2: Use an existing variable for gl_FrontFacing if present. Reviewed-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Rob Clark <[email protected]> Tested-by: Urja Rannikko <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5915>
* nir: Add a face_sysval argument to nir_lower_two_sided_colorIcecream952020-07-172-2/+2
| | | | | | | | | | This is needed for handling drivers that use an input for loading the face, for example Panfrost with Midgard GPUs. Reviewed-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Rob Clark <[email protected]> Tested-by: Urja Rannikko <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5915>
* pan/mdg: Do per-sample framebuffer loadsIcecream952020-07-171-1/+1
| | | | | | | | EXT_shader_framebuffer_fetch requires the fetched value to be per-sample, so we need to load the sample id when in a fragment shader. Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5930>
* mesa: do not use bitfields for advanced-blend stateErik Faye-Lund2020-07-173-38/+33
| | | | | | | Signed-off-by: Elie Tournier <[email protected]> Reviewed-by: Gert Wollny <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5516>
* Android: Fixes for Q and RRoman Stratiienko2020-07-151-1/+1
| | | | | | | | | | | | | | | | Fix Android-Q build: - Use AOSP prebuilt bison by specifying $(BISON) variable - Use AOSP prebuilt flex by specifying $(LEX) variable Fix Android-R build: - Add M4 environmet variable for Android R and higher (See [1]) [1] - https://cs.android.com/android/_/android/platform/build/+/2bfffb9f48a78de12faf5da77424c0cecb70d6eb:Changes.md;dlc=997661002af1282d938e88c3c723037e42e5d283 Signed-off-by: Roman Stratiienko <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Tested-by: Mauro Rossi <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5894>
* compiler: Add dual-source factors to blend_factorIcecream952020-07-151-0/+2
| | | | | Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5620>
* nir: Support load/store of temps as scratch in nir_lower_explicit_ioJesse Natalie2020-07-141-3/+14
| | | | | Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5889>
* nir: When nir_lower_vars_to_explicit_types is run on temps, update scratch_sizeJesse Natalie2020-07-141-2/+21
| | | | | | | | To allow interop with other scratch ops, append any remaining temp vars to the end of any already-allocated scratch space. Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5889>
* nir_lower_io: Add addr_format_is_offset helperJesse Natalie2020-07-141-2/+8
| | | | | Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5889>
* nir/lower_subgroups: add lower_shuffle_to_swizzle_amdRhys Perry2020-07-132-0/+38
| | | | | | | | masked_swizzle_amd can be much faster than shuffle. Signed-off-by: Rhys Perry <[email protected]> Reviewed-by: Daniel Schürmann <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5695>
* nir/lower_subgroups: pass options struct to lower_shuffleRhys Perry2020-07-131-5/+9
| | | | | | Signed-off-by: Rhys Perry <[email protected]> Reviewed-by: Daniel Schürmann <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5695>
* nir: Add a base value to load_raw_output_panIcecream952020-07-131-1/+1
| | | | | | | This is the render target the read instruction uses. Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>
* spirv: Allow block-decorated struct types for constantsJason Ekstrand2020-07-122-1/+3
| | | | | | | | | | | Whenever a struct type is decorated Block or BufferBlock we turn that into a GLSL_TYPE_INTERFACE. Since these decorations can end up random places, we should allow them for constants. Closes: #3252 Fixes: 9d0ae777dd6 "spirv: Use interface type for block and buffer..." Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5855>
* spirv: Skip phis in unreachable blocks in the second phi passJason Ekstrand2020-07-121-1/+8
| | | | | | | Closes: #3253 Fixes: 22fdb2f8551 "nir/spirv: Update to the latest revision" Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5855>
* nir: allow nir_lower_clip_halfz to run in geometry shadersMike Blumenkrantz2020-07-111-1/+2
| | | | | | | | the final output of gl_Position needs this transform, and geometry shaders must write this value for stream 0 if rasterization is enabled Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5851>
* nir: allow nir_lower_point_size_mov to run in geometry shaderMike Blumenkrantz2020-07-111-1/+2
| | | | | | | geometry shaders may need to emit PSIZ as well Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5851>
* glsl: declare gl_Layer/gl_ViewportIndex/gl_ViewportMask as vs builtinsPierre-Eric Pelloux-Prayer2020-07-091-50/+55
| | | | | | | | | | | | | | | | | | | | | | | | Otherwise a VS doing the following: out gl_PerVertex { vec4 gl_Position; int gl_ViewportIndex; }; cannot be compiled because of the following error: "redeclaration of gl_PerVertex must be a subset of the built-in members of gl_PerVertex" v2: add GLSL_PRECISION_HIGH param to add_varying() for "gl_Layer" in generate_fs_special_vars. v3: add GLSL_PRECISION_HIGH param to add_varying() for "gl_Layer" in generate_varyings. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2946 Tested-by: John Galt <[email protected]> Reviewed-by: Marek Olšák <[email protected]> (v3) Reviewed-by: Ian Romanick <[email protected]> (v3) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5167>
* glsl: only allow 32 bits atomic operations on imagesPierre-Eric Pelloux-Prayer2020-07-091-0/+44
| | | | | | | | | | | | | EXT_shader_image_load_store says: The format of the image unit must be in the "1x32" equivalence class otherwise the atomic operation is invalid. ARB_shader_image_load_store says: We will only support 32-bit atomic operations on images Fixes: fc0a2e5d017 ("glsl: add EXT_shader_image_load_store new image functions") Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5688>
* glsl: don't expose imageAtomicIncWrap for signed imagePierre-Eric Pelloux-Prayer2020-07-091-15/+29
| | | | | | | | | The spec says that it's only allowed for unsigned ones. Same from imageAtomicDecWrap. Fixes: fc0a2e5d017 ("glsl: add EXT_shader_image_load_store new image functions") Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5688>
* glsl: reject size1x8 for image variable with floating-point data typesPierre-Eric Pelloux-Prayer2020-07-091-5/+7
| | | | | | Fixes: 8d07d66180b ("glsl,nir: Switch the enum representing shader image formats to PIPE_FORMAT.") Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5688>
* glsl: don't validate array types in ir_dereference_variableMarek Olšák2020-07-081-1/+4
| | | | | | | | Fixes: 8d62969cfe8 - glsl: validate more stuff Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3245 Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5813>
* nir/validate: Don't abort() until after the shader has printedJason Ekstrand2020-07-081-33/+7
| | | | | | | | | | | | | | | | | | | | | In the case where SSA use/def chains are broken, NIR prints out a very cryptic error and then aborts. This abort happens during validation rather than after the print is complete, hiding any other errors that may have been found. One might think, "So what? Fix your use/def issue first." However, what makes this especially bad is that, when use/def chains are broken, there's usually a much nicer error inline in the shader that would have been printed had we not aborted early so the current behavior simply ensures you get the most cryptic error possible in an already difficult-to-debug case. While we're at it, we remove the one other case of abort() which is in the validation of phi instruction sources. Reviewed-by: Rob Clark <[email protected]> Tested-by: Marcin Ślusarz <[email protected]> Reviewed-by: Marcin Ślusarz <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5809>
* nir: add lowering pass for fragcolor -> fragdataMike Blumenkrantz2020-07-083-0/+111
| | | | | | | | this is needed for zink and other drivers which can support fragcolor but not fragdata and want to correctly handle EXT_multiview_draw_buffers Reviewed-by: Erik Faye-Lund <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5687>
* glsl: lower mediump temporaries to 16 bits except structures (v2)Marek Olšák2020-07-073-2/+1022
| | | | | | | | | | | Without this, NIR contains non-lowerable 32-bit phis for mediump variables. Structures are not lowered yet. v2: add the LowerPrecisionTemporaries option Reviewed-by: Alyssa Rosenzweig <[email protected]> (v1) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
* glsl: Handle 16-bit types in loop analysisAlyssa Rosenzweig2020-07-071-0/+9
| | | | | | | | | | Fixes crash with mediump lowering in: dEQP-GLES2.functional.shaders.loops.do_while_constant_iterations.basic_mediump_float_fragment Signed-off-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
* glsl: add capability to lower mediump array typesMarek Olšák2020-07-071-29/+48
| | | | | | | | This is not needed for lowering expressions, because they always work with basic types, but it will be needed for lowering variables. Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
* glsl: lower builtins to mediump that always return mediump or lowpMarek Olšák2020-07-072-2/+114
| | | | | Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
* glsl: lower builtins to mediump that ignore precision of certain parametersMarek Olšák2020-07-072-0/+97
| | | | | Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
* glsl: don't lower builtins to mediump that don't allow itMarek Olšák2020-07-074-15/+334
| | | | | Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
* glsl: don't lower precision of textureSizeMarek Olšák2020-07-072-0/+19
| | | | | Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
* glsl: flatten a tautological conditional in lower_precisionMarek Olšák2020-07-071-8/+5
| | | | | Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
* glsl: cleanups in lower_precisionMarek Olšák2020-07-071-9/+8
| | | | | Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
* glsl: remove the return type from lower_precisionMarek Olšák2020-07-072-10/+3
| | | | | | | It's unused. Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
* glsl: convert reusable lower_precision util code into helper functionsMarek Olšák2020-07-071-27/+34
| | | | | Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
* glsl: validate more stuffMarek Olšák2020-07-071-0/+66
| | | | | Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
* glsl: run validate_ir_tree if GLSL_VALIDATE=1 regardless of the build configMarek Olšák2020-07-071-4/+5
| | | | | Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
* glsl: fix evaluating float16 constant expression matricesMarek Olšák2020-07-071-0/+6
| | | | | Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
* glsl: fix the type of ir_constant_data::u16Marek Olšák2020-07-071-1/+1
| | | | | Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
* glsl: print constant initializersMarek Olšák2020-07-071-0/+10
| | | | | Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
* glsl: print precision qualifiers in IR dumpsMarek Olšák2020-07-071-2/+3
| | | | | Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
* glsl: make print_type non-static for debuggingMarek Olšák2020-07-072-11/+12
| | | | | Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
* nir: refactor nir_can_move_instrDaniel Schürmann2020-07-071-27/+24
| | | | | Reviewed-by: Rhys Perry <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5622>
* nir: also move vecN in case of nir_move_copiesDaniel Schürmann2020-07-071-1/+1
| | | | | Reviewed-by: Rhys Perry <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5622>
* nir: Add intrinsics for the line widthNeil Roberts2020-07-061-0/+2
| | | | | | | | | | | | | | The first intrinsic is intended to expose the value set by glLineWidth to shaders internally. The second intrinsic exposes the value actually sent to the hardware. This may be wider than the first one in order to implement anti-aliasing. These will be used in later patches to implement a line smoothing lowering pass. v2: Add a second intrinsic for the expanded line width for anti-aliasing. Reviewed-by: Eric Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5624>
* compiler: Add a system value for the line coordNeil Roberts2020-07-066-0/+9
| | | | | | | | | The line coord is a coordinate along the axis perpendicular to the line. It is in the range [0,1] between the two edges of the line. It is available at least on Broadcom hardware. Reviewed-by: Eric Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5624>
* nir: Add docs to nir_lower[_explicit]_ioJason Ekstrand2020-07-061-0/+32
| | | | | | | Reviewed-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Connor Abbott <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5418>
* nir: Remove shared support from lower_ioJason Ekstrand2020-07-061-78/+4
| | | | | | | | | | | | No drivers are using this anymore so we can delete it and not keep maintaining this legacy code-path. If any drivers want this in the future, they should use nir_lower_varst_to_explicit_types followed by nir_lower_explicit_io. Reviewed-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Connor Abbott <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5418>
* nir: Assert that nir_lower_io is only called with allowed modesJason Ekstrand2020-07-061-7/+6
| | | | | | | Reviewed-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Connor Abbott <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5418>
* nir: add vec2_index_32bit_offset address formatConnor Abbott2020-07-063-36/+70
| | | | | | | | | | | | | | | | | | For turnip, we use the "bindless" model on a6xx. Loads and stores with the bindless model require a bindless base, which is an immediate field in the instruction that selects between 5 different 64-bit "bindless base registers", a 32-bit descriptor index that's added to the base, and the usual 32-bit offset. The bindless base usually, but not always, corresponds to the Vulkan descriptor set. We can handle the case where the base is non-constant by using a bunch of if-statements, to make it a little easier in core NIR, and this seems to be what Qualcomm's driver does too. Therefore, the pointer format we need to use in NIR has a vec2 index, for the bindless base and descriptor index. Plumb this format through core NIR. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5683>