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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 #include "modules/webgl/EXTTextureFilterAnisotropic.h" | 54 #include "modules/webgl/EXTTextureFilterAnisotropic.h" |
55 #include "modules/webgl/OESElementIndexUint.h" | 55 #include "modules/webgl/OESElementIndexUint.h" |
56 #include "modules/webgl/OESStandardDerivatives.h" | 56 #include "modules/webgl/OESStandardDerivatives.h" |
57 #include "modules/webgl/OESTextureFloat.h" | 57 #include "modules/webgl/OESTextureFloat.h" |
58 #include "modules/webgl/OESTextureFloatLinear.h" | 58 #include "modules/webgl/OESTextureFloatLinear.h" |
59 #include "modules/webgl/OESTextureHalfFloat.h" | 59 #include "modules/webgl/OESTextureHalfFloat.h" |
60 #include "modules/webgl/OESTextureHalfFloatLinear.h" | 60 #include "modules/webgl/OESTextureHalfFloatLinear.h" |
61 #include "modules/webgl/OESVertexArrayObject.h" | 61 #include "modules/webgl/OESVertexArrayObject.h" |
62 #include "modules/webgl/WebGLActiveInfo.h" | 62 #include "modules/webgl/WebGLActiveInfo.h" |
63 #include "modules/webgl/WebGLBuffer.h" | 63 #include "modules/webgl/WebGLBuffer.h" |
| 64 #include "modules/webgl/WebGLCompressedTextureASTC.h" |
64 #include "modules/webgl/WebGLCompressedTextureATC.h" | 65 #include "modules/webgl/WebGLCompressedTextureATC.h" |
65 #include "modules/webgl/WebGLCompressedTextureETC1.h" | 66 #include "modules/webgl/WebGLCompressedTextureETC1.h" |
66 #include "modules/webgl/WebGLCompressedTexturePVRTC.h" | 67 #include "modules/webgl/WebGLCompressedTexturePVRTC.h" |
67 #include "modules/webgl/WebGLCompressedTextureS3TC.h" | 68 #include "modules/webgl/WebGLCompressedTextureS3TC.h" |
68 #include "modules/webgl/WebGLContextAttributeHelpers.h" | 69 #include "modules/webgl/WebGLContextAttributeHelpers.h" |
69 #include "modules/webgl/WebGLContextAttributes.h" | 70 #include "modules/webgl/WebGLContextAttributes.h" |
70 #include "modules/webgl/WebGLContextEvent.h" | 71 #include "modules/webgl/WebGLContextEvent.h" |
71 #include "modules/webgl/WebGLContextGroup.h" | 72 #include "modules/webgl/WebGLContextGroup.h" |
72 #include "modules/webgl/WebGLDebugRendererInfo.h" | 73 #include "modules/webgl/WebGLDebugRendererInfo.h" |
73 #include "modules/webgl/WebGLDebugShaders.h" | 74 #include "modules/webgl/WebGLDebugShaders.h" |
(...skipping 5608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5682 return false; | 5683 return false; |
5683 } | 5684 } |
5684 if (width < 0 || height < 0) { | 5685 if (width < 0 || height < 0) { |
5685 synthesizeGLError(GL_INVALID_VALUE, functionName, "width or height < 0")
; | 5686 synthesizeGLError(GL_INVALID_VALUE, functionName, "width or height < 0")
; |
5686 return false; | 5687 return false; |
5687 } | 5688 } |
5688 | 5689 |
5689 unsigned bytesRequired = 0; | 5690 unsigned bytesRequired = 0; |
5690 | 5691 |
5691 switch (format) { | 5692 switch (format) { |
| 5693 case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: |
| 5694 case GL_COMPRESSED_RGBA_ASTC_5x4_KHR: |
| 5695 case GL_COMPRESSED_RGBA_ASTC_5x5_KHR: |
| 5696 case GL_COMPRESSED_RGBA_ASTC_6x5_KHR: |
| 5697 case GL_COMPRESSED_RGBA_ASTC_6x6_KHR: |
| 5698 case GL_COMPRESSED_RGBA_ASTC_8x5_KHR: |
| 5699 case GL_COMPRESSED_RGBA_ASTC_8x6_KHR: |
| 5700 case GL_COMPRESSED_RGBA_ASTC_8x8_KHR: |
| 5701 case GL_COMPRESSED_RGBA_ASTC_10x5_KHR: |
| 5702 case GL_COMPRESSED_RGBA_ASTC_10x6_KHR: |
| 5703 case GL_COMPRESSED_RGBA_ASTC_10x8_KHR: |
| 5704 case GL_COMPRESSED_RGBA_ASTC_10x10_KHR: |
| 5705 case GL_COMPRESSED_RGBA_ASTC_12x10_KHR: |
| 5706 case GL_COMPRESSED_RGBA_ASTC_12x12_KHR: |
| 5707 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: |
| 5708 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: |
| 5709 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: |
| 5710 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: |
| 5711 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: |
| 5712 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: |
| 5713 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: |
| 5714 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: |
| 5715 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: |
| 5716 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: |
| 5717 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: |
| 5718 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: |
| 5719 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: |
| 5720 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: |
| 5721 { |
| 5722 const int index = (format < GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR)
? |
| 5723 (int)format - GL_COMPRESSED_RGBA_ASTC_4x4_KHR : (int)format - GL
_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR; |
| 5724 |
| 5725 const int kBlockSize = 16; |
| 5726 const int kBlockWidth = WebGLCompressedTextureASTC::kBlockSizeCompre
ssASTC[index].blockWidth; |
| 5727 const int kBlockHeight = WebGLCompressedTextureASTC::kBlockSizeCompr
essASTC[index].blockHeight; |
| 5728 |
| 5729 int numBlocksAcross = (width + kBlockWidth - 1) / kBlockWidth; |
| 5730 int numBlocksDown = (height + kBlockHeight - 1) / kBlockHeight; |
| 5731 int numBlocks = numBlocksAcross * numBlocksDown; |
| 5732 bytesRequired = numBlocks * kBlockSize; |
| 5733 } |
| 5734 break; |
5692 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: | 5735 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: |
5693 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: | 5736 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: |
5694 { | 5737 { |
5695 const int kBlockWidth = 4; | 5738 const int kBlockWidth = 4; |
5696 const int kBlockHeight = 4; | 5739 const int kBlockHeight = 4; |
5697 const int kBlockSize = 8; | 5740 const int kBlockSize = 8; |
5698 int numBlocksAcross = (width + kBlockWidth - 1) / kBlockWidth; | 5741 int numBlocksAcross = (width + kBlockWidth - 1) / kBlockWidth; |
5699 int numBlocksDown = (height + kBlockHeight - 1) / kBlockHeight; | 5742 int numBlocksDown = (height + kBlockHeight - 1) / kBlockHeight; |
5700 int numBlocks = numBlocksAcross * numBlocksDown; | 5743 int numBlocks = numBlocksAcross * numBlocksDown; |
5701 bytesRequired = numBlocks * kBlockSize; | 5744 bytesRequired = numBlocks * kBlockSize; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5752 | 5795 |
5753 bool WebGLRenderingContextBase::validateCompressedTexDimensions(const char* func
tionName, TexImageFunctionType functionType, GLenum target, GLint level, GLsizei
width, GLsizei height, GLenum format) | 5796 bool WebGLRenderingContextBase::validateCompressedTexDimensions(const char* func
tionName, TexImageFunctionType functionType, GLenum target, GLint level, GLsizei
width, GLsizei height, GLenum format) |
5754 { | 5797 { |
5755 if (!validateTexFuncDimensions(functionName, functionType, target, level, wi
dth, height)) | 5798 if (!validateTexFuncDimensions(functionName, functionType, target, level, wi
dth, height)) |
5756 return false; | 5799 return false; |
5757 | 5800 |
5758 bool widthValid = false; | 5801 bool widthValid = false; |
5759 bool heightValid = false; | 5802 bool heightValid = false; |
5760 | 5803 |
5761 switch (format) { | 5804 switch (format) { |
| 5805 case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: |
| 5806 case GL_COMPRESSED_RGBA_ASTC_5x4_KHR: |
| 5807 case GL_COMPRESSED_RGBA_ASTC_5x5_KHR: |
| 5808 case GL_COMPRESSED_RGBA_ASTC_6x5_KHR: |
| 5809 case GL_COMPRESSED_RGBA_ASTC_6x6_KHR: |
| 5810 case GL_COMPRESSED_RGBA_ASTC_8x5_KHR: |
| 5811 case GL_COMPRESSED_RGBA_ASTC_8x6_KHR: |
| 5812 case GL_COMPRESSED_RGBA_ASTC_8x8_KHR: |
| 5813 case GL_COMPRESSED_RGBA_ASTC_10x5_KHR: |
| 5814 case GL_COMPRESSED_RGBA_ASTC_10x6_KHR: |
| 5815 case GL_COMPRESSED_RGBA_ASTC_10x8_KHR: |
| 5816 case GL_COMPRESSED_RGBA_ASTC_10x10_KHR: |
| 5817 case GL_COMPRESSED_RGBA_ASTC_12x10_KHR: |
| 5818 case GL_COMPRESSED_RGBA_ASTC_12x12_KHR: |
| 5819 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: |
| 5820 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: |
| 5821 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: |
| 5822 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: |
| 5823 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: |
| 5824 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: |
| 5825 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: |
| 5826 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: |
| 5827 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: |
| 5828 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: |
| 5829 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: |
| 5830 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: |
| 5831 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: |
| 5832 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: { |
| 5833 widthValid = true; |
| 5834 heightValid = true; |
| 5835 break; |
| 5836 } |
5762 case GC3D_COMPRESSED_ATC_RGB_AMD: | 5837 case GC3D_COMPRESSED_ATC_RGB_AMD: |
5763 case GC3D_COMPRESSED_ATC_RGBA_EXPLICIT_ALPHA_AMD: | 5838 case GC3D_COMPRESSED_ATC_RGBA_EXPLICIT_ALPHA_AMD: |
5764 case GC3D_COMPRESSED_ATC_RGBA_INTERPOLATED_ALPHA_AMD: | 5839 case GC3D_COMPRESSED_ATC_RGBA_INTERPOLATED_ALPHA_AMD: |
5765 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: | 5840 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: |
5766 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: | 5841 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: |
5767 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: | 5842 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: |
5768 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: { | 5843 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: { |
5769 const int kBlockWidth = 4; | 5844 const int kBlockWidth = 4; |
5770 const int kBlockHeight = 4; | 5845 const int kBlockHeight = 4; |
5771 widthValid = (level && width == 1) || (level && width == 2) || !(width %
kBlockWidth); | 5846 widthValid = (level && width == 1) || (level && width == 2) || !(width %
kBlockWidth); |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6627 | 6702 |
6628 return totalBytesPerPixel; | 6703 return totalBytesPerPixel; |
6629 } | 6704 } |
6630 | 6705 |
6631 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const | 6706 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const |
6632 { | 6707 { |
6633 return m_drawingBuffer.get(); | 6708 return m_drawingBuffer.get(); |
6634 } | 6709 } |
6635 | 6710 |
6636 } // namespace blink | 6711 } // namespace blink |
OLD | NEW |