rusticl: Use the new spirv_capabilities struct

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Iván Briano <ivan.briano@intel.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28905>
This commit is contained in:
Faith Ekstrand
2024-04-24 10:37:36 -05:00
committed by Marge Bot
parent 30f209c017
commit ba11b12a82
2 changed files with 30 additions and 21 deletions

View File

@@ -299,10 +299,32 @@ impl SPIRVBin {
}
}
fn get_spirv_capabilities() -> spirv_capabilities {
spirv_capabilities {
Addresses: true,
Float16: true,
Float64: true,
GenericPointer: true,
Groups: true,
GroupNonUniformShuffle: true,
GroupNonUniformShuffleRelative: true,
Int8: true,
Int16: true,
Int64: true,
Kernel: true,
ImageBasic: true,
ImageReadWrite: true,
Linkage: true,
LiteralSampler: true,
..Default::default()
}
}
fn get_spirv_options(
library: bool,
clc_shader: *const nir_shader,
address_bits: u32,
caps: &spirv_capabilities,
log: Option<&mut Vec<String>>,
) -> spirv_to_nir_options {
let global_addr_format;
@@ -329,25 +351,7 @@ impl SPIRVBin {
as u32,
printf: true,
caps: spirv_supported_capabilities {
address: true,
float16: true,
float64: true,
generic_pointers: true,
groups: true,
subgroup_shuffle: true,
int8: true,
int16: true,
int64: true,
kernel: true,
kernel_image: true,
kernel_image_read_write: true,
linkage: true,
literal_sampler: true,
..Default::default()
},
capabilities: caps,
constant_addr_format: global_addr_format,
global_addr_format: global_addr_format,
shared_addr_format: offset_addr_format,
@@ -368,7 +372,9 @@ impl SPIRVBin {
log: Option<&mut Vec<String>>,
) -> Option<NirShader> {
let c_entry = CString::new(entry_point.as_bytes()).unwrap();
let spirv_options = Self::get_spirv_options(false, libclc.get_nir(), address_bits, log);
let spirv_caps = Self::get_spirv_capabilities();
let spirv_options =
Self::get_spirv_options(false, libclc.get_nir(), address_bits, &spirv_caps, log);
let nir = unsafe {
spirv_to_nir(
@@ -389,7 +395,9 @@ impl SPIRVBin {
pub fn get_lib_clc(screen: &PipeScreen) -> Option<NirShader> {
let nir_options = screen.nir_shader_compiler_options(pipe_shader_type::PIPE_SHADER_COMPUTE);
let address_bits = screen.compute_param(pipe_compute_cap::PIPE_COMPUTE_CAP_ADDRESS_BITS);
let spirv_options = Self::get_spirv_options(true, ptr::null(), address_bits, None);
let spirv_caps = Self::get_spirv_capabilities();
let spirv_options =
Self::get_spirv_options(false, ptr::null(), address_bits, &spirv_caps, None);
let shader_cache = DiskCacheBorrowed::as_ptr(&screen.shader_cache());
NirShader::new(unsafe {

View File

@@ -8,6 +8,7 @@
#include "glsl_types.h"
#include "nir_serialize.h"
#include "spirv/nir_spirv.h"
#include "spirv/spirv_info.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"