From c5f07f09902646a37a73c0f3b32102902a99b69f Mon Sep 17 00:00:00 2001
From: Ethan Lee <[EMAIL REDACTED]>
Date: Tue, 1 Sep 2026 08:25:20 -0400
Subject: [PATCH] gpu: Return early when attempting to bind 0 samplers.
This is a common occurrence for vertex shaders specifically, and allows backends
to not have to handle this edge case every time.
---
src/gpu/SDL_gpu.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/gpu/SDL_gpu.c b/src/gpu/SDL_gpu.c
index 1c41f5ed299e4..a63bbaf4a9846 100644
--- a/src/gpu/SDL_gpu.c
+++ b/src/gpu/SDL_gpu.c
@@ -2109,6 +2109,10 @@ void SDL_BindGPUVertexSamplers(
}
}
+ if (num_bindings == 0) {
+ return;
+ }
+
RENDERPASS_DEVICE->BindVertexSamplers(
RENDERPASS_COMMAND_BUFFER,
first_slot,
@@ -2216,6 +2220,10 @@ void SDL_BindGPUFragmentSamplers(
}
}
+ if (num_bindings == 0) {
+ return;
+ }
+
RENDERPASS_DEVICE->BindFragmentSamplers(
RENDERPASS_COMMAND_BUFFER,
first_slot,