mirrored from https://chromium.googlesource.com/angle/angle
-
Notifications
You must be signed in to change notification settings - Fork 592
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CL/Vulkan: Add utility function for clspv compile options
Add a utility function for querying the options based on the vulkan renderer for the clspv compiler. Bug: angleproject:361717757 Change-Id: I9722b8a80bcad3f2b799d87b8fbe29c84a686a6e Signed-off-by: Gowtham Tammana <[email protected]> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5810696 Reviewed-by: Shahbaz Youssefi <[email protected]> Reviewed-by: Charlie Lao <[email protected]>
- Loading branch information
1 parent
42ea855
commit 0929a8d
Showing
5 changed files
with
87 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// | ||
// 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. | ||
// | ||
// Utilities to map clspv interface variables to OpenCL and Vulkan mappings. | ||
// | ||
|
||
#include "libANGLE/renderer/vulkan/clspv_utils.h" | ||
#include "libANGLE/renderer/vulkan/CLDeviceVk.h" | ||
|
||
#include <string> | ||
|
||
namespace rx | ||
{ | ||
std::string ClspvGetCompilerOptions(const CLDeviceVk *device) | ||
{ | ||
ASSERT(device && device->getRenderer()); | ||
const vk::Renderer *rendererVk = device->getRenderer(); | ||
std::string options{""}; | ||
|
||
cl_uint addressBits; | ||
if (IsError(device->getInfoUInt(cl::DeviceInfo::AddressBits, &addressBits))) | ||
{ | ||
// This should'nt fail here | ||
ASSERT(false); | ||
} | ||
options += addressBits == 64 ? " -arch=spir64" : " -arch=spir"; | ||
|
||
// Other internal Clspv compiler flags that are needed/required | ||
options += " --long-vector"; | ||
|
||
// 8 bit storage buffer support | ||
if (!rendererVk->getFeatures().supports8BitStorageBuffer.enabled) | ||
{ | ||
options += " --no-8bit-storage=ssbo"; | ||
} | ||
if (!rendererVk->getFeatures().supports8BitUniformAndStorageBuffer.enabled) | ||
{ | ||
options += " --no-8bit-storage=ubo"; | ||
} | ||
if (!rendererVk->getFeatures().supports8BitPushConstant.enabled) | ||
{ | ||
options += " --no-8bit-storage=pushconstant"; | ||
} | ||
|
||
// 16 bit storage options | ||
if (!rendererVk->getFeatures().supports16BitStorageBuffer.enabled) | ||
{ | ||
options += " --no-16bit-storage=ssbo"; | ||
} | ||
if (!rendererVk->getFeatures().supports16BitUniformAndStorageBuffer.enabled) | ||
{ | ||
options += " --no-16bit-storage=ubo"; | ||
} | ||
if (!rendererVk->getFeatures().supports16BitPushConstant.enabled) | ||
{ | ||
options += " --no-16bit-storage=pushconstant"; | ||
} | ||
|
||
return options; | ||
} | ||
|
||
} // namespace rx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// 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. | ||
// | ||
|
||
#include <libANGLE/renderer/vulkan/CLDeviceVk.h> | ||
|
||
namespace rx | ||
{ | ||
// 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); | ||
|
||
} // namespace rx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters