1/*------------------------------------------------------------------------- 2 * drawElements Quality Program OpenGL ES 3.0 Module 3 * ------------------------------------------------- 4 * 5 * Copyright 2014 The Android Open Source Project 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 * 19 *//*! 20 * \file 21 * \brief GLES3 Scissor tests 22 *//*--------------------------------------------------------------------*/ 23 24#include "es3fScissorTests.hpp" 25 26#include "glsScissorTests.hpp" 27 28#include "sglrGLContext.hpp" 29#include "sglrReferenceContext.hpp" 30#include "sglrContextUtil.hpp" 31 32#include "tcuVector.hpp" 33#include "tcuRenderTarget.hpp" 34#include "tcuImageCompare.hpp" 35 36#include "gluStrUtil.hpp" 37#include "gluDrawUtil.hpp" 38 39#include "glwEnums.hpp" 40#include "deDefs.hpp" 41 42namespace deqp 43{ 44namespace gles3 45{ 46namespace Functional 47{ 48 49ScissorTests::ScissorTests (Context& context): 50 TestCaseGroup (context, "scissor", "Scissor Tests") 51{ 52} 53 54ScissorTests::~ScissorTests (void) 55{ 56} 57 58void ScissorTests::init (void) 59{ 60 using tcu::Vec4; 61 using namespace gls::Functional::ScissorTestInternal; 62 63 tcu::TestContext& tc = m_context.getTestContext(); 64 glu::RenderContext& rc = m_context.getRenderContext(); 65 66 const struct 67 { 68 const char* name; 69 const char* desc; 70 const tcu::Vec4 scissor; 71 const tcu::Vec4 render; 72 const PrimitiveType type; 73 const int primitives; 74 } cases[] = 75 { 76 { "contained_quads", "Triangles fully inside scissor area (single call)", Vec4(0.1f, 0.1f, 0.8f, 0.8f), Vec4(0.2f, 0.2f, 0.6f, 0.6f), TRIANGLE, 30 }, 77 { "partial_quads", "Triangles partially inside scissor area (single call)", Vec4(0.3f, 0.3f, 0.4f, 0.4f), Vec4(0.2f, 0.2f, 0.6f, 0.6f), TRIANGLE, 30 }, 78 { "contained_tri", "Triangle fully inside scissor area", Vec4(0.1f, 0.1f, 0.8f, 0.8f), Vec4(0.2f, 0.2f, 0.6f, 0.6f), TRIANGLE, 1 }, 79 { "enclosing_tri", "Triangle fully covering scissor area", Vec4(0.4f, 0.4f, 0.2f, 0.2f), Vec4(0.2f, 0.2f, 0.6f, 0.6f), TRIANGLE, 1 }, 80 { "partial_tri", "Triangle partially inside scissor area", Vec4(0.4f, 0.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 1.0f, 1.0f), TRIANGLE, 1 }, 81 { "outside_render_tri", "Triangle with scissor area outside render target", Vec4(1.4f, 1.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 0.6f, 0.6f), TRIANGLE, 1 }, 82 { "partial_lines", "Linse partially inside scissor area", Vec4(0.4f, 0.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 1.0f, 1.0f), LINE, 30 }, 83 { "contained_line", "Line fully inside scissor area", Vec4(0.1f, 0.1f, 0.8f, 0.8f), Vec4(0.2f, 0.2f, 0.6f, 0.6f), LINE, 1 }, 84 { "partial_line", "Line partially inside scissor area", Vec4(0.4f, 0.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 1.0f, 1.0f), LINE, 1 }, 85 { "outside_render_line", "Line with scissor area outside render target", Vec4(1.4f, 1.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 0.6f, 0.6f), LINE, 1 }, 86 { "contained_point", "Point fully inside scissor area", Vec4(0.1f, 0.1f, 0.8f, 0.8f), Vec4(0.5f, 0.5f, 0.0f, 0.0f), POINT, 1 }, 87 { "partial_points", "Points partially inside scissor area", Vec4(0.4f, 0.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 1.0f, 1.0f), POINT, 30 }, 88 { "outside_point", "Point fully outside scissor area", Vec4(0.4f, 0.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 0.0f, 0.0f), POINT, 1 }, 89 { "outside_render_point", "Point with scissor area outside render target", Vec4(1.4f, 1.4f, 0.6f, 0.6f), Vec4(0.5f, 0.5f, 0.0f, 0.0f), POINT, 1 } 90 }; 91 92 for (int caseNdx = 0; caseNdx < DE_LENGTH_OF_ARRAY(cases); caseNdx++) 93 { 94 addChild(createPrimitiveTest(tc, 95 rc, 96 cases[caseNdx].name, 97 cases[caseNdx].desc, 98 cases[caseNdx].scissor, 99 cases[caseNdx].render, 100 cases[caseNdx].type, 101 cases[caseNdx].primitives)); 102 } 103 104 addChild(createClearTest(tc, rc, "clear_depth", "Depth buffer clear", Vec4(0.1f, 0.1f, 0.8f, 0.8f), GL_DEPTH_BUFFER_BIT)); 105 addChild(createClearTest(tc, rc, "clear_stencil", "Stencil buffer clear", Vec4(0.1f, 0.1f, 0.8f, 0.8f), GL_STENCIL_BUFFER_BIT)); 106 addChild(createClearTest(tc, rc, "clear_color", "Color buffer clear", Vec4(0.1f, 0.1f, 0.8f, 0.8f), GL_COLOR_BUFFER_BIT)); 107 108 addChild(createFramebufferClearTest(tc, rc, "clear_fixed_buffer", "Fixed point color clear", CLEAR_COLOR_FIXED)); 109 addChild(createFramebufferClearTest(tc, rc, "clear_int_buffer", "Integer color clear", CLEAR_COLOR_INT)); 110 addChild(createFramebufferClearTest(tc, rc, "clear_uint_buffer", "Unsigned integer buffer clear", CLEAR_COLOR_UINT)); 111 addChild(createFramebufferClearTest(tc, rc, "clear_depth_buffer", "Depth buffer clear", CLEAR_DEPTH)); 112 addChild(createFramebufferClearTest(tc, rc, "clear_stencil_buffer", "Stencil buffer clear", CLEAR_STENCIL)); 113 addChild(createFramebufferClearTest(tc, rc, "clear_depth_stencil_buffer", "Fixed point color buffer clear", CLEAR_DEPTH_STENCIL)); 114 115 addChild(createFramebufferBlitTest(tc, rc, "framebuffer_blit_center", "Blit to default framebuffer, scissor away edges", Vec4(0.1f, 0.1f, 0.8f, 0.8f))); 116 addChild(createFramebufferBlitTest(tc, rc, "framebuffer_blit_corner", "Blit to default framebuffer, scissor all but a corner", Vec4(0.6f, 0.6f, 0.5f, 0.5f))); 117 addChild(createFramebufferBlitTest(tc, rc, "framebuffer_blit_none", "Blit to default framebuffer, scissor area outside screen", Vec4(1.6f, 0.6f, 0.5f, 0.5f))); 118} 119 120} // Functional 121} // gles3 122} // deqp 123