Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Unified Diff: gpu/command_buffer/service/texture_definition.cc

Issue 1105153003: Avoid EGLImage target texture reuse on PowerVR (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/texture_definition.h ('k') | gpu/config/gpu_driver_bug_list_json.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/texture_definition.cc
diff --git a/gpu/command_buffer/service/texture_definition.cc b/gpu/command_buffer/service/texture_definition.cc
index bb3c49de4e7a6c221c3df8b98795977f760a65d5..a5fe1d388deee2fef9c3095ca42371eee0fef590 100644
--- a/gpu/command_buffer/service/texture_definition.cc
+++ b/gpu/command_buffer/service/texture_definition.cc
@@ -243,6 +243,8 @@ class NativeImageBufferStub : public NativeImageBuffer {
DISALLOW_COPY_AND_ASSIGN(NativeImageBufferStub);
};
+bool g_avoid_egl_target_texture_reuse = false;
+
} // anonymous namespace
// static
@@ -260,6 +262,11 @@ scoped_refptr<NativeImageBuffer> NativeImageBuffer::Create(GLuint texture_id) {
}
}
+// static
+void TextureDefinition::AvoidEGLTargetTextureReuse() {
+ g_avoid_egl_target_texture_reuse = true;
+}
+
TextureDefinition::LevelInfo::LevelInfo()
: target(0),
internal_format(0),
@@ -347,12 +354,12 @@ Texture* TextureDefinition::CreateTexture() const {
glGenTextures(1, &texture_id);
Texture* texture(new Texture(texture_id));
- UpdateTexture(texture);
+ UpdateTextureInternal(texture);
return texture;
}
-void TextureDefinition::UpdateTexture(Texture* texture) const {
+void TextureDefinition::UpdateTextureInternal(Texture* texture) const {
gfx::ScopedTextureBinder texture_binder(target_, texture->service_id());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter_);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter_);
@@ -397,6 +404,22 @@ void TextureDefinition::UpdateTexture(Texture* texture) const {
texture->usage_ = usage_;
}
+void TextureDefinition::UpdateTexture(Texture* texture) const {
+ GLuint old_service_id = 0u;
+ if (image_buffer_.get() && g_avoid_egl_target_texture_reuse) {
+ GLuint service_id = 0u;
+ glGenTextures(1, &service_id);
+ old_service_id = texture->service_id();
+ texture->SetServiceId(service_id);
+ }
+
no sievers 2015/04/29 17:21:30 Sorry I missed this though we talked about it - bu
boliu 2015/04/29 18:22:36 SG, I'll make the patch.
+ UpdateTextureInternal(texture);
+
+ if (old_service_id) {
+ glDeleteTextures(1, &old_service_id);
+ }
+}
+
bool TextureDefinition::Matches(const Texture* texture) const {
DCHECK(target_ == texture->target());
if (texture->min_filter_ != min_filter_ ||
« no previous file with comments | « gpu/command_buffer/service/texture_definition.h ('k') | gpu/config/gpu_driver_bug_list_json.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698