Skip to content

Commit 08de596

Browse files
committed
dkCmdBufBindTextures: allow slots 32-39 (overlapping with image slots 0-7)
1 parent c1849f7 commit 08de596

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

source/cmd_bind_common.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ namespace
1919

2020
constexpr bool checkInRange(uint32_t base, uint32_t size, uint32_t max)
2121
{
22-
uint32_t end = base + size;
2322
// Avoid ( ͡° ͜ʖ ͡°) overflows and underflows
24-
return end >= base && end <= max;
23+
return base <= max && (max - base) >= size;
2524
}
2625

2726
DkResult checkBuffers(DkBufExtents const buffers[], uint32_t numBuffers, uint32_t bufAlign, uint32_t maxSize)
@@ -241,7 +240,7 @@ void dkCmdBufBindTextures(DkCmdBuf obj, DkStage stage, uint32_t firstId, DkResHa
241240
DK_ENTRYPOINT(obj);
242241
DK_DEBUG_BAD_INPUT(stage < DkStage_Vertex || stage > DkStage_Compute, "invalid stage");
243242
DK_DEBUG_NON_NULL_ARRAY(handles, numHandles);
244-
DK_DEBUG_BAD_INPUT(!checkInRange(firstId, numHandles, DK_NUM_TEXTURE_BINDINGS));
243+
DK_DEBUG_BAD_INPUT(!checkInRange(firstId, numHandles, DK_NUM_TEXTURE_BINDINGS+DK_NUM_IMAGE_BINDINGS));
245244
CmdBufWriter w{obj};
246245

247246
if (stage == DkStage_Compute)

0 commit comments

Comments
 (0)