chromium/third_party/angle/src/tests/test_utils/MultiviewTest.h

//
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// MultiviewTest:
//   Implementation of helpers for multiview testing.
//

#ifndef ANGLE_TESTS_TESTUTILS_MULTIVIEWTEST_H_
#define ANGLE_TESTS_TESTUTILS_MULTIVIEWTEST_H_

#include "test_utils/ANGLETest.h"

namespace angle
{
enum ExtensionName
{};

// Creates a simple program that passes through two-dimensional vertices and renders green
// fragments.
GLuint CreateSimplePassthroughProgram(int numViews, ExtensionName multiviewExtension);

// Create a 2D texture array to use for multiview rendering. Texture ids should be
// created beforehand. If depthTexture or stencilTexture is 0, it will not be initialized.
// If samples is 0, then non-multisampled textures are created. Otherwise multisampled textures are
// created with the requested sample count.
void CreateMultiviewBackingTextures(int samples,
                                    int viewWidth,
                                    int height,
                                    int numLayers,
                                    std::vector<GLuint> colorTextures,
                                    GLuint depthTexture,
                                    GLuint depthStencilTexture);
void CreateMultiviewBackingTextures(int samples,
                                    int viewWidth,
                                    int height,
                                    int numLayers,
                                    GLuint colorTexture,
                                    GLuint depthTexture,
                                    GLuint depthStencilTexture);

// Attach multiview textures to the framebuffer denoted by target. If there are multiple color
// textures they get attached to different color attachments starting from 0.
void AttachMultiviewTextures(GLenum target,
                             int viewWidth,
                             int numViews,
                             int baseViewIndex,
                             std::vector<GLuint> colorTextures,
                             GLuint depthTexture,
                             GLuint depthStencilTexture);
void AttachMultiviewTextures(GLenum target,
                             int viewWidth,
                             int numViews,
                             int baseViewIndex,
                             GLuint colorTexture,
                             GLuint depthTexture,
                             GLuint depthStencilTexture);

struct MultiviewImplementationParams : public PlatformParameters
{};
std::ostream &operator<<(std::ostream &os, const MultiviewImplementationParams &params);

MultiviewImplementationParams VertexShaderOpenGL(EGLenum clientType,
                                                 GLint majorVersion,
                                                 GLint minorVersion,
                                                 EGLint profileMask,
                                                 ExtensionName multiviewExtension);
MultiviewImplementationParams VertexShaderVulkan(EGLenum clientType,
                                                 GLint majorVersion,
                                                 GLint minorVersion,
                                                 EGLint profileMask,
                                                 ExtensionName multiviewExtension);
MultiviewImplementationParams VertexShaderD3D11(EGLenum clientType,
                                                GLint majorVersion,
                                                GLint minorVersion,
                                                EGLint profileMask,
                                                ExtensionName multiviewExtension);
MultiviewImplementationParams GeomShaderD3D11(EGLenum clientType,
                                              GLint majorVersion,
                                              GLint minorVersion,
                                              EGLint profileMask,
                                              ExtensionName multiviewExtension);

class MultiviewTestBase : public ANGLETestBase
{};

// Base class for multiview tests that don't need specific helper functions.
class MultiviewTest : public MultiviewTestBase,
                      public ::testing::TestWithParam<MultiviewImplementationParams>
{};

}  // namespace angle

#endif  // ANGLE_TESTS_TESTUTILS_MULTIVIEWTEST_H_