Web: Add SSBOs and a few other missing compute features.
This commit is contained in:
parent
51ed01c877
commit
3dd1ce5b54
@ -673,6 +673,13 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
|
||||
case glslang::EbvFace: return spv::BuiltInFrontFacing;
|
||||
case glslang::EbvFragDepth: return spv::BuiltInFragDepth;
|
||||
|
||||
case glslang::EbvNumWorkGroups: return spv::BuiltInNumWorkgroups;
|
||||
case glslang::EbvWorkGroupSize: return spv::BuiltInWorkgroupSize;
|
||||
case glslang::EbvWorkGroupId: return spv::BuiltInWorkgroupId;
|
||||
case glslang::EbvLocalInvocationId: return spv::BuiltInLocalInvocationId;
|
||||
case glslang::EbvLocalInvocationIndex: return spv::BuiltInLocalInvocationIndex;
|
||||
case glslang::EbvGlobalInvocationId: return spv::BuiltInGlobalInvocationId;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// These *Distance capabilities logically belong here, but if the member is declared and
|
||||
// then never used, consumers of SPIR-V prefer the capability not be declared.
|
||||
@ -757,12 +764,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
|
||||
case glslang::EbvTessCoord: return spv::BuiltInTessCoord;
|
||||
case glslang::EbvPatchVertices: return spv::BuiltInPatchVertices;
|
||||
case glslang::EbvHelperInvocation: return spv::BuiltInHelperInvocation;
|
||||
case glslang::EbvNumWorkGroups: return spv::BuiltInNumWorkgroups;
|
||||
case glslang::EbvWorkGroupSize: return spv::BuiltInWorkgroupSize;
|
||||
case glslang::EbvWorkGroupId: return spv::BuiltInWorkgroupId;
|
||||
case glslang::EbvLocalInvocationId: return spv::BuiltInLocalInvocationId;
|
||||
case glslang::EbvLocalInvocationIndex: return spv::BuiltInLocalInvocationIndex;
|
||||
case glslang::EbvGlobalInvocationId: return spv::BuiltInGlobalInvocationId;
|
||||
|
||||
case glslang::EbvSubGroupSize:
|
||||
builder.addExtension(spv::E_SPV_KHR_shader_ballot);
|
||||
@ -1200,11 +1201,11 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T
|
||||
}
|
||||
|
||||
switch (type.getQualifier().storage) {
|
||||
case glslang::EvqGlobal: return spv::StorageClassPrivate;
|
||||
case glslang::EvqConstReadOnly: return spv::StorageClassFunction;
|
||||
case glslang::EvqTemporary: return spv::StorageClassFunction;
|
||||
#ifndef GLSLANG_WEB
|
||||
case glslang::EvqGlobal: return spv::StorageClassPrivate;
|
||||
case glslang::EvqConstReadOnly: return spv::StorageClassFunction;
|
||||
case glslang::EvqTemporary: return spv::StorageClassFunction;
|
||||
case glslang::EvqShared: return spv::StorageClassWorkgroup;
|
||||
#ifndef GLSLANG_WEB
|
||||
case glslang::EvqPayloadNV: return spv::StorageClassRayPayloadNV;
|
||||
case glslang::EvqPayloadInNV: return spv::StorageClassIncomingRayPayloadNV;
|
||||
case glslang::EvqHitAttrNV: return spv::StorageClassHitAttributeNV;
|
||||
@ -2548,7 +2549,6 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
||||
binOp = glslang::EOpMod;
|
||||
break;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
case glslang::EOpEmitVertex:
|
||||
case glslang::EOpEndPrimitive:
|
||||
case glslang::EOpBarrier:
|
||||
@ -2572,6 +2572,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
||||
// These all have 0 operands and will naturally finish up in the code below for 0 operands
|
||||
break;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
case glslang::EOpAtomicStore:
|
||||
noReturnValue = true;
|
||||
// fallthrough
|
||||
@ -3537,8 +3538,8 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
|
||||
builder.addIncorporatedExtension("SPV_EXT_descriptor_indexing", spv::Spv_1_5);
|
||||
builder.addCapability(spv::CapabilityRuntimeDescriptorArrayEXT);
|
||||
}
|
||||
spvType = builder.makeRuntimeArray(spvType);
|
||||
#endif
|
||||
spvType = builder.makeRuntimeArray(spvType);
|
||||
}
|
||||
if (stride > 0)
|
||||
builder.addDecoration(spvType, spv::DecorationArrayStride, stride);
|
||||
@ -7172,6 +7173,48 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
|
||||
case glslang::EOpRefract:
|
||||
libCall = spv::GLSLstd450Refract;
|
||||
break;
|
||||
case glslang::EOpBarrier:
|
||||
{
|
||||
// This is for the extended controlBarrier function, with four operands.
|
||||
// The unextended barrier() goes through createNoArgOperation.
|
||||
assert(operands.size() == 4);
|
||||
unsigned int executionScope = builder.getConstantScalar(operands[0]);
|
||||
unsigned int memoryScope = builder.getConstantScalar(operands[1]);
|
||||
unsigned int semantics = builder.getConstantScalar(operands[2]) | builder.getConstantScalar(operands[3]);
|
||||
builder.createControlBarrier((spv::Scope)executionScope, (spv::Scope)memoryScope, (spv::MemorySemanticsMask)semantics);
|
||||
if (semantics & (spv::MemorySemanticsMakeAvailableKHRMask |
|
||||
spv::MemorySemanticsMakeVisibleKHRMask |
|
||||
spv::MemorySemanticsOutputMemoryKHRMask |
|
||||
spv::MemorySemanticsVolatileMask)) {
|
||||
builder.addCapability(spv::CapabilityVulkanMemoryModelKHR);
|
||||
}
|
||||
if (glslangIntermediate->usingVulkanMemoryModel() && (executionScope == spv::ScopeDevice || memoryScope == spv::ScopeDevice)) {
|
||||
builder.addCapability(spv::CapabilityVulkanMemoryModelDeviceScopeKHR);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case glslang::EOpMemoryBarrier:
|
||||
{
|
||||
// This is for the extended memoryBarrier function, with three operands.
|
||||
// The unextended memoryBarrier() goes through createNoArgOperation.
|
||||
assert(operands.size() == 3);
|
||||
unsigned int memoryScope = builder.getConstantScalar(operands[0]);
|
||||
unsigned int semantics = builder.getConstantScalar(operands[1]) | builder.getConstantScalar(operands[2]);
|
||||
builder.createMemoryBarrier((spv::Scope)memoryScope, (spv::MemorySemanticsMask)semantics);
|
||||
if (semantics & (spv::MemorySemanticsMakeAvailableKHRMask |
|
||||
spv::MemorySemanticsMakeVisibleKHRMask |
|
||||
spv::MemorySemanticsOutputMemoryKHRMask |
|
||||
spv::MemorySemanticsVolatileMask)) {
|
||||
builder.addCapability(spv::CapabilityVulkanMemoryModelKHR);
|
||||
}
|
||||
if (glslangIntermediate->usingVulkanMemoryModel() && memoryScope == spv::ScopeDevice) {
|
||||
builder.addCapability(spv::CapabilityVulkanMemoryModelDeviceScopeKHR);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
case glslang::EOpInterpolateAtSample:
|
||||
if (typeProxy == glslang::EbtFloat16)
|
||||
@ -7330,47 +7373,6 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
|
||||
extBuiltins = getExtBuiltins(spv::E_SPV_AMD_shader_explicit_vertex_parameter);
|
||||
libCall = spv::InterpolateAtVertexAMD;
|
||||
break;
|
||||
case glslang::EOpBarrier:
|
||||
{
|
||||
// This is for the extended controlBarrier function, with four operands.
|
||||
// The unextended barrier() goes through createNoArgOperation.
|
||||
assert(operands.size() == 4);
|
||||
unsigned int executionScope = builder.getConstantScalar(operands[0]);
|
||||
unsigned int memoryScope = builder.getConstantScalar(operands[1]);
|
||||
unsigned int semantics = builder.getConstantScalar(operands[2]) | builder.getConstantScalar(operands[3]);
|
||||
builder.createControlBarrier((spv::Scope)executionScope, (spv::Scope)memoryScope, (spv::MemorySemanticsMask)semantics);
|
||||
if (semantics & (spv::MemorySemanticsMakeAvailableKHRMask |
|
||||
spv::MemorySemanticsMakeVisibleKHRMask |
|
||||
spv::MemorySemanticsOutputMemoryKHRMask |
|
||||
spv::MemorySemanticsVolatileMask)) {
|
||||
builder.addCapability(spv::CapabilityVulkanMemoryModelKHR);
|
||||
}
|
||||
if (glslangIntermediate->usingVulkanMemoryModel() && (executionScope == spv::ScopeDevice || memoryScope == spv::ScopeDevice)) {
|
||||
builder.addCapability(spv::CapabilityVulkanMemoryModelDeviceScopeKHR);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case glslang::EOpMemoryBarrier:
|
||||
{
|
||||
// This is for the extended memoryBarrier function, with three operands.
|
||||
// The unextended memoryBarrier() goes through createNoArgOperation.
|
||||
assert(operands.size() == 3);
|
||||
unsigned int memoryScope = builder.getConstantScalar(operands[0]);
|
||||
unsigned int semantics = builder.getConstantScalar(operands[1]) | builder.getConstantScalar(operands[2]);
|
||||
builder.createMemoryBarrier((spv::Scope)memoryScope, (spv::MemorySemanticsMask)semantics);
|
||||
if (semantics & (spv::MemorySemanticsMakeAvailableKHRMask |
|
||||
spv::MemorySemanticsMakeVisibleKHRMask |
|
||||
spv::MemorySemanticsOutputMemoryKHRMask |
|
||||
spv::MemorySemanticsVolatileMask)) {
|
||||
builder.addCapability(spv::CapabilityVulkanMemoryModelKHR);
|
||||
}
|
||||
if (glslangIntermediate->usingVulkanMemoryModel() && memoryScope == spv::ScopeDevice) {
|
||||
builder.addCapability(spv::CapabilityVulkanMemoryModelDeviceScopeKHR);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case glslang::EOpReportIntersectionNV:
|
||||
{
|
||||
@ -7478,17 +7480,18 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
|
||||
// Intrinsics with no arguments (or no return value, and no precision).
|
||||
spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId)
|
||||
{
|
||||
#ifndef GLSLANG_WEB
|
||||
// GLSL memory barriers use queuefamily scope in new model, device scope in old model
|
||||
spv::Scope memoryBarrierScope = glslangIntermediate->usingVulkanMemoryModel() ? spv::ScopeQueueFamilyKHR : spv::ScopeDevice;
|
||||
|
||||
switch (op) {
|
||||
#ifndef GLSLANG_WEB
|
||||
case glslang::EOpEmitVertex:
|
||||
builder.createNoResultOp(spv::OpEmitVertex);
|
||||
return 0;
|
||||
case glslang::EOpEndPrimitive:
|
||||
builder.createNoResultOp(spv::OpEndPrimitive);
|
||||
return 0;
|
||||
#endif
|
||||
case glslang::EOpBarrier:
|
||||
if (glslangIntermediate->getStage() == EShLangTessControl) {
|
||||
if (glslangIntermediate->usingVulkanMemoryModel()) {
|
||||
@ -7509,18 +7512,10 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv:
|
||||
builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsAllMemory |
|
||||
spv::MemorySemanticsAcquireReleaseMask);
|
||||
return 0;
|
||||
case glslang::EOpMemoryBarrierAtomicCounter:
|
||||
builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsAtomicCounterMemoryMask |
|
||||
spv::MemorySemanticsAcquireReleaseMask);
|
||||
return 0;
|
||||
case glslang::EOpMemoryBarrierBuffer:
|
||||
builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsUniformMemoryMask |
|
||||
spv::MemorySemanticsAcquireReleaseMask);
|
||||
return 0;
|
||||
case glslang::EOpMemoryBarrierImage:
|
||||
builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsImageMemoryMask |
|
||||
spv::MemorySemanticsAcquireReleaseMask);
|
||||
return 0;
|
||||
case glslang::EOpMemoryBarrierShared:
|
||||
builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsWorkgroupMemoryMask |
|
||||
spv::MemorySemanticsAcquireReleaseMask);
|
||||
@ -7529,6 +7524,15 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv:
|
||||
builder.createMemoryBarrier(spv::ScopeWorkgroup, spv::MemorySemanticsAllMemory |
|
||||
spv::MemorySemanticsAcquireReleaseMask);
|
||||
return 0;
|
||||
#ifndef GLSLANG_WEB
|
||||
case glslang::EOpMemoryBarrierAtomicCounter:
|
||||
builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsAtomicCounterMemoryMask |
|
||||
spv::MemorySemanticsAcquireReleaseMask);
|
||||
return 0;
|
||||
case glslang::EOpMemoryBarrierImage:
|
||||
builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsImageMemoryMask |
|
||||
spv::MemorySemanticsAcquireReleaseMask);
|
||||
return 0;
|
||||
case glslang::EOpAllMemoryBarrierWithGroupSync:
|
||||
builder.createControlBarrier(spv::ScopeWorkgroup, spv::ScopeDevice,
|
||||
spv::MemorySemanticsAllMemory |
|
||||
@ -7620,10 +7624,10 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv:
|
||||
builder.addCapability(spv::CapabilityShaderClockKHR);
|
||||
return builder.createOp(spv::OpReadClockKHR, typeId, args);
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
logger->missingFunctionality("unknown operation with no arguments");
|
||||
|
||||
|
@ -1 +1 @@
|
||||
388096 ../build/install/bin/glslangValidator.exe
|
||||
399360 ../build/install/bin/glslangValidator.exe
|
||||
|
@ -1,75 +1,140 @@
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 55
|
||||
; Bound: 91
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpEntryPoint GLCompute %main "main" %gl_NumWorkGroups %gl_WorkGroupID %gl_LocalInvocationID %gl_GlobalInvocationID %gl_LocalInvocationIndex
|
||||
OpExecutionMode %main LocalSize 2 5 7
|
||||
OpSource ESSL 310
|
||||
OpName %main "main"
|
||||
OpName %bName "bName"
|
||||
OpMemberName %bName 0 "size"
|
||||
OpMemberName %bName 1 "count"
|
||||
OpMemberName %bName 2 "data"
|
||||
OpName %bInst "bInst"
|
||||
OpName %s "s"
|
||||
OpName %arrX "arrX"
|
||||
OpName %arrY "arrY"
|
||||
OpName %arrZ "arrZ"
|
||||
OpDecorate %19 SpecId 18
|
||||
OpDecorate %21 SpecId 19
|
||||
OpName %gl_NumWorkGroups "gl_NumWorkGroups"
|
||||
OpName %gl_WorkGroupID "gl_WorkGroupID"
|
||||
OpName %gl_LocalInvocationID "gl_LocalInvocationID"
|
||||
OpName %gl_GlobalInvocationID "gl_GlobalInvocationID"
|
||||
OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex"
|
||||
OpDecorate %_runtimearr_v4float ArrayStride 16
|
||||
OpMemberDecorate %bName 0 Offset 0
|
||||
OpMemberDecorate %bName 1 Offset 16
|
||||
OpMemberDecorate %bName 2 Offset 32
|
||||
OpDecorate %bName BufferBlock
|
||||
OpDecorate %bInst DescriptorSet 0
|
||||
OpDecorate %bInst Binding 0
|
||||
OpDecorate %39 SpecId 18
|
||||
OpDecorate %41 SpecId 19
|
||||
OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
|
||||
OpDecorate %gl_NumWorkGroups BuiltIn NumWorkgroups
|
||||
OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId
|
||||
OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId
|
||||
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
|
||||
OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%uint_264 = OpConstant %uint 264
|
||||
%int = OpTypeInt 32 1
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%_runtimearr_v4float = OpTypeRuntimeArray %v4float
|
||||
%bName = OpTypeStruct %int %v3uint %_runtimearr_v4float
|
||||
%_ptr_Uniform_bName = OpTypePointer Uniform %bName
|
||||
%bInst = OpVariable %_ptr_Uniform_bName Uniform
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%float_7 = OpConstant %float 7
|
||||
%24 = OpConstantComposite %v4float %float_7 %float_7 %float_7 %float_7
|
||||
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%uint_3400 = OpConstant %uint 3400
|
||||
%uint_72 = OpConstant %uint 72
|
||||
%uint_197645 = OpConstant %uint 197645
|
||||
%_arr_v4float_uint_197645 = OpTypeArray %v4float %uint_197645
|
||||
%_ptr_Function__arr_v4float_uint_197645 = OpTypePointer Function %_arr_v4float_uint_197645
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Workgroup__arr_v4float_uint_197645 = OpTypePointer Workgroup %_arr_v4float_uint_197645
|
||||
%s = OpVariable %_ptr_Workgroup__arr_v4float_uint_197645 Workgroup
|
||||
%int_3 = OpConstant %int 3
|
||||
%float_1 = OpConstant %float 1
|
||||
%16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%19 = OpSpecConstant %uint 2
|
||||
%float_0 = OpConstant %float 0
|
||||
%39 = OpSpecConstant %uint 2
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%21 = OpSpecConstant %uint 7
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%23 = OpSpecConstantComposite %v3uint %19 %uint_5 %21
|
||||
%41 = OpSpecConstant %uint 7
|
||||
%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %39 %uint_5 %41
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_arr_int_25 = OpTypeArray %int %25
|
||||
%_ptr_Private__arr_int_25 = OpTypePointer Private %_arr_int_25
|
||||
%arrX = OpVariable %_ptr_Private__arr_int_25 Private
|
||||
%int_0 = OpConstant %int 0
|
||||
%_arr_int_44 = OpTypeArray %int %44
|
||||
%_ptr_Private__arr_int_44 = OpTypePointer Private %_arr_int_44
|
||||
%arrX = OpVariable %_ptr_Private__arr_int_44 Private
|
||||
%_ptr_Private_int = OpTypePointer Private %int
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_int_34 = OpTypeArray %int %34
|
||||
%_ptr_Private__arr_int_34 = OpTypePointer Private %_arr_int_34
|
||||
%arrY = OpVariable %_ptr_Private__arr_int_34 Private
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_int_42 = OpTypeArray %int %42
|
||||
%_ptr_Private__arr_int_42 = OpTypePointer Private %_arr_int_42
|
||||
%arrZ = OpVariable %_ptr_Private__arr_int_42 Private
|
||||
%_arr_int_52 = OpTypeArray %int %52
|
||||
%_ptr_Private__arr_int_52 = OpTypePointer Private %_arr_int_52
|
||||
%arrY = OpVariable %_ptr_Private__arr_int_52 Private
|
||||
%_arr_int_59 = OpTypeArray %int %59
|
||||
%_ptr_Private__arr_int_59 = OpTypePointer Private %_arr_int_59
|
||||
%arrZ = OpVariable %_ptr_Private__arr_int_59 Private
|
||||
%_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
|
||||
%gl_NumWorkGroups = OpVariable %_ptr_Input_v3uint Input
|
||||
%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input
|
||||
%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input
|
||||
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input
|
||||
%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint
|
||||
%int_197645 = OpConstant %int 197645
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%s = OpVariable %_ptr_Function__arr_v4float_uint_197645 Function
|
||||
%18 = OpAccessChain %_ptr_Function_v4float %s %int_3
|
||||
OpStore %18 %16
|
||||
%25 = OpCompositeExtract %uint %23 0
|
||||
%31 = OpAccessChain %_ptr_Private_int %arrX %int_0
|
||||
%32 = OpLoad %int %31
|
||||
%34 = OpCompositeExtract %uint %23 1
|
||||
%38 = OpAccessChain %_ptr_Private_int %arrY %int_0
|
||||
%39 = OpLoad %int %38
|
||||
%40 = OpIMul %int %32 %39
|
||||
%42 = OpCompositeExtract %uint %23 2
|
||||
%46 = OpAccessChain %_ptr_Private_int %arrZ %int_0
|
||||
%47 = OpLoad %int %46
|
||||
%48 = OpIMul %int %40 %47
|
||||
%49 = OpConvertSToF %float %48
|
||||
%50 = OpAccessChain %_ptr_Function_v4float %s %int_3
|
||||
%51 = OpLoad %v4float %50
|
||||
%52 = OpVectorTimesScalar %v4float %51 %49
|
||||
%53 = OpAccessChain %_ptr_Function_v4float %s %int_3
|
||||
OpStore %53 %52
|
||||
OpControlBarrier %uint_2 %uint_2 %uint_264
|
||||
%20 = OpAccessChain %_ptr_Uniform_int %bInst %int_0
|
||||
%21 = OpLoad %int %20
|
||||
%22 = OpSDiv %int %21 %int_2
|
||||
%26 = OpAccessChain %_ptr_Uniform_v4float %bInst %int_2 %22
|
||||
%27 = OpLoad %v4float %26
|
||||
%28 = OpFMul %v4float %27 %24
|
||||
%29 = OpAccessChain %_ptr_Uniform_v4float %bInst %int_2 %22
|
||||
OpStore %29 %28
|
||||
OpMemoryBarrier %uint_1 %uint_3400
|
||||
OpMemoryBarrier %uint_2 %uint_3400
|
||||
OpMemoryBarrier %uint_1 %uint_264
|
||||
OpMemoryBarrier %uint_1 %uint_72
|
||||
%44 = OpCompositeExtract %uint %gl_WorkGroupSize 0
|
||||
%49 = OpAccessChain %_ptr_Private_int %arrX %int_0
|
||||
%50 = OpLoad %int %49
|
||||
%51 = OpConvertSToF %float %50
|
||||
%52 = OpCompositeExtract %uint %gl_WorkGroupSize 1
|
||||
%56 = OpAccessChain %_ptr_Private_int %arrY %int_0
|
||||
%57 = OpLoad %int %56
|
||||
%58 = OpConvertSToF %float %57
|
||||
%59 = OpCompositeExtract %uint %gl_WorkGroupSize 2
|
||||
%63 = OpAccessChain %_ptr_Private_int %arrZ %int_0
|
||||
%64 = OpLoad %int %63
|
||||
%65 = OpConvertSToF %float %64
|
||||
%66 = OpCompositeConstruct %v4float %float_0 %51 %58 %65
|
||||
%68 = OpAccessChain %_ptr_Workgroup_v4float %s %int_3
|
||||
OpStore %68 %66
|
||||
%72 = OpLoad %v3uint %gl_NumWorkGroups
|
||||
%73 = OpIAdd %v3uint %72 %gl_WorkGroupSize
|
||||
%75 = OpLoad %v3uint %gl_WorkGroupID
|
||||
%76 = OpIAdd %v3uint %73 %75
|
||||
%78 = OpLoad %v3uint %gl_LocalInvocationID
|
||||
%79 = OpIAdd %v3uint %76 %78
|
||||
%81 = OpLoad %v3uint %gl_GlobalInvocationID
|
||||
%84 = OpLoad %uint %gl_LocalInvocationIndex
|
||||
%85 = OpCompositeConstruct %v3uint %84 %84 %84
|
||||
%86 = OpIMul %v3uint %81 %85
|
||||
%87 = OpIAdd %v3uint %79 %86
|
||||
%89 = OpAccessChain %_ptr_Uniform_v3uint %bInst %int_1
|
||||
OpStore %89 %87
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
@ -5,6 +5,7 @@ layout(local_size_x_id = 18, local_size_z_id = 19) in;
|
||||
layout(local_size_x = 2) in;
|
||||
layout(local_size_y = 5) in;
|
||||
layout(local_size_z = 7) in;
|
||||
|
||||
const int total = gl_MaxComputeWorkGroupCount.x
|
||||
+ gl_MaxComputeWorkGroupCount.y
|
||||
+ gl_MaxComputeWorkGroupCount.z
|
||||
@ -17,12 +18,24 @@ int arrX[gl_WorkGroupSize.x];
|
||||
int arrY[gl_WorkGroupSize.y];
|
||||
int arrZ[gl_WorkGroupSize.z];
|
||||
|
||||
layout(binding = 0, set = 0) buffer bName {
|
||||
int size;
|
||||
uvec3 count;
|
||||
vec4 data[];
|
||||
} bInst;
|
||||
|
||||
void main()
|
||||
{
|
||||
barrier();
|
||||
|
||||
bInst.data[bInst.size / 2] *= vec4(7.0);
|
||||
|
||||
memoryBarrier();
|
||||
memoryBarrierShared();
|
||||
groupMemoryBarrier();
|
||||
s[3] = vec4(1.0);
|
||||
s[3] *= arrX[0] * arrY[0] * arrZ[0];
|
||||
memoryBarrierShared();
|
||||
memoryBarrierBuffer();
|
||||
|
||||
s[3] = vec4(0, arrX[0], arrY[0], arrZ[0]);
|
||||
bInst.count = gl_NumWorkGroups + gl_WorkGroupSize + gl_WorkGroupID + gl_LocalInvocationID +
|
||||
gl_GlobalInvocationID * gl_LocalInvocationIndex;
|
||||
}
|
||||
|
@ -3819,13 +3819,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
stageBuiltins[EShLangCompute].append(
|
||||
"void memoryBarrierShared();"
|
||||
"void groupMemoryBarrier();"
|
||||
"void memoryBarrierBuffer();"
|
||||
);
|
||||
}
|
||||
#ifndef GLSLANG_WEB
|
||||
if ((profile != EEsProfile && version >= 420) || esBarrier) {
|
||||
commonBuiltins.append(
|
||||
"void memoryBarrierAtomicCounter();"
|
||||
"void memoryBarrierBuffer();"
|
||||
"void memoryBarrierImage();"
|
||||
);
|
||||
}
|
||||
@ -7692,8 +7692,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
symbolTable.setFunctionExtensions("dFdyCoarse", 1, &E_GL_NV_compute_shader_derivatives);
|
||||
symbolTable.setFunctionExtensions("fwidthCoarse", 1, &E_GL_NV_compute_shader_derivatives);
|
||||
}
|
||||
|
||||
#endif
|
||||
break;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
case EShLangRayGenNV:
|
||||
case EShLangIntersectNV:
|
||||
case EShLangAnyHitNV:
|
||||
@ -8108,6 +8110,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
|
||||
symbolTable.relateToOperator("barrier", EOpBarrier);
|
||||
symbolTable.relateToOperator("memoryBarrier", EOpMemoryBarrier);
|
||||
symbolTable.relateToOperator("memoryBarrierBuffer", EOpMemoryBarrierBuffer);
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
symbolTable.relateToOperator("packInt2x16", EOpPackInt2x16);
|
||||
@ -8132,7 +8135,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
|
||||
symbolTable.relateToOperator("controlBarrier", EOpBarrier);
|
||||
symbolTable.relateToOperator("memoryBarrierAtomicCounter", EOpMemoryBarrierAtomicCounter);
|
||||
symbolTable.relateToOperator("memoryBarrierBuffer", EOpMemoryBarrierBuffer);
|
||||
symbolTable.relateToOperator("memoryBarrierImage", EOpMemoryBarrierImage);
|
||||
|
||||
symbolTable.relateToOperator("atomicLoad", EOpAtomicLoad);
|
||||
|
@ -3813,10 +3813,6 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua
|
||||
// for ES, if size isn't coming from an initializer, it has to be explicitly declared now,
|
||||
// with very few exceptions
|
||||
|
||||
// last member of ssbo block exception:
|
||||
if (qualifier.storage == EvqBuffer && lastMember)
|
||||
return;
|
||||
|
||||
// implicitly-sized io exceptions:
|
||||
switch (language) {
|
||||
case EShLangGeometry:
|
||||
@ -3851,6 +3847,10 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua
|
||||
|
||||
#endif
|
||||
|
||||
// last member of ssbo block exception:
|
||||
if (qualifier.storage == EvqBuffer && lastMember)
|
||||
return;
|
||||
|
||||
arraySizeRequiredCheck(loc, *arraySizes);
|
||||
}
|
||||
|
||||
@ -5384,6 +5384,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
|
||||
#endif
|
||||
case EShLangCompute:
|
||||
if (id.compare(0, 11, "local_size_") == 0) {
|
||||
#ifndef GLSLANG_WEB
|
||||
if (language == EShLangMeshNV || language == EShLangTaskNV) {
|
||||
requireExtensions(loc, 1, &E_GL_NV_mesh_shader, "gl_WorkGroupSize");
|
||||
}
|
||||
@ -5392,6 +5393,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
|
||||
profileRequires(loc, EEsProfile, 310, 0, "gl_WorkGroupSize");
|
||||
profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkGroupSize");
|
||||
}
|
||||
#endif
|
||||
if (nonLiteral)
|
||||
error(loc, "needs a literal integer", "local_size", "");
|
||||
if (id.size() == 12 && value == 0) {
|
||||
@ -8017,7 +8019,9 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
|
||||
}
|
||||
if (intermediate.getLocalSize(i) > (unsigned int)max)
|
||||
error(loc, "too large; see gl_MaxComputeWorkGroupSize", "local_size", "");
|
||||
} else if (language == EShLangMeshNV) {
|
||||
}
|
||||
#ifndef GLSLANG_WEB
|
||||
else if (language == EShLangMeshNV) {
|
||||
switch (i) {
|
||||
case 0: max = resources.maxMeshWorkGroupSizeX_NV; break;
|
||||
case 1: max = resources.maxMeshWorkGroupSizeY_NV; break;
|
||||
@ -8035,7 +8039,9 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
|
||||
}
|
||||
if (intermediate.getLocalSize(i) > (unsigned int)max)
|
||||
error(loc, "too large; see gl_MaxTaskWorkGroupSizeNV", "local_size", "");
|
||||
} else {
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
assert(0);
|
||||
}
|
||||
|
||||
|
@ -343,6 +343,7 @@ void TScanContext::fillInKeywordMap()
|
||||
|
||||
(*KeywordMap)["const"] = CONST;
|
||||
(*KeywordMap)["uniform"] = UNIFORM;
|
||||
(*KeywordMap)["buffer"] = BUFFER;
|
||||
(*KeywordMap)["in"] = IN;
|
||||
(*KeywordMap)["out"] = OUT;
|
||||
(*KeywordMap)["smooth"] = SMOOTH;
|
||||
@ -410,7 +411,6 @@ void TScanContext::fillInKeywordMap()
|
||||
(*KeywordMap)["attribute"] = ATTRIBUTE;
|
||||
(*KeywordMap)["varying"] = VARYING;
|
||||
(*KeywordMap)["noperspective"] = NOPERSPECTIVE;
|
||||
(*KeywordMap)["buffer"] = BUFFER;
|
||||
(*KeywordMap)["coherent"] = COHERENT;
|
||||
(*KeywordMap)["devicecoherent"] = DEVICECOHERENT;
|
||||
(*KeywordMap)["queuefamilycoherent"] = QUEUEFAMILYCOHERENT;
|
||||
@ -905,6 +905,13 @@ int TScanContext::tokenizeIdentifier()
|
||||
case CASE:
|
||||
return keyword;
|
||||
|
||||
case BUFFER:
|
||||
afterBuffer = true;
|
||||
if ((parseContext.isEsProfile() && parseContext.version < 310) ||
|
||||
(!parseContext.isEsProfile() && parseContext.version < 430))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
case STRUCT:
|
||||
afterStruct = true;
|
||||
return keyword;
|
||||
@ -998,12 +1005,6 @@ int TScanContext::tokenizeIdentifier()
|
||||
if (parseContext.isEsProfile() && parseContext.version >= 300)
|
||||
reservedWord();
|
||||
return keyword;
|
||||
case BUFFER:
|
||||
afterBuffer = true;
|
||||
if ((parseContext.isEsProfile() && parseContext.version < 310) ||
|
||||
(!parseContext.isEsProfile() && parseContext.version < 430))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
case PAYLOADNV:
|
||||
case PAYLOADINNV:
|
||||
case HITATTRNV:
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
//
|
||||
// Do not edit the .y file, only edit the .m4 file.
|
||||
// The .y bison file is not a source file, it is a derivitive of the .m4 file.
|
||||
// The .y bison file is not a source file, it is a derivative of the .m4 file.
|
||||
// The m4 file needs to be processed by m4 to generate the .y bison file.
|
||||
//
|
||||
// Code sandwiched between a pair:
|
||||
@ -49,7 +49,7 @@
|
||||
// ...
|
||||
// GLSLANG_WEB_EXCLUDE_OFF
|
||||
//
|
||||
// Will be exluded from the grammar when m4 is executed as:
|
||||
// Will be excluded from the grammar when m4 is executed as:
|
||||
//
|
||||
// m4 -P -DGLSLANG_WEB
|
||||
//
|
||||
@ -277,7 +277,7 @@ GLSLANG_WEB_EXCLUDE_OFF
|
||||
%token <lex> CENTROID IN OUT INOUT
|
||||
%token <lex> STRUCT VOID WHILE
|
||||
%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
|
||||
%token <lex> UNIFORM SHARED
|
||||
%token <lex> UNIFORM SHARED BUFFER
|
||||
%token <lex> FLAT SMOOTH LAYOUT
|
||||
|
||||
GLSLANG_WEB_EXCLUDE_ON
|
||||
@ -285,7 +285,7 @@ GLSLANG_WEB_EXCLUDE_ON
|
||||
%token <lex> INT64CONSTANT UINT64CONSTANT
|
||||
%token <lex> SUBROUTINE DEMOTE
|
||||
%token <lex> PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV
|
||||
%token <lex> PATCH SAMPLE BUFFER NONUNIFORM
|
||||
%token <lex> PATCH SAMPLE NONUNIFORM
|
||||
%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT
|
||||
%token <lex> SUBGROUPCOHERENT NONPRIVATE
|
||||
%token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV
|
||||
@ -1368,12 +1368,12 @@ storage_qualifier
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.storage = EvqShared;
|
||||
}
|
||||
GLSLANG_WEB_EXCLUDE_ON
|
||||
| BUFFER {
|
||||
parseContext.globalCheck($1.loc, "buffer");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.storage = EvqBuffer;
|
||||
}
|
||||
GLSLANG_WEB_EXCLUDE_ON
|
||||
| ATTRIBUTE {
|
||||
parseContext.requireStage($1.loc, EShLangVertex, "attribute");
|
||||
parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute");
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
//
|
||||
// Do not edit the .y file, only edit the .m4 file.
|
||||
// The .y bison file is not a source file, it is a derivitive of the .m4 file.
|
||||
// The .y bison file is not a source file, it is a derivative of the .m4 file.
|
||||
// The m4 file needs to be processed by m4 to generate the .y bison file.
|
||||
//
|
||||
// Code sandwiched between a pair:
|
||||
@ -49,7 +49,7 @@
|
||||
// ...
|
||||
// GLSLANG_WEB_EXCLUDE_OFF
|
||||
//
|
||||
// Will be exluded from the grammar when m4 is executed as:
|
||||
// Will be excluded from the grammar when m4 is executed as:
|
||||
//
|
||||
// m4 -P -DGLSLANG_WEB
|
||||
//
|
||||
@ -194,7 +194,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
||||
%token <lex> CENTROID IN OUT INOUT
|
||||
%token <lex> STRUCT VOID WHILE
|
||||
%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
|
||||
%token <lex> UNIFORM SHARED
|
||||
%token <lex> UNIFORM SHARED BUFFER
|
||||
%token <lex> FLAT SMOOTH LAYOUT
|
||||
|
||||
|
||||
@ -1164,6 +1164,11 @@ storage_qualifier
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.storage = EvqShared;
|
||||
}
|
||||
| BUFFER {
|
||||
parseContext.globalCheck($1.loc, "buffer");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.storage = EvqBuffer;
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -182,9 +182,10 @@ extern int yydebug;
|
||||
DEFAULT = 392,
|
||||
UNIFORM = 393,
|
||||
SHARED = 394,
|
||||
FLAT = 395,
|
||||
SMOOTH = 396,
|
||||
LAYOUT = 397
|
||||
BUFFER = 395,
|
||||
FLAT = 396,
|
||||
SMOOTH = 397,
|
||||
LAYOUT = 398
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -229,7 +230,7 @@ union YYSTYPE
|
||||
glslang::TArraySizes* typeParameters;
|
||||
} interm;
|
||||
|
||||
#line 233 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */
|
||||
#line 234 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */
|
||||
};
|
||||
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user