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

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

Issue 2761153002: Ignore custom offscreen surface unless explicitly opted in (Closed)
Patch Set: Make "own offscreen surface" support explicit with its own attribute. Created 3 years, 9 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
« no previous file with comments | « gpu/ipc/common/gpu_command_buffer_traits_multi.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6d305cf9ab99b670e9d8c743e9ad21c6cbd1161d..e5e060d364cd7b31adfc473ae7a350aaed56abd6 100644
--- a/gpu/ipc/service/gpu_command_buffer_stub.cc
+++ b/gpu/ipc/service/gpu_command_buffer_stub.cc
@@ -655,20 +655,29 @@ bool GpuCommandBufferStub::Initialize(
decoder_->set_engine(executor_.get());
if (offscreen) {
- if (init_params.attribs.depth_size > 0) {
- surface_format.SetDepthBits(init_params.attribs.depth_size);
+ // Do we want to create an offscreen rendering context suitable
+ // for directly drawing to a separately supplied surface? In that
+ // case, we must ensure that the surface used for context creation
+ // is compatible with the requested attributes. This is explicitly
+ // opt-in since some context such as for NaCl request custom
+ // attributes but don't expect to get their own surface, and not
+ // all surface factories support custom formats.
+ if (init_params.attribs.own_offscreen_surface) {
+ if (init_params.attribs.depth_size > 0) {
+ surface_format.SetDepthBits(init_params.attribs.depth_size);
+ }
+ if (init_params.attribs.samples > 0) {
+ surface_format.SetSamples(init_params.attribs.samples);
+ }
+ if (init_params.attribs.stencil_size > 0) {
+ surface_format.SetStencilBits(init_params.attribs.stencil_size);
+ }
+ // Currently, we can't separately control alpha channel for surfaces,
+ // it's generally enabled by default except for RGB565 and (on desktop)
+ // smaller-than-32bit formats.
+ //
+ // TODO(klausw): use init_params.attribs.alpha_size here if possible.
}
- if (init_params.attribs.samples > 0) {
- surface_format.SetSamples(init_params.attribs.samples);
- }
- if (init_params.attribs.stencil_size > 0) {
- surface_format.SetStencilBits(init_params.attribs.stencil_size);
- }
- // Currently, we can't separately control alpha channel for surfaces,
- // it's generally enabled by default except for RGB565 and (on desktop)
- // smaller-than-32bit formats.
- //
- // TODO(klausw): use init_params.attribs.alpha_size here if possible.
if (!surface_format.IsCompatible(default_surface->GetFormat())) {
DVLOG(1) << __FUNCTION__ << ": Hit the OwnOffscreenSurface path";
use_virtualized_gl_context_ = false;
« no previous file with comments | « gpu/ipc/common/gpu_command_buffer_traits_multi.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698