Skip to content

Commit

Permalink
fix: buffer copy for fxaa
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceh121 committed Dec 27, 2023
1 parent 4b322cc commit 3747e55
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ public FxaaPostProcessEffect(IFXAAShader shader) {
public Texture process(GraphicsManager glx, Texture tex) {
return this.shader.run(glx.getModelBatch().getRenderContext(), tex);
}

@Override
public boolean isInPlace() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.lwjgl.opengl.GL43;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Pixmap.Format;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g3d.utils.RenderContext;

Expand All @@ -23,22 +24,25 @@ public LWJGLFXAAShader(final int shaderHandle, final int programHandle) {
public Texture run(final RenderContext ctx, final Texture tex) {
this.bind();

final int width = Gdx.graphics.getWidth();
final int height = Gdx.graphics.getHeight();

final int texUnit = ctx.textureBinder.bind(tex);
final Texture texOut = new Texture(width, height, Format.RGB888);
final int texUnitOut = ctx.textureBinder.bind(texOut);

// final int texUnit = 0;
// tex.bind(0);

final int width = Gdx.graphics.getWidth();
final int height = Gdx.graphics.getHeight();

this.setInputImage(ctx, texUnit);
this.setOutputImage(ctx, texUnit);
this.setOutputImage(ctx, texUnitOut);
this.setInvResolution(width, height);

this.dispatch(width / 64, height / 64, 1); // XXX divisions here should round up

GL43.glMemoryBarrier(GL43.GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);

return tex;
return texOut;
}

@Override
Expand Down

0 comments on commit 3747e55

Please sign in to comment.