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

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

Issue 14844004: gpu: Refactor to support cross-channel shared textures (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix accidentally reverted behavior Created 7 years, 7 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 7e1e01e36bc2b0bacc00e10d678d69afa5ea50fa..d7665f99e7e17b6e0c1c1e8d64bbfd68e2bfbfb2 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -693,13 +693,13 @@ class GLES2DecoderImpl : public GLES2Decoder {
}
// Creates a Texture for the given texture.
- Texture* CreateTexture(
+ TextureRef* CreateTexture(
GLuint client_id, GLuint service_id) {
return texture_manager()->CreateTexture(client_id, service_id);
}
// Gets the texture info for the given texture. Returns NULL if none exists.
- Texture* GetTexture(GLuint client_id) const {
+ TextureRef* GetTexture(GLuint client_id) const {
return texture_manager()->GetTexture(client_id);
}
@@ -1376,9 +1376,9 @@ class GLES2DecoderImpl : public GLES2Decoder {
}
// Gets the texture id for a given target.
- Texture* GetTextureInfoForTarget(GLenum target) {
+ TextureRef* GetTextureInfoForTarget(GLenum target) {
TextureUnit& unit = state_.texture_units[state_.active_texture_unit];
- Texture* texture = NULL;
+ TextureRef* texture = NULL;
switch (target) {
case GL_TEXTURE_2D:
texture = unit.bound_texture_2d;
@@ -1405,9 +1405,9 @@ class GLES2DecoderImpl : public GLES2Decoder {
return texture;
}
- Texture* GetTextureInfoForTargetUnlessDefault(
+ TextureRef* GetTextureInfoForTargetUnlessDefault(
GLenum target) {
- Texture* texture = GetTextureInfoForTarget(target);
+ TextureRef* texture = GetTextureInfoForTarget(target);
if (!texture)
return NULL;
if (texture == texture_manager()->GetDefaultTextureInfo(target))
@@ -1614,7 +1614,7 @@ class GLES2DecoderImpl : public GLES2Decoder {
// The copy that is saved when SwapBuffers is called.
scoped_ptr<BackFramebuffer> offscreen_saved_frame_buffer_;
scoped_ptr<BackTexture> offscreen_saved_color_texture_;
- scoped_refptr<Texture>
+ scoped_refptr<TextureRef>
offscreen_saved_color_texture_info_;
// The copy that is used as the destination for multi-sample resolves.
@@ -2234,25 +2234,25 @@ bool GLES2DecoderImpl::Initialize(
for (uint32 tt = 0; tt < state_.texture_units.size(); ++tt) {
glActiveTexture(GL_TEXTURE0 + tt);
// We want the last bind to be 2D.
- Texture* texture;
+ TextureRef* ref;
if (features().oes_egl_image_external) {
- texture = texture_manager()->GetDefaultTextureInfo(
+ ref = texture_manager()->GetDefaultTextureInfo(
GL_TEXTURE_EXTERNAL_OES);
- state_.texture_units[tt].bound_texture_external_oes = texture;
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture->service_id());
+ state_.texture_units[tt].bound_texture_external_oes = ref;
+ glBindTexture(GL_TEXTURE_EXTERNAL_OES, ref->service_id());
}
if (features().arb_texture_rectangle) {
- texture = texture_manager()->GetDefaultTextureInfo(
+ ref = texture_manager()->GetDefaultTextureInfo(
GL_TEXTURE_RECTANGLE_ARB);
- state_.texture_units[tt].bound_texture_rectangle_arb = texture;
- glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texture->service_id());
+ state_.texture_units[tt].bound_texture_rectangle_arb = ref;
+ glBindTexture(GL_TEXTURE_RECTANGLE_ARB, ref->service_id());
}
- texture = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_CUBE_MAP);
- state_.texture_units[tt].bound_texture_cube_map = texture;
- glBindTexture(GL_TEXTURE_CUBE_MAP, texture->service_id());
- texture = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_2D);
- state_.texture_units[tt].bound_texture_2d = texture;
- glBindTexture(GL_TEXTURE_2D, texture->service_id());
+ ref = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_CUBE_MAP);
+ state_.texture_units[tt].bound_texture_cube_map = ref;
+ glBindTexture(GL_TEXTURE_CUBE_MAP, ref->service_id());
+ ref = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_2D);
+ state_.texture_units[tt].bound_texture_2d = ref;
+ glBindTexture(GL_TEXTURE_2D, ref->service_id());
}
glActiveTexture(GL_TEXTURE0);
CHECK_GL_ERROR();
@@ -2705,28 +2705,30 @@ void GLES2DecoderImpl::DeleteTexturesHelper(
bool supports_separate_framebuffer_binds =
features().chromium_framebuffer_multisample;
for (GLsizei ii = 0; ii < n; ++ii) {
- Texture* texture = GetTexture(client_ids[ii]);
- if (texture && !texture->IsDeleted()) {
+ TextureRef* texture_ref = GetTexture(client_ids[ii]);
+ if (texture_ref) {
+ Texture* texture = texture_ref->texture();
if (texture->IsAttachedToFramebuffer()) {
clear_state_dirty_ = true;
}
- // Unbind texture from texture units.
+ // Unbind texture_ref from texture_ref units.
for (size_t jj = 0; jj < state_.texture_units.size(); ++jj) {
- state_.texture_units[jj].Unbind(texture);
+ state_.texture_units[jj].Unbind(texture_ref);
}
// Unbind from current framebuffers.
if (supports_separate_framebuffer_binds) {
if (state_.bound_read_framebuffer) {
state_.bound_read_framebuffer->UnbindTexture(
- GL_READ_FRAMEBUFFER_EXT, texture);
+ GL_READ_FRAMEBUFFER_EXT, texture_ref);
}
if (state_.bound_draw_framebuffer) {
state_.bound_draw_framebuffer->UnbindTexture(
- GL_DRAW_FRAMEBUFFER_EXT, texture);
+ GL_DRAW_FRAMEBUFFER_EXT, texture_ref);
}
} else {
if (state_.bound_draw_framebuffer) {
- state_.bound_draw_framebuffer->UnbindTexture(GL_FRAMEBUFFER, texture);
+ state_.bound_draw_framebuffer->UnbindTexture(GL_FRAMEBUFFER,
+ texture_ref);
}
}
GLuint service_id = texture->service_id();
@@ -2771,6 +2773,8 @@ bool GLES2DecoderImpl::MakeCurrent() {
if (workarounds().unbind_fbo_on_context_switch)
RestoreFramebufferBindings();
+ clear_state_dirty_ = true;
+
return true;
}
@@ -2972,9 +2976,9 @@ void GLES2DecoderImpl::UpdateParentTextureInfo() {
// Update the info about the offscreen saved color texture in the parent.
// The reference to the parent is a weak pointer and will become null if the
// parent is later destroyed.
+ GLenum target = offscreen_saved_color_texture_info_->texture()->target();
TextureManager* parent_texture_manager = parent_->texture_manager();
- glBindTexture(offscreen_saved_color_texture_info_->target(),
- offscreen_saved_color_texture_info_->service_id());
+ glBindTexture(target, offscreen_saved_color_texture_info_->service_id());
parent_texture_manager->SetLevelInfo(
offscreen_saved_color_texture_info_,
GL_TEXTURE_2D,
@@ -3011,10 +3015,8 @@ void GLES2DecoderImpl::UpdateParentTextureInfo() {
offscreen_saved_color_texture_info_,
GL_TEXTURE_WRAP_T,
GL_CLAMP_TO_EDGE);
- Texture* texture = GetTextureInfoForTarget(
- offscreen_saved_color_texture_info_->target());
- glBindTexture(offscreen_saved_color_texture_info_->target(),
- texture ? texture->service_id() : 0);
+ TextureRef* texture_ref = GetTextureInfoForTarget(target);
+ glBindTexture(target, texture_ref ? texture_ref->service_id() : 0);
} else {
offscreen_saved_color_texture_info_ = NULL;
}
@@ -3059,9 +3061,9 @@ void GLES2DecoderImpl::SetAsyncPixelTransferDelegate(
bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id,
uint32* service_texture_id) {
- Texture* texture = texture_manager()->GetTexture(client_texture_id);
- if (texture) {
- *service_texture_id = texture->service_id();
+ TextureRef* texture_ref = texture_manager()->GetTexture(client_texture_id);
+ if (texture_ref) {
+ *service_texture_id = texture_ref->service_id();
return true;
}
return false;
@@ -3260,7 +3262,7 @@ bool GLES2DecoderImpl::SetParent(GLES2Decoder* new_parent,
offscreen_saved_color_texture_info_ =
new_parent_impl->CreateTexture(new_parent_texture_id, service_id);
- offscreen_saved_color_texture_info_->SetNotOwned();
+ offscreen_saved_color_texture_info_->texture()->SetNotOwned();
new_parent_impl->texture_manager()->
SetTarget(offscreen_saved_color_texture_info_, GL_TEXTURE_2D);
@@ -3699,7 +3701,7 @@ void GLES2DecoderImpl::RestoreFramebufferBindings() const {
void GLES2DecoderImpl::RestoreTextureState(unsigned service_id) const {
GLuint client_id = 0;
if (texture_manager()->GetClientId(service_id, &client_id)) {
- Texture* texture = GetTexture(client_id);
+ Texture* texture = GetTexture(client_id)->texture();
GLenum target = texture->target();
glBindTexture(target, service_id);
glTexParameteri(
@@ -3812,11 +3814,11 @@ void GLES2DecoderImpl::DoBindRenderbuffer(GLenum target, GLuint client_id) {
}
void GLES2DecoderImpl::DoBindTexture(GLenum target, GLuint client_id) {
- Texture* texture = NULL;
+ TextureRef* texture_ref = NULL;
GLuint service_id = 0;
if (client_id != 0) {
- texture = GetTexture(client_id);
- if (!texture) {
+ texture_ref = GetTexture(client_id);
+ if (!texture_ref) {
if (!group_->bind_generates_resource()) {
LOG(ERROR) << "glBindTexture: id not generated by glGenTextures";
current_decoder_error_ = error::kGenericError;
@@ -3827,14 +3829,15 @@ void GLES2DecoderImpl::DoBindTexture(GLenum target, GLuint client_id) {
glGenTextures(1, &service_id);
DCHECK_NE(0u, service_id);
CreateTexture(client_id, service_id);
- texture = GetTexture(client_id);
+ texture_ref = GetTexture(client_id);
IdAllocatorInterface* id_allocator =
group_->GetIdAllocator(id_namespaces::kTextures);
id_allocator->MarkAsUsed(client_id);
}
} else {
- texture = texture_manager()->GetDefaultTextureInfo(target);
+ texture_ref = texture_manager()->GetDefaultTextureInfo(target);
}
+ Texture* texture = texture_ref->texture();
// Check the texture exists
// Check that we are not trying to bind it to a different target.
@@ -3852,7 +3855,7 @@ void GLES2DecoderImpl::DoBindTexture(GLenum target, GLuint client_id) {
}
LogClientServiceForInfo(texture, client_id, "glBindTexture");
if (texture->target() == 0) {
- texture_manager()->SetTarget(texture, target);
+ texture_manager()->SetTarget(texture_ref, target);
}
glBindTexture(target, texture->service_id());
@@ -3860,13 +3863,13 @@ void GLES2DecoderImpl::DoBindTexture(GLenum target, GLuint client_id) {
unit.bind_target = target;
switch (target) {
case GL_TEXTURE_2D:
- unit.bound_texture_2d = texture;
+ unit.bound_texture_2d = texture_ref;
break;
case GL_TEXTURE_CUBE_MAP:
- unit.bound_texture_cube_map = texture;
+ unit.bound_texture_cube_map = texture_ref;
break;
case GL_TEXTURE_EXTERNAL_OES:
- unit.bound_texture_external_oes = texture;
+ unit.bound_texture_external_oes = texture_ref;
if (texture->IsStreamTexture()) {
DCHECK(stream_texture_manager_);
StreamTexture* stream_tex =
@@ -3876,7 +3879,7 @@ void GLES2DecoderImpl::DoBindTexture(GLenum target, GLuint client_id) {
}
break;
case GL_TEXTURE_RECTANGLE_ARB:
- unit.bound_texture_rectangle_arb = texture;
+ unit.bound_texture_rectangle_arb = texture_ref;
break;
default:
NOTREACHED(); // Validation should prevent us getting here.
@@ -3953,9 +3956,9 @@ void GLES2DecoderImpl::DoEnableVertexAttribArray(GLuint index) {
}
void GLES2DecoderImpl::DoGenerateMipmap(GLenum target) {
- Texture* texture = GetTextureInfoForTarget(target);
- if (!texture ||
- !texture_manager()->CanGenerateMipmaps(texture)) {
+ TextureRef* texture_ref = GetTextureInfoForTarget(target);
+ if (!texture_ref ||
+ !texture_manager()->CanGenerateMipmaps(texture_ref)) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION, "glGenerateMipmap", "Can not generate mips");
return;
@@ -3964,14 +3967,14 @@ void GLES2DecoderImpl::DoGenerateMipmap(GLenum target) {
if (target == GL_TEXTURE_CUBE_MAP) {
for (int i = 0; i < 6; ++i) {
GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X + i;
- if (!texture_manager()->ClearTextureLevel(this, texture, face, 0)) {
+ if (!texture_manager()->ClearTextureLevel(this, texture_ref, face, 0)) {
LOCAL_SET_GL_ERROR(
GL_OUT_OF_MEMORY, "glGenerateMipmap", "dimensions too big");
return;
}
}
} else {
- if (!texture_manager()->ClearTextureLevel(this, texture, target, 0)) {
+ if (!texture_manager()->ClearTextureLevel(this, texture_ref, target, 0)) {
LOCAL_SET_GL_ERROR(
GL_OUT_OF_MEMORY, "glGenerateMipmap", "dimensions too big");
return;
@@ -3990,11 +3993,12 @@ void GLES2DecoderImpl::DoGenerateMipmap(GLenum target) {
}
glGenerateMipmapEXT(target);
if (workarounds().set_texture_filter_before_generating_mipmap) {
- glTexParameteri(target, GL_TEXTURE_MIN_FILTER, texture->min_filter());
+ glTexParameteri(target, GL_TEXTURE_MIN_FILTER,
+ texture_ref->texture()->min_filter());
}
GLenum error = LOCAL_PEEK_GL_ERROR("glGenerateMipmap");
if (error == GL_NO_ERROR) {
- texture_manager()->MarkMipmapsGenerated(texture);
+ texture_manager()->MarkMipmapsGenerated(texture_ref);
}
}
@@ -4883,16 +4887,16 @@ void GLES2DecoderImpl::DoFramebufferTexture2D(
return;
}
GLuint service_id = 0;
- Texture* texture = NULL;
+ TextureRef* texture_ref = NULL;
if (client_texture_id) {
- texture = GetTexture(client_texture_id);
- if (!texture) {
+ texture_ref = GetTexture(client_texture_id);
+ if (!texture_ref) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
- "glFramebufferTexture2D", "unknown texture");
+ "glFramebufferTexture2D", "unknown texture_ref");
return;
}
- service_id = texture->service_id();
+ service_id = texture_ref->service_id();
}
if (!texture_manager()->ValidForTarget(textarget, level, 0, 0, 1)) {
@@ -4906,7 +4910,7 @@ void GLES2DecoderImpl::DoFramebufferTexture2D(
glFramebufferTexture2DEXT(target, attachment, textarget, service_id, level);
GLenum error = LOCAL_PEEK_GL_ERROR("glFramebufferTexture2D");
if (error == GL_NO_ERROR) {
- framebuffer->AttachTexture(attachment, texture, textarget, level);
+ framebuffer->AttachTexture(attachment, texture_ref, textarget, level);
}
if (framebuffer == state_.bound_draw_framebuffer) {
clear_state_dirty_ = true;
@@ -5147,7 +5151,7 @@ void GLES2DecoderImpl::DoLinkProgram(GLuint program_id) {
void GLES2DecoderImpl::DoTexParameterf(
GLenum target, GLenum pname, GLfloat param) {
- Texture* texture = GetTextureInfoForTarget(target);
+ TextureRef* texture = GetTextureInfoForTarget(target);
if (!texture) {
LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameterf", "unknown texture");
return;
@@ -5160,7 +5164,7 @@ void GLES2DecoderImpl::DoTexParameterf(
void GLES2DecoderImpl::DoTexParameteri(
GLenum target, GLenum pname, GLint param) {
- Texture* texture = GetTextureInfoForTarget(target);
+ TextureRef* texture = GetTextureInfoForTarget(target);
if (!texture) {
LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameteri", "unknown texture");
return;
@@ -5172,7 +5176,7 @@ void GLES2DecoderImpl::DoTexParameteri(
void GLES2DecoderImpl::DoTexParameterfv(
GLenum target, GLenum pname, const GLfloat* params) {
- Texture* texture = GetTextureInfoForTarget(target);
+ TextureRef* texture = GetTextureInfoForTarget(target);
if (!texture) {
LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameterfv", "unknown texture");
return;
@@ -5185,7 +5189,7 @@ void GLES2DecoderImpl::DoTexParameterfv(
void GLES2DecoderImpl::DoTexParameteriv(
GLenum target, GLenum pname, const GLint* params) {
- Texture* texture = GetTextureInfoForTarget(target);
+ TextureRef* texture = GetTextureInfoForTarget(target);
if (!texture) {
LOCAL_SET_GL_ERROR(
GL_INVALID_VALUE, "glTexParameteriv", "unknown texture");
@@ -5650,7 +5654,7 @@ bool GLES2DecoderImpl::SetBlackTextureForNonRenderableTextures() {
GLuint texture_unit_index = uniform_info->texture_units[jj];
if (texture_unit_index < state_.texture_units.size()) {
TextureUnit& texture_unit = state_.texture_units[texture_unit_index];
- Texture* texture =
+ TextureRef* texture =
texture_unit.GetInfoForSamplerType(uniform_info->type);
if (!texture || !texture_manager()->CanRender(texture)) {
textures_set = true;
@@ -5684,17 +5688,17 @@ void GLES2DecoderImpl::RestoreStateForNonRenderableTextures() {
GLuint texture_unit_index = uniform_info->texture_units[jj];
if (texture_unit_index < state_.texture_units.size()) {
TextureUnit& texture_unit = state_.texture_units[texture_unit_index];
- Texture* texture = uniform_info->type == GL_SAMPLER_2D ?
+ TextureRef* texture_ref = uniform_info->type == GL_SAMPLER_2D ?
texture_unit.bound_texture_2d :
texture_unit.bound_texture_cube_map;
- if (!texture || !texture_manager()->CanRender(texture)) {
+ if (!texture_ref || !texture_manager()->CanRender(texture_ref)) {
glActiveTexture(GL_TEXTURE0 + texture_unit_index);
- // Get the texture info that was previously bound here.
- texture = texture_unit.bind_target == GL_TEXTURE_2D ?
+ // Get the texture_ref info that was previously bound here.
+ texture_ref = texture_unit.bind_target == GL_TEXTURE_2D ?
texture_unit.bound_texture_2d :
texture_unit.bound_texture_cube_map;
glBindTexture(texture_unit.bind_target,
- texture ? texture->service_id() : 0);
+ texture_ref ? texture_ref->service_id() : 0);
}
}
}
@@ -5721,10 +5725,10 @@ bool GLES2DecoderImpl::ClearUnclearedTextures() {
GLuint texture_unit_index = uniform_info->texture_units[jj];
if (texture_unit_index < state_.texture_units.size()) {
TextureUnit& texture_unit = state_.texture_units[texture_unit_index];
- Texture* texture =
+ TextureRef* texture_ref =
texture_unit.GetInfoForSamplerType(uniform_info->type);
- if (texture && !texture->SafeToRenderFrom()) {
- if (!texture_manager()->ClearRenderableLevels(this, texture)) {
+ if (texture_ref && !texture_ref->texture()->SafeToRenderFrom()) {
+ if (!texture_manager()->ClearRenderableLevels(this, texture_ref)) {
return false;
}
}
@@ -6420,8 +6424,8 @@ bool GLES2DecoderImpl::DoIsShader(GLuint client_id) {
}
bool GLES2DecoderImpl::DoIsTexture(GLuint client_id) {
- const Texture* texture = GetTexture(client_id);
- return texture && texture->IsValid() && !texture->IsDeleted();
+ const TextureRef* texture_ref = GetTexture(client_id);
+ return texture_ref && texture_ref->texture()->IsValid();
}
void GLES2DecoderImpl::DoAttachShader(
@@ -7338,7 +7342,7 @@ bool GLES2DecoderImpl::ClearLevel(
}
y += tile_height;
}
- Texture* texture = GetTextureInfoForTarget(bind_target);
+ TextureRef* texture = GetTextureInfoForTarget(bind_target);
glBindTexture(bind_target, texture ? texture->service_id() : 0);
return true;
}
@@ -7513,13 +7517,14 @@ error::Error GLES2DecoderImpl::DoCompressedTexImage2D(
"glCompressedTexImage2D", "dimensions out of range");
return error::kNoError;
}
- Texture* texture = GetTextureInfoForTarget(target);
- if (!texture) {
+ TextureRef* texture_ref = GetTextureInfoForTarget(target);
+ if (!texture_ref) {
LOCAL_SET_GL_ERROR(
GL_INVALID_VALUE,
"glCompressedTexImage2D", "unknown texture target");
return error::kNoError;
}
+ Texture* texture = texture_ref->texture();
if (texture->IsImmutable()) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
@@ -7542,9 +7547,6 @@ error::Error GLES2DecoderImpl::DoCompressedTexImage2D(
if (texture->IsAttachedToFramebuffer()) {
clear_state_dirty_ = true;
- // TODO(gman): If textures tracked which framebuffers they were attached to
- // we could just mark those framebuffers as not complete.
- framebuffer_manager()->IncFramebufferStateChangeCount();
}
scoped_ptr<int8[]> zero;
@@ -7559,8 +7561,8 @@ error::Error GLES2DecoderImpl::DoCompressedTexImage2D(
GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage2D");
if (error == GL_NO_ERROR) {
texture_manager()->SetLevelInfo(
- texture, target, level, internal_format, width, height, 1, border, 0, 0,
- true);
+ texture_ref, target, level, internal_format,
+ width, height, 1, border, 0, 0, true);
}
return error::kNoError;
}
@@ -7753,13 +7755,13 @@ bool GLES2DecoderImpl::ValidateTexImage2D(
function_name, "can not supply data for depth or stencil textures");
return false;
}
- Texture* texture = GetTextureInfoForTarget(target);
- if (!texture) {
+ TextureRef* texture_ref = GetTextureInfoForTarget(target);
+ if (!texture_ref) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION, function_name, "unknown texture for target");
return false;
}
- if (texture->IsImmutable()) {
+ if (texture_ref->texture()->IsImmutable()) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION, function_name, "texture is immutable");
return false;
@@ -7788,7 +7790,8 @@ void GLES2DecoderImpl::DoTexImage2D(
return;
}
- Texture* texture = GetTextureInfoForTarget(target);
+ TextureRef* texture_ref = GetTextureInfoForTarget(target);
+ Texture* texture = texture_ref->texture();
GLsizei tex_width = 0;
GLsizei tex_height = 0;
GLenum tex_type = 0;
@@ -7802,7 +7805,7 @@ void GLES2DecoderImpl::DoTexImage2D(
if (level_is_same && !pixels) {
// Just set the level texture but mark the texture as uncleared.
texture_manager()->SetLevelInfo(
- texture,
+ texture_ref,
target, level, internal_format, width, height, 1, border, format, type,
false);
tex_image_2d_failed_ = false;
@@ -7811,14 +7814,11 @@ void GLES2DecoderImpl::DoTexImage2D(
if (texture->IsAttachedToFramebuffer()) {
clear_state_dirty_ = true;
- // TODO(gman): If textures tracked which framebuffers they were attached to
- // we could just mark those framebuffers as not complete.
- framebuffer_manager()->IncFramebufferStateChangeCount();
}
if (!teximage2d_faster_than_texsubimage2d_ && level_is_same && pixels) {
glTexSubImage2D(target, level, 0, 0, width, height, format, type, pixels);
- texture_manager()->SetLevelCleared(texture, target, level, true);
+ texture_manager()->SetLevelCleared(texture_ref, target, level, true);
tex_image_2d_failed_ = false;
return;
}
@@ -7830,7 +7830,7 @@ void GLES2DecoderImpl::DoTexImage2D(
GLenum error = LOCAL_PEEK_GL_ERROR("glTexImage2D");
if (error == GL_NO_ERROR) {
texture_manager()->SetLevelInfo(
- texture,
+ texture_ref,
target, level, internal_format, width, height, 1, border, format, type,
pixels != NULL);
tex_image_2d_failed_ = false;
@@ -7910,13 +7910,14 @@ void GLES2DecoderImpl::DoCompressedTexSubImage2D(
GLenum format,
GLsizei image_size,
const void * data) {
- Texture* texture = GetTextureInfoForTarget(target);
- if (!texture) {
+ TextureRef* texture_ref = GetTextureInfoForTarget(target);
+ if (!texture_ref) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glCompressedTexSubImage2D", "unknown texture for target");
return;
}
+ Texture* texture = texture_ref->texture();
GLenum type = 0;
GLenum internal_format = 0;
if (!texture->GetLevelType(target, level, &type, &internal_format)) {
@@ -7982,13 +7983,14 @@ void GLES2DecoderImpl::DoCopyTexImage2D(
GLsizei height,
GLint border) {
DCHECK(!ShouldDeferReads());
- Texture* texture = GetTextureInfoForTarget(target);
- if (!texture) {
+ TextureRef* texture_ref = GetTextureInfoForTarget(target);
+ if (!texture_ref) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glCopyTexImage2D", "unknown texture for target");
return;
}
+ Texture* texture = texture_ref->texture();
if (texture->IsImmutable()) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION, "glCopyTexImage2D", "texture is immutable");
@@ -8046,9 +8048,6 @@ void GLES2DecoderImpl::DoCopyTexImage2D(
if (texture->IsAttachedToFramebuffer()) {
clear_state_dirty_ = true;
- // TODO(gman): If textures tracked which framebuffers they were attached to
- // we could just mark those framebuffers as not complete.
- framebuffer_manager()->IncFramebufferStateChangeCount();
}
// Clip to size to source dimensions
@@ -8088,7 +8087,7 @@ void GLES2DecoderImpl::DoCopyTexImage2D(
GLenum error = LOCAL_PEEK_GL_ERROR("glCopyTexImage2D");
if (error == GL_NO_ERROR) {
texture_manager()->SetLevelInfo(
- texture, target, level, internal_format, width, height, 1,
+ texture_ref, target, level, internal_format, width, height, 1,
border, internal_format, GL_UNSIGNED_BYTE, true);
}
}
@@ -8103,13 +8102,14 @@ void GLES2DecoderImpl::DoCopyTexSubImage2D(
GLsizei width,
GLsizei height) {
DCHECK(!ShouldDeferReads());
- Texture* texture = GetTextureInfoForTarget(target);
- if (!texture) {
+ TextureRef* texture_ref = GetTextureInfoForTarget(target);
+ if (!texture_ref) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glCopyTexSubImage2D", "unknown texture for target");
return;
}
+ Texture* texture = texture_ref->texture();
GLenum type = 0;
GLenum format = 0;
if (!texture->GetLevelType(target, level, &type, &format) ||
@@ -8158,7 +8158,7 @@ void GLES2DecoderImpl::DoCopyTexSubImage2D(
Clip(x, width, size.width(), &copyX, &copyWidth);
Clip(y, height, size.height(), &copyY, &copyHeight);
- if (!texture_manager()->ClearTextureLevel(this, texture, target, level)) {
+ if (!texture_manager()->ClearTextureLevel(this, texture_ref, target, level)) {
LOCAL_SET_GL_ERROR(
GL_OUT_OF_MEMORY, "glCopyTexSubImage2D", "dimensions too big");
return;
@@ -8228,13 +8228,14 @@ bool GLES2DecoderImpl::ValidateTexSubImage2D(
LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, type, "type");
return false;
}
- Texture* texture = GetTextureInfoForTarget(target);
- if (!texture) {
+ TextureRef* texture_ref = GetTextureInfoForTarget(target);
+ if (!texture_ref) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
function_name, "unknown texture for target");
return false;
}
+ Texture* texture = texture_ref->texture();
GLenum current_type = 0;
GLenum internal_format = 0;
if (!texture->GetLevelType(target, level, &current_type, &internal_format)) {
@@ -8294,14 +8295,16 @@ error::Error GLES2DecoderImpl::DoTexSubImage2D(
xoffset, yoffset, width, height, format, type, data)) {
return error;
}
- Texture* texture = GetTextureInfoForTarget(target);
+ TextureRef* texture_ref = GetTextureInfoForTarget(target);
+ Texture* texture = texture_ref->texture();
GLsizei tex_width = 0;
GLsizei tex_height = 0;
bool ok = texture->GetLevelSize(target, level, &tex_width, &tex_height);
DCHECK(ok);
if (xoffset != 0 || yoffset != 0 ||
width != tex_width || height != tex_height) {
- if (!texture_manager()->ClearTextureLevel(this, texture, target, level)) {
+ if (!texture_manager()->ClearTextureLevel(this, texture_ref,
+ target, level)) {
LOCAL_SET_GL_ERROR(
GL_OUT_OF_MEMORY, "glTexSubImage2D", "dimensions too big");
return error::kNoError;
@@ -8323,7 +8326,7 @@ error::Error GLES2DecoderImpl::DoTexSubImage2D(
glTexSubImage2D(
target, level, xoffset, yoffset, width, height, format, type, data);
}
- texture_manager()->SetLevelCleared(texture, target, level, true);
+ texture_manager()->SetLevelCleared(texture_ref, target, level, true);
return error::kNoError;
}
@@ -8782,7 +8785,7 @@ void GLES2DecoderImpl::DoSwapBuffers() {
} else {
// Flip the textures in the parent context via the texture manager.
if (!!offscreen_saved_color_texture_info_.get())
- offscreen_saved_color_texture_info_->
+ offscreen_saved_color_texture_info_->texture()->
SetServiceId(offscreen_target_color_texture_->id());
offscreen_saved_color_texture_.swap(offscreen_target_color_texture_);
@@ -9339,14 +9342,15 @@ error::Error GLES2DecoderImpl::HandleCreateStreamTextureCHROMIUM(
if (!result)
return error::kOutOfBounds;
*result = GL_ZERO;
- Texture* texture = texture_manager()->GetTexture(client_id);
- if (!texture) {
+ TextureRef* texture_ref = texture_manager()->GetTexture(client_id);
+ if (!texture_ref) {
LOCAL_SET_GL_ERROR(
GL_INVALID_VALUE,
"glCreateStreamTextureCHROMIUM", "bad texture id.");
return error::kNoError;
}
+ Texture* texture = texture_ref->texture();
if (texture->IsStreamTexture()) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
@@ -9369,7 +9373,7 @@ error::Error GLES2DecoderImpl::HandleCreateStreamTextureCHROMIUM(
texture->service_id(), client_id);
if (object_id) {
- texture_manager()->SetStreamTexture(texture, true);
+ texture_manager()->SetStreamTexture(texture_ref, true);
} else {
LOCAL_SET_GL_ERROR(
GL_OUT_OF_MEMORY,
@@ -9384,13 +9388,13 @@ error::Error GLES2DecoderImpl::HandleDestroyStreamTextureCHROMIUM(
uint32 immediate_data_size,
const cmds::DestroyStreamTextureCHROMIUM& c) {
GLuint client_id = c.texture;
- Texture* texture = texture_manager()->GetTexture(client_id);
- if (texture && texture->IsStreamTexture()) {
+ TextureRef* texture_ref = texture_manager()->GetTexture(client_id);
+ if (texture_ref && texture_ref->texture()->IsStreamTexture()) {
if (!stream_texture_manager_)
return error::kInvalidArguments;
- stream_texture_manager_->DestroyStreamTexture(texture->service_id());
- texture_manager()->SetStreamTexture(texture, false);
+ stream_texture_manager_->DestroyStreamTexture(texture_ref->service_id());
+ texture_manager()->SetStreamTexture(texture_ref, false);
} else {
LOCAL_SET_GL_ERROR(
GL_INVALID_VALUE,
@@ -9446,8 +9450,8 @@ void GLES2DecoderImpl::DoTexImageIOSurface2DCHROMIUM(
// Default target might be conceptually valid, but disallow it to avoid
// accidents.
- Texture* texture = GetTextureInfoForTargetUnlessDefault(target);
- if (!texture) {
+ TextureRef* texture_ref = GetTextureInfoForTargetUnlessDefault(target);
+ if (!texture_ref) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glTexImageIOSurface2DCHROMIUM", "no rectangle texture bound");
@@ -9468,11 +9472,11 @@ void GLES2DecoderImpl::DoTexImageIOSurface2DCHROMIUM(
}
// Release any IOSurface previously bound to this texture.
- ReleaseIOSurfaceForTexture(texture->service_id());
+ ReleaseIOSurfaceForTexture(texture_ref->service_id());
// Make sure we release the IOSurface even if CGLTexImageIOSurface2D fails.
texture_to_io_surface_map_.insert(
- std::make_pair(texture->service_id(), surface));
+ std::make_pair(texture_ref->service_id(), surface));
CGLContextObj context =
static_cast<CGLContextObj>(context_->GetHandle());
@@ -9496,7 +9500,7 @@ void GLES2DecoderImpl::DoTexImageIOSurface2DCHROMIUM(
}
texture_manager()->SetLevelInfo(
- texture, target, 0, GL_RGBA, width, height, 1, 0,
+ texture_ref, target, 0, GL_RGBA, width, height, 1, 0,
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, true);
#else
@@ -9553,10 +9557,10 @@ static GLenum ExtractFormatFromStorageFormat(GLenum internalformat) {
void GLES2DecoderImpl::DoCopyTextureCHROMIUM(
GLenum target, GLuint source_id, GLuint dest_id, GLint level,
GLenum internal_format, GLenum dest_type) {
- Texture* dest_texture = GetTexture(dest_id);
- Texture* source_texture = GetTexture(source_id);
+ TextureRef* dest_texture_ref = GetTexture(dest_id);
+ TextureRef* source_texture_ref = GetTexture(source_id);
- if (!source_texture || !dest_texture) {
+ if (!source_texture_ref || !dest_texture_ref) {
LOCAL_SET_GL_ERROR(
GL_INVALID_VALUE, "glCopyTextureCHROMIUM", "unknown texture id");
return;
@@ -9568,6 +9572,8 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM(
return;
}
+ Texture* source_texture = source_texture_ref->texture();
+ Texture* dest_texture = dest_texture_ref->texture();
if (dest_texture->target() != GL_TEXTURE_2D ||
(source_texture->target() != GL_TEXTURE_2D &&
source_texture->target() != GL_TEXTURE_EXTERNAL_OES)) {
@@ -9659,11 +9665,11 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM(
}
texture_manager()->SetLevelInfo(
- dest_texture, GL_TEXTURE_2D, level, internal_format, source_width,
+ dest_texture_ref, GL_TEXTURE_2D, level, internal_format, source_width,
source_height, 1, 0, internal_format, dest_type, true);
} else {
texture_manager()->SetLevelCleared(
- dest_texture, GL_TEXTURE_2D, level, true);
+ dest_texture_ref, GL_TEXTURE_2D, level, true);
}
// GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix
@@ -9758,13 +9764,14 @@ void GLES2DecoderImpl::DoTexStorage2DEXT(
GL_INVALID_VALUE, "glTexStorage2DEXT", "dimensions out of range");
return;
}
- Texture* texture = GetTextureInfoForTarget(target);
- if (!texture) {
+ TextureRef* texture_ref = GetTextureInfoForTarget(target);
+ if (!texture_ref) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glTexStorage2DEXT", "unknown texture for target");
return;
}
+ Texture* texture = texture_ref->texture();
if (texture->IsAttachedToFramebuffer()) {
clear_state_dirty_ = true;
}
@@ -9810,8 +9817,8 @@ void GLES2DecoderImpl::DoTexStorage2DEXT(
GLsizei level_height = height;
for (int ii = 0; ii < levels; ++ii) {
texture_manager()->SetLevelInfo(
- texture, target, ii, format, level_width, level_height, 1, 0, format,
- type, false);
+ texture_ref, target, ii, format,
+ level_width, level_height, 1, 0, format, type, false);
level_width = std::max(1, level_width >> 1);
level_height = std::max(1, level_height >> 1);
}
@@ -9838,15 +9845,15 @@ void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target,
"context", logger_.GetLogPrefix(),
"mailbox[0]", static_cast<unsigned char>(mailbox[0]));
- Texture* texture = GetTextureInfoForTarget(target);
- if (!texture) {
+ TextureRef* texture_ref = GetTextureInfoForTarget(target);
+ if (!texture_ref) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glProduceTextureCHROMIUM", "unknown texture for target");
return;
}
- TextureDefinition* definition = texture_manager()->Save(texture);
+ TextureDefinition* definition = texture_manager()->Save(texture_ref);
if (!definition) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
@@ -9860,7 +9867,7 @@ void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target,
definition,
texture_manager())) {
bool success = texture_manager()->Restore(
- "glProductTextureCHROMIUM", this, texture, definition);
+ "glProductTextureCHROMIUM", this, texture_ref, definition);
DCHECK(success);
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
@@ -9868,7 +9875,7 @@ void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target,
return;
}
- glBindTexture(texture->target(), texture->service_id());
+ glBindTexture(texture_ref->texture()->target(), texture_ref->service_id());
}
void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target,
@@ -9877,8 +9884,8 @@ void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target,
"context", logger_.GetLogPrefix(),
"mailbox[0]", static_cast<unsigned char>(mailbox[0]));
- Texture* texture = GetTextureInfoForTarget(target);
- if (!texture) {
+ TextureRef* texture_ref = GetTextureInfoForTarget(target);
+ if (!texture_ref) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glConsumeTextureCHROMIUM", "unknown texture for target");
@@ -9897,7 +9904,7 @@ void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target,
}
if (!texture_manager()->Restore(
- "glConsumeTextureCHROMIUM", this, texture, definition.release())) {
+ "glConsumeTextureCHROMIUM", this, texture_ref, definition.release())) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glConsumeTextureCHROMIUM", "invalid texture");
@@ -9940,8 +9947,8 @@ void GLES2DecoderImpl::DoBindTexImage2DCHROMIUM(
// Default target might be conceptually valid, but disallow it to avoid
// accidents.
- Texture* texture = GetTextureInfoForTargetUnlessDefault(target);
- if (!texture) {
+ TextureRef* texture_ref = GetTextureInfoForTargetUnlessDefault(target);
+ if (!texture_ref) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glBindTexImage2DCHROMIUM", "no texture bound");
@@ -9969,9 +9976,9 @@ void GLES2DecoderImpl::DoBindTexImage2DCHROMIUM(
gfx::Size size = gl_image->GetSize();
texture_manager()->SetLevelInfo(
- texture, target, 0, GL_RGBA, size.width(), size.height(), 1, 0,
+ texture_ref, target, 0, GL_RGBA, size.width(), size.height(), 1, 0,
GL_RGBA, GL_UNSIGNED_BYTE, true);
- texture_manager()->SetLevelImage(texture, target, 0, gl_image);
+ texture_manager()->SetLevelImage(texture_ref, target, 0, gl_image);
}
void GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM(
@@ -9987,8 +9994,8 @@ void GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM(
// Default target might be conceptually valid, but disallow it to avoid
// accidents.
- Texture* texture = GetTextureInfoForTargetUnlessDefault(target);
- if (!texture) {
+ TextureRef* texture_ref = GetTextureInfoForTargetUnlessDefault(target);
+ if (!texture_ref) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glReleaseTexImage2DCHROMIUM", "no texture bound");
@@ -10004,7 +10011,7 @@ void GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM(
}
// Do nothing when image is not currently bound.
- if (texture->GetLevelImage(target, 0) != gl_image)
+ if (texture_ref->texture()->GetLevelImage(target, 0) != gl_image)
return;
{
@@ -10014,7 +10021,7 @@ void GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM(
}
texture_manager()->SetLevelInfo(
- texture, target, 0, GL_RGBA, 0, 0, 1, 0,
+ texture_ref, target, 0, GL_RGBA, 0, 0, 1, 0,
GL_RGBA, GL_UNSIGNED_BYTE, false);
}
@@ -10161,7 +10168,8 @@ error::Error GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM(
}
// Extra async validation.
- Texture* texture = GetTextureInfoForTarget(target);
+ TextureRef* texture_ref = GetTextureInfoForTarget(target);
+ Texture* texture = texture_ref->texture();
if (!ValidateAsyncTransfer(
"glAsyncTexImage2DCHROMIUM", texture, target, level, pixels))
return error::kNoError;
@@ -10174,15 +10182,6 @@ error::Error GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM(
return error::kNoError;
}
- // Since we don't allow async redefinition, this is the only
- // time the size of this texture can change while bound
- // as a frame-buffer.
- if (texture->IsAttachedToFramebuffer()) {
- // TODO(gman): If textures tracked which framebuffers they were attached to
- // we could just mark those framebuffers as not complete.
- framebuffer_manager()->IncFramebufferStateChangeCount();
- }
-
if (!EnsureGPUMemoryAvailable(pixels_size)) {
LOCAL_SET_GL_ERROR(
GL_OUT_OF_MEMORY, "glAsyncTexImage2DCHROMIUM", "out of memory");
@@ -10208,7 +10207,7 @@ error::Error GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM(
// immutable so the async state stays valid. The level info
// is set up lazily when the transfer completes.
DCHECK(!texture->GetAsyncTransferState());
- texture->SetAsyncTransferState(
+ texture_ref->SetAsyncTransferState(
make_scoped_ptr(
async_pixel_transfer_delegate_->CreatePixelTransferState(
texture->service_id(),
@@ -10220,11 +10219,11 @@ error::Error GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM(
tex_params,
mem_params,
base::Bind(&TextureManager::SetLevelInfoFromParams,
- // The callback is only invoked if the transfer state
- // still exists, which implies through manager->info->state
+ // The callback is only invoked if the transfer delegate still
+ // exists, which implies through manager->texture_ref->state
// ownership that both of these pointers are valid.
base::Unretained(texture_manager()),
- base::Unretained(texture),
+ base::Unretained(texture_ref),
tex_params));
return error::kNoError;
}
@@ -10260,7 +10259,8 @@ error::Error GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM(
}
// Extra async validation.
- Texture* texture = GetTextureInfoForTarget(target);
+ TextureRef* texture_ref = GetTextureInfoForTarget(target);
+ Texture* texture = texture_ref->texture();
if (!ValidateAsyncTransfer(
"glAsyncTexSubImage2DCHROMIUM", texture, target, level, pixels))
return error::kNoError;
@@ -10272,7 +10272,8 @@ error::Error GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM(
// - Textures become immutable after an async call.
// This way we know in all cases that an async texture is always clear.
if (!texture->SafeToRenderFrom()) {
- if (!texture_manager()->ClearTextureLevel(this, texture, target, level)) {
+ if (!texture_manager()->ClearTextureLevel(this, texture_ref,
+ target, level)) {
LOCAL_SET_GL_ERROR(
GL_OUT_OF_MEMORY,
"glAsyncTexSubImage2DCHROMIUM", "dimensions too big");
@@ -10293,7 +10294,8 @@ error::Error GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM(
width, height, format, type};
AsyncMemoryParams mem_params = {shared_memory, shm_size,
shm_data_offset, shm_data_size};
- if (!texture->GetAsyncTransferState()) {
+ AsyncPixelTransferState* state = texture->GetAsyncTransferState();
+ if (!state) {
// TODO(epenner): We may want to enforce exclusive use
// of async APIs in which case this should become an error,
// (the texture should have been async defined).
@@ -10305,16 +10307,15 @@ error::Error GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM(
&define_params.internal_format);
// Set up the async state if needed, and make the texture
// immutable so the async state stays valid.
- texture->SetAsyncTransferState(
- make_scoped_ptr(
- async_pixel_transfer_delegate_->CreatePixelTransferState(
- texture->service_id(),
- define_params)));
+ state = async_pixel_transfer_delegate_->CreatePixelTransferState(
+ texture->service_id(),
+ define_params);
+ texture_ref->SetAsyncTransferState(make_scoped_ptr(state));
texture->SetImmutable(true);
}
async_pixel_transfer_delegate_->AsyncTexSubImage2D(
- texture->GetAsyncTransferState(), tex_params, mem_params);
+ state, tex_params, mem_params);
return error::kNoError;
}
@@ -10328,15 +10329,22 @@ error::Error GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM(
GL_INVALID_ENUM, "glWaitAsyncTexImage2DCHROMIUM", "target");
return error::kNoError;
}
- Texture* texture = GetTextureInfoForTarget(target);
- if (!texture) {
+ TextureRef* texture_ref = GetTextureInfoForTarget(target);
+ if (!texture_ref) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glWaitAsyncTexImage2DCHROMIUM", "unknown texture");
return error::kNoError;
}
- async_pixel_transfer_delegate_->WaitForTransferCompletion(
- texture->GetAsyncTransferState());
+ AsyncPixelTransferState* state =
+ texture_ref->texture()->GetAsyncTransferState();
+ if (!state) {
+ LOCAL_SET_GL_ERROR(
+ GL_INVALID_OPERATION,
+ "glWaitAsyncTexImage2DCHROMIUM", "No async transfer started");
+ return error::kNoError;
+ }
+ async_pixel_transfer_delegate_->WaitForTransferCompletion(state);
ProcessFinishedAsyncTransfers();
return error::kNoError;
}
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager_unittest.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698