Fix static array issue and scratch issue.

This commit is contained in:
2025-10-24 11:35:42 +02:00
parent da660ad87e
commit b30e04f2fa
6 changed files with 60 additions and 9 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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));

View File

@@ -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;

View File

@@ -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

50
pass_test.ink Normal file
View File

@@ -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
}
}
}