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

Unified Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 2826043002: Do not share FBOs/VAOs/Transform feedback objects across contexts (Closed)
Patch Set: FBOs/VAOs should not be shared between contexts 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/client/gles2_implementation.cc
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 584353f07f26e4d8e0d8dfcf201880fb68cce162..51e571e74aeea1a32d435c443b677ffa3fa2ce8a 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -245,7 +245,9 @@ bool GLES2Implementation::Initialize(
query_tracker_.reset(new QueryTracker(mapped_memory_.get()));
buffer_tracker_.reset(new BufferTracker(mapped_memory_.get()));
- query_id_allocator_.reset(new IdAllocator());
+ for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i)
+ id_allocators_[i].reset(new IdAllocator());
Zhenyao Mo 2017/04/19 20:24:28 Some of these allocators are never used. Why?
Chandan 2017/04/20 10:56:07 As of now, 3 allocators are created, one each for
+
if (support_client_side_arrays_) {
GetIdHandler(id_namespaces::kBuffers)->MakeIds(
this, kClientSideArrayId, arraysize(reserved_ids_), &reserved_ids_[0]);
@@ -313,10 +315,7 @@ RangeIdHandlerInterface* GLES2Implementation::GetRangeIdHandler(
}
IdAllocator* GLES2Implementation::GetIdAllocator(int namespace_id) const {
- if (namespace_id == id_namespaces::kQueries)
- return query_id_allocator_.get();
- NOTREACHED();
- return NULL;
+ return id_allocators_[namespace_id].get();
}
void GLES2Implementation::OnGpuControlLostContext() {
@@ -4398,18 +4397,14 @@ void GLES2Implementation::BindFramebufferHelper(
}
if (changed) {
- GetIdHandler(id_namespaces::kFramebuffers)->MarkAsUsedForBind(
- this, target, framebuffer, &GLES2Implementation::BindFramebufferStub);
+ if (framebuffer != 0)
+ GetIdAllocator(id_namespaces::kFramebuffers)->MarkAsUsed(framebuffer);
+ helper_->BindFramebuffer(target, framebuffer);
+ if (share_group_->bind_generates_resource())
+ helper_->CommandBufferHelper::OrderingBarrier();
}
}
-void GLES2Implementation::BindFramebufferStub(GLenum target,
- GLuint framebuffer) {
- helper_->BindFramebuffer(target, framebuffer);
- if (share_group_->bind_generates_resource())
- helper_->CommandBufferHelper::OrderingBarrier();
-}
-
void GLES2Implementation::BindRenderbufferHelper(
GLenum target, GLuint renderbuffer) {
// TODO(gman): See note #1 above.
@@ -4573,14 +4568,10 @@ void GLES2Implementation::DeleteBuffersStub(
void GLES2Implementation::DeleteFramebuffersHelper(
GLsizei n, const GLuint* framebuffers) {
- if (!GetIdHandler(id_namespaces::kFramebuffers)->FreeIds(
- this, n, framebuffers, &GLES2Implementation::DeleteFramebuffersStub)) {
- SetGLError(
- GL_INVALID_VALUE,
- "glDeleteFramebuffers", "id not created by this context.");
- return;
- }
+ helper_->DeleteFramebuffersImmediate(n, framebuffers);
+ IdAllocator* id_allocator = GetIdAllocator(id_namespaces::kFramebuffers);
for (GLsizei ii = 0; ii < n; ++ii) {
+ id_allocator->FreeID(framebuffers[ii]);
if (framebuffers[ii] == bound_framebuffer_) {
bound_framebuffer_ = 0;
}
@@ -4590,11 +4581,6 @@ void GLES2Implementation::DeleteFramebuffersHelper(
}
}
-void GLES2Implementation::DeleteFramebuffersStub(
- GLsizei n, const GLuint* framebuffers) {
- helper_->DeleteFramebuffersImmediate(n, framebuffers);
-}
-
void GLES2Implementation::DeleteRenderbuffersHelper(
GLsizei n, const GLuint* renderbuffers) {
if (!GetIdHandler(id_namespaces::kRenderbuffers)->FreeIds(
@@ -4650,18 +4636,10 @@ void GLES2Implementation::DeleteTexturesStub(GLsizei n,
void GLES2Implementation::DeleteVertexArraysOESHelper(
GLsizei n, const GLuint* arrays) {
vertex_array_object_manager_->DeleteVertexArrays(n, arrays);
- if (!GetIdHandler(id_namespaces::kVertexArrays)->FreeIds(
- this, n, arrays, &GLES2Implementation::DeleteVertexArraysOESStub)) {
- SetGLError(
- GL_INVALID_VALUE,
- "glDeleteVertexArraysOES", "id not created by this context.");
- return;
- }
-}
-
-void GLES2Implementation::DeleteVertexArraysOESStub(
- GLsizei n, const GLuint* arrays) {
helper_->DeleteVertexArraysOESImmediate(n, arrays);
+ IdAllocator* id_allocator = GetIdAllocator(id_namespaces::kVertexArrays);
+ for (GLsizei ii = 0; ii < n; ++ii)
+ id_allocator->FreeID(arrays[ii]);
}
void GLES2Implementation::DeleteSamplersStub(
@@ -5566,9 +5544,10 @@ void GLES2Implementation::PostSubBufferCHROMIUM(
void GLES2Implementation::DeleteQueriesEXTHelper(
GLsizei n, const GLuint* queries) {
+ IdAllocator* id_allocator = GetIdAllocator(id_namespaces::kQueries);
for (GLsizei ii = 0; ii < n; ++ii) {
query_tracker_->RemoveQuery(queries[ii]);
- query_id_allocator_->FreeID(queries[ii]);
+ id_allocator->FreeID(queries[ii]);
}
helper_->DeleteQueriesEXTImmediate(n, queries);
@@ -5651,7 +5630,7 @@ void GLES2Implementation::BeginQueryEXT(GLenum target, GLuint id) {
return;
}
- if (!query_id_allocator_->InUse(id)) {
+ if (!GetIdAllocator(id_namespaces::kQueries)->InUse(id)) {
SetGLError(GL_INVALID_OPERATION, "glBeginQueryEXT", "invalid id");
return;
}
@@ -5708,7 +5687,7 @@ void GLES2Implementation::QueryCounterEXT(GLuint id, GLenum target) {
return;
}
- if (!query_id_allocator_->InUse(id)) {
+ if (!GetIdAllocator(id_namespaces::kQueries)->InUse(id)) {
SetGLError(GL_INVALID_OPERATION, "glQueryCounterEXT", "invalid id");
return;
}

Powered by Google App Engine
This is Rietveld 408576698