Handle buffer references vs 'const'

Allow constructors to and from references to be constant folded. Section 4.3.3
says constructors whose arguments are all constant expressions must fold.

Disallow 'const' on buffer reference types. It is not a 'non-void transparent
basic data type' (it is not considered 'basic').

Handle buffer reference constants (which can be assigned to a non-const reference,
or can be further folded to another type of constant) by converting to
'constructor(uint64_t constant)' in addConversion.

Disallow == and != operators on reference types.
This commit is contained in:
Jeff Bolz
2019-02-18 00:11:05 -06:00
parent d90d548161
commit be63facd80
13 changed files with 1271 additions and 1099 deletions

View File

@@ -0,0 +1,23 @@
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : enable
#extension GL_EXT_buffer_reference : enable
#extension GL_EXT_scalar_block_layout : enable
layout(buffer_reference) buffer T1 {
int x;
};
layout(buffer_reference) buffer T2 {
int x;
};
const int s = int(uint64_t(T1(T2(uint64_t(3)))));
int x[s];
void main()
{
T1 a = T1(uint64_t(4)), b = T1(uint64_t(5));
T1 c = true ? a : b;
T1 d = (a,b);
T1 e = true ? T1(uint64_t(6)) : T1(uint64_t(7));
}