Hash :
f64fef25
Author :
Date :
2024-06-07T12:18:18
CL/Vulkan: Protect clspv compiler calls The clspv compiler uses llvm backend to perform source code transliteration, and the llvm parser used is non-rentrant. So protect the clspv compiler call with a mutex. Bug: angleproject:361717757 Change-Id: Ib10d6d165307594bed607d5e794b0ef92c3c894b Signed-off-by: Gowtham Tammana <g.tammana@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6092035 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@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
//
// Copyright 2024 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.
//
// clspv_utils:
// Utilities to map clspv interface variables to OpenCL and Vulkan mappings.
//
#ifndef LIBANGLE_RENDERER_VULKAN_CLSPV_UTILS_H_
#define LIBANGLE_RENDERER_VULKAN_CLSPV_UTILS_H_
#include <string>
#include <vector>
#include <libANGLE/renderer/vulkan/CLDeviceVk.h>
#include "clspv/Compiler.h"
namespace rx
{
struct ClspvPrintfBufferStorage
{
uint32_t descriptorSet = 0;
uint32_t binding = 0;
uint32_t pcOffset = 0;
uint32_t size = 0;
};
struct ClspvPrintfInfo
{
uint32_t id = 0;
std::string formatSpecifier;
std::vector<uint32_t> argSizes;
};
angle::Result ClspvProcessPrintfBuffer(unsigned char *buffer,
const size_t bufferSize,
const angle::HashMap<uint32_t, ClspvPrintfInfo> *infoMap);
// Populate a list of options that can be supported by clspv based on the features supported by the
// vulkan renderer.
std::string ClspvGetCompilerOptions(const CLDeviceVk *device);
ClspvError ClspvCompileSource(const size_t programCount,
const size_t *programSizes,
const char **programs,
const char *options,
char **outputBinary,
size_t *outputBinarySize,
char **outputLog);
} // namespace rx
#endif // LIBANGLE_RENDERER_VULKAN_CLSPV_UTILS_H_