Skip to content

Commit 4de3411

Browse files
committed
fixes
1 parent 95e95e6 commit 4de3411

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ Release/
1111
/build*/
1212
out/
1313
*.aps
14+
/imgui.ini

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ add_library(dsfix
4444
dinput.cpp
4545
dinput8.def
4646
dsfix.rc
47+
Effect.cpp
4748
FPS.cpp
4849
FXAA.cpp
4950
GAUSS.cpp

Effect.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "Effect.h"
2+
3+
const D3DVERTEXELEMENT9 Effect::vertexElements[3] = {
4+
{0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
5+
{0, 12, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0},
6+
D3DDECL_END()};

Effect.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,15 @@ class Effect {
1212
protected:
1313
Microsoft::WRL::ComPtr<IDirect3DDevice9> device;
1414
Microsoft::WRL::ComPtr<IDirect3DVertexDeclaration9> vertexDeclaration;
15+
static const D3DVERTEXELEMENT9 vertexElements[3];
1516

16-
Effect(IDirect3DDevice9* device) noexcept : device(device) {}
17+
Effect(IDirect3DDevice9* device) noexcept : device(device) {
18+
try {
19+
ThrowIfFailed(device->CreateVertexDeclaration(vertexElements, &vertexDeclaration));
20+
} catch (const std::system_error& err) {
21+
spdlog::error(L"{}", DXGetErrorString9W(err.code().value()));
22+
}
23+
}
1724

1825
virtual ~Effect() = default;
1926

0 commit comments

Comments
 (0)