Revert "New approach to GrProcessor uniforms."
This reverts commit 10c9f36bddc88590cf535a7833eb6a0c95eda3c5.
Reason for revert:bad gms, maybe blocking chrome roll
Original change's description:
> New approach to GrProcessor uniforms.
>
> The important aspect is that it allows knowing the uniforms that will
> be used by a set of processors without having to create ProgramImpls.
>
> GrProcessor subclasses specify uniforms at creation time in a similar
> style to how GrGeometryProcessors already specify attributes. That is,
> they initialize a span of structs describing the uniform which may
> contain void uniforms that are skipped. Unlike attributes, the struct
> contains an offset into the processor where the data is stored.
>
> GrUniformAggregator is used to collect the uniforms from all processors
> that compose a draw and mangle their names. The ProgramImpl subclasses
> query the aggregator for their uniform names when emitting code.
>
> The old system for uniforms is left intact and only three processors,
> one GP, one FP, and one XP, are updated to use the new system.
>
> Some pieces that are missing before everything can be moved over:
> -support for uniforms not owned by GrProcessor (e.g. rt-adjust)
> -support for samplers
> -helpers for common patterns
> (e.g. GrGeometryProcessor::ProgramImpl::setupUniformColor(),
> and the various matrix helpers on ProgramImpl)
>
> Bug: skia:12182
>
> Change-Id: I21c1b7a8940eb9b8aad003f5a2569e43977a33d2
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440841
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
Bug: skia:12182
Change-Id: I6cc508900a599d27124f8ba48597593192d5d807
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448418
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
diff --git a/src/gpu/GrSPIRVUniformHandler.cpp b/src/gpu/GrSPIRVUniformHandler.cpp
index 90505e6..f073496 100644
--- a/src/gpu/GrSPIRVUniformHandler.cpp
+++ b/src/gpu/GrSPIRVUniformHandler.cpp
@@ -293,37 +293,7 @@
return fSamplerSwizzles[handle.toIndex()];
}
-GrUniformDataManager::ProgramUniforms GrSPIRVUniformHandler::getNewProgramUniforms(
- const GrUniformAggregator& aggregator) {
- GrUniformDataManager::ProgramUniforms result;
- result.reserve(aggregator.numProcessors());
- for (int p = 0; p < aggregator.numProcessors(); ++p) {
- GrUniformDataManager::ProcessorUniforms uniforms;
- auto records = aggregator.processorRecords(p);
- uniforms.reserve(records.size());
- for (const GrUniformAggregator::Record& record : records) {
- const GrProcessor::Uniform& u = record.uniform();
- uint32_t offset = get_ubo_offset(&fCurrentUBOOffset, u.type(), u.count());
- uniforms.push_back({record.indexInProcessor, u.type(), u.count(), offset});
-
- // Add to fNewUniforms so that these get declared.
- SPIRVUniformInfo& info = fNewUniforms.push_back();
- GrShaderVar var(record.name, u.type(), u.count());
- SkString qualifier = SkStringPrintf("offset = %d", offset);
- var.addLayoutQualifier(qualifier.c_str());
- info.fUBOOffset = offset;
- info.fVariable = var;
- info.fVisibility = u.visibility();
- info.fOwner = nullptr;
- }
- result.push_back(std::move(uniforms));
- }
- return result;
-}
-
-void GrSPIRVUniformHandler::appendUniformDecls(const GrUniformAggregator&,
- GrShaderFlags visibility,
- SkString* out) const {
+void GrSPIRVUniformHandler::appendUniformDecls(GrShaderFlags visibility, SkString* out) const {
auto textures = fTextures.items().begin();
for (const SPIRVUniformInfo& sampler : fSamplers.items()) {
if (sampler.fVisibility & visibility) {
@@ -341,12 +311,6 @@
uniformsString.append(";\n");
}
}
- for (const UniformInfo& uniform : fNewUniforms.items()) {
- if (uniform.fVisibility & visibility) {
- uniform.fVariable.appendDecl(fProgramBuilder->shaderCaps(), &uniformsString);
- uniformsString.append(";\n");
- }
- }
if (!uniformsString.isEmpty()) {
out->appendf("layout (set = %d, binding = %d) uniform UniformBuffer\n{\n",
kUniformDescriptorSet, kUniformBinding);