aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2018-03-16 16:40:36 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-19 13:49:55 +0000
commit8d2ba44c9cba790cfd8ace80de9e15972bccbe5d (patch)
tree9b70ebe57967be852673947dd5d6b971d9c5ba8f /src/sksl
parent89b1456b552dda6207d5ca432047965f7041cc48 (diff)
SPIR-V output now always includes DescriptorSet for uniforms
Bug: skia: Change-Id: I6a31d6ec51d59340ef738c2bc4a8a88a261bef14 Reviewed-on: https://skia-review.googlesource.com/114865 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl')
-rw-r--r--src/sksl/SkSLSPIRVCodeGenerator.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/sksl/SkSLSPIRVCodeGenerator.cpp b/src/sksl/SkSLSPIRVCodeGenerator.cpp
index 6e008471ea..7d3726a8c1 100644
--- a/src/sksl/SkSLSPIRVCodeGenerator.cpp
+++ b/src/sksl/SkSLSPIRVCodeGenerator.cpp
@@ -2473,9 +2473,9 @@ SpvId SPIRVCodeGenerator::writeInterfaceBlock(const InterfaceBlock& intf) {
bool isBuffer = (0 != (intf.fVariable.fModifiers.fFlags & Modifiers::kBuffer_Flag));
bool pushConstant = (0 != (intf.fVariable.fModifiers.fLayout.fFlags &
Layout::kPushConstant_Flag));
- MemoryLayout layout = (pushConstant || isBuffer) ?
- MemoryLayout(MemoryLayout::k430_Standard) :
- fDefaultLayout;
+ MemoryLayout memoryLayout = (pushConstant || isBuffer) ?
+ MemoryLayout(MemoryLayout::k430_Standard) :
+ fDefaultLayout;
SpvId result = this->nextId();
const Type* type = &intf.fVariable.fType;
if (fProgram.fInputs.fRTHeight) {
@@ -2487,7 +2487,7 @@ SpvId SPIRVCodeGenerator::writeInterfaceBlock(const InterfaceBlock& intf) {
fields.emplace_back(Modifiers(), StringFragment(SKSL_RTHEIGHT_NAME), fContext.fFloat_Type.get());
type = new Type(type->fOffset, type->name(), fields);
}
- SpvId typeId = this->getType(*type, layout);
+ SpvId typeId = this->getType(*type, memoryLayout);
if (intf.fVariable.fModifiers.fFlags & Modifiers::kBuffer_Flag) {
this->writeInstruction(SpvOpDecorate, typeId, SpvDecorationBufferBlock, fDecorationBuffer);
} else {
@@ -2497,7 +2497,11 @@ SpvId SPIRVCodeGenerator::writeInterfaceBlock(const InterfaceBlock& intf) {
SpvId ptrType = this->nextId();
this->writeInstruction(SpvOpTypePointer, ptrType, storageClass, typeId, fConstantBuffer);
this->writeInstruction(SpvOpVariable, ptrType, result, storageClass, fConstantBuffer);
- this->writeLayout(intf.fVariable.fModifiers.fLayout, result);
+ Layout layout = intf.fVariable.fModifiers.fLayout;
+ if (intf.fVariable.fModifiers.fFlags & Modifiers::kUniform_Flag && layout.fSet == -1) {
+ layout.fSet = 0;
+ }
+ this->writeLayout(layout, result);
fVariableMap[&intf.fVariable] = result;
if (fProgram.fInputs.fRTHeight) {
delete type;