diff options
author | Keith Packard <keithp@keithp.com> | 2014-10-13 11:40:06 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2015-05-14 16:12:42 -0700 |
commit | 1b745e0c1ff45e014aa21c3d8edf93227bec99bf (patch) | |
tree | e46e81c83286e767992d8acd2e423f5b851133e5 /glamor/glamor_transform.c | |
parent | ff3195aadde95c8e89f77f389a7dfb418dd2426c (diff) |
glamor: Adapt glamor_program API to handle render acceleration
This extends the existing API to support options needed for render
accleration, including an additional fragment, 'combine', (which
provides a place to perform the source IN mask operation before the
final OP dest state) and an additional 'defines' parameter which
provides a way to add target-dependent values without using a uniform.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'glamor/glamor_transform.c')
-rw-r--r-- | glamor/glamor_transform.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/glamor/glamor_transform.c b/glamor/glamor_transform.c index e94bca856..f476a99b7 100644 --- a/glamor/glamor_transform.c +++ b/glamor/glamor_transform.c @@ -155,11 +155,7 @@ glamor_set_solid(PixmapPtr pixmap, } Bool -glamor_set_texture(PixmapPtr texture, - int off_x, - int off_y, - GLint offset_uniform, - GLint size_inv_uniform) +glamor_set_texture_pixmap(PixmapPtr texture) { glamor_pixmap_private *texture_priv; @@ -174,6 +170,23 @@ glamor_set_texture(PixmapPtr texture, glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, texture_priv->fbo->tex); + /* we're not setting the sampler uniform here as we always use + * GL_TEXTURE0, and the default value for uniforms is zero. So, + * save a bit of CPU time by taking advantage of that. + */ + return TRUE; +} + +Bool +glamor_set_texture(PixmapPtr texture, + int off_x, + int off_y, + GLint offset_uniform, + GLint size_inv_uniform) +{ + if (!glamor_set_texture_pixmap(texture)) + return FALSE; + glUniform2f(offset_uniform, off_x, off_y); glUniform2f(size_inv_uniform, 1.0f/texture->drawable.width, 1.0f/texture->drawable.height); return TRUE; |