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

Unified Diff: gpu/ipc/service/gpu_command_buffer_stub.cc

Issue 2461803002: Enable creation of offscreen contexts which own their backing surface. (Closed)
Patch Set: Drop unnecessary dependent patch Created 4 years, 1 month 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/ipc/service/gpu_command_buffer_stub.cc
diff --git a/gpu/ipc/service/gpu_command_buffer_stub.cc b/gpu/ipc/service/gpu_command_buffer_stub.cc
index b6396195afabdcb5ec8d6c46d8e5f253f00e02fe..48c2cc8a7b7d0e0674fad4cd1376cfae08043fea 100644
--- a/gpu/ipc/service/gpu_command_buffer_stub.cc
+++ b/gpu/ipc/service/gpu_command_buffer_stub.cc
@@ -566,7 +566,29 @@ bool GpuCommandBufferStub::Initialize(
decoder_->set_engine(executor_.get());
if (offscreen) {
- surface_ = default_surface;
+ if (init_params.attribs.own_offscreen_surface) {
+ use_virtualized_gl_context_ = false;
+ int depth = init_params.attribs.depth_size;
+ if (depth > 0) {
+ if (depth == 24 && surface_format == gl::GLSurface::SURFACE_ARGB8888) {
+ surface_format = gl::GLSurface::SURFACE_ARGB8888_DEPTH24;
+ } else if (depth == 24 &&
+ surface_format == gl::GLSurface::SURFACE_RGB565) {
+ surface_format = gl::GLSurface::SURFACE_RGB565_DEPTH24;
+ } else {
+ DLOG(ERROR) << "Failed to create surface, can't add depth_size="
+ << depth << " to base format " << surface_format;
piman 2016/11/16 00:44:02 Should we fail initialization here, then? I.e. ret
dcheng 2016/11/17 01:17:00 +1, this is coming from the renderer right? We nee
klausw 2017/01/05 02:17:43 Please see the new logic, I think it's much cleane
+ }
+ }
+ surface_ = gl::init::CreateUninitializedOffscreenGLSurface(gfx::Size());
+ if (!surface_ || !surface_->Initialize(surface_format)) {
+ surface_ = nullptr;
+ DLOG(ERROR) << "Failed to create surface.";
+ return false;
+ }
+ } else {
+ surface_ = default_surface;
+ }
} else {
surface_ = ImageTransportSurface::CreateNativeSurface(
AsWeakPtr(), surface_handle_, surface_format);

Powered by Google App Engine
This is Rietveld 408576698