Skip to content

Commit

Permalink
General white-space fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bfierz committed Sep 9, 2021
1 parent de9613f commit b9129d4
Showing 211 changed files with 3,864 additions and 4,043 deletions.
19 changes: 9 additions & 10 deletions src/benchmarks/vcl.geometry/main.cpp
Original file line number Diff line number Diff line change
@@ -289,17 +289,16 @@ void BM_Int_RayBox_MaxMult(benchmark::State& state)
}

// Register the function as a benchmark
BENCHMARK(BM_Int_RayBoxEberly);//->ThreadRange(1, 16);
BENCHMARK_TEMPLATE(BM_Int_RayBox, float);//->ThreadRange(1, 16);
BENCHMARK_TEMPLATE(BM_Int_RayBox, Vcl::float4);//->ThreadRange(1, 16);
BENCHMARK_TEMPLATE(BM_Int_RayBox, Vcl::float8);//->ThreadRange(1, 16);
BENCHMARK_TEMPLATE(BM_Int_RayBox, Vcl::float16);//->ThreadRange(1, 16);
BENCHMARK_TEMPLATE(BM_Int_RayBox_MaxMult, float);//->ThreadRange(1, 16);
BENCHMARK_TEMPLATE(BM_Int_RayBox_MaxMult, Vcl::float4);//->ThreadRange(1, 16);
BENCHMARK_TEMPLATE(BM_Int_RayBox_MaxMult, Vcl::float8);//->ThreadRange(1, 16);
BENCHMARK_TEMPLATE(BM_Int_RayBox_MaxMult, Vcl::float16);//->ThreadRange(1, 16);
BENCHMARK(BM_Int_RayBoxEberly);
BENCHMARK_TEMPLATE(BM_Int_RayBox, float);
BENCHMARK_TEMPLATE(BM_Int_RayBox, Vcl::float4);
BENCHMARK_TEMPLATE(BM_Int_RayBox, Vcl::float8);
BENCHMARK_TEMPLATE(BM_Int_RayBox, Vcl::float16);
BENCHMARK_TEMPLATE(BM_Int_RayBox_MaxMult, float);
BENCHMARK_TEMPLATE(BM_Int_RayBox_MaxMult, Vcl::float4);
BENCHMARK_TEMPLATE(BM_Int_RayBox_MaxMult, Vcl::float8);
BENCHMARK_TEMPLATE(BM_Int_RayBox_MaxMult, Vcl::float16);

////////////////////////////////////////////////////////////////////////////////


