Skip to content

Commit 3d7ded6

Browse files
committed
Merge branch 'master' into iridescence_bxdf
2 parents 0984c7e + b7f3dfb commit 3d7ded6

File tree

20 files changed

+1034
-744
lines changed

20 files changed

+1034
-744
lines changed

.github/workflows/build-nabla.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,17 @@ jobs:
364364
sparse-checkout: |
365365
smoke
366366
367+
- name: Download VulkanSDK
368+
uses: jakoch/install-vulkan-sdk-action@v1
369+
with:
370+
install_runtime: true
371+
cache: false
372+
stripdown: true
373+
install_lavapipe: true
374+
375+
- name: Add lavapipe driver
376+
run: reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\Vulkan\Drivers" /v "C:\lavapipe\share\vulkan\icd.d\lvp_icd.x86_64.json" /t REG_DWORD /d 0 /f
377+
367378
- name: Download Nabla install artifact
368379
uses: actions/download-artifact@v4
369380
with:
@@ -385,4 +396,4 @@ jobs:
385396
run: cmake --build smoke/out --config ${{ matrix.config }}
386397

387398
- name: CTest Smoke
388-
run: ctest --test-dir smoke/out --force-new-ctest-process --output-on-failure --no-tests=error -C ${{ matrix.config }}
399+
run: ctest --verbose --test-dir smoke/out --force-new-ctest-process --output-on-failure --no-tests=error -C ${{ matrix.config }}

.gitmodules

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,7 @@
125125
path = ci
126126
url = [email protected]:Devsh-Graphics-Programming/Nabla-CI.git
127127
branch = ditt
128-
update = none
128+
update = none
129+
[submodule "3rdparty/Vulkan-Tools"]
130+
path = 3rdparty/Vulkan-Tools
131+
url = [email protected]:Devsh-Graphics-Programming/Vulkan-Tools.git

3rdparty/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,10 @@ if (NBL_BUILD_BULLET)
454454
set(BULLET_INCLUDE_PATH ${BULLET_INCLUDE_PATH} PARENT_SCOPE)
455455
endif()
456456

457+
add_library(Vulkan-Headers INTERFACE)
458+
target_include_directories(Vulkan-Headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers/include")
459+
add_subdirectory(Vulkan-Tools/vulkaninfo vulkaninfo EXCLUDE_FROM_ALL)
460+
457461
# Final gather
458462
set(NBL_3RDPARTY_TARGETS
459463
lzma
@@ -475,6 +479,7 @@ set(NBL_3RDPARTY_TARGETS
475479
SPIRV
476480
SPIRV-Tools-static # SPIRV-Tools-shared in case of SHARED lib
477481
SPIRV-Tools-opt
482+
vulkaninfo
478483
Imath
479484
freetype
480485
${NBL_MSDFGEN_TARGETS}

3rdparty/Vulkan-Headers

Submodule Vulkan-Headers updated 61 files

3rdparty/Vulkan-Tools

Submodule Vulkan-Tools added at 761e7bf

include/nbl/asset/utils/CPolygonGeometryManipulator.h

Lines changed: 56 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "nbl/asset/ICPUPolygonGeometry.h"
1111
#include "nbl/asset/utils/CGeometryManipulator.h"
12+
#include "nbl/asset/utils/CSmoothNormalGenerator.h"
1213

1314
namespace nbl::asset
1415
{
@@ -17,17 +18,6 @@ namespace nbl::asset
1718
class NBL_API2 CPolygonGeometryManipulator
1819
{
1920
public:
20-
//vertex data needed for CSmoothNormalGenerator
21-
struct SSNGVertexData
22-
{
23-
uint32_t index; //offset of the vertex into index buffer
24-
uint32_t hash; //
25-
float wage; //angle wage of the vertex
26-
hlsl::float32_t3 position; //position of the vertex in 3D space
27-
hlsl::float32_t3 parentTriangleFaceNormal; //
28-
};
29-
30-
using VxCmpFunction = std::function<bool(const SSNGVertexData&, const SSNGVertexData&, const ICPUPolygonGeometry*)>;
3121

3222
static inline void recomputeContentHashes(ICPUPolygonGeometry* geo)
3323
{
@@ -243,11 +233,14 @@ class NBL_API2 CPolygonGeometryManipulator
243233

244234
static core::smart_refctd_ptr<ICPUPolygonGeometry> createUnweldedList(const ICPUPolygonGeometry* inGeo);
245235

236+
using SSNGVertexData = CSmoothNormalGenerator::VertexData;
237+
using SSNGVxCmpFunction = CSmoothNormalGenerator::VxCmpFunction;
238+
246239
static core::smart_refctd_ptr<ICPUPolygonGeometry> createSmoothVertexNormal(const ICPUPolygonGeometry* inbuffer, bool enableWelding = false, float epsilon = 1.525e-5f,
247-
VxCmpFunction vxcmp = [](const CPolygonGeometryManipulator::SSNGVertexData& v0, const CPolygonGeometryManipulator::SSNGVertexData& v1, const ICPUPolygonGeometry* buffer)
240+
SSNGVxCmpFunction vxcmp = [](const SSNGVertexData& v0, const SSNGVertexData& v1, const ICPUPolygonGeometry* buffer)
248241
{
249-
static constexpr float cosOf45Deg = 0.70710678118f;
250-
return dot(v0.parentTriangleFaceNormal,v1.parentTriangleFaceNormal) > cosOf45Deg;
242+
constexpr float cosOf45Deg = 0.70710678118f;
243+
return dot(normalize(v0.weightedNormal),normalize(v1.weightedNormal)) > cosOf45Deg;
251244
});
252245

253246
#if 0 // TODO: REDO
@@ -277,14 +270,14 @@ class NBL_API2 CPolygonGeometryManipulator
277270
};
278271
typedef std::function<bool(const IMeshManipulator::SSNGVertexData&, const IMeshManipulator::SSNGVertexData&, ICPUMeshBuffer*)> VxCmpFunction;
279272

280-
//! Compares two attributes of floating point types in accordance with passed error metric.
281-
/**
282-
@param _a First attribute.
283-
@param _b Second attribute.
284-
@param _cpa Component count.
285-
@param _errMetric Error metric info.
286-
*/
287-
static inline bool compareFloatingPointAttribute(const core::vectorSIMDf& _a, const core::vectorSIMDf& _b, size_t _cpa, const SErrorMetric& _errMetric)
273+
//! Compares two attributes of floating point types in accordance with passed error metric.
274+
/**
275+
@param _a First attribute.
276+
@param _b Second attribute.
277+
@param _cpa Component count.
278+
@param _errMetric Error metric info.
279+
*/
280+
static inline bool compareFloatingPointAttribute(const core::vectorSIMDf& _a, const core::vectorSIMDf& _b, size_t _cpa, const SErrorMetric& _errMetric)
288281
{
289282
using ErrorF_t = core::vectorSIMDf(*)(core::vectorSIMDf, core::vectorSIMDf);
290283

@@ -365,41 +358,41 @@ class NBL_API2 CPolygonGeometryManipulator
365358
}
366359

367360

368-
//! Swaps the index buffer for a new index buffer with invalid triangles removed.
369-
/**
370-
Invalid triangle is such consisting of two or more same indices.
371-
@param _input Input index buffer.
372-
@param _idxType Type of indices in the index buffer.
373-
@returns New index buffer or nullptr if input indices were of unknown type or _input was nullptr.
374-
*/
375-
static void filterInvalidTriangles(ICPUMeshBuffer* _input);
376-
377-
//! Creates index buffer from input converting it to indices for line list primitives. Input is assumed to be indices for line strip.
378-
/**
379-
@param _input Input index buffer's data.
380-
@param _idxCount Index count.
381-
@param _inIndexType Type of input index buffer data (32bit or 16bit).
382-
@param _outIndexType Type of output index buffer data (32bit or 16bit).
383-
*/
384-
static core::smart_refctd_ptr<ICPUBuffer> idxBufferFromLineStripsToLines(const void* _input, uint32_t& _idxCount, E_INDEX_TYPE _inIndexType, E_INDEX_TYPE _outIndexType);
385-
386-
//! Creates index buffer from input converting it to indices for triangle list primitives. Input is assumed to be indices for triangle strip.
387-
/**
388-
@param _input Input index buffer's data.
389-
@param _idxCount Index count.
390-
@param _inIndexType Type of input index buffer data (32bit or 16bit).
391-
@param _outIndexType Type of output index buffer data (32bit or 16bit).
392-
*/
393-
static core::smart_refctd_ptr<ICPUBuffer> idxBufferFromTriangleStripsToTriangles(const void* _input, uint32_t& _idxCount, E_INDEX_TYPE _inIndexType, E_INDEX_TYPE _outIndexType);
394-
395-
//! Creates index buffer from input converting it to indices for triangle list primitives. Input is assumed to be indices for triangle fan.
396-
/**
397-
@param _input Input index buffer's data.
398-
@param _idxCount Index count.
399-
@param _inIndexType Type of input index buffer data (32bit or 16bit).
400-
@param _outIndexType Type of output index buffer data (32bit or 16bit).
401-
*/
402-
static core::smart_refctd_ptr<ICPUBuffer> idxBufferFromTrianglesFanToTriangles(const void* _input, uint32_t& _idxCount, E_INDEX_TYPE _inIndexType, E_INDEX_TYPE _outIndexType);
361+
//! Swaps the index buffer for a new index buffer with invalid triangles removed.
362+
/**
363+
Invalid triangle is such consisting of two or more same indices.
364+
@param _input Input index buffer.
365+
@param _idxType Type of indices in the index buffer.
366+
@returns New index buffer or nullptr if input indices were of unknown type or _input was nullptr.
367+
*/
368+
static void filterInvalidTriangles(ICPUMeshBuffer* _input);
369+
370+
//! Creates index buffer from input converting it to indices for line list primitives. Input is assumed to be indices for line strip.
371+
/**
372+
@param _input Input index buffer's data.
373+
@param _idxCount Index count.
374+
@param _inIndexType Type of input index buffer data (32bit or 16bit).
375+
@param _outIndexType Type of output index buffer data (32bit or 16bit).
376+
*/
377+
static core::smart_refctd_ptr<ICPUBuffer> idxBufferFromLineStripsToLines(const void* _input, uint32_t& _idxCount, E_INDEX_TYPE _inIndexType, E_INDEX_TYPE _outIndexType);
378+
379+
//! Creates index buffer from input converting it to indices for triangle list primitives. Input is assumed to be indices for triangle strip.
380+
/**
381+
@param _input Input index buffer's data.
382+
@param _idxCount Index count.
383+
@param _inIndexType Type of input index buffer data (32bit or 16bit).
384+
@param _outIndexType Type of output index buffer data (32bit or 16bit).
385+
*/
386+
static core::smart_refctd_ptr<ICPUBuffer> idxBufferFromTriangleStripsToTriangles(const void* _input, uint32_t& _idxCount, E_INDEX_TYPE _inIndexType, E_INDEX_TYPE _outIndexType);
387+
388+
//! Creates index buffer from input converting it to indices for triangle list primitives. Input is assumed to be indices for triangle fan.
389+
/**
390+
@param _input Input index buffer's data.
391+
@param _idxCount Index count.
392+
@param _inIndexType Type of input index buffer data (32bit or 16bit).
393+
@param _outIndexType Type of output index buffer data (32bit or 16bit).
394+
*/
395+
static core::smart_refctd_ptr<ICPUBuffer> idxBufferFromTrianglesFanToTriangles(const void* _input, uint32_t& _idxCount, E_INDEX_TYPE _inIndexType, E_INDEX_TYPE _outIndexType);
403396

404397
//!
405398
static inline std::array<uint32_t,3u> getTriangleIndices(const ICPUMeshBuffer* mb, uint32_t triangleIx)
@@ -635,7 +628,7 @@ class NBL_API2 CPolygonGeometryManipulator
635628

636629
//! Creates a copy of a mesh with vertices welded
637630
/** \param mesh Input mesh
638-
\param errMetrics Array of size EVAI_COUNT. Describes error metric for each vertex attribute (used if attribute is of floating point or normalized type).
631+
\param errMetrics Array of size EVAI_COUNT. Describes error metric for each vertex attribute (used if attribute is of floating point or normalized type).
639632
\param tolerance The threshold for vertex comparisons.
640633
\return Mesh without redundant vertices. */
641634
static core::smart_refctd_ptr<ICPUMeshBuffer> createMeshBufferWelded(ICPUMeshBuffer *inbuffer, const SErrorMetric* errMetrics, const bool& optimIndexType = true, const bool& makeNewMesh = false);
@@ -653,12 +646,12 @@ class NBL_API2 CPolygonGeometryManipulator
653646
*/
654647
static void requantizeMeshBuffer(ICPUMeshBuffer* _meshbuffer, const SErrorMetric* _errMetric);
655648

656-
//! Creates a 32bit index buffer for a mesh with primitive types changed to list types
657-
/**#
649+
//! Creates a 32bit index buffer for a mesh with primitive types changed to list types
650+
/**#
658651
@param _newPrimitiveType
659-
@param _begin non-const iterator to beginning of meshbuffer range
660-
@param _end non-const iterator to ending of meshbuffer range
661-
*/
652+
@param _begin non-const iterator to beginning of meshbuffer range
653+
@param _end non-const iterator to ending of meshbuffer range
654+
*/
662655
template<typename Iterator>
663656
static inline void homogenizePrimitiveTypeAndIndices(Iterator _begin, Iterator _end, const E_PRIMITIVE_TOPOLOGY _newPrimitiveType, const E_INDEX_TYPE outIndexType = EIT_32BIT)
664657
{

0 commit comments

Comments
 (0)