tcuTexture.hpp revision 6d31105cb879614b2cf87193ea90215efd13bcce
1#ifndef _TCUTEXTURE_HPP 2#define _TCUTEXTURE_HPP 3/*------------------------------------------------------------------------- 4 * drawElements Quality Program Tester Core 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 Reference Texture Implementation. 24 *//*--------------------------------------------------------------------*/ 25 26#include "tcuDefs.hpp" 27#include "tcuVector.hpp" 28#include "deArrayBuffer.hpp" 29 30#include <vector> 31#include <ostream> 32 33namespace tcu 34{ 35 36/*--------------------------------------------------------------------*//*! 37 * \brief Texture format 38 *//*--------------------------------------------------------------------*/ 39class TextureFormat 40{ 41public: 42 enum ChannelOrder 43 { 44 R = 0, 45 A, 46 I, 47 L, 48 LA, 49 RG, 50 RA, 51 RGB, 52 RGBA, 53 ARGB, 54 BGRA, 55 56 sRGB, 57 sRGBA, 58 59 D, 60 S, 61 DS, 62 63 CHANNELORDER_LAST 64 }; 65 66 enum ChannelType 67 { 68 SNORM_INT8 = 0, 69 SNORM_INT16, 70 SNORM_INT32, 71 UNORM_INT8, 72 UNORM_INT16, 73 UNORM_INT32, 74 UNORM_SHORT_565, 75 UNORM_SHORT_555, 76 UNORM_SHORT_4444, 77 UNORM_SHORT_5551, 78 UNORM_INT_101010, 79 UNORM_INT_1010102_REV, 80 UNSIGNED_INT_1010102_REV, 81 UNSIGNED_INT_11F_11F_10F_REV, 82 UNSIGNED_INT_999_E5_REV, 83 UNSIGNED_INT_24_8, 84 SIGNED_INT8, 85 SIGNED_INT16, 86 SIGNED_INT32, 87 UNSIGNED_INT8, 88 UNSIGNED_INT16, 89 UNSIGNED_INT32, 90 HALF_FLOAT, 91 FLOAT, 92 FLOAT_UNSIGNED_INT_24_8_REV, 93 94 CHANNELTYPE_LAST 95 }; 96 97 ChannelOrder order; 98 ChannelType type; 99 100 TextureFormat (ChannelOrder order_, ChannelType type_) 101 : order (order_) 102 , type (type_) 103 { 104 } 105 106 TextureFormat (void) 107 : order (CHANNELORDER_LAST) 108 , type (CHANNELTYPE_LAST) 109 { 110 } 111 112 int getPixelSize (void) const; 113 114 bool operator== (const TextureFormat& other) const { return !(*this != other); } 115 bool operator!= (const TextureFormat& other) const 116 { 117 return (order != other.order || type != other.type); 118 } 119} DE_WARN_UNUSED_TYPE; 120 121/*--------------------------------------------------------------------*//*! 122 * \brief Texture swizzle 123 *//*--------------------------------------------------------------------*/ 124struct TextureSwizzle 125{ 126 enum Channel 127 { 128 // \note CHANNEL_N must equal int N 129 CHANNEL_0 = 0, 130 CHANNEL_1, 131 CHANNEL_2, 132 CHANNEL_3, 133 134 CHANNEL_ZERO, 135 CHANNEL_ONE, 136 137 CHANNEL_LAST 138 }; 139 140 Channel components[4]; 141}; 142 143//! get the swizzle used to expand texture data with a given channel order to RGBA form 144const TextureSwizzle& getChannelReadSwizzle (TextureFormat::ChannelOrder order); 145 146//! get the swizzle used to narrow RGBA form data to native texture data with a given channel order 147const TextureSwizzle& getChannelWriteSwizzle (TextureFormat::ChannelOrder order); 148 149/*--------------------------------------------------------------------*//*! 150 * \brief Sampling parameters 151 *//*--------------------------------------------------------------------*/ 152class Sampler 153{ 154public: 155 enum WrapMode 156 { 157 CLAMP_TO_EDGE = 0, //! Clamp to edge 158 CLAMP_TO_BORDER, //! Use border color at edge 159 REPEAT_GL, //! Repeat with OpenGL semantics 160 REPEAT_CL, //! Repeat with OpenCL semantics 161 MIRRORED_REPEAT_GL, //! Mirrored repeat with OpenGL semantics 162 MIRRORED_REPEAT_CL, //! Mirrored repeat with OpenCL semantics 163 164 WRAPMODE_LAST 165 }; 166 167 enum FilterMode 168 { 169 NEAREST = 0, 170 LINEAR, 171 172 NEAREST_MIPMAP_NEAREST, 173 NEAREST_MIPMAP_LINEAR, 174 LINEAR_MIPMAP_NEAREST, 175 LINEAR_MIPMAP_LINEAR, 176 177 FILTERMODE_LAST 178 }; 179 180 enum CompareMode 181 { 182 COMPAREMODE_NONE = 0, 183 COMPAREMODE_LESS, 184 COMPAREMODE_LESS_OR_EQUAL, 185 COMPAREMODE_GREATER, 186 COMPAREMODE_GREATER_OR_EQUAL, 187 COMPAREMODE_EQUAL, 188 COMPAREMODE_NOT_EQUAL, 189 COMPAREMODE_ALWAYS, 190 COMPAREMODE_NEVER, 191 192 COMPAREMODE_LAST 193 }; 194 195 // Wrap control 196 WrapMode wrapS; 197 WrapMode wrapT; 198 WrapMode wrapR; 199 200 // Minifcation & magnification 201 FilterMode minFilter; 202 FilterMode magFilter; 203 float lodThreshold; // lod <= lodThreshold ? magnified : minified 204 205 // Coordinate normalization 206 bool normalizedCoords; 207 208 // Shadow comparison 209 CompareMode compare; 210 int compareChannel; 211 212 // Border color 213 Vec4 borderColor; 214 215 // Seamless cube map filtering 216 bool seamlessCubeMap; 217 218 Sampler (WrapMode wrapS_, 219 WrapMode wrapT_, 220 WrapMode wrapR_, 221 FilterMode minFilter_, 222 FilterMode magFilter_, 223 float lodThreshold_ = 0.0f, 224 bool normalizedCoords_ = true, 225 CompareMode compare_ = COMPAREMODE_NONE, 226 int compareChannel_ = 0, 227 const Vec4& borderColor_ = Vec4(0.0f, 0.0f, 0.0f, 0.0f), 228 bool seamlessCubeMap_ = false) 229 : wrapS (wrapS_) 230 , wrapT (wrapT_) 231 , wrapR (wrapR_) 232 , minFilter (minFilter_) 233 , magFilter (magFilter_) 234 , lodThreshold (lodThreshold_) 235 , normalizedCoords (normalizedCoords_) 236 , compare (compare_) 237 , compareChannel (compareChannel_) 238 , borderColor (borderColor_) 239 , seamlessCubeMap (seamlessCubeMap_) 240 { 241 } 242 243 Sampler (void) 244 : wrapS (WRAPMODE_LAST) 245 , wrapT (WRAPMODE_LAST) 246 , wrapR (WRAPMODE_LAST) 247 , minFilter (FILTERMODE_LAST) 248 , magFilter (FILTERMODE_LAST) 249 , lodThreshold (0.0f) 250 , normalizedCoords (true) 251 , compare (COMPAREMODE_NONE) 252 , compareChannel (0) 253 , borderColor (0.0f, 0.0f, 0.0f, 0.0f) 254 , seamlessCubeMap (false) 255 { 256 } 257} DE_WARN_UNUSED_TYPE; 258 259// Calculate pitches for pixel data with no padding. 260IVec3 calculatePackedPitch (const TextureFormat& format, const IVec3& size); 261 262class TextureLevel; 263 264/*--------------------------------------------------------------------*//*! 265 * \brief Read-only pixel data access 266 * 267 * ConstPixelBufferAccess encapsulates pixel data pointer along with 268 * format and layout information. It can be used for read-only access 269 * to arbitrary pixel buffers. 270 * 271 * Access objects are like iterators or pointers. They can be passed around 272 * as values and are valid as long as the storage doesn't change. 273 *//*--------------------------------------------------------------------*/ 274class ConstPixelBufferAccess 275{ 276public: 277 ConstPixelBufferAccess (void); 278 ConstPixelBufferAccess (const TextureLevel& level); 279 ConstPixelBufferAccess (const TextureFormat& format, int width, int height, int depth, const void* data); 280 ConstPixelBufferAccess (const TextureFormat& format, const IVec3& size, const void* data); 281 ConstPixelBufferAccess (const TextureFormat& format, int width, int height, int depth, int rowPitch, int slicePitch, const void* data); 282 ConstPixelBufferAccess (const TextureFormat& format, const IVec3& size, const IVec3& pitch, const void* data); 283 284 const TextureFormat& getFormat (void) const { return m_format; } 285 const IVec3& getSize (void) const { return m_size; } 286 int getWidth (void) const { return m_size.x(); } 287 int getHeight (void) const { return m_size.y(); } 288 int getDepth (void) const { return m_size.z(); } 289 int getRowPitch (void) const { return m_pitch.y(); } 290 int getSlicePitch (void) const { return m_pitch.z(); } 291 292 const void* getDataPtr (void) const { return m_data; } 293 int getDataSize (void) const { return m_size.z()*m_pitch.z(); } 294 295 Vec4 getPixel (int x, int y, int z = 0) const; 296 IVec4 getPixelInt (int x, int y, int z = 0) const; 297 UVec4 getPixelUint (int x, int y, int z = 0) const { return getPixelInt(x, y, z).cast<deUint32>(); } 298 299 template<typename T> 300 Vector<T, 4> getPixelT (int x, int y, int z = 0) const; 301 302 float getPixDepth (int x, int y, int z = 0) const; 303 int getPixStencil (int x, int y, int z = 0) const; 304 305 Vec4 sample1D (const Sampler& sampler, Sampler::FilterMode filter, float s, int level) const; 306 Vec4 sample2D (const Sampler& sampler, Sampler::FilterMode filter, float s, float t, int depth) const; 307 Vec4 sample3D (const Sampler& sampler, Sampler::FilterMode filter, float s, float t, float r) const; 308 309 Vec4 sample1DOffset (const Sampler& sampler, Sampler::FilterMode filter, float s, const IVec2& offset) const; 310 Vec4 sample2DOffset (const Sampler& sampler, Sampler::FilterMode filter, float s, float t, const IVec3& offset) const; 311 Vec4 sample3DOffset (const Sampler& sampler, Sampler::FilterMode filter, float s, float t, float r, const IVec3& offset) const; 312 313 float sample1DCompare (const Sampler& sampler, Sampler::FilterMode filter, float ref, float s, const IVec2& offset) const; 314 float sample2DCompare (const Sampler& sampler, Sampler::FilterMode filter, float ref, float s, float t, const IVec3& offset) const; 315 316protected: 317 TextureFormat m_format; 318 IVec3 m_size; 319 IVec3 m_pitch; //!< (pixelPitch, rowPitch, slicePitch) 320 mutable void* m_data; 321} DE_WARN_UNUSED_TYPE; 322 323/*--------------------------------------------------------------------*//*! 324 * \brief Read-write pixel data access 325 * 326 * This class extends read-only access object by providing write functionality. 327 * 328 * \note PixelBufferAccess may not have any data members nor add any 329 * virtual functions. It must be possible to reinterpret_cast<> 330 * PixelBufferAccess to ConstPixelBufferAccess. 331 *//*--------------------------------------------------------------------*/ 332class PixelBufferAccess : public ConstPixelBufferAccess 333{ 334public: 335 PixelBufferAccess (void) {} 336 PixelBufferAccess (TextureLevel& level); 337 PixelBufferAccess (const TextureFormat& format, int width, int height, int depth, void* data); 338 PixelBufferAccess (const TextureFormat& format, const IVec3& size, void* data); 339 PixelBufferAccess (const TextureFormat& format, int width, int height, int depth, int rowPitch, int slicePitch, void* data); 340 PixelBufferAccess (const TextureFormat& format, const IVec3& size, const IVec3& pitch, void* data); 341 342 void* getDataPtr (void) const { return m_data; } 343 344 void setPixels (const void* buf, int bufSize) const; 345 void setPixel (const tcu::Vec4& color, int x, int y, int z = 0) const; 346 void setPixel (const tcu::IVec4& color, int x, int y, int z = 0) const; 347 void setPixel (const tcu::UVec4& color, int x, int y, int z = 0) const { setPixel(color.cast<int>(), x, y, z); } 348 349 void setPixDepth (float depth, int x, int y, int z = 0) const; 350 void setPixStencil (int stencil, int x, int y, int z = 0) const; 351} DE_WARN_UNUSED_TYPE; 352 353/*--------------------------------------------------------------------*//*! 354 * \brief Generic pixel data container 355 * 356 * This container supports all valid TextureFormat combinations and 357 * both 2D and 3D textures. To read or manipulate data access object must 358 * be queried using getAccess(). 359 *//*--------------------------------------------------------------------*/ 360class TextureLevel 361{ 362public: 363 TextureLevel (void); 364 TextureLevel (const TextureFormat& format); 365 TextureLevel (const TextureFormat& format, int width, int height, int depth = 1); 366 ~TextureLevel (void); 367 368 const IVec3& getSize (void) const { return m_size; } 369 int getWidth (void) const { return m_size.x(); } 370 int getHeight (void) const { return m_size.y(); } 371 int getDepth (void) const { return m_size.z(); } 372 bool isEmpty (void) const { return m_size.x() * m_size.y() * m_size.z() == 0; } 373 const TextureFormat getFormat (void) const { return m_format; } 374 375 void setStorage (const TextureFormat& format, int width, int heigth, int depth = 1); 376 void setSize (int width, int height, int depth = 1); 377 378 PixelBufferAccess getAccess (void) { return PixelBufferAccess(m_format, m_size, calculatePackedPitch(m_format, m_size), getPtr()); } 379 ConstPixelBufferAccess getAccess (void) const { return ConstPixelBufferAccess(m_format, m_size, calculatePackedPitch(m_format, m_size), getPtr()); } 380 381private: 382 void* getPtr (void) { return m_data.getPtr(); } 383 const void* getPtr (void) const { return m_data.getPtr(); } 384 385 TextureFormat m_format; 386 IVec3 m_size; 387 de::ArrayBuffer<deUint8> m_data; 388 389 friend class ConstPixelBufferAccess; 390} DE_WARN_UNUSED_TYPE; 391 392Vec4 sampleLevelArray1D (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, int level, float lod); 393Vec4 sampleLevelArray2D (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, float t, int depth, float lod); 394Vec4 sampleLevelArray3D (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, float t, float r, float lod); 395 396Vec4 sampleLevelArray1DOffset (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, float lod, const IVec2& offset); 397Vec4 sampleLevelArray2DOffset (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, float t, float lod, const IVec3& offset); 398Vec4 sampleLevelArray3DOffset (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, float t, float r, float lod, const IVec3& offset); 399 400float sampleLevelArray1DCompare (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float ref, float s, float lod, const IVec2& offset); 401float sampleLevelArray2DCompare (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float ref, float s, float t, float lod, const IVec3& offset); 402 403Vec4 gatherArray2DOffsets (const ConstPixelBufferAccess& src, const Sampler& sampler, float s, float t, int depth, int componentNdx, const IVec2 (&offsets)[4]); 404Vec4 gatherArray2DOffsetsCompare (const ConstPixelBufferAccess& src, const Sampler& sampler, float ref, float s, float t, int depth, const IVec2 (&offsets)[4]); 405 406enum CubeFace 407{ 408 CUBEFACE_NEGATIVE_X = 0, 409 CUBEFACE_POSITIVE_X, 410 CUBEFACE_NEGATIVE_Y, 411 CUBEFACE_POSITIVE_Y, 412 CUBEFACE_NEGATIVE_Z, 413 CUBEFACE_POSITIVE_Z, 414 415 CUBEFACE_LAST 416}; 417 418/*--------------------------------------------------------------------*//*! 419 * \brief Coordinates projected onto cube face. 420 *//*--------------------------------------------------------------------*/ 421template<typename T> 422struct CubeFaceCoords 423{ 424 CubeFace face; 425 T s; 426 T t; 427 428 CubeFaceCoords (CubeFace face_, T s_, T t_) : face(face_), s(s_), t(t_) {} 429 CubeFaceCoords (CubeFace face_, const Vector<T, 2>& c) : face(face_), s(c.x()), t(c.y()) {} 430} DE_WARN_UNUSED_TYPE; 431 432typedef CubeFaceCoords<float> CubeFaceFloatCoords; 433typedef CubeFaceCoords<int> CubeFaceIntCoords; 434 435CubeFace selectCubeFace (const Vec3& coords); 436Vec2 projectToFace (CubeFace face, const Vec3& coords); 437CubeFaceFloatCoords getCubeFaceCoords (const Vec3& coords); 438CubeFaceIntCoords remapCubeEdgeCoords (const CubeFaceIntCoords& coords, int size); 439 440/*--------------------------------------------------------------------*//*! 441 * \brief 1D Texture View 442 *//*--------------------------------------------------------------------*/ 443class Texture1DView 444{ 445public: 446 Texture1DView (int numLevels, const ConstPixelBufferAccess* levels); 447 448 int getNumLevels (void) const { return m_numLevels; } 449 int getWidth (void) const { return m_numLevels > 0 ? m_levels[0].getWidth() : 0; } 450 const ConstPixelBufferAccess& getLevel (int ndx) const { DE_ASSERT(de::inBounds(ndx, 0, m_numLevels)); return m_levels[ndx]; } 451 const ConstPixelBufferAccess* getLevels (void) const { return m_levels; } 452 453 Vec4 sample (const Sampler& sampler, float s, float lod) const; 454 Vec4 sampleOffset (const Sampler& sampler, float s, float lod, deInt32 offset) const; 455 float sampleCompare (const Sampler& sampler, float ref, float s, float lod) const; 456 float sampleCompareOffset (const Sampler& sampler, float ref, float s, float lod, deInt32 offset) const; 457 458protected: 459 int m_numLevels; 460 const ConstPixelBufferAccess* m_levels; 461} DE_WARN_UNUSED_TYPE; 462 463inline Texture1DView::Texture1DView (int numLevels, const ConstPixelBufferAccess* levels) 464 : m_numLevels (numLevels) 465 , m_levels (levels) 466{ 467 DE_ASSERT(m_numLevels >= 0 && ((m_numLevels == 0) == !m_levels)); 468} 469 470inline Vec4 Texture1DView::sample (const Sampler& sampler, float s, float lod) const 471{ 472 return sampleLevelArray1D(m_levels, m_numLevels, sampler, s, 0 /* depth */, lod); 473} 474 475inline Vec4 Texture1DView::sampleOffset (const Sampler& sampler, float s, float lod, deInt32 offset) const 476{ 477 return sampleLevelArray1DOffset(m_levels, m_numLevels, sampler, s, lod, IVec2(offset, 0)); 478} 479 480inline float Texture1DView::sampleCompare (const Sampler& sampler, float ref, float s, float lod) const 481{ 482 return sampleLevelArray1DCompare(m_levels, m_numLevels, sampler, ref, s, lod, IVec2(0, 0)); 483} 484 485inline float Texture1DView::sampleCompareOffset (const Sampler& sampler, float ref, float s, float lod, deInt32 offset) const 486{ 487 return sampleLevelArray1DCompare(m_levels, m_numLevels, sampler, ref, s, lod, IVec2(offset, 0)); 488} 489 490/*--------------------------------------------------------------------*//*! 491 * \brief 2D Texture View 492 *//*--------------------------------------------------------------------*/ 493class Texture2DView 494{ 495public: 496 Texture2DView (int numLevels, const ConstPixelBufferAccess* levels); 497 498 int getNumLevels (void) const { return m_numLevels; } 499 int getWidth (void) const { return m_numLevels > 0 ? m_levels[0].getWidth() : 0; } 500 int getHeight (void) const { return m_numLevels > 0 ? m_levels[0].getHeight() : 0; } 501 const ConstPixelBufferAccess& getLevel (int ndx) const { DE_ASSERT(de::inBounds(ndx, 0, m_numLevels)); return m_levels[ndx]; } 502 const ConstPixelBufferAccess* getLevels (void) const { return m_levels; } 503 504 Vec4 sample (const Sampler& sampler, float s, float t, float lod) const; 505 Vec4 sampleOffset (const Sampler& sampler, float s, float t, float lod, const IVec2& offset) const; 506 float sampleCompare (const Sampler& sampler, float ref, float s, float t, float lod) const; 507 float sampleCompareOffset (const Sampler& sampler, float ref, float s, float t, float lod, const IVec2& offset) const; 508 509 Vec4 gatherOffsets (const Sampler& sampler, float s, float t, int componentNdx, const IVec2 (&offsets)[4]) const; 510 Vec4 gatherOffsetsCompare(const Sampler& sampler, float ref, float s, float t, const IVec2 (&offsets)[4]) const; 511 512protected: 513 int m_numLevels; 514 const ConstPixelBufferAccess* m_levels; 515} DE_WARN_UNUSED_TYPE; 516 517inline Texture2DView::Texture2DView (int numLevels, const ConstPixelBufferAccess* levels) 518 : m_numLevels (numLevels) 519 , m_levels (levels) 520{ 521 DE_ASSERT(m_numLevels >= 0 && ((m_numLevels == 0) == !m_levels)); 522} 523 524inline Vec4 Texture2DView::sample (const Sampler& sampler, float s, float t, float lod) const 525{ 526 return sampleLevelArray2D(m_levels, m_numLevels, sampler, s, t, 0 /* depth */, lod); 527} 528 529inline Vec4 Texture2DView::sampleOffset (const Sampler& sampler, float s, float t, float lod, const IVec2& offset) const 530{ 531 return sampleLevelArray2DOffset(m_levels, m_numLevels, sampler, s, t, lod, IVec3(offset.x(), offset.y(), 0)); 532} 533 534inline float Texture2DView::sampleCompare (const Sampler& sampler, float ref, float s, float t, float lod) const 535{ 536 return sampleLevelArray2DCompare(m_levels, m_numLevels, sampler, ref, s, t, lod, IVec3(0, 0, 0)); 537} 538 539inline float Texture2DView::sampleCompareOffset (const Sampler& sampler, float ref, float s, float t, float lod, const IVec2& offset) const 540{ 541 return sampleLevelArray2DCompare(m_levels, m_numLevels, sampler, ref, s, t, lod, IVec3(offset.x(), offset.y(), 0)); 542} 543 544inline Vec4 Texture2DView::gatherOffsets (const Sampler& sampler, float s, float t, int componentNdx, const IVec2 (&offsets)[4]) const 545{ 546 return gatherArray2DOffsets(m_levels[0], sampler, s, t, 0, componentNdx, offsets); 547} 548 549inline Vec4 Texture2DView::gatherOffsetsCompare (const Sampler& sampler, float ref, float s, float t, const IVec2 (&offsets)[4]) const 550{ 551 return gatherArray2DOffsetsCompare(m_levels[0], sampler, ref, s, t, 0, offsets); 552} 553 554/*--------------------------------------------------------------------*//*! 555 * \brief Base class for textures that have single mip-map pyramid 556 *//*--------------------------------------------------------------------*/ 557class TextureLevelPyramid 558{ 559public: 560 TextureLevelPyramid (const TextureFormat& format, int numLevels); 561 TextureLevelPyramid (const TextureLevelPyramid& other); 562 ~TextureLevelPyramid(void); 563 564 const TextureFormat& getFormat (void) const { return m_format; } 565 bool isLevelEmpty (int levelNdx) const { return m_data[levelNdx].empty(); } 566 567 int getNumLevels (void) const { return (int)m_access.size(); } 568 const ConstPixelBufferAccess& getLevel (int ndx) const { return m_access[ndx]; } 569 const PixelBufferAccess& getLevel (int ndx) { return m_access[ndx]; } 570 571 const ConstPixelBufferAccess* getLevels (void) const { return &m_access[0]; } 572 const PixelBufferAccess* getLevels (void) { return &m_access[0]; } 573 574 void allocLevel (int levelNdx, int width, int height, int depth); 575 void clearLevel (int levelNdx); 576 577 TextureLevelPyramid& operator= (const TextureLevelPyramid& other); 578 579private: 580 typedef de::ArrayBuffer<deUint8> LevelData; 581 582 TextureFormat m_format; 583 std::vector<LevelData> m_data; 584 std::vector<PixelBufferAccess> m_access; 585} DE_WARN_UNUSED_TYPE; 586 587/*--------------------------------------------------------------------*//*! 588 * \brief 1D Texture reference implementation 589 *//*--------------------------------------------------------------------*/ 590class Texture1D : private TextureLevelPyramid 591{ 592public: 593 Texture1D (const TextureFormat& format, int width); 594 Texture1D (const Texture1D& other); 595 ~Texture1D (void); 596 597 int getWidth (void) const { return m_width; } 598 const Texture1DView& getView (void) const { return m_view; } 599 600 void allocLevel (int levelNdx); 601 602 // Sampling 603 Vec4 sample (const Sampler& sampler, float s, float lod) const; 604 Vec4 sampleOffset (const Sampler& sampler, float s, float lod, deInt32 offset) const; 605 606 using TextureLevelPyramid::getFormat; 607 using TextureLevelPyramid::getNumLevels; 608 using TextureLevelPyramid::getLevel; 609 using TextureLevelPyramid::clearLevel; 610 using TextureLevelPyramid::isLevelEmpty; 611 612 Texture1D& operator= (const Texture1D& other); 613 614 operator Texture1DView (void) const { return m_view; } 615 616private: 617 int m_width; 618 Texture1DView m_view; 619} DE_WARN_UNUSED_TYPE; 620 621inline Vec4 Texture1D::sample (const Sampler& sampler, float s, float lod) const 622{ 623 return m_view.sample(sampler, s, lod); 624} 625 626inline Vec4 Texture1D::sampleOffset (const Sampler& sampler, float s, float lod, deInt32 offset) const 627{ 628 return m_view.sampleOffset(sampler, s, lod, offset); 629} 630 631/*--------------------------------------------------------------------*//*! 632 * \brief 2D Texture reference implementation 633 *//*--------------------------------------------------------------------*/ 634class Texture2D : private TextureLevelPyramid 635{ 636public: 637 Texture2D (const TextureFormat& format, int width, int height); 638 Texture2D (const Texture2D& other); 639 ~Texture2D (void); 640 641 int getWidth (void) const { return m_width; } 642 int getHeight (void) const { return m_height; } 643 const Texture2DView& getView (void) const { return m_view; } 644 645 void allocLevel (int levelNdx); 646 647 // Sampling 648 Vec4 sample (const Sampler& sampler, float s, float t, float lod) const; 649 Vec4 sampleOffset (const Sampler& sampler, float s, float t, float lod, const IVec2& offset) const; 650 float sampleCompare (const Sampler& sampler, float ref, float s, float t, float lod) const; 651 float sampleCompareOffset (const Sampler& sampler, float ref, float s, float t, float lod, const IVec2& offset) const; 652 653 Vec4 gatherOffsets (const Sampler& sampler, float s, float t, int componentNdx, const IVec2 (&offsets)[4]) const; 654 Vec4 gatherOffsetsCompare(const Sampler& sampler, float ref, float s, float t, const IVec2 (&offsets)[4]) const; 655 656 using TextureLevelPyramid::getFormat; 657 using TextureLevelPyramid::getNumLevels; 658 using TextureLevelPyramid::getLevel; 659 using TextureLevelPyramid::clearLevel; 660 using TextureLevelPyramid::isLevelEmpty; 661 662 Texture2D& operator= (const Texture2D& other); 663 664 operator Texture2DView (void) const { return m_view; } 665 666private: 667 int m_width; 668 int m_height; 669 Texture2DView m_view; 670} DE_WARN_UNUSED_TYPE; 671 672inline Vec4 Texture2D::sample (const Sampler& sampler, float s, float t, float lod) const 673{ 674 return m_view.sample(sampler, s, t, lod); 675} 676 677inline Vec4 Texture2D::sampleOffset (const Sampler& sampler, float s, float t, float lod, const IVec2& offset) const 678{ 679 return m_view.sampleOffset(sampler, s, t, lod, offset); 680} 681 682inline float Texture2D::sampleCompare (const Sampler& sampler, float ref, float s, float t, float lod) const 683{ 684 return m_view.sampleCompare(sampler, ref, s, t, lod); 685} 686 687inline float Texture2D::sampleCompareOffset (const Sampler& sampler, float ref, float s, float t, float lod, const IVec2& offset) const 688{ 689 return m_view.sampleCompareOffset(sampler, ref, s, t, lod, offset); 690} 691 692inline Vec4 Texture2D::gatherOffsets (const Sampler& sampler, float s, float t, int componentNdx, const IVec2 (&offsets)[4]) const 693{ 694 return m_view.gatherOffsets(sampler, s, t, componentNdx, offsets); 695} 696 697inline Vec4 Texture2D::gatherOffsetsCompare (const Sampler& sampler, float ref, float s, float t, const IVec2 (&offsets)[4]) const 698{ 699 return m_view.gatherOffsetsCompare(sampler, ref, s, t, offsets); 700} 701 702/*--------------------------------------------------------------------*//*! 703 * \brief Cube Map Texture View 704 *//*--------------------------------------------------------------------*/ 705class TextureCubeView 706{ 707public: 708 TextureCubeView (void); 709 TextureCubeView (int numLevels, const ConstPixelBufferAccess* const (&levels)[CUBEFACE_LAST]); 710 711 int getNumLevels (void) const { return m_numLevels; } 712 int getSize (void) const { return m_numLevels > 0 ? m_levels[0][0].getWidth() : 0; } 713 const ConstPixelBufferAccess& getLevelFace (int ndx, CubeFace face) const { DE_ASSERT(de::inBounds(ndx, 0, m_numLevels)); return m_levels[face][ndx]; } 714 const ConstPixelBufferAccess* getFaceLevels (CubeFace face) const { return m_levels[face]; } 715 716 Vec4 sample (const Sampler& sampler, float s, float t, float p, float lod) const; 717 float sampleCompare (const Sampler& sampler, float ref, float s, float t, float r, float lod) const; 718 719 Vec4 gather (const Sampler& sampler, float s, float t, float r, int componentNdx) const; 720 Vec4 gatherCompare (const Sampler& sampler, float ref, float s, float t, float r) const; 721 722protected: 723 int m_numLevels; 724 const ConstPixelBufferAccess* m_levels[CUBEFACE_LAST]; 725} DE_WARN_UNUSED_TYPE; 726 727/*--------------------------------------------------------------------*//*! 728 * \brief Cube Map Texture reference implementation 729 *//*--------------------------------------------------------------------*/ 730class TextureCube 731{ 732public: 733 TextureCube (const TextureFormat& format, int size); 734 TextureCube (const TextureCube& other); 735 ~TextureCube (void); 736 737 const TextureFormat& getFormat (void) const { return m_format; } 738 int getSize (void) const { return m_size; } 739 740 int getNumLevels (void) const { return (int)m_access[0].size(); } 741 const ConstPixelBufferAccess& getLevelFace (int ndx, CubeFace face) const { return m_access[face][ndx]; } 742 const PixelBufferAccess& getLevelFace (int ndx, CubeFace face) { return m_access[face][ndx]; } 743 744 void allocLevel (CubeFace face, int levelNdx); 745 void clearLevel (CubeFace face, int levelNdx); 746 bool isLevelEmpty (CubeFace face, int levelNdx) const { return m_data[face][levelNdx].empty(); } 747 748 Vec4 sample (const Sampler& sampler, float s, float t, float p, float lod) const; 749 float sampleCompare (const Sampler& sampler, float ref, float s, float t, float r, float lod) const; 750 751 Vec4 gather (const Sampler& sampler, float s, float t, float r, int componentNdx) const; 752 Vec4 gatherCompare (const Sampler& sampler, float ref, float s, float t, float r) const; 753 754 TextureCube& operator= (const TextureCube& other); 755 756 operator TextureCubeView (void) const { return m_view; } 757 758private: 759 typedef de::ArrayBuffer<deUint8> LevelData; 760 761 TextureFormat m_format; 762 int m_size; 763 std::vector<LevelData> m_data[CUBEFACE_LAST]; 764 std::vector<PixelBufferAccess> m_access[CUBEFACE_LAST]; 765 TextureCubeView m_view; 766} DE_WARN_UNUSED_TYPE; 767 768inline Vec4 TextureCube::sample (const Sampler& sampler, float s, float t, float p, float lod) const 769{ 770 return m_view.sample(sampler, s, t, p, lod); 771} 772 773inline float TextureCube::sampleCompare (const Sampler& sampler, float ref, float s, float t, float r, float lod) const 774{ 775 return m_view.sampleCompare(sampler, ref, s, t, r, lod); 776} 777 778inline Vec4 TextureCube::gather (const Sampler& sampler, float s, float t, float r, int componentNdx) const 779{ 780 return m_view.gather(sampler, s, t, r, componentNdx); 781} 782 783inline Vec4 TextureCube::gatherCompare (const Sampler& sampler, float ref, float s, float t, float r) const 784{ 785 return m_view.gatherCompare(sampler, ref, s, t, r); 786} 787 788/*--------------------------------------------------------------------*//*! 789 * \brief 1D Array Texture View 790 *//*--------------------------------------------------------------------*/ 791class Texture1DArrayView 792{ 793public: 794 Texture1DArrayView (int numLevels, const ConstPixelBufferAccess* levels); 795 796 int getWidth (void) const { return m_numLevels > 0 ? m_levels[0].getWidth() : 0; } 797 int getNumLayers (void) const { return m_numLevels > 0 ? m_levels[0].getHeight() : 0; } 798 int getNumLevels (void) const { return m_numLevels; } 799 const ConstPixelBufferAccess& getLevel (int ndx) const { DE_ASSERT(de::inBounds(ndx, 0, m_numLevels)); return m_levels[ndx]; } 800 const ConstPixelBufferAccess* getLevels (void) const { return m_levels; } 801 802 Vec4 sample (const Sampler& sampler, float s, float t, float lod) const; 803 Vec4 sampleOffset (const Sampler& sampler, float s, float t, float lod, deInt32 offset) const; 804 float sampleCompare (const Sampler& sampler, float ref, float s, float t, float lod) const; 805 float sampleCompareOffset (const Sampler& sampler, float ref, float s, float t, float lod, deInt32 offset) const; 806 807protected: 808 int selectLayer (float r) const; 809 810 int m_numLevels; 811 const ConstPixelBufferAccess* m_levels; 812} DE_WARN_UNUSED_TYPE; 813 814/*--------------------------------------------------------------------*//*! 815 * \brief 2D Array Texture View 816 *//*--------------------------------------------------------------------*/ 817class Texture2DArrayView 818{ 819public: 820 Texture2DArrayView (int numLevels, const ConstPixelBufferAccess* levels); 821 822 int getWidth (void) const { return m_numLevels > 0 ? m_levels[0].getWidth() : 0; } 823 int getHeight (void) const { return m_numLevels > 0 ? m_levels[0].getHeight() : 0; } 824 int getNumLayers (void) const { return m_numLevels > 0 ? m_levels[0].getDepth() : 0; } 825 int getNumLevels (void) const { return m_numLevels; } 826 const ConstPixelBufferAccess& getLevel (int ndx) const { DE_ASSERT(de::inBounds(ndx, 0, m_numLevels)); return m_levels[ndx]; } 827 const ConstPixelBufferAccess* getLevels (void) const { return m_levels; } 828 829 Vec4 sample (const Sampler& sampler, float s, float t, float r, float lod) const; 830 Vec4 sampleOffset (const Sampler& sampler, float s, float t, float r, float lod, const IVec2& offset) const; 831 float sampleCompare (const Sampler& sampler, float ref, float s, float t, float r, float lod) const; 832 float sampleCompareOffset (const Sampler& sampler, float ref, float s, float t, float r, float lod, const IVec2& offset) const; 833 834 Vec4 gatherOffsets (const Sampler& sampler, float s, float t, float r, int componentNdx, const IVec2 (&offsets)[4]) const; 835 Vec4 gatherOffsetsCompare(const Sampler& sampler, float ref, float s, float t, float r, const IVec2 (&offsets)[4]) const; 836 837protected: 838 int selectLayer (float r) const; 839 840 int m_numLevels; 841 const ConstPixelBufferAccess* m_levels; 842} DE_WARN_UNUSED_TYPE; 843 844/*--------------------------------------------------------------------*//*! 845 * \brief 1D Array Texture reference implementation 846 *//*--------------------------------------------------------------------*/ 847class Texture1DArray : private TextureLevelPyramid 848{ 849public: 850 Texture1DArray (const TextureFormat& format, int width, int numLayers); 851 Texture1DArray (const Texture1DArray& other); 852 ~Texture1DArray (void); 853 854 int getWidth (void) const { return m_width; } 855 int getNumLayers (void) const { return m_numLayers; } 856 857 void allocLevel (int levelNdx); 858 859 using TextureLevelPyramid::getFormat; 860 using TextureLevelPyramid::getNumLevels; 861 using TextureLevelPyramid::getLevel; 862 using TextureLevelPyramid::clearLevel; 863 using TextureLevelPyramid::isLevelEmpty; 864 865 Vec4 sample (const Sampler& sampler, float s, float t, float lod) const; 866 Vec4 sampleOffset (const Sampler& sampler, float s, float t, float lod, deInt32 offset) const; 867 float sampleCompare (const Sampler& sampler, float ref, float s, float t, float lod) const; 868 float sampleCompareOffset (const Sampler& sampler, float ref, float s, float t, float lod, deInt32 offset) const; 869 870 Texture1DArray& operator= (const Texture1DArray& other); 871 872 operator Texture1DArrayView (void) const { return m_view; } 873 874private: 875 int m_width; 876 int m_numLayers; 877 Texture1DArrayView m_view; 878} DE_WARN_UNUSED_TYPE; 879 880inline Vec4 Texture1DArray::sample (const Sampler& sampler, float s, float t, float lod) const 881{ 882 return m_view.sample(sampler, s, t, lod); 883} 884 885inline Vec4 Texture1DArray::sampleOffset (const Sampler& sampler, float s, float t, float lod, deInt32 offset) const 886{ 887 return m_view.sampleOffset(sampler, s, t, lod, offset); 888} 889 890inline float Texture1DArray::sampleCompare (const Sampler& sampler, float ref, float s, float t, float lod) const 891{ 892 return m_view.sampleCompare(sampler, ref, s, t, lod); 893} 894 895inline float Texture1DArray::sampleCompareOffset (const Sampler& sampler, float ref, float s, float t, float lod, deInt32 offset) const 896{ 897 return m_view.sampleCompareOffset(sampler, ref, s, t, lod, offset); 898} 899 900/*--------------------------------------------------------------------*//*! 901 * \brief 2D Array Texture reference implementation 902 *//*--------------------------------------------------------------------*/ 903class Texture2DArray : private TextureLevelPyramid 904{ 905public: 906 Texture2DArray (const TextureFormat& format, int width, int height, int numLayers); 907 Texture2DArray (const Texture2DArray& other); 908 ~Texture2DArray (void); 909 910 int getWidth (void) const { return m_width; } 911 int getHeight (void) const { return m_height; } 912 int getNumLayers (void) const { return m_numLayers; } 913 914 void allocLevel (int levelNdx); 915 916 using TextureLevelPyramid::getFormat; 917 using TextureLevelPyramid::getNumLevels; 918 using TextureLevelPyramid::getLevel; 919 using TextureLevelPyramid::clearLevel; 920 using TextureLevelPyramid::isLevelEmpty; 921 922 Vec4 sample (const Sampler& sampler, float s, float t, float r, float lod) const; 923 Vec4 sampleOffset (const Sampler& sampler, float s, float t, float r, float lod, const IVec2& offset) const; 924 float sampleCompare (const Sampler& sampler, float ref, float s, float t, float r, float lod) const; 925 float sampleCompareOffset (const Sampler& sampler, float ref, float s, float t, float r, float lod, const IVec2& offset) const; 926 927 Vec4 gatherOffsets (const Sampler& sampler, float s, float t, float r, int componentNdx, const IVec2 (&offsets)[4]) const; 928 Vec4 gatherOffsetsCompare(const Sampler& sampler, float ref, float s, float t, float r, const IVec2 (&offsets)[4]) const; 929 930 Texture2DArray& operator= (const Texture2DArray& other); 931 932 operator Texture2DArrayView (void) const { return m_view; } 933 934private: 935 int m_width; 936 int m_height; 937 int m_numLayers; 938 Texture2DArrayView m_view; 939} DE_WARN_UNUSED_TYPE; 940 941inline Vec4 Texture2DArray::sample (const Sampler& sampler, float s, float t, float r, float lod) const 942{ 943 return m_view.sample(sampler, s, t, r, lod); 944} 945 946inline Vec4 Texture2DArray::sampleOffset (const Sampler& sampler, float s, float t, float r, float lod, const IVec2& offset) const 947{ 948 return m_view.sampleOffset(sampler, s, t, r, lod, offset); 949} 950 951inline float Texture2DArray::sampleCompare (const Sampler& sampler, float ref, float s, float t, float r, float lod) const 952{ 953 return m_view.sampleCompare(sampler, ref, s, t, r, lod); 954} 955 956inline float Texture2DArray::sampleCompareOffset (const Sampler& sampler, float ref, float s, float t, float r, float lod, const IVec2& offset) const 957{ 958 return m_view.sampleCompareOffset(sampler, ref, s, t, r, lod, offset); 959} 960 961inline Vec4 Texture2DArray::gatherOffsets (const Sampler& sampler, float s, float t, float r, int componentNdx, const IVec2 (&offsets)[4]) const 962{ 963 return m_view.gatherOffsets(sampler, s, t, r, componentNdx, offsets); 964} 965 966inline Vec4 Texture2DArray::gatherOffsetsCompare (const Sampler& sampler, float ref, float s, float t, float r, const IVec2 (&offsets)[4]) const 967{ 968 return m_view.gatherOffsetsCompare(sampler, ref, s, t, r, offsets); 969} 970 971/*--------------------------------------------------------------------*//*! 972 * \brief 3D Texture View 973 *//*--------------------------------------------------------------------*/ 974class Texture3DView 975{ 976public: 977 Texture3DView (int numLevels, const ConstPixelBufferAccess* levels); 978 979 int getWidth (void) const { return m_numLevels > 0 ? m_levels[0].getWidth() : 0; } 980 int getHeight (void) const { return m_numLevels > 0 ? m_levels[0].getHeight() : 0; } 981 int getDepth (void) const { return m_numLevels > 0 ? m_levels[0].getDepth() : 0; } 982 int getNumLevels (void) const { return m_numLevels; } 983 const ConstPixelBufferAccess& getLevel (int ndx) const { DE_ASSERT(de::inBounds(ndx, 0, m_numLevels)); return m_levels[ndx]; } 984 const ConstPixelBufferAccess* getLevels (void) const { return m_levels; } 985 986 Vec4 sample (const Sampler& sampler, float s, float t, float r, float lod) const; 987 Vec4 sampleOffset (const Sampler& sampler, float s, float t, float r, float lod, const IVec3& offset) const; 988 989protected: 990 int m_numLevels; 991 const ConstPixelBufferAccess* m_levels; 992} DE_WARN_UNUSED_TYPE; 993 994inline Vec4 Texture3DView::sample (const Sampler& sampler, float s, float t, float r, float lod) const 995{ 996 return sampleLevelArray3D(m_levels, m_numLevels, sampler, s, t, r, lod); 997} 998 999inline Vec4 Texture3DView::sampleOffset (const Sampler& sampler, float s, float t, float r, float lod, const IVec3& offset) const 1000{ 1001 return sampleLevelArray3DOffset(m_levels, m_numLevels, sampler, s, t, r, lod, offset); 1002} 1003 1004/*--------------------------------------------------------------------*//*! 1005 * \brief 3D Texture reference implementation 1006 *//*--------------------------------------------------------------------*/ 1007class Texture3D : private TextureLevelPyramid 1008{ 1009public: 1010 Texture3D (const TextureFormat& format, int width, int height, int depth); 1011 Texture3D (const Texture3D& other); 1012 ~Texture3D (void); 1013 1014 int getWidth (void) const { return m_width; } 1015 int getHeight (void) const { return m_height; } 1016 int getDepth (void) const { return m_depth; } 1017 1018 void allocLevel (int levelNdx); 1019 1020 using TextureLevelPyramid::getFormat; 1021 using TextureLevelPyramid::getNumLevels; 1022 using TextureLevelPyramid::getLevel; 1023 using TextureLevelPyramid::clearLevel; 1024 using TextureLevelPyramid::isLevelEmpty; 1025 1026 Vec4 sample (const Sampler& sampler, float s, float t, float r, float lod) const; 1027 Vec4 sampleOffset (const Sampler& sampler, float s, float t, float r, float lod, const IVec3& offset) const; 1028 1029 Texture3D& operator= (const Texture3D& other); 1030 1031 operator Texture3DView (void) const { return m_view; } 1032 1033private: 1034 int m_width; 1035 int m_height; 1036 int m_depth; 1037 Texture3DView m_view; 1038} DE_WARN_UNUSED_TYPE; 1039 1040inline Vec4 Texture3D::sample (const Sampler& sampler, float s, float t, float r, float lod) const 1041{ 1042 return m_view.sample(sampler, s, t, r, lod); 1043} 1044 1045inline Vec4 Texture3D::sampleOffset (const Sampler& sampler, float s, float t, float r, float lod, const IVec3& offset) const 1046{ 1047 return m_view.sampleOffset(sampler, s, t, r, lod, offset); 1048} 1049 1050/*--------------------------------------------------------------------*//*! 1051 * \brief Cube Map Array Texture View 1052 *//*--------------------------------------------------------------------*/ 1053class TextureCubeArrayView 1054{ 1055public: 1056 TextureCubeArrayView (int numLevels, const ConstPixelBufferAccess* levels); 1057 1058 int getSize (void) const { return m_numLevels > 0 ? m_levels[0].getWidth() : 0; } 1059 int getDepth (void) const { return m_numLevels > 0 ? m_levels[0].getDepth() : 0; } 1060 int getNumLayers (void) const { return getDepth() / 6; } 1061 int getNumLevels (void) const { return m_numLevels; } 1062 const ConstPixelBufferAccess& getLevel (int ndx) const { DE_ASSERT(de::inBounds(ndx, 0, m_numLevels)); return m_levels[ndx]; } 1063 const ConstPixelBufferAccess* getLevels (void) const { return m_levels; } 1064 1065 Vec4 sample (const Sampler& sampler, float s, float t, float r, float q, float lod) const; 1066 Vec4 sampleOffset (const Sampler& sampler, float s, float t, float r, float q, float lod, const IVec2& offset) const; 1067 float sampleCompare (const Sampler& sampler, float ref, float s, float t, float r, float q, float lod) const; 1068 float sampleCompareOffset (const Sampler& sampler, float ref, float s, float t, float r, float q, float lod, const IVec2& offset) const; 1069 1070protected: 1071 int selectLayer (float q) const; 1072 1073 int m_numLevels; 1074 const ConstPixelBufferAccess* m_levels; 1075} DE_WARN_UNUSED_TYPE; 1076 1077/*--------------------------------------------------------------------*//*! 1078 * \brief Cube Map Array Texture reference implementation 1079 *//*--------------------------------------------------------------------*/ 1080class TextureCubeArray : private TextureLevelPyramid 1081{ 1082public: 1083 TextureCubeArray (const TextureFormat& format, int size, int depth); 1084 TextureCubeArray (const TextureCubeArray& other); 1085 ~TextureCubeArray (void); 1086 1087 int getSize (void) const { return m_size; } 1088 int getDepth (void) const { return m_depth; } 1089 1090 void allocLevel (int levelNdx); 1091 1092 using TextureLevelPyramid::getFormat; 1093 using TextureLevelPyramid::getNumLevels; 1094 using TextureLevelPyramid::getLevel; 1095 using TextureLevelPyramid::clearLevel; 1096 using TextureLevelPyramid::isLevelEmpty; 1097 1098 Vec4 sample (const Sampler& sampler, float s, float t, float r, float q, float lod) const; 1099 Vec4 sampleOffset (const Sampler& sampler, float s, float t, float r, float q, float lod, const IVec2& offset) const; 1100 float sampleCompare (const Sampler& sampler, float ref, float s, float t, float r, float q, float lod) const; 1101 float sampleCompareOffset (const Sampler& sampler, float ref, float s, float t, float r, float q, float lod, const IVec2& offset) const; 1102 1103 TextureCubeArray& operator= (const TextureCubeArray& other); 1104 1105 operator TextureCubeArrayView (void) const { return m_view; } 1106 1107private: 1108 int m_size; 1109 int m_depth; 1110 TextureCubeArrayView m_view; 1111} DE_WARN_UNUSED_TYPE; 1112 1113inline Vec4 TextureCubeArray::sample (const Sampler& sampler, float s, float t, float r, float q, float lod) const 1114{ 1115 return m_view.sample(sampler, s, t, r, q, lod); 1116} 1117 1118inline Vec4 TextureCubeArray::sampleOffset (const Sampler& sampler, float s, float t, float r, float q, float lod, const IVec2& offset) const 1119{ 1120 return m_view.sampleOffset(sampler, s, t, r, q, lod, offset); 1121} 1122 1123inline float TextureCubeArray::sampleCompare (const Sampler& sampler, float ref, float s, float t, float r, float q, float lod) const 1124{ 1125 return m_view.sampleCompare(sampler, ref, s, t, r, q, lod); 1126} 1127 1128inline float TextureCubeArray::sampleCompareOffset (const Sampler& sampler, float ref, float s, float t, float r, float q, float lod, const IVec2& offset) const 1129{ 1130 return m_view.sampleCompareOffset(sampler, ref, s, t, r, q, lod, offset); 1131} 1132 1133// Stream operators. 1134std::ostream& operator<< (std::ostream& str, TextureFormat::ChannelOrder order); 1135std::ostream& operator<< (std::ostream& str, TextureFormat::ChannelType type); 1136std::ostream& operator<< (std::ostream& str, TextureFormat format); 1137std::ostream& operator<< (std::ostream& str, CubeFace face); 1138std::ostream& operator<< (std::ostream& str, const ConstPixelBufferAccess& access); 1139 1140} // tcu 1141 1142#endif // _TCUTEXTURE_HPP 1143