Fix tests

This commit is contained in:
luboslenco
2025-02-27 20:24:59 +01:00
parent 2e0faea6c0
commit 88b1016065
9 changed files with 53 additions and 30 deletions
+4 -4
View File
@@ -397,7 +397,7 @@ int krafix_compile(const char *source, char *output, int *length, const char *ta
extern kinc_g5_command_list_t commandList;
static kinc_g5_constant_buffer_t constant_buffer;
static kinc_g5_render_target_t *render_target;
static kinc_g5_raytrace_pipeline_t pipeline;
static kinc_g5_raytrace_pipeline_t rt_pipeline;
static kinc_g5_raytrace_acceleration_structure_t accel;
static bool raytrace_created = false;
static bool raytrace_accel_created = false;
@@ -2686,11 +2686,11 @@ bool iron_raytrace_supported() {
void iron_raytrace_init(buffer_t *shader) {
if (raytrace_created) {
kinc_g5_constant_buffer_destroy(&constant_buffer);
kinc_g5_raytrace_pipeline_destroy(&pipeline);
kinc_g5_raytrace_pipeline_destroy(&rt_pipeline);
}
raytrace_created = true;
kinc_g5_constant_buffer_init(&constant_buffer, constant_buffer_size * 4);
kinc_g5_raytrace_pipeline_init(&pipeline, &commandList, shader->buffer, (int)shader->length, &constant_buffer);
kinc_g5_raytrace_pipeline_init(&rt_pipeline, &commandList, shader->buffer, (int)shader->length, &constant_buffer);
}
void iron_raytrace_as_init() {
@@ -2820,7 +2820,7 @@ void iron_raytrace_dispatch_rays(kinc_g5_render_target_t *render_target, buffer_
kinc_g5_constant_buffer_unlock(&constant_buffer);
kinc_g5_raytrace_set_acceleration_structure(&accel);
kinc_g5_raytrace_set_pipeline(&pipeline);
kinc_g5_raytrace_set_pipeline(&rt_pipeline);
kinc_g5_raytrace_set_target(render_target);
kinc_g5_raytrace_dispatch_rays(&commandList);
}
+1 -1
View File
@@ -228,7 +228,7 @@ declare function iron_g4_create_fragment_shader_from_source(source: string): any
declare function iron_g4_delete_shader(shader: any): void;
declare function iron_g4_create_pipeline(): any;
declare function iron_g4_delete_pipeline(pipeline: any): void;
declare function iron_g4_compile_pipeline(pipeline: any, structure0: any, structure1: any, structure2: any, structure3: any, length: i32, vertex_shader: any, fragment_shader: any, state: any): void;
declare function iron_g4_compile_pipeline(pipeline: any, structure0: any, vertex_shader: any, fragment_shader: any, state: any): void;
declare function iron_g4_set_pipeline(pipeline: any): void;
declare function iron_load_image(file: string, readable: bool): any;
declare function iron_unload_image(image: image_t): void;
+13
View File
@@ -0,0 +1,13 @@
let project = new Project("plugins");
project.add_cfiles("plugin_api.c");
project.add_cfiles("plugins.c");
if (flags.physics) {
project.add_cfiles("phys_jolt/phys_jolt.cpp");
project.add_cfiles("phys_jolt/Jolt/**");
project.add_include_dir("phys_jolt");
project.add_define("JPH_NO_DEBUG");
}
return project;
Binary file not shown.
+3 -1
View File
@@ -1,12 +1,14 @@
let flags = globalThis.flags;
flags.with_iron = true;
flags.lite = true;
let project = new Project("Test");
project.add_project("../../../");
project.add_tsfiles("sources");
project.add_tsfiles("../../../sources/ts/iron");
project.add_shaders("../../../shaders/draw/*.glsl");
project.add_shaders("shaders/*.glsl");
project.add_shaders("../../../shaders/*.glsl");
project.add_assets("assets/*", { destination: "data/{name}" });
return project;
+15 -24
View File
@@ -2,26 +2,6 @@
// Red triangle test
// ../../../make --graphics vulkan --run
let vs: string = "#version 330\n\
in vec3 pos; \
void main() { \
gl_Position = vec4(pos, 1.0); \
} \
";
let fs: string = "#version 330\n\
out vec4 frag_color; \
void main() { \
frag_color = vec4(1.0, 0.0, 0.0, 1.0); \
} \
";
let vertices: f32[] = [
-1.0, -1.0, 0.0,
1.0, -1.0, 0.0,
0.0, 1.0, 0.0
];
let indices: i32[] = [0, 1, 2];
let pipeline: any;
let vb: any;
let ib: any;
@@ -54,8 +34,12 @@ function main() {
let elems: kinc_vertex_elem_t[] = [elem];
let structure0: vertex_struct_t = { elements: elems };
let vert: any = iron_g4_create_vertex_shader_from_source(vs);
let frag: any = iron_g4_create_fragment_shader_from_source(fs);
let vs_buffer: buffer_t = iron_load_blob("./data/test.vert.spirv");
let fs_buffer: buffer_t = iron_load_blob("./data/test.frag.spirv");
let vert: any = iron_g4_create_shader(vs_buffer, shader_type_t.VERTEX);
let frag: any = iron_g4_create_shader(fs_buffer, shader_type_t.FRAGMENT);
let masks: bool[] = [true, true, true, true, true, true, true, true];
let attachments: i32[] = [0];
@@ -77,9 +61,16 @@ function main() {
depth_attachment_bits: 0
};
iron_g4_compile_pipeline(pipeline, structure0, null, null, null, 1, vert, frag, null, state);
iron_g4_compile_pipeline(pipeline, structure0, vert, frag, state);
vb = iron_g4_create_vertex_buffer(vertices.length / 3, structure0.elements, 0, 0);
let vertices: f32[] = [
-1.0, -1.0, 0.0,
1.0, -1.0, 0.0,
0.0, 1.0, 0.0
];
let indices: i32[] = [0, 1, 2];
vb = iron_g4_create_vertex_buffer(vertices.length / 3, structure0.elements, 0);
let vb_data: buffer_t = iron_g4_lock_vertex_buffer(vb);
for (let i: i32 = 0; i < vertices.length; i++) {
buffer_set_f32(vb_data, i * 4, vertices[i]);
+3
View File
@@ -1,8 +1,11 @@
let flags = globalThis.flags;
flags.with_iron = true;
flags.lite = true;
let project = new Project("Test");
project.add_project("../../../");
project.add_tsfiles("./");
project.add_tsfiles("../../../sources/ts/iron");
project.add_shaders("./*.glsl");
return project;
+7
View File
@@ -0,0 +1,7 @@
#version 450
out vec4 frag_color;
void main() {
frag_color = vec4(1.0, 0.0, 0.0, 1.0);
}
+7
View File
@@ -0,0 +1,7 @@
#version 450
in vec3 pos;
void main() {
gl_Position = vec4(pos, 1.0);
}