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" 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <vector> 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <string> 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace glu 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*! 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief 1D Texture only supported on OpenGL 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Texture1D 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture1D (const RenderContext& context, deUint32 format, deUint32 dataType, int width); 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture1D (const RenderContext& context, deUint32 internalFormat, int width); 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~Texture1D (void); 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture1D& getRefTexture (void) { return m_refTexture; } 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Texture1D& getRefTexture (void) const { return m_refTexture; } 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 getGLTexture (void) const { return m_glTexture; } 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void upload (void); 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture1D (const Texture1D& other); // Not allowed! 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture1D& operator= (const Texture1D& other); // Not allowed! 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const RenderContext& m_context; 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_format; //!< Internal format. 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture1D m_refTexture; 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_glTexture; 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*! 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief 2D Texture 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Texture2D 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture2D (const RenderContext& context, const ContextInfo& contextInfo, int numLevels, const tcu::CompressedTexture* levels, const tcu::CompressedTexture::DecompressionParams& = tcu::CompressedTexture::DecompressionParams(false)); 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture2D (const RenderContext& context, deUint32 format, deUint32 dataType, int width, int height); 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture2D (const RenderContext& context, deUint32 internalFormat, int width, int height); 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~Texture2D (void); 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void upload (void); // Not supported on compressed textures. 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture2D& getRefTexture (void) { return m_refTexture; } 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Texture2D& getRefTexture (void) const { return m_refTexture; } 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 getGLTexture (void) const { return m_glTexture; } 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static Texture2D* create (const RenderContext& context, const ContextInfo& contextInfo, const tcu::Archive& archive, int numLevels, const std::vector<std::string>& filenames); 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static Texture2D* create (const RenderContext& context, const ContextInfo& contextInfo, const tcu::Archive& archive, int numLevels, const char* const* filenames); 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static Texture2D* create (const RenderContext& context, const ContextInfo& contextInfo, const tcu::Archive& archive, const char* filename) { return create(context, contextInfo, archive, 1, &filename); } 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture2D (const Texture2D& other); // Not allowed! 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture2D& operator= (const Texture2D& other); // Not allowed! 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void loadCompressed (int numLevels, const tcu::CompressedTexture* levels, const tcu::CompressedTexture::DecompressionParams&); 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const RenderContext& m_context; 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool m_isCompressed; 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_format; //!< Internal format. 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture2D m_refTexture; 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_glTexture; 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*! 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Cube Map Texture 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TextureCube 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // For compressed cubemap constructor and create() function input level pointers / filenames are expected 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // to laid out to array in following order: 1093c827367444ee418f129b2c238299f49d3264554Jarkko 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, ... } 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureCube (const RenderContext& context, const ContextInfo& contextInfo, int numLevels, const tcu::CompressedTexture* levels, const tcu::CompressedTexture::DecompressionParams& = tcu::CompressedTexture::DecompressionParams(false)); 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureCube (const RenderContext& context, deUint32 format, deUint32 dataType, int size); 1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureCube (const RenderContext& context, deUint32 internalFormat, int size); 1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~TextureCube (void); 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void upload (void); // Not supported on compressed textures. 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TextureCube& getRefTexture (void) { return m_refTexture; } 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::TextureCube& getRefTexture (void) const { return m_refTexture; } 1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 getGLTexture (void) const { return m_glTexture; } 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static TextureCube* create (const RenderContext& context, const ContextInfo& contextInfo, const tcu::Archive& archive, int numLevels, const std::vector<std::string>& filenames); 1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static TextureCube* create (const RenderContext& context, const ContextInfo& contextInfo, const tcu::Archive& archive, int numLevels, const char* const* filenames); 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureCube (const TextureCube& other); // Not allowed! 1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureCube& operator= (const TextureCube& other); // Not allowed! 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void loadCompressed (int numLevels, const tcu::CompressedTexture* levels, const tcu::CompressedTexture::DecompressionParams&); 1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const RenderContext& m_context; 1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool m_isCompressed; 1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_format; //!< Internal format. 1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TextureCube m_refTexture; 1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_glTexture; 1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*! 1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief 2D Array Texture 1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \note Not supported on OpenGL ES 2 1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Texture2DArray 1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture2DArray (const RenderContext& context, deUint32 format, deUint32 dataType, int width, int height, int numLayers); 1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture2DArray (const RenderContext& context, deUint32 internalFormat, int width, int height, int numLayers); 1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~Texture2DArray (void); 1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void upload (void); 1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture2DArray& getRefTexture (void) { return m_refTexture; } 1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Texture2DArray& getRefTexture (void) const { return m_refTexture; } 1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 getGLTexture (void) const { return m_glTexture; } 1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture2DArray (const Texture2DArray& other); // Not allowed! 1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture2DArray& operator= (const Texture2DArray& other); // Not allowed! 1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const RenderContext& m_context; 1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_format; //!< Internal format. 1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture2DArray m_refTexture; 1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_glTexture; 1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*! 1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief 1D Array Texture 1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \note Only supported on OpenGL 1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Texture1DArray 1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture1DArray (const RenderContext& context, deUint32 format, deUint32 dataType, int width, int numLayers); 1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture1DArray (const RenderContext& context, deUint32 internalFormat, int width, int numLayers); 1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~Texture1DArray (void); 1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void upload (void); 1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture1DArray& getRefTexture (void) { return m_refTexture; } 1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Texture1DArray& getRefTexture (void) const { return m_refTexture; } 1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 getGLTexture (void) const { return m_glTexture; } 1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture1DArray (const Texture1DArray& other); // Not allowed! 1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture1DArray& operator= (const Texture1DArray& other); // Not allowed! 1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const RenderContext& m_context; 1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_format; //!< Internal format. 1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture1DArray m_refTexture; 1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_glTexture; 1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*! 1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief 3D Texture 2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \note Not supported on OpenGL ES 2 2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Texture3D 2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture3D (const RenderContext& context, deUint32 format, deUint32 dataType, int width, int height, int depth); 2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture3D (const RenderContext& context, deUint32 internalFormat, int width, int height, int depth); 2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~Texture3D (void); 2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void upload (void); 2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture3D& getRefTexture (void) { return m_refTexture; } 2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::Texture3D& getRefTexture (void) const { return m_refTexture; } 2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 getGLTexture (void) const { return m_glTexture; } 2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture3D (const Texture3D& other); // Not allowed! 2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Texture3D& operator= (const Texture3D& other); // Not allowed! 2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const RenderContext& m_context; 2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_format; //!< Internal format. 2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::Texture3D m_refTexture; 2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_glTexture; 2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*! 2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Cube Map Array Texture 2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \note Not supported on OpenGL ES 3.0 or lower 2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TextureCubeArray 2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureCubeArray (const RenderContext& context, deUint32 format, deUint32 dataType, int size, int numLayers); 2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureCubeArray (const RenderContext& context, deUint32 internalFormat, int size, int numLayers); 2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~TextureCubeArray (void); 2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void upload (void); 2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TextureCubeArray& getRefTexture (void) { return m_refTexture; } 2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::TextureCubeArray& getRefTexture (void) const { return m_refTexture; } 2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 getGLTexture (void) const { return m_glTexture; } 2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureCubeArray (const TextureCubeArray& other); // Not allowed! 2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureCubeArray& operator= (const TextureCubeArray& other); // Not allowed! 2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const RenderContext& m_context; 2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_format; //!< Internal format. 2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TextureCubeArray m_refTexture; 2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_glTexture; 2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*! 2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief 1D Texture Buffer only supported on OpenGL 2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TextureBuffer 2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureBuffer (const RenderContext& context, deUint32 internalFormat, size_t bufferSize); 2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureBuffer (const RenderContext& context, deUint32 internalFormat, size_t bufferSize, size_t offset, size_t size, const void* data = DE_NULL); 2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~TextureBuffer (void); 2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::PixelBufferAccess& getRefTexture (void) { return m_refTexture; } 2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::ConstPixelBufferAccess& getRefTexture (void) const { return m_refTexture; } 2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint8* getRefBuffer (void) { return &(m_refBuffer[0]); } 2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const deUint8* getRefBuffer (void) const { return &(m_refBuffer[0]); } 2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry size_t getSize (void) const { return m_size; } 2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry size_t getOffset (void) const { return m_offset; } 2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry size_t getBufferSize (void) const { return m_refBuffer.size(); } 2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 getGLTexture (void) const { return m_glTexture; } 2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 getGLBuffer (void) const { return m_glBuffer; } 2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // \note Resizes reference buffer. Invalidates old pixel buffer acceses. 2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // \note Doesn't upload data. 2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void bufferData (const deUint8* data, size_t size); 2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void upload (void); 2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (deUint32 internalFormat, size_t bufferSize, size_t offset, size_t size, const void* data); 2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureBuffer (const TextureBuffer& other); // Not allowed! 2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureBuffer& operator= (const TextureBuffer& other); // Not allowed! 2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const RenderContext& m_context; 2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_format; //!< Internal format. 2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<deUint8> m_refBuffer; 2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry size_t m_offset; 2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry size_t m_size; 2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::PixelBufferAccess m_refTexture; 2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_glTexture; 2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 m_glBuffer; 2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // glu 3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif // _GLUTEXTURE_HPP 304