Commit Graph

1548 Commits

Author SHA1 Message Date
Connor McLaughlin
1dd676c1de MSL: Emit wrapper for SSign (sign() for int types)
Metal does not define the sign() function for integer types, only
floating-point types.
2018-11-08 13:08:34 +10:00
Hans-Kristian Arntzen
cf5e1c2801
Merge pull request #743 from cdavis5e/relaxed-block-layout
MSL: Also pack members at unaligned offsets.
2018-11-07 19:38:56 +01:00
Hans-Kristian Arntzen
28a7583cfa
Merge pull request #741 from stenzek/msl-early-fragment-tests
MSL: Print early_fragment_tests specifier before fragment
2018-11-07 19:32:37 +01:00
Chip Davis
e50eecfeeb MSL: Also pack members at unaligned offsets.
This is necessary to support `VK_KHR_relaxed_block_layout`.
2018-11-07 09:42:54 -06:00
Connor McLaughlin
801431b45b MSL: Print early_fragment_tests specifier before fragment
The compiler in 10.14 reports an error that the attribute cannot be
applied to types if the specifier is printed before fragment.
2018-11-07 21:54:19 +10:00
Hans-Kristian Arntzen
daaffc4717
Merge pull request #738 from cdavis5e/shader-small-storage
Add support for 8- and 16-bit types to GLSL and MSL.
2018-11-06 19:58:44 +01:00
Chip Davis
0d949e11ff Support bitcasts of 16-bit types. 2018-11-05 14:56:36 -06:00
Chip Davis
ca4744ab72 Support constants of 16-bit integral type in GLSL and MSL.
Constants of 8-bit type aren't supported in GLSL, since there's no
extension letting you use them.
2018-11-02 14:39:55 -05:00
Chip Davis
117ccf407c Use specific base types for 8- and 16-bit integers. 2018-11-01 17:45:10 -05:00
Chip Davis
1fb27b4cda Add support for 8- and 16-bit types to GLSL and MSL.
In GLSL, 8-bit types require GL_EXT_shader_8bit_storage. 16-bit types
can use either GL_AMD_gpu_shader_int16/GL_AMD_gpu_shader_half_float or
GL_EXT_shader_16bit_storage.
2018-11-01 10:20:57 -05:00
Hans-Kristian Arntzen
13633c0500
Merge pull request #737 from KhronosGroup/fix-724
Deal with OpSpecConstantOp used as array size.
2018-11-01 15:26:19 +01:00
Hans-Kristian Arntzen
480acdad18 Deal with OpSpecConstantOp used as array size.
When trying to validate buffer sizes, we usually need to bail out when
using SpecConstantOps, but for some very specific cases where we allow
unsized arrays currently, we can safely allow "unknown" sized arrays as
well.

This is probably the best we can do, when we have even more difficult
cases than this, we throw a more sensible error message.
2018-11-01 14:58:02 +01:00
Hans-Kristian Arntzen
37dbdf14fa
Merge pull request #736 from KhronosGroup/spec-constant-macro-hlsl-msl
Add spec constant macro support to HLSL/MSL as well
2018-11-01 13:24:05 +01:00
Hans-Kristian Arntzen
00d542ed44 Minor nit, set emitted when emitting spec constant op in HLSL. 2018-11-01 11:49:32 +01:00
Hans-Kristian Arntzen
6e99fcf695 Run format_all.sh. 2018-11-01 11:23:48 +01:00
Hans-Kristian Arntzen
d4ad1e266a Add test case for local_size_x_id and some complex cases. 2018-11-01 11:23:48 +01:00
Hans-Kristian Arntzen
62db535b3f Update tests. 2018-11-01 11:23:48 +01:00
Hans-Kristian Arntzen
fd6ff3617a Support macro overrides for spec constants in HLSL. 2018-11-01 11:23:48 +01:00
Hans-Kristian Arntzen
fdfa7b0880
Merge pull request #733 from nicebyte/spec-const-glsl
Alter the handling of spec consts in non-Vulkan GLSL
2018-11-01 10:32:19 +01:00
Grigory Dzhavadyan
a5d82d1138 Alter the handling of spec consts in non-Vulkan GLSL
Previously, when generating non-Vulkan GLSL, each use of a spec constant
would be subsituted for its default value and the declaration of the constant
itself would be omitted completely.

This change slightly alters this behavior. The uses of the constant are kept,
as well as the declaration, although the latter is stripped of the layout
qualifier. The declaration is also prepended with the following code:

    #ifndef <constant name>_value
    #define <constant name> <default constant value>
    #endif

and the constant itself now looks like

    const <constant type> <constant name> = <constant name>_value;

The rationale for this change is that it gives the user a way to provide
custom values for specialization constants even when the target does not
support them.
2018-11-01 00:39:09 -07:00
Hans-Kristian Arntzen
dfd1bf8c56
Merge pull request #734 from zeux/master
Fix Options::force_temporary to work with OpenGL GLSL
2018-10-30 21:18:51 +01:00
Arseny Kapoulkine
7f055e8a68 Fix Options::force_temporary to work with OpenGL GLSL
Setting force_temporary to true produces invalid GLSL because sampler
variables are copied:

    highp sampler2D _377 = DiffuseMapTexture;

This change fixes the problem by always forwarding forwardable
variables. I also took an opportunity to restructure the code to make
it easier to read and add extra conditions to in the future.
2018-10-30 10:49:18 -07:00
Hans-Kristian Arntzen
236df43689 Try release build for Travis. 2018-10-27 14:02:09 +02:00
Hans-Kristian Arntzen
a89ab694e1
Merge pull request #732 from KhronosGroup/travis-release-build
Try release build for Travis.
2018-10-27 14:00:46 +02:00
Hans-Kristian Arntzen
6570038860 Try release build for Travis. 2018-10-27 12:26:35 +02:00
Hans-Kristian Arntzen
76d6238315
Merge pull request #731 from KhronosGroup/travis-windows
Add Windows support in Travis CI
2018-10-27 01:45:10 +02:00
Hans-Kristian Arntzen
6157bf3cae Add Windows support in Travis CI.
- Add new Windows support
- Use CMake/CTest instead of Make + shell scripts
- Use --parallel in CTest
- Fix CTest on Windows
- Cleanups in test_shaders.py
- Force specific commit for SPIRV-Headers
- Fix Inf/NaN odd-ball case by moving to ASM
2018-10-27 00:22:30 +02:00
Hans-Kristian Arntzen
bfeb388edf
Merge pull request #729 from KhronosGroup/fix-728
HLSL: Use same logic as GLSL for picking cbuffer block name.
2018-10-23 09:10:55 +02:00
Hans-Kristian Arntzen
226d837d7e HLSL: Use same logic as GLSL for picking cbuffer block name.
HLSL just picked the variable name which did not work as expected for
some users. Use the same logic as GLSL and set up declared_block_names,
so the actual name can be queried later.
2018-10-22 09:50:04 +02:00
Hans-Kristian Arntzen
a8e5a0bb9c
Merge pull request #722 from KhronosGroup/parser-refactor
Hoist out parsing module from spirv_cross::Compiler
2018-10-19 12:50:12 +02:00
Hans-Kristian Arntzen
5bcf02f7c9 Hoist out parsing module from spirv_cross::Compiler.
This is a large refactor which splits out the SPIR-V parser from
Compiler and moves it into its more appropriately named Parser module.

The Parser is responsible for building a ParsedIR structure which is
then consumed by one or more compilers.

Compiler can take a ParsedIR by value or move reference. This should
allow for optimal case for both multiple compilations and single
compilation scenarios.
2018-10-19 12:01:31 +02:00
Khronos Group Webmaster
cc5c0204d8
Create CODE_OF_CONDUCT.md 2018-10-10 15:52:21 -04:00
Hans-Kristian Arntzen
d2928bda70
Merge pull request #721 from KhronosGroup/fix-720
Refactor MSL to use SPIRCombinedImageSampler.
2018-10-05 10:10:49 +02:00
Hans-Kristian Arntzen
a697299bc1 Refactor MSL to use SPIRCombinedImageSampler.
Avoids special "meta" data to express this type.
Makes MSL implementation in line with HLSL.
2018-10-05 09:49:57 +02:00
Hans-Kristian Arntzen
519565b030
Merge pull request #718 from cdavis5e/op-image-sampled-image
MSL: Handle OpImage on OpSampledImage expressions.
2018-10-04 21:30:08 +02:00
Hans-Kristian Arntzen
3c512d04b5
Merge pull request #717 from cdavis5e/depth-gather-swizzle
MSL: Swizzle gathers on depth textures as well.
2018-10-04 18:36:59 +02:00
Chip Davis
47089a48a0 Make the test case a lot simpler. 2018-10-04 11:26:46 -05:00
Chip Davis
9919fbbe0d MSL: Handle OpImage on OpSampledImage expressions.
I have seen this happen. The included test case is one such case.
2018-10-03 11:48:46 -05:00
Chip Davis
010fecc466 MSL: Swizzle gathers on depth textures as well.
Might as well.
2018-10-03 11:47:13 -05:00
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