forked from AuroraMiddleware/gtk
gl renderer: add basic code to support texture tiling
This commit is contained in:
parent
a9fec38680
commit
4240119d64
@ -654,3 +654,14 @@ gsk_gl_driver_init_texture_with_surface (GskGLDriver *self,
|
|||||||
if (t->min_filter != GL_NEAREST)
|
if (t->min_filter != GL_NEAREST)
|
||||||
glGenerateMipmap (GL_TEXTURE_2D);
|
glGenerateMipmap (GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gsk_gl_driver_texture_needs_tiling (GskGLDriver *self,
|
||||||
|
GdkTexture *texture)
|
||||||
|
{
|
||||||
|
int max = gsk_gl_driver_get_max_texture_size (self);
|
||||||
|
|
||||||
|
g_assert (self->max_texture_size > -1);
|
||||||
|
|
||||||
|
return texture->width > max || texture->height > max;
|
||||||
|
}
|
||||||
|
@ -33,6 +33,8 @@ int gsk_gl_driver_create_permanent_texture (GskGLDriver *driver
|
|||||||
int gsk_gl_driver_create_texture (GskGLDriver *driver,
|
int gsk_gl_driver_create_texture (GskGLDriver *driver,
|
||||||
float width,
|
float width,
|
||||||
float height);
|
float height);
|
||||||
|
gboolean gsk_gl_driver_texture_needs_tiling (GskGLDriver *driver,
|
||||||
|
GdkTexture *texture);
|
||||||
int gsk_gl_driver_create_render_target (GskGLDriver *driver,
|
int gsk_gl_driver_create_render_target (GskGLDriver *driver,
|
||||||
int texture_id,
|
int texture_id,
|
||||||
gboolean add_depth_buffer,
|
gboolean add_depth_buffer,
|
||||||
|
@ -554,12 +554,19 @@ static inline void
|
|||||||
render_texture_node (GskGLRenderer *self,
|
render_texture_node (GskGLRenderer *self,
|
||||||
GskRenderNode *node,
|
GskRenderNode *node,
|
||||||
RenderOpBuilder *builder)
|
RenderOpBuilder *builder)
|
||||||
|
{
|
||||||
|
GdkTexture *texture = gsk_texture_node_get_texture (node);
|
||||||
|
|
||||||
|
if (gsk_gl_driver_texture_needs_tiling (self->gl_driver, texture))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
const float min_x = builder->dx + node->bounds.origin.x;
|
const float min_x = builder->dx + node->bounds.origin.x;
|
||||||
const float min_y = builder->dy + node->bounds.origin.y;
|
const float min_y = builder->dy + node->bounds.origin.y;
|
||||||
const float max_x = min_x + node->bounds.size.width;
|
const float max_x = min_x + node->bounds.size.width;
|
||||||
const float max_y = min_y + node->bounds.size.height;
|
const float max_y = min_y + node->bounds.size.height;
|
||||||
GdkTexture *texture = gsk_texture_node_get_texture (node);
|
|
||||||
int gl_min_filter = GL_NEAREST, gl_mag_filter = GL_NEAREST;
|
int gl_min_filter = GL_NEAREST, gl_mag_filter = GL_NEAREST;
|
||||||
int texture_id;
|
int texture_id;
|
||||||
|
|
||||||
@ -583,6 +590,7 @@ render_texture_node (GskGLRenderer *self,
|
|||||||
{ { max_x, min_y }, { 1, 0 }, },
|
{ { max_x, min_y }, { 1, 0 }, },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
render_cairo_node (GskGLRenderer *self,
|
render_cairo_node (GskGLRenderer *self,
|
||||||
|
Loading…
Reference in New Issue
Block a user