From 135dc4dcc5be6e8d249c6a27c47eb1e05879ab67 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Sun, 9 Feb 2025 22:07:08 +0100 Subject: [PATCH] Cleanup --- .../kinc/backend/graphics5/pipeline.c.h | 18 ---------------- .../kinc/backend/graphics5/shader.c.h | 20 ------------------ .../kinc/backend/graphics4/pipeline.c.h | 4 ---- armorcore/sources/iron.h | 5 +---- armorcore/sources/kinc/graphics4/pipeline.c.h | 3 --- armorcore/sources/kinc/graphics4/pipeline.h | 3 --- armorcore/sources/kinc/graphics4/shader.h | 3 --- armorcore/sources/kinc/graphics5/pipeline.c.h | 3 --- armorcore/sources/kinc/graphics5/pipeline.h | 3 --- armorcore/sources/kinc/graphics5/shader.h | 3 --- armorcore/sources/ts/g4.ts | 5 +---- armorcore/sources/ts/iron.ts | 2 +- armorcore/sources/ts/scene.ts | 1 - armorcore/sources/ts/shader_data.ts | 10 --------- armorcore/sources/ts/sys.ts | 5 +++-- base/assets/Scene.arm | Bin 179394 -> 179310 bytes base/assets/shader_datas.arm | Bin 24430 -> 23842 bytes base/sources/util_clone.ts | 1 - 18 files changed, 6 insertions(+), 83 deletions(-) diff --git a/armorcore/sources/backends/direct3d12/kinc/backend/graphics5/pipeline.c.h b/armorcore/sources/backends/direct3d12/kinc/backend/graphics5/pipeline.c.h index 2cd81b97..6058a3e0 100644 --- a/armorcore/sources/backends/direct3d12/kinc/backend/graphics5/pipeline.c.h +++ b/armorcore/sources/backends/direct3d12/kinc/backend/graphics5/pipeline.c.h @@ -157,24 +157,6 @@ kinc_g5_constant_location_t kinc_g5_pipeline_get_constant_location(struct kinc_g location.impl.computeOffset = 0; location.impl.computeSize = 0; - { - ShaderConstant constant = findConstant(pipe->geometryShader, name); - location.impl.geometryOffset = constant.offset; - location.impl.geometrySize = constant.size; - } - - { - ShaderConstant constant = findConstant(pipe->tessellationControlShader, name); - location.impl.tessControlOffset = constant.offset; - location.impl.tessControlSize = constant.size; - } - - { - ShaderConstant constant = findConstant(pipe->tessellationEvaluationShader, name); - location.impl.tessEvalOffset = constant.offset; - location.impl.tessEvalSize = constant.size; - } - return location; } diff --git a/armorcore/sources/backends/direct3d12/kinc/backend/graphics5/shader.c.h b/armorcore/sources/backends/direct3d12/kinc/backend/graphics5/shader.c.h index d5856141..f2bb3eca 100644 --- a/armorcore/sources/backends/direct3d12/kinc/backend/graphics5/shader.c.h +++ b/armorcore/sources/backends/direct3d12/kinc/backend/graphics5/shader.c.h @@ -60,26 +60,6 @@ void kinc_g5_shader_init(kinc_g5_shader_t *shader, const void *_data, size_t len shader->impl.length = (int)length - index; shader->impl.data = (uint8_t *)malloc(shader->impl.length); memcpy(shader->impl.data, &data[index], shader->impl.length); - - switch (type) { - case KINC_G5_SHADER_TYPE_VERTEX: - // Microsoft::affirm(device->CreateVertexShader(this->data, this->length, nullptr, (ID3D11VertexShader**)&shader)); - break; - case KINC_G5_SHADER_TYPE_FRAGMENT: - // Microsoft::affirm(device->CreatePixelShader(this->data, this->length, nullptr, (ID3D11PixelShader**)&shader)); - break; - case KINC_G5_SHADER_TYPE_GEOMETRY: - // Microsoft::affirm(device->CreateGeometryShader(this->data, this->length, nullptr, (ID3D11GeometryShader**)&shader)); - break; - case KINC_G5_SHADER_TYPE_TESSELLATION_CONTROL: - // Microsoft::affirm(device->CreateHullShader(this->data, this->length, nullptr, (ID3D11HullShader**)&shader)); - break; - case KINC_G5_SHADER_TYPE_TESSELLATION_EVALUATION: - // Microsoft::affirm(device->CreateDomainShader(this->data, this->length, nullptr, (ID3D11DomainShader**)&shader)); - break; - default: - break; - } } void kinc_g5_shader_destroy(kinc_g5_shader_t *shader) { diff --git a/armorcore/sources/backends/g4ong5/kinc/backend/graphics4/pipeline.c.h b/armorcore/sources/backends/g4ong5/kinc/backend/graphics4/pipeline.c.h index 32c79fa5..19c356cc 100644 --- a/armorcore/sources/backends/g4ong5/kinc/backend/graphics4/pipeline.c.h +++ b/armorcore/sources/backends/g4ong5/kinc/backend/graphics4/pipeline.c.h @@ -35,10 +35,6 @@ void kinc_g4_pipeline_compile(kinc_g4_pipeline_t *pipe) { } pipe->impl._pipeline.vertexShader = &pipe->vertex_shader->impl._shader; pipe->impl._pipeline.fragmentShader = &pipe->fragment_shader->impl._shader; - pipe->impl._pipeline.geometryShader = pipe->geometry_shader != NULL ? &pipe->geometry_shader->impl._shader : NULL; - pipe->impl._pipeline.tessellationControlShader = pipe->tessellation_control_shader != NULL ? &pipe->tessellation_control_shader->impl._shader : NULL; - pipe->impl._pipeline.tessellationEvaluationShader = - pipe->tessellation_evaluation_shader != NULL ? &pipe->tessellation_evaluation_shader->impl._shader : NULL; pipe->impl._pipeline.blend_source = (kinc_g5_blending_factor_t)pipe->blend_source; pipe->impl._pipeline.blend_destination = (kinc_g5_blending_factor_t)pipe->blend_destination; pipe->impl._pipeline.blend_operation = (kinc_g5_blending_operation_t)pipe->blend_operation; diff --git a/armorcore/sources/iron.h b/armorcore/sources/iron.h index 5ab67c3a..3daa1aa3 100644 --- a/armorcore/sources/iron.h +++ b/armorcore/sources/iron.h @@ -1427,7 +1427,7 @@ typedef struct iron_pipeline_state { int depth_attachment_bits; } iron_pipeline_state_t; -void iron_g4_compile_pipeline(kinc_g4_pipeline_t *pipeline, vertex_struct_t *structure0, vertex_struct_t *structure1, vertex_struct_t *structure2, vertex_struct_t *structure3, i32 length, kinc_g4_shader_t *vertex_shader, kinc_g4_shader_t *fragment_shader, kinc_g4_shader_t *geometry_shader, iron_pipeline_state_t *state) { +void iron_g4_compile_pipeline(kinc_g4_pipeline_t *pipeline, vertex_struct_t *structure0, vertex_struct_t *structure1, vertex_struct_t *structure2, vertex_struct_t *structure3, i32 length, kinc_g4_shader_t *vertex_shader, kinc_g4_shader_t *fragment_shader, iron_pipeline_state_t *state) { kinc_g4_vertex_structure_t s0, s1, s2, s3; kinc_g4_vertex_structure_init(&s0); kinc_g4_vertex_structure_init(&s1); @@ -1450,9 +1450,6 @@ void iron_g4_compile_pipeline(kinc_g4_pipeline_t *pipeline, vertex_struct_t *str pipeline->vertex_shader = vertex_shader; pipeline->fragment_shader = fragment_shader; - if (geometry_shader != null) { - pipeline->geometry_shader = geometry_shader; - } for (int i = 0; i < length; ++i) { pipeline->input_layout[i] = structures[i]; } diff --git a/armorcore/sources/kinc/graphics4/pipeline.c.h b/armorcore/sources/kinc/graphics4/pipeline.c.h index 3a7dad3c..bde9af66 100644 --- a/armorcore/sources/kinc/graphics4/pipeline.c.h +++ b/armorcore/sources/kinc/graphics4/pipeline.c.h @@ -8,9 +8,6 @@ void kinc_g4_internal_pipeline_set_defaults(kinc_g4_pipeline_t *state) { } state->vertex_shader = NULL; state->fragment_shader = NULL; - state->geometry_shader = NULL; - state->tessellation_control_shader = NULL; - state->tessellation_evaluation_shader = NULL; state->cull_mode = KINC_G4_CULL_NOTHING; diff --git a/armorcore/sources/kinc/graphics4/pipeline.h b/armorcore/sources/kinc/graphics4/pipeline.h index bf140415..b0e7b199 100644 --- a/armorcore/sources/kinc/graphics4/pipeline.h +++ b/armorcore/sources/kinc/graphics4/pipeline.h @@ -55,9 +55,6 @@ typedef struct kinc_g4_pipeline { struct kinc_g4_vertex_structure *input_layout[16]; struct kinc_g4_shader *vertex_shader; struct kinc_g4_shader *fragment_shader; - struct kinc_g4_shader *geometry_shader; - struct kinc_g4_shader *tessellation_control_shader; - struct kinc_g4_shader *tessellation_evaluation_shader; kinc_g4_cull_mode_t cull_mode; diff --git a/armorcore/sources/kinc/graphics4/shader.h b/armorcore/sources/kinc/graphics4/shader.h index 5388beb8..3120c51d 100644 --- a/armorcore/sources/kinc/graphics4/shader.h +++ b/armorcore/sources/kinc/graphics4/shader.h @@ -12,9 +12,6 @@ typedef enum kinc_g4_shader_type { KINC_G4_SHADER_TYPE_FRAGMENT, KINC_G4_SHADER_TYPE_VERTEX, KINC_G4_SHADER_TYPE_COMPUTE, - KINC_G4_SHADER_TYPE_GEOMETRY, - KINC_G4_SHADER_TYPE_TESSELLATION_CONTROL, - KINC_G4_SHADER_TYPE_TESSELLATION_EVALUATION, KINC_G4_SHADER_TYPE_COUNT } kinc_g4_shader_type_t; diff --git a/armorcore/sources/kinc/graphics5/pipeline.c.h b/armorcore/sources/kinc/graphics5/pipeline.c.h index 00c6dd3e..2f6244bb 100644 --- a/armorcore/sources/kinc/graphics5/pipeline.c.h +++ b/armorcore/sources/kinc/graphics5/pipeline.c.h @@ -6,9 +6,6 @@ void kinc_g5_internal_pipeline_init(kinc_g5_pipeline_t *pipe) { } pipe->vertexShader = NULL; pipe->fragmentShader = NULL; - pipe->geometryShader = NULL; - pipe->tessellationControlShader = NULL; - pipe->tessellationEvaluationShader = NULL; pipe->cullMode = KINC_G5_CULL_MODE_NEVER; diff --git a/armorcore/sources/kinc/graphics5/pipeline.h b/armorcore/sources/kinc/graphics5/pipeline.h index bdeb83d1..b2699995 100644 --- a/armorcore/sources/kinc/graphics5/pipeline.h +++ b/armorcore/sources/kinc/graphics5/pipeline.h @@ -57,9 +57,6 @@ typedef struct kinc_g5_pipeline { kinc_g5_vertex_structure_t *inputLayout[16]; struct kinc_g5_shader *vertexShader; struct kinc_g5_shader *fragmentShader; - struct kinc_g5_shader *geometryShader; - struct kinc_g5_shader *tessellationControlShader; - struct kinc_g5_shader *tessellationEvaluationShader; kinc_g5_cull_mode_t cullMode; diff --git a/armorcore/sources/kinc/graphics5/shader.h b/armorcore/sources/kinc/graphics5/shader.h index 72debeff..21f11b8a 100644 --- a/armorcore/sources/kinc/graphics5/shader.h +++ b/armorcore/sources/kinc/graphics5/shader.h @@ -14,9 +14,6 @@ typedef enum kinc_g5_shader_type { KINC_G5_SHADER_TYPE_FRAGMENT, KINC_G5_SHADER_TYPE_VERTEX, KINC_G5_SHADER_TYPE_COMPUTE, - KINC_G5_SHADER_TYPE_GEOMETRY, - KINC_G5_SHADER_TYPE_TESSELLATION_CONTROL, - KINC_G5_SHADER_TYPE_TESSELLATION_EVALUATION, KINC_G5_SHADER_TYPE_COUNT } kinc_g5_shader_type_t; diff --git a/armorcore/sources/ts/g4.ts b/armorcore/sources/ts/g4.ts index daf6c182..c9273ec5 100644 --- a/armorcore/sources/ts/g4.ts +++ b/armorcore/sources/ts/g4.ts @@ -83,7 +83,6 @@ function g4_pipeline_compile(raw: pipeline_t) { let structure1: vertex_struct_t = raw.input_layout.length > 1 ? raw.input_layout[1] : null; let structure2: vertex_struct_t = raw.input_layout.length > 2 ? raw.input_layout[2] : null; let structure3: vertex_struct_t = raw.input_layout.length > 3 ? raw.input_layout[3] : null; - let gs: any = raw.geometry_shader != null ? raw.geometry_shader.shader_ : null; for (let i: i32 = raw.color_write_masks_red.length; i < 8; ++i) { array_push(raw.color_write_masks_red, true); @@ -114,7 +113,7 @@ function g4_pipeline_compile(raw: pipeline_t) { state.color_attachments = raw.color_attachments; state.depth_attachment_bits = g4_pipeline_get_depth_buffer_bits(raw.depth_attachment); - iron_g4_compile_pipeline(raw.pipeline_, structure0, structure1, structure2, structure3, raw.input_layout.length, raw.vertex_shader.shader_, raw.fragment_shader.shader_, gs, state); + iron_g4_compile_pipeline(raw.pipeline_, structure0, structure1, structure2, structure3, raw.input_layout.length, raw.vertex_shader.shader_, raw.fragment_shader.shader_, state); } function g4_pipeline_set(raw: pipeline_t) { @@ -515,7 +514,6 @@ type pipeline_t = { input_layout?: vertex_struct_t[]; vertex_shader?: shader_t; fragment_shader?: shader_t; - geometry_shader?: shader_t; cull_mode?: cull_mode_t; depth_write?: bool; depth_mode?: compare_mode_t; @@ -669,5 +667,4 @@ enum cull_mode_t { enum shader_type_t { FRAGMENT = 0, VERTEX = 1, - GEOMETRY = 3, } diff --git a/armorcore/sources/ts/iron.ts b/armorcore/sources/ts/iron.ts index 13b19523..32f02273 100644 --- a/armorcore/sources/ts/iron.ts +++ b/armorcore/sources/ts/iron.ts @@ -230,7 +230,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, geometry_shader: any, state: 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_set_pipeline(pipeline: any): void; declare function iron_load_image(file: string, readable: bool): any; declare function iron_unload_image(image: image_t): void; diff --git a/armorcore/sources/ts/scene.ts b/armorcore/sources/ts/scene.ts index 6b348dc3..8c0b732a 100644 --- a/armorcore/sources/ts/scene.ts +++ b/armorcore/sources/ts/scene.ts @@ -634,7 +634,6 @@ type shader_context_t = { cull_mode?: string; vertex_shader?: string; fragment_shader?: string; - geometry_shader?: string; shader_from_source?: bool; // Build shader at runtime using from_source() blend_source?: string; blend_destination?: string; diff --git a/armorcore/sources/ts/shader_data.ts b/armorcore/sources/ts/shader_data.ts index 206f63f0..2361eea1 100644 --- a/armorcore/sources/ts/shader_data.ts +++ b/armorcore/sources/ts/shader_data.ts @@ -159,9 +159,6 @@ function shader_context_compile(raw: shader_context_t): shader_context_t { ///if arm_embed raw._.pipe_state.fragment_shader = sys_get_shader(raw.fragment_shader); raw._.pipe_state.vertex_shader = sys_get_shader(raw.vertex_shader); - if (raw.geometry_shader != null) { - raw._.pipe_state.geometry_shader = sys_get_shader(raw.geometry_shader); - } ///else // Load shaders manually @@ -169,10 +166,6 @@ function shader_context_compile(raw: shader_context_t): shader_context_t { raw._.pipe_state.vertex_shader = g4_shader_create(vs_buffer, shader_type_t.VERTEX); let fs_buffer: buffer_t = data_get_blob(raw.fragment_shader + shader_data_ext()); raw._.pipe_state.fragment_shader = g4_shader_create(fs_buffer, shader_type_t.FRAGMENT); - if (raw.geometry_shader != null) { - let gs_buffer: buffer_t = data_get_blob(raw.geometry_shader + shader_data_ext()); - raw._.pipe_state.geometry_shader = g4_shader_create(gs_buffer, shader_type_t.GEOMETRY); - } ///end } @@ -263,9 +256,6 @@ function shader_context_delete(raw: shader_context_t) { if (raw._.pipe_state.vertex_shader != null) { g4_shader_delete(raw._.pipe_state.vertex_shader); } - if (raw._.pipe_state.geometry_shader != null) { - g4_shader_delete(raw._.pipe_state.geometry_shader); - } g4_pipeline_delete(raw._.pipe_state); } diff --git a/armorcore/sources/ts/sys.ts b/armorcore/sources/ts/sys.ts index d79b75b9..2e261a03 100644 --- a/armorcore/sources/ts/sys.ts +++ b/armorcore/sources/ts/sys.ts @@ -378,8 +378,9 @@ function sys_get_shader(name: string): shader_t { if (shader == null) { shader = g4_shader_create( iron_load_blob(data_path() + name + sys_shader_ext()), - ends_with(name, ".frag") ? shader_type_t.FRAGMENT : ends_with(name, ".vert") ? shader_type_t.VERTEX : shader_type_t.GEOMETRY); - map_set(_sys_shaders, name, shader); + ends_with(name, ".frag") ? shader_type_t.FRAGMENT : shader_type_t.VERTEX + ); + map_set(_sys_shaders, name, shader); } return shader; } diff --git a/base/assets/Scene.arm b/base/assets/Scene.arm index 66f2a882e24e96510ada6033b02c75744dec909b..ac76add521f11c1d185a880a1143ba5c7a724ec5 100644 GIT binary patch delta 88 zcmX@~lk43Nu7(!IElmDv7{#UstYKQaU1%+nFf)*&wt;CAh$F$coplqF86!kKfBNdp bOfDet62|QnTbZ1hkn}xf+Mc+ZDUlHXn1CN1 delta 172 zcmaF&gX_>wu7(!IElmDv7{#XttYKO!!q33Kke-^Kn_5y-8DE@{n37s_VEdmnOd`xc y6@nX>HsMqu$+-RYMkX^xh)Ma=8#gn#;8a}7xZQFqlQR<`Yo9P}=iSYe$Or&)i9cZg diff --git a/base/assets/shader_datas.arm b/base/assets/shader_datas.arm index 01c65fb41592580914681cdff74a2ac925ed1dc2..b693ffbadcd55984fc61b74ed0117fa567fade88 100644 GIT binary patch delta 659 zcmYk3O-Nfo6or|nPio^t-;^{0$SR8Pw2QdrsJ>i<)WSuD_E> z_lxahQbY>t7}j4N6AyWIlRTwS$Wug(rg7)Br`obvz|b(|jillx{B0deT2{Pole;|B zinlaD_ep!G;~O5A=o7221{ql^WF7is4JQ-JudVX3A3F~ddbZ0a^;!2OX$J#W!Z7^T zgwFj2T{w)DKpt7^29=^)Ol(VGH3C6Lq~`hqMZcU6^-zYr z^fGAs;!{0DlxQ?6FJuh)DFo3&fiL!2Jp?_3^zD69*)En?_d8Wb}N&Dcd*YLp=ffaJ%i)Vz#9``=35f@AC!>N!CtJjTr{~7MT z`$O1q@;b^5ftqm|7Fwd*-wI62ov9ZHvDCWzv3*AFEILRS$nJsP)w%957(B{z4+W#J zgOjSbjlM7O9*%Ke3_X`yaToS}_pEr#@v!3eOube7-gsEYok&TQXo>Kpb6U8Mt!1g>d5WTWlhAee zEr&nb!Z3~$)tHZHS1B@Fr7vo-C*0WaFjhMh?Uib6(kbp@F3;IQrd|>-9ES*Jgz#vnx8a$>sH*|)OQjJJs#M}zv51*SJGNc zI9BLMilJHVeJV#5O;9Pl%E_;^qF(h4))s*ewimZEVsWN2^7;AyUn{3?ZsMr3e;4ld Ot2UrHMr