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

Unified Diff: cc/gl_renderer.cc

Issue 11415040: Relax assertions around context loss and program initialization. Higher level code will take care o… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « no previous file | cc/program_binding.h » ('j') | cc/program_binding.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/gl_renderer.cc
diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc
index e69d285070ef275234d916123d6d6562eb7e5205..ad48cef55753e076f9825fbd05b528c97a307d83 100644
--- a/cc/gl_renderer.cc
+++ b/cc/gl_renderer.cc
@@ -292,7 +292,7 @@ void GLRenderer::drawQuad(DrawingFrame& frame, const DrawQuad* quad)
void GLRenderer::drawCheckerboardQuad(const DrawingFrame& frame, const CheckerboardDrawQuad* quad)
{
const TileCheckerboardProgram* program = tileCheckerboardProgram();
- DCHECK(program && program->initialized());
+ DCHECK(program && (program->initialized() || isContextLost()));
GLC(context(), context()->useProgram(program->program()));
SkColor color = quad->color();
@@ -318,7 +318,7 @@ void GLRenderer::drawDebugBorderQuad(const DrawingFrame& frame, const DebugBorde
{
static float glMatrix[16];
const SolidColorProgram* program = solidColorProgram();
- DCHECK(program && program->initialized());
+ DCHECK(program && (program->initialized() || isContextLost()));
GLC(context(), context()->useProgram(program->program()));
// Use the full quadRect for debug quads to not move the edges based on partial swaps.
@@ -855,7 +855,7 @@ void GLRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQuad* qua
void GLRenderer::drawYUVVideoQuad(const DrawingFrame& frame, const YUVVideoDrawQuad* quad)
{
const VideoYUVProgram* program = videoYUVProgram();
- DCHECK(program && program->initialized());
+ DCHECK(program && (program->initialized() || isContextLost()));
const VideoLayerImpl::FramePlane& yPlane = quad->yPlane();
const VideoLayerImpl::FramePlane& uPlane = quad->uPlane();
@@ -928,9 +928,10 @@ void GLRenderer::drawStreamVideoQuad(const DrawingFrame& frame, const StreamVide
}
struct TextureProgramBinding {
- template<class Program> void set(Program* program)
+ template<class Program> void set(
+ Program* program, WebKit::WebGraphicsContext3D* context)
{
- DCHECK(program && program->initialized());
+ DCHECK(program && (program->initialized() || context->isContextLost()));
programId = program->program();
samplerLocation = program->fragmentShader().samplerLocation();
matrixLocation = program->vertexShader().matrixLocation();
@@ -943,9 +944,10 @@ struct TextureProgramBinding {
};
struct TexTransformTextureProgramBinding : TextureProgramBinding {
- template<class Program> void set(Program* program)
+ template<class Program> void set(
+ Program* program, WebKit::WebGraphicsContext3D* context)
{
- TextureProgramBinding::set(program);
+ TextureProgramBinding::set(program, context);
texTransformLocation = program->vertexShader().texTransformLocation();
}
int texTransformLocation;
@@ -955,9 +957,9 @@ void GLRenderer::drawTextureQuad(const DrawingFrame& frame, const TextureDrawQua
{
TexTransformTextureProgramBinding binding;
if (quad->flipped())
- binding.set(textureProgramFlip());
+ binding.set(textureProgramFlip(), context());
else
- binding.set(textureProgram());
+ binding.set(textureProgram(), context());
GLC(context(), context()->useProgram(binding.programId));
GLC(context(), context()->uniform1i(binding.samplerLocation, 0));
const gfx::RectF& uvRect = quad->uvRect();
@@ -988,7 +990,7 @@ void GLRenderer::drawTextureQuad(const DrawingFrame& frame, const TextureDrawQua
void GLRenderer::drawIOSurfaceQuad(const DrawingFrame& frame, const IOSurfaceDrawQuad* quad)
{
TexTransformTextureProgramBinding binding;
- binding.set(textureIOSurfaceProgram());
+ binding.set(textureIOSurfaceProgram(), context());
GLC(context(), context()->useProgram(binding.programId));
GLC(context(), context()->uniform1i(binding.samplerLocation, 0));
« no previous file with comments | « no previous file | cc/program_binding.h » ('j') | cc/program_binding.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698