Hash :
9bc837f6
Author :
Date :
2021-04-07T15:24:12
Vulkan: Generate SPIR-V directly from the translator; Part 1 This is the first change in a series to generate SPIR-V directly from the translator's AST, instead of the generating text GLSL and feeding it to glslang. This change implements the majority of the work needed to map AST types to SPIR-V types, and declare types and interface variables in SPIR-V. Additionally, it lays the infrastructure to conditionally enabling this path in end2end tests. No tests are currently enabled as the change doesn't actually generate code for function bodies yet. Bug: angleproject:4889 Change-Id: Iacb28b6907fd48c50e4cc5a0e7ad72f6eed241d4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2889603 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
//
// 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.
//
// EGLPlatformParameters: Basic description of an EGL device.
#ifndef UTIL_EGLPLATFORMPARAMETERS_H_
#define UTIL_EGLPLATFORMPARAMETERS_H_
#include "util/util_gl.h"
#include <tuple>
namespace angle
{
struct PlatformMethods;
// The GLES driver type determines what shared object we use to load the GLES entry points.
// AngleEGL loads from ANGLE's version of libEGL, libGLESv2, and libGLESv1_CM.
// SystemEGL uses the system copies of libEGL, libGLESv2, and libGLESv1_CM.
// SystemWGL loads Windows GL with the GLES compatiblity extensions. See util/WGLWindow.h.
enum class GLESDriverType
{
AngleEGL,
SystemEGL,
SystemWGL,
};
} // namespace angle
struct EGLPlatformParameters
{
EGLPlatformParameters() = default;
explicit EGLPlatformParameters(EGLint renderer) : renderer(renderer) {}
EGLPlatformParameters(EGLint renderer,
EGLint majorVersion,
EGLint minorVersion,
EGLint deviceType)
: renderer(renderer),
majorVersion(majorVersion),
minorVersion(minorVersion),
deviceType(deviceType)
{}
EGLPlatformParameters(EGLint renderer,
EGLint majorVersion,
EGLint minorVersion,
EGLint deviceType,
EGLint presentPath)
: renderer(renderer),
majorVersion(majorVersion),
minorVersion(minorVersion),
deviceType(deviceType),
presentPath(presentPath)
{}
auto tie() const
{
return std::tie(renderer, majorVersion, minorVersion, deviceType, presentPath,
debugLayersEnabled, contextVirtualization, transformFeedbackFeature,
allocateNonZeroMemoryFeature, emulateCopyTexImage2DFromRenderbuffers,
shaderStencilOutputFeature, genMultipleMipsPerPassFeature, platformMethods,
robustness, emulatedPrerotation, asyncCommandQueueFeatureVulkan,
hasExplicitMemBarrierFeatureMtl, hasCheapRenderPassFeatureMtl,
forceBufferGPUStorageFeatureMtl, supportsVulkanViewportFlip, emulatedVAOs,
directSPIRVGeneration);
}
EGLint renderer = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE;
EGLint majorVersion = EGL_DONT_CARE;
EGLint minorVersion = EGL_DONT_CARE;
EGLint deviceType = EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE;
EGLint presentPath = EGL_DONT_CARE;
EGLint debugLayersEnabled = EGL_DONT_CARE;
EGLint contextVirtualization = EGL_DONT_CARE;
EGLint robustness = EGL_DONT_CARE;
EGLint transformFeedbackFeature = EGL_DONT_CARE;
EGLint allocateNonZeroMemoryFeature = EGL_DONT_CARE;
EGLint emulateCopyTexImage2DFromRenderbuffers = EGL_DONT_CARE;
EGLint shaderStencilOutputFeature = EGL_DONT_CARE;
EGLint genMultipleMipsPerPassFeature = EGL_DONT_CARE;
uint32_t emulatedPrerotation = 0; // Can be 0, 90, 180 or 270
EGLint asyncCommandQueueFeatureVulkan = EGL_DONT_CARE;
EGLint hasExplicitMemBarrierFeatureMtl = EGL_DONT_CARE;
EGLint hasCheapRenderPassFeatureMtl = EGL_DONT_CARE;
EGLint forceBufferGPUStorageFeatureMtl = EGL_DONT_CARE;
EGLint supportsVulkanViewportFlip = EGL_DONT_CARE;
EGLint emulatedVAOs = EGL_DONT_CARE;
EGLint directSPIRVGeneration = EGL_DONT_CARE;
angle::PlatformMethods *platformMethods = nullptr;
};
inline bool operator<(const EGLPlatformParameters &a, const EGLPlatformParameters &b)
{
return a.tie() < b.tie();
}
inline bool operator==(const EGLPlatformParameters &a, const EGLPlatformParameters &b)
{
return a.tie() == b.tie();
}
inline bool operator!=(const EGLPlatformParameters &a, const EGLPlatformParameters &b)
{
return a.tie() != b.tie();
}
#endif // UTIL_EGLPLATFORMPARAMETERS_H_