fix SkSL SPIR-V geometry shaders' entry point declaration

Bug: skia:
Change-Id: I5cd5a35fe1a554b127548a7809c106de70df0be7
Reviewed-on: https://skia-review.googlesource.com/114785
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
Ethan Nicholas 2018-03-16 12:20:54 -04:00 committed by Skia Commit-Bot
parent 2ab6f7e580
commit 16c1196ea6
4 changed files with 11 additions and 7 deletions

View File

@ -24,6 +24,7 @@
#define SK_OUTCOLOR_BUILTIN 10004
#define SK_TRANSFORMEDCOORDS2D_BUILTIN 10005
#define SK_TEXTURESAMPLERS_BUILTIN 10006
#define SK_OUT_BUILTIN 10007
#define SK_FRAGCOORD_BUILTIN 15
#define SK_VERTEXID_BUILTIN 5
#define SK_INSTANCEID_BUILTIN 6

View File

@ -2436,7 +2436,7 @@ void SPIRVCodeGenerator::writeLayout(const Layout& layout, SpvId target) {
fCapabilities |= (((uint64_t) 1) << SpvCapabilityInputAttachment);
}
if (layout.fBuiltin >= 0 && layout.fBuiltin != SK_FRAGCOLOR_BUILTIN &&
layout.fBuiltin != SK_IN_BUILTIN) {
layout.fBuiltin != SK_IN_BUILTIN && layout.fBuiltin != SK_OUT_BUILTIN) {
this->writeInstruction(SpvOpDecorate, target, SpvDecorationBuiltIn, layout.fBuiltin,
fDecorationBuffer);
}
@ -2949,8 +2949,9 @@ void SPIRVCodeGenerator::writeInstructions(const Program& program, OutputStream&
intf.fSizes.emplace_back(new IntLiteral(fContext, -1, skInSize));
}
SpvId id = this->writeInterfaceBlock(intf);
if ((intf.fVariable.fModifiers.fFlags & Modifiers::kIn_Flag) ||
(intf.fVariable.fModifiers.fFlags & Modifiers::kOut_Flag)) {
if (((intf.fVariable.fModifiers.fFlags & Modifiers::kIn_Flag) ||
(intf.fVariable.fModifiers.fFlags & Modifiers::kOut_Flag)) &&
intf.fVariable.fModifiers.fLayout.fBuiltin == -1) {
interfaceVars.insert(id);
}
}
@ -2976,8 +2977,10 @@ void SPIRVCodeGenerator::writeInstructions(const Program& program, OutputStream&
for (auto entry : fVariableMap) {
const Variable* var = entry.first;
if (var->fStorage == Variable::kGlobal_Storage &&
((var->fModifiers.fFlags & Modifiers::kIn_Flag) ||
(var->fModifiers.fFlags & Modifiers::kOut_Flag))) {
((var->fModifiers.fFlags & Modifiers::kIn_Flag) ||
(var->fModifiers.fFlags & Modifiers::kOut_Flag)) &&
var->fModifiers.fLayout.fBuiltin != SK_IN_BUILTIN &&
var->fModifiers.fLayout.fBuiltin != SK_OUT_BUILTIN) {
interfaceVars.insert(entry.second);
}
}

View File

@ -79,7 +79,7 @@ static const Type& get_type(const Context& context, Expression& value, size_t co
}
/**
* Represents a vector swizzle operation such as 'float21, 2, 3).zyx'.
* Represents a vector swizzle operation such as 'float2(1, 2, 3).zyx'.
*/
struct Swizzle : public Expression {
Swizzle(const Context& context, std::unique_ptr<Expression> base, std::vector<int> components)

View File

@ -8,7 +8,7 @@ layout(builtin=10002) in sk_PerVertex {
layout(builtin=3) float sk_ClipDistance[1];
} sk_in[];
out sk_PerVertex {
layout(builtin=10007) out sk_PerVertex {
layout(builtin=0) float4 sk_Position;
layout(builtin=1) float sk_PointSize;
layout(builtin=3) float sk_ClipDistance[1];