diff --git a/src/main.cpp b/src/main.cpp index 53f15fe..23e970b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -44,8 +44,6 @@ static R_Buffer view_projection_matrix_buffer; static R_Buffer per_frame_buffer; static R_Buffer tint_color_buffer; -static R_Buffer vertex_buffer; -static R_Buffer index_buffer; static R_Buffer player_instance_buffer; static R_Buffer tile_uvs_buffer; @@ -170,23 +168,6 @@ enum Settings_Category { SETTINGS_AUDIO, }; -struct Vertex { - vec3 pos; - vec2 uv; -}; - -static Vertex vertices[] = { - {{ -0.5f, 0.5f, 0.0f }, { 0.0f, 0.0f }}, - {{ -0.5f, -0.5f, 0.0f }, { 0.0f, 1.0f }}, - {{ 0.5f, -0.5f, 0.0f }, { 1.0f, 1.0f }}, - {{ 0.5f, 0.5f, 0.0f }, { 1.0f, 0.0f }}, -}; - -static Uint16 indices[] = { - 0, 1, 2, - 0, 2, 3, -}; - struct Instance { vec2 pos; uint32_t sprite_selection; @@ -892,18 +873,6 @@ static bool init_resources() { return false; } - vertex_buffer = renderer_buffer_create(R_BUFFER_USAGE_VERTEX, sizeof(vertices), vertices, "vertex_buffer"); - if (!vertex_buffer) { - log_error("Failed to create buffer."); - return false; - } - - index_buffer = renderer_buffer_create(R_BUFFER_USAGE_INDEX, sizeof(indices), indices, "index_buffer"); - if (!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."); @@ -1564,7 +1533,7 @@ static void render_game() { { ZoneScopedN("Draw Player"); renderer_frame_set_shader(R_SHADER_CHARACTER_SHADOW); - renderer_frame_draw(vertex_buffer, index_buffer, player_instance_buffer, 6, 1, &(R_Draw_Resources){ + renderer_frame_draw(NULL, NULL, player_instance_buffer, 6, 1, &(R_Draw_Resources){ .vertex_uniform_buffers = (R_Buffer[]){ view_projection_matrix_buffer }, .num_vertex_uniform_buffers = 1, @@ -1577,7 +1546,7 @@ static void render_game() { }); renderer_frame_set_shader(R_SHADER_CHARACTER); - renderer_frame_draw(vertex_buffer, index_buffer, player_instance_buffer, 6, 1, &(R_Draw_Resources){ + renderer_frame_draw(NULL, NULL, player_instance_buffer, 6, 1, &(R_Draw_Resources){ .vertex_uniform_buffers = (R_Buffer[]){ view_projection_matrix_buffer }, .num_vertex_uniform_buffers = 1, diff --git a/src/renderer_sdlgpu.c b/src/renderer_sdlgpu.c index 8a97ab9..540d4e5 100644 --- a/src/renderer_sdlgpu.c +++ b/src/renderer_sdlgpu.c @@ -343,8 +343,8 @@ void renderer_frame_draw(R_Buffer vertex_buffer, R_Buffer index_buffer, R_Buffer for (int i = 0; i < resources->num_fragment_storage_buffers; i++) SDL_BindGPUFragmentStorageBuffers(render_pass, i, &resources->fragment_storage_buffers[i]->buffer, 1); for (int i = 0; i < resources->num_fragment_uniform_buffers; i++) SDL_PushGPUFragmentUniformData(render_command_buffer, i, resources->fragment_uniform_buffers[i]->cpu_uniform_data, resources->fragment_uniform_buffers[i]->num_bytes); - if (vertex_buffer) SDL_BindGPUVertexBuffers(render_pass, 0, &(SDL_GPUBufferBinding){ .buffer = vertex_buffer->buffer, .offset = 0 }, 1); - if (instance_buffer) SDL_BindGPUVertexBuffers(render_pass, 1, &(SDL_GPUBufferBinding){ .buffer = instance_buffer->buffer, .offset = 0 }, 1); + if (vertex_buffer) SDL_BindGPUVertexBuffers(render_pass, 0, &(SDL_GPUBufferBinding){ .buffer = vertex_buffer->buffer, .offset = 0 }, 1); + if (instance_buffer) SDL_BindGPUVertexBuffers(render_pass, vertex_buffer ? 1 : 0, &(SDL_GPUBufferBinding){ .buffer = instance_buffer->buffer, .offset = 0 }, 1); if (index_buffer) { SDL_BindGPUIndexBuffer(render_pass, &(SDL_GPUBufferBinding){ .buffer = index_buffer->buffer, .offset = 0 }, SDL_GPU_INDEXELEMENTSIZE_16BIT); @@ -454,48 +454,29 @@ bool renderer_init(SDL_Window *window_) { .vertex_buffer_descriptions = (SDL_GPUVertexBufferDescription[]){ { .slot = 0, - .pitch = 20, - .input_rate = SDL_GPU_VERTEXINPUTRATE_VERTEX, - - .instance_step_rate = 0, - }, - { - .slot = 1, .pitch = 12, .input_rate = SDL_GPU_VERTEXINPUTRATE_INSTANCE, .instance_step_rate = 0, }, }, - .num_vertex_buffers = 2, + .num_vertex_buffers = 1, .vertex_attributes = (SDL_GPUVertexAttribute[]){ - { - .location = 0, - .buffer_slot = 0, - .format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3, - .offset = 0, - }, - { - .location = 1, - .buffer_slot = 0, - .format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2, - .offset = 12, - }, { .location = 2, - .buffer_slot = 1, + .buffer_slot = 0, .format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2, .offset = 0, }, { .location = 3, - .buffer_slot = 1, + .buffer_slot = 0, .format = SDL_GPU_VERTEXELEMENTFORMAT_UINT, .offset = 8, }, }, - .num_vertex_attributes = 4, + .num_vertex_attributes = 2, }, .primitive_type = SDL_GPU_PRIMITIVETYPE_TRIANGLELIST, @@ -611,48 +592,29 @@ bool renderer_init(SDL_Window *window_) { .vertex_buffer_descriptions = (SDL_GPUVertexBufferDescription[]){ { .slot = 0, - .pitch = 20, - .input_rate = SDL_GPU_VERTEXINPUTRATE_VERTEX, - - .instance_step_rate = 0, - }, - { - .slot = 1, .pitch = 12, .input_rate = SDL_GPU_VERTEXINPUTRATE_INSTANCE, .instance_step_rate = 0, }, }, - .num_vertex_buffers = 2, + .num_vertex_buffers = 1, .vertex_attributes = (SDL_GPUVertexAttribute[]){ - { - .location = 0, - .buffer_slot = 0, - .format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3, - .offset = 0, - }, - { - .location = 1, - .buffer_slot = 0, - .format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2, - .offset = 12, - }, { .location = 2, - .buffer_slot = 1, + .buffer_slot = 0, .format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2, .offset = 0, }, { .location = 3, - .buffer_slot = 1, + .buffer_slot = 0, .format = SDL_GPU_VERTEXELEMENTFORMAT_UINT, .offset = 8, }, }, - .num_vertex_attributes = 4, + .num_vertex_attributes = 2, }, .primitive_type = SDL_GPU_PRIMITIVETYPE_TRIANGLELIST, diff --git a/src/renderer_wgpu.c b/src/renderer_wgpu.c index 4b4ef6d..cc63124 100644 --- a/src/renderer_wgpu.c +++ b/src/renderer_wgpu.c @@ -475,8 +475,8 @@ void renderer_frame_draw(R_Buffer vertex_buffer, R_Buffer index_buffer, R_Buffer wgpuRenderPassEncoderSetBindGroup(pass_encoder, 3, NULL, 0, NULL); } - if (vertex_buffer) wgpuRenderPassEncoderSetVertexBuffer(pass_encoder, 0, vertex_buffer->buffer, 0, WGPU_WHOLE_SIZE); - if (instance_buffer) wgpuRenderPassEncoderSetVertexBuffer(pass_encoder, 1, instance_buffer->buffer, 0, WGPU_WHOLE_SIZE); + if (vertex_buffer) wgpuRenderPassEncoderSetVertexBuffer(pass_encoder, 0, vertex_buffer->buffer, 0, WGPU_WHOLE_SIZE); + if (instance_buffer) wgpuRenderPassEncoderSetVertexBuffer(pass_encoder, vertex_buffer ? 1 : 0, instance_buffer->buffer, 0, WGPU_WHOLE_SIZE); if (index_buffer) { wgpuRenderPassEncoderSetIndexBuffer(pass_encoder, index_buffer->buffer, WGPUIndexFormat_Uint16, 0, WGPU_WHOLE_SIZE); @@ -683,14 +683,14 @@ bool renderer_init(SDL_Window *window_) { .chain = { .next = NULL, .sType = WGPUSType_ShaderSourceWGSL }, .code = { .data = shader_source, .length = SDL_arraysize(shader_source) }, }, - .label = { .data = "basic shader", .length = WGPU_STRLEN } + .label = { .data = "character shader", .length = WGPU_STRLEN } }); shaders[R_SHADER_CHARACTER] = wgpuDeviceCreateRenderPipeline(device, &(WGPURenderPipelineDescriptor){ - .label = { .data = "basic render_pipeline", .length = WGPU_STRLEN }, + .label = { .data = "character render_pipeline", .length = WGPU_STRLEN }, .layout = wgpuDeviceCreatePipelineLayout(device, &(WGPUPipelineLayoutDescriptor){ - .label = { .data = "basic pipeline_layout", .length = WGPU_STRLEN }, + .label = { .data = "character pipeline_layout", .length = WGPU_STRLEN }, .bindGroupLayoutCount = 4, .bindGroupLayouts = (WGPUBindGroupLayout[]){ wgpuDeviceCreateBindGroupLayout(device, &(WGPUBindGroupLayoutDescriptor){ @@ -726,25 +726,8 @@ bool renderer_init(SDL_Window *window_) { .entryPoint = { .data = "main_vertex", .length = WGPU_STRLEN }, .constantCount = 0, .constants = NULL, - .bufferCount = 2, + .bufferCount = 1, .buffers = (WGPUVertexBufferLayout[]){ - { - .stepMode = WGPUVertexStepMode_Vertex, - .arrayStride = 20, - .attributeCount = 2, - .attributes = (WGPUVertexAttribute[]){ - { - .format = WGPUVertexFormat_Float32x3, - .offset = 0, - .shaderLocation = 0, - }, - { - .format = WGPUVertexFormat_Float32x2, - .offset = 12, - .shaderLocation = 1, - }, - }, - }, { .stepMode = WGPUVertexStepMode_Instance, .arrayStride = 12, @@ -804,14 +787,14 @@ bool renderer_init(SDL_Window *window_) { .chain = { .next = NULL, .sType = WGPUSType_ShaderSourceWGSL }, .code = { .data = shader_source, .length = SDL_arraysize(shader_source) }, }, - .label = { .data = "basic shader", .length = WGPU_STRLEN } + .label = { .data = "character_shadow shader", .length = WGPU_STRLEN } }); shaders[R_SHADER_CHARACTER_SHADOW] = wgpuDeviceCreateRenderPipeline(device, &(WGPURenderPipelineDescriptor){ - .label = { .data = "basic render_pipeline", .length = WGPU_STRLEN }, + .label = { .data = "character_shadow render_pipeline", .length = WGPU_STRLEN }, .layout = wgpuDeviceCreatePipelineLayout(device, &(WGPUPipelineLayoutDescriptor){ - .label = { .data = "basic pipeline_layout", .length = WGPU_STRLEN }, + .label = { .data = "character_shadow pipeline_layout", .length = WGPU_STRLEN }, .bindGroupLayoutCount = 4, .bindGroupLayouts = (WGPUBindGroupLayout[]){ wgpuDeviceCreateBindGroupLayout(device, &(WGPUBindGroupLayoutDescriptor){ @@ -847,25 +830,8 @@ bool renderer_init(SDL_Window *window_) { .entryPoint = { .data = "main_vertex", .length = WGPU_STRLEN }, .constantCount = 0, .constants = NULL, - .bufferCount = 2, + .bufferCount = 1, .buffers = (WGPUVertexBufferLayout[]){ - { - .stepMode = WGPUVertexStepMode_Vertex, - .arrayStride = 20, - .attributeCount = 2, - .attributes = (WGPUVertexAttribute[]){ - { - .format = WGPUVertexFormat_Float32x3, - .offset = 0, - .shaderLocation = 0, - }, - { - .format = WGPUVertexFormat_Float32x2, - .offset = 12, - .shaderLocation = 1, - }, - }, - }, { .stepMode = WGPUVertexStepMode_Instance, .arrayStride = 12, diff --git a/src/shaders/spirv/character.spv b/src/shaders/spirv/character.spv index b4ea3cd..a2ab796 100644 Binary files a/src/shaders/spirv/character.spv and b/src/shaders/spirv/character.spv differ diff --git a/src/shaders/spirv/character_shadow.spv b/src/shaders/spirv/character_shadow.spv index c26060d..c8add25 100644 Binary files a/src/shaders/spirv/character_shadow.spv and b/src/shaders/spirv/character_shadow.spv differ diff --git a/src/shaders/spirv/world.spv b/src/shaders/spirv/world.spv index b007138..9837f01 100644 Binary files a/src/shaders/spirv/world.spv and b/src/shaders/spirv/world.spv differ diff --git a/src/shaders/src/character.slang b/src/shaders/src/character.slang index f55ce24..984db1c 100644 --- a/src/shaders/src/character.slang +++ b/src/shaders/src/character.slang @@ -5,9 +5,6 @@ struct VertexShaderInput { uint32_t vertex_index : SV_VulkanVertexID; - [vk::location(0)] float3 pos; - [vk::location(1)] float2 uv; - // Per Instance [vk::location(2)] float2 world_pos; [vk::location(3)] uint sprite_selection; @@ -27,12 +24,25 @@ struct FragmentShaderOutput { VertexShaderOutput main_vertex(VertexShaderInput input) { var output: VertexShaderOutput; - output.pos = mul(float4(input.world_pos + input.pos.xy, 0, 1), view_projection_matrix); + var vertex_pos = float2(0, 0); + var vertex_uv = float2(0, 0); + + switch (input.vertex_index) { + case 0: { vertex_pos = float2(-0.5, 0.5); vertex_uv = float2(0, 0); } break; + case 1: { vertex_pos = float2(-0.5, -0.5); vertex_uv = float2(0, 1); } break; + case 2: { vertex_pos = float2( 0.5, -0.5); vertex_uv = float2(1, 1); } break; + case 3: { vertex_pos = float2(-0.5, 0.5); vertex_uv = float2(0, 0); } break; + case 4: { vertex_pos = float2( 0.5, -0.5); vertex_uv = float2(1, 1); } break; + case 5: { vertex_pos = float2( 0.5, 0.5); vertex_uv = float2(1, 0); } break; + default: {} + } + + output.pos = mul(float4(input.world_pos + vertex_pos, 0, 1), view_projection_matrix); uint sprite_x = bitfieldExtract(input.sprite_selection, 16, 16); uint sprite_y = bitfieldExtract(input.sprite_selection, 0, 16); - output.uv = (float2(sprite_x, sprite_y) + input.uv) * (1.0 / 4.0); + output.uv = (float2(sprite_x, sprite_y) + vertex_uv) * (1.0 / 4.0); return output; } diff --git a/src/shaders/src/character_shadow.slang b/src/shaders/src/character_shadow.slang index ae88676..d6b29ec 100644 --- a/src/shaders/src/character_shadow.slang +++ b/src/shaders/src/character_shadow.slang @@ -5,9 +5,6 @@ struct VertexShaderInput { uint32_t vertex_index : SV_VulkanVertexID; - [vk::location(0)] float3 pos; - [vk::location(1)] float2 uv; - // Per Instance [vk::location(2)] float2 world_pos; }; @@ -26,10 +23,23 @@ struct FragmentShaderOutput { VertexShaderOutput main_vertex(VertexShaderInput input) { var output: VertexShaderOutput; - input.pos.xy *= 0.5; + var vertex_pos = float2(0, 0); + var vertex_uv = float2(0, 0); - output.pos = mul(float4(input.world_pos + input.pos.xy + float2(0, -0.35), 0, 1), view_projection_matrix); - output.uv = input.uv; + switch (input.vertex_index) { + case 0: { vertex_pos = float2(-0.5, 0.5); vertex_uv = float2(0, 0); } break; + case 1: { vertex_pos = float2(-0.5, -0.5); vertex_uv = float2(0, 1); } break; + case 2: { vertex_pos = float2( 0.5, -0.5); vertex_uv = float2(1, 1); } break; + case 3: { vertex_pos = float2(-0.5, 0.5); vertex_uv = float2(0, 0); } break; + case 4: { vertex_pos = float2( 0.5, -0.5); vertex_uv = float2(1, 1); } break; + case 5: { vertex_pos = float2( 0.5, 0.5); vertex_uv = float2(1, 0); } break; + default: {} + } + + vertex_pos *= 0.5; + + output.pos = mul(float4(input.world_pos + vertex_pos + float2(0, -0.35), 0, 1), view_projection_matrix); + output.uv = vertex_uv; return output; } diff --git a/src/shaders/src/world.slang b/src/shaders/src/world.slang index 0e69d83..0b92634 100644 --- a/src/shaders/src/world.slang +++ b/src/shaders/src/world.slang @@ -26,19 +26,25 @@ struct FragmentShaderOutput { VertexShaderOutput main_vertex(VertexShaderInput input) { var output: VertexShaderOutput; - let tile_pos = uint32_t2(input.instance_index % per_frame.map_width, input.instance_index / per_frame.map_width); - output.tile = map_texture.Load(uint32_t3(tile_pos, 0)); + var vertex_pos = float2(0, 0); + var vertex_uv = float2(0, 0); switch (input.vertex_index) { - case 0: { output.pos = mul(float4(float2(tile_pos) - float2(0.5, 0.5) + float2(-0.5, 0.5), 0, 1), view_projection_matrix); output.uv = float2(0, 0); } break; - case 1: { output.pos = mul(float4(float2(tile_pos) - float2(0.5, 0.5) + float2(-0.5, -0.5), 0, 1), view_projection_matrix); output.uv = float2(0, 1); } break; - case 2: { output.pos = mul(float4(float2(tile_pos) - float2(0.5, 0.5) + float2( 0.5, -0.5), 0, 1), view_projection_matrix); output.uv = float2(1, 1); } break; - case 3: { output.pos = mul(float4(float2(tile_pos) - float2(0.5, 0.5) + float2(-0.5, 0.5), 0, 1), view_projection_matrix); output.uv = float2(0, 0); } break; - case 4: { output.pos = mul(float4(float2(tile_pos) - float2(0.5, 0.5) + float2( 0.5, -0.5), 0, 1), view_projection_matrix); output.uv = float2(1, 1); } break; - case 5: { output.pos = mul(float4(float2(tile_pos) - float2(0.5, 0.5) + float2( 0.5, 0.5), 0, 1), view_projection_matrix); output.uv = float2(1, 0); } break; + case 0: { vertex_pos = float2(-1.0, 0.0); vertex_uv = float2(0, 0); } break; + case 1: { vertex_pos = float2(-1.0, -1.0); vertex_uv = float2(0, 1); } break; + case 2: { vertex_pos = float2( 0.0, -1.0); vertex_uv = float2(1, 1); } break; + case 3: { vertex_pos = float2(-1.0, 0.0); vertex_uv = float2(0, 0); } break; + case 4: { vertex_pos = float2( 0.0, -1.0); vertex_uv = float2(1, 1); } break; + case 5: { vertex_pos = float2( 0.0, 0.0); vertex_uv = float2(1, 0); } break; default: {} } + let tile_pos = uint32_t2(input.instance_index % per_frame.map_width, input.instance_index / per_frame.map_width); + + output.tile = map_texture.Load(uint32_t3(tile_pos, 0)); + output.pos = mul(float4(tile_pos + vertex_pos, 0, 1), view_projection_matrix); + output.uv = vertex_uv; + return output; } diff --git a/src/shaders/wgsl/character.wgsl b/src/shaders/wgsl/character.wgsl index 0f97f35..f50d42e 100644 --- a/src/shaders/wgsl/character.wgsl +++ b/src/shaders/wgsl/character.wgsl @@ -17,8 +17,6 @@ struct VertexShaderOutput_0 struct vertexInput_0 { - @location(0) pos_1 : vec3, - @location(1) uv_1 : vec2, @location(2) world_pos_0 : vec2, @location(3) sprite_selection_0 : u32, }; @@ -27,8 +25,53 @@ struct vertexInput_0 fn main_vertex( _S1 : vertexInput_0, @builtin(vertex_index) vertex_index_0 : u32) -> VertexShaderOutput_0 { 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(_S1.world_pos_0 + _S1.pos_1.xy, 0.0f, 1.0f)))); - output_0.uv_0 = (vec2(f32((u32(_S1.sprite_selection_0>>(u32(16)))&((((u32(1)<>(u32(0)))&((((u32(1)<(0.25f); + const _S2 : vec2 = vec2(0.0f, 0.0f); + var vertex_pos_0 : vec2; + var vertex_uv_0 : vec2; + switch(vertex_index_0) + { + case u32(0): + { + vertex_pos_0 = vec2(-0.5f, 0.5f); + vertex_uv_0 = _S2; + } + case u32(1): + { + const _S3 : vec2 = vec2(0.0f, 1.0f); + vertex_pos_0 = vec2(-0.5f, -0.5f); + vertex_uv_0 = _S3; + } + case u32(2): + { + const _S4 : vec2 = vec2(1.0f, 1.0f); + vertex_pos_0 = vec2(0.5f, -0.5f); + vertex_uv_0 = _S4; + } + case u32(3): + { + vertex_pos_0 = vec2(-0.5f, 0.5f); + vertex_uv_0 = _S2; + } + case u32(4): + { + const _S5 : vec2 = vec2(1.0f, 1.0f); + vertex_pos_0 = vec2(0.5f, -0.5f); + vertex_uv_0 = _S5; + } + case u32(5): + { + const _S6 : vec2 = vec2(1.0f, 0.0f); + vertex_pos_0 = vec2(0.5f, 0.5f); + vertex_uv_0 = _S6; + } + default : + { + vertex_pos_0 = _S2; + vertex_uv_0 = _S2; + } + } + 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(_S1.world_pos_0 + vertex_pos_0, 0.0f, 1.0f)))); + output_0.uv_0 = (vec2(f32((u32(_S1.sprite_selection_0>>(u32(16)))&((((u32(1)<>(u32(0)))&((((u32(1)<(0.25f); return output_0; } @@ -41,15 +84,15 @@ fn GetDimensions_0( texture_texture_0 : texture_2d, texture_sampler_0 : sa fn pixel_art_sample_0( input_texture_texture_0 : texture_2d, input_texture_sampler_0 : sampler, input_uv_0 : vec2) -> vec4 { var dimensions_0 : vec2; - var _S2 : f32 = dimensions_0[i32(0)]; - var _S3 : f32 = dimensions_0[i32(1)]; - GetDimensions_0(input_texture_texture_0, input_texture_sampler_0, &(_S2), &(_S3)); - dimensions_0[i32(0)] = _S2; - dimensions_0[i32(1)] = _S3; - var _S4 : vec2 = input_uv_0 * dimensions_0.xy; - var _S5 : vec2 = (floor(_S4) + min(fract(_S4) / (fwidth((_S4))), vec2(1.0f, 1.0f)) - vec2(0.5f)) / dimensions_0.xy; + var _S7 : f32 = dimensions_0[i32(0)]; + var _S8 : f32 = dimensions_0[i32(1)]; + GetDimensions_0(input_texture_texture_0, input_texture_sampler_0, &(_S7), &(_S8)); + dimensions_0[i32(0)] = _S7; + dimensions_0[i32(1)] = _S8; + var _S9 : vec2 = input_uv_0 * dimensions_0.xy; + var _S10 : vec2 = (floor(_S9) + min(fract(_S9) / (fwidth((_S9))), vec2(1.0f, 1.0f)) - vec2(0.5f)) / dimensions_0.xy; ; - return (textureSample((input_texture_texture_0), (input_texture_sampler_0), (_S5))); + return (textureSample((input_texture_texture_0), (input_texture_sampler_0), (_S10))); } struct FragmentShaderOutput_0 @@ -59,15 +102,15 @@ struct FragmentShaderOutput_0 struct pixelInput_0 { - @location(0) uv_2 : vec2, + @location(0) uv_1 : vec2, }; @fragment -fn main_fragment( _S6 : pixelInput_0, @builtin(position) pos_2 : vec4) -> FragmentShaderOutput_0 +fn main_fragment( _S11 : pixelInput_0, @builtin(position) pos_1 : vec4) -> FragmentShaderOutput_0 { var output_1 : FragmentShaderOutput_0; - var _S7 : vec4 = pixel_art_sample_0(texture1_texture_0, texture1_sampler_0, _S6.uv_2); - output_1.color_0 = vec4(_S7.xyz * tint_0.xyz, _S7.w); + var _S12 : vec4 = pixel_art_sample_0(texture1_texture_0, texture1_sampler_0, _S11.uv_1); + output_1.color_0 = vec4(_S12.xyz * tint_0.xyz, _S12.w); return output_1; } diff --git a/src/shaders/wgsl/character_shadow.wgsl b/src/shaders/wgsl/character_shadow.wgsl index f21029e..f08b69d 100644 --- a/src/shaders/wgsl/character_shadow.wgsl +++ b/src/shaders/wgsl/character_shadow.wgsl @@ -17,33 +17,62 @@ struct VertexShaderOutput_0 struct vertexInput_0 { - @location(0) pos_1 : vec3, - @location(1) uv_1 : vec2, @location(2) world_pos_0 : vec2, }; -struct VertexShaderInput_0 -{ - vertex_index_0 : u32, - pos_2 : vec3, - uv_2 : vec2, - world_pos_1 : vec2, -}; - @vertex -fn main_vertex( _S1 : vertexInput_0, @builtin(vertex_index) vertex_index_1 : u32) -> VertexShaderOutput_0 +fn main_vertex( _S1 : vertexInput_0, @builtin(vertex_index) vertex_index_0 : u32) -> VertexShaderOutput_0 { - var _S2 : VertexShaderInput_0; - _S2.vertex_index_0 = vertex_index_1; - _S2.pos_2 = _S1.pos_1; - _S2.uv_2 = _S1.uv_1; - _S2.world_pos_1 = _S1.world_pos_0; - var _S3 : vec2 = _S2.pos_2.xy * vec2(0.5f); - _S2.pos_2.x = _S3.x; - _S2.pos_2.y = _S3.y; 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(_S2.world_pos_1 + _S2.pos_2.xy + vec2(0.0f, -0.34999999403953552f), 0.0f, 1.0f)))); - output_0.uv_0 = _S2.uv_2; + const _S2 : vec2 = vec2(0.0f, 0.0f); + var vertex_uv_0 : vec2; + var vertex_pos_0 : vec2; + switch(vertex_index_0) + { + case u32(0): + { + const _S3 : vec2 = vec2(-0.5f, 0.5f); + vertex_uv_0 = _S2; + vertex_pos_0 = _S3; + } + case u32(1): + { + const _S4 : vec2 = vec2(-0.5f, -0.5f); + vertex_uv_0 = vec2(0.0f, 1.0f); + vertex_pos_0 = _S4; + } + case u32(2): + { + const _S5 : vec2 = vec2(0.5f, -0.5f); + vertex_uv_0 = vec2(1.0f, 1.0f); + vertex_pos_0 = _S5; + } + case u32(3): + { + const _S6 : vec2 = vec2(-0.5f, 0.5f); + vertex_uv_0 = _S2; + vertex_pos_0 = _S6; + } + case u32(4): + { + const _S7 : vec2 = vec2(0.5f, -0.5f); + vertex_uv_0 = vec2(1.0f, 1.0f); + vertex_pos_0 = _S7; + } + case u32(5): + { + const _S8 : vec2 = vec2(0.5f, 0.5f); + vertex_uv_0 = vec2(1.0f, 0.0f); + vertex_pos_0 = _S8; + } + default : + { + vertex_uv_0 = _S2; + vertex_pos_0 = _S2; + } + } + 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(_S1.world_pos_0 + vertex_pos_0 * vec2(0.5f) + vec2(0.0f, -0.34999999403953552f), 0.0f, 1.0f)))); + output_0.uv_0 = vertex_uv_0; return output_0; } @@ -56,15 +85,15 @@ fn GetDimensions_0( texture_texture_0 : texture_2d, texture_sampler_0 : sa fn pixel_art_sample_0( input_texture_texture_0 : texture_2d, input_texture_sampler_0 : sampler, input_uv_0 : vec2) -> vec4 { var dimensions_0 : vec2; - var _S4 : f32 = dimensions_0[i32(0)]; - var _S5 : f32 = dimensions_0[i32(1)]; - GetDimensions_0(input_texture_texture_0, input_texture_sampler_0, &(_S4), &(_S5)); - dimensions_0[i32(0)] = _S4; - dimensions_0[i32(1)] = _S5; - var _S6 : vec2 = input_uv_0 * dimensions_0.xy; - var _S7 : vec2 = (floor(_S6) + min(fract(_S6) / (fwidth((_S6))), vec2(1.0f, 1.0f)) - vec2(0.5f)) / dimensions_0.xy; + var _S9 : f32 = dimensions_0[i32(0)]; + var _S10 : f32 = dimensions_0[i32(1)]; + GetDimensions_0(input_texture_texture_0, input_texture_sampler_0, &(_S9), &(_S10)); + dimensions_0[i32(0)] = _S9; + dimensions_0[i32(1)] = _S10; + var _S11 : vec2 = input_uv_0 * dimensions_0.xy; + var _S12 : vec2 = (floor(_S11) + min(fract(_S11) / (fwidth((_S11))), vec2(1.0f, 1.0f)) - vec2(0.5f)) / dimensions_0.xy; ; - return (textureSample((input_texture_texture_0), (input_texture_sampler_0), (_S7))); + return (textureSample((input_texture_texture_0), (input_texture_sampler_0), (_S12))); } struct FragmentShaderOutput_0 @@ -74,15 +103,15 @@ struct FragmentShaderOutput_0 struct pixelInput_0 { - @location(0) uv_3 : vec2, + @location(0) uv_1 : vec2, }; @fragment -fn main_fragment( _S8 : pixelInput_0, @builtin(position) pos_3 : vec4) -> FragmentShaderOutput_0 +fn main_fragment( _S13 : pixelInput_0, @builtin(position) pos_1 : vec4) -> FragmentShaderOutput_0 { var output_1 : FragmentShaderOutput_0; - var _S9 : vec4 = pixel_art_sample_0(texture1_texture_0, texture1_sampler_0, _S8.uv_3); - output_1.color_0 = vec4(_S9.xyz * tint_0.xyz, _S9.w); + var _S14 : vec4 = pixel_art_sample_0(texture1_texture_0, texture1_sampler_0, _S13.uv_1); + output_1.color_0 = vec4(_S14.xyz * tint_0.xyz, _S14.w); return output_1; } diff --git a/src/shaders/wgsl/world.wgsl b/src/shaders/wgsl/world.wgsl index 0287dfb..b905419 100644 --- a/src/shaders/wgsl/world.wgsl +++ b/src/shaders/wgsl/world.wgsl @@ -34,49 +34,59 @@ struct VertexShaderOutput_0 @vertex fn main_vertex(@builtin(vertex_index) vertex_index_0 : u32, @builtin(instance_index) instance_index_0 : u32) -> VertexShaderOutput_0 { - var _S1 : u32 = instance_index_0 % per_frame_0.map_width_0; - var _S2 : u32 = instance_index_0 / per_frame_0.map_width_0; - var _S3 : vec2 = vec2(_S1, _S2); var output_0 : VertexShaderOutput_0; - var _S4 : vec3 = vec3(vec3(_S3, u32(0))); - output_0.tile_0 = (textureLoad((map_texture_0), ((_S4)).xy, ((_S4)).z).x); + const _S1 : vec2 = vec2(0.0f, 0.0f); + var vertex_pos_0 : vec2; + var vertex_uv_0 : vec2; switch(vertex_index_0) { case u32(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(vec2(_S3) - vec2(0.5f, 0.5f) + vec2(-0.5f, 0.5f), 0.0f, 1.0f)))); - output_0.uv_0 = vec2(0.0f, 0.0f); + vertex_pos_0 = vec2(-1.0f, 0.0f); + vertex_uv_0 = _S1; } case u32(1): { - 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(vec2(_S3) - vec2(0.5f, 0.5f) + vec2(-0.5f, -0.5f), 0.0f, 1.0f)))); - output_0.uv_0 = vec2(0.0f, 1.0f); + const _S2 : vec2 = vec2(0.0f, 1.0f); + vertex_pos_0 = vec2(-1.0f, -1.0f); + vertex_uv_0 = _S2; } case u32(2): { - 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(vec2(_S3) - vec2(0.5f, 0.5f) + vec2(0.5f, -0.5f), 0.0f, 1.0f)))); - output_0.uv_0 = vec2(1.0f, 1.0f); + const _S3 : vec2 = vec2(1.0f, 1.0f); + vertex_pos_0 = vec2(0.0f, -1.0f); + vertex_uv_0 = _S3; } case u32(3): { - 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(vec2(_S3) - vec2(0.5f, 0.5f) + vec2(-0.5f, 0.5f), 0.0f, 1.0f)))); - output_0.uv_0 = vec2(0.0f, 0.0f); + vertex_pos_0 = vec2(-1.0f, 0.0f); + vertex_uv_0 = _S1; } case u32(4): { - 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(vec2(_S3) - vec2(0.5f, 0.5f) + vec2(0.5f, -0.5f), 0.0f, 1.0f)))); - output_0.uv_0 = vec2(1.0f, 1.0f); + const _S4 : vec2 = vec2(1.0f, 1.0f); + vertex_pos_0 = vec2(0.0f, -1.0f); + vertex_uv_0 = _S4; } case u32(5): { - const _S5 : vec2 = vec2(0.5f, 0.5f); - 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(vec2(_S3) - _S5 + _S5, 0.0f, 1.0f)))); - output_0.uv_0 = vec2(1.0f, 0.0f); + const _S5 : vec2 = vec2(1.0f, 0.0f); + vertex_pos_0 = _S1; + vertex_uv_0 = _S5; } default : { + vertex_pos_0 = _S1; + vertex_uv_0 = _S1; } } + var _S6 : u32 = instance_index_0 % per_frame_0.map_width_0; + var _S7 : u32 = instance_index_0 / per_frame_0.map_width_0; + var _S8 : vec2 = vec2(_S6, _S7); + var _S9 : vec3 = vec3(vec3(_S8, u32(0))); + output_0.tile_0 = (textureLoad((map_texture_0), ((_S9)).xy, ((_S9)).z).x); + 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(vec2(_S8) + vertex_pos_0, 0.0f, 1.0f)))); + output_0.uv_0 = vertex_uv_0; return output_0; } @@ -88,16 +98,16 @@ fn CombinedTextureSampler_Sample_0( this_texture_0 : texture_2d, this_samp fn pixel_art_sample_0( input_texture_texture_0 : texture_2d, input_texture_sampler_0 : sampler, input_uv_0 : vec2, tile_uv_0 : vec4) -> vec4 { var dimensions_0 : vec2; - var _S6 : f32 = dimensions_0[i32(0)]; - var _S7 : f32 = dimensions_0[i32(1)]; - {var dim = textureDimensions((input_texture_texture_0));((_S6)) = f32(dim.x);((_S7)) = f32(dim.y);}; - dimensions_0[i32(0)] = _S6; - dimensions_0[i32(1)] = _S7; - var _S8 : vec2 = tile_uv_0.xy; - var _S9 : vec2 = tile_uv_0.zw; - var _S10 : vec2 = mix(_S8, _S9, input_uv_0); - var _S11 : vec2 = vec2(0.5f); - return CombinedTextureSampler_Sample_0(input_texture_texture_0, input_texture_sampler_0, clamp((floor(_S10) + saturate(fract(_S10) / (fwidth((_S10)))) - _S11) / dimensions_0, (_S8 + _S11) / dimensions_0, (_S9 - _S11) / dimensions_0)); + var _S10 : f32 = dimensions_0[i32(0)]; + var _S11 : f32 = dimensions_0[i32(1)]; + {var dim = textureDimensions((input_texture_texture_0));((_S10)) = f32(dim.x);((_S11)) = f32(dim.y);}; + dimensions_0[i32(0)] = _S10; + dimensions_0[i32(1)] = _S11; + var _S12 : vec2 = tile_uv_0.xy; + var _S13 : vec2 = tile_uv_0.zw; + var _S14 : vec2 = mix(_S12, _S13, input_uv_0); + var _S15 : vec2 = vec2(0.5f); + return CombinedTextureSampler_Sample_0(input_texture_texture_0, input_texture_sampler_0, clamp((floor(_S14) + saturate(fract(_S14) / (fwidth((_S14)))) - _S15) / dimensions_0, (_S12 + _S15) / dimensions_0, (_S13 - _S15) / dimensions_0)); } struct FragmentShaderOutput_0 @@ -112,11 +122,11 @@ struct pixelInput_0 }; @fragment -fn main_fragment( _S12 : pixelInput_0, @builtin(position) pos_1 : vec4) -> FragmentShaderOutput_0 +fn main_fragment( _S16 : pixelInput_0, @builtin(position) pos_1 : vec4) -> FragmentShaderOutput_0 { var output_1 : FragmentShaderOutput_0; - var _S13 : vec4 = pixel_art_sample_0(block2_tile_atlas_texture_0, block2_tile_atlas_sampler_0, _S12.uv_1, block2_tile_uvs_0[_S12.tile_1]); - output_1.color_0 = vec4(_S13.xyz * block3_tint_0.xyz, _S13.w); + var _S17 : vec4 = pixel_art_sample_0(block2_tile_atlas_texture_0, block2_tile_atlas_sampler_0, _S16.uv_1, block2_tile_uvs_0[_S16.tile_1]); + output_1.color_0 = vec4(_S17.xyz * block3_tint_0.xyz, _S17.w); return output_1; }