Commit Graph

66 Commits

Author SHA1 Message Date
Jason Ekstrand 7e5e64c8a9 nir/spirv: Make vectors a proper array time with an array_element
This makes dealing with single-component derefs easier
2016-01-21 16:20:39 -08:00
Jason Ekstrand b298743d7b nir/spirv: Add an actual variable struct to spirv_to_nir
This allows us, among other things, to do structure splitting on-the-fly to
more correctly handle input/output structs.
2016-01-21 16:20:39 -08:00
Jason Ekstrand 2892693d56 nir/spirv: Split variable handling out into its own file
It's 1300 lines all by itself and it will only grow.
2016-01-21 16:20:39 -08:00
Jason Ekstrand 1112bf633f nir/spirv: Rework access chains
Previously, we were creating nir_deref's immediately.  Now, instead, we
have an intermediate vtn_access_chain structure.  While a little more
awkward initially, this will allow us to more easily do structure splitting
on-the-fly.
2016-01-21 16:18:37 -08:00
Kristian Høgsberg Kristensen c5490d0277 vk: Fix indirect push constants
This currently sets the base and size of all push constants to the
entire push constant block. The idea is that we'll use the base and size
to eventually optimize the amount we actually push, but for now we don't
do that.
2016-01-21 11:10:11 -08:00
Jordan Justen b1a7a27d60 nir/spirv: Handle compute shared atomics
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-01-21 00:31:29 -08:00
Jordan Justen a7e5b683ca nir/spirv: Support workgroup (shared) variable translation
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-01-21 00:31:29 -08:00
Jason Ekstrand 34f9a5f301 nir/spirv: Pull texture dimensionality out of the image when available 2016-01-20 11:11:30 -08:00
Jason Ekstrand c7203aa621 nir/spirv: Move OpPhi handling to vtn_cfg.c
Phi handling is somewhat intrinsically tied to the CFG.  Moving it here
makes it a bit easier to handle that.  In particular, we can now do SSA
repair after we've done the phi node second-pass.  This fixes 6 CTS tests.
2016-01-19 19:00:00 -08:00
Jason Ekstrand 891564adb9 nir/spirv: Handle OpLine and OpNoLine in foreach_instruction
This way we don't have to explicitly handle them everywhere.
2016-01-19 19:00:00 -08:00
Jason Ekstrand c2a6f4302e nir/spirv: Patch through image qualifiers 2016-01-18 17:21:05 -08:00
Jason Ekstrand 56c8a5f2b8 nir/spirv: Implement ImageQuerySize for storage iamges
SPIR-V only has one ImageQuerySize opcode that has to work for both
textures and storage images.  Therefore, we have to special-case that one a
bit and look at the type of the incoming image handle.
2016-01-18 17:21:05 -08:00
Jason Ekstrand bb8cadd169 nir/spirv: Insert movs around image intrinsics
Image intrinsics always take a vec4 coordinate and always return a vec4.
This simplifies the intrinsics a but but also means that they don't
actually match the incomming SPIR-V.  In order to compensate for this, we
add swizzling movs for both source and destination to get the right number
of components.
2016-01-18 17:21:05 -08:00
Jason Ekstrand 117cac75d0 nir/spirv: Stop trusting the SPIR-V for the number of texture coordinates 2016-01-15 11:13:51 -08:00
Jason Ekstrand 6483d3f8fe nir/spirv: Fix texture return types
We were just hard-coding everything to a vec4.  This meant we weren't
handling shadow samplers at all and integer things were getting the wrong
return type.
2016-01-14 18:48:57 -08:00
Jason Ekstrand f46f4e4886 nir/spirv: Add initial support for Vertex/Instance index 2016-01-14 09:12:32 -08:00
Jordan Justen 8ce2b0e140 nir/spirv: Add support for ArrayLength op
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-01-13 23:34:45 -08:00
Jason Ekstrand 0079523a0d nir/spirv: Add support for OpSpecConstantOp 2016-01-13 15:18:36 -08:00
Jason Ekstrand c95c3b2c21 nir/spirv: Add initial support for specialization constants 2016-01-13 15:18:36 -08:00
Jason Ekstrand 610aa00cdf nir/spirv: Add support for OpQuantize 2016-01-12 15:36:38 -08:00
Kristian Høgsberg Kristensen 7df20f0c14 vk: Support SpvBuiltInViewportIndex 2016-01-12 10:53:59 -08:00
Jason Ekstrand 62e56492c3 nir/spirv: Allow non-block variables with interface types in lists
The original objective was to disallow UBO and SSBO variables from the
variable lists.  This was accidentally broken in b208620fd when fixing some
other interface issues.
2016-01-12 01:32:19 -08:00
Jason Ekstrand 4141d13de5 nir/spirv: Handle matrix decorations on arrays of matrices
Connor's original shallow-copy plan works great except that a couple of the
decorations apply to a matrix which may be some levels down in an array.
We weren't properly unpacking that.  This fixes most of the remaining SSBO
and UBO layout tests.
2016-01-12 01:04:44 -08:00
Jason Ekstrand b208620fd2 nir/spirv: Allow creating local/global variables from interface types
Not sure if this is actually allowed, but it's not that hard to just strip
the interface information from the type.
2016-01-11 17:45:54 -08:00
Jason Ekstrand 350bbd3d15 nir/spirv: Allow base derefs in get_vulkan_resource_index 2016-01-11 17:45:24 -08:00
Jason Ekstrand dee09d7393 nir/spirv: Better handle OpCopyMemory 2016-01-11 16:29:38 -08:00
Jason Ekstrand 1ca97cefb0 nir/spirv: Add no-op support for OpSourceContinued 2016-01-11 16:06:11 -08:00
Jason Ekstrand c974b94578 nir/spirv: Properly handle OpConstantNull 2016-01-11 14:30:46 -08:00
Jason Ekstrand 96683065f2 nir/spirv: Assert that matrix types are valid 2016-01-11 14:30:46 -08:00
Jason Ekstrand 17cfafd83a nir/spirv: Handle OpNoLine 2016-01-11 14:30:46 -08:00
Jason Ekstrand 790565b06e anv/pipeline: Handle output lowering in anv_pipeline instead of spirv_to_nir
While we're at it, we delete any unused variables.  This allows us to prune
variables that are not used in the current stage from the shader.
2016-01-11 11:06:06 -08:00
Jason Ekstrand 30883adfb8 nir/spirv: Get rid of a bunch of stage asserts
Since we may have multiple entrypoints from different stages, we don't know
what stage we are actually in so these asserts are invalid.
2016-01-11 11:06:06 -08:00
Jason Ekstrand 9f4ba499d1 nir/spirv: Take an entrypoint stage as well as a name 2016-01-11 11:06:06 -08:00
Jason Ekstrand 4e15d26e47 nir/spirv: Fix a small bug in row-major matrix loading 2016-01-08 12:27:25 -08:00
Jason Ekstrand fe2f44f2a4 nir/spirv: Use create_ssa_value for block_load_store 2016-01-08 11:50:34 -08:00
Jason Ekstrand 393562f47b nir/spirv: Split ALU operations out into their own file 2016-01-08 11:26:43 -08:00
Jason Ekstrand 72bff62e7f nir/spirv: Add support for SSBO atomics 2016-01-07 22:13:46 -08:00
Jason Ekstrand fe57ad62a6 nir/spirv: Rework UBOs and SSBOs
This completely reworks all block load/store operations.  In particular, it
should get row-major matrices working.
2016-01-07 22:13:46 -08:00
Jason Ekstrand 195c60deb4 nir/spirv: Wrap borrow/carry ops in b2i
NIR specifies them as booleans but SPIR-V wants ints.
2016-01-06 17:13:06 -08:00
Jason Ekstrand 71a25a0b07 nir/spirv: Simplify phi node handling
Instead of trying to crawl through predecessor chains and build phi nodes,
we just do a poor-man's out-of-ssa on the spot.  The into-SSA pass will
deal with putting the actual phi nodes in for us.
2016-01-05 14:59:40 -08:00
Jason Ekstrand 8b403d599b nir/spirv: Add support for the ControlBarrier instruction 2016-01-04 22:08:24 -08:00
Jason Ekstrand b8f0bea07a nir/spirv: Implement extended add, sub, and mul 2016-01-04 20:59:16 -08:00
Jason Ekstrand 3a3c4aecf1 nir/spirv: Add support for bitfield operations 2016-01-04 17:37:10 -08:00
Jason Ekstrand f32370a536 nir/spirv: Add a documenting assert for OpConstantSampler 2016-01-04 17:37:10 -08:00
Jason Ekstrand 0309199802 nir/spirv: Add initial support for ConstantNull 2016-01-04 17:37:10 -08:00
Jason Ekstrand f6c4658cde nir/spirv: Fix group decorations
They were completely bogus before.  For one thing, OpDecorationGroup
created a value of type undef rather than decoration_group.  Also
OpGroupMemberDecorate didn't properly apply the decoration to the different
members of the different groups.  It *should* be correct now but there's no
good way to test it yet.
2016-01-02 11:53:36 -08:00
Jason Ekstrand 1ddcbbf05f nir/spirv: Add a missing break statement in handle_image 2015-12-30 21:57:04 -08:00
Jason Ekstrand 0bb103d010 nir/spirv: Handle push constants after decorations 2015-12-30 20:54:27 -08:00
Jason Ekstrand cf6ce424e0 nir/spirv: Fix constant num_elements and allocation
Thanks to the addition of nir_clone, we now have a num_elements field in
nir_constant which we weren't setting.  Also, constants have to be parented
to the variable they initialize, so we have to make a copy.
2015-12-30 18:51:59 -08:00
Jason Ekstrand 5afac62b28 nir/spirv: Handle OpLine 2015-12-30 17:45:43 -08:00