Commit Graph

63 Commits

Author SHA1 Message Date
Jason Ekstrand ee8c67abe8 nir/spirv: Add support for builtins in arrays 2015-10-22 17:58:20 -07:00
Jason Ekstrand 9fe907ec79 nir/spirv: Make the builtins array distinguish between in and out 2015-10-22 17:54:24 -07:00
Jason Ekstrand d11ea76168 nir/spirv: Make vtn_get_builtin_location smarter
Instead of just stomping on the mode, it now validates asserts that the
previously set mode is correct and only changes it if needed.  We need to
do this because, in geometry shaders, there are some builtins that can be
either an input or an output depending on context.  We can get that
information from the SPIR-V source but we can't throw it away.
2015-10-22 17:45:41 -07:00
Jason Ekstrand 9abef3e817 nir/spirv: Make get_builtin_variable take a nir_variable_mode
We'll want this in a moment for validation but, for now, it just gets
stompped by get_builtin_variable.
2015-10-22 17:28:25 -07:00
Jason Ekstrand 2ce6636c75 nir/spirv: Remove the vtn_type argument from _vtn_variable_load/store
Now that builtins are handled in deref chains, we don't really need this
anymore.
2015-10-22 16:56:42 -07:00
Jason Ekstrand 0329a252bd nir/spirv: Add defaults for GS input/output primitive types
These are supposed to be specified in the SPIR-V source as SpvExecutionMode
enums but glslang isn't giving them to us.  A bug has been filed:

https://github.com/KhronosGroup/glslang/issues/84
2015-10-21 21:46:22 -07:00
Jason Ekstrand ea23cb3543 nir/spirv: Add capabilities and decorations for basic geometry shaders 2015-10-21 20:36:25 -07:00
Jason Ekstrand 164abff0c0 nir/spirv: Add support for more CS system values 2015-10-21 18:39:06 -07:00
Jason Ekstrand 5790ee2bbb nir/spirv: Add support for various barrier type instructions 2015-10-21 18:17:11 -07:00
Jason Ekstrand 3d35e4361f Fix a couple of dereferences 2015-10-21 18:16:50 -07:00
Jason Ekstrand 55a7ee730c spirv/nir: Add more stage asserts 2015-10-21 18:00:05 -07:00
Jason Ekstrand 27393c8630 nir/spirv: Add support for GS metadata 2015-10-21 17:58:34 -07:00
Jason Ekstrand 59bae36ffb nir/spirv: Fix a typo 2015-10-20 15:35:13 -07:00
Jason Ekstrand 44b22ca441 nir/spirv: Handle SpvExecutionMode 2015-10-20 15:23:56 -07:00
Jason Ekstrand 12c30c9498 nir/spirv: Use the new nir_variable helpers 2015-10-19 16:08:23 -07:00
Jason Ekstrand 7e6959402d nir/spirv: Handle builtins in OpAccessChain
Previously, we were trying to handle them later when loading.  However, at
that point, you've already lost information and it's harder to handle
certain corner-cases.  In particular, if you have a shader that does

gl_PerVertex.gl_Position.x = foo

