Skip to content
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

implement FillImage command and sRGB support #63

Closed
wants to merge 4 commits into from

Conversation

eliasnaur
Copy link
Collaborator

FillImage is like Fill, except that it takes its color from one or
more image atlases.

kernel4 uses a single image for non-Vulkan hosts, and the dynamic sized array
of image descriptors on Vulkan.

A previous version of this commit used textures. I think images are a better
choice for piet-gpu, for several reasons:

  • Texture sampling, in particular textureGrad, is slow on lower spec devices
    such as Google Pixel. Texture sampling is particularly slow and difficult to
    implement for CPU fallbacks.
  • Texture sampling need more parameters, in particular the full u,v
    transformation matrix, leading to a large increase in the command size. Since
    all commands use the same size, that memory penalty is paid by all scenes, not
    just scenes with textures.
  • It is unlikely that piet-gpu will support every kind of fill for every
    client, because each kind must be added to kernel4.

With FillImage, a client will prepare the image(s) in separate shader stages,
sampling and applying transformations and special effects as needed. Textures
that align with the output pixel grid can be used directly, without
pre-processing.

Note that the pre-processing step can run concurrently with the piet-gpu pipeline;
Only the last stage, kernel4, needs the images.

Pre-processing most likely uses fixed function vertex/fragment programs,
which on some GPUs may run in parallel with piet-gpu's compute programs.

While here, fix a few validation errors:

  • Explicitly enable EXT_descriptor_indexing, KHR_maintenance3,
    KHR_get_physical_device_properties2.
  • Specify a vkDescriptorSetVariableDescriptorCountAllocateInfo for
    vkAllocateDescriptorSets. Otherwise, variable image2D arrays won't work (but
    sampler2D arrays do, at least on my setup).

Updates #38

Signed-off-by: Elias Naur mail@eliasnaur.com

Signed-off-by: Elias Naur <mail@eliasnaur.com>
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The NVIDIA shader compiler bug that forced splitting of the state struct
into primitive types is now fixed.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
As described in linebender#62, the non-deterministic scene monoid may result in
slightly different transformations for path segments in an otherwise
closed path.

This change ensure consistent transformation across paths in three steps.

First, absolute transformations computed by the scene monoid is stored
along with path segments and annotated elements.

Second, elements.comp no longer transforms path segments. Instead,
each path segment is stored untransformed along with a reference to its
absolute transformation.

Finally, path_coarse performs the transformation of path segments.
Because all segments in a path shared a single transformation reference,
the inconsistency in linebender#62 is avoided.

Fixes linebender#62

Signed-off-by: Elias Naur <mail@eliasnaur.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant