forked from AuroraMiddleware/gtk
2a38cecd33
The primary goal here was to cleanup the current GL renderer to make maintenance easier going forward. Furthermore, it tracks state to allow us to implement more advanced renderer features going forward. Reordering This renderer will reorder batches by render target to reduce the number of times render targets are changed. In the future, we could also reorder by program within the render target if we can determine that vertices do not overlap. Uniform Snapshots To allow for reordering of batches all uniforms need to be tracked for the programs. This allows us to create the full uniform state when the batch has been moved into a new position. Some care was taken as it can be performance sensitive. Attachment Snapshots Similar to uniform snapshots, we need to know all of the texture attachments so that we can rebind them when necessary. Render Jobs To help isolate the process of creating GL commands from the renderer abstraction a render job abstraction was added. This could be extended in the future if we decided to do tiling. Command Queue Render jobs create batches using the command queue. The command queue will snapshot uniform and attachment state so that it can reorder batches right before executing them. Currently, the only reordering done is to ensure that we only visit each render target once. We could extend this by tracking vertices, attachments, and others. This code currently uses an inline array helper to reduce overhead from GArray which was showing up on profiles. It could be changed to use GdkArray without too much work, but had roughly double the instructions. Cycle counts have not yet been determined. GLSL Programs This was simplified to use XMACROS so that we can just extend one file (gskglprograms.defs) instead of multiple places. The programs are added as fields in the driver for easy access. Driver The driver manages textures, render targets, access to atlases, programs, and more. There is one driver per display, by using the shared GL context. Some work could be done here to batch uploads so that we make fewer calls to upload when sending icon theme data to the GPU. We'd need to keep a copy of the atlas data for such purposes.
84 lines
4.6 KiB
Plaintext
84 lines
4.6 KiB
Plaintext
GSK_NGL_DEFINE_PROGRAM (blend,
|
|
"/org/gtk/libgsk/glsl/blend.glsl",
|
|
GSK_NGL_ADD_UNIFORM (1, BLEND_SOURCE2, u_source2)
|
|
GSK_NGL_ADD_UNIFORM (2, BLEND_MODE, u_mode))
|
|
|
|
GSK_NGL_DEFINE_PROGRAM (blit,
|
|
"/org/gtk/libgsk/glsl/blit.glsl",
|
|
GSK_NGL_NO_UNIFORMS)
|
|
|
|
GSK_NGL_DEFINE_PROGRAM (blur,
|
|
"/org/gtk/libgsk/glsl/blur.glsl",
|
|
GSK_NGL_ADD_UNIFORM (1, BLUR_RADIUS, u_blur_radius)
|
|
GSK_NGL_ADD_UNIFORM (2, BLUR_SIZE, u_blur_size)
|
|
GSK_NGL_ADD_UNIFORM (3, BLUR_DIR, u_blur_dir))
|
|
|
|
GSK_NGL_DEFINE_PROGRAM (border,
|
|
"/org/gtk/libgsk/glsl/border.glsl",
|
|
GSK_NGL_ADD_UNIFORM (1, BORDER_COLOR, u_color)
|
|
GSK_NGL_ADD_UNIFORM (2, BORDER_WIDTHS, u_widths)
|
|
GSK_NGL_ADD_UNIFORM (3, BORDER_OUTLINE_RECT, u_outline_rect))
|
|
|
|
GSK_NGL_DEFINE_PROGRAM (color,
|
|
"/org/gtk/libgsk/glsl/color.glsl",
|
|
GSK_NGL_ADD_UNIFORM (1, COLOR_COLOR, u_color))
|
|
|
|
GSK_NGL_DEFINE_PROGRAM (coloring,
|
|
"/org/gtk/libgsk/glsl/coloring.glsl",
|
|
GSK_NGL_ADD_UNIFORM (1, COLORING_COLOR, u_color))
|
|
|
|
GSK_NGL_DEFINE_PROGRAM (color_matrix,
|
|
"/org/gtk/libgsk/glsl/color_matrix.glsl",
|
|
GSK_NGL_ADD_UNIFORM (1, COLOR_MATRIX_COLOR_MATRIX, u_color_matrix)
|
|
GSK_NGL_ADD_UNIFORM (2, COLOR_MATRIX_COLOR_OFFSET, u_color_offset))
|
|
|
|
GSK_NGL_DEFINE_PROGRAM (conic_gradient,
|
|
"/org/gtk/libgsk/glsl/conic_gradient.glsl",
|
|
GSK_NGL_ADD_UNIFORM (1, CONIC_GRADIENT_COLOR_STOPS, u_color_stops)
|
|
GSK_NGL_ADD_UNIFORM (2, CONIC_GRADIENT_NUM_COLOR_STOPS, u_num_color_stops)
|
|
GSK_NGL_ADD_UNIFORM (3, CONIC_GRADIENT_GEOMETRY, u_geometry))
|
|
|
|
GSK_NGL_DEFINE_PROGRAM (cross_fade,
|
|
"/org/gtk/libgsk/glsl/cross_fade.glsl",
|
|
GSK_NGL_ADD_UNIFORM (1, CROSS_FADE_PROGRESS, u_progress)
|
|
GSK_NGL_ADD_UNIFORM (2, CROSS_FADE_SOURCE2, u_source2))
|
|
|
|
GSK_NGL_DEFINE_PROGRAM (inset_shadow,
|
|
"/org/gtk/libgsk/glsl/inset_shadow.glsl",
|
|
GSK_NGL_ADD_UNIFORM (1, INSET_SHADOW_COLOR, u_color)
|
|
GSK_NGL_ADD_UNIFORM (2, INSET_SHADOW_SPREAD, u_spread)
|
|
GSK_NGL_ADD_UNIFORM (3, INSET_SHADOW_OFFSET, u_offset)
|
|
GSK_NGL_ADD_UNIFORM (4, INSET_SHADOW_OUTLINE_RECT, u_outline_rect))
|
|
|
|
GSK_NGL_DEFINE_PROGRAM (linear_gradient,
|
|
"/org/gtk/libgsk/glsl/linear_gradient.glsl",
|
|
GSK_NGL_ADD_UNIFORM (1, LINEAR_GRADIENT_COLOR_STOPS, u_color_stops)
|
|
GSK_NGL_ADD_UNIFORM (2, LINEAR_GRADIENT_NUM_COLOR_STOPS, u_num_color_stops)
|
|
GSK_NGL_ADD_UNIFORM (3, LINEAR_GRADIENT_POINTS, u_points)
|
|
GSK_NGL_ADD_UNIFORM (4, LINEAR_GRADIENT_REPEAT, u_repeat))
|
|
|
|
GSK_NGL_DEFINE_PROGRAM (outset_shadow,
|
|
"/org/gtk/libgsk/glsl/outset_shadow.glsl",
|
|
GSK_NGL_ADD_UNIFORM (1, OUTSET_SHADOW_COLOR, u_color)
|
|
GSK_NGL_ADD_UNIFORM (2, OUTSET_SHADOW_OUTLINE_RECT, u_outline_rect))
|
|
|
|
GSK_NGL_DEFINE_PROGRAM (radial_gradient,
|
|
"/org/gtk/libgsk/glsl/radial_gradient.glsl",
|
|
GSK_NGL_ADD_UNIFORM (1, RADIAL_GRADIENT_COLOR_STOPS, u_color_stops)
|
|
GSK_NGL_ADD_UNIFORM (2, RADIAL_GRADIENT_NUM_COLOR_STOPS, u_num_color_stops)
|
|
GSK_NGL_ADD_UNIFORM (3, RADIAL_GRADIENT_REPEAT, u_repeat)
|
|
GSK_NGL_ADD_UNIFORM (4, RADIAL_GRADIENT_RANGE, u_range)
|
|
GSK_NGL_ADD_UNIFORM (5, RADIAL_GRADIENT_GEOMETRY, u_geometry))
|
|
|
|
GSK_NGL_DEFINE_PROGRAM (repeat,
|
|
"/org/gtk/libgsk/glsl/repeat.glsl",
|
|
GSK_NGL_ADD_UNIFORM (1, REPEAT_CHILD_BOUNDS, u_child_bounds)
|
|
GSK_NGL_ADD_UNIFORM (2, REPEAT_TEXTURE_RECT, u_texture_rect))
|
|
|
|
GSK_NGL_DEFINE_PROGRAM (unblurred_outset_shadow,
|
|
"/org/gtk/libgsk/glsl/unblurred_outset_shadow.glsl",
|
|
GSK_NGL_ADD_UNIFORM (1, UNBLURRED_OUTSET_SHADOW_COLOR, u_color)
|
|
GSK_NGL_ADD_UNIFORM (2, UNBLURRED_OUTSET_SHADOW_SPREAD, u_spread)
|
|
GSK_NGL_ADD_UNIFORM (3, UNBLURRED_OUTSET_SHADOW_OFFSET, u_offset)
|
|
GSK_NGL_ADD_UNIFORM (4, UNBLURRED_OUTSET_SHADOW_OUTLINE_RECT, u_outline_rect))
|