From 76a2ba96bd8435624ecbf35dab36c8437739ad36 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Sat, 12 Jul 2025 10:46:34 +0200 Subject: [PATCH] Cleanup --- base/assets/Scene.arm | Bin 178056 -> 177864 bytes base/assets/shader_datas.arm | Bin 15981 -> 15103 bytes base/sources/backends/direct3d12_gpu.c | 12 ++---------- base/sources/backends/metal_gpu.m | 14 ++------------ base/sources/backends/vulkan_gpu.c | 15 ++------------- base/sources/iron_gpu.c | 2 -- base/sources/iron_gpu.h | 6 ------ base/sources/ts/iron/scene.ts | 2 -- base/sources/ts/node_shader_context.ts | 2 -- base/sources/ts/util_clone.ts | 2 -- 10 files changed, 6 insertions(+), 49 deletions(-) diff --git a/base/assets/Scene.arm b/base/assets/Scene.arm index 585fd6345e9491729369f06b7a709d46f604da4e..f7f5643f26faf7e7a5629ccc5325d43351e3f083 100644 GIT binary patch delta 115 zcmeBp&voK0S3?Wq7N(Ue7)7Qlu4l@hF1eDae!A%vCe!JyTbPQs7p!7hzzCERT*LGk kN%+oMCKr$}P|FvD@N}T+@a--enchO>kc`_7G>(}W08Vi$?*IS* delta 259 zcmX@{maF4ES3?Wq7N(Ue7{#U^T*s6@U2-K;Js&><14B|yYFoGW#|&Rc&`z#k7DCsQ=+=rq3j5ty#;6rCp<_BZ!}!(a-%Nsxj3SdCFiTBVXE_fOp8Q)tcya{WexS@N zHff+t*yL=UYOt(@?(NCCd^SLtM$UIo^%axz#qyw{-?`sI)pbnXYa=`P1Mfzl+AKcR z$;bJgLe)1+zNMZ8w4;wvWOJ9G03%fR6-a3E235Yvts)9QP0K{yz%1CDFQ&i*6q+FM z7bXO@6XedzC@2~Xw|beMd>d6A^p zWD{kp$)6-ECOEp$aeZuZmv4b}Jx7)D-`MU8|fe>D^W%5WHgWj1FRr?CUM3#?=&zqYyt MRXlz3UYiY!07)OL-v9sr delta 1130 zcmexg`nG1mT1K&n>;CcaGcYhD<)r4N#OD{J7EN|gw-FHq3MJ+gWF*ETNo=&3HPpbCGxA}!9|6tt@G@*-48fZe;`I&&)U3R9FFMd6@7U5=^My{9Z(X38+m#{4Ximz+nW6Cu_+`VBHFn-$~vj z(*%RbnlclCzTYiFhVM@^2~W0HnlX8*yamvRbMh*T(x}Nbu_QA;?=~|iy{4p0{-_YB zh%N1+sM_qP7y=5EY0AGz@KV*}_v*Zp-BkYr-QlLjNJ>OjZGNxr49YUbnx9Cp5s}b= zp|IIQTODLXfetB-h9n_dUa!do$}E$)_4y}1*AoJo@=K3oQ#Okj*02G!PBbUl51Thy H_%Q(hM9Xxi diff --git a/base/sources/backends/direct3d12_gpu.c b/base/sources/backends/direct3d12_gpu.c index c3e63543..8ab77b22 100644 --- a/base/sources/backends/direct3d12_gpu.c +++ b/base/sources/backends/direct3d12_gpu.c @@ -58,20 +58,12 @@ static D3D12_BLEND convert_blend_factor(gpu_blending_factor_t factor) { } } -static D3D12_BLEND_OP convert_blend_operation(gpu_blending_operation_t op) { - switch (op) { - case GPU_BLENDOP_ADD: - return D3D12_BLEND_OP_ADD; - } -} - static D3D12_CULL_MODE convert_cull_mode(gpu_cull_mode_t cull_mode) { switch (cull_mode) { case GPU_CULL_MODE_CLOCKWISE: return D3D12_CULL_MODE_FRONT; case GPU_CULL_MODE_COUNTERCLOCKWISE: return D3D12_CULL_MODE_BACK; - case GPU_CULL_MODE_NEVER: default: return D3D12_CULL_MODE_NONE; } @@ -782,10 +774,10 @@ void gpu_pipeline_compile(gpu_pipeline_t *pipe) { pipe->alpha_blend_source != GPU_BLEND_ONE || pipe->alpha_blend_destination != GPU_BLEND_ZERO; psoDesc.BlendState.RenderTarget[i].SrcBlend = convert_blend_factor(pipe->blend_source); psoDesc.BlendState.RenderTarget[i].DestBlend = convert_blend_factor(pipe->blend_destination); - psoDesc.BlendState.RenderTarget[i].BlendOp = convert_blend_operation(pipe->blend_operation); + psoDesc.BlendState.RenderTarget[i].BlendOp = D3D12_BLEND_OP_ADD; psoDesc.BlendState.RenderTarget[i].SrcBlendAlpha = convert_blend_factor(pipe->alpha_blend_source); psoDesc.BlendState.RenderTarget[i].DestBlendAlpha = convert_blend_factor(pipe->alpha_blend_destination); - psoDesc.BlendState.RenderTarget[i].BlendOpAlpha = convert_blend_operation(pipe->alpha_blend_operation); + psoDesc.BlendState.RenderTarget[i].BlendOpAlpha = D3D12_BLEND_OP_ADD; psoDesc.BlendState.RenderTarget[i].RenderTargetWriteMask = (((pipe->color_write_mask_red[i] ? D3D12_COLOR_WRITE_ENABLE_RED : 0) | (pipe->color_write_mask_green[i] ? D3D12_COLOR_WRITE_ENABLE_GREEN : 0)) | diff --git a/base/sources/backends/metal_gpu.m b/base/sources/backends/metal_gpu.m index a9ca3f54..f8399677 100644 --- a/base/sources/backends/metal_gpu.m +++ b/base/sources/backends/metal_gpu.m @@ -46,13 +46,6 @@ static MTLBlendFactor convert_blending_factor(gpu_blending_factor_t factor) { } } -static MTLBlendOperation convert_blending_operation(gpu_blending_operation_t op) { - switch (op) { - case GPU_BLENDOP_ADD: - return MTLBlendOperationAdd; - } -} - static MTLCompareFunction convert_compare_mode(gpu_compare_mode_t compare) { switch (compare) { case GPU_COMPARE_MODE_ALWAYS: @@ -89,7 +82,6 @@ static MTLPixelFormat convert_texture_format(gpu_texture_format_t format) { return MTLPixelFormatR8Unorm; case GPU_TEXTURE_FORMAT_D32: return MTLPixelFormatDepth32Float; - case GPU_TEXTURE_FORMAT_RGBA32: default: return MTLPixelFormatBGRA8Unorm; } @@ -105,8 +97,6 @@ static int format_byte_size(gpu_texture_format_t format) { return 2; case GPU_TEXTURE_FORMAT_R8: return 1; - case GPU_TEXTURE_FORMAT_RGBA32: - case GPU_TEXTURE_FORMAT_R32: default: return 4; } @@ -445,10 +435,10 @@ void gpu_pipeline_compile(gpu_pipeline_t *pipeline) { pipeline->alpha_blend_source != GPU_BLEND_ONE || pipeline->alpha_blend_destination != GPU_BLEND_ZERO; renderPipelineDesc.colorAttachments[i].sourceRGBBlendFactor = convert_blending_factor(pipeline->blend_source); renderPipelineDesc.colorAttachments[i].destinationRGBBlendFactor = convert_blending_factor(pipeline->blend_destination); - renderPipelineDesc.colorAttachments[i].rgbBlendOperation = convert_blending_operation(pipeline->blend_operation); + renderPipelineDesc.colorAttachments[i].rgbBlendOperation = MTLBlendOperationAdd; renderPipelineDesc.colorAttachments[i].sourceAlphaBlendFactor = convert_blending_factor(pipeline->alpha_blend_source); renderPipelineDesc.colorAttachments[i].destinationAlphaBlendFactor = convert_blending_factor(pipeline->alpha_blend_destination); - renderPipelineDesc.colorAttachments[i].alphaBlendOperation = convert_blending_operation(pipeline->alpha_blend_operation); + renderPipelineDesc.colorAttachments[i].alphaBlendOperation = MTLBlendOperationAdd; renderPipelineDesc.colorAttachments[i].writeMask = (pipeline->color_write_mask_red[i] ? MTLColorWriteMaskRed : 0) | (pipeline->color_write_mask_green[i] ? MTLColorWriteMaskGreen : 0) | diff --git a/base/sources/backends/vulkan_gpu.c b/base/sources/backends/vulkan_gpu.c index 96657b6b..9f8c10ce 100644 --- a/base/sources/backends/vulkan_gpu.c +++ b/base/sources/backends/vulkan_gpu.c @@ -76,9 +76,6 @@ static VkFormat convert_image_format(gpu_texture_format_t format) { return VK_FORMAT_R16_SFLOAT; case GPU_TEXTURE_FORMAT_R32: return VK_FORMAT_R32_SFLOAT; - case GPU_TEXTURE_FORMAT_RGBA32: - // return VK_FORMAT_R8G8B8A8_UNORM; - return VK_FORMAT_B8G8R8A8_UNORM; case GPU_TEXTURE_FORMAT_D32: return VK_FORMAT_D32_SFLOAT; default: @@ -107,7 +104,6 @@ static VkCullModeFlagBits convert_cull_mode(gpu_cull_mode_t cull_mode) { return VK_CULL_MODE_BACK_BIT; case GPU_CULL_MODE_COUNTERCLOCKWISE: return VK_CULL_MODE_FRONT_BIT; - case GPU_CULL_MODE_NEVER: default: return VK_CULL_MODE_NONE; } @@ -142,13 +138,6 @@ static VkBlendFactor convert_blend_factor(gpu_blending_factor_t factor) { } } -static VkBlendOp convert_blend_operation(gpu_blending_operation_t op) { - switch (op) { - case GPU_BLENDOP_ADD: - return VK_BLEND_OP_ADD; - } -} - static VkImageLayout convert_texture_state(gpu_texture_state_t state) { switch (state) { case GPU_TEXTURE_STATE_SHADER_RESOURCE: @@ -1549,10 +1538,10 @@ void gpu_pipeline_compile(gpu_pipeline_t *pipeline) { pipeline->alpha_blend_destination != GPU_BLEND_ZERO; att_state[i].srcColorBlendFactor = convert_blend_factor(pipeline->blend_source); att_state[i].dstColorBlendFactor = convert_blend_factor(pipeline->blend_destination); - att_state[i].colorBlendOp = convert_blend_operation(pipeline->blend_operation); + att_state[i].colorBlendOp = VK_BLEND_OP_ADD; att_state[i].srcAlphaBlendFactor = convert_blend_factor(pipeline->alpha_blend_source); att_state[i].dstAlphaBlendFactor = convert_blend_factor(pipeline->alpha_blend_destination); - att_state[i].alphaBlendOp = convert_blend_operation(pipeline->alpha_blend_operation); + att_state[i].alphaBlendOp = VK_BLEND_OP_ADD; } cb.attachmentCount = pipeline->color_attachment_count; cb.pAttachments = att_state; diff --git a/base/sources/iron_gpu.c b/base/sources/iron_gpu.c index 040cebe6..a665f858 100644 --- a/base/sources/iron_gpu.c +++ b/base/sources/iron_gpu.c @@ -232,10 +232,8 @@ void gpu_internal_pipeline_init(gpu_pipeline_t *pipe) { pipe->depth_mode = GPU_COMPARE_MODE_ALWAYS; pipe->blend_source = GPU_BLEND_ONE; pipe->blend_destination = GPU_BLEND_ZERO; - pipe->blend_operation = GPU_BLENDOP_ADD; pipe->alpha_blend_source = GPU_BLEND_ONE; pipe->alpha_blend_destination = GPU_BLEND_ZERO; - pipe->alpha_blend_operation = GPU_BLENDOP_ADD; for (int i = 0; i < 8; ++i) { pipe->color_write_mask_red[i] = true; pipe->color_write_mask_green[i] = true; diff --git a/base/sources/iron_gpu.h b/base/sources/iron_gpu.h index 08445125..72ac72e8 100644 --- a/base/sources/iron_gpu.h +++ b/base/sources/iron_gpu.h @@ -62,10 +62,6 @@ typedef enum { GPU_BLEND_INV_DEST_ALPHA } gpu_blending_factor_t; -typedef enum { - GPU_BLENDOP_ADD -} gpu_blending_operation_t; - typedef enum gpu_cull_mode { GPU_CULL_MODE_CLOCKWISE, GPU_CULL_MODE_COUNTERCLOCKWISE, @@ -118,10 +114,8 @@ typedef struct gpu_pipeline { gpu_compare_mode_t depth_mode; gpu_blending_factor_t blend_source; gpu_blending_factor_t blend_destination; - gpu_blending_operation_t blend_operation; gpu_blending_factor_t alpha_blend_source; gpu_blending_factor_t alpha_blend_destination; - gpu_blending_operation_t alpha_blend_operation; bool color_write_mask_red[8]; bool color_write_mask_green[8]; bool color_write_mask_blue[8]; diff --git a/base/sources/ts/iron/scene.ts b/base/sources/ts/iron/scene.ts index 8a56638e..8ec5838b 100644 --- a/base/sources/ts/iron/scene.ts +++ b/base/sources/ts/iron/scene.ts @@ -575,10 +575,8 @@ type shader_context_t = { shader_from_source?: bool; // Build shader at runtime using from_source() blend_source?: string; blend_destination?: string; - blend_operation?: string; alpha_blend_source?: string; alpha_blend_destination?: string; - alpha_blend_operation?: string; color_writes_red?: bool[]; // Per target masks color_writes_green?: bool[]; color_writes_blue?: bool[]; diff --git a/base/sources/ts/node_shader_context.ts b/base/sources/ts/node_shader_context.ts index 554278b2..ef5bbb08 100644 --- a/base/sources/ts/node_shader_context.ts +++ b/base/sources/ts/node_shader_context.ts @@ -33,10 +33,8 @@ function node_shader_context_create(material: material_t, props: shader_context_ cull_mode: props.cull_mode, blend_source: props.blend_source, blend_destination: props.blend_destination, - blend_operation: props.blend_operation, alpha_blend_source: props.alpha_blend_source, alpha_blend_destination: props.alpha_blend_destination, - alpha_blend_operation: props.alpha_blend_operation, fragment_shader: "", vertex_shader: "", vertex_elements: props.vertex_elements != null ? props.vertex_elements : vertex_elements_default, diff --git a/base/sources/ts/util_clone.ts b/base/sources/ts/util_clone.ts index f6bdb23c..fdd9fcd9 100644 --- a/base/sources/ts/util_clone.ts +++ b/base/sources/ts/util_clone.ts @@ -204,10 +204,8 @@ function util_clone_shader_contexts(contexts: shader_context_t[]): shader_contex c.shader_from_source = contexts[i].shader_from_source; c.blend_source = contexts[i].blend_source; c.blend_destination = contexts[i].blend_destination; - c.blend_operation = contexts[i].blend_operation; c.alpha_blend_source = contexts[i].alpha_blend_source; c.alpha_blend_destination = contexts[i].alpha_blend_destination; - c.alpha_blend_operation = contexts[i].alpha_blend_operation; c.color_writes_red = util_clone_bool_array(contexts[i].color_writes_red); c.color_writes_green = util_clone_bool_array(contexts[i].color_writes_green); c.color_writes_blue = util_clone_bool_array(contexts[i].color_writes_blue);