Skip to content

Commit 86bedb8

Browse files
committed
Remove config.h
1 parent f4cc99c commit 86bedb8

20 files changed

Lines changed: 44 additions & 96 deletions

.github/workflows/cmake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: Configure CMake
3838
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
3939
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
40-
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
40+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPATHFINDER_USE_D3D11=ON -DPATHFINDER_BUILD_DEMO=ON
4141

4242
- name: Build
4343
# Build your program with the given configuration

CMakeLists.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
1111
option(PATHFINDER_BACKEND_OPENGL "Enable OpenGL backend" ON)
1212
option(PATHFINDER_BACKEND_VULKAN "Enable Vulkan backend" ON)
1313
option(PATHFINDER_BUILD_DEMO "Build demo" OFF)
14+
option(PATHFINDER_USE_D3D11 "Use D3D11" OFF)
1415

1516
# Identify Linux.
1617
if (UNIX AND NOT APPLE AND NOT ANDROID)
@@ -24,23 +25,29 @@ if (EMSCRIPTEN)
2425
set(PATHFINDER_BACKEND_OPENGL ON)
2526
# No Vulkan support for web.
2627
set(PATHFINDER_BACKEND_VULKAN OFF)
28+
# No compute shader for web.
29+
set(PATHFINDER_USE_D3D11 OFF)
2730
elseif (APPLE)
2831
# No GL support for Mac.
2932
set(PATHFINDER_BACKEND_OPENGL OFF)
3033
set(PATHFINDER_BACKEND_VULKAN ON)
3134
elseif (LINUX)
32-
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm|aarch64")
35+
if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm|aarch64")
3336
message(STATUS "Building on ARM architecture")
34-
else()
37+
else ()
3538
message(STATUS "Not on ARM architecture")
3639
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1")
37-
endif()
40+
endif ()
3841
endif ()
3942

4043
add_subdirectory(pathfinder)
4144

4245
target_compile_features(pathfinder PUBLIC cxx_std_14)
4346

47+
if (PATHFINDER_USE_D3D11)
48+
target_compile_definitions(pathfinder PUBLIC PATHFINDER_ENABLE_D3D11)
49+
endif ()
50+
4451
if (PATHFINDER_BACKEND_VULKAN)
4552
message("[Pathfinder] Enabled Vulkan backend")
4653

pathfinder/common/f32x4.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44
#include <algorithm>
55
#include <cstdint>
66

7-
#include "../config.h"
87
#include "logger.h"
98
#include "math/vec2.h"
109

1110
#undef min
1211
#undef max
1312

13+
/// Enable SIMD.
14+
#if !defined(PATHFINDER_EMSCRIPTEN) && !defined(PATHFINDER_APPLE)
15+
#define PATHFINDER_ENABLE_SIMD
16+
#endif
17+
1418
#ifdef PATHFINDER_ENABLE_SIMD
1519
#if defined(__ANDROID__) || (defined(__linux__) && defined(__ARM_ARCH))
1620
// Converts Intel SSE intrinsics to Arm/Aarch64 NEON intrinsics.

pathfinder/common/i32x4.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
#include <cstdint>
55

6-
#include "../config.h"
7-
86
#if defined(__ANDROID__) || (defined(__linux__) && defined(__ARM_ARCH))
97
// A C/C++ header file that converts Intel SSE intrinsics to Arm/Aarch64 NEON intrinsics.
108
#include <sse2neon.h>
@@ -28,31 +26,31 @@ struct I32x4 {
2826
v = _mm_setr_epi32(x, y, z, w);
2927
}
3028

