1 #ifndef _ESEXTCTEXTUREBUFFERBUFFERPARAMETERS_HPP 2 #define _ESEXTCTEXTUREBUFFERBUFFERPARAMETERS_HPP 3 /*------------------------------------------------------------------------- 4 * OpenGL Conformance Test Suite 5 * ----------------------------- 6 * 7 * Copyright (c) 2014-2016 The Khronos Group Inc. 8 * 9 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * you may not use this file except in compliance with the License. 11 * You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 * 21 */ /*! 22 * \file 23 * \brief 24 */ /*-------------------------------------------------------------------*/ 25 26 /*! 27 * \file esextcTextureBufferBufferParameters.hpp 28 * \brief GetBufferParameteriv and GetBufferPointerv test (Test 9) 29 */ /*-------------------------------------------------------------------*/ 30 31 #include "../esextcTestCaseBase.hpp" 32 #include "gluShaderUtil.hpp" 33 #include "tcuDefs.hpp" 34 35 namespace glcts 36 { 37 38 /** Implementation of (Test 9) from CTS_EXT_texture_buffer. Description follows: 39 * 40 * Test whether for buffer object bound to TEXTURE_BUFFER_EXT target 41 * GetBufferParameteriv and GetBufferPointerv functions return correct 42 * parameters of the buffer object. 43 * 44 * Category: API. 45 * 46 * The test should create buffer object and bind it to TEXTURE_BUFFER_EXT target. 47 * 48 * The function GetBufferParameteriv called with GL_BUFFER_SIZE parameter name 49 * should return 0. 50 * 51 * Use glBufferData to initialize the buffer object's data store. 52 * 53 * The function GetBufferParameteriv called with GL_BUFFER_SIZE parameter name 54 * should return the size specified in the above glBufferData call. 55 * 56 * The function GetBufferParameteriv called with GL_BUFFER_USAGE parameter name 57 * should return the usage specified in the above glBufferData call. 58 * 59 * The function GetBufferParameteriv called with GL_BUFFER_MAPPED parameter name 60 * should return GL_FALSE, because the buffer object's data store is not mapped. 61 * 62 * The function GetBufferParameteriv called with GL_BUFFER_MAP_OFFSET parameter 63 * name should return 0, because the buffer object's data store is not mapped. 64 * 65 * The function GetBufferParameteriv called with GL_BUFFER_MAP_LENGTH parameter 66 * name should return 0, because the buffer object's data store is not mapped. 67 * 68 * The function glGetBufferPointerv called with GL_BUFFER_MAP_POINTER parameter 69 * name should return NULL, because the buffer object's data store is not mapped. 70 * 71 * Map the buffer object's data store to client's address space by using 72 * glMapBufferRange function (map the whole data store). 73 * 74 * The function GetBufferParameteriv called with GL_BUFFER_MAPPED parameter name 75 * should return GL_TRUE, because whole buffer object's data store is mapped. 76 * 77 * The function GetBufferParameteriv called with GL_BUFFER_MAP_OFFSET parameter 78 * name should return 0, because the whole data store is mapped. 79 * 80 * The function GetBufferParameteriv called with GL_BUFFER_MAP_LENGTH parameter 81 * name should return the size of the data store. 82 * 83 * The function GetBufferParameteriv called with GL_BUFFER_ACCESS_FLAGS parameter 84 * name should return the access policy set while mapping the buffer object. 85 * 86 * The function glGetBufferPointerv called with GL_BUFFER_MAP_POINTER parameter 87 * name should the pointer to which the buffer object's data store is currently 88 * mapped. 89 * 90 * Map the buffer object's data store to client's address space by using 91 * glMapBufferRange function (map only a range of the data store). 92 * 93 * The function GetBufferParameteriv called with GL_BUFFER_MAPPED parameter name 94 * should return GL_TRUE, because a range of buffer object's data store is mapped. 95 * 96 * The function GetBufferParameteriv called with GL_BUFFER_MAP_OFFSET parameter 97 * name should return the offset specified in the above glMapBufferRange call. 98 * 99 * The function GetBufferParameteriv called with GL_BUFFER_MAP_LENGTH parameter 100 * name should return the length specified in the above glMapBufferRange call. 101 * 102 * The data store should be unmapped using glUnmapBuffer function. 103 */ 104 class TextureBufferBufferParameters : public TestCaseBase 105 { 106 public: 107 /* Public methods */ 108 TextureBufferBufferParameters(Context& context, const ExtParameters& extParams, const char* name, 109 const char* description); 110 ~TextureBufferBufferParameters()111 virtual ~TextureBufferBufferParameters() 112 { 113 } 114 115 virtual void deinit(void); 116 virtual IterateResult iterate(void); 117 118 private: 119 /* Private methods */ 120 void initTest(void); 121 122 glw::GLboolean queryBufferParameteriv(glw::GLenum target, glw::GLenum pname, glw::GLint expected_data); 123 glw::GLboolean queryBufferParameteri64v(glw::GLenum target, glw::GLenum pname, glw::GLint64 expected_data); 124 glw::GLboolean queryBufferPointerv(glw::GLenum target, glw::GLenum pname, glw::GLvoid* expected_params); 125 126 /* Private variables */ 127 glw::GLuint m_bo_id; /* Buffer Object */ 128 glw::GLubyte* m_buffer_pointer; /* Pointer to mapped buffer */ 129 130 /* Private static constants */ 131 static const glw::GLint m_bo_size; /* Buffer object size */ 132 }; 133 134 } // namespace glcts 135 136 #endif // _ESEXTCTEXTUREBUFFERBUFFERPARAMETERS_HPP 137