diff --git a/DDrawCompat/D3dDdi/ShaderBlitter.cpp b/DDrawCompat/D3dDdi/ShaderBlitter.cpp index 1ddf49f..a1db838 100644 --- a/DDrawCompat/D3dDdi/ShaderBlitter.cpp +++ b/DDrawCompat/D3dDdi/ShaderBlitter.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #define CONCAT_(a, b) a##b @@ -84,6 +85,7 @@ namespace D3dDdi , m_psLanczos(createPixelShader(g_psLanczos)) , m_psLockRef(createPixelShader(g_psLockRef)) , m_psPaletteLookup(createPixelShader(g_psPaletteLookup)) + , m_psPoint(createPixelShader(g_psPoint)) , m_psTextureSampler(createPixelShader(g_psTextureSampler)) , m_vertexShaderDecl(createVertexShaderDecl()) , m_convolutionParams{} @@ -528,8 +530,8 @@ namespace D3dDdi switch (Config::displayFilter.get()) { case Config::Settings::DisplayFilter::POINT: - m_device.getShaderBlitter().textureBlt(rt, rtIndex, rtRect, - srcResource, srcSubResourceIndex, srcRect, D3DTEXF_POINT); + m_device.getShaderBlitter().pointBlt(rt, rtIndex, rtRect, + srcResource, srcSubResourceIndex, srcRect); break; case Config::Settings::DisplayFilter::BILINEAR: @@ -669,6 +671,16 @@ namespace D3dDdi m_psPaletteLookup.get(), D3DTEXF_POINT); } + void ShaderBlitter::pointBlt(const Resource& dstResource, UINT dstSubResourceIndex, const RECT& dstRect, + const Resource& srcResource, UINT srcSubResourceIndex, const RECT& srcRect) + { + LOG_FUNC("ShaderBlitter::pointBlt", static_cast(dstResource), dstSubResourceIndex, dstRect, + static_cast(srcResource), srcSubResourceIndex, srcRect); + + convolutionBlt(dstResource, dstSubResourceIndex, dstRect, srcResource, srcSubResourceIndex, srcRect, + 0.5f, m_psPoint.get()); + } + void ShaderBlitter::resetGammaRamp() { g_isGammaRampDefault = true; diff --git a/DDrawCompat/D3dDdi/ShaderBlitter.h b/DDrawCompat/D3dDdi/ShaderBlitter.h index 9248e25..ebb58ec 100644 --- a/DDrawCompat/D3dDdi/ShaderBlitter.h +++ b/DDrawCompat/D3dDdi/ShaderBlitter.h @@ -46,6 +46,8 @@ namespace D3dDdi const Resource& lockRefResource); void palettizedBlt(const Resource& dstResource, UINT dstSubResourceIndex, const RECT& dstRect, const Resource& srcResource, UINT srcSubResourceIndex, const RECT& srcRect, RGBQUAD palette[256]); + void pointBlt(const Resource& dstResource, UINT dstSubResourceIndex, const RECT& dstRect, + const Resource& srcResource, UINT srcSubResourceIndex, const RECT& srcRect); void splineBlt(const Resource& dstResource, UINT dstSubResourceIndex, const RECT& dstRect, const Resource& srcResource, UINT srcSubResourceIndex, const RECT& srcRect, UINT lobes); void textureBlt(const Resource& dstResource, UINT dstSubResourceIndex, const RECT& dstRect, @@ -117,6 +119,7 @@ namespace D3dDdi std::unique_ptr m_psLanczos; std::unique_ptr m_psLockRef; std::unique_ptr m_psPaletteLookup; + std::unique_ptr m_psPoint; std::unique_ptr m_psTextureSampler; std::unique_ptr m_vertexShaderDecl; ConvolutionParams m_convolutionParams; diff --git a/DDrawCompat/DDrawCompat.vcxproj b/DDrawCompat/DDrawCompat.vcxproj index 227eed3..5337b6a 100644 --- a/DDrawCompat/DDrawCompat.vcxproj +++ b/DDrawCompat/DDrawCompat.vcxproj @@ -473,6 +473,7 @@ + Vertex diff --git a/DDrawCompat/DDrawCompat.vcxproj.filters b/DDrawCompat/DDrawCompat.vcxproj.filters index 9c68e41..c1b9582 100644 --- a/DDrawCompat/DDrawCompat.vcxproj.filters +++ b/DDrawCompat/DDrawCompat.vcxproj.filters @@ -1115,6 +1115,9 @@ Shaders + + Shaders + diff --git a/DDrawCompat/Shaders/Point.hlsl b/DDrawCompat/Shaders/Point.hlsl new file mode 100644 index 0000000..9c6b137 --- /dev/null +++ b/DDrawCompat/Shaders/Point.hlsl @@ -0,0 +1,7 @@ +#define NONNEGATIVE +#include "Convolution.hlsli" + +float4 kernel(float4 x) +{ + return abs(x) <= 0.5f; +}