mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 14:10:30 +00:00
glrenderer: Move ProgramState into Program
There is no real reason to have this on the side indexed via the index, as it is stored next to each other anyway. Plus, storing them together lets use use `Program` structures not in the array.
This commit is contained in:
parent
e29c586b7c
commit
6887d0ce24
@ -2919,7 +2919,7 @@ gsk_gl_renderer_programs_new (void)
|
||||
programs->ref_count = 1;
|
||||
for (i = 0; i < GL_N_PROGRAMS; i ++)
|
||||
{
|
||||
programs->state[i].opacity = 1.0f;
|
||||
programs->programs[i].state.opacity = 1.0f;
|
||||
}
|
||||
|
||||
return programs;
|
||||
@ -2944,7 +2944,7 @@ gsk_gl_renderer_programs_unref (GskGLRendererPrograms *programs)
|
||||
{
|
||||
if (programs->programs[i].id > 0)
|
||||
glDeleteProgram (programs->programs[i].id);
|
||||
gsk_transform_unref (programs->state[i].modelview);
|
||||
gsk_transform_unref (programs->programs[i].state.modelview);
|
||||
}
|
||||
g_free (programs);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ get_current_program_state (RenderOpBuilder *builder)
|
||||
if (!builder->current_program)
|
||||
return NULL;
|
||||
|
||||
return &builder->programs->state[builder->current_program->index];
|
||||
return &builder->current_program->state;
|
||||
}
|
||||
|
||||
void
|
||||
@ -218,10 +218,10 @@ ops_free (RenderOpBuilder *builder)
|
||||
|
||||
void
|
||||
ops_set_program (RenderOpBuilder *builder,
|
||||
const Program *program)
|
||||
Program *program)
|
||||
{
|
||||
OpProgram *op;
|
||||
ProgramState *program_state;
|
||||
ProgramState *program_state = NULL;
|
||||
|
||||
if (builder->current_program == program)
|
||||
return;
|
||||
@ -231,7 +231,7 @@ ops_set_program (RenderOpBuilder *builder,
|
||||
|
||||
builder->current_program = program;
|
||||
|
||||
program_state = &builder->programs->state[program->index];
|
||||
program_state = &program->state;
|
||||
|
||||
if (memcmp (&builder->current_projection, &program_state->projection, sizeof (graphene_matrix_t)) != 0)
|
||||
{
|
||||
|
@ -31,6 +31,57 @@ typedef struct
|
||||
OpsMatrixMetadata metadata;
|
||||
} MatrixStackEntry;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GskTransform *modelview;
|
||||
GskRoundedRect clip;
|
||||
graphene_matrix_t projection;
|
||||
int source_texture;
|
||||
graphene_rect_t viewport;
|
||||
float opacity;
|
||||
/* Per-program state */
|
||||
union {
|
||||
GdkRGBA color;
|
||||
struct {
|
||||
graphene_matrix_t matrix;
|
||||
graphene_vec4_t offset;
|
||||
} color_matrix;
|
||||
struct {
|
||||
float widths[4];
|
||||
GdkRGBA color;
|
||||
GskRoundedRect outline;
|
||||
} border;
|
||||
struct {
|
||||
GskRoundedRect outline;
|
||||
float dx;
|
||||
float dy;
|
||||
float spread;
|
||||
GdkRGBA color;
|
||||
} inset_shadow;
|
||||
struct {
|
||||
GskRoundedRect outline;
|
||||
float dx;
|
||||
float dy;
|
||||
float spread;
|
||||
GdkRGBA color;
|
||||
} unblurred_outset_shadow;
|
||||
struct {
|
||||
int n_color_stops;
|
||||
GskColorStop color_stops[GL_MAX_GRADIENT_STOPS];
|
||||
float start_point[2];
|
||||
float end_point[2];
|
||||
} linear_gradient;
|
||||
struct {
|
||||
int n_color_stops;
|
||||
GskColorStop color_stops[GL_MAX_GRADIENT_STOPS];
|
||||
float center[2];
|
||||
float start;
|
||||
float end;
|
||||
float radius[2]; /* h/v */
|
||||
} radial_gradient;
|
||||
};
|
||||
} ProgramState;
|
||||
|
||||
struct _Program
|
||||
{
|
||||
int index; /* Into the renderer's program array */
|
||||
@ -109,59 +160,9 @@ struct _Program
|
||||
int texture_rect_location;
|
||||
} repeat;
|
||||
};
|
||||
ProgramState state;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GskTransform *modelview;
|
||||
GskRoundedRect clip;
|
||||
graphene_matrix_t projection;
|
||||
int source_texture;
|
||||
graphene_rect_t viewport;
|
||||
float opacity;
|
||||
/* Per-program state */
|
||||
union {
|
||||
GdkRGBA color;
|
||||
struct {
|
||||
graphene_matrix_t matrix;
|
||||
graphene_vec4_t offset;
|
||||
} color_matrix;
|
||||
struct {
|
||||
float widths[4];
|
||||
GdkRGBA color;
|
||||
GskRoundedRect outline;
|
||||
} border;
|
||||
struct {
|
||||
GskRoundedRect outline;
|
||||
float dx;
|
||||
float dy;
|
||||
float spread;
|
||||
GdkRGBA color;
|
||||
} inset_shadow;
|
||||
struct {
|
||||
GskRoundedRect outline;
|
||||
float dx;
|
||||
float dy;
|
||||
float spread;
|
||||
GdkRGBA color;
|
||||
} unblurred_outset_shadow;
|
||||
struct {
|
||||
int n_color_stops;
|
||||
GskColorStop color_stops[GL_MAX_GRADIENT_STOPS];
|
||||
float start_point[2];
|
||||
float end_point[2];
|
||||
} linear_gradient;
|
||||
struct {
|
||||
int n_color_stops;
|
||||
GskColorStop color_stops[GL_MAX_GRADIENT_STOPS];
|
||||
float center[2];
|
||||
float start;
|
||||
float end;
|
||||
float radius[2]; /* h/v */
|
||||
} radial_gradient;
|
||||
};
|
||||
} ProgramState;
|
||||
|
||||
typedef struct {
|
||||
int ref_count;
|
||||
union {
|
||||
@ -189,7 +190,7 @@ typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
GskGLRendererPrograms *programs;
|
||||
const Program *current_program;
|
||||
Program *current_program;
|
||||
int current_render_target;
|
||||
int current_texture;
|
||||
|
||||
@ -236,7 +237,7 @@ void ops_pop_modelview (RenderOpBuilder *builder);
|
||||
float ops_get_scale (const RenderOpBuilder *builder);
|
||||
|
||||
void ops_set_program (RenderOpBuilder *builder,
|
||||
const Program *program);
|
||||
Program *program);
|
||||
|
||||
void ops_push_clip (RenderOpBuilder *builder,
|
||||
const GskRoundedRect *clip);
|
||||
|
Loading…
Reference in New Issue
Block a user