summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv
Commit message (Collapse)AuthorAgeFilesLines
* nir/spirv: handle if's with same label in both branchesJuan A. Suarez Romero2017-09-121-2/+10
| | | | | | | | | | | | | | When a conditional branch has the same labels in the "if" part and in the "else" part, then we have the same cfg block, and it must be handled once. v2: handle it the same way as OpBranch (Jason). Fixes: dEQP-VK.spirv_assembly.instruction.compute.conditional_branch.same_labels* dEQP-VK.spirv_assembly.instruction.graphics.conditional_branch.same_labels* Reviewed-by: Jason Ekstrand <[email protected]>
* nir/spirv: fix chain access with different index bit sizesSamuel Iglesias Gonsálvez2017-09-111-3/+8
| | | | | | | | | | | | Currently we support 32-bit indexes/offsets all over the driver, so we convert them to that bit size. Fixes dEQP-VK.spirv_assembly.instruction.*.indexing.* v2: Use u2u32 instead (Jason). Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* spirv: Add support for the HelperInvocation builtinJason Ekstrand2017-09-051-1/+4
| | | | | | | | I have no idea how this got missed but it's been missing since forever. Cc: [email protected] Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* nir/spirv: Use unreachable("...") rather than assert(!"...")Matt Turner2017-08-292-13/+13
| | | | | | | | Quiets a number of uninitialized variable warnings in clang. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* spirv: Fix SpvImageFormatR16uiJason Ekstrand2017-08-021-1/+1
| | | | | Reviewed-by: Lionel Landwerlin <[email protected]> Cc: "17.1 17.2" <[email protected]>
* compiler/spirv: Add a .gitignore and ignore spirv_info.cJason Ekstrand2017-07-181-0/+1
|
* nir/spirv: Add support for SPV_KHR_variable_pointersJason Ekstrand2017-07-185-10/+108
| | | | Reviewed-by: Iago Toral Quiroga <[email protected]>
* nir/spirv: Add a helper for pushing SSA valuesJason Ekstrand2017-07-184-10/+20
| | | | Reviewed-by: Iago Toral Quiroga <[email protected]>
* nir/spirv: Implement OpPtrAccessChain for buffersJason Ekstrand2017-07-183-4/+34
| | | | Reviewed-by: Iago Toral Quiroga <[email protected]>
* spirv/nir: Add some useful asserts for type decorationsJason Ekstrand2017-07-181-0/+4
| | | | | | | Now that vtn_type has piles of unions, we should assert sanity before setting fields that may stomp others. Reviewed-by: Iago Toral Quiroga <[email protected]>
* spirv: Add support for the StorageBuffer storage classJason Ekstrand2017-07-181-0/+4
| | | | Reviewed-by: Iago Toral Quiroga <[email protected]>
* spirv: Generate spirv_info.cIan Romanick2017-07-182-156/+82
| | | | | | | | | | | | | | | | | | The old table based spirv_*_to_string functions would return NULL for any values "inside" the table that didn't have entries. The tables also needed to be updated by hand each time a new spirv.h was imported. Generate the file instead. v2: Make this script work more like src/mesa/main/format_fallback.py. Suggested by Jason. Remove SCons supports. Suggested by Jason and Emil. Put all the build work in Makefile.nir.am in lieu of adding a new Makefile.spirv.am. Suggested by Emil. Add support for Android builds based on code provided by Emil. Signed-off-by: Ian Romanick <[email protected]> Suggested-by: Jason Ekstrand <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* spirv: Import the lastest 1.0.2 JSON from KhronosIan Romanick2017-07-181-0/+5792
| | | | | Signed-off-by: Ian Romanick <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
* spirv: Import the latest 1.2 header from KhronosJason Ekstrand2017-07-181-4/+37
| | | | Reviewed-by: Iago Toral Quiroga <[email protected]>
* spirv: Fix reaching unreachable for compare exchange on imagesJames Legg2017-07-101-0/+1
| | | | | | | | | | | | | | | We were hitting the unreachable("Invalid image opcode") near the end of vtn_handle_image when parsing the SpvOpAtomicCompareExchange opcode. v2: Add stable CC. v3: Ignore SpvOpAtomicCompareExchangeWeak. It requires the Kernel capability which is not exposed in Vulkan, and spirv_to_nir is not used for OpenCL which does support it. Reviewed-by: Jason Ekstrand <[email protected]> CC: <[email protected]>
* nir/spirv: Remove unnecessary comment.Andres Gomez2017-07-081-5/+0
| | | | | | | | | It should have been removed after 00c47e111c. Cc: Jason Ekstrand <[email protected]> Cc: Connor Abbott <[email protected]> Signed-off-by: Andres Gomez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir/spirv: Rework function argument setupJason Ekstrand2017-07-053-28/+34
| | | | | | | | Now that we have proper pointer types, we can be more sensible about the way we set up function arguments and deal with the two cases of pointer vs. SSA parameters distinctly. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Stop trying to convert pointers to SSA in glsl450Jason Ekstrand2017-07-051-1/+6
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Use real pointer typesJason Ekstrand2017-07-054-15/+60
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Stop using glsl_type for function typesJason Ekstrand2017-07-053-31/+31
| | | | | | | We're going to want the full vtn_type available to us anyway at which point glsl_type isn't really buying us anything. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Beef up the type system a bitJason Ekstrand2017-07-052-28/+59
| | | | | | | | | This adds a vtn concept of base_type as well as a couple of other fields. This lets us be a tiny bit more efficient in some cases but, more importantly, it will eventually let us express things the GLSL type system can't. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Compact vtn_typeJason Ekstrand2017-07-052-26/+39
| | | | | | | Use an anonymous union of structs to help keep the structure small and better organized. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Simplify type copyingJason Ekstrand2017-07-051-7/+1
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Compute offsets for UBOs and SSBOs up-frontJason Ekstrand2017-07-052-27/+138
| | | | | | | | | Now that we have a pointer wrapper class, we can create offsets for UBOs and SSBOs up-front instead of waiting until we have the full access chain. For push constants, we still use the old mechanism because it provides us with some nice range information. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Rework the way pointers get dereferencedJason Ekstrand2017-07-052-64/+88
| | | | | | | This has the advantage of moving all of the "extend an access chain" code into one place. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Break variable creation out into a helperJason Ekstrand2017-07-051-172/+184
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Remove unneeded parameters from pointer_to_offsetJason Ekstrand2017-07-053-19/+8
| | | | | | | | Everyone now calls it with stop_at_matrix = false. Since we're now always walking all the way to the end of the access chain, the type returned is just the same as ptr->type; Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Simplify matrix loads/storesJason Ekstrand2017-07-052-100/+90
| | | | | | | | | | | | | | | | | | | | | Instead of handling all of the complexity at the end, we choose to decorate types a bit more cleverly. When we have a row-major matrix type, we give it the stride of a single vector and give it's array element type (which represents a column) the actual matrix stride. Previously, we were using stop_at_matrix and handling everything from matrix on down as special cases but now we walk the access chain all the way to the end and then load. Even though this looks like it may lead to a significant functional change, it doesn't. The reason why we needed to do stop_at_matrix before was to handle row-major properly since the offsets and strides would be all out-of-order. Now that row major matrix types have the small stride on the matrix and the large stride on the vector, offsetting to a single column of a row-major matrix works fine. The load/store code simply picks up on the fact that the stride isn't the type size and does multiple loads. The generated code from these methods should be the same. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Use the correct stride for non-32-bit vectorsJason Ekstrand2017-07-051-1/+1
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Wrap access chains in a new vtn_pointer data structureJason Ekstrand2017-07-054-159/+187
| | | | | | | | | | | | The vtn_pointer structure provides a bit better abstraction than passing access chains around directly. For one thing, if the pointer just points to a variable, we don't need the access chain at all. Also, pointers know what their dereferenced type is so we can avoid passing the type in a bunch of places. Finally, pointers can, in theory, be extended to the case where you don't actually know what variable is being referenced. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Rename some things from access_chain to pointerJason Ekstrand2017-07-054-82/+73
| | | | | | | We're about to add a vtn_pointer data structure and this will prevent some rename churn in the next commit. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Split up Uniform and UniformConstant storage classesJason Ekstrand2017-07-051-3/+7
| | | | | | | | | We were originally handling them together because I was rather unclear on the distinction. However, keeping them combined keeps the confusion. Split them up so that it's more clear from the code how we expect the two storage classes to be used. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Add a storage_class_to_mode helperJason Ekstrand2017-07-051-45/+78
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Use the type from the deref for atomicsJason Ekstrand2017-07-051-3/+3
| | | | | | | Previously, we were using the type of the variable which is incorrect. Cc: "17.1" <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Move a "}"Jason Ekstrand2017-07-051-1/+1
| | | | | | | It's closing a "{" at the begining of a switch case. Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* spirv: fix OpBitcast when the src and dst bitsize are different (v3)Connor Abbott2017-07-031-1/+66
| | | | | | | | | | | | | | | Before, we were just implementing it with a move, which is incorrect when the source and destination have different bitsizes. To implement it properly, we need to use the 64-bit pack/unpack opcodes. Since glslang uses OpBitcast to implement packInt2x32 and unpackInt2x32, this should fix them on anv (and radv once we enable the int64 capability). v2: make supporting non-32/64 bit easier (Jason) v3: add another assert (Jason) Fixes: b3135c3c ("anv: Advertise shaderInt64 on Broadwell and above") Signed-off-by: Connor Abbott <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: implement GLSL.std.450 NMax, NMIn and NClamp operationsJuan A. Suarez Romero2017-06-271-0/+3
| | | | | | v2: NIR fmax/fmin already handles NaN (Connor). Reviewed by: Elie Tournier <[email protected]>
* nir: add support for 64-bit in SmoothStep functionJuan A. Suarez Romero2017-06-271-3/+5
| | | | | | | | | | | According to GLSL.std.450 spec, SmoothStep expects input to be a floating-point type, but it does not restrict the bitsize. Current implementation relies on inputs to be 32-bit. This commit extends the support to 64-bit size inputs. Reviewed by: Elie Tournier <[email protected]>
* spirv: Work around the Doom shader bugJason Ekstrand2017-06-202-0/+28
| | | | | | | | | | | | | | | | | Doom shipped with a broken version of GLSLang which handles samplers as function arguments in a way that isn't spec-compliant. In particular, it creates a temporary local sampler variable and copies the sampler into it. While Dave has had a hack patch out for a while that gets it working, we've never landed it because we've been hoping that a game update would come out with fixed shaders. Unfortunately, no game update appears on to be on the horizon and I've found this issue in yet another application so I think we're stuck working around it. Hopefully, we can delete this code one day. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99467 Cc: "17.1" <[email protected]> Tested-by: Grazvydas Ignotas <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* nir: Port to u_dynarrayThomas Helland2017-06-072-5/+5
| | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* nir: Embed the shader_info in the nir_shader againJason Ekstrand2017-05-092-31/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit e1af20f18a86f52a9640faf2d4ff8a71b0a4fa9b changed the shader_info from being embedded into being just a pointer. The idea was that sharing the shader_info between NIR and GLSL would be easier if it were a pointer pointing to the same shader_info struct. This, however, has caused a few problems: 1) There are many things which generate NIR without GLSL. This means we have to support both NIR shaders which come from GLSL and ones that don't and need to have an info elsewhere. 2) The solution to (1) raises all sorts of ownership issues which have to be resolved with ralloc_parent checks. 3) Ever since 00620782c92100d77c660f9783504c6d80fa1d58, we've been using nir_gather_info to fill out the final shader_info. Thanks to cloning and the above ownership issues, the nir_shader::info may not point back to the gl_shader anymore and so we have to do a copy of the shader_info from NIR back to GLSL anyway. All of these issues go away if we just embed the shader_info in the nir_shader. There's a little downside of having to copy it back after calling nir_gather_info but, as explained above, we have to do that anyway. Acked-by: Timothy Arceri <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* spirv: Add support for SPV_KHR_multiviewJason Ekstrand2017-05-033-0/+9
| | | | | Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* spirv: Bump the SPIR-V header to the latest public versionJason Ekstrand2017-05-031-3/+31
| | | | | Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* spirv: consistently use ifndef guards over pragma onceEmil Velikov2017-03-223-2/+10
| | | | | | | Signed-off-by: Emil Velikov <[email protected]> Acked-by: Vedran Miletić <[email protected]> Acked-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* spirv: Implement IsInf using an integer comparisonJason Ekstrand2017-03-201-1/+1
| | | | | | | | | | | Since we already do fabs on the one source, we're guaranteed to get positive infinity if we get any infinity at all. Since +inf only has one IEEE 754 representation, we can use an integer comparison and avoid all of the ordered/unordered issues. Cc: Dave Airlie <[email protected]> Reviewed-by: Elie Tournier <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* nir: Make image_size a variable-width intrinsicJason Ekstrand2017-03-141-7/+11
| | | | | | Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Restrict the number of channels in texture coordinatesJason Ekstrand2017-03-141-1/+2
| | | | | | | | | Some SPIR-V texturing instructions pack more than the texture coordinate into the coordinate source. We need to mask off the unused channels. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* spirv: Silence unused variable warnings in release modeJason Ekstrand2017-03-071-0/+1
| | | | Reviewed-by: Jordan Justen <[email protected]>
* spirv: Use nir_builder for control flowJason Ekstrand2017-03-011-31/+14
| | | | Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* nir: Combine the int and double [un]pack opcodesJason Ekstrand2017-02-161-2/+2
| | | | | | | NIR is a typeless IR and the two opcodes, when considered bitwise, do exactly the same thing. There's no reason to have two versions. Reviewed-by: Kenneth Graunke <[email protected]>