diff options
| author | skal <pascal.massimino@gmail.com> | 2026-05-21 08:10:47 +0200 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-05-21 08:10:47 +0200 |
| commit | d806027dcaeadcdd8d2febd88bc46b2fd2c465de (patch) | |
| tree | 30bc1ef9f40ccab7c00e31ee20e62bb86755fa26 /src/gpu/gpu.cc | |
| parent | 680042a18c11ad5e58757e45b260745c2f52417f (diff) | |
Diffstat (limited to 'src/gpu/gpu.cc')
| -rw-r--r-- | src/gpu/gpu.cc | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/gpu/gpu.cc b/src/gpu/gpu.cc index f5f1515..3200655 100644 --- a/src/gpu/gpu.cc +++ b/src/gpu/gpu.cc @@ -138,14 +138,18 @@ WGPUShaderModule gpu_create_shader_module(WGPUDevice device, } WGPUSampler gpu_create_linear_sampler(WGPUDevice device) { - WGPUSampler s = SamplerCache::Get().get_or_create(device, SamplerCache::clamp()); - if (s) wgpuSamplerAddRef(s); // Caller owns a reference (for RAII wrappers) + WGPUSampler s = + SamplerCache::Get().get_or_create(device, SamplerCache::clamp()); + if (s) + wgpuSamplerAddRef(s); // Caller owns a reference (for RAII wrappers) return s; } WGPUSampler gpu_create_nearest_sampler(WGPUDevice device) { - WGPUSampler s = SamplerCache::Get().get_or_create(device, SamplerCache::nearest()); - if (s) wgpuSamplerAddRef(s); // Caller owns a reference (for RAII wrappers) + WGPUSampler s = + SamplerCache::Get().get_or_create(device, SamplerCache::nearest()); + if (s) + wgpuSamplerAddRef(s); // Caller owns a reference (for RAII wrappers) return s; } @@ -170,8 +174,8 @@ RenderPass gpu_create_render_pass(WGPUDevice device, WGPUTextureFormat format, // Compose shader to resolve #include directives std::string composed_shader = ShaderComposer::Get().Compose({}, shader_code); - WGPUShaderModule shader_module = - gpu_create_shader_module(device, composed_shader.c_str(), "render_shader"); + WGPUShaderModule shader_module = gpu_create_shader_module( + device, composed_shader.c_str(), "render_shader"); // Create Bind Group Layout & Bind Group std::vector<WGPUBindGroupLayoutEntry> bgl_entries; @@ -268,8 +272,8 @@ ComputePass gpu_create_compute_pass(WGPUDevice device, const char* shader_code, // Compose shader to resolve #include directives std::string composed_shader = ShaderComposer::Get().Compose({}, shader_code); - WGPUShaderModule shader_module = - gpu_create_shader_module(device, composed_shader.c_str(), "compute_shader"); + WGPUShaderModule shader_module = gpu_create_shader_module( + device, composed_shader.c_str(), "compute_shader"); std::vector<WGPUBindGroupLayoutEntry> bgl_entries; std::vector<WGPUBindGroupEntry> bg_entries; @@ -379,7 +383,7 @@ void gpu_init(PlatformState* platform_state) { // Exclude GL backend: wgpu's WGL pixel-format selection panics under Wine. WGPUInstanceExtras win_extras = {}; win_extras.chain.sType = (WGPUSType)WGPUSType_InstanceExtras; - win_extras.backends = WGPUInstanceBackend_Primary; // Vulkan + DX12, no GL + win_extras.backends = WGPUInstanceBackend_Primary; // Vulkan + DX12, no GL WGPUInstanceDescriptor win_desc = {}; win_desc.nextInChain = (WGPUChainedStruct*)&win_extras; g_instance = wgpuCreateInstance(&win_desc); @@ -435,7 +439,6 @@ void gpu_init(PlatformState* platform_state) { wgpuSurfaceConfigure(g_surface, &g_config); InitShaderComposer(); - } void gpu_resize(int width, int height) { |
