Skip to content

Commit

Permalink
scoped
Browse files Browse the repository at this point in the history
  • Loading branch information
Meakk committed Feb 6, 2024
1 parent c8407fb commit 4c49832
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions library/VTKExtensions/Rendering/Testing/TestF3DBitonicSort.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,38 @@
#include <random>
#include <sstream>

class ScopedOpenGLContext
{
public:
ScopedOpenGLContext()
{
this->RenWin->OffScreenRenderingOn();
this->RenWin->Start();
}
~ScopedOpenGLContext()
{
this->RenWin->End();
}

vtkOpenGLRenderWindow* GetContext()
{
return vtkOpenGLRenderWindow::SafeDownCast(this->RenWin);
}

private:
vtkNew<vtkRenderWindow> RenWin;
};

int TestF3DBitonicSort(int argc, char* argv[])
{
// we need an OpenGL context
vtkNew<vtkRenderWindow> renWin;
renWin->OffScreenRenderingOn();
renWin->Start();
ScopedOpenGLContext context;

//if (!vtkShader::IsComputeShaderSupported())
// if (!vtkShader::IsComputeShaderSupported())
//{
// std::cerr << "Compute shaders are not supported on this system, skipping the test.\n";
// return EXIT_SUCCESS;
//}
// std::cerr << "Compute shaders are not supported on this system, skipping the test.\n";
// return EXIT_SUCCESS;
// }

constexpr int nbElements = 10000;

Expand All @@ -49,7 +69,7 @@ int TestF3DBitonicSort(int argc, char* argv[])
// sort
// vtkNew<vtkF3DBitonicSort> sorter;
// sorter->Initialize(128, VTK_DOUBLE, VTK_INT);
// sorter->Run(vtkOpenGLRenderWindow::SafeDownCast(renWin), nbElements, bufferKeys, bufferValues);
// sorter->Run(, nbElements, bufferKeys, bufferValues);

// download sorted key buffer to CPU
// bufferKeys->Download(keys.data(), keys.size());
Expand All @@ -63,7 +83,5 @@ int TestF3DBitonicSort(int argc, char* argv[])
// }
// }

renWin->Finalize();

return EXIT_SUCCESS;
}

0 comments on commit 4c49832

Please sign in to comment.