Skip to content

Commit 07a2eac

Browse files
committed
Some PhysDev Feature Addition and Maintanance + Checks
1 parent b674b06 commit 07a2eac

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

include/nbl/video/IPhysicalDevice.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ class IPhysicalDevice : public core::Interface, public core::Unmovable
158158

159159
// Queries
160160
bool allowCommandBufferQueryCopies = false;
161+
bool inheritedQueries = false;
161162

162163
// Buffer Device Address
163164
bool bufferDeviceAddress = false;

src/nbl/video/COpenGLCommandBuffer.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,14 @@ COpenGLCommandBuffer::~COpenGLCommandBuffer()
941941
case impl::ECT_COPY_QUERY_POOL_RESULTS:
942942
{
943943
auto& c = cmd.get<impl::ECT_COPY_QUERY_POOL_RESULTS>();
944-
944+
945+
const IPhysicalDevice* physdev = getOriginDevice()->getPhysicalDevice();
946+
if(!physdev->getFeatures().allowCommandBufferQueryCopies)
947+
{
948+
assert(false); // allowCommandBufferQueryCopies feature not enabled -> can't write query results to buffer
949+
break;
950+
}
951+
945952
const COpenGLBuffer* buffer = static_cast<const COpenGLBuffer*>(c.dstBuffer.get());
946953
const COpenGLQueryPool* qp = IBackendObject::compatibility_cast<const COpenGLQueryPool*>(c.queryPool.get(), this);
947954
auto queryPoolQueriesCount = qp->getCreationParameters().queryCount;

src/nbl/video/CVulkanPhysicalDevice.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ class CVulkanPhysicalDevice final : public IPhysicalDevice
170170
m_features.shaderSubgroupQuad = subgroupProperties.supportedOperations & VK_SUBGROUP_FEATURE_QUAD_BIT;
171171
m_features.shaderSubgroupQuadAllStages = ((subgroupProperties.supportedStages & asset::IShader::E_SHADER_STAGE::ESS_ALL)
172172
== asset::IShader::E_SHADER_STAGE::ESS_ALL);
173+
m_features.inheritedQueries = features.inheritedQueries;
173174

174175
// RayQuery
175176
if (m_availableFeatureSet.find(VK_KHR_RAY_QUERY_EXTENSION_NAME) != m_availableFeatureSet.end())
@@ -434,7 +435,10 @@ class CVulkanPhysicalDevice final : public IPhysicalDevice
434435
VkPhysicalDeviceFeatures2 vk_deviceFeatures2 = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2 };
435436
vk_deviceFeatures2.pNext = firstFeatureInChain;
436437
vk_deviceFeatures2.features = {};
438+
// Enabled Logical Device Features By Default:
439+
// TODO: seperate logical and physical device features.
437440
vk_deviceFeatures2.features.samplerAnisotropy = m_features.samplerAnisotropy;
441+
vk_deviceFeatures2.features.inheritedQueries = m_features.inheritedQueries;
438442

439443
// Create Device
440444
VkDeviceCreateInfo vk_createInfo = { VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO };

src/nbl/video/IOpenGL_PhysicalDeviceBase.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,15 +334,17 @@ class IOpenGL_PhysicalDeviceBase : public IPhysicalDevice, public IOpenGLPhysica
334334
{
335335
m_features.allowCommandBufferQueryCopies = true;
336336
}
337+
m_features.inheritedQueries = true; // We emulate secondary command buffers so enable by default
337338

338339
if (m_glfeatures.isFeatureAvailable(m_glfeatures.NBL_EXT_texture_filter_anisotropic))
339340
{
340341
GetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &num);
341342
m_glfeatures.MaxAnisotropy = static_cast<uint8_t>(num);
343+
m_features.samplerAnisotropy = true;
344+
m_limits.maxSamplerAnisotropyLog2 = std::log2((float)m_glfeatures.MaxAnisotropy);
342345
}
343346
else m_glfeatures.MaxAnisotropy = 0u;
344347

345-
346348
if (m_glfeatures.isFeatureAvailable(m_glfeatures.NBL_ARB_geometry_shader4))
347349
{
348350
GetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES, &num);

0 commit comments

Comments
 (0)