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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2818993002: GL Implementation for GPU Discardable
Patch Set: rebase Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "gpu/command_buffer/service/image_factory.h" 53 #include "gpu/command_buffer/service/image_factory.h"
54 #include "gpu/command_buffer/service/image_manager.h" 54 #include "gpu/command_buffer/service/image_manager.h"
55 #include "gpu/command_buffer/service/logger.h" 55 #include "gpu/command_buffer/service/logger.h"
56 #include "gpu/command_buffer/service/mailbox_manager.h" 56 #include "gpu/command_buffer/service/mailbox_manager.h"
57 #include "gpu/command_buffer/service/memory_tracking.h" 57 #include "gpu/command_buffer/service/memory_tracking.h"
58 #include "gpu/command_buffer/service/path_manager.h" 58 #include "gpu/command_buffer/service/path_manager.h"
59 #include "gpu/command_buffer/service/program_manager.h" 59 #include "gpu/command_buffer/service/program_manager.h"
60 #include "gpu/command_buffer/service/query_manager.h" 60 #include "gpu/command_buffer/service/query_manager.h"
61 #include "gpu/command_buffer/service/renderbuffer_manager.h" 61 #include "gpu/command_buffer/service/renderbuffer_manager.h"
62 #include "gpu/command_buffer/service/sampler_manager.h" 62 #include "gpu/command_buffer/service/sampler_manager.h"
63 #include "gpu/command_buffer/service/service_discardable_manager.h"
63 #include "gpu/command_buffer/service/shader_manager.h" 64 #include "gpu/command_buffer/service/shader_manager.h"
64 #include "gpu/command_buffer/service/shader_translator.h" 65 #include "gpu/command_buffer/service/shader_translator.h"
65 #include "gpu/command_buffer/service/texture_manager.h" 66 #include "gpu/command_buffer/service/texture_manager.h"
66 #include "gpu/command_buffer/service/transform_feedback_manager.h" 67 #include "gpu/command_buffer/service/transform_feedback_manager.h"
67 #include "gpu/command_buffer/service/vertex_array_manager.h" 68 #include "gpu/command_buffer/service/vertex_array_manager.h"
68 #include "gpu/command_buffer/service/vertex_attrib_manager.h" 69 #include "gpu/command_buffer/service/vertex_attrib_manager.h"
69 #include "third_party/angle/src/image_util/loadimage.h" 70 #include "third_party/angle/src/image_util/loadimage.h"
70 #include "third_party/smhasher/src/City.h" 71 #include "third_party/smhasher/src/City.h"
71 #include "ui/gfx/buffer_types.h" 72 #include "ui/gfx/buffer_types.h"
72 #include "ui/gfx/geometry/point.h" 73 #include "ui/gfx/geometry/point.h"
(...skipping 4131 matching lines...) Expand 10 before | Expand all | Expand 10 after
4204 if (framebuffer_state_.bound_draw_framebuffer.get()) { 4205 if (framebuffer_state_.bound_draw_framebuffer.get()) {
4205 framebuffer_state_.bound_draw_framebuffer 4206 framebuffer_state_.bound_draw_framebuffer
4206 ->UnbindTexture(GL_DRAW_FRAMEBUFFER_EXT, texture_ref); 4207 ->UnbindTexture(GL_DRAW_FRAMEBUFFER_EXT, texture_ref);
4207 } 4208 }
4208 } else { 4209 } else {
4209 if (framebuffer_state_.bound_draw_framebuffer.get()) { 4210 if (framebuffer_state_.bound_draw_framebuffer.get()) {
4210 framebuffer_state_.bound_draw_framebuffer 4211 framebuffer_state_.bound_draw_framebuffer
4211 ->UnbindTexture(GL_FRAMEBUFFER, texture_ref); 4212 ->UnbindTexture(GL_FRAMEBUFFER, texture_ref);
4212 } 4213 }
4213 } 4214 }
4215
4216 GetContextGroup()->discardable_manager()->OnTextureDeleted(client_id,
4217 group_.get());
4214 RemoveTexture(client_id); 4218 RemoveTexture(client_id);
4215 } 4219 }
4216 } 4220 }
4217 } 4221 }
4218 4222
4219 void GLES2DecoderImpl::DeleteSamplersHelper(GLsizei n, 4223 void GLES2DecoderImpl::DeleteSamplersHelper(GLsizei n,
4220 const volatile GLuint* client_ids) { 4224 const volatile GLuint* client_ids) {
4221 for (GLsizei ii = 0; ii < n; ++ii) { 4225 for (GLsizei ii = 0; ii < n; ++ii) {
4222 GLuint client_id = client_ids[ii]; 4226 GLuint client_id = client_ids[ii];
4223 Sampler* sampler = GetSampler(client_id); 4227 Sampler* sampler = GetSampler(client_id);
(...skipping 15345 matching lines...) Expand 10 before | Expand all | Expand 10 after
19569 glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture_ref->service_id()); 19573 glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture_ref->service_id());
19570 } 19574 }
19571 } 19575 }
19572 19576
19573 glActiveTexture(GL_TEXTURE0 + state_.active_texture_unit); 19577 glActiveTexture(GL_TEXTURE0 + state_.active_texture_unit);
19574 19578
19575 texture_manager_service_id_generation_ = 19579 texture_manager_service_id_generation_ =
19576 texture_manager()->GetServiceIdGeneration(); 19580 texture_manager()->GetServiceIdGeneration();
19577 } 19581 }
19578 19582
19583 error::Error GLES2DecoderImpl::HandleInitializeDiscardableTextureCHROMIUM(
19584 uint32_t immediate_data_size,
19585 const volatile void* cmd_data) {
19586 const volatile gles2::cmds::InitializeDiscardableTextureCHROMIUM& c =
19587 *static_cast<
19588 const volatile gles2::cmds::InitializeDiscardableTextureCHROMIUM*>(
19589 cmd_data);
19590 TextureRef* texture = texture_manager()->GetTexture(c.texture_id);
19591 if (!texture) {
19592 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE,
19593 "glInitializeDiscardableTextureCHROMIUM",
19594 "Invalid texture ID");
19595 return error::kNoError;
19596 }
19597 size_t size = texture->texture()->estimated_size();
19598 ServiceDiscardableHandle handle(GetSharedMemoryBuffer(c.shm_id), c.shm_offset,
19599 c.shm_id);
19600 GetContextGroup()->discardable_manager()->InsertLockedTexture(
19601 c.texture_id, size, group_.get(), std::move(handle));
19602 return error::kNoError;
19603 }
19604
19605 error::Error GLES2DecoderImpl::HandleUnlockDiscardableTextureCHROMIUM(
19606 uint32_t immediate_data_size,
19607 const volatile void* cmd_data) {
19608 const volatile gles2::cmds::UnlockDiscardableTextureCHROMIUM& c =
19609 *static_cast<
19610 const volatile gles2::cmds::UnlockDiscardableTextureCHROMIUM*>(
19611 cmd_data);
19612 if (!GetContextGroup()->discardable_manager()->UnlockTexture(c.texture_id,
19613 group_.get())) {
19614 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glUnlockDiscardableTextureCHROMIUM",
19615 "Texture ID not initialized");
19616 }
19617 return error::kNoError;
19618 }
19619
19579 // Include the auto-generated part of this file. We split this because it means 19620 // Include the auto-generated part of this file. We split this because it means
19580 // we can easily edit the non-auto generated parts right here in this file 19621 // we can easily edit the non-auto generated parts right here in this file
19581 // instead of having to edit some template or the code generator. 19622 // instead of having to edit some template or the code generator.
19582 #include "base/macros.h" 19623 #include "base/macros.h"
19583 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 19624 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
19584 19625
19585 } // namespace gles2 19626 } // namespace gles2
19586 } // namespace gpu 19627 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698