added SPIR-V RelaxedPrecision
Bug: skia:5524 Change-Id: I716b6bb8da95acb72ba71d083eb8b40cafbc6af8 Reviewed-on: https://skia-review.googlesource.com/19266 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
parent
b310fd597f
commit
a51d7137ec
@ -2599,6 +2599,13 @@ SpvId SPIRVCodeGenerator::writeInterfaceBlock(const InterfaceBlock& intf) {
|
||||
return result;
|
||||
}
|
||||
|
||||
void SPIRVCodeGenerator::writePrecisionModifier(const Modifiers& modifiers, SpvId id) {
|
||||
if ((modifiers.fFlags & Modifiers::kLowp_Flag) |
|
||||
(modifiers.fFlags & Modifiers::kMediump_Flag)) {
|
||||
this->writeInstruction(SpvOpDecorate, id, SpvDecorationRelaxedPrecision, fDecorationBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
#define BUILTIN_IGNORE 9999
|
||||
void SPIRVCodeGenerator::writeGlobalVars(Program::Kind kind, const VarDeclarations& decl,
|
||||
OutputStream& out) {
|
||||
@ -2650,6 +2657,7 @@ void SPIRVCodeGenerator::writeGlobalVars(Program::Kind kind, const VarDeclaratio
|
||||
SpvId type = this->getPointerType(var->fType, storageClass);
|
||||
this->writeInstruction(SpvOpVariable, type, id, storageClass, fConstantBuffer);
|
||||
this->writeInstruction(SpvOpName, id, var->fName.c_str(), fNameBuffer);
|
||||
this->writePrecisionModifier(var->fModifiers, id);
|
||||
if (var->fType.kind() == Type::kMatrix_Kind) {
|
||||
this->writeInstruction(SpvOpMemberDecorate, id, (SpvId) i, SpvDecorationColMajor,
|
||||
fDecorationBuffer);
|
||||
|
@ -111,6 +111,8 @@ private:
|
||||
SpvId getPointerType(const Type& type, const MemoryLayout& layout,
|
||||
SpvStorageClass_ storageClass);
|
||||
|
||||
void writePrecisionModifier(const Modifiers& modifiers, SpvId id);
|
||||
|
||||
std::vector<SpvId> getAccessChain(const Expression& expr, OutputStream& out);
|
||||
|
||||
void writeLayout(const Layout& layout, SpvId target);
|
||||
|
Loading…
Reference in New Issue
Block a user