Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
Conflicts: configs/default
This commit is contained in:
+12
-30
@@ -30,14 +30,15 @@ import common
|
||||
# Configuration options
|
||||
|
||||
if common.default_platform in ('linux', 'freebsd', 'darwin'):
|
||||
default_statetrackers = 'mesa'
|
||||
default_statetrackers = 'all'
|
||||
default_drivers = 'softpipe,failover,i915simple,i965simple'
|
||||
default_winsys = 'xlib'
|
||||
elif common.default_platform in ('winddk',):
|
||||
default_statetrackers = 'none'
|
||||
default_statetrackers = 'all'
|
||||
default_drivers = 'softpipe,i915simple'
|
||||
default_winsys = 'none'
|
||||
default_winsys = 'all'
|
||||
else:
|
||||
default_statetrackers = 'all'
|
||||
default_drivers = 'all'
|
||||
default_winsys = 'all'
|
||||
|
||||
@@ -48,11 +49,15 @@ opts.Add(ListOption('statetrackers', 'state_trackers to build', default_statetra
|
||||
opts.Add(ListOption('drivers', 'pipe drivers to build', default_drivers,
|
||||
['softpipe', 'failover', 'i915simple', 'i965simple', 'cell']))
|
||||
opts.Add(ListOption('winsys', 'winsys drivers to build', default_winsys,
|
||||
['xlib', 'intel']))
|
||||
['xlib', 'intel', 'gdi']))
|
||||
|
||||
env = Environment(
|
||||
options = opts,
|
||||
ENV = os.environ)
|
||||
options = opts,
|
||||
tools = ['gallium'],
|
||||
toolpath = ['scons'],
|
||||
ENV = os.environ,
|
||||
)
|
||||
|
||||
Help(opts.GenerateHelpText(env))
|
||||
|
||||
# replicate options values in local variables
|
||||
@@ -80,22 +85,6 @@ Export([
|
||||
|
||||
#######################################################################
|
||||
# Environment setup
|
||||
#
|
||||
# TODO: put the compiler specific settings in separate files
|
||||
# TODO: auto-detect as much as possible
|
||||
|
||||
if platform == 'winddk':
|
||||
env.Tool('winddk', ['.'])
|
||||
|
||||
env.Append(CPPPATH = [
|
||||
env['SDK_INC_PATH'],
|
||||
env['DDK_INC_PATH'],
|
||||
env['WDM_INC_PATH'],
|
||||
env['CRT_INC_PATH'],
|
||||
])
|
||||
|
||||
common.generate(env)
|
||||
|
||||
|
||||
# Includes
|
||||
env.Append(CPPPATH = [
|
||||
@@ -106,13 +95,6 @@ env.Append(CPPPATH = [
|
||||
])
|
||||
|
||||
|
||||
# x86 assembly
|
||||
if x86:
|
||||
if gcc:
|
||||
env.Append(CFLAGS = '-m32')
|
||||
env.Append(CXXFLAGS = '-m32')
|
||||
|
||||
|
||||
# Posix
|
||||
if platform in ('posix', 'linux', 'freebsd', 'darwin'):
|
||||
env.Append(CPPDEFINES = [
|
||||
@@ -177,6 +159,6 @@ Export('env')
|
||||
|
||||
SConscript(
|
||||
'src/SConscript',
|
||||
build_dir = common.make_build_dir(env),
|
||||
build_dir = env['build'],
|
||||
duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
|
||||
)
|
||||
|
||||
@@ -202,8 +202,13 @@ case $ARCH in
|
||||
if [ $NOPREFIX = 1 ] ; then
|
||||
# No "lib" or ".so" part
|
||||
echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}
|
||||
#OPTS="-shared -Wl,-soname,${LIBNAME}" # soname???
|
||||
OPTS="-shared"
|
||||
case $ARCH in 'Linux' | 'GNU' | GNU/*)
|
||||
OPTS="-Xlinker -Bsymbolic -shared"
|
||||
;;
|
||||
*)
|
||||
OPTS="-shared"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Check if objects are 32-bit and we're running in 64-bit
|
||||
# environment. If so, pass -m32 flag to linker.
|
||||
|
||||
+31
-3
@@ -1,12 +1,39 @@
|
||||
#!/usr/bin/env python
|
||||
##########################################################################
|
||||
#
|
||||
# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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, sub license, 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 NON-INFRINGEMENT.
|
||||
# IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
|
||||
import sys
|
||||
import optparse
|
||||
import re
|
||||
import struct
|
||||
|
||||
__version__ = '0.1'
|
||||
|
||||
__version__ = '0.1'
|
||||
|
||||
verbose = False
|
||||
|
||||
@@ -16,7 +43,7 @@ class ParseError(Exception):
|
||||
|
||||
|
||||
class MsvcDemangler:
|
||||
# http://www.kegel.com/mangle.html
|
||||
# http://www.kegel.com/mangle.html
|
||||
|
||||
def __init__(self, symbol):
|
||||
self._symbol = symbol
|
||||
@@ -112,7 +139,8 @@ class Profile:
|
||||
continue
|
||||
if type != 'f':
|
||||
continue
|
||||
addr = int(addr, 16)
|
||||
section, offset = section_offset.split(':')
|
||||
addr = int(offset, 16)
|
||||
name = demangle(name)
|
||||
if last_addr == addr:
|
||||
# TODO: handle collapsed functions
|
||||
|
||||
@@ -34,7 +34,7 @@ default_machine = _machine_map.get(default_machine, 'generic')
|
||||
|
||||
if default_platform in ('linux', 'freebsd', 'darwin'):
|
||||
default_dri = 'yes'
|
||||
elif default_platform in ('winddk', 'windows'):
|
||||
elif default_platform in ('winddk', 'windows', 'wince'):
|
||||
default_dri = 'no'
|
||||
else:
|
||||
default_dri = 'no'
|
||||
@@ -58,254 +58,7 @@ def AddOptions(opts):
|
||||
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
|
||||
allowed_values=('generic', 'x86', 'x86_64')))
|
||||
opts.Add(EnumOption('platform', 'target platform', default_platform,
|
||||
allowed_values=('linux', 'cell', 'windows', 'winddk')))
|
||||
allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince')))
|
||||
opts.Add(BoolOption('llvm', 'use LLVM', 'no'))
|
||||
opts.Add(BoolOption('dri', 'build DRI drivers', default_dri))
|
||||
|
||||
|
||||
#######################################################################
|
||||
# Quiet command lines
|
||||
#
|
||||
# See also http://www.scons.org/wiki/HidingCommandLinesInOutput
|
||||
|
||||
def quietCommandLines(env):
|
||||
env['CCCOMSTR'] = "Compiling $SOURCE ..."
|
||||
env['CXXCOMSTR'] = "Compiling $SOURCE ..."
|
||||
env['ARCOMSTR'] = "Archiving $TARGET ..."
|
||||
env['RANLIBCOMSTR'] = ""
|
||||
env['LINKCOMSTR'] = "Linking $TARGET ..."
|
||||
|
||||
|
||||
#######################################################################
|
||||
# Convenience Library Builder
|
||||
# based on the stock StaticLibrary and SharedLibrary builders
|
||||
|
||||
import SCons.Action
|
||||
import SCons.Builder
|
||||
|
||||
def createConvenienceLibBuilder(env):
|
||||
"""This is a utility function that creates the ConvenienceLibrary
|
||||
Builder in an Environment if it is not there already.
|
||||
|
||||
If it is already there, we return the existing one.
|
||||
"""
|
||||
|
||||
try:
|
||||
convenience_lib = env['BUILDERS']['ConvenienceLibrary']
|
||||
except KeyError:
|
||||
action_list = [ SCons.Action.Action("$ARCOM", "$ARCOMSTR") ]
|
||||
if env.Detect('ranlib'):
|
||||
ranlib_action = SCons.Action.Action("$RANLIBCOM", "$RANLIBCOMSTR")
|
||||
action_list.append(ranlib_action)
|
||||
|
||||
convenience_lib = SCons.Builder.Builder(action = action_list,
|
||||
emitter = '$LIBEMITTER',
|
||||
prefix = '$LIBPREFIX',
|
||||
suffix = '$LIBSUFFIX',
|
||||
src_suffix = '$SHOBJSUFFIX',
|
||||
src_builder = 'SharedObject')
|
||||
env['BUILDERS']['ConvenienceLibrary'] = convenience_lib
|
||||
env['BUILDERS']['Library'] = convenience_lib
|
||||
|
||||
return convenience_lib
|
||||
|
||||
|
||||
#######################################################################
|
||||
# Build
|
||||
|
||||
def make_build_dir(env):
|
||||
# Put build output in a separate dir, which depends on the current configuration
|
||||
# See also http://www.scons.org/wiki/AdvancedBuildExample
|
||||
build_topdir = 'build'
|
||||
build_subdir = env['platform']
|
||||
if env['dri']:
|
||||
build_subdir += "-dri"
|
||||
if env['llvm']:
|
||||
build_subdir += "-llvm"
|
||||
if env['machine'] != 'generic':
|
||||
build_subdir += '-' + env['machine']
|
||||
if env['debug']:
|
||||
build_subdir += "-debug"
|
||||
if env['profile']:
|
||||
build_subdir += "-profile"
|
||||
build_dir = os.path.join(build_topdir, build_subdir)
|
||||
# Place the .sconsign file on the builddir too, to avoid issues with different scons
|
||||
# versions building the same source file
|
||||
env.SConsignFile(os.path.join(build_dir, '.sconsign'))
|
||||
return build_dir
|
||||
|
||||
|
||||
#######################################################################
|
||||
# Common environment generation code
|
||||
|
||||
def generate(env):
|
||||
# FIXME: this is already too late
|
||||
#if env.get('quiet', False):
|
||||
# quietCommandLines(env)
|
||||
|
||||
# shortcuts
|
||||
debug = env['debug']
|
||||
machine = env['machine']
|
||||
platform = env['platform']
|
||||
x86 = env['machine'] == 'x86'
|
||||
gcc = env['platform'] in ('linux', 'freebsd', 'darwin')
|
||||
msvc = env['platform'] in ('windows', 'winddk')
|
||||
|
||||
# C preprocessor options
|
||||
cppdefines = []
|
||||
if debug:
|
||||
cppdefines += ['DEBUG']
|
||||
else:
|
||||
cppdefines += ['NDEBUG']
|
||||
if env['profile']:
|
||||
cppdefines += ['PROFILE']
|
||||
if platform == 'windows':
|
||||
cppdefines += [
|
||||
'WIN32',
|
||||
'_WINDOWS',
|
||||
'_UNICODE',
|
||||
'UNICODE',
|
||||
# http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx,
|
||||
'WIN32_LEAN_AND_MEAN',
|
||||
'VC_EXTRALEAN',
|
||||
'_CRT_SECURE_NO_DEPRECATE',
|
||||
]
|
||||
if debug:
|
||||
cppdefines += ['_DEBUG']
|
||||
if platform == 'winddk':
|
||||
# Mimic WINDDK's builtin flags. See also:
|
||||
# - WINDDK's bin/makefile.new i386mk.inc for more info.
|
||||
# - buildchk_wxp_x86.log files, generated by the WINDDK's build
|
||||
# - http://alter.org.ua/docs/nt_kernel/vc8_proj/
|
||||
cppdefines += [
|
||||
('_X86_', '1'),
|
||||
('i386', '1'),
|
||||
'STD_CALL',
|
||||
('CONDITION_HANDLING', '1'),
|
||||
('NT_INST', '0'),
|
||||
('WIN32', '100'),
|
||||
('_NT1X_', '100'),
|
||||
('WINNT', '1'),
|
||||
('_WIN32_WINNT', '0x0501'), # minimum required OS version
|
||||
('WINVER', '0x0501'),
|
||||
('_WIN32_IE', '0x0603'),
|
||||
('WIN32_LEAN_AND_MEAN', '1'),
|
||||
('DEVL', '1'),
|
||||
('__BUILDMACHINE__', 'WinDDK'),
|
||||
('FPO', '0'),
|
||||
]
|
||||
if debug:
|
||||
cppdefines += [('DBG', 1)]
|
||||
if platform == 'windows':
|
||||
cppdefines += ['PIPE_SUBSYSTEM_USER']
|
||||
if platform == 'winddk':
|
||||
cppdefines += ['PIPE_SUBSYSTEM_KERNEL']
|
||||
env.Append(CPPDEFINES = cppdefines)
|
||||
|
||||
# C compiler options
|
||||
cflags = []
|
||||
if gcc:
|
||||
if debug:
|
||||
cflags += ['-O0', '-g3']
|
||||
else:
|
||||
cflags += ['-O3', '-g3']
|
||||
if env['profile']:
|
||||
cflags += ['-pg']
|
||||
cflags += [
|
||||
'-Wall',
|
||||
'-Wmissing-prototypes',
|
||||
'-Wno-long-long',
|
||||
'-ffast-math',
|
||||
'-pedantic',
|
||||
'-fmessage-length=0', # be nice to Eclipse
|
||||
]
|
||||
if msvc:
|
||||
# See also:
|
||||
# - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
|
||||
# - cl /?
|
||||
if debug:
|
||||
cflags += [
|
||||
'/Od', # disable optimizations
|
||||
'/Oi', # enable intrinsic functions
|
||||
'/Oy-', # disable frame pointer omission
|
||||
]
|
||||
else:
|
||||
cflags += [
|
||||
'/Ox', # maximum optimizations
|
||||
'/Oi', # enable intrinsic functions
|
||||
'/Os', # favor code space
|
||||
]
|
||||
if env['profile']:
|
||||
cflags += [
|
||||
'/Gh', # enable _penter hook function
|
||||
'/GH', # enable _pexit hook function
|
||||
]
|
||||
if platform == 'windows':
|
||||
cflags += [
|
||||
# TODO
|
||||
#'/Wp64', # enable 64 bit porting warnings
|
||||
]
|
||||
if platform == 'winddk':
|
||||
cflags += [
|
||||
'/Zl', # omit default library name in .OBJ
|
||||
'/Zp8', # 8bytes struct member alignment
|
||||
'/Gy', # separate functions for linker
|
||||
'/Gm-', # disable minimal rebuild
|
||||
'/W3', # warning level
|
||||
'/WX', # treat warnings as errors
|
||||
'/Gz', # __stdcall Calling convention
|
||||
'/GX-', # disable C++ EH
|
||||
'/GR-', # disable C++ RTTI
|
||||
'/GF', # enable read-only string pooling
|
||||
'/G6', # optimize for PPro, P-II, P-III
|
||||
'/Ze', # enable extensions
|
||||
'/Gi-', # disable incremental compilation
|
||||
'/QIfdiv-', # disable Pentium FDIV fix
|
||||
'/hotpatch', # prepares an image for hotpatching.
|
||||
#'/Z7', #enable old-style debug info
|
||||
]
|
||||
# Put debugging information in a separate .pdb file for each object file as
|
||||
# descrived in the scons manpage
|
||||
env['CCPDBFLAGS'] = '/Zi /Fd${TARGET}.pdb'
|
||||
env.Append(CFLAGS = cflags)
|
||||
env.Append(CXXFLAGS = cflags)
|
||||
|
||||
# Linker options
|
||||
if platform == 'winddk':
|
||||
# See also:
|
||||
# - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
|
||||
env.Append(LINKFLAGS = [
|
||||
'/merge:_PAGE=PAGE',
|
||||
'/merge:_TEXT=.text',
|
||||
'/section:INIT,d',
|
||||
'/opt:ref',
|
||||
'/opt:icf',
|
||||
'/ignore:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221',
|
||||
'/incremental:no',
|
||||
'/fullbuild',
|
||||
'/release',
|
||||
'/nodefaultlib',
|
||||
'/wx',
|
||||
'/debug',
|
||||
'/debugtype:cv',
|
||||
'/version:5.1',
|
||||
'/osversion:5.1',
|
||||
'/functionpadmin:5',
|
||||
'/safeseh',
|
||||
'/pdbcompress',
|
||||
'/stack:0x40000,0x1000',
|
||||
'/driver',
|
||||
'/align:0x80',
|
||||
'/subsystem:native,5.01',
|
||||
'/base:0x10000',
|
||||
|
||||
'/entry:DrvEnableDriver',
|
||||
])
|
||||
|
||||
|
||||
createConvenienceLibBuilder(env)
|
||||
|
||||
|
||||
# for debugging
|
||||
#print env.Dump()
|
||||
|
||||
|
||||
+3
-2
@@ -60,7 +60,7 @@ GLW_SOURCES = GLwDrawA.c
|
||||
|
||||
# Directories to build
|
||||
LIB_DIR = lib
|
||||
SRC_DIRS = gallium mesa gallium/winsys glu glut/glx glw
|
||||
SRC_DIRS = gallium mesa egl gallium/winsys glu glut/glx glw
|
||||
GLU_DIRS = sgi
|
||||
DRIVER_DIRS =
|
||||
# Which subdirs under $(TOP)/progs/ to enter:
|
||||
@@ -71,8 +71,9 @@ PROGRAM_DIRS = demos redbook samples glsl xdemos
|
||||
GALLIUM_AUXILIARY_DIRS = draw cso_cache pipebuffer tgsi sct translate rtasm util
|
||||
GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a)
|
||||
GALLIUM_DRIVER_DIRS = softpipe i915simple i965simple nv10 nv30 nv40 nv50 failover
|
||||
GALLIUM_WINSYS_COMMON_DIRS =
|
||||
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVER_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
|
||||
GALLIUM_WINSYS_DIRS = xlib
|
||||
GALLIUM_WINSYS_DIRS = xlib egl_xlib
|
||||
|
||||
|
||||
# Library/program dependencies
|
||||
|
||||
+4
-3
@@ -13,7 +13,7 @@ CXX = g++
|
||||
#MKDEP = gcc -M
|
||||
#MKDEP_OPTIONS = -MF depend
|
||||
|
||||
OPT_FLAGS = -O -g
|
||||
OPT_FLAGS = -O2 -g
|
||||
PIC_FLAGS = -fPIC
|
||||
|
||||
# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support.
|
||||
@@ -61,9 +61,10 @@ endif
|
||||
|
||||
|
||||
|
||||
DRIVER_DIRS = dri
|
||||
DRIVER_DIRS =
|
||||
WINDOW_SYSTEM = dri
|
||||
GALLIUM_WINSYS_DIRS = dri
|
||||
GALLIUM_WINSYS_DIRS = dri egl_xlib
|
||||
GALLIUM_WINSYS_COMMON_DIRS = intel_drm
|
||||
|
||||
# gamma are missing because they have not been converted to use the new
|
||||
# interface.
|
||||
|
||||
+17
-17
@@ -1,17 +1,17 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Mesa Source Code Documentation</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="qindex">
|
||||
<a class="qindex" href="../main/index.html">core</a> |
|
||||
<a class="qindex" href="../glapi/index.html">glapi</a> |
|
||||
<a class="qindex" href="../vbo/index.html">vbo</a> |
|
||||
<a class="qindex" href="../math/index.html">math</a> |
|
||||
<a class="qindex" href="../shader/index.html">shader</a> |
|
||||
<a class="qindex" href="../swrast/index.html">swrast</a> |
|
||||
<a class="qindex" href="../swrast_setup/index.html">swrast_setup</a> |
|
||||
<a class="qindex" href="../tnl/index.html">tnl</a> |
|
||||
<a class="qindex" href="../tnl_dd/index.html">tnl_dd</a>
|
||||
</div>
|
||||
<html>
|
||||
<head>
|
||||
<title>Mesa Source Code Documentation</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="qindex">
|
||||
<a class="qindex" href="../main/index.html">core</a> |
|
||||
<a class="qindex" href="../glapi/index.html">glapi</a> |
|
||||
<a class="qindex" href="../vbo/index.html">vbo</a> |
|
||||
<a class="qindex" href="../math/index.html">math</a> |
|
||||
<a class="qindex" href="../shader/index.html">shader</a> |
|
||||
<a class="qindex" href="../swrast/index.html">swrast</a> |
|
||||
<a class="qindex" href="../swrast_setup/index.html">swrast_setup</a> |
|
||||
<a class="qindex" href="../tnl/index.html">tnl</a> |
|
||||
<a class="qindex" href="../tnl_dd/index.html">tnl_dd</a>
|
||||
</div>
|
||||
|
||||
+11
-11
@@ -1,11 +1,11 @@
|
||||
<html>
|
||||
<head><title>Mesa Source Code Documentation</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="qindex">
|
||||
<a class="qindex" href="../core_subset/index.html">Mesa Core</a> |
|
||||
<a class="qindex" href="../math_subset/index.html">math</a> |
|
||||
<a class="qindex" href="../miniglx/index.html">MiniGLX</a> |
|
||||
<a class="qindex" href="../radeon_subset/index.html">radeon_subset</a>
|
||||
</div>
|
||||
<html>
|
||||
<head><title>Mesa Source Code Documentation</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="qindex">
|
||||
<a class="qindex" href="../core_subset/index.html">Mesa Core</a> |
|
||||
<a class="qindex" href="../math_subset/index.html">math</a> |
|
||||
<a class="qindex" href="../miniglx/index.html">MiniGLX</a> |
|
||||
<a class="qindex" href="../radeon_subset/index.html">radeon_subset</a>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,300 @@
|
||||
/* -*- mode: c; tab-width: 8; -*- */
|
||||
/* vi: set sw=4 ts=8: */
|
||||
/* Reference version of egl.h for EGL 1.4.
|
||||
* Last modified 2008/05/02
|
||||
*/
|
||||
|
||||
#ifndef __egl_h_
|
||||
#define __egl_h_
|
||||
|
||||
/* All platform-dependent types and macro boilerplate (such as EGLAPI
|
||||
* and EGLAPIENTRY) should go in eglplatform.h.
|
||||
*/
|
||||
#include <EGL/eglplatform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* EGL Types */
|
||||
typedef int32_t EGLint;
|
||||
typedef unsigned int EGLBoolean;
|
||||
typedef unsigned int EGLenum;
|
||||
typedef void *EGLConfig;
|
||||
typedef void *EGLContext;
|
||||
typedef void *EGLDisplay;
|
||||
typedef void *EGLSurface;
|
||||
typedef void *EGLClientBuffer;
|
||||
|
||||
/* EGL Versioning */
|
||||
#define EGL_VERSION_1_0 1
|
||||
#define EGL_VERSION_1_1 1
|
||||
#define EGL_VERSION_1_2 1
|
||||
#define EGL_VERSION_1_3 1
|
||||
#define EGL_VERSION_1_4 1
|
||||
|
||||
/* EGL Enumerants. Bitmasks and other exceptional cases aside, most
|
||||
* enums are assigned unique values starting at 0x3000.
|
||||
*/
|
||||
|
||||
/* EGL aliases */
|
||||
#define EGL_FALSE 0
|
||||
#define EGL_TRUE 1
|
||||
|
||||
/* Out-of-band handle values */
|
||||
#define EGL_DEFAULT_DISPLAY ((void *)0)
|
||||
#define EGL_NO_CONTEXT ((EGLContext)0)
|
||||
#define EGL_NO_DISPLAY ((EGLDisplay)0)
|
||||
#define EGL_NO_SURFACE ((EGLSurface)0)
|
||||
|
||||
/* Out-of-band attribute value */
|
||||
#define EGL_DONT_CARE ((EGLint)-1)
|
||||
|
||||
/* Errors / GetError return values */
|
||||
#define EGL_SUCCESS 0x3000
|
||||
#define EGL_NOT_INITIALIZED 0x3001
|
||||
#define EGL_BAD_ACCESS 0x3002
|
||||
#define EGL_BAD_ALLOC 0x3003
|
||||
#define EGL_BAD_ATTRIBUTE 0x3004
|
||||
#define EGL_BAD_CONFIG 0x3005
|
||||
#define EGL_BAD_CONTEXT 0x3006
|
||||
#define EGL_BAD_CURRENT_SURFACE 0x3007
|
||||
#define EGL_BAD_DISPLAY 0x3008
|
||||
#define EGL_BAD_MATCH 0x3009
|
||||
#define EGL_BAD_NATIVE_PIXMAP 0x300A
|
||||
#define EGL_BAD_NATIVE_WINDOW 0x300B
|
||||
#define EGL_BAD_PARAMETER 0x300C
|
||||
#define EGL_BAD_SURFACE 0x300D
|
||||
#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */
|
||||
|
||||
/* Reserved 0x300F-0x301F for additional errors */
|
||||
|
||||
/* Config attributes */
|
||||
#define EGL_BUFFER_SIZE 0x3020
|
||||
#define EGL_ALPHA_SIZE 0x3021
|
||||
#define EGL_BLUE_SIZE 0x3022
|
||||
#define EGL_GREEN_SIZE 0x3023
|
||||
#define EGL_RED_SIZE 0x3024
|
||||
#define EGL_DEPTH_SIZE 0x3025
|
||||
#define EGL_STENCIL_SIZE 0x3026
|
||||
#define EGL_CONFIG_CAVEAT 0x3027
|
||||
#define EGL_CONFIG_ID 0x3028
|
||||
#define EGL_LEVEL 0x3029
|
||||
#define EGL_MAX_PBUFFER_HEIGHT 0x302A
|
||||
#define EGL_MAX_PBUFFER_PIXELS 0x302B
|
||||
#define EGL_MAX_PBUFFER_WIDTH 0x302C
|
||||
#define EGL_NATIVE_RENDERABLE 0x302D
|
||||
#define EGL_NATIVE_VISUAL_ID 0x302E
|
||||
#define EGL_NATIVE_VISUAL_TYPE 0x302F
|
||||
#define EGL_PRESERVED_RESOURCES 0x3030
|
||||
#define EGL_SAMPLES 0x3031
|
||||
#define EGL_SAMPLE_BUFFERS 0x3032
|
||||
#define EGL_SURFACE_TYPE 0x3033
|
||||
#define EGL_TRANSPARENT_TYPE 0x3034
|
||||
#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
|
||||
#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
|
||||
#define EGL_TRANSPARENT_RED_VALUE 0x3037
|
||||
#define EGL_NONE 0x3038 /* Attrib list terminator */
|
||||
#define EGL_BIND_TO_TEXTURE_RGB 0x3039
|
||||
#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
|
||||
#define EGL_MIN_SWAP_INTERVAL 0x303B
|
||||
#define EGL_MAX_SWAP_INTERVAL 0x303C
|
||||
#define EGL_LUMINANCE_SIZE 0x303D
|
||||
#define EGL_ALPHA_MASK_SIZE 0x303E
|
||||
#define EGL_COLOR_BUFFER_TYPE 0x303F
|
||||
#define EGL_RENDERABLE_TYPE 0x3040
|
||||
#define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */
|
||||
#define EGL_CONFORMANT 0x3042
|
||||
|
||||
/* Reserved 0x3041-0x304F for additional config attributes */
|
||||
|
||||
/* Config attribute values */
|
||||
#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */
|
||||
#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */
|
||||
#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */
|
||||
#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */
|
||||
#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */
|
||||
|
||||
/* More config attribute values, for EGL_TEXTURE_FORMAT */
|
||||
#define EGL_NO_TEXTURE 0x305C
|
||||
#define EGL_TEXTURE_RGB 0x305D
|
||||
#define EGL_TEXTURE_RGBA 0x305E
|
||||
#define EGL_TEXTURE_2D 0x305F
|
||||
|
||||
/* Config attribute mask bits */
|
||||
#define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */
|
||||
#define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */
|
||||
#define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */
|
||||
#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */
|
||||
#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */
|
||||
#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */
|
||||
#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */
|
||||
|
||||
#define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */
|
||||
#define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */
|
||||
#define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */
|
||||
#define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */
|
||||
|
||||
/* QueryString targets */
|
||||
#define EGL_VENDOR 0x3053
|
||||
#define EGL_VERSION 0x3054
|
||||
#define EGL_EXTENSIONS 0x3055
|
||||
#define EGL_CLIENT_APIS 0x308D
|
||||
|
||||
/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */
|
||||
#define EGL_HEIGHT 0x3056
|
||||
#define EGL_WIDTH 0x3057
|
||||
#define EGL_LARGEST_PBUFFER 0x3058
|
||||
#define EGL_TEXTURE_FORMAT 0x3080
|
||||
#define EGL_TEXTURE_TARGET 0x3081
|
||||
#define EGL_MIPMAP_TEXTURE 0x3082
|
||||
#define EGL_MIPMAP_LEVEL 0x3083
|
||||
#define EGL_RENDER_BUFFER 0x3086
|
||||
#define EGL_VG_COLORSPACE 0x3087
|
||||
#define EGL_VG_ALPHA_FORMAT 0x3088
|
||||
#define EGL_HORIZONTAL_RESOLUTION 0x3090
|
||||
#define EGL_VERTICAL_RESOLUTION 0x3091
|
||||
#define EGL_PIXEL_ASPECT_RATIO 0x3092
|
||||
#define EGL_SWAP_BEHAVIOR 0x3093
|
||||
#define EGL_MULTISAMPLE_RESOLVE 0x3099
|
||||
|
||||
/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */
|
||||
#define EGL_BACK_BUFFER 0x3084
|
||||
#define EGL_SINGLE_BUFFER 0x3085
|
||||
|
||||
/* OpenVG color spaces */
|
||||
#define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */
|
||||
#define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */
|
||||
|
||||
/* OpenVG alpha formats */
|
||||
#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */
|
||||
#define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */
|
||||
|
||||
/* Constant scale factor by which fractional display resolutions &
|
||||
* aspect ratio are scaled when queried as integer values.
|
||||
*/
|
||||
#define EGL_DISPLAY_SCALING 10000
|
||||
|
||||
/* Unknown display resolution/aspect ratio */
|
||||
#define EGL_UNKNOWN ((EGLint)-1)
|
||||
|
||||
/* Back buffer swap behaviors */
|
||||
#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */
|
||||
#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */
|
||||
|
||||
/* CreatePbufferFromClientBuffer buffer types */
|
||||
#define EGL_OPENVG_IMAGE 0x3096
|
||||
|
||||
/* QueryContext targets */
|
||||
#define EGL_CONTEXT_CLIENT_TYPE 0x3097
|
||||
|
||||
/* CreateContext attributes */
|
||||
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
|
||||
|
||||
/* Multisample resolution behaviors */
|
||||
#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */
|
||||
#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */
|
||||
|
||||
/* BindAPI/QueryAPI targets */
|
||||
#define EGL_OPENGL_ES_API 0x30A0
|
||||
#define EGL_OPENVG_API 0x30A1
|
||||
#define EGL_OPENGL_API 0x30A2
|
||||
|
||||
/* GetCurrentSurface targets */
|
||||
#define EGL_DRAW 0x3059
|
||||
#define EGL_READ 0x305A
|
||||
|
||||
/* WaitNative engines */
|
||||
#define EGL_CORE_NATIVE_ENGINE 0x305B
|
||||
|
||||
/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */
|
||||
#define EGL_COLORSPACE EGL_VG_COLORSPACE
|
||||
#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT
|
||||
#define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB
|
||||
#define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR
|
||||
#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE
|
||||
#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE
|
||||
|
||||
/* EGL extensions must request enum blocks from the Khronos
|
||||
* API Registrar, who maintains the enumerant registry. Submit
|
||||
* a bug in Khronos Bugzilla against task "Registry".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* EGL Functions */
|
||||
|
||||
EGLAPI EGLint EGLAPIENTRY eglGetError(void);
|
||||
|
||||
EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy);
|
||||
|
||||
EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name);
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
|
||||
EGLint config_size, EGLint *num_config);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
|
||||
EGLConfig *configs, EGLint config_size,
|
||||
EGLint *num_config);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
|
||||
EGLint attribute, EGLint *value);
|
||||
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
|
||||
EGLNativeWindowType win,
|
||||
const EGLint *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
|
||||
const EGLint *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
|
||||
EGLNativePixmapType pixmap,
|
||||
const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
|
||||
EGLint attribute, EGLint *value);
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api);
|
||||
EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void);
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void);
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void);
|
||||
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(
|
||||
EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
|
||||
EGLConfig config, const EGLint *attrib_list);
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
|
||||
EGLint attribute, EGLint value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
|
||||
|
||||
|
||||
EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config,
|
||||
EGLContext share_context,
|
||||
const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,
|
||||
EGLSurface read, EGLContext ctx);
|
||||
|
||||
EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw);
|
||||
EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx,
|
||||
EGLint attribute, EGLint *value);
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
|
||||
EGLNativePixmapType target);
|
||||
|
||||
EGLAPI void (* EGLAPIENTRY eglGetProcAddress(const char *procname))(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __egl_h_ */
|
||||
@@ -0,0 +1,186 @@
|
||||
#ifndef __eglext_h_
|
||||
#define __eglext_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE 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
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
#include <EGL/eglplatform.h>
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
/* Header file version number */
|
||||
/* eglext.h last updated 2007/11/20 */
|
||||
/* Current version at http://www.khronos.org/registry/egl/ */
|
||||
#define EGL_EGLEXT_VERSION 1
|
||||
|
||||
#ifndef EGL_KHR_config_attribs
|
||||
#define EGL_KHR_config_attribs 1
|
||||
#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */
|
||||
#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */
|
||||
#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_lock_surface
|
||||
#define EGL_KHR_lock_surface 1
|
||||
#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
|
||||
#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
|
||||
#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */
|
||||
#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */
|
||||
#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */
|
||||
#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */
|
||||
#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */
|
||||
#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */
|
||||
#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */
|
||||
#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */
|
||||
#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */
|
||||
#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */
|
||||
#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */
|
||||
#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_image
|
||||
#define EGL_KHR_image 1
|
||||
#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */
|
||||
typedef void *EGLImageKHR;
|
||||
extern const EGLImageKHR EGL_NO_IMAGE_KHR;
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, EGLint *attr_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, EGLint *attr_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_vg_parent_image
|
||||
#define EGL_KHR_vg_parent_image 1
|
||||
#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_gl_texture_2D_image
|
||||
#define EGL_KHR_gl_texture_2D_image 1
|
||||
#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_gl_texture_cubemap_image
|
||||
#define EGL_KHR_gl_texture_cubemap_image 1
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_gl_texture_3D_image
|
||||
#define EGL_KHR_gl_texture_3D_image 1
|
||||
#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_gl_renderbuffer_image
|
||||
#define EGL_KHR_gl_renderbuffer_image 1
|
||||
#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */
|
||||
#endif
|
||||
|
||||
|
||||
/* EGL_MESA_screen extension >>> PRELIMINARY <<< */
|
||||
#ifndef EGL_MESA_screen_surface
|
||||
#define EGL_MESA_screen_surface 1
|
||||
|
||||
#define EGL_BAD_SCREEN_MESA 0x4000
|
||||
#define EGL_BAD_MODE_MESA 0x4001
|
||||
#define EGL_SCREEN_COUNT_MESA 0x4002
|
||||
#define EGL_SCREEN_POSITION_MESA 0x4003
|
||||
#define EGL_SCREEN_POSITION_GRANULARITY_MESA 0x4004
|
||||
#define EGL_MODE_ID_MESA 0x4005
|
||||
#define EGL_REFRESH_RATE_MESA 0x4006
|
||||
#define EGL_OPTIMAL_MESA 0x4007
|
||||
#define EGL_INTERLACED_MESA 0x4008
|
||||
#define EGL_SCREEN_BIT_MESA 0x08
|
||||
|
||||
typedef u_int32_t EGLScreenMESA;
|
||||
typedef u_int32_t EGLModeMESA;
|
||||
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
|
||||
EGLAPI const char * EGLAPIENTRY eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLCHOOSEMODEMESA) (EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETMODESMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGetModeATTRIBMESA) (EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSCRREENSMESA) (EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESCREENSURFACEMESA) (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSHOWSCREENSURFACEMESA) (EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSCREENPOSIITONMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENSURFACEMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENMODEMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
|
||||
typedef const char * (EGLAPIENTRYP PFNEGLQUERYMODESTRINGMESA) (EGLDisplay dpy, EGLModeMESA mode);
|
||||
|
||||
#endif /* EGL_MESA_screen_surface */
|
||||
|
||||
|
||||
#ifndef EGL_MESA_copy_context
|
||||
#define EGL_MESA_copy_context 1
|
||||
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOPYCONTEXTMESA) (EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask);
|
||||
|
||||
#endif /* EGL_MESA_copy_context */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,82 @@
|
||||
/* -*- mode: c; tab-width: 8; -*- */
|
||||
/* vi: set sw=4 ts=8: */
|
||||
/* Platform-specific types and definitions for egl.h */
|
||||
|
||||
#ifndef __eglplatform_h_
|
||||
#define __eglplatform_h_
|
||||
|
||||
/* Windows calling convention boilerplate */
|
||||
#if (defined(WIN32) || defined(_WIN32_WCE))
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/* Macros used in EGL function prototype declarations.
|
||||
*
|
||||
* EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
|
||||
* typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
|
||||
*
|
||||
* On Windows, EGLAPIENTRY can be defined like APIENTRY.
|
||||
* On most other platforms, it should be empty.
|
||||
*/
|
||||
|
||||
#ifndef EGLAPIENTRY
|
||||
#define EGLAPIENTRY
|
||||
#endif
|
||||
#ifndef EGLAPIENTRYP
|
||||
#define EGLAPIENTRYP EGLAPIENTRY *
|
||||
#endif
|
||||
|
||||
/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
|
||||
* are aliases of window-system-dependent types, such as X Display * or
|
||||
* Windows Device Context. They must be defined in platform-specific
|
||||
* code below. The EGL-prefixed versions of Native*Type are the same
|
||||
* types, renamed in EGL 1.3 so all types in the API start with "EGL".
|
||||
*/
|
||||
|
||||
/* Unix (tentative)
|
||||
#include <X headers>
|
||||
typedef Display *NativeDisplayType;
|
||||
- or maybe, if encoding "hostname:display.head"
|
||||
typedef const char *NativeWindowType;
|
||||
etc.
|
||||
*/
|
||||
|
||||
|
||||
#if (defined(WIN32) || defined(_WIN32_WCE))
|
||||
|
||||
/** BEGIN Added for Windows **/
|
||||
#ifndef EGLAPI
|
||||
#define EGLAPI __declspec(dllexport)
|
||||
#endif
|
||||
typedef long int32_t;
|
||||
typedef HDC NativeDisplayType;
|
||||
typedef HWND NativeWindowType;
|
||||
typedef HBITMAP NativePixmapType;
|
||||
/** END Added for Windows **/
|
||||
|
||||
#elif defined(__gnu_linux__)
|
||||
|
||||
/** BEGIN Added for X (Mesa) **/
|
||||
#ifndef EGLAPI
|
||||
#define EGLAPI extern
|
||||
#endif
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
typedef Display *NativeDisplayType;
|
||||
typedef Window NativeWindowType;
|
||||
typedef Pixmap NativePixmapType;
|
||||
/** END Added for X (Mesa) **/
|
||||
|
||||
#endif
|
||||
|
||||
/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
|
||||
typedef NativeDisplayType EGLNativeDisplayType;
|
||||
typedef NativePixmapType EGLNativePixmapType;
|
||||
typedef NativeWindowType EGLNativeWindowType;
|
||||
|
||||
#endif /* __eglplatform_h */
|
||||
+5
-264
@@ -1,265 +1,6 @@
|
||||
#ifndef __egl_h_
|
||||
#define __egl_h_
|
||||
|
||||
/*
|
||||
** Copyright 2002-2003 Promoters of the Khronos Group (3Dlabs, ARM Ltd.,
|
||||
** ATI Technologies, Inc., Discreet, Ericsson Mobile, Imagination
|
||||
** Technologies Group plc, Motorola, Inc., Nokia, Silicon Graphics, Inc.,
|
||||
** SK Telecom, and Sun Microsystems).
|
||||
**
|
||||
** This document is protected by copyright, and contains information
|
||||
** proprietary to The Khronos Group. Any copying, adaptation, distribution,
|
||||
** public performance, or public display of this document without the
|
||||
** express written consent of the copyright holders is strictly prohibited.
|
||||
** The receipt or possession of this document does not convey any rights to
|
||||
** reproduce, disclose, or distribute its contents, or to manufacture, use,
|
||||
** or sell anything that it may describe, in whole or in part.
|
||||
*/
|
||||
|
||||
/* For compatibility with early OpenGL ES 1.0 implementations that
|
||||
* included gl.h in egl.h (and apps that only included egl.h)
|
||||
* See: http://www.khronos.org/registry/implementers_guide.html
|
||||
*/
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/egltypes.h>
|
||||
|
||||
|
||||
/*
|
||||
** Versioning and extensions
|
||||
*/
|
||||
#define EGL_VERSION_1_0 1
|
||||
#define EGL_VERSION_1_1 1
|
||||
|
||||
/*
|
||||
** Boolean
|
||||
*/
|
||||
#define EGL_FALSE 0
|
||||
#define EGL_TRUE 1
|
||||
|
||||
/*
|
||||
** Errors
|
||||
*/
|
||||
#define EGL_SUCCESS 0x3000
|
||||
#define EGL_NOT_INITIALIZED 0x3001
|
||||
#define EGL_BAD_ACCESS 0x3002
|
||||
#define EGL_BAD_ALLOC 0x3003
|
||||
#define EGL_BAD_ATTRIBUTE 0x3004
|
||||
#define EGL_BAD_CONFIG 0x3005
|
||||
#define EGL_BAD_CONTEXT 0x3006
|
||||
#define EGL_BAD_CURRENT_SURFACE 0x3007
|
||||
#define EGL_BAD_DISPLAY 0x3008
|
||||
#define EGL_BAD_MATCH 0x3009
|
||||
#define EGL_BAD_NATIVE_PIXMAP 0x300A
|
||||
#define EGL_BAD_NATIVE_WINDOW 0x300B
|
||||
#define EGL_BAD_PARAMETER 0x300C
|
||||
#define EGL_BAD_SURFACE 0x300D
|
||||
#define EGL_CONTEXT_LOST 0x300E
|
||||
/* 0x300F - 0x301F reserved for additional errors. */
|
||||
|
||||
/*
|
||||
** Config attributes
|
||||
*/
|
||||
#define EGL_BUFFER_SIZE 0x3020
|
||||
#define EGL_ALPHA_SIZE 0x3021
|
||||
#define EGL_BLUE_SIZE 0x3022
|
||||
#define EGL_GREEN_SIZE 0x3023
|
||||
#define EGL_RED_SIZE 0x3024
|
||||
#define EGL_DEPTH_SIZE 0x3025
|
||||
#define EGL_STENCIL_SIZE 0x3026
|
||||
#define EGL_CONFIG_CAVEAT 0x3027
|
||||
#define EGL_CONFIG_ID 0x3028
|
||||
#define EGL_LEVEL 0x3029
|
||||
#define EGL_MAX_PBUFFER_HEIGHT 0x302A
|
||||
#define EGL_MAX_PBUFFER_PIXELS 0x302B
|
||||
#define EGL_MAX_PBUFFER_WIDTH 0x302C
|
||||
#define EGL_NATIVE_RENDERABLE 0x302D
|
||||
#define EGL_NATIVE_VISUAL_ID 0x302E
|
||||
#define EGL_NATIVE_VISUAL_TYPE 0x302F
|
||||
/*#define EGL_PRESERVED_RESOURCES 0x3030*/
|
||||
#define EGL_SAMPLES 0x3031
|
||||
#define EGL_SAMPLE_BUFFERS 0x3032
|
||||
#define EGL_SURFACE_TYPE 0x3033
|
||||
#define EGL_TRANSPARENT_TYPE 0x3034
|
||||
#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
|
||||
#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
|
||||
#define EGL_TRANSPARENT_RED_VALUE 0x3037
|
||||
#define EGL_NONE 0x3038 /* Also a config value */
|
||||
#define EGL_BIND_TO_TEXTURE_RGB 0x3039
|
||||
#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
|
||||
#define EGL_MIN_SWAP_INTERVAL 0x303B
|
||||
#define EGL_MAX_SWAP_INTERVAL 0x303C
|
||||
|
||||
/*
|
||||
** Config values
|
||||
*/
|
||||
#define EGL_DONT_CARE ((EGLint) -1)
|
||||
|
||||
#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */
|
||||
#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* " */
|
||||
#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */
|
||||
#define EGL_NO_TEXTURE 0x305C /* EGL_TEXTURE_FORMAT/TARGET value */
|
||||
#define EGL_TEXTURE_RGB 0x305D /* EGL_TEXTURE_FORMAT value */
|
||||
#define EGL_TEXTURE_RGBA 0x305E /* " */
|
||||
#define EGL_TEXTURE_2D 0x305F /* EGL_TEXTURE_TARGET value */
|
||||
|
||||
/*
|
||||
** Config attribute mask bits
|
||||
*/
|
||||
#define EGL_PBUFFER_BIT 0x01 /* EGL_SURFACE_TYPE mask bit */
|
||||
#define EGL_PIXMAP_BIT 0x02 /* " */
|
||||
#define EGL_WINDOW_BIT 0x04 /* " */
|
||||
|
||||
/*
|
||||
** String names
|
||||
*/
|
||||
#define EGL_VENDOR 0x3053 /* eglQueryString target */
|
||||
#define EGL_VERSION 0x3054 /* " */
|
||||
#define EGL_EXTENSIONS 0x3055 /* " */
|
||||
|
||||
/*
|
||||
** Surface attributes
|
||||
*/
|
||||
#define EGL_HEIGHT 0x3056
|
||||
#define EGL_WIDTH 0x3057
|
||||
#define EGL_LARGEST_PBUFFER 0x3058
|
||||
#define EGL_TEXTURE_FORMAT 0x3080 /* For pbuffers bound as textures */
|
||||
#define EGL_TEXTURE_TARGET 0x3081 /* " */
|
||||
#define EGL_MIPMAP_TEXTURE 0x3082 /* " */
|
||||
#define EGL_MIPMAP_LEVEL 0x3083 /* " */
|
||||
|
||||
/*
|
||||
** BindTexImage / ReleaseTexImage buffer target
|
||||
*/
|
||||
#define EGL_BACK_BUFFER 0x3084
|
||||
|
||||
/*
|
||||
** Current surfaces
|
||||
*/
|
||||
#define EGL_DRAW 0x3059
|
||||
#define EGL_READ 0x305A
|
||||
|
||||
/*
|
||||
** Engines
|
||||
*/
|
||||
#define EGL_CORE_NATIVE_ENGINE 0x305B
|
||||
|
||||
/* 0x305C-0x3FFFF reserved for future use */
|
||||
|
||||
/*
|
||||
** Functions
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GLAPI EGLint APIENTRY eglGetError (void);
|
||||
|
||||
GLAPI EGLDisplay APIENTRY eglGetDisplay (NativeDisplayType display);
|
||||
GLAPI EGLBoolean APIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
|
||||
GLAPI EGLBoolean APIENTRY eglTerminate (EGLDisplay dpy);
|
||||
GLAPI const char * APIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
|
||||
GLAPI void (APIENTRY * eglGetProcAddress (const char *procname))();
|
||||
|
||||
GLAPI EGLBoolean APIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
|
||||
GLAPI EGLBoolean APIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
|
||||
GLAPI EGLBoolean APIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
|
||||
|
||||
GLAPI EGLSurface APIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list);
|
||||
GLAPI EGLSurface APIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list);
|
||||
GLAPI EGLSurface APIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
|
||||
GLAPI EGLBoolean APIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
|
||||
GLAPI EGLBoolean APIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
|
||||
|
||||
/* EGL 1.1 render-to-texture APIs */
|
||||
GLAPI EGLBoolean APIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
|
||||
GLAPI EGLBoolean APIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
GLAPI EGLBoolean APIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
|
||||
/* EGL 1.1 swap control API */
|
||||
GLAPI EGLBoolean APIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
|
||||
|
||||
GLAPI EGLContext APIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list);
|
||||
GLAPI EGLBoolean APIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
|
||||
GLAPI EGLBoolean APIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
|
||||
GLAPI EGLContext APIENTRY eglGetCurrentContext (void);
|
||||
GLAPI EGLSurface APIENTRY eglGetCurrentSurface (EGLint readdraw);
|
||||
GLAPI EGLDisplay APIENTRY eglGetCurrentDisplay (void);
|
||||
GLAPI EGLBoolean APIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
|
||||
|
||||
GLAPI EGLBoolean APIENTRY eglWaitGL (void);
|
||||
GLAPI EGLBoolean APIENTRY eglWaitNative (EGLint engine);
|
||||
GLAPI EGLBoolean APIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface draw);
|
||||
GLAPI EGLBoolean APIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, NativePixmapType target);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ___egl_h_ */
|
||||
|
||||
|
||||
|
||||
/* usage
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Initialization
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
HDC hdc = GetDC(0); // the screen or window device context, for example
|
||||
|
||||
EGLDisplay display = eglGetDisplay(hdc);
|
||||
|
||||
EGLint major, minor;
|
||||
|
||||
if (!eglInitialize(display, &major, &minor)) {
|
||||
// could not initialize display
|
||||
}
|
||||
|
||||
EGLConfig configs[10];
|
||||
EGLint matchingConfigs;
|
||||
EGLint attribList[] = { 0 }; // extend this
|
||||
|
||||
if (!eglChooseConfig(display, attribList, &configs, 10, &matchingConfigs)) {
|
||||
// could not choose config
|
||||
}
|
||||
|
||||
if (matchingConfigs < 1) {
|
||||
// did not find a suitable configuration
|
||||
}
|
||||
|
||||
EGLConfig config = configs[0]; // pick any
|
||||
|
||||
EGLSurface surface = eglCreatePbufferSurface(display, config, attribList);
|
||||
|
||||
// test for error
|
||||
|
||||
EGLContext context = eglCreateContext(display, config, 0, attribList);
|
||||
|
||||
// test for error
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Rendering Loop
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
eglMakeCurrent(display, surface, surface, context);
|
||||
|
||||
// actual GL rendering goes here
|
||||
|
||||
eglWait();
|
||||
eglSwapBuffers(display, surface);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Cleanup
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
|
||||
if (!eglDestoyContext(display, context)) {
|
||||
// error deallocating context
|
||||
}
|
||||
|
||||
if (!eglDestroySurface(display, surface)) {
|
||||
// error deallocating surface
|
||||
}
|
||||
|
||||
if (!eglTerminate(display)) {
|
||||
// error while cleaning up display
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
#ifndef __egl_types_h_
|
||||
#define __egl_types_h_
|
||||
|
||||
/*
|
||||
** egltypes.h is platform dependent. It defines:
|
||||
**
|
||||
** - EGL types and resources
|
||||
** - Native types
|
||||
** - EGL and native handle values
|
||||
**
|
||||
** EGL types and resources are to be typedef'ed with appropriate platform
|
||||
** dependent resource handle types. EGLint must be an integer of at least
|
||||
** 32-bit.
|
||||
**
|
||||
** NativeDisplayType, NativeWindowType and NativePixmapType are to be
|
||||
** replaced with corresponding types of the native window system in egl.h.
|
||||
**
|
||||
** EGL and native handle values must match their types.
|
||||
*/
|
||||
|
||||
#if (defined(WIN32) || defined(_WIN32_WCE))
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#endif
|
||||
|
||||
// Windows Header Files:
|
||||
#include <windows.h>
|
||||
|
||||
typedef HDC NativeDisplayType;
|
||||
typedef HWND NativeWindowType;
|
||||
typedef HBITMAP NativePixmapType;
|
||||
|
||||
#define EGL_DEFAULT_DISPLAY GetDC(0)
|
||||
|
||||
#elif defined(__SYMBIAN32__)
|
||||
|
||||
#include <e32def.h>
|
||||
|
||||
class RWindow;
|
||||
class CWindowGc;
|
||||
class CFbsBitmap;
|
||||
|
||||
typedef CWindowGc * NativeDisplayType;
|
||||
typedef RWindow * NativeWindowType;
|
||||
typedef CFbsBitmap * NativePixmapType;
|
||||
|
||||
#define EGL_DEFAULT_DISPLAY ((NativeDisplayType) 0)
|
||||
|
||||
#elif defined(__gnu_linux__)
|
||||
|
||||
typedef void * NativeDisplayType;
|
||||
typedef void * NativeWindowType;
|
||||
typedef void * NativePixmapType;
|
||||
|
||||
#define EGL_DEFAULT_DISPLAY ((NativeDisplayType) 0)
|
||||
|
||||
#else
|
||||
|
||||
# error "Unsupported Operating System"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace EGL {
|
||||
class Context;
|
||||
class Config;
|
||||
class Surface;
|
||||
}
|
||||
|
||||
typedef const EGL::Config * EGLConfig;
|
||||
typedef EGL::Surface * EGLSurface;
|
||||
typedef EGL::Context * EGLContext;
|
||||
|
||||
#else
|
||||
|
||||
typedef void * EGLConfig;
|
||||
typedef void * EGLSurface;
|
||||
typedef void * EGLContext;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** Types and resources
|
||||
*/
|
||||
typedef int EGLBoolean;
|
||||
typedef int EGLint;
|
||||
typedef void * EGLDisplay;
|
||||
|
||||
/*
|
||||
** EGL and native handle values
|
||||
*/
|
||||
#define EGL_NO_CONTEXT ((EGLContext)0)
|
||||
#define EGL_NO_DISPLAY ((EGLDisplay)0)
|
||||
#define EGL_NO_SURFACE ((EGLSurface)0)
|
||||
|
||||
|
||||
#endif //ndef __egl_types_h_
|
||||
+234
-297
@@ -1,6 +1,10 @@
|
||||
#ifndef __gl_h_
|
||||
#define __gl_h_
|
||||
|
||||
/* $Id: gl.h 4533 2007-11-26 11:19:35Z markc $ */
|
||||
|
||||
#include <GLES/glplatform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -39,79 +43,33 @@ extern "C" {
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
*/
|
||||
|
||||
#if defined(__SYMBIAN32__)
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef signed char GLbyte;
|
||||
typedef short GLshort;
|
||||
typedef int GLint;
|
||||
typedef int GLsizei;
|
||||
typedef unsigned char GLubyte;
|
||||
typedef unsigned short GLushort;
|
||||
typedef unsigned int GLuint;
|
||||
typedef float GLfloat;
|
||||
typedef float GLclampf;
|
||||
typedef void GLvoid;
|
||||
typedef int GLfixed;
|
||||
typedef int GLclampx;
|
||||
|
||||
# include <e32def.h>
|
||||
typedef int GLintptr;
|
||||
typedef int GLsizeiptr;
|
||||
|
||||
#elif (defined(WIN32) || defined(_WIN32_WCE)) /*&& !defined(APIENTRY) && !defined(__CYGWIN__)*/
|
||||
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
# endif
|
||||
|
||||
# include <windows.h>
|
||||
|
||||
#elif defined(__gnu_linux__)
|
||||
|
||||
# define GLAPI
|
||||
|
||||
# ifdef APIENTRY
|
||||
# undef APIENTRY
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
# error "Unsupported Operating System"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
|
||||
#ifndef GLAPI
|
||||
#ifdef OGLES_EXPORTS
|
||||
#define GLAPI __declspec(dllexport)
|
||||
#else
|
||||
#define GLAPI __declspec(dllimport)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef signed char GLbyte;
|
||||
typedef short GLshort;
|
||||
typedef int GLint;
|
||||
typedef int GLsizei;
|
||||
typedef unsigned char GLubyte;
|
||||
typedef unsigned short GLushort;
|
||||
typedef unsigned int GLuint;
|
||||
typedef float GLfloat;
|
||||
typedef float GLclampf;
|
||||
typedef void GLvoid;
|
||||
typedef int GLintptr;
|
||||
typedef int GLsizeiptr;
|
||||
typedef int GLfixed;
|
||||
typedef int GLclampx;
|
||||
/* Internal convenience typedefs */
|
||||
typedef void (*_GLfuncptr)();
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
/* OpenGL ES core versions */
|
||||
#define GL_OES_VERSION_1_0 1
|
||||
#define GL_OES_VERSION_1_1 1
|
||||
|
||||
/* Extensions */
|
||||
#define GL_OES_compressed_paletted_texture 1
|
||||
/*#define GL_OES_draw_texture 1*/
|
||||
#define GL_OES_matrix_get 1
|
||||
/*#define GL_OES_matrix_palette 1*/
|
||||
#define GL_OES_point_size_array 1
|
||||
#define GL_OES_point_sprite 1
|
||||
#define GL_OES_read_format 1
|
||||
#define GL_VERSION_ES_CM_1_0 1
|
||||
#define GL_VERSION_ES_CL_1_0 1
|
||||
#define GL_VERSION_ES_CM_1_1 1
|
||||
#define GL_VERSION_ES_CL_1_1 1
|
||||
|
||||
/* ClearBufferMask */
|
||||
#define GL_DEPTH_BUFFER_BIT 0x00000100
|
||||
@@ -311,8 +269,6 @@ typedef void (*_GLfuncptr)();
|
||||
#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
|
||||
#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
|
||||
#define GL_MAX_VIEWPORT_DIMS 0x0D3A
|
||||
#define GL_MAX_ELEMENTS_VERTICES 0x80E8
|
||||
#define GL_MAX_ELEMENTS_INDICES 0x80E9
|
||||
#define GL_MAX_TEXTURE_UNITS 0x84E2
|
||||
#define GL_SUBPIXEL_BITS 0x0D50
|
||||
#define GL_RED_BITS 0x0D52
|
||||
@@ -351,15 +307,8 @@ typedef void (*_GLfuncptr)();
|
||||
/* GL_TEXTURE_WRAP_S */
|
||||
/* GL_TEXTURE_WRAP_T */
|
||||
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
|
||||
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
|
||||
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
|
||||
|
||||
/* OES_matrix_get */
|
||||
#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS 0x898D
|
||||
#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS 0x898E
|
||||
#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS 0x898F
|
||||
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
|
||||
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
|
||||
|
||||
/* HintMode */
|
||||
#define GL_DONT_CARE 0x1100
|
||||
@@ -370,7 +319,6 @@ typedef void (*_GLfuncptr)();
|
||||
#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
|
||||
#define GL_POINT_SMOOTH_HINT 0x0C51
|
||||
#define GL_LINE_SMOOTH_HINT 0x0C52
|
||||
#define GL_POLYGON_SMOOTH_HINT 0x0C53
|
||||
#define GL_FOG_HINT 0x0C54
|
||||
#define GL_GENERATE_MIPMAP_HINT 0x8192
|
||||
|
||||
@@ -565,18 +513,6 @@ typedef void (*_GLfuncptr)();
|
||||
#define GL_REPEAT 0x2901
|
||||
#define GL_CLAMP_TO_EDGE 0x812F
|
||||
|
||||
/* PixelInternalFormat */
|
||||
#define GL_PALETTE4_RGB8_OES 0x8B90
|
||||
#define GL_PALETTE4_RGBA8_OES 0x8B91
|
||||
#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
|
||||
#define GL_PALETTE4_RGBA4_OES 0x8B93
|
||||
#define GL_PALETTE4_RGB5_A1_OES 0x8B94
|
||||
#define GL_PALETTE8_RGB8_OES 0x8B95
|
||||
#define GL_PALETTE8_RGBA8_OES 0x8B96
|
||||
#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
|
||||
#define GL_PALETTE8_RGBA4_OES 0x8B98
|
||||
#define GL_PALETTE8_RGB5_A1_OES 0x8B99
|
||||
|
||||
/* VertexPointerType */
|
||||
/* GL_SHORT */
|
||||
/* GL_FLOAT */
|
||||
@@ -597,22 +533,18 @@ typedef void (*_GLfuncptr)();
|
||||
#define GL_ARRAY_BUFFER 0x8892
|
||||
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
|
||||
|
||||
#define GL_ARRAY_BUFFER_BINDING 0x8894
|
||||
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
|
||||
#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
|
||||
#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
|
||||
#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
|
||||
#define GL_ARRAY_BUFFER_BINDING 0x8894
|
||||
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
|
||||
#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
|
||||
#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
|
||||
#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
|
||||
#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
|
||||
|
||||
#define GL_STATIC_DRAW 0x88E4
|
||||
#define GL_DYNAMIC_DRAW 0x88E8
|
||||
|
||||
#define GL_WRITE_ONLY 0x88B9
|
||||
|
||||
#define GL_BUFFER_SIZE 0x8764
|
||||
#define GL_BUFFER_USAGE 0x8765
|
||||
#define GL_BUFFER_ACCESS 0x88BB
|
||||
|
||||
|
||||
/* Texture combine + dot3 */
|
||||
#define GL_SUBTRACT 0x84E7
|
||||
@@ -644,218 +576,223 @@ typedef void (*_GLfuncptr)();
|
||||
#define GL_DOT3_RGB 0x86AE
|
||||
#define GL_DOT3_RGBA 0x86AF
|
||||
|
||||
/*****************************************************************************************/
|
||||
/* OES extension functions */
|
||||
/*****************************************************************************************/
|
||||
/* OES_point_sprite */
|
||||
#define GL_POINT_SPRITE_OES 0x8861
|
||||
#define GL_COORD_REPLACE_OES 0x8862
|
||||
/*------------------------------------------------------------------------*
|
||||
* required OES extension tokens
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* OES_read_format */
|
||||
#ifndef GL_OES_read_format
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
|
||||
#endif
|
||||
|
||||
/* GL_OES_compressed_paletted_texture */
|
||||
#ifndef GL_OES_compressed_paletted_texture
|
||||
#define GL_PALETTE4_RGB8_OES 0x8B90
|
||||
#define GL_PALETTE4_RGBA8_OES 0x8B91
|
||||
#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
|
||||
#define GL_PALETTE4_RGBA4_OES 0x8B93
|
||||
#define GL_PALETTE4_RGB5_A1_OES 0x8B94
|
||||
#define GL_PALETTE8_RGB8_OES 0x8B95
|
||||
#define GL_PALETTE8_RGBA8_OES 0x8B96
|
||||
#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
|
||||
#define GL_PALETTE8_RGBA4_OES 0x8B98
|
||||
#define GL_PALETTE8_RGB5_A1_OES 0x8B99
|
||||
#endif
|
||||
|
||||
/* OES_point_size_array */
|
||||
#define GL_POINT_SIZE_ARRAY_OES 0x8B9C
|
||||
#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A
|
||||
#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B
|
||||
#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C
|
||||
#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F
|
||||
#ifndef GL_OES_point_size_array
|
||||
#define GL_POINT_SIZE_ARRAY_OES 0x8B9C
|
||||
#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A
|
||||
#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B
|
||||
#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C
|
||||
#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F
|
||||
#endif
|
||||
|
||||
/* OES_matrix_palette */
|
||||
#define GL_MAX_VERTEX_UNITS_OES 0x86A4
|
||||
#define GL_MAX_PALETTE_MATRICES_OES 0x8842
|
||||
#define GL_MATRIX_PALETTE_OES 0x8840
|
||||
#define GL_MATRIX_INDEX_ARRAY_OES 0x8844
|
||||
#define GL_WEIGHT_ARRAY_OES 0x86AD
|
||||
|
||||
#define GL_MATRIX_INDEX_ARRAY_SIZE_OES 0x8846
|
||||
#define GL_MATRIX_INDEX_ARRAY_TYPE_OES 0x8847
|
||||
#define GL_MATRIX_INDEX_ARRAY_STRIDE_OES 0x8848
|
||||
#define GL_MATRIX_INDEX_ARRAY_POINTER_OES 0x8849
|
||||
#define GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES 0x8B9E
|
||||
|
||||
#define GL_WEIGHT_ARRAY_SIZE_OES 0x86AB
|
||||
#define GL_WEIGHT_ARRAY_TYPE_OES 0x86A9
|
||||
#define GL_WEIGHT_ARRAY_STRIDE_OES 0x86AA
|
||||
#define GL_WEIGHT_ARRAY_POINTER_OES 0x86AC
|
||||
#define GL_WEIGHT_ARRAY_BUFFER_BINDING_OES 0x889E
|
||||
|
||||
/* OES_draw_texture */
|
||||
#define GL_TEXTURE_CROP_RECT_OES 0x8B9D
|
||||
/* GL_OES_point_sprite */
|
||||
#ifndef GL_OES_point_sprite
|
||||
#define GL_POINT_SPRITE_OES 0x8861
|
||||
#define GL_COORD_REPLACE_OES 0x8862
|
||||
#endif
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
GLAPI void APIENTRY glActiveTexture (GLenum texture);
|
||||
GLAPI void APIENTRY glAlphaFunc (GLenum func, GLclampf ref);
|
||||
GLAPI void APIENTRY glAlphaFuncx (GLenum func, GLclampx ref);
|
||||
GLAPI void APIENTRY glBindBuffer(GLenum target, GLuint buffer);
|
||||
GLAPI void APIENTRY glBindTexture (GLenum target, GLuint texture);
|
||||
GLAPI void APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
|
||||
GLAPI void APIENTRY glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
|
||||
GLAPI void APIENTRY glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
|
||||
GLAPI void APIENTRY glClear (GLbitfield mask);
|
||||
GLAPI void APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
GLAPI void APIENTRY glClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
|
||||
GLAPI void APIENTRY glClearDepthf (GLclampf depth);
|
||||
GLAPI void APIENTRY glClearDepthx (GLclampx depth);
|
||||
GLAPI void APIENTRY glClearStencil (GLint s);
|
||||
GLAPI void APIENTRY glClientActiveTexture (GLenum texture);
|
||||
GLAPI void APIENTRY glClipPlanex(GLenum plane, const GLfixed *equation);
|
||||
GLAPI void APIENTRY glClipPlanef(GLenum plane, const GLfloat *equation);
|
||||
GLAPI void APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
GLAPI void APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
|
||||
GLAPI void APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
GLAPI void APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
GLAPI void APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
GLAPI void APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GLAPI void APIENTRY glCullFace (GLenum mode);
|
||||
GLAPI void APIENTRY glDeleteBuffers(GLsizei n, const GLuint *buffers);
|
||||
GLAPI void APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
|
||||
GLAPI void APIENTRY glDepthFunc (GLenum func);
|
||||
GLAPI void APIENTRY glDepthMask (GLboolean flag);
|
||||
GLAPI void APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
|
||||
GLAPI void APIENTRY glDepthRangex (GLclampx zNear, GLclampx zFar);
|
||||
GLAPI void APIENTRY glDisable (GLenum cap);
|
||||
GLAPI void APIENTRY glDisableClientState (GLenum array);
|
||||
GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
|
||||
GLAPI void APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
|
||||
GLAPI void APIENTRY glEnable (GLenum cap);
|
||||
GLAPI void APIENTRY glEnableClientState (GLenum array);
|
||||
GLAPI void APIENTRY glFinish (void);
|
||||
GLAPI void APIENTRY glFlush (void);
|
||||
GLAPI void APIENTRY glFogf (GLenum pname, GLfloat param);
|
||||
GLAPI void APIENTRY glFogfv (GLenum pname, const GLfloat *params);
|
||||
GLAPI void APIENTRY glFogx (GLenum pname, GLfixed param);
|
||||
GLAPI void APIENTRY glFogxv (GLenum pname, const GLfixed *params);
|
||||
GLAPI void APIENTRY glFrontFace (GLenum mode);
|
||||
GLAPI void APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
|
||||
GLAPI void APIENTRY glFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
|
||||
GLAPI void APIENTRY glGetBooleanv(GLenum pname, GLboolean *params);
|
||||
GLAPI void APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
|
||||
GLAPI void APIENTRY glGetClipPlanef(GLenum pname, GLfloat eqn[4]);
|
||||
GLAPI void APIENTRY glGetClipPlanex(GLenum pname, GLfixed eqn[4]);
|
||||
GLAPI void APIENTRY glGenBuffers(GLsizei n, GLuint *buffers);
|
||||
GLAPI void APIENTRY glGenTextures (GLsizei n, GLuint *textures);
|
||||
GLAPI GLenum APIENTRY glGetError (void);
|
||||
GLAPI void APIENTRY glGetFixedv(GLenum pname, GLfixed *params);
|
||||
GLAPI void APIENTRY glGetFloatv(GLenum pname, GLfloat *params);
|
||||
GLAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *params);
|
||||
GLAPI void APIENTRY glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
|
||||
GLAPI void APIENTRY glGetLightxv(GLenum light, GLenum pname, GLfixed *params);
|
||||
GLAPI void APIENTRY glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
|
||||
GLAPI void APIENTRY glGetMaterialxv(GLenum face, GLenum pname, GLfixed *params);
|
||||
GLAPI void APIENTRY glGetPointerv(GLenum pname, void **params);
|
||||
GLAPI const GLubyte * APIENTRY glGetString (GLenum name);
|
||||
GLAPI void APIENTRY glGetTexEnviv(GLenum env, GLenum pname, GLint *params);
|
||||
GLAPI void APIENTRY glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params);
|
||||
GLAPI void APIENTRY glGetTexEnvxv(GLenum env, GLenum pname, GLfixed *params);
|
||||
GLAPI void APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
|
||||
GLAPI void APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
|
||||
GLAPI void APIENTRY glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *params);
|
||||
GLAPI void APIENTRY glHint (GLenum target, GLenum mode);
|
||||
GLAPI GLboolean APIENTRY glIsBuffer(GLuint buffer);
|
||||
GLAPI GLboolean APIENTRY glIsEnabled(GLenum cap);
|
||||
GLAPI GLboolean APIENTRY glIsTexture(GLuint texture);
|
||||
GLAPI void APIENTRY glLightModelf (GLenum pname, GLfloat param);
|
||||
GLAPI void APIENTRY glLightModelfv (GLenum pname, const GLfloat *params);
|
||||
GLAPI void APIENTRY glLightModelx (GLenum pname, GLfixed param);
|
||||
GLAPI void APIENTRY glLightModelxv (GLenum pname, const GLfixed *params);
|
||||
GLAPI void APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param);
|
||||
GLAPI void APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params);
|
||||
GLAPI void APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param);
|
||||
GLAPI void APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params);
|
||||
GLAPI void APIENTRY glLineWidth (GLfloat width);
|
||||
GLAPI void APIENTRY glLineWidthx (GLfixed width);
|
||||
GLAPI void APIENTRY glLoadIdentity (void);
|
||||
GLAPI void APIENTRY glLoadMatrixf (const GLfloat *m);
|
||||
GLAPI void APIENTRY glLoadMatrixx (const GLfixed *m);
|
||||
GLAPI void APIENTRY glLogicOp (GLenum opcode);
|
||||
GLAPI void APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param);
|
||||
GLAPI void APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);
|
||||
GLAPI void APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param);
|
||||
GLAPI void APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *params);
|
||||
GLAPI void APIENTRY glMatrixMode (GLenum mode);
|
||||
GLAPI void APIENTRY glMultMatrixf (const GLfloat *m);
|
||||
GLAPI void APIENTRY glMultMatrixx (const GLfixed *m);
|
||||
GLAPI void APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
|
||||
GLAPI void APIENTRY glMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
|
||||
GLAPI void APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);
|
||||
GLAPI void APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz);
|
||||
GLAPI void APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
GLAPI void APIENTRY glOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
|
||||
GLAPI void APIENTRY glOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
|
||||
GLAPI void APIENTRY glPixelStorei (GLenum pname, GLint param);
|
||||
GLAPI void APIENTRY glPointParameterf(GLenum pname, GLfloat param);
|
||||
GLAPI void APIENTRY glPointParameterfv(GLenum pname, const GLfloat *params);
|
||||
GLAPI void APIENTRY glPointParameterx(GLenum pname, GLfixed param);
|
||||
GLAPI void APIENTRY glPointParameterxv(GLenum pname, const GLfixed *params);
|
||||
GLAPI void APIENTRY glPointSize (GLfloat size);
|
||||
GLAPI void APIENTRY glPointSizex (GLfixed size);
|
||||
GLAPI void APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
|
||||
GLAPI void APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units);
|
||||
GLAPI void APIENTRY glPopMatrix (void);
|
||||
GLAPI void APIENTRY glPushMatrix (void);
|
||||
GLAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
|
||||
GLAPI void APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
|
||||
GLAPI void APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
|
||||
GLAPI void APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
|
||||
GLAPI void APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert);
|
||||
GLAPI void APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z);
|
||||
GLAPI void APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z);
|
||||
GLAPI void APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GLAPI void APIENTRY glShadeModel (GLenum mode);
|
||||
GLAPI void APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
|
||||
GLAPI void APIENTRY glStencilMask (GLuint mask);
|
||||
GLAPI void APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
|
||||
GLAPI void APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
GLAPI void APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param);
|
||||
GLAPI void APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);
|
||||
GLAPI void APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param);
|
||||
GLAPI void APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params);
|
||||
GLAPI void APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
GLAPI void APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
|
||||
GLAPI void APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
|
||||
GLAPI void APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param);
|
||||
GLAPI void APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
GLAPI void APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z);
|
||||
GLAPI void APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z);
|
||||
GLAPI void APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
GLAPI void APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
/* Available only in Common profile */
|
||||
GL_API void GL_APIENTRY glAlphaFunc (GLenum func, GLclampf ref);
|
||||
GL_API void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
GL_API void GL_APIENTRY glClearDepthf (GLclampf depth);
|
||||
GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation);
|
||||
GL_API void GL_APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
GL_API void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
|
||||
GL_API void GL_APIENTRY glFogf (GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glFogfv (GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
|
||||
GL_API void GL_APIENTRY glGetClipPlanef (GLenum pname, GLfloat eqn[4]);
|
||||
GL_API void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *params);
|
||||
GL_API void GL_APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params);
|
||||
GL_API void GL_APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);
|
||||
GL_API void GL_APIENTRY glGetTexEnvfv (GLenum env, GLenum pname, GLfloat *params);
|
||||
GL_API void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
|
||||
GL_API void GL_APIENTRY glLightModelf (GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glLightModelfv (GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glLineWidth (GLfloat width);
|
||||
GL_API void GL_APIENTRY glLoadMatrixf (const GLfloat *m);
|
||||
GL_API void GL_APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glMultMatrixf (const GLfloat *m);
|
||||
GL_API void GL_APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
|
||||
GL_API void GL_APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);
|
||||
GL_API void GL_APIENTRY glOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
|
||||
GL_API void GL_APIENTRY glPointParameterf (GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glPointSize (GLfloat size);
|
||||
GL_API void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
|
||||
GL_API void GL_APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
|
||||
GL_API void GL_APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z);
|
||||
GL_API void GL_APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z);
|
||||
|
||||
/*****************************************************************************************/
|
||||
/* OES extension functions */
|
||||
/*****************************************************************************************/
|
||||
/* Available in both Common and Common-Lite profiles */
|
||||
GL_API void GL_APIENTRY glActiveTexture (GLenum texture);
|
||||
GL_API void GL_APIENTRY glAlphaFuncx (GLenum func, GLclampx ref);
|
||||
GL_API void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
|
||||
GL_API void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
|
||||
GL_API void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
|
||||
GL_API void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
|
||||
GL_API void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
|
||||
GL_API void GL_APIENTRY glClear (GLbitfield mask);
|
||||
GL_API void GL_APIENTRY glClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
|
||||
GL_API void GL_APIENTRY glClearDepthx (GLclampx depth);
|
||||
GL_API void GL_APIENTRY glClearStencil (GLint s);
|
||||
GL_API void GL_APIENTRY glClientActiveTexture (GLenum texture);
|
||||
GL_API void GL_APIENTRY glClipPlanex (GLenum plane, const GLfixed *equation);
|
||||
GL_API void GL_APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
|
||||
GL_API void GL_APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
|
||||
GL_API void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
GL_API void GL_APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
GL_API void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
GL_API void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
GL_API void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
GL_API void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_API void GL_APIENTRY glCullFace (GLenum mode);
|
||||
GL_API void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
|
||||
GL_API void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
|
||||
GL_API void GL_APIENTRY glDepthFunc (GLenum func);
|
||||
GL_API void GL_APIENTRY glDepthMask (GLboolean flag);
|
||||
GL_API void GL_APIENTRY glDepthRangex (GLclampx zNear, GLclampx zFar);
|
||||
GL_API void GL_APIENTRY glDisable (GLenum cap);
|
||||
GL_API void GL_APIENTRY glDisableClientState (GLenum array);
|
||||
GL_API void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
|
||||
GL_API void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
|
||||
GL_API void GL_APIENTRY glEnable (GLenum cap);
|
||||
GL_API void GL_APIENTRY glEnableClientState (GLenum array);
|
||||
GL_API void GL_APIENTRY glFinish (void);
|
||||
GL_API void GL_APIENTRY glFlush (void);
|
||||
GL_API void GL_APIENTRY glFogx (GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glFogxv (GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glFrontFace (GLenum mode);
|
||||
GL_API void GL_APIENTRY glFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
|
||||
GL_API void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *params);
|
||||
GL_API void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
|
||||
GL_API void GL_APIENTRY glGetClipPlanex (GLenum pname, GLfixed eqn[4]);
|
||||
GL_API void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
|
||||
GL_API void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
|
||||
GL_API GLenum GL_APIENTRY glGetError (void);
|
||||
GL_API void GL_APIENTRY glGetFixedv (GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *params);
|
||||
GL_API void GL_APIENTRY glGetLightxv (GLenum light, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetMaterialxv (GLenum face, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetPointerv (GLenum pname, void **params);
|
||||
GL_API const GLubyte * GL_APIENTRY glGetString (GLenum name);
|
||||
GL_API void GL_APIENTRY glGetTexEnviv (GLenum env, GLenum pname, GLint *params);
|
||||
GL_API void GL_APIENTRY glGetTexEnvxv (GLenum env, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
|
||||
GL_API void GL_APIENTRY glGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glHint (GLenum target, GLenum mode);
|
||||
GL_API GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
|
||||
GL_API GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
|
||||
GL_API GLboolean GL_APIENTRY glIsTexture (GLuint texture);
|
||||
GL_API void GL_APIENTRY glLightModelx (GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glLightModelxv (GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glLineWidthx (GLfixed width);
|
||||
GL_API void GL_APIENTRY glLoadIdentity (void);
|
||||
GL_API void GL_APIENTRY glLoadMatrixx (const GLfixed *m);
|
||||
GL_API void GL_APIENTRY glLogicOp (GLenum opcode);
|
||||
GL_API void GL_APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glMatrixMode (GLenum mode);
|
||||
GL_API void GL_APIENTRY glMultMatrixx (const GLfixed *m);
|
||||
GL_API void GL_APIENTRY glMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
|
||||
GL_API void GL_APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz);
|
||||
GL_API void GL_APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
GL_API void GL_APIENTRY glOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
|
||||
GL_API void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
|
||||
GL_API void GL_APIENTRY glPointParameterx (GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glPointParameterxv (GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glPointSizex (GLfixed size);
|
||||
GL_API void GL_APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units);
|
||||
GL_API void GL_APIENTRY glPopMatrix (void);
|
||||
GL_API void GL_APIENTRY glPushMatrix (void);
|
||||
GL_API void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
|
||||
GL_API void GL_APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
|
||||
GL_API void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
|
||||
GL_API void GL_APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert);
|
||||
GL_API void GL_APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z);
|
||||
GL_API void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_API void GL_APIENTRY glShadeModel (GLenum mode);
|
||||
GL_API void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
|
||||
GL_API void GL_APIENTRY glStencilMask (GLuint mask);
|
||||
GL_API void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
|
||||
GL_API void GL_APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
GL_API void GL_APIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param);
|
||||
GL_API void GL_APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params);
|
||||
GL_API void GL_APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
GL_API void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
|
||||
GL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
|
||||
GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z);
|
||||
GL_API void GL_APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
GL_API void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
#ifdef GL_OES_matrix_palette
|
||||
/*------------------------------------------------------------------------*
|
||||
* Required OES extension functions
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
GLAPI void APIENTRY glCurrentPaletteMatrixOES (GLuint matrixpaletteindex);
|
||||
GLAPI void APIENTRY glLoadPaletteFromModelViewMatrixOES (void);
|
||||
GLAPI void APIENTRY glMatrixIndexPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
GLAPI void APIENTRY glWeightPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
/* GL_OES_read_format */
|
||||
#ifndef GL_OES_read_format
|
||||
#define GL_OES_read_format 1
|
||||
#endif
|
||||
|
||||
#endif /* OES_matrix_palette */
|
||||
/* GL_OES_compressed_paletted_texture */
|
||||
#ifndef GL_OES_compressed_paletted_texture
|
||||
#define GL_OES_compressed_paletted_texture 1
|
||||
#endif
|
||||
|
||||
#ifdef GL_OES_point_size_array
|
||||
/* GL_OES_point_size_array */
|
||||
#ifndef GL_OES_point_size_array
|
||||
#define GL_OES_point_size_array 1
|
||||
GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
#endif
|
||||
|
||||
GLAPI void APIENTRY glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
|
||||
#endif /* OES_point_size_array */
|
||||
|
||||
#ifdef GL_OES_draw_texture
|
||||
|
||||
GLAPI void APIENTRY glDrawTexsOES (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
|
||||
GLAPI void APIENTRY glDrawTexiOES (GLint x, GLint y, GLint z, GLint width, GLint height);
|
||||
GLAPI void APIENTRY glDrawTexfOES (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
|
||||
GLAPI void APIENTRY glDrawTexxOES (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
|
||||
|
||||
GLAPI void APIENTRY glDrawTexsvOES (GLshort *coords);
|
||||
GLAPI void APIENTRY glDrawTexivOES (GLint *coords);
|
||||
GLAPI void APIENTRY glDrawTexfvOES (GLfloat *coords);
|
||||
GLAPI void APIENTRY glDrawTexxvOES (GLfixed *coords);
|
||||
|
||||
#endif /* GL_OES_draw_texture */
|
||||
/* GL_OES_point_sprite */
|
||||
#ifndef GL_OES_point_sprite
|
||||
#define GL_OES_point_sprite 1
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __gl_h_ */
|
||||
|
||||
|
||||
+579
-51
@@ -1,80 +1,608 @@
|
||||
#ifndef __glext_h_
|
||||
#define __glext_h_
|
||||
|
||||
/* $Id: glext.h 5687 2008-05-13 21:31:32Z oddhack $ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright 1992-2003, Silicon Graphics, Inc.
|
||||
** All Rights Reserved.
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.0 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
|
||||
** the contents of this file may not be disclosed to third parties, copied or
|
||||
** duplicated in any form, in whole or in part, without the prior written
|
||||
** permission of Silicon Graphics, Inc.
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** RESTRICTED RIGHTS LEGEND:
|
||||
** Use, duplication or disclosure by the Government is subject to restrictions
|
||||
** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
|
||||
** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
|
||||
** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
|
||||
** rights reserved under the Copyright Laws of the United States.
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** --------------------------------------------------------------------------
|
||||
**
|
||||
** Copyright (c) 2004, Hans-Martin Will. All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
** OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
** THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: The application programming interfaces
|
||||
** established by SGI in conjunction with the Original Code are The
|
||||
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
||||
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
||||
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
||||
** Window System(R) (Version 1.3), released October 19, 1998. This software
|
||||
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
*/
|
||||
|
||||
#ifndef WIN32
|
||||
#define APIENTRY
|
||||
#ifndef GL_APIENTRYP
|
||||
# define GL_APIENTRYP GL_APIENTRY*
|
||||
#endif
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
/*------------------------------------------------------------------------*
|
||||
* OES extension tokens
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_OES_blend_equation_separate */
|
||||
#ifndef GL_OES_blend_equation_separate
|
||||
/* BLEND_EQUATION_RGB_OES same as BLEND_EQUATION_OES */
|
||||
#define GL_BLEND_EQUATION_RGB_OES 0x8009
|
||||
#define GL_BLEND_EQUATION_ALPHA_OES 0x883D
|
||||
#endif
|
||||
|
||||
#ifdef EGL_ON_SYMBIAN
|
||||
# undef GLAPI
|
||||
# define GLAPI EXPORT_C
|
||||
#else
|
||||
# ifndef GLAPI
|
||||
# define GLAPI
|
||||
# endif
|
||||
/* GL_OES_blend_func_separate */
|
||||
#ifndef GL_OES_blend_func_separate
|
||||
#define GL_BLEND_DST_RGB_OES 0x80C8
|
||||
#define GL_BLEND_SRC_RGB_OES 0x80C9
|
||||
#define GL_BLEND_DST_ALPHA_OES 0x80CA
|
||||
#define GL_BLEND_SRC_ALPHA_OES 0x80CB
|
||||
#endif
|
||||
|
||||
/* GL_OES_blend_subtract */
|
||||
#ifndef GL_OES_blend_subtract
|
||||
#define GL_BLEND_EQUATION_OES 0x8009
|
||||
#define GL_FUNC_ADD_OES 0x8006
|
||||
#define GL_FUNC_SUBTRACT_OES 0x800A
|
||||
#define GL_FUNC_REVERSE_SUBTRACT_OES 0x800B
|
||||
#endif
|
||||
|
||||
#define GL_OES_query_matrix 1
|
||||
/* GL_OES_compressed_ETC1_RGB8_texture */
|
||||
#ifndef GL_OES_compressed_ETC1_RGB8_texture
|
||||
#define GL_ETC1_RGB8_OES 0x8D64
|
||||
#endif
|
||||
|
||||
/* OES_query_matrix */
|
||||
GLAPI GLbitfield APIENTRY glQueryMatrixxOES(GLfixed *mantissa, GLint *exponent);
|
||||
/* OES_draw_texture */
|
||||
#ifndef GL_OES_draw_texture
|
||||
#define GL_TEXTURE_CROP_RECT_OES 0x8B9D
|
||||
#endif
|
||||
|
||||
/* OES_fixed_point */
|
||||
#ifndef GL_OES_fixed_point
|
||||
#define GL_FIXED_OES 0x140C
|
||||
#endif
|
||||
|
||||
/* OES_framebuffer_object */
|
||||
#ifndef GL_OES_framebuffer_object
|
||||
#define GL_NONE_OES 0
|
||||
#define GL_FRAMEBUFFER_OES 0x8D40
|
||||
#define GL_RENDERBUFFER_OES 0x8D41
|
||||
#define GL_RGBA4_OES 0x8056
|
||||
#define GL_RGB5_A1_OES 0x8057
|
||||
#define GL_RGB565_OES 0x8D62
|
||||
#define GL_DEPTH_COMPONENT16_OES 0x81A5
|
||||
#define GL_RENDERBUFFER_WIDTH_OES 0x8D42
|
||||
#define GL_RENDERBUFFER_HEIGHT_OES 0x8D43
|
||||
#define GL_RENDERBUFFER_INTERNAL_FORMAT_OES 0x8D44
|
||||
#define GL_RENDERBUFFER_RED_SIZE_OES 0x8D50
|
||||
#define GL_RENDERBUFFER_GREEN_SIZE_OES 0x8D51
|
||||
#define GL_RENDERBUFFER_BLUE_SIZE_OES 0x8D52
|
||||
#define GL_RENDERBUFFER_ALPHA_SIZE_OES 0x8D53
|
||||
#define GL_RENDERBUFFER_DEPTH_SIZE_OES 0x8D54
|
||||
#define GL_RENDERBUFFER_STENCIL_SIZE_OES 0x8D55
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES 0x8CD0
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES 0x8CD1
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES 0x8CD2
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES 0x8CD3
|
||||
#define GL_COLOR_ATTACHMENT0_OES 0x8CE0
|
||||
#define GL_DEPTH_ATTACHMENT_OES 0x8D00
|
||||
#define GL_STENCIL_ATTACHMENT_OES 0x8D20
|
||||
#define GL_FRAMEBUFFER_COMPLETE_OES 0x8CD5
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES 0x8CD6
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES 0x8CD7
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES 0x8CD9
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES 0x8CDA
|
||||
#define GL_FRAMEBUFFER_UNSUPPORTED_OES 0x8CDD
|
||||
#define GL_FRAMEBUFFER_BINDING_OES 0x8CA6
|
||||
#define GL_RENDERBUFFER_BINDING_OES 0x8CA7
|
||||
#define GL_MAX_RENDERBUFFER_SIZE_OES 0x84E8
|
||||
#define GL_INVALID_FRAMEBUFFER_OPERATION_OES 0x0506
|
||||
#endif
|
||||
|
||||
/* OES_matrix_get */
|
||||
#ifndef GL_OES_matrix_get
|
||||
#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898D
|
||||
#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898E
|
||||
#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898F
|
||||
#endif
|
||||
|
||||
/* OES_matrix_palette */
|
||||
#ifndef GL_OES_matrix_palette
|
||||
#define GL_MAX_VERTEX_UNITS_OES 0x86A4
|
||||
#define GL_MAX_PALETTE_MATRICES_OES 0x8842
|
||||
#define GL_MATRIX_PALETTE_OES 0x8840
|
||||
#define GL_MATRIX_INDEX_ARRAY_OES 0x8844
|
||||
#define GL_WEIGHT_ARRAY_OES 0x86AD
|
||||
#define GL_CURRENT_PALETTE_MATRIX_OES 0x8843
|
||||
#define GL_MATRIX_INDEX_ARRAY_SIZE_OES 0x8846
|
||||
#define GL_MATRIX_INDEX_ARRAY_TYPE_OES 0x8847
|
||||
#define GL_MATRIX_INDEX_ARRAY_STRIDE_OES 0x8848
|
||||
#define GL_MATRIX_INDEX_ARRAY_POINTER_OES 0x8849
|
||||
#define GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES 0x8B9E
|
||||
#define GL_WEIGHT_ARRAY_SIZE_OES 0x86AB
|
||||
#define GL_WEIGHT_ARRAY_TYPE_OES 0x86A9
|
||||
#define GL_WEIGHT_ARRAY_STRIDE_OES 0x86AA
|
||||
#define GL_WEIGHT_ARRAY_POINTER_OES 0x86AC
|
||||
#define GL_WEIGHT_ARRAY_BUFFER_BINDING_OES 0x889E
|
||||
#endif
|
||||
|
||||
/* GL_OES_stencil_wrap */
|
||||
#ifndef GL_OES_stencil_wrap
|
||||
#define GL_INCR_WRAP_OES 0x8507
|
||||
#define GL_DECR_WRAP_OES 0x8508
|
||||
#endif
|
||||
|
||||
/* GL_OES_texture_cube_map */
|
||||
#ifndef GL_OES_texture_cube_map
|
||||
#define GL_NORMAL_MAP_OES 0x8511
|
||||
#define GL_REFLECTION_MAP_OES 0x8512
|
||||
#define GL_TEXTURE_CUBE_MAP_OES 0x8513
|
||||
#define GL_TEXTURE_BINDING_CUBE_MAP_OES 0x8514
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES 0x8515
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES 0x8516
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES 0x8517
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES 0x8518
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES 0x8519
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES 0x851A
|
||||
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES 0x851C
|
||||
#define GL_TEXTURE_GEN_MODE_OES 0x2500
|
||||
#define GL_TEXTURE_GEN_STR_OES 0x8D60
|
||||
#endif
|
||||
|
||||
/* GL_OES_texture_mirrored_repeat */
|
||||
#ifndef GL_OES_texture_mirrored_repeat
|
||||
#define GL_MIRRORED_REPEAT_OES 0x8370
|
||||
#endif
|
||||
|
||||
/* GL_OES_EGL_image */
|
||||
#ifndef GL_OES_EGL_image
|
||||
typedef void* GLeglImageOES;
|
||||
#endif
|
||||
|
||||
/* GL_OES_depth24 */
|
||||
#ifndef GL_OES_depth24
|
||||
#define GL_DEPTH_COMPONENT24_OES 0x81A6
|
||||
#endif
|
||||
|
||||
/* GL_OES_depth32 */
|
||||
#ifndef GL_OES_depth32
|
||||
#define GL_DEPTH_COMPONENT32_OES 0x81A7
|
||||
#endif
|
||||
|
||||
/* GL_OES_mapbuffer */
|
||||
#ifndef GL_OES_mapbuffer
|
||||
#define GL_WRITE_ONLY_OES 0x88B9
|
||||
#define GL_BUFFER_ACCESS_OES 0x88BB
|
||||
#define GL_BUFFER_MAPPED_OES 0x88BC
|
||||
#define GL_BUFFER_MAP_POINTER_OES 0x88BD
|
||||
#endif
|
||||
|
||||
/* GL_OES_rgb8_rgba8 */
|
||||
#ifndef GL_OES_rgb8_rgba8
|
||||
#define GL_RGB8_OES 0x8051
|
||||
#define GL_RGBA8_OES 0x8058
|
||||
#endif
|
||||
|
||||
/* GL_OES_stencil1 */
|
||||
#ifndef GL_OES_stencil1
|
||||
#define GL_STENCIL_INDEX1_OES 0x8D46
|
||||
#endif
|
||||
|
||||
/* GL_OES_stencil4 */
|
||||
#ifndef GL_OES_stencil4
|
||||
#define GL_STENCIL_INDEX4_OES 0x8D47
|
||||
#endif
|
||||
|
||||
/* GL_OES_stencil8 */
|
||||
#ifndef GL_OES_stencil8
|
||||
#define GL_STENCIL_INDEX8_OES 0x8D48
|
||||
#endif
|
||||
|
||||
/* GL_AMD_compressed_3DC_texture */
|
||||
#ifndef GL_AMD_compressed_3DC_texture
|
||||
#define GL_3DC_X_AMD 0x87F9
|
||||
#define GL_3DC_XY_AMD 0x87FA
|
||||
#endif
|
||||
|
||||
/* GL_AMD_compressed_ATC_texture */
|
||||
#ifndef GL_AMD_compressed_ATC_texture
|
||||
#define GL_ATC_RGB_AMD 0x8C92
|
||||
#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
|
||||
#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
|
||||
#endif
|
||||
|
||||
/* GL_EXT_texture_filter_anisotropic */
|
||||
#ifndef GL_EXT_texture_filter_anisotropic
|
||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* OES extension functions
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_OES_blend_equation_separate */
|
||||
#ifndef GL_OES_blend_equation_separate
|
||||
#define GL_OES_blend_equation_separate 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glBlendEquationSeparateOES (GLenum modeRGB, GLenum modeAlpha);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEOESPROC) (GLenum modeRGB, GLenum modeAlpha);
|
||||
#endif
|
||||
|
||||
/* GL_OES_blend_func_separate */
|
||||
#ifndef GL_OES_blend_func_separate
|
||||
#define GL_OES_blend_func_separate 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glBlendFuncSeparateOES (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEOESPROC) (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
|
||||
#endif
|
||||
|
||||
/* GL_OES_blend_subtract */
|
||||
#ifndef GL_OES_blend_subtract
|
||||
#define GL_OES_blend_subtract 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glBlendEquationOES (GLenum mode);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONOESPROC) (GLenum mode);
|
||||
#endif
|
||||
|
||||
/* GL_OES_byte_coordinates */
|
||||
#ifndef GL_OES_byte_coordinates
|
||||
#define GL_OES_byte_coordinates 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_compressed_ETC1_RGB8_texture */
|
||||
#ifndef GL_OES_compressed_ETC1_RGB8_texture
|
||||
#define GL_OES_compressed_ETC1_RGB8_texture 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_draw_texture */
|
||||
#ifndef GL_OES_draw_texture
|
||||
#define GL_OES_draw_texture 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glDrawTexsOES (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
|
||||
GL_API void GL_APIENTRY glDrawTexiOES (GLint x, GLint y, GLint z, GLint width, GLint height);
|
||||
GL_API void GL_APIENTRY glDrawTexxOES (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
|
||||
GL_API void GL_APIENTRY glDrawTexsvOES (const GLshort *coords);
|
||||
GL_API void GL_APIENTRY glDrawTexivOES (const GLint *coords);
|
||||
GL_API void GL_APIENTRY glDrawTexxvOES (const GLfixed *coords);
|
||||
GL_API void GL_APIENTRY glDrawTexfOES (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
|
||||
GL_API void GL_APIENTRY glDrawTexfvOES (const GLfloat *coords);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWTEXSOESPROC) (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWTEXIOESPROC) (GLint x, GLint y, GLint z, GLint width, GLint height);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWTEXXOESPROC) (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWTEXSVOESPROC) (const GLshort *coords);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWTEXIVOESPROC) (const GLint *coords);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWTEXXVOESPROC) (const GLfixed *coords);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWTEXFOESPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWTEXFVOESPROC) (const GLfloat *coords);
|
||||
#endif
|
||||
|
||||
/* GL_OES_extended_matrix_palette */
|
||||
#ifndef GL_OES_extended_matrix_palette
|
||||
#define GL_OES_extended_matrix_palette 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_fixed_point */
|
||||
#ifndef GL_OES_fixed_point
|
||||
#define GL_OES_fixed_point 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glAlphaFuncxOES (GLenum func, GLclampx ref);
|
||||
GL_API void GL_APIENTRY glClearColorxOES (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
|
||||
GL_API void GL_APIENTRY glClearDepthxOES (GLclampx depth);
|
||||
GL_API void GL_APIENTRY glClipPlanexOES (GLenum plane, const GLfixed *equation);
|
||||
GL_API void GL_APIENTRY glColor4xOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
|
||||
GL_API void GL_APIENTRY glDepthRangexOES (GLclampx zNear, GLclampx zFar);
|
||||
GL_API void GL_APIENTRY glFogxOES (GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glFogxvOES (GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glFrustumxOES (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
|
||||
GL_API void GL_APIENTRY glGetClipPlanexOES (GLenum pname, GLfixed eqn[4]);
|
||||
GL_API void GL_APIENTRY glGetFixedvOES (GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetLightxvOES (GLenum light, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetMaterialxvOES (GLenum face, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetTexEnvxvOES (GLenum env, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetTexParameterxvOES (GLenum target, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glLightModelxOES (GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glLightModelxvOES (GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glLightxOES (GLenum light, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glLightxvOES (GLenum light, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glLineWidthxOES (GLfixed width);
|
||||
GL_API void GL_APIENTRY glLoadMatrixxOES (const GLfixed *m);
|
||||
GL_API void GL_APIENTRY glMaterialxOES (GLenum face, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glMaterialxvOES (GLenum face, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glMultMatrixxOES (const GLfixed *m);
|
||||
GL_API void GL_APIENTRY glMultiTexCoord4xOES (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
|
||||
GL_API void GL_APIENTRY glNormal3xOES (GLfixed nx, GLfixed ny, GLfixed nz);
|
||||
GL_API void GL_APIENTRY glOrthoxOES (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
|
||||
GL_API void GL_APIENTRY glPointParameterxOES (GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glPointSizexOES (GLfixed size);
|
||||
GL_API void GL_APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units);
|
||||
GL_API void GL_APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
|
||||
GL_API void GL_APIENTRY glSampleCoveragexOES (GLclampx value, GLboolean invert);
|
||||
GL_API void GL_APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z);
|
||||
GL_API void GL_APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glTexParameterxOES (GLenum target, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glTexParameterxvOES (GLenum target, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glTranslatexOES (GLfixed x, GLfixed y, GLfixed z);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLALPHAFUNCXOESPROC) (GLenum func, GLclampx ref);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARCOLORXOESPROC) (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARDEPTHXOESPROC) (GLclampx depth);
|
||||
typedef void (GL_APIENTRYP PFNGLCLIPPLANEXOESPROC) (GLenum plane, const GLfixed *equation);
|
||||
typedef void (GL_APIENTRYP PFNGLCOLOR4XOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
|
||||
typedef void (GL_APIENTRYP PFNGLDEPTHRANGEXOESPROC) (GLclampx zNear, GLclampx zFar);
|
||||
typedef void (GL_APIENTRYP PFNGLFOGXOESPROC) (GLenum pname, GLfixed param);
|
||||
typedef void (GL_APIENTRYP PFNGLFOGXVOESPROC) (GLenum pname, const GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLFRUSTUMXOESPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
|
||||
typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEXOESPROC) (GLenum pname, GLfixed eqn[4]);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFIXEDVOESPROC) (GLenum pname, GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETLIGHTXVOESPROC) (GLenum light, GLenum pname, GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETMATERIALXVOESPROC) (GLenum face, GLenum pname, GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXENVXVOESPROC) (GLenum env, GLenum pname, GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLLIGHTMODELXOESPROC) (GLenum pname, GLfixed param);
|
||||
typedef void (GL_APIENTRYP PFNGLLIGHTMODELXVOESPROC) (GLenum pname, const GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed param);
|
||||
typedef void (GL_APIENTRYP PFNGLLIGHTXVOESPROC) (GLenum light, GLenum pname, const GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLLINEWIDTHXOESPROC) (GLfixed width);
|
||||
typedef void (GL_APIENTRYP PFNGLLOADMATRIXXOESPROC) (const GLfixed *m);
|
||||
typedef void (GL_APIENTRYP PFNGLMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param);
|
||||
typedef void (GL_APIENTRYP PFNGLMATERIALXVOESPROC) (GLenum face, GLenum pname, const GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLMULTMATRIXXOESPROC) (const GLfixed *m);
|
||||
typedef void (GL_APIENTRYP PFNGLMULTITEXCOORD4XOESPROC) (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
|
||||
typedef void (GL_APIENTRYP PFNGLNORMAL3XOESPROC) (GLfixed nx, GLfixed ny, GLfixed nz);
|
||||
typedef void (GL_APIENTRYP PFNGLORTHOXOESPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
|
||||
typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXOESPROC) (GLenum pname, GLfixed param);
|
||||
typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size);
|
||||
typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units);
|
||||
typedef void (GL_APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEXOESPROC) (GLclampx value, GLboolean invert);
|
||||
typedef void (GL_APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTRANSLATEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);
|
||||
#endif
|
||||
|
||||
/* GL_OES_framebuffer_object */
|
||||
#ifndef GL_OES_framebuffer_object
|
||||
#define GL_OES_framebuffer_object 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API GLboolean GL_APIENTRY glIsRenderbufferOES (GLuint renderbuffer);
|
||||
GL_API void GL_APIENTRY glBindRenderbufferOES (GLenum target, GLuint renderbuffer);
|
||||
GL_API void GL_APIENTRY glDeleteRenderbuffersOES (GLsizei n, const GLuint* renderbuffers);
|
||||
GL_API void GL_APIENTRY glGenRenderbuffersOES (GLsizei n, GLuint* renderbuffers);
|
||||
GL_API void GL_APIENTRY glRenderbufferStorageOES (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
GL_API void GL_APIENTRY glGetRenderbufferParameterivOES (GLenum target, GLenum pname, GLint* params);
|
||||
GL_API GLboolean GL_APIENTRY glIsFramebufferOES (GLuint framebuffer);
|
||||
GL_API void GL_APIENTRY glBindFramebufferOES (GLenum target, GLuint framebuffer);
|
||||
GL_API void GL_APIENTRY glDeleteFramebuffersOES (GLsizei n, const GLuint* framebuffers);
|
||||
GL_API void GL_APIENTRY glGenFramebuffersOES (GLsizei n, GLuint* framebuffers);
|
||||
GL_API GLenum GL_APIENTRY glCheckFramebufferStatusOES (GLenum target);
|
||||
GL_API void GL_APIENTRY glFramebufferRenderbufferOES (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
GL_API void GL_APIENTRY glFramebufferTexture2DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
GL_API void GL_APIENTRY glGetFramebufferAttachmentParameterivOES (GLenum target, GLenum attachment, GLenum pname, GLint* params);
|
||||
GL_API void GL_APIENTRY glGenerateMipmapOES (GLenum target);
|
||||
#endif
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFEROESPROC) (GLuint renderbuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFEROESPROC) (GLenum target, GLuint renderbuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSOESPROC) (GLsizei n, const GLuint* renderbuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSOESPROC) (GLsizei n, GLuint* renderbuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVOESPROC) (GLenum target, GLenum pname, GLint* params);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFEROESPROC) (GLuint framebuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFEROESPROC) (GLenum target, GLuint framebuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSOESPROC) (GLsizei n, const GLuint* framebuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSOESPROC) (GLsizei n, GLuint* framebuffers);
|
||||
typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSOESPROC) (GLenum target);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEROESPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params);
|
||||
typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPOESPROC) (GLenum target);
|
||||
#endif
|
||||
|
||||
/* GL_OES_matrix_get */
|
||||
#ifndef GL_OES_matrix_get
|
||||
#define GL_OES_matrix_get 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_matrix_palette */
|
||||
#ifndef GL_OES_matrix_palette
|
||||
#define GL_OES_matrix_palette 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glCurrentPaletteMatrixOES (GLuint matrixpaletteindex);
|
||||
GL_API void GL_APIENTRY glLoadPaletteFromModelViewMatrixOES (void);
|
||||
GL_API void GL_APIENTRY glMatrixIndexPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
GL_API void GL_APIENTRY glWeightPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLCURRENTPALETTEMATRIXOESPROC) (GLuint matrixpaletteindex);
|
||||
typedef void (GL_APIENTRYP PFNGLLOADPALETTEFROMMODELVIEWMATRIXOESPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLMATRIXINDEXPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
typedef void (GL_APIENTRYP PFNGLWEIGHTPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
#endif
|
||||
|
||||
/* GL_OES_query_matrix */
|
||||
#ifndef GL_OES_query_matrix
|
||||
#define GL_OES_query_matrix 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API GLbitfield GL_APIENTRY glQueryMatrixxOES (GLfixed mantissa[16], GLint exponent[16]);
|
||||
#endif
|
||||
typedef GLbitfield (GL_APIENTRYP PFNGLQUERYMATRIXXOESPROC) (GLfixed mantissa[16], GLint exponent[16]);
|
||||
#endif
|
||||
|
||||
/* GL_OES_single_precision */
|
||||
#ifndef GL_OES_single_precision
|
||||
#define GL_OES_single_precision 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glDepthRangefOES (GLclampf zNear, GLclampf zFar);
|
||||
GL_API void GL_APIENTRY glFrustumfOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
|
||||
GL_API void GL_APIENTRY glOrthofOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
|
||||
GL_API void GL_APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation);
|
||||
GL_API void GL_APIENTRY glGetClipPlanefOES (GLenum pname, GLfloat eqn[4]);
|
||||
GL_API void GL_APIENTRY glClearDepthfOES (GLclampf depth);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFOESPROC) (GLclampf zNear, GLclampf zFar);
|
||||
typedef void (GL_APIENTRYP PFNGLFRUSTUMFOESPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
|
||||
typedef void (GL_APIENTRYP PFNGLORTHOFOESPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
|
||||
typedef void (GL_APIENTRYP PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat *equation);
|
||||
typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEFOESPROC) (GLenum pname, GLfloat eqn[4]);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFOESPROC) (GLclampf depth);
|
||||
#endif
|
||||
|
||||
/* GL_OES_stencil_wrap */
|
||||
#ifndef GL_OES_stencil_wrap
|
||||
#define GL_OES_stencil_wrap 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_texture_cube_map */
|
||||
#ifndef GL_OES_texture_cube_map
|
||||
#define GL_OES_texture_cube_map 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glTexGenfOES (GLenum coord, GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glTexGenfvOES (GLenum coord, GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glTexGeniOES (GLenum coord, GLenum pname, GLint param);
|
||||
GL_API void GL_APIENTRY glTexGenivOES (GLenum coord, GLenum pname, const GLint *params);
|
||||
GL_API void GL_APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetTexGenfvOES (GLenum coord, GLenum pname, GLfloat *params);
|
||||
GL_API void GL_APIENTRY glGetTexGenivOES (GLenum coord, GLenum pname, GLint *params);
|
||||
GL_API void GL_APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLTEXGENFOESPROC) (GLenum coord, GLenum pname, GLfloat param);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXGENFVOESPROC) (GLenum coord, GLenum pname, const GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXGENIOESPROC) (GLenum coord, GLenum pname, GLint param);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXGENIVOESPROC) (GLenum coord, GLenum pname, const GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params);
|
||||
#endif
|
||||
|
||||
/* GL_OES_texture_env_crossbar */
|
||||
#ifndef GL_OES_texture_env_crossbar
|
||||
#define GL_OES_texture_env_crossbar 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_texture_mirrored_repeat */
|
||||
#ifndef GL_OES_texture_mirrored_repeat
|
||||
#define GL_OES_texture_mirrored_repeat 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_EGL_image */
|
||||
#ifndef GL_OES_EGL_image
|
||||
#define GL_OES_EGL_image 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
|
||||
GL_API void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
|
||||
typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
|
||||
#endif
|
||||
|
||||
/* GL_OES_depth24 */
|
||||
#ifndef GL_OES_depth24
|
||||
#define GL_OES_depth24 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_depth32 */
|
||||
#ifndef GL_OES_depth32
|
||||
#define GL_OES_depth32 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_element_index_uint */
|
||||
#ifndef GL_OES_element_index_uint
|
||||
#define GL_OES_element_index_uint 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_fbo_render_mipmap */
|
||||
#ifndef GL_OES_fbo_render_mipmap
|
||||
#define GL_OES_fbo_render_mipmap 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_mapbuffer */
|
||||
#ifndef GL_OES_mapbuffer
|
||||
#define GL_OES_mapbuffer 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
|
||||
GL_API GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
|
||||
GL_API void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void** params);
|
||||
#endif
|
||||
typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void** params);
|
||||
#endif
|
||||
|
||||
/* GL_OES_rgb8_rgba8 */
|
||||
#ifndef GL_OES_rgb8_rgba8
|
||||
#define GL_OES_rgb8_rgba8 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_stencil1 */
|
||||
#ifndef GL_OES_stencil1
|
||||
#define GL_OES_stencil1 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_stencil4 */
|
||||
#ifndef GL_OES_stencil4
|
||||
#define GL_OES_stencil4 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_stencil8 */
|
||||
#ifndef GL_OES_stencil8
|
||||
#define GL_OES_stencil8 1
|
||||
#endif
|
||||
|
||||
/* GL_AMD_compressed_3DC_texture */
|
||||
#ifndef GL_AMD_compressed_3DC_texture
|
||||
#define GL_AMD_compressed_3DC_texture 1
|
||||
#endif
|
||||
|
||||
/* GL_AMD_compressed_ATC_texture */
|
||||
#ifndef GL_AMD_compressed_ATC_texture
|
||||
#define GL_AMD_compressed_ATC_texture 1
|
||||
#endif
|
||||
|
||||
/* GL_EXT_texture_filter_anisotropic */
|
||||
#ifndef GL_EXT_texture_filter_anisotropic
|
||||
#define GL_EXT_texture_filter_anisotropic 1
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __glext_h_ */
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
#ifndef __glplatform_h_
|
||||
#define __glplatform_h_
|
||||
|
||||
/* $Id: glplatform.h 4585 2007-11-30 09:49:39Z markc $ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.0 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: The application programming interfaces
|
||||
** established by SGI in conjunction with the Original Code are The
|
||||
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
||||
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
||||
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
||||
** Window System(R) (Version 1.3), released October 19, 1998. This software
|
||||
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of GL_API and GL_APIENTRY
|
||||
*-----------------------------------------------------------------------*/
|
||||
|
||||
#define __GL_EXPORTS
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifdef __GL_EXPORTS
|
||||
# define GL_API __declspec(dllexport)
|
||||
# else
|
||||
# define GL_API __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# ifdef __GL_EXPORTS
|
||||
# define GL_API
|
||||
# else
|
||||
# define GL_API extern
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define GL_APIENTRY
|
||||
|
||||
#ifndef APIENTRY
|
||||
# define APIENTRY GL_APIENTRY
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __glplatform_h_ */
|
||||
@@ -0,0 +1,653 @@
|
||||
#ifndef __gl2_h_
|
||||
#define __gl2_h_
|
||||
|
||||
/* $Id: gl2.h 5418 2008-03-26 19:57:12Z oddhack $ */
|
||||
|
||||
#include <GLES2/gl2platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.0 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: The application programming interfaces
|
||||
** established by SGI in conjunction with the Original Code are The
|
||||
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
||||
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
||||
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
||||
** Window System(R) (Version 1.3), released October 19, 1998. This software
|
||||
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Data type definitions
|
||||
*-----------------------------------------------------------------------*/
|
||||
|
||||
typedef void GLvoid;
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef signed char GLbyte;
|
||||
typedef short GLshort;
|
||||
typedef int GLint;
|
||||
typedef int GLsizei;
|
||||
typedef unsigned char GLubyte;
|
||||
typedef unsigned short GLushort;
|
||||
typedef unsigned int GLuint;
|
||||
typedef float GLfloat;
|
||||
typedef float GLclampf;
|
||||
typedef int GLfixed;
|
||||
typedef int GLclampx;
|
||||
|
||||
/* GL types for handling large vertex buffer objects */
|
||||
typedef int GLintptr;
|
||||
typedef int GLsizeiptr;
|
||||
|
||||
/* OpenGL ES core versions */
|
||||
#define GL_ES_VERSION_2_0 1
|
||||
|
||||
/* ClearBufferMask */
|
||||
#define GL_DEPTH_BUFFER_BIT 0x00000100
|
||||
#define GL_STENCIL_BUFFER_BIT 0x00000400
|
||||
#define GL_COLOR_BUFFER_BIT 0x00004000
|
||||
|
||||
/* Boolean */
|
||||
#define GL_FALSE 0
|
||||
#define GL_TRUE 1
|
||||
|
||||
/* \todo check that this should be in core. */
|
||||
#define GL_NONE 0
|
||||
|
||||
/* BeginMode */
|
||||
#define GL_POINTS 0x0000
|
||||
#define GL_LINES 0x0001
|
||||
#define GL_LINE_LOOP 0x0002
|
||||
#define GL_LINE_STRIP 0x0003
|
||||
#define GL_TRIANGLES 0x0004
|
||||
#define GL_TRIANGLE_STRIP 0x0005
|
||||
#define GL_TRIANGLE_FAN 0x0006
|
||||
|
||||
/* AlphaFunction (not supported in ES20) */
|
||||
/* GL_NEVER */
|
||||
/* GL_LESS */
|
||||
/* GL_EQUAL */
|
||||
/* GL_LEQUAL */
|
||||
/* GL_GREATER */
|
||||
/* GL_NOTEQUAL */
|
||||
/* GL_GEQUAL */
|
||||
/* GL_ALWAYS */
|
||||
|
||||
/* BlendingFactorDest */
|
||||
#define GL_ZERO 0
|
||||
#define GL_ONE 1
|
||||
#define GL_SRC_COLOR 0x0300
|
||||
#define GL_ONE_MINUS_SRC_COLOR 0x0301
|
||||
#define GL_SRC_ALPHA 0x0302
|
||||
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
|
||||
#define GL_DST_ALPHA 0x0304
|
||||
#define GL_ONE_MINUS_DST_ALPHA 0x0305
|
||||
|
||||
/* BlendingFactorSrc */
|
||||
/* GL_ZERO */
|
||||
/* GL_ONE */
|
||||
#define GL_DST_COLOR 0x0306
|
||||
#define GL_ONE_MINUS_DST_COLOR 0x0307
|
||||
#define GL_SRC_ALPHA_SATURATE 0x0308
|
||||
/* GL_SRC_ALPHA */
|
||||
/* GL_ONE_MINUS_SRC_ALPHA */
|
||||
/* GL_DST_ALPHA */
|
||||
/* GL_ONE_MINUS_DST_ALPHA */
|
||||
|
||||
/* BlendEquationSeparate */
|
||||
#define GL_FUNC_ADD 0x8006
|
||||
#define GL_BLEND_EQUATION 0x8009
|
||||
#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */
|
||||
#define GL_BLEND_EQUATION_ALPHA 0x883D
|
||||
|
||||
/* BlendSubtract */
|
||||
#define GL_FUNC_SUBTRACT 0x800A
|
||||
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
|
||||
|
||||
/* Separate Blend Functions */
|
||||
#define GL_BLEND_DST_RGB 0x80C8
|
||||
#define GL_BLEND_SRC_RGB 0x80C9
|
||||
#define GL_BLEND_DST_ALPHA 0x80CA
|
||||
#define GL_BLEND_SRC_ALPHA 0x80CB
|
||||
#define GL_CONSTANT_COLOR 0x8001
|
||||
#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
|
||||
#define GL_CONSTANT_ALPHA 0x8003
|
||||
#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
|
||||
#define GL_BLEND_COLOR 0x8005
|
||||
|
||||
/* Buffer Objects */
|
||||
#define GL_ARRAY_BUFFER 0x8892
|
||||
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
|
||||
#define GL_ARRAY_BUFFER_BINDING 0x8894
|
||||
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
|
||||
|
||||
#define GL_STREAM_DRAW 0x88E0
|
||||
#define GL_STATIC_DRAW 0x88E4
|
||||
#define GL_DYNAMIC_DRAW 0x88E8
|
||||
|
||||
#define GL_BUFFER_SIZE 0x8764
|
||||
#define GL_BUFFER_USAGE 0x8765
|
||||
|
||||
#define GL_CURRENT_VERTEX_ATTRIB 0x8626
|
||||
|
||||
/* CullFaceMode */
|
||||
#define GL_FRONT 0x0404
|
||||
#define GL_BACK 0x0405
|
||||
#define GL_FRONT_AND_BACK 0x0408
|
||||
|
||||
/* DepthFunction */
|
||||
/* GL_NEVER */
|
||||
/* GL_LESS */
|
||||
/* GL_EQUAL */
|
||||
/* GL_LEQUAL */
|
||||
/* GL_GREATER */
|
||||
/* GL_NOTEQUAL */
|
||||
/* GL_GEQUAL */
|
||||
/* GL_ALWAYS */
|
||||
|
||||
/* EnableCap */
|
||||
#define GL_TEXTURE_2D 0x0DE1
|
||||
#define GL_CULL_FACE 0x0B44
|
||||
#define GL_BLEND 0x0BE2
|
||||
#define GL_DITHER 0x0BD0
|
||||
#define GL_STENCIL_TEST 0x0B90
|
||||
#define GL_DEPTH_TEST 0x0B71
|
||||
#define GL_SCISSOR_TEST 0x0C11
|
||||
#define GL_POLYGON_OFFSET_FILL 0x8037
|
||||
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
|
||||
#define GL_SAMPLE_COVERAGE 0x80A0
|
||||
|
||||
/* ErrorCode */
|
||||
#define GL_NO_ERROR 0
|
||||
#define GL_INVALID_ENUM 0x0500
|
||||
#define GL_INVALID_VALUE 0x0501
|
||||
#define GL_INVALID_OPERATION 0x0502
|
||||
#define GL_OUT_OF_MEMORY 0x0505
|
||||
|
||||
/* FrontFaceDirection */
|
||||
#define GL_CW 0x0900
|
||||
#define GL_CCW 0x0901
|
||||
|
||||
/* GetPName */
|
||||
#define GL_LINE_WIDTH 0x0B21
|
||||
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
|
||||
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
|
||||
#define GL_CULL_FACE_MODE 0x0B45
|
||||
#define GL_FRONT_FACE 0x0B46
|
||||
#define GL_DEPTH_RANGE 0x0B70
|
||||
#define GL_DEPTH_WRITEMASK 0x0B72
|
||||
#define GL_DEPTH_CLEAR_VALUE 0x0B73
|
||||
#define GL_DEPTH_FUNC 0x0B74
|
||||
#define GL_STENCIL_CLEAR_VALUE 0x0B91
|
||||
#define GL_STENCIL_FUNC 0x0B92
|
||||
#define GL_STENCIL_FAIL 0x0B94
|
||||
#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
|
||||
#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
|
||||
#define GL_STENCIL_REF 0x0B97
|
||||
#define GL_STENCIL_VALUE_MASK 0x0B93
|
||||
#define GL_STENCIL_WRITEMASK 0x0B98
|
||||
#define GL_STENCIL_BACK_FUNC 0x8800
|
||||
#define GL_STENCIL_BACK_FAIL 0x8801
|
||||
#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
|
||||
#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
|
||||
#define GL_STENCIL_BACK_REF 0x8CA3
|
||||
#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
|
||||
#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
|
||||
#define GL_VIEWPORT 0x0BA2
|
||||
#define GL_SCISSOR_BOX 0x0C10
|
||||
/* GL_SCISSOR_TEST */
|
||||
#define GL_COLOR_CLEAR_VALUE 0x0C22
|
||||
#define GL_COLOR_WRITEMASK 0x0C23
|
||||
#define GL_UNPACK_ALIGNMENT 0x0CF5
|
||||
#define GL_PACK_ALIGNMENT 0x0D05
|
||||
#define GL_MAX_TEXTURE_SIZE 0x0D33
|
||||
#define GL_MAX_VIEWPORT_DIMS 0x0D3A
|
||||
#define GL_SUBPIXEL_BITS 0x0D50
|
||||
#define GL_RED_BITS 0x0D52
|
||||
#define GL_GREEN_BITS 0x0D53
|
||||
#define GL_BLUE_BITS 0x0D54
|
||||
#define GL_ALPHA_BITS 0x0D55
|
||||
#define GL_DEPTH_BITS 0x0D56
|
||||
#define GL_STENCIL_BITS 0x0D57
|
||||
#define GL_POLYGON_OFFSET_UNITS 0x2A00
|
||||
/* GL_POLYGON_OFFSET_FILL */
|
||||
#define GL_POLYGON_OFFSET_FACTOR 0x8038
|
||||
#define GL_TEXTURE_BINDING_2D 0x8069
|
||||
#define GL_SAMPLE_BUFFERS 0x80A8
|
||||
#define GL_SAMPLES 0x80A9
|
||||
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
|
||||
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
|
||||
|
||||
/* GetTextureParameter */
|
||||
/* GL_TEXTURE_MAG_FILTER */
|
||||
/* GL_TEXTURE_MIN_FILTER */
|
||||
/* GL_TEXTURE_WRAP_S */
|
||||
/* GL_TEXTURE_WRAP_T */
|
||||
|
||||
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
|
||||
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
|
||||
|
||||
/* HintMode */
|
||||
#define GL_DONT_CARE 0x1100
|
||||
#define GL_FASTEST 0x1101
|
||||
#define GL_NICEST 0x1102
|
||||
|
||||
/* HintTarget */
|
||||
#define GL_GENERATE_MIPMAP_HINT 0x8192
|
||||
|
||||
/* DataType */
|
||||
#define GL_BYTE 0x1400
|
||||
#define GL_UNSIGNED_BYTE 0x1401
|
||||
#define GL_SHORT 0x1402
|
||||
#define GL_UNSIGNED_SHORT 0x1403
|
||||
#define GL_INT 0x1404
|
||||
#define GL_UNSIGNED_INT 0x1405
|
||||
#define GL_FLOAT 0x1406
|
||||
#define GL_FIXED 0x140C
|
||||
|
||||
/* PixelFormat */
|
||||
#define GL_DEPTH_COMPONENT 0x1902
|
||||
#define GL_ALPHA 0x1906
|
||||
#define GL_RGB 0x1907
|
||||
#define GL_RGBA 0x1908
|
||||
#define GL_LUMINANCE 0x1909
|
||||
#define GL_LUMINANCE_ALPHA 0x190A
|
||||
|
||||
/* PixelType */
|
||||
/* GL_UNSIGNED_BYTE */
|
||||
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
|
||||
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
|
||||
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
|
||||
|
||||
/* Shaders */
|
||||
#define GL_FRAGMENT_SHADER 0x8B30
|
||||
#define GL_VERTEX_SHADER 0x8B31
|
||||
#define GL_MAX_VERTEX_ATTRIBS 0x8869
|
||||
#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
|
||||
#define GL_MAX_VARYING_VECTORS 0x8DFC
|
||||
#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
|
||||
#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
|
||||
#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
|
||||
#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
|
||||
#define GL_SHADER_TYPE 0x8B4F
|
||||
#define GL_DELETE_STATUS 0x8B80
|
||||
#define GL_LINK_STATUS 0x8B82
|
||||
#define GL_VALIDATE_STATUS 0x8B83
|
||||
#define GL_ATTACHED_SHADERS 0x8B85
|
||||
#define GL_ACTIVE_UNIFORMS 0x8B86
|
||||
#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
|
||||
#define GL_ACTIVE_ATTRIBUTES 0x8B89
|
||||
#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
|
||||
#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
|
||||
#define GL_CURRENT_PROGRAM 0x8B8D
|
||||
|
||||
/* StencilFunction */
|
||||
#define GL_NEVER 0x0200
|
||||
#define GL_LESS 0x0201
|
||||
#define GL_EQUAL 0x0202
|
||||
#define GL_LEQUAL 0x0203
|
||||
#define GL_GREATER 0x0204
|
||||
#define GL_NOTEQUAL 0x0205
|
||||
#define GL_GEQUAL 0x0206
|
||||
#define GL_ALWAYS 0x0207
|
||||
|
||||
/* StencilOp */
|
||||
/* GL_ZERO */
|
||||
#define GL_KEEP 0x1E00
|
||||
#define GL_REPLACE 0x1E01
|
||||
#define GL_INCR 0x1E02
|
||||
#define GL_DECR 0x1E03
|
||||
#define GL_INVERT 0x150A
|
||||
#define GL_INCR_WRAP 0x8507
|
||||
#define GL_DECR_WRAP 0x8508
|
||||
|
||||
/* StringName */
|
||||
#define GL_VENDOR 0x1F00
|
||||
#define GL_RENDERER 0x1F01
|
||||
#define GL_VERSION 0x1F02
|
||||
#define GL_EXTENSIONS 0x1F03
|
||||
|
||||
/* TextureMagFilter */
|
||||
#define GL_NEAREST 0x2600
|
||||
#define GL_LINEAR 0x2601
|
||||
|
||||
/* TextureMinFilter */
|
||||
/* GL_NEAREST */
|
||||
/* GL_LINEAR */
|
||||
#define GL_NEAREST_MIPMAP_NEAREST 0x2700
|
||||
#define GL_LINEAR_MIPMAP_NEAREST 0x2701
|
||||
#define GL_NEAREST_MIPMAP_LINEAR 0x2702
|
||||
#define GL_LINEAR_MIPMAP_LINEAR 0x2703
|
||||
|
||||
/* TextureParameterName */
|
||||
#define GL_TEXTURE_MAG_FILTER 0x2800
|
||||
#define GL_TEXTURE_MIN_FILTER 0x2801
|
||||
#define GL_TEXTURE_WRAP_S 0x2802
|
||||
#define GL_TEXTURE_WRAP_T 0x2803
|
||||
|
||||
/* TextureTarget */
|
||||
/* GL_TEXTURE_2D */
|
||||
#define GL_TEXTURE 0x1702
|
||||
|
||||
#define GL_TEXTURE_CUBE_MAP 0x8513
|
||||
#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
|
||||
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
|
||||
|
||||
/* TextureUnit */
|
||||
#define GL_TEXTURE0 0x84C0
|
||||
#define GL_TEXTURE1 0x84C1
|
||||
#define GL_TEXTURE2 0x84C2
|
||||
#define GL_TEXTURE3 0x84C3
|
||||
#define GL_TEXTURE4 0x84C4
|
||||
#define GL_TEXTURE5 0x84C5
|
||||
#define GL_TEXTURE6 0x84C6
|
||||
#define GL_TEXTURE7 0x84C7
|
||||
#define GL_TEXTURE8 0x84C8
|
||||
#define GL_TEXTURE9 0x84C9
|
||||
#define GL_TEXTURE10 0x84CA
|
||||
#define GL_TEXTURE11 0x84CB
|
||||
#define GL_TEXTURE12 0x84CC
|
||||
#define GL_TEXTURE13 0x84CD
|
||||
#define GL_TEXTURE14 0x84CE
|
||||
#define GL_TEXTURE15 0x84CF
|
||||
#define GL_TEXTURE16 0x84D0
|
||||
#define GL_TEXTURE17 0x84D1
|
||||
#define GL_TEXTURE18 0x84D2
|
||||
#define GL_TEXTURE19 0x84D3
|
||||
#define GL_TEXTURE20 0x84D4
|
||||
#define GL_TEXTURE21 0x84D5
|
||||
#define GL_TEXTURE22 0x84D6
|
||||
#define GL_TEXTURE23 0x84D7
|
||||
#define GL_TEXTURE24 0x84D8
|
||||
#define GL_TEXTURE25 0x84D9
|
||||
#define GL_TEXTURE26 0x84DA
|
||||
#define GL_TEXTURE27 0x84DB
|
||||
#define GL_TEXTURE28 0x84DC
|
||||
#define GL_TEXTURE29 0x84DD
|
||||
#define GL_TEXTURE30 0x84DE
|
||||
#define GL_TEXTURE31 0x84DF
|
||||
#define GL_ACTIVE_TEXTURE 0x84E0
|
||||
|
||||
/* TextureWrapMode */
|
||||
#define GL_REPEAT 0x2901
|
||||
#define GL_CLAMP_TO_EDGE 0x812F
|
||||
#define GL_MIRRORED_REPEAT 0x8370
|
||||
|
||||
/* Uniform Types */
|
||||
#define GL_FLOAT_VEC2 0x8B50
|
||||
#define GL_FLOAT_VEC3 0x8B51
|
||||
#define GL_FLOAT_VEC4 0x8B52
|
||||
#define GL_INT_VEC2 0x8B53
|
||||
#define GL_INT_VEC3 0x8B54
|
||||
#define GL_INT_VEC4 0x8B55
|
||||
#define GL_BOOL 0x8B56
|
||||
#define GL_BOOL_VEC2 0x8B57
|
||||
#define GL_BOOL_VEC3 0x8B58
|
||||
#define GL_BOOL_VEC4 0x8B59
|
||||
#define GL_FLOAT_MAT2 0x8B5A
|
||||
#define GL_FLOAT_MAT3 0x8B5B
|
||||
#define GL_FLOAT_MAT4 0x8B5C
|
||||
#define GL_SAMPLER_2D 0x8B5E
|
||||
#define GL_SAMPLER_CUBE 0x8B60
|
||||
|
||||
/* Vertex Arrays */
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
|
||||
|
||||
/* Read Format */
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
|
||||
|
||||
/* Shader Source */
|
||||
#define GL_COMPILE_STATUS 0x8B81
|
||||
#define GL_INFO_LOG_LENGTH 0x8B84
|
||||
#define GL_SHADER_SOURCE_LENGTH 0x8B88
|
||||
#define GL_SHADER_COMPILER 0x8DFA
|
||||
|
||||
/* Shader Binary */
|
||||
#define GL_PLATFORM_BINARY 0x8D63
|
||||
#define GL_SHADER_BINARY_FORMATS 0x8DF8
|
||||
#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
|
||||
|
||||
/* Shader Precision-Specified Types */
|
||||
#define GL_LOW_FLOAT 0x8DF0
|
||||
#define GL_MEDIUM_FLOAT 0x8DF1
|
||||
#define GL_HIGH_FLOAT 0x8DF2
|
||||
#define GL_LOW_INT 0x8DF3
|
||||
#define GL_MEDIUM_INT 0x8DF4
|
||||
#define GL_HIGH_INT 0x8DF5
|
||||
|
||||
/* Framebuffer Object. */
|
||||
#define GL_FRAMEBUFFER 0x8D40
|
||||
#define GL_RENDERBUFFER 0x8D41
|
||||
|
||||
#define GL_RGBA4 0x8056
|
||||
#define GL_RGB5_A1 0x8057
|
||||
#define GL_RGB565 0x8D62
|
||||
#define GL_DEPTH_COMPONENT16 0x81A5
|
||||
#define GL_STENCIL_INDEX 0x1901
|
||||
#define GL_STENCIL_INDEX8 0x8D48
|
||||
|
||||
#define GL_RENDERBUFFER_WIDTH 0x8D42
|
||||
#define GL_RENDERBUFFER_HEIGHT 0x8D43
|
||||
#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
|
||||
#define GL_RENDERBUFFER_RED_SIZE 0x8D50
|
||||
#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
|
||||
#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
|
||||
#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
|
||||
#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
|
||||
#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
|
||||
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
|
||||
|
||||
#define GL_COLOR_ATTACHMENT0 0x8CE0
|
||||
#define GL_DEPTH_ATTACHMENT 0x8D00
|
||||
#define GL_STENCIL_ATTACHMENT 0x8D20
|
||||
|
||||
#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS 0x8CDA
|
||||
#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
|
||||
|
||||
#define GL_FRAMEBUFFER_BINDING 0x8CA6
|
||||
#define GL_RENDERBUFFER_BINDING 0x8CA7
|
||||
#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
|
||||
|
||||
#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* GL core functions.
|
||||
*-----------------------------------------------------------------------*/
|
||||
|
||||
GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
|
||||
GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const char* name);
|
||||
GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
|
||||
GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
|
||||
GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
|
||||
GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
|
||||
GL_APICALL void GL_APIENTRY glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
GL_APICALL void GL_APIENTRY glBlendEquation( GLenum mode );
|
||||
GL_APICALL void GL_APIENTRY glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
|
||||
GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
|
||||
GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
|
||||
GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void* data, GLenum usage);
|
||||
GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void* data);
|
||||
GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
|
||||
GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
|
||||
GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth);
|
||||
GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
|
||||
GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);
|
||||
GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
|
||||
GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
|
||||
GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
|
||||
GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers);
|
||||
GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
|
||||
GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);
|
||||
GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures);
|
||||
GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
|
||||
GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
|
||||
GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
|
||||
GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
|
||||
GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
|
||||
GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
|
||||
GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void* indices);
|
||||
GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
|
||||
GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
|
||||
GL_APICALL void GL_APIENTRY glFinish (void);
|
||||
GL_APICALL void GL_APIENTRY glFlush (void);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
|
||||
GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
|
||||
GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
|
||||
GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers);
|
||||
GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
|
||||
GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
|
||||
GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
|
||||
GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
|
||||
GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
|
||||
GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const char* name);
|
||||
GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
|
||||
GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
|
||||
GL_APICALL GLenum GL_APIENTRY glGetError (void);
|
||||
GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
|
||||
GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, char* infolog);
|
||||
GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, char* source);
|
||||
GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
|
||||
GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const char* name);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void** pointer);
|
||||
GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
|
||||
GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
|
||||
GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
|
||||
GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
|
||||
GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels);
|
||||
GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
|
||||
GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
|
||||
GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_APICALL void GL_APIENTRY glShaderBinary (GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length);
|
||||
GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const char** string, const GLint* length);
|
||||
GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
|
||||
GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
|
||||
GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);
|
||||
GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
|
||||
GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels);
|
||||
GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x);
|
||||
GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x);
|
||||
GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y);
|
||||
GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y);
|
||||
GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);
|
||||
GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z);
|
||||
GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);
|
||||
GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v);
|
||||
GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||
GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||
GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||
GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
|
||||
GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __gl2_h_ */
|
||||
@@ -0,0 +1,389 @@
|
||||
#ifndef __gl2ext_h_
|
||||
#define __gl2ext_h_
|
||||
|
||||
/* $Id: gl2ext.h 5767 2008-06-02 17:44:20Z benj $ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.0 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: The application programming interfaces
|
||||
** established by SGI in conjunction with the Original Code are The
|
||||
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
||||
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
||||
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
||||
** Window System(R) (Version 1.3), released October 19, 1998. This software
|
||||
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
*/
|
||||
|
||||
#ifndef GL_APIENTRYP
|
||||
# define GL_APIENTRYP GL_APIENTRY*
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* OES extension tokens
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_OES_compressed_ETC1_RGB8_texture */
|
||||
#ifndef GL_OES_compressed_ETC1_RGB8_texture
|
||||
#define GL_ETC1_RGB8_OES 0x8D64
|
||||
#endif
|
||||
|
||||
/* GL_OES_compressed_paletted_texture */
|
||||
#ifndef GL_OES_compressed_paletted_texture
|
||||
#define GL_PALETTE4_RGB8_OES 0x8B90
|
||||
#define GL_PALETTE4_RGBA8_OES 0x8B91
|
||||
#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
|
||||
#define GL_PALETTE4_RGBA4_OES 0x8B93
|
||||
#define GL_PALETTE4_RGB5_A1_OES 0x8B94
|
||||
#define GL_PALETTE8_RGB8_OES 0x8B95
|
||||
#define GL_PALETTE8_RGBA8_OES 0x8B96
|
||||
#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
|
||||
#define GL_PALETTE8_RGBA4_OES 0x8B98
|
||||
#define GL_PALETTE8_RGB5_A1_OES 0x8B99
|
||||
#endif
|
||||
|
||||
/* GL_OES_EGL_image */
|
||||
#ifndef GL_OES_EGL_image
|
||||
typedef void* GLeglImageOES;
|
||||
#endif
|
||||
|
||||
/* GL_OES_depth24 */
|
||||
#ifndef GL_OES_depth24
|
||||
#define GL_DEPTH_COMPONENT24_OES 0x81A6
|
||||
#endif
|
||||
|
||||
/* GL_OES_depth32 */
|
||||
#ifndef GL_OES_depth32
|
||||
#define GL_DEPTH_COMPONENT32_OES 0x81A7
|
||||
#endif
|
||||
|
||||
/* GL_OES_depth_texture */
|
||||
/* No new tokens introduced by this extension. */
|
||||
|
||||
/* GL_OES_mapbuffer */
|
||||
#ifndef GL_OES_mapbuffer
|
||||
/* GL_READ_ONLY and GL_READ_WRITE not supported */
|
||||
#define GL_WRITE_ONLY_OES 0x88B9
|
||||
#define GL_BUFFER_ACCESS_OES 0x88BB
|
||||
#define GL_BUFFER_MAPPED_OES 0x88BC
|
||||
#define GL_BUFFER_MAP_POINTER_OES 0x88BD
|
||||
#endif
|
||||
|
||||
/* GL_OES_packed_depth_stencil */
|
||||
#ifndef GL_OES_packed_depth_stencil
|
||||
#define GL_DEPTH_STENCIL_OES 0x84F9
|
||||
#define GL_UNSIGNED_INT_24_8_OES 0x84FA
|
||||
#define GL_DEPTH24_STENCIL8_OES 0x88F0
|
||||
#endif
|
||||
|
||||
/* GL_OES_rgb8_rgba8 */
|
||||
#ifndef GL_OES_rgb8_rgba8
|
||||
#define GL_RGB8_OES 0x8051
|
||||
#define GL_RGBA8_OES 0x8058
|
||||
#endif
|
||||
|
||||
/* GL_OES_standard_derivatives */
|
||||
#ifndef GL_OES_standard_derivatives
|
||||
#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
|
||||
#endif
|
||||
|
||||
/* GL_OES_stencil1 */
|
||||
#ifndef GL_OES_stencil1
|
||||
#define GL_STENCIL_INDEX1_OES 0x8D46
|
||||
#endif
|
||||
|
||||
/* GL_OES_stencil4 */
|
||||
#ifndef GL_OES_stencil4
|
||||
#define GL_STENCIL_INDEX4_OES 0x8D47
|
||||
#endif
|
||||
|
||||
/* GL_OES_texture3D */
|
||||
#ifndef GL_OES_texture3D
|
||||
#define GL_TEXTURE_WRAP_R_OES 0x8072
|
||||
#define GL_TEXTURE_3D_OES 0x806F
|
||||
#define GL_TEXTURE_BINDING_3D_OES 0x806A
|
||||
#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073
|
||||
#define GL_SAMPLER_3D_OES 0x8B5F
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4
|
||||
#endif
|
||||
|
||||
/* GL_OES_texture_half_float */
|
||||
#ifndef GL_OES_texture_half_float
|
||||
#define GL_HALF_FLOAT_OES 0x8D61
|
||||
#endif
|
||||
|
||||
/* GL_OES_vertex_half_float */
|
||||
/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */
|
||||
|
||||
/* GL_OES_vertex_type_10_10_10_2 */
|
||||
#ifndef GL_OES_vertex_type_10_10_10_2
|
||||
#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6
|
||||
#define GL_INT_10_10_10_2_OES 0x8DF7
|
||||
#endif
|
||||
|
||||
/* GL_OES_get_program_binary */
|
||||
#ifndef GL_OES_get_program_binary
|
||||
#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
|
||||
#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
|
||||
#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF
|
||||
#endif
|
||||
|
||||
/* GL_AMD_program_binary_Z400 */
|
||||
#ifndef GL_AMD_program_binary_Z400
|
||||
#define GL_Z400_BINARY_AMD 0x8740
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* AMD extension tokens
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_AMD_compressed_3DC_texture */
|
||||
#ifndef GL_AMD_compressed_3DC_texture
|
||||
#define GL_3DC_X_AMD 0x87F9
|
||||
#define GL_3DC_XY_AMD 0x87FA
|
||||
#endif
|
||||
|
||||
/* GL_AMD_compressed_ATC_texture */
|
||||
#ifndef GL_AMD_compressed_ATC_texture
|
||||
#define GL_ATC_RGB_AMD 0x8C92
|
||||
#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
|
||||
#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* EXT extension tokens
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_EXT_texture_filter_anisotropic */
|
||||
#ifndef GL_EXT_texture_filter_anisotropic
|
||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
|
||||
#endif
|
||||
|
||||
/* GL_EXT_texture_type_2_10_10_10_REV */
|
||||
#ifndef GL_EXT_texture_type_2_10_10_10_REV
|
||||
#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* OES extension functions
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_OES_compressed_ETC1_RGB8_texture */
|
||||
#ifndef GL_OES_compressed_ETC1_RGB8_texture
|
||||
#define GL_OES_compressed_ETC1_RGB8_texture 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_compressed_paletted_texture */
|
||||
#ifndef GL_OES_compressed_paletted_texture
|
||||
#define GL_OES_compressed_paletted_texture 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_EGL_image */
|
||||
#ifndef GL_OES_EGL_image
|
||||
#define GL_OES_EGL_image 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
|
||||
GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
|
||||
typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
|
||||
#endif
|
||||
|
||||
/* GL_OES_depth24 */
|
||||
#ifndef GL_OES_depth24
|
||||
#define GL_OES_depth24 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_depth32 */
|
||||
#ifndef GL_OES_depth32
|
||||
#define GL_OES_depth32 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_depth_texture */
|
||||
#ifndef GL_OES_depth_texture
|
||||
#define GL_OES_depth_texture 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_element_index_uint */
|
||||
#ifndef GL_OES_element_index_uint
|
||||
#define GL_OES_element_index_uint 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_fbo_render_mipmap */
|
||||
#ifndef GL_OES_fbo_render_mipmap
|
||||
#define GL_OES_fbo_render_mipmap 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_fragment_precision_high */
|
||||
#ifndef GL_OES_fragment_precision_high
|
||||
#define GL_OES_fragment_precision_high 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_mapbuffer */
|
||||
#ifndef GL_OES_mapbuffer
|
||||
#define GL_OES_mapbuffer 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
|
||||
GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
|
||||
GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void** params);
|
||||
#endif
|
||||
typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void** params);
|
||||
#endif
|
||||
|
||||
/* GL_OES_packed_depth_stencil */
|
||||
#ifndef GL_OES_packed_depth_stencil
|
||||
#define GL_OES_packed_depth_stencil 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_rgb8_rgba8 */
|
||||
#ifndef GL_OES_rgb8_rgba8
|
||||
#define GL_OES_rgb8_rgba8 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_standard_derivatives */
|
||||
#ifndef GL_OES_standard_derivatives
|
||||
#define GL_OES_standard_derivatives 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_stencil1 */
|
||||
#ifndef GL_OES_stencil1
|
||||
#define GL_OES_stencil1 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_stencil4 */
|
||||
#ifndef GL_OES_stencil4
|
||||
#define GL_OES_stencil4 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_texture_3D */
|
||||
#ifndef GL_OES_texture_3D
|
||||
#define GL_OES_texture_3D 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels);
|
||||
GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels);
|
||||
GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
|
||||
#endif
|
||||
|
||||
/* GL_OES_texture_float_linear */
|
||||
#ifndef GL_OES_texture_float_linear
|
||||
#define GL_OES_texture_float_linear 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_texture_half_float_linear */
|
||||
#ifndef GL_OES_texture_half_float_linear
|
||||
#define GL_OES_texture_half_float_linear 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_texture_float */
|
||||
#ifndef GL_OES_texture_float
|
||||
#define GL_OES_texture_float 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_texture_half_float */
|
||||
#ifndef GL_OES_texture_half_float
|
||||
#define GL_OES_texture_half_float 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_texture_npot */
|
||||
#ifndef GL_OES_texture_npot
|
||||
#define GL_OES_texture_npot 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_vertex_half_float */
|
||||
#ifndef GL_OES_vertex_half_float
|
||||
#define GL_OES_vertex_half_float 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_vertex_type_10_10_10_2 */
|
||||
#ifndef GL_OES_vertex_type_10_10_10_2
|
||||
#define GL_OES_vertex_type_10_10_10_2 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_get_program_binary */
|
||||
#ifndef GL_OES_get_program_binary
|
||||
#define GL_OES_get_program_binary 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
|
||||
GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* AMD extension functions
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_AMD_compressed_3DC_texture */
|
||||
#ifndef GL_AMD_compressed_3DC_texture
|
||||
#define GL_AMD_compressed_3DC_texture 1
|
||||
#endif
|
||||
|
||||
/* GL_AMD_compressed_ATC_texture */
|
||||
#ifndef GL_AMD_compressed_ATC_texture
|
||||
#define GL_AMD_compressed_ATC_texture 1
|
||||
#endif
|
||||
|
||||
/* GL_AMD_program_binary_Z400 */
|
||||
#ifndef GL_AMD_program_binary_Z400
|
||||
#define GL_AMD_program_binary_Z400 1
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* EXT extension functions
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_EXT_texture_filter_anisotropic */
|
||||
#ifndef GL_EXT_texture_filter_anisotropic
|
||||
#define GL_EXT_texture_filter_anisotropic 1
|
||||
#endif
|
||||
|
||||
/* GL_EXT_texture_type_2_10_10_10_REV */
|
||||
#ifndef GL_EXT_texture_type_2_10_10_10_REV
|
||||
#define GL_EXT_texture_type_2_10_10_10_REV 1
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __gl2ext_h_ */
|
||||
@@ -0,0 +1,72 @@
|
||||
#ifndef __gl2platform_h_
|
||||
#define __gl2platform_h_
|
||||
|
||||
/* $Id: gl2platform.h 4532 2007-11-26 11:12:44Z markc $ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.0 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: The application programming interfaces
|
||||
** established by SGI in conjunction with the Original Code are The
|
||||
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
||||
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
||||
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
||||
** Window System(R) (Version 1.3), released October 19, 1998. This software
|
||||
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of GL_APICALL and GL_APIENTRY
|
||||
*-----------------------------------------------------------------------*/
|
||||
|
||||
#if defined(_WIN32) || defined(__VC32__) /* Win32 */
|
||||
# if defined (_DLL_EXPORTS)
|
||||
# define GL_APICALL __declspec(dllexport)
|
||||
# else
|
||||
# define GL_APICALL __declspec(dllimport)
|
||||
# endif
|
||||
#elif defined (__ARMCC_VERSION) /* ADS */
|
||||
# define GL_APICALL
|
||||
#elif defined (__SYMBIAN32__) && defined (__GCC32__) /* Symbian GCC */
|
||||
# define GL_APICALL __declspec(dllexport)
|
||||
#elif defined (__GNUC__) /* GCC dependencies (kludge) */
|
||||
# define GL_APICALL
|
||||
#endif
|
||||
|
||||
#if !defined (GL_APICALL)
|
||||
# error Unsupported platform!
|
||||
#endif
|
||||
|
||||
#define GL_APIENTRY
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __gl2platform_h_ */
|
||||
@@ -118,35 +118,35 @@ extfuncs.h: $(TOP)/progs/util/extfuncs.h
|
||||
|
||||
|
||||
reflect: reflect.o showbuffer.o readtex.o
|
||||
$(CC) reflect.o showbuffer.o readtex.o $(APP_LIB_DEPS) -o $@
|
||||
$(CC) reflect.o showbuffer.o readtex.o $(APP_LIB_DEPS) $(ARCH_FLAGS) -o $@
|
||||
|
||||
reflect.o: reflect.c showbuffer.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) reflect.c
|
||||
|
||||
|
||||
shadowtex: shadowtex.o showbuffer.o
|
||||
$(CC) shadowtex.o showbuffer.o $(APP_LIB_DEPS) -o $@
|
||||
$(CC) shadowtex.o showbuffer.o $(APP_LIB_DEPS) $(ARCH_FLAGS) -o $@
|
||||
|
||||
shadowtex.o: shadowtex.c showbuffer.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) shadowtex.c
|
||||
|
||||
|
||||
gloss: gloss.o trackball.o readtex.o
|
||||
$(CC) gloss.o trackball.o readtex.o $(APP_LIB_DEPS) -o $@
|
||||
$(CC) gloss.o trackball.o readtex.o $(APP_LIB_DEPS) $(ARCH_FLAGS) -o $@
|
||||
|
||||
gloss.o: gloss.c trackball.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) gloss.c
|
||||
|
||||
|
||||
engine: engine.o trackball.o readtex.o
|
||||
$(CC) engine.o trackball.o readtex.o $(APP_LIB_DEPS) -o $@
|
||||
$(CC) engine.o trackball.o readtex.o $(APP_LIB_DEPS) $(ARCH_FLAGS) -o $@
|
||||
|
||||
engine.o: engine.c trackball.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) engine.c
|
||||
|
||||
|
||||
fslight: fslight.o
|
||||
$(CC) fslight.o $(APP_LIB_DEPS) -o $@
|
||||
$(CC) fslight.o $(APP_LIB_DEPS) $(ARCH_FLAGS) -o $@
|
||||
|
||||
fslight.o: fslight.c extfuncs.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) fslight.c
|
||||
|
||||
@@ -3,3 +3,6 @@ demo2
|
||||
demo3
|
||||
eglgears
|
||||
eglinfo
|
||||
peglgears
|
||||
xeglgears
|
||||
xegl_tri
|
||||
|
||||
+25
-3
@@ -13,7 +13,10 @@ PROGRAMS = \
|
||||
demo2 \
|
||||
demo3 \
|
||||
eglinfo \
|
||||
eglgears
|
||||
eglgears \
|
||||
peglgears \
|
||||
xeglgears \
|
||||
xegl_tri
|
||||
|
||||
|
||||
.c.o:
|
||||
@@ -58,6 +61,25 @@ eglgears: eglgears.o $(TOP)/$(LIB_DIR)/libEGL.so
|
||||
eglgears.o: eglgears.c $(HEADERS)
|
||||
$(CC) -c $(CFLAGS) -I$(TOP)/include eglgears.c
|
||||
|
||||
peglgears: peglgears.o $(TOP)/$(LIB_DIR)/libEGL.so
|
||||
$(CC) $(CFLAGS) peglgears.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
|
||||
|
||||
peglgears.o: peglgears.c $(HEADERS)
|
||||
$(CC) -c $(CFLAGS) -I$(TOP)/include peglgears.c
|
||||
|
||||
xeglgears: xeglgears.o $(TOP)/$(LIB_DIR)/libEGL.so
|
||||
$(CC) $(CFLAGS) xeglgears.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
|
||||
|
||||
xeglgears.o: xeglgears.c $(HEADERS)
|
||||
$(CC) -c $(CFLAGS) -I$(TOP)/include xeglgears.c
|
||||
|
||||
|
||||
xegl_tri: xegl_tri.o $(TOP)/$(LIB_DIR)/libEGL.so
|
||||
$(CC) $(CFLAGS) xegl_tri.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
|
||||
|
||||
xegl_tri.o: xegl_tri.c $(HEADERS)
|
||||
$(CC) -c $(CFLAGS) -I$(TOP)/include xegl_tri.c
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.o *~
|
||||
@@ -65,7 +87,7 @@ clean:
|
||||
rm -f $(PROGRAMS)
|
||||
|
||||
run:
|
||||
LD_LIBRARY_PATH=$(TOP)/lib ./eglgears
|
||||
LD_LIBRARY_PATH=$(TOP)/lib ./peglgears
|
||||
|
||||
debug:
|
||||
LD_LIBRARY_PATH=$(TOP)/lib gdb ./eglgears
|
||||
LD_LIBRARY_PATH=$(TOP)/lib gdb ./peglgears
|
||||
|
||||
+5
-2
@@ -2,7 +2,10 @@
|
||||
* Exercise EGL API functions
|
||||
*/
|
||||
|
||||
#include <GLES/egl.h>
|
||||
#define EGL_EGLEXT_PROTOTYPES
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -102,7 +105,7 @@ main(int argc, char *argv[])
|
||||
/*
|
||||
EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
*/
|
||||
EGLDisplay d = eglGetDisplay("!EGL_i915");
|
||||
EGLDisplay d = eglGetDisplay((EGLNativeDisplayType) "!EGL_i915");
|
||||
assert(d);
|
||||
|
||||
if (!eglInitialize(d, &maj, &min)) {
|
||||
|
||||
+39
-20
@@ -2,35 +2,54 @@
|
||||
* Exercise EGL API functions
|
||||
*/
|
||||
|
||||
#define EGL_EGLEXT_PROTOTYPES
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <GLES/egl.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#include <GLES/gl.h>
|
||||
|
||||
/*#define FRONTBUFFER*/
|
||||
|
||||
static void _subset_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
|
||||
static void _subset_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2,
|
||||
GLfloat r, GLfloat g, GLfloat b)
|
||||
{
|
||||
glBegin( GL_QUADS );
|
||||
glVertex2f( x1, y1 );
|
||||
glVertex2f( x2, y1 );
|
||||
glVertex2f( x2, y2 );
|
||||
glVertex2f( x1, y2 );
|
||||
glEnd();
|
||||
GLfloat v[4][2], c[4][4];
|
||||
int i;
|
||||
|
||||
v[0][0] = x1; v[0][1] = y1;
|
||||
v[1][0] = x2; v[1][1] = y1;
|
||||
v[2][0] = x2; v[2][1] = y2;
|
||||
v[3][0] = x1; v[3][1] = y2;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
c[i][0] = r;
|
||||
c[i][1] = g;
|
||||
c[i][2] = b;
|
||||
c[i][3] = 1.0;
|
||||
}
|
||||
|
||||
glVertexPointer(2, GL_FLOAT, 0, v);
|
||||
glColorPointer(4, GL_FLOAT, 0, v);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
|
||||
static void redraw(EGLDisplay dpy, EGLSurface surf, int rot)
|
||||
{
|
||||
printf("Redraw event\n");
|
||||
GLfloat r, g, b;
|
||||
|
||||
#ifdef FRONTBUFFER
|
||||
glDrawBuffer( GL_FRONT );
|
||||
#else
|
||||
glDrawBuffer( GL_BACK );
|
||||
#endif
|
||||
printf("Redraw event\n");
|
||||
|
||||
glClearColor( rand()/(float)RAND_MAX,
|
||||
rand()/(float)RAND_MAX,
|
||||
@@ -39,13 +58,14 @@ static void redraw(EGLDisplay dpy, EGLSurface surf, int rot)
|
||||
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
glColor3f( rand()/(float)RAND_MAX,
|
||||
rand()/(float)RAND_MAX,
|
||||
rand()/(float)RAND_MAX );
|
||||
r = rand()/(float)RAND_MAX;
|
||||
g = rand()/(float)RAND_MAX;
|
||||
b = rand()/(float)RAND_MAX;
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(rot, 0, 0, 1);
|
||||
glScalef(.5, .5, .5);
|
||||
_subset_Rectf( -1, -1, 1, 1 );
|
||||
_subset_Rectf( -1, -1, 1, 1, r, g, b );
|
||||
glPopMatrix();
|
||||
|
||||
#ifdef FRONTBUFFER
|
||||
@@ -102,7 +122,7 @@ main(int argc, char *argv[])
|
||||
/*
|
||||
EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
*/
|
||||
EGLDisplay d = eglGetDisplay("!EGL_i915");
|
||||
EGLDisplay d = eglGetDisplay((EGLNativeDisplayType) "!EGL_i915");
|
||||
assert(d);
|
||||
|
||||
if (!eglInitialize(d, &maj, &min)) {
|
||||
@@ -161,7 +181,6 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
glViewport(0, 0, 1024, 768);
|
||||
glDrawBuffer( GL_FRONT );
|
||||
|
||||
glClearColor( 0,
|
||||
1.0,
|
||||
|
||||
+5
-1
@@ -2,7 +2,11 @@
|
||||
* Exercise EGL API functions
|
||||
*/
|
||||
|
||||
#include <GLES/egl.h>
|
||||
#define EGL_EGLEXT_PROTOTYPES
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#include <GL/gl.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -27,13 +27,16 @@
|
||||
* Program runs for 5 seconds then exits, outputing framerate to console
|
||||
*/
|
||||
|
||||
#define EGL_EGLEXT_PROTOTYPES
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GLES/egl.h>
|
||||
#include <assert.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
#define MAX_CONFIGS 10
|
||||
#define MAX_MODES 100
|
||||
@@ -385,7 +388,7 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* DBR : Create EGL context/surface etc */
|
||||
d = eglGetDisplay("!EGL_i915");
|
||||
d = eglGetDisplay((EGLNativeDisplayType)"!EGL_i915");
|
||||
assert(d);
|
||||
|
||||
if (!eglInitialize(d, &maj, &min)) {
|
||||
|
||||
+11
-10
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <GLES/egl.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -48,8 +48,8 @@ PrintConfigs(EGLDisplay d)
|
||||
eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
|
||||
|
||||
printf("Configurations:\n");
|
||||
printf(" bf lv d st colorbuffer dp st supported\n");
|
||||
printf(" id sz l b ro r g b a th cl surfaces \n");
|
||||
printf(" bf lv d st colorbuffer dp st vis supported\n");
|
||||
printf(" id sz l b ro r g b a th cl id surfaces \n");
|
||||
printf("---------------------------------------------------\n");
|
||||
for (i = 0; i < numConfigs; i++) {
|
||||
EGLint id, size, level;
|
||||
@@ -57,6 +57,7 @@ PrintConfigs(EGLDisplay d)
|
||||
EGLint depth, stencil;
|
||||
EGLint surfaces;
|
||||
EGLint doubleBuf = 1, stereo = 0;
|
||||
EGLint vid;
|
||||
char surfString[100] = "";
|
||||
|
||||
eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id);
|
||||
@@ -69,6 +70,7 @@ PrintConfigs(EGLDisplay d)
|
||||
eglGetConfigAttrib(d, configs[i], EGL_ALPHA_SIZE, &alpha);
|
||||
eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth);
|
||||
eglGetConfigAttrib(d, configs[i], EGL_STENCIL_SIZE, &stencil);
|
||||
eglGetConfigAttrib(d, configs[i], EGL_NATIVE_VISUAL_ID, &vid);
|
||||
eglGetConfigAttrib(d, configs[i], EGL_SURFACE_TYPE, &surfaces);
|
||||
|
||||
if (surfaces & EGL_WINDOW_BIT)
|
||||
@@ -84,12 +86,12 @@ PrintConfigs(EGLDisplay d)
|
||||
if (strlen(surfString) > 0)
|
||||
surfString[strlen(surfString) - 1] = 0;
|
||||
|
||||
printf("0x%02x %2d %2d %c %c %2d %2d %2d %2d %2d %2d %-12s\n",
|
||||
printf("0x%02x %2d %2d %c %c %2d %2d %2d %2d %2d %2d 0x%02x %-12s\n",
|
||||
id, size, level,
|
||||
doubleBuf ? 'y' : '.',
|
||||
stereo ? 'y' : '.',
|
||||
red, green, blue, alpha,
|
||||
depth, stencil, surfString);
|
||||
depth, stencil, vid, surfString);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,8 +141,7 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int maj, min;
|
||||
/*EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);*/
|
||||
EGLDisplay d = eglGetDisplay("!EGL_i915");
|
||||
EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
|
||||
if (!eglInitialize(d, &maj, &min)) {
|
||||
printf("eglinfo: eglInitialize failed\n");
|
||||
@@ -150,14 +151,14 @@ main(int argc, char *argv[])
|
||||
printf("EGL API version: %d.%d\n", maj, min);
|
||||
printf("EGL vendor string: %s\n", eglQueryString(d, EGL_VENDOR));
|
||||
printf("EGL version string: %s\n", eglQueryString(d, EGL_VERSION));
|
||||
#ifdef EGL_VERSION_1_2
|
||||
printf("EGL client APIs: %s\n", eglQueryString(d, EGL_CLIENT_APIS));
|
||||
#endif
|
||||
printf("EGL extensions string:\n");
|
||||
printf(" %s\n", eglQueryString(d, EGL_EXTENSIONS));
|
||||
printf("\n");
|
||||
|
||||
PrintConfigs(d);
|
||||
|
||||
printf("\n");
|
||||
|
||||
PrintModes(d);
|
||||
|
||||
eglTerminate(d);
|
||||
|
||||
@@ -0,0 +1,449 @@
|
||||
/*
|
||||
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* 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 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
|
||||
* BRIAN PAUL 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This is a port of the infamous "glxgears" demo to straight EGL
|
||||
* Port by Dane Rushton 10 July 2005
|
||||
*
|
||||
* No command line options.
|
||||
* Program runs for 5 seconds then exits, outputing framerate to console
|
||||
*/
|
||||
|
||||
#define EGL_EGLEXT_PROTOTYPES
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <GL/gl.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
#define MAX_CONFIGS 10
|
||||
#define MAX_MODES 100
|
||||
|
||||
#define BENCHMARK
|
||||
|
||||
#ifdef BENCHMARK
|
||||
|
||||
/* XXX this probably isn't very portable */
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* return current time (in seconds) */
|
||||
static double
|
||||
current_time(void)
|
||||
{
|
||||
struct timeval tv;
|
||||
#ifdef __VMS
|
||||
(void) gettimeofday(&tv, NULL );
|
||||
#else
|
||||
struct timezone tz;
|
||||
(void) gettimeofday(&tv, &tz);
|
||||
#endif
|
||||
return (double) tv.tv_sec + tv.tv_usec / 1000000.0;
|
||||
}
|
||||
|
||||
#else /*BENCHMARK*/
|
||||
|
||||
/* dummy */
|
||||
static double
|
||||
current_time(void)
|
||||
{
|
||||
/* update this function for other platforms! */
|
||||
static double t = 0.0;
|
||||
static int warn = 1;
|
||||
if (warn) {
|
||||
fprintf(stderr, "Warning: current_time() not implemented!!\n");
|
||||
warn = 0;
|
||||
}
|
||||
return t += 1.0;
|
||||
}
|
||||
|
||||
#endif /*BENCHMARK*/
|
||||
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265
|
||||
#endif
|
||||
|
||||
|
||||
static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
|
||||
static GLint gear1, gear2, gear3;
|
||||
static GLfloat angle = 0.0;
|
||||
|
||||
#if 0
|
||||
static GLfloat eyesep = 5.0; /* Eye separation. */
|
||||
static GLfloat fix_point = 40.0; /* Fixation point distance. */
|
||||
static GLfloat left, right, asp; /* Stereo frustum params. */
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Draw a gear wheel. You'll probably want to call this function when
|
||||
* building a display list since we do a lot of trig here.
|
||||
*
|
||||
* Input: inner_radius - radius of hole at center
|
||||
* outer_radius - radius at center of teeth
|
||||
* width - width of gear
|
||||
* teeth - number of teeth
|
||||
* tooth_depth - depth of tooth
|
||||
*/
|
||||
static void
|
||||
gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
|
||||
GLint teeth, GLfloat tooth_depth)
|
||||
{
|
||||
GLint i;
|
||||
GLfloat r0, r1, r2;
|
||||
GLfloat angle, da;
|
||||
GLfloat u, v, len;
|
||||
|
||||
r0 = inner_radius;
|
||||
r1 = outer_radius - tooth_depth / 2.0;
|
||||
r2 = outer_radius + tooth_depth / 2.0;
|
||||
|
||||
da = 2.0 * M_PI / teeth / 4.0;
|
||||
|
||||
glShadeModel(GL_FLAT);
|
||||
|
||||
glNormal3f(0.0, 0.0, 1.0);
|
||||
|
||||
/* draw front face */
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
for (i = 0; i <= teeth; i++) {
|
||||
angle = i * 2.0 * M_PI / teeth;
|
||||
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
|
||||
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
|
||||
if (i < teeth) {
|
||||
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
|
||||
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
|
||||
width * 0.5);
|
||||
}
|
||||
}
|
||||
glEnd();
|
||||
|
||||
/* draw front sides of teeth */
|
||||
glBegin(GL_QUADS);
|
||||
da = 2.0 * M_PI / teeth / 4.0;
|
||||
for (i = 0; i < teeth; i++) {
|
||||
angle = i * 2.0 * M_PI / teeth;
|
||||
|
||||
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
|
||||
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
|
||||
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
|
||||
width * 0.5);
|
||||
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
|
||||
width * 0.5);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
glNormal3f(0.0, 0.0, -1.0);
|
||||
|
||||
/* draw back face */
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
for (i = 0; i <= teeth; i++) {
|
||||
angle = i * 2.0 * M_PI / teeth;
|
||||
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
|
||||
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
|
||||
if (i < teeth) {
|
||||
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
|
||||
-width * 0.5);
|
||||
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
|
||||
}
|
||||
}
|
||||
glEnd();
|
||||
|
||||
/* draw back sides of teeth */
|
||||
glBegin(GL_QUADS);
|
||||
da = 2.0 * M_PI / teeth / 4.0;
|
||||
for (i = 0; i < teeth; i++) {
|
||||
angle = i * 2.0 * M_PI / teeth;
|
||||
|
||||
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
|
||||
-width * 0.5);
|
||||
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
|
||||
-width * 0.5);
|
||||
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
|
||||
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
/* draw outward faces of teeth */
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
for (i = 0; i < teeth; i++) {
|
||||
angle = i * 2.0 * M_PI / teeth;
|
||||
|
||||
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
|
||||
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
|
||||
u = r2 * cos(angle + da) - r1 * cos(angle);
|
||||
v = r2 * sin(angle + da) - r1 * sin(angle);
|
||||
len = sqrt(u * u + v * v);
|
||||
u /= len;
|
||||
v /= len;
|
||||
glNormal3f(v, -u, 0.0);
|
||||
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
|
||||
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
|
||||
glNormal3f(cos(angle), sin(angle), 0.0);
|
||||
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
|
||||
width * 0.5);
|
||||
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
|
||||
-width * 0.5);
|
||||
u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
|
||||
v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
|
||||
glNormal3f(v, -u, 0.0);
|
||||
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
|
||||
width * 0.5);
|
||||
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
|
||||
-width * 0.5);
|
||||
glNormal3f(cos(angle), sin(angle), 0.0);
|
||||
}
|
||||
|
||||
glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
|
||||
glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5);
|
||||
|
||||
glEnd();
|
||||
|
||||
glShadeModel(GL_SMOOTH);
|
||||
|
||||
/* draw inside radius cylinder */
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
for (i = 0; i <= teeth; i++) {
|
||||
angle = i * 2.0 * M_PI / teeth;
|
||||
glNormal3f(-cos(angle), -sin(angle), 0.0);
|
||||
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
|
||||
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(view_rotx, 1.0, 0.0, 0.0);
|
||||
glRotatef(view_roty, 0.0, 1.0, 0.0);
|
||||
glRotatef(view_rotz, 0.0, 0.0, 1.0);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(-3.0, -2.0, 0.0);
|
||||
glRotatef(angle, 0.0, 0.0, 1.0);
|
||||
glCallList(gear1);
|
||||
glPopMatrix();
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(3.1, -2.0, 0.0);
|
||||
glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
|
||||
glCallList(gear2);
|
||||
glPopMatrix();
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(-3.1, 4.2, 0.0);
|
||||
glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
|
||||
glCallList(gear3);
|
||||
glPopMatrix();
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
/* new window size or exposure */
|
||||
static void
|
||||
reshape(int width, int height)
|
||||
{
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
|
||||
GLfloat h = (GLfloat) height / (GLfloat) width;
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -40.0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
init(void)
|
||||
{
|
||||
static GLfloat pos[4] = { 5.0, 5.0, 10.0, 0.0 };
|
||||
static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 };
|
||||
static GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 };
|
||||
static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 };
|
||||
|
||||
glLightfv(GL_LIGHT0, GL_POSITION, pos);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
/* make the gears */
|
||||
gear1 = glGenLists(1);
|
||||
glNewList(gear1, GL_COMPILE);
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
|
||||
gear(1.0, 4.0, 1.0, 20, 0.7);
|
||||
glEndList();
|
||||
|
||||
gear2 = glGenLists(1);
|
||||
glNewList(gear2, GL_COMPILE);
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
|
||||
gear(0.5, 2.0, 2.0, 10, 0.7);
|
||||
glEndList();
|
||||
|
||||
gear3 = glGenLists(1);
|
||||
glNewList(gear3, GL_COMPILE);
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
|
||||
gear(1.3, 2.0, 0.5, 10, 0.7);
|
||||
glEndList();
|
||||
|
||||
glEnable(GL_NORMALIZE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void run_gears(EGLDisplay dpy, EGLSurface surf, int ttr)
|
||||
{
|
||||
double st = current_time();
|
||||
double ct = st;
|
||||
int frames = 0;
|
||||
while (ct - st < ttr)
|
||||
{
|
||||
double tt = current_time();
|
||||
double dt = tt - ct;
|
||||
ct = tt;
|
||||
|
||||
/* advance rotation for next frame */
|
||||
angle += 70.0 * dt; /* 70 degrees per second */
|
||||
if (angle > 3600.0)
|
||||
angle -= 3600.0;
|
||||
|
||||
draw();
|
||||
|
||||
eglSwapBuffers(dpy, surf);
|
||||
|
||||
|
||||
frames++;
|
||||
}
|
||||
|
||||
GLfloat seconds = ct - st;
|
||||
GLfloat fps = frames / seconds;
|
||||
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, fps);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int major, minor;
|
||||
EGLContext ctx;
|
||||
EGLSurface surface;
|
||||
EGLConfig configs[MAX_CONFIGS];
|
||||
EGLint numConfigs, i;
|
||||
EGLBoolean b;
|
||||
EGLDisplay d;
|
||||
EGLint screenAttribs[10];
|
||||
GLboolean printInfo = GL_FALSE;
|
||||
EGLint width = 300, height = 300;
|
||||
|
||||
/* parse cmd line args */
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (strcmp(argv[i], "-info") == 0)
|
||||
{
|
||||
printInfo = GL_TRUE;
|
||||
}
|
||||
else
|
||||
printf("Warning: unknown parameter: %s\n", argv[i]);
|
||||
}
|
||||
|
||||
/* DBR : Create EGL context/surface etc */
|
||||
d = eglGetDisplay((EGLNativeDisplayType)"!EGL_i915");
|
||||
assert(d);
|
||||
|
||||
if (!eglInitialize(d, &major, &minor)) {
|
||||
printf("peglgears: eglInitialize failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("peglgears: EGL version = %d.%d\n", major, minor);
|
||||
printf("peglgears: EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
|
||||
|
||||
eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
|
||||
|
||||
eglBindAPI(EGL_OPENGL_API);
|
||||
|
||||
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
|
||||
if (ctx == EGL_NO_CONTEXT) {
|
||||
printf("peglgears: failed to create context\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* build up screenAttribs array */
|
||||
i = 0;
|
||||
screenAttribs[i++] = EGL_WIDTH;
|
||||
screenAttribs[i++] = width;
|
||||
screenAttribs[i++] = EGL_HEIGHT;
|
||||
screenAttribs[i++] = height;
|
||||
screenAttribs[i++] = EGL_NONE;
|
||||
|
||||
surface = eglCreatePbufferSurface(d, configs[0], screenAttribs);
|
||||
if (surface == EGL_NO_SURFACE) {
|
||||
printf("peglgears: failed to create pbuffer surface\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
b = eglMakeCurrent(d, surface, surface, ctx);
|
||||
if (!b) {
|
||||
printf("peglgears: make current failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (printInfo)
|
||||
{
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
|
||||
}
|
||||
|
||||
init();
|
||||
reshape(width, height);
|
||||
|
||||
glDrawBuffer( GL_BACK );
|
||||
|
||||
run_gears(d, surface, 5.0);
|
||||
|
||||
eglDestroySurface(d, surface);
|
||||
eglDestroyContext(d, ctx);
|
||||
eglTerminate(d);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,359 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* 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 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
|
||||
* BRIAN PAUL 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Draw a triangle with X/EGL.
|
||||
* Brian Paul
|
||||
* 3 June 2008
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <GL/gl.h> /* using full OpenGL for now */
|
||||
#include <GLES/egl.h>
|
||||
|
||||
|
||||
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
|
||||
|
||||
|
||||
static void
|
||||
draw(void)
|
||||
{
|
||||
static const GLfloat verts[3][2] = {
|
||||
{ -1, -1 },
|
||||
{ 1, -1 },
|
||||
{ 0, 1 }
|
||||
};
|
||||
static const GLfloat colors[3][3] = {
|
||||
{ 1, 0, 0 },
|
||||
{ 0, 1, 0 },
|
||||
{ 0, 0, 1 }
|
||||
};
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(view_rotx, 1, 0, 0);
|
||||
glRotatef(view_roty, 0, 1, 0);
|
||||
glRotatef(view_rotz, 0, 0, 1);
|
||||
|
||||
{
|
||||
glVertexPointer(2, GL_FLOAT, 0, verts);
|
||||
glColorPointer(3, GL_FLOAT, 0, colors);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
/* new window size or exposure */
|
||||
static void
|
||||
reshape(int width, int height)
|
||||
{
|
||||
GLfloat ar = (GLfloat) width / (GLfloat) height;
|
||||
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -10.0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
init(void)
|
||||
{
|
||||
glClearColor(0.4, 0.4, 0.4, 0.0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create an RGB, double-buffered X window.
|
||||
* Return the window and context handles.
|
||||
*/
|
||||
static void
|
||||
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
|
||||
const char *name,
|
||||
int x, int y, int width, int height,
|
||||
Window *winRet,
|
||||
EGLContext *ctxRet,
|
||||
EGLSurface *surfRet)
|
||||
{
|
||||
static const EGLint attribs[] = {
|
||||
EGL_RED_SIZE, 1,
|
||||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_DEPTH_SIZE, 1,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
int scrnum;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
Window root;
|
||||
Window win;
|
||||
XVisualInfo *visInfo, visTemplate;
|
||||
int num_visuals;
|
||||
EGLContext ctx;
|
||||
EGLConfig config;
|
||||
EGLint num_configs;
|
||||
EGLint vid;
|
||||
|
||||
scrnum = DefaultScreen( x_dpy );
|
||||
root = RootWindow( x_dpy, scrnum );
|
||||
|
||||
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
|
||||
printf("Error: couldn't get an EGL visual config\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
assert(config);
|
||||
assert(num_configs > 0);
|
||||
|
||||
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
|
||||
printf("Error: eglGetConfigAttrib() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* The X window visual must match the EGL config */
|
||||
visTemplate.visualid = vid;
|
||||
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
|
||||
if (!visInfo) {
|
||||
printf("Error: couldn't get X visual\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* window attributes */
|
||||
attr.background_pixel = 0;
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
|
||||
0, visInfo->depth, InputOutput,
|
||||
visInfo->visual, mask, &attr );
|
||||
|
||||
/* set hints and properties */
|
||||
{
|
||||
XSizeHints sizehints;
|
||||
sizehints.x = x;
|
||||
sizehints.y = y;
|
||||
sizehints.width = width;
|
||||
sizehints.height = height;
|
||||
sizehints.flags = USSize | USPosition;
|
||||
XSetNormalHints(x_dpy, win, &sizehints);
|
||||
XSetStandardProperties(x_dpy, win, name, name,
|
||||
None, (char **)NULL, 0, &sizehints);
|
||||
}
|
||||
|
||||
eglBindAPI(EGL_OPENGL_API);
|
||||
|
||||
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
|
||||
if (!ctx) {
|
||||
printf("Error: glXCreateContext failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
|
||||
|
||||
if (!*surfRet) {
|
||||
printf("Error: eglCreateWindowSurface failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
XFree(visInfo);
|
||||
|
||||
*winRet = win;
|
||||
*ctxRet = ctx;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
event_loop(Display *dpy, Window win,
|
||||
EGLDisplay egl_dpy, EGLSurface egl_surf)
|
||||
{
|
||||
while (1) {
|
||||
int redraw = 0;
|
||||
XEvent event;
|
||||
|
||||
XNextEvent(dpy, &event);
|
||||
|
||||
switch (event.type) {
|
||||
case Expose:
|
||||
redraw = 1;
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
reshape(event.xconfigure.width, event.xconfigure.height);
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
char buffer[10];
|
||||
int r, code;
|
||||
code = XLookupKeysym(&event.xkey, 0);
|
||||
if (code == XK_Left) {
|
||||
view_roty += 5.0;
|
||||
}
|
||||
else if (code == XK_Right) {
|
||||
view_roty -= 5.0;
|
||||
}
|
||||
else if (code == XK_Up) {
|
||||
view_rotx += 5.0;
|
||||
}
|
||||
else if (code == XK_Down) {
|
||||
view_rotx -= 5.0;
|
||||
}
|
||||
else {
|
||||
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
|
||||
NULL, NULL);
|
||||
if (buffer[0] == 27) {
|
||||
/* escape */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
redraw = 1;
|
||||
break;
|
||||
default:
|
||||
; /*no-op*/
|
||||
}
|
||||
|
||||
if (redraw) {
|
||||
draw();
|
||||
eglSwapBuffers(egl_dpy, egl_surf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
printf("Usage:\n");
|
||||
printf(" -display <displayname> set the display to run on\n");
|
||||
printf(" -info display OpenGL renderer info\n");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
const int winWidth = 300, winHeight = 300;
|
||||
Display *x_dpy;
|
||||
Window win;
|
||||
EGLSurface egl_surf;
|
||||
EGLContext egl_ctx;
|
||||
EGLDisplay egl_dpy;
|
||||
char *dpyName = NULL;
|
||||
GLboolean printInfo = GL_FALSE;
|
||||
EGLint egl_major, egl_minor;
|
||||
int i;
|
||||
const char *s;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-display") == 0) {
|
||||
dpyName = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "-info") == 0) {
|
||||
printInfo = GL_TRUE;
|
||||
}
|
||||
else {
|
||||
usage();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
x_dpy = XOpenDisplay(dpyName);
|
||||
if (!x_dpy) {
|
||||
printf("Error: couldn't open display %s\n",
|
||||
dpyName ? dpyName : getenv("DISPLAY"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
egl_dpy = eglGetDisplay(x_dpy);
|
||||
if (!egl_dpy) {
|
||||
printf("Error: eglGetDisplay() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
|
||||
printf("Error: eglInitialize() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VERSION);
|
||||
printf("EGL_VERSION = %s\n", s);
|
||||
|
||||
make_x_window(x_dpy, egl_dpy,
|
||||
"xegl_tri", 0, 0, winWidth, winHeight,
|
||||
&win, &egl_ctx, &egl_surf);
|
||||
|
||||
XMapWindow(x_dpy, win);
|
||||
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
|
||||
printf("Error: eglMakeCurrent() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (printInfo) {
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
/* Set initial projection/viewing transformation.
|
||||
* We can't be sure we'll get a ConfigureNotify event when the window
|
||||
* first appears.
|
||||
*/
|
||||
reshape(winWidth, winHeight);
|
||||
|
||||
event_loop(x_dpy, win, egl_dpy, egl_surf);
|
||||
|
||||
eglDestroyContext(egl_dpy, egl_ctx);
|
||||
eglDestroySurface(egl_dpy, egl_surf);
|
||||
eglTerminate(egl_dpy);
|
||||
|
||||
|
||||
XDestroyWindow(x_dpy, win);
|
||||
XCloseDisplay(x_dpy);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,608 @@
|
||||
/*
|
||||
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* 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 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
|
||||
* BRIAN PAUL 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Ported to X/EGL/GLES. XXX Actually, uses full OpenGL ATM.
|
||||
* Brian Paul
|
||||
* 30 May 2008
|
||||
*/
|
||||
|
||||
/*
|
||||
* Command line options:
|
||||
* -info print GL implementation information
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <GL/gl.h>
|
||||
#include <EGL/egl.h>
|
||||
|
||||
|
||||
#define BENCHMARK
|
||||
|
||||
#ifdef BENCHMARK
|
||||
|
||||
/* XXX this probably isn't very portable */
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* return current time (in seconds) */
|
||||
static double
|
||||
current_time(void)
|
||||
{
|
||||
struct timeval tv;
|
||||
#ifdef __VMS
|
||||
(void) gettimeofday(&tv, NULL );
|
||||
#else
|
||||
struct timezone tz;
|
||||
(void) gettimeofday(&tv, &tz);
|
||||
#endif
|
||||
return (double) tv.tv_sec + tv.tv_usec / 1000000.0;
|
||||
}
|
||||
|
||||
#else /*BENCHMARK*/
|
||||
|
||||
/* dummy */
|
||||
static double
|
||||
current_time(void)
|
||||
{
|
||||
/* update this function for other platforms! */
|
||||
static double t = 0.0;
|
||||
static int warn = 1;
|
||||
if (warn) {
|
||||
fprintf(stderr, "Warning: current_time() not implemented!!\n");
|
||||
warn = 0;
|
||||
}
|
||||
return t += 1.0;
|
||||
}
|
||||
|
||||
#endif /*BENCHMARK*/
|
||||
|
||||
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265
|
||||
#endif
|
||||
|
||||
|
||||
static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
|
||||
static GLint gear1, gear2, gear3;
|
||||
static GLfloat angle = 0.0;
|
||||
|
||||
static GLboolean fullscreen = GL_FALSE; /* Create a single fullscreen window */
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Draw a gear wheel. You'll probably want to call this function when
|
||||
* building a display list since we do a lot of trig here.
|
||||
*
|
||||
* Input: inner_radius - radius of hole at center
|
||||
* outer_radius - radius at center of teeth
|
||||
* width - width of gear
|
||||
* teeth - number of teeth
|
||||
* tooth_depth - depth of tooth
|
||||
*/
|
||||
static void
|
||||
gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
|
||||
GLint teeth, GLfloat tooth_depth)
|
||||
{
|
||||
GLint i;
|
||||
GLfloat r0, r1, r2;
|
||||
GLfloat angle, da;
|
||||
GLfloat u, v, len;
|
||||
|
||||
r0 = inner_radius;
|
||||
r1 = outer_radius - tooth_depth / 2.0;
|
||||
r2 = outer_radius + tooth_depth / 2.0;
|
||||
|
||||
da = 2.0 * M_PI / teeth / 4.0;
|
||||
|
||||
glShadeModel(GL_FLAT);
|
||||
|
||||
glNormal3f(0.0, 0.0, 1.0);
|
||||
|
||||
/* draw front face */
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
for (i = 0; i <= teeth; i++) {
|
||||
angle = i * 2.0 * M_PI / teeth;
|
||||
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
|
||||
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
|
||||
if (i < teeth) {
|
||||
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
|
||||
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
|
||||
width * 0.5);
|
||||
}
|
||||
}
|
||||
glEnd();
|
||||
|
||||
/* draw front sides of teeth */
|
||||
glBegin(GL_QUADS);
|
||||
da = 2.0 * M_PI / teeth / 4.0;
|
||||
for (i = 0; i < teeth; i++) {
|
||||
angle = i * 2.0 * M_PI / teeth;
|
||||
|
||||
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
|
||||
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
|
||||
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
|
||||
width * 0.5);
|
||||
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
|
||||
width * 0.5);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
glNormal3f(0.0, 0.0, -1.0);
|
||||
|
||||
/* draw back face */
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
for (i = 0; i <= teeth; i++) {
|
||||
angle = i * 2.0 * M_PI / teeth;
|
||||
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
|
||||
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
|
||||
if (i < teeth) {
|
||||
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
|
||||
-width * 0.5);
|
||||
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
|
||||
}
|
||||
}
|
||||
glEnd();
|
||||
|
||||
/* draw back sides of teeth */
|
||||
glBegin(GL_QUADS);
|
||||
da = 2.0 * M_PI / teeth / 4.0;
|
||||
for (i = 0; i < teeth; i++) {
|
||||
angle = i * 2.0 * M_PI / teeth;
|
||||
|
||||
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
|
||||
-width * 0.5);
|
||||
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
|
||||
-width * 0.5);
|
||||
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
|
||||
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
/* draw outward faces of teeth */
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
for (i = 0; i < teeth; i++) {
|
||||
angle = i * 2.0 * M_PI / teeth;
|
||||
|
||||
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
|
||||
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
|
||||
u = r2 * cos(angle + da) - r1 * cos(angle);
|
||||
v = r2 * sin(angle + da) - r1 * sin(angle);
|
||||
len = sqrt(u * u + v * v);
|
||||
u /= len;
|
||||
v /= len;
|
||||
glNormal3f(v, -u, 0.0);
|
||||
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
|
||||
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
|
||||
glNormal3f(cos(angle), sin(angle), 0.0);
|
||||
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
|
||||
width * 0.5);
|
||||
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
|
||||
-width * 0.5);
|
||||
u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
|
||||
v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
|
||||
glNormal3f(v, -u, 0.0);
|
||||
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
|
||||
width * 0.5);
|
||||
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
|
||||
-width * 0.5);
|
||||
glNormal3f(cos(angle), sin(angle), 0.0);
|
||||
}
|
||||
|
||||
glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
|
||||
glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5);
|
||||
|
||||
glEnd();
|
||||
|
||||
glShadeModel(GL_SMOOTH);
|
||||
|
||||
/* draw inside radius cylinder */
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
for (i = 0; i <= teeth; i++) {
|
||||
angle = i * 2.0 * M_PI / teeth;
|
||||
glNormal3f(-cos(angle), -sin(angle), 0.0);
|
||||
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
|
||||
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(view_rotx, 1.0, 0.0, 0.0);
|
||||
glRotatef(view_roty, 0.0, 1.0, 0.0);
|
||||
glRotatef(view_rotz, 0.0, 0.0, 1.0);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(-3.0, -2.0, 0.0);
|
||||
glRotatef(angle, 0.0, 0.0, 1.0);
|
||||
glCallList(gear1);
|
||||
glPopMatrix();
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(3.1, -2.0, 0.0);
|
||||
glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
|
||||
glCallList(gear2);
|
||||
glPopMatrix();
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(-3.1, 4.2, 0.0);
|
||||
glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
|
||||
glCallList(gear3);
|
||||
glPopMatrix();
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
/* new window size or exposure */
|
||||
static void
|
||||
reshape(int width, int height)
|
||||
{
|
||||
GLfloat ar = (GLfloat) width / (GLfloat) height;
|
||||
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -40.0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
init(void)
|
||||
{
|
||||
static GLfloat pos[4] = { 5.0, 5.0, 10.0, 0.0 };
|
||||
static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 };
|
||||
static GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 };
|
||||
static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 };
|
||||
|
||||
glLightfv(GL_LIGHT0, GL_POSITION, pos);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
/* make the gears */
|
||||
gear1 = glGenLists(1);
|
||||
glNewList(gear1, GL_COMPILE);
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
|
||||
gear(1.0, 4.0, 1.0, 20, 0.7);
|
||||
glEndList();
|
||||
|
||||
gear2 = glGenLists(1);
|
||||
glNewList(gear2, GL_COMPILE);
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
|
||||
gear(0.5, 2.0, 2.0, 10, 0.7);
|
||||
glEndList();
|
||||
|
||||
gear3 = glGenLists(1);
|
||||
glNewList(gear3, GL_COMPILE);
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
|
||||
gear(1.3, 2.0, 0.5, 10, 0.7);
|
||||
glEndList();
|
||||
|
||||
glEnable(GL_NORMALIZE);
|
||||
|
||||
glClearColor(0.2, 0.2, 0.2, 0.0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create an RGB, double-buffered X window.
|
||||
* Return the window and context handles.
|
||||
*/
|
||||
static void
|
||||
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
|
||||
const char *name,
|
||||
int x, int y, int width, int height,
|
||||
Window *winRet,
|
||||
EGLContext *ctxRet,
|
||||
EGLSurface *surfRet)
|
||||
{
|
||||
static const EGLint attribs[] = {
|
||||
EGL_RED_SIZE, 1,
|
||||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
/*EGL_DOUBLEBUFFER,*/
|
||||
EGL_DEPTH_SIZE, 1,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
int scrnum;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
Window root;
|
||||
Window win;
|
||||
XVisualInfo *visInfo, visTemplate;
|
||||
int num_visuals;
|
||||
EGLContext ctx;
|
||||
EGLConfig config;
|
||||
EGLint num_configs, vid;
|
||||
|
||||
scrnum = DefaultScreen( x_dpy );
|
||||
root = RootWindow( x_dpy, scrnum );
|
||||
|
||||
if (fullscreen) {
|
||||
x = 0; y = 0;
|
||||
width = DisplayWidth( x_dpy, scrnum );
|
||||
height = DisplayHeight( x_dpy, scrnum );
|
||||
}
|
||||
|
||||
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
|
||||
printf("Error: couldn't get an EGL visual config\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
|
||||
printf("Error: eglGetConfigAttrib() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* The X window visual must match the EGL config */
|
||||
visTemplate.visualid = vid;
|
||||
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
|
||||
if (!visInfo) {
|
||||
printf("Error: couldn't get X visual\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* window attributes */
|
||||
attr.background_pixel = 0;
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
attr.override_redirect = fullscreen;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect;
|
||||
|
||||
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
|
||||
0, visInfo->depth, InputOutput,
|
||||
visInfo->visual, mask, &attr );
|
||||
|
||||
/* set hints and properties */
|
||||
{
|
||||
XSizeHints sizehints;
|
||||
sizehints.x = x;
|
||||
sizehints.y = y;
|
||||
sizehints.width = width;
|
||||
sizehints.height = height;
|
||||
sizehints.flags = USSize | USPosition;
|
||||
XSetNormalHints(x_dpy, win, &sizehints);
|
||||
XSetStandardProperties(x_dpy, win, name, name,
|
||||
None, (char **)NULL, 0, &sizehints);
|
||||
}
|
||||
|
||||
eglBindAPI(EGL_OPENGL_API);
|
||||
|
||||
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
|
||||
if (!ctx) {
|
||||
printf("Error: glXCreateContext failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
|
||||
|
||||
XFree(visInfo);
|
||||
|
||||
*winRet = win;
|
||||
*ctxRet = ctx;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
event_loop(Display *dpy, Window win,
|
||||
EGLDisplay egl_dpy, EGLSurface egl_surf)
|
||||
{
|
||||
while (1) {
|
||||
while (XPending(dpy) > 0) {
|
||||
XEvent event;
|
||||
XNextEvent(dpy, &event);
|
||||
switch (event.type) {
|
||||
case Expose:
|
||||
/* we'll redraw below */
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
reshape(event.xconfigure.width, event.xconfigure.height);
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
char buffer[10];
|
||||
int r, code;
|
||||
code = XLookupKeysym(&event.xkey, 0);
|
||||
if (code == XK_Left) {
|
||||
view_roty += 5.0;
|
||||
}
|
||||
else if (code == XK_Right) {
|
||||
view_roty -= 5.0;
|
||||
}
|
||||
else if (code == XK_Up) {
|
||||
view_rotx += 5.0;
|
||||
}
|
||||
else if (code == XK_Down) {
|
||||
view_rotx -= 5.0;
|
||||
}
|
||||
else {
|
||||
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
|
||||
NULL, NULL);
|
||||
if (buffer[0] == 27) {
|
||||
/* escape */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
static int frames = 0;
|
||||
static double tRot0 = -1.0, tRate0 = -1.0;
|
||||
double dt, t = current_time();
|
||||
if (tRot0 < 0.0)
|
||||
tRot0 = t;
|
||||
dt = t - tRot0;
|
||||
tRot0 = t;
|
||||
|
||||
/* advance rotation for next frame */
|
||||
angle += 70.0 * dt; /* 70 degrees per second */
|
||||
if (angle > 3600.0)
|
||||
angle -= 3600.0;
|
||||
|
||||
draw();
|
||||
eglSwapBuffers(egl_dpy, egl_surf);
|
||||
|
||||
frames++;
|
||||
|
||||
if (tRate0 < 0.0)
|
||||
tRate0 = t;
|
||||
if (t - tRate0 >= 5.0) {
|
||||
GLfloat seconds = t - tRate0;
|
||||
GLfloat fps = frames / seconds;
|
||||
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds,
|
||||
fps);
|
||||
tRate0 = t;
|
||||
frames = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
printf("Usage:\n");
|
||||
printf(" -display <displayname> set the display to run on\n");
|
||||
printf(" -fullscreen run in fullscreen mode\n");
|
||||
printf(" -info display OpenGL renderer info\n");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
const int winWidth = 300, winHeight = 300;
|
||||
Display *x_dpy;
|
||||
Window win;
|
||||
EGLSurface egl_surf;
|
||||
EGLContext egl_ctx;
|
||||
EGLDisplay egl_dpy;
|
||||
char *dpyName = NULL;
|
||||
GLboolean printInfo = GL_FALSE;
|
||||
EGLint egl_major, egl_minor;
|
||||
int i;
|
||||
const char *s;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-display") == 0) {
|
||||
dpyName = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "-info") == 0) {
|
||||
printInfo = GL_TRUE;
|
||||
}
|
||||
else if (strcmp(argv[i], "-fullscreen") == 0) {
|
||||
fullscreen = GL_TRUE;
|
||||
}
|
||||
else {
|
||||
usage();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
x_dpy = XOpenDisplay(dpyName);
|
||||
if (!x_dpy) {
|
||||
printf("Error: couldn't open display %s\n",
|
||||
dpyName ? dpyName : getenv("DISPLAY"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
egl_dpy = eglGetDisplay(x_dpy);
|
||||
if (!egl_dpy) {
|
||||
printf("Error: eglGetDisplay() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
|
||||
printf("Error: eglInitialize() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VERSION);
|
||||
printf("EGL_VERSION = %s\n", s);
|
||||
|
||||
make_x_window(x_dpy, egl_dpy,
|
||||
"glxgears", 0, 0, winWidth, winHeight,
|
||||
&win, &egl_ctx, &egl_surf);
|
||||
|
||||
XMapWindow(x_dpy, win);
|
||||
eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx);
|
||||
|
||||
if (printInfo) {
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
/* Set initial projection/viewing transformation.
|
||||
* We can't be sure we'll get a ConfigureNotify event when the window
|
||||
* first appears.
|
||||
*/
|
||||
reshape(winWidth, winHeight);
|
||||
|
||||
event_loop(x_dpy, win, egl_dpy, egl_surf);
|
||||
|
||||
glDeleteLists(gear1, 1);
|
||||
glDeleteLists(gear2, 1);
|
||||
glDeleteLists(gear3, 1);
|
||||
|
||||
eglDestroyContext(egl_dpy, egl_ctx);
|
||||
eglDestroySurface(egl_dpy, egl_surf);
|
||||
eglTerminate(egl_dpy);
|
||||
|
||||
|
||||
XDestroyWindow(x_dpy, win);
|
||||
XCloseDisplay(x_dpy);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -18,6 +18,7 @@ bufferobj
|
||||
bug_3050
|
||||
bug_3101
|
||||
bug_3195
|
||||
bug_texstore_i8
|
||||
calibrate_rast
|
||||
copypixrate
|
||||
crossbar
|
||||
|
||||
@@ -30,6 +30,7 @@ SOURCES = \
|
||||
bug_3050.c \
|
||||
bug_3101.c \
|
||||
bug_3195.c \
|
||||
bug_texstore_i8.c \
|
||||
calibrate_rast.c \
|
||||
copypixrate.c \
|
||||
crossbar.c \
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
/*
|
||||
* Based on the trivial/quad-tex-2d program.
|
||||
* Modified by Jakob Bornecrantz <jakob@tungstengraphics.com>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
static GLenum Target = GL_TEXTURE_2D;
|
||||
static GLenum Filter = GL_NEAREST;
|
||||
GLenum doubleBuffer;
|
||||
static float Rot = 0;
|
||||
static int win = 0;
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
int internalFormat;
|
||||
int sourceFormat;
|
||||
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
|
||||
#define SIZE 16
|
||||
{
|
||||
GLubyte tex2d[SIZE][SIZE][4];
|
||||
GLint s, t;
|
||||
|
||||
for (s = 0; s < SIZE; s++) {
|
||||
for (t = 0; t < SIZE; t++) {
|
||||
tex2d[t][s][0] = 0xff;
|
||||
tex2d[t][s][1] = 0xff;
|
||||
tex2d[t][s][2] = 0xff;
|
||||
tex2d[t][s][3] = 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
internalFormat = GL_LUMINANCE8;
|
||||
sourceFormat = GL_RGBA;
|
||||
|
||||
glTexImage2D(Target,
|
||||
0,
|
||||
internalFormat,
|
||||
SIZE, SIZE,
|
||||
0,
|
||||
sourceFormat,
|
||||
GL_UNSIGNED_BYTE,
|
||||
//GL_UNSIGNED_INT,
|
||||
tex2d);
|
||||
|
||||
glEnable(Target);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
glTexParameterf(Target, GL_TEXTURE_WRAP_R, GL_REPEAT);
|
||||
glTexParameterf(Target, GL_TEXTURE_MIN_FILTER, Filter);
|
||||
glTexParameterf(Target, GL_TEXTURE_MAG_FILTER, Filter);
|
||||
}
|
||||
}
|
||||
|
||||
static void Reshape(int width, int height)
|
||||
{
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
#if 0
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
#else
|
||||
glFrustum(-1, 1, -1, 1, 10, 20);
|
||||
#endif
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0, 0, -15);
|
||||
}
|
||||
|
||||
static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
switch (key) {
|
||||
case 'r':
|
||||
Rot += 10.0;
|
||||
break;
|
||||
case 'R':
|
||||
Rot -= 10.0;
|
||||
break;
|
||||
case 27:
|
||||
glutDestroyWindow(win);
|
||||
exit(0);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
static void Draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(Rot, 0, 1, 0);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(1,0);
|
||||
glVertex3f( 0.9, -0.9, 0.0);
|
||||
glTexCoord2f(1,1);
|
||||
glVertex3f( 0.9, 0.9, 0.0);
|
||||
glTexCoord2f(0,1);
|
||||
glVertex3f(-0.9, 0.9, 0.0);
|
||||
glTexCoord2f(0,0);
|
||||
glVertex3f(-0.9, -0.9, 0.0);
|
||||
glEnd();
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum Args(int argc, char **argv)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
doubleBuffer = GL_FALSE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-sb") == 0) {
|
||||
doubleBuffer = GL_FALSE;
|
||||
} else if (strcmp(argv[i], "-db") == 0) {
|
||||
doubleBuffer = GL_TRUE;
|
||||
} else {
|
||||
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
if (Args(argc, argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glutInitWindowPosition(0, 0);
|
||||
glutInitWindowSize(250, 250);
|
||||
|
||||
type = GLUT_RGB;
|
||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
win = glutCreateWindow("Tex test");
|
||||
if (!win) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ clear
|
||||
clear-fbo
|
||||
clear-fbo-tex
|
||||
clear-scissor
|
||||
clear-undefined
|
||||
dlist-dangling
|
||||
dlist-edgeflag
|
||||
dlist-edgeflag-dangling
|
||||
@@ -37,6 +38,8 @@ point-wide
|
||||
point-wide-smooth
|
||||
poly
|
||||
poly-flat
|
||||
poly-flat-clip
|
||||
poly-flat-unfilled-clip
|
||||
poly-unfilled
|
||||
quad
|
||||
quad-clip
|
||||
@@ -73,6 +76,11 @@ tri-cull
|
||||
tri-cull-both
|
||||
tri-dlist
|
||||
tri-edgeflag
|
||||
trifan
|
||||
trifan-flat
|
||||
trifan-flat-clip
|
||||
trifan-flat-unfilled-clip
|
||||
trifan-unfilled
|
||||
tri-fbo
|
||||
tri-fbo-tex
|
||||
tri-flat
|
||||
@@ -96,10 +104,12 @@ tri-z
|
||||
tri-z-eq
|
||||
tristrip
|
||||
tristrip-clip
|
||||
tristrip-flat
|
||||
vbo-drawarrays
|
||||
vbo-drawelements
|
||||
vbo-drawrange
|
||||
vp-array
|
||||
vp-array-int
|
||||
vp-clip
|
||||
vp-line-clip
|
||||
vp-tri
|
||||
|
||||
@@ -14,6 +14,7 @@ SOURCES = \
|
||||
clear-fbo-tex.c \
|
||||
clear-fbo.c \
|
||||
clear-scissor.c \
|
||||
clear-undefined.c \
|
||||
clear.c \
|
||||
dlist-dangling.c \
|
||||
dlist-edgeflag-dangling.c \
|
||||
@@ -48,6 +49,8 @@ SOURCES = \
|
||||
point-wide-smooth.c \
|
||||
point.c \
|
||||
poly-flat.c \
|
||||
poly-flat-clip.c \
|
||||
poly-flat-unfilled-clip.c \
|
||||
poly-unfilled.c \
|
||||
poly.c \
|
||||
quad-clip-all-vertices.c \
|
||||
@@ -104,12 +107,19 @@ SOURCES = \
|
||||
tri-z-eq.c \
|
||||
tri-z.c \
|
||||
tri.c \
|
||||
trifan-flat.c \
|
||||
trifan-flat-clip.c \
|
||||
trifan-flat-unfilled-clip.c \
|
||||
trifan-unfilled.c \
|
||||
trifan.c \
|
||||
tristrip-clip.c \
|
||||
tristrip-flat.c \
|
||||
tristrip.c \
|
||||
vbo-drawarrays.c \
|
||||
vbo-drawelements.c \
|
||||
vbo-drawrange.c \
|
||||
vp-array.c \
|
||||
vp-array-int.c \
|
||||
vp-clip.c \
|
||||
vp-line-clip.c \
|
||||
vp-tri.c \
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* glClear + glScissor + Undefined content of framebuffer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
GLenum doubleBuffer;
|
||||
GLint Width = 200, Height = 150;
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
fprintf(stderr, "Top right corner should be red\n");
|
||||
}
|
||||
|
||||
static void Reshape(int width, int height)
|
||||
{
|
||||
Width = width;
|
||||
Height = height;
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
glutPostRedisplay();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void Draw(void)
|
||||
{
|
||||
glColor4f(1.0, 0.0, 0.0, 1.0);
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2d(0.0, 0.0);
|
||||
glVertex2d(0.0, 1.0);
|
||||
glVertex2d(1.0, 1.0);
|
||||
glVertex2d(1.0, 0.0);
|
||||
glEnd();
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2d(0.0, 0.0);
|
||||
glVertex2d(0.0, -1.0);
|
||||
glVertex2d(1.0, -1.0);
|
||||
glVertex2d(1.0, 0.0);
|
||||
glEnd();
|
||||
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glClearColor(1, 1, 0, 0);
|
||||
glScissor(Width / 2, 0, Width - Width / 2, Height / 2);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glClearColor(0, 0, 1, 0);
|
||||
glScissor(0, Height / 2, Width / 2, Height - Height / 2);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
glColor4f(0.0, 1.0, 0.0, 1.0);
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2d( 0.0, 0.0);
|
||||
glVertex2d( 0.0, -1.0);
|
||||
glVertex2d(-1.0, -1.0);
|
||||
glVertex2d(-1.0, 0.0);
|
||||
glEnd();
|
||||
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum Args(int argc, char **argv)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
doubleBuffer = GL_TRUE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-sb") == 0) {
|
||||
doubleBuffer = GL_FALSE;
|
||||
} else if (strcmp(argv[i], "-db") == 0) {
|
||||
doubleBuffer = GL_TRUE;
|
||||
} else {
|
||||
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
if (Args(argc, argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( Width, Height );
|
||||
|
||||
|
||||
type = GLUT_RGB | GLUT_ALPHA;
|
||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow(argv[0]) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Init();
|
||||
Reshape(Width, Height);
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
@@ -75,13 +75,13 @@ static void Draw(void)
|
||||
|
||||
glBegin(GL_POLYGON);
|
||||
glColor3f(1,0,0);
|
||||
glVertex3f( 1.1, -1.1, -30.0);
|
||||
glVertex3f( 0, 0, -30.0);
|
||||
glColor3f(1,1,0);
|
||||
glVertex3f( 1.1, 1.1, -30.0);
|
||||
glVertex3f( 1.3, 1.1, -30.0);
|
||||
glColor3f(1,0,1);
|
||||
glVertex3f(-1.1, 1.1, -30.0);
|
||||
glVertex3f(-.9, .9, -30.0);
|
||||
glColor3f(0,1,1);
|
||||
glVertex3f(-1.1, -1.1, -30.0);
|
||||
glVertex3f(-1.1, -1.3, -30.0);
|
||||
glEnd();
|
||||
|
||||
glFlush();
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
#define CI_OFFSET_1 16
|
||||
#define CI_OFFSET_2 32
|
||||
|
||||
|
||||
GLenum doubleBuffer;
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
}
|
||||
|
||||
static void Reshape(int width, int height)
|
||||
{
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
static void Draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glShadeModel(GL_FLAT);
|
||||
|
||||
glPolygonMode(GL_FRONT, GL_LINE);
|
||||
glPolygonMode(GL_BACK, GL_LINE);
|
||||
glLineWidth(4.0);
|
||||
|
||||
|
||||
glBegin(GL_POLYGON);
|
||||
glColor3f(1,0,0);
|
||||
glVertex3f( 0, 0, -30.0);
|
||||
glColor3f(1,1,0);
|
||||
glVertex3f( 1.3, 1.1, -30.0);
|
||||
glColor3f(1,0,1);
|
||||
glVertex3f(-.9, .9, -30.0);
|
||||
glColor3f(0,1,1);
|
||||
glVertex3f(-1.1, -1.3, -30.0);
|
||||
glEnd();
|
||||
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum Args(int argc, char **argv)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
doubleBuffer = GL_FALSE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-sb") == 0) {
|
||||
doubleBuffer = GL_FALSE;
|
||||
} else if (strcmp(argv[i], "-db") == 0) {
|
||||
doubleBuffer = GL_TRUE;
|
||||
} else {
|
||||
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
if (Args(argc, argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||
|
||||
type = GLUT_RGB;
|
||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow("First Tri") == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
#define CI_OFFSET_1 16
|
||||
#define CI_OFFSET_2 32
|
||||
|
||||
|
||||
GLenum doubleBuffer;
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
}
|
||||
|
||||
static void Reshape(int width, int height)
|
||||
{
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
static void Draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glShadeModel(GL_FLAT);
|
||||
|
||||
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glColor3f(1,0,0);
|
||||
glVertex3f( 0, 0, -30.0);
|
||||
glColor3f(1,1,0);
|
||||
glVertex3f( 1.3, 1.1, -30.0);
|
||||
glColor3f(1,0,1);
|
||||
glVertex3f(-.9, .9, -30.0);
|
||||
glColor3f(0,1,1);
|
||||
glVertex3f(-1.1, -1.3, -30.0);
|
||||
glEnd();
|
||||
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum Args(int argc, char **argv)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
doubleBuffer = GL_FALSE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-sb") == 0) {
|
||||
doubleBuffer = GL_FALSE;
|
||||
} else if (strcmp(argv[i], "-db") == 0) {
|
||||
doubleBuffer = GL_TRUE;
|
||||
} else {
|
||||
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
if (Args(argc, argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||
|
||||
type = GLUT_RGB;
|
||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow("First Tri") == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
#define CI_OFFSET_1 16
|
||||
#define CI_OFFSET_2 32
|
||||
|
||||
|
||||
GLenum doubleBuffer;
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
}
|
||||
|
||||
static void Reshape(int width, int height)
|
||||
{
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
static void Draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glShadeModel(GL_FLAT);
|
||||
|
||||
glPolygonMode(GL_FRONT, GL_LINE);
|
||||
glPolygonMode(GL_BACK, GL_LINE);
|
||||
glLineWidth(4.0);
|
||||
|
||||
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glColor3f(1,0,0);
|
||||
glVertex3f( 0, 0, -30.0);
|
||||
glColor3f(1,1,0);
|
||||
glVertex3f( 1.3, 1.1, -30.0);
|
||||
glColor3f(1,0,1);
|
||||
glVertex3f(-.9, .9, -30.0);
|
||||
glColor3f(0,1,1);
|
||||
glVertex3f(-1.1, -1.3, -30.0);
|
||||
glEnd();
|
||||
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum Args(int argc, char **argv)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
doubleBuffer = GL_FALSE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-sb") == 0) {
|
||||
doubleBuffer = GL_FALSE;
|
||||
} else if (strcmp(argv[i], "-db") == 0) {
|
||||
doubleBuffer = GL_TRUE;
|
||||
} else {
|
||||
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
if (Args(argc, argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||
|
||||
type = GLUT_RGB;
|
||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow("First Tri") == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
#define CI_OFFSET_1 16
|
||||
#define CI_OFFSET_2 32
|
||||
|
||||
|
||||
GLenum doubleBuffer;
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
}
|
||||
|
||||
static void Reshape(int width, int height)
|
||||
{
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
static void Draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glShadeModel(GL_FLAT);
|
||||
|
||||
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glColor3f(1,0,0);
|
||||
glVertex3f( 0.9, -0.9, -30.0);
|
||||
glColor3f(1,1,0);
|
||||
glVertex3f( 0.9, 0.9, -30.0);
|
||||
glColor3f(1,0,1);
|
||||
glVertex3f(-0.9, 0.9, -30.0);
|
||||
glColor3f(0,1,1);
|
||||
glVertex3f(-0.9, -0.9, -30.0);
|
||||
glEnd();
|
||||
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum Args(int argc, char **argv)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
doubleBuffer = GL_FALSE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-sb") == 0) {
|
||||
doubleBuffer = GL_FALSE;
|
||||
} else if (strcmp(argv[i], "-db") == 0) {
|
||||
doubleBuffer = GL_TRUE;
|
||||
} else {
|
||||
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
if (Args(argc, argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||
|
||||
type = GLUT_RGB | GLUT_ALPHA;
|
||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow("First Tri") == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
#define CI_OFFSET_1 16
|
||||
#define CI_OFFSET_2 32
|
||||
|
||||
|
||||
GLenum doubleBuffer;
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
}
|
||||
|
||||
static void Reshape(int width, int height)
|
||||
{
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
static void Draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glColor3f(1,0,0);
|
||||
glVertex3f( 0.9, -0.9, -30.0);
|
||||
glColor3f(1,1,0);
|
||||
glVertex3f( 0.9, 0.9, -30.0);
|
||||
glColor3f(1,0,1);
|
||||
glVertex3f(-0.9, 0.9, -30.0);
|
||||
glColor3f(0,1,1);
|
||||
glVertex3f(-0.9, -0.9, -30.0);
|
||||
glEnd();
|
||||
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum Args(int argc, char **argv)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
doubleBuffer = GL_FALSE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-sb") == 0) {
|
||||
doubleBuffer = GL_FALSE;
|
||||
} else if (strcmp(argv[i], "-db") == 0) {
|
||||
doubleBuffer = GL_TRUE;
|
||||
} else {
|
||||
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
if (Args(argc, argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||
|
||||
type = GLUT_RGB | GLUT_ALPHA;
|
||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow("First Tri") == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
#define CI_OFFSET_1 16
|
||||
#define CI_OFFSET_2 32
|
||||
|
||||
|
||||
GLenum doubleBuffer;
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
}
|
||||
|
||||
static void Reshape(int width, int height)
|
||||
{
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
static void Draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glColor3f(1,0,0);
|
||||
glVertex3f( 0.9, -0.9, -30.0);
|
||||
glColor3f(1,1,0);
|
||||
glVertex3f( 0.9, 0.9, -30.0);
|
||||
glColor3f(1,0,1);
|
||||
glVertex3f(-0.9, 0.9, -30.0);
|
||||
glColor3f(0,1,1);
|
||||
glVertex3f(-0.9, -0.9, -30.0);
|
||||
glEnd();
|
||||
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum Args(int argc, char **argv)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
doubleBuffer = GL_FALSE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-sb") == 0) {
|
||||
doubleBuffer = GL_FALSE;
|
||||
} else if (strcmp(argv[i], "-db") == 0) {
|
||||
doubleBuffer = GL_TRUE;
|
||||
} else {
|
||||
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
if (Args(argc, argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||
|
||||
type = GLUT_RGB | GLUT_ALPHA;
|
||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow("First Tri") == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glut.h>
|
||||
|
||||
GLint verts[][4] = {
|
||||
{ 1, -1, 0, 1 },
|
||||
{ 1, 1, 0, 1 },
|
||||
{ -1, 1, 0, 1 },
|
||||
{ -1, -1, 0, 1 },
|
||||
};
|
||||
|
||||
GLubyte color[][4] = {
|
||||
{ 0x00, 0x00, 0xff, 0x00 },
|
||||
{ 0x00, 0xff, 0x00, 0x00 },
|
||||
{ 0xff, 0x00, 0x00, 0x00 },
|
||||
{ 0xff, 0xff, 0xff, 0x00 },
|
||||
};
|
||||
|
||||
GLuint indices[] = { 0, 1, 2, 3 };
|
||||
|
||||
static void Init( void )
|
||||
{
|
||||
GLint errno;
|
||||
GLuint prognum;
|
||||
|
||||
static const char *prog1 =
|
||||
"!!ARBvp1.0\n"
|
||||
"MOV result.color, vertex.color;\n"
|
||||
"MOV result.position, vertex.position;\n"
|
||||
"END\n";
|
||||
|
||||
glGenProgramsARB(1, &prognum);
|
||||
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
|
||||
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
|
||||
strlen(prog1), (const GLubyte *) prog1);
|
||||
|
||||
assert(glIsProgramARB(prognum));
|
||||
errno = glGetError();
|
||||
printf("glGetError = %d\n", errno);
|
||||
if (errno != GL_NO_ERROR)
|
||||
{
|
||||
GLint errorpos;
|
||||
|
||||
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
|
||||
printf("errorpos: %d\n", errorpos);
|
||||
printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
|
||||
}
|
||||
|
||||
|
||||
glEnableClientState( GL_VERTEX_ARRAY );
|
||||
glEnableClientState( GL_COLOR_ARRAY );
|
||||
glVertexPointer( 3, GL_INT, sizeof(verts[0]), verts );
|
||||
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, color );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void Display( void )
|
||||
{
|
||||
glClearColor(0.3, 0.3, 0.3, 1);
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||
|
||||
glEnable(GL_VERTEX_PROGRAM_NV);
|
||||
glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, indices );
|
||||
|
||||
glFlush();
|
||||
}
|
||||
|
||||
|
||||
static void Reshape( int width, int height )
|
||||
{
|
||||
glViewport( 0, 0, width, height );
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
/*glTranslatef( 0.0, 0.0, -15.0 );*/
|
||||
}
|
||||
|
||||
|
||||
static void Key( unsigned char key, int x, int y )
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
glutInit( &argc, argv );
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitWindowSize( 250, 250 );
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
|
||||
glutCreateWindow(argv[0]);
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
glutDisplayFunc( Display );
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
+1
-1
@@ -230,7 +230,7 @@ int main( int argc, char *argv[] )
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitWindowSize( 250, 250 );
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
|
||||
glutCreateWindow(argv[0]);
|
||||
glutCreateWindow(argv[argc-1]);
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
glutDisplayFunc( Display );
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
const int KernelSize = 8;
|
||||
uniform vec2 Offset2f[KernelSize];
|
||||
uniform vec4 KernelValue4f[KernelSize];
|
||||
|
||||
void main(void)
|
||||
{
|
||||
int i;
|
||||
vec4 sum = vec4(0.0);
|
||||
vec4 tmp = gl_Color;
|
||||
vec2 rg, ba;
|
||||
gl_Position = gl_Vertex;
|
||||
|
||||
rg = Offset2f[4];
|
||||
ba = Offset2f[5];
|
||||
|
||||
|
||||
gl_FrontColor = KernelValue4f[0] * vec4(rg, ba);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
const int KernelSize = 16;
|
||||
uniform float KernelValue1f[KernelSize];
|
||||
|
||||
void main(void)
|
||||
{
|
||||
int i;
|
||||
vec4 sum = vec4(0.0);
|
||||
vec4 tmp = gl_Color;
|
||||
gl_Position = gl_Vertex;
|
||||
|
||||
for (i = 0; i < KernelSize; ++i) {
|
||||
float x, y, z, w;
|
||||
|
||||
x = KernelValue1f[i]; ++i;
|
||||
y = KernelValue1f[i]; ++i;
|
||||
z = KernelValue1f[i]; ++i;
|
||||
w = KernelValue1f[i];
|
||||
|
||||
sum += tmp * vec4(x, y, z, w);
|
||||
}
|
||||
gl_FrontColor = sum;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
const int KernelSize = 9;
|
||||
uniform vec2 KernelValue2f[KernelSize];
|
||||
|
||||
void main(void)
|
||||
{
|
||||
int i;
|
||||
vec4 sum = vec4(0.0);
|
||||
vec4 tmp = gl_Color;
|
||||
gl_Position = gl_Vertex;
|
||||
|
||||
for (i = 0; i < KernelSize; ++i) {
|
||||
vec2 rg, ba;
|
||||
|
||||
rg = KernelValue2f[i];
|
||||
++i;
|
||||
if (i < KernelSize)
|
||||
ba = KernelValue2f[i];
|
||||
else
|
||||
ba = vec2(0, 0);
|
||||
|
||||
sum += tmp * vec4(rg, ba);
|
||||
}
|
||||
gl_FrontColor = sum;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
const int KernelSize = 4;
|
||||
uniform vec4 KernelValue4f[KernelSize];
|
||||
|
||||
void main(void)
|
||||
{
|
||||
int i;
|
||||
vec4 sum = vec4(0.0);
|
||||
vec4 tmp = gl_Color;
|
||||
gl_Position = gl_Vertex;
|
||||
|
||||
for (i = 0; i < KernelSize; ++i) {
|
||||
vec4 rgba;
|
||||
|
||||
rgba = KernelValue4f[i];
|
||||
|
||||
sum += tmp * rgba;
|
||||
}
|
||||
gl_FrontColor = sum;
|
||||
}
|
||||
@@ -76,6 +76,52 @@ static void check_link(GLuint prog)
|
||||
}
|
||||
}
|
||||
|
||||
static void setup_uniforms()
|
||||
{
|
||||
{
|
||||
GLuint loc1f = glGetUniformLocationARB(program, "Offset1f");
|
||||
GLuint loc2f = glGetUniformLocationARB(program, "Offset2f");
|
||||
GLuint loc4f = glGetUniformLocationARB(program, "Offset4f");
|
||||
GLfloat vecKer[] =
|
||||
{ 1.0, 0.0, 0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
1.0, 0.0, 0.0, 1.0,
|
||||
0.0, 0.0, 0.0, 1.0
|
||||
};
|
||||
if (loc1f >= 0)
|
||||
glUniform1fv(loc1f, 16, vecKer);
|
||||
|
||||
if (loc2f >= 0)
|
||||
glUniform2fv(loc2f, 8, vecKer);
|
||||
|
||||
if (loc4f >= 0)
|
||||
glUniform4fv(loc4f, 4, vecKer);
|
||||
|
||||
}
|
||||
|
||||
GLuint loc1f = glGetUniformLocationARB(program, "KernelValue1f");
|
||||
GLuint loc2f = glGetUniformLocationARB(program, "KernelValue2f");
|
||||
GLuint loc4f = glGetUniformLocationARB(program, "KernelValue4f");
|
||||
GLfloat vecKer[] =
|
||||
{ 1.0, 0.0, 0.0, 0.25,
|
||||
0.0, 1.0, 0.0, 0.25,
|
||||
0.0, 0.0, 1.0, 0.25,
|
||||
0.0, 0.0, 0.0, 0.25,
|
||||
0.5, 0.0, 0.0, 0.35,
|
||||
0.0, 0.5, 0.0, 0.35,
|
||||
0.0, 0.0, 0.5, 0.35,
|
||||
0.0, 0.0, 0.0, 0.35
|
||||
};
|
||||
if (loc1f >= 0)
|
||||
glUniform1fv(loc1f, 16, vecKer);
|
||||
|
||||
if (loc2f >= 0)
|
||||
glUniform2fv(loc2f, 8, vecKer);
|
||||
|
||||
if (loc4f >= 0)
|
||||
glUniform4fv(loc4f, 4, vecKer);
|
||||
}
|
||||
|
||||
static void prepare_shaders()
|
||||
{
|
||||
static const char *fragShaderText =
|
||||
@@ -103,6 +149,8 @@ static void prepare_shaders()
|
||||
glLinkProgram(program);
|
||||
check_link(program);
|
||||
glUseProgram(program);
|
||||
|
||||
setup_uniforms();
|
||||
}
|
||||
|
||||
static void args(int argc, char *argv[])
|
||||
|
||||
+121
-75
@@ -88,12 +88,18 @@ current_time(void)
|
||||
#endif
|
||||
|
||||
|
||||
/** Event handler results: */
|
||||
#define NOP 0
|
||||
#define EXIT 1
|
||||
#define DRAW 2
|
||||
|
||||
static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
|
||||
static GLint gear1, gear2, gear3;
|
||||
static GLfloat angle = 0.0;
|
||||
|
||||
static GLboolean fullscreen = GL_FALSE; /* Create a single fullscreen window */
|
||||
static GLboolean stereo = GL_FALSE; /* Enable stereo. */
|
||||
static GLboolean animate = GL_TRUE; /* Animation */
|
||||
static GLfloat eyesep = 5.0; /* Eye separation. */
|
||||
static GLfloat fix_point = 40.0; /* Fixation point distance. */
|
||||
static GLfloat left, right, asp; /* Stereo frustum params. */
|
||||
@@ -239,7 +245,7 @@ gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
|
||||
|
||||
|
||||
static void
|
||||
do_draw(void)
|
||||
draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
@@ -269,8 +275,9 @@ do_draw(void)
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
draw(void)
|
||||
draw_gears(void)
|
||||
{
|
||||
if (stereo) {
|
||||
/* First left eye. */
|
||||
@@ -284,7 +291,7 @@ draw(void)
|
||||
|
||||
glPushMatrix();
|
||||
glTranslated(+0.5 * eyesep, 0.0, 0.0);
|
||||
do_draw();
|
||||
draw();
|
||||
glPopMatrix();
|
||||
|
||||
/* Then right eye. */
|
||||
@@ -298,10 +305,50 @@ draw(void)
|
||||
|
||||
glPushMatrix();
|
||||
glTranslated(-0.5 * eyesep, 0.0, 0.0);
|
||||
do_draw();
|
||||
draw();
|
||||
glPopMatrix();
|
||||
} else
|
||||
do_draw();
|
||||
}
|
||||
else {
|
||||
draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Draw single frame, do SwapBuffers, compute FPS */
|
||||
static void
|
||||
draw_frame(Display *dpy, Window win)
|
||||
{
|
||||
static int frames = 0;
|
||||
static double tRot0 = -1.0, tRate0 = -1.0;
|
||||
double dt, t = current_time();
|
||||
|
||||
if (tRot0 < 0.0)
|
||||
tRot0 = t;
|
||||
dt = t - tRot0;
|
||||
tRot0 = t;
|
||||
|
||||
if (animate) {
|
||||
/* advance rotation for next frame */
|
||||
angle += 70.0 * dt; /* 70 degrees per second */
|
||||
if (angle > 3600.0)
|
||||
angle -= 3600.0;
|
||||
}
|
||||
|
||||
draw_gears();
|
||||
glXSwapBuffers(dpy, win);
|
||||
|
||||
frames++;
|
||||
|
||||
if (tRate0 < 0.0)
|
||||
tRate0 = t;
|
||||
if (t - tRate0 >= 5.0) {
|
||||
GLfloat seconds = t - tRate0;
|
||||
GLfloat fps = frames / seconds;
|
||||
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds,
|
||||
fps);
|
||||
tRate0 = t;
|
||||
frames = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -319,7 +366,8 @@ reshape(int width, int height)
|
||||
|
||||
left = -5.0 * ((w - 0.5 * eyesep) / fix_point);
|
||||
right = 5.0 * ((w + 0.5 * eyesep) / fix_point);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
GLfloat h = (GLfloat) height / (GLfloat) width;
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
@@ -430,10 +478,11 @@ make_window( Display *dpy, const char *name,
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
/* XXX this is a bad way to get a borderless window! */
|
||||
attr.override_redirect = fullscreen;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect;
|
||||
|
||||
win = XCreateWindow( dpy, root, 0, 0, width, height,
|
||||
win = XCreateWindow( dpy, root, x, y, width, height,
|
||||
0, visinfo->depth, InputOutput,
|
||||
visinfo->visual, mask, &attr );
|
||||
|
||||
@@ -463,79 +512,70 @@ make_window( Display *dpy, const char *name,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle one X event.
|
||||
* \return NOP, EXIT or DRAW
|
||||
*/
|
||||
static int
|
||||
handle_event(Display *dpy, Window win, XEvent *event)
|
||||
{
|
||||
switch (event->type) {
|
||||
case Expose:
|
||||
return DRAW;
|
||||
case ConfigureNotify:
|
||||
reshape(event->xconfigure.width, event->xconfigure.height);
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
char buffer[10];
|
||||
int r, code;
|
||||
code = XLookupKeysym(&event->xkey, 0);
|
||||
if (code == XK_Left) {
|
||||
view_roty += 5.0;
|
||||
}
|
||||
else if (code == XK_Right) {
|
||||
view_roty -= 5.0;
|
||||
}
|
||||
else if (code == XK_Up) {
|
||||
view_rotx += 5.0;
|
||||
}
|
||||
else if (code == XK_Down) {
|
||||
view_rotx -= 5.0;
|
||||
}
|
||||
else {
|
||||
r = XLookupString(&event->xkey, buffer, sizeof(buffer),
|
||||
NULL, NULL);
|
||||
if (buffer[0] == 27) {
|
||||
/* escape */
|
||||
return EXIT;
|
||||
}
|
||||
else if (buffer[0] == 'a' || buffer[0] == 'A') {
|
||||
animate = !animate;
|
||||
}
|
||||
}
|
||||
return DRAW;
|
||||
}
|
||||
}
|
||||
return NOP;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
event_loop(Display *dpy, Window win)
|
||||
{
|
||||
while (1) {
|
||||
while (XPending(dpy) > 0) {
|
||||
int op;
|
||||
while (!animate || XPending(dpy) > 0) {
|
||||
XEvent event;
|
||||
XNextEvent(dpy, &event);
|
||||
switch (event.type) {
|
||||
case Expose:
|
||||
/* we'll redraw below */
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
reshape(event.xconfigure.width, event.xconfigure.height);
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
char buffer[10];
|
||||
int r, code;
|
||||
code = XLookupKeysym(&event.xkey, 0);
|
||||
if (code == XK_Left) {
|
||||
view_roty += 5.0;
|
||||
}
|
||||
else if (code == XK_Right) {
|
||||
view_roty -= 5.0;
|
||||
}
|
||||
else if (code == XK_Up) {
|
||||
view_rotx += 5.0;
|
||||
}
|
||||
else if (code == XK_Down) {
|
||||
view_rotx -= 5.0;
|
||||
}
|
||||
else {
|
||||
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
|
||||
NULL, NULL);
|
||||
if (buffer[0] == 27) {
|
||||
/* escape */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
op = handle_event(dpy, win, &event);
|
||||
if (op == EXIT)
|
||||
return;
|
||||
else if (op == DRAW)
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
static int frames = 0;
|
||||
static double tRot0 = -1.0, tRate0 = -1.0;
|
||||
double dt, t = current_time();
|
||||
if (tRot0 < 0.0)
|
||||
tRot0 = t;
|
||||
dt = t - tRot0;
|
||||
tRot0 = t;
|
||||
|
||||
/* advance rotation for next frame */
|
||||
angle += 70.0 * dt; /* 70 degrees per second */
|
||||
if (angle > 3600.0)
|
||||
angle -= 3600.0;
|
||||
|
||||
draw();
|
||||
glXSwapBuffers(dpy, win);
|
||||
|
||||
frames++;
|
||||
|
||||
if (tRate0 < 0.0)
|
||||
tRate0 = t;
|
||||
if (t - tRate0 >= 5.0) {
|
||||
GLfloat seconds = t - tRate0;
|
||||
GLfloat fps = frames / seconds;
|
||||
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds,
|
||||
fps);
|
||||
tRate0 = t;
|
||||
frames = 0;
|
||||
}
|
||||
}
|
||||
draw_frame(dpy, win);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,13 +588,15 @@ usage(void)
|
||||
printf(" -stereo run in stereo mode\n");
|
||||
printf(" -fullscreen run in fullscreen mode\n");
|
||||
printf(" -info display OpenGL renderer info\n");
|
||||
printf(" -geometry WxH+X+Y window geometry\n");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
const int winWidth = 300, winHeight = 300;
|
||||
unsigned int winWidth = 300, winHeight = 300;
|
||||
int x = 0, y = 0;
|
||||
Display *dpy;
|
||||
Window win;
|
||||
GLXContext ctx;
|
||||
@@ -576,6 +618,10 @@ main(int argc, char *argv[])
|
||||
else if (strcmp(argv[i], "-fullscreen") == 0) {
|
||||
fullscreen = GL_TRUE;
|
||||
}
|
||||
else if (i < argc-1 && strcmp(argv[i], "-geometry") == 0) {
|
||||
XParseGeometry(argv[i+1], &x, &y, &winWidth, &winHeight);
|
||||
i++;
|
||||
}
|
||||
else {
|
||||
usage();
|
||||
return -1;
|
||||
@@ -589,7 +635,7 @@ main(int argc, char *argv[])
|
||||
return -1;
|
||||
}
|
||||
|
||||
make_window(dpy, "glxgears", 0, 0, winWidth, winHeight, &win, &ctx);
|
||||
make_window(dpy, "glxgears", x, y, winWidth, winHeight, &win, &ctx);
|
||||
XMapWindow(dpy, win);
|
||||
glXMakeCurrent(dpy, win, ctx);
|
||||
|
||||
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
"""evc
|
||||
|
||||
Tool-specific initialization for Microsoft eMbedded Visual C++.
|
||||
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001-2007 The SCons Foundation
|
||||
# Copyright (c) 2008 Tungsten Graphics, Inc.
|
||||
#
|
||||
# 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 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.
|
||||
#
|
||||
|
||||
import os.path
|
||||
import re
|
||||
import string
|
||||
|
||||
import SCons.Action
|
||||
import SCons.Builder
|
||||
import SCons.Errors
|
||||
import SCons.Platform.win32
|
||||
import SCons.Tool
|
||||
import SCons.Util
|
||||
import SCons.Warnings
|
||||
|
||||
import msvc_sa
|
||||
import mslib_sa
|
||||
import mslink_sa
|
||||
|
||||
def get_evc_paths(env, version=None):
|
||||
"""Return a 3-tuple of (INCLUDE, LIB, PATH) as the values
|
||||
of those three environment variables that should be set
|
||||
in order to execute the MSVC tools properly."""
|
||||
|
||||
exe_paths = []
|
||||
lib_paths = []
|
||||
include_paths = []
|
||||
|
||||
# mymic the batch files located in Microsoft eMbedded C++ 4.0\EVC\WCExxx\BIN
|
||||
os_version = os.environ.get('OSVERSION', 'WCE500')
|
||||
platform = os.environ.get('PLATFORM', 'STANDARDSDK_500')
|
||||
wce_root = os.environ.get('WCEROOT', 'C:\\Program Files\\Microsoft eMbedded C++ 4.0')
|
||||
sdk_root = os.environ.get('SDKROOT', 'C:\\Windows CE Tools')
|
||||
|
||||
target_cpu = 'x86'
|
||||
cfg = 'none'
|
||||
|
||||
exe_paths.append( os.path.join(wce_root, 'COMMON', 'EVC', 'bin') )
|
||||
exe_paths.append( os.path.join(wce_root, 'EVC', os_version, 'bin') )
|
||||
include_paths.append( os.path.join(sdk_root, os_version, platform, 'include', target_cpu) )
|
||||
include_paths.append( os.path.join(sdk_root, os_version, platform, 'MFC', 'include') )
|
||||
include_paths.append( os.path.join(sdk_root, os_version, platform, 'ATL', 'include') )
|
||||
lib_paths.append( os.path.join(sdk_root, os_version, platform, 'lib', target_cpu) )
|
||||
lib_paths.append( os.path.join(sdk_root, os_version, platform, 'MFC', 'lib', target_cpu) )
|
||||
lib_paths.append( os.path.join(sdk_root, os_version, platform, 'ATL', 'lib', target_cpu) )
|
||||
|
||||
include_path = string.join( include_paths, os.pathsep )
|
||||
lib_path = string.join(lib_paths, os.pathsep )
|
||||
exe_path = string.join(exe_paths, os.pathsep )
|
||||
return (include_path, lib_path, exe_path)
|
||||
|
||||
def generate(env):
|
||||
|
||||
msvc_sa.generate(env)
|
||||
mslib_sa.generate(env)
|
||||
mslink_sa.generate(env)
|
||||
|
||||
if not env.has_key('ENV'):
|
||||
env['ENV'] = {}
|
||||
|
||||
try:
|
||||
include_path, lib_path, exe_path = get_evc_paths(env)
|
||||
|
||||
# since other tools can set these, we just make sure that the
|
||||
# relevant stuff from WINDDK is in there somewhere.
|
||||
env.PrependENVPath('INCLUDE', include_path)
|
||||
env.PrependENVPath('LIB', lib_path)
|
||||
env.PrependENVPath('PATH', exe_path)
|
||||
except (SCons.Util.RegError, SCons.Errors.InternalError):
|
||||
pass
|
||||
|
||||
def exists(env):
|
||||
if not msvc_sa.exits(env):
|
||||
return 0
|
||||
if not mslib_sa.exits(env):
|
||||
return 0
|
||||
if not mslink_sa.exits(env):
|
||||
return 0
|
||||
return 1
|
||||
|
||||
# vim:set ts=4 sw=4 et:
|
||||
@@ -0,0 +1,323 @@
|
||||
"""gallium
|
||||
|
||||
Frontend-tool for Gallium3D architecture.
|
||||
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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, sub license, 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 NON-INFRINGEMENT.
|
||||
# IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
|
||||
#
|
||||
|
||||
|
||||
import os.path
|
||||
|
||||
import SCons.Action
|
||||
import SCons.Builder
|
||||
|
||||
|
||||
def quietCommandLines(env):
|
||||
# Quiet command lines
|
||||
# See also http://www.scons.org/wiki/HidingCommandLinesInOutput
|
||||
env['CCCOMSTR'] = "Compiling $SOURCE ..."
|
||||
env['CXXCOMSTR'] = "Compiling $SOURCE ..."
|
||||
env['ARCOMSTR'] = "Archiving $TARGET ..."
|
||||
env['RANLIBCOMSTR'] = ""
|
||||
env['LINKCOMSTR'] = "Linking $TARGET ..."
|
||||
|
||||
|
||||
def createConvenienceLibBuilder(env):
|
||||
"""This is a utility function that creates the ConvenienceLibrary
|
||||
Builder in an Environment if it is not there already.
|
||||
|
||||
If it is already there, we return the existing one.
|
||||
|
||||
Based on the stock StaticLibrary and SharedLibrary builders.
|
||||
"""
|
||||
|
||||
try:
|
||||
convenience_lib = env['BUILDERS']['ConvenienceLibrary']
|
||||
except KeyError:
|
||||
action_list = [ SCons.Action.Action("$ARCOM", "$ARCOMSTR") ]
|
||||
if env.Detect('ranlib'):
|
||||
ranlib_action = SCons.Action.Action("$RANLIBCOM", "$RANLIBCOMSTR")
|
||||
action_list.append(ranlib_action)
|
||||
|
||||
convenience_lib = SCons.Builder.Builder(action = action_list,
|
||||
emitter = '$LIBEMITTER',
|
||||
prefix = '$LIBPREFIX',
|
||||
suffix = '$LIBSUFFIX',
|
||||
src_suffix = '$SHOBJSUFFIX',
|
||||
src_builder = 'SharedObject')
|
||||
env['BUILDERS']['ConvenienceLibrary'] = convenience_lib
|
||||
env['BUILDERS']['Library'] = convenience_lib
|
||||
|
||||
return convenience_lib
|
||||
|
||||
|
||||
def generate(env):
|
||||
"""Common environment generation code"""
|
||||
|
||||
# FIXME: this is already too late
|
||||
#if env.get('quiet', False):
|
||||
# quietCommandLines(env)
|
||||
|
||||
# shortcuts
|
||||
debug = env['debug']
|
||||
machine = env['machine']
|
||||
platform = env['platform']
|
||||
x86 = env['machine'] == 'x86'
|
||||
gcc = env['platform'] in ('linux', 'freebsd', 'darwin')
|
||||
msvc = env['platform'] in ('windows', 'winddk', 'wince')
|
||||
|
||||
# Tool
|
||||
if platform == 'winddk':
|
||||
env.Tool('winddk')
|
||||
elif platform == 'wince':
|
||||
env.Tool('evc')
|
||||
else:
|
||||
env.Tool('default')
|
||||
|
||||
# Put build output in a separate dir, which depends on the current
|
||||
# configuration. See also http://www.scons.org/wiki/AdvancedBuildExample
|
||||
build_topdir = 'build'
|
||||
build_subdir = env['platform']
|
||||
if env['dri']:
|
||||
build_subdir += "-dri"
|
||||
if env['llvm']:
|
||||
build_subdir += "-llvm"
|
||||
if env['machine'] != 'generic':
|
||||
build_subdir += '-' + env['machine']
|
||||
if env['debug']:
|
||||
build_subdir += "-debug"
|
||||
if env['profile']:
|
||||
build_subdir += "-profile"
|
||||
build_dir = os.path.join(build_topdir, build_subdir)
|
||||
# Place the .sconsign file in the build dir too, to avoid issues with
|
||||
# different scons versions building the same source file
|
||||
env['build'] = build_dir
|
||||
env.SConsignFile(os.path.join(build_dir, '.sconsign'))
|
||||
|
||||
# C preprocessor options
|
||||
cppdefines = []
|
||||
if debug:
|
||||
cppdefines += ['DEBUG']
|
||||
else:
|
||||
cppdefines += ['NDEBUG']
|
||||
if env['profile']:
|
||||
cppdefines += ['PROFILE']
|
||||
if platform == 'windows':
|
||||
cppdefines += [
|
||||
'WIN32',
|
||||
'_WINDOWS',
|
||||
'_UNICODE',
|
||||
'UNICODE',
|
||||
# http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx,
|
||||
'WIN32_LEAN_AND_MEAN',
|
||||
'VC_EXTRALEAN',
|
||||
'_CRT_SECURE_NO_DEPRECATE',
|
||||
]
|
||||
if debug:
|
||||
cppdefines += ['_DEBUG']
|
||||
if platform == 'winddk':
|
||||
# Mimic WINDDK's builtin flags. See also:
|
||||
# - WINDDK's bin/makefile.new i386mk.inc for more info.
|
||||
# - buildchk_wxp_x86.log files, generated by the WINDDK's build
|
||||
# - http://alter.org.ua/docs/nt_kernel/vc8_proj/
|
||||
cppdefines += [
|
||||
('_X86_', '1'),
|
||||
('i386', '1'),
|
||||
'STD_CALL',
|
||||
('CONDITION_HANDLING', '1'),
|
||||
('NT_INST', '0'),
|
||||
('WIN32', '100'),
|
||||
('_NT1X_', '100'),
|
||||
('WINNT', '1'),
|
||||
('_WIN32_WINNT', '0x0501'), # minimum required OS version
|
||||
('WINVER', '0x0501'),
|
||||
('_WIN32_IE', '0x0603'),
|
||||
('WIN32_LEAN_AND_MEAN', '1'),
|
||||
('DEVL', '1'),
|
||||
('__BUILDMACHINE__', 'WinDDK'),
|
||||
('FPO', '0'),
|
||||
]
|
||||
if debug:
|
||||
cppdefines += [('DBG', 1)]
|
||||
if platform == 'wince':
|
||||
cppdefines += [
|
||||
('_WIN32_WCE', '500'),
|
||||
'WCE_PLATFORM_STANDARDSDK_500',
|
||||
'_i386_',
|
||||
('UNDER_CE', '500'),
|
||||
'UNICODE',
|
||||
'_UNICODE',
|
||||
'_X86_',
|
||||
'x86',
|
||||
'_USRDLL',
|
||||
'TEST_EXPORTS' ,
|
||||
]
|
||||
if platform == 'windows':
|
||||
cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_USER']
|
||||
if platform == 'winddk':
|
||||
cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_DISPLAY']
|
||||
if platform == 'wince':
|
||||
cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE']
|
||||
env.Append(CPPDEFINES = cppdefines)
|
||||
|
||||
# C preprocessor includes
|
||||
if platform == 'winddk':
|
||||
env.Append(CPPPATH = [
|
||||
env['SDK_INC_PATH'],
|
||||
env['DDK_INC_PATH'],
|
||||
env['WDM_INC_PATH'],
|
||||
env['CRT_INC_PATH'],
|
||||
])
|
||||
|
||||
# C compiler options
|
||||
cflags = []
|
||||
if gcc:
|
||||
if debug:
|
||||
cflags += ['-O0', '-g3']
|
||||
else:
|
||||
cflags += ['-O3', '-g3']
|
||||
if env['profile']:
|
||||
cflags += ['-pg']
|
||||
if env['machine'] == 'x86':
|
||||
cflags += ['-m32']
|
||||
if env['machine'] == 'x86_64':
|
||||
cflags += ['-m64']
|
||||
cflags += [
|
||||
'-Wall',
|
||||
'-Wmissing-prototypes',
|
||||
'-Wno-long-long',
|
||||
'-ffast-math',
|
||||
'-pedantic',
|
||||
'-fmessage-length=0', # be nice to Eclipse
|
||||
]
|
||||
if msvc:
|
||||
# See also:
|
||||
# - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
|
||||
# - cl /?
|
||||
if debug:
|
||||
cflags += [
|
||||
'/Od', # disable optimizations
|
||||
'/Oi', # enable intrinsic functions
|
||||
'/Oy-', # disable frame pointer omission
|
||||
]
|
||||
else:
|
||||
cflags += [
|
||||
'/Ox', # maximum optimizations
|
||||
'/Oi', # enable intrinsic functions
|
||||
'/Os', # favor code space
|
||||
]
|
||||
if env['profile']:
|
||||
cflags += [
|
||||
'/Gh', # enable _penter hook function
|
||||
'/GH', # enable _pexit hook function
|
||||
]
|
||||
cflags += [
|
||||
'/W3', # warning level
|
||||
#'/Wp64', # enable 64 bit porting warnings
|
||||
]
|
||||
if platform == 'windows':
|
||||
cflags += [
|
||||
# TODO
|
||||
]
|
||||
if platform == 'winddk':
|
||||
cflags += [
|
||||
'/Zl', # omit default library name in .OBJ
|
||||
'/Zp8', # 8bytes struct member alignment
|
||||
'/Gy', # separate functions for linker
|
||||
'/Gm-', # disable minimal rebuild
|
||||
'/WX', # treat warnings as errors
|
||||
'/Gz', # __stdcall Calling convention
|
||||
'/GX-', # disable C++ EH
|
||||
'/GR-', # disable C++ RTTI
|
||||
'/GF', # enable read-only string pooling
|
||||
'/G6', # optimize for PPro, P-II, P-III
|
||||
'/Ze', # enable extensions
|
||||
'/Gi-', # disable incremental compilation
|
||||
'/QIfdiv-', # disable Pentium FDIV fix
|
||||
'/hotpatch', # prepares an image for hotpatching.
|
||||
#'/Z7', #enable old-style debug info
|
||||
]
|
||||
if platform == 'wince':
|
||||
cflags += [
|
||||
'/Gs8192',
|
||||
'/GF', # enable read-only string pooling
|
||||
]
|
||||
# Automatic pdb generation
|
||||
# See http://scons.tigris.org/issues/show_bug.cgi?id=1656
|
||||
env.EnsureSConsVersion(0, 98, 0)
|
||||
env['PDB'] = '${TARGET.base}.pdb'
|
||||
env.Append(CFLAGS = cflags)
|
||||
env.Append(CXXFLAGS = cflags)
|
||||
|
||||
# Linker options
|
||||
linkflags = []
|
||||
if gcc:
|
||||
if env['machine'] == 'x86':
|
||||
linkflags += ['-m32']
|
||||
if env['machine'] == 'x86_64':
|
||||
linkflags += ['-m64']
|
||||
if platform == 'winddk':
|
||||
# See also:
|
||||
# - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
|
||||
linkflags += [
|
||||
'/merge:_PAGE=PAGE',
|
||||
'/merge:_TEXT=.text',
|
||||
'/section:INIT,d',
|
||||
'/opt:ref',
|
||||
'/opt:icf',
|
||||
'/ignore:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221',
|
||||
'/incremental:no',
|
||||
'/fullbuild',
|
||||
'/release',
|
||||
'/nodefaultlib',
|
||||
'/wx',
|
||||
'/debug',
|
||||
'/debugtype:cv',
|
||||
'/version:5.1',
|
||||
'/osversion:5.1',
|
||||
'/functionpadmin:5',
|
||||
'/safeseh',
|
||||
'/pdbcompress',
|
||||
'/stack:0x40000,0x1000',
|
||||
'/driver',
|
||||
'/align:0x80',
|
||||
'/subsystem:native,5.01',
|
||||
'/base:0x10000',
|
||||
|
||||
'/entry:DrvEnableDriver',
|
||||
]
|
||||
env.Append(LINKFLAGS = linkflags)
|
||||
|
||||
# Convenience Library Builder
|
||||
createConvenienceLibBuilder(env)
|
||||
|
||||
# for debugging
|
||||
#print env.Dump()
|
||||
|
||||
|
||||
def exists(env):
|
||||
return 1
|
||||
@@ -0,0 +1,49 @@
|
||||
"""mslib_sa
|
||||
|
||||
Tool-specific initialization for lib (MicroSoft library archiver).
|
||||
|
||||
Based on SCons.Tool.mslib, without the MSVC detection.
|
||||
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation
|
||||
#
|
||||
# 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 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.
|
||||
#
|
||||
|
||||
import SCons.Defaults
|
||||
import SCons.Tool
|
||||
import SCons.Util
|
||||
|
||||
def generate(env):
|
||||
"""Add Builders and construction variables for lib to an Environment."""
|
||||
SCons.Tool.createStaticLibBuilder(env)
|
||||
|
||||
env['AR'] = 'lib'
|
||||
env['ARFLAGS'] = SCons.Util.CLVar('/nologo')
|
||||
env['ARCOM'] = "${TEMPFILE('$AR $ARFLAGS /OUT:$TARGET $SOURCES')}"
|
||||
env['LIBPREFIX'] = ''
|
||||
env['LIBSUFFIX'] = '.lib'
|
||||
|
||||
def exists(env):
|
||||
return env.Detect('lib')
|
||||
|
||||
# vim:set ts=4 sw=4 et:
|
||||
@@ -0,0 +1,211 @@
|
||||
"""mslink_sa
|
||||
|
||||
Tool-specific initialization for the Microsoft linker.
|
||||
|
||||
Based on SCons.Tool.mslink, without the MSVS detection.
|
||||
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation
|
||||
#
|
||||
# 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 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.
|
||||
#
|
||||
|
||||
import os.path
|
||||
|
||||
import SCons.Action
|
||||
import SCons.Defaults
|
||||
import SCons.Errors
|
||||
import SCons.Platform.win32
|
||||
import SCons.Tool
|
||||
import SCons.Tool.msvc
|
||||
import SCons.Util
|
||||
|
||||
def pdbGenerator(env, target, source, for_signature):
|
||||
try:
|
||||
return ['/PDB:%s' % target[0].attributes.pdb, '/DEBUG']
|
||||
except (AttributeError, IndexError):
|
||||
return None
|
||||
|
||||
def windowsShlinkTargets(target, source, env, for_signature):
|
||||
listCmd = []
|
||||
dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX')
|
||||
if dll: listCmd.append("/out:%s"%dll.get_string(for_signature))
|
||||
|
||||
implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX')
|
||||
if implib: listCmd.append("/implib:%s"%implib.get_string(for_signature))
|
||||
|
||||
return listCmd
|
||||
|
||||
def windowsShlinkSources(target, source, env, for_signature):
|
||||
listCmd = []
|
||||
|
||||
deffile = env.FindIxes(source, "WINDOWSDEFPREFIX", "WINDOWSDEFSUFFIX")
|
||||
for src in source:
|
||||
if src == deffile:
|
||||
# Treat this source as a .def file.
|
||||
listCmd.append("/def:%s" % src.get_string(for_signature))
|
||||
else:
|
||||
# Just treat it as a generic source file.
|
||||
listCmd.append(src)
|
||||
return listCmd
|
||||
|
||||
def windowsLibEmitter(target, source, env):
|
||||
SCons.Tool.msvc.validate_vars(env)
|
||||
|
||||
extratargets = []
|
||||
extrasources = []
|
||||
|
||||
dll = env.FindIxes(target, "SHLIBPREFIX", "SHLIBSUFFIX")
|
||||
no_import_lib = env.get('no_import_lib', 0)
|
||||
|
||||
if not dll:
|
||||
raise SCons.Errors.UserError, "A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX")
|
||||
|
||||
insert_def = env.subst("$WINDOWS_INSERT_DEF")
|
||||
if not insert_def in ['', '0', 0] and \
|
||||
not env.FindIxes(source, "WINDOWSDEFPREFIX", "WINDOWSDEFSUFFIX"):
|
||||
|
||||
# append a def file to the list of sources
|
||||
extrasources.append(
|
||||
env.ReplaceIxes(dll,
|
||||
"SHLIBPREFIX", "SHLIBSUFFIX",
|
||||
"WINDOWSDEFPREFIX", "WINDOWSDEFSUFFIX"))
|
||||
|
||||
if env.has_key('PDB') and env['PDB']:
|
||||
pdb = env.arg2nodes('$PDB', target=target, source=source)[0]
|
||||
extratargets.append(pdb)
|
||||
target[0].attributes.pdb = pdb
|
||||
|
||||
if not no_import_lib and \
|
||||
not env.FindIxes(target, "LIBPREFIX", "LIBSUFFIX"):
|
||||
# Append an import library to the list of targets.
|
||||
extratargets.append(
|
||||
env.ReplaceIxes(dll,
|
||||
"SHLIBPREFIX", "SHLIBSUFFIX",
|
||||
"LIBPREFIX", "LIBSUFFIX"))
|
||||
# and .exp file is created if there are exports from a DLL
|
||||
extratargets.append(
|
||||
env.ReplaceIxes(dll,
|
||||
"SHLIBPREFIX", "SHLIBSUFFIX",
|
||||
"WINDOWSEXPPREFIX", "WINDOWSEXPSUFFIX"))
|
||||
|
||||
return (target+extratargets, source+extrasources)
|
||||
|
||||
def prog_emitter(target, source, env):
|
||||
SCons.Tool.msvc.validate_vars(env)
|
||||
|
||||
extratargets = []
|
||||
|
||||
exe = env.FindIxes(target, "PROGPREFIX", "PROGSUFFIX")
|
||||
if not exe:
|
||||
raise SCons.Errors.UserError, "An executable should have exactly one target with the suffix: %s" % env.subst("$PROGSUFFIX")
|
||||
|
||||
if env.has_key('PDB') and env['PDB']:
|
||||
pdb = env.arg2nodes('$PDB', target=target, source=source)[0]
|
||||
extratargets.append(pdb)
|
||||
target[0].attributes.pdb = pdb
|
||||
|
||||
return (target+extratargets,source)
|
||||
|
||||
def RegServerFunc(target, source, env):
|
||||
if env.has_key('register') and env['register']:
|
||||
ret = regServerAction([target[0]], [source[0]], env)
|
||||
if ret:
|
||||
raise SCons.Errors.UserError, "Unable to register %s" % target[0]
|
||||
else:
|
||||
print "Registered %s sucessfully" % target[0]
|
||||
return ret
|
||||
return 0
|
||||
|
||||
regServerAction = SCons.Action.Action("$REGSVRCOM", "$REGSVRCOMSTR")
|
||||
regServerCheck = SCons.Action.Action(RegServerFunc, None)
|
||||
shlibLinkAction = SCons.Action.Action('${TEMPFILE("$SHLINK $SHLINKFLAGS $_SHLINK_TARGETS $( $_LIBDIRFLAGS $) $_LIBFLAGS $_PDB $_SHLINK_SOURCES")}')
|
||||
compositeLinkAction = shlibLinkAction + regServerCheck
|
||||
|
||||
def generate(env):
|
||||
"""Add Builders and construction variables for ar to an Environment."""
|
||||
SCons.Tool.createSharedLibBuilder(env)
|
||||
SCons.Tool.createProgBuilder(env)
|
||||
|
||||
env['SHLINK'] = '$LINK'
|
||||
env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS /dll')
|
||||
env['_SHLINK_TARGETS'] = windowsShlinkTargets
|
||||
env['_SHLINK_SOURCES'] = windowsShlinkSources
|
||||
env['SHLINKCOM'] = compositeLinkAction
|
||||
env.Append(SHLIBEMITTER = [windowsLibEmitter])
|
||||
env['LINK'] = 'link'
|
||||
env['LINKFLAGS'] = SCons.Util.CLVar('/nologo')
|
||||
env['_PDB'] = pdbGenerator
|
||||
env['LINKCOM'] = '${TEMPFILE("$LINK $LINKFLAGS /OUT:$TARGET.windows $( $_LIBDIRFLAGS $) $_LIBFLAGS $_PDB $SOURCES.windows")}'
|
||||
env.Append(PROGEMITTER = [prog_emitter])
|
||||
env['LIBDIRPREFIX']='/LIBPATH:'
|
||||
env['LIBDIRSUFFIX']=''
|
||||
env['LIBLINKPREFIX']=''
|
||||
env['LIBLINKSUFFIX']='$LIBSUFFIX'
|
||||
|
||||
env['WIN32DEFPREFIX'] = ''
|
||||
env['WIN32DEFSUFFIX'] = '.def'
|
||||
env['WIN32_INSERT_DEF'] = 0
|
||||
env['WINDOWSDEFPREFIX'] = '${WIN32DEFPREFIX}'
|
||||
env['WINDOWSDEFSUFFIX'] = '${WIN32DEFSUFFIX}'
|
||||
env['WINDOWS_INSERT_DEF'] = '${WIN32_INSERT_DEF}'
|
||||
|
||||
env['WIN32EXPPREFIX'] = ''
|
||||
env['WIN32EXPSUFFIX'] = '.exp'
|
||||
env['WINDOWSEXPPREFIX'] = '${WIN32EXPPREFIX}'
|
||||
env['WINDOWSEXPSUFFIX'] = '${WIN32EXPSUFFIX}'
|
||||
|
||||
env['WINDOWSSHLIBMANIFESTPREFIX'] = ''
|
||||
env['WINDOWSSHLIBMANIFESTSUFFIX'] = '${SHLIBSUFFIX}.manifest'
|
||||
env['WINDOWSPROGMANIFESTPREFIX'] = ''
|
||||
env['WINDOWSPROGMANIFESTSUFFIX'] = '${PROGSUFFIX}.manifest'
|
||||
|
||||
env['REGSVRACTION'] = regServerCheck
|
||||
env['REGSVR'] = os.path.join(SCons.Platform.win32.get_system_root(),'System32','regsvr32')
|
||||
env['REGSVRFLAGS'] = '/s '
|
||||
env['REGSVRCOM'] = '$REGSVR $REGSVRFLAGS ${TARGET.windows}'
|
||||
|
||||
# For most platforms, a loadable module is the same as a shared
|
||||
# library. Platforms which are different can override these, but
|
||||
# setting them the same means that LoadableModule works everywhere.
|
||||
SCons.Tool.createLoadableModuleBuilder(env)
|
||||
env['LDMODULE'] = '$SHLINK'
|
||||
env['LDMODULEPREFIX'] = '$SHLIBPREFIX'
|
||||
env['LDMODULESUFFIX'] = '$SHLIBSUFFIX'
|
||||
env['LDMODULEFLAGS'] = '$SHLINKFLAGS'
|
||||
# We can't use '$SHLINKCOM' here because that will stringify the
|
||||
# action list on expansion, and will then try to execute expanded
|
||||
# strings, with the upshot that it would try to execute RegServerFunc
|
||||
# as a command.
|
||||
env['LDMODULECOM'] = compositeLinkAction
|
||||
|
||||
def exists(env):
|
||||
platform = env.get('PLATFORM', '')
|
||||
if platform in ('win32', 'cygwin'):
|
||||
# Only explicitly search for a 'link' executable on Windows
|
||||
# systems. Some other systems (e.g. Ubuntu Linux) have an
|
||||
# executable named 'link' and we don't want that to make SCons
|
||||
# think Visual Studio is installed.
|
||||
return env.Detect('link')
|
||||
return None
|
||||
|
||||
# vim:set ts=4 sw=4 et:
|
||||
@@ -1,18 +1,13 @@
|
||||
"""winddk
|
||||
"""msvc_sa
|
||||
|
||||
Tool-specific initialization for Microsoft Windows DDK.
|
||||
Tool-specific initialization for Microsoft Visual C/C++.
|
||||
|
||||
Based on engine.SCons.Tool.msvc.
|
||||
|
||||
There normally shouldn't be any need to import this module directly.
|
||||
It will usually be imported through the generic SCons.Tool.Tool()
|
||||
selection method.
|
||||
Based on SCons.Tool.msvc, without the MSVS detection.
|
||||
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001-2007 The SCons Foundation
|
||||
# Copyright (c) 2008 Tungsten Graphics, Inc.
|
||||
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
@@ -43,52 +38,12 @@ import SCons.Builder
|
||||
import SCons.Errors
|
||||
import SCons.Platform.win32
|
||||
import SCons.Tool
|
||||
import SCons.Tool.mslib
|
||||
import SCons.Tool.mslink
|
||||
import SCons.Util
|
||||
import SCons.Warnings
|
||||
|
||||
CSuffixes = ['.c', '.C']
|
||||
CXXSuffixes = ['.cc', '.cpp', '.cxx', '.c++', '.C++']
|
||||
|
||||
def get_winddk_paths(env, version=None):
|
||||
"""Return a 3-tuple of (INCLUDE, LIB, PATH) as the values
|
||||
of those three environment variables that should be set
|
||||
in order to execute the MSVC tools properly."""
|
||||
|
||||
WINDDKdir = None
|
||||
exe_paths = []
|
||||
lib_paths = []
|
||||
include_paths = []
|
||||
|
||||
if 'BASEDIR' in os.environ:
|
||||
WINDDKdir = os.environ['BASEDIR']
|
||||
else:
|
||||
WINDDKdir = "C:\\WINDDK\\3790.1830"
|
||||
|
||||
exe_paths.append( os.path.join(WINDDKdir, 'bin') )
|
||||
exe_paths.append( os.path.join(WINDDKdir, 'bin', 'x86') )
|
||||
include_paths.append( os.path.join(WINDDKdir, 'inc', 'wxp') )
|
||||
lib_paths.append( os.path.join(WINDDKdir, 'lib') )
|
||||
|
||||
target_os = 'wxp'
|
||||
target_cpu = 'i386'
|
||||
|
||||
env['SDK_INC_PATH'] = os.path.join(WINDDKdir, 'inc', target_os)
|
||||
env['CRT_INC_PATH'] = os.path.join(WINDDKdir, 'inc', 'crt')
|
||||
env['DDK_INC_PATH'] = os.path.join(WINDDKdir, 'inc', 'ddk', target_os)
|
||||
env['WDM_INC_PATH'] = os.path.join(WINDDKdir, 'inc', 'ddk', 'wdm', target_os)
|
||||
|
||||
env['SDK_LIB_PATH'] = os.path.join(WINDDKdir, 'lib', target_os, target_cpu)
|
||||
env['CRT_LIB_PATH'] = os.path.join(WINDDKdir, 'lib', 'crt', target_cpu)
|
||||
env['DDK_LIB_PATH'] = os.path.join(WINDDKdir, 'lib', target_os, target_cpu)
|
||||
env['WDM_LIB_PATH'] = os.path.join(WINDDKdir, 'lib', target_os, target_cpu)
|
||||
|
||||
include_path = string.join( include_paths, os.pathsep )
|
||||
lib_path = string.join(lib_paths, os.pathsep )
|
||||
exe_path = string.join(exe_paths, os.pathsep )
|
||||
return (include_path, lib_path, exe_path)
|
||||
|
||||
def validate_vars(env):
|
||||
"""Validate the PCH and PCHSTOP construction variables."""
|
||||
if env.has_key('PCH') and env['PCH']:
|
||||
@@ -207,30 +162,12 @@ def generate(env):
|
||||
env['PCHCOM'] = '$CXX $CXXFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo${TARGETS[1]} /Yc$PCHSTOP /Fp${TARGETS[0]} $CCPDBFLAGS $PCHPDBFLAGS'
|
||||
env['BUILDERS']['PCH'] = pch_builder
|
||||
|
||||
env['AR'] = 'lib'
|
||||
env['ARFLAGS'] = SCons.Util.CLVar('/nologo')
|
||||
env['ARCOM'] = "${TEMPFILE('$AR $ARFLAGS /OUT:$TARGET $SOURCES')}"
|
||||
env['LIBPREFIX'] = ''
|
||||
env['LIBSUFFIX'] = '.lib'
|
||||
|
||||
SCons.Tool.mslink.generate(env)
|
||||
|
||||
if not env.has_key('ENV'):
|
||||
env['ENV'] = {}
|
||||
|
||||
try:
|
||||
include_path, lib_path, exe_path = get_winddk_paths(env)
|
||||
|
||||
# since other tools can set these, we just make sure that the
|
||||
# relevant stuff from WINDDK is in there somewhere.
|
||||
env.PrependENVPath('INCLUDE', include_path)
|
||||
env.PrependENVPath('LIB', lib_path)
|
||||
env.PrependENVPath('PATH', exe_path)
|
||||
except (SCons.Util.RegError, SCons.Errors.InternalError):
|
||||
pass
|
||||
|
||||
if not env['ENV'].has_key('SystemRoot'): # required for dlls in the winsxs folders
|
||||
env['ENV']['SystemRoot'] = SCons.Platform.win32.get_system_root()
|
||||
|
||||
def exists(env):
|
||||
return env.Detect('cl')
|
||||
|
||||
# vim:set sw=4 et:
|
||||
# vim:set ts=4 sw=4 et:
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
"""winddk
|
||||
|
||||
Tool-specific initialization for Microsoft Windows DDK.
|
||||
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2001-2007 The SCons Foundation
|
||||
# Copyright (c) 2008 Tungsten Graphics, Inc.
|
||||
#
|
||||
# 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 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.
|
||||
#
|
||||
|
||||
import os.path
|
||||
import re
|
||||
import string
|
||||
|
||||
import SCons.Action
|
||||
import SCons.Builder
|
||||
import SCons.Errors
|
||||
import SCons.Platform.win32
|
||||
import SCons.Tool
|
||||
import SCons.Util
|
||||
import SCons.Warnings
|
||||
|
||||
import msvc_sa
|
||||
import mslib_sa
|
||||
import mslink_sa
|
||||
|
||||
def get_winddk_paths(env, version=None):
|
||||
"""Return a 3-tuple of (INCLUDE, LIB, PATH) as the values
|
||||
of those three environment variables that should be set
|
||||
in order to execute the MSVC tools properly."""
|
||||
|
||||
WINDDKdir = None
|
||||
exe_paths = []
|
||||
lib_paths = []
|
||||
include_paths = []
|
||||
|
||||
if 'BASEDIR' in os.environ:
|
||||
WINDDKdir = os.environ['BASEDIR']
|
||||
else:
|
||||
WINDDKdir = "C:\\WINDDK\\3790.1830"
|
||||
|
||||
exe_paths.append( os.path.join(WINDDKdir, 'bin') )
|
||||
exe_paths.append( os.path.join(WINDDKdir, 'bin', 'x86') )
|
||||
include_paths.append( os.path.join(WINDDKdir, 'inc', 'wxp') )
|
||||
lib_paths.append( os.path.join(WINDDKdir, 'lib') )
|
||||
|
||||
target_os = 'wxp'
|
||||
target_cpu = 'i386'
|
||||
|
||||
env['SDK_INC_PATH'] = os.path.join(WINDDKdir, 'inc', target_os)
|
||||
env['CRT_INC_PATH'] = os.path.join(WINDDKdir, 'inc', 'crt')
|
||||
env['DDK_INC_PATH'] = os.path.join(WINDDKdir, 'inc', 'ddk', target_os)
|
||||
env['WDM_INC_PATH'] = os.path.join(WINDDKdir, 'inc', 'ddk', 'wdm', target_os)
|
||||
|
||||
env['SDK_LIB_PATH'] = os.path.join(WINDDKdir, 'lib', target_os, target_cpu)
|
||||
env['CRT_LIB_PATH'] = os.path.join(WINDDKdir, 'lib', 'crt', target_cpu)
|
||||
env['DDK_LIB_PATH'] = os.path.join(WINDDKdir, 'lib', target_os, target_cpu)
|
||||
env['WDM_LIB_PATH'] = os.path.join(WINDDKdir, 'lib', target_os, target_cpu)
|
||||
|
||||
include_path = string.join( include_paths, os.pathsep )
|
||||
lib_path = string.join(lib_paths, os.pathsep )
|
||||
exe_path = string.join(exe_paths, os.pathsep )
|
||||
return (include_path, lib_path, exe_path)
|
||||
|
||||
def generate(env):
|
||||
|
||||
msvc_sa.generate(env)
|
||||
mslib_sa.generate(env)
|
||||
mslink_sa.generate(env)
|
||||
|
||||
if not env.has_key('ENV'):
|
||||
env['ENV'] = {}
|
||||
|
||||
try:
|
||||
include_path, lib_path, exe_path = get_winddk_paths(env)
|
||||
|
||||
# since other tools can set these, we just make sure that the
|
||||
# relevant stuff from WINDDK is in there somewhere.
|
||||
env.PrependENVPath('INCLUDE', include_path)
|
||||
env.PrependENVPath('LIB', lib_path)
|
||||
env.PrependENVPath('PATH', exe_path)
|
||||
except (SCons.Util.RegError, SCons.Errors.InternalError):
|
||||
pass
|
||||
|
||||
def exists(env):
|
||||
if not msvc_sa.exits(env):
|
||||
return 0
|
||||
if not mslib_sa.exits(env):
|
||||
return 0
|
||||
if not mslink_sa.exits(env):
|
||||
return 0
|
||||
return 1
|
||||
|
||||
# vim:set ts=4 sw=4 et:
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
TOP = ../..
|
||||
|
||||
SUBDIRS = main drivers/demo drivers/dri
|
||||
SUBDIRS = main drivers
|
||||
|
||||
|
||||
default: subdirs
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
# src/egl/drivers/Makefile
|
||||
|
||||
TOP = ../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
|
||||
SUBDIRS = demo dri xdri
|
||||
|
||||
|
||||
default: conditional_subdirs
|
||||
|
||||
|
||||
# depending on $DRIVER_DIRS...
|
||||
conditional_subdirs:
|
||||
@if [ "${DRIVER_DIRS}" = "dri" ] ; then \
|
||||
$(MAKE) dri_subdirs ; \
|
||||
fi
|
||||
|
||||
|
||||
dri_subdirs:
|
||||
@ (cd dri ; $(MAKE)) || exit 1
|
||||
@ (cd xdri ; $(MAKE)) || exit 1
|
||||
|
||||
demo_subdir:
|
||||
@ (cd demo ; $(MAKE)) || exit 1
|
||||
|
||||
|
||||
|
||||
subdirs:
|
||||
@for dir in $(SUBDIRS) ; do \
|
||||
if [ -d $$dir ] ; then \
|
||||
(cd $$dir ; $(MAKE)) || exit 1 ; \
|
||||
fi \
|
||||
done
|
||||
|
||||
|
||||
clean:
|
||||
@for dir in $(SUBDIRS) ; do \
|
||||
if [ -d $$dir ] ; then \
|
||||
(cd $$dir ; $(MAKE) clean) ; \
|
||||
fi \
|
||||
done
|
||||
@@ -21,7 +21,7 @@
|
||||
typedef struct demo_driver
|
||||
{
|
||||
_EGLDriver Base; /* base class/object */
|
||||
GLuint DemoStuff;
|
||||
unsigned DemoStuff;
|
||||
} DemoDriver;
|
||||
|
||||
#define DEMO_DRIVER(D) ((DemoDriver *) (D))
|
||||
@@ -33,7 +33,7 @@ typedef struct demo_driver
|
||||
typedef struct demo_surface
|
||||
{
|
||||
_EGLSurface Base; /* base class/object */
|
||||
GLuint DemoStuff;
|
||||
unsigned DemoStuff;
|
||||
} DemoSurface;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ typedef struct demo_surface
|
||||
typedef struct demo_context
|
||||
{
|
||||
_EGLContext Base; /* base class/object */
|
||||
GLuint DemoStuff;
|
||||
unsigned DemoStuff;
|
||||
} DemoContext;
|
||||
|
||||
|
||||
@@ -152,9 +152,9 @@ demoCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext
|
||||
|
||||
/* generate handle and insert into hash table */
|
||||
_eglSaveContext(&c->Base);
|
||||
assert(c->Base.Handle);
|
||||
assert(_eglGetContextHandle(&c->Base));
|
||||
|
||||
return c->Base.Handle;
|
||||
return _eglGetContextHandle(&c->Base);
|
||||
}
|
||||
|
||||
|
||||
@@ -286,7 +286,7 @@ demoMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface rea
|
||||
* plug in API functions.
|
||||
*/
|
||||
_EGLDriver *
|
||||
_eglMain(_EGLDisplay *dpy)
|
||||
_eglMain(_EGLDisplay *dpy, const char *args)
|
||||
{
|
||||
DemoDriver *demo;
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@ SOURCES = egldri.c
|
||||
|
||||
OBJECTS = $(SOURCES:.c=.o)
|
||||
|
||||
DRM_LIB = `pkg-config --libs libdrm`
|
||||
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
|
||||
@@ -43,7 +45,7 @@ library: $(TOP)/$(LIB_DIR)/libEGLdri.so
|
||||
|
||||
$(TOP)/$(LIB_DIR)/libEGLdri.so: $(OBJECTS)
|
||||
$(TOP)/bin/mklib -o EGLdri -major 1 -minor 0 \
|
||||
-install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS)
|
||||
-install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) $(DRM_LIB)
|
||||
|
||||
|
||||
clean:
|
||||
@@ -55,7 +57,7 @@ depend: $(SOURCES) $(HEADERS)
|
||||
@ rm -f depend
|
||||
@ touch depend
|
||||
$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \
|
||||
$(SOURCES) $(HEADERS) > /dev/null
|
||||
$(SOURCES) $(HEADERS) >/dev/null 2>/dev/null
|
||||
|
||||
include depend
|
||||
# DO NOT DELETE
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Generic EGL driver for DRI.
|
||||
* Generic EGL driver for DRI. This is basically an "adaptor" driver
|
||||
* that allows libEGL to load/use regular DRI drivers.
|
||||
*
|
||||
* This file contains all the code needed to interface DRI-based drivers
|
||||
* with libEGL.
|
||||
@@ -23,6 +24,7 @@
|
||||
#include "egldisplay.h"
|
||||
#include "eglcontext.h"
|
||||
#include "eglconfig.h"
|
||||
#include "eglconfigutil.h"
|
||||
#include "eglsurface.h"
|
||||
#include "eglscreen.h"
|
||||
#include "eglglobals.h"
|
||||
@@ -32,18 +34,72 @@
|
||||
#include "egldri.h"
|
||||
|
||||
const char *sysfs = "/sys/class";
|
||||
#define None 0
|
||||
|
||||
static const int empty_attribute_list[1] = { None };
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Given a card number, return the name of the DRI driver to use.
|
||||
* This generally means reading the contents of
|
||||
* /sys/class/drm/cardX/dri_library_name, where X is the card number
|
||||
*/
|
||||
static EGLBoolean
|
||||
driver_name_from_card_number(int card, char *driverName, int maxDriverName)
|
||||
{
|
||||
char path[2000];
|
||||
FILE *f;
|
||||
int length;
|
||||
|
||||
snprintf(path, sizeof(path), "%s/drm/card%d/dri_library_name", sysfs, card);
|
||||
|
||||
f = fopen(path, "r");
|
||||
if (!f)
|
||||
return EGL_FALSE;
|
||||
|
||||
fgets(driverName, maxDriverName, f);
|
||||
fclose(f);
|
||||
|
||||
if ((length = strlen(driverName)) > 1) {
|
||||
/* remove the trailing newline from sysfs */
|
||||
driverName[length - 1] = '\0';
|
||||
strncat(driverName, "_dri", maxDriverName);
|
||||
return EGL_TRUE;
|
||||
}
|
||||
else {
|
||||
return EGL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The bootstrap function.
|
||||
* Return a new driDriver object and plug in API functions.
|
||||
* This function, in turn, loads a specific DRI driver (ex: r200_dri.so).
|
||||
*/
|
||||
_EGLDriver *
|
||||
_eglMain(_EGLDisplay *dpy)
|
||||
_eglMain(_EGLDisplay *dpy, const char *args)
|
||||
{
|
||||
#if 1
|
||||
const int card = args ? atoi(args) : 0;
|
||||
_EGLDriver *driver = NULL;
|
||||
char driverName[1000];
|
||||
|
||||
if (!driver_name_from_card_number(card, driverName, sizeof(driverName))) {
|
||||
_eglLog(_EGL_WARNING,
|
||||
"Unable to determine driver name for card %d\n", card);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
_eglLog(_EGL_DEBUG, "Driver name: %s\n", driverName);
|
||||
|
||||
driver = _eglOpenDriver(dpy, driverName, args);
|
||||
|
||||
return driver;
|
||||
|
||||
#else
|
||||
|
||||
int length;
|
||||
char path[NAME_MAX];
|
||||
struct dirent *dirent;
|
||||
@@ -58,14 +114,19 @@ _eglMain(_EGLDisplay *dpy)
|
||||
_eglLog(_EGL_WARNING, "%s DRM devices not found.", path);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
/* loop over dir entries looking for cardX where "X" is in the
|
||||
* dpy->DriverName ":X" string.
|
||||
*/
|
||||
while ((dirent = readdir(dir))) {
|
||||
|
||||
if (strncmp(&dirent->d_name[0], "card", 4) != 0)
|
||||
continue;
|
||||
if (strcmp(&dirent->d_name[4], &dpy->Name[1]) != 0)
|
||||
if (strcmp(&dirent->d_name[4], &driverName[1]) != 0)
|
||||
continue;
|
||||
|
||||
snprintf(path, sizeof(path), "%s/drm/card%s/dri_library_name", sysfs, &dpy->Name[1]);
|
||||
snprintf(path, sizeof(path), "%s/drm/card%s/dri_library_name",
|
||||
sysfs, &driverName[1]);
|
||||
_eglLog(_EGL_INFO, "Opening %s", path);
|
||||
#if 1
|
||||
file = fopen(path, "r");
|
||||
@@ -89,6 +150,7 @@ _eglMain(_EGLDisplay *dpy)
|
||||
closedir(dir);
|
||||
|
||||
return driver;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +203,7 @@ _eglDRICreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
|
||||
/* generate handle and insert into hash table */
|
||||
_eglSaveContext(&c->Base);
|
||||
|
||||
return c->Base.Handle;
|
||||
return _eglGetContextHandle(&c->Base);
|
||||
}
|
||||
|
||||
|
||||
@@ -152,13 +214,15 @@ _eglDRIMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw,
|
||||
driDisplay *disp = Lookup_driDisplay(dpy);
|
||||
driContext *ctx = Lookup_driContext(context);
|
||||
EGLBoolean b;
|
||||
__DRIid drawBuf = (__DRIid) draw;
|
||||
__DRIid readBuf = (__DRIid) read;
|
||||
|
||||
b = _eglMakeCurrent(drv, dpy, draw, read, context);
|
||||
if (!b)
|
||||
return EGL_FALSE;
|
||||
|
||||
if (ctx) {
|
||||
ctx->driContext.bindContext(disp, 0, read, draw, &ctx->driContext);
|
||||
ctx->driContext.bindContext(disp, 0, drawBuf, readBuf, &ctx->driContext);
|
||||
}
|
||||
else {
|
||||
/* what's this??? */
|
||||
@@ -190,7 +254,7 @@ _eglDRICreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
|
||||
#if 0
|
||||
GLcontext *ctx = NULL; /* this _should_ be OK */
|
||||
#endif
|
||||
GLvisual visMode;
|
||||
__GLcontextModes visMode;
|
||||
_EGLConfig *conf = _eglLookupConfig(drv, dpy, config);
|
||||
assert(conf); /* bad config should be caught earlier */
|
||||
_eglConfigToContextModesRec(conf, &visMode);
|
||||
@@ -267,7 +331,8 @@ _eglDRICreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg,
|
||||
_EGLConfig *config = _eglLookupConfig(drv, dpy, cfg);
|
||||
driDisplay *disp = Lookup_driDisplay(dpy);
|
||||
driSurface *surface;
|
||||
GLvisual visMode;
|
||||
__GLcontextModes visMode;
|
||||
__DRIid drawBuf;
|
||||
|
||||
surface = (driSurface *) calloc(1, sizeof(*surface));
|
||||
if (!surface) {
|
||||
@@ -292,8 +357,10 @@ _eglDRICreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg,
|
||||
/* convert EGLConfig to GLvisual */
|
||||
_eglConfigToContextModesRec(config, &visMode);
|
||||
|
||||
drawBuf = (__DRIid) _eglGetSurfaceHandle(&surface->Base);
|
||||
|
||||
/* Create a new DRI drawable */
|
||||
if (!disp->driScreen.createNewDrawable(disp, &visMode, surface->Base.Handle,
|
||||
if (!disp->driScreen.createNewDrawable(disp, &visMode, drawBuf,
|
||||
&surface->drawable, GLX_WINDOW_BIT,
|
||||
empty_attribute_list)) {
|
||||
_eglRemoveSurface(&surface->Base);
|
||||
@@ -715,7 +782,7 @@ __eglGetDrawableInfo(__DRInativeDisplay * ndpy, int screen, __DRIid drawable,
|
||||
{
|
||||
__DRIscreen *pDRIScreen;
|
||||
__DRIscreenPrivate *psp;
|
||||
driSurface *surf = Lookup_driSurface(drawable);
|
||||
driSurface *surf = Lookup_driSurface((EGLSurface) drawable);
|
||||
|
||||
pDRIScreen = __eglFindDRIScreen(ndpy, screen);
|
||||
|
||||
@@ -1019,8 +1086,10 @@ _eglDRICreateDisplay(driDisplay *dpy, __DRIframebuffer *framebuffer)
|
||||
api_ver,
|
||||
& interface_methods,
|
||||
NULL);
|
||||
if (!dpy->driScreen.private)
|
||||
if (!dpy->driScreen.private) {
|
||||
_eglLog(_EGL_WARNING, "egldri.c: DRI create new screen failed");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
DRM_UNLOCK( dpy->drmFD, dpy->pSAREA, dpy->serverContext );
|
||||
|
||||
@@ -1080,6 +1149,7 @@ _eglDRIInitialize(_EGLDriver *drv, EGLDisplay dpy,
|
||||
{
|
||||
_EGLDisplay *disp = _eglLookupDisplay(dpy);
|
||||
driDisplay *display;
|
||||
const char *driverName = (const char *) disp->NativeDisplay;
|
||||
|
||||
assert(disp);
|
||||
|
||||
@@ -1088,13 +1158,13 @@ _eglDRIInitialize(_EGLDriver *drv, EGLDisplay dpy,
|
||||
*/
|
||||
display = calloc(1, sizeof(*display));
|
||||
display->Base = *disp;
|
||||
_eglHashInsert(_eglGlobal.Displays, disp->Handle, display);
|
||||
_eglSaveDisplay(&display->Base);
|
||||
free(disp);
|
||||
|
||||
*major = 1;
|
||||
*minor = 0;
|
||||
|
||||
sscanf(&disp->Name[1], "%d", &display->minor);
|
||||
sscanf(driverName + 1, "%d", &display->minor);
|
||||
|
||||
drv->Initialized = EGL_TRUE;
|
||||
return EGL_TRUE;
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
#ifndef EGLDRI_INCLUDED
|
||||
#define EGLDRI_INCLUDED
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "egldisplay.h"
|
||||
#include "eglscreen.h"
|
||||
#include "eglsurface.h"
|
||||
#include "eglcontext.h"
|
||||
#include "mtypes.h"
|
||||
|
||||
#include "dri_util.h"
|
||||
#include "drm_sarea.h"
|
||||
|
||||
@@ -14,7 +17,7 @@
|
||||
*/
|
||||
typedef struct dri_display
|
||||
{
|
||||
_EGLDisplay Base; /* base class/object */
|
||||
_EGLDisplay Base; /**< base class */
|
||||
void *pFB;
|
||||
int drmFD; /**< \brief DRM device file descriptor */
|
||||
int minor;
|
||||
@@ -32,7 +35,7 @@ typedef struct dri_display
|
||||
unsigned long FBStart; /**< \brief physical address of the framebuffer */
|
||||
void *driverClientMsg;
|
||||
int driverClientMsgSize;
|
||||
int chipset;
|
||||
unsigned chipset;
|
||||
void *driverPrivate;
|
||||
drm_magic_t magic;
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
# src/egl/drivers/xdri/Makefile
|
||||
|
||||
# Build XEGL DRI driver loader library: egl_xdri.so
|
||||
|
||||
|
||||
TOP = ../../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
|
||||
DRIVER_NAME = egl_xdri.so
|
||||
|
||||
|
||||
INCLUDE_DIRS = \
|
||||
-I. \
|
||||
-I/usr/include \
|
||||
-I/usr/include/drm \
|
||||
-I$(TOP)/include \
|
||||
-I$(TOP)/include/GL/internal \
|
||||
-I$(TOP)/src/mesa/glapi \
|
||||
-I$(TOP)/src/mesa/drivers/dri/common \
|
||||
-I$(TOP)/src/egl/main \
|
||||
-I$(TOP)/src/glx/x11
|
||||
|
||||
SOURCES = egl_xdri.c
|
||||
|
||||
OBJECTS = $(SOURCES:.c=.o)
|
||||
|
||||
DRM_LIB = `pkg-config --libs libdrm`
|
||||
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
|
||||
|
||||
|
||||
.PHONY: library
|
||||
|
||||
|
||||
default: depend library Makefile
|
||||
|
||||
|
||||
library: $(TOP)/$(LIB_DIR)/$(DRIVER_NAME)
|
||||
|
||||
|
||||
# Make the egl_xdri.so library
|
||||
$(TOP)/$(LIB_DIR)/$(DRIVER_NAME): $(OBJECTS)
|
||||
$(TOP)/bin/mklib -o $(DRIVER_NAME) \
|
||||
-noprefix \
|
||||
-major 1 -minor 0 \
|
||||
-install $(TOP)/$(LIB_DIR) \
|
||||
-ldl $(OBJECTS) $(DRM_LIB)
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f *.so
|
||||
rm -f depend depend.bak
|
||||
|
||||
|
||||
depend: $(SOURCES) $(HEADERS)
|
||||
@ echo "running $(MKDEP)"
|
||||
@ rm -f depend
|
||||
@ touch depend
|
||||
$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \
|
||||
$(SOURCES) $(HEADERS) >/dev/null 2>/dev/null
|
||||
|
||||
include depend
|
||||
# DO NOT DELETE
|
||||
@@ -0,0 +1,837 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* 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, sub license, 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 NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Code to interface a DRI driver to libEGL.
|
||||
* Note that unlike previous DRI/EGL interfaces, this one is meant to
|
||||
* be used _with_ X. Applications will use eglCreateWindowSurface()
|
||||
* to render into X-created windows.
|
||||
*
|
||||
* This is an EGL driver that, in turn, loads a regular DRI driver.
|
||||
* There are some dependencies on code in libGL, but those coudl be
|
||||
* removed with some effort.
|
||||
*
|
||||
* Authors: Brian Paul
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include "dlfcn.h"
|
||||
#include <X11/Xlib.h>
|
||||
#include <GL/gl.h>
|
||||
#include "xf86dri.h"
|
||||
#include "glxclient.h"
|
||||
#include "dri_util.h"
|
||||
#include "drm_sarea.h"
|
||||
|
||||
#define _EGL_PLATFORM_X
|
||||
|
||||
#include "eglconfig.h"
|
||||
#include "eglcontext.h"
|
||||
#include "egldisplay.h"
|
||||
#include "egldriver.h"
|
||||
#include "eglglobals.h"
|
||||
#include "eglhash.h"
|
||||
#include "egllog.h"
|
||||
#include "eglsurface.h"
|
||||
|
||||
|
||||
|
||||
#define CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))
|
||||
|
||||
|
||||
/** subclass of _EGLDriver */
|
||||
struct xdri_egl_driver
|
||||
{
|
||||
_EGLDriver Base; /**< base class */
|
||||
|
||||
const char *dri_driver_name; /**< name of DRI driver to load */
|
||||
void *dri_driver_handle; /**< returned by dlopen(dri_driver_name) */
|
||||
|
||||
int chipset;
|
||||
int minor;
|
||||
int drmFD;
|
||||
|
||||
__DRIscreen driScreen;
|
||||
__DRIframebuffer framebuffer;
|
||||
drm_handle_t hSAREA;
|
||||
drmAddress pSAREA;
|
||||
char *busID;
|
||||
drm_magic_t magic;
|
||||
};
|
||||
|
||||
|
||||
/** subclass of _EGLContext */
|
||||
struct xdri_egl_context
|
||||
{
|
||||
_EGLContext Base; /**< base class */
|
||||
|
||||
__DRIcontext driContext;
|
||||
};
|
||||
|
||||
|
||||
/** subclass of _EGLSurface */
|
||||
struct xdri_egl_surface
|
||||
{
|
||||
_EGLSurface Base; /**< base class */
|
||||
|
||||
__DRIid driDrawable; /**< DRI surface */
|
||||
drm_drawable_t hDrawable;
|
||||
};
|
||||
|
||||
|
||||
/** subclass of _EGLConfig */
|
||||
struct xdri_egl_config
|
||||
{
|
||||
_EGLConfig Base; /**< base class */
|
||||
|
||||
const __GLcontextModes *mode; /**< corresponding GLX mode */
|
||||
};
|
||||
|
||||
|
||||
/** cast wrapper */
|
||||
static struct xdri_egl_driver *
|
||||
xdri_egl_driver(_EGLDriver *drv)
|
||||
{
|
||||
return (struct xdri_egl_driver *) drv;
|
||||
}
|
||||
|
||||
|
||||
/** Map EGLSurface handle to xdri_egl_surface object */
|
||||
static struct xdri_egl_surface *
|
||||
lookup_surface(EGLSurface surf)
|
||||
{
|
||||
_EGLSurface *surface = _eglLookupSurface(surf);
|
||||
return (struct xdri_egl_surface *) surface;
|
||||
}
|
||||
|
||||
|
||||
/** Map EGLContext handle to xdri_egl_context object */
|
||||
static struct xdri_egl_context *
|
||||
lookup_context(EGLContext c)
|
||||
{
|
||||
_EGLContext *context = _eglLookupContext(c);
|
||||
return (struct xdri_egl_context *) context;
|
||||
}
|
||||
|
||||
|
||||
/** Map EGLConfig handle to xdri_egl_config object */
|
||||
static struct xdri_egl_config *
|
||||
lookup_config(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config)
|
||||
{
|
||||
_EGLConfig *conf = _eglLookupConfig(drv, dpy, config);
|
||||
return (struct xdri_egl_config *) conf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Produce a set of EGL configs.
|
||||
* Note that we get the list of GLcontextModes from the GLX library.
|
||||
* This dependency on GLX lib will be removed someday.
|
||||
*/
|
||||
static void
|
||||
create_configs(_EGLDisplay *disp)
|
||||
{
|
||||
const __GLcontextModes *m;
|
||||
__GLXdisplayPrivate *priv = __glXInitialize(disp->Xdpy);
|
||||
__GLXscreenConfigs *scrn = priv->screenConfigs;
|
||||
int id = 1;
|
||||
|
||||
for (m = scrn->configs; m; m = m->next) {
|
||||
/* EGL requires double-buffered configs */
|
||||
if (m->doubleBufferMode) {
|
||||
struct xdri_egl_config *config = CALLOC_STRUCT(xdri_egl_config);
|
||||
|
||||
_eglInitConfig(&config->Base, id++);
|
||||
|
||||
SET_CONFIG_ATTRIB(&config->Base, EGL_BUFFER_SIZE, m->rgbBits);
|
||||
SET_CONFIG_ATTRIB(&config->Base, EGL_RED_SIZE, m->redBits);
|
||||
SET_CONFIG_ATTRIB(&config->Base, EGL_GREEN_SIZE, m->greenBits);
|
||||
SET_CONFIG_ATTRIB(&config->Base, EGL_BLUE_SIZE, m->blueBits);
|
||||
SET_CONFIG_ATTRIB(&config->Base, EGL_ALPHA_SIZE, m->alphaBits);
|
||||
SET_CONFIG_ATTRIB(&config->Base, EGL_DEPTH_SIZE, m->depthBits);
|
||||
SET_CONFIG_ATTRIB(&config->Base, EGL_STENCIL_SIZE, m->stencilBits);
|
||||
SET_CONFIG_ATTRIB(&config->Base, EGL_NATIVE_VISUAL_ID, m->visualID);
|
||||
SET_CONFIG_ATTRIB(&config->Base, EGL_NATIVE_VISUAL_TYPE, m->visualType);
|
||||
/* XXX only window rendering allowed ATM */
|
||||
SET_CONFIG_ATTRIB(&config->Base, EGL_SURFACE_TYPE, EGL_WINDOW_BIT);
|
||||
|
||||
/* XXX possibly other things to init... */
|
||||
|
||||
/* Ptr from EGL config to GLcontextMode. Used in CreateContext(). */
|
||||
config->mode = m;
|
||||
|
||||
_eglAddConfig(disp, &config->Base);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called via __DRIinterfaceMethods object
|
||||
*/
|
||||
static __DRIfuncPtr
|
||||
dri_get_proc_address(const char * proc_name)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dri_context_modes_destroy(__GLcontextModes *modes)
|
||||
{
|
||||
_eglLog(_EGL_DEBUG, "%s", __FUNCTION__);
|
||||
|
||||
while (modes) {
|
||||
__GLcontextModes * const next = modes->next;
|
||||
free(modes);
|
||||
modes = next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a linked list of 'count' GLcontextModes.
|
||||
* These are used during the client/server visual negotiation phase,
|
||||
* then discarded.
|
||||
*/
|
||||
static __GLcontextModes *
|
||||
dri_context_modes_create(unsigned count, size_t minimum_size)
|
||||
{
|
||||
/* This code copied from libGLX, and modified */
|
||||
const size_t size = (minimum_size > sizeof(__GLcontextModes))
|
||||
? minimum_size : sizeof(__GLcontextModes);
|
||||
__GLcontextModes * head = NULL;
|
||||
__GLcontextModes ** next;
|
||||
unsigned i;
|
||||
|
||||
next = & head;
|
||||
for (i = 0 ; i < count ; i++) {
|
||||
*next = (__GLcontextModes *) calloc(1, size);
|
||||
if (*next == NULL) {
|
||||
dri_context_modes_destroy(head);
|
||||
head = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
(*next)->doubleBufferMode = 1;
|
||||
(*next)->visualID = GLX_DONT_CARE;
|
||||
(*next)->visualType = GLX_DONT_CARE;
|
||||
(*next)->visualRating = GLX_NONE;
|
||||
(*next)->transparentPixel = GLX_NONE;
|
||||
(*next)->transparentRed = GLX_DONT_CARE;
|
||||
(*next)->transparentGreen = GLX_DONT_CARE;
|
||||
(*next)->transparentBlue = GLX_DONT_CARE;
|
||||
(*next)->transparentAlpha = GLX_DONT_CARE;
|
||||
(*next)->transparentIndex = GLX_DONT_CARE;
|
||||
(*next)->xRenderable = GLX_DONT_CARE;
|
||||
(*next)->fbconfigID = GLX_DONT_CARE;
|
||||
(*next)->swapMethod = GLX_SWAP_UNDEFINED_OML;
|
||||
(*next)->bindToTextureRgb = GLX_DONT_CARE;
|
||||
(*next)->bindToTextureRgba = GLX_DONT_CARE;
|
||||
(*next)->bindToMipmapTexture = GLX_DONT_CARE;
|
||||
(*next)->bindToTextureTargets = 0;
|
||||
(*next)->yInverted = GLX_DONT_CARE;
|
||||
|
||||
next = & ((*next)->next);
|
||||
}
|
||||
|
||||
return head;
|
||||
}
|
||||
|
||||
|
||||
static __DRIscreen *
|
||||
dri_find_dri_screen(__DRInativeDisplay *ndpy, int scrn)
|
||||
{
|
||||
/* unused? */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static GLboolean
|
||||
dri_window_exists(__DRInativeDisplay *dpy, __DRIid draw)
|
||||
{
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
static GLboolean
|
||||
dri_create_context(__DRInativeDisplay *dpy, int screenNum, int configID,
|
||||
void * contextID, drm_context_t * hw_context)
|
||||
{
|
||||
assert(configID >= 0);
|
||||
return XF86DRICreateContextWithConfig(dpy, screenNum,
|
||||
configID, contextID, hw_context);
|
||||
}
|
||||
|
||||
|
||||
static GLboolean
|
||||
dri_destroy_context(__DRInativeDisplay * ndpy, int screen, __DRIid context)
|
||||
{
|
||||
return XF86DRIDestroyContext(ndpy, screen, context);
|
||||
}
|
||||
|
||||
|
||||
static GLboolean
|
||||
dri_create_drawable(__DRInativeDisplay * ndpy, int screen,
|
||||
__DRIid drawable, drm_drawable_t * hHWDrawable)
|
||||
{
|
||||
_eglLog(_EGL_DEBUG, "XDRI: %s", __FUNCTION__);
|
||||
|
||||
/* Create DRI drawable for given window ID (drawable) */
|
||||
if (!XF86DRICreateDrawable(ndpy, screen, drawable, hHWDrawable))
|
||||
return EGL_FALSE;
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
static GLboolean
|
||||
dri_destroy_drawable(__DRInativeDisplay * ndpy, int screen, __DRIid drawable)
|
||||
{
|
||||
_eglLog(_EGL_DEBUG, "XDRI: %s", __FUNCTION__);
|
||||
return XF86DRIDestroyDrawable(ndpy, screen, drawable);
|
||||
}
|
||||
|
||||
|
||||
static GLboolean
|
||||
dri_get_drawable_info(__DRInativeDisplay *dpy, int scrn,
|
||||
__DRIid draw, unsigned int * index, unsigned int * stamp,
|
||||
int * x, int * y, int * width, int * height,
|
||||
int * numClipRects, drm_clip_rect_t ** pClipRects,
|
||||
int * backX, int * backY,
|
||||
int * numBackClipRects,
|
||||
drm_clip_rect_t ** pBackClipRects)
|
||||
{
|
||||
_eglLog(_EGL_DEBUG, "XDRI: %s", __FUNCTION__);
|
||||
|
||||
if (!XF86DRIGetDrawableInfo(dpy, scrn, draw, index, stamp,
|
||||
x, y, width, height,
|
||||
numClipRects, pClipRects,
|
||||
backX, backY,
|
||||
numBackClipRects, pBackClipRects)) {
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Table of functions exported by the loader to the driver.
|
||||
*/
|
||||
static const __DRIinterfaceMethods interface_methods = {
|
||||
dri_get_proc_address,
|
||||
|
||||
dri_context_modes_create,
|
||||
dri_context_modes_destroy,
|
||||
|
||||
dri_find_dri_screen,
|
||||
dri_window_exists,
|
||||
|
||||
dri_create_context,
|
||||
dri_destroy_context,
|
||||
|
||||
dri_create_drawable,
|
||||
dri_destroy_drawable,
|
||||
dri_get_drawable_info,
|
||||
|
||||
NULL,/*__eglGetUST,*/
|
||||
NULL,/*__eglGetMSCRate,*/
|
||||
};
|
||||
|
||||
|
||||
|
||||
static EGLBoolean
|
||||
init_drm(struct xdri_egl_driver *xdri_drv, _EGLDisplay *disp)
|
||||
{
|
||||
static const char createNewScreenName[] = "__driCreateNewScreen_20050727";
|
||||
PFNCREATENEWSCREENFUNC createNewScreen;
|
||||
int api_ver = 0;/*__glXGetInternalVersion();*/
|
||||
__DRIversion ddx_version;
|
||||
__DRIversion dri_version;
|
||||
__DRIversion drm_version;
|
||||
drmVersionPtr version;
|
||||
drm_handle_t hFB;
|
||||
int newlyopened;
|
||||
int status;
|
||||
__GLcontextModes *modes;
|
||||
int scrn = DefaultScreen(disp->Xdpy);
|
||||
|
||||
createNewScreen = (PFNCREATENEWSCREENFUNC)
|
||||
dlsym(xdri_drv->dri_driver_handle, createNewScreenName);
|
||||
if (!createNewScreen) {
|
||||
_eglLog(_EGL_WARNING, "XDRI: Couldn't find %s function in the driver.",
|
||||
createNewScreenName);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
else {
|
||||
_eglLog(_EGL_DEBUG, "XDRI: Found %s", createNewScreenName);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the DRI X extension version.
|
||||
*/
|
||||
dri_version.major = 4;
|
||||
dri_version.minor = 0;
|
||||
dri_version.patch = 0;
|
||||
|
||||
|
||||
if (!XF86DRIOpenConnection(disp->Xdpy, scrn,
|
||||
&xdri_drv->hSAREA, &xdri_drv->busID)) {
|
||||
_eglLog(_EGL_WARNING, "XF86DRIOpenConnection failed");
|
||||
}
|
||||
|
||||
xdri_drv->drmFD = drmOpenOnce(NULL, xdri_drv->busID, &newlyopened);
|
||||
if (xdri_drv->drmFD < 0) {
|
||||
perror("drmOpenOnce failed: ");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
else {
|
||||
_eglLog(_EGL_DEBUG, "XDRI: drmOpenOnce returned %d", xdri_drv->drmFD);
|
||||
}
|
||||
|
||||
|
||||
if (drmGetMagic(xdri_drv->drmFD, &xdri_drv->magic)) {
|
||||
perror("drmGetMagic failed: ");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
version = drmGetVersion(xdri_drv->drmFD);
|
||||
if (version) {
|
||||
drm_version.major = version->version_major;
|
||||
drm_version.minor = version->version_minor;
|
||||
drm_version.patch = version->version_patchlevel;
|
||||
drmFreeVersion(version);
|
||||
_eglLog(_EGL_DEBUG, "XDRI: Got DRM version %d.%d.%d",
|
||||
drm_version.major,
|
||||
drm_version.minor,
|
||||
drm_version.patch);
|
||||
}
|
||||
else {
|
||||
drm_version.major = -1;
|
||||
drm_version.minor = -1;
|
||||
drm_version.patch = -1;
|
||||
_eglLog(_EGL_WARNING, "XDRI: drmGetVersion() failed");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
/* Authenticate w/ server.
|
||||
*/
|
||||
if (!XF86DRIAuthConnection(disp->Xdpy, scrn, xdri_drv->magic)) {
|
||||
_eglLog(_EGL_WARNING, "XDRI: XF86DRIAuthConnection() failed");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
else {
|
||||
_eglLog(_EGL_DEBUG, "XDRI: XF86DRIAuthConnection() success");
|
||||
}
|
||||
|
||||
/* Get ddx version.
|
||||
*/
|
||||
{
|
||||
char *driverName;
|
||||
|
||||
/*
|
||||
* Get device name (like "tdfx") and the ddx version
|
||||
* numbers. We'll check the version in each DRI driver's
|
||||
* "createNewScreen" function.
|
||||
*/
|
||||
if (!XF86DRIGetClientDriverName(disp->Xdpy, scrn,
|
||||
&ddx_version.major,
|
||||
&ddx_version.minor,
|
||||
&ddx_version.patch,
|
||||
&driverName)) {
|
||||
_eglLog(_EGL_WARNING, "XDRI: XF86DRIGetClientDriverName failed");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
else {
|
||||
_eglLog(_EGL_DEBUG, "XDRI: XF86DRIGetClientDriverName returned %s", driverName);
|
||||
}
|
||||
}
|
||||
|
||||
/* Get framebuffer info.
|
||||
*/
|
||||
{
|
||||
int junk;
|
||||
if (!XF86DRIGetDeviceInfo(disp->Xdpy, scrn,
|
||||
&hFB,
|
||||
&junk,
|
||||
&xdri_drv->framebuffer.size,
|
||||
&xdri_drv->framebuffer.stride,
|
||||
&xdri_drv->framebuffer.dev_priv_size,
|
||||
&xdri_drv->framebuffer.dev_priv)) {
|
||||
_eglLog(_EGL_WARNING, "XDRI: XF86DRIGetDeviceInfo() failed");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
else {
|
||||
_eglLog(_EGL_DEBUG, "XDRI: XF86DRIGetDeviceInfo() success");
|
||||
}
|
||||
xdri_drv->framebuffer.width = DisplayWidth(disp->Xdpy, scrn);
|
||||
xdri_drv->framebuffer.height = DisplayHeight(disp->Xdpy, scrn);
|
||||
}
|
||||
|
||||
/* Map the framebuffer region. (this may not be needed)
|
||||
*/
|
||||
status = drmMap(xdri_drv->drmFD, hFB, xdri_drv->framebuffer.size,
|
||||
(drmAddressPtr) &xdri_drv->framebuffer.base);
|
||||
if (status != 0) {
|
||||
_eglLog(_EGL_WARNING, "XDRI: drmMap(framebuffer) failed");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
else {
|
||||
_eglLog(_EGL_DEBUG, "XDRI: drmMap(framebuffer) success");
|
||||
}
|
||||
|
||||
/* Map the SAREA region.
|
||||
*/
|
||||
status = drmMap(xdri_drv->drmFD, xdri_drv->hSAREA, SAREA_MAX, &xdri_drv->pSAREA);
|
||||
if (status != 0) {
|
||||
_eglLog(_EGL_WARNING, "XDRI: drmMap(sarea) failed");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
else {
|
||||
_eglLog(_EGL_DEBUG, "XDRI: drmMap(sarea) success");
|
||||
}
|
||||
|
||||
/* Create the DRI screen.
|
||||
*/
|
||||
xdri_drv->driScreen.private = createNewScreen(disp->Xdpy,
|
||||
scrn, /* screen number */
|
||||
&xdri_drv->driScreen,
|
||||
NULL, /* visuals */
|
||||
&ddx_version,
|
||||
&dri_version,
|
||||
&drm_version,
|
||||
&xdri_drv->framebuffer,
|
||||
xdri_drv->pSAREA,
|
||||
xdri_drv->drmFD,
|
||||
api_ver,
|
||||
&interface_methods,
|
||||
&modes);
|
||||
if (!xdri_drv->driScreen.private) {
|
||||
_eglLog(_EGL_WARNING, "XDRI: create new screen failed");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
else {
|
||||
_eglLog(_EGL_DEBUG, "XDRI: create new screen success");
|
||||
}
|
||||
|
||||
create_configs(disp);
|
||||
|
||||
/* print modes / debug */
|
||||
if (0) {
|
||||
__GLcontextModes *m;
|
||||
|
||||
for (m = modes; m; m = m->next) {
|
||||
_eglLog(_EGL_DEBUG,
|
||||
"mode ID 0x%x rgba %d %d %d %d z %d s %d db %d\n", m->visualID,
|
||||
m->redBits, m->greenBits, m->blueBits, m->alphaBits,
|
||||
m->depthBits, m->stencilBits, m->doubleBufferMode);
|
||||
}
|
||||
}
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
static EGLBoolean
|
||||
load_dri_driver(struct xdri_egl_driver *xdri_drv)
|
||||
{
|
||||
char filename[100];
|
||||
int flags = RTLD_NOW;
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s.so", xdri_drv->dri_driver_name);
|
||||
_eglLog(_EGL_DEBUG, "XDRI: dlopen(%s)", filename);
|
||||
|
||||
xdri_drv->dri_driver_handle = dlopen(filename, flags);
|
||||
if (!xdri_drv->dri_driver_handle) {
|
||||
_eglLog(_EGL_WARNING, "XDRI Could not open %s (%s)",
|
||||
filename, dlerror());
|
||||
|
||||
return EGL_FALSE;
|
||||
}
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called via eglInitialize(), xdri_drv->API.Initialize().
|
||||
*/
|
||||
static EGLBoolean
|
||||
xdri_eglInitialize(_EGLDriver *drv, EGLDisplay dpy,
|
||||
EGLint *minor, EGLint *major)
|
||||
{
|
||||
struct xdri_egl_driver *xdri_drv = xdri_egl_driver(drv);
|
||||
_EGLDisplay *disp = _eglLookupDisplay(dpy);
|
||||
static char name[100];
|
||||
|
||||
_eglLog(_EGL_DEBUG, "XDRI: eglInitialize");
|
||||
|
||||
if (!disp->Xdpy) {
|
||||
disp->Xdpy = XOpenDisplay(NULL);
|
||||
if (!disp->Xdpy) {
|
||||
_eglLog(_EGL_WARNING, "XDRI: XOpenDisplay failed");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* choose the DRI driver to load */
|
||||
xdri_drv->dri_driver_name = _eglChooseDRMDriver(0);
|
||||
if (!load_dri_driver(xdri_drv))
|
||||
return EGL_FALSE;
|
||||
|
||||
if (!init_drm(xdri_drv, disp))
|
||||
return EGL_FALSE;
|
||||
|
||||
xdri_drv->Base.Initialized = EGL_TRUE;
|
||||
|
||||
snprintf(name, sizeof(name), "X/DRI:%s", xdri_drv->dri_driver_name);
|
||||
xdri_drv->Base.Name = name;
|
||||
|
||||
/* we're supporting EGL 1.4 */
|
||||
*minor = 1;
|
||||
*major = 4;
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called via eglTerminate(), drv->API.Terminate().
|
||||
*/
|
||||
static EGLBoolean
|
||||
xdri_eglTerminate(_EGLDriver *drv, EGLDisplay dpy)
|
||||
{
|
||||
struct xdri_egl_driver *xdri_drv = xdri_egl_driver(drv);
|
||||
|
||||
_eglLog(_EGL_DEBUG, "XDRI: eglTerminate");
|
||||
|
||||
_eglLog(_EGL_DEBUG, "XDRI: Closing %s", xdri_drv->dri_driver_name);
|
||||
dlclose(xdri_drv->dri_driver_handle);
|
||||
xdri_drv->dri_driver_handle = NULL;
|
||||
|
||||
free((void*) xdri_drv->dri_driver_name);
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called via eglCreateContext(), drv->API.CreateContext().
|
||||
*/
|
||||
static EGLContext
|
||||
xdri_eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
|
||||
EGLContext share_list, const EGLint *attrib_list)
|
||||
{
|
||||
struct xdri_egl_driver *xdri_drv = xdri_egl_driver(drv);
|
||||
_EGLDisplay *disp = _eglLookupDisplay(dpy);
|
||||
struct xdri_egl_config *xdri_config = lookup_config(drv, dpy, config);
|
||||
void *shared = NULL;
|
||||
int renderType = GLX_RGBA_BIT;
|
||||
|
||||
struct xdri_egl_context *xdri_ctx = CALLOC_STRUCT(xdri_egl_context);
|
||||
if (!xdri_ctx)
|
||||
return EGL_NO_CONTEXT;
|
||||
|
||||
if (!_eglInitContext(drv, dpy, &xdri_ctx->Base, config, attrib_list)) {
|
||||
free(xdri_ctx);
|
||||
return EGL_NO_CONTEXT;
|
||||
}
|
||||
|
||||
assert(xdri_config);
|
||||
|
||||
xdri_ctx->driContext.private =
|
||||
xdri_drv->driScreen.createNewContext(disp->Xdpy,
|
||||
xdri_config->mode, renderType,
|
||||
shared, &xdri_ctx->driContext);
|
||||
if (!xdri_ctx->driContext.private) {
|
||||
_eglLog(_EGL_DEBUG, "driScreen.createNewContext failed");
|
||||
free(xdri_ctx);
|
||||
return EGL_NO_CONTEXT;
|
||||
}
|
||||
|
||||
xdri_ctx->driContext.mode = xdri_config->mode;
|
||||
|
||||
return _eglGetContextHandle(&xdri_ctx->Base);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called via eglMakeCurrent(), drv->API.MakeCurrent().
|
||||
*/
|
||||
static EGLBoolean
|
||||
xdri_eglMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface d,
|
||||
EGLSurface r, EGLContext context)
|
||||
{
|
||||
_EGLDisplay *disp = _eglLookupDisplay(dpy);
|
||||
struct xdri_egl_context *xdri_ctx = lookup_context(context);
|
||||
struct xdri_egl_surface *xdri_draw = lookup_surface(d);
|
||||
struct xdri_egl_surface *xdri_read = lookup_surface(r);
|
||||
__DRIid draw = xdri_draw->driDrawable;
|
||||
__DRIid read = xdri_read->driDrawable;
|
||||
int scrn = DefaultScreen(disp->Xdpy);
|
||||
|
||||
if (!_eglMakeCurrent(drv, dpy, d, r, context))
|
||||
return EGL_FALSE;
|
||||
|
||||
|
||||
if (!xdri_ctx->driContext.bindContext(disp->Xdpy, scrn, draw, read,
|
||||
&xdri_ctx->driContext)) {
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
|
||||
*/
|
||||
static EGLSurface
|
||||
xdri_eglCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
|
||||
NativeWindowType window, const EGLint *attrib_list)
|
||||
{
|
||||
_EGLDisplay *disp = _eglLookupDisplay(dpy);
|
||||
struct xdri_egl_surface *xdri_surf;
|
||||
int scrn = DefaultScreen(disp->Xdpy);
|
||||
|
||||
xdri_surf = CALLOC_STRUCT(xdri_egl_surface);
|
||||
if (!xdri_surf)
|
||||
return EGL_NO_SURFACE;
|
||||
|
||||
if (!_eglInitSurface(drv, dpy, &xdri_surf->Base, EGL_WINDOW_BIT,
|
||||
config, attrib_list)) {
|
||||
free(xdri_surf);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
if (!XF86DRICreateDrawable(disp->Xdpy, scrn, window, &xdri_surf->hDrawable)) {
|
||||
free(xdri_surf);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
xdri_surf->driDrawable = window;
|
||||
|
||||
_eglSaveSurface(&xdri_surf->Base);
|
||||
|
||||
_eglLog(_EGL_DEBUG,
|
||||
"XDRI: CreateWindowSurface win 0x%x handle %d hDrawable %d",
|
||||
(int) window, _eglGetSurfaceHandle(&xdri_surf->Base),
|
||||
(int) xdri_surf->hDrawable);
|
||||
|
||||
return _eglGetSurfaceHandle(&xdri_surf->Base);
|
||||
}
|
||||
|
||||
|
||||
static EGLBoolean
|
||||
xdri_eglDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface)
|
||||
{
|
||||
struct xdri_egl_surface *xdri_surf = lookup_surface(surface);
|
||||
if (xdri_surf) {
|
||||
_eglHashRemove(_eglGlobal.Surfaces, (EGLuint) surface);
|
||||
if (xdri_surf->Base.IsBound) {
|
||||
xdri_surf->Base.DeletePending = EGL_TRUE;
|
||||
}
|
||||
else {
|
||||
/*
|
||||
st_unreference_framebuffer(&surf->Framebuffer);
|
||||
*/
|
||||
free(xdri_surf);
|
||||
}
|
||||
return EGL_TRUE;
|
||||
}
|
||||
else {
|
||||
_eglError(EGL_BAD_SURFACE, "eglDestroySurface");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static EGLBoolean
|
||||
xdri_eglSwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
|
||||
{
|
||||
_EGLDisplay *disp = _eglLookupDisplay(dpy);
|
||||
|
||||
_eglLog(_EGL_DEBUG, "XDRI: EGL SwapBuffers");
|
||||
|
||||
/* error checking step: */
|
||||
if (!_eglSwapBuffers(drv, dpy, draw))
|
||||
return EGL_FALSE;
|
||||
|
||||
{
|
||||
struct xdri_egl_surface *xdri_surf = lookup_surface(draw);
|
||||
__GLXdisplayPrivate *priv = __glXInitialize(disp->Xdpy);
|
||||
__GLXscreenConfigs *scrn = priv->screenConfigs;
|
||||
__DRIscreen *psc = &scrn->driScreen;
|
||||
__DRIdrawable * const pdraw = psc->getDrawable(disp->Xdpy,
|
||||
xdri_surf->driDrawable,
|
||||
psc->private);
|
||||
|
||||
if (pdraw)
|
||||
pdraw->swapBuffers(disp->Xdpy, pdraw->private);
|
||||
else
|
||||
_eglLog(_EGL_WARNING, "pdraw is null in SwapBuffers");
|
||||
}
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This is the main entrypoint into the driver, called by libEGL.
|
||||
* Create a new _EGLDriver object and init its dispatch table.
|
||||
*/
|
||||
_EGLDriver *
|
||||
_eglMain(_EGLDisplay *disp, const char *args)
|
||||
{
|
||||
struct xdri_egl_driver *xdri_drv = CALLOC_STRUCT(xdri_egl_driver);
|
||||
if (!xdri_drv)
|
||||
return NULL;
|
||||
|
||||
_eglInitDriverFallbacks(&xdri_drv->Base);
|
||||
xdri_drv->Base.API.Initialize = xdri_eglInitialize;
|
||||
xdri_drv->Base.API.Terminate = xdri_eglTerminate;
|
||||
|
||||
xdri_drv->Base.API.CreateContext = xdri_eglCreateContext;
|
||||
xdri_drv->Base.API.MakeCurrent = xdri_eglMakeCurrent;
|
||||
xdri_drv->Base.API.CreateWindowSurface = xdri_eglCreateWindowSurface;
|
||||
xdri_drv->Base.API.DestroySurface = xdri_eglDestroySurface;
|
||||
xdri_drv->Base.API.SwapBuffers = xdri_eglSwapBuffers;
|
||||
|
||||
xdri_drv->Base.ClientAPIsMask = EGL_OPENGL_BIT /*| EGL_OPENGL_ES_BIT*/;
|
||||
xdri_drv->Base.Name = "X/DRI";
|
||||
|
||||
_eglLog(_EGL_DEBUG, "XDRI: main(%s)", args);
|
||||
|
||||
return &xdri_drv->Base;
|
||||
}
|
||||
+21
-5
@@ -8,34 +8,49 @@ INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/mesa/glapi
|
||||
|
||||
HEADERS = \
|
||||
eglconfig.h \
|
||||
eglconfigutil.h \
|
||||
eglcontext.h \
|
||||
egldefines.h \
|
||||
egldisplay.h \
|
||||
egldriver.h \
|
||||
eglglobals.h \
|
||||
egllog.h \
|
||||
eglhash.h \
|
||||
eglmisc.h \
|
||||
eglmode.h \
|
||||
eglscreen.h \
|
||||
eglsurface.h
|
||||
eglstring.h \
|
||||
eglsurface.h \
|
||||
eglx.h
|
||||
|
||||
SOURCES = \
|
||||
eglapi.c \
|
||||
eglconfig.c \
|
||||
eglconfigutil.c \
|
||||
eglcontext.c \
|
||||
egldisplay.c \
|
||||
egldriver.c \
|
||||
eglglobals.c \
|
||||
egllog.c \
|
||||
eglhash.c \
|
||||
eglmisc.c \
|
||||
eglmode.c \
|
||||
eglscreen.c \
|
||||
eglsurface.c
|
||||
eglstring.c \
|
||||
eglsurface.c \
|
||||
eglx.c
|
||||
|
||||
OBJECTS = $(SOURCES:.c=.o)
|
||||
|
||||
|
||||
# Undefined for now
|
||||
LOCAL_CFLAGS = -D_EGL_PLATFORM_X=1
|
||||
|
||||
LIBS = -lX11
|
||||
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
|
||||
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(LOCAL_CFLAGS) $< -o $@
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +62,7 @@ library: $(TOP)/$(LIB_DIR)/libEGL.so
|
||||
|
||||
$(TOP)/$(LIB_DIR)/libEGL.so: $(OBJECTS)
|
||||
$(TOP)/bin/mklib -o EGL -major 1 -minor 0 \
|
||||
-install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS)
|
||||
-install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) $(LIBS)
|
||||
|
||||
|
||||
|
||||
@@ -61,7 +76,8 @@ depend: $(SOURCES) $(HEADERS)
|
||||
@ rm -f depend
|
||||
@ touch depend
|
||||
$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \
|
||||
$(SOURCES) $(HEADERS) > /dev/null
|
||||
$(SOURCES) $(HEADERS) > /dev/null 2>/dev/null
|
||||
|
||||
|
||||
include depend
|
||||
# DO NOT DELETE
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
|
||||
|
||||
Notes about the EGL library:
|
||||
|
||||
|
||||
The EGL code here basically consists of two things:
|
||||
|
||||
1. An EGL API dispatcher. This directly routes all the eglFooBar() API
|
||||
calls into driver-specific functions.
|
||||
|
||||
2. Fallbacks for EGL API functions. A driver _could_ implement all the
|
||||
EGL API calls from scratch. But in many cases, the fallbacks provided
|
||||
in libEGL (such as eglChooseConfig()) will do the job.
|
||||
|
||||
|
||||
|
||||
Bootstrapping:
|
||||
|
||||
When the apps calls eglOpenDisplay() a device driver is selected and loaded
|
||||
(look for dlsym() or LoadLibrary() in egldriver.c).
|
||||
|
||||
The driver's _eglMain() function is then called. This driver function
|
||||
allocates, initializes and returns a new _EGLDriver object (usually a
|
||||
subclass of that type).
|
||||
|
||||
As part of initialization, the dispatch table in _EGLDriver->API must be
|
||||
populated with all the EGL entrypoints. Typically, _eglInitDriverFallbacks()
|
||||
can be used to plug in default/fallback functions. Some functions like
|
||||
driver->API.Initialize and driver->API.Terminate _must_ be implemented
|
||||
with driver-specific code (no default/fallback function is possible).
|
||||
|
||||
|
||||
A bit later, the app will call eglInitialize(). This will get routed
|
||||
to the driver->API.Initialize() function. Any additional driver
|
||||
initialization that wasn't done in _eglMain() should be done at this
|
||||
point. Typically, this will involve setting up visual configs, etc.
|
||||
|
||||
|
||||
|
||||
Special Functions:
|
||||
|
||||
Certain EGL functions _must_ be implemented by the driver. This includes:
|
||||
|
||||
eglCreateContext
|
||||
eglCreateWindowSurface
|
||||
eglCreatePixmapSurface
|
||||
eglCreatePBufferSurface
|
||||
eglMakeCurrent
|
||||
eglSwapBuffers
|
||||
|
||||
Most of the EGLConfig-related functions can be implemented with the
|
||||
defaults/fallbacks. Same thing for the eglGet/Query functions.
|
||||
|
||||
|
||||
|
||||
|
||||
Teardown:
|
||||
|
||||
When eglTerminate() is called, the driver->API.Terminate() function is
|
||||
called. The driver should clean up after itself. eglTerminate() will
|
||||
then close/unload the driver (shared library).
|
||||
|
||||
|
||||
|
||||
|
||||
Subclassing:
|
||||
|
||||
The internal libEGL data structures such as _EGLDisplay, _EGLContext,
|
||||
_EGLSurface, etc should be considered base classes from which drivers
|
||||
will derive subclasses.
|
||||
|
||||
+109
-73
@@ -43,36 +43,54 @@
|
||||
|
||||
|
||||
/**
|
||||
* NOTE: displayName is treated as a string in _eglChooseDriver()!!!
|
||||
* This will probably change!
|
||||
* See _eglChooseDriver() for details!
|
||||
* This is typically the first EGL function that an application calls.
|
||||
* We initialize our global vars and create a private _EGLDisplay object.
|
||||
*/
|
||||
EGLDisplay APIENTRY
|
||||
eglGetDisplay(NativeDisplayType displayName)
|
||||
EGLDisplay EGLAPIENTRY
|
||||
eglGetDisplay(NativeDisplayType nativeDisplay)
|
||||
{
|
||||
_EGLDisplay *dpy;
|
||||
_eglInitGlobals();
|
||||
dpy = _eglNewDisplay(displayName);
|
||||
if (dpy)
|
||||
return dpy->Handle;
|
||||
else
|
||||
return EGL_NO_DISPLAY;
|
||||
dpy = _eglNewDisplay(nativeDisplay);
|
||||
return _eglGetDisplayHandle(dpy);
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
/**
|
||||
* This is typically the second EGL function that an application calls.
|
||||
* Here we load/initialize the actual hardware driver.
|
||||
*/
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
|
||||
{
|
||||
if (dpy) {
|
||||
_EGLDriver *drv = _eglChooseDriver(dpy);
|
||||
if (drv)
|
||||
return drv->API.Initialize(drv, dpy, major, minor);
|
||||
EGLBoolean retVal;
|
||||
_EGLDisplay *dpyPriv = _eglLookupDisplay(dpy);
|
||||
if (!dpyPriv) {
|
||||
return EGL_FALSE;
|
||||
}
|
||||
dpyPriv->Driver = _eglOpenDriver(dpyPriv,
|
||||
dpyPriv->DriverName,
|
||||
dpyPriv->DriverArgs);
|
||||
if (!dpyPriv->Driver) {
|
||||
return EGL_FALSE;
|
||||
}
|
||||
/* Initialize the particular driver now */
|
||||
retVal = dpyPriv->Driver->API.Initialize(dpyPriv->Driver, dpy,
|
||||
major, minor);
|
||||
|
||||
dpyPriv->Driver->APImajor = *major;
|
||||
dpyPriv->Driver->APIminor = *minor;
|
||||
snprintf(dpyPriv->Driver->Version, sizeof(dpyPriv->Driver->Version),
|
||||
"%d.%d (%s)", *major, *minor, dpyPriv->Driver->Name);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglTerminate(EGLDisplay dpy)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -83,7 +101,7 @@ eglTerminate(EGLDisplay dpy)
|
||||
}
|
||||
|
||||
|
||||
const char * APIENTRY
|
||||
const char * EGLAPIENTRY
|
||||
eglQueryString(EGLDisplay dpy, EGLint name)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -94,7 +112,7 @@ eglQueryString(EGLDisplay dpy, EGLint name)
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -103,7 +121,7 @@ eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *nu
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -111,7 +129,7 @@ eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, E
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -119,7 +137,7 @@ eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *v
|
||||
}
|
||||
|
||||
|
||||
EGLContext APIENTRY
|
||||
EGLContext EGLAPIENTRY
|
||||
eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -127,7 +145,7 @@ eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list, const
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -135,7 +153,7 @@ eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -143,7 +161,7 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -151,7 +169,7 @@ eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
|
||||
}
|
||||
|
||||
|
||||
EGLSurface APIENTRY
|
||||
EGLSurface EGLAPIENTRY
|
||||
eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -159,7 +177,7 @@ eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window
|
||||
}
|
||||
|
||||
|
||||
EGLSurface APIENTRY
|
||||
EGLSurface EGLAPIENTRY
|
||||
eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -167,7 +185,7 @@ eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap
|
||||
}
|
||||
|
||||
|
||||
EGLSurface APIENTRY
|
||||
EGLSurface EGLAPIENTRY
|
||||
eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -175,7 +193,7 @@ eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_l
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -183,7 +201,7 @@ eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -191,7 +209,7 @@ eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *va
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -199,7 +217,7 @@ eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint va
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -207,7 +225,7 @@ eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -215,7 +233,7 @@ eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglSwapInterval(EGLDisplay dpy, EGLint interval)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -223,7 +241,7 @@ eglSwapInterval(EGLDisplay dpy, EGLint interval)
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglSwapBuffers(EGLDisplay dpy, EGLSurface draw)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -231,7 +249,7 @@ eglSwapBuffers(EGLDisplay dpy, EGLSurface draw)
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, NativePixmapType target)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -239,7 +257,7 @@ eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, NativePixmapType target)
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglWaitGL(void)
|
||||
{
|
||||
EGLDisplay dpy = eglGetCurrentDisplay();
|
||||
@@ -252,7 +270,7 @@ eglWaitGL(void)
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglWaitNative(EGLint engine)
|
||||
{
|
||||
EGLDisplay dpy = eglGetCurrentDisplay();
|
||||
@@ -265,40 +283,31 @@ eglWaitNative(EGLint engine)
|
||||
}
|
||||
|
||||
|
||||
EGLDisplay APIENTRY
|
||||
EGLDisplay EGLAPIENTRY
|
||||
eglGetCurrentDisplay(void)
|
||||
{
|
||||
_EGLDisplay *dpy = _eglGetCurrentDisplay();
|
||||
if (dpy)
|
||||
return dpy->Handle;
|
||||
else
|
||||
return EGL_NO_DISPLAY;
|
||||
return _eglGetDisplayHandle(dpy);
|
||||
}
|
||||
|
||||
|
||||
EGLContext APIENTRY
|
||||
EGLContext EGLAPIENTRY
|
||||
eglGetCurrentContext(void)
|
||||
{
|
||||
_EGLContext *ctx = _eglGetCurrentContext();
|
||||
if (ctx)
|
||||
return ctx->Handle;
|
||||
else
|
||||
return EGL_NO_CONTEXT;
|
||||
return _eglGetContextHandle(ctx);
|
||||
}
|
||||
|
||||
|
||||
EGLSurface APIENTRY
|
||||
EGLSurface EGLAPIENTRY
|
||||
eglGetCurrentSurface(EGLint readdraw)
|
||||
{
|
||||
_EGLSurface *s = _eglGetCurrentSurface(readdraw);
|
||||
if (s)
|
||||
return s->Handle;
|
||||
else
|
||||
return EGL_NO_SURFACE;
|
||||
return _eglGetSurfaceHandle(s);
|
||||
}
|
||||
|
||||
|
||||
EGLint APIENTRY
|
||||
EGLint EGLAPIENTRY
|
||||
eglGetError(void)
|
||||
{
|
||||
_EGLThreadInfo *t = _eglGetCurrentThread();
|
||||
@@ -308,7 +317,7 @@ eglGetError(void)
|
||||
}
|
||||
|
||||
|
||||
void (* APIENTRY eglGetProcAddress(const char *procname))()
|
||||
void (* EGLAPIENTRY eglGetProcAddress(const char *procname))()
|
||||
{
|
||||
typedef void (*genericFunc)();
|
||||
struct name_function {
|
||||
@@ -376,12 +385,15 @@ void (* APIENTRY eglGetProcAddress(const char *procname))()
|
||||
return (genericFunc) egl_functions[i].function;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
/* XXX enable this code someday */
|
||||
return (genericFunc) _glapi_get_proc_address(procname);
|
||||
#else
|
||||
|
||||
/* now loop over drivers to query their procs */
|
||||
for (i = 0; i < _eglGlobal.NumDrivers; i++) {
|
||||
_EGLProc p = _eglGlobal.Drivers[i]->API.GetProcAddress(procname);
|
||||
if (p)
|
||||
return p;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -389,7 +401,7 @@ void (* APIENTRY eglGetProcAddress(const char *procname))()
|
||||
* EGL_MESA_screen extension
|
||||
*/
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen,
|
||||
const EGLint *attrib_list, EGLModeMESA *modes,
|
||||
EGLint modes_size, EGLint *num_modes)
|
||||
@@ -402,7 +414,7 @@ eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen,
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -413,7 +425,7 @@ eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -424,7 +436,7 @@ eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean APIENTRY
|
||||
EGLBoolean EGLAPIENTRY
|
||||
eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
@@ -508,21 +520,42 @@ eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode)
|
||||
|
||||
#ifdef EGL_VERSION_1_2
|
||||
|
||||
|
||||
/**
|
||||
* Specify the client API to use for subsequent calls including:
|
||||
* eglCreateContext()
|
||||
* eglGetCurrentContext()
|
||||
* eglGetCurrentDisplay()
|
||||
* eglGetCurrentSurface()
|
||||
* eglMakeCurrent(when the ctx parameter is EGL NO CONTEXT)
|
||||
* eglWaitClient()
|
||||
* eglWaitNative()
|
||||
* See section 3.7 "Rendering Context" in the EGL specification for details.
|
||||
*/
|
||||
EGLBoolean
|
||||
eglBindAPI(EGLenum api)
|
||||
{
|
||||
_EGLThreadInfo *t = _eglGetCurrentThread();
|
||||
|
||||
switch (api) {
|
||||
#ifdef EGL_VERSION_1_4
|
||||
case EGL_OPENGL_API:
|
||||
if (_eglGlobal.ClientAPIsMask & EGL_OPENGL_BIT) {
|
||||
t->CurrentAPI = api;
|
||||
return EGL_TRUE;
|
||||
}
|
||||
_eglError(EGL_BAD_PARAMETER, "eglBindAPI");
|
||||
return EGL_FALSE;
|
||||
#endif
|
||||
case EGL_OPENGL_ES_API:
|
||||
if (_eglGlobal.OpenGLESAPISupported) {
|
||||
if (_eglGlobal.ClientAPIsMask & (EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT)) {
|
||||
t->CurrentAPI = api;
|
||||
return EGL_TRUE;
|
||||
}
|
||||
_eglError(EGL_BAD_PARAMETER, "eglBindAPI");
|
||||
return EGL_FALSE;
|
||||
case EGL_OPENVG_API:
|
||||
if (_eglGlobal.OpenVGAPISupported) {
|
||||
if (_eglGlobal.ClientAPIsMask & EGL_OPENVG_BIT) {
|
||||
t->CurrentAPI = api;
|
||||
return EGL_TRUE;
|
||||
}
|
||||
@@ -535,6 +568,18 @@ eglBindAPI(EGLenum api)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the last value set with eglBindAPI().
|
||||
*/
|
||||
EGLenum
|
||||
eglQueryAPI(void)
|
||||
{
|
||||
/* returns one of EGL_OPENGL_API, EGL_OPENGL_ES_API or EGL_OPENVG_API */
|
||||
_EGLThreadInfo *t = _eglGetCurrentThread();
|
||||
return t->CurrentAPI;
|
||||
}
|
||||
|
||||
|
||||
EGLSurface
|
||||
eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
|
||||
EGLClientBuffer buffer, EGLConfig config,
|
||||
@@ -546,15 +591,6 @@ eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
|
||||
}
|
||||
|
||||
|
||||
EGLenum
|
||||
eglQueryAPI(void)
|
||||
{
|
||||
/* returns one of EGL_OPENGL_ES_API or EGL_OPENVG_API */
|
||||
_EGLThreadInfo *t = _eglGetCurrentThread();
|
||||
return t->CurrentAPI;
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean
|
||||
eglReleaseThread(void)
|
||||
{
|
||||
|
||||
+10
-1
@@ -1,11 +1,16 @@
|
||||
#ifndef EGLAPI_INCLUDED
|
||||
#define EGLAPI_INCLUDED
|
||||
|
||||
/**
|
||||
* A generic function ptr type
|
||||
*/
|
||||
typedef void (*_EGLProc)();
|
||||
|
||||
|
||||
/**
|
||||
* Typedefs for all EGL API entrypoint functions.
|
||||
*/
|
||||
|
||||
|
||||
/* driver funcs */
|
||||
typedef EGLBoolean (*Initialize_t)(_EGLDriver *, EGLDisplay dpy, EGLint *major, EGLint *minor);
|
||||
typedef EGLBoolean (*Terminate_t)(_EGLDriver *, EGLDisplay dpy);
|
||||
@@ -39,6 +44,9 @@ typedef const char *(*QueryString_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint nam
|
||||
typedef EGLBoolean (*WaitGL_t)(_EGLDriver *drv, EGLDisplay dpy);
|
||||
typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint engine);
|
||||
|
||||
typedef _EGLProc (*GetProcAddress_t)(const char *procname);
|
||||
|
||||
|
||||
|
||||
#ifdef EGL_MESA_screen_surface
|
||||
typedef EGLBoolean (*ChooseModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
|
||||
@@ -95,6 +103,7 @@ struct _egl_api
|
||||
QueryString_t QueryString;
|
||||
WaitGL_t WaitGL;
|
||||
WaitNative_t WaitNative;
|
||||
GetProcAddress_t GetProcAddress;
|
||||
|
||||
/* EGL_MESA_screen extension */
|
||||
ChooseModeMESA_t ChooseModeMESA;
|
||||
|
||||
+30
-264
@@ -17,48 +17,6 @@
|
||||
#define MIN2(A, B) (((A) < (B)) ? (A) : (B))
|
||||
|
||||
|
||||
/**
|
||||
* Convert an _EGLConfig to a __GLcontextModes object.
|
||||
* NOTE: This routine may be incomplete - we're only making sure that
|
||||
* the fields needed by Mesa (for _mesa_create_context/framebuffer) are
|
||||
* set correctly.
|
||||
*/
|
||||
void
|
||||
_eglConfigToContextModesRec(const _EGLConfig *config, __GLcontextModes *mode)
|
||||
{
|
||||
memset(mode, 0, sizeof(*mode));
|
||||
|
||||
mode->rgbMode = GL_TRUE; /* no color index */
|
||||
mode->colorIndexMode = GL_FALSE;
|
||||
mode->doubleBufferMode = GL_TRUE; /* always DB for now */
|
||||
mode->stereoMode = GL_FALSE;
|
||||
|
||||
mode->redBits = GET_CONFIG_ATTRIB(config, EGL_RED_SIZE);
|
||||
mode->greenBits = GET_CONFIG_ATTRIB(config, EGL_GREEN_SIZE);
|
||||
mode->blueBits = GET_CONFIG_ATTRIB(config, EGL_BLUE_SIZE);
|
||||
mode->alphaBits = GET_CONFIG_ATTRIB(config, EGL_ALPHA_SIZE);
|
||||
mode->rgbBits = GET_CONFIG_ATTRIB(config, EGL_BUFFER_SIZE);
|
||||
|
||||
/* no rgba masks - fix? */
|
||||
|
||||
mode->depthBits = GET_CONFIG_ATTRIB(config, EGL_DEPTH_SIZE);
|
||||
mode->haveDepthBuffer = mode->depthBits > 0;
|
||||
|
||||
mode->stencilBits = GET_CONFIG_ATTRIB(config, EGL_STENCIL_SIZE);
|
||||
mode->haveStencilBuffer = mode->stencilBits > 0;
|
||||
|
||||
/* no accum */
|
||||
|
||||
mode->level = GET_CONFIG_ATTRIB(config, EGL_LEVEL);
|
||||
mode->samples = GET_CONFIG_ATTRIB(config, EGL_SAMPLES);
|
||||
mode->sampleBuffers = GET_CONFIG_ATTRIB(config, EGL_SAMPLE_BUFFERS);
|
||||
|
||||
/* surface type - not really needed */
|
||||
mode->visualType = GLX_TRUE_COLOR;
|
||||
mode->renderType = GLX_RGBA_BIT;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_eglSetConfigAttrib(_EGLConfig *config, EGLint attr, EGLint val)
|
||||
{
|
||||
@@ -76,7 +34,7 @@ void
|
||||
_eglInitConfig(_EGLConfig *config, EGLint id)
|
||||
{
|
||||
memset(config, 0, sizeof(*config));
|
||||
config->Handle = id;
|
||||
config->Handle = (EGLConfig) id;
|
||||
_eglSetConfigAttrib(config, EGL_CONFIG_ID, id);
|
||||
_eglSetConfigAttrib(config, EGL_BIND_TO_TEXTURE_RGB, EGL_DONT_CARE);
|
||||
_eglSetConfigAttrib(config, EGL_BIND_TO_TEXTURE_RGBA, EGL_DONT_CARE);
|
||||
@@ -99,8 +57,20 @@ _eglInitConfig(_EGLConfig *config, EGLint id)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the public handle for an internal _EGLConfig.
|
||||
* This is the inverse of _eglLookupConfig().
|
||||
*/
|
||||
EGLConfig
|
||||
_eglGetConfigHandle(_EGLConfig *config)
|
||||
{
|
||||
return config ? config->Handle : 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Given an EGLConfig handle, return the corresponding _EGLConfig object.
|
||||
* This is the inverse of _eglGetConfigHandle().
|
||||
*/
|
||||
_EGLConfig *
|
||||
_eglLookupConfig(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config)
|
||||
@@ -108,8 +78,8 @@ _eglLookupConfig(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config)
|
||||
EGLint i;
|
||||
_EGLDisplay *disp = _eglLookupDisplay(dpy);
|
||||
for (i = 0; i < disp->NumConfigs; i++) {
|
||||
if (disp->Configs[i].Handle == config) {
|
||||
return disp->Configs + i;
|
||||
if (disp->Configs[i]->Handle == config) {
|
||||
return disp->Configs[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@@ -118,23 +88,24 @@ _eglLookupConfig(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config)
|
||||
|
||||
/**
|
||||
* Add the given _EGLConfig to the given display.
|
||||
* Note that we just save the ptr to the config (we don't copy the config).
|
||||
*/
|
||||
_EGLConfig *
|
||||
_eglAddConfig(_EGLDisplay *display, const _EGLConfig *config)
|
||||
_eglAddConfig(_EGLDisplay *display, _EGLConfig *config)
|
||||
{
|
||||
_EGLConfig *newConfigs;
|
||||
_EGLConfig **newConfigs;
|
||||
EGLint n;
|
||||
|
||||
n = display->NumConfigs;
|
||||
|
||||
newConfigs = (_EGLConfig *) realloc(display->Configs,
|
||||
(n + 1) * sizeof(_EGLConfig));
|
||||
/* realloc array of ptrs */
|
||||
newConfigs = (_EGLConfig **) realloc(display->Configs,
|
||||
(n + 1) * sizeof(_EGLConfig *));
|
||||
if (newConfigs) {
|
||||
display->Configs = newConfigs;
|
||||
display->Configs[n] = *config; /* copy struct */
|
||||
display->Configs[n].Handle = n;
|
||||
display->Configs[n] = config;
|
||||
display->NumConfigs++;
|
||||
return display->Configs + n;
|
||||
return config;
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
@@ -360,8 +331,8 @@ _eglChooseConfig(_EGLDriver *drv, EGLDisplay dpy, const EGLint *attrib_list,
|
||||
|
||||
/* make array of pointers to qualifying configs */
|
||||
for (i = count = 0; i < disp->NumConfigs && count < config_size; i++) {
|
||||
if (_eglConfigQualifies(disp->Configs + i, &criteria)) {
|
||||
configList[count++] = disp->Configs + i;
|
||||
if (_eglConfigQualifies(disp->Configs[i], &criteria)) {
|
||||
configList[count++] = disp->Configs[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,8 +340,10 @@ _eglChooseConfig(_EGLDriver *drv, EGLDisplay dpy, const EGLint *attrib_list,
|
||||
qsort(configList, count, sizeof(_EGLConfig *), _eglCompareConfigs);
|
||||
|
||||
/* copy config handles to output array */
|
||||
for (i = 0; i < count; i++) {
|
||||
configs[i] = configList[i]->Handle;
|
||||
if (configs) {
|
||||
for (i = 0; i < count; i++) {
|
||||
configs[i] = configList[i]->Handle;
|
||||
}
|
||||
}
|
||||
|
||||
free(configList);
|
||||
@@ -419,7 +392,7 @@ _eglGetConfigs(_EGLDriver *drv, EGLDisplay dpy, EGLConfig *configs,
|
||||
EGLint i;
|
||||
*num_config = MIN2(disp->NumConfigs, config_size);
|
||||
for (i = 0; i < *num_config; i++) {
|
||||
configs[i] = disp->Configs[i].Handle;
|
||||
configs[i] = disp->Configs[i]->Handle;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -429,210 +402,3 @@ _eglGetConfigs(_EGLDriver *drv, EGLDisplay dpy, EGLConfig *configs,
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a set of \c __GLcontextModes that a driver will expose.
|
||||
*
|
||||
* A set of \c __GLcontextModes will be created based on the supplied
|
||||
* parameters. The number of modes processed will be 2 *
|
||||
* \c num_depth_stencil_bits * \c num_db_modes.
|
||||
*
|
||||
* For the most part, data is just copied from \c depth_bits, \c stencil_bits,
|
||||
* \c db_modes, and \c visType into each \c __GLcontextModes element.
|
||||
* However, the meanings of \c fb_format and \c fb_type require further
|
||||
* explanation. The \c fb_format specifies which color components are in
|
||||
* each pixel and what the default order is. For example, \c GL_RGB specifies
|
||||
* that red, green, blue are available and red is in the "most significant"
|
||||
* position and blue is in the "least significant". The \c fb_type specifies
|
||||
* the bit sizes of each component and the actual ordering. For example, if
|
||||
* \c GL_UNSIGNED_SHORT_5_6_5_REV is specified with \c GL_RGB, bits [15:11]
|
||||
* are the blue value, bits [10:5] are the green value, and bits [4:0] are
|
||||
* the red value.
|
||||
*
|
||||
* One sublte issue is the combination of \c GL_RGB or \c GL_BGR and either
|
||||
* of the \c GL_UNSIGNED_INT_8_8_8_8 modes. The resulting mask values in the
|
||||
* \c __GLcontextModes structure is \b identical to the \c GL_RGBA or
|
||||
* \c GL_BGRA case, except the \c alphaMask is zero. This means that, as
|
||||
* far as this routine is concerned, \c GL_RGB with \c GL_UNSIGNED_INT_8_8_8_8
|
||||
* still uses 32-bits.
|
||||
*
|
||||
* If in doubt, look at the tables used in the function.
|
||||
*
|
||||
* \param ptr_to_modes Pointer to a pointer to a linked list of
|
||||
* \c __GLcontextModes. Upon completion, a pointer to
|
||||
* the next element to be process will be stored here.
|
||||
* If the function fails and returns \c GL_FALSE, this
|
||||
* value will be unmodified, but some elements in the
|
||||
* linked list may be modified.
|
||||
* \param fb_format Format of the framebuffer. Currently only \c GL_RGB,
|
||||
* \c GL_RGBA, \c GL_BGR, and \c GL_BGRA are supported.
|
||||
* \param fb_type Type of the pixels in the framebuffer. Currently only
|
||||
* \c GL_UNSIGNED_SHORT_5_6_5,
|
||||
* \c GL_UNSIGNED_SHORT_5_6_5_REV,
|
||||
* \c GL_UNSIGNED_INT_8_8_8_8, and
|
||||
* \c GL_UNSIGNED_INT_8_8_8_8_REV are supported.
|
||||
* \param depth_bits Array of depth buffer sizes to be exposed.
|
||||
* \param stencil_bits Array of stencil buffer sizes to be exposed.
|
||||
* \param num_depth_stencil_bits Number of entries in both \c depth_bits and
|
||||
* \c stencil_bits.
|
||||
* \param db_modes Array of buffer swap modes. If an element has a
|
||||
* value of \c GLX_NONE, then it represents a
|
||||
* single-buffered mode. Other valid values are
|
||||
* \c GLX_SWAP_EXCHANGE_OML, \c GLX_SWAP_COPY_OML, and
|
||||
* \c GLX_SWAP_UNDEFINED_OML. See the
|
||||
* GLX_OML_swap_method extension spec for more details.
|
||||
* \param num_db_modes Number of entries in \c db_modes.
|
||||
* \param visType GLX visual type. Usually either \c GLX_TRUE_COLOR or
|
||||
* \c GLX_DIRECT_COLOR.
|
||||
*
|
||||
* \returns
|
||||
* \c GL_TRUE on success or \c GL_FALSE on failure. Currently the only
|
||||
* cause of failure is a bad parameter (i.e., unsupported \c fb_format or
|
||||
* \c fb_type).
|
||||
*
|
||||
* \todo
|
||||
* There is currently no way to support packed RGB modes (i.e., modes with
|
||||
* exactly 3 bytes per pixel) or floating-point modes. This could probably
|
||||
* be done by creating some new, private enums with clever names likes
|
||||
* \c GL_UNSIGNED_3BYTE_8_8_8, \c GL_4FLOAT_32_32_32_32,
|
||||
* \c GL_4HALF_16_16_16_16, etc. We can cross that bridge when we come to it.
|
||||
*/
|
||||
GLboolean
|
||||
_eglFillInConfigs(_EGLConfig * configs,
|
||||
GLenum fb_format, GLenum fb_type,
|
||||
const u_int8_t * depth_bits, const u_int8_t * stencil_bits,
|
||||
unsigned num_depth_stencil_bits,
|
||||
const GLenum * db_modes, unsigned num_db_modes,
|
||||
int visType)
|
||||
{
|
||||
static const u_int8_t bits_table[3][4] = {
|
||||
/* R G B A */
|
||||
{ 5, 6, 5, 0 }, /* Any GL_UNSIGNED_SHORT_5_6_5 */
|
||||
{ 8, 8, 8, 0 }, /* Any RGB with any GL_UNSIGNED_INT_8_8_8_8 */
|
||||
{ 8, 8, 8, 8 } /* Any RGBA with any GL_UNSIGNED_INT_8_8_8_8 */
|
||||
};
|
||||
|
||||
/* The following arrays are all indexed by the fb_type masked with 0x07.
|
||||
* Given the four supported fb_type values, this results in valid array
|
||||
* indices of 3, 4, 5, and 7.
|
||||
*/
|
||||
static const u_int32_t masks_table_rgb[8][4] = {
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5 */
|
||||
{0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5_REV */
|
||||
{0xFF000000, 0x00FF0000, 0x0000FF00, 0x00000000}, /* 8_8_8_8 */
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000} /* 8_8_8_8_REV */
|
||||
};
|
||||
|
||||
static const u_int32_t masks_table_rgba[8][4] = {
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5 */
|
||||
{0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5_REV */
|
||||
{0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF}, /* 8_8_8_8 */
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000}, /* 8_8_8_8_REV */
|
||||
};
|
||||
|
||||
static const u_int32_t masks_table_bgr[8][4] = {
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5 */
|
||||
{0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5_REV */
|
||||
{0x0000FF00, 0x00FF0000, 0xFF000000, 0x00000000}, /* 8_8_8_8 */
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000}, /* 8_8_8_8_REV */
|
||||
};
|
||||
|
||||
static const u_int32_t masks_table_bgra[8][4] = {
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5 */
|
||||
{0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5_REV */
|
||||
{0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF}, /* 8_8_8_8 */
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000}, /* 8_8_8_8_REV */
|
||||
};
|
||||
|
||||
static const u_int8_t bytes_per_pixel[8] = {
|
||||
0, 0, 0, 2, 2, 4, 0, 4
|
||||
};
|
||||
|
||||
const u_int8_t * bits;
|
||||
const u_int32_t * masks;
|
||||
const int index = fb_type & 0x07;
|
||||
_EGLConfig *config;
|
||||
unsigned i;
|
||||
unsigned j;
|
||||
unsigned k;
|
||||
|
||||
if ( bytes_per_pixel[index] == 0 ) {
|
||||
_eglLog(_EGL_INFO,
|
||||
"[%s:%u] Framebuffer type 0x%04x has 0 bytes per pixel.",
|
||||
__FUNCTION__, __LINE__, fb_type);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* Valid types are GL_UNSIGNED_SHORT_5_6_5 and GL_UNSIGNED_INT_8_8_8_8 and
|
||||
* the _REV versions.
|
||||
*
|
||||
* Valid formats are GL_RGBA, GL_RGB, and GL_BGRA.
|
||||
*/
|
||||
switch ( fb_format ) {
|
||||
case GL_RGB:
|
||||
bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[1];
|
||||
masks = masks_table_rgb[index];
|
||||
break;
|
||||
|
||||
case GL_RGBA:
|
||||
bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[2];
|
||||
masks = masks_table_rgba[index];
|
||||
break;
|
||||
|
||||
case GL_BGR:
|
||||
bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[1];
|
||||
masks = masks_table_bgr[index];
|
||||
break;
|
||||
|
||||
case GL_BGRA:
|
||||
bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[2];
|
||||
masks = masks_table_bgra[index];
|
||||
break;
|
||||
|
||||
default:
|
||||
_eglLog(_EGL_WARNING,
|
||||
"[%s:%u] Framebuffer format 0x%04x is not GL_RGB, GL_RGBA, GL_BGR, or GL_BGRA.",
|
||||
__FUNCTION__, __LINE__, fb_format);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
config = configs;
|
||||
for (k = 0; k < num_depth_stencil_bits; k++) {
|
||||
for (i = 0; i < num_db_modes; i++) {
|
||||
for (j = 0; j < 2; j++) {
|
||||
_eglSetConfigAttrib(config, EGL_RED_SIZE, bits[0]);
|
||||
_eglSetConfigAttrib(config, EGL_GREEN_SIZE, bits[1]);
|
||||
_eglSetConfigAttrib(config, EGL_BLUE_SIZE, bits[2]);
|
||||
_eglSetConfigAttrib(config, EGL_ALPHA_SIZE, bits[3]);
|
||||
_eglSetConfigAttrib(config, EGL_BUFFER_SIZE,
|
||||
bits[0] + bits[1] + bits[2] + bits[3]);
|
||||
|
||||
_eglSetConfigAttrib(config, EGL_STENCIL_SIZE, stencil_bits[k]);
|
||||
_eglSetConfigAttrib(config, EGL_DEPTH_SIZE, depth_bits[i]);
|
||||
|
||||
_eglSetConfigAttrib(config, EGL_SURFACE_TYPE, EGL_SCREEN_BIT_MESA |
|
||||
EGL_PBUFFER_BIT | EGL_PIXMAP_BIT | EGL_WINDOW_BIT);
|
||||
|
||||
config++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
|
||||
#include "egltypedefs.h"
|
||||
#include "GL/internal/glcore.h"
|
||||
#include <GLES/gl.h>
|
||||
|
||||
|
||||
#define MAX_ATTRIBS 100
|
||||
@@ -25,12 +25,16 @@ extern void
|
||||
_eglInitConfig(_EGLConfig *config, EGLint id);
|
||||
|
||||
|
||||
extern EGLConfig
|
||||
_eglGetConfigHandle(_EGLConfig *config);
|
||||
|
||||
|
||||
extern _EGLConfig *
|
||||
_eglLookupConfig(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config);
|
||||
|
||||
|
||||
extern _EGLConfig *
|
||||
_eglAddConfig(_EGLDisplay *display, const _EGLConfig *config);
|
||||
_eglAddConfig(_EGLDisplay *display, _EGLConfig *config);
|
||||
|
||||
|
||||
extern EGLBoolean
|
||||
@@ -52,16 +56,5 @@ _eglGetConfigs(_EGLDriver *drv, EGLDisplay dpy, EGLConfig *configs, EGLint confi
|
||||
extern void
|
||||
_eglSetConfigAttrib(_EGLConfig *config, EGLint attr, EGLint val);
|
||||
|
||||
extern GLboolean
|
||||
_eglFillInConfigs( _EGLConfig *configs,
|
||||
GLenum fb_format, GLenum fb_type,
|
||||
const u_int8_t * depth_bits, const u_int8_t * stencil_bits,
|
||||
unsigned num_depth_stencil_bits,
|
||||
const GLenum * db_modes, unsigned num_db_modes,
|
||||
int visType );
|
||||
|
||||
extern void
|
||||
_eglConfigToContextModesRec(const _EGLConfig *config, __GLcontextModes *mode);
|
||||
|
||||
|
||||
#endif /* EGLCONFIG_INCLUDED */
|
||||
|
||||
@@ -0,0 +1,260 @@
|
||||
/**
|
||||
* Extra utility functions related to EGL configs.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "eglconfigutil.h"
|
||||
#include "egllog.h"
|
||||
|
||||
|
||||
/**
|
||||
* Convert an _EGLConfig to a __GLcontextModes object.
|
||||
* NOTE: This routine may be incomplete - we're only making sure that
|
||||
* the fields needed by Mesa (for _mesa_create_context/framebuffer) are
|
||||
* set correctly.
|
||||
*/
|
||||
void
|
||||
_eglConfigToContextModesRec(const _EGLConfig *config, __GLcontextModes *mode)
|
||||
{
|
||||
memset(mode, 0, sizeof(*mode));
|
||||
|
||||
mode->rgbMode = GL_TRUE; /* no color index */
|
||||
mode->colorIndexMode = GL_FALSE;
|
||||
mode->doubleBufferMode = GL_TRUE; /* always DB for now */
|
||||
mode->stereoMode = GL_FALSE;
|
||||
|
||||
mode->redBits = GET_CONFIG_ATTRIB(config, EGL_RED_SIZE);
|
||||
mode->greenBits = GET_CONFIG_ATTRIB(config, EGL_GREEN_SIZE);
|
||||
mode->blueBits = GET_CONFIG_ATTRIB(config, EGL_BLUE_SIZE);
|
||||
mode->alphaBits = GET_CONFIG_ATTRIB(config, EGL_ALPHA_SIZE);
|
||||
mode->rgbBits = GET_CONFIG_ATTRIB(config, EGL_BUFFER_SIZE);
|
||||
|
||||
/* no rgba masks - fix? */
|
||||
|
||||
mode->depthBits = GET_CONFIG_ATTRIB(config, EGL_DEPTH_SIZE);
|
||||
mode->haveDepthBuffer = mode->depthBits > 0;
|
||||
|
||||
mode->stencilBits = GET_CONFIG_ATTRIB(config, EGL_STENCIL_SIZE);
|
||||
mode->haveStencilBuffer = mode->stencilBits > 0;
|
||||
|
||||
/* no accum */
|
||||
|
||||
mode->level = GET_CONFIG_ATTRIB(config, EGL_LEVEL);
|
||||
mode->samples = GET_CONFIG_ATTRIB(config, EGL_SAMPLES);
|
||||
mode->sampleBuffers = GET_CONFIG_ATTRIB(config, EGL_SAMPLE_BUFFERS);
|
||||
|
||||
/* surface type - not really needed */
|
||||
mode->visualType = GLX_TRUE_COLOR;
|
||||
mode->renderType = GLX_RGBA_BIT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates a set of \c _EGLConfigs that a driver will expose.
|
||||
*
|
||||
* A set of \c __GLcontextModes will be created based on the supplied
|
||||
* parameters. The number of modes processed will be 2 *
|
||||
* \c num_depth_stencil_bits * \c num_db_modes.
|
||||
*
|
||||
* For the most part, data is just copied from \c depth_bits, \c stencil_bits,
|
||||
* \c db_modes, and \c visType into each \c __GLcontextModes element.
|
||||
* However, the meanings of \c fb_format and \c fb_type require further
|
||||
* explanation. The \c fb_format specifies which color components are in
|
||||
* each pixel and what the default order is. For example, \c GL_RGB specifies
|
||||
* that red, green, blue are available and red is in the "most significant"
|
||||
* position and blue is in the "least significant". The \c fb_type specifies
|
||||
* the bit sizes of each component and the actual ordering. For example, if
|
||||
* \c GL_UNSIGNED_SHORT_5_6_5_REV is specified with \c GL_RGB, bits [15:11]
|
||||
* are the blue value, bits [10:5] are the green value, and bits [4:0] are
|
||||
* the red value.
|
||||
*
|
||||
* One sublte issue is the combination of \c GL_RGB or \c GL_BGR and either
|
||||
* of the \c GL_UNSIGNED_INT_8_8_8_8 modes. The resulting mask values in the
|
||||
* \c __GLcontextModes structure is \b identical to the \c GL_RGBA or
|
||||
* \c GL_BGRA case, except the \c alphaMask is zero. This means that, as
|
||||
* far as this routine is concerned, \c GL_RGB with \c GL_UNSIGNED_INT_8_8_8_8
|
||||
* still uses 32-bits.
|
||||
*
|
||||
* If in doubt, look at the tables used in the function.
|
||||
*
|
||||
* \param configs the array of configs generated
|
||||
* \param fb_format Format of the framebuffer. Currently only \c GL_RGB,
|
||||
* \c GL_RGBA, \c GL_BGR, and \c GL_BGRA are supported.
|
||||
* \param fb_type Type of the pixels in the framebuffer. Currently only
|
||||
* \c GL_UNSIGNED_SHORT_5_6_5,
|
||||
* \c GL_UNSIGNED_SHORT_5_6_5_REV,
|
||||
* \c GL_UNSIGNED_INT_8_8_8_8, and
|
||||
* \c GL_UNSIGNED_INT_8_8_8_8_REV are supported.
|
||||
* \param depth_bits Array of depth buffer sizes to be exposed.
|
||||
* \param stencil_bits Array of stencil buffer sizes to be exposed.
|
||||
* \param num_depth_stencil_bits Number of entries in both \c depth_bits and
|
||||
* \c stencil_bits.
|
||||
* \param db_modes Array of buffer swap modes. If an element has a
|
||||
* value of \c GLX_NONE, then it represents a
|
||||
* single-buffered mode. Other valid values are
|
||||
* \c GLX_SWAP_EXCHANGE_OML, \c GLX_SWAP_COPY_OML, and
|
||||
* \c GLX_SWAP_UNDEFINED_OML. See the
|
||||
* GLX_OML_swap_method extension spec for more details.
|
||||
* \param num_db_modes Number of entries in \c db_modes.
|
||||
* \param visType GLX visual type. Usually either \c GLX_TRUE_COLOR or
|
||||
* \c GLX_DIRECT_COLOR.
|
||||
*
|
||||
* \returns
|
||||
* \c GL_TRUE on success or \c GL_FALSE on failure. Currently the only
|
||||
* cause of failure is a bad parameter (i.e., unsupported \c fb_format or
|
||||
* \c fb_type).
|
||||
*
|
||||
* \todo
|
||||
* There is currently no way to support packed RGB modes (i.e., modes with
|
||||
* exactly 3 bytes per pixel) or floating-point modes. This could probably
|
||||
* be done by creating some new, private enums with clever names likes
|
||||
* \c GL_UNSIGNED_3BYTE_8_8_8, \c GL_4FLOAT_32_32_32_32,
|
||||
* \c GL_4HALF_16_16_16_16, etc. We can cross that bridge when we come to it.
|
||||
*/
|
||||
EGLBoolean
|
||||
_eglFillInConfigs(_EGLConfig * configs,
|
||||
GLenum fb_format, GLenum fb_type,
|
||||
const u_int8_t * depth_bits, const u_int8_t * stencil_bits,
|
||||
unsigned num_depth_stencil_bits,
|
||||
const GLenum * db_modes, unsigned num_db_modes,
|
||||
int visType)
|
||||
{
|
||||
#if 0
|
||||
static const u_int8_t bits_table[3][4] = {
|
||||
/* R G B A */
|
||||
{ 5, 6, 5, 0 }, /* Any GL_UNSIGNED_SHORT_5_6_5 */
|
||||
{ 8, 8, 8, 0 }, /* Any RGB with any GL_UNSIGNED_INT_8_8_8_8 */
|
||||
{ 8, 8, 8, 8 } /* Any RGBA with any GL_UNSIGNED_INT_8_8_8_8 */
|
||||
};
|
||||
|
||||
/* The following arrays are all indexed by the fb_type masked with 0x07.
|
||||
* Given the four supported fb_type values, this results in valid array
|
||||
* indices of 3, 4, 5, and 7.
|
||||
*/
|
||||
static const u_int32_t masks_table_rgb[8][4] = {
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5 */
|
||||
{0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5_REV */
|
||||
{0xFF000000, 0x00FF0000, 0x0000FF00, 0x00000000}, /* 8_8_8_8 */
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000} /* 8_8_8_8_REV */
|
||||
};
|
||||
|
||||
static const u_int32_t masks_table_rgba[8][4] = {
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5 */
|
||||
{0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5_REV */
|
||||
{0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF}, /* 8_8_8_8 */
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000}, /* 8_8_8_8_REV */
|
||||
};
|
||||
|
||||
static const u_int32_t masks_table_bgr[8][4] = {
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5 */
|
||||
{0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5_REV */
|
||||
{0x0000FF00, 0x00FF0000, 0xFF000000, 0x00000000}, /* 8_8_8_8 */
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000}, /* 8_8_8_8_REV */
|
||||
};
|
||||
|
||||
static const u_int32_t masks_table_bgra[8][4] = {
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5 */
|
||||
{0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5_REV */
|
||||
{0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF}, /* 8_8_8_8 */
|
||||
{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
||||
{0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000}, /* 8_8_8_8_REV */
|
||||
};
|
||||
|
||||
static const u_int8_t bytes_per_pixel[8] = {
|
||||
0, 0, 0, 2, 2, 4, 0, 4
|
||||
};
|
||||
|
||||
const u_int8_t * bits;
|
||||
const u_int32_t * masks;
|
||||
const int index = fb_type & 0x07;
|
||||
_EGLConfig *config;
|
||||
unsigned i;
|
||||
unsigned j;
|
||||
unsigned k;
|
||||
|
||||
if ( bytes_per_pixel[index] == 0 ) {
|
||||
_eglLog(_EGL_INFO,
|
||||
"[%s:%u] Framebuffer type 0x%04x has 0 bytes per pixel.",
|
||||
__FUNCTION__, __LINE__, fb_type);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* Valid types are GL_UNSIGNED_SHORT_5_6_5 and GL_UNSIGNED_INT_8_8_8_8 and
|
||||
* the _REV versions.
|
||||
*
|
||||
* Valid formats are GL_RGBA, GL_RGB, and GL_BGRA.
|
||||
*/
|
||||
switch ( fb_format ) {
|
||||
case GL_RGB:
|
||||
bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[1];
|
||||
masks = masks_table_rgb[index];
|
||||
break;
|
||||
|
||||
case GL_RGBA:
|
||||
bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[2];
|
||||
masks = masks_table_rgba[index];
|
||||
break;
|
||||
|
||||
case GL_BGR:
|
||||
bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[1];
|
||||
masks = masks_table_bgr[index];
|
||||
break;
|
||||
|
||||
case GL_BGRA:
|
||||
bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[2];
|
||||
masks = masks_table_bgra[index];
|
||||
break;
|
||||
|
||||
default:
|
||||
_eglLog(_EGL_WARNING,
|
||||
"[%s:%u] Framebuffer format 0x%04x is not GL_RGB, GL_RGBA, GL_BGR, or GL_BGRA.",
|
||||
__FUNCTION__, __LINE__, fb_format);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
config = configs;
|
||||
for (k = 0; k < num_depth_stencil_bits; k++) {
|
||||
for (i = 0; i < num_db_modes; i++) {
|
||||
for (j = 0; j < 2; j++) {
|
||||
_eglSetConfigAttrib(config, EGL_RED_SIZE, bits[0]);
|
||||
_eglSetConfigAttrib(config, EGL_GREEN_SIZE, bits[1]);
|
||||
_eglSetConfigAttrib(config, EGL_BLUE_SIZE, bits[2]);
|
||||
_eglSetConfigAttrib(config, EGL_ALPHA_SIZE, bits[3]);
|
||||
_eglSetConfigAttrib(config, EGL_BUFFER_SIZE,
|
||||
bits[0] + bits[1] + bits[2] + bits[3]);
|
||||
|
||||
_eglSetConfigAttrib(config, EGL_STENCIL_SIZE, stencil_bits[k]);
|
||||
_eglSetConfigAttrib(config, EGL_DEPTH_SIZE, depth_bits[i]);
|
||||
|
||||
_eglSetConfigAttrib(config, EGL_SURFACE_TYPE, EGL_SCREEN_BIT_MESA |
|
||||
EGL_PBUFFER_BIT | EGL_PIXMAP_BIT | EGL_WINDOW_BIT);
|
||||
|
||||
config++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
#else
|
||||
return GL_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
#ifndef EGLCONFIGUTIL_INCLUDED
|
||||
#define EGLCONFIGUTIL_INCLUDED
|
||||
|
||||
#include "eglconfig.h"
|
||||
#include "GL/internal/glcore.h"
|
||||
|
||||
|
||||
extern void
|
||||
_eglConfigToContextModesRec(const _EGLConfig *config, __GLcontextModes *mode);
|
||||
|
||||
|
||||
extern EGLBoolean
|
||||
_eglFillInConfigs( _EGLConfig *configs,
|
||||
EGLenum fb_format, EGLenum fb_type,
|
||||
const u_int8_t * depth_bits, const u_int8_t * stencil_bits,
|
||||
unsigned num_depth_stencil_bits,
|
||||
const EGLenum * db_modes, unsigned num_db_modes,
|
||||
int visType );
|
||||
|
||||
|
||||
|
||||
#endif /* EGLCONFIGUTIL_INCLUDED */
|
||||
+54
-25
@@ -6,12 +6,12 @@
|
||||
#include "egldisplay.h"
|
||||
#include "egldriver.h"
|
||||
#include "eglglobals.h"
|
||||
#include "eglhash.h"
|
||||
#include "eglsurface.h"
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the given _EGLContext object to defaults.
|
||||
* Initialize the given _EGLContext object to defaults and/or the values
|
||||
* in the attrib_list.
|
||||
*/
|
||||
EGLBoolean
|
||||
_eglInitContext(_EGLDriver *drv, EGLDisplay dpy, _EGLContext *ctx,
|
||||
@@ -20,42 +20,54 @@ _eglInitContext(_EGLDriver *drv, EGLDisplay dpy, _EGLContext *ctx,
|
||||
_EGLConfig *conf;
|
||||
_EGLDisplay *display = _eglLookupDisplay(dpy);
|
||||
EGLint i;
|
||||
const EGLenum api = eglQueryAPI();
|
||||
|
||||
conf = _eglLookupConfig(drv, dpy, config);
|
||||
if (!conf) {
|
||||
_eglError(EGL_BAD_CONFIG, "eglCreateContext");
|
||||
if (api == EGL_NONE) {
|
||||
_eglError(EGL_BAD_MATCH, "eglCreateContext(no client API)");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
|
||||
switch (attrib_list[i]) {
|
||||
/* no attribs defined for now */
|
||||
default:
|
||||
_eglError(EGL_BAD_ATTRIBUTE, "eglCreateContext");
|
||||
return EGL_NO_CONTEXT;
|
||||
}
|
||||
conf = _eglLookupConfig(drv, dpy, config);
|
||||
if (!conf) {
|
||||
_eglError(EGL_BAD_CONFIG, "_eglInitContext");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
memset(ctx, 0, sizeof(_EGLContext));
|
||||
|
||||
ctx->ClientVersion = 1; /* the default, per EGL spec */
|
||||
|
||||
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
|
||||
switch (attrib_list[i]) {
|
||||
case EGL_CONTEXT_CLIENT_VERSION:
|
||||
i++;
|
||||
ctx->ClientVersion = attrib_list[i];
|
||||
break;
|
||||
default:
|
||||
_eglError(EGL_BAD_ATTRIBUTE, "_eglInitContext");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
ctx->Display = display;
|
||||
ctx->Config = conf;
|
||||
ctx->DrawSurface = EGL_NO_SURFACE;
|
||||
ctx->ReadSurface = EGL_NO_SURFACE;
|
||||
ctx->ClientAPI = api;
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Assign an EGLContext handle to the _EGLContext object then put it into
|
||||
* the hash table.
|
||||
/**
|
||||
* Save a new _EGLContext into the hash table.
|
||||
*/
|
||||
void
|
||||
_eglSaveContext(_EGLContext *ctx)
|
||||
{
|
||||
assert(ctx);
|
||||
ctx->Handle = _eglHashGenKey(_eglGlobal.Contexts);
|
||||
_eglHashInsert(_eglGlobal.Contexts, ctx->Handle, ctx);
|
||||
/* no-op.
|
||||
* Public EGLContext handle and private _EGLContext are the same.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -65,19 +77,34 @@ _eglSaveContext(_EGLContext *ctx)
|
||||
void
|
||||
_eglRemoveContext(_EGLContext *ctx)
|
||||
{
|
||||
_eglHashRemove(_eglGlobal.Contexts, ctx->Handle);
|
||||
/* no-op.
|
||||
* Public EGLContext handle and private _EGLContext are the same.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the public handle for the given private context ptr.
|
||||
* This is the inverse of _eglLookupContext().
|
||||
*/
|
||||
EGLContext
|
||||
_eglGetContextHandle(_EGLContext *ctx)
|
||||
{
|
||||
/* just a cast! */
|
||||
return (EGLContext) ctx;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the _EGLContext object that corresponds to the given
|
||||
* EGLContext handle.
|
||||
* This is the inverse of _eglGetContextHandle().
|
||||
*/
|
||||
_EGLContext *
|
||||
_eglLookupContext(EGLContext ctx)
|
||||
{
|
||||
_EGLContext *c = (_EGLContext *) _eglHashLookup(_eglGlobal.Contexts, ctx);
|
||||
return c;
|
||||
/* just a cast since EGLContext is just a void ptr */
|
||||
return (_EGLContext *) ctx;
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +139,7 @@ _eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
|
||||
}
|
||||
|
||||
_eglSaveContext(context);
|
||||
return context->Handle;
|
||||
return (EGLContext) context;
|
||||
#endif
|
||||
return EGL_NO_CONTEXT;
|
||||
}
|
||||
@@ -126,7 +153,6 @@ _eglDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx)
|
||||
{
|
||||
_EGLContext *context = _eglLookupContext(ctx);
|
||||
if (context) {
|
||||
_eglHashRemove(_eglGlobal.Contexts, ctx);
|
||||
if (context->IsBound) {
|
||||
context->DeletePending = EGL_TRUE;
|
||||
}
|
||||
@@ -163,8 +189,11 @@ _eglQueryContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx,
|
||||
#ifdef EGL_VERSION_1_2
|
||||
case EGL_CONTEXT_CLIENT_TYPE:
|
||||
*value = c->ClientAPI;
|
||||
return EGL_FALSE;
|
||||
return EGL_TRUE;
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
case EGL_CONTEXT_CLIENT_VERSION:
|
||||
*value = c->ClientVersion;
|
||||
return EGL_TRUE;
|
||||
default:
|
||||
_eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext");
|
||||
return EGL_FALSE;
|
||||
@@ -239,7 +268,7 @@ _eglMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface d,
|
||||
ctx = NULL;
|
||||
}
|
||||
/* really delete context now */
|
||||
drv->API.DestroyContext(drv, dpy, oldContext->Handle);
|
||||
drv->API.DestroyContext(drv, dpy, _eglGetContextHandle(oldContext));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
*/
|
||||
struct _egl_context
|
||||
{
|
||||
EGLContext Handle; /* The public/opaque handle which names this object */
|
||||
|
||||
_EGLDisplay *Display; /* who do I belong to? */
|
||||
|
||||
_EGLConfig *Config;
|
||||
@@ -22,9 +20,9 @@ struct _egl_context
|
||||
|
||||
EGLBoolean IsBound;
|
||||
EGLBoolean DeletePending;
|
||||
#ifdef EGL_VERSION_1_2
|
||||
EGLint ClientAPI; /* Either EGL_OPENGL_ES_API or EGL_OPENVG_API */
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
|
||||
EGLint ClientAPI; /**< EGL_OPENGL_ES_API, EGL_OPENGL_API, EGL_OPENVG_API */
|
||||
EGLint ClientVersion; /**< 1 = OpenGLES 1.x, 2 = OpenGLES 2.x */
|
||||
};
|
||||
|
||||
|
||||
@@ -41,6 +39,10 @@ extern void
|
||||
_eglRemoveContext(_EGLContext *ctx);
|
||||
|
||||
|
||||
extern EGLContext
|
||||
_eglGetContextHandle(_EGLContext *ctx);
|
||||
|
||||
|
||||
extern _EGLContext *
|
||||
_eglLookupContext(EGLContext ctx);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
@@ -24,43 +24,22 @@
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
**************************************************************************/
|
||||
/*
|
||||
* Authors:
|
||||
* Keith Whitwell <keith@tungstengraphics.com>
|
||||
* Brian Paul
|
||||
*/
|
||||
|
||||
#include "tnl/t_vp_build.h"
|
||||
|
||||
#include "pipe/p_context.h"
|
||||
#include "pipe/p_defines.h"
|
||||
|
||||
#include "st_context.h"
|
||||
#include "st_atom.h"
|
||||
|
||||
|
||||
#define TGSI_DEBUG 0
|
||||
|
||||
|
||||
/**
|
||||
* When TnL state has changed, need to generate new vertex program.
|
||||
* This should be done before updating the vertes shader (vs) state.
|
||||
* Internal EGL defines
|
||||
*/
|
||||
static void update_tnl( struct st_context *st )
|
||||
{
|
||||
/* Would be good to avoid this when shaders are active:
|
||||
*/
|
||||
_tnl_UpdateFixedFunctionProgram( st->ctx );
|
||||
}
|
||||
|
||||
|
||||
const struct st_tracked_state st_update_tnl = {
|
||||
"st_update_tnl", /* name */
|
||||
{ /* dirty */
|
||||
TNL_FIXED_FUNCTION_STATE_FLAGS, /* mesa */
|
||||
0 /* st */
|
||||
},
|
||||
update_tnl /* update */
|
||||
};
|
||||
#ifndef EGLDEFINES_INCLUDED
|
||||
#define EGLDEFINES_INCLUDED
|
||||
|
||||
|
||||
#define _EGL_MAX_EXTENSIONS_LEN 1000
|
||||
|
||||
#define _EGL_VENDOR_STRING "Mesa Project"
|
||||
|
||||
|
||||
|
||||
#endif /* EGLDEFINES_INCLUDED */
|
||||
+76
-26
@@ -1,52 +1,88 @@
|
||||
|
||||
/**
|
||||
* Functions related to EGLDisplay.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "eglcontext.h"
|
||||
#include "egldisplay.h"
|
||||
#include "egldriver.h"
|
||||
#include "eglglobals.h"
|
||||
#include "eglhash.h"
|
||||
|
||||
|
||||
static char *
|
||||
my_strdup(const char *s)
|
||||
{
|
||||
int l = strlen(s);
|
||||
char *s2 = malloc(l + 1);
|
||||
strcpy(s2, s);
|
||||
return s2;
|
||||
}
|
||||
#include "eglstring.h"
|
||||
|
||||
|
||||
/**
|
||||
* We're assuming that the NativeDisplayType parameter is actually
|
||||
* a string.
|
||||
* Return a new _EGLDisplay object for the given displayName
|
||||
* Allocate a new _EGLDisplay object for the given nativeDisplay handle.
|
||||
* We'll also try to determine the device driver name at this time.
|
||||
*
|
||||
* Note that nativeDisplay may be an X Display ptr, or a string.
|
||||
*/
|
||||
_EGLDisplay *
|
||||
_eglNewDisplay(NativeDisplayType displayName)
|
||||
_eglNewDisplay(NativeDisplayType nativeDisplay)
|
||||
{
|
||||
_EGLDisplay *dpy = (_EGLDisplay *) calloc(1, sizeof(_EGLDisplay));
|
||||
if (dpy) {
|
||||
dpy->Handle = _eglHashGenKey(_eglGlobal.Displays);
|
||||
_eglHashInsert(_eglGlobal.Displays, dpy->Handle, dpy);
|
||||
if (displayName)
|
||||
dpy->Name = my_strdup(displayName);
|
||||
else
|
||||
dpy->Name = NULL;
|
||||
dpy->Driver = NULL; /* this gets set later */
|
||||
EGLuint key = _eglHashGenKey(_eglGlobal.Displays);
|
||||
|
||||
dpy->Handle = (EGLDisplay) key;
|
||||
_eglHashInsert(_eglGlobal.Displays, key, dpy);
|
||||
|
||||
dpy->NativeDisplay = nativeDisplay;
|
||||
#if defined(_EGL_PLATFORM_X)
|
||||
dpy->Xdpy = (Display *) nativeDisplay;
|
||||
#endif
|
||||
|
||||
dpy->DriverName = _eglChooseDriver(dpy);
|
||||
if (!dpy->DriverName) {
|
||||
free(dpy);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return dpy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the public handle for an internal _EGLDisplay.
|
||||
* This is the inverse of _eglLookupDisplay().
|
||||
*/
|
||||
EGLDisplay
|
||||
_eglGetDisplayHandle(_EGLDisplay *display)
|
||||
{
|
||||
if (display)
|
||||
return display->Handle;
|
||||
else
|
||||
return EGL_NO_DISPLAY;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the _EGLDisplay object that corresponds to the given public/
|
||||
* opaque display handle.
|
||||
* This is the inverse of _eglGetDisplayHandle().
|
||||
*/
|
||||
_EGLDisplay *
|
||||
_eglLookupDisplay(EGLDisplay dpy)
|
||||
{
|
||||
_EGLDisplay *d = (_EGLDisplay *) _eglHashLookup(_eglGlobal.Displays, dpy);
|
||||
return d;
|
||||
EGLuint key = (EGLuint) dpy;
|
||||
if (!_eglGlobal.Displays)
|
||||
return NULL;
|
||||
return (_EGLDisplay *) _eglHashLookup(_eglGlobal.Displays, key);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_eglSaveDisplay(_EGLDisplay *dpy)
|
||||
{
|
||||
EGLuint key = _eglHashGenKey(_eglGlobal.Displays);
|
||||
assert(dpy);
|
||||
assert(!dpy->Handle);
|
||||
dpy->Handle = (EGLDisplay) key;
|
||||
assert(dpy->Handle);
|
||||
_eglHashInsert(_eglGlobal.Displays, key, dpy);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,11 +97,25 @@ _eglGetCurrentDisplay(void)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Free all the data hanging of an _EGLDisplay object, but not
|
||||
* the object itself.
|
||||
*/
|
||||
void
|
||||
_eglCleanupDisplay(_EGLDisplay *disp)
|
||||
{
|
||||
/* XXX incomplete */
|
||||
EGLint i;
|
||||
|
||||
for (i = 0; i < disp->NumConfigs; i++) {
|
||||
free(disp->Configs[i]);
|
||||
}
|
||||
free(disp->Configs);
|
||||
free(disp->Name);
|
||||
/* driver deletes _EGLDisplay */
|
||||
disp->Configs = NULL;
|
||||
|
||||
/* XXX incomplete */
|
||||
|
||||
free((void *) disp->DriverName);
|
||||
disp->DriverName = NULL;
|
||||
|
||||
/* driver deletes the _EGLDisplay object */
|
||||
}
|
||||
|
||||
@@ -1,22 +1,31 @@
|
||||
#ifndef EGLDISPLAY_INCLUDED
|
||||
#define EGLDISPLAY_INCLUDED
|
||||
|
||||
#ifdef _EGL_PLATFORM_X
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
#include "egltypedefs.h"
|
||||
|
||||
|
||||
struct _egl_display
|
||||
{
|
||||
EGLNativeDisplayType NativeDisplay;
|
||||
EGLDisplay Handle;
|
||||
|
||||
char *Name;
|
||||
const char *DriverName;
|
||||
const char *DriverArgs;
|
||||
_EGLDriver *Driver;
|
||||
|
||||
EGLint NumScreens;
|
||||
_EGLScreen **Screens; /* array [NumScreens] */
|
||||
|
||||
EGLint NumConfigs;
|
||||
_EGLConfig *Configs; /* array [NumConfigs] */
|
||||
_EGLConfig **Configs; /* array [NumConfigs] of ptr to _EGLConfig */
|
||||
|
||||
#ifdef _EGL_PLATFORM_X
|
||||
Display *Xdpy;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -24,10 +33,18 @@ extern _EGLDisplay *
|
||||
_eglNewDisplay(NativeDisplayType displayName);
|
||||
|
||||
|
||||
EGLDisplay
|
||||
_eglGetDisplayHandle(_EGLDisplay *display);
|
||||
|
||||
|
||||
extern _EGLDisplay *
|
||||
_eglLookupDisplay(EGLDisplay dpy);
|
||||
|
||||
|
||||
extern void
|
||||
_eglSaveDisplay(_EGLDisplay *dpy);
|
||||
|
||||
|
||||
extern _EGLDisplay *
|
||||
_eglGetCurrentDisplay(void);
|
||||
|
||||
|
||||
+245
-108
@@ -1,112 +1,261 @@
|
||||
/**
|
||||
* Functions for choosing and opening/loading device drivers.
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "eglconfig.h"
|
||||
#include "eglcontext.h"
|
||||
#include "egldefines.h"
|
||||
#include "egldisplay.h"
|
||||
#include "egldriver.h"
|
||||
#include "eglglobals.h"
|
||||
#include "egllog.h"
|
||||
#include "eglmisc.h"
|
||||
#include "eglmode.h"
|
||||
#include "eglscreen.h"
|
||||
#include "eglstring.h"
|
||||
#include "eglsurface.h"
|
||||
|
||||
#if defined(_EGL_PLATFORM_X)
|
||||
#include <dlfcn.h>
|
||||
#include "eglx.h"
|
||||
#elif defined(_EGL_PLATFORM_WINDOWS)
|
||||
/* XXX to do */
|
||||
#elif defined(_EGL_PLATFORM_WINCE)
|
||||
/* XXX to do */
|
||||
#endif
|
||||
|
||||
|
||||
static const char *DefaultDriverName = ":0";
|
||||
static const char *SysFS = "/sys/class";
|
||||
|
||||
const char *DefaultDriverName = "demodriver";
|
||||
|
||||
|
||||
/**
|
||||
* Choose and open/init the hardware driver for the given EGLDisplay.
|
||||
* Previously, the EGLDisplay was created with _eglNewDisplay() where
|
||||
* we recorded the user's NativeDisplayType parameter.
|
||||
* Wrappers for dlopen/dlclose()
|
||||
*/
|
||||
#if defined(_EGL_PLATFORM_WINDOWS)
|
||||
|
||||
typedef HMODULE lib_handle;
|
||||
|
||||
static HMODULE
|
||||
open_library(const char *filename)
|
||||
{
|
||||
return LoadLibrary(filename);
|
||||
}
|
||||
|
||||
static void
|
||||
close_library(HMODULE lib)
|
||||
{
|
||||
FreeLibrary(lib);
|
||||
}
|
||||
|
||||
#elif defined(_EGL_PLATFORM_X)
|
||||
|
||||
typedef void * lib_handle;
|
||||
|
||||
static void *
|
||||
open_library(const char *filename)
|
||||
{
|
||||
return dlopen(filename, RTLD_LAZY);
|
||||
}
|
||||
|
||||
static void
|
||||
close_library(void *lib)
|
||||
{
|
||||
dlclose(lib);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Given a card number, use sysfs to determine the DRI driver name.
|
||||
*/
|
||||
const char *
|
||||
_eglChooseDRMDriver(int card)
|
||||
{
|
||||
#if 0
|
||||
return _eglstrdup("libEGLdri");
|
||||
#else
|
||||
char path[2000], driverName[2000];
|
||||
FILE *f;
|
||||
int length;
|
||||
|
||||
snprintf(path, sizeof(path), "%s/drm/card%d/dri_library_name", SysFS, card);
|
||||
|
||||
f = fopen(path, "r");
|
||||
if (!f)
|
||||
return NULL;
|
||||
|
||||
fgets(driverName, sizeof(driverName), f);
|
||||
fclose(f);
|
||||
|
||||
if ((length = strlen(driverName)) > 1) {
|
||||
/* remove the trailing newline from sysfs */
|
||||
driverName[length - 1] = '\0';
|
||||
strncat(driverName, "_dri", sizeof(driverName));
|
||||
return _eglstrdup(driverName);
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* XXX this function is totally subject change!!!
|
||||
*
|
||||
* Now we'll use the NativeDisplayType value.
|
||||
*
|
||||
* Currently, the native display value is treated as a string.
|
||||
* Determine/return the name of the driver to use for the given _EGLDisplay.
|
||||
*
|
||||
* Try to be clever and determine if nativeDisplay is an Xlib Display
|
||||
* ptr or a string (naming a driver or screen number, etc).
|
||||
*
|
||||
* If the first character is ':' we interpret it as a screen or card index
|
||||
* number (i.e. ":0" or ":1", etc)
|
||||
* Else if the first character is '!' we interpret it as specific driver name
|
||||
* (i.e. "!r200" or "!i830".
|
||||
*
|
||||
* Whatever follows ':' is copied and put into dpy->DriverArgs.
|
||||
*
|
||||
* The caller may free() the returned string.
|
||||
*/
|
||||
_EGLDriver *
|
||||
_eglChooseDriver(EGLDisplay display)
|
||||
const char *
|
||||
_eglChooseDriver(_EGLDisplay *dpy)
|
||||
{
|
||||
_EGLDisplay *dpy = _eglLookupDisplay(display);
|
||||
_EGLDriver *drv;
|
||||
const char *driverName = DefaultDriverName;
|
||||
const char *name;
|
||||
const char *displayString = (const char *) dpy->NativeDisplay;
|
||||
const char *driverName = NULL;
|
||||
|
||||
assert(dpy);
|
||||
(void) DefaultDriverName;
|
||||
|
||||
name = dpy->Name;
|
||||
if (!name) {
|
||||
/* use default */
|
||||
/* First, if the EGL_DRIVER env var is set, use that */
|
||||
driverName = getenv("EGL_DRIVER");
|
||||
if (driverName)
|
||||
return _eglstrdup(driverName);
|
||||
|
||||
#if 0
|
||||
if (!displayString) {
|
||||
/* choose a default */
|
||||
displayString = DefaultDriverName;
|
||||
}
|
||||
else if (name[0] == ':' && (name[1] >= '0' && name[1] <= '9') && !name[2]) {
|
||||
/* XXX probe hardware here to determine which driver to open */
|
||||
driverName = "libEGLdri";
|
||||
#endif
|
||||
/* extract default DriverArgs = whatever follows ':' */
|
||||
if (displayString &&
|
||||
(displayString[0] == '!' ||
|
||||
displayString[0] == ':')) {
|
||||
const char *args = strchr(displayString, ':');
|
||||
if (args)
|
||||
dpy->DriverArgs = _eglstrdup(args + 1);
|
||||
}
|
||||
else if (name[0] == '!') {
|
||||
/* use specified driver name */
|
||||
driverName = name + 1;
|
||||
|
||||
/* determine driver name now */
|
||||
if (displayString && displayString[0] == ':' &&
|
||||
(displayString[1] >= '0' && displayString[1] <= '9') &&
|
||||
!displayString[2]) {
|
||||
int card = atoi(displayString + 1);
|
||||
driverName = _eglChooseDRMDriver(card);
|
||||
}
|
||||
else if (displayString && displayString[0] == '!') {
|
||||
/* use user-specified driver name */
|
||||
driverName = _eglstrdup(displayString + 1);
|
||||
/* truncate driverName at ':' if present */
|
||||
{
|
||||
char *args = strchr(driverName, ':');
|
||||
if (args) {
|
||||
*args = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Maybe display was returned by XOpenDisplay? */
|
||||
_eglLog(_EGL_FATAL, "eglChooseDriver() bad name");
|
||||
/* NativeDisplay is not a string! */
|
||||
#if defined(_EGL_PLATFORM_X)
|
||||
driverName = _xeglChooseDriver(dpy);
|
||||
#elif defined(_EGL_PLATFORM_WINDOWS)
|
||||
/* XXX to do */
|
||||
driverName = _weglChooseDriver(dpy);
|
||||
#elif defined(_EGL_PLATFORM_WINCE)
|
||||
/* XXX to do */
|
||||
#else
|
||||
driverName = DefaultDriverName;
|
||||
#endif
|
||||
}
|
||||
|
||||
_eglLog(_EGL_INFO, "eglChooseDriver() choosing %s", driverName);
|
||||
|
||||
drv = _eglOpenDriver(dpy, driverName);
|
||||
dpy->Driver = drv;
|
||||
|
||||
return drv;
|
||||
return driverName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Open/load the named driver and call its bootstrap function: _eglMain().
|
||||
* By the time this function is called, the dpy->DriverName should have
|
||||
* been determined.
|
||||
*
|
||||
* \return new _EGLDriver object.
|
||||
*/
|
||||
_EGLDriver *
|
||||
_eglOpenDriver(_EGLDisplay *dpy, const char *driverName)
|
||||
_eglOpenDriver(_EGLDisplay *dpy, const char *driverName, const char *args)
|
||||
{
|
||||
_EGLDriver *drv;
|
||||
_EGLMain_t mainFunc;
|
||||
void *lib;
|
||||
lib_handle lib;
|
||||
char driverFilename[1000];
|
||||
|
||||
assert(driverName);
|
||||
|
||||
#if defined(_EGL_PLATFORM_WINDOWS)
|
||||
/* XXX untested */
|
||||
sprintf(driverFilename, "%s.dll", driverName);
|
||||
_eglLog(_EGL_DEBUG, "dlopen(%s)", driverFilename);
|
||||
#elif defined(_EGL_PLATFORM_X)
|
||||
/* XXX also prepend a directory path??? */
|
||||
sprintf(driverFilename, "%s.so", driverName);
|
||||
|
||||
_eglLog(_EGL_DEBUG, "dlopen(%s)", driverFilename);
|
||||
lib = dlopen(driverFilename, RTLD_NOW);
|
||||
#endif
|
||||
lib = open_library(driverFilename);
|
||||
|
||||
if (!lib) {
|
||||
_eglLog(_EGL_WARNING, "Could not open %s (%s)",
|
||||
driverFilename, dlerror());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(_EGL_PLATFORM_WINDOWS)
|
||||
mainFunc = (_EGLMain_t) GetProcAddress(lib, "_eglMain");
|
||||
#elif defined(_EGL_PLATFORM_X)
|
||||
mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain");
|
||||
#endif
|
||||
|
||||
if (!mainFunc) {
|
||||
_eglLog(_EGL_WARNING, "_eglMain not found in %s", driverFilename);
|
||||
dlclose(lib);
|
||||
close_library(lib);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
drv = mainFunc(dpy);
|
||||
drv = mainFunc(dpy, args);
|
||||
if (!drv) {
|
||||
dlclose(lib);
|
||||
close_library(lib);
|
||||
return NULL;
|
||||
}
|
||||
/* with a recurvise open you want the inner most handle */
|
||||
if (!drv->LibHandle)
|
||||
drv->LibHandle = lib;
|
||||
else
|
||||
dlclose(lib);
|
||||
|
||||
drv->Display = dpy;
|
||||
/* with a recurvise open you want the inner most handle */
|
||||
if (!drv->LibHandle) {
|
||||
drv->LibHandle = lib;
|
||||
}
|
||||
else {
|
||||
close_library(lib);
|
||||
}
|
||||
|
||||
/* update the global notion of supported APIs */
|
||||
_eglGlobal.ClientAPIsMask |= drv->ClientAPIsMask;
|
||||
|
||||
_eglSaveDriver(drv);
|
||||
|
||||
return drv;
|
||||
}
|
||||
|
||||
@@ -117,18 +266,30 @@ _eglCloseDriver(_EGLDriver *drv, EGLDisplay dpy)
|
||||
void *handle = drv->LibHandle;
|
||||
EGLBoolean b;
|
||||
|
||||
_eglLog(_EGL_INFO, "Closing driver");
|
||||
_eglLog(_EGL_DEBUG, "Closing %s", drv->Name);
|
||||
|
||||
/*
|
||||
* XXX check for currently bound context/surfaces and delete them?
|
||||
*/
|
||||
|
||||
b = drv->API.Terminate(drv, dpy);
|
||||
dlclose(handle);
|
||||
|
||||
close_library(handle);
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save the given driver pointer in the list of all known drivers.
|
||||
*/
|
||||
void
|
||||
_eglSaveDriver(_EGLDriver *drv)
|
||||
{
|
||||
_eglGlobal.Drivers[ _eglGlobal.NumDrivers++ ] = drv;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Given a display handle, return the _EGLDriver for that display.
|
||||
*/
|
||||
@@ -201,72 +362,48 @@ _eglInitDriverFallbacks(_EGLDriver *drv)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Examine the individual extension enable/disable flags and recompute
|
||||
* the driver's Extensions string.
|
||||
* Try to determine which EGL APIs (OpenGL, OpenGL ES, OpenVG, etc)
|
||||
* are supported on the system by looking for standard library names.
|
||||
*/
|
||||
static void
|
||||
_eglUpdateExtensionsString(_EGLDriver *drv)
|
||||
EGLint
|
||||
_eglFindAPIs(void)
|
||||
{
|
||||
drv->Extensions.String[0] = 0;
|
||||
|
||||
if (drv->Extensions.MESA_screen_surface)
|
||||
strcat(drv->Extensions.String, "EGL_MESA_screen_surface ");
|
||||
if (drv->Extensions.MESA_copy_context)
|
||||
strcat(drv->Extensions.String, "EGL_MESA_copy_context ");
|
||||
assert(strlen(drv->Extensions.String) < MAX_EXTENSIONS_LEN);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const char *
|
||||
_eglQueryString(_EGLDriver *drv, EGLDisplay dpy, EGLint name)
|
||||
{
|
||||
(void) drv;
|
||||
(void) dpy;
|
||||
switch (name) {
|
||||
case EGL_VENDOR:
|
||||
return "Mesa Project";
|
||||
case EGL_VERSION:
|
||||
return "1.0";
|
||||
case EGL_EXTENSIONS:
|
||||
_eglUpdateExtensionsString(drv);
|
||||
return drv->Extensions.String;
|
||||
#ifdef EGL_VERSION_1_2
|
||||
case EGL_CLIENT_APIS:
|
||||
/* XXX need to initialize somewhere */
|
||||
return drv->ClientAPIs;
|
||||
EGLint mask = 0x0;
|
||||
lib_handle lib;
|
||||
#if defined(_EGL_PLATFORM_WINDOWS)
|
||||
/* XXX not sure about these names */
|
||||
const char *es1_libname = "libGLESv1_CM.dll";
|
||||
const char *es2_libname = "libGLESv2.dll";
|
||||
const char *gl_libname = "OpenGL32.dll";
|
||||
const char *vg_libname = "libOpenVG.dll";
|
||||
#elif defined(_EGL_PLATFORM_X)
|
||||
const char *es1_libname = "libGLESv1_CM.so";
|
||||
const char *es2_libname = "libGLESv2.so";
|
||||
const char *gl_libname = "libGL.so";
|
||||
const char *vg_libname = "libOpenVG.so";
|
||||
#endif
|
||||
default:
|
||||
_eglError(EGL_BAD_PARAMETER, "eglQueryString");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean
|
||||
_eglWaitGL(_EGLDriver *drv, EGLDisplay dpy)
|
||||
{
|
||||
/* just a placeholder */
|
||||
(void) drv;
|
||||
(void) dpy;
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean
|
||||
_eglWaitNative(_EGLDriver *drv, EGLDisplay dpy, EGLint engine)
|
||||
{
|
||||
/* just a placeholder */
|
||||
(void) drv;
|
||||
(void) dpy;
|
||||
switch (engine) {
|
||||
case EGL_CORE_NATIVE_ENGINE:
|
||||
break;
|
||||
default:
|
||||
_eglError(EGL_BAD_PARAMETER, "eglWaitNative(engine)");
|
||||
return EGL_FALSE;
|
||||
if ((lib = open_library(es1_libname))) {
|
||||
close_library(lib);
|
||||
mask |= EGL_OPENGL_ES_BIT;
|
||||
}
|
||||
|
||||
return EGL_TRUE;
|
||||
if ((lib = open_library(es2_libname))) {
|
||||
close_library(lib);
|
||||
mask |= EGL_OPENGL_ES2_BIT;
|
||||
}
|
||||
|
||||
if ((lib = open_library(gl_libname))) {
|
||||
close_library(lib);
|
||||
mask |= EGL_OPENGL_BIT;
|
||||
}
|
||||
|
||||
if ((lib = open_library(vg_libname))) {
|
||||
close_library(lib);
|
||||
mask |= EGL_OPENVG_BIT;
|
||||
}
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
+28
-28
@@ -4,9 +4,7 @@
|
||||
|
||||
#include "egltypedefs.h"
|
||||
#include "eglapi.h"
|
||||
|
||||
/* should probably use a dynamic-length string, but this will do */
|
||||
#define MAX_EXTENSIONS_LEN 1000
|
||||
#include "egldefines.h"
|
||||
|
||||
|
||||
/**
|
||||
@@ -17,7 +15,7 @@ struct _egl_extensions
|
||||
EGLBoolean MESA_screen_surface;
|
||||
EGLBoolean MESA_copy_context;
|
||||
|
||||
char String[MAX_EXTENSIONS_LEN];
|
||||
char String[_EGL_MAX_EXTENSIONS_LEN];
|
||||
};
|
||||
|
||||
|
||||
@@ -26,37 +24,48 @@ struct _egl_extensions
|
||||
*/
|
||||
struct _egl_driver
|
||||
{
|
||||
EGLBoolean Initialized; /* set by driver after initialized */
|
||||
EGLBoolean Initialized; /**< set by driver after initialized */
|
||||
|
||||
void *LibHandle; /* dlopen handle */
|
||||
void *LibHandle; /**< dlopen handle */
|
||||
|
||||
_EGLDisplay *Display;
|
||||
const char *Name; /**< name of this driver */
|
||||
|
||||
int ABIversion;
|
||||
int APImajor, APIminor; /* returned through eglInitialize */
|
||||
const char *ClientAPIs;
|
||||
int APImajor, APIminor; /**< as returned by eglInitialize() */
|
||||
char Version[1000]; /**< initialized from APImajor/minor, Name */
|
||||
|
||||
_EGLAPI API;
|
||||
/** Bitmask of supported APIs (EGL_xx_BIT) set by the driver during init */
|
||||
EGLint ClientAPIsMask;
|
||||
|
||||
_EGLAPI API; /**< EGL API dispatch table */
|
||||
|
||||
_EGLExtensions Extensions;
|
||||
|
||||
int LargestPbuffer;
|
||||
};
|
||||
|
||||
|
||||
extern _EGLDriver *_eglMain(_EGLDisplay *dpy);
|
||||
extern _EGLDriver *_eglMain(_EGLDisplay *dpy, const char *args);
|
||||
|
||||
|
||||
extern const char *
|
||||
_eglChooseDRMDriver(int card);
|
||||
|
||||
extern const char *
|
||||
_eglChooseDriver(_EGLDisplay *dpy);
|
||||
|
||||
|
||||
extern _EGLDriver *
|
||||
_eglChooseDriver(EGLDisplay dpy);
|
||||
|
||||
|
||||
extern _EGLDriver *
|
||||
_eglOpenDriver(_EGLDisplay *dpy, const char *driverName);
|
||||
_eglOpenDriver(_EGLDisplay *dpy, const char *driverName, const char *args);
|
||||
|
||||
|
||||
extern EGLBoolean
|
||||
_eglCloseDriver(_EGLDriver *drv, EGLDisplay dpy);
|
||||
|
||||
|
||||
extern void
|
||||
_eglSaveDriver(_EGLDriver *drv);
|
||||
|
||||
|
||||
extern _EGLDriver *
|
||||
_eglLookupDriver(EGLDisplay d);
|
||||
|
||||
@@ -65,17 +74,8 @@ extern void
|
||||
_eglInitDriverFallbacks(_EGLDriver *drv);
|
||||
|
||||
|
||||
extern const char *
|
||||
_eglQueryString(_EGLDriver *drv, EGLDisplay dpy, EGLint name);
|
||||
|
||||
|
||||
extern EGLBoolean
|
||||
_eglWaitGL(_EGLDriver *drv, EGLDisplay dpy);
|
||||
|
||||
|
||||
extern EGLBoolean
|
||||
_eglWaitNative(_EGLDriver *drv, EGLDisplay dpy, EGLint engine);
|
||||
|
||||
extern EGLint
|
||||
_eglFindAPIs(void);
|
||||
|
||||
|
||||
#endif /* EGLDRIVER_INCLUDED */
|
||||
|
||||
@@ -15,13 +15,11 @@ _eglInitGlobals(void)
|
||||
{
|
||||
if (!_eglGlobal.Initialized) {
|
||||
_eglGlobal.Displays = _eglNewHashTable();
|
||||
_eglGlobal.Contexts = _eglNewHashTable();
|
||||
_eglGlobal.Surfaces = _eglNewHashTable();
|
||||
_eglGlobal.FreeScreenHandle = 1;
|
||||
_eglGlobal.Initialized = EGL_TRUE;
|
||||
|
||||
_eglGlobal.OpenGLESAPISupported = EGL_TRUE;
|
||||
_eglGlobal.OpenVGAPISupported = EGL_FALSE;
|
||||
_eglGlobal.ClientAPIsMask = 0x0;
|
||||
|
||||
/* XXX temporary */
|
||||
_eglGlobal.ThreadInfo = _eglNewThreadInfo();
|
||||
@@ -37,7 +35,6 @@ _eglDestroyGlobals(void)
|
||||
{
|
||||
/* XXX TODO walk over table entries, deleting each */
|
||||
_eglDeleteHashTable(_eglGlobal.Displays);
|
||||
_eglDeleteHashTable(_eglGlobal.Contexts);
|
||||
_eglDeleteHashTable(_eglGlobal.Surfaces);
|
||||
}
|
||||
|
||||
@@ -52,7 +49,7 @@ _eglNewThreadInfo(void)
|
||||
if (t) {
|
||||
t->CurrentContext = EGL_NO_CONTEXT;
|
||||
t->LastError = EGL_SUCCESS;
|
||||
t->CurrentAPI = EGL_NONE;
|
||||
t->CurrentAPI = EGL_OPENGL_ES_API; /* default, per EGL spec */
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
@@ -24,17 +24,20 @@ struct _egl_global
|
||||
EGLBoolean Initialized;
|
||||
|
||||
_EGLHashtable *Displays;
|
||||
_EGLHashtable *Contexts;
|
||||
_EGLHashtable *Surfaces;
|
||||
|
||||
EGLScreenMESA FreeScreenHandle;
|
||||
|
||||
/* XXX these may be temporary */
|
||||
EGLBoolean OpenGLESAPISupported;
|
||||
EGLBoolean OpenVGAPISupported;
|
||||
/* bitmaks of supported APIs (supported by _some_ driver) */
|
||||
EGLint ClientAPIsMask;
|
||||
|
||||
char ClientAPIs[1000]; /**< updated by eglQueryString */
|
||||
|
||||
/* XXX temporary - should be thread-specific data (TSD) */
|
||||
_EGLThreadInfo *ThreadInfo;
|
||||
|
||||
EGLint NumDrivers;
|
||||
_EGLDriver *Drivers[10];
|
||||
};
|
||||
|
||||
|
||||
|
||||
+16
-14
@@ -1,5 +1,7 @@
|
||||
/**
|
||||
* Logging facility for debug/info messages.
|
||||
* _EGL_FATAL messages are printed to stderr
|
||||
* The EGL_LOG_LEVEL var controls the output of other warning/info/debug msgs.
|
||||
*/
|
||||
|
||||
|
||||
@@ -10,37 +12,37 @@
|
||||
#include "egllog.h"
|
||||
|
||||
#define MAXSTRING 1000
|
||||
#define FALLBACK_LOG_LEVEL _EGL_DEBUG
|
||||
#define FALLBACK_LOG_LEVEL_STR "debug"
|
||||
#define FALLBACK_LOG_LEVEL _EGL_WARNING
|
||||
#define FALLBACK_LOG_LEVEL_STR "warning"
|
||||
|
||||
static EGLint ReportingLevel = -1;
|
||||
|
||||
|
||||
static void
|
||||
log_level_initialize (void)
|
||||
log_level_initialize(void)
|
||||
{
|
||||
char *log_env = getenv ("EGL_LOG_LEVEL");
|
||||
char *log_env = getenv("EGL_LOG_LEVEL");
|
||||
|
||||
if (log_env == NULL) {
|
||||
ReportingLevel = FALLBACK_LOG_LEVEL;
|
||||
}
|
||||
else if (strcasecmp (log_env, "fatal") == 0) {
|
||||
else if (strcasecmp(log_env, "fatal") == 0) {
|
||||
ReportingLevel = _EGL_FATAL;
|
||||
}
|
||||
else if (strcasecmp (log_env, "warning") == 0) {
|
||||
else if (strcasecmp(log_env, "warning") == 0) {
|
||||
ReportingLevel = _EGL_WARNING;
|
||||
}
|
||||
else if (strcasecmp (log_env, "info") == 0) {
|
||||
else if (strcasecmp(log_env, "info") == 0) {
|
||||
ReportingLevel = _EGL_INFO;
|
||||
}
|
||||
else if (strcasecmp (log_env, "debug") == 0) {
|
||||
else if (strcasecmp(log_env, "debug") == 0) {
|
||||
ReportingLevel = _EGL_DEBUG;
|
||||
}
|
||||
else {
|
||||
fprintf (stderr, "Unrecognized EGL_LOG_LEVEL environment variable value. "
|
||||
"Expected one of \"fatal\", \"warning\", \"info\", \"debug\". "
|
||||
"Got \"%s\". Falling back to \"%s\".\n",
|
||||
log_env, FALLBACK_LOG_LEVEL_STR);
|
||||
fprintf(stderr, "Unrecognized EGL_LOG_LEVEL environment variable value. "
|
||||
"Expected one of \"fatal\", \"warning\", \"info\", \"debug\". "
|
||||
"Got \"%s\". Falling back to \"%s\".\n",
|
||||
log_env, FALLBACK_LOG_LEVEL_STR);
|
||||
ReportingLevel = FALLBACK_LOG_LEVEL;
|
||||
}
|
||||
}
|
||||
@@ -59,7 +61,7 @@ _eglLog(EGLint level, const char *fmtStr, ...)
|
||||
static int log_level_initialized = 0;
|
||||
|
||||
if (!log_level_initialized) {
|
||||
log_level_initialize ();
|
||||
log_level_initialize();
|
||||
log_level_initialized = 1;
|
||||
}
|
||||
|
||||
@@ -85,7 +87,7 @@ _eglLog(EGLint level, const char *fmtStr, ...)
|
||||
vsnprintf(msg, MAXSTRING, fmtStr, args);
|
||||
va_end(args);
|
||||
|
||||
fprintf(stderr, "EGL %s: %s\n", levelStr, msg);
|
||||
fprintf(stderr, "libEGL %s: %s\n", levelStr, msg);
|
||||
|
||||
if (level == _EGL_FATAL) {
|
||||
exit(1); /* or abort()? */
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* 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, sub license, 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 NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Small/misc EGL functions
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "eglglobals.h"
|
||||
#include "eglmisc.h"
|
||||
|
||||
|
||||
/**
|
||||
* Examine the individual extension enable/disable flags and recompute
|
||||
* the driver's Extensions string.
|
||||
*/
|
||||
static void
|
||||
_eglUpdateExtensionsString(_EGLDriver *drv)
|
||||
{
|
||||
drv->Extensions.String[0] = 0;
|
||||
|
||||
if (drv->Extensions.MESA_screen_surface)
|
||||
strcat(drv->Extensions.String, "EGL_MESA_screen_surface ");
|
||||
if (drv->Extensions.MESA_copy_context)
|
||||
strcat(drv->Extensions.String, "EGL_MESA_copy_context ");
|
||||
assert(strlen(drv->Extensions.String) < _EGL_MAX_EXTENSIONS_LEN);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_eglUpdateAPIsString(_EGLDriver *drv)
|
||||
{
|
||||
_eglGlobal.ClientAPIs[0] = 0;
|
||||
|
||||
if (_eglGlobal.ClientAPIsMask & EGL_OPENGL_BIT)
|
||||
strcat(_eglGlobal.ClientAPIs, "OpenGL ");
|
||||
|
||||
if (_eglGlobal.ClientAPIsMask & EGL_OPENGL_ES_BIT)
|
||||
strcat(_eglGlobal.ClientAPIs, "OpenGL_ES ");
|
||||
|
||||
if (_eglGlobal.ClientAPIsMask & EGL_OPENGL_ES2_BIT)
|
||||
strcat(_eglGlobal.ClientAPIs, "OpenGL_ES2 ");
|
||||
|
||||
if (_eglGlobal.ClientAPIsMask & EGL_OPENVG_BIT)
|
||||
strcat(_eglGlobal.ClientAPIs, "OpenVG ");
|
||||
|
||||
assert(strlen(_eglGlobal.ClientAPIs) < sizeof(_eglGlobal.ClientAPIs));
|
||||
}
|
||||
|
||||
|
||||
|
||||
const char *
|
||||
_eglQueryString(_EGLDriver *drv, EGLDisplay dpy, EGLint name)
|
||||
{
|
||||
(void) drv;
|
||||
(void) dpy;
|
||||
switch (name) {
|
||||
case EGL_VENDOR:
|
||||
return _EGL_VENDOR_STRING;
|
||||
case EGL_VERSION:
|
||||
return drv->Version;
|
||||
case EGL_EXTENSIONS:
|
||||
_eglUpdateExtensionsString(drv);
|
||||
return drv->Extensions.String;
|
||||
#ifdef EGL_VERSION_1_2
|
||||
case EGL_CLIENT_APIS:
|
||||
_eglUpdateAPIsString(drv);
|
||||
return _eglGlobal.ClientAPIs;
|
||||
#endif
|
||||
default:
|
||||
_eglError(EGL_BAD_PARAMETER, "eglQueryString");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean
|
||||
_eglWaitGL(_EGLDriver *drv, EGLDisplay dpy)
|
||||
{
|
||||
/* just a placeholder */
|
||||
(void) drv;
|
||||
(void) dpy;
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean
|
||||
_eglWaitNative(_EGLDriver *drv, EGLDisplay dpy, EGLint engine)
|
||||
{
|
||||
/* just a placeholder */
|
||||
(void) drv;
|
||||
(void) dpy;
|
||||
switch (engine) {
|
||||
case EGL_CORE_NATIVE_ENGINE:
|
||||
break;
|
||||
default:
|
||||
_eglError(EGL_BAD_PARAMETER, "eglWaitNative(engine)");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
@@ -25,49 +25,23 @@
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef INTEL_WINSYS_H
|
||||
#define INTEL_WINSYS_H
|
||||
|
||||
#include "pipe/p_state.h"
|
||||
#ifndef EGLMISC_INCLUDED
|
||||
#define EGLMISC_INCLUDED
|
||||
|
||||
struct intel_context;
|
||||
struct pipe_context;
|
||||
struct pipe_winsys;
|
||||
struct pipe_buffer;
|
||||
struct _DriBufferObject;
|
||||
|
||||
struct pipe_winsys *
|
||||
intel_create_pipe_winsys( int fd, struct _DriFreeSlabManager *fMan );
|
||||
|
||||
void
|
||||
intel_destroy_pipe_winsys( struct pipe_winsys *winsys );
|
||||
|
||||
struct pipe_context *
|
||||
intel_create_softpipe( struct intel_context *intel,
|
||||
struct pipe_winsys *winsys );
|
||||
|
||||
struct pipe_context *
|
||||
intel_create_i915simple( struct intel_context *intel,
|
||||
struct pipe_winsys *winsys );
|
||||
#include "egldriver.h"
|
||||
|
||||
|
||||
struct intel_buffer {
|
||||
struct pipe_buffer base;
|
||||
struct _DriBufferPool *pool;
|
||||
struct _DriBufferObject *driBO;
|
||||
};
|
||||
|
||||
static INLINE struct intel_buffer *
|
||||
intel_buffer( struct pipe_buffer *buf )
|
||||
{
|
||||
return (struct intel_buffer *)buf;
|
||||
}
|
||||
|
||||
static INLINE struct _DriBufferObject *
|
||||
dri_bo( struct pipe_buffer *buf )
|
||||
{
|
||||
return intel_buffer(buf)->driBO;
|
||||
}
|
||||
extern const char *
|
||||
_eglQueryString(_EGLDriver *drv, EGLDisplay dpy, EGLint name);
|
||||
|
||||
|
||||
#endif
|
||||
extern EGLBoolean
|
||||
_eglWaitGL(_EGLDriver *drv, EGLDisplay dpy);
|
||||
|
||||
|
||||
extern EGLBoolean
|
||||
_eglWaitNative(_EGLDriver *drv, EGLDisplay dpy, EGLint engine);
|
||||
|
||||
|
||||
#endif /* EGLMISC_INCLUDED */
|
||||
@@ -4,6 +4,9 @@
|
||||
#include "egltypedefs.h"
|
||||
|
||||
|
||||
#define EGL_NO_MODE_MESA 0
|
||||
|
||||
|
||||
/**
|
||||
* Data structure which corresponds to an EGLModeMESA.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* String utils.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "eglstring.h"
|
||||
|
||||
|
||||
char *
|
||||
_eglstrdup(const char *s)
|
||||
{
|
||||
if (s) {
|
||||
int l = strlen(s);
|
||||
char *s2 = malloc(l + 1);
|
||||
if (s2)
|
||||
strcpy(s2, s);
|
||||
return s2;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef EGLSTRING_INCLUDED
|
||||
#define EGLSTRING_INCLUDED
|
||||
|
||||
|
||||
extern char *
|
||||
_eglstrdup(const char *s);
|
||||
|
||||
|
||||
#endif /* EGLSTRING_INCLUDED */
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <string.h>
|
||||
#include "eglcontext.h"
|
||||
#include "eglconfig.h"
|
||||
#include "egldriver.h"
|
||||
#include "eglglobals.h"
|
||||
#include "eglhash.h"
|
||||
#include "egllog.h"
|
||||
@@ -175,7 +176,7 @@ _eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
|
||||
}
|
||||
}
|
||||
|
||||
if (width <= 0 || height <= 0) {
|
||||
if (width < 0 || height < 0) {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, func);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
@@ -207,25 +208,47 @@ _eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
|
||||
void
|
||||
_eglSaveSurface(_EGLSurface *surf)
|
||||
{
|
||||
EGLuint key = _eglHashGenKey(_eglGlobal.Surfaces);
|
||||
assert(surf);
|
||||
assert(!surf->Handle);
|
||||
surf->Handle = _eglHashGenKey(_eglGlobal.Contexts);
|
||||
surf->Handle = (EGLSurface) key;
|
||||
assert(surf->Handle);
|
||||
_eglHashInsert(_eglGlobal.Surfaces, surf->Handle, surf);
|
||||
_eglHashInsert(_eglGlobal.Surfaces, key, surf);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_eglRemoveSurface(_EGLSurface *surf)
|
||||
{
|
||||
_eglHashRemove(_eglGlobal.Surfaces, surf->Handle);
|
||||
_eglHashRemove(_eglGlobal.Surfaces, (EGLuint) surf->Handle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return the public handle for an internal _EGLSurface.
|
||||
* This is the inverse of _eglLookupSurface().
|
||||
*/
|
||||
EGLSurface
|
||||
_eglGetSurfaceHandle(_EGLSurface *surface)
|
||||
{
|
||||
if (surface)
|
||||
return surface->Handle;
|
||||
else
|
||||
return EGL_NO_SURFACE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the private _EGLSurface which corresponds to a public EGLSurface
|
||||
* handle.
|
||||
* This is the inverse of _eglGetSurfaceHandle().
|
||||
*/
|
||||
_EGLSurface *
|
||||
_eglLookupSurface(EGLSurface surf)
|
||||
{
|
||||
_EGLSurface *c = (_EGLSurface *) _eglHashLookup(_eglGlobal.Surfaces, surf);
|
||||
_EGLSurface *c = (_EGLSurface *) _eglHashLookup(_eglGlobal.Surfaces,
|
||||
(EGLuint) surf);
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -297,7 +320,9 @@ _eglQuerySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surf,
|
||||
case EGL_CONFIG_ID:
|
||||
*value = GET_CONFIG_ATTRIB(surface->Config, EGL_CONFIG_ID);
|
||||
return EGL_TRUE;
|
||||
/*XXX case EGL_LARGEST_PBUFFER:*/
|
||||
case EGL_LARGEST_PBUFFER:
|
||||
*value = drv->LargestPbuffer;
|
||||
return EGL_TRUE;
|
||||
case EGL_SURFACE_TYPE:
|
||||
*value = surface->Type;
|
||||
return EGL_TRUE;
|
||||
@@ -439,7 +464,7 @@ _eglDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface)
|
||||
{
|
||||
_EGLSurface *surf = _eglLookupSurface(surface);
|
||||
if (surf) {
|
||||
_eglHashRemove(_eglGlobal.Surfaces, surface);
|
||||
_eglHashRemove(_eglGlobal.Surfaces, (EGLuint) surface);
|
||||
if (surf->IsBound) {
|
||||
surf->DeletePending = EGL_TRUE;
|
||||
}
|
||||
|
||||
@@ -51,6 +51,10 @@ extern void
|
||||
_eglRemoveSurface(_EGLSurface *surf);
|
||||
|
||||
|
||||
extern EGLSurface
|
||||
_eglGetSurfaceHandle(_EGLSurface *surface);
|
||||
|
||||
|
||||
extern _EGLSurface *
|
||||
_eglLookupSurface(EGLSurface surf);
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#ifndef EGLTYPEDEFS_INCLUDED
|
||||
#define EGLTYPEDEFS_INCLUDED
|
||||
|
||||
#define EGL_EGLEXT_PROTOTYPES
|
||||
|
||||
#include <GLES/egl.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
|
||||
typedef struct _egl_api _EGLAPI;
|
||||
@@ -26,9 +28,7 @@ typedef struct _egl_surface _EGLSurface;
|
||||
typedef struct _egl_thread_info _EGLThreadInfo;
|
||||
|
||||
|
||||
typedef void (*_EGLProc)();
|
||||
|
||||
typedef _EGLDriver *(*_EGLMain_t)(_EGLDisplay *dpy);
|
||||
typedef _EGLDriver *(*_EGLMain_t)(_EGLDisplay *dpy, const char *args);
|
||||
|
||||
|
||||
#endif /* EGLTYPEDEFS_INCLUDED */
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* 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, sub license, 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 NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* X-specific EGL code.
|
||||
*
|
||||
* Any glue code needed to make EGL work with X is placed in this file.
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "egldriver.h"
|
||||
#include "egllog.h"
|
||||
#include "eglstring.h"
|
||||
#include "eglx.h"
|
||||
|
||||
|
||||
static const char *DefaultDRIDriver = "egl_xdri";
|
||||
static const char *DefaultSoftDriver = "egl_softpipe";
|
||||
|
||||
|
||||
/**
|
||||
* Given an X Display ptr (at dpy->Xdpy) try to determine the appropriate
|
||||
* device driver. Return its name.
|
||||
*
|
||||
* This boils down to whether to use the egl_xdri.so driver which will
|
||||
* load a DRI driver or the egl_softpipe.so driver that'll do software
|
||||
* rendering on Xlib.
|
||||
*/
|
||||
const char *
|
||||
_xeglChooseDriver(_EGLDisplay *dpy)
|
||||
{
|
||||
#ifdef _EGL_PLATFORM_X
|
||||
_XPrivDisplay xdpy;
|
||||
int screen;
|
||||
const char *driverName;
|
||||
|
||||
assert(dpy);
|
||||
|
||||
if (!dpy->Xdpy) {
|
||||
dpy->Xdpy = XOpenDisplay(NULL);
|
||||
if (!dpy->Xdpy) {
|
||||
/* can't open X display -> can't use X-based driver */
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
xdpy = (_XPrivDisplay) dpy->Xdpy;
|
||||
|
||||
assert(dpy->Xdpy);
|
||||
|
||||
screen = DefaultScreen(dpy->Xdpy);
|
||||
|
||||
/* See if we can choose a DRI/DRM driver */
|
||||
driverName = _eglChooseDRMDriver(screen);
|
||||
if (driverName) {
|
||||
/* DRI is available */
|
||||
free((void *) driverName);
|
||||
driverName = _eglstrdup(DefaultDRIDriver);
|
||||
}
|
||||
else {
|
||||
driverName = _eglstrdup(DefaultSoftDriver);
|
||||
}
|
||||
|
||||
_eglLog(_EGL_DEBUG, "_xeglChooseDriver: %s", driverName);
|
||||
|
||||
return driverName;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef EGLX_INCLUDED
|
||||
#define EGLX_INCLUDED
|
||||
|
||||
|
||||
#include "egldisplay.h"
|
||||
|
||||
|
||||
extern const char *
|
||||
_xeglChooseDriver(_EGLDisplay *dpy);
|
||||
|
||||
|
||||
#endif /* EGLX_INCLUDED */
|
||||
@@ -2,7 +2,7 @@ TOP = ../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
|
||||
SUBDIRS = auxiliary drivers
|
||||
SUBDIRS = auxiliary drivers winsys/common
|
||||
|
||||
|
||||
default: subdirs
|
||||
|
||||
@@ -26,12 +26,18 @@ C_SOURCES = \
|
||||
draw_pt_emit.c \
|
||||
draw_pt_fetch.c \
|
||||
draw_pt_fetch_emit.c \
|
||||
draw_pt_fetch_shade_emit.c \
|
||||
draw_pt_fetch_shade_pipeline.c \
|
||||
draw_pt_post_vs.c \
|
||||
draw_pt_util.c \
|
||||
draw_pt_varray.c \
|
||||
draw_pt_vcache.c \
|
||||
draw_vertex.c \
|
||||
draw_vs.c \
|
||||
draw_vs_varient.c \
|
||||
draw_vs_aos.c \
|
||||
draw_vs_aos_io.c \
|
||||
draw_vs_aos_machine.c \
|
||||
draw_vs_exec.c \
|
||||
draw_vs_llvm.c \
|
||||
draw_vs_sse.c
|
||||
|
||||
@@ -15,7 +15,7 @@ draw = env.ConvenienceLibrary(
|
||||
'draw_pipe_stipple.c',
|
||||
'draw_pipe_twoside.c',
|
||||
'draw_pipe_unfilled.c',
|
||||
'draw_pipe_util.c',
|
||||
'draw_pipe_util.c',
|
||||
'draw_pipe_validate.c',
|
||||
'draw_pipe_vbuf.c',
|
||||
'draw_pipe_wide_line.c',
|
||||
@@ -25,15 +25,21 @@ draw = env.ConvenienceLibrary(
|
||||
'draw_pt_emit.c',
|
||||
'draw_pt_fetch.c',
|
||||
'draw_pt_fetch_emit.c',
|
||||
'draw_pt_fetch_shade_emit.c',
|
||||
'draw_pt_fetch_shade_pipeline.c',
|
||||
'draw_pt_post_vs.c',
|
||||
'draw_pt_util.c',
|
||||
'draw_pt_varray.c',
|
||||
'draw_pt_vcache.c',
|
||||
'draw_vertex.c',
|
||||
'draw_vs.c',
|
||||
'draw_vs_aos.c',
|
||||
'draw_vs_aos_io.c',
|
||||
'draw_vs_aos_machine.c',
|
||||
'draw_vs_exec.c',
|
||||
'draw_vs_llvm.c',
|
||||
'draw_vs_sse.c',
|
||||
'draw_vs_varient.c'
|
||||
])
|
||||
|
||||
auxiliaries.insert(0, draw)
|
||||
|
||||
@@ -56,12 +56,6 @@ struct draw_context *draw_create( void )
|
||||
|
||||
draw->reduced_prim = ~0; /* != any of PIPE_PRIM_x */
|
||||
|
||||
tgsi_exec_machine_init(&draw->machine);
|
||||
|
||||
/* FIXME: give this machine thing a proper constructor:
|
||||
*/
|
||||
draw->machine.Inputs = align_malloc(PIPE_MAX_ATTRIBS * sizeof(struct tgsi_exec_vector), 16);
|
||||
draw->machine.Outputs = align_malloc(PIPE_MAX_ATTRIBS * sizeof(struct tgsi_exec_vector), 16);
|
||||
|
||||
if (!draw_pipeline_init( draw ))
|
||||
goto fail;
|
||||
@@ -69,6 +63,9 @@ struct draw_context *draw_create( void )
|
||||
if (!draw_pt_init( draw ))
|
||||
goto fail;
|
||||
|
||||
if (!draw_vs_init( draw ))
|
||||
goto fail;
|
||||
|
||||
return draw;
|
||||
|
||||
fail:
|
||||
@@ -83,13 +80,6 @@ void draw_destroy( struct draw_context *draw )
|
||||
return;
|
||||
|
||||
|
||||
if (draw->machine.Inputs)
|
||||
align_free(draw->machine.Inputs);
|
||||
|
||||
if (draw->machine.Outputs)
|
||||
align_free(draw->machine.Outputs);
|
||||
|
||||
tgsi_exec_machine_free_data(&draw->machine);
|
||||
|
||||
/* Not so fast -- we're just borrowing this at the moment.
|
||||
*
|
||||
@@ -99,6 +89,7 @@ void draw_destroy( struct draw_context *draw )
|
||||
|
||||
draw_pipeline_destroy( draw );
|
||||
draw_pt_destroy( draw );
|
||||
draw_vs_destroy( draw );
|
||||
|
||||
FREE( draw );
|
||||
}
|
||||
@@ -183,6 +174,8 @@ void draw_set_viewport_state( struct draw_context *draw,
|
||||
viewport->translate[1] == 0.0f &&
|
||||
viewport->translate[2] == 0.0f &&
|
||||
viewport->translate[3] == 0.0f);
|
||||
|
||||
draw_vs_set_viewport( draw, viewport );
|
||||
}
|
||||
|
||||
|
||||
@@ -224,9 +217,11 @@ draw_set_mapped_vertex_buffer(struct draw_context *draw,
|
||||
|
||||
void
|
||||
draw_set_mapped_constant_buffer(struct draw_context *draw,
|
||||
const void *buffer)
|
||||
const void *buffer,
|
||||
unsigned size )
|
||||
{
|
||||
draw->pt.user.constants = buffer;
|
||||
draw_vs_set_constants( draw, (const float (*)[4])buffer, size );
|
||||
}
|
||||
|
||||
|
||||
@@ -295,7 +290,7 @@ int
|
||||
draw_find_vs_output(struct draw_context *draw,
|
||||
uint semantic_name, uint semantic_index)
|
||||
{
|
||||
const struct draw_vertex_shader *vs = draw->vertex_shader;
|
||||
const struct draw_vertex_shader *vs = draw->vs.vertex_shader;
|
||||
uint i;
|
||||
for (i = 0; i < vs->info.num_outputs; i++) {
|
||||
if (vs->info.output_semantic_name[i] == semantic_name &&
|
||||
@@ -320,7 +315,7 @@ draw_find_vs_output(struct draw_context *draw,
|
||||
uint
|
||||
draw_num_vs_outputs(struct draw_context *draw)
|
||||
{
|
||||
uint count = draw->vertex_shader->info.num_outputs;
|
||||
uint count = draw->vs.vertex_shader->info.num_outputs;
|
||||
if (draw->extra_vp_outputs.slot > 0)
|
||||
count++;
|
||||
return count;
|
||||
@@ -354,14 +349,30 @@ void draw_set_edgeflags( struct draw_context *draw,
|
||||
* \param elements the element buffer ptr
|
||||
*/
|
||||
void
|
||||
draw_set_mapped_element_buffer( struct draw_context *draw,
|
||||
unsigned eltSize, void *elements )
|
||||
draw_set_mapped_element_buffer_range( struct draw_context *draw,
|
||||
unsigned eltSize,
|
||||
unsigned min_index,
|
||||
unsigned max_index,
|
||||
void *elements )
|
||||
{
|
||||
draw->pt.user.elts = elements;
|
||||
draw->pt.user.eltSize = eltSize;
|
||||
draw->pt.user.min_index = min_index;
|
||||
draw->pt.user.max_index = max_index;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
draw_set_mapped_element_buffer( struct draw_context *draw,
|
||||
unsigned eltSize,
|
||||
void *elements )
|
||||
{
|
||||
draw->pt.user.elts = elements;
|
||||
draw->pt.user.eltSize = eltSize;
|
||||
draw->pt.user.min_index = 0;
|
||||
draw->pt.user.max_index = 0xffffffff;
|
||||
}
|
||||
|
||||
|
||||
/* Revamp me please:
|
||||
*/
|
||||
|
||||
@@ -118,14 +118,23 @@ void draw_set_vertex_elements(struct draw_context *draw,
|
||||
unsigned count,
|
||||
const struct pipe_vertex_element *elements);
|
||||
|
||||
void
|
||||
draw_set_mapped_element_buffer_range( struct draw_context *draw,
|
||||
unsigned eltSize,
|
||||
unsigned min_index,
|
||||
unsigned max_index,
|
||||
void *elements );
|
||||
|
||||
void draw_set_mapped_element_buffer( struct draw_context *draw,
|
||||
unsigned eltSize, void *elements );
|
||||
unsigned eltSize,
|
||||
void *elements );
|
||||
|
||||
void draw_set_mapped_vertex_buffer(struct draw_context *draw,
|
||||
unsigned attr, const void *buffer);
|
||||
|
||||
void draw_set_mapped_constant_buffer(struct draw_context *draw,
|
||||
const void *buffer);
|
||||
const void *buffer,
|
||||
unsigned size );
|
||||
|
||||
void draw_set_edgeflags( struct draw_context *draw,
|
||||
const unsigned *edgeflag );
|
||||
|
||||
@@ -212,6 +212,72 @@ void draw_pipeline_run( struct draw_context *draw,
|
||||
draw->pipeline.vertex_count = 0;
|
||||
}
|
||||
|
||||
#define QUAD(i0,i1,i2,i3) \
|
||||
do_triangle( draw, \
|
||||
( DRAW_PIPE_RESET_STIPPLE | \
|
||||
DRAW_PIPE_EDGE_FLAG_0 | \
|
||||
DRAW_PIPE_EDGE_FLAG_2 ), \
|
||||
verts + stride * ((i0) & ~DRAW_PIPE_FLAG_MASK), \
|
||||
verts + stride * (i1), \
|
||||
verts + stride * (i3)); \
|
||||
do_triangle( draw, \
|
||||
( DRAW_PIPE_EDGE_FLAG_0 | \
|
||||
DRAW_PIPE_EDGE_FLAG_1 ), \
|
||||
verts + stride * ((i1) & ~DRAW_PIPE_FLAG_MASK), \
|
||||
verts + stride * (i2), \
|
||||
verts + stride * (i3))
|
||||
|
||||
#define TRIANGLE(flags,i0,i1,i2) \
|
||||
do_triangle( draw, \
|
||||
flags, /* flags */ \
|
||||
verts + stride * ((i0) & ~DRAW_PIPE_FLAG_MASK), \
|
||||
verts + stride * (i1), \
|
||||
verts + stride * (i2))
|
||||
|
||||
#define LINE(flags,i0,i1) \
|
||||
do_line( draw, \
|
||||
flags, \
|
||||
verts + stride * ((i0) & ~DRAW_PIPE_FLAG_MASK), \
|
||||
verts + stride * (i+1))
|
||||
|
||||
#define POINT(i0) \
|
||||
do_point( draw, \
|
||||
verts + stride * i0 )
|
||||
|
||||
#define FUNC pipe_run_linear
|
||||
#define ARGS \
|
||||
struct draw_context *draw, \
|
||||
unsigned prim, \
|
||||
struct vertex_header *vertices, \
|
||||
unsigned stride
|
||||
|
||||
#define LOCAL_VARS \
|
||||
char *verts = (char *)vertices; \
|
||||
boolean flatfirst = (draw->rasterizer->flatshade && \
|
||||
draw->rasterizer->flatshade_first); \
|
||||
unsigned i; \
|
||||
ushort flags
|
||||
|
||||
#define FLUSH
|
||||
|
||||
#include "draw_pt_decompose.h"
|
||||
|
||||
void draw_pipeline_run_linear( struct draw_context *draw,
|
||||
unsigned prim,
|
||||
struct vertex_header *vertices,
|
||||
unsigned count,
|
||||
unsigned stride )
|
||||
{
|
||||
char *verts = (char *)vertices;
|
||||
draw->pipeline.verts = verts;
|
||||
draw->pipeline.vertex_stride = stride;
|
||||
draw->pipeline.vertex_count = count;
|
||||
|
||||
pipe_run_linear(draw, prim, vertices, stride, count);
|
||||
|
||||
draw->pipeline.verts = NULL;
|
||||
draw->pipeline.vertex_count = 0;
|
||||
}
|
||||
|
||||
|
||||
void draw_pipeline_flush( struct draw_context *draw,
|
||||
|
||||
@@ -116,7 +116,7 @@ dup_vert( struct draw_stage *stage,
|
||||
{
|
||||
struct vertex_header *tmp = stage->tmp[idx];
|
||||
const uint vsize = sizeof(struct vertex_header)
|
||||
+ stage->draw->num_vs_outputs * 4 * sizeof(float);
|
||||
+ stage->draw->vs.num_vs_outputs * 4 * sizeof(float);
|
||||
memcpy(tmp, vert, vsize);
|
||||
tmp->vertex_id = UNDEFINED_VERTEX_ID;
|
||||
return tmp;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user