Skip to content

Instantly share code, notes, and snippets.

@luluco250
Created December 31, 2020 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luluco250/986d6d4b34e5a865819a9c8ef4553dd9 to your computer and use it in GitHub Desktop.
Save luluco250/986d6d4b34e5a865819a9c8ef4553dd9 to your computer and use it in GitHub Desktop.
ReShade broken pooled texture behavior on DirectX 9 example shader
#ifndef BROKEN_POOLED_USE_POOLED
#define BROKEN_POOLED_USE_POOLED 1
#endif
texture BackBufferTex : COLOR;
sampler BackBuffer
{
Texture = BackBufferTex;
};
texture ATex
#if BROKEN_POOLED_USE_POOLED
<pooled = true;>
#endif
{
Width = BUFFER_WIDTH;
Height = BUFFER_HEIGHT;
};
sampler A
{
Texture = ATex;
};
texture BTex
#if BROKEN_POOLED_USE_POOLED
<pooled = true;>
#endif
{
Width = BUFFER_WIDTH;
Height = BUFFER_HEIGHT;
};
sampler B
{
Texture = BTex;
};
void ScreenVS(
uint id : SV_VERTEXID,
out float4 pos : SV_POSITION,
out float2 uv : TEXCOORD)
{
uv.x = (id == 2) ? 2.0 : 0.0;
uv.y = (id == 1) ? 2.0 : 0.0;
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
}
float4 WriteAPS(float4 p : SV_POSITION, float2 uv : TEXCOORD) : SV_TARGET
{
return tex2D(BackBuffer, uv);
}
float4 WriteBPS(float4 p : SV_POSITION, float2 uv : TEXCOORD) : SV_TARGET
{
return tex2D(A, uv);
}
float4 FinalPS(float4 p : SV_POSITION, float2 uv : TEXCOORD) : SV_TARGET
{
return tex2D(B, uv);
}
technique BrokenPooled
{
pass WriteA
{
VertexShader = ScreenVS;
PixelShader = WriteAPS;
RenderTarget = ATex;
}
pass WriteB
{
VertexShader = ScreenVS;
PixelShader = WriteBPS;
RenderTarget = BTex;
}
pass Final
{
VertexShader = ScreenVS;
PixelShader = FinalPS;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment