Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/ray_query_geometry_creator_example'
Browse files Browse the repository at this point in the history
  • Loading branch information
devsh committed Nov 20, 2024
2 parents f1b65e9 + 039734a commit 3a046cd
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
5 changes: 0 additions & 5 deletions include/nbl/application_templates/MonoDeviceApplication.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,11 @@ class MonoDeviceApplication : public virtual MonoSystemMonoLoggerApplication
}

// These features are features you'll enable if present but won't interfere with your choice of device
// There's no intersection operator (yet) on the features, so its not used yet!
// virtual function so you can override as needed for some example father down the line
virtual video::SPhysicalDeviceFeatures getPreferredDeviceFeatures() const
{
video::SPhysicalDeviceFeatures retval = {};

/*retval.shaderFloat64 = true;
retval.shaderDrawParameters = true;
retval.drawIndirectCount = true;*/

return retval;
}

Expand Down
6 changes: 6 additions & 0 deletions include/nbl/builtin/hlsl/spirv_intrinsics/core.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ SquareMatrix matrixInverse(NBL_CONST_REF_ARG(SquareMatrix) mat);
[[vk::ext_instruction(GLSLstd450UnpackSnorm2x16, "GLSL.std.450")]]
float32_t2 unpackSnorm2x16(uint32_t p);

[[vk::ext_instruction(GLSLstd450UnpackSnorm4x8, "GLSL.std.450")]]
float32_t4 unpackSnorm4x8(uint32_t p);

[[vk::ext_instruction(GLSLstd450UnpackUnorm4x8, "GLSL.std.450")]]
float32_t4 unpackUnorm4x8(uint32_t p);

// Memory Semantics link here: https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#Memory_Semantics_-id-

// https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_memory_semantics_id
Expand Down
2 changes: 1 addition & 1 deletion include/nbl/video/ILogicalDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ class NBL_API2 ILogicalDevice : public core::IReferenceCounted, public IDeviceMe
NBL_LOG_ERROR("The queryPool was not created by this device");
return false;
}
if (firstQuery + queryCount >= queryPool->getCreationParameters().queryCount)
if (firstQuery + queryCount > queryPool->getCreationParameters().queryCount)
{
NBL_LOG_ERROR("Query index out of bounds");
return false;
Expand Down
4 changes: 3 additions & 1 deletion include/nbl/video/utilities/IUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,9 @@ class NBL_API2 IUtilities : public core::IReferenceCounted
auto buffer = m_device->createBuffer(std::move(params));
auto mreqs = buffer->getMemoryReqs();
mreqs.memoryTypeBits &= m_device->getPhysicalDevice()->getDeviceLocalMemoryTypeBits();
auto mem = m_device->allocate(mreqs,buffer.get());
auto allocFlags = (params.usage & asset::IBuffer::EUF_SHADER_DEVICE_ADDRESS_BIT) ?
IDeviceMemoryAllocation::E_MEMORY_ALLOCATE_FLAGS::EMAF_DEVICE_ADDRESS_BIT : IDeviceMemoryAllocation::E_MEMORY_ALLOCATE_FLAGS::EMAF_NONE;
auto mem = m_device->allocate(mreqs,buffer.get(), allocFlags);

auto submitSuccess = autoSubmit(
submit,
Expand Down
2 changes: 1 addition & 1 deletion src/nbl/video/CVulkanAccelerationStructure.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void getVkASGeometryFrom(const IGPUBottomLevelAccelerationStructure::Triangles<c
outBase.geometry.triangles.vertexData = QueryOnly ? NullAddress:getVkDeviceOrHostAddress<const BufferType>(triangles.vertexData[0]);
outBase.geometry.triangles.vertexStride = triangles.vertexStride;
outBase.geometry.triangles.maxVertex = triangles.maxVertex;
outBase.geometry.triangles.indexType = static_cast<VkIndexType>(triangles.indexType);
outBase.geometry.triangles.indexType = (triangles.indexType == asset::E_INDEX_TYPE::EIT_UNKNOWN) ? VK_INDEX_TYPE_NONE_KHR : static_cast<VkIndexType>(triangles.indexType);
outBase.geometry.triangles.indexData = QueryOnly ? NullAddress:getVkDeviceOrHostAddress<const BufferType>(triangles.indexData);
// except that the hostAddress member of VkAccelerationStructureGeometryTrianglesDataKHR::transformData will be examined to check if it is NULL.
if (!triangles.hasTransform())
Expand Down

0 comments on commit 3a046cd

Please sign in to comment.