Weird "PIP" bug in Direct3D 10 with repro
- Ruuttu
- Topic Author
Less
More
Check out this shader with Direct3D 10+. When the ReShade overlay is open, the shader also renders correctly. When the overlay is closed, the shader only renders a little "PIP" image into the top left corner.
imgur.com/a/kWj2fxb
This happens with Fallout 4 and GTA V, and perhaps with any other Direct3D 10+ game. It doesn't affect Direct3D 9.
This happens with Fallout 4 and GTA V, and perhaps with any other Direct3D 10+ game. It doesn't affect Direct3D 9.
#include "ReShade.fxh"
// ----------------------------------------------------------------------------
// TEXTURES
sampler2D BackBufferSampler {
Texture = ReShade::BackBufferTex;
};
/* For keeping current frame in quarter size */
texture2D Downscaled {
Width = BUFFER_WIDTH / 4;
Height = BUFFER_HEIGHT / 4;
Format = R8;
};
sampler2D DownscaledSampler {
Texture = Downscaled;
};
/* For keeping previous frame in quarter size */
texture2D PreviousFrame {
Width = BUFFER_WIDTH / 4;
Height = BUFFER_HEIGHT / 4;
Format = R8;
};
sampler2D PreviousFrameSampler {
Texture = PreviousFrame;
};
// ----------------------------------------------------------------------------
// FUNCTIONS
float GetSmallBackBuffer(
float4 vpos : SV_Position,
float2 texcoord : TEXCOORD) : SV_Target {
float3 color = tex2D(BackBufferSampler, texcoord);
return (
color.r * 0.25
+ color.g * 0.50
+ color.b * 0.25
);
}
float SaveSmallBackBuffer(
float4 vpos : SV_Position,
float2 texcoord : TEXCOORD) : SV_Target {
return tex2D(DownscaledSampler, texcoord).r;
}
float3 ShowDifferences(
float4 vpos : SV_Position,
float2 texcoord : TEXCOORD) : SV_Target {
float3 color = tex2D(BackBufferSampler, texcoord);
/* Highlight what changed between current and previous frame */
float smallCurrent = tex2D(DownscaledSampler, texcoord).r;
float smallPrevious = tex2D(PreviousFrameSampler, texcoord).r;
return (color * 0.5 + 0.5) + (smallCurrent - smallPrevious);
}
// ----------------------------------------------------------------------------
// PASSES
technique Repro {
pass Downscale {
VertexShader = PostProcessVS;
PixelShader = GetSmallBackBuffer;
RenderTarget = Downscaled;
}
pass Differences {
VertexShader = PostProcessVS;
PixelShader = ShowDifferences;
}
pass SaveFrame {
VertexShader = PostProcessVS;
PixelShader = SaveSmallBackBuffer;
RenderTarget = PreviousFrame;
}
}
Please Log in or Create an account to join the conversation.
- crosire
Less
More
5 years 8 months ago #2
by crosire
Replied by crosire on topic Weird "PIP" bug in Direct3D 10 with repro
I tried your code in GTA 5 and cannot reproduce this with latest ReShade . Could you share your full config (preset, active shaders, ...)?
Please Log in or Create an account to join the conversation.
- Ruuttu
- Topic Author
Less
More
5 years 8 months ago - 5 years 8 months ago #3
by Ruuttu
Replied by Ruuttu on topic Weird "PIP" bug in Direct3D 10 with repro
Here are the files that you could place next to GTA5.exe. There are no other effects in the preset, so I'm afraid it prolly won't help
files.fm/u/dr6wr7tf
files.fm/u/dr6wr7tf
Last edit: 5 years 8 months ago by Ruuttu.
Please Log in or Create an account to join the conversation.
- Daodan
Less
More
5 years 8 months ago - 5 years 8 months ago #4
by Daodan
Replied by Daodan on topic Weird "PIP" bug in Direct3D 10 with repro
I just tried out the shader (standalone, no other effects were compiled) from the first post in Fallout 4 and it behaves exactly the same:
When ReShade doesn't draw anything onto the screen the effect is only shown on the top left corner at a quarter of the resolution.
(ReShade 3.4.0.346, Nvidia driver 398.36)
One workaround/fix is to change the textures and samplers (BUFFER_WIDTH * BUFFER_HEIGHT, MipLODBias = 2)
When ReShade doesn't draw anything onto the screen the effect is only shown on the top left corner at a quarter of the resolution.
(ReShade 3.4.0.346, Nvidia driver 398.36)
One workaround/fix is to change the textures and samplers (BUFFER_WIDTH * BUFFER_HEIGHT, MipLODBias = 2)
Warning: Spoiler!
#include "ReShade.fxh"
// ----------------------------------------------------------------------------
// TEXTURES
sampler2D BackBufferSampler2 {
Texture = ReShade::BackBufferTex;
};
/* For keeping current frame in quarter size */
texture2D DownscaledLOD { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; MipLevels = 3; Format = R8; };
sampler2D DownscaledSamplerLOD { Texture = DownscaledLOD; MipLODBias = 2; };
/* For keeping previous frame in quarter size */
texture2D PreviousFrameLOD { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; MipLevels = 3; Format = R8; };
sampler2D PreviousFrameSamplerLOD { Texture = PreviousFrameLOD; MipLODBias = 2; };
// ----------------------------------------------------------------------------
// FUNCTIONS
float GetSmallBackBuffer(
float4 vpos : SV_Position,
float2 texcoord : TEXCOORD) : SV_Target {
float3 color = tex2D(BackBufferSampler2, texcoord).rgb;
return (
color.r * 0.25
+ color.g * 0.50
+ color.b * 0.25
);
}
float SaveSmallBackBuffer(
float4 vpos : SV_Position,
float2 texcoord : TEXCOORD) : SV_Target {
return tex2D(DownscaledSamplerLOD, texcoord).r;
}
float3 ShowDifferences(
float4 vpos : SV_Position,
float2 texcoord : TEXCOORD) : SV_Target {
float3 color = tex2D(BackBufferSampler2, texcoord).rgb;
/* Highlight what changed between current and previous frame */
float smallCurrent = tex2D(DownscaledSamplerLOD, texcoord).r;
float smallPrevious = tex2D(PreviousFrameSamplerLOD, texcoord).r;
return (color * 0.5 + 0.5) + (smallCurrent - smallPrevious);
}
// ----------------------------------------------------------------------------
// PASSES
technique ReproLOD {
pass Downscale {
VertexShader = PostProcessVS;
PixelShader = GetSmallBackBuffer;
RenderTarget = DownscaledLOD;
}
pass Differences {
VertexShader = PostProcessVS;
PixelShader = ShowDifferences;
}
pass SaveFrame {
VertexShader = PostProcessVS;
PixelShader = SaveSmallBackBuffer;
RenderTarget = PreviousFrameLOD;
}
}
Last edit: 5 years 8 months ago by Daodan.
Please Log in or Create an account to join the conversation.
- crosire
Less
More
5 years 8 months ago #5
by crosire
Replied by crosire on topic Weird "PIP" bug in Direct3D 10 with repro
Tried in a variety of different D3D11 games and just cannot see that behavior. It always covers the entire screen for me (used only the files from the third post).
The behavior you see would indicate that the viewport is not set correctly, but ReShade does that right before it kicks off the draw call of each pass ... So I don't know what's going on here.
The behavior you see would indicate that the viewport is not set correctly, but ReShade does that right before it kicks off the draw call of each pass ... So I don't know what's going on here.
Please Log in or Create an account to join the conversation.
- Daodan
Less
More
5 years 8 months ago #6
by Daodan
Replied by Daodan on topic Weird "PIP" bug in Direct3D 10 with repro
Just reverted back to ReShade 3.3.2.290 and it works fine.
Please Log in or Create an account to join the conversation.
- Ruuttu
- Topic Author
Less
More
5 years 8 months ago #7
by Ruuttu
Replied by Ruuttu on topic Weird "PIP" bug in Direct3D 10 with repro
I found another workaround, which is to add a dummy render pass to the end which just outputs the backbuffer as it already was.
float3 DoNothingShader(
float4 vpos : SV_Position,
float2 texcoord : TEXCOORD) : SV_Target {
return tex2D(ReShade::BackBuffer, texcoord);
}
technique Repro {
...
pass DoNothing {
VertexShader = PostProcessVS;
PixelShader = DoNothingShader;
}
}
Please Log in or Create an account to join the conversation.