Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 1 | #ifndef _GLUTEXTUREUTIL_HPP |
| 2 | #define _GLUTEXTUREUTIL_HPP |
| 3 | /*------------------------------------------------------------------------- |
| 4 | * drawElements Quality Program OpenGL ES Utilities |
| 5 | * ------------------------------------------------ |
| 6 | * |
| 7 | * Copyright 2014 The Android Open Source Project |
| 8 | * |
| 9 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 10 | * you may not use this file except in compliance with the License. |
| 11 | * You may obtain a copy of the License at |
| 12 | * |
| 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | * |
| 15 | * Unless required by applicable law or agreed to in writing, software |
| 16 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 | * See the License for the specific language governing permissions and |
| 19 | * limitations under the License. |
| 20 | * |
| 21 | *//*! |
| 22 | * \file |
| 23 | * \brief Texture format utilities. |
| 24 | *//*--------------------------------------------------------------------*/ |
| 25 | |
| 26 | #include "gluDefs.hpp" |
| 27 | #include "tcuTexture.hpp" |
| 28 | #include "tcuCompressedTexture.hpp" |
| 29 | #include "gluShaderUtil.hpp" |
| 30 | #include "deInt32.h" |
| 31 | |
| 32 | namespace glu |
| 33 | { |
| 34 | |
| 35 | class RenderContext; |
| 36 | class ContextInfo; |
Jarkko Pöyry | 12fea2e | 2015-03-13 12:32:21 -0700 | [diff] [blame] | 37 | class TextureBuffer; |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 38 | |
| 39 | /*--------------------------------------------------------------------*//*! |
| 40 | * \brief GL pixel transfer format. |
| 41 | *//*--------------------------------------------------------------------*/ |
| 42 | struct TransferFormat |
| 43 | { |
| 44 | deUint32 format; //!< Pixel format. |
| 45 | deUint32 dataType; //!< Data type. |
| 46 | |
| 47 | TransferFormat (void) |
| 48 | : format (0) |
| 49 | , dataType (0) |
| 50 | { |
| 51 | } |
| 52 | |
| 53 | TransferFormat (deUint32 format_, deUint32 dataType_) |
| 54 | : format (format_) |
| 55 | , dataType (dataType_) |
| 56 | { |
| 57 | } |
Jarkko Pöyry | 93df375 | 2015-02-24 12:37:32 -0800 | [diff] [blame] | 58 | } DE_WARN_UNUSED_TYPE; |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 59 | |
| 60 | tcu::TextureFormat mapGLTransferFormat (deUint32 format, deUint32 dataType); |
| 61 | tcu::TextureFormat mapGLInternalFormat (deUint32 internalFormat); |
Mika Isojärvi | b0f5bf5 | 2015-01-08 15:42:40 -0800 | [diff] [blame] | 62 | tcu::CompressedTexFormat mapGLCompressedTexFormat (deUint32 format); |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 63 | bool isGLInternalColorFormatFilterable (deUint32 internalFormat); |
| 64 | tcu::Sampler mapGLSampler (deUint32 wrapS, deUint32 minFilter, deUint32 magFilter); |
| 65 | tcu::Sampler mapGLSampler (deUint32 wrapS, deUint32 wrapT, deUint32 minFilter, deUint32 magFilter); |
| 66 | tcu::Sampler mapGLSampler (deUint32 wrapS, deUint32 wrapT, deUint32 wrapR, deUint32 minFilter, deUint32 magFilter); |
| 67 | tcu::Sampler::CompareMode mapGLCompareFunc (deUint32 mode); |
| 68 | |
| 69 | TransferFormat getTransferFormat (tcu::TextureFormat format); |
| 70 | deUint32 getInternalFormat (tcu::TextureFormat format); |
Mika Isojärvi | becd5d5 | 2014-11-04 17:30:50 +0200 | [diff] [blame] | 71 | deUint32 getGLFormat (tcu::CompressedTexFormat format); |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 72 | |
| 73 | deUint32 getGLWrapMode (tcu::Sampler::WrapMode wrapMode); |
| 74 | deUint32 getGLFilterMode (tcu::Sampler::FilterMode filterMode); |
| 75 | deUint32 getGLCompareFunc (tcu::Sampler::CompareMode compareMode); |
| 76 | |
| 77 | deUint32 getGLCubeFace (tcu::CubeFace face); |
Mika Isojärvi | 07b89ce | 2015-01-08 15:20:07 -0800 | [diff] [blame] | 78 | tcu::CubeFace getCubeFaceFromGL (deUint32 face); |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 79 | |
| 80 | DataType getSampler1DType (tcu::TextureFormat format); |
| 81 | DataType getSampler2DType (tcu::TextureFormat format); |
| 82 | DataType getSamplerCubeType (tcu::TextureFormat format); |
Akos Dirner | edf9803 | 2016-06-28 15:12:00 +0200 | [diff] [blame] | 83 | DataType getSampler1DArrayType (tcu::TextureFormat format); |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 84 | DataType getSampler2DArrayType (tcu::TextureFormat format); |
| 85 | DataType getSampler3DType (tcu::TextureFormat format); |
| 86 | DataType getSamplerCubeArrayType (tcu::TextureFormat format); |
| 87 | |
| 88 | bool isSizedFormatColorRenderable (const RenderContext& renderCtx, const ContextInfo& contextInfo, deUint32 sizedFormat); |
Jarkko Pöyry | 238d2ae | 2015-02-23 18:15:05 -0800 | [diff] [blame] | 89 | bool isCompressedFormat (deUint32 internalFormat); |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 90 | |
Jarkko Pöyry | 45b7dbb | 2015-04-23 16:02:39 -0700 | [diff] [blame] | 91 | const tcu::IVec2 (&getDefaultGatherOffsets (void))[4]; |
| 92 | |
Jarkko Pöyry | 12fea2e | 2015-03-13 12:32:21 -0700 | [diff] [blame] | 93 | tcu::PixelBufferAccess getTextureBufferEffectiveRefTexture (TextureBuffer& buffer, int maxTextureBufferSize); |
| 94 | tcu::ConstPixelBufferAccess getTextureBufferEffectiveRefTexture (const TextureBuffer& buffer, int maxTextureBufferSize); |
| 95 | |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 96 | } // glu |
| 97 | |
| 98 | #endif // _GLUTEXTUREUTIL_HPP |