Fix compute fuzzing
This commit is contained in:
@@ -12,15 +12,17 @@ pub(crate) fn compile_gradient_function(
|
||||
types: SpirVTypes,
|
||||
function_id: Option<spirv::Word>,
|
||||
) {
|
||||
let gradient_fn_type = b.type_function(types.vec4, vec![types.vec4p]);
|
||||
let jit_string = b.string("Gradient JIT");
|
||||
let _scene = b
|
||||
.begin_function(
|
||||
types.float,
|
||||
types.vec4,
|
||||
function_id,
|
||||
//spirv::FunctionControl::DONT_INLINE
|
||||
spirv::FunctionControl::INLINE
|
||||
| spirv::FunctionControl::PURE
|
||||
| spirv::FunctionControl::CONST,
|
||||
types.gradient_fn_type,
|
||||
gradient_fn_type,
|
||||
)
|
||||
.unwrap();
|
||||
let pos_p = b.function_parameter(types.vec4p).unwrap();
|
||||
@@ -35,7 +37,7 @@ pub(crate) fn compile_gradient_function(
|
||||
use SSAOpcode::*;
|
||||
use rspirv::dr::Operand::IdRef;
|
||||
|
||||
b.line(types.jit_string, line as u32, 0);
|
||||
b.line(jit_string, line as u32, 0);
|
||||
|
||||
fn input_resolve(
|
||||
float: u32,
|
||||
|
||||
@@ -13,6 +13,8 @@ pub(crate) fn compile_interval_function(
|
||||
types: SpirVTypes,
|
||||
function_id: Option<spirv::Word>,
|
||||
) {
|
||||
let interval_fn_type = b.type_function(types.vec2, vec![types.vec4p, types.vec4p]);
|
||||
let jit_string = b.string("Interval JIT");
|
||||
let _scene = b
|
||||
.begin_function(
|
||||
types.vec2,
|
||||
@@ -21,7 +23,7 @@ pub(crate) fn compile_interval_function(
|
||||
spirv::FunctionControl::INLINE
|
||||
| spirv::FunctionControl::PURE
|
||||
| spirv::FunctionControl::CONST,
|
||||
types.interval_fn_type,
|
||||
interval_fn_type,
|
||||
)
|
||||
.unwrap();
|
||||
let pos_low = b.function_parameter(types.vec4p).unwrap();
|
||||
@@ -38,7 +40,7 @@ pub(crate) fn compile_interval_function(
|
||||
use SSAOpcode::*;
|
||||
use rspirv::dr::Operand::IdRef;
|
||||
|
||||
b.line(types.jit_string, line as u32, 0);
|
||||
b.line(jit_string, line as u32, 0);
|
||||
|
||||
fn input_resolve(
|
||||
float: u32,
|
||||
|
||||
@@ -4,17 +4,13 @@ pub(crate) mod point;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub(crate) struct SpirVTypes {
|
||||
pub glsl: u32,
|
||||
pub void: u32,
|
||||
pub float: u32,
|
||||
pub bool: u32,
|
||||
pub choice: u32,
|
||||
pub vec2: u32,
|
||||
pub vec3: u32,
|
||||
pub vec4: u32,
|
||||
pub vec4p: u32,
|
||||
pub point_fn_type: u32,
|
||||
pub interval_fn_type: u32,
|
||||
pub gradient_fn_type: u32,
|
||||
pub jit_string: u32,
|
||||
pub glsl: u32,
|
||||
pub void: u32,
|
||||
pub float: u32,
|
||||
pub bool: u32,
|
||||
pub choice: u32,
|
||||
pub vec2: u32,
|
||||
pub vec3: u32,
|
||||
pub vec4: u32,
|
||||
pub vec4p: u32,
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ pub(crate) fn compile_point_function(
|
||||
types: SpirVTypes,
|
||||
function_id: Option<spirv::Word>,
|
||||
) {
|
||||
let point_fn_type = b.type_function(types.float, vec![types.vec4p]);
|
||||
let jit_string = b.string("Point JIT");
|
||||
let _scene = b
|
||||
.begin_function(
|
||||
types.float,
|
||||
@@ -20,7 +22,7 @@ pub(crate) fn compile_point_function(
|
||||
spirv::FunctionControl::INLINE
|
||||
| spirv::FunctionControl::PURE
|
||||
| spirv::FunctionControl::CONST,
|
||||
types.point_fn_type,
|
||||
point_fn_type,
|
||||
)
|
||||
.unwrap();
|
||||
let pos_p = b.function_parameter(types.vec4p).unwrap();
|
||||
@@ -35,7 +37,7 @@ pub(crate) fn compile_point_function(
|
||||
use SSAOpcode::*;
|
||||
use rspirv::dr::Operand::IdRef;
|
||||
|
||||
b.line(types.jit_string, line as u32, 0);
|
||||
b.line(jit_string, line as u32, 0);
|
||||
|
||||
fn input_resolve(
|
||||
float: u32,
|
||||
|
||||
+2
-10
@@ -467,7 +467,7 @@ impl SSATape {
|
||||
b
|
||||
};
|
||||
let glsl = if with_module {
|
||||
1
|
||||
4
|
||||
} else {
|
||||
b.ext_inst_import("GLSL.std.450")
|
||||
};
|
||||
@@ -480,10 +480,6 @@ impl SSATape {
|
||||
let vec3 = b.type_vector(float, 3);
|
||||
let vec4 = b.type_vector(float, 4);
|
||||
let vec4p = b.type_pointer(None, spirv::StorageClass::Function, vec4);
|
||||
let point_fn_type = b.type_function(float, vec![vec4p]);
|
||||
let interval_fn_type = b.type_function(vec2, vec![vec4p, vec4p]);
|
||||
let gradient_fn_type = b.type_function(vec4, vec![vec4p]);
|
||||
let jit_string = b.string("JIT");
|
||||
|
||||
const POINT_FN_LOC: u32 = 10000;
|
||||
const INTERVAL_FN_LOC: u32 = 20000;
|
||||
@@ -499,10 +495,6 @@ impl SSATape {
|
||||
vec3,
|
||||
vec4,
|
||||
vec4p,
|
||||
point_fn_type,
|
||||
interval_fn_type,
|
||||
gradient_fn_type,
|
||||
jit_string,
|
||||
};
|
||||
|
||||
// Manually fix the header bounds
|
||||
@@ -561,7 +553,7 @@ impl SSATape {
|
||||
if DUMP_SPV_DIS_TO_FILE {
|
||||
std::fs::write(
|
||||
format!(
|
||||
"{}.spv-dis",
|
||||
"spv-dis/{}.spv-dis",
|
||||
humantime::format_rfc3339(std::time::SystemTime::now())
|
||||
),
|
||||
module.disassemble(),
|
||||
|
||||
Reference in New Issue
Block a user