aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrProcessor.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2016-11-29 11:59:17 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-29 17:42:53 +0000
commitf9f451213a3951d8a61568998de2ddbd643f6693 (patch)
treeba11ab458cbe8c654337bc704c52f4ca73f6b44a /src/gpu/GrProcessor.cpp
parente18c97b73a0392b2eee57a111122dd5b637e36e6 (diff)
Reland image storage with fixes.
Revert "Revert "Initial OpenGL Image support."" This reverts commit 59dc41175d99d0a31c046aec0c26c4d82a3a3574. BUG=skia: Change-Id: Ibe3c87ce7f746f065fdbcc5a518388cc291112f5 Reviewed-on: https://skia-review.googlesource.com/5131 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrProcessor.cpp')
-rw-r--r--src/gpu/GrProcessor.cpp52
1 files changed, 47 insertions, 5 deletions
diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp
index 1e100e41fa..f4f7ccb138 100644
--- a/src/gpu/GrProcessor.cpp
+++ b/src/gpu/GrProcessor.cpp
@@ -122,7 +122,12 @@ void GrProcessor::addTextureSampler(const TextureSampler* access) {
void GrProcessor::addBufferAccess(const BufferAccess* access) {
fBufferAccesses.push_back(access);
- this->addGpuResource(access->getProgramBuffer());
+ this->addGpuResource(access->programBuffer());
+}
+
+void GrProcessor::addImageStorageAccess(const ImageStorageAccess* access) {
+ fImageStorageAccesses.push_back(access);
+ this->addGpuResource(access->programTexture());
}
void* GrProcessor::operator new(size_t size) {
@@ -133,9 +138,10 @@ void GrProcessor::operator delete(void* target) {
return MemoryPoolAccessor().pool()->release(target);
}
-bool GrProcessor::hasSameSamplers(const GrProcessor& that) const {
+bool GrProcessor::hasSameSamplersAndAccesses(const GrProcessor &that) const {
if (this->numTextureSamplers() != that.numTextureSamplers() ||
- this->numBuffers() != that.numBuffers()) {
+ this->numBuffers() != that.numBuffers() ||
+ this->numImageStorages() != that.numImageStorages()) {
return false;
}
for (int i = 0; i < this->numTextureSamplers(); ++i) {
@@ -148,6 +154,11 @@ bool GrProcessor::hasSameSamplers(const GrProcessor& that) const {
return false;
}
}
+ for (int i = 0; i < this->numImageStorages(); ++i) {
+ if (this->imageStorageAccess(i) != that.imageStorageAccess(i)) {
+ return false;
+ }
+ }
return true;
}
@@ -189,6 +200,37 @@ void GrProcessor::TextureSampler::reset(GrTexture* texture,
///////////////////////////////////////////////////////////////////////////////////////////////////
+GrProcessor::ImageStorageAccess::ImageStorageAccess(sk_sp<GrTexture> texture, GrIOType ioType,
+ GrSLMemoryModel memoryModel,
+ GrSLRestrict restrict,
+ GrShaderFlags visibility) {
+ SkASSERT(texture);
+ fTexture.set(texture.release(), ioType);
+ fMemoryModel = memoryModel;
+ fRestrict = restrict;
+ fVisibility = visibility;
+ // We currently infer this from the config. However, we could allow the client to specify
+ // a format that is different but compatible with the config.
+ switch (fTexture.get()->config()) {
+ case kRGBA_8888_GrPixelConfig:
+ fFormat = GrImageStorageFormat::kRGBA8;
+ break;
+ case kRGBA_8888_sint_GrPixelConfig:
+ fFormat = GrImageStorageFormat::kRGBA8i;
+ break;
+ case kRGBA_half_GrPixelConfig:
+ fFormat = GrImageStorageFormat::kRGBA16f;
+ break;
+ case kRGBA_float_GrPixelConfig:
+ fFormat = GrImageStorageFormat::kRGBA32f;
+ break;
+ default:
+ SkFAIL("Config is not (yet) supported as image storage.");
+ break;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
// Initial static variable from GrXPFactory
-int32_t GrXPFactory::gCurrXPFClassID =
- GrXPFactory::kIllegalXPFClassID;
+int32_t GrXPFactory::gCurrXPFClassID = GrXPFactory::kIllegalXPFClassID;