31-
inline static I32x4 splat(int32_t x) {
29+
static I32x4 splat(int32_t x) {
3230
return I32x4(_mm_set1_epi32(x));
3331
}
3432

35-
inline I32x4 shift_l(int32_t count) const {
33+
I32x4 shift_l(int32_t count) const {
3634
// Same as _mm_sllv_epi32(v, _mm_set1_epi32(count)), but that requires AVX2.
3735
// Cf. https://stackoverflow.com/questions/14731442/am-i-using-mm-srl-epi32-wrong
3836
return I32x4(_mm_sll_epi32(v, _mm_set_epi32(0, 0, 0, count)));
3937
}
4038

41-
inline I32x4 shift_r(int32_t count) const {
39+
I32x4 shift_r(int32_t count) const {
4240
// Same as _mm_srlv_epi32(v, _mm_set1_epi32(count)), but that requires AVX2.
4341
// Cf. https://stackoverflow.com/questions/14731442/am-i-using-mm-srl-epi32-wrong
4442
return I32x4(_mm_srl_epi32(v, _mm_set_epi32(0, 0, 0, count)));
4543
}
4644

47-
inline I32x4 operator+(const I32x4 &b) const {
45+
I32x4 operator+(const I32x4 &b) const {
4846
return I32x4(_mm_add_epi32(v, b.v));
4947
}
5048

51-
inline I32x4 operator-(const I32x4 &b) const {
49+
I32x4 operator-(const I32x4 &b) const {
5250
return I32x4(_mm_sub_epi32(v, b.v));
5351
}
5452

55-
inline I32x4 operator*(const I32x4 &b) const {
53+
I32x4 operator*(const I32x4 &b) const {
5654
// Multiply 2 and 0.
5755
__m128i tmp1 = _mm_mul_epu32(v, b.v);
5856
// Multiply 3 and 1.
@@ -62,11 +60,11 @@ struct I32x4 {
6260
return I32x4(_mm_unpacklo_epi32(_mm_shuffle_epi32(tmp1, 8), _mm_shuffle_epi32(tmp2, 8)));
6361
}
6462

65-
inline void operator+=(const I32x4 &b) {
63+
void operator+=(const I32x4 &b) {
6664
*this = *this + b;
6765
}
6866

69-
inline void operator-=(const I32x4 &b) {
67+
void operator-=(const I32x4 &b) {
7068
*this = *this - b;
7169
}
7270
};

pathfinder/common/math/vec2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct Vec2 {
6060
}
6161

6262
Vec2 normalize() const {
63-
#ifdef PATHFINDER_DEBUG
63+
#ifndef NDEBUG
6464
if (length() == 0) {
6565
Logger::error("Attempted to normalize a vector of zero length. This may indicate a bug in your code!");
6666
}

pathfinder/common/timestamp.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <sstream>
66
#include <string>
77

8-
#include "../config.h"
98
#include "logger.h"
109

1110
namespace Pathfinder {

pathfinder/config.h

Lines changed: 0 additions & 55 deletions
This file was deleted.

pathfinder/core/canvas.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "../common/io.h"
44
#include "../common/logger.h"
55
#include "../common/timestamp.h"
6-
#include "../config.h"
76
#include "d3d11/renderer.h"
87
#include "d3d11/scene_builder.h"
98
#include "d3d9/renderer.h"

pathfinder/core/canvas.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ enum class PathOp {
4848
/// Normally, we only need one canvas to render multiple scenes.
4949
class Canvas {
5050
public:
51-
explicit Canvas(Vec2I size,
52-
const std::shared_ptr<Device> &_device,
53-
const std::shared_ptr<Queue> &_queue,
54-
RenderLevel _render_level);
51+
Canvas(Vec2I size,
52+
const std::shared_ptr<Device> &_device,
53+
const std::shared_ptr<Queue> &_queue,
54+
RenderLevel _render_level);
5555

5656
/// Set the final render target.
5757
void set_dst_texture(const std::shared_ptr<Texture> &new_dst_texture);

pathfinder/core/d3d9/object_builder.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#include "../../common/f32x4.h"
44
#include "../../common/math/basic.h"
5-
#include "../../config.h"
65
#include "../data/data.h"
76

87
namespace Pathfinder {

0 commit comments

Comments
 (0)