From f564c143542ee0c78f24f1fe3171944b10a120ce Mon Sep 17 00:00:00 2001 From: Sven Balzer <4653051+Kyuusokuna@users.noreply.github.com> Date: Sat, 1 Aug 2026 09:37:43 +0200 Subject: [PATCH] change grid shader primitive to line from triangle --- CMakeLists.txt | 1 + src/main.cpp | 73 +++---------------------------------- src/renderer_sdlgpu.c | 29 +++++---------- src/renderer_wgpu.c | 23 ++++-------- src/shaders/spirv/grid.spv | Bin 2840 -> 3964 bytes src/shaders/src/grid.slang | 33 +++++++++++------ src/shaders/wgsl/grid.wgsl | 56 +++++++++++++--------------- 7 files changed, 69 insertions(+), 146 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f3b389f..236c4c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ set(CMAKE_C_STANDARD 23) set(CMAKE_C_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_DISABLE_PRECOMPILE_HEADERS ON) option(TRACY_ENABLE "Enable Tracy profiling" OFF) diff --git a/src/main.cpp b/src/main.cpp index 9af77a9..6891baa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -45,8 +45,6 @@ static R_Buffer tint_color_buffer; static R_Buffer vertex_buffer; static R_Buffer index_buffer; -static R_Buffer grid_vertex_buffer; -static R_Buffer grid_index_buffer; static R_Buffer player_instance_buffer; static R_Buffer tile_uvs_buffer; @@ -185,51 +183,6 @@ static Uint16 indices[] = { 0, 2, 3, }; -#define grid_line_size (1.0f / 64.0f) -static Vertex grid_vertices[] = { - // LEFT - {{ -0.5f, 0.5f, 0.0f }}, - {{ -0.5f, -0.5f + grid_line_size, 0.0f }}, - {{ -0.5f + grid_line_size, -0.5f + grid_line_size, 0.0f }}, - {{ -0.5f + grid_line_size, 0.5f, 0.0f }}, - - // TOP - {{ -0.5f + grid_line_size, 0.5f, 0.0f }}, - {{ -0.5f + grid_line_size, 0.5f - grid_line_size, 0.0f }}, - {{ 0.5f, 0.5f - grid_line_size, 0.0f }}, - {{ 0.5f, 0.5f, 0.0f }}, - - // RIGHT - {{ 0.5f - grid_line_size, 0.5f - grid_line_size, 0.0f }}, - {{ 0.5f - grid_line_size, -0.5f, 0.0f }}, - {{ 0.5f, -0.5f, 0.0f }}, - {{ 0.5f, 0.5f - grid_line_size, 0.0f }}, - - // BOTTOM - {{ -0.5f, -0.5f + grid_line_size, 0.0f }}, - {{ -0.5f, -0.5f, 0.0f }}, - {{ 0.5f - grid_line_size, -0.5f, 0.0f }}, - {{ 0.5f - grid_line_size, -0.5f + grid_line_size, 0.0f }}, -}; - -static Uint16 grid_indices[] = { - // LEFT - 0, 1, 2, - 0, 2, 3, - - // TOP - 4, 5, 6, - 4, 6, 7, - - // RIGHT - 8, 9, 10, - 8, 10, 11, - - // BOTTOM - 12, 13, 14, - 12, 14, 15, -}; - struct Instance { vec2 pos; }; @@ -255,12 +208,13 @@ struct Player { static Player player; -struct PerFrame { +struct alignas(16) PerFrame { i32vec2 drag_start; i32vec2 mouse; vec2 grid_offset; - Sint32 grid_width; - Sint32 map_width; + Uint32 grid_width; + Uint32 map_width; + Uint32 grid_height; }; static PerFrame per_frame = {}; @@ -928,18 +882,6 @@ static bool init_resources() { return false; } - grid_vertex_buffer = renderer_buffer_create(R_BUFFER_USAGE_VERTEX, sizeof(grid_vertices), grid_vertices, "grid_vertex_buffer"); - if (!grid_vertex_buffer) { - log_error("Failed to create buffer."); - return false; - } - - grid_index_buffer = renderer_buffer_create(R_BUFFER_USAGE_INDEX, sizeof(grid_indices), grid_indices, "grid_index_buffer"); - if (!grid_index_buffer) { - log_error("Failed to create buffer."); - return false; - } - player_instance_buffer = renderer_buffer_create(R_BUFFER_USAGE_VERTEX, sizeof(player_instance), &player_instance, "player_instance_buffer"); if (!player_instance_buffer) { log_error("Failed to create buffer."); @@ -1329,6 +1271,7 @@ static void render_editor() { per_frame.map_width = current_map.size.x; per_frame.grid_width = selected_tile != -1 ? current_map.size.x : current_map.size.x + 1; + per_frame.grid_height = selected_tile != -1 ? current_map.size.y : current_map.size.y + 1; per_frame.grid_offset = selected_tile != -1 ? vec2(-0.5f, -0.5f) : vec2(-1.0f, -1.0f); per_frame.mouse = tile_pos; @@ -1394,12 +1337,8 @@ static void render_editor() { if (show_grid) { ZoneScopedN("Draw Grid"); - Uint32 num_grid_cells = current_map.size.y * current_map.size.x; - if (selected_tile == -1) - num_grid_cells = (current_map.size.y + 1) * (current_map.size.x + 1); - renderer_frame_set_shader(R_SHADER_GRID); - renderer_frame_draw(grid_vertex_buffer, grid_index_buffer, NULL, SDL_arraysize(grid_indices), num_grid_cells, &(R_Draw_Resources){ + renderer_frame_draw(NULL, NULL, NULL, per_frame.grid_width * 2 + per_frame.grid_height * 2 + 4, 1, &(R_Draw_Resources){ .vertex_uniform_buffers = (R_Buffer[]){ view_projection_matrix_buffer, per_frame_buffer }, .num_vertex_uniform_buffers = 2, }); diff --git a/src/renderer_sdlgpu.c b/src/renderer_sdlgpu.c index 02c8bb2..2301402 100644 --- a/src/renderer_sdlgpu.c +++ b/src/renderer_sdlgpu.c @@ -733,29 +733,14 @@ bool renderer_init(SDL_Window *window_) { .fragment_shader = fragment_shader, .vertex_input_state = { - .vertex_buffer_descriptions = (SDL_GPUVertexBufferDescription[]){ - { - .slot = 0, - .pitch = 20, - .input_rate = SDL_GPU_VERTEXINPUTRATE_VERTEX, + .vertex_buffer_descriptions = (SDL_GPUVertexBufferDescription[]){}, + .num_vertex_buffers = 0, - .instance_step_rate = 0, - }, - }, - .num_vertex_buffers = 1, - - .vertex_attributes = (SDL_GPUVertexAttribute[]){ - { - .location = 0, - .buffer_slot = 0, - .format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3, - .offset = 0, - }, - }, - .num_vertex_attributes = 1, + .vertex_attributes = (SDL_GPUVertexAttribute[]){}, + .num_vertex_attributes = 0, }, - .primitive_type = SDL_GPU_PRIMITIVETYPE_TRIANGLELIST, + .primitive_type = SDL_GPU_PRIMITIVETYPE_LINELIST, .rasterizer_state = { .fill_mode = SDL_GPU_FILLMODE_FILL, @@ -824,6 +809,10 @@ bool renderer_init(SDL_Window *window_) { SDL_ReleaseGPUShader(device, fragment_shader); } + for (int i = 0; i < R_SHADER_COUNT; i++) { + SDL_assert(shaders[i]); + } + transfer_buffer = SDL_CreateGPUTransferBuffer(device, &(SDL_GPUTransferBufferCreateInfo){ .usage = SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD, .size = 64 * 1024, diff --git a/src/renderer_wgpu.c b/src/renderer_wgpu.c index 5545f74..b63988e 100644 --- a/src/renderer_wgpu.c +++ b/src/renderer_wgpu.c @@ -932,25 +932,12 @@ bool renderer_init(SDL_Window *window_) { .entryPoint = { .data = "main_vertex", .length = WGPU_STRLEN }, .constantCount = 0, .constants = NULL, - .bufferCount = 1, - .buffers = (WGPUVertexBufferLayout[]){ - { - .stepMode = WGPUVertexStepMode_Vertex, - .arrayStride = 20, - .attributeCount = 1, - .attributes = (WGPUVertexAttribute[]){ - { - .format = WGPUVertexFormat_Float32x3, - .offset = 0, - .shaderLocation = 0, - }, - }, - }, - }, + .bufferCount = 0, + .buffers = NULL, }, .primitive = { - .topology = WGPUPrimitiveTopology_TriangleList, + .topology = WGPUPrimitiveTopology_LineList, .stripIndexFormat = WGPUIndexFormat_Undefined, .frontFace = WGPUFrontFace_CCW, .cullMode = WGPUCullMode_Back, @@ -978,6 +965,10 @@ bool renderer_init(SDL_Window *window_) { wgpuShaderModuleRelease(shader); } + for (int i = 0; i < R_SHADER_COUNT; i++) { + SDL_assert(shaders[i]); + } + return true; } diff --git a/src/shaders/spirv/grid.spv b/src/shaders/spirv/grid.spv index ca11d4d8a1a7ee01bb169032eac095bc93fd2e52..a57bed531a04b49d33857d69c5394ba023bc2625 100644 GIT binary patch literal 3964 zcma)+>u*$L5Qh(xmOF}E1;HXB2(^M1M7fC~MMbUR{kB=!ZM)d**6ngJfrLh)82kWg z6h#q@qM#9@;0HAR1^C%N#Y+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6z#bT{&zRuzZ(h-7jOWYa N2VlOjJGmb2^FN10^OXPq diff --git a/src/shaders/src/grid.slang b/src/shaders/src/grid.slang index 83fbbca..487b283 100644 --- a/src/shaders/src/grid.slang +++ b/src/shaders/src/grid.slang @@ -1,16 +1,16 @@ #language 2026 struct VertexShaderInput { - uint32_t vertex_index : SV_VulkanVertexID; - uint32_t instance_index : SV_VulkanInstanceID; - - [vk::location(0)] float3 pos; + uint32_t vertex_index : SV_VulkanVertexID; }; struct VertexShaderOutput { float4 pos : SV_Position; - int selected; + nointerpolation int2 selection_min; + nointerpolation int2 selection_max; + + float2 tile_pos; }; struct FragmentShaderOutput { @@ -23,6 +23,7 @@ struct Per_Frame_Data { float2 grid_offset; uint32_t grid_width; uint32_t map_width; + uint32_t grid_height; }; [vk::binding(0, 1)] ConstantBuffer view_projection_matrix : register(b0, space1); @@ -31,14 +32,22 @@ struct Per_Frame_Data { [shader("vertex")] VertexShaderOutput main_vertex(VertexShaderInput input) { var output: VertexShaderOutput; + output.selection_min = min(per_frame.drag_start, per_frame.mouse); + output.selection_max = max(per_frame.drag_start, per_frame.mouse); - let tile_pos = float2(float(input.instance_index % per_frame.grid_width), float(input.instance_index / per_frame.grid_width)); - output.pos = mul(float4(tile_pos + per_frame.grid_offset + input.pos.xy, 0, 1), view_projection_matrix); + let vertex_pos = select(input.vertex_index < (per_frame.grid_height + 1) * 2, + select(input.vertex_index % 2 == 0, + float2( 0, input.vertex_index / 2), + float2(per_frame.grid_width, input.vertex_index / 2) + ), + select(input.vertex_index % 2 == 0, + float2((input.vertex_index % ((per_frame.grid_height + 1) * 2)) / 2, 0), + float2((input.vertex_index % ((per_frame.grid_height + 1) * 2)) / 2, per_frame.grid_height) + ) + ); - let pos = int2(tile_pos + round(per_frame.grid_offset)); - let selection_min = min(per_frame.drag_start, per_frame.mouse); - let selection_max = max(per_frame.drag_start, per_frame.mouse); - output.selected = select(all(pos >= selection_min) && all(pos <= selection_max), 1, 0); + output.pos = mul(float4(vertex_pos + per_frame.grid_offset - float2(0.5, 0.5), 0, 1), view_projection_matrix); + output.tile_pos = vertex_pos + round(per_frame.grid_offset); return output; } @@ -50,7 +59,7 @@ static const float4 selected_color = float4(1.0, 0.0, 1.0, 1.0); FragmentShaderOutput main_fragment(VertexShaderOutput input) { var output: FragmentShaderOutput; - output.color = input.selected != 0 ? selected_color : color; + output.color = select(all(input.tile_pos >= (input.selection_min - float2(0.01, 0.01))) && all(input.tile_pos <= (input.selection_max + float2(1.01, 1.01))), selected_color, color); return output; } diff --git a/src/shaders/wgsl/grid.wgsl b/src/shaders/wgsl/grid.wgsl index 097a851..08ea7ee 100644 --- a/src/shaders/wgsl/grid.wgsl +++ b/src/shaders/wgsl/grid.wgsl @@ -5,6 +5,7 @@ struct Per_Frame_Data_std140_0 @align(16) grid_offset_0 : vec2, @align(8) grid_width_0 : u32, @align(4) map_width_0 : u32, + @align(16) grid_height_0 : u32, }; @binding(1) @group(1) var per_frame_0 : Per_Frame_Data_std140_0; @@ -17,35 +18,26 @@ struct _MatrixStorage_float4x4_ColMajorstd140_0 struct VertexShaderOutput_0 { @builtin(position) pos_0 : vec4, - @location(0) selected_0 : i32, -}; - -struct vertexInput_0 -{ - @location(0) pos_1 : vec3, + @interpolate(flat) @location(0) selection_min_0 : vec2, + @interpolate(flat) @location(1) selection_max_0 : vec2, + @location(2) tile_pos_0 : vec2, }; @vertex -fn main_vertex( _S1 : vertexInput_0, @builtin(vertex_index) vertex_index_0 : u32, @builtin(instance_index) instance_index_0 : u32) -> VertexShaderOutput_0 +fn main_vertex(@builtin(vertex_index) vertex_index_0 : u32) -> VertexShaderOutput_0 { - var _S2 : u32 = instance_index_0 % per_frame_0.grid_width_0; - var _S3 : f32 = f32(_S2); - var _S4 : u32 = instance_index_0 / per_frame_0.grid_width_0; - var _S5 : vec2 = vec2(_S3, f32(_S4)); var output_0 : VertexShaderOutput_0; - output_0.pos_0 = (((mat4x4(view_projection_matrix_0.data_0[i32(0)][i32(0)], view_projection_matrix_0.data_0[i32(1)][i32(0)], view_projection_matrix_0.data_0[i32(2)][i32(0)], view_projection_matrix_0.data_0[i32(3)][i32(0)], view_projection_matrix_0.data_0[i32(0)][i32(1)], view_projection_matrix_0.data_0[i32(1)][i32(1)], view_projection_matrix_0.data_0[i32(2)][i32(1)], view_projection_matrix_0.data_0[i32(3)][i32(1)], view_projection_matrix_0.data_0[i32(0)][i32(2)], view_projection_matrix_0.data_0[i32(1)][i32(2)], view_projection_matrix_0.data_0[i32(2)][i32(2)], view_projection_matrix_0.data_0[i32(3)][i32(2)], view_projection_matrix_0.data_0[i32(0)][i32(3)], view_projection_matrix_0.data_0[i32(1)][i32(3)], view_projection_matrix_0.data_0[i32(2)][i32(3)], view_projection_matrix_0.data_0[i32(3)][i32(3)])) * (vec4(_S5 + per_frame_0.grid_offset_0 + _S1.pos_1.xy, 0.0f, 1.0f)))); - var _S6 : vec2 = vec2(_S5 + round(per_frame_0.grid_offset_0)); - var _S7 : vec2 = max(per_frame_0.drag_start_0, per_frame_0.mouse_0); - var _S8 : bool; - if((all((_S6 >= (min(per_frame_0.drag_start_0, per_frame_0.mouse_0)))))) - { - _S8 = (all((_S6 <= _S7))); - } - else - { - _S8 = false; - } - output_0.selected_0 = select(i32(0), i32(1), _S8); + output_0.selection_min_0 = min(per_frame_0.drag_start_0, per_frame_0.mouse_0); + output_0.selection_max_0 = max(per_frame_0.drag_start_0, per_frame_0.mouse_0); + var _S1 : bool = vertex_index_0 < ((per_frame_0.grid_height_0 + u32(1)) * u32(2)); + var _S2 : bool = (vertex_index_0 % u32(2)) == u32(0); + var _S3 : vec2 = select(vec2(f32(per_frame_0.grid_width_0), f32(vertex_index_0 / u32(2))), vec2(0.0f, f32(vertex_index_0 / u32(2))), _S2); + var _S4 : u32 = vertex_index_0 % ((per_frame_0.grid_height_0 + u32(1)) * u32(2)); + var _S5 : vec2 = vec2(f32(_S4 / u32(2)), 0.0f); + var _S6 : u32 = vertex_index_0 % ((per_frame_0.grid_height_0 + u32(1)) * u32(2)); + var _S7 : vec2 = select(select(vec2(f32(_S6 / u32(2)), f32(per_frame_0.grid_height_0)), _S5, _S2), _S3, _S1); + output_0.pos_0 = (((mat4x4(view_projection_matrix_0.data_0[i32(0)][i32(0)], view_projection_matrix_0.data_0[i32(1)][i32(0)], view_projection_matrix_0.data_0[i32(2)][i32(0)], view_projection_matrix_0.data_0[i32(3)][i32(0)], view_projection_matrix_0.data_0[i32(0)][i32(1)], view_projection_matrix_0.data_0[i32(1)][i32(1)], view_projection_matrix_0.data_0[i32(2)][i32(1)], view_projection_matrix_0.data_0[i32(3)][i32(1)], view_projection_matrix_0.data_0[i32(0)][i32(2)], view_projection_matrix_0.data_0[i32(1)][i32(2)], view_projection_matrix_0.data_0[i32(2)][i32(2)], view_projection_matrix_0.data_0[i32(3)][i32(2)], view_projection_matrix_0.data_0[i32(0)][i32(3)], view_projection_matrix_0.data_0[i32(1)][i32(3)], view_projection_matrix_0.data_0[i32(2)][i32(3)], view_projection_matrix_0.data_0[i32(3)][i32(3)])) * (vec4(_S7 + per_frame_0.grid_offset_0 - vec2(0.5f, 0.5f), 0.0f, 1.0f)))); + output_0.tile_pos_0 = _S7 + round(per_frame_0.grid_offset_0); return output_0; } @@ -56,23 +48,25 @@ struct FragmentShaderOutput_0 struct pixelInput_0 { - @location(0) selected_1 : i32, + @interpolate(flat) @location(0) selection_min_1 : vec2, + @interpolate(flat) @location(1) selection_max_1 : vec2, + @location(2) tile_pos_1 : vec2, }; @fragment -fn main_fragment( _S9 : pixelInput_0, @builtin(position) pos_2 : vec4) -> FragmentShaderOutput_0 +fn main_fragment( _S8 : pixelInput_0, @builtin(position) pos_1 : vec4) -> FragmentShaderOutput_0 { var output_1 : FragmentShaderOutput_0; - var _S10 : vec4; - if((_S9.selected_1) != i32(0)) + var _S9 : bool; + if((all(((_S8.tile_pos_1) >= (vec2(_S8.selection_min_1) - vec2(0.00999999977648258f, 0.00999999977648258f)))))) { - _S10 = vec4(1.0f, 0.0f, 1.0f, 1.0f); + _S9 = (all(((_S8.tile_pos_1) <= (vec2(_S8.selection_max_1) + vec2(1.00999999046325684f, 1.00999999046325684f))))); } else { - _S10 = vec4(1.0f, 1.0f, 1.0f, 0.10000000149011612f); + _S9 = false; } - output_1.color_0 = _S10; + output_1.color_0 = select(vec4(1.0f, 1.0f, 1.0f, 0.10000000149011612f), vec4(1.0f, 0.0f, 1.0f, 1.0f), _S9); return output_1; }