1e5c31af7Sopenharmony_ci#ifndef _GL4CSPARSETEXTURETESTS_HPP 2e5c31af7Sopenharmony_ci#define _GL4CSPARSETEXTURETESTS_HPP 3e5c31af7Sopenharmony_ci/*------------------------------------------------------------------------- 4e5c31af7Sopenharmony_ci * OpenGL Conformance Test Suite 5e5c31af7Sopenharmony_ci * ----------------------------- 6e5c31af7Sopenharmony_ci * 7e5c31af7Sopenharmony_ci * Copyright (c) 2016 The Khronos Group Inc. 8e5c31af7Sopenharmony_ci * 9e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 10e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License. 11e5c31af7Sopenharmony_ci * You may obtain a copy of the License at 12e5c31af7Sopenharmony_ci * 13e5c31af7Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 14e5c31af7Sopenharmony_ci * 15e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 16e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 17e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and 19e5c31af7Sopenharmony_ci * limitations under the License. 20e5c31af7Sopenharmony_ci * 21e5c31af7Sopenharmony_ci */ /*! 22e5c31af7Sopenharmony_ci * \file 23e5c31af7Sopenharmony_ci * \brief 24e5c31af7Sopenharmony_ci */ /*-------------------------------------------------------------------*/ 25e5c31af7Sopenharmony_ci 26e5c31af7Sopenharmony_ci/** 27e5c31af7Sopenharmony_ci */ /*! 28e5c31af7Sopenharmony_ci * \file gl4cSparseTextureTests.hpp 29e5c31af7Sopenharmony_ci * \brief Conformance tests for the GL_ARB_sparse_texture functionality. 30e5c31af7Sopenharmony_ci */ /*-------------------------------------------------------------------*/ 31e5c31af7Sopenharmony_ci 32e5c31af7Sopenharmony_ci#include "glcTestCase.hpp" 33e5c31af7Sopenharmony_ci#include "glwDefs.hpp" 34e5c31af7Sopenharmony_ci#include "glwEnums.hpp" 35e5c31af7Sopenharmony_ci#include "tcuDefs.hpp" 36e5c31af7Sopenharmony_ci#include <sstream> 37e5c31af7Sopenharmony_ci#include <vector> 38e5c31af7Sopenharmony_ci 39e5c31af7Sopenharmony_ci#include "gluTextureUtil.hpp" 40e5c31af7Sopenharmony_ci#include "tcuTextureUtil.hpp" 41e5c31af7Sopenharmony_ci 42e5c31af7Sopenharmony_ciusing namespace glw; 43e5c31af7Sopenharmony_ciusing namespace glu; 44e5c31af7Sopenharmony_ci 45e5c31af7Sopenharmony_cinamespace gl4cts 46e5c31af7Sopenharmony_ci{ 47e5c31af7Sopenharmony_ci 48e5c31af7Sopenharmony_cistruct TextureState 49e5c31af7Sopenharmony_ci{ 50e5c31af7Sopenharmony_ci GLint width; 51e5c31af7Sopenharmony_ci GLint height; 52e5c31af7Sopenharmony_ci GLint depth; 53e5c31af7Sopenharmony_ci GLint levels; 54e5c31af7Sopenharmony_ci GLint samples; 55e5c31af7Sopenharmony_ci tcu::TextureFormat format; 56e5c31af7Sopenharmony_ci 57e5c31af7Sopenharmony_ci GLint minDepth; 58e5c31af7Sopenharmony_ci 59e5c31af7Sopenharmony_ci GLint pageSizeX; 60e5c31af7Sopenharmony_ci GLint pageSizeY; 61e5c31af7Sopenharmony_ci GLint pageSizeZ; 62e5c31af7Sopenharmony_ci}; 63e5c31af7Sopenharmony_ci 64e5c31af7Sopenharmony_ciclass SparseTextureUtils 65e5c31af7Sopenharmony_ci{ 66e5c31af7Sopenharmony_cipublic: 67e5c31af7Sopenharmony_ci static bool verifyQueryError(std::stringstream& log, const char* funcName, GLint target, GLint pname, GLint error, 68e5c31af7Sopenharmony_ci GLint expectedError); 69e5c31af7Sopenharmony_ci 70e5c31af7Sopenharmony_ci static bool verifyError(std::stringstream& log, const char* funcName, GLint error, GLint expectedError); 71e5c31af7Sopenharmony_ci 72e5c31af7Sopenharmony_ci static GLint getTargetDepth(GLint target); 73e5c31af7Sopenharmony_ci 74e5c31af7Sopenharmony_ci static void getTexturePageSizes(const Functions& gl, GLint target, GLint format, GLint& pageSizeX, GLint& pageSizeY, 75e5c31af7Sopenharmony_ci GLint& pageSizeZ); 76e5c31af7Sopenharmony_ci 77e5c31af7Sopenharmony_ci static void getTextureLevelSize(GLint target, TextureState& state, GLint level, GLint& width, GLint& height, 78e5c31af7Sopenharmony_ci GLint& depth); 79e5c31af7Sopenharmony_ci}; 80e5c31af7Sopenharmony_ci 81e5c31af7Sopenharmony_ci/** Represents texture static helper 82e5c31af7Sopenharmony_ci **/ 83e5c31af7Sopenharmony_ciclass Texture 84e5c31af7Sopenharmony_ci{ 85e5c31af7Sopenharmony_cipublic: 86e5c31af7Sopenharmony_ci /* Public static routines */ 87e5c31af7Sopenharmony_ci /* Functionality */ 88e5c31af7Sopenharmony_ci static void Bind(const Functions& gl, GLuint id, GLenum target); 89e5c31af7Sopenharmony_ci 90e5c31af7Sopenharmony_ci static void Generate(const Functions& gl, GLuint& out_id); 91e5c31af7Sopenharmony_ci 92e5c31af7Sopenharmony_ci static void Delete(const Functions& gl, GLuint& id); 93e5c31af7Sopenharmony_ci 94e5c31af7Sopenharmony_ci static void Storage(const Functions& gl, GLenum target, GLsizei levels, GLenum internal_format, GLuint width, 95e5c31af7Sopenharmony_ci GLuint height, GLuint depth); 96e5c31af7Sopenharmony_ci 97e5c31af7Sopenharmony_ci static void GetData(const Functions& gl, GLint level, GLenum target, GLenum format, GLenum type, GLvoid* out_data); 98e5c31af7Sopenharmony_ci 99e5c31af7Sopenharmony_ci static void SubImage(const Functions& gl, GLenum target, GLint level, GLint x, GLint y, GLint z, GLsizei width, 100e5c31af7Sopenharmony_ci GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); 101e5c31af7Sopenharmony_ci 102e5c31af7Sopenharmony_ci /* Public fields */ 103e5c31af7Sopenharmony_ci GLuint m_id; 104e5c31af7Sopenharmony_ci 105e5c31af7Sopenharmony_ci /* Public constants */ 106e5c31af7Sopenharmony_ci static const GLuint m_invalid_id; 107e5c31af7Sopenharmony_ci}; 108e5c31af7Sopenharmony_ci 109e5c31af7Sopenharmony_ci/** Test verifies TexParameter{if}{v}, TexParameterI{u}v, GetTexParameter{if}v 110e5c31af7Sopenharmony_ci * and GetTexParameterIi{u}v queries for <pname>: 111e5c31af7Sopenharmony_ci * - TEXTURE_SPARSE_ARB, 112e5c31af7Sopenharmony_ci * - VIRTUAL_PAGE_SIZE_INDEX_ARB. 113e5c31af7Sopenharmony_ci * Test verifies also GetTexParameter{if}v and GetTexParameterIi{u}v queries for <pname>: 114e5c31af7Sopenharmony_ci * - NUM_SPARSE_LEVELS_ARB 115e5c31af7Sopenharmony_ci **/ 116e5c31af7Sopenharmony_ciclass TextureParameterQueriesTestCase : public deqp::TestCase 117e5c31af7Sopenharmony_ci{ 118e5c31af7Sopenharmony_cipublic: 119e5c31af7Sopenharmony_ci /* Public methods */ 120e5c31af7Sopenharmony_ci TextureParameterQueriesTestCase(deqp::Context& context); 121e5c31af7Sopenharmony_ci 122e5c31af7Sopenharmony_ci void init(); 123e5c31af7Sopenharmony_ci tcu::TestNode::IterateResult iterate(); 124e5c31af7Sopenharmony_ci 125e5c31af7Sopenharmony_ciprivate: 126e5c31af7Sopenharmony_ci /* Private members */ 127e5c31af7Sopenharmony_ci std::stringstream mLog; 128e5c31af7Sopenharmony_ci 129e5c31af7Sopenharmony_ci std::vector<GLint> mSupportedTargets; 130e5c31af7Sopenharmony_ci std::vector<GLint> mNotSupportedTargets; 131e5c31af7Sopenharmony_ci 132e5c31af7Sopenharmony_ci /* Private methods */ 133e5c31af7Sopenharmony_ci bool testTextureSparseARB(const Functions& gl, GLint target, GLint expectedError = GL_NO_ERROR); 134e5c31af7Sopenharmony_ci bool testVirtualPageSizeIndexARB(const Functions& gl, GLint target, GLint expectedError = GL_NO_ERROR); 135e5c31af7Sopenharmony_ci bool testNumSparseLevelsARB(const Functions& gl, GLint target); 136e5c31af7Sopenharmony_ci 137e5c31af7Sopenharmony_ci bool checkGetTexParameter(const Functions& gl, GLint target, GLint pname, GLint expected); 138e5c31af7Sopenharmony_ci}; 139e5c31af7Sopenharmony_ci 140e5c31af7Sopenharmony_ci/** Test verifies GetInternalformativ query for formats from Table 8.12 and <pname>: 141e5c31af7Sopenharmony_ci * - NUM_VIRTUAL_PAGE_SIZES_ARB, 142e5c31af7Sopenharmony_ci * - VIRTUAL_PAGE_SIZE_X_ARB, 143e5c31af7Sopenharmony_ci * - VIRTUAL_PAGE_SIZE_Y_ARB, 144e5c31af7Sopenharmony_ci * - VIRTUAL_PAGE_SIZE_Z_ARB. 145e5c31af7Sopenharmony_ci **/ 146e5c31af7Sopenharmony_ciclass InternalFormatQueriesTestCase : public deqp::TestCase 147e5c31af7Sopenharmony_ci{ 148e5c31af7Sopenharmony_cipublic: 149e5c31af7Sopenharmony_ci /* Public methods */ 150e5c31af7Sopenharmony_ci InternalFormatQueriesTestCase(deqp::Context& context); 151e5c31af7Sopenharmony_ci 152e5c31af7Sopenharmony_ci void init(); 153e5c31af7Sopenharmony_ci tcu::TestNode::IterateResult iterate(); 154e5c31af7Sopenharmony_ci 155e5c31af7Sopenharmony_ciprivate: 156e5c31af7Sopenharmony_ci /* Private methods */ 157e5c31af7Sopenharmony_ci std::stringstream mLog; 158e5c31af7Sopenharmony_ci 159e5c31af7Sopenharmony_ci std::vector<GLint> mSupportedTargets; 160e5c31af7Sopenharmony_ci std::vector<GLint> mSupportedInternalFormats; 161e5c31af7Sopenharmony_ci 162e5c31af7Sopenharmony_ci /* Private members */ 163e5c31af7Sopenharmony_ci}; 164e5c31af7Sopenharmony_ci 165e5c31af7Sopenharmony_ci/** Test verifies GetIntegerv, GetFloatv, GetDoublev, GetInteger64v, 166e5c31af7Sopenharmony_ci * and GetBooleanv queries for <pname>: 167e5c31af7Sopenharmony_ci * - MAX_SPARSE_TEXTURE_SIZE_ARB, 168e5c31af7Sopenharmony_ci * - MAX_SPARSE_3D_TEXTURE_SIZE_ARB, 169e5c31af7Sopenharmony_ci * - MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB, 170e5c31af7Sopenharmony_ci * - SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB. 171e5c31af7Sopenharmony_ci **/ 172e5c31af7Sopenharmony_ciclass SimpleQueriesTestCase : public deqp::TestCase 173e5c31af7Sopenharmony_ci{ 174e5c31af7Sopenharmony_cipublic: 175e5c31af7Sopenharmony_ci /* Public methods */ 176e5c31af7Sopenharmony_ci SimpleQueriesTestCase(deqp::Context& context); 177e5c31af7Sopenharmony_ci 178e5c31af7Sopenharmony_ci tcu::TestNode::IterateResult iterate(); 179e5c31af7Sopenharmony_ci 180e5c31af7Sopenharmony_ciprivate: 181e5c31af7Sopenharmony_ci /* Private methods */ 182e5c31af7Sopenharmony_ci /* Private members */ 183e5c31af7Sopenharmony_ci void testSipmleQueries(const Functions& gl, GLint pname); 184e5c31af7Sopenharmony_ci}; 185e5c31af7Sopenharmony_ci 186e5c31af7Sopenharmony_ci/** Test verifies glTexStorage* functionality added by ARB_sparse_texture extension 187e5c31af7Sopenharmony_ci **/ 188e5c31af7Sopenharmony_ciclass SparseTextureAllocationTestCase : public deqp::TestCase 189e5c31af7Sopenharmony_ci{ 190e5c31af7Sopenharmony_cipublic: 191e5c31af7Sopenharmony_ci /* Public methods */ 192e5c31af7Sopenharmony_ci SparseTextureAllocationTestCase(deqp::Context& context); 193e5c31af7Sopenharmony_ci 194e5c31af7Sopenharmony_ci SparseTextureAllocationTestCase(deqp::Context& context, const char* name, const char* description); 195e5c31af7Sopenharmony_ci 196e5c31af7Sopenharmony_ci virtual void init(); 197e5c31af7Sopenharmony_ci virtual tcu::TestNode::IterateResult iterate(); 198e5c31af7Sopenharmony_ci 199e5c31af7Sopenharmony_ciprotected: 200e5c31af7Sopenharmony_ci /* Protected methods */ 201e5c31af7Sopenharmony_ci std::stringstream mLog; 202e5c31af7Sopenharmony_ci 203e5c31af7Sopenharmony_ci std::vector<GLint> mSupportedTargets; 204e5c31af7Sopenharmony_ci std::vector<GLint> mFullArrayTargets; 205e5c31af7Sopenharmony_ci std::vector<GLint> mSupportedInternalFormats; 206e5c31af7Sopenharmony_ci 207e5c31af7Sopenharmony_ci /* Protected members */ 208e5c31af7Sopenharmony_ci bool positiveTesting(const Functions& gl, GLint target, GLint format); 209e5c31af7Sopenharmony_ci bool verifyTexParameterErrors(const Functions& gl, GLint target, GLint format); 210e5c31af7Sopenharmony_ci bool verifyTexStorageVirtualPageSizeIndexError(const Functions& gl, GLint target, GLint format); 211e5c31af7Sopenharmony_ci bool verifyTexStorageFullArrayCubeMipmapsError(const Functions& gl, GLint target, GLint format); 212e5c31af7Sopenharmony_ci bool verifyTexStorageInvalidValueErrors(const Functions& gl, GLint target, GLint format); 213e5c31af7Sopenharmony_ci}; 214e5c31af7Sopenharmony_ci 215e5c31af7Sopenharmony_ci/** Test verifies glTexPageCommitmentARB functionality added by ARB_sparse_texture extension 216e5c31af7Sopenharmony_ci **/ 217e5c31af7Sopenharmony_ciclass SparseTextureCommitmentTestCase : public deqp::TestCase 218e5c31af7Sopenharmony_ci{ 219e5c31af7Sopenharmony_cipublic: 220e5c31af7Sopenharmony_ci /* Public methods */ 221e5c31af7Sopenharmony_ci SparseTextureCommitmentTestCase(deqp::Context& context); 222e5c31af7Sopenharmony_ci 223e5c31af7Sopenharmony_ci SparseTextureCommitmentTestCase(deqp::Context& context, const char* name, const char* description); 224e5c31af7Sopenharmony_ci 225e5c31af7Sopenharmony_ci virtual void init(); 226e5c31af7Sopenharmony_ci virtual tcu::TestNode::IterateResult iterate(); 227e5c31af7Sopenharmony_ci 228e5c31af7Sopenharmony_ciprotected: 229e5c31af7Sopenharmony_ci /* Protected members */ 230e5c31af7Sopenharmony_ci std::stringstream mLog; 231e5c31af7Sopenharmony_ci 232e5c31af7Sopenharmony_ci std::vector<GLint> mSupportedTargets; 233e5c31af7Sopenharmony_ci std::vector<GLint> mSupportedInternalFormats; 234e5c31af7Sopenharmony_ci 235e5c31af7Sopenharmony_ci TextureState mState; 236e5c31af7Sopenharmony_ci 237e5c31af7Sopenharmony_ci /* Protected methods */ 238e5c31af7Sopenharmony_ci virtual void texPageCommitment(const Functions& gl, GLint target, GLint format, GLuint& texture, GLint level, 239e5c31af7Sopenharmony_ci GLint xOffset, GLint yOffset, GLint zOffset, GLint width, GLint height, GLint depth, 240e5c31af7Sopenharmony_ci GLboolean committ); 241e5c31af7Sopenharmony_ci 242e5c31af7Sopenharmony_ci virtual bool caseAllowed(GLint target, GLint format); 243e5c31af7Sopenharmony_ci 244e5c31af7Sopenharmony_ci virtual bool prepareTexture(const Functions& gl, GLint target, GLint format, GLuint& texture); 245e5c31af7Sopenharmony_ci virtual bool sparseAllocateTexture(const Functions& gl, GLint target, GLint format, GLuint& texture, GLint levels); 246e5c31af7Sopenharmony_ci virtual bool allocateTexture(const Functions& gl, GLint target, GLint format, GLuint& texture, GLint levels); 247e5c31af7Sopenharmony_ci virtual bool writeDataToTexture(const Functions& gl, GLint target, GLint format, GLuint& texture, GLint level); 248e5c31af7Sopenharmony_ci virtual bool verifyTextureData(const Functions& gl, GLint target, GLint format, GLuint& texture, GLint level); 249e5c31af7Sopenharmony_ci virtual bool commitTexturePage(const Functions& gl, GLint target, GLint format, GLuint& texture, GLint level); 250e5c31af7Sopenharmony_ci 251e5c31af7Sopenharmony_ci virtual bool isInPageSizesRange(GLint target, GLint level); 252e5c31af7Sopenharmony_ci virtual bool isPageSizesMultiplication(GLint target, GLint level); 253e5c31af7Sopenharmony_ci 254e5c31af7Sopenharmony_ci virtual bool verifyInvalidOperationErrors(const Functions& gl, GLint target, GLint format, GLuint& texture); 255e5c31af7Sopenharmony_ci virtual bool verifyInvalidValueErrors(const Functions& gl, GLint target, GLint format, GLuint& texture); 256e5c31af7Sopenharmony_ci}; 257e5c31af7Sopenharmony_ci 258e5c31af7Sopenharmony_ci/** Test verifies glTexturePageCommitmentEXT functionality added by ARB_sparse_texture extension 259e5c31af7Sopenharmony_ci **/ 260e5c31af7Sopenharmony_ciclass SparseDSATextureCommitmentTestCase : public SparseTextureCommitmentTestCase 261e5c31af7Sopenharmony_ci{ 262e5c31af7Sopenharmony_cipublic: 263e5c31af7Sopenharmony_ci /* Public methods */ 264e5c31af7Sopenharmony_ci SparseDSATextureCommitmentTestCase(deqp::Context& context); 265e5c31af7Sopenharmony_ci 266e5c31af7Sopenharmony_ci virtual tcu::TestNode::IterateResult iterate(); 267e5c31af7Sopenharmony_ci 268e5c31af7Sopenharmony_ciprivate: 269e5c31af7Sopenharmony_ci /* Private methods */ 270e5c31af7Sopenharmony_ci virtual void texPageCommitment(const Functions& gl, GLint target, GLint format, GLuint& texture, GLint level, 271e5c31af7Sopenharmony_ci GLint xOffset, GLint yOffset, GLint zOffset, GLint width, GLint height, GLint depth, 272e5c31af7Sopenharmony_ci GLboolean committ); 273e5c31af7Sopenharmony_ci}; 274e5c31af7Sopenharmony_ci 275e5c31af7Sopenharmony_ci/** Test group which encapsulates all sparse texture conformance tests */ 276e5c31af7Sopenharmony_ciclass SparseTextureTests : public deqp::TestCaseGroup 277e5c31af7Sopenharmony_ci{ 278e5c31af7Sopenharmony_cipublic: 279e5c31af7Sopenharmony_ci /* Public methods */ 280e5c31af7Sopenharmony_ci SparseTextureTests(deqp::Context& context); 281e5c31af7Sopenharmony_ci 282e5c31af7Sopenharmony_ci void init(); 283e5c31af7Sopenharmony_ci 284e5c31af7Sopenharmony_ciprivate: 285e5c31af7Sopenharmony_ci SparseTextureTests(const SparseTextureTests& other); 286e5c31af7Sopenharmony_ci SparseTextureTests& operator=(const SparseTextureTests& other); 287e5c31af7Sopenharmony_ci}; 288e5c31af7Sopenharmony_ci 289e5c31af7Sopenharmony_ci} /* glcts namespace */ 290e5c31af7Sopenharmony_ci 291e5c31af7Sopenharmony_ci#endif // _GL4CSPARSETEXTURETESTS_HPP 292