mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 01:15:35 +00:00
gpu: [compute] pre-transform images before rendering
We're about to change the last stage of the compute pipeline to only accept images, not sampled textures. This change prepares materials for pixel-aligned image copying by pre-rendering images to a texture, applying transforms. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+13
-15
@@ -203,7 +203,7 @@ void main() {
|
||||
uint tile_count;
|
||||
switch (tag) {
|
||||
case Annotated_Fill:
|
||||
case Annotated_FillTexture:
|
||||
case Annotated_FillImage:
|
||||
case Annotated_Stroke:
|
||||
case Annotated_BeginClip:
|
||||
case Annotated_EndClip:
|
||||
@@ -327,27 +327,25 @@ void main() {
|
||||
}
|
||||
cmd_ref.offset += Cmd_size;
|
||||
break;
|
||||
case Annotated_FillTexture:
|
||||
case Annotated_FillImage:
|
||||
tile = Tile_read(read_tile_alloc(element_ref_ix), TileRef(sh_tile_base[element_ref_ix]
|
||||
+ (sh_tile_stride[element_ref_ix] * tile_y + tile_x) * Tile_size));
|
||||
AnnoFillTexture fill_tex = Annotated_FillTexture_read(conf.anno_alloc, ref);
|
||||
AnnoFillImage fill_img = Annotated_FillImage_read(conf.anno_alloc, ref);
|
||||
if (!alloc_cmd(cmd_alloc, cmd_ref, cmd_limit)) {
|
||||
break;
|
||||
}
|
||||
if (tile.tile.offset != 0) {
|
||||
CmdFillTexture cmd_fill_tex;
|
||||
cmd_fill_tex.tile_ref = tile.tile.offset;
|
||||
cmd_fill_tex.backdrop = tile.backdrop;
|
||||
cmd_fill_tex.mat = fill_tex.mat;
|
||||
cmd_fill_tex.translate = fill_tex.translate;
|
||||
cmd_fill_tex.uv_bounds = fill_tex.uv_bounds;
|
||||
Cmd_FillTexture_write(cmd_alloc, cmd_ref, cmd_fill_tex);
|
||||
CmdFillImage cmd_fill_img;
|
||||
cmd_fill_img.tile_ref = tile.tile.offset;
|
||||
cmd_fill_img.backdrop = tile.backdrop;
|
||||
cmd_fill_img.index = fill_img.index;
|
||||
cmd_fill_img.offset = fill_img.offset;
|
||||
Cmd_FillImage_write(cmd_alloc, cmd_ref, cmd_fill_img);
|
||||
} else {
|
||||
CmdSolidTexture cmd_solid_tex;
|
||||
cmd_solid_tex.mat = fill_tex.mat;
|
||||
cmd_solid_tex.translate = fill_tex.translate;
|
||||
cmd_solid_tex.uv_bounds = fill_tex.uv_bounds;
|
||||
Cmd_SolidTexture_write(cmd_alloc, cmd_ref, cmd_solid_tex);
|
||||
CmdSolidImage cmd_solid_img;
|
||||
cmd_solid_img.index = fill_img.index;
|
||||
cmd_solid_img.offset = fill_img.offset;
|
||||
Cmd_SolidImage_write(cmd_alloc, cmd_ref, cmd_solid_img);
|
||||
}
|
||||
cmd_ref.offset += Cmd_size;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user