GLSL 4.6: Implement atomic counter ops and SPV_KHR_shader_atomic_counter_ops.
This commit is contained in:
@@ -1745,6 +1745,20 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
||||
atomic = true;
|
||||
break;
|
||||
|
||||
case glslang::EOpAtomicCounterAdd:
|
||||
case glslang::EOpAtomicCounterSubtract:
|
||||
case glslang::EOpAtomicCounterMin:
|
||||
case glslang::EOpAtomicCounterMax:
|
||||
case glslang::EOpAtomicCounterAnd:
|
||||
case glslang::EOpAtomicCounterOr:
|
||||
case glslang::EOpAtomicCounterXor:
|
||||
case glslang::EOpAtomicCounterExchange:
|
||||
case glslang::EOpAtomicCounterCompSwap:
|
||||
builder.addExtension("SPV_KHR_shader_atomic_counter_ops");
|
||||
builder.addCapability(spv::CapabilityAtomicStorageOps);
|
||||
atomic = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1815,6 +1829,15 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
||||
case glslang::EOpAtomicXor:
|
||||
case glslang::EOpAtomicExchange:
|
||||
case glslang::EOpAtomicCompSwap:
|
||||
case glslang::EOpAtomicCounterAdd:
|
||||
case glslang::EOpAtomicCounterSubtract:
|
||||
case glslang::EOpAtomicCounterMin:
|
||||
case glslang::EOpAtomicCounterMax:
|
||||
case glslang::EOpAtomicCounterAnd:
|
||||
case glslang::EOpAtomicCounterOr:
|
||||
case glslang::EOpAtomicCounterXor:
|
||||
case glslang::EOpAtomicCounterExchange:
|
||||
case glslang::EOpAtomicCounterCompSwap:
|
||||
if (arg == 0)
|
||||
lvalue = true;
|
||||
break;
|
||||
@@ -4619,34 +4642,45 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv
|
||||
switch (op) {
|
||||
case glslang::EOpAtomicAdd:
|
||||
case glslang::EOpImageAtomicAdd:
|
||||
case glslang::EOpAtomicCounterAdd:
|
||||
opCode = spv::OpAtomicIAdd;
|
||||
break;
|
||||
case glslang::EOpAtomicCounterSubtract:
|
||||
opCode = spv::OpAtomicISub;
|
||||
break;
|
||||
case glslang::EOpAtomicMin:
|
||||
case glslang::EOpImageAtomicMin:
|
||||
case glslang::EOpAtomicCounterMin:
|
||||
opCode = typeProxy == glslang::EbtUint ? spv::OpAtomicUMin : spv::OpAtomicSMin;
|
||||
break;
|
||||
case glslang::EOpAtomicMax:
|
||||
case glslang::EOpImageAtomicMax:
|
||||
case glslang::EOpAtomicCounterMax:
|
||||
opCode = typeProxy == glslang::EbtUint ? spv::OpAtomicUMax : spv::OpAtomicSMax;
|
||||
break;
|
||||
case glslang::EOpAtomicAnd:
|
||||
case glslang::EOpImageAtomicAnd:
|
||||
case glslang::EOpAtomicCounterAnd:
|
||||
opCode = spv::OpAtomicAnd;
|
||||
break;
|
||||
case glslang::EOpAtomicOr:
|
||||
case glslang::EOpImageAtomicOr:
|
||||
case glslang::EOpAtomicCounterOr:
|
||||
opCode = spv::OpAtomicOr;
|
||||
break;
|
||||
case glslang::EOpAtomicXor:
|
||||
case glslang::EOpImageAtomicXor:
|
||||
case glslang::EOpAtomicCounterXor:
|
||||
opCode = spv::OpAtomicXor;
|
||||
break;
|
||||
case glslang::EOpAtomicExchange:
|
||||
case glslang::EOpImageAtomicExchange:
|
||||
case glslang::EOpAtomicCounterExchange:
|
||||
opCode = spv::OpAtomicExchange;
|
||||
break;
|
||||
case glslang::EOpAtomicCompSwap:
|
||||
case glslang::EOpImageAtomicCompSwap:
|
||||
case glslang::EOpAtomicCounterCompSwap:
|
||||
opCode = spv::OpAtomicCompareExchange;
|
||||
break;
|
||||
case glslang::EOpAtomicCounterIncrement:
|
||||
|
||||
Reference in New Issue
Block a user