[graphite] Move GrProcessorKeyBuilder to generic skgpu::KeyBuilder class.
This also allows the KeyBuilder class to be used in Graphite. In Graphite I plan to use it for other keys besides building up shaders/processors so I dropped that from the name. There was nothing special abouts its implementation that made it specific to Processors anyways. Bug: skia:12754 Change-Id: I1b25730b061f9342b61e3b2e4ac43328b8074d59 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/486897 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
dd9ef457d9
commit
cdeb092655
@ -15,6 +15,7 @@
|
||||
#include "src/gpu/GrGeometryProcessor.h"
|
||||
#include "src/gpu/GrMemoryPool.h"
|
||||
#include "src/gpu/GrProgramInfo.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/glsl/GrGLSLColorSpaceXformHelper.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
@ -94,7 +95,7 @@ public:
|
||||
return std::make_unique<Impl>();
|
||||
}
|
||||
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const override {
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder* b) const override {
|
||||
b->add32(fMode);
|
||||
b->add32(GrColorSpaceXform::XformKey(fColorSpaceXform.get()));
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "src/gpu/GrProgramInfo.h"
|
||||
#include "src/gpu/GrResourceProvider.h"
|
||||
#include "src/gpu/GrShaderVar.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
||||
#include "src/gpu/ops/GrDrawOp.h"
|
||||
@ -48,7 +49,7 @@ public:
|
||||
|
||||
const char* name() const final { return "AttributeTestProcessor"; }
|
||||
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const final {
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder* b) const final {
|
||||
b->add32(static_cast<uint32_t>(fMode));
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "src/gpu/GrShaderVar.h"
|
||||
#include "src/gpu/GrSurfaceProxy.h"
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLVarying.h"
|
||||
#include "src/gpu/ops/GrDrawOp.h"
|
||||
@ -72,7 +73,7 @@ public:
|
||||
|
||||
const char* name() const final { return "ClockwiseTestProcessor"; }
|
||||
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const final {
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder* b) const final {
|
||||
b->add32(fReadSkFragCoord);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ private:
|
||||
: INHERITED(that) {}
|
||||
|
||||
const char* name() const override { return "DestColorTestFP"; }
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override {}
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
|
||||
|
||||
std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
}
|
||||
|
||||
const char* name() const override { return "DSLEffect"; }
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override {}
|
||||
bool onIsEqual(const GrFragmentProcessor& that) const override { return this == &that; }
|
||||
std::unique_ptr<GrFragmentProcessor> clone() const override { return nullptr; }
|
||||
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
}
|
||||
|
||||
const char* name() const override { return "UniformMatrixEffect"; }
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override {}
|
||||
bool onIsEqual(const GrFragmentProcessor& that) const override { return this == &that; }
|
||||
std::unique_ptr<GrFragmentProcessor> clone() const override { return nullptr; }
|
||||
|
||||
@ -74,7 +74,7 @@ public:
|
||||
}
|
||||
|
||||
const char* name() const override { return "ExplicitCoordEffect"; }
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override {}
|
||||
bool onIsEqual(const GrFragmentProcessor& that) const override { return this == &that; }
|
||||
std::unique_ptr<GrFragmentProcessor> clone() const override { return nullptr; }
|
||||
|
||||
@ -103,7 +103,7 @@ public:
|
||||
}
|
||||
|
||||
const char* name() const override { return "TestPatternEffect"; }
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override {}
|
||||
bool onIsEqual(const GrFragmentProcessor& that) const override { return this == &that; }
|
||||
std::unique_ptr<GrFragmentProcessor> clone() const override { return nullptr; }
|
||||
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override {}
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override {
|
||||
SkASSERT(false);
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
|
||||
const char* name() const override { return "FwidthSquircleTestProcessor"; }
|
||||
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const final {}
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const final {}
|
||||
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps&) const final;
|
||||
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
|
||||
private:
|
||||
const char* name() const final { return "TessellationTestTriShader"; }
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const final {}
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const final {}
|
||||
|
||||
class Impl : public ProgramImpl {
|
||||
public:
|
||||
@ -179,7 +179,7 @@ public:
|
||||
|
||||
const char* name() const final { return "TessellationTestRectShader"; }
|
||||
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const final {}
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const final {}
|
||||
|
||||
private:
|
||||
class Impl : public ProgramImpl {
|
||||
|
@ -818,6 +818,7 @@ skia_native_gpu_sources = [
|
||||
skia_shared_gpu_sources = [
|
||||
"$_include/gpu/ShaderErrorHandler.h",
|
||||
"$_src/gpu/BufferWriter.h",
|
||||
"$_src/gpu/KeyBuilder.h",
|
||||
"$_src/gpu/ShaderErrorHandler.cpp",
|
||||
|
||||
# tessellate
|
||||
|
@ -5,8 +5,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef ShaderErrorHandler_DEFINED
|
||||
#define ShaderErrorHandler_DEFINED
|
||||
#ifndef skgpu_ShaderErrorHandler_DEFINED
|
||||
#define skgpu_ShaderErrorHandler_DEFINED
|
||||
|
||||
#include "include/core/SkTypes.h"
|
||||
|
||||
@ -33,4 +33,4 @@ ShaderErrorHandler* DefaultShaderErrorHandler();
|
||||
|
||||
} // namespace skgpu
|
||||
|
||||
#endif
|
||||
#endif // skgpu_ShaderErrorHandler_DEFINED
|
||||
|
@ -130,7 +130,7 @@ public:
|
||||
private:
|
||||
std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override {}
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "src/gpu/GrRecordingContextPriv.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/SurfaceFillContext.h"
|
||||
#include "src/gpu/effects/GrTextureEffect.h"
|
||||
@ -175,7 +176,7 @@ private:
|
||||
|
||||
std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
|
||||
@ -449,7 +450,7 @@ GrDisplacementMapEffect::onMakeProgramImpl() const {
|
||||
return std::make_unique<Impl>();
|
||||
}
|
||||
|
||||
void GrDisplacementMapEffect::onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||||
void GrDisplacementMapEffect::onAddToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const {
|
||||
static constexpr int kChannelSelectorKeyBits = 2; // Max value is 3, so 2 bits are required
|
||||
|
||||
uint32_t xKey = static_cast<uint32_t>(fXChannelSelector);
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "src/gpu/GrRecordingContextPriv.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/SurfaceFillContext.h"
|
||||
#include "src/gpu/effects/GrTextureEffect.h"
|
||||
@ -636,7 +637,7 @@ protected:
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
|
||||
private:
|
||||
void onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override {
|
||||
void onAddToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const override {
|
||||
b->add32(fBoundaryMode << 2 | fLight->type());
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "src/gpu/GrRecordingContextPriv.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/SurfaceFillContext.h"
|
||||
#include "src/gpu/effects/GrTextureEffect.h"
|
||||
@ -207,7 +208,7 @@ private:
|
||||
|
||||
std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
GrMorphologyEffect(std::unique_ptr<GrFragmentProcessor> inputFP, GrSurfaceProxyView,
|
||||
@ -286,7 +287,7 @@ std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrMorphologyEffect::onMakeProg
|
||||
return std::make_unique<Impl>();
|
||||
}
|
||||
|
||||
void GrMorphologyEffect::onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||||
void GrMorphologyEffect::onAddToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const {
|
||||
uint32_t key = static_cast<uint32_t>(fRadius);
|
||||
key |= (static_cast<uint32_t>(fType) << 8);
|
||||
key |= (static_cast<uint32_t>(fDirection) << 9);
|
||||
|
@ -5,8 +5,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef BufferWriter_DEFINED
|
||||
#define BufferWriter_DEFINED
|
||||
#ifndef skgpu_BufferWriter_DEFINED
|
||||
#define skgpu_BufferWriter_DEFINED
|
||||
|
||||
#include "include/core/SkRect.h"
|
||||
#include "include/private/SkColorData.h"
|
||||
@ -349,4 +349,4 @@ struct UniformWriter : public BufferWriter {
|
||||
|
||||
} // namespace skgpu
|
||||
|
||||
#endif // BufferWriter_DEFINED
|
||||
#endif // skgpu_BufferWriter_DEFINED
|
||||
|
@ -24,13 +24,16 @@ class GrBackendFormat;
|
||||
class GrBackendRenderTarget;
|
||||
class GrBackendTexture;
|
||||
struct GrContextOptions;
|
||||
class GrProcessorKeyBuilder;
|
||||
class GrProgramDesc;
|
||||
class GrProgramInfo;
|
||||
class GrRenderTargetProxy;
|
||||
class GrSurface;
|
||||
class SkJSONWriter;
|
||||
|
||||
namespace skgpu {
|
||||
class KeyBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the capabilities of a GrContext.
|
||||
*/
|
||||
@ -456,7 +459,7 @@ public:
|
||||
* in parameters. Currently this extra keying is only needed when building a vulkan pipeline
|
||||
* with immutable samplers.
|
||||
*/
|
||||
virtual void addExtraSamplerKey(GrProcessorKeyBuilder*,
|
||||
virtual void addExtraSamplerKey(skgpu::KeyBuilder*,
|
||||
GrSamplerState,
|
||||
const GrBackendFormat&) const {}
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "include/core/SkColorSpace.h"
|
||||
#include "src/core/SkColorSpacePriv.h"
|
||||
#include "src/gpu/GrColorInfo.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLColorSpaceXformHelper.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
|
||||
@ -82,7 +83,7 @@ bool GrColorSpaceXformEffect::onIsEqual(const GrFragmentProcessor& s) const {
|
||||
return GrColorSpaceXform::Equals(fColorXform.get(), other.fColorXform.get());
|
||||
}
|
||||
|
||||
void GrColorSpaceXformEffect::onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const {
|
||||
void GrColorSpaceXformEffect::onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder* b) const {
|
||||
b->add32(GrColorSpaceXform::XformKey(fColorXform.get()));
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ private:
|
||||
SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& input) const override;
|
||||
|
||||
std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
|
||||
sk_sp<GrColorSpaceXform> fColorXform;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "src/core/SkArenaAlloc.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrGeometryProcessor.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLUniformHandler.h"
|
||||
#include "src/gpu/glsl/GrGLSLVarying.h"
|
||||
@ -48,7 +49,7 @@ public:
|
||||
|
||||
const char* name() const override { return "DefaultGeometryProcessor"; }
|
||||
|
||||
void addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override {
|
||||
void addToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const override {
|
||||
uint32_t key = fFlags;
|
||||
key |= fCoverage == 0xff ? 0x80 : 0;
|
||||
key |= fLocalCoordsWillBeRead ? 0x100 : 0;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "src/gpu/GrPipeline.h"
|
||||
#include "src/gpu/GrProcessorAnalysis.h"
|
||||
#include "src/gpu/GrShaderCaps.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/effects/GrBlendFragmentProcessor.h"
|
||||
#include "src/gpu/effects/GrSkSLFP.h"
|
||||
#include "src/gpu/effects/GrTextureEffect.h"
|
||||
@ -284,7 +285,7 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::SwizzleOutput(
|
||||
return std::make_unique<Impl>();
|
||||
}
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const override {
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder* b) const override {
|
||||
b->add32(fSwizzle.asKey());
|
||||
}
|
||||
|
||||
@ -403,7 +404,7 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::Compose(
|
||||
|
||||
ComposeProcessor(const ComposeProcessor& that) : INHERITED(that) {}
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override {}
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
|
||||
|
||||
@ -527,7 +528,7 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::SurfaceColor() {
|
||||
this->setWillReadDstColor();
|
||||
}
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override {}
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
|
||||
|
||||
@ -579,7 +580,7 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::DeviceSpace(
|
||||
return std::make_unique<Impl>();
|
||||
}
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override {}
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor& processor) const override { return true; }
|
||||
|
||||
@ -825,7 +826,7 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::HighPrecision(
|
||||
return std::make_unique<Impl>();
|
||||
}
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override {}
|
||||
bool onIsEqual(const GrFragmentProcessor& other) const override { return true; }
|
||||
|
||||
SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& input) const override {
|
||||
|
@ -20,11 +20,14 @@ class GrGLSLFPFragmentBuilder;
|
||||
class GrGLSLProgramDataManager;
|
||||
class GrPaint;
|
||||
class GrPipeline;
|
||||
class GrProcessorKeyBuilder;
|
||||
struct GrShaderCaps;
|
||||
class GrSwizzle;
|
||||
class GrTextureEffect;
|
||||
|
||||
namespace skgpu {
|
||||
class KeyBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Some fragment-processor creation methods have preconditions that might not be satisfied by the
|
||||
* calling code. Those methods can return a `GrFPResult` from their factory methods. If creation
|
||||
@ -179,7 +182,7 @@ public:
|
||||
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl() const;
|
||||
|
||||
void addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||||
void addToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const {
|
||||
this->onAddToKey(caps, b);
|
||||
for (const auto& child : fChildProcessors) {
|
||||
if (child) {
|
||||
@ -426,7 +429,7 @@ private:
|
||||
*/
|
||||
virtual std::unique_ptr<ProgramImpl> onMakeProgramImpl() const = 0;
|
||||
|
||||
virtual void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const = 0;
|
||||
virtual void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const = 0;
|
||||
|
||||
/**
|
||||
* Subclass implements this to support isEqual(). It will only be called if it is known that
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "src/core/SkMatrixPriv.h"
|
||||
#include "src/gpu/GrPipeline.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLUniformHandler.h"
|
||||
@ -33,6 +34,13 @@ uint32_t GrGeometryProcessor::ComputeCoordTransformsKey(const GrFragmentProcesso
|
||||
return key;
|
||||
}
|
||||
|
||||
void GrGeometryProcessor::getAttributeKey(skgpu::KeyBuilder* b) const {
|
||||
b->appendComment("vertex attributes");
|
||||
fVertexAttributes.addToKey(b);
|
||||
b->appendComment("instance attributes");
|
||||
fInstanceAttributes.addToKey(b);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline GrSamplerState::Filter clamp_filter(GrTextureType type,
|
||||
@ -545,7 +553,7 @@ void AttributeSet::initExplicit(const Attribute* attrs, int count, size_t stride
|
||||
}
|
||||
}
|
||||
|
||||
void AttributeSet::addToKey(GrProcessorKeyBuilder* b) const {
|
||||
void AttributeSet::addToKey(skgpu::KeyBuilder* b) const {
|
||||
int rawCount = SkAbs32(fRawCount);
|
||||
b->addBits(16, SkToU16(this->stride()), "stride");
|
||||
b->addBits(16, rawCount, "attribute count");
|
||||
|
@ -165,7 +165,7 @@ public:
|
||||
// an explicit offset aligned to 4 bytes and with no attribute crossing stride boundaries.
|
||||
void initExplicit(const Attribute* attrs, int count, size_t stride);
|
||||
|
||||
void addToKey(GrProcessorKeyBuilder* b) const;
|
||||
void addToKey(skgpu::KeyBuilder* b) const;
|
||||
|
||||
private:
|
||||
const Attribute* fAttributes = nullptr;
|
||||
@ -207,17 +207,12 @@ public:
|
||||
inline static constexpr int kCoordTransformKeyBits = 4;
|
||||
|
||||
/**
|
||||
* Adds a key on the GrProcessorKeyBuilder that reflects any variety in the code that the
|
||||
* Adds a key on the skgpu::KeyBuilder that reflects any variety in the code that the
|
||||
* geometry processor subclass can emit.
|
||||
*/
|
||||
virtual void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const = 0;
|
||||
virtual void addToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const = 0;
|
||||
|
||||
void getAttributeKey(GrProcessorKeyBuilder* b) const {
|
||||
b->appendComment("vertex attributes");
|
||||
fVertexAttributes.addToKey(b);
|
||||
b->appendComment("instance attributes");
|
||||
fInstanceAttributes.addToKey(b);
|
||||
}
|
||||
void getAttributeKey(skgpu::KeyBuilder* b) const;
|
||||
|
||||
/**
|
||||
* Returns a new instance of the appropriate implementation class for the given
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "src/gpu/GrAppliedClip.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrXferProcessor.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
|
||||
#include "src/gpu/glsl/GrGLSLUniformHandler.h"
|
||||
|
||||
@ -74,7 +75,7 @@ GrPipeline::GrPipeline(GrScissorTest scissorTest,
|
||||
}
|
||||
}
|
||||
|
||||
void GrPipeline::genKey(GrProcessorKeyBuilder* b, const GrCaps& caps) const {
|
||||
void GrPipeline::genKey(skgpu::KeyBuilder* b, const GrCaps& caps) const {
|
||||
// kSnapVerticesToPixelCenters is implemented in a shader.
|
||||
InputFlags ignoredFlags = InputFlags::kSnapVerticesToPixelCenters;
|
||||
b->add32((uint32_t)fFlags & ~(uint32_t)ignoredFlags, "flags");
|
||||
|
@ -190,7 +190,7 @@ public:
|
||||
GrXferBarrierType xferBarrierType(const GrCaps&) const;
|
||||
|
||||
// Used by Vulkan and Metal to cache their respective pipeline objects
|
||||
void genKey(GrProcessorKeyBuilder*, const GrCaps&) const;
|
||||
void genKey(skgpu::KeyBuilder*, const GrCaps&) const;
|
||||
|
||||
const GrSwizzle& writeSwizzle() const { return fWriteSwizzle; }
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "src/gpu/GrRenderTarget.h"
|
||||
#include "src/gpu/GrShaderCaps.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/effects/GrTextureEffect.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
|
||||
@ -54,7 +55,7 @@ static uint32_t sampler_key(GrTextureType textureType, const GrSwizzle& swizzle,
|
||||
return SkToU32(samplerTypeKey | swizzleKey << kSamplerOrImageTypeKeyBits);
|
||||
}
|
||||
|
||||
static void add_geomproc_sampler_keys(GrProcessorKeyBuilder* b,
|
||||
static void add_geomproc_sampler_keys(skgpu::KeyBuilder* b,
|
||||
const GrGeometryProcessor& geomProc,
|
||||
const GrCaps& caps) {
|
||||
int numTextureSamplers = geomProc.numTextureSamplers();
|
||||
@ -82,7 +83,7 @@ static constexpr uint32_t kClassIDBits = 8;
|
||||
*/
|
||||
static void gen_geomproc_key(const GrGeometryProcessor& geomProc,
|
||||
const GrCaps& caps,
|
||||
GrProcessorKeyBuilder* b) {
|
||||
skgpu::KeyBuilder* b) {
|
||||
b->appendComment(geomProc.name());
|
||||
b->addBits(kClassIDBits, geomProc.classID(), "geomProcClassID");
|
||||
|
||||
@ -95,7 +96,7 @@ static void gen_geomproc_key(const GrGeometryProcessor& geomProc,
|
||||
static void gen_xp_key(const GrXferProcessor& xp,
|
||||
const GrCaps& caps,
|
||||
const GrPipeline& pipeline,
|
||||
GrProcessorKeyBuilder* b) {
|
||||
skgpu::KeyBuilder* b) {
|
||||
b->appendComment(xp.name());
|
||||
b->addBits(kClassIDBits, xp.classID(), "xpClassID");
|
||||
|
||||
@ -114,7 +115,7 @@ static void gen_xp_key(const GrXferProcessor& xp,
|
||||
|
||||
static void gen_fp_key(const GrFragmentProcessor& fp,
|
||||
const GrCaps& caps,
|
||||
GrProcessorKeyBuilder* b) {
|
||||
skgpu::KeyBuilder* b) {
|
||||
b->appendComment(fp.name());
|
||||
b->addBits(kClassIDBits, fp.classID(), "fpClassID");
|
||||
b->addBits(GrGeometryProcessor::kCoordTransformKeyBits,
|
||||
@ -141,7 +142,7 @@ static void gen_fp_key(const GrFragmentProcessor& fp,
|
||||
}
|
||||
}
|
||||
|
||||
static void gen_key(GrProcessorKeyBuilder* b,
|
||||
static void gen_key(skgpu::KeyBuilder* b,
|
||||
const GrProgramInfo& programInfo,
|
||||
const GrCaps& caps) {
|
||||
gen_geomproc_key(programInfo.geomProc(), caps, b);
|
||||
@ -170,7 +171,7 @@ void GrProgramDesc::Build(GrProgramDesc* desc,
|
||||
const GrProgramInfo& programInfo,
|
||||
const GrCaps& caps) {
|
||||
desc->reset();
|
||||
GrProcessorKeyBuilder b(desc->key());
|
||||
skgpu::KeyBuilder b(desc->key());
|
||||
gen_key(&b, programInfo, caps);
|
||||
desc->fInitialKeyLength = desc->keyLength();
|
||||
}
|
||||
@ -178,7 +179,7 @@ void GrProgramDesc::Build(GrProgramDesc* desc,
|
||||
SkString GrProgramDesc::Describe(const GrProgramInfo& programInfo,
|
||||
const GrCaps& caps) {
|
||||
GrProgramDesc desc;
|
||||
GrProcessorStringKeyBuilder b(desc.key());
|
||||
skgpu::StringKeyBuilder b(desc.key());
|
||||
gen_key(&b, programInfo, caps);
|
||||
b.flush();
|
||||
return b.description();
|
||||
|
@ -19,86 +19,6 @@ class GrCaps;
|
||||
class GrProgramInfo;
|
||||
class GrRenderTarget;
|
||||
|
||||
class GrProcessorKeyBuilder {
|
||||
public:
|
||||
GrProcessorKeyBuilder(SkTArray<uint32_t, true>* data) : fData(data) {}
|
||||
|
||||
virtual ~GrProcessorKeyBuilder() {
|
||||
// Ensure that flush was called before we went out of scope
|
||||
SkASSERT(fBitsUsed == 0);
|
||||
}
|
||||
|
||||
virtual void addBits(uint32_t numBits, uint32_t val, const char* label) {
|
||||
SkASSERT(numBits > 0 && numBits <= 32);
|
||||
SkASSERT(numBits == 32 || (val < (1u << numBits)));
|
||||
|
||||
fCurValue |= (val << fBitsUsed);
|
||||
fBitsUsed += numBits;
|
||||
|
||||
if (fBitsUsed >= 32) {
|
||||
// Overflow, start a new working value
|
||||
fData->push_back(fCurValue);
|
||||
uint32_t excess = fBitsUsed - 32;
|
||||
fCurValue = excess ? (val >> (numBits - excess)) : 0;
|
||||
fBitsUsed = excess;
|
||||
}
|
||||
|
||||
SkASSERT(fCurValue < (1u << fBitsUsed));
|
||||
}
|
||||
|
||||
void addBytes(uint32_t numBytes, const void* data, const char* label) {
|
||||
const uint8_t* bytes = reinterpret_cast<const uint8_t*>(data);
|
||||
for (; numBytes --> 0; bytes++) {
|
||||
this->addBits(8, *bytes, label);
|
||||
}
|
||||
}
|
||||
|
||||
void addBool(bool b, const char* label) {
|
||||
this->addBits(1, b, label);
|
||||
}
|
||||
|
||||
void add32(uint32_t v, const char* label = "unknown") {
|
||||
this->addBits(32, v, label);
|
||||
}
|
||||
|
||||
virtual void appendComment(const char* comment) {}
|
||||
|
||||
// Introduces a word-boundary in the key. Must be called before using the key with any cache,
|
||||
// but can also be called to create a break between generic data and backend-specific data.
|
||||
void flush() {
|
||||
if (fBitsUsed) {
|
||||
fData->push_back(fCurValue);
|
||||
fCurValue = 0;
|
||||
fBitsUsed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
SkTArray<uint32_t, true>* fData;
|
||||
uint32_t fCurValue = 0;
|
||||
uint32_t fBitsUsed = 0; // ... in current value
|
||||
};
|
||||
|
||||
class GrProcessorStringKeyBuilder : public GrProcessorKeyBuilder {
|
||||
public:
|
||||
GrProcessorStringKeyBuilder(SkTArray<uint32_t, true>* data) : INHERITED(data) {}
|
||||
|
||||
void addBits(uint32_t numBits, uint32_t val, const char* label) override {
|
||||
INHERITED::addBits(numBits, val, label);
|
||||
fDescription.appendf("%s: %u\n", label, val);
|
||||
}
|
||||
|
||||
void appendComment(const char* comment) override {
|
||||
fDescription.appendf("%s\n", comment);
|
||||
}
|
||||
|
||||
SkString description() const { return fDescription; }
|
||||
|
||||
private:
|
||||
using INHERITED = GrProcessorKeyBuilder;
|
||||
SkString fDescription;
|
||||
};
|
||||
|
||||
/** This class is used to generate a generic program cache key. The Dawn, Metal and Vulkan
|
||||
* backends derive backend-specific versions which add additional information.
|
||||
*/
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "src/gpu/GrStencilSettings.h"
|
||||
|
||||
#include "src/gpu/GrProcessor.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
|
||||
constexpr const GrUserStencilSettings gUnused(
|
||||
GrUserStencilSettings::StaticInit<
|
||||
@ -243,7 +244,7 @@ const GrUserStencilSettings* GrStencilSettings::SetClipBitSettings(bool setToIns
|
||||
return setToInside ? &gSetStencilClipBit : &gZeroStencilClipBit;
|
||||
}
|
||||
|
||||
void GrStencilSettings::genKey(GrProcessorKeyBuilder* b, bool includeRefs) const {
|
||||
void GrStencilSettings::genKey(skgpu::KeyBuilder* b, bool includeRefs) const {
|
||||
b->addBits(6, fFlags, "stencilFlags");
|
||||
if (this->isDisabled()) {
|
||||
return;
|
||||
|
@ -12,7 +12,9 @@
|
||||
#include "include/core/SkRegion.h"
|
||||
#include "src/gpu/GrUserStencilSettings.h"
|
||||
|
||||
class GrProcessorKeyBuilder;
|
||||
namespace skgpu {
|
||||
class KeyBuilder;
|
||||
}
|
||||
|
||||
enum class GrStencilTest : uint16_t {
|
||||
kAlways,
|
||||
@ -68,7 +70,7 @@ public:
|
||||
bool usesWrapOp() const { SkASSERT(this->isValid());
|
||||
return !(fFlags & kNoWrapOps_StencilFlag); }
|
||||
|
||||
void genKey(GrProcessorKeyBuilder* b, bool includeRefsAndMasks) const;
|
||||
void genKey(skgpu::KeyBuilder* b, bool includeRefsAndMasks) const;
|
||||
|
||||
bool operator!=(const GrStencilSettings& that) const { return !(*this == that); }
|
||||
bool operator==(const GrStencilSettings&) const;
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrPipeline.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
|
||||
|
||||
@ -31,7 +32,7 @@ bool GrXferProcessor::hasSecondaryOutput() const {
|
||||
}
|
||||
|
||||
void GrXferProcessor::addToKey(const GrShaderCaps& caps,
|
||||
GrProcessorKeyBuilder* b,
|
||||
skgpu::KeyBuilder* b,
|
||||
const GrSurfaceOrigin* originIfDstTexture,
|
||||
bool usesInputAttachmentForDstRead) const {
|
||||
uint32_t key = this->willReadDstColor() ? 0x1 : 0x0;
|
||||
|
@ -68,11 +68,10 @@ public:
|
||||
class ProgramImpl;
|
||||
|
||||
/**
|
||||
* Adds a key on the GrProcessorKeyBuilder calls onAddToKey(...) to get the specific subclass's
|
||||
* key.
|
||||
* Adds a key on the skgpu::KeyBuilder calls onAddToKey(...) to get the specific subclass's key.
|
||||
*/
|
||||
void addToKey(const GrShaderCaps&,
|
||||
GrProcessorKeyBuilder*,
|
||||
skgpu::KeyBuilder*,
|
||||
const GrSurfaceOrigin* originIfDstTexture,
|
||||
bool usesInputAttachmentForDstRead) const;
|
||||
|
||||
@ -145,10 +144,10 @@ protected:
|
||||
|
||||
private:
|
||||
/**
|
||||
* Adds a key on the GrProcessorKeyBuilder that reflects any variety in the code that may be
|
||||
* emitted by the xfer processor subclass.
|
||||
* Adds a key on the skgpu::KeyBuilder that reflects any variety in the code that may be emitted
|
||||
* by the xfer processor subclass.
|
||||
*/
|
||||
virtual void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const = 0;
|
||||
virtual void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const = 0;
|
||||
|
||||
/**
|
||||
* If we are not performing a dst read, returns whether the subclass will set a secondary
|
||||
|
97
src/gpu/KeyBuilder.h
Normal file
97
src/gpu/KeyBuilder.h
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef skgpu_KeyBuilder_DEFINED
|
||||
#define skgpu_KeyBuilder_DEFINED
|
||||
|
||||
#include "include/core/SkString.h"
|
||||
#include "include/private/SkTArray.h"
|
||||
|
||||
namespace skgpu {
|
||||
|
||||
class KeyBuilder {
|
||||
public:
|
||||
KeyBuilder(SkTArray<uint32_t, true>* data) : fData(data) {}
|
||||
|
||||
virtual ~KeyBuilder() {
|
||||
// Ensure that flush was called before we went out of scope
|
||||
SkASSERT(fBitsUsed == 0);
|
||||
}
|
||||
|
||||
virtual void addBits(uint32_t numBits, uint32_t val, const char* label) {
|
||||
SkASSERT(numBits > 0 && numBits <= 32);
|
||||
SkASSERT(numBits == 32 || (val < (1u << numBits)));
|
||||
|
||||
fCurValue |= (val << fBitsUsed);
|
||||
fBitsUsed += numBits;
|
||||
|
||||
if (fBitsUsed >= 32) {
|
||||
// Overflow, start a new working value
|
||||
fData->push_back(fCurValue);
|
||||
uint32_t excess = fBitsUsed - 32;
|
||||
fCurValue = excess ? (val >> (numBits - excess)) : 0;
|
||||
fBitsUsed = excess;
|
||||
}
|
||||
|
||||
SkASSERT(fCurValue < (1u << fBitsUsed));
|
||||
}
|
||||
|
||||
void addBytes(uint32_t numBytes, const void* data, const char* label) {
|
||||
const uint8_t* bytes = reinterpret_cast<const uint8_t*>(data);
|
||||
for (; numBytes --> 0; bytes++) {
|
||||
this->addBits(8, *bytes, label);
|
||||
}
|
||||
}
|
||||
|
||||
void addBool(bool b, const char* label) {
|
||||
this->addBits(1, b, label);
|
||||
}
|
||||
|
||||
void add32(uint32_t v, const char* label = "unknown") {
|
||||
this->addBits(32, v, label);
|
||||
}
|
||||
|
||||
virtual void appendComment(const char* comment) {}
|
||||
|
||||
// Introduces a word-boundary in the key. Must be called before using the key with any cache,
|
||||
// but can also be called to create a break between generic data and backend-specific data.
|
||||
void flush() {
|
||||
if (fBitsUsed) {
|
||||
fData->push_back(fCurValue);
|
||||
fCurValue = 0;
|
||||
fBitsUsed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
SkTArray<uint32_t, true>* fData;
|
||||
uint32_t fCurValue = 0;
|
||||
uint32_t fBitsUsed = 0; // ... in current value
|
||||
};
|
||||
|
||||
class StringKeyBuilder : public KeyBuilder {
|
||||
public:
|
||||
StringKeyBuilder(SkTArray<uint32_t, true>* data) : KeyBuilder(data) {}
|
||||
|
||||
void addBits(uint32_t numBits, uint32_t val, const char* label) override {
|
||||
KeyBuilder::addBits(numBits, val, label);
|
||||
fDescription.appendf("%s: %u\n", label, val);
|
||||
}
|
||||
|
||||
void appendComment(const char* comment) override {
|
||||
fDescription.appendf("%s\n", comment);
|
||||
}
|
||||
|
||||
SkString description() const { return fDescription; }
|
||||
|
||||
private:
|
||||
SkString fDescription;
|
||||
};
|
||||
|
||||
} // namespace skgpu
|
||||
|
||||
#endif // skgpu_KeyBuilder_DEFINED
|
@ -16,6 +16,7 @@
|
||||
#include "src/gpu/GrProgramInfo.h"
|
||||
#include "src/gpu/GrShaderCaps.h"
|
||||
#include "src/gpu/GrStencilSettings.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/d3d/GrD3DCaps.h"
|
||||
#include "src/gpu/d3d/GrD3DGpu.h"
|
||||
#include "src/gpu/d3d/GrD3DRenderTarget.h"
|
||||
@ -1038,7 +1039,7 @@ GrCaps::SupportedRead GrD3DCaps::onSupportedReadPixelsColorType(
|
||||
return { GrColorType::kUnknown, 0 };
|
||||
}
|
||||
|
||||
void GrD3DCaps::addExtraSamplerKey(GrProcessorKeyBuilder* b,
|
||||
void GrD3DCaps::addExtraSamplerKey(skgpu::KeyBuilder* b,
|
||||
GrSamplerState samplerState,
|
||||
const GrBackendFormat& format) const {
|
||||
// TODO
|
||||
@ -1054,7 +1055,7 @@ GrProgramDesc GrD3DCaps::makeDesc(GrRenderTarget* rt,
|
||||
GrProgramDesc desc;
|
||||
GrProgramDesc::Build(&desc, programInfo, *this);
|
||||
|
||||
GrProcessorKeyBuilder b(desc.key());
|
||||
skgpu::KeyBuilder b(desc.key());
|
||||
|
||||
GrD3DRenderTarget* d3dRT = (GrD3DRenderTarget*) rt;
|
||||
d3dRT->genKey(&b);
|
||||
|
@ -94,7 +94,7 @@ public:
|
||||
|
||||
uint64_t computeFormatKey(const GrBackendFormat&) const override;
|
||||
|
||||
void addExtraSamplerKey(GrProcessorKeyBuilder*,
|
||||
void addExtraSamplerKey(skgpu::KeyBuilder*,
|
||||
GrSamplerState,
|
||||
const GrBackendFormat&) const override;
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "include/gpu/GrBackendSurface.h"
|
||||
#include "include/gpu/d3d/GrD3DTypes.h"
|
||||
#include "src/gpu/GrRenderTarget.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/d3d/GrD3DGpu.h"
|
||||
#include "src/gpu/d3d/GrD3DResourceProvider.h"
|
||||
#include "src/gpu/d3d/GrD3DTextureResource.h"
|
||||
@ -190,7 +191,7 @@ DXGI_FORMAT GrD3DRenderTarget::stencilDxgiFormat() const {
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
void GrD3DRenderTarget::genKey(GrProcessorKeyBuilder* b) const {
|
||||
void GrD3DRenderTarget::genKey(skgpu::KeyBuilder* b) const {
|
||||
b->add32(this->dxgiFormat());
|
||||
b->add32(this->numSamples());
|
||||
b->add32(this->stencilDxgiFormat());
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
DXGI_FORMAT stencilDxgiFormat() const;
|
||||
|
||||
// Key used for the program desc
|
||||
void genKey(GrProcessorKeyBuilder* b) const;
|
||||
void genKey(skgpu::KeyBuilder* b) const;
|
||||
|
||||
protected:
|
||||
GrD3DRenderTarget(GrD3DGpu* gpu,
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "src/gpu/GrProgramInfo.h"
|
||||
#include "src/gpu/GrRenderTarget.h"
|
||||
#include "src/gpu/GrStencilSettings.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
|
||||
GrDawnCaps::GrDawnCaps(const GrContextOptions& contextOptions) : INHERITED(contextOptions) {
|
||||
fMipmapSupport = true;
|
||||
@ -179,7 +180,7 @@ GrProgramDesc GrDawnCaps::makeDesc(GrRenderTarget* rt,
|
||||
return desc;
|
||||
}
|
||||
|
||||
GrProcessorKeyBuilder b(desc.key());
|
||||
skgpu::KeyBuilder b(desc.key());
|
||||
GrStencilSettings stencil = programInfo.nonGLStencilSettings();
|
||||
stencil.genKey(&b, true);
|
||||
|
||||
|
@ -5,8 +5,10 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "src/gpu/GrShaderCaps.h"
|
||||
#include "src/gpu/effects/GrBezierEffect.h"
|
||||
|
||||
#include "src/gpu/GrShaderCaps.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
|
||||
#include "src/gpu/glsl/GrGLSLUniformHandler.h"
|
||||
@ -151,7 +153,7 @@ void GrConicEffect::Impl::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
|
||||
|
||||
GrConicEffect::~GrConicEffect() = default;
|
||||
|
||||
void GrConicEffect::addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||||
void GrConicEffect::addToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const {
|
||||
uint32_t key = 0;
|
||||
key |= fCoverageScale == 0xff ? 0x8 : 0x0;
|
||||
key |= fUsesLocalCoords ? 0x10 : 0x0;
|
||||
@ -304,7 +306,7 @@ void GrQuadEffect::Impl::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
|
||||
|
||||
GrQuadEffect::~GrQuadEffect() = default;
|
||||
|
||||
void GrQuadEffect::addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||||
void GrQuadEffect::addToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const {
|
||||
uint32_t key = 0;
|
||||
key |= fCoverageScale != 0xff ? 0x8 : 0x0;
|
||||
key |= fUsesLocalCoords ? 0x10 : 0x0;
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
|
||||
const char* name() const override { return "Conic"; }
|
||||
|
||||
void addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override;
|
||||
void addToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const override;
|
||||
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps&) const override;
|
||||
|
||||
@ -141,7 +141,7 @@ public:
|
||||
|
||||
const char* name() const override { return "Quad"; }
|
||||
|
||||
void addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override;
|
||||
void addToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const override;
|
||||
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps&) const override;
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "src/core/SkMatrixPriv.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/effects/GrMatrixEffect.h"
|
||||
#include "src/gpu/effects/GrTextureEffect.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
@ -213,7 +214,7 @@ GrBicubicEffect::GrBicubicEffect(const GrBicubicEffect& that)
|
||||
, fDirection(that.fDirection)
|
||||
, fClamp(that.fClamp) {}
|
||||
|
||||
void GrBicubicEffect::onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||||
void GrBicubicEffect::onAddToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const {
|
||||
uint32_t key = (static_cast<uint32_t>(fDirection) << 0) | (static_cast<uint32_t>(fClamp) << 2);
|
||||
b->add32(key);
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ private:
|
||||
|
||||
std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrShaderCaps.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/effects/GrAtlasedShaderHelpers.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
|
||||
@ -177,7 +178,7 @@ void GrBitmapTextGeoProc::addNewViews(const GrSurfaceProxyView* views,
|
||||
this->setTextureSamplerCnt(numActiveViews);
|
||||
}
|
||||
|
||||
void GrBitmapTextGeoProc::addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||||
void GrBitmapTextGeoProc::addToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const {
|
||||
b->addBool(fUsesW, "usesW");
|
||||
static_assert(kLast_GrMaskFormat < (1u << 2));
|
||||
b->addBits(2, fMaskFormat, "maskFormat");
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
|
||||
void addNewViews(const GrSurfaceProxyView*, int numActiveViews, GrSamplerState);
|
||||
|
||||
void addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override;
|
||||
void addToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const override;
|
||||
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps& caps) const override;
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "src/gpu/effects/GrBlendFragmentProcessor.h"
|
||||
|
||||
#include "src/gpu/GrFragmentProcessor.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/glsl/GrGLSLBlend.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
@ -138,7 +139,7 @@ private:
|
||||
return flags;
|
||||
}
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const override {
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder* b) const override {
|
||||
b->add32((int)fMode);
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,10 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "src/core/SkPathPriv.h"
|
||||
#include "src/gpu/effects/GrConvexPolyEffect.h"
|
||||
|
||||
#include "src/core/SkPathPriv.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
|
||||
#include "src/gpu/glsl/GrGLSLUniformHandler.h"
|
||||
@ -85,7 +87,7 @@ GrFPResult GrConvexPolyEffect::Make(std::unique_ptr<GrFragmentProcessor> inputFP
|
||||
|
||||
GrConvexPolyEffect::~GrConvexPolyEffect() {}
|
||||
|
||||
void GrConvexPolyEffect::onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||||
void GrConvexPolyEffect::onAddToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const {
|
||||
static_assert(kGrClipEdgeTypeCnt <= 8);
|
||||
uint32_t key = (fEdgeCount << 3) | static_cast<int>(fEdgeType);
|
||||
b->add32(key);
|
||||
|
@ -67,7 +67,7 @@ private:
|
||||
|
||||
std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor& other) const override;
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "src/gpu/GrColor.h"
|
||||
#include "src/gpu/GrPipeline.h"
|
||||
#include "src/gpu/GrXferProcessor.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLBlend.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLUniformHandler.h"
|
||||
@ -27,7 +28,7 @@ public:
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl() const override;
|
||||
|
||||
private:
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
|
||||
void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override;
|
||||
|
||||
@ -43,7 +44,7 @@ private:
|
||||
using INHERITED = GrXferProcessor;
|
||||
};
|
||||
|
||||
void CoverageSetOpXP::onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||||
void CoverageSetOpXP::onAddToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const {
|
||||
b->addBool(fInvertCoverage, "invert coverage");
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "src/gpu/GrProcessor.h"
|
||||
#include "src/gpu/GrShaderCaps.h"
|
||||
#include "src/gpu/GrXferProcessor.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLBlend.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
|
||||
@ -91,7 +92,7 @@ public:
|
||||
private:
|
||||
bool hasHWBlendEquation() const { return kIllegal_GrBlendEquation != fHWBlendEquation; }
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
|
||||
void onGetBlendInfo(BlendInfo*) const override;
|
||||
|
||||
@ -103,7 +104,7 @@ private:
|
||||
using INHERITED = GrXferProcessor;
|
||||
};
|
||||
|
||||
void CustomXP::onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||||
void CustomXP::onAddToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const {
|
||||
uint32_t key = 0;
|
||||
if (this->hasHWBlendEquation()) {
|
||||
SkASSERT(caps.advBlendEqInteraction() > 0); // 0 will mean !xp.hasHWBlendEquation().
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
private:
|
||||
const char* name() const override { return "Disable Color"; }
|
||||
bool onIsEqual(const GrXferProcessor& xpBase) const override { return true; }
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override {}
|
||||
void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override {
|
||||
blendInfo->fWriteColor = false;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrShaderCaps.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/effects/GrAtlasedShaderHelpers.h"
|
||||
#include "src/gpu/effects/GrDistanceFieldGeoProc.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
@ -265,7 +266,7 @@ void GrDistanceFieldA8TextGeoProc::addNewViews(const GrSurfaceProxyView* views,
|
||||
}
|
||||
|
||||
void GrDistanceFieldA8TextGeoProc::addToKey(const GrShaderCaps& caps,
|
||||
GrProcessorKeyBuilder* b) const {
|
||||
skgpu::KeyBuilder* b) const {
|
||||
uint32_t key = 0;
|
||||
key |= fFlags;
|
||||
key |= ProgramImpl::ComputeMatrixKey(caps, fLocalMatrix) << 16;
|
||||
@ -532,7 +533,7 @@ void GrDistanceFieldPathGeoProc::addNewViews(const GrSurfaceProxyView* views,
|
||||
}
|
||||
|
||||
void GrDistanceFieldPathGeoProc::addToKey(const GrShaderCaps& caps,
|
||||
GrProcessorKeyBuilder* b) const {
|
||||
skgpu::KeyBuilder* b) const {
|
||||
uint32_t key = fFlags;
|
||||
key |= ProgramImpl::ComputeMatrixKey(caps, fMatrix) << 16;
|
||||
key |= fMatrix.hasPerspective() << (16 + ProgramImpl::kMatrixKeyBits);
|
||||
@ -845,7 +846,7 @@ void GrDistanceFieldLCDTextGeoProc::addNewViews(const GrSurfaceProxyView* views,
|
||||
}
|
||||
|
||||
void GrDistanceFieldLCDTextGeoProc::addToKey(const GrShaderCaps& caps,
|
||||
GrProcessorKeyBuilder* b) const {
|
||||
skgpu::KeyBuilder* b) const {
|
||||
uint32_t key = 0;
|
||||
key |= ProgramImpl::ComputeMatrixKey(caps, fLocalMatrix);
|
||||
key |= fFlags << 16;
|
||||
|
@ -92,7 +92,7 @@ public:
|
||||
|
||||
void addNewViews(const GrSurfaceProxyView* views, int numViews, GrSamplerState);
|
||||
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps&) const override;
|
||||
|
||||
@ -154,7 +154,7 @@ public:
|
||||
|
||||
void addNewViews(const GrSurfaceProxyView*, int numActiveViews, GrSamplerState);
|
||||
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps&) const override;
|
||||
|
||||
@ -230,7 +230,7 @@ public:
|
||||
|
||||
void addNewViews(const GrSurfaceProxyView*, int numActiveViews, GrSamplerState);
|
||||
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps&) const override;
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "src/core/SkGpuBlurUtils.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/effects/GrTextureEffect.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
|
||||
@ -220,7 +221,7 @@ GrGaussianConvolutionFragmentProcessor::GrGaussianConvolutionFragmentProcessor(
|
||||
}
|
||||
|
||||
void GrGaussianConvolutionFragmentProcessor::onAddToKey(const GrShaderCaps& shaderCaps,
|
||||
GrProcessorKeyBuilder* b) const {
|
||||
skgpu::KeyBuilder* b) const {
|
||||
if (loop_type(shaderCaps) != LoopType::kVariableLength) {
|
||||
b->add32(fRadius);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ private:
|
||||
|
||||
std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
#include "src/gpu/GrThreadSafeCache.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/effects/GrTextureEffect.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
@ -301,7 +302,7 @@ std::unique_ptr<GrFragmentProcessor> GrMatrixConvolutionEffect::clone() const {
|
||||
}
|
||||
|
||||
void GrMatrixConvolutionEffect::onAddToKey(const GrShaderCaps& caps,
|
||||
GrProcessorKeyBuilder* b) const {
|
||||
skgpu::KeyBuilder* b) const {
|
||||
SkASSERT(this->fKernel.size().width() <= 0x7FFF && this->fKernel.size().height() <= 0xFFFF);
|
||||
uint32_t key = this->fKernel.size().width() << 16 | this->fKernel.size().height();
|
||||
key |= fConvolveAlpha ? 1U << 31 : 0;
|
||||
|
@ -103,7 +103,7 @@ private:
|
||||
|
||||
std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
|
||||
|
@ -58,7 +58,7 @@ std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrMatrixEffect::onMakeProgramI
|
||||
return std::make_unique<Impl>();
|
||||
}
|
||||
|
||||
void GrMatrixEffect::onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {}
|
||||
void GrMatrixEffect::onAddToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const {}
|
||||
|
||||
bool GrMatrixEffect::onIsEqual(const GrFragmentProcessor& other) const {
|
||||
const GrMatrixEffect& that = other.cast<GrMatrixEffect>();
|
||||
|
@ -33,7 +33,7 @@ private:
|
||||
}
|
||||
|
||||
std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& inputColor) const override {
|
||||
return ConstantOutputForConstantInput(this->childProcessor(0), inputColor);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "src/gpu/effects/GrModulateAtlasCoverageEffect.h"
|
||||
|
||||
#include "src/gpu/GrDynamicAtlas.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/effects/GrTextureEffect.h"
|
||||
|
||||
GrModulateAtlasCoverageEffect::GrModulateAtlasCoverageEffect(
|
||||
@ -32,6 +33,11 @@ GrModulateAtlasCoverageEffect::GrModulateAtlasCoverageEffect(
|
||||
, fFlags(that.fFlags)
|
||||
, fBounds(that.fBounds) {}
|
||||
|
||||
void GrModulateAtlasCoverageEffect::onAddToKey(const GrShaderCaps&,
|
||||
skgpu::KeyBuilder* b) const {
|
||||
b->add32(fFlags & Flags::kCheckBounds);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor::ProgramImpl>
|
||||
GrModulateAtlasCoverageEffect::onMakeProgramImpl() const {
|
||||
class Impl : public ProgramImpl {
|
||||
|
@ -36,9 +36,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const override {
|
||||
b->add32(fFlags & Flags::kCheckBounds);
|
||||
}
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder* b) const override;
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor& that) const override {
|
||||
auto fp = that.cast<GrModulateAtlasCoverageEffect>();
|
||||
return fFlags == fp.fFlags && fBounds == fp.fBounds;
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "src/gpu/GrProcessor.h"
|
||||
#include "src/gpu/GrProcessorAnalysis.h"
|
||||
#include "src/gpu/GrXferProcessor.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLBlend.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
|
||||
@ -385,7 +386,7 @@ public:
|
||||
BlendFormula getBlendFormula() const { return fBlendFormula; }
|
||||
|
||||
private:
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
|
||||
bool onHasSecondaryOutput() const override { return fBlendFormula.hasSecondaryOutput(); }
|
||||
|
||||
@ -439,7 +440,7 @@ static void append_color_output(const PorterDuffXferProcessor& xp,
|
||||
}
|
||||
}
|
||||
|
||||
void PorterDuffXferProcessor::onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const {
|
||||
void PorterDuffXferProcessor::onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder* b) const {
|
||||
b->add32(fBlendFormula.primaryOutput() | (fBlendFormula.secondaryOutput() << 3));
|
||||
static_assert(BlendFormula::kLast_OutputType < 8);
|
||||
}
|
||||
@ -486,7 +487,7 @@ public:
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl() const override;
|
||||
|
||||
private:
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
|
||||
bool onIsEqual(const GrXferProcessor& xpBase) const override {
|
||||
const ShaderPDXferProcessor& xp = xpBase.cast<ShaderPDXferProcessor>();
|
||||
@ -501,7 +502,7 @@ private:
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
void ShaderPDXferProcessor::onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const {
|
||||
void ShaderPDXferProcessor::onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder* b) const {
|
||||
b->add32(static_cast<int>(fXfermode));
|
||||
}
|
||||
|
||||
@ -547,7 +548,7 @@ public:
|
||||
private:
|
||||
PDLCDXferProcessor(const SkPMColor4f& blendConstant, float alpha);
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override {}
|
||||
|
||||
void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override {
|
||||
blendInfo->fSrcBlend = kConstC_GrBlendCoeff;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "src/core/SkTLazy.h"
|
||||
#include "src/gpu/GrFragmentProcessor.h"
|
||||
#include "src/gpu/GrShaderCaps.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/effects/GrConvexPolyEffect.h"
|
||||
#include "src/gpu/effects/GrOvalEffect.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
@ -62,7 +63,7 @@ private:
|
||||
|
||||
std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor& other) const override;
|
||||
|
||||
@ -371,7 +372,7 @@ void CircularRRectEffect::Impl::onSetData(const GrGLSLProgramDataManager& pdman,
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CircularRRectEffect::onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||||
void CircularRRectEffect::onAddToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const {
|
||||
static_assert(kGrClipEdgeTypeCnt <= 8);
|
||||
b->add32((fCircularCornerFlags << 3) | static_cast<int>(fEdgeType));
|
||||
}
|
||||
@ -401,7 +402,7 @@ private:
|
||||
|
||||
std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor& other) const override;
|
||||
|
||||
@ -663,7 +664,7 @@ void EllipticalRRectEffect::Impl::onSetData(const GrGLSLProgramDataManager& pdma
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void EllipticalRRectEffect::onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||||
void EllipticalRRectEffect::onAddToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const {
|
||||
static_assert((int)GrClipEdgeType::kLast < (1 << 3));
|
||||
b->add32(fRRect.getType() | static_cast<int>(fEdgeType) << 3);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
const Attribute& inShadowParams() const { return fInShadowParams; }
|
||||
GrColor color() const { return fColor; }
|
||||
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override {}
|
||||
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps&) const override;
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "src/gpu/GrBaseContextPriv.h"
|
||||
#include "src/gpu/GrColorInfo.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
|
||||
#include "src/sksl/SkSLUtil.h"
|
||||
@ -351,7 +352,7 @@ std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrSkSLFP::onMakeProgramImpl()
|
||||
return std::make_unique<Impl>();
|
||||
}
|
||||
|
||||
void GrSkSLFP::onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||||
void GrSkSLFP::onAddToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const {
|
||||
// In the unlikely event of a hash collision, we also include the uniform size in the key.
|
||||
// That ensures that we will (at worst) use the wrong program, but one that expects the same
|
||||
// amount of uniform data.
|
||||
|
@ -174,7 +174,7 @@ private:
|
||||
|
||||
std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "src/core/SkMatrixPriv.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/effects/GrMatrixEffect.h"
|
||||
#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
|
||||
#include "src/sksl/SkSLUtil.h"
|
||||
@ -720,7 +721,7 @@ std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrTextureEffect::onMakeProgram
|
||||
return std::make_unique<Impl>();
|
||||
}
|
||||
|
||||
void GrTextureEffect::onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const {
|
||||
void GrTextureEffect::onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder* b) const {
|
||||
auto m0 = static_cast<uint32_t>(fShaderModes[0]);
|
||||
b->addBits(8, m0, "shaderMode0");
|
||||
|
||||
|
@ -168,7 +168,7 @@ private:
|
||||
|
||||
std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "src/core/SkYUVMath.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/GrYUVATextureProxies.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/effects/GrMatrixEffect.h"
|
||||
#include "src/gpu/effects/GrTextureEffect.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
@ -336,7 +337,7 @@ std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrYUVtoRGBEffect::onMakeProgra
|
||||
return std::make_unique<Impl>();
|
||||
}
|
||||
|
||||
void GrYUVtoRGBEffect::onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||||
void GrYUVtoRGBEffect::onAddToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const {
|
||||
uint32_t packed = 0;
|
||||
int i = 0;
|
||||
for (auto [plane, channel] : fLocations) {
|
||||
|
@ -41,7 +41,7 @@ private:
|
||||
|
||||
std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
|
||||
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "src/gpu/GrRenderTargetProxy.h"
|
||||
#include "src/gpu/GrShaderCaps.h"
|
||||
#include "src/gpu/GrSurfaceProxy.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/mtl/GrMtlRenderTarget.h"
|
||||
#include "src/gpu/mtl/GrMtlTexture.h"
|
||||
#include "src/gpu/mtl/GrMtlUtil.h"
|
||||
@ -1148,7 +1149,7 @@ GrProgramDesc GrMtlCaps::makeDesc(GrRenderTarget*, const GrProgramInfo& programI
|
||||
GrProgramDesc desc;
|
||||
GrProgramDesc::Build(&desc, programInfo, *this);
|
||||
|
||||
GrProcessorKeyBuilder b(desc.key());
|
||||
skgpu::KeyBuilder b(desc.key());
|
||||
|
||||
// If ordering here is changed, update getStencilPixelFormat() below
|
||||
b.add32(programInfo.backendFormat().asMtlFormat());
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "src/gpu/GrGeometryProcessor.h"
|
||||
#include "src/gpu/GrProcessor.h"
|
||||
#include "src/gpu/GrProgramInfo.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/geometry/GrPathUtils.h"
|
||||
#include "src/gpu/geometry/GrStyledShape.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
@ -559,7 +560,7 @@ public:
|
||||
|
||||
const char* name() const override { return "QuadEdge"; }
|
||||
|
||||
void addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override {
|
||||
void addToKey(const GrShaderCaps& caps, KeyBuilder* b) const override {
|
||||
b->addBool(fUsesLocalCoords, "usesLocalCoords");
|
||||
b->addBits(ProgramImpl::kMatrixKeyBits,
|
||||
ProgramImpl::ComputeMatrixKey(caps, fLocalMatrix),
|
||||
|
@ -8,12 +8,17 @@
|
||||
#include "src/gpu/ops/AtlasInstancedHelper.h"
|
||||
|
||||
#include "src/gpu/BufferWriter.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLVarying.h"
|
||||
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
||||
|
||||
namespace skgpu::v1 {
|
||||
|
||||
void AtlasInstancedHelper::getKeyBits(KeyBuilder* b) const {
|
||||
b->addBits(kNumShaderFlags, (int)fShaderFlags, "atlasFlags");
|
||||
}
|
||||
|
||||
void AtlasInstancedHelper::appendInstanceAttribs(
|
||||
SkTArray<GrGeometryProcessor::Attribute>* instanceAttribs) const {
|
||||
instanceAttribs->emplace_back("locations", kFloat4_GrVertexAttribType, kFloat4_GrSLType);
|
||||
|
@ -49,9 +49,7 @@ public:
|
||||
}
|
||||
|
||||
// Adds bits to the shader key that uniquely identify this specific helper's shader code.
|
||||
void getKeyBits(GrProcessorKeyBuilder* b) const {
|
||||
b->addBits(kNumShaderFlags, (int)fShaderFlags, "atlasFlags");
|
||||
}
|
||||
void getKeyBits(KeyBuilder* b) const;
|
||||
|
||||
// Appends the instanced input attribs to the back of the array that we will need in order to
|
||||
// locate our path in the atlas.
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "src/gpu/GrProgramInfo.h"
|
||||
#include "src/gpu/GrRecordingContextPriv.h"
|
||||
#include "src/gpu/GrStyle.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/geometry/GrQuad.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
@ -718,7 +719,7 @@ public:
|
||||
|
||||
const char* name() const override { return "DashingCircleEffect"; }
|
||||
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void addToKey(const GrShaderCaps&, KeyBuilder*) const override;
|
||||
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps&) const override;
|
||||
|
||||
@ -842,7 +843,7 @@ GrGeometryProcessor* DashingCircleEffect::Make(SkArenaAlloc* arena,
|
||||
});
|
||||
}
|
||||
|
||||
void DashingCircleEffect::addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||||
void DashingCircleEffect::addToKey(const GrShaderCaps& caps, KeyBuilder* b) const {
|
||||
uint32_t key = 0;
|
||||
key |= fUsesLocalCoords ? 0x1 : 0x0;
|
||||
key |= static_cast<uint32_t>(fAAMode) << 1;
|
||||
@ -910,7 +911,7 @@ public:
|
||||
|
||||
bool usesLocalCoords() const { return fUsesLocalCoords; }
|
||||
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void addToKey(const GrShaderCaps&, KeyBuilder*) const override;
|
||||
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps&) const override;
|
||||
|
||||
@ -1056,7 +1057,7 @@ GrGeometryProcessor* DashingLineEffect::Make(SkArenaAlloc* arena,
|
||||
});
|
||||
}
|
||||
|
||||
void DashingLineEffect::addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||||
void DashingLineEffect::addToKey(const GrShaderCaps& caps, KeyBuilder* b) const {
|
||||
uint32_t key = 0;
|
||||
key |= fUsesLocalCoords ? 0x1 : 0x0;
|
||||
key |= static_cast<int>(fAAMode) << 1;
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "src/gpu/GrOpsRenderPass.h"
|
||||
#include "src/gpu/GrProgramInfo.h"
|
||||
#include "src/gpu/GrResourceProvider.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLVarying.h"
|
||||
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
||||
@ -53,7 +54,7 @@ private:
|
||||
|
||||
int colorAttribIdx() const { return fUsesLocalCoords ? 3 : 1; }
|
||||
const char* name() const override { return "DrawAtlasPathShader"; }
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const override {
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder* b) const override {
|
||||
b->addBits(1, fUsesLocalCoords, "localCoords");
|
||||
fAtlasHelper->getKeyBits(b);
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "src/gpu/GrGeometryProcessor.h"
|
||||
#include "src/gpu/GrOpFlushState.h"
|
||||
#include "src/gpu/GrProgramInfo.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/glsl/GrGLSLColorSpaceXformHelper.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
@ -59,7 +60,7 @@ public:
|
||||
const Attribute& colorAttr() const { return fAttributes[kColorIndex]; }
|
||||
const Attribute& localCoordsAttr() const { return fAttributes[kLocalCoordsIndex]; }
|
||||
|
||||
void addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override {
|
||||
void addToKey(const GrShaderCaps& caps, KeyBuilder* b) const override {
|
||||
uint32_t key = 0;
|
||||
key |= (fColorArrayType == ColorArrayType::kSkColor) ? 0x1 : 0;
|
||||
key |= ProgramImpl::ComputeMatrixKey(caps, fViewMatrix) << 20;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "src/gpu/GrRecordingContextPriv.h"
|
||||
#include "src/gpu/GrResourceProvider.h"
|
||||
#include "src/gpu/GrVx.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/geometry/GrShape.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLVarying.h"
|
||||
@ -341,7 +342,7 @@ public:
|
||||
|
||||
const char* name() const override { return "FillRRectOp::Processor"; }
|
||||
|
||||
void addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override {
|
||||
void addToKey(const GrShaderCaps& caps, KeyBuilder* b) const override {
|
||||
b->addBits(kNumProcessorFlags, (uint32_t)fFlags, "flags");
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "src/gpu/GrResourceProvider.h"
|
||||
#include "src/gpu/GrShaderCaps.h"
|
||||
#include "src/gpu/GrStyle.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
|
||||
#include "src/gpu/glsl/GrGLSLUniformHandler.h"
|
||||
@ -78,7 +79,7 @@ public:
|
||||
|
||||
const char* name() const override { return "CircleGeometryProcessor"; }
|
||||
|
||||
void addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override {
|
||||
void addToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const override {
|
||||
b->addBool(fStroke, "stroked" );
|
||||
b->addBool(fInClipPlane.isInitialized(), "clipPlane" );
|
||||
b->addBool(fInIsectPlane.isInitialized(), "isectPlane" );
|
||||
@ -280,7 +281,7 @@ public:
|
||||
|
||||
const char* name() const override { return "ButtCapDashedCircleGeometryProcessor"; }
|
||||
|
||||
void addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override {
|
||||
void addToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const override {
|
||||
b->addBits(ProgramImpl::kMatrixKeyBits,
|
||||
ProgramImpl::ComputeMatrixKey(caps, fLocalMatrix),
|
||||
"localMatrixType");
|
||||
@ -536,7 +537,7 @@ public:
|
||||
|
||||
const char* name() const override { return "EllipseGeometryProcessor"; }
|
||||
|
||||
void addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override {
|
||||
void addToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const override {
|
||||
b->addBool(fStroke, "stroked");
|
||||
b->addBits(ProgramImpl::kMatrixKeyBits,
|
||||
ProgramImpl::ComputeMatrixKey(caps, fLocalMatrix),
|
||||
@ -733,7 +734,7 @@ public:
|
||||
|
||||
const char* name() const override { return "DIEllipseGeometryProcessor"; }
|
||||
|
||||
void addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override {
|
||||
void addToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const override {
|
||||
b->addBits(2, static_cast<uint32_t>(fStyle), "style");
|
||||
b->addBits(ProgramImpl::kMatrixKeyBits,
|
||||
ProgramImpl::ComputeMatrixKey(caps, fViewMatrix),
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "src/gpu/GrProgramInfo.h"
|
||||
#include "src/gpu/GrResourceProvider.h"
|
||||
#include "src/gpu/GrResourceProviderPriv.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/glsl/GrGLSLColorSpaceXformHelper.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
@ -43,7 +44,7 @@ public:
|
||||
|
||||
const char* name() const override { return "LatticeGP"; }
|
||||
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const override {
|
||||
void addToKey(const GrShaderCaps&, KeyBuilder* b) const override {
|
||||
b->add32(GrColorSpaceXform::XformKey(fColorSpaceXform.get()));
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
|
||||
private:
|
||||
const char* name() const final { return "tessellate_HullShader"; }
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const final {}
|
||||
void addToKey(const GrShaderCaps&, KeyBuilder*) const final {}
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps&) const final;
|
||||
|
||||
constexpr static int kMaxInstanceAttribCount = 3;
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
|
||||
private:
|
||||
const char* name() const final { return "tessellate_BoundingBoxShader"; }
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const final {}
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const final {}
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps&) const final;
|
||||
|
||||
const SkPMColor4f fColor;
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "include/private/SkVx.h"
|
||||
#include "src/gpu/GrMeshDrawTarget.h"
|
||||
#include "src/gpu/GrResourceProvider.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/geometry/GrQuadUtils.h"
|
||||
#include "src/gpu/glsl/GrGLSLColorSpaceXformHelper.h"
|
||||
@ -624,7 +625,7 @@ public:
|
||||
|
||||
const char* name() const override { return "QuadPerEdgeAAGeometryProcessor"; }
|
||||
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const override {
|
||||
void addToKey(const GrShaderCaps&, KeyBuilder* b) const override {
|
||||
// texturing, device-dimensions are single bit flags
|
||||
b->addBool(fTexSubset.isInitialized(), "subset");
|
||||
b->addBool(fSampler.isInitialized(), "textured");
|
||||
|
@ -5,8 +5,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef tessellate_CullTest_DEFINED
|
||||
#define tessellate_CullTest_DEFINED
|
||||
#ifndef skgpu_tessellate_CullTest_DEFINED
|
||||
#define skgpu_tessellate_CullTest_DEFINED
|
||||
|
||||
#include "include/core/SkMatrix.h"
|
||||
#include "src/gpu/tessellate/Tessellation.h"
|
||||
@ -104,4 +104,4 @@ private:
|
||||
|
||||
} // namespace skgpu
|
||||
|
||||
#endif // tessellate_CullTest_DEFINED
|
||||
#endif // skgpu_tessellate_CullTest_DEFINED
|
||||
|
@ -5,8 +5,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef tessellate_MiddleOutPolygonTriangulator_DEFINED
|
||||
#define tessellate_MiddleOutPolygonTriangulator_DEFINED
|
||||
#ifndef skgpu_tessellate_MiddleOutPolygonTriangulator_DEFINED
|
||||
#define skgpu_tessellate_MiddleOutPolygonTriangulator_DEFINED
|
||||
|
||||
#include "include/core/SkPath.h"
|
||||
#include "include/core/SkPoint.h"
|
||||
@ -239,4 +239,4 @@ private:
|
||||
|
||||
} // namespace skgpu
|
||||
|
||||
#endif // tessellate_MiddleOutPolygonTriangulator_DEFINED
|
||||
#endif // skgpu_tessellate_MiddleOutPolygonTriangulator_DEFINED
|
||||
|
@ -5,8 +5,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef tessellate_Tessellation_DEFINED
|
||||
#define tessellate_Tessellation_DEFINED
|
||||
#ifndef skgpu_tessellate_Tessellation_DEFINED
|
||||
#define skgpu_tessellate_Tessellation_DEFINED
|
||||
|
||||
#include "include/core/SkStrokeRec.h"
|
||||
#include "include/gpu/GrTypes.h"
|
||||
|
@ -5,8 +5,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef tessellate_WangsFormula_DEFINED
|
||||
#define tessellate_WangsFormula_DEFINED
|
||||
#ifndef skgpu_tessellate_WangsFormula_DEFINED
|
||||
#define skgpu_tessellate_WangsFormula_DEFINED
|
||||
|
||||
#include "include/core/SkMatrix.h"
|
||||
#include "include/core/SkPoint.h"
|
||||
@ -316,4 +316,4 @@ SK_MAYBE_UNUSED inline static SkString as_sksl() {
|
||||
|
||||
#undef AI
|
||||
|
||||
#endif // tessellate_WangsFormula_DEFINED
|
||||
#endif // skgpu_tessellate_WangsFormula_DEFINED
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
|
||||
private:
|
||||
const char* name() const final { return "tessellate_SimpleTriangleShader"; }
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const final {}
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const final {}
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps&) const final;
|
||||
};
|
||||
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
|
||||
private:
|
||||
const char* name() const final { return "tessellate_HardwareWedgeShader"; }
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const final {}
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const final {}
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps&) const final;
|
||||
};
|
||||
|
||||
@ -194,7 +194,7 @@ public:
|
||||
|
||||
private:
|
||||
const char* name() const final { return "tessellate_HardwareCurveShader"; }
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const final {}
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const final {}
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps&) const final;
|
||||
};
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "src/gpu/tessellate/shaders/GrPathTessellationShader.h"
|
||||
|
||||
#include "src/core/SkMathPriv.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
||||
#include "src/gpu/tessellate/PathTessellator.h"
|
||||
#include "src/gpu/tessellate/Tessellation.h"
|
||||
@ -73,7 +74,7 @@ public:
|
||||
|
||||
private:
|
||||
const char* name() const final { return "tessellate_MiddleOutShader"; }
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const final {
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder* b) const final {
|
||||
// When color is in a uniform, it's always wide so we need to ignore kWideColorIfEnabled.
|
||||
// When color is in an attrib, its wideness is accounted for as part of the attrib key in
|
||||
// GrGeometryProcessor::getAttributeKey().
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "src/gpu/tessellate/shaders/GrStrokeTessellationShader.h"
|
||||
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLVarying.h"
|
||||
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
||||
@ -398,7 +399,7 @@ void GrStrokeTessellationShader::Impl::setData(const GrGLSLProgramDataManager& p
|
||||
}
|
||||
}
|
||||
|
||||
void GrStrokeTessellationShader::addToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const {
|
||||
void GrStrokeTessellationShader::addToKey(const GrShaderCaps&, skgpu::KeyBuilder* b) const {
|
||||
bool keyNeedsJoin = (fMode != Mode::kHardwareTessellation) &&
|
||||
!(fPatchAttribs & PatchAttribs::kStrokeParams);
|
||||
SkASSERT((int)fMode >> 2 == 0);
|
||||
|
@ -64,7 +64,7 @@ private:
|
||||
}
|
||||
SkUNREACHABLE;
|
||||
}
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps&) const final;
|
||||
|
||||
const Mode fMode;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "src/gpu/GrShaderCaps.h"
|
||||
#include "src/gpu/GrStencilSettings.h"
|
||||
#include "src/gpu/GrUtil.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/vk/GrVkGpu.h"
|
||||
#include "src/gpu/vk/GrVkImage.h"
|
||||
@ -1785,7 +1786,7 @@ int GrVkCaps::getFragmentUniformSet() const {
|
||||
return GrVkUniformHandler::kUniformBufferDescSet;
|
||||
}
|
||||
|
||||
void GrVkCaps::addExtraSamplerKey(GrProcessorKeyBuilder* b,
|
||||
void GrVkCaps::addExtraSamplerKey(skgpu::KeyBuilder* b,
|
||||
GrSamplerState samplerState,
|
||||
const GrBackendFormat& format) const {
|
||||
const GrVkYcbcrConversionInfo* ycbcrInfo = format.getVkYcbcrConversionInfo();
|
||||
@ -1823,7 +1824,7 @@ GrProgramDesc GrVkCaps::makeDesc(GrRenderTarget* rt,
|
||||
GrProgramDesc desc;
|
||||
GrProgramDesc::Build(&desc, programInfo, *this);
|
||||
|
||||
GrProcessorKeyBuilder b(desc.key());
|
||||
skgpu::KeyBuilder b(desc.key());
|
||||
|
||||
// This will become part of the sheared off key used to persistently cache
|
||||
// the SPIRV code. It needs to be added right after the base key so that,
|
||||
|
@ -241,7 +241,7 @@ public:
|
||||
int getFragmentUniformBinding() const;
|
||||
int getFragmentUniformSet() const;
|
||||
|
||||
void addExtraSamplerKey(GrProcessorKeyBuilder*,
|
||||
void addExtraSamplerKey(skgpu::KeyBuilder*,
|
||||
GrSamplerState,
|
||||
const GrBackendFormat&) const override;
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "src/gpu/vk/GrVkRenderPass.h"
|
||||
|
||||
#include "src/gpu/GrProcessor.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/vk/GrVkFramebuffer.h"
|
||||
#include "src/gpu/vk/GrVkGpu.h"
|
||||
#include "src/gpu/vk/GrVkRenderTarget.h"
|
||||
@ -441,12 +442,12 @@ bool GrVkRenderPass::equalLoadStoreOps(const LoadStoreOps& colorOps,
|
||||
return true;
|
||||
}
|
||||
|
||||
void GrVkRenderPass::genKey(GrProcessorKeyBuilder* b) const {
|
||||
void GrVkRenderPass::genKey(skgpu::KeyBuilder* b) const {
|
||||
GenKey(b, fAttachmentFlags, fAttachmentsDescriptor, fSelfDepFlags,
|
||||
fLoadFromResolve, (uint64_t)fRenderPass);
|
||||
}
|
||||
|
||||
void GrVkRenderPass::GenKey(GrProcessorKeyBuilder* b,
|
||||
void GrVkRenderPass::GenKey(skgpu::KeyBuilder* b,
|
||||
AttachmentFlags attachmentFlags,
|
||||
const AttachmentsDescriptor& attachmentsDescriptor,
|
||||
SelfDependencyFlags selfDepFlags,
|
||||
|
@ -15,9 +15,11 @@
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
class GrProcessorKeyBuilder;
|
||||
class GrVkGpu;
|
||||
class GrVkRenderTarget;
|
||||
namespace skgpu {
|
||||
class KeyBuilder;
|
||||
}
|
||||
|
||||
class GrVkRenderPass : public GrVkManagedResource {
|
||||
public:
|
||||
@ -156,9 +158,9 @@ public:
|
||||
uint32_t clearValueCount() const { return fClearValueCount; }
|
||||
|
||||
|
||||
void genKey(GrProcessorKeyBuilder*) const;
|
||||
void genKey(skgpu::KeyBuilder*) const;
|
||||
|
||||
static void GenKey(GrProcessorKeyBuilder*,
|
||||
static void GenKey(skgpu::KeyBuilder*,
|
||||
AttachmentFlags,
|
||||
const AttachmentsDescriptor&,
|
||||
SelfDependencyFlags selfDepFlags,
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/gpu/GrFragmentProcessor.h"
|
||||
#include "src/gpu/GrRecordingContextPriv.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/effects/GrMatrixEffect.h"
|
||||
#include "src/gpu/effects/GrTextureEffect.h"
|
||||
@ -623,7 +624,7 @@ private:
|
||||
return std::make_unique<Impl>();
|
||||
}
|
||||
|
||||
void onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override;
|
||||
void onAddToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const override;
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor& sBase) const override {
|
||||
const GrPerlinNoise2Effect& s = sBase.cast<GrPerlinNoise2Effect>();
|
||||
@ -894,7 +895,7 @@ void GrPerlinNoise2Effect::Impl::onSetData(const GrGLSLProgramDataManager& pdman
|
||||
}
|
||||
}
|
||||
|
||||
void GrPerlinNoise2Effect::onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||||
void GrPerlinNoise2Effect::onAddToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const {
|
||||
uint32_t key = fNumOctaves;
|
||||
key = key << 3; // Make room for next 3 bits
|
||||
switch (fType) {
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "src/gpu/GrOpsRenderPass.h"
|
||||
#include "src/gpu/GrProgramInfo.h"
|
||||
#include "src/gpu/GrResourceProvider.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLVarying.h"
|
||||
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
||||
@ -450,7 +451,7 @@ public:
|
||||
|
||||
const char* name() const override { return "GrMeshTestProcessor"; }
|
||||
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const final {
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder* b) const final {
|
||||
b->add32(fInstanceLocation.isInitialized());
|
||||
b->add32(fVertexPosition.isInitialized());
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
|
||||
const char* name() const override { return "GrPipelineDynamicStateTest Processor"; }
|
||||
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const final {}
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const final {}
|
||||
|
||||
std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps&) const final;
|
||||
|
||||
|
@ -167,7 +167,7 @@ public:
|
||||
std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
|
||||
return nullptr;
|
||||
}
|
||||
void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
|
||||
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override {}
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override { return false; }
|
||||
|
||||
GrRecordingContext* const fContext;
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "src/gpu/GrMemoryPool.h"
|
||||
#include "src/gpu/GrOpFlushState.h"
|
||||
#include "src/gpu/GrProgramInfo.h"
|
||||
#include "src/gpu/KeyBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLVarying.h"
|
||||
#include "src/gpu/ops/GrMeshDrawOp.h"
|
||||
@ -94,7 +95,7 @@ private:
|
||||
|
||||
return std::make_unique<Impl>();
|
||||
}
|
||||
void addToKey(const GrShaderCaps&, GrProcessorKeyBuilder* builder) const override {
|
||||
void addToKey(const GrShaderCaps&, skgpu::KeyBuilder* builder) const override {
|
||||
builder->add32(fNumAttribs);
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user