Merge branch 'master' into i915-unification

Conflicts:

	src/mesa/drivers/dri/common/dri_bufmgr.c
	src/mesa/drivers/dri/common/dri_drmpool.c
	src/mesa/drivers/dri/i915tex/intel_batchpool.c
	src/mesa/drivers/dri/i915tex/intel_buffer_objects.c
	src/mesa/drivers/dri/i915tex/intel_regions.c
	src/mesa/drivers/dri/i915tex/intel_screen.c
	src/mesa/drivers/dri/i915tex/intel_screen.h
This commit is contained in:
Eric Anholt 2007-05-18 14:14:12 -07:00
commit 1bdee18536
281 changed files with 21668 additions and 17986 deletions

3
.gitignore vendored
View file

@ -1,7 +1,8 @@
*~
*.a
*.o
*.so
*.sw[a-z]
*~
depend
depend.bak
lib

View file

@ -7,7 +7,9 @@ SUBDIRS = src progs
default: $(TOP)/configs/current
@for dir in $(SUBDIRS) ; do \
(cd $$dir ; $(MAKE)) || exit 1 ; \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE)) || exit 1 ; \
fi \
done
@ -16,7 +18,9 @@ doxygen:
clean:
@for dir in $(SUBDIRS) ; do \
(cd $$dir ; $(MAKE) clean) ; \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE) clean) ; \
fi \
done
@ -34,9 +38,12 @@ realclean:
install:
@for dir in $(SUBDIRS) ; do \
(cd $$dir ; $(MAKE) install) || exit 1 ; \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE) install) || exit 1 ; \
fi \
done
# DirectFBGL module installation
linux-directfb-install:
cd src/mesa/drivers/directfb && $(MAKE) install
@ -155,10 +162,10 @@ ultrix-gcc:
# Rules for making release tarballs
DIRECTORY = Mesa-6.5.3pre
LIB_NAME = MesaLib-6.5.3pre
DEMO_NAME = MesaDemos-6.5.3pre
GLUT_NAME = MesaGLUT-6.5.3pre
DIRECTORY = Mesa-7.1pre
LIB_NAME = MesaLib-7.1pre
DEMO_NAME = MesaDemos-7.1pre
GLUT_NAME = MesaGLUT-7.1pre
MAIN_FILES = \
$(DIRECTORY)/Makefile* \
@ -222,6 +229,9 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/shader/slang/descrip.mms \
$(DIRECTORY)/src/mesa/shader/slang/sources \
$(DIRECTORY)/src/mesa/shader/slang/library/*.[ch] \
$(DIRECTORY)/src/mesa/shader/slang/library/*.gc \
$(DIRECTORY)/src/mesa/shader/slang/library/*.syn \
$(DIRECTORY)/src/mesa/shader/slang/library/Makefile \
$(DIRECTORY)/src/mesa/swrast/*.[ch] \
$(DIRECTORY)/src/mesa/swrast/descrip.mms \
$(DIRECTORY)/src/mesa/swrast/sources \
@ -288,7 +298,16 @@ MAIN_FILES = \
$(DIRECTORY)/windows/VC7/mesa/glu/glu.vcproj \
$(DIRECTORY)/windows/VC7/mesa/mesa.sln \
$(DIRECTORY)/windows/VC7/mesa/mesa/mesa.vcproj \
$(DIRECTORY)/windows/VC7/mesa/osmesa/osmesa.vcproj
$(DIRECTORY)/windows/VC7/mesa/osmesa/osmesa.vcproj \
$(DIRECTORY)/windows/VC8/mesa/mesa.sln \
$(DIRECTORY)/windows/VC8/mesa/gdi/gdi.vcproj \
$(DIRECTORY)/windows/VC8/mesa/glu/glu.vcproj \
$(DIRECTORY)/windows/VC8/mesa/mesa/mesa.vcproj \
$(DIRECTORY)/windows/VC8/mesa/osmesa/osmesa.vcproj \
$(DIRECTORY)/windows/VC8/progs/progs.sln \
$(DIRECTORY)/windows/VC8/progs/demos/gears.vcproj \
$(DIRECTORY)/windows/VC8/progs/glut/glut.vcproj
DRI_FILES = \
$(DIRECTORY)/include/GL/internal/dri_interface.h \
@ -364,6 +383,9 @@ DEMO_FILES = \
$(DIRECTORY)/progs/samples/Makefile* \
$(DIRECTORY)/progs/samples/README \
$(DIRECTORY)/progs/samples/*.c \
$(DIRECTORY)/progs/glsl/Makefile* \
$(DIRECTORY)/progs/glsl/*.c \
$(DIRECTORY)/progs/glsl/*.txt \
$(DIRECTORY)/progs/windml/Makefile.ugl \
$(DIRECTORY)/progs/windml/*.c \
$(DIRECTORY)/progs/windml/*.bmp \

View file

@ -100,6 +100,10 @@ do
-L*)
DEPS="$DEPS $1"
;;
-pthread)
# this is a special case (see bugzilla 10876)
DEPS="$DEPS $1"
;;
'-cplusplus')
CPLUSPLUS=1
;;

View file

@ -8,9 +8,9 @@
CONFIG_NAME = default
# Version info
MESA_MAJOR=6
MESA_MINOR=5
MESA_TINY=3
MESA_MAJOR=7
MESA_MINOR=1
MESA_TINY=0
# external projects. This should be useless now that we use libdrm.
DRM_SOURCE_PATH=$(TOP)/../drm

View file

@ -67,4 +67,4 @@ WINDOW_SYSTEM=dri
# gamma are missing because they have not been converted to use the new
# interface.
DRI_DIRS = i810 i915tex i915 i965 mach64 mga r128 r200 r300 radeon s3v \
savage sis tdfx trident unichrome ffb nouveau
savage sis tdfx trident unichrome ffb

View file

@ -22,7 +22,8 @@ ARCH_FLAGS ?=
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
-D_BSD_SOURCE -D_GNU_SOURCE \
-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
-DGLX_DIRECT_RENDERING -DHAVE_ALIAS -DUSE_XCB -DHAVE_POSIX_MEMALIGN
-DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING \
-DHAVE_ALIAS -DUSE_XCB -DHAVE_POSIX_MEMALIGN
X11_INCLUDES = `pkg-config --cflags-only-I x11` `pkg-config --cflags-only-I xcb` `pkg-config --cflags-only-I x11-xcb` `pkg-config --cflags-only-I xcb-glx`
@ -65,4 +66,4 @@ WINDOW_SYSTEM=dri
# gamma are missing because they have not been converted to use the new
# interface.
DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon s3v \
savage sis tdfx trident unichrome ffb
savage sis tdfx trident unichrome ffb nouveau

View file

@ -15,6 +15,13 @@ PIC_FLAGS = -fPIC
# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support.
ARCH_FLAGS ?=
# DRM and pciaccess
LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
LIBDRM_LIB = `pkg-config --libs libdrm`
PCIACCESS_CFLAGS = `pkg-config --cflags pciaccess`
PCIACCESS_LIB = `pkg-config --libs pciaccess`
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
-D_BSD_SOURCE -D_GNU_SOURCE -DHAVE_POSIX_MEMALIGN \
-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DDRM_USE_MALLOC -DIN_DRI_DRIVER
@ -28,7 +35,7 @@ CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
ASM_SOURCES =
# Library/program dependencies
DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl -L$(TOP)/$(LIB_DIR)
DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl -L$(TOP)/$(LIB_DIR) $(PCIACCESS_LIB)
GL_LIB_DEPS = -lm -lpthread -ldl
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm
@ -39,5 +46,5 @@ SRC_DIRS = glx/mini mesa glu glut/mini
DRIVER_DIRS = dri
PROGRAM_DIRS = miniglx
#DRI_DIRS = ffb gamma sis savage
DRI_DIRS = i810 i915 mach64 mga r128 r200 radeon tdfx unichrome fb
#DRI_DIRS = ffb gamma sis savage tdfx unichrome fb
DRI_DIRS = i810 i915tex i915 mach64 mga r128 r200 radeon

View file

@ -0,0 +1,805 @@
Name
MESA_texture_array
Name Strings
GL_MESA_texture_array
Contact
Ian Romanick, IBM (idr 'at' us.ibm.com)
IP Status
No known IP issues.
Status
Shipping in Mesa 7.1
Version
$Date: 2007/05/16$ $Revision: 0.4$
Number
TBD
Dependencies
OpenGL 1.2 or GL_EXT_texture3D is required.
Support for ARB_fragment_program is assumed, but not required.
Support for ARB_fragment_program_shadow is assumed, but not required.
Support for EXT_framebuffer_object is assumed, but not required.
Written based on the wording of the OpenGL 2.0 specification and
ARB_fragment_program_shadow but not dependent on them.
Overview
There are a number of circumstances where an application may wish to
blend two textures out of a larger set of textures. Moreover, in some
cases the selected textures may vary on a per-fragment basis within
a polygon. Several examples include:
1. High dynamic range textures. The application stores several
different "exposures" of an image as different textures. On a
per-fragment basis, the application selects which exposures are
used.
2. A terrain engine where the altitude of a point determines the
texture applied to it. If the transition is from beach sand to
grass to rocks to snow, the application will store each texture
in a different texture map, and dynamically select which two
textures to blend at run-time.
3. Storing short video clips in textures. Each depth slice is a
single frame of video.
Several solutions to this problem have been proposed, but they either
involve using a separate texture unit for each texture map or using 3D
textures without mipmaps. Both of these options have major drawbacks.
This extension provides a third alternative that eliminates the major
drawbacks of both previous methods. A new texture target,
TEXTURE_2D_ARRAY, is added that functions identically to TEXTURE_3D in
all aspects except the sizes of the non-base level images. In
traditional 3D texturing, the size of the N+1 LOD is half the size
of the N LOD in all three dimensions. For the TEXTURE_2D_ARRAY target,
the height and width of the N+1 LOD is halved, but the depth is the
same for all levels of detail. The texture then becomes an array of
2D textures. The per-fragment texel is selected by the R texture
coordinate.
References:
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=011557
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=000516
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=011903
http://www.delphi3d.net/articles/viewarticle.php?article=terraintex.htm
New Procedures and Functions
All functions come directly from EXT_texture_array.
void FramebufferTextureLayerEXT(enum target, enum attachment,
uint texture, int level, int layer);
New Tokens
All token names and values come directly from EXT_texture_array.
Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, by
the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and
GetDoublev, and by the <target> parameter of TexImage3D, GetTexImage,
GetTexLevelParameteriv, GetTexLevelParameterfv, GetTexParameteriv, and
GetTexParameterfv:
TEXTURE_1D_ARRAY_EXT 0x8C18
TEXTURE_2D_ARRAY_EXT 0x8C1A
Accepted by the <target> parameter of TexImage2D, TexSubImage2D,
CopyTexImage2D, CopyTexSubImage2D, CompressedTexImage2D,
CompressedTexSubImage2D, GetTexLevelParameteriv, and
GetTexLevelParameterfv:
TEXTURE_1D_ARRAY_EXT
PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19
Accepted by the <target> parameter of TexImage3D, TexSubImage3D,
CopyTexSubImage3D, CompressedTexImage3D, CompressedTexSubImage3D,
GetTexLevelParameteriv, and GetTexLevelParameterfv:
TEXTURE_2D_ARRAY_EXT
PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B
Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
GetFloatv, and GetDoublev
TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C
TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D
MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF
Accepted by the <param> parameter of TexParameterf, TexParameteri,
TexParameterfv, and TexParameteriv when the <pname> parameter is
TEXTURE_COMPARE_MODE_ARB:
COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E
(Note: COMPARE_REF_DEPTH_TO_TEXTURE_EXT is simply an alias for the
existing COMPARE_R_TO_TEXTURE token in OpenGL 2.0; the alternate name
reflects the fact that the R coordinate is not always used.)
Accepted by the <internalformat> parameter of TexImage3D and
CompressedTexImage3D, and by the <format> parameter of
CompressedTexSubImage3D:
COMPRESSED_RGB_S3TC_DXT1_EXT
COMPRESSED_RGBA_S3TC_DXT1_EXT
COMPRESSED_RGBA_S3TC_DXT3_EXT
COMPRESSED_RGBA_S3TC_DXT5_EXT
Accepted by the <pname> parameter of
GetFramebufferAttachmentParameterivEXT:
FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
(Note: FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER is simply an alias for the
FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT token provided in
EXT_framebuffer_object. This extension generalizes the notion of
"<zoffset>" to include layers of an array texture.)
Additions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation)
None
Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization)
-- Section 3.8.1 "Texture Image Specification"
Change the first paragraph (page 150) to say (spec changes identical to
EXT_texture_array):
"The command
void TexImage3D(enum target, int level, int internalformat,
sizei width, sizei height, sizei depth, int border,
enum format, enum type, void *data);
is used to specify a three-dimensional texture image. target must be one
one of TEXTURE_3D for a three-dimensional texture or
TEXTURE_2D_ARRAY_EXT for an two-dimensional array texture.
Additionally, target may be either PROXY_TEXTURE_3D for a
three-dimensional proxy texture, or PROXY_TEXTURE_2D_ARRAY_EXT for a
two-dimensional proxy array texture."
Change the fourth paragraph on page 151 to say (spec changes identical
to EXT_texture_array):
"Textures with a base internal format of DEPTH_COMPONENT are supported
by texture image specification commands only if target is TEXTURE_1D,
TEXTURE_2D, TEXTURE_1D_ARRAY_EXT, TEXTURE_2D_ARRAY_EXT,
PROXY_TEXTURE_1D, PROXY_TEXTURE_2D, PROXY_TEXTURE_1D_ARRAY_EXT, or
PROXY_TEXTURE_2D_ARRAY_EXT. Using this format in conjunction with any
other target will result in an INVALID_OPERATION error."
Change the fourth paragraph on page 156 to say (spec changes identical
to EXT_texture_array):
"The command
void TexImage2D(enum target, int level,
int internalformat, sizei width, sizei height,
int border, enum format, enum type, void *data);
is used to specify a two-dimensional texture image. target must be one
of TEXTURE_2D for a two-dimensional texture, TEXTURE_1D_ARRAY_EXT for a
one-dimensional array texture, or one of TEXTURE_CUBE_MAP_POSITIVE_X,
TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE_MAP_POSITIVE_Y,
TEXTURE_CUBE_MAP_NEGATIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z, or
TEXTURE_CUBE_MAP_NEGATIVE_Z for a cube map texture. Additionally,
target may be either PROXY_TEXTURE_2D for a two-dimensional proxy
texture, PROXY_TEXTURE_1D_ARRAY_EXT for a one-dimensional proxy array
texture, or PROXY TEXTURE_CUBE_MAP for a cube map proxy texture in the
special case discussed in section 3.8.11. The other parameters match
the corresponding parameters of TexImage3D.
For the purposes of decoding the texture image, TexImage2D is
equivalent to calling TexImage3D with corresponding arguments and depth
of 1, except that
* The border depth, d_b, is zero, and the depth of the image is
always 1 regardless of the value of border.
* The border height, h_b, is zero if <target> is
TEXTURE_1D_ARRAY_EXT, and <border> otherwise.
* Convolution will be performed on the image (possibly changing its
width and height) if SEPARABLE 2D or CONVOLUTION 2D is enabled.
* UNPACK SKIP IMAGES is ignored."
-- Section 3.8.2 "Alternate Texture Image Specification Commands"
Change the second paragraph (page 159) (spec changes identical
to EXT_texture_array):
"The command
void CopyTexImage2D(enum target, int level,
enum internalformat, int x, int y, sizei width,
sizei height, int border);
defines a two-dimensional texture image in exactly the manner of
TexImage2D, except that the image data are taken from the framebuffer
rather than from client memory. Currently, target must be one of
TEXTURE_2D, TEXTURE_1D_ARRAY_EXT, TEXTURE_CUBE_MAP_POSITIVE_X,
TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE MAP_POSITIVE_Y,
TEXTURE_CUBE_MAP_NEGATIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z, or
TEXTURE_CUBE_MAP_NEGATIVE_Z.
Change the last paragraph on page 160 to say (spec changes identical
to EXT_texture_array):
"Currently the target arguments of TexSubImage1D and CopyTexSubImage1D
must be TEXTURE_1D, the target arguments of TexSubImage2D and
CopyTexSubImage2D must be one of TEXTURE_2D, TEXTURE_1D_ARRAY_EXT,
TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_NEGATIVE_X,
TEXTURE_CUBE_MAP_POSITIVE_Y, TEXTURE_CUBE_MAP_NEGATIVE_Y,
TEXTURE_CUBE_MAP_POSITIVE_Z, or TEXTURE_CUBE_MAP_NEGATIVE_Z, and the
target arguments of TexSubImage3D and CopyTexSubImage3D must be
TEXTURE_3D or TEXTURE_2D_ARRAY_EXT. ..."
-- Section 3.8.4 "Texture Parameters"
Change the first paragraph (page 166) to say:
"Various parameters control how the texel array is treated when
specified or changed, and when applied to a fragment. Each parameter is
set by calling
void TexParameter{if}(enum target, enum pname, T param);
void TexParameter{if}v(enum target, enum pname, T params);
target is the target, either TEXTURE_1D, TEXTURE_2D, TEXTURE_3D,
TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT."
-- Section 3.8.8 "Texture Minification" in the section "Scale Factor and Level of Detail"
Change the first paragraph (page 172) to say:
"Let s(x,y) be the function that associates an s texture coordinate
with each set of window coordinates (x,y) that lie within a primitive;
define t(x,y) and r(x,y) analogously. Let u(x,y) = w_t * s(x,y),
v(x,y) = h_t * t(x,y), and w(x,y) = d_t * r(x,y), where w_t, h_t,
and d_t are as defined by equations 3.15, 3.16, and 3.17 with
w_s, h_s, and d_s equal to the width, height, and depth of the
image array whose level is level_base. For a one-dimensional
texture or a one-dimensional array texture, define v(x,y) = 0 and
w(x,y) = 0; for a two-dimensional texture or a two-dimensional array
texture, define w(x,y) = 0..."
-- Section 3.8.8 "Texture Minification" in the section "Mipmapping"
Change the third paragraph (page 174) to say:
"For a two-dimensional texture, two-dimensional array texture, or
cube map texture,"
Change the fourth paragraph (page 174) to say:
"And for a one-dimensional texture or a one-dimensional array texture,"
After the first paragraph (page 175) add:
"For one-dimensional array textures, h_b and d_b are treated as 1,
regardless of the actual values, when performing mipmap calculations.
For two-dimensional array textures, d_b is always treated as one,
regardless of the actual value, when performing mipmap calculations."
-- Section 3.8.8 "Automatic Mipmap Generation" in the section "Mipmapping"
Change the third paragraph (page 176) to say (spec changes identical
to EXT_texture_array):
"The contents of the derived arrays are computed by repeated, filtered
reduction of the level_base array. For one- and two-dimensional array
textures, each layer is filtered independently. ..."
-- Section 3.8.8 "Manual Mipmap Generation" in the section "Mipmapping"
Change first paragraph to say (spec changes identical to
EXT_texture_array):
"Mipmaps can be generated manually with the command
void GenerateMipmapEXT(enum target);
where <target> is one of TEXTURE_1D, TEXTURE_2D, TEXTURE_CUBE_MAP,
TEXTURE_3D, TEXTURE_1D_ARRAY, or TEXTURE_2D_ARRAY. Mipmap generation
affects the texture image attached to <target>. ..."
-- Section 3.8.10 "Texture Completeness"
Change the second paragaph (page 177) to say (spec changes identical
to EXT_texture_array):
"For one-, two-, or three-dimensional textures and one- or
two-dimensional array textures, a texture is complete if the following
conditions all hold true:"
-- Section 3.8.11 "Texture State and Proxy State"
Change the second and third paragraphs (page 179) to say (spec changes
identical to EXT_texture_array):
"In addition to image arrays for one-, two-, and three-dimensional
textures, one- and two-dimensional array textures, and the six image
arrays for the cube map texture, partially instantiated image arrays
are maintained for one-, two-, and three-dimensional textures and one-
and two-dimensional array textures. Additionally, a single proxy image
array is maintained for the cube map texture. Each proxy image array
includes width, height, depth, border width, and internal format state
values, as well as state for the red, green, blue, alpha, luminance,
and intensity component resolutions. Proxy image arrays do not include
image data, nor do they include texture properties. When TexImage3D is
executed with target specified as PROXY_TEXTURE_3D, the
three-dimensional proxy state values of the specified level-of-detail
are recomputed and updated. If the image array would not be supported
by TexImage3D called with target set to TEXTURE 3D, no error is
generated, but the proxy width, height, depth, border width, and
component resolutions are set to zero. If the image array would be
supported by such a call to TexImage3D, the proxy state values are set
exactly as though the actual image array were being specified. No pixel
data are transferred or processed in either case.
Proxy arrays for one- and two-dimensional textures and one- and
two-dimensional array textures are operated on in the same way when
TexImage1D is executed with target specified as PROXY_TEXTURE_1D,
TexImage2D is executed with target specified as PROXY_TEXTURE_2D or
PROXY_TEXTURE_1D_ARRAY_EXT, or TexImage3D is executed with target
specified as PROXY_TETXURE_2D_ARRAY_EXT."
-- Section 3.8.12 "Texture Objects"
Change section (page 180) to say (spec changes identical to
EXT_texture_array):
"In addition to the default textures TEXTURE_1D, TEXTURE_2D,
TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and TEXTURE_2D_EXT,
named one-, two-, and three-dimensional, cube map, and one- and
two-dimensional array texture objects can be created and operated upon.
The name space for texture objects is the unsigned integers, with zero
reserved by the GL.
A texture object is created by binding an unused name to TEXTURE_1D,
TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or
TEXTURE_2D_ARRAY_EXT. The binding is effected by calling
void BindTexture(enum target, uint texture);
with <target> set to the desired texture target and <texture> set to
the unused name. The resulting texture object is a new state vector,
comprising all the state values listed in section 3.8.11, set to the
same initial values. If the new texture object is bound to TEXTURE_1D,
TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or
TEXTURE_2D_ARRAY_EXT, it is and remains a one-, two-,
three-dimensional, cube map, one- or two-dimensional array texture
respectively until it is deleted.
BindTexture may also be used to bind an existing texture object to
either TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP,
TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT. The error
INVALID_OPERATION is generated if an attempt is made to bind a texture
object of different dimensionality than the specified target. If the
bind is successful no change is made to the state of the bound texture
object, and any previous binding to target is broken.
While a texture object is bound, GL operations on the target to which
it is bound affect the bound object, and queries of the target to which
it is bound return state from the bound object. If texture mapping of
the dimensionality of the target to which a texture object is bound is
enabled, the state of the bound texture object directs the texturing
operation.
In the initial state, TEXTURE_1D, TEXTURE_2D, TEXTURE_3D,
TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and TEXTURE_2D_ARRAY_EXT have
one-, two-, three-dimensional, cube map, and one- and two-dimensional
array texture state vectors respectively associated with them. In order
that access to these initial textures not be lost, they are treated as
texture objects all of whose names are 0. The initial one-, two-,
three-dimensional, cube map, one- and two-dimensional array textures
are therefore operated upon, queried, and applied as TEXTURE_1D,
TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and
TEXTURE_2D_ARRAY_EXT respectively while 0 is bound to the corresponding
targets.
Change second paragraph on page 181 to say (spec changes identical to
EXT_texture_array):
"... If a texture that is currently bound to one of the targets
TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP,
TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT is deleted, it is as
though BindTexture had been executed with the same target and texture
zero. ..."
Change second paragraph on page 182 to say (spec changes identical to
EXT_texture_array):
"The texture object name space, including the initial one-, two-, and
three dimensional, cube map, and one- and two-dimensional array texture
objects, is shared among all texture units. ..."
-- Section 3.8.14 "Depth Texture Comparison Modes" in "Texture Comparison Modes"
Change second through fourth paragraphs (page 188) to say:
"Let D_t be the depth texture value, in the range [0, 1]. For
texture lookups from one- and two-dimesional, rectangle, and
one-dimensional array targets, let R be the interpolated <r>
texture coordinate, clamped to the range [0, 1]. For texture lookups
from two-dimesional array texture targets, let R be the interpolated
<q> texture coordinate, clamped to the range [0, 1]. Then the
effective texture value L_t, I_t, or A_t is computed as follows:
If the value of TEXTURE_COMPARE_MODE is NONE, then
r = Dt
If the value of TEXTURE_COMPARE_MODE is
COMPARE_REF_DEPTH_TO_TEXTURE_EXT), then r depends on the texture
comparison function as shown in table 3.27."
-- Section 3.8.15 "Texture Application"
Change the first paragraph (page 189) to say:
"Texturing is enabled or disabled using the generic Enable and Disable
commands, respectively, with the symbolic constants TEXTURE_1D,
TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or
TEXTURE_2D_ARRAY_EXT to enable one-, two-, three-dimensional, cube
map, one-dimensional array, or two-dimensional array texture,
respectively. If both two- and one-dimensional textures are enabled,
the two-dimensional texture is used. If the three-dimensional and
either of the two- or one-dimensional textures is enabled, the
three-dimensional texture is used. If the cube map texture and any of
the three-, two-, or one-dimensional textures is enabled, then cube map
texturing is used. If one-dimensional array texture is enabled and any
of cube map, three-, two-, or one-dimensional textures is enabled,
one-dimensional array texturing is used. If two-dimensional array
texture is enabled and any of cube map, three-, two-, one-dimensional
textures or one-dimensional array texture is enabled, two-dimensional
array texturing is used..."
-- Section 3.11.2 of ARB_fragment_program (Fragment Program Grammar and Restrictions):
(mostly add to existing grammar rules)
<optionName> ::= "MESA_texture_array"
<texTarget> ::= "1D"
| "2D"
| "3D"
| "CUBE"
| "RECT"
| <arrayTarget> (if program option is present)
| <shadowTarget> (if program option is present)
<arrayTarget> ::= "ARRAY1D"
| "ARRAY2D"
<shadowTarget> ::= "SHADOW1D"
| "SHADOW2D"
| "SHADOWRECT"
| <shadowArrayTarget> (if program option is present)
<shadowArrayTarget> ::= "SHADOWARRAY1D"
| "SHADOWARRAY2D"
-- Add Section 3.11.4.5.4 "Texture Stack Option"
"If a fragment program specifies the "MESA_texture_array" program
option, the <texTarget> rule is modified to add the texture targets
ARRAY1D and ARRAY2D (See Section 3.11.2)."
-- Section 3.11.6 "Fragment Program Texture Instruction Set"
(replace 1st and 2nd paragraphs with the following paragraphs)
"The first three texture instructions described below specify the
mapping of 4-tuple input vectors to 4-tuple output vectors.
The sampling of the texture works as described in section 3.8,
except that texture environments and texture functions are not
applicable, and the texture enables hierarchy is replaced by explicit
references to the desired texture target (i.e., 1D, 2D, 3D, cube map,
rectangle, ARRAY1D, ARRAY2D). These texture instructions specify
how the 4-tuple is mapped into the coordinates used for sampling. The
following function is used to describe the texture sampling in the
descriptions below:
vec4 TextureSample(vec4 coord, float lodBias, int texImageUnit,
enum texTarget);
Note that not all four components of the texture coordinates <coord>
are used by all texture targets. Component usage for each <texTarget>
is defined in table X.
coordinates used
texTarget Texture Type s t r layer shadow
---------------- --------------------- ----- ----- ------
1D TEXTURE_1D x - - - -
2D TEXTURE_2D x y - - -
3D TEXTURE_3D x y z - -
CUBE TEXTURE_CUBE_MAP x y z - -
RECT TEXTURE_RECTANGLE_ARB x y - - -
ARRAY1D TEXTURE_1D_ARRAY_EXT x - - y -
ARRAY2D TEXTURE_2D_ARRAY_EXT x y - z -
SHADOW1D TEXTURE_1D x - - - z
SHADOW2D TEXTURE_2D x y - - z
SHADOWRECT TEXTURE_RECTANGLE_ARB x y - - z
SHADOWARRAY1D TEXTURE_1D_ARRAY_EXT x - - y z
SHADOWARRAY2D TEXTURE_2D_ARRAY_EXT x y - z w
Table X: Texture types accessed for each of the <texTarget>, and
coordinate mappings. The "coordinates used" column indicate the
input values used for each coordinate of the texture lookup, the
layer selector for array textures, and the reference value for
texture comparisons."
-- Section 3.11.6.2 "TXP: Project coordinate and map to color"
Add to the end of the section:
"A program will fail to load if the TXP instruction is used in
conjunction with the SHADOWARRAY2D target."
Additions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment Operations)
-- Section 4.4.2.3 "Attaching Texture Images to a Framebuffer"
Add to the end of the section (spec changes identical to
EXT_texture_array):
"The command
void FramebufferTextureLayerEXT(enum target, enum attachment,
uint texture, int level, int layer);
operates identically to FramebufferTexture3DEXT, except that it
attaches a single layer of a three-dimensional texture or a one- or
two-dimensional array texture. <layer> is an integer indicating the
layer number, and is treated identically to the <zoffset> parameter in
FramebufferTexture3DEXT. The error INVALID_VALUE is generated if
<layer> is negative. The error INVALID_OPERATION is generated if
<texture> is non-zero and is not the name of a three dimensional
texture or one- or two-dimensional array texture. Unlike
FramebufferTexture3D, no <textarget> parameter is accepted.
If <texture> is non-zero and the command does not result in an error,
the framebuffer attachment state corresponding to <attachment> is
updated as in the other FramebufferTexture commands, except that
FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT is set to <layer>."
-- Section 4.4.4.1 "Framebuffer Attachment Completeness"
Add to the end of the list of completeness rules (spec changes
identical to EXT_texture_array):
"* If FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE and
FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT names a one- or
two-dimensional array texture, then
FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT must be smaller than the
number of layers in the texture."
Additions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions)
-- Section 5.4 "Display Lists"
Change the first paragraphi on page 242 to say (spec changes
identical to EXT_texture_array):
"TexImage3D, TexImage2D, TexImage1D, Histogram, and ColorTable are
executed immediately when called with the corresponding proxy arguments
PROXY_TEXTURE_3D or PROXY_TEXTURE_2D_ARRAY_EXT; PROXY_TEXTURE_2D,
PROXY_TEXTURE_CUBE_MAP, or PROXY_TEXTURE_1D_ARRAY_EXT;
PROXY_TEXTURE_1D; PROXY_HISTOGRAM; and PROXY_COLOR_TABLE,
PROXY_POST_CONVOLUTION_COLOR_TABLE, or
PROXY_POST_COLOR_MATRIX_COLOR_TABLE."
Additions to Chapter 6 of the OpenGL 2.0 Specification (State and State Requests)
-- Section 6.1.3 "Enumerated Queries"
Add after the line beginning "If the value of
FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE" (spec changes
identical to EXT_texture_array):
"If <pname> is FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT and the
texture object named FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT is a
three-dimensional texture or a one- or two-dimensional array texture,
then <params> will contain the number of texture layer attached to the
attachment point. Otherwise, <params> will contain the value zero."
-- Section 6.1.4 "Texture Queries"
Change the first three paragraphs (page 248) to say (spec changes
identical to EXT_texture_array):
"The command
void GetTexImage(enum tex, int lod, enum format,
enum type, void *img);
is used to obtain texture images. It is somewhat different from the
other get commands; tex is a symbolic value indicating which texture
(or texture face in the case of a cube map texture target name) is to
be obtained. TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_1D_ARRAY_EXT,
and TEXTURE_2D_ARRAY_EXT indicate a one-, two-, or three-dimensional
texture, or one- or two-dimensional array texture, respectively.
TEXTURE_CUBE_MAP_POSITIVE_X, ...
GetTexImage obtains... from the first image to the last for
three-dimensional textures. One- and two-dimensional array textures
are treated as two- and three-dimensional images, respectively, where
the layers are treated as rows or images. These groups are then...
For three-dimensional and two-dimensional array textures, pixel storage
operations are applied as if the image were two-dimensional, except
that the additional pixel storage state values PACK_IMAGE_HEIGHT and
PACK_SKIP_IMAGES are applied. ..."
Additions to Appendix A of the OpenGL 2.0 Specification (Invariance)
None
Additions to the AGL/GLX/WGL Specifications
None
GLX Protocol
None
Dependencies on ARB_fragment_program
If ARB_fragment_program is not supported, the changes to section 3.11
should be ignored.
Dependencies on EXT_framebuffer_object
If EXT_framebuffer_object is not supported, the changes to section
3.8.8 ("Manual Mipmap Generation"), 4.4.2.3, and 6.1.3 should be ignored.
Dependencies on EXT_texture_compression_s3tc and NV_texture_compression_vtc
(Identical dependency as EXT_texture_array.)
S3TC texture compression is supported for two-dimensional array textures.
When <target> is TEXTURE_2D_ARRAY_EXT, each layer is stored independently
as a compressed two-dimensional textures. When specifying or querying
compressed images using one of the S3TC formats, the images are provided
and/or returned as a series of two-dimensional textures stored
consecutively in memory, with the layer closest to zero specified first.
For array textures, images are not arranged in 4x4x4 or 4x4x2 blocks as in
the three-dimensional compression format provided in the
EXT_texture_compression_vtc extension. Pixel store parameters, including
those specific to three-dimensional images, are ignored when compressed
image data are provided or returned, as in the
EXT_texture_compression_s3tc extension.
S3TC compression is not supported for one-dimensional texture targets in
EXT_texture_compression_s3tc, and is not supported for one-dimensional
array textures in this extension. If compressed one-dimensional arrays
are needed, use a two-dimensional texture with a height of one.
This extension allows the use of the four S3TC internal format types in
TexImage3D, CompressedTexImage3D, and CompressedTexSubImage3D calls.
Errors
None
New State
(add to table 6.15, p. 276)
Initial
Get Value Type Get Command Value Description Sec. Attribute
---------------------------- ----- ----------- ----- -------------------- ------ ---------
TEXTURE_BINDING_1D_ARRAY_EXT 2*xZ+ GetIntegerv 0 texture object bound 3.8.12 texture
to TEXTURE_1D_ARRAY
TEXTURE_BINDING_2D_ARRAY_EXT 2*xZ+ GetIntegerv 0 texture object bound 3.8.12 texture
to TEXTURE_2D_ARRAY
New Implementation Dependent State
(add to Table 6.32, p. 293)
Minimum
Get Value Type Get Command Value Description Sec. Attribute
---------------------------- ---- ----------- ------- ------------------ ----- ---------
MAX_TEXTURE_ARRAY_LAYERS_EXT Z+ GetIntegerv 64 maximum number of 3.8.1 -
layers for texture
arrays
Issues
(1) Is "texture stack" a good name for this functionality?
NO. The name is changed to "array texture" to match the
nomenclature used by GL_EXT_texture_array.
(2) Should the R texture coordinate be treated as normalized or
un-normalized? If it were un-normalized, floor(R) could be thought
of as a direct index into the array texture. This may be more
convenient for applications.
RESOLVED. All texture coordinates are normalized. The issue of
un-normalized texture coordinates has been discussed in the ARB
before and should be left for a layered extension.
RE-RESOLVED. The R coordinate is un-normalized. Accessing an array
using [0, layers-1] coordinates is much more natural.
(3) How does LOD selection work for stacked textures?
RESOLVED. For 2D array textures the R coordinate is ignored, and
the LOD selection equations for 2D textures are used. For 1D
array textures the T coordinate is ignored, and the LOD selection
equations for 1D textures are used. The expected usage is in a
fragment program with an explicit LOD selection.
(4) What is the maximum size of a 2D array texture? Is it the same
as for a 3D texture, or should a new query be added? How about for 1D
array textures?
RESOLVED. A new query is added.
(5) How are array textures exposed in GLSL?
RESOLVED. Use GL_EXT_texture_array.
(6) Should a 1D array texture also be exposed?
RESOLVED. For orthogonality, yes.
(7) How are stacked textures attached to framebuffer objects?
RESOLVED. Layers of both one- and two-dimensional array textures
are attached using FreambufferTextureLayerEXT. Once attached, the
array texture layer behaves exactly as either a one- or
two-dimensional texture.
(8) How is this extension related to GL_EXT_texture_array?
This extension adapats GL_MESAX_texture_stack to the notation,
indexing, and FBO access of GL_EXT_texture_array. This extension
replaces the GLSL support of GL_EXT_texture_array with
GL_ARB_fragment_program support.
Assembly program support is also provided by GL_NV_gpu_program4.
GL_NV_gpu_program4 also adds support for other features that are
specific to Nvidia hardware, while this extension adds only support
for array textures.
Much of text of this extension that has changed since
GL_MESAX_texture_stack comes directly from either
GL_EXT_texture_array or GL_NV_gpu_program4.
Revision History
||2005/11/15||0.1||idr||Initial draft MESAX version.||
||2005/12/07||0.2||idr||Added framebuffer object interactions.||
||2005/12/12||0.3||idr||Updated fragment program interactions.||
||2007/05/16||0.4||idr||Converted to MESA_texture_array. Brought in line with EXT_texture_array and NV_gpu_program4.||

View file

@ -88,19 +88,6 @@ driver (such as <code>radeon_dri.so</code>) at runtime. &nbsp;The
environment variable <code>LIBGL_DRIVERS_PATH</code> should name the
directory where these modules are located.<br>
<br>
Prior to running a MiniGXL application, the following kernel modules
must be installed:<br>
<br>
<div style="margin-left: 40px;"> agpgart.o<br>
radeonfb.o &nbsp;(assuming Radeon hardware)<br>
radeon.o &nbsp;(assuming Radeon hardware)<br>
</div>
<code></code> <br>
Finally, MiniGLX reads a configuration file (by default,<code>
/etc/miniglx.conf</code>) to determine basic configuration information.
&nbsp;The configuration file may also be located in the directory
specified by the <code>MINIGLX_CONF</code> environment variable).<br>
<br>
The remainder of this section describes the MiniGLX API functions.<br>
<br>
<h2>3.1 Initialization</h2>

View file

@ -1,155 +1,163 @@
File: docs/README.WIN32
Last updated: Mar 31, 2006 - Karl Schultz - kschultz@users.sourceforge.net
Quick Start
----- -----
Unzip the MesaLib, MesaGLUT, and MesaDemos ZIP files into the same
directory. The libs and demos build separately, so if you do not care
about the demos or GLUT, you only need to unzip MesaLib. If you unzip
more than one ZIP file, they all need to be unzipped into the same
directory. Don't worry, you will not overwrite anything.
The Windows build system uses Microsoft Visual Studio. Project files
for a specific version of Visual Studio are in their own directory in
the top-level "windows" directory. For example, Visual Studio 6 files
are in windows/VC6. If a directory does not exist for your version of
Visual Studio, you can try importing the project files from an earlier
version of Visual Studio. At this time, project files exist for
Version 6 and Version 7. The code has been built with a beta version
of Version 8 and it runs on 64-bit Windows. If you want to try this,
start by importing the VC7 files and create the 64-bit targets in the
configuration manager.
It is likely that the new and free Visual Studio Express can be used
to build Mesa, but it hasn't been tried yet. Start with the VC7
project files.
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.
Makefiles are no longer shipped or supported, but can be generated
from the projects using Visual Studio.
Windows Drivers
------- -------
At this time, only the GDI driver is known to work. Most of the demos
in progs/demos should work with this driver.
Source code also exists in the tree for other drivers in
src/mesa/drivers/windows, but the status of this code is unknown.
The GDI driver operates basically by writing pixel spans into a DIB
section and then blitting the DIB to the window. The driver was
recently cleaned up and rewitten and so may have bugs or may be
missing some functionality. The older versions of the CVS source may
be useful in figuring out any problems, or report them to me.
To build Mesa with the GDI driver, build the mesa, gdi, and glu
projects in the Visual Studio workspace found at
windows/VC6/mesa/mesa.dsw
or
windows/VC7/mesa/mesa.sln
The osmesa DLL can also be built with the osmesa project.
The build system creates a lib top-level directory and copies
resulting LIB and DLL files to this lib directory. The files are:
OPENGL32.LIB, GLU32.LIB, OSMESA32.LIB
OPENGL32.DLL, GLU32.DLL, OSMESA32.DLL
If the MesaDemos ZIP file was extracted, the DLL files are also copied
to the demos directory. This facilitates running the demos as described
below.
GLUT and Demos
---- --- -----
A Visual Studio workspace can be found at
windows/VC6/progs/progs.dsw
or
windows/VC7/progs/progs.sln
It can be used to build GLUT and a few demos. The GLUT lib and DLL
are copied to the top-level lib directory, along with the Mesa libs.
The demo build system expects to find the LIB files in the top level
lib directory, so you must build the Mesa libs first. The demo
executables are placed in the demos directory, because some of them
rely on data files found there. Also, the Mesa lib DLL's were copied
there by the Mesa lib build process. Therefore, you should be able to
simply run the demo executables from the demo directory.
If you want to run the demos from the Visual Studio, you may have to
change the startup directory and explicitly state where the executables are.
You may also build all the demo programs by using a makefile. Go to
the progs/demos directory and make sure you have executed VCVARS32.BAT
or whatever setup script is appropriate for your compiler. Then,
nmake -f Makefile.win
should build all the demos.
Build System Notes
----- ------ -----
VC6
---
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
---
The above-mentioned .cc problem does not exist in this version.
General
-------
After building, you can copy the above DLL files to a place in your
PATH such as $SystemRoot/SYSTEM32. If you don't like putting things
in a system directory, place them in the same directory as the
executable(s). Be careful about accidentially overwriting files of
the same name in the SYSTEM32 directory.
The DLL files are built so that the external entry points use the
stdcall calling convention.
Static LIB files are not built. The LIB files that are built with are
the linker import files associated with the DLL files.
The si-glu sources are used to build the GLU libs. This was done
mainly to get the better tessellator code.
To build "mangled" Mesa, add the preprocessor define USE_MGL_NAMESPACE
to the project settings. You will also need to edit src/mesa.def to
change all the gl* symbols to mgl*. Because this is easy to do with a
global replace operation in a text editor, no additional mangled
version of mesa.def is maintained or shipped.
If you have a Windows-related build problem or question, it is
probably better to direct it to me (kschultz@users.sourceforge.net),
rather than directly to the other Mesa developers. I will help you as
much as I can. I also monitor the Mesa mailing lists and will answer
questions in this area there as well.
Karl Schultz
File: docs/README.WIN32
Last updated: Apr 25, 2007 - Karl Schultz - kschultz@users.sourceforge.net
Quick Start
----- -----
Unzip the MesaLib, MesaGLUT, and MesaDemos ZIP files into the same
directory. The libs and demos build separately, so if you do not care
about the demos or GLUT, you only need to unzip MesaLib. If you unzip
more than one ZIP file, they all need to be unzipped into the same
directory. Don't worry, you will not overwrite anything.
The Windows build system uses Microsoft Visual Studio. Project files
for a specific version of Visual Studio are in their own directory in
the top-level "windows" directory. For example, Visual Studio 8 files
are in windows/VC8.
Support has been dropped for versions of Visual Studio prior to 8. The
main reason is because Microsoft now provides a free compiler and
developer environment. Visual Studio Express can be found at
http://msdn.microsoft.com/vstudio/express/visualc/default.aspx
You'll also need the Platform SDK. Instructions for obtaining and
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.
Makefiles are no longer shipped or supported, but can be generated
from the projects using Visual Studio.
Windows Drivers
------- -------
At this time, only the GDI driver is known to work. Most of the demos
in progs/demos should work with this driver.
Source code also exists in the tree for other drivers in
src/mesa/drivers/windows, but the status of this code is unknown.
The GDI driver operates basically by writing pixel spans into a DIB
section and then blitting the DIB to the window. The driver was
recently cleaned up and rewitten and so may have bugs or may be
missing some functionality. The older versions of the CVS source may
be useful in figuring out any problems, or report them to me.
To build Mesa with the GDI driver, build the mesa, gdi, and glu
projects in the Visual Studio workspace found at
windows/VC8/mesa/mesa.sln
The osmesa DLL can also be built with the osmesa project.
The build system creates a lib top-level directory and copies
resulting LIB and DLL files to this lib directory. The files are:
OPENGL32.LIB, GLU32.LIB, OSMESA32.LIB
OPENGL32.DLL, GLU32.DLL, OSMESA32.DLL
If the MesaDemos ZIP file was extracted, the DLL files are also copied
to the demos directory. This facilitates running the demos as described
below.
GLUT and Demos
---- --- -----
A Visual Studio workspace can be found at
windows/VC8/progs/progs.sln
It can be used to build GLUT and a few demos. The GLUT lib and DLL
are copied to the top-level lib directory, along with the Mesa libs.
The demo build system expects to find the LIB files in the top level
lib directory, so you must build the Mesa libs first. The demo
executables are placed in the demos directory, because some of them
rely on data files found there. Also, the Mesa lib DLL's were copied
there by the Mesa lib build process. Therefore, you should be able to
simply run the demo executables from the demo directory.
If you want to run the demos from the Visual Studio, you may have to
change the startup directory and explicitly state where the executables are.
You may also build all the demo programs by using a makefile. Go to
the progs/demos directory and make sure you have executed VCVARS32.BAT
or whatever setup script is appropriate for your compiler. Then,
nmake -f Makefile.win
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
---
No notes.
General
-------
After building, you can copy the above DLL files to a place in your
PATH such as $SystemRoot/SYSTEM32. If you don't like putting things
in a system directory, place them in the same directory as the
executable(s). Be careful about accidentially overwriting files of
the same name in the SYSTEM32 directory.
The DLL files are built so that the external entry points use the
stdcall calling convention.
Static LIB files are not built. The LIB files that are built with are
the linker import files associated with the DLL files.
The si-glu sources are used to build the GLU libs. This was done
mainly to get the better tessellator code.
To build "mangled" Mesa, add the preprocessor define USE_MGL_NAMESPACE
to the project settings. You will also need to edit src/mesa.def to
change all the gl* symbols to mgl*. Because this is easy to do with a
global replace operation in a text editor, no additional mangled
version of mesa.def is maintained or shipped.
If you have a Windows-related build problem or question, it is
probably better to direct it to me (kschultz@users.sourceforge.net),
rather than directly to the other Mesa developers. I will help you as
much as I can. I also monitor the Mesa mailing lists and will answer
questions in this area there as well.
Karl Schultz

View file

@ -71,8 +71,8 @@ a:visited {
<li><a href="helpwanted.html" target="MainFrame">Help Wanted</a>
<li><a href="devinfo.html" target="MainFrame">Development Notes</a>
<li><a href="sourcedocs.html" target="MainFrame">Source Documentation</a>
<li><a href="subset.html" target="MainFrame">Subset Information</a>
<li><a href="fbdev-dri.html" target="MainFrame">fbdev/DRI Environment</a>
<li><a href="subset.html" target="MainFrame">Mesa Subset Driver</a>
<li><a href="glfbdev-driver.html" target="MainFrame">glFBDev Driver</a>
<LI><A HREF="dispatch.html" target="MainFrame">GL Dispatch</A>
</ul>

View file

@ -9,7 +9,7 @@
<H1>Downloading</H1>
<p>
Last development release: <b>6.5.2</b>
Last development release: <b>6.5.3</b>
</p>
<p>

View file

@ -12,161 +12,77 @@
<H1>1. Introduction</H1>
<p>
The fbdev/DRI sub-project within Mesa brings hardware accelerated OpenGL
rendering to the Linux fbdev environment.
The X Window System / XFree86 is not needed.
The fbdev/DRI environment supports hardware-accelerated 3D rendering without
the X window system. This is typically used for embedded applications.
</p>
<p>
Basically, the <a href="http://dri.sf.net/">DRI</a> drivers for hardware
accelerated OpenGL for XFree86 have been ported to fbdev so that X is
not needed.
This means fbdev/DRI works in full-screen mode only.
Contributors to this project include Jon Smirl, Keith Whitwell and Dave Airlie.
</p>
<p>
DRI driver writers may find this simplified environment easier to work in,
compared to the full XFree86/DRI environment.
Applications in the fbdev/DRI environment use
the <a href="MiniGXL.html"> MiniGLX</a> interface to choose pixel
formats, create rendering contexts, etc. It's a subset of the GLX and
Xlib interfaces allowing some degree of application portability between
the X and X-less environments.
</p>
<p>
Much of the work for this project has been done by Jon Smirl and
Keith Whitwell.
</p>
<p>
To use fbdev/DRI, you'll need a Linux 2.4 or 2.6 kernel.
</p>
<h3>Background Info</h3>
<p>
The Mesa-based DRI drivers used to be hosted in the DRI tree (which is
basically a copy of the XFree86 tree).
Since the Mesa-based DRI drivers are moreso "Mesa drivers" than "XFree86
drivers" and the fact that with some work, the drivers could be used
without X, the driver code was moved into the Mesa tree.
</p>
<p>
So now the DRI drivers can be compiled for two different environments:
fbdev and XFree86.
To build the drivers for XFree86, one has to download/build the DRI
source tree.
Eventually, we'd like to be able to build the drivers for XFree86 outside
of the XFree86/DRI trees.
</p>
<h1>2. Compilation</h1>
<h2>2.1 Compiling the DRM modules</h2>
<p>
First, you'll need the DRM (Direct Rendering Manager) kernel module sources.
They're found in a module of the DRI CVS tree.
To obtain the code do the following:
You'll need the DRM and pciaccess libraries. Check with:
</p>
<pre>
cvs -d:pserver:anonymous@anoncvs.freedesktop.org:/cvs/dri login
</pre>
<p>
Press Enter/Return when prompted for a password. Then,
</p>
<pre>
cvs -d:pserver:anonymous@anoncvs.freedesktop.org:/cvs/dri co drm
pkg-config --modversion libdrm
pkg-config --modversion pciaccess
</pre>
<p>
Compile the DRM kernel modules:
You can get them from the git repository with:
</p>
<pre>
cd drm/linux
make
git clone git://anongit.freedesktop.org/git/mesa/drm
git clone git://anongit.freedesktop.org/git/xorg/lib/libpciaccess
</pre>
<p>
Note: you may need to be root in order to make a few symlinks.
See the README files in those projects for build/install instructions.
</p>
<p>
When compilation is done, you should have at least the following
kernel modules:
You'll need fbdev header files. Check with:
</p>
<pre>
gamma.o
i810.o
i830.o
mach64.o
mga.o
r128.o
radeon.o
savage.o
sis.o
tdfx.o
via.o
ls -l /usr/include/linux/fb.h
</pre>
<p>
You'll probably want to copy/move them into your kernel module directory
(for example: <code>/lib/modules/2.4.18-14/kernel/drivers/char/drm/</code>).
</p>
<h2>2.2 Compiling the Mesa drivers</h2>
<p>
Begin by editing the <code>Mesa/configs/default</code> file to set
the <code>DRM_SOURCE_PATH</code> variable.
Set it to the location where the DRM module sources are located.
For example, if your current directory in step 2.1 was <code>/home/fred/</code>
set DRM_SOURCE_PATH to <code>/home/fred/drm</code>
</p>
<p>
Next, assuming you're starting with a fresh Mesa CVS checkout,
do the following:
Compile Mesa with the 'linux-solo' configuration:
</p>
<pre>
make linux-solo
</pre>
<p>
If you previously built the source tree, run <code>make realclean</code>
first to remove the old object files.
When complete you should have the following:
</p>
<p>
When this is finished, check the <code>Mesa/lib/</code> directory
to verify that the following files were made:
</p>
<ul>
<li><code>libGL.so.1.2</code> - the client-side OpenGL library
(and a few symlinks to it).
<li><code>libGLU.so.1.1</code> - the GLU library (and a few symlinks to it).
<li><code>libglut.so.3.7</code> - the GLUT library (and a few symlinks to it).
<li><code>mga_dri.so</code> - DRI driver for Matrox G200/G400 cards.
<li><code>r128_dri.so</code> - DRI driver for ATI Rage 128 cards.
<li><code>r200_dri.so</code> - DRI driver for ATI R200 Radeon cards.
<li><code>radeon_dri.so</code> - DRI driver for original ATI Radeon cards.
<li><code>i810_dri.so</code> - DRI driver for Intel i810/i815 chips.
<li><code>i830_dri.so</code> - DRI driver for Intel i830/i845 chips.
<li><code>mga_dri.so</code> - DRI driver for Matrox G200/G400 cards.
<li><code>sis_dri.so</code> - DRI driver for SIS cards.
<li><code>tdfx_dri.so</code> - DRI driver for 3dfx Voodoo 3/4/5 cards.
<li><code>gamma_dri.so</code> - DRI driver for 3Dlabs gamma cards.
<li><code>fb_dri.so</code> - software-only fbdev driver.
<li><code>miniglx.conf</code> - configuration file for the MiniGLX interface
<li>lib/libGL.so - the GL library which applications link with
<li>lib/*_dri_so - DRI drivers
<li>lib/miniglx.conf - sample MiniGLX config file
<li>progs/miniglx/* - several MiniGLX sample programs
</ul>
<h1>3. Using fbdev/DRI</h1>
<p>
If XFree86 is currently running, exit/stop the X server so you're
working from the console.
If an X server currently running, exit/stop it so you're working from
the console.
</p>
@ -175,12 +91,23 @@ working from the console.
<p>
You'll need to load the kernel modules specific to your graphics hardware.
Typically, this consists of the agpgart module, an fbdev driver module
and the DRM kernel module (from step 2.1).
and the DRM kernel module.
</p>
<p>
As root, the kernel modules can be loaded as follows:
</p>
<p>
If you have Intel i915/i945 hardware:
</p>
<pre>
modprobe agpgart # the AGP GART module
modprobe intelfb # the Intel fbdev driver
modprobe i915 # the i915/945 DRI kernel module
</pre>
<p>
If you have ATI Radeon/R200 hardware, run as root:
If you have ATI Radeon/R200 hardware:
</p>
<pre>
modprobe agpgart # the AGP GART module
@ -189,7 +116,7 @@ If you have ATI Radeon/R200 hardware, run as root:
</pre>
<p>
If you have ATI Rage 128 hardware, run as root:
If you have ATI Rage 128 hardware:
</p>
<pre>
modprobe agpgart # the AGP GART module
@ -198,7 +125,7 @@ If you have ATI Rage 128 hardware, run as root:
</pre>
<p>
If you have Matrox G200/G400 hardware, run as root:
If you have Matrox G200/G400 hardware:
</p>
<pre>
modprobe agpgart # the AGP GART module
@ -207,37 +134,46 @@ If you have Matrox G200/G400 hardware, run as root:
</pre>
<p>
Then run <code>lsmod</code> to be sure the modules are loaded.
For a Radeon card, you should see something like this:
To verify that the agpgart, fbdev and drm modules are loaded:
</p>
<pre>
Module Size Used by Not tainted
radeon 110308 0 (unused)
radeonfb 21900 0 (unused)
agpgart 43072 1
ls -l /dev/agpgart /dev/fb* /dev/dri
</pre>
<p>
Alternately, use lsmod to inspect the currently installed modules.
If you have problems, look at the output of dmesg.
</p>
<h2>3.2 Configuration File</h2>
<p>
The <code>Mesa/lib/miniglx.conf</code> file should be installed
in <code>/etc/</code>.
Copy the sample miniglx.conf to /etc/miniglx.conf and review/edit its contents.
Alternately, the MINIGLX_CONF environment variable can be used to
indicate the location of miniglx.conf
</p>
<p>
Edit <code>/etc/miniglx.conf</code> to be sure it's set up correctly
for your hardware.
Comments in the file explain the options.
To determine the pciBusID value, run lspci and examine the output.
For example:
</p>
<pre>
/sbin/lspci:
00:02.0 VGA compatible controller: Intel Corporation 82915G/GV/910GL Express Chipset Family Graphics Controller (rev 04)
</pre>
<p>
00:02.0 indicates that pciBusID should be PCI:0:2:0
</p>
<h2>3.3 Running fbdev/DRI Programs</h2>
<p>
Make sure your LD_LIBRARY_PATH environment variable is set to the
<code>Mesa/lib/</code> directory.
location of the libGL.so library. You may need to append other paths
to LD_LIBRARY_PATH if libpciaccess.so is in a non-standard location,
for example.
</p>
<p>
@ -245,7 +181,7 @@ Change to the <code>Mesa/progs/miniglx/</code> directory and
start the sample_server program in the background:
</p>
<pre>
./sample_server &
./sample_server &amp;
</pre>
<p>
@ -268,27 +204,24 @@ them from a remote shell so that you can stop them with ctrl-C.
<h1>4.0 Troubleshooting</h1>
<p>
<ol>
<li>
If you try to run miniglxtest and get the following:
</p>
<br>
<pre>
[miniglx] failed to probe chipset
connect: Connection refused
server connection lost
</pre>
<p>
It means that the sample_server process is not running.
</p>
<br>
<br>
</li>
</ol>
<h1>5.0 Programming Information</h1>
<p>
The full OpenGL API is available with fbdev/DRI.
</p>
<p>
OpenGL/Mesa is interfaced to fbdev via the <a href="MiniGLX.html">MiniGLX</a>
interface.

View file

@ -128,10 +128,15 @@ specification as well as the GL_ARB_vertex_program and
GL_ARB_fragment_program extensions.
</p>
<p>
May 2007: Mesa 7.0 is released, implementing the OpenGL 2.1 specification
and OpenGL Shading Language.
</p>
<p>
Ongoing: Mesa is used as the core of many hardware OpenGL drivers for
the XFree86 X.org X servers within the
the XFree86 and X.org X servers within the
<A href="http://dri.freedesktop.org/" target="_parent">DRI project</A>.
I continue to enhance Mesa with new extensions and features.
</p>
@ -141,9 +146,16 @@ I continue to enhance Mesa with new extensions and features.
<H1>Major Versions</H1>
<p>
This is a summary of the major versions of Mesa. Note that Mesa's major
version number tracks OpenGL's minor version number (+1).
Work is underway to implement the OpenGL 2.0 specification.
This is a summary of the major versions of Mesa.
Mesa's major version number has been incremented whenever a new version
of the OpenGL specification is implemented.
</p>
<H2>Version 7.x features</H2>
<p>
Version 7.x of Mesa implements the OpenGL 2.1 API. The main feature
of OpenGL 2.x is the OpenGL Shading Language.
</p>

View file

@ -11,6 +11,21 @@
<H1>News</H1>
<h2>May ???, 2007</h2>
<p>
<a href="relnotes-7.0.html">Mesa 7.0</a> is released.
This is a stable release featuring OpenGL 2.1 support.
</p>
<h2>April 27, 2007</h2>
<p>
<a href="relnotes-6.5.3.html">Mesa 6.5.3</a> is released.
This is a development release which will lead up to the Mesa 7.0 release
(which will advertise OpenGL 2.1 API support).
</p>
<h2>March 26, 2007</h2>
<p>
The new Shading Language compiler branch has been merged into the git

View file

@ -8,27 +8,53 @@
<body bgcolor="#eeeeee">
<H1>Mesa 6.5.3 Release Notes / (in progress)</H1>
<H1>Mesa 6.5.3 Release Notes / April 27, 2007</H1>
<p>
Mesa 6.5.3 is a 6.5 follow-on development release with many internal changes.
Mesa 6.5.3 is a development release with many changes and new features.
Mesa 7.0 is expected to follow shortly.
</p>
<h2>MD5 checksums</h2>
<pre>
TBD
39f33ea64e34e2d5b20640b008b57649 MesaLib-6.5.3.tar.gz
46359457147c469745f24b5074a186f0 MesaLib-6.5.3.tar.bz2
a8946fa861634ce15971396f47992c41 MesaLib-6.5.3.zip
08e26948d57eaca74d02a530b2d8106e MesaDemos-6.5.3.tar.gz
8af91773ab2653fe537499676b05f2e8 MesaDemos-6.5.3.tar.bz2
783f81b171bf89b0929abc894efd25a6 MesaDemos-6.5.3.zip
9467d415388fe1ad82991fb20704b812 MesaGLUT-6.5.3.tar.gz
360843e46b7ebb6909290b023f9b26fa MesaGLUT-6.5.3.tar.bz2
7686065e5c15a30de08a1610860b6840 MesaGLUT-6.5.3.zip
</pre>
<h2>Shared library numbering</h2>
<p>
Mesa 6.5.3 supports the OpenGL 2.0/2.1 API. However, the (unix)
shared library version is still 1.5 (i.e. libGL.so.1.5.xxxxxx).
Bumping the shared library version to 2.x would cause linking problems
with existing OpenGL applications. Since OpenGL 2.x is backward
compatible with OpenGL 1.x the shared library version number doesn't
have to be incremented (which would indicate an incompatible ABI).
</p>
<p>
Other OpenGL vendors name their OpenGL 2.x libraries libGL.so.1.0.xxxxx
for the same reason.
</p>
<h2>New features</h2>
<ul>
<li>OpenGL 2.0 support.
<li>Entirely new Shading Language code generator.
<li>OpenGL 2.0 and 2.1 API support.
<li>Entirely new Shading Language code generator. See the
<a href="shading.html">Shading Language</a> page for more information.
<li>Much faster software execution of vertex, fragment shaders.
<li>New vertex buffer object infrastructure (replaces old array_cache code).
<li>New vertex buffer object (vbo) infrastructure
<li>Updated glext.h file (version 39)
<li>Updated glxext.h file (version 18)
<li>Updated glxext.h file (version 19)
<li>GL_MAX_DRAWBUFFERS is now 4 (software rendering) so
"multiple render targets" are really supported.
</ul>
@ -43,18 +69,22 @@ TBD
<li>Overlapping glCopyPixels with negative Y zoom didn't work (bug 10521)
<li>Fixed a number of framebuffer/renderbuffer reference counting bugs
<li>Fixed a few bugs in software-emulated alpha planes
<li>Assorted minor bug fixes in glCopy/DrawPixels, glPixelZoom, etc.
<li>Assorted DRI driver bug fixes.
<li>Fixed a number of bugs that prevented "depth-peeling" rendering from working.
</ul>
<h2>Internal code changes</h2>
<ul>
<li>Massive changes to the Shading Language compiler.
<li>The _MaintainTnlProgram, _MaintainTexEnvProgram, _TexEnvProgram and
_TnlProgram fields have been moved.
<li>The ctx->Vertex/FragmentProgram._Current fields point to the program
in effect, whether it comes from a shader, user-program or generated
fixed-function program.
<li>Old array_cache module replaced by new vbo module. All geometry
rendering is now cast in the form of vertex buffer objects.
<li>Massive changes to the Shading Language compiler and related state.
<li>Vertex/fragment shaders are compiled into GPU instructions and
programs very similar to GL_ARB_vertex/fragment_program.
<li>Vertex and fragment programs are executed with the same code now.
<li>The SSE-optimized vertex program path has been removed since it didn't
support more than 12 temp registers, didn't support branching/looping, etc.
</ul>
@ -72,17 +102,17 @@ fixed-function program.
Driver Status
---------------------- ----------------------
DRI drivers varies with the driver
XMesa/GLX (on Xlib) implements OpenGL 2.0
OSMesa (off-screen) implements OpenGL 2.0
XMesa/GLX (on Xlib) implements OpenGL 2.1
OSMesa (off-screen) implements OpenGL 2.1
Windows/Win32 implements OpenGL 2.1
Glide (3dfx Voodoo1/2) implements OpenGL 1.3
SVGA implements OpenGL 1.3
Wind River UGL implements OpenGL 1.3
Windows/Win32 implements OpenGL 1.5
DJGPP implements OpenGL 1.5
GGI implements OpenGL 1.3
BeOS implements OpenGL 1.5
Allegro needs updating
D3D needs updating
SVGA unsupported
Wind River UGL unsupported
DJGPP unsupported
GGI unsupported
BeOS unsupported
Allegro unsupported
D3D unsupported
</pre>
</body>

78
docs/relnotes-7.0.html Normal file
View file

@ -0,0 +1,78 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.0 Release Notes / (<em>in progress</em>)</H1>
<p>
Mesa 7.0 is a stable release, featuring OpenGL 2.1 API support.
</p>
<h2>MD5 checksums</h2>
<pre>
TBD
</pre>
<h2>New features</h2>
<ul>
<li>OpenGL 2.0 and 2.1 API support.
</ul>
<h2>Bug fixes</h2>
<ul>
<li>Fixed a few fog-related bugs.
<li>Fixed broken GLSL mix() function.
<li>Fixed broken GLSL exp() functions.
<li>Fixed GLSL mod4(vec4, vec4) bug.
<li>Implemented GLSL asin(), acos(), atan() functions.
<li>Fixed an R300 driver bug that caused Xorg composite manager to crash
<li>Fixed R300 vertex program/matrix bug (10848)
<li>GLSL dFdx() and dFdy() work for fragment program inputs now (texcoords)
<li>Specifying an invalid texture unit as a sampler could lead to a crash
</ul>
<h2>Internal code changes</h2>
<ul>
<li>Some texture code consolidation and simplifiction (Ian Romanick)
<li>R300 driver clean-ups.
</ul>
<h2>To Do (someday) items</h2>
<ul>
<li>Switch to freeglut
<li>Fix linux-glide target/driver.
<li>Improved lambda and derivative calculation for frag progs.
</ul>
<h2>Driver Status</h2>
<pre>
Driver Status
---------------------- ----------------------
DRI drivers varies with the driver
XMesa/GLX (on Xlib) implements OpenGL 2.1
OSMesa (off-screen) implements OpenGL 2.1
Windows/Win32 implements OpenGL 2.1
Glide (3dfx Voodoo1/2) implements OpenGL 1.3
SVGA unsupported
Wind River UGL unsupported
DJGPP unsupported
GGI unsupported
BeOS unsupported
Allegro unsupported
D3D unsupported
</pre>
</body>
</html>

67
docs/relnotes-7.1.html Normal file
View file

@ -0,0 +1,67 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.1 Release Notes / (<em>in progress</em>)</H1>
<p>
Mesa 7.1 is a new development release.
</p>
<h2>MD5 checksums</h2>
<pre>
TBD
</pre>
<h2>New features</h2>
<ul>
</ul>
<h2>Bug fixes</h2>
<ul>
</ul>
<h2>Internal code changes</h2>
<ul>
</ul>
<h2>To Do (someday) items</h2>
<ul>
<li>Switch to freeglut
<li>Fix linux-glide target/driver.
<li>Improved lambda and derivative calculation for frag progs.
</ul>
<h2>Driver Status</h2>
<pre>
Driver Status
---------------------- ----------------------
DRI drivers varies with the driver
XMesa/GLX (on Xlib) implements OpenGL 2.1
OSMesa (off-screen) implements OpenGL 2.1
Windows/Win32 implements OpenGL 2.1
Glide (3dfx Voodoo1/2) implements OpenGL 1.3
SVGA unsupported
Wind River UGL unsupported
DJGPP unsupported
GGI unsupported
BeOS unsupported
Allegro unsupported
D3D unsupported
</pre>
</body>
</html>

View file

@ -20,6 +20,8 @@ The release notes summarize what's new or changed in each Mesa release.
</p>
<UL>
<LI><A HREF="relnotes-7.1.html">7.1 release notes</A>
<LI><A HREF="relnotes-7.0.html">7.0 release notes</A>
<LI><A HREF="relnotes-6.5.3.html">6.5.3 release notes</A>
<LI><A HREF="relnotes-6.5.2.html">6.5.2 release notes</A>
<LI><A HREF="relnotes-6.5.1.html">6.5.1 release notes</A>

View file

@ -44,6 +44,10 @@ in Mesa:
<li>Comparison of user-defined structs
<li>Linking of multiple shaders is not supported
<li>gl_ClipVertex
<li>The derivative functions such as dFdx() are not implemented
<li>The inverse trig functions asin(), acos(), and atan() are not implemented
<li>The gl_Color and gl_SecondaryColor varying vars are interpolated
without perspective correction
</ul>
<p>
@ -66,7 +70,6 @@ All other major features of the shading language should function.
<li>The quality of generated code is pretty good, register usage is fair.
<li>Shader error detection and reporting of errors (InfoLog) is not
very good yet.
<li>There are known memory leaks in the compiler.
<li>The ftransform() function doesn't necessarily match the results of
fixed-function transformation.
</ul>
@ -294,7 +297,7 @@ A new <a href="http://glean.sf.net" target="_parent">Glean</a> test has
been create to exercise the GLSL compiler.
</p>
<p>
The <em>glsl1</em> test runs over 130 sub-tests to check that the language
The <em>glsl1</em> test runs over 150 sub-tests to check that the language
features and built-in functions work properly.
This test should be run frequently while working on the compiler to catch
regressions.

View file

@ -1,17 +1,18 @@
<HTML>
<TITLE>Mesa Subset</TITLE>
<TITLE>Mesa Subset Driver</TITLE>
<link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<H1>Mesa Subset</H1>
<H1>Mesa Subset Driver</H1>
<p>
In 2002/2003 Tungsten Graphics was contracted to develop a subset Mesa/Radeon
driver for an embedded environment. The result is a reduced-size DRI driver
for the ATI R200 chip, for use with Linux fbdev rather than XFree86.
for the ATI R200 chip, for use with
<a href="fbdev-dri.html">fbdev/DRI environment</a>.
</p>
<p>
@ -19,15 +20,5 @@ The specification for this subset can be found
<a href="subset-A.html">here</a>.
</p>
<p>
The <a href="MiniGLX.html">MiniGLX specification</a> describes the
interface between fbdev and Mesa.
</p>
<p>
More info to come...
</p>
</BODY>
</HTML>

View file

@ -42,7 +42,7 @@ WIDTH="88" HEIGHT="31" ALIGN="BOTTOM" ALT="Sourceforge.net" BORDER="0"></A>
<br>
<br>
<li>The Mesa CVS repository is hosted by
<li>The Mesa git repository is hosted by
<a href="http://freedesktop.org/" target="_parent">freedesktop.org</a>.
<br>
<br>

View file

@ -2209,6 +2209,34 @@ GLAPI void GLAPIENTRY glGetProgramRegisterfvMESA(GLenum target, GLsizei len, con
#endif /* GL_MESA_program_debug */
#ifndef GL_MESA_texture_array
#define GL_MESA_texture_array 1
/* GL_MESA_texture_array uses the same enum values as GL_EXT_texture_array.
*/
#ifndef GL_EXT_texture_array
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glFramebufferTextureLayerEXT(GLenum target,
GLenum attachment, GLuint texture, GLint level, GLint layer);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target,
GLenum attachment, GLuint texture, GLint level, GLint layer);
#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18
#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19
#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A
#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B
#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C
#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D
#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
#endif
#endif
#ifndef GL_ATI_blend_equation_separate
#define GL_ATI_blend_equation_separate 1

