| OLD | NEW |
| 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 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1911 { | 1911 { |
| 1912 if (isContextLost() || !object) | 1912 if (isContextLost() || !object) |
| 1913 return false; | 1913 return false; |
| 1914 if (!object->validate(contextGroup(), this)) { | 1914 if (!object->validate(contextGroup(), this)) { |
| 1915 synthesizeGLError(GL_INVALID_OPERATION, "delete", "object does not belon
g to this context"); | 1915 synthesizeGLError(GL_INVALID_OPERATION, "delete", "object does not belon
g to this context"); |
| 1916 return false; | 1916 return false; |
| 1917 } | 1917 } |
| 1918 if (object->hasObject()) { | 1918 if (object->hasObject()) { |
| 1919 // We need to pass in context here because we want | 1919 // We need to pass in context here because we want |
| 1920 // things in this context unbound. | 1920 // things in this context unbound. |
| 1921 object->deleteObject(webContext(), contextGL()); | 1921 object->deleteObject(contextGL()); |
| 1922 } | 1922 } |
| 1923 return true; | 1923 return true; |
| 1924 } | 1924 } |
| 1925 | 1925 |
| 1926 void WebGLRenderingContextBase::deleteBuffer(WebGLBuffer* buffer) | 1926 void WebGLRenderingContextBase::deleteBuffer(WebGLBuffer* buffer) |
| 1927 { | 1927 { |
| 1928 if (!deleteObject(buffer)) | 1928 if (!deleteObject(buffer)) |
| 1929 return; | 1929 return; |
| 1930 removeBoundBuffer(buffer); | 1930 removeBoundBuffer(buffer); |
| 1931 } | 1931 } |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2034 | 2034 |
| 2035 void WebGLRenderingContextBase::detachShader(ScriptState* scriptState, WebGLProg
ram* program, WebGLShader* shader) | 2035 void WebGLRenderingContextBase::detachShader(ScriptState* scriptState, WebGLProg
ram* program, WebGLShader* shader) |
| 2036 { | 2036 { |
| 2037 if (isContextLost() || !validateWebGLObject("detachShader", program) || !val
idateWebGLObject("detachShader", shader)) | 2037 if (isContextLost() || !validateWebGLObject("detachShader", program) || !val
idateWebGLObject("detachShader", shader)) |
| 2038 return; | 2038 return; |
| 2039 if (!program->detachShader(shader)) { | 2039 if (!program->detachShader(shader)) { |
| 2040 synthesizeGLError(GL_INVALID_OPERATION, "detachShader", "shader not atta
ched"); | 2040 synthesizeGLError(GL_INVALID_OPERATION, "detachShader", "shader not atta
ched"); |
| 2041 return; | 2041 return; |
| 2042 } | 2042 } |
| 2043 contextGL()->DetachShader(objectOrZero(program), objectOrZero(shader)); | 2043 contextGL()->DetachShader(objectOrZero(program), objectOrZero(shader)); |
| 2044 shader->onDetached(webContext(), contextGL()); | 2044 shader->onDetached(contextGL()); |
| 2045 preserveObjectWrapper(scriptState, program, "shader", shader->type(), nullpt
r); | 2045 preserveObjectWrapper(scriptState, program, "shader", shader->type(), nullpt
r); |
| 2046 } | 2046 } |
| 2047 | 2047 |
| 2048 void WebGLRenderingContextBase::disable(GLenum cap) | 2048 void WebGLRenderingContextBase::disable(GLenum cap) |
| 2049 { | 2049 { |
| 2050 if (isContextLost() || !validateCapability("disable", cap)) | 2050 if (isContextLost() || !validateCapability("disable", cap)) |
| 2051 return; | 2051 return; |
| 2052 if (cap == GL_STENCIL_TEST) { | 2052 if (cap == GL_STENCIL_TEST) { |
| 2053 m_stencilEnabled = false; | 2053 m_stencilEnabled = false; |
| 2054 applyStencilTest(); | 2054 applyStencilTest(); |
| (...skipping 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4177 WebGLTexture* texture = validateTexture2DBinding("texImage2D", target); | 4177 WebGLTexture* texture = validateTexture2DBinding("texImage2D", target); |
| 4178 if (!texture) | 4178 if (!texture) |
| 4179 return; | 4179 return; |
| 4180 if (!validateTexFunc("texImage2D", TexImage, SourceHTMLVideoElement, target,
level, internalformat, video->videoWidth(), video->videoHeight(), 1, 0, format,
type, 0, 0, 0)) | 4180 if (!validateTexFunc("texImage2D", TexImage, SourceHTMLVideoElement, target,
level, internalformat, video->videoWidth(), video->videoHeight(), 1, 0, format,
type, 0, 0, 0)) |
| 4181 return; | 4181 return; |
| 4182 | 4182 |
| 4183 // Go through the fast path doing a GPU-GPU textures copy without a readback
to system memory if possible. | 4183 // Go through the fast path doing a GPU-GPU textures copy without a readback
to system memory if possible. |
| 4184 // Otherwise, it will fall back to the normal SW path. | 4184 // Otherwise, it will fall back to the normal SW path. |
| 4185 if (GL_TEXTURE_2D == target) { | 4185 if (GL_TEXTURE_2D == target) { |
| 4186 if (Extensions3DUtil::canUseCopyTextureCHROMIUM(target, internalformat,
type, level) | 4186 if (Extensions3DUtil::canUseCopyTextureCHROMIUM(target, internalformat,
type, level) |
| 4187 && video->copyVideoTextureToPlatformTexture(webContext(), texture->o
bject(), internalformat, type, m_unpackPremultiplyAlpha, m_unpackFlipY)) { | 4187 && video->copyVideoTextureToPlatformTexture(contextGL(), texture->ob
ject(), internalformat, type, m_unpackPremultiplyAlpha, m_unpackFlipY)) { |
| 4188 return; | 4188 return; |
| 4189 } | 4189 } |
| 4190 | 4190 |
| 4191 // Try using an accelerated image buffer, this allows YUV conversion to
be done on the GPU. | 4191 // Try using an accelerated image buffer, this allows YUV conversion to
be done on the GPU. |
| 4192 OwnPtr<ImageBufferSurface> surface = adoptPtr(new AcceleratedImageBuffer
Surface(IntSize(video->videoWidth(), video->videoHeight()))); | 4192 OwnPtr<ImageBufferSurface> surface = adoptPtr(new AcceleratedImageBuffer
Surface(IntSize(video->videoWidth(), video->videoHeight()))); |
| 4193 if (surface->isValid()) { | 4193 if (surface->isValid()) { |
| 4194 OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(surface.release(
))); | 4194 OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(surface.release(
))); |
| 4195 if (imageBuffer) { | 4195 if (imageBuffer) { |
| 4196 // The video element paints an RGBA frame into our surface here.
By using an AcceleratedImageBufferSurface, | 4196 // The video element paints an RGBA frame into our surface here.
By using an AcceleratedImageBufferSurface, |
| 4197 // we enable the WebMediaPlayer implementation to do any necessa
ry color space conversion on the GPU (though it | 4197 // 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 Loading... |
| 4799 return; | 4799 return; |
| 4800 } | 4800 } |
| 4801 | 4801 |
| 4802 if (transformFeedbackActive() && !transformFeedbackPaused()) { | 4802 if (transformFeedbackActive() && !transformFeedbackPaused()) { |
| 4803 synthesizeGLError(GL_INVALID_OPERATION, "useProgram", "transform feedbac
k is active and not paused"); | 4803 synthesizeGLError(GL_INVALID_OPERATION, "useProgram", "transform feedbac
k is active and not paused"); |
| 4804 return; | 4804 return; |
| 4805 } | 4805 } |
| 4806 | 4806 |
| 4807 if (m_currentProgram != program) { | 4807 if (m_currentProgram != program) { |
| 4808 if (m_currentProgram) | 4808 if (m_currentProgram) |
| 4809 m_currentProgram->onDetached(webContext(), contextGL()); | 4809 m_currentProgram->onDetached(contextGL()); |
| 4810 m_currentProgram = program; | 4810 m_currentProgram = program; |
| 4811 contextGL()->UseProgram(objectOrZero(program)); | 4811 contextGL()->UseProgram(objectOrZero(program)); |
| 4812 if (program) | 4812 if (program) |
| 4813 program->onAttached(); | 4813 program->onAttached(); |
| 4814 preserveObjectWrapper(scriptState, this, "program", 0, program); | 4814 preserveObjectWrapper(scriptState, this, "program", 0, program); |
| 4815 } | 4815 } |
| 4816 } | 4816 } |
| 4817 | 4817 |
| 4818 void WebGLRenderingContextBase::validateProgram(WebGLProgram* program) | 4818 void WebGLRenderingContextBase::validateProgram(WebGLProgram* program) |
| 4819 { | 4819 { |
| (...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6311 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6311 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 6312 } | 6312 } |
| 6313 | 6313 |
| 6314 void WebGLRenderingContextBase::restoreUnpackParameters() | 6314 void WebGLRenderingContextBase::restoreUnpackParameters() |
| 6315 { | 6315 { |
| 6316 if (m_unpackAlignment != 1) | 6316 if (m_unpackAlignment != 1) |
| 6317 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6317 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| 6318 } | 6318 } |
| 6319 | 6319 |
| 6320 } // namespace blink | 6320 } // namespace blink |
| OLD | NEW |