// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #pragma once #include "video_core/renderer_opengl/gl_resource_manager.h" namespace OpenGL { constexpr GLint PositionLocation = 0; constexpr GLint TexCoordLocation = 1; constexpr GLint ModelViewMatrixLocation = 0; struct ScreenRectVertex { constexpr ScreenRectVertex() = default; constexpr ScreenRectVertex(u32 x, u32 y, GLfloat u, GLfloat v) : position{{static_cast(x), static_cast(y)}}, tex_coord{{u, v}} {} std::array position{}; std::array tex_coord{}; }; /** * Defines a 1:1 pixel orthographic projection matrix with (0,0) on the top-left * corner and (width, height) on the lower-bottom. * * The projection part of the matrix is trivial, hence these operations are represented * by a 3x2 matrix. */ static inline std::array MakeOrthographicMatrix(float width, float height) { std::array matrix; // Laid out in column-major order // clang-format off matrix[0] = 2.f / width; matrix[2] = 0.f; matrix[4] = -1.f; matrix[1] = 0.f; matrix[3] = -2.f / height; matrix[5] = 1.f; // Last matrix row is implicitly assumed to be [0, 0, 1]. // clang-format on return matrix; } } // namespace OpenGL