Commit Graph

1509 Commits

Author SHA1 Message Date
Khronos Group Webmaster
1373e7613d
Revert LICENSE to Apache 2.0 2018-10-03 10:11:06 -04:00
Khronos Group Webmaster
793845139e
Update LICENSE
Change Apache 2.0 to Khronos Apache 2.0 CLA
2018-09-27 16:37:12 -04:00
Hans-Kristian Arntzen
c9210427b9
Merge pull request #713 from cdavis5e/resource-arrays-msl
MSL: Expand arrays of buffers passed as input.
2018-09-27 19:57:55 +02:00
Chip Davis
b7433c01ee Minor cleanups.
Throw an error for cases we don't support. Add a blank line after each
local array declaration.
2018-09-27 11:01:46 -05:00
Chip Davis
2506046cb4 Merge remote-tracking branch 'origin' into resource-arrays-msl 2018-09-27 10:50:16 -05:00
Hans-Kristian Arntzen
e0fb64bfe7
Merge pull request #715 from KhronosGroup/fix-709
Use GL_EXT_samplerless_texture_functions in Vulkan GLSL.
2018-09-27 14:05:55 +02:00
Hans-Kristian Arntzen
c07c303999 Use GL_EXT_samplerless_texture_functions in Vulkan GLSL. 2018-09-27 13:36:38 +02:00
Hans-Kristian Arntzen
44ed66426b
Merge pull request #714 from KhronosGroup/update-glslang-spirv-tools
Update glslang and SPIRV-Tools.
2018-09-27 11:53:56 +02:00
Hans-Kristian Arntzen
af75ef005f Update glslang and SPIRV-Tools.
A lot of changes in spirv-opt output.
Some new invalid SPIR-V was found but most of them were not significant
for SPIRV-Cross, so just marked them as invalid.
2018-09-27 11:10:22 +02:00
Chip Davis
3a9af9681c MSL: Expand arrays of buffers passed as input.
Even as of Metal 2.1, MSL still doesn't support arrays of buffers
directly. Therefore, we must manually expand them. In the prologue, we
define arrays holding the argument pointers; these arrays are what the
transpiled code ends up referencing. We might be able to do similar
things for textures and samplers prior to MSL 2.0.

Speaking of which, also enable texture arrays on iOS MSL 1.2.
2018-09-26 20:48:09 -05:00
Hans-Kristian Arntzen
69b034f26e
Merge pull request #706 from cdavis5e/component-swizzle
MSL: Add an option to insert texture swizzles into generated shaders.
2018-09-25 10:06:03 +02:00
Chip Davis
7107f40f99 Provide feedback on whether or not the auxiliary buffer is needed. 2018-09-24 13:38:27 -05:00
Chip Davis
7956b002eb Give up on non-aliased sampled image parameters.
This needs extra work to map them back to the original resource.
2018-09-24 12:42:39 -05:00
Chip Davis
db7a40ce77 Use is_sampled_image_type() elsewhere. 2018-09-24 12:33:11 -05:00
Chip Davis
8855ea0a3e Move is_sampled_image_type() onto the Compiler class.
While I'm at it, don't use a bitwise op with a `bool` variable.
Apparently, MSVC doesn't like that.
2018-09-24 12:24:58 -05:00
Chip Davis
c11374c3cf Don't override Compiler::analyze_image_and_sampler_usage().
Just add our own separate function for analyzing sampled image usage.
2018-09-24 12:10:27 -05:00
Hans-Kristian Arntzen
34014886e3
Merge pull request #710 from cdavis5e/buffer-image-reads
MSL: Add spvTexelBufferCoord for buffer image reads, too.
2018-09-24 10:22:15 +02:00
Chip Davis
7cb817e40e Add spvTexelBufferCoord for buffer image reads, too.
I should've caught this when I fixed this for writes.
2018-09-23 14:37:03 -05:00
Chip Davis
4302c5abfb Pass the swizzle constants as a buffer.
It'll be useful to have an "auxiliary buffer" for other builtins--e.g.
`DrawIndex` (which should be easier to implement now), or `ViewIndex`
when someone gets around to implementing multiview.

Pass this buffer to leaf functions as well.

