mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 06:40:11 +01:00
clc: allow passing custom validator options
Signed-off-by: Karol Herbst <git@karolherbst.de> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23700>
This commit is contained in:
parent
8f7da6f052
commit
99a480ba9b
4 changed files with 18 additions and 4 deletions
|
|
@ -81,6 +81,10 @@ struct clc_compile_args {
|
|||
unsigned address_bits;
|
||||
};
|
||||
|
||||
struct clc_validator_options {
|
||||
uint32_t limit_max_function_arg;
|
||||
};
|
||||
|
||||
struct clc_binary {
|
||||
void *data;
|
||||
size_t size;
|
||||
|
|
|
|||
|
|
@ -1162,13 +1162,22 @@ clc_link_spirv_binaries(const struct clc_linker_args *args,
|
|||
|
||||
bool
|
||||
clc_validate_spirv(const struct clc_binary *spirv,
|
||||
const struct clc_logger *logger)
|
||||
const struct clc_logger *logger,
|
||||
const struct clc_validator_options *options)
|
||||
{
|
||||
SPIRVMessageConsumer msgconsumer(logger);
|
||||
spvtools::SpirvTools tools(spirv_target);
|
||||
tools.SetMessageConsumer(msgconsumer);
|
||||
spvtools::ValidatorOptions spirv_options;
|
||||
const uint32_t *data = static_cast<const uint32_t *>(spirv->data);
|
||||
return tools.Validate(data, spirv->size / 4);
|
||||
|
||||
if (options) {
|
||||
spirv_options.SetUniversalLimit(
|
||||
spv_validator_limit_max_function_args,
|
||||
options->limit_max_function_arg);
|
||||
}
|
||||
|
||||
return tools.Validate(data, spirv->size / 4, spirv_options);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -75,7 +75,8 @@ clc_link_spirv_binaries(const struct clc_linker_args *args,
|
|||
|
||||
bool
|
||||
clc_validate_spirv(const struct clc_binary *spirv,
|
||||
const struct clc_logger *logger);
|
||||
const struct clc_logger *logger,
|
||||
const struct clc_validator_options *options);
|
||||
|
||||
int
|
||||
clc_spirv_specialize(const struct clc_binary *in_spirv,
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ impl SPIRVBin {
|
|||
pub fn clone_on_validate(&self) -> (Option<Self>, String) {
|
||||
let mut msgs: Vec<String> = Vec::new();
|
||||
let logger = create_clc_logger(&mut msgs);
|
||||
let res = unsafe { clc_validate_spirv(&self.spirv, &logger) };
|
||||
let res = unsafe { clc_validate_spirv(&self.spirv, &logger, ptr::null()) };
|
||||
|
||||
(res.then(|| self.clone()), msgs.join("\n"))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue