OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "modules/webgl/WebGL2RenderingContextBase.h" | 6 #include "modules/webgl/WebGL2RenderingContextBase.h" |
7 | 7 |
8 #include "bindings/modules/v8/WebGLAny.h" | 8 #include "bindings/modules/v8/WebGLAny.h" |
9 #include "core/html/HTMLCanvasElement.h" | 9 #include "core/html/HTMLCanvasElement.h" |
10 #include "core/html/HTMLImageElement.h" | 10 #include "core/html/HTMLImageElement.h" |
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
922 | 922 |
923 void WebGL2RenderingContextBase::compressedTexImage3D(GLenum target, GLint level , GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint bor der, DOMArrayBufferView* data) | 923 void WebGL2RenderingContextBase::compressedTexImage3D(GLenum target, GLint level , GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint bor der, DOMArrayBufferView* data) |
924 { | 924 { |
925 if (isContextLost()) | 925 if (isContextLost()) |
926 return; | 926 return; |
927 | 927 |
928 WebGLTexture* tex = validateTextureBinding("compressedTexImage3D", target, t rue); | 928 WebGLTexture* tex = validateTextureBinding("compressedTexImage3D", target, t rue); |
929 if (!tex) | 929 if (!tex) |
930 return; | 930 return; |
931 | 931 |
932 if (internalformat != tex->getInternalFormat(target, level)) { | |
qiankun
2015/11/23 09:44:27
CompressedTexImage3D is used to specify a three-di
| |
933 synthesizeGLError(GL_INVALID_OPERATION, "compressedTexImage3D", "format does not match texture format"); | |
934 return; | |
935 } | |
936 | |
932 if (tex->isImmutable()) { | 937 if (tex->isImmutable()) { |
933 synthesizeGLError(GL_INVALID_OPERATION, "compressedTexImage3D", "attempt ed to modify immutable texture"); | 938 synthesizeGLError(GL_INVALID_OPERATION, "compressedTexImage3D", "attempt ed to modify immutable texture"); |
934 return; | 939 return; |
935 } | 940 } |
936 | 941 |
937 webContext()->compressedTexImage3D(target, level, internalformat, width, hei ght, depth, border, data->byteLength(), data->baseAddress()); | 942 webContext()->compressedTexImage3D(target, level, internalformat, width, hei ght, depth, border, data->byteLength(), data->baseAddress()); |
938 tex->setLevelInfo(target, level, internalformat, width, height, depth, GL_UN SIGNED_BYTE); | 943 tex->setLevelInfo(target, level, internalformat, width, height, depth, GL_UN SIGNED_BYTE); |
939 } | 944 } |
940 | 945 |
941 void WebGL2RenderingContextBase::compressedTexSubImage3D(GLenum target, GLint le vel, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, DOMArrayBufferView* data) | 946 void WebGL2RenderingContextBase::compressedTexSubImage3D(GLenum target, GLint le vel, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, DOMArrayBufferView* data) |
(...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3125 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() | 3130 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() |
3126 { | 3131 { |
3127 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) | 3132 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) |
3128 return m_readFramebufferBinding->colorBufferFormat(); | 3133 return m_readFramebufferBinding->colorBufferFormat(); |
3129 if (m_requestedAttributes.alpha()) | 3134 if (m_requestedAttributes.alpha()) |
3130 return GL_RGBA; | 3135 return GL_RGBA; |
3131 return GL_RGB; | 3136 return GL_RGB; |
3132 } | 3137 } |
3133 | 3138 |
3134 } // namespace blink | 3139 } // namespace blink |
OLD | NEW |