Test that we handle this for integer textures as well.
2018-09-22 19:36:11 -05:00
Chip Davis
c793868417 Pack texture component swizzles by bytes. 2018-09-22 19:15:15 -05:00
Chip Davis
7fff65a811 Remove extraneous space in enum class decl. 2018-09-21 13:52:20 -05:00
Hans-Kristian Arntzen
2d6ce39bda
Merge pull request #708 from billhollings/master
Fix integer precision warnings on assignments.
2018-09-21 09:31:19 +02:00
Bill Hollings
daa831f59d Fix integer precision warnings on assignments. 2018-09-20 16:10:42 -04:00
Chip Davis
2583321657 MSL: Add an option to insert texture swizzles into generated shaders.
It's intended to be used with MoltenVK to support arbitrary
`VkComponentMapping` settings. The idea is that MoltenVK will pass a
buffer (which it set to some buffer index that isn't being used)
containing packed versions of the `VkComponentMapping` struct, one for
each sampled image.

Yes, this is horribly ugly. It is unfortunately necessary. Much of the
ugliness is to support swizzling gather operations, where we need to
alter the component that the gather operates on--something complicated
by the `gather()` method requiring the passed-in component to be a
constant expression. It doesn't even support swizzling gathers on depth
textures, though I could add that if it turns out we need it.
2018-09-19 22:32:24 -05:00
Hans-Kristian Arntzen
f22de1f2f1
Merge pull request #705 from cdavis5e/msl-viewport-index
MSL: Handle the ViewportIndex builtin.
2018-09-19 16:33:05 +02:00
Chip Davis
ec857f6778 Cast uses of Layer and ViewportIndex to the expected type. 2018-09-19 09:13:30 -05:00
Chip Davis
0e9ad14ba6 MSL: Handle the ViewportIndex builtin.
This requires MSL 2.0+.

Also, force `ViewportIndex` and `Layer` to be defined as the correct
type, which is always `uint` in MSL.

Since Metal doesn't yet have geometry shaders, the vertex shader (or
tessellation evaluation shader == "post-tessellation vertex shader" in
Metal jargon) is the only kind of shader that can set this output. This
currently requires an extension to Vulkan, which causes validation of
the SPIR-V binaries for the test cases to fail. Therefore, the test
cases are marked "invalid", even though they're actually perfectly valid
SPIR-V--they just won't work without the
`SPV_EXT_shader_viewport_index_layer` extension.
2018-09-18 09:52:30 -05:00
Hans-Kristian Arntzen
bfbe36f636
Merge pull request #704 from KhronosGroup/fix-702
Fix edge case where switch case blocks can break out of loops
2018-09-18 11:19:32 +02:00
Hans-Kristian Arntzen
a985ac9499 Add test case for continue out of switch default block. 2018-09-18 11:01:15 +02:00
Hans-Kristian Arntzen
de365f2e21 Merge branch 'master' of git://github.com/lifpan/SPIRV-Cross 2018-09-18 10:52:26 +02:00
Hans-Kristian Arntzen
3b5968bb26 Deal with switch cases which break out of a loop.
Need some pretty hideous ladder variable system, but high level
languages do not support breaking out of a loop. break in switch blocks
and break in loops alias each other.
2018-09-18 10:50:48 +02:00
lifpan
e4d8ef2044 Propagate loop dominator to switch-default block
This is necessary if OpSwitch is inside a loop.
2018-09-18 15:53:02 +08:00
Hans-Kristian Arntzen
439602dc6c Add missing reference files. 2018-09-18 09:32:53 +02:00
Hans-Kristian Arntzen
ecc4da4cd5
Merge pull request #699 from cdavis5e/msl-sample-pos
MSL: Handle the SamplePosition builtin.
2018-09-18 09:23:31 +02:00
Chip Davis
7dcfed888a Use a hook to emit a local for the sample position.
That way, we don't have to handle it specially when constructing a call.
2018-09-17 11:51:09 -05:00
Chip Davis
72fc1cce53 Merge remote-tracking branch 'origin' into msl-sample-pos 2018-09-17 11:20:34 -05:00
Hans-Kristian Arntzen
c602580027
Merge pull request #701 from KhronosGroup/fix-697
Implement atomic increment/decrement in GLSL and HLSL.
2018-09-17 16:23:41 +02:00
Hans-Kristian Arntzen
737715214e Implement atomic increment/decrement in GLSL and HLSL. 2018-09-17 15:54:21 +02:00
Hans-Kristian Arntzen
a77880787d
Merge pull request #698 from KhronosGroup/fix-695
MSL: Support global I/O block and struct Input/Output usage.
2018-09-17 14:54:58 +02:00
Hans-Kristian Arntzen
340957a3ab Make fixup_hooks more flexible.
No reason why it needs to return a string.
Callbacks can just do one or more statements themselves.
2018-09-17 14:06:44 +02:00
Hans-Kristian Arntzen
4aead55ca6 Remove dead comment. 2018-09-17 13:58:48 +02:00
Hans-Kristian Arntzen
49ac538a64 Remove maybe_assign_input_struct.
This is obsolete and wrong since we already unflatten I/O structs.
2018-09-17 13:51:02 +02:00
Chip Davis
39bc101e82 MSL: Handle the SamplePosition builtin.
This is somewhat tricky, because in MSL this value is obtained through a
function, `get_sample_position()`. Since the call expression is an
rvalue, it can't be passed by reference, so functions get a copy
instead.

This was the last piece preventing us from turning on sample-rate
shading support in MoltenVK.
2018-09-13 09:34:28 -05:00
Hans-Kristian Arntzen
1bbb4032c8
Merge pull request #693 from cdavis5e/msl-atomic-inc-dec
MSL: Fix OpAtomicIIncrement and OpAtomicIDecrement.
2018-09-13 16:19:27 +02:00
Hans-Kristian Arntzen
d310060f92 MSL: Support global I/O block and struct Input/Output usage.
Implement this by flattening outputs and unflattening inputs explicitly.
This allows us to pass down a single struct instead of dealing with the
insanity that would be passing down each flattened member separately.

Remove stage_uniforms_var_id.
Seems to be dead code. Naked uniforms do not exist in SPIR-V for Vulkan,
which this seems to have been intended for. It was also unused elsewhere.
2018-09-13 16:04:24 +02:00
Chip Davis
06edf804ac Clarify name of this parameter. 2018-09-13 08:56:23 -05:00
Hans-Kristian Arntzen
6bae609e23
Merge pull request #696 from KhronosGroup/fix-694
MSL: textureQueryLod() is not supported.
2018-09-13 13:41:48 +02:00
Hans-Kristian Arntzen
71bb7785ac MSL: textureQueryLod() is not supported.
Don't bother with hacky workaround unless required.
2018-09-13 13:44:46 +02:00
Chip Davis
986345c754 Fix tests for changes to my last patch. 2018-09-12 09:43:12 -05:00
Hans-Kristian Arntzen
c029b0a531
Merge pull request #691 from KhronosGroup/fix-689
MSL: Support copying array of arrays.
2018-09-12 10:53:12 +02:00