gfx/angle/extensions/ANGLE_pack_reverse_row_order.txt

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 Name
michael@0 2
michael@0 3 ANGLE_pack_reverse_row_order
michael@0 4
michael@0 5 Name Strings
michael@0 6
michael@0 7 GL_ANGLE_pack_reverse_row_order
michael@0 8
michael@0 9 Contact
michael@0 10
michael@0 11 Daniel Koch, TransGaming (daniel 'at' transgaming.com)
michael@0 12
michael@0 13 Contributors
michael@0 14
michael@0 15 Brian Salomon
michael@0 16 Daniel Koch
michael@0 17
michael@0 18 Status
michael@0 19
michael@0 20 Implemented in ANGLE ES2
michael@0 21
michael@0 22 Version
michael@0 23
michael@0 24 Last Modified Date: February 22, 2011
michael@0 25 Author Revision: 22
michael@0 26
michael@0 27 Number
michael@0 28
michael@0 29 OpenGL ES Extension #110
michael@0 30
michael@0 31 Dependencies
michael@0 32
michael@0 33 OpenGL 1.5 or OpenGL ES 1.0 are required.
michael@0 34
michael@0 35 Some of the functionality of this extension is not supported
michael@0 36 when implemented against OpenGL ES.
michael@0 37
michael@0 38 EXT_texture_rg interacts with this extension.
michael@0 39
michael@0 40 The extension is written against the OpenGL 3.2 Specification
michael@0 41 (Core Profile).
michael@0 42
michael@0 43 Overview
michael@0 44
michael@0 45 This extension introduces a mechanism to allow reversing the order
michael@0 46 in which image rows are written into a pack destination. This
michael@0 47 effectively allows an application to flip the results of a ReadPixels
michael@0 48 in the y direction operation without having to render upside down.
michael@0 49
michael@0 50 The coordinate system of OpenGL is vertically reversed in comparison to a
michael@0 51 number of other graphics systems such as native windowing APIs. Applications
michael@0 52 that perform ReadPixels may have to either render to an intermediate color
michael@0 53 buffer before calling ReadPixels or perform a flip in software after
michael@0 54 ReadPixels. In some systems the GL can perform the row reversal during
michael@0 55 ReadPixels without incurring additional cost.
michael@0 56
michael@0 57 IP Status
michael@0 58
michael@0 59 No known IP claims.
michael@0 60
michael@0 61 New Procedures and Functions
michael@0 62
michael@0 63 None
michael@0 64
michael@0 65 New Types
michael@0 66
michael@0 67 None
michael@0 68
michael@0 69 New Tokens
michael@0 70
michael@0 71 Accepted by the <pname> parameter of PixelStore{if}, GetIntegerv(),
michael@0 72 GetBooleanv(), and GetFloatv():
michael@0 73
michael@0 74 PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4
michael@0 75
michael@0 76 Additions to Chapter 3 of the OpenGL 3.2 Specification (Rasterization)
michael@0 77
michael@0 78 In Section 4.3.1 (Reading Pixels) add a row to table 4.7:
michael@0 79
michael@0 80 +------------------------------+---------+---------------+-------------+
michael@0 81 | Parameter Name | Type | Initial Value | Valid Range |
michael@0 82 +------------------------------+---------+---------------+-------------+
michael@0 83 | PACK_REVERSE_ROW_ORDER_ANGLE | boolean | FALSE | TRUE/FALSE |
michael@0 84 +------------------------------+---------+---------------+-------------+
michael@0 85
michael@0 86 In Section 4.3.1 (Reading Pixels) modify the second paragraph of subsection
michael@0 87 "Placement in Pixel Pack Buffer or Client Memory" to read:
michael@0 88
michael@0 89 When PACK_REVERSE_ROW_ORDER_ANGLE is FALSE groups of elements are placed
michael@0 90 in memory just as they are taken from memory when transferring pixel
michael@0 91 rectangles to the GL. That is, the ith group of the jth row
michael@0 92 (corresponding to the ith pixel in the jth row) is placed in memory just
michael@0 93 where the ith group of the jth row would be taken from when transferring
michael@0 94 pixels. See Unpacking under section 3.7.2. The only difference is that
michael@0 95 the storage mode parameters whose names begin with PACK_ are used
michael@0 96 instead of those whose names begin with UNPACK_. If the format is RED,
michael@0 97 GREEN, BLUE, or ALPHA, only the corresponding single element is written.
michael@0 98 Likewise if the format is RG, RGB, or BGR, only the corresponding two or
michael@0 99 three elements are written. Otherwise all the elements of each group are
michael@0 100 written. When PACK_REVERSE_ROW_ORDER_ANGLE is TRUE the order of the rows
michael@0 101 of elements is reversed before the data is packed. That is, the element
michael@0 102 corresponding to pixel (x, y + height - 1) becomes the first element
michael@0 103 packed, followed by (x + 1, y + height - 1), etc. Otherwise, pixel data
michael@0 104 is packed in the same manner as when PACK_REVERSE_ROW_ORDER_ANGLE is
michael@0 105 FALSE.
michael@0 106
michael@0 107 Additions to Chapter 6 of the OpenGL 3.2 Specification (State and State Requests)
michael@0 108
michael@0 109 In Section 6.1.4 add the following sentence to the fifth paragraph
michael@0 110 (beginning with "For three-dimensional and two-dimensional array
michael@0 111 textures..."):
michael@0 112 When PACK_REVERSE_ROW_ORDER_ANGLE is TRUE the order of rows within
michael@0 113 each image are reversed without reordering the images themselves.
michael@0 114
michael@0 115 Dependencies on OpenGL ES
michael@0 116
michael@0 117 If implemented for OpenGL ES, this extension behaves as specified, except:
michael@0 118
michael@0 119 -Delete all references to formats RED, GREEN, BLUE, RG, and BGR.
michael@0 120
michael@0 121 -The language about image order in Section 6.1.4 does not apply as OpenGL ES
michael@0 122 does not have GetTexImage.
michael@0 123
michael@0 124 Dependencies on EXT_texture_rg
michael@0 125
michael@0 126 If EXT_texture_rg is present reinsert language about formats RED and RG
michael@0 127 into the OpenGL ES 2.0 specification.
michael@0 128
michael@0 129 Errors
michael@0 130
michael@0 131 None
michael@0 132
michael@0 133 New State
michael@0 134 Initial
michael@0 135 Get Value Type Get Command Value Description Sec.
michael@0 136 --------- ---- ----------- ------- ----------- ----
michael@0 137 PACK_REVERSE_ROW_ORDER_ANGLE B GetIntegerv FALSE Pixel pack row order reversal 4.3.1
michael@0 138
michael@0 139 New Implementation Dependent State
michael@0 140
michael@0 141 None
michael@0 142
michael@0 143 Issues
michael@0 144
michael@0 145 None
michael@0 146
michael@0 147 Sample Code
michael@0 148
michael@0 149 /* Allocate space to hold the pixel data */
michael@0 150 const GLvoid* pixels = malloc(width * height * 4);
michael@0 151
michael@0 152 /* Bind the framebuffer object to be read */
michael@0 153 glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer);
michael@0 154
michael@0 155 /* Enable row order reversal */
michael@0 156 glPixelStore(GL_PACK_REVERSE_ROW_ORDER_ANGLE, TRUE);
michael@0 157
michael@0 158 /* The pixel data stored in pixels will be in top-down order, ready for
michael@0 159 * use with a windowing system API that expects this order.
michael@0 160 */
michael@0 161 glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
michael@0 162
michael@0 163 Revision History
michael@0 164
michael@0 165 Revision 1, 2011/11/22 (Brian Salomon)
michael@0 166 - First version
michael@0 167 Revision 2, 2012/02/22 (dgkoch)
michael@0 168 - prepare for publishing

mercurial