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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 1833273002: Remove WebGraphicsContext3D::getGLES2Interface(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: getgles2: rebase Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 { 1912 {
1913 if (isContextLost() || !object) 1913 if (isContextLost() || !object)
1914 return false; 1914 return false;
1915 if (!object->validate(contextGroup(), this)) { 1915 if (!object->validate(contextGroup(), this)) {
1916 synthesizeGLError(GL_INVALID_OPERATION, "delete", "object does not belon g to this context"); 1916 synthesizeGLError(GL_INVALID_OPERATION, "delete", "object does not belon g to this context");
1917 return false; 1917 return false;
1918 } 1918 }
1919 if (object->hasObject()) { 1919 if (object->hasObject()) {
1920 // We need to pass in context here because we want 1920 // We need to pass in context here because we want
1921 // things in this context unbound. 1921 // things in this context unbound.
1922 object->deleteObject(webContext(), contextGL()); 1922 object->deleteObject(contextGL());
1923 } 1923 }
1924 return true; 1924 return true;
1925 } 1925 }
1926 1926
1927 void WebGLRenderingContextBase::deleteBuffer(WebGLBuffer* buffer) 1927 void WebGLRenderingContextBase::deleteBuffer(WebGLBuffer* buffer)
1928 { 1928 {
1929 if (!deleteObject(buffer)) 1929 if (!deleteObject(buffer))
1930 return; 1930 return;
1931 removeBoundBuffer(buffer); 1931 removeBoundBuffer(buffer);
1932 } 1932 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2035 2035
2036 void WebGLRenderingContextBase::detachShader(ScriptState* scriptState, WebGLProg ram* program, WebGLShader* shader) 2036 void WebGLRenderingContextBase::detachShader(ScriptState* scriptState, WebGLProg ram* program, WebGLShader* shader)
2037 { 2037 {
2038 if (isContextLost() || !validateWebGLObject("detachShader", program) || !val idateWebGLObject("detachShader", shader)) 2038 if (isContextLost() || !validateWebGLObject("detachShader", program) || !val idateWebGLObject("detachShader", shader))
2039 return; 2039 return;
2040 if (!program->detachShader(shader)) { 2040 if (!program->detachShader(shader)) {
2041 synthesizeGLError(GL_INVALID_OPERATION, "detachShader", "shader not atta ched"); 2041 synthesizeGLError(GL_INVALID_OPERATION, "detachShader", "shader not atta ched");
2042 return; 2042 return;
2043 } 2043 }
2044 contextGL()->DetachShader(objectOrZero(program), objectOrZero(shader)); 2044 contextGL()->DetachShader(objectOrZero(program), objectOrZero(shader));
2045 shader->onDetached(webContext(), contextGL()); 2045 shader->onDetached(contextGL());
2046 preserveObjectWrapper(scriptState, program, "shader", shader->type(), nullpt r); 2046 preserveObjectWrapper(scriptState, program, "shader", shader->type(), nullpt r);
2047 } 2047 }
2048 2048
2049 void WebGLRenderingContextBase::disable(GLenum cap) 2049 void WebGLRenderingContextBase::disable(GLenum cap)
2050 { 2050 {
2051 if (isContextLost() || !validateCapability("disable", cap)) 2051 if (isContextLost() || !validateCapability("disable", cap))
2052 return; 2052 return;
2053 if (cap == GL_STENCIL_TEST) { 2053 if (cap == GL_STENCIL_TEST) {
2054 m_stencilEnabled = false; 2054 m_stencilEnabled = false;
2055 applyStencilTest(); 2055 applyStencilTest();
(...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after
4205 WebGLTexture* texture = validateTexture2DBinding("texImage2D", target); 4205 WebGLTexture* texture = validateTexture2DBinding("texImage2D", target);
4206 if (!texture) 4206 if (!texture)
4207 return; 4207 return;
4208 if (!validateTexFunc("texImage2D", TexImage, SourceHTMLVideoElement, target, level, internalformat, video->videoWidth(), video->videoHeight(), 1, 0, format, type, 0, 0, 0)) 4208 if (!validateTexFunc("texImage2D", TexImage, SourceHTMLVideoElement, target, level, internalformat, video->videoWidth(), video->videoHeight(), 1, 0, format, type, 0, 0, 0))
4209 return; 4209 return;
4210 4210
4211 // Go through the fast path doing a GPU-GPU textures copy without a readback to system memory if possible. 4211 // Go through the fast path doing a GPU-GPU textures copy without a readback to system memory if possible.
4212 // Otherwise, it will fall back to the normal SW path. 4212 // Otherwise, it will fall back to the normal SW path.
4213 if (GL_TEXTURE_2D == target) { 4213 if (GL_TEXTURE_2D == target) {
4214 if (Extensions3DUtil::canUseCopyTextureCHROMIUM(target, internalformat, type, level) 4214 if (Extensions3DUtil::canUseCopyTextureCHROMIUM(target, internalformat, type, level)
4215 && video->copyVideoTextureToPlatformTexture(webContext(), texture->o bject(), internalformat, type, m_unpackPremultiplyAlpha, m_unpackFlipY)) { 4215 && video->copyVideoTextureToPlatformTexture(contextGL(), texture->ob ject(), internalformat, type, m_unpackPremultiplyAlpha, m_unpackFlipY)) {
4216 return; 4216 return;
4217 } 4217 }
4218 4218
4219 // Try using an accelerated image buffer, this allows YUV conversion to be done on the GPU. 4219 // Try using an accelerated image buffer, this allows YUV conversion to be done on the GPU.
4220 OwnPtr<ImageBufferSurface> surface = adoptPtr(new AcceleratedImageBuffer Surface(IntSize(video->videoWidth(), video->videoHeight()))); 4220 OwnPtr<ImageBufferSurface> surface = adoptPtr(new AcceleratedImageBuffer Surface(IntSize(video->videoWidth(), video->videoHeight())));
4221 if (surface->isValid()) { 4221 if (surface->isValid()) {
4222 OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(surface.release( ))); 4222 OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(surface.release( )));
4223 if (imageBuffer) { 4223 if (imageBuffer) {
4224 // The video element paints an RGBA frame into our surface here. By using an AcceleratedImageBufferSurface, 4224 // The video element paints an RGBA frame into our surface here. By using an AcceleratedImageBufferSurface,
4225 // we enable the WebMediaPlayer implementation to do any necessa ry color space conversion on the GPU (though it 4225 // we enable the WebMediaPlayer implementation to do any necessa ry color space conversion on the GPU (though it
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
4827 return; 4827 return;
4828 } 4828 }
4829 4829
4830 if (transformFeedbackActive() && !transformFeedbackPaused()) { 4830 if (transformFeedbackActive() && !transformFeedbackPaused()) {
4831 synthesizeGLError(GL_INVALID_OPERATION, "useProgram", "transform feedbac k is active and not paused"); 4831 synthesizeGLError(GL_INVALID_OPERATION, "useProgram", "transform feedbac k is active and not paused");
4832 return; 4832 return;
4833 } 4833 }
4834 4834
4835 if (m_currentProgram != program) { 4835 if (m_currentProgram != program) {
4836 if (m_currentProgram) 4836 if (m_currentProgram)
4837 m_currentProgram->onDetached(webContext(), contextGL()); 4837 m_currentProgram->onDetached(contextGL());
4838 m_currentProgram = program; 4838 m_currentProgram = program;
4839 contextGL()->UseProgram(objectOrZero(program)); 4839 contextGL()->UseProgram(objectOrZero(program));
4840 if (program) 4840 if (program)
4841 program->onAttached(); 4841 program->onAttached();
4842 preserveObjectWrapper(scriptState, this, "program", 0, program); 4842 preserveObjectWrapper(scriptState, this, "program", 0, program);
4843 } 4843 }
4844 } 4844 }
4845 4845
4846 void WebGLRenderingContextBase::validateProgram(WebGLProgram* program) 4846 void WebGLRenderingContextBase::validateProgram(WebGLProgram* program)
4847 { 4847 {
(...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after
6339 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); 6339 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
6340 } 6340 }
6341 6341
6342 void WebGLRenderingContextBase::restoreUnpackParameters() 6342 void WebGLRenderingContextBase::restoreUnpackParameters()
6343 { 6343 {
6344 if (m_unpackAlignment != 1) 6344 if (m_unpackAlignment != 1)
6345 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); 6345 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
6346 } 6346 }
6347 6347
6348 } // namespace blink 6348 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLRenderbuffer.cpp ('k') | third_party/WebKit/Source/modules/webgl/WebGLSampler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698