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

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

Issue 22824009: Remove StreamTextureManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 4f63037c5382b9329fedffcec783b71159ddc1f3..6770c697448029c005c8e3e825b09a1910b799a9 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -53,8 +53,6 @@
#include "gpu/command_buffer/service/shader_manager.h"
#include "gpu/command_buffer/service/shader_translator.h"
#include "gpu/command_buffer/service/shader_translator_cache.h"
-#include "gpu/command_buffer/service/stream_texture.h"
-#include "gpu/command_buffer/service/stream_texture_manager.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "gpu/command_buffer/service/vertex_array_manager.h"
#include "gpu/command_buffer/service/vertex_attrib_manager.h"
@@ -724,10 +722,6 @@ class GLES2DecoderImpl : public GLES2Decoder {
return group_->memory_tracker();
}
- StreamTextureManager* stream_texture_manager() const {
- return group_->stream_texture_manager();
- }
-
bool EnsureGPUMemoryAvailable(size_t estimated_size) {
MemoryTracker* tracker = memory_tracker();
if (tracker) {
@@ -3882,12 +3876,6 @@ void GLES2DecoderImpl::DoBindTexture(GLenum target, GLuint client_id) {
"glBindTexture", "texture bound to more than 1 target.");
return;
}
- if (texture->IsStreamTexture() && target != GL_TEXTURE_EXTERNAL_OES) {
- LOCAL_SET_GL_ERROR(
- GL_INVALID_OPERATION,
- "glBindTexture", "illegal target for stream texture.");
- return;
- }
LogClientServiceForInfo(texture, client_id, "glBindTexture");
if (texture->target() == 0) {
texture_manager()->SetTarget(texture_ref, target);
@@ -5670,12 +5658,12 @@ void GLES2DecoderImpl::ForceCompileShaderIfPending(Shader* shader) {
}
void GLES2DecoderImpl::UpdateStreamTextureIfNeeded(Texture* texture) {
- if (texture && texture->IsStreamTexture()) {
- DCHECK(stream_texture_manager());
- StreamTexture* stream_tex =
- stream_texture_manager()->LookupStreamTexture(texture->service_id());
- if (stream_tex)
- stream_tex->Update();
+ if (features().chromium_stream_texture && texture &&
+ texture->target() == GL_TEXTURE_EXTERNAL_OES) {
+ scoped_refptr<gfx::GLImage> stream_tex =
+ texture->GetLevelImage(GL_TEXTURE_EXTERNAL_OES, 0);
+ if (stream_tex.get())
+ stream_tex->UpdateTexImage();
}
}
@@ -9486,50 +9474,53 @@ error::Error GLES2DecoderImpl::HandleCreateStreamTextureCHROMIUM(
}
Texture* texture = texture_ref->texture();
- if (texture->IsStreamTexture()) {
- LOCAL_SET_GL_ERROR(
- GL_INVALID_OPERATION,
- "glCreateStreamTextureCHROMIUM", "is already a stream texture.");
- return error::kNoError;
- }
-
if (texture->target() && texture->target() != GL_TEXTURE_EXTERNAL_OES) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glCreateStreamTextureCHROMIUM",
"is already bound to incompatible target.");
return error::kNoError;
- }
-
- if (!stream_texture_manager())
- return error::kInvalidArguments;
-
- GLuint object_id = stream_texture_manager()->CreateStreamTexture(
- texture->service_id(), client_id);
-
- if (object_id) {
- texture_manager()->SetStreamTexture(texture_ref, true);
+ } else if (!texture->target()) {
+ texture_manager()->SetTarget(texture_ref, GL_TEXTURE_EXTERNAL_OES);
+ }
+
+ scoped_refptr<gfx::GLImage> image =
+ gfx::GLImage::CreateGLImageForStreamTexture(texture->service_id());
piman 2013/08/12 23:22:07 General question: is it ok for the GLImage to outl
no sievers 2013/08/13 00:21:35 I think it should be harmless, at least with the c
+
+ uint32 image_id = 0;
+ if (image) {
+ image_id = group_->GetIdAllocator(id_namespaces::kImages)->AllocateID();
+ image_manager()->AddImage(image, image_id);
+ texture_manager()->SetLevelInfo(texture_ref,
+ GL_TEXTURE_EXTERNAL_OES,
+ 0,
+ GL_RGBA,
+ 0,
+ 0,
+ 1,
+ 0,
+ GL_RGBA,
+ GL_UNSIGNED_BYTE,
+ true);
+ texture_manager()->SetLevelImage(
+ texture_ref, GL_TEXTURE_EXTERNAL_OES, 0, image);
} else {
LOCAL_SET_GL_ERROR(
GL_OUT_OF_MEMORY,
"glCreateStreamTextureCHROMIUM", "failed to create platform texture.");
}
- *result = object_id;
+ *result = image_id;
return error::kNoError;
}
error::Error GLES2DecoderImpl::HandleDestroyStreamTextureCHROMIUM(
uint32 immediate_data_size,
const cmds::DestroyStreamTextureCHROMIUM& c) {
- GLuint client_id = c.texture;
- TextureRef* texture_ref = texture_manager()->GetTexture(client_id);
- if (texture_ref && texture_manager()->IsStreamTextureOwner(texture_ref)) {
- if (!stream_texture_manager())
- return error::kInvalidArguments;
-
- stream_texture_manager()->DestroyStreamTexture(texture_ref->service_id());
- texture_manager()->SetStreamTexture(texture_ref, false);
+ GLuint image_id = c.texture;
+ if (image_id && image_manager()->LookupImage(image_id)) {
+ image_manager()->RemoveImage(image_id);
+ group_->GetIdAllocator(id_namespaces::kImages)->FreeID(image_id);
} else {
LOCAL_SET_GL_ERROR(
GL_INVALID_VALUE,
@@ -9741,10 +9732,8 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM(
if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) {
UpdateStreamTextureIfNeeded(source_texture);
- DCHECK(stream_texture_manager());
- StreamTexture* stream_tex =
- stream_texture_manager()->LookupStreamTexture(
- source_texture->service_id());
+ scoped_refptr<gfx::GLImage> stream_tex =
+ source_texture->GetLevelImage(GL_TEXTURE_EXTERNAL_OES, 0);
if (!stream_tex) {
LOCAL_SET_GL_ERROR(
GL_INVALID_VALUE,

Powered by Google App Engine
This is Rietveld 408576698