1 #ifndef _ESEXTCFRAGMENTSHADINGRATECOMBINEDTESTS_HPP 2 #define _ESEXTCFRAGMENTSHADINGRATECOMBINEDTESTS_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 * \file esextcesextcFragmentShadingRateCombinedTests.hpp 24 * \brief FragmentShadingRateEXT tests for combination of conditions 25 */ /*-------------------------------------------------------------------*/ 26 27 #include "../esextcTestCaseBase.hpp" 28 #include "gluShaderUtil.hpp" 29 #include "tcuDefs.hpp" 30 31 #include <vector> 32 33 namespace glu 34 { 35 class ShaderProgram; 36 } 37 38 namespace glcts 39 { 40 class FragmentShadingRateCombined : public TestCaseBase 41 { 42 public: 43 struct TestcaseParam 44 { 45 bool useShadingRateAPI; 46 bool useShadingRatePrimitive; 47 bool useShadingRateAttachment; 48 glw::GLenum combinerOp0; 49 glw::GLenum combinerOp1; 50 bool msaa; 51 deInt32 framebufferSize; 52 }; 53 54 struct Extent2D 55 { 56 deUint32 width; 57 deUint32 height; 58 }; 59 60 public: 61 FragmentShadingRateCombined(Context& context, const ExtParameters& extParams, 62 const FragmentShadingRateCombined::TestcaseParam& testcaseParam, const char* name, 63 const char* description); 64 ~FragmentShadingRateCombined()65 virtual ~FragmentShadingRateCombined() 66 { 67 } 68 69 void init(void) override; 70 void deinit(void) override; 71 IterateResult iterate(void) override; 72 73 private: 74 std::string genVS(); 75 std::string genFS(); 76 std::string genCS(); 77 glw::GLenum translateDrawIDToShadingRate(deUint32 drawID) const; 78 glw::GLenum translatePrimIDToShadingRate(deUint32 primID) const; 79 glw::GLenum translateCoordsToShadingRate(deUint32 srx, deUint32 sry) const; 80 deUint32 getPrimitiveID(deUint32 drawID) const; 81 deUint32 simulate(deUint32 drawID, deUint32 primID, deUint32 x, deUint32 y); 82 Extent2D packedShadingRateToExtent(deUint32 packedRate) const; 83 deUint32 shadingRateExtentToClampedMask(Extent2D ext, bool allowSwap) const; 84 85 void setupTest(void); 86 Extent2D combine(Extent2D extent0, Extent2D extent1, glw::GLenum combineOp) const; 87 88 private: 89 TestcaseParam m_tcParam; 90 glu::ShaderProgram* m_renderProgram; 91 glu::ShaderProgram* m_computeProgram; 92 glw::GLuint m_to_id; 93 glw::GLuint m_sr_to_id; 94 glw::GLuint m_fbo_id; 95 glw::GLuint m_vbo_id; 96 std::vector<glw::GLenum> m_availableShadingRates; 97 glw::GLint m_srTexelWidth; 98 glw::GLint m_srTexelHeight; 99 std::vector<deUint32> m_simulationCache; 100 }; 101 102 } // namespace glcts 103 104 #endif // _ESEXTCFRAGMENTSHADINGRATECOMBINEDTESTS_HPP 105