BENCHMARK_MAIN();
12 changes: 6 additions & 6 deletions src/benchmarks/vcl.math/problems.cpp
Original file line number Diff line number Diff line change
@@ -47,8 +47,8 @@ void createRandomProblems(
// Rest-state
Eigen::Matrix3f M;
M << d(rng), d(rng), d(rng),
d(rng), d(rng), d(rng),
d(rng), d(rng), d(rng);
d(rng), d(rng), d(rng),
d(rng), d(rng), d(rng);
F.at<float>(i) = M;

if (R)
@@ -74,8 +74,8 @@ void createSymmetricProblems(
// Rest-state
Eigen::Matrix3f M;
M << d(rng), d(rng), d(rng),
d(rng), d(rng), d(rng),
d(rng), d(rng), d(rng);
d(rng), d(rng), d(rng),
d(rng), d(rng), d(rng);
Eigen::Matrix3f MtM = M.transpose() * M;
F.at<float>(i) = MtM;

@@ -105,8 +105,8 @@ void createRotationProblems(
// Rest-state
Eigen::Matrix3f X0;
X0 << d(rng), d(rng), d(rng),
d(rng), d(rng), d(rng),
d(rng), d(rng), d(rng);
d(rng), d(rng), d(rng),
d(rng), d(rng), d(rng);

// Rotation angle
float angle = a(rng);
11 changes: 7 additions & 4 deletions src/benchmarks/vcl.math/svd33_correctness.cpp
Original file line number Diff line number Diff line change
@@ -230,9 +230,10 @@ void checkSolution(

int main(int, char**)
{
using Vcl::float16;
// clang-format off
using Vcl::float4;
using Vcl::float8;
using Vcl::float16;
using Vcl::Mathematics::McAdamsJacobiSVD;
using Vcl::Mathematics::QRJacobiSVD;
using Vcl::Mathematics::TwoSidedJacobiSVD;
@@ -285,13 +286,15 @@ int main(int, char**)
#ifdef VCL_VECTORIZE_AVX
auto mcadams_float8 = static_cast<ComputeSvdFloat8>(McAdamsJacobiSVD);
computeSolution<float8> (nr_problems, mcadams_float8, F, resU, resV, resS); checkSolution("McAdamnsSVD - float8", "mc_adams_svd_float8_errors.txt", nr_problems, 1e-5f, refU, refV, refS, resU, resV, resS);
#endif // defined VCL_VECTORIZE_AVX
#endif

#ifdef VCL_CUDA_SUPPORT
cudaMcAdamsSVD(nr_problems, F, resU, resV, resS); checkSolution("McAdamsSVD - CUDA", "cuda_mc_adams_svd_errors.txt", nr_problems, 1e-5f, refU, refV, refS, resU, resV, resS);
#endif // defined VCL_CUDA_SUPPORT
#endif

#ifdef VCL_OPENCL_SUPPORT
openCLMcAdamsSVD(nr_problems, F, resU, resV, resS); checkSolution("McAdamsSVD - OpenCL", "opencl_mc_adams_svd_errors.txt", nr_problems, 1e-5f, refU, refV, refS, resU, resV, resS);
#endif // defined VCL_OPENCL_SUPPORT
#endif

// clang-format on
}
25 changes: 14 additions & 11 deletions src/examples/d3d12/drawtetmesh/main.cpp
Original file line number Diff line number Diff line change
@@ -152,16 +152,18 @@ class DrawTetMeshApplication final : public Application
using Vcl::Graphics::Runtime::D3D12::GraphicsPipelineState;
using Vcl::Graphics::Runtime::D3D12::Shader;

std::vector<DescriptorTableLayoutEntry> comp_dynamic_resources =
{
// clang-format off
std::vector<DescriptorTableLayoutEntry> comp_dynamic_resources = {
{ DescriptorTableLayoutEntryType::Constant, ContantDescriptor{0, 0, 2}, D3D12_SHADER_VISIBILITY_ALL },
{ DescriptorTableLayoutEntryType::Table, TableDescriptor{{
{ DescriptorTableLayoutEntryType::Table, TableDescriptor{ {
{ D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 0, 0, D3D12_DESCRIPTOR_RANGE_FLAG_NONE, D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND},
{ D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 1, 0, D3D12_DESCRIPTOR_RANGE_FLAG_NONE, D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND},
{ D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, 0, D3D12_DESCRIPTOR_RANGE_FLAG_NONE, D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND},
{ D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 1, 0, D3D12_DESCRIPTOR_RANGE_FLAG_NONE, D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND}
}}, D3D12_SHADER_VISIBILITY_ALL }
} }, D3D12_SHADER_VISIBILITY_ALL }
};
// clang-format on

_tetToTriMeshCtx.TableLayoutCompute = std::make_unique<DescriptorTableLayout>(device(), std::move(comp_dynamic_resources));
_tetToTriMeshCtx.TableCompute = std::make_unique<DescriptorTable>(device(), _tetToTriMeshCtx.TableLayoutCompute.get());
_tetToTriMeshCtx.TableCompute->addResource(0, _tetMeshIndices.get(), 0, 4 * _mesh->nrVolumes(), sizeof(int));
@@ -174,9 +176,8 @@ class DrawTetMeshApplication final : public Application
cpsd.ComputeShader = &tet_to_tri_mesh_cs;
_tetToTriMeshCtx.TetToTriMeshPS = std::make_unique<ComputePipelineState>(device(), cpsd, _tetToTriMeshCtx.TableLayoutCompute.get());

std::vector<DescriptorTableLayoutEntry> dynamic_resources =
{
{ DescriptorTableLayoutEntryType::Constant, ContantDescriptor{0, 0, 16}, D3D12_SHADER_VISIBILITY_VERTEX }
std::vector<DescriptorTableLayoutEntry> dynamic_resources = {
{ DescriptorTableLayoutEntryType::Constant, ContantDescriptor{ 0, 0, 16 }, D3D12_SHADER_VISIBILITY_VERTEX }
};
_tetToTriMeshCtx.TableLayoutGraphics = std::make_unique<DescriptorTableLayout>(device(), std::move(dynamic_resources));

@@ -218,13 +219,15 @@ class DrawTetMeshApplication final : public Application
using Vcl::Graphics::Runtime::D3D12::GraphicsPipelineState;
using Vcl::Graphics::Runtime::D3D12::Shader;

std::vector<DescriptorTableLayoutEntry> comp_dynamic_resources =
{
// clang-format off
std::vector<DescriptorTableLayoutEntry> comp_dynamic_resources = {
{ DescriptorTableLayoutEntryType::Constant, ContantDescriptor{0, 0, 16}, D3D12_SHADER_VISIBILITY_ALL },
{ DescriptorTableLayoutEntryType::Table, TableDescriptor{{
{ DescriptorTableLayoutEntryType::Table, TableDescriptor{ {
{ D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 0, 0, D3D12_DESCRIPTOR_RANGE_FLAG_NONE, D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND}
}}, D3D12_SHADER_VISIBILITY_ALL }
} }, D3D12_SHADER_VISIBILITY_ALL }
};
// clang-format on

_directTetMeshCtx.TableLayoutGraphics = std::make_unique<DescriptorTableLayout>(device(), std::move(comp_dynamic_resources));
_directTetMeshCtx.TableGraphics = std::make_unique<DescriptorTable>(device(), _directTetMeshCtx.TableLayoutGraphics.get());
_directTetMeshCtx.TableGraphics->addResource(0, _tetMeshVertices.get(), 0, _mesh->nrVertices(), sizeof(TetraMesh::Vertex));
7 changes: 3 additions & 4 deletions src/examples/d3d12/gridcube/main.cpp
Original file line number Diff line number Diff line change
@@ -100,10 +100,9 @@ class DynamicBoundingGridExample final : public ImGuiApplication
_cameraController = std::make_unique<Vcl::Graphics::TrackballCameraController>();
_cameraController->setCamera(_camera.get());

std::vector<DescriptorTableLayoutEntry> dynamic_resources =
{
{ DescriptorTableLayoutEntryType::InlineConstantBufferView, InlineDescriptor{0, 0, D3D12_ROOT_DESCRIPTOR_FLAG_NONE}, D3D12_SHADER_VISIBILITY_VERTEX },
{ DescriptorTableLayoutEntryType::InlineConstantBufferView, InlineDescriptor{1, 0, D3D12_ROOT_DESCRIPTOR_FLAG_NONE}, D3D12_SHADER_VISIBILITY_VERTEX }
std::vector<DescriptorTableLayoutEntry> dynamic_resources = {
{ DescriptorTableLayoutEntryType::InlineConstantBufferView, InlineDescriptor{ 0, 0, D3D12_ROOT_DESCRIPTOR_FLAG_NONE }, D3D12_SHADER_VISIBILITY_VERTEX },
{ DescriptorTableLayoutEntryType::InlineConstantBufferView, InlineDescriptor{ 1, 0, D3D12_ROOT_DESCRIPTOR_FLAG_NONE }, D3D12_SHADER_VISIBILITY_VERTEX }
};
_tableLayout = std::make_unique<DescriptorTableLayout>(device(), std::move(dynamic_resources));
//_table = std::make_unique<DescriptorTable>(device(), _tableLayout.get());
6 changes: 4 additions & 2 deletions src/examples/d3d12/spinningcube/main.cpp
Original file line number Diff line number Diff line change
@@ -103,8 +103,8 @@ class SpinningCubeApplication final : public Application
_camera.setFarPlane(10.0f);
_camera.setPosition({ 1.5f, 1.5f, 1.5f });

std::vector<float> cube_points =
{
// clang-format off
std::vector<float> cube_points = {
1, 1, -1,
-1, 1, -1,
-1, 1, 1,
@@ -114,6 +114,8 @@ class SpinningCubeApplication final : public Application
-1, -1, 1,
1, -1, 1
};
// clang-format on

BufferDescription vbo_desc = {
cube_points.size() * sizeof(float),
BufferUsage::Vertex
22 changes: 14 additions & 8 deletions src/examples/d3d12/texturedcube/main.cpp
Original file line number Diff line number Diff line change
@@ -82,13 +82,15 @@ class SpinningCubeApplication final : public Application
_vs = std::make_unique<Shader>(ShaderType::VertexShader, 0, CubeCsoVS);
_ps = std::make_unique<Shader>(ShaderType::FragmentShader, 0, CubeCsoPS);

std::vector<DescriptorTableLayoutEntry> dynamic_resources =
{
{ DescriptorTableLayoutEntryType::Constant, ContantDescriptor{0, 0, 16}, D3D12_SHADER_VISIBILITY_VERTEX },
{ DescriptorTableLayoutEntryType::Table, TableDescriptor{{
{ D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 0, 0, D3D12_DESCRIPTOR_RANGE_FLAG_NONE, D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND}
}}, D3D12_SHADER_VISIBILITY_PIXEL }
// clang-format off
std::vector<DescriptorTableLayoutEntry> dynamic_resources = {
{ DescriptorTableLayoutEntryType::Constant, ContantDescriptor{ 0, 0, 16 }, D3D12_SHADER_VISIBILITY_VERTEX },
{ DescriptorTableLayoutEntryType::Table, TableDescriptor{ {
{ D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 0, 0, D3D12_DESCRIPTOR_RANGE_FLAG_NONE, D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND }
} }, D3D12_SHADER_VISIBILITY_PIXEL }
};
// clang-format on

std::vector<D3D12_STATIC_SAMPLER_DESC> static_samplers = {
CD3DX12_STATIC_SAMPLER_DESC(
0,
@@ -104,6 +106,7 @@ class SpinningCubeApplication final : public Application
};
_tableLayout = std::make_unique<DescriptorTableLayout>(device(), std::move(dynamic_resources), std::move(static_samplers));

// clang-format off
InputLayoutDescription input_layout{
{
{ 0, 5 * sizeof(float), VertexDataClassification::VertexDataPerObject },
@@ -113,6 +116,7 @@ class SpinningCubeApplication final : public Application
{ "UV", SurfaceFormat::R32G32_FLOAT, 0, 0, 12 },
}
};
// clang-format on

PipelineStateDescription psd;
psd.VertexShader = _vs.get();
@@ -128,8 +132,8 @@ class SpinningCubeApplication final : public Application
_camera.setFarPlane(10.0f);
_camera.setPosition({ 1.5f, 1.5f, 1.5f });

std::vector<float> cube_points =
{
// clang-format off
std::vector<float> cube_points = {
-1.0f,-1.0f,-1.0f, 0.0f, 0.0f,
-1.0f,-1.0f, 1.0f, 0.0f, 1.0f,
-1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
@@ -172,6 +176,8 @@ class SpinningCubeApplication final : public Application
-1.0f, 1.0f, 1.0f, 0.0f, 1.0f,
+1.0f,-1.0f, 1.0f, 1.0f, 0.0f,
};
// clang-format on

BufferDescription vbo_desc = {
cube_points.size() * sizeof(float),
BufferUsage::Vertex
2 changes: 2 additions & 0 deletions src/examples/meshviewer/components/transform.cpp
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@
#include <vcl/rtti/attribute.h>
#include <vcl/rtti/constructor.h>

// clang-format off
VCL_RTTI_CTOR_TABLE_BEGIN(Transform)
Vcl::RTTI::Constructor<System::Components::Transform, Eigen::Matrix4f>(Vcl::RTTI::Parameter<Eigen::Matrix4f>("InitialTransform"))
VCL_RTTI_CTOR_TABLE_END(Transform)
@@ -41,6 +42,7 @@ VCL_DEFINE_METAOBJECT(System::Components::Transform)
type->registerConstructors(Transform_constructor_bases);
type->registerAttributes(Transform_attribute_bases);
}
// clang-format on

namespace System { namespace Components {
Transform::Transform(const Eigen::Matrix4f& initial)
38 changes: 14 additions & 24 deletions src/examples/meshviewer/meshview.cpp
Original file line number Diff line number Diff line change
@@ -132,31 +132,21 @@ FboRenderer::FboRenderer()
{ "PlaneEquation", SurfaceFormat::R32G32B32A32_FLOAT, 0, 0, 0 },
}
};

InputLayoutDescription opaqueTriLayout =
{
{
{ 0, sizeof(Eigen::Vector3i), VertexDataClassification::VertexDataPerObject },
{ 1, sizeof(Eigen::Vector3i), VertexDataClassification::VertexDataPerObject },
{ 2, sizeof(Eigen::Vector4f), VertexDataClassification::VertexDataPerObject }
},
{
{ "Index0", SurfaceFormat::R32G32B32_SINT, 0, 0, 0 },
{ "Index1", SurfaceFormat::R32G32B32_SINT, 0, 1, 0 },
{ "Colour", SurfaceFormat::R32G32B32A32_FLOAT, 0, 2, 0 }
}

InputLayoutDescription opaqueTriLayout = {
{ { 0, sizeof(Eigen::Vector3i), VertexDataClassification::VertexDataPerObject },
{ 1, sizeof(Eigen::Vector3i), VertexDataClassification::VertexDataPerObject },
{ 2, sizeof(Eigen::Vector4f), VertexDataClassification::VertexDataPerObject } },
{ { "Index0", SurfaceFormat::R32G32B32_SINT, 0, 0, 0 },
{ "Index1", SurfaceFormat::R32G32B32_SINT, 0, 1, 0 },
{ "Colour", SurfaceFormat::R32G32B32A32_FLOAT, 0, 2, 0 } }
};

InputLayoutDescription opaqueTetraLayout =
{
{
{ 0, sizeof(Eigen::Vector4i), VertexDataClassification::VertexDataPerObject },
{ 1, sizeof(Eigen::Vector4f), VertexDataClassification::VertexDataPerObject }
},
{
{ "Index", SurfaceFormat::R32G32B32A32_SINT, 0, 0, 0 },
{ "Colour", SurfaceFormat::R32G32B32A32_FLOAT, 0, 1, 0 }
}

InputLayoutDescription opaqueTetraLayout = {
{ { 0, sizeof(Eigen::Vector4i), VertexDataClassification::VertexDataPerObject },
{ 1, sizeof(Eigen::Vector4f), VertexDataClassification::VertexDataPerObject } },
{ { "Index", SurfaceFormat::R32G32B32A32_SINT, 0, 0, 0 },
{ "Colour", SurfaceFormat::R32G32B32A32_FLOAT, 0, 1, 0 } }
};

Shader boxVert = createShader(ShaderType::VertexShader, ":/shaders/debug/boundinggrid.vert");
6 changes: 4 additions & 2 deletions src/examples/meshviewer/shaders/3DSceneBindings.h
Original file line number Diff line number Diff line change
@@ -32,7 +32,8 @@
#define PER_FRAME_LIGHT_DATA_LOC 1

// Define common buffers
UNIFORM_BUFFER(PER_FRAME_CAMERA_DATA_LOC) PerFrameCameraData
UNIFORM_BUFFER(PER_FRAME_CAMERA_DATA_LOC)
PerFrameCameraData
{
// Viewport (x, y, w, h)
vec4 Viewport;
@@ -59,7 +60,8 @@ struct HemisphereLight
vec3 Direction;
};

UNIFORM_BUFFER(PER_FRAME_LIGHT_DATA_LOC) PerFrameLightData
UNIFORM_BUFFER(PER_FRAME_LIGHT_DATA_LOC)
PerFrameLightData
{
HemisphereLight HemiLight;
};
3 changes: 2 additions & 1 deletion src/examples/meshviewer/shaders/MarchingCubes.h
Original file line number Diff line number Diff line change
@@ -30,7 +30,8 @@
// Define common locations
#define MARCHING_CUBES_TABLES_LOC 6

UNIFORM_BUFFER(MARCHING_CUBES_TABLES_LOC) MarchingCubesTables
UNIFORM_BUFFER(MARCHING_CUBES_TABLES_LOC)
MarchingCubesTables
{
// LuT: Number of generated polygons for each in/out permutation
int caseToNumPolys[256];
Loading

0 comments on commit b9129d4

Please sign in to comment.