Fix two compile time errors to allow SOA pointer and array be passed as function argument.
This commit is contained in:
2
decl.cpp
2
decl.cpp
@@ -456,7 +456,7 @@ Declarator::InitFromType(const Type *baseType, DeclSpecs *ds) {
|
||||
return;
|
||||
}
|
||||
|
||||
decl->type = PointerType::GetUniform(targetType);
|
||||
decl->type = PointerType::GetUniform(targetType, at->IsSOAType());
|
||||
|
||||
// Make sure there are no unsized arrays (other than the
|
||||
// first dimension) in function parameter lists.
|
||||
|
||||
@@ -808,7 +808,12 @@ Module::AddFunctionDeclaration(const std::string &name,
|
||||
// uniform pointers, since varying pointers are int vectors...)
|
||||
if (!functionType->isTask &&
|
||||
((CastType<PointerType>(argType) != NULL &&
|
||||
argType->IsUniformType()) ||
|
||||
argType->IsUniformType() &&
|
||||
// Exclude SOA argument because it is a pair {struct *, int}
|
||||
// instead of pointer
|
||||
!CastType<PointerType>(argType)->IsSlice())
|
||||
||
|
||||
|
||||
CastType<ReferenceType>(argType) != NULL)) {
|
||||
|
||||
// NOTE: LLVM indexes function parameters starting from 1.
|
||||
|
||||
4
type.cpp
4
type.cpp
@@ -874,8 +874,8 @@ PointerType::PointerType(const Type *t, Variability v, bool ic, bool is,
|
||||
|
||||
|
||||
PointerType *
|
||||
PointerType::GetUniform(const Type *t) {
|
||||
return new PointerType(t, Variability(Variability::Uniform), false);
|
||||
PointerType::GetUniform(const Type *t, bool is) {
|
||||
return new PointerType(t, Variability(Variability::Uniform), false, is);
|
||||
}
|
||||
|
||||
|
||||
|
||||
2
type.h
2
type.h
@@ -430,7 +430,7 @@ public:
|
||||
bool isSlice = false, bool frozen = false);
|
||||
|
||||
/** Helper method to return a uniform pointer to the given type. */
|
||||
static PointerType *GetUniform(const Type *t);
|
||||
static PointerType *GetUniform(const Type *t, bool isSlice = false);
|
||||
/** Helper method to return a varying pointer to the given type. */
|
||||
static PointerType *GetVarying(const Type *t);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user