From 2c0a6d7f695d69e76be69600a7017794073b2808 Mon Sep 17 00:00:00 2001 From: jbrodman Date: Mon, 24 Mar 2014 00:01:37 -0700 Subject: [PATCH] Fix exported varying bug & backwards compatibility. --- module.cpp | 7 ++++++- type.cpp | 10 +++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/module.cpp b/module.cpp index 0a79e736..1d92aaf4 100644 --- a/module.cpp +++ b/module.cpp @@ -1204,7 +1204,12 @@ lEmitStructDecl(const StructType *st, std::vector *emittedSt for (int i = 0; i < st->GetElementCount(); ++i) { const Type *type = st->GetElementType(i)->GetAsNonConstType(); std::string d = type->GetCDeclaration(st->GetElementName(i)); - fprintf(file, " %s;\n", d.c_str()); + if (type->IsVaryingType()) { + fprintf(file, " %s[%d];\n", d.c_str(), g->target->getVectorWidth()); + } + else { + fprintf(file, " %s;\n", d.c_str()); + } } fprintf(file, "};\n"); fprintf(file, "#endif\n\n"); diff --git a/type.cpp b/type.cpp index 5d0154aa..b6d504f2 100644 --- a/type.cpp +++ b/type.cpp @@ -1909,7 +1909,15 @@ StructType::StructType(const std::string &n, const llvm::SmallVector