1e5c31af7Sopenharmony_ci/*------------------------------------------------------------------------- 2e5c31af7Sopenharmony_ci * drawElements Quality Program OpenGL ES 3.0 Module 3e5c31af7Sopenharmony_ci * ------------------------------------------------- 4e5c31af7Sopenharmony_ci * 5e5c31af7Sopenharmony_ci * Copyright 2014 The Android Open Source Project 6e5c31af7Sopenharmony_ci * 7e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 8e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License. 9e5c31af7Sopenharmony_ci * You may obtain a copy of the License at 10e5c31af7Sopenharmony_ci * 11e5c31af7Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 12e5c31af7Sopenharmony_ci * 13e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 14e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 15e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and 17e5c31af7Sopenharmony_ci * limitations under the License. 18e5c31af7Sopenharmony_ci * 19e5c31af7Sopenharmony_ci *//*! 20e5c31af7Sopenharmony_ci * \file 21e5c31af7Sopenharmony_ci * \brief Texture access function tests. 22e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/ 23e5c31af7Sopenharmony_ci 24e5c31af7Sopenharmony_ci#include "es3fShaderTextureFunctionTests.hpp" 25e5c31af7Sopenharmony_ci#include "glsShaderRenderCase.hpp" 26e5c31af7Sopenharmony_ci#include "glsShaderLibrary.hpp" 27e5c31af7Sopenharmony_ci#include "glsTextureTestUtil.hpp" 28e5c31af7Sopenharmony_ci#include "gluTexture.hpp" 29e5c31af7Sopenharmony_ci#include "gluTextureUtil.hpp" 30e5c31af7Sopenharmony_ci#include "gluPixelTransfer.hpp" 31e5c31af7Sopenharmony_ci#include "gluStrUtil.hpp" 32e5c31af7Sopenharmony_ci#include "tcuTextureUtil.hpp" 33e5c31af7Sopenharmony_ci#include "tcuMatrix.hpp" 34e5c31af7Sopenharmony_ci#include "tcuMatrixUtil.hpp" 35e5c31af7Sopenharmony_ci#include "tcuTestLog.hpp" 36e5c31af7Sopenharmony_ci#include "glwFunctions.hpp" 37e5c31af7Sopenharmony_ci#include "deMath.h" 38e5c31af7Sopenharmony_ci 39e5c31af7Sopenharmony_ci#include <sstream> 40e5c31af7Sopenharmony_ci 41e5c31af7Sopenharmony_ci#include "glwEnums.hpp" 42e5c31af7Sopenharmony_ci#include "glwFunctions.hpp" 43e5c31af7Sopenharmony_ci 44e5c31af7Sopenharmony_cinamespace deqp 45e5c31af7Sopenharmony_ci{ 46e5c31af7Sopenharmony_cinamespace gles3 47e5c31af7Sopenharmony_ci{ 48e5c31af7Sopenharmony_cinamespace Functional 49e5c31af7Sopenharmony_ci{ 50e5c31af7Sopenharmony_ci 51e5c31af7Sopenharmony_cinamespace 52e5c31af7Sopenharmony_ci{ 53e5c31af7Sopenharmony_ci 54e5c31af7Sopenharmony_ciusing glu::TextureTestUtil::computeLodFromDerivates; 55e5c31af7Sopenharmony_ci 56e5c31af7Sopenharmony_cienum Function 57e5c31af7Sopenharmony_ci{ 58e5c31af7Sopenharmony_ci FUNCTION_TEXTURE = 0, //!< texture(), textureOffset() 59e5c31af7Sopenharmony_ci FUNCTION_TEXTUREPROJ, //!< textureProj(), textureProjOffset() 60e5c31af7Sopenharmony_ci FUNCTION_TEXTUREPROJ3, //!< textureProj(sampler2D, vec3) 61e5c31af7Sopenharmony_ci FUNCTION_TEXTURELOD, // ... 62e5c31af7Sopenharmony_ci FUNCTION_TEXTUREPROJLOD, 63e5c31af7Sopenharmony_ci FUNCTION_TEXTUREPROJLOD3, //!< textureProjLod(sampler2D, vec3) 64e5c31af7Sopenharmony_ci FUNCTION_TEXTUREGRAD, 65e5c31af7Sopenharmony_ci FUNCTION_TEXTUREPROJGRAD, 66e5c31af7Sopenharmony_ci FUNCTION_TEXTUREPROJGRAD3, //!< textureProjGrad(sampler2D, vec3) 67e5c31af7Sopenharmony_ci FUNCTION_TEXELFETCH, 68e5c31af7Sopenharmony_ci 69e5c31af7Sopenharmony_ci FUNCTION_LAST 70e5c31af7Sopenharmony_ci}; 71e5c31af7Sopenharmony_ci 72e5c31af7Sopenharmony_ciinline bool functionHasAutoLod (glu::ShaderType shaderType, Function function) 73e5c31af7Sopenharmony_ci{ 74e5c31af7Sopenharmony_ci return shaderType == glu::SHADERTYPE_FRAGMENT && 75e5c31af7Sopenharmony_ci (function == FUNCTION_TEXTURE || 76e5c31af7Sopenharmony_ci function == FUNCTION_TEXTUREPROJ || 77e5c31af7Sopenharmony_ci function == FUNCTION_TEXTUREPROJ3); 78e5c31af7Sopenharmony_ci} 79e5c31af7Sopenharmony_ci 80e5c31af7Sopenharmony_ciinline bool functionHasProj (Function function) 81e5c31af7Sopenharmony_ci{ 82e5c31af7Sopenharmony_ci return function == FUNCTION_TEXTUREPROJ || 83e5c31af7Sopenharmony_ci function == FUNCTION_TEXTUREPROJ3 || 84e5c31af7Sopenharmony_ci function == FUNCTION_TEXTUREPROJLOD || 85e5c31af7Sopenharmony_ci function == FUNCTION_TEXTUREPROJGRAD || 86e5c31af7Sopenharmony_ci function == FUNCTION_TEXTUREPROJLOD3 || 87e5c31af7Sopenharmony_ci function == FUNCTION_TEXTUREPROJGRAD3; 88e5c31af7Sopenharmony_ci} 89e5c31af7Sopenharmony_ci 90e5c31af7Sopenharmony_ciinline bool functionHasGrad (Function function) 91e5c31af7Sopenharmony_ci{ 92e5c31af7Sopenharmony_ci return function == FUNCTION_TEXTUREGRAD || function == FUNCTION_TEXTUREPROJGRAD || function == FUNCTION_TEXTUREPROJGRAD3; 93e5c31af7Sopenharmony_ci} 94e5c31af7Sopenharmony_ci 95e5c31af7Sopenharmony_ciinline bool functionHasLod (Function function) 96e5c31af7Sopenharmony_ci{ 97e5c31af7Sopenharmony_ci return function == FUNCTION_TEXTURELOD || 98e5c31af7Sopenharmony_ci function == FUNCTION_TEXTUREPROJLOD || 99e5c31af7Sopenharmony_ci function == FUNCTION_TEXTUREPROJLOD3 || 100e5c31af7Sopenharmony_ci function == FUNCTION_TEXELFETCH; 101e5c31af7Sopenharmony_ci} 102e5c31af7Sopenharmony_ci 103e5c31af7Sopenharmony_cistruct TextureLookupSpec 104e5c31af7Sopenharmony_ci{ 105e5c31af7Sopenharmony_ci Function function; 106e5c31af7Sopenharmony_ci 107e5c31af7Sopenharmony_ci tcu::Vec4 minCoord; 108e5c31af7Sopenharmony_ci tcu::Vec4 maxCoord; 109e5c31af7Sopenharmony_ci 110e5c31af7Sopenharmony_ci // Bias 111e5c31af7Sopenharmony_ci bool useBias; 112e5c31af7Sopenharmony_ci 113e5c31af7Sopenharmony_ci // Bias or Lod for *Lod* functions 114e5c31af7Sopenharmony_ci float minLodBias; 115e5c31af7Sopenharmony_ci float maxLodBias; 116e5c31af7Sopenharmony_ci 117e5c31af7Sopenharmony_ci // For *Grad* functions 118e5c31af7Sopenharmony_ci tcu::Vec3 minDX; 119e5c31af7Sopenharmony_ci tcu::Vec3 maxDX; 120e5c31af7Sopenharmony_ci tcu::Vec3 minDY; 121e5c31af7Sopenharmony_ci tcu::Vec3 maxDY; 122e5c31af7Sopenharmony_ci 123e5c31af7Sopenharmony_ci bool useOffset; 124e5c31af7Sopenharmony_ci tcu::IVec3 offset; 125e5c31af7Sopenharmony_ci 126e5c31af7Sopenharmony_ci TextureLookupSpec (void) 127e5c31af7Sopenharmony_ci : function (FUNCTION_LAST) 128e5c31af7Sopenharmony_ci , minCoord (0.0f) 129e5c31af7Sopenharmony_ci , maxCoord (1.0f) 130e5c31af7Sopenharmony_ci , useBias (false) 131e5c31af7Sopenharmony_ci , minLodBias (0.0f) 132e5c31af7Sopenharmony_ci , maxLodBias (0.0f) 133e5c31af7Sopenharmony_ci , minDX (0.0f) 134e5c31af7Sopenharmony_ci , maxDX (0.0f) 135e5c31af7Sopenharmony_ci , minDY (0.0f) 136e5c31af7Sopenharmony_ci , maxDY (0.0f) 137e5c31af7Sopenharmony_ci , useOffset (false) 138e5c31af7Sopenharmony_ci , offset (0) 139e5c31af7Sopenharmony_ci { 140e5c31af7Sopenharmony_ci } 141e5c31af7Sopenharmony_ci 142e5c31af7Sopenharmony_ci TextureLookupSpec (Function function_, 143e5c31af7Sopenharmony_ci const tcu::Vec4& minCoord_, 144e5c31af7Sopenharmony_ci const tcu::Vec4& maxCoord_, 145e5c31af7Sopenharmony_ci bool useBias_, 146e5c31af7Sopenharmony_ci float minLodBias_, 147e5c31af7Sopenharmony_ci float maxLodBias_, 148e5c31af7Sopenharmony_ci const tcu::Vec3& minDX_, 149e5c31af7Sopenharmony_ci const tcu::Vec3& maxDX_, 150e5c31af7Sopenharmony_ci const tcu::Vec3& minDY_, 151e5c31af7Sopenharmony_ci const tcu::Vec3& maxDY_, 152e5c31af7Sopenharmony_ci bool useOffset_, 153e5c31af7Sopenharmony_ci const tcu::IVec3& offset_) 154e5c31af7Sopenharmony_ci : function (function_) 155e5c31af7Sopenharmony_ci , minCoord (minCoord_) 156e5c31af7Sopenharmony_ci , maxCoord (maxCoord_) 157e5c31af7Sopenharmony_ci , useBias (useBias_) 158e5c31af7Sopenharmony_ci , minLodBias (minLodBias_) 159e5c31af7Sopenharmony_ci , maxLodBias (maxLodBias_) 160e5c31af7Sopenharmony_ci , minDX (minDX_) 161e5c31af7Sopenharmony_ci , maxDX (maxDX_) 162e5c31af7Sopenharmony_ci , minDY (minDY_) 163e5c31af7Sopenharmony_ci , maxDY (maxDY_) 164e5c31af7Sopenharmony_ci , useOffset (useOffset_) 165e5c31af7Sopenharmony_ci , offset (offset_) 166e5c31af7Sopenharmony_ci { 167e5c31af7Sopenharmony_ci } 168e5c31af7Sopenharmony_ci}; 169e5c31af7Sopenharmony_ci 170e5c31af7Sopenharmony_cienum TextureType 171e5c31af7Sopenharmony_ci{ 172e5c31af7Sopenharmony_ci TEXTURETYPE_2D, 173e5c31af7Sopenharmony_ci TEXTURETYPE_CUBE_MAP, 174e5c31af7Sopenharmony_ci TEXTURETYPE_2D_ARRAY, 175e5c31af7Sopenharmony_ci TEXTURETYPE_3D, 176e5c31af7Sopenharmony_ci 177e5c31af7Sopenharmony_ci TEXTURETYPE_LAST 178e5c31af7Sopenharmony_ci}; 179e5c31af7Sopenharmony_ci 180e5c31af7Sopenharmony_cistruct TextureSpec 181e5c31af7Sopenharmony_ci{ 182e5c31af7Sopenharmony_ci TextureType type; //!< Texture type (2D, cubemap, ...) 183e5c31af7Sopenharmony_ci deUint32 format; //!< Internal format. 184e5c31af7Sopenharmony_ci int width; 185e5c31af7Sopenharmony_ci int height; 186e5c31af7Sopenharmony_ci int depth; 187e5c31af7Sopenharmony_ci int numLevels; 188e5c31af7Sopenharmony_ci tcu::Sampler sampler; 189e5c31af7Sopenharmony_ci 190e5c31af7Sopenharmony_ci TextureSpec (void) 191e5c31af7Sopenharmony_ci : type (TEXTURETYPE_LAST) 192e5c31af7Sopenharmony_ci , format (GL_NONE) 193e5c31af7Sopenharmony_ci , width (0) 194e5c31af7Sopenharmony_ci , height (0) 195e5c31af7Sopenharmony_ci , depth (0) 196e5c31af7Sopenharmony_ci , numLevels (0) 197e5c31af7Sopenharmony_ci { 198e5c31af7Sopenharmony_ci } 199e5c31af7Sopenharmony_ci 200e5c31af7Sopenharmony_ci TextureSpec (TextureType type_, 201e5c31af7Sopenharmony_ci deUint32 format_, 202e5c31af7Sopenharmony_ci int width_, 203e5c31af7Sopenharmony_ci int height_, 204e5c31af7Sopenharmony_ci int depth_, 205e5c31af7Sopenharmony_ci int numLevels_, 206e5c31af7Sopenharmony_ci const tcu::Sampler& sampler_) 207e5c31af7Sopenharmony_ci : type (type_) 208e5c31af7Sopenharmony_ci , format (format_) 209e5c31af7Sopenharmony_ci , width (width_) 210e5c31af7Sopenharmony_ci , height (height_) 211e5c31af7Sopenharmony_ci , depth (depth_) 212e5c31af7Sopenharmony_ci , numLevels (numLevels_) 213e5c31af7Sopenharmony_ci , sampler (sampler_) 214e5c31af7Sopenharmony_ci { 215e5c31af7Sopenharmony_ci } 216e5c31af7Sopenharmony_ci}; 217e5c31af7Sopenharmony_ci 218e5c31af7Sopenharmony_cistruct TexLookupParams 219e5c31af7Sopenharmony_ci{ 220e5c31af7Sopenharmony_ci float lod; 221e5c31af7Sopenharmony_ci tcu::IVec3 offset; 222e5c31af7Sopenharmony_ci tcu::Vec4 scale; 223e5c31af7Sopenharmony_ci tcu::Vec4 bias; 224e5c31af7Sopenharmony_ci 225e5c31af7Sopenharmony_ci TexLookupParams (void) 226e5c31af7Sopenharmony_ci : lod (0.0f) 227e5c31af7Sopenharmony_ci , offset (0) 228e5c31af7Sopenharmony_ci , scale (1.0f) 229e5c31af7Sopenharmony_ci , bias (0.0f) 230e5c31af7Sopenharmony_ci { 231e5c31af7Sopenharmony_ci } 232e5c31af7Sopenharmony_ci}; 233e5c31af7Sopenharmony_ci 234e5c31af7Sopenharmony_ci} // anonymous 235e5c31af7Sopenharmony_ci 236e5c31af7Sopenharmony_ciusing tcu::Vec2; 237e5c31af7Sopenharmony_ciusing tcu::Vec3; 238e5c31af7Sopenharmony_ciusing tcu::Vec4; 239e5c31af7Sopenharmony_ciusing tcu::IVec2; 240e5c31af7Sopenharmony_ciusing tcu::IVec3; 241e5c31af7Sopenharmony_ciusing tcu::IVec4; 242e5c31af7Sopenharmony_ci 243e5c31af7Sopenharmony_cistatic const glu::TextureTestUtil::LodMode DEFAULT_LOD_MODE = glu::TextureTestUtil::LODMODE_EXACT; 244e5c31af7Sopenharmony_ci 245e5c31af7Sopenharmony_ciinline float computeLodFromGrad2D (const gls::ShaderEvalContext& c) 246e5c31af7Sopenharmony_ci{ 247e5c31af7Sopenharmony_ci float w = (float)c.textures[0].tex2D->getWidth(); 248e5c31af7Sopenharmony_ci float h = (float)c.textures[0].tex2D->getHeight(); 249e5c31af7Sopenharmony_ci return computeLodFromDerivates(DEFAULT_LOD_MODE, c.in[1].x()*w, c.in[1].y()*h, c.in[2].x()*w, c.in[2].y()*h); 250e5c31af7Sopenharmony_ci} 251e5c31af7Sopenharmony_ci 252e5c31af7Sopenharmony_ciinline float computeLodFromGrad2DArray (const gls::ShaderEvalContext& c) 253e5c31af7Sopenharmony_ci{ 254e5c31af7Sopenharmony_ci float w = (float)c.textures[0].tex2DArray->getWidth(); 255e5c31af7Sopenharmony_ci float h = (float)c.textures[0].tex2DArray->getHeight(); 256e5c31af7Sopenharmony_ci return computeLodFromDerivates(DEFAULT_LOD_MODE, c.in[1].x()*w, c.in[1].y()*h, c.in[2].x()*w, c.in[2].y()*h); 257e5c31af7Sopenharmony_ci} 258e5c31af7Sopenharmony_ci 259e5c31af7Sopenharmony_ciinline float computeLodFromGrad3D (const gls::ShaderEvalContext& c) 260e5c31af7Sopenharmony_ci{ 261e5c31af7Sopenharmony_ci float w = (float)c.textures[0].tex3D->getWidth(); 262e5c31af7Sopenharmony_ci float h = (float)c.textures[0].tex3D->getHeight(); 263e5c31af7Sopenharmony_ci float d = (float)c.textures[0].tex3D->getDepth(); 264e5c31af7Sopenharmony_ci return computeLodFromDerivates(DEFAULT_LOD_MODE, c.in[1].x()*w, c.in[1].y()*h, c.in[1].z()*d, c.in[2].x()*w, c.in[2].y()*h, c.in[2].z()*d); 265e5c31af7Sopenharmony_ci} 266e5c31af7Sopenharmony_ci 267e5c31af7Sopenharmony_ciinline float computeLodFromGradCube (const gls::ShaderEvalContext& c) 268e5c31af7Sopenharmony_ci{ 269e5c31af7Sopenharmony_ci // \note Major axis is always -Z or +Z 270e5c31af7Sopenharmony_ci float m = de::abs(c.in[0].z()); 271e5c31af7Sopenharmony_ci float d = (float)c.textures[0].texCube->getSize(); 272e5c31af7Sopenharmony_ci float s = d/(2.0f*m); 273e5c31af7Sopenharmony_ci float t = d/(2.0f*m); 274e5c31af7Sopenharmony_ci return computeLodFromDerivates(DEFAULT_LOD_MODE, c.in[1].x()*s, c.in[1].y()*t, c.in[2].x()*s, c.in[2].y()*t); 275e5c31af7Sopenharmony_ci} 276e5c31af7Sopenharmony_ci 277e5c31af7Sopenharmony_citypedef void (*TexEvalFunc) (gls::ShaderEvalContext& c, const TexLookupParams& lookupParams); 278e5c31af7Sopenharmony_ci 279e5c31af7Sopenharmony_ciinline Vec4 texture2D (const gls::ShaderEvalContext& c, float s, float t, float lod) { return c.textures[0].tex2D->sample(c.textures[0].sampler, s, t, lod); } 280e5c31af7Sopenharmony_ciinline Vec4 textureCube (const gls::ShaderEvalContext& c, float s, float t, float r, float lod) { return c.textures[0].texCube->sample(c.textures[0].sampler, s, t, r, lod); } 281e5c31af7Sopenharmony_ciinline Vec4 texture2DArray (const gls::ShaderEvalContext& c, float s, float t, float r, float lod) { return c.textures[0].tex2DArray->sample(c.textures[0].sampler, s, t, r, lod); } 282e5c31af7Sopenharmony_ciinline Vec4 texture3D (const gls::ShaderEvalContext& c, float s, float t, float r, float lod) { return c.textures[0].tex3D->sample(c.textures[0].sampler, s, t, r, lod); } 283e5c31af7Sopenharmony_ci 284e5c31af7Sopenharmony_ciinline float texture2DShadow (const gls::ShaderEvalContext& c, float ref, float s, float t, float lod) { return c.textures[0].tex2D->sampleCompare(c.textures[0].sampler, ref, s, t, lod); } 285e5c31af7Sopenharmony_ciinline float textureCubeShadow (const gls::ShaderEvalContext& c, float ref, float s, float t, float r, float lod) { return c.textures[0].texCube->sampleCompare(c.textures[0].sampler, ref, s, t, r, lod); } 286e5c31af7Sopenharmony_ciinline float texture2DArrayShadow (const gls::ShaderEvalContext& c, float ref, float s, float t, float r, float lod) { return c.textures[0].tex2DArray->sampleCompare(c.textures[0].sampler, ref, s, t, r, lod); } 287e5c31af7Sopenharmony_ci 288e5c31af7Sopenharmony_ciinline Vec4 texture2DOffset (const gls::ShaderEvalContext& c, float s, float t, float lod, IVec2 offset) { return c.textures[0].tex2D->sampleOffset(c.textures[0].sampler, s, t, lod, offset); } 289e5c31af7Sopenharmony_ciinline Vec4 texture2DArrayOffset (const gls::ShaderEvalContext& c, float s, float t, float r, float lod, IVec2 offset) { return c.textures[0].tex2DArray->sampleOffset(c.textures[0].sampler, s, t, r, lod, offset); } 290e5c31af7Sopenharmony_ciinline Vec4 texture3DOffset (const gls::ShaderEvalContext& c, float s, float t, float r, float lod, IVec3 offset) { return c.textures[0].tex3D->sampleOffset(c.textures[0].sampler, s, t, r, lod, offset); } 291e5c31af7Sopenharmony_ci 292e5c31af7Sopenharmony_ciinline float texture2DShadowOffset (const gls::ShaderEvalContext& c, float ref, float s, float t, float lod, IVec2 offset) { return c.textures[0].tex2D->sampleCompareOffset(c.textures[0].sampler, ref, s, t, lod, offset); } 293e5c31af7Sopenharmony_ciinline float texture2DArrayShadowOffset (const gls::ShaderEvalContext& c, float ref, float s, float t, float r, float lod, IVec2 offset) { return c.textures[0].tex2DArray->sampleCompareOffset(c.textures[0].sampler, ref, s, t, r, lod, offset); } 294e5c31af7Sopenharmony_ci 295e5c31af7Sopenharmony_ci// Eval functions. 296e5c31af7Sopenharmony_cistatic void evalTexture2D (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2D(c, c.in[0].x(), c.in[0].y(), p.lod)*p.scale + p.bias; } 297e5c31af7Sopenharmony_cistatic void evalTextureCube (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = textureCube(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod)*p.scale + p.bias; } 298e5c31af7Sopenharmony_cistatic void evalTexture2DArray (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DArray(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod)*p.scale + p.bias; } 299e5c31af7Sopenharmony_cistatic void evalTexture3D (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture3D(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod)*p.scale + p.bias; } 300e5c31af7Sopenharmony_ci 301e5c31af7Sopenharmony_cistatic void evalTexture2DBias (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2D(c, c.in[0].x(), c.in[0].y(), p.lod+c.in[1].x())*p.scale + p.bias; } 302e5c31af7Sopenharmony_cistatic void evalTextureCubeBias (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = textureCube(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod+c.in[1].x())*p.scale + p.bias; } 303e5c31af7Sopenharmony_cistatic void evalTexture2DArrayBias (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DArray(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod+c.in[1].x())*p.scale + p.bias; } 304e5c31af7Sopenharmony_cistatic void evalTexture3DBias (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture3D(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod+c.in[1].x())*p.scale + p.bias; } 305e5c31af7Sopenharmony_ci 306e5c31af7Sopenharmony_cistatic void evalTexture2DProj3 (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2D(c, c.in[0].x()/c.in[0].z(), c.in[0].y()/c.in[0].z(), p.lod)*p.scale + p.bias; } 307e5c31af7Sopenharmony_cistatic void evalTexture2DProj3Bias (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2D(c, c.in[0].x()/c.in[0].z(), c.in[0].y()/c.in[0].z(), p.lod+c.in[1].x())*p.scale + p.bias; } 308e5c31af7Sopenharmony_cistatic void evalTexture2DProj (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2D(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), p.lod)*p.scale + p.bias; } 309e5c31af7Sopenharmony_cistatic void evalTexture2DProjBias (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2D(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), p.lod+c.in[1].x())*p.scale + p.bias; } 310e5c31af7Sopenharmony_cistatic void evalTexture3DProj (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture3D(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[0].z()/c.in[0].w(), p.lod)*p.scale + p.bias; } 311e5c31af7Sopenharmony_cistatic void evalTexture3DProjBias (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture3D(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[0].z()/c.in[0].w(), p.lod+c.in[1].x())*p.scale + p.bias; } 312e5c31af7Sopenharmony_ci 313e5c31af7Sopenharmony_cistatic void evalTexture2DLod (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2D(c, c.in[0].x(), c.in[0].y(), c.in[1].x())*p.scale + p.bias; } 314e5c31af7Sopenharmony_cistatic void evalTextureCubeLod (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = textureCube(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), c.in[1].x())*p.scale + p.bias; } 315e5c31af7Sopenharmony_cistatic void evalTexture2DArrayLod (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DArray(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), c.in[1].x())*p.scale + p.bias; } 316e5c31af7Sopenharmony_cistatic void evalTexture3DLod (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture3D(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), c.in[1].x())*p.scale + p.bias; } 317e5c31af7Sopenharmony_ci 318e5c31af7Sopenharmony_cistatic void evalTexture2DProjLod3 (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2D(c, c.in[0].x()/c.in[0].z(), c.in[0].y()/c.in[0].z(), c.in[1].x())*p.scale + p.bias; } 319e5c31af7Sopenharmony_cistatic void evalTexture2DProjLod (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2D(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[1].x())*p.scale + p.bias; } 320e5c31af7Sopenharmony_cistatic void evalTexture3DProjLod (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture3D(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[0].z()/c.in[0].w(), c.in[1].x())*p.scale + p.bias; } 321e5c31af7Sopenharmony_ci 322e5c31af7Sopenharmony_ci// Offset variants 323e5c31af7Sopenharmony_ci 324e5c31af7Sopenharmony_cistatic void evalTexture2DOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DOffset(c, c.in[0].x(), c.in[0].y(), p.lod, p.offset.swizzle(0,1))*p.scale + p.bias; } 325e5c31af7Sopenharmony_cistatic void evalTexture2DArrayOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DArrayOffset(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod, p.offset.swizzle(0,1))*p.scale + p.bias; } 326e5c31af7Sopenharmony_cistatic void evalTexture3DOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture3DOffset(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod, p.offset)*p.scale + p.bias; } 327e5c31af7Sopenharmony_ci 328e5c31af7Sopenharmony_cistatic void evalTexture2DOffsetBias (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DOffset(c, c.in[0].x(), c.in[0].y(), p.lod+c.in[1].x(), p.offset.swizzle(0,1))*p.scale + p.bias; } 329e5c31af7Sopenharmony_cistatic void evalTexture2DArrayOffsetBias (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DArrayOffset(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod+c.in[1].x(), p.offset.swizzle(0,1))*p.scale + p.bias; } 330e5c31af7Sopenharmony_cistatic void evalTexture3DOffsetBias (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture3DOffset(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod+c.in[1].x(), p.offset)*p.scale + p.bias; } 331e5c31af7Sopenharmony_ci 332e5c31af7Sopenharmony_cistatic void evalTexture2DLodOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DOffset(c, c.in[0].x(), c.in[0].y(), c.in[1].x(), p.offset.swizzle(0,1))*p.scale + p.bias; } 333e5c31af7Sopenharmony_cistatic void evalTexture2DArrayLodOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DArrayOffset(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), c.in[1].x(), p.offset.swizzle(0,1))*p.scale + p.bias; } 334e5c31af7Sopenharmony_cistatic void evalTexture3DLodOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture3DOffset(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), c.in[1].x(), p.offset)*p.scale + p.bias; } 335e5c31af7Sopenharmony_ci 336e5c31af7Sopenharmony_cistatic void evalTexture2DProj3Offset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DOffset(c, c.in[0].x()/c.in[0].z(), c.in[0].y()/c.in[0].z(), p.lod, p.offset.swizzle(0,1))*p.scale + p.bias; } 337e5c31af7Sopenharmony_cistatic void evalTexture2DProj3OffsetBias (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DOffset(c, c.in[0].x()/c.in[0].z(), c.in[0].y()/c.in[0].z(), p.lod+c.in[1].x(), p.offset.swizzle(0,1))*p.scale + p.bias; } 338e5c31af7Sopenharmony_cistatic void evalTexture2DProjOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DOffset(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), p.lod, p.offset.swizzle(0,1))*p.scale + p.bias; } 339e5c31af7Sopenharmony_cistatic void evalTexture2DProjOffsetBias (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DOffset(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), p.lod+c.in[1].x(), p.offset.swizzle(0,1))*p.scale + p.bias; } 340e5c31af7Sopenharmony_cistatic void evalTexture3DProjOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture3DOffset(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[0].z()/c.in[0].w(), p.lod, p.offset)*p.scale + p.bias; } 341e5c31af7Sopenharmony_cistatic void evalTexture3DProjOffsetBias (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture3DOffset(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[0].z()/c.in[0].w(), p.lod+c.in[1].x(), p.offset)*p.scale + p.bias; } 342e5c31af7Sopenharmony_ci 343e5c31af7Sopenharmony_cistatic void evalTexture2DProjLod3Offset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DOffset(c, c.in[0].x()/c.in[0].z(), c.in[0].y()/c.in[0].z(), c.in[1].x(), p.offset.swizzle(0,1))*p.scale + p.bias; } 344e5c31af7Sopenharmony_cistatic void evalTexture2DProjLodOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DOffset(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[1].x(), p.offset.swizzle(0,1))*p.scale + p.bias; } 345e5c31af7Sopenharmony_cistatic void evalTexture3DProjLodOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture3DOffset(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[0].z()/c.in[0].w(), c.in[1].x(), p.offset)*p.scale + p.bias; } 346e5c31af7Sopenharmony_ci 347e5c31af7Sopenharmony_ci// Shadow variants 348e5c31af7Sopenharmony_ci 349e5c31af7Sopenharmony_cistatic void evalTexture2DShadow (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color.x() = texture2DShadow(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), p.lod); } 350e5c31af7Sopenharmony_cistatic void evalTexture2DShadowBias (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color.x() = texture2DShadow(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), p.lod+c.in[1].x()); } 351e5c31af7Sopenharmony_ci 352e5c31af7Sopenharmony_cistatic void evalTextureCubeShadow (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color.x() = textureCubeShadow(c, c.in[0].w(), c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod); } 353e5c31af7Sopenharmony_cistatic void evalTextureCubeShadowBias (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color.x() = textureCubeShadow(c, c.in[0].w(), c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod+c.in[1].x()); } 354e5c31af7Sopenharmony_ci 355e5c31af7Sopenharmony_cistatic void evalTexture2DArrayShadow (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color.x() = texture2DArrayShadow(c, c.in[0].w(), c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod); } 356e5c31af7Sopenharmony_ci 357e5c31af7Sopenharmony_cistatic void evalTexture2DShadowLod (gls::ShaderEvalContext& c, const TexLookupParams&) { c.color.x() = texture2DShadow(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), c.in[1].x()); } 358e5c31af7Sopenharmony_cistatic void evalTexture2DShadowLodOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color.x() = texture2DShadowOffset(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), c.in[1].x(), p.offset.swizzle(0,1)); } 359e5c31af7Sopenharmony_ci 360e5c31af7Sopenharmony_cistatic void evalTexture2DShadowProj (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color.x() = texture2DShadow(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), p.lod); } 361e5c31af7Sopenharmony_cistatic void evalTexture2DShadowProjBias (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color.x() = texture2DShadow(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), p.lod+c.in[1].x()); } 362e5c31af7Sopenharmony_ci 363e5c31af7Sopenharmony_cistatic void evalTexture2DShadowProjLod (gls::ShaderEvalContext& c, const TexLookupParams&) { c.color.x() = texture2DShadow(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[1].x()); } 364e5c31af7Sopenharmony_cistatic void evalTexture2DShadowProjLodOffset(gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color.x() = texture2DShadowOffset(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[1].x(), p.offset.swizzle(0,1)); } 365e5c31af7Sopenharmony_ci 366e5c31af7Sopenharmony_cistatic void evalTexture2DShadowOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color.x() = texture2DShadowOffset(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), p.lod, p.offset.swizzle(0,1)); } 367e5c31af7Sopenharmony_cistatic void evalTexture2DShadowOffsetBias (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color.x() = texture2DShadowOffset(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), p.lod+c.in[1].x(), p.offset.swizzle(0,1)); } 368e5c31af7Sopenharmony_ci 369e5c31af7Sopenharmony_cistatic void evalTexture2DShadowProjOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color.x() = texture2DShadowOffset(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), p.lod, p.offset.swizzle(0,1)); } 370e5c31af7Sopenharmony_cistatic void evalTexture2DShadowProjOffsetBias (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color.x() = texture2DShadowOffset(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), p.lod+c.in[1].x(), p.offset.swizzle(0,1)); } 371e5c31af7Sopenharmony_ci 372e5c31af7Sopenharmony_ci// Gradient variarts 373e5c31af7Sopenharmony_ci 374e5c31af7Sopenharmony_cistatic void evalTexture2DGrad (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2D(c, c.in[0].x(), c.in[0].y(), computeLodFromGrad2D(c))*p.scale + p.bias; } 375e5c31af7Sopenharmony_cistatic void evalTextureCubeGrad (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = textureCube(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), computeLodFromGradCube(c))*p.scale + p.bias; } 376e5c31af7Sopenharmony_cistatic void evalTexture2DArrayGrad (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DArray(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), computeLodFromGrad2DArray(c))*p.scale + p.bias; } 377e5c31af7Sopenharmony_cistatic void evalTexture3DGrad (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture3D(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), computeLodFromGrad3D(c))*p.scale + p.bias; } 378e5c31af7Sopenharmony_ci 379e5c31af7Sopenharmony_cistatic void evalTexture2DShadowGrad (gls::ShaderEvalContext& c, const TexLookupParams&) { c.color.x() = texture2DShadow(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), computeLodFromGrad2D(c)); } 380e5c31af7Sopenharmony_cistatic void evalTextureCubeShadowGrad (gls::ShaderEvalContext& c, const TexLookupParams&) { c.color.x() = textureCubeShadow(c, c.in[0].w(), c.in[0].x(), c.in[0].y(), c.in[0].z(), computeLodFromGradCube(c)); } 381e5c31af7Sopenharmony_cistatic void evalTexture2DArrayShadowGrad (gls::ShaderEvalContext& c, const TexLookupParams&) { c.color.x() = texture2DArrayShadow(c, c.in[0].w(), c.in[0].x(), c.in[0].y(), c.in[0].z(), computeLodFromGrad2DArray(c)); } 382e5c31af7Sopenharmony_ci 383e5c31af7Sopenharmony_cistatic void evalTexture2DGradOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DOffset(c, c.in[0].x(), c.in[0].y(), computeLodFromGrad2D(c), p.offset.swizzle(0,1))*p.scale + p.bias; } 384e5c31af7Sopenharmony_cistatic void evalTexture2DArrayGradOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DArrayOffset(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), computeLodFromGrad2DArray(c), p.offset.swizzle(0,1))*p.scale + p.bias; } 385e5c31af7Sopenharmony_cistatic void evalTexture3DGradOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture3DOffset(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), computeLodFromGrad3D(c), p.offset)*p.scale + p.bias; } 386e5c31af7Sopenharmony_ci 387e5c31af7Sopenharmony_cistatic void evalTexture2DShadowGradOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color.x() = texture2DShadowOffset(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), computeLodFromGrad2D(c), p.offset.swizzle(0,1)); } 388e5c31af7Sopenharmony_cistatic void evalTexture2DArrayShadowGradOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color.x() = texture2DArrayShadowOffset(c, c.in[0].w(), c.in[0].x(), c.in[0].y(), c.in[0].z(), computeLodFromGrad2DArray(c), p.offset.swizzle(0,1)); } 389e5c31af7Sopenharmony_ci 390e5c31af7Sopenharmony_cistatic void evalTexture2DShadowProjGrad (gls::ShaderEvalContext& c, const TexLookupParams&) { c.color.x() = texture2DShadow(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), computeLodFromGrad2D(c)); } 391e5c31af7Sopenharmony_cistatic void evalTexture2DShadowProjGradOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color.x() = texture2DShadowOffset(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), computeLodFromGrad2D(c), p.offset.swizzle(0,1)); } 392e5c31af7Sopenharmony_ci 393e5c31af7Sopenharmony_cistatic void evalTexture2DProjGrad3 (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2D(c, c.in[0].x()/c.in[0].z(), c.in[0].y()/c.in[0].z(), computeLodFromGrad2D(c))*p.scale + p.bias; } 394e5c31af7Sopenharmony_cistatic void evalTexture2DProjGrad (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2D(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), computeLodFromGrad2D(c))*p.scale + p.bias; } 395e5c31af7Sopenharmony_cistatic void evalTexture3DProjGrad (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture3D(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[0].z()/c.in[0].w(), computeLodFromGrad3D(c))*p.scale + p.bias; } 396e5c31af7Sopenharmony_ci 397e5c31af7Sopenharmony_cistatic void evalTexture2DProjGrad3Offset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DOffset(c, c.in[0].x()/c.in[0].z(), c.in[0].y()/c.in[0].z(), computeLodFromGrad2D(c), p.offset.swizzle(0,1))*p.scale + p.bias; } 398e5c31af7Sopenharmony_cistatic void evalTexture2DProjGradOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture2DOffset(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), computeLodFromGrad2D(c), p.offset.swizzle(0,1))*p.scale + p.bias; } 399e5c31af7Sopenharmony_cistatic void evalTexture3DProjGradOffset (gls::ShaderEvalContext& c, const TexLookupParams& p) { c.color = texture3DOffset(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[0].z()/c.in[0].w(), computeLodFromGrad3D(c), p.offset)*p.scale + p.bias; } 400e5c31af7Sopenharmony_ci 401e5c31af7Sopenharmony_ci// Texel fetch variants 402e5c31af7Sopenharmony_ci 403e5c31af7Sopenharmony_cistatic void evalTexelFetch2D (gls::ShaderEvalContext& c, const TexLookupParams& p) 404e5c31af7Sopenharmony_ci{ 405e5c31af7Sopenharmony_ci int x = deChopFloatToInt32(c.in[0].x())+p.offset.x(); 406e5c31af7Sopenharmony_ci int y = deChopFloatToInt32(c.in[0].y())+p.offset.y(); 407e5c31af7Sopenharmony_ci int lod = deChopFloatToInt32(c.in[1].x()); 408e5c31af7Sopenharmony_ci c.color = c.textures[0].tex2D->getLevel(lod).getPixel(x, y)*p.scale + p.bias; 409e5c31af7Sopenharmony_ci} 410e5c31af7Sopenharmony_ci 411e5c31af7Sopenharmony_cistatic void evalTexelFetch2DArray (gls::ShaderEvalContext& c, const TexLookupParams& p) 412e5c31af7Sopenharmony_ci{ 413e5c31af7Sopenharmony_ci int x = deChopFloatToInt32(c.in[0].x())+p.offset.x(); 414e5c31af7Sopenharmony_ci int y = deChopFloatToInt32(c.in[0].y())+p.offset.y(); 415e5c31af7Sopenharmony_ci int l = deChopFloatToInt32(c.in[0].z()); 416e5c31af7Sopenharmony_ci int lod = deChopFloatToInt32(c.in[1].x()); 417e5c31af7Sopenharmony_ci c.color = c.textures[0].tex2DArray->getLevel(lod).getPixel(x, y, l)*p.scale + p.bias; 418e5c31af7Sopenharmony_ci} 419e5c31af7Sopenharmony_ci 420e5c31af7Sopenharmony_cistatic void evalTexelFetch3D (gls::ShaderEvalContext& c, const TexLookupParams& p) 421e5c31af7Sopenharmony_ci{ 422e5c31af7Sopenharmony_ci int x = deChopFloatToInt32(c.in[0].x())+p.offset.x(); 423e5c31af7Sopenharmony_ci int y = deChopFloatToInt32(c.in[0].y())+p.offset.y(); 424e5c31af7Sopenharmony_ci int z = deChopFloatToInt32(c.in[0].z())+p.offset.z(); 425e5c31af7Sopenharmony_ci int lod = deChopFloatToInt32(c.in[1].x()); 426e5c31af7Sopenharmony_ci c.color = c.textures[0].tex3D->getLevel(lod).getPixel(x, y, z)*p.scale + p.bias; 427e5c31af7Sopenharmony_ci} 428e5c31af7Sopenharmony_ci 429e5c31af7Sopenharmony_ciclass TexLookupEvaluator : public gls::ShaderEvaluator 430e5c31af7Sopenharmony_ci{ 431e5c31af7Sopenharmony_cipublic: 432e5c31af7Sopenharmony_ci TexLookupEvaluator (TexEvalFunc evalFunc, const TexLookupParams& lookupParams) : m_evalFunc(evalFunc), m_lookupParams(lookupParams) {} 433e5c31af7Sopenharmony_ci 434e5c31af7Sopenharmony_ci virtual void evaluate (gls::ShaderEvalContext& ctx) { m_evalFunc(ctx, m_lookupParams); } 435e5c31af7Sopenharmony_ci 436e5c31af7Sopenharmony_ciprivate: 437e5c31af7Sopenharmony_ci TexEvalFunc m_evalFunc; 438e5c31af7Sopenharmony_ci const TexLookupParams& m_lookupParams; 439e5c31af7Sopenharmony_ci}; 440e5c31af7Sopenharmony_ci 441e5c31af7Sopenharmony_ciclass ShaderTextureFunctionCase : public gls::ShaderRenderCase 442e5c31af7Sopenharmony_ci{ 443e5c31af7Sopenharmony_cipublic: 444e5c31af7Sopenharmony_ci ShaderTextureFunctionCase (Context& context, const char* name, const char* desc, const TextureLookupSpec& lookup, const TextureSpec& texture, TexEvalFunc evalFunc, bool isVertexCase); 445e5c31af7Sopenharmony_ci ~ShaderTextureFunctionCase (void); 446e5c31af7Sopenharmony_ci 447e5c31af7Sopenharmony_ci void init (void); 448e5c31af7Sopenharmony_ci void deinit (void); 449e5c31af7Sopenharmony_ci 450e5c31af7Sopenharmony_ciprotected: 451e5c31af7Sopenharmony_ci void setupUniforms (int programID, const tcu::Vec4& constCoords); 452e5c31af7Sopenharmony_ci 453e5c31af7Sopenharmony_ciprivate: 454e5c31af7Sopenharmony_ci void initTexture (void); 455e5c31af7Sopenharmony_ci void initShaderSources (void); 456e5c31af7Sopenharmony_ci 457e5c31af7Sopenharmony_ci TextureLookupSpec m_lookupSpec; 458e5c31af7Sopenharmony_ci TextureSpec m_textureSpec; 459e5c31af7Sopenharmony_ci 460e5c31af7Sopenharmony_ci TexLookupParams m_lookupParams; 461e5c31af7Sopenharmony_ci TexLookupEvaluator m_evaluator; 462e5c31af7Sopenharmony_ci 463e5c31af7Sopenharmony_ci glu::Texture2D* m_texture2D; 464e5c31af7Sopenharmony_ci glu::TextureCube* m_textureCube; 465e5c31af7Sopenharmony_ci glu::Texture2DArray* m_texture2DArray; 466e5c31af7Sopenharmony_ci glu::Texture3D* m_texture3D; 467e5c31af7Sopenharmony_ci}; 468e5c31af7Sopenharmony_ci 469e5c31af7Sopenharmony_ciShaderTextureFunctionCase::ShaderTextureFunctionCase (Context& context, const char* name, const char* desc, const TextureLookupSpec& lookup, const TextureSpec& texture, TexEvalFunc evalFunc, bool isVertexCase) 470e5c31af7Sopenharmony_ci : gls::ShaderRenderCase(context.getTestContext(), context.getRenderContext(), context.getContextInfo(), name, desc, isVertexCase, m_evaluator) 471e5c31af7Sopenharmony_ci , m_lookupSpec (lookup) 472e5c31af7Sopenharmony_ci , m_textureSpec (texture) 473e5c31af7Sopenharmony_ci , m_evaluator (evalFunc, m_lookupParams) 474e5c31af7Sopenharmony_ci , m_texture2D (DE_NULL) 475e5c31af7Sopenharmony_ci , m_textureCube (DE_NULL) 476e5c31af7Sopenharmony_ci , m_texture2DArray (DE_NULL) 477e5c31af7Sopenharmony_ci , m_texture3D (DE_NULL) 478e5c31af7Sopenharmony_ci{ 479e5c31af7Sopenharmony_ci} 480e5c31af7Sopenharmony_ci 481e5c31af7Sopenharmony_ciShaderTextureFunctionCase::~ShaderTextureFunctionCase (void) 482e5c31af7Sopenharmony_ci{ 483e5c31af7Sopenharmony_ci delete m_texture2D; 484e5c31af7Sopenharmony_ci delete m_textureCube; 485e5c31af7Sopenharmony_ci delete m_texture2DArray; 486e5c31af7Sopenharmony_ci delete m_texture3D; 487e5c31af7Sopenharmony_ci} 488e5c31af7Sopenharmony_ci 489e5c31af7Sopenharmony_civoid ShaderTextureFunctionCase::init (void) 490e5c31af7Sopenharmony_ci{ 491e5c31af7Sopenharmony_ci { 492e5c31af7Sopenharmony_ci // Base coord scale & bias 493e5c31af7Sopenharmony_ci Vec4 s = m_lookupSpec.maxCoord-m_lookupSpec.minCoord; 494e5c31af7Sopenharmony_ci Vec4 b = m_lookupSpec.minCoord; 495e5c31af7Sopenharmony_ci 496e5c31af7Sopenharmony_ci float baseCoordTrans[] = 497e5c31af7Sopenharmony_ci { 498e5c31af7Sopenharmony_ci s.x(), 0.0f, 0.f, b.x(), 499e5c31af7Sopenharmony_ci 0.f, s.y(), 0.f, b.y(), 500e5c31af7Sopenharmony_ci s.z()/2.f, -s.z()/2.f, 0.f, s.z()/2.f + b.z(), 501e5c31af7Sopenharmony_ci -s.w()/2.f, s.w()/2.f, 0.f, s.w()/2.f + b.w() 502e5c31af7Sopenharmony_ci }; 503e5c31af7Sopenharmony_ci 504e5c31af7Sopenharmony_ci m_userAttribTransforms.push_back(tcu::Mat4(baseCoordTrans)); 505e5c31af7Sopenharmony_ci } 506e5c31af7Sopenharmony_ci 507e5c31af7Sopenharmony_ci bool hasLodBias = functionHasLod(m_lookupSpec.function) || m_lookupSpec.useBias; 508e5c31af7Sopenharmony_ci bool isGrad = functionHasGrad(m_lookupSpec.function); 509e5c31af7Sopenharmony_ci DE_ASSERT(!isGrad || !hasLodBias); 510e5c31af7Sopenharmony_ci 511e5c31af7Sopenharmony_ci if (hasLodBias) 512e5c31af7Sopenharmony_ci { 513e5c31af7Sopenharmony_ci float s = m_lookupSpec.maxLodBias-m_lookupSpec.minLodBias; 514e5c31af7Sopenharmony_ci float b = m_lookupSpec.minLodBias; 515e5c31af7Sopenharmony_ci float lodCoordTrans[] = 516e5c31af7Sopenharmony_ci { 517e5c31af7Sopenharmony_ci s/2.0f, s/2.0f, 0.f, b, 518e5c31af7Sopenharmony_ci 0.0f, 0.0f, 0.0f, 0.0f, 519e5c31af7Sopenharmony_ci 0.0f, 0.0f, 0.0f, 0.0f, 520e5c31af7Sopenharmony_ci 0.0f, 0.0f, 0.0f, 0.0f 521e5c31af7Sopenharmony_ci }; 522e5c31af7Sopenharmony_ci 523e5c31af7Sopenharmony_ci m_userAttribTransforms.push_back(tcu::Mat4(lodCoordTrans)); 524e5c31af7Sopenharmony_ci } 525e5c31af7Sopenharmony_ci else if (isGrad) 526e5c31af7Sopenharmony_ci { 527e5c31af7Sopenharmony_ci Vec3 sx = m_lookupSpec.maxDX-m_lookupSpec.minDX; 528e5c31af7Sopenharmony_ci Vec3 sy = m_lookupSpec.maxDY-m_lookupSpec.minDY; 529e5c31af7Sopenharmony_ci float gradDxTrans[] = 530e5c31af7Sopenharmony_ci { 531e5c31af7Sopenharmony_ci sx.x()/2.0f, sx.x()/2.0f, 0.f, m_lookupSpec.minDX.x(), 532e5c31af7Sopenharmony_ci sx.y()/2.0f, sx.y()/2.0f, 0.0f, m_lookupSpec.minDX.y(), 533e5c31af7Sopenharmony_ci sx.z()/2.0f, sx.z()/2.0f, 0.0f, m_lookupSpec.minDX.z(), 534e5c31af7Sopenharmony_ci 0.0f, 0.0f, 0.0f, 0.0f 535e5c31af7Sopenharmony_ci }; 536e5c31af7Sopenharmony_ci float gradDyTrans[] = 537e5c31af7Sopenharmony_ci { 538e5c31af7Sopenharmony_ci -sy.x()/2.0f, -sy.x()/2.0f, 0.f, m_lookupSpec.maxDY.x(), 539e5c31af7Sopenharmony_ci -sy.y()/2.0f, -sy.y()/2.0f, 0.0f, m_lookupSpec.maxDY.y(), 540e5c31af7Sopenharmony_ci -sy.z()/2.0f, -sy.z()/2.0f, 0.0f, m_lookupSpec.maxDY.z(), 541e5c31af7Sopenharmony_ci 0.0f, 0.0f, 0.0f, 0.0f 542e5c31af7Sopenharmony_ci }; 543e5c31af7Sopenharmony_ci 544e5c31af7Sopenharmony_ci m_userAttribTransforms.push_back(tcu::Mat4(gradDxTrans)); 545e5c31af7Sopenharmony_ci m_userAttribTransforms.push_back(tcu::Mat4(gradDyTrans)); 546e5c31af7Sopenharmony_ci } 547e5c31af7Sopenharmony_ci 548e5c31af7Sopenharmony_ci initShaderSources(); 549e5c31af7Sopenharmony_ci initTexture(); 550e5c31af7Sopenharmony_ci 551e5c31af7Sopenharmony_ci gls::ShaderRenderCase::init(); 552e5c31af7Sopenharmony_ci} 553e5c31af7Sopenharmony_ci 554e5c31af7Sopenharmony_civoid ShaderTextureFunctionCase::initTexture (void) 555e5c31af7Sopenharmony_ci{ 556e5c31af7Sopenharmony_ci static const IVec4 texCubeSwz[] = 557e5c31af7Sopenharmony_ci { 558e5c31af7Sopenharmony_ci IVec4(0,0,1,1), 559e5c31af7Sopenharmony_ci IVec4(1,1,0,0), 560e5c31af7Sopenharmony_ci IVec4(0,1,0,1), 561e5c31af7Sopenharmony_ci IVec4(1,0,1,0), 562e5c31af7Sopenharmony_ci IVec4(0,1,1,0), 563e5c31af7Sopenharmony_ci IVec4(1,0,0,1) 564e5c31af7Sopenharmony_ci }; 565e5c31af7Sopenharmony_ci DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(texCubeSwz) == tcu::CUBEFACE_LAST); 566e5c31af7Sopenharmony_ci 567e5c31af7Sopenharmony_ci tcu::TextureFormat texFmt = glu::mapGLInternalFormat(m_textureSpec.format); 568e5c31af7Sopenharmony_ci tcu::TextureFormatInfo fmtInfo = tcu::getTextureFormatInfo(texFmt); 569e5c31af7Sopenharmony_ci tcu::IVec2 viewportSize = getViewportSize(); 570e5c31af7Sopenharmony_ci bool useProj = functionHasProj(m_lookupSpec.function) && !functionHasGrad(m_lookupSpec.function) && !functionHasLod(m_lookupSpec.function); 571e5c31af7Sopenharmony_ci bool isAutoLod = functionHasAutoLod(m_isVertexCase ? glu::SHADERTYPE_VERTEX : glu::SHADERTYPE_FRAGMENT, 572e5c31af7Sopenharmony_ci m_lookupSpec.function); // LOD can vary significantly 573e5c31af7Sopenharmony_ci float proj = useProj ? 1.0f / m_lookupSpec.minCoord[m_lookupSpec.function == FUNCTION_TEXTUREPROJ3 ? 2 : 3] : 1.0f; 574e5c31af7Sopenharmony_ci 575e5c31af7Sopenharmony_ci switch (m_textureSpec.type) 576e5c31af7Sopenharmony_ci { 577e5c31af7Sopenharmony_ci case TEXTURETYPE_2D: 578e5c31af7Sopenharmony_ci { 579e5c31af7Sopenharmony_ci float levelStep = isAutoLod ? 0.0f : 1.0f / (float)de::max(1, m_textureSpec.numLevels-1); 580e5c31af7Sopenharmony_ci Vec4 cScale = fmtInfo.valueMax-fmtInfo.valueMin; 581e5c31af7Sopenharmony_ci Vec4 cBias = fmtInfo.valueMin; 582e5c31af7Sopenharmony_ci int baseCellSize = de::min(m_textureSpec.width/4, m_textureSpec.height/4); 583e5c31af7Sopenharmony_ci 584e5c31af7Sopenharmony_ci m_texture2D = new glu::Texture2D(m_renderCtx, m_textureSpec.format, m_textureSpec.width, m_textureSpec.height); 585e5c31af7Sopenharmony_ci for (int level = 0; level < m_textureSpec.numLevels; level++) 586e5c31af7Sopenharmony_ci { 587e5c31af7Sopenharmony_ci float fA = float(level)*levelStep; 588e5c31af7Sopenharmony_ci float fB = 1.0f-fA; 589e5c31af7Sopenharmony_ci Vec4 colorA = cBias + cScale*Vec4(fA, fB, fA, fB); 590e5c31af7Sopenharmony_ci Vec4 colorB = cBias + cScale*Vec4(fB, fA, fB, fA); 591e5c31af7Sopenharmony_ci 592e5c31af7Sopenharmony_ci m_texture2D->getRefTexture().allocLevel(level); 593e5c31af7Sopenharmony_ci tcu::fillWithGrid(m_texture2D->getRefTexture().getLevel(level), de::max(1, baseCellSize>>level), colorA, colorB); 594e5c31af7Sopenharmony_ci } 595e5c31af7Sopenharmony_ci m_texture2D->upload(); 596e5c31af7Sopenharmony_ci 597e5c31af7Sopenharmony_ci // Compute LOD. 598e5c31af7Sopenharmony_ci float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*(float)m_textureSpec.width / (float)viewportSize[0]; 599e5c31af7Sopenharmony_ci float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*(float)m_textureSpec.height / (float)viewportSize[1]; 600e5c31af7Sopenharmony_ci m_lookupParams.lod = computeLodFromDerivates(DEFAULT_LOD_MODE, dudx, 0.0f, 0.0f, dvdy); 601e5c31af7Sopenharmony_ci 602e5c31af7Sopenharmony_ci // Append to texture list. 603e5c31af7Sopenharmony_ci m_textures.push_back(gls::TextureBinding(m_texture2D, m_textureSpec.sampler)); 604e5c31af7Sopenharmony_ci break; 605e5c31af7Sopenharmony_ci } 606e5c31af7Sopenharmony_ci 607e5c31af7Sopenharmony_ci case TEXTURETYPE_CUBE_MAP: 608e5c31af7Sopenharmony_ci { 609e5c31af7Sopenharmony_ci float levelStep = isAutoLod ? 0.0f : 1.0f / (float)de::max(1, m_textureSpec.numLevels-1); 610e5c31af7Sopenharmony_ci Vec4 cScale = fmtInfo.valueMax-fmtInfo.valueMin; 611e5c31af7Sopenharmony_ci Vec4 cBias = fmtInfo.valueMin; 612e5c31af7Sopenharmony_ci Vec4 cCorner = cBias + cScale*0.5f; 613e5c31af7Sopenharmony_ci int baseCellSize = de::min(m_textureSpec.width/4, m_textureSpec.height/4); 614e5c31af7Sopenharmony_ci 615e5c31af7Sopenharmony_ci DE_ASSERT(m_textureSpec.width == m_textureSpec.height); 616e5c31af7Sopenharmony_ci m_textureCube = new glu::TextureCube(m_renderCtx, m_textureSpec.format, m_textureSpec.width); 617e5c31af7Sopenharmony_ci for (int level = 0; level < m_textureSpec.numLevels; level++) 618e5c31af7Sopenharmony_ci { 619e5c31af7Sopenharmony_ci float fA = float(level)*levelStep; 620e5c31af7Sopenharmony_ci float fB = 1.0f-fA; 621e5c31af7Sopenharmony_ci Vec2 f (fA, fB); 622e5c31af7Sopenharmony_ci 623e5c31af7Sopenharmony_ci for (int face = 0; face < tcu::CUBEFACE_LAST; face++) 624e5c31af7Sopenharmony_ci { 625e5c31af7Sopenharmony_ci const IVec4& swzA = texCubeSwz[face]; 626e5c31af7Sopenharmony_ci IVec4 swzB = 1-swzA; 627e5c31af7Sopenharmony_ci Vec4 colorA = cBias + cScale*f.swizzle(swzA[0], swzA[1], swzA[2], swzA[3]); 628e5c31af7Sopenharmony_ci Vec4 colorB = cBias + cScale*f.swizzle(swzB[0], swzB[1], swzB[2], swzB[3]); 629e5c31af7Sopenharmony_ci 630e5c31af7Sopenharmony_ci m_textureCube->getRefTexture().allocLevel((tcu::CubeFace)face, level); 631e5c31af7Sopenharmony_ci 632e5c31af7Sopenharmony_ci { 633e5c31af7Sopenharmony_ci const tcu::PixelBufferAccess access = m_textureCube->getRefTexture().getLevelFace(level, (tcu::CubeFace)face); 634e5c31af7Sopenharmony_ci const int lastPix = access.getWidth()-1; 635e5c31af7Sopenharmony_ci 636e5c31af7Sopenharmony_ci tcu::fillWithGrid(access, de::max(1, baseCellSize>>level), colorA, colorB); 637e5c31af7Sopenharmony_ci 638e5c31af7Sopenharmony_ci // Ensure all corners have identical colors in order to avoid dealing with ambiguous corner texel filtering 639e5c31af7Sopenharmony_ci access.setPixel(cCorner, 0, 0); 640e5c31af7Sopenharmony_ci access.setPixel(cCorner, 0, lastPix); 641e5c31af7Sopenharmony_ci access.setPixel(cCorner, lastPix, 0); 642e5c31af7Sopenharmony_ci access.setPixel(cCorner, lastPix, lastPix); 643e5c31af7Sopenharmony_ci } 644e5c31af7Sopenharmony_ci } 645e5c31af7Sopenharmony_ci } 646e5c31af7Sopenharmony_ci m_textureCube->upload(); 647e5c31af7Sopenharmony_ci 648e5c31af7Sopenharmony_ci // Compute LOD \note Assumes that only single side is accessed and R is constant major axis. 649e5c31af7Sopenharmony_ci DE_ASSERT(de::abs(m_lookupSpec.minCoord[2] - m_lookupSpec.maxCoord[2]) < 0.005); 650e5c31af7Sopenharmony_ci DE_ASSERT(de::abs(m_lookupSpec.minCoord[0]) < de::abs(m_lookupSpec.minCoord[2]) && de::abs(m_lookupSpec.maxCoord[0]) < de::abs(m_lookupSpec.minCoord[2])); 651e5c31af7Sopenharmony_ci DE_ASSERT(de::abs(m_lookupSpec.minCoord[1]) < de::abs(m_lookupSpec.minCoord[2]) && de::abs(m_lookupSpec.maxCoord[1]) < de::abs(m_lookupSpec.minCoord[2])); 652e5c31af7Sopenharmony_ci 653e5c31af7Sopenharmony_ci tcu::CubeFaceFloatCoords c00 = tcu::getCubeFaceCoords(Vec3(m_lookupSpec.minCoord[0]*proj, m_lookupSpec.minCoord[1]*proj, m_lookupSpec.minCoord[2]*proj)); 654e5c31af7Sopenharmony_ci tcu::CubeFaceFloatCoords c10 = tcu::getCubeFaceCoords(Vec3(m_lookupSpec.maxCoord[0]*proj, m_lookupSpec.minCoord[1]*proj, m_lookupSpec.minCoord[2]*proj)); 655e5c31af7Sopenharmony_ci tcu::CubeFaceFloatCoords c01 = tcu::getCubeFaceCoords(Vec3(m_lookupSpec.minCoord[0]*proj, m_lookupSpec.maxCoord[1]*proj, m_lookupSpec.minCoord[2]*proj)); 656e5c31af7Sopenharmony_ci float dudx = (c10.s - c00.s)*(float)m_textureSpec.width / (float)viewportSize[0]; 657e5c31af7Sopenharmony_ci float dvdy = (c01.t - c00.t)*(float)m_textureSpec.height / (float)viewportSize[1]; 658e5c31af7Sopenharmony_ci 659e5c31af7Sopenharmony_ci m_lookupParams.lod = computeLodFromDerivates(DEFAULT_LOD_MODE, dudx, 0.0f, 0.0f, dvdy); 660e5c31af7Sopenharmony_ci 661e5c31af7Sopenharmony_ci m_textures.push_back(gls::TextureBinding(m_textureCube, m_textureSpec.sampler)); 662e5c31af7Sopenharmony_ci break; 663e5c31af7Sopenharmony_ci } 664e5c31af7Sopenharmony_ci 665e5c31af7Sopenharmony_ci case TEXTURETYPE_2D_ARRAY: 666e5c31af7Sopenharmony_ci { 667e5c31af7Sopenharmony_ci float layerStep = 1.0f / (float)m_textureSpec.depth; 668e5c31af7Sopenharmony_ci float levelStep = isAutoLod ? 0.0f : 1.0f / (float)(de::max(1, m_textureSpec.numLevels-1)*m_textureSpec.depth); 669e5c31af7Sopenharmony_ci Vec4 cScale = fmtInfo.valueMax-fmtInfo.valueMin; 670e5c31af7Sopenharmony_ci Vec4 cBias = fmtInfo.valueMin; 671e5c31af7Sopenharmony_ci int baseCellSize = de::min(m_textureSpec.width/4, m_textureSpec.height/4); 672e5c31af7Sopenharmony_ci 673e5c31af7Sopenharmony_ci m_texture2DArray = new glu::Texture2DArray(m_renderCtx, m_textureSpec.format, m_textureSpec.width, m_textureSpec.height, m_textureSpec.depth); 674e5c31af7Sopenharmony_ci for (int level = 0; level < m_textureSpec.numLevels; level++) 675e5c31af7Sopenharmony_ci { 676e5c31af7Sopenharmony_ci m_texture2DArray->getRefTexture().allocLevel(level); 677e5c31af7Sopenharmony_ci tcu::PixelBufferAccess levelAccess = m_texture2DArray->getRefTexture().getLevel(level); 678e5c31af7Sopenharmony_ci 679e5c31af7Sopenharmony_ci for (int layer = 0; layer < levelAccess.getDepth(); layer++) 680e5c31af7Sopenharmony_ci { 681e5c31af7Sopenharmony_ci float fA = (float)layer*layerStep + (float)level*levelStep; 682e5c31af7Sopenharmony_ci float fB = 1.0f-fA; 683e5c31af7Sopenharmony_ci Vec4 colorA = cBias + cScale*Vec4(fA, fB, fA, fB); 684e5c31af7Sopenharmony_ci Vec4 colorB = cBias + cScale*Vec4(fB, fA, fB, fA); 685e5c31af7Sopenharmony_ci 686e5c31af7Sopenharmony_ci tcu::fillWithGrid(tcu::getSubregion(levelAccess, 0, 0, layer, levelAccess.getWidth(), levelAccess.getHeight(), 1), de::max(1, baseCellSize>>level), colorA, colorB); 687e5c31af7Sopenharmony_ci } 688e5c31af7Sopenharmony_ci } 689e5c31af7Sopenharmony_ci m_texture2DArray->upload(); 690e5c31af7Sopenharmony_ci 691e5c31af7Sopenharmony_ci // Compute LOD. 692e5c31af7Sopenharmony_ci float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*(float)m_textureSpec.width / (float)viewportSize[0]; 693e5c31af7Sopenharmony_ci float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*(float)m_textureSpec.height / (float)viewportSize[1]; 694e5c31af7Sopenharmony_ci m_lookupParams.lod = computeLodFromDerivates(DEFAULT_LOD_MODE, dudx, 0.0f, 0.0f, dvdy); 695e5c31af7Sopenharmony_ci 696e5c31af7Sopenharmony_ci // Append to texture list. 697e5c31af7Sopenharmony_ci m_textures.push_back(gls::TextureBinding(m_texture2DArray, m_textureSpec.sampler)); 698e5c31af7Sopenharmony_ci break; 699e5c31af7Sopenharmony_ci } 700e5c31af7Sopenharmony_ci 701e5c31af7Sopenharmony_ci case TEXTURETYPE_3D: 702e5c31af7Sopenharmony_ci { 703e5c31af7Sopenharmony_ci float levelStep = isAutoLod ? 0.0f : 1.0f / (float)de::max(1, m_textureSpec.numLevels-1); 704e5c31af7Sopenharmony_ci Vec4 cScale = fmtInfo.valueMax-fmtInfo.valueMin; 705e5c31af7Sopenharmony_ci Vec4 cBias = fmtInfo.valueMin; 706e5c31af7Sopenharmony_ci int baseCellSize = de::min(de::min(m_textureSpec.width/2, m_textureSpec.height/2), m_textureSpec.depth/2); 707e5c31af7Sopenharmony_ci 708e5c31af7Sopenharmony_ci m_texture3D = new glu::Texture3D(m_renderCtx, m_textureSpec.format, m_textureSpec.width, m_textureSpec.height, m_textureSpec.depth); 709e5c31af7Sopenharmony_ci for (int level = 0; level < m_textureSpec.numLevels; level++) 710e5c31af7Sopenharmony_ci { 711e5c31af7Sopenharmony_ci float fA = (float)level*levelStep; 712e5c31af7Sopenharmony_ci float fB = 1.0f-fA; 713e5c31af7Sopenharmony_ci Vec4 colorA = cBias + cScale*Vec4(fA, fB, fA, fB); 714e5c31af7Sopenharmony_ci Vec4 colorB = cBias + cScale*Vec4(fB, fA, fB, fA); 715e5c31af7Sopenharmony_ci 716e5c31af7Sopenharmony_ci m_texture3D->getRefTexture().allocLevel(level); 717e5c31af7Sopenharmony_ci tcu::fillWithGrid(m_texture3D->getRefTexture().getLevel(level), de::max(1, baseCellSize>>level), colorA, colorB); 718e5c31af7Sopenharmony_ci } 719e5c31af7Sopenharmony_ci m_texture3D->upload(); 720e5c31af7Sopenharmony_ci 721e5c31af7Sopenharmony_ci // Compute LOD. 722e5c31af7Sopenharmony_ci float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*(float)m_textureSpec.width / (float)viewportSize[0]; 723e5c31af7Sopenharmony_ci float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*(float)m_textureSpec.height / (float)viewportSize[1]; 724e5c31af7Sopenharmony_ci float dwdx = (m_lookupSpec.maxCoord[2]-m_lookupSpec.minCoord[2])*0.5f*proj*(float)m_textureSpec.depth / (float)viewportSize[0]; 725e5c31af7Sopenharmony_ci float dwdy = (m_lookupSpec.maxCoord[2]-m_lookupSpec.minCoord[2])*0.5f*proj*(float)m_textureSpec.depth / (float)viewportSize[1]; 726e5c31af7Sopenharmony_ci m_lookupParams.lod = computeLodFromDerivates(DEFAULT_LOD_MODE, dudx, 0.0f, dwdx, 0.0f, dvdy, dwdy); 727e5c31af7Sopenharmony_ci 728e5c31af7Sopenharmony_ci // Append to texture list. 729e5c31af7Sopenharmony_ci m_textures.push_back(gls::TextureBinding(m_texture3D, m_textureSpec.sampler)); 730e5c31af7Sopenharmony_ci break; 731e5c31af7Sopenharmony_ci } 732e5c31af7Sopenharmony_ci 733e5c31af7Sopenharmony_ci default: 734e5c31af7Sopenharmony_ci DE_ASSERT(DE_FALSE); 735e5c31af7Sopenharmony_ci } 736e5c31af7Sopenharmony_ci 737e5c31af7Sopenharmony_ci // Set lookup scale & bias 738e5c31af7Sopenharmony_ci m_lookupParams.scale = fmtInfo.lookupScale; 739e5c31af7Sopenharmony_ci m_lookupParams.bias = fmtInfo.lookupBias; 740e5c31af7Sopenharmony_ci m_lookupParams.offset = m_lookupSpec.offset; 741e5c31af7Sopenharmony_ci} 742e5c31af7Sopenharmony_ci 743e5c31af7Sopenharmony_civoid ShaderTextureFunctionCase::initShaderSources (void) 744e5c31af7Sopenharmony_ci{ 745e5c31af7Sopenharmony_ci Function function = m_lookupSpec.function; 746e5c31af7Sopenharmony_ci bool isVtxCase = m_isVertexCase; 747e5c31af7Sopenharmony_ci bool isProj = functionHasProj(function); 748e5c31af7Sopenharmony_ci bool isGrad = functionHasGrad(function); 749e5c31af7Sopenharmony_ci bool isShadow = m_textureSpec.sampler.compare != tcu::Sampler::COMPAREMODE_NONE; 750e5c31af7Sopenharmony_ci bool is2DProj4 = !isShadow && m_textureSpec.type == TEXTURETYPE_2D && (function == FUNCTION_TEXTUREPROJ || function == FUNCTION_TEXTUREPROJLOD || function == FUNCTION_TEXTUREPROJGRAD); 751e5c31af7Sopenharmony_ci bool isIntCoord = function == FUNCTION_TEXELFETCH; 752e5c31af7Sopenharmony_ci bool hasLodBias = functionHasLod(m_lookupSpec.function) || m_lookupSpec.useBias; 753e5c31af7Sopenharmony_ci int texCoordComps = m_textureSpec.type == TEXTURETYPE_2D ? 2 : 3; 754e5c31af7Sopenharmony_ci int extraCoordComps = (isProj ? (is2DProj4 ? 2 : 1) : 0) + (isShadow ? 1 : 0); 755e5c31af7Sopenharmony_ci glu::DataType coordType = glu::getDataTypeFloatVec(texCoordComps+extraCoordComps); 756e5c31af7Sopenharmony_ci glu::Precision coordPrec = glu::PRECISION_HIGHP; 757e5c31af7Sopenharmony_ci const char* coordTypeName = glu::getDataTypeName(coordType); 758e5c31af7Sopenharmony_ci const char* coordPrecName = glu::getPrecisionName(coordPrec); 759e5c31af7Sopenharmony_ci tcu::TextureFormat texFmt = glu::mapGLInternalFormat(m_textureSpec.format); 760e5c31af7Sopenharmony_ci glu::DataType samplerType = glu::TYPE_LAST; 761e5c31af7Sopenharmony_ci glu::DataType gradType = (m_textureSpec.type == TEXTURETYPE_CUBE_MAP || m_textureSpec.type == TEXTURETYPE_3D) ? glu::TYPE_FLOAT_VEC3 : glu::TYPE_FLOAT_VEC2; 762e5c31af7Sopenharmony_ci const char* gradTypeName = glu::getDataTypeName(gradType); 763e5c31af7Sopenharmony_ci const char* baseFuncName = DE_NULL; 764e5c31af7Sopenharmony_ci 765e5c31af7Sopenharmony_ci DE_ASSERT(!isGrad || !hasLodBias); 766e5c31af7Sopenharmony_ci 767e5c31af7Sopenharmony_ci switch (m_textureSpec.type) 768e5c31af7Sopenharmony_ci { 769e5c31af7Sopenharmony_ci case TEXTURETYPE_2D: samplerType = isShadow ? glu::TYPE_SAMPLER_2D_SHADOW : glu::getSampler2DType(texFmt); break; 770e5c31af7Sopenharmony_ci case TEXTURETYPE_CUBE_MAP: samplerType = isShadow ? glu::TYPE_SAMPLER_CUBE_SHADOW : glu::getSamplerCubeType(texFmt); break; 771e5c31af7Sopenharmony_ci case TEXTURETYPE_2D_ARRAY: samplerType = isShadow ? glu::TYPE_SAMPLER_2D_ARRAY_SHADOW : glu::getSampler2DArrayType(texFmt); break; 772e5c31af7Sopenharmony_ci case TEXTURETYPE_3D: DE_ASSERT(!isShadow); samplerType = glu::getSampler3DType(texFmt); break; 773e5c31af7Sopenharmony_ci default: 774e5c31af7Sopenharmony_ci DE_ASSERT(DE_FALSE); 775e5c31af7Sopenharmony_ci } 776e5c31af7Sopenharmony_ci 777e5c31af7Sopenharmony_ci switch (m_lookupSpec.function) 778e5c31af7Sopenharmony_ci { 779e5c31af7Sopenharmony_ci case FUNCTION_TEXTURE: baseFuncName = "texture"; break; 780e5c31af7Sopenharmony_ci case FUNCTION_TEXTUREPROJ: baseFuncName = "textureProj"; break; 781e5c31af7Sopenharmony_ci case FUNCTION_TEXTUREPROJ3: baseFuncName = "textureProj"; break; 782e5c31af7Sopenharmony_ci case FUNCTION_TEXTURELOD: baseFuncName = "textureLod"; break; 783e5c31af7Sopenharmony_ci case FUNCTION_TEXTUREPROJLOD: baseFuncName = "textureProjLod"; break; 784e5c31af7Sopenharmony_ci case FUNCTION_TEXTUREPROJLOD3: baseFuncName = "textureProjLod"; break; 785e5c31af7Sopenharmony_ci case FUNCTION_TEXTUREGRAD: baseFuncName = "textureGrad"; break; 786e5c31af7Sopenharmony_ci case FUNCTION_TEXTUREPROJGRAD: baseFuncName = "textureProjGrad"; break; 787e5c31af7Sopenharmony_ci case FUNCTION_TEXTUREPROJGRAD3: baseFuncName = "textureProjGrad"; break; 788e5c31af7Sopenharmony_ci case FUNCTION_TEXELFETCH: baseFuncName = "texelFetch"; break; 789e5c31af7Sopenharmony_ci default: 790e5c31af7Sopenharmony_ci DE_ASSERT(DE_FALSE); 791e5c31af7Sopenharmony_ci } 792e5c31af7Sopenharmony_ci 793e5c31af7Sopenharmony_ci std::ostringstream vert; 794e5c31af7Sopenharmony_ci std::ostringstream frag; 795e5c31af7Sopenharmony_ci std::ostringstream& op = isVtxCase ? vert : frag; 796e5c31af7Sopenharmony_ci 797e5c31af7Sopenharmony_ci vert << "#version 300 es\n" 798e5c31af7Sopenharmony_ci << "in highp vec4 a_position;\n" 799e5c31af7Sopenharmony_ci << "in " << coordPrecName << " " << coordTypeName << " a_in0;\n"; 800e5c31af7Sopenharmony_ci 801e5c31af7Sopenharmony_ci if (isGrad) 802e5c31af7Sopenharmony_ci { 803e5c31af7Sopenharmony_ci vert << "in " << coordPrecName << " " << gradTypeName << " a_in1;\n"; 804e5c31af7Sopenharmony_ci vert << "in " << coordPrecName << " " << gradTypeName << " a_in2;\n"; 805e5c31af7Sopenharmony_ci } 806e5c31af7Sopenharmony_ci else if (hasLodBias) 807e5c31af7Sopenharmony_ci vert << "in " << coordPrecName << " float a_in1;\n"; 808e5c31af7Sopenharmony_ci 809e5c31af7Sopenharmony_ci frag << "#version 300 es\n" 810e5c31af7Sopenharmony_ci << "layout(location = 0) out mediump vec4 o_color;\n"; 811e5c31af7Sopenharmony_ci 812e5c31af7Sopenharmony_ci if (isVtxCase) 813e5c31af7Sopenharmony_ci { 814e5c31af7Sopenharmony_ci vert << "out mediump vec4 v_color;\n"; 815e5c31af7Sopenharmony_ci frag << "in mediump vec4 v_color;\n"; 816e5c31af7Sopenharmony_ci } 817e5c31af7Sopenharmony_ci else 818e5c31af7Sopenharmony_ci { 819e5c31af7Sopenharmony_ci vert << "out " << coordPrecName << " " << coordTypeName << " v_texCoord;\n"; 820e5c31af7Sopenharmony_ci frag << "in " << coordPrecName << " " << coordTypeName << " v_texCoord;\n"; 821e5c31af7Sopenharmony_ci 822e5c31af7Sopenharmony_ci if (isGrad) 823e5c31af7Sopenharmony_ci { 824e5c31af7Sopenharmony_ci vert << "out " << coordPrecName << " " << gradTypeName << " v_gradX;\n"; 825e5c31af7Sopenharmony_ci vert << "out " << coordPrecName << " " << gradTypeName << " v_gradY;\n"; 826e5c31af7Sopenharmony_ci frag << "in " << coordPrecName << " " << gradTypeName << " v_gradX;\n"; 827e5c31af7Sopenharmony_ci frag << "in " << coordPrecName << " " << gradTypeName << " v_gradY;\n"; 828e5c31af7Sopenharmony_ci } 829e5c31af7Sopenharmony_ci 830e5c31af7Sopenharmony_ci if (hasLodBias) 831e5c31af7Sopenharmony_ci { 832e5c31af7Sopenharmony_ci vert << "out " << coordPrecName << " float v_lodBias;\n"; 833e5c31af7Sopenharmony_ci frag << "in " << coordPrecName << " float v_lodBias;\n"; 834e5c31af7Sopenharmony_ci } 835e5c31af7Sopenharmony_ci } 836e5c31af7Sopenharmony_ci 837e5c31af7Sopenharmony_ci // Uniforms 838e5c31af7Sopenharmony_ci op << "uniform highp " << glu::getDataTypeName(samplerType) << " u_sampler;\n" 839e5c31af7Sopenharmony_ci << "uniform highp vec4 u_scale;\n" 840e5c31af7Sopenharmony_ci << "uniform highp vec4 u_bias;\n"; 841e5c31af7Sopenharmony_ci 842e5c31af7Sopenharmony_ci vert << "\nvoid main()\n{\n" 843e5c31af7Sopenharmony_ci << "\tgl_Position = a_position;\n"; 844e5c31af7Sopenharmony_ci frag << "\nvoid main()\n{\n"; 845e5c31af7Sopenharmony_ci 846e5c31af7Sopenharmony_ci if (isVtxCase) 847e5c31af7Sopenharmony_ci vert << "\tv_color = "; 848e5c31af7Sopenharmony_ci else 849e5c31af7Sopenharmony_ci frag << "\to_color = "; 850e5c31af7Sopenharmony_ci 851e5c31af7Sopenharmony_ci // Op. 852e5c31af7Sopenharmony_ci { 853e5c31af7Sopenharmony_ci const char* texCoord = isVtxCase ? "a_in0" : "v_texCoord"; 854e5c31af7Sopenharmony_ci const char* gradX = isVtxCase ? "a_in1" : "v_gradX"; 855e5c31af7Sopenharmony_ci const char* gradY = isVtxCase ? "a_in2" : "v_gradY"; 856e5c31af7Sopenharmony_ci const char* lodBias = isVtxCase ? "a_in1" : "v_lodBias"; 857e5c31af7Sopenharmony_ci 858e5c31af7Sopenharmony_ci op << "vec4(" << baseFuncName; 859e5c31af7Sopenharmony_ci if (m_lookupSpec.useOffset) 860e5c31af7Sopenharmony_ci op << "Offset"; 861e5c31af7Sopenharmony_ci op << "(u_sampler, "; 862e5c31af7Sopenharmony_ci 863e5c31af7Sopenharmony_ci if (isIntCoord) 864e5c31af7Sopenharmony_ci op << "ivec" << (texCoordComps+extraCoordComps) << "("; 865e5c31af7Sopenharmony_ci 866e5c31af7Sopenharmony_ci op << texCoord; 867e5c31af7Sopenharmony_ci 868e5c31af7Sopenharmony_ci if (isIntCoord) 869e5c31af7Sopenharmony_ci op << ")"; 870e5c31af7Sopenharmony_ci 871e5c31af7Sopenharmony_ci if (isGrad) 872e5c31af7Sopenharmony_ci op << ", " << gradX << ", " << gradY; 873e5c31af7Sopenharmony_ci 874e5c31af7Sopenharmony_ci if (functionHasLod(function)) 875e5c31af7Sopenharmony_ci { 876e5c31af7Sopenharmony_ci if (isIntCoord) 877e5c31af7Sopenharmony_ci op << ", int(" << lodBias << ")"; 878e5c31af7Sopenharmony_ci else 879e5c31af7Sopenharmony_ci op << ", " << lodBias; 880e5c31af7Sopenharmony_ci } 881e5c31af7Sopenharmony_ci 882e5c31af7Sopenharmony_ci if (m_lookupSpec.useOffset) 883e5c31af7Sopenharmony_ci { 884e5c31af7Sopenharmony_ci int offsetComps = m_textureSpec.type == TEXTURETYPE_3D ? 3 : 2; 885e5c31af7Sopenharmony_ci 886e5c31af7Sopenharmony_ci op << ", ivec" << offsetComps << "("; 887e5c31af7Sopenharmony_ci for (int ndx = 0; ndx < offsetComps; ndx++) 888e5c31af7Sopenharmony_ci { 889e5c31af7Sopenharmony_ci if (ndx != 0) 890e5c31af7Sopenharmony_ci op << ", "; 891e5c31af7Sopenharmony_ci op << m_lookupSpec.offset[ndx]; 892e5c31af7Sopenharmony_ci } 893e5c31af7Sopenharmony_ci op << ")"; 894e5c31af7Sopenharmony_ci } 895e5c31af7Sopenharmony_ci 896e5c31af7Sopenharmony_ci if (m_lookupSpec.useBias) 897e5c31af7Sopenharmony_ci op << ", " << lodBias; 898e5c31af7Sopenharmony_ci 899e5c31af7Sopenharmony_ci op << ")"; 900e5c31af7Sopenharmony_ci 901e5c31af7Sopenharmony_ci if (isShadow) 902e5c31af7Sopenharmony_ci op << ", 0.0, 0.0, 1.0)"; 903e5c31af7Sopenharmony_ci else 904e5c31af7Sopenharmony_ci op << ")*u_scale + u_bias"; 905e5c31af7Sopenharmony_ci 906e5c31af7Sopenharmony_ci op << ";\n"; 907e5c31af7Sopenharmony_ci } 908e5c31af7Sopenharmony_ci 909e5c31af7Sopenharmony_ci if (isVtxCase) 910e5c31af7Sopenharmony_ci frag << "\to_color = v_color;\n"; 911e5c31af7Sopenharmony_ci else 912e5c31af7Sopenharmony_ci { 913e5c31af7Sopenharmony_ci vert << "\tv_texCoord = a_in0;\n"; 914e5c31af7Sopenharmony_ci 915e5c31af7Sopenharmony_ci if (isGrad) 916e5c31af7Sopenharmony_ci { 917e5c31af7Sopenharmony_ci vert << "\tv_gradX = a_in1;\n"; 918e5c31af7Sopenharmony_ci vert << "\tv_gradY = a_in2;\n"; 919e5c31af7Sopenharmony_ci } 920e5c31af7Sopenharmony_ci else if (hasLodBias) 921e5c31af7Sopenharmony_ci vert << "\tv_lodBias = a_in1;\n"; 922e5c31af7Sopenharmony_ci } 923e5c31af7Sopenharmony_ci 924e5c31af7Sopenharmony_ci vert << "}\n"; 925e5c31af7Sopenharmony_ci frag << "}\n"; 926e5c31af7Sopenharmony_ci 927e5c31af7Sopenharmony_ci m_vertShaderSource = vert.str(); 928e5c31af7Sopenharmony_ci m_fragShaderSource = frag.str(); 929e5c31af7Sopenharmony_ci} 930e5c31af7Sopenharmony_ci 931e5c31af7Sopenharmony_civoid ShaderTextureFunctionCase::deinit (void) 932e5c31af7Sopenharmony_ci{ 933e5c31af7Sopenharmony_ci gls::ShaderRenderCase::deinit(); 934e5c31af7Sopenharmony_ci 935e5c31af7Sopenharmony_ci delete m_texture2D; 936e5c31af7Sopenharmony_ci delete m_textureCube; 937e5c31af7Sopenharmony_ci delete m_texture2DArray; 938e5c31af7Sopenharmony_ci delete m_texture3D; 939e5c31af7Sopenharmony_ci 940e5c31af7Sopenharmony_ci m_texture2D = DE_NULL; 941e5c31af7Sopenharmony_ci m_textureCube = DE_NULL; 942e5c31af7Sopenharmony_ci m_texture2DArray = DE_NULL; 943e5c31af7Sopenharmony_ci m_texture3D = DE_NULL; 944e5c31af7Sopenharmony_ci} 945e5c31af7Sopenharmony_ci 946e5c31af7Sopenharmony_civoid ShaderTextureFunctionCase::setupUniforms (int programID, const tcu::Vec4&) 947e5c31af7Sopenharmony_ci{ 948e5c31af7Sopenharmony_ci const glw::Functions& gl = m_renderCtx.getFunctions(); 949e5c31af7Sopenharmony_ci gl.uniform1i(gl.getUniformLocation(programID, "u_sampler"), 0); 950e5c31af7Sopenharmony_ci gl.uniform4fv(gl.getUniformLocation(programID, "u_scale"), 1, m_lookupParams.scale.getPtr()); 951e5c31af7Sopenharmony_ci gl.uniform4fv(gl.getUniformLocation(programID, "u_bias"), 1, m_lookupParams.bias.getPtr()); 952e5c31af7Sopenharmony_ci} 953e5c31af7Sopenharmony_ci 954e5c31af7Sopenharmony_ciclass TextureSizeCase : public TestCase 955e5c31af7Sopenharmony_ci{ 956e5c31af7Sopenharmony_cipublic: 957e5c31af7Sopenharmony_ci TextureSizeCase (Context& context, const char* name, const char* desc, const char* samplerType, const TextureSpec& texture, bool isVertexCase); 958e5c31af7Sopenharmony_ci ~TextureSizeCase (void); 959e5c31af7Sopenharmony_ci 960e5c31af7Sopenharmony_ci void deinit (void); 961e5c31af7Sopenharmony_ci IterateResult iterate (void); 962e5c31af7Sopenharmony_ci 963e5c31af7Sopenharmony_ciprivate: 964e5c31af7Sopenharmony_ci struct TestSize 965e5c31af7Sopenharmony_ci { 966e5c31af7Sopenharmony_ci tcu::IVec3 textureSize; 967e5c31af7Sopenharmony_ci int lod; 968e5c31af7Sopenharmony_ci int lodBase; 969e5c31af7Sopenharmony_ci tcu::IVec3 expectedSize; 970e5c31af7Sopenharmony_ci }; 971e5c31af7Sopenharmony_ci 972e5c31af7Sopenharmony_ci bool initShader (void); 973e5c31af7Sopenharmony_ci void freeShader (void); 974e5c31af7Sopenharmony_ci bool testTextureSize (const TestSize&); 975e5c31af7Sopenharmony_ci std::string genVertexShader (void) const; 976e5c31af7Sopenharmony_ci std::string genFragmentShader (void) const; 977e5c31af7Sopenharmony_ci glw::GLenum getGLTextureTarget (void) const; 978e5c31af7Sopenharmony_ci 979e5c31af7Sopenharmony_ci const char* m_samplerTypeStr; 980e5c31af7Sopenharmony_ci const TextureSpec m_textureSpec; 981e5c31af7Sopenharmony_ci const bool m_isVertexCase; 982e5c31af7Sopenharmony_ci const bool m_has3DSize; 983e5c31af7Sopenharmony_ci glu::ShaderProgram* m_program; 984e5c31af7Sopenharmony_ci int m_iterationCounter; 985e5c31af7Sopenharmony_ci}; 986e5c31af7Sopenharmony_ci 987e5c31af7Sopenharmony_ciTextureSizeCase::TextureSizeCase (Context& context, const char* name, const char* desc, const char* samplerType, const TextureSpec& texture, bool isVertexCase) 988e5c31af7Sopenharmony_ci : TestCase (context, name, desc) 989e5c31af7Sopenharmony_ci , m_samplerTypeStr (samplerType) 990e5c31af7Sopenharmony_ci , m_textureSpec (texture) 991e5c31af7Sopenharmony_ci , m_isVertexCase (isVertexCase) 992e5c31af7Sopenharmony_ci , m_has3DSize (texture.type == TEXTURETYPE_3D || texture.type == TEXTURETYPE_2D_ARRAY) 993e5c31af7Sopenharmony_ci , m_program (DE_NULL) 994e5c31af7Sopenharmony_ci , m_iterationCounter(0) 995e5c31af7Sopenharmony_ci{ 996e5c31af7Sopenharmony_ci} 997e5c31af7Sopenharmony_ci 998e5c31af7Sopenharmony_ciTextureSizeCase::~TextureSizeCase (void) 999e5c31af7Sopenharmony_ci{ 1000e5c31af7Sopenharmony_ci deinit(); 1001e5c31af7Sopenharmony_ci} 1002e5c31af7Sopenharmony_ci 1003e5c31af7Sopenharmony_civoid TextureSizeCase::deinit (void) 1004e5c31af7Sopenharmony_ci{ 1005e5c31af7Sopenharmony_ci freeShader(); 1006e5c31af7Sopenharmony_ci} 1007e5c31af7Sopenharmony_ci 1008e5c31af7Sopenharmony_ciTestCase::IterateResult TextureSizeCase::iterate (void) 1009e5c31af7Sopenharmony_ci{ 1010e5c31af7Sopenharmony_ci const int currentIteration = m_iterationCounter++; 1011e5c31af7Sopenharmony_ci const TestSize testSizes[] = 1012e5c31af7Sopenharmony_ci { 1013e5c31af7Sopenharmony_ci { tcu::IVec3(1, 2, 1), 1, 0, tcu::IVec3(1, 1, 1) }, 1014e5c31af7Sopenharmony_ci { tcu::IVec3(1, 2, 1), 0, 0, tcu::IVec3(1, 2, 1) }, 1015e5c31af7Sopenharmony_ci 1016e5c31af7Sopenharmony_ci { tcu::IVec3(1, 3, 2), 0, 0, tcu::IVec3(1, 3, 2) }, 1017e5c31af7Sopenharmony_ci { tcu::IVec3(1, 3, 2), 1, 0, tcu::IVec3(1, 1, 1) }, 1018e5c31af7Sopenharmony_ci 1019e5c31af7Sopenharmony_ci { tcu::IVec3(100, 31, 18), 0, 0, tcu::IVec3(100, 31, 18) }, 1020e5c31af7Sopenharmony_ci { tcu::IVec3(100, 31, 18), 1, 0, tcu::IVec3(50, 15, 9) }, 1021e5c31af7Sopenharmony_ci { tcu::IVec3(100, 31, 18), 2, 0, tcu::IVec3(25, 7, 4) }, 1022e5c31af7Sopenharmony_ci { tcu::IVec3(100, 31, 18), 3, 0, tcu::IVec3(12, 3, 2) }, 1023e5c31af7Sopenharmony_ci { tcu::IVec3(100, 31, 18), 4, 0, tcu::IVec3(6, 1, 1) }, 1024e5c31af7Sopenharmony_ci { tcu::IVec3(100, 31, 18), 5, 0, tcu::IVec3(3, 1, 1) }, 1025e5c31af7Sopenharmony_ci { tcu::IVec3(100, 31, 18), 6, 0, tcu::IVec3(1, 1, 1) }, 1026e5c31af7Sopenharmony_ci 1027e5c31af7Sopenharmony_ci { tcu::IVec3(100, 128, 32), 0, 0, tcu::IVec3(100, 128, 32) }, 1028e5c31af7Sopenharmony_ci { tcu::IVec3(100, 128, 32), 1, 0, tcu::IVec3(50, 64, 16) }, 1029e5c31af7Sopenharmony_ci { tcu::IVec3(100, 128, 32), 2, 0, tcu::IVec3(25, 32, 8) }, 1030e5c31af7Sopenharmony_ci { tcu::IVec3(100, 128, 32), 3, 0, tcu::IVec3(12, 16, 4) }, 1031e5c31af7Sopenharmony_ci { tcu::IVec3(100, 128, 32), 4, 0, tcu::IVec3(6, 8, 2) }, 1032e5c31af7Sopenharmony_ci { tcu::IVec3(100, 128, 32), 5, 0, tcu::IVec3(3, 4, 1) }, 1033e5c31af7Sopenharmony_ci { tcu::IVec3(100, 128, 32), 6, 0, tcu::IVec3(1, 2, 1) }, 1034e5c31af7Sopenharmony_ci { tcu::IVec3(100, 128, 32), 7, 0, tcu::IVec3(1, 1, 1) }, 1035e5c31af7Sopenharmony_ci 1036e5c31af7Sopenharmony_ci // pow 2 1037e5c31af7Sopenharmony_ci { tcu::IVec3(128, 64, 32), 0, 0, tcu::IVec3(128, 64, 32) }, 1038e5c31af7Sopenharmony_ci { tcu::IVec3(128, 64, 32), 1, 0, tcu::IVec3(64, 32, 16) }, 1039e5c31af7Sopenharmony_ci { tcu::IVec3(128, 64, 32), 2, 0, tcu::IVec3(32, 16, 8) }, 1040e5c31af7Sopenharmony_ci { tcu::IVec3(128, 64, 32), 3, 0, tcu::IVec3(16, 8, 4) }, 1041e5c31af7Sopenharmony_ci { tcu::IVec3(128, 64, 32), 4, 0, tcu::IVec3(8, 4, 2) }, 1042e5c31af7Sopenharmony_ci { tcu::IVec3(128, 64, 32), 5, 0, tcu::IVec3(4, 2, 1) }, 1043e5c31af7Sopenharmony_ci { tcu::IVec3(128, 64, 32), 6, 0, tcu::IVec3(2, 1, 1) }, 1044e5c31af7Sopenharmony_ci { tcu::IVec3(128, 64, 32), 7, 0, tcu::IVec3(1, 1, 1) }, 1045e5c31af7Sopenharmony_ci 1046e5c31af7Sopenharmony_ci // w == h 1047e5c31af7Sopenharmony_ci { tcu::IVec3(1, 1, 1), 0, 0, tcu::IVec3(1, 1, 1) }, 1048e5c31af7Sopenharmony_ci { tcu::IVec3(64, 64, 64), 0, 0, tcu::IVec3(64, 64, 64) }, 1049e5c31af7Sopenharmony_ci { tcu::IVec3(64, 64, 64), 1, 0, tcu::IVec3(32, 32, 32) }, 1050e5c31af7Sopenharmony_ci { tcu::IVec3(64, 64, 64), 2, 0, tcu::IVec3(16, 16, 16) }, 1051e5c31af7Sopenharmony_ci { tcu::IVec3(64, 64, 64), 3, 0, tcu::IVec3(8, 8, 8) }, 1052e5c31af7Sopenharmony_ci { tcu::IVec3(64, 64, 64), 4, 0, tcu::IVec3(4, 4, 4) }, 1053e5c31af7Sopenharmony_ci 1054e5c31af7Sopenharmony_ci // with lod base 1055e5c31af7Sopenharmony_ci { tcu::IVec3(100, 31, 18), 3, 1, tcu::IVec3(6, 1, 1) }, 1056e5c31af7Sopenharmony_ci { tcu::IVec3(128, 64, 32), 3, 1, tcu::IVec3(8, 4, 2) }, 1057e5c31af7Sopenharmony_ci { tcu::IVec3(64, 64, 64), 1, 1, tcu::IVec3(16, 16, 16) }, 1058e5c31af7Sopenharmony_ci 1059e5c31af7Sopenharmony_ci }; 1060e5c31af7Sopenharmony_ci const int lastIterationIndex = DE_LENGTH_OF_ARRAY(testSizes) + 1; 1061e5c31af7Sopenharmony_ci 1062e5c31af7Sopenharmony_ci if (currentIteration == 0) 1063e5c31af7Sopenharmony_ci { 1064e5c31af7Sopenharmony_ci m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); 1065e5c31af7Sopenharmony_ci return initShader() ? CONTINUE : STOP; 1066e5c31af7Sopenharmony_ci } 1067e5c31af7Sopenharmony_ci else if (currentIteration == lastIterationIndex) 1068e5c31af7Sopenharmony_ci { 1069e5c31af7Sopenharmony_ci freeShader(); 1070e5c31af7Sopenharmony_ci return STOP; 1071e5c31af7Sopenharmony_ci } 1072e5c31af7Sopenharmony_ci else 1073e5c31af7Sopenharmony_ci { 1074e5c31af7Sopenharmony_ci if (!testTextureSize(testSizes[currentIteration - 1])) 1075e5c31af7Sopenharmony_ci if (m_testCtx.getTestResult() != QP_TEST_RESULT_FAIL) 1076e5c31af7Sopenharmony_ci m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got unexpected texture size"); 1077e5c31af7Sopenharmony_ci return CONTINUE; 1078e5c31af7Sopenharmony_ci } 1079e5c31af7Sopenharmony_ci} 1080e5c31af7Sopenharmony_ci 1081e5c31af7Sopenharmony_cibool TextureSizeCase::initShader (void) 1082e5c31af7Sopenharmony_ci{ 1083e5c31af7Sopenharmony_ci const std::string vertSrc = genVertexShader(); 1084e5c31af7Sopenharmony_ci const std::string fragSrc = genFragmentShader(); 1085e5c31af7Sopenharmony_ci 1086e5c31af7Sopenharmony_ci DE_ASSERT(m_program == DE_NULL); 1087e5c31af7Sopenharmony_ci m_program = new glu::ShaderProgram(m_context.getRenderContext(), glu::makeVtxFragSources(vertSrc, fragSrc)); 1088e5c31af7Sopenharmony_ci m_context.getTestContext().getLog() << *m_program; 1089e5c31af7Sopenharmony_ci 1090e5c31af7Sopenharmony_ci if (!m_program->isOk()) 1091e5c31af7Sopenharmony_ci { 1092e5c31af7Sopenharmony_ci m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Shader failed"); 1093e5c31af7Sopenharmony_ci return false; 1094e5c31af7Sopenharmony_ci } 1095e5c31af7Sopenharmony_ci 1096e5c31af7Sopenharmony_ci return true; 1097e5c31af7Sopenharmony_ci} 1098e5c31af7Sopenharmony_ci 1099e5c31af7Sopenharmony_civoid TextureSizeCase::freeShader (void) 1100e5c31af7Sopenharmony_ci{ 1101e5c31af7Sopenharmony_ci delete m_program; 1102e5c31af7Sopenharmony_ci m_program = DE_NULL; 1103e5c31af7Sopenharmony_ci} 1104e5c31af7Sopenharmony_ci 1105e5c31af7Sopenharmony_cibool TextureSizeCase::testTextureSize (const TestSize& testSize) 1106e5c31af7Sopenharmony_ci{ 1107e5c31af7Sopenharmony_ci using tcu::TestLog; 1108e5c31af7Sopenharmony_ci 1109e5c31af7Sopenharmony_ci const tcu::Vec4 triangle[3] = // covers entire viewport 1110e5c31af7Sopenharmony_ci { 1111e5c31af7Sopenharmony_ci tcu::Vec4(-1, -1, 0, 1), 1112e5c31af7Sopenharmony_ci tcu::Vec4( 4, -1, 0, 1), 1113e5c31af7Sopenharmony_ci tcu::Vec4(-1, 4, 0, 1), 1114e5c31af7Sopenharmony_ci }; 1115e5c31af7Sopenharmony_ci 1116e5c31af7Sopenharmony_ci const glw::Functions& gl = m_context.getRenderContext().getFunctions(); 1117e5c31af7Sopenharmony_ci 1118e5c31af7Sopenharmony_ci const glw::GLint positionLoc = gl.getAttribLocation (m_program->getProgram(), "a_position"); 1119e5c31af7Sopenharmony_ci const glw::GLint samplerLoc = gl.getUniformLocation (m_program->getProgram(), "u_sampler"); 1120e5c31af7Sopenharmony_ci const glw::GLint sizeLoc = gl.getUniformLocation (m_program->getProgram(), "u_texSize"); 1121e5c31af7Sopenharmony_ci const glw::GLint lodLoc = gl.getUniformLocation (m_program->getProgram(), "u_lod"); 1122e5c31af7Sopenharmony_ci const glw::GLenum textureTarget = getGLTextureTarget (); 1123e5c31af7Sopenharmony_ci const bool isSquare = testSize.textureSize.x() == testSize.textureSize.y(); 1124e5c31af7Sopenharmony_ci const bool is2DLodValid = (testSize.textureSize.x() >> (testSize.lod + testSize.lodBase)) != 0 || (testSize.textureSize.y() >> (testSize.lod + testSize.lodBase)) != 0; 1125e5c31af7Sopenharmony_ci bool success = true; 1126e5c31af7Sopenharmony_ci glw::GLenum errorValue; 1127e5c31af7Sopenharmony_ci 1128e5c31af7Sopenharmony_ci // Skip incompatible cases 1129e5c31af7Sopenharmony_ci if (m_textureSpec.type == TEXTURETYPE_CUBE_MAP && !isSquare) 1130e5c31af7Sopenharmony_ci return true; 1131e5c31af7Sopenharmony_ci if (m_textureSpec.type == TEXTURETYPE_2D && !is2DLodValid) 1132e5c31af7Sopenharmony_ci return true; 1133e5c31af7Sopenharmony_ci if (m_textureSpec.type == TEXTURETYPE_2D_ARRAY && !is2DLodValid) 1134e5c31af7Sopenharmony_ci return true; 1135e5c31af7Sopenharmony_ci 1136e5c31af7Sopenharmony_ci // setup rendering 1137e5c31af7Sopenharmony_ci 1138e5c31af7Sopenharmony_ci gl.useProgram (m_program->getProgram()); 1139e5c31af7Sopenharmony_ci gl.uniform1i (samplerLoc, 0); 1140e5c31af7Sopenharmony_ci gl.clearColor (0.5f, 0.5f, 0.5f, 1.0f); 1141e5c31af7Sopenharmony_ci gl.viewport (0, 0, 1, 1); 1142e5c31af7Sopenharmony_ci gl.vertexAttribPointer (positionLoc, 4, GL_FLOAT, GL_FALSE, 0, triangle); 1143e5c31af7Sopenharmony_ci gl.enableVertexAttribArray (positionLoc); 1144e5c31af7Sopenharmony_ci 1145e5c31af7Sopenharmony_ci // setup texture 1146e5c31af7Sopenharmony_ci { 1147e5c31af7Sopenharmony_ci const int maxLevel = testSize.lod + testSize.lodBase; 1148e5c31af7Sopenharmony_ci const int levels = maxLevel + 1; 1149e5c31af7Sopenharmony_ci glw::GLuint texId = 0; 1150e5c31af7Sopenharmony_ci 1151e5c31af7Sopenharmony_ci // gen texture 1152e5c31af7Sopenharmony_ci gl.genTextures(1, &texId); 1153e5c31af7Sopenharmony_ci gl.bindTexture(textureTarget, texId); 1154e5c31af7Sopenharmony_ci gl.texParameteri(textureTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 1155e5c31af7Sopenharmony_ci gl.texParameteri(textureTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 1156e5c31af7Sopenharmony_ci gl.texParameteri(textureTarget, GL_TEXTURE_BASE_LEVEL, testSize.lodBase); 1157e5c31af7Sopenharmony_ci 1158e5c31af7Sopenharmony_ci // set up texture 1159e5c31af7Sopenharmony_ci 1160e5c31af7Sopenharmony_ci switch (m_textureSpec.type) 1161e5c31af7Sopenharmony_ci { 1162e5c31af7Sopenharmony_ci case TEXTURETYPE_3D: 1163e5c31af7Sopenharmony_ci { 1164e5c31af7Sopenharmony_ci m_context.getTestContext().getLog() << TestLog::Message << "Testing image size " << testSize.textureSize.x() << "x" << testSize.textureSize.y() << "x" << testSize.textureSize.z() << TestLog::EndMessage; 1165e5c31af7Sopenharmony_ci m_context.getTestContext().getLog() << TestLog::Message << "Lod: " << testSize.lod << ", base level: " << testSize.lodBase << TestLog::EndMessage; 1166e5c31af7Sopenharmony_ci m_context.getTestContext().getLog() << TestLog::Message << "Expecting: " << testSize.expectedSize.x() << "x" << testSize.expectedSize.y() << "x" << testSize.expectedSize.z() << TestLog::EndMessage; 1167e5c31af7Sopenharmony_ci 1168e5c31af7Sopenharmony_ci gl.uniform3iv(sizeLoc, 1, testSize.expectedSize.m_data); 1169e5c31af7Sopenharmony_ci gl.uniform1iv(lodLoc, 1, &testSize.lod); 1170e5c31af7Sopenharmony_ci 1171e5c31af7Sopenharmony_ci gl.texStorage3D(textureTarget, levels, m_textureSpec.format, testSize.textureSize.x(), testSize.textureSize.y(), testSize.textureSize.z()); 1172e5c31af7Sopenharmony_ci break; 1173e5c31af7Sopenharmony_ci } 1174e5c31af7Sopenharmony_ci 1175e5c31af7Sopenharmony_ci case TEXTURETYPE_2D: 1176e5c31af7Sopenharmony_ci case TEXTURETYPE_CUBE_MAP: 1177e5c31af7Sopenharmony_ci { 1178e5c31af7Sopenharmony_ci m_context.getTestContext().getLog() << TestLog::Message << "Testing image size " << testSize.textureSize.x() << "x" << testSize.textureSize.y() << TestLog::EndMessage; 1179e5c31af7Sopenharmony_ci m_context.getTestContext().getLog() << TestLog::Message << "Lod: " << testSize.lod << ", base level: " << testSize.lodBase << TestLog::EndMessage; 1180e5c31af7Sopenharmony_ci m_context.getTestContext().getLog() << TestLog::Message << "Expecting: " << testSize.expectedSize.x() << "x" << testSize.expectedSize.y() << TestLog::EndMessage; 1181e5c31af7Sopenharmony_ci 1182e5c31af7Sopenharmony_ci gl.uniform2iv(sizeLoc, 1, testSize.expectedSize.m_data); 1183e5c31af7Sopenharmony_ci gl.uniform1iv(lodLoc, 1, &testSize.lod); 1184e5c31af7Sopenharmony_ci 1185e5c31af7Sopenharmony_ci gl.texStorage2D(textureTarget, levels, m_textureSpec.format, testSize.textureSize.x(), testSize.textureSize.y()); 1186e5c31af7Sopenharmony_ci break; 1187e5c31af7Sopenharmony_ci } 1188e5c31af7Sopenharmony_ci 1189e5c31af7Sopenharmony_ci case TEXTURETYPE_2D_ARRAY: 1190e5c31af7Sopenharmony_ci { 1191e5c31af7Sopenharmony_ci tcu::IVec3 expectedSize(testSize.expectedSize.x(), testSize.expectedSize.y(), testSize.textureSize.z()); 1192e5c31af7Sopenharmony_ci 1193e5c31af7Sopenharmony_ci m_context.getTestContext().getLog() << TestLog::Message << "Testing image size " << testSize.textureSize.x() << "x" << testSize.textureSize.y() << " with " << testSize.textureSize.z() << " layer(s)" << TestLog::EndMessage; 1194e5c31af7Sopenharmony_ci m_context.getTestContext().getLog() << TestLog::Message << "Lod: " << testSize.lod << ", base level: " << testSize.lodBase << TestLog::EndMessage; 1195e5c31af7Sopenharmony_ci m_context.getTestContext().getLog() << TestLog::Message << "Expecting: " << testSize.expectedSize.x() << "x" << testSize.expectedSize.y() << " and " << testSize.textureSize.z() << " layer(s)" << TestLog::EndMessage; 1196e5c31af7Sopenharmony_ci 1197e5c31af7Sopenharmony_ci gl.uniform3iv(sizeLoc, 1, expectedSize.m_data); 1198e5c31af7Sopenharmony_ci gl.uniform1iv(lodLoc, 1, &testSize.lod); 1199e5c31af7Sopenharmony_ci 1200e5c31af7Sopenharmony_ci gl.texStorage3D(textureTarget, levels, m_textureSpec.format, testSize.textureSize.x(), testSize.textureSize.y(), testSize.textureSize.z()); 1201e5c31af7Sopenharmony_ci break; 1202e5c31af7Sopenharmony_ci } 1203e5c31af7Sopenharmony_ci 1204e5c31af7Sopenharmony_ci default: 1205e5c31af7Sopenharmony_ci { 1206e5c31af7Sopenharmony_ci DE_ASSERT(false); 1207e5c31af7Sopenharmony_ci break; 1208e5c31af7Sopenharmony_ci } 1209e5c31af7Sopenharmony_ci } 1210e5c31af7Sopenharmony_ci 1211e5c31af7Sopenharmony_ci errorValue = gl.getError(); 1212e5c31af7Sopenharmony_ci if (errorValue == GL_OUT_OF_MEMORY) 1213e5c31af7Sopenharmony_ci { 1214e5c31af7Sopenharmony_ci throw glu::OutOfMemoryError("Failed to allocate texture, got GL_OUT_OF_MEMORY.", "TexStorageXD", __FILE__, __LINE__); 1215e5c31af7Sopenharmony_ci } 1216e5c31af7Sopenharmony_ci else if (errorValue != GL_NO_ERROR) 1217e5c31af7Sopenharmony_ci { 1218e5c31af7Sopenharmony_ci // error is a failure too 1219e5c31af7Sopenharmony_ci m_context.getTestContext().getLog() << tcu::TestLog::Message << "Failed, got " << glu::getErrorStr(errorValue) << "." << tcu::TestLog::EndMessage; 1220e5c31af7Sopenharmony_ci success = false; 1221e5c31af7Sopenharmony_ci } 1222e5c31af7Sopenharmony_ci else 1223e5c31af7Sopenharmony_ci { 1224e5c31af7Sopenharmony_ci // test 1225e5c31af7Sopenharmony_ci const float colorTolerance = 0.1f; 1226e5c31af7Sopenharmony_ci tcu::TextureLevel sample (tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), 1, 1); 1227e5c31af7Sopenharmony_ci tcu::Vec4 outputColor; 1228e5c31af7Sopenharmony_ci 1229e5c31af7Sopenharmony_ci gl.clear (GL_COLOR_BUFFER_BIT); 1230e5c31af7Sopenharmony_ci gl.drawArrays (GL_TRIANGLES, 0, 3); 1231e5c31af7Sopenharmony_ci gl.finish (); 1232e5c31af7Sopenharmony_ci 1233e5c31af7Sopenharmony_ci glu::readPixels (m_context.getRenderContext(), 0, 0, sample.getAccess()); 1234e5c31af7Sopenharmony_ci 1235e5c31af7Sopenharmony_ci outputColor = sample.getAccess().getPixel(0, 0); 1236e5c31af7Sopenharmony_ci 1237e5c31af7Sopenharmony_ci if (outputColor.x() >= 1.0f - colorTolerance && 1238e5c31af7Sopenharmony_ci outputColor.y() >= 1.0f - colorTolerance && 1239e5c31af7Sopenharmony_ci outputColor.z() >= 1.0f - colorTolerance) 1240e5c31af7Sopenharmony_ci { 1241e5c31af7Sopenharmony_ci // success 1242e5c31af7Sopenharmony_ci m_context.getTestContext().getLog() << TestLog::Message << "Passed" << TestLog::EndMessage; 1243e5c31af7Sopenharmony_ci } 1244e5c31af7Sopenharmony_ci else 1245e5c31af7Sopenharmony_ci { 1246e5c31af7Sopenharmony_ci // failure 1247e5c31af7Sopenharmony_ci m_context.getTestContext().getLog() << TestLog::Message << "Failed" << TestLog::EndMessage; 1248e5c31af7Sopenharmony_ci success = false; 1249e5c31af7Sopenharmony_ci } 1250e5c31af7Sopenharmony_ci } 1251e5c31af7Sopenharmony_ci 1252e5c31af7Sopenharmony_ci // empty line to format log nicely 1253e5c31af7Sopenharmony_ci m_context.getTestContext().getLog() << TestLog::Message << TestLog::EndMessage; 1254e5c31af7Sopenharmony_ci 1255e5c31af7Sopenharmony_ci // free 1256e5c31af7Sopenharmony_ci gl.bindTexture (textureTarget, 0); 1257e5c31af7Sopenharmony_ci gl.deleteTextures (1, &texId); 1258e5c31af7Sopenharmony_ci } 1259e5c31af7Sopenharmony_ci 1260e5c31af7Sopenharmony_ci gl.useProgram(0); 1261e5c31af7Sopenharmony_ci 1262e5c31af7Sopenharmony_ci return success; 1263e5c31af7Sopenharmony_ci} 1264e5c31af7Sopenharmony_ci 1265e5c31af7Sopenharmony_cistd::string TextureSizeCase::genVertexShader() const 1266e5c31af7Sopenharmony_ci{ 1267e5c31af7Sopenharmony_ci std::ostringstream vert; 1268e5c31af7Sopenharmony_ci 1269e5c31af7Sopenharmony_ci vert << "#version 300 es\n" 1270e5c31af7Sopenharmony_ci << "in highp vec4 a_position;\n"; 1271e5c31af7Sopenharmony_ci 1272e5c31af7Sopenharmony_ci if (m_isVertexCase) 1273e5c31af7Sopenharmony_ci { 1274e5c31af7Sopenharmony_ci vert << "out mediump vec4 v_color;\n"; 1275e5c31af7Sopenharmony_ci vert << "uniform highp " << m_samplerTypeStr << " u_sampler;\n"; 1276e5c31af7Sopenharmony_ci vert << "uniform highp ivec" << (m_has3DSize ? 3 : 2) << " u_texSize;\n"; 1277e5c31af7Sopenharmony_ci vert << "uniform highp int u_lod;\n"; 1278e5c31af7Sopenharmony_ci } 1279e5c31af7Sopenharmony_ci 1280e5c31af7Sopenharmony_ci vert << "void main()\n{\n"; 1281e5c31af7Sopenharmony_ci 1282e5c31af7Sopenharmony_ci if (m_isVertexCase) 1283e5c31af7Sopenharmony_ci vert << " v_color = (textureSize(u_sampler, u_lod) == u_texSize ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 1.0));\n"; 1284e5c31af7Sopenharmony_ci 1285e5c31af7Sopenharmony_ci vert << " gl_Position = a_position;\n" 1286e5c31af7Sopenharmony_ci << "}\n"; 1287e5c31af7Sopenharmony_ci 1288e5c31af7Sopenharmony_ci return vert.str(); 1289e5c31af7Sopenharmony_ci} 1290e5c31af7Sopenharmony_ci 1291e5c31af7Sopenharmony_cistd::string TextureSizeCase::genFragmentShader() const 1292e5c31af7Sopenharmony_ci{ 1293e5c31af7Sopenharmony_ci std::ostringstream frag; 1294e5c31af7Sopenharmony_ci 1295e5c31af7Sopenharmony_ci frag << "#version 300 es\n" 1296e5c31af7Sopenharmony_ci << "layout(location = 0) out mediump vec4 o_color;\n"; 1297e5c31af7Sopenharmony_ci 1298e5c31af7Sopenharmony_ci if (m_isVertexCase) 1299e5c31af7Sopenharmony_ci frag << "in mediump vec4 v_color;\n"; 1300e5c31af7Sopenharmony_ci 1301e5c31af7Sopenharmony_ci if (!m_isVertexCase) 1302e5c31af7Sopenharmony_ci { 1303e5c31af7Sopenharmony_ci frag << "uniform highp " << m_samplerTypeStr << " u_sampler;\n"; 1304e5c31af7Sopenharmony_ci frag << "uniform highp ivec" << (m_has3DSize ? 3 : 2) << " u_texSize;\n"; 1305e5c31af7Sopenharmony_ci frag << "uniform highp int u_lod;\n"; 1306e5c31af7Sopenharmony_ci } 1307e5c31af7Sopenharmony_ci 1308e5c31af7Sopenharmony_ci frag << "void main()\n{\n"; 1309e5c31af7Sopenharmony_ci 1310e5c31af7Sopenharmony_ci if (!m_isVertexCase) 1311e5c31af7Sopenharmony_ci frag << " o_color = (textureSize(u_sampler, u_lod) == u_texSize ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 1.0));\n"; 1312e5c31af7Sopenharmony_ci else 1313e5c31af7Sopenharmony_ci frag << " o_color = v_color;\n"; 1314e5c31af7Sopenharmony_ci 1315e5c31af7Sopenharmony_ci frag << "}\n"; 1316e5c31af7Sopenharmony_ci 1317e5c31af7Sopenharmony_ci return frag.str(); 1318e5c31af7Sopenharmony_ci} 1319e5c31af7Sopenharmony_ci 1320e5c31af7Sopenharmony_ciglw::GLenum TextureSizeCase::getGLTextureTarget() const 1321e5c31af7Sopenharmony_ci{ 1322e5c31af7Sopenharmony_ci switch (m_textureSpec.type) 1323e5c31af7Sopenharmony_ci { 1324e5c31af7Sopenharmony_ci case TEXTURETYPE_2D: return GL_TEXTURE_2D; 1325e5c31af7Sopenharmony_ci case TEXTURETYPE_CUBE_MAP: return GL_TEXTURE_CUBE_MAP; 1326e5c31af7Sopenharmony_ci case TEXTURETYPE_2D_ARRAY: return GL_TEXTURE_2D_ARRAY; 1327e5c31af7Sopenharmony_ci case TEXTURETYPE_3D: return GL_TEXTURE_3D; 1328e5c31af7Sopenharmony_ci default: DE_ASSERT(DE_FALSE); 1329e5c31af7Sopenharmony_ci } 1330e5c31af7Sopenharmony_ci return 0; 1331e5c31af7Sopenharmony_ci} 1332e5c31af7Sopenharmony_ci 1333e5c31af7Sopenharmony_ciShaderTextureFunctionTests::ShaderTextureFunctionTests (Context& context) 1334e5c31af7Sopenharmony_ci : TestCaseGroup(context, "texture_functions", "Texture Access Function Tests") 1335e5c31af7Sopenharmony_ci{ 1336e5c31af7Sopenharmony_ci} 1337e5c31af7Sopenharmony_ci 1338e5c31af7Sopenharmony_ciShaderTextureFunctionTests::~ShaderTextureFunctionTests (void) 1339e5c31af7Sopenharmony_ci{ 1340e5c31af7Sopenharmony_ci} 1341e5c31af7Sopenharmony_ci 1342e5c31af7Sopenharmony_cienum CaseFlags 1343e5c31af7Sopenharmony_ci{ 1344e5c31af7Sopenharmony_ci VERTEX = (1<<0), 1345e5c31af7Sopenharmony_ci FRAGMENT = (1<<1), 1346e5c31af7Sopenharmony_ci BOTH = VERTEX|FRAGMENT 1347e5c31af7Sopenharmony_ci}; 1348e5c31af7Sopenharmony_ci 1349e5c31af7Sopenharmony_cistruct TexFuncCaseSpec 1350e5c31af7Sopenharmony_ci{ 1351e5c31af7Sopenharmony_ci const char* name; 1352e5c31af7Sopenharmony_ci TextureLookupSpec lookupSpec; 1353e5c31af7Sopenharmony_ci TextureSpec texSpec; 1354e5c31af7Sopenharmony_ci TexEvalFunc evalFunc; 1355e5c31af7Sopenharmony_ci deUint32 flags; 1356e5c31af7Sopenharmony_ci}; 1357e5c31af7Sopenharmony_ci 1358e5c31af7Sopenharmony_ci#define CASE_SPEC(NAME, FUNC, MINCOORD, MAXCOORD, USEBIAS, MINLOD, MAXLOD, USEOFFSET, OFFSET, TEXSPEC, EVALFUNC, FLAGS) \ 1359e5c31af7Sopenharmony_ci { #NAME, TextureLookupSpec(FUNC, MINCOORD, MAXCOORD, USEBIAS, MINLOD, MAXLOD, tcu::Vec3(0.0f), tcu::Vec3(0.0f), tcu::Vec3(0.0f), tcu::Vec3(0.0f), USEOFFSET, OFFSET), TEXSPEC, EVALFUNC, FLAGS } 1360e5c31af7Sopenharmony_ci#define GRAD_CASE_SPEC(NAME, FUNC, MINCOORD, MAXCOORD, MINDX, MAXDX, MINDY, MAXDY, USEOFFSET, OFFSET, TEXSPEC, EVALFUNC, FLAGS) \ 1361e5c31af7Sopenharmony_ci { #NAME, TextureLookupSpec(FUNC, MINCOORD, MAXCOORD, false, 0.0f, 0.0f, MINDX, MAXDX, MINDY, MAXDY, USEOFFSET, OFFSET), TEXSPEC, EVALFUNC, FLAGS } 1362e5c31af7Sopenharmony_ci 1363e5c31af7Sopenharmony_cistatic void createCaseGroup (TestCaseGroup* parent, const char* groupName, const char* groupDesc, const TexFuncCaseSpec* cases, int numCases) 1364e5c31af7Sopenharmony_ci{ 1365e5c31af7Sopenharmony_ci tcu::TestCaseGroup* group = new tcu::TestCaseGroup(parent->getTestContext(), groupName, groupDesc); 1366e5c31af7Sopenharmony_ci parent->addChild(group); 1367e5c31af7Sopenharmony_ci 1368e5c31af7Sopenharmony_ci for (int ndx = 0; ndx < numCases; ndx++) 1369e5c31af7Sopenharmony_ci { 1370e5c31af7Sopenharmony_ci std::string name = cases[ndx].name; 1371e5c31af7Sopenharmony_ci if (cases[ndx].flags & VERTEX) 1372e5c31af7Sopenharmony_ci group->addChild(new ShaderTextureFunctionCase(parent->getContext(), (name + "_vertex").c_str(), "", cases[ndx].lookupSpec, cases[ndx].texSpec, cases[ndx].evalFunc, true)); 1373e5c31af7Sopenharmony_ci if (cases[ndx].flags & FRAGMENT) 1374e5c31af7Sopenharmony_ci group->addChild(new ShaderTextureFunctionCase(parent->getContext(), (name + "_fragment").c_str(), "", cases[ndx].lookupSpec, cases[ndx].texSpec, cases[ndx].evalFunc, false)); 1375e5c31af7Sopenharmony_ci } 1376e5c31af7Sopenharmony_ci} 1377e5c31af7Sopenharmony_ci 1378e5c31af7Sopenharmony_civoid ShaderTextureFunctionTests::init (void) 1379e5c31af7Sopenharmony_ci{ 1380e5c31af7Sopenharmony_ci // Samplers 1381e5c31af7Sopenharmony_ci static const tcu::Sampler samplerNearestNoMipmap (tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, 1382e5c31af7Sopenharmony_ci tcu::Sampler::NEAREST, tcu::Sampler::NEAREST, 1383e5c31af7Sopenharmony_ci 0.0f /* LOD threshold */, true /* normalized coords */, tcu::Sampler::COMPAREMODE_NONE, 1384e5c31af7Sopenharmony_ci 0 /* cmp channel */, tcu::Vec4(0.0f) /* border color */, true /* seamless cube map */); 1385e5c31af7Sopenharmony_ci static const tcu::Sampler samplerLinearNoMipmap (tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, 1386e5c31af7Sopenharmony_ci tcu::Sampler::LINEAR, tcu::Sampler::LINEAR, 1387e5c31af7Sopenharmony_ci 0.0f /* LOD threshold */, true /* normalized coords */, tcu::Sampler::COMPAREMODE_NONE, 1388e5c31af7Sopenharmony_ci 0 /* cmp channel */, tcu::Vec4(0.0f) /* border color */, true /* seamless cube map */); 1389e5c31af7Sopenharmony_ci static const tcu::Sampler samplerNearestMipmap (tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, 1390e5c31af7Sopenharmony_ci tcu::Sampler::NEAREST_MIPMAP_NEAREST, tcu::Sampler::NEAREST, 1391e5c31af7Sopenharmony_ci 0.0f /* LOD threshold */, true /* normalized coords */, tcu::Sampler::COMPAREMODE_NONE, 1392e5c31af7Sopenharmony_ci 0 /* cmp channel */, tcu::Vec4(0.0f) /* border color */, true /* seamless cube map */); 1393e5c31af7Sopenharmony_ci static const tcu::Sampler samplerLinearMipmap (tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, 1394e5c31af7Sopenharmony_ci tcu::Sampler::LINEAR_MIPMAP_NEAREST, tcu::Sampler::LINEAR, 1395e5c31af7Sopenharmony_ci 0.0f /* LOD threshold */, true /* normalized coords */, tcu::Sampler::COMPAREMODE_NONE, 1396e5c31af7Sopenharmony_ci 0 /* cmp channel */, tcu::Vec4(0.0f) /* border color */, true /* seamless cube map */); 1397e5c31af7Sopenharmony_ci 1398e5c31af7Sopenharmony_ci static const tcu::Sampler samplerShadowNoMipmap (tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, 1399e5c31af7Sopenharmony_ci tcu::Sampler::NEAREST, tcu::Sampler::NEAREST, 1400e5c31af7Sopenharmony_ci 0.0f /* LOD threshold */, true /* normalized coords */, tcu::Sampler::COMPAREMODE_LESS, 1401e5c31af7Sopenharmony_ci 0 /* cmp channel */, tcu::Vec4(0.0f) /* border color */, true /* seamless cube map */); 1402e5c31af7Sopenharmony_ci static const tcu::Sampler samplerShadowMipmap (tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, 1403e5c31af7Sopenharmony_ci tcu::Sampler::NEAREST_MIPMAP_NEAREST, tcu::Sampler::NEAREST, 1404e5c31af7Sopenharmony_ci 0.0f /* LOD threshold */, true /* normalized coords */, tcu::Sampler::COMPAREMODE_LESS, 1405e5c31af7Sopenharmony_ci 0 /* cmp channel */, tcu::Vec4(0.0f) /* border color */, true /* seamless cube map */); 1406e5c31af7Sopenharmony_ci 1407e5c31af7Sopenharmony_ci static const tcu::Sampler samplerTexelFetch (tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, 1408e5c31af7Sopenharmony_ci tcu::Sampler::NEAREST_MIPMAP_NEAREST, tcu::Sampler::NEAREST, 1409e5c31af7Sopenharmony_ci 0.0f /* LOD threshold */, false /* non-normalized coords */, tcu::Sampler::COMPAREMODE_NONE, 1410e5c31af7Sopenharmony_ci 0 /* cmp channel */, tcu::Vec4(0.0f) /* border color */, true /* seamless cube map */); 1411e5c31af7Sopenharmony_ci 1412e5c31af7Sopenharmony_ci // Default textures. 1413e5c31af7Sopenharmony_ci // Type Format W H D L Sampler 1414e5c31af7Sopenharmony_ci static const TextureSpec tex2DFixed (TEXTURETYPE_2D, GL_RGBA8, 256, 256, 1, 1, samplerLinearNoMipmap); 1415e5c31af7Sopenharmony_ci static const TextureSpec tex2DFloat (TEXTURETYPE_2D, GL_RGBA16F, 256, 256, 1, 1, samplerLinearNoMipmap); 1416e5c31af7Sopenharmony_ci static const TextureSpec tex2DInt (TEXTURETYPE_2D, GL_RGBA8I, 256, 256, 1, 1, samplerNearestNoMipmap); 1417e5c31af7Sopenharmony_ci static const TextureSpec tex2DUint (TEXTURETYPE_2D, GL_RGBA8UI, 256, 256, 1, 1, samplerNearestNoMipmap); 1418e5c31af7Sopenharmony_ci static const TextureSpec tex2DMipmapFixed (TEXTURETYPE_2D, GL_RGBA8, 256, 256, 1, 9, samplerLinearMipmap); 1419e5c31af7Sopenharmony_ci static const TextureSpec tex2DMipmapFloat (TEXTURETYPE_2D, GL_RGBA16F, 256, 256, 1, 9, samplerLinearMipmap); 1420e5c31af7Sopenharmony_ci static const TextureSpec tex2DMipmapInt (TEXTURETYPE_2D, GL_RGBA8I, 256, 256, 1, 9, samplerNearestMipmap); 1421e5c31af7Sopenharmony_ci static const TextureSpec tex2DMipmapUint (TEXTURETYPE_2D, GL_RGBA8UI, 256, 256, 1, 9, samplerNearestMipmap); 1422e5c31af7Sopenharmony_ci 1423e5c31af7Sopenharmony_ci static const TextureSpec tex2DShadow (TEXTURETYPE_2D, GL_DEPTH_COMPONENT16, 256, 256, 1, 9, samplerShadowNoMipmap); 1424e5c31af7Sopenharmony_ci static const TextureSpec tex2DMipmapShadow (TEXTURETYPE_2D, GL_DEPTH_COMPONENT16, 256, 256, 1, 9, samplerShadowMipmap); 1425e5c31af7Sopenharmony_ci 1426e5c31af7Sopenharmony_ci static const TextureSpec tex2DTexelFetchFixed (TEXTURETYPE_2D, GL_RGBA8, 256, 256, 1, 9, samplerTexelFetch); 1427e5c31af7Sopenharmony_ci static const TextureSpec tex2DTexelFetchFloat (TEXTURETYPE_2D, GL_RGBA16F, 256, 256, 1, 9, samplerTexelFetch); 1428e5c31af7Sopenharmony_ci static const TextureSpec tex2DTexelFetchInt (TEXTURETYPE_2D, GL_RGBA8I, 256, 256, 1, 9, samplerTexelFetch); 1429e5c31af7Sopenharmony_ci static const TextureSpec tex2DTexelFetchUint (TEXTURETYPE_2D, GL_RGBA8UI, 256, 256, 1, 9, samplerTexelFetch); 1430e5c31af7Sopenharmony_ci 1431e5c31af7Sopenharmony_ci static const TextureSpec texCubeFixed (TEXTURETYPE_CUBE_MAP, GL_RGBA8, 256, 256, 1, 1, samplerLinearNoMipmap); 1432e5c31af7Sopenharmony_ci static const TextureSpec texCubeFloat (TEXTURETYPE_CUBE_MAP, GL_RGBA16F, 256, 256, 1, 1, samplerLinearNoMipmap); 1433e5c31af7Sopenharmony_ci static const TextureSpec texCubeInt (TEXTURETYPE_CUBE_MAP, GL_RGBA8I, 256, 256, 1, 1, samplerNearestNoMipmap); 1434e5c31af7Sopenharmony_ci static const TextureSpec texCubeUint (TEXTURETYPE_CUBE_MAP, GL_RGBA8UI, 256, 256, 1, 1, samplerNearestNoMipmap); 1435e5c31af7Sopenharmony_ci static const TextureSpec texCubeMipmapFixed (TEXTURETYPE_CUBE_MAP, GL_RGBA8, 256, 256, 1, 9, samplerLinearMipmap); 1436e5c31af7Sopenharmony_ci static const TextureSpec texCubeMipmapFloat (TEXTURETYPE_CUBE_MAP, GL_RGBA16F, 128, 128, 1, 8, samplerLinearMipmap); 1437e5c31af7Sopenharmony_ci static const TextureSpec texCubeMipmapInt (TEXTURETYPE_CUBE_MAP, GL_RGBA8I, 256, 256, 1, 9, samplerNearestMipmap); 1438e5c31af7Sopenharmony_ci static const TextureSpec texCubeMipmapUint (TEXTURETYPE_CUBE_MAP, GL_RGBA8UI, 256, 256, 1, 9, samplerNearestMipmap); 1439e5c31af7Sopenharmony_ci 1440e5c31af7Sopenharmony_ci static const TextureSpec texCubeShadow (TEXTURETYPE_CUBE_MAP, GL_DEPTH_COMPONENT16, 256, 256, 1, 1, samplerShadowNoMipmap); 1441e5c31af7Sopenharmony_ci static const TextureSpec texCubeMipmapShadow (TEXTURETYPE_CUBE_MAP, GL_DEPTH_COMPONENT16, 256, 256, 1, 9, samplerShadowMipmap); 1442e5c31af7Sopenharmony_ci 1443e5c31af7Sopenharmony_ci static const TextureSpec tex2DArrayFixed (TEXTURETYPE_2D_ARRAY, GL_RGBA8, 128, 128, 4, 1, samplerLinearNoMipmap); 1444e5c31af7Sopenharmony_ci static const TextureSpec tex2DArrayFloat (TEXTURETYPE_2D_ARRAY, GL_RGBA16F, 128, 128, 4, 1, samplerLinearNoMipmap); 1445e5c31af7Sopenharmony_ci static const TextureSpec tex2DArrayInt (TEXTURETYPE_2D_ARRAY, GL_RGBA8I, 128, 128, 4, 1, samplerNearestNoMipmap); 1446e5c31af7Sopenharmony_ci static const TextureSpec tex2DArrayUint (TEXTURETYPE_2D_ARRAY, GL_RGBA8UI, 128, 128, 4, 1, samplerNearestNoMipmap); 1447e5c31af7Sopenharmony_ci static const TextureSpec tex2DArrayMipmapFixed (TEXTURETYPE_2D_ARRAY, GL_RGBA8, 128, 128, 4, 8, samplerLinearMipmap); 1448e5c31af7Sopenharmony_ci static const TextureSpec tex2DArrayMipmapFloat (TEXTURETYPE_2D_ARRAY, GL_RGBA16F, 128, 128, 4, 8, samplerLinearMipmap); 1449e5c31af7Sopenharmony_ci static const TextureSpec tex2DArrayMipmapInt (TEXTURETYPE_2D_ARRAY, GL_RGBA8I, 128, 128, 4, 8, samplerNearestMipmap); 1450e5c31af7Sopenharmony_ci static const TextureSpec tex2DArrayMipmapUint (TEXTURETYPE_2D_ARRAY, GL_RGBA8UI, 128, 128, 4, 8, samplerNearestMipmap); 1451e5c31af7Sopenharmony_ci 1452e5c31af7Sopenharmony_ci static const TextureSpec tex2DArrayShadow (TEXTURETYPE_2D_ARRAY, GL_DEPTH_COMPONENT16, 128, 128, 4, 1, samplerShadowNoMipmap); 1453e5c31af7Sopenharmony_ci static const TextureSpec tex2DArrayMipmapShadow (TEXTURETYPE_2D_ARRAY, GL_DEPTH_COMPONENT16, 128, 128, 4, 8, samplerShadowMipmap); 1454e5c31af7Sopenharmony_ci 1455e5c31af7Sopenharmony_ci static const TextureSpec tex2DArrayTexelFetchFixed (TEXTURETYPE_2D_ARRAY, GL_RGBA8, 128, 128, 4, 8, samplerTexelFetch); 1456e5c31af7Sopenharmony_ci static const TextureSpec tex2DArrayTexelFetchFloat (TEXTURETYPE_2D_ARRAY, GL_RGBA16F, 128, 128, 4, 8, samplerTexelFetch); 1457e5c31af7Sopenharmony_ci static const TextureSpec tex2DArrayTexelFetchInt (TEXTURETYPE_2D_ARRAY, GL_RGBA8I, 128, 128, 4, 8, samplerTexelFetch); 1458e5c31af7Sopenharmony_ci static const TextureSpec tex2DArrayTexelFetchUint (TEXTURETYPE_2D_ARRAY, GL_RGBA8UI, 128, 128, 4, 8, samplerTexelFetch); 1459e5c31af7Sopenharmony_ci 1460e5c31af7Sopenharmony_ci static const TextureSpec tex3DFixed (TEXTURETYPE_3D, GL_RGBA8, 64, 32, 32, 1, samplerLinearNoMipmap); 1461e5c31af7Sopenharmony_ci static const TextureSpec tex3DFloat (TEXTURETYPE_3D, GL_RGBA16F, 64, 32, 32, 1, samplerLinearNoMipmap); 1462e5c31af7Sopenharmony_ci static const TextureSpec tex3DInt (TEXTURETYPE_3D, GL_RGBA8I, 64, 32, 32, 1, samplerNearestNoMipmap); 1463e5c31af7Sopenharmony_ci static const TextureSpec tex3DUint (TEXTURETYPE_3D, GL_RGBA8UI, 64, 32, 32, 1, samplerNearestNoMipmap); 1464e5c31af7Sopenharmony_ci static const TextureSpec tex3DMipmapFixed (TEXTURETYPE_3D, GL_RGBA8, 64, 32, 32, 7, samplerLinearMipmap); 1465e5c31af7Sopenharmony_ci static const TextureSpec tex3DMipmapFloat (TEXTURETYPE_3D, GL_RGBA16F, 64, 32, 32, 7, samplerLinearMipmap); 1466e5c31af7Sopenharmony_ci static const TextureSpec tex3DMipmapInt (TEXTURETYPE_3D, GL_RGBA8I, 64, 32, 32, 7, samplerNearestMipmap); 1467e5c31af7Sopenharmony_ci static const TextureSpec tex3DMipmapUint (TEXTURETYPE_3D, GL_RGBA8UI, 64, 32, 32, 7, samplerNearestMipmap); 1468e5c31af7Sopenharmony_ci 1469e5c31af7Sopenharmony_ci static const TextureSpec tex3DTexelFetchFixed (TEXTURETYPE_3D, GL_RGBA8, 64, 32, 32, 7, samplerTexelFetch); 1470e5c31af7Sopenharmony_ci static const TextureSpec tex3DTexelFetchFloat (TEXTURETYPE_3D, GL_RGBA16F, 64, 32, 32, 7, samplerTexelFetch); 1471e5c31af7Sopenharmony_ci static const TextureSpec tex3DTexelFetchInt (TEXTURETYPE_3D, GL_RGBA8I, 64, 32, 32, 7, samplerTexelFetch); 1472e5c31af7Sopenharmony_ci static const TextureSpec tex3DTexelFetchUint (TEXTURETYPE_3D, GL_RGBA8UI, 64, 32, 32, 7, samplerTexelFetch); 1473e5c31af7Sopenharmony_ci 1474e5c31af7Sopenharmony_ci // texture() cases 1475e5c31af7Sopenharmony_ci static const TexFuncCaseSpec textureCases[] = 1476e5c31af7Sopenharmony_ci { 1477e5c31af7Sopenharmony_ci // Name Function MinCoord MaxCoord Bias? MinLod MaxLod Offset? Offset Format EvalFunc Flags 1478e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_fixed, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DFixed, evalTexture2D, VERTEX), 1479e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_fixed, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DMipmapFixed, evalTexture2D, FRAGMENT), 1480e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_float, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DFloat, evalTexture2D, VERTEX), 1481e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_float, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DMipmapFloat, evalTexture2D, FRAGMENT), 1482e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DInt, evalTexture2D, VERTEX), 1483e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DMipmapInt, evalTexture2D, FRAGMENT), 1484e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DUint, evalTexture2D, VERTEX), 1485e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DMipmapUint, evalTexture2D, FRAGMENT), 1486e5c31af7Sopenharmony_ci 1487e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_bias_fixed, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), tex2DMipmapFixed, evalTexture2DBias, FRAGMENT), 1488e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_bias_float, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), tex2DMipmapFloat, evalTexture2DBias, FRAGMENT), 1489e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d_bias, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), tex2DMipmapInt, evalTexture2DBias, FRAGMENT), 1490e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d_bias, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), tex2DMipmapUint, evalTexture2DBias, FRAGMENT), 1491e5c31af7Sopenharmony_ci 1492e5c31af7Sopenharmony_ci CASE_SPEC(samplercube_fixed, FUNCTION_TEXTURE, Vec4(-1.0f, -1.0f, 1.01f, 0.0f), Vec4( 1.0f, 1.0f, 1.01f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), texCubeFixed, evalTextureCube, VERTEX), 1493e5c31af7Sopenharmony_ci CASE_SPEC(samplercube_fixed, FUNCTION_TEXTURE, Vec4(-1.0f, -1.0f, 1.01f, 0.0f), Vec4( 1.0f, 1.0f, 1.01f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), texCubeMipmapFixed, evalTextureCube, FRAGMENT), 1494e5c31af7Sopenharmony_ci CASE_SPEC(samplercube_float, FUNCTION_TEXTURE, Vec4(-1.0f, -1.0f, -1.01f, 0.0f), Vec4( 1.0f, 1.0f, -1.01f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), texCubeFloat, evalTextureCube, VERTEX), 1495e5c31af7Sopenharmony_ci CASE_SPEC(samplercube_float, FUNCTION_TEXTURE, Vec4(-1.0f, -1.0f, -1.01f, 0.0f), Vec4( 1.0f, 1.0f, -1.01f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), texCubeMipmapFloat, evalTextureCube, FRAGMENT), 1496e5c31af7Sopenharmony_ci CASE_SPEC(isamplercube, FUNCTION_TEXTURE, Vec4(-1.0f, -1.0f, 1.01f, 0.0f), Vec4( 1.0f, 1.0f, 1.01f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), texCubeInt, evalTextureCube, VERTEX), 1497e5c31af7Sopenharmony_ci CASE_SPEC(isamplercube, FUNCTION_TEXTURE, Vec4(-1.0f, -1.0f, 1.01f, 0.0f), Vec4( 1.0f, 1.0f, 1.01f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), texCubeMipmapInt, evalTextureCube, FRAGMENT), 1498e5c31af7Sopenharmony_ci CASE_SPEC(usamplercube, FUNCTION_TEXTURE, Vec4(-1.0f, -1.0f, -1.01f, 0.0f), Vec4( 1.0f, 1.0f, -1.01f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), texCubeUint, evalTextureCube, VERTEX), 1499e5c31af7Sopenharmony_ci CASE_SPEC(usamplercube, FUNCTION_TEXTURE, Vec4(-1.0f, -1.0f, -1.01f, 0.0f), Vec4( 1.0f, 1.0f, -1.01f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), texCubeMipmapUint, evalTextureCube, FRAGMENT), 1500e5c31af7Sopenharmony_ci 1501e5c31af7Sopenharmony_ci CASE_SPEC(samplercube_bias_fixed, FUNCTION_TEXTURE, Vec4(-1.0f, -1.0f, 1.01f, 0.0f), Vec4( 1.0f, 1.0f, 1.01f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), texCubeMipmapFixed, evalTextureCubeBias, FRAGMENT), 1502e5c31af7Sopenharmony_ci CASE_SPEC(samplercube_bias_float, FUNCTION_TEXTURE, Vec4(-1.0f, -1.0f, -1.01f, 0.0f), Vec4( 1.0f, 1.0f, -1.01f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), texCubeMipmapFloat, evalTextureCubeBias, FRAGMENT), 1503e5c31af7Sopenharmony_ci CASE_SPEC(isamplercube_bias, FUNCTION_TEXTURE, Vec4(-1.0f, -1.0f, 1.01f, 0.0f), Vec4( 1.0f, 1.0f, 1.01f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), texCubeMipmapInt, evalTextureCubeBias, FRAGMENT), 1504e5c31af7Sopenharmony_ci CASE_SPEC(usamplercube_bias, FUNCTION_TEXTURE, Vec4(-1.0f, -1.0f, -1.01f, 0.0f), Vec4( 1.0f, 1.0f, -1.01f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), texCubeMipmapUint, evalTextureCubeBias, FRAGMENT), 1505e5c31af7Sopenharmony_ci 1506e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_fixed, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DArrayFixed, evalTexture2DArray, VERTEX), 1507e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_fixed, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DArrayMipmapFixed, evalTexture2DArray, FRAGMENT), 1508e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_float, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DArrayFloat, evalTexture2DArray, VERTEX), 1509e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_float, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DArrayMipmapFloat, evalTexture2DArray, FRAGMENT), 1510e5c31af7Sopenharmony_ci CASE_SPEC(isampler2darray, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DArrayInt, evalTexture2DArray, VERTEX), 1511e5c31af7Sopenharmony_ci CASE_SPEC(isampler2darray, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DArrayMipmapInt, evalTexture2DArray, FRAGMENT), 1512e5c31af7Sopenharmony_ci CASE_SPEC(usampler2darray, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DArrayUint, evalTexture2DArray, VERTEX), 1513e5c31af7Sopenharmony_ci CASE_SPEC(usampler2darray, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DArrayMipmapUint, evalTexture2DArray, FRAGMENT), 1514e5c31af7Sopenharmony_ci 1515e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_bias_fixed, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), tex2DArrayMipmapFixed, evalTexture2DArrayBias, FRAGMENT), 1516e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_bias_float, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), tex2DArrayMipmapFloat, evalTexture2DArrayBias, FRAGMENT), 1517e5c31af7Sopenharmony_ci CASE_SPEC(isampler2darray_bias, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), tex2DArrayMipmapInt, evalTexture2DArrayBias, FRAGMENT), 1518e5c31af7Sopenharmony_ci CASE_SPEC(usampler2darray_bias, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), tex2DArrayMipmapUint, evalTexture2DArrayBias, FRAGMENT), 1519e5c31af7Sopenharmony_ci 1520e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_fixed, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex3DFixed, evalTexture3D, VERTEX), 1521e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_fixed, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex3DMipmapFixed, evalTexture3D, FRAGMENT), 1522e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_float, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex3DFloat, evalTexture3D, VERTEX), 1523e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_float, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex3DMipmapFloat, evalTexture3D, FRAGMENT), 1524e5c31af7Sopenharmony_ci CASE_SPEC(isampler3d, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex3DInt, evalTexture3D, VERTEX), 1525e5c31af7Sopenharmony_ci CASE_SPEC(isampler3d, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex3DMipmapInt, evalTexture3D, FRAGMENT), 1526e5c31af7Sopenharmony_ci CASE_SPEC(usampler3d, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex3DUint, evalTexture3D, VERTEX), 1527e5c31af7Sopenharmony_ci CASE_SPEC(usampler3d, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex3DMipmapUint, evalTexture3D, FRAGMENT), 1528e5c31af7Sopenharmony_ci 1529e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_bias_fixed, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), true, -2.0f, 1.0f, false, IVec3(0), tex3DMipmapFixed, evalTexture3DBias, FRAGMENT), 1530e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_bias_float, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), true, -2.0f, 1.0f, false, IVec3(0), tex3DMipmapFloat, evalTexture3DBias, FRAGMENT), 1531e5c31af7Sopenharmony_ci CASE_SPEC(isampler3d_bias, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), tex3DMipmapInt, evalTexture3DBias, FRAGMENT), 1532e5c31af7Sopenharmony_ci CASE_SPEC(usampler3d_bias, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), tex3DMipmapUint, evalTexture3DBias, FRAGMENT), 1533e5c31af7Sopenharmony_ci 1534e5c31af7Sopenharmony_ci CASE_SPEC(sampler2dshadow, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 1.0f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DShadow, evalTexture2DShadow, VERTEX), 1535e5c31af7Sopenharmony_ci CASE_SPEC(sampler2dshadow, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 1.0f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DMipmapShadow, evalTexture2DShadow, FRAGMENT), 1536e5c31af7Sopenharmony_ci CASE_SPEC(sampler2dshadow_bias, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 1.0f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), tex2DMipmapShadow, evalTexture2DShadowBias, FRAGMENT), 1537e5c31af7Sopenharmony_ci 1538e5c31af7Sopenharmony_ci CASE_SPEC(samplercubeshadow, FUNCTION_TEXTURE, Vec4(-1.0f, -1.0f, 1.01f, 0.0f), Vec4( 1.0f, 1.0f, 1.01f, 1.0f), false, 0.0f, 0.0f, false, IVec3(0), texCubeShadow, evalTextureCubeShadow, VERTEX), 1539e5c31af7Sopenharmony_ci CASE_SPEC(samplercubeshadow, FUNCTION_TEXTURE, Vec4(-1.0f, -1.0f, 1.01f, 0.0f), Vec4( 1.0f, 1.0f, 1.01f, 1.0f), false, 0.0f, 0.0f, false, IVec3(0), texCubeMipmapShadow, evalTextureCubeShadow, FRAGMENT), 1540e5c31af7Sopenharmony_ci CASE_SPEC(samplercubeshadow_bias, FUNCTION_TEXTURE, Vec4(-1.0f, -1.0f, 1.01f, 0.0f), Vec4( 1.0f, 1.0f, 1.01f, 1.0f), true, -2.0f, 2.0f, false, IVec3(0), texCubeMipmapShadow, evalTextureCubeShadowBias, FRAGMENT), 1541e5c31af7Sopenharmony_ci 1542e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darrayshadow, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 1.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DArrayShadow, evalTexture2DArrayShadow, VERTEX), 1543e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darrayshadow, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 1.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DArrayMipmapShadow, evalTexture2DArrayShadow, FRAGMENT) 1544e5c31af7Sopenharmony_ci 1545e5c31af7Sopenharmony_ci // Not in spec. 1546e5c31af7Sopenharmony_ci// CASE_SPEC(sampler2darrayshadow_bias, (FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 1.0f), true, -2.0f, 2.0f, Vec2(0.0f), Vec2(0.0f), false, IVec3(0)), tex2DArrayMipmapShadow, evalTexture2DArrayShadowBias, FRAGMENT) 1547e5c31af7Sopenharmony_ci }; 1548e5c31af7Sopenharmony_ci createCaseGroup(this, "texture", "texture() Tests", textureCases, DE_LENGTH_OF_ARRAY(textureCases)); 1549e5c31af7Sopenharmony_ci 1550e5c31af7Sopenharmony_ci // textureOffset() cases 1551e5c31af7Sopenharmony_ci // \note _bias variants are not using mipmap thanks to wide allowed range for LOD computation 1552e5c31af7Sopenharmony_ci static const TexFuncCaseSpec textureOffsetCases[] = 1553e5c31af7Sopenharmony_ci { 1554e5c31af7Sopenharmony_ci // Name Function MinCoord MaxCoord Bias? MinLod MaxLod Offset? Offset Format EvalFunc Flags 1555e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_fixed, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DFixed, evalTexture2DOffset, VERTEX), 1556e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_fixed, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, 0.0f, 0.0f, true, IVec3(7, -8, 0), tex2DMipmapFixed, evalTexture2DOffset, FRAGMENT), 1557e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_float, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DFloat, evalTexture2DOffset, VERTEX), 1558e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_float, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, 0.0f, 0.0f, true, IVec3(7, -8, 0), tex2DMipmapFloat, evalTexture2DOffset, FRAGMENT), 1559e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DInt, evalTexture2DOffset, VERTEX), 1560e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, 0.0f, 0.0f, true, IVec3(7, -8, 0), tex2DMipmapInt, evalTexture2DOffset, FRAGMENT), 1561e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DUint, evalTexture2DOffset, VERTEX), 1562e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, 0.0f, 0.0f, true, IVec3(7, -8, 0), tex2DMipmapUint, evalTexture2DOffset, FRAGMENT), 1563e5c31af7Sopenharmony_ci 1564e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_bias_fixed, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), true, -2.0f, 2.0f, true, IVec3(-8, 7, 0), tex2DFixed, evalTexture2DOffsetBias, FRAGMENT), 1565e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_bias_float, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), true, -2.0f, 2.0f, true, IVec3(7, -8, 0), tex2DFloat, evalTexture2DOffsetBias, FRAGMENT), 1566e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d_bias, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), true, -2.0f, 2.0f, true, IVec3(-8, 7, 0), tex2DInt, evalTexture2DOffsetBias, FRAGMENT), 1567e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d_bias, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), true, -2.0f, 2.0f, true, IVec3(7, -8, 0), tex2DUint, evalTexture2DOffsetBias, FRAGMENT), 1568e5c31af7Sopenharmony_ci 1569e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_fixed, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DArrayFixed, evalTexture2DArrayOffset, VERTEX), 1570e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_fixed, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, 0.0f, 0.0f, true, IVec3(7, -8, 0), tex2DArrayMipmapFixed, evalTexture2DArrayOffset, FRAGMENT), 1571e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_float, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DArrayFloat, evalTexture2DArrayOffset, VERTEX), 1572e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_float, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, 0.0f, 0.0f, true, IVec3(7, -8, 0), tex2DArrayMipmapFloat, evalTexture2DArrayOffset, FRAGMENT), 1573e5c31af7Sopenharmony_ci CASE_SPEC(isampler2darray, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DArrayInt, evalTexture2DArrayOffset, VERTEX), 1574e5c31af7Sopenharmony_ci CASE_SPEC(isampler2darray, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, 0.0f, 0.0f, true, IVec3(7, -8, 0), tex2DArrayMipmapInt, evalTexture2DArrayOffset, FRAGMENT), 1575e5c31af7Sopenharmony_ci CASE_SPEC(usampler2darray, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DArrayUint, evalTexture2DArrayOffset, VERTEX), 1576e5c31af7Sopenharmony_ci CASE_SPEC(usampler2darray, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, 0.0f, 0.0f, true, IVec3(7, -8, 0), tex2DArrayMipmapUint, evalTexture2DArrayOffset, FRAGMENT), 1577e5c31af7Sopenharmony_ci 1578e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_bias_fixed, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), true, -2.0f, 2.0f, true, IVec3(-8, 7, 0), tex2DArrayFixed, evalTexture2DArrayOffsetBias, FRAGMENT), 1579e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_bias_float, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), true, -2.0f, 2.0f, true, IVec3(7, -8, 0), tex2DArrayFloat, evalTexture2DArrayOffsetBias, FRAGMENT), 1580e5c31af7Sopenharmony_ci CASE_SPEC(isampler2darray_bias, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), true, -2.0f, 2.0f, true, IVec3(-8, 7, 0), tex2DArrayInt, evalTexture2DArrayOffsetBias, FRAGMENT), 1581e5c31af7Sopenharmony_ci CASE_SPEC(usampler2darray_bias, FUNCTION_TEXTURE, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), true, -2.0f, 2.0f, true, IVec3(7, -8, 0), tex2DArrayUint, evalTexture2DArrayOffsetBias, FRAGMENT), 1582e5c31af7Sopenharmony_ci 1583e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_fixed, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 3), tex3DFixed, evalTexture3DOffset, VERTEX), 1584e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_fixed, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, 0.0f, 0.0f, true, IVec3(7, 3, -8), tex3DMipmapFixed, evalTexture3DOffset, FRAGMENT), 1585e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_float, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, 0.0f, 0.0f, true, IVec3(3, -8, 7), tex3DFloat, evalTexture3DOffset, VERTEX), 1586e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_float, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 3), tex3DMipmapFloat, evalTexture3DOffset, FRAGMENT), 1587e5c31af7Sopenharmony_ci CASE_SPEC(isampler3d, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, 0.0f, 0.0f, true, IVec3(7, 3, -8), tex3DInt, evalTexture3DOffset, VERTEX), 1588e5c31af7Sopenharmony_ci CASE_SPEC(isampler3d, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, 0.0f, 0.0f, true, IVec3(3, -8, 7), tex3DMipmapInt, evalTexture3DOffset, FRAGMENT), 1589e5c31af7Sopenharmony_ci CASE_SPEC(usampler3d, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 3), tex3DUint, evalTexture3DOffset, VERTEX), 1590e5c31af7Sopenharmony_ci CASE_SPEC(usampler3d, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, 0.0f, 0.0f, true, IVec3(7, 3, -8), tex3DMipmapUint, evalTexture3DOffset, FRAGMENT), 1591e5c31af7Sopenharmony_ci 1592e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_bias_fixed, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), true, -2.0f, 1.0f, true, IVec3(-8, 7, 3), tex3DFixed, evalTexture3DOffsetBias, FRAGMENT), 1593e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_bias_float, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), true, -2.0f, 1.0f, true, IVec3(7, 3, -8), tex3DFloat, evalTexture3DOffsetBias, FRAGMENT), 1594e5c31af7Sopenharmony_ci CASE_SPEC(isampler3d_bias, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), true, -2.0f, 2.0f, true, IVec3(3, -8, 7), tex3DInt, evalTexture3DOffsetBias, FRAGMENT), 1595e5c31af7Sopenharmony_ci CASE_SPEC(usampler3d_bias, FUNCTION_TEXTURE, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), true, -2.0f, 2.0f, true, IVec3(-8, 7, 3), tex3DUint, evalTexture3DOffsetBias, FRAGMENT), 1596e5c31af7Sopenharmony_ci 1597e5c31af7Sopenharmony_ci CASE_SPEC(sampler2dshadow, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 1.0f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DShadow, evalTexture2DShadowOffset, VERTEX), 1598e5c31af7Sopenharmony_ci CASE_SPEC(sampler2dshadow, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 1.0f, 0.0f), false, 0.0f, 0.0f, true, IVec3(7, -8, 0), tex2DMipmapShadow, evalTexture2DShadowOffset, FRAGMENT), 1599e5c31af7Sopenharmony_ci CASE_SPEC(sampler2dshadow_bias, FUNCTION_TEXTURE, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 1.0f, 0.0f), true, -2.0f, 2.0f, true, IVec3(-8, 7, 0), tex2DShadow, evalTexture2DShadowOffsetBias, FRAGMENT) 1600e5c31af7Sopenharmony_ci }; 1601e5c31af7Sopenharmony_ci createCaseGroup(this, "textureoffset", "textureOffset() Tests", textureOffsetCases, DE_LENGTH_OF_ARRAY(textureOffsetCases)); 1602e5c31af7Sopenharmony_ci 1603e5c31af7Sopenharmony_ci // textureProj() cases 1604e5c31af7Sopenharmony_ci // \note Currently uses constant divider! 1605e5c31af7Sopenharmony_ci static const TexFuncCaseSpec textureProjCases[] = 1606e5c31af7Sopenharmony_ci { 1607e5c31af7Sopenharmony_ci // Name Function MinCoord MaxCoord Bias? MinLod MaxLod Offset? Offset Format EvalFunc Flags 1608e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec3_fixed, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DFixed, evalTexture2DProj3, VERTEX), 1609e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec3_fixed, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DMipmapFixed, evalTexture2DProj3, FRAGMENT), 1610e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec3_float, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DFloat, evalTexture2DProj3, VERTEX), 1611e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec3_float, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DMipmapFloat, evalTexture2DProj3, FRAGMENT), 1612e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d_vec3, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DInt, evalTexture2DProj3, VERTEX), 1613e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d_vec3, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DMipmapInt, evalTexture2DProj3, FRAGMENT), 1614e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d_vec3, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DUint, evalTexture2DProj3, VERTEX), 1615e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d_vec3, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DMipmapUint, evalTexture2DProj3, FRAGMENT), 1616e5c31af7Sopenharmony_ci 1617e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec3_bias_fixed, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), tex2DMipmapFixed, evalTexture2DProj3Bias, FRAGMENT), 1618e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec3_bias_float, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), tex2DMipmapFloat, evalTexture2DProj3Bias, FRAGMENT), 1619e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d_vec3_bias, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), tex2DMipmapInt, evalTexture2DProj3Bias, FRAGMENT), 1620e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d_vec3_bias, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), true, -2.0f, 2.0f, false, IVec3(0), tex2DMipmapUint, evalTexture2DProj3Bias, FRAGMENT), 1621e5c31af7Sopenharmony_ci 1622e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec4_fixed, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, 0.0f, 0.0f, false, IVec3(0), tex2DFixed, evalTexture2DProj, VERTEX), 1623e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec4_fixed, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, 0.0f, 0.0f, false, IVec3(0), tex2DMipmapFixed, evalTexture2DProj, FRAGMENT), 1624e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec4_float, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, 0.0f, 0.0f, false, IVec3(0), tex2DFloat, evalTexture2DProj, VERTEX), 1625e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec4_float, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, 0.0f, 0.0f, false, IVec3(0), tex2DMipmapFloat, evalTexture2DProj, FRAGMENT), 1626e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d_vec4, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, 0.0f, 0.0f, false, IVec3(0), tex2DInt, evalTexture2DProj, VERTEX), 1627e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d_vec4, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, 0.0f, 0.0f, false, IVec3(0), tex2DMipmapInt, evalTexture2DProj, FRAGMENT), 1628e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d_vec4, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, 0.0f, 0.0f, false, IVec3(0), tex2DUint, evalTexture2DProj, VERTEX), 1629e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d_vec4, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, 0.0f, 0.0f, false, IVec3(0), tex2DMipmapUint, evalTexture2DProj, FRAGMENT), 1630e5c31af7Sopenharmony_ci 1631e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec4_bias_fixed, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), true, -2.0f, 2.0f, false, IVec3(0), tex2DMipmapFixed, evalTexture2DProjBias, FRAGMENT), 1632e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec4_bias_float, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), true, -2.0f, 2.0f, false, IVec3(0), tex2DMipmapFloat, evalTexture2DProjBias, FRAGMENT), 1633e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d_vec4_bias, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), true, -2.0f, 2.0f, false, IVec3(0), tex2DMipmapInt, evalTexture2DProjBias, FRAGMENT), 1634e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d_vec4_bias, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), true, -2.0f, 2.0f, false, IVec3(0), tex2DMipmapUint, evalTexture2DProjBias, FRAGMENT), 1635e5c31af7Sopenharmony_ci 1636e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_fixed, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, 0.0f, 0.0f, false, IVec3(0), tex3DFixed, evalTexture3DProj, VERTEX), 1637e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_fixed, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, 0.0f, 0.0f, false, IVec3(0), tex3DMipmapFixed, evalTexture3DProj, FRAGMENT), 1638e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_float, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, 0.0f, 0.0f, false, IVec3(0), tex3DFloat, evalTexture3DProj, VERTEX), 1639e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_float, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, 0.0f, 0.0f, false, IVec3(0), tex3DMipmapFloat, evalTexture3DProj, FRAGMENT), 1640e5c31af7Sopenharmony_ci CASE_SPEC(isampler3d, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, 0.0f, 0.0f, false, IVec3(0), tex3DInt, evalTexture3DProj, VERTEX), 1641e5c31af7Sopenharmony_ci CASE_SPEC(isampler3d, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, 0.0f, 0.0f, false, IVec3(0), tex3DMipmapInt, evalTexture3DProj, FRAGMENT), 1642e5c31af7Sopenharmony_ci CASE_SPEC(usampler3d, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, 0.0f, 0.0f, false, IVec3(0), tex3DUint, evalTexture3DProj, VERTEX), 1643e5c31af7Sopenharmony_ci CASE_SPEC(usampler3d, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, 0.0f, 0.0f, false, IVec3(0), tex3DMipmapUint, evalTexture3DProj, FRAGMENT), 1644e5c31af7Sopenharmony_ci 1645e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_bias_fixed, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), true, -2.0f, 1.0f, false, IVec3(0), tex3DMipmapFixed, evalTexture3DProjBias, FRAGMENT), 1646e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_bias_float, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), true, -2.0f, 1.0f, false, IVec3(0), tex3DMipmapFloat, evalTexture3DProjBias, FRAGMENT), 1647e5c31af7Sopenharmony_ci CASE_SPEC(isampler3d_bias, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), true, -2.0f, 2.0f, false, IVec3(0), tex3DMipmapInt, evalTexture3DProjBias, FRAGMENT), 1648e5c31af7Sopenharmony_ci CASE_SPEC(usampler3d_bias, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), true, -2.0f, 2.0f, false, IVec3(0), tex3DMipmapUint, evalTexture3DProjBias, FRAGMENT), 1649e5c31af7Sopenharmony_ci 1650e5c31af7Sopenharmony_ci CASE_SPEC(sampler2dshadow, FUNCTION_TEXTUREPROJ, Vec4( 0.2f, 0.6f, 0.0f, 1.5f), Vec4(-2.25f, -3.45f, 1.5f, 1.5f), false, 0.0f, 0.0f, false, IVec3(0), tex2DShadow, evalTexture2DShadowProj, VERTEX), 1651e5c31af7Sopenharmony_ci CASE_SPEC(sampler2dshadow, FUNCTION_TEXTUREPROJ, Vec4( 0.2f, 0.6f, 0.0f, 1.5f), Vec4(-2.25f, -3.45f, 1.5f, 1.5f), false, 0.0f, 0.0f, false, IVec3(0), tex2DMipmapShadow, evalTexture2DShadowProj, FRAGMENT), 1652e5c31af7Sopenharmony_ci CASE_SPEC(sampler2dshadow_bias, FUNCTION_TEXTUREPROJ, Vec4( 0.2f, 0.6f, 0.0f, 1.5f), Vec4(-2.25f, -3.45f, 1.5f, 1.5f), true, -2.0f, 2.0f, false, IVec3(0), tex2DMipmapShadow, evalTexture2DShadowProjBias, FRAGMENT) 1653e5c31af7Sopenharmony_ci }; 1654e5c31af7Sopenharmony_ci createCaseGroup(this, "textureproj", "textureProj() Tests", textureProjCases, DE_LENGTH_OF_ARRAY(textureProjCases)); 1655e5c31af7Sopenharmony_ci 1656e5c31af7Sopenharmony_ci // textureProjOffset() cases 1657e5c31af7Sopenharmony_ci // \note Currently uses constant divider! 1658e5c31af7Sopenharmony_ci static const TexFuncCaseSpec textureProjOffsetCases[] = 1659e5c31af7Sopenharmony_ci { 1660e5c31af7Sopenharmony_ci // Name Function MinCoord MaxCoord Bias? MinLod MaxLod Offset? Offset Format EvalFunc Flags 1661e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec3_fixed, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DFixed, evalTexture2DProj3Offset, VERTEX), 1662e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec3_fixed, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, 0.0f, 0.0f, true, IVec3(7, -8, 0), tex2DMipmapFixed, evalTexture2DProj3Offset, FRAGMENT), 1663e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec3_float, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DFloat, evalTexture2DProj3Offset, VERTEX), 1664e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec3_float, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, 0.0f, 0.0f, true, IVec3(7, -8, 0), tex2DMipmapFloat, evalTexture2DProj3Offset, FRAGMENT), 1665e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d_vec3, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DInt, evalTexture2DProj3Offset, VERTEX), 1666e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d_vec3, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, 0.0f, 0.0f, true, IVec3(7, -8, 0), tex2DMipmapInt, evalTexture2DProj3Offset, FRAGMENT), 1667e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d_vec3, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DUint, evalTexture2DProj3Offset, VERTEX), 1668e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d_vec3, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, 0.0f, 0.0f, true, IVec3(7, -8, 0), tex2DMipmapUint, evalTexture2DProj3Offset, FRAGMENT), 1669e5c31af7Sopenharmony_ci 1670e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec3_bias_fixed, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), true, -2.0f, 2.0f, true, IVec3(-8, 7, 0), tex2DFixed, evalTexture2DProj3OffsetBias, FRAGMENT), 1671e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec3_bias_float, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), true, -2.0f, 2.0f, true, IVec3(7, -8, 0), tex2DFloat, evalTexture2DProj3OffsetBias, FRAGMENT), 1672e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d_vec3_bias, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), true, -2.0f, 2.0f, true, IVec3(-8, 7, 0), tex2DInt, evalTexture2DProj3OffsetBias, FRAGMENT), 1673e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d_vec3_bias, FUNCTION_TEXTUREPROJ3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), true, -2.0f, 2.0f, true, IVec3(7, -8, 0), tex2DUint, evalTexture2DProj3OffsetBias, FRAGMENT), 1674e5c31af7Sopenharmony_ci 1675e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec4_fixed, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DFixed, evalTexture2DProjOffset, VERTEX), 1676e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec4_fixed, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, 0.0f, 0.0f, true, IVec3(7, -8, 0), tex2DMipmapFixed, evalTexture2DProjOffset, FRAGMENT), 1677e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec4_float, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DFloat, evalTexture2DProjOffset, VERTEX), 1678e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec4_float, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, 0.0f, 0.0f, true, IVec3(7, -8, 0), tex2DMipmapFloat, evalTexture2DProjOffset, FRAGMENT), 1679e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d_vec4, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DInt, evalTexture2DProjOffset, VERTEX), 1680e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d_vec4, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, 0.0f, 0.0f, true, IVec3(7, -8, 0), tex2DMipmapInt, evalTexture2DProjOffset, FRAGMENT), 1681e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d_vec4, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DUint, evalTexture2DProjOffset, VERTEX), 1682e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d_vec4, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, 0.0f, 0.0f, true, IVec3(7, -8, 0), tex2DMipmapUint, evalTexture2DProjOffset, FRAGMENT), 1683e5c31af7Sopenharmony_ci 1684e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec4_bias_fixed, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), true, -2.0f, 2.0f, true, IVec3(-8, 7, 0), tex2DFixed, evalTexture2DProjOffsetBias, FRAGMENT), 1685e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec4_bias_float, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), true, -2.0f, 2.0f, true, IVec3(7, -8, 0), tex2DFloat, evalTexture2DProjOffsetBias, FRAGMENT), 1686e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d_vec4_bias, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), true, -2.0f, 2.0f, true, IVec3(-8, 7, 0), tex2DInt, evalTexture2DProjOffsetBias, FRAGMENT), 1687e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d_vec4_bias, FUNCTION_TEXTUREPROJ, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), true, -2.0f, 2.0f, true, IVec3(7, -8, 0), tex2DUint, evalTexture2DProjOffsetBias, FRAGMENT), 1688e5c31af7Sopenharmony_ci 1689e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_fixed, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 3), tex3DFixed, evalTexture3DProjOffset, VERTEX), 1690e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_fixed, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, 0.0f, 0.0f, true, IVec3(7, 3, -8), tex3DMipmapFixed, evalTexture3DProjOffset, FRAGMENT), 1691e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_float, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, 0.0f, 0.0f, true, IVec3(3, -8, 7), tex3DFloat, evalTexture3DProjOffset, VERTEX), 1692e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_float, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 3), tex3DMipmapFloat, evalTexture3DProjOffset, FRAGMENT), 1693e5c31af7Sopenharmony_ci CASE_SPEC(isampler3d, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, 0.0f, 0.0f, true, IVec3(7, 3, -8), tex3DInt, evalTexture3DProjOffset, VERTEX), 1694e5c31af7Sopenharmony_ci CASE_SPEC(isampler3d, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, 0.0f, 0.0f, true, IVec3(3, -8, 7), tex3DMipmapInt, evalTexture3DProjOffset, FRAGMENT), 1695e5c31af7Sopenharmony_ci CASE_SPEC(usampler3d, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 3), tex3DUint, evalTexture3DProjOffset, VERTEX), 1696e5c31af7Sopenharmony_ci CASE_SPEC(usampler3d, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, 0.0f, 0.0f, true, IVec3(7, 3, -8), tex3DMipmapUint, evalTexture3DProjOffset, FRAGMENT), 1697e5c31af7Sopenharmony_ci 1698e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_bias_fixed, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), true, -2.0f, 2.0f, true, IVec3(-8, 7, 3), tex3DFixed, evalTexture3DProjOffsetBias, FRAGMENT), 1699e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_bias_float, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), true, -2.0f, 2.0f, true, IVec3(7, 3, -8), tex3DFloat, evalTexture3DProjOffsetBias, FRAGMENT), 1700e5c31af7Sopenharmony_ci CASE_SPEC(isampler3d_bias, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), true, -2.0f, 2.0f, true, IVec3(3, -8, 7), tex3DInt, evalTexture3DProjOffsetBias, FRAGMENT), 1701e5c31af7Sopenharmony_ci CASE_SPEC(usampler3d_bias, FUNCTION_TEXTUREPROJ, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), true, -2.0f, 2.0f, true, IVec3(-8, 7, 3), tex3DUint, evalTexture3DProjOffsetBias, FRAGMENT), 1702e5c31af7Sopenharmony_ci 1703e5c31af7Sopenharmony_ci CASE_SPEC(sampler2dshadow, FUNCTION_TEXTUREPROJ, Vec4( 0.2f, 0.6f, 0.0f, 1.5f), Vec4(-2.25f, -3.45f, 1.5f, 1.5f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DShadow, evalTexture2DShadowProjOffset, VERTEX), 1704e5c31af7Sopenharmony_ci CASE_SPEC(sampler2dshadow, FUNCTION_TEXTUREPROJ, Vec4( 0.2f, 0.6f, 0.0f, 1.5f), Vec4(-2.25f, -3.45f, 1.5f, 1.5f), false, 0.0f, 0.0f, true, IVec3(7, -8, 0), tex2DMipmapShadow, evalTexture2DShadowProjOffset, FRAGMENT), 1705e5c31af7Sopenharmony_ci CASE_SPEC(sampler2dshadow_bias, FUNCTION_TEXTUREPROJ, Vec4( 0.2f, 0.6f, 0.0f, 1.5f), Vec4(-2.25f, -3.45f, 1.5f, 1.5f), true, -2.0f, 2.0f, true, IVec3(-8, 7, 0), tex2DShadow, evalTexture2DShadowProjOffsetBias, FRAGMENT) 1706e5c31af7Sopenharmony_ci }; 1707e5c31af7Sopenharmony_ci createCaseGroup(this, "textureprojoffset", "textureOffsetProj() Tests", textureProjOffsetCases, DE_LENGTH_OF_ARRAY(textureProjOffsetCases)); 1708e5c31af7Sopenharmony_ci 1709e5c31af7Sopenharmony_ci // textureLod() cases 1710e5c31af7Sopenharmony_ci static const TexFuncCaseSpec textureLodCases[] = 1711e5c31af7Sopenharmony_ci { 1712e5c31af7Sopenharmony_ci // Name Function MinCoord MaxCoord Bias? MinLod MaxLod Offset? Offset Format EvalFunc Flags 1713e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_fixed, FUNCTION_TEXTURELOD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, -1.0f, 9.0f, false, IVec3(0), tex2DMipmapFixed, evalTexture2DLod, BOTH), 1714e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_float, FUNCTION_TEXTURELOD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, -1.0f, 9.0f, false, IVec3(0), tex2DMipmapFloat, evalTexture2DLod, BOTH), 1715e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d, FUNCTION_TEXTURELOD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, -1.0f, 9.0f, false, IVec3(0), tex2DMipmapInt, evalTexture2DLod, BOTH), 1716e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d, FUNCTION_TEXTURELOD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, -1.0f, 9.0f, false, IVec3(0), tex2DMipmapUint, evalTexture2DLod, BOTH), 1717e5c31af7Sopenharmony_ci 1718e5c31af7Sopenharmony_ci CASE_SPEC(samplercube_fixed, FUNCTION_TEXTURELOD, Vec4(-1.0f, -1.0f, 1.01f, 0.0f), Vec4( 1.0f, 1.0f, 1.01f, 0.0f), false, -1.0f, 9.0f, false, IVec3(0), texCubeMipmapFixed, evalTextureCubeLod, BOTH), 1719e5c31af7Sopenharmony_ci CASE_SPEC(samplercube_float, FUNCTION_TEXTURELOD, Vec4(-1.0f, -1.0f, -1.01f, 0.0f), Vec4( 1.0f, 1.0f, -1.01f, 0.0f), false, -1.0f, 9.0f, false, IVec3(0), texCubeMipmapFloat, evalTextureCubeLod, BOTH), 1720e5c31af7Sopenharmony_ci CASE_SPEC(isamplercube, FUNCTION_TEXTURELOD, Vec4(-1.0f, -1.0f, 1.01f, 0.0f), Vec4( 1.0f, 1.0f, 1.01f, 0.0f), false, -1.0f, 9.0f, false, IVec3(0), texCubeMipmapInt, evalTextureCubeLod, BOTH), 1721e5c31af7Sopenharmony_ci CASE_SPEC(usamplercube, FUNCTION_TEXTURELOD, Vec4(-1.0f, -1.0f, -1.01f, 0.0f), Vec4( 1.0f, 1.0f, -1.01f, 0.0f), false, -1.0f, 9.0f, false, IVec3(0), texCubeMipmapUint, evalTextureCubeLod, BOTH), 1722e5c31af7Sopenharmony_ci 1723e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_fixed, FUNCTION_TEXTURELOD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, -1.0f, 8.0f, false, IVec3(0), tex2DArrayMipmapFixed, evalTexture2DArrayLod, BOTH), 1724e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_float, FUNCTION_TEXTURELOD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, -1.0f, 8.0f, false, IVec3(0), tex2DArrayMipmapFloat, evalTexture2DArrayLod, BOTH), 1725e5c31af7Sopenharmony_ci CASE_SPEC(isampler2darray, FUNCTION_TEXTURELOD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, -1.0f, 8.0f, false, IVec3(0), tex2DArrayMipmapInt, evalTexture2DArrayLod, BOTH), 1726e5c31af7Sopenharmony_ci CASE_SPEC(usampler2darray, FUNCTION_TEXTURELOD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, -1.0f, 8.0f, false, IVec3(0), tex2DArrayMipmapUint, evalTexture2DArrayLod, BOTH), 1727e5c31af7Sopenharmony_ci 1728e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_fixed, FUNCTION_TEXTURELOD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, -1.0f, 7.0f, false, IVec3(0), tex3DMipmapFixed, evalTexture3DLod, BOTH), 1729e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_float, FUNCTION_TEXTURELOD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, -1.0f, 7.0f, false, IVec3(0), tex3DMipmapFloat, evalTexture3DLod, BOTH), 1730e5c31af7Sopenharmony_ci CASE_SPEC(isampler3d, FUNCTION_TEXTURELOD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, -1.0f, 7.0f, false, IVec3(0), tex3DMipmapInt, evalTexture3DLod, BOTH), 1731e5c31af7Sopenharmony_ci CASE_SPEC(usampler3d, FUNCTION_TEXTURELOD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, -1.0f, 7.0f, false, IVec3(0), tex3DMipmapUint, evalTexture3DLod, BOTH), 1732e5c31af7Sopenharmony_ci 1733e5c31af7Sopenharmony_ci CASE_SPEC(sampler2dshadow, FUNCTION_TEXTURELOD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 1.0f, 0.0f), false, -1.0f, 9.0f, false, IVec3(0), tex2DMipmapShadow, evalTexture2DShadowLod, BOTH) 1734e5c31af7Sopenharmony_ci }; 1735e5c31af7Sopenharmony_ci createCaseGroup(this, "texturelod", "textureLod() Tests", textureLodCases, DE_LENGTH_OF_ARRAY(textureLodCases)); 1736e5c31af7Sopenharmony_ci 1737e5c31af7Sopenharmony_ci // textureLodOffset() cases 1738e5c31af7Sopenharmony_ci static const TexFuncCaseSpec textureLodOffsetCases[] = 1739e5c31af7Sopenharmony_ci { 1740e5c31af7Sopenharmony_ci // Name Function MinCoord MaxCoord Bias? MinLod MaxLod Offset? Offset Format EvalFunc Flags 1741e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_fixed, FUNCTION_TEXTURELOD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, -1.0f, 9.0f, true, IVec3(-8, 7, 0), tex2DMipmapFixed, evalTexture2DLodOffset, BOTH), 1742e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_float, FUNCTION_TEXTURELOD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, -1.0f, 9.0f, true, IVec3(7, -8, 0), tex2DMipmapFloat, evalTexture2DLodOffset, BOTH), 1743e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d, FUNCTION_TEXTURELOD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, -1.0f, 9.0f, true, IVec3(-8, 7, 0), tex2DMipmapInt, evalTexture2DLodOffset, BOTH), 1744e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d, FUNCTION_TEXTURELOD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), false, -1.0f, 9.0f, true, IVec3(7, -8, 0), tex2DMipmapUint, evalTexture2DLodOffset, BOTH), 1745e5c31af7Sopenharmony_ci 1746e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_fixed, FUNCTION_TEXTURELOD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, -1.0f, 8.0f, true, IVec3(-8, 7, 0), tex2DArrayMipmapFixed, evalTexture2DArrayLodOffset, BOTH), 1747e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_float, FUNCTION_TEXTURELOD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, -1.0f, 8.0f, true, IVec3(7, -8, 0), tex2DArrayMipmapFloat, evalTexture2DArrayLodOffset, BOTH), 1748e5c31af7Sopenharmony_ci CASE_SPEC(isampler2darray, FUNCTION_TEXTURELOD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, -1.0f, 8.0f, true, IVec3(-8, 7, 0), tex2DArrayMipmapInt, evalTexture2DArrayLodOffset, BOTH), 1749e5c31af7Sopenharmony_ci CASE_SPEC(usampler2darray, FUNCTION_TEXTURELOD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), false, -1.0f, 8.0f, true, IVec3(7, -8, 0), tex2DArrayMipmapUint, evalTexture2DArrayLodOffset, BOTH), 1750e5c31af7Sopenharmony_ci 1751e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_fixed, FUNCTION_TEXTURELOD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, -1.0f, 7.0f, true, IVec3(-8, 7, 3), tex3DMipmapFixed, evalTexture3DLodOffset, BOTH), 1752e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_float, FUNCTION_TEXTURELOD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, -1.0f, 7.0f, true, IVec3(7, 3, -8), tex3DMipmapFloat, evalTexture3DLodOffset, BOTH), 1753e5c31af7Sopenharmony_ci CASE_SPEC(isampler3d, FUNCTION_TEXTURELOD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, -1.0f, 7.0f, true, IVec3(3, -8, 7), tex3DMipmapInt, evalTexture3DLodOffset, BOTH), 1754e5c31af7Sopenharmony_ci CASE_SPEC(usampler3d, FUNCTION_TEXTURELOD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), false, -1.0f, 7.0f, true, IVec3(-8, 7, 3), tex3DMipmapUint, evalTexture3DLodOffset, BOTH), 1755e5c31af7Sopenharmony_ci 1756e5c31af7Sopenharmony_ci CASE_SPEC(sampler2dshadow, FUNCTION_TEXTURELOD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 1.0f, 0.0f), false, -1.0f, 9.0f, true, IVec3(-8, 7, 0), tex2DMipmapShadow, evalTexture2DShadowLodOffset, BOTH) 1757e5c31af7Sopenharmony_ci }; 1758e5c31af7Sopenharmony_ci createCaseGroup(this, "texturelodoffset", "textureLodOffset() Tests", textureLodOffsetCases, DE_LENGTH_OF_ARRAY(textureLodOffsetCases)); 1759e5c31af7Sopenharmony_ci 1760e5c31af7Sopenharmony_ci // textureProjLod() cases 1761e5c31af7Sopenharmony_ci static const TexFuncCaseSpec textureProjLodCases[] = 1762e5c31af7Sopenharmony_ci { 1763e5c31af7Sopenharmony_ci // Name Function MinCoord MaxCoord Bias? MinLod MaxLod Offset? Offset Format EvalFunc Flags 1764e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec3_fixed, FUNCTION_TEXTUREPROJLOD3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, -1.0f, 9.0f, false, IVec3(0), tex2DMipmapFixed, evalTexture2DProjLod3, BOTH), 1765e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec3_float, FUNCTION_TEXTUREPROJLOD3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, -1.0f, 9.0f, false, IVec3(0), tex2DMipmapFloat, evalTexture2DProjLod3, BOTH), 1766e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d_vec3, FUNCTION_TEXTUREPROJLOD3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, -1.0f, 9.0f, false, IVec3(0), tex2DMipmapInt, evalTexture2DProjLod3, BOTH), 1767e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d_vec3, FUNCTION_TEXTUREPROJLOD3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, -1.0f, 9.0f, false, IVec3(0), tex2DMipmapUint, evalTexture2DProjLod3, BOTH), 1768e5c31af7Sopenharmony_ci 1769e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec4_fixed, FUNCTION_TEXTUREPROJLOD, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, -1.0f, 9.0f, false, IVec3(0), tex2DMipmapFixed, evalTexture2DProjLod, BOTH), 1770e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec4_float, FUNCTION_TEXTUREPROJLOD, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, -1.0f, 9.0f, false, IVec3(0), tex2DMipmapFloat, evalTexture2DProjLod, BOTH), 1771e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d_vec4, FUNCTION_TEXTUREPROJLOD, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, -1.0f, 9.0f, false, IVec3(0), tex2DMipmapInt, evalTexture2DProjLod, BOTH), 1772e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d_vec4, FUNCTION_TEXTUREPROJLOD, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, -1.0f, 9.0f, false, IVec3(0), tex2DMipmapUint, evalTexture2DProjLod, BOTH), 1773e5c31af7Sopenharmony_ci 1774e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_fixed, FUNCTION_TEXTUREPROJLOD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, -1.0f, 7.0f, false, IVec3(0), tex3DMipmapFixed, evalTexture3DProjLod, BOTH), 1775e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_float, FUNCTION_TEXTUREPROJLOD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, -1.0f, 7.0f, false, IVec3(0), tex3DMipmapFloat, evalTexture3DProjLod, BOTH), 1776e5c31af7Sopenharmony_ci CASE_SPEC(isampler3d, FUNCTION_TEXTUREPROJLOD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, -1.0f, 7.0f, false, IVec3(0), tex3DMipmapInt, evalTexture3DProjLod, BOTH), 1777e5c31af7Sopenharmony_ci CASE_SPEC(usampler3d, FUNCTION_TEXTUREPROJLOD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, -1.0f, 7.0f, false, IVec3(0), tex3DMipmapUint, evalTexture3DProjLod, BOTH), 1778e5c31af7Sopenharmony_ci 1779e5c31af7Sopenharmony_ci CASE_SPEC(sampler2dshadow, FUNCTION_TEXTUREPROJLOD, Vec4( 0.2f, 0.6f, 0.0f, 1.5f), Vec4(-2.25f, -3.45f, 1.5f, 1.5f), false, -1.0f, 9.0f, false, IVec3(0), tex2DMipmapShadow, evalTexture2DShadowProjLod, BOTH) 1780e5c31af7Sopenharmony_ci }; 1781e5c31af7Sopenharmony_ci createCaseGroup(this, "textureprojlod", "textureProjLod() Tests", textureProjLodCases, DE_LENGTH_OF_ARRAY(textureProjLodCases)); 1782e5c31af7Sopenharmony_ci 1783e5c31af7Sopenharmony_ci // textureProjLodOffset() cases 1784e5c31af7Sopenharmony_ci static const TexFuncCaseSpec textureProjLodOffsetCases[] = 1785e5c31af7Sopenharmony_ci { 1786e5c31af7Sopenharmony_ci // Name Function MinCoord MaxCoord Bias? MinLod MaxLod Offset? Offset Format EvalFunc Flags 1787e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec3_fixed, FUNCTION_TEXTUREPROJLOD3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, -1.0f, 9.0f, true, IVec3(-8, 7, 0), tex2DMipmapFixed, evalTexture2DProjLod3Offset, BOTH), 1788e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec3_float, FUNCTION_TEXTUREPROJLOD3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, -1.0f, 9.0f, true, IVec3(7, -8, 0), tex2DMipmapFloat, evalTexture2DProjLod3Offset, BOTH), 1789e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d_vec3, FUNCTION_TEXTUREPROJLOD3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, -1.0f, 9.0f, true, IVec3(-8, 7, 0), tex2DMipmapInt, evalTexture2DProjLod3Offset, BOTH), 1790e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d_vec3, FUNCTION_TEXTUREPROJLOD3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), false, -1.0f, 9.0f, true, IVec3(7, -8, 0), tex2DMipmapUint, evalTexture2DProjLod3Offset, BOTH), 1791e5c31af7Sopenharmony_ci 1792e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec4_fixed, FUNCTION_TEXTUREPROJLOD, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, -1.0f, 9.0f, true, IVec3(-8, 7, 0), tex2DMipmapFixed, evalTexture2DProjLodOffset, BOTH), 1793e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_vec4_float, FUNCTION_TEXTUREPROJLOD, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, -1.0f, 9.0f, true, IVec3(7, -8, 0), tex2DMipmapFloat, evalTexture2DProjLodOffset, BOTH), 1794e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d_vec4, FUNCTION_TEXTUREPROJLOD, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, -1.0f, 9.0f, true, IVec3(-8, 7, 0), tex2DMipmapInt, evalTexture2DProjLodOffset, BOTH), 1795e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d_vec4, FUNCTION_TEXTUREPROJLOD, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), false, -1.0f, 9.0f, true, IVec3(7, -8, 0), tex2DMipmapUint, evalTexture2DProjLodOffset, BOTH), 1796e5c31af7Sopenharmony_ci 1797e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_fixed, FUNCTION_TEXTUREPROJLOD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, -1.0f, 7.0f, true, IVec3(-8, 7, 3), tex3DMipmapFixed, evalTexture3DProjLodOffset, BOTH), 1798e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_float, FUNCTION_TEXTUREPROJLOD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, -1.0f, 7.0f, true, IVec3(7, 3, -8), tex3DMipmapFloat, evalTexture3DProjLodOffset, BOTH), 1799e5c31af7Sopenharmony_ci CASE_SPEC(isampler3d, FUNCTION_TEXTUREPROJLOD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, -1.0f, 7.0f, true, IVec3(3, -8, 7), tex3DMipmapInt, evalTexture3DProjLodOffset, BOTH), 1800e5c31af7Sopenharmony_ci CASE_SPEC(usampler3d, FUNCTION_TEXTUREPROJLOD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), false, -1.0f, 7.0f, true, IVec3(-8, 7, 3), tex3DMipmapUint, evalTexture3DProjLodOffset, BOTH), 1801e5c31af7Sopenharmony_ci 1802e5c31af7Sopenharmony_ci CASE_SPEC(sampler2dshadow, FUNCTION_TEXTUREPROJLOD, Vec4( 0.2f, 0.6f, 0.0f, 1.5f), Vec4(-2.25f, -3.45f, 1.5f, 1.5f), false, -1.0f, 9.0f, true, IVec3(-8, 7, 0), tex2DMipmapShadow, evalTexture2DShadowProjLodOffset, BOTH) 1803e5c31af7Sopenharmony_ci }; 1804e5c31af7Sopenharmony_ci createCaseGroup(this, "textureprojlodoffset", "textureProjLodOffset() Tests", textureProjLodOffsetCases, DE_LENGTH_OF_ARRAY(textureProjLodOffsetCases)); 1805e5c31af7Sopenharmony_ci 1806e5c31af7Sopenharmony_ci // textureGrad() cases 1807e5c31af7Sopenharmony_ci // \note Only one of dudx, dudy, dvdx, dvdy is non-zero since spec allows approximating p from derivates by various methods. 1808e5c31af7Sopenharmony_ci static const TexFuncCaseSpec textureGradCases[] = 1809e5c31af7Sopenharmony_ci { 1810e5c31af7Sopenharmony_ci // Name Function MinCoord MaxCoord MinDx MaxDx MinDy MaxDy Offset? Offset Format EvalFunc Flags 1811e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2d_fixed, FUNCTION_TEXTUREGRAD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), tex2DMipmapFixed, evalTexture2DGrad, BOTH), 1812e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2d_float, FUNCTION_TEXTUREGRAD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, -0.2f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), tex2DMipmapFloat, evalTexture2DGrad, BOTH), 1813e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(isampler2d, FUNCTION_TEXTUREGRAD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3(-0.2f, 0.0f, 0.0f), false, IVec3(0), tex2DMipmapInt, evalTexture2DGrad, BOTH), 1814e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(usampler2d, FUNCTION_TEXTUREGRAD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.2f, 0.0f), false, IVec3(0), tex2DMipmapUint, evalTexture2DGrad, BOTH), 1815e5c31af7Sopenharmony_ci 1816e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(samplercube_fixed, FUNCTION_TEXTUREGRAD, Vec4(-1.0f, -1.0f, 1.01f, 0.0f), Vec4( 1.0f, 1.0f, 1.01f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), texCubeMipmapFixed, evalTextureCubeGrad, BOTH), 1817e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(samplercube_float, FUNCTION_TEXTUREGRAD, Vec4(-1.0f, -1.0f, -1.01f, 0.0f), Vec4( 1.0f, 1.0f, -1.01f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, -0.2f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), texCubeMipmapFloat, evalTextureCubeGrad, BOTH), 1818e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(isamplercube, FUNCTION_TEXTUREGRAD, Vec4(-1.0f, -1.0f, 1.01f, 0.0f), Vec4( 1.0f, 1.0f, 1.01f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3(-0.2f, 0.0f, 0.0f), false, IVec3(0), texCubeMipmapInt, evalTextureCubeGrad, BOTH), 1819e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(usamplercube, FUNCTION_TEXTUREGRAD, Vec4(-1.0f, -1.0f, -1.01f, 0.0f), Vec4( 1.0f, 1.0f, -1.01f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.2f, 0.0f), false, IVec3(0), texCubeMipmapUint, evalTextureCubeGrad, BOTH), 1820e5c31af7Sopenharmony_ci 1821e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2darray_fixed, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), tex2DArrayMipmapFixed, evalTexture2DArrayGrad, BOTH), 1822e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2darray_float, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, -0.2f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), tex2DArrayMipmapFloat, evalTexture2DArrayGrad, BOTH), 1823e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(isampler2darray, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3(-0.2f, 0.0f, 0.0f), false, IVec3(0), tex2DArrayMipmapInt, evalTexture2DArrayGrad, BOTH), 1824e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(usampler2darray, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.2f, 0.0f), false, IVec3(0), tex2DArrayMipmapUint, evalTexture2DArrayGrad, BOTH), 1825e5c31af7Sopenharmony_ci 1826e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler3d_fixed, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), tex3DMipmapFixed, evalTexture3DGrad, BOTH), 1827e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler3d_float, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, -0.2f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), tex3DMipmapFloat, evalTexture3DGrad, VERTEX), 1828e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler3d_float, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.2f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), tex3DMipmapFloat, evalTexture3DGrad, FRAGMENT), 1829e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(isampler3d, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3(-0.2f, 0.0f, 0.0f), false, IVec3(0), tex3DMipmapInt, evalTexture3DGrad, BOTH), 1830e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(usampler3d, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.2f, 0.0f), false, IVec3(0), tex3DMipmapUint, evalTexture3DGrad, VERTEX), 1831e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(usampler3d, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, -0.2f), false, IVec3(0), tex3DMipmapUint, evalTexture3DGrad, FRAGMENT), 1832e5c31af7Sopenharmony_ci 1833e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2dshadow, FUNCTION_TEXTUREGRAD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 1.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), tex2DMipmapShadow, evalTexture2DShadowGrad, BOTH), 1834e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(samplercubeshadow, FUNCTION_TEXTUREGRAD, Vec4(-1.0f, -1.0f, 1.01f, 0.0f), Vec4( 1.0f, 1.0f, 1.01f, 1.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.2f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), texCubeMipmapShadow, evalTextureCubeShadowGrad, BOTH), 1835e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2darrayshadow, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 1.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), false, IVec3(0), tex2DArrayMipmapShadow, evalTexture2DArrayShadowGrad, VERTEX), 1836e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2darrayshadow, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 1.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, -0.2f, 0.0f), false, IVec3(0), tex2DArrayMipmapShadow, evalTexture2DArrayShadowGrad, FRAGMENT) 1837e5c31af7Sopenharmony_ci }; 1838e5c31af7Sopenharmony_ci createCaseGroup(this, "texturegrad", "textureGrad() Tests", textureGradCases, DE_LENGTH_OF_ARRAY(textureGradCases)); 1839e5c31af7Sopenharmony_ci 1840e5c31af7Sopenharmony_ci // textureGradOffset() cases 1841e5c31af7Sopenharmony_ci static const TexFuncCaseSpec textureGradOffsetCases[] = 1842e5c31af7Sopenharmony_ci { 1843e5c31af7Sopenharmony_ci // Name Function MinCoord MaxCoord MinDx MaxDx MinDy MaxDy Offset? Offset Format EvalFunc Flags 1844e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2d_fixed, FUNCTION_TEXTUREGRAD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), true, IVec3(-8, 7, 0), tex2DMipmapFixed, evalTexture2DGradOffset, BOTH), 1845e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2d_float, FUNCTION_TEXTUREGRAD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, -0.2f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), true, IVec3(7, -8, 0), tex2DMipmapFloat, evalTexture2DGradOffset, BOTH), 1846e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(isampler2d, FUNCTION_TEXTUREGRAD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3(-0.2f, 0.0f, 0.0f), true, IVec3(-8, 7, 0), tex2DMipmapInt, evalTexture2DGradOffset, BOTH), 1847e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(usampler2d, FUNCTION_TEXTUREGRAD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.2f, 0.0f), true, IVec3(7, -8, 0), tex2DMipmapUint, evalTexture2DGradOffset, BOTH), 1848e5c31af7Sopenharmony_ci 1849e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2darray_fixed, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), true, IVec3(-8, 7, 0), tex2DArrayMipmapFixed, evalTexture2DArrayGradOffset, BOTH), 1850e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2darray_float, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, -0.2f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), true, IVec3(7, -8, 0), tex2DArrayMipmapFloat, evalTexture2DArrayGradOffset, BOTH), 1851e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(isampler2darray, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3(-0.2f, 0.0f, 0.0f), true, IVec3(-8, 7, 0), tex2DArrayMipmapInt, evalTexture2DArrayGradOffset, BOTH), 1852e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(usampler2darray, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.2f, 0.0f), true, IVec3(7, -8, 0), tex2DArrayMipmapUint, evalTexture2DArrayGradOffset, BOTH), 1853e5c31af7Sopenharmony_ci 1854e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler3d_fixed, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), true, IVec3(-8, 7, 3), tex3DMipmapFixed, evalTexture3DGradOffset, BOTH), 1855e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler3d_float, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, -0.2f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), true, IVec3(7, 3, -8), tex3DMipmapFloat, evalTexture3DGradOffset, VERTEX), 1856e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler3d_float, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.2f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), true, IVec3(3, -8, 7), tex3DMipmapFloat, evalTexture3DGradOffset, FRAGMENT), 1857e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(isampler3d, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3(-0.2f, 0.0f, 0.0f), true, IVec3(-8, 7, 3), tex3DMipmapInt, evalTexture3DGradOffset, BOTH), 1858e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(usampler3d, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.2f, 0.0f), true, IVec3(7, 3, -8), tex3DMipmapUint, evalTexture3DGradOffset, VERTEX), 1859e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(usampler3d, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -1.4f, 0.1f, 0.0f), Vec4( 1.5f, 2.3f, 2.3f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, -0.2f), true, IVec3(3, -8, 7), tex3DMipmapUint, evalTexture3DGradOffset, FRAGMENT), 1860e5c31af7Sopenharmony_ci 1861e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2dshadow, FUNCTION_TEXTUREGRAD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 1.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), true, IVec3(-8, 7, 0), tex2DMipmapShadow, evalTexture2DShadowGradOffset, VERTEX), 1862e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2dshadow, FUNCTION_TEXTUREGRAD, Vec4(-0.2f, -0.4f, 0.0f, 0.0f), Vec4( 1.5f, 2.3f, 1.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.2f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), true, IVec3(7, -8, 0), tex2DMipmapShadow, evalTexture2DShadowGradOffset, FRAGMENT), 1863e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2darrayshadow, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 1.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), true, IVec3(-8, 7, 0), tex2DArrayMipmapShadow, evalTexture2DArrayShadowGradOffset, VERTEX), 1864e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2darrayshadow, FUNCTION_TEXTUREGRAD, Vec4(-1.2f, -0.4f, -0.5f, 0.0f), Vec4( 1.5f, 2.3f, 3.5f, 1.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, -0.2f, 0.0f), true, IVec3(7, -8, 0), tex2DArrayMipmapShadow, evalTexture2DArrayShadowGradOffset, FRAGMENT) 1865e5c31af7Sopenharmony_ci }; 1866e5c31af7Sopenharmony_ci createCaseGroup(this, "texturegradoffset", "textureGradOffset() Tests", textureGradOffsetCases, DE_LENGTH_OF_ARRAY(textureGradOffsetCases)); 1867e5c31af7Sopenharmony_ci 1868e5c31af7Sopenharmony_ci // textureProjGrad() cases 1869e5c31af7Sopenharmony_ci static const TexFuncCaseSpec textureProjGradCases[] = 1870e5c31af7Sopenharmony_ci { 1871e5c31af7Sopenharmony_ci // Name Function MinCoord MaxCoord MinDx MaxDx MinDy MaxDy Offset? Offset Format EvalFunc Flags 1872e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2d_vec3_fixed, FUNCTION_TEXTUREPROJGRAD3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), tex2DMipmapFixed, evalTexture2DProjGrad3, BOTH), 1873e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2d_vec3_float, FUNCTION_TEXTUREPROJGRAD3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, -0.2f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), tex2DMipmapFloat, evalTexture2DProjGrad3, BOTH), 1874e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(isampler2d_vec3, FUNCTION_TEXTUREPROJGRAD3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3(-0.2f, 0.0f, 0.0f), false, IVec3(0), tex2DMipmapInt, evalTexture2DProjGrad3, BOTH), 1875e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(usampler2d_vec3, FUNCTION_TEXTUREPROJGRAD3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.2f, 0.0f), false, IVec3(0), tex2DMipmapUint, evalTexture2DProjGrad3, BOTH), 1876e5c31af7Sopenharmony_ci 1877e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2d_vec4_fixed, FUNCTION_TEXTUREPROJGRAD, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), tex2DMipmapFixed, evalTexture2DProjGrad, BOTH), 1878e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2d_vec4_float, FUNCTION_TEXTUREPROJGRAD, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, -0.2f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), tex2DMipmapFloat, evalTexture2DProjGrad, BOTH), 1879e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(isampler2d_vec4, FUNCTION_TEXTUREPROJGRAD, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3(-0.2f, 0.0f, 0.0f), false, IVec3(0), tex2DMipmapInt, evalTexture2DProjGrad, BOTH), 1880e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(usampler2d_vec4, FUNCTION_TEXTUREPROJGRAD, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.2f, 0.0f), false, IVec3(0), tex2DMipmapUint, evalTexture2DProjGrad, BOTH), 1881e5c31af7Sopenharmony_ci 1882e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler3d_fixed, FUNCTION_TEXTUREPROJGRAD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), tex3DMipmapFixed, evalTexture3DProjGrad, BOTH), 1883e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler3d_float, FUNCTION_TEXTUREPROJGRAD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, -0.2f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), tex3DMipmapFloat, evalTexture3DProjGrad, VERTEX), 1884e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler3d_float, FUNCTION_TEXTUREPROJGRAD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.2f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), tex3DMipmapFloat, evalTexture3DProjGrad, FRAGMENT), 1885e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(isampler3d, FUNCTION_TEXTUREPROJGRAD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3(-0.2f, 0.0f, 0.0f), false, IVec3(0), tex3DMipmapInt, evalTexture3DProjGrad, BOTH), 1886e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(usampler3d, FUNCTION_TEXTUREPROJGRAD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.2f, 0.0f), false, IVec3(0), tex3DMipmapUint, evalTexture3DProjGrad, VERTEX), 1887e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(usampler3d, FUNCTION_TEXTUREPROJGRAD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, -0.2f), false, IVec3(0), tex3DMipmapUint, evalTexture3DProjGrad, FRAGMENT), 1888e5c31af7Sopenharmony_ci 1889e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2dshadow, FUNCTION_TEXTUREPROJGRAD, Vec4( 0.2f, 0.6f, 0.0f, -1.5f), Vec4(-2.25f, -3.45f, -1.5f, -1.5f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), false, IVec3(0), tex2DMipmapShadow, evalTexture2DShadowProjGrad, VERTEX), 1890e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2dshadow, FUNCTION_TEXTUREPROJGRAD, Vec4( 0.2f, 0.6f, 0.0f, -1.5f), Vec4(-2.25f, -3.45f, -1.5f, -1.5f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, -0.2f, 0.0f), false, IVec3(0), tex2DMipmapShadow, evalTexture2DShadowProjGrad, FRAGMENT) 1891e5c31af7Sopenharmony_ci }; 1892e5c31af7Sopenharmony_ci createCaseGroup(this, "textureprojgrad", "textureProjGrad() Tests", textureProjGradCases, DE_LENGTH_OF_ARRAY(textureProjGradCases)); 1893e5c31af7Sopenharmony_ci 1894e5c31af7Sopenharmony_ci // textureProjGradOffset() cases 1895e5c31af7Sopenharmony_ci static const TexFuncCaseSpec textureProjGradOffsetCases[] = 1896e5c31af7Sopenharmony_ci { 1897e5c31af7Sopenharmony_ci // Name Function MinCoord MaxCoord MinDx MaxDx MinDy MaxDy Offset? Offset Format EvalFunc Flags 1898e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2d_vec3_fixed, FUNCTION_TEXTUREPROJGRAD3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), true, IVec3(-8, 7, 0), tex2DMipmapFixed, evalTexture2DProjGrad3Offset, BOTH), 1899e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2d_vec3_float, FUNCTION_TEXTUREPROJGRAD3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, -0.2f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), true, IVec3(7, -8, 0), tex2DMipmapFloat, evalTexture2DProjGrad3Offset, BOTH), 1900e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(isampler2d_vec3, FUNCTION_TEXTUREPROJGRAD3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3(-0.2f, 0.0f, 0.0f), true, IVec3(-8, 7, 0), tex2DMipmapInt, evalTexture2DProjGrad3Offset, BOTH), 1901e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(usampler2d_vec3, FUNCTION_TEXTUREPROJGRAD3, Vec4(-0.3f, -0.6f, 1.5f, 0.0f), Vec4(2.25f, 3.45f, 1.5f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.2f, 0.0f), true, IVec3(7, -8, 0), tex2DMipmapUint, evalTexture2DProjGrad3Offset, BOTH), 1902e5c31af7Sopenharmony_ci 1903e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2d_vec4_fixed, FUNCTION_TEXTUREPROJGRAD, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), true, IVec3(-8, 7, 0), tex2DMipmapFixed, evalTexture2DProjGradOffset, BOTH), 1904e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2d_vec4_float, FUNCTION_TEXTUREPROJGRAD, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, -0.2f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), true, IVec3(7, -8, 0), tex2DMipmapFloat, evalTexture2DProjGradOffset, BOTH), 1905e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(isampler2d_vec4, FUNCTION_TEXTUREPROJGRAD, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3(-0.2f, 0.0f, 0.0f), true, IVec3(-8, 7, 0), tex2DMipmapInt, evalTexture2DProjGradOffset, BOTH), 1906e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(usampler2d_vec4, FUNCTION_TEXTUREPROJGRAD, Vec4(-0.3f, -0.6f, 0.0f, 1.5f), Vec4(2.25f, 3.45f, 0.0f, 1.5f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.2f, 0.0f), true, IVec3(7, -8, 0), tex2DMipmapUint, evalTexture2DProjGradOffset, BOTH), 1907e5c31af7Sopenharmony_ci 1908e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler3d_fixed, FUNCTION_TEXTUREPROJGRAD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), true, IVec3(-8, 7, 3), tex3DMipmapFixed, evalTexture3DProjGradOffset, BOTH), 1909e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler3d_float, FUNCTION_TEXTUREPROJGRAD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, -0.2f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), true, IVec3(7, 3, -8), tex3DMipmapFloat, evalTexture3DProjGradOffset, VERTEX), 1910e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler3d_float, FUNCTION_TEXTUREPROJGRAD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.2f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), true, IVec3(3, -8, 7), tex3DMipmapFloat, evalTexture3DProjGradOffset, FRAGMENT), 1911e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(isampler3d, FUNCTION_TEXTUREPROJGRAD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3(-0.2f, 0.0f, 0.0f), true, IVec3(-8, 7, 3), tex3DMipmapInt, evalTexture3DProjGradOffset, BOTH), 1912e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(usampler3d, FUNCTION_TEXTUREPROJGRAD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.2f, 0.0f), true, IVec3(7, 3, -8), tex3DMipmapUint, evalTexture3DProjGradOffset, VERTEX), 1913e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(usampler3d, FUNCTION_TEXTUREPROJGRAD, Vec4(0.9f, 1.05f, -0.08f, -0.75f), Vec4(-1.13f, -1.7f, -1.7f, -0.75f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, -0.2f), true, IVec3(3, -8, 7), tex3DMipmapUint, evalTexture3DProjGradOffset, FRAGMENT), 1914e5c31af7Sopenharmony_ci 1915e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2dshadow, FUNCTION_TEXTUREPROJGRAD, Vec4( 0.2f, 0.6f, 0.0f, -1.5f), Vec4(-2.25f, -3.45f, -1.5f, -1.5f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.2f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), true, IVec3(-8, 7, 0), tex2DMipmapShadow, evalTexture2DShadowProjGradOffset, VERTEX), 1916e5c31af7Sopenharmony_ci GRAD_CASE_SPEC(sampler2dshadow, FUNCTION_TEXTUREPROJGRAD, Vec4( 0.2f, 0.6f, 0.0f, -1.5f), Vec4(-2.25f, -3.45f, -1.5f, -1.5f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, 0.0f, 0.0f), Vec3( 0.0f, -0.2f, 0.0f), true, IVec3(7, -8, 0), tex2DMipmapShadow, evalTexture2DShadowProjGradOffset, FRAGMENT) 1917e5c31af7Sopenharmony_ci }; 1918e5c31af7Sopenharmony_ci createCaseGroup(this, "textureprojgradoffset", "textureProjGradOffset() Tests", textureProjGradOffsetCases, DE_LENGTH_OF_ARRAY(textureProjGradOffsetCases)); 1919e5c31af7Sopenharmony_ci 1920e5c31af7Sopenharmony_ci // texelFetch() cases 1921e5c31af7Sopenharmony_ci // \note Level is constant across quad 1922e5c31af7Sopenharmony_ci static const TexFuncCaseSpec texelFetchCases[] = 1923e5c31af7Sopenharmony_ci { 1924e5c31af7Sopenharmony_ci // Name Function MinCoord MaxCoord Bias? MinLod MaxLod Offset? Offset Format EvalFunc Flags 1925e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_fixed, FUNCTION_TEXELFETCH, Vec4(0.0f, 0.0f, 0.0f, 0.0f), Vec4(255.9f, 255.9f, 0.0f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DTexelFetchFixed, evalTexelFetch2D, BOTH), 1926e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_float, FUNCTION_TEXELFETCH, Vec4(0.0f, 0.0f, 0.0f, 0.0f), Vec4(127.9f, 127.9f, 0.0f, 0.0f), false, 1.0f, 1.0f, false, IVec3(0), tex2DTexelFetchFloat, evalTexelFetch2D, BOTH), 1927e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d, FUNCTION_TEXELFETCH, Vec4(0.0f, 0.0f, 0.0f, 0.0f), Vec4( 63.9f, 63.9f, 0.0f, 0.0f), false, 2.0f, 2.0f, false, IVec3(0), tex2DTexelFetchInt, evalTexelFetch2D, BOTH), 1928e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d, FUNCTION_TEXELFETCH, Vec4(0.0f, 0.0f, 0.0f, 0.0f), Vec4( 15.9f, 15.9f, 0.0f, 0.0f), false, 4.0f, 4.0f, false, IVec3(0), tex2DTexelFetchUint, evalTexelFetch2D, BOTH), 1929e5c31af7Sopenharmony_ci 1930e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_fixed, FUNCTION_TEXELFETCH, Vec4(0.0f, 0.0f, 0.0f, 0.0f), Vec4(127.9f, 127.9f, 3.9f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex2DArrayTexelFetchFixed, evalTexelFetch2DArray, BOTH), 1931e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_float, FUNCTION_TEXELFETCH, Vec4(0.0f, 0.0f, 0.0f, 0.0f), Vec4( 63.9f, 63.9f, 3.9f, 0.0f), false, 1.0f, 1.0f, false, IVec3(0), tex2DArrayTexelFetchFloat, evalTexelFetch2DArray, BOTH), 1932e5c31af7Sopenharmony_ci CASE_SPEC(isampler2darray, FUNCTION_TEXELFETCH, Vec4(0.0f, 0.0f, 0.0f, 0.0f), Vec4( 31.9f, 31.9f, 3.9f, 0.0f), false, 2.0f, 2.0f, false, IVec3(0), tex2DArrayTexelFetchInt, evalTexelFetch2DArray, BOTH), 1933e5c31af7Sopenharmony_ci CASE_SPEC(usampler2darray, FUNCTION_TEXELFETCH, Vec4(0.0f, 0.0f, 0.0f, 0.0f), Vec4( 15.9f, 15.9f, 3.9f, 0.0f), false, 3.0f, 3.0f, false, IVec3(0), tex2DArrayTexelFetchUint, evalTexelFetch2DArray, BOTH), 1934e5c31af7Sopenharmony_ci 1935e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_fixed, FUNCTION_TEXELFETCH, Vec4(0.0f, 0.0f, 0.0f, 0.0f), Vec4(63.9f, 31.9f, 31.9f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex3DTexelFetchFixed, evalTexelFetch3D, BOTH), 1936e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_float, FUNCTION_TEXELFETCH, Vec4(0.0f, 0.0f, 0.0f, 0.0f), Vec4(31.9f, 15.9f, 15.9f, 0.0f), false, 1.0f, 1.0f, false, IVec3(0), tex3DTexelFetchFloat, evalTexelFetch3D, BOTH), 1937e5c31af7Sopenharmony_ci CASE_SPEC(isampler3d, FUNCTION_TEXELFETCH, Vec4(0.0f, 0.0f, 0.0f, 0.0f), Vec4(15.9f, 7.9f, 7.9f, 0.0f), false, 2.0f, 2.0f, false, IVec3(0), tex3DTexelFetchInt, evalTexelFetch3D, BOTH), 1938e5c31af7Sopenharmony_ci CASE_SPEC(usampler3d, FUNCTION_TEXELFETCH, Vec4(0.0f, 0.0f, 0.0f, 0.0f), Vec4(63.9f, 31.9f, 31.9f, 0.0f), false, 0.0f, 0.0f, false, IVec3(0), tex3DTexelFetchUint, evalTexelFetch3D, BOTH) 1939e5c31af7Sopenharmony_ci }; 1940e5c31af7Sopenharmony_ci createCaseGroup(this, "texelfetch", "texelFetch() Tests", texelFetchCases, DE_LENGTH_OF_ARRAY(texelFetchCases)); 1941e5c31af7Sopenharmony_ci 1942e5c31af7Sopenharmony_ci // texelFetchOffset() cases 1943e5c31af7Sopenharmony_ci static const TexFuncCaseSpec texelFetchOffsetCases[] = 1944e5c31af7Sopenharmony_ci { 1945e5c31af7Sopenharmony_ci // Name Function MinCoord MaxCoord Bias? MinLod MaxLod Offset? Offset Format EvalFunc Flags 1946e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_fixed, FUNCTION_TEXELFETCH, Vec4( 8.0f, -7.0f, 0.0f, 0.0f), Vec4(263.9f, 248.9f, 0.0f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DTexelFetchFixed, evalTexelFetch2D, BOTH), 1947e5c31af7Sopenharmony_ci CASE_SPEC(sampler2d_float, FUNCTION_TEXELFETCH, Vec4(-7.0f, 8.0f, 0.0f, 0.0f), Vec4(120.9f, 135.9f, 0.0f, 0.0f), false, 1.0f, 1.0f, true, IVec3(7, -8, 0), tex2DTexelFetchFloat, evalTexelFetch2D, BOTH), 1948e5c31af7Sopenharmony_ci CASE_SPEC(isampler2d, FUNCTION_TEXELFETCH, Vec4( 8.0f, -7.0f, 0.0f, 0.0f), Vec4( 71.9f, 56.9f, 0.0f, 0.0f), false, 2.0f, 2.0f, true, IVec3(-8, 7, 0), tex2DTexelFetchInt, evalTexelFetch2D, BOTH), 1949e5c31af7Sopenharmony_ci CASE_SPEC(usampler2d, FUNCTION_TEXELFETCH, Vec4(-7.0f, 8.0f, 0.0f, 0.0f), Vec4( 8.9f, 23.9f, 0.0f, 0.0f), false, 4.0f, 4.0f, true, IVec3(7, -8, 0), tex2DTexelFetchUint, evalTexelFetch2D, BOTH), 1950e5c31af7Sopenharmony_ci 1951e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_fixed, FUNCTION_TEXELFETCH, Vec4( 8.0f, -7.0f, 0.0f, 0.0f), Vec4(135.9f, 120.9f, 3.9f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 0), tex2DArrayTexelFetchFixed, evalTexelFetch2DArray, BOTH), 1952e5c31af7Sopenharmony_ci CASE_SPEC(sampler2darray_float, FUNCTION_TEXELFETCH, Vec4(-7.0f, 8.0f, 0.0f, 0.0f), Vec4( 56.9f, 71.9f, 3.9f, 0.0f), false, 1.0f, 1.0f, true, IVec3(7, -8, 0), tex2DArrayTexelFetchFloat, evalTexelFetch2DArray, BOTH), 1953e5c31af7Sopenharmony_ci CASE_SPEC(isampler2darray, FUNCTION_TEXELFETCH, Vec4( 8.0f, -7.0f, 0.0f, 0.0f), Vec4( 39.9f, 24.9f, 3.9f, 0.0f), false, 2.0f, 2.0f, true, IVec3(-8, 7, 0), tex2DArrayTexelFetchInt, evalTexelFetch2DArray, BOTH), 1954e5c31af7Sopenharmony_ci CASE_SPEC(usampler2darray, FUNCTION_TEXELFETCH, Vec4(-7.0f, 8.0f, 0.0f, 0.0f), Vec4( 8.9f, 23.9f, 3.9f, 0.0f), false, 3.0f, 3.0f, true, IVec3(7, -8, 0), tex2DArrayTexelFetchUint, evalTexelFetch2DArray, BOTH), 1955e5c31af7Sopenharmony_ci 1956e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_fixed, FUNCTION_TEXELFETCH, Vec4( 8.0f, -7.0f, -3.0f, 0.0f),Vec4(71.9f, 24.9f, 28.9f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 3), tex3DTexelFetchFixed, evalTexelFetch3D, BOTH), 1957e5c31af7Sopenharmony_ci CASE_SPEC(sampler3d_float, FUNCTION_TEXELFETCH, Vec4(-7.0f, -3.0f, 8.0f, 0.0f),Vec4(24.9f, 12.9f, 23.9f, 0.0f), false, 1.0f, 1.0f, true, IVec3(7, 3, -8), tex3DTexelFetchFloat, evalTexelFetch3D, BOTH), 1958e5c31af7Sopenharmony_ci CASE_SPEC(isampler3d, FUNCTION_TEXELFETCH, Vec4(-3.0f, 8.0f, -7.0f, 0.0f),Vec4(12.9f, 15.9f, 0.9f, 0.0f), false, 2.0f, 2.0f, true, IVec3(3, -8, 7), tex3DTexelFetchInt, evalTexelFetch3D, BOTH), 1959e5c31af7Sopenharmony_ci CASE_SPEC(usampler3d, FUNCTION_TEXELFETCH, Vec4( 8.0f, -7.0f, -3.0f, 0.0f),Vec4(71.9f, 24.9f, 28.9f, 0.0f), false, 0.0f, 0.0f, true, IVec3(-8, 7, 3), tex3DTexelFetchUint, evalTexelFetch3D, BOTH) 1960e5c31af7Sopenharmony_ci }; 1961e5c31af7Sopenharmony_ci createCaseGroup(this, "texelfetchoffset", "texelFetchOffset() Tests", texelFetchOffsetCases, DE_LENGTH_OF_ARRAY(texelFetchOffsetCases)); 1962e5c31af7Sopenharmony_ci 1963e5c31af7Sopenharmony_ci // textureSize() cases 1964e5c31af7Sopenharmony_ci { 1965e5c31af7Sopenharmony_ci struct TextureSizeCaseSpec 1966e5c31af7Sopenharmony_ci { 1967e5c31af7Sopenharmony_ci const char* name; 1968e5c31af7Sopenharmony_ci const char* samplerName; 1969e5c31af7Sopenharmony_ci TextureSpec textureSpec; 1970e5c31af7Sopenharmony_ci } textureSizeCases[] = 1971e5c31af7Sopenharmony_ci { 1972e5c31af7Sopenharmony_ci { "sampler2d_fixed", "sampler2D", tex2DFixed }, 1973e5c31af7Sopenharmony_ci { "sampler2d_float", "sampler2D", tex2DFloat }, 1974e5c31af7Sopenharmony_ci { "isampler2d", "isampler2D", tex2DInt }, 1975e5c31af7Sopenharmony_ci { "usampler2d", "usampler2D", tex2DUint }, 1976e5c31af7Sopenharmony_ci { "sampler2dshadow", "sampler2DShadow", tex2DShadow }, 1977e5c31af7Sopenharmony_ci { "sampler3d_fixed", "sampler3D", tex3DFixed }, 1978e5c31af7Sopenharmony_ci { "sampler3d_float", "sampler3D", tex3DFloat }, 1979e5c31af7Sopenharmony_ci { "isampler3d", "isampler3D", tex3DInt }, 1980e5c31af7Sopenharmony_ci { "usampler3d", "usampler3D", tex3DUint }, 1981e5c31af7Sopenharmony_ci { "samplercube_fixed", "samplerCube", texCubeFixed }, 1982e5c31af7Sopenharmony_ci { "samplercube_float", "samplerCube", texCubeFloat }, 1983e5c31af7Sopenharmony_ci { "isamplercube", "isamplerCube", texCubeInt }, 1984e5c31af7Sopenharmony_ci { "usamplercube", "usamplerCube", texCubeUint }, 1985e5c31af7Sopenharmony_ci { "samplercubeshadow", "samplerCubeShadow", texCubeShadow }, 1986e5c31af7Sopenharmony_ci { "sampler2darray_fixed", "sampler2DArray", tex2DArrayFixed }, 1987e5c31af7Sopenharmony_ci { "sampler2darray_float", "sampler2DArray", tex2DArrayFloat }, 1988e5c31af7Sopenharmony_ci { "isampler2darray", "isampler2DArray", tex2DArrayInt }, 1989e5c31af7Sopenharmony_ci { "usampler2darray", "usampler2DArray", tex2DArrayUint }, 1990e5c31af7Sopenharmony_ci { "sampler2darrayshadow", "sampler2DArrayShadow", tex2DArrayShadow }, 1991e5c31af7Sopenharmony_ci }; 1992e5c31af7Sopenharmony_ci 1993e5c31af7Sopenharmony_ci tcu::TestCaseGroup* group = new tcu::TestCaseGroup(m_testCtx, "texturesize", "textureSize() Tests"); 1994e5c31af7Sopenharmony_ci addChild(group); 1995e5c31af7Sopenharmony_ci 1996e5c31af7Sopenharmony_ci for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(textureSizeCases); ++ndx) 1997e5c31af7Sopenharmony_ci { 1998e5c31af7Sopenharmony_ci group->addChild(new TextureSizeCase(m_context, (std::string(textureSizeCases[ndx].name) + "_vertex").c_str(), "", textureSizeCases[ndx].samplerName, textureSizeCases[ndx].textureSpec, true)); 1999e5c31af7Sopenharmony_ci group->addChild(new TextureSizeCase(m_context, (std::string(textureSizeCases[ndx].name) + "_fragment").c_str(), "", textureSizeCases[ndx].samplerName, textureSizeCases[ndx].textureSpec, false)); 2000e5c31af7Sopenharmony_ci } 2001e5c31af7Sopenharmony_ci } 2002e5c31af7Sopenharmony_ci 2003e5c31af7Sopenharmony_ci // Negative cases. 2004e5c31af7Sopenharmony_ci { 2005e5c31af7Sopenharmony_ci gls::ShaderLibrary library(m_testCtx, m_context.getRenderContext(), m_context.getContextInfo()); 2006e5c31af7Sopenharmony_ci std::vector<tcu::TestNode*> negativeCases = library.loadShaderFile("shaders/invalid_texture_functions.test"); 2007e5c31af7Sopenharmony_ci 2008e5c31af7Sopenharmony_ci tcu::TestCaseGroup* group = new tcu::TestCaseGroup(m_testCtx, "invalid", "Invalid texture function usage", negativeCases); 2009e5c31af7Sopenharmony_ci addChild(group); 2010e5c31af7Sopenharmony_ci } 2011e5c31af7Sopenharmony_ci} 2012e5c31af7Sopenharmony_ci 2013e5c31af7Sopenharmony_ci} // Functional 2014e5c31af7Sopenharmony_ci} // gles3 2015e5c31af7Sopenharmony_ci} // deqp 2016