aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-04-04 10:15:51 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-04 15:27:44 +0000
commitab015efc48c462ffdffebb45c02cd19efb254983 (patch)
tree0b120fe0e4238f89f7e4bb73a88a00301ecf1378 /src/gpu
parent19aff5dd5cd83141f12c234c4255a35f63e564cd (diff)
Move the ability to access textures, buffers, and image storages out from GrProcessor.
GrXferProcessor can no longer use this functionality so it is moved to a new intermediate class inherited by GrFragmentProcessor and GrPrimitiveProcessor. Change-Id: I4f30c89bdceb2d77b602bf0646107e0780881c26 Reviewed-on: https://skia-review.googlesource.com/11202 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrFragmentProcessor.cpp2
-rw-r--r--src/gpu/GrPipeline.cpp2
-rw-r--r--src/gpu/GrPrimitiveProcessor.h2
-rw-r--r--src/gpu/GrProcessor.cpp100
-rw-r--r--src/gpu/GrProgramDesc.cpp28
-rw-r--r--src/gpu/effects/GrBicubicEffect.cpp4
-rw-r--r--src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp3
-rw-r--r--src/gpu/effects/GrConstColorProcessor.cpp3
-rw-r--r--src/gpu/effects/GrConvexPolyEffect.cpp8
-rw-r--r--src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp4
-rw-r--r--src/gpu/effects/GrMatrixConvolutionEffect.cpp4
-rw-r--r--src/gpu/effects/GrNonlinearColorSpaceXformEffect.cpp3
-rw-r--r--src/gpu/effects/GrOvalEffect.cpp8
-rw-r--r--src/gpu/effects/GrRRectEffect.cpp8
-rw-r--r--src/gpu/effects/GrSimpleTextureEffect.cpp3
-rw-r--r--src/gpu/effects/GrTextureDomain.cpp6
-rw-r--r--src/gpu/effects/GrYUVEffect.cpp4
-rw-r--r--src/gpu/gl/GrGLProgram.cpp13
-rw-r--r--src/gpu/gl/GrGLProgram.h4
-rw-r--r--src/gpu/glsl/GrGLSLFragmentProcessor.h15
-rw-r--r--src/gpu/glsl/GrGLSLProgramBuilder.cpp11
-rw-r--r--src/gpu/glsl/GrGLSLProgramBuilder.h5
-rw-r--r--src/gpu/vk/GrVkGpuCommandBuffer.cpp4
-rw-r--r--src/gpu/vk/GrVkPipelineState.cpp13
-rw-r--r--src/gpu/vk/GrVkPipelineState.h7
25 files changed, 144 insertions, 120 deletions
diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp
index 601cb3ca8c..352946731b 100644
--- a/src/gpu/GrFragmentProcessor.cpp
+++ b/src/gpu/GrFragmentProcessor.cpp
@@ -353,7 +353,7 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::OverrideInput(sk_sp<GrFragmentPr
private:
void onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& fp) override {
+ const GrFragmentProcessor& fp) override {
GrColor4f color = fp.cast<ReplaceInputFragmentProcessor>().fColor;
if (!fHaveSetColor || color != fPreviousColor) {
pdman.set4fv(fColorUni, 1, color.fRGBA);
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 960cd8adb3..e36db07e0e 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -121,7 +121,7 @@ void GrPipeline::init(const InitArgs& args) {
static void add_dependencies_for_processor(const GrFragmentProcessor* proc, GrRenderTarget* rt) {
GrFragmentProcessor::TextureAccessIter iter(proc);
- while (const GrProcessor::TextureSampler* sampler = iter.next()) {
+ while (const GrResourceIOProcessor::TextureSampler* sampler = iter.next()) {
SkASSERT(rt->getLastOpList());
rt->getLastOpList()->addDependency(sampler->texture());
}
diff --git a/src/gpu/GrPrimitiveProcessor.h b/src/gpu/GrPrimitiveProcessor.h
index ddccd99496..76fa6c591e 100644
--- a/src/gpu/GrPrimitiveProcessor.h
+++ b/src/gpu/GrPrimitiveProcessor.h
@@ -38,7 +38,7 @@ class GrGLSLPrimitiveProcessor;
* GrPrimitiveProcessors must proivide seed color and coverage for the Ganesh color / coverage
* pipelines, and they must provide some notion of equality
*/
-class GrPrimitiveProcessor : public GrProcessor {
+class GrPrimitiveProcessor : public GrResourceIOProcessor {
public:
// Only the GrGeometryProcessor subclass actually has a geo shader or vertex attributes, but
// we put these calls on the base class to prevent having to cast
diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp
index 4ab54681cc..7c1052886d 100644
--- a/src/gpu/GrProcessor.cpp
+++ b/src/gpu/GrProcessor.cpp
@@ -120,21 +120,27 @@ int32_t GrProcessor::gCurrProcessorClassID = GrProcessor::kIllegalProcessorClass
///////////////////////////////////////////////////////////////////////////////
-GrProcessor::~GrProcessor() {}
+void* GrProcessor::operator new(size_t size) { return MemoryPoolAccessor().pool()->allocate(size); }
-void GrProcessor::addTextureSampler(const TextureSampler* access) {
+void GrProcessor::operator delete(void* target) {
+ return MemoryPoolAccessor().pool()->release(target);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void GrResourceIOProcessor::addTextureSampler(const TextureSampler* access) {
fTextureSamplers.push_back(access);
}
-void GrProcessor::addBufferAccess(const BufferAccess* access) {
+void GrResourceIOProcessor::addBufferAccess(const BufferAccess* access) {
fBufferAccesses.push_back(access);
}
-void GrProcessor::addImageStorageAccess(const ImageStorageAccess* access) {
+void GrResourceIOProcessor::addImageStorageAccess(const ImageStorageAccess* access) {
fImageStorageAccesses.push_back(access);
}
-void GrProcessor::addPendingIOs() const {
+void GrResourceIOProcessor::addPendingIOs() const {
for (const auto& sampler : fTextureSamplers) {
sampler->programTexture()->markPendingIO();
}
@@ -146,7 +152,7 @@ void GrProcessor::addPendingIOs() const {
}
}
-void GrProcessor::removeRefs() const {
+void GrResourceIOProcessor::removeRefs() const {
for (const auto& sampler : fTextureSamplers) {
sampler->programTexture()->removeRef();
}
@@ -158,7 +164,7 @@ void GrProcessor::removeRefs() const {
}
}
-void GrProcessor::pendingIOComplete() const {
+void GrResourceIOProcessor::pendingIOComplete() const {
for (const auto& sampler : fTextureSamplers) {
sampler->programTexture()->pendingIOComplete();
}
@@ -170,15 +176,7 @@ void GrProcessor::pendingIOComplete() const {
}
}
-void* GrProcessor::operator new(size_t size) {
- return MemoryPoolAccessor().pool()->allocate(size);
-}
-
-void GrProcessor::operator delete(void* target) {
- return MemoryPoolAccessor().pool()->release(target);
-}
-
-bool GrProcessor::hasSameSamplersAndAccesses(const GrProcessor &that) const {
+bool GrResourceIOProcessor::hasSameSamplersAndAccesses(const GrResourceIOProcessor& that) const {
if (this->numTextureSamplers() != that.numTextureSamplers() ||
this->numBuffers() != that.numBuffers() ||
this->numImageStorages() != that.numImageStorages()) {
@@ -204,36 +202,37 @@ bool GrProcessor::hasSameSamplersAndAccesses(const GrProcessor &that) const {
///////////////////////////////////////////////////////////////////////////////////////////////////
-GrProcessor::TextureSampler::TextureSampler() {}
+GrResourceIOProcessor::TextureSampler::TextureSampler() {}
-GrProcessor::TextureSampler::TextureSampler(GrTexture* texture, const GrSamplerParams& params) {
+GrResourceIOProcessor::TextureSampler::TextureSampler(GrTexture* texture,
+ const GrSamplerParams& params) {
this->reset(texture, params);
}
-GrProcessor::TextureSampler::TextureSampler(GrTexture* texture,
- GrSamplerParams::FilterMode filterMode,
- SkShader::TileMode tileXAndY,
- GrShaderFlags visibility) {
+GrResourceIOProcessor::TextureSampler::TextureSampler(GrTexture* texture,
+ GrSamplerParams::FilterMode filterMode,
+ SkShader::TileMode tileXAndY,
+ GrShaderFlags visibility) {
this->reset(texture, filterMode, tileXAndY, visibility);
}
-GrProcessor::TextureSampler::TextureSampler(GrResourceProvider* resourceProvider,
- sk_sp<GrTextureProxy> proxy,
- const GrSamplerParams& params) {
+GrResourceIOProcessor::TextureSampler::TextureSampler(GrResourceProvider* resourceProvider,
+ sk_sp<GrTextureProxy> proxy,
+ const GrSamplerParams& params) {
this->reset(resourceProvider, std::move(proxy), params);
}
-GrProcessor::TextureSampler::TextureSampler(GrResourceProvider* resourceProvider,
- sk_sp<GrTextureProxy> proxy,
- GrSamplerParams::FilterMode filterMode,
- SkShader::TileMode tileXAndY,
- GrShaderFlags visibility) {
+GrResourceIOProcessor::TextureSampler::TextureSampler(GrResourceProvider* resourceProvider,
+ sk_sp<GrTextureProxy> proxy,
+ GrSamplerParams::FilterMode filterMode,
+ SkShader::TileMode tileXAndY,
+ GrShaderFlags visibility) {
this->reset(resourceProvider, std::move(proxy), filterMode, tileXAndY, visibility);
}
-void GrProcessor::TextureSampler::reset(GrTexture* texture,
- const GrSamplerParams& params,
- GrShaderFlags visibility) {
+void GrResourceIOProcessor::TextureSampler::reset(GrTexture* texture,
+ const GrSamplerParams& params,
+ GrShaderFlags visibility) {
SkASSERT(texture);
fTexture.set(SkRef(texture), kRead_GrIOType);
fParams = params;
@@ -241,10 +240,10 @@ void GrProcessor::TextureSampler::reset(GrTexture* texture,
fVisibility = visibility;
}
-void GrProcessor::TextureSampler::reset(GrTexture* texture,
- GrSamplerParams::FilterMode filterMode,
- SkShader::TileMode tileXAndY,
- GrShaderFlags visibility) {
+void GrResourceIOProcessor::TextureSampler::reset(GrTexture* texture,
+ GrSamplerParams::FilterMode filterMode,
+ SkShader::TileMode tileXAndY,
+ GrShaderFlags visibility) {
SkASSERT(texture);
fTexture.set(SkRef(texture), kRead_GrIOType);
filterMode = SkTMin(filterMode, texture->texturePriv().highestFilterMode());
@@ -252,10 +251,10 @@ void GrProcessor::TextureSampler::reset(GrTexture* texture,
fVisibility = visibility;
}
-void GrProcessor::TextureSampler::reset(GrResourceProvider* resourceProvider,
- sk_sp<GrTextureProxy> proxy,
- const GrSamplerParams& params,
- GrShaderFlags visibility) {
+void GrResourceIOProcessor::TextureSampler::reset(GrResourceProvider* resourceProvider,
+ sk_sp<GrTextureProxy> proxy,
+ const GrSamplerParams& params,
+ GrShaderFlags visibility) {
// For now, end the deferral at this time. Once all the TextureSamplers are swapped over
// to taking a GrSurfaceProxy just use the IORefs on the proxy
GrTexture* texture = proxy->instantiate(resourceProvider);
@@ -266,11 +265,11 @@ void GrProcessor::TextureSampler::reset(GrResourceProvider* resourceProvider,
fVisibility = visibility;
}
-void GrProcessor::TextureSampler::reset(GrResourceProvider* resourceProvider,
- sk_sp<GrTextureProxy> proxy,
- GrSamplerParams::FilterMode filterMode,
- SkShader::TileMode tileXAndY,
- GrShaderFlags visibility) {
+void GrResourceIOProcessor::TextureSampler::reset(GrResourceProvider* resourceProvider,
+ sk_sp<GrTextureProxy> proxy,
+ GrSamplerParams::FilterMode filterMode,
+ SkShader::TileMode tileXAndY,
+ GrShaderFlags visibility) {
// For now, end the deferral at this time. Once all the TextureSamplers are swapped over
// to taking a GrSurfaceProxy just use the IORefs on the proxy
GrTexture* texture = proxy->instantiate(resourceProvider);
@@ -283,10 +282,11 @@ void GrProcessor::TextureSampler::reset(GrResourceProvider* resourceProvider,
///////////////////////////////////////////////////////////////////////////////////////////////////
-GrProcessor::ImageStorageAccess::ImageStorageAccess(sk_sp<GrTexture> texture, GrIOType ioType,
- GrSLMemoryModel memoryModel,
- GrSLRestrict restrict,
- GrShaderFlags visibility) {
+GrResourceIOProcessor::ImageStorageAccess::ImageStorageAccess(sk_sp<GrTexture> texture,
+ GrIOType ioType,
+ GrSLMemoryModel memoryModel,
+ GrSLRestrict restrict,
+ GrShaderFlags visibility) {
SkASSERT(texture);
fTexture.set(texture.release(), ioType);
fMemoryModel = memoryModel;
diff --git a/src/gpu/GrProgramDesc.cpp b/src/gpu/GrProgramDesc.cpp
index 0b7d2c3d77..86c653d647 100644
--- a/src/gpu/GrProgramDesc.cpp
+++ b/src/gpu/GrProgramDesc.cpp
@@ -61,13 +61,13 @@ static uint16_t sampler_key(GrSLType samplerType, GrPixelConfig config, GrShader
(caps.samplerPrecision(config, visibility) << (8 + kSamplerOrImageTypeKeyBits)));
}
-static uint16_t storage_image_key(const GrProcessor::ImageStorageAccess& imageAccess) {
+static uint16_t storage_image_key(const GrResourceIOProcessor::ImageStorageAccess& imageAccess) {
GrSLType type = imageAccess.texture()->texturePriv().imageStorageType();
return image_storage_or_sampler_uniform_type_key(type) |
(int)imageAccess.format() << kSamplerOrImageTypeKeyBits;
}
-static void add_sampler_and_image_keys(GrProcessorKeyBuilder* b, const GrProcessor& proc,
+static void add_sampler_and_image_keys(GrProcessorKeyBuilder* b, const GrResourceIOProcessor& proc,
const GrShaderCaps& caps) {
int numTextureSamplers = proc.numTextureSamplers();
int numBuffers = proc.numBuffers();
@@ -81,13 +81,13 @@ static void add_sampler_and_image_keys(GrProcessorKeyBuilder* b, const GrProcess
uint16_t* k16 = SkTCast<uint16_t*>(b->add32n(word32Count));
int j = 0;
for (int i = 0; i < numTextureSamplers; ++i, ++j) {
- const GrProcessor::TextureSampler& sampler = proc.textureSampler(i);
+ const GrResourceIOProcessor::TextureSampler& sampler = proc.textureSampler(i);
const GrTexture* tex = sampler.texture();
k16[j] = sampler_key(tex->texturePriv().samplerType(), tex->config(), sampler.visibility(),
caps);
}
for (int i = 0; i < numBuffers; ++i, ++j) {
- const GrProcessor::BufferAccess& access = proc.bufferAccess(i);
+ const GrResourceIOProcessor::BufferAccess& access = proc.bufferAccess(i);
k16[j] = sampler_key(kBufferSampler_GrSLType, access.texelConfig(), access.visibility(),
caps);
}
@@ -109,7 +109,7 @@ static void add_sampler_and_image_keys(GrProcessorKeyBuilder* b, const GrProcess
* transforms, etc, for the space allotted in the meta-key. NOTE, both FPs and GPs share this
* function because it is hairy, though FPs do not have attribs, and GPs do not have transforms
*/
-static bool gen_meta_key(const GrProcessor& proc,
+static bool gen_meta_key(const GrResourceIOProcessor& proc,
const GrShaderCaps& shaderCaps,
uint32_t transformKey,
GrProcessorKeyBuilder* b) {
@@ -130,6 +130,22 @@ static bool gen_meta_key(const GrProcessor& proc,
return true;
}
+static bool gen_meta_key(const GrXferProcessor& xp,
+ const GrShaderCaps& shaderCaps,
+ GrProcessorKeyBuilder* b) {
+ size_t processorKeySize = b->size();
+ uint32_t classID = xp.classID();
+
+ // Currently we allow 16 bits for the class id and the overall processor key size.
+ static const uint32_t kMetaKeyInvalidMask = ~((uint32_t)SK_MaxU16);
+ if ((processorKeySize | classID) & kMetaKeyInvalidMask) {
+ return false;
+ }
+
+ b->add32((classID << 16) | SkToU32(processorKeySize));
+ return true;
+}
+
static bool gen_frag_proc_and_meta_keys(const GrPrimitiveProcessor& primProc,
const GrFragmentProcessor& fp,
const GrShaderCaps& shaderCaps,
@@ -187,7 +203,7 @@ bool GrProgramDesc::Build(GrProgramDesc* desc,
originIfDstTexture = &origin;
}
xp.getGLSLProcessorKey(shaderCaps, &b, originIfDstTexture);
- if (!gen_meta_key(xp, shaderCaps, 0, &b)) {
+ if (!gen_meta_key(xp, shaderCaps, &b)) {
desc->key().reset();
return false;
}
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index b418096da5..c60400e383 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -27,7 +27,7 @@ public:
}
protected:
- void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override;
+ void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
private:
typedef GrGLSLProgramDataManager::UniformHandle UniformHandle;
@@ -118,7 +118,7 @@ void GrGLBicubicEffect::emitCode(EmitArgs& args) {
}
void GrGLBicubicEffect::onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& processor) {
+ const GrFragmentProcessor& processor) {
const GrBicubicEffect& bicubicEffect = processor.cast<GrBicubicEffect>();
GrTexture* texture = processor.textureSampler(0).texture();
float imageIncrement[2];
diff --git a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp
index 2d49883066..95b08d2f0d 100644
--- a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp
+++ b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp
@@ -48,7 +48,8 @@ public:
}
protected:
- void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& proc) override {}
+ void onSetData(const GrGLSLProgramDataManager& pdman,
+ const GrFragmentProcessor& proc) override {}
GrBlurredEdgeFP::Mode fMode;
};
diff --git a/src/gpu/effects/GrConstColorProcessor.cpp b/src/gpu/effects/GrConstColorProcessor.cpp
index 1013ff318a..9f46712f29 100644
--- a/src/gpu/effects/GrConstColorProcessor.cpp
+++ b/src/gpu/effects/GrConstColorProcessor.cpp
@@ -42,7 +42,8 @@ public:
}
protected:
- void onSetData(const GrGLSLProgramDataManager& pdm, const GrProcessor& processor) override {
+ void onSetData(const GrGLSLProgramDataManager& pdm,
+ const GrFragmentProcessor& processor) override {
GrColor4f color = processor.cast<GrConstColorProcessor>().color();
// We use the "illegal" color value as an uninit sentinel. With GrColor4f, the "illegal"
// color is *really* illegal (not just unpremultiplied), so this check is simple.
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index d94d94a29a..312c038201 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -85,7 +85,7 @@ public:
static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
protected:
- void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override;
+ void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
private:
GrGLSLProgramDataManager::UniformHandle fRectUniform;
@@ -137,7 +137,7 @@ void GLAARectEffect::emitCode(EmitArgs& args) {
}
void GLAARectEffect::onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& processor) {
+ const GrFragmentProcessor& processor) {
const AARectEffect& aare = processor.cast<AARectEffect>();
const SkRect& rect = aare.getRect();
if (rect != fPrevRect) {
@@ -176,7 +176,7 @@ public:
static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
protected:
- void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override;
+ void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
private:
GrGLSLProgramDataManager::UniformHandle fEdgeUniform;
@@ -217,7 +217,7 @@ void GrGLConvexPolyEffect::emitCode(EmitArgs& args) {
}
void GrGLConvexPolyEffect::onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& effect) {
+ const GrFragmentProcessor& effect) {
const GrConvexPolyEffect& cpe = effect.cast<GrConvexPolyEffect>();
size_t byteSize = 3 * cpe.getEdgeCount() * sizeof(SkScalar);
if (0 != memcmp(fPrevEdges, cpe.getEdges(), byteSize)) {
diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
index 4fa462e3bf..b4f13143d8 100644
--- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
+++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
@@ -25,7 +25,7 @@ public:
static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
protected:
- void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor&) override;
+ void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
private:
UniformHandle fKernelUni;
@@ -98,7 +98,7 @@ void GrGLConvolutionEffect::emitCode(EmitArgs& args) {
}
void GrGLConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& processor) {
+ const GrFragmentProcessor& processor) {
const GrGaussianConvolutionFragmentProcessor& conv =
processor.cast<GrGaussianConvolutionFragmentProcessor>();
GrTexture& texture = *conv.textureSampler(0).texture();
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index 62a53dd380..03d90ea675 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -20,7 +20,7 @@ public:
static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
protected:
- void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override;
+ void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
private:
typedef GrGLSLProgramDataManager::UniformHandle UniformHandle;
@@ -131,7 +131,7 @@ void GrGLMatrixConvolutionEffect::GenKey(const GrProcessor& processor,
}
void GrGLMatrixConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& processor) {
+ const GrFragmentProcessor& processor) {
const GrMatrixConvolutionEffect& conv = processor.cast<GrMatrixConvolutionEffect>();
GrTexture* texture = conv.textureSampler(0).texture();
diff --git a/src/gpu/effects/GrNonlinearColorSpaceXformEffect.cpp b/src/gpu/effects/GrNonlinearColorSpaceXformEffect.cpp
index d4c0a392d6..c6c0c26574 100644
--- a/src/gpu/effects/GrNonlinearColorSpaceXformEffect.cpp
+++ b/src/gpu/effects/GrNonlinearColorSpaceXformEffect.cpp
@@ -108,7 +108,8 @@ public:
}
protected:
- void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& processor) override {
+ void onSetData(const GrGLSLProgramDataManager& pdman,
+ const GrFragmentProcessor& processor) override {
const GrNonlinearColorSpaceXformEffect& csxe =
processor.cast<GrNonlinearColorSpaceXformEffect>();
if (SkToBool(csxe.ops() & GrNonlinearColorSpaceXformEffect::kSrcTransfer_Op)) {
diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp
index a8b0c847b9..672f5d873c 100644
--- a/src/gpu/effects/GrOvalEffect.cpp
+++ b/src/gpu/effects/GrOvalEffect.cpp
@@ -98,7 +98,7 @@ public:
static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
protected:
- void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override;
+ void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
private:
GrGLSLProgramDataManager::UniformHandle fCircleUniform;
@@ -151,7 +151,7 @@ void GLCircleEffect::GenKey(const GrProcessor& processor, const GrShaderCaps&,
}
void GLCircleEffect::onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& processor) {
+ const GrFragmentProcessor& processor) {
const CircleEffect& ce = processor.cast<CircleEffect>();
if (ce.getRadius() != fPrevRadius || ce.getCenter() != fPrevCenter) {
SkScalar radius = ce.getRadius();
@@ -266,7 +266,7 @@ public:
static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
protected:
- void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override;
+ void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
private:
GrGLSLProgramDataManager::UniformHandle fEllipseUniform;
@@ -344,7 +344,7 @@ void GLEllipseEffect::GenKey(const GrProcessor& effect, const GrShaderCaps&,
}
void GLEllipseEffect::onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& effect) {
+ const GrFragmentProcessor& effect) {
const EllipseEffect& ee = effect.cast<EllipseEffect>();
if (ee.getRadii() != fPrevRadii || ee.getCenter() != fPrevCenter) {
float invRXSqd;
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index 1b4772d155..887bc00bda 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -135,7 +135,7 @@ public:
static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
protected:
- void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override;
+ void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
private:
GrGLSLProgramDataManager::UniformHandle fInnerRectUniform;
@@ -291,7 +291,7 @@ void GLCircularRRectEffect::GenKey(const GrProcessor& processor, const GrShaderC
}
void GLCircularRRectEffect::onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& processor) {
+ const GrFragmentProcessor& processor) {
const CircularRRectEffect& crre = processor.cast<CircularRRectEffect>();
const SkRRect& rrect = crre.getRRect();
if (rrect != fPrevRRect) {
@@ -487,7 +487,7 @@ public:
static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
protected:
- void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override;
+ void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
private:
GrGLSLProgramDataManager::UniformHandle fInnerRectUniform;
@@ -602,7 +602,7 @@ void GLEllipticalRRectEffect::GenKey(const GrProcessor& effect, const GrShaderCa
}
void GLEllipticalRRectEffect::onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& effect) {
+ const GrFragmentProcessor& effect) {
const EllipticalRRectEffect& erre = effect.cast<EllipticalRRectEffect>();
const SkRRect& rrect = erre.getRRect();
// If we're using a scale factor to work around precision issues, choose the largest radius
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp
index 5d2c2882e5..a41ed8b0b9 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.cpp
+++ b/src/gpu/effects/GrSimpleTextureEffect.cpp
@@ -63,7 +63,8 @@ public:
}
protected:
- void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& processor) override {
+ void onSetData(const GrGLSLProgramDataManager& pdman,
+ const GrFragmentProcessor& processor) override {
const GrSimpleTextureEffect& textureEffect = processor.cast<GrSimpleTextureEffect>();
if (SkToBool(textureEffect.colorSpaceXform())) {
fColorSpaceHelper.setData(pdman, textureEffect.colorSpaceXform());
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index 91b1e552b9..ee21841656 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -305,7 +305,8 @@ GrGLSLFragmentProcessor* GrTextureDomainEffect::onCreateGLSLInstance() const {
}
protected:
- void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& fp) override {
+ void onSetData(const GrGLSLProgramDataManager& pdman,
+ const GrFragmentProcessor& fp) override {
const GrTextureDomainEffect& tde = fp.cast<GrTextureDomainEffect>();
const GrTextureDomain& domain = tde.fTextureDomain;
fGLDomain.setData(pdman, domain, tde.textureSampler(0).texture());
@@ -407,7 +408,8 @@ GrGLSLFragmentProcessor* GrDeviceSpaceTextureDecalFragmentProcessor::onCreateGLS
}
protected:
- void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& fp) override {
+ void onSetData(const GrGLSLProgramDataManager& pdman,
+ const GrFragmentProcessor& fp) override {
const GrDeviceSpaceTextureDecalFragmentProcessor& dstdfp =
fp.cast<GrDeviceSpaceTextureDecalFragmentProcessor>();
GrTexture* texture = dstdfp.textureSampler(0).texture();
diff --git a/src/gpu/effects/GrYUVEffect.cpp b/src/gpu/effects/GrYUVEffect.cpp
index f43f60a29f..be4d6c2d5c 100644
--- a/src/gpu/effects/GrYUVEffect.cpp
+++ b/src/gpu/effects/GrYUVEffect.cpp
@@ -131,7 +131,7 @@ public:
protected:
void onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& processor) override {
+ const GrFragmentProcessor& processor) override {
const YUVtoRGBEffect& yuvEffect = processor.cast<YUVtoRGBEffect>();
switch (yuvEffect.getColorSpace()) {
case kJPEG_SkYUVColorSpace:
@@ -285,7 +285,7 @@ public:
private:
void onSetData(const GrGLSLProgramDataManager& pdman,
- const GrProcessor& processor) override {
+ const GrFragmentProcessor& processor) override {
const RGBToYUVEffect& effect = processor.cast<RGBToYUVEffect>();
OutputChannels oc = effect.outputChannels();
if (effect.getColorSpace() != fLastColorSpace || oc != fLastOutputChannels) {
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 29fe35c111..e208e7447e 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -144,30 +144,29 @@ void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc,
}
}
-void GrGLProgram::bindTextures(const GrProcessor& processor,
+void GrGLProgram::bindTextures(const GrResourceIOProcessor& processor,
bool allowSRGBInputs,
int* nextSamplerIdx) {
for (int i = 0; i < processor.numTextureSamplers(); ++i) {
- const GrProcessor::TextureSampler& sampler = processor.textureSampler(i);
+ const GrResourceIOProcessor::TextureSampler& sampler = processor.textureSampler(i);
fGpu->bindTexture((*nextSamplerIdx)++, sampler.params(),
allowSRGBInputs, static_cast<GrGLTexture*>(sampler.texture()));
}
for (int i = 0; i < processor.numBuffers(); ++i) {
- const GrProcessor::BufferAccess& access = processor.bufferAccess(i);
+ const GrResourceIOProcessor::BufferAccess& access = processor.bufferAccess(i);
fGpu->bindTexelBuffer((*nextSamplerIdx)++, access.texelConfig(),
static_cast<GrGLBuffer*>(access.buffer()));
}
for (int i = 0; i < processor.numImageStorages(); ++i) {
- const GrProcessor::ImageStorageAccess& access = processor.imageStorageAccess(i);
+ const GrResourceIOProcessor::ImageStorageAccess& access = processor.imageStorageAccess(i);
fGpu->bindImageStorage((*nextSamplerIdx)++, access.ioType(),
static_cast<GrGLTexture *>(access.texture()));
}
}
-void GrGLProgram::generateMipmaps(const GrProcessor& processor,
- bool allowSRGBInputs) {
+void GrGLProgram::generateMipmaps(const GrResourceIOProcessor& processor, bool allowSRGBInputs) {
for (int i = 0; i < processor.numTextureSamplers(); ++i) {
- const GrProcessor::TextureSampler& sampler = processor.textureSampler(i);
+ const GrResourceIOProcessor::TextureSampler& sampler = processor.textureSampler(i);
fGpu->generateMipmaps(sampler.params(), allowSRGBInputs,
static_cast<GrGLTexture*>(sampler.texture()));
}
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index cd547b0b74..f9b84d8031 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -125,10 +125,10 @@ protected:
void setRenderTargetState(const GrPrimitiveProcessor&, const GrRenderTarget*);
// Helper for setData() that binds textures and texel buffers to the appropriate texture units
- void bindTextures(const GrProcessor&, bool allowSRGBInputs, int* nextSamplerIdx);
+ void bindTextures(const GrResourceIOProcessor&, bool allowSRGBInputs, int* nextSamplerIdx);
// Helper for generateMipmaps() that ensures mipmaps are up to date
- void generateMipmaps(const GrProcessor&, bool allowSRGBInputs);
+ void generateMipmaps(const GrResourceIOProcessor&, bool allowSRGBInputs);
// these reflect the current values of uniforms (GL uniform values travel with program)
RenderTargetState fRenderTargetState;
diff --git a/src/gpu/glsl/GrGLSLFragmentProcessor.h b/src/gpu/glsl/GrGLSLFragmentProcessor.h
index 7a8d51ca83..1cf0d1d000 100644
--- a/src/gpu/glsl/GrGLSLFragmentProcessor.h
+++ b/src/gpu/glsl/GrGLSLFragmentProcessor.h
@@ -70,12 +70,12 @@ private:
public:
using TransformedCoordVars = BuilderInputProvider<GrShaderVar, GrFragmentProcessor,
&GrFragmentProcessor::numCoordTransforms>;
- using TextureSamplers = BuilderInputProvider<SamplerHandle, GrProcessor,
- &GrProcessor::numTextureSamplers>;
- using BufferSamplers = BuilderInputProvider<SamplerHandle, GrProcessor,
- &GrProcessor::numBuffers>;
- using ImageStorages = BuilderInputProvider<ImageStorageHandle, GrProcessor,
- &GrProcessor::numImageStorages>;
+ using TextureSamplers = BuilderInputProvider<SamplerHandle, GrResourceIOProcessor,
+ &GrResourceIOProcessor::numTextureSamplers>;
+ using BufferSamplers = BuilderInputProvider<SamplerHandle, GrResourceIOProcessor,
+ &GrResourceIOProcessor::numBuffers>;
+ using ImageStorages = BuilderInputProvider<ImageStorageHandle, GrResourceIOProcessor,
+ &GrResourceIOProcessor::numImageStorages>;
/** Called when the program stage should insert its code into the shaders. The code in each
shader will be in its own block ({}) and so locally scoped names will not collide across
@@ -194,8 +194,7 @@ protected:
uniform variables required by the shaders created in emitCode(). The GrFragmentProcessor
parameter is guaranteed to be of the same type that created this GrGLSLFragmentProcessor and
to have an identical processor key as the one that created this GrGLSLFragmentProcessor. */
- // TODO update this to pass in GrFragmentProcessor
- virtual void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) {}
+ virtual void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) {}
private:
void internalEmitChild(int, const char*, const char*, EmitArgs&);
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
index 4cd4fd6ec5..12e7ca2c1d 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
@@ -264,14 +264,14 @@ void GrGLSLProgramBuilder::emitAndInstallXferProc(const GrGLSLExpr4& colorIn,
}
void GrGLSLProgramBuilder::emitSamplersAndImageStorages(
- const GrProcessor& processor,
+ const GrResourceIOProcessor& processor,
SkTArray<SamplerHandle>* outTexSamplerHandles,
SkTArray<SamplerHandle>* outBufferSamplerHandles,
SkTArray<ImageStorageHandle>* outImageStorageHandles) {
SkString name;
int numTextureSamplers = processor.numTextureSamplers();
for (int t = 0; t < numTextureSamplers; ++t) {
- const GrProcessor::TextureSampler& sampler = processor.textureSampler(t);
+ const GrResourceIOProcessor::TextureSampler& sampler = processor.textureSampler(t);
name.printf("TextureSampler_%d", outTexSamplerHandles->count());
GrSLType samplerType = sampler.texture()->texturePriv().samplerType();
if (kTextureExternalSampler_GrSLType == samplerType) {
@@ -291,7 +291,7 @@ void GrGLSLProgramBuilder::emitSamplersAndImageStorages(
GrShaderFlags texelBufferVisibility = kNone_GrShaderFlags;
for (int b = 0; b < numBuffers; ++b) {
- const GrProcessor::BufferAccess& access = processor.bufferAccess(b);
+ const GrResourceIOProcessor::BufferAccess& access = processor.bufferAccess(b);
name.printf("BufferSampler_%d", outBufferSamplerHandles->count());
outBufferSamplerHandles->emplace_back(
this->emitSampler(kBufferSampler_GrSLType, access.texelConfig(), name.c_str(),
@@ -307,7 +307,8 @@ void GrGLSLProgramBuilder::emitSamplersAndImageStorages(
}
int numImageStorages = processor.numImageStorages();
for (int i = 0; i < numImageStorages; ++i) {
- const GrProcessor::ImageStorageAccess& imageStorageAccess = processor.imageStorageAccess(i);
+ const GrResourceIOProcessor::ImageStorageAccess& imageStorageAccess =
+ processor.imageStorageAccess(i);
name.printf("Image_%d", outImageStorageHandles->count());
outImageStorageHandles->emplace_back(
this->emitImageStorage(imageStorageAccess, name.c_str()));
@@ -334,7 +335,7 @@ GrGLSLProgramBuilder::SamplerHandle GrGLSLProgramBuilder::emitSampler(GrSLType s
}
GrGLSLProgramBuilder::ImageStorageHandle GrGLSLProgramBuilder::emitImageStorage(
- const GrProcessor::ImageStorageAccess& access, const char* name) {
+ const GrResourceIOProcessor::ImageStorageAccess& access, const char* name) {
if (access.visibility() & kVertex_GrShaderFlag) {
++fNumVertexImageStorages;
}
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.h b/src/gpu/glsl/GrGLSLProgramBuilder.h
index 2d2ab47a5e..147eb98c98 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.h
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.h
@@ -153,13 +153,14 @@ private:
const GrGLSLExpr4& input,
GrGLSLExpr4* output);
void emitAndInstallXferProc(const GrGLSLExpr4& colorIn, const GrGLSLExpr4& coverageIn);
- void emitSamplersAndImageStorages(const GrProcessor& processor,
+ void emitSamplersAndImageStorages(const GrResourceIOProcessor& processor,
SkTArray<SamplerHandle>* outTexSamplerHandles,
SkTArray<SamplerHandle>* outBufferSamplerHandles,
SkTArray<ImageStorageHandle>* outImageStorageHandles);
SamplerHandle emitSampler(GrSLType samplerType, GrPixelConfig, const char* name,
GrShaderFlags visibility);
- ImageStorageHandle emitImageStorage(const GrProcessor::ImageStorageAccess&, const char* name);
+ ImageStorageHandle emitImageStorage(const GrResourceIOProcessor::ImageStorageAccess&,
+ const char* name);
void emitFSOutputSwizzle(bool hasSecondaryOutput);
bool checkSamplerCounts();
bool checkImageStorageCounts();
diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.cpp b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
index 8baf60e1e8..e6593eff9a 100644
--- a/src/gpu/vk/GrVkGpuCommandBuffer.cpp
+++ b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
@@ -492,9 +492,9 @@ static void set_texture_layout(GrVkTexture* vkTexture, GrVkGpu* gpu) {
false);
}
-static void prepare_sampled_images(const GrProcessor& processor, GrVkGpu* gpu) {
+static void prepare_sampled_images(const GrResourceIOProcessor& processor, GrVkGpu* gpu) {
for (int i = 0; i < processor.numTextureSamplers(); ++i) {
- const GrProcessor::TextureSampler& sampler = processor.textureSampler(i);
+ const GrResourceIOProcessor::TextureSampler& sampler = processor.textureSampler(i);
GrVkTexture* vkTexture = static_cast<GrVkTexture*>(sampler.texture());
SkASSERT(vkTexture);
diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp
index b689866be2..4ce7681b15 100644
--- a/src/gpu/vk/GrVkPipelineState.cpp
+++ b/src/gpu/vk/GrVkPipelineState.cpp
@@ -172,12 +172,13 @@ void GrVkPipelineState::abandonGPUResources() {
}
}
-static void append_texture_bindings(const GrProcessor& processor,
- SkTArray<const GrProcessor::TextureSampler*>* textureBindings) {
+static void append_texture_bindings(
+ const GrResourceIOProcessor& processor,
+ SkTArray<const GrResourceIOProcessor::TextureSampler*>* textureBindings) {
// We don't support image storages in VK.
SkASSERT(!processor.numImageStorages());
if (int numTextureSamplers = processor.numTextureSamplers()) {
- const GrProcessor::TextureSampler** bindings =
+ const GrResourceIOProcessor::TextureSampler** bindings =
textureBindings->push_back_n(numTextureSamplers);
int i = 0;
do {
@@ -195,7 +196,7 @@ void GrVkPipelineState::setData(GrVkGpu* gpu,
this->setRenderTargetState(pipeline.getRenderTarget());
- SkSTArray<8, const GrProcessor::TextureSampler*> textureBindings;
+ SkSTArray<8, const GrResourceIOProcessor::TextureSampler*> textureBindings;
fGeometryProcessor->setData(fDataManager, primProc,
GrFragmentProcessor::CoordTransformIter(pipeline));
@@ -217,7 +218,7 @@ void GrVkPipelineState::setData(GrVkGpu* gpu,
SkIPoint offset;
GrTexture* dstTexture = pipeline.dstTexture(&offset);
fXferProcessor->setData(fDataManager, pipeline.getXferProcessor(), dstTexture, offset);
- GrProcessor::TextureSampler dstTextureSampler;
+ GrResourceIOProcessor::TextureSampler dstTextureSampler;
if (dstTexture) {
dstTextureSampler.reset(dstTexture);
textureBindings.push_back(&dstTextureSampler);
@@ -313,7 +314,7 @@ void GrVkPipelineState::writeUniformBuffers(const GrVkGpu* gpu) {
void GrVkPipelineState::writeSamplers(
GrVkGpu* gpu,
- const SkTArray<const GrProcessor::TextureSampler*>& textureBindings,
+ const SkTArray<const GrResourceIOProcessor::TextureSampler*>& textureBindings,
bool allowSRGBInputs) {
SkASSERT(fNumSamplers == textureBindings.count());
diff --git a/src/gpu/vk/GrVkPipelineState.h b/src/gpu/vk/GrVkPipelineState.h
index c4ca4caf59..4d23364b83 100644
--- a/src/gpu/vk/GrVkPipelineState.h
+++ b/src/gpu/vk/GrVkPipelineState.h
@@ -141,9 +141,10 @@ private:
void writeUniformBuffers(const GrVkGpu* gpu);
- void writeSamplers(GrVkGpu* gpu,
- const SkTArray<const GrProcessor::TextureSampler*>& textureBindings,
- bool allowSRGBInputs);
+ void writeSamplers(
+ GrVkGpu* gpu,
+ const SkTArray<const GrResourceIOProcessor::TextureSampler*>& textureBindings,
+ bool allowSRGBInputs);
/**
* We use the RT's size and origin to adjust from Skia device space to vulkan normalized device