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 5584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5658 return false; | 5659 return false; |
5659 } | 5660 } |
5660 if (width < 0 || height < 0) { | 5661 if (width < 0 || height < 0) { |
5661 synthesizeGLError(GL_INVALID_VALUE, functionName, "width or height < 0") ; | 5662 synthesizeGLError(GL_INVALID_VALUE, functionName, "width or height < 0") ; |
5662 return false; | 5663 return false; |
5663 } | 5664 } |
5664 | 5665 |
5665 unsigned bytesRequired = 0; | 5666 unsigned bytesRequired = 0; |
5666 | 5667 |
5667 switch (format) { | 5668 switch (format) { |
5669 case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: | |
5670 case GL_COMPRESSED_RGBA_ASTC_5x4_KHR: | |
5671 case GL_COMPRESSED_RGBA_ASTC_5x5_KHR: | |
5672 case GL_COMPRESSED_RGBA_ASTC_6x5_KHR: | |
5673 case GL_COMPRESSED_RGBA_ASTC_6x6_KHR: | |
5674 case GL_COMPRESSED_RGBA_ASTC_8x5_KHR: | |
5675 case GL_COMPRESSED_RGBA_ASTC_8x6_KHR: | |
5676 case GL_COMPRESSED_RGBA_ASTC_8x8_KHR: | |
5677 case GL_COMPRESSED_RGBA_ASTC_10x5_KHR: | |
5678 case GL_COMPRESSED_RGBA_ASTC_10x6_KHR: | |
5679 case GL_COMPRESSED_RGBA_ASTC_10x8_KHR: | |
5680 case GL_COMPRESSED_RGBA_ASTC_10x10_KHR: | |
5681 case GL_COMPRESSED_RGBA_ASTC_12x10_KHR: | |
5682 case GL_COMPRESSED_RGBA_ASTC_12x12_KHR: | |
5683 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: | |
5684 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: | |
5685 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: | |
5686 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: | |
5687 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: | |
5688 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: | |
5689 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: | |
5690 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: | |
5691 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: | |
5692 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: | |
5693 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: | |
5694 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: | |
5695 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: | |
5696 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: | |
5697 { | |
5698 const int index = (format < GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR) ? | |
5699 (int)format - GL_COMPRESSED_RGBA_ASTC_4x4_KHR : (int)format - GL _COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR; | |
bajones
2015/08/07 22:01:09
This has the same basic issue as I described in ht
| |
5700 | |
5701 const int kBlockWidth = WebGLCompressedTextureASTC::kBlockSizeCompre ssASTC[index].blockWidth; | |
5702 const int kBlockHeight = WebGLCompressedTextureASTC::kBlockSizeCompr essASTC[index].blockHeight; | |
5703 | |
5704 int kBlockX = (max(width, kBlockWidth) + kBlockWidth - 1) / kBlockWi dth; | |
5705 int kBlockY = (max(height, kBlockHeight) + kBlockHeight - 1) / kBloc kHeight; | |
5706 | |
5707 bytesRequired = (kBlockX * kBlockY) << 4; | |
5708 } | |
5709 break; | |
5668 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: | 5710 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: |
5669 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: | 5711 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: |
5670 { | 5712 { |
5671 const int kBlockWidth = 4; | 5713 const int kBlockWidth = 4; |
5672 const int kBlockHeight = 4; | 5714 const int kBlockHeight = 4; |
5673 const int kBlockSize = 8; | 5715 const int kBlockSize = 8; |
5674 int numBlocksAcross = (width + kBlockWidth - 1) / kBlockWidth; | 5716 int numBlocksAcross = (width + kBlockWidth - 1) / kBlockWidth; |
5675 int numBlocksDown = (height + kBlockHeight - 1) / kBlockHeight; | 5717 int numBlocksDown = (height + kBlockHeight - 1) / kBlockHeight; |
5676 int numBlocks = numBlocksAcross * numBlocksDown; | 5718 int numBlocks = numBlocksAcross * numBlocksDown; |
5677 bytesRequired = numBlocks * kBlockSize; | 5719 bytesRequired = numBlocks * kBlockSize; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5728 | 5770 |
5729 bool WebGLRenderingContextBase::validateCompressedTexDimensions(const char* func tionName, TexImageFunctionType functionType, GLenum target, GLint level, GLsizei width, GLsizei height, GLenum format) | 5771 bool WebGLRenderingContextBase::validateCompressedTexDimensions(const char* func tionName, TexImageFunctionType functionType, GLenum target, GLint level, GLsizei width, GLsizei height, GLenum format) |
5730 { | 5772 { |
5731 if (!validateTexFuncDimensions(functionName, functionType, target, level, wi dth, height)) | 5773 if (!validateTexFuncDimensions(functionName, functionType, target, level, wi dth, height)) |
5732 return false; | 5774 return false; |
5733 | 5775 |
5734 bool widthValid = false; | 5776 bool widthValid = false; |
5735 bool heightValid = false; | 5777 bool heightValid = false; |
5736 | 5778 |
5737 switch (format) { | 5779 switch (format) { |
5780 case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: | |
5781 case GL_COMPRESSED_RGBA_ASTC_5x4_KHR: | |
5782 case GL_COMPRESSED_RGBA_ASTC_5x5_KHR: | |
5783 case GL_COMPRESSED_RGBA_ASTC_6x5_KHR: | |
5784 case GL_COMPRESSED_RGBA_ASTC_6x6_KHR: | |
5785 case GL_COMPRESSED_RGBA_ASTC_8x5_KHR: | |
5786 case GL_COMPRESSED_RGBA_ASTC_8x6_KHR: | |
5787 case GL_COMPRESSED_RGBA_ASTC_8x8_KHR: | |
5788 case GL_COMPRESSED_RGBA_ASTC_10x5_KHR: | |
5789 case GL_COMPRESSED_RGBA_ASTC_10x6_KHR: | |
5790 case GL_COMPRESSED_RGBA_ASTC_10x8_KHR: | |
5791 case GL_COMPRESSED_RGBA_ASTC_10x10_KHR: | |
5792 case GL_COMPRESSED_RGBA_ASTC_12x10_KHR: | |
5793 case GL_COMPRESSED_RGBA_ASTC_12x12_KHR: | |
5794 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: | |
5795 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: | |
5796 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: | |
5797 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: | |
5798 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: | |
5799 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: | |
5800 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: | |
5801 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: | |
5802 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: | |
5803 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: | |
5804 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: | |
5805 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: | |
5806 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: | |
5807 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: { | |
5808 widthValid = true; | |
5809 heightValid = true; | |
5810 break; | |
5811 } | |
5738 case GC3D_COMPRESSED_ATC_RGB_AMD: | 5812 case GC3D_COMPRESSED_ATC_RGB_AMD: |
5739 case GC3D_COMPRESSED_ATC_RGBA_EXPLICIT_ALPHA_AMD: | 5813 case GC3D_COMPRESSED_ATC_RGBA_EXPLICIT_ALPHA_AMD: |
5740 case GC3D_COMPRESSED_ATC_RGBA_INTERPOLATED_ALPHA_AMD: | 5814 case GC3D_COMPRESSED_ATC_RGBA_INTERPOLATED_ALPHA_AMD: |
5741 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: | 5815 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: |
5742 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: | 5816 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: |
5743 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: | 5817 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: |
5744 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: { | 5818 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: { |
5745 const int kBlockWidth = 4; | 5819 const int kBlockWidth = 4; |
5746 const int kBlockHeight = 4; | 5820 const int kBlockHeight = 4; |
5747 widthValid = (level && width == 1) || (level && width == 2) || !(width % kBlockWidth); | 5821 widthValid = (level && width == 1) || (level && width == 2) || !(width % kBlockWidth); |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6606 | 6680 |
6607 return totalBytesPerPixel; | 6681 return totalBytesPerPixel; |
6608 } | 6682 } |
6609 | 6683 |
6610 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const | 6684 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const |
6611 { | 6685 { |
6612 return m_drawingBuffer.get(); | 6686 return m_drawingBuffer.get(); |
6613 } | 6687 } |
6614 | 6688 |
6615 } // namespace blink | 6689 } // namespace blink |
OLD | NEW |