Hash :
46d75031
Author :
Date :
2024-11-06T17:12:05
CL/VK: ConstantDataPointerPushConstant support add compiler option "-module-constants-in-storage-buffer" to enable Module-scope __constants to be collected into a single storage buffer Bug: angleproject:442950569 Change-Id: I45b3776301a5cee8896cade71bce517dfad2eda2 Signed-off-by: hoonee.cho <hoonee.cho@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6916343 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Austin Annestrand <a.annestrand@samsung.com> Reviewed-by: Geoff Lang <geofflang@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
//
// 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"
#include "clspv/Sampler.h"
#include "spirv-tools/libspirv.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;
};
struct ClspvLiteralSampler
{
uint32_t descriptorSet;
uint32_t binding;
cl_bool normalizedCoords;
cl::AddressingMode addressingMode;
cl::FilterMode filterMode;
};
struct ClspvConstantDataBufferInfo
{
uint32_t set;
uint32_t binding;
uint32_t pcOffset;
std::vector<uint8_t> bufferData;
};
namespace clspv_cl
{
cl::AddressingMode GetAddressingMode(uint32_t mask);
cl::FilterMode GetFilterMode(uint32_t mask);
inline bool IsNormalizedCoords(uint32_t mask)
{
return (mask & clspv::kSamplerNormalizedCoordsMask) == clspv::CLK_NORMALIZED_COORDS_TRUE;
}
} // namespace clspv_cl
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);
spv_target_env ClspvGetSpirvVersion(const vk::Renderer *renderer);
bool ClspvValidate(vk::Renderer *rendererVk, const angle::spirv::Blob &blob);
} // namespace rx
#endif // LIBANGLE_RENDERER_VULKAN_CLSPV_UTILS_H_