we have trouble because we see the .x and we don't know that we're in
gl_Position.  If we, instead, handle it in OpAccessChain, we have all the
information we need and we can silently re-direct it to the appropreate
variable.  This also lets us delete some code which is a nice side-effect.
2015-10-19 15:50:45 -07:00
Jason Ekstrand 8ed23654c9 nir/spirv: Fix handling of vector component selects via OpAccessChain
When we get to the end of the _vtn_load/store_varaible recursion, we may
have one link left in the deref chain if there is a vector component select
on the end.  In this case, we need to truncate the deref chain early so
that, when we make the copy for the load, we don't get the extra deref.
The final deref will be handled by the vector extract/insert that comes
later.
2015-10-15 21:18:57 -07:00
Jason Ekstrand de608153fb nir/spirv: Use the Vulkan ubo intrinsics 2015-10-14 18:38:33 -07:00
Jason Ekstrand d2d8945eb8 nir/spirv: Fix a bug in indirect OpAccessChain handling 2015-10-13 20:00:18 -07:00
Jason Ekstrand c272bb58f5 nir/spirv: Better texture handling 2015-10-06 15:10:45 -07:00
Jason Ekstrand ccea9cc332 nir/spirv: Update to SPIR-V Rev. 32 2015-10-06 14:52:35 -07:00
Jason Ekstrand f406b708a5 Merge branch 'nir-spirv' into vulkan 2015-09-17 20:03:40 -07:00
Jason Ekstrand 616db92b01 nir/spirv: Add better location handling
Previously, our location handling was focussed on either no location
(usually implicit 0) or a builting.  Unfortunately, if you gave it a
location, it would blow it away and just not care.  This worked fine with
crucible and our meta shaders but didn't work with the CTS.  The new code
uses the "data.explicit_location" field to denote that it has a "final"
location (usually from a builtin) and, otherwise, the location is
considered to be relative to the base for that shader stage.
2015-09-17 20:02:46 -07:00
Jason Ekstrand 2f3de6260d Merge branch 'nir-spirv' into vulkan 2015-09-05 14:12:59 -07:00
Jason Ekstrand 612b13aeae nir/spirv: Add support for most of the rest of texturing
Assuming this all works, about the only thing left should be some
corner-cases for tg4
2015-09-05 14:10:05 -07:00
Jason Ekstrand fe786ff67d Merge branch 'nir-spirv' into vulkan 2015-09-05 13:17:53 -07:00
Jason Ekstrand 35fcd37fcf nir/spirv: Handle decorations after assigning variable locations 2015-09-05 13:17:21 -07:00
Jason Ekstrand 87d02f515b Merge branch 'nir-spirv' into vulkan 2015-09-05 09:48:33 -07:00
Jason Ekstrand 9be43ef99c nir/spirv: Handle the MatrixStride member decoration 2015-09-05 09:47:45 -07:00
Jason Ekstrand 9a95d08ed6 Merge branch 'nir-spirv' into vulkan 2015-09-04 18:54:15 -07:00
Jason Ekstrand 9e2c13350e nir/spirv: Add support for SpvDecorationColMajor 2015-09-04 18:50:14 -07:00
Jason Ekstrand 86c3476668 nir/spirv: Use VERTEX_ID_ZERO_BASE for VertexId
In Vulkan, VertexId and InstanceId will be zero-based and new intrinsics,
VertexIndex and InstanceIndex, will be added for non-zer-based.  See also,
Khronos bug #14255
2015-08-31 17:16:49 -07:00
Jason Ekstrand 22fdb2f855 nir/spirv: Update to the latest revision 2015-08-31 17:05:23 -07:00
Jason Ekstrand 756b00389c nir/spirv: Don't assert that the current block is empty
It's possible that someone will give us SPIR-V code in which someone
needlessly branches to new blocks.  We should handle that ok now.
2015-08-31 16:58:20 -07:00
Jason Ekstrand fe220ebd37 nir/spirv: Add initial support for samplers 2015-08-31 16:58:20 -07:00
Jason Ekstrand 62b094a81c nir/spirv: Handle jump-to-loop in a more general way 2015-08-31 16:58:20 -07:00
Jason Ekstrand ca51d926fd nir/spirv: Handle boolean uniforms correctly 2015-08-31 16:58:20 -07:00
Jason Ekstrand b6562bbc30 nir/spirv: Handle control-flow with loops 2015-08-31 16:58:20 -07:00
Jason Ekstrand 4a63761e1d nir/spirv: Set a name on temporary variables 2015-08-31 16:58:20 -07:00
Jason Ekstrand 6fc7911d15 nir/spirv: Use the correct length for copying string literals 2015-08-31 16:58:20 -07:00
Jason Ekstrand 9da6d808be nir/spirv: Make vtn_ssa_value handle constants as well as ssa values 2015-08-31 16:58:20 -07:00
Jason Ekstrand 1feeee9cf4 nir/spirv: Add initial support for GLSL 4.50 builtins 2015-08-31 16:58:20 -07:00
Jason Ekstrand 577c09fdad nir/spirv: Split the core datastructures into a header file 2015-08-31 16:58:20 -07:00
Jason Ekstrand 66fc7f252f nir/spirv: Use the builder for all instructions
We don't actually use it to create all the instructions but we do use it
for insertion always.  This should make things far more consistent for
implementing extended instructions.
2015-08-31 16:58:20 -07:00
Jason Ekstrand 9e03b6724c nir/spirv: Add support for a bunch of ALU operations 2015-08-31 16:58:20 -07:00
Jason Ekstrand 91b3b46d8b nir/spirv: Add support for indirect array accesses 2015-08-31 16:58:20 -07:00
Jason Ekstrand 9197e3b9fc nir/spirv: Explicitly type constants and SSA values 2015-08-31 16:58:20 -07:00
Jason Ekstrand b7904b8281 nir/spirv: Handle OpBranchConditional
We do control-flow handling as a two-step process.  The first step is to
walk the instructions list and record various information about blocks and
functions.  This is where the acutal nir_function_overload objects get
created.  We also record the start/stop instruction for each block.  Then
a second pass walks over each of the functions and over the blocks in each
function in a way that's NIR-friendly and actually parses the instructions.
2015-08-31 16:58:20 -07:00
Jason Ekstrand d216dcee94 nir/spirv: Add a helper for getting a value as an SSA value 2015-08-31 16:58:20 -07:00
Jason Ekstrand f36fabb736 nir/spirv: Split instruction handling into preamble and body sections 2015-08-31 16:58:20 -07:00