1 #ifndef _ES31FMULTISAMPLESHADERRENDERCASE_HPP 2 #define _ES31FMULTISAMPLESHADERRENDERCASE_HPP 3 /*------------------------------------------------------------------------- 4 * drawElements Quality Program OpenGL ES 3.1 Module 5 * ------------------------------------------------- 6 * 7 * Copyright 2014 The Android Open Source Project 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 Multisample shader render case 24 *//*--------------------------------------------------------------------*/ 25 26 #include "tcuDefs.hpp" 27 #include "tes31TestCase.hpp" 28 29 #include <map> 30 31 namespace tcu 32 { 33 class Surface; 34 } // namespace tcu 35 36 namespace glu 37 { 38 class ShaderProgram; 39 } // namespace glu 40 41 namespace deqp 42 { 43 namespace gles31 44 { 45 namespace Functional 46 { 47 namespace MultisampleShaderRenderUtil 48 { 49 50 class QualityWarning : public tcu::Exception 51 { 52 public: 53 QualityWarning(const std::string &message); 54 }; 55 56 class MultisampleRenderCase : public TestCase 57 { 58 public: 59 enum RenderTarget 60 { 61 TARGET_DEFAULT = 0, 62 TARGET_TEXTURE, 63 TARGET_RENDERBUFFER, 64 65 TARGET_LAST 66 }; 67 enum Flags 68 { 69 FLAG_PER_ITERATION_SHADER = 1, 70 FLAG_VERIFY_MSAA_TEXTURE_SAMPLE_BUFFERS = 2, // !< flag set: each sample layer is verified by verifySampleBuffer 71 }; 72 73 MultisampleRenderCase(Context &context, const char *name, const char *desc, int numSamples, RenderTarget target, 74 int renderSize, int flags = 0); 75 virtual ~MultisampleRenderCase(void); 76 77 virtual void init(void); 78 virtual void deinit(void); 79 IterateResult iterate(void); 80 81 private: 82 virtual void preDraw(void); 83 virtual void postDraw(void); 84 virtual void preTest(void); 85 virtual void postTest(void); 86 virtual std::string getIterationDescription(int iteration) const; 87 88 void drawOneIteration(void); 89 void verifyResultImageAndSetResult(const tcu::Surface &resultImage); 90 void verifyResultBuffersAndSetResult(const std::vector<tcu::Surface> &resultBuffers); 91 virtual std::string genVertexSource(int numTargetSamples) const; 92 virtual std::string genFragmentSource(int numTargetSamples) const = 0; 93 std::string genMSSamplerSource(int numTargetSamples) const; 94 std::string genMSTextureResolverSource(int numTargetSamples) const; 95 std::string genMSTextureLayerFetchSource(int numTargetSamples) const; 96 virtual bool verifyImage(const tcu::Surface &resultImage) = 0; 97 virtual bool verifySampleBuffers(const std::vector<tcu::Surface> &resultBuffers); 98 virtual void setupRenderData(void); 99 100 glw::GLint getMaxConformantSampleCount(glw::GLenum target, glw::GLenum internalFormat); 101 102 protected: 103 struct Attrib 104 { 105 int offset; 106 int stride; 107 }; 108 109 const int m_numRequestedSamples; 110 const RenderTarget m_renderTarget; 111 const int m_renderSize; 112 const bool m_perIterationShader; 113 const bool m_verifyTextureSampleBuffers; 114 int32_t m_numTargetSamples; 115 116 uint32_t m_buffer; 117 uint32_t m_resolveBuffer; 118 glu::ShaderProgram *m_program; 119 uint32_t m_fbo; 120 uint32_t m_fboTexture; 121 glu::ShaderProgram *m_textureSamplerProgram; 122 uint32_t m_fboRbo; 123 uint32_t m_resolveFbo; 124 uint32_t m_resolveFboTexture; 125 int m_iteration; 126 int m_numIterations; 127 uint32_t m_renderMode; 128 int32_t m_renderCount; 129 uint32_t m_renderVao; 130 uint32_t m_resolveVao; 131 132 std::string m_renderSceneDescription; 133 std::map<std::string, Attrib> m_renderAttribs; 134 }; 135 136 } // namespace MultisampleShaderRenderUtil 137 } // namespace Functional 138 } // namespace gles31 139 } // namespace deqp 140 141 #endif // _ES31FMULTISAMPLESHADERRENDERCASE_HPP 142