From 362015cd770de486c5dea218d3609450682756ca Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sat, 14 May 2016 07:05:04 +0200 Subject: vo_opengl: abstract hook texture access behind macro This macro takes care of rotation, swizzling, integer conversion and normalization automatically. I found the performance impact to be nonexistant for superxbr and debanding, although rotation *did* have an impact due to the extra matrix multiplication. (So it gets skipped where possible) All of the internal hooks have been rewritten to use this new mechanism, and the prescaler hooks have finally been separated from each other. This also means the prescale FBO kludge is no longer required. This fixes image corruption for image formats like 0bgr, and also fixes prescaling under rotation. (As well as other user hooks that have orientation-dependent access) The "raw" attributes (tex, tex_pos, pixel_size) are still un-rotated, in case something needs them, but ideally the hooks should be rewritten to use the new API as much as possible. The hooked texture has been renamed from just NAME to NAME_raw to make script authors notice the change (and also deemphasize direct texture access). This is also a step towards getting rid of the use_integer pass. --- DOCS/man/vo.rst | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'DOCS') diff --git a/DOCS/man/vo.rst b/DOCS/man/vo.rst index 4d6972e5a3..7892761581 100644 --- a/DOCS/man/vo.rst +++ b/DOCS/man/vo.rst @@ -763,14 +763,26 @@ Available video output drivers are: definitions to that shader pass, where NAME is the name of the bound texture: - sampler NAME - The bound texture itself. + vec4 NAME_tex(vec2 pos) + The sampling function to use to access the texture at a certain + spot (in texture coordinate space, range [0,1]). This takes care + of any necessary normalization conversions. + vec4 NAME_texOff(vec2 offset) + Sample the texture at a certain offset in pixels. This works like + NAME_tex but additionally takes care of necessary rotations, so + that sampling at e.g. vec2(-1,0) is always one pixel to the left. vec2 NAME_pos The local texture coordinate of that texture, range [0,1]. vec2 NAME_size The (rotated) size in pixels of the texture. + mat2 NAME_rot + The rotation matrix associated with this texture. (Rotates + pixel space to texture coordinates) vec2 NAME_pt The (unrotated) size of a single pixel, range [0,1]. + sampler NAME_raw + The raw bound texture itself. The use of this should be + avoided unless absolutely necessary. In addition, the global uniforms described in ``post-shaders`` are also available. -- cgit v1.2.3