Skip to content

Commit c1d8428

Browse files
committed
Refactor: Removed ~0u conversion as I had forgotten that I had resolved this problem already.
1 parent e24094d commit c1d8428

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

include/SDL3/SDL_gpu.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,10 @@
304304
#ifndef SDL_gpu_h_
305305
#define SDL_gpu_h_
306306

307-
#include <SDL3/SDL_gpu.h>
307+
#include <SDL3/SDL_stdinc.h>
308308
#include <SDL3/SDL_pixels.h>
309309
#include <SDL3/SDL_properties.h>
310310
#include <SDL3/SDL_rect.h>
311-
#include <SDL3/SDL_stdinc.h>
312311
#include <SDL3/SDL_surface.h>
313312
#include <SDL3/SDL_video.h>
314313

src/gpu/SDL_gpu.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ void SDL_GPU_BlitCommon(
318318
1,
319319
NULL);
320320

321-
322321
viewport.x = (float)info->destination.x;
323322
viewport.y = (float)info->destination.y;
324323
viewport.w = (float)info->destination.w;
@@ -1412,15 +1411,6 @@ SDL_GPURenderPass *SDL_BeginGPURenderPass(
14121411
SDL_assert_release(!"Cannot cycle color target when load op is LOAD!");
14131412
}
14141413

1415-
// Get hint to check for "webgpu"
1416-
const char *backend = SDL_GetHint(SDL_HINT_GPU_DRIVER);
1417-
bool is_webgpu = SDL_strcasecmp(backend, "webgpu") == 0;
1418-
1419-
// WebGPU uses ~0u for default layer_or_depth_plane, however this causes issues with other backends
1420-
if (color_target_infos[i].layer_or_depth_plane == ~0u && !is_webgpu) {
1421-
SDL_memset((void *)&color_target_infos[i].layer_or_depth_plane, 0, sizeof(color_target_infos[i].layer_or_depth_plane));
1422-
}
1423-
14241414
if (color_target_infos[i].store_op == SDL_GPU_STOREOP_RESOLVE || color_target_infos[i].store_op == SDL_GPU_STOREOP_RESOLVE_AND_STORE) {
14251415
if (color_target_infos[i].resolve_texture == NULL) {
14261416
SDL_assert_release(!"Store op is RESOLVE or RESOLVE_AND_STORE but resolve_texture is NULL!");

src/gpu/webgpu/SDL_gpu_webgpu.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333
#include <regex.h>
3434

3535
// TODO: REMOVE
36-
// Code compiles without these but my IDE is complaining without them
37-
#include "../../../include/SDL3/SDL_atomic.h"
38-
#include "../../../include/SDL3/SDL_gpu.h"
36+
// Code compiles without these but my LSP freaks out without them
37+
#include <SDL3/SDL_gpu.h>
38+
#include <SDL3/SDL_atomic.h>
3939

40-
// I currently have a copy of the webgpu.h file in the include directory:
40+
// I currently have a copy of the webgpu.h file in the local include directory:
4141
// - usr/local/include/webgpu/webgpu.h
4242
// it can be downloaded from here: https://github.com/webgpu-native/webgpu-headers/blob/main/webgpu.h
4343
//
44-
// THIS IS A TEMPORARY SOLUTION
44+
// The code compiles without it as long as Emscripten is used and the -sUSE_WEBGPU flag is set
4545
#include <webgpu/webgpu.h>
4646

4747
#define MAX_UBO_SECTION_SIZE 4096 // 4 KiB
@@ -2202,6 +2202,7 @@ void WebGPU_BeginRenderPass(SDL_GPUCommandBuffer *commandBuffer,
22022202

22032203
WebGPUCommandBuffer *wgpu_cmd_buf = (WebGPUCommandBuffer *)commandBuffer;
22042204
if (!wgpu_cmd_buf || colorAttachmentCount == 0) {
2205+
SDL_LogError(SDL_LOG_CATEGORY_GPU, "Invalid parameters for render pass");
22052206
return;
22062207
}
22072208

@@ -2286,6 +2287,7 @@ void WebGPU_BeginRenderPass(SDL_GPUCommandBuffer *commandBuffer,
22862287
.depthStencilAttachment = depthStencilAttachmentInfo ? &depthStencilAttachment : NULL
22872288
};
22882289

2290+
// Create the render pass encoder
22892291
wgpu_cmd_buf->renderPassEncoder =
22902292
wgpuCommandEncoderBeginRenderPass(wgpu_cmd_buf->commandEncoder, &renderPassDesc);
22912293

0 commit comments

Comments
 (0)