Hash :
f02490d1
Author :
Date :
2019-12-23T14:06:12
Vulkan: clean up arguments to glslang wrapper Some flags were sent as parameters while an Options parameter was added. This change moves those flags to the GlslangSourceOptions struct. Bug: angleproject:3394 Change-Id: Iff5c1c83dd564d7bcfcbd84e6df244b7356d669d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1984108 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@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
//
// Copyright 2019 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.
//
// Wrapper for Khronos glslang compiler. This file is used by Vulkan and Metal backends.
//
#ifndef LIBANGLE_RENDERER_GLSLANG_WRAPPER_UTILS_H_
#define LIBANGLE_RENDERER_GLSLANG_WRAPPER_UTILS_H_
#include <functional>
#include "libANGLE/renderer/ProgramImpl.h"
namespace rx
{
enum class GlslangError
{
InvalidShader,
};
struct GlslangSourceOptions
{
// Uniforms set index:
uint32_t uniformsAndXfbDescriptorSetIndex = 0;
// Textures set index:
uint32_t textureDescriptorSetIndex = 1;
// Other shader resources set index:
uint32_t shaderResourceDescriptorSetIndex = 2;
// ANGLE driver uniforms set index:
uint32_t driverUniformsDescriptorSetIndex = 3;
// Binding index start for transform feedback buffers:
uint32_t xfbBindingIndexStart = 16;
bool useOldRewriteStructSamplers = false;
bool supportsTransformFeedbackExtension = false;
bool emulateTransformFeedback = false;
};
using GlslangErrorCallback = std::function<angle::Result(GlslangError)>;
void GlslangInitialize();
void GlslangRelease();
// Get the mapped sampler name after the soure is transformed by GlslangGetShaderSource()
std::string GlslangGetMappedSamplerName(const std::string &originalName);
// Transform the source to include actual binding points for various shader
// resources (textures, buffers, xfb, etc)
void GlslangGetShaderSource(const GlslangSourceOptions &options,
const gl::ProgramState &programState,
const gl::ProgramLinkedResources &resources,
gl::ShaderMap<std::string> *shaderSourcesOut);
angle::Result GlslangGetShaderSpirvCode(GlslangErrorCallback callback,
const gl::Caps &glCaps,
bool enableLineRasterEmulation,
const gl::ShaderMap<std::string> &shaderSources,
gl::ShaderMap<std::vector<uint32_t>> *shaderCodesOut);
} // namespace rx
#endif // LIBANGLE_RENDERER_GLSLANG_WRAPPER_UTILS_H_