Path: blob/main_old/src/tests/gl_tests/FloatingPointSurfaceTest.cpp
1693 views
//1// Copyright 2017 The ANGLE Project Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4//56// FloatingPointSurfaceTest.cpp : Test functionality of the EGL_EXT_pixel_format_float extension.78#include "test_utils/ANGLETest.h"910using namespace angle;1112class FloatingPointSurfaceTest : public ANGLETest13{14protected:15FloatingPointSurfaceTest()16{17setWindowWidth(512);18setWindowHeight(512);19setConfigRedBits(16);20setConfigGreenBits(16);21setConfigBlueBits(16);22setConfigAlphaBits(16);23setConfigComponentType(EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT);24}2526void testSetUp() override27{28constexpr char kFS[] =29"precision highp float;\n"30"void main()\n"31"{\n"32" gl_FragColor = vec4(1.0, 2.0, 3.0, 4.0);\n"33"}\n";3435mProgram = CompileProgram(essl1_shaders::vs::Simple(), kFS);36ASSERT_NE(0u, mProgram) << "shader compilation failed.";3738ASSERT_GL_NO_ERROR();39}4041void testTearDown() override { glDeleteProgram(mProgram); }4243GLuint mProgram;44};4546// Test clearing and checking the color is correct47TEST_P(FloatingPointSurfaceTest, Clearing)48{49GLColor32F clearColor(0.0f, 1.0f, 2.0f, 3.0f);50glClearColor(clearColor.R, clearColor.G, clearColor.B, clearColor.A);51glClear(GL_COLOR_BUFFER_BIT);52ASSERT_GL_NO_ERROR();5354EXPECT_PIXEL_COLOR32F_EQ(0, 0, clearColor);55}5657// Test drawing and checking the color is correct58TEST_P(FloatingPointSurfaceTest, Drawing)59{60glUseProgram(mProgram);61drawQuad(mProgram, essl1_shaders::PositionAttrib(), 0.5f);6263EXPECT_PIXEL_32F_EQ(0, 0, 1.0f, 2.0f, 3.0f, 4.0f);64}6566// Use this to select which configurations (e.g. which renderer, which GLES major version) these67// tests should be run against.68ANGLE_INSTANTIATE_TEST(FloatingPointSurfaceTest,69ES2_D3D11(),70ES3_D3D11(),71ES2_D3D11_PRESENT_PATH_FAST());7273// This test suite is not instantiated on some OSes.74GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(FloatingPointSurfaceTest);757677