rusticl: explicitly state supported SPIR-V extensions
We'll need to be explicit about supported extensions. Signed-off-by: Karol Herbst <git@karolherbst.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23031>
This commit is contained in:
@@ -22,6 +22,7 @@ use std::cmp::min;
|
||||
use std::collections::HashMap;
|
||||
use std::convert::TryInto;
|
||||
use std::env;
|
||||
use std::ffi::CString;
|
||||
use std::os::raw::*;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
@@ -37,6 +38,7 @@ pub struct Device {
|
||||
pub embedded: bool,
|
||||
pub extension_string: String,
|
||||
pub extensions: Vec<cl_name_version>,
|
||||
pub spirv_extensions: Vec<CString>,
|
||||
pub clc_features: Vec<cl_name_version>,
|
||||
pub formats: HashMap<cl_image_format, HashMap<cl_mem_object_type, cl_mem_flags>>,
|
||||
pub lib_clc: NirShader,
|
||||
@@ -194,6 +196,7 @@ impl Device {
|
||||
embedded: false,
|
||||
extension_string: String::from(""),
|
||||
extensions: Vec::new(),
|
||||
spirv_extensions: Vec::new(),
|
||||
clc_features: Vec::new(),
|
||||
formats: HashMap::new(),
|
||||
lib_clc: lib_clc?,
|
||||
@@ -474,6 +477,7 @@ impl Device {
|
||||
let mut exts_str: Vec<String> = Vec::new();
|
||||
let mut exts = PLATFORM_EXTENSIONS.to_vec();
|
||||
let mut feats = Vec::new();
|
||||
let mut spirv_exts = Vec::new();
|
||||
let mut add_ext = |major, minor, patch, ext: &str| {
|
||||
exts.push(mk_cl_version_ext(major, minor, patch, ext));
|
||||
exts_str.push(ext.to_owned());
|
||||
@@ -481,12 +485,16 @@ impl Device {
|
||||
let mut add_feat = |major, minor, patch, feat: &str| {
|
||||
feats.push(mk_cl_version_ext(major, minor, patch, feat));
|
||||
};
|
||||
let mut add_spirv = |ext: &str| {
|
||||
spirv_exts.push(CString::new(ext).unwrap());
|
||||
};
|
||||
|
||||
// add extensions all drivers support for now
|
||||
add_ext(1, 0, 0, "cl_khr_global_int32_base_atomics");
|
||||
add_ext(1, 0, 0, "cl_khr_global_int32_extended_atomics");
|
||||
add_ext(1, 0, 0, "cl_khr_local_int32_base_atomics");
|
||||
add_ext(1, 0, 0, "cl_khr_local_int32_extended_atomics");
|
||||
add_spirv("SPV_KHR_float_controls");
|
||||
|
||||
if self.doubles_supported() {
|
||||
add_ext(1, 0, 0, "cl_khr_fp64");
|
||||
@@ -529,6 +537,7 @@ impl Device {
|
||||
self.extensions = exts;
|
||||
self.clc_features = feats;
|
||||
self.extension_string = format!("{} {}", PLATFORM_EXTENSION_STR, exts_str.join(" "));
|
||||
self.spirv_extensions = spirv_exts;
|
||||
}
|
||||
|
||||
fn shader_param(&self, cap: pipe_shader_cap) -> i32 {
|
||||
|
||||
@@ -564,6 +564,7 @@ impl Program {
|
||||
headers,
|
||||
get_disk_cache(),
|
||||
dev.cl_features(),
|
||||
&dev.spirv_extensions,
|
||||
dev.address_bits(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -70,11 +70,15 @@ impl SPIRVBin {
|
||||
headers: &[CLCHeader],
|
||||
cache: &Option<DiskCache>,
|
||||
features: clc_optional_features,
|
||||
spirv_extensions: &[CString],
|
||||
address_bits: u32,
|
||||
) -> (Option<Self>, String) {
|
||||
let mut hash_key = None;
|
||||
let has_includes = args.iter().any(|a| a.as_bytes()[0..2] == *b"-I");
|
||||
|
||||
let mut spirv_extensions: Vec<_> = spirv_extensions.iter().map(|s| s.as_ptr()).collect();
|
||||
spirv_extensions.push(ptr::null());
|
||||
|
||||
if let Some(cache) = cache {
|
||||
if !has_includes {
|
||||
let mut key = Vec::new();
|
||||
@@ -117,7 +121,7 @@ impl SPIRVBin {
|
||||
num_args: c_args.len() as u32,
|
||||
spirv_version: clc_spirv_version::CLC_SPIRV_VERSION_MAX,
|
||||
features: features,
|
||||
allowed_spirv_extensions: ptr::null(),
|
||||
allowed_spirv_extensions: spirv_extensions.as_ptr(),
|
||||
address_bits: address_bits,
|
||||
};
|
||||
let mut msgs: Vec<String> = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user