Merge pull request #1388 from KhronosGroup/uint-sparse-residency-query
GLSL: Support uint code for sparse residency query.
This commit is contained in:
commit
bbefea2b02
@ -0,0 +1,23 @@
|
||||
#version 450
|
||||
#extension GL_ARB_sparse_texture2 : require
|
||||
|
||||
struct ResType
|
||||
{
|
||||
uint _m0;
|
||||
vec4 _m1;
|
||||
};
|
||||
|
||||
layout(binding = 0) uniform sampler2D uSamp;
|
||||
|
||||
layout(location = 0) in vec2 vUV;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint _30;
|
||||
vec4 _31;
|
||||
_30 = sparseTextureARB(uSamp, vUV, _31);
|
||||
ResType _26 = ResType(_30, _31);
|
||||
vec4 texel = _26._m1;
|
||||
bool ret = sparseTexelsResidentARB(int(_26._m0));
|
||||
}
|
||||
|
@ -0,0 +1,57 @@
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 30
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability SparseResidency
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %vUV %FragColor
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpSource GLSL 450
|
||||
OpSourceExtension "GL_ARB_sparse_texture2"
|
||||
OpSourceExtension "GL_ARB_sparse_texture_clamp"
|
||||
OpName %main "main"
|
||||
OpName %ret "ret"
|
||||
OpName %uSamp "uSamp"
|
||||
OpName %vUV "vUV"
|
||||
OpName %texel "texel"
|
||||
OpName %ResType "ResType"
|
||||
OpName %FragColor "FragColor"
|
||||
OpDecorate %uSamp DescriptorSet 0
|
||||
OpDecorate %uSamp Binding 0
|
||||
OpDecorate %vUV Location 0
|
||||
OpDecorate %FragColor Location 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function_bool = OpTypePointer Function %bool
|
||||
%float = OpTypeFloat 32
|
||||
%10 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%11 = OpTypeSampledImage %10
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%uSamp = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%vUV = OpVariable %_ptr_Input_v2float Input
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%uint = OpTypeInt 32 0
|
||||
%ResType = OpTypeStruct %uint %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%FragColor = OpVariable %_ptr_Output_v4float Output
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%ret = OpVariable %_ptr_Function_bool Function
|
||||
%texel = OpVariable %_ptr_Function_v4float Function
|
||||
%14 = OpLoad %11 %uSamp
|
||||
%18 = OpLoad %v2float %vUV
|
||||
%24 = OpImageSparseSampleImplicitLod %ResType %14 %18
|
||||
%25 = OpCompositeExtract %v4float %24 1
|
||||
OpStore %texel %25
|
||||
%26 = OpCompositeExtract %uint %24 0
|
||||
%27 = OpImageSparseTexelsResident %bool %26
|
||||
OpStore %ret %27
|
||||
OpReturn
|
||||
OpFunctionEnd
|
@ -10217,7 +10217,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
|
||||
if (options.es)
|
||||
SPIRV_CROSS_THROW("Sparse feedback is not supported in GLSL.");
|
||||
require_extension_internal("GL_ARB_sparse_texture2");
|
||||
GLSL_UFOP(sparseTexelsResidentARB);
|
||||
emit_unary_func_op_cast(ops[0], ops[1], ops[2], "sparseTexelsResidentARB", int_type, SPIRType::Boolean);
|
||||
break;
|
||||
|
||||
case OpImage:
|
||||
|
Loading…
Reference in New Issue
Block a user