|
@@ -163,8 +163,9 @@ inline bool isExternalVar(const VarDecl *var) {
|
|
|
// groupshared variables are allowed to be declared as "static". But we still
|
|
|
// need to put them in the Workgroup storage class. That is, when seeing
|
|
|
// "static groupshared", ignore "static".
|
|
|
- return var->hasExternalFormalLinkage() ? !var->isStaticDataMember()
|
|
|
- : var->getAttr<HLSLGroupSharedAttr>();
|
|
|
+ return var->hasExternalFormalLinkage()
|
|
|
+ ? !var->isStaticDataMember()
|
|
|
+ : (var->getAttr<HLSLGroupSharedAttr>() != nullptr);
|
|
|
}
|
|
|
|
|
|
/// Returns the referenced variable's DeclContext if the given expr is
|
|
@@ -2756,7 +2757,9 @@ uint32_t SPIRVEmitter::processGetSamplePosition(const CXXMemberCallExpr *expr) {
|
|
|
|
|
|
SpirvEvalInfo SPIRVEmitter::processSubpassLoad(const CXXMemberCallExpr *expr) {
|
|
|
const auto *object = expr->getImplicitObjectArgument()->IgnoreParens();
|
|
|
- const uint32_t sample = expr->getNumArgs() == 1 ? doExpr(expr->getArg(0)) : 0;
|
|
|
+ const uint32_t sample = expr->getNumArgs() == 1
|
|
|
+ ? static_cast<uint32_t>(doExpr(expr->getArg(0)))
|
|
|
+ : 0;
|
|
|
const uint32_t zero = theBuilder.getConstantInt32(0);
|
|
|
const uint32_t location = theBuilder.getConstantComposite(
|
|
|
theBuilder.getVecType(theBuilder.getInt32Type(), 2), {zero, zero});
|
|
@@ -2980,7 +2983,8 @@ uint32_t SPIRVEmitter::processTextureGatherRGBACmpRGBA(
|
|
|
const auto image = loadIfGLValue(imageExpr);
|
|
|
const auto sampler = doExpr(expr->getArg(0));
|
|
|
const uint32_t coordinate = doExpr(expr->getArg(1));
|
|
|
- const uint32_t compareVal = isCmp ? doExpr(expr->getArg(2)) : 0;
|
|
|
+ const uint32_t compareVal =
|
|
|
+ isCmp ? static_cast<uint32_t>(doExpr(expr->getArg(2))) : 0;
|
|
|
|
|
|
// Handle offsets (if any).
|
|
|
bool needsEmulation = false;
|
|
@@ -3009,7 +3013,9 @@ uint32_t SPIRVEmitter::processTextureGatherRGBACmpRGBA(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- const auto status = hasStatusArg ? doExpr(expr->getArg(numArgs - 1)) : 0;
|
|
|
+ const auto status =
|
|
|
+ hasStatusArg ? static_cast<uint32_t>(doExpr(expr->getArg(numArgs - 1)))
|
|
|
+ : 0;
|
|
|
const bool isNonUniform = image.isNonUniform() || sampler.isNonUniform();
|
|
|
|
|
|
if (needsEmulation) {
|
|
@@ -3074,7 +3080,9 @@ uint32_t SPIRVEmitter::processTextureGatherCmp(const CXXMemberCallExpr *expr) {
|
|
|
|
|
|
const auto retType = typeTranslator.translateType(callee->getReturnType());
|
|
|
const auto imageType = typeTranslator.translateType(imageExpr->getType());
|
|
|
- const auto status = hasStatusArg ? doExpr(expr->getArg(numArgs - 1)) : 0;
|
|
|
+ const auto status =
|
|
|
+ hasStatusArg ? static_cast<uint32_t>(doExpr(expr->getArg(numArgs - 1)))
|
|
|
+ : 0;
|
|
|
|
|
|
return theBuilder.createImageGather(
|
|
|
retType, imageType, image, sampler,
|
|
@@ -3937,7 +3945,9 @@ uint32_t SPIRVEmitter::processTextureSampleGather(const CXXMemberCallExpr *expr,
|
|
|
else if (numArgs > 3 && expr->getArg(3)->getType()->isFloatingType())
|
|
|
clamp = doExpr(expr->getArg(3));
|
|
|
const bool hasClampArg = (clamp != 0);
|
|
|
- const auto status = hasStatusArg ? doExpr(expr->getArg(numArgs - 1)) : 0;
|
|
|
+ const auto status =
|
|
|
+ hasStatusArg ? static_cast<uint32_t>(doExpr(expr->getArg(numArgs - 1)))
|
|
|
+ : 0;
|
|
|
|
|
|
// Subtract 1 for status (if it exists), subtract 1 for clamp (if it exists),
|
|
|
// and subtract 2 for sampler_state and location.
|
|
@@ -4006,7 +4016,9 @@ SPIRVEmitter::processTextureSampleBiasLevel(const CXXMemberCallExpr *expr,
|
|
|
const auto numArgs = expr->getNumArgs();
|
|
|
const bool hasStatusArg =
|
|
|
expr->getArg(numArgs - 1)->getType()->isUnsignedIntegerType();
|
|
|
- const auto status = hasStatusArg ? doExpr(expr->getArg(numArgs - 1)) : 0;
|
|
|
+ const auto status =
|
|
|
+ hasStatusArg ? static_cast<uint32_t>(doExpr(expr->getArg(numArgs - 1)))
|
|
|
+ : 0;
|
|
|
|
|
|
uint32_t clamp = 0;
|
|
|
// The .SampleLevel() methods do not take the clamp argument.
|
|
@@ -4070,7 +4082,9 @@ uint32_t SPIRVEmitter::processTextureSampleGrad(const CXXMemberCallExpr *expr) {
|
|
|
const auto numArgs = expr->getNumArgs();
|
|
|
const bool hasStatusArg =
|
|
|
expr->getArg(numArgs - 1)->getType()->isUnsignedIntegerType();
|
|
|
- const auto status = hasStatusArg ? doExpr(expr->getArg(numArgs - 1)) : 0;
|
|
|
+ const auto status =
|
|
|
+ hasStatusArg ? static_cast<uint32_t>(doExpr(expr->getArg(numArgs - 1)))
|
|
|
+ : 0;
|
|
|
|
|
|
uint32_t clamp = 0;
|
|
|
if (numArgs > 4 && expr->getArg(4)->getType()->isFloatingType())
|
|
@@ -4154,7 +4168,9 @@ SPIRVEmitter::processTextureSampleCmpCmpLevelZero(const CXXMemberCallExpr *expr,
|
|
|
const auto numArgs = expr->getNumArgs();
|
|
|
const bool hasStatusArg =
|
|
|
expr->getArg(numArgs - 1)->getType()->isUnsignedIntegerType();
|
|
|
- const auto status = hasStatusArg ? doExpr(expr->getArg(numArgs - 1)) : 0;
|
|
|
+ const auto status =
|
|
|
+ hasStatusArg ? static_cast<uint32_t>(doExpr(expr->getArg(numArgs - 1)))
|
|
|
+ : 0;
|
|
|
|
|
|
uint32_t clamp = 0;
|
|
|
// The .SampleCmpLevelZero() methods do not take the clamp argument.
|
|
@@ -4249,7 +4265,9 @@ SPIRVEmitter::processBufferTextureLoad(const CXXMemberCallExpr *expr) {
|
|
|
const bool isTextureMS = TypeTranslator::isTextureMS(objectType);
|
|
|
const bool hasStatusArg =
|
|
|
expr->getArg(numArgs - 1)->getType()->isUnsignedIntegerType();
|
|
|
- const auto status = hasStatusArg ? doExpr(expr->getArg(numArgs - 1)) : 0;
|
|
|
+ const auto status =
|
|
|
+ hasStatusArg ? static_cast<uint32_t>(doExpr(expr->getArg(numArgs - 1)))
|
|
|
+ : 0;
|
|
|
|
|
|
if (TypeTranslator::isBuffer(objectType) ||
|
|
|
TypeTranslator::isRWBuffer(objectType) ||
|
|
@@ -5622,8 +5640,9 @@ SPIRVEmitter::tryToAssignToVectorElements(const Expr *lhs,
|
|
|
}
|
|
|
|
|
|
const auto vec1 = doExpr(base);
|
|
|
- const uint32_t vec1Val =
|
|
|
- vec1.isRValue() ? vec1 : theBuilder.createLoad(baseTypeId, vec1);
|
|
|
+ const uint32_t vec1Val = vec1.isRValue()
|
|
|
+ ? static_cast<uint32_t>(vec1)
|
|
|
+ : theBuilder.createLoad(baseTypeId, vec1);
|
|
|
const uint32_t shuffle =
|
|
|
theBuilder.createVectorShuffle(baseTypeId, vec1Val, rhs, selectors);
|
|
|
|