View file

@ -46,9 +46,9 @@ extern "C" {
/*************************************************************/
/* Header file version number, required by OpenGL ABI for Linux */
/* glxext.h last updated 2007/02/13 */
/* glxext.h last updated 2007/04/21 */
/* Current version at http://www.opengl.org/registry/ */
#define GLX_GLXEXT_VERSION 18
#define GLX_GLXEXT_VERSION 19
#ifndef GLX_VERSION_1_3
#define GLX_WINDOW_BIT 0x00000001
@ -386,7 +386,7 @@ typedef struct {
/* (as used in the GLX_OML_sync_control extension). */
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#include <inttypes.h>
#elif defined(__sun__)
#elif defined(__sun__) || defined(__digital__)
#include <inttypes.h>
#if defined(__STDC__)
#if defined(__arch64__)

View file

@ -180,6 +180,21 @@ extern XMesaContext XMesaCreateContext( XMesaVisual v,
extern void XMesaDestroyContext( XMesaContext c );
#ifdef XFree86Server
/*
* These are the extra routines required for integration with XFree86.
* None of these routines should be user visible. -KEM
*/
extern GLboolean XMesaForceCurrent( XMesaContext c );
extern GLboolean XMesaLoseCurrent( XMesaContext c );
extern GLboolean XMesaCopyContext( XMesaContext src,
XMesaContext dst,
GLuint mask );
#endif /* XFree86Server */
/*
* Create an XMesaBuffer from an X window.
*/

View file

@ -124,8 +124,7 @@ do { \
do { \
/* Assumes: Images are always in ZPixmap format */ \
(void) __d; \
if (__sx || __sy) /* The non-trivial case */ \
XMesaPutImageHelper(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h); \
ASSERT(!__sx && !__sy); /* The SubImage case */ \
ValidateGC(__b, __gc); \
(*__gc->ops->PutImage)(__b, __gc, ((XMesaDrawable)(__b))->depth, \
__x, __y, __w, __h, 0, ZPixmap, \

View file

@ -17,7 +17,7 @@ message:
subdirs:
@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir ; $(MAKE)) || exit 1 ; \
(cd $$dir && $(MAKE)) || exit 1 ; \
fi \
done
@ -27,6 +27,6 @@ install:
clean:
@for dir in $(SUBDIRS) tests ; do \
if [ -d $$dir ] ; then \
(cd $$dir ; $(MAKE) clean) ; \
(cd $$dir && $(MAKE) clean) ; \
fi \
done

View file

@ -22,9 +22,11 @@ LIBS = GLUT32.LIB OPENGL32.LIB
all: OPENGL32.DLL GLU32.DLL GLUT32.DLL \
readtex.h readtex.c showbuffer.h showbuffer.c \
extfuncs.h trackball.h trackball.c \
arbfplight.exe arbfslight.exe arbocclude.exe bounce.exe \
clearspd.exe cubemap.exe drawpix.exe fire.exe fogcoord.exe \
fplight.exe gamma.exe gearbox.exe \
clearspd.exe cubemap.exe drawpix.exe engine.exe \
fire.exe fogcoord.exe \
fplight.exe fslight.exe gamma.exe gearbox.exe \
gears.exe geartrain.exe gloss.exe \
glinfo.exe glslnoise.exe \
gltestperf.exe glutfx.exe ipers.exe isosurf.exe lodbias.exe \
@ -42,14 +44,16 @@ bounce.exe: bounce.obj
clearspd.exe: clearspd.obj
cubemap.exe: cubemap.obj readtex.obj
drawpix.exe: drawpix.obj readtex.obj
engine.exe: engine.obj readtex.obj trackball.obj
fire.exe: fire.obj readtex.obj
fogcoord.exe: fogcoord.obj readtex.obj
fplight.exe: fplight.obj
fslight.exe: fslight.obj
gamma.exe: gamma.obj
gearbox.exe: gearbox.obj
gears.exe: gears.obj
geartrain.exe: geartrain.obj
gloss.exe: gloss.obj readtex.obj
gloss.exe: gloss.obj readtex.obj trackball.obj
glinfo.exe: glinfo.obj
glslnoise.exe: glslnoise.obj
gltestperf.exe: gltestperf.obj
@ -105,14 +109,23 @@ showbuffer.c: $(TOP)\progs\util\showbuffer.c
showbuffer.h: $(TOP)\progs\util\showbuffer.h
copy $** .
trackball.c: $(TOP)\progs\util\trackball.c
copy $** .
trackball.h: $(TOP)\progs\util\trackball.h
copy $** .
extfuncs.h: $(TOP)\progs\util\extfuncs.h
copy $** .
.obj.exe:
$(link) $(ldebug) -out:$@ $** /LIBPATH:$(LIBDIR) $(LIBS)
.c.obj:
$(cc) $(cdebug) $(cflags) $(cvars) /I$(INCDIR) $*.c
$(cc) $(cdebug) $(cflags) $(cvars) -D_USE_MATH_DEFINES /I$(INCDIR) $*.c
clean::
del *.obj *.exe readtex.* showbuffer.*
del *.obj *.exe readtex.* showbuffer.* trackball.*
clobber::

View file

@ -24,6 +24,7 @@ static GLuint VertProg;
static GLboolean Anim = GL_TRUE;
static GLboolean Wire = GL_FALSE;
static GLboolean PixelLight = GL_TRUE;
static GLint Win;
static GLint T0 = 0;
static GLint Frames = 0;
@ -148,6 +149,7 @@ static void Key( unsigned char key, int x, int y )
case 27:
glDeleteProgramsARB_func(1, &VertProg);
glDeleteProgramsARB_func(1, &FragProg);
glutDestroyWindow(Win);
exit(0);
break;
}
@ -382,7 +384,7 @@ int main( int argc, char *argv[] )
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 200, 200 );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
Win = glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );

View file

@ -62,7 +62,7 @@ static PFNGLUNIFORM3FVARBPROC glUniform4fvARB = NULL;
static void normalize (GLfloat *dst, const GLfloat *src)
{
GLfloat len = sqrtf (src[0] * src[0] + src[1] * src[1] + src[2] * src[2]);
GLfloat len = sqrt (src[0] * src[0] + src[1] * src[1] + src[2] * src[2]);
dst[0] = src[0] / len;
dst[1] = src[1] / len;
dst[2] = src[2] / len;

View file

@ -7,151 +7,136 @@
* Daniel Borca
*/
#define GL_GLEXT_PROTOTYPES
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glut.h>
#include "readtex.h"
#define DEPTH 5.0f
#define TEXTURE_FILE "../images/bw.rgb"
static PFNGLFOGCOORDFEXTPROC glFogCoordf_ext;
static PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointer_ext;
#define ARRAYS 0 /* use glDrawElements */
#define VERBOSE 1 /* tell me what happens */
#define DEPTH 15.0f
#if !defined(GLAPIENTRYP)
# define GLAPIENTRYP *
#endif
typedef void (GLAPIENTRYP GLFOGCOORDFEXTPROC) (GLfloat f);
typedef void (GLAPIENTRYP GLFOGCOORDPOINTEREXTPROC) (GLenum, GLsizei, const GLvoid *);
static GLFOGCOORDFEXTPROC glFogCoordf_ext;
#if ARRAYS
static GLFOGCOORDPOINTEREXTPROC glFogCoordPointer_ext;
#endif
static GLboolean have_fog_coord;
static GLfloat camz;
static GLuint texture[1];
static GLint fogMode;
static GLboolean fogCoord;
static GLfloat fogDensity = 0.75;
static GLfloat fogStart = 1.0, fogEnd = 40.0;
static GLfloat fogStart = 1.0, fogEnd = DEPTH;
static GLfloat fogColor[4] = {0.6f, 0.3f, 0.0f, 1.0f};
static const char *ModeStr = NULL;
static GLboolean Arrays = GL_FALSE;
static GLboolean Texture = GL_TRUE;
static void APIENTRY glFogCoordf_nop (GLfloat f)
static void
Reset(void)
{
fogMode = 1;
fogCoord = 1;
fogDensity = 0.75;
fogStart = 1.0;
fogEnd = DEPTH;
Arrays = GL_FALSE;
Texture = GL_TRUE;
}
static void APIENTRY
glFogCoordf_nop (GLfloat f)
{
(void)f;
}
static int BuildTexture (const char *filename, GLuint texid[])
static void
PrintString(const char *s)
{
GLubyte *tex_data;
GLenum tex_format;
GLint tex_width, tex_height;
tex_data = LoadRGBImage(filename, &tex_width, &tex_height, &tex_format);
if (tex_data == NULL) {
return -1;
while (*s) {
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
s++;
}
{
GLint tex_max;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &tex_max);
if ((tex_width > tex_max) || (tex_height > tex_max)) {
return -1;
}
}
glGenTextures(1, texid);
glBindTexture(GL_TEXTURE_2D, texid[0]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, tex_format, tex_width, tex_height, 0,
tex_format, GL_UNSIGNED_BYTE, tex_data);
return 0;
}
static int SetFogMode (GLint fogMode)
static void
PrintInfo(void)
{
char s[100];
glDisable(GL_FOG);
glColor3f(0, 1, 1);
sprintf(s, "Mode(m): %s Start(s/S): %g End(e/E): %g Density(d/D): %g",
ModeStr, fogStart, fogEnd, fogDensity);
glWindowPos2iARB(5, 20);
PrintString(s);
sprintf(s, "Arrays(a): %s glFogCoord(c): %s EyeZ(z/z): %g",
(Arrays ? "Yes" : "No"),
(fogCoord ? "Yes" : "No"),
camz);
glWindowPos2iARB(5, 5);
PrintString(s);
}
static int
SetFogMode(GLint fogMode)
{
fogMode &= 3;
switch (fogMode) {
case 0:
ModeStr = "Off";
glDisable(GL_FOG);
#if VERBOSE
printf("fog(disable)\n");
#endif
break;
case 1:
ModeStr = "GL_LINEAR";
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_LINEAR);
glFogf(GL_FOG_START, fogStart);
glFogf(GL_FOG_END, fogEnd);
#if VERBOSE
printf("fog(GL_LINEAR, %.2f, %.2f)\n", fogStart, fogEnd);
#endif
break;
case 2:
ModeStr = "GL_EXP";
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_EXP);
glFogf(GL_FOG_DENSITY, fogDensity);
#if VERBOSE
printf("fog(GL_EXP, %.2f)\n", fogDensity);
#endif
break;
case 3:
ModeStr = "GL_EXP2";
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_EXP2);
glFogf(GL_FOG_DENSITY, fogDensity);
#if VERBOSE
printf("fog(GL_EXP2, %.2f)\n", fogDensity);
#endif
break;
}
return fogMode;
}
static GLboolean SetFogCoord (GLboolean fogCoord)
static GLboolean
SetFogCoord(GLboolean fogCoord)
{
glFogCoordf_ext = glFogCoordf_nop;
if (!have_fog_coord) {
#if VERBOSE
printf("fog(GL_FRAGMENT_DEPTH_EXT)%s\n", fogCoord ? " EXT_fog_coord not available!" : "");
#endif
return GL_FALSE;
}
if (fogCoord) {
glFogCoordf_ext = (GLFOGCOORDFEXTPROC)glutGetProcAddress("glFogCoordfEXT");
glFogCoordf_ext = (PFNGLFOGCOORDFEXTPROC)glutGetProcAddress("glFogCoordfEXT");
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
#if VERBOSE
printf("fog(GL_FOG_COORDINATE_EXT)\n");
#endif
} else {
}
else {
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
#if VERBOSE
printf("fog(GL_FRAGMENT_DEPTH_EXT)\n");
#endif
}
return fogCoord;
}
#if ARRAYS
/* could reuse vertices */
static GLuint vertex_index[] = {
/* Back */
@ -172,19 +157,19 @@ static GLuint vertex_index[] = {
static GLfloat vertex_pointer[][3] = {
/* Back */
{-2.5f,-2.5f,-DEPTH}, { 2.5f,-2.5f,-DEPTH}, { 2.5f, 2.5f,-DEPTH}, {-2.5f, 2.5f,-DEPTH},
{-1.0f,-1.0f,-DEPTH}, { 1.0f,-1.0f,-DEPTH}, { 1.0f, 1.0f,-DEPTH}, {-1.0f, 1.0f,-DEPTH},
/* Floor */
{-2.5f,-2.5f,-DEPTH}, { 2.5f,-2.5f,-DEPTH}, { 2.5f,-2.5f, DEPTH}, {-2.5f,-2.5f, DEPTH},
{-1.0f,-1.0f,-DEPTH}, { 1.0f,-1.0f,-DEPTH}, { 1.0f,-1.0f, 0.0}, {-1.0f,-1.0f, 0.0},
/* Roof */
{-2.5f, 2.5f,-DEPTH}, { 2.5f, 2.5f,-DEPTH}, { 2.5f, 2.5f, DEPTH}, {-2.5f, 2.5f, DEPTH},
{-1.0f, 1.0f,-DEPTH}, { 1.0f, 1.0f,-DEPTH}, { 1.0f, 1.0f, 0.0}, {-1.0f, 1.0f, 0.0},
/* Right */
{ 2.5f,-2.5f, DEPTH}, { 2.5f, 2.5f, DEPTH}, { 2.5f, 2.5f,-DEPTH}, { 2.5f,-2.5f,-DEPTH},
{ 1.0f,-1.0f, 0.0}, { 1.0f, 1.0f, 0.0}, { 1.0f, 1.0f,-DEPTH}, { 1.0f,-1.0f,-DEPTH},
/* Left */
{-2.5f,-2.5f, DEPTH}, {-2.5f, 2.5f, DEPTH}, {-2.5f, 2.5f,-DEPTH}, {-2.5f,-2.5f,-DEPTH}
{-1.0f,-1.0f, 0.0}, {-1.0f, 1.0f, 0.0}, {-1.0f, 1.0f,-DEPTH}, {-1.0f,-1.0f,-DEPTH}
};
static GLfloat texcoord_pointer[][2] = {
@ -192,118 +177,139 @@ static GLfloat texcoord_pointer[][2] = {
{0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f},
/* Floor */
{0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f},
{0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, DEPTH}, {0.0f, DEPTH},
/* Roof */
{0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f},
{1.0f, 0.0f}, {0.0f, 0.0f}, {0.0f, DEPTH}, {1.0f, DEPTH},
/* Right */
{0.0f, 0.0f}, {0.0f, 1.0f}, {1.0f, 1.0f}, {1.0f, 0.0f},
{0.0f, 1.0f}, {0.0f, 0.0f}, {DEPTH, 0.0f}, {DEPTH, 1.0f},
/* Left */
{0.0f, 0.0f}, {0.0f, 1.0f}, {1.0f, 1.0f}, {1.0f, 0.0f}
{0.0f, 0.0f}, {0.0f, 1.0f}, {DEPTH, 1.0f}, {DEPTH, 0.0f}
};
static GLfloat fogcoord_pointer[][1] = {
static GLfloat fogcoord_pointer[] = {
/* Back */
{1.0f}, {1.0f}, {1.0f}, {1.0f},
DEPTH, DEPTH, DEPTH, DEPTH,
/* Floor */
{1.0f}, {1.0f}, {0.0f}, {0.0f},
DEPTH, DEPTH, 0.0, 0.0,
/* Roof */
{1.0f}, {1.0f}, {0.0f}, {0.0f},
DEPTH, DEPTH, 0.0, 0.0,
/* Right */
{0.0f}, {0.0f}, {1.0f}, {1.0f},
0.0, 0.0, DEPTH, DEPTH,
/* Left */
{0.0f}, {0.0f}, {1.0f}, {1.0f}
0.0, 0.0, DEPTH, DEPTH
};
#endif
static void Display( void )
static void
Display( void )
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity ();
glTranslatef(0.0f, 0.0f, camz);
glTranslatef(0.0f, 0.0f, -camz);
#if ARRAYS
glDrawElements(GL_QUADS, sizeof(vertex_index) / sizeof(vertex_index[0]), GL_UNSIGNED_INT, vertex_index);
#else
/* Back */
glBegin(GL_QUADS);
glFogCoordf_ext(1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f,-2.5f,-DEPTH);
glFogCoordf_ext(1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 2.5f,-2.5f,-DEPTH);
glFogCoordf_ext(1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 2.5f, 2.5f,-DEPTH);
glFogCoordf_ext(1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f, 2.5f,-DEPTH);
glEnd();
SetFogMode(fogMode);
/* Floor */
glBegin(GL_QUADS);
glFogCoordf_ext(1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f,-2.5f,-DEPTH);
glFogCoordf_ext(1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 2.5f,-2.5f,-DEPTH);
glFogCoordf_ext(0.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 2.5f,-2.5f, DEPTH);
glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f,-2.5f, DEPTH);
glEnd();
glColor3f(1, 1, 1);
/* Roof */
glBegin(GL_QUADS);
glFogCoordf_ext(1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f, 2.5f,-DEPTH);
glFogCoordf_ext(1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 2.5f, 2.5f,-DEPTH);
glFogCoordf_ext(0.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 2.5f, 2.5f, DEPTH);
glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f, 2.5f, DEPTH);
glEnd();
if (Texture)
glEnable(GL_TEXTURE_2D);
/* Right */
glBegin(GL_QUADS);
glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f( 2.5f,-2.5f, DEPTH);
glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f( 2.5f, 2.5f, DEPTH);
glFogCoordf_ext(1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 2.5f, 2.5f,-DEPTH);
glFogCoordf_ext(1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 2.5f,-2.5f,-DEPTH);
glEnd();
if (Arrays) {
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glDrawElements(GL_QUADS, sizeof(vertex_index) / sizeof(vertex_index[0]),
GL_UNSIGNED_INT, vertex_index);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
else {
/* Back */
glBegin(GL_QUADS);
glFogCoordf_ext(DEPTH); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,-1.0f,-DEPTH);
glFogCoordf_ext(DEPTH); glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f,-1.0f,-DEPTH);
glFogCoordf_ext(DEPTH); glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f,-DEPTH);
glFogCoordf_ext(DEPTH); glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f,-DEPTH);
glEnd();
/* Left */
glBegin(GL_QUADS);
glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f,-2.5f, DEPTH);
glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f, 2.5f, DEPTH);
glFogCoordf_ext(1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(-2.5f, 2.5f,-DEPTH);
glFogCoordf_ext(1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(-2.5f,-2.5f,-DEPTH);
glEnd();
#endif
/* Floor */
glBegin(GL_QUADS);
glFogCoordf_ext(DEPTH); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,-1.0f,-DEPTH);
glFogCoordf_ext(DEPTH); glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f,-1.0f,-DEPTH);
glFogCoordf_ext(0.0f); glTexCoord2f(1.0f, DEPTH); glVertex3f( 1.0f,-1.0f,0.0);
glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, DEPTH); glVertex3f(-1.0f,-1.0f,0.0);
glEnd();
/* Roof */
glBegin(GL_QUADS);
glFogCoordf_ext(DEPTH); glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, 1.0f,-DEPTH);
glFogCoordf_ext(DEPTH); glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, 1.0f,-DEPTH);
glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, DEPTH); glVertex3f( 1.0f, 1.0f,0.0);
glFogCoordf_ext(0.0f); glTexCoord2f(1.0f, DEPTH); glVertex3f(-1.0f, 1.0f,0.0);
glEnd();
/* Right */
glBegin(GL_QUADS);
glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f,-1.0f,0.0);
glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, 1.0f,0.0);
glFogCoordf_ext(DEPTH); glTexCoord2f(DEPTH, 0.0f); glVertex3f( 1.0f, 1.0f,-DEPTH);
glFogCoordf_ext(DEPTH); glTexCoord2f(DEPTH, 1.0f); glVertex3f( 1.0f,-1.0f,-DEPTH);
glEnd();
/* Left */
glBegin(GL_QUADS);
glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,-1.0f,0.0);
glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f,0.0);
glFogCoordf_ext(DEPTH); glTexCoord2f(DEPTH, 1.0f); glVertex3f(-1.0f, 1.0f,-DEPTH);
glFogCoordf_ext(DEPTH); glTexCoord2f(DEPTH, 0.0f); glVertex3f(-1.0f,-1.0f,-DEPTH);
glEnd();
}
glDisable(GL_TEXTURE_2D);
PrintInfo();
glutSwapBuffers();
}
static void Reshape( int width, int height )
static void
Reshape( int width, int height )
{
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f, (GLfloat)(width)/(GLfloat)(height), 0.1f, 100.0f);
glFrustum(-1, 1, -1, 1, 1.0, 100);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
static void Key( unsigned char key, int x, int y )
static void
Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 'a':
Arrays = !Arrays;
break;
case 'f':
case 'm':
fogMode = SetFogMode(fogMode + 1);
break;
case '+':
if (fogDensity < 1.0) {
fogDensity += 0.05;
}
case 'D':
fogDensity += 0.05;
SetFogMode(fogMode);
break;
case '-':
case 'd':
if (fogDensity > 0.0) {
fogDensity -= 0.05;
}
@ -311,31 +317,43 @@ static void Key( unsigned char key, int x, int y )
break;
case 's':
if (fogStart > 0.0) {
fogStart -= 1.0;
fogStart -= 0.25;
}
SetFogMode(fogMode);
break;
case 'S':
if (fogStart < fogEnd) {
fogStart += 1.0;
if (fogStart < 100.0) {
fogStart += 0.25;
}
SetFogMode(fogMode);
break;
case 'e':
if (fogEnd > fogStart) {
fogEnd -= 1.0;
if (fogEnd > 0.0) {
fogEnd -= 0.25;
}
SetFogMode(fogMode);
break;
case 'E':
if (fogEnd < 100.0) {
fogEnd += 1.0;
fogEnd += 0.25;
}
SetFogMode(fogMode);
break;
case 'c':
fogCoord = SetFogCoord(fogCoord ^ GL_TRUE);
break;
case 't':
Texture = !Texture;
break;
case 'z':
camz -= 0.1;
break;
case 'Z':
camz += 0.1;
break;
case 'r':
Reset();
break;
case 27:
exit(0);
break;
@ -344,37 +362,28 @@ static void Key( unsigned char key, int x, int y )
}
static void SpecialKey( int key, int x, int y )
static void
Init(void)
{
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
if (camz < (DEPTH - 1.0)) {
camz += 1.0f;
}
break;
case GLUT_KEY_DOWN:
if (camz > -19.0) {
camz -= 1.0f;
}
break;
}
glutPostRedisplay();
}
static const GLubyte teximage[2][2][4] = {
{ { 255, 255, 255, 255}, { 128, 128, 128, 255} },
{ { 128, 128, 128, 255}, { 255, 255, 255, 255} }
};
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
static void Init( void )
{
have_fog_coord = glutExtensionSupported("GL_EXT_fog_coord");
if (BuildTexture(TEXTURE_FILE, texture) == -1) {
exit(1);
if (!have_fog_coord) {
printf("GL_EXT_fog_coord not supported!\n");
}
glEnable(GL_TEXTURE_2D);
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClearDepth(1.0f);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0,
GL_RGBA, GL_UNSIGNED_BYTE, teximage);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glClearColor(0.1f, 0.1f, 0.1f, 0.0f);
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_SMOOTH);
@ -383,11 +392,8 @@ static void Init( void )
glFogfv(GL_FOG_COLOR, fogColor);
glHint(GL_FOG_HINT, GL_NICEST);
fogCoord = SetFogCoord(GL_TRUE); /* try to enable fog_coord */
fogMode = SetFogMode(2); /* GL_EXP */
fogMode = SetFogMode(1);
camz = -19.0f;
#if ARRAYS
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vertex_pointer);
@ -395,24 +401,24 @@ static void Init( void )
glTexCoordPointer(2, GL_FLOAT, 0, texcoord_pointer);
if (have_fog_coord) {
glFogCoordPointer_ext = (GLFOGCOORDPOINTEREXTPROC)glutGetProcAddress("glFogCoordPointerEXT");
glFogCoordPointer_ext = (PFNGLFOGCOORDPOINTEREXTPROC)glutGetProcAddress("glFogCoordPointerEXT");
glEnableClientState(GL_FOG_COORDINATE_ARRAY_EXT);
glFogCoordPointer_ext(GL_FLOAT, 0, fogcoord_pointer);
}
#endif
Reset();
}
int main( int argc, char *argv[] )
int
main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 640, 480 );
glutInitWindowSize( 600, 600 );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutDisplayFunc( Display );
Init();
glutMainLoop();

View file

@ -24,7 +24,7 @@ static GLuint VertProg;
static GLboolean Anim = GL_TRUE;
static GLboolean Wire = GL_FALSE;
static GLboolean PixelLight = GL_TRUE;
static GLint Win;
static GLfloat Xrot = 0, Yrot = 0;
@ -136,8 +136,8 @@ static void Key( unsigned char key, int x, int y )
}
break;
case 27:
glutDestroyWindow(Win);
exit(0);
break;
}
glutPostRedisplay();
}
@ -272,7 +272,7 @@ int main( int argc, char *argv[] )
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 200, 200 );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
Win = glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );

View file

@ -45,7 +45,7 @@ static GLint uTexture;
static GLuint SphereList, RectList, CurList;
static GLint win = 0;
static GLboolean anim = GL_FALSE;
static GLboolean anim = GL_TRUE;
static GLboolean wire = GL_FALSE;
static GLboolean pixelLight = GL_TRUE;
@ -58,7 +58,7 @@ static GLfloat xRot = 90.0f, yRot = 0.0f;
static void
normalize(GLfloat *dst, const GLfloat *src)
{
GLfloat len = sqrtf(src[0] * src[0] + src[1] * src[1] + src[2] * src[2]);
GLfloat len = sqrt(src[0] * src[0] + src[1] * src[1] + src[2] * src[2]);
dst[0] = src[0] / len;
dst[1] = src[1] / len;
dst[2] = src[2] / len;
@ -477,8 +477,8 @@ Init(void)
version = (const char *) glGetString(GL_VERSION);
if (version[0] != '2' || version[1] != '.') {
printf("Warning: this program expects OpenGL 2.0\n");
/*exit(1);*/
printf("This program requires OpenGL 2.x, found %s\n", version);
exit(1);
}
GetExtensionFuncs();
@ -579,6 +579,8 @@ Init(void)
#if 0
TestFunctions();
#else
(void) TestFunctions;
#endif
}
@ -603,7 +605,7 @@ main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(100, 100);
glutInitWindowSize(200, 200);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);

View file

@ -296,14 +296,27 @@ RenderShadowMap(void)
0, 1, 0); /* up */
if (UseFBO) {
GLenum fbo_status;
glTexImage2D(GL_TEXTURE_2D, 0, depthFormat,
ShadowTexWidth, ShadowTexHeight, 0,
depthFormat, depthType, NULL);
/* Set the filter mode so that the texture is texture-complete.
* Otherwise it will cause the framebuffer to fail the framebuffer
* completeness test.
*/
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, ShadowFBO);
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);
assert(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)
== GL_FRAMEBUFFER_COMPLETE_EXT);
fbo_status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
if (fbo_status != GL_FRAMEBUFFER_COMPLETE_EXT) {
fprintf(stderr, "FBO not complete! status = 0x%04x\n", fbo_status);
assert(fbo_status == GL_FRAMEBUFFER_COMPLETE_EXT);
}
}
assert(!glIsEnabled(GL_TEXTURE_1D));

View file

@ -4,10 +4,10 @@
* Updated for GLU 1.3 tessellation by Gareth Hughes <gareth@valinux.com>
*/
#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glut.h>
#define MAX_POINTS 256
#define MAX_CONTOURS 32

View file

@ -5,17 +5,12 @@ include $(TOP)/configs/current
INCDIR = $(TOP)/include
OSMESA_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa -lGLU -lGL $(APP_LIB_DEPS)
OSMESA16_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa16 -lGLU -lGL $(APP_LIB_DEPS)
OSMESA32_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa32 -lGLU -lGL $(APP_LIB_DEPS)
LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
PROGS = \
brick \
bump \
deriv \
mandelbrot \
noise \
toyball \

319
progs/glsl/deriv.c Normal file
View file

@ -0,0 +1,319 @@
/**
* Test OpenGL 2.0 dx/dy functions for texcoords.
* Brian Paul
* 2 May 2007
*
* NOTE: resize the window to observe how the partial derivatives of
* the texcoords change.
*/
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
static char *FragProgFile = NULL;
static char *VertProgFile = NULL;
static GLuint fragShader;
static GLuint vertShader;
static GLuint program;
static GLuint SphereList, RectList, CurList;
static GLint win = 0;
static GLboolean anim = GL_TRUE;
static GLfloat xRot = 0.0f, yRot = 0.0f;
static void
Redisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(xRot, 1.0f, 0.0f, 0.0f);
glRotatef(yRot, 0.0f, 1.0f, 0.0f);
glCallList(CurList);
glPopMatrix();
glutSwapBuffers();
}
static void
Idle(void)
{
yRot = glutGet(GLUT_ELAPSED_TIME) * 0.1;
glutPostRedisplay();
}
static void
Reshape(int width, int height)
{
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -15.0f);
}
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glutDestroyWindow(win);
}
static void
Key(unsigned char key, int x, int y)
{
(void) x;
(void) y;
switch(key) {
case ' ':
case 'a':
anim = !anim;
if (anim)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
break;
case 'o':
if (CurList == SphereList)
CurList = RectList;
else
CurList = SphereList;
break;
case 27:
CleanUp();
exit(0);
break;
}
glutPostRedisplay();
}
static void
SpecialKey(int key, int x, int y)
{
const GLfloat step = 3.0f;
(void) x;
(void) y;
switch(key) {
case GLUT_KEY_UP:
xRot -= step;
break;
case GLUT_KEY_DOWN:
xRot += step;
break;
case GLUT_KEY_LEFT:
yRot -= step;
break;
case GLUT_KEY_RIGHT:
yRot += step;
break;
}
glutPostRedisplay();
}
static void
MakeSphere(void)
{
GLUquadricObj *obj = gluNewQuadric();
SphereList = glGenLists(1);
gluQuadricTexture(obj, GL_TRUE);
glNewList(SphereList, GL_COMPILE);
gluSphere(obj, 2.0f, 30, 15);
glEndList();
}
static void
MakeRect(void)
{
RectList = glGenLists(1);
glNewList(RectList, GL_COMPILE);
glBegin(GL_POLYGON);
glTexCoord2f(0, 0); glVertex2f(-2, -2);
glTexCoord2f(1, 0); glVertex2f( 2, -2);
glTexCoord2f(1, 1); glVertex2f( 2, 2);
glTexCoord2f(0, 1); glVertex2f(-2, 2);
glEnd();
glEndList();
}
static void
LoadAndCompileShader(GLuint shader, const char *text)
{
GLint stat;
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
glCompileShader_func(shader);
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog_func(shader, 1000, &len, log);
fprintf(stderr, "fslight: problem compiling shader:\n%s\n", log);
exit(1);
}
}
/**
* Read a shader from a file.
*/
static void
ReadShader(GLuint shader, const char *filename)
{
const int max = 100*1000;
int n;
char *buffer = (char*) malloc(max);
FILE *f = fopen(filename, "r");
if (!f) {
fprintf(stderr, "fslight: Unable to open shader file %s\n", filename);
exit(1);
}
n = fread(buffer, 1, max, f);
printf("fslight: read %d bytes from shader file %s\n", n, filename);
if (n > 0) {
buffer[n] = 0;
LoadAndCompileShader(shader, buffer);
}
fclose(f);
free(buffer);
}
static void
CheckLink(GLuint prog)
{
GLint stat;
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog_func(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
}
static void
Init(void)
{
static const char *fragShaderText =
"void main() {\n"
" gl_FragColor = abs(dFdy(gl_TexCoord[0])) * 50.0;\n"
" // gl_FragColor = gl_TexCoord[0];\n"
"}\n";
static const char *vertShaderText =
"void main() {\n"
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
" gl_TexCoord[0] = gl_MultiTexCoord0;\n"
"}\n";
const char *version;
version = (const char *) glGetString(GL_VERSION);
if (version[0] != '2' || version[1] != '.') {
printf("This program requires OpenGL 2.x, found %s\n", version);
exit(1);
}
GetExtensionFuncs();
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
if (FragProgFile)
ReadShader(fragShader, FragProgFile);
else
LoadAndCompileShader(fragShader, fragShaderText);
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
if (VertProgFile)
ReadShader(vertShader, VertProgFile);
else
LoadAndCompileShader(vertShader, vertShaderText);
program = glCreateProgram_func();
glAttachShader_func(program, fragShader);
glAttachShader_func(program, vertShader);
glLinkProgram_func(program);
CheckLink(program);
glUseProgram_func(program);
/*assert(glGetError() == 0);*/
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
glEnable(GL_DEPTH_TEST);
MakeSphere();
MakeRect();
CurList = SphereList;
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
glColor3f(1, 0, 0);
}
static void
ParseOptions(int argc, char *argv[])
{
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-fs") == 0) {
FragProgFile = argv[i+1];
}
else if (strcmp(argv[i], "-vs") == 0) {
VertProgFile = argv[i+1];
}
}
}
int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(200, 200);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);
glutDisplayFunc(Redisplay);
if (anim)
glutIdleFunc(Idle);
ParseOptions(argc, argv);
Init();
glutMainLoop();
return 0;
}

View file

@ -1,5 +1,3 @@
/* $Id: miniglxtest.c,v 1.3 2004/03/25 14:58:39 brianp Exp $ */
/*
* Test the mini GLX interface.
*/
@ -7,6 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <GL/gl.h>
#define USE_MINI_GLX 1
@ -16,90 +15,86 @@
#include <GL/glx.h>
#endif
#define FRONTBUFFER 1
#define NR 6
#define DO_SLEEPS 1
#define NR_DISPLAYS 2
static GLXContext ctx;
GLXContext ctx;
static GLuint NumFrames = 100;
static GLuint NumDisplays = 1;
static GLboolean Texture = GL_FALSE;
static GLboolean SingleBuffer = GL_FALSE;
static GLboolean Sleeps = GL_TRUE;
static void _subset_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
static void
rect(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
{
glBegin( GL_QUADS );
glVertex2f( x1, y1 );
glVertex2f( x2, y1 );
glVertex2f( x2, y2 );
glVertex2f( x1, y2 );
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glColor3f(0, 0, 1); glVertex2f(x1, y1);
glTexCoord2f(1, 0); glColor3f(1, 0, 0); glVertex2f(x2, y1);
glTexCoord2f(1, 1); glColor3f(0, 1, 0); glVertex2f(x2, y2);
glTexCoord2f(0, 1); glColor3f(0, 0, 0); glVertex2f(x1, y2);
glEnd();
}
static void redraw( Display *dpy, Window w, int rot )
static void
redraw(Display *dpy, Window w, int rot)
{
printf("Redraw event\n");
GLfloat a;
#if FRONTBUFFER
glDrawBuffer( GL_FRONT );
#else
/* glDrawBuffer( GL_BACK ); */
#endif
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor( rand()/(float)RAND_MAX,
rand()/(float)RAND_MAX,
rand()/(float)RAND_MAX,
1);
glClear( GL_COLOR_BUFFER_BIT );
#if 1
glColor3f( rand()/(float)RAND_MAX,
rand()/(float)RAND_MAX,
rand()/(float)RAND_MAX );
glPushMatrix();
glRotatef(rot, 0, 0, 1);
glScalef(.5, .5, .5);
_subset_Rectf( -1, -1, 1, 1 );
glRotatef(rot, 0, 0, 1);
glScalef(.5, .5, .5);
for (a = 0.0; a < 360.0; a += 30.0) {
glPushMatrix();
glRotatef(a, 0, 0, 1);
glRotatef(40, 1, 0, 0);
glColor3f(a / 360.0, 1-a/360.0, 0);
rect(0.3, -0.25, 1.5, 0.25);
glPopMatrix();
}
glPopMatrix();
#endif
#if FRONTBUFFER
glFlush();
#else
glXSwapBuffers( dpy, w );
#endif
glFinish();
if (SingleBuffer)
glFlush();
else
glXSwapBuffers(dpy, w);
}
static Window make_rgb_db_window( Display *dpy,
unsigned int width, unsigned int height )
static Window
make_window(Display *dpy, unsigned int width, unsigned int height)
{
int attrib[] = { GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
#if !FRONTBUFFER
GLX_DOUBLEBUFFER,
#endif
None };
int scrnum;
int attrib_single[] = { GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DEPTH_SIZE, 1,
None };
int attrib_double[] = { GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DEPTH_SIZE, 1,
GLX_DOUBLEBUFFER,
None };
int *attrib = SingleBuffer ? attrib_single : attrib_double;
int scrnum = 0;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visinfo;
scrnum = 0;
root = RootWindow( dpy, scrnum );
root = RootWindow(dpy, scrnum);
if (!(visinfo = glXChooseVisual( dpy, scrnum, attrib ))) {
if (!(visinfo = glXChooseVisual(dpy, scrnum, attrib))) {
printf("Error: couldn't get an RGB, Double-buffered visual\n");
exit(1);
}
if(!(ctx = glXCreateContext( dpy, visinfo, NULL, True ))) {
if (!(ctx = glXCreateContext(dpy, visinfo, NULL, True))) {
printf("Error: glXCreateContext failed\n");
exit(1);
}
@ -107,19 +102,19 @@ static Window make_rgb_db_window( Display *dpy,
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( dpy, root, 0, 0, width, height,
win = XCreateWindow(dpy, root, 0, 0, width, height,
0, visinfo->depth, InputOutput,
visinfo->visual, mask, &attr );
visinfo->visual, mask, &attr);
if (!win) {
printf("Error: XCreateWindow failed\n");
exit(1);
}
glXMakeCurrent( dpy, win, ctx );
glXMakeCurrent(dpy, win, ctx);
glViewport(0, 0, width, height);
@ -127,22 +122,24 @@ static Window make_rgb_db_window( Display *dpy,
}
static void event_loop( Display *dpy, Window win )
static void
event_loop(Display *dpy, Window win)
{
int i;
printf("Hang on... drawing %d frames\n", NR);
for (i = 0; i < NR; i++) {
redraw( dpy, win, i*10 );
if (DO_SLEEPS) {
printf("sleep(1)\n");
sleep(1);
printf("Drawing %d frames\n", NumFrames);
for (i = 0; i < NumFrames; i++) {
redraw(dpy, win, -i*2);
if (Sleeps) {
usleep(20000);
}
}
}
static int foo( void )
static int
runtest(void)
{
Display *dpy;
Window win;
@ -153,41 +150,121 @@ static int foo( void )
return 1;
}
win = make_rgb_db_window( dpy, 800, 600);
win = make_window(dpy, 800, 600);
srand(getpid());
glShadeModel( GL_FLAT );
glClearColor( 0.5, 0.5, 0.5, 1.0 );
/* init GL state */
glClearColor(0.5, 0.5, 0.5, 1.0);
glEnable(GL_DEPTH_TEST);
if (Texture) {
GLubyte image[16][16][4];
GLint i, j;
for (i = 0; i < 16; i++) {
for (j = 0; j < 16; j++) {
if (((i / 2) ^ (j / 2)) & 1) {
image[i][j][0] = 255;
image[i][j][1] = 255;
image[i][j][2] = 255;
image[i][j][3] = 255;
}
else {
image[i][j][0] = 128;
image[i][j][1] = 128;
image[i][j][2] = 128;
image[i][j][3] = 128;
}
}
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0,
GL_RGBA, GL_UNSIGNED_BYTE, image);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glEnable(GL_TEXTURE_2D);
}
if (SingleBuffer) {
glDrawBuffer(GL_FRONT);
glReadBuffer(GL_FRONT);
}
else {
glDrawBuffer(GL_BACK);
}
XMapWindow( dpy, win );
XMapWindow(dpy, win);
/* wait for window to get mapped */
{
XEvent e;
while (1) {
XNextEvent( dpy, &e );
XNextEvent(dpy, &e);
if (e.type == MapNotify && e.xmap.window == win) {
break;
}
}
}
event_loop( dpy, win );
event_loop(dpy, win);
glXDestroyContext( dpy, ctx );
XDestroyWindow( dpy, win );
glXDestroyContext(dpy, ctx);
XDestroyWindow(dpy, win);
XCloseDisplay( dpy );
XCloseDisplay(dpy);
return 0;
}
int main()
static void
usage(void)
{
printf("Usage:\n");
printf(" -f N render N frames (default %d)\n", NumFrames);
printf(" -d N do N display cycles\n");
printf(" -t texturing\n");
printf(" -s single buffering\n");
printf(" -n no usleep() delay\n");
}
static void
parse_args(int argc, char *argv[])
{
int i;
for (i = 0 ; i < NR_DISPLAYS ; i++) {
if (foo() != 0)
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-f") == 0) {
NumFrames = atoi(argv[i + 1]);
i++;
}
else if (strcmp(argv[i], "-d") == 0) {
NumDisplays = atoi(argv[i + 1]);
i++;
}
else if (strcmp(argv[i], "-n") == 0) {
Sleeps = GL_FALSE;
}
else if (strcmp(argv[i], "-s") == 0) {
SingleBuffer = GL_TRUE;
}
else if (strcmp(argv[i], "-t") == 0) {
Texture = GL_TRUE;
}
else {
usage();
exit(1);
}
}
}
int
main(int argc, char *argv[])
{
int i;
parse_args(argc, argv);
for (i = 0; i < NumDisplays; i++) {
if (runtest() != 0)
break;
}

View file

@ -1,221 +0,0 @@
LOCAL_LIBRARIES = $(XLIB) $(TOP)\lib\Mesaaux.a $(TOP)\lib\Mesaglu.a $(TOP)\lib\MesaGL.a
INCLUDES = -I$(TOP)\include
SRCS = accanti.c \
accnot.c \
accpersp.c \
accum.c \
aim.c \
alpha.c \
alpha3D.c \
anti.c \
antiindex.c \
antipindex.c \
antipoint.c \
antipoly.c \
bezcurve.c \
bezmesh.c \
bezsurf.c \
checker.c \
checker2.c \
chess.c \
clip.c \
colormat.c \
cone.c \
cube.c \
curve.c \
depthcue.c \
disk.c \
dof.c \
dofnot.c \
double.c \
drawf.c \
feedback.c \
fog.c \
fogindex.c \
font.c \
light.c \
linelist.c \
lines.c \
list.c \
list2.c \
maplight.c \
material.c \
mipmap.c \
model.c \
movelight.c \
nurbs.c \
pickdepth.c \
pickline.c \
picksquare.c \
plane.c \
planet.c \
planetup.c \
polys.c \
robot.c \
sccolorlight.c \
scene.c \
scenebamb.c \
sceneflat.c \
select.c \
simple.c \
smooth.c \
sphere.c \
stencil.c \
stroke.c \
surface.c \
tea.c \
teaambient.c \
teapots.c \
texgen.c \
texturesurf.c \
trim.c \
xfont.c
PROGRAMS = ProgramTargetName(accanti) \
ProgramTargetName(accnot) \
ProgramTargetName(accpersp) \
ProgramTargetName(accum) \
ProgramTargetName(aim) \
ProgramTargetName(alpha) \
ProgramTargetName(alpha3D) \
ProgramTargetName(anti) \
ProgramTargetName(antiindex) \
ProgramTargetName(antipindex) \
ProgramTargetName(antipoint) \
ProgramTargetName(antipoly) \
ProgramTargetName(bezcurve) \
ProgramTargetName(bezmesh) \
ProgramTargetName(bezsurf) \
ProgramTargetName(checker) \
ProgramTargetName(checker2) \
ProgramTargetName(chess) \
ProgramTargetName(clip) \
ProgramTargetName(colormat) \
ProgramTargetName(cone) \
ProgramTargetName(cube) \
ProgramTargetName(curve) \
ProgramTargetName(depthcue) \
ProgramTargetName(disk) \
ProgramTargetName(dof) \
ProgramTargetName(dofnot) \
ProgramTargetName(double) \
ProgramTargetName(drawf) \
ProgramTargetName(feedback) \
ProgramTargetName(fog) \
ProgramTargetName(fogindex) \
ProgramTargetName(font) \
ProgramTargetName(light) \
ProgramTargetName(linelist) \
ProgramTargetName(lines) \
ProgramTargetName(list) \
ProgramTargetName(list2) \
ProgramTargetName(maplight) \
ProgramTargetName(material) \
ProgramTargetName(mipmap) \
ProgramTargetName(model) \
ProgramTargetName(movelight) \
ProgramTargetName(nurbs) \
ProgramTargetName(pickdepth) \
ProgramTargetName(pickline) \
ProgramTargetName(picksquare) \
ProgramTargetName(plane) \
ProgramTargetName(planet) \
ProgramTargetName(planetup) \
ProgramTargetName(polys) \
ProgramTargetName(robot) \
ProgramTargetName(sccolorlight) \
ProgramTargetName(scene) \
ProgramTargetName(scenebamb) \
ProgramTargetName(sceneflat) \
ProgramTargetName(select) \
ProgramTargetName(simple) \
ProgramTargetName(smooth) \
ProgramTargetName(sphere) \
ProgramTargetName(stencil) \
ProgramTargetName(stroke) \
ProgramTargetName(surface) \
ProgramTargetName(tea) \
ProgramTargetName(teaambient) \
ProgramTargetName(teapots) \
ProgramTargetName(texgen) \
ProgramTargetName(texturesurf) \
ProgramTargetName(trim) \
ProgramTargetName(xfont)
AllTarget($(PROGRAMS))
NormalProgramTarget(accanti,accanti.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(accnot,accnot.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(accpersp,accpersp.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(accum,accum.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(aim,aim.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(alpha,alpha.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(alpha3D,alpha3D.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(anti,anti.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(antiindex,antiindex.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(antipindex,antipindex.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(antipoint,antipoint.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(antipoly,antipoly.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(bezcurve,bezcurve.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(bezmesh,bezmesh.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(bezsurf,bezsurf.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(checker,checker.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(checker2,checker2.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(chess,chess.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(clip,clip.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(colormat,colormat.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(cone,cone.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(cube,cube.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(curve,curve.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(depthcue,depthcue.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(disk,disk.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(dof,dof.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(dofnot,dofnot.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(double,double.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(drawf,drawf.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(feedback,feedback.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(fog,fog.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(fogindex,fogindex.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(font,font.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(light,light.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(linelist,linelist.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(lines,lines.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(list,list.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(list2,list2.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(maplight,maplight.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(material,material.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(mipmap,mipmap.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(model,model.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(movelight,movelight.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(nurbs,nurbs.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(pickdepth,pickdepth.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(pickline,pickline.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(picksquare,picksquare.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(plane,plane.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(planet,planet.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(planetup,planetup.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(polys,polys.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(robot,robot.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(sccolorlight,sccolorlight.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(scene,scene.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(scenebamb,scenebamb.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(sceneflat,sceneflat.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(select,select.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(simple,simple.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(smooth,smooth.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(sphere,sphere.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(stencil,stencil.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(stroke,stroke.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(surface,surface.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(tea,tea.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(teaambient,teaambient.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(teapots,teapots.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(texgen,texgen.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(texturesurf,texturesurf.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(trim,trim.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(xfont,xfont.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
DependTarget()

View file

@ -1,101 +0,0 @@
LOCAL_LIBRARIES = $(XLIB) $(TOP)\lib\glut.a $(TOP)\lib\Mesaglu.a $(TOP)\lib\MesaGL.a
INCLUDES = -I$(TOP)\include
SRCS = accum.c \
bitmap1.c \
bitmap2.c \
blendeq.c \
blendxor.c \
copy.c \
cursor.c \
depth.c \
eval.c \
fog.c \
font.c \
line.c \
logo.c \
nurb.c \
oglinfo.c \
olympic.c \
overlay.c \
point.c \
prim.c \
quad.c \
select.c \
shape.c \
speed.c \
sphere.c \
star.c \
stencil.c \
stretch.c \
texture.c \
tri.c \
wave.c
PROGRAMS = ProgramTargetName(accum) \
ProgramTargetName(bitmap1) \
ProgramTargetName(bitmap2) \
ProgramTargetName(blendeq) \
ProgramTargetName(blendxor) \
ProgramTargetName(copy) \
ProgramTargetName(cursor) \
ProgramTargetName(depth) \
ProgramTargetName(eval) \
ProgramTargetName(fog) \
ProgramTargetName(font) \
ProgramTargetName(line) \
ProgramTargetName(logo) \
ProgramTargetName(nurb) \
ProgramTargetName(oglinfo) \
ProgramTargetName(olympic) \
ProgramTargetName(overlay) \
ProgramTargetName(point) \
ProgramTargetName(prim) \
ProgramTargetName(quad) \
ProgramTargetName(select) \
ProgramTargetName(shape) \
ProgramTargetName(speed) \
ProgramTargetName(sphere) \
ProgramTargetName(star) \
ProgramTargetName(stencil) \
ProgramTargetName(stretch) \
ProgramTargetName(texture) \
ProgramTargetName(tri) \
ProgramTargetName(wave)
AllTarget($(PROGRAMS))
NormalProgramTarget(accum,accum.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(bitmap1,bitmap1.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(bitmap2,bitmap2.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(blendeq,blendeq.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(blendxor,blendxor.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(copy,copy.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(cursor,cursor.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(depth,depth.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(eval,eval.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(fog,fog.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(font,font.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(line,line.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(logo,logo.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(nurb,nurb.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(oglinfo,oglinfo.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(olympic,olympic.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(overlay,overlay.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(point,point.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(prim,prim.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(quad,quad.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(select,select.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(shape,shape.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(speed,speed.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(sphere,sphere.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(star,star.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(stencil,stencil.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(stretch,stretch.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(texture,texture.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(tri,tri.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
NormalProgramTarget(wave,wave.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
DependTarget()

View file

@ -23,6 +23,7 @@ SOURCES = \
arbvptest3.c \
arbvptorus.c \
arbvpwarpmesh.c \
arraytexture.c \
blendminmax.c \
blendsquare.c \
bufferobj.c \
@ -117,6 +118,12 @@ getprocaddress: getprocaddress.c getproclist.h
getproclist.h: $(TOP)/src/mesa/glapi/gl_API.xml getprocaddress.c getprocaddress.py
python getprocaddress.py > getproclist.h
arraytexture: arraytexture.o readtex.o
$(CC) $(CFLAGS) arraytexture.o readtex.o $(LIBS) -o $@
arraytexture.o: arraytexture.c readtex.h
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
afsmultiarb: afsmultiarb.o readtex.o
$(CC) $(CFLAGS) afsmultiarb.o readtex.o $(LIBS) -o $@

337
progs/tests/arraytexture.c Normal file
View file

@ -0,0 +1,337 @@
/*
* (C) Copyright IBM Corporation 2007
* 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
* on 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
* IBM 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.
*/
/**
* \file arraytexture.c
*
*
* \author Ian Romanick <idr@us.ibm.com>
*/
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <GL/glut.h>
#include <GL/glext.h>
#if !defined(GL_EXT_texture_array) && !defined(GL_MESA_texture_array)
# error "This demo requires enums for either GL_EXT_texture_array or GL_MESA_texture_array to build."
#endif
#include "readtex.h"
#define GL_CHECK_ERROR() \
do { \
GLenum err = glGetError(); \
if (err) { \
printf("%s:%u: %s (0x%04x)\n", __FILE__, __LINE__, \
gluErrorString(err), err); \
} \
} while (0)
static const char *const textures[] = {
"../images/girl.rgb",
"../images/girl2.rgb",
"../images/arch.rgb",
"../images/s128.rgb",
"../images/tree3.rgb",
"../images/bw.rgb",
"../images/reflect.rgb",
"../images/wrs_logo.rgb",
NULL
};
static const char frag_prog[] =
"!!ARBfp1.0\n"
"OPTION MESA_texture_array;\n"
"TEX result.color, fragment.texcoord[0], texture[0], ARRAY2D;\n"
"END\n";
static GLfloat Xrot = 0, Yrot = -30, Zrot = 0;
static GLfloat texZ = 0.0;
static GLfloat texZ_dir = 0.01;
static GLint num_layers;
static PFNGLBINDPROGRAMARBPROC bind_program;
static PFNGLPROGRAMSTRINGARBPROC program_string;
static PFNGLGENPROGRAMSARBPROC gen_programs;
static void
PrintString(const char *s)
{
while (*s) {
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
s++;
}
}
static void Idle(void)
{
static int lastTime = 0;
int t = glutGet(GLUT_ELAPSED_TIME);
if (lastTime == 0)
lastTime = t;
else if (t - lastTime < 10)
return;
lastTime = t;
texZ += texZ_dir;
if ((texZ < 0.0) || ((GLint) texZ > num_layers)) {
texZ_dir = -texZ_dir;
}
glutPostRedisplay();
}
static void Display(void)
{
char str[100];
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1, 1, -1, 1, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
(*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 0);
glColor3f(1,1,1);
glRasterPos3f(-0.9, -0.9, 0.0);
sprintf(str, "Texture Z coordinate = %4.1f", texZ);
PrintString(str);
(*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 1);
GL_CHECK_ERROR();
glEnable(GL_TEXTURE_2D_ARRAY_EXT);
GL_CHECK_ERROR();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -8.0);
glPushMatrix();
glRotatef(Xrot, 1, 0, 0);
glRotatef(Yrot, 0, 1, 0);
glRotatef(Zrot, 0, 0, 1);
glBegin(GL_QUADS);
glTexCoord3f(0.0, 0.0, texZ); glVertex2f(-1.0, -1.0);
glTexCoord3f(2.0, 0.0, texZ); glVertex2f(1.0, -1.0);
glTexCoord3f(2.0, 2.0, texZ); glVertex2f(1.0, 1.0);
glTexCoord3f(0.0, 2.0, texZ); glVertex2f(-1.0, 1.0);
glEnd();
glPopMatrix();
glDisable(GL_TEXTURE_2D_ARRAY_EXT);
GL_CHECK_ERROR();
(*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 0);
GL_CHECK_ERROR();
glutSwapBuffers();
}
static void Reshape(int width, int height)
{
glViewport(0, 0, width, height);
}
static void Key(unsigned char key, int x, int y)
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void SpecialKey(int key, int x, int y)
{
const GLfloat step = 3.0;
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
Xrot -= step;
break;
case GLUT_KEY_DOWN:
Xrot += step;
break;
case GLUT_KEY_LEFT:
Yrot -= step;
break;
case GLUT_KEY_RIGHT:
Yrot += step;
break;
}
glutPostRedisplay();
}
static int FindLine(const char *program, int position)
{
int i, line = 1;
for (i = 0; i < position; i++) {
if (program[i] == '\n')
line++;
}
return line;
}
static void
compile_fragment_program(GLuint id, const char *prog)
{
int errorPos;
int err;
err = glGetError();
(*bind_program)(GL_FRAGMENT_PROGRAM_ARB, id);
(*program_string)(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(prog), (const GLubyte *) prog);
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
err = glGetError();
if (err != GL_NO_ERROR || errorPos != -1) {
int l = FindLine(prog, errorPos);
printf("Fragment Program Error (err=%d, pos=%d line=%d): %s\n",
err, errorPos, l,
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
exit(0);
}
}
static void require_extension(const char *ext)
{
if (!glutExtensionSupported(ext)) {
printf("Sorry, %s not supported by this renderer.\n", ext);
exit(1);
}
}
static void Init(void)
{
const char *const ver_string = (const char *const) glGetString(GL_VERSION);
unsigned i;
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", ver_string);
require_extension("GL_ARB_fragment_program");
require_extension("GL_MESA_texture_array");
require_extension("GL_SGIS_generate_mipmap");
bind_program = glutGetProcAddress("glBindProgramARB");
program_string = glutGetProcAddress("glProgramStringARB");
gen_programs = glutGetProcAddress("glGenProgramsARB");
for (num_layers = 0; textures[num_layers] != NULL; num_layers++)
/* empty */ ;
glBindTexture(GL_TEXTURE_2D_ARRAY_EXT, 1);
glTexImage3D(GL_TEXTURE_2D_ARRAY_EXT, 0, GL_RGB8,
256, 256, num_layers, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
GL_CHECK_ERROR();
glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_GENERATE_MIPMAP_SGIS,
GL_TRUE);
for (i = 0; textures[i] != NULL; i++) {
GLint width, height;
GLenum format;
GLubyte *image = LoadRGBImage(textures[i], &width, &height, &format);
if (!image) {
printf("Error: could not load texture image %s\n", textures[i]);
exit(1);
}
/* resize to 256 x 256 */
if (width != 256 || height != 256) {
GLubyte *newImage = malloc(256 * 256 * 4);
gluScaleImage(format, width, height, GL_UNSIGNED_BYTE, image,
256, 256, GL_UNSIGNED_BYTE, newImage);
free(image);
image = newImage;
}
glTexSubImage3D(GL_TEXTURE_2D_ARRAY_EXT, 0,
0, 0, i, 256, 256, 1,
format, GL_UNSIGNED_BYTE, image);
free(image);
}
GL_CHECK_ERROR();
glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
GL_CHECK_ERROR();
glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
GL_CHECK_ERROR();
compile_fragment_program(1, frag_prog);
GL_CHECK_ERROR();
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition(0, 0);
glutInitWindowSize(350, 350);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow("Array texture test");
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);
glutDisplayFunc(Display);
glutIdleFunc(Idle);
Init();
glutMainLoop();
return 0;
}

View file

@ -11,6 +11,7 @@ static PFNGLCREATEPROGRAMPROC glCreateProgram_func = NULL;
static PFNGLCREATESHADERPROC glCreateShader_func = NULL;
static PFNGLDELETEPROGRAMPROC glDeleteProgram_func = NULL;
static PFNGLDELETESHADERPROC glDeleteShader_func = NULL;
static PFNGLGETACTIVEATTRIBPROC glGetActiveAttrib_func = NULL;
static PFNGLGETATTACHEDSHADERSPROC glGetAttachedShaders_func = NULL;
static PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation_func = NULL;
static PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog_func = NULL;
@ -78,6 +79,7 @@ GetExtensionFuncs(void)
glCreateShader_func = (PFNGLCREATESHADERPROC) glutGetProcAddress("glCreateShader");
glDeleteProgram_func = (PFNGLDELETEPROGRAMPROC) glutGetProcAddress("glDeleteProgram");
glDeleteShader_func = (PFNGLDELETESHADERPROC) glutGetProcAddress("glDeleteShader");
glGetActiveAttrib_func = (PFNGLGETACTIVEATTRIBPROC) glutGetProcAddress("glGetActiveAttrib");
glGetAttachedShaders_func = (PFNGLGETATTACHEDSHADERSPROC) glutGetProcAddress("glGetAttachedShaders");
glGetAttribLocation_func = (PFNGLGETATTRIBLOCATIONPROC) glutGetProcAddress("glGetAttribLocation");
glGetProgramInfoLog_func = (PFNGLGETPROGRAMINFOLOGPROC) glutGetProcAddress("glGetProgramInfoLog");

View file

@ -17,14 +17,14 @@ message:
subdirs:
@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir ; $(MAKE)) || exit 1 ; \
(cd $$dir && $(MAKE)) || exit 1; \
fi \
done
install:
@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir ; $(MAKE) install) || exit 1 ; \
(cd $$dir && $(MAKE) install) || exit 1 ; \
fi \
done
@ -35,6 +35,6 @@ $(TOP)/$(LIB_DIR):
clean:
@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir ; $(MAKE) clean) ; \
(cd $$dir && $(MAKE) clean) ; \
fi \
done

View file

@ -1,4 +1,4 @@
DESCRIPTION 'Mesa GLU (OpenGL work-alike) for Win32'
;DESCRIPTION 'Mesa GLU (OpenGL work-alike) for Win32'
VERSION 5.1
;
; Module definition file for GLU (GLU32.DLL)

View file

@ -349,12 +349,18 @@ getVisualInfoRGB(unsigned int mode)
__glutScreen, list);
}
#ifndef VisualIDMask
#define VisualIDMask 0
#endif
static XVisualInfo *
getVisualInfoID(int id)
{
XVisualInfo temp;
int count;
#if !defined(_WIN32)
temp.visualid = id;
#endif
return XGetVisualInfo(__glutDisplay, VisualIDMask, &temp, &count);
}

View file

@ -90,7 +90,7 @@ int APIENTRY glutCreateWindow (const char *title)
attr.event_mask = StructureNotifyMask | ExposureMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( dpy, root, 0, 0, g_width, g_height,
win = XCreateWindow( dpy, root, g_xpos, g_ypos, g_width, g_height,
0, visinfo->depth, InputOutput,
visinfo->visual, mask, &attr );
if (!win) {

View file

@ -1,5 +1,4 @@
# Build a subset DRI-based libGL.so library.
# Indirect rendering not supported, etc.
# Build the MiniGLX libGL.so library.
TOP = ../../..
include $(TOP)/configs/current
@ -29,7 +28,9 @@ INCLUDE_DIRS = \
-I$(TOP)/src/mesa/glapi \
-I$(TOP)/src/glx/x11 \
-I$(TOP)/src/mesa/drivers/dri/common \
`pkg-config --cflags libdrm`
$(LIBDRM_CFLAGS) \
$(PCIACCESS_CFLAGS)
##### RULES #####
@ -43,16 +44,20 @@ INCLUDE_DIRS = \
##### TARGETS #####
default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/miniglx.conf
# Make libGL
$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile
$(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \
@ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \
-major 1 -minor 2 $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR) $(GL_LIB_DEPS) $(OBJECTS) `/usr/bin/pkg-config --libs libdrm` `/usr/bin/pkg-config --libs pciaccess`
rm -f $(TOP)/$(LIB_DIR)/miniglx.conf
install example.miniglx.conf $(TOP)/$(LIB_DIR)/miniglx.conf
-install $(TOP)/$(LIB_DIR) $(GL_LIB_DEPS) $(OBJECTS) \
$(LIBDRM_LIB) $(PCIACCESS_LIB)
# install sample miniglx.conf
$(TOP)/$(LIB_DIR)/miniglx.conf:
$(INSTALL) example.miniglx.conf $(TOP)/$(LIB_DIR)/miniglx.conf
drmtest: xf86drm.o drmtest.o

View file

@ -1528,8 +1528,8 @@ XCreateWindow( Display *dpy, Window parent, int x, int y,
}
/* init other per-window fields */
win->x = 0;
win->y = 0;
win->x = x;
win->y = y;
win->w = width;
win->h = height;
win->visual = visual; /* ptr assignment */
@ -1537,7 +1537,7 @@ XCreateWindow( Display *dpy, Window parent, int x, int y,
win->bytesPerPixel = dpy->driverContext.cpp;
win->rowStride = dpy->driverContext.shared.virtualWidth * win->bytesPerPixel;
win->size = win->rowStride * height;
win->frontStart = dpy->driverContext.FBAddress;
win->frontStart = dpy->driverContext.FBAddress + (win->rowStride * win->x) + (win->y * win->bytesPerPixel);
win->frontBottom = (GLubyte *) win->frontStart + (height-1) * win->rowStride;
/* This is incorrect: the hardware driver could put the backbuffer

View file

@ -40,18 +40,6 @@
#include "glcontextmodes.h"
#include "glheader.h"
static void ChangeDrawableAttribute( Display * dpy, GLXDrawable drawable,
const CARD32 * attribs, size_t num_attribs );
static void DestroyPbuffer( Display * dpy, GLXDrawable drawable );
static GLXDrawable CreatePbuffer( Display *dpy,
const __GLcontextModes * fbconfig, unsigned int width, unsigned int height,
const int *attrib_list, GLboolean size_in_attribs );
static int GetDrawableAttribute( Display *dpy, GLXDrawable drawable,
int attribute, unsigned int *value );
/**
* Change a drawable's attribute.
@ -150,7 +138,7 @@ DestroyPbuffer( Display * dpy, GLXDrawable drawable )
if ( (priv->majorVersion > 1) || (priv->minorVersion >= 3) ) {
xGLXDestroyPbufferReq * req;
GetReqExtra( GLXDestroyPbuffer, 4, req );
GetReq( GLXDestroyPbuffer, req );
req->reqType = opcode;
req->glxCode = X_GLXDestroyPbuffer;
req->pbuffer = (GLXPbuffer) drawable;

View file

@ -1667,7 +1667,7 @@ __glXGetArrayType( const __GLXattribute * const state,
key, index );
if ( a != NULL ) {
*dest = (GLintptr) a->enabled;
*dest = (GLintptr) a->data_type;
}
return (a != NULL);

View file

@ -89,9 +89,7 @@ fbdev: $(CORE_OBJECTS) $(FBDEV_DRIVER_OBJECTS) $(COMMON_DRIVER_OBJECTS)
# Stand-alone Mesa libGL and libOSMesa
STAND_ALONE_DRIVER_SOURCES = \
$(COMMON_DRIVER_SOURCES) \
$(X11_DRIVER_SOURCES) \
$(GLIDE_DRIVER_SOURCES) \
$(SVGA_DRIVER_SOURCES)
$(X11_DRIVER_SOURCES)
STAND_ALONE_DRIVER_OBJECTS = $(STAND_ALONE_DRIVER_SOURCES:.c=.o)

View file

@ -28,9 +28,9 @@
#include "buffers.h"
#include "context.h"
#include "framebuffer.h"
#include "occlude.h"
#include "program.h"
#include "prog_execute.h"
#include "queryobj.h"
#include "renderbuffer.h"
#include "texcompress.h"
#include "texformat.h"

View file

@ -14,21 +14,25 @@ $(TOP)/$(LIB_DIR):
subdirs:
echo $(DRI_DIRS)
@for dir in $(DRI_DIRS) ; do \
echo $$dir ; \
(cd $$dir && $(MAKE)) || exit 1; \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE)) || exit 1 ; \
fi \
done
install:
@for dir in $(DRI_DIRS) ; do \
(cd $$dir && $(MAKE) install) || exit 1; \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE) install) || exit 1 ; \
fi \
done
clean:
@for dir in $(DRI_DIRS) ; do \
(cd $$dir && $(MAKE) clean) ; \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE) clean ; \
fi \
done
-rm -f common/*.o

View file

@ -26,11 +26,13 @@ OBJECTS = $(C_SOURCES:.c=.o) \
$(ASM_SOURCES:.S=.o)
else
# miniglx
WINOBJ=
WINLIB=-L$(MESA)/src/glx/mini
MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
INCLUDES = $(MINIGLX_INCLUDES) \
$(SHARED_INCLUDES)
$(SHARED_INCLUDES) \
$(PCIACCESS_CFLAGS)
OBJECTS = $(C_SOURCES:.c=.o) \
$(MINIGLX_SOURCES:.c=.o) \
@ -55,7 +57,8 @@ SHARED_INCLUDES = \
-I$(TOP)/src/mesa/swrast_setup \
-I$(TOP)/src/egl/main \
-I$(TOP)/src/egl/drivers/dri \
`pkg-config --cflags libdrm`
$(LIBDRM_CFLAGS)
##### RULES #####
@ -71,11 +74,6 @@ SHARED_INCLUDES = \
default: depend symlinks $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME)
#$(TOP)/$(LIB_DIR)/$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile
# @echo BUILDING FOR: $(WINDOW_SYSTEM)
# $(TOP)/bin/mklib -o $(LIBNAME) -noprefix -install $(TOP)/$(LIB_DIR) \
# $(WINLIB) $(LIB_DEPS) $(WINOBJ) $(MESA_MODULES) $(OBJECTS)
$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template
$(TOP)/bin/mklib -noprefix -o $@ \
$(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS)
@ -85,9 +83,6 @@ $(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME)
$(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR)
# Run 'make depend' to update the dependencies if you change
# what's included by any source file.
depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
touch depend
$(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) \
@ -104,8 +99,10 @@ clean:
-rm -f *.o */*.o *~ *.so *~ server/*.o $(SYMLINKS)
-rm -f depend depend.bak
install: $(LIBNAME)
$(INSTALL) -d $(DRI_DRIVER_INSTALL_DIR)
$(INSTALL) -m 755 $(LIBNAME) $(DRI_DRIVER_INSTALL_DIR)
include depend

View file

@ -121,7 +121,6 @@ dri_bo_subdata(dri_bo *bo, unsigned long offset,
dri_bo_unmap(bo);
}
void
dri_bo_get_subdata(dri_bo *bo, unsigned long offset,
unsigned long size, void *data)

View file

@ -440,6 +440,13 @@ static const char Color4ubVertex3fvSUN_names[] =
"";
#endif
#if defined(need_GL_EXT_texture_array)
static const char FramebufferTextureLayerEXT_names[] =
"iiiii\0" /* Parameter signature */
"glFramebufferTextureLayerEXT\0"
"";
#endif
#if defined(need_GL_SGIX_list_priority)
static const char GetListParameterivSGIX_names[] =
"iip\0" /* Parameter signature */
@ -5479,6 +5486,13 @@ static const struct dri_extension_function GL_EXT_texture3D_functions[] = {
};
#endif
#if defined(need_GL_EXT_texture_array)
static const struct dri_extension_function GL_EXT_texture_array_functions[] = {
{ FramebufferTextureLayerEXT_names, FramebufferTextureLayerEXT_remap_index, -1 },
{ NULL, 0, 0 }
};
#endif
#if defined(need_GL_EXT_texture_object)
static const struct dri_extension_function GL_EXT_texture_object_functions[] = {
{ PrioritizeTextures_names, -1, 331 },

View file

@ -541,17 +541,19 @@ void i915_update_fog( GLcontext *ctx )
else {
enabled = ctx->Fog.Enabled;
mode = ctx->Fog.Mode;
try_pixel_fog = (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT &&
ctx->Hint.Fog == GL_NICEST &&
0); /* XXX - DISABLE -- Need ortho fallback */
#if 0
/* XXX - DISABLED -- Need ortho fallback */
try_pixel_fog = (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT
&&ctx->Hint.Fog == GL_NICEST);
#else
try_pixel_fog = 0;
#endif
}
if (!enabled) {
i915->vertex_fog = I915_FOG_NONE;
}
else if (try_pixel_fog) {
I915_STATECHANGE(i915, I915_UPLOAD_FOG);
i915->state.Fog[I915_FOGREG_MODE1] &= ~FMC1_FOGFUNC_MASK;
i915->vertex_fog = I915_FOG_PIXEL;
@ -567,8 +569,8 @@ void i915_update_fog( GLcontext *ctx )
i915->vertex_fog = I915_FOG_VERTEX;
}
else {
GLfloat c1 = ctx->Fog.End/(ctx->Fog.End-ctx->Fog.Start);
GLfloat c2 = 1.0/(ctx->Fog.End-ctx->Fog.Start);
GLfloat c2 = 1.0 / (ctx->Fog.End - ctx->Fog.Start);
GLfloat c1 = ctx->Fog.End * c2;
i915->state.Fog[I915_FOGREG_MODE1] &= ~FMC1_C1_MASK;
i915->state.Fog[I915_FOGREG_MODE1] |= FMC1_FOGFUNC_PIXEL_LINEAR;
@ -576,10 +578,11 @@ void i915_update_fog( GLcontext *ctx )
((GLuint)(c1 * FMC1_C1_ONE)) & FMC1_C1_MASK;
if (i915->state.Fog[I915_FOGREG_MODE1] & FMC1_FOGINDEX_Z) {
i915->state.Fog[I915_FOGREG_MODE2] = (GLuint)(c2 * FMC2_C2_ONE);
i915->state.Fog[I915_FOGREG_MODE2]
= (GLuint)(c2 * FMC2_C2_ONE);
}
else {
union { float f; int i; } fi;
fi_type fi;
fi.f = c2;
i915->state.Fog[I915_FOGREG_MODE2] = fi.i;
}
@ -602,24 +605,22 @@ void i915_update_fog( GLcontext *ctx )
i915->vertex_fog = I915_FOG_VERTEX;
}
{
I915_STATECHANGE(i915, I915_UPLOAD_CTX);
I915_ACTIVESTATE(i915, I915_UPLOAD_FOG, enabled);
if (enabled)
i915->state.Ctx[I915_CTXREG_LIS5] |= S5_FOG_ENABLE;
else
i915->state.Ctx[I915_CTXREG_LIS5] &= ~S5_FOG_ENABLE;
}
I915_STATECHANGE(i915, I915_UPLOAD_CTX);
I915_ACTIVESTATE(i915, I915_UPLOAD_FOG, enabled);
if (enabled)
i915->state.Ctx[I915_CTXREG_LIS5] |= S5_FOG_ENABLE;
else
i915->state.Ctx[I915_CTXREG_LIS5] &= ~S5_FOG_ENABLE;
/* always enbale pixel fog
* vertex fog use precaculted fog coord will conflict with appended
* fog program
/* Always enable pixel fog. Vertex fog using fog coord will conflict
* with fog code appended onto fragment program.
*/
_tnl_allow_vertex_fog( ctx, 0 );
_tnl_allow_pixel_fog( ctx, 1 );
}
static void i915Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
static void
i915Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
{
i915ContextPtr i915 = I915_CONTEXT(ctx);
@ -634,8 +635,8 @@ static void i915Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
I915_STATECHANGE(i915, I915_UPLOAD_FOG);
if (i915->state.Fog[I915_FOGREG_MODE1] & FMC1_FOGINDEX_Z) {
i915->state.Fog[I915_FOGREG_MODE3] = (GLuint)(ctx->Fog.Density *
FMC3_D_ONE);
i915->state.Fog[I915_FOGREG_MODE3]
= (GLuint)(ctx->Fog.Density * FMC3_D_ONE);
}
else {
union { float f; int i; } fi;

View file

@ -196,7 +196,6 @@ static const struct tnl_pipeline_stage *intel_pipeline[] = {
&_tnl_texgen_stage,
&_tnl_texture_transform_stage,
&_tnl_point_attenuation_stage,
&_tnl_arb_vertex_program_stage,
&_tnl_vertex_program_stage,
#if 1
&_intel_render_stage, /* ADD: unclipped rastersetup-to-dma */

View file

@ -455,12 +455,14 @@ static unsigned long AllocFromAGP(const DRIDriverContext *ctx, I830Rec *pI830, l
}
unsigned long
I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *result, I830MemPool *pool, long size, unsigned long alignment, int flags)
I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830,
I830MemRange *result, I830MemPool *pool, long size,
unsigned long alignment, int flags)
{
int ret;
unsigned long ret;
if (!result)
return 0;
if (!result)
return 0;
/* Make sure these are initialised. */
result->Size = 0;
@ -470,16 +472,15 @@ I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *resul
return 0;
}
if (pool->Free.Size < size)
return AllocFromAGP(ctx, pI830, size, alignment, result);
else
{
ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags);
if (ret==0)
return AllocFromAGP(ctx, pI830, size, alignment, result);
return ret;
if (pool->Free.Size < size) {
ret = AllocFromAGP(ctx, pI830, size, alignment, result);
}
else {
ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags);
if (ret == 0)
ret = AllocFromAGP(ctx, pI830, size, alignment, result);
}
return ret;
}
static Bool BindAgpRange(const DRIDriverContext *ctx, I830MemRange *mem)

View file

@ -563,7 +563,6 @@ i915_update_fog(GLcontext * ctx)
if (ctx->FragmentProgram._Active) {
/* Pull in static fog state from program */
mode = ctx->FragmentProgram._Current->FogOption;
enabled = (mode != GL_NONE);
try_pixel_fog = 0;
@ -571,15 +570,19 @@ i915_update_fog(GLcontext * ctx)
else {
enabled = ctx->Fog.Enabled;
mode = ctx->Fog.Mode;
try_pixel_fog = (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT && ctx->Hint.Fog == GL_NICEST && 0); /* XXX - DISABLE -- Need ortho fallback */
#if 0
/* XXX - DISABLED -- Need ortho fallback */
try_pixel_fog = (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT
&& ctx->Hint.Fog == GL_NICEST);
#else
try_pixel_fog = 0;
#endif
}
if (!enabled) {
i915->vertex_fog = I915_FOG_NONE;
}
else if (try_pixel_fog) {
I915_STATECHANGE(i915, I915_UPLOAD_FOG);
i915->state.Fog[I915_FOGREG_MODE1] &= ~FMC1_FOGFUNC_MASK;
i915->vertex_fog = I915_FOG_PIXEL;
@ -591,12 +594,13 @@ i915_update_fog(GLcontext * ctx)
* either fallback or append fog instructions to end of
* program in the case of linear fog.
*/
printf("vertex fog!\n");
i915->state.Fog[I915_FOGREG_MODE1] |= FMC1_FOGFUNC_VERTEX;
i915->vertex_fog = I915_FOG_VERTEX;
}
else {
GLfloat c1 = ctx->Fog.End / (ctx->Fog.End - ctx->Fog.Start);
GLfloat c2 = 1.0 / (ctx->Fog.End - ctx->Fog.Start);
GLfloat c1 = ctx->Fog.End * c2;
i915->state.Fog[I915_FOGREG_MODE1] &= ~FMC1_C1_MASK;
i915->state.Fog[I915_FOGREG_MODE1] |= FMC1_FOGFUNC_PIXEL_LINEAR;
@ -604,15 +608,11 @@ i915_update_fog(GLcontext * ctx)
((GLuint) (c1 * FMC1_C1_ONE)) & FMC1_C1_MASK;
if (i915->state.Fog[I915_FOGREG_MODE1] & FMC1_FOGINDEX_Z) {
i915->state.Fog[I915_FOGREG_MODE2] =
(GLuint) (c2 * FMC2_C2_ONE);
i915->state.Fog[I915_FOGREG_MODE2]
= (GLuint) (c2 * FMC2_C2_ONE);
}
else {
union
{
float f;
int i;
} fi;
fi_type fi;
fi.f = c2;
i915->state.Fog[I915_FOGREG_MODE2] = fi.i;
}
@ -628,26 +628,22 @@ i915_update_fog(GLcontext * ctx)
break;
}
}
else { /* if (i915->vertex_fog != I915_FOG_VERTEX) */
else { /* if (i915->vertex_fog != I915_FOG_VERTEX) */
I915_STATECHANGE(i915, I915_UPLOAD_FOG);
i915->state.Fog[I915_FOGREG_MODE1] &= ~FMC1_FOGFUNC_MASK;
i915->state.Fog[I915_FOGREG_MODE1] |= FMC1_FOGFUNC_VERTEX;
i915->vertex_fog = I915_FOG_VERTEX;
}
{
I915_STATECHANGE(i915, I915_UPLOAD_CTX);
I915_ACTIVESTATE(i915, I915_UPLOAD_FOG, enabled);
if (enabled)
i915->state.Ctx[I915_CTXREG_LIS5] |= S5_FOG_ENABLE;
else
i915->state.Ctx[I915_CTXREG_LIS5] &= ~S5_FOG_ENABLE;
}
I915_STATECHANGE(i915, I915_UPLOAD_CTX);
I915_ACTIVESTATE(i915, I915_UPLOAD_FOG, enabled);
if (enabled)
i915->state.Ctx[I915_CTXREG_LIS5] |= S5_FOG_ENABLE;
else
i915->state.Ctx[I915_CTXREG_LIS5] &= ~S5_FOG_ENABLE;
/* always enbale pixel fog
* vertex fog use precaculted fog coord will conflict with appended
* fog program
/* Always enable pixel fog. Vertex fog using fog coord will conflict
* with fog code appended onto fragment program.
*/
_tnl_allow_vertex_fog( ctx, 0 );
_tnl_allow_pixel_fog( ctx, 1 );
@ -669,15 +665,11 @@ i915Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param)
I915_STATECHANGE(i915, I915_UPLOAD_FOG);
if (i915->state.Fog[I915_FOGREG_MODE1] & FMC1_FOGINDEX_Z) {
i915->state.Fog[I915_FOGREG_MODE3] = (GLuint) (ctx->Fog.Density *
FMC3_D_ONE);
i915->state.Fog[I915_FOGREG_MODE3] =
(GLuint) (ctx->Fog.Density * FMC3_D_ONE);
}
else {
union
{
float f;
int i;
} fi;
fi_type fi;
fi.f = ctx->Fog.Density;
i915->state.Fog[I915_FOGREG_MODE3] = fi.i;
}

View file

@ -0,0 +1,418 @@
/**************************************************************************
*
* Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA
* 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 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
* THE COPYRIGHT HOLDERS, AUTHORS 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.
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
*
**************************************************************************/
/*
* Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com>
*/
#include <xf86drm.h>
#include <stdlib.h>
#include <errno.h>
#include "imports.h"
#include "glthread.h"
#include "dri_bufpool.h"
#include "dri_bufmgr.h"
#include "intel_screen.h"
typedef struct
{
drmMMListHead head;
struct _BPool *parent;
struct _DriFenceObject *fence;
unsigned long start;
int unfenced;
int mapped;
} BBuf;
typedef struct _BPool
{
_glthread_Mutex mutex;
unsigned long bufSize;
unsigned poolSize;
unsigned numFree;
unsigned numTot;
unsigned numDelayed;
unsigned checkDelayed;
drmMMListHead free;
drmMMListHead delayed;
drmMMListHead head;
drmBO kernelBO;
void *virtual;
BBuf *bufs;
} BPool;
static BPool *
createBPool(int fd, unsigned long bufSize, unsigned numBufs, unsigned flags,
unsigned checkDelayed)
{
BPool *p = (BPool *) malloc(sizeof(*p));
BBuf *buf;
int i;
if (!p)
return NULL;
p->bufs = (BBuf *) malloc(numBufs * sizeof(*p->bufs));
if (!p->bufs) {
free(p);
return NULL;
}
DRMINITLISTHEAD(&p->free);
DRMINITLISTHEAD(&p->head);
DRMINITLISTHEAD(&p->delayed);
p->numTot = numBufs;
p->numFree = numBufs;
p->bufSize = bufSize;
p->numDelayed = 0;
p->checkDelayed = checkDelayed;
_glthread_INIT_MUTEX(p->mutex);
if (drmBOCreate(fd, 0, numBufs * bufSize, 0, NULL, drm_bo_type_dc,
flags, DRM_BO_HINT_DONT_FENCE, &p->kernelBO)) {
free(p->bufs);
free(p);
return NULL;
}
if (drmBOMap(fd, &p->kernelBO, DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0,
&p->virtual)) {
drmBODestroy(fd, &p->kernelBO);
free(p->bufs);
free(p);
return NULL;
}
/*
* We unmap the buffer so that we can validate it later. Note that this is
* just a synchronizing operation. The buffer will have a virtual mapping
* until it is destroyed.
*/
drmBOUnmap(fd, &p->kernelBO);
buf = p->bufs;
for (i = 0; i < numBufs; ++i) {
buf->parent = p;
buf->fence = NULL;
buf->start = i * bufSize;
buf->mapped = 0;
buf->unfenced = 0;
DRMLISTADDTAIL(&buf->head, &p->free);
buf++;
}
return p;
}
static void
pool_checkFree(BPool * p, int wait)
{
drmMMListHead *list, *prev;
BBuf *buf;
int signaled = 0;
int i;
list = p->delayed.next;
if (p->numDelayed > 3) {
for (i = 0; i < p->numDelayed; i += 3) {
list = list->next;
}
}
prev = list->prev;
for (; list != &p->delayed; list = prev, prev = list->prev) {
buf = DRMLISTENTRY(BBuf, list, head);
if (!signaled) {
if (wait) {
driFenceFinish(buf->fence, DRM_FENCE_TYPE_EXE, 1);
signaled = 1;
}
else {
signaled = driFenceSignaled(buf->fence, DRM_FENCE_TYPE_EXE);
}
}
if (!signaled)
break;
driFenceUnReference(buf->fence);
buf->fence = NULL;
DRMLISTDEL(list);
p->numDelayed--;
DRMLISTADD(list, &p->free);
p->numFree++;
}
}
static void *
pool_create(struct _DriBufferPool *pool,
unsigned long size, unsigned flags, unsigned hint,
unsigned alignment)
{
BPool *p = (BPool *) pool->data;
drmMMListHead *item;
if (alignment && (alignment != 4096))
return NULL;
_glthread_LOCK_MUTEX(p->mutex);
if (p->numFree == 0)
pool_checkFree(p, GL_TRUE);
if (p->numFree == 0) {
fprintf(stderr, "Out of fixed size buffer objects\n");
BM_CKFATAL(-ENOMEM);
}
item = p->free.next;
if (item == &p->free) {
fprintf(stderr, "Fixed size buffer pool corruption\n");
}
DRMLISTDEL(item);
--p->numFree;
_glthread_UNLOCK_MUTEX(p->mutex);
return (void *) DRMLISTENTRY(BBuf, item, head);
}
static int
pool_destroy(struct _DriBufferPool *pool, void *private)
{
BBuf *buf = (BBuf *) private;
BPool *p = buf->parent;
_glthread_LOCK_MUTEX(p->mutex);
if (buf->fence) {
DRMLISTADDTAIL(&buf->head, &p->delayed);
p->numDelayed++;
}
else {
buf->unfenced = 0;
DRMLISTADD(&buf->head, &p->free);
p->numFree++;
}
if ((p->numDelayed % p->checkDelayed) == 0)
pool_checkFree(p, 0);
_glthread_UNLOCK_MUTEX(p->mutex);
return 0;
}
static int
pool_map(struct _DriBufferPool *pool, void *private, unsigned flags,
int hint, void **virtual)
{
BBuf *buf = (BBuf *) private;
BPool *p = buf->parent;
_glthread_LOCK_MUTEX(p->mutex);
/*
* Currently Mesa doesn't have any condition variables to resolve this
* cleanly in a multithreading environment.
* We bail out instead.
*/
if (buf->mapped) {
fprintf(stderr, "Trying to map already mapped buffer object\n");
BM_CKFATAL(-EINVAL);
}
#if 0
if (buf->unfenced && !(hint & DRM_BO_HINT_ALLOW_UNFENCED_MAP)) {
fprintf(stderr, "Trying to map an unfenced buffer object 0x%08x"
" 0x%08x %d\n", hint, flags, buf->start);
BM_CKFATAL(-EINVAL);
}
#endif
if (buf->fence) {
_glthread_UNLOCK_MUTEX(p->mutex);
return -EBUSY;
}
buf->mapped = GL_TRUE;
*virtual = (unsigned char *) p->virtual + buf->start;
_glthread_UNLOCK_MUTEX(p->mutex);
return 0;
}
static int
pool_waitIdle(struct _DriBufferPool *pool, void *private, int lazy)
{
BBuf *buf = (BBuf *) private;
driFenceFinish(buf->fence, 0, lazy);
return 0;
}
static int
pool_unmap(struct _DriBufferPool *pool, void *private)
{
BBuf *buf = (BBuf *) private;
buf->mapped = 0;
return 0;
}
static unsigned long
pool_offset(struct _DriBufferPool *pool, void *private)
{
BBuf *buf = (BBuf *) private;
BPool *p = buf->parent;
return p->kernelBO.offset + buf->start;
}
static unsigned
pool_flags(struct _DriBufferPool *pool, void *private)
{
BPool *p = (BPool *) pool->data;
return p->kernelBO.flags;
}
static unsigned long
pool_size(struct _DriBufferPool *pool, void *private)
{
BPool *p = (BPool *) pool->data;
return p->bufSize;
}
static int
pool_fence(struct _DriBufferPool *pool, void *private,
struct _DriFenceObject *fence)
{
BBuf *buf = (BBuf *) private;
BPool *p = buf->parent;
_glthread_LOCK_MUTEX(p->mutex);
if (buf->fence) {
driFenceUnReference(buf->fence);
}
buf->fence = fence;
buf->unfenced = 0;
driFenceReference(buf->fence);
_glthread_UNLOCK_MUTEX(p->mutex);
return 0;
}
static drmBO *
pool_kernel(struct _DriBufferPool *pool, void *private)
{
BBuf *buf = (BBuf *) private;
BPool *p = buf->parent;
return &p->kernelBO;
}
static int
pool_validate(struct _DriBufferPool *pool, void *private)
{
BBuf *buf = (BBuf *) private;
BPool *p = buf->parent;
_glthread_LOCK_MUTEX(p->mutex);
buf->unfenced = GL_TRUE;
_glthread_UNLOCK_MUTEX(p->mutex);
return 0;
}
static void
pool_takedown(struct _DriBufferPool *pool)
{
BPool *p = (BPool *) pool->data;
/*
* Wait on outstanding fences.
*/
_glthread_LOCK_MUTEX(p->mutex);
while ((p->numFree < p->numTot) && p->numDelayed) {
_glthread_UNLOCK_MUTEX(p->mutex);
sched_yield();
pool_checkFree(p, GL_TRUE);
_glthread_LOCK_MUTEX(p->mutex);
}
drmBODestroy(pool->fd, &p->kernelBO);
free(p->bufs);
_glthread_UNLOCK_MUTEX(p->mutex);
free(p);
free(pool);
}
struct _DriBufferPool *
driBatchPoolInit(int fd, unsigned flags,
unsigned long bufSize,
unsigned numBufs, unsigned checkDelayed)
{
struct _DriBufferPool *pool;
pool = (struct _DriBufferPool *) malloc(sizeof(*pool));
if (!pool)
return NULL;
pool->data = createBPool(fd, bufSize, numBufs, flags, checkDelayed);
if (!pool->data)
return NULL;
pool->fd = fd;
pool->map = &pool_map;
pool->unmap = &pool_unmap;
pool->destroy = &pool_destroy;
pool->offset = &pool_offset;
pool->flags = &pool_flags;
pool->size = &pool_size;
pool->create = &pool_create;
pool->fence = &pool_fence;
pool->kernel = &pool_kernel;
pool->validate = &pool_validate;
pool->waitIdle = &pool_waitIdle;
pool->setstatic = NULL;
pool->takeDown = &pool_takedown;
return pool;
}

View file

@ -209,7 +209,6 @@ static const struct tnl_pipeline_stage *intel_pipeline[] = {
&_tnl_texgen_stage,
&_tnl_texture_transform_stage,
&_tnl_point_attenuation_stage,
&_tnl_arb_vertex_program_stage,
&_tnl_vertex_program_stage,
#if 1
&_intel_render_stage, /* ADD: unclipped rastersetup-to-dma */

View file

@ -520,7 +520,7 @@ intel_framebuffer_renderbuffer(GLcontext * ctx,
/**
* When glFramebufferTexture[123]D is called this function sets up the
* gl_renderbuffer wrapp around the texture image.
* gl_renderbuffer wrapper around the texture image.
* This will have the region info needed for hardware rendering.
*/
static struct intel_renderbuffer *
@ -606,7 +606,7 @@ intel_render_texture(GLcontext * ctx,
irb = intel_wrap_texture(ctx, newImage);
if (irb) {
/* bind the wrapper to the attachment point */
att->Renderbuffer = &irb->Base;
_mesa_reference_renderbuffer(&att->Renderbuffer, &irb->Base);
}
else {
/* fallback to software rendering */

View file

@ -894,6 +894,7 @@ __driCreateNewScreen_20050727(__DRInativeDisplay * dpy, int scrn,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &intelAPI);
if (psp != NULL) {
I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv;
*driver_modes = intelFillInModes(dri_priv->cpp * 8,

View file

@ -483,12 +483,14 @@ static unsigned long AllocFromAGP(const DRIDriverContext *ctx, I830Rec *pI830, l
}
unsigned long
I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *result, I830MemPool *pool, long size, unsigned long alignment, int flags)
I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830,
I830MemRange *result, I830MemPool *pool, long size,
unsigned long alignment, int flags)
{
int ret;
unsigned long ret;
if (!result)
return 0;
if (!result)
return 0;
/* Make sure these are initialised. */
result->Size = 0;
@ -498,16 +500,15 @@ I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *resul
return 0;
}
if (pool->Free.Size < size)
return AllocFromAGP(ctx, pI830, size, alignment, result);
else
{
ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags);
if (ret==0)
return AllocFromAGP(ctx, pI830, size, alignment, result);
return ret;
if (pool->Free.Size < size) {
ret = AllocFromAGP(ctx, pI830, size, alignment, result);
}
else {
ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags);
if (ret == 0)
ret = AllocFromAGP(ctx, pI830, size, alignment, result);
}
return ret;
}
static Bool BindAgpRange(const DRIDriverContext *ctx, I830MemRange *mem)
@ -895,31 +896,6 @@ I830DRIUnmapScreenRegions(const DRIDriverContext *ctx, I830Rec *pI830, drmI830Sa
}
}
#if 0
static void
I830InitTextureHeap(const DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
{
/* Start up the simple memory manager for agp space */
drmI830MemInitHeap drmHeap;
drmHeap.region = I830_MEM_REGION_AGP;
drmHeap.start = 0;
drmHeap.size = sarea->tex_size;
if (drmCommandWrite(ctx->drmFD, DRM_I830_INIT_HEAP,
&drmHeap, sizeof(drmHeap))) {
fprintf(stderr,
"[drm] Failed to initialized agp heap manager\n");
} else {
fprintf(stderr,
"[drm] Initialized kernel agp heap manager, %d\n",
sarea->tex_size);
I830SetParam(ctx, I830_SETPARAM_TEX_LRU_LOG_GRANULARITY,
sarea->log_tex_granularity);
}
}
#endif
static Bool
I830DRIDoMappings(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
{
@ -943,9 +919,6 @@ I830DRIDoMappings(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
I830DRIMapScreenRegions(ctx, pI830, sarea);
SetupDRIMM(ctx, pI830);
#if 0
I830InitTextureHeap(ctx, pI830, sarea);
#endif
if (ctx->pciDevice != PCI_CHIP_845_G &&
ctx->pciDevice != PCI_CHIP_I830_M) {
I830SetParam(ctx, I830_SETPARAM_USE_MI_BATCHBUFFER_START, 1 );

View file

@ -34,6 +34,7 @@
#include "brw_state.h"
#include "brw_defines.h"
#include "brw_util.h"
#include "macros.h"
#include "enums.h"
static void upload_cc_vp( struct brw_context *brw )

View file

@ -46,7 +46,7 @@
#include "tnl/tnl.h"
#include "vbo/vbo_context.h"
#include "swrast/swrast.h"

View file

@ -81,7 +81,7 @@ void TAG(translate_vertex)(GLcontext *ctx,
dst->specular[2] = ((GLubyte *)p)[0];
dst->specular[1] = ((GLubyte *)p)[1];
dst->specular[0] = ((GLubyte *)p)[2];
dst->fog = ((GLubyte *)p)[3];
dst->attrib[FRAG_ATTRIB_FOGC][0] = ((GLubyte *)p)[3];
p++;
case TINY_VERTEX_FORMAT:

View file

@ -372,7 +372,6 @@ static const struct tnl_pipeline_stage *mga_pipeline[] = {
&_tnl_fog_coordinate_stage,
&_tnl_texgen_stage,
&_tnl_texture_transform_stage,
&_tnl_arb_vertex_program_stage,
&_tnl_vertex_program_stage,
/* REMOVE: point attenuation stage */

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_cmdbuf.c,v 1.1 2002/10/30 12:51:51 alanh Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_context.c,v 1.3 2003/05/06 23:52:08 daenzer Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
@ -192,7 +191,6 @@ static const struct tnl_pipeline_stage *r200_pipeline[] = {
&_tnl_texgen_stage,
&_tnl_texture_transform_stage,
&_tnl_point_attenuation_stage,
&_tnl_arb_vertex_program_stage,
&_tnl_vertex_program_stage,
/* Try again to go to tcl?
* - no good for asymmetric-twoside (do with multipass)
@ -680,7 +678,6 @@ r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
newCtx->dri.drawable = driDrawPriv;
r200SetCliprects(newCtx);
r200UpdateWindow( newCtx->glCtx );
r200UpdateViewportOffset( newCtx->glCtx );
}

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_context.h,v 1.2 2002/12/16 16:18:54 dawes Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_ioctl.c,v 1.4 2002/12/17 00:32:56 dawes Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_ioctl.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_lock.c,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_lock.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos_arrays.c,v 1.3 2003/02/23 23:59:01 dawes Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_pixel.c,v 1.2 2002/12/16 16:18:54 dawes Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_pixel.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_reg.h,v 1.2 2002/12/16 16:18:54 dawes Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_sanity.c,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
/**************************************************************************
Copyright 2002 ATI Technologies Inc., Ontario, Canada, and

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_span.c,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_span.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86$ */
/**************************************************************************
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_state.h,v 1.2 2002/11/05 17:46:08 tsi Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_state_init.c,v 1.4 2003/02/22 06:21:11 dawes Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c,v 1.5 2003/05/06 23:52:08 daenzer Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_swtcl.h,v 1.3 2003/05/06 23:52:08 daenzer Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tcl.c,v 1.2 2002/12/16 16:18:55 dawes Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tcl.h,v 1.2 2002/12/16 16:18:55 dawes Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tex.c,v 1.2 2002/11/05 17:46:08 tsi Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
@ -182,7 +181,7 @@ static void r200SetTexMaxAnisotropy( r200TexObjPtr t, GLfloat max )
{
t->pp_txfilter &= ~R200_MAX_ANISO_MASK;
if ( max == 1.0 ) {
if ( max <= 1.0 ) {
t->pp_txfilter |= R200_MAX_ANISO_1_TO_1;
} else if ( max <= 2.0 ) {
t->pp_txfilter |= R200_MAX_ANISO_2_TO_1;
@ -483,7 +482,7 @@ r200ValidateClientStorage( GLcontext *ctx, GLenum target,
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
if (0)
if ( R200_DEBUG & DEBUG_TEXTURE )
fprintf(stderr, "intformat %s format %s type %s\n",
_mesa_lookup_enum_by_nr( internalFormat ),
_mesa_lookup_enum_by_nr( format ),
@ -549,7 +548,7 @@ r200ValidateClientStorage( GLcontext *ctx, GLenum target,
format, type);
if (0)
if ( R200_DEBUG & DEBUG_TEXTURE )
fprintf(stderr, "%s: srcRowStride %d/%x\n",
__FUNCTION__, srcRowStride, srcRowStride);

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tex.h,v 1.1 2002/10/30 12:51:53 alanh Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_texmem.c,v 1.5 2002/12/17 00:32:56 dawes Exp $ */
/**************************************************************************
Copyright (C) Tungsten Graphics 2002. All Rights Reserved.

View file

@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_texstate.c,v 1.3 2003/02/15 22:18:47 dawes Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.

View file

@ -1,3 +1,4 @@
radeon_chipset.h
radeon_screen.*
radeon_screen.[ch]
radeon_span.h
server

View file

@ -0,0 +1,2 @@
#!/bin/sh
indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs "$@"

View file

@ -1,6 +1,5 @@
# src/mesa/drivers/dri/r300/Makefile
TOP = ../../../../..
include $(TOP)/configs/current
@ -28,8 +27,7 @@ DRIVER_SOURCES = \
radeon_lock.c \
radeon_span.c \
radeon_state.c \
radeon_mm.c \
radeon_vtxfmt_a.c \
r300_mem.c \
\
r300_context.c \
r300_ioctl.c \
@ -42,34 +40,12 @@ DRIVER_SOURCES = \
r300_vertprog.c \
r300_fragprog.c \
r300_shader.c \
r300_maos.c \
r300_emit.c \
$(EGL_SOURCES)
# \
# r200_context.c \
# r200_ioctl.c \
# r200_state.c \
# r200_state_init.c \
# r200_cmdbuf.c \
# r200_pixel.c \
# r200_tex.c \
# r200_texmem.c \
# r200_texstate.c \
# r200_swtcl.c \
# r200_maos.c \
# r200_sanity.c \
# r200_vtxfmt.c \
# r200_vtxfmt_c.c \
# r200_vtxfmt_sse.c \
# r200_vtxfmt_x86.c
C_SOURCES = $(COMMON_SOURCES) $(DRIVER_SOURCES)
X86_SOURCES =
#r200_vtxtmp_x86.S
DRIVER_DEFINES = -DCOMPILE_R300 -DGLX_DIRECT_RENDERING -DR200_MERGED=0 \
DRIVER_DEFINES = -DCOMPILE_R300 -DR200_MERGED=0 \
-DRADEON_COMMON=1 -DRADEON_COMMON_FOR_R300
SYMLINKS = \
@ -83,11 +59,11 @@ SYMLINKS = \
COMMON_SYMLINKS = \
radeon_chipset.h \
radeon_screen.c \
radeon_screen.h
radeon_screen.h \
radeon_span.h
##### TARGETS #####
include ../Makefile.template
server:
@ -100,4 +76,3 @@ $(COMMON_SYMLINKS):
@[ -e $@ ] || ln -sf ../radeon/$@ ./
symlinks: $(SYMLINKS) $(COMMON_SYMLINKS)

View file

@ -1,103 +0,0 @@
#ifndef __PIXEL_SHADER_H__
#define __PIXEL_SHADER_H__
#include "r300_reg.h"
/* INSTR 0 */
#define PFS_OP_MAD 0
#define PFS_OP_DP3 1
#define PFS_OP_DP4 2
#define PFS_OP_MIN 4
#define PFS_OP_MAX 5
#define PFS_OP_CMP 8
#define PFS_OP_FRC 9
#define PFS_OP_OUTC_REPL_ALPHA 10
/* "or" these with arg0 value to negate or take absolute value of an argument */
#define PFS_ARG_NEG (1<<5)
#define PFS_ARG_ABS (1<<6)
#define MAKE_PFS_INSTR0(op, arg0, arg1, arg2, flags) \
( ((op)<<23) \
| ((arg0)<<R300_FPI0_ARG0C_SHIFT) \
| ((arg1)<<R300_FPI0_ARG1C_SHIFT) \
| ((arg2)<<R300_FPI0_ARG2C_SHIFT) \
| (flags) \
)
#define PFS_FLAG_X 1
#define PFS_FLAG_Y 2
#define PFS_FLAG_XY 3
#define PFS_FLAG_Z 4
#define PFS_FLAG_XZ 5
#define PFS_FLAG_YZ 6
#define PFS_FLAG_ALL 7
#define PFS_FLAG_NONE 0
#define EASY_PFS_INSTR0(op, arg0, arg1, arg2) \
MAKE_PFS_INSTR0(PFS_OP_##op, \
R300_FPI0_ARGC_##arg0, \
R300_FPI0_ARGC_##arg1, \
R300_FPI0_ARGC_##arg2, \
0)
/* INSTR 1 */
#define PFS_FLAG_CONST (1<<5)
#define MAKE_PFS_INSTR1(dstc, src0, src1, src2, reg, output) \
((src0) | ((src1) << R300_FPI1_SRC1C_SHIFT) \
| ((src2)<<R300_FPI1_SRC2C_SHIFT) \
| ((dstc) << R300_FPI1_DSTC_SHIFT) \
| ((reg) << 23) | ((output)<<26))
#define EASY_PFS_INSTR1(dstc, src0, src1, src2, reg, output) \
MAKE_PFS_INSTR1(dstc, src0, src1, src2, PFS_FLAG_##reg, PFS_FLAG_##output)
/* INSTR 2 */
/* you can "or" PFS_ARG_NEG with these values to negate them */
#define MAKE_PFS_INSTR2(op, arg0, arg1, arg2, flags) \
(((op) << 23) | \
((arg0)<<R300_FPI2_ARG0A_SHIFT) | \
((arg1)<<R300_FPI2_ARG1A_SHIFT) | \
((arg2)<<R300_FPI2_ARG2A_SHIFT) | \
(flags))
#define EASY_PFS_INSTR2(op, arg0, arg1, arg2) \
MAKE_PFS_INSTR2(R300_FPI2_OUTA_##op, \
R300_FPI2_ARGA_##arg0, \
R300_FPI2_ARGA_##arg1, \
R300_FPI2_ARGA_##arg2, \
0)
/* INSTR 3 */
#define PFS_FLAG_NONE 0
#define PFS_FLAG_REG 1
#define PFS_FLAG_OUTPUT 2
#define PFS_FLAG_BOTH 3
#define MAKE_PFS_INSTR3(dstc, src0, src1, src2, flags) \
((src0) | ((src1) << R300_FPI1_SRC1C_SHIFT) \
| ((src2)<<R300_FPI1_SRC2C_SHIFT) \
| ((dstc) << R300_FPI1_DSTC_SHIFT) \
| ((flags) << 23))
#define EASY_PFS_INSTR3(dstc, src0, src1, src2, flag) \
MAKE_PFS_INSTR3(dstc, src0, src1, src2, PFS_FLAG_##flag)
/* What are 0's ORed with flags ? They are register numbers that
just happen to be 0 */
#define PFS_NOP { \
EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO), \
EASY_PFS_INSTR1(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, NONE, ALL), \
EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO), \
EASY_PFS_INSTR3(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, OUTPUT) \
}
#endif

Some files were not shown because too many files have changed in this diff Show more