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 } // tcu 35 36 namespace glu 37 { 38 class ShaderProgram; 39 } // glu 40 41 42 namespace deqp 43 { 44 namespace gles31 45 { 46 namespace Functional 47 { 48 namespace MultisampleShaderRenderUtil 49 { 50 51 class QualityWarning : public tcu::Exception 52 { 53 public: 54 QualityWarning (const std::string& message); 55 }; 56 57 class MultisampleRenderCase : public TestCase 58 { 59 public: 60 enum RenderTarget 61 { 62 TARGET_DEFAULT = 0, 63 TARGET_TEXTURE, 64 TARGET_RENDERBUFFER, 65 66 TARGET_LAST 67 }; 68 enum Flags 69 { 70 FLAG_PER_ITERATION_SHADER = 1, 71 FLAG_VERIFY_MSAA_TEXTURE_SAMPLE_BUFFERS = 2, // !< flag set: each sample layer is verified by verifySampleBuffer 72 }; 73 74 MultisampleRenderCase (Context& context, const char* name, const char* desc, int numSamples, RenderTarget target, 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 deInt32 m_numTargetSamples; 115 116 deUint32 m_buffer; 117 deUint32 m_resolveBuffer; 118 glu::ShaderProgram* m_program; 119 deUint32 m_fbo; 120 deUint32 m_fboTexture; 121 glu::ShaderProgram* m_textureSamplerProgram; 122 deUint32 m_fboRbo; 123 deUint32 m_resolveFbo; 124 deUint32 m_resolveFboTexture; 125 int m_iteration; 126 int m_numIterations; 127 deUint32 m_renderMode; 128 deInt32 m_renderCount; 129 deUint32 m_renderVao; 130 deUint32 m_resolveVao; 131 132 std::string m_renderSceneDescription; 133 std::map<std::string, Attrib> m_renderAttribs; 134 }; 135 136 } // MultisampleShaderRenderUtil 137 } // Functional 138 } // gles31 139 } // deqp 140 141 #endif // _ES31FMULTISAMPLESHADERRENDERCASE_HPP 142