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/GrUniformDataManager.h b/src/gpu/GrUniformDataManager.h
index 9bb3539..b418960 100644
--- a/src/gpu/GrUniformDataManager.h
+++ b/src/gpu/GrUniformDataManager.h
@@ -8,41 +8,20 @@
#ifndef GrUniformDataManager_DEFINED
#define GrUniformDataManager_DEFINED
+#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
+
#include "include/private/GrTypesPriv.h"
#include "include/private/SkTArray.h"
#include "src/core/SkAutoMalloc.h"
-#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
-
-#include <vector>
-
-class GrProgramInfo;
/**
* Subclass of GrGLSLProgramDataManager used to store uniforms for a program in a CPU buffer that
- * can be uploaded to a UBO.
+ * can be uploaded to a UBO. This currently assumes uniform layouts that are compatible with
+ * Vulkan, Dawn, and D3D12. It could be used more broadly if this aspect was made configurable.
*/
class GrUniformDataManager : public GrGLSLProgramDataManager {
public:
- enum class Layout {
- kStd140,
- kStd430,
- kMetal, /** This is our own self-imposed layout we use for Metal. */
- };
-
- struct NewUniform {
- size_t indexInProcessor = ~0;
- GrSLType type = kVoid_GrSLType;
- int count = 0;
- uint32_t offset = 0;
- };
-
- using ProcessorUniforms = std::vector<NewUniform>;
- using ProgramUniforms = std::vector<ProcessorUniforms>;
-
- GrUniformDataManager(ProgramUniforms,
- Layout layout,
- uint32_t uniformCount,
- uint32_t uniformSize);
+ GrUniformDataManager(uint32_t uniformCount, uint32_t uniformSize);
void set1i(UniformHandle, int32_t) const override;
void set1iv(UniformHandle, int arrayCount, const int32_t v[]) const override;
@@ -72,8 +51,6 @@
// For the uniform data to be dirty so that we will reupload on the next use.
void markDirty() { fUniformsDirty = true; }
- void setUniforms(const GrProgramInfo& info);
-
protected:
struct Uniform {
uint32_t fOffset;
@@ -94,19 +71,6 @@
mutable SkAutoMalloc fUniformData;
mutable bool fUniformsDirty;
-
-private:
- class UniformManager {
- public:
- UniformManager(ProgramUniforms, Layout layout);
- bool writeUniforms(const GrProgramInfo& info, void* buffer);
-
- private:
- ProgramUniforms fUniforms;
- Layout fLayout;
- };
-
- UniformManager fUniformManager;
};
#endif