graphicsfuzz icon indicating copy to clipboard operation
graphicsfuzz copied to clipboard

Support for textures in GraphicsFuzz

Open afd opened this issue 5 years ago • 4 comments

As a starting point, let's support just sampler2D in a pipeline, and have a default checkerboard texture be used.

Suppose a shader job includes a declaration:

uniform sampler2D foo;

The corresponding JSON file should be able to contain a uniform entry:

"foo": { func: "sampler2D", texture = SOME_STRING }

When uniform bindings are added to the shader job, "foo" should be given a descriptor set binding just like with any other uniform; similarly for the code that removes uniform bindings.

SOME_STRING should either be:

  • A known special name for a pre-defined texture, or
  • The name of a .png file Initially, let's just support a single pre-defined texture called CHECKERBOARD, so that we could have:

"foo": { func: "sampler2D", texture = "CHECKERBOARD" }

Let's adapt gfauto so that, if the .json file defines a sampler2D with CHECKERBOARD as the texture, appropriate Amber code is generated to make an image, run a pipeline to render a checkerboard pattern to the image, and bind this image to the main pipeline at descriptor set 0 and the binding specified in the .json file.

@paulthomson @jarisiru for info.

afd avatar Jun 26 '20 14:06 afd

Suggested amber output for given minimal input shader:

mintex.zip mintex

jarisiru avatar Sep 02 '20 12:09 jarisiru

https://github.com/google/graphicsfuzz/pull/1066 moves samplers out of uniform blocks, and https://github.com/google/graphicsfuzz/pull/1070 implements the amber file generation changes.

jarisiru avatar Sep 16 '20 11:09 jarisiru

Does GraphicFuzz now support shaders with texture?

tungts1101 avatar Oct 28 '21 02:10 tungts1101

Yes, see shaders/src/main/glsl/samples/320es/stable_sampler* for examples of use.

jarisiru avatar Oct 29 '21 07:10 jarisiru