-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Postshader: Let shaders use the previous frame #14528
Conversation
This is useful for i.e. simulating the slow update speed of the PSP's LCD screen, but could in theory be used for other effects.
Useful mainly when using previous frame output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice refactoring too! Just nitpicking.
Common/GPU/D3D11/thin3d_d3d11.cpp
Outdated
@@ -1329,6 +1332,7 @@ Framebuffer *D3D11DrawContext::CreateFramebuffer(const FramebufferDesc &desc) { | |||
void D3D11DrawContext::BindTextures(int start, int count, Texture **textures) { | |||
// Collect the resource views from the textures. | |||
ID3D11ShaderResourceView *views[8]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might as well change this array length to MAX_BOUND_TEXTURES since you're here poking around
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, agreed. Went ahead and cleaned up some other GL checks in Draw too along the same lines.
-[Unknown]
Common/GPU/D3D11/thin3d_d3d11.cpp
Outdated
@@ -1338,6 +1342,7 @@ void D3D11DrawContext::BindTextures(int start, int count, Texture **textures) { | |||
|
|||
void D3D11DrawContext::BindSamplerStates(int start, int count, SamplerState **states) { | |||
ID3D11SamplerState *samplers[8]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
GL actually had a check for 16 but then an array for 8. This should make it easier to figure out if we ever hit those limits.
Not sure if I'm doing something wrong, but even with a test shader posted here past frame is always black, so the test shader results in a 90% mix of black and 10% of current frame, so just a very dark image from current frame. |
Have you set |
Aw, I completely missed that, it works fine now;3, thanks. |
This is useful for i.e. simulating the slow update speed of the PSP's LCD screen, but could in theory be used for other effects.
Here's a test fragment shader I was using:
Using
0.1
makes the effect very obvious, but of course that varies by rendered FPS. For that reason I added a u_timeDelta:u_timeDelta.x
u_timeDelta.y
u_timeDelta.z
u_timeDelta.w
With this, the above example can be amended with
uniform vec4 u_timeDelta;
at the top, andu_timeDelta.y * 6
in place of 0.1 to have a more stable effect regardless of game FPS. But you could also force 60 FPS output.-[Unknown]