forked from f3d-app/f3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3D gaussians .splat reader (f3d-app#1248)
- Loading branch information
Showing
43 changed files
with
1,099 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[codespell] | ||
skip = ./testing/**/*,./.git/**/*,./**/*.patch,./external/cxxopts/cxxopts.hpp,./external/nlohmann_json/nlohmann/json.hpp | ||
ignore-words-list=nnumber,unknwn,dota,modle | ||
ignore-words-list=nnumber,unknwn,dota,modle,inout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
a4cb9c6c90c18a31e225aa4a18df6a591bf8cd3b | ||
be69fa3a50de292857e69702885576ac6f114805 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
library/VTKExtensions/Rendering/Testing/TestF3DBitonicSort.cxx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
#include <vtkOpenGLBufferObject.h> | ||
#include <vtkOpenGLRenderWindow.h> | ||
#include <vtkShader.h> | ||
|
||
#include "vtkF3DBitonicSort.h" | ||
#include "vtkF3DBitonicSortFunctions.h" | ||
#include "vtkF3DBitonicSortGlobalDisperseCS.h" | ||
#include "vtkF3DBitonicSortGlobalFlipCS.h" | ||
#include "vtkF3DBitonicSortLocalDisperseCS.h" | ||
#include "vtkF3DBitonicSortLocalSortCS.h" | ||
|
||
#include <algorithm> | ||
#include <random> | ||
|
||
int TestF3DBitonicSort(int argc, char* argv[]) | ||
{ | ||
// Turn off VTK error reporting to avoid unwanted failure detection by ctest | ||
vtkObject::GlobalWarningDisplayOff(); | ||
|
||
// we need an OpenGL context | ||
vtkNew<vtkRenderWindow> renWin; | ||
renWin->OffScreenRenderingOn(); | ||
renWin->Start(); | ||
|
||
if (!vtkShader::IsComputeShaderSupported()) | ||
{ | ||
std::cerr << "Compute shaders are not supported on this system, skipping the test.\n"; | ||
return EXIT_SUCCESS; | ||
} | ||
|
||
constexpr int nbElements = 10000; | ||
|
||
// fill CPU keys and values buffers | ||
std::vector<double> keys(nbElements); | ||
std::vector<int> values(nbElements); | ||
|
||
std::random_device dev; | ||
std::mt19937 rng(dev()); | ||
std::uniform_real_distribution<double> dist(0.0, 1.0); | ||
|
||
std::generate(std::begin(keys), std::end(keys), [&]() { return dist(rng); }); | ||
std::fill(std::begin(values), std::end(values), 0); // we do not care about the values | ||
|
||
// upload these buffers to the GPU | ||
vtkNew<vtkOpenGLBufferObject> bufferKeys; | ||
vtkNew<vtkOpenGLBufferObject> bufferValues; | ||
|
||
bufferKeys->Upload(keys, vtkOpenGLBufferObject::ArrayBuffer); | ||
bufferValues->Upload(values, vtkOpenGLBufferObject::ArrayBuffer); | ||
|
||
// sort | ||
vtkNew<vtkF3DBitonicSort> sorter; | ||
|
||
// check invalid workgroup size | ||
if (sorter->Initialize(-1, VTK_FLOAT, VTK_FLOAT)) | ||
{ | ||
std::cerr << "The invalid workgroup size is not failing" << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
|
||
// check invalid types | ||
if (sorter->Initialize(128, VTK_CHAR, VTK_FLOAT)) | ||
{ | ||
std::cerr << "The invalid key type is not failing" << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
|
||
if (sorter->Initialize(128, VTK_FLOAT, VTK_CHAR)) | ||
{ | ||
std::cerr << "The invalid key type is not failing" << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
|
||
if (sorter->Run( | ||
vtkOpenGLRenderWindow::SafeDownCast(renWin), nbElements, bufferKeys, bufferValues)) | ||
{ | ||
std::cerr << "Uninitialized run is not failing" << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
|
||
if (!sorter->Initialize(128, VTK_DOUBLE, VTK_INT)) | ||
{ | ||
std::cerr << "Valid Initialize call failed" << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
|
||
if (!sorter->Run( | ||
vtkOpenGLRenderWindow::SafeDownCast(renWin), nbElements, bufferKeys, bufferValues)) | ||
{ | ||
std::cerr << "Sorter Run call failed" << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
|
||
// download sorted key buffer to CPU | ||
bufferKeys->Download(keys.data(), keys.size()); | ||
|
||
// check if correctly sorted | ||
for (int i = 1; i < nbElements; i++) | ||
{ | ||
if (keys[i - 1] > keys[i]) | ||
{ | ||
return EXIT_FAILURE; | ||
} | ||
} | ||
|
||
return EXIT_SUCCESS; | ||
} |
Oops, something went wrong.