Compare commits

...

93 Commits

Author SHA1 Message Date
Brian Paul
61b226a4f4 set planned release date (Oct 3) 2002-10-02 17:36:59 +00:00
Brian Paul
adc4d21dbb finished the spec 2002-10-02 17:31:05 +00:00
Brian Paul
efaa8be77f also test glTexSubImage2D() with YCbCr data 2002-10-02 17:26:18 +00:00
Brian Paul
ed7b3b61f5 better error checking related to YCbCr images 2002-10-02 17:24:40 +00:00
Brian Paul
17d73e49c8 disable GL_NV_texture_rectangle by default 2002-09-30 16:13:03 +00:00
Brian Paul
032341cbea fix bug in index_mask() (bug 609837) 2002-09-23 17:20:12 +00:00
Brian Paul
53170a3af0 gl_texture_image RowStride changes from DRI R200 branch 2002-09-23 16:39:43 +00:00
Brian Paul
57181b2c0a update from Daniel Borca 2002-09-21 22:45:30 +00:00
Keith Whitwell
00a1ff66e2 Spelling mistake meas --> mesa 2002-09-21 18:18:09 +00:00
Brian Paul
635e8c3459 documentation for GL_MESA_pack_invert extension 2002-09-21 18:12:17 +00:00
Brian Paul
6d99cffed3 fixed GL_MESA_pack_invert oversight 2002-09-21 17:36:08 +00:00
Brian Paul
9c16911e06 init pixelstore.Invert to GL_FALSE 2002-09-21 17:21:44 +00:00
Brian Paul
0de37dcc2e added GL_APPLE_client_storage GL_MESA_pack_invert 2002-09-21 17:20:02 +00:00
Brian Paul
a53dccf9c5 added GL_MESA_pack_invert 2002-09-21 17:12:10 +00:00
Brian Paul
3291a3c69c minor YCBCR fixes 2002-09-21 17:11:08 +00:00
Brian Paul
d2fba8a633 sync with DRI R200 branch (GL_APPLE_client_storage extension) 2002-09-20 19:40:52 +00:00
Brian Paul
8d7ed801a5 updated status to OBSOLETE 2002-09-20 19:14:11 +00:00
Brian Paul
689a803c90 first draft at spec'ing these new extensions 2002-09-20 19:11:33 +00:00
Karl Schultz
8365cbbc85 Add missing entries and clean up a bit. 2002-09-20 18:32:17 +00:00
Brian Paul
baa9451a93 finish-up AGP loose-ends 2002-09-20 17:37:13 +00:00
Brian Paul
79c9cca366 GLX_NV_vertex_array_range and GLX_MESA_agp_offset extensions 2002-09-20 17:36:33 +00:00
Brian Paul
14b30bace0 removed old MESA_TRACE stuff 2002-09-20 17:36:01 +00:00
Brian Paul
1c6b172c01 stub functions for AGP from 4.1 branch 2002-09-20 16:28:04 +00:00
Brian Paul
da1a6739fe updated BeOS driver 2002-09-19 16:37:29 +00:00
Brian Paul
15b418be49 added src/BeOS/*.h to file list 2002-09-19 16:36:35 +00:00
Brian Paul
33629a0d70 updated BeOS support (Philippe Houdoin) 2002-09-19 16:29:43 +00:00
Brian Paul
d8f5422a37 push and pop ESI (Daniel Borca) 2002-09-19 16:06:13 +00:00
Brian Paul
b83df71385 obsolete 2002-09-19 16:05:23 +00:00
Keith Whitwell
b7f6f84fc2 Doesn't find readpix.c without this -I../util 2002-09-17 16:55:38 +00:00
Brian Paul
50cd089a7f remove GLint t, pass target to _mesa_init_teximage_fields() 2002-09-17 14:13:43 +00:00
Brian Paul
7e22bad6da undo last check-in 2002-09-17 01:05:05 +00:00
Brian Paul
7d46390bd4 sync from r200 DRI branch (_swrast_render_start/finish() and tnl_dd changes 2002-09-17 01:01:21 +00:00
Brian Paul
3580b7a3d3 fix auto mipmap generation problem (backport from 4.1) 2002-09-16 20:29:22 +00:00
Brian Paul
c383ce0e0f removed unused teximage Width/Height/DepthScale 2002-09-15 17:35:05 +00:00
Brian Paul
a10727eedc fixed typo 2002-09-14 16:54:47 +00:00
Brian Paul
d4c7dd076c latest 4.0.4 updates 2002-09-14 16:54:04 +00:00
Brian Paul
1e57a87e6a new comments 2002-09-14 16:50:24 +00:00
Brian Paul
6080451f93 implemented glGetTexImage for YCRCB 2002-09-14 16:50:08 +00:00
Brian Paul
5419097b37 added GL_UNSIGNED_SHORT_8_8_APPLE 2002-09-14 16:49:42 +00:00
Brian Paul
889b6c4e7a fix YCbCr component ordering typos 2002-09-13 23:18:22 +00:00
Brian Paul
58be490b08 fix i/j typo and icr/icb transposition 2002-09-13 23:17:04 +00:00
Brian Paul
d314643448 fix typos 2002-09-13 19:39:45 +00:00
Brian Paul
a28d96bd0e added GL_MESA_ycbcr_texture and GL_APPLE_ycbcr_422 tokens 2002-09-13 19:38:56 +00:00
Brian Paul
6d3c1ec7cd test GL_MESA_ycbcr_texture and GL_NV_texture_rectangle 2002-09-13 19:36:46 +00:00
Brian Paul
aa80a17ad0 initial prototype of new GL_MESA_ycrcb_texture extension 2002-09-13 19:34:38 +00:00
Brian Paul
1509a4399a removed cvs log comments 2002-09-13 18:15:09 +00:00
Brian Paul
c2065e3ea5 removed unfinished GL_MESA_sprite_point extension 2002-09-13 17:34:01 +00:00
Brian Paul
ba35bb6897 added AIX compile fixes 2002-09-13 14:10:32 +00:00
Karl Schultz
eefdfddd3e Add #define GL_GLEXT_PROTOTYPES since this demo uses ARB extensions.
Windows needs them for correct linkage.
2002-09-12 17:04:22 +00:00
Karl Schultz
00068e6686 Mark the destroyed context as not current. (Frank Warmerdam) 2002-09-12 17:02:52 +00:00
Karl Schultz
1c1f60d437 silence compiler warnings 2002-09-11 00:06:23 +00:00
Karl Schultz
476c1fdbc6 Remove linker option to make a map file. 2002-09-11 00:04:24 +00:00
Karl Schultz
5613f469d7 Added cast to prevent compiler warnings. 2002-09-10 23:38:48 +00:00
Karl Schultz
6338c52cd4 Fix compiler warnings. 2002-09-10 23:35:38 +00:00
Karl Schultz
c4c5e26cc7 Backport gareth's 1.14 changes. 2002-09-10 23:32:13 +00:00
Brian Paul
b6454b19ae added compressed tex image error check fix 2002-09-06 14:42:40 +00:00
Brian Paul
84c56fef84 incorrect dimenstion passed to texture_error_check() in compressed teximage functions 2002-09-06 14:42:11 +00:00
Brian Paul
a2bb621983 latest 4.0.4 updates 2002-09-06 13:01:32 +00:00
Brian Paul
d057db7942 removed GL_MAX_CONVOLUTION_WIDTH/HEIGHT 2002-09-06 13:01:00 +00:00
Brian Paul
5c04890c5f don't query GL_MAX_CONVOLUTION_WIDTH/HEIGHT 2002-09-06 12:59:14 +00:00
Brian Paul
fb3475078d minor updates to sync with XFree86 2002-09-06 03:47:54 +00:00
Brian Paul
ea214a755b added -l option to print interesting OpenGL limits 2002-09-06 03:36:43 +00:00
Brian Paul
8af93aa529 glext.h version 17 2002-09-06 03:01:10 +00:00
Brian Paul
ab81956422 upgraded glext.h to version 17 2002-09-06 02:57:17 +00:00
Brian Paul
38a30cfef0 added latest 4.0.4 changes 2002-09-05 21:21:35 +00:00
Brian Paul
e95e02331e added GL_IBM_texture_mirrored_repeat (Ian Romanick) 2002-09-05 21:18:09 +00:00
Brian Paul
9636b9aa25 test for ARB_texture_cube_map when getting GL version(Ian Romanick) 2002-09-05 21:16:17 +00:00
Brian Paul
f610b8f418 updated wglGetProcAddress 2002-09-04 14:15:27 +00:00
Brian Paul
601fd74868 updated DOS file list 2002-09-03 18:14:22 +00:00
Brian Paul
36ee4317c2 updates from Daniel Borca 2002-09-03 17:58:36 +00:00
Brian Paul
9d4181cd56 version bumps for 4.0.4 2002-09-03 17:50:19 +00:00
Brian Paul
cf1dc9faf9 s/APIENTRY/GLAPIENTRY/ 2002-08-30 13:52:16 +00:00
Brian Paul
6fa2c761a1 added ARB_multitexture function pointers, glext.h updates 2002-08-29 14:45:31 +00:00
Brian Paul
d9c191f2ad version 16 2002-08-29 14:45:05 +00:00
Karl Schultz
36b477442f Don't call _mesa_initialize_context because we are using
_mesa_create_context.  This avoids calling initialize twice and fixes
memory leaks.  Add call to free the GL context because we are creating it
with _mesa_create_context, fixing another leak.
2002-08-28 17:08:37 +00:00
Brian Paul
95358c87ef Back-port of NV_texture_rectangle from Mesa 4.1. 2002-08-28 01:13:34 +00:00
Brian Paul
829ca52b1a define GLAPIENTRY and GLAPI if not defined in gl.h 2002-08-27 21:47:46 +00:00
Alan Hourihane
767b8b6b81 bring over VERTEX_COLOR change from DRI trunk (from PPC fixes) 2002-08-21 17:46:08 +00:00
Keith Whitwell
634d720426 update colormaterial state on swtcl wakeup 2002-08-21 10:39:41 +00:00
Brian Paul
72dcd2b1b0 fix problems in FXgetImage() 2002-08-21 02:57:38 +00:00
Brian Paul
b60335f125 fixed array index typo in VERT_SAVE_RGBA() macro 2002-08-21 02:56:31 +00:00
Karl Schultz
3e78e05a4c Add notes about needing to run VCVARS32.BAT before compiling.
Reword some notes about the build process.
2002-08-15 15:14:47 +00:00
Brian Paul
1099dcdc09 initialize SWvertex array to zeros 2002-08-08 00:42:23 +00:00
Brian Paul
a73bc7e9ce added fog factor clamping to GL_LINEAR case 2002-08-02 16:21:30 +00:00
Karl Schultz
19f17185bd export new symbol for osmesa lib 2002-07-29 15:58:08 +00:00
Brian Paul
22f431fc84 fix warnings (bug 580528) 2002-07-22 13:45:45 +00:00
Brian Paul
5538b98051 fix patching offsets (Sven Panne) (patch 544637) 2002-07-12 16:00:36 +00:00
Brian Paul
f2acb26f16 Pedantic compiler fixes (Sven Panne) 2002-07-12 15:50:46 +00:00
Brian Paul
6d0fd19a71 applied Eric Anholt's patch for Athlon SSE 2002-07-11 15:32:00 +00:00
Brian Paul
670ea9f590 Added divide by zero check (Jon Perry). Remove dead vars. Fix indentation. 2002-06-30 16:58:50 +00:00
Brian Paul
c3be87b84b CHAN_TYPE==GL_FLOAT clamping. call _tnl_MakeCurrent. (Gerk Huisma) 2002-06-30 16:07:12 +00:00
Brian Paul
a4d34a5688 blending fixes for CHAN_TYPE==GL_FLOAT (Gerk Huisma) 2002-06-30 15:57:52 +00:00
Brian Paul
e64e5f5529 fix CHAN_TYPE==GL_FLOAT compile problem 2002-06-26 14:57:08 +00:00
116 changed files with 5265 additions and 2845 deletions

View File

@@ -1,8 +1,8 @@
# $Id: Make-config,v 1.50.2.10 2002/06/10 17:01:30 brianp Exp $
# $Id: Make-config,v 1.50.2.11 2002/09/03 17:50:19 brianp Exp $
MESA_MAJOR=4
MESA_MINOR=0
MESA_TINY=3
MESA_TINY=4
VERSION=$(MESA_MAJOR).$(MESA_MINOR)
# Mesa 3-D graphics library

View File

@@ -1,7 +1,7 @@
# $Id: Makefile.X11,v 1.56.2.10 2002/06/24 20:44:58 brianp Exp $
# $Id: Makefile.X11,v 1.56.2.13 2002/09/19 16:36:35 brianp Exp $
# Mesa 3-D graphics library
# Version: 4.0.3
# Version: 4.0.4
#
# Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
#
@@ -330,10 +330,10 @@ realclean: clean
DIRECTORY = Mesa-4.0.3
LIB_NAME = MesaLib-4.0.3
DEMO_NAME = MesaDemos-4.0.3
GLU_NAME = MesaGLU-4.0.3
DIRECTORY = Mesa-4.0.4
LIB_NAME = MesaLib-4.0.4
DEMO_NAME = MesaDemos-4.0.4
GLU_NAME = MesaGLU-4.0.4
GLUT_NAME = GLUT-3.7
@@ -432,7 +432,9 @@ LIB_FILES = \
$(DIRECTORY)/src/windml/tornado/*.cdf \
$(DIRECTORY)/src/windml/man3/*.3 \
$(DIRECTORY)/src/windml/man3/*.html \
$(DIRECTORY)/src/DOS/*.[ch] \
$(DIRECTORY)/src/DOS/*.[chS] \
$(DIRECTORY)/src/DOS/vesa/*.[ch] \
$(DIRECTORY)/src/BeOS/*.h \
$(DIRECTORY)/src/BeOS/*.cpp \
$(DIRECTORY)/src/FX/Makefile.am \
$(DIRECTORY)/src/FX/Makefile.in \

94
docs/MESA_agp_offset.spec Normal file
View File

@@ -0,0 +1,94 @@
Name
MESA_agp_offset
Name Strings
GLX_MESA_agp_offset
Contact
Brian Paul, Tungsten Graphics, Inc. (brian 'at' tungstengraphics.com)
Keith Whitwell, Tungsten Graphics, Inc. (keith 'at' tungstengraphics.com)
Status
Shipping (Mesa 4.0.4 and later. Only implemented in particular
XFree86/DRI drivers.)
Version
1.0
Number
TBD
Dependencies
OpenGL 1.0 or later is required
GLX_NV_vertex_array_range is required.
This extensions is written against the OpenGL 1.4 Specification.
Overview
This extensions provides a way to convert pointers in an AGP memory
region into byte offsets into the AGP aperture.
Note, this extension depends on GLX_NV_vertex_array_range, for which
no real specification exists. See GL_NV_vertex_array_range for more
information.
IP Status
None
Issues
None
New Procedures and Functions
GLuint glXGetAGPOffsetMESA( const GLvoid *pointer )
New Tokens
None
Additions to the OpenGL 1.4 Specification
None
Additions to Chapter 3 the GLX 1.4 Specification (Functions and Errors)
Add a new section, 3.6 as follows:
3.6 AGP Memory Access
On "PC" computers, AGP memory can be allocated with glXAllocateMemoryNV
and freed with glXFreeMemoryNV. Sometimes it's useful to know where a
block of AGP memory is located with respect to the start of the AGP
aperature. The function
GLuint glXGetAGPOffsetMESA( const GLvoid *pointer )
Returns the offset of the given memory block from the start of AGP
memory in basic machine units (i.e. bytes). If pointer is invalid
the value ~0 will be returned.
GLX Protocol
None. This is a client side-only extension.
Errors
glXGetAGPOffsetMESA will return ~0 if the pointer does not point to
an AGP memory region.
New State
None
Revision History
20 September 2002 - Initial draft
2 October 2002 - finished GLX chapter 3 additions

138
docs/MESA_pack_invert.spec Normal file
View File

@@ -0,0 +1,138 @@
Name
MESA_pack_invert
Name Strings
GL_MESA_pack_invert
Contact
Brian Paul, Tungsten Graphics, Inc. (brian 'at' tungstengraphics.com)
Keith Whitwell, Tungsten Graphics, Inc. (keith 'at' tungstengraphics.com)
Status
Shipping (Mesa 4.0.4 and later)
Version
1.0
Number
TBD
Dependencies
OpenGL 1.0 or later is required
This extensions is written against the OpenGL 1.4 Specification.
Overview
This extension adds a new pixel storage parameter to indicate that
images are to be packed in top-to-bottom order instead of OpenGL's
conventional bottom-to-top order. Only pixel packing can be
inverted (i.e. for glReadPixels, glGetTexImage, glGetConvolutionFilter,
etc).
Almost all known image file formats store images in top-to-bottom
order. As it is, OpenGL reads images from the frame buffer in
bottom-to-top order. Thus, images usually have to be inverted before
writing them to a file with image I/O libraries. This extension
allows images to be read such that inverting isn't needed.
IP Status
None
Issues
1. Should we also defined UNPACK_INVERT_MESA for glDrawPixels, etc?
Resolved: No, we're only concerned with pixel packing. There are other
solutions for inverting images when using glDrawPixels (negative Y pixel
zoom) or glTexImage (invert the vertex T coordinates). It would be easy
enough to define a complementary extension for pixel packing in the
future if needed.
New Procedures and Functions
None
New Tokens
Accepted by the <pname> parameter of PixelStorei and PixelStoref
and the <pname> parameter of GetIntegerv, GetFloatv, GetDoublev
and GetBooleanv:
PACK_INVERT_MESA 0x8758
Additions to Chapter 2 of the OpenGL 1.4 Specification (OpenGL Operation)
None
Additions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization)
None
Additions to Chapter 4 of the OpenGL 1.4 Specification (Per-Fragment
Operations and the Frame Buffer)
Add the following entry to table 4.4 (PixelStore parameters) on page 182:
Parameter Name Type Initial Value Valid Range
---------------------------------------------------------
PACK_INVERT_MESA boolean FALSE TRUE/FALSE
In the section labeled "Placement in Client Memory" on page 184
insert the following text into the paragraph before the sentence
that starts with "If the format is RED, GREEN, BLUE...":
"The parameter PACK_INVERT_MESA controls whether the image is packed
in bottom-to-top order (the default) or top-to-bottom order. Equation
3.8 is modified as follows:
... the first element of the Nth row is indicated by
p + Nk, if PACK_INVERT_MESA is false
p + k * (H - 1) - Nk, if PACK_INVERT_MESA is true, where H is the
image height
"
Additions to Chapter 5 of the OpenGL 1.4 Specification (Special Functions)
None
Additions to Chapter 6 of the OpenGL 1.4 Specification (State and
State Requests)
None
Additions to Appendix A of the OpenGL 1.4 Specification (Invariance)
None
Additions to the AGL/GLX/WGL Specifications
None
GLX Protocol
None
Errors
None
New State
Add the following entry to table 6.20 (Pixels) on page 235:
Get Value Type Get Cmd Initial Value Description Sec Attribute
--------------------------------------------------------------------------------------------------
PACK_INVERT_MESA boolean GetBoolean FALSE Value of PACK_INVERT_MESA 4.3.2 pixel-store
Revision History
21 September 2002 - Initial draft

View File

@@ -15,11 +15,11 @@ Contact
Status
Not yet shipping.
OBSOLETE - NEVER SHIPPED (use GL_NV_packed_depth_stencil)
Version
$Id: MESA_packed_depth_stencil.spec,v 1.1 2000/11/03 14:58:45 brianp Exp $
$Id: MESA_packed_depth_stencil.spec,v 1.1.2.1 2002/09/20 19:14:11 brianp Exp $
Number

View File

@@ -14,11 +14,11 @@ Contact
Status
Not yet shipping.
OBSOLETE - NEVER SHIPPED (use GL_NV_point_sprite)
Version
$Id: MESA_sprite_point.spec,v 1.1 2000/12/08 00:21:02 brianp Exp $
$Id: MESA_sprite_point.spec,v 1.1.2.1 2002/09/20 19:14:11 brianp Exp $
Number

View File

@@ -0,0 +1,197 @@
Name
MESA_ycbcr_texture
Name Strings
GL_MESA_ycbcr_texture
Contact
Brian Paul, Tungsten Graphics, Inc. (brian 'at' tungstengraphics.com)
Keith Whitwell, Tungsten Graphics, Inc. (keith 'at' tungstengraphics.com)
Status
Shipping (Mesa 4.0.4 and later)
Version
1.0
Number
TBD
Dependencies
OpenGL 1.0 or later is required
This extensions is written against the OpenGL 1.4 Specification.
NV_texture_rectangle effects the definition of this extension.
Overview
This extension supports texture images in the YCbCr format. There is
no support for converting YCbCr images to RGB or vice versa. The
intention is for YCbCr image data to be directly sent to the renderer
without any pixel transfer operations. Only 2D texture images are
supported (not glDrawPixels, glReadPixels, etc).
A YCbCr pixel (texel) is a 16-bit unsigned short with two components.
The first component is luminance (Y). For pixels in even-numbered
image columns, the second component is Cb. For pixels in odd-numbered
image columns, the second component is Cr. If one were to convert the
data to RGB one would need to examine two pixels from columns N and N+1
(where N is even) to deduce the RGB color.
IP Status
None
Issues
None
New Procedures and Functions
None
New Tokens
Accepted by the <internalFormat> and <format> parameters of
TexImage2D and TexSubImage2D:
GL_YCBCR_MESA 0x8757
Accepted by the <type> parameter of TexImage2D and TexSubImage2D:
GL_UNSIGNED_SHORT_8_8_MESA 0x85BA /* same as Apple's */
GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB /* same as Apple's */
Additions to Chapter 2 of the OpenGL 1.4 Specification (OpenGL Operation)
None
Additions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization)
In section 3.6.4, Rasterization of Pixel Rectangles, on page 102,
add the following to Table 3.8 (Packed pixel formats):
type Parameter GL Data Number of Matching
Token Name Type Components Pixel Formats
-------------- ------- ---------- -------------
UNSIGNED_SHORT_8_8_MESA ushort 3 YCBCR_422_MESA
UNSIGNED_SHORT_8_8_REV_MESA ushort 3 YCBCR_422_MESA
In section 3.6.4, Rasterization of Pixel Rectangles, on page 102,
add the following to Table 3.10 (UNSIGNED_SHORT formats):
UNSIGNED_SHORT_8_8_MESA:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
+-------------------------------+-------------------------------+
| 1st | 2nd |
+-------------------------------+-------------------------------+
UNSIGNED_SHORT_8_8_REV_MESA:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
+-------------------------------+-------------------------------+
| 2nd | 1st |
+-------------------------------+-------------------------------+
In section 3.6.4, Rasterization of Pixel Rectangles, on page 102,
add the following to Table 3.12 (Packed pixel fiedl assignments):
First Second Third Fourth
Format Element Element Element Element
------ ------- ------- ------- -------
YCBCR_422_MESA luminance chroma
In section 3.8.1, Texture Image Specification, on page 125, add
another item to the list of TexImage2D and TexImage3D equivalence
exceptions:
* The value of internalformat and format may be YCBCR_MESA to
indicate that the image data is in YCbCr format. type must
be either UNSIGNED_SHORT_8_8_MESA or UNSIGNED_SHORT_8_8_REV_MESA
as seen in tables 3.8 and 3.10. Table 3.12 describes the mapping
between Y and Cb/Cr to the components.
If NV_texture_rectangle is supported target may also be
TEXTURE_RECTANGLE_NV or PROXY_TEXTURE_RECTANGLE_NV.
All pixel transfer operations are bypassed. The texture is stored as
YCbCr, not RGB. Queries of the texture's red, green and blue component
sizes will return zero.
In section 3.8.1, Texture Image Specification, on page 126, add
another item to the list of TexImage1D and TexImage2D equivalence
exceptions:
* The value of internalformat and format can not be YCBCR_MESA.
In section 3.8.2, Alternate Texture Image Specification Commands, on
page 129, insert this paragraph after the first full paragraph on the
page:
"If the internal storage format of the image being updated by
TexSubImage2D is YCBCR_MESA then format must be YCBCR_MESA.
The error INVALID_OPERATION will be generated otherwise."
Additions to Chapter 4 of the OpenGL 1.4 Specification (Per-Fragment
Operations and the Frame Buffer)
None
Additions to Chapter 5 of the OpenGL 1.4 Specification (Special Functions)
None
Additions to Chapter 6 of the OpenGL 1.4 Specification (State and
State Requests)
None
Additions to Appendix A of the OpenGL 1.4 Specification (Invariance)
None
Additions to the AGL/GLX/WGL Specifications
None
GLX Protocol
None
Errors
INVALID_ENUM is generated by TexImage2D if <internalFormat> is
MESA_YCBCR but <format> is not MESA_YCBCR.
INVALID_ENUM is generated by TexImage2D if <format> is MESA_YCBCR but
<internalFormat> is not MESA_YCBCR.
INVALID_VALUE is generated by TexImage2D if <format> is MESA_YCBCR and
<internalFormat> is MESA_YCBCR and <border> is not zero.
INVALID_OPERATION is generated by TexSubImage2D if the internal image
format is YCBCR_MESA and format is not YCBCR_MESA.
INVALID_OPERATION is generated by CopyTexSubImage2D if the internal
image is YCBCR_MESA.
New State
Edit table 6.16 on page 231: change the type of TEXTURE_INTERNAL_FORMAT
from n x Z42 to n x Z43 to indicate that internal format may also be
YCBCR_MESA.
Revision History
20 September 2002 - Initial draft

View File

@@ -1,102 +1,65 @@
Mesa-4.0.3 BeOS R5 driver patch
Version alpha v0.3
Mesa / BeOS Information
HOW TO BUILD:
1) You need gcc 2.95.3 to be installed:
http://www.bebits.com/app/2157
Check your installed gcc version by running this command from a Terminal:
gcc -v
2) Download Mesa-4.0.3 sources
http://prdownloads.sourceforge.net/mesa3d/MesaLib-4.0.3.tar.gz?download
Introduction
3) Extract official 4.0.3 sources code somewhere
Mesa 3.1 features a new driver for the BeOS. The new driver implements
a clone of the BGLView class. This class, derived from BView, allows
OpenGL rendering into a BeOS window.
4) Then, extract the BeOS driver patch at same place. This will
overwrite modified sources and add BeOS-specific ones.
Any application which uses the BGLView should be able to use Mesa
instead of Be's OpenGL without changing any code.
5) Open a new Terminal window:
$ cd /path/to/Mesa-4.0.3/src
$ make -f Makefile.BeOS-R5
Since Be's OpenGL implementation (as of R4) is basically just the
SGI sample implementation, it's pretty slow. You'll see that Mesa
is considerably faster.
6) Take a cup of coffee!
7) When done, you should find a obj.x86/libGL.so
8) To test this library as a Be Inc's one:
- rename /boot/beos/system/lib/libGL.so into libGL.so.r5
- put/copy obj.x86/libGL.so file into /boot/home/config/lib directory
- run GLTeapot...
Source Code
To see more information, run your(s) GL app(s) from Terminal:
$ export MESA_INFO=1
$ export MESA_DEBUG=1
$ myGLapp
MMX cpu detected.
Not testing OS support for SSE, leaving enabled.
SSE cpu detected.
Mesa GL_VERSION = 1.2 Mesa 4.0.3
Mesa GL_RENDERER = BGLView
Mesa GL_VENDOR = Brian Paul
Mesa GL_EXTENSIONS = GL_ARB_imaging GL_ARB_multitexture
[...]
GL_SGIX_shadow GL_SGIX_shadow_ambient
Mesa thread-safe: NO
Mesa x86-optimized: YES
Mesa sparc-optimized: NO
The source code for the driver is in Mesa-3.1/src/BeOS/GLView.cpp
It's not 100% finished at this time but many GLUT-based demos are
working. No optimizations have been made at this time.
BUILD ISSUES:
- If the build stop on math/m_*.c files, you're not using gcc 2.95.3.
- The Makefile.BeOS-R5 is set currently to build a non-debug x86/mmx/sse/3dnow optimized libGL.so.
It's a modified BeOS standard makefile, so editing it to follow your needs should be easy...
- NASM support instead of built-in gcc assembler (GAS) is not supported yet...
- "Mesa thread-safe: NO" is correct: the Mesa multithread support don't allow to share a gl context
between any thread, only give you one thread <-> one context, which is inaccurate under BeOS...
KNOWN LIMITATIONS & BUGS:
- BeOS driver only support software rendition ATM
- No BDirectWindow support yet, too. GLLife will not work for this reason.
- 3dnow support untested
- GLTeapot: object mouse control don't work
- GLTeapot: window resizing don't work
- many others: ALPHA VERSION, remember.
Compiling
In the Mesa-3.x directory type "make -f Makefile.X11 beos-r4".
When it finishes the libMesaGL.so and libMesaGLU.so libraries for
BeOS will be in the Mesa-3.x/lib/ directory.
Example Programs
Look in the Mesa-3.x/BeOS/ directory for one or two BGLView demo
programs. They should have been compiled along with the Mesa
library.
GLUT
A version of GLUT 2.5 for BeOS can be found in src-glut.beos/.
The original distribution can be obtained from
http://home.beoscentral.com/jehamby/Glut-3.5-x86.zip
This is a special version of GLUT adapted for the BeOS. I don't
believe Mark Kilgard's normal GLUT distribution includes BeOS
support.
It seems that you have to recompile GLUT with libMesaGL.so instead
of libGL.so in order for everything to work. I'm not sure why.
Special Features
Mesa's implementation of the BGLView class has an extra member
function: CopySubBufferMESA(). It basically works like SwapBuffers()
but it only copies a sub region from the back buffer to the front
buffer. This is a useful optimization for some applications.
If you use this method in your code be sure that you check at runtime
that you're actually using Mesa (with glGetString) so you don't
cause a fatal error when running with Be's OpenGL.
Work Left To Do
Color index mode is not implemented yet.
Reading pixels from the front buffer not implemented yet.
There is also a BGLScreen class in BeOS for full-screen OpenGL
rendering. This should also be implemented for Mesa.
Old BeOS Driver
Mesa 2.6 had an earlier BeOS driver. It was based on Mesa's Off-screen
rendering interface, not BGLView. If you're interested in the older
driver you should get Mesa 2.6.
BeOS and Glide
Mesa 3.0 supported the 3Dfx/Glide library on Beos. Download Mesa 3.0
if interested. Ideally, the 3Dfx/Glide support should be updated to
work with the new Mesa 3.1 BGLView implementation.
The Glide library hasn't been updated for BeOS R4, to my knowledge, as
of February, 1999.
----------------------------------------------------------------------
$Id: README.BEOS,v 1.6 1999/11/27 01:40:40 brianp Exp $
philippe.houdoin@free.fr

View File

@@ -1,4 +1,4 @@
Mesa 4.0 DOS/DJGPP Port v1.0
Mesa 4.0 DOS/DJGPP Port v1.1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -6,75 +6,150 @@
Description:
~~~~~~~~~~~~
Well, guess what... this is the DOS port of MESA 4.0, for DJGPP fans... Whoa!
Well, guess what... this is the DOS port of Mesa 4.0.4, for DJGPP fans... Whoa!
The driver has its origins in ddsample.c, written by Brian Paul and found by me
in Mesa 3.4.2.
Legal:
~~~~~~
MESA copyright applies.
Mesa copyright applies, provided this package is used within Mesa. For anything
else, see GPL.
Installation:
~~~~~~~~~~~~~
Type "make -f Makefile.DJ" to compile the libraries. Make accepts some options
which are passed to compiler: the target cpu (CPU=..., default=`pentium') and
X86 specific options (HAVE_X86=1, HAVE_MMX=1, HAVE_SSE=1, HAVE_3DNOW=1). The
core library (libGL) requires LFN support during compilation. Also, you must
have the DXE2 package (available on SimTel.Net, courtesy of Andrew Zabolotny)
installed in order to build the dynamic modules; if you encounter errors, you
can fetch a patched version from my web page.
The demos are not built automagically (see Pitfalls below). To make them, use
one of the following rules:
Static:
gcc -o OUT.exe IN.c -lglut -lglu -lgl
Dynamic:
gcc -o OUT.exe -include dmesadxe.h IN.c -ligl -liglu -liglut -ldl
Usage of the dynamic modules requires three things:
Unzip and type:
make -f Makefile.DJ [OPTIONS...]
Available options:
Environment variables:
CPU optimize for the given processor.
default = k6
BIG_OPT=1 crazy optimizations; not very useful, though...
default = no
GLIDE absolute path to Glide library; used with FX.
default = $(TOP)/include/glide3
FX=1 build for 3dfx Glide3; use it if you have the Glide
SDK (designed for your platform), and, of course, a
3dfx card... Note that this disables compilation of
actual DMesa code, as Glide does all the stuff!
default = no
HAVE_X86=1 optimize for i386.
default = no
HAVE_MMX=1 MMX instructions; use only if you assembler/compiler
supports MMX instruction set; backwards compatibility
with older processors is still preserved.
default = no
HAVE_SSE=1 (see HAVE_MMX)
default = no
HAVE_3DNOW=1 (see HAVE_MMX)
default = no
Targets:
all: build everything
libgl: build GL
libglu: build GLU
libglut: build GLUT
clean: remove object files
realclean: remove all generated files
Tested on:
CPU: K6-2 (CXT) @500(412.5) MHz
Mainboard: ViA Apollo VP2/97 w/ 128 MB SDRAM
Video card: PowerColor Evil King3 (Voodoo3 3000) w/ 16384 kB SDRAM
DJGPP: djdev 2.03 + gcc v3.1 + make v3.79.1
FAQ:
~~~~
1. Compilation
Q) I tried to run `make' and it exits because `gcc' complains it cannot find
some stupid file.
A) You need LFN support.
A) When compiling for Glide (FX=1), pay attention to Glide path.
2. Dynamic modules
Q) What are you mumbling about dynamic modules?
A) You must have the DXE2 package (available on SimTel.Net, courtesy of
Andrew Zabolotny) installed in order to build the dynamic modules.
Q) I have DXE2, but I couln'd build the `dxe2gen.exe'.
Q) I built `dxe2gen.exe', but it doesn't do the job right.
A) There is a patched version on my web page.
Q) DXE2 modules give me headaches...
A) The DXE2 modules are not compulsory. The static libraries are still built
and you can use them in the old-fashioned, classic way. For example:
gcc -o OUT.exe IN.c -lglut -lglu -lgl
Q) Okay, DXE2 modules are built. How can I use them?
A) Usage of the dynamic modules requires three things:
- include DMESADXE.H in one of the sources, so references inside
dynamic modules will get resolved (or use `-include' directive)
- link against import libraries (libIgl*.a) and LIBDL.A, which will do
dynamic modules will get resolved (or use `-include' directive).
- link against import libraries (libI*.a) and LIBDL.A, which will do
the dynamic linkage job for you
- put the DXEs somewhere along the library path (LD_LIBRARY_PATH) or
in the current directory
For example:
gcc -o OUT.exe -include dmesadxe.h IN.c -ligl -liglu -liglut -ldl
Tested on:
CPU: Intel Pentium w/ MMX @166 MHz
Mainboard: ViA Apollo VP2 w/ 128 MB SDRAM
Video card: Matrox Millenium 2064W w/ 2048 kB WRAM, BIOS v3.0
DJGPP: djdev 2.03 + gcc v3.0.3 + make v3.79
Q) The application dies with "Abort!" due to unresolved symbols.
A) This is bad! Extract the unresolved symbol list from this module. For
example:
dxe2gen --show-unres gl.dxe > u
Check DMESADXE.H; the symbols in `u' must either be present here or be
exported from another module that has to be loaded before your faulting
one. Then recompile.
3. Using Mesa for DJGPP
Q) Does this build work in Win9x?
A) Yes.
libGL (the core):
~~~~~~~~~~~~~~~~~
Q) Does it work under NT (W2k, XP) core?
A) Uh... probably not!
Of course, MESA 4.0 core sources are required. It will probably work with
MESA 3.5, but not a chance with earlier versions due to major changes to the
MESA driver interface and the directory tree. All should compile succesfully.
Q) I made a simple application and it does nothing. It exits right away. Not
even a blank screen.
A) The current version supports only RGB[A] modes, for it made no sense to
me to endorse color-index (aka palette) modes.
A) Single-buffered is not allowed at all. Until I can find a way to use
*REAL* hardware acceleration, it won't get implemented.
A) Another weird "feature" is that buffer width must be multiple of 4 (I'm a
lazy programmer and I found that the easiest way to keep buffer handling
at peak performance ;-).
The driver has its origins in ddsample.c, written by Brian Paul and found by
me in MESA 3.4.2. I touched almost all the functions, changing the coding
style :-( Sorry!
Q) My demo doesn't display text. I know I used the glut font routines!
A) Then you probably use GLUT as a DXE. Well, there is no direct access to
variables due to the way DXE works. Read the documentation. The author of
GLUT took this into account for _WIN32 DLL's only; I don't want to modify
his headers. The only workaround is to link GLUT the old way :-(
Pitfalls:
1. The current version supports only RGB[A] modes, for it made no sense to me
to endorse color-index (aka palette) modes.
2. Single-buffered is not allowed at all. Until I can find a way to use *REAL*
hardware acceleration, it won't get implemented.
3. Another weird "feature" is that buffer width must be multiple of 4 (I'm a
lazy programmer and I found that the easiest way to keep buffer handling at
peak performance ;-).
Q) The DJGPP port of Mesa is so SLOOOW! The Win32 OpenGL performs so much
better...
A) Is that a question? If you have a Voodoo3/Banshee card, you're lucky. The
Glide port is on my web page. If you haven't, sorry; everything is done
in software. Suggestions?
libGLU:
~~~~~~~
Mesa GLU sources are required.
Q) I have a super/mega/ultra monitor and all you can do is 60Hz? My eyes are
leaking from the orbits...
A) If you were compiling for Glide, see Glide info. If not, be aware that
refresh rate control works only for VESA 3.0. The environment variable
DMESA_REFRESH sets the default screen refresh. For example:
set DMESA_REFRESH=75
@@ -85,7 +160,7 @@ Well, this "skeletal" GLUT implementation is not mine. Thanks should go to
Bernhard Tschirren, Mark Kilgard, Brian Paul and probably others (or probably
not ;-). I only changed it to be self-standing (Allegro-free). The keyboard,
mouse and timer drivers were inspired from an old project of mine (D3Xl) and
fixed with some Allegro "infusions"; I deeply thank to Shawn Hargreaves et co.
fixed with many Allegro "infusions"; I deeply thank to Shawn Hargreaves et co.
My keyboard driver used only scancodes, but since GLUT requires ASCII values
for keys, I borrowed the translation tables (and maybe more) from Allegro.
@@ -121,6 +196,10 @@ History:
~~~~~~~~
v1.0 mar-2002 initial release
v1.1 sep-2002 + added 3dfx Glide3 support
+ added refresh rate control
+ added fonts in glut
* lots of minor changes

View File

@@ -1,12 +1,13 @@
File: docs/README.WIN32
Last updated: Nov 29, 2001 - Karl Schultz - kschultz@users.sourceforge.net
Last updated: Aug 15, 2002 - Karl Schultz - kschultz@users.sourceforge.net
Quick Start
If you have Microsoft Visual C++ 6.0 installed, simply go to the top directory
of the Mesa distribution and type 'nmake -f Makefile.win NODEBUG=1' for
an optimized build.
an optimized build. Note that you may have to run ...VC98/BIN/VCVARS32.BAT
to set up the appropriate compiler environment variables.
Details and Notes
@@ -17,9 +18,12 @@ Details and Notes
demos a handful of demo executables.
- After building, you can copy the above DLL files to a place in your PATH
or to the demos directory if you just want to give the demos a try.
The DLL and LIB files are copied to the ./lib directory. The makefile
creates this directory if it does not already exist.
such as $SystemRoot/SYSTEM32. If you don't like putting things in a
system directory, place them in the same directory as the executable(s).
For example, you can copy the DLL files to the demos directory if you
just want to run the demos. The build process places the DLL and LIB files
in the ./lib directory. The makefile creates this directory if it does
not already exist.
- The make targets 'clean' and 'clobber' will remove objects and libraries.
But the files in ./lib are never cleaned.

View File

@@ -1,5 +1,5 @@
Mesa 4.0.3 Unix/X11 Information
Mesa 4.0.4 Unix/X11 Information
@@ -25,7 +25,7 @@ There are two ways to compile Mesa on Unix/X11 systems:
The top-level makefile will execute the makefiles in a number of sub-
directories. When finished, the Mesa libraries will be in the Mesa-4.0.3/lib/
directories. When finished, the Mesa libraries will be in the Mesa-4.0.4/lib/
directory. A few GLUT demos in the demos/ directory should be ready to run.
If you also downloaded and unpacked the demos there should be executables
@@ -323,4 +323,4 @@ Summary of X-related environment variables:
----------------------------------------------------------------------
$Id: README.X11,v 3.8.2.3 2002/04/26 13:54:47 brianp Exp $
$Id: README.X11,v 3.8.2.4 2002/09/03 17:50:21 brianp Exp $

View File

@@ -1,4 +1,4 @@
$Id: VERSIONS,v 1.73.2.29 2002/06/25 15:22:12 brianp Exp $
$Id: VERSIONS,v 1.73.2.41 2002/10/02 17:36:59 brianp Exp $
Mesa Version History
@@ -981,3 +981,32 @@ Mesa Version History
- lots of T&L updates for the Radeon DRI driver
Known bugs:
- mipmap LOD computation (fixed for Mesa 4.1)
4.0.4 October 3, 2002
New:
- GL_NV_texture_rectangle extension
- updated glext.h header (version 17)
- updated DOS driver (Daniel Borca)
- updated BeOS R5 driver (Philippe Houdoin)
- added GL_IBM_texture_mirror_repeat
- glxinfo now takes -l option to print interesting OpenGL limits info
- GL_MESA_ycbcr_texture extension
- GL_APPLE_client_storage extension (for some DRI drivers only)
- GL_MESA_pack_invert extension
Bug fixes:
- fixed GL_LINEAR fog bug by adding clamping
- fixed FP exceptions found using Alpha CPU
- 3dfx MESA_GLX_FX=window (render to window) didn't work
- fixed memory leak in wglCreateContest (Karl Schultz)
- define GLAPIENTRY and GLAPI if undefined in glu.h
- wglGetProcAddress didn't handle all API functions
- when testing for OpenGL 1.2 vs 1.3, check for GL_ARB_texture_cube_map
- removed GL_MAX_CONVOLUTION_WIDTH/HEIGHT from glGetInteger/Float/etc()
- error checking in compressed tex image functions had some glitches
- fixed AIX compile problem in src/config.c
- glGetTexImage was using pixel unpacking instead of packing params
- auto-mipmap generation for cube maps was incorrect
Changes:
- max texture units reduced to six to accomodate texture rectangles
- removed unfinished GL_MESA_sprite_point extension code

View File

@@ -1,10 +1,10 @@
/* $Id: gl.h,v 1.59.2.3 2002/04/26 13:53:09 brianp Exp $ */
/* $Id: gl.h,v 1.59.2.11 2002/09/21 17:12:10 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.0.3
* Version: 4.0.4
*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2002 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"),
@@ -63,6 +63,10 @@
# define GLAPIENTRY
#endif /* WIN32 / CYGWIN bracket */
#if (defined(__BEOS__) && defined(__POWERPC__)) || defined(__QUICKDRAW__)
# define PRAGMA_EXPORT_SUPPORTED 1
#endif
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(__CYGWIN__)
#include <gl/mesa_wgl.h>
#endif
@@ -1913,6 +1917,9 @@ GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] );
GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert );
#if defined(GL_GLEXT_LEGACY)
/*
* GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1)
*/
@@ -1990,14 +1997,45 @@ GLAPI void GLAPIENTRY glMultiTexCoord4ivARB(GLenum target, const GLint *v);
GLAPI void GLAPIENTRY glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v);
typedef void (GLAPIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
typedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);
#endif /* GL_ARB_multitexture */
#if defined(GL_GLEXT_LEGACY)
/*
* 1. GL_EXT_abgr
*/
@@ -2370,8 +2408,6 @@ GLAPI void GLAPIENTRY glUnlockArraysEXT( void );
/*
* 197. GL_MESA_window_pos
*/
@@ -2486,21 +2522,50 @@ GLAPI void GLAPIENTRY glTracePointerRangeMESA( const GLvoid* first, const GLvoid
#endif /* GL_MESA_packed_depth_stencil */
/*
* ??. GL_MESA_sprite_point
*/
#ifndef GL_MESA_sprite_point
#define GL_MESA_sprite_point 1
#define GL_SPRITE_POINT_MESA 0x8757 /* XXX not finalized! */
#ifndef GL_MESA_ycbcr_texture
#define GL_MESA_ycbcr_texture 1
#endif
#define GL_YCBCR_MESA 0x8757
#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA /* same as Apple */
#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB /* same as Apple */
#endif /* GL_MESA_texture_ycbcr */
#ifndef GL_MESA_pack_invert
#define GL_MESA_pack_invert 1
#define GL_PACK_INVERT_MESA 0x8758
#endif /* GL_MESA_pack_invert */
#ifndef GL_APPLE_client_storage
#define GL_APPLE_client_storage 1
#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2
#endif /* GL_APPLE_client_storage */
#ifndef GL_APPLE_ycbcr_422
#define GL_APPLE_ycbcr_422 1
#define GL_YCBCR_422_APPLE 0x85B9
#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
#endif /* GL_APPLE_ycbcr_422 */
/**********************************************************************
* Begin system-specific stuff
*/
#if defined(__BEOS__) || defined(__QUICKDRAW__)
#if defined(PRAGMA_EXPORT_SUPPORTED)
#pragma export off
#endif

View File

@@ -24,7 +24,7 @@ extern "C" {
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Inc. The Original Code is Copyright (c) 1991-2002 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
@@ -49,9 +49,9 @@ extern "C" {
/*************************************************************/
/* Header file version number, required by OpenGL ABI for Linux */
/* glext.h last updated 2002/05/30 */
/* glext.h last updated 2002/08/21 */
/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */
#define GL_GLEXT_VERSION 15
#define GL_GLEXT_VERSION 17
#ifndef GL_VERSION_1_2
#define GL_UNSIGNED_BYTE_3_3_2 0x8032
@@ -60,6 +60,16 @@ extern "C" {
#define GL_UNSIGNED_INT_8_8_8_8 0x8035
#define GL_UNSIGNED_INT_10_10_10_2 0x8036
#define GL_RESCALE_NORMAL 0x803A
#define GL_TEXTURE_BINDING_3D 0x806A
#define GL_PACK_SKIP_IMAGES 0x806B
#define GL_PACK_IMAGE_HEIGHT 0x806C
#define GL_UNPACK_SKIP_IMAGES 0x806D
#define GL_UNPACK_IMAGE_HEIGHT 0x806E
#define GL_TEXTURE_3D 0x806F
#define GL_PROXY_TEXTURE_3D 0x8070
#define GL_TEXTURE_DEPTH 0x8071
#define GL_TEXTURE_WRAP_R 0x8072
#define GL_MAX_3D_TEXTURE_SIZE 0x8073
#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
@@ -143,7 +153,7 @@ extern "C" {
#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8
#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9
#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA
#define GL_POST_COLOR_MATIX_ALPHA_BIAS 0x80BB
#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB
#define GL_COLOR_TABLE 0x80D0
#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1
#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2
@@ -160,9 +170,7 @@ extern "C" {
#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD
#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE
#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF
#define GL_IGNORE_BORDER 0x8150
#define GL_CONSTANT_BORDER 0x8151
#define GL_WRAP_BORDER 0x8152
#define GL_REPLICATE_BORDER 0x8153
#define GL_CONVOLUTION_BORDER_COLOR 0x8154
#endif
@@ -267,6 +275,48 @@ extern "C" {
#define GL_DOT3_RGBA 0x86AF
#endif
#ifndef GL_VERSION_1_4
#define GL_BLEND_DST_RGB 0x80C8
#define GL_BLEND_SRC_RGB 0x80C9
#define GL_BLEND_DST_ALPHA 0x80CA
#define GL_BLEND_SRC_ALPHA 0x80CB
#define GL_POINT_SIZE_MIN 0x8126
#define GL_POINT_SIZE_MAX 0x8127
#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
#define GL_POINT_DISTANCE_ATTENUATION 0x8129
#define GL_GENERATE_MIPMAP 0x8191
#define GL_GENERATE_MIPMAP_HINT 0x8192
#define GL_DEPTH_COMPONENT16 0x81A5
#define GL_DEPTH_COMPONENT24 0x81A6
#define GL_DEPTH_COMPONENT32 0x81A7
#define GL_MIRRORED_REPEAT 0x8370
#define GL_FOG_COORDINATE_SOURCE 0x8450
#define GL_FOG_COORDINATE 0x8451
#define GL_FRAGMENT_DEPTH 0x8452
#define GL_CURRENT_FOG_COORDINATE 0x8453
#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454
#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455
#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456
#define GL_FOG_COORDINATE_ARRAY 0x8457
#define GL_COLOR_SUM 0x8458
#define GL_CURRENT_SECONDARY_COLOR 0x8459
#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A
#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B
#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C
#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D
#define GL_SECONDARY_COLOR_ARRAY 0x845E
#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
#define GL_TEXTURE_FILTER_CONTROL 0x8500
#define GL_TEXTURE_LOD_BIAS 0x8501
#define GL_INCR_WRAP 0x8507
#define GL_DECR_WRAP 0x8508
#define GL_TEXTURE_DEPTH_SIZE 0x884A
#define GL_DEPTH_TEXTURE_MODE 0x884B
#define GL_TEXTURE_COMPARE_MODE 0x884C
#define GL_TEXTURE_COMPARE_FUNC 0x884D
#define GL_COMPARE_R_TO_TEXTURE 0x884E
#endif
#ifndef GL_ARB_multitexture
#define GL_TEXTURE0_ARB 0x84C0
#define GL_TEXTURE1_ARB 0x84C1
@@ -362,17 +412,9 @@ extern "C" {
#ifndef GL_ARB_point_parameters
#define GL_POINT_SIZE_MIN_ARB 0x8126
#define GL_POINT_SIZE_MIN_EXT 0x8126
#define GL_POINT_SIZE_MIN_SGIS 0x8126
#define GL_POINT_SIZE_MAX_ARB 0x8127
#define GL_POINT_SIZE_MAX_EXT 0x8127
#define GL_POINT_SIZE_MAX_SGIS 0x8127
#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128
#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128
#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128
#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129
#define GL_DISTANCE_ATTENUATION_EXT 0x8129
#define GL_DISTANCE_ATTENUATION_SGIS 0x8129
#endif
#ifndef GL_ARB_vertex_blend
@@ -491,6 +533,88 @@ extern "C" {
#ifndef GL_ARB_window_pos
#endif
#ifndef GL_ARB_vertex_program
#define GL_VERTEX_PROGRAM_ARB 0x8620
#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642
#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643
#define GL_COLOR_SUM_ARB 0x8458
#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622
#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624
#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A
#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626
#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645
#define GL_PROGRAM_LENGTH_ARB 0x8627
#define GL_PROGRAM_FORMAT_ARB 0x8876
#define GL_PROGRAM_BINDING_ARB 0x8677
#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0
#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1
#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2
#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3
#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4
#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5
#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6
#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7
#define GL_PROGRAM_PARAMETERS_ARB 0x88A8
#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9
#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA
#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB
#define GL_PROGRAM_ATTRIBS_ARB 0x88AC
#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD
#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE
#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF
#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0
#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1
#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2
#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3
#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4
#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5
#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6
#define GL_PROGRAM_STRING_ARB 0x8628
#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B
#define GL_CURRENT_MATRIX_ARB 0x8641
#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7
#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640
#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869
#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F
#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E
#define GL_PROGRAM_ERROR_STRING_ARB 0x8874
#define GL_MATRIX0_ARB 0x88C0
#define GL_MATRIX1_ARB 0x88C1
#define GL_MATRIX2_ARB 0x88C2
#define GL_MATRIX3_ARB 0x88C3
#define GL_MATRIX4_ARB 0x88C4
#define GL_MATRIX5_ARB 0x88C5
#define GL_MATRIX6_ARB 0x88C6
#define GL_MATRIX7_ARB 0x88C7
#define GL_MATRIX8_ARB 0x88C8
#define GL_MATRIX9_ARB 0x88C9
#define GL_MATRIX10_ARB 0x88CA
#define GL_MATRIX11_ARB 0x88CB
#define GL_MATRIX12_ARB 0x88CC
#define GL_MATRIX13_ARB 0x88CD
#define GL_MATRIX14_ARB 0x88CE
#define GL_MATRIX15_ARB 0x88CF
#define GL_MATRIX16_ARB 0x88D0
#define GL_MATRIX17_ARB 0x88D1
#define GL_MATRIX18_ARB 0x88D2
#define GL_MATRIX19_ARB 0x88D3
#define GL_MATRIX20_ARB 0x88D4
#define GL_MATRIX21_ARB 0x88D5
#define GL_MATRIX22_ARB 0x88D6
#define GL_MATRIX23_ARB 0x88D7
#define GL_MATRIX24_ARB 0x88D8
#define GL_MATRIX25_ARB 0x88D9
#define GL_MATRIX26_ARB 0x88DA
#define GL_MATRIX27_ARB 0x88DB
#define GL_MATRIX28_ARB 0x88DC
#define GL_MATRIX29_ARB 0x88DD
#define GL_MATRIX30_ARB 0x88DE
#define GL_MATRIX31_ARB 0x88DF
#endif
#ifndef GL_EXT_abgr
#define GL_ABGR_EXT 0x8000
#endif
@@ -556,23 +680,14 @@ extern "C" {
#endif
#ifndef GL_EXT_texture3D
#define GL_PACK_SKIP_IMAGES 0x806B
#define GL_PACK_SKIP_IMAGES_EXT 0x806B
#define GL_PACK_IMAGE_HEIGHT 0x806C
#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C
#define GL_UNPACK_SKIP_IMAGES 0x806D
#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D
#define GL_UNPACK_IMAGE_HEIGHT 0x806E
#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E
#define GL_TEXTURE_3D 0x806F
#define GL_TEXTURE_3D_EXT 0x806F
#define GL_PROXY_TEXTURE_3D 0x8070
#define GL_PROXY_TEXTURE_3D_EXT 0x8070
#define GL_TEXTURE_DEPTH 0x8071
#define GL_TEXTURE_DEPTH_EXT 0x8071
#define GL_TEXTURE_WRAP_R 0x8072
#define GL_TEXTURE_WRAP_R_EXT 0x8072
#define GL_MAX_3D_TEXTURE_SIZE 0x8073
#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073
#endif
@@ -899,6 +1014,20 @@ extern "C" {
#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E
#endif
#ifndef GL_EXT_point_parameters
#define GL_POINT_SIZE_MIN_EXT 0x8126
#define GL_POINT_SIZE_MAX_EXT 0x8127
#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128
#define GL_DISTANCE_ATTENUATION_EXT 0x8129
#endif
#ifndef GL_SGIS_point_parameters
#define GL_POINT_SIZE_MIN_SGIS 0x8126
#define GL_POINT_SIZE_MAX_SGIS 0x8127
#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128
#define GL_DISTANCE_ATTENUATION_SGIS 0x8129
#endif
#ifndef GL_SGIX_instruments
#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180
#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181
@@ -2289,6 +2418,11 @@ extern "C" {
#ifndef GL_EXT_shadow_funcs
#endif
#ifndef GL_EXT_stencil_two_side
#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910
#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911
#endif
/*************************************************************/
@@ -2472,6 +2606,102 @@ typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint
typedef void (APIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img);
#endif
#ifndef GL_VERSION_1_4
#define GL_VERSION_1_4 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glBlendFuncSeparate (GLenum, GLenum, GLenum, GLenum);
GLAPI void APIENTRY glFogCoordf (GLfloat);
GLAPI void APIENTRY glFogCoordfv (const GLfloat *);
GLAPI void APIENTRY glFogCoordd (GLdouble);
GLAPI void APIENTRY glFogCoorddv (const GLdouble *);
GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *);
GLAPI void APIENTRY glMultiDrawArrays (GLenum, GLint *, GLsizei *, GLsizei);
GLAPI void APIENTRY glMultiDrawElements (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei);
GLAPI void APIENTRY glPointParameterf (GLenum, GLfloat);
GLAPI void APIENTRY glPointParameterfv (GLenum, const GLfloat *);
GLAPI void APIENTRY glPointParameteri (GLenum, GLint);
GLAPI void APIENTRY glPointParameteriv (GLenum, const GLint *);
GLAPI void APIENTRY glSecondaryColor3b (GLbyte, GLbyte, GLbyte);
GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *);
GLAPI void APIENTRY glSecondaryColor3d (GLdouble, GLdouble, GLdouble);
GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *);
GLAPI void APIENTRY glSecondaryColor3f (GLfloat, GLfloat, GLfloat);
GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *);
GLAPI void APIENTRY glSecondaryColor3i (GLint, GLint, GLint);
GLAPI void APIENTRY glSecondaryColor3iv (const GLint *);
GLAPI void APIENTRY glSecondaryColor3s (GLshort, GLshort, GLshort);
GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *);
GLAPI void APIENTRY glSecondaryColor3ub (GLubyte, GLubyte, GLubyte);
GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *);
GLAPI void APIENTRY glSecondaryColor3ui (GLuint, GLuint, GLuint);
GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *);
GLAPI void APIENTRY glSecondaryColor3us (GLushort, GLushort, GLushort);
GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *);
GLAPI void APIENTRY glSecondaryColorPointer (GLint, GLenum, GLsizei, const GLvoid *);
GLAPI void APIENTRY glWindowPos2d (GLdouble, GLdouble);
GLAPI void APIENTRY glWindowPos2dv (const GLdouble *);
GLAPI void APIENTRY glWindowPos2f (GLfloat, GLfloat);
GLAPI void APIENTRY glWindowPos2fv (const GLfloat *);
GLAPI void APIENTRY glWindowPos2i (GLint, GLint);
GLAPI void APIENTRY glWindowPos2iv (const GLint *);
GLAPI void APIENTRY glWindowPos2s (GLshort, GLshort);
GLAPI void APIENTRY glWindowPos2sv (const GLshort *);
GLAPI void APIENTRY glWindowPos3d (GLdouble, GLdouble, GLdouble);
GLAPI void APIENTRY glWindowPos3dv (const GLdouble *);
GLAPI void APIENTRY glWindowPos3f (GLfloat, GLfloat, GLfloat);
GLAPI void APIENTRY glWindowPos3fv (const GLfloat *);
GLAPI void APIENTRY glWindowPos3i (GLint, GLint, GLint);
GLAPI void APIENTRY glWindowPos3iv (const GLint *);
GLAPI void APIENTRY glWindowPos3s (GLshort, GLshort, GLshort);
GLAPI void APIENTRY glWindowPos3sv (const GLshort *);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRY * PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
typedef void (APIENTRY * PFNGLFOGCOORDFPROC) (GLfloat coord);
typedef void (APIENTRY * PFNGLFOGCOORDFVPROC) (const GLfloat *coord);
typedef void (APIENTRY * PFNGLFOGCOORDDPROC) (GLdouble coord);
typedef void (APIENTRY * PFNGLFOGCOORDDVPROC) (const GLdouble *coord);
typedef void (APIENTRY * PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
typedef void (APIENTRY * PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
typedef void (APIENTRY * PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
typedef void (APIENTRY * PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);
typedef void (APIENTRY * PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);
typedef void (APIENTRY * PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);
typedef void (APIENTRY * PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue);
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v);
typedef void (APIENTRY * PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
typedef void (APIENTRY * PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y);
typedef void (APIENTRY * PFNGLWINDOWPOS2DVPROC) (const GLdouble *v);
typedef void (APIENTRY * PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y);
typedef void (APIENTRY * PFNGLWINDOWPOS2FVPROC) (const GLfloat *v);
typedef void (APIENTRY * PFNGLWINDOWPOS2IPROC) (GLint x, GLint y);
typedef void (APIENTRY * PFNGLWINDOWPOS2IVPROC) (const GLint *v);
typedef void (APIENTRY * PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y);
typedef void (APIENTRY * PFNGLWINDOWPOS2SVPROC) (const GLshort *v);
typedef void (APIENTRY * PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z);
typedef void (APIENTRY * PFNGLWINDOWPOS3DVPROC) (const GLdouble *v);
typedef void (APIENTRY * PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z);
typedef void (APIENTRY * PFNGLWINDOWPOS3FVPROC) (const GLfloat *v);
typedef void (APIENTRY * PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z);
typedef void (APIENTRY * PFNGLWINDOWPOS3IVPROC) (const GLint *v);
typedef void (APIENTRY * PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z);
typedef void (APIENTRY * PFNGLWINDOWPOS3SVPROC) (const GLshort *v);
#endif
#ifndef GL_ARB_multitexture
#define GL_ARB_multitexture 1
#ifdef GL_GLEXT_PROTOTYPES
@@ -2718,6 +2948,136 @@ typedef void (APIENTRY * PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort
typedef void (APIENTRY * PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v);
#endif
#ifndef GL_ARB_vertex_program
#define GL_ARB_vertex_program 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glVertexAttrib1dARB (GLuint, GLdouble);
GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint, const GLdouble *);
GLAPI void APIENTRY glVertexAttrib1fARB (GLuint, GLfloat);
GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint, const GLfloat *);
GLAPI void APIENTRY glVertexAttrib1sARB (GLuint, GLshort);
GLAPI void APIENTRY glVertexAttrib1svARB (GLuint, const GLshort *);
GLAPI void APIENTRY glVertexAttrib2dARB (GLuint, GLdouble, GLdouble);
GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint, const GLdouble *);
GLAPI void APIENTRY glVertexAttrib2fARB (GLuint, GLfloat, GLfloat);
GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint, const GLfloat *);
GLAPI void APIENTRY glVertexAttrib2sARB (GLuint, GLshort, GLshort);
GLAPI void APIENTRY glVertexAttrib2svARB (GLuint, const GLshort *);
GLAPI void APIENTRY glVertexAttrib3dARB (GLuint, GLdouble, GLdouble, GLdouble);
GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint, const GLdouble *);
GLAPI void APIENTRY glVertexAttrib3fARB (GLuint, GLfloat, GLfloat, GLfloat);
GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint, const GLfloat *);
GLAPI void APIENTRY glVertexAttrib3sARB (GLuint, GLshort, GLshort, GLshort);
GLAPI void APIENTRY glVertexAttrib3svARB (GLuint, const GLshort *);
GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint, const GLbyte *);
GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint, const GLint *);
GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint, const GLshort *);
GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint, GLubyte, GLubyte, GLubyte, GLubyte);
GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint, const GLubyte *);
GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint, const GLuint *);
GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint, const GLushort *);
GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint, const GLbyte *);
GLAPI void APIENTRY glVertexAttrib4dARB (GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint, const GLdouble *);
GLAPI void APIENTRY glVertexAttrib4fARB (GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint, const GLfloat *);
GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint, const GLint *);
GLAPI void APIENTRY glVertexAttrib4sARB (GLuint, GLshort, GLshort, GLshort, GLshort);
GLAPI void APIENTRY glVertexAttrib4svARB (GLuint, const GLshort *);
GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint, const GLubyte *);
GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint, const GLuint *);
GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint, const GLushort *);
GLAPI void APIENTRY glVertexAttribPointerARB (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint);
GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint);
GLAPI void APIENTRY glProgramStringARB (GLenum, GLenum, GLsizei, const GLvoid *);
GLAPI void APIENTRY glBindProgramARB (GLenum, GLuint);
GLAPI void APIENTRY glDeleteProgramsARB (GLsizei, const GLuint *);
GLAPI void APIENTRY glGenProgramsARB (GLsizei, GLuint *);
GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum, GLuint, const GLdouble *);
GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum, GLuint, const GLfloat *);
GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum, GLuint, const GLdouble *);
GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum, GLuint, const GLfloat *);
GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum, GLuint, GLdouble *);
GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum, GLuint, GLfloat *);
GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum, GLuint, GLdouble *);
GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum, GLuint, GLfloat *);
GLAPI void APIENTRY glGetProgramivARB (GLenum, GLenum, GLint *);
GLAPI void APIENTRY glGetProgramStringARB (GLenum, GLenum, GLvoid *);
GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint, GLenum, GLdouble *);
GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint, GLenum, GLfloat *);
GLAPI void APIENTRY glGetVertexAttribivARB (GLuint, GLenum, GLint *);
GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint, GLenum, GLvoid* *);
GLAPI GLboolean APIENTRY glIsProgramARB (GLuint);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRY * PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x);
typedef void (APIENTRY * PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x);
typedef void (APIENTRY * PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x);
typedef void (APIENTRY * PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y);
typedef void (APIENTRY * PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y);
typedef void (APIENTRY * PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y);
typedef void (APIENTRY * PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
typedef void (APIENTRY * PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
typedef void (APIENTRY * PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
typedef void (APIENTRY * PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
typedef void (APIENTRY * PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
typedef void (APIENTRY * PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void (APIENTRY * PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
typedef void (APIENTRY * PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v);
typedef void (APIENTRY * PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
typedef void (APIENTRY * PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
typedef void (APIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
typedef void (APIENTRY * PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string);
typedef void (APIENTRY * PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program);
typedef void (APIENTRY * PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs);
typedef void (APIENTRY * PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs);
typedef void (APIENTRY * PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
typedef void (APIENTRY * PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params);
typedef void (APIENTRY * PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void (APIENTRY * PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params);
typedef void (APIENTRY * PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
typedef void (APIENTRY * PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params);
typedef void (APIENTRY * PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void (APIENTRY * PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params);
typedef void (APIENTRY * PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params);
typedef void (APIENTRY * PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params);
typedef void (APIENTRY * PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params);
typedef void (APIENTRY * PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params);
typedef void (APIENTRY * PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params);
typedef void (APIENTRY * PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string);
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params);
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params);
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params);
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer);
typedef GLboolean (APIENTRY * PFNGLISPROGRAMARBPROC) (GLuint program);
#endif
#ifndef GL_EXT_abgr
#define GL_EXT_abgr 1
#endif
@@ -3762,9 +4122,15 @@ typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3F
#define GL_EXT_blend_func_separate 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum, GLenum, GLenum, GLenum);
GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum, GLenum, GLenum, GLenum);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRY * PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
#endif
#ifndef GL_INGR_blend_func_separate
#define GL_INGR_blend_func_separate 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum, GLenum, GLenum, GLenum);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRY * PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
#endif
@@ -4642,6 +5008,14 @@ typedef void (APIENTRY * PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint
#define GL_EXT_shadow_funcs 1
#endif
#ifndef GL_EXT_stencil_two_side
#define GL_EXT_stencil_two_side 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRY * PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face);
#endif
#ifdef __cplusplus
}

View File

@@ -36,6 +36,14 @@
#include <GL/gl.h>
#ifndef GLAPIENTRY
#define GLAPIENTRY
#endif
#ifndef GLAPI
#define GLAPI
#endif
#ifdef __cplusplus
extern "C" {
#endif

View File

@@ -1,4 +1,4 @@
/* $Id: glx.h,v 1.33.2.2 2002/04/26 13:53:09 brianp Exp $ */
/* $Id: glx.h,v 1.33.2.4 2002/09/20 17:36:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -297,7 +297,6 @@ extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
extern void (*glXGetProcAddress(const GLubyte *procname))();
#ifndef GLX_GLXEXT_LEGACY
#include <GL/glxext.h>
@@ -453,6 +452,38 @@ extern void (*glXGetProcAddressARB(const GLubyte *procName))();
#endif /* GLX_GLXEXT_LEGACY */
/**
** The following aren't in glxext.h yet.
**/
/*
* ???. GLX_NV_vertex_array_range
*/
#ifndef GLX_NV_vertex_array_range
#define GLX_NV_vertex_array_range
extern void *glXAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
extern void glXFreeMemoryNV(GLvoid *pointer);
typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
typedef void ( * PFNGLXFREEMEMORYNVPROC) (GLvoid *pointer);
#endif /* GLX_NV_vertex_array_range */
/*
* ???. GLX_MESA_agp_offset
*/
#ifndef GLX_MESA_agp_offset
#define GLX_MESA_agp_offset 1
extern GLuint glXGetAGPOffsetMESA(const GLvoid *pointer);
typedef GLuint (* PFNGLXGETAGPOFFSETMESAPROC) (const GLvoid *pointer);
#endif /* GLX_MESA_agp_offset */
#ifdef __cplusplus
}

View File

@@ -1,4 +1,4 @@
/* $Id: glx_mangle.h,v 1.1.1.1.8.1 2001/11/09 22:00:26 brianp Exp $ */
/* $Id: glx_mangle.h,v 1.1.1.1.8.2 2002/09/20 18:32:17 kschultz Exp $ */
/*
* Mesa 3-D graphics library
@@ -41,17 +41,133 @@
#define glXWaitGL mglXWaitGL
#define glXWaitX mglXWaitX
#define glXUseXFont mglXUseXFont
/* GLX 1.1 */
#define glXQueryExtensionsString mglXQueryExtensionsString
#define glXQueryServerString mglXQueryServerString
#define glXGetClientString mglXGetClientString
#define glXCreateGLXPixmapMESA mglXCreateGLXPixmapMESA
#define glXReleaseBuffersMESA mglXReleaseBuffersMESA
#define glXCopySubBufferMESA mglXCopySubBufferMESA
#define glXGetVideoSyncSGI mglXGetVideoSyncSGI
#define glXWaitVideoSyncSGI mglXWaitVideoSyncSGI
/* GLX 1.2 */
#define glXGetCurrentDisplay mglXGetCurrentDisplay
/* GLX 1.3 */
#define glXChooseFBConfig mglXChooseFBConfig
#define glXGetFBConfigAttrib mglXGetFBConfigAttrib
#define glXGetFBConfigs mglXGetFBConfigs
#define glXGetVisualFromFBConfig mglXGetVisualFromFBConfig
#define glXCreateWindow mglXCreateWindow
#define glXDestroyWindow mglXDestroyWindow
#define glXCreatePixmap mglXCreatePixmap
#define glXDestroyPixmap mglXDestroyPixmap
#define glXCreatePbuffer mglXCreatePbuffer
#define glXDestroyPbuffer mglXDestroyPbuffer
#define glXQueryDrawable mglXQueryDrawable
#define glXCreateNewContext mglXCreateNewContext
#define glXMakeContextCurrent mglXMakeContextCurrent
#define glXGetCurrentReadDrawable mglXGetCurrentReadDrawable
#define glXQueryContext mglXQueryContext
#define glXSelectEvent mglXSelectEvent
#define glXGetSelectedEvent mglXGetSelectedEvent
/* GLX 1.4 */
#define glXGetProcAddress mglXGetProcAddress
/*
* 41. GLX_SGI_video_sync
*/
#define glXGetVideoSyncSGI mglXGetVideoSyncSGI
#define glXWaitVideoSyncSGI mglXWaitVideoSyncSGI
/*
* 47. GLX_EXT_import_context
*/
#define glXFreeContextEXT mglXFreeContextEXT
#define glXGetContextIDEXT mglXGetContextIDEXT
#define glXGetCurrentDisplayEXT mglXGetCurrentDisplayEXT
#define glXImportContextEXT mglXImportContextEXT
#define glXQueryContextInfoEXT mglXQueryContextInfoEXT
/*
* 215. GLX_MESA_copy_sub_buffer
*/
#define glXCopySubBufferMESA mglXCopySubBufferMESA
/*
* 216. GLX_MESA_pixmap_colormap
*/
#define glXCreateGLXPixmapMESA mglXCreateGLXPixmapMESA
/*
* 217. GLX_MESA_release_buffers
*/
#define glXReleaseBuffersMESA mglXReleaseBuffersMESA
/*
* 218. GLX_MESA_set_3dfx_mode
*/
#define glXSet3DfxModeMESA mglXSet3DfxModeMESA
/*
* ARB 2. GLX_ARB_get_proc_address
*/
#define glXGetProcAddressARB mglXGetProcAddressARB
/**
** The following aren't in glxext.h yet.
**/
/*
* ???. GLX_NV_vertex_array_range
*/
#define glXAllocateMemoryNV mglXAllocateMemoryNV
#define glXFreeMemoryNV mglXFreeMemoryNV
/*
* ???. GLX_MESA_agp_offset
*/
#define glXGetAGPOffsetMESA mglXGetAGPOffsetMESA
/*
* Other extensions implemented and in glxext.h
*/
#define glXSwapIntervalSGI mglXSwapIntervalSGI
#define glXGetVideoSyncSGI mglXGetVideoSyncSGI
#define glXWaitVideoSyncSGI mglXWaitVideoSyncSGI
#define glXMakeCurrentReadSGI mglXMakeCurrentReadSGI
#define glXCushionSGI mglXCushionSGI
#define glXCreateGLXPixmapMESA mglXCreateGLXPixmapMESA
#define glXReleaseBuffersMESA mglXReleaseBuffersMESA
#define glXCopySubBufferMESA mglXCopySubBufferMESA
#define glXGetTransparentIndexSUN mglXGetTransparentIndexSUN
#define glXBindChannelToWindowSGIX mglXBindChannelToWindowSGIX
#define glXBindSwapBarrierSGIX mglXBindSwapBarrierSGIX
#define glXChannelRectSGIX mglXChannelRectSGIX
#define glXChannelRectSyncSGIX mglXChannelRectSyncSGIX
#define glXChooseFBConfigSGIX mglXChooseFBConfigSGIX
#define glXCreateContextWithConfigSGIX mglXCreateContextWithConfigSGIX
#define glXCreateGLXPbufferSGIX mglXCreateGLXPbufferSGIX
#define glXCreateGLXPixmapWithConfigSGIX mglXCreateGLXPixmapWithConfigSGIX
#define glXDestroyGLXPbufferSGIX mglXDestroyGLXPbufferSGIX
#define glXGetCurrentReadDrawableSGI mglXGetCurrentReadDrawableSGI
#define glXGetFBConfigAttribSGIX mglXGetFBConfigAttribSGIX
#define glXGetFBConfigFromVisualSGIX mglXGetFBConfigFromVisualSGIX
#define glXGetSelectedEventSGIX mglXGetSelectedEventSGIX
#define glXGetVisualFromFBConfigSGIX mglXGetVisualFromFBConfigSGIX
#define glXJoinSwapGroupSGIX mglXJoinSwapGroupSGIX
#define glXQueryChannelDeltasSGIX mglXQueryChannelDeltasSGIX
#define glXQueryChannelRectSGIX mglXQueryChannelRectSGIX
#define glXQueryGLXPbufferSGIX mglXQueryGLXPbufferSGIX
#define glXQueryMaxSwapBarriersSGIX mglXQueryMaxSwapBarriersSGIX
#define glXSelectEventSGIX mglXSelectEventSGIX
#endif

View File

@@ -1,4 +1,4 @@
/* $Id: drawpix.c,v 1.5 2000/12/24 22:53:54 pesco Exp $ */
/* $Id: drawpix.c,v 1.5.2.2 2002/09/13 18:15:09 brianp Exp $ */
/*
* glDrawPixels demo/test/benchmark
@@ -6,60 +6,6 @@
* Brian Paul September 25, 1997 This file is in the public domain.
*/
/*
* $Log: drawpix.c,v $
* Revision 1.5 2000/12/24 22:53:54 pesco
* * demos/Makefile.am (INCLUDES): Added -I$(top_srcdir)/util.
* * demos/Makefile.X11, demos/Makefile.BeOS-R4, demos/Makefile.cygnus:
* Essentially the same.
* Program files updated to include "readtex.c", not "../util/readtex.c".
* * demos/reflect.c: Likewise for "showbuffer.c".
*
*
* * Makefile.am (EXTRA_DIST): Added top-level regular files.
*
* * include/GL/Makefile.am (INC_X11): Added glxext.h.
*
*
* * src/GGI/include/ggi/mesa/Makefile.am (EXTRA_HEADERS): Include
* Mesa GGI headers in dist even if HAVE_GGI is not given.
*
* * configure.in: Look for GLUT and demo source dirs in $srcdir.
*
* * src/swrast/Makefile.am (libMesaSwrast_la_SOURCES): Set to *.[ch].
* More source list updates in various Makefile.am's.
*
* * Makefile.am (dist-hook): Remove CVS directory from distribution.
* (DIST_SUBDIRS): List all possible subdirs here.
* (SUBDIRS): Only list subdirs selected for build again.
* The above two applied to all subdir Makefile.am's also.
*
* Revision 1.4 2000/09/08 21:45:21 brianp
* added dither key option
*
* Revision 1.3 1999/10/28 18:23:29 brianp
* minor changes to Usage() function
*
* Revision 1.2 1999/10/21 22:13:58 brianp
* added f key to toggle front/back drawing
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.3 1999/03/28 18:18:33 brianp
* minor clean-up
*
* Revision 3.2 1998/11/05 04:34:04 brianp
* moved image files to ../images/ directory
*
* Revision 3.1 1998/02/22 16:43:17 brianp
* added a few casts to silence compiler warnings
*
* Revision 3.0 1998/02/14 18:42:29 brianp
* initial rev
*
*/
#include <stdio.h>
#include <stdlib.h>
@@ -287,7 +233,7 @@ static void Init( GLboolean ciMode )
if (ciMode) {
/* Convert RGB image to grayscale */
GLubyte *indexImage = malloc( ImgWidth * ImgHeight );
GLubyte *indexImage = (GLubyte *) malloc( ImgWidth * ImgHeight );
GLint i;
for (i=0; i<ImgWidth*ImgHeight; i++) {
int gray = Image[i*3] + Image[i*3+1] + Image[i*3+2];

View File

@@ -752,7 +752,7 @@ main(int ac, char **av)
glFogfv(GL_FOG_COLOR, fogcolor);
glFogf(GL_FOG_DENSITY, 0.1);
p = malloc(sizeof(part) * np);
p = (part *) malloc(sizeof(part) * np);
for (i = 0; i < np; i++)
setnewpart(&p[i]);

View File

@@ -1,4 +1,4 @@
/* $Id: isosurf.c,v 1.13 2001/10/04 19:14:26 kschultz Exp $ */
/* $Id: isosurf.c,v 1.13.2.2 2002/09/10 23:35:38 kschultz Exp $ */
/*
* Display an isosurface of 3-D wind speed volume.
@@ -32,6 +32,7 @@
#include <math.h>
#ifdef _WIN32
#include <windows.h>
#undef CLIP_MASK
#endif
#define GL_GLEXT_LEGACY
#include "GL/glut.h"
@@ -39,34 +40,36 @@
#include "readtex.c" /* I know, this is a hack. KW: me too. */
#define TEXTURE_FILE "../images/reflect.rgb"
#define LIT 0x1
#define UNLIT 0x2
#define REFLECT 0x10
#define POINT_FILTER 0x40
#define LINEAR_FILTER 0x80
#define GLVERTEX 0x100
#define DRAW_ELTS 0x4
#define DRAW_ARRAYS 0x200
#define ARRAY_ELT 0x400
#define LOCKED 0x800
#define UNLOCKED 0x8
#define IMMEDIATE 0x1000
#define DISPLAYLIST 0x2000000
#define SHADE_SMOOTH 0x2000
#define SHADE_FLAT 0x4000
#define TRIANGLES 0x8000
#define STRIPS 0x10000
#define POINTS 0x20000
#define USER_CLIP 0x40000
#define NO_USER_CLIP 0x80000
#define MATERIALS 0x100000
#define NO_MATERIALS 0x200000
#define FOG 0x400000
#define NO_FOG 0x800000
#define QUIT 0x1000000
#define GLINFO 0x4000000
#define STIPPLE 0x8000000
#define NO_STIPPLE 0x20
#define LIT 0x00000001
#define UNLIT 0x00000002
#define REFLECT 0x00000004
#define POINT_FILTER 0x00000008
#define LINEAR_FILTER 0x00000010
#define GLVERTEX 0x00000020
#define DRAW_ELTS 0x00000040
#define DRAW_ARRAYS 0x00000080
#define ARRAY_ELT 0x00000100
#define LOCKED 0x00000200
#define UNLOCKED 0x00000400
#define IMMEDIATE 0x00000800
#define DISPLAYLIST 0x00001000
#define SHADE_SMOOTH 0x00002000
#define SHADE_FLAT 0x00004000
#define TRIANGLES 0x00008000
#define STRIPS 0x00010000
#define POINTS 0x00020000
#define USER_CLIP 0x00040000
#define NO_USER_CLIP 0x00080000
#define MATERIALS 0x00100000
#define NO_MATERIALS 0x00200000
#define FOG 0x00400000
#define NO_FOG 0x00800000
#define QUIT 0x01000000
#define GLINFO 0x02000000
#define STIPPLE 0x04000000
#define NO_STIPPLE 0x08000000
#define POLYGON_FILL 0x10000000
#define POLYGON_LINE 0x20000000
#define LIGHT_MASK (LIT|UNLIT|REFLECT)
#define FILTER_MASK (POINT_FILTER|LINEAR_FILTER)
@@ -79,9 +82,10 @@
#define SHADE_MASK (SHADE_SMOOTH|SHADE_FLAT)
#define FOG_MASK (FOG|NO_FOG)
#define STIPPLE_MASK (STIPPLE|NO_STIPPLE)
#define POLYGON_MASK (POLYGON_FILL|POLYGON_LINE)
#define MAXVERTS 10000
static GLuint maxverts = MAXVERTS;
static GLint maxverts = MAXVERTS;
static float data[MAXVERTS][6];
static float compressed_data[MAXVERTS][6];
static float expanded_data[MAXVERTS*3][6];
@@ -144,7 +148,7 @@ static void read_surface( char *filename )
static void print_flags( const char *msg, GLuint flags )
{
fprintf(stderr,
"%s (0x%x): %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
"%s (0x%x): %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
msg, flags,
(flags & GLVERTEX) ? "glVertex, " : "",
(flags & DRAW_ARRAYS) ? "glDrawArrays, " : "",
@@ -162,7 +166,8 @@ static void print_flags( const char *msg, GLuint flags )
(flags & USER_CLIP) ? "user_clip, " : "",
(flags & MATERIALS) ? "materials, " : "",
(flags & FOG) ? "fog, " : "",
(flags & STIPPLE) ? "stipple, " : "");
(flags & STIPPLE) ? "stipple, " : "",
(flags & POLYGON_LINE) ? "polygon mode line, " : "");
}
@@ -333,7 +338,7 @@ static void make_tri_indices( void )
{
unsigned int *v = tri_indices;
unsigned int parity = 0;
unsigned int i, j;
int i, j;
for (j=2;j<numverts;j++,parity^=1) {
if (parity) {
@@ -363,9 +368,9 @@ static void make_tri_indices( void )
#define MIN(x,y) (x < y) ? x : y
static void draw_surface( int with_state )
static void draw_surface( unsigned int with_state )
{
GLuint i, j;
GLint i, j;
if (with_state & DISPLAYLIST) {
if ((with_state & (RENDER_STYLE_MASK|PRIMITIVE_MASK|MATERIAL_MASK)) !=
@@ -684,28 +689,34 @@ static void ModeMenu(int m)
if (CHANGED(state, m, FOG_MASK)) {
UPDATE(state, m, FOG_MASK);
if (m & FOG)
{
if (m & FOG) {
glEnable(GL_FOG);
}
else
{
else {
glDisable(GL_FOG);
}
}
if (CHANGED(state, m, STIPPLE_MASK)) {
UPDATE(state, m, STIPPLE_MASK);
if (m & STIPPLE)
{
if (m & STIPPLE) {
glEnable(GL_POLYGON_STIPPLE);
}
else
{
else {
glDisable(GL_POLYGON_STIPPLE);
}
}
if (CHANGED(state, m, POLYGON_MASK)) {
UPDATE(state, m, POLYGON_MASK);
if (m & POLYGON_FILL) {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
else {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
}
}
#ifdef GL_EXT_vertex_array
if (CHANGED(state, m, (LOCK_MASK|RENDER_STYLE_MASK|PRIMITIVE_MASK)))
{
@@ -1077,6 +1088,9 @@ int main(int argc, char **argv)
glutAddMenuEntry("Stipple", STIPPLE);
glutAddMenuEntry("No Stipple", NO_STIPPLE);
glutAddMenuEntry("", 0);
glutAddMenuEntry("Polygon Mode Fill", POLYGON_FILL);
glutAddMenuEntry("Polygon Mode Line", POLYGON_LINE);
glutAddMenuEntry("", 0);
glutAddMenuEntry("Point Filtered", POINT_FILTER);
glutAddMenuEntry("Linear Filtered", LINEAR_FILTER);
glutAddMenuEntry("", 0);

View File

@@ -1,4 +1,4 @@
/* $Id: multiarb.c,v 1.10 2001/06/20 19:12:30 brianp Exp $ */
/* $Id: multiarb.c,v 1.10.2.2 2002/09/13 18:15:09 brianp Exp $ */
/*
* GL_ARB_multitexture demo
@@ -10,77 +10,12 @@
* Brian Paul November 1998 This program is in the public domain.
*/
/*
* $Log: multiarb.c,v $
* Revision 1.10 2001/06/20 19:12:30 brianp
* also print GL_MAX_TEXTURE_SIZE
*
* Revision 1.9 2001/06/13 14:33:16 brianp
* moved glTexEnvi calls to better logical locations
*
* Revision 1.8 2000/12/24 22:53:54 pesco
* * demos/Makefile.am (INCLUDES): Added -I$(top_srcdir)/util.
* * demos/Makefile.X11, demos/Makefile.BeOS-R4, demos/Makefile.cygnus:
* Essentially the same.
* Program files updated to include "readtex.c", not "../util/readtex.c".
* * demos/reflect.c: Likewise for "showbuffer.c".
*
*
* * Makefile.am (EXTRA_DIST): Added top-level regular files.
*
* * include/GL/Makefile.am (INC_X11): Added glxext.h.
*
*
* * src/GGI/include/ggi/mesa/Makefile.am (EXTRA_HEADERS): Include
* Mesa GGI headers in dist even if HAVE_GGI is not given.
*
* * configure.in: Look for GLUT and demo source dirs in $srcdir.
*
* * src/swrast/Makefile.am (libMesaSwrast_la_SOURCES): Set to *.[ch].
* More source list updates in various Makefile.am's.
*
* * Makefile.am (dist-hook): Remove CVS directory from distribution.
* (DIST_SUBDIRS): List all possible subdirs here.
* (SUBDIRS): Only list subdirs selected for build again.
* The above two applied to all subdir Makefile.am's also.
*
* Revision 1.7 2000/11/01 16:02:01 brianp
* print number of texture units
*
* Revision 1.6 2000/05/23 23:21:00 brianp
* set default window pos
*
* Revision 1.5 2000/02/02 17:31:45 brianp
* changed > to >=
*
* Revision 1.4 2000/02/02 01:07:21 brianp
* limit Drift to [0, 1]
*
* Revision 1.3 1999/10/21 16:40:32 brianp
* added -info command line option
*
* Revision 1.2 1999/10/13 12:02:13 brianp
* use texture objects now
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 1.3 1999/03/28 18:20:49 brianp
* minor clean-up
*
* Revision 1.2 1998/11/05 04:34:04 brianp
* moved image files to ../images/ directory
*
* Revision 1.1 1998/11/03 01:36:33 brianp
* Initial revision
*
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "readtex.c" /* I know, this is a hack. */

View File

@@ -1,4 +1,4 @@
/* $Id: paltex.c,v 1.6.2.1 2002/04/15 22:14:09 kschultz Exp $ */
/* $Id: paltex.c,v 1.6.2.3 2002/07/22 13:45:45 brianp Exp $ */
/*
* Paletted texture demo. Written by Brian Paul.
@@ -94,15 +94,16 @@ static void Init( void )
{
#define HEIGHT 8
#define WIDTH 32
static char texture[HEIGHT][WIDTH] = {
" ",
" MMM EEEE SSS AAA ",
" M M M E S S A A ",
" M M M EEEE SS A A ",
" M M M E SS AAAAA ",
" M M E S S A A ",
" M M EEEE SSS A A ",
" "
/* 257 = HEIGHT * WIDTH + 1 (for trailing '\0') */
static char texture[257] = {"\
\
MMM EEEE SSS AAA \
M M M E S S A A \
M M M EEEE SS A A \
M M M E SS AAAAA \
M M E S S A A \
M M EEEE SSS A A \
"
};
GLubyte table[256][4];
@@ -161,7 +162,7 @@ static void Init( void )
0, /* border */
GL_COLOR_INDEX, /* texture format */
GL_UNSIGNED_BYTE, /* texture type */
texture); /* teh texture */
texture); /* the texture */
#endif
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

View File

@@ -8,6 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#ifdef WIN32

View File

@@ -1,4 +1,4 @@
/* $Id: readpix.c,v 1.4.2.1 2002/05/01 14:53:52 alanh Exp $ */
/* $Id: readpix.c,v 1.4.2.2 2002/07/12 15:50:46 brianp Exp $ */
/*
* glReadPixels and glCopyPixels test
@@ -8,6 +8,9 @@
/*
* $Log: readpix.c,v $
* Revision 1.4.2.2 2002/07/12 15:50:46 brianp
* Pedantic compiler fixes (Sven Panne)
*
* Revision 1.4.2.1 2002/05/01 14:53:52 alanh
* glutSwapBuffers implicitly does a glFinish when swapping back to the front
* buffer. We now issue a glFinish when not issuing SwapBuffers to ensure
@@ -243,7 +246,7 @@ Init( GLboolean ciMode )
if (ciMode) {
/* Convert RGB image to grayscale */
GLubyte *indexImage = malloc( ImgWidth * ImgHeight );
GLubyte *indexImage = (GLubyte *) malloc( ImgWidth * ImgHeight );
GLint i;
for (i=0; i<ImgWidth*ImgHeight; i++) {
int gray = Image[i*3] + Image[i*3+1] + Image[i*3+2];

View File

@@ -1,4 +1,4 @@
/* $Id: shadowtex.c,v 1.4 2001/02/28 18:41:50 brianp Exp $ */
/* $Id: shadowtex.c,v 1.4.2.1 2002/07/12 15:50:46 brianp Exp $ */
/*
* Shadow demo using the GL_SGIX_depth_texture, GL_SGIX_shadow and
@@ -257,8 +257,8 @@ Display(void)
*/
if (DisplayMode == SHOW_DEPTH_MAPPING) {
/* load depth image as gray-scale luminance texture */
GLfloat *depth = malloc(ShadowTexWidth * ShadowTexHeight
* sizeof(GLfloat));
GLfloat *depth = (GLfloat *) malloc(ShadowTexWidth * ShadowTexHeight
* sizeof(GLfloat));
if (depth) {
glReadPixels(0, 0, ShadowTexWidth, ShadowTexHeight,
GL_DEPTH_COMPONENT, GL_FLOAT, depth);

View File

@@ -11,6 +11,7 @@
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#ifdef WIN32

View File

@@ -1,4 +1,4 @@
/* $Id: tessdemo.c,v 1.11 2001/03/21 02:47:32 gareth Exp $ */
/* $Id: tessdemo.c,v 1.11.2.2 2002/09/11 00:09:01 kschultz Exp $ */
/*
* A demo of the GLU polygon tesselation functions written by Bogdan Sikorski.
@@ -90,7 +90,7 @@ static void GLCALLBACK edge_callback( GLenum flag )
static void GLCALLBACK end_callback()
{
GLint i;
GLuint i;
glBegin( GL_LINES );
@@ -165,6 +165,8 @@ static void set_screen_wh( GLsizei w, GLsizei h )
height = h;
}
typedef void (GLAPIENTRY *callback_t)();
static void tesse( void )
{
GLUtesselator *tobj;
@@ -177,11 +179,11 @@ static void tesse( void )
if ( tobj != NULL ) {
gluTessNormal( tobj, 0.0, 0.0, 1.0 );
gluTessCallback( tobj, GLU_TESS_BEGIN, glBegin );
gluTessCallback( tobj, GLU_TESS_VERTEX, glVertex2fv );
gluTessCallback( tobj, GLU_TESS_END, glEnd );
gluTessCallback( tobj, GLU_TESS_ERROR, error_callback );
gluTessCallback( tobj, GLU_TESS_COMBINE, combine_callback );
gluTessCallback( tobj, GLU_TESS_BEGIN, (callback_t) glBegin );
gluTessCallback( tobj, GLU_TESS_VERTEX, (callback_t) glVertex2fv );
gluTessCallback( tobj, GLU_TESS_END, (callback_t) glEnd );
gluTessCallback( tobj, GLU_TESS_ERROR, (callback_t) error_callback );
gluTessCallback( tobj, GLU_TESS_COMBINE, (callback_t) combine_callback );
glNewList( list_start, GL_COMPILE );
gluBeginPolygon( tobj );
@@ -201,10 +203,10 @@ static void tesse( void )
gluEndPolygon( tobj );
glEndList();
gluTessCallback( tobj, GLU_TESS_BEGIN, begin_callback );
gluTessCallback( tobj, GLU_TESS_VERTEX, vertex_callback );
gluTessCallback( tobj, GLU_TESS_END, end_callback );
gluTessCallback( tobj, GLU_TESS_EDGE_FLAG, edge_callback );
gluTessCallback( tobj, GLU_TESS_BEGIN, (callback_t) begin_callback );
gluTessCallback( tobj, GLU_TESS_VERTEX, (callback_t) vertex_callback );
gluTessCallback( tobj, GLU_TESS_END, (callback_t) end_callback );
gluTessCallback( tobj, GLU_TESS_EDGE_FLAG, (callback_t) edge_callback );
glNewList( list_start + 1, GL_COMPILE );
gluBeginPolygon( tobj );
@@ -308,6 +310,7 @@ static void mouse_clicked( int button, int state, int x, int y )
static void display( void )
{
GLuint i,j;
GLsizei ii, jj;
GLuint point_cnt;
glClear( GL_COLOR_BUFFER_BIT );
@@ -319,12 +322,12 @@ static void display( void )
glBegin( GL_LINES );
for ( i = 0 ; i < width ; i += 10 ) {
for ( j = 0 ; j < height ; j += 10 ) {
glVertex2i( 0, j );
glVertex2i( width, j );
glVertex2i( i, height );
glVertex2i( i, 0 );
for ( ii = 0 ; ii < width ; ii += 10 ) {
for ( jj = 0 ; jj < height ; jj += 10 ) {
glVertex2i( 0, jj );
glVertex2i( width, jj );
glVertex2i( ii, height );
glVertex2i( ii, 0 );
}
}

View File

@@ -1,4 +1,4 @@
/* $Id: trispd.c,v 1.2 2000/10/26 15:26:14 brianp Exp $ */
/* $Id: trispd.c,v 1.2.2.1 2002/07/12 15:50:46 brianp Exp $ */
/*
* Simple GLUT program to measure triangle strip rendering speed.
@@ -7,6 +7,9 @@
/*
* $Log: trispd.c,v $
* Revision 1.2.2.1 2002/07/12 15:50:46 brianp
* Pedantic compiler fixes (Sven Panne)
*
* Revision 1.2 2000/10/26 15:26:14 brianp
* added a glFinish() call
*
@@ -158,7 +161,7 @@ static void LoadTex(int comp, int filter)
{
GLubyte *pixels;
int x, y;
pixels = malloc(4*256*256);
pixels = (GLubyte *) malloc(4*256*256);
for (y = 0; y < 256; ++y)
for (x = 0; x < 256; ++x) {
pixels[(y*256+x)*4+0] = (int)(128.5 + 127.0 * cos(0.024544 * x));

View File

@@ -103,8 +103,8 @@ drawRects(GLenum mode)
void
processHits(GLint hits, GLuint buffer[])
{
unsigned int i, j;
GLuint names, *ptr;
GLint i;
GLuint j, names, *ptr;
printf("hits = %d\n", hits);
ptr = (GLuint *) buffer;

View File

@@ -87,8 +87,8 @@ void drawSquares(GLenum mode)
*/
void processHits (GLint hits, GLuint buffer[])
{
unsigned int i, j;
GLuint ii = 0, jj = 0, names, *ptr;
GLint i;
GLuint j, ii = 0, jj = 0, names, *ptr;
printf ("hits = %d\n", hits);
ptr = (GLuint *) buffer;

View File

@@ -124,8 +124,8 @@ void drawScene (void)
*/
void processHits (GLint hits, GLuint buffer[])
{
unsigned int i, j;
GLuint names, *ptr;
GLint i;
GLuint j, names, *ptr;
printf ("hits = %d\n", hits);
ptr = (GLuint *) buffer;

View File

@@ -94,7 +94,7 @@ void CALLBACK vertexCallback(GLvoid *vertex)
pointer = (GLdouble *) vertex;
glColor3dv(pointer+3);
glVertex3dv(vertex);
glVertex3dv(pointer);
}
/* combineCallback is used to create a new vertex when edges

View File

@@ -1,6 +1,6 @@
typedef struct {
int sizeX, sizeY;
size_t sizeX, sizeY;
GLubyte *data;
} PPMImage;
@@ -30,7 +30,7 @@ static PPMImage *LoadPPM(const char *filename)
exit(1);
}
result = malloc(sizeof(PPMImage));
result = (PPMImage *) malloc(sizeof(PPMImage));
if (!result)
{
fprintf(stderr, "Unable to allocate memory\n");
@@ -52,14 +52,15 @@ static PPMImage *LoadPPM(const char *filename)
while (fgetc(fp) != '\n')
;
result->data = malloc(3 * result->sizeX * result->sizeY);
result->data = (GLubyte *) malloc(3 * result->sizeX * result->sizeY);
if (!result)
{
fprintf(stderr, "Unable to allocate memory\n");
exit(1);
}
if (fread(result->data, 3 * result->sizeX, result->sizeY, fp) != result->sizeY)
if (fread(result->data, 3 * result->sizeX, result->sizeY, fp) !=
result->sizeY)
{
fprintf(stderr, "Error loading image `%s'\n", filename);
exit(1);

View File

@@ -216,11 +216,13 @@ static void CALLBACK ErrorCallback(GLenum which)
}
}
typedef void (GLAPIENTRY *callback_t)();
static void Init(void)
{
theNurbs = gluNewNurbsRenderer();
gluNurbsCallback(theNurbs, GLU_ERROR, ErrorCallback);
gluNurbsCallback(theNurbs, GLU_ERROR, (callback_t) ErrorCallback);
gluNurbsProperty(theNurbs, GLU_SAMPLING_TOLERANCE, 15.0);
gluNurbsProperty(theNurbs, GLU_DISPLAY_MODE, GLU_OUTLINE_PATCH);

View File

@@ -102,6 +102,8 @@ static void CALLBACK ErrorHandler(GLenum which)
fprintf(stderr, "Quad Error: %s\n", gluErrorString(which));
}
typedef void (GLAPIENTRY *callback_t)();
static void Init(void)
{
static GLint colorIndexes[3] = {0, 200, 255};
@@ -163,7 +165,7 @@ static void Init(void)
}
quadObj = gluNewQuadric();
gluQuadricCallback(quadObj, GLU_ERROR, ErrorHandler);
gluQuadricCallback(quadObj, GLU_ERROR, (callback_t) ErrorHandler);
radius1 = 10;
radius2 = 5;

View File

@@ -6,18 +6,17 @@
CC = gcc
CFLAGS = -g -I../include
CFLAGS = -g -I../include -I../util
LIBS = -L../lib -lglut -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXext -lm
PROGS = cva \
dinoshade \
fogcoord \
manytex \
multipal \
projtex \
seccolor \
sharedtex \
texline
seccolor \
texline texwrap fogcoord multiwindow
##### RULES #####

237
progs/tests/yuv.c Normal file
View File

@@ -0,0 +1,237 @@
/*
* Test the GL_NV_texture_rectangle and GL_MESA_ycrcb_texture extensions.
*
* Brian Paul 13 September 2002
*/
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "readtex.c" /* I know, this is a hack. */
#define TEXTURE_FILE "../images/girl.rgb"
static GLfloat Xrot = 0, Yrot = 0, Zrot = 0;
static GLint ImgWidth, ImgHeight;
static GLenum ImgFormat;
static GLubyte *Image = NULL;
static GLushort *ImageYUV = NULL;
static void DrawObject(void)
{
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2f(-1.0, -1.0);
glTexCoord2f(ImgWidth, 0);
glVertex2f(1.0, -1.0);
glTexCoord2f(ImgWidth, ImgHeight);
glVertex2f(1.0, 1.0);
glTexCoord2f(0, ImgHeight);
glVertex2f(-1.0, 1.0);
glEnd();
}
static void Display( void )
{
glClear( GL_COLOR_BUFFER_BIT );
glPushMatrix();
glRotatef(Xrot, 1.0, 0.0, 0.0);
glRotatef(Yrot, 0.0, 1.0, 0.0);
glRotatef(Zrot, 0.0, 0.0, 1.0);
DrawObject();
glPopMatrix();
glutSwapBuffers();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 100.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0, 0.0, -15.0 );
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void SpecialKey( int key, int x, int y )
{
float 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();
}
#define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) )
static void ConvertRGBtoYUV(GLint w, GLint h, const GLubyte *src,
GLushort *dest)
{
GLint i, j;
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
const GLfloat r = (*src++) / 255.0;
const GLfloat g = (*src++) / 255.0;
const GLfloat b = (*src++) / 255.0;
GLfloat y, cr, cb;
GLint iy, icr, icb;
y = r * 65.481 + g * 128.553 + b * 24.966 + 16;
cb = r * -37.797 + g * -74.203 + b * 112.0 + 128;
cr = r * 112.0 + g * -93.786 + b * -18.214 + 128;
/*printf("%f %f %f -> %f %f %f\n", r, g, b, y, cb, cr);*/
iy = (GLint) CLAMP(y, 0, 254);
icb = (GLint) CLAMP(cb, 0, 254);
icr = (GLint) CLAMP(cr, 0, 254);
if (j & 1) {
/* odd */
*dest = (iy << 8) | icr;
}
else {
/* even */
*dest = (iy << 8) | icb;
}
dest++;
}
}
}
static void Init( int argc, char *argv[] )
{
GLuint texObj = 100;
const char *file;
if (!glutExtensionSupported("GL_NV_texture_rectangle")) {
printf("Sorry, GL_NV_texture_rectangle is required\n");
exit(0);
}
if (!glutExtensionSupported("GL_MESA_ycbcr_texture")) {
printf("Sorry, GL_MESA_ycbcr_texture is required\n");
exit(0);
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, texObj);
#ifdef LINEAR_FILTER
/* linear filtering looks much nicer but is much slower for Mesa */
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
#else
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
#endif
if (argc > 1)
file = argv[1];
else
file = TEXTURE_FILE;
Image = LoadRGBImage(file, &ImgWidth, &ImgHeight, &ImgFormat);
if (!Image) {
printf("Couldn't read %s\n", TEXTURE_FILE);
exit(0);
}
#if 0
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0,
GL_RGB, ImgWidth, ImgHeight, 0,
ImgFormat, GL_UNSIGNED_BYTE, Image);
#else
ImageYUV = (GLushort *) malloc(ImgWidth * ImgHeight * sizeof(GLushort));
ConvertRGBtoYUV(ImgWidth, ImgHeight, Image, ImageYUV);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0,
GL_YCBCR_MESA, ImgWidth, ImgHeight, 0,
GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_MESA, ImageYUV);
assert(glGetError() == GL_NO_ERROR);
glTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0,
0, 0, ImgWidth, ImgHeight,
GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_MESA, ImageYUV);
assert(glGetError() == GL_NO_ERROR);
#endif
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_TEXTURE_RECTANGLE_NV);
glShadeModel(GL_FLAT);
glClearColor(0.3, 0.3, 0.4, 1.0);
if (argc > 1 && strcmp(argv[1], "-info")==0) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
}
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowSize( 300, 300 );
glutInitWindowPosition( 0, 0 );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
glutCreateWindow(argv[0] );
Init( argc, argv );
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutDisplayFunc( Display );
glutMainLoop();
return 0;
}

View File

@@ -1,7 +1,7 @@
/* $Id: glxinfo.c,v 1.14.2.1 2002/03/08 19:43:36 brianp Exp $ */
/* $Id: glxinfo.c,v 1.14.2.5 2002/09/06 12:59:14 brianp Exp $ */
/*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2002 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"),
@@ -29,6 +29,8 @@
* -v print verbose information
* -display DisplayName specify the X display to interogate
* -b only print ID of "best" visual on screen 0
* -i use indirect rendering connection only
* -l print interesting OpenGL limits (added 5 Sep 2002)
*
* Brian Paul 26 January 2000
*/
@@ -148,7 +150,59 @@ print_display_info(Display *dpy)
static void
print_screen_info(Display *dpy, int scrnum, Bool allowDirect)
print_limits(void)
{
struct token_name {
GLuint count;
GLenum token;
const char *name;
};
static const struct token_name limits[] = {
{ 1, GL_MAX_ATTRIB_STACK_DEPTH, "GL_MAX_ATTRIB_STACK_DEPTH" },
{ 1, GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH" },
{ 1, GL_MAX_CLIP_PLANES, "GL_MAX_CLIP_PLANES" },
{ 1, GL_MAX_COLOR_MATRIX_STACK_DEPTH, "GL_MAX_COLOR_MATRIX_STACK_DEPTH" },
{ 1, GL_MAX_ELEMENTS_VERTICES, "GL_MAX_ELEMENTS_VERTICES" },
{ 1, GL_MAX_ELEMENTS_INDICES, "GL_MAX_ELEMENTS_INDICES" },
{ 1, GL_MAX_EVAL_ORDER, "GL_MAX_EVAL_ORDER" },
{ 1, GL_MAX_LIGHTS, "GL_MAX_LIGHTS" },
{ 1, GL_MAX_LIST_NESTING, "GL_MAX_LIST_NESTING" },
{ 1, GL_MAX_MODELVIEW_STACK_DEPTH, "GL_MAX_MODELVIEW_STACK_DEPTH" },
{ 1, GL_MAX_NAME_STACK_DEPTH, "GL_MAX_NAME_STACK_DEPTH" },
{ 1, GL_MAX_PIXEL_MAP_TABLE, "GL_MAX_PIXEL_MAP_TABLE" },
{ 1, GL_MAX_PROJECTION_STACK_DEPTH, "GL_MAX_PROJECTION_STACK_DEPTH" },
{ 1, GL_MAX_TEXTURE_STACK_DEPTH, "GL_MAX_TEXTURE_STACK_DEPTH" },
{ 1, GL_MAX_TEXTURE_SIZE, "GL_MAX_TEXTURE_SIZE" },
{ 1, GL_MAX_3D_TEXTURE_SIZE, "GL_MAX_3D_TEXTURE_SIZE" },
{ 1, GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB" },
{ 1, GL_MAX_RECTANGLE_TEXTURE_SIZE_NV, "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV" },
{ 1, GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB" },
{ 1, GL_MAX_TEXTURE_UNITS_ARB, "GL_MAX_TEXTURE_UNITS_ARB" },
{ 1, GL_MAX_TEXTURE_LOD_BIAS_EXT, "GL_MAX_TEXTURE_LOD_BIAS_EXT" },
{ 1, GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT" },
{ 2, GL_MAX_VIEWPORT_DIMS, "GL_MAX_VIEWPORT_DIMS" },
{ 2, GL_ALIASED_LINE_WIDTH_RANGE, "GL_ALIASED_LINE_WIDTH_RANGE" },
{ 2, GL_SMOOTH_LINE_WIDTH_RANGE, "GL_SMOOTH_LINE_WIDTH_RANGE" },
{ 2, GL_ALIASED_POINT_SIZE_RANGE, "GL_ALIASED_POINT_SIZE_RANGE" },
{ 2, GL_SMOOTH_POINT_SIZE_RANGE, "GL_SMOOTH_POINT_SIZE_RANGE" },
{ 0, (GLenum) 0, NULL }
};
GLint i, max[2];
printf("OpenGL limits:\n");
for (i = 0; limits[i].count; i++) {
glGetIntegerv(limits[i].token, max);
if (glGetError() == GL_NONE) {
if (limits[i].count == 1)
printf(" %s = %d\n", limits[i].name, max[0]);
else /* XXX fix if we ever query something with more than 2 values */
printf(" %s = %d, %d\n", limits[i].name, max[0], max[1]);
}
}
}
static void
print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits)
{
Window win;
int attribSingle[] = {
@@ -218,7 +272,7 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect)
const char *gluExtensions = (const char *) gluGetString(GLU_EXTENSIONS);
#endif
/* Strip the screen number from the display name, if present. */
if (!(displayName = malloc(strlen(DisplayString(dpy)) + 1))) {
if (!(displayName = (char *) malloc(strlen(DisplayString(dpy)) + 1))) {
fprintf(stderr, "Error: malloc() failed\n");
exit(1);
}
@@ -247,6 +301,8 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect)
printf("OpenGL version string: %s\n", glVersion);
printf("OpenGL extensions:\n");
print_extension_list(glExtensions);
if (limits)
print_limits();
#ifdef DO_GLU
printf("glu version: %s\n", gluVersion);
printf("glu extensions:\n");
@@ -416,6 +472,8 @@ print_visual_attribs_short(const struct visual_attribs *attribs)
caveat = "Slow";
else if (attribs->visualCaveat == GLX_NON_CONFORMANT_VISUAL_EXT)
caveat = "Ncon";
else
caveat = "None";
#else
caveat = "None";
#endif
@@ -486,16 +544,16 @@ print_visual_attribs_long(const struct visual_attribs *attribs)
static void
print_visual_info(Display *dpy, int scrnum, InfoMode mode)
{
XVisualInfo template;
XVisualInfo theTemplate;
XVisualInfo *visuals;
int numVisuals;
long mask;
int i;
/* get list of all visuals on this screen */
template.screen = scrnum;
theTemplate.screen = scrnum;
mask = VisualScreenMask;
visuals = XGetVisualInfo(dpy, mask, &template, &numVisuals);
visuals = XGetVisualInfo(dpy, mask, &theTemplate, &numVisuals);
if (mode == Verbose) {
for (i = 0; i < numVisuals; i++) {
@@ -569,7 +627,7 @@ mesa_hack(Display *dpy, int scrnum)
static int
find_best_visual(Display *dpy, int scrnum)
{
XVisualInfo template;
XVisualInfo theTemplate;
XVisualInfo *visuals;
int numVisuals;
long mask;
@@ -577,9 +635,9 @@ find_best_visual(Display *dpy, int scrnum)
struct visual_attribs bestVis;
/* get list of all visuals on this screen */
template.screen = scrnum;
theTemplate.screen = scrnum;
mask = VisualScreenMask;
visuals = XGetVisualInfo(dpy, mask, &template, &numVisuals);
visuals = XGetVisualInfo(dpy, mask, &theTemplate, &numVisuals);
/* init bestVis with first visual info */
get_visual_attribs(dpy, &visuals[0], &bestVis);
@@ -627,6 +685,7 @@ usage(void)
printf("\t-h: This information.\n");
printf("\t-i: Force an indirect rendering context.\n");
printf("\t-b: Find the 'best' visual and print it's number.\n");
printf("\t-l: Print interesting OpenGLl imits.\n");
}
@@ -638,6 +697,7 @@ main(int argc, char *argv[])
int numScreens, scrnum;
InfoMode mode = Normal;
GLboolean findBest = GL_FALSE;
GLboolean limits = GL_FALSE;
Bool allowDirect = True;
int i;
@@ -658,6 +718,9 @@ main(int argc, char *argv[])
else if (strcmp(argv[i], "-i") == 0) {
allowDirect = False;
}
else if (strcmp(argv[i], "-l") == 0) {
limits = GL_TRUE;
}
else if (strcmp(argv[i], "-h") == 0) {
usage();
return 0;
@@ -686,7 +749,7 @@ main(int argc, char *argv[])
print_display_info(dpy);
for (scrnum = 0; scrnum < numScreens; scrnum++) {
mesa_hack(dpy, scrnum);
print_screen_info(dpy, scrnum, allowDirect);
print_screen_info(dpy, scrnum, allowDirect, limits);
printf("\n");
print_visual_info(dpy, scrnum, mode);
if (scrnum + 1 < numScreens)

View File

@@ -1,4 +1,4 @@
/* $Id: glxpixmap.c,v 1.2 2000/07/11 16:05:29 brianp Exp $ */
/* $Id: glxpixmap.c,v 1.2.6.1 2002/07/12 15:50:46 brianp Exp $ */
/*
@@ -10,6 +10,7 @@
#include <GL/gl.h>
#define GLX_GLXEXT_PROTOTYPES
#include <GL/glx.h>
#include <stdio.h>
#include <stdlib.h>

View File

@@ -20,32 +20,46 @@
# 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.
# DOS/DJGPP glu makefile v1.0 for Mesa 4.0
# DOS/DJGPP glu makefile v1.1 for Mesa 4.0
#
# Copyright (C) 2002 - Borca Daniel
# Email : dborca@yahoo.com
# Web : http://www.geocities.com/dborca
#
# Available options:
#
# Environment variables:
# CFLAGS
#
# Targets:
# all: build GLU
# clean: remove object files
#
.PHONY: all clean
TOP = ..
CC = gcc
CFLAGS = -I$(TOP)/include -Wall -W -Wno-unused -mcpu=$(CPU) -ffast-math -O2
AR = ar
ARFLAGS = ruv
LIBDIR = $(TOP)/lib
ifeq ($(wildcard $(DJDIR)/lib/dxe2.ld),)
DXE2GEN =
else
DXE2GEN = $(wildcard $(addsuffix /dxe2gen.exe,$(subst ;, ,$(PATH))))
endif
GLU_LIB = libglu.a
GLU_DXE = glu.dxe
GLU_IMP = libiglu.a
CC = gcc
CFLAGS += -I$(TOP)/include
AR = ar
ARFLAGS = ru
ifneq ($(wildcard $(DJDIR)/lib/dxe2.ld),)
DXE2GEN = $(wildcard $(addsuffix /dxe2gen.exe,$(subst ;, ,$(PATH))))
endif
RM = del
CORE_SOURCES = \
glu.c \
mipmap.c \
@@ -64,7 +78,7 @@ SOURCES = $(CORE_SOURCES)
OBJECTS = $(SOURCES:.c=.o)
.c.o:
gcc -o $@ -c $(CFLAGS) $<
$(CC) -o $@ -c $(CFLAGS) $<
all: $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP)
@@ -76,10 +90,10 @@ ifeq ($(DXE2GEN),)
$(warning Missing DXE2GEN and/or DXE2.LD! You must have DXE2GEN)
$(warning somewhere in PATH, and DXE2.LD in DJGPP/LIB directory.)
else
dxe2gen -o $(LIBDIR)/$(GLU_DXE) -I $(LIBDIR)/$(GLU_IMP) $(OBJECTS) -D "Mesa DOS GLU" -U
-dxe2gen -o $(LIBDIR)/$(GLU_DXE) -I $(LIBDIR)/$(GLU_IMP) $(OBJECTS) -E djgpp_ -E glu -D "Mesa DJGPP GLU" -U
endif
clean:
-$(RM) *.o
-$(RM) $(subst /,\,*.o)
include depend
-include depend

View File

@@ -35,8 +35,8 @@
/*
* slicer.c++
*
* $Date: 2001/05/01 14:56:00 $ $Revision: 1.2 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/slicer.cc,v 1.2 2001/05/01 14:56:00 brianp Exp $
* $Date: 2002/06/30 16:58:50 $ $Revision: 1.2.2.1 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/slicer.cc,v 1.2.2.1 2002/06/30 16:58:50 brianp Exp $
*/
#include <stdlib.h>
@@ -309,7 +309,6 @@ static void triangulateRectAux(PwlArc* top, PwlArc* bot, PwlArc* left, PwlArc* r
static void triangulateRect(Arc_ptr loop, Backend& backend, int TB_or_LR, int ulinear, int vlinear)
{
int i;
//we know the loop is a rectangle, but not sure which is top
Arc_ptr top, bot, left, right;
if(loop->tail()[1] == loop->head()[1])
@@ -572,8 +571,6 @@ static void triangulateRectCenter(int n_ulines, REAL* u_val,
int n_vlines, REAL* v_val,
Backend& backend)
{
TrimVertex trimVert;
trimVert.nuid = 0;//????
// XXX this code was patched by Diego Santa Cruz <Diego.SantaCruz@epfl.ch>
// to fix a problem in which glMapGrid2f() was called with bad parameters.
@@ -1075,18 +1072,21 @@ void Slicer::slice_new(Arc_ptr loop)
mydu = (du>0)? du: -du;
mydv = (dv>0)? dv: -dv;
for(Arc_ptr jarc=loop->next; jarc != loop; jarc = jarc->next)
{
for(Arc_ptr jarc=loop->next; jarc != loop; jarc = jarc->next)
{
if(jarc->tail()[0] < uMin)
uMin = jarc->tail()[0];
if(jarc->tail()[0] > uMax)
uMax = jarc->tail()[0];
if(jarc->tail()[1] < vMin)
vMin = jarc->tail()[1];
if(jarc->tail()[1] > vMax)
vMax = jarc->tail()[1];
}
if(jarc->tail()[0] < uMin)
uMin = jarc->tail()[0];
if(jarc->tail()[0] > uMax)
uMax = jarc->tail()[0];
if(jarc->tail()[1] < vMin)
vMin = jarc->tail()[1];
if(jarc->tail()[1] > vMax)
vMax = jarc->tail()[1];
}
if (uMax == uMin)
return; // prevent divide-by-zero. Jon Perry. 17 June 2002
if(mydu > uMax - uMin)
num_ulines = 2;

View File

@@ -20,36 +20,65 @@
# 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.
# DOS/DJGPP glut makefile v1.0 for Mesa 4.0
# DOS/DJGPP glut makefile v1.1 for Mesa 4.0
#
# Copyright (C) 2002 - Borca Daniel
# Email : dborca@yahoo.com
# Web : http://www.geocities.com/dborca
#
# Available options:
#
# Environment variables:
# CFLAGS
#
# GLIDE absolute path to Glide SDK; used with FX.
# default = $(TOP)/include/glide3
# FX=1 build for 3dfx Glide3; use it if you have the glide
# SDK (designed for your platform), and, of course, a
# 3dfx card... Note that this disables compilation of
# actual DMesa code, as Glide does all the stuff!
# default = no
# MARK absolute path to original GLUT.
# default = $(TOP)/src-glut
#
# Targets:
# all: build GLUT
# clean: remove object files
#
.PHONY: all clean
TOP = ..
CC = gcc
CFLAGS = -I$(TOP)/include -Wall -W -Wno-unused -mcpu=$(CPU) -ffast-math -O2
AR = ar
ARFLAGS = ruv
GLIDE ?= $(TOP)/include/glide3
MARK ?= $(TOP)/src-glut
LIBDIR = $(TOP)/lib
ifeq ($(wildcard $(DJDIR)/lib/dxe2.ld),)
DXE2GEN =
else
DXE2GEN = $(wildcard $(addsuffix /dxe2gen.exe,$(subst ;, ,$(PATH))))
endif
GLUT_LIB = libglut.a
GLUT_DXE = glut.dxe
GLUT_IMP = libiglut.a
CC = gcc
CFLAGS += -I$(TOP)/include -I$(MARK)
ifdef FX
CFLAGS += -D__DOS__ -I$(GLIDE) -DFX -DFX_GLIDE3 -DFXMESA_USE_ARGB
endif
AR = ar
ARFLAGS = ru
ifneq ($(wildcard $(DJDIR)/lib/dxe2.ld),)
DXE2GEN = $(wildcard $(addsuffix /dxe2gen.exe,$(subst ;, ,$(PATH))))
endif
RM = del
CORE_SOURCES = \
bitmap.c \
callback.c \
color.c \
font.c \
globals.c \
init.c \
menu.c \
@@ -66,16 +95,25 @@ PC_HW_SOURCES = \
PC_HW/pc_timer.c \
PC_HW/pc_irq.S
SOURCES = $(CORE_SOURCES) $(PC_HW_SOURCES)
MARK_SOURCES = \
$(MARK)/glut_8x13.c \
$(MARK)/glut_9x15.c \
$(MARK)/glut_hel10.c \
$(MARK)/glut_hel12.c \
$(MARK)/glut_hel18.c \
$(MARK)/glut_tr10.c \
$(MARK)/glut_tr24.c
SOURCES = $(CORE_SOURCES) $(PC_HW_SOURCES) $(MARK_SOURCES)
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
.c.o:
gcc -o $@ -c $(CFLAGS) $<
$(CC) -o $@ -c $(CFLAGS) $<
.S.o:
gcc -o $@ -c $(CFLAGS) $<
$(CC) -o $@ -c $(CFLAGS) $<
.s.o:
gcc -o $@ -c $(CFLAGS) $(<:.s=.S)
$(CC) -o $@ -c $(CFLAGS) -x assembler-with-cpp $<
all: $(LIBDIR)/$(GLUT_LIB) $(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP)
@@ -87,28 +125,12 @@ ifeq ($(DXE2GEN),)
$(warning Missing DXE2GEN and/or DXE2.LD! You must have DXE2GEN)
$(warning somewhere in PATH, and DXE2.LD in DJGPP/LIB directory.)
else
dxe2gen -o $(LIBDIR)/$(GLUT_DXE) -I $(LIBDIR)/$(GLUT_IMP) $(OBJECTS) -D "Mesa DOS GLUT" -U
-dxe2gen -o $(LIBDIR)/$(GLUT_DXE) -I $(LIBDIR)/$(GLUT_IMP) $(OBJECTS) -E djgpp_ -E glut -D "Mesa DJGPP GLUT" -U
endif
clean:
-$(RM) *.o
-$(RM) PC_HW\*.o
-$(RM) $(subst /,\,*.o)
-$(RM) $(subst /,\,PC_HW/*.o)
-$(RM) $(subst /,\,$(MARK)/*.o)
callback.o: callback.c ../include/GL/glut.h internal.h PC_HW/pc_hw.h
color.o: color.c ../include/GL/glut.h
font.o: font.c ../include/GL/glut.h
globals.o: globals.c ../include/GL/glut.h internal.h PC_HW/pc_hw.h
init.o: init.c ../include/GL/glut.h internal.h PC_HW/pc_hw.h
menu.o: menu.c ../include/GL/glut.h
models.o: models.c ../include/GL/glut.h
overlay.o: overlay.c ../include/GL/glut.h
state.o: state.c ../include/GL/glut.h internal.h PC_HW/pc_hw.h
teapot.o: teapot.c ../include/GL/glut.h
window.o: window.c ../include/GL/glut.h ../include/GL/dmesa.h internal.h \
PC_HW/pc_hw.h
PC_HW/pc_hw.o: PC_HW/pc_hw.c PC_HW/pc_hw.h
PC_HW/pc_keyb.o: PC_HW/pc_keyb.c PC_HW/pc_hw.h
PC_HW/pc_mouse.o: PC_HW/pc_mouse.c PC_HW/pc_hw.h
PC_HW/pc_timer.o: PC_HW/pc_timer.c PC_HW/pc_hw.h
PC_HW/pc_irq.o: PC_HW/pc_irq.S
-include depend

View File

@@ -1,5 +1,5 @@
/*
* PC/HW routine collection v1.0 for DOS/DJGPP
* PC/HW routine collection v1.1 for DOS/DJGPP
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -45,8 +45,8 @@ void *pc_malloc (size_t size);
/*
* IRQ
*/
#define ENABLE() __asm__ __volatile__ ("sti")
#define DISABLE() __asm__ __volatile__ ("cli")
#define ENABLE() __asm __volatile ("sti")
#define DISABLE() __asm __volatile ("cli")
extern int pc_install_irq (int i, int (*handler) ());
extern int pc_remove_irq (int i);

View File

@@ -1,5 +1,5 @@
/*
* PC/HW routine collection v1.0 for DOS/DJGPP
* PC/HW routine collection v1.1 for DOS/DJGPP
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -201,7 +201,7 @@ static unsigned char numlock_table[10] =
/* kb_wait_for_write_ready:
* Wait for the keyboard controller to set the ready-for-write bit.
*/
static __inline__ int kb_wait_for_write_ready (void)
static __inline int kb_wait_for_write_ready (void)
{
int timeout = 4096;
@@ -215,7 +215,7 @@ static __inline__ int kb_wait_for_write_ready (void)
/* kb_wait_for_read_ready:
* Wait for the keyboard controller to set the ready-for-read bit.
*/
static __inline__ int kb_wait_for_read_ready (void)
static __inline int kb_wait_for_read_ready (void)
{
int timeout = 16384;
@@ -229,7 +229,7 @@ static __inline__ int kb_wait_for_read_ready (void)
/* kb_send_data:
* Sends a byte to the keyboard controller. Returns 1 if all OK.
*/
static __inline__ int kb_send_data (unsigned char data)
static __inline int kb_send_data (unsigned char data)
{
int resends = 4;
int timeout, temp;
@@ -357,9 +357,9 @@ static void handle_code (int scancode, int keycode)
in_a_terrupt--;
} ENDOFUNC(handle_code)
static __inline__ void satisfy (void)
static __inline void satisfy (void)
{
__asm__("\n\
__asm("\n\
inb $0x61, %%al \n\
movb %%al, %%ah \n\
orb $0x80, %%al \n\
@@ -404,7 +404,7 @@ static int keyboard ()
only SIGINT (but not Ctrl-Break)
calls the destructors and will safely clean up
*/
__asm__("\n\
__asm("\n\
movb $0x79, %%al \n\
call ___djgpp_hw_exception \n\
":::"%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");

View File

@@ -1,5 +1,5 @@
/*
* PC/HW routine collection v1.0 for DOS/DJGPP
* PC/HW routine collection v1.1 for DOS/DJGPP
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -17,7 +17,7 @@
#define CLEAR_MICKEYS() \
do { \
__asm__ __volatile__ ("movw $0xb, %%ax; int $0x33":::"%eax", "%ecx", "%edx"); \
__asm __volatile ("movw $0xb, %%ax; int $0x33":::"%eax", "%ecx", "%edx"); \
ox = oy = 0; \
} while (0)
@@ -71,7 +71,7 @@ void pc_remove_mouse (void)
{
if (mouse_callback) {
pc_clexit(pc_remove_mouse);
__asm__("\n\
__asm("\n\
movl %%edx, %%ecx \n\
shrl $16, %%ecx \n\
movw $0x0304, %%ax \n\
@@ -97,7 +97,7 @@ int pc_install_mouse (void)
}
/* reset mouse and get status */
__asm__("\n\
__asm("\n\
xorl %%eax, %%eax \n\
int $0x33 \n\
andl %%ebx, %%eax \n\
@@ -133,7 +133,7 @@ int pc_install_mouse (void)
}
/* try to hook a call-back */
__asm__("\n\
__asm("\n\
pushl %%ds \n\
pushl %%es \n\
movw $0x0303, %%ax \n\
@@ -225,7 +225,7 @@ void pc_unscare_mouse (void)
/* not implemented */
}
__asm__("\n\
__asm("\n\
.balign 4 \n\
.global _mouse_wrapper \n\
_mouse_wrapper: \n\

56
src/glut/dos/bitmap.c Normal file
View File

@@ -0,0 +1,56 @@
/* Copyright (c) Mark J. Kilgard, 1994. */
/* 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. */
#include "glutbitmap.h"
void APIENTRY
glutBitmapCharacter(GLUTbitmapFont font, int c)
{
const BitmapCharRec *ch;
BitmapFontPtr fontinfo;
GLint swapbytes, lsbfirst, rowlength;
GLint skiprows, skippixels, alignment;
#if defined(_WIN32)
fontinfo = (BitmapFontPtr) __glutFont(font);
#else
fontinfo = (BitmapFontPtr) font;
#endif
if (c < fontinfo->first ||
c >= fontinfo->first + fontinfo->num_chars)
return;
ch = fontinfo->ch[c - fontinfo->first];
if (ch) {
/* Save current modes. */
glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes);
glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst);
glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength);
glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows);
glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels);
glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
/* Little endian machines (DEC Alpha for example) could
benefit from setting GL_UNPACK_LSB_FIRST to GL_TRUE
instead of GL_FALSE, but this would require changing the
generated bitmaps too. */
glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glBitmap(ch->width, ch->height, ch->xorig, ch->yorig,
ch->advance, 0, ch->bitmap);
/* Restore saved modes. */
glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes);
glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst);
glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels);
glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
}
}

View File

@@ -1,52 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 3.4
* Copyright (C) 1995-1998 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/
#include "GL/glut.h"
void APIENTRY glutBitmapCharacter (void *font, int character)
{
}
int APIENTRY glutBitmapWidth (void *font, int character)
{
return 0;
}
void APIENTRY glutStrokeCharacter (void *font, int character)
{
}
int APIENTRY glutStrokeWidth (void *font, int character)
{
return 0;
}

View File

@@ -19,7 +19,7 @@
*/
/*
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
* DOS/DJGPP glut driver v1.1 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -28,16 +28,26 @@
#include "GL/glut.h"
#ifndef FX
#include "GL/dmesa.h"
#else
#include "GL/fxmesa.h"
#endif
#include "internal.h"
static int window;
#ifndef FX
static DMesaVisual visual = NULL;
static DMesaContext context = NULL;
static DMesaBuffer buffer[MAX_WINDOWS];
#else
static void *visual = NULL;
static fxMesaContext context = NULL;
static int fx_attrib[32];
#endif
@@ -48,8 +58,12 @@ static void clean (void)
for (i=0; i<MAX_WINDOWS; i++) {
glutDestroyWindow(i+1);
}
#ifndef FX
if (context) DMesaDestroyContext(context);
if (visual) DMesaDestroyVisual(visual);
#else
if (context) fxMesaDestroyContext(context);
#endif
pc_close_stdout();
pc_close_stderr();
@@ -76,6 +90,7 @@ int APIENTRY glutCreateWindow (const char *title)
screen_h = 768;
}
#ifndef FX
if ((visual=DMesaCreateVisual(screen_w, screen_h, DEFAULT_BPP,
g_display_mode & GLUT_DOUBLE,
g_display_mode & GLUT_DEPTH ?DEPTH_SIZE :0,
@@ -88,12 +103,24 @@ int APIENTRY glutCreateWindow (const char *title)
DMesaDestroyVisual(visual);
return 0;
}
#else
i = 0;
if (g_display_mode & GLUT_DOUBLE) fx_attrib[i++] = FXMESA_DOUBLEBUFFER;
if (g_display_mode & GLUT_DEPTH) { fx_attrib[i++] = FXMESA_DEPTH_SIZE; fx_attrib[i++] = DEPTH_SIZE; }
if (g_display_mode & GLUT_STENCIL) { fx_attrib[i++] = FXMESA_STENCIL_SIZE; fx_attrib[i++] = STENCIL_SIZE; }
if (g_display_mode & GLUT_ACCUM) { fx_attrib[i++] = FXMESA_ACCUM_SIZE; fx_attrib[i++] = ACCUM_SIZE; }
fx_attrib[i] = FXMESA_NONE;
if ((context=fxMesaCreateBestContext(-1, screen_w, screen_h, fx_attrib))==NULL) {
return 0;
}
#endif
pc_open_stdout();
pc_open_stderr();
pc_atexit(clean);
}
#ifndef FX
for (i=0; i<MAX_WINDOWS; i++) {
if (!buffer[i]) {
DMesaBuffer b;
@@ -115,6 +142,11 @@ int APIENTRY glutCreateWindow (const char *title)
}
return 0;
#else
fxMesaMakeCurrent(context);
return 1;
#endif
}
@@ -126,10 +158,12 @@ int APIENTRY glutCreateSubWindow (int win, int x, int y, int width, int height)
void APIENTRY glutDestroyWindow (int win)
{
#ifndef FX
if (buffer[win-1]) {
DMesaDestroyBuffer(buffer[win-1]);
buffer[win-1] = NULL;
}
#endif
}
@@ -142,7 +176,11 @@ void APIENTRY glutPostRedisplay (void)
void APIENTRY glutSwapBuffers (void)
{
if (g_mouse) pc_scare_mouse();
#ifndef FX
DMesaSwapBuffers(buffer[window]);
#else
fxMesaSwapBuffers();
#endif
if (g_mouse) pc_unscare_mouse();
}
@@ -171,15 +209,18 @@ void APIENTRY glutSetIconTitle (const char *title)
void APIENTRY glutPositionWindow (int x, int y)
{
#ifndef FX
if (DMesaViewport(buffer[window], x, y, g_width, g_height)) {
g_xpos = x;
g_ypos = y;
}
#endif
}
void APIENTRY glutReshapeWindow (int width, int height)
{
#ifndef FX
if (DMesaViewport(buffer[window], g_xpos, g_ypos, width, height)) {
g_width = width;
g_height = height;
@@ -189,6 +230,7 @@ void APIENTRY glutReshapeWindow (int width, int height)
glViewport(0, 0, width, height);
}
}
#endif
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,3 @@
/* $Id: t_dd_dmatmp2.h,v 1.1.2.2 2002/06/14 03:49:10 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -113,9 +112,11 @@ static void TAG(render_points_verts)( GLcontext *ctx,
GLuint count,
GLuint flags )
{
LOCAL_VARS;
if (0) fprintf(stderr, "%s\n", __FUNCTION__);
EMIT_PRIM( ctx, GL_POINTS, HW_POINTS, start, count );
if (start < count) {
LOCAL_VARS;
if (0) fprintf(stderr, "%s\n", __FUNCTION__);
EMIT_PRIM( ctx, GL_POINTS, HW_POINTS, start, count );
}
}
static void TAG(render_lines_verts)( GLcontext *ctx,
@@ -157,7 +158,7 @@ static void TAG(render_line_strip_verts)( GLcontext *ctx,
RESET_STIPPLE();
if (PREFER_DISCREET_ELT_PRIM( count-start, HW_LINES ))
if (PREFER_DISCRETE_ELT_PRIM( count-start, HW_LINES ))
{
int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS();
int currentsz;
@@ -221,7 +222,7 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx,
if (start+1 >= count)
return;
if (PREFER_DISCREET_ELT_PRIM( count-start, HW_LINES )) {
if (PREFER_DISCRETE_ELT_PRIM( count-start, HW_LINES )) {
int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS();
int currentsz;
@@ -335,7 +336,7 @@ static void TAG(render_triangles_verts)( GLcontext *ctx,
return;
}
/* need a PREFER_DISCREET_ELT_PRIM here too..
/* need a PREFER_DISCRETE_ELT_PRIM here too..
*/
EMIT_PRIM( ctx, GL_TRIANGLES, HW_TRIANGLES, start, count );
}
@@ -353,7 +354,7 @@ static void TAG(render_tri_strip_verts)( GLcontext *ctx,
if (start + 2 >= count)
return;
if (PREFER_DISCREET_ELT_PRIM( count-start, HW_TRIANGLES ))
if (PREFER_DISCRETE_ELT_PRIM( count-start, HW_TRIANGLES ))
{
int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS();
int currentsz;
@@ -435,7 +436,7 @@ static void TAG(render_tri_fan_verts)( GLcontext *ctx,
if (start+2 >= count)
return;
if (PREFER_DISCREET_ELT_PRIM( count-start, HW_TRIANGLES ))
if (PREFER_DISCRETE_ELT_PRIM( count-start, HW_TRIANGLES ))
{
int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS();
int currentsz;

View File

@@ -1,4 +1,3 @@
/* $Id: t_dd_vb.c,v 1.15.2.1 2001/12/13 10:57:41 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -195,22 +194,78 @@ void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v )
LOCALVARS
GLuint format = GET_VERTEX_FORMAT();
if (format == TINY_VERTEX_FORMAT) {
fprintf(stderr, "x %f y %f z %f\n", v->v.x, v->v.y, v->v.z);
fprintf(stderr, "r %d g %d b %d a %d\n",
fprintf(stderr, "(%x) ", format);
switch (format) {
#if HAVE_TINY_VERTICES
case TINY_VERTEX_FORMAT:
fprintf(stderr, "xyz %.4f,%.4f,%.4f rgba %x:%x:%x:%x\n",
v->v.x, v->v.y, v->v.z,
v->tv.color.red,
v->tv.color.green,
v->tv.color.blue,
v->tv.color.alpha);
}
else {
fprintf(stderr, "x %f y %f z %f oow %f\n",
v->v.x, v->v.y, v->v.z, v->v.w);
fprintf(stderr, "r %d g %d b %d a %d\n",
break;
#endif
#if HAVE_NOTEX_VERTICES
case NOTEX_VERTEX_FORMAT:
fprintf(stderr, "xyzw %.4f,%.4f,%.4f,%.4f rgba %x:%x:%x:%x spec %x:%x:%x:%x\n",
v->v.x, v->v.y, v->v.z, v->v.w,
v->v.color.red,
v->v.color.green,
v->v.color.blue,
v->v.color.alpha);
v->v.color.alpha,
v->v.specular.red,
v->v.specular.green,
v->v.specular.blue,
v->v.specular.alpha);
break;
#endif
#if HAVE_TEX0_VERTICES
case TEX0_VERTEX_FORMAT:
fprintf(stderr, "xyzw %.4f,%.4f,%.4f,%.4f rgba %x:%x:%x:%x st %.4f,%.4f\n",
v->v.x, v->v.y, v->v.z, v->v.w,
v->v.color.red,
v->v.color.green,
v->v.color.blue,
v->v.color.alpha,
v->v.u0,
v->v.v0);
break;
#endif
#if HAVE_TEX1_VERTICES
case TEX1_VERTEX_FORMAT:
fprintf(stderr, "xyzw %.4f,%.4f,%.4f,%.4f rgba %x:%x:%x:%x st %.4f,%.4f st %.4f,%.4f\n",
v->v.x, v->v.y, v->v.z, v->v.w,
v->v.color.red,
v->v.color.green,
v->v.color.blue,
v->v.color.alpha,
v->v.u0,
v->v.v0,
v->v.u1,
v->v.u2);
break;
#endif
#if HAVE_PTEX_VERTICES
case PROJ_TEX1_VERTEX_FORMAT:
fprintf(stderr, "xyzw %.4f,%.4f,%.4f,%.4f rgba %x:%x:%x:%x stq %.4f,%.4f,%.4f stq %.4f,%.4f,%.4f\n",
v->v.x, v->v.y, v->v.z, v->v.w,
v->v.color.red,
v->v.color.green,
v->v.color.blue,
v->v.color.alpha,
v->pv.u0,
v->pv.v0,
v->pv.q0,
v->pv.u1,
v->pv.v1,
v->pv.q1);
break;
#endif
default:
fprintf(stderr, "???\n");
break;
}
fprintf(stderr, "\n");

View File

@@ -1,4 +1,4 @@
/* $Id: t_dd_vbtmp.h,v 1.14.2.4 2002/06/14 03:49:10 brianp Exp $ */
/* $Id: t_dd_vbtmp.h,v 1.14.2.5 2002/08/21 17:46:08 alanh Exp $ */
/*
* Mesa 3-D graphics library
@@ -61,7 +61,10 @@
* unsigned char ub4[4][16];
* }
*
* VERTEX: hw vertex type as above
* VERTEX_COLOR: hw color struct type in VERTEX
*
* DO_XYZW: Emit xyz and maybe w coordinates.
* DO_RGBA: Emit color.
* DO_SPEC: Emit specular color.
@@ -459,11 +462,11 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
*(GLuint *)&v[3] = LE32_TO_CPU(*(GLuint *)col);
}
else {
GLubyte *b = (GLubyte *)&v[3];
b[0] = col[0][2];
b[1] = col[0][1];
b[2] = col[0][0];
b[3] = col[0][3];
VERTEX_COLOR *c = (VERTEX_COLOR *)&v[3];
c->blue = col[0][2];
c->green = col[0][1];
c->red = col[0][0];
c->alpha = col[0][3];
}
STRIDE_4UB( col, col_stride );
}
@@ -483,11 +486,11 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
*(GLuint *)&v[3] = LE32_TO_CPU(*(GLuint *)&col[i]);
}
else {
GLubyte *b = (GLubyte *)&v[3];
b[0] = col[i][2];
b[1] = col[i][1];
b[2] = col[i][0];
b[3] = col[i][3];
VERTEX_COLOR *c = (VERTEX_COLOR *)&v[3];
c->blue = col[i][2];
c->green = col[i][1];
c->red = col[i][0];
c->alpha = col[i][3];
}
}
/* fprintf(stderr, "vert %d: %.2f %.2f %.2f %x\n", */
@@ -528,11 +531,11 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
*(GLuint *)v = LE32_TO_CPU(*(GLuint *)col[0]);
}
else {
GLubyte *b = (GLubyte *)v;
b[0] = col[0][2];
b[1] = col[0][1];
b[2] = col[0][0];
b[3] = col[0][3];
VERTEX_COLOR *c = (VERTEX_COLOR *)v;
c->blue = col[0][2];
c->green = col[0][1];
c->red = col[0][0];
c->alpha = col[0][3];
}
STRIDE_4UB( col, col_stride );
}

View File

@@ -23,7 +23,7 @@
*/
/*
* DOS/DJGPP device driver v1.0 for Mesa 4.0
* DOS/DJGPP device driver v1.1 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -79,10 +79,9 @@ struct dmesa_buffer {
GLframebuffer gl_buffer; /* The depth, stencil, accum, etc buffers */
void *the_window; /* your window handle, etc */
int bypp; /* bytes per pixel */
int xpos, ypos; /* position */
int width, height; /* size in pixels */
int bwidth, len; /* bytes in a line, then total */
int bypp, stride, bytes; /* bytes per pixel, in a line, then total */
};
/*
@@ -493,7 +492,7 @@ static void clear (GLcontext *ctx, GLbitfield mask, GLboolean all,
if (*colorMask==0xffffffff) {
if (mask & DD_BACK_LEFT_BIT) {
if (all) {
vl_clear(b->the_window, b->len, c->ClearColor);
vl_clear(b->the_window, b->bytes, c->ClearColor);
} else {
vl_rect(b->the_window, x, y, width, height, c->ClearColor);
}
@@ -514,10 +513,9 @@ static void clear (GLcontext *ctx, GLbitfield mask, GLboolean all,
static void set_read_buffer (GLcontext *ctx, GLframebuffer *buffer,
GLenum mode)
{
/*
DMesaContext c = (DMesaContext)ctx->DriverCtx;
dmesa_update_state(ctx);
*/
/*
XXX this has to be fixed
*/
}
@@ -553,7 +551,7 @@ static const GLubyte* get_string (GLcontext *ctx, GLenum name)
{
switch (name) {
case GL_RENDERER:
return (const GLubyte *)"Mesa DOS\0DJGPP port (c) Borca Daniel 31-mar-2002";
return (const GLubyte *)"Mesa DJGPP\0port (c) Borca Daniel 3-sep-2002";
default:
return NULL;
}
@@ -729,6 +727,12 @@ DMesaVisual DMesaCreateVisual (GLint width, GLint height, GLint colDepth,
DMesaVisual v;
GLint redBits, greenBits, blueBits, alphaBits;
int refresh;
char *var = getenv("DMESA_REFRESH");
if ((var == NULL) || ((refresh=atoi(var)) == 0)) {
refresh = 60;
}
if (!dbFlag) {
return NULL;
}
@@ -755,7 +759,7 @@ DMesaVisual DMesaCreateVisual (GLint width, GLint height, GLint colDepth,
return NULL;
}
if (vl_video_init(width, height, colDepth)!=0) {
if (vl_video_init(width, height, colDepth, refresh) != 0) {
return NULL;
}
@@ -788,7 +792,7 @@ DMesaVisual DMesaCreateVisual (GLint width, GLint height, GLint colDepth,
void DMesaDestroyVisual (DMesaVisual v)
{
vl_video_exit(!0);
vl_video_exit();
_mesa_destroy_visual(v->gl_visual);
free(v);
}
@@ -884,8 +888,8 @@ GLboolean DMesaViewport (DMesaBuffer b,
b->ypos = ypos;
b->width = width;
b->height = height;
b->bwidth = width * b->bypp;
b->len = b->bwidth * height;
b->stride = width * b->bypp;
b->bytes = b->stride * height;
return GL_TRUE;
}
}
@@ -923,5 +927,7 @@ GLboolean DMesaMakeCurrent (DMesaContext c, DMesaBuffer b)
void DMesaSwapBuffers (DMesaBuffer b)
{
/* copy/swap back buffer to front if applicable */
vl_flip(b->the_window, b->bwidth, b->height);
GET_CURRENT_CONTEXT(ctx);
_mesa_swapbuffers(ctx);
vl_flip(b->the_window, b->stride, b->height);
}

View File

@@ -23,7 +23,7 @@
*/
/*
* DOS/DJGPP device driver v1.0 for Mesa 4.0
* DOS/DJGPP device driver v1.1 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -37,6 +37,12 @@
#ifndef MAX
#define MAX(x, y) (((x)<(y))?(y):(x))
#endif
/* _create_linear_mapping:
* Maps a physical address range into linear memory.
*/

View File

@@ -23,7 +23,7 @@
*/
/*
* DOS/DJGPP device driver v1.0 for Mesa 4.0
* DOS/DJGPP device driver v1.1 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -34,14 +34,6 @@
#ifndef DPMIINT_H_included
#define DPMIINT_H_included
#ifndef NULL
#define NULL 0
#endif
#ifndef MAX
#define MAX(x, y) (((x)<(y))?(y):(x))
#endif
int _create_selector (int *segment, unsigned long base, int size);
void _remove_selector (int *segment);

View File

@@ -0,0 +1,397 @@
/*
* Mesa 3-D graphics library
* Version: 4.0
*
* Copyright (C) 1999 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.
*/
/*
* DOS/DJGPP device driver v1.1 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/
#include <dpmi.h>
#include <string.h>
#include <stubinfo.h>
#include <sys/exceptn.h>
#include <sys/segments.h>
#include <sys/farptr.h>
#include <sys/movedata.h>
#include "vesa.h"
#include "../dpmiint.h"
static vl_mode modes[64];
static word16 vesa_ver;
static int banked_selector, linear_selector;
static int oldmode = -1;
/*
* VESA info
*/
#define V_SIGN 0
#define V_MINOR 4
#define V_MAJOR 5
#define V_OEM_OFS 6
#define V_OEM_SEG 8
#define V_MODE_OFS 14
#define V_MODE_SEG 16
#define V_MEMORY 18
/*
* mode info
*/
#define M_ATTR 0
#define M_GRAN 4
#define M_SCANLEN 16
#define M_XRES 18
#define M_YRES 20
#define M_BPP 25
#define M_RED 31
#define M_GREEN 33
#define M_BLUE 35
#define M_PHYS_PTR 40
/*
* VESA 3.0 CRTC timings structure
*/
typedef struct CRTCInfoBlock {
unsigned short HorizontalTotal;
unsigned short HorizontalSyncStart;
unsigned short HorizontalSyncEnd;
unsigned short VerticalTotal;
unsigned short VerticalSyncStart;
unsigned short VerticalSyncEnd;
unsigned char Flags;
unsigned long PixelClock; /* units of Hz */
unsigned short RefreshRate; /* units of 0.01 Hz */
unsigned char reserved[40];
} __PACKED__ CRTCInfoBlock;
#define HNEG (1 << 2)
#define VNEG (1 << 3)
#define DOUBLESCAN (1 << 0)
/* vesa_init:
* Attempts to detect VESA, check video modes and create selectors.
* Returns 0 if error.
*/
static word16 vesa_init (void)
{
__dpmi_regs r;
word16 *p;
vl_mode *q;
char vesa_info[512], tmp[512];
int maxsize = 0;
word32 linearfb = 0;
if (vesa_ver) {
return vesa_ver;
}
_farpokel(_stubinfo->ds_selector, 0, 0x32454256);
r.x.ax = 0x4f00;
r.x.di = 0;
r.x.es = _stubinfo->ds_segment;
__dpmi_int(0x10, &r);
movedata(_stubinfo->ds_selector, 0, _my_ds(), (unsigned)vesa_info, 512);
if ((r.x.ax!=0x004f) || ((_32_ vesa_info[V_SIGN])!=0x41534556)) {
return 0;
}
p = (word16 *)(((_16_ vesa_info[V_MODE_SEG])<<4) + (_16_ vesa_info[V_MODE_OFS]));
q = modes;
do {
if ((q->mode=_farpeekw(__djgpp_dos_sel, (unsigned long)(p++)))==0xffff) {
break;
}
r.x.ax = 0x4f01;
r.x.cx = q->mode;
r.x.di = 512;
r.x.es = _stubinfo->ds_segment;
__dpmi_int(0x10, &r);
movedata(_stubinfo->ds_selector, 512, _my_ds(), (unsigned)tmp, 256);
switch (tmp[M_BPP]) {
case 16:
q->bpp = tmp[M_RED] + tmp[M_GREEN] + tmp[M_BLUE];
break;
case 15:
case 24:
case 32:
q->bpp = tmp[M_BPP];
break;
default:
q->bpp = 0;
}
if ((r.x.ax==0x004f) && ((tmp[M_ATTR]&0x11)==0x11) && q->bpp) {
q->xres = _16_ tmp[M_XRES];
q->yres = _16_ tmp[M_YRES];
q->scanlen = _16_ tmp[M_SCANLEN];
q->gran = (_16_ tmp[M_GRAN])<<10;
if (tmp[M_ATTR]&0x80) {
#if 0
*(q+1) = *q++;
#else
vl_mode *q1 = q + 1;
*q1 = *q++;
#endif
linearfb = _32_ tmp[M_PHYS_PTR];
q->mode |= 0x4000;
}
if (maxsize<(q->scanlen*q->yres)) {
maxsize = q->scanlen*q->yres;
}
q++;
}
} while (TRUE);
if (q==modes) {
return 0;
}
if (linearfb) {
maxsize = ((maxsize+0xfffUL)&~0xfffUL);
if (_create_selector(&linear_selector, linearfb, maxsize)) {
return 0;
}
}
if (_create_selector(&banked_selector, 0xa0000, modes[0].gran)) {
_remove_selector(&linear_selector);
return 0;
}
for (q=modes; q->mode!=0xffff; q++) {
q->sel = (q->mode&0x4000) ? linear_selector : banked_selector;
}
return (vesa_ver = _16_ vesa_info[V_MINOR]);
}
/* vesa_finit:
* Frees all resources allocated by VESA init code.
*/
static void vesa_finit (void)
{
if (vesa_ver) {
_remove_selector(&linear_selector);
_remove_selector(&banked_selector);
}
}
/* vesa_getmodes:
* Returns ptr to mode array.
*/
static vl_mode *vesa_getmodes (void)
{
return (vesa_init() == 0) ? NULL : modes;
}
/* _closest_pixclk:
* Uses VESA 3.0 function 0x4F0B to find the closest pixel clock to the
* requested value.
*/
static unsigned long _closest_pixclk (int mode_no, unsigned long vclk)
{
__dpmi_regs r;
r.x.ax = 0x4F0B;
r.h.bl = 0;
r.d.ecx = vclk;
r.x.dx = mode_no;
__dpmi_int(0x10, &r);
return (r.x.ax==0x004f) ? r.d.ecx : 0;
}
/* _crtc_timing:
* Calculates CRTC mode timings.
*/
static void _crtc_timing (CRTCInfoBlock *crtc, int xres, int yres, int xadjust, int yadjust)
{
int HTotal, VTotal;
int HDisp, VDisp;
int HSS, VSS;
int HSE, VSE;
int HSWidth, VSWidth;
int SS, SE;
int doublescan = FALSE;
if (yres < 400) {
doublescan = TRUE;
yres *= 2;
}
HDisp = xres;
HTotal = (int)(HDisp * 1.27) & ~0x7;
HSWidth = (int)((HTotal - HDisp) / 5) & ~0x7;
HSS = HDisp + 16;
HSE = HSS + HSWidth;
VDisp = yres;
VTotal = VDisp * 1.07;
VSWidth = (VTotal / 100) + 1;
VSS = VDisp + ((int)(VTotal - VDisp) / 5) + 1;
VSE = VSS + VSWidth;
SS = HSS + xadjust;
SE = HSE + xadjust;
if (xadjust < 0) {
if (SS < (HDisp + 8)) {
SS = HDisp + 8;
SE = SS + HSWidth;
}
} else {
if ((HTotal - 24) < SE) {
SE = HTotal - 24;
SS = SE - HSWidth;
}
}
HSS = SS;
HSE = SE;
SS = VSS + yadjust;
SE = VSE + yadjust;
if (yadjust < 0) {
if (SS < (VDisp + 3)) {
SS = VDisp + 3;
SE = SS + VSWidth;
}
} else {
if ((VTotal - 4) < SE) {
SE = VTotal - 4;
SS = SE - VSWidth;
}
}
VSS = SS;
VSE = SE;
crtc->HorizontalTotal = HTotal;
crtc->HorizontalSyncStart = HSS;
crtc->HorizontalSyncEnd = HSE;
crtc->VerticalTotal = VTotal;
crtc->VerticalSyncStart = VSS;
crtc->VerticalSyncEnd = VSE;
crtc->Flags = HNEG | VNEG;
if (doublescan)
crtc->Flags |= DOUBLESCAN;
}
/* vesa_entermode:
* Attempts to enter specified video mode.
*
* success: 0
* failure: !0
*/
static int vesa_entermode (vl_mode *p, int refresh)
{
__dpmi_regs r;
if (oldmode == -1) {
r.x.ax = 0x4f03;
__dpmi_int(0x10, &r);
oldmode = r.x.bx;
}
r.x.ax = 0x4f02;
r.x.bx = p->mode;
if ((vesa_ver>>8) >= 3) {
/* VESA 3.0 stuff for controlling the refresh rate */
CRTCInfoBlock crtc;
unsigned long vclk;
double f0;
_crtc_timing(&crtc, p->xres, p->yres, 0, 0);
vclk = (double)crtc.HorizontalTotal * crtc.VerticalTotal * refresh;
vclk = _closest_pixclk(p->mode, vclk);
if (vclk != 0) {
f0 = (double)vclk / (crtc.HorizontalTotal * crtc.VerticalTotal);
/*_current_refresh_rate = (int)(f0 + 0.5);*/
crtc.PixelClock = vclk;
crtc.RefreshRate = refresh * 100;
movedata(_my_ds(), (unsigned)&crtc, _stubinfo->ds_selector, 0, sizeof(crtc));
r.x.di = 0;
r.x.es = _stubinfo->ds_segment;
r.x.bx |= 0x0800;
}
}
__dpmi_int(0x10, &r);
return (r.x.ax != 0x004f);
}
/* vesa_restore:
* Restores to the mode prior to first call to vesa_entermode.
*/
static void vesa_restore (void)
{
__dpmi_regs r;
if (oldmode != -1) {
r.x.ax = 0x4f02;
r.x.bx = oldmode;
__dpmi_int(0x10, &r);
}
}
/*
* the driver
*/
vl_driver VESA = {
vesa_getmodes,
vesa_entermode,
vesa_restore,
vesa_finit
};

View File

@@ -0,0 +1,43 @@
/*
* Mesa 3-D graphics library
* Version: 4.0
*
* Copyright (C) 1999 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.
*/
/*
* DOS/DJGPP device driver v1.1 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/
#ifndef VESA_H_included
#define VESA_H_included
#include "../videoint.h"
extern vl_driver VESA;
#endif

View File

@@ -23,7 +23,7 @@
*/
/*
* DOS/DJGPP device driver v1.0 for Mesa 4.0
* DOS/DJGPP device driver v1.1 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -31,52 +31,29 @@
*/
#include <dpmi.h>
#include <stdlib.h>
#include <string.h>
#include <stubinfo.h>
#include <sys/exceptn.h>
#include <sys/segments.h>
#include <sys/farptr.h>
#include "video.h"
#include "dpmiint.h"
#include "videoint.h"
#include "vesa/vesa.h"
typedef unsigned char word8;
typedef unsigned short word16;
typedef unsigned long word32;
typedef struct vl_mode {
int mode;
int xres, yres;
int scanlen;
int bpp;
} vl_mode;
#define _16_ *(word16 *)&
#define _32_ *(word32 *)&
static int init;
static vl_mode modes[64];
static vl_driver *drv = &VESA;
/* card specific: valid forever */
static word16 vesa_ver;
static word32 hw_granularity, hw_linearfb;
word32 vl_hw_granularity;
static unsigned int gran_shift, gran_mask;
/* based upon mode specific data: valid entire session */
static int video_selector, banked_selector, linear_selector;
int vl_video_selector;
static int video_scanlen, video_bypp;
/* valid until next buffer */
static int current_offset, current_delta, current_width;
int vl_current_offset, vl_current_delta;
static int current_width;
/* lookup table for scaling 5 bit colors up to 8 bits */
static int _rgb_scale_5[32] =
{
static int _rgb_scale_5[32] = {
0, 8, 16, 24, 32, 41, 49, 57,
65, 74, 82, 90, 98, 106, 115, 123,
131, 139, 148, 156, 164, 172, 180, 189,
@@ -84,8 +61,7 @@ static int _rgb_scale_5[32] =
};
/* lookup table for scaling 6 bit colors up to 8 bits */
static int _rgb_scale_6[64] =
{
static int _rgb_scale_6[64] = {
0, 4, 8, 12, 16, 20, 24, 28,
32, 36, 40, 44, 48, 52, 56, 60,
64, 68, 72, 76, 80, 85, 89, 93,
@@ -98,69 +74,17 @@ static int _rgb_scale_6[64] =
/*
* virtual clearing
*/
void (*vl_clear) (void *buffer, int len, int color);
#define v_clear15 v_clear16
extern void v_clear16 (void *buffer, int len, int color);
extern void v_clear32 (void *buffer, int len, int color);
__asm__("\n\
.text \n\
.balign 4 \n\
.global _v_clear16 \n\
_v_clear16: \n\
movl 12(%esp), %eax \n\
pushw %ax \n\
pushw %ax \n\
popl %eax \n\
jmp _v_clear_common \n\
.balign 4 \n\
.global _v_clear32 \n\
_v_clear32: \n\
movl 12(%esp), %eax \n\
.balign 4 \n\
_v_clear_common: \n\
movl 8(%esp), %ecx \n\
movl 4(%esp), %edx \n\
shrl $2, %ecx \n\
0: \n\
.balign 4 \n\
movl %eax, (%edx) \n\
addl $4, %edx \n\
decl %ecx \n\
jnz 0b \n\
ret");
extern void v_clear24 (void *buffer, int len, int color);
__asm__("\n\
.text \n\
.balign 4 \n\
.global _v_clear24 \n\
_v_clear24: \n\
movl 8(%esp), %edx \n\
movl $0xaaaaaaab, %eax \n\
mull %edx \n\
movl 12(%esp), %eax \n\
movl %edx, %ecx \n\
movl 4(%esp), %edx \n\
pushl %ebx \n\
shrl %ecx \n\
movb 18(%esp), %bl \n\
.balign 4 \n\
0: \n\
movw %ax, (%edx) \n\
movb %bl, 2(%edx) \n\
addl $3, %edx \n\
decl %ecx \n\
jnz 0b \n\
popl %ebx \n\
ret");
void (*vl_clear) (void *buffer, int bytes, int color);
void (*vl_flip) (void *buffer, int stride, int height);
int (*vl_mixrgba) (const unsigned char rgba[]);
int (*vl_mixrgb) (const unsigned char rgb[]);
void (*vl_putpixel) (void *buffer, int offset, int color);
void (*vl_getrgba) (void *buffer, int offset, unsigned char rgba[4]);
/*
* virtual rectangle clearing
/* vl_rect:
* Clears a rectange with specified color.
*/
void vl_rect (void *buffer, int x, int y, int width, int height, int color)
{
@@ -177,114 +101,9 @@ void vl_rect (void *buffer, int x, int y, int width, int height, int color)
/*
* virtual dumping:
/* vl_mixrgba*:
* Color composition (w/ ALPHA).
*/
void (*vl_flip) (void *buffer, int width, int height);
extern void b_dump_virtual (void *buffer, int width, int height);
__asm__("\n\
.text \n\
.balign 4 \n\
.global _b_dump_virtual \n\
_b_dump_virtual: \n\
pushl %ebx \n\
pushl %esi \n\
pushl %edi \n\
pushl %ebp \n\
movl _video_selector, %fs \n\
movl 4*4+4+0(%esp), %esi \n\
movl _hw_granularity, %ebp \n\
xorl %edx, %edx \n\
movl _current_offset, %eax \n\
divl %ebp \n\
movl %edx, %edi \n\
pushl %eax \n\
movl %eax, %edx \n\
xorl %ebx, %ebx \n\
movw $0x4f05, %ax \n\
int $0x10 \n\
movl _current_delta, %ebx \n\
movl 5*4+4+4(%esp), %ecx \n\
movl 5*4+4+8(%esp), %edx \n\
shrl $2, %ecx \n\
.balign 4 \n\
0: \n\
pushl %ecx \n\
.balign 4 \n\
1: \n\
cmpl %ebp, %edi \n\
jb 2f \n\
pushl %ebx \n\
pushl %edx \n\
incl 12(%esp) \n\
movw $0x4f05, %ax \n\
movl 12(%esp), %edx \n\
xorl %ebx, %ebx \n\
int $0x10 \n\
popl %edx \n\
popl %ebx \n\
subl %ebp, %edi \n\
2: \n\
movl (%esi), %eax \n\
addl $4, %esi \n\
movl %eax, %fs:(%edi) \n\
addl $4, %edi \n\
decl %ecx \n\
jnz 1b \n\
popl %ecx \n\
addl %ebx, %edi \n\
decl %edx \n\
jnz 0b \n\
popl %eax \n\
popl %ebp \n\
popl %edi \n\
popl %esi \n\
popl %ebx \n\
ret");
extern void l_dump_virtual (void *buffer, int width, int height);
__asm__("\n\
.text \n\
.balign 4 \n\
.global _l_dump_virtual \n\
_l_dump_virtual: \n\
pushl %ebx \n\
pushl %esi \n\
pushl %edi \n\
movl _video_selector, %fs \n\
movl 3*4+4+0(%esp), %esi \n\
movl _current_offset, %edi \n\
movl 3*4+4+4(%esp), %ecx \n\
movl 3*4+4+8(%esp), %edx \n\
movl _current_delta, %ebx \n\
shrl $2, %ecx \n\
.balign 4 \n\
0: \n\
pushl %ecx \n\
.balign 4 \n\
1: \n\
movl (%esi), %eax \n\
addl $4, %esi \n\
movl %eax, %fs:(%edi) \n\
addl $4, %edi \n\
decl %ecx \n\
jnz 1b \n\
popl %ecx \n\
addl %ebx, %edi \n\
decl %edx \n\
jnz 0b \n\
popl %edi \n\
popl %esi \n\
popl %ebx \n\
ret");
/*
* mix RGBA components
*/
int (*vl_mixrgba) (const unsigned char rgba[]);
#define vl_mixrgba15 vl_mixrgb15
#define vl_mixrgba16 vl_mixrgb16
#define vl_mixrgba24 vl_mixrgb24
@@ -295,11 +114,9 @@ static int vl_mixrgba32 (const unsigned char rgba[])
/*
* mix RGB components
/* vl_mixrgb*:
* Color composition (w/o ALPHA).
*/
int (*vl_mixrgb) (const unsigned char rgb[]);
static int vl_mixrgb15 (const unsigned char rgb[])
{
return ((rgb[0]>>3)<<10)|((rgb[1]>>3)<<5)|(rgb[2]>>3);
@@ -316,60 +133,8 @@ static int vl_mixrgb32 (const unsigned char rgb[])
/*
* vl_putpixel*
*/
void (*vl_putpixel) (void *buffer, int offset, int color);
#define v_putpixel15 v_putpixel16
extern void v_putpixel16 (void *buffer, int offset, int color);
__asm__("\n\
.text \n\
.balign 4 \n\
.global _v_putpixel16 \n\
_v_putpixel16: \n\
movl 8(%esp), %edx \n\
shll %edx \n\
movl 12(%esp), %eax \n\
addl 4(%esp), %edx \n\
movw %ax, (%edx) \n\
ret");
extern void v_putpixel24 (void *buffer, int offset, int color);
__asm__("\n\
.text \n\
.balign 4 \n\
.global _v_putpixel24 \n\
_v_putpixel24: \n\
movl 8(%esp), %edx \n\
leal (%edx, %edx, 2), %edx \n\
movl 12(%esp), %eax \n\
addl 4(%esp), %edx \n\
movw %ax, (%edx) \n\
shrl $16, %eax \n\
movb %al, 2(%edx) \n\
ret");
extern void v_putpixel32 (void *buffer, int offset, int color);
__asm__("\n\
.text \n\
.balign 4 \n\
.global _v_putpixel32 \n\
_v_putpixel32: \n\
movl 8(%esp), %edx \n\
shll $2, %edx \n\
movl 12(%esp), %eax \n\
addl 4(%esp), %edx \n\
movl %eax, (%edx) \n\
ret");
/*
* get pixel and decompose R, G, B, A
*/
void (*vl_getrgba) (void *buffer, int offset, unsigned char rgba[4]);
/*
* v_getrgba*
/* v_getrgba*:
* Color decomposition.
*/
static void v_getrgba15 (void *buffer, int offset, unsigned char rgba[4])
{
@@ -406,8 +171,8 @@ static void v_getrgba32 (void *buffer, int offset, unsigned char rgba[4])
/*
* sync buffer with video hardware
/* vl_sync_buffer:
* Syncs buffer with video hardware. Returns NULL in case of failure.
*/
void *vl_sync_buffer (void *buffer, int x, int y, int width, int height)
{
@@ -417,9 +182,9 @@ void *vl_sync_buffer (void *buffer, int x, int y, int width, int height)
return NULL;
} else {
if ((newbuf=realloc(buffer, width*height*video_bypp))!=NULL) {
current_offset = video_scanlen * y + video_bypp * x;
vl_current_offset = video_scanlen * y + video_bypp * x;
current_width = width;
current_delta = video_scanlen - video_bypp * width;
vl_current_delta = video_scanlen - video_bypp * width;
}
return newbuf;
}
@@ -427,102 +192,22 @@ void *vl_sync_buffer (void *buffer, int x, int y, int width, int height)
/*
* attempts to detect VESA and video modes
*/
static word16 vl_vesa_init (void)
{
__dpmi_regs r;
unsigned short *p;
vl_mode *q;
char vesa_info[512], tmp[512];
int maxsize = 0;
_farpokel(_stubinfo->ds_selector, 0, 0x32454256);
r.x.ax = 0x4f00;
r.x.di = 0;
r.x.es = _stubinfo->ds_segment;
__dpmi_int(0x10, &r);
if (r.x.ax==0x004f) {
movedata(_stubinfo->ds_selector, 0, _my_ds(), (unsigned)vesa_info, 512);
if ((_32_ vesa_info[0])==0x41534556) {
p = (unsigned short *)(((_16_ vesa_info[0x10])<<4) + (_16_ vesa_info[0x0e]));
q = modes;
do {
if ((q->mode=_farpeekw(__djgpp_dos_sel, (unsigned long)(p++)))==0xffff) {
break;
}
r.x.ax = 0x4f01;
r.x.cx = q->mode;
r.x.di = 512;
r.x.es = _stubinfo->ds_segment;
__dpmi_int(0x10, &r);
movedata(_stubinfo->ds_selector, 512, _my_ds(), (unsigned)tmp, 256);
switch (tmp[0x19]) {
case 16:
q->bpp = tmp[0x1f] + tmp[0x21] + tmp[0x23];
break;
case 15:
case 24:
case 32:
q->bpp = tmp[0x19];
break;
default:
q->bpp = 0;
}
if ((r.x.ax==0x004f)&&((tmp[0]&0x11)==0x11)&&q->bpp) {
q->xres = _16_ tmp[0x12];
q->yres = _16_ tmp[0x14];
q->scanlen = _16_ tmp[0x10];
hw_granularity = (_16_ tmp[4])<<10;
if (tmp[0]&0x80) {
*(q+1) = *q++;
hw_linearfb = _32_ tmp[0x28];
q->mode |= 0x4000;
}
if (maxsize<(q->scanlen*q->yres)) {
maxsize = q->scanlen*q->yres;
}
q++;
}
} while (!0);
if (hw_linearfb) {
maxsize = ((maxsize+0xfffUL)&~0xfffUL);
if (_create_selector(&linear_selector, hw_linearfb, maxsize)) {
return 0;
}
}
if (_create_selector(&banked_selector, 0xa0000, hw_granularity)) {
_remove_selector(&linear_selector);
return 0;
}
return _16_ vesa_info[4];
}
}
return 0;
}
/*
* setup mode
/* vl_setup_mode:
*
* success: 0
* failure: -1
*/
static int vl_setup_mode (vl_mode *p)
{
if (p->mode&0x4000) {
video_selector = linear_selector;
vl_flip = l_dump_virtual;
} else {
{ int n; for (gran_shift=0, n=hw_granularity; n; gran_shift++, n>>=1) ; }
{ int n; for (gran_shift=0, n=p->gran; n; gran_shift++, n>>=1) ; }
gran_mask = (1<<(--gran_shift)) - 1;
if (hw_granularity!=(gran_mask+1)) {
if ((unsigned)p->gran != (gran_mask+1)) {
return -1;
}
video_selector = banked_selector;
vl_hw_granularity = p->gran;
vl_flip = b_dump_virtual;
}
@@ -554,56 +239,44 @@ static int vl_setup_mode (vl_mode *p)
video_bypp = (p->bpp+7)/8;
video_scanlen = p->scanlen;
vl_video_selector = p->sel;
return 0;
}
/*
* shutdown the video engine
/* vl_video_exit:
* Shutdown the video engine.
* Restores to the mode prior to first call to `vl_video_init'.
*/
void vl_video_exit (int textmode)
void vl_video_exit (void)
{
if (init) {
if (textmode) {
__asm__("movw $0x3, %%ax; int $0x10":::"%eax");
}
_remove_selector(&linear_selector);
_remove_selector(&banked_selector);
init = !init;
}
drv->restore();
drv->finit();
}
/*
* initialize video engine
/* vl_video_init:
* Enter mode.
*
* success: 0
* failure: -1
* success: 0
* failure: -1
*/
int vl_video_init (int width, int height, int bpp)
int vl_video_init (int width, int height, int bpp, int refresh)
{
vl_mode *p, *q;
unsigned int min;
/* check for prior initialization */
if (init) {
return 0;
}
/* initialize hardware */
if (!(vesa_ver=vl_vesa_init())) {
if ((q=drv->getmodes()) == NULL) {
return -1;
}
init = !init;
/* search for a mode that fits our request */
for (min=-1, p=NULL, q=modes; q->mode!=0xffff; q++) {
if ((q->xres>=width)&&(q->yres>=height)&&(q->bpp==bpp)) {
for (min=-1, p=NULL; q->mode!=0xffff; q++) {
if ((q->xres>=width) && (q->yres>=height) && (q->bpp==bpp)) {
if (min>=(unsigned)(q->xres*q->yres)) {
min = q->xres*q->yres;
p = q;
@@ -611,13 +284,11 @@ int vl_video_init (int width, int height, int bpp)
}
}
if (p) {
vl_setup_mode(p);
__asm__("movw $0x4f02, %%ax; int $0x10"::"b"(p->mode):"%eax");
/* check, setup and enter mode */
if ((p!=NULL) && (vl_setup_mode(p) == 0) && (drv->entermode(p, refresh) == 0)) {
return 0;
} else {
/* no suitable mode found, abort */
vl_video_exit(0);
return -1;
}
/* abort */
return -1;
}

View File

@@ -23,7 +23,7 @@
*/
/*
* DOS/DJGPP device driver v1.0 for Mesa 4.0
* DOS/DJGPP device driver v1.1 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
@@ -34,15 +34,15 @@
#ifndef VIDEO_H_included
#define VIDEO_H_included
int vl_video_init (int width, int height, int bpp);
void vl_video_exit (int textmode);
int vl_video_init (int width, int height, int bpp, int refresh);
void vl_video_exit (void);
void *vl_sync_buffer (void *buffer, int x, int y, int width, int height);
extern void (*vl_clear) (void *buffer, int len, int color);
extern void (*vl_clear) (void *buffer, int bytes, int color);
void vl_rect (void *buffer, int x, int y, int width, int height, int color);
void (*vl_flip) (void *buffer, int width, int height);
void (*vl_flip) (void *buffer, int stride, int height);
extern int (*vl_mixrgba) (const unsigned char rgba[]);
extern int (*vl_mixrgb) (const unsigned char rgb[]);

View File

@@ -0,0 +1,99 @@
/*
* Mesa 3-D graphics library
* Version: 4.0
*
* Copyright (C) 1999 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.
*/
/*
* DOS/DJGPP device driver v1.1 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/
#ifndef VIDEOINT_H_included
#define VIDEOINT_H_included
/*
* general purpose defines, etc.
*/
#ifndef FALSE
#define FALSE 0
#define TRUE !FALSE
#endif
#define __PACKED__ __attribute__((packed))
typedef unsigned char word8;
typedef unsigned short word16;
typedef unsigned long word32;
#define _16_ *(word16 *)&
#define _32_ *(word32 *)&
/*
* video mode structure
*/
typedef struct vl_mode {
int mode;
int xres, yres;
int scanlen;
int bpp;
int sel;
int gran;
} vl_mode;
/*
* video driver structure
*/
typedef struct {
vl_mode *(*getmodes) (void);
int (*entermode) (vl_mode *p, int refresh);
void (*restore) (void);
void (*finit) (void);
} vl_driver;
/*
* asm routines to deal with virtual buffering
*/
#define v_clear15 v_clear16
extern void v_clear16 (void *buffer, int bytes, int color);
extern void v_clear32 (void *buffer, int bytes, int color);
extern void v_clear24 (void *buffer, int bytes, int color);
extern void b_dump_virtual (void *buffer, int stride, int height);
extern void l_dump_virtual (void *buffer, int stride, int height);
#define v_putpixel15 v_putpixel16
extern void v_putpixel16 (void *buffer, int offset, int color);
extern void v_putpixel24 (void *buffer, int offset, int color);
extern void v_putpixel32 (void *buffer, int offset, int color);
#endif

View File

@@ -0,0 +1,237 @@
/*
* Mesa 3-D graphics library
* Version: 4.0
*
* Copyright (C) 1999 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.
*/
/*
* DOS/DJGPP device driver v1.1 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/
.file "virtual.S"
/*
* extern word32 vl_hw_granularity;
* extern int vl_video_selector;
* extern int vl_current_offset, vl_current_delta;
*/
.text
/*
* void v_clear16 (void *buffer, int bytes, int color);
*/
.balign 4
.global _v_clear16
_v_clear16:
movl 12(%esp), %eax
pushw %ax
pushw %ax
popl %eax
jmp _v_clear_common
/*
* void v_clear32 (void *buffer, int bytes, int color);
*/
.balign 4
.global _v_clear32
_v_clear32:
movl 12(%esp), %eax
.balign 4
_v_clear_common:
movl 8(%esp), %ecx
movl 4(%esp), %edx
shrl $2, %ecx
0:
.balign 4
movl %eax, (%edx)
addl $4, %edx
decl %ecx
jnz 0b
ret
/*
* void v_clear24 (void *buffer, int bytes, int color);
*/
.balign 4
.global _v_clear24
_v_clear24:
movl 8(%esp), %edx
movl $0xaaaaaaab, %eax
mull %edx
movl 12(%esp), %eax
movl %edx, %ecx
movl 4(%esp), %edx
pushl %ebx
shrl %ecx
movb 18(%esp), %bl
.balign 4
0:
movw %ax, (%edx)
movb %bl, 2(%edx)
addl $3, %edx
decl %ecx
jnz 0b
popl %ebx
ret
/*
* void b_dump_virtual (void *buffer, int stride, int height);
*/
.balign 4
.global _b_dump_virtual
_b_dump_virtual:
pushl %ebx
pushl %esi
pushl %edi
pushl %ebp
movl _vl_video_selector, %fs
movl 4*4+4+0(%esp), %esi
movl _vl_hw_granularity, %ebp
xorl %edx, %edx
movl _vl_current_offset, %eax
divl %ebp
movl %edx, %edi
pushl %eax
movl %eax, %edx
xorl %ebx, %ebx
movw $0x4f05, %ax
int $0x10
movl _vl_current_delta, %ebx
movl 5*4+4+4(%esp), %ecx
movl 5*4+4+8(%esp), %edx
shrl $2, %ecx
.balign 4
0:
pushl %ecx
.balign 4
1:
cmpl %ebp, %edi
jb 2f
pushl %ebx
pushl %edx
incl 12(%esp)
movw $0x4f05, %ax
movl 12(%esp), %edx
xorl %ebx, %ebx
int $0x10
popl %edx
popl %ebx
subl %ebp, %edi
2:
movl (%esi), %eax
addl $4, %esi
movl %eax, %fs:(%edi)
addl $4, %edi
decl %ecx
jnz 1b
popl %ecx
addl %ebx, %edi
decl %edx
jnz 0b
popl %eax
popl %ebp
popl %edi
popl %esi
popl %ebx
ret
/*
* void l_dump_virtual (void *buffer, int stride, int height);
*/
.balign 4
.global _l_dump_virtual
_l_dump_virtual:
pushl %ebx
pushl %esi
pushl %edi
movl _vl_video_selector, %fs
movl 3*4+4+0(%esp), %esi
movl _vl_current_offset, %edi
movl 3*4+4+4(%esp), %ecx
movl 3*4+4+8(%esp), %edx
movl _vl_current_delta, %ebx
shrl $2, %ecx
.balign 4
0:
pushl %ecx
.balign 4
1:
movl (%esi), %eax
addl $4, %esi
movl %eax, %fs:(%edi)
addl $4, %edi
decl %ecx
jnz 1b
popl %ecx
addl %ebx, %edi
decl %edx
jnz 0b
popl %edi
popl %esi
popl %ebx
ret
/*
* void v_putpixel16 (void *buffer, int offset, int color);
*/
.balign 4
.global _v_putpixel16
_v_putpixel16:
movl 8(%esp), %edx
shll %edx
movl 12(%esp), %eax
addl 4(%esp), %edx
movw %ax, (%edx)
ret
/*
* void v_putpixel24 (void *buffer, int offset, int color);
*/
.balign 4
.global _v_putpixel24
_v_putpixel24:
movl 8(%esp), %edx
leal (%edx, %edx, 2), %edx
movl 12(%esp), %eax
addl 4(%esp), %edx
movw %ax, (%edx)
shrl $16, %eax
movb %al, 2(%edx)
ret
/*
* void v_putpixel32 (void *buffer, int offset, int color);
*/
.balign 4
.global _v_putpixel32
_v_putpixel32:
movl 8(%esp), %edx
shll $2, %edx
movl 12(%esp), %eax
addl 4(%esp), %edx
movl %eax, (%edx)
ret

View File

@@ -1,4 +1,4 @@
/* $Id: fxtris.c,v 1.17.2.1 2001/11/06 16:00:58 brianp Exp $ */
/* $Id: fxtris.c,v 1.17.2.2 2002/08/21 02:56:31 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -331,7 +331,7 @@ do { \
do { \
color[idx][0] = v[idx]->r; \
color[idx][1] = v[idx]->g; \
color[idx][1] = v[idx]->b; \
color[idx][2] = v[idx]->b; \
color[idx][3] = v[idx]->a; \
} while (0)
@@ -630,6 +630,7 @@ static void fxFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
GrVertex *vertptr = fxMesa->verts;
const GrVertex *start = VERT(elts[0]);
int i;
for (i = 2 ; i < n ; i++) {
grDrawTriangle( start, VERT(elts[i-1]), VERT(elts[i]) );
}

View File

@@ -1,4 +1,4 @@
/* $Id: fxvb.c,v 1.11.2.1 2002/06/06 16:15:13 brianp Exp $ */
/* $Id: fxvb.c,v 1.11.2.3 2002/09/17 01:05:05 brianp Exp $ */
/*
* Mesa 3-D graphics library

View File

@@ -1,4 +1,4 @@
/* $Id: fxwgl.c,v 1.14 2001/09/23 16:50:01 brianp Exp $ */
/* $Id: fxwgl.c,v 1.14.2.1 2002/09/04 14:15:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -45,6 +45,7 @@ extern "C"
#include "fxdrv.h"
#include <windows.h>
#include "GL/gl.h"
#include "glapi.h"
#ifdef __cplusplus
}
@@ -55,12 +56,6 @@ extern "C"
#define MAX_MESA_ATTRS 20
struct __extensions__
{
PROC proc;
char *name;
};
struct __pixelformat__
{
PIXELFORMATDESCRIPTOR pfd;
@@ -69,78 +64,6 @@ struct __pixelformat__
WINGDIAPI void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *);
static struct __extensions__ ext[] = {
#ifdef GL_EXT_polygon_offset
{(PROC) glPolygonOffsetEXT, "glPolygonOffsetEXT"},
#endif
{(PROC) glBlendEquationEXT, "glBlendEquationEXT"},
{(PROC) glBlendColorEXT, "glBlendColorExt"},
{(PROC) glVertexPointerEXT, "glVertexPointerEXT"},
{(PROC) glNormalPointerEXT, "glNormalPointerEXT"},
{(PROC) glColorPointerEXT, "glColorPointerEXT"},
{(PROC) glIndexPointerEXT, "glIndexPointerEXT"},
{(PROC) glTexCoordPointerEXT, "glTexCoordPointer"},
{(PROC) glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT"},
{(PROC) glGetPointervEXT, "glGetPointervEXT"},
{(PROC) glArrayElementEXT, "glArrayElementEXT"},
{(PROC) glDrawArraysEXT, "glDrawArrayEXT"},
{(PROC) glAreTexturesResidentEXT, "glAreTexturesResidentEXT"},
{(PROC) glBindTextureEXT, "glBindTextureEXT"},
{(PROC) glDeleteTexturesEXT, "glDeleteTexturesEXT"},
{(PROC) glGenTexturesEXT, "glGenTexturesEXT"},
{(PROC) glIsTextureEXT, "glIsTextureEXT"},
{(PROC) glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT"},
{(PROC) glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT"},
{(PROC) glTexImage3DEXT, "glTexImage3DEXT"},
{(PROC) glTexSubImage3DEXT, "glTexSubImage3DEXT"},
{(PROC) gl3DfxSetPaletteEXT, "3DFX_set_global_palette"},
{(PROC) glColorTableEXT, "glColorTableEXT"},
{(PROC) glColorSubTableEXT, "glColorSubTableEXT"},
{(PROC) glGetColorTableEXT, "glGetColorTableEXT"},
{(PROC) glGetColorTableParameterfvEXT, "glGetColorTableParameterfvEXT"},
{(PROC) glGetColorTableParameterivEXT, "glGetColorTableParameterivEXT"},
{(PROC) glPointParameterfEXT, "glPointParameterfEXT"},
{(PROC) glPointParameterfvEXT, "glPointParameterfvEXT"},
{(PROC) glBlendFuncSeparateINGR, "glBlendFuncSeparateINGR"},
{(PROC) glActiveTextureARB, "glActiveTextureARB"},
{(PROC) glClientActiveTextureARB, "glClientActiveTextureARB"},
{(PROC) glMultiTexCoord1dARB, "glMultiTexCoord1dARB"},
{(PROC) glMultiTexCoord1dvARB, "glMultiTexCoord1dvARB"},
{(PROC) glMultiTexCoord1fARB, "glMultiTexCoord1fARB"},
{(PROC) glMultiTexCoord1fvARB, "glMultiTexCoord1fvARB"},
{(PROC) glMultiTexCoord1iARB, "glMultiTexCoord1iARB"},
{(PROC) glMultiTexCoord1ivARB, "glMultiTexCoord1ivARB"},
{(PROC) glMultiTexCoord1sARB, "glMultiTexCoord1sARB"},
{(PROC) glMultiTexCoord1svARB, "glMultiTexCoord1svARB"},
{(PROC) glMultiTexCoord2dARB, "glMultiTexCoord2dARB"},
{(PROC) glMultiTexCoord2dvARB, "glMultiTexCoord2dvARB"},
{(PROC) glMultiTexCoord2fARB, "glMultiTexCoord2fARB"},
{(PROC) glMultiTexCoord2fvARB, "glMultiTexCoord2fvARB"},
{(PROC) glMultiTexCoord2iARB, "glMultiTexCoord2iARB"},
{(PROC) glMultiTexCoord2ivARB, "glMultiTexCoord2ivARB"},
{(PROC) glMultiTexCoord2sARB, "glMultiTexCoord2sARB"},
{(PROC) glMultiTexCoord2svARB, "glMultiTexCoord2svARB"},
{(PROC) glMultiTexCoord3dARB, "glMultiTexCoord3dARB"},
{(PROC) glMultiTexCoord3dvARB, "glMultiTexCoord3dvARB"},
{(PROC) glMultiTexCoord3fARB, "glMultiTexCoord3fARB"},
{(PROC) glMultiTexCoord3fvARB, "glMultiTexCoord3fvARB"},
{(PROC) glMultiTexCoord3iARB, "glMultiTexCoord3iARB"},
{(PROC) glMultiTexCoord3ivARB, "glMultiTexCoord3ivARB"},
{(PROC) glMultiTexCoord3sARB, "glMultiTexCoord3sARB"},
{(PROC) glMultiTexCoord3svARB, "glMultiTexCoord3svARB"},
{(PROC) glMultiTexCoord4dARB, "glMultiTexCoord4dARB"},
{(PROC) glMultiTexCoord4dvARB, "glMultiTexCoord4dvARB"},
{(PROC) glMultiTexCoord4fARB, "glMultiTexCoord4fARB"},
{(PROC) glMultiTexCoord4fvARB, "glMultiTexCoord4fvARB"},
{(PROC) glMultiTexCoord4iARB, "glMultiTexCoord4iARB"},
{(PROC) glMultiTexCoord4ivARB, "glMultiTexCoord4ivARB"},
{(PROC) glMultiTexCoord4sARB, "glMultiTexCoord4sARB"},
{(PROC) glMultiTexCoord4svARB, "glMultiTexCoord4svARB"},
{(PROC) glLockArraysEXT, "glLockArraysEXT"},
{(PROC) glUnlockArraysEXT, "glUnlockArraysEXT"}
};
static int qt_ext = sizeof(ext) / sizeof(ext[0]);
struct __pixelformat__ pix[] = {
@@ -509,20 +432,12 @@ wglGetCurrentDC(VOID)
PROC GLAPIENTRY
wglGetProcAddress(LPCSTR lpszProc)
{
int i;
PROC p = (PROC) _glapi_get_proc_address((const char *) lpszProc);
if (p)
return p;
/*fprintf(stderr,"fxMesa: looking for extension %s\n",lpszProc);
fflush(stderr); */
for (i = 0; i < qt_ext; i++)
if (!strcmp(lpszProc, ext[i].name)) {
/*fprintf(stderr,"fxMesa: found extension %s\n",lpszProc);
fflush(stderr); */
return (ext[i].proc);
}
SetLastError(0);
return (NULL);
return(NULL);
}
BOOL GLAPIENTRY

View File

@@ -1,4 +1,4 @@
/* $Id: osmesa.c,v 1.71.2.8 2002/06/25 15:23:51 brianp Exp $ */
/* $Id: osmesa.c,v 1.71.2.9 2002/06/30 16:07:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -486,6 +486,10 @@ OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type,
_mesa_ResizeBuffersMESA();
}
/* Added by Gerk Huisma: */
_tnl_MakeCurrent( &ctx->gl_ctx, ctx->gl_ctx.DrawBuffer,
ctx->gl_ctx.ReadBuffer );
return GL_TRUE;
}
@@ -631,6 +635,15 @@ OSMesaGetColorBuffer( OSMesaContext c, GLint *width,
* Useful macros:
*/
#if CHAN_TYPE == GL_FLOAT
#define PACK_RGBA(DST, R, G, B, A) \
do { \
(DST)[0] = (R < 0.0f) ? 0.0f : ((R > 1.0f) ? 1.0f : R); \
(DST)[1] = (G < 0.0f) ? 0.0f : ((G > 1.0f) ? 1.0f : G); \
(DST)[2] = (B < 0.0f) ? 0.0f : ((B > 1.0f) ? 1.0f : B); \
(DST)[3] = (A < 0.0f) ? 0.0f : ((A > 1.0f) ? 1.0f : A); \
} while (0)
#else
#define PACK_RGBA(DST, R, G, B, A) \
do { \
(DST)[osmesa->rInd] = R; \
@@ -638,6 +651,7 @@ do { \
(DST)[osmesa->bInd] = B; \
(DST)[osmesa->aInd] = A; \
} while (0)
#endif
#define PACK_RGB(DST, R, G, B) \
do { \
@@ -880,7 +894,7 @@ static void clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
static void buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height )
{
#ifdef WIN32
/* Hack to get around problems with exporting glapi_Context from MesaGL
/* Hack to get around problems with exporting glapi_Context from Mesa
and importing into OSMesa. */
GLcontext *ctx = (GLcontext *) _glapi_get_context();
#else

View File

@@ -1,4 +1,4 @@
/* $Id: wgl.c,v 1.9.2.1 2002/04/23 18:24:41 kschultz Exp $ */
/* $Id: wgl.c,v 1.9.2.2 2002/09/04 14:15:27 brianp Exp $ */
/*
* This library is free software; you can redistribute it and/or
@@ -44,60 +44,16 @@ extern "C" {
#include "wmesadef.h"
#include "GL/wmesa.h"
#include "mtypes.h"
#include "glapi.h"
#define MAX_MESA_ATTRS 20
struct __extensions__
{
PROC proc;
char *name;
};
struct __pixelformat__
{
PIXELFORMATDESCRIPTOR pfd;
GLboolean doubleBuffered;
};
struct __extensions__ ext[] = {
#ifdef GL_EXT_polygon_offset
{ (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" },
#endif
{ (PROC)glBlendEquationEXT, "glBlendEquationEXT" },
{ (PROC)glBlendColorEXT, "glBlendColorExt" },
{ (PROC)glVertexPointerEXT, "glVertexPointerEXT" },
{ (PROC)glNormalPointerEXT, "glNormalPointerEXT" },
{ (PROC)glColorPointerEXT, "glColorPointerEXT" },
{ (PROC)glIndexPointerEXT, "glIndexPointerEXT" },
{ (PROC)glTexCoordPointerEXT, "glTexCoordPointer" },
{ (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" },
{ (PROC)glGetPointervEXT, "glGetPointervEXT" },
{ (PROC)glArrayElementEXT, "glArrayElementEXT" },
{ (PROC)glDrawArraysEXT, "glDrawArrayEXT" },
{ (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" },
{ (PROC)glBindTextureEXT, "glBindTextureEXT" },
{ (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" },
{ (PROC)glGenTexturesEXT, "glGenTexturesEXT" },
{ (PROC)glIsTextureEXT, "glIsTextureEXT" },
{ (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" },
{ (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" },
{ (PROC)glTexImage3DEXT, "glTexImage3DEXT" },
{ (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" },
{ (PROC)glColorTableEXT, "glColorTableEXT" },
{ (PROC)glColorSubTableEXT, "glColorSubTableEXT" },
{ (PROC)glGetColorTableEXT, "glGetColorTableEXT" },
{ (PROC)glGetColorTableParameterfvEXT, "glGetColorTableParameterfvEXT" },
{ (PROC)glGetColorTableParameterivEXT, "glGetColorTableParameterivEXT" },
{ (PROC)glPointParameterfEXT, "glPointParameterfEXT" },
{ (PROC)glPointParameterfvEXT, "glPointParameterfvEXT" },
{ (PROC)glBlendFuncSeparateEXT, "glBlendFuncSeparateEXT" },
{ (PROC)glLockArraysEXT, "glLockArraysEXT" },
{ (PROC)glUnlockArraysEXT, "glUnlockArraysEXT" }
};
int qt_ext = sizeof(ext) / sizeof(ext[0]);
struct __pixelformat__ pix[] =
{
/* Double Buffer, alpha */
@@ -134,7 +90,7 @@ struct __pixelformat__ pix[] =
},
};
int qt_pix = sizeof(pix) / sizeof(pix[0]);
int qt_pix = sizeof(pix) / sizeof(pix[0]);
typedef struct {
WMesaContext ctx;
@@ -616,13 +572,12 @@ WGLAPI int GLAPIENTRY wglDescribePixelFormat(HDC hdc,int iPixelFormat,UINT nByte
*/
WGLAPI PROC GLAPIENTRY wglGetProcAddress(LPCSTR lpszProc)
{
int i;
for(i = 0;i < qt_ext;i++)
if(!strcmp(lpszProc,ext[i].name))
return(ext[i].proc);
PROC p = (PROC) _glapi_get_proc_address((const char *) lpszProc);
if (p)
return p;
SetLastError(0);
return(NULL);
SetLastError(0);
return(NULL);
}
WGLAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc)

View File

@@ -1,4 +1,4 @@
/* $Id: wmesa.c,v 1.22.2.8 2002/06/24 20:18:04 kschultz Exp $ */
/* $Id: wmesa.c,v 1.22.2.10 2002/09/12 17:02:52 kschultz Exp $ */
/*
* Windows (Win32) device driver for Mesa 3.4
@@ -1346,16 +1346,6 @@ WMesaContext WMesaCreateContext( HWND hWnd, HPALETTE* Pal,
return NULL;
}
if (!_mesa_initialize_context(c->gl_ctx,
c->gl_visual,
(GLcontext *) NULL,
(void *) c, GL_TRUE )) {
_mesa_destroy_visual( c->gl_visual );
free(c);
return NULL;
}
_mesa_enable_sw_extensions(c->gl_ctx);
_mesa_enable_1_3_extensions(c->gl_ctx);
@@ -1407,7 +1397,8 @@ void WMesaDestroyContext( void )
_mesa_destroy_visual( c->gl_visual );
_mesa_destroy_framebuffer( c->gl_buffer );
_mesa_free_context_data( c->gl_ctx );
free( (void *) c->gl_ctx);
if (c->db_flag)
#ifdef DDRAW
DDFree(c);
@@ -1419,6 +1410,9 @@ void WMesaDestroyContext( void )
if(parallelMachine)
PRDestroyRenderBuffer();
#endif
// There is no longer a current context.
WMesaMakeCurrent( NULL );
}

View File

@@ -1,7 +1,7 @@
/*
* Mesa 3-D graphics library
* Version: 4.0.3
* Version: 4.0.4
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -65,7 +65,7 @@
#define SERVER_MINOR_VERSION 4
/* This is appended onto the glXGetClient/ServerString version strings. */
#define MESA_GLX_VERSION "Mesa 4.0.3"
#define MESA_GLX_VERSION "Mesa 4.0.4"
/* Who implemented this GLX? */
#define VENDOR "Brian Paul"
@@ -2476,6 +2476,34 @@ Fake_glXSet3DfxModeMESA( int mode )
/*** AGP memory allocation ***/
static void *
Fake_glXAllocateMemoryNV( GLsizei size,
GLfloat readFrequency,
GLfloat writeFrequency,
GLfloat priority )
{
(void) size;
(void) readFrequency;
(void) writeFrequency;
(void) priority;
return NULL;
}
static void
Fake_glXFreeMemoryNV( GLvoid *pointer )
{
(void) pointer;
}
static GLuint
Fake_glXGetAGPOffsetMESA( const GLvoid *pointer )
{
return ~0;
}
extern struct _glxapi_table *_mesa_GetGLXDispatchTable(void);
struct _glxapi_table *_mesa_GetGLXDispatchTable(void)
@@ -2614,5 +2642,10 @@ struct _glxapi_table *_mesa_GetGLXDispatchTable(void)
/*** GLX_MESA_set_3dfx_mode ***/
glx.Set3DfxModeMESA = Fake_glXSet3DfxModeMESA;
/*** GLX AGP memory allocation ***/
glx.AllocateMemoryNV = Fake_glXAllocateMemoryNV;
glx.FreeMemoryNV = Fake_glXFreeMemoryNV;
glx.GetAGPOffsetMESA = Fake_glXGetAGPOffsetMESA;
return &glx;
}

View File

@@ -1,10 +1,10 @@
/* $Id: glxapi.c,v 1.28.2.1 2002/03/15 18:32:54 brianp Exp $ */
/* $Id: glxapi.c,v 1.28.2.3 2002/09/20 17:37:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.0.2
* Version: 4.0.4
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2002 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"),
@@ -989,6 +989,49 @@ Bool glXSet3DfxModeMESA(int mode)
/*** GLX_NV_vertex_array_range ***/
void *
glXAllocateMemoryNV( GLsizei size,
GLfloat readFrequency,
GLfloat writeFrequency,
GLfloat priority )
{
struct _glxapi_table *t;
Display *dpy = glXGetCurrentDisplay();
GET_DISPATCH(dpy, t);
if (!t)
return NULL;
return (t->AllocateMemoryNV)(size, readFrequency, writeFrequency, priority);
}
void
glXFreeMemoryNV( GLvoid *pointer )
{
struct _glxapi_table *t;
Display *dpy = glXGetCurrentDisplay();
GET_DISPATCH(dpy, t);
if (!t)
return;
(t->FreeMemoryNV)(pointer);
}
/*** GLX_MESA_agp_offset */
GLuint
glXGetAGPOffsetMESA( const GLvoid *pointer )
{
struct _glxapi_table *t;
Display *dpy = glXGetCurrentDisplay();
GET_DISPATCH(dpy, t);
if (!t)
return ~0;
return (t->GetAGPOffsetMESA)(pointer);
}
/**********************************************************************/
/* GLX API management functions */
/**********************************************************************/
@@ -1198,6 +1241,10 @@ static struct name_address_pair GLX_functions[] = {
/*** GLX_ARB_get_proc_address ***/
{ "glXGetProcAddressARB", (GLvoid *) glXGetProcAddressARB },
/*** GLX AGP memory allocation ***/
{ "glXAllocateMemoryNV", (GLvoid *) glXAllocateMemoryNV },
{ "glXFreeMemoryNV", (GLvoid *) glXFreeMemoryNV },
{ NULL, NULL } /* end of list */
};

View File

@@ -1,10 +1,10 @@
/* $Id: glxapi.h,v 1.11.2.1 2002/03/15 18:32:54 brianp Exp $ */
/* $Id: glxapi.h,v 1.11.2.3 2002/09/20 17:37:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.0.2
* Version: 4.0.4
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2002 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"),
@@ -196,6 +196,13 @@ struct _glxapi_table {
/*** GLX_MESA_set_3dfx_mode ***/
Bool (*Set3DfxModeMESA)(int mode);
/*** GLX AGP functions ***/
void * (*AllocateMemoryNV)( GLsizei size,
GLfloat readFrequency,
GLfloat writeFrequency,
GLfloat priority );
void (*FreeMemoryNV)( GLvoid *pointer );
GLuint (*GetAGPOffsetMESA)( const GLvoid *pointer );
};

View File

@@ -1,10 +1,10 @@
/* $Id: realglx.c,v 1.4 2001/05/30 14:39:47 brianp Exp $ */
/* $Id: realglx.c,v 1.4.2.1 2002/09/20 16:28:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.5
* Version: 4.0.4
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2002 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"),
@@ -170,5 +170,9 @@ _real_GetGLXDispatchTable(void)
/*** GLX_MESA_set_3dfx_mode ***/
glx.Set3DfxModeMESA = _real_glXSet3DfxModeMESA;
/*** GLX AGP memory allocation ***/
glx.AllocateMemoryNV = _real_glXAllocateMemoryNV;
glx.FreeMemoryNV = _real_glXFreeMemoryNV;
return &glx;
}

View File

@@ -1,4 +1,4 @@
/* $Id: realglx.h,v 1.4 2001/05/30 14:39:47 brianp Exp $ */
/* $Id: realglx.h,v 1.4.2.1 2002/09/20 17:37:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -312,4 +312,21 @@ _real_glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
int x, int y, int width, int height );
#endif
#ifdef GLX_NV_vertex_array_range
extern void *
_real_glXAllocateMemoryNV( GLsizei size, GLfloat readFrequency,
GLfloat writeFrequency, GLfloat priority );
extern void
_real_glXFreeMemoryNV( GLvoid *pointer );
#endif
#ifdef GLX_MESA_agp_offset
extern GLuint
_real_glXGetAGPOffset( const GLvoid *pointer );
#endif
#endif /* REALGLX_H */

View File

@@ -1,4 +1,4 @@
/* $Id: xm_api.c,v 1.29.2.9 2002/06/17 23:32:43 brianp Exp $ */
/* $Id: xm_api.c,v 1.29.2.10 2002/08/21 02:57:38 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -2239,8 +2239,6 @@ static void FXgetImage( XMesaBuffer b )
unsigned int bw, depth, width, height;
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
assert(xmesa->xm_buffer->FXctx);
#ifdef XFree86Server
x = b->frontbuffer->x;
y = b->frontbuffer->y;
@@ -2248,37 +2246,37 @@ static void FXgetImage( XMesaBuffer b )
height = b->frontbuffer->height;
depth = b->frontbuffer->depth;
#else
XGetGeometry( xmesa->xm_visual->display, b->frontbuffer,
XGetGeometry( b->xm_visual->display, b->frontbuffer,
&root, &xpos, &ypos, &width, &height, &bw, &depth);
#endif
if (b->width != width || b->height != height) {
b->width = MIN2((int)width, xmesa->xm_buffer->FXctx->width);
b->height = MIN2((int)height, xmesa->xm_buffer->FXctx->height);
b->width = MIN2((int)width, b->FXctx->width);
b->height = MIN2((int)height, b->FXctx->height);
if (b->width & 1)
b->width--; /* prevent odd width */
xmesa_alloc_back_buffer( b );
}
grLfbWriteColorFormat(GR_COLORFORMAT_ARGB);
if (xmesa->xm_visual->undithered_pf==PF_5R6G5B) {
if (b->xm_visual->undithered_pf==PF_5R6G5B) {
/* Special case: 16bpp RGB */
grLfbReadRegion( GR_BUFFER_FRONTBUFFER, /* src buffer */
0, xmesa->xm_buffer->FXctx->height - b->height, /*pos*/
0, b->FXctx->height - b->height, /*pos*/
b->width, b->height, /* size */
b->width * sizeof(GLushort), /* stride */
b->backimage->data); /* dest buffer */
}
else if (xmesa->xm_visual->dithered_pf==PF_DITHER
&& GET_VISUAL_DEPTH(xmesa->xm_visual)==8) {
else if (b->xm_visual->dithered_pf==PF_DITHER
&& GET_VISUAL_DEPTH(b->xm_visual)==8) {
/* Special case: 8bpp RGB */
for (y=0;y<b->height;y++) {
GLubyte *ptr = (GLubyte*) xmesa->xm_buffer->backimage->data
+ xmesa->xm_buffer->backimage->bytes_per_line * y;
GLubyte *ptr = (GLubyte*) b->backimage->data
+ b->backimage->bytes_per_line * y;
XDITHER_SETUP(y);
/* read row from 3Dfx frame buffer */
grLfbReadRegion( GR_BUFFER_FRONTBUFFER,
0, xmesa->xm_buffer->FXctx->height-(b->height-y),
0, b->FXctx->height-(b->height-y),
b->width, 1,
0,
pixbuf );
@@ -2297,7 +2295,7 @@ static void FXgetImage( XMesaBuffer b )
for (y=0;y<b->height;y++) {
/* read row from 3Dfx frame buffer */
grLfbReadRegion( GR_BUFFER_FRONTBUFFER,
0, xmesa->xm_buffer->FXctx->height-(b->height-y),
0, b->FXctx->height-(b->height-y),
b->width, 1,
0,
pixbuf );
@@ -2309,7 +2307,8 @@ static void FXgetImage( XMesaBuffer b )
(pixbuf[x] & 0xf800) >> 8,
(pixbuf[x] & 0x07e0) >> 3,
(pixbuf[x] & 0x001f) << 3,
0xff, xmesa->pixelformat));
0xff,
b->xm_visual->undithered_pf));
}
}
}

View File

@@ -1,4 +1,4 @@
/* $Id: xm_dd.c,v 1.26.2.7 2002/06/19 21:50:14 brianp Exp $ */
/* $Id: xm_dd.c,v 1.26.2.8 2002/09/23 17:20:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -231,6 +231,7 @@ index_mask( GLcontext *ctx, GLuint mask )
m = (unsigned long) mask;
}
XMesaSetPlaneMask( xmesa->display, xmesa->xm_buffer->cleargc, m );
XMesaSetPlaneMask( xmesa->display, xmesa->xm_buffer->gc, m );
}
}

View File

@@ -0,0 +1,416 @@
## BeOS Generic Makefile v2.0 ##
## Fill in this file to specify the project being created, and the referenced
## makefile-engine will do all of the hard work for you. This handles both
## Intel and PowerPC builds of the BeOS.
## Application Specific Settings ---------------------------------------------
# specify the name of the binary
NAME= libGL.so
# specify the type of binary
# APP: Application
# SHARED: Shared library or add-on
# STATIC: Static library archive
# DRIVER: Kernel Driver
TYPE= SHARED
# specify the source files to use
# full paths or paths relative to the makefile can be included
# all files, regardless of directory, will have their object
# files created in the common object directory.
# Note that this means this makefile will not work correctly
# if two source files with the same name (source.c or source.cpp)
# are included from different directories. Also note that spaces
# in folder names do not work well with this makefile.
MESA_CORE_SRCS = \
swrast_setup/ss_context.c \
swrast_setup/ss_triangle.c \
swrast_setup/ss_vb.c \
api_arrayelt.c \
api_loopback.c \
api_noop.c \
api_validate.c \
accum.c \
attrib.c \
blend.c \
buffers.c \
clip.c \
colortab.c \
config.c \
context.c \
convolve.c \
debug.c \
depth.c \
dispatch.c \
dlist.c \
drawpix.c \
enable.c \
enums.c \
eval.c \
extensions.c \
feedback.c \
fog.c \
get.c \
glapi.c \
glthread.c \
hash.c \
hint.c \
histogram.c \
image.c \
imports.c \
light.c \
lines.c \
matrix.c \
mem.c \
mmath.c \
pixel.c \
points.c \
polygon.c \
rastpos.c \
state.c \
stencil.c \
texformat.c \
teximage.c \
texobj.c \
texstate.c \
texstore.c \
texutil.c \
varray.c \
vtxfmt.c \
math/m_debug_clip.c \
math/m_debug_norm.c \
math/m_debug_vertex.c \
math/m_debug_xform.c \
math/m_eval.c \
math/m_matrix.c \
math/m_translate.c \
math/m_vector.c \
math/m_vertices.c \
math/m_xform.c \
array_cache/ac_context.c \
array_cache/ac_import.c \
swrast/s_aaline.c \
swrast/s_aatriangle.c \
swrast/s_accum.c \
swrast/s_alpha.c \
swrast/s_alphabuf.c \
swrast/s_bitmap.c \
swrast/s_blend.c \
swrast/s_buffers.c \
swrast/s_copypix.c \
swrast/s_context.c \
swrast/s_depth.c \
swrast/s_drawpix.c \
swrast/s_feedback.c \
swrast/s_fog.c \
swrast/s_histogram.c \
swrast/s_imaging.c \
swrast/s_lines.c \
swrast/s_logic.c \
swrast/s_masking.c \
swrast/s_pb.c \
swrast/s_pixeltex.c \
swrast/s_points.c \
swrast/s_readpix.c \
swrast/s_scissor.c \
swrast/s_span.c \
swrast/s_stencil.c \
swrast/s_texture.c \
swrast/s_texstore.c \
swrast/s_triangle.c \
swrast/s_zoom.c \
tnl/t_array_api.c \
tnl/t_array_import.c \
tnl/t_context.c \
tnl/t_eval_api.c \
tnl/t_imm_alloc.c \
tnl/t_imm_api.c \
tnl/t_imm_debug.c \
tnl/t_imm_dlist.c \
tnl/t_imm_elt.c \
tnl/t_imm_eval.c \
tnl/t_imm_exec.c \
tnl/t_imm_fixup.c \
tnl/t_pipeline.c \
tnl/t_vb_fog.c \
tnl/t_vb_light.c \
tnl/t_vb_normals.c \
tnl/t_vb_points.c \
tnl/t_vb_render.c \
tnl/t_vb_texgen.c \
tnl/t_vb_texmat.c \
tnl/t_vb_vertex.c
MESA_X86_SRCS = \
X86/x86.c \
X86/glapi_x86.S \
X86/common_x86.c \
X86/common_x86_asm.S \
X86/x86_xform2.S \
X86/x86_xform3.S \
X86/x86_xform4.S \
X86/x86_vertex.S \
X86/x86_cliptest.S
MESA_MMX_SRCS = \
X86/mmx_blend.S
MESA_SSE_SRCS = \
X86/sse.c \
X86/sse_xform2.S \
X86/sse_xform3.S \
X86/sse_xform4.S \
X86/sse_vertex.S \
X86/sse_normal.S
MESA_3DNOW_SRCS = \
X86/3dnow.c \
X86/3dnow_xform1.S \
X86/3dnow_xform2.S \
X86/3dnow_xform3.S \
X86/3dnow_xform4.S \
X86/3dnow_vertex.S
MESA_BEOS_DRIVER_SRCS = \
BeOS/GLView.cpp \
BeOS/MesaDriver.cpp
MESA_DEFINES =
# To use GAS assembler, uncomment this line instead:
MESA_DEFINES += GNU_ASSEMBLER
# To use NASM assembler, uncomment this line instead:
# MESA_DEFINES += NASM_ASSEMBLER
# To add thread-safety, uncomment this line instead:
# MESA_DEFINES += BEOS_THREADS
# To build a DEBUG version of Mesa, uncomment this line instead:
# MESA_DEFINES += DEBUG
# x86-optimized code
MACHINE=$(shell uname -m)
ifeq ($(MACHINE), BePC)
HAVE_MMX = 1
HAVE_SSE = 1
HAVE_3DNOW = 1
else
# No assembly optimization for PowerPC...
# HAVE_ALTIVEC=1
endif
ifdef HAVE_MMX
MESA_X86_SRCS += $(MESA_MMX_SRCS)
MESA_DEFINES += USE_MMX_ASM
HAVE_X86 = 1
endif
ifdef HAVE_SSE
MESA_X86_SRCS += $(MESA_SSE_SRCS)
MESA_DEFINES += USE_SSE_ASM
HAVE_X86 = 1
endif
ifdef HAVE_3DNOW
MESA_X86_SRCS += $(MESA_3DNOW_SRCS)
MESA_DEFINES += USE_3DNOW_ASM
HAVE_X86 = 1
endif
ifdef HAVE_X86
MESA_DEFINES += USE_X86_ASM
else
MESA_X86_SRCS =
endif
# FIXME: SI-GLU version support currently broken
# USE_SI_GLU=1
ifdef USE_SI_GLU
GLU_SRCS = \
../si-glu/libutil/error.c \
../si-glu/libutil/glue.c \
../si-glu/libutil/mipmap.c \
../si-glu/libutil/project.c \
../si-glu/libutil/quad.c \
../si-glu/libutil/registry.c \
../si-glu/libtess/dict.c \
../si-glu/libtess/geom.c \
../si-glu/libtess/memalloc.c \
../si-glu/libtess/mesh.c \
../si-glu/libtess/normal.c \
../si-glu/libtess/priorityq.c \
../si-glu/libtess/render.c \
../si-glu/libtess/sweep.c \
../si-glu/libtess/tess.c \
../si-glu/libtess/tessmono.c \
../si-glu/libnurbs/interface/bezierEval.cc \
../si-glu/libnurbs/interface/bezierPatch.cc \
../si-glu/libnurbs/interface/bezierPatchMesh.cc \
../si-glu/libnurbs/interface/glcurveval.cc \
../si-glu/libnurbs/interface/glinterface.cc \
../si-glu/libnurbs/interface/glrenderer.cc \
../si-glu/libnurbs/interface/glsurfeval.cc \
../si-glu/libnurbs/interface/incurveeval.cc \
../si-glu/libnurbs/interface/insurfeval.cc \
../si-glu/libnurbs/internals/arc.cc \
../si-glu/libnurbs/internals/arcsorter.cc \
../si-glu/libnurbs/internals/arctess.cc \
../si-glu/libnurbs/internals/backend.cc \
../si-glu/libnurbs/internals/basiccrveval.cc \
../si-glu/libnurbs/internals/basicsurfeval.cc \
../si-glu/libnurbs/internals/bin.cc \
../si-glu/libnurbs/internals/bufpool.cc \
../si-glu/libnurbs/internals/cachingeval.cc \
../si-glu/libnurbs/internals/ccw.cc \
../si-glu/libnurbs/internals/coveandtiler.cc \
../si-glu/libnurbs/internals/curve.cc \
../si-glu/libnurbs/internals/curvelist.cc \
../si-glu/libnurbs/internals/curvesub.cc \
../si-glu/libnurbs/internals/dataTransform.cc \
../si-glu/libnurbs/internals/displaylist.cc \
../si-glu/libnurbs/internals/flist.cc \
../si-glu/libnurbs/internals/flistsorter.cc \
../si-glu/libnurbs/internals/hull.cc \
../si-glu/libnurbs/internals/intersect.cc \
../si-glu/libnurbs/internals/knotvector.cc \
../si-glu/libnurbs/internals/mapdesc.cc \
../si-glu/libnurbs/internals/mapdescv.cc \
../si-glu/libnurbs/internals/maplist.cc \
../si-glu/libnurbs/internals/mesher.cc \
../si-glu/libnurbs/internals/monoTriangulationBackend.cc \
../si-glu/libnurbs/internals/monotonizer.cc \
../si-glu/libnurbs/internals/mycode.cc \
../si-glu/libnurbs/internals/nurbsinterfac.cc \
../si-glu/libnurbs/internals/nurbstess.cc \
../si-glu/libnurbs/internals/patch.cc \
../si-glu/libnurbs/internals/patchlist.cc \
../si-glu/libnurbs/internals/quilt.cc \
../si-glu/libnurbs/internals/reader.cc \
../si-glu/libnurbs/internals/renderhints.cc \
../si-glu/libnurbs/internals/slicer.cc \
../si-glu/libnurbs/internals/sorter.cc \
../si-glu/libnurbs/internals/splitarcs.cc \
../si-glu/libnurbs/internals/subdivider.cc \
../si-glu/libnurbs/internals/tobezier.cc \
../si-glu/libnurbs/internals/trimline.cc \
../si-glu/libnurbs/internals/trimregion.cc \
../si-glu/libnurbs/internals/trimvertpool.cc \
../si-glu/libnurbs/internals/uarray.cc \
../si-glu/libnurbs/internals/varray.cc \
../si-glu/libnurbs/nurbtess/directedLine.cc \
../si-glu/libnurbs/nurbtess/gridWrap.cc \
../si-glu/libnurbs/nurbtess/monoChain.cc \
../si-glu/libnurbs/nurbtess/monoPolyPart.cc \
../si-glu/libnurbs/nurbtess/monoTriangulation.cc \
../si-glu/libnurbs/nurbtess/partitionX.cc \
../si-glu/libnurbs/nurbtess/partitionY.cc \
../si-glu/libnurbs/nurbtess/polyDBG.cc \
../si-glu/libnurbs/nurbtess/polyUtil.cc \
../si-glu/libnurbs/nurbtess/primitiveStream.cc \
../si-glu/libnurbs/nurbtess/quicksort.cc \
../si-glu/libnurbs/nurbtess/rectBlock.cc \
../si-glu/libnurbs/nurbtess/sampleComp.cc \
../si-glu/libnurbs/nurbtess/sampleCompBot.cc \
../si-glu/libnurbs/nurbtess/sampleCompRight.cc \
../si-glu/libnurbs/nurbtess/sampleCompTop.cc \
../si-glu/libnurbs/nurbtess/sampleMonoPoly.cc \
../si-glu/libnurbs/nurbtess/sampledLine.cc \
../si-glu/libnurbs/nurbtess/searchTree.cc
else
GLU_SRCS = \
../src-glu/glu.c \
../src-glu/mipmap.c \
../src-glu/project.c \
../src-glu/quadric.c \
../src-glu/tess.c \
../src-glu/tesselat.c \
../src-glu/polytest.c \
../src-glu/nurbs.c \
../src-glu/nurbscrv.c \
../src-glu/nurbssrf.c \
../src-glu/nurbsutl.c
endif
# Target sources
SRCS = $(MESA_CORE_SRCS) $(MESA_X86_SRCS) $(MESA_BEOS_DRIVER_SRCS) $(GLU_SRCS)
# specify the resource files to use
# full path or a relative path to the resource file can be used.
RSRCS =
# specify additional libraries to link against
# there are two acceptable forms of library specifications
# - if your library follows the naming pattern of:
# libXXX.so or libXXX.a you can simply specify XXX
# library: libbe.so entry: be
#
# - if your library does not follow the standard library
# naming scheme you need to specify the path to the library
# and it's name
# library: my_lib.a entry: my_lib.a or path/my_lib.a
LIBS = be
# specify additional paths to directories following the standard
# libXXX.so or libXXX.a naming scheme. You can specify full paths
# or paths relative to the makefile. The paths included may not
# be recursive, so include all of the paths where libraries can
# be found. Directories where source files are found are
# automatically included.
LIBPATHS =
# additional paths to look for system headers
# thes use the form: #include <header>
# source file directories are NOT auto-included here
SYSTEM_INCLUDE_PATHS = ../include
ifdef USE_SI_GLU
SYSTEM_INCLUDE_PATHS += ../si-glu/include
endif
# additional paths to look for local headers
# thes use the form: #include "header"
# source file directories are automatically included
LOCAL_INCLUDE_PATHS =
# specify the level of optimization that you desire
# NONE, SOME, FULL
OPTIMIZE = FULL
# specify any preprocessor symbols to be defined. The symbols
# will be set to a value of 1. For example specify DEBUG if you want
# DEBUG=1 to be set when compiling.
DEFINES = $(MESA_DEFINES)
# specify special warning levels
# if unspecified default warnings will be used
# NONE = suppress all warnings
# ALL = enable all warnings
WARNINGS = ALL
# specify whether image symbols will be created
# so that stack crawls in the debugger are meaningful
# if TRUE symbols will be created
SYMBOLS = TRUE
# specify debug settings
# if TRUE will allow application to be run from
# a source-level debugger
# DEBUGGER = TRUE
DEBUGGER = FALSE
# specify additional compiler flags for all files
COMPILER_FLAGS =
# specify additional linker flags
LINKER_FLAGS =
## include the makefile-engine
include /boot/develop/etc/makefile-engine
## Add NASM support for assembly code compilation...
# $(OBJ_DIR)/%.o : %.nasm
# nasm -f elf $(MESA_DEFINES) -o $@ $<
$(OBJ_DIR)/%.o : %.S
# we strip empty lines from gcc preprocessor output...
gcc -c $< $(INCLUDES) $(CFLAGS) -o $@
# gcc $(INCLUDES) $(CFLAGS) -E $< | grep -v '^$$' > $(addsuffix .nasm, $(basename $<))
# gcc $(INCLUDES) $(CFLAGS) -E $< | grep -v '^$$' > $(addsuffix .nasm, $(basename $<))
# nasm -f elf $(MESA_DEFINES) -o $@ $(addsuffix .nasm, $(basename $<))

View File

@@ -20,32 +20,68 @@
# 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.
# DOS/DJGPP core makefile v1.0 for Mesa 4.0
# DOS/DJGPP core makefile v1.1 for Mesa 4.0
#
# Copyright (C) 2002 - Borca Daniel
# Email : dborca@yahoo.com
# Web : http://www.geocities.com/dborca
#
# Available options:
#
# Environment variables:
# CFLAGS
#
# GLIDE absolute path to Glide SDK; used with FX.
# default = $(TOP)/include/glide3
# FX=1 build for 3dfx Glide3; use it if you have the glide
# SDK (designed for your platform), and, of course, a
# 3dfx card... Note that this disables compilation of
# actual DMesa code, as Glide does all the stuff!
# default = no
# HAVE_X86=1 optimize for i386.
# default = no
# HAVE_MMX=1 MMX instructions; use only if you assembler/compiler
# supports MMX instruction set; backwards compatibility
# with older processors is still preserved.
# default = no
# HAVE_SSE=1 (see HAVE_MMX)
# default = no
# HAVE_3DNOW=1 (see HAVE_MMX)
# default = no
#
# Targets:
# all: build GL
# clean: remove object files
#
.PHONY: all clean
TOP = ..
CC = gcc
CFLAGS = -I$(TOP)/include -I. -Wall -W -Wno-unused -mcpu=$(CPU) -ffast-math -O2
AR = ar
ARFLAGS = ruv
GLIDE ?= $(TOP)/include/glide3
LIBDIR = $(TOP)/lib
ifeq ($(wildcard $(DJDIR)/lib/dxe2.ld),)
DXE2GEN =
else
DXE2GEN = $(wildcard $(addsuffix /dxe2gen.exe,$(subst ;, ,$(PATH))))
endif
GL_LIB = libgl.a
GL_DXE = gl.dxe
GL_IMP = libigl.a
CC = gcc
CFLAGS += -I$(TOP)/include -I.
ifdef FX
CFLAGS += -D__DOS__ -I$(GLIDE) -DFX -DFX_GLIDE3 -DFXMESA_USE_ARGB
endif
AR = ar
ARFLAGS = ru
ifneq ($(wildcard $(DJDIR)/lib/dxe2.ld),)
DXE2GEN = $(wildcard $(addsuffix /dxe2gen.exe,$(subst ;, ,$(PATH))))
endif
RM = del
CORE_SOURCES = \
swrast_setup/ss_context.c \
swrast_setup/ss_triangle.c \
@@ -176,7 +212,8 @@ X86_SOURCES = \
X86/x86_vertex.S \
X86/x86_cliptest.S
MMX_SOURCES =
MMX_SOURCES = \
X86/mmx_blend.S
SSE_SOURCES = \
X86/sse.c \
@@ -186,7 +223,7 @@ SSE_SOURCES = \
X86/sse_vertex.S \
X86/sse_normal.S
D3NOW_SOURCES = \
K3D_SOURCES = \
X86/3dnow.c \
X86/3dnow_xform2.S \
X86/3dnow_xform3.S \
@@ -204,7 +241,7 @@ CFLAGS += -DUSE_SSE_ASM
HAVE_X86 = 1
endif
ifdef HAVE_3DNOW
X86_SOURCES += $(D3NOW_SOURCES)
X86_SOURCES += $(K3D_SOURCES)
CFLAGS += -DUSE_3DNOW_ASM
HAVE_X86 = 1
endif
@@ -214,16 +251,36 @@ else
X86_SOURCES =
endif
DRIVER_SOURCES = DOS/dmesa.c DOS/video.c DOS/dpmi.c
ifndef FX
DRIVER_SOURCES = \
DOS/dmesa.c \
DOS/video.c \
DOS/virtual.S \
DOS/vesa/vesa.c \
DOS/dpmi.c
else
DRIVER_SOURCES = \
FX/fxapi.c \
FX/fxdd.c \
FX/fxddspan.c \
FX/fxddtex.c \
FX/fxsetup.c \
FX/fxtexman.c \
FX/fxtris.c \
FX/fxvb.c \
FX/fxglidew.c
endif
SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(DRIVER_SOURCES)
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
.c.o:
gcc -o $@ -c $(CFLAGS) $<
$(CC) -o $@ -c $(CFLAGS) $<
.S.o:
gcc -o $@ -c $(CFLAGS) $<
$(CC) -o $@ -c $(CFLAGS) $<
.s.o:
$(CC) -o $@ -c $(CFLAGS) -x assembler-with-cpp $<
all: $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GL_DXE) $(LIBDIR)/$(GL_IMP)
@@ -235,24 +292,19 @@ ifeq ($(DXE2GEN),)
$(warning Missing DXE2GEN and/or DXE2.LD! You must have DXE2GEN)
$(warning somewhere in PATH, and DXE2.LD in DJGPP/LIB directory.)
else
dxe2gen -o $(LIBDIR)/$(GL_DXE) -I $(LIBDIR)/$(GL_IMP) $(OBJECTS) -D "Mesa DOS GL" -U
-dxe2gen -o $(LIBDIR)/$(GL_DXE) -I $(LIBDIR)/$(GL_IMP) $(OBJECTS) -E djgpp_ -E gl -E DMesa -E fxMesa -D "Mesa DJGPP GL" -U
endif
clean:
-$(RM) *.o
ifdef HAVE_X86
-$(RM) X86\*.o
endif
-$(RM) DOS\*.o
-$(RM) $(subst /,\,*.o)
-$(RM) $(subst /,\,array_cache/*.o)
-$(RM) $(subst /,\,math/*.o)
-$(RM) $(subst /,\,swrast/*.o)
-$(RM) $(subst /,\,swrast_setup/*.o)
-$(RM) $(subst /,\,tnl/*.o)
-$(RM) $(subst /,\,X86/*.o)
-$(RM) $(subst /,\,DOS/*.o)
-$(RM) $(subst /,\,DOS/vesa/*.o)
-$(RM) $(subst /,\,FX/*.o)
include depend
DOS/dmesa.o: DOS/dmesa.c glheader.h ../include/GL/gl.h context.h glapi.h \
mtypes.h config.h glapitable.h glthread.h math/m_matrix.h dd.h macros.h \
../include/GL/dmesa.h extensions.h matrix.h mmath.h texformat.h \
texstore.h array_cache/acache.h swrast/s_context.h swrast/swrast.h \
swrast/s_depth.h swrast/s_lines.h swrast/s_triangle.h swrast/s_trispan.h \
swrast_setup/swrast_setup.h tnl/tnl.h tnl/t_context.h math/m_vector.h \
math/m_xform.h tnl/t_pipeline.h DOS/video.h swrast/s_tritemp.h
DOS/dpmi.o: DOS/dpmi.c DOS/dpmiint.h
DOS/video.o: DOS/video.c DOS/video.h DOS/dpmiint.h
-include depend

View File

@@ -158,7 +158,7 @@ CFLAGS = $(cvarsdll) $(CFLAGS) -D_OPENGL32_ -DBUILD_GL32 -DNO_PARALLEL -DNO_STER
!IFNDEF NODEBUG
CFLAGS = $(CFLAGS) -DMESA_DEBUG
!ENDIF
LFLAGS = $(dlllflags) $(lcommon) $(LFLAGS) /MAP
LFLAGS = $(dlllflags) $(lcommon) $(LFLAGS)
OBJS = $(ASM_SRCS:.S=.obj) $(CORE_SRCS:.c=.obj) $(DRIVER_SRCS:.c=.obj)
LIBS = winmm.lib $(guilibsdll)

View File

@@ -1,8 +1,8 @@
/* $Id: attrib.c,v 1.57.2.4 2002/06/16 03:19:57 brianp Exp $ */
/* $Id: attrib.c,v 1.57.2.5 2002/08/28 01:13:34 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.0.3
* Version: 4.0.4
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -353,6 +353,8 @@ _mesa_PushAttrib(GLbitfield mask)
attr->Unit[u].Current3D);
_mesa_copy_texture_object(&attr->Unit[u].SavedCubeMap,
attr->Unit[u].CurrentCubeMap);
_mesa_copy_texture_object(&attr->Unit[u].SavedRect,
attr->Unit[u].CurrentRect);
}
newnode = new_attrib_node( GL_TEXTURE_BIT );
newnode->data = attr;
@@ -519,6 +521,12 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable)
(GLboolean) (enable->Texture[i] & TEXTURE0_2D) );
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_3D,
(GLboolean) (enable->Texture[i] & TEXTURE0_3D) );
if (ctx->Extensions.ARB_texture_cube_map)
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_CUBE_MAP_ARB,
(GLboolean) (enable->Texture[i] & TEXTURE0_CUBE) );
if (ctx->Extensions.NV_texture_rectangle)
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_RECTANGLE_NV,
(GLboolean) (enable->Texture[i] & TEXTURE0_RECT) );
}
}
@@ -561,7 +569,7 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib)
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
const struct gl_texture_unit *unit = &texAttrib->Unit[u];
GLuint numObjs, i;
GLuint i;
_mesa_ActiveTextureARB(GL_TEXTURE0_ARB + u);
_mesa_set_enable(ctx, GL_TEXTURE_1D,
@@ -574,6 +582,10 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib)
_mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP_ARB,
(GLboolean) (unit->Enabled & TEXTURE0_CUBE ? GL_TRUE : GL_FALSE));
}
if (ctx->Extensions.NV_texture_rectangle) {
_mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE_NV,
(GLboolean) (unit->Enabled & TEXTURE0_RECT ? GL_TRUE : GL_FALSE));
}
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, unit->EnvMode);
_mesa_TexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, unit->EnvColor);
_mesa_TexGeni(GL_S, GL_TEXTURE_GEN_MODE, unit->GenModeS);
@@ -629,9 +641,7 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib)
}
/* Restore texture object state */
numObjs = ctx->Extensions.ARB_texture_cube_map ? 4 : 3;
for (i = 0; i < numObjs; i++) {
for (i = 0; i < NUM_TEXTURE_TARGETS; i++) {
GLenum target = 0;
const struct gl_texture_object *obj = NULL;
GLfloat bordColor[4];
@@ -650,9 +660,17 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib)
obj = &unit->Saved3D;
break;
case 3:
if (!ctx->Extensions.ARB_texture_cube_map)
continue;
target = GL_TEXTURE_CUBE_MAP_ARB;
obj = &unit->SavedCubeMap;
break;
case 4:
if (!ctx->Extensions.NV_texture_rectangle)
continue;
target = GL_TEXTURE_RECTANGLE_NV;
obj = &unit->SavedRect;
break;
default:
; /* silence warnings */
}
@@ -704,6 +722,7 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib)
ctx->Texture.Unit[u].Current2D->RefCount--;
ctx->Texture.Unit[u].Current3D->RefCount--;
ctx->Texture.Unit[u].CurrentCubeMap->RefCount--;
ctx->Texture.Unit[u].CurrentRect->RefCount--;
}
}

View File

@@ -1,10 +1,10 @@
/* $Id: config.h,v 1.34.2.2 2001/11/28 17:18:20 brianp Exp $ */
/* $Id: config.h,v 1.34.2.3 2002/08/28 01:13:34 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.0.1
* Version: 4.0.4
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2002 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"),
@@ -108,8 +108,11 @@
/* Number of cube texture mipmap levels */
#define MAX_CUBE_TEXTURE_LEVELS 12
/* Maximum rectangular texture size - GL_NV_texture_rectangle */
#define MAX_TEXTURE_RECT_SIZE 2048
/* Number of texture units - GL_ARB_multitexture */
#define MAX_TEXTURE_UNITS 8
#define MAX_TEXTURE_UNITS 6
/* Maximum viewport/image size: */
#define MAX_WIDTH 2048

View File

@@ -1,8 +1,8 @@
/* $Id: context.c,v 1.148.2.7 2002/06/17 23:32:43 brianp Exp $ */
/* $Id: context.c,v 1.148.2.10 2002/09/20 17:36:01 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.0.3
* Version: 4.0.4
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -491,26 +491,33 @@ alloc_shared_state( void )
/* Default Texture objects */
outOfMemory = GL_FALSE;
ss->Default1D = _mesa_alloc_texture_object(ss, 0, 1);
ss->Default1D = _mesa_alloc_texture_object(ss, 0, GL_TEXTURE_1D);
if (!ss->Default1D) {
outOfMemory = GL_TRUE;
}
ss->Default2D = _mesa_alloc_texture_object(ss, 0, 2);
ss->Default2D = _mesa_alloc_texture_object(ss, 0, GL_TEXTURE_2D);
if (!ss->Default2D) {
outOfMemory = GL_TRUE;
}
ss->Default3D = _mesa_alloc_texture_object(ss, 0, 3);
ss->Default3D = _mesa_alloc_texture_object(ss, 0, GL_TEXTURE_3D);
if (!ss->Default3D) {
outOfMemory = GL_TRUE;
}
ss->DefaultCubeMap = _mesa_alloc_texture_object(ss, 0, 6);
ss->DefaultCubeMap = _mesa_alloc_texture_object(ss, 0,
GL_TEXTURE_CUBE_MAP_ARB);
if (!ss->DefaultCubeMap) {
outOfMemory = GL_TRUE;
}
ss->DefaultRect = _mesa_alloc_texture_object(ss, 0,
GL_TEXTURE_RECTANGLE_NV);
if (!ss->DefaultRect) {
outOfMemory = GL_TRUE;
}
if (!ss->DisplayList || !ss->TexObjects || outOfMemory) {
/* Ran out of memory at some point. Free everything and return NULL */
if (ss->DisplayList)
@@ -525,6 +532,8 @@ alloc_shared_state( void )
_mesa_free_texture_object(ss, ss->Default3D);
if (ss->DefaultCubeMap)
_mesa_free_texture_object(ss, ss->DefaultCubeMap);
if (ss->DefaultRect)
_mesa_free_texture_object(ss, ss->DefaultRect);
FREE(ss);
return NULL;
}
@@ -671,6 +680,7 @@ init_texture_unit( GLcontext *ctx, GLuint unit )
texUnit->Current2D = ctx->Shared->Default2D;
texUnit->Current3D = ctx->Shared->Default3D;
texUnit->CurrentCubeMap = ctx->Shared->DefaultCubeMap;
texUnit->CurrentRect = ctx->Shared->DefaultRect;
}
@@ -728,6 +738,7 @@ init_attrib_groups( GLcontext *ctx )
ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS;
ctx->Const.Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS;
ctx->Const.MaxCubeTextureLevels = MAX_CUBE_TEXTURE_LEVELS;
ctx->Const.MaxTextureRectSize = MAX_TEXTURE_RECT_SIZE;
ctx->Const.MaxTextureUnits = MAX_TEXTURE_UNITS;
ctx->Const.MaxTextureMaxAnisotropy = MAX_TEXTURE_MAX_ANISOTROPY;
ctx->Const.MaxTextureLodBias = MAX_TEXTURE_LOD_BIAS;
@@ -1083,7 +1094,6 @@ init_attrib_groups( GLcontext *ctx )
ctx->Point.MinSize = 0.0;
ctx->Point.MaxSize = ctx->Const.MaxPointSize;
ctx->Point.Threshold = 1.0;
ctx->Point.SpriteMode = GL_FALSE; /* GL_MESA_sprite_point */
/* Polygon group */
ctx->Polygon.CullFlag = GL_FALSE;
@@ -1313,25 +1323,25 @@ alloc_proxy_textures( GLcontext *ctx )
GLboolean out_of_memory;
GLint i;
ctx->Texture.Proxy1D = _mesa_alloc_texture_object(NULL, 0, 1);
ctx->Texture.Proxy1D = _mesa_alloc_texture_object(NULL, 0, GL_TEXTURE_1D);
if (!ctx->Texture.Proxy1D) {
return GL_FALSE;
}
ctx->Texture.Proxy2D = _mesa_alloc_texture_object(NULL, 0, 2);
ctx->Texture.Proxy2D = _mesa_alloc_texture_object(NULL, 0, GL_TEXTURE_2D);
if (!ctx->Texture.Proxy2D) {
_mesa_free_texture_object(NULL, ctx->Texture.Proxy1D);
return GL_FALSE;
}
ctx->Texture.Proxy3D = _mesa_alloc_texture_object(NULL, 0, 3);
ctx->Texture.Proxy3D = _mesa_alloc_texture_object(NULL, 0, GL_TEXTURE_3D);
if (!ctx->Texture.Proxy3D) {
_mesa_free_texture_object(NULL, ctx->Texture.Proxy1D);
_mesa_free_texture_object(NULL, ctx->Texture.Proxy2D);
return GL_FALSE;
}
ctx->Texture.ProxyCubeMap = _mesa_alloc_texture_object(NULL, 0, 6);
ctx->Texture.ProxyCubeMap = _mesa_alloc_texture_object(NULL, 0, GL_TEXTURE_CUBE_MAP_ARB);
if (!ctx->Texture.ProxyCubeMap) {
_mesa_free_texture_object(NULL, ctx->Texture.Proxy1D);
_mesa_free_texture_object(NULL, ctx->Texture.Proxy2D);
@@ -1339,16 +1349,27 @@ alloc_proxy_textures( GLcontext *ctx )
return GL_FALSE;
}
ctx->Texture.ProxyRect = _mesa_alloc_texture_object(NULL, 0, GL_TEXTURE_RECTANGLE_NV);
if (!ctx->Texture.ProxyRect) {
_mesa_free_texture_object(NULL, ctx->Texture.Proxy1D);
_mesa_free_texture_object(NULL, ctx->Texture.Proxy2D);
_mesa_free_texture_object(NULL, ctx->Texture.Proxy3D);
_mesa_free_texture_object(NULL, ctx->Texture.ProxyCubeMap);
return GL_FALSE;
}
out_of_memory = GL_FALSE;
for (i=0;i<MAX_TEXTURE_LEVELS;i++) {
ctx->Texture.Proxy1D->Image[i] = _mesa_alloc_texture_image();
ctx->Texture.Proxy2D->Image[i] = _mesa_alloc_texture_image();
ctx->Texture.Proxy3D->Image[i] = _mesa_alloc_texture_image();
ctx->Texture.ProxyCubeMap->Image[i] = _mesa_alloc_texture_image();
ctx->Texture.ProxyRect->Image[i] = _mesa_alloc_texture_image();
if (!ctx->Texture.Proxy1D->Image[i]
|| !ctx->Texture.Proxy2D->Image[i]
|| !ctx->Texture.Proxy3D->Image[i]
|| !ctx->Texture.ProxyCubeMap->Image[i]) {
|| !ctx->Texture.ProxyCubeMap->Image[i]
|| !ctx->Texture.ProxyRect->Image[i]) {
out_of_memory = GL_TRUE;
}
}
@@ -1366,11 +1387,15 @@ alloc_proxy_textures( GLcontext *ctx )
if (ctx->Texture.ProxyCubeMap->Image[i]) {
_mesa_free_texture_image(ctx->Texture.ProxyCubeMap->Image[i]);
}
if (ctx->Texture.ProxyRect->Image[i]) {
_mesa_free_texture_image(ctx->Texture.ProxyRect->Image[i]);
}
}
_mesa_free_texture_object(NULL, ctx->Texture.Proxy1D);
_mesa_free_texture_object(NULL, ctx->Texture.Proxy2D);
_mesa_free_texture_object(NULL, ctx->Texture.Proxy3D);
_mesa_free_texture_object(NULL, ctx->Texture.ProxyCubeMap);
_mesa_free_texture_object(NULL, ctx->Texture.ProxyRect);
return GL_FALSE;
}
else {
@@ -1468,6 +1493,7 @@ _mesa_initialize_context( GLcontext *ctx,
ctx->Shared->Default2D->RefCount += MAX_TEXTURE_UNITS;
ctx->Shared->Default3D->RefCount += MAX_TEXTURE_UNITS;
ctx->Shared->DefaultCubeMap->RefCount += MAX_TEXTURE_UNITS;
ctx->Shared->DefaultRect->RefCount += MAX_TEXTURE_UNITS;
init_attrib_groups( ctx );
@@ -1551,36 +1577,6 @@ _mesa_initialize_context( GLcontext *ctx,
}
ctx->MRD = 1.0; /* Minimum resolvable depth value, for polygon offset */
#if defined(MESA_TRACE)
ctx->TraceCtx = (trace_context_t *) CALLOC( sizeof(trace_context_t) );
#if 0
/* Brian: do you want to have CreateContext fail here,
or should we just trap in NewTrace (currently done)? */
if (!(ctx->TraceCtx)) {
free_shared_state(ctx, ctx->Shared);
FREE( ctx->Exec );
FREE( ctx->Save );
return GL_FALSE;
}
#endif
trInitContext(ctx->TraceCtx);
ctx->TraceDispatch = (struct _glapi_table *)
CALLOC(dispatchSize * sizeof(void*));
#if 0
if (!(ctx->TraceCtx)) {
free_shared_state(ctx, ctx->Shared);
FREE( ctx->Exec );
FREE( ctx->Save );
FREE( ctx->TraceCtx );
return GL_FALSE;
}
#endif
trInitDispatch(ctx->TraceDispatch);
#endif
if (getenv("MESA_DEBUG"))
add_debug_flags(getenv("MESA_DEBUG"));
@@ -1677,6 +1673,7 @@ _mesa_free_context_data( GLcontext *ctx )
_mesa_free_texture_object( NULL, ctx->Texture.Proxy2D );
_mesa_free_texture_object( NULL, ctx->Texture.Proxy3D );
_mesa_free_texture_object( NULL, ctx->Texture.ProxyCubeMap );
_mesa_free_texture_object( NULL, ctx->Texture.ProxyRect );
/* Free evaluator data */
if (ctx->EvalMap.Map1Vertex3.Points)

View File

@@ -1,8 +1,8 @@
/* $Id: enable.c,v 1.50.2.3 2002/04/19 08:37:10 alanh Exp $ */
/* $Id: enable.c,v 1.50.2.5 2002/09/13 17:34:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.0.2
* Version: 4.0.4
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -793,7 +793,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
ctx->Multisample.SampleCoverageInvert = state;
break;
/* GL_IBM_rasterpos_clip */
/* GL_IBM_rasterpos_clip */
case GL_RASTER_POSITION_UNCLIPPED_IBM:
if (!ctx->Extensions.IBM_rasterpos_clip) {
_mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
@@ -805,21 +805,28 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
ctx->Transform.RasterPositionUnclipped = state;
break;
/* GL_MESA_sprite_point */
case GL_SPRITE_POINT_MESA:
if (!ctx->Extensions.MESA_sprite_point) {
_mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
return;
/* GL_NV_texture_rectangle */
case GL_TEXTURE_RECTANGLE_NV:
{
const GLuint curr = ctx->Texture.CurrentUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
GLuint newenabled = texUnit->Enabled & ~TEXTURE0_RECT;
if (!ctx->Extensions.NV_texture_rectangle) {
_mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
return;
}
if (state)
newenabled |= TEXTURE0_RECT;
if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->Enabled = newenabled;
}
if (ctx->Point.SpriteMode == state)
return;
FLUSH_VERTICES(ctx, _NEW_POINT);
ctx->Point.SpriteMode = state;
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
return;
default:
_mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
return;
}
if (ctx->Driver.Enable) {
@@ -1117,9 +1124,17 @@ _mesa_IsEnabled( GLenum cap )
return GL_FALSE;
}
/* GL_MESA_sprite_point */
case GL_SPRITE_POINT_MESA:
return ctx->Point.SpriteMode;
/* GL_NV_texture_rectangle */
case GL_TEXTURE_RECTANGLE_NV:
if (ctx->Extensions.NV_texture_rectangle) {
const struct gl_texture_unit *texUnit;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
return (texUnit->Enabled & TEXTURE0_RECT) ? GL_TRUE : GL_FALSE;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled");
return GL_FALSE;
}
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );

View File

@@ -1,10 +1,10 @@
/* $Id: extensions.c,v 1.65 2001/10/17 13:31:07 brianp Exp $ */
/* $Id: extensions.c,v 1.65.2.7 2002/09/30 16:13:03 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.5.1
* Version: 4.0.4
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2002 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"),
@@ -101,13 +101,16 @@ static struct {
{ OFF, "GL_EXT_vertex_array_set", F(EXT_vertex_array_set) },
{ OFF, "GL_HP_occlusion_test", F(HP_occlusion_test) },
{ ON, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip) },
{ OFF, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)},
{ OFF, "GL_INGR_blend_func_separate", F(INGR_blend_func_separate) },
{ OFF, "GL_MESA_pack_invert", F(MESA_pack_invert) },
{ OFF, "GL_MESA_packed_depth_stencil", 0 },
{ OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) },
{ OFF, "GL_MESA_sprite_point", F(MESA_sprite_point) },
{ OFF, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture) },
{ ON, "GL_MESA_window_pos", F(MESA_window_pos) },
{ OFF, "GL_NV_blend_square", F(NV_blend_square) },
{ ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) },
{ OFF, "GL_NV_texture_rectangle", F(NV_texture_rectangle) },
{ OFF, "GL_SGI_color_matrix", F(SGI_color_matrix) },
{ OFF, "GL_SGI_color_table", F(SGI_color_table) },
{ OFF, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) },
@@ -118,7 +121,8 @@ static struct {
{ OFF, "GL_SGIX_pixel_texture", F(SGIX_pixel_texture) },
{ OFF, "GL_SGIX_shadow", F(SGIX_shadow) },
{ OFF, "GL_SGIX_shadow_ambient", F(SGIX_shadow_ambient) },
{ OFF, "GL_3DFX_texture_compression_FXT1", F(_3DFX_texture_compression_FXT1) }
{ OFF, "GL_3DFX_texture_compression_FXT1", F(_3DFX_texture_compression_FXT1) },
{ OFF, "GL_APPLE_client_storage", F(APPLE_client_storage) },
};
@@ -159,10 +163,14 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
"GL_EXT_texture_env_dot3",
"GL_EXT_texture_lod_bias",
"GL_HP_occlusion_test",
"GL_IBM_texture_mirrored_repeat",
"GL_INGR_blend_func_separate",
"GL_MESA_pack_invert",
"GL_MESA_resize_buffers",
"GL_MESA_ycbcr_texture",
"GL_NV_blend_square",
"GL_NV_texgen_reflection",
"GL_NV_texture_rectangle",
"GL_SGI_color_matrix",
"GL_SGI_color_table",
"GL_SGIS_generate_mipmap",

View File

@@ -1,8 +1,8 @@
/* $Id: get.c,v 1.69.2.6 2002/04/26 13:51:53 brianp Exp $ */
/* $Id: get.c,v 1.69.2.11 2002/09/21 17:12:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.0.3
* Version: 4.0.4
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -60,6 +60,42 @@
/* Check if named extension is enabled, if not generate error and return */
#define CHECK_EXTENSION_B(EXTNAME, PNAME) \
if (!ctx->Extensions.EXTNAME) { \
char message[100]; \
sprintf(message, "glGetBooleanv(0x%x)", (int) PNAME); \
_mesa_error(ctx, GL_INVALID_VALUE, message); \
return; \
}
#define CHECK_EXTENSION_I(EXTNAME, PNAME) \
if (!ctx->Extensions.EXTNAME) { \
char message[100]; \
sprintf(message, "glGetIntegerv(0x%x)", (int) PNAME); \
_mesa_error(ctx, GL_INVALID_VALUE, message); \
return; \
}
#define CHECK_EXTENSION_F(EXTNAME, PNAME) \
if (!ctx->Extensions.EXTNAME) { \
char message[100]; \
sprintf(message, "glGetFloatv(0x%x)", (int) PNAME); \
_mesa_error(ctx, GL_INVALID_VALUE, message); \
return; \
}
#define CHECK_EXTENSION_D(EXTNAME, PNAME) \
if (!ctx->Extensions.EXTNAME) { \
char message[100]; \
sprintf(message, "glGetDoublev(0x%x)", (int) PNAME); \
_mesa_error(ctx, GL_INVALID_VALUE, message); \
return; \
}
static GLenum
pixel_texgen_mode(const GLcontext *ctx)
{
@@ -636,6 +672,9 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
case GL_PACK_IMAGE_HEIGHT_EXT:
*params = ctx->Pack.ImageHeight;
break;
case GL_PACK_INVERT_MESA:
*params = ctx->Pack.Invert;
break;
case GL_PERSPECTIVE_CORRECTION_HINT:
*params = ENUM_TO_BOOL(ctx->Hint.PerspectiveCorrection);
break;
@@ -1181,12 +1220,6 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
return;
}
break;
case GL_MAX_CONVOLUTION_WIDTH:
*params = INT_TO_BOOL(ctx->Const.MaxConvolutionWidth);
break;
case GL_MAX_CONVOLUTION_HEIGHT:
*params = INT_TO_BOOL(ctx->Const.MaxConvolutionHeight);
break;
case GL_POST_CONVOLUTION_RED_SCALE_EXT:
*params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[0]);
break;
@@ -1362,17 +1395,6 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
}
break;
/* GL_MESA_sprite_point */
case GL_SPRITE_POINT_MESA:
if (ctx->Extensions.MESA_sprite_point) {
*params = ctx->Point.SpriteMode;
}
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" );
return;
}
break;
/* GL_SGIS_generate_mipmap */
case GL_GENERATE_MIPMAP_HINT_SGIS:
if (ctx->Extensions.SGIS_generate_mipmap) {
@@ -1384,6 +1406,20 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
}
break;
/* GL_NV_texture_rectangle */
case GL_TEXTURE_RECTANGLE_NV:
CHECK_EXTENSION_B(NV_texture_rectangle, pname);
*params = _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV);
break;
case GL_TEXTURE_BINDING_RECTANGLE_NV:
CHECK_EXTENSION_B(NV_texture_rectangle, pname);
*params = INT_TO_BOOL(textureUnit->CurrentRect->Name);
break;
case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:
CHECK_EXTENSION_B(NV_texture_rectangle, pname);
*params = INT_TO_BOOL(ctx->Const.MaxTextureRectSize);
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" );
}
@@ -1943,6 +1979,9 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
case GL_PACK_IMAGE_HEIGHT_EXT:
*params = (GLdouble) ctx->Pack.ImageHeight;
break;
case GL_PACK_INVERT_MESA:
*params = (GLdouble) ctx->Pack.Invert;
break;
case GL_PERSPECTIVE_CORRECTION_HINT:
*params = ENUM_TO_DOUBLE(ctx->Hint.PerspectiveCorrection);
break;
@@ -2485,12 +2524,6 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
return;
}
break;
case GL_MAX_CONVOLUTION_WIDTH:
*params = (GLdouble) ctx->Const.MaxConvolutionWidth;
break;
case GL_MAX_CONVOLUTION_HEIGHT:
*params = (GLdouble) ctx->Const.MaxConvolutionHeight;
break;
case GL_POST_CONVOLUTION_RED_SCALE_EXT:
*params = (GLdouble) ctx->Pixel.PostConvolutionScale[0];
break;
@@ -2666,17 +2699,6 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
}
break;
/* GL_MESA_sprite_point */
case GL_SPRITE_POINT_MESA:
if (ctx->Extensions.MESA_sprite_point) {
*params = (GLdouble) ctx->Point.SpriteMode;
}
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetDoublev" );
return;
}
break;
/* GL_SGIS_generate_mipmap */
case GL_GENERATE_MIPMAP_HINT_SGIS:
if (ctx->Extensions.SGIS_generate_mipmap) {
@@ -2688,6 +2710,20 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
}
break;
/* GL_NV_texture_rectangle */
case GL_TEXTURE_RECTANGLE_NV:
CHECK_EXTENSION_D(NV_texture_rectangle, pname);
*params = (GLdouble) _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV);
break;
case GL_TEXTURE_BINDING_RECTANGLE_NV:
CHECK_EXTENSION_D(NV_texture_rectangle, pname);
*params = (GLdouble) textureUnit->CurrentRect->Name;
break;
case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:
CHECK_EXTENSION_D(NV_texture_rectangle, pname);
*params = (GLdouble) ctx->Const.MaxTextureRectSize;
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glGetDoublev" );
}
@@ -3254,6 +3290,9 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
case GL_PACK_IMAGE_HEIGHT_EXT:
*params = (GLfloat) ctx->Pack.ImageHeight;
break;
case GL_PACK_INVERT_MESA:
*params = (GLfloat) ctx->Pack.Invert;
break;
case GL_PERSPECTIVE_CORRECTION_HINT:
*params = ENUM_TO_FLOAT(ctx->Hint.PerspectiveCorrection);
break;
@@ -3770,12 +3809,6 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
return;
}
break;
case GL_MAX_CONVOLUTION_WIDTH:
*params = (GLfloat) ctx->Const.MaxConvolutionWidth;
break;
case GL_MAX_CONVOLUTION_HEIGHT:
*params = (GLfloat) ctx->Const.MaxConvolutionHeight;
break;
case GL_POST_CONVOLUTION_RED_SCALE_EXT:
*params = ctx->Pixel.PostConvolutionScale[0];
break;
@@ -3951,17 +3984,6 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
}
break;
/* GL_MESA_sprite_point */
case GL_SPRITE_POINT_MESA:
if (ctx->Extensions.MESA_sprite_point) {
*params = (GLfloat) ctx->Point.SpriteMode;
}
else {
GET_FLOAT_ERROR;
return;
}
break;
/* GL_SGIS_generate_mipmap */
case GL_GENERATE_MIPMAP_HINT_SGIS:
if (ctx->Extensions.SGIS_generate_mipmap) {
@@ -3973,7 +3995,21 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
}
break;
default:
/* GL_NV_texture_rectangle */
case GL_TEXTURE_RECTANGLE_NV:
CHECK_EXTENSION_F(NV_texture_rectangle, pname);
*params = (GLfloat) _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV);
break;
case GL_TEXTURE_BINDING_RECTANGLE_NV:
CHECK_EXTENSION_F(NV_texture_rectangle, pname);
*params = (GLfloat) textureUnit->CurrentRect->Name;
break;
case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:
CHECK_EXTENSION_F(NV_texture_rectangle, pname);
*params = (GLfloat) ctx->Const.MaxTextureRectSize;
break;
default:
GET_FLOAT_ERROR;
}
}
@@ -4534,6 +4570,9 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
case GL_PACK_IMAGE_HEIGHT_EXT:
*params = ctx->Pack.ImageHeight;
break;
case GL_PACK_INVERT_MESA:
*params = ctx->Pack.Invert;
break;
case GL_PERSPECTIVE_CORRECTION_HINT:
*params = (GLint) ctx->Hint.PerspectiveCorrection;
break;
@@ -5076,12 +5115,6 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
return;
}
break;
case GL_MAX_CONVOLUTION_WIDTH:
*params = ctx->Const.MaxConvolutionWidth;
break;
case GL_MAX_CONVOLUTION_HEIGHT:
*params = ctx->Const.MaxConvolutionHeight;
break;
case GL_POST_CONVOLUTION_RED_SCALE_EXT:
*params = (GLint) ctx->Pixel.PostConvolutionScale[0];
break;
@@ -5278,17 +5311,6 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
}
break;
/* GL_MESA_sprite_point */
case GL_SPRITE_POINT_MESA:
if (ctx->Extensions.MESA_sprite_point) {
*params = (GLint) ctx->Point.SpriteMode;
}
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
return;
}
break;
/* GL_SGIS_generate_mipmap */
case GL_GENERATE_MIPMAP_HINT_SGIS:
if (ctx->Extensions.SGIS_generate_mipmap) {
@@ -5300,6 +5322,20 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
}
break;
/* GL_NV_texture_rectangle */
case GL_TEXTURE_RECTANGLE_NV:
CHECK_EXTENSION_I(NV_texture_rectangle, pname);
*params = (GLint) _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV);
break;
case GL_TEXTURE_BINDING_RECTANGLE_NV:
CHECK_EXTENSION_I(NV_texture_rectangle, pname);
*params = (GLint) textureUnit->CurrentRect->Name;
break;
case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:
CHECK_EXTENSION_I(NV_texture_rectangle, pname);
*params = (GLint) ctx->Const.MaxTextureRectSize;
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
}
@@ -5369,8 +5405,8 @@ _mesa_GetString( GLenum name )
GET_CURRENT_CONTEXT(ctx);
static const char *vendor = "Brian Paul";
static const char *renderer = "Mesa";
static const char *version_1_2 = "1.2 Mesa 4.0.3";
static const char *version_1_3 = "1.3 Mesa 4.0.3";
static const char *version_1_2 = "1.2 Mesa 4.0.4";
static const char *version_1_3 = "1.3 Mesa 4.0.4";
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
@@ -5391,6 +5427,7 @@ _mesa_GetString( GLenum name )
ctx->Extensions.ARB_multisample &&
ctx->Extensions.ARB_texture_border_clamp &&
ctx->Extensions.ARB_texture_compression &&
ctx->Extensions.ARB_texture_cube_map &&
ctx->Extensions.EXT_texture_env_add &&
ctx->Extensions.ARB_texture_env_combine &&
ctx->Extensions.ARB_texture_env_dot3)

View File

@@ -1,10 +1,10 @@
/* $Id: image.c,v 1.63.2.1 2002/03/19 16:42:41 brianp Exp $ */
/* $Id: image.c,v 1.63.2.7 2002/09/21 17:36:08 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.5
* Version: 4.0.4
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2002 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"),
@@ -57,7 +57,9 @@ const struct gl_pixelstore_attrib _mesa_native_packing = {
0, /* ImageHeight */
0, /* SkipImages */
GL_FALSE, /* SwapBytes */
GL_FALSE /* LsbFirst */
GL_FALSE, /* LsbFirst */
GL_FALSE, /* ClientStorage */
GL_FALSE /* Invert */
};
@@ -203,6 +205,9 @@ GLint _mesa_sizeof_packed_type( GLenum type )
return sizeof(GLuint);
case GL_UNSIGNED_INT_2_10_10_10_REV:
return sizeof(GLuint);
case GL_UNSIGNED_SHORT_8_8_MESA:
case GL_UNSIGNED_SHORT_8_8_REV_MESA:
return sizeof(GLushort);
default:
return -1;
}
@@ -245,6 +250,8 @@ GLint _mesa_components_in_format( GLenum format )
return 4;
case GL_ABGR_EXT:
return 4;
case GL_YCBCR_MESA:
return 2;
default:
return -1;
}
@@ -303,6 +310,12 @@ GLint _mesa_bytes_per_pixel( GLenum format, GLenum type )
return sizeof(GLuint);
else
return -1;
case GL_UNSIGNED_SHORT_8_8_MESA:
case GL_UNSIGNED_SHORT_8_8_REV_MESA:
if (format == GL_YCBCR_MESA)
return sizeof(GLushort);
else
return -1;
default:
return -1;
}
@@ -393,6 +406,12 @@ _mesa_is_legal_format_and_type( GLenum format, GLenum type )
default:
return GL_FALSE;
}
case GL_YCBCR_MESA:
if (type == GL_UNSIGNED_SHORT_8_8_MESA ||
type == GL_UNSIGNED_SHORT_8_8_REV_MESA)
return GL_TRUE;
else
return GL_FALSE;
default:
; /* fall-through */
}
@@ -476,6 +495,7 @@ _mesa_image_address( const struct gl_pixelstore_attrib *packing,
else {
/* Non-BITMAP data */
GLint bytes_per_pixel, bytes_per_row, remainder, bytes_per_image;
GLint topOfImage;
bytes_per_pixel = _mesa_bytes_per_pixel( format, type );
@@ -491,9 +511,19 @@ _mesa_image_address( const struct gl_pixelstore_attrib *packing,
bytes_per_image = bytes_per_row * rows_per_image;
if (packing->Invert) {
/* set pixel_addr to the last row */
topOfImage = bytes_per_row * (height - 1);
bytes_per_row = -bytes_per_row;
}
else {
topOfImage = 0;
}
/* compute final pixel address */
pixel_addr = (GLubyte *) image
+ (skipimages + img) * bytes_per_image
+ topOfImage
+ (skiprows + row) * bytes_per_row
+ (skippixels + column) * bytes_per_pixel;
}
@@ -514,14 +544,18 @@ _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
ASSERT(packing);
if (type == GL_BITMAP) {
/* BITMAP data */
GLint bytes;
if (packing->RowLength == 0) {
GLint bytes = (width + 7) / 8;
return bytes;
bytes = (width + 7) / 8;
}
else {
GLint bytes = (packing->RowLength + 7) / 8;
return bytes;
bytes = (packing->RowLength + 7) / 8;
}
if (packing->Invert) {
/* negate the bytes per row (negative row stride) */
bytes = -bytes;
}
return bytes;
}
else {
/* Non-BITMAP data */
@@ -538,6 +572,8 @@ _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
remainder = bytesPerRow % packing->Alignment;
if (remainder > 0)
bytesPerRow += (packing->Alignment - remainder);
if (packing->Invert)
bytesPerRow = -bytesPerRow;
return bytesPerRow;
}
}

View File

@@ -450,6 +450,7 @@ EXPORTS
_swrast_Clear
_glapi_get_context
_mesa_ResizeBuffersMESA
_tnl_MakeCurrent
wglCopyContext
wglCreateContext
wglDeleteContext

View File

@@ -1,10 +1,10 @@
/* $Id: mtypes.h,v 1.51.2.6 2002/06/14 03:49:09 brianp Exp $ */
/* $Id: mtypes.h,v 1.51.2.13 2002/09/23 16:39:43 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.5
* Version: 4.0.4
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2002 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"),
@@ -614,7 +614,6 @@ struct gl_pixel_attrib {
struct gl_point_attrib {
GLboolean SmoothFlag; /* True if GL_POINT_SMOOTH is enabled */
GLboolean SpriteMode; /* GL_MESA_sprite_point extension */
GLfloat Size; /* User-specified point size */
GLfloat _Size; /* Size clamped to Const.Min/MaxPointSize */
GLfloat Params[3]; /* GL_EXT_point_parameters */
@@ -669,49 +668,51 @@ struct gl_stencil_attrib {
#define R_BIT 4
#define Q_BIT 8
#define NUM_TEXTURE_TARGETS 4 /* 1D, 2D, 3D and CUBE */
#define NUM_TEXTURE_TARGETS 5 /* 1D, 2D, 3D, CUBE, and RECT */
/* Texture Enabled flags */
#define TEXTURE0_1D 0x1 /* Texture unit 0 (default) */
#define TEXTURE0_2D 0x2
#define TEXTURE0_3D 0x4
#define TEXTURE0_CUBE 0x8
#define TEXTURE0_ANY (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D | TEXTURE0_CUBE)
#define TEXTURE1_1D (TEXTURE0_1D << 4) /* Texture unit 1 */
#define TEXTURE1_2D (TEXTURE0_2D << 4)
#define TEXTURE1_3D (TEXTURE0_3D << 4)
#define TEXTURE1_CUBE (TEXTURE0_CUBE << 4)
#define TEXTURE1_ANY (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D | TEXTURE1_CUBE)
#define TEXTURE2_1D (TEXTURE0_1D << 8) /* Texture unit 2 */
#define TEXTURE2_2D (TEXTURE0_2D << 8)
#define TEXTURE2_3D (TEXTURE0_3D << 8)
#define TEXTURE2_CUBE (TEXTURE0_CUBE << 8)
#define TEXTURE2_ANY (TEXTURE2_1D | TEXTURE2_2D | TEXTURE2_3D | TEXTURE2_CUBE)
#define TEXTURE3_1D (TEXTURE0_1D << 12) /* Texture unit 3 */
#define TEXTURE3_2D (TEXTURE0_2D << 12)
#define TEXTURE3_3D (TEXTURE0_3D << 12)
#define TEXTURE3_CUBE (TEXTURE0_CUBE << 12)
#define TEXTURE3_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
#define TEXTURE4_1D (TEXTURE0_1D << 16) /* Texture unit 4 */
#define TEXTURE4_2D (TEXTURE0_2D << 16)
#define TEXTURE4_3D (TEXTURE0_3D << 16)
#define TEXTURE4_CUBE (TEXTURE0_CUBE << 16)
#define TEXTURE5_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
#define TEXTURE5_1D (TEXTURE0_1D << 20) /* Texture unit 5 */
#define TEXTURE5_2D (TEXTURE0_2D << 20)
#define TEXTURE5_3D (TEXTURE0_3D << 20)
#define TEXTURE5_CUBE (TEXTURE0_CUBE << 20)
#define TEXTURE5_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
#define TEXTURE6_1D (TEXTURE0_1D << 24) /* Texture unit 6 */
#define TEXTURE6_2D (TEXTURE0_2D << 24)
#define TEXTURE6_3D (TEXTURE0_3D << 24)
#define TEXTURE6_CUBE (TEXTURE0_CUBE << 24)
#define TEXTURE6_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
#define TEXTURE7_1D (TEXTURE0_1D << 28) /* Texture unit 7 */
#define TEXTURE7_2D (TEXTURE0_2D << 28)
#define TEXTURE7_3D (TEXTURE0_3D << 28)
#define TEXTURE7_CUBE (TEXTURE0_CUBE << 28)
#define TEXTURE7_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
#define TEXTURE0_RECT 0x10
#define TEXTURE0_ANY (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D | TEXTURE0_CUBE | TEXTURE0_RECT)
#define TEXTURE1_1D (TEXTURE0_1D << 5) /* Texture unit 1 */
#define TEXTURE1_2D (TEXTURE0_2D << 5)
#define TEXTURE1_3D (TEXTURE0_3D << 5)
#define TEXTURE1_CUBE (TEXTURE0_CUBE << 5)
#define TEXTURE1_RECT (TEXTURE0_RECT << 5)
#define TEXTURE1_ANY (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D | TEXTURE1_CUBE | TEXTURE1_RECT)
#define TEXTURE2_1D (TEXTURE0_1D << 10) /* Texture unit 2 */
#define TEXTURE2_2D (TEXTURE0_2D << 10)
#define TEXTURE2_3D (TEXTURE0_3D << 10)
#define TEXTURE2_CUBE (TEXTURE0_CUBE << 10)
#define TEXTURE2_RECT (TEXTURE0_RECT << 10)
#define TEXTURE2_ANY (TEXTURE2_1D | TEXTURE2_2D | TEXTURE2_3D | TEXTURE2_CUBE | TEXTURE2_RECT)
#define TEXTURE3_1D (TEXTURE0_1D << 15) /* Texture unit 3 */
#define TEXTURE3_2D (TEXTURE0_2D << 15)
#define TEXTURE3_3D (TEXTURE0_3D << 15)
#define TEXTURE3_CUBE (TEXTURE0_CUBE << 15)
#define TEXTURE3_RECT (TEXTURE0_RECT << 15)
#define TEXTURE3_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE | TEXTURE3_RECT)
#define TEXTURE4_1D (TEXTURE0_1D << 20) /* Texture unit 4 */
#define TEXTURE4_2D (TEXTURE0_2D << 20)
#define TEXTURE4_3D (TEXTURE0_3D << 20)
#define TEXTURE4_CUBE (TEXTURE0_CUBE << 20)
#define TEXTURE4_RECT (TEXTURE0_RECT << 20)
#define TEXTURE4_ANY (TEXTURE4_1D | TEXTURE4_2D | TEXTURE4_3D | TEXTURE4_CUBE | TEXTURE4_TECT)
#define TEXTURE5_1D (TEXTURE0_1D << 25) /* Texture unit 5 */
#define TEXTURE5_2D (TEXTURE0_2D << 25)
#define TEXTURE5_3D (TEXTURE0_3D << 25)
#define TEXTURE5_CUBE (TEXTURE0_CUBE << 25)
#define TEXTURE5_RECT (TEXTURE0_CUBE << 25)
#define TEXTURE5_ANY (TEXTURE5_1D | TEXTURE5_2D | TEXTURE5_3D | TEXTURE5_CUBE | TEXTURE5_RECT)
/* Bitmap versions of the GL_ constants.
*/
@@ -800,6 +801,7 @@ struct gl_texture_image {
GLuint Width; /* = 2^WidthLog2 + 2*Border */
GLuint Height; /* = 2^HeightLog2 + 2*Border */
GLuint Depth; /* = 2^DepthLog2 + 2*Border */
GLuint RowStride; /* == Width unless IsClientData and padded */
GLuint Width2; /* = Width - 2*Border */
GLuint Height2; /* = Height - 2*Border */
GLuint Depth2; /* = Depth - 2*Border */
@@ -808,6 +810,7 @@ struct gl_texture_image {
GLuint DepthLog2; /* = log2(Depth2) */
GLuint MaxLog2; /* = MAX(WidthLog2, HeightLog2) */
GLvoid *Data; /* Image data, accessed via FetchTexel() */
GLboolean IsClientData; /* Data owned by client? */
const struct gl_texture_format *TexFormat;
@@ -826,7 +829,7 @@ struct gl_texture_object {
_glthread_Mutex Mutex; /* for thread safety */
GLint RefCount; /* reference count */
GLuint Name; /* an unsigned integer */
GLuint Dimensions; /* 1 or 2 or 3 or 6 (cube map) */
GLenum Target; /* GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */
GLfloat Priority; /* in [0,1] */
GLchan BorderColor[4];
GLenum WrapS; /* Wrap modes are: GL_CLAMP, REPEAT */
@@ -872,8 +875,8 @@ struct gl_texture_object {
* Texture units are new with the multitexture extension.
*/
struct gl_texture_unit {
GLuint Enabled; /* bitmask of TEXTURE0_1D, _2D, _3D, _CUBE */
GLuint _ReallyEnabled; /* 0 or one of TEXTURE0_1D, _2D, _3D, _CUBE */
GLuint Enabled; /* bitmask of TEXTURE0_1D, _2D, _3D, _CUBE, _RECT */
GLuint _ReallyEnabled; /* 0 or one of TEXTURE0_1D, _2D, _3D, _CUBE, _RECT */
GLenum EnvMode; /* GL_MODULATE, GL_DECAL, GL_BLEND, etc. */
GLfloat EnvColor[4];
@@ -911,13 +914,15 @@ struct gl_texture_unit {
struct gl_texture_object *Current2D;
struct gl_texture_object *Current3D;
struct gl_texture_object *CurrentCubeMap; /* GL_ARB_texture_cube_map */
struct gl_texture_object *CurrentRect; /* GL_NV_texture_rectangle */
struct gl_texture_object *_Current; /* Points to really enabled tex obj */
struct gl_texture_object Saved1D; /* only used by glPush/PopAttrib */
struct gl_texture_object Saved2D;
struct gl_texture_object Saved3D;
struct gl_texture_object SavedCubeMap;
struct gl_texture_object SavedCubeMap; /* GL_ARB_texture_cube_map */
struct gl_texture_object SavedRect; /* GL_NV_texture_rectangle */
};
@@ -927,8 +932,8 @@ struct gl_texture_attrib {
GLuint _ReallyEnabled; /* enables for all texture units: */
/* = (Unit[0]._ReallyEnabled << 0) | */
/* (Unit[1]._ReallyEnabled << 4) | */
/* (Unit[2]._ReallyEnabled << 8) | etc... */
/* (Unit[1]._ReallyEnabled << 5) | */
/* (Unit[2]._ReallyEnabled << 10) | etc... */
GLuint _GenFlags; /* for texgen */
GLuint _TexGenEnabled;
@@ -939,7 +944,8 @@ struct gl_texture_attrib {
struct gl_texture_object *Proxy1D;
struct gl_texture_object *Proxy2D;
struct gl_texture_object *Proxy3D;
struct gl_texture_object *ProxyCubeMap;
struct gl_texture_object *ProxyCubeMap; /* GL_ARB_texture_cube_map */
struct gl_texture_object *ProxyRect; /* GL_NV_texture_rectangle */
/* GL_EXT_shared_texture_palette */
GLboolean SharedPalette;
@@ -987,6 +993,8 @@ struct gl_pixelstore_attrib {
GLint SkipImages; /* for GL_EXT_texture3D */
GLboolean SwapBytes;
GLboolean LsbFirst;
GLboolean ClientStorage; /* GL_APPLE_client_storage */
GLboolean Invert; /* GL_MESA_pack_invert */
};
@@ -1113,6 +1121,7 @@ struct gl_shared_state {
struct gl_texture_object *Default2D;
struct gl_texture_object *Default3D;
struct gl_texture_object *DefaultCubeMap;
struct gl_texture_object *DefaultRect;
void *DriverData; /* Device driver shared state */
};
@@ -1163,7 +1172,8 @@ struct gl_frame_buffer {
struct gl_constants {
GLint MaxTextureLevels;
GLint Max3DTextureLevels;
GLint MaxCubeTextureLevels;
GLint MaxCubeTextureLevels; /* GL_ARB_texture_cube_map */
GLint MaxTextureRectSize; /* GL_NV_texture_rectangle */
GLuint MaxTextureUnits;
GLfloat MaxTextureMaxAnisotropy; /* GL_EXT_texture_filter_anisotropic */
GLfloat MaxTextureLodBias; /* GL_EXT_texture_lod_bias */
@@ -1235,11 +1245,13 @@ struct gl_extensions {
GLboolean HP_occlusion_test;
GLboolean IBM_rasterpos_clip;
GLboolean INGR_blend_func_separate;
GLboolean MESA_pack_invert;
GLboolean MESA_window_pos;
GLboolean MESA_resize_buffers;
GLboolean MESA_sprite_point;
GLboolean MESA_ycbcr_texture;
GLboolean NV_blend_square;
GLboolean NV_texgen_reflection;
GLboolean NV_texture_rectangle;
GLboolean SGI_color_matrix;
GLboolean SGI_color_table;
GLboolean SGIS_generate_mipmap;
@@ -1250,6 +1262,7 @@ struct gl_extensions {
GLboolean SGIX_shadow;
GLboolean SGIX_shadow_ambient;
GLboolean _3DFX_texture_compression_FXT1;
GLboolean APPLE_client_storage;
};

View File

@@ -1,8 +1,8 @@
/* $Id: pixel.c,v 1.31.2.2 2002/04/24 20:41:51 brianp Exp $ */
/* $Id: pixel.c,v 1.31.2.4 2002/09/21 17:12:34 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.0.3
* Version: 4.0.4
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -146,6 +146,17 @@ _mesa_PixelStorei( GLenum pname, GLint param )
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
ctx->Pack.Alignment = param;
break;
case GL_PACK_INVERT_MESA:
if (!ctx->Extensions.MESA_pack_invert) {
_mesa_error( ctx, GL_INVALID_ENUM, "glPixelstore(pname)" );
return;
}
if (ctx->Pack.Invert == param)
return;
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
ctx->Pack.Invert = param;
break;
case GL_UNPACK_SWAP_BYTES:
if (param == (GLint)ctx->Unpack.SwapBytes)
return;
@@ -223,6 +234,13 @@ _mesa_PixelStorei( GLenum pname, GLint param )
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
ctx->Unpack.Alignment = param;
break;
case GL_UNPACK_CLIENT_STORAGE_APPLE:
if (param == (GLint)ctx->Unpack.ClientStorage)
return;
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
ctx->Unpack.ClientStorage = param ? GL_TRUE : GL_FALSE;
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" );
return;

View File

@@ -1,8 +1,8 @@
/* $Id: state.c,v 1.69.2.4 2002/06/06 16:25:08 brianp Exp $ */
/* $Id: state.c,v 1.69.2.5 2002/08/28 01:13:35 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.5
* Version: 4.0.4
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
@@ -773,6 +773,17 @@ update_texture_state( GLcontext *ctx )
}
}
if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_RECT)) {
struct gl_texture_object *texObj = texUnit->CurrentRect;
if (!texObj->Complete) {
_mesa_test_texobj_completeness(ctx, texObj);
}
if (texObj->Complete) {
texUnit->_ReallyEnabled = TEXTURE0_RECT;
texUnit->_Current = texObj;
}
}
if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_2D)) {
struct gl_texture_object *texObj = texUnit->Current2D;
if (!texObj->Complete) {

View File

@@ -1,10 +1,10 @@
/* $Id: texformat.c,v 1.11 2001/06/15 14:18:46 brianp Exp $ */
/* $Id: texformat.c,v 1.11.2.2 2002/09/20 19:40:54 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.5
* Version: 4.0.4
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2002 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"),
@@ -23,8 +23,9 @@
* 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.
*
* Author:
* Authors:
* Gareth Hughes <gareth@valinux.com>
* Brian Paul
*/
#ifdef PC_HEADER
@@ -438,6 +439,45 @@ const struct gl_texture_format _mesa_texformat_ci8 = {
};
const struct gl_texture_format _mesa_texformat_ycbcr = {
MESA_FORMAT_YCBCR, /* MesaFormat */
GL_YCBCR_MESA, /* BaseFormat */
GL_UNSIGNED_SHORT_8_8_MESA, /* Type */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
0, /* AlphaBits */
0, /* LuminanceBits */
0, /* IntensityBits */
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
fetch_1d_texel_ycbcr, /* FetchTexel1D */
fetch_2d_texel_ycbcr, /* FetchTexel2D */
fetch_3d_texel_ycbcr, /* FetchTexel3D */
};
const struct gl_texture_format _mesa_texformat_ycbcr_rev = {
MESA_FORMAT_YCBCR_REV, /* MesaFormat */
GL_YCBCR_MESA, /* BaseFormat */
GL_UNSIGNED_SHORT_8_8_REV_MESA, /* Type */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
0, /* AlphaBits */
0, /* LuminanceBits */
0, /* IntensityBits */
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
fetch_1d_texel_ycbcr_rev, /* FetchTexel1D */
fetch_2d_texel_ycbcr_rev, /* FetchTexel2D */
fetch_3d_texel_ycbcr_rev, /* FetchTexel3D */
};
/* =============================================================
* Null format:
*/
@@ -590,6 +630,12 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
_mesa_problem(ctx, "texture compression extension not enabled");
return &_mesa_texformat_rgba;
case GL_YCBCR_MESA:
if (type == GL_UNSIGNED_SHORT_8_8_MESA)
return &_mesa_texformat_ycbcr;
else
return &_mesa_texformat_ycbcr_rev;
default:
_mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()");
printf("intformat = %d %x\n", internalFormat, internalFormat);

View File

@@ -1,10 +1,10 @@
/* $Id: texformat.h,v 1.7.2.1 2002/06/08 12:43:40 brianp Exp $ */
/* $Id: texformat.h,v 1.7.2.3 2002/09/21 18:18:09 keithw Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.5
* Version: 4.0.4
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2002 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"),
@@ -23,8 +23,9 @@
* 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.
*
* Author:
* Authors:
* Gareth Hughes <gareth@valinux.com>
* Brian Paul
*/
#ifndef TEXFORMAT_H
@@ -33,8 +34,7 @@
#include "mtypes.h"
/* The Mesa internal texture image types. These will be set to their
* default value, but may be changed by drivers as required.
/* The Mesa internal texture image types.
*/
enum _format {
/* Hardware-friendly formats. Drivers can override the default
@@ -61,6 +61,8 @@ enum _format {
MESA_FORMAT_L8, /* LLLL LLLL */
MESA_FORMAT_I8, /* IIII IIII */
MESA_FORMAT_CI8, /* CCCC CCCC */
MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */
MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */
/* Generic GLchan-based formats. These are the default formats used
* by the software rasterizer and, unless the driver overrides the
@@ -91,11 +93,11 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type );
extern GLint
_mesa_base_compressed_texformat(GLcontext *ctx, GLint intFormat);
_mesa_base_compressed_texformat( GLcontext *ctx, GLint intFormat );
extern GLint
_mesa_compressed_texture_size(GLcontext *ctx,
const struct gl_texture_image *texImage);
_mesa_compressed_texture_size( GLcontext *ctx,
const struct gl_texture_image *texImage );
/* The default formats, GLchan per component:
@@ -123,6 +125,8 @@ extern const struct gl_texture_format _mesa_texformat_a8;
extern const struct gl_texture_format _mesa_texformat_l8;
extern const struct gl_texture_format _mesa_texformat_i8;
extern const struct gl_texture_format _mesa_texformat_ci8;
extern const struct gl_texture_format _mesa_texformat_ycbcr;
extern const struct gl_texture_format _mesa_texformat_ycbcr_rev;
/* The null format:
*/

View File

@@ -1,10 +1,10 @@
/* $Id: texformat_tmp.h,v 1.3.2.1 2002/05/09 20:51:32 keithw Exp $ */
/* $Id: texformat_tmp.h,v 1.3.2.4 2002/09/23 16:39:44 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.5
* Version: 4.0.4
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2002 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"),
@@ -23,8 +23,9 @@
* 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.
*
* Author:
* Authors:
* Gareth Hughes <gareth@valinux.com>
* Brian Paul
*/
#if DIM == 1
@@ -43,13 +44,13 @@
#elif DIM == 2
#define CHAN_SRC( t, i, j, k, sz ) \
((GLchan *)(t)->Data + ((t)->Width * (j) + (i)) * (sz))
((GLchan *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))
#define UBYTE_SRC( t, i, j, k, sz ) \
((GLubyte *)(t)->Data + ((t)->Width * (j) + (i)) * (sz))
((GLubyte *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))
#define USHORT_SRC( t, i, j, k ) \
((GLushort *)(t)->Data + ((t)->Width * (j) + (i)))
((GLushort *)(t)->Data + ((t)->RowStride * (j) + (i)))
#define FLOAT_SRC( t, i, j, k ) \
((GLfloat *)(t)->Data + ((t)->Width * (j) + (i)))
((GLfloat *)(t)->Data + ((t)->RowStride * (j) + (i)))
#define FETCH(x) fetch_2d_texel_##x
@@ -57,16 +58,16 @@
#define CHAN_SRC( t, i, j, k, sz ) \
(GLchan *)(t)->Data + (((t)->Height * (k) + (j)) * \
(t)->Width + (i)) * (sz)
(t)->RowStride + (i)) * (sz)
#define UBYTE_SRC( t, i, j, k, sz ) \
((GLubyte *)(t)->Data + (((t)->Height * (k) + (j)) * \
(t)->Width + (i)) * (sz))
(t)->RowStride + (i)) * (sz))
#define USHORT_SRC( t, i, j, k ) \
((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \
(t)->Width + (i)))
(t)->RowStride + (i)))
#define FLOAT_SRC( t, i, j, k ) \
((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \
(t)->Width + (i)))
(t)->RowStride + (i)))
#define FETCH(x) fetch_3d_texel_##x
@@ -191,7 +192,8 @@ static void FETCH(rgb565)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src;
const GLushort s = *src;
GLchan *rgba = (GLchan *) texel;
rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) * 255 / 0xf8 );
rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) * 255 / 0xfc );
rgba[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) * 255 / 0xf8 );
@@ -202,7 +204,8 @@ static void FETCH(argb4444)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src;
const GLushort s = *src;
GLchan *rgba = (GLchan *) texel;
rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
@@ -213,7 +216,8 @@ static void FETCH(argb1555)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src;
const GLushort s = *src;
GLchan *rgba = (GLchan *) texel;
rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0x1f) * 255 / 0x1f );
rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0x1f) * 255 / 0x1f );
rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0x1f) * 255 / 0x1f );
@@ -235,7 +239,8 @@ static void FETCH(rgb332)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
{
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
GLchan *rgba = (GLchan *) texel; GLubyte s = *src;
const GLubyte s = *src;
GLchan *rgba = (GLchan *) texel;
rgba[RCOMP] = UBYTE_TO_CHAN( ((s ) & 0xe0) * 255 / 0xe0 );
rgba[GCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xe0) * 255 / 0xe0 );
rgba[BCOMP] = UBYTE_TO_CHAN( ((s << 5) & 0xc0) * 255 / 0xc0 );
@@ -283,6 +288,66 @@ static void FETCH(ci8)( const struct gl_texture_image *texImage,
*index = UBYTE_TO_CHAN( *src );
}
/* XXX this may break if GLchan != GLubyte */
static void FETCH(ycbcr)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
{
const GLushort *src0 = USHORT_SRC( texImage, (i & ~1), j, k ); /* even */
const GLushort *src1 = src0 + 1; /* odd */
const GLubyte y0 = (*src0 >> 8) & 0xff; /* luminance */
const GLubyte cb = *src0 & 0xff; /* chroma U */
const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */
const GLubyte cr = *src1 & 0xff; /* chroma V */
GLchan *rgba = (GLchan *) texel;
GLint r, g, b;
if (i & 1) {
/* odd pixel: use y1,cr,cb */
r = (GLint) (1.164 * (y1-16) + 1.596 * (cr-128));
g = (GLint) (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
b = (GLint) (1.164 * (y1-16) + 2.018 * (cb-128));
}
else {
/* even pixel: use y0,cr,cb */
r = (GLint) (1.164 * (y0-16) + 1.596 * (cr-128));
g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128));
}
rgba[RCOMP] = CLAMP(r, 0, CHAN_MAX);
rgba[GCOMP] = CLAMP(g, 0, CHAN_MAX);
rgba[BCOMP] = CLAMP(b, 0, CHAN_MAX);
rgba[ACOMP] = CHAN_MAX;
}
/* XXX this may break if GLchan != GLubyte */
static void FETCH(ycbcr_rev)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
{
const GLushort *src0 = USHORT_SRC( texImage, (i & ~1), j, k ); /* even */
const GLushort *src1 = src0 + 1; /* odd */
const GLubyte y0 = *src0 & 0xff; /* luminance */
const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma U */
const GLubyte y1 = *src1 & 0xff; /* luminance */
const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma V */
GLchan *rgba = (GLchan *) texel;
GLint r, g, b;
if (i & 1) {
/* odd pixel: use y1,cr,cb */
r = (GLint) (1.164 * (y1-16) + 1.596 * (cr-128));
g = (GLint) (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
b = (GLint) (1.164 * (y1-16) + 2.018 * (cb-128));
}
else {
/* even pixel: use y0,cr,cb */
r = (GLint) (1.164 * (y0-16) + 1.596 * (cr-128));
g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128));
}
rgba[RCOMP] = CLAMP(r, 0, CHAN_MAX);
rgba[GCOMP] = CLAMP(g, 0, CHAN_MAX);
rgba[BCOMP] = CLAMP(b, 0, CHAN_MAX);
rgba[ACOMP] = CHAN_MAX;
}
#undef CHAN_SRC
#undef UBYTE_SRC

View File

@@ -1,8 +1,8 @@
/* $Id: teximage.c,v 1.104.2.4 2002/06/08 13:05:07 brianp Exp $ */
/* $Id: teximage.c,v 1.104.2.13 2002/10/02 17:24:40 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.0.3
* Version: 4.0.4
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -102,6 +102,7 @@ static void PrintTexture(const struct gl_texture_image *img)
printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]);
data += c;
}
data += (img->RowStride - img->Width) * c;
printf("\n");
}
#endif
@@ -223,6 +224,11 @@ _mesa_base_tex_format( GLcontext *ctx, GLint format )
return GL_DEPTH_COMPONENT;
else
return -1;
case GL_YCBCR_MESA:
if (ctx->Extensions.MESA_ycbcr_texture)
return GL_YCBCR_MESA;
else
return -1;
default:
return -1; /* error */
}
@@ -280,6 +286,7 @@ is_color_format(GLenum format)
case GL_RGBA12:
case GL_RGBA16:
return GL_TRUE;
case GL_YCBCR_MESA: /* not considered to be RGB */
default:
return GL_FALSE;
}
@@ -359,6 +366,10 @@ _mesa_set_tex_image(struct gl_texture_object *tObj,
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
tObj->NegZ[level] = texImage;
return;
case GL_TEXTURE_RECTANGLE_NV:
ASSERT(level == 0);
tObj->Image[level] = texImage;
return;
default:
_mesa_problem(NULL, "bad target in _mesa_set_tex_image()");
return;
@@ -435,6 +446,12 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit,
case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
return ctx->Extensions.ARB_texture_cube_map
? ctx->Texture.ProxyCubeMap : NULL;
case GL_TEXTURE_RECTANGLE_NV:
return ctx->Extensions.NV_texture_rectangle
? texUnit->CurrentRect : NULL;
case GL_PROXY_TEXTURE_RECTANGLE_NV:
return ctx->Extensions.NV_texture_rectangle
? ctx->Texture.ProxyRect : NULL;
default:
_mesa_problem(NULL, "bad target in _mesa_select_tex_object()");
return NULL;
@@ -500,6 +517,22 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit,
return ctx->Texture.ProxyCubeMap->Image[level];
else
return NULL;
case GL_TEXTURE_RECTANGLE_NV:
if (ctx->Extensions.NV_texture_rectangle) {
ASSERT(level == 0);
return texUnit->CurrentRect->Image[level];
}
else {
return NULL;
}
case GL_PROXY_TEXTURE_RECTANGLE_NV:
if (ctx->Extensions.NV_texture_rectangle) {
ASSERT(level == 0);
return ctx->Texture.ProxyRect->Image[level];
}
else {
return NULL;
}
default:
_mesa_problem(ctx, "bad target in _mesa_select_tex_image()");
return NULL;
@@ -580,6 +613,7 @@ clear_teximage_fields(struct gl_texture_image *img)
img->Width = 0;
img->Height = 0;
img->Depth = 0;
img->RowStride = 0;
img->Width2 = 0;
img->Height2 = 0;
img->Depth2 = 0;
@@ -598,7 +632,7 @@ clear_teximage_fields(struct gl_texture_image *img)
* Initialize basic fields of the gl_texture_image struct.
*/
void
_mesa_init_teximage_fields(GLcontext *ctx,
_mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
struct gl_texture_image *img,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum internalFormat)
@@ -611,6 +645,7 @@ _mesa_init_teximage_fields(GLcontext *ctx,
img->Width = width;
img->Height = height;
img->Depth = depth;
img->RowStride = img->Width;
img->WidthLog2 = logbase2(width - 2 * border);
if (height == 1) /* 1-D texture */
img->HeightLog2 = 0;
@@ -648,31 +683,73 @@ texture_error_check( GLcontext *ctx, GLenum target,
GLint maxLevels = 0, maxTextureSize;
if (dimensions == 1) {
isProxy = (GLboolean) (target == GL_PROXY_TEXTURE_1D);
if (target != GL_TEXTURE_1D && !isProxy) {
if (target == GL_PROXY_TEXTURE_1D) {
isProxy = GL_TRUE;
}
else if (target == GL_TEXTURE_1D) {
isProxy = GL_FALSE;
}
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" );
return GL_TRUE;
}
maxLevels = ctx->Const.MaxTextureLevels;
}
else if (dimensions == 2) {
isProxy = (GLboolean) (target == GL_PROXY_TEXTURE_2D ||
target == GL_PROXY_TEXTURE_CUBE_MAP_ARB);
if (target != GL_TEXTURE_2D && !isProxy &&
!(ctx->Extensions.ARB_texture_cube_map &&
target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexImage2D(target)" );
return GL_TRUE;
}
if (target == GL_PROXY_TEXTURE_2D || target == GL_TEXTURE_2D)
if (target == GL_PROXY_TEXTURE_2D) {
isProxy = GL_TRUE;
maxLevels = ctx->Const.MaxTextureLevels;
else
}
else if (target == GL_TEXTURE_2D) {
isProxy = GL_FALSE;
maxLevels = ctx->Const.MaxTextureLevels;
}
else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) {
if (!ctx->Extensions.ARB_texture_cube_map) {
_mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
return GL_TRUE;
}
isProxy = GL_TRUE;
maxLevels = ctx->Const.MaxCubeTextureLevels;
}
else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
if (!ctx->Extensions.ARB_texture_cube_map) {
_mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
return GL_TRUE;
}
isProxy = GL_FALSE;
maxLevels = ctx->Const.MaxCubeTextureLevels;
}
else if (target == GL_PROXY_TEXTURE_RECTANGLE_NV) {
if (!ctx->Extensions.NV_texture_rectangle) {
_mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
return GL_TRUE;
}
isProxy = GL_TRUE;
maxLevels = 1;
}
else if (target == GL_TEXTURE_RECTANGLE_NV) {
if (!ctx->Extensions.NV_texture_rectangle) {
_mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
return GL_TRUE;
}
isProxy = GL_FALSE;
maxLevels = 1;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
return GL_TRUE;
}
}
else if (dimensions == 3) {
isProxy = (GLboolean) (target == GL_PROXY_TEXTURE_3D);
if (target != GL_TEXTURE_3D && !isProxy) {
if (target == GL_PROXY_TEXTURE_3D) {
isProxy = GL_TRUE;
}
else if (target == GL_TEXTURE_3D) {
isProxy = GL_FALSE;
}
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexImage3D(target)" );
return GL_TRUE;
}
@@ -695,9 +772,24 @@ texture_error_check( GLcontext *ctx, GLenum target,
}
return GL_TRUE;
}
if ((target == GL_TEXTURE_RECTANGLE_NV ||
target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0) {
return GL_TRUE;
}
/* Width */
if (width < 2 * border || width > 2 + maxTextureSize
if (target == GL_TEXTURE_RECTANGLE_NV ||
target == GL_PROXY_TEXTURE_RECTANGLE_NV) {
if (width < 1 || width > ctx->Const.MaxTextureRectSize) {
if (!isProxy) {
char message[100];
sprintf(message, "glTexImage%dD(width=%d)", dimensions, width);
_mesa_error(ctx, GL_INVALID_VALUE, message);
}
return GL_TRUE;
}
}
else if (width < 2 * border || width > 2 + maxTextureSize
|| logbase2( width - 2 * border ) < 0) {
if (!isProxy) {
char message[100];
@@ -708,7 +800,18 @@ texture_error_check( GLcontext *ctx, GLenum target,
}
/* Height */
if (dimensions >= 2) {
if (target == GL_TEXTURE_RECTANGLE_NV ||
target == GL_PROXY_TEXTURE_RECTANGLE_NV) {
if (height < 1 || height > ctx->Const.MaxTextureRectSize) {
if (!isProxy) {
char message[100];
sprintf(message, "glTexImage%dD(height=%d)", dimensions, height);
_mesa_error(ctx, GL_INVALID_VALUE, message);
}
return GL_TRUE;
}
}
else if (dimensions >= 2) {
if (height < 2 * border || height > 2 + maxTextureSize
|| logbase2( height - 2 * border ) < 0) {
if (!isProxy) {
@@ -745,7 +848,18 @@ texture_error_check( GLcontext *ctx, GLenum target,
}
/* Level */
if (level < 0 || level >= maxLevels) {
if (target == GL_TEXTURE_RECTANGLE_NV ||
target == GL_PROXY_TEXTURE_RECTANGLE_NV) {
if (level != 0) {
if (!isProxy) {
char message[100];
sprintf(message, "glTexImage%dD(level=%d)", dimensions, level);
_mesa_error(ctx, GL_INVALID_VALUE, message);
}
return GL_TRUE;
}
}
else if (level < 0 || level >= maxLevels) {
if (!isProxy) {
char message[100];
sprintf(message, "glTexImage%dD(level=%d)", dimensions, level);
@@ -789,6 +903,41 @@ texture_error_check( GLcontext *ctx, GLenum target,
return GL_TRUE;
}
if (format == GL_YCBCR_MESA || iformat == GL_YCBCR_MESA) {
ASSERT(ctx->Extensions.MESA_ycbcr_texture);
if (format != GL_YCBCR_MESA ||
iformat != GL_YCBCR_MESA ||
(type != GL_UNSIGNED_SHORT_8_8_MESA &&
type != GL_UNSIGNED_SHORT_8_8_REV_MESA)) {
if (!isProxy) {
char message[100];
sprintf(message,
"glTexImage%d(format/type/internalFormat YCBCR mismatch)",
dimensions);
_mesa_error(ctx, GL_INVALID_ENUM, message);
}
return GL_TRUE; /* error */
}
if (target != GL_TEXTURE_2D &&
target != GL_PROXY_TEXTURE_2D &&
target != GL_TEXTURE_RECTANGLE_NV &&
target != GL_PROXY_TEXTURE_RECTANGLE_NV) {
if (!isProxy)
_mesa_error(ctx, GL_INVALID_ENUM, "glTexImage(target)");
return GL_TRUE;
}
if (border != 0) {
if (!isProxy) {
char message[100];
sprintf(message,
"glTexImage%d(format=GL_YCBCR_MESA and border=%d)",
dimensions, border);
_mesa_error(ctx, GL_INVALID_VALUE, message);
}
return GL_TRUE;
}
}
/* if we get here, the parameters are OK */
return GL_FALSE;
}
@@ -814,36 +963,40 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions,
GLboolean compressed;
if (dimensions == 1) {
if (target != GL_TEXTURE_1D) {
if (target == GL_TEXTURE_1D) {
maxLevels = ctx->Const.MaxTextureLevels;
}
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage1D(target)" );
return GL_TRUE;
}
maxLevels = ctx->Const.MaxTextureLevels;
}
else if (dimensions == 2) {
if (ctx->Extensions.ARB_texture_cube_map) {
if ((target < GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB ||
target > GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) &&
target != GL_TEXTURE_2D) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" );
return GL_TRUE;
}
if (ctx->Extensions.ARB_texture_cube_map &&
target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
target <=GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
maxLevels = ctx->Const.MaxCubeTextureLevels;
}
else if (target != GL_TEXTURE_2D) {
else if (ctx->Extensions.NV_texture_rectangle &&
target == GL_TEXTURE_RECTANGLE_NV) {
maxLevels = 1;
}
else if (target == GL_TEXTURE_2D) {
maxLevels = ctx->Const.MaxTextureLevels;
}
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" );
return GL_TRUE;
}
if (target == GL_PROXY_TEXTURE_2D && target == GL_TEXTURE_2D)
maxLevels = ctx->Const.MaxTextureLevels;
else
maxLevels = ctx->Const.MaxCubeTextureLevels;
}
else if (dimensions == 3) {
if (target != GL_TEXTURE_3D) {
if (target == GL_TEXTURE_3D) {
maxLevels = ctx->Const.Max3DTextureLevels;
}
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage3D(target)" );
return GL_TRUE;
}
maxLevels = ctx->Const.Max3DTextureLevels;
}
else {
_mesa_problem( ctx, "bad dims in texture_error_check" );
@@ -881,7 +1034,7 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions,
destTex = _mesa_select_tex_image(ctx, texUnit, target, level);
if (!destTex) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glTexSubImage2D");
_mesa_error(ctx, GL_INVALID_OPERATION, "glTexSubImage1/2/3D");
return GL_TRUE;
}
@@ -966,10 +1119,15 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions,
maxLevels = ctx->Const.MaxTextureLevels;
}
else if (dimensions == 2) {
if (ctx->Extensions.ARB_texture_cube_map) {
if ((target < GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB ||
target > GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) &&
target != GL_TEXTURE_2D) {
if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
if (!ctx->Extensions.ARB_texture_cube_map) {
_mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" );
return GL_TRUE;
}
}
else if (target == GL_TEXTURE_RECTANGLE_NV) {
if (!ctx->Extensions.NV_texture_rectangle) {
_mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" );
return GL_TRUE;
}
@@ -980,6 +1138,8 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions,
}
if (target == GL_TEXTURE_2D)
maxLevels = ctx->Const.MaxTextureLevels;
else if (target == GL_TEXTURE_RECTANGLE_NV)
maxLevels = 1;
else
maxLevels = ctx->Const.MaxCubeTextureLevels;
}
@@ -1181,6 +1341,11 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions,
}
}
if (teximage->IntFormat == GL_YCBCR_MESA) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage2D");
return GL_TRUE;
}
/* if we get here, the parameters are OK */
return GL_FALSE;
}
@@ -1193,7 +1358,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
{
const struct gl_texture_unit *texUnit;
const struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
const struct gl_texture_image *texImage;
GLint maxLevels = 0;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -1211,6 +1376,9 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
else if (target == GL_TEXTURE_3D) {
maxLevels = ctx->Const.Max3DTextureLevels;
}
else if (target == GL_TEXTURE_RECTANGLE_NV) {
maxLevels = 1;
}
else {
maxLevels = ctx->Const.MaxCubeTextureLevels;
}
@@ -1241,6 +1409,10 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
}
if (!ctx->Extensions.MESA_ycbcr_texture && format == GL_YCBCR_MESA) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
}
/* XXX what if format/type doesn't match texture format/type? */
if (!pixels)
@@ -1265,7 +1437,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
for (img = 0; img < depth; img++) {
for (row = 0; row < height; row++) {
/* compute destination address in client memory */
GLvoid *dest = _mesa_image_address( &ctx->Unpack, pixels,
GLvoid *dest = _mesa_image_address( &ctx->Pack, pixels,
width, height, format, type,
img, row, 0);
assert(dest);
@@ -1291,6 +1463,23 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
_mesa_pack_depth_span(ctx, width, dest, type,
depthRow, &ctx->Pack);
}
else if (format == GL_YCBCR_MESA) {
const GLint rowstride = texImage->RowStride;
/* No pixel transfer */
MEMCPY(dest, (const GLushort *) texImage->Data + row * rowstride,
width * sizeof(GLushort));
/* check for byte swapping */
if ((texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR
&& type == GL_UNSIGNED_SHORT_8_8_REV_MESA) ||
(texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV
&& type == GL_UNSIGNED_SHORT_8_8_MESA)) {
if (!ctx->Pack.SwapBytes)
_mesa_swap2((GLushort *) dest, width);
}
else if (ctx->Pack.SwapBytes) {
_mesa_swap2((GLushort *) dest, width);
}
}
else {
/* general case: convert row to RGBA format */
GLchan rgba[MAX_WIDTH][4];
@@ -1354,7 +1543,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
texImage->Data = NULL;
}
clear_teximage_fields(texImage); /* not really needed, but helpful */
_mesa_init_teximage_fields(ctx, texImage, postConvWidth, 1, 1,
_mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1,
border, internalFormat);
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
@@ -1410,7 +1599,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
struct gl_texture_image *texImage;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
_mesa_init_teximage_fields(ctx, texImage, postConvWidth, 1, 1,
_mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1,
border, internalFormat);
ASSERT(ctx->Driver.TestProxyTexImage);
error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level,
@@ -1449,7 +1638,9 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
if (target == GL_TEXTURE_2D ||
(ctx->Extensions.ARB_texture_cube_map &&
target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) {
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) ||
(ctx->Extensions.NV_texture_rectangle &&
target == GL_TEXTURE_RECTANGLE_NV)) {
/* non-proxy target */
struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
@@ -1479,7 +1670,8 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
texImage->Data = NULL;
}
clear_teximage_fields(texImage); /* not really needed, but helpful */
_mesa_init_teximage_fields(ctx, texImage, postConvWidth, postConvHeight,
_mesa_init_teximage_fields(ctx, target, texImage,
postConvWidth, postConvHeight,
1, border, internalFormat);
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
@@ -1527,7 +1719,9 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
}
else if (target == GL_PROXY_TEXTURE_2D ||
(target == GL_PROXY_TEXTURE_CUBE_MAP_ARB &&
ctx->Extensions.ARB_texture_cube_map)) {
ctx->Extensions.ARB_texture_cube_map) ||
(target == GL_PROXY_TEXTURE_RECTANGLE_NV &&
ctx->Extensions.NV_texture_rectangle)) {
/* Proxy texture: check for errors and update proxy state */
GLenum error = texture_error_check(ctx, target, level, internalFormat,
format, type, 2,
@@ -1537,7 +1731,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
struct gl_texture_image *texImage;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
_mesa_init_teximage_fields(ctx, texImage, postConvWidth,
_mesa_init_teximage_fields(ctx, target, texImage, postConvWidth,
postConvHeight, 1, border, internalFormat);
ASSERT(ctx->Driver.TestProxyTexImage);
error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level,
@@ -1600,8 +1794,8 @@ _mesa_TexImage3D( GLenum target, GLint level, GLenum internalFormat,
texImage->Data = NULL;
}
clear_teximage_fields(texImage); /* not really needed, but helpful */
_mesa_init_teximage_fields(ctx, texImage, width, height, depth, border,
internalFormat);
_mesa_init_teximage_fields(ctx, target, texImage, width, height, depth,
border, internalFormat);
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
@@ -1657,7 +1851,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLenum internalFormat,
struct gl_texture_image *texImage;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
_mesa_init_teximage_fields(ctx, texImage, width, height, 1,
_mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
border, internalFormat);
ASSERT(ctx->Driver.TestProxyTexImage);
error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level,
@@ -1871,7 +2065,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
}
clear_teximage_fields(texImage); /* not really needed, but helpful */
_mesa_init_teximage_fields(ctx, texImage, postConvWidth, 1, 1,
_mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1,
border, internalFormat);
@@ -1935,7 +2129,8 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
}
clear_teximage_fields(texImage); /* not really needed, but helpful */
_mesa_init_teximage_fields(ctx, texImage, postConvWidth, postConvHeight, 1,
_mesa_init_teximage_fields(ctx, target, texImage,
postConvWidth, postConvHeight, 1,
border, internalFormat);
ASSERT(ctx->Driver.CopyTexImage2D);
@@ -2119,7 +2314,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
texImage->Data = NULL;
}
_mesa_init_teximage_fields(ctx, texImage, width, 1, 1,
_mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1,
border, internalFormat);
if (ctx->Extensions.ARB_texture_compression) {
@@ -2144,7 +2339,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
struct gl_texture_image *texImage;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
_mesa_init_teximage_fields(ctx, texImage, width, 1, 1,
_mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1,
border, internalFormat);
ASSERT(ctx->Driver.TestProxyTexImage);
error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level,
@@ -2191,13 +2386,15 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
if (target == GL_TEXTURE_2D ||
(ctx->Extensions.ARB_texture_cube_map &&
target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) {
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) ||
(ctx->Extensions.NV_texture_rectangle &&
target == GL_TEXTURE_RECTANGLE_NV)) {
struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
if (texture_error_check(ctx, target, level, internalFormat,
GL_NONE, GL_NONE, 1, width, height, 1, border)) {
GL_NONE, GL_NONE, 2, width, height, 1, border)) {
return; /* error in texture image was detected */
}
@@ -2218,8 +2415,8 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
texImage->Data = NULL;
}
_mesa_init_teximage_fields(ctx, texImage, width, height, 1, border,
internalFormat);
_mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
border, internalFormat);
if (ctx->Extensions.ARB_texture_compression) {
ASSERT(ctx->Driver.CompressedTexImage2D);
@@ -2243,7 +2440,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
struct gl_texture_image *texImage;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
_mesa_init_teximage_fields(ctx, texImage, width, height, 1,
_mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
border, internalFormat);
ASSERT(ctx->Driver.TestProxyTexImage);
error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level,
@@ -2295,7 +2492,7 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
struct gl_texture_image *texImage;
if (texture_error_check(ctx, target, level, internalFormat,
GL_NONE, GL_NONE, 1, width, height, depth, border)) {
GL_NONE, GL_NONE, 3, width, height, depth, border)) {
return; /* error in texture image was detected */
}
@@ -2316,8 +2513,8 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
texImage->Data = NULL;
}
_mesa_init_teximage_fields(ctx, texImage, width, height, depth, border,
internalFormat);
_mesa_init_teximage_fields(ctx, target, texImage, width, height, depth,
border, internalFormat);
if (ctx->Extensions.ARB_texture_compression) {
ASSERT(ctx->Driver.CompressedTexImage3D);
@@ -2336,13 +2533,14 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
else if (target == GL_PROXY_TEXTURE_3D) {
/* Proxy texture: check for errors and update proxy state */
GLenum error = texture_error_check(ctx, target, level, internalFormat,
GL_NONE, GL_NONE, 1, width, height, depth, border);
GL_NONE, GL_NONE, 3, width, height, depth, border);
if (!error) {
struct gl_texture_unit *texUnit;
struct gl_texture_image *texImage;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
_mesa_init_teximage_fields(ctx, texImage, width, height, depth,
_mesa_init_teximage_fields(ctx, target, texImage,
width, height, depth,
border, internalFormat);
ASSERT(ctx->Driver.TestProxyTexImage);
error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level,

View File

@@ -1,8 +1,8 @@
/* $Id: teximage.h,v 1.19 2001/05/21 16:41:03 brianp Exp $ */
/* $Id: teximage.h,v 1.19.2.1 2002/08/28 01:13:35 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.5
* Version: 4.0.4
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
@@ -48,7 +48,7 @@ _mesa_free_texture_image( struct gl_texture_image *teximage );
extern void
_mesa_init_teximage_fields(GLcontext *ctx,
_mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
struct gl_texture_image *img,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum internalFormat);

View File

@@ -1,8 +1,8 @@
/* $Id: texobj.c,v 1.50.2.1 2002/06/16 03:19:58 brianp Exp $ */
/* $Id: texobj.c,v 1.50.2.2 2002/08/28 01:13:36 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.0.3
* Version: 4.0.4
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -55,11 +55,16 @@
*/
struct gl_texture_object *
_mesa_alloc_texture_object( struct gl_shared_state *shared,
GLuint name, GLuint dimensions )
GLuint name, GLenum target )
{
struct gl_texture_object *obj;
ASSERT(dimensions <= 3 || dimensions == 6);
ASSERT(target == 0 ||
target == GL_TEXTURE_1D ||
target == GL_TEXTURE_2D ||
target == GL_TEXTURE_3D ||
target == GL_TEXTURE_CUBE_MAP_ARB ||
target == GL_TEXTURE_RECTANGLE_NV);
obj = CALLOC_STRUCT(gl_texture_object);
@@ -68,11 +73,20 @@ _mesa_alloc_texture_object( struct gl_shared_state *shared,
_glthread_INIT_MUTEX(obj->Mutex);
obj->RefCount = 1;
obj->Name = name;
obj->Dimensions = dimensions;
obj->Target = target;
obj->Priority = 1.0F;
obj->WrapS = GL_REPEAT;
obj->WrapT = GL_REPEAT;
obj->WrapR = GL_REPEAT;
if (target == GL_TEXTURE_RECTANGLE_NV) {
obj->WrapS = GL_CLAMP_TO_EDGE;
obj->WrapT = GL_CLAMP_TO_EDGE;
obj->WrapR = GL_CLAMP_TO_EDGE;
obj->MinFilter = GL_LINEAR;
}
else {
obj->WrapS = GL_REPEAT;
obj->WrapT = GL_REPEAT;
obj->WrapR = GL_REPEAT;
obj->MinFilter = GL_NEAREST_MIPMAP_LINEAR;
}
obj->MinFilter = GL_NEAREST_MIPMAP_LINEAR;
obj->MagFilter = GL_LINEAR;
obj->MinLod = -1000.0;
@@ -228,24 +242,32 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
}
/* Compute _MaxLevel */
if (t->Dimensions == 1) {
if (t->Target == GL_TEXTURE_1D) {
maxLog2 = t->Image[baseLevel]->WidthLog2;
maxLevels = ctx->Const.MaxTextureLevels;
}
else if (t->Dimensions == 2 || t->Dimensions == 6) {
else if (t->Target == GL_TEXTURE_2D) {
maxLog2 = MAX2(t->Image[baseLevel]->WidthLog2,
t->Image[baseLevel]->HeightLog2);
maxLevels = (t->Dimensions == 2) ?
ctx->Const.MaxTextureLevels : ctx->Const.MaxCubeTextureLevels;
maxLevels = ctx->Const.MaxTextureLevels;
}
else if (t->Dimensions == 3) {
else if (t->Target == GL_TEXTURE_3D) {
GLint max = MAX2(t->Image[baseLevel]->WidthLog2,
t->Image[baseLevel]->HeightLog2);
maxLog2 = MAX2(max, (GLint)(t->Image[baseLevel]->DepthLog2));
maxLevels = ctx->Const.Max3DTextureLevels;
}
else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
maxLog2 = MAX2(t->Image[baseLevel]->WidthLog2,
t->Image[baseLevel]->HeightLog2);
maxLevels = ctx->Const.MaxCubeTextureLevels;
}
else if (t->Target == GL_TEXTURE_RECTANGLE_NV) {
maxLog2 = 0; /* not applicable */
maxLevels = 1; /* no mipmapping */
}
else {
_mesa_problem(ctx, "Bad t->Dimension in _mesa_test_texobj_completeness");
_mesa_problem(ctx, "Bad t->Target in _mesa_test_texobj_completeness");
return;
}
@@ -258,7 +280,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
/* Compute _MaxLambda = q - b (see the 1.2 spec) used during mipmapping */
t->_MaxLambda = (GLfloat) (t->_MaxLevel - t->BaseLevel);
if (t->Dimensions == 6) {
if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
/* make sure that all six cube map level 0 images are the same size */
const GLuint w = t->Image[baseLevel]->Width2;
const GLuint h = t->Image[baseLevel]->Height2;
@@ -314,7 +336,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
}
/* Test things which depend on number of texture image dimensions */
if (t->Dimensions == 1) {
if (t->Target == GL_TEXTURE_1D) {
/* Test 1-D mipmaps */
GLuint width = t->Image[baseLevel]->Width2;
for (i = baseLevel + 1; i < maxLevels; i++) {
@@ -338,7 +360,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
}
}
}
else if (t->Dimensions == 2) {
else if (t->Target == GL_TEXTURE_2D) {
/* Test 2-D mipmaps */
GLuint width = t->Image[baseLevel]->Width2;
GLuint height = t->Image[baseLevel]->Height2;
@@ -371,7 +393,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
}
}
}
else if (t->Dimensions == 3) {
else if (t->Target == GL_TEXTURE_3D) {
/* Test 3-D mipmaps */
GLuint width = t->Image[baseLevel]->Width2;
GLuint height = t->Image[baseLevel]->Height2;
@@ -413,7 +435,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
}
}
}
else if (t->Dimensions == 6) {
else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
/* make sure 6 cube faces are consistant */
GLuint width = t->Image[baseLevel]->Width2;
GLuint height = t->Image[baseLevel]->Height2;
@@ -449,6 +471,10 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
}
}
}
else if (t->Target == GL_TEXTURE_RECTANGLE_NV) {
/* XXX special checking? */
}
else {
/* Dimensions = ??? */
_mesa_problem(ctx, "Bug in gl_test_texture_object_completeness\n");
@@ -582,7 +608,6 @@ _mesa_BindTexture( GLenum target, GLuint texName )
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
struct gl_texture_object *oldTexObj;
struct gl_texture_object *newTexObj = 0;
GLuint targetDim;
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
@@ -591,24 +616,28 @@ _mesa_BindTexture( GLenum target, GLuint texName )
switch (target) {
case GL_TEXTURE_1D:
targetDim = 1;
oldTexObj = texUnit->Current1D;
break;
case GL_TEXTURE_2D:
targetDim = 2;
oldTexObj = texUnit->Current2D;
break;
case GL_TEXTURE_3D:
targetDim = 3;
oldTexObj = texUnit->Current3D;
break;
case GL_TEXTURE_CUBE_MAP_ARB:
if (ctx->Extensions.ARB_texture_cube_map) {
targetDim = 6;
oldTexObj = texUnit->CurrentCubeMap;
break;
if (!ctx->Extensions.ARB_texture_cube_map) {
_mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" );
return;
}
/* fallthrough */
oldTexObj = texUnit->CurrentCubeMap;
break;
case GL_TEXTURE_RECTANGLE_NV:
if (!ctx->Extensions.NV_texture_rectangle) {
_mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" );
return;
}
oldTexObj = texUnit->CurrentRect;
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" );
return;
@@ -635,6 +664,9 @@ _mesa_BindTexture( GLenum target, GLuint texName )
case GL_TEXTURE_CUBE_MAP_ARB:
newTexObj = ctx->Shared->DefaultCubeMap;
break;
case GL_TEXTURE_RECTANGLE_NV:
newTexObj = ctx->Shared->DefaultRect;
break;
default:
; /* Bad targets are caught above */
}
@@ -645,23 +677,30 @@ _mesa_BindTexture( GLenum target, GLuint texName )
newTexObj = (struct gl_texture_object *) _mesa_HashLookup(hash, texName);
if (newTexObj) {
/* error checking */
if (newTexObj->Dimensions > 0 && newTexObj->Dimensions != targetDim) {
if (newTexObj->Target != 0 && newTexObj->Target != target) {
/* the named texture object's dimensions don't match the target */
_mesa_error( ctx, GL_INVALID_OPERATION,
"glBindTexture(wrong dimensionality)" );
return;
}
if (newTexObj->Target == 0 && target == GL_TEXTURE_RECTANGLE_NV) {
/* have to init wrap and filter state here - kind of klunky */
newTexObj->WrapS = GL_CLAMP_TO_EDGE;
newTexObj->WrapT = GL_CLAMP_TO_EDGE;
newTexObj->WrapR = GL_CLAMP_TO_EDGE;
newTexObj->MinFilter = GL_LINEAR;
}
}
else {
/* if this is a new texture id, allocate a texture object now */
newTexObj = _mesa_alloc_texture_object( ctx->Shared, texName,
targetDim);
target);
if (!newTexObj) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindTexture");
return;
}
}
newTexObj->Dimensions = targetDim;
newTexObj->Target = target;
}
newTexObj->RefCount++;
@@ -683,6 +722,9 @@ _mesa_BindTexture( GLenum target, GLuint texName )
case GL_TEXTURE_CUBE_MAP_ARB:
texUnit->CurrentCubeMap = newTexObj;
break;
case GL_TEXTURE_RECTANGLE_NV:
texUnit->CurrentRect = newTexObj;
break;
default:
_mesa_problem(ctx, "bad target in BindTexture");
}

View File

@@ -1,8 +1,8 @@
/* $Id: texobj.h,v 1.6.2.1 2002/06/16 03:19:58 brianp Exp $ */
/* $Id: texobj.h,v 1.6.2.2 2002/08/28 01:13:36 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.0.3
* Version: 4.0.4
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -39,7 +39,7 @@
extern struct gl_texture_object *
_mesa_alloc_texture_object( struct gl_shared_state *shared, GLuint name,
GLuint dimensions );
GLenum target );
extern void

View File

@@ -1,8 +1,8 @@
/* $Id: texstate.c,v 1.58.2.9 2002/06/16 03:19:58 brianp Exp $ */
/* $Id: texstate.c,v 1.58.2.10 2002/08/28 01:13:36 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.0.3
* Version: 4.0.4
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -114,6 +114,8 @@ _mesa_copy_texture_state( const GLcontext *src, GLcontext *dst )
src->Texture.Unit[i].Current3D);
_mesa_copy_texture_object(dst->Texture.Unit[i].CurrentCubeMap,
src->Texture.Unit[i].CurrentCubeMap);
_mesa_copy_texture_object(dst->Texture.Unit[i].CurrentRect,
src->Texture.Unit[i].CurrentRect);
}
}
@@ -986,11 +988,19 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
texObj = texUnit->Current3D;
break;
case GL_TEXTURE_CUBE_MAP_ARB:
if (ctx->Extensions.ARB_texture_cube_map) {
texObj = texUnit->CurrentCubeMap;
break;
if (!ctx->Extensions.ARB_texture_cube_map) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
return;
}
/* fallthrough */
texObj = texUnit->CurrentCubeMap;
break;
case GL_TEXTURE_RECTANGLE_NV:
if (!ctx->Extensions.NV_texture_rectangle) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
return;
}
texObj = texUnit->CurrentRect;
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
return;
@@ -1002,11 +1012,15 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
if (texObj->MinFilter == eparam)
return;
if (eparam==GL_NEAREST || eparam==GL_LINEAR
|| eparam==GL_NEAREST_MIPMAP_NEAREST
|| eparam==GL_LINEAR_MIPMAP_NEAREST
|| eparam==GL_NEAREST_MIPMAP_LINEAR
|| eparam==GL_LINEAR_MIPMAP_LINEAR) {
if (eparam==GL_NEAREST || eparam==GL_LINEAR) {
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->MinFilter = eparam;
}
else if ((eparam==GL_NEAREST_MIPMAP_NEAREST ||
eparam==GL_LINEAR_MIPMAP_NEAREST ||
eparam==GL_NEAREST_MIPMAP_LINEAR ||
eparam==GL_LINEAR_MIPMAP_LINEAR) &&
texObj->Target != GL_TEXTURE_RECTANGLE_NV) {
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->MinFilter = eparam;
}
@@ -1032,13 +1046,18 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
case GL_TEXTURE_WRAP_S:
if (texObj->WrapS == eparam)
return;
if (eparam==GL_CLAMP ||
eparam==GL_REPEAT ||
eparam==GL_CLAMP_TO_EDGE ||
if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE ||
(eparam == GL_CLAMP_TO_BORDER_ARB &&
ctx->Extensions.ARB_texture_border_clamp) ||
(eparam == GL_MIRRORED_REPEAT_ARB &&
ctx->Extensions.ARB_texture_mirrored_repeat)) {
ctx->Extensions.ARB_texture_border_clamp)) {
/* any texture target */
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->WrapS = eparam;
}
else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
(eparam == GL_REPEAT ||
(eparam == GL_MIRRORED_REPEAT_ARB &&
ctx->Extensions.ARB_texture_mirrored_repeat))) {
/* non-rectangle texture */
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->WrapS = eparam;
}
@@ -1050,13 +1069,18 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
case GL_TEXTURE_WRAP_T:
if (texObj->WrapT == eparam)
return;
if (eparam==GL_CLAMP ||
eparam==GL_REPEAT ||
eparam==GL_CLAMP_TO_EDGE ||
if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE ||
(eparam == GL_CLAMP_TO_BORDER_ARB &&
ctx->Extensions.ARB_texture_border_clamp) ||
(eparam == GL_MIRRORED_REPEAT_ARB &&
ctx->Extensions.ARB_texture_mirrored_repeat)) {
ctx->Extensions.ARB_texture_border_clamp)) {
/* any texture target */
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->WrapT = eparam;
}
else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
(eparam == GL_REPEAT ||
(eparam == GL_MIRRORED_REPEAT_ARB &&
ctx->Extensions.ARB_texture_mirrored_repeat))) {
/* non-rectangle texture */
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->WrapT = eparam;
}
@@ -1068,13 +1092,18 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
case GL_TEXTURE_WRAP_R_EXT:
if (texObj->WrapR == eparam)
return;
if (eparam==GL_CLAMP ||
eparam==GL_REPEAT ||
eparam==GL_CLAMP_TO_EDGE ||
if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE ||
(eparam == GL_CLAMP_TO_BORDER_ARB &&
ctx->Extensions.ARB_texture_border_clamp) ||
(eparam == GL_MIRRORED_REPEAT_ARB &&
ctx->Extensions.ARB_texture_mirrored_repeat)) {
ctx->Extensions.ARB_texture_border_clamp)) {
/* any texture target */
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->WrapR = eparam;
}
else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
(eparam == GL_REPEAT ||
(eparam == GL_MIRRORED_REPEAT_ARB &&
ctx->Extensions.ARB_texture_mirrored_repeat))) {
/* non-rectangle texture */
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->WrapR = eparam;
}
@@ -1106,6 +1135,10 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
_mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
return;
}
if (target == GL_TEXTURE_RECTANGLE_NV && params[0] != 0.0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
return;
}
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->BaseLevel = (GLint) params[0];
break;
@@ -1256,6 +1289,9 @@ tex_image_dimensions(GLcontext *ctx, GLenum target)
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
return ctx->Extensions.ARB_texture_cube_map ? 2 : 0;
case GL_TEXTURE_RECTANGLE_NV:
case GL_PROXY_TEXTURE_RECTANGLE_NV:
return ctx->Extensions.NV_texture_rectangle ? 2 : 0;
default:
_mesa_problem(ctx, "bad target in _mesa_tex_target_dimensions()");
return 0;
@@ -1292,6 +1328,19 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
case GL_PROXY_TEXTURE_3D:
maxLevels = ctx->Const.Max3DTextureLevels;
break;
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
maxLevels = ctx->Const.MaxCubeTextureLevels;
break;
case GL_TEXTURE_RECTANGLE_NV:
case GL_PROXY_TEXTURE_RECTANGLE_NV:
maxLevels = 1;
break;
default:
maxLevels = ctx->Const.MaxCubeTextureLevels;
break;
@@ -1315,7 +1364,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
isProxy = (target == GL_PROXY_TEXTURE_1D) ||
(target == GL_PROXY_TEXTURE_2D) ||
(target == GL_PROXY_TEXTURE_3D) ||
(target == GL_PROXY_TEXTURE_CUBE_MAP_ARB);
(target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) ||
(target == GL_PROXY_TEXTURE_RECTANGLE_NV);
switch (pname) {
case GL_TEXTURE_WIDTH:

View File

@@ -1,8 +1,8 @@
/* $Id: texstore.c,v 1.34.2.2 2002/04/04 17:05:59 brianp Exp $ */
/* $Id: texstore.c,v 1.34.2.8 2002/09/21 17:11:08 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.0.3
* Version: 4.0.4
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -115,6 +115,8 @@ components_in_intformat( GLint format )
case GL_DEPTH_COMPONENT24_SGIX:
case GL_DEPTH_COMPONENT32_SGIX:
return 1;
case GL_YCBCR_MESA:
return 2; /* Y + (Cb or Cr) */
default:
return -1; /* error */
}
@@ -255,6 +257,27 @@ transfer_teximage(GLcontext *ctx, GLuint dimensions,
dest += dstImageStride;
}
}
else if (texDestFormat == GL_YCBCR_MESA) {
/* YCbCr texture */
GLint img, row;
GLushort *dest = (GLushort *) texDestAddr
+ dstZoffset * (dstImageStride / sizeof(GLushort))
+ dstYoffset * (dstRowStride / sizeof(GLushort))
+ dstXoffset * texComponents;
ASSERT(ctx->Extensions.MESA_ycbcr_texture);
printf("copy ycbcr\n");
for (img = 0; img < srcDepth; img++) {
GLushort *destRow = dest;
for (row = 0; row < srcHeight; row++) {
const GLvoid *srcRow = _mesa_image_address(srcPacking,
srcAddr, srcWidth, srcHeight,
srcFormat, srcType, img, row, 0);
MEMCPY(destRow, srcRow, srcWidth * sizeof(GLushort));
destRow += (dstRowStride / sizeof(GLushort));
}
dest += dstImageStride / sizeof(GLushort);
}
}
else if (texDestFormat == GL_DEPTH_COMPONENT) {
/* Depth texture (shadow maps) */
GLint img, row;
@@ -666,7 +689,7 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
/* GL_SGIS_generate_mipmap */
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
_mesa_generate_mipmap(ctx,
_mesa_generate_mipmap(ctx, target,
&ctx->Texture.Unit[ctx->Texture.CurrentUnit],
texObj);
}
@@ -739,7 +762,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
/* GL_SGIS_generate_mipmap */
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
_mesa_generate_mipmap(ctx,
_mesa_generate_mipmap(ctx, target,
&ctx->Texture.Unit[ctx->Texture.CurrentUnit],
texObj);
}
@@ -805,7 +828,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
/* GL_SGIS_generate_mipmap */
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
_mesa_generate_mipmap(ctx,
_mesa_generate_mipmap(ctx, target,
&ctx->Texture.Unit[ctx->Texture.CurrentUnit],
texObj);
}
@@ -837,7 +860,8 @@ _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
/* GL_SGIS_generate_mipmap */
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
_mesa_generate_mipmap(ctx, &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
_mesa_generate_mipmap(ctx, target,
&ctx->Texture.Unit[ctx->Texture.CurrentUnit],
texObj);
}
}
@@ -866,7 +890,8 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level,
/* GL_SGIS_generate_mipmap */
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
_mesa_generate_mipmap(ctx, &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
_mesa_generate_mipmap(ctx, target,
&ctx->Texture.Unit[ctx->Texture.CurrentUnit],
texObj);
}
}
@@ -895,7 +920,8 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
format, type, pixels, packing);
/* GL_SGIS_generate_mipmap */
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
_mesa_generate_mipmap(ctx, &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
_mesa_generate_mipmap(ctx, target,
&ctx->Texture.Unit[ctx->Texture.CurrentUnit],
texObj);
}
}
@@ -1603,44 +1629,32 @@ make_3d_mipmap(const struct gl_texture_format *format, GLint border,
* Stop at texObj's MaxLevel or when we get to the 1x1 texture.
*/
void
_mesa_generate_mipmap(GLcontext *ctx,
_mesa_generate_mipmap(GLcontext *ctx, GLenum target,
const struct gl_texture_unit *texUnit,
struct gl_texture_object *texObj)
{
const GLenum targets1D[] = { GL_TEXTURE_1D, 0 };
const GLenum targets2D[] = { GL_TEXTURE_2D, 0 };
const GLenum targets3D[] = { GL_TEXTURE_3D, 0 };
const GLenum targetsCube[] = { GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB,
GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB,
GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB,
0 };
const GLenum *targets;
GLint level;
GLint maxLevels = 0;
ASSERT(texObj);
ASSERT(texObj->Image[texObj->BaseLevel]);
switch (texObj->Dimensions) {
case 1:
targets = targets1D;
switch (texObj->Target) {
case GL_TEXTURE_1D:
maxLevels = ctx->Const.MaxTextureLevels;
break;
case 2:
targets = targets2D;
case GL_TEXTURE_2D:
maxLevels = ctx->Const.MaxTextureLevels;
break;
case 3:
targets = targets3D;
case GL_TEXTURE_3D:
maxLevels = ctx->Const.Max3DTextureLevels;
break;
case 6:
targets = targetsCube;
case GL_TEXTURE_CUBE_MAP_ARB:
maxLevels = ctx->Const.MaxCubeTextureLevels;
break;
case GL_TEXTURE_RECTANGLE_NV:
maxLevels = 1;
break;
default:
_mesa_problem(ctx,
"Bad texture object dimension in _mesa_generate_mipmaps");
@@ -1655,7 +1669,6 @@ _mesa_generate_mipmap(GLcontext *ctx,
GLint srcWidth, srcHeight, srcDepth;
GLint dstWidth, dstHeight, dstDepth;
GLint border, bytesPerTexel;
GLint t;
srcImage = texObj->Image[level];
ASSERT(srcImage);
@@ -1692,67 +1705,73 @@ _mesa_generate_mipmap(GLcontext *ctx,
return;
}
/* Need this loop just because of cubemaps */
for (t = 0; targets[t]; t++) {
ASSERT(t < 6);
dstImage = _mesa_select_tex_image(ctx, texUnit, targets[t], level+1);
/* get dest gl_texture_image */
dstImage = _mesa_select_tex_image(ctx, texUnit, target, level+1);
if (!dstImage) {
dstImage = _mesa_alloc_texture_image();
if (!dstImage) {
dstImage = _mesa_alloc_texture_image();
if (!dstImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
return;
}
_mesa_set_tex_image(texObj, targets[t], level + 1, dstImage);
}
/* Free old image data */
if (dstImage->Data)
MESA_PBUFFER_FREE(dstImage->Data);
/* initialize new image */
_mesa_init_teximage_fields(ctx, dstImage, dstWidth, dstHeight,
dstDepth, border, srcImage->Format);
dstImage->DriverData = NULL;
dstImage->TexFormat = srcImage->TexFormat;
dstImage->FetchTexel = srcImage->FetchTexel;
ASSERT(dstImage->TexFormat);
ASSERT(dstImage->FetchTexel);
ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0);
/* alloc new image buffer */
dstImage->Data = MESA_PBUFFER_ALLOC(dstWidth * dstHeight * dstDepth
* bytesPerTexel);
if (!dstImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
return;
}
_mesa_set_tex_image(texObj, target, level + 1, dstImage);
}
/*
* We use simple 2x2 averaging to compute the next mipmap level.
*/
switch (texObj->Dimensions) {
case 1:
make_1d_mipmap(srcImage->TexFormat, border,
srcWidth, (const GLubyte *) srcImage->Data,
dstWidth, (GLubyte *) dstImage->Data);
break;
case 2:
case 6:
make_2d_mipmap(srcImage->TexFormat, border,
srcWidth, srcHeight, (const GLubyte *) srcImage->Data,
dstWidth, dstHeight, (GLubyte *) dstImage->Data);
break;
case 3:
make_3d_mipmap(srcImage->TexFormat, border,
srcWidth, srcHeight, srcDepth, (const GLubyte *) srcImage->Data,
dstWidth, dstHeight, dstDepth, (GLubyte *) dstImage->Data);
break;
default:
_mesa_problem(ctx, "bad dimensions in _mesa_generate_mipmaps");
return;
}
} /* loop over tex image targets */
/* Free old image data */
if (dstImage->Data)
MESA_PBUFFER_FREE(dstImage->Data);
/* initialize new image */
_mesa_init_teximage_fields(ctx, target, dstImage, dstWidth, dstHeight,
dstDepth, border, srcImage->Format);
dstImage->DriverData = NULL;
dstImage->TexFormat = srcImage->TexFormat;
dstImage->FetchTexel = srcImage->FetchTexel;
ASSERT(dstImage->TexFormat);
ASSERT(dstImage->FetchTexel);
ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0);
/* alloc new image buffer */
dstImage->Data = MESA_PBUFFER_ALLOC(dstWidth * dstHeight * dstDepth
* bytesPerTexel);
if (!dstImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
return;
}
/*
* We use simple 2x2 averaging to compute the next mipmap level.
*/
switch (target) {
case GL_TEXTURE_1D:
make_1d_mipmap(srcImage->TexFormat, border,
srcWidth, (const GLubyte *) srcImage->Data,
dstWidth, (GLubyte *) dstImage->Data);
break;
case GL_TEXTURE_2D:
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
make_2d_mipmap(srcImage->TexFormat, border,
srcWidth, srcHeight, (const GLubyte *) srcImage->Data,
dstWidth, dstHeight, (GLubyte *) dstImage->Data);
break;
case GL_TEXTURE_3D:
make_3d_mipmap(srcImage->TexFormat, border,
srcWidth, srcHeight, srcDepth,
(const GLubyte *) srcImage->Data,
dstWidth, dstHeight, dstDepth,
(GLubyte *) dstImage->Data);
break;
case GL_TEXTURE_RECTANGLE_NV:
/* no mipmaps, do nothing */
break;
default:
_mesa_problem(ctx, "bad dimensions in _mesa_generate_mipmaps");
return;
}
} /* loop over tex levels */
}

View File

@@ -1,10 +1,10 @@
/* $Id: texstore.h,v 1.9 2001/06/15 14:18:46 brianp Exp $ */
/* $Id: texstore.h,v 1.9.2.1 2002/09/16 20:29:23 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.5
* Version: 4.0.4
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2002 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"),
@@ -149,7 +149,7 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
extern void
_mesa_generate_mipmap(GLcontext *ctx,
_mesa_generate_mipmap(GLcontext *ctx, GLenum target,
const struct gl_texture_unit *texUnit,
struct gl_texture_object *texObj);

View File

@@ -1,4 +1,4 @@
/* $Id: texutil.c,v 1.25.2.5 2002/06/12 00:28:55 brianp Exp $ */
/* $Id: texutil.c,v 1.25.2.8 2002/09/21 17:11:08 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -27,6 +27,14 @@
* Gareth Hughes <gareth@valinux.com>
*/
/*
* Description:
* Functions for texture image conversion. This takes care of converting
* typical GL_RGBA/GLubyte textures into hardware-specific formats.
* We can handle non-standard row strides and pixel unpacking parameters.
*/
#ifdef PC_HEADER
#include "all.h"
#else
@@ -51,7 +59,7 @@
#endif
struct gl_texture_convert {
struct convert_info {
GLint xoffset, yoffset, zoffset; /* Subimage offset */
GLint width, height, depth; /* Subimage region */
@@ -67,15 +75,16 @@ struct gl_texture_convert {
GLint index;
};
typedef GLboolean (*convert_func)( struct gl_texture_convert *convert );
typedef GLboolean (*convert_func)( const struct convert_info *convert );
/* bitvalues for convert->index */
#define CONVERT_STRIDE_BIT 0x1
#define CONVERT_UNPACKING_BIT 0x2
/* =============================================================
* RGBA8888 textures:
* Convert to RGBA8888 textures:
*/
#define DST_TYPE GLuint
@@ -118,7 +127,7 @@ typedef GLboolean (*convert_func)( struct gl_texture_convert *convert );
#define CONVERT_RGBA8888( name ) \
static GLboolean \
convert_##name##_rgba8888( struct gl_texture_convert *convert ) \
convert_##name##_rgba8888( const struct convert_info *convert ) \
{ \
convert_func *tab; \
GLint index = convert->index; \
@@ -154,7 +163,7 @@ CONVERT_RGBA8888( texsubimage3d )
/* =============================================================
* ARGB8888 textures:
* Convert to ARGB8888 textures:
*/
#define DST_TYPE GLuint
@@ -197,7 +206,7 @@ CONVERT_RGBA8888( texsubimage3d )
#define CONVERT_ARGB8888( name ) \
static GLboolean \
convert_##name##_argb8888( struct gl_texture_convert *convert ) \
convert_##name##_argb8888( const struct convert_info *convert ) \
{ \
convert_func *tab; \
GLint index = convert->index; \
@@ -232,11 +241,11 @@ CONVERT_ARGB8888( texsubimage3d )
/* =============================================================
* RGB888 textures:
* Convert to RGB888 textures:
*/
static GLboolean
convert_texsubimage2d_rgb888( struct gl_texture_convert *convert )
convert_texsubimage2d_rgb888( const struct convert_info *convert )
{
/* This is a placeholder for now...
*/
@@ -244,7 +253,7 @@ convert_texsubimage2d_rgb888( struct gl_texture_convert *convert )
}
static GLboolean
convert_texsubimage3d_rgb888( struct gl_texture_convert *convert )
convert_texsubimage3d_rgb888( const struct convert_info *convert )
{
/* This is a placeholder for now...
*/
@@ -254,7 +263,7 @@ convert_texsubimage3d_rgb888( struct gl_texture_convert *convert )
/* =============================================================
* RGB565 textures:
* Convert to RGB565 textures:
*/
#define DST_TYPE GLushort
@@ -301,7 +310,7 @@ convert_texsubimage3d_rgb888( struct gl_texture_convert *convert )
#define CONVERT_RGB565( name ) \
static GLboolean \
convert_##name##_rgb565( struct gl_texture_convert *convert ) \
convert_##name##_rgb565( const struct convert_info *convert ) \
{ \
convert_func *tab; \
GLint index = convert->index; \
@@ -336,7 +345,7 @@ CONVERT_RGB565( texsubimage3d )
/* =============================================================
* ARGB4444 textures:
* Convert to ARGB4444 textures:
*/
#define DST_TYPE GLushort
@@ -369,7 +378,7 @@ CONVERT_RGB565( texsubimage3d )
#define CONVERT_ARGB4444( name ) \
static GLboolean \
convert_##name##_argb4444( struct gl_texture_convert *convert ) \
convert_##name##_argb4444( const struct convert_info *convert ) \
{ \
convert_func *tab; \
GLint index = convert->index; \
@@ -399,7 +408,7 @@ CONVERT_ARGB4444( texsubimage3d )
/* =============================================================
* ARGB1555 textures:
* Convert to ARGB1555 textures:
*/
#define DST_TYPE GLushort
@@ -463,7 +472,7 @@ CONVERT_ARGB4444( texsubimage3d )
#define CONVERT_ARGB1555( name ) \
static GLboolean \
convert_##name##_argb1555( struct gl_texture_convert *convert ) \
convert_##name##_argb1555( const struct convert_info *convert ) \
{ \
convert_func *tab; \
GLint index = convert->index; \
@@ -498,7 +507,7 @@ CONVERT_ARGB1555( texsubimage3d )
/* =============================================================
* AL88 textures:
* Conver to AL88 textures:
*/
#define DST_TYPE GLushort
@@ -520,7 +529,7 @@ CONVERT_ARGB1555( texsubimage3d )
dst = PACK_COLOR_88_LE( src[0], 0x00 )
#define CONVERT_TEXEL_DWORD( dst, src ) \
dst = APPEND16( PACK_COLOR_88_LE( src[0], 0x00 ), \
dst = APPEND16( PACK_COLOR_88_LE( src[0], 0x00 ), \
PACK_COLOR_88_LE( src[1], 0x00 ) )
#define SRC_TEXEL_BYTES 1
@@ -559,7 +568,7 @@ CONVERT_ARGB1555( texsubimage3d )
#define CONVERT_AL88( name ) \
static GLboolean \
convert_##name##_al88( struct gl_texture_convert *convert ) \
convert_##name##_al88( const struct convert_info *convert ) \
{ \
convert_func *tab; \
GLint index = convert->index; \
@@ -599,11 +608,11 @@ CONVERT_AL88( texsubimage3d )
/* =============================================================
* RGB332 textures:
* Convert to RGB332 textures:
*/
static GLboolean
convert_texsubimage2d_rgb332( struct gl_texture_convert *convert )
convert_texsubimage2d_rgb332( const struct convert_info *convert )
{
/* This is a placeholder for now...
*/
@@ -611,7 +620,7 @@ convert_texsubimage2d_rgb332( struct gl_texture_convert *convert )
}
static GLboolean
convert_texsubimage3d_rgb332( struct gl_texture_convert *convert )
convert_texsubimage3d_rgb332( const struct convert_info *convert )
{
/* This is a placeholder for now...
*/
@@ -621,7 +630,7 @@ convert_texsubimage3d_rgb332( struct gl_texture_convert *convert )
/* =============================================================
* CI8 (and all other single-byte texel) textures:
* Convert to CI8 (and all other single-byte texel) textures:
*/
#define DST_TYPE GLubyte
@@ -639,7 +648,7 @@ convert_texsubimage3d_rgb332( struct gl_texture_convert *convert )
#define CONVERT_CI8( name ) \
static GLboolean \
convert_##name##_ci8( struct gl_texture_convert *convert ) \
convert_##name##_ci8( const struct convert_info *convert ) \
{ \
convert_func *tab; \
GLint index = convert->index; \
@@ -665,12 +674,88 @@ CONVERT_CI8( texsubimage2d )
CONVERT_CI8( texsubimage3d )
/* =============================================================
* Global entry points
* convert to YCBCR textures:
*/
static convert_func gl_convert_texsubimage2d_tab[] = {
#define DST_TYPE GLushort
#define DST_TEXELS_PER_DWORD 2
#define CONVERT_TEXEL( dst, src ) \
dst = (src[0] << 8) | src[1];
#define CONVERT_DIRECT
#define SRC_TEXEL_BYTES 2
#define TAG(x) x##_ycbcr_direct
#include "texutil_tmp.h"
#define CONVERT_YCBCR( name ) \
static GLboolean \
convert_##name##_ycbcr( const struct convert_info *convert ) \
{ \
convert_func *tab; \
GLint index = convert->index; \
\
if (convert->format != GL_YCBCR_MESA) { \
/* Can't handle this source format/type combination */ \
return GL_FALSE; \
} \
tab = name##_tab_ycbcr_direct; \
\
return tab[index]( convert ); \
}
CONVERT_YCBCR( texsubimage2d )
CONVERT_YCBCR( texsubimage3d )
/* =============================================================
* convert to YCBCR_REV textures:
*/
#define DST_TYPE GLushort
#define DST_TEXELS_PER_DWORD 2
#define CONVERT_TEXEL( dst, src ) \
dst = (src[1] << 8) | src[0];
#define CONVERT_DIRECT
#define SRC_TEXEL_BYTES 2
#define TAG(x) x##_ycbcr_rev_direct
#include "texutil_tmp.h"
#define CONVERT_YCBCR_REV( name ) \
static GLboolean \
convert_##name##_ycbcr_rev( const struct convert_info *convert ) \
{ \
convert_func *tab; \
GLint index = convert->index; \
\
if (convert->format != GL_YCBCR_MESA) { \
/* Can't handle this source format/type combination */ \
return GL_FALSE; \
} \
tab = name##_tab_ycbcr_rev_direct; \
\
return tab[index]( convert ); \
}
CONVERT_YCBCR_REV( texsubimage2d )
CONVERT_YCBCR_REV( texsubimage3d )
/* =============================================================
* Tables of texture conversion/packing functions.
*/
static convert_func convert_texsubimage2d_table[] = {
convert_texsubimage2d_rgba8888,
convert_texsubimage2d_argb8888,
convert_texsubimage2d_rgb888,
@@ -683,9 +768,11 @@ static convert_func gl_convert_texsubimage2d_tab[] = {
convert_texsubimage2d_ci8,
convert_texsubimage2d_ci8,
convert_texsubimage2d_ci8,
convert_texsubimage2d_ycbcr,
convert_texsubimage2d_ycbcr_rev,
};
static convert_func gl_convert_texsubimage3d_tab[] = {
static convert_func convert_texsubimage3d_table[] = {
convert_texsubimage3d_rgba8888,
convert_texsubimage3d_argb8888,
convert_texsubimage3d_rgb888,
@@ -698,6 +785,8 @@ static convert_func gl_convert_texsubimage3d_tab[] = {
convert_texsubimage3d_ci8,
convert_texsubimage3d_ci8,
convert_texsubimage3d_ci8,
convert_texsubimage3d_ycbcr,
convert_texsubimage3d_ycbcr_rev,
};
@@ -728,21 +817,21 @@ convert_needs_unpacking( const struct gl_pixelstore_attrib *unpacking,
GLboolean
_mesa_convert_texsubimage1d( GLint mesaFormat,
_mesa_convert_texsubimage1d( GLint mesaFormat, /* dest */
GLint xoffset,
GLint width,
GLenum format, GLenum type,
GLenum format, GLenum type, /* source */
const struct gl_pixelstore_attrib *unpacking,
const GLvoid *srcImage, GLvoid *dstImage )
{
struct gl_texture_convert convert;
struct convert_info convert;
ASSERT( unpacking );
ASSERT( srcImage );
ASSERT( dstImage );
ASSERT( mesaFormat >= MESA_FORMAT_RGBA8888 );
ASSERT( mesaFormat <= MESA_FORMAT_CI8 );
ASSERT( mesaFormat <= MESA_FORMAT_YCBCR_REV );
/* Make it easier to pass all the parameters around.
*/
@@ -761,7 +850,9 @@ _mesa_convert_texsubimage1d( GLint mesaFormat,
if ( convert_needs_unpacking( unpacking, format, type ) )
convert.index |= CONVERT_UNPACKING_BIT;
return gl_convert_texsubimage2d_tab[mesaFormat]( &convert );
ASSERT(convert.index < 4);
return convert_texsubimage2d_table[mesaFormat]( &convert );
}
@@ -791,22 +882,22 @@ _mesa_convert_texsubimage1d( GLint mesaFormat,
* destImage - pointer to dest image
*/
GLboolean
_mesa_convert_texsubimage2d( GLint mesaFormat,
_mesa_convert_texsubimage2d( GLint mesaFormat, /* dest */
GLint xoffset, GLint yoffset,
GLint width, GLint height,
GLint destImageWidth,
GLenum format, GLenum type,
GLenum format, GLenum type, /* source */
const struct gl_pixelstore_attrib *unpacking,
const GLvoid *srcImage, GLvoid *dstImage )
{
struct gl_texture_convert convert;
struct convert_info convert;
ASSERT( unpacking );
ASSERT( srcImage );
ASSERT( dstImage );
ASSERT( mesaFormat >= MESA_FORMAT_RGBA8888 );
ASSERT( mesaFormat <= MESA_FORMAT_CI8 );
ASSERT( mesaFormat <= MESA_FORMAT_YCBCR_REV );
/* Make it easier to pass all the parameters around.
*/
@@ -815,8 +906,8 @@ _mesa_convert_texsubimage2d( GLint mesaFormat,
convert.width = width;
convert.height = height;
convert.dstImageWidth = destImageWidth;
convert.format = format;
convert.type = type;
convert.format = format; /* src */
convert.type = type; /* src */
convert.unpacking = unpacking;
convert.srcImage = srcImage;
convert.dstImage = dstImage;
@@ -829,26 +920,31 @@ _mesa_convert_texsubimage2d( GLint mesaFormat,
if ( width != destImageWidth )
convert.index |= CONVERT_STRIDE_BIT;
return gl_convert_texsubimage2d_tab[mesaFormat]( &convert );
ASSERT(convert.index < 4);
ASSERT(mesaFormat < sizeof(convert_texsubimage2d_table) /
sizeof(convert_texsubimage2d_table[0]));
return convert_texsubimage2d_table[mesaFormat]( &convert );
}
GLboolean
_mesa_convert_texsubimage3d( GLint mesaFormat,
_mesa_convert_texsubimage3d( GLint mesaFormat, /* dest */
GLint xoffset, GLint yoffset, GLint zoffset,
GLint width, GLint height, GLint depth,
GLint dstImageWidth, GLint dstImageHeight,
GLenum format, GLenum type,
GLenum format, GLenum type, /* source */
const struct gl_pixelstore_attrib *unpacking,
const GLvoid *srcImage, GLvoid *dstImage )
{
struct gl_texture_convert convert;
struct convert_info convert;
ASSERT( unpacking );
ASSERT( srcImage );
ASSERT( dstImage );
ASSERT( mesaFormat >= MESA_FORMAT_RGBA8888 );
ASSERT( mesaFormat <= MESA_FORMAT_CI8 );
ASSERT( mesaFormat <= MESA_FORMAT_YCBCR_REV );
/* Make it easier to pass all the parameters around.
*/
@@ -874,7 +970,9 @@ _mesa_convert_texsubimage3d( GLint mesaFormat,
if ( width != dstImageWidth || height != dstImageHeight )
convert.index |= CONVERT_STRIDE_BIT;
return gl_convert_texsubimage3d_tab[mesaFormat]( &convert );
ASSERT(convert.index < 4);
return convert_texsubimage3d_table[mesaFormat]( &convert );
}

View File

@@ -1,8 +1,8 @@
/* $Id: texutil_tmp.h,v 1.8.2.1 2002/02/21 15:11:16 brianp Exp $ */
/* $Id: texutil_tmp.h,v 1.8.2.3 2002/09/14 16:50:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.0.2
* Version: 4.0.4
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -28,7 +28,23 @@
*/
/*
* NOTE: All 3D teximage code is untested and most definitely broken...
* For 2D and 3D texture images, we generate functions for
* - conversion without pixel unpacking and standard stride
* - conversion without pixel unpacking and non-standard stride
* - conversion with pixel unpacking and standard stride
* - conversion with pixel unpacking and non-standard stride
*
*
* Macros which need to be defined before including this file:
* TAG(x) - the function name wrapper
* DST_TYPE - the destination texel datatype (GLuint, GLushort, etc)
* DST_TEXELS_PER_DWORD - number of dest texels that'll fit in 4 bytes
* CONVERT_TEXEL - code to convert from source to dest texel
* CONVER_TEXEL_DWORD - if multiple texels fit in 4 bytes, this macros
* will convert/store multiple texels at once
* CONVERT_DIRECT - if defined, just memcpy texels from src to dest
* SRC_TEXEL_BYTES - bytes per source texel
* PRESERVE_DST_TYPE - if defined, don't undefined these macros at end
*/
@@ -43,7 +59,7 @@
* PRE: No pixelstore attribs, width == dstImageWidth.
*/
static GLboolean
TAG(texsubimage2d)( struct gl_texture_convert *convert )
TAG(texsubimage2d)( const struct convert_info *convert )
{
const GLubyte *src = (const GLubyte *)convert->srcImage;
GLuint *dst = (GLuint *)((GLubyte *)convert->dstImage +
@@ -79,7 +95,7 @@ TAG(texsubimage2d)( struct gl_texture_convert *convert )
/* PRE: As above, height == dstImageHeight also.
*/
static GLboolean
TAG(texsubimage3d)( struct gl_texture_convert *convert )
TAG(texsubimage3d)( const struct convert_info *convert )
{
const GLubyte *src = (const GLubyte *)convert->srcImage;
GLuint *dst = (GLuint *)((GLubyte *)convert->dstImage +
@@ -118,7 +134,7 @@ TAG(texsubimage3d)( struct gl_texture_convert *convert )
* PRE: No pixelstore attribs, width != dstImageWidth.
*/
static GLboolean
TAG(texsubimage2d_stride)( struct gl_texture_convert *convert )
TAG(texsubimage2d_stride)( const struct convert_info *convert )
{
const GLubyte *src = (const GLubyte *)convert->srcImage;
DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage +
@@ -151,7 +167,7 @@ TAG(texsubimage2d_stride)( struct gl_texture_convert *convert )
/* PRE: As above, or height != dstImageHeight also.
*/
static GLboolean
TAG(texsubimage3d_stride)( struct gl_texture_convert *convert )
TAG(texsubimage3d_stride)( const struct convert_info *convert )
{
const GLubyte *src = (const GLubyte *)convert->srcImage;
DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage +
@@ -191,7 +207,7 @@ TAG(texsubimage3d_stride)( struct gl_texture_convert *convert )
* PRE: Require pixelstore attribs, width == dstImageWidth.
*/
static GLboolean
TAG(texsubimage2d_unpack)( struct gl_texture_convert *convert )
TAG(texsubimage2d_unpack)( const struct convert_info *convert )
{
const GLubyte *src = (const GLubyte *)
_mesa_image_address( convert->unpacking, convert->srcImage,
@@ -249,7 +265,7 @@ TAG(texsubimage2d_unpack)( struct gl_texture_convert *convert )
/* PRE: as above, height == dstImageHeight also.
*/
static GLboolean
TAG(texsubimage3d_unpack)( struct gl_texture_convert *convert )
TAG(texsubimage3d_unpack)( const struct convert_info *convert )
{
const GLubyte *src = (const GLubyte *)
_mesa_image_address( convert->unpacking, convert->srcImage,
@@ -324,7 +340,7 @@ TAG(texsubimage3d_unpack)( struct gl_texture_convert *convert )
* PRE: Require pixelstore attribs, width != dstImageWidth.
*/
static GLboolean
TAG(texsubimage2d_stride_unpack)( struct gl_texture_convert *convert )
TAG(texsubimage2d_stride_unpack)( const struct convert_info *convert )
{
const GLubyte *src = (const GLubyte *)
_mesa_image_address( convert->unpacking, convert->srcImage,
@@ -372,7 +388,7 @@ TAG(texsubimage2d_stride_unpack)( struct gl_texture_convert *convert )
/* PRE: As above, or height != dstImageHeight also.
*/
static GLboolean
TAG(texsubimage3d_stride_unpack)( struct gl_texture_convert *convert )
TAG(texsubimage3d_stride_unpack)( const struct convert_info *convert )
{
const GLubyte *src = (const GLubyte *)
_mesa_image_address( convert->unpacking, convert->srcImage,

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