diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-23 20:34:15 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-23 20:34:15 +0000 |
commit | f62a5abd6205c7a84a19f8b00b45b0792b767f57 (patch) | |
tree | 100e751f4e0302bbb4ecde919fb1cea272aeb7cf /media | |
parent | 97807cbf58afe1e25b2bd014ce758e88e483d08b (diff) | |
download | chromium_src-f62a5abd6205c7a84a19f8b00b45b0792b767f57.zip chromium_src-f62a5abd6205c7a84a19f8b00b45b0792b767f57.tar.gz chromium_src-f62a5abd6205c7a84a19f8b00b45b0792b767f57.tar.bz2 |
GLContext no longer holds a pointer to a GLSurface.
This is part of an ongoing effort to treat GL contexts and GL surfaces as independent entities.
TEST=run WebGL on mac, windows and linux, trybots
BUG=none
Review URL: http://codereview.chromium.org/7021014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86332 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/tools/shader_bench/cpu_color_painter.cc | 4 | ||||
-rw-r--r-- | media/tools/shader_bench/gpu_color_painter.cc | 2 | ||||
-rw-r--r-- | media/tools/shader_bench/gpu_color_painter_exp.cc | 4 | ||||
-rw-r--r-- | media/tools/shader_bench/gpu_painter.cc | 9 | ||||
-rw-r--r-- | media/tools/shader_bench/gpu_painter.h | 5 | ||||
-rw-r--r-- | media/tools/shader_bench/shader_bench.cc | 6 |
6 files changed, 18 insertions, 12 deletions
diff --git a/media/tools/shader_bench/cpu_color_painter.cc b/media/tools/shader_bench/cpu_color_painter.cc index 61347ea..5b8f240 100644 --- a/media/tools/shader_bench/cpu_color_painter.cc +++ b/media/tools/shader_bench/cpu_color_painter.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -88,5 +88,5 @@ void CPUColorPainter::Paint(scoped_refptr<media::VideoFrame> video_frame) { rgba_frame->data(0)); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - context()->SwapBuffers(); + surface()->SwapBuffers(); } diff --git a/media/tools/shader_bench/gpu_color_painter.cc b/media/tools/shader_bench/gpu_color_painter.cc index 01c1eb4..908bb9f 100644 --- a/media/tools/shader_bench/gpu_color_painter.cc +++ b/media/tools/shader_bench/gpu_color_painter.cc @@ -113,5 +113,5 @@ void GPUColorWithLuminancePainter::Paint( } glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - context()->SwapBuffers(); + surface()->SwapBuffers(); } diff --git a/media/tools/shader_bench/gpu_color_painter_exp.cc b/media/tools/shader_bench/gpu_color_painter_exp.cc index cb89e09..668fb0f 100644 --- a/media/tools/shader_bench/gpu_color_painter_exp.cc +++ b/media/tools/shader_bench/gpu_color_painter_exp.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -126,5 +126,5 @@ void GPUColorRGBALumHackPainter::Paint( } glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - context()->SwapBuffers(); + surface()->SwapBuffers(); } diff --git a/media/tools/shader_bench/gpu_painter.cc b/media/tools/shader_bench/gpu_painter.cc index c1fe5ae..e6350119 100644 --- a/media/tools/shader_bench/gpu_painter.cc +++ b/media/tools/shader_bench/gpu_painter.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -25,13 +25,16 @@ static const float kTextureCoords[8] = { static const unsigned int kErrorSize = 4096; GPUPainter::GPUPainter() - : context_(NULL) { + : surface_(NULL), + context_(NULL) { } GPUPainter::~GPUPainter() { } -void GPUPainter::SetGLContext(gfx::GLContext* context) { +void GPUPainter::SetGLContext(gfx::GLSurface* surface, + gfx::GLContext* context) { + surface_ = surface; context_ = context; } diff --git a/media/tools/shader_bench/gpu_painter.h b/media/tools/shader_bench/gpu_painter.h index 20b8643..1fcfb8a 100644 --- a/media/tools/shader_bench/gpu_painter.h +++ b/media/tools/shader_bench/gpu_painter.h @@ -9,6 +9,7 @@ #include "ui/gfx/gl/gl_bindings.h" #include "ui/gfx/gl/gl_context.h" #include "ui/gfx/gl/gl_implementation.h" +#include "ui/gfx/gl/gl_surface.h" // Class that renders video frames to a window via GPU. class GPUPainter : public Painter { @@ -17,10 +18,11 @@ class GPUPainter : public Painter { virtual ~GPUPainter(); // Returns a reference to the GL context. + gfx::GLSurface* surface() const { return surface_; } gfx::GLContext* context() const { return context_; } // Sets context for subsequent gl calls in this painter. - virtual void SetGLContext(gfx::GLContext* context); + virtual void SetGLContext(gfx::GLSurface* surface, gfx::GLContext* context); // Creates shader program into given context, from the vertex and fragment // shader source code. Returns the id of the shader program. @@ -34,6 +36,7 @@ class GPUPainter : public Painter { GLuint LoadShader(unsigned type, const char* shader_source); // Reference to the gl context. + gfx::GLSurface* surface_; gfx::GLContext* context_; DISALLOW_COPY_AND_ASSIGN(GPUPainter); diff --git a/media/tools/shader_bench/shader_bench.cc b/media/tools/shader_bench/shader_bench.cc index 077bfd2..17210a6 100644 --- a/media/tools/shader_bench/shader_bench.cc +++ b/media/tools/shader_bench/shader_bench.cc @@ -135,8 +135,8 @@ int main(int argc, char** argv) { scoped_ptr<media::Window> window(new media::Window(width, height)); gfx::GLSurface* surface = gfx::GLSurface::CreateViewGLSurface(window->PluginWindow()); - gfx::GLContext* context = gfx::GLContext::CreateGLContext(surface, NULL); - context->MakeCurrent(); + gfx::GLContext* context = gfx::GLContext::CreateGLContext(NULL, surface); + context->MakeCurrent(surface); // This sets D3DPRESENT_INTERVAL_IMMEDIATE on Windows. context->SetSwapInterval(0); @@ -155,7 +155,7 @@ int main(int argc, char** argv) { for (int i = 0; i < kNumPainters; i++) { scoped_ptr<GPUPainter> painter(painters[i].painter); painter->LoadFrames(&frames); - painter->SetGLContext(context); + painter->SetGLContext(surface, context); painter->Initialize(width, height); printf("Running %s tests...", painters[i].name); RunTest(window.get(), painter.get()); |