Move GrShaderVar to an appending model for layout qualifiers
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5144 Change-Id: I05e88961e50bd679cfe5863f413f3ec65bc9fd95 Reviewed-on: https://skia-review.googlesource.com/5144 Reviewed-by: Greg Daniel <egdaniel@google.com> Reviewed-by: Chris Dalton <csmartdalton@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
cb5338cadc
commit
6039768963
@ -271,10 +271,17 @@ public:
|
||||
void setPrecision(GrSLPrecision p) { fPrecision = p; }
|
||||
|
||||
/**
|
||||
* Set the layout qualifier
|
||||
* Appends to the layout qualifier
|
||||
*/
|
||||
void setLayoutQualifier(const char* layoutQualifier) {
|
||||
fLayoutQualifier = layoutQualifier;
|
||||
void addLayoutQualifier(const char* layoutQualifier) {
|
||||
if (!layoutQualifier || !strlen(layoutQualifier)) {
|
||||
return;
|
||||
}
|
||||
if (fLayoutQualifier.isEmpty()) {
|
||||
fLayoutQualifier = layoutQualifier;
|
||||
} else {
|
||||
fLayoutQualifier.appendf(", %s", layoutQualifier);
|
||||
}
|
||||
}
|
||||
|
||||
void addModifier(const char* modifier) {
|
||||
|
@ -54,11 +54,11 @@ const GrGLSLCaps* GrVkPipelineStateBuilder::glslCaps() const {
|
||||
}
|
||||
|
||||
void GrVkPipelineStateBuilder::finalizeFragmentOutputColor(GrShaderVar& outputColor) {
|
||||
outputColor.setLayoutQualifier("location = 0, index = 0");
|
||||
outputColor.addLayoutQualifier("location = 0, index = 0");
|
||||
}
|
||||
|
||||
void GrVkPipelineStateBuilder::finalizeFragmentSecondaryColor(GrShaderVar& outputColor) {
|
||||
outputColor.setLayoutQualifier("location = 0, index = 1");
|
||||
outputColor.addLayoutQualifier("location = 0, index = 1");
|
||||
}
|
||||
|
||||
bool GrVkPipelineStateBuilder::CreateVkShaderModule(const GrVkGpu* gpu,
|
||||
|
@ -189,7 +189,7 @@ GrGLSLUniformHandler::SamplerHandle GrVkUniformHandler::addSampler(uint32_t visi
|
||||
info.fVariable.setName(mangleName);
|
||||
SkString layoutQualifier;
|
||||
layoutQualifier.appendf("set=%d, binding=%d", kSamplerDescSet, fSamplers.count() - 1);
|
||||
info.fVariable.setLayoutQualifier(layoutQualifier.c_str());
|
||||
info.fVariable.addLayoutQualifier(layoutQualifier.c_str());
|
||||
info.fVisibility = visibility;
|
||||
info.fUBOffset = 0;
|
||||
fSamplerSwizzles.push_back(swizzle);
|
||||
|
@ -58,7 +58,7 @@ void finalize_helper(GrVkVaryingHandler::VarArray& vars) {
|
||||
GrShaderVar& var = vars[i];
|
||||
SkString location;
|
||||
location.appendf("location = %d", locationIndex);
|
||||
var.setLayoutQualifier(location.c_str());
|
||||
var.addLayoutQualifier(location.c_str());
|
||||
|
||||
int elementSize = grsltype_to_location_size(var.getType());
|
||||
SkASSERT(elementSize);
|
||||
|
Loading…
Reference in New Issue
Block a user