Index: gpu/command_buffer/service/texture_manager.cc |
diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc |
index 9bdcb96aa03558104244d803701dcd75191c34fa..42de872e6de522440d643c4cc4051f0ce47b43e6 100644 |
--- a/gpu/command_buffer/service/texture_manager.cc |
+++ b/gpu/command_buffer/service/texture_manager.cc |
@@ -28,6 +28,7 @@ |
#include "ui/gl/gl_context.h" |
#include "ui/gl/gl_implementation.h" |
#include "ui/gl/gl_state_restorer.h" |
+#include "ui/gl/gl_stream_texture_image.h" |
reveman
2016/02/18 20:20:57
Did you forget to add this file? Btw, can this cla
liberato (no reviews please)
2016/02/19 18:39:56
Done.
|
#include "ui/gl/gl_version_info.h" |
#include "ui/gl/trace_util.h" |
@@ -1327,10 +1328,12 @@ bool Texture::ClearLevel( |
return true; |
} |
-void Texture::SetLevelImage(GLenum target, |
- GLint level, |
- gl::GLImage* image, |
- ImageState state) { |
+void Texture::SetLevelImageInternal( |
+ GLenum target, |
+ GLint level, |
+ gl::GLImage* image, |
+ gl::GLStreamTextureImage* stream_texture_image, |
+ ImageState state) { |
DCHECK_GE(level, 0); |
size_t face_index = GLES2Util::GLTargetToFaceIndex(target); |
DCHECK_LT(static_cast<size_t>(face_index), |
@@ -1342,15 +1345,29 @@ void Texture::SetLevelImage(GLenum target, |
DCHECK_EQ(info.target, target); |
DCHECK_EQ(info.level, level); |
info.image = image; |
+ info.stream_texture_image = stream_texture_image; |
info.image_state = state; |
UpdateCanRenderCondition(); |
UpdateHasImages(); |
} |
-gl::GLImage* Texture::GetLevelImage(GLint target, |
- GLint level, |
- ImageState* state) const { |
+void Texture::SetLevelImage(GLenum target, |
+ GLint level, |
+ gl::GLImage* image, |
+ ImageState state) { |
+ SetLevelImageInternal(target, level, image, nullptr, state); |
+} |
+ |
+void Texture::SetLevelStreamTextureImage(GLenum target, |
+ GLint level, |
+ gl::GLStreamTextureImage* image, |
+ ImageState state) { |
+ SetLevelImageInternal(target, level, image, image, state); |
+} |
+ |
+const Texture::LevelInfo* Texture::GetLevelInfo(GLint target, |
+ GLint level) const { |
if (target != GL_TEXTURE_2D && target != GL_TEXTURE_EXTERNAL_OES && |
target != GL_TEXTURE_RECTANGLE_ARB) { |
return NULL; |
@@ -1360,19 +1377,38 @@ gl::GLImage* Texture::GetLevelImage(GLint target, |
if (level >= 0 && face_index < face_infos_.size() && |
static_cast<size_t>(level) < face_infos_[face_index].level_infos.size()) { |
const LevelInfo& info = face_infos_[face_index].level_infos[level]; |
- if (info.target != 0) { |
- if (state) |
- *state = info.image_state; |
- return info.image.get(); |
- } |
+ if (info.target != 0) |
+ return &info; |
} |
return NULL; |
} |
+gl::GLImage* Texture::GetLevelImage(GLint target, |
+ GLint level, |
+ ImageState* state) const { |
+ const LevelInfo* info = GetLevelInfo(target, level); |
+ if (!info) |
+ return NULL; |
reveman
2016/02/18 20:20:56
nit: nullptr
liberato (no reviews please)
2016/02/19 18:39:56
Done.
|
+ |
+ if (state) |
+ *state = info->image_state; |
+ return info->image.get(); |
+} |
+ |
gl::GLImage* Texture::GetLevelImage(GLint target, GLint level) const { |
return GetLevelImage(target, level, nullptr); |
} |
+gl::GLStreamTextureImage* Texture::GetLevelStreamTextureImage( |
+ GLint target, |
+ GLint level) const { |
+ const LevelInfo* info = GetLevelInfo(target, level); |
+ if (!info) |
+ return NULL; |
reveman
2016/02/18 20:20:57
nit: nullptr
liberato (no reviews please)
2016/02/19 18:39:56
Done.
|
+ |
+ return info->stream_texture_image.get(); |
+} |
+ |
void Texture::DumpLevelMemory(base::trace_event::ProcessMemoryDump* pmd, |
uint64_t client_tracing_id, |
const std::string& dump_name) const { |
@@ -1868,6 +1904,15 @@ void TextureManager::SetLevelImage(TextureRef* ref, |
ref->texture()->SetLevelImage(target, level, image, state); |
} |
+void TextureManager::SetLevelStreamTextureImage(TextureRef* ref, |
+ GLenum target, |
+ GLint level, |
+ gl::GLStreamTextureImage* image, |
+ Texture::ImageState state) { |
+ DCHECK(ref); |
+ ref->texture()->SetLevelStreamTextureImage(target, level, image, state); |
+} |
+ |
size_t TextureManager::GetSignatureSize() const { |
return sizeof(TextureTag) + sizeof(TextureSignature); |
} |