Commit 2dbbe256 authored by Eric Anholt's avatar Eric Anholt

Merge branch 'glamor-gongzg-merge'

parents 4d626461 7982eca6
noinst_LTLIBRARIES = libglamor.la
# Override these since glamor doesn't need them and the needed files aren't
# built (in hw/xfree86/os-support/solaris) until after glamor is built
SOLARIS_ASM_CFLAGS=""
if XORG
sdk_HEADERS = glamor.h
endif
if GLAMOR_GLES2
libglamor_la_LIBADD = $(GLESV2_LIBS)
else
libglamor_la_LIBADD = $(GL_LIBS)
endif
if XORG
sdk_HEADERS = glamor.h
endif
INCLUDES = \
$(XORG_INCS)
AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS) $(LIBDRM_CFLAGS)
libglamor_la_SOURCES = \
glamor.c \
glamor_copyarea.c \
glamor_copywindow.c \
glamor_core.c \
glamor_fill.c \
glamor_fillspans.c \
glamor_getspans.c \
glamor_glyphs.c \
glamor_polyfillrect.c \
glamor_polylines.c \
glamor_putimage.c \
glamor_setspans.c \
glamor_render.c \
glamor_tile.c \
glamor_triangles.c\
glamor_pixmap.c\
glamor_picture.c\
glamor_window.c\
glamor_gl_dispatch.c\
glamor.h
This diff is collapsed.
/*
* Copyright © 2008 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* Authors:
* Eric Anholt <eric@anholt.net>
*
*/
#ifndef GLAMOR_H
#define GLAMOR_H
#include "scrnintstr.h"
#ifdef GLAMOR_FOR_XORG
#include "xf86str.h"
#endif
#include "pixmapstr.h"
#include "windowstr.h"
#include "gcstruct.h"
#include "picturestr.h"
#include "fb.h"
#include "fbpict.h"
#endif /* GLAMOR_H */
#define GLAMOR_INVERTED_Y_AXIS 1
#define GLAMOR_HOSTX 2
#define GLAMOR_VALID_FLAGS (GLAMOR_INVERTED_Y_AXIS | GLAMOR_HOSTX)
#define GLAMOR_EGL_EXTERNAL_BUFFER 3
extern _X_EXPORT Bool glamor_init(ScreenPtr screen, unsigned int flags);
extern _X_EXPORT void glamor_fini(ScreenPtr screen);
extern _X_EXPORT void glamor_set_screen_pixmap_texture(ScreenPtr screen, int w, int h, unsigned int tex);
extern _X_EXPORT Bool glamor_glyphs_init (ScreenPtr pScreen);
void glamor_set_pixmap_texture(PixmapPtr pixmap, int w, int h, unsigned int tex);
#ifdef GLAMOR_FOR_XORG
extern _X_EXPORT Bool glamor_egl_init(ScrnInfoPtr scrn, int fd);
extern _X_EXPORT Bool glamor_create_egl_screen_image(ScreenPtr screen, int handle, int stride);
extern _X_EXPORT Bool glamor_create_egl_pixmap_image(PixmapPtr pixmap, int handle, int stride);
extern _X_EXPORT Bool glamor_close_egl_screen(ScreenPtr screen);
extern _X_EXPORT void glamor_free_egl_screen(int scrnIndex, int flags);
#endif
This diff is collapsed.
/*
* Copyright © 2008 Intel Corporation
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "glamor_priv.h"
/** @file glamor_copywindow.c
*
* Screen CopyWindow implementation.
*/
void glamor_copy_window(WindowPtr win, DDXPointRec old_origin,
RegionPtr src_region)
{
RegionRec dst_region;
int dx, dy;
PixmapPtr pixmap = win->drawable.pScreen->GetWindowPixmap(win);
dx = old_origin.x - win->drawable.x;
dy = old_origin.y - win->drawable.y;
REGION_TRANSLATE(win->drawable.pScreen, src_region, -dx, -dy);
REGION_INIT(win->drawable.pScreen, &dst_region, NullBox, 0);
REGION_INTERSECT(win->drawable.pScreen, &dst_region, &win->borderClip,
src_region);
#ifdef COMPOSITE
if (pixmap->screen_x || pixmap->screen_y)
REGION_TRANSLATE(win->drawable.pScreen, &dst_region,
-pixmap->screen_x, -pixmap->screen_y);
#endif
miCopyRegion(&pixmap->drawable, &pixmap->drawable,
NULL, &dst_region, dx, dy, glamor_copy_n_to_n, 0, NULL);
REGION_UNINIT(win->drawable.pScreen, &dst_region);
}
This diff is collapsed.
#ifndef __GLAMOR_DEBUG_H__
#define __GLAMOR_DEBUG_H__
#define GLAMOR_DELAYED_STRING_MAX 64
#define GLAMOR_DEBUG_NONE 0
#define GLAMOR_DEBUG_UNIMPL 0
#define GLAMOR_DEBUG_FALLBACK 1
#define GLAMOR_DEBUG_TEXTURE_DOWNLOAD 2
#define GLAMOR_DEBUG_TEXTURE_DYNAMIC_UPLOAD 3
extern void
AbortServer(void) _X_NORETURN;
#define GLAMOR_PANIC(_format_, ...) \
do { \
LogMessageVerb(X_NONE, 0, "Glamor Fatal Error" \
" at %32s line %d: " _format_ "\n", \
__FUNCTION__, __LINE__, \
##__VA_ARGS__ ); \
AbortServer(); \
} while(0)
#define __debug_output_message(_format_, _prefix_, ...) \
LogMessageVerb(X_NONE, 0, \
"%32s:\t" _format_ , \
/*_prefix_,*/ \
__FUNCTION__, \
##__VA_ARGS__)
#define glamor_debug_output(_level_, _format_,...) \
do { \
if (glamor_debug_level >= _level_) \
__debug_output_message(_format_, \
"Glamor debug", \
##__VA_ARGS__); \
} while(0)
#define glamor_fallback(_format_,...) \
do { \
if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) \
__debug_output_message(_format_, \
"Glamor fallback", \
##__VA_ARGS__);} while(0)
#define glamor_delayed_fallback(_screen_, _format_,...) \
do { \
if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) { \
glamor_screen_private *_glamor_priv_; \
_glamor_priv_ = glamor_get_screen_private(_screen_); \
_glamor_priv_->delayed_fallback_pending = 1; \
snprintf(_glamor_priv_->delayed_fallback_string, \
GLAMOR_DELAYED_STRING_MAX, \
"glamor delayed fallback: \t%s " _format_ , \
__FUNCTION__, ##__VA_ARGS__); } } while(0)
#define glamor_clear_delayed_fallbacks(_screen_) \
do { \
if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) { \
glamor_screen_private *_glamor_priv_; \
_glamor_priv_ = glamor_get_screen_private(_screen_); \
_glamor_priv_->delayed_fallback_pending = 0; } } while(0)
#define glamor_report_delayed_fallbacks(_screen_) \
do { \
if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) { \
glamor_screen_private *_glamor_priv_; \
_glamor_priv_ = glamor_get_screen_private(_screen_); \
LogMessageVerb(X_INFO, 0, "%s", \
_glamor_priv_->delayed_fallback_string); \
_glamor_priv_->delayed_fallback_pending = 0; } } while(0)
#endif
This diff is collapsed.
/*
* Copyright © 2008 Intel Corporation
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "glamor_priv.h"
/** @file glamor_fillspans.c
*
* GC fill implementation, based loosely on fb_fill.c
*/
void
glamor_fill(DrawablePtr drawable,
GCPtr gc,
int x,
int y,
int width,
int height)
{
PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(drawable);
int off_x, off_y;
glamor_get_drawable_deltas(drawable, dst_pixmap, &off_x, &off_y);
switch (gc->fillStyle) {
case FillSolid:
if (!glamor_solid(dst_pixmap,
x + off_x,
y + off_y,
width,
height,
gc->alu,
gc->planemask,
gc->fgPixel))
goto fail;
break;
case FillStippled:
case FillOpaqueStippled:
if (!glamor_stipple(dst_pixmap,
gc->stipple,
x + off_x,
y + off_y,
width,
height,
gc->alu,
gc->planemask,
gc->fgPixel,
gc->bgPixel,
gc->patOrg.x,
gc->patOrg.y))
goto fail;
return;
break;
case FillTiled:
if (!glamor_tile(dst_pixmap,
gc->tile.pixmap,
x + off_x,
y + off_y,
width,
height,
gc->alu,
gc->planemask,
drawable->x + x + off_x - gc->patOrg.x,
drawable->y + y + off_y - gc->patOrg.y))
goto fail;
break;
}
return;
fail:
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
if (glamor_prepare_access_gc(gc)) {
fbFill(drawable, gc, x, y, width, height);
glamor_finish_access_gc(gc);
}
glamor_finish_access(drawable);
}
return;
}
void
glamor_init_solid_shader(ScreenPtr screen)
{
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
const char *solid_vs =
"attribute vec4 v_position;"
"void main()\n"
"{\n"
" gl_Position = v_position;\n"
"}\n";
const char *solid_fs =
GLAMOR_DEFAULT_PRECISION
"uniform vec4 color;\n"
"void main()\n"
"{\n"
" gl_FragColor = color;\n"
"}\n";
GLint fs_prog, vs_prog;
glamor_priv->solid_prog = dispatch->glCreateProgram();
vs_prog = glamor_compile_glsl_prog(dispatch, GL_VERTEX_SHADER, solid_vs);
fs_prog = glamor_compile_glsl_prog(dispatch, GL_FRAGMENT_SHADER, solid_fs);
dispatch->glAttachShader(glamor_priv->solid_prog, vs_prog);
dispatch->glAttachShader(glamor_priv->solid_prog, fs_prog);
dispatch->glBindAttribLocation(glamor_priv->solid_prog, GLAMOR_VERTEX_POS, "v_position");
glamor_link_glsl_prog(dispatch, glamor_priv->solid_prog);
glamor_priv->solid_color_uniform_location =
dispatch->glGetUniformLocation(glamor_priv->solid_prog, "color");
}
Bool
glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
unsigned char alu, unsigned long planemask, unsigned long fg_pixel)
{
ScreenPtr screen = pixmap->drawable.pScreen;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
int x1 = x;
int x2 = x + width;
int y1 = y;
int y2 = y + height;
GLfloat color[4];
float vertices[8];
GLfloat xscale, yscale;
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
glamor_fallback("dest %p has no fbo.\n", pixmap);
goto fail;
}
glamor_set_alu(dispatch, alu);
if (!glamor_set_planemask(pixmap, planemask)) {
glamor_fallback("Failedto set planemask in glamor_solid.\n");
goto fail;
}
glamor_get_rgba_from_pixel(fg_pixel,
&color[0],
&color[1],
&color[2],
&color[3],
format_for_pixmap(pixmap));
#ifdef GLAMOR_DELAYED_FILLING
if (x == 0 && y == 0
&& width == pixmap->drawable.width
&& height == pixmap->drawable.height
&& pixmap_priv->fb != glamor_priv->screen_fbo ) {
pixmap_priv->pending_op.type = GLAMOR_PENDING_FILL;
memcpy(&pixmap_priv->pending_op.fill.color4fv,
color, 4*sizeof(GLfloat));
pixmap_priv->pending_op.fill.colori = fg_pixel;
return TRUE;
}
#endif
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
glamor_validate_pixmap(pixmap);
dispatch->glUseProgram(glamor_priv->solid_prog);
dispatch->glUniform4fv(glamor_priv->solid_color_uniform_location, 1, color);
dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE,
2 * sizeof(float), vertices);
dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
pixmap_priv_get_scale(pixmap_priv, &xscale, &yscale);
glamor_set_normalize_vcoords(xscale, yscale, x1, y1, x2, y2,
glamor_priv->yInverted,
vertices);
dispatch->glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
dispatch->glUseProgram(0);
return TRUE;
fail:
glamor_set_alu(dispatch, GXcopy);
glamor_set_planemask(pixmap, ~0);
return FALSE;
}
/*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
/** @file glamor_fillspans.c
*
* FillSpans implementation, taken from fb_fillsp.c
*/
#include "glamor_priv.h"
void
glamor_fill_spans(DrawablePtr drawable,
GCPtr gc,
int n,
DDXPointPtr points,
int *widths,
int sorted)
{
DDXPointPtr ppt;
int nbox;
BoxPtr pbox;
int x1, x2, y;
RegionPtr pClip = fbGetCompositeClip(gc);
if (gc->fillStyle != FillSolid && gc->fillStyle != FillTiled)
goto fail;
ppt = points;
while (n--) {
x1 = ppt->x;
y = ppt->y;
x2 = x1 + (int)*widths;
ppt++;
widths++;
nbox = REGION_NUM_RECTS(pClip);
pbox = REGION_RECTS(pClip);
while (nbox--) {
if (pbox->y1 > y || pbox->y2 <= y)
continue;
if (x1 < pbox->x1)
x1 = pbox->x1;
if (x2 > pbox->x2)
x2 = pbox->x2;
if (x2 <= x1)
continue;
glamor_fill (drawable,gc,
x1, y,
x2 - x1 , 1);
pbox++;
}
}
return;
fail:
glamor_fallback("to %p (%c)\n", drawable,
glamor_get_drawable_location(drawable));
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
if (glamor_prepare_access_gc(gc)) {
fbFillSpans(drawable, gc, n, points, widths, sorted);
glamor_finish_access_gc(gc);
}
glamor_finish_access(drawable);
}
}
/*
* Copyright © 2009 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* Authors:
* Eric Anholt <eric@anholt.net>
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "glamor_priv.h"
void
glamor_get_spans(DrawablePtr drawable,
int wmax,
DDXPointPtr points,
int *widths,
int count,
char *dst)
{
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
GLenum format, type;
int no_alpha, no_revert;
glamor_screen_private *glamor_priv = glamor_get_screen_private(drawable->pScreen);
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
PixmapPtr temp_pixmap = NULL;
int i;
uint8_t *readpixels_dst = (uint8_t *)dst;
int x_off, y_off;
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
glamor_fallback("pixmap has no fbo.\n");
goto fail;
}
if (glamor_get_tex_format_type_from_pixmap(pixmap,
&format,
&type,
&no_alpha,
&no_revert
)) {
glamor_fallback("unknown depth. %d \n",
drawable->depth);
goto fail;
}
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
glamor_validate_pixmap(pixmap);
if (glamor_priv->gl_flavor == GLAMOR_GL_ES2) {
/* XXX prepare whole pixmap is not efficient. */
temp_pixmap = glamor_es2_pixmap_read_prepare(pixmap, &format,
&type, no_alpha, no_revert);
pixmap_priv = glamor_get_pixmap_private(temp_pixmap);
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
}
glamor_get_drawable_deltas(drawable, pixmap, &x_off, &y_off);
for (i = 0; i < count; i++) {
if (glamor_priv->yInverted) {
dispatch->glReadPixels(points[i].x + x_off,
(points[i].y + y_off),
widths[i],
1,
format, type,
readpixels_dst);
} else {
dispatch->glReadPixels(points[i].x + x_off,
pixmap->drawable.height - 1 - (points[i].y + y_off),
widths[i],
1,
format, type,
readpixels_dst);
}
readpixels_dst += PixmapBytePad(widths[i], drawable->depth);
}
if (temp_pixmap)
pixmap->drawable.pScreen->DestroyPixmap(temp_pixmap);
return;
fail:
glamor_fallback("from %p (%c)\n", drawable,
glamor_get_drawable_location(drawable));
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RO)) {
fbGetSpans(drawable, wmax, points, widths, count, dst);
glamor_finish_access(drawable);
}
}
#include "glamor_priv.h"
#define INIT_FUNC(dst,func_name,get) \
dst->func_name = get(#func_name); \
if (dst->func_name == NULL) \
{ ErrorF("Failed to get fun %s", #func_name); \
goto fail; }
Bool
glamor_gl_dispatch_init_impl(struct glamor_gl_dispatch *dispatch,
int gl_version,
void *(*get_proc_address)(const char*))
{
INIT_FUNC(dispatch, glMatrixMode, get_proc_address);
INIT_FUNC(dispatch, glLoadIdentity, get_proc_address);
INIT_FUNC(dispatch, glViewport, get_proc_address);
INIT_FUNC(dispatch, glRasterPos2i, get_proc_address);
INIT_FUNC(dispatch, glDrawArrays, get_proc_address);
INIT_FUNC(dispatch, glReadPixels, get_proc_address);
INIT_FUNC(dispatch, glDrawPixels, get_proc_address);
INIT_FUNC(dispatch, glPixelStorei, get_proc_address);
INIT_FUNC(dispatch, glTexParameteri, get_proc_address);