mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-20 13:28:09 +02:00
Merge branch 'master' into pipe-video
Conflicts: src/gallium/auxiliary/vl/vl_compositor.c src/gallium/auxiliary/vl/vl_compositor.h src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c src/gallium/auxiliary/vl/vl_shader_build.c
This commit is contained in:
commit
447dddb93d
901 changed files with 52286 additions and 18767 deletions
7
Makefile
7
Makefile
|
|
@ -439,8 +439,7 @@ DEMO_FILES = \
|
|||
$(DIRECTORY)/progs/windml/Makefile.ugl \
|
||||
$(DIRECTORY)/progs/windml/*.c \
|
||||
$(DIRECTORY)/progs/windml/*.bmp \
|
||||
$(DIRECTORY)/progs/ggi/*.c \
|
||||
$(DIRECTORY)/windows/VC7/progs/progs.sln
|
||||
$(DIRECTORY)/progs/ggi/*.c
|
||||
|
||||
GLUT_FILES = \
|
||||
$(DIRECTORY)/include/GL/glut.h \
|
||||
|
|
@ -463,9 +462,7 @@ GLUT_FILES = \
|
|||
$(DIRECTORY)/src/glut/mini/glut.pc.in \
|
||||
$(DIRECTORY)/src/glut/directfb/Makefile \
|
||||
$(DIRECTORY)/src/glut/directfb/NOTES \
|
||||
$(DIRECTORY)/src/glut/directfb/*[ch] \
|
||||
$(DIRECTORY)/windows/VC6/progs/glut/glut.dsp \
|
||||
$(DIRECTORY)/windows/VC7/progs/glut/glut.vcproj
|
||||
$(DIRECTORY)/src/glut/directfb/*[ch]
|
||||
|
||||
DEPEND_FILES = \
|
||||
$(TOP)/src/mesa/depend \
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ import common
|
|||
default_statetrackers = 'mesa'
|
||||
|
||||
if common.default_platform in ('linux', 'freebsd', 'darwin'):
|
||||
default_drivers = 'softpipe,failover,i915,trace,identity,llvmpipe'
|
||||
default_drivers = 'softpipe,failover,svga,i915,trace,identity,llvmpipe'
|
||||
default_winsys = 'xlib'
|
||||
elif common.default_platform in ('winddk',):
|
||||
default_drivers = 'softpipe,i915,trace,identity'
|
||||
default_drivers = 'softpipe,svga,i915,trace,identity'
|
||||
default_winsys = 'all'
|
||||
else:
|
||||
default_drivers = 'all'
|
||||
|
|
@ -46,9 +46,9 @@ common.AddOptions(opts)
|
|||
opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers,
|
||||
['mesa', 'python', 'xorg']))
|
||||
opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
|
||||
['softpipe', 'failover', 'i915', 'cell', 'trace', 'r300', 'identity', 'llvmpipe']))
|
||||
['softpipe', 'failover', 'svga', 'i915', 'cell', 'trace', 'r300', 'identity', 'llvmpipe']))
|
||||
opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
|
||||
['xlib', 'intel', 'gdi', 'radeon']))
|
||||
['xlib', 'vmware', 'intel', 'gdi', 'radeon']))
|
||||
|
||||
opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,309 +0,0 @@
|
|||
#!/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
|
||||
|
||||
from gprof2dot import Call, Function, Profile
|
||||
from gprof2dot import CALLS, SAMPLES, TIME, TIME_RATIO, TOTAL_TIME, TOTAL_TIME_RATIO
|
||||
from gprof2dot import DotWriter, TEMPERATURE_COLORMAP
|
||||
|
||||
|
||||
__version__ = '0.1'
|
||||
|
||||
|
||||
class ParseError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class MsvcDemangler:
|
||||
# http://www.kegel.com/mangle.html
|
||||
|
||||
def __init__(self, symbol):
|
||||
self._symbol = symbol
|
||||
self._pos = 0
|
||||
|
||||
def lookahead(self):
|
||||
return self._symbol[self._pos]
|
||||
|
||||
def consume(self):
|
||||
ret = self.lookahead()
|
||||
self._pos += 1
|
||||
return ret
|
||||
|
||||
def match(self, c):
|
||||
if self.lookahead() != c:
|
||||
raise ParseError
|
||||
self.consume()
|
||||
|
||||
def parse(self):
|
||||
self.match('?')
|
||||
name = self.parse_name()
|
||||
qualifications = self.parse_qualifications()
|
||||
return '::'.join(qualifications + [name])
|
||||
|
||||
def parse_name(self):
|
||||
if self.lookahead() == '?':
|
||||
return self.consume() + self.consume()
|
||||
else:
|
||||
name = self.parse_id()
|
||||
self.match('@')
|
||||
return name
|
||||
|
||||
def parse_qualifications(self):
|
||||
qualifications = []
|
||||
while self.lookahead() != '@':
|
||||
name = self.parse_id()
|
||||
qualifications.append(name)
|
||||
self.match('@')
|
||||
return qualifications
|
||||
|
||||
def parse_id(self):
|
||||
s = ''
|
||||
while True:
|
||||
c = self.lookahead()
|
||||
if c.isalnum() or c in '_':
|
||||
s += c
|
||||
self.consume()
|
||||
else:
|
||||
break
|
||||
return s
|
||||
|
||||
|
||||
def demangle(name):
|
||||
if name.startswith('_'):
|
||||
name = name[1:]
|
||||
idx = name.rfind('@')
|
||||
if idx != -1 and name[idx+1:].isdigit():
|
||||
name = name[:idx]
|
||||
return name
|
||||
if name.startswith('?'):
|
||||
demangler = MsvcDemangler(name)
|
||||
return demangler.parse()
|
||||
return name
|
||||
|
||||
|
||||
class Reader:
|
||||
|
||||
def __init__(self):
|
||||
self.symbols = []
|
||||
self.symbol_cache = {}
|
||||
self.base_addr = None
|
||||
|
||||
def read_map(self, mapfile):
|
||||
# See http://msdn.microsoft.com/en-us/library/k7xkk3e2.aspx
|
||||
last_addr = 0
|
||||
last_name = 0
|
||||
for line in file(mapfile, "rt"):
|
||||
fields = line.split()
|
||||
try:
|
||||
section_offset, name, addr, type, lib_object = fields
|
||||
except ValueError:
|
||||
continue
|
||||
if type != 'f':
|
||||
continue
|
||||
section, offset = section_offset.split(':')
|
||||
addr = int(offset, 16)
|
||||
self.symbols.append((addr, name))
|
||||
last_addr = addr
|
||||
last_name = name
|
||||
|
||||
# sort symbols
|
||||
self.symbols.sort(key = lambda (addr, name): addr)
|
||||
|
||||
def lookup_addr(self, addr):
|
||||
try:
|
||||
return self.symbol_cache[addr]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
tolerance = 4196
|
||||
s, e = 0, len(self.symbols)
|
||||
while s != e:
|
||||
i = (s + e)//2
|
||||
start_addr, name = self.symbols[i]
|
||||
try:
|
||||
end_addr, next_name = self.symbols[i + 1]
|
||||
except IndexError:
|
||||
end_addr = start_addr + tolerance
|
||||
if addr < start_addr:
|
||||
e = i
|
||||
continue
|
||||
if addr == end_addr:
|
||||
return next_name, addr - start_addr
|
||||
if addr > end_addr:
|
||||
s = i
|
||||
continue
|
||||
return name, addr - start_addr
|
||||
raise ValueError
|
||||
|
||||
def lookup_symbol(self, name):
|
||||
for symbol_addr, symbol_name in self.symbols:
|
||||
if name == symbol_name:
|
||||
return symbol_addr
|
||||
return 0
|
||||
|
||||
def read_data(self, data):
|
||||
profile = Profile()
|
||||
|
||||
fp = file(data, "rb")
|
||||
entry_format = "IIII"
|
||||
entry_size = struct.calcsize(entry_format)
|
||||
caller = None
|
||||
caller_stack = []
|
||||
while True:
|
||||
entry = fp.read(entry_size)
|
||||
if len(entry) < entry_size:
|
||||
break
|
||||
caller_addr, callee_addr, samples_lo, samples_hi = struct.unpack(entry_format, entry)
|
||||
if caller_addr == 0 and callee_addr == 0:
|
||||
continue
|
||||
|
||||
if self.base_addr is None:
|
||||
ref_addr = self.lookup_symbol('___debug_profile_reference@0')
|
||||
if ref_addr:
|
||||
self.base_addr = (caller_addr - ref_addr) & ~(options.align - 1)
|
||||
else:
|
||||
self.base_addr = 0
|
||||
sys.stderr.write('Base addr: %08x\n' % self.base_addr)
|
||||
|
||||
samples = (samples_hi << 32) | samples_lo
|
||||
|
||||
try:
|
||||
caller_raddr = caller_addr - self.base_addr
|
||||
caller_sym, caller_ofs = self.lookup_addr(caller_raddr)
|
||||
|
||||
try:
|
||||
caller = profile.functions[caller_sym]
|
||||
except KeyError:
|
||||
caller_name = demangle(caller_sym)
|
||||
caller = Function(caller_sym, caller_name)
|
||||
profile.add_function(caller)
|
||||
caller[CALLS] = 0
|
||||
caller[SAMPLES] = 0
|
||||
except ValueError:
|
||||
caller = None
|
||||
|
||||
if not callee_addr:
|
||||
if caller:
|
||||
caller[SAMPLES] += samples
|
||||
else:
|
||||
callee_raddr = callee_addr - self.base_addr
|
||||
callee_sym, callee_ofs = self.lookup_addr(callee_raddr)
|
||||
|
||||
try:
|
||||
callee = profile.functions[callee_sym]
|
||||
except KeyError:
|
||||
callee_name = demangle(callee_sym)
|
||||
callee = Function(callee_sym, callee_name)
|
||||
profile.add_function(callee)
|
||||
callee[CALLS] = samples
|
||||
callee[SAMPLES] = 0
|
||||
else:
|
||||
callee[CALLS] += samples
|
||||
|
||||
if caller is not None:
|
||||
try:
|
||||
call = caller.calls[callee.id]
|
||||
except KeyError:
|
||||
call = Call(callee.id)
|
||||
call[CALLS] = samples
|
||||
caller.add_call(call)
|
||||
else:
|
||||
call[CALLS] += samples
|
||||
|
||||
if options.verbose:
|
||||
if not callee_addr:
|
||||
sys.stderr.write('%s+%u: %u\n' % (caller_sym, caller_ofs, samples))
|
||||
else:
|
||||
sys.stderr.write('%s+%u -> %s+%u: %u\n' % (caller_sym, caller_ofs, callee_sym, callee_ofs, samples))
|
||||
|
||||
# compute derived data
|
||||
profile.validate()
|
||||
profile.find_cycles()
|
||||
profile.aggregate(SAMPLES)
|
||||
profile.ratio(TIME_RATIO, SAMPLES)
|
||||
profile.call_ratios(CALLS)
|
||||
profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO)
|
||||
|
||||
return profile
|
||||
|
||||
|
||||
def main():
|
||||
parser = optparse.OptionParser(
|
||||
usage="\n\t%prog [options] [file] ...",
|
||||
version="%%prog %s" % __version__)
|
||||
parser.add_option(
|
||||
'-a', '--align', metavar='NUMBER',
|
||||
type="int", dest="align", default=16,
|
||||
help="section alignment")
|
||||
parser.add_option(
|
||||
'-m', '--map', metavar='FILE',
|
||||
type="string", dest="map",
|
||||
help="map file")
|
||||
parser.add_option(
|
||||
'-b', '--base', metavar='FILE',
|
||||
type="string", dest="base",
|
||||
help="base addr")
|
||||
parser.add_option(
|
||||
'-n', '--node-thres', metavar='PERCENTAGE',
|
||||
type="float", dest="node_thres", default=0.5,
|
||||
help="eliminate nodes below this threshold [default: %default]")
|
||||
parser.add_option(
|
||||
'-e', '--edge-thres', metavar='PERCENTAGE',
|
||||
type="float", dest="edge_thres", default=0.1,
|
||||
help="eliminate edges below this threshold [default: %default]")
|
||||
parser.add_option(
|
||||
'-v', '--verbose',
|
||||
action="count",
|
||||
dest="verbose", default=0,
|
||||
help="verbose output")
|
||||
|
||||
global options
|
||||
(options, args) = parser.parse_args(sys.argv[1:])
|
||||
|
||||
reader = Reader()
|
||||
if options.base is not None:
|
||||
reader.base_addr = int(options.base, 16)
|
||||
if options.map is not None:
|
||||
reader.read_map(options.map)
|
||||
for arg in args:
|
||||
profile = reader.read_data(arg)
|
||||
profile.prune(options.node_thres/100.0, options.edge_thres/100.0)
|
||||
output = sys.stdout
|
||||
dot = DotWriter(output)
|
||||
colormap = TEMPERATURE_COLORMAP
|
||||
dot.graph(profile, colormap)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ INSTALL_INC_DIR = $(includedir)
|
|||
DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@
|
||||
|
||||
# Where libGL will look for DRI hardware drivers
|
||||
DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR)
|
||||
DRI_DRIVER_SEARCH_DIR = @DRI_DRIVER_SEARCH_DIR@
|
||||
|
||||
# Xorg driver install directory (for xorg state-tracker)
|
||||
XORG_DRIVER_INSTALL_DIR = @XORG_DRIVER_INSTALL_DIR@
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ CONFIG_NAME = default
|
|||
|
||||
# Version info
|
||||
MESA_MAJOR=7
|
||||
MESA_MINOR=7
|
||||
MESA_MINOR=8
|
||||
MESA_TINY=0
|
||||
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ EGL_DRIVERS_DIRS = demo
|
|||
GALLIUM_DIRS = auxiliary drivers state_trackers
|
||||
GALLIUM_AUXILIARY_DIRS = rbug draw translate cso_cache pipebuffer tgsi sct rtasm util indices vl
|
||||
GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a)
|
||||
GALLIUM_DRIVERS_DIRS = softpipe i915 failover trace identity
|
||||
GALLIUM_DRIVERS_DIRS = softpipe failover svga i915 trace identity
|
||||
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
|
||||
GALLIUM_WINSYS_DIRS = xlib egl_xlib
|
||||
GALLIUM_WINSYS_DRM_DIRS =
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
|
|||
X11_INCLUDES = -I/usr/X11R6/include
|
||||
|
||||
CFLAGS = -Wall -Wmissing-prototypes -Wdeclaration-after-statement \
|
||||
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \
|
||||
$(DEFINES) $(ASM_FLAGS) $(X11_INCLUDES) -std=c99 -ffast-math
|
||||
-Wpointer-arith $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \
|
||||
$(DEFINES) $(ASM_FLAGS) $(X11_INCLUDES) -std=c99 -ffast-math
|
||||
|
||||
CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
|
||||
$(X11_INCLUDES)
|
||||
CXXFLAGS = -Wall -Wpointer-arith $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \
|
||||
$(DEFINES) $(X11_INCLUDES)
|
||||
|
||||
# Work around aliasing bugs - developers should comment this out
|
||||
CFLAGS += -fno-strict-aliasing
|
||||
|
|
|
|||
|
|
@ -4,5 +4,6 @@ include $(TOP)/configs/linux
|
|||
|
||||
CONFIG_NAME = linux-debug
|
||||
|
||||
OPT_FLAGS = -g -ansi -pedantic
|
||||
OPT_FLAGS = -g
|
||||
CFLAGS += -ansi -pedantic
|
||||
DEFINES += -DDEBUG -DDEBUG_MATH
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ EGL_DRIVERS_DIRS = demo glx
|
|||
DRIVER_DIRS = dri
|
||||
WINDOW_SYSTEM = dri
|
||||
GALLIUM_WINSYS_DIRS = drm
|
||||
GALLIUM_WINSYS_DRM_DIRS = intel
|
||||
GALLIUM_WINSYS_DRM_DIRS = vmware intel
|
||||
GALLIUM_STATE_TRACKERS_DIRS = egl
|
||||
|
||||
DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon \
|
||||
|
|
|
|||
20
configure.ac
20
configure.ac
|
|
@ -649,6 +649,13 @@ AC_ARG_WITH([dri-driverdir],
|
|||
[DRI_DRIVER_INSTALL_DIR="$withval"],
|
||||
[DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
|
||||
AC_SUBST([DRI_DRIVER_INSTALL_DIR])
|
||||
dnl Extra search path for DRI drivers
|
||||
AC_ARG_WITH([dri-searchpath],
|
||||
[AS_HELP_STRING([--with-dri-searchpath=DIRS...],
|
||||
[semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
|
||||
[DRI_DRIVER_SEARCH_DIR="$withval"],
|
||||
[DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
|
||||
AC_SUBST([DRI_DRIVER_SEARCH_DIR])
|
||||
dnl Direct rendering or just indirect rendering
|
||||
AC_ARG_ENABLE([driglx-direct],
|
||||
[AS_HELP_STRING([--disable-driglx-direct],
|
||||
|
|
@ -1182,6 +1189,19 @@ AC_ARG_WITH([max-height],
|
|||
[AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
|
||||
)
|
||||
|
||||
dnl
|
||||
dnl Gallium SVGA configuration
|
||||
dnl
|
||||
AC_ARG_ENABLE([gallium-svga],
|
||||
[AS_HELP_STRING([--disable-gallium-svga],
|
||||
[build gallium SVGA @<:@default=enabled@:>@])],
|
||||
[enable_gallium_svga="$enableval"],
|
||||
[enable_gallium_svga=yes])
|
||||
if test "x$enable_gallium_svga" = xyes; then
|
||||
GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS vmware"
|
||||
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Gallium Intel configuration
|
||||
dnl
|
||||
|
|
|
|||
|
|
@ -27,12 +27,6 @@ using the SDK with Visual Studio Express can be found at
|
|||
|
||||
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
|
||||
|
||||
If you are stuck using VC6 or VC7, you may start with these project
|
||||
files, but you may need to modify them to reflect changes in the
|
||||
Mesa source code tree. If you sucessfully update the project files,
|
||||
please submit them to the author of this document so that they may
|
||||
be included in the next distribution.
|
||||
|
||||
The project files to build the core Mesa library, Windows Mesa
|
||||
drivers, OSMesa, and GLU are in the mesa directory. The project files
|
||||
to build GLUT and some demo programs are in the progs directory.
|
||||
|
|
@ -106,23 +100,6 @@ should build all the demos.
|
|||
Build System Notes
|
||||
----- ------ -----
|
||||
|
||||
VC6 (not actively supported)
|
||||
---
|
||||
|
||||
Visual Studio 6 does not recognize files with the .cc extension as C++
|
||||
language files, without a lot of unnatural tweaking. So, the VC6
|
||||
build process uses custom build steps to compile these files in the
|
||||
GLU library.
|
||||
|
||||
Two additional configurations are provided, Debug x86 and Release x86
|
||||
that activate the shader code compilation by defining SLANG_86. It is
|
||||
unknown if and how this works.
|
||||
|
||||
VC7 (not actively supported)
|
||||
---
|
||||
|
||||
The above-mentioned .cc problem does not exist in this version.
|
||||
|
||||
VC8
|
||||
---
|
||||
|
||||
|
|
|
|||
197
docs/libGL.txt
Normal file
197
docs/libGL.txt
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
|
||||
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
This document describes the implementation of the XFree86 4.0 libGL.so
|
||||
library defined by the Linux/OpenGL Base specification found at
|
||||
http://reality.sgi.com/opengl/linux/linuxbase.html.
|
||||
|
||||
The documentation is divided into two sections:
|
||||
User's Guide
|
||||
Driver Developer's Guide
|
||||
|
||||
Author: Brian Paul (brian@precisioninsight.com)
|
||||
Date: February 2000
|
||||
|
||||
|
||||
|
||||
User's Guide
|
||||
------------
|
||||
|
||||
Using libGL.so
|
||||
|
||||
The libGL.so library defines the gl- and glX-prefixed functions needed to
|
||||
run OpenGL programs. OpenGL client applications should link with the
|
||||
-lGL option to use it.
|
||||
|
||||
libGL.so serves two primary functions: GLX protocol generation for indirect
|
||||
rendering and loading/management of hardware drivers for direct rendering.
|
||||
|
||||
When libGL.so initializes itself it uses the DRI to determine the
|
||||
appropriate hardware driver for each screen on the local X display.
|
||||
The hardware drivers are expected to be in the /usr/X11R6/lib/modules/dri/
|
||||
directory. Drivers are named with the convention <name>_dri.so where
|
||||
<name> is a driver such as "tdfx", "i810", "gamma", etc.
|
||||
|
||||
The LIBGL_DRIVERS_DIR environment variable may be used to specify a
|
||||
different DRI modules directory, overriding /usr/X11R6/lib/modules/dri/.
|
||||
This environment variable is ignored in setuid programs for security
|
||||
reasons.
|
||||
|
||||
When libGL.so is unable to locate appropriate hardware drivers it will
|
||||
fall back to using indirect GLX rendering.
|
||||
|
||||
To aid in solving problems, libGL.so will print diagnostic messages to
|
||||
stderr if the LIBGL_DEBUG environment variable is defined.
|
||||
|
||||
libGL.so is thread safe. The overhead of thread safety for common,
|
||||
single-thread clients is negligible. However, the overhead of thread
|
||||
safety for multi-threaded clients is significant. Each GL API call
|
||||
requires two calls to pthread_get_specific() which can noticably
|
||||
impact performance. Warning: libGL.so is thread safe but individual
|
||||
DRI drivers may not be. Please consult the documentation for a driver
|
||||
to learn if it is thread safe.
|
||||
|
||||
|
||||
|
||||
Indirect Rendering
|
||||
|
||||
You can force indirect rendering mode by setting the LIBGL_ALWAYS_INDIRECT
|
||||
environment variable. Hardware acceleration will not be used.
|
||||
|
||||
|
||||
|
||||
libGL.so Extensibility
|
||||
|
||||
libGL.so is designed to be extended without upgrading. That is,
|
||||
drivers may install new OpenGL extension functions into libGL.so
|
||||
without requiring libGL.so to be replaced. Clients of libGL.so should
|
||||
use the glXGetProcAddressEXT() function to obtain the address of
|
||||
functions by name. For more details of GLX_ARB_get_proc_address see
|
||||
http://oss.sgi.com/projects/ogl-sample/registry/ARB/get_proc_address.spec
|
||||
|
||||
libGL.so is also designed with flexibility such that it may be used
|
||||
with many generations of hardware drivers to come.
|
||||
|
||||
|
||||
|
||||
|
||||
Driver Developer's Guide
|
||||
------------------------
|
||||
|
||||
This section describes the requirements to make an XFree86 4.0
|
||||
libGL.so-compatible hardware driver. It is not intended for end
|
||||
users of libGL.so.
|
||||
|
||||
|
||||
XFree86 source files
|
||||
|
||||
libGL.so is built inside XFree86 with sources found in xc/lib/GL/.
|
||||
Specifically, libGL.so is built from:
|
||||
|
||||
xc/lib/GL/glx/*.c
|
||||
xc/lib/dri/XF86dri.c
|
||||
xc/lib/dri/dri_glx.c
|
||||
xc/lib/GL/mesa/src/glapi.c
|
||||
xc/lib/GL/mesa/src/glapitemp.h
|
||||
xc/lib/GL/mesa/src/glapitable.h
|
||||
xc/lib/GL/mesa/src/glapioffsets.h
|
||||
xc/lib/GL/mesa/src/glapinoop.c
|
||||
xc/lib/GL/mesa/src/glheader.h
|
||||
xc/lib/GL/mesa/src/glthread.c
|
||||
xc/lib/GL/mesa/src/glthread.h
|
||||
xc/lib/GL/mesa/src/X86/glapi_x86.S
|
||||
xc/lib/GL/mesa/src/X86/assyntax.h
|
||||
|
||||
Understand that the mesa/src/gl*.[ch] files are not tied to Mesa. They
|
||||
have no dependencies on the rest of Mesa and are designed to be reusable
|
||||
in a number of projects.
|
||||
|
||||
The glapi_x86.X and assyntax.h files implement x86-optimized dispatch
|
||||
of GL functions. They are not required; C-based dispatch can be used
|
||||
instead, with a slight performance penalty.
|
||||
|
||||
|
||||
|
||||
Driver loading and binding
|
||||
|
||||
When libGL.so initializes itself (via the __glXInitialize function) a
|
||||
call is made to driCreateDisplay(). This function uses DRI facilities
|
||||
to determine the driver file appropriate for each screen on the local
|
||||
display. Each screen's driver is then opened with dlopen() and asked
|
||||
for its __driCreateScreen() function. The pointers to the __driCreateScreen()
|
||||
functions are kept in an array, indexed by screen number, in the
|
||||
__DRIdisplayRec struct.
|
||||
|
||||
When a driver's __driCreateScreen() function is called, it must initialize
|
||||
a __DRIscreenRec struct. This struct acts as the root of a tree of
|
||||
function pointers which are called to create and destroy contexts and
|
||||
drawables and perform all the operations needed by the GLX interface.
|
||||
See the xc/lib/GL/glx/glxclient.h file for details.
|
||||
|
||||
|
||||
|
||||
Dynamic Extension Function Registration
|
||||
|
||||
In order to provide forward compatibility with future drivers, libGL.so
|
||||
allows drivers to register new OpenGL extension functions which weren't
|
||||
known when libGL.so was built.
|
||||
|
||||
The register_extensions() function in xc/lib/GL/dri/dri_glx.c is called
|
||||
as soon as libGL.so is loaded. This is done with gcc's constructor
|
||||
attribute. This mechanism will likely have to be changed for other compilers.
|
||||
|
||||
register_extensions() loops over all local displays and screens, determines
|
||||
the DRI driver for each, and calls the driver's __driRegisterExtensions()
|
||||
function, if present.
|
||||
|
||||
The __driRegisterExtensions() function can add new entrypoints to libGL
|
||||
by calling:
|
||||
|
||||
GLboolean _glapi_add_entrypoint(const char *funcName, GLuint offset)
|
||||
|
||||
The parameters are the name of the function (such as "glFoobarEXT") and the
|
||||
offset of the dispatch slot in the API dispatch table. The return value
|
||||
indicates success (GL_TRUE) or failure (GL_FALSE).
|
||||
|
||||
_glapi_add_entrypoint() will synthesize entrypoint code in assembly
|
||||
language. Assembly languages is required since parameter passing
|
||||
can't be handled correctly using a C-based solution.
|
||||
|
||||
The address of the new entrypoint is obtained by calling the
|
||||
glXGetProcAddressARB() function.
|
||||
|
||||
The dispatch offset number MUST be a number allocated by SGI in the same
|
||||
manner in which new GL_* constants are allocated. Using an arbitrary
|
||||
offset number will result in many problems.
|
||||
|
||||
|
||||
|
||||
Dispatch Management
|
||||
|
||||
When a GL context is made current, the driver must install its dispatch
|
||||
table as the current dispatch table. This is done by calling
|
||||
|
||||
void _glapi_set_dispatch(struct _glapi_table *dispatch);
|
||||
|
||||
This will install the named dispatch table for the calling thread.
|
||||
The current dispatch table for a thread can be obtained by calling
|
||||
|
||||
struct _glapi_table *_glapi_get_dispatch(void);
|
||||
|
||||
For higher performance in the common single-thread case, the global
|
||||
variable _glapi_Dispatch will point to the current dispatch table.
|
||||
This variable will be NULL when in multi-thread mode.
|
||||
|
||||
|
||||
|
||||
Context Management
|
||||
|
||||
libGL.so uses the XFree86 xthreads package to manage a thread-specific
|
||||
current context pointer. See __glXGet/SetCurrentContext() in glext.c
|
||||
|
||||
Drivers may use the _glapi_set/get_context() functions to maintain
|
||||
a private thread-specific context pointer.
|
||||
|
||||
|
|
@ -10,6 +10,13 @@
|
|||
|
||||
<H1>News</H1>
|
||||
|
||||
<h2>November XX, 2009</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.6.1.html">Mesa 7.6.1</a> is released. This is a bug-fix
|
||||
release fixing issues found in the 7.6 release.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>September 28, 2009</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.6.html">Mesa 7.6</a> is released. This is a new feature
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ tbd
|
|||
<ul>
|
||||
<li>Upgraded GL/glext.h to version 56, GL/glxext.h to version 25,
|
||||
GL/wglext.h to version 17
|
||||
<li>New 3D driver, r600, for Radeon R6xx, R7xx hardware
|
||||
</ul>
|
||||
|
||||
|
||||
|
|
@ -51,7 +52,17 @@ tbd
|
|||
<li>Fixed glGetTexLevelParameter(GL_TEXTURE_INTERNAL_FORMAT) query so that
|
||||
it returns the actual compressed format chosen.
|
||||
<li>Fixed glBitmap bugs in Intel drivers.
|
||||
<li>Fixed a number of Microsoft Visual Studio compilation problems.
|
||||
<li>Fixed clipping / provoking vertex bugs in i965 driver.
|
||||
<li>Assorted build fixes for AIX.
|
||||
<li>Endianness fixes for the DRI swrast driver (bug 22767).</li>
|
||||
</ul>
|
||||
|
||||
<h2>Changes</h2>
|
||||
<ul>
|
||||
<li>Removed old VC6, VC7 project files for Windows
|
||||
</ul>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ tbd
|
|||
|
||||
<h2>New features</h2>
|
||||
<ul>
|
||||
<li>VMware "SVGA" Gallium driver. This is a Gallium3D driver which targets the
|
||||
VMware virtual graphics device. It allows Linux OpenGL guest applications
|
||||
to utilize the 3D graphics hardware of the host operating system.
|
||||
<li>GL_ARB_draw_elements_base_vertex (supported in Intel i965 and software drivers)</li>
|
||||
<li>GL_ARB_depth_clamp (supported in Intel i965 DRI and software drivers)</li>
|
||||
<li>GL_NV_depth_clamp (supported in Intel i965 DRI and software drivers)</li>
|
||||
|
|
@ -44,11 +47,15 @@ tbd
|
|||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>Many assorted i965 driver fixes.
|
||||
<li>Many r300-gallium driver fixes; this driver is now considered unstable-quality instead of experimental-quality.
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Changes</h2>
|
||||
<ul>
|
||||
<li>New Mesa texture/surface format infrastructure
|
||||
<li>Removed some unused Mesa device driver hooks
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
|
|
|
|||
53
docs/relnotes-7.8.html
Normal file
53
docs/relnotes-7.8.html
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<HTML>
|
||||
|
||||
<TITLE>Mesa Release Notes</TITLE>
|
||||
|
||||
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
|
||||
|
||||
<BODY>
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.8 Release Notes / date TBD</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.8 is a new development release.
|
||||
People who are concerned with stability and reliability should stick
|
||||
with a previous release or wait for Mesa 7.8.1.
|
||||
</p>
|
||||
<p>
|
||||
Mesa 7.8 implements the OpenGL 2.1 API, but the version reported by
|
||||
glGetString(GL_VERSION) depends on the particular driver being used.
|
||||
Some drivers don't support all the features required in OpenGL 2.1.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
|
||||
for DRI hardware acceleration.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
tbd
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>New features</h2>
|
||||
<ul>
|
||||
<li>TBD
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>TBD
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Changes</h2>
|
||||
<ul>
|
||||
<li>TBD
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -13,6 +13,7 @@ The release notes summarize what's new or changed in each Mesa release.
|
|||
</p>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="relnotes-7.8.html">7.8 release notes</A>
|
||||
<LI><A HREF="relnotes-7.7.html">7.7 release notes</A>
|
||||
<LI><A HREF="relnotes-7.6.1.html">7.6.1 release notes</A>
|
||||
<LI><A HREF="relnotes-7.6.html">7.6 release notes</A>
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@
|
|||
|
||||
/* GLX 1.4 */
|
||||
#define glXGetProcAddress mglXGetProcAddress
|
||||
#define glXGetProcAddressARB mglXGetProcAddressARB
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
1
progs/.gitignore
vendored
Normal file
1
progs/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
*.dSYM
|
||||
|
|
@ -15,22 +15,18 @@ message:
|
|||
|
||||
|
||||
subdirs:
|
||||
@if test -n "$(SUBDIRS)" ; then \
|
||||
for dir in $(SUBDIRS) ; do \
|
||||
if [ -d $$dir ] ; then \
|
||||
(cd $$dir && $(MAKE)) || exit 1 ; \
|
||||
fi \
|
||||
done \
|
||||
fi
|
||||
@list='$(SUBDIRS)'; for dir in $$list ; do \
|
||||
if [ -d $$dir ] ; then \
|
||||
(cd $$dir && $(MAKE)) || exit 1 ; \
|
||||
fi \
|
||||
done
|
||||
|
||||
# Dummy install target
|
||||
install:
|
||||
|
||||
clean:
|
||||
-@if test -n "$(SUBDIRS)" ; then \
|
||||
for dir in $(SUBDIRS) tests ; do \
|
||||
if [ -d $$dir ] ; then \
|
||||
(cd $$dir && $(MAKE) clean) ; \
|
||||
fi \
|
||||
done \
|
||||
fi
|
||||
@list='$(SUBDIRS)'; for dir in $$list tests ; do \
|
||||
if [ -d $$dir ] ; then \
|
||||
(cd $$dir && $(MAKE) clean) ; \
|
||||
fi \
|
||||
done
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@
|
|||
|
||||
#define DEPTH 5.0f
|
||||
|
||||
static PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointer_ext;
|
||||
|
||||
static GLfloat camz;
|
||||
|
||||
static GLint fogMode;
|
||||
|
|
|
|||
|
|
@ -353,6 +353,7 @@ MakeSphere(void)
|
|||
glNewList(SphereList, GL_COMPILE);
|
||||
gluSphere(obj, 2.0f, 10, 5);
|
||||
glEndList();
|
||||
gluDeleteQuadric(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -133,6 +133,8 @@ initdlists(void)
|
|||
|
||||
glEndList();
|
||||
}
|
||||
|
||||
gluDeleteQuadric(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -887,5 +887,6 @@ int main(int argc, char **argv)
|
|||
glutIdleFunc( idle_ );
|
||||
glutDisplayFunc( draw );
|
||||
glutMainLoop();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -245,6 +245,9 @@ loadImageTextures(void)
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
}
|
||||
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);
|
||||
|
||||
free(texData3);
|
||||
free(texData4);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -834,6 +834,8 @@ initdlists(void)
|
|||
gluQuadricTexture(obj, GL_TRUE);
|
||||
gluSphere(obj, SPHERE_RADIUS, 16, 16);
|
||||
glEndList();
|
||||
|
||||
gluDeleteQuadric(obj);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ Idle(void)
|
|||
{
|
||||
Xrot = glutGet(GLUT_ELAPSED_TIME) * 0.02;
|
||||
Yrot = glutGet(GLUT_ELAPSED_TIME) * 0.04;
|
||||
//Zrot += 2.0;
|
||||
/*Zrot += 2.0;*/
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ void main()
|
|||
float iter;
|
||||
|
||||
// for (iter = 0.0; iter < MaxIterations && r2 < 4.0; ++iter)
|
||||
for (iter = 0.0; iter < 12 && r2 < 4.0; ++iter)
|
||||
for (iter = 0.0; iter < 12.0 && r2 < 4.0; ++iter)
|
||||
{
|
||||
float tempreal = real;
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ static GLint win = 0;
|
|||
|
||||
static GLfloat xRot = 20.0f, yRot = 0.0f, zRot = 0.0f;
|
||||
|
||||
static GLuint tangentAttrib;
|
||||
static GLint tangentAttrib;
|
||||
|
||||
static GLboolean Anim = GL_FALSE;
|
||||
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ static void keyPress(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(0);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ MakeSphere(void)
|
|||
glNewList(SphereList, GL_COMPILE);
|
||||
gluSphere(obj, 2.0f, 30, 15);
|
||||
glEndList();
|
||||
gluDeleteQuadric(obj);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -22,22 +22,22 @@ static const char *FragShaderText[ 4 ] = {
|
|||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].w ) * 0.5 + 0.5;\n"
|
||||
" gl_FragColor.a = 1;\n"
|
||||
" gl_FragColor.a = 1.0;\n"
|
||||
"}\n",
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xw ) * 0.5 + 0.5;\n"
|
||||
" gl_FragColor.a = 1;\n"
|
||||
" gl_FragColor.a = 1.0;\n"
|
||||
"}\n",
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xyw ) * 0.5 + 0.5;\n"
|
||||
" gl_FragColor.a = 1;\n"
|
||||
" gl_FragColor.a = 1.0;\n"
|
||||
"}\n",
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xyzw ) * 0.5 + 0.5;\n"
|
||||
" gl_FragColor.a = 1;\n"
|
||||
" gl_FragColor.a = 1.0;\n"
|
||||
"}\n"
|
||||
};
|
||||
|
||||
|
|
@ -125,6 +125,7 @@ Key(unsigned char key, int x, int y)
|
|||
case 'a':
|
||||
Anim = !Anim;
|
||||
glutIdleFunc(Anim ? Idle : NULL);
|
||||
break;
|
||||
case 's':
|
||||
Slice -= step;
|
||||
break;
|
||||
|
|
@ -193,7 +194,7 @@ LoadAndCompileShader(GLuint shader, const char *text)
|
|||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog(shader, 1000, &len, log);
|
||||
fprintf(stderr, "noise: problem compiling shader: %s\n", log);
|
||||
fprintf(stderr, "multinoise: problem compiling shader: %s\n", log);
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -369,12 +369,9 @@ InitPrograms(void)
|
|||
static void
|
||||
InitGL(void)
|
||||
{
|
||||
const char *version = (const char *) glGetString(GL_VERSION);
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
if (version[0] != '2' || version[1] != '.') {
|
||||
printf("Warning: this program expects OpenGL 2.0\n");
|
||||
/*exit(1);*/
|
||||
}
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
printf("Usage:\n");
|
||||
printf(" a - toggle arrays vs. immediate mode rendering\n");
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ static const char *FragShaderText =
|
|||
" vec4 p;\n"
|
||||
" p.xy = gl_TexCoord[0].xy;\n"
|
||||
" p.z = Slice;\n"
|
||||
" p.w = 0;\n"
|
||||
" p.w = 0.0;\n"
|
||||
" vec4 n = noise4(p * scale);\n"
|
||||
" gl_FragColor = n * Scale + Bias;\n"
|
||||
"}\n";
|
||||
|
|
@ -119,6 +119,7 @@ Key(unsigned char key, int x, int y)
|
|||
case 'a':
|
||||
Anim = !Anim;
|
||||
glutIdleFunc(Anim ? Idle : NULL);
|
||||
break;
|
||||
case 's':
|
||||
Slice -= step;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -627,7 +627,7 @@ Init(void)
|
|||
NumAttribs = GetAttribs(Program, Attribs);
|
||||
PrintAttribs(Attribs);
|
||||
|
||||
//assert(glGetError() == 0);
|
||||
/*assert(glGetError() == 0);*/
|
||||
|
||||
glClearColor(0.4f, 0.4f, 0.8f, 0.0f);
|
||||
|
||||
|
|
|
|||
|
|
@ -310,8 +310,10 @@ MakeMipmap(void)
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4);
|
||||
////glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5);
|
||||
/*
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5);
|
||||
*/
|
||||
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
#undef SZ
|
||||
|
|
|
|||
|
|
@ -400,11 +400,8 @@ InitPrograms(void)
|
|||
static void
|
||||
Init(GLboolean useImageFiles)
|
||||
{
|
||||
const char *version = (const char *) glGetString(GL_VERSION);
|
||||
|
||||
if (version[0] != '2' || version[1] != '.') {
|
||||
printf("Warning: this program expects OpenGL 2.0\n");
|
||||
/*exit(1);*/
|
||||
if (!ShadersSupported()) {
|
||||
exit(1);
|
||||
}
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
|
|
|
|||
|
|
@ -179,9 +179,9 @@ Init(void)
|
|||
"\n"
|
||||
"void main() {\n"
|
||||
" vec2 p = gl_FragCoord.xy; \n"
|
||||
" if (crs(v1 - v0, p - v0) >= 0 && \n"
|
||||
" crs(v2 - v1, p - v1) >= 0 && \n"
|
||||
" crs(v0 - v2, p - v2) >= 0) \n"
|
||||
" if (crs(v1 - v0, p - v0) >= 0.0 && \n"
|
||||
" crs(v2 - v1, p - v1) >= 0.0 && \n"
|
||||
" crs(v0 - v2, p - v2) >= 0.0) \n"
|
||||
" gl_FragColor = vec4(1.0); \n"
|
||||
" else \n"
|
||||
" gl_FragColor = vec4(0.5); \n"
|
||||
|
|
|
|||
|
|
@ -116,6 +116,8 @@ void init(void)
|
|||
glNewList(startList+3, GL_COMPILE);
|
||||
gluPartialDisk(qobj, 0.0, 1.0, 20, 4, 0.0, 225.0);
|
||||
glEndList();
|
||||
|
||||
gluDeleteQuadric(qobj);
|
||||
}
|
||||
|
||||
void display(void)
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ void RenderScene (void)
|
|||
if (p != NULL)
|
||||
p++;
|
||||
}
|
||||
if (*p != '\0')
|
||||
if (p && *p != '\0')
|
||||
printf ("*** %s\n", "I/O error");
|
||||
|
||||
nextprogram = program->next;
|
||||
|
|
|
|||
|
|
@ -220,6 +220,12 @@ static void load_test_file (const char *filename)
|
|||
|
||||
fseek (f, 0, SEEK_END);
|
||||
size = ftell (f);
|
||||
|
||||
if (size == -1) {
|
||||
fclose (f);
|
||||
return;
|
||||
}
|
||||
|
||||
fseek (f, 0, SEEK_SET);
|
||||
|
||||
code = (char *) (malloc (size));
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ SOURCES = \
|
|||
texdown \
|
||||
texfilt.c \
|
||||
texgenmix.c \
|
||||
texleak.c \
|
||||
texline.c \
|
||||
texobj.c \
|
||||
texobjshare.c \
|
||||
|
|
|
|||
|
|
@ -134,6 +134,8 @@ static void Init( const char *vertProgFile,
|
|||
}
|
||||
|
||||
len = fread(buf, 1, 10*1000,f);
|
||||
fclose(f);
|
||||
|
||||
glProgramStringARB_func(GL_VERTEX_PROGRAM_ARB,
|
||||
GL_PROGRAM_FORMAT_ASCII_ARB,
|
||||
len,
|
||||
|
|
@ -170,6 +172,8 @@ static void Init( const char *vertProgFile,
|
|||
}
|
||||
|
||||
len = fread(buf, 1, 10*1000,f);
|
||||
fclose(f);
|
||||
|
||||
glProgramStringARB_func(GL_FRAGMENT_PROGRAM_ARB,
|
||||
GL_PROGRAM_FORMAT_ASCII_ARB,
|
||||
len,
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ Display(void)
|
|||
|
||||
glUseProgram_func(Program);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
/* draw to user framebuffer */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBobject);
|
||||
|
||||
|
|
@ -68,18 +70,23 @@ Display(void)
|
|||
glPopMatrix();
|
||||
|
||||
/* read from user framebuffer */
|
||||
/* bottom half = colorbuffer 0 */
|
||||
/* left half = colorbuffer 0 */
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
glReadPixels(0, 0, Width, Height / 2, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
glPixelStorei(GL_PACK_ROW_LENGTH, Width);
|
||||
glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
|
||||
glReadPixels(0, 0, Width / 2, Height, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
buffer);
|
||||
/* top half = colorbuffer 1 */
|
||||
|
||||
/* right half = colorbuffer 1 */
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT1_EXT);
|
||||
glReadPixels(0, Height/2, Width, Height - Height / 2,
|
||||
glPixelStorei(GL_PACK_SKIP_PIXELS, Width / 2);
|
||||
glReadPixels(Width / 2, 0, Width - Width / 2, Height,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
buffer + Width * (Height / 2) * 4);
|
||||
buffer);
|
||||
|
||||
/* draw to window */
|
||||
glUseProgram_func(0);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
glWindowPos2iARB(0, 0);
|
||||
glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||
|
|
|
|||
|
|
@ -3516,7 +3516,7 @@ check_functions( const char *extensions )
|
|||
struct name_test_pair *entry;
|
||||
int failures = 0, passes = 0, untested = 0;
|
||||
int totalFail = 0, totalPass = 0, totalUntested = 0, totalUnsupported = 0;
|
||||
int doTests;
|
||||
int doTests = 0;
|
||||
const char *version = (const char *) glGetString(GL_VERSION);
|
||||
|
||||
/* The functions list will have "real" entries (consisting of
|
||||
|
|
|
|||
|
|
@ -285,6 +285,12 @@ main(int argc, char** argv)
|
|||
glutInitWindowSize (600, 600);
|
||||
glutCreateWindow (argv[0]);
|
||||
glewInit();
|
||||
|
||||
if (!glutExtensionSupported("GL_EXT_texture_compression_s3tc")) {
|
||||
fprintf(stderr, "This test requires GL_EXT_texture_compression_s3tc.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
myInit();
|
||||
glutReshapeFunc (myReshape);
|
||||
glutDisplayFunc(display);
|
||||
|
|
|
|||
|
|
@ -17,53 +17,53 @@ struct pixel_format {
|
|||
GLenum format;
|
||||
GLenum type;
|
||||
GLint bytes;
|
||||
GLuint redTexel, greenTexel;
|
||||
GLuint redTexel, greenTexel; /* with approx 51% alpha, when applicable */
|
||||
};
|
||||
|
||||
static const struct pixel_format Formats[] = {
|
||||
|
||||
{ "GL_RGBA/GL_UNSIGNED_INT_8_8_8_8",
|
||||
GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, 4, 0xff000000, 0x00ff0000 },
|
||||
GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, 4, 0xff000080, 0x00ff0080 },
|
||||
{ "GL_RGBA/GL_UNSIGNED_INT_8_8_8_8_REV",
|
||||
GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0x000000ff, 0x0000ff00 },
|
||||
GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0x800000ff, 0x8000ff00 },
|
||||
{ "GL_RGBA/GL_UNSIGNED_INT_10_10_10_2",
|
||||
GL_RGBA, GL_UNSIGNED_INT_10_10_10_2, 4, 0xffc00000, 0x3ff000 },
|
||||
GL_RGBA, GL_UNSIGNED_INT_10_10_10_2, 4, 0xffc00002, 0x3ff002 },
|
||||
{ "GL_RGBA/GL_UNSIGNED_INT_2_10_10_10_REV",
|
||||
GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, 4, 0x3ff, 0xffc00 },
|
||||
GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, 4, 0xc00003ff, 0xc00ffc00 },
|
||||
{ "GL_RGBA/GL_UNSIGNED_SHORT_4_4_4_4",
|
||||
GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0xf000, 0x0f00 },
|
||||
GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0xf008, 0x0f08 },
|
||||
{ "GL_RGBA/GL_UNSIGNED_SHORT_4_4_4_4_REV",
|
||||
GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0x000f, 0x00f0 },
|
||||
GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0x800f, 0x80f0 },
|
||||
{ "GL_RGBA/GL_UNSIGNED_SHORT_5_5_5_1",
|
||||
GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0xf800, 0x7c0 },
|
||||
GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0xf801, 0x7c1 },
|
||||
{ "GL_RGBA/GL_UNSIGNED_SHORT_1_5_5_5_REV",
|
||||
GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x1f, 0x3e0 },
|
||||
GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x801f, 0x83e0 },
|
||||
|
||||
{ "GL_BGRA/GL_UNSIGNED_INT_8_8_8_8",
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, 4, 0x0000ff00, 0x00ff0000 },
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, 4, 0x0000ff80, 0x00ff0080 },
|
||||
{ "GL_BGRA/GL_UNSIGNED_INT_8_8_8_8_REV",
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0x00ff0000, 0x0000ff00 },
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0x80ff0000, 0x8000ff00 },
|
||||
{ "GL_BGRA/GL_UNSIGNED_SHORT_4_4_4_4",
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0x00f0, 0x0f00 },
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0x00f8, 0x0f08 },
|
||||
{ "GL_BGRA/GL_UNSIGNED_SHORT_4_4_4_4_REV",
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0x0f00, 0x00f0 },
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0x8f00, 0x80f0 },
|
||||
{ "GL_BGRA/GL_UNSIGNED_SHORT_5_5_5_1",
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0x3e, 0x7c0 },
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0x3f, 0x7c1 },
|
||||
{ "GL_BGRA/GL_UNSIGNED_SHORT_1_5_5_5_REV",
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x7c00, 0x3e0 },
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0xfc00, 0x83e0 },
|
||||
|
||||
{ "GL_ABGR_EXT/GL_UNSIGNED_INT_8_8_8_8",
|
||||
GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8, 4, 0x000000ff, 0x0000ff00 },
|
||||
GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8, 4, 0x800000ff, 0x8000ff00 },
|
||||
{ "GL_ABGR_EXT/GL_UNSIGNED_INT_8_8_8_8_REV",
|
||||
GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0xff000000, 0x00ff0000 },
|
||||
GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0xff000080, 0x00ff0080 },
|
||||
{ "GL_ABGR_EXT/GL_UNSIGNED_SHORT_4_4_4_4",
|
||||
GL_ABGR_EXT, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0x000f, 0x00f0 },
|
||||
GL_ABGR_EXT, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0x800f, 0x80f0 },
|
||||
{ "GL_ABGR_EXT/GL_UNSIGNED_SHORT_4_4_4_4_REV",
|
||||
GL_ABGR_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0xf000, 0x0f00 },
|
||||
GL_ABGR_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0xf008, 0x0f08 },
|
||||
{ "GL_ABGR_EXT/GL_UNSIGNED_SHORT_5_5_5_1",
|
||||
GL_ABGR_EXT, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0x1, 0x3e },
|
||||
GL_ABGR_EXT, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0xf801, 0xf83e },
|
||||
{ "GL_ABGR_EXT/GL_UNSIGNED_SHORT_1_5_5_5_REV",
|
||||
GL_ABGR_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x8000, 0x7c00 },
|
||||
GL_ABGR_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x800f, 0x7c0f },
|
||||
|
||||
{ "GL_RGB/GL_UNSIGNED_SHORT_5_6_5",
|
||||
GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 2, 0xf800, 0x7e0 },
|
||||
|
|
@ -108,7 +108,7 @@ static const struct name_format IntFormats[] = {
|
|||
static GLuint CurFormat = 0;
|
||||
|
||||
static GLboolean Test3D = GL_FALSE;
|
||||
|
||||
static GLboolean Blend = GL_FALSE;
|
||||
|
||||
|
||||
static void
|
||||
|
|
@ -192,12 +192,15 @@ MakeTexture(const struct pixel_format *format, GLenum intFormat, GLboolean swap)
|
|||
}
|
||||
|
||||
if (0) {
|
||||
GLint r, g, b, a;
|
||||
GLint r, g, b, a, l, i;
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &r);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE, &g);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE, &b);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &a);
|
||||
printf("sizes: %d %d %d %d\n", r, g, b, a);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_LUMINANCE_SIZE, &l);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTENSITY_SIZE, &i);
|
||||
printf("IntFormat: 0x%x R %d G %d B %d A %d L %d I %d\n",
|
||||
intFormat, r, g, b, a, l, i);
|
||||
glGetError();
|
||||
}
|
||||
|
||||
|
|
@ -231,6 +234,10 @@ Draw(void)
|
|||
glEnable(GL_TEXTURE_3D);
|
||||
else
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
if (Blend)
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
glBegin(GL_POLYGON);
|
||||
glTexCoord3f(0, 0, 0.5); glVertex2f(0, 0);
|
||||
glTexCoord3f(1, 0, 0.5); glVertex2f(w, 0);
|
||||
|
|
@ -242,6 +249,9 @@ Draw(void)
|
|||
glDisable(GL_TEXTURE_3D);
|
||||
else
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
glColor3f(0, 0, 0);
|
||||
glRasterPos2i(8, 6);
|
||||
PrintString(Formats[i].name);
|
||||
|
|
@ -262,7 +272,7 @@ Draw(void)
|
|||
glPushMatrix();
|
||||
glTranslatef(2, (i + 1) * (h + 2), 0);
|
||||
glRasterPos2i(8, 6);
|
||||
sprintf(s, "Internal Texture Format [f/F]: %s (%d of %d)",
|
||||
sprintf(s, "Internal Texture Format [f/F]: %s (%d of %lu)",
|
||||
IntFormats[CurFormat].name, CurFormat + 1, NUM_INT_FORMATS);
|
||||
PrintString(s);
|
||||
glPopMatrix();
|
||||
|
|
@ -276,6 +286,15 @@ Draw(void)
|
|||
PrintString("Target [2/3]: GL_TEXTURE_2D");
|
||||
glPopMatrix();
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(2, (i + 3) * (h + 2), 0);
|
||||
glRasterPos2i(8, 6);
|
||||
if (Blend)
|
||||
PrintString("Blend: Yes");
|
||||
else
|
||||
PrintString("Blend: No");
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
|
@ -298,6 +317,9 @@ Key(unsigned char key, int x, int y)
|
|||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 'b':
|
||||
Blend = !Blend;
|
||||
break;
|
||||
case 'F':
|
||||
if (CurFormat == 0)
|
||||
CurFormat = NUM_INT_FORMATS - 1;
|
||||
|
|
@ -333,6 +355,7 @@ Init(void)
|
|||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@
|
|||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
|
||||
static void assert_test(const char *file, int line, int cond, const char *msg)
|
||||
{
|
||||
if (!cond)
|
||||
|
|
@ -42,7 +46,7 @@ static void assert_error_test(const char *file, int line, GLenum expect)
|
|||
|
||||
#define assert_error(err) assert_error_test(__FILE__, __LINE__, (err))
|
||||
|
||||
static void check_status(GLuint id, GLenum pname, void (*query)(GLuint, GLenum, GLint *))
|
||||
static void check_status(GLuint id, GLenum pname, void (APIENTRY *query)(GLuint, GLenum, GLint *))
|
||||
{
|
||||
GLint status;
|
||||
|
||||
|
|
|
|||
|
|
@ -424,13 +424,13 @@ main(int argc, char *argv[])
|
|||
{
|
||||
const char *dpyName = XDisplayName(NULL);
|
||||
|
||||
struct window *h0, *h1, *h2, *h3;
|
||||
struct window *h0;
|
||||
|
||||
/* four windows and contexts sharing display lists and texture objects */
|
||||
h0 = AddWindow(dpyName, 10, 10, NULL);
|
||||
h1 = AddWindow(dpyName, 330, 10, h0);
|
||||
h2 = AddWindow(dpyName, 10, 350, h0);
|
||||
h3 = AddWindow(dpyName, 330, 350, h0);
|
||||
(void) AddWindow(dpyName, 330, 10, h0);
|
||||
(void) AddWindow(dpyName, 10, 350, h0);
|
||||
(void) AddWindow(dpyName, 330, 350, h0);
|
||||
|
||||
InitGLstuff(h0);
|
||||
|
||||
|
|
|
|||
|
|
@ -181,6 +181,18 @@ static void ReInit( GLenum TC, TEXTURE *Tx )
|
|||
GL_TEXTURE_INTERNAL_FORMAT, &v);
|
||||
printf("Requested internal format = 0x%x, actual = 0x%x\n", TC, v);
|
||||
|
||||
if (0) {
|
||||
GLint r, g, b, a, l, i;
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &r);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE, &g);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE, &b);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &a);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_LUMINANCE_SIZE, &l);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTENSITY_SIZE, &i);
|
||||
printf("Compressed Bits per R: %d G: %d B: %d A: %d L: %d I: %d\n",
|
||||
r, g, b, a, l, i);
|
||||
}
|
||||
|
||||
/* okay, now cache the compressed texture */
|
||||
Tx->TC = TC;
|
||||
if (Tx->cData != NULL) {
|
||||
|
|
|
|||
|
|
@ -176,6 +176,8 @@ MeasureDownloadRate(void)
|
|||
orig_getImage = (GLubyte *) malloc(image_bytes + ALIGN);
|
||||
if (!orig_texImage || !orig_getImage) {
|
||||
DownloadRate = 0.0;
|
||||
free(orig_texImage);
|
||||
free(orig_getImage);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
140
progs/tests/texleak.c
Normal file
140
progs/tests/texleak.c
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
* 'Texture leak' test
|
||||
*
|
||||
* Allocates and uses an additional texture of the maximum supported size for
|
||||
* each frame. This tests the system's ability to cope with using increasing
|
||||
* amounts of texture memory.
|
||||
*
|
||||
* Michel Dänzer July 2009 This program is in the public domain.
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
GLint size;
|
||||
GLvoid *image;
|
||||
static GLuint numTexObj;
|
||||
static GLuint *texObj;
|
||||
|
||||
|
||||
static void Idle( void )
|
||||
{
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void DrawObject(void)
|
||||
{
|
||||
static const GLfloat tex_coords[] = { 0.0, 0.0, 1.0, 1.0, 0.0 };
|
||||
static const GLfloat vtx_coords[] = { -1.0, -1.0, 1.0, 1.0, -1.0 };
|
||||
GLint i, j;
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
for (i = 0; i < numTexObj; i++) {
|
||||
glBindTexture(GL_TEXTURE_2D, texObj[i]);
|
||||
glBegin(GL_QUADS);
|
||||
for (j = 0; j < 4; j++ ) {
|
||||
glTexCoord2f(tex_coords[j], tex_coords[j+1]);
|
||||
glVertex2f( vtx_coords[j], vtx_coords[j+1] );
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void Display( void )
|
||||
{
|
||||
struct timeval start, end;
|
||||
|
||||
texObj = realloc(texObj, ++numTexObj * sizeof(*texObj));
|
||||
|
||||
/* allocate a texture object */
|
||||
glGenTextures(1, texObj + (numTexObj - 1));
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, texObj[numTexObj - 1]);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
memset(image, (16 * numTexObj) & 0xff, 4 * size * size);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size, size, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, image);
|
||||
|
||||
gettimeofday(&start, NULL);
|
||||
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
glPushMatrix();
|
||||
glScalef(5.0, 5.0, 5.0);
|
||||
DrawObject();
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
|
||||
glFinish();
|
||||
gettimeofday(&end, NULL);
|
||||
printf("Rendering frame took %lu ms using %u MB of textures\n",
|
||||
end.tv_sec * 1000 + end.tv_usec / 1000 - start.tv_sec * 1000 -
|
||||
start.tv_usec / 1000, numTexObj * 4 * size / 1024 * size / 1024);
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
|
||||
static void Reshape( int width, int height )
|
||||
{
|
||||
glViewport( 0, 0, width, height );
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glOrtho( -6.0, 6.0, -6.0, 6.0, 10.0, 100.0 );
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
glTranslatef( 0.0, 0.0, -70.0 );
|
||||
}
|
||||
|
||||
|
||||
static void Init( int argc, char *argv[] )
|
||||
{
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &size);
|
||||
printf("%d x %d max texture size\n", size, size);
|
||||
|
||||
image = malloc(4 * size * size);
|
||||
if (!image) {
|
||||
fprintf(stderr, "Failed to allocate %u bytes of memory\n", 4 * size * size);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
glShadeModel(GL_FLAT);
|
||||
glClearColor(0.3, 0.3, 0.4, 1.0);
|
||||
|
||||
Idle();
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
glutInit( &argc, argv );
|
||||
glutInitWindowSize( 300, 300 );
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
|
||||
glutCreateWindow(argv[0] );
|
||||
glewInit();
|
||||
|
||||
Init( argc, argv );
|
||||
|
||||
glutReshapeFunc( Reshape );
|
||||
glutDisplayFunc( Display );
|
||||
glutIdleFunc(Idle);
|
||||
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -88,7 +88,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(0);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(0);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue