1 #ifndef _ESEXTCFRAGMENTSHADINGRATEATTACHMENTTESTS_HPP 2 #define _ESEXTCFRAGMENTSHADINGRATEATTACHMENTTESTS_HPP 3 /*------------------------------------------------------------------------- 4 * OpenGL Conformance Test Suite 5 * ----------------------------- 6 * 7 * Copyright (c) 2022-2022 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 23 /*! 24 * \file 25 * \brief 26 */ /*-------------------------------------------------------------------*/ 27 28 /*! 29 * \file esextcesextcFragmentShadingRateAttachment.hpp 30 * \brief FragmentShadingRateEXT attachment related tests 31 */ /*-------------------------------------------------------------------*/ 32 33 #include "../esextcTestCaseBase.hpp" 34 #include "gluShaderUtil.hpp" 35 #include "tcuDefs.hpp" 36 37 #include <vector> 38 39 namespace glu 40 { 41 class ShaderProgram; 42 } 43 44 namespace glcts 45 { 46 class FragmentShadingRateAttachment : public TestCaseBase 47 { 48 public: 49 enum class TestKind 50 { 51 Scissor = 0, 52 MultiView = 1, 53 Count, 54 }; 55 56 struct TestcaseParam 57 { 58 TestKind testKind; 59 bool attachmentShadingRate; 60 bool multiShadingRate; 61 deUint32 framebufferSize; 62 deUint32 layerCount; 63 }; 64 65 struct Box 66 { inglcts::FragmentShadingRateAttachment::Box67 bool in(deUint32 xIn, deUint32 yIn) 68 { 69 return (xIn >= x && xIn < (x + width) && yIn >= y && yIn < (y + height)); 70 } 71 deUint32 x; 72 deUint32 y; 73 deUint32 width; 74 deUint32 height; 75 }; 76 77 public: 78 FragmentShadingRateAttachment(Context& context, const ExtParameters& extParams, const TestcaseParam& testcaseParam, 79 const char* name, const char* description); 80 ~FragmentShadingRateAttachment()81 ~FragmentShadingRateAttachment() override 82 { 83 } 84 85 void init(void) override; 86 void deinit(void) override; 87 IterateResult iterate(void) override; 88 89 private: 90 std::string genVS() const; 91 std::string genFS() const; 92 glw::GLenum translateCoordsToShadingRate(deUint32 srLayer, deUint32 srx, deUint32 sry) const; 93 glw::GLenum translateDrawIDToShadingRate(deUint32 drawID) const; 94 deUint32 drawIDToViewID(deUint32 drawID) const; 95 96 void setupTest(void); 97 98 private: 99 TestcaseParam m_tcParam; 100 glu::ShaderProgram* m_program; 101 glw::GLuint m_to_id; 102 glw::GLuint m_sr_to_id; 103 glw::GLuint m_fbo_id; 104 glw::GLuint m_vbo_id; 105 Box m_scissorBox; 106 std::vector<glw::GLenum> m_availableShadingRates; 107 glw::GLint m_srTexelWidth; 108 glw::GLint m_srTexelHeight; 109 }; 110 111 } // namespace glcts 112 113 #endif // _ESEXTCFRAGMENTSHADINGRATEATTACHMENTTESTS_HPP 114