[SOLVED] ReShade GUI issue in DX9 games
- Daodan
- Topic Author
Less
More
6 years 3 weeks ago - 6 years 3 weeks ago #1
by Daodan
[SOLVED] ReShade GUI issue in DX9 games was created by Daodan
I've been using ReShade (huge thanks to the devs!) for quite a long time now, and a while ago i started writing shaders myself.
I'm currently working on a shader that adapts itself to the average luma of the frame. While working on that shader i had the idea to outsource that averaging into its own shader, where certain stats such as average luma, average color etc. are rendered to 1x1 textures. These values can then be shared across ohter shaders.
That works, but there is a really weird issue i've come across in DX9 games:
If the last (or only) executed technique has more than one render target (at a size different than BUFFER_WIDTH x BUFFER_HEIGHT) the ReShade GUI just disappears (settings window, error log, fps counter) while all enabled effects are still being processed.
I've tested that in Remember Me and Dragon Age: Origins, both show that behaviour.
Specs: Win 10 (Build 16299), i5-4590, GTX960 (driver 391.24), MSI Afterburner & RivaTuner not running
Is this caused by flawed code (it compiles without error/warning...), a bug in ReShade (guess not, OGL and DX11 work fine, and why should a shader cause this?) or just a quirk in DX9 or the game?
Here is the shader i wrote to track and recreate that issue.
When enabling all techniques one after another the last two let the GUI disappear.
I know there can be an issue that disables all effects when the overlay is not visible, but this is somewhat different.
Thanks in advance.
I'm currently working on a shader that adapts itself to the average luma of the frame. While working on that shader i had the idea to outsource that averaging into its own shader, where certain stats such as average luma, average color etc. are rendered to 1x1 textures. These values can then be shared across ohter shaders.
That works, but there is a really weird issue i've come across in DX9 games:
If the last (or only) executed technique has more than one render target (at a size different than BUFFER_WIDTH x BUFFER_HEIGHT) the ReShade GUI just disappears (settings window, error log, fps counter) while all enabled effects are still being processed.
I've tested that in Remember Me and Dragon Age: Origins, both show that behaviour.
Specs: Win 10 (Build 16299), i5-4590, GTX960 (driver 391.24), MSI Afterburner & RivaTuner not running
Is this caused by flawed code (it compiles without error/warning...), a bug in ReShade (guess not, OGL and DX11 work fine, and why should a shader cause this?) or just a quirk in DX9 or the game?
Here is the shader i wrote to track and recreate that issue.
When enabling all techniques one after another the last two let the GUI disappear.
Warning: Spoiler!
#include "ReShade.fxh"
/* BackBuffer size, default format */
texture2D texBufferSize1 { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; };
texture2D texBufferSize2 { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; };
/* Default size, default format */
texture2D texDefaultSize1;
texture2D texDefaultSize2;
texture2D texDefaultSize3;
float3 InvertColor_PS(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target {
return 1.0 - tex2D(ReShade::BackBuffer, texcoord).rgb;
}
void RenderOneTexture_PS(float4 vpos : SV_Position, float2 texcoord : TexCoord, out float3 color1 : SV_Target0) {
color1 = tex2D(ReShade::BackBuffer, texcoord).rgb;
}
void RenderTwoTextures_PS(float4 vpos : SV_Position, float2 texcoord : TexCoord, out float3 color1 : SV_Target0, out float3 color2 : SV_Target1) {
color1 = tex2D(ReShade::BackBuffer, texcoord).rgb;
color2 = tex2D(ReShade::BackBuffer, texcoord).rgb;
}
void RenderThreeTextures_PS(float4 vpos : SV_Position, float2 texcoord : TexCoord, out float3 color1 : SV_Target0, out float3 color2 : SV_Target1, out float3 color3 : SV_Target2) {
color1 = tex2D(ReShade::BackBuffer, texcoord).rgb;
color2 = tex2D(ReShade::BackBuffer, texcoord).rgb;
color3 = tex2D(ReShade::BackBuffer, texcoord).rgb;
}
/* Invert color, just to see that ReShade is doing something */
technique InvertColor {
pass {
VertexShader = PostProcessVS;
PixelShader = InvertColor_PS;
}
}
/* No issues */
technique RenderOneTextureAtBufferSize {
pass {
VertexShader = PostProcessVS;
PixelShader = RenderOneTexture_PS;
RenderTarget0 = texBufferSize1;
}
}
/* No issues */
technique RenderTwoTexturesAtBufferSize {
pass {
VertexShader = PostProcessVS;
PixelShader = RenderTwoTextures_PS;
RenderTarget0 = texBufferSize1;
RenderTarget1 = texBufferSize2;
}
}
/* No issues */
technique RenderOneTextureAtDefaultSize {
pass {
VertexShader = PostProcessVS;
PixelShader = RenderOneTexture_PS;
RenderTarget0 = texDefaultSize1;
}
}
/*
If one of the following techniques is the last one executed,
the ReShade overlay will disappear in DX9 games.
The overlay reappears after deactivating this technique.
Regardless, all other activated shaders still keep working.
*/
technique RenderTwoTexturesAtDefaultSize {
pass {
VertexShader = PostProcessVS;
PixelShader = RenderTwoTextures_PS;
RenderTarget0 = texDefaultSize1;
RenderTarget1 = texDefaultSize2;
}
}
technique RenderThreeTexturesAtDefaultSize {
pass {
VertexShader = PostProcessVS;
PixelShader = RenderThreeTextures_PS;
RenderTarget0 = texDefaultSize1;
RenderTarget1 = texDefaultSize2;
RenderTarget2 = texDefaultSize3;
}
}
I know there can be an issue that disables all effects when the overlay is not visible, but this is somewhat different.
Thanks in advance.
Last edit: 6 years 3 weeks ago by Daodan. Reason: Issue has been solved.
Please Log in or Create an account to join the conversation.
- crosire
Less
More
6 years 3 weeks ago - 6 years 3 weeks ago #2
by crosire
Replied by crosire on topic ReShade GUI issue in DX9 games
That's a bug. Nice find. It's fixed (
github.com/crosire/reshade/commit/477dda...5a0e258cf0b7ad401aaa
) in the next update. Thanks a lot!
Last edit: 6 years 3 weeks ago by crosire.
Please Log in or Create an account to join the conversation.