forked from Blinue/Magpie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFsrEasuTransform.h
41 lines (35 loc) · 1.08 KB
/
FsrEasuTransform.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#include "pch.h"
#include <SimpleScaleTransform.h>
#include "EffectDefines.h"
class FsrEasuTransform : public SimpleScaleTransform {
private:
FsrEasuTransform() : SimpleScaleTransform(GUID_MAGPIE_FSR_EASU_SHADER) {}
public:
static HRESULT Create(_In_ ID2D1EffectContext* d2dEC, _Outptr_ FsrEasuTransform** ppOutput) {
if (!ppOutput) {
return E_INVALIDARG;
}
HRESULT hr = LoadShader(d2dEC, MAGPIE_FSR_EASU_SHADER, GUID_MAGPIE_FSR_EASU_SHADER);
if (FAILED(hr)) {
return hr;
}
*ppOutput = new FsrEasuTransform();
return hr;
}
protected:
void _SetShaderConstantBuffer(const SIZE& srcSize, const SIZE& destSize) override {
struct {
INT32 srcWidth;
INT32 srcHeight;
INT32 destWidth;
INT32 destHeight;
} shaderConstants{
srcSize.cx,
srcSize.cy,
destSize.cx,
destSize.cy
};
_drawInfo->SetPixelShaderConstantBuffer((BYTE*)&shaderConstants, sizeof(shaderConstants));
}
};