mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
Merge branch 'master' of git+ssh://michal@git.freedesktop.org/git/mesa/mesa into softpipe_0_1_branch
This commit is contained in:
commit
3b8bc1f467
299 changed files with 12790 additions and 10441 deletions
2
Makefile
2
Makefile
|
|
@ -372,6 +372,8 @@ DEMO_FILES = \
|
|||
$(DIRECTORY)/progs/demos/*.cxx \
|
||||
$(DIRECTORY)/progs/demos/*.dat \
|
||||
$(DIRECTORY)/progs/demos/README \
|
||||
$(DIRECTORY)/progs/fbdev/Makefile \
|
||||
$(DIRECTORY)/progs/fbdev/glfbdevtest.c \
|
||||
$(DIRECTORY)/progs/osdemos/Makefile \
|
||||
$(DIRECTORY)/progs/osdemos/*.c \
|
||||
$(DIRECTORY)/progs/xdemos/Makefile* \
|
||||
|
|
|
|||
25
Makefile.mgw
25
Makefile.mgw
|
|
@ -51,16 +51,23 @@
|
|||
# realclean: remove all generated files
|
||||
#
|
||||
|
||||
# MinGW core makefile updated for Mesa 7.0
|
||||
#
|
||||
# updated : by Heromyth, 2007-6-25
|
||||
# Email : zxpmyth@yahoo.com.cn
|
||||
# Bug : All the default settings work fine. But the setting X86=1 can't work.
|
||||
# The others havn't been tested yet.
|
||||
|
||||
|
||||
|
||||
.PHONY : all libgl clean realclean
|
||||
|
||||
ifeq ($(ICD),1)
|
||||
# when -std=c99 mingw will not define WIN32
|
||||
CFLAGS = -Wall -W -Werror
|
||||
CFLAGS = -Wall -Werror
|
||||
else
|
||||
# I love c89
|
||||
CFLAGS = -Wall -W -pedantic
|
||||
CFLAGS = -Wall -pedantic
|
||||
endif
|
||||
CFLAGS += -O2 -ffast-math
|
||||
|
||||
|
|
@ -72,16 +79,28 @@ else
|
|||
UNLINK = $(RM) $(1)
|
||||
endif
|
||||
|
||||
all: libgl
|
||||
all: libgl libglu libglut
|
||||
|
||||
libgl: lib
|
||||
$(MAKE) -f Makefile.mgw -C src/mesa
|
||||
|
||||
libglu: libgl
|
||||
$(MAKE) -f Makefile.mgw -C src/glu/sgi
|
||||
|
||||
libglut: libglu
|
||||
$(MAKE) -f Makefile.mgw -C src/glut/glx
|
||||
|
||||
example: libglut
|
||||
$(MAKE) -f Makefile.mgw star -C progs/samples
|
||||
copy progs\samples\star.exe lib
|
||||
|
||||
lib:
|
||||
mkdir lib
|
||||
|
||||
clean:
|
||||
$(MAKE) -f Makefile.mgw clean -C src/mesa
|
||||
$(MAKE) -f Makefile.mgw clean -C src/glu/sgi
|
||||
$(MAKE) -f Makefile.mgw clean -C src/glut/glx
|
||||
|
||||
realclean: clean
|
||||
-$(call UNLINK,lib/*.a)
|
||||
|
|
|
|||
|
|
@ -104,6 +104,9 @@ do
|
|||
# this is a special case (see bugzilla 10876)
|
||||
DEPS="$DEPS $1"
|
||||
;;
|
||||
'-pthread')
|
||||
DEPS="$DEPS -pthread"
|
||||
;;
|
||||
'-cplusplus')
|
||||
CPLUSPLUS=1
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ ASM_SOURCES =
|
|||
# Library/program dependencies
|
||||
LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
|
||||
LIBDRM_LIB = `pkg-config --libs libdrm`
|
||||
DRI_LIB_DEPS = -L/usr/local/lib -lm -lpthread -lexpat $(LIBDRM_LIB)
|
||||
DRI_LIB_DEPS = -L/usr/local/lib -lm -pthread -lexpat $(LIBDRM_LIB)
|
||||
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
|
||||
-lm -lpthread $(LIBDRM_LIB)
|
||||
-lm -pthread $(LIBDRM_LIB)
|
||||
|
||||
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm
|
||||
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -lGL -lXt -lX11
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ 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
|
||||
-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
|
||||
-DHAVE_ALIAS
|
||||
|
||||
CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
|
||||
$(ASM_FLAGS) -std=c99 -ffast-math
|
||||
|
|
|
|||
805
docs/MESA_texture_array.spec
Normal file
805
docs/MESA_texture_array.spec
Normal 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.||
|
||||
|
|
@ -9,11 +9,7 @@
|
|||
<H1>Downloading</H1>
|
||||
|
||||
<p>
|
||||
Last development release: <b>6.5.3</b>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Last stable release: <b>6.4.2</b>
|
||||
Last stable release: <b>7.0</b>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ GL_ARB_fragment_program extensions.
|
|||
</p>
|
||||
|
||||
<p>
|
||||
May 2007: Mesa 7.0 is released, implementing the OpenGL 2.1 specification
|
||||
June 2007: Mesa 7.0 is released, implementing the OpenGL 2.1 specification
|
||||
and OpenGL Shading Language.
|
||||
</p>
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<H1>News</H1>
|
||||
|
||||
|
||||
<h2>May ???, 2007</h2>
|
||||
<h2>June 22, 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.
|
||||
|
|
|
|||
|
|
@ -8,16 +8,25 @@
|
|||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.0 Release Notes / (<em>in progress</em>)</H1>
|
||||
<H1>Mesa 7.0 Release Notes / June 22, 2007</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.0 is a stable release, featuring OpenGL 2.1 API support.
|
||||
A number of bugs have been fixed since the 6.5.3 release.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
TBD
|
||||
35a1698986f7ac8dc435624ee9256cda MesaLib-7.0.tar.gz
|
||||
50c371455fa7532c04aa0a970f9bc51f MesaLib-7.0.tar.bz2
|
||||
bcedb6f43c97c1bc49e5cc7f12835722 MesaLib-7.0.zip
|
||||
9bad332c7b74f59be96556135212ca9e MesaDemos-7.0.tar.gz
|
||||
fada2bc1f29da513e015fda1e3abd0c0 MesaDemos-7.0.tar.bz2
|
||||
84e3bbe470d983ae32f1f0c779faf99e MesaDemos-7.0.zip
|
||||
76c7bb54f9850c689eba844f6daed332 MesaGLUT-7.0.tar.gz
|
||||
4af28296e02772ef1de00e4e79bf3d12 MesaGLUT-7.0.tar.bz2
|
||||
9043cb0b54cc03d1874728d74b12188c MesaGLUT-7.0.zip
|
||||
</pre>
|
||||
|
||||
|
||||
|
|
@ -37,6 +46,12 @@ TBD
|
|||
<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
|
||||
<li>The GLX protocol request for glXDestroyPBuffer() was incorrect (bug 10983)
|
||||
<li>ARB vp state.light[n].half value was incorrect (bug 10987)
|
||||
<li>Fixed a positional light source bug (bug 11009)
|
||||
<li>Fixed point size attenuation problem (bug 11042)
|
||||
<li>glPopAttrib didn't restore texture object's LOD bias (bug 11049)
|
||||
<li>Fixed a TLS / TEXTREL problem (bug 7459)
|
||||
</ul>
|
||||
|
||||
|
||||
|
|
|
|||
72
docs/relnotes-7.1.html
Normal file
72
docs/relnotes-7.1.html
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<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>
|
||||
<li>GL_EXT_texture_from_pixmap extension for Xlib driver
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Internal code changes</h2>
|
||||
<ul>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>To Do (someday) items</h2>
|
||||
<ul>
|
||||
<li>Remove the MEMCPY() and _mesa_memcpy() wrappers and just use memcpy().
|
||||
Probably do the same for malloc, calloc, etc.
|
||||
The wrappers were useful in the past for memory debugging but now we
|
||||
have valgrind. Not worried about SunOS 4 support anymore either...
|
||||
<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>
|
||||
|
|
@ -20,6 +20,7 @@ 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>
|
||||
|
|
|
|||
|
|
@ -2209,6 +2209,39 @@ 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 */
|
||||
|
||||
#if 0
|
||||
/* (temporarily) disabled because of collision with typedef in glext.h
|
||||
* that happens if apps include both gl.h and glext.h
|
||||
*/
|
||||
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target,
|
||||
GLenum attachment, GLuint texture, GLint level, GLint layer);
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#define glActiveStencilFaceEXT MANGLE(ActiveStencilFaceEXT)
|
||||
#define glActiveTextureARB MANGLE(ActiveTextureARB)
|
||||
#define glActiveTexture MANGLE(ActiveTexture)
|
||||
#define glActiveVaryingNV MANGLE(ActiveVaryingNV)
|
||||
#define glAlphaFragmentOp1ATI MANGLE(AlphaFragmentOp1ATI)
|
||||
#define glAlphaFragmentOp2ATI MANGLE(AlphaFragmentOp2ATI)
|
||||
#define glAlphaFragmentOp3ATI MANGLE(AlphaFragmentOp3ATI)
|
||||
|
|
@ -52,11 +53,16 @@
|
|||
#define glBeginOcclusionQueryNV MANGLE(BeginOcclusionQueryNV)
|
||||
#define glBeginQueryARB MANGLE(BeginQueryARB)
|
||||
#define glBeginQuery MANGLE(BeginQuery)
|
||||
#define glBeginTransformFeedbackNV MANGLE(BeginTransformFeedbackNV)
|
||||
#define glBeginVertexShaderEXT MANGLE(BeginVertexShaderEXT)
|
||||
#define glBindAttribLocationARB MANGLE(BindAttribLocationARB)
|
||||
#define glBindAttribLocation MANGLE(BindAttribLocation)
|
||||
#define glBindBufferARB MANGLE(BindBufferARB)
|
||||
#define glBindBufferBaseNV MANGLE(BindBufferBaseNV)
|
||||
#define glBindBuffer MANGLE(BindBuffer)
|
||||
#define glBindBufferOffsetNV MANGLE(BindBufferOffsetNV)
|
||||
#define glBindBufferRangeNV MANGLE(BindBufferRangeNV)
|
||||
#define glBindFragDataLocationEXT MANGLE(BindFragDataLocationEXT)
|
||||
#define glBindFragmentShaderATI MANGLE(BindFragmentShaderATI)
|
||||
#define glBindFramebufferEXT MANGLE(BindFramebufferEXT)
|
||||
#define glBindLightParameterEXT MANGLE(BindLightParameterEXT)
|
||||
|
|
@ -97,6 +103,7 @@
|
|||
#define glBlitFramebufferEXT MANGLE(BlitFramebufferEXT)
|
||||
#define glBufferDataARB MANGLE(BufferDataARB)
|
||||
#define glBufferData MANGLE(BufferData)
|
||||
#define glBufferParameteriAPPLE MANGLE(BufferParameteriAPPLE)
|
||||
#define glBufferSubDataARB MANGLE(BufferSubDataARB)
|
||||
#define glBufferSubData MANGLE(BufferSubData)
|
||||
#define glCallList MANGLE(CallList)
|
||||
|
|
@ -104,8 +111,11 @@
|
|||
#define glCheckFramebufferStatusEXT MANGLE(CheckFramebufferStatusEXT)
|
||||
#define glClampColorARB MANGLE(ClampColorARB)
|
||||
#define glClearAccum MANGLE(ClearAccum)
|
||||
#define glClearColorIiEXT MANGLE(ClearColorIiEXT)
|
||||
#define glClearColorIuiEXT MANGLE(ClearColorIuiEXT)
|
||||
#define glClearColor MANGLE(ClearColor)
|
||||
#define glClearDebugLogMESA MANGLE(ClearDebugLogMESA)
|
||||
#define glClearDepthdNV MANGLE(ClearDepthdNV)
|
||||
#define glClearDepth MANGLE(ClearDepth)
|
||||
#define glClearIndex MANGLE(ClearIndex)
|
||||
#define glClear MANGLE(Clear)
|
||||
|
|
@ -161,6 +171,7 @@
|
|||
#define glColorFragmentOp1ATI MANGLE(ColorFragmentOp1ATI)
|
||||
#define glColorFragmentOp2ATI MANGLE(ColorFragmentOp2ATI)
|
||||
#define glColorFragmentOp3ATI MANGLE(ColorFragmentOp3ATI)
|
||||
#define glColorMaskIndexedEXT MANGLE(ColorMaskIndexedEXT)
|
||||
#define glColorMask MANGLE(ColorMask)
|
||||
#define glColorMaterial MANGLE(ColorMaterial)
|
||||
#define glColorPointerEXT MANGLE(ColorPointerEXT)
|
||||
|
|
@ -261,19 +272,23 @@
|
|||
#define glDeleteTextures MANGLE(DeleteTextures)
|
||||
#define glDeleteVertexArraysAPPLE MANGLE(DeleteVertexArraysAPPLE)
|
||||
#define glDeleteVertexShaderEXT MANGLE(DeleteVertexShaderEXT)
|
||||
#define glDepthBoundsdNV MANGLE(DepthBoundsdNV)
|
||||
#define glDepthBoundsEXT MANGLE(DepthBoundsEXT)
|
||||
#define glDepthFunc MANGLE(DepthFunc)
|
||||
#define glDepthMask MANGLE(DepthMask)
|
||||
#define glDepthRangedNV MANGLE(DepthRangedNV)
|
||||
#define glDepthRange MANGLE(DepthRange)
|
||||
#define glDetachObjectARB MANGLE(DetachObjectARB)
|
||||
#define glDetachShader MANGLE(DetachShader)
|
||||
#define glDetailTexFuncSGIS MANGLE(DetailTexFuncSGIS)
|
||||
#define glDisableClientState MANGLE(DisableClientState)
|
||||
#define glDisableIndexedEXT MANGLE(DisableIndexedEXT)
|
||||
#define glDisable MANGLE(Disable)
|
||||
#define glDisableVariantClientStateEXT MANGLE(DisableVariantClientStateEXT)
|
||||
#define glDisableVertexAttribArrayARB MANGLE(DisableVertexAttribArrayARB)
|
||||
#define glDisableVertexAttribArray MANGLE(DisableVertexAttribArray)
|
||||
#define glDrawArraysEXT MANGLE(DrawArraysEXT)
|
||||
#define glDrawArraysInstancedEXT MANGLE(DrawArraysInstancedEXT)
|
||||
#define glDrawArrays MANGLE(DrawArrays)
|
||||
#define glDrawBuffer MANGLE(DrawBuffer)
|
||||
#define glDrawBuffersARB MANGLE(DrawBuffersARB)
|
||||
|
|
@ -281,6 +296,7 @@
|
|||
#define glDrawBuffers MANGLE(DrawBuffers)
|
||||
#define glDrawElementArrayAPPLE MANGLE(DrawElementArrayAPPLE)
|
||||
#define glDrawElementArrayATI MANGLE(DrawElementArrayATI)
|
||||
#define glDrawElementsInstancedEXT MANGLE(DrawElementsInstancedEXT)
|
||||
#define glDrawElements MANGLE(DrawElements)
|
||||
#define glDrawMeshArraysSUN MANGLE(DrawMeshArraysSUN)
|
||||
#define glDrawPixels MANGLE(DrawPixels)
|
||||
|
|
@ -296,6 +312,7 @@
|
|||
#define glElementPointerAPPLE MANGLE(ElementPointerAPPLE)
|
||||
#define glElementPointerATI MANGLE(ElementPointerATI)
|
||||
#define glEnableClientState MANGLE(EnableClientState)
|
||||
#define glEnableIndexedEXT MANGLE(EnableIndexedEXT)
|
||||
#define glEnable MANGLE(Enable)
|
||||
#define glEnableVariantClientStateEXT MANGLE(EnableVariantClientStateEXT)
|
||||
#define glEnableVertexAttribArrayARB MANGLE(EnableVertexAttribArrayARB)
|
||||
|
|
@ -306,6 +323,7 @@
|
|||
#define glEndOcclusionQueryNV MANGLE(EndOcclusionQueryNV)
|
||||
#define glEndQueryARB MANGLE(EndQueryARB)
|
||||
#define glEndQuery MANGLE(EndQuery)
|
||||
#define glEndTransformFeedbackNV MANGLE(EndTransformFeedbackNV)
|
||||
#define glEndVertexShaderEXT MANGLE(EndVertexShaderEXT)
|
||||
#define glEvalCoord1d MANGLE(EvalCoord1d)
|
||||
#define glEvalCoord1dv MANGLE(EvalCoord1dv)
|
||||
|
|
@ -331,6 +349,7 @@
|
|||
#define glFinishObjectAPPLE MANGLE(FinishObjectAPPLE)
|
||||
#define glFinishTextureSUNX MANGLE(FinishTextureSUNX)
|
||||
#define glFlush MANGLE(Flush)
|
||||
#define glFlushMappedBufferRangeAPPLE MANGLE(FlushMappedBufferRangeAPPLE)
|
||||
#define glFlushPixelDataRangeNV MANGLE(FlushPixelDataRangeNV)
|
||||
#define glFlushRasterSGIX MANGLE(FlushRasterSGIX)
|
||||
#define glFlushVertexArrayRangeAPPLE MANGLE(FlushVertexArrayRangeAPPLE)
|
||||
|
|
@ -370,6 +389,9 @@
|
|||
#define glFramebufferTexture1DEXT MANGLE(FramebufferTexture1DEXT)
|
||||
#define glFramebufferTexture2DEXT MANGLE(FramebufferTexture2DEXT)
|
||||
#define glFramebufferTexture3DEXT MANGLE(FramebufferTexture3DEXT)
|
||||
#define glFramebufferTextureEXT MANGLE(FramebufferTextureEXT)
|
||||
#define glFramebufferTextureFaceEXT MANGLE(FramebufferTextureFaceEXT)
|
||||
#define glFramebufferTextureLayerEXT MANGLE(FramebufferTextureLayerEXT)
|
||||
#define glFrameZoomSGIX MANGLE(FrameZoomSGIX)
|
||||
#define glFreeObjectBufferATI MANGLE(FreeObjectBufferATI)
|
||||
#define glFrontFace MANGLE(FrontFace)
|
||||
|
|
@ -398,12 +420,14 @@
|
|||
#define glGetActiveAttrib MANGLE(GetActiveAttrib)
|
||||
#define glGetActiveUniformARB MANGLE(GetActiveUniformARB)
|
||||
#define glGetActiveUniform MANGLE(GetActiveUniform)
|
||||
#define glGetActiveVaryingNV MANGLE(GetActiveVaryingNV)
|
||||
#define glGetArrayObjectfvATI MANGLE(GetArrayObjectfvATI)
|
||||
#define glGetArrayObjectivATI MANGLE(GetArrayObjectivATI)
|
||||
#define glGetAttachedObjectsARB MANGLE(GetAttachedObjectsARB)
|
||||
#define glGetAttachedShaders MANGLE(GetAttachedShaders)
|
||||
#define glGetAttribLocationARB MANGLE(GetAttribLocationARB)
|
||||
#define glGetAttribLocation MANGLE(GetAttribLocation)
|
||||
#define glGetBooleanIndexedvEXT MANGLE(GetBooleanIndexedvEXT)
|
||||
#define glGetBooleanv MANGLE(GetBooleanv)
|
||||
#define glGetBufferParameterivARB MANGLE(GetBufferParameterivARB)
|
||||
#define glGetBufferParameteriv MANGLE(GetBufferParameteriv)
|
||||
|
|
@ -444,6 +468,7 @@
|
|||
#define glGetFinalCombinerInputParameterivNV MANGLE(GetFinalCombinerInputParameterivNV)
|
||||
#define glGetFloatv MANGLE(GetFloatv)
|
||||
#define glGetFogFuncSGIS MANGLE(GetFogFuncSGIS)
|
||||
#define glGetFragDataLocationEXT MANGLE(GetFragDataLocationEXT)
|
||||
#define glGetFragmentLightfvSGIX MANGLE(GetFragmentLightfvSGIX)
|
||||
#define glGetFragmentLightivSGIX MANGLE(GetFragmentLightivSGIX)
|
||||
#define glGetFragmentMaterialfvSGIX MANGLE(GetFragmentMaterialfvSGIX)
|
||||
|
|
@ -460,6 +485,7 @@
|
|||
#define glGetImageTransformParameterivHP MANGLE(GetImageTransformParameterivHP)
|
||||
#define glGetInfoLogARB MANGLE(GetInfoLogARB)
|
||||
#define glGetInstrumentsSGIX MANGLE(GetInstrumentsSGIX)
|
||||
#define glGetIntegerIndexedvEXT MANGLE(GetIntegerIndexedvEXT)
|
||||
#define glGetIntegerv MANGLE(GetIntegerv)
|
||||
#define glGetInvariantBooleanvEXT MANGLE(GetInvariantBooleanvEXT)
|
||||
#define glGetInvariantFloatvEXT MANGLE(GetInvariantFloatvEXT)
|
||||
|
|
@ -503,12 +529,16 @@
|
|||
#define glGetPolygonStipple MANGLE(GetPolygonStipple)
|
||||
#define glGetProgramEnvParameterdvARB MANGLE(GetProgramEnvParameterdvARB)
|
||||
#define glGetProgramEnvParameterfvARB MANGLE(GetProgramEnvParameterfvARB)
|
||||
#define glGetProgramEnvParameterIivNV MANGLE(GetProgramEnvParameterIivNV)
|
||||
#define glGetProgramEnvParameterIuivNV MANGLE(GetProgramEnvParameterIuivNV)
|
||||
#define glGetProgramInfoLog MANGLE(GetProgramInfoLog)
|
||||
#define glGetProgramivARB MANGLE(GetProgramivARB)
|
||||
#define glGetProgramiv MANGLE(GetProgramiv)
|
||||
#define glGetProgramivNV MANGLE(GetProgramivNV)
|
||||
#define glGetProgramLocalParameterdvARB MANGLE(GetProgramLocalParameterdvARB)
|
||||
#define glGetProgramLocalParameterfvARB MANGLE(GetProgramLocalParameterfvARB)
|
||||
#define glGetProgramLocalParameterIivNV MANGLE(GetProgramLocalParameterIivNV)
|
||||
#define glGetProgramLocalParameterIuivNV MANGLE(GetProgramLocalParameterIuivNV)
|
||||
#define glGetProgramNamedParameterdvNV MANGLE(GetProgramNamedParameterdvNV)
|
||||
#define glGetProgramNamedParameterfvNV MANGLE(GetProgramNamedParameterfvNV)
|
||||
#define glGetProgramParameterdvNV MANGLE(GetProgramParameterdvNV)
|
||||
|
|
@ -545,20 +575,27 @@
|
|||
#define glGetTexLevelParameterfv MANGLE(GetTexLevelParameterfv)
|
||||
#define glGetTexLevelParameteriv MANGLE(GetTexLevelParameteriv)
|
||||
#define glGetTexParameterfv MANGLE(GetTexParameterfv)
|
||||
#define glGetTexParameterIivEXT MANGLE(GetTexParameterIivEXT)
|
||||
#define glGetTexParameterIuivEXT MANGLE(GetTexParameterIuivEXT)
|
||||
#define glGetTexParameteriv MANGLE(GetTexParameteriv)
|
||||
#define glGetTrackMatrixivNV MANGLE(GetTrackMatrixivNV)
|
||||
#define glGetTransformFeedbackVaryingNV MANGLE(GetTransformFeedbackVaryingNV)
|
||||
#define glGetUniformBufferSizeEXT MANGLE(GetUniformBufferSizeEXT)
|
||||
#define glGetUniformfvARB MANGLE(GetUniformfvARB)
|
||||
#define glGetUniformfv MANGLE(GetUniformfv)
|
||||
#define glGetUniformivARB MANGLE(GetUniformivARB)
|
||||
#define glGetUniformiv MANGLE(GetUniformiv)
|
||||
#define glGetUniformLocationARB MANGLE(GetUniformLocationARB)
|
||||
#define glGetUniformLocation MANGLE(GetUniformLocation)
|
||||
#define glGetUniformOffsetEXT MANGLE(GetUniformOffsetEXT)
|
||||
#define glGetUniformuivEXT MANGLE(GetUniformuivEXT)
|
||||
#define glGetVariantArrayObjectfvATI MANGLE(GetVariantArrayObjectfvATI)
|
||||
#define glGetVariantArrayObjectivATI MANGLE(GetVariantArrayObjectivATI)
|
||||
#define glGetVariantBooleanvEXT MANGLE(GetVariantBooleanvEXT)
|
||||
#define glGetVariantFloatvEXT MANGLE(GetVariantFloatvEXT)
|
||||
#define glGetVariantIntegervEXT MANGLE(GetVariantIntegervEXT)
|
||||
#define glGetVariantPointervEXT MANGLE(GetVariantPointervEXT)
|
||||
#define glGetVaryingLocationNV MANGLE(GetVaryingLocationNV)
|
||||
#define glGetVertexAttribArrayObjectfvATI MANGLE(GetVertexAttribArrayObjectfvATI)
|
||||
#define glGetVertexAttribArrayObjectivATI MANGLE(GetVertexAttribArrayObjectivATI)
|
||||
#define glGetVertexAttribdvARB MANGLE(GetVertexAttribdvARB)
|
||||
|
|
@ -567,6 +604,8 @@
|
|||
#define glGetVertexAttribfvARB MANGLE(GetVertexAttribfvARB)
|
||||
#define glGetVertexAttribfv MANGLE(GetVertexAttribfv)
|
||||
#define glGetVertexAttribfvNV MANGLE(GetVertexAttribfvNV)
|
||||
#define glGetVertexAttribIivEXT MANGLE(GetVertexAttribIivEXT)
|
||||
#define glGetVertexAttribIuivEXT MANGLE(GetVertexAttribIuivEXT)
|
||||
#define glGetVertexAttribivARB MANGLE(GetVertexAttribivARB)
|
||||
#define glGetVertexAttribiv MANGLE(GetVertexAttribiv)
|
||||
#define glGetVertexAttribivNV MANGLE(GetVertexAttribivNV)
|
||||
|
|
@ -613,6 +652,7 @@
|
|||
#define glIsAsyncMarkerSGIX MANGLE(IsAsyncMarkerSGIX)
|
||||
#define glIsBufferARB MANGLE(IsBufferARB)
|
||||
#define glIsBuffer MANGLE(IsBuffer)
|
||||
#define glIsEnabledIndexedEXT MANGLE(IsEnabledIndexedEXT)
|
||||
#define glIsEnabled MANGLE(IsEnabled)
|
||||
#define glIsFenceAPPLE MANGLE(IsFenceAPPLE)
|
||||
#define glIsFenceNV MANGLE(IsFenceNV)
|
||||
|
|
@ -852,17 +892,32 @@
|
|||
#define glPrimitiveRestartNV MANGLE(PrimitiveRestartNV)
|
||||
#define glPrioritizeTexturesEXT MANGLE(PrioritizeTexturesEXT)
|
||||
#define glPrioritizeTextures MANGLE(PrioritizeTextures)
|
||||
#define glProgramBufferParametersfvNV MANGLE(ProgramBufferParametersfvNV)
|
||||
#define glProgramBufferParametersIivNV MANGLE(ProgramBufferParametersIivNV)
|
||||
#define glProgramBufferParametersIuivNV MANGLE(ProgramBufferParametersIuivNV)
|
||||
#define glProgramCallbackMESA MANGLE(ProgramCallbackMESA)
|
||||
#define glProgramEnvParameter4dARB MANGLE(ProgramEnvParameter4dARB)
|
||||
#define glProgramEnvParameter4dvARB MANGLE(ProgramEnvParameter4dvARB)
|
||||
#define glProgramEnvParameter4fARB MANGLE(ProgramEnvParameter4fARB)
|
||||
#define glProgramEnvParameter4fvARB MANGLE(ProgramEnvParameter4fvARB)
|
||||
#define glProgramEnvParameterI4iNV MANGLE(ProgramEnvParameterI4iNV)
|
||||
#define glProgramEnvParameterI4ivNV MANGLE(ProgramEnvParameterI4ivNV)
|
||||
#define glProgramEnvParameterI4uiNV MANGLE(ProgramEnvParameterI4uiNV)
|
||||
#define glProgramEnvParameterI4uivNV MANGLE(ProgramEnvParameterI4uivNV)
|
||||
#define glProgramEnvParameters4fvEXT MANGLE(ProgramEnvParameters4fvEXT)
|
||||
#define glProgramEnvParametersI4ivNV MANGLE(ProgramEnvParametersI4ivNV)
|
||||
#define glProgramEnvParametersI4uivNV MANGLE(ProgramEnvParametersI4uivNV)
|
||||
#define glProgramLocalParameter4dARB MANGLE(ProgramLocalParameter4dARB)
|
||||
#define glProgramLocalParameter4dvARB MANGLE(ProgramLocalParameter4dvARB)
|
||||
#define glProgramLocalParameter4fARB MANGLE(ProgramLocalParameter4fARB)
|
||||
#define glProgramLocalParameter4fvARB MANGLE(ProgramLocalParameter4fvARB)
|
||||
#define glProgramLocalParameterI4iNV MANGLE(ProgramLocalParameterI4iNV)
|
||||
#define glProgramLocalParameterI4ivNV MANGLE(ProgramLocalParameterI4ivNV)
|
||||
#define glProgramLocalParameterI4uiNV MANGLE(ProgramLocalParameterI4uiNV)
|
||||
#define glProgramLocalParameterI4uivNV MANGLE(ProgramLocalParameterI4uivNV)
|
||||
#define glProgramLocalParameters4fvEXT MANGLE(ProgramLocalParameters4fvEXT)
|
||||
#define glProgramLocalParametersI4ivNV MANGLE(ProgramLocalParametersI4ivNV)
|
||||
#define glProgramLocalParametersI4uivNV MANGLE(ProgramLocalParametersI4uivNV)
|
||||
#define glProgramNamedParameter4dNV MANGLE(ProgramNamedParameter4dNV)
|
||||
#define glProgramNamedParameter4dvNV MANGLE(ProgramNamedParameter4dvNV)
|
||||
#define glProgramNamedParameter4fNV MANGLE(ProgramNamedParameter4fNV)
|
||||
|
|
@ -871,9 +926,11 @@
|
|||
#define glProgramParameter4dvNV MANGLE(ProgramParameter4dvNV)
|
||||
#define glProgramParameter4fNV MANGLE(ProgramParameter4fNV)
|
||||
#define glProgramParameter4fvNV MANGLE(ProgramParameter4fvNV)
|
||||
#define glProgramParameteriEXT MANGLE(ProgramParameteriEXT)
|
||||
#define glProgramParameters4dvNV MANGLE(ProgramParameters4dvNV)
|
||||
#define glProgramParameters4fvNV MANGLE(ProgramParameters4fvNV)
|
||||
#define glProgramStringARB MANGLE(ProgramStringARB)
|
||||
#define glProgramVertexLimitNV MANGLE(ProgramVertexLimitNV)
|
||||
#define glPushAttrib MANGLE(PushAttrib)
|
||||
#define glPushClientAttrib MANGLE(PushClientAttrib)
|
||||
#define glPushMatrix MANGLE(PushMatrix)
|
||||
|
|
@ -915,6 +972,7 @@
|
|||
#define glRectsv MANGLE(Rectsv)
|
||||
#define glReferencePlaneSGIX MANGLE(ReferencePlaneSGIX)
|
||||
#define glRenderbufferStorageEXT MANGLE(RenderbufferStorageEXT)
|
||||
#define glRenderbufferStorageMultisampleCoverageNV MANGLE(RenderbufferStorageMultisampleCoverageNV)
|
||||
#define glRenderbufferStorageMultisampleEXT MANGLE(RenderbufferStorageMultisampleEXT)
|
||||
#define glRenderMode MANGLE(RenderMode)
|
||||
#define glReplacementCodePointerSUN MANGLE(ReplacementCodePointerSUN)
|
||||
|
|
@ -1043,6 +1101,7 @@
|
|||
#define glTestFenceAPPLE MANGLE(TestFenceAPPLE)
|
||||
#define glTestFenceNV MANGLE(TestFenceNV)
|
||||
#define glTestObjectAPPLE MANGLE(TestObjectAPPLE)
|
||||
#define glTexBufferEXT MANGLE(TexBufferEXT)
|
||||
#define glTexBumpParameterfvATI MANGLE(TexBumpParameterfvATI)
|
||||
#define glTexBumpParameterivATI MANGLE(TexBumpParameterivATI)
|
||||
#define glTexCoord1d MANGLE(TexCoord1d)
|
||||
|
|
@ -1121,7 +1180,9 @@
|
|||
#define glTexImage4DSGIS MANGLE(TexImage4DSGIS)
|
||||
#define glTexParameterf MANGLE(TexParameterf)
|
||||
#define glTexParameterfv MANGLE(TexParameterfv)
|
||||
#define glTexParameterIivEXT MANGLE(TexParameterIivEXT)
|
||||
#define glTexParameteri MANGLE(TexParameteri)
|
||||
#define glTexParameterIuivEXT MANGLE(TexParameterIuivEXT)
|
||||
#define glTexParameteriv MANGLE(TexParameteriv)
|
||||
#define glTexSubImage1DEXT MANGLE(TexSubImage1DEXT)
|
||||
#define glTexSubImage1D MANGLE(TexSubImage1D)
|
||||
|
|
@ -1135,6 +1196,8 @@
|
|||
#define glTextureMaterialEXT MANGLE(TextureMaterialEXT)
|
||||
#define glTextureNormalEXT MANGLE(TextureNormalEXT)
|
||||
#define glTrackMatrixNV MANGLE(TrackMatrixNV)
|
||||
#define glTransformFeedbackAttribsNV MANGLE(TransformFeedbackAttribsNV)
|
||||
#define glTransformFeedbackVaryingsNV MANGLE(TransformFeedbackVaryingsNV)
|
||||
#define glTranslated MANGLE(Translated)
|
||||
#define glTranslatef MANGLE(Translatef)
|
||||
#define glUniform1fARB MANGLE(Uniform1fARB)
|
||||
|
|
@ -1145,6 +1208,8 @@
|
|||
#define glUniform1i MANGLE(Uniform1i)
|
||||
#define glUniform1ivARB MANGLE(Uniform1ivARB)
|
||||
#define glUniform1iv MANGLE(Uniform1iv)
|
||||
#define glUniform1uiEXT MANGLE(Uniform1uiEXT)
|
||||
#define glUniform1uivEXT MANGLE(Uniform1uivEXT)
|
||||
#define glUniform2fARB MANGLE(Uniform2fARB)
|
||||
#define glUniform2f MANGLE(Uniform2f)
|
||||
#define glUniform2fvARB MANGLE(Uniform2fvARB)
|
||||
|
|
@ -1153,6 +1218,8 @@
|
|||
#define glUniform2i MANGLE(Uniform2i)
|
||||
#define glUniform2ivARB MANGLE(Uniform2ivARB)
|
||||
#define glUniform2iv MANGLE(Uniform2iv)
|
||||
#define glUniform2uiEXT MANGLE(Uniform2uiEXT)
|
||||
#define glUniform2uivEXT MANGLE(Uniform2uivEXT)
|
||||
#define glUniform3fARB MANGLE(Uniform3fARB)
|
||||
#define glUniform3f MANGLE(Uniform3f)
|
||||
#define glUniform3fvARB MANGLE(Uniform3fvARB)
|
||||
|
|
@ -1161,6 +1228,8 @@
|
|||
#define glUniform3i MANGLE(Uniform3i)
|
||||
#define glUniform3ivARB MANGLE(Uniform3ivARB)
|
||||
#define glUniform3iv MANGLE(Uniform3iv)
|
||||
#define glUniform3uiEXT MANGLE(Uniform3uiEXT)
|
||||
#define glUniform3uivEXT MANGLE(Uniform3uivEXT)
|
||||
#define glUniform4fARB MANGLE(Uniform4fARB)
|
||||
#define glUniform4f MANGLE(Uniform4f)
|
||||
#define glUniform4fvARB MANGLE(Uniform4fvARB)
|
||||
|
|
@ -1169,6 +1238,9 @@
|
|||
#define glUniform4i MANGLE(Uniform4i)
|
||||
#define glUniform4ivARB MANGLE(Uniform4ivARB)
|
||||
#define glUniform4iv MANGLE(Uniform4iv)
|
||||
#define glUniform4uiEXT MANGLE(Uniform4uiEXT)
|
||||
#define glUniform4uivEXT MANGLE(Uniform4uivEXT)
|
||||
#define glUniformBufferEXT MANGLE(UniformBufferEXT)
|
||||
#define glUniformMatrix2fvARB MANGLE(UniformMatrix2fvARB)
|
||||
#define glUniformMatrix2fv MANGLE(UniformMatrix2fv)
|
||||
#define glUniformMatrix2x3fv MANGLE(UniformMatrix2x3fv)
|
||||
|
|
@ -1340,6 +1412,27 @@
|
|||
#define glVertexAttrib4usvARB MANGLE(VertexAttrib4usvARB)
|
||||
#define glVertexAttrib4usv MANGLE(VertexAttrib4usv)
|
||||
#define glVertexAttribArrayObjectATI MANGLE(VertexAttribArrayObjectATI)
|
||||
#define glVertexAttribI1iEXT MANGLE(VertexAttribI1iEXT)
|
||||
#define glVertexAttribI1ivEXT MANGLE(VertexAttribI1ivEXT)
|
||||
#define glVertexAttribI1uiEXT MANGLE(VertexAttribI1uiEXT)
|
||||
#define glVertexAttribI1uivEXT MANGLE(VertexAttribI1uivEXT)
|
||||
#define glVertexAttribI2iEXT MANGLE(VertexAttribI2iEXT)
|
||||
#define glVertexAttribI2ivEXT MANGLE(VertexAttribI2ivEXT)
|
||||
#define glVertexAttribI2uiEXT MANGLE(VertexAttribI2uiEXT)
|
||||
#define glVertexAttribI2uivEXT MANGLE(VertexAttribI2uivEXT)
|
||||
#define glVertexAttribI3iEXT MANGLE(VertexAttribI3iEXT)
|
||||
#define glVertexAttribI3ivEXT MANGLE(VertexAttribI3ivEXT)
|
||||
#define glVertexAttribI3uiEXT MANGLE(VertexAttribI3uiEXT)
|
||||
#define glVertexAttribI3uivEXT MANGLE(VertexAttribI3uivEXT)
|
||||
#define glVertexAttribI4bvEXT MANGLE(VertexAttribI4bvEXT)
|
||||
#define glVertexAttribI4iEXT MANGLE(VertexAttribI4iEXT)
|
||||
#define glVertexAttribI4ivEXT MANGLE(VertexAttribI4ivEXT)
|
||||
#define glVertexAttribI4svEXT MANGLE(VertexAttribI4svEXT)
|
||||
#define glVertexAttribI4ubvEXT MANGLE(VertexAttribI4ubvEXT)
|
||||
#define glVertexAttribI4uiEXT MANGLE(VertexAttribI4uiEXT)
|
||||
#define glVertexAttribI4uivEXT MANGLE(VertexAttribI4uivEXT)
|
||||
#define glVertexAttribI4usvEXT MANGLE(VertexAttribI4usvEXT)
|
||||
#define glVertexAttribIPointerEXT MANGLE(VertexAttribIPointerEXT)
|
||||
#define glVertexAttribPointerARB MANGLE(VertexAttribPointerARB)
|
||||
#define glVertexAttribPointer MANGLE(VertexAttribPointer)
|
||||
#define glVertexAttribPointerNV MANGLE(VertexAttribPointerNV)
|
||||
|
|
|
|||
|
|
@ -44,6 +44,19 @@
|
|||
#define GLAPIENTRYP GLAPIENTRY *
|
||||
#endif
|
||||
|
||||
#ifdef GLAPI
|
||||
#undef GLAPI
|
||||
#endif
|
||||
|
||||
# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GLU32)
|
||||
# define GLAPI __declspec(dllexport)
|
||||
# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
|
||||
# define GLAPI __declspec(dllimport)
|
||||
# else /* for use with static link lib build of Win32 edition only */
|
||||
# define GLAPI extern
|
||||
# endif /* _STATIC_MESA support */
|
||||
|
||||
|
||||
#ifndef GLAPI
|
||||
#define GLAPI
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ extern _CRTIMP void __cdecl exit(int);
|
|||
#endif
|
||||
|
||||
/* GLUT API entry point declarations for Win32. */
|
||||
#if defined(GLUT_BUILDING_LIB) && defined(_DLL)
|
||||
#if (defined(BUILD_GLUT32) || defined(GLUT_BUILDING_LIB)) && defined(_DLL)
|
||||
# define GLUTAPI __declspec(dllexport)
|
||||
#elif defined(_DLL)
|
||||
# define GLUTAPI __declspec(dllimport)
|
||||
|
|
@ -131,8 +131,10 @@ extern _CRTIMP void __cdecl exit(int);
|
|||
# endif
|
||||
# define CALLBACK __stdcall
|
||||
typedef int (GLUTAPIENTRY *PROC)();
|
||||
typedef void *HGLRC;
|
||||
typedef void *HDC;
|
||||
#if !defined(__MINGW32__)
|
||||
typedef void *HGLRC;
|
||||
typedef void *HDC;
|
||||
#endif
|
||||
typedef unsigned long COLORREF;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -361,6 +361,18 @@ struct __DRIscreenRec {
|
|||
void * (*createNewContext)(__DRInativeDisplay *dpy, const __GLcontextModes *modes,
|
||||
int render_type,
|
||||
void *sharedPrivate, __DRIcontext *pctx);
|
||||
|
||||
/**
|
||||
* Method to override base texture image with a driver specific 'offset'.
|
||||
* The depth passed in allows e.g. to ignore the alpha channel of texture
|
||||
* images where the non-alpha components don't occupy a whole texel.
|
||||
*
|
||||
* For GLX_EXT_texture_from_pixmap with AIGLX.
|
||||
*
|
||||
* \since Internal API version 20070121.
|
||||
*/
|
||||
void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname,
|
||||
unsigned long long offset, GLint depth, GLuint pitch);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 4.1
|
||||
* Version: 7.1
|
||||
*
|
||||
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
|
@ -397,6 +397,25 @@ extern XMesaBuffer XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap,
|
|||
|
||||
|
||||
|
||||
/*
|
||||
* Texture from Pixmap
|
||||
* New in Mesa 7.1
|
||||
*/
|
||||
extern void
|
||||
XMesaBindTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer,
|
||||
const int *attrib_list);
|
||||
|
||||
extern void
|
||||
XMesaReleaseTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer);
|
||||
|
||||
|
||||
extern XMesaBuffer
|
||||
XMesaCreatePixmapTextureBuffer(XMesaVisual v, XMesaPixmap p,
|
||||
XMesaColormap cmap,
|
||||
int format, int target, int mipmap);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ typedef XColor XMesaColor;
|
|||
#define XMesaDrawPoints XDrawPoints
|
||||
#define XMesaDrawLine XDrawLine
|
||||
#define XMesaFillRectangle XFillRectangle
|
||||
#define XMesaGetImage XGetImage
|
||||
#define XMesaPutImage XPutImage
|
||||
#define XMesaCopyArea XCopyArea
|
||||
|
||||
|
|
|
|||
|
|
@ -39,11 +39,19 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#ifndef _XMESA_XF86_H_
|
||||
#define _XMESA_XF86_H_
|
||||
|
||||
#include "GL/glxtokens.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "servermd.h"
|
||||
|
||||
typedef struct _XMesaImageRec XMesaImage;
|
||||
|
||||
typedef struct _XMesaImageRec {
|
||||
int width, height;
|
||||
char *data;
|
||||
int bytes_per_line; /* Padded to 32 bits */
|
||||
int bits_per_pixel;
|
||||
} XMesaImage;
|
||||
|
||||
typedef ScreenRec XMesaDisplay;
|
||||
typedef PixmapPtr XMesaPixmap;
|
||||
|
|
@ -120,6 +128,26 @@ do { \
|
|||
(*__gc->ops->PolyFillRect)((DrawablePtr)__b, __gc, 1, __r); \
|
||||
} while (0)
|
||||
|
||||
static _X_INLINE XMesaImage *XMesaGetImage(XMesaDisplay *dpy, PixmapPtr p, int x,
|
||||
int y, unsigned int width,
|
||||
unsigned int height,
|
||||
unsigned long plane_mask, int format)
|
||||
{
|
||||
XMesaImage *img = Xcalloc(sizeof(*img));
|
||||
|
||||
img->width = p->drawable.width;
|
||||
img->height = p->drawable.height;
|
||||
img->bits_per_pixel = p->drawable.bitsPerPixel;
|
||||
img->bytes_per_line = PixmapBytePad(width, p->drawable.depth);
|
||||
img->data = malloc(height * img->bytes_per_line);
|
||||
|
||||
/* Assumes: Images are always in ZPixmap format */
|
||||
(*p->drawable.pScreen->GetImage)(&p->drawable, x, y, width, height,
|
||||
plane_mask, ZPixmap, img->data);
|
||||
|
||||
return img;
|
||||
}
|
||||
|
||||
#define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \
|
||||
do { \
|
||||
/* Assumes: Images are always in ZPixmap format */ \
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
* Added GL_EXT_packed_depth_stencil support on 15 March 2006.
|
||||
* Added GL_EXT_framebuffer_object support on 27 March 2006.
|
||||
* Removed old SGIX extension support on 5 April 2006.
|
||||
* Added vertex / fragment program support on 7 June 2007 (Ian Romanick).
|
||||
*
|
||||
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
|
||||
*
|
||||
|
|
@ -34,6 +35,7 @@
|
|||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <GL/glut.h>
|
||||
#include "showbuffer.h"
|
||||
|
|
@ -67,8 +69,27 @@ static GLboolean NeedNewShadowMap = GL_FALSE;
|
|||
static GLuint ShadowTexture, GrayTexture;
|
||||
static GLuint ShadowFBO;
|
||||
|
||||
static GLfloat lightModelview[16];
|
||||
static GLfloat lightProjection[16];
|
||||
|
||||
static GLuint vert_prog;
|
||||
static GLuint frag_progs[3];
|
||||
static GLuint curr_frag = 0;
|
||||
static GLuint max_frag = 1;
|
||||
|
||||
#define NUM_FRAG_MODES 3
|
||||
static const char *FragProgNames[] = {
|
||||
"fixed-function",
|
||||
"program without \"OPTION ARB_fragment_program_shadow\"",
|
||||
"program with \"OPTION ARB_fragment_program_shadow\"",
|
||||
};
|
||||
|
||||
static GLboolean HaveFBO = GL_FALSE;
|
||||
static GLboolean UseFBO = GL_FALSE;
|
||||
static GLboolean HaveVP = GL_FALSE;
|
||||
static GLboolean HaveFP = GL_FALSE;
|
||||
static GLboolean HaveFP_Shadow = GL_FALSE;
|
||||
static GLboolean UseVP = GL_FALSE;
|
||||
static GLboolean HavePackedDepthStencil = GL_FALSE;
|
||||
static GLboolean UsePackedDepthStencil = GL_FALSE;
|
||||
static GLboolean HaveEXTshadowFuncs = GL_FALSE;
|
||||
|
|
@ -91,6 +112,103 @@ static GLuint DisplayMode;
|
|||
|
||||
|
||||
|
||||
#define MAT4_MUL(dest_vec, src_mat, src_vec) \
|
||||
"DP4 " dest_vec ".x, " src_mat "[0], " src_vec ";\n" \
|
||||
"DP4 " dest_vec ".y, " src_mat "[1], " src_vec ";\n" \
|
||||
"DP4 " dest_vec ".z, " src_mat "[2], " src_vec ";\n" \
|
||||
"DP4 " dest_vec ".w, " src_mat "[3], " src_vec ";\n"
|
||||
|
||||
#define MAT3_MUL(dest_vec, src_mat, src_vec) \
|
||||
"DP3 " dest_vec ".x, " src_mat "[0], " src_vec ";\n" \
|
||||
"DP3 " dest_vec ".y, " src_mat "[1], " src_vec ";\n" \
|
||||
"DP3 " dest_vec ".z, " src_mat "[2], " src_vec ";\n"
|
||||
|
||||
#define NORMALIZE(dest, src) \
|
||||
"DP3 " dest ".w, " src ", " src ";\n" \
|
||||
"RSQ " dest ".w, " dest ".w;\n" \
|
||||
"MUL " dest ", " src ", " dest ".w;\n"
|
||||
|
||||
/**
|
||||
* Vertex program for shadow mapping.
|
||||
*/
|
||||
static const char vert_code[] =
|
||||
"!!ARBvp1.0\n"
|
||||
"ATTRIB iPos = vertex.position;\n"
|
||||
"ATTRIB iNorm = vertex.normal;\n"
|
||||
|
||||
"PARAM mvinv[4] = { state.matrix.modelview.invtrans };\n"
|
||||
"PARAM mvp[4] = { state.matrix.mvp };\n"
|
||||
"PARAM mv[4] = { state.matrix.modelview };\n"
|
||||
"PARAM texmat[4] = { state.matrix.texture[0] };\n"
|
||||
"PARAM lightPos = state.light[0].position;\n"
|
||||
"PARAM ambientCol = state.lightprod[0].ambient;\n"
|
||||
"PARAM diffuseCol = state.lightprod[0].diffuse;\n"
|
||||
|
||||
"TEMP n, lightVec;\n"
|
||||
"ALIAS V = lightVec;\n"
|
||||
"ALIAS NdotL = n;\n"
|
||||
|
||||
"OUTPUT oPos = result.position;\n"
|
||||
"OUTPUT oColor = result.color;\n"
|
||||
"OUTPUT oTex = result.texcoord[0];\n"
|
||||
|
||||
/* Transform the vertex to clip coordinates. */
|
||||
MAT4_MUL("oPos", "mvp", "iPos")
|
||||
|
||||
/* Transform the vertex to eye coordinates. */
|
||||
MAT4_MUL("V", "mv", "iPos")
|
||||
|
||||
/* Transform the vertex to projected light coordinates. */
|
||||
MAT4_MUL("oTex", "texmat", "iPos")
|
||||
|
||||
/* Transform the normal to eye coordinates. */
|
||||
MAT3_MUL("n", "mvinv", "iNorm")
|
||||
|
||||
/* Calculate the vector from the vertex to the light in eye
|
||||
* coordinates.
|
||||
*/
|
||||
"SUB lightVec, lightPos, V;\n"
|
||||
NORMALIZE("lightVec", "lightVec")
|
||||
|
||||
/* Compute diffuse lighting coefficient.
|
||||
*/
|
||||
"DP3 NdotL.x, n, lightVec;\n"
|
||||
"MAX NdotL.x, NdotL.x, {0.0};\n"
|
||||
"MIN NdotL.x, NdotL.x, {1.0};\n"
|
||||
|
||||
/* Accumulate color contributions.
|
||||
*/
|
||||
"MOV oColor, diffuseCol;\n"
|
||||
"MAD oColor.xyz, NdotL.x, diffuseCol, ambientCol;\n"
|
||||
"END\n"
|
||||
;
|
||||
|
||||
static const char frag_code[] =
|
||||
"!!ARBfp1.0\n"
|
||||
|
||||
"TEMP shadow, temp;\n"
|
||||
|
||||
"TXP shadow, fragment.texcoord[0], texture[0], 2D;\n"
|
||||
"RCP temp.x, fragment.texcoord[0].w;\n"
|
||||
"MUL temp.x, temp.x, fragment.texcoord[0].z;\n"
|
||||
"SGE shadow, shadow.x, temp.x;\n"
|
||||
"MUL result.color.rgb, fragment.color, shadow.x;\n"
|
||||
"MOV result.color.a, fragment.color;\n"
|
||||
"END\n"
|
||||
;
|
||||
|
||||
static const char frag_shadow_code[] =
|
||||
"!!ARBfp1.0\n"
|
||||
"OPTION ARB_fragment_program_shadow;\n"
|
||||
|
||||
"TEMP shadow;\n"
|
||||
|
||||
"TXP shadow, fragment.texcoord[0], texture[0], SHADOW2D;\n"
|
||||
"MUL result.color.rgb, fragment.color, shadow.x;\n"
|
||||
"MOV result.color.a, fragment.color.a;\n"
|
||||
"END\n"
|
||||
;
|
||||
|
||||
static void
|
||||
DrawScene(void)
|
||||
{
|
||||
|
|
@ -134,27 +252,56 @@ DrawScene(void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Load the GL_TEXTURE matrix with the projection from the light
|
||||
* source's point of view.
|
||||
/**
|
||||
* Calculate modelview and project matrices for the light
|
||||
*
|
||||
* Stores the results in \c lightProjection (projection matrix) and
|
||||
* \c lightModelview (modelview matrix).
|
||||
*/
|
||||
static void
|
||||
MakeShadowMatrix(const GLfloat lightPos[4], const GLfloat spotDir[3],
|
||||
GLfloat spotAngle, GLfloat shadowNear, GLfloat shadowFar)
|
||||
{
|
||||
GLfloat d;
|
||||
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
/* compute frustum to enclose spot light cone */
|
||||
const GLfloat d = shadowNear * tan(spotAngle);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.5, 0.5, 0.5 + Bias);
|
||||
glScalef(0.5, 0.5, 0.5);
|
||||
d = shadowNear * tan(spotAngle);
|
||||
glFrustum(-d, d, -d, d, shadowNear, shadowFar);
|
||||
glGetFloatv(GL_PROJECTION_MATRIX, lightProjection);
|
||||
glPopMatrix();
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
gluLookAt(lightPos[0], lightPos[1], lightPos[2],
|
||||
lightPos[0] + spotDir[0],
|
||||
lightPos[1] + spotDir[1],
|
||||
lightPos[2] + spotDir[2],
|
||||
0, 1, 0);
|
||||
0.0, 1.0, 0.0);
|
||||
glGetFloatv(GL_MODELVIEW_MATRIX, lightModelview);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load \c GL_TEXTURE matrix with light's MVP matrix.
|
||||
*/
|
||||
static void SetShadowTextureMatrix(void)
|
||||
{
|
||||
static const GLfloat biasMatrix[16] = {
|
||||
0.5, 0.0, 0.0, 0.0,
|
||||
0.0, 0.5, 0.0, 0.0,
|
||||
0.0, 0.0, 0.5, 0.0,
|
||||
0.5, 0.5, 0.5, 1.0,
|
||||
};
|
||||
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadMatrixf(biasMatrix);
|
||||
glTranslatef(0.0, 0.0, Bias);
|
||||
glMultMatrixf(lightProjection);
|
||||
glMultMatrixf(lightModelview);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
|
|
@ -258,7 +405,6 @@ RenderShadowMap(void)
|
|||
{
|
||||
GLenum depthFormat; /* GL_DEPTH_COMPONENT or GL_DEPTH_STENCIL_EXT */
|
||||
GLenum depthType; /* GL_UNSIGNED_INT_24_8_EXT or GL_UNSIGNED_INT */
|
||||
float d;
|
||||
|
||||
if (WindowWidth >= 1024 && WindowHeight >= 1024) {
|
||||
ShadowTexWidth = ShadowTexHeight = 1024;
|
||||
|
|
@ -283,17 +429,11 @@ RenderShadowMap(void)
|
|||
depthType = GL_UNSIGNED_INT;
|
||||
}
|
||||
|
||||
/* compute frustum to enclose spot light cone */
|
||||
d = ShadowNear * tan(SpotAngle);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-d, d, -d, d, ShadowNear, ShadowFar);
|
||||
glLoadMatrixf(lightProjection);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
gluLookAt(LightPos[0], LightPos[1], LightPos[2], /* from */
|
||||
0, 0, 0, /* target */
|
||||
0, 1, 0); /* up */
|
||||
glLoadMatrixf(lightModelview);
|
||||
|
||||
if (UseFBO) {
|
||||
GLenum fbo_status;
|
||||
|
|
@ -389,10 +529,8 @@ ShowShadowMap(void)
|
|||
DisableTexgen();
|
||||
|
||||
/* interpret texture's depth values as luminance values */
|
||||
#if defined(GL_ARB_shadow)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE_ARB, GL_LUMINANCE);
|
||||
#endif
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
|
||||
glBegin(GL_POLYGON);
|
||||
|
|
@ -420,6 +558,7 @@ Display(void)
|
|||
LightPos, SpotDir);
|
||||
|
||||
if (NeedNewShadowMap) {
|
||||
MakeShadowMatrix(LightPos, SpotDir, SpotAngle, ShadowNear, ShadowFar);
|
||||
RenderShadowMap();
|
||||
NeedNewShadowMap = GL_FALSE;
|
||||
}
|
||||
|
|
@ -457,12 +596,11 @@ Display(void)
|
|||
}
|
||||
|
||||
if (DisplayMode == SHOW_DEPTH_MAPPING) {
|
||||
#if defined(GL_ARB_shadow)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE);
|
||||
#endif
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
MakeShadowMatrix(LightPos, SpotDir, SpotAngle, ShadowNear, ShadowFar);
|
||||
|
||||
SetShadowTextureMatrix();
|
||||
EnableIdentityTexgen();
|
||||
}
|
||||
else if (DisplayMode == SHOW_DISTANCE) {
|
||||
|
|
@ -476,20 +614,42 @@ Display(void)
|
|||
}
|
||||
else {
|
||||
assert(DisplayMode == SHOW_SHADOWS);
|
||||
#if defined(GL_ARB_shadow)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB,
|
||||
GL_COMPARE_R_TO_TEXTURE_ARB);
|
||||
#endif
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
if (curr_frag > 0) {
|
||||
glEnable(GL_FRAGMENT_PROGRAM_ARB);
|
||||
}
|
||||
else {
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
}
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
MakeShadowMatrix(LightPos, SpotDir, SpotAngle, ShadowNear, ShadowFar);
|
||||
EnableIdentityTexgen();
|
||||
|
||||
SetShadowTextureMatrix();
|
||||
|
||||
if (UseVP) {
|
||||
glEnable(GL_VERTEX_PROGRAM_ARB);
|
||||
}
|
||||
else {
|
||||
glEnable(GL_LIGHTING);
|
||||
EnableIdentityTexgen();
|
||||
}
|
||||
}
|
||||
|
||||
DrawScene();
|
||||
|
||||
DisableTexgen();
|
||||
glDisable(GL_TEXTURE_1D);
|
||||
if (UseVP) {
|
||||
glDisable(GL_VERTEX_PROGRAM_ARB);
|
||||
}
|
||||
else {
|
||||
DisableTexgen();
|
||||
glDisable(GL_LIGHTING);
|
||||
}
|
||||
|
||||
if (curr_frag > 0) {
|
||||
glDisable(GL_FRAGMENT_PROGRAM_ARB);
|
||||
}
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
|
|
@ -561,6 +721,14 @@ Key(unsigned char key, int x, int y)
|
|||
case 'm':
|
||||
DisplayMode = SHOW_DEPTH_MAPPING;
|
||||
break;
|
||||
case 'M':
|
||||
curr_frag = (1 + curr_frag) % max_frag;
|
||||
printf("Using fragment %s\n", FragProgNames[curr_frag]);
|
||||
|
||||
if (HaveFP) {
|
||||
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, frag_progs[curr_frag]);
|
||||
}
|
||||
break;
|
||||
case 'n':
|
||||
case 's':
|
||||
case ' ':
|
||||
|
|
@ -572,10 +740,8 @@ Key(unsigned char key, int x, int y)
|
|||
if (Operator >= 8)
|
||||
Operator = 0;
|
||||
printf("Operator: %s\n", OperatorName[Operator]);
|
||||
#if defined(GL_ARB_shadow)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB,
|
||||
OperatorFunc[Operator]);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case 'p':
|
||||
|
|
@ -592,6 +758,11 @@ Key(unsigned char key, int x, int y)
|
|||
NeedNewShadowMap = GL_TRUE;
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
UseVP = !UseVP && HaveVP;
|
||||
printf("Using vertex %s mode.\n",
|
||||
UseVP ? "program" : "fixed-function");
|
||||
break;
|
||||
case 'z':
|
||||
Zrot -= step;
|
||||
break;
|
||||
|
|
@ -646,28 +817,62 @@ SpecialKey(int key, int x, int y)
|
|||
}
|
||||
|
||||
|
||||
/* A helper for finding errors in program strings */
|
||||
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 GLuint
|
||||
compile_program(GLenum target, const char *code)
|
||||
{
|
||||
GLuint p;
|
||||
GLint errorPos;
|
||||
|
||||
|
||||
glGenProgramsARB(1, & p);
|
||||
|
||||
glBindProgramARB(target, p);
|
||||
glProgramStringARB(target, GL_PROGRAM_FORMAT_ASCII_ARB,
|
||||
strlen(code), code);
|
||||
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
|
||||
if (glGetError() != GL_NO_ERROR || errorPos != -1) {
|
||||
int l = FindLine(code, errorPos);
|
||||
printf("Fragment Program Error (pos=%d line=%d): %s\n", errorPos, l,
|
||||
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
glBindProgramARB(target, 0);
|
||||
return p;
|
||||
}
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
static const GLfloat borderColor[4] = {1.0, 0.0, 0.0, 0.0};
|
||||
|
||||
#if defined(GL_ARB_depth_texture) && defined(GL_ARB_shadow)
|
||||
if (!glutExtensionSupported("GL_ARB_depth_texture") ||
|
||||
!glutExtensionSupported("GL_ARB_shadow")) {
|
||||
#else
|
||||
if (1) {
|
||||
#endif
|
||||
printf("Sorry, this demo requires the GL_ARB_depth_texture and GL_ARB_shadow extensions\n");
|
||||
exit(1);
|
||||
}
|
||||
printf("Using GL_ARB_depth_texture and GL_ARB_shadow\n");
|
||||
|
||||
#if defined(GL_ARB_shadow_ambient)
|
||||
HaveVP = glutExtensionSupported("GL_ARB_vertex_program");
|
||||
HaveFP = glutExtensionSupported("GL_ARB_fragment_program");
|
||||
HaveFP_Shadow = glutExtensionSupported("GL_ARB_fragment_program_shadow");
|
||||
|
||||
HaveShadowAmbient = glutExtensionSupported("GL_ARB_shadow_ambient");
|
||||
if (HaveShadowAmbient) {
|
||||
printf("and GL_ARB_shadow_ambient\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
HaveEXTshadowFuncs = glutExtensionSupported("GL_EXT_shadow_funcs");
|
||||
|
||||
|
|
@ -690,15 +895,12 @@ Init(void)
|
|||
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||
#if defined(GL_ARB_shadow)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB,
|
||||
GL_COMPARE_R_TO_TEXTURE_ARB);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);
|
||||
#endif
|
||||
|
||||
if (HaveShadowAmbient) {
|
||||
#if defined(GL_ARB_shadow_ambient)
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FAIL_VALUE_ARB, 0.3);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(GL_EXT_framebuffer_object)
|
||||
|
|
@ -733,6 +935,25 @@ Init(void)
|
|||
256, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, image);
|
||||
}
|
||||
|
||||
if (HaveVP) {
|
||||
vert_prog = compile_program(GL_VERTEX_PROGRAM_ARB, vert_code);
|
||||
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, vert_prog);
|
||||
}
|
||||
|
||||
max_frag = 1;
|
||||
frag_progs[0] = 0;
|
||||
|
||||
if (HaveFP) {
|
||||
frag_progs[1] = compile_program(GL_FRAGMENT_PROGRAM_ARB, frag_code);
|
||||
max_frag = 2;
|
||||
}
|
||||
|
||||
if (HaveFP && HaveFP_Shadow) {
|
||||
frag_progs[2] = compile_program(GL_FRAGMENT_PROGRAM_ARB,
|
||||
frag_shadow_code);
|
||||
max_frag = 3;
|
||||
}
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
|
|
@ -751,6 +972,8 @@ PrintHelp(void)
|
|||
printf(" f = toggle nearest/bilinear texture filtering\n");
|
||||
printf(" b/B = decrease/increase shadow map Z bias\n");
|
||||
printf(" p = toggle use of packed depth/stencil\n");
|
||||
printf(" M = cycle through fragment program modes\n");
|
||||
printf(" v = toggle vertex program modes\n");
|
||||
printf(" cursor keys = rotate scene\n");
|
||||
printf(" <shift> + cursor keys = rotate light source\n");
|
||||
if (HaveEXTshadowFuncs)
|
||||
|
|
|
|||
|
|
@ -333,13 +333,13 @@ menu(int option)
|
|||
smooth = 0;
|
||||
break;
|
||||
case 10:
|
||||
glPointSize(4.0);
|
||||
glPointSize(16.0);
|
||||
break;
|
||||
case 11:
|
||||
glPointSize(8.0);
|
||||
glPointSize(32.0);
|
||||
break;
|
||||
case 12:
|
||||
glPointSize(16.0);
|
||||
glPointSize(64.0);
|
||||
break;
|
||||
case 13:
|
||||
spin = 1 - spin;
|
||||
|
|
@ -411,19 +411,19 @@ key(unsigned char c, int x, int y)
|
|||
glutPostRedisplay();
|
||||
break;
|
||||
case '1':
|
||||
glPointSize(2.0);
|
||||
glPointSize(16.0);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case '2':
|
||||
glPointSize(4.0);
|
||||
glPointSize(32.0);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case '3':
|
||||
glPointSize(8.0);
|
||||
glPointSize(64.0);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case '4':
|
||||
glPointSize(16.0);
|
||||
glPointSize(128.0);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case 27:
|
||||
|
|
@ -526,9 +526,9 @@ main(int argc, char **argv)
|
|||
glutAddMenuEntry("Threshold 10", 7);
|
||||
glutAddMenuEntry("Point smooth on", 8);
|
||||
glutAddMenuEntry("Point smooth off", 9);
|
||||
glutAddMenuEntry("Point size 4", 10);
|
||||
glutAddMenuEntry("Point size 8", 11);
|
||||
glutAddMenuEntry("Point size 16", 12);
|
||||
glutAddMenuEntry("Point size 16", 10);
|
||||
glutAddMenuEntry("Point size 32", 11);
|
||||
glutAddMenuEntry("Point size 64", 12);
|
||||
glutAddMenuEntry("Toggle spin", 13);
|
||||
glutAddMenuEntry("200 points ", 14);
|
||||
glutAddMenuEntry("500 points ", 15);
|
||||
|
|
@ -544,7 +544,7 @@ main(int argc, char **argv)
|
|||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glPointSize(16.0);
|
||||
glPointSize(32.0);
|
||||
#ifdef GL_ARB_point_parameters
|
||||
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,11 +23,21 @@
|
|||
#include <GL/glfbdev.h>
|
||||
#include <math.h>
|
||||
|
||||
#define DEFAULT_DEPTH 8
|
||||
|
||||
/**
|
||||
* Choose one of these modes
|
||||
*/
|
||||
/*static const int XRes = 1280, YRes = 1024, Hz = 75;*/
|
||||
/*static const int XRes = 1280, YRes = 1024, Hz = 70;*/
|
||||
/*static const int XRes = 1280, YRes = 1024, Hz = 60;*/
|
||||
static const int XRes = 1024, YRes = 768, Hz = 70;
|
||||
|
||||
static int DesiredDepth = 32;
|
||||
|
||||
static int NumFrames = 100;
|
||||
|
||||
static struct fb_fix_screeninfo FixedInfo;
|
||||
static struct fb_var_screeninfo VarInfo, OrigVarInfo;
|
||||
static int DesiredDepth = 0;
|
||||
static int OriginalVT = -1;
|
||||
static int ConsoleFD = -1;
|
||||
static int FrameBufferFD = -1;
|
||||
|
|
@ -227,7 +237,6 @@ initialize_fbdev( void )
|
|||
VarInfo = OrigVarInfo;
|
||||
|
||||
/* set the depth, resolution, etc */
|
||||
DesiredDepth = 32;
|
||||
if (DesiredDepth)
|
||||
VarInfo.bits_per_pixel = DesiredDepth;
|
||||
|
||||
|
|
@ -251,16 +260,60 @@ initialize_fbdev( void )
|
|||
VarInfo.blue.length = 8;
|
||||
VarInfo.transp.length = 8;
|
||||
}
|
||||
/* timing values taken from /etc/fb.modes (1280x1024 @ 75Hz) */
|
||||
VarInfo.xres_virtual = VarInfo.xres = 1280;
|
||||
VarInfo.yres_virtual = VarInfo.yres = 1024;
|
||||
VarInfo.pixclock = 7408;
|
||||
VarInfo.left_margin = 248;
|
||||
VarInfo.right_margin = 16;
|
||||
VarInfo.upper_margin = 38;
|
||||
VarInfo.lower_margin = 1;
|
||||
VarInfo.hsync_len = 144;
|
||||
VarInfo.vsync_len = 3;
|
||||
|
||||
/* timing values taken from /etc/fb.modes */
|
||||
if (XRes == 1280 && YRes == 1024) {
|
||||
VarInfo.xres_virtual = VarInfo.xres = XRes;
|
||||
VarInfo.yres_virtual = VarInfo.yres = YRes;
|
||||
if (Hz == 75) {
|
||||
VarInfo.pixclock = 7408;
|
||||
VarInfo.left_margin = 248;
|
||||
VarInfo.right_margin = 16;
|
||||
VarInfo.upper_margin = 38;
|
||||
VarInfo.lower_margin = 1;
|
||||
VarInfo.hsync_len = 144;
|
||||
VarInfo.vsync_len = 3;
|
||||
}
|
||||
else if (Hz == 70) {
|
||||
VarInfo.pixclock = 7937;
|
||||
VarInfo.left_margin = 216;
|
||||
VarInfo.right_margin = 80;
|
||||
VarInfo.upper_margin = 36;
|
||||
VarInfo.lower_margin = 1;
|
||||
VarInfo.hsync_len = 112;
|
||||
VarInfo.vsync_len = 5;
|
||||
}
|
||||
else if (Hz == 60) {
|
||||
VarInfo.pixclock = 9260;
|
||||
VarInfo.left_margin = 248;
|
||||
VarInfo.right_margin = 48;
|
||||
VarInfo.upper_margin = 38;
|
||||
VarInfo.lower_margin = 1;
|
||||
VarInfo.hsync_len = 112;
|
||||
VarInfo.vsync_len = 3;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "invalid rate for 1280x1024\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else if (XRes == 1024 && YRes == 768 && Hz == 70) {
|
||||
VarInfo.xres_virtual = VarInfo.xres = XRes;
|
||||
VarInfo.yres_virtual = VarInfo.yres = YRes;
|
||||
if (Hz == 70) {
|
||||
VarInfo.pixclock = 13334;
|
||||
VarInfo.left_margin = 144;
|
||||
VarInfo.right_margin = 24;
|
||||
VarInfo.upper_margin = 29;
|
||||
VarInfo.lower_margin = 3;
|
||||
VarInfo.hsync_len = 136;
|
||||
VarInfo.vsync_len = 6;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "invalid rate for 1024x768\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
VarInfo.xoffset = 0;
|
||||
VarInfo.yoffset = 0;
|
||||
|
|
@ -338,7 +391,7 @@ initialize_fbdev( void )
|
|||
printf("MMIOAddress = %p\n", MMIOAddress);
|
||||
|
||||
/* try out some simple MMIO register reads */
|
||||
if (1)
|
||||
if (0)
|
||||
{
|
||||
typedef unsigned int CARD32;
|
||||
typedef unsigned char CARD8;
|
||||
|
|
@ -452,6 +505,7 @@ gltest( void )
|
|||
GLFBDevVisualPtr vis;
|
||||
int bytes, r, g, b, a;
|
||||
float ang;
|
||||
int i;
|
||||
|
||||
printf("GLFBDEV_VENDOR = %s\n", glFBDevGetString(GLFBDEV_VENDOR));
|
||||
printf("GLFBDEV_VERSION = %s\n", glFBDevGetString(GLFBDEV_VERSION));
|
||||
|
|
@ -491,13 +545,17 @@ gltest( void )
|
|||
glEnable(GL_LIGHT0);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
for (ang = 0; ang <= 180; ang += 15) {
|
||||
printf("Drawing %d frames...\n", NumFrames);
|
||||
|
||||
ang = 0.0;
|
||||
for (i = 0; i < NumFrames; i++) {
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glPushMatrix();
|
||||
glRotatef(ang, 1, 0, 0);
|
||||
doughnut(1, 3, 40, 20);
|
||||
glPopMatrix();
|
||||
glFBDevSwapBuffers(buf);
|
||||
ang += 15.0;
|
||||
}
|
||||
|
||||
/* clean up */
|
||||
|
|
@ -510,12 +568,29 @@ gltest( void )
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
parse_args(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-f") == 0) {
|
||||
NumFrames = atoi(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main( int argc, char *argv[] )
|
||||
{
|
||||
signal(SIGUSR1, signal_handler); /* exit if someone tries a vt switch */
|
||||
signal(SIGSEGV, signal_handler); /* catch segfaults */
|
||||
|
||||
parse_args(argc, argv);
|
||||
|
||||
printf("Setting mode to %d x %d @ %d Hz, %d bpp\n", XRes, YRes, Hz, DesiredDepth);
|
||||
initialize_fbdev();
|
||||
gltest();
|
||||
shutdown_fbdev();
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ SOURCES = \
|
|||
arbvptest3.c \
|
||||
arbvptorus.c \
|
||||
arbvpwarpmesh.c \
|
||||
arraytexture.c \
|
||||
blendminmax.c \
|
||||
blendsquare.c \
|
||||
bufferobj.c \
|
||||
|
|
@ -54,6 +55,7 @@ SOURCES = \
|
|||
pbo.c \
|
||||
prog_parameter.c \
|
||||
projtex.c \
|
||||
random.c \
|
||||
readrate.c \
|
||||
seccolor.c \
|
||||
sharedtex.c \
|
||||
|
|
@ -117,6 +119,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
337
progs/tests/arraytexture.c
Normal 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;
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ static int Win;
|
|||
static int Width = 400, Height = 400;
|
||||
static GLuint FBobject, RBobjects[3];
|
||||
static GLfloat Xrot = 0.0, Yrot = 0.0;
|
||||
static GLuint Program;
|
||||
|
||||
|
||||
static void
|
||||
|
|
@ -40,6 +41,8 @@ Display(void)
|
|||
GL_COLOR_ATTACHMENT1_EXT
|
||||
};
|
||||
|
||||
glUseProgram_func(Program);
|
||||
|
||||
/* draw to user framebuffer */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBobject);
|
||||
|
||||
|
|
@ -71,10 +74,12 @@ Display(void)
|
|||
buffer);
|
||||
/* top half = colorbuffer 1 */
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT1_EXT);
|
||||
glReadPixels(0, Height/2, Width, Height / 2, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
buffer + Width * Height / 2 * 4);
|
||||
glReadPixels(0, Height/2, Width, Height - Height / 2,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
buffer + Width * (Height / 2) * 4);
|
||||
|
||||
/* draw to window */
|
||||
glUseProgram_func(0);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
glWindowPos2iARB(0, 0);
|
||||
glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||
|
|
@ -243,15 +248,15 @@ SetupShaders(void)
|
|||
" gl_FragData[1] = vec4(1.0) - gl_Color; \n"
|
||||
"}\n";
|
||||
|
||||
GLuint fragShader, program;
|
||||
GLuint fragShader;
|
||||
|
||||
fragShader = LoadAndCompileShader(GL_FRAGMENT_SHADER, fragShaderText);
|
||||
program = glCreateProgram_func();
|
||||
Program = glCreateProgram_func();
|
||||
|
||||
glAttachShader_func(program, fragShader);
|
||||
glLinkProgram_func(program);
|
||||
CheckLink(program);
|
||||
glUseProgram_func(program);
|
||||
glAttachShader_func(Program, fragShader);
|
||||
glLinkProgram_func(Program);
|
||||
CheckLink(Program);
|
||||
glUseProgram_func(Program);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
457
progs/tests/random.c
Normal file
457
progs/tests/random.c
Normal file
|
|
@ -0,0 +1,457 @@
|
|||
/**
|
||||
* Random rendering, to check for crashes, hangs, etc.
|
||||
*
|
||||
* Brian Paul
|
||||
* 21 June 2007
|
||||
*/
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
static int Win;
|
||||
static GLboolean Anim = GL_TRUE;
|
||||
static int Width = 200, Height = 200;
|
||||
static int DB = 0;
|
||||
static int MinVertexCount = 0, MaxVertexCount = 1000;
|
||||
static int Count = 0;
|
||||
|
||||
struct vertex
|
||||
{
|
||||
int type;
|
||||
float v[4];
|
||||
};
|
||||
|
||||
static int BufferSize = 10000;
|
||||
static struct vertex *Vbuffer = NULL;
|
||||
static int Vcount, Vprim;
|
||||
|
||||
enum {
|
||||
BEGIN,
|
||||
END,
|
||||
VERTEX2,
|
||||
VERTEX3,
|
||||
VERTEX4,
|
||||
COLOR3,
|
||||
COLOR4,
|
||||
TEX2,
|
||||
TEX3,
|
||||
TEX4,
|
||||
SECCOLOR3,
|
||||
NORMAL3
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This can be called from within gdb after a crash:
|
||||
* (gdb) call ReportState()
|
||||
*/
|
||||
static void
|
||||
ReportState(void)
|
||||
{
|
||||
static const struct {
|
||||
GLenum token;
|
||||
char *str;
|
||||
GLenum type;
|
||||
} state [] = {
|
||||
{ GL_ALPHA_TEST, "GL_ALPHA_TEST", GL_INT },
|
||||
{ GL_BLEND, "GL_BLEND", GL_INT },
|
||||
{ GL_CLIP_PLANE0, "GL_CLIP_PLANE0", GL_INT },
|
||||
{ GL_DEPTH_TEST, "GL_DEPTH_TEST", GL_INT },
|
||||
{ GL_LIGHTING, "GL_LIGHTING", GL_INT },
|
||||
{ GL_LINE_WIDTH, "GL_LINE_WIDTH", GL_FLOAT },
|
||||
{ GL_POINT_SIZE, "GL_POINT_SIZE", GL_FLOAT },
|
||||
{ GL_SHADE_MODEL, "GL_SHADE_MODEL", GL_INT },
|
||||
{ GL_SCISSOR_TEST, "GL_SCISSOR_TEST", GL_INT },
|
||||
{ 0, NULL, 0 }
|
||||
};
|
||||
|
||||
GLint i;
|
||||
|
||||
for (i = 0; state[i].token; i++) {
|
||||
if (state[i].type == GL_INT) {
|
||||
GLint v;
|
||||
glGetIntegerv(state[i].token, &v);
|
||||
printf("%s = %d\n", state[i].str, v);
|
||||
}
|
||||
else {
|
||||
GLfloat v;
|
||||
glGetFloatv(state[i].token, &v);
|
||||
printf("%s = %f\n", state[i].str, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
PrintVertex(const char *f, const struct vertex *v, int sz)
|
||||
{
|
||||
int i;
|
||||
printf("%s(", f);
|
||||
for (i = 0; i < sz; i++) {
|
||||
printf("%g%s", v->v[i], (i == sz-1) ? "" : ", ");
|
||||
}
|
||||
printf(");\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* This can be called from within gdb after a crash:
|
||||
* (gdb) call ReportState()
|
||||
*/
|
||||
static void
|
||||
LastPrim(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < Vcount; i++) {
|
||||
switch (Vbuffer[i].type) {
|
||||
case BEGIN:
|
||||
printf("glBegin(%d);\n", (int) Vbuffer[i].v[0]);
|
||||
break;
|
||||
case END:
|
||||
printf("glEnd();\n");
|
||||
break;
|
||||
case VERTEX2:
|
||||
PrintVertex("glVertex2f", Vbuffer + i, 2);
|
||||
break;
|
||||
case VERTEX3:
|
||||
PrintVertex("glVertex3f", Vbuffer + i, 3);
|
||||
break;
|
||||
case VERTEX4:
|
||||
PrintVertex("glVertex4f", Vbuffer + i, 4);
|
||||
break;
|
||||
case COLOR3:
|
||||
PrintVertex("glColor3f", Vbuffer + i, 3);
|
||||
break;
|
||||
case COLOR4:
|
||||
PrintVertex("glColor4f", Vbuffer + i, 4);
|
||||
break;
|
||||
case TEX2:
|
||||
PrintVertex("glTexCoord2f", Vbuffer + i, 2);
|
||||
break;
|
||||
case TEX3:
|
||||
PrintVertex("glTexCoord3f", Vbuffer + i, 3);
|
||||
break;
|
||||
case TEX4:
|
||||
PrintVertex("glTexCoord4f", Vbuffer + i, 4);
|
||||
break;
|
||||
case SECCOLOR3:
|
||||
PrintVertex("glSecondaryColor3f", Vbuffer + i, 3);
|
||||
break;
|
||||
case NORMAL3:
|
||||
PrintVertex("glNormal3f", Vbuffer + i, 3);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
RandomInt(int max)
|
||||
{
|
||||
if (max == 0)
|
||||
return 0;
|
||||
return rand() % max;
|
||||
}
|
||||
|
||||
static float
|
||||
RandomFloat(float min, float max)
|
||||
{
|
||||
int k = rand() % 10000;
|
||||
float x = min + (max - min) * k / 10000.0;
|
||||
return x;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return true if random number in [0,1] is <= percentile.
|
||||
*/
|
||||
static GLboolean
|
||||
RandomChoice(float percentile)
|
||||
{
|
||||
return RandomFloat(0.0, 1.0) <= percentile;
|
||||
}
|
||||
|
||||
static void
|
||||
RandomStateChange(void)
|
||||
{
|
||||
int k = RandomInt(19);
|
||||
switch (k) {
|
||||
case 0:
|
||||
glEnable(GL_BLEND);
|
||||
break;
|
||||
case 1:
|
||||
glDisable(GL_BLEND);
|
||||
break;
|
||||
case 2:
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
break;
|
||||
case 3:
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
break;
|
||||
case 4:
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
break;
|
||||
case 5:
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
break;
|
||||
case 6:
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
break;
|
||||
case 7:
|
||||
glPointSize(10.0);
|
||||
break;
|
||||
case 8:
|
||||
glPointSize(1.0);
|
||||
break;
|
||||
case 9:
|
||||
glLineWidth(10.0);
|
||||
break;
|
||||
case 10:
|
||||
glLineWidth(1.0);
|
||||
break;
|
||||
case 11:
|
||||
glEnable(GL_LIGHTING);
|
||||
break;
|
||||
case 12:
|
||||
glDisable(GL_LIGHTING);
|
||||
break;
|
||||
case 13:
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
break;
|
||||
case 14:
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
break;
|
||||
case 15:
|
||||
glEnable(GL_CLIP_PLANE0);
|
||||
break;
|
||||
case 16:
|
||||
glDisable(GL_CLIP_PLANE0);
|
||||
break;
|
||||
case 17:
|
||||
glShadeModel(GL_FLAT);
|
||||
break;
|
||||
case 18:
|
||||
glShadeModel(GL_SMOOTH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
RandomPrimitive(void)
|
||||
{
|
||||
int i;
|
||||
int len = MinVertexCount + RandomInt(MaxVertexCount - MinVertexCount);
|
||||
|
||||
Vprim = RandomInt(10);
|
||||
|
||||
glBegin(Vprim);
|
||||
Vbuffer[Vcount].type = BEGIN;
|
||||
Vbuffer[Vcount].v[0] = Vprim;
|
||||
Vcount++;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
Vbuffer[Vcount].v[0] = RandomFloat(-3, 3);
|
||||
Vbuffer[Vcount].v[1] = RandomFloat(-3, 3);
|
||||
Vbuffer[Vcount].v[2] = RandomFloat(-3, 3);
|
||||
Vbuffer[Vcount].v[3] = RandomFloat(-3, 3);
|
||||
int k = RandomInt(9);
|
||||
switch (k) {
|
||||
case 0:
|
||||
glVertex2fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = VERTEX2;
|
||||
break;
|
||||
case 1:
|
||||
glVertex3fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = VERTEX3;
|
||||
break;
|
||||
case 2:
|
||||
glVertex4fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = VERTEX4;
|
||||
break;
|
||||
case 3:
|
||||
glColor3fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = COLOR3;
|
||||
break;
|
||||
case 4:
|
||||
glColor4fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = COLOR4;
|
||||
break;
|
||||
case 5:
|
||||
glTexCoord2fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = TEX2;
|
||||
break;
|
||||
case 6:
|
||||
glTexCoord3fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = TEX3;
|
||||
break;
|
||||
case 7:
|
||||
glTexCoord4fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = TEX4;
|
||||
break;
|
||||
case 8:
|
||||
glSecondaryColor3fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = SECCOLOR3;
|
||||
break;
|
||||
case 9:
|
||||
glNormal3fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = NORMAL3;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
Vcount++;
|
||||
|
||||
if (Vcount >= BufferSize - 2) {
|
||||
/* reset */
|
||||
Vcount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Vbuffer[Vcount++].type = END;
|
||||
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
RandomDraw(void)
|
||||
{
|
||||
int i;
|
||||
GLboolean dlist = RandomChoice(0.1);
|
||||
if (dlist)
|
||||
glNewList(1, GL_COMPILE);
|
||||
for (i = 0; i < 3; i++) {
|
||||
RandomStateChange();
|
||||
}
|
||||
RandomPrimitive();
|
||||
|
||||
if (dlist) {
|
||||
glEndList();
|
||||
glCallList(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Idle(void)
|
||||
{
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Draw(void)
|
||||
{
|
||||
#if 1
|
||||
RandomDraw();
|
||||
Count++;
|
||||
#else
|
||||
/* cut & paste temp code here */
|
||||
#endif
|
||||
|
||||
assert(glGetError() == 0);
|
||||
|
||||
if (DB)
|
||||
glutSwapBuffers();
|
||||
else
|
||||
glFinish();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Reshape(int width, int height)
|
||||
{
|
||||
Width = width;
|
||||
Height = height;
|
||||
glViewport(0, 0, width, height);
|
||||
glScissor(20, 20, Width-40, Height-40);
|
||||
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, -15.0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Key(unsigned char key, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 27:
|
||||
glutDestroyWindow(Win);
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
static const GLdouble plane[4] = {1, 1, 0, 0};
|
||||
glDrawBuffer(GL_FRONT);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glEnable(GL_LIGHT0);
|
||||
glClipPlane(GL_CLIP_PLANE0, plane);
|
||||
|
||||
Vbuffer = (struct vertex *)
|
||||
malloc(BufferSize * sizeof(struct vertex));
|
||||
|
||||
/* silence warnings */
|
||||
(void) ReportState;
|
||||
(void) LastPrim;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ParseArgs(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-s") == 0) {
|
||||
int j = atoi(argv[i + 1]);
|
||||
printf("Random seed value: %d\n", j);
|
||||
srand(j);
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "-a") == 0) {
|
||||
i++;
|
||||
MinVertexCount = atoi(argv[i]);
|
||||
}
|
||||
else if (strcmp(argv[i], "-b") == 0) {
|
||||
i++;
|
||||
MaxVertexCount = atoi(argv[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
glutInitWindowPosition(0, 0);
|
||||
glutInitWindowSize(Width, Height);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
Win = glutCreateWindow(argv[0]);
|
||||
ParseArgs(argc, argv);
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
if (Anim)
|
||||
glutIdleFunc(Idle);
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -23,6 +23,7 @@ PROGS = glthreads \
|
|||
overlay \
|
||||
pbinfo \
|
||||
pbdemo \
|
||||
texture_from_pixmap \
|
||||
wincopy \
|
||||
xfont \
|
||||
xrotfontdemo \
|
||||
|
|
|
|||
396
progs/xdemos/texture_from_pixmap.c
Normal file
396
progs/xdemos/texture_from_pixmap.c
Normal file
|
|
@ -0,0 +1,396 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 7.1
|
||||
*
|
||||
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Test the GLX_EXT_texture_from_pixmap extension
|
||||
* Brian Paul
|
||||
* 19 May 2007
|
||||
*/
|
||||
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#define GLX_GLXEXT_PROTOTYPES
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glx.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
static float top, bottom;
|
||||
|
||||
static PFNGLXBINDTEXIMAGEEXTPROC glXBindTexImageEXT_func = NULL;
|
||||
static PFNGLXRELEASETEXIMAGEEXTPROC glXReleaseTexImageEXT_func = NULL;
|
||||
|
||||
|
||||
static Display *
|
||||
OpenDisplay(void)
|
||||
{
|
||||
int screen;
|
||||
Display *dpy;
|
||||
const char *ext;
|
||||
|
||||
dpy = XOpenDisplay(NULL);
|
||||
if (!dpy) {
|
||||
printf("Couldn't open default display!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
screen = DefaultScreen(dpy);
|
||||
ext = glXQueryExtensionsString(dpy, screen);
|
||||
if (!strstr(ext, "GLX_EXT_texture_from_pixmap")) {
|
||||
fprintf(stderr, "GLX_EXT_texture_from_pixmap not supported.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glXBindTexImageEXT_func = (PFNGLXBINDTEXIMAGEEXTPROC)
|
||||
glXGetProcAddress((GLubyte *) "glXBindTexImageEXT");
|
||||
glXReleaseTexImageEXT_func = (PFNGLXRELEASETEXIMAGEEXTPROC)
|
||||
glXGetProcAddress((GLubyte*) "glXReleaseTexImageEXT");
|
||||
|
||||
if (!glXBindTexImageEXT_func || !glXReleaseTexImageEXT_func) {
|
||||
fprintf(stderr, "glXGetProcAddress failed!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return dpy;
|
||||
}
|
||||
|
||||
|
||||
static GLXFBConfig
|
||||
ChoosePixmapFBConfig(Display *display)
|
||||
{
|
||||
int screen = DefaultScreen(display);
|
||||
GLXFBConfig *fbconfigs;
|
||||
int i, nfbconfigs, value;
|
||||
|
||||
fbconfigs = glXGetFBConfigs(display, screen, &nfbconfigs);
|
||||
for (i = 0; i < nfbconfigs; i++) {
|
||||
|
||||
glXGetFBConfigAttrib(display, fbconfigs[i], GLX_DRAWABLE_TYPE, &value);
|
||||
if (!(value & GLX_PIXMAP_BIT))
|
||||
continue;
|
||||
|
||||
glXGetFBConfigAttrib(display, fbconfigs[i],
|
||||
GLX_BIND_TO_TEXTURE_TARGETS_EXT, &value);
|
||||
if (!(value & GLX_TEXTURE_2D_BIT_EXT))
|
||||
continue;
|
||||
|
||||
glXGetFBConfigAttrib(display, fbconfigs[i],
|
||||
GLX_BIND_TO_TEXTURE_RGBA_EXT, &value);
|
||||
if (value == False) {
|
||||
glXGetFBConfigAttrib(display, fbconfigs[i],
|
||||
GLX_BIND_TO_TEXTURE_RGB_EXT, &value);
|
||||
if (value == False)
|
||||
continue;
|
||||
}
|
||||
|
||||
glXGetFBConfigAttrib(display, fbconfigs[i],
|
||||
GLX_Y_INVERTED_EXT, &value);
|
||||
if (value == True) {
|
||||
top = 0.0f;
|
||||
bottom = 1.0f;
|
||||
}
|
||||
else {
|
||||
top = 1.0f;
|
||||
bottom = 0.0f;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == nfbconfigs) {
|
||||
printf("Unable to find FBconfig for texturing\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return fbconfigs[i];
|
||||
}
|
||||
|
||||
|
||||
static GLXPixmap
|
||||
CreatePixmap(Display *dpy, GLXFBConfig config, int w, int h, Pixmap *p)
|
||||
{
|
||||
GLXPixmap gp;
|
||||
const int pixmapAttribs[] = {
|
||||
GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT,
|
||||
GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGB_EXT,
|
||||
None
|
||||
};
|
||||
Window root = RootWindow(dpy, 0);
|
||||
|
||||
*p = XCreatePixmap(dpy, root, w, h, 24);
|
||||
XSync(dpy, 0);
|
||||
gp = glXCreatePixmap(dpy, config, *p, pixmapAttribs);
|
||||
XSync(dpy, 0);
|
||||
|
||||
return gp;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
DrawPixmapImage(Display *dpy, Pixmap pm, int w, int h)
|
||||
{
|
||||
XGCValues gcvals;
|
||||
GC gc;
|
||||
|
||||
gcvals.background = 0;
|
||||
gc = XCreateGC(dpy, pm, GCBackground, &gcvals);
|
||||
|
||||
XSetForeground(dpy, gc, 0x0);
|
||||
XFillRectangle(dpy, pm, gc, 0, 0, w, h);
|
||||
|
||||
XSetForeground(dpy, gc, 0xff0000);
|
||||
XFillRectangle(dpy, pm, gc, 0, 0, 50, 50);
|
||||
|
||||
XSetForeground(dpy, gc, 0x00ff00);
|
||||
XFillRectangle(dpy, pm, gc, w - 50, 0, 50, 50);
|
||||
|
||||
XSetForeground(dpy, gc, 0x0000ff);
|
||||
XFillRectangle(dpy, pm, gc, 0, h - 50, 50, 50);
|
||||
|
||||
XSetForeground(dpy, gc, 0xffffff);
|
||||
XFillRectangle(dpy, pm, gc, h - 50, h - 50, 50, 50);
|
||||
|
||||
XSetForeground(dpy, gc, 0xffff00);
|
||||
XSetLineAttributes(dpy, gc, 3, LineSolid, CapButt, JoinBevel);
|
||||
XDrawLine(dpy, pm, gc, 0, 0, w, h);
|
||||
XDrawLine(dpy, pm, gc, 0, h, w, 0);
|
||||
|
||||
XFreeGC(dpy, gc);
|
||||
}
|
||||
|
||||
|
||||
static XVisualInfo *
|
||||
ChooseWindowVisual(Display *dpy)
|
||||
{
|
||||
int screen = DefaultScreen(dpy);
|
||||
XVisualInfo *visinfo;
|
||||
int attribs[] = {
|
||||
GLX_RGBA,
|
||||
GLX_RED_SIZE, 1,
|
||||
GLX_GREEN_SIZE, 1,
|
||||
GLX_BLUE_SIZE, 1,
|
||||
GLX_DOUBLEBUFFER,
|
||||
None
|
||||
};
|
||||
|
||||
visinfo = glXChooseVisual(dpy, screen, attribs);
|
||||
if (!visinfo) {
|
||||
printf("Unable to find RGB, double-buffered visual\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return visinfo;
|
||||
}
|
||||
|
||||
|
||||
static Window
|
||||
CreateWindow(Display *dpy, XVisualInfo *visinfo,
|
||||
int width, int height, const char *name)
|
||||
{
|
||||
int screen = DefaultScreen(dpy);
|
||||
Window win;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
Window root;
|
||||
|
||||
root = RootWindow(dpy, screen);
|
||||
|
||||
/* window attributes */
|
||||
attr.background_pixel = 0;
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
win = XCreateWindow(dpy, root, 0, 0, width, height,
|
||||
0, visinfo->depth, InputOutput,
|
||||
visinfo->visual, mask, &attr);
|
||||
if (win) {
|
||||
XSizeHints sizehints;
|
||||
sizehints.width = width;
|
||||
sizehints.height = height;
|
||||
sizehints.flags = USSize;
|
||||
XSetNormalHints(dpy, win, &sizehints);
|
||||
XSetStandardProperties(dpy, win, name, name,
|
||||
None, (char **)NULL, 0, &sizehints);
|
||||
|
||||
XMapWindow(dpy, win);
|
||||
}
|
||||
return win;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
BindPixmapTexture(Display *dpy, GLXPixmap gp)
|
||||
{
|
||||
GLuint texture;
|
||||
|
||||
glGenTextures(1, &texture);
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
|
||||
glXBindTexImageEXT_func(dpy, gp, GLX_FRONT_LEFT_EXT, NULL);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
/*
|
||||
glXReleaseTexImageEXT_func(display, glxpixmap, GLX_FRONT_LEFT_EXT);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Resize(Window win, unsigned int width, unsigned int height)
|
||||
{
|
||||
float sz = 1.5;
|
||||
glViewport(0, 0, width, height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-sz, sz, -sz, sz, -1.0, 1.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Redraw(Display *dpy, Window win, float rot)
|
||||
{
|
||||
glClearColor(0.25, 0.25, 0.25, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glPushMatrix();
|
||||
glRotatef(rot, 0, 0, 1);
|
||||
glRotatef(2.0 * rot, 1, 0, 0);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2d(0.0, bottom);
|
||||
glVertex2f(-1, -1);
|
||||
glTexCoord2d(1.0, bottom);
|
||||
glVertex2f( 1, -1);
|
||||
glTexCoord2d(1.0, top);
|
||||
glVertex2d(1.0, 1.0);
|
||||
glTexCoord2d(0.0, top);
|
||||
glVertex2f(-1.0, 1.0);
|
||||
glEnd();
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glXSwapBuffers(dpy, win);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
EventLoop(Display *dpy, Window win)
|
||||
{
|
||||
GLfloat rot = 0.0;
|
||||
int anim = 0;
|
||||
|
||||
while (1) {
|
||||
if (!anim || XPending(dpy) > 0) {
|
||||
XEvent event;
|
||||
XNextEvent(dpy, &event);
|
||||
|
||||
switch (event.type) {
|
||||
case Expose:
|
||||
Redraw(dpy, win, rot);
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
Resize(event.xany.window,
|
||||
event.xconfigure.width,
|
||||
event.xconfigure.height);
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
char buf[100];
|
||||
KeySym keySym;
|
||||
XComposeStatus stat;
|
||||
XLookupString(&event.xkey, buf, sizeof(buf), &keySym, &stat);
|
||||
if (keySym == XK_Escape) {
|
||||
return; /* exit */
|
||||
}
|
||||
else if (keySym == XK_r) {
|
||||
rot += 1.0;
|
||||
Redraw(dpy, win, rot);
|
||||
}
|
||||
else if (keySym == XK_a) {
|
||||
anim = !anim;
|
||||
}
|
||||
else if (keySym == XK_R) {
|
||||
rot -= 1.0;
|
||||
Redraw(dpy, win, rot);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
; /*no-op*/
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* animate */
|
||||
rot += 1.0;
|
||||
Redraw(dpy, win, rot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
Display *dpy;
|
||||
GLXFBConfig pixmapConfig;
|
||||
XVisualInfo *windowVis;
|
||||
GLXPixmap gp;
|
||||
Window win;
|
||||
GLXContext ctx;
|
||||
Pixmap p;
|
||||
|
||||
dpy = OpenDisplay();
|
||||
|
||||
pixmapConfig = ChoosePixmapFBConfig(dpy);
|
||||
windowVis = ChooseWindowVisual(dpy);
|
||||
win = CreateWindow(dpy, windowVis, 500, 500, "Texture From Pixmap");
|
||||
|
||||
gp = CreatePixmap(dpy, pixmapConfig, 512, 512, &p);
|
||||
DrawPixmapImage(dpy, p, 512, 512);
|
||||
|
||||
ctx = glXCreateContext(dpy, windowVis, NULL, True);
|
||||
if (!ctx) {
|
||||
printf("Couldn't create GLX context\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glXMakeCurrent(dpy, win, ctx);
|
||||
|
||||
BindPixmapTexture(dpy, gp);
|
||||
|
||||
EventLoop(dpy, win);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -43,10 +43,9 @@
|
|||
#include "definitions.h"
|
||||
#include "primitiveStream.h"
|
||||
#include "directedLine.h"
|
||||
#include "arc.h"
|
||||
|
||||
class Backend;
|
||||
class Arc;
|
||||
typedef Arc *Arc_ptr;
|
||||
|
||||
class reflexChain{
|
||||
Real2 *queue;
|
||||
|
|
|
|||
|
|
@ -28,14 +28,13 @@
|
|||
typedef void (GLUTCALLBACK *__GlutTimerCallback) ( int value );
|
||||
|
||||
typedef struct __GlutTimer_s {
|
||||
unsigned int interval;
|
||||
struct timeval interval;
|
||||
struct timeval expire;
|
||||
|
||||
__GlutTimerCallback func;
|
||||
int value;
|
||||
|
||||
struct __GlutTimer_s *next;
|
||||
struct __GlutTimer_s *prev;
|
||||
} __GlutTimer;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -207,8 +206,7 @@ glutIdleFunc( void (GLUTCALLBACK *func) (void) )
|
|||
void GLUTAPIENTRY
|
||||
glutTimerFunc( unsigned int msec, void (GLUTCALLBACK *func) (int value), int value )
|
||||
{
|
||||
__GlutTimer *timer;
|
||||
struct timeval now;
|
||||
__GlutTimer *timer;
|
||||
|
||||
if (!func)
|
||||
return;
|
||||
|
|
@ -217,24 +215,19 @@ glutTimerFunc( unsigned int msec, void (GLUTCALLBACK *func) (int value), int val
|
|||
if (!timer)
|
||||
__glutFatalError( "out of memory" );
|
||||
|
||||
gettimeofday( &now, NULL );
|
||||
|
||||
timer->interval = msec;
|
||||
timer->expire.tv_sec = now.tv_sec + (now.tv_usec/1000 + msec) / 1000;
|
||||
timer->expire.tv_usec = (now.tv_usec + msec*1000) % 1000000;
|
||||
timer->interval.tv_sec = msec / 1000;
|
||||
timer->interval.tv_usec = (msec % 1000) * 1000;
|
||||
|
||||
gettimeofday( &timer->expire, NULL );
|
||||
timer->expire.tv_usec += timer->interval.tv_usec;
|
||||
timer->expire.tv_sec += timer->interval.tv_sec + timer->expire.tv_usec/1000000;
|
||||
timer->expire.tv_usec %= 1000000;
|
||||
|
||||
timer->func = func;
|
||||
timer->value = value;
|
||||
|
||||
if (g_timers) {
|
||||
timer->prev = g_timers->prev;
|
||||
g_timers->prev->next = timer;
|
||||
g_timers->prev = timer;
|
||||
}
|
||||
else {
|
||||
g_timers = timer;
|
||||
g_timers->prev = timer;
|
||||
}
|
||||
timer->next = g_timers;
|
||||
g_timers = timer;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -254,12 +247,41 @@ __glutHandleTimers( void )
|
|||
g_idle = GL_FALSE;
|
||||
|
||||
cur->func( cur->value );
|
||||
|
||||
cur->expire.tv_sec += (cur->expire.tv_usec/1000 + cur->interval) / 1000;
|
||||
cur->expire.tv_usec = (cur->expire.tv_usec + cur->interval*1000) % 1000000;
|
||||
|
||||
cur->expire.tv_usec += cur->interval.tv_usec;
|
||||
cur->expire.tv_sec += cur->interval.tv_sec + cur->expire.tv_usec/1000000;
|
||||
cur->expire.tv_usec %= 1000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GLboolean
|
||||
__glutGetTimeout( int *ret_msec )
|
||||
{
|
||||
__GlutTimer *cur;
|
||||
struct timeval *time = NULL;
|
||||
struct timeval now;
|
||||
|
||||
for (cur = g_timers; cur; cur = cur->next) {
|
||||
if (time == NULL ||
|
||||
time->tv_sec > cur->expire.tv_sec ||
|
||||
(time->tv_sec == cur->expire.tv_sec &&
|
||||
time->tv_usec > cur->expire.tv_usec)) {
|
||||
time = &cur->expire;
|
||||
}
|
||||
}
|
||||
|
||||
if (time == NULL)
|
||||
return GL_FALSE;
|
||||
|
||||
gettimeofday( &now, NULL );
|
||||
|
||||
*ret_msec = (time->tv_sec - now.tv_sec) * 1000 +
|
||||
(time->tv_usec - now.tv_usec + 500) / 1000;
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
|
|
@ -275,4 +297,4 @@ __glutFreeTimers( void )
|
|||
|
||||
g_timers = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -435,13 +435,14 @@ glutMainLoop( void )
|
|||
{
|
||||
__glutAssert( events != NULL );
|
||||
|
||||
__glutHandleWindows();
|
||||
|
||||
while (GL_TRUE) {
|
||||
DFBEvent evt, prev;
|
||||
|
||||
g_idle = GL_TRUE;
|
||||
|
||||
__glutHandleTimers();
|
||||
__glutHandleWindows();
|
||||
|
||||
prev.clazz = DFEC_NONE;
|
||||
|
||||
|
|
@ -471,13 +472,19 @@ glutMainLoop( void )
|
|||
__glutHandleTimers();
|
||||
}
|
||||
|
||||
__glutHandleWindows();
|
||||
|
||||
if (g_idle) {
|
||||
if (idle_func) {
|
||||
idle_func();
|
||||
}
|
||||
else {
|
||||
int msec;
|
||||
__glutSetWindow( NULL );
|
||||
usleep( 500 );
|
||||
if (__glutGetTimeout( &msec ))
|
||||
events->WaitForEventWithTimeout( events, msec/1000, msec%1000 );
|
||||
else
|
||||
events->WaitForEvent( events );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ extern void __glutDestroyWindow( __GlutWindow *window );
|
|||
extern void __glutDestroyWindows( void );
|
||||
/* callback.c */
|
||||
extern void __glutHandleTimers( void );
|
||||
extern GLboolean __glutGetTimeout( int *ret_msec );
|
||||
extern void __glutFreeTimers( void );
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@
|
|||
#endif
|
||||
#include <X11/Xutil.h>
|
||||
#else
|
||||
#ifdef __MINGW32__
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#ifndef __CYGWIN32__
|
||||
#include <mmsystem.h> /* Win32 Multimedia API header. */
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@
|
|||
implied. This program is -not- in the public domain. */
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef __MINGW32__
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#ifndef __CYGWIN32__
|
||||
#include <mmsystem.h> /* Win32 Multimedia API header. */
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
/* The following added by Paul Garceau <pgarceau@teleport.com> */
|
||||
#if defined(__MINGW32__)
|
||||
#include <GL/gl.h>
|
||||
#include <time.h>
|
||||
#include <windows.h>
|
||||
struct timeval;
|
||||
|
|
|
|||
|
|
@ -6,16 +6,14 @@
|
|||
/* This program is freely distributable without licensing fees
|
||||
and is provided without guarantee or warrantee expressed or
|
||||
implied. This program is -not- in the public domain. */
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
|
||||
/* These definitions are missing from windows.h */
|
||||
WINGDIAPI int WINAPI wglChoosePixelFormat(HDC, PIXELFORMATDESCRIPTOR *);
|
||||
WINGDIAPI int WINAPI wglDescribePixelFormat(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
|
||||
WINGDIAPI int WINAPI wglGetPixelFormat(HDC);
|
||||
WINGDIAPI BOOL WINAPI wglSetPixelFormat(HDC, int, PIXELFORMATDESCRIPTOR *);
|
||||
WINGDIAPI BOOL WINAPI wglSwapBuffers(HDC);
|
||||
|
||||
|
||||
/* Type definitions (conversions) */
|
||||
typedef int Visual; /* Win32 equivalent of X11 type */
|
||||
|
|
|
|||
|
|
@ -2434,6 +2434,7 @@ void (*glXGetProcAddress(const GLubyte *procname))( void )
|
|||
return _glapi_get_proc_address((const char *) procname);
|
||||
}
|
||||
|
||||
void (*glXGetProcAddressARB(const GLubyte *procName))( void ) __attribute__ ((alias ("glXGetProcAddress")));
|
||||
|
||||
/**
|
||||
* \brief Query the Mini GLX version.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -176,9 +176,9 @@ clean:
|
|||
-rm -f */*/*.o
|
||||
-rm -f depend depend.bak libmesa.a
|
||||
-rm -f drivers/*/*.o
|
||||
(cd drivers/dri ; $(MAKE) clean)
|
||||
(cd x86 ; $(MAKE) clean)
|
||||
(cd x86-64 ; $(MAKE) clean)
|
||||
(cd drivers/dri && $(MAKE) clean)
|
||||
(cd x86 && $(MAKE) clean)
|
||||
(cd x86-64 && $(MAKE) clean)
|
||||
|
||||
|
||||
include depend
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5.3
|
||||
* Version: 7.1
|
||||
*
|
||||
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
|
||||
*
|
||||
|
|
@ -292,3 +292,97 @@ _mesa_init_glsl_driver_functions(struct dd_function_table *driver)
|
|||
driver->UseProgram = _mesa_use_program;
|
||||
driver->ValidateProgram = _mesa_validate_program;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call the ctx->Driver.* state functions with current values to initialize
|
||||
* driver state.
|
||||
* Only the Intel drivers use this so far.
|
||||
*/
|
||||
void
|
||||
_mesa_init_driver_state(GLcontext *ctx)
|
||||
{
|
||||
ctx->Driver.AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef);
|
||||
|
||||
ctx->Driver.BlendColor(ctx, ctx->Color.BlendColor);
|
||||
|
||||
ctx->Driver.BlendEquationSeparate(ctx,
|
||||
ctx->Color.BlendEquationRGB,
|
||||
ctx->Color.BlendEquationA);
|
||||
|
||||
ctx->Driver.BlendFuncSeparate(ctx,
|
||||
ctx->Color.BlendSrcRGB,
|
||||
ctx->Color.BlendDstRGB,
|
||||
ctx->Color.BlendSrcA, ctx->Color.BlendDstA);
|
||||
|
||||
ctx->Driver.ColorMask(ctx,
|
||||
ctx->Color.ColorMask[RCOMP],
|
||||
ctx->Color.ColorMask[GCOMP],
|
||||
ctx->Color.ColorMask[BCOMP],
|
||||
ctx->Color.ColorMask[ACOMP]);
|
||||
|
||||
ctx->Driver.CullFace(ctx, ctx->Polygon.CullFaceMode);
|
||||
ctx->Driver.DepthFunc(ctx, ctx->Depth.Func);
|
||||
ctx->Driver.DepthMask(ctx, ctx->Depth.Mask);
|
||||
|
||||
ctx->Driver.Enable(ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled);
|
||||
ctx->Driver.Enable(ctx, GL_BLEND, ctx->Color.BlendEnabled);
|
||||
ctx->Driver.Enable(ctx, GL_COLOR_LOGIC_OP, ctx->Color.ColorLogicOpEnabled);
|
||||
ctx->Driver.Enable(ctx, GL_COLOR_SUM, ctx->Fog.ColorSumEnabled);
|
||||
ctx->Driver.Enable(ctx, GL_CULL_FACE, ctx->Polygon.CullFlag);
|
||||
ctx->Driver.Enable(ctx, GL_DEPTH_TEST, ctx->Depth.Test);
|
||||
ctx->Driver.Enable(ctx, GL_DITHER, ctx->Color.DitherFlag);
|
||||
ctx->Driver.Enable(ctx, GL_FOG, ctx->Fog.Enabled);
|
||||
ctx->Driver.Enable(ctx, GL_LIGHTING, ctx->Light.Enabled);
|
||||
ctx->Driver.Enable(ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag);
|
||||
ctx->Driver.Enable(ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag);
|
||||
ctx->Driver.Enable(ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled);
|
||||
ctx->Driver.Enable(ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled);
|
||||
ctx->Driver.Enable(ctx, GL_TEXTURE_1D, GL_FALSE);
|
||||
ctx->Driver.Enable(ctx, GL_TEXTURE_2D, GL_FALSE);
|
||||
ctx->Driver.Enable(ctx, GL_TEXTURE_RECTANGLE_NV, GL_FALSE);
|
||||
ctx->Driver.Enable(ctx, GL_TEXTURE_3D, GL_FALSE);
|
||||
ctx->Driver.Enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
|
||||
|
||||
ctx->Driver.Fogfv(ctx, GL_FOG_COLOR, ctx->Fog.Color);
|
||||
ctx->Driver.Fogfv(ctx, GL_FOG_MODE, 0);
|
||||
ctx->Driver.Fogfv(ctx, GL_FOG_DENSITY, &ctx->Fog.Density);
|
||||
ctx->Driver.Fogfv(ctx, GL_FOG_START, &ctx->Fog.Start);
|
||||
ctx->Driver.Fogfv(ctx, GL_FOG_END, &ctx->Fog.End);
|
||||
|
||||
ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace);
|
||||
|
||||
{
|
||||
GLfloat f = (GLfloat) ctx->Light.Model.ColorControl;
|
||||
ctx->Driver.LightModelfv(ctx, GL_LIGHT_MODEL_COLOR_CONTROL, &f);
|
||||
}
|
||||
|
||||
ctx->Driver.LineWidth(ctx, ctx->Line.Width);
|
||||
ctx->Driver.LogicOpcode(ctx, ctx->Color.LogicOp);
|
||||
ctx->Driver.PointSize(ctx, ctx->Point.Size);
|
||||
ctx->Driver.PolygonStipple(ctx, (const GLubyte *) ctx->PolygonStipple);
|
||||
ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
|
||||
ctx->Scissor.Width, ctx->Scissor.Height);
|
||||
ctx->Driver.ShadeModel(ctx, ctx->Light.ShadeModel);
|
||||
ctx->Driver.StencilFuncSeparate(ctx, GL_FRONT,
|
||||
ctx->Stencil.Function[0],
|
||||
ctx->Stencil.Ref[0],
|
||||
ctx->Stencil.ValueMask[0]);
|
||||
ctx->Driver.StencilFuncSeparate(ctx, GL_BACK,
|
||||
ctx->Stencil.Function[1],
|
||||
ctx->Stencil.Ref[1],
|
||||
ctx->Stencil.ValueMask[1]);
|
||||
ctx->Driver.StencilMaskSeparate(ctx, GL_FRONT, ctx->Stencil.WriteMask[0]);
|
||||
ctx->Driver.StencilMaskSeparate(ctx, GL_BACK, ctx->Stencil.WriteMask[1]);
|
||||
ctx->Driver.StencilOpSeparate(ctx, GL_FRONT,
|
||||
ctx->Stencil.FailFunc[0],
|
||||
ctx->Stencil.ZFailFunc[0],
|
||||
ctx->Stencil.ZPassFunc[0]);
|
||||
ctx->Driver.StencilOpSeparate(ctx, GL_BACK,
|
||||
ctx->Stencil.FailFunc[1],
|
||||
ctx->Stencil.ZFailFunc[1],
|
||||
ctx->Stencil.ZPassFunc[1]);
|
||||
|
||||
|
||||
ctx->Driver.DrawBuffer(ctx, ctx->Color.DrawBuffer[0]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5.3
|
||||
* Version: 7.1
|
||||
*
|
||||
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
|
||||
*
|
||||
|
|
@ -33,4 +33,9 @@ _mesa_init_driver_functions(struct dd_function_table *driver);
|
|||
extern void
|
||||
_mesa_init_glsl_driver_functions(struct dd_function_table *driver);
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_init_driver_state(GLcontext *ctx);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -134,7 +134,6 @@ static bool directfbgl_init_visual ( GLvisual *visual,
|
|||
static bool directfbgl_create_context ( GLcontext *context,
|
||||
GLframebuffer *framebuffer,
|
||||
GLvisual *visual,
|
||||
DFBSurfacePixelFormat format,
|
||||
IDirectFBGL_data *data );
|
||||
static void directfbgl_destroy_context( GLcontext *context,
|
||||
GLframebuffer *framebuffer );
|
||||
|
|
@ -340,8 +339,9 @@ Construct( IDirectFBGL *thiz, IDirectFBSurface *surface )
|
|||
}
|
||||
|
||||
/* Create context. */
|
||||
if (!directfbgl_create_context( &data->context, &data->framebuffer,
|
||||
&data->visual, data->format, data )) {
|
||||
if (!directfbgl_create_context( &data->context,
|
||||
&data->framebuffer,
|
||||
&data->visual, data )) {
|
||||
D_ERROR( "DirectFBGL/Mesa: failed to create context.\n" );
|
||||
IDirectFBGL_Mesa_Destruct( thiz );
|
||||
return DFB_UNSUPPORTED;
|
||||
|
|
@ -762,11 +762,10 @@ directfbgl_init_visual( GLvisual *visual,
|
|||
}
|
||||
|
||||
static bool
|
||||
directfbgl_create_context( GLcontext *context,
|
||||
GLframebuffer *framebuffer,
|
||||
GLvisual *visual,
|
||||
DFBSurfacePixelFormat format,
|
||||
IDirectFBGL_data *data )
|
||||
directfbgl_create_context( GLcontext *context,
|
||||
GLframebuffer *framebuffer,
|
||||
GLvisual *visual,
|
||||
IDirectFBGL_data *data )
|
||||
{
|
||||
struct dd_function_table functions;
|
||||
|
||||
|
|
@ -800,7 +799,7 @@ directfbgl_create_context( GLcontext *context,
|
|||
data->render.Delete = dfbDeleteRenderbuffer;
|
||||
data->render.AllocStorage = dfbRenderbufferStorage;
|
||||
|
||||
switch (format) {
|
||||
switch (data->format) {
|
||||
case DSPF_RGB332:
|
||||
data->render.GetRow = get_row_RGB332;
|
||||
data->render.GetValues = get_values_RGB332;
|
||||
|
|
@ -887,6 +886,9 @@ directfbgl_create_context( GLcontext *context,
|
|||
return false;
|
||||
}
|
||||
|
||||
data->render.Width = data->width;
|
||||
data->render.Height = data->height;
|
||||
|
||||
_mesa_add_renderbuffer( framebuffer, BUFFER_FRONT_LEFT, &data->render );
|
||||
|
||||
_mesa_add_soft_renderbuffers( framebuffer,
|
||||
|
|
@ -908,8 +910,11 @@ static void
|
|||
directfbgl_destroy_context( GLcontext *context,
|
||||
GLframebuffer *framebuffer )
|
||||
{
|
||||
_mesa_free_framebuffer_data( framebuffer );
|
||||
_mesa_notifyDestroy( context );
|
||||
_swsetup_DestroyContext( context );
|
||||
_swrast_DestroyContext( context );
|
||||
_tnl_DestroyContext( context );
|
||||
_vbo_DestroyContext( context );
|
||||
//_mesa_free_framebuffer_data( framebuffer );
|
||||
_mesa_free_context_data( context );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ install:
|
|||
clean:
|
||||
@for dir in $(DRI_DIRS) ; do \
|
||||
if [ -d $$dir ] ; then \
|
||||
(cd $$dir && $(MAKE) clean ; \
|
||||
(cd $$dir && $(MAKE) clean) ; \
|
||||
fi \
|
||||
done
|
||||
-rm -f common/*.o
|
||||
|
|
|
|||
|
|
@ -995,6 +995,9 @@ __driUtilCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
|
|||
psc->getMSC = driGetMSC;
|
||||
psc->createNewContext = driCreateNewContext;
|
||||
|
||||
if (internal_api_version >= 20070121)
|
||||
psc->setTexOffset = psp->DriverAPI.setTexOffset;
|
||||
|
||||
if ( (psp->DriverAPI.InitDriver != NULL)
|
||||
&& !(*psp->DriverAPI.InitDriver)(psp) ) {
|
||||
_mesa_free( psp );
|
||||
|
|
|
|||
|
|
@ -189,6 +189,12 @@ struct __DriverAPIRec {
|
|||
/*@}*/
|
||||
void (*CopySubBuffer)(__DRIdrawablePrivate *driDrawPriv,
|
||||
int x, int y, int w, int h);
|
||||
|
||||
/**
|
||||
* See corresponding field in \c __DRIscreenRec.
|
||||
*/
|
||||
void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname,
|
||||
unsigned long long offset, GLint depth, GLuint pitch);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
@ -1471,9 +1478,10 @@ static const char ImageTransformParameterfvHP_names[] =
|
|||
"";
|
||||
#endif
|
||||
|
||||
#if defined(need_GL_ARB_vertex_program)
|
||||
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
|
||||
static const char VertexAttrib4ivARB_names[] =
|
||||
"ip\0" /* Parameter signature */
|
||||
"glVertexAttrib4iv\0"
|
||||
"glVertexAttrib4ivARB\0"
|
||||
"";
|
||||
#endif
|
||||
|
|
@ -1579,9 +1587,10 @@ static const char PixelTransformParameterfvEXT_names[] =
|
|||
"";
|
||||
#endif
|
||||
|
||||
#if defined(need_GL_ARB_vertex_program)
|
||||
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
|
||||
static const char VertexAttrib4bvARB_names[] =
|
||||
"ip\0" /* Parameter signature */
|
||||
"glVertexAttrib4bv\0"
|
||||
"glVertexAttrib4bvARB\0"
|
||||
"";
|
||||
#endif
|
||||
|
|
@ -2384,9 +2393,10 @@ static const char GetAttribLocationARB_names[] =
|
|||
"";
|
||||
#endif
|
||||
|
||||
#if defined(need_GL_ARB_vertex_program)
|
||||
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
|
||||
static const char VertexAttrib4ubvARB_names[] =
|
||||
"ip\0" /* Parameter signature */
|
||||
"glVertexAttrib4ubv\0"
|
||||
"glVertexAttrib4ubvARB\0"
|
||||
"";
|
||||
#endif
|
||||
|
|
@ -2903,9 +2913,10 @@ static const char ReplacementCodeuiColor4ubVertex3fSUN_names[] =
|
|||
"";
|
||||
#endif
|
||||
|
||||
#if defined(need_GL_ARB_vertex_program)
|
||||
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
|
||||
static const char VertexAttrib4usvARB_names[] =
|
||||
"ip\0" /* Parameter signature */
|
||||
"glVertexAttrib4usv\0"
|
||||
"glVertexAttrib4usvARB\0"
|
||||
"";
|
||||
#endif
|
||||
|
|
@ -4386,9 +4397,10 @@ static const char WindowPos4iMESA_names[] =
|
|||
"";
|
||||
#endif
|
||||
|
||||
#if defined(need_GL_ARB_vertex_program)
|
||||
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
|
||||
static const char VertexAttrib4uivARB_names[] =
|
||||
"ip\0" /* Parameter signature */
|
||||
"glVertexAttrib4uiv\0"
|
||||
"glVertexAttrib4uivARB\0"
|
||||
"";
|
||||
#endif
|
||||
|
|
@ -5479,6 +5491,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 },
|
||||
|
|
@ -6243,6 +6262,8 @@ static const struct dri_extension_function GL_VERSION_2_0_functions[] = {
|
|||
{ GetVertexAttribivARB_names, GetVertexAttribivARB_remap_index, -1 },
|
||||
{ CreateProgram_names, CreateProgram_remap_index, -1 },
|
||||
{ StencilFuncSeparate_names, StencilFuncSeparate_remap_index, -1 },
|
||||
{ VertexAttrib4ivARB_names, VertexAttrib4ivARB_remap_index, -1 },
|
||||
{ VertexAttrib4bvARB_names, VertexAttrib4bvARB_remap_index, -1 },
|
||||
{ VertexAttrib3dARB_names, VertexAttrib3dARB_remap_index, -1 },
|
||||
{ VertexAttrib4fARB_names, VertexAttrib4fARB_remap_index, -1 },
|
||||
{ VertexAttrib4fvARB_names, VertexAttrib4fvARB_remap_index, -1 },
|
||||
|
|
@ -6256,6 +6277,7 @@ static const struct dri_extension_function GL_VERSION_2_0_functions[] = {
|
|||
{ VertexAttrib1dvARB_names, VertexAttrib1dvARB_remap_index, -1 },
|
||||
{ GetVertexAttribfvARB_names, GetVertexAttribfvARB_remap_index, -1 },
|
||||
{ GetAttribLocationARB_names, GetAttribLocationARB_remap_index, -1 },
|
||||
{ VertexAttrib4ubvARB_names, VertexAttrib4ubvARB_remap_index, -1 },
|
||||
{ Uniform3ivARB_names, Uniform3ivARB_remap_index, -1 },
|
||||
{ VertexAttrib4sARB_names, VertexAttrib4sARB_remap_index, -1 },
|
||||
{ VertexAttrib2dvARB_names, VertexAttrib2dvARB_remap_index, -1 },
|
||||
|
|
@ -6268,6 +6290,7 @@ static const struct dri_extension_function GL_VERSION_2_0_functions[] = {
|
|||
{ VertexAttrib4NuivARB_names, VertexAttrib4NuivARB_remap_index, -1 },
|
||||
{ Uniform4fARB_names, Uniform4fARB_remap_index, -1 },
|
||||
{ VertexAttrib1dARB_names, VertexAttrib1dARB_remap_index, -1 },
|
||||
{ VertexAttrib4usvARB_names, VertexAttrib4usvARB_remap_index, -1 },
|
||||
{ LinkProgramARB_names, LinkProgramARB_remap_index, -1 },
|
||||
{ ShaderSourceARB_names, ShaderSourceARB_remap_index, -1 },
|
||||
{ VertexAttrib3svARB_names, VertexAttrib3svARB_remap_index, -1 },
|
||||
|
|
@ -6297,6 +6320,7 @@ static const struct dri_extension_function GL_VERSION_2_0_functions[] = {
|
|||
{ DrawBuffersARB_names, DrawBuffersARB_remap_index, -1 },
|
||||
{ Uniform1fvARB_names, Uniform1fvARB_remap_index, -1 },
|
||||
{ EnableVertexAttribArrayARB_names, EnableVertexAttribArrayARB_remap_index, -1 },
|
||||
{ VertexAttrib4uivARB_names, VertexAttrib4uivARB_remap_index, -1 },
|
||||
{ VertexAttrib4svARB_names, VertexAttrib4svARB_remap_index, -1 },
|
||||
{ GetShaderiv_names, GetShaderiv_remap_index, -1 },
|
||||
{ VertexAttrib2svARB_names, VertexAttrib2svARB_remap_index, -1 },
|
||||
|
|
|
|||
|
|
@ -138,10 +138,10 @@ static void ffb_translate_vertex(GLcontext *ctx, const ffb_vertex *src,
|
|||
const GLfloat ty = m[13];
|
||||
const GLfloat tz = m[14];
|
||||
|
||||
dst->win[0] = sx * src->x + tx;
|
||||
dst->win[1] = sy * src->y + ty;
|
||||
dst->win[2] = sz * src->z + tz;
|
||||
dst->win[3] = 1.0;
|
||||
dst->attrib[FRAG_ATTRIB_WPOS][0] = sx * src->x + tx;
|
||||
dst->attrib[FRAG_ATTRIB_WPOS][1] = sy * src->y + ty;
|
||||
dst->attrib[FRAG_ATTRIB_WPOS][2] = sz * src->z + tz;
|
||||
dst->attrib[FRAG_ATTRIB_WPOS][3] = 1.0;
|
||||
|
||||
dst->color[0] = FFB_UBYTE_FROM_COLOR(src->color[0].red);
|
||||
dst->color[1] = FFB_UBYTE_FROM_COLOR(src->color[0].green);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
#include "texmem.h"
|
||||
|
||||
#include "drivers/common/driverfuncs.h"
|
||||
|
||||
#include "intel_screen.h"
|
||||
#include "intel_batchbuffer.h"
|
||||
|
||||
|
|
@ -1074,7 +1076,7 @@ void i830InitState( i830ContextPtr i830 )
|
|||
|
||||
i830_init_packets( i830 );
|
||||
|
||||
intelInitState( ctx );
|
||||
_mesa_init_driver_state(ctx);
|
||||
|
||||
memcpy( &i830->initial, &i830->state, sizeof(i830->state) );
|
||||
|
||||
|
|
@ -1085,8 +1087,3 @@ void i830InitState( i830ContextPtr i830 )
|
|||
I830_UPLOAD_CTX |
|
||||
I830_UPLOAD_BUFFERS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -857,11 +857,6 @@ static void i915BindProgram( GLcontext *ctx,
|
|||
assert(p->on_hardware == 0);
|
||||
assert(p->params_uptodate == 0);
|
||||
|
||||
/* Hack: make sure fog is correctly enabled according to this
|
||||
* fragment program's fog options.
|
||||
*/
|
||||
ctx->Driver.Enable( ctx, GL_FRAGMENT_PROGRAM_ARB,
|
||||
ctx->FragmentProgram.Enabled );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -935,9 +930,6 @@ static void i915ProgramStringNotify( GLcontext *ctx,
|
|||
/* Hack: make sure fog is correctly enabled according to this
|
||||
* fragment program's fog options.
|
||||
*/
|
||||
ctx->Driver.Enable( ctx, GL_FRAGMENT_PROGRAM_ARB,
|
||||
ctx->FragmentProgram.Enabled );
|
||||
|
||||
if (p->FragProg.FogOption) {
|
||||
/* add extra instructions to do fog, then turn off FogOption field */
|
||||
_mesa_append_fog_code(ctx, &p->FragProg);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@
|
|||
|
||||
#include "texmem.h"
|
||||
|
||||
#include "drivers/common/driverfuncs.h"
|
||||
|
||||
#include "intel_screen.h"
|
||||
#include "intel_batchbuffer.h"
|
||||
|
||||
|
|
@ -961,15 +963,8 @@ void i915InitState( i915ContextPtr i915 )
|
|||
|
||||
i915_init_packets( i915 );
|
||||
|
||||
intelInitState( ctx );
|
||||
_mesa_init_driver_state(ctx);
|
||||
|
||||
memcpy( &i915->initial, &i915->state, sizeof(i915->state) );
|
||||
i915->current = &i915->state;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -172,12 +172,8 @@ static void i915LayoutTextureImages( i915ContextPtr i915,
|
|||
|
||||
t->intel.image[0][i].offset = total_height * pitch;
|
||||
t->intel.image[0][i].internalFormat = baseImage->_BaseFormat;
|
||||
if (t->intel.image[0][i].image->IsCompressed)
|
||||
{
|
||||
if (t->intel.image[0][i].image->Height > 4)
|
||||
total_height += t->intel.image[0][i].image->Height/4;
|
||||
else
|
||||
total_height += 1;
|
||||
if (t->intel.image[0][i].image->IsCompressed) {
|
||||
total_height += (t->intel.image[0][i].image->Height + 3) / 4;
|
||||
}
|
||||
else
|
||||
total_height += MAX2(2, t->intel.image[0][i].image->Height);
|
||||
|
|
@ -495,12 +491,19 @@ static void i915SetTexImages( i915ContextPtr i915,
|
|||
abort();
|
||||
}
|
||||
|
||||
|
||||
if (i915->intel.intelScreen->deviceID == PCI_CHIP_I945_G ||
|
||||
i915->intel.intelScreen->deviceID == PCI_CHIP_I945_GM)
|
||||
i945LayoutTextureImages( i915, tObj );
|
||||
else
|
||||
i915LayoutTextureImages( i915, tObj );
|
||||
switch (i915->intel.intelScreen->deviceID) {
|
||||
case PCI_CHIP_I945_G:
|
||||
case PCI_CHIP_I945_GM:
|
||||
case PCI_CHIP_I945_GME:
|
||||
case PCI_CHIP_G33_G:
|
||||
case PCI_CHIP_Q33_G:
|
||||
case PCI_CHIP_Q35_G:
|
||||
i945LayoutTextureImages( i915, tObj );
|
||||
break;
|
||||
default:
|
||||
i915LayoutTextureImages( i915, tObj );
|
||||
break;
|
||||
}
|
||||
|
||||
t->Setup[I915_TEXREG_MS3] =
|
||||
(((tObj->Image[0][t->intel.base.firstLevel]->Height - 1) << MS3_HEIGHT_SHIFT) |
|
||||
|
|
|
|||
|
|
@ -123,6 +123,14 @@ const GLubyte *intelGetString( GLcontext *ctx, GLenum name )
|
|||
chipset = "Intel(R) 945G"; break;
|
||||
case PCI_CHIP_I945_GM:
|
||||
chipset = "Intel(R) 945GM"; break;
|
||||
case PCI_CHIP_I945_GME:
|
||||
chipset = "Intel(R) 945GME"; break;
|
||||
case PCI_CHIP_G33_G:
|
||||
chipset = "Intel(R) G33"; break;
|
||||
case PCI_CHIP_Q35_G:
|
||||
chipset = "Intel(R) Q35"; break;
|
||||
case PCI_CHIP_Q33_G:
|
||||
chipset = "Intel(R) Q33"; break;
|
||||
default:
|
||||
chipset = "Unknown Intel Chipset"; break;
|
||||
}
|
||||
|
|
@ -766,98 +774,3 @@ void intelCopySubBuffer( __DRIdrawablePrivate *dPriv,
|
|||
fprintf(stderr, "%s: drawable has no context!\n", __FUNCTION__);
|
||||
}
|
||||
}
|
||||
|
||||
void intelInitState( GLcontext *ctx )
|
||||
{
|
||||
/* Mesa should do this for us:
|
||||
*/
|
||||
ctx->Driver.AlphaFunc( ctx,
|
||||
ctx->Color.AlphaFunc,
|
||||
ctx->Color.AlphaRef);
|
||||
|
||||
ctx->Driver.BlendColor( ctx,
|
||||
ctx->Color.BlendColor );
|
||||
|
||||
ctx->Driver.BlendEquationSeparate( ctx,
|
||||
ctx->Color.BlendEquationRGB,
|
||||
ctx->Color.BlendEquationA);
|
||||
|
||||
ctx->Driver.BlendFuncSeparate( ctx,
|
||||
ctx->Color.BlendSrcRGB,
|
||||
ctx->Color.BlendDstRGB,
|
||||
ctx->Color.BlendSrcA,
|
||||
ctx->Color.BlendDstA);
|
||||
|
||||
ctx->Driver.ColorMask( ctx,
|
||||
ctx->Color.ColorMask[RCOMP],
|
||||
ctx->Color.ColorMask[GCOMP],
|
||||
ctx->Color.ColorMask[BCOMP],
|
||||
ctx->Color.ColorMask[ACOMP]);
|
||||
|
||||
ctx->Driver.CullFace( ctx, ctx->Polygon.CullFaceMode );
|
||||
ctx->Driver.DepthFunc( ctx, ctx->Depth.Func );
|
||||
ctx->Driver.DepthMask( ctx, ctx->Depth.Mask );
|
||||
|
||||
ctx->Driver.Enable( ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled );
|
||||
ctx->Driver.Enable( ctx, GL_BLEND, ctx->Color.BlendEnabled );
|
||||
ctx->Driver.Enable( ctx, GL_COLOR_LOGIC_OP, ctx->Color.ColorLogicOpEnabled );
|
||||
ctx->Driver.Enable( ctx, GL_COLOR_SUM, ctx->Fog.ColorSumEnabled );
|
||||
ctx->Driver.Enable( ctx, GL_CULL_FACE, ctx->Polygon.CullFlag );
|
||||
ctx->Driver.Enable( ctx, GL_DEPTH_TEST, ctx->Depth.Test );
|
||||
ctx->Driver.Enable( ctx, GL_DITHER, ctx->Color.DitherFlag );
|
||||
ctx->Driver.Enable( ctx, GL_FOG, ctx->Fog.Enabled );
|
||||
ctx->Driver.Enable( ctx, GL_LIGHTING, ctx->Light.Enabled );
|
||||
ctx->Driver.Enable( ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag );
|
||||
ctx->Driver.Enable( ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag );
|
||||
ctx->Driver.Enable( ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled );
|
||||
ctx->Driver.Enable( ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled );
|
||||
ctx->Driver.Enable( ctx, GL_TEXTURE_1D, GL_FALSE );
|
||||
ctx->Driver.Enable( ctx, GL_TEXTURE_2D, GL_FALSE );
|
||||
ctx->Driver.Enable( ctx, GL_TEXTURE_RECTANGLE_NV, GL_FALSE );
|
||||
ctx->Driver.Enable( ctx, GL_TEXTURE_3D, GL_FALSE );
|
||||
ctx->Driver.Enable( ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE );
|
||||
|
||||
ctx->Driver.Fogfv( ctx, GL_FOG_COLOR, ctx->Fog.Color );
|
||||
ctx->Driver.Fogfv( ctx, GL_FOG_MODE, 0 );
|
||||
ctx->Driver.Fogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density );
|
||||
ctx->Driver.Fogfv( ctx, GL_FOG_START, &ctx->Fog.Start );
|
||||
ctx->Driver.Fogfv( ctx, GL_FOG_END, &ctx->Fog.End );
|
||||
|
||||
ctx->Driver.FrontFace( ctx, ctx->Polygon.FrontFace );
|
||||
|
||||
{
|
||||
GLfloat f = (GLfloat)ctx->Light.Model.ColorControl;
|
||||
ctx->Driver.LightModelfv( ctx, GL_LIGHT_MODEL_COLOR_CONTROL, &f );
|
||||
}
|
||||
|
||||
ctx->Driver.LineWidth( ctx, ctx->Line.Width );
|
||||
ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp );
|
||||
ctx->Driver.PointSize( ctx, ctx->Point.Size );
|
||||
ctx->Driver.PolygonStipple( ctx, (const GLubyte *)ctx->PolygonStipple );
|
||||
ctx->Driver.Scissor( ctx, ctx->Scissor.X, ctx->Scissor.Y,
|
||||
ctx->Scissor.Width, ctx->Scissor.Height );
|
||||
ctx->Driver.ShadeModel( ctx, ctx->Light.ShadeModel );
|
||||
ctx->Driver.StencilFuncSeparate( ctx, GL_FRONT,
|
||||
ctx->Stencil.Function[0],
|
||||
ctx->Stencil.Ref[0],
|
||||
ctx->Stencil.ValueMask[0] );
|
||||
ctx->Driver.StencilFuncSeparate( ctx, GL_BACK,
|
||||
ctx->Stencil.Function[1],
|
||||
ctx->Stencil.Ref[1],
|
||||
ctx->Stencil.ValueMask[1] );
|
||||
ctx->Driver.StencilMaskSeparate( ctx, GL_FRONT, ctx->Stencil.WriteMask[0] );
|
||||
ctx->Driver.StencilMaskSeparate( ctx, GL_BACK, ctx->Stencil.WriteMask[1] );
|
||||
ctx->Driver.StencilOpSeparate( ctx, GL_FRONT,
|
||||
ctx->Stencil.FailFunc[0],
|
||||
ctx->Stencil.ZFailFunc[0],
|
||||
ctx->Stencil.ZPassFunc[0]);
|
||||
ctx->Driver.StencilOpSeparate( ctx, GL_BACK,
|
||||
ctx->Stencil.FailFunc[1],
|
||||
ctx->Stencil.ZFailFunc[1],
|
||||
ctx->Stencil.ZPassFunc[1]);
|
||||
|
||||
|
||||
ctx->Driver.DrawBuffer( ctx, ctx->Color.DrawBuffer[0] );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -454,6 +454,10 @@ extern int INTEL_DEBUG;
|
|||
#define PCI_CHIP_I915_GM 0x2592
|
||||
#define PCI_CHIP_I945_G 0x2772
|
||||
#define PCI_CHIP_I945_GM 0x27A2
|
||||
#define PCI_CHIP_I945_GME 0x27AE
|
||||
#define PCI_CHIP_G33_G 0x29C2
|
||||
#define PCI_CHIP_Q35_G 0x29B2
|
||||
#define PCI_CHIP_Q33_G 0x29D2
|
||||
|
||||
|
||||
/* ================================================================
|
||||
|
|
@ -473,7 +477,6 @@ extern void intelSetBackClipRects(intelContextPtr intel);
|
|||
extern void intelSetFrontClipRects(intelContextPtr intel);
|
||||
extern void intelWindowMoved( intelContextPtr intel );
|
||||
|
||||
extern void intelInitState( GLcontext *ctx );
|
||||
extern const GLubyte *intelGetString( GLcontext *ctx, GLenum name );
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -439,10 +439,26 @@ intelDrawPixels( GLcontext *ctx,
|
|||
if (INTEL_DEBUG & DEBUG_PIXEL)
|
||||
fprintf(stderr, "%s\n", __FUNCTION__);
|
||||
|
||||
if (!intelTryDrawPixels( ctx, x, y, width, height, format, type,
|
||||
unpack, pixels ))
|
||||
if (intelTryDrawPixels( ctx, x, y, width, height, format, type,
|
||||
unpack, pixels ))
|
||||
return;
|
||||
|
||||
if (ctx->FragmentProgram._Current == ctx->FragmentProgram._TexEnvProgram) {
|
||||
/*
|
||||
* We don't want the i915 texenv program to be applied to DrawPixels.
|
||||
* This is really just a performance optimization (mesa will other-
|
||||
* wise happily run the fragment program on each pixel in the image).
|
||||
*/
|
||||
struct gl_fragment_program *fpSave = ctx->FragmentProgram._Current;
|
||||
ctx->FragmentProgram._Current = NULL;
|
||||
_swrast_DrawPixels( ctx, x, y, width, height, format, type,
|
||||
unpack, pixels );
|
||||
unpack, pixels );
|
||||
ctx->FragmentProgram._Current = fpSave;
|
||||
}
|
||||
else {
|
||||
_swrast_DrawPixels( ctx, x, y, width, height, format, type,
|
||||
unpack, pixels );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -514,6 +514,10 @@ static GLboolean intelCreateContext( const __GLcontextModes *mesaVis,
|
|||
case PCI_CHIP_I915_GM:
|
||||
case PCI_CHIP_I945_G:
|
||||
case PCI_CHIP_I945_GM:
|
||||
case PCI_CHIP_I945_GME:
|
||||
case PCI_CHIP_G33_G:
|
||||
case PCI_CHIP_Q35_G:
|
||||
case PCI_CHIP_Q33_G:
|
||||
return i915CreateContext( mesaVis, driContextPriv,
|
||||
sharedContextPrivate );
|
||||
|
||||
|
|
|
|||
|
|
@ -634,11 +634,32 @@ static void intelUploadTexImage( intelContextPtr intel,
|
|||
image->Height);
|
||||
}
|
||||
else if (image->IsCompressed) {
|
||||
GLuint row_len = image->Width * 2;
|
||||
GLuint row_len = 0;
|
||||
GLubyte *dst = (GLubyte *)(t->BufAddr + offset);
|
||||
GLubyte *src = (GLubyte *)image->Data;
|
||||
GLuint j;
|
||||
|
||||
/* must always copy whole blocks (8/16 bytes) */
|
||||
switch (image->InternalFormat) {
|
||||
case GL_COMPRESSED_RGB_FXT1_3DFX:
|
||||
case GL_COMPRESSED_RGBA_FXT1_3DFX:
|
||||
case GL_RGB_S3TC:
|
||||
case GL_RGB4_S3TC:
|
||||
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
|
||||
row_len = (image->Width * 2 + 7) & ~7;
|
||||
break;
|
||||
case GL_RGBA_S3TC:
|
||||
case GL_RGBA4_S3TC:
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
|
||||
row_len = (image->Width * 4 + 15) & ~15;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"Internal Compressed format not supported %d\n", image->InternalFormat);
|
||||
break;
|
||||
}
|
||||
|
||||
if (INTEL_DEBUG & DEBUG_TEXTURE)
|
||||
fprintf(stderr,
|
||||
"Upload image %dx%dx%d offset %xm row_len %x "
|
||||
|
|
@ -646,36 +667,21 @@ static void intelUploadTexImage( intelContextPtr intel,
|
|||
image->Width, image->Height, image->Depth, offset,
|
||||
row_len, t->Pitch, t->depth_pitch);
|
||||
|
||||
switch (image->InternalFormat) {
|
||||
case GL_COMPRESSED_RGB_FXT1_3DFX:
|
||||
case GL_COMPRESSED_RGBA_FXT1_3DFX:
|
||||
case GL_RGB_S3TC:
|
||||
case GL_RGB4_S3TC:
|
||||
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
|
||||
for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) {
|
||||
__memcpy(dst, src, row_len );
|
||||
src += row_len;
|
||||
}
|
||||
break;
|
||||
case GL_RGBA_S3TC:
|
||||
case GL_RGBA4_S3TC:
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
|
||||
for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) {
|
||||
__memcpy(dst, src, (image->Width*4) );
|
||||
src += image->Width*4;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"Internal Compressed format not supported %d\n", image->InternalFormat);
|
||||
break;
|
||||
if (row_len) {
|
||||
for (j = 0 ; j < (image->Height + 3)/4 ; j++, dst += (t->Pitch)) {
|
||||
__memcpy(dst, src, row_len );
|
||||
src += row_len;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Time for another vtbl entry:
|
||||
*/
|
||||
else if (intel->intelScreen->deviceID == PCI_CHIP_I945_G ||
|
||||
intel->intelScreen->deviceID == PCI_CHIP_I945_GM) {
|
||||
intel->intelScreen->deviceID == PCI_CHIP_I945_GM ||
|
||||
intel->intelScreen->deviceID == PCI_CHIP_I945_GME ||
|
||||
intel->intelScreen->deviceID == PCI_CHIP_G33_G ||
|
||||
intel->intelScreen->deviceID == PCI_CHIP_Q33_G ||
|
||||
intel->intelScreen->deviceID == PCI_CHIP_Q35_G) {
|
||||
GLuint row_len = image->Width * image->TexFormat->TexelBytes;
|
||||
GLubyte *dst = (GLubyte *)(t->BufAddr + offset);
|
||||
GLubyte *src = (GLubyte *)image->Data;
|
||||
|
|
|
|||
|
|
@ -575,6 +575,7 @@
|
|||
#define MT_16BIT_DIB_RGB565_8888 (7<<3)
|
||||
#define MT_32BIT_ARGB8888 (0<<3) /* SURFACE_32BIT */
|
||||
#define MT_32BIT_ABGR8888 (1<<3)
|
||||
#define MT_32BIT_XRGB8888 (2<<3) /* XXX: Guess from i915_reg.h */
|
||||
#define MT_32BIT_BUMP_XLDVDU_8888 (6<<3)
|
||||
#define MT_32BIT_DIB_8888 (7<<3)
|
||||
#define MT_411_YUV411 (0<<3) /* SURFACE_411 */
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
#include "texmem.h"
|
||||
|
||||
#include "drivers/common/driverfuncs.h"
|
||||
|
||||
#include "intel_screen.h"
|
||||
#include "intel_batchbuffer.h"
|
||||
#include "intel_fbo.h"
|
||||
|
|
@ -1101,7 +1103,7 @@ i830InitState(struct i830_context *i830)
|
|||
|
||||
i830_init_packets(i830);
|
||||
|
||||
intelInitState(ctx);
|
||||
_mesa_init_driver_state(ctx);
|
||||
|
||||
memcpy(&i830->initial, &i830->state, sizeof(i830->state));
|
||||
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
|
|||
struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
|
||||
struct intel_texture_object *intelObj = intel_texture_object(tObj);
|
||||
struct gl_texture_image *firstImage;
|
||||
GLuint *state = i830->state.Tex[unit];
|
||||
GLuint *state = i830->state.Tex[unit], format, pitch;
|
||||
|
||||
memset(state, 0, sizeof(state));
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
|
|||
i830->state.tex_buffer[unit] = NULL;
|
||||
}
|
||||
|
||||
if (!intel_finalize_mipmap_tree(intel, unit))
|
||||
if (!intelObj->imageOverride && !intel_finalize_mipmap_tree(intel, unit))
|
||||
return GL_FALSE;
|
||||
|
||||
/* Get first image here, since intelObj->firstLevel will get set in
|
||||
|
|
@ -136,11 +136,34 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
|
|||
*/
|
||||
firstImage = tObj->Image[0][intelObj->firstLevel];
|
||||
|
||||
i830->state.tex_buffer[unit] = driBOReference(intelObj->mt->region->buffer);
|
||||
i830->state.tex_offset[unit] = intel_miptree_image_offset(intelObj->mt, 0,
|
||||
intelObj->
|
||||
firstLevel);
|
||||
if (intelObj->imageOverride) {
|
||||
i830->state.tex_buffer[unit] = NULL;
|
||||
i830->state.tex_offset[unit] = intelObj->textureOffset;
|
||||
|
||||
switch (intelObj->depthOverride) {
|
||||
case 32:
|
||||
format = MAPSURF_32BIT | MT_32BIT_ARGB8888;
|
||||
break;
|
||||
case 24:
|
||||
default:
|
||||
format = MAPSURF_32BIT | MT_32BIT_XRGB8888;
|
||||
break;
|
||||
case 16:
|
||||
format = MAPSURF_16BIT | MT_16BIT_RGB565;
|
||||
break;
|
||||
}
|
||||
|
||||
pitch = intelObj->pitchOverride;
|
||||
} else {
|
||||
i830->state.tex_buffer[unit] = driBOReference(intelObj->mt->region->
|
||||
buffer);
|
||||
i830->state.tex_offset[unit] = intel_miptree_image_offset(intelObj->mt,
|
||||
0, intelObj->
|
||||
firstLevel);
|
||||
|
||||
format = translate_texture_format(firstImage->TexFormat->MesaFormat);
|
||||
pitch = intelObj->mt->pitch * intelObj->mt->cpp;
|
||||
}
|
||||
|
||||
state[I830_TEXREG_TM0LI] = (_3DSTATE_LOAD_STATE_IMMEDIATE_2 |
|
||||
(LOAD_TEXTURE_MAP0 << unit) | 4);
|
||||
|
|
@ -151,12 +174,10 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
|
|||
|
||||
state[I830_TEXREG_TM0S1] =
|
||||
(((firstImage->Height - 1) << TM0S1_HEIGHT_SHIFT) |
|
||||
((firstImage->Width - 1) << TM0S1_WIDTH_SHIFT) |
|
||||
translate_texture_format(firstImage->TexFormat->MesaFormat));
|
||||
((firstImage->Width - 1) << TM0S1_WIDTH_SHIFT) | format);
|
||||
|
||||
state[I830_TEXREG_TM0S2] =
|
||||
(((((intelObj->mt->pitch * intelObj->mt->cpp) / 4) -
|
||||
1) << TM0S2_PITCH_SHIFT) | TM0S2_CUBE_FACE_ENA_MASK);
|
||||
((((pitch / 4) - 1) << TM0S2_PITCH_SHIFT) | TM0S2_CUBE_FACE_ENA_MASK);
|
||||
|
||||
{
|
||||
if (tObj->Target == GL_TEXTURE_CUBE_MAP)
|
||||
|
|
|
|||
|
|
@ -490,11 +490,13 @@ i830_emit_state(struct intel_context *intel)
|
|||
DRM_BO_MASK_MEM | DRM_BO_FLAG_READ,
|
||||
state->tex_offset[i] | TM0S0_USE_FENCE);
|
||||
}
|
||||
else {
|
||||
assert(i == 0);
|
||||
assert(state == &i830->meta);
|
||||
OUT_BATCH(0);
|
||||
}
|
||||
else if (state == &i830->meta) {
|
||||
assert(i == 0);
|
||||
OUT_BATCH(0);
|
||||
}
|
||||
else {
|
||||
OUT_BATCH(state->tex_offset[i]);
|
||||
}
|
||||
|
||||
OUT_BATCH(state->Tex[i][I830_TEXREG_TM0S1]);
|
||||
OUT_BATCH(state->Tex[i][I830_TEXREG_TM0S2]);
|
||||
|
|
|
|||
|
|
@ -849,11 +849,6 @@ i915BindProgram(GLcontext * ctx, GLenum target, struct gl_program *prog)
|
|||
assert(p->on_hardware == 0);
|
||||
assert(p->params_uptodate == 0);
|
||||
|
||||
/* Hack: make sure fog is correctly enabled according to this
|
||||
* fragment program's fog options.
|
||||
*/
|
||||
ctx->Driver.Enable(ctx, GL_FRAGMENT_PROGRAM_ARB,
|
||||
ctx->FragmentProgram.Enabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -926,9 +921,6 @@ i915ProgramStringNotify(GLcontext * ctx,
|
|||
/* Hack: make sure fog is correctly enabled according to this
|
||||
* fragment program's fog options.
|
||||
*/
|
||||
ctx->Driver.Enable(ctx, GL_FRAGMENT_PROGRAM_ARB,
|
||||
ctx->FragmentProgram.Enabled);
|
||||
|
||||
if (p->FragProg.FogOption) {
|
||||
/* add extra instructions to do fog, then turn off FogOption field */
|
||||
_mesa_append_fog_code(ctx, &p->FragProg);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@
|
|||
|
||||
#include "texmem.h"
|
||||
|
||||
#include "drivers/common/driverfuncs.h"
|
||||
|
||||
#include "intel_fbo.h"
|
||||
#include "intel_screen.h"
|
||||
#include "intel_batchbuffer.h"
|
||||
|
|
@ -1005,7 +1007,7 @@ i915InitState(struct i915_context *i915)
|
|||
|
||||
i915_init_packets(i915);
|
||||
|
||||
intelInitState(ctx);
|
||||
_mesa_init_driver_state(ctx);
|
||||
|
||||
memcpy(&i915->initial, &i915->state, sizeof(i915->state));
|
||||
i915->current = &i915->state;
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ i915_miptree_layout(struct intel_mipmap_tree * mt)
|
|||
*/
|
||||
for (level = mt->first_level; level <= MAX2(8, mt->last_level);
|
||||
level++) {
|
||||
intel_miptree_set_level_info(mt, level, 1, 0, mt->total_height,
|
||||
intel_miptree_set_level_info(mt, level, depth, 0, mt->total_height,
|
||||
width, height, depth);
|
||||
|
||||
|
||||
|
|
@ -161,11 +161,9 @@ i915_miptree_layout(struct intel_mipmap_tree * mt)
|
|||
if (mt->compressed)
|
||||
img_height = MAX2(1, height / 4);
|
||||
else
|
||||
img_height = MAX2(2, height);
|
||||
img_height = (MAX2(2, height) + 1) & ~1;
|
||||
|
||||
mt->total_height += img_height;
|
||||
mt->total_height += 1;
|
||||
mt->total_height &= ~1;
|
||||
|
||||
width = minify(width);
|
||||
height = minify(height);
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
|
|||
struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
|
||||
struct intel_texture_object *intelObj = intel_texture_object(tObj);
|
||||
struct gl_texture_image *firstImage;
|
||||
GLuint *state = i915->state.Tex[unit];
|
||||
GLuint *state = i915->state.Tex[unit], format, pitch;
|
||||
|
||||
memset(state, 0, sizeof(state));
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
|
|||
i915->state.tex_buffer[unit] = NULL;
|
||||
}
|
||||
|
||||
if (!intel_finalize_mipmap_tree(intel, unit))
|
||||
if (!intelObj->imageOverride && !intel_finalize_mipmap_tree(intel, unit))
|
||||
return GL_FALSE;
|
||||
|
||||
/* Get first image here, since intelObj->firstLevel will get set in
|
||||
|
|
@ -141,24 +141,45 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
|
|||
*/
|
||||
firstImage = tObj->Image[0][intelObj->firstLevel];
|
||||
|
||||
i915->state.tex_buffer[unit] = driBOReference(intelObj->mt->region->buffer);
|
||||
i915->state.tex_offset[unit] = intel_miptree_image_offset(intelObj->mt, 0,
|
||||
intelObj->
|
||||
firstLevel);
|
||||
if (intelObj->imageOverride) {
|
||||
i915->state.tex_buffer[unit] = NULL;
|
||||
i915->state.tex_offset[unit] = intelObj->textureOffset;
|
||||
|
||||
switch (intelObj->depthOverride) {
|
||||
case 32:
|
||||
format = MAPSURF_32BIT | MT_32BIT_ARGB8888;
|
||||
break;
|
||||
case 24:
|
||||
default:
|
||||
format = MAPSURF_32BIT | MT_32BIT_XRGB8888;
|
||||
break;
|
||||
case 16:
|
||||
format = MAPSURF_16BIT | MT_16BIT_RGB565;
|
||||
break;
|
||||
}
|
||||
|
||||
pitch = intelObj->pitchOverride;
|
||||
} else {
|
||||
i915->state.tex_buffer[unit] = driBOReference(intelObj->mt->region->
|
||||
buffer);
|
||||
i915->state.tex_offset[unit] = intel_miptree_image_offset(intelObj->mt,
|
||||
0, intelObj->
|
||||
firstLevel);
|
||||
|
||||
format = translate_texture_format(firstImage->TexFormat->MesaFormat);
|
||||
pitch = intelObj->mt->pitch * intelObj->mt->cpp;
|
||||
}
|
||||
|
||||
state[I915_TEXREG_MS3] =
|
||||
(((firstImage->Height - 1) << MS3_HEIGHT_SHIFT) |
|
||||
((firstImage->Width - 1) << MS3_WIDTH_SHIFT) |
|
||||
translate_texture_format(firstImage->TexFormat->MesaFormat) |
|
||||
((firstImage->Width - 1) << MS3_WIDTH_SHIFT) | format |
|
||||
MS3_USE_FENCE_REGS);
|
||||
|
||||
state[I915_TEXREG_MS4] =
|
||||
(((((intelObj->mt->pitch * intelObj->mt->cpp) / 4) -
|
||||
1) << MS4_PITCH_SHIFT) | MS4_CUBE_FACE_ENA_MASK |
|
||||
((((intelObj->lastLevel -
|
||||
intelObj->firstLevel) *
|
||||
4)) << MS4_MAX_LOD_SHIFT) | ((firstImage->Depth -
|
||||
1) << MS4_VOLUME_DEPTH_SHIFT));
|
||||
((((pitch / 4) - 1) << MS4_PITCH_SHIFT) | MS4_CUBE_FACE_ENA_MASK |
|
||||
((((intelObj->lastLevel - intelObj->firstLevel) * 4)) <<
|
||||
MS4_MAX_LOD_SHIFT) | ((firstImage->Depth - 1) <<
|
||||
MS4_VOLUME_DEPTH_SHIFT));
|
||||
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -381,11 +381,13 @@ i915_emit_state(struct intel_context *intel)
|
|||
DRM_BO_MASK_MEM | DRM_BO_FLAG_READ,
|
||||
state->tex_offset[i]);
|
||||
}
|
||||
else {
|
||||
else if (state == &i915->meta) {
|
||||
assert(i == 0);
|
||||
assert(state == &i915->meta);
|
||||
OUT_BATCH(0);
|
||||
}
|
||||
else {
|
||||
OUT_BATCH(state->tex_offset[i]);
|
||||
}
|
||||
|
||||
OUT_BATCH(state->Tex[i][I915_TEXREG_MS3]);
|
||||
OUT_BATCH(state->Tex[i][I915_TEXREG_MS4]);
|
||||
|
|
|
|||
|
|
@ -134,6 +134,18 @@ intelGetString(GLcontext * ctx, GLenum name)
|
|||
case PCI_CHIP_I945_GM:
|
||||
chipset = "Intel(R) 945GM";
|
||||
break;
|
||||
case PCI_CHIP_I945_GME:
|
||||
chipset = "Intel(R) 945GME";
|
||||
break;
|
||||
case PCI_CHIP_G33_G:
|
||||
chipset = "Intel(R) G33";
|
||||
break;
|
||||
case PCI_CHIP_Q35_G:
|
||||
chipset = "Intel(R) Q35";
|
||||
break;
|
||||
case PCI_CHIP_Q33_G:
|
||||
chipset = "Intel(R) Q33";
|
||||
break;
|
||||
default:
|
||||
chipset = "Unknown Intel Chipset";
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -92,6 +92,10 @@ struct intel_texture_object
|
|||
* regions will be copied to this region and the old storage freed.
|
||||
*/
|
||||
struct intel_mipmap_tree *mt;
|
||||
|
||||
GLboolean imageOverride;
|
||||
GLint depthOverride;
|
||||
GLuint pitchOverride;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -381,6 +385,10 @@ extern int INTEL_DEBUG;
|
|||
#define PCI_CHIP_I915_GM 0x2592
|
||||
#define PCI_CHIP_I945_G 0x2772
|
||||
#define PCI_CHIP_I945_GM 0x27A2
|
||||
#define PCI_CHIP_I945_GME 0x27AE
|
||||
#define PCI_CHIP_G33_G 0x29C2
|
||||
#define PCI_CHIP_Q35_G 0x29B2
|
||||
#define PCI_CHIP_Q33_G 0x29D2
|
||||
|
||||
|
||||
/* ================================================================
|
||||
|
|
@ -395,7 +403,6 @@ extern GLboolean intelInitContext(struct intel_context *intel,
|
|||
|
||||
extern void intelGetLock(struct intel_context *intel, GLuint flags);
|
||||
|
||||
extern void intelInitState(GLcontext * ctx);
|
||||
extern void intelFinish(GLcontext * ctx);
|
||||
extern void intelFlush(GLcontext * ctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -79,6 +79,10 @@ intel_miptree_create(struct intel_context *intel,
|
|||
switch (intel->intelScreen->deviceID) {
|
||||
case PCI_CHIP_I945_G:
|
||||
case PCI_CHIP_I945_GM:
|
||||
case PCI_CHIP_I945_GME:
|
||||
case PCI_CHIP_G33_G:
|
||||
case PCI_CHIP_Q33_G:
|
||||
case PCI_CHIP_Q35_G:
|
||||
ok = i945_miptree_layout(mt);
|
||||
break;
|
||||
case PCI_CHIP_I915_G:
|
||||
|
|
|
|||
|
|
@ -363,5 +363,20 @@ intelDrawPixels(GLcontext * ctx,
|
|||
if (INTEL_DEBUG & DEBUG_PIXEL)
|
||||
_mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
|
||||
|
||||
_swrast_DrawPixels(ctx, x, y, width, height, format, type, unpack, pixels);
|
||||
if (ctx->FragmentProgram._Current == ctx->FragmentProgram._TexEnvProgram) {
|
||||
/*
|
||||
* We don't want the i915 texenv program to be applied to DrawPixels.
|
||||
* This is really just a performance optimization (mesa will other-
|
||||
* wise happily run the fragment program on each pixel in the image).
|
||||
*/
|
||||
struct gl_fragment_program *fpSave = ctx->FragmentProgram._Current;
|
||||
ctx->FragmentProgram._Current = NULL;
|
||||
_swrast_DrawPixels( ctx, x, y, width, height, format, type,
|
||||
unpack, pixels );
|
||||
ctx->FragmentProgram._Current = fpSave;
|
||||
}
|
||||
else {
|
||||
_swrast_DrawPixels( ctx, x, y, width, height, format, type,
|
||||
unpack, pixels );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -752,6 +752,10 @@ intelCreateContext(const __GLcontextModes * mesaVis,
|
|||
case PCI_CHIP_I915_GM:
|
||||
case PCI_CHIP_I945_G:
|
||||
case PCI_CHIP_I945_GM:
|
||||
case PCI_CHIP_I945_GME:
|
||||
case PCI_CHIP_G33_G:
|
||||
case PCI_CHIP_Q35_G:
|
||||
case PCI_CHIP_Q33_G:
|
||||
return i915CreateContext(mesaVis, driContextPriv, sharedContextPrivate);
|
||||
|
||||
default:
|
||||
|
|
@ -776,7 +780,8 @@ static const struct __DriverAPIRec intelAPI = {
|
|||
.WaitForMSC = driWaitForMSC32,
|
||||
.WaitForSBC = NULL,
|
||||
.SwapBuffersMSC = NULL,
|
||||
.CopySubBuffer = intelCopySubBuffer
|
||||
.CopySubBuffer = intelCopySubBuffer,
|
||||
.setTexOffset = intelSetTexOffset,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -267,97 +267,3 @@ intelInitStateFuncs(struct dd_function_table *functions)
|
|||
functions->DepthRange = intelDepthRange;
|
||||
functions->ClearColor = intelClearColor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
intelInitState(GLcontext * ctx)
|
||||
{
|
||||
/* Mesa should do this for us:
|
||||
*/
|
||||
ctx->Driver.AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef);
|
||||
|
||||
ctx->Driver.BlendColor(ctx, ctx->Color.BlendColor);
|
||||
|
||||
ctx->Driver.BlendEquationSeparate(ctx,
|
||||
ctx->Color.BlendEquationRGB,
|
||||
ctx->Color.BlendEquationA);
|
||||
|
||||
ctx->Driver.BlendFuncSeparate(ctx,
|
||||
ctx->Color.BlendSrcRGB,
|
||||
ctx->Color.BlendDstRGB,
|
||||
ctx->Color.BlendSrcA, ctx->Color.BlendDstA);
|
||||
|
||||
ctx->Driver.ColorMask(ctx,
|
||||
ctx->Color.ColorMask[RCOMP],
|
||||
ctx->Color.ColorMask[GCOMP],
|
||||
ctx->Color.ColorMask[BCOMP],
|
||||
ctx->Color.ColorMask[ACOMP]);
|
||||
|
||||
ctx->Driver.CullFace(ctx, ctx->Polygon.CullFaceMode);
|
||||
ctx->Driver.DepthFunc(ctx, ctx->Depth.Func);
|
||||
ctx->Driver.DepthMask(ctx, ctx->Depth.Mask);
|
||||
|
||||
ctx->Driver.Enable(ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled);
|
||||
ctx->Driver.Enable(ctx, GL_BLEND, ctx->Color.BlendEnabled);
|
||||
ctx->Driver.Enable(ctx, GL_COLOR_LOGIC_OP, ctx->Color.ColorLogicOpEnabled);
|
||||
ctx->Driver.Enable(ctx, GL_COLOR_SUM, ctx->Fog.ColorSumEnabled);
|
||||
ctx->Driver.Enable(ctx, GL_CULL_FACE, ctx->Polygon.CullFlag);
|
||||
ctx->Driver.Enable(ctx, GL_DEPTH_TEST, ctx->Depth.Test);
|
||||
ctx->Driver.Enable(ctx, GL_DITHER, ctx->Color.DitherFlag);
|
||||
ctx->Driver.Enable(ctx, GL_FOG, ctx->Fog.Enabled);
|
||||
ctx->Driver.Enable(ctx, GL_LIGHTING, ctx->Light.Enabled);
|
||||
ctx->Driver.Enable(ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag);
|
||||
ctx->Driver.Enable(ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag);
|
||||
ctx->Driver.Enable(ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled);
|
||||
ctx->Driver.Enable(ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled);
|
||||
ctx->Driver.Enable(ctx, GL_TEXTURE_1D, GL_FALSE);
|
||||
ctx->Driver.Enable(ctx, GL_TEXTURE_2D, GL_FALSE);
|
||||
ctx->Driver.Enable(ctx, GL_TEXTURE_RECTANGLE_NV, GL_FALSE);
|
||||
ctx->Driver.Enable(ctx, GL_TEXTURE_3D, GL_FALSE);
|
||||
ctx->Driver.Enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
|
||||
|
||||
ctx->Driver.Fogfv(ctx, GL_FOG_COLOR, ctx->Fog.Color);
|
||||
ctx->Driver.Fogfv(ctx, GL_FOG_MODE, 0);
|
||||
ctx->Driver.Fogfv(ctx, GL_FOG_DENSITY, &ctx->Fog.Density);
|
||||
ctx->Driver.Fogfv(ctx, GL_FOG_START, &ctx->Fog.Start);
|
||||
ctx->Driver.Fogfv(ctx, GL_FOG_END, &ctx->Fog.End);
|
||||
|
||||
ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace);
|
||||
|
||||
{
|
||||
GLfloat f = (GLfloat) ctx->Light.Model.ColorControl;
|
||||
ctx->Driver.LightModelfv(ctx, GL_LIGHT_MODEL_COLOR_CONTROL, &f);
|
||||
}
|
||||
|
||||
ctx->Driver.LineWidth(ctx, ctx->Line.Width);
|
||||
ctx->Driver.LogicOpcode(ctx, ctx->Color.LogicOp);
|
||||
ctx->Driver.PointSize(ctx, ctx->Point.Size);
|
||||
ctx->Driver.PolygonStipple(ctx, (const GLubyte *) ctx->PolygonStipple);
|
||||
ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
|
||||
ctx->Scissor.Width, ctx->Scissor.Height);
|
||||
ctx->Driver.ShadeModel(ctx, ctx->Light.ShadeModel);
|
||||
ctx->Driver.StencilFuncSeparate(ctx, GL_FRONT,
|
||||
ctx->Stencil.Function[0],
|
||||
ctx->Stencil.Ref[0],
|
||||
ctx->Stencil.ValueMask[0]);
|
||||
ctx->Driver.StencilFuncSeparate(ctx, GL_BACK,
|
||||
ctx->Stencil.Function[1],
|
||||
ctx->Stencil.Ref[1],
|
||||
ctx->Stencil.ValueMask[1]);
|
||||
ctx->Driver.StencilMaskSeparate(ctx, GL_FRONT, ctx->Stencil.WriteMask[0]);
|
||||
ctx->Driver.StencilMaskSeparate(ctx, GL_BACK, ctx->Stencil.WriteMask[1]);
|
||||
ctx->Driver.StencilOpSeparate(ctx, GL_FRONT,
|
||||
ctx->Stencil.FailFunc[0],
|
||||
ctx->Stencil.ZFailFunc[0],
|
||||
ctx->Stencil.ZPassFunc[0]);
|
||||
ctx->Driver.StencilOpSeparate(ctx, GL_BACK,
|
||||
ctx->Stencil.FailFunc[1],
|
||||
ctx->Stencil.ZFailFunc[1],
|
||||
ctx->Stencil.ZPassFunc[1]);
|
||||
|
||||
|
||||
/* XXX this isn't really needed */
|
||||
ctx->Driver.DrawBuffer(ctx, ctx->Color.DrawBuffer[0]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,6 +135,9 @@ void intelGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level,
|
|||
const struct gl_texture_object *texObj,
|
||||
const struct gl_texture_image *texImage);
|
||||
|
||||
void intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname,
|
||||
unsigned long long offset, GLint depth, GLuint pitch);
|
||||
|
||||
GLuint intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit);
|
||||
|
||||
void intel_tex_map_images(struct intel_context *intel,
|
||||
|
|
|
|||
|
|
@ -385,7 +385,6 @@ intelTexImage(GLcontext * ctx,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
assert(!intelImage->mt);
|
||||
|
||||
if (intelObj->mt &&
|
||||
|
|
@ -667,3 +666,26 @@ intelGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level,
|
|||
texObj, texImage, 1);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname,
|
||||
unsigned long long offset, GLint depth, GLuint pitch)
|
||||
{
|
||||
struct intel_context *intel = (struct intel_context*)
|
||||
((__DRIcontextPrivate*)pDRICtx->private)->driverPrivate;
|
||||
struct gl_texture_object *tObj = _mesa_lookup_texture(&intel->ctx, texname);
|
||||
struct intel_texture_object *intelObj = intel_texture_object(tObj);
|
||||
|
||||
if (!intelObj)
|
||||
return;
|
||||
|
||||
if (intelObj->mt)
|
||||
intel_miptree_release(intel, &intelObj->mt);
|
||||
|
||||
intelObj->imageOverride = GL_TRUE;
|
||||
intelObj->depthOverride = depth;
|
||||
intelObj->pitchOverride = pitch;
|
||||
|
||||
if (offset)
|
||||
intelObj->textureOffset = offset;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,6 +105,8 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
|
|||
{
|
||||
struct gl_texture_object *tObj = intel->ctx.Texture.Unit[unit]._Current;
|
||||
struct intel_texture_object *intelObj = intel_texture_object(tObj);
|
||||
int comp_byte = 0;
|
||||
int cpp;
|
||||
|
||||
GLuint face, i;
|
||||
GLuint nr_faces = 0;
|
||||
|
|
@ -114,7 +116,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
|
|||
|
||||
/* We know/require this is true by now:
|
||||
*/
|
||||
assert(intelObj->base.Complete);
|
||||
assert(intelObj->base._Complete);
|
||||
|
||||
/* What levels must the tree include at a minimum?
|
||||
*/
|
||||
|
|
@ -148,6 +150,12 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
|
|||
intel_miptree_reference(&intelObj->mt, firstImage->mt);
|
||||
}
|
||||
|
||||
if (firstImage->base.IsCompressed) {
|
||||
comp_byte = intel_compressed_num_bytes(firstImage->base.TexFormat->MesaFormat);
|
||||
cpp = comp_byte;
|
||||
}
|
||||
else cpp = firstImage->base.TexFormat->TexelBytes;
|
||||
|
||||
/* Check tree can hold all active levels. Check tree matches
|
||||
* target, imageFormat, etc.
|
||||
*
|
||||
|
|
@ -165,7 +173,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
|
|||
intelObj->mt->width0 != firstImage->base.Width ||
|
||||
intelObj->mt->height0 != firstImage->base.Height ||
|
||||
intelObj->mt->depth0 != firstImage->base.Depth ||
|
||||
intelObj->mt->cpp != firstImage->base.TexFormat->TexelBytes ||
|
||||
intelObj->mt->cpp != cpp ||
|
||||
intelObj->mt->compressed != firstImage->base.IsCompressed)) {
|
||||
intel_miptree_release(intel, &intelObj->mt);
|
||||
}
|
||||
|
|
@ -174,10 +182,6 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
|
|||
/* May need to create a new tree:
|
||||
*/
|
||||
if (!intelObj->mt) {
|
||||
int comp_byte = 0;
|
||||
|
||||
if (firstImage->base.IsCompressed)
|
||||
comp_byte = intel_compressed_num_bytes(firstImage->base.TexFormat->MesaFormat);
|
||||
intelObj->mt = intel_miptree_create(intel,
|
||||
intelObj->base.Target,
|
||||
firstImage->base.InternalFormat,
|
||||
|
|
@ -186,8 +190,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
|
|||
firstImage->base.Width,
|
||||
firstImage->base.Height,
|
||||
firstImage->base.Depth,
|
||||
firstImage->base.TexFormat->
|
||||
TexelBytes,
|
||||
cpp,
|
||||
comp_byte);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@
|
|||
#include "tnl/tnl.h"
|
||||
#include "vbo/vbo_context.h"
|
||||
#include "swrast/swrast.h"
|
||||
#include "swrast_setup/swrast_setup.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1154,7 +1154,9 @@ static void build_fog( struct tnl_program *p )
|
|||
{
|
||||
struct ureg fog = register_output(p, VERT_RESULT_FOGC);
|
||||
struct ureg input;
|
||||
|
||||
GLuint useabs = p->state->fog_source_is_depth && p->state->fog_option &&
|
||||
(p->state->fog_option != FOG_EXP2);
|
||||
|
||||
if (p->state->fog_source_is_depth) {
|
||||
input = swizzle1(get_eye_position(p), Z);
|
||||
}
|
||||
|
|
@ -1171,26 +1173,30 @@ static void build_fog( struct tnl_program *p )
|
|||
|
||||
emit_op1(p, OPCODE_MOV, fog, 0, id);
|
||||
|
||||
if (useabs) {
|
||||
emit_op1(p, OPCODE_ABS, tmp, 0, input);
|
||||
}
|
||||
|
||||
switch (p->state->fog_option) {
|
||||
case FOG_LINEAR: {
|
||||
emit_op1(p, OPCODE_ABS, tmp, 0, input);
|
||||
emit_op3(p, OPCODE_MAD, tmp, 0, tmp, swizzle1(params,X), swizzle1(params,Y));
|
||||
emit_op3(p, OPCODE_MAD, tmp, 0, useabs ? tmp : input,
|
||||
swizzle1(params,X), swizzle1(params,Y));
|
||||
emit_op2(p, OPCODE_MAX, tmp, 0, tmp, swizzle1(id,X)); /* saturate */
|
||||
emit_op2(p, OPCODE_MIN, fog, WRITEMASK_X, tmp, swizzle1(id,W));
|
||||
break;
|
||||
}
|
||||
case FOG_EXP:
|
||||
emit_op1(p, OPCODE_ABS, tmp, 0, input);
|
||||
emit_op2(p, OPCODE_MUL, tmp, 0, tmp, swizzle1(params,Z));
|
||||
emit_op2(p, OPCODE_MUL, tmp, 0, useabs ? tmp : input,
|
||||
swizzle1(params,Z));
|
||||
emit_op1(p, OPCODE_EX2, fog, WRITEMASK_X, ureg_negate(tmp));
|
||||
break;
|
||||
case FOG_EXP2:
|
||||
emit_op2(p, OPCODE_MUL, tmp, 0, input, swizzle1(params,W));
|
||||
emit_op2(p, OPCODE_MUL, tmp, 0, tmp, tmp);
|
||||
emit_op2(p, OPCODE_MUL, tmp, 0, tmp, tmp);
|
||||
emit_op1(p, OPCODE_EX2, fog, WRITEMASK_X, ureg_negate(tmp));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
release_temp(p, tmp);
|
||||
}
|
||||
else {
|
||||
|
|
@ -1198,7 +1204,7 @@ static void build_fog( struct tnl_program *p )
|
|||
*
|
||||
* KW: Is it really necessary to do anything in this case?
|
||||
*/
|
||||
emit_op1(p, OPCODE_MOV, fog, 0, input);
|
||||
emit_op1(p, useabs ? OPCODE_ABS : OPCODE_MOV, fog, 0, input);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -532,12 +532,15 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
|
|||
GLuint dst_offset,
|
||||
GLboolean dst_tiled,
|
||||
GLshort x, GLshort y,
|
||||
GLshort w, GLshort h)
|
||||
GLshort w, GLshort h,
|
||||
GLenum logic_op)
|
||||
{
|
||||
struct xy_setup_blit setup;
|
||||
struct xy_text_immediate_blit text;
|
||||
int dwords = ((src_size + 7) & ~7) / 4;
|
||||
|
||||
assert( logic_op - GL_CLEAR >= 0 );
|
||||
assert( logic_op - GL_CLEAR < 0x10 );
|
||||
|
||||
if (w < 0 || h < 0)
|
||||
return;
|
||||
|
|
@ -561,7 +564,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
|
|||
setup.br0.length = (sizeof(setup) / sizeof(int)) - 2;
|
||||
|
||||
setup.br13.dest_pitch = dst_pitch;
|
||||
setup.br13.rop = 0xcc;
|
||||
setup.br13.rop = translate_raster_op(logic_op);
|
||||
setup.br13.color_depth = (cpp == 4) ? BR13_8888 : BR13_565;
|
||||
setup.br13.clipping_enable = 0;
|
||||
setup.br13.mono_source_transparency = 1;
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
|
|||
GLuint dst_offset,
|
||||
GLboolean dst_tiled,
|
||||
GLshort dst_x, GLshort dst_y,
|
||||
GLshort w, GLshort h);
|
||||
GLshort w, GLshort h,
|
||||
GLenum logic_op );
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -106,20 +106,23 @@ static const GLubyte *intelGetString( GLcontext *ctx, GLenum name )
|
|||
case GL_RENDERER:
|
||||
switch (intel_context(ctx)->intelScreen->deviceID) {
|
||||
case PCI_CHIP_I965_Q:
|
||||
chipset = "Intel(R) 965Q"; break;
|
||||
chipset = "Intel(R) 965Q";
|
||||
break;
|
||||
case PCI_CHIP_I965_G:
|
||||
case PCI_CHIP_I965_G_1:
|
||||
chipset = "Intel(R) 965G"; break;
|
||||
chipset = "Intel(R) 965G";
|
||||
break;
|
||||
case PCI_CHIP_I946_GZ:
|
||||
chipset = "Intel(R) 946GZ"; break;
|
||||
chipset = "Intel(R) 946GZ";
|
||||
break;
|
||||
case PCI_CHIP_I965_GM:
|
||||
chipset = "Intel(R) 965GM"; break;
|
||||
chipset = "Intel(R) 965GM";
|
||||
break;
|
||||
case PCI_CHIP_I965_GME:
|
||||
chipset = "Intel(R) 965GME/GLE";
|
||||
break;
|
||||
default:
|
||||
chipset = "Unknown Intel Chipset"; break;
|
||||
chipset = "Unknown Intel Chipset";
|
||||
}
|
||||
|
||||
(void) driGetRendererString( buffer, chipset, DRIVER_VERSION, 0 );
|
||||
|
|
|
|||
|
|
@ -385,6 +385,7 @@ extern int INTEL_DEBUG;
|
|||
#define PCI_CHIP_I965_G_1 0x2982
|
||||
#define PCI_CHIP_I946_GZ 0x2972
|
||||
#define PCI_CHIP_I965_GM 0x2A02
|
||||
#define PCI_CHIP_I965_GME 0x2A12
|
||||
|
||||
|
||||
/* ================================================================
|
||||
|
|
@ -399,7 +400,6 @@ extern GLboolean intelInitContext( struct intel_context *intel,
|
|||
|
||||
extern void intelGetLock(struct intel_context *intel, GLuint flags);
|
||||
|
||||
extern void intelInitState( GLcontext *ctx );
|
||||
extern void intelFinish( GLcontext *ctx );
|
||||
extern void intelFlush( GLcontext *ctx );
|
||||
|
||||
|
|
|
|||
|
|
@ -260,7 +260,9 @@ do_blit_bitmap( GLcontext *ctx,
|
|||
int h = MIN2(DY, box_h - py);
|
||||
int w = MIN2(DX, box_w - px);
|
||||
GLuint sz = align(align(w,8) * h, 64)/8;
|
||||
|
||||
GLenum logic_op = ctx->Color.ColorLogicOpEnabled ?
|
||||
ctx->Color.LogicOp : GL_COPY;
|
||||
|
||||
assert(sz <= sizeof(stipple));
|
||||
memset(stipple, 0, sz);
|
||||
|
||||
|
|
@ -288,7 +290,8 @@ do_blit_bitmap( GLcontext *ctx,
|
|||
dst->tiled,
|
||||
rect.x1 + px,
|
||||
rect.y2 - (py + h),
|
||||
w, h);
|
||||
w, h,
|
||||
logic_op);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,99 +197,3 @@ void intelInitStateFuncs( struct dd_function_table *functions )
|
|||
functions->RenderMode = intelRenderMode;
|
||||
functions->ClearColor = intelClearColor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void intelInitState( GLcontext *ctx )
|
||||
{
|
||||
/* Mesa should do this for us:
|
||||
*/
|
||||
ctx->Driver.AlphaFunc( ctx,
|
||||
ctx->Color.AlphaFunc,
|
||||
ctx->Color.AlphaRef);
|
||||
|
||||
ctx->Driver.BlendColor( ctx,
|
||||
ctx->Color.BlendColor );
|
||||
|
||||
ctx->Driver.BlendEquationSeparate( ctx,
|
||||
ctx->Color.BlendEquationRGB,
|
||||
ctx->Color.BlendEquationA);
|
||||
|
||||
ctx->Driver.BlendFuncSeparate( ctx,
|
||||
ctx->Color.BlendSrcRGB,
|
||||
ctx->Color.BlendDstRGB,
|
||||
ctx->Color.BlendSrcA,
|
||||
ctx->Color.BlendDstA);
|
||||
|
||||
ctx->Driver.ColorMask( ctx,
|
||||
ctx->Color.ColorMask[RCOMP],
|
||||
ctx->Color.ColorMask[GCOMP],
|
||||
ctx->Color.ColorMask[BCOMP],
|
||||
ctx->Color.ColorMask[ACOMP]);
|
||||
|
||||
ctx->Driver.CullFace( ctx, ctx->Polygon.CullFaceMode );
|
||||
ctx->Driver.DepthFunc( ctx, ctx->Depth.Func );
|
||||
ctx->Driver.DepthMask( ctx, ctx->Depth.Mask );
|
||||
|
||||
ctx->Driver.Enable( ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled );
|
||||
ctx->Driver.Enable( ctx, GL_BLEND, ctx->Color.BlendEnabled );
|
||||
ctx->Driver.Enable( ctx, GL_COLOR_LOGIC_OP, ctx->Color.ColorLogicOpEnabled );
|
||||
ctx->Driver.Enable( ctx, GL_COLOR_SUM, ctx->Fog.ColorSumEnabled );
|
||||
ctx->Driver.Enable( ctx, GL_CULL_FACE, ctx->Polygon.CullFlag );
|
||||
ctx->Driver.Enable( ctx, GL_DEPTH_TEST, ctx->Depth.Test );
|
||||
ctx->Driver.Enable( ctx, GL_DITHER, ctx->Color.DitherFlag );
|
||||
ctx->Driver.Enable( ctx, GL_FOG, ctx->Fog.Enabled );
|
||||
ctx->Driver.Enable( ctx, GL_LIGHTING, ctx->Light.Enabled );
|
||||
ctx->Driver.Enable( ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag );
|
||||
ctx->Driver.Enable( ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag );
|
||||
ctx->Driver.Enable( ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled );
|
||||
ctx->Driver.Enable( ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled );
|
||||
ctx->Driver.Enable( ctx, GL_TEXTURE_1D, GL_FALSE );
|
||||
ctx->Driver.Enable( ctx, GL_TEXTURE_2D, GL_FALSE );
|
||||
ctx->Driver.Enable( ctx, GL_TEXTURE_RECTANGLE_NV, GL_FALSE );
|
||||
ctx->Driver.Enable( ctx, GL_TEXTURE_3D, GL_FALSE );
|
||||
ctx->Driver.Enable( ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE );
|
||||
|
||||
ctx->Driver.Fogfv( ctx, GL_FOG_COLOR, ctx->Fog.Color );
|
||||
ctx->Driver.Fogfv( ctx, GL_FOG_MODE, 0 );
|
||||
ctx->Driver.Fogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density );
|
||||
ctx->Driver.Fogfv( ctx, GL_FOG_START, &ctx->Fog.Start );
|
||||
ctx->Driver.Fogfv( ctx, GL_FOG_END, &ctx->Fog.End );
|
||||
|
||||
ctx->Driver.FrontFace( ctx, ctx->Polygon.FrontFace );
|
||||
|
||||
{
|
||||
GLfloat f = (GLfloat)ctx->Light.Model.ColorControl;
|
||||
ctx->Driver.LightModelfv( ctx, GL_LIGHT_MODEL_COLOR_CONTROL, &f );
|
||||
}
|
||||
|
||||
ctx->Driver.LineWidth( ctx, ctx->Line.Width );
|
||||
ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp );
|
||||
ctx->Driver.PointSize( ctx, ctx->Point.Size );
|
||||
ctx->Driver.PolygonStipple( ctx, (const GLubyte *)ctx->PolygonStipple );
|
||||
ctx->Driver.Scissor( ctx, ctx->Scissor.X, ctx->Scissor.Y,
|
||||
ctx->Scissor.Width, ctx->Scissor.Height );
|
||||
ctx->Driver.ShadeModel( ctx, ctx->Light.ShadeModel );
|
||||
ctx->Driver.StencilFuncSeparate( ctx, GL_FRONT,
|
||||
ctx->Stencil.Function[0],
|
||||
ctx->Stencil.Ref[0],
|
||||
ctx->Stencil.ValueMask[0] );
|
||||
ctx->Driver.StencilFuncSeparate( ctx, GL_BACK,
|
||||
ctx->Stencil.Function[1],
|
||||
ctx->Stencil.Ref[1],
|
||||
ctx->Stencil.ValueMask[1] );
|
||||
ctx->Driver.StencilMaskSeparate( ctx, GL_FRONT, ctx->Stencil.WriteMask[0] );
|
||||
ctx->Driver.StencilMaskSeparate( ctx, GL_BACK, ctx->Stencil.WriteMask[1] );
|
||||
ctx->Driver.StencilOpSeparate( ctx, GL_FRONT,
|
||||
ctx->Stencil.FailFunc[0],
|
||||
ctx->Stencil.ZFailFunc[0],
|
||||
ctx->Stencil.ZPassFunc[0]);
|
||||
ctx->Driver.StencilOpSeparate( ctx, GL_BACK,
|
||||
ctx->Stencil.FailFunc[1],
|
||||
ctx->Stencil.ZFailFunc[1],
|
||||
ctx->Stencil.ZPassFunc[1]);
|
||||
|
||||
|
||||
ctx->Driver.DrawBuffer( ctx, ctx->Color.DrawBuffer[0] );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ GLuint intel_finalize_mipmap_tree( struct intel_context *intel,
|
|||
|
||||
/* We know/require this is true by now:
|
||||
*/
|
||||
assert(intelObj->base.Complete);
|
||||
assert(intelObj->base._Complete);
|
||||
|
||||
/* What levels must the tree include at a minimum?
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ void i945_miptree_layout_2d( struct intel_mipmap_tree *mt )
|
|||
GLuint img_height;
|
||||
|
||||
intel_miptree_set_level_info(mt, level, 1, x, y, width,
|
||||
mt->compressed ? height/4 : height, 1);
|
||||
height, 1);
|
||||
|
||||
if (mt->compressed)
|
||||
img_height = MAX2(1, height/4);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ void TAG(translate_vertex)(GLcontext *ctx,
|
|||
UNVIEWPORT_VARS;
|
||||
CARD32 *p = (CARD32 *)src + 10 - mmesa->vertex_size;
|
||||
|
||||
dst->win[3] = 1.0;
|
||||
dst->attrib[FRAG_ATTRIB_WPOS][3] = 1.0;
|
||||
|
||||
switch ( format ) {
|
||||
case TEX1_VERTEX_FORMAT:
|
||||
|
|
@ -75,17 +75,17 @@ void TAG(translate_vertex)(GLcontext *ctx,
|
|||
dst->attrib[FRAG_ATTRIB_TEX0][1] = LE32_IN_FLOAT( p++ );
|
||||
#endif
|
||||
dst->attrib[FRAG_ATTRIB_TEX0][3] = 1.0;
|
||||
dst->win[3] = LE32_IN_FLOAT( p++ );
|
||||
dst->attrib[FRAG_ATTRIB_WPOS][3] = LE32_IN_FLOAT( p++ );
|
||||
|
||||
case NOTEX_VERTEX_FORMAT:
|
||||
dst->specular[2] = ((GLubyte *)p)[0];
|
||||
dst->specular[1] = ((GLubyte *)p)[1];
|
||||
dst->specular[0] = ((GLubyte *)p)[2];
|
||||
dst->attrib[FRAG_ATTRIB_FOGC][0] = ((GLubyte *)p)[3];
|
||||
dst->attrib[FRAG_ATTRIB_COL1][2] = UBYTE_TO_FLOAT(((GLubyte *)p)[0]);
|
||||
dst->attrib[FRAG_ATTRIB_COL1][1] = UBYTE_TO_FLOAT(((GLubyte *)p)[1]);
|
||||
dst->attrib[FRAG_ATTRIB_COL1][0] = UBYTE_TO_FLOAT(((GLubyte *)p)[2]);
|
||||
dst->attrib[FRAG_ATTRIB_FOGC][0] = ((GLubyte *)p)[3]; /*XXX int->float?*/
|
||||
p++;
|
||||
|
||||
case TINY_VERTEX_FORMAT:
|
||||
dst->win[2] = UNVIEWPORT_Z( LE32_IN( p++ ) );
|
||||
dst->attrib[FRAG_ATTRIB_WPOS][2] = UNVIEWPORT_Z( LE32_IN( p++ ) );
|
||||
|
||||
dst->color[2] = ((GLubyte *)p)[0];
|
||||
dst->color[1] = ((GLubyte *)p)[1];
|
||||
|
|
@ -96,8 +96,8 @@ void TAG(translate_vertex)(GLcontext *ctx,
|
|||
{
|
||||
GLuint xy = LE32_IN( p );
|
||||
|
||||
dst->win[0] = UNVIEWPORT_X( (GLfloat)(GLshort)( xy >> 16 ) );
|
||||
dst->win[1] = UNVIEWPORT_Y( (GLfloat)(GLshort)( xy & 0xffff ) );
|
||||
dst->attrib[FRAG_ATTRIB_WPOS][0] = UNVIEWPORT_X( (GLfloat)(GLshort)( xy >> 16 ) );
|
||||
dst->attrib[FRAG_ATTRIB_WPOS][1] = UNVIEWPORT_Y( (GLfloat)(GLshort)( xy & 0xffff ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ nouveau_bo_download_from_screen(GLcontext *ctx, GLuint offset, GLuint size,
|
|||
DEBUG("..sys_mem\n");
|
||||
in_mem = nouveau_mem_alloc(ctx, NOUVEAU_MEM_AGP, size, 0);
|
||||
if (in_mem) {
|
||||
DEBUG("....via AGP\n");
|
||||
DEBUG("....via GART\n");
|
||||
/* otherwise, try blitting to faster memory and
|
||||
* copying from there
|
||||
*/
|
||||
|
|
@ -86,7 +86,7 @@ nouveau_bo_upload_to_screen(GLcontext *ctx, GLuint offset, GLuint size,
|
|||
NOUVEAU_MEM_MAPPED,
|
||||
size, 0);
|
||||
if (out_mem) {
|
||||
DEBUG("....via AGP\n");
|
||||
DEBUG("....via GART\n");
|
||||
_mesa_memcpy(out_mem->map,
|
||||
nbo->cpu_mem_sys + offset, size);
|
||||
nouveau_memformat_flat_emit(ctx, nbo->gpu_mem, out_mem,
|
||||
|
|
@ -511,7 +511,7 @@ nouveauBufferData(GLcontext *ctx, GLenum target, GLsizeiptrARB size,
|
|||
gpu_flags = 0;
|
||||
break;
|
||||
default:
|
||||
gpu_flags = NOUVEAU_BO_VRAM_OK | NOUVEAU_BO_AGP_OK;
|
||||
gpu_flags = NOUVEAU_BO_VRAM_OK | NOUVEAU_BO_GART_OK;
|
||||
break;
|
||||
}
|
||||
nouveau_bo_init_storage(ctx, gpu_flags, size, data, usage, obj);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include "nouveau_buffers.h"
|
||||
|
||||
#define NOUVEAU_BO_VRAM_OK (NOUVEAU_MEM_FB | NOUVEAU_MEM_FB_ACCEPTABLE)
|
||||
#define NOUVEAU_BO_AGP_OK (NOUVEAU_MEM_AGP | NOUVEAU_MEM_AGP_ACCEPTABLE)
|
||||
#define NOUVEAU_BO_GART_OK (NOUVEAU_MEM_AGP | NOUVEAU_MEM_AGP_ACCEPTABLE)
|
||||
|
||||
typedef struct nouveau_bufferobj_region_t {
|
||||
uint32_t start;
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ nouveau_memformat_flat_emit(GLcontext *ctx,
|
|||
return GL_FALSE;
|
||||
}
|
||||
|
||||
src_handle = (src->type & NOUVEAU_MEM_FB) ? NvDmaFB : NvDmaAGP;
|
||||
dst_handle = (dst->type & NOUVEAU_MEM_FB) ? NvDmaFB : NvDmaAGP;
|
||||
src_handle = (src->type & NOUVEAU_MEM_FB) ? NvDmaFB : NvDmaTT;
|
||||
dst_handle = (dst->type & NOUVEAU_MEM_FB) ? NvDmaFB : NvDmaTT;
|
||||
src_offset += nouveau_mem_gpu_offset_get(ctx, src);
|
||||
dst_offset += nouveau_mem_gpu_offset_get(ctx, dst);
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ nouveau_mem_gpu_offset_get(GLcontext *ctx, nouveau_mem *mem)
|
|||
if (mem->type & NOUVEAU_MEM_FB)
|
||||
return (uint32_t)mem->offset - nmesa->vram_phys;
|
||||
else if (mem->type & NOUVEAU_MEM_AGP)
|
||||
return (uint32_t)mem->offset - nmesa->agp_phys;
|
||||
return (uint32_t)mem->offset - nmesa->gart_phys;
|
||||
else
|
||||
return 0xDEADF00D;
|
||||
}
|
||||
|
|
@ -299,6 +299,8 @@ nouveau_cliprects_drawable_set(nouveauContextPtr nmesa,
|
|||
nmesa->pClipRects = dPriv->pClipRects;
|
||||
nmesa->drawX = dPriv->x;
|
||||
nmesa->drawY = dPriv->y;
|
||||
nmesa->drawW = dPriv->w;
|
||||
nmesa->drawH = dPriv->h;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -313,6 +315,8 @@ nouveau_cliprects_renderbuffer_set(nouveauContextPtr nmesa,
|
|||
nmesa->osClipRect.y2 = nrb->mesa.Height;
|
||||
nmesa->drawX = 0;
|
||||
nmesa->drawY = 0;
|
||||
nmesa->drawW = nrb->mesa.Width;
|
||||
nmesa->drawH = nrb->mesa.Height;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -145,10 +145,10 @@ GLboolean nouveauCreateContext( const __GLcontextModes *glVisual,
|
|||
&nmesa->vram_size))
|
||||
return GL_FALSE;
|
||||
if (!nouveauDRMGetParam(nmesa, NOUVEAU_GETPARAM_AGP_PHYSICAL,
|
||||
&nmesa->agp_phys))
|
||||
&nmesa->gart_phys))
|
||||
return GL_FALSE;
|
||||
if (!nouveauDRMGetParam(nmesa, NOUVEAU_GETPARAM_AGP_SIZE,
|
||||
&nmesa->agp_size))
|
||||
&nmesa->gart_size))
|
||||
return GL_FALSE;
|
||||
if (!nouveauFifoInit(nmesa))
|
||||
return GL_FALSE;
|
||||
|
|
|
|||
|
|
@ -99,19 +99,22 @@ typedef struct nouveau_context {
|
|||
/* The read-only regs */
|
||||
volatile unsigned char* mmio;
|
||||
|
||||
/* The per-channel notifier block */
|
||||
volatile void *notifier_block;
|
||||
|
||||
/* Physical addresses of AGP/VRAM apertures */
|
||||
uint64_t vram_phys;
|
||||
uint64_t vram_size;
|
||||
uint64_t agp_phys;
|
||||
uint64_t agp_size;
|
||||
uint64_t gart_phys;
|
||||
uint64_t gart_size;
|
||||
|
||||
/* Channel synchronisation */
|
||||
nouveau_notifier *syncNotifier;
|
||||
drm_nouveau_notifier_alloc_t *syncNotifier;
|
||||
|
||||
/* ARB_occlusion_query / EXT_timer_query */
|
||||
GLuint query_object_max;
|
||||
GLboolean * query_alloc;
|
||||
nouveau_notifier *queryNotifier;
|
||||
drm_nouveau_notifier_alloc_t *queryNotifier;
|
||||
|
||||
/* Additional hw-specific functions */
|
||||
nouveau_hw_func hw_func;
|
||||
|
|
@ -150,7 +153,7 @@ typedef struct nouveau_context {
|
|||
GLuint numClipRects;
|
||||
drm_clip_rect_t *pClipRects;
|
||||
drm_clip_rect_t osClipRect;
|
||||
GLuint drawX, drawY;
|
||||
GLuint drawX, drawY, drawW, drawH;
|
||||
|
||||
/* The rendering context information */
|
||||
GLenum current_primitive; /* the current primitive enum */
|
||||
|
|
|
|||
|
|
@ -99,13 +99,14 @@ void nouveauWaitForIdle(nouveauContextPtr nmesa)
|
|||
GLboolean nouveauFifoInit(nouveauContextPtr nmesa)
|
||||
{
|
||||
drm_nouveau_fifo_alloc_t fifo_init;
|
||||
int i;
|
||||
int i, ret;
|
||||
|
||||
#ifdef NOUVEAU_RING_DEBUG
|
||||
return GL_TRUE;
|
||||
#endif
|
||||
|
||||
int ret;
|
||||
fifo_init.fb_ctxdma_handle = NvDmaFB;
|
||||
fifo_init.tt_ctxdma_handle = NvDmaTT;
|
||||
ret=drmCommandWriteRead(nmesa->driFd, DRM_NOUVEAU_FIFO_ALLOC, &fifo_init, sizeof(fifo_init));
|
||||
if (ret) {
|
||||
FATAL("Fifo initialization ioctl failed (returned %d)\n",ret);
|
||||
|
|
@ -117,12 +118,21 @@ GLboolean nouveauFifoInit(nouveauContextPtr nmesa)
|
|||
FATAL("Unable to map the fifo (returned %d)\n",ret);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
ret = drmMap(nmesa->driFd, fifo_init.ctrl, fifo_init.ctrl_size, &nmesa->fifo.mmio);
|
||||
if (ret) {
|
||||
FATAL("Unable to map the control regs (returned %d)\n",ret);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
ret = drmMap(nmesa->driFd, fifo_init.notifier,
|
||||
fifo_init.notifier_size,
|
||||
&nmesa->notifier_block);
|
||||
if (ret) {
|
||||
FATAL("Unable to map the notifier block (returned %d)\n",ret);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* Setup our initial FIFO tracking params */
|
||||
nmesa->fifo.channel = fifo_init.channel;
|
||||
nmesa->fifo.put_base = fifo_init.put_base;
|
||||
|
|
|
|||
|
|
@ -7,61 +7,18 @@
|
|||
GLboolean nouveauCreateContextObject(nouveauContextPtr nmesa,
|
||||
uint32_t handle, int class)
|
||||
{
|
||||
drm_nouveau_object_init_t cto;
|
||||
drm_nouveau_grobj_alloc_t cto;
|
||||
int ret;
|
||||
|
||||
cto.channel = nmesa->fifo.channel;
|
||||
cto.handle = handle;
|
||||
cto.class = class;
|
||||
ret = drmCommandWrite(nmesa->driFd, DRM_NOUVEAU_OBJECT_INIT, &cto, sizeof(cto));
|
||||
ret = drmCommandWrite(nmesa->driFd, DRM_NOUVEAU_GROBJ_ALLOC,
|
||||
&cto, sizeof(cto));
|
||||
|
||||
return ret == 0;
|
||||
}
|
||||
|
||||
GLboolean nouveauCreateDmaObject(nouveauContextPtr nmesa,
|
||||
uint32_t handle,
|
||||
int class,
|
||||
uint32_t offset,
|
||||
uint32_t size,
|
||||
int target,
|
||||
int access)
|
||||
{
|
||||
drm_nouveau_dma_object_init_t dma;
|
||||
int ret;
|
||||
|
||||
dma.channel = nmesa->fifo.channel;
|
||||
dma.class = class;
|
||||
dma.handle = handle;
|
||||
dma.target = target;
|
||||
dma.access = access;
|
||||
dma.offset = offset;
|
||||
dma.size = size;
|
||||
ret = drmCommandWriteRead(nmesa->driFd, DRM_NOUVEAU_DMA_OBJECT_INIT,
|
||||
&dma, sizeof(dma));
|
||||
return ret == 0;
|
||||
}
|
||||
|
||||
GLboolean nouveauCreateDmaObjectFromMem(nouveauContextPtr nmesa,
|
||||
uint32_t handle, int class,
|
||||
nouveau_mem *mem,
|
||||
int access)
|
||||
{
|
||||
uint32_t offset = mem->offset;
|
||||
int target = mem->type & (NOUVEAU_MEM_FB | NOUVEAU_MEM_AGP);
|
||||
|
||||
if (!target)
|
||||
return GL_FALSE;
|
||||
|
||||
if (target & NOUVEAU_MEM_FB)
|
||||
offset -= nmesa->vram_phys;
|
||||
else if (target & NOUVEAU_MEM_AGP)
|
||||
offset -= nmesa->agp_phys;
|
||||
|
||||
return nouveauCreateDmaObject(nmesa, handle, class,
|
||||
offset, mem->size,
|
||||
target, access);
|
||||
}
|
||||
|
||||
void nouveauObjectOnSubchannel(nouveauContextPtr nmesa, int subchannel, int handle)
|
||||
{
|
||||
BEGIN_RING_SIZE(subchannel, 0, 1);
|
||||
|
|
@ -74,16 +31,6 @@ void nouveauObjectInit(nouveauContextPtr nmesa)
|
|||
return;
|
||||
#endif
|
||||
|
||||
/* We need to know vram size.. and AGP size (and even if the card is AGP..) */
|
||||
nouveauCreateDmaObject( nmesa, NvDmaFB, NV_DMA_IN_MEMORY,
|
||||
0, nmesa->vram_size,
|
||||
NOUVEAU_MEM_FB,
|
||||
NOUVEAU_MEM_ACCESS_RW);
|
||||
nouveauCreateDmaObject( nmesa, NvDmaAGP, NV_DMA_IN_MEMORY,
|
||||
0, nmesa->agp_size,
|
||||
NOUVEAU_MEM_AGP,
|
||||
NOUVEAU_MEM_ACCESS_RW);
|
||||
|
||||
nouveauCreateContextObject(nmesa, Nv3D, nmesa->screen->card->class_3d);
|
||||
if (nmesa->screen->card->type>=NV_10) {
|
||||
nouveauCreateContextObject(nmesa, NvCtxSurf2D, NV10_CONTEXT_SURFACES_2D);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ enum DMAObjects {
|
|||
NvMemFormat = 0x80000022,
|
||||
NvCtxSurf3D = 0x80000023,
|
||||
NvDmaFB = 0xD0FB0001,
|
||||
NvDmaAGP = 0xD0AA0001,
|
||||
NvDmaTT = 0xD0AA0001,
|
||||
NvSyncNotify = 0xD0000001,
|
||||
NvQueryNotify = 0xD0000002
|
||||
};
|
||||
|
|
@ -31,17 +31,5 @@ extern void nouveauObjectOnSubchannel(nouveauContextPtr nmesa, int subchannel, i
|
|||
|
||||
extern GLboolean nouveauCreateContextObject(nouveauContextPtr nmesa,
|
||||
uint32_t handle, int class);
|
||||
extern GLboolean nouveauCreateDmaObject(nouveauContextPtr nmesa,
|
||||
uint32_t handle,
|
||||
int class,
|
||||
uint32_t offset,
|
||||
uint32_t size,
|
||||
int target,
|
||||
int access);
|
||||
extern GLboolean nouveauCreateDmaObjectFromMem(nouveauContextPtr nmesa,
|
||||
uint32_t handle,
|
||||
int class,
|
||||
nouveau_mem *mem,
|
||||
int access);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ nouveauBeginQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q)
|
|||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
nouveau_query_object *nq = (nouveau_query_object *)q;
|
||||
|
||||
nouveau_notifier_reset(nmesa->queryNotifier, nq->notifier_id);
|
||||
nouveau_notifier_reset(ctx, nmesa->queryNotifier, nq->notifier_id);
|
||||
|
||||
switch (nmesa->screen->card->type) {
|
||||
case NV_20:
|
||||
|
|
@ -105,12 +105,13 @@ nouveauUpdateQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q)
|
|||
nouveau_query_object *nq = (nouveau_query_object *)q;
|
||||
int status;
|
||||
|
||||
status = nouveau_notifier_status(nmesa->queryNotifier,
|
||||
status = nouveau_notifier_status(ctx, nmesa->queryNotifier,
|
||||
nq->notifier_id);
|
||||
|
||||
q->Ready = (status == NV_NOTIFY_STATE_STATUS_COMPLETED);
|
||||
if (q->Ready)
|
||||
q->Result = nouveau_notifier_return_val(nmesa->queryNotifier,
|
||||
q->Result = nouveau_notifier_return_val(ctx,
|
||||
nmesa->queryNotifier,
|
||||
nq->notifier_id);
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +121,7 @@ nouveauWaitQueryResult(GLcontext *ctx, GLenum target, struct gl_query_object *q)
|
|||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
nouveau_query_object *nq = (nouveau_query_object *)q;
|
||||
|
||||
nouveau_notifier_wait_status(nmesa->queryNotifier, nq->notifier_id,
|
||||
nouveau_notifier_wait_status(ctx, nmesa->queryNotifier, nq->notifier_id,
|
||||
NV_NOTIFY_STATE_STATUS_COMPLETED, 0);
|
||||
nouveauUpdateQuery(ctx, target, q);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
|
|||
static const __DRIversion ddx_expected = { 1, 2, 0 };
|
||||
static const __DRIversion dri_expected = { 4, 0, 0 };
|
||||
static const __DRIversion drm_expected = { 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL };
|
||||
#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 6
|
||||
#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 7
|
||||
#error nouveau_drm.h version doesn't match expected version
|
||||
#endif
|
||||
dri_interface = interface;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#define HAVE_HW_STENCIL_SPANS 0
|
||||
#define HAVE_HW_STENCIL_PIXELS 0
|
||||
|
||||
static char *fake_span[1280*1024*4];
|
||||
|
||||
#define HW_CLIPLOOP() \
|
||||
do { \
|
||||
int _nc = nmesa->numClipRects; \
|
||||
|
|
@ -52,6 +54,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
GLuint height = nrb->mesa.Height; \
|
||||
GLubyte *map = (GLubyte *)(nrb->map ? nrb->map : nrb->mem->map) + \
|
||||
(nmesa->drawY * nrb->pitch) + (nmesa->drawX * nrb->cpp); \
|
||||
map = fake_span; \
|
||||
GLuint p; \
|
||||
(void) p;
|
||||
|
||||
|
|
@ -120,6 +123,6 @@ nouveauSpanSetFunctions(nouveau_renderbuffer *nrb, const GLvisual *vis)
|
|||
{
|
||||
if (nrb->mesa._ActualFormat == GL_RGBA8)
|
||||
nouveauInitPointers_ARGB8888(&nrb->mesa);
|
||||
else if (nrb->mesa._ActualFormat == GL_RGB5)
|
||||
else // if (nrb->mesa._ActualFormat == GL_RGB5)
|
||||
nouveauInitPointers_RGB565(&nrb->mesa);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,14 +60,14 @@ static void nouveauCalcViewport(GLcontext *ctx)
|
|||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
const GLfloat *v = ctx->Viewport._WindowMap.m;
|
||||
GLfloat *m = nmesa->viewport.m;
|
||||
GLfloat xoffset = nmesa->drawX, yoffset = nmesa->drawY;
|
||||
GLfloat xoffset = nmesa->drawX, yoffset = nmesa->drawY + nmesa->drawH;
|
||||
|
||||
nmesa->depth_scale = 1.0 / ctx->DrawBuffer->_DepthMaxF;
|
||||
|
||||
m[MAT_SX] = v[MAT_SX];
|
||||
m[MAT_TX] = v[MAT_TX] + xoffset + SUBPIXEL_X;
|
||||
m[MAT_SY] = - v[MAT_SY];
|
||||
m[MAT_TY] = v[MAT_TY] + yoffset + SUBPIXEL_Y;
|
||||
m[MAT_TY] = (-v[MAT_TY]) + yoffset + SUBPIXEL_Y;
|
||||
m[MAT_SZ] = v[MAT_SZ] * nmesa->depth_scale;
|
||||
m[MAT_TZ] = v[MAT_TZ] * nmesa->depth_scale;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,53 +35,51 @@
|
|||
#include "nouveau_msg.h"
|
||||
#include "nouveau_sync.h"
|
||||
|
||||
nouveau_notifier *
|
||||
#define NOTIFIER(__v) \
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); \
|
||||
volatile uint32_t *__v = (void*)nmesa->notifier_block + notifier->offset
|
||||
|
||||
drm_nouveau_notifier_alloc_t *
|
||||
nouveau_notifier_new(GLcontext *ctx, GLuint handle, GLuint count)
|
||||
{
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
nouveau_notifier *notifier;
|
||||
drm_nouveau_notifier_alloc_t *notifier;
|
||||
int ret;
|
||||
|
||||
#ifdef NOUVEAU_RING_DEBUG
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
notifier = CALLOC_STRUCT(nouveau_notifier_t);
|
||||
notifier = CALLOC_STRUCT(drm_nouveau_notifier_alloc);
|
||||
if (!notifier)
|
||||
return NULL;
|
||||
|
||||
notifier->mem = nouveau_mem_alloc(ctx,
|
||||
NOUVEAU_MEM_FB | NOUVEAU_MEM_MAPPED,
|
||||
count * NV_NOTIFIER_SIZE,
|
||||
0);
|
||||
if (!notifier->mem) {
|
||||
notifier->channel = nmesa->fifo.channel;
|
||||
notifier->handle = handle;
|
||||
notifier->count = count;
|
||||
ret = drmCommandWriteRead(nmesa->driFd, DRM_NOUVEAU_NOTIFIER_ALLOC,
|
||||
notifier, sizeof(*notifier));
|
||||
if (ret) {
|
||||
MESSAGE("Failed to create notifier 0x%08x: %d\n", handle, ret);
|
||||
FREE(notifier);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!nouveauCreateDmaObjectFromMem(nmesa, handle, NV_DMA_IN_MEMORY,
|
||||
notifier->mem,
|
||||
NOUVEAU_MEM_ACCESS_RW)) {
|
||||
nouveau_mem_free(ctx, notifier->mem);
|
||||
FREE(notifier);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
notifier->handle = handle;
|
||||
return notifier;
|
||||
}
|
||||
|
||||
void
|
||||
nouveau_notifier_destroy(GLcontext *ctx, nouveau_notifier *notifier)
|
||||
nouveau_notifier_destroy(GLcontext *ctx, drm_nouveau_notifier_alloc_t *notifier)
|
||||
{
|
||||
/*XXX: free DMA object.. */
|
||||
nouveau_mem_free(ctx, notifier->mem);
|
||||
/*XXX: free notifier object.. */
|
||||
FREE(notifier);
|
||||
}
|
||||
|
||||
void
|
||||
nouveau_notifier_reset(nouveau_notifier *notifier, GLuint id)
|
||||
nouveau_notifier_reset(GLcontext *ctx, drm_nouveau_notifier_alloc_t *notifier,
|
||||
GLuint id)
|
||||
{
|
||||
volatile GLuint *n = notifier->mem->map + (id * NV_NOTIFIER_SIZE);
|
||||
NOTIFIER(n);
|
||||
|
||||
#ifdef NOUVEAU_RING_DEBUG
|
||||
return;
|
||||
|
|
@ -95,26 +93,29 @@ nouveau_notifier_reset(nouveau_notifier *notifier, GLuint id)
|
|||
}
|
||||
|
||||
GLuint
|
||||
nouveau_notifier_status(nouveau_notifier *notifier, GLuint id)
|
||||
nouveau_notifier_status(GLcontext *ctx, drm_nouveau_notifier_alloc_t *notifier,
|
||||
GLuint id)
|
||||
{
|
||||
volatile GLuint *n = notifier->mem->map + (id * NV_NOTIFIER_SIZE);
|
||||
NOTIFIER(n);
|
||||
|
||||
return n[NV_NOTIFY_STATE/4] >> NV_NOTIFY_STATE_STATUS_SHIFT;
|
||||
}
|
||||
|
||||
GLuint
|
||||
nouveau_notifier_return_val(nouveau_notifier *notifier, GLuint id)
|
||||
nouveau_notifier_return_val(GLcontext *ctx,
|
||||
drm_nouveau_notifier_alloc_t *notifier, GLuint id)
|
||||
{
|
||||
volatile GLuint *n = notifier->mem->map + (id * NV_NOTIFIER_SIZE);
|
||||
NOTIFIER(n);
|
||||
|
||||
return n[NV_NOTIFY_RETURN_VALUE/4];
|
||||
}
|
||||
|
||||
GLboolean
|
||||
nouveau_notifier_wait_status(nouveau_notifier *notifier, GLuint id,
|
||||
nouveau_notifier_wait_status(GLcontext *ctx,
|
||||
drm_nouveau_notifier_alloc_t *notifier, GLuint id,
|
||||
GLuint status, GLuint timeout)
|
||||
{
|
||||
volatile GLuint *n = notifier->mem->map + (id * NV_NOTIFIER_SIZE);
|
||||
NOTIFIER(n);
|
||||
unsigned int time = 0;
|
||||
|
||||
#ifdef NOUVEAU_RING_DEBUG
|
||||
|
|
@ -144,13 +145,13 @@ nouveau_notifier_wait_status(nouveau_notifier *notifier, GLuint id,
|
|||
}
|
||||
|
||||
void
|
||||
nouveau_notifier_wait_nop(GLcontext *ctx, nouveau_notifier *notifier,
|
||||
GLuint subc)
|
||||
nouveau_notifier_wait_nop(GLcontext *ctx,
|
||||
drm_nouveau_notifier_alloc_t *notifier, GLuint subc)
|
||||
{
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
NOTIFIER(n);
|
||||
GLboolean ret;
|
||||
|
||||
nouveau_notifier_reset(notifier, 0);
|
||||
nouveau_notifier_reset(ctx, notifier, 0);
|
||||
|
||||
BEGIN_RING_SIZE(subc, NV_NOTIFY, 1);
|
||||
OUT_RING (NV_NOTIFY_STYLE_WRITE_ONLY);
|
||||
|
|
@ -158,7 +159,7 @@ nouveau_notifier_wait_nop(GLcontext *ctx, nouveau_notifier *notifier,
|
|||
OUT_RING (0);
|
||||
FIRE_RING();
|
||||
|
||||
ret = nouveau_notifier_wait_status(notifier, 0,
|
||||
ret = nouveau_notifier_wait_status(ctx, notifier, 0,
|
||||
NV_NOTIFY_STATE_STATUS_COMPLETED,
|
||||
0 /* no timeout */);
|
||||
if (ret == GL_FALSE) MESSAGE("wait on notifier failed\n");
|
||||
|
|
|
|||
|
|
@ -47,21 +47,23 @@
|
|||
#define NV_NOTIFY 0x00000104
|
||||
#define NV_NOTIFY_STYLE_WRITE_ONLY 0
|
||||
|
||||
typedef struct nouveau_notifier_t {
|
||||
GLuint handle;
|
||||
nouveau_mem *mem;
|
||||
} nouveau_notifier;
|
||||
|
||||
extern nouveau_notifier *nouveau_notifier_new(GLcontext *, GLuint handle,
|
||||
GLuint count);
|
||||
extern void nouveau_notifier_destroy(GLcontext *, nouveau_notifier *);
|
||||
extern void nouveau_notifier_reset(nouveau_notifier *, GLuint id);
|
||||
extern GLuint nouveau_notifier_status(nouveau_notifier *, GLuint id);
|
||||
extern GLuint nouveau_notifier_return_val(nouveau_notifier *, GLuint id);
|
||||
extern GLboolean nouveau_notifier_wait_status(nouveau_notifier *r, GLuint id,
|
||||
GLuint status, GLuint timeout);
|
||||
extern void nouveau_notifier_wait_nop(GLcontext *ctx,
|
||||
nouveau_notifier *, GLuint subc);
|
||||
extern drm_nouveau_notifier_alloc_t *
|
||||
nouveau_notifier_new(GLcontext *, GLuint handle, GLuint count);
|
||||
extern void
|
||||
nouveau_notifier_destroy(GLcontext *, drm_nouveau_notifier_alloc_t *);
|
||||
extern void
|
||||
nouveau_notifier_reset(GLcontext *, drm_nouveau_notifier_alloc_t *, GLuint id);
|
||||
extern GLuint
|
||||
nouveau_notifier_status(GLcontext *, drm_nouveau_notifier_alloc_t *, GLuint id);
|
||||
extern GLuint
|
||||
nouveau_notifier_return_val(GLcontext *, drm_nouveau_notifier_alloc_t *,
|
||||
GLuint id);
|
||||
extern GLboolean
|
||||
nouveau_notifier_wait_status(GLcontext *, drm_nouveau_notifier_alloc_t *,
|
||||
GLuint id, GLuint status, GLuint timeout);
|
||||
extern void
|
||||
nouveau_notifier_wait_nop(GLcontext *ctx, drm_nouveau_notifier_alloc_t *,
|
||||
GLuint subc);
|
||||
|
||||
extern GLboolean nouveauSyncInitFuncs(GLcontext *ctx);
|
||||
#endif
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue