13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _GLUTEXTURE_HPP 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _GLUTEXTURE_HPP 33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*------------------------------------------------------------------------- 43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL ES Utilities 53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ------------------------------------------------ 63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project 83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License"); 103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License. 113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at 123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * http://www.apache.org/licenses/LICENSE-2.0 143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software 163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS, 173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and 193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License. 203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*! 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Texture classes. 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluDefs.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTexture.hpp" 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuCompressedTexture.hpp" 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuResource.hpp" 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluRenderContext.hpp" 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluContextInfo.hpp" 32d6148171f88da1301f053e2e0236afc69416137cJarkko Pöyry#include "deArrayBuffer.hpp" 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <vector> 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <string> 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace glu 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*! 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief 1D Texture only supported on OpenGL 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Texture1D 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture1D (const RenderContext& context, deUint32 format, deUint32 dataType, int width); 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture1D (const RenderContext& context, deUint32 internalFormat, int width); 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~Texture1D (void); 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture1D& getRefTexture (void) { return m_refTexture; } 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Texture1D& getRefTexture (void) const { return m_refTexture; } 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 getGLTexture (void) const { return m_glTexture; } 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void upload (void); 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture1D (const Texture1D& other); // Not allowed! 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture1D& operator= (const Texture1D& other); // Not allowed! 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const RenderContext& m_context; 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_format; //!< Internal format. 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture1D m_refTexture; 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_glTexture; 6493df37596ea66700965094b3aa2830cf4f2ca5aaJarkko Pöyry} DE_WARN_UNUSED_TYPE; 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*! 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief 2D Texture 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Texture2D 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 72becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi Texture2D (const RenderContext& context, const ContextInfo& contextInfo, int numLevels, const tcu::CompressedTexture* levels, const tcu::TexDecompressionParams& decompressionParams = tcu::TexDecompressionParams()); 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture2D (const RenderContext& context, deUint32 format, deUint32 dataType, int width, int height); 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture2D (const RenderContext& context, deUint32 internalFormat, int width, int height); 7548087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulos virtual ~Texture2D (void); 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7748087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulos virtual void upload (void); // Not supported on compressed textures. 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture2D& getRefTexture (void) { return m_refTexture; } 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Texture2D& getRefTexture (void) const { return m_refTexture; } 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 getGLTexture (void) const { return m_glTexture; } 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static Texture2D* create (const RenderContext& context, const ContextInfo& contextInfo, const tcu::Archive& archive, int numLevels, const std::vector<std::string>& filenames); 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static Texture2D* create (const RenderContext& context, const ContextInfo& contextInfo, const tcu::Archive& archive, int numLevels, const char* const* filenames); 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static Texture2D* create (const RenderContext& context, const ContextInfo& contextInfo, const tcu::Archive& archive, const char* filename) { return create(context, contextInfo, archive, 1, &filename); } 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8748087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulosprotected: 8848087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulos const RenderContext& m_context; 8948087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulos 9048087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulos bool m_isCompressed; 9148087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulos deUint32 m_format; //!< Internal format. 9248087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulos tcu::Texture2D m_refTexture; 9348087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulos 9448087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulos deUint32 m_glTexture; 9548087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulos 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture2D (const Texture2D& other); // Not allowed! 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture2D& operator= (const Texture2D& other); // Not allowed! 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 100becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi void loadCompressed (int numLevels, const tcu::CompressedTexture* levels, const tcu::TexDecompressionParams& decompressionParams); 10148087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulos} DE_WARN_UNUSED_TYPE; 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10348087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulosclass ImmutableTexture2D : public Texture2D 10448087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulos{ 10548087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulospublic: 10648087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulos ImmutableTexture2D (const RenderContext& context, deUint32 internalFormat, int width, int height); 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10848087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulos void upload (void); // Not supported on compressed textures. 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11048087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulosprivate: 11148087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulos ImmutableTexture2D (const ImmutableTexture2D& other); // Not allowed! 11248087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulos ImmutableTexture2D& operator= (const ImmutableTexture2D& other); // Not allowed! 11348087f5f0eb08759ee763f98daf3b34becb74559Pyry Haulos}; 1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*! 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Cube Map Texture 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TextureCube 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // For compressed cubemap constructor and create() function input level pointers / filenames are expected 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // to laid out to array in following order: 1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // { l0_neg_x, l0_pos_x, l0_neg_y, l0_pos_y, l0_neg_z, l0_pos_z, l1_neg_x, l1_pos_x, ... } 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 125becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi TextureCube (const RenderContext& context, const ContextInfo& contextInfo, int numLevels, const tcu::CompressedTexture* levels, const tcu::TexDecompressionParams& decompressionParams = tcu::TexDecompressionParams()); 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureCube (const RenderContext& context, deUint32 format, deUint32 dataType, int size); 1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureCube (const RenderContext& context, deUint32 internalFormat, int size); 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~TextureCube (void); 1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void upload (void); // Not supported on compressed textures. 1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TextureCube& getRefTexture (void) { return m_refTexture; } 1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::TextureCube& getRefTexture (void) const { return m_refTexture; } 1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 getGLTexture (void) const { return m_glTexture; } 1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static TextureCube* create (const RenderContext& context, const ContextInfo& contextInfo, const tcu::Archive& archive, int numLevels, const std::vector<std::string>& filenames); 1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static TextureCube* create (const RenderContext& context, const ContextInfo& contextInfo, const tcu::Archive& archive, int numLevels, const char* const* filenames); 1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureCube (const TextureCube& other); // Not allowed! 1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureCube& operator= (const TextureCube& other); // Not allowed! 1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 143becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi void loadCompressed (int numLevels, const tcu::CompressedTexture* levels, const tcu::TexDecompressionParams& decompressionParams); 1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const RenderContext& m_context; 1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool m_isCompressed; 1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_format; //!< Internal format. 1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TextureCube m_refTexture; 1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_glTexture; 15293df37596ea66700965094b3aa2830cf4f2ca5aaJarkko Pöyry} DE_WARN_UNUSED_TYPE; 1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*! 1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief 2D Array Texture 1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \note Not supported on OpenGL ES 2 1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Texture2DArray 1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture2DArray (const RenderContext& context, deUint32 format, deUint32 dataType, int width, int height, int numLayers); 1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture2DArray (const RenderContext& context, deUint32 internalFormat, int width, int height, int numLayers); 163becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi Texture2DArray (const RenderContext& context, const ContextInfo& contextInfo, int numLevels, const tcu::CompressedTexture* levels, const tcu::TexDecompressionParams& decompressionParams = tcu::TexDecompressionParams()); 1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~Texture2DArray (void); 1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void upload (void); 1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture2DArray& getRefTexture (void) { return m_refTexture; } 1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Texture2DArray& getRefTexture (void) const { return m_refTexture; } 1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 getGLTexture (void) const { return m_glTexture; } 1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture2DArray (const Texture2DArray& other); // Not allowed! 1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture2DArray& operator= (const Texture2DArray& other); // Not allowed! 1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 176becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi void loadCompressed (int numLevels, const tcu::CompressedTexture* levels, const tcu::TexDecompressionParams& decompressionParams); 177becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi 178becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi 1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const RenderContext& m_context; 1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 181becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi bool m_isCompressed; 1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_format; //!< Internal format. 1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture2DArray m_refTexture; 1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_glTexture; 18693df37596ea66700965094b3aa2830cf4f2ca5aaJarkko Pöyry} DE_WARN_UNUSED_TYPE; 1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*! 1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief 1D Array Texture 1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \note Only supported on OpenGL 1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Texture1DArray 1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture1DArray (const RenderContext& context, deUint32 format, deUint32 dataType, int width, int numLayers); 1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture1DArray (const RenderContext& context, deUint32 internalFormat, int width, int numLayers); 1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~Texture1DArray (void); 1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void upload (void); 2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture1DArray& getRefTexture (void) { return m_refTexture; } 2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Texture1DArray& getRefTexture (void) const { return m_refTexture; } 2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 getGLTexture (void) const { return m_glTexture; } 2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture1DArray (const Texture1DArray& other); // Not allowed! 2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture1DArray& operator= (const Texture1DArray& other); // Not allowed! 2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const RenderContext& m_context; 2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_format; //!< Internal format. 2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture1DArray m_refTexture; 2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_glTexture; 21593df37596ea66700965094b3aa2830cf4f2ca5aaJarkko Pöyry} DE_WARN_UNUSED_TYPE; 2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*! 2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief 3D Texture 2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \note Not supported on OpenGL ES 2 2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Texture3D 2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture3D (const RenderContext& context, deUint32 format, deUint32 dataType, int width, int height, int depth); 2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture3D (const RenderContext& context, deUint32 internalFormat, int width, int height, int depth); 2267785313bbe673ac62d24612fdb72be3248772f29Jarkko Pöyry Texture3D (const RenderContext& context, const ContextInfo& contextInfo, int numLevels, const tcu::CompressedTexture* levels, const tcu::TexDecompressionParams& decompressionParams = tcu::TexDecompressionParams()); 2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~Texture3D (void); 2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void upload (void); 2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture3D& getRefTexture (void) { return m_refTexture; } 2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Texture3D& getRefTexture (void) const { return m_refTexture; } 2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 getGLTexture (void) const { return m_glTexture; } 2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture3D (const Texture3D& other); // Not allowed! 2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture3D& operator= (const Texture3D& other); // Not allowed! 2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2397785313bbe673ac62d24612fdb72be3248772f29Jarkko Pöyry void loadCompressed (int numLevels, const tcu::CompressedTexture* levels, const tcu::TexDecompressionParams& decompressionParams); 2407785313bbe673ac62d24612fdb72be3248772f29Jarkko Pöyry 2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const RenderContext& m_context; 2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2437785313bbe673ac62d24612fdb72be3248772f29Jarkko Pöyry bool m_isCompressed; 2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_format; //!< Internal format. 2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture3D m_refTexture; 2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_glTexture; 24893df37596ea66700965094b3aa2830cf4f2ca5aaJarkko Pöyry} DE_WARN_UNUSED_TYPE; 2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*! 2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Cube Map Array Texture 2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \note Not supported on OpenGL ES 3.0 or lower 2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TextureCubeArray 2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureCubeArray (const RenderContext& context, deUint32 format, deUint32 dataType, int size, int numLayers); 2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureCubeArray (const RenderContext& context, deUint32 internalFormat, int size, int numLayers); 259becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi 2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~TextureCubeArray (void); 2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void upload (void); 2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TextureCubeArray& getRefTexture (void) { return m_refTexture; } 2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::TextureCubeArray& getRefTexture (void) const { return m_refTexture; } 2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 getGLTexture (void) const { return m_glTexture; } 2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureCubeArray (const TextureCubeArray& other); // Not allowed! 2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureCubeArray& operator= (const TextureCubeArray& other); // Not allowed! 2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const RenderContext& m_context; 2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 274becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi bool m_isCompressed; 2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_format; //!< Internal format. 2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TextureCubeArray m_refTexture; 2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_glTexture; 27993df37596ea66700965094b3aa2830cf4f2ca5aaJarkko Pöyry} DE_WARN_UNUSED_TYPE; 2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*! 2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief 1D Texture Buffer only supported on OpenGL 2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TextureBuffer 2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureBuffer (const RenderContext& context, deUint32 internalFormat, size_t bufferSize); 2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureBuffer (const RenderContext& context, deUint32 internalFormat, size_t bufferSize, size_t offset, size_t size, const void* data = DE_NULL); 2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~TextureBuffer (void); 2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 29212fea2ef01511716e0387c3e3dd8c4ba6ade0cc2Jarkko Pöyry // \note Effective pixel buffer access must be limited to w <= GL_MAX_TEXTURE_BUFFER_SIZE 29312fea2ef01511716e0387c3e3dd8c4ba6ade0cc2Jarkko Pöyry const tcu::PixelBufferAccess getFullRefTexture (void); 29412fea2ef01511716e0387c3e3dd8c4ba6ade0cc2Jarkko Pöyry const tcu::ConstPixelBufferAccess getFullRefTexture (void) const; 2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 29612fea2ef01511716e0387c3e3dd8c4ba6ade0cc2Jarkko Pöyry // \note mutating buffer storage will invalidate existing pixel buffer accesses 29712fea2ef01511716e0387c3e3dd8c4ba6ade0cc2Jarkko Pöyry de::ArrayBuffer<deUint8>& getRefBuffer (void) { return m_refBuffer; } 29812fea2ef01511716e0387c3e3dd8c4ba6ade0cc2Jarkko Pöyry const de::ArrayBuffer<deUint8>& getRefBuffer (void) const { return m_refBuffer; } 2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry size_t getSize (void) const { return m_size; } 3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry size_t getOffset (void) const { return m_offset; } 3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry size_t getBufferSize (void) const { return m_refBuffer.size(); } 3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 getGLTexture (void) const { return m_glTexture; } 3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 getGLBuffer (void) const { return m_glBuffer; } 3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void upload (void); 3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 31012fea2ef01511716e0387c3e3dd8c4ba6ade0cc2Jarkko Pöyry void init (deUint32 internalFormat, size_t bufferSize, size_t offset, size_t size, const void* data); 31112fea2ef01511716e0387c3e3dd8c4ba6ade0cc2Jarkko Pöyry TextureBuffer (const TextureBuffer& other); // Not allowed! 31212fea2ef01511716e0387c3e3dd8c4ba6ade0cc2Jarkko Pöyry TextureBuffer& operator= (const TextureBuffer& other); // Not allowed! 31312fea2ef01511716e0387c3e3dd8c4ba6ade0cc2Jarkko Pöyry 31412fea2ef01511716e0387c3e3dd8c4ba6ade0cc2Jarkko Pöyry const RenderContext& m_context; 31512fea2ef01511716e0387c3e3dd8c4ba6ade0cc2Jarkko Pöyry deUint32 m_format; //!< Internal format. 31612fea2ef01511716e0387c3e3dd8c4ba6ade0cc2Jarkko Pöyry de::ArrayBuffer<deUint8> m_refBuffer; 31712fea2ef01511716e0387c3e3dd8c4ba6ade0cc2Jarkko Pöyry size_t m_offset; 31812fea2ef01511716e0387c3e3dd8c4ba6ade0cc2Jarkko Pöyry size_t m_size; 31912fea2ef01511716e0387c3e3dd8c4ba6ade0cc2Jarkko Pöyry 32012fea2ef01511716e0387c3e3dd8c4ba6ade0cc2Jarkko Pöyry deUint32 m_glTexture; 32112fea2ef01511716e0387c3e3dd8c4ba6ade0cc2Jarkko Pöyry deUint32 m_glBuffer; 32293df37596ea66700965094b3aa2830cf4f2ca5aaJarkko Pöyry} DE_WARN_UNUSED_TYPE; 3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // glu 3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif // _GLUTEXTURE_HPP 327