summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv
Commit message (Collapse)AuthorAgeFilesLines
* spirv/radv: add AMD_gcn_shader capability, remove current extensionsAlejandro Piñeiro2018-03-152-2/+1
| | | | | | | | | | | | | | | | | | | | | | So now, during spirv_to_nir, it uses the capability instead of the extension. Note that we are really doing here is treating SPV_AMD_gcn_shader as other supported extensions. SPV_AMD_gcn_shader is not the first SPV extension supported. For example, the capability draw_parameters infers if the extension SPV_KHR_shader_draw_parameters is supported or not. This could be seen as counter-intuitive, and that it would be easier to define which extensions are supported, and based our checks on that, but we need to take into account that some capabilities are optional from core, and others came from new extensions. Also this commit would make the implementation of ARB_spirv_extensions easier. v2: AMD_gcn_shader capability renamed to gcn_shader (Daniel Schürmann) Reviewed-by: Daniel Schürmann <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* spirv: update arguments for vtn_nir_alu_op_for_spirv_opcode()Samuel Iglesias Gonsálvez2018-03-153-15/+15
| | | | | | | | | | | We don't need anymore the source and destination's data type, just their bitsize. v2: - Use glsl_get_bit_size () instead (Jason). Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* spirv: fix the translation of SPIR-V conversion opcodes to NIRSamuel Iglesias Gonsálvez2018-03-151-3/+37
| | | | | | | | | There are some SPIRV opcodes (like UConvert and SConvert) have some expectations of the output that doesn't depend on the operands data type. Generalize the solution of all of them. Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* compiler: int8/uint8 supportKarol Herbst2018-03-142-0/+38
| | | | | | | | | | OpenCL kernels also have int8/uint8. v2: remove changes in nir_search as Jason posted a patch for that Reviewed-by: Jason Ekstrand <[email protected]> Signed-off-by: Rob Clark <[email protected]> Signed-off-by: Karol Herbst <[email protected]>
* spirv: Handle doubles when multiplying a mat by a scalarNeil Roberts2018-03-141-3/+3
| | | | | | | | | | The code to handle mat multiplication by a scalar tries to pick either imul or fmul depending on whether the matrix is float or integer. However it was doing this by checking whether the base type is float. This was making it choose the int path for doubles (and presumably float16s). Reviewed-by: Jason Ekstrand <[email protected]>
* spirv: Silence compiler warning about undefined srcs[0]Eric Anholt2018-03-131-0/+1
| | | | | | v2: Use assume() at the srcs[] definition instead. Reviewed-by: Ian Romanick <[email protected]>
* spirv: handle AMD_gcn_shader extended instructionsDaniel Schürmann2018-03-074-0/+64
| | | | | | Co-authored-by: Dave Airlie <[email protected]> Signed-off-by: Daniel Schürmann <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* spirv: import AMD extensions header from glslangDaniel Schürmann2018-03-071-0/+110
| | | | | Signed-off-by: Daniel Schürmann <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* spirv: Add support for subgroup arithmeticJason Ekstrand2018-03-072-8/+93
| | | | | Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* spirv: Add subgroup quad supportJason Ekstrand2018-03-072-2/+27
| | | | | Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* spirv: Add subgroup shuffle supportJason Ekstrand2018-03-072-1/+28
| | | | | Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* spirv: Add subgroup vote supportJason Ekstrand2018-03-072-1/+50
| | | | Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Add subgroup ballot supportJason Ekstrand2018-03-073-8/+160
| | | | Reviewed-by: Iago Toral Quiroga <[email protected]>
* spirv: Add initial subgroup supportJason Ekstrand2018-03-074-0/+142
| | | | | Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* spirv: Handle the new OpModuleProcessed instructionJason Ekstrand2018-03-071-0/+1
| | | | Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* nir/spirv: Add support for device groupsJason Ekstrand2018-03-072-0/+8
| | | | Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* spirv: Update the SPIR-V headers and json to 1.3.1Jason Ekstrand2018-03-072-41/+683
| | | | Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* spirv: Rework barriersJason Ekstrand2018-03-071-18/+114
| | | | | | | | | | Our previous handling of barriers always used the big hammer and didn't correctly emit memory barriers when specified along with a control barrier. This commit completely reworks the way we emit barriers to make things both more precise and more correct. Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* spirv: Add a vtn_constant_value helperJason Ekstrand2018-03-071-0/+6
| | | | | Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* spirv: Add SpvCapabilityShaderViewportIndexLayerEXTCaio Marcelo de Oliveira Filho2018-03-072-0/+12
| | | | | | | | | | | | | | This capability allows gl_ViewportIndex and gl_Layer to also be used as outputs in Vertex and Tesselation shaders. v2: Make conditional to the capability, add gl_Layer, add tesselation shaders. (Iago) v3: Don't export to tesselation control shader. v4: Add Reviewd-by tag. Reviewed-by: Iago Toral Quiroga <[email protected]>
* spirv/i965/anv: Relax push constant offset assertions being 32-bit alignedJose Maria Casanova Crespo2018-02-281-2/+0
| | | | | | | | | | | | | | | | The introduction of 16-bit types with VK_KHR_16bit_storages implies that push constant offsets could be multiple of 2-bytes. Some assertions are updated so offsets should be just multiple of size of the base type but in some cases we can not assume it as doubles aren't aligned to 8 bytes in some cases. For 16-bit types, the push constant offset takes into account the internal offset in the 32-bit uniform bucket adding 2-bytes when we access not 32-bit aligned elements. In all 32-bit aligned cases it just becomes 0. v2: Assert offsets to be aligned to the dest type size. (Jason Ekstrand) Reviewed-by: Jason Ekstrand <[email protected]>
* spirv: Calculate properly 16-bit vector sizesJose Maria Casanova Crespo2018-02-281-5/+2
| | | | | | | | | | | Range in 16-bit push constants load was being calculated wrongly using 4-bytes per element instead of 2-bytes as it should be. v2: Use glsl_get_bit_size instead of if statement (Jason Ekstrand) Reviewed-by: Jason Ekstrand <[email protected]>
* spirv: apply memory qualifiers to imagesSamuel Pitoiset2018-02-221-3/+9
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* spirv: split constant initializers on in/out structsIago Toral Quiroga2018-02-061-0/+8
| | | | | | | | | The SPIR-V parser splits in/out struct variables and creates a separate variable for each first-level member of the struct. When the struct variable has an initializer this means that we also need to split the initializer. Reviewed-by: Jason Ekstrand <[email protected]>
* .gitignore: Ignore new generated filesScott D Phillips2018-01-081-0/+1
| | | | | | | | | New generated files from: bb1e6ff161c ("spirv: Add a prepass to set types on vtn_values") 65fc16c9741 ("autotools: set XA versions in configure.ac and configure header file") Reviewed-by: Jordan Justen <[email protected]>
* spirv: Do implicit conversions of uint to bool in OpStoreJason Ekstrand2018-01-081-0/+19
| | | | | | | | | | | Technically, the GLSLang bug related to this can also affect SSBO writes where the bool -> uint conversion is missing. However, the only known shipping application with an old enough version of GLSLang to cause issues with this is the new DOOM game so we keep the workaround as small as possible. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104424 Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Loosen the validation for load/store type matchingJason Ekstrand2018-01-081-6/+33
| | | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104338 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104424 Tested-by: Eero Tamminen <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Require a storage type for OpStore destinationsJason Ekstrand2018-01-081-0/+4
| | | | | | | This rules out things such as trying to store a pointer to a local variable. Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Add a vtn_types_compatible helperJason Ekstrand2018-01-082-0/+55
| | | | | Tested-by: Eero Tamminen <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Store the id of the type in vtn_typeJason Ekstrand2018-01-083-5/+8
| | | | | | | | | Previously, we were storing a pointer to the vtn_value because we use it to look up decorations when we create input/output variables. This works, but it also may be useful to have the id itself so we may as well store that instead. Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Add a mechanism for dumping failing shadersJason Ekstrand2018-01-082-0/+29
| | | | Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Rework asserts in var_decoration_cbJason Ekstrand2018-01-081-7/+8
| | | | | | | | Now that higher levels are enforcing decoration sanity, we don't need the vtn_asserts here. This function *should* be safe but we still want a few well-placed regular asserts in case something goes awry. Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Rework error checking for decorationsJason Ekstrand2018-01-081-9/+32
| | | | | | | | | | | | This reworks the error checking on our generic handling of decorations. The objective is to validate all of the SPIR-V assumptions we make up-front and convert redundant checks to compiled-out asserts. The most important part of this is to ensure that member decorations only occur on OpTypeStruct and that the member is never out-of-bounds. This way later code can assume that the member is sane and not have to worry about OOB array access due to a misplaced OpMemberDecorate. Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Add better type validation to OpTypeImageJason Ekstrand2018-01-081-7/+10
| | | | Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Switch on vtn_base_type in OpComposite(Extract|Insert)Jason Ekstrand2018-01-081-37/+32
| | | | | | | | This is a bit simpler since we have fewer enum values in the case. It's also a bit more efficient because we're making fewer glsl_get_* calls. While we're at it, add better type validation. Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Refactor Op[Spec]ConstantComposite and add better validationJason Ekstrand2018-01-081-36/+32
| | | | | | | | Now that vtn_base_type is a real and full base type, we can switch on that instead of the GLSL base type which is a lot fewer cases in our switch. Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Add better validation to Op[Spec]ConstantJason Ekstrand2018-01-081-2/+7
| | | | Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Remove a pointless assignment in SpvOpSpecConstantJason Ekstrand2018-01-081-1/+0
| | | | | | We re-assign later inside the bit_size switch Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Unify boolean constants and add better validationJason Ekstrand2018-01-081-10/+11
| | | | Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv/info: Add spirv_op_to_stringJason Ekstrand2018-01-082-0/+11
| | | | Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Make 'info' a local array spirv_info_c.pyJason Ekstrand2018-01-081-3/+5
| | | | Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Add better error messages in vtn_value helpersJason Ekstrand2018-01-081-11/+15
| | | | Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: Import 1.2 rev 3 headers and grammar from KhronosCaio Marcelo de Oliveira Filho2018-01-082-164/+431
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* spirv: consider bitsize when handling OpSwitch casesEero Tamminen2017-12-281-3/+11
| | | | | | | | | | | | This reverts commit 7665383a33f9ce9256aa121cbe4d3bd948dff145 and is squashed together with https://patchwork.freedesktop.org/patch/194610/ (spirv: avoid infinite loop / freeze in vtn_cfg_walk_blocks()) which fixes https://bugs.freedesktop.org/show_bug.cgi?id=104359 properly. Fixes: 9702fac68e (spirv: consider bitsize when handling OpSwitch cases) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104359 Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* Revert "spirv: consider bitsize when handling OpSwitch cases"Mark Janes2017-12-211-11/+3
| | | | | | | | | | This reverts commit 9702fac68e8bd07be8871f7925d7f9fb98da3699, which hangs vulkancts and crucible on all platforms. The patch is being reverted because it disables continuous integration testing. The patch from bug 104359 does not apply to master. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104359
* spirv: consider bitsize when handling OpSwitch casesJuan A. Suarez Romero2017-12-201-3/+11
| | | | | | | When walking over all the cases in a OpSwitch, take in account the bitsize of the literals to avoid getting wrong cases. Reviewed-by: Jason Ekstrand <[email protected]>
* spirv: Relax the validation conditions of OpSelectJason Ekstrand2017-12-181-4/+21
| | | | | | | | | | | The Talos Principle contains shaders with an OpSelect between two vectors where the condition is a scalar boolean. This is technically against the spec bout nir_builder gracefully handles it by splatting out the condition to all the channels. So long as the condition is a boolean, just emit a warning instead of failing. Reviewed-by: Lionel Landwerlin <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104246
* spirv: Handle image and sampler function parametersJason Ekstrand2017-12-121-0/+73
|
* spirv/cfg: Refactor the function parameter loop a bitJason Ekstrand2017-12-121-5/+9
|
* spirv/cfg: Be a bit more precise about function parametersJason Ekstrand2017-12-121-3/+2
| | | | | | Pointers with no storage type are converted to inout variables but SSA values and pointers with a storage type (which turns into a uint or uvec2) are just input variables.