xref: /aosp_15_r20/external/deqp/framework/opengl/gluTextureUtil.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
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;
37 class TextureBuffer;
38 
39 /*--------------------------------------------------------------------*//*!
40  * \brief GL pixel transfer format.
41  *//*--------------------------------------------------------------------*/
42 struct TransferFormat
43 {
44     uint32_t format;   //!< Pixel format.
45     uint32_t dataType; //!< Data type.
46 
TransferFormatglu::TransferFormat47     TransferFormat(void) : format(0), dataType(0)
48     {
49     }
50 
TransferFormatglu::TransferFormat51     TransferFormat(uint32_t format_, uint32_t dataType_) : format(format_), dataType(dataType_)
52     {
53     }
54 } DE_WARN_UNUSED_TYPE;
55 
56 tcu::TextureFormat mapGLTransferFormat(uint32_t format, uint32_t dataType);
57 tcu::TextureFormat mapGLInternalFormat(uint32_t internalFormat);
58 tcu::CompressedTexFormat mapGLCompressedTexFormat(uint32_t format);
59 bool isGLInternalColorFormatFilterable(uint32_t internalFormat);
60 tcu::Sampler mapGLSampler(uint32_t wrapS, uint32_t minFilter, uint32_t magFilter);
61 tcu::Sampler mapGLSampler(uint32_t wrapS, uint32_t wrapT, uint32_t minFilter, uint32_t magFilter);
62 tcu::Sampler mapGLSampler(uint32_t wrapS, uint32_t wrapT, uint32_t wrapR, uint32_t minFilter, uint32_t magFilter);
63 tcu::Sampler::CompareMode mapGLCompareFunc(uint32_t mode);
64 
65 TransferFormat getTransferFormat(tcu::TextureFormat format);
66 uint32_t getInternalFormat(tcu::TextureFormat format);
67 uint32_t getGLFormat(tcu::CompressedTexFormat format);
68 
69 uint32_t getGLWrapMode(tcu::Sampler::WrapMode wrapMode);
70 uint32_t getGLFilterMode(tcu::Sampler::FilterMode filterMode);
71 uint32_t getGLCompareFunc(tcu::Sampler::CompareMode compareMode);
72 
73 uint32_t getGLCubeFace(tcu::CubeFace face);
74 tcu::CubeFace getCubeFaceFromGL(uint32_t face);
75 
76 DataType getSampler1DType(tcu::TextureFormat format);
77 DataType getSampler2DType(tcu::TextureFormat format);
78 DataType getSamplerCubeType(tcu::TextureFormat format);
79 DataType getSampler1DArrayType(tcu::TextureFormat format);
80 DataType getSampler2DArrayType(tcu::TextureFormat format);
81 DataType getSampler3DType(tcu::TextureFormat format);
82 DataType getSamplerCubeArrayType(tcu::TextureFormat format);
83 
84 bool isSizedFormatColorRenderable(const RenderContext &renderCtx, const ContextInfo &contextInfo, uint32_t sizedFormat);
85 bool isCompressedFormat(uint32_t internalFormat);
86 
87 const tcu::IVec2 (&getDefaultGatherOffsets(void))[4];
88 
89 tcu::PixelBufferAccess getTextureBufferEffectiveRefTexture(TextureBuffer &buffer, int maxTextureBufferSize);
90 tcu::ConstPixelBufferAccess getTextureBufferEffectiveRefTexture(const TextureBuffer &buffer, int maxTextureBufferSize);
91 
92 } // namespace glu
93 
94 #endif // _GLUTEXTUREUTIL_HPP
95