Commit 2e3b5c8c authored by hendrikw's avatar hendrikw Committed by Commit bot

gpu: Disallow zero sized offscreen framebuffers

Modify initial the offscreen size if empty
DCHECK to assert that we don't run into this situation again

BUG=481035

Review URL: https://codereview.chromium.org/1106773002

Cr-Commit-Position: refs/heads/master@{#327180}
parent 577e62cd
...@@ -201,6 +201,14 @@ GpuCommandBufferStub::GpuCommandBufferStub( ...@@ -201,6 +201,14 @@ GpuCommandBufferStub::GpuCommandBufferStub(
use_virtualized_gl_context_ |= use_virtualized_gl_context_ |=
context_group_->feature_info()->workarounds().use_virtualized_gl_contexts; context_group_->feature_info()->workarounds().use_virtualized_gl_contexts;
bool is_offscreen = surface_id_ == 0;
if (is_offscreen && initial_size_.IsEmpty()) {
// If we're an offscreen surface with zero width and/or height, set to a
// non-zero size so that we have a complete framebuffer for operations like
// glClear.
initial_size_ = gfx::Size(1, 1);
}
} }
GpuCommandBufferStub::~GpuCommandBufferStub() { GpuCommandBufferStub::~GpuCommandBufferStub() {
......
...@@ -2464,6 +2464,7 @@ bool GLES2DecoderImpl::Initialize( ...@@ -2464,6 +2464,7 @@ bool GLES2DecoderImpl::Initialize(
TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize"); TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize");
DCHECK(context->IsCurrent(surface.get())); DCHECK(context->IsCurrent(surface.get()));
DCHECK(!context_.get()); DCHECK(!context_.get());
DCHECK(!offscreen || !offscreen_size.IsEmpty());
ContextCreationAttribHelper attrib_parser; ContextCreationAttribHelper attrib_parser;
if (!attrib_parser.Parse(attribs)) if (!attrib_parser.Parse(attribs))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment