Skip to content

Commit 9ab9a10

Browse files
make the signatures of viewports and scissors even nicer
also add more sane defaults
1 parent 50ec6b1 commit 9ab9a10

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

include/nbl/asset/RasterizationStates.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ namespace nbl::asset
1515

1616
struct SViewport
1717
{
18-
float x, y;
18+
float x = 0.f;
19+
float y = 0.f;
1920
float width, height;
20-
float minDepth, maxDepth;
21+
// Reverse-Z is our framework default
22+
float minDepth = 1.f;
23+
float maxDepth = 0.f;
2124
};
2225

2326

include/nbl/video/IGPUCommandBuffer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ class NBL_API2 IGPUCommandBuffer : public IBackendObject
301301
bool bindIndexBuffer(const asset::SBufferBinding<const IGPUBuffer>& binding, const asset::E_INDEX_TYPE indexType);
302302

303303
//! dynamic state
304-
inline bool setScissor(const uint32_t first, const std::span<const VkRect2D> scissors)
304+
inline bool setScissor(const std::span<const VkRect2D> scissors, const uint32_t first=0)
305305
{
306306
const uint32_t count = scissors.size();
307307
if(invalidDynamic(first,count))
@@ -321,9 +321,9 @@ class NBL_API2 IGPUCommandBuffer : public IBackendObject
321321
}
322322
[[deprecated]] inline bool setScissor(const uint32_t first, const uint32_t count, const VkRect2D* const pScissors)
323323
{
324-
return setScissor(first,{pScissors,count});
324+
return setScissor({pScissors,count},first);
325325
}
326-
inline bool setViewport(const uint32_t first, const std::span<const asset::SViewport> viewports)
326+
inline bool setViewport(const std::span<const asset::SViewport> viewports, const uint32_t first=0)
327327
{
328328
const uint32_t count = viewports.size();
329329
if (invalidDynamic(first,count))
@@ -333,7 +333,7 @@ class NBL_API2 IGPUCommandBuffer : public IBackendObject
333333
}
334334
[[deprecated]] inline bool setViewport(const uint32_t first, const uint32_t count, const asset::SViewport* const pViewports)
335335
{
336-
return setViewport(first,{pViewports,count});
336+
return setViewport({pViewports,count},first);
337337
}
338338
bool setLineWidth(const float width);
339339
inline bool setDepthBias(const float depthBiasConstantFactor, const float depthBiasClamp, const float depthBiasSlopeFactor)

0 commit comments

Comments
 (0)