Welcome, Guest.
Username: Password: Remember me

TOPIC: Weird "PIP" bug in Direct3D 10 with repro

Weird "PIP" bug in Direct3D 10 with repro 4 months 3 weeks ago #1

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.

#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;
    }
}
The administrator has disabled public write access.

Weird "PIP" bug in Direct3D 10 with repro 4 months 2 weeks ago #2

I tried your code in GTA 5 and cannot reproduce this with latest ReShade =|. Could you share your full config (preset, active shaders, ...)?
Cheers, crosire =)
The administrator has disabled public write access.

Weird "PIP" bug in Direct3D 10 with repro 4 months 2 weeks ago #3

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
Last Edit: 4 months 2 weeks ago by Ruuttu.
The administrator has disabled public write access.

Weird "PIP" bug in Direct3D 10 with repro 4 months 2 weeks ago #4

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)

Warning: Spoiler! [ Click to expand ]
Last Edit: 4 months 2 weeks ago by Daodan.
The administrator has disabled public write access.

Weird "PIP" bug in Direct3D 10 with repro 4 months 2 weeks ago #5

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.
Cheers, crosire =)
The administrator has disabled public write access.

Weird "PIP" bug in Direct3D 10 with repro 4 months 2 weeks ago #6

Just reverted back to ReShade 3.3.2.290 and it works fine.
The administrator has disabled public write access.

Weird "PIP" bug in Direct3D 10 with repro 4 months 2 weeks ago #7

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;
  }
}
The administrator has disabled public write access.