2204 Commits

Author SHA1 Message Date
Hai Nguyen
b8dfe1348a Vulkan rules relaxed for glslang C interface
- Added vulkan_rules_relaxed flag to glslang_input_t to turn on Vulkan
  rules relaxed during shader creation.
2021-11-30 04:55:25 -05:00
Hai Nguyen
febbeb4f83
Support for automap options and resource binding shift (#2834)
* Support for automap options

- Added glslang_shader_options_t with enums for auto map bindings and
  auto map locations.
- Added options param to glslang_shader_parse.
- Modified glslang_shader_parse to call appropriate auto map function if
  auto map bits are set.

* Refactored auto map for C interface

- Added glslang_shader_set_options to independently set options instead
  of being a param on an existing function.
- Added glslang_program_map_io to call mapIO so auto map location
  actually works.

* Added support for shifting resource bindings

- Added resource binding shift functions to match C++ interface

* Uncommented preprocessor call that was commented out for debugging
2021-11-29 14:23:01 -07:00
Rex Xu
6c1db7fd6c Fix validation failures of test cases regarding GL_EXT_spirv_intrinsics
1. The test cases of OpReadClockKHR is invalid. The return type is
   unsigned integer rather than signed integer.
2. When SPIR-V decorate or SPIR-V type is specified, we should avoid
   auto location mapping because the semantics are totally decided by
   SPIR-V tokens.
2021-11-25 16:24:37 +08:00
Greg Fischer
69f9dce708
Merge branch 'master' into GL_ARB_fragment_coord_conventions 2021-11-24 11:52:08 -07:00
Greg Fischer
a40e4ac3f7
Merge branch 'master' into textureQueryLOD 2021-11-22 10:39:03 -07:00
Greg Fischer
2c54c20813
Merge pull request #2782 from kevin-mccullough/FixIomapperSeperableShaderValidation
Fix issue with separable shader validation in iomapper
2021-11-19 15:19:27 -07:00
Greg Fischer
a0c7b6fe87
Merge pull request #2811 from mbechard/master
remove unneeded extra constructions now that pool allocation is fixed
2021-11-18 10:18:22 -07:00
Malcolm Bechard
eebb48f5fc remove unneeded extra constructions now that pool allocation is fixed 2021-11-17 18:11:10 -05:00
Kevin McCullough
cbab732905 Fix issue with separable shader validation in iomapper 2021-11-17 14:28:16 -08:00
Greg Fischer
74b0abb9cd
Merge pull request #2825 from greg-lunarg/i2244
Add --hlsl-dx-position-w option
2021-11-17 09:55:17 -07:00
Greg Fischer
e9564feb55 Add --hlsl-dx-position-w option
This reciprocates the w component of SV_Position in HLSL fragment shaders
to provide DirectX compatibility for HLSL shaders in Vulkan.

Fixes #2244
2021-11-16 18:42:12 -07:00
Kevin Athey
cd187e201a Initialize member TSymbol::uniqueId. 2021-11-15 16:33:08 -08:00
Greg Fischer
7141f89a89
Merge pull request #2806 from ZhiqianXia/bestFunctionMatching
#extension GL_ARB_gpu_shader5 support the implicit conversion ,
2021-11-15 13:28:53 -07:00
Greg Fischer
7d27f667a3
Merge pull request #2818 from mhillenbrand/promoteConstantUnion_signed_char
TIntermediate::promoteConstantUnion(): fix conversion to int8
2021-11-15 10:52:12 -07:00
Greg Fischer
f669f13998
Merge pull request #2819 from greg-lunarg/i2812
Fix struct type sharing
2021-11-12 19:16:35 -07:00
Greg Fischer
3074ec94bf
Merge pull request #2814 from mhillenbrand/isinf_isnan2
Use intermOut.cpp's IsNan and IsInfinity for parse-time constant folding (updated)
2021-11-12 17:38:11 -07:00
Greg Fischer
10be28ac9b Fix struct type sharing
Fixes #2812
2021-11-12 16:57:11 -07:00
Marius Hillenbrand
f1fa8afa25 TIntermediate::promoteConstantUnion(): fix conversion to int8
The signedness of type char is implementation-defined in C++. The
conversion to (signed) int8 currently uses a cast to char, which is
undefined for negative values when the type char is implemented as
unsigned. Thus, fix to cast to "signed char", which has the intended
semantic on all implementations.

Fixes #2807
2021-11-12 10:35:31 +01:00
Greg Fischer
1f8c8b88c7 Revert port of GL_EXT_shader_realtime_clock to GL_EXT_spirv_intrinsics
Could not be found by glslang library interface. Blocking SDK build.
2021-11-11 23:39:47 -07:00
Marius Hillenbrand
0eda343970 Use intermOut.cpp's IsNan and IsInfinity for parse-time constant folding (updated)
There were two implementations of isInf() and isNan(), in Constant.cpp
and in intermOut.cpp. The former only works on little-endian systems,
the latter is a wrapper for library functions and works regardless of
endianness. Move the second version into Common.h and adopt it in both
places. Thereby avoid the duplication and fix for big-endian systems.

A previous commit with the same intent and purpose had missed a required
header for builds on Windows.

On s390x, this fixes the test case
Glsl/CompileToAstTest.FromFile/constFold_frag.

Fixes #2802
2021-11-11 16:49:40 +01:00
Greg Fischer
600c5037ba
Merge pull request #2810 from greg-lunarg/push1
Generate error for binding on push_constant
2021-11-11 08:18:59 -07:00
Greg Fischer
002b3f55c7 Generate error for binding on push_constant 2021-11-10 15:15:43 -07:00
Greg Fischer
22a5e36446
Revert "Use intermOut.cpp's IsNan and IsInfinity for parse-time constant folding" 2021-11-10 14:13:37 -07:00
ZhiqianXia
50a6a51625 Support the #extension GL_ARB_fragment_coord_conventions.
Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
2021-11-10 10:41:40 +08:00
ZhiqianXia
77b0d72c68 #extension GL_ARB_gpu_shader5 support the implicit conversion ,
So the best function matching algorithm should be actived.


Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
2021-11-10 09:44:16 +08:00
Greg Fischer
bb5b357550
Merge pull request #2781 from kevin-mccullough/FixLinkTimeValidationForGl_PerVertex
Fix incorrect link time validation for unused gl_PerVertex members
2021-11-09 13:44:32 -07:00
Greg Fischer
627f409aec
Merge pull request #2801 from haasn/thread_safety
Thread safety fixes
2021-11-09 11:43:38 -07:00
Marius Hillenbrand
d1ee644e1d Use intermOut.cpp's IsNan and IsInfinity for parse-time constant folding
There were two implementations of isInf() and isNan(), in Constant.cpp
and in intermOut.cpp. The former only works on little-endian systems,
the latter is a wrapper for library functions and works regardless of
endianness. Move the second version into Common.h and adopt it in both
places. Thereby avoid the duplication and fix for big-endian systems.

On s390x, this fixes the test case
Glsl/CompileToAstTest.FromFile/constFold_frag.

Fixes #2802
2021-11-09 16:58:21 +01:00
Greg Fischer
8f56d73800
Merge pull request #2799 from cyanreg/master
Add support for targeting Vulkan 1.2 in the C API
2021-11-08 18:47:27 -07:00
Kevin McCullough
13fd2d6470 Fix incorrect link time validation for unused gl_PerVertex members 2021-11-08 15:23:02 -08:00
Niklas Haas
4302d51868 Don't release global mutex before initialize/finalize is done
Otherwise this can race with other threads for access to the fields it's
supposed to be initializing/finalizing.

For example, imagine another thread is calling ShInitialize() while the
first thread is calling ShFinalize() - the finalize function would
destroy the state at the same time as the initialize function is trying
to initialize it.

Holding on to the global lock for the entire function prevents all of
these failure modes.
2021-11-08 15:00:28 +01:00
Niklas Haas
3971424207 Initialize global mutex in a thread-safe manner
Currently, ShInitialize() and friends call glslang::InitGlobalLock()
which *overwrites* the global mutex. As such, even though it ostensibly
takes a mutex, this function is actually completely thread-unsafe.

Fix it by using pthread_once to ensure the mutex is only initialized
once, and then never again.
2021-11-08 14:47:32 +01:00
Lynne
5ec47530b7 Add support for targeting Vulkan 1.2 in the C API 2021-11-08 10:48:38 +01:00
ZhiqianXia
46d3a30bd9 Support the #extension GL_ARB_draw_instanced.
Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
2021-11-08 13:48:03 +08:00
ZhiqianXia
e76116982a Add the GL_EXT_shader_integer_mix Preamble for glsl.
Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
2021-11-02 14:39:28 +08:00
Greg Fischer
77d680e1c3
Merge pull request #2712 from ZhiqianXia/switch_error
glslang should report a error for Feature: last case/default label not followed by statements'.
2021-11-01 10:19:09 -06:00
ZhiqianXia
1de2d1745b To be compatible with Feature: 'last case/default label not followed by statements'.
Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
2021-10-28 09:23:19 +08:00
Greg Fischer
432a43cccb Remove support for double trig, pow, exp and log
These are not supported in core GLSL or under any extension

Fixes 2793
2021-10-27 11:59:26 -06:00
Jeremy Hayes
c9cc4845b9 Return new allocator for copied containers
Fix #2760.

Implement the optional function select_on_container_copy_contruction to
return a default-contructed allocator for containers that are
copy-constructed. This gives copy-constructed containers a pool
allocator for the current thead.

There may be a similar problem with the copy contructor which takes
allocators of type "Other" but, in practice, there is only one place
where this is being used and the allocators are always the same. (i.e.
executing from the same thread)
2021-10-25 10:59:27 -06:00
Greg Fischer
3afa350331
Merge pull request #2780 from kevin-mccullough/FixCrossStageCheck
Fix cross-stage check to allow subsequent stage to use previous stage's binding
2021-10-22 14:44:10 -06:00
Greg Fischer
38fd9221db
Merge pull request #2777 from amdrexu/bugfix
Make modifications of GL_EXT_spirv_intrinsics
2021-10-21 12:59:22 -06:00
Greg Fischer
9290474dcf
Merge pull request #2787 from greg-lunarg/i2779
Allow 8/16-bit integer as array index
2021-10-20 18:26:59 -06:00
Greg Fischer
8020da3f18
Merge pull request #2788 from alelenv/iomapper_sr_fix
Skip auto decorating shader record buffer blocks with 'set' and 'binding'.
2021-10-20 16:28:11 -06:00
Greg Fischer
82b2668d58 Allow 8/16-bit integer as array index
Also enable 8/16 bit int capability in SPIR-V in such cases.

Also enable 64 bit capabilities when used in operations.

Fixes #2779
2021-10-20 15:15:30 -06:00
Greg Fischer
6639be7c2d Accept gl_ViewportMask in version 430 and later
Was previously accepted only in 450 or later.

Fixes #2785
2021-10-20 13:51:23 -06:00
alelenv
c571cd8f89 Skip auto decorating shader record buffer blocks with 'set' and
'binding'.
2021-10-19 20:59:35 -07:00
amhagan
035a3bbc4a GL_EXT_spirv_intrinsics - Port extensions
Add mechanism to use GL_EXT_spirv_intrinsics headers in glslang.
Ported GL_EXT_shader_realtime_clock as an example.
2021-10-15 14:13:08 -04:00
Rex Xu
07aec25f82 Make modifications of GL_EXT_spirv_intrinsics
1. spirv_execution_mode_id and spirv_decorate_id could support
   specialization constants. The original implementation always
   assume only normal frontend constants are valid. It is not true.

2. spirv_type donesn't support type_specifier as an option of
   spirv_type_parameter. At present, only constant_expression is the
   valid option.
2021-10-15 20:22:36 +08:00
Kevin McCullough
d3567231eb Fix cross-stage check to allow subsequent stage to use previous stage's binding 2021-10-13 14:57:06 -07:00
Greg Fischer
b9ba4c5743
Merge pull request #2770 from ncesario-lunarg/ncesario-cmake-endif
cmake: Remove "conditions" from endif
2021-10-07 12:33:37 -06:00