Weird "PIP" bug in Direct3D 10 with repro

  • Ruuttu
  • Topic Author
More
5 years 8 months ago #1 by Ruuttu Weird "PIP" bug in Direct3D 10 with repro was created by Ruuttu
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;
    }
}

Please Log in or Create an account to join the conversation.

  • crosire
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
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
Last edit: 5 years 8 months ago by Ruuttu.

Please Log in or Create an account to join the conversation.

  • Daodan
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)

Warning: Spoiler!
Last edit: 5 years 8 months ago by Daodan.

Please Log in or Create an account to join the conversation.

  • crosire
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.

Please Log in or Create an account to join the conversation.

  • Daodan
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
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.

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.