In SPIRVCodeGenerator, use the Program's ModifiersPool
We were passing in the IR generator's which had already been reset, so technically belonged to the *next* Program to be compiled. Change-Id: Ib68c283591f02d1642bb7c2d9658f5caa76b0f15 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324700 Commit-Queue: Brian Osman <brianosman@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Auto-Submit: Brian Osman <brianosman@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
parent
141d35cdec
commit
8b43dadea2
@ -1609,7 +1609,6 @@ bool Compiler::optimize(Program& program) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
program.finish();
|
||||
return fErrorCount == 0;
|
||||
}
|
||||
|
||||
@ -1619,7 +1618,7 @@ bool Compiler::toSPIRV(Program& program, OutputStream& out) {
|
||||
#ifdef SK_ENABLE_SPIRV_VALIDATION
|
||||
StringStream buffer;
|
||||
fSource = program.fSource.get();
|
||||
SPIRVCodeGenerator cg(fContext.get(), fIRGenerator->fModifiers.get(), &program, this, &buffer);
|
||||
SPIRVCodeGenerator cg(fContext.get(), &program, this, &buffer);
|
||||
bool result = cg.generateCode();
|
||||
fSource = nullptr;
|
||||
if (result) {
|
||||
@ -1637,7 +1636,7 @@ bool Compiler::toSPIRV(Program& program, OutputStream& out) {
|
||||
}
|
||||
#else
|
||||
fSource = program.fSource.get();
|
||||
SPIRVCodeGenerator cg(fContext.get(), fIRGenerator->fModifiers.get(), &program, this, &out);
|
||||
SPIRVCodeGenerator cg(fContext.get(), &program, this, &out);
|
||||
bool result = cg.generateCode();
|
||||
fSource = nullptr;
|
||||
#endif
|
||||
|
@ -59,10 +59,6 @@ public:
|
||||
return Handle(this, index);
|
||||
}
|
||||
|
||||
void finish() {
|
||||
fModifiersMap.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<Modifiers> fModifiers;
|
||||
std::unordered_map<Modifiers, int> fModifiersMap;
|
||||
|
@ -1879,7 +1879,7 @@ SpvId SPIRVCodeGenerator::writeVariableReference(const VariableReference& ref, O
|
||||
Modifiers modifiers(layout, Modifiers::kUniform_Flag);
|
||||
const Variable* intfVar = fSynthetics.takeOwnershipOfSymbol(
|
||||
std::make_unique<Variable>(/*offset=*/-1,
|
||||
fModifiers.handle(modifiers),
|
||||
fProgram.fModifiers->handle(modifiers),
|
||||
name,
|
||||
&intfStruct,
|
||||
/*builtin=*/false,
|
||||
|
@ -104,19 +104,20 @@ public:
|
||||
virtual void store(SpvId value, OutputStream& out) = 0;
|
||||
};
|
||||
|
||||
SPIRVCodeGenerator(const Context* context, ModifiersPool* modifiers,
|
||||
const Program* program, ErrorReporter* errors, OutputStream* out)
|
||||
: INHERITED(program, errors, out)
|
||||
, fContext(*context)
|
||||
, fModifiers(*modifiers)
|
||||
, fDefaultLayout(MemoryLayout::k140_Standard)
|
||||
, fCapabilities(0)
|
||||
, fIdCount(1)
|
||||
, fBoolTrue(0)
|
||||
, fBoolFalse(0)
|
||||
, fSetupFragPosition(false)
|
||||
, fCurrentBlock(0)
|
||||
, fSynthetics(errors) {
|
||||
SPIRVCodeGenerator(const Context* context,
|
||||
const Program* program,
|
||||
ErrorReporter* errors,
|
||||
OutputStream* out)
|
||||
: INHERITED(program, errors, out)
|
||||
, fContext(*context)
|
||||
, fDefaultLayout(MemoryLayout::k140_Standard)
|
||||
, fCapabilities(0)
|
||||
, fIdCount(1)
|
||||
, fBoolTrue(0)
|
||||
, fBoolFalse(0)
|
||||
, fSetupFragPosition(false)
|
||||
, fCurrentBlock(0)
|
||||
, fSynthetics(errors) {
|
||||
this->setupIntrinsics();
|
||||
}
|
||||
|
||||
@ -367,7 +368,6 @@ private:
|
||||
void writeGeometryShaderExecutionMode(SpvId entryPoint, OutputStream& out);
|
||||
|
||||
const Context& fContext;
|
||||
ModifiersPool& fModifiers;
|
||||
const MemoryLayout fDefaultLayout;
|
||||
|
||||
uint64_t fCapabilities;
|
||||
|
@ -177,10 +177,6 @@ struct Program {
|
||||
|
||||
const std::vector<std::unique_ptr<ProgramElement>>& elements() const { return fElements; }
|
||||
|
||||
void finish() {
|
||||
fModifiers->finish();
|
||||
}
|
||||
|
||||
Kind fKind;
|
||||
std::unique_ptr<String> fSource;
|
||||
Settings fSettings;
|
||||
@ -195,6 +191,7 @@ private:
|
||||
std::unique_ptr<ModifiersPool> fModifiers;
|
||||
|
||||
friend class Compiler;
|
||||
friend class SPIRVCodeGenerator; // fModifiers
|
||||
};
|
||||
|
||||
} // namespace SkSL
|
||||
|
Loading…
Reference in New Issue
Block a user