Fix bugs related to varying pointers to functions that return void.

This commit is contained in:
Matt Pharr
2012-05-23 14:29:17 -07:00
parent e8858150cb
commit 2c5a57e386
2 changed files with 11 additions and 6 deletions

View File

@@ -3243,7 +3243,8 @@ FunctionEmitContext::CallInst(llvm::Value *func, const FunctionType *funcType,
// Now, do a masked store into the memory allocated to // Now, do a masked store into the memory allocated to
// accumulate the result using the call mask. // accumulate the result using the call mask.
if (callResult != NULL) { if (callResult != NULL &&
callResult->getType() != LLVMTypes::VoidType) {
Assert(resultPtr != NULL); Assert(resultPtr != NULL);
StoreInst(callResult, resultPtr, callMask, returnType, StoreInst(callResult, resultPtr, callMask, returnType,
PointerType::GetUniform(returnType)); PointerType::GetUniform(returnType));

View File

@@ -3586,11 +3586,15 @@ FunctionCallExpr::TypeCheck() {
Assert(funcType->GetParameterDefault(i) != NULL); Assert(funcType->GetParameterDefault(i) != NULL);
} }
if (fptrType->IsVaryingType() && if (fptrType->IsVaryingType()) {
funcType->GetReturnType()->IsUniformType()) { const Type *retType = funcType->GetReturnType();
Error(pos, "Illegal to call a varying function pointer that " if (Type::Equal(retType, AtomicType::Void) == false &&
"points to a function with a uniform return type."); retType->IsUniformType()) {
return NULL; Error(pos, "Illegal to call a varying function pointer that "
"points to a function with a uniform return type \"%s\".",
funcType->GetReturnType()->GetString().c_str());
return NULL;
}
} }
} }