Merge pull request #1734 from KhronosGroup/buffer-reference-uvec2
GLSL: Emit GL_EXT_buffer_reference_uvec2 as required.
This commit is contained in:
commit
51d8e7be94
@ -0,0 +1,21 @@
|
||||
#version 450
|
||||
#extension GL_EXT_buffer_reference : require
|
||||
#extension GL_EXT_buffer_reference_uvec2 : require
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(buffer_reference) buffer PtrInt;
|
||||
layout(buffer_reference, std430) buffer PtrInt
|
||||
{
|
||||
int value;
|
||||
};
|
||||
|
||||
layout(set = 0, binding = 0, std430) buffer Buf
|
||||
{
|
||||
uvec2 ptr;
|
||||
} _10;
|
||||
|
||||
void main()
|
||||
{
|
||||
PtrInt(_10.ptr).value = 10;
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
#version 450
|
||||
#extension GL_EXT_buffer_reference : require
|
||||
#extension GL_EXT_buffer_reference_uvec2 : require
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(buffer_reference) buffer PtrInt;
|
||||
layout(buffer_reference, std430) buffer PtrInt
|
||||
{
|
||||
int value;
|
||||
};
|
||||
|
||||
layout(set = 0, binding = 0, std430) buffer Buf
|
||||
{
|
||||
uvec2 ptr;
|
||||
PtrInt ptrint;
|
||||
} _13;
|
||||
|
||||
void main()
|
||||
{
|
||||
_13.ptr = uvec2(_13.ptrint);
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
#version 450
|
||||
#extension GL_EXT_buffer_reference : require
|
||||
#extension GL_EXT_buffer_reference_uvec2 : require
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(buffer_reference) buffer PtrInt;
|
||||
layout(buffer_reference, std430) buffer PtrInt
|
||||
{
|
||||
int value;
|
||||
};
|
||||
|
||||
layout(set = 0, binding = 0, std430) buffer Buf
|
||||
{
|
||||
uvec2 ptr;
|
||||
} _10;
|
||||
|
||||
void main()
|
||||
{
|
||||
PtrInt(_10.ptr).value = 10;
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
#version 450
|
||||
#extension GL_EXT_buffer_reference : require
|
||||
#extension GL_EXT_buffer_reference_uvec2 : require
|
||||
|
||||
layout(buffer_reference) buffer PtrInt
|
||||
{
|
||||
int value;
|
||||
};
|
||||
|
||||
layout(set = 0, binding = 0) buffer Buf
|
||||
{
|
||||
uvec2 ptr;
|
||||
PtrInt ptrint;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
ptr = uvec2(ptrint);
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
#version 450
|
||||
#extension GL_EXT_buffer_reference : require
|
||||
#extension GL_EXT_buffer_reference_uvec2 : require
|
||||
|
||||
layout(buffer_reference) buffer PtrInt
|
||||
{
|
||||
int value;
|
||||
};
|
||||
|
||||
layout(set = 0, binding = 0) buffer Buf
|
||||
{
|
||||
uvec2 ptr;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
PtrInt(ptr).value = 10;
|
||||
}
|
@ -8047,7 +8047,11 @@ string CompilerGLSL::bitcast_glsl_op(const SPIRType &out_type, const SPIRType &i
|
||||
{
|
||||
// OpBitcast can deal with pointers.
|
||||
if (out_type.pointer || in_type.pointer)
|
||||
{
|
||||
if (out_type.vecsize == 2 || in_type.vecsize == 2)
|
||||
require_extension_internal("GL_EXT_buffer_reference_uvec2");
|
||||
return type_to_glsl(out_type);
|
||||
}
|
||||
|
||||
if (out_type.basetype == in_type.basetype)
|
||||
return "";
|
||||
@ -12611,6 +12615,10 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
|
||||
if (type.storage != StorageClassPhysicalStorageBufferEXT)
|
||||
SPIRV_CROSS_THROW("Only StorageClassPhysicalStorageBufferEXT is supported by OpConvertUToPtr.");
|
||||
|
||||
auto &in_type = expression_type(ops[2]);
|
||||
if (in_type.vecsize == 2)
|
||||
require_extension_internal("GL_EXT_buffer_reference_uvec2");
|
||||
|
||||
auto op = type_to_glsl(type);
|
||||
emit_unary_func_op(ops[0], ops[1], ops[2], op.c_str());
|
||||
break;
|
||||
@ -12623,6 +12631,9 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
|
||||
if (ptr_type.storage != StorageClassPhysicalStorageBufferEXT)
|
||||
SPIRV_CROSS_THROW("Only StorageClassPhysicalStorageBufferEXT is supported by OpConvertPtrToU.");
|
||||
|
||||
if (type.vecsize == 2)
|
||||
require_extension_internal("GL_EXT_buffer_reference_uvec2");
|
||||
|
||||
auto op = type_to_glsl(type);
|
||||
emit_unary_func_op(ops[0], ops[1], ops[2], op.c_str());
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user