resources/shader/fxaa: don't rely on magic _SIZE uniform
This commit is contained in:
parent
141c942432
commit
85eff81c7f
3 changed files with 6 additions and 2 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
void main(void) {
|
||||
gl_Position = r_projectionMatrix * r_modelViewMatrix * vec4(position, 1.0);
|
||||
v_rcpFrame = 1.0 / tex_SIZE;
|
||||
v_rcpFrame = 1.0 / tex_size;
|
||||
fxaaCoords(
|
||||
texCoordRawIn,
|
||||
v_rcpFrame,
|
||||
|
|
|
@ -14,7 +14,7 @@ OUT(0) vec4 fragColor;
|
|||
#endif
|
||||
|
||||
UNIFORM(0) sampler2D tex;
|
||||
UNIFORM(1) vec2 tex_SIZE;
|
||||
UNIFORM(1) vec2 tex_size;
|
||||
UNIFORM(2) sampler2D depth;
|
||||
|
||||
VARYING(0) vec2 v_coordNW;
|
||||
|
|
|
@ -574,6 +574,10 @@ static bool fxaa_rule(Framebuffer *fb) {
|
|||
r_depth_func(DEPTH_ALWAYS);
|
||||
r_blend(BLEND_NONE);
|
||||
r_shader_ptr(stagedraw.shaders.fxaa);
|
||||
Texture *tex = r_framebuffer_get_attachment(fb, FRAMEBUFFER_ATTACH_COLOR0);
|
||||
uint w, h;
|
||||
r_texture_get_size(tex, 0, &w, &h);
|
||||
r_uniform_vec2("tex_size", w, h);
|
||||
r_uniform_sampler("depth", r_framebuffer_get_attachment(fb, FRAMEBUFFER_ATTACH_DEPTH));
|
||||
draw_framebuffer_tex(fb, VIEWPORT_W, VIEWPORT_H);
|
||||
r_state_pop();
|
||||
|
|
Loading…
Reference in a new issue