Skip to content

Commit 0a4669b

Browse files
Merge pull request #756 from Devsh-Graphics-Programming/asset-conversion-v3
Asset conversion v3
2 parents 739e9ec + 3ce0eba commit 0a4669b

File tree

14 files changed

+662
-1003
lines changed

14 files changed

+662
-1003
lines changed

include/nbl/asset/IDescriptorSet.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ class IDescriptorSet : public virtual core::IReferenceCounted // TODO: try to re
8585
info.buffer.offset = range.offset;
8686
info.buffer.size = range.size;
8787
}
88+
template<typename ImageType>
89+
SDescriptorInfo(const core::smart_refctd_ptr<IImageView<ImageType>>& image, const IImage::LAYOUT layout, const core::smart_refctd_ptr<typename layout_t::sampler_type>& sampler={}) : desc()
90+
{
91+
desc = image;
92+
info.image.imageLayout = layout;
93+
info.combinedImageSampler.sampler = sampler;
94+
}
8895
SDescriptorInfo(const SDescriptorInfo& other) : SDescriptorInfo()
8996
{
9097
operator=(other);

include/nbl/asset/IImageView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class IImageView : public IImageViewBase
123123
// declared some usages but they are not a subset
124124
{
125125
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkImageViewCreateInfo.html#VUID-VkImageViewCreateInfo-pNext-02663
126-
if (subresourceRange.aspectMask.hasFlags(IImage::EAF_STENCIL_BIT) && !imgParams.stencilUsage.hasFlags(_params.subUsages))
126+
if (subresourceRange.aspectMask.hasFlags(IImage::EAF_STENCIL_BIT) && !imgParams.actualStencilUsage().hasFlags(_params.subUsages))
127127
return false;
128128
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkImageViewCreateInfo.html#VUID-VkImageViewCreateInfo-pNext-02664
129129
if ((subresourceRange.aspectMask.value&(~IImage::EAF_STENCIL_BIT)) && !imgParams.usage.hasFlags(_params.subUsages))

include/nbl/core/util/bitflag.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct bitflag final
3636
constexpr bool operator!=(const bitflag<ENUM_TYPE> rhs) const {return value!=rhs.value;}
3737
constexpr bool operator==(const bitflag<ENUM_TYPE> rhs) const {return value==rhs.value;}
3838
constexpr bool hasFlags(const bitflag<ENUM_TYPE> val) const {return (static_cast<UNDERLYING_TYPE>(value) & static_cast<UNDERLYING_TYPE>(val.value)) == static_cast<UNDERLYING_TYPE>(val.value);}
39+
constexpr bool hasAnyFlag(const bitflag<ENUM_TYPE> val) const {return (static_cast<UNDERLYING_TYPE>(value) & static_cast<UNDERLYING_TYPE>(val.value)) != static_cast<UNDERLYING_TYPE>(0);}
3940
};
4041

4142
template<typename T, typename Dummy>

include/nbl/video/IAPIConnection.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ class NBL_API2 IAPIConnection : public core::IReferenceCounted
5959

6060
std::span<IPhysicalDevice* const> getPhysicalDevices() const;
6161

62-
const SFeatures& getEnabledFeatures() const { return m_enabledFeatures; };
62+
const SFeatures& getEnabledFeatures() const { return m_enabledFeatures; }
63+
64+
const bool isRunningInRenderdoc() const { return m_rdoc_api; }
6365

6466
protected:
6567
IAPIConnection(const SFeatures& enabledFeatures);

include/nbl/video/IGPUCommandBuffer.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,27 @@ class NBL_API2 IGPUCommandBuffer : public IBackendObject
7878
return false;
7979
}
8080

81+
// This lets us know if not submitting this cmdbuf has no side-effects
82+
// TODO: should we track the `bind` and `set{$DynamicState}` commands?
83+
inline bool empty() const
84+
{
85+
switch (m_state)
86+
{
87+
case STATE::RECORDING:
88+
[[fallthrough]];
89+
case STATE::EXECUTABLE:
90+
[[fallthrough]];
91+
case STATE::PENDING:
92+
if (m_noCommands)
93+
return false;
94+
[[fallthrough]];
95+
default:
96+
return true;
97+
}
98+
}
99+
// if you use `getNativeHandle()` to record some custom commands between `begin()` and `end()`
100+
inline void setNotEmtpy() {m_noCommands = true;}
101+
81102
//! Begin, Reset, End
82103
enum class USAGE : uint8_t
83104
{
@@ -787,6 +808,7 @@ class NBL_API2 IGPUCommandBuffer : public IBackendObject
787808

788809
uint64_t m_resetCheckedStamp;
789810
STATE m_state = STATE::INITIAL;
811+
bool m_noCommands = true;
790812
// only useful while recording
791813
SInheritanceInfo m_cachedInheritanceInfo;
792814
core::bitflag<USAGE> m_recordingFlags = USAGE::NONE;

0 commit comments

Comments
 (0)