diff --git a/OptiScaler/shaders/depth_transfer/DT_Common.h b/OptiScaler/shaders/depth_transfer/DT_Common.h index 2cc104a5..35841397 100644 --- a/OptiScaler/shaders/depth_transfer/DT_Common.h +++ b/OptiScaler/shaders/depth_transfer/DT_Common.h @@ -12,7 +12,7 @@ RWTexture2D DestinationTexture : register(u0); void CSMain(uint3 dispatchThreadID : SV_DispatchThreadID) { float srcColor = SourceTexture.Load(int3(dispatchThreadID.xy, 0)); - DestinationTexture[dispatchThreadID.xy] = 1.0f - srcColor; + DestinationTexture[dispatchThreadID.xy] = srcColor; })"; inline static ID3DBlob* DT_CompileShader(const char* shaderCode, const char* entryPoint, const char* target) diff --git a/OptiScaler/shaders/depth_transfer/DT_Dx11.cpp b/OptiScaler/shaders/depth_transfer/DT_Dx11.cpp index a5f6969b..8194b48d 100644 --- a/OptiScaler/shaders/depth_transfer/DT_Dx11.cpp +++ b/OptiScaler/shaders/depth_transfer/DT_Dx11.cpp @@ -48,7 +48,14 @@ bool DepthTransfer_Dx11::InitializeViews(ID3D11Texture2D* InResource, ID3D11Text // Create SRV for input texture D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {}; - srvDesc.Format = DXGI_FORMAT_R24_UNORM_X8_TYPELESS; + + if (desc.Format == DXGI_FORMAT_R24G8_TYPELESS) + srvDesc.Format = DXGI_FORMAT_R24_UNORM_X8_TYPELESS; + else if (desc.Format == DXGI_FORMAT_R32G8X24_TYPELESS) + srvDesc.Format = DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS; + else + srvDesc.Format = desc.Format; + srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; srvDesc.Texture2D.MipLevels = 1; diff --git a/OptiScaler/shaders/depth_transfer/precompile/dt.hlsl b/OptiScaler/shaders/depth_transfer/precompile/dt.hlsl index 9a3ee457..1352ea32 100644 --- a/OptiScaler/shaders/depth_transfer/precompile/dt.hlsl +++ b/OptiScaler/shaders/depth_transfer/precompile/dt.hlsl @@ -6,5 +6,5 @@ RWTexture2D DestinationTexture : register(u0); void CSMain(uint3 dispatchThreadID : SV_DispatchThreadID) { float srcColor = SourceTexture.Load(int3(dispatchThreadID.xy, 0)); - DestinationTexture[dispatchThreadID.xy] = 1.0f - srcColor; + DestinationTexture[dispatchThreadID.xy] = srcColor; } \ No newline at end of file diff --git a/OptiScaler/shaders/depth_transfer/precompile/dt_Shader_Dx11.cso b/OptiScaler/shaders/depth_transfer/precompile/dt_Shader_Dx11.cso index 14dcf163..cd7d399c 100644 Binary files a/OptiScaler/shaders/depth_transfer/precompile/dt_Shader_Dx11.cso and b/OptiScaler/shaders/depth_transfer/precompile/dt_Shader_Dx11.cso differ diff --git a/OptiScaler/shaders/depth_transfer/precompile/dt_Shader_Dx11.h b/OptiScaler/shaders/depth_transfer/precompile/dt_Shader_Dx11.h index a0fdb5b7..7d0d134c 100644 --- a/OptiScaler/shaders/depth_transfer/precompile/dt_Shader_Dx11.h +++ b/OptiScaler/shaders/depth_transfer/precompile/dt_Shader_Dx11.h @@ -1,40 +1,58 @@ #pragma once inline static const unsigned char dt_cso[] = { - 0x44, 0x58, 0x42, 0x43, 0x8e, 0xe4, 0x79, 0xbe, 0x2f, 0x17, 0x49, 0x59, 0xac, 0x7f, 0xd3, 0x4f, 0x51, 0x36, 0xe9, - 0x8d, 0x01, 0x00, 0x00, 0x00, 0xa4, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x01, - 0x00, 0x00, 0x14, 0x01, 0x00, 0x00, 0x24, 0x01, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xc8, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, - 0x00, 0x05, 0x53, 0x43, 0x00, 0x01, 0x00, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x52, 0x44, 0x31, 0x31, 0x3c, 0x00, 0x00, - 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x0c, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x8a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, - 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, - 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x08, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x53, 0x48, 0x45, 0x58, 0xdc, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, - 0x37, 0x00, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x55, 0x55, 0x00, 0x00, 0x9c, 0x18, 0x00, 0x04, 0x00, 0xe0, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, - 0x00, 0x00, 0x5f, 0x00, 0x00, 0x02, 0x32, 0x00, 0x02, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x9b, - 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x04, - 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x02, 0x00, 0x36, 0x00, 0x00, 0x08, 0xc2, 0x00, 0x10, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x89, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0x12, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, - 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0xa4, 0x00, - 0x00, 0x06, 0xf2, 0xe0, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x05, 0x02, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 + 0x44, 0x58, 0x42, 0x43, 0xee, 0x2f, 0x51, 0x86, 0x72, 0xcb, 0x72, 0x5b, + 0xe5, 0x6b, 0x46, 0x2e, 0xbb, 0xfd, 0xc8, 0x55, 0x01, 0x00, 0x00, 0x00, + 0x84, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x04, 0x01, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00, 0x24, 0x01, 0x00, 0x00, + 0xe8, 0x01, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xc8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x53, 0x43, 0x00, 0x01, 0x00, 0x00, + 0x9d, 0x00, 0x00, 0x00, 0x52, 0x44, 0x31, 0x31, 0x3c, 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, + 0x24, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x65, + 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, + 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, + 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, + 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, + 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x4f, 0x53, 0x47, 0x4e, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x53, 0x48, 0x45, 0x58, 0xbc, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x05, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, + 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x55, 0x55, 0x00, 0x00, 0x9c, 0x18, 0x00, 0x04, 0x00, 0xe0, 0x11, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x02, + 0x32, 0x00, 0x02, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, + 0x9b, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x04, 0x32, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x02, 0x00, 0x36, 0x00, 0x00, 0x08, + 0xc2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x89, 0xc2, 0x00, 0x00, 0x80, + 0x43, 0x55, 0x15, 0x00, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x06, 0xf2, 0xe0, 0x11, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x46, 0x05, 0x02, 0x00, 0x06, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, + 0x94, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 };