aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrProcessor.cpp
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/GrProcessor.cpp
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/GrProcessor.cpp')
-rw-r--r--src/gpu/GrProcessor.cpp100
1 files changed, 50 insertions, 50 deletions
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;