From b30e04f2fa61708b18f4fd5ee1079530c3f3ea47 Mon Sep 17 00:00:00 2001 From: Niels Bross Date: Fri, 24 Oct 2025 11:35:42 +0200 Subject: [PATCH] Fix static array issue and scratch issue. --- check.jai | 4 ++-- codegen.jai | 4 ++-- ink.jai | 3 ++- lexing.jai | 4 ++-- parsing.jai | 4 ++-- pass_test.ink | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 60 insertions(+), 9 deletions(-) create mode 100644 pass_test.ink diff --git a/check.jai b/check.jai index d243d64..9158042 100644 --- a/check.jai +++ b/check.jai @@ -2313,8 +2313,8 @@ check :: (ctx : *Compiler_Context, allocator : Allocator = temp) { new_context := context; new_context.allocator = allocator; push_context new_context { - init_context_allocators(); - defer clear_context_allocators(); + init_scratch(); + defer clear_scratch(); checker : Checker; diff --git a/codegen.jai b/codegen.jai index 05f1120..ef96e99 100644 --- a/codegen.jai +++ b/codegen.jai @@ -608,8 +608,8 @@ codegen :: (result : *Compiler_Context, output_language : Output_Language, alloc new_context := context; new_context.allocator = allocator; push_context new_context { - init_context_allocators(); - defer clear_context_allocators(); + init_scratch(); + defer clear_scratch(); state : Codegen_State; state.ctx = result; diff --git a/ink.jai b/ink.jai index 617e3b0..6a95efc 100644 --- a/ink.jai +++ b/ink.jai @@ -644,7 +644,8 @@ evaluate_result :: (result : Result) { main :: () { args := get_command_line_arguments(); - init_context_allocators(); + init_scratch(); + defer clear_scratch(); local_temp := make_arena(Megabytes(128)); diff --git a/lexing.jai b/lexing.jai index edd871d..6d21f2d 100644 --- a/lexing.jai +++ b/lexing.jai @@ -559,8 +559,8 @@ lex :: (ctx : *Compiler_Context, allocator := temp) { new_context := context; new_context.allocator = allocator; push_context new_context { - init_context_allocators(); - defer clear_context_allocators(); + init_scratch(); + defer clear_scratch(); lexer : Lexer; lexer.ctx = ctx; diff --git a/parsing.jai b/parsing.jai index 4719455..0a4550d 100644 --- a/parsing.jai +++ b/parsing.jai @@ -1476,8 +1476,8 @@ parse :: (ctx : *Compiler_Context, allocator := temp) { new_context := context; new_context.allocator = allocator; push_context new_context { - init_context_allocators(); - defer clear_context_allocators(); + init_scratch(); + defer clear_scratch(); parse_state : Parser; array_reserve(*ctx.nodes, 128); //@Note(niels): This is quite a random number to be honest diff --git a/pass_test.ink b/pass_test.ink new file mode 100644 index 0000000..42f08f1 --- /dev/null +++ b/pass_test.ink @@ -0,0 +1,50 @@ +shader Entity { + constants :: Constant_Buffer { + model : float4x4; + projection : float4x4; + light_view : float4x4; + + light_dir : float3; + light_color : float3; + } + + Vertex_In :: struct { + position : float3; + normal : float3; + uv : float2; + } + + Vertex_Out :: struct { + position : float4; + normal : float3; + uv : float2; + world_pos : float3; + } + + vertex main :: (in : Vertex_In) -> Vertex_Out { + // Do some stuff here + } + + pass : shadow { + vertex = main; + pixel :: (in : Vertex_Out) -> float4 { + // Do some shadow stuff + } + } + + pass : picking { + vertex = main; + pixel :: (in : Vertex_Out) -> float4 { + // Do some picking stuff + } + } + + pass : lighting { + vertex = main; + pixel :: (in : Vertex_Out) -> float4 { + // Do some lighting stuff + } + } + +} +