1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgName
2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    MESA_ycbcr_texture
4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgName Strings
6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GL_MESA_ycbcr_texture
8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgContact
10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    Brian Paul, Tungsten Graphics, Inc. (brian.paul 'at' tungstengraphics.com)
12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    Keith Whitwell, Tungsten Graphics, Inc.  (keith 'at' tungstengraphics.com)
13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgStatus
15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    Shipping (Mesa 4.0.4 and later)
17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgVersion
19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    1.0
21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgNumber
23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    TBD
25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgDependencies
27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    OpenGL 1.0 or later is required
29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    This extension is written against the OpenGL 1.4 Specification.
30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    NV_texture_rectangle effects the definition of this extension.
31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgOverview
33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    This extension supports texture images stored in the YCbCr format.
35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    There is no support for converting YCbCr images to RGB or vice versa
36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    during pixel transfer.  The texture's YCbCr colors are converted to
37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    RGB during texture sampling, after-which, all the usual per-fragment
38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    operations take place.  Only 2D texture images are supported (not
39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    glDrawPixels, glReadPixels, etc).
40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    A YCbCr pixel (texel) is a 16-bit unsigned short with two components.
42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    The first component is luminance (Y).  For pixels in even-numbered
43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    image columns, the second component is Cb.  For pixels in odd-numbered
44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    image columns, the second component is Cr.  If one were to convert the
45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    data to RGB one would need to examine two pixels from columns N and N+1
46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    (where N is even) to deduce the RGB color.
47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgIP Status
49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    None
51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgIssues
53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    None
55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgNew Procedures and Functions
57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    None
59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgNew Tokens
61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    Accepted by the <internalFormat> and <format> parameters of
63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    TexImage2D and TexSubImage2D:
64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org        YCBCR_MESA                   0x8757
66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    Accepted by the <type> parameter of TexImage2D and TexSubImage2D:
68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org        UNSIGNED_SHORT_8_8_MESA      0x85BA /* same as Apple's */
70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org        UNSIGNED_SHORT_8_8_REV_MESA  0x85BB /* same as Apple's */
71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgAdditions to Chapter 2 of the OpenGL 1.4 Specification (OpenGL Operation)
73f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
74f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    None
75f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
76f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgAdditions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization)
77f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
78f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    In section 3.6.4, Rasterization of Pixel Rectangles, on page 101,
79f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    add the following to Table 3.8 (Packed pixel formats):
80f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    
81f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    type Parameter                GL Data   Number of        Matching
82f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     Token Name                    Type     Components     Pixel Formats
83f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    --------------                -------   ----------     -------------
84f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    UNSIGNED_SHORT_8_8_MESA       ushort         2         YCBCR_MESA
85f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    UNSIGNED_SHORT_8_8_REV_MESA   ushort         2         YCBCR_MESA
86f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
87f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
88f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    In section 3.6.4, Rasterization of Pixel Rectangles, on page 102,
89f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    add the following to Table 3.10 (UNSIGNED_SHORT formats):
90f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
91f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    UNSIGNED_SHORT_8_8_MESA:
92f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
93f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      15  14  13  12  11  10  9   8   7   6   5   4   3   2   1   0
94f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    +-------------------------------+-------------------------------+
95f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    |              1st              |              2nd              |
96f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    +-------------------------------+-------------------------------+
97f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                        
98f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    UNSIGNED_SHORT_8_8_REV_MESA:
99f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
100f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      15  14  13  12  11  10  9   8   7   6   5   4   3   2   1   0
101f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    +-------------------------------+-------------------------------+
102f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    |              2nd              |              1st              |
103f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    +-------------------------------+-------------------------------+
104f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
105f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
106f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    In section 3.6.4, Rasterization of Pixel Rectangles, on page 104,
107f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    add the following to Table 3.12 (Packed pixel field assignments):
108f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
109f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                       First       Second     Third      Fourth
110f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    Format             Element     Element    Element    Element
111f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    ------             -------     -------    -------    -------
112f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    YCBCR_MESA         luminance   chroma
113f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
114f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
115f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    In section 3.8.1, Texture Image Specification, on page 125, add
116f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    another item to the list of TexImage2D and TexImage3D equivalence
117f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    exceptions:
118f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
119f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    * The value of internalformat and format may be YCBCR_MESA to
120f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      indicate that the image data is in YCbCr format.  type must
121f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      be either UNSIGNED_SHORT_8_8_MESA or UNSIGNED_SHORT_8_8_REV_MESA
122f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      as seen in tables 3.8 and 3.10.  Table 3.12 describes the mapping
123f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      between Y and Cb/Cr to the components.
124f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      If NV_texture_rectangle is supported target may also be
125f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      TEXTURE_RECTANGLE_NV or PROXY_TEXTURE_RECTANGLE_NV.
126f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      All pixel transfer operations are bypassed.  The texture is stored as
127f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      YCbCr, not RGB.  Queries of the texture's red, green and blue component
128f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      sizes will return zero.  The YCbCr colors are converted to RGB during
129f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      texture sampling using an implementation dependent conversion.
130f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
131f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
132f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    In section 3.8.1, Texture Image Specification, on page 126, add
133f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    another item to the list of TexImage1D and TexImage2D equivalence
134f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    exceptions:
135f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
136f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    * The value of internalformat and format can not be YCBCR_MESA.
137f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
138f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
139f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    In section 3.8.2, Alternate Texture Image Specification Commands, on
140f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    page 129, insert this paragraph after the first full paragraph on the
141f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    page:
142f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
143f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org         "If the internal storage format of the image being updated by
144f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    TexSubImage2D is YCBCR_MESA then format must be YCBCR_MESA.
145f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    The error INVALID_OPERATION will be generated otherwise."
146f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
147f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
148f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgAdditions to Chapter 4 of the OpenGL 1.4 Specification (Per-Fragment
149f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgOperations and the Frame Buffer)
150f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
151f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    None
152f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
153f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgAdditions to Chapter 5 of the OpenGL 1.4 Specification (Special Functions)
154f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
155f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    None
156f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
157f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgAdditions to Chapter 6 of the OpenGL 1.4 Specification (State and
158f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgState Requests)
159f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
160f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    None
161f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
162f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgAdditions to Appendix A of the OpenGL 1.4 Specification (Invariance)
163f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
164f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    None
165f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
166f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgAdditions to the AGL/GLX/WGL Specifications
167f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
168f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    None
169f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
170f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgGLX Protocol
171f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
172f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    None
173f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
174f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgErrors
175f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
176f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    INVALID_ENUM is generated by TexImage2D if <internalFormat> is
177f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    MESA_YCBCR but <format> is not MESA_YCBCR.
178f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
179f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    INVALID_ENUM is generated by TexImage2D if <format> is MESA_YCBCR but
180f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    <internalFormat> is not MESA_YCBCR.
181f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
182f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    INVALID_VALUE is generated by TexImage2D if <format> is MESA_YCBCR and
183f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    <internalFormat> is MESA_YCBCR and <border> is not zero.
184f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
185f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    INVALID_OPERATION is generated by TexSubImage2D if the internal image
186f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    format is YCBCR_MESA and <format> is not YCBCR_MESA.
187f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
188f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    INVALID_OPERATION is generated by CopyTexSubImage2D if the internal
189f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    image is YCBCR_MESA.
190f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    
191f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgNew State
192f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
193f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    Edit table 6.16 on page 231: change the type of TEXTURE_INTERNAL_FORMAT
194f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    from n x Z42 to n x Z43 to indicate that internal format may also be
195f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    YCBCR_MESA.
196f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
197f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgRevision History
198f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
199f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    20 September 2002 - Initial draft
200f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    29 April 2003 - minor updates
201f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     3 September 2003 - further clarify when YCbCr->RGB conversion takes place
202f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    19 September 2003 - a few more updates prior to submitting to extension
203f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                        registry.
204f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     3 April 2004 - fix assorted inaccuracies
205