Compare commits

...

126 Commits

Author SHA1 Message Date
Ian Romanick
e5fdeef1e0 mesa: Bump version number to 9.0 (final)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2012-10-08 14:58:35 -07:00
Tom Stellard
a8d0652c04 configure.ac: Don't link gallium drivers with libdricore
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit d68e337c60)
2012-10-08 10:27:40 -07:00
Anuj Phogat
ad4b3b93de _mesa_meta_GenerateMipmap: Support all texture targets by generating shaders at runtime
This is a squash for the following 7 commits.  The first introduces the
functionality, and the remaining six fix various bugs.

Patch 1:
    _mesa_meta_GenerateMipmap: Support all texture targets by generating shaders at runtime

    glsl path of _mesa_meta_GenerateMipmap() function would require different fragment
    shaders depending on the texture target. This patch adds the code to generate
    appropriate fragment shader programs at run time.
    Fixes https://bugs.freedesktop.org/show_bug.cgi?id=54296

    V2: Removed the code for integer textures as ARB is planning to
        disallow automatic mipmap generation for integer textures.
        Now using ralloc_asprintf in setup_glsl_generate_mipmap().

    NOTE: This is a candidate for stable branches.

    Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>
    (cherry picked from commit 299acac849)

Patch 2:
    _mesa_meta_GenerateMipmap: Generate separate shaders for glsl 120 / 130

    glsl version of _mesa_meta_GenerateMipmap() would require separate
    shaders for glsl 120 and 130.

    V2: Removed the code for integer textures as ARB is planning to
        disallow automatic mipmap generation for integer textures.

    NOTE: This is a candidate for stable branches.

    Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>
    (cherry picked from commit 15bf3103b4)

Patch 3:
    meta: Add on demand compilation of per target shader programs

    A call to glGenerateMipmap() follows the generation of a relevant
    shader program in setup_glsl_generate_mipmap().

    To support all texture targets and to avoid compiling shaders
    everytime, per target shader programs are compiled on demand
    and saved for the next call.

    Fixes float-texture(mipmap.manual):
    See Comment 6: https://bugs.freedesktop.org/show_bug.cgi?id=54296

    NOTE: This is a candidate for stable branches.

    Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>
    (cherry picked from commit eb1d87fb94)

Patch 4:
    meta: make mem_ctx non-global.

    I can't see any external users, and this is a global symbol,

    Reviewed-by: Matt Turner <mattst88@gmail.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    (cherry picked from commit 36639ec6e9)

Patch 5:
    meta: Remove unsafe global mem_ctx pointer

    NOTE: This is a candidate for the 9.0 branch.

    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Brian Paul <brianp@vmware.com>
    Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
    (cherry picked from commit ab097dde0c)

Patch 6:
    meta: Rearrange shader creation in setup_glsl_generate_mipmap

    The diff looks weird, but this moves the code from the first 'if
    (ctx->Const.GLSLVersion < 130)' block down into the second block.  It
    also moves some variable decalarations closer to their use.

    NOTE: This is a candidate for the 9.0 branch.

    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Brian Paul <brianp@vmware.com>
    Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
    (cherry picked from commit 3308c079bd)

Patch 7:
    meta: Don't use GLSL 1.30 shader on OpenGL ES 2

    Fixes GLES2 CoverageGL conformance test.

    NOTE: This is a candidate for the 9.0 branch.

    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Brian Paul <brianp@vmware.com>
    Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
    (cherry picked from commit 0242381f06)
2012-10-07 20:38:14 -07:00
Marek Olšák
7851d398de r600g: fix possible issue with stencil mipmap rendering
Somehow I only hit this issue with my latest libdrm changes.
This won't be needed with DB texturing.

NOTE: This is a candidate for the 9.0 branch.
(cherry picked from commit 9dfca930d7)
2012-10-06 05:40:09 +02:00
Brian Paul
19a15cd5ba mesa: remove bogus compressed texture size checks
A compressed texture image size doesn't have to be a multiple of the
compressed block size (only sub-images do).  Fixes issues when building
compressed mipmaps because we often wind up with non-block-size images
for the higher mipmap levels.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=55445

Note: This is a candidate for the stable branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Sven Arvidsson <sa@whiz.se>
(cherry picked from commit df4a88ac43)
2012-10-05 15:55:47 -07:00
Anuj Phogat
c566267f5c intel/i965: Disable SampleAlphaToOne if dual source blending enabled
From SandyBridge PRM, volume 2 Part 1, section 12.2.3, BLEND_STATE:
DWord 1, Bit 30 (AlphaToOne Enable):
"If Dual Source Blending is enabled, this bit must be disabled"

Note: This is a candidate for stable branches.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit ea0d088727)
2012-10-05 15:55:47 -07:00
Kenneth Graunke
8491e03b2b mesa: Flag _NEW_VARYING_VP_INPUTS when TexEnv programs are active.
The idea here is to not flag _NEW_VARYING_VP_INPUTS when shaders (either
GLSL or ARB vp/fp) are in use.  If either TNL or TexEnv programs are
active, at least one stage is using fixed function.

On Pineview, fixes 20 Piglit, 60 oglconforms, and 7 ES 1.1 conformance
tests, as well as missing textures in Xonotic.  These were all
regressions since commit fb4a34e60e.

NOTE: This is a candidate for the 9.0 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49127
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54807
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 7fa0f10cd8)
2012-10-05 15:55:47 -07:00
Paul Berry
78c9adb17e mesa: don't enable glVertexPointer() when using API_OPENGLES2.
This function is only present in GLES1 and in the OpenGL compatibility
profile.

Fixes the following "make check" failure:

    [----------] 1 test from DispatchSanity_test
    [ RUN      ] DispatchSanity_test.GLES2
    Mesa warning: couldn't open libtxc_dxtn.so, software DXTn
    compression/decompression unavailable
    dispatch_sanity.cpp:122: Failure
    Value of: table[i]
       Actual: 0x4de54e
    Expected: (_glapi_proc) _mesa_generic_nop
    Which is: 0x41af72
    i = 321
    [  FAILED  ] DispatchSanity_test.GLES2 (4 ms)
    [----------] 1 test from DispatchSanity_test (4 ms total)

NOTE: This is a candidate for stable release branches.

Reviewed-by: Oliver McFadden <oliver.mcfadden@linux.intel.com>
Tested-by: Oliver McFadden <oliver.mcfadden@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 8f0b81bf7d)
2012-10-05 15:55:47 -07:00
Robert Bragg
e1cb50b15d SwapBuffersRegionNOK: invert rectangles on y axis
The EGL_NOK_swap_region2 spec states that the rectangles are specified
with a bottom-left origin within a surface coordinate space also with a
bottom left origin, so this patch ensures the rectangles are flipped
before passing them on to dri2_copy_region.

Fixes piglit's egl-nok-swap-region test.

Tested-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 0a523a8820)
2012-10-05 15:03:56 -07:00
Matt Turner
c8fda5f44a build: Set PTHREAD_LIBS for pkgconfig files if empty
(cherry picked from dd4fde8f67)
2012-10-05 17:30:11 +02:00
Tom Stellard
542f6feda9 radeon/llvm: Remove R600InstrInfo.td from TD_FILES
Fixes build bug introduced by
cebbdd4ac2
(cherry picked from commit 2baaa5c7eb)
2012-10-05 15:45:43 +02:00
Tom Stellard
71b5503164 radeon/llvm: Cleanup makefile
Hopefully, this will fix all the parallel make problems people have
been having.
(cherry picked from commit cebbdd4ac2)
2012-10-04 10:10:37 -04:00
Eric Anholt
b2048c5e90 i965: Use visibility cflags on the driver code.
(cherry picked from commit 837f06b42f)

The only symbols that need to be public (those in intel_screen.c that the
loader looks for) are already marked public.  Saves 100k of compiled driver
size.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2012-10-03 15:24:19 -07:00
Matt Turner
ddb9ecca3b build: Don't build libdricore if not building classic drivers
(cherry picked from commit 523c015246)
2012-10-03 15:24:18 -07:00
Matt Turner
76732c9ca5 build: Add visibility CFLAGS to OSMesa
(cherry picked from commit 24ded89876)
2012-10-03 15:24:18 -07:00
Matt Turner
c8669c7ba7 build: Link OSMesa with glapi, libdl, libstdc++
(cherry picked from commit 1762ec28db)

Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=399813
          https://bugs.freedesktop.org/show_bug.cgi?id=53179
2012-10-03 15:24:11 -07:00
Matt Turner
f9a8673a7a build: Set visibility CFLAGS in dri/swrast
(cherry picked from commit 4cfff7211c)
2012-10-03 14:00:52 -07:00
Matt Turner
f88046a1f0 build: Set visibility CFLAGS in dri/r200
(cherry picked from commit 3628402707)
2012-10-03 14:00:46 -07:00
Matt Turner
8ebcf34d87 build: Set visibility CFLAGS in dri/radeon
(cherry picked from commit 55d45efdd8)
2012-10-03 14:00:40 -07:00
Matt Turner
3b794e4a56 build: Set visibility CFLAGS in dri/nouveau
(cherry picked from commit 340637d54d)
2012-10-03 14:00:32 -07:00
Matt Turner
0470fa395f build: Set visibility CFLAGS in dri/i915
(cherry picked from commit 381d120b8a)
2012-10-03 14:00:26 -07:00
Matt Turner
6512610f9a build: Set visibility CFLAGS in dri/common
(cherry picked from commit d2872b5612)
2012-10-03 14:00:14 -07:00
Matt Turner
03cfc8d660 build: Build src/glsl with visibility CFLAGS
(cherry picked from commit 8746f641bb)
2012-10-03 13:59:52 -07:00
Matt Turner
a1f1add42d build: Turn on visibility CFLAGS for core mesa
(cherry picked from commit 710a90ccaf)
2012-10-03 13:59:43 -07:00
Matt Turner
a2f28ceea2 build: Use AX_PTHREAD's HAVE_PTHREAD preprocessor definition
(cherry picked from commit 814345f54b)

Conflicts:

	src/mapi/glapi/gen/gl_x86-64_asm.py
	src/mapi/glapi/gen/gl_x86_asm.py
2012-10-03 13:59:08 -07:00
Matt Turner
421dda800d build: Use PTHREAD_LIBS and PTHREAD_CFLAGS
(cherry picked from commit b6651ae6ad)

Conflicts:

	src/mesa/main/tests/Makefile.am
2012-10-03 13:56:24 -07:00
Matt Turner
89e76252ca dri drivers: Link dricommon before dynamic libraries
I think libtool should be handling this for us, but the build fails for
Jordan because libdricommon (a static library, which uses expat) appears
before -lexpat on the linker command.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Jordan Justen <jordan.l.justen@intel.com>
(cherry picked from commit 31ab61cac1)

Conflicts:

	src/mesa/drivers/dri/i965/Makefile.am
2012-10-03 13:46:03 -07:00
Oliver McFadden
f2b4f588f5 Revert "i965: Implement guardband clipping on Ivybridge."
This reverts commit 610910a66d.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55523
Signed-off-by: Oliver McFadden <oliver.mcfadden@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-10-03 13:32:32 +03:00
Oliver McFadden
dbe13c105f Revert "i965: Implement guardband clipping on Sandybridge."
This reverts commit 85cd30406f.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55523
Signed-off-by: Oliver McFadden <oliver.mcfadden@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-10-03 13:32:21 +03:00
Matt Turner
9fc4a39dbf build: Remove autoconf check for signbit
rebase failure in 7da12426f7.
(cherry picked from commit 159ca32fec)
2012-10-02 22:52:42 -07:00
Brian Paul
604cd6b966 mesa: fix glCompressedTexSubImage assertion/segfault
If the destination texture image doesn't exist we'd hit an assertion
(or crash in a release build).  The piglit/s3tc-errors test hits this.
This has already been fixed in master by the error checking code
consolidation.

Note: This is a candidate for the 8.0 branch.
2012-10-01 08:24:36 -06:00
Brian Paul
e642d61d13 scons: add new -p (prefix) options for yacc
These were recently added to the Makefiles.
(cherry picked from commit e78ebbc5f9)
2012-09-30 11:43:58 -07:00
Marek Olšák
d9197f9037 r600g: fix EXP on Cayman
NOTE: This is a candidate for the stable branches.
(cherry picked from commit 96f50d0cf7)
2012-09-30 05:31:49 +02:00
Marek Olšák
fc62ee7e0d r600g: fix RSQ of negative value on Cayman
NOTE: This is a candidate for the stable branches.
(cherry picked from commit fd5c538464)
2012-09-30 05:31:42 +02:00
Marek Olšák
50ba62e231 r600g: fix instance divisor on Cayman
Not sure if this is the best way to fix it.

NOTE: This is a candidate for the stable branches.
(cherry picked from commit 836325bf7e)
2012-09-30 05:31:35 +02:00
Kenneth Graunke
549129838c meta: Use float for temporary images, not (un)signed normalized.
In commit 091eb15b69, Jordan changed get_temp_image_type() to use
_mesa_get_format_datatype() instead of returning GL_FLOAT.  That has
several possible return values: GL_FLOAT, GL_INT, GL_UNSIGNED_INT,
GL_SIGNED_NORMALIZED, and GL_UNSIGNED_NORMALIZED.

We do want to use GL_INT/GL_UNSIGNED_INT for integer formats.  However,
we want to continue using GL_FLOAT for the normalized fixed-point types.
There isn't any code in pack.c to handle GL_(UN)SIGNED_NORMALIZED.

Fixes oglconform's fboarb advanced.blit.copypix, which was regressed by
commit 091eb15b69.

NOTE: This is a candidate for the 9.0 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53573
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 3767b25bd3)
2012-09-28 15:56:11 -07:00
Eric Anholt
0586a94929 i965: Remove broken non-interleaved-to-interleaved upload code.
This failed when all the uploads to occur were uniform-type vertex data (like
glColor4f being active across a DrawArrays), because it would upload 1 element
instead of 1 element per vertex.  There was no citation for how this code
helped any particular application, and it breaks ETQW, so just remove it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47170
NOTE: This is a candidate for the 9.0 and 8.0 branches.
Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 0334e8dc25)
2012-09-28 15:55:28 -07:00
Kenneth Graunke
fdabc7d9f6 meta: Don't _mesa_set_enable() invalid targets in ES 1.
GL_TEXTURE_1D, GL_TEXTURE_3D, GL_TEXTURE_RECTANGLE, and
GL_TEXTURE_GEN_S/T/R/Q don't exist in ES 1 contexts, so any meta ops
that used _mesa_meta_begin with MESA_META_TEXTURE would trigger GL
errors.  One such operation is _mesa_meta_Clear().

On ES 1, we want to disable GL_TEXTURE_GEN_STR_OES instead.

Fixes the ES1 conformance test miplin.c, which was regressed by commit
08be1d288f.

NOTE: This is a candidate for the 9.0 branch.

v2: Also blacklist GL_TEXTURE_3D, per Brian's comment.
v3: Disable GL_TEXTURE_GEN_STR_OES, per Ian's comment.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54297
Reviewed-by: Brian Paul <brianp@vmware.com> [v1]
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 679c93ff89)
2012-09-28 15:54:18 -07:00
Matt Turner
cb84fe5e10 build: Link libglapi with pthreads
NOTE: This is a candidate for the 9.0 branch.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=839060
          https://bugs.gentoo.org/show_bug.cgi?id=435152
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 9ed00075d8)
2012-09-28 15:48:30 -07:00
Matt Turner
cc18cc282f build: Use AX_PTHREAD to detect pthreads
NOTE: This is a candidate for the 9.0 branch.

Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 7da12426f7)
2012-09-28 15:48:25 -07:00
Brian Paul
5ef472dd83 mesa: fix incorrect error for glCompressedSubTexImage
If a subtexture region isn't aligned to the compressed block size,
return GL_INVALID_OPERATION, not gl_INVALID_VALUE.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 1f586684d6)
2012-09-28 15:47:57 -07:00
Ian Romanick
7c60a95a0e i915: Don't free the intel_context structure when intelCreateContext fails.
intelDestroyContext will eventually be called, and it will clean things up.

NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53618
(cherry picked from commit de958de71b)
2012-09-28 15:41:34 -07:00
Ian Romanick
8aaef12a59 i965: Don't free the intel_context structure when intelCreateContext fails.
This squashes two commits from master:

    i965: Don't free the intel_context structure when intelCreateContext fails.

    intelDestroyContext will eventually be called, and it will clean things
    up.  The call to brwInitVtbl is moved earlier so that
    intelDestroyContext can call the device-specific destructor.  This also
    makes the code look more like the i915 code.

    NOTE: This is a candidate for the 9.0 branch.

    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Eric Anholt <eric@anholt.net>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54301
    (cherry picked from commit 87f26214d6)

And:

    i965: brwInitVtbl needs to know the chipset generation

    Fixes major regressions since de958de.

    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    (cherry picked from commit e87c63f288)

The second commit message should have read 'since 87f2621', of course.
2012-09-28 15:40:20 -07:00
Ian Romanick
a87b0110b9 intel: Don't call intelDestroyContext if there is no context to destroy
Some error paths in the device-specific context creation functions can exit
before the deintel_context structure is allocated.

NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53618
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54301
(cherry picked from commit 22897c7497)
2012-09-28 15:07:02 -07:00
Ian Romanick
5174eed793 dri_util: Use calloc to allocate __DRIcontext
The __DRIcontext contains some pointers, and some drivers check for them to be
NULL in some failure paths.  Instead of sprinkling NULL assignments across the
various drivers, just zero out the whole thing.

NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Lu Hua <huax.lu@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53618
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54301
(cherry picked from commit f93cb0bebb)
2012-09-28 15:06:58 -07:00
Kenneth Graunke
8c1c18769e i965/blorp: Add support for blits between SRGB and linear formats (fixed).
This is a squash of 2 commits from master.
The first commit is:

i965/blorp: Add support for blits between SRGB and linear formats.

Fixes colorspace issues in L4D2 when multisampling is enabled (the
scene was far too dark, but the flashlight area was way too bright).

The nVidia and AMD binary drivers both allow this kind of blit.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit e2249e8c4d)

The second commit is:

i965/blorp: Fix sRGB MSAA resolves.

Commit e2249e8c4d (i965/blorp: Add
support for blits between SRGB and linear formats) changed blorp to
always configure surface states for in linear format (even if the
underlying surface is sRGB).  This allowed sRGB-to-linear and
linear-to-sRGB blits to occur without causing the image to be
inappropriately brightened or darkened.

However, it broke sRGB MSAA resolves, since they rely on the
destination buffer format being sRGB in order to ensure that samples
are averaged together in sRGB-correct fashion.

This patch fixes the problem by instead configuring the source buffer
to use the *same* format as the destination buffer.  This ensures that
the image won't be brightened or darkened, but preserves proper sRGB
averaging.

Fixes piglit tests "EXT_framebuffer_multisample/accuracy srgb".

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55265

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 124b214f09)
2012-09-28 11:20:40 -07:00
Paul Berry
849a3d243d i965: Don't spill "smeared" registers.
Fixes an assertion failure when compiling certain shaders that need both
pull constants and register spilling:

brw_eu_emit.c:204: validate_reg: Assertion `execsize >= width' failed.

NOTE: This is a candidate for the 8.0 release branch.

Signed-off-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit ab5ce2789f)
2012-09-28 11:20:40 -07:00
Paul Berry
36bc0fe4f2 i965/blorp: Increase Y alignment for multisampled stencil blits.
This patch is a band-aid fix for a bug in commit 5fd67fa (i965/blorp:
Reduce alignment restrictions for stencil blits), which causes
multisampled stencil blits to work incorrectly on Sandy Bridge.

When blitting to or from a normal stencil buffer, we have to use a
coordinate transformation that swizzles coordinates to account for the
fact that stencil buffers use W tiling, but the most similar tiling
format available for textures and render targets is Y tiling.  The
differences between W and Y tiling cause pixels to be scrambled within
a block of size 8x4 (width x height) as measured relative to a W tile,
or 16x2 as measured relative to a Y tile.  So in order to make sure
that pixels at the edges of the blit aren't lost, we need to align the
rendering rectangle (and the buffer sizes) to multiples of the 8x4
block size.  This alignment happens in the brw_blorp_blit_params
constructor, whereas the determination of how to swizzle the
coordinates happens during code generation, in the
brw_blorp_blit_program class.

When blitting to or from a multisampled stencil buffer, the coordinate
swizzling is more complex, because it has to account for the
interleaving pattern of samples, which uses 4x4 blocks for 4x MSAA and
8x4 blocks for 8x MSAA.  The end result is that if multisampling is in
use, the 16x2 block size (relative so a Y tile) needs to be expanded
to 16x4, and the corresponding size relative to a W tile expands to
8x8.

The problem doesn't affect Ivy Bridge severely enough to crop up in
Piglit tests because on Ivy Bridge we have to disable multisampling
when blitting *to* a multisampled stencil buffer (the blorp compiler
generates code to compensate for the fact that multisampling is
disabled).  However I suspect a bug is still present because we don't
disable multisampling when blitting *from* a multisampled stencil
buffer.

This patch fixes the problem by doubling the vertical alignment
requirement when blitting to or from a multisampled stencil buffer,
and multisampling has not been disabled.

In the long run I would like to rework the brw_blorp_blit_params
constructor--it's difficult to follow and has had several subtle bugs
like this one.  However this band-aid fix should be suitable for
cherry-picking to release branches.

Fixes Piglit tests "unaligned-blit {2,4} stencil {msaa,upsample}" on
Sandy Bridge.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit a33ce665a5)
2012-09-28 11:20:39 -07:00
Paul Berry
76c1c34c4a i965/blorp: Fix offsets and width/height for stencil blits.
Fixes piglit test "framebuffer-blit-levels draw stencil".

Acked-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 1a5d4f7cb2)
2012-09-28 11:20:39 -07:00
Paul Berry
21e9850d53 i965/blorp: Reduce alignment restrictions for stencil blits.
Previously, we aligned all stencil blit operations to multiples of the
size of a tile, since stencil buffers use W-tiling, and blorp has to
approximate this by configuring the 3D pipeline for Y-tiling and
swizzling coordinates.

However, this was unnecessarily conservative; it turns out that the
differences between W-tiling and Y-tiling are confined to 32-byte
sub-tiles within the 4k tiling pattern; the layout of these 32-byte
sub-tiles within the larger 4k tile is the same (8 sub-tiles across by
16 sub-tiles down, in column-major order).  Therefore we only need to
align stencil blit operations to multiples of the sub-tile size.

Note: although the performance improvement of this change is probably
quite small, the fact that W-tiling and Y-tiling formats only differ
within 32-byte sub-tiles will be essential in a future patch to ensure
that stencil blits work correctly between parts of the miptree other
than level/layer 0.  Making this change provides handy documentation
(and validation) of this fact.

Acked-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 5fd67fac14)
2012-09-28 11:20:39 -07:00
Paul Berry
62bc4af0e1 i965/blorp: don't reduce stencil alignment restrictions when multisampling.
When blitting to a stencil buffer, we need to align the rectangle we
send down the rendering pipeline, to account for the fact that the
stencil buffer uses a W-tiled layout, but we are configuring its
surface state as Y-tiled.

Previously, when the stencil buffer was multisampled, we assumed that
we could reduce the amount of alignment that was necessary, since each
pixel occupies a block of 2x2 or 4x2 samples in the stencil buffer.
That would have been correct if the coordinates we were adjusting were
measured in pixels.  However, the conversion from pixel coordinates to
coordinates within the interleaved buffer has already been done;
therefore the full alignment restriction applies.

Note: the reason this mistake wasn't previously uncovered by piglit
tests is because it is being masked by another mistake: the blorp
engine is using overly conservative alignment restrictions when doing
stencil blits.  The overly conservative alignment restrictions will be
removed in the patch that follows.  Doing this fix now will prevent
the subsequent patch from introducing regressions.

Acked-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 1a75063d5f)
2012-09-28 11:20:39 -07:00
Paul Berry
68da5dfc2c intel: Add map_stencil_as_y_tiled to intel_region_get_aligned_offset.
This patch modifies intel_region_get_aligned_offset() to make the
appropriate calculation when the blorp engine sets up a W-tiled
stencil buffer using a Y-tiled SURFACE_STATE.

Acked-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit b760c9913d)
2012-09-28 11:20:39 -07:00
Paul Berry
96fd94ba94 intel: Add map_stencil_as_y_tiled to intel_region_get_tile_masks.
When the blorp engine is performing a blit from one stencil buffer to
another, it sets up the surface state for these buffers as Y-tiled, so
it needs to be able to force intel_region_get_tile_masks() to return
the appropriate masks for a Y-tiled region.

Acked-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 50dec7fc2d)
2012-09-28 11:20:39 -07:00
Paul Berry
239e9bef92 i965/blorp: Account for offsets when emitting SURFACE_STATE.
Fixes piglit tests "framebuffer-blit-levels {read,draw} depth".

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit f04f219906)
2012-09-28 11:20:39 -07:00
Paul Berry
e87174cf4b i965/blorp: Thread level and layer through brw_blorp_blit_miptrees().
Previously, when performing a blit using the blorp engine, we failed
to account for the level and layer of the source and destination.  As
a result, all blits would occur between miplevel 0 and layer 0 of the
corresponding textures, regardless of which level/layer was bound to
the framebuffer.

This patch passes the correct level and layer through
brw_blorp_miptrees() into the brw_blorp_blit_params data structure.

Further patches in the series will adapt
gen{6,7}_blorp_emit_surface_state to make use of these parameters.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 3123f06215)
2012-09-28 11:20:39 -07:00
Paul Berry
127dc6d136 i965/blorp: store x and y offsets in brw_blorp_mip_info.
Currently, gen{6,7}_blorp_emit_surface_state assumes that the src and
dst surfaces are mapped to miplevel 0 and layer 0 (thus no surface
offset is required).  This is a bug, since the user might try to blit
to and from levels/layers other than 0.

To fix this bug, it will not be sufficient to have
gen6_{6,7}_blorp_emit_surface_state look up the surface offset at the
time they set up the surface state, since these offsets will need to
be tweaked when blitting stencil buffers (due to the fact that stencil
buffer blits have to swizzle between W and Y tiling formats).

So, to pave the way for the bug fix, this patch causes the x and y
offsets to be computed during blit setup and stored in
brw_blorp_mip_info.

As a result of this change, brw_blorp_mip_info doesn't need to store
the level and layer anymore.

For consistency, this patch makes a similar change to the handling of
depth buffers when doing HiZ operations.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit c130ce7b2b)
2012-09-28 11:20:38 -07:00
Paul Berry
602e9a0f37 i965/blorp: store surface width/height in brw_blorp_mip_info.
Previously, gen{6,7}_blorp_emit_surface_state would look up the width
and height of the surface at the time they set up the surface state,
and then tweak it if necessary (it's necessary when a W-tiled surface
is being mapped as Y-tiled).  With this patch, we look up the width
and height when setting up the blit, and store them in
brw_blorp_mip_info.  This allows us to do the necessary tweak in the
brw_blorp_blit_params constructor (where it makes more sense).  It
also reduces the need to keep track of level and layer in
brw_blorp_mip_info, so that a future patch can eliminate them
entirely.

For consistency, this patch makes a similar change to the handling of
depth buffers when doing HiZ operations.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 09b0fa8499)
2012-09-28 11:20:38 -07:00
Paul Berry
5c66640ac7 i965/blorp: Change gl_renderbuffer* params to intel_renderbuffer*.
This makes it more convenient for blorp functions to get access to
Intel-specific data inside the renderbuffer objects.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit e14b1288ef)
2012-09-28 11:20:38 -07:00
Paul Berry
cb9765ca94 i965/blorp: Clarify why width/height must be adjusted for Gen6 IMS surfaces.
Also add a clarifying comment for why the width/height doesn't need
adjustment for Gen7.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 32c7b2769c)
2012-09-28 11:20:38 -07:00
Paul Berry
5db1deab51 i965/gen6+: Adjust stencil buffer size after computing miptree layout.
Since Gen6+ stencil buffers use W-tiling (a tiling arrangement which
drm and the kernel are not aware of) we need to round up the width and
height of a stencil buffer to multiples of the W-tile size (64x64)
before allocating a stencil buffer.  Previously, we rounded up the
size of the base miplevel, and then computed the miptree layout based
on the rounded up size.  This was incorrect, because it meant that the
total size of the miptree would not be properly W-tile aligned, and
therefore we would not always allocate enough pages.

(Note: even though the GL API doesn't allow creation of mipmapped
stencil textures, it does allow mipmapping of a combined depth/stencil
texture, and on Gen6+, a combined depth/stencil texture is internally
implemented as a pair of separate depth and stencil buffers.)

For example, on Sandy Bridge, when allocating a mipmapped stencil
texture of size 128x128, we would first round up to the nearest
multiple of 64x64 (causing no change to the size), and then compute
the miptree layout (whose size worked out to 128x196).  Then we would
request an allocation of 128*196 bytes (6.125 pages), causing 7 pages
to be allocated to the texture.  However, the texture needs 8 pages,
since each W-tile occupies a page, and it takes 2 W-tiles to cover a
width of 128 and 4 W-tiles to cover a height of 196.

This patch changes the order of operations so that the miptree layout
is computed first and then the total size of the miptree is rounded up
to be W-tile aligned.

NOTE: This is a candidate for the 8.0 release branch.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit bde833c9d0)
2012-09-28 11:20:38 -07:00
Ian Romanick
4cdbf27fac mesa: Don't set uniform dispatch pointers for many things in ES2 or core
NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 6c01a0e770)
2012-09-28 10:56:46 -07:00
Ian Romanick
0fb12a40e4 mesa: Don't set shaderapi dispatch pointers for many things in ES2 or core
v2: Allow GL_ARB_shader_objects functions in core profile because we
still expose the extension string there.  Don't allow
glBindFragDataLocation in GLES3 because it's not part of that API.
Based (mostly) on review comments from Eric Anholt.

NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit be66cf950e)
2012-09-28 10:55:30 -07:00
Ian Romanick
f16031513f mesa: Don't set vtxfmt dispatch pointers for many things in ES2 or core
NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit aa0f588e2d)
2012-09-28 10:52:05 -07:00
Ian Romanick
0dc989ea5b mesa: Don't set loopback dispatch pointers for most things in ES2 or core
NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit a13c07f752)
2012-09-28 10:50:16 -07:00
Ian Romanick
c01f896062 mesa: Pass GL context to _mesa_create_save_table
This isn't used by this patch, but it will be necessary for several
follow-on patches.  Separating this out will make it easier to reorder
patches later.

NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 3ef9e43865)
2012-09-28 10:36:55 -07:00
Ian Romanick
b56c93dfff mesa: Don't set dispatch pointer for glTexStorage in ES2
NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit ee77061277)
2012-09-28 10:35:02 -07:00
Ian Romanick
90ec1db9f4 mesa: Don't set dispatch pointer for glGetProgramivARB in ES2
This function is not the same as glGetProgramiv.

NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 7f7268d385)
2012-09-28 10:27:36 -07:00
Ian Romanick
dd0dd9aa52 mesa: Don't set dispatch pointer for glResizeBuffersMESA in ES2
NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit a83b01371e)
2012-09-28 10:22:24 -07:00
Ian Romanick
7dc8dc0f7c mesa: Don't set dispatch pointers for glPointParameter[if][v] in ES2
NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 1c0a44aaf5)
2012-09-28 10:19:55 -07:00
Ian Romanick
961567d0fe mesa: Don't set dispatch pointers for glClearDepth or glDepthRange in ES2
NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 2a3a68e4c7)
2012-09-28 10:19:19 -07:00
Ian Romanick
de4e222794 mesa: Don't set dispatch pointer for glGetBufferSubData in ES2
NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 11927bfc4a)
2012-09-28 10:17:20 -07:00
Ian Romanick
f57bc97c7a mesa: Don't set dispatch pointer for glGetDoublev in ES2
NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 850412b8ab)
2012-09-28 10:16:38 -07:00
Ian Romanick
bb16b471d2 mesa: Don't set dispatch pointer for glPointSize in ES2
NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit aa129b0833)
2012-09-28 10:14:53 -07:00
Ian Romanick
d87c319390 gles2: Alias glReadBufferNV with desktop glReadBuffer
NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: Kristian Høgsberg <krh@bitplanet.net>
(cherry picked from commit 23ff634c9c)
2012-09-28 10:11:56 -07:00
Ian Romanick
cf81335712 mesa: Allow glGetTexParameter of GL_TEXTURE_SRGB_DECODE_EXT
This was already (correctly) supported for glGetSamplerParameter paths.

NOTE: This is a candidate for stable branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit ae3023e967)
2012-09-28 09:56:09 -07:00
Chris Forbes
8d06574d2b mesa: fix dropped && in glGetStringi()
This fixes glGetStringi(GL_EXTENSIONS,.. for core contexts. Previously,
all extension names returned would be NULL.

NOTE: This is a candidate for release branches.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit d30a7d2eb4)
2012-09-28 09:56:04 -07:00
Brian Paul
4eecc8d007 upgrade glext.h to version 85
NOTE: This is a candidate for the stable branches.
(cherry picked from commit 68060cfb2b)
2012-09-28 09:51:20 -07:00
Matt Turner
b1ce5749b9 targets/xorg-i915: Rename driver to i915_drv.so.
modesetting_drv.so is undescriptive and collides with
xf86-video-modesetting.

Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2012-09-25 12:05:20 -07:00
Kenneth Graunke
82a08e2f46 mesa: Ignore SRGB when determining compatible resolve formats.
MSAA resolves and other blit-like operations ignore SRGB state anyway,
so we should be able to safely allow resolves between compatible
SRGB/linear formats like SRGBA8 and RGBA8888.

This matches the behavior of the nVidia and AMD binary drivers.

Fixes completely black rendering when using multisampling in L4D2.

NOTE: This is a candidate for the 9.0 branch.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit c96828ecb4)
2012-09-25 07:21:40 -07:00
Kenneth Graunke
3dd84a58bb mesa: Don't override S3TC internalFormat if data is pre-compressed.
Commit 42723d88d intended to override an S3TC internalFormat to a
generic compressed format when the application requested online
compression of uncompressed data.  Unfortunately, it also broke
pre-compressed textures when libtxc_dxtn isn't installed but the
extensions are forced on.

Both glCompressedTexImage2D() and glTexImage2D() call teximage(), which
calls _mesa_choose_texture_format(), hitting this override code.  If we
have actual S3TC source data, we can't treat it as any other format, and
need to avoid the override.

Since glCompressedTexImage2D() passes in a format of GL_NONE (which is
illegal for glTexImage), we can use that to detect the pre-compressed
case and avoid the overrides.

Fixes a regression since 42723d88d3.

NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-and-tested-by: Jordan Justen <jordan.l.justen@intel.com>
(cherry picked from commit 328961d955)
2012-09-25 07:17:33 -07:00
Kenneth Graunke
0231c54ebb meta: Don't _mesa_set_enable() invalid targets in ES 1.
GL_TEXTURE_1D, GL_TEXTURE_3D, GL_TEXTURE_RECTANGLE, and GL_TEXTURE_GEN_*
don't exist in ES 1 contexts, so any meta ops that used _mesa_meta_begin
with MESA_META_TEXTURE would trigger GL errors.  One such operation is
_mesa_meta_Clear().

Fixes the ES1 conformance test miplin.c, which was regressed by commit
08be1d288f.

NOTE: This is a candidate for the 9.0 branch.

v2: Also blacklist GL_TEXTURE_3D, per Brian's comments.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54297
Cc: Ian Romanick <idr@freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2012-09-25 07:17:09 -07:00
Jonas Maebe
2fe673fec3 darwin: do not create double-buffered offscreen pixel formats
http://xquartz.macosforge.org/trac/ticket/536

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 5fdf1f784b)
2012-09-24 16:06:37 -07:00
Vadim Girlin
f6a66a33f7 winsys/radeon: fix relocs caching
Don't cache pointers to elements of reallocatable array.
In some circumstances it caused false cache hits resulting in incorrect
command stream and gpu lockup.

Note: This is a candidate for the stable branches.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
(cherry picked from commit 9aa8bac98b)
2012-09-24 03:05:39 +02:00
Marek Olšák
38d1191f41 draw: fix non-indexed draw calls if there's an index buffer
pipe_draw_info::indexed determines if it should be indexed and not
the presence of an index buffer.

This fixes crashes in r300g.

NOTE: This is a candidate for the stable branches.

Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 2988fa940e)
2012-09-22 14:22:15 +02:00
Marek Olšák
a940c74bc3 r600g: set QUANT_MODE on Cayman too
This fixes piglit/fbo-blit-stretched.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit bfe489c76b)
2012-09-22 01:19:51 +02:00
Marek Olšák
c3454d95af r600g: do not require MSAA renderbuffer support if not asked for
to allow stencil-only sampler-only formats (like X24S8)

NOTE: This is a candidate for the stable branches.
(cherry picked from commit df5e2c058f)
2012-09-22 01:19:33 +02:00
Marek Olšák
27e056ff15 gallium/u_blitter: fix stencil-only blits
NOTE: This is a candidate for the stable branches.
(cherry picked from commit 61706915a3)
2012-09-22 01:19:23 +02:00
Marek Olšák
e81717e9e7 r300g: fix colormask with non-BGRA formats
NOTE: This is a candidate for the stable branches.
(cherry picked from commit 1e51d368eb)
2012-09-22 01:19:13 +02:00
Marek Olšák
86735d78e6 r600g: don't use a staging resource for large transfers
It kills performance if the resource is linear.
(cherry picked from commit e386972f5b)
2012-09-22 01:18:57 +02:00
Andreas Boll
890b405232 docs: fix some issues in relnotes
improve markup
fix link to relnotes-9.0
add missing relnotes links
(cherry picked from commit 6fb8aeb2c5)
2012-09-19 12:24:13 +02:00
Andreas Boll
1e314197dd docs/devinfo: fix typo
(cherry picked from commit abb1c847ac)
2012-09-19 12:24:13 +02:00
Matt Turner
437c40eee4 build: Don't list glproto and dri2proto in pkg-config file
No files provided by glproto or dri2proto are needed for building
something with Mesa.

Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=342393
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2012-09-18 14:10:11 -07:00
Dave Airlie
7cfd42cefe mesa/glsl: rename preprocess to glcpp_preprocess
This symbol with dricore escapes into the namespace, its too generic,
we should prefix it with something just to be nice.

Should be applied to stable + 9.0

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 88b0790b1a)
2012-09-15 08:27:51 +10:00
Dave Airlie
8f7990c5f2 glcpp: fix abuse of yylex
So glcpp tried to workaround yylex its own way, but failed,
do it properly.

This fixes another crash found after fixing the first crash.

this is a candidate for 9.0 and stable branches

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 53d46bc787)
2012-09-15 08:27:51 +10:00
Dave Airlie
a834381506 mesa: use a prefix for the program lex
This avoids us making a global yylex symbol which will interfere will
all sorts of apps.

with libdricore which can't do symbol visibility currently we pollute
the namespace with this.

This is a candidate for 9.0 & stable branches.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit cc943c8470)
2012-09-15 08:27:51 +10:00
Mike Frysinger
fafaf56479 mklib: clean up abi flags for x86 targets
The current code is duplicated in two places and relies on `uname` to
detect the flags.  This is no good for cross-compiling, and the current
logic uses -m64 for the x32 ABI which breaks things.

Unify the code in one place, avoid `uname` completely, and add support
for the new x32 ABI.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-09-14 15:26:27 -07:00
Alex Deucher
f94b6d706f r600g: reduce quant mode on evergreen+
Seems to have an affect on the allowable range of
values.  Set evergreen+ to 1/256 to match 6xx/7xx.

fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=54877

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit b33d7eaa5e)
2012-09-14 09:26:59 -04:00
Kenneth Graunke
a5a86652f1 i965: Fix out-of-order sampler unit usage in ARB fragment programs.
ARB fragment programs use texture unit numbers directly, unlike GLSL
which has an extra indirection.  If a fragment program only uses one
texture assigned to GL_TEXTURE1, SamplersUsed will only contain a single
bit, which would make us only upload a single surface/sampler state
entry.  However, it needs to be the second entry.

Using _mesa_fls() instead of _mesa_bitcount() solves this.  For ARB
programs, this makes num_samplers the ID of the highest texture unit
used.  Since GLSL uses consecutive integers assigned by the linker,
_mesa_fls() should give the same result as _mesa_bitcount()..

Fixes a regression since 85e8e9e000,
which caused GPU hangs in ETQW (and probably others), as well as
breaking piglit test fp-fragment-position.

v2: Add a comment, as suggested by Matt.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54098
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54179
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Tested-by: meng <mengmeng.meng@intel.com>
(cherry picked from commit 28f4be9eb9)
2012-09-14 02:03:00 -07:00
Kenneth Graunke
66e8f863d3 mesa: Add a _mesa_fls() function to find the last bit set in a word.
ffs() finds the least significant bit set; _mesa_fls() finds the /most/
significant bit.

v2: Make it an inline function in imports.h, per Brian's suggestion.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 0fc163408e)
2012-09-14 02:02:53 -07:00
Vadim Girlin
c586fce4fb r600g: adjust QUANT_MODE for higher precision
Use 1/256 for R6xx/7xx, 1/4096 for evergreen, instead of default 1/16.

Helps to pass some piglit tests (fbo, multisample).

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit f44bda17f5)
2012-09-12 11:57:36 +02:00
Vadim Girlin
405d47bbe7 mesa: don't wait in _mesa_ClientWaitSync if timeout is 0
From ARB_sync spec:

    If the value of <timeout> is zero, then ClientWaitSync does not
    block, but simply tests the current state of <sync>. TIMEOUT_EXPIRED
    will be returned in this case if <sync> is not signaled, even though
    no actual wait was performed.

Fixes random fails of the arb_sync-timeout-zero piglit test on r600g.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit b05a1fc156)
2012-09-12 11:57:36 +02:00
Brian Paul
04f902b472 mesa: fix proxy texture error handling in glTexStorage()
This is basically a follow-on to 1f5b1f9846.
Basically, generate GL errors for ordinary invalid parameters for proxy
targets the same as for non-proxy targets.  Only texture size and OOM
errors should be handled specially for proxies.

Note: This is a candidate for the stable branches.
(cherry picked from commit 35c75f6777)
2012-09-12 10:22:04 +02:00
Brian Paul
f9bb66b1ce mesa: make _mesa_get_proxy_target() non-static
Needed for the next patch.

Note: This is a candidate for the stable branches.
(cherry picked from commit d17440dcaa)
2012-09-12 10:22:04 +02:00
Brian Paul
10b9a02952 mesa: do internal format error checking for glTexStorage()
Turns out we weren't doing any format checking before.  Now check
the internal format and, in particular, make sure that unsized internal
formats aren't accepted.

Note: This is a candidate for the stable branches.
(cherry picked from commit 2e4fc54977)
2012-09-12 10:22:04 +02:00
Paul Berry
1f4d074f75 mesa/msaa: Allow X and Y flips in multisampled blits.
From the GL 4.3 spec, section 18.3.1 "Blitting Pixel Rectangles":

    If SAMPLE_BUFFERS for either the read framebuffer or draw
    framebuffer is greater than zero, no copy is performed and an
    INVALID_OPERATION error is generated if the dimensions of the
    source and destination rectangles provided to BlitFramebuffer are
    not identical, or if the formats of the read and draw framebuffers
    are not identical.

It is not clear from the spec whether "dimensions" should mean both
sign and magnitude, or just magnitude.

Previously, Mesa interpreted "dimensions" as meaning both sign and
magnitude, so any multisampled blit that attempted to flip the image
in the X and/or Y direction would fail.

However, Y flips are likely to be commonplace in OpenGL applications
that have been ported from DirectX applications, as a result of the
fact that DirectX and OpenGL differ in their orientation of the Y
axis.  Furthermore, at least one commercial driver (nVidia) permits Y
filps, and L4D2 relies on them being permitted.  So it seems prudent
for Mesa to permit them.

This patch changes Mesa to allow both X and Y flips, since there is no
language in the spec to indicate that X and Y flips should be treated
differently.

NOTE: This is a candidate for stable release branches.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit 5d5f0f3491)
2012-09-12 10:22:04 +02:00
Kenneth Graunke
42ef3f68c9 glsl: Generate compile errors for explicit blend indices < 0 or > 1.
According to the GLSL 4.30 specification, this is a compile time error.
Earlier specifications don't specify a behavior, but since 0 and 1 are
the only valid indices for dual source blending, it makes sense to
generate the error.

Fixes (the fixed version of) piglit's layout-12.frag.

NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
(cherry picked from commit 354f2cb5c7)
2012-09-12 10:22:03 +02:00
Eric Anholt
e2b4f9aac3 i965: Fix virtual_grf_interferes() between calculate_live_intervals() and DCE.
This fixes the blue zombies bug in l4d2.

NOTE: This is a candidate for the 9.0 branch.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 39aca5076f)
2012-09-12 10:22:03 +02:00
Brian Paul
8b8416676e glapi/glx: rename 'table' variable to 'disp_table'
This fixes an issue where the local 'table' variable was hiding the
function parameter name in glGetColorTable(..., void *table).

This should be OK as long as there's never a GL entrypoint that uses
'disp_table' as a parameter name.

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 043f66204b)
2012-09-12 10:22:03 +02:00
Brian Paul
6e9baa85a9 mesa: fix per-level max texture size error checking
This is a long-standing omission in Mesa's texture image size checking.
We need to take the mipmap level into consideration when checking if the
width, height and depth are too large.

Fixes the new piglit max-texture-size-level test.
Thanks to Stéphane Marchesin for finding this problem.

Note: This is a candidate for the stable branches.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
(cherry picked from commit 771e7b6d88)
2012-09-12 10:22:03 +02:00
Brian Paul
3f6ce3454f st/mesa: s/CALLOC/calloc/ to fix allocation bug
The CALLOC() macro only takes one argument so this was being treated
as a comma expression.  Simply use calloc() instead.

A follow-on patch will replace all CALLOC() calls with calloc().

NOTE: This is a candidate for the 8.0 and 9.0 branches.
(cherry picked from commit 43ed822a50)
2012-09-12 10:22:03 +02:00
Johannes Obermayr
7f011e2075 Set OSMESA_VERSION=8.
VERSION_NUMBER is not required anymore. So it will be removed.

Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 10a96f4a4d)
2012-09-07 15:29:48 -04:00
Jerome Glisse
41d14eaf19 r600g: fix num of dwords needed for alphatest_state atom
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2012-09-06 15:23:51 -04:00
Chad Versace
13b8eb6452 mesa: Don't advertise GLES extensions in GL contexts
glGetStringi(GL_EXTENSIONS) failed to respect the context's API, and so
returned all internally enabled GLES extensions from a GL context.
Likewise, glGetIntegerv(GL_NUM_EXTENSIONS) also failed to repsect the
context's API.

Note: This is a candidate for the 8.0 and 9.0 branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit f29a4b0157)
2012-09-06 11:49:11 -07:00
Tapani Pälli
c7775e842b android: do not expose single buffered eglconfigs
On Android we want to add only double buffered configs for visuals.
Earlier implementation set the SurfaceType as 0 for single buffered
configs but driver still exposed these configs that were not compatible
with any egl surface type.  This caused Khronos conformance test runs to
fail on Android. This patch fixes the issue by skipping single buffered
configs earlier and not exposing them.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit d58ca43b80)
2012-09-04 19:24:14 -07:00
Tapani Pälli
2a69de60bf android: fix liblog API changes
android logging macros changed their name in JellyBean.

Signed-off-by: Bruce E. Robertson <bruce.e.robertson@intel.com>
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 29d394b9ba)
2012-09-04 19:24:14 -07:00
Tapani Pälli
8cffec495c xmlconfig: use __progname when building for Android
__progname symbol and strrchr are available with bionic.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 4d02b018f4)
2012-09-04 19:24:14 -07:00
Ian Romanick
284fe97515 meta: Don't save and restore fog state when there is no fog state
I wonder if the better solution is to have _mesa_meta_GenerateMipmap not
use MESA_META_ALL for the GLSL path.  Even on compatibility profiles
there is no reason to save and restore fog on this path.

NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Lu Hua <huax.lu@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54295
(cherry picked from commit 51b069e7aa)
2012-09-03 10:38:48 -07:00
Kenneth Graunke
6886da783a i965/fs: Don't use brw->fragment_program in calculate_urb_setup().
Reading brw->fragment_program is nonsensical in compiler code: it
contains the currently active program (if any), not the one currently
being compiled.  Attempting to access it may either lead to crashes
(null pointer dereference if no program is active) or wrong results.

Fixes piglit regressions since 9ef710575b
on pre-Sandybridge hardware.  The actual bug was created in commit
7b1fbc6889.

NOTE: This is a candidate for the 8.0 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54183
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
(cherry picked from commit 4d9abd96cc)
2012-08-31 23:00:25 -07:00
Matt Turner
b982fa8e8f build: Remove left over echo from GLU removal 2012-08-31 15:13:23 -07:00
Matt Turner
d240dcee6d Remove libGLU
It's been moved to its own repository, found at
	http://cgit.freedesktop.org/mesa/glu/

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2012-08-31 15:08:40 -07:00
Jakob Bornecrantz
0097809879 dri: Rework planar image interface
As discussed with Kristian on #wayland. Pushes the decision of components into
the dri driver giving it greater freedom to allow t to implement YUV samplers
in hardware, and which mode to use.

This interface will also allow drivers like SVGA to implement YUV surfaces
without the need to sub-allocate and instead send 3 seperate buffers for each
channel, currently not implemented.

I have tested these changes on Gallium Svga. Scott tested them on both intel
and Gallium Radeon. Kristan and Pekka tested them on intel.

v2: Fix typo in dri2_from_planar.
v3: Merge in intel changes.

(cherry picked from commit 6a7dea93fa)

Tested-by: Scott Moreau <oreaus@gmail.com>
Tested-by: Pekka Paalanen <ppaalanen@gmail.com>
Tested-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
2012-08-31 19:53:45 +02:00
Marek Olšák
ef557eacff winsys/radeon: disable virtual memory on Cayman
It hangs.
2012-08-31 18:02:35 +02:00
Vinson Lee
de92b7adca scons: Remove leftover print statement.
Remove print statement left over from commit
c57fb034b1.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
(cherry picked from commit f3bb6bd9b3)
2012-08-31 08:30:54 -07:00
Andreas Boll
3ffd5dfbce docs: update relnotes-9.0
Signed-off-by: Brian Paul <brianp@vmware.com>
2012-08-31 09:22:39 -06:00
Andreas Boll
03785fe360 mesa: also bump version in Makefile.am and configure.ac to 9.0
Signed-off-by: Brian Paul <brianp@vmware.com>
2012-08-31 09:22:36 -06:00
Vinson Lee
7b676fd738 scons: Add default libraries to Solaris build.
Fixes SCons build on Solaris.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54293
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Signed-off-by: Brian Paul <brianp@vmware.com>
2012-08-31 08:24:59 -06:00
354 changed files with 2517 additions and 59670 deletions

View File

@@ -40,7 +40,7 @@ LOCAL_CFLAGS += \
-DANDROID_VERSION=0x0$(major)0$(minor)
LOCAL_CFLAGS += \
-DPTHREADS \
-DHAVE_PTHREAD=1 \
-fvisibility=hidden \
-Wno-sign-compare

View File

@@ -21,6 +21,8 @@
SUBDIRS = src
ACLOCAL_AMFLAGS = -I m4
doxygen:
cd doxygen && $(MAKE)
@@ -52,7 +54,7 @@ distclean-local:
# Rules for making release tarballs
PACKAGE_VERSION=8.1-devel
PACKAGE_VERSION=9.0
PACKAGE_DIR = Mesa-$(PACKAGE_VERSION)
PACKAGE_NAME = MesaLib-$(PACKAGE_VERSION)

View File

@@ -319,6 +319,25 @@ case $ARCH in
fi
fi
# Check if objects are 32-bit and we're running in 64-bit
# environment. If so, pass -m32 flag to linker.
add_abi_flag_to_opts() {
case $(file $1) in
*32-bit*x86-64*)
# x86_64 x32 ABI.
OPTS="-mx32 ${OPTS}"
;;
*64-bit*x86-64*)
# x86_64 64-bit ABI.
OPTS="-m64 ${OPTS}"
;;
*32-bit*Intel*)
# x86 32-bit ABI.
OPTS="-m32 ${OPTS}"
;;
esac
}
if [ $NOPREFIX = 1 ] ; then
# No "lib" or ".so" part
echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}
@@ -330,15 +349,8 @@ case $ARCH in
;;
esac
# Check if objects are 32-bit and we're running in 64-bit
# environment. If so, pass -m32 flag to linker.
set ${OBJECTS}
ABI32=`file $1 | grep 32-bit`
ARM=`file $1 | grep ARM`
# Do not add "-m32" option for arm.
if [ -z "$ARM" -a "${ABI32}" -a `uname -m` = "x86_64" ] ; then
OPTS="-m32 ${OPTS}"
fi
# Check to see if we are building for a different ABI.
add_abi_flag_to_opts ${OBJECTS}
if [ "${ALTOPTS}" ] ; then
OPTS=${ALTOPTS}
@@ -389,15 +401,9 @@ case $ARCH in
# exptmp is removed below
fi
# Check if objects are 32-bit and we're running in 64-bit
# environment. If so, pass -m32 flag to linker.
set ${OBJECTS}
ABI32=`file $1 | grep 32-bit`
ARM=`file $1 | grep ARM`
# Do not add "-m32" option for arm.
if [ -z "$ARM" -a "${ABI32}" -a `uname -m` = "x86_64" ] ; then
OPTS="-m32 ${OPTS}"
fi
# Check to see if we are building for a different ABI.
add_abi_flag_to_opts ${OBJECTS}
if [ "${ALTOPTS}" ] ; then
OPTS=${ALTOPTS}
fi

View File

@@ -94,7 +94,7 @@ MOTIF_CFLAGS = -I/usr/include/Motif1.2
# Directories to build
LIB_DIR = lib
SRC_DIRS = glsl mapi/glapi mapi/vgapi mesa \
gallium egl gallium/winsys gallium/targets glu
gallium egl gallium/winsys gallium/targets
DRIVER_DIRS = x11 osmesa
# Gallium directories and

View File

@@ -6,9 +6,10 @@ dnl Tell the user about autoconf.html in the --help output
m4_divert_once([HELP_END], [
See docs/autoconf.html for more details on the options for Mesa.])
AC_INIT([Mesa], [8.1.0],
AC_INIT([Mesa], [9.0.0],
[https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
AC_CONFIG_AUX_DIR([bin])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([foreign])
@@ -26,6 +27,10 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
LT_PREREQ([2.2])
LT_INIT([disable-static])
dnl Set internal versions
OSMESA_VERSION=8
AC_SUBST([OSMESA_VERSION])
dnl Versions for external dependencies
LIBDRM_REQUIRED=2.4.24
LIBDRM_RADEON_REQUIRED=2.4.39
@@ -155,13 +160,13 @@ DEFINES=""
AC_SUBST([DEFINES])
case "$host_os" in
linux*|*-gnu*|gnu*)
DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
DEFINES="$DEFINES -D_GNU_SOURCE"
;;
solaris*)
DEFINES="$DEFINES -DPTHREADS -DSVR4"
DEFINES="$DEFINES -DSVR4"
;;
cygwin*)
DEFINES="$DEFINES -DPTHREADS"
DEFINES="$DEFINES"
;;
esac
@@ -340,18 +345,12 @@ AC_ARG_WITH([gl-lib-name],
[specify GL library name @<:@default=GL@:>@])],
[GL_LIB=$withval],
[GL_LIB=GL])
AC_ARG_WITH([glu-lib-name],
[AS_HELP_STRING([--with-glu-lib-name@<:@=NAME@:>@],
[specify GLU library name @<:@default=GLU@:>@])],
[GLU_LIB=$withval],
[GLU_LIB=GLU])
AC_ARG_WITH([osmesa-lib-name],
[AS_HELP_STRING([--with-osmesa-lib-name@<:@=NAME@:>@],
[specify OSMesa library name @<:@default=OSMesa@:>@])],
[OSMESA_LIB=$withval],
[OSMESA_LIB=OSMesa])
AS_IF([test "x$GL_LIB" = xyes], [GL_LIB=GL])
AS_IF([test "x$GLU_LIB" = xyes], [GLU_LIB=GLU])
AS_IF([test "x$OSMESA_LIB" = xyes], [OSMESA_LIB=OSMesa])
dnl
@@ -366,11 +365,9 @@ AC_ARG_ENABLE([mangling],
if test "x${enable_mangling}" = "xyes" ; then
DEFINES="${DEFINES} -DUSE_MGL_NAMESPACE"
GL_LIB="Mangled${GL_LIB}"
GLU_LIB="Mangled${GLU_LIB}"
OSMESA_LIB="Mangled${OSMESA_LIB}"
fi
AC_SUBST([GL_LIB])
AC_SUBST([GLU_LIB])
AC_SUBST([OSMESA_LIB])
dnl
@@ -389,7 +386,6 @@ if test "x$enable_texture_float" = xyes; then
fi
GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
@@ -398,7 +394,6 @@ VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
GLAPI_LIB_NAME='lib$(GLAPI_LIB).'${LIB_EXTENSION}
GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
GLU_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLU_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
@@ -407,7 +402,6 @@ VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENS
GLAPI_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLAPI_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
AC_SUBST([GL_LIB_NAME])
AC_SUBST([GLU_LIB_NAME])
AC_SUBST([OSMESA_LIB_NAME])
AC_SUBST([EGL_LIB_NAME])
AC_SUBST([GLESv1_CM_LIB_NAME])
@@ -416,7 +410,6 @@ AC_SUBST([VG_LIB_NAME])
AC_SUBST([GLAPI_LIB_NAME])
AC_SUBST([GL_LIB_GLOB])
AC_SUBST([GLU_LIB_GLOB])
AC_SUBST([EGL_LIB_GLOB])
AC_SUBST([GLESv1_CM_LIB_GLOB])
AC_SUBST([GLESv2_LIB_GLOB])
@@ -507,6 +500,13 @@ AC_SUBST([DLOPEN_LIBS])
dnl See if posix_memalign is available
AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
dnl Check for pthreads
AX_PTHREAD
dnl AX_PTHREADS leaves PTHREAD_LIBS empty for gcc and sets PTHREAD_CFLAGS
dnl to -pthread, which causes problems if we need -lpthread to appear in
dnl pkgconfig files.
test -z "$PTHREAD_LIBS" && PTHREAD_LIBS="-lpthread"
dnl SELinux awareness.
AC_ARG_ENABLE([selinux],
[AS_HELP_STRING([--enable-selinux],
@@ -521,6 +521,7 @@ if test "x$enable_selinux" = "xyes"; then
SELINUX_LIBS="-lselinux"
DEFINES="$DEFINES -DMESA_SELINUX"
fi
AC_SUBST([SELINUX_LIBS])
dnl Options for APIs
AC_ARG_ENABLE([opengl],
@@ -861,19 +862,18 @@ xyesyes)
GL_PC_REQ_PRIV="x11 xext"
X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
GL_LIB_DEPS="$XLIBGL_LIBS"
GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $DLOPEN_LIBS"
GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm $PTHREAD_LIBS"
;;
xyesno)
# DRI-based GLX
PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
GL_PC_REQ_PRIV="glproto >= $GLPROTO_REQUIRED"
if test x"$driglx_direct" = xyes; then
if test "x$have_libdrm" != xyes; then
AC_MSG_ERROR([Direct rendering requires libdrm >= $LIBDRM_REQUIRED])
fi
PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED"
fi
# find the DRI deps for libGL
@@ -890,9 +890,9 @@ xyesno)
X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
GL_LIB_DEPS="$DRIGL_LIBS"
# need DRM libs, -lpthread, etc.
GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
# need DRM libs, $PTHREAD_LIBS, etc.
GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
GL_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
;;
esac
@@ -900,10 +900,10 @@ esac
# builds.
AM_CONDITIONAL(HAVE_XF86VIDMODE, test "x$HAVE_XF86VIDMODE" = xyes)
GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
GLESv1_CM_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
GLESv2_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
AC_SUBST([GL_LIB_DEPS])
AC_SUBST([GL_PC_REQ_PRIV])
@@ -915,12 +915,7 @@ AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
AC_SUBST([GLESv2_LIB_DEPS])
AC_SUBST([GLESv2_PC_LIB_PRIV])
GLAPI_LIB_DEPS="-lpthread $SELINUX_LIBS"
AC_SUBST([GLAPI_LIB_DEPS])
DRI_LIB_DEPS="\$(top_builddir)/src/mesa/libdricore/libdricore${VERSION}.la"
GALLIUM_DRI_LIB_DEPS="\$(TOP)/\$(LIB_DIR)/libdricore${VERSION}.so"
AC_SUBST([HAVE_XF86VIDMODE])
@@ -950,8 +945,8 @@ AC_ARG_ENABLE([glx-tls],
[GLX_USE_TLS=no])
AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
AS_IF([test "x$GLX_USE_TLS" = xyes],
[DEFINES="${DEFINES} -DGLX_USE_TLS -DPTHREADS"])
AS_IF([test "x$GLX_USE_TLS" = xyes -a "x$ax_pthread_ok" = xyes],
[DEFINES="${DEFINES} -DGLX_USE_TLS"])
dnl
dnl More DRI setup
@@ -1035,7 +1030,7 @@ if test "x$enable_dri" = xyes; then
esac
;;
freebsd* | dragonfly* | *netbsd*)
DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1"
DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
if test "x$DRI_DIRS" = "xyes"; then
@@ -1094,9 +1089,10 @@ if test "x$enable_dri" = xyes; then
fi
# put all the necessary libs together
DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
GALLIUM_DRI_LIB_DEPS="$GALLIUM_DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $PTHREAD_LIBS $DLOPEN_LIBS"
GALLIUM_DRI_LIB_DEPS="$GALLIUM_DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $PTHREAD_LIBS $DLOPEN_LIBS"
fi
AM_CONDITIONAL(NEED_LIBDRICORE, test -n "$DRI_DIRS")
AC_SUBST([DRI_DIRS])
AC_SUBST([EXPAT_INCLUDES])
AC_SUBST([DRI_LIB_DEPS])
@@ -1191,12 +1187,12 @@ esac
if test "x$enable_osmesa" = xyes; then
# only link libraries with osmesa if shared
if test "$enable_static" = no; then
OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
else
OSMESA_LIB_DEPS=""
fi
OSMESA_MESA_DEPS=""
OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
OSMESA_PC_LIB_PRIV="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
fi
AC_SUBST([OSMESA_LIB_DEPS])
@@ -1242,7 +1238,7 @@ EGL_CLIENT_APIS=""
if test "x$enable_egl" = xyes; then
SRC_DIRS="$SRC_DIRS egl"
EGL_LIB_DEPS="$DLOPEN_LIBS $SELINUX_LIBS -lpthread"
EGL_LIB_DEPS="$DLOPEN_LIBS $SELINUX_LIBS $PTHREAD_LIBS"
AC_CHECK_FUNC(mincore, [DEFINES="$DEFINES -DHAVE_MINCORE"])
@@ -1365,11 +1361,11 @@ if test "x$enable_openvg" = xyes; then
fi
EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
VG_LIB_DEPS="$VG_LIB_DEPS $SELINUX_LIBS -lpthread"
VG_LIB_DEPS="$VG_LIB_DEPS $SELINUX_LIBS $PTHREAD_LIBS"
CORE_DIRS="$CORE_DIRS mapi/vgapi"
GALLIUM_STATE_TRACKERS_DIRS="vega $GALLIUM_STATE_TRACKERS_DIRS"
HAVE_ST_VEGA=yes
VG_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
VG_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
AC_SUBST([VG_PC_LIB_PRIV])
fi
@@ -1465,60 +1461,6 @@ if test "x$enable_opencl" = xyes; then
enable_gallium_loader=yes
fi
dnl
dnl GLU configuration
dnl
AC_ARG_ENABLE([glu],
[AS_HELP_STRING([--disable-glu],
[enable OpenGL Utility library @<:@default=enabled@:>@])],
[enable_glu="$enableval"],
[enable_glu=yes])
if test "x$enable_glu" = xyes; then
if test "x$enable_glx" = xno -a "x$enable_osmesa" = xno; then
AC_MSG_NOTICE([Disabling GLU since there is no OpenGL driver])
enable_glu=no
fi
fi
if test "x$enable_glu" = xyes; then
SRC_DIRS="$SRC_DIRS glu"
if test "x$enable_glx" = xno; then
# Link libGLU to libOSMesa instead of libGL
GLU_LIB_DEPS=""
GLU_PC_REQ="osmesa"
if test "$enable_static" = no; then
GLU_MESA_DEPS='-l$(OSMESA_LIB)'
else
GLU_MESA_DEPS=""
fi
else
# If static, empty GLU_LIB_DEPS and add libs for programs to link
GLU_PC_REQ="gl"
GLU_PC_LIB_PRIV="-lm"
if test "$enable_static" = no; then
GLU_LIB_DEPS="-lm"
GLU_MESA_DEPS='-l$(GL_LIB)'
else
GLU_LIB_DEPS=""
GLU_MESA_DEPS=""
fi
fi
fi
if test "$enable_static" = no; then
GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
fi
GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
AC_SUBST([GLU_LIB_DEPS])
AC_SUBST([GLU_MESA_DEPS])
AC_SUBST([GLU_PC_REQ])
AC_SUBST([GLU_PC_REQ_PRIV])
AC_SUBST([GLU_PC_LIB_PRIV])
AC_SUBST([GLU_PC_CFLAGS])
AC_SUBST([PROGRAM_DIRS])
dnl
dnl Gallium configuration
dnl
@@ -1986,10 +1928,6 @@ AM_CONDITIONAL(HAVE_X86_ASM, echo "$DEFINES" | grep 'X86_ASM' >/dev/null 2>&1)
AM_CONDITIONAL(HAVE_X86_64_ASM, echo "$DEFINES" | grep 'X86_64_ASM' >/dev/null 2>&1)
AM_CONDITIONAL(HAVE_SPARC_ASM, echo "$DEFINES" | grep 'SPARC_ASM' >/dev/null 2>&1)
# To pass as an argument to libtool's -version-number flag
VERSION_NUMBER=`echo "$VERSION" | $SED 's/\./:/g'`
AC_SUBST([VERSION_NUMBER])
dnl prepend CORE_DIRS to SRC_DIRS
SRC_DIRS="$CORE_DIRS $SRC_DIRS"
@@ -2115,9 +2053,6 @@ xyesno)
;;
esac
echo ""
echo " GLU: $enable_glu"
dnl EGL
echo ""
echo " EGL: $enable_egl"

View File

@@ -17,10 +17,6 @@
<li><a href="#dri">DRI Driver Options</a></li>
<li><a href="#osmesa">OSMesa Driver Options</a></li>
</ul>
<li><p><a href="#library">Library Options</a>
<ul>
<li><a href="#glu">GLU</a></li>
</ul>
<li><p><a href="#demos">Demo Program Options</a>
</ol>
@@ -219,12 +215,6 @@ libraries that will be built. More details on the specific GL libraries
can be found in the <a href="install.html">basic installation
instructions</a>.
<dl>
<dt id="glu">GLU <dd><p> The libGLU library will be built by default
on all drivers. This can be disable with the option
<code>--disable-glu</code>.
</dl>
<h2 id="demos">4. Demo Program Options</h2>

View File

@@ -74,7 +74,6 @@
<li><a href="http://sourceforge.net/projects/mesa3d" target="_parent">SourceForge homepage</a>
<li><a href="repository.html" target="MainFrame">Source Code Repository</a>
<li><a href="sourcetree.html" target="MainFrame">Source Code Tree</a>
<li><a href="glu.html" target="MainFrame">SGI's GLU</a>
<li><a href="utilities.html" target="MainFrame">Utilities</a>
<li><a href="helpwanted.html" target="MainFrame">Help Wanted</a>
<li><a href="devinfo.html" target="MainFrame">Development Notes</a>

View File

@@ -169,7 +169,7 @@ branch is relevant.
<dd>MESA_MAJOR, MESA_MINOR and MESA_TINY</dd>
<dt>Makefile.am</dt>
<dd>PACKAGE_VERSION</dd>
<dt>autoconf.ac</dt>
<dt>configure.ac</dt>
<dd>AC_INIT</dd>
<dt>src/mesa/main/version.h</dt>
<dd>MESA_MAJOR, MESA_MINOR, MESA_PATCH and MESA_VERSION_STRING</dd>

View File

@@ -197,7 +197,7 @@ few preprocessor defines.</p>
<ul>
<li>If <tt>GLX_USE_TLS</tt> is defined, method #4 is used.</li>
<li>If <tt>PTHREADS</tt> is defined, method #3 is used.</li>
<li>If <tt>HAVE_PTHREAD</tt> is defined, method #3 is used.</li>
<li>If <tt>WIN32_THREADS</tt> is defined, method #2 is used.</li>
<li>If none of the preceeding are defined, method #1 is used.</li>
</ul>

View File

@@ -69,7 +69,6 @@ docs/ - documentation
src/ - source code for libraries
src/mesa - sources for the main Mesa library and device drivers
src/gallium - sources for Gallium and Gallium drivers
src/glu - libGLU source code
src/glx - sources for building libGL with full GLX and DRI support
</pre>
@@ -80,7 +79,12 @@ instructions</a>.
</p>
<h1>Demos and GLUT</h1>
<h1>Demos, GLUT, and GLU</h1>
<p>
A package of SGI's GLU library is available
<a href="ftp://ftp.freedesktop.org/pub/mesa/glu/" target="_parent">here</a>
</p>
<p>
A package of Mark Kilgard's GLUT library is available
@@ -93,9 +97,13 @@ The Mesa demos collection is available
</p>
<p>
In the past, GLUT and the Mesa demos were released in conjunction with
Mesa releases. But since GLUT and the demos change infrequently, they
were split off some time ago.
In the past, GLUT, GLU and the Mesa demos were released in conjunction with
Mesa releases. But since GLUT, GLU and the demos change infrequently, they
were split off into their own git repositories:
<a href="http://cgit.freedesktop.org/mesa/glut/">GLUT</a>,
<a href="http://cgit.freedesktop.org/mesa/glu/">GLU</a> and
<a href="http://cgit.freedesktop.org/mesa/demos/">Demos</a>,
</p>

View File

@@ -226,10 +226,6 @@ Basically you'll want the following:
</li><li>/usr/lib/libGL.so.1 - a symlink to libGL.so.1.xyz
</li><li>/usr/lib/libGL.so.xyz - the actual OpenGL/Mesa library. xyz denotes the
Mesa version number.
</li><li>/usr/lib/libGLU.so - a symlink to libGLU.so.1
</li><li>/usr/lib/libGLU.so.1 - a symlink to libGLU.so.1.3.xyz
</li><li>/usr/lib/libGLU.so.xyz - the OpenGL Utility library. xyz denotes the Mesa
version number.
</li></ul>
<p>
After installing XFree86/X.org and the DRI drivers, some of these files

View File

@@ -1,46 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>SGI GLU</title>
<link rel="stylesheet" type="text/css" href="mesa.css">
</head>
<body>
<h1>SGI SI GLU</h1>
(Silicon Graphics, Inc. Sample Implementation of the OpenGL Utility library)
<p>
SGI open-sourced their OpenGL Sample Implementation (SI) in January, 2000.
This includes the GLU library.
</p>
<p>
The SI GLU library implements GLU version 1.3 whereas the original
Mesa GLU library only implemented version 1.2.
We recommend using the SI GLU library instead of Mesa's GLU library
since it's more up-to-date, complete and reliable.
We're no longer developing the original Mesa GLU library.
</p>
<p>
The SI GLU library code is included in the Mesa distribution.
You don't have to download it separately.
</p>
<p>
<b>Olivier Michel</b> has made Linux RPMs of GLU for i386 and PowerPC.
You can download them from the
<a href="http://www.sourceforge.net/project/showfiles.php?group_id=3"
target="_parent">download area</a> under <b>Miscellaneous</b>.
</p>
<p>
Visit the <a href="http://oss.sgi.com/projects/ogl-sample/" target="_parent">
OpenGL Sample Implementation home page</a> for more information about the SI.
</p>
</body>
</html>

View File

@@ -151,9 +151,6 @@ You'll see a set of library files similar to this:
lrwxrwxrwx 1 brian users 10 Mar 26 07:53 libGL.so -> libGL.so.1*
lrwxrwxrwx 1 brian users 19 Mar 26 07:53 libGL.so.1 -> libGL.so.1.5.060100*
-rwxr-xr-x 1 brian users 3375861 Mar 26 07:53 libGL.so.1.5.060100*
lrwxrwxrwx 1 brian users 11 Mar 26 07:53 libGLU.so -> libGLU.so.1*
lrwxrwxrwx 1 brian users 20 Mar 26 07:53 libGLU.so.1 -> libGLU.so.1.3.060100*
-rwxr-xr-x 1 brian users 549269 Mar 26 07:53 libGLU.so.1.3.060100*
lrwxrwxrwx 1 brian users 14 Mar 26 07:53 libOSMesa.so -> libOSMesa.so.6*
lrwxrwxrwx 1 brian users 23 Mar 26 07:53 libOSMesa.so.6 -> libOSMesa.so.6.1.060100*
-rwxr-xr-x 1 brian users 23871 Mar 26 07:53 libOSMesa.so.6.1.060100*
@@ -162,8 +159,6 @@ lrwxrwxrwx 1 brian users 23 Mar 26 07:53 libOSMesa.so.6 -> libOSM
<p>
<b>libGL</b> is the main OpenGL library (i.e. Mesa).
<br>
<b>libGLU</b> is the OpenGL Utility library.
<br>
<b>libOSMesa</b> is the OSMesa (Off-Screen) interface library.
</p>

View File

@@ -95,8 +95,6 @@ Device drivers src/mesa/drivers/* MIT, generally
Ext headers include/GL/glext.h Khronos
include/GL/glxext.h
SGI GLU library src/glu/sgi/ SGI Free B
</pre>
<p>

View File

@@ -7,7 +7,7 @@
</head>
<body>
<h1>Mesa 9.0 Release Notes / date TBD</h1>
<h1>Mesa 9.0 Release Notes / October 8th, 2012</h1>
<p>
Mesa 9.0 is a new development release.
@@ -37,10 +37,14 @@ Note: some of the new features are only available with certain drivers.
</p>
<ul>
<li>Added new Gallium3D - nv30 driver</li>
<li>Added new Gallium3D - radeonsi driver</li>
<li>Added OpenCL state tracker Clover</li>
<li>Completed VDPAU state tracker (video decoding support is currently limited to MPEG1 and MPEG2)</li>
<li>GL_ARB_base_instance</li>
<li>GL_ARB_blend_func_extended</li>
<li>GL_ARB_debug_output</li>
<li>GL_ARB_invalidate_subdate - Currently a "no-op" implementation. This
<li>GL_ARB_invalidate_subdata - Currently a "no-op" implementation. This
extension is always enabled in all drivers.</li>
<li>GL_ARB_shader_bit_encoding</li>
<li>GL_ARB_texture_buffer_object</li>
@@ -52,6 +56,7 @@ extension is always enabled in all drivers.</li>
<li>GL_EXT_read_format_bgra for ES 1.1 and 2.0</li>
<li>GL_EXT_texture_rg for ES 2.x</li>
<li>GL_NV_read_buffer for ES 2.0</li>
<li>GLX_ARB_create_context_robustness</li>
<li>EGL_KHR_create_context</li>
<li>EGL_KHR_surfaceless_context - This replaces the
EGL_KHR_surfaceless_{gles1,gles2,opengl} extensions that were never approved
@@ -67,10 +72,18 @@ by Khronos.</li>
<h2>Changes</h2>
<p>
<ul>
<li>
The legacy/static Makefile system (ex: 'make linux-dri') has been removed.
<br>
The two supported build methods are now autoconf/automake and SCons.
</p>
</li>
<li>Removed support for GL_ARB_shadow_ambient extension</li>
<li>Removed Gallium3D - nvfx driver (use nv30 instead)</li>
<li>
libGLU has been moved into its own repository, found at <a href="http://cgit.freedesktop.org/mesa/glu/">http://cgit.freedesktop.org/mesa/glu/</a>
</li>
</ul>
</body>

View File

@@ -14,12 +14,14 @@ The release notes summarize what's new or changed in each Mesa release.
</p>
<ul>
<li><a href="relnotes-8.1.html">8.1 release notes</a>
<li><a href="relnotes-9.0.html">9.0 release notes</a>
<li><a href="relnotes-8.0.4.html">8.0.4 release notes</a>
<li><a href="relnotes-8.0.3.html">8.0.3 release notes</a>
<li><a href="relnotes-8.0.2.html">8.0.2 release notes</a>
<li><a href="relnotes-8.0.1.html">8.0.1 release notes</a>
<li><a href="relnotes-8.0.html">8.0 release notes</a>
<li><a href="relnotes-7.11.2.html">7.11.2 release notes</a>
<li><a href="relnotes-7.11.1.html">7.11.1 release notes</a>
<li><a href="relnotes-7.11.html">7.11 release notes</a>
<li><a href="relnotes-7.10.3.html">7.10.3 release notes</a>
<li><a href="relnotes-7.10.2.html">7.10.2 release notes</a>

View File

@@ -146,11 +146,6 @@ each directory.
</ul>
</ul>
<ul>
<li><b>glu</b> - The OpenGL Utility library
<ul>
<li><b>sgi</b> - GLU from SGI
<li><b>mesa</b> - Mesa version of GLU (deprecated)
</ul>
<li><b>glx</b> - The GLX library code for building libGL. This is used for
direct rendering drivers. It will dynamically load one of the
xxx_dri.so drivers.

View File

@@ -29,9 +29,9 @@ extern "C" {
*/
/* Header file version number, required by OpenGL ABI for Linux */
/* glext.h last updated $Date: 2012-08-06 02:01:01 -0700 (Mon, 06 Aug 2012) $ */
/* glext.h last updated $Date: 2012-09-19 19:02:24 -0700 (Wed, 19 Sep 2012) $ */
/* Current version at http://www.opengl.org/registry/ */
#define GL_GLEXT_VERSION 83
#define GL_GLEXT_VERSION 85
/* Function declaration macros - to move into glplatform.h */
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
@@ -88,9 +88,6 @@ extern "C" {
#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
#endif
#ifndef GL_VERSION_1_2_DEPRECATED
#define GL_RESCALE_NORMAL 0x803A
#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
#define GL_SINGLE_COLOR 0x81F9
@@ -110,9 +107,6 @@ extern "C" {
#define GL_BLEND_EQUATION 0x8009
#define GL_FUNC_SUBTRACT 0x800A
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
#endif
#ifndef GL_ARB_imaging_DEPRECATED
#define GL_CONVOLUTION_1D 0x8010
#define GL_CONVOLUTION_2D 0x8011
#define GL_SEPARABLE_2D 0x8012
@@ -239,9 +233,6 @@ extern "C" {
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
#define GL_CLAMP_TO_BORDER 0x812D
#endif
#ifndef GL_VERSION_1_3_DEPRECATED
#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
#define GL_MAX_TEXTURE_UNITS 0x84E2
#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
@@ -298,9 +289,6 @@ extern "C" {
#define GL_TEXTURE_DEPTH_SIZE 0x884A
#define GL_TEXTURE_COMPARE_MODE 0x884C
#define GL_TEXTURE_COMPARE_FUNC 0x884D
#endif
#ifndef GL_VERSION_1_4_DEPRECATED
#define GL_POINT_SIZE_MIN 0x8126
#define GL_POINT_SIZE_MAX 0x8127
#define GL_POINT_DISTANCE_ATTENUATION 0x8129
@@ -354,9 +342,7 @@ extern "C" {
#define GL_DYNAMIC_READ 0x88E9
#define GL_DYNAMIC_COPY 0x88EA
#define GL_SAMPLES_PASSED 0x8914
#endif
#ifndef GL_VERSION_1_5_DEPRECATED
#define GL_SRC1_ALPHA 0x8589
#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
@@ -378,7 +364,6 @@ extern "C" {
#define GL_SRC1_RGB 0x8581
#define GL_SRC2_RGB 0x8582
#define GL_SRC0_ALPHA 0x8588
#define GL_SRC1_ALPHA 0x8589
#define GL_SRC2_ALPHA 0x858A
#endif
@@ -463,9 +448,6 @@ extern "C" {
#define GL_STENCIL_BACK_REF 0x8CA3
#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
#endif
#ifndef GL_VERSION_2_0_DEPRECATED
#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643
#define GL_POINT_SPRITE 0x8861
#define GL_COORD_REPLACE 0x8862
@@ -489,9 +471,6 @@ extern "C" {
#define GL_SRGB8_ALPHA8 0x8C43
#define GL_COMPRESSED_SRGB 0x8C48
#define GL_COMPRESSED_SRGB_ALPHA 0x8C49
#endif
#ifndef GL_VERSION_2_1_DEPRECATED
#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F
#define GL_SLUMINANCE_ALPHA 0x8C44
#define GL_SLUMINANCE8_ALPHA8 0x8C45
@@ -726,9 +705,6 @@ extern "C" {
/* reuse GL_RG32UI */
/* Reuse tokens from ARB_vertex_array_object */
/* reuse GL_VERTEX_ARRAY_BINDING */
#endif
#ifndef GL_VERSION_3_0_DEPRECATED
#define GL_CLAMP_VERTEX_COLOR 0x891A
#define GL_CLAMP_FRAGMENT_COLOR 0x891B
#define GL_ALPHA_INTEGER 0x8D97
@@ -749,7 +725,6 @@ extern "C" {
#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B
#define GL_TEXTURE_BINDING_BUFFER 0x8C2C
#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D
#define GL_TEXTURE_BUFFER_FORMAT 0x8C2E
#define GL_TEXTURE_RECTANGLE 0x84F5
#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6
#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7
@@ -1015,6 +990,7 @@ extern "C" {
/* reuse GL_MEDIUM_INT */
/* reuse GL_HIGH_INT */
/* reuse GL_SHADER_COMPILER */
/* reuse GL_SHADER_BINARY_FORMATS */
/* reuse GL_NUM_SHADER_BINARY_FORMATS */
/* reuse GL_MAX_VERTEX_UNIFORM_VECTORS */
/* reuse GL_MAX_VARYING_VECTORS */
@@ -2030,9 +2006,6 @@ extern "C" {
#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
#define GL_MAX_SAMPLES 0x8D57
#endif
#ifndef GL_ARB_framebuffer_object_DEPRECATED
#define GL_INDEX 0x8222
#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14
#define GL_TEXTURE_INTENSITY_TYPE 0x8C15
@@ -2264,6 +2237,7 @@ extern "C" {
#ifndef GL_ARB_texture_gather
#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E
#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F
#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F
#endif
#ifndef GL_ARB_texture_query_lod
@@ -2441,6 +2415,7 @@ extern "C" {
#define GL_MEDIUM_INT 0x8DF4
#define GL_HIGH_INT 0x8DF5
#define GL_SHADER_COMPILER 0x8DFA
#define GL_SHADER_BINARY_FORMATS 0x8DF8
#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
#define GL_MAX_VARYING_VECTORS 0x8DFC
@@ -2744,6 +2719,7 @@ extern "C" {
#define GL_PROGRAM_PIPELINE 0x82E4
#define GL_SAMPLER 0x82E6
#define GL_DISPLAY_LIST 0x82E7
/* DISPLAY_LIST used in compatibility profile only */
#define GL_MAX_LABEL_LENGTH 0x82E8
#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143
#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144
@@ -2787,33 +2763,25 @@ extern "C" {
#ifndef GL_ARB_copy_image
#endif
#ifndef GL_ARB_debug_group
/* reuse GL_DEBUG_TYPE_MARKER */
/* reuse GL_DEBUG_TYPE_PUSH_GROUP */
/* reuse GL_DEBUG_TYPE_POP_GROUP */
/* reuse GL_DEBUG_SEVERITY_NOTIFICATION */
/* reuse GL_MAX_DEBUG_GROUP_STACK_DEPTH */
/* reuse GL_DEBUG_GROUP_STACK_DEPTH */
/* reuse GL_STACK_UNDERFLOW */
/* reuse GL_STACK_OVERFLOW */
#ifndef GL_ARB_texture_view
#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB
#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC
#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD
#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE
#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
#endif
#ifndef GL_ARB_debug_label
/* reuse GL_BUFFER */
/* reuse GL_SHADER */
/* reuse GL_PROGRAM */
/* reuse GL_QUERY */
/* reuse GL_PROGRAM_PIPELINE */
/* reuse GL_SAMPLER */
/* DISPLAY_LIST used in compatibility profile only */
/* reuse GL_DISPLAY_LIST */
/* reuse GL_MAX_LABEL_LENGTH */
/* reuse GL_VERTEX_ARRAY */
#ifndef GL_ARB_vertex_attrib_binding
#define GL_VERTEX_ATTRIB_BINDING 0x82D4
#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5
#define GL_VERTEX_BINDING_DIVISOR 0x82D6
#define GL_VERTEX_BINDING_OFFSET 0x82D7
#define GL_VERTEX_BINDING_STRIDE 0x82D8
#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9
#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA
#endif
#ifndef GL_ARB_debug_output2
/* reuse GL_CONTEXT_FLAG_DEBUG_BIT */
/* reuse GL_DEBUG_OUTPUT */
#ifndef GL_ARB_robustness_isolation
#endif
#ifndef GL_ARB_ES3_compatibility
@@ -3050,7 +3018,7 @@ extern "C" {
#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE
#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF
#define GL_SHADER_STORAGE_BARRIER_BIT 0x2000
#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS
#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS
/* reuse GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS */
#endif
@@ -3070,27 +3038,6 @@ extern "C" {
#ifndef GL_ARB_texture_storage_multisample
#endif
#ifndef GL_ARB_texture_view
#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB
#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC
#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD
#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE
#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
#endif
#ifndef GL_ARB_vertex_attrib_binding
#define GL_VERTEX_ATTRIB_BINDING 0x82D4
#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5
#define GL_VERTEX_BINDING_DIVISOR 0x82D6
#define GL_VERTEX_BINDING_OFFSET 0x82D7
#define GL_VERTEX_BINDING_STRIDE 0x82D8
#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9
#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA
#endif
#ifndef GL_ARB_robustness_isolation
#endif
#ifndef GL_EXT_abgr
#define GL_ABGR_EXT 0x8000
#endif
@@ -4947,6 +4894,8 @@ extern "C" {
#define GL_RGB4_S3TC 0x83A1
#define GL_RGBA_S3TC 0x83A2
#define GL_RGBA4_S3TC 0x83A3
#define GL_RGBA_DXT5_S3TC 0x83A4
#define GL_RGBA4_DXT5_S3TC 0x83A5
#endif
#ifndef GL_ATI_draw_buffers
@@ -4970,7 +4919,7 @@ extern "C" {
#endif
#ifndef GL_ATI_pixel_format_float
#define GL_TYPE_RGBA_FLOAT_ATI 0x8820
#define GL_RGBA_FLOAT_MODE_ATI 0x8820
#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835
#endif
@@ -5430,7 +5379,7 @@ extern "C" {
#define GL_PRIMITIVES_GENERATED_NV 0x8C87
#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88
#define GL_RASTERIZER_DISCARD_NV 0x8C89
#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_ATTRIBS_NV 0x8C8A
#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV 0x8C8A
#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B
#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C
#define GL_SEPARATE_ATTRIBS_NV 0x8C8D
@@ -5947,6 +5896,7 @@ extern "C" {
#endif
#ifndef GL_AMD_debug_output
#define GL_MAX_DEBUG_MESSAGE_LENGTH_AMD 0x9143
#define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144
#define GL_DEBUG_LOGGED_MESSAGES_AMD 0x9145
#define GL_DEBUG_SEVERITY_HIGH_AMD 0x9146
@@ -6176,6 +6126,18 @@ extern "C" {
#define GL_QUERY_RESULT_NO_WAIT_AMD 0x9194
#endif
#ifndef GL_AMD_sparse_texture
#define GL_VIRTUAL_PAGE_SIZE_X_AMD 0x9195
#define GL_VIRTUAL_PAGE_SIZE_Y_AMD 0x9196
#define GL_VIRTUAL_PAGE_SIZE_Z_AMD 0x9197
#define GL_MAX_SPARSE_TEXTURE_SIZE_AMD 0x9198
#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_AMD 0x9199
#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS 0x919A
#define GL_MIN_SPARSE_LEVEL_AMD 0x919B
#define GL_MIN_LOD_WARNING_AMD 0x919C
#define GL_TEXTURE_STORAGE_SPARSE_BIT_AMD 0x00000001
#endif
/*************************************************************/
@@ -6292,18 +6254,6 @@ GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end,
GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
#endif
#ifndef GL_VERSION_1_2_DEPRECATED
#define GL_VERSION_1_2_DEPRECATED 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glColorTable (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
GLAPI void APIENTRY glColorTableParameterfv (GLenum target, GLenum pname, const GLfloat *params);
GLAPI void APIENTRY glColorTableParameteriv (GLenum target, GLenum pname, const GLint *params);
@@ -6337,6 +6287,12 @@ GLAPI void APIENTRY glMinmax (GLenum target, GLenum internalformat, GLboolean si
GLAPI void APIENTRY glResetHistogram (GLenum target);
GLAPI void APIENTRY glResetMinmax (GLenum target);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
@@ -6383,21 +6339,6 @@ GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint
GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, GLvoid *img);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img);
#endif
#ifndef GL_VERSION_1_3_DEPRECATED
#define GL_VERSION_1_3_DEPRECATED 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glClientActiveTexture (GLenum texture);
GLAPI void APIENTRY glMultiTexCoord1d (GLenum target, GLdouble s);
GLAPI void APIENTRY glMultiTexCoord1dv (GLenum target, const GLdouble *v);
@@ -6436,6 +6377,15 @@ GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *m);
GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *m);
GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *m);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img);
typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);
typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s);
typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v);
@@ -6485,19 +6435,6 @@ GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param);
GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params);
GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param);
GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);
typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);
typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);
typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);
#endif
#ifndef GL_VERSION_1_4_DEPRECATED
#define GL_VERSION_1_4_DEPRECATED 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glFogCoordf (GLfloat coord);
GLAPI void APIENTRY glFogCoordfv (const GLfloat *coord);
GLAPI void APIENTRY glFogCoordd (GLdouble coord);
@@ -6537,6 +6474,13 @@ GLAPI void APIENTRY glWindowPos3iv (const GLint *v);
GLAPI void APIENTRY glWindowPos3s (GLshort x, GLshort y, GLshort z);
GLAPI void APIENTRY glWindowPos3sv (const GLshort *v);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);
typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);
typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);
typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);
typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord);
typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord);
typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord);
@@ -7074,10 +7018,7 @@ typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB,
/* ARB_clear_buffer_object */
/* ARB_compute_shader */
/* ARB_copy_image */
/* ARB_debug_group */
/* ARB_debug_label */
/* KHR_debug (ARB_debug_output promoted to KHR without suffixes) */
/* ARB_debug_output2 (no entry points) */
/* KHR_debug (includes ARB_debug_output commands promoted to KHR without suffixes) */
/* ARB_explicit_uniform_location (no entry points) */
/* ARB_framebuffer_no_attachments */
/* ARB_internalformat_query2 */
@@ -8621,7 +8562,6 @@ typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum ta
#ifndef GL_KHR_debug
#define GL_KHR_debug 1
/* KHR_debug also reuses entry points from ARB_debug_group and ARB_debug_label */
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
GLAPI void APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
@@ -8682,18 +8622,46 @@ GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint
typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
#endif
#ifndef GL_ARB_debug_group
#define GL_ARB_debug_group 1
/* ARB_debug_group reuses entry points from KHR_debug */
#ifndef GL_ARB_texture_view
#define GL_ARB_texture_view 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
#endif
#ifndef GL_ARB_debug_label
#define GL_ARB_debug_label 1
/* ARB_debug_label reuses entry points from KHR_debug */
#ifndef GL_ARB_vertex_attrib_binding
#define GL_ARB_vertex_attrib_binding 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
GLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
GLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
GLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
GLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex);
GLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor);
GLAPI void APIENTRY glVertexArrayBindVertexBufferEXT (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
GLAPI void APIENTRY glVertexArrayVertexAttribFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
GLAPI void APIENTRY glVertexArrayVertexAttribIFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
GLAPI void APIENTRY glVertexArrayVertexAttribLFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
GLAPI void APIENTRY glVertexArrayVertexAttribBindingEXT (GLuint vaobj, GLuint attribindex, GLuint bindingindex);
GLAPI void APIENTRY glVertexArrayVertexBindingDivisorEXT (GLuint vaobj, GLuint bindingindex, GLuint divisor);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex);
typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor);
typedef void (APIENTRYP PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex);
typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor);
#endif
#ifndef GL_ARB_debug_output2
#define GL_ARB_debug_output2 1
#ifndef GL_ARB_robustness_isolation
#define GL_ARB_robustness_isolation 1
#endif
#ifndef GL_ARB_ES3_compatibility
@@ -8824,48 +8792,6 @@ typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC) (GLuint texture
typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
#endif
#ifndef GL_ARB_texture_view
#define GL_ARB_texture_view 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
#endif
#ifndef GL_ARB_vertex_attrib_binding
#define GL_ARB_vertex_attrib_binding 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
GLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
GLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
GLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
GLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex);
GLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor);
GLAPI void APIENTRY glVertexArrayBindVertexBufferEXT (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
GLAPI void APIENTRY glVertexArrayVertexAttribFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
GLAPI void APIENTRY glVertexArrayVertexAttribIFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
GLAPI void APIENTRY glVertexArrayVertexAttribLFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
GLAPI void APIENTRY glVertexArrayVertexAttribBindingEXT (GLuint vaobj, GLuint attribindex, GLuint bindingindex);
GLAPI void APIENTRY glVertexArrayVertexBindingDivisorEXT (GLuint vaobj, GLuint bindingindex, GLuint divisor);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex);
typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor);
typedef void (APIENTRYP PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex);
typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor);
#endif
#ifndef GL_ARB_robustness_isolation
#define GL_ARB_robustness_isolation 1
#endif
#ifndef GL_EXT_abgr
#define GL_EXT_abgr 1
#endif
@@ -9607,11 +9533,15 @@ GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum target, GLenum pname,
GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum target, GLenum pname, GLfloat param);
GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum target, GLenum pname, const GLint *params);
GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params);
GLAPI void APIENTRY glGetPixelTransformParameterivEXT (GLenum target, GLenum pname, GLint *params);
GLAPI void APIENTRY glGetPixelTransformParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param);
typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param);
typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params);
typedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
typedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
#endif
#ifndef GL_EXT_pixel_transform_color_table
@@ -9963,11 +9893,11 @@ typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLen
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glVertexWeightfEXT (GLfloat weight);
GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *weight);
GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer);
GLAPI void APIENTRY glVertexWeightPointerEXT (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight);
typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight);
typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer);
typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
#endif
#ifndef GL_NV_light_max_exponent
@@ -12543,7 +12473,7 @@ typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glVDPAUInitNV (const GLvoid *vdpDevice, const GLvoid *getProcAddress);
GLAPI void APIENTRY glVDPAUFiniNV (void);
GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (const GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterOutputSurfaceNV (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
GLAPI void APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface);
GLAPI void APIENTRY glVDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface);
@@ -12554,7 +12484,7 @@ GLAPI void APIENTRY glVDPAUUnmapSurfacesNV (GLsizei numSurface, const GLvdpauSur
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLVDPAUINITNVPROC) (const GLvoid *vdpDevice, const GLvoid *getProcAddress);
typedef void (APIENTRYP PFNGLVDPAUFININVPROC) (void);
typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (const GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
typedef void (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface);
typedef void (APIENTRYP PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface);
@@ -12792,6 +12722,16 @@ typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle)
#define GL_AMD_query_buffer_object 1
#endif
#ifndef GL_AMD_sparse_texture
#define GL_AMD_sparse_texture 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glTexStorageSparseAMD (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
GLAPI void APIENTRY glTextureStorageSparseAMD (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLTEXSTORAGESPARSEAMDPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
typedef void (APIENTRYP PFNGLTEXTURESTORAGESPARSEAMDPROC) (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
#endif
#ifdef __cplusplus
}

View File

@@ -1,353 +0,0 @@
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and
* either this permission notice or a reference to
* http://oss.sgi.com/projects/FreeB/
* 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
* SILICON GRAPHICS, INC. 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.
*
* Except as contained in this notice, the name of Silicon Graphics, Inc.
* shall not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization from
* Silicon Graphics, Inc.
*/
#ifndef __glu_h__
#define __glu_h__
#if defined(USE_MGL_NAMESPACE)
#include "glu_mangle.h"
#endif
#include <GL/gl.h>
#ifndef GLAPIENTRY
#if defined(_MSC_VER) || defined(__MINGW32__)
#define GLAPIENTRY __stdcall
#else
#define GLAPIENTRY
#endif
#endif
#ifndef GLAPIENTRYP
#define GLAPIENTRYP GLAPIENTRY *
#endif
#if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GLU32)
# undef GLAPI
# define GLAPI __declspec(dllexport)
#elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL)
/* tag specifying we're building for DLL runtime support */
# undef GLAPI
# define GLAPI __declspec(dllimport)
#elif !defined(GLAPI)
/* for use with static link lib build of Win32 edition only */
# define GLAPI extern
#endif /* _STATIC_MESA support */
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************/
/* Extensions */
#define GLU_EXT_object_space_tess 1
#define GLU_EXT_nurbs_tessellator 1
/* Boolean */
#define GLU_FALSE 0
#define GLU_TRUE 1
/* Version */
#define GLU_VERSION_1_1 1
#define GLU_VERSION_1_2 1
#define GLU_VERSION_1_3 1
/* StringName */
#define GLU_VERSION 100800
#define GLU_EXTENSIONS 100801
/* ErrorCode */
#define GLU_INVALID_ENUM 100900
#define GLU_INVALID_VALUE 100901
#define GLU_OUT_OF_MEMORY 100902
#define GLU_INCOMPATIBLE_GL_VERSION 100903
#define GLU_INVALID_OPERATION 100904
/* NurbsDisplay */
/* GLU_FILL */
#define GLU_OUTLINE_POLYGON 100240
#define GLU_OUTLINE_PATCH 100241
/* NurbsCallback */
#define GLU_NURBS_ERROR 100103
#define GLU_ERROR 100103
#define GLU_NURBS_BEGIN 100164
#define GLU_NURBS_BEGIN_EXT 100164
#define GLU_NURBS_VERTEX 100165
#define GLU_NURBS_VERTEX_EXT 100165
#define GLU_NURBS_NORMAL 100166
#define GLU_NURBS_NORMAL_EXT 100166
#define GLU_NURBS_COLOR 100167
#define GLU_NURBS_COLOR_EXT 100167
#define GLU_NURBS_TEXTURE_COORD 100168
#define GLU_NURBS_TEX_COORD_EXT 100168
#define GLU_NURBS_END 100169
#define GLU_NURBS_END_EXT 100169
#define GLU_NURBS_BEGIN_DATA 100170
#define GLU_NURBS_BEGIN_DATA_EXT 100170
#define GLU_NURBS_VERTEX_DATA 100171
#define GLU_NURBS_VERTEX_DATA_EXT 100171
#define GLU_NURBS_NORMAL_DATA 100172
#define GLU_NURBS_NORMAL_DATA_EXT 100172
#define GLU_NURBS_COLOR_DATA 100173
#define GLU_NURBS_COLOR_DATA_EXT 100173
#define GLU_NURBS_TEXTURE_COORD_DATA 100174
#define GLU_NURBS_TEX_COORD_DATA_EXT 100174
#define GLU_NURBS_END_DATA 100175
#define GLU_NURBS_END_DATA_EXT 100175
/* NurbsError */
#define GLU_NURBS_ERROR1 100251
#define GLU_NURBS_ERROR2 100252
#define GLU_NURBS_ERROR3 100253
#define GLU_NURBS_ERROR4 100254
#define GLU_NURBS_ERROR5 100255
#define GLU_NURBS_ERROR6 100256
#define GLU_NURBS_ERROR7 100257
#define GLU_NURBS_ERROR8 100258
#define GLU_NURBS_ERROR9 100259
#define GLU_NURBS_ERROR10 100260
#define GLU_NURBS_ERROR11 100261
#define GLU_NURBS_ERROR12 100262
#define GLU_NURBS_ERROR13 100263
#define GLU_NURBS_ERROR14 100264
#define GLU_NURBS_ERROR15 100265
#define GLU_NURBS_ERROR16 100266
#define GLU_NURBS_ERROR17 100267
#define GLU_NURBS_ERROR18 100268
#define GLU_NURBS_ERROR19 100269
#define GLU_NURBS_ERROR20 100270
#define GLU_NURBS_ERROR21 100271
#define GLU_NURBS_ERROR22 100272
#define GLU_NURBS_ERROR23 100273
#define GLU_NURBS_ERROR24 100274
#define GLU_NURBS_ERROR25 100275
#define GLU_NURBS_ERROR26 100276
#define GLU_NURBS_ERROR27 100277
#define GLU_NURBS_ERROR28 100278
#define GLU_NURBS_ERROR29 100279
#define GLU_NURBS_ERROR30 100280
#define GLU_NURBS_ERROR31 100281
#define GLU_NURBS_ERROR32 100282
#define GLU_NURBS_ERROR33 100283
#define GLU_NURBS_ERROR34 100284
#define GLU_NURBS_ERROR35 100285
#define GLU_NURBS_ERROR36 100286
#define GLU_NURBS_ERROR37 100287
/* NurbsProperty */
#define GLU_AUTO_LOAD_MATRIX 100200
#define GLU_CULLING 100201
#define GLU_SAMPLING_TOLERANCE 100203
#define GLU_DISPLAY_MODE 100204
#define GLU_PARAMETRIC_TOLERANCE 100202
#define GLU_SAMPLING_METHOD 100205
#define GLU_U_STEP 100206
#define GLU_V_STEP 100207
#define GLU_NURBS_MODE 100160
#define GLU_NURBS_MODE_EXT 100160
#define GLU_NURBS_TESSELLATOR 100161
#define GLU_NURBS_TESSELLATOR_EXT 100161
#define GLU_NURBS_RENDERER 100162
#define GLU_NURBS_RENDERER_EXT 100162
/* NurbsSampling */
#define GLU_OBJECT_PARAMETRIC_ERROR 100208
#define GLU_OBJECT_PARAMETRIC_ERROR_EXT 100208
#define GLU_OBJECT_PATH_LENGTH 100209
#define GLU_OBJECT_PATH_LENGTH_EXT 100209
#define GLU_PATH_LENGTH 100215
#define GLU_PARAMETRIC_ERROR 100216
#define GLU_DOMAIN_DISTANCE 100217
/* NurbsTrim */
#define GLU_MAP1_TRIM_2 100210
#define GLU_MAP1_TRIM_3 100211
/* QuadricDrawStyle */
#define GLU_POINT 100010
#define GLU_LINE 100011
#define GLU_FILL 100012
#define GLU_SILHOUETTE 100013
/* QuadricCallback */
/* GLU_ERROR */
/* QuadricNormal */
#define GLU_SMOOTH 100000
#define GLU_FLAT 100001
#define GLU_NONE 100002
/* QuadricOrientation */
#define GLU_OUTSIDE 100020
#define GLU_INSIDE 100021
/* TessCallback */
#define GLU_TESS_BEGIN 100100
#define GLU_BEGIN 100100
#define GLU_TESS_VERTEX 100101
#define GLU_VERTEX 100101
#define GLU_TESS_END 100102
#define GLU_END 100102
#define GLU_TESS_ERROR 100103
#define GLU_TESS_EDGE_FLAG 100104
#define GLU_EDGE_FLAG 100104
#define GLU_TESS_COMBINE 100105
#define GLU_TESS_BEGIN_DATA 100106
#define GLU_TESS_VERTEX_DATA 100107
#define GLU_TESS_END_DATA 100108
#define GLU_TESS_ERROR_DATA 100109
#define GLU_TESS_EDGE_FLAG_DATA 100110
#define GLU_TESS_COMBINE_DATA 100111
/* TessContour */
#define GLU_CW 100120
#define GLU_CCW 100121
#define GLU_INTERIOR 100122
#define GLU_EXTERIOR 100123
#define GLU_UNKNOWN 100124
/* TessProperty */
#define GLU_TESS_WINDING_RULE 100140
#define GLU_TESS_BOUNDARY_ONLY 100141
#define GLU_TESS_TOLERANCE 100142
/* TessError */
#define GLU_TESS_ERROR1 100151
#define GLU_TESS_ERROR2 100152
#define GLU_TESS_ERROR3 100153
#define GLU_TESS_ERROR4 100154
#define GLU_TESS_ERROR5 100155
#define GLU_TESS_ERROR6 100156
#define GLU_TESS_ERROR7 100157
#define GLU_TESS_ERROR8 100158
#define GLU_TESS_MISSING_BEGIN_POLYGON 100151
#define GLU_TESS_MISSING_BEGIN_CONTOUR 100152
#define GLU_TESS_MISSING_END_POLYGON 100153
#define GLU_TESS_MISSING_END_CONTOUR 100154
#define GLU_TESS_COORD_TOO_LARGE 100155
#define GLU_TESS_NEED_COMBINE_CALLBACK 100156
/* TessWinding */
#define GLU_TESS_WINDING_ODD 100130
#define GLU_TESS_WINDING_NONZERO 100131
#define GLU_TESS_WINDING_POSITIVE 100132
#define GLU_TESS_WINDING_NEGATIVE 100133
#define GLU_TESS_WINDING_ABS_GEQ_TWO 100134
/*************************************************************/
#ifdef __cplusplus
class GLUnurbs;
class GLUquadric;
class GLUtesselator;
#else
typedef struct GLUnurbs GLUnurbs;
typedef struct GLUquadric GLUquadric;
typedef struct GLUtesselator GLUtesselator;
#endif
typedef GLUnurbs GLUnurbsObj;
typedef GLUquadric GLUquadricObj;
typedef GLUtesselator GLUtesselatorObj;
typedef GLUtesselator GLUtriangulatorObj;
#define GLU_TESS_MAX_COORD 1.0e150
/* Internal convenience typedefs */
typedef void (GLAPIENTRYP _GLUfuncptr)(void);
GLAPI void GLAPIENTRY gluBeginCurve (GLUnurbs* nurb);
GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess);
GLAPI void GLAPIENTRY gluBeginSurface (GLUnurbs* nurb);
GLAPI void GLAPIENTRY gluBeginTrim (GLUnurbs* nurb);
GLAPI GLint GLAPIENTRY gluBuild1DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
GLAPI GLint GLAPIENTRY gluBuild1DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void *data);
GLAPI GLint GLAPIENTRY gluBuild2DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
GLAPI GLint GLAPIENTRY gluBuild2DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data);
GLAPI GLint GLAPIENTRY gluBuild3DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
GLAPI GLint GLAPIENTRY gluBuild3DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
GLAPI GLboolean GLAPIENTRY gluCheckExtension (const GLubyte *extName, const GLubyte *extString);
GLAPI void GLAPIENTRY gluCylinder (GLUquadric* quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks);
GLAPI void GLAPIENTRY gluDeleteNurbsRenderer (GLUnurbs* nurb);
GLAPI void GLAPIENTRY gluDeleteQuadric (GLUquadric* quad);
GLAPI void GLAPIENTRY gluDeleteTess (GLUtesselator* tess);
GLAPI void GLAPIENTRY gluDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops);
GLAPI void GLAPIENTRY gluEndCurve (GLUnurbs* nurb);
GLAPI void GLAPIENTRY gluEndPolygon (GLUtesselator* tess);
GLAPI void GLAPIENTRY gluEndSurface (GLUnurbs* nurb);
GLAPI void GLAPIENTRY gluEndTrim (GLUnurbs* nurb);
GLAPI const GLubyte * GLAPIENTRY gluErrorString (GLenum error);
GLAPI void GLAPIENTRY gluGetNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat* data);
GLAPI const GLubyte * GLAPIENTRY gluGetString (GLenum name);
GLAPI void GLAPIENTRY gluGetTessProperty (GLUtesselator* tess, GLenum which, GLdouble* data);
GLAPI void GLAPIENTRY gluLoadSamplingMatrices (GLUnurbs* nurb, const GLfloat *model, const GLfloat *perspective, const GLint *view);
GLAPI void GLAPIENTRY gluLookAt (GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ, GLdouble upX, GLdouble upY, GLdouble upZ);
GLAPI GLUnurbs* GLAPIENTRY gluNewNurbsRenderer (void);
GLAPI GLUquadric* GLAPIENTRY gluNewQuadric (void);
GLAPI GLUtesselator* GLAPIENTRY gluNewTess (void);
GLAPI void GLAPIENTRY gluNextContour (GLUtesselator* tess, GLenum type);
GLAPI void GLAPIENTRY gluNurbsCallback (GLUnurbs* nurb, GLenum which, _GLUfuncptr CallBackFunc);
GLAPI void GLAPIENTRY gluNurbsCallbackData (GLUnurbs* nurb, GLvoid* userData);
GLAPI void GLAPIENTRY gluNurbsCallbackDataEXT (GLUnurbs* nurb, GLvoid* userData);
GLAPI void GLAPIENTRY gluNurbsCurve (GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order, GLenum type);
GLAPI void GLAPIENTRY gluNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat value);
GLAPI void GLAPIENTRY gluNurbsSurface (GLUnurbs* nurb, GLint sKnotCount, GLfloat* sKnots, GLint tKnotCount, GLfloat* tKnots, GLint sStride, GLint tStride, GLfloat* control, GLint sOrder, GLint tOrder, GLenum type);
GLAPI void GLAPIENTRY gluOrtho2D (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top);
GLAPI void GLAPIENTRY gluPartialDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep);
GLAPI void GLAPIENTRY gluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
GLAPI void GLAPIENTRY gluPickMatrix (GLdouble x, GLdouble y, GLdouble delX, GLdouble delY, GLint *viewport);
GLAPI GLint GLAPIENTRY gluProject (GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ);
GLAPI void GLAPIENTRY gluPwlCurve (GLUnurbs* nurb, GLint count, GLfloat* data, GLint stride, GLenum type);
GLAPI void GLAPIENTRY gluQuadricCallback (GLUquadric* quad, GLenum which, _GLUfuncptr CallBackFunc);
GLAPI void GLAPIENTRY gluQuadricDrawStyle (GLUquadric* quad, GLenum draw);
GLAPI void GLAPIENTRY gluQuadricNormals (GLUquadric* quad, GLenum normal);
GLAPI void GLAPIENTRY gluQuadricOrientation (GLUquadric* quad, GLenum orientation);
GLAPI void GLAPIENTRY gluQuadricTexture (GLUquadric* quad, GLboolean texture);
GLAPI GLint GLAPIENTRY gluScaleImage (GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut);
GLAPI void GLAPIENTRY gluSphere (GLUquadric* quad, GLdouble radius, GLint slices, GLint stacks);
GLAPI void GLAPIENTRY gluTessBeginContour (GLUtesselator* tess);
GLAPI void GLAPIENTRY gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data);
GLAPI void GLAPIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc);
GLAPI void GLAPIENTRY gluTessEndContour (GLUtesselator* tess);
GLAPI void GLAPIENTRY gluTessEndPolygon (GLUtesselator* tess);
GLAPI void GLAPIENTRY gluTessNormal (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ);
GLAPI void GLAPIENTRY gluTessProperty (GLUtesselator* tess, GLenum which, GLdouble data);
GLAPI void GLAPIENTRY gluTessVertex (GLUtesselator* tess, GLdouble *location, GLvoid* data);
GLAPI GLint GLAPIENTRY gluUnProject (GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* objX, GLdouble* objY, GLdouble* objZ);
GLAPI GLint GLAPIENTRY gluUnProject4 (GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble nearVal, GLdouble farVal, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW);
#ifdef __cplusplus
}
#endif
#endif /* __glu_h__ */

View File

@@ -1,86 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 3.0
* 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.
*/
#ifndef GLU_MANGLE_H
#define GLU_MANGLE_H
#define gluLookAt mgluLookAt
#define gluOrtho2D mgluOrtho2D
#define gluPerspective mgluPerspective
#define gluPickMatrix mgluPickMatrix
#define gluProject mgluProject
#define gluUnProject mgluUnProject
#define gluErrorString mgluErrorString
#define gluScaleImage mgluScaleImage
#define gluBuild1DMipmaps mgluBuild1DMipmaps
#define gluBuild2DMipmaps mgluBuild2DMipmaps
#define gluNewQuadric mgluNewQuadric
#define gluDeleteQuadric mgluDeleteQuadric
#define gluQuadricDrawStyle mgluQuadricDrawStyle
#define gluQuadricOrientation mgluQuadricOrientation
#define gluQuadricNormals mgluQuadricNormals
#define gluQuadricTexture mgluQuadricTexture
#define gluQuadricCallback mgluQuadricCallback
#define gluCylinder mgluCylinder
#define gluSphere mgluSphere
#define gluDisk mgluDisk
#define gluPartialDisk mgluPartialDisk
#define gluNewNurbsRenderer mgluNewNurbsRenderer
#define gluDeleteNurbsRenderer mgluDeleteNurbsRenderer
#define gluLoadSamplingMatrices mgluLoadSamplingMatrices
#define gluNurbsProperty mgluNurbsProperty
#define gluGetNurbsProperty mgluGetNurbsProperty
#define gluBeginCurve mgluBeginCurve
#define gluEndCurve mgluEndCurve
#define gluNurbsCurve mgluNurbsCurve
#define gluBeginSurface mgluBeginSurface
#define gluEndSurface mgluEndSurface
#define gluNurbsSurface mgluNurbsSurface
#define gluBeginTrim mgluBeginTrim
#define gluEndTrim mgluEndTrim
#define gluPwlCurve mgluPwlCurve
#define gluNurbsCallback mgluNurbsCallback
#define gluNewTess mgluNewTess
#define gluDeleteTess mgluDeleteTess
#define gluTessBeginPolygon mgluTessBeginPolygon
#define gluTessBeginContour mgluTessBeginContour
#define gluTessVertex mgluTessVertex
#define gluTessEndPolygon mgluTessEndPolygon
#define gluTessEndContour mgluTessEndContour
#define gluTessProperty mgluTessProperty
#define gluTessNormal mgluTessNormal
#define gluTessCallback mgluTessCallback
#define gluGetTessProperty mgluGetTessProperty
#define gluBeginPolygon mgluBeginPolygon
#define gluNextContour mgluNextContour
#define gluEndPolygon mgluEndPolygon
#define gluGetString mgluGetString
#define gluBuild1DMipmapLevels mgluBuild1DMipmapLevels
#define gluBuild2DMipmapLevels mgluBuild2DMipmapLevels
#define gluBuild3DMipmapLevels mgluBuild3DMipmapLevels
#define gluBuild3DMipmaps mgluBuild3DMipmaps
#define gluCheckExtension mgluCheckExtension
#define gluUnProject4 mgluUnProject4
#define gluNurbsCallbackData mgluNurbsCallbackData
#define gluNurbsCallbackDataEXT mgluNurbsCallbackDataEXT
#endif

View File

@@ -923,6 +923,10 @@ struct __DRIdri2ExtensionRec {
* __DRI_IMAGE_FORMAT_NONE is for images that aren't directly usable
* by the driver (YUV planar formats) but serve as a base image for
* creating sub-images for the different planes within the image.
*
* R8, GR88 and NONE should not be used with createImageFormName or
* createImage, and are returned by query from sub images created with
* createImageFromNames (NONE, see above) and fromPlane (R8 & GR88).
*/
#define __DRI_IMAGE_FORMAT_RGB565 0x1001
#define __DRI_IMAGE_FORMAT_XRGB8888 0x1002
@@ -937,6 +941,49 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_USE_SCANOUT 0x0002
#define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated */
/**
* Four CC formats that matches with WL_DRM_FORMAT_* from wayland_drm.h
* and GBM_FORMAT_* from gbm.h, used with createImageFromNames.
*
* \since 5
*/
#define __DRI_IMAGE_FOURCC_RGB565 0x36314752
#define __DRI_IMAGE_FOURCC_ARGB8888 0x34325241
#define __DRI_IMAGE_FOURCC_XRGB8888 0x34325258
#define __DRI_IMAGE_FOURCC_ABGR8888 0x34324241
#define __DRI_IMAGE_FOURCC_XBGR8888 0x34324258
#define __DRI_IMAGE_FOURCC_YUV410 0x39565559
#define __DRI_IMAGE_FOURCC_YUV411 0x31315559
#define __DRI_IMAGE_FOURCC_YUV420 0x32315559
#define __DRI_IMAGE_FOURCC_YUV422 0x36315559
#define __DRI_IMAGE_FOURCC_YUV444 0x34325559
#define __DRI_IMAGE_FOURCC_NV12 0x3231564e
#define __DRI_IMAGE_FOURCC_NV16 0x3631564e
#define __DRI_IMAGE_FOURCC_YUYV 0x56595559
/**
* Queryable on images created by createImageFromNames.
*
* RGB and RGBA are may be usable directly as images but its still
* recommended to call fromPlanar with plane == 0.
*
* Y_U_V, Y_UV and Y_XUXV all requires call to fromPlanar to create
* usable sub-images, sampling from images return raw YUV data and
* color conversion needs to be done in the shader.
*
* \since 5
*/
#define __DRI_IMAGE_COMPONENTS_RGB 0x3001
#define __DRI_IMAGE_COMPONENTS_RGBA 0x3002
#define __DRI_IMAGE_COMPONENTS_Y_U_V 0x3003
#define __DRI_IMAGE_COMPONENTS_Y_UV 0x3004
#define __DRI_IMAGE_COMPONENTS_Y_XUXV 0x3005
/**
* queryImage attributes
*/
@@ -947,6 +994,7 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_ATTRIB_FORMAT 0x2003 /* available in versions 3+ */
#define __DRI_IMAGE_ATTRIB_WIDTH 0x2004 /* available in versions 4+ */
#define __DRI_IMAGE_ATTRIB_HEIGHT 0x2005
#define __DRI_IMAGE_ATTRIB_COMPONENTS 0x2006 /* available in versions 5+ */
typedef struct __DRIimageRec __DRIimage;
typedef struct __DRIimageExtensionRec __DRIimageExtension;
@@ -983,6 +1031,19 @@ struct __DRIimageExtensionRec {
*/
GLboolean (*validateUsage)(__DRIimage *image, unsigned int use);
/**
* Unlike createImageFromName __DRI_IMAGE_FORMAT is not but instead
* __DRI_IMAGE_FOURCC and strides are in bytes not pixels. Stride is
* also per block and not per pixel (for non-RGB, see gallium blocks).
*
* \since 5
*/
__DRIimage *(*createImageFromNames)(__DRIscreen *screen,
int width, int height, int fourcc,
int *names, int num_names,
int *strides, int *offsets,
void *loaderPrivate);
/**
* Create an image out of a sub-region of a parent image. This
* entry point lets us create individual __DRIimages for different
@@ -998,10 +1059,8 @@ struct __DRIimageExtensionRec {
*
* \since 5
*/
__DRIimage *(*createSubImage)(__DRIimage *image,
int width, int height, int format,
int offset, int pitch,
void *loaderPrivate);
__DRIimage *(*fromPlanar)(__DRIimage *image, int plane,
void *loaderPrivate);
};

5
m4/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
libtool.m4
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4

309
m4/ax_pthread.m4 Normal file
View File

@@ -0,0 +1,309 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
#
# DESCRIPTION
#
# This macro figures out how to build C programs using POSIX threads. It
# sets the PTHREAD_LIBS output variable to the threads library and linker
# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
# flags that are needed. (The user can also force certain compiler
# flags/libs to be tested by setting these environment variables.)
#
# Also sets PTHREAD_CC to any special C compiler that is needed for
# multi-threaded programs (defaults to the value of CC otherwise). (This
# is necessary on AIX to use the special cc_r compiler alias.)
#
# NOTE: You are assumed to not only compile your program with these flags,
# but also link it with them as well. e.g. you should link with
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
#
# If you are only building threads programs, you may wish to use these
# variables in your default LIBS, CFLAGS, and CC:
#
# LIBS="$PTHREAD_LIBS $LIBS"
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# CC="$PTHREAD_CC"
#
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
#
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
# PTHREAD_CFLAGS.
#
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
# is not found. If ACTION-IF-FOUND is not specified, the default action
# will define HAVE_PTHREAD.
#
# Please let the authors know if this macro fails on any platform, or if
# you have any other suggestions or comments. This macro was based on work
# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
# grateful for the helpful feedback of numerous users.
#
# Updated for Autoconf 2.68 by Daniel Richard G.
#
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program 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 General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 18
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_PUSH([C])
ax_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes)
AC_MSG_RESULT($ax_pthread_ok)
if test x"$ax_pthread_ok" = xno; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# ... -mt is also the pthreads flag for HP/aCC
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case ${host_os} in
solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
;;
darwin*)
ax_pthread_flags="-pthread $ax_pthread_flags"
;;
esac
if test x"$ax_pthread_ok" = xno; then
for flag in $ax_pthread_flags; do
case $flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $flag])
PTHREAD_CFLAGS="$flag"
;;
pthread-config)
AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
if test x"$ax_pthread_config" = xno; then continue; fi
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
PTHREAD_LIBS="-l$flag"
;;
esac
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
static void routine(void *a) { a = 0; }
static void *start_routine(void *a) { return a; }],
[pthread_t th; pthread_attr_t attr;
pthread_create(&th, 0, start_routine, 0);
pthread_join(th, 0);
pthread_attr_init(&attr);
pthread_cleanup_push(routine, 0);
pthread_cleanup_pop(0) /* ; */])],
[ax_pthread_ok=yes],
[])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($ax_pthread_ok)
if test "x$ax_pthread_ok" = xyes; then
break;
fi
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Various other checks:
if test "x$ax_pthread_ok" = xyes; then
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
AC_MSG_CHECKING([for joinable pthread attribute])
attr_name=unknown
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[int attr = $attr; return attr /* ; */])],
[attr_name=$attr; break],
[])
done
AC_MSG_RESULT($attr_name)
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
[Define to necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case ${host_os} in
aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
osf* | hpux*) flag="-D_REENTRANT";;
solaris*)
if test "$GCC" = "yes"; then
flag="-D_REENTRANT"
else
flag="-mt -D_REENTRANT"
fi
;;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
ax_cv_PTHREAD_PRIO_INHERIT, [
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[#include <pthread.h>]], [[int i = PTHREAD_PRIO_INHERIT;]])],
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
[ax_cv_PTHREAD_PRIO_INHERIT=no])
])
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.]))
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
# More AIX lossage: must compile with xlc_r or cc_r
if test x"$GCC" != xyes; then
AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
else
PTHREAD_CC=$CC
fi
else
PTHREAD_CC="$CC"
fi
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_CC)
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$ax_pthread_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
:
else
ax_pthread_ok=no
$2
fi
AC_LANG_POP
])dnl AX_PTHREAD

View File

@@ -251,7 +251,7 @@ def generate(env):
'_SVID_SOURCE',
'_BSD_SOURCE',
'_GNU_SOURCE',
'PTHREADS',
'HAVE_PTHREAD',
'HAVE_POSIX_MEMALIGN',
]
if env['platform'] == 'darwin':
@@ -498,7 +498,7 @@ def generate(env):
# Default libs
libs = []
if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
if env['platform'] in ('darwin', 'freebsd', 'linux', 'posix', 'sunos'):
libs += ['m', 'pthread', 'dl']
env.Append(LIBS = libs)

View File

@@ -27,8 +27,6 @@ if not env['embedded']:
SConscript('glx/SConscript')
if env['platform'] not in ['darwin', 'haiku', 'sunos']:
SConscript('egl/main/SConscript')
if env['platform'] not in ['darwin']:
SConscript('glu/sgi/SConscript')
if env['gles']:
SConscript('mapi/shared-glapi/SConscript')

View File

@@ -1093,68 +1093,16 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx,
* wl_drm format code to a description of the planes in the buffer
* that lets us create a __DRIimage for each of the planes. */
static const struct wl_drm_format_descriptor {
uint32_t wl_format;
static const struct wl_drm_components_descriptor {
uint32_t dri_components;
EGLint components;
int nplanes;
struct {
int buffer_index;
int width_shift;
int height_shift;
uint32_t dri_format;
int cpp;
} planes[3];
} wl_drm_formats[] = {
{ WL_DRM_FORMAT_ARGB8888, EGL_TEXTURE_RGBA, 1,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_ARGB8888, 4 }, } },
{ WL_DRM_FORMAT_XRGB8888, EGL_TEXTURE_RGB, 1,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_XRGB8888, 4 }, } },
{ WL_DRM_FORMAT_YUV410, EGL_TEXTURE_Y_U_V_WL, 3,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 1, 2, 2, __DRI_IMAGE_FORMAT_R8, 1 },
{ 2, 2, 2, __DRI_IMAGE_FORMAT_R8, 1 } } },
{ WL_DRM_FORMAT_YUV411, EGL_TEXTURE_Y_U_V_WL, 3,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 1, 2, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 2, 2, 0, __DRI_IMAGE_FORMAT_R8, 1 } } },
{ WL_DRM_FORMAT_YUV420, EGL_TEXTURE_Y_U_V_WL, 3,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 1, 1, 1, __DRI_IMAGE_FORMAT_R8, 1 },
{ 2, 1, 1, __DRI_IMAGE_FORMAT_R8, 1 } } },
{ WL_DRM_FORMAT_YUV422, EGL_TEXTURE_Y_U_V_WL, 3,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 1, 1, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 2, 1, 0, __DRI_IMAGE_FORMAT_R8, 1 } } },
{ WL_DRM_FORMAT_YUV444, EGL_TEXTURE_Y_U_V_WL, 3,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 1, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 2, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 } } },
{ WL_DRM_FORMAT_NV12, EGL_TEXTURE_Y_UV_WL, 2,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 1, 1, 1, __DRI_IMAGE_FORMAT_GR88, 2 } } },
{ WL_DRM_FORMAT_NV16, EGL_TEXTURE_Y_UV_WL, 2,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 1, 1, 0, __DRI_IMAGE_FORMAT_GR88, 2 } } },
/* For YUYV buffers, we set up two overlapping DRI images and treat
* them as planar buffers in the compositors. Plane 0 is GR88 and
* samples YU or YV pairs and places Y into the R component, while
* plane 1 is ARGB and samples YUYV clusters and places pairs and
* places U into the G component and V into A. This lets the
* texture sampler interpolate the Y components correctly when
* sampling from plane 0, and interpolate U and V correctly when
* sampling from plane 1. */
{ WL_DRM_FORMAT_YUYV, EGL_TEXTURE_Y_XUXV_WL, 2,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_GR88, 2 },
{ 0, 1, 0, __DRI_IMAGE_FORMAT_ARGB8888, 4 } } }
} wl_drm_components[] = {
{ __DRI_IMAGE_COMPONENTS_RGB, EGL_TEXTURE_RGB, 1 },
{ __DRI_IMAGE_COMPONENTS_RGBA, EGL_TEXTURE_RGBA, 1 },
{ __DRI_IMAGE_COMPONENTS_Y_U_V, EGL_TEXTURE_Y_U_V_WL, 3 },
{ __DRI_IMAGE_COMPONENTS_Y_UV, EGL_TEXTURE_Y_UV_WL, 2 },
{ __DRI_IMAGE_COMPONENTS_Y_XUXV, EGL_TEXTURE_Y_XUXV_WL, 2 },
};
static _EGLImage *
@@ -1164,13 +1112,11 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx,
{
struct wl_drm_buffer *buffer = (struct wl_drm_buffer *) _buffer;
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
const struct wl_drm_components_descriptor *f;
__DRIimage *dri_image;
_EGLImageAttribs attrs;
EGLint err;
uint32_t format;
int32_t offset, stride, plane, width, height;
int cpp, index;
const struct wl_drm_format_descriptor *f;
int32_t plane;
if (!wayland_buffer_is_drm(&buffer->buffer))
return NULL;
@@ -1189,17 +1135,12 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx,
return NULL;
}
width = buffer->buffer.width >> f->planes[plane].width_shift;
height = buffer->buffer.height >> f->planes[plane].height_shift;
format = f->planes[plane].dri_format;
cpp = f->planes[plane].cpp;
index = f->planes[plane].buffer_index;
offset = buffer->offset[index];
stride = buffer->stride[index];
dri_image = dri2_dpy->image->fromPlanar(buffer->driver_buffer, plane, NULL);
dri_image = dri2_dpy->image->createSubImage(buffer->driver_buffer,
width, height, format,
offset, stride / cpp, NULL);
if (dri_image == NULL) {
_eglError(EGL_BAD_PARAMETER, "dri2_create_image_wayland_wl_buffer");
return NULL;
}
return dri2_create_image(disp, dri_image);
}
@@ -1360,24 +1301,31 @@ dri2_wl_reference_buffer(void *user_data, uint32_t name,
{
_EGLDisplay *disp = user_data;
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
int i;
__DRIimage *img;
int i, dri_components = 0;
for (i = 0; i < ARRAY_SIZE(wl_drm_formats); i++)
if (wl_drm_formats[i].wl_format == buffer->format) {
buffer->driver_format = &wl_drm_formats[i];
break;
}
img = dri2_dpy->image->createImageFromNames(dri2_dpy->dri_screen,
buffer->buffer.width,
buffer->buffer.height,
buffer->format, (int*)&name, 1,
buffer->stride,
buffer->offset,
NULL);
if (buffer->driver_format == NULL)
if (img == NULL)
return;
buffer->driver_buffer =
dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen,
buffer->buffer.width,
buffer->buffer.height,
__DRI_IMAGE_FORMAT_NONE, name,
buffer->stride[0] / 4,
NULL);
dri2_dpy->image->queryImage(img, __DRI_IMAGE_ATTRIB_COMPONENTS, &dri_components);
buffer->driver_format = NULL;
for (i = 0; i < ARRAY_SIZE(wl_drm_components); i++)
if (wl_drm_components[i].dri_components == dri_components)
buffer->driver_format = &wl_drm_components[i];
if (buffer->driver_format == NULL)
dri2_dpy->image->destroyImage(img);
else
buffer->driver_buffer = img;
}
static void
@@ -1442,7 +1390,7 @@ dri2_query_wayland_buffer_wl(_EGLDriver *drv, _EGLDisplay *disp,
EGLint attribute, EGLint *value)
{
struct wl_drm_buffer *buffer = (struct wl_drm_buffer *) _buffer;
const struct wl_drm_format_descriptor *format;
const struct wl_drm_components_descriptor *format;
if (!wayland_buffer_is_drm(&buffer->buffer))
return EGL_FALSE;

View File

@@ -500,6 +500,14 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
for (j = 0; dri2_dpy->driver_configs[j]; j++) {
const EGLint surface_type = EGL_WINDOW_BIT | EGL_PBUFFER_BIT;
struct dri2_egl_config *dri2_conf;
unsigned int double_buffered = 0;
dri2_dpy->core->getConfigAttrib(dri2_dpy->driver_configs[j],
__DRI_ATTRIB_DOUBLE_BUFFER, &double_buffered);
/* support only double buffered configs */
if (!double_buffered)
continue;
dri2_conf = dri2_add_config(dpy, dri2_dpy->driver_configs[j],
count + 1, visuals[i].size, surface_type, NULL,
@@ -525,17 +533,6 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
/* there is no front buffer so no OpenGL */
dri2_conf->base.RenderableType &= ~EGL_OPENGL_BIT;
dri2_conf->base.Conformant &= ~EGL_OPENGL_BIT;
/*
* We want to make sure GL_DRAW_BUFFER for windows or pbuffers is always
* GL_BACK. For EGL configs that do not have a double DRI config, clear
* the surface type.
*
* This is just to be on the safe side. dri2_add_config never sets
* EGL_WINDOW_BIT or EGL_PBUFFER_BIT for such configs.
*/
if (!dri2_conf->dri_double_config)
dri2_conf->base.SurfaceType = 0;
}
return (count != 0);
@@ -660,18 +657,29 @@ droid_open_device(void)
return (fd >= 0) ? dup(fd) : -1;
}
/* support versions < JellyBean */
#ifndef ALOGW
#define ALOGW LOGW
#endif
#ifndef ALOGD
#define ALOGD LOGD
#endif
#ifndef ALOGI
#define ALOGI LOGI
#endif
static void
droid_log(EGLint level, const char *msg)
{
switch (level) {
case _EGL_DEBUG:
LOGD("%s", msg);
ALOGD("%s", msg);
break;
case _EGL_INFO:
LOGI("%s", msg);
ALOGI("%s", msg);
break;
case _EGL_WARNING:
LOGW("%s", msg);
ALOGW("%s", msg);
break;
case _EGL_FATAL:
LOG_FATAL("%s", msg);

View File

@@ -778,10 +778,9 @@ dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw,
if (numRects > (int)ARRAY_SIZE(rectangles))
return dri2_copy_region(drv, disp, draw, dri2_surf->region);
/* FIXME: Invert y here? */
for (i = 0; i < numRects; i++) {
rectangles[i].x = rects[i * 4];
rectangles[i].y = rects[i * 4 + 1];
rectangles[i].y = dri2_surf->base.Height - rects[i * 4 + 1] - rects[i * 4 + 3];
rectangles[i].width = rects[i * 4 + 2];
rectangles[i].height = rects[i * 4 + 3];
}

View File

@@ -42,7 +42,7 @@
static _EGLThreadInfo dummy_thread = _EGL_THREAD_INFO_INITIALIZER;
#if PTHREADS
#if HAVE_PTHREAD
#include <pthread.h>
static _EGL_DECLARE_MUTEX(_egl_TSDMutex);
@@ -108,7 +108,7 @@ static INLINE EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *))
return EGL_TRUE;
}
#else /* PTHREADS */
#else /* HAVE_PTHREAD */
static const _EGLThreadInfo *_egl_TSD;
static void (*_egl_FreeTSD)(_EGLThreadInfo *);
@@ -137,7 +137,7 @@ static INLINE EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *))
return EGL_TRUE;
}
#endif /* !PTHREADS */
#endif /* !HAVE_PTHREAD */
static void

View File

@@ -31,7 +31,7 @@
#include "eglcompiler.h"
#ifdef PTHREADS
#ifdef HAVE_PTHREAD
#include <pthread.h>
typedef pthread_mutex_t _EGLMutex;

View File

@@ -621,7 +621,7 @@ draw_set_indexes(struct draw_context *draw,
elem_size == 2 ||
elem_size == 4);
draw->pt.user.elts = elements;
draw->pt.user.eltSize = elem_size;
draw->pt.user.eltSizeIB = elem_size;
}

View File

@@ -174,6 +174,7 @@ struct draw_context
/** vertex element/index buffer (ex: glDrawElements) */
const void *elts;
/** bytes per index (0, 1, 2 or 4) */
unsigned eltSizeIB;
unsigned eltSize;
int eltBias;
unsigned min_index;

View File

@@ -362,7 +362,7 @@ draw_pt_arrays_restart(struct draw_context *draw,
assert(info->primitive_restart);
if (draw->pt.user.elts) {
if (draw->pt.user.eltSize) {
/* indexed prims (draw_elements) */
cur_start = start;
cur_count = 0;
@@ -433,12 +433,8 @@ draw_arrays_instanced(struct draw_context *draw,
info.count = count;
info.start_instance = startInstance;
info.instance_count = instanceCount;
info.indexed = (draw->pt.user.elts != NULL);
if (!info.indexed) {
info.min_index = start;
info.max_index = start + count - 1;
}
info.min_index = start;
info.max_index = start + count - 1;
draw_vbo(draw, &info);
}
@@ -465,6 +461,7 @@ draw_vbo(struct draw_context *draw,
draw->pt.user.eltBias = info->index_bias;
draw->pt.user.min_index = info->min_index;
draw->pt.user.max_index = info->max_index;
draw->pt.user.eltSize = info->indexed ? draw->pt.user.eltSizeIB : 0;
if (0)
debug_printf("draw_vbo(mode=%u start=%u count=%u):\n",

View File

@@ -1213,6 +1213,21 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter,
pipe->bind_fragment_sampler_states(pipe, 2, samplers);
pipe_sampler_view_reference(&views[1], NULL);
} else if (blit_stencil) {
/* Set a stencil-only sampler view for it not to sample depth instead. */
struct pipe_sampler_view templ;
struct pipe_sampler_view *view;
templ = *src;
templ.format = util_format_stencil_only(templ.format);
assert(templ.format != PIPE_FORMAT_NONE);
view = pipe->create_sampler_view(pipe, src->texture, &templ);
pipe->set_fragment_sampler_views(pipe, 1, &view);
pipe->bind_fragment_sampler_states(pipe, 1, &ctx->sampler_state);
pipe_sampler_view_reference(&view, NULL);
} else {
pipe->set_fragment_sampler_views(pipe, 1, &src);
pipe->bind_fragment_sampler_states(pipe, 1, &ctx->sampler_state);

View File

@@ -41,6 +41,16 @@ struct r300_fragment_shader;
struct r300_vertex_shader;
struct r300_stencilref_context;
enum colormask_swizzle {
COLORMASK_BGRA,
COLORMASK_RGBA,
COLORMASK_RRRR,
COLORMASK_AAAA,
COLORMASK_GRRG,
COLORMASK_ARRA,
COLORMASK_NUM_SWIZZLES
};
struct r300_atom {
/* Name, for debugging. */
const char* name;
@@ -66,7 +76,7 @@ struct r300_aa_state {
struct r300_blend_state {
struct pipe_blend_state state;
uint32_t cb_clamp[8];
uint32_t cb_clamp[COLORMASK_NUM_SWIZZLES][8];
uint32_t cb_noclamp[8];
uint32_t cb_no_readwrite[8];
};
@@ -320,6 +330,8 @@ struct r300_surface {
/* Whether the CBZB clear is allowed on the surface. */
boolean cbzb_allowed;
unsigned colormask_swizzle;
};
struct r300_texture_desc {

View File

@@ -45,10 +45,12 @@ void r300_emit_blend_state(struct r300_context* r300,
CS_LOCALS(r300);
if (fb->nr_cbufs) {
if (fb->cbufs[0]->format == PIPE_FORMAT_R16G16B16A16_FLOAT)
if (fb->cbufs[0]->format == PIPE_FORMAT_R16G16B16A16_FLOAT) {
WRITE_CS_TABLE(blend->cb_noclamp, size);
else
WRITE_CS_TABLE(blend->cb_clamp, size);
} else {
unsigned swz = r300_surface(fb->cbufs[0])->colormask_swizzle;
WRITE_CS_TABLE(blend->cb_clamp[swz], size);
}
} else {
WRITE_CS_TABLE(blend->cb_no_readwrite, size);
}

View File

@@ -169,15 +169,52 @@ static boolean blend_discard_if_src_alpha_color_1(unsigned srcRGB, unsigned srcA
dstA == PIPE_BLENDFACTOR_ONE);
}
/* The hardware colormask is clunky a must be swizzled depending on the format.
* This was figured out by trial-and-error. */
static unsigned bgra_cmask(unsigned mask)
{
/* Gallium uses RGBA color ordering while R300 expects BGRA. */
return ((mask & PIPE_MASK_R) << 2) |
((mask & PIPE_MASK_B) >> 2) |
(mask & (PIPE_MASK_G | PIPE_MASK_A));
}
static unsigned rgba_cmask(unsigned mask)
{
return mask & PIPE_MASK_RGBA;
}
static unsigned rrrr_cmask(unsigned mask)
{
return (mask & PIPE_MASK_R) |
((mask & PIPE_MASK_R) << 1) |
((mask & PIPE_MASK_R) << 2) |
((mask & PIPE_MASK_R) << 3);
}
static unsigned aaaa_cmask(unsigned mask)
{
return ((mask & PIPE_MASK_A) >> 3) |
((mask & PIPE_MASK_A) >> 2) |
((mask & PIPE_MASK_A) >> 1) |
(mask & PIPE_MASK_A);
}
static unsigned grrg_cmask(unsigned mask)
{
return ((mask & PIPE_MASK_R) << 1) |
((mask & PIPE_MASK_R) << 2) |
((mask & PIPE_MASK_G) >> 1) |
((mask & PIPE_MASK_G) << 2);
}
static unsigned arra_cmask(unsigned mask)
{
return ((mask & PIPE_MASK_R) << 1) |
((mask & PIPE_MASK_R) << 2) |
((mask & PIPE_MASK_A) >> 3) |
(mask & PIPE_MASK_A);
}
/* Create a new blend state based on the CSO blend state.
*
* This encompasses alpha blending, logic/raster ops, and blend dithering. */
@@ -190,9 +227,9 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
uint32_t blend_control_noclamp = 0; /* R300_RB3D_CBLEND: 0x4e04 */
uint32_t alpha_blend_control = 0; /* R300_RB3D_ABLEND: 0x4e08 */
uint32_t alpha_blend_control_noclamp = 0; /* R300_RB3D_ABLEND: 0x4e08 */
uint32_t color_channel_mask = 0; /* R300_RB3D_COLOR_CHANNEL_MASK: 0x4e0c */
uint32_t rop = 0; /* R300_RB3D_ROPCNTL: 0x4e18 */
uint32_t dither = 0; /* R300_RB3D_DITHER_CTL: 0x4e50 */
int i;
CB_LOCALS;
blend->state = *state;
@@ -331,20 +368,6 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
(state->logicop_func) << R300_RB3D_ROPCNTL_ROP_SHIFT;
}
/* Color channel masks for all MRTs. */
color_channel_mask = bgra_cmask(state->rt[0].colormask);
if (r300screen->caps.is_r500 && state->independent_blend_enable) {
if (state->rt[1].blend_enable) {
color_channel_mask |= bgra_cmask(state->rt[1].colormask) << 4;
}
if (state->rt[2].blend_enable) {
color_channel_mask |= bgra_cmask(state->rt[2].colormask) << 8;
}
if (state->rt[3].blend_enable) {
color_channel_mask |= bgra_cmask(state->rt[3].colormask) << 12;
}
}
/* Neither fglrx nor classic r300 ever set this, regardless of dithering
* state. Since it's an optional implementation detail, we can leave it
* out and never dither.
@@ -358,14 +381,27 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
*/
/* Build a command buffer. */
BEGIN_CB(blend->cb_clamp, 8);
OUT_CB_REG(R300_RB3D_ROPCNTL, rop);
OUT_CB_REG_SEQ(R300_RB3D_CBLEND, 3);
OUT_CB(blend_control);
OUT_CB(alpha_blend_control);
OUT_CB(color_channel_mask);
OUT_CB_REG(R300_RB3D_DITHER_CTL, dither);
END_CB;
{
unsigned (*func[COLORMASK_NUM_SWIZZLES])(unsigned) = {
bgra_cmask,
rgba_cmask,
rrrr_cmask,
aaaa_cmask,
grrg_cmask,
arra_cmask
};
for (i = 0; i < COLORMASK_NUM_SWIZZLES; i++) {
BEGIN_CB(blend->cb_clamp[i], 8);
OUT_CB_REG(R300_RB3D_ROPCNTL, rop);
OUT_CB_REG_SEQ(R300_RB3D_CBLEND, 3);
OUT_CB(blend_control);
OUT_CB(alpha_blend_control);
OUT_CB(func[i](state->rt[0].colormask));
OUT_CB_REG(R300_RB3D_DITHER_CTL, dither);
END_CB;
}
}
/* Build a command buffer. */
BEGIN_CB(blend->cb_noclamp, 8);
@@ -373,7 +409,7 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
OUT_CB_REG_SEQ(R300_RB3D_CBLEND, 3);
OUT_CB(blend_control_noclamp);
OUT_CB(alpha_blend_control_noclamp);
OUT_CB(color_channel_mask);
OUT_CB(rgba_cmask(state->rt[0].colormask));
OUT_CB_REG(R300_RB3D_DITHER_CTL, dither);
END_CB;

View File

@@ -704,10 +704,87 @@ static uint32_t r300_translate_out_fmt(enum pipe_format format)
}
}
static uint32_t r300_translate_colormask_swizzle(enum pipe_format format)
{
switch (format) {
case PIPE_FORMAT_A8_UNORM:
case PIPE_FORMAT_A8_SNORM:
case PIPE_FORMAT_A16_UNORM:
case PIPE_FORMAT_A16_SNORM:
case PIPE_FORMAT_A16_FLOAT:
case PIPE_FORMAT_A32_FLOAT:
return COLORMASK_AAAA;
case PIPE_FORMAT_I8_UNORM:
case PIPE_FORMAT_I8_SNORM:
case PIPE_FORMAT_L8_UNORM:
case PIPE_FORMAT_L8_SNORM:
case PIPE_FORMAT_R8_UNORM:
case PIPE_FORMAT_R8_SNORM:
case PIPE_FORMAT_R32_FLOAT:
case PIPE_FORMAT_L32_FLOAT:
case PIPE_FORMAT_I32_FLOAT:
return COLORMASK_RRRR;
case PIPE_FORMAT_L8A8_SNORM:
case PIPE_FORMAT_L8A8_UNORM:
case PIPE_FORMAT_L16A16_UNORM:
case PIPE_FORMAT_L16A16_SNORM:
case PIPE_FORMAT_L16A16_FLOAT:
case PIPE_FORMAT_L32A32_FLOAT:
return COLORMASK_ARRA;
case PIPE_FORMAT_R8G8_SNORM:
case PIPE_FORMAT_R8G8_UNORM:
case PIPE_FORMAT_R16G16_UNORM:
case PIPE_FORMAT_R16G16_SNORM:
case PIPE_FORMAT_R16G16_FLOAT:
case PIPE_FORMAT_R32G32_FLOAT:
return COLORMASK_GRRG;
case PIPE_FORMAT_B5G6R5_UNORM:
case PIPE_FORMAT_B5G5R5A1_UNORM:
case PIPE_FORMAT_B5G5R5X1_UNORM:
case PIPE_FORMAT_B4G4R4A4_UNORM:
case PIPE_FORMAT_B4G4R4X4_UNORM:
case PIPE_FORMAT_B8G8R8A8_UNORM:
/*case PIPE_FORMAT_B8G8R8A8_SNORM:*/
case PIPE_FORMAT_B8G8R8X8_UNORM:
/*case PIPE_FORMAT_B8G8R8X8_SNORM:*/
case PIPE_FORMAT_B10G10R10A2_UNORM:
return COLORMASK_BGRA;
case PIPE_FORMAT_R8G8B8X8_UNORM:
/*case PIPE_FORMAT_R8G8B8X8_SNORM:*/
case PIPE_FORMAT_R8G8B8A8_UNORM:
case PIPE_FORMAT_R8G8B8A8_SNORM:
case PIPE_FORMAT_R10G10B10A2_UNORM:
case PIPE_FORMAT_R10G10B10X2_SNORM:
case PIPE_FORMAT_R16_UNORM:
case PIPE_FORMAT_R16G16B16A16_UNORM:
case PIPE_FORMAT_R16_SNORM:
case PIPE_FORMAT_R16G16B16A16_SNORM:
case PIPE_FORMAT_R16_FLOAT:
case PIPE_FORMAT_R16G16B16A16_FLOAT:
case PIPE_FORMAT_R32G32B32A32_FLOAT:
case PIPE_FORMAT_L16_UNORM:
case PIPE_FORMAT_L16_SNORM:
case PIPE_FORMAT_L16_FLOAT:
case PIPE_FORMAT_I16_UNORM:
case PIPE_FORMAT_I16_SNORM:
case PIPE_FORMAT_I16_FLOAT:
return COLORMASK_RGBA;
default:
return ~0; /* Unsupported. */
}
}
boolean r300_is_colorbuffer_format_supported(enum pipe_format format)
{
return r300_translate_colorformat(format) != ~0 &&
r300_translate_out_fmt(format) != ~0;
r300_translate_out_fmt(format) != ~0 &&
r300_translate_colormask_swizzle(format) != ~0;
}
boolean r300_is_zs_format_supported(enum pipe_format format)
@@ -827,6 +904,8 @@ static void r300_texture_setup_fb_state(struct r300_surface *surf)
R300_COLOR_TILE(tex->tex.macrotile[level]) |
R300_COLOR_MICROTILE(tex->tex.microtile);
surf->format = r300_translate_out_fmt(surf->base.format);
surf->colormask_swizzle =
r300_translate_colormask_swizzle(surf->base.format);
}
}

View File

@@ -643,13 +643,6 @@ boolean evergreen_is_format_supported(struct pipe_screen *screen,
default:
return FALSE;
}
/* require render-target support for multisample resources */
if (util_format_is_depth_or_stencil(format)) {
usage |= PIPE_BIND_DEPTH_STENCIL;
} else {
usage |= PIPE_BIND_RENDER_TARGET;
}
}
if ((usage & PIPE_BIND_SAMPLER_VIEW) &&
@@ -917,10 +910,12 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx,
if (rctx->chip_class == CAYMAN) {
r600_pipe_state_add_reg(rstate, CM_R_028BE4_PA_SU_VTX_CNTL,
S_028C08_PIX_CENTER_HALF(state->gl_rasterization_rules));
S_028C08_PIX_CENTER_HALF(state->gl_rasterization_rules) |
S_028C08_QUANT_MODE(V_028C08_X_1_256TH));
} else {
r600_pipe_state_add_reg(rstate, R_028C08_PA_SU_VTX_CNTL,
S_028C08_PIX_CENTER_HALF(state->gl_rasterization_rules));
S_028C08_PIX_CENTER_HALF(state->gl_rasterization_rules) |
S_028C08_QUANT_MODE(V_028C08_X_1_256TH));
}
r600_pipe_state_add_reg(rstate, R_028B7C_PA_SU_POLY_OFFSET_CLAMP, fui(state->offset_clamp));
r600_pipe_state_add_reg(rstate, R_028814_PA_SU_SC_MODE_CNTL,
@@ -1496,13 +1491,24 @@ static void evergreen_init_depth_surface(struct r600_context *rctx,
if (rtex->surface.flags & RADEON_SURF_SBUFFER) {
uint64_t stencil_offset = rtex->surface.stencil_offset;
unsigned stile_split = rtex->surface.stencil_tile_split;
unsigned i, stile_split = rtex->surface.stencil_tile_split;
stile_split = eg_tile_split(stile_split);
stencil_offset += r600_resource_va(screen, surf->base.texture);
stencil_offset += rtex->surface.level[level].offset / 4;
stencil_offset >>= 8;
/* We're guessing the stencil offset from the depth offset.
* Make sure each mipmap level has a unique offset. */
for (i = 1; i <= level; i++) {
/* If two levels have the same address, add 256
* to the offset of the smaller level. */
if ((rtex->surface.level[i-1].offset / 4) >> 8 ==
(rtex->surface.level[i].offset / 4) >> 8) {
stencil_offset++;
}
}
surf->db_stencil_base = stencil_offset;
surf->db_stencil_info = 1 | S_028044_TILE_SPLIT(stile_split);
} else {

View File

@@ -1955,6 +1955,17 @@
#define S_028C08_PIX_CENTER_HALF(x) (((x) & 0x1) << 0)
#define G_028C08_PIX_CENTER_HALF(x) (((x) >> 0) & 0x1)
#define C_028C08_PIX_CENTER_HALF 0xFFFFFFFE
#define S_028C08_QUANT_MODE(x) (((x) & 0x7) << 3)
#define G_028C08_QUANT_MODE(x) (((x) >> 3) & 0x7)
#define C_028C08_QUANT_MODE 0xFFFFFFC7
#define V_028C08_X_1_16TH 0x00
#define V_028C08_X_1_8TH 0x01
#define V_028C08_X_1_4TH 0x02
#define V_028C08_X_1_2 0x03
#define V_028C08_X_1 0x04
#define V_028C08_X_1_256TH 0x05
#define V_028C08_X_1_1024TH 0x06
#define V_028C08_X_1_4096TH 0x07
#define R_028C0C_PA_CL_GB_VERT_CLIP_ADJ 0x00028C0C
#define R_028C10_PA_CL_GB_VERT_DISC_ADJ 0x00028C10
#define R_028C14_PA_CL_GB_HORZ_CLIP_ADJ 0x00028C14

View File

@@ -2752,31 +2752,47 @@ int r600_vertex_elements_build_fetch_shader(struct r600_context *rctx, struct r6
unsigned fetch_resource_start = rctx->chip_class >= EVERGREEN ? 0 : 160;
unsigned format, num_format, format_comp, endian;
uint32_t *bytecode;
int i, r;
int i, j, r;
memset(&bc, 0, sizeof(bc));
r600_bytecode_init(&bc, rctx->chip_class, rctx->family);
for (i = 0; i < ve->count; i++) {
if (elements[i].instance_divisor > 1) {
struct r600_bytecode_alu alu;
memset(&alu, 0, sizeof(alu));
alu.inst = BC_INST(&bc, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT);
alu.src[0].sel = 0;
alu.src[0].chan = 3;
alu.src[1].sel = V_SQ_ALU_SRC_LITERAL;
alu.src[1].value = (1ll << 32) / elements[i].instance_divisor + 1;
alu.dst.sel = i + 1;
alu.dst.chan = 3;
alu.dst.write = 1;
alu.last = 1;
if ((r = r600_bytecode_add_alu(&bc, &alu))) {
r600_bytecode_clear(&bc);
return r;
if (rctx->chip_class == CAYMAN) {
for (j = 0; j < 4; j++) {
struct r600_bytecode_alu alu;
memset(&alu, 0, sizeof(alu));
alu.inst = BC_INST(&bc, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT);
alu.src[0].sel = 0;
alu.src[0].chan = 3;
alu.src[1].sel = V_SQ_ALU_SRC_LITERAL;
alu.src[1].value = (1ll << 32) / elements[i].instance_divisor + 1;
alu.dst.sel = i + 1;
alu.dst.chan = j;
alu.dst.write = j == 3;
alu.last = j == 3;
if ((r = r600_bytecode_add_alu(&bc, &alu))) {
r600_bytecode_clear(&bc);
return r;
}
}
} else {
struct r600_bytecode_alu alu;
memset(&alu, 0, sizeof(alu));
alu.inst = BC_INST(&bc, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT);
alu.src[0].sel = 0;
alu.src[0].chan = 3;
alu.src[1].sel = V_SQ_ALU_SRC_LITERAL;
alu.src[1].value = (1ll << 32) / elements[i].instance_divisor + 1;
alu.dst.sel = i + 1;
alu.dst.chan = 3;
alu.dst.write = 1;
alu.last = 1;
if ((r = r600_bytecode_add_alu(&bc, &alu))) {
r600_bytecode_clear(&bc);
return r;
}
}
}
}

View File

@@ -1878,6 +1878,11 @@ static int cayman_emit_float_instr(struct r600_shader_ctx *ctx)
alu.inst = ctx->inst_info->r600_opcode;
for (j = 0; j < inst->Instruction.NumSrcRegs; j++) {
r600_bytecode_src(&alu.src[j], &ctx->src[j], 0);
/* RSQ should take the absolute value of src */
if (ctx->inst_info->tgsi_opcode == TGSI_OPCODE_RSQ) {
r600_bytecode_src_set_abs(&alu.src[j]);
}
}
tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
alu.dst.write = (inst->Dst[0].Register.WriteMask >> i) & 1;
@@ -4373,10 +4378,8 @@ static int tgsi_exp(struct r600_shader_ctx *ctx)
alu.dst.sel = ctx->temp_reg;
alu.dst.chan = i;
if (i == 0)
alu.dst.write = 1;
if (i == 2)
alu.last = 1;
alu.dst.write = i == 0;
alu.last = i == 2;
r = r600_bytecode_add_alu(ctx->bc, &alu);
if (r)
return r;

View File

@@ -592,6 +592,10 @@ boolean r600_is_format_supported(struct pipe_screen *screen,
format == PIPE_FORMAT_R11G11B10_FLOAT)
return FALSE;
/* MSAA integer colorbuffers hang. */
if (util_format_is_pure_integer(format))
return FALSE;
switch (sample_count) {
case 2:
case 4:
@@ -600,15 +604,6 @@ boolean r600_is_format_supported(struct pipe_screen *screen,
default:
return FALSE;
}
/* require render-target support for multisample resources */
if (util_format_is_depth_or_stencil(format)) {
usage |= PIPE_BIND_DEPTH_STENCIL;
} else if (util_format_is_pure_integer(format)) {
return FALSE; /* no integer textures */
} else {
usage |= PIPE_BIND_RENDER_TARGET;
}
}
if ((usage & PIPE_BIND_SAMPLER_VIEW) &&
@@ -948,7 +943,8 @@ static void *r600_create_rs_state(struct pipe_context *ctx,
r600_pipe_state_add_reg(rstate, R_028A4C_PA_SC_MODE_CNTL, sc_mode_cntl);
r600_pipe_state_add_reg(rstate, R_028C08_PA_SU_VTX_CNTL,
S_028C08_PIX_CENTER_HALF(state->gl_rasterization_rules));
S_028C08_PIX_CENTER_HALF(state->gl_rasterization_rules) |
S_028C08_QUANT_MODE(V_028C08_X_1_256TH));
r600_pipe_state_add_reg(rstate, R_028DFC_PA_SU_POLY_OFFSET_CLAMP, fui(state->offset_clamp));
r600_pipe_state_add_reg(rstate, R_028814_PA_SU_SC_MODE_CNTL,

View File

@@ -108,7 +108,7 @@ void r600_init_common_atoms(struct r600_context *rctx)
{
r600_init_atom(&rctx->surface_sync_cmd.atom, r600_emit_surface_sync, 5, EMIT_EARLY);
r600_init_atom(&rctx->r6xx_flush_and_inv_cmd, r600_emit_r6xx_flush_and_inv, 2, EMIT_EARLY);
r600_init_atom(&rctx->alphatest_state.atom, r600_emit_alphatest_state, 3, 0);
r600_init_atom(&rctx->alphatest_state.atom, r600_emit_alphatest_state, 6, 0);
r600_atom_dirty(rctx, &rctx->alphatest_state.atom);
}

View File

@@ -592,13 +592,6 @@ bool r600_init_flushed_depth_texture(struct pipe_context *ctx,
return true;
}
/* Needs adjustment for pixelformat:
*/
static INLINE unsigned u_box_volume( const struct pipe_box *box )
{
return box->width * box->depth * box->height;
}
struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
struct pipe_resource *texture,
unsigned level,
@@ -622,9 +615,6 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
use_staging_texture = TRUE;
}
if ((usage & PIPE_TRANSFER_READ) && u_box_volume(box) > 1024)
use_staging_texture = TRUE;
/* Use a staging texture for uploads if the underlying BO is busy. */
if (!(usage & PIPE_TRANSFER_READ) &&
(rctx->ws->cs_is_buffer_referenced(rctx->cs, rtex->resource.cs_buf, RADEON_USAGE_READWRITE) ||

View File

@@ -2194,6 +2194,15 @@
#define S_028C08_PIX_CENTER_HALF(x) (((x) & 0x1) << 0)
#define G_028C08_PIX_CENTER_HALF(x) (((x) >> 0) & 0x1)
#define C_028C08_PIX_CENTER_HALF 0xFFFFFFFE
#define S_028C08_QUANT_MODE(x) (((x) & 0x7) << 3)
#define G_028C08_QUANT_MODE(x) (((x) >> 3) & 0x7)
#define C_028C08_QUANT_MODE 0xFFFFFFC7
#define V_028C08_X_1_16TH 0x00
#define V_028C08_X_1_8TH 0x01
#define V_028C08_X_1_4TH 0x02
#define V_028C08_X_1_2 0x03
#define V_028C08_X_1 0x04
#define V_028C08_X_1_256TH 0x05
#define R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX 0x028C1C
#define R_028C48_PA_SC_AA_MASK 0x028C48
#define R_028810_PA_CL_CLIP_CNTL 0x028810

View File

@@ -20,8 +20,6 @@ tablegen = $(TBLGEN) -I $(LLVM_INCLUDEDIR) $1 $2 -o $3
HAVE_LLVM_INTRINSICS = $(shell grep IntrinsicsR600.td $(LLVM_INCLUDEDIR)/llvm/Intrinsics.td)
gen: $(GENERATED_SOURCES)
SIRegisterInfo.td: SIGenRegisterInfo.pl
$(PERL) $^ > $@
@@ -38,37 +36,37 @@ endif
R600RegisterInfo.td: R600GenRegisterInfo.pl
$(PERL) $^ > $@
AMDGPUGenRegisterInfo.inc: *.td
AMDGPUGenRegisterInfo.inc: $(TD_FILES)
$(call tablegen, -gen-register-info, AMDGPU.td, $@)
AMDGPUGenInstrInfo.inc: *.td
AMDGPUGenInstrInfo.inc: $(TD_FILES)
$(call tablegen, -gen-instr-info, AMDGPU.td, $@)
AMDGPUGenAsmWriter.inc: *.td
AMDGPUGenAsmWriter.inc: $(TD_FILES)
$(call tablegen, -gen-asm-writer, AMDGPU.td, $@)
AMDGPUGenDAGISel.inc: *.td
AMDGPUGenDAGISel.inc: $(TD_FILES)
$(call tablegen, -gen-dag-isel, AMDGPU.td, $@)
AMDGPUGenCallingConv.inc: *.td
AMDGPUGenCallingConv.inc: $(TD_FILES)
$(call tablegen, -gen-callingconv, AMDGPU.td, $@)
AMDGPUGenSubtargetInfo.inc: *.td
AMDGPUGenSubtargetInfo.inc: $(TD_FILES)
$(call tablegen, -gen-subtarget, AMDGPU.td, $@)
AMDGPUGenEDInfo.inc: *.td
AMDGPUGenEDInfo.inc: $(TD_FILES)
$(call tablegen, -gen-enhanced-disassembly-info, AMDGPU.td, $@)
AMDGPUGenIntrinsics.inc: *.td
AMDGPUGenIntrinsics.inc: $(TD_FILES)
$(call tablegen, -gen-tgt-intrinsic, AMDGPU.td, $@)
AMDGPUGenCodeEmitter.inc: *.td
AMDGPUGenCodeEmitter.inc: $(TD_FILES)
$(call tablegen, -gen-emitter, AMDGPU.td, $@)
AMDGPUGenMCCodeEmitter.inc: *.td
AMDGPUGenMCCodeEmitter.inc: $(TD_FILES)
$(call tablegen, -mc-emitter -gen-emitter, AMDGPU.td, $@)
AMDGPUGenDFAPacketizer.inc: *.td
AMDGPUGenDFAPacketizer.inc: $(TD_FILES)
$(call tablegen, -gen-dfa-packetizer, AMDGPU.td, $@)
LOADER_LIBS=$(shell llvm-config --libs bitreader asmparser)

View File

@@ -1,4 +1,29 @@
TD_FILES := \
AMDGPU.td \
AMDGPUInstrInfo.td \
AMDGPUInstructions.td \
AMDGPUIntrinsics.td \
AMDGPURegisterInfo.td \
AMDILBase.td \
AMDILInstrInfo.td \
AMDILIntrinsics.td \
AMDILRegisterInfo.td \
Processors.td \
R600Instructions.td \
R600Intrinsics.td \
R600IntrinsicsNoOpenCL.td \
R600IntrinsicsOpenCL.td \
R600RegisterInfo.td \
R600Schedule.td \
SIInstrFormats.td \
SIInstrInfo.td \
SIInstructions.td \
SIIntrinsics.td \
SIRegisterInfo.td \
SISchedule.td
GENERATED_SOURCES := \
R600Intrinsics.td \
R600RegisterInfo.td \

View File

@@ -86,6 +86,7 @@ struct __DRIimageRec {
unsigned level;
unsigned layer;
uint32_t dri_format;
uint32_t dri_components;
void *loader_private;
};

View File

@@ -574,6 +574,7 @@ dri2_create_image(__DRIscreen *_screen,
img->level = 0;
img->layer = 0;
img->dri_format = format;
img->dri_components = 0;
img->loader_private = loaderPrivate;
return img;
@@ -612,6 +613,11 @@ dri2_query_image(__DRIimage *image, int attrib, int *value)
case __DRI_IMAGE_ATTRIB_HEIGHT:
*value = image->texture->height0;
return GL_TRUE;
case __DRI_IMAGE_ATTRIB_COMPONENTS:
if (image->dri_components == 0)
return GL_FALSE;
*value = image->dri_components;
return GL_TRUE;
default:
return GL_FALSE;
}
@@ -630,6 +636,8 @@ dri2_dup_image(__DRIimage *image, void *loaderPrivate)
pipe_resource_reference(&img->texture, image->texture);
img->level = image->level;
img->layer = image->layer;
/* This should be 0 for sub images, but dup is also used for base images. */
img->dri_components = image->dri_components;
img->loader_private = loaderPrivate;
return img;
@@ -649,6 +657,76 @@ dri2_validate_usage(__DRIimage *image, unsigned int use)
return GL_FALSE;
}
static __DRIimage *
dri2_from_names(__DRIscreen *screen, int width, int height, int format,
int *names, int num_names, int *strides, int *offsets,
void *loaderPrivate)
{
__DRIimage *img;
int stride, dri_components;
if (num_names != 1)
return NULL;
if (offsets[0] != 0)
return NULL;
switch(format) {
case __DRI_IMAGE_FOURCC_RGB565:
format = __DRI_IMAGE_FORMAT_RGB565;
dri_components = __DRI_IMAGE_COMPONENTS_RGB;
break;
case __DRI_IMAGE_FOURCC_ARGB8888:
format = __DRI_IMAGE_FORMAT_ARGB8888;
dri_components = __DRI_IMAGE_COMPONENTS_RGBA;
break;
case __DRI_IMAGE_FOURCC_XRGB8888:
format = __DRI_IMAGE_FORMAT_XRGB8888;
dri_components = __DRI_IMAGE_COMPONENTS_RGB;
break;
case __DRI_IMAGE_FOURCC_ABGR8888:
format = __DRI_IMAGE_FORMAT_ABGR8888;
dri_components = __DRI_IMAGE_COMPONENTS_RGBA;
break;
case __DRI_IMAGE_FOURCC_XBGR8888:
format = __DRI_IMAGE_FORMAT_XBGR8888;
dri_components = __DRI_IMAGE_COMPONENTS_RGB;
break;
default:
return NULL;
}
/* Strides are in bytes not pixels. */
stride = strides[0] /4;
img = dri2_create_image_from_name(screen, width, height, format,
names[0], stride, loaderPrivate);
if (img == NULL)
return NULL;
img->dri_components = dri_components;
return img;
}
static __DRIimage *
dri2_from_planar(__DRIimage *image, int plane, void *loaderPrivate)
{
__DRIimage *img;
if (plane != 0)
return NULL;
if (image->dri_components == 0)
return NULL;
img = dri2_dup_image(image, loaderPrivate);
if (img == NULL)
return NULL;
/* set this to 0 for sub images. */
img->dri_components = 0;
return img;
}
static void
dri2_destroy_image(__DRIimage *img)
{
@@ -657,7 +735,7 @@ dri2_destroy_image(__DRIimage *img)
}
static struct __DRIimageExtensionRec dri2ImageExtension = {
{ __DRI_IMAGE, 4 },
{ __DRI_IMAGE, 5 },
dri2_create_image_from_name,
dri2_create_image_from_renderbuffer,
dri2_destroy_image,
@@ -665,6 +743,8 @@ static struct __DRIimageExtensionRec dri2ImageExtension = {
dri2_query_image,
dri2_dup_image,
dri2_validate_usage,
dri2_from_names,
dri2_from_planar,
};
/*

View File

@@ -1,7 +1,7 @@
TOP = ../../../..
include $(TOP)/configs/current
LIBNAME = modesetting_drv.so
LIBNAME = i915_drv.so
C_SOURCES = \
intel_target.c \

View File

@@ -52,7 +52,7 @@ static PciChipsets intel_xorg_pci_devices[] = {
};
static XF86ModuleVersionInfo intel_xorg_version = {
"modesetting",
"i915",
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,

View File

@@ -214,9 +214,10 @@ int radeon_get_reloc(struct radeon_cs_context *csc, struct radeon_bo *bo)
unsigned hash = bo->handle & (sizeof(csc->is_handle_added)-1);
if (csc->is_handle_added[hash]) {
reloc = csc->relocs_hashlist[hash];
i = csc->reloc_indices_hashlist[hash];
reloc = &csc->relocs[i];
if (reloc->handle == bo->handle) {
return csc->reloc_indices_hashlist[hash];
return i;
}
/* Hash collision, look for the BO in the list of relocs linearly. */
@@ -233,7 +234,6 @@ int radeon_get_reloc(struct radeon_cs_context *csc, struct radeon_bo *bo)
* AAAAAAAAAAABBBBBBBBBBBBBBCCCCCCCC
* will collide here: ^ and here: ^,
* meaning that we should get very few collisions in the end. */
csc->relocs_hashlist[hash] = reloc;
csc->reloc_indices_hashlist[hash] = i;
/*printf("write_reloc collision, hash: %i, handle: %i\n", hash, bo->handle);*/
return i;
@@ -257,10 +257,11 @@ static unsigned radeon_add_reloc(struct radeon_cs_context *csc,
enum radeon_bo_domain wd = usage & RADEON_USAGE_WRITE ? domains : 0;
if (csc->is_handle_added[hash]) {
reloc = csc->relocs_hashlist[hash];
i = csc->reloc_indices_hashlist[hash];
reloc = &csc->relocs[i];
if (reloc->handle == bo->handle) {
update_reloc_domains(reloc, rd, wd, added_domains);
return csc->reloc_indices_hashlist[hash];
return i;
}
/* Hash collision, look for the BO in the list of relocs linearly. */
@@ -270,7 +271,6 @@ static unsigned radeon_add_reloc(struct radeon_cs_context *csc,
if (reloc->handle == bo->handle) {
update_reloc_domains(reloc, rd, wd, added_domains);
csc->relocs_hashlist[hash] = reloc;
csc->reloc_indices_hashlist[hash] = i;
/*printf("write_reloc collision, hash: %i, handle: %i\n", hash, bo->handle);*/
return i;
@@ -303,7 +303,6 @@ static unsigned radeon_add_reloc(struct radeon_cs_context *csc,
reloc->flags = 0;
csc->is_handle_added[hash] = TRUE;
csc->relocs_hashlist[hash] = reloc;
csc->reloc_indices_hashlist[hash] = csc->crelocs;
csc->chunks[1].length_dw += RELOC_DWORDS;

View File

@@ -48,7 +48,6 @@ struct radeon_cs_context {
/* 0 = BO not added, 1 = BO added */
char is_handle_added[256];
struct drm_radeon_cs_reloc *relocs_hashlist[256];
unsigned reloc_indices_hashlist[256];
unsigned used_vram;

View File

@@ -303,6 +303,9 @@ static boolean do_winsys_init(struct radeon_drm_winsys *ws)
&ws->info.r600_ib_vm_max_size))
ws->info.r600_virtual_address = FALSE;
}
/* Remove this line once the virtual address space feature is fixed. */
if (ws->gen == R600 && !debug_get_bool_option("RADEON_VA", FALSE))
ws->info.r600_virtual_address = FALSE;
}
/* Get max pipes, this is only needed for compute shaders. All evergreen+

View File

@@ -363,7 +363,7 @@ gbm_dri_bo_import(struct gbm_device *gbm,
struct gbm_dri_bo *bo;
__DRIimage *image;
unsigned dri_use = 0;
int dri_format, width, height, gbm_format, stride, cpp, offset;
int gbm_format;
/* Required for query image WIDTH & HEIGHT */
if (dri->image->base.version < 4)
@@ -376,20 +376,15 @@ gbm_dri_bo_import(struct gbm_device *gbm,
struct wl_drm_buffer *wb = (struct wl_drm_buffer *) buffer;
image = wb->driver_buffer;
stride = wb->stride[0];
offset = wb->offset[0];
cpp = 4;
switch (wb->format) {
case WL_DRM_FORMAT_XRGB8888:
dri_format = __DRI_IMAGE_FORMAT_XRGB8888;
gbm_format = GBM_FORMAT_XRGB8888;
break;
case WL_DRM_FORMAT_ARGB8888:
dri_format = __DRI_IMAGE_FORMAT_ARGB8888;
gbm_format = GBM_FORMAT_ARGB8888;
break;
case WL_DRM_FORMAT_YUYV:
dri_format = __DRI_IMAGE_FORMAT_ARGB8888;
gbm_format = GBM_FORMAT_YUYV;
break;
default:
@@ -401,15 +396,15 @@ gbm_dri_bo_import(struct gbm_device *gbm,
case GBM_BO_IMPORT_EGL_IMAGE:
{
int dri_format;
if (dri->lookup_image == NULL)
return NULL;
image = dri->lookup_image(dri->screen, buffer, dri->lookup_user_data);
dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_FORMAT, &dri_format);
gbm_format = gbm_dri_to_gbm_format(dri_format);
dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, &stride);
offset = 0;
cpp = 4;
if (gbm_format == 0)
return NULL;
break;
}
@@ -422,13 +417,7 @@ gbm_dri_bo_import(struct gbm_device *gbm,
if (bo == NULL)
return NULL;
dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_WIDTH, &width);
dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_HEIGHT, &height);
bo->image = dri->image->createSubImage(image,
width, height, dri_format,
offset, stride / cpp, NULL);
bo->image = dri->image->dupImage(image, NULL);
if (usage & GBM_BO_USE_SCANOUT)
dri_use |= __DRI_IMAGE_USE_SCANOUT;
@@ -441,10 +430,14 @@ gbm_dri_bo_import(struct gbm_device *gbm,
}
bo->base.base.gbm = gbm;
bo->base.base.width = width;
bo->base.base.height = height;
bo->base.base.stride = stride;
bo->base.base.format = gbm_format;
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_WIDTH,
(int*)&bo->base.base.width);
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HEIGHT,
(int*)&bo->base.base.height);
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_STRIDE,
(int*)&bo->base.base.stride);
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HANDLE,
&bo->base.base.handle.s32);

View File

@@ -23,7 +23,7 @@
# builtin_compiler is built before libglsl to generate builtin_function.cpp for libglsl.
# For this to work, a dummy version of builtin_function.cpp, builtin_stubs.cpp, is used.
AM_CFLAGS = \
AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mesa/ \
@@ -31,8 +31,8 @@ AM_CFLAGS = \
$(DEFINES) \
$(LIBRARY_DEFINES) \
$(API_DEFINES)
AM_CXXFLAGS = $(AM_CFLAGS)
AM_CFLAGS = $(VISIBILITY_CFLAGS)
AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c

View File

@@ -17,7 +17,7 @@ env.Prepend(CPPPATH = [
# Make glcpp-parse.h and glsl_parser.h reachable from the include path.
env.Append(CPPPATH = [Dir('.').abspath, Dir('glcpp').abspath])
env.Append(YACCFLAGS = '-d')
env.Append(YACCFLAGS = '-d -p "glcpp_parser_"')
parser_env = env.Clone()
parser_env.Append(YACCFLAGS = [

View File

@@ -2086,9 +2086,24 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
} else {
var->location = qual->location;
}
if (qual->flags.q.explicit_index) {
var->explicit_index = true;
var->index = qual->index;
/* From the GLSL 4.30 specification, section 4.4.2 (Output
* Layout Qualifiers):
*
* "It is also a compile-time error if a fragment shader
* sets a layout index to less than 0 or greater than 1."
*
* Older specifications don't mandate a behavior; we take
* this as a clarification and always generate the error.
*/
if (qual->index < 0 || qual->index > 1) {
_mesa_glsl_error(loc, state,
"explicit index may only be 0 or 1\n");
} else {
var->explicit_index = true;
var->index = qual->index;
}
}
}
} else if (qual->flags.q.explicit_index) {

View File

@@ -31,7 +31,7 @@ AM_CFLAGS = \
$(LIBRARY_DEFINES) \
$(API_DEFINES)
AM_YFLAGS = -v -d
AM_YFLAGS = -v -d -p "glcpp_parser_"
AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c
noinst_LTLIBRARIES = libglcpp.la

View File

@@ -133,8 +133,6 @@ _glcpp_parser_skip_stack_change_if (glcpp_parser_t *parser, YYLTYPE *loc,
static void
_glcpp_parser_skip_stack_pop (glcpp_parser_t *parser, YYLTYPE *loc);
#define yylex glcpp_parser_lex
static int
glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser);
@@ -1197,12 +1195,6 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api)
return parser;
}
int
glcpp_parser_parse (glcpp_parser_t *parser)
{
return yyparse (parser);
}
void
glcpp_parser_destroy (glcpp_parser_t *parser)
{

View File

@@ -111,7 +111,7 @@ main (int argc, char *argv[])
if (shader == NULL)
return 1;
ret = preprocess(ctx, &shader, &info_log, NULL, API_OPENGL);
ret = glcpp_preprocess(ctx, &shader, &info_log, NULL, API_OPENGL);
printf("%s", shader);
fprintf(stderr, "%s", info_log);

View File

@@ -196,7 +196,7 @@ void
glcpp_parser_destroy (glcpp_parser_t *parser);
int
preprocess(void *ralloc_ctx, const char **shader, char **info_log,
glcpp_preprocess(void *ralloc_ctx, const char **shader, char **info_log,
const struct gl_extensions *extensions, int api);
/* Functions for writing to the info log */

View File

@@ -150,7 +150,7 @@ remove_line_continuations(glcpp_parser_t *ctx, const char *shader)
}
int
preprocess(void *ralloc_ctx, const char **shader, char **info_log,
glcpp_preprocess(void *ralloc_ctx, const char **shader, char **info_log,
const struct gl_extensions *extensions, int api)
{
int errors;

View File

@@ -296,7 +296,7 @@ _mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target);
extern "C" {
#endif
extern int preprocess(void *ctx, const char **shader, char **info_log,
extern int glcpp_preprocess(void *ctx, const char **shader, char **info_log,
const struct gl_extensions *extensions, int api);
extern void _mesa_destroy_shader_compiler(void);

View File

@@ -144,7 +144,7 @@ compile_shader(struct gl_context *ctx, struct gl_shader *shader)
new(shader) _mesa_glsl_parse_state(ctx, shader->Type, shader);
const char *source = shader->Source;
state->error = preprocess(state, &source, &state->info_log,
state->error = glcpp_preprocess(state, &source, &state->info_log,
state->extensions, ctx->API) != 0;
if (!state->error) {

View File

@@ -216,7 +216,7 @@ int test_optpass(int argc, char **argv)
} else {
shader->Source = input.c_str();
const char *source = shader->Source;
state->error = preprocess(state, &source, &state->info_log,
state->error = glcpp_preprocess(state, &source, &state->info_log,
state->extensions, ctx->API) != 0;
if (!state->error) {

View File

@@ -24,12 +24,14 @@ uniform_initializer_test_SOURCES = \
copy_constant_to_storage_tests.cpp \
set_uniform_initializer_tests.cpp \
uniform_initializer_utils.cpp
uniform_initializer_test_CFLAGS = \
$(PTHREAD_CFLAGS)
uniform_initializer_test_LDADD = \
$(top_builddir)/src/gtest/libgtest.la \
$(top_builddir)/src/glsl/libglsl.la \
$(top_builddir)/src/mesa/libmesa.la \
-lpthread
$(PTHREAD_LIBS)
ralloc_test_SOURCES = ralloc_test.cpp $(top_builddir)/src/glsl/ralloc.c
ralloc_test_LDADD = $(top_builddir)/src/gtest/libgtest.la -lpthread
ralloc_test_CFLAGS = $(PTHREAD_CFLAGS)
ralloc_test_LDADD = $(top_builddir)/src/gtest/libgtest.la $(PTHREAD_LIBS)

1
src/glu/.gitignore vendored
View File

@@ -1 +0,0 @@
exptmp

View File

@@ -1,40 +0,0 @@
# src/glu/Makefile
TOP = ../..
include $(TOP)/configs/current
SUBDIRS = sgi
default: $(TOP)/configs/current
@for dir in $(SUBDIRS) ; do \
(cd $$dir && $(MAKE)) || exit 1 ; \
done
# GLU pkg-config file
pcedit = sed \
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
-e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
-e 's,@GLU_PC_REQ@,$(GLU_PC_REQ),' \
-e 's,@GLU_PC_REQ_PRIV@,$(GLU_PC_REQ_PRIV),' \
-e 's,@GLU_PC_LIB_PRIV@,$(GLU_PC_LIB_PRIV),' \
-e 's,@GLU_PC_CFLAGS@,$(GLU_PC_CFLAGS),' \
-e 's,@GLU_LIB@,$(GLU_LIB),'
glu.pc: glu.pc.in
$(pcedit) $< > $@
install: glu.pc
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
$(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLU_LIB_GLOB) $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -m 644 glu.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
clean:
-@for dir in $(SUBDIRS) ; do \
(cd $$dir && $(MAKE) clean) ; \
done
-rm -f *.pc

View File

@@ -1,13 +0,0 @@
prefix=@INSTALL_DIR@
exec_prefix=${prefix}
libdir=@INSTALL_LIB_DIR@
includedir=@INSTALL_INC_DIR@
Name: glu
Description: Mesa OpenGL Utility library
Requires: @GLU_PC_REQ@
Requires.private: @GLU_PC_REQ_PRIV@
Version: @VERSION@
Libs: -L${libdir} -l@GLU_LIB@
Libs.private: @GLU_PC_LIB_PRIV@
Cflags: -I${includedir} @GLU_PC_CFLAGS@

View File

@@ -1 +0,0 @@
exptmp

View File

@@ -1,144 +0,0 @@
# src/glu/sgi/Makefile
.SUFFIXES : .cc
TOP = ../../..
include $(TOP)/configs/current
GLU_MAJOR = 1
GLU_MINOR = 3
GLU_TINY = 0$(MESA_MAJOR)$(MESA_MINOR)0$(MESA_TINY)
INCDIRS = -I$(TOP)/include -Iinclude -Iinternals -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess
C_SOURCES = \
libutil/error.c \
libutil/glue.c \
libutil/mipmap.c \
libutil/project.c \
libutil/quad.c \
libutil/registry.c \
libtess/dict.c \
libtess/geom.c \
libtess/memalloc.c \
libtess/mesh.c \
libtess/normal.c \
libtess/priorityq.c \
libtess/render.c \
libtess/sweep.c \
libtess/tess.c \
libtess/tessmono.c
CC_SOURCES = \
libnurbs/interface/bezierEval.cc \
libnurbs/interface/bezierPatch.cc \
libnurbs/interface/bezierPatchMesh.cc \
libnurbs/interface/glcurveval.cc \
libnurbs/interface/glinterface.cc \
libnurbs/interface/glrenderer.cc \
libnurbs/interface/glsurfeval.cc \
libnurbs/interface/incurveeval.cc \
libnurbs/interface/insurfeval.cc \
libnurbs/internals/arc.cc \
libnurbs/internals/arcsorter.cc \
libnurbs/internals/arctess.cc \
libnurbs/internals/backend.cc \
libnurbs/internals/basiccrveval.cc \
libnurbs/internals/basicsurfeval.cc \
libnurbs/internals/bin.cc \
libnurbs/internals/bufpool.cc \
libnurbs/internals/cachingeval.cc \
libnurbs/internals/ccw.cc \
libnurbs/internals/coveandtiler.cc \
libnurbs/internals/curve.cc \
libnurbs/internals/curvelist.cc \
libnurbs/internals/curvesub.cc \
libnurbs/internals/dataTransform.cc \
libnurbs/internals/displaylist.cc \
libnurbs/internals/flist.cc \
libnurbs/internals/flistsorter.cc \
libnurbs/internals/hull.cc \
libnurbs/internals/intersect.cc \
libnurbs/internals/knotvector.cc \
libnurbs/internals/mapdesc.cc \
libnurbs/internals/mapdescv.cc \
libnurbs/internals/maplist.cc \
libnurbs/internals/mesher.cc \
libnurbs/internals/monoTriangulationBackend.cc \
libnurbs/internals/monotonizer.cc \
libnurbs/internals/mycode.cc \
libnurbs/internals/nurbsinterfac.cc \
libnurbs/internals/nurbstess.cc \
libnurbs/internals/patch.cc \
libnurbs/internals/patchlist.cc \
libnurbs/internals/quilt.cc \
libnurbs/internals/reader.cc \
libnurbs/internals/renderhints.cc \
libnurbs/internals/slicer.cc \
libnurbs/internals/sorter.cc \
libnurbs/internals/splitarcs.cc \
libnurbs/internals/subdivider.cc \
libnurbs/internals/tobezier.cc \
libnurbs/internals/trimline.cc \
libnurbs/internals/trimregion.cc \
libnurbs/internals/trimvertpool.cc \
libnurbs/internals/uarray.cc \
libnurbs/internals/varray.cc \
libnurbs/nurbtess/directedLine.cc \
libnurbs/nurbtess/gridWrap.cc \
libnurbs/nurbtess/monoChain.cc \
libnurbs/nurbtess/monoPolyPart.cc \
libnurbs/nurbtess/monoTriangulation.cc \
libnurbs/nurbtess/partitionX.cc \
libnurbs/nurbtess/partitionY.cc \
libnurbs/nurbtess/polyDBG.cc \
libnurbs/nurbtess/polyUtil.cc \
libnurbs/nurbtess/primitiveStream.cc \
libnurbs/nurbtess/quicksort.cc \
libnurbs/nurbtess/rectBlock.cc \
libnurbs/nurbtess/sampleComp.cc \
libnurbs/nurbtess/sampleCompBot.cc \
libnurbs/nurbtess/sampleCompRight.cc \
libnurbs/nurbtess/sampleCompTop.cc \
libnurbs/nurbtess/sampleMonoPoly.cc \
libnurbs/nurbtess/sampledLine.cc \
libnurbs/nurbtess/searchTree.cc
SOURCES = $(C_SOURCES) $(CC_SOURCES)
C_OBJECTS = $(C_SOURCES:.c=.o)
CC_OBJECTS = $(CC_SOURCES:.cc=.o)
OBJECTS = $(C_OBJECTS) $(CC_OBJECTS)
##### RULES #####
.c.o:
$(CC) -c $(INCDIRS) $(CFLAGS) -DNDEBUG -DLIBRARYBUILD $< -o $@
.cc.o:
$(CXX) -c $(INCDIRS) $(CXXFLAGS) -DNDEBUG -DLIBRARYBUILD $< -o $@
##### TARGETS #####
default:
$(MAKE) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME)
$(TOP)/$(LIB_DIR):
-mkdir $(TOP)/$(LIB_DIR)
# Make the library:
$(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME): $(OBJECTS)
$(MKLIB) -o $(GLU_LIB) -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
-major $(GLU_MAJOR) -minor $(GLU_MINOR) -patch $(GLU_TINY) \
-cplusplus $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
-exports glu.exports -id $(INSTALL_LIB_DIR)/lib$(GLU_LIB).$(GLU_MAJOR).dylib \
$(GLU_LIB_DEPS) $(OBJECTS)
clean:
-rm -f *.o */*.o */*/*.o
-rm -f *.lo */*.lo */*/*.lo
-rm -f *.la */*.la */*/*.la

View File

@@ -1,143 +0,0 @@
Import('*')
env = env.Clone()
env.Prepend(CPPPATH = [
'include',
'internals',
'libnurbs/internals',
'libnurbs/interface',
'libnurbs/nurbtess',
])
env.Prepend(CPPDEFINES = [
'LIBRARYBUILD',
'RESOLVE_3D_TEXTURE_SUPPORT',
])
sources = [
'libutil/error.c',
'libutil/glue.c',
'libutil/mipmap.c',
'libutil/project.c',
'libutil/quad.c',
'libutil/registry.c',
'libtess/dict.c',
'libtess/geom.c',
'libtess/memalloc.c',
'libtess/mesh.c',
'libtess/normal.c',
'libtess/priorityq.c',
'libtess/render.c',
'libtess/sweep.c',
'libtess/tess.c',
'libtess/tessmono.c',
'libnurbs/interface/bezierEval.cc',
'libnurbs/interface/bezierPatch.cc',
'libnurbs/interface/bezierPatchMesh.cc',
'libnurbs/interface/glcurveval.cc',
'libnurbs/interface/glinterface.cc',
'libnurbs/interface/glrenderer.cc',
'libnurbs/interface/glsurfeval.cc',
'libnurbs/interface/incurveeval.cc',
'libnurbs/interface/insurfeval.cc',
'libnurbs/internals/arc.cc',
'libnurbs/internals/arcsorter.cc',
'libnurbs/internals/arctess.cc',
'libnurbs/internals/backend.cc',
'libnurbs/internals/basiccrveval.cc',
'libnurbs/internals/basicsurfeval.cc',
'libnurbs/internals/bin.cc',
'libnurbs/internals/bufpool.cc',
'libnurbs/internals/cachingeval.cc',
'libnurbs/internals/ccw.cc',
'libnurbs/internals/coveandtiler.cc',
'libnurbs/internals/curve.cc',
'libnurbs/internals/curvelist.cc',
'libnurbs/internals/curvesub.cc',
'libnurbs/internals/dataTransform.cc',
'libnurbs/internals/displaylist.cc',
'libnurbs/internals/flist.cc',
'libnurbs/internals/flistsorter.cc',
'libnurbs/internals/hull.cc',
'libnurbs/internals/intersect.cc',
'libnurbs/internals/knotvector.cc',
'libnurbs/internals/mapdesc.cc',
'libnurbs/internals/mapdescv.cc',
'libnurbs/internals/maplist.cc',
'libnurbs/internals/mesher.cc',
'libnurbs/internals/monoTriangulationBackend.cc',
'libnurbs/internals/monotonizer.cc',
'libnurbs/internals/mycode.cc',
'libnurbs/internals/nurbsinterfac.cc',
'libnurbs/internals/nurbstess.cc',
'libnurbs/internals/patch.cc',
'libnurbs/internals/patchlist.cc',
'libnurbs/internals/quilt.cc',
'libnurbs/internals/reader.cc',
'libnurbs/internals/renderhints.cc',
'libnurbs/internals/slicer.cc',
'libnurbs/internals/sorter.cc',
'libnurbs/internals/splitarcs.cc',
'libnurbs/internals/subdivider.cc',
'libnurbs/internals/tobezier.cc',
'libnurbs/internals/trimline.cc',
'libnurbs/internals/trimregion.cc',
'libnurbs/internals/trimvertpool.cc',
'libnurbs/internals/uarray.cc',
'libnurbs/internals/varray.cc',
'libnurbs/nurbtess/directedLine.cc',
'libnurbs/nurbtess/gridWrap.cc',
'libnurbs/nurbtess/monoChain.cc',
'libnurbs/nurbtess/monoPolyPart.cc',
'libnurbs/nurbtess/monoTriangulation.cc',
'libnurbs/nurbtess/partitionX.cc',
'libnurbs/nurbtess/partitionY.cc',
'libnurbs/nurbtess/polyDBG.cc',
'libnurbs/nurbtess/polyUtil.cc',
'libnurbs/nurbtess/primitiveStream.cc',
'libnurbs/nurbtess/quicksort.cc',
'libnurbs/nurbtess/rectBlock.cc',
'libnurbs/nurbtess/sampleComp.cc',
'libnurbs/nurbtess/sampleCompBot.cc',
'libnurbs/nurbtess/sampleCompRight.cc',
'libnurbs/nurbtess/sampleCompTop.cc',
'libnurbs/nurbtess/sampleMonoPoly.cc',
'libnurbs/nurbtess/sampledLine.cc',
'libnurbs/nurbtess/searchTree.cc',
]
if env['platform'] == 'windows':
# -D_OPENGL32_ -Iinclude -DBUILD_GL32
env.PrependUnique(LIBS = [
'gdi32',
'user32',
'opengl32',
])
target = 'glu32'
sources += ['glu.def']
else:
env.PrependUnique(LIBS = [
'GL',
])
target = 'glu'
if env['platform'] == 'haiku':
glu = env.StaticLibrary(
target = target,
source = sources
)
else:
glu = env.SharedLibrary(
target = target,
source = sources
)
env.Alias('glu', env.InstallSharedLibrary(glu, version=(1, 3, 0)))
if env['platform'] == 'windows':
glu = env.FindIxes(glu, 'LIBPREFIX', 'LIBSUFFIX')
else:
glu = env.FindIxes(glu, 'SHLIBPREFIX', 'SHLIBSUFFIX')
Export('glu')

View File

@@ -1,4 +0,0 @@
/*
* This file contains nothing. It's just there so there's at least a single
* source file for libGLU.la in this directory.
*/

View File

@@ -1,88 +0,0 @@
;DESCRIPTION 'Mesa GLU (OpenGL work-alike) for Win32'
VERSION 5.1
;
; Module definition file for GLU (GLU32.DLL)
;
; Note: The GLU functions use the STDCALL
; function calling convention. Microsoft's
; GLU32 uses this convention and so must the
; Mesa GLU32 so that the Mesa DLL can be used
; as a drop-in replacement.
;
; The linker exports STDCALL entry points with
; 'decorated' names; e.g., _glBegin@0, where the
; trailing number is the number of bytes of
; parameter data pushed onto the stack. The
; callee is responsible for popping this data
; off the stack, usually via a RETF n instruction.
;
; However, the Microsoft GLU32.DLL does not export
; the decorated names, even though the calling convention
; is STDCALL. So, this module definition file is
; needed to force the Mesa GLU32.DLL to export the
; symbols in the same manner as the Microsoft DLL.
; Were it not for this problem, this file would not
; be needed (for the glu* functions) since the entry
; points are compiled with dllexport declspec.
;
EXPORTS
gluBeginCurve
gluBeginPolygon
gluBeginSurface
gluBeginTrim
gluBuild1DMipmapLevels
gluBuild1DMipmaps
gluBuild2DMipmapLevels
gluBuild2DMipmaps
gluBuild3DMipmapLevels
gluBuild3DMipmaps
gluCheckExtension
gluCylinder
gluDeleteNurbsRenderer
gluDeleteQuadric
gluDeleteTess
gluDisk
gluEndCurve
gluEndPolygon
gluEndSurface
gluEndTrim
gluErrorString
gluGetNurbsProperty
gluGetString
gluGetTessProperty
gluLoadSamplingMatrices
gluLookAt
gluNewNurbsRenderer
gluNewQuadric
gluNewTess
gluNextContour
gluNurbsCallback
gluNurbsCallbackData
gluNurbsCallbackDataEXT
gluNurbsCurve
gluNurbsProperty
gluNurbsSurface
gluOrtho2D
gluPartialDisk
gluPerspective
gluPickMatrix
gluProject
gluPwlCurve
gluQuadricCallback
gluQuadricDrawStyle
gluQuadricNormals
gluQuadricOrientation
gluQuadricTexture
gluScaleImage
gluSphere
gluTessBeginContour
gluTessBeginPolygon
gluTessCallback
gluTessEndContour
gluTessEndPolygon
gluTessNormal
gluTessProperty
gluTessVertex
gluUnProject
gluUnProject4

View File

@@ -1,118 +0,0 @@
gluBeginCurve
gluBeginPolygon
gluBeginSurface
gluBeginTrim
gluBuild1DMipmapLevels
gluBuild1DMipmaps
gluBuild2DMipmapLevels
gluBuild2DMipmaps
gluBuild3DMipmapLevels
gluBuild3DMipmaps
gluCheckExtension
gluCylinder
gluDeleteNurbsRenderer
gluDeleteQuadric
gluDeleteTess
gluDisk
gluEndCurve
gluEndPolygon
gluEndSurface
gluEndTrim
gluErrorString
gluGetNurbsProperty
gluGetString
gluGetTessProperty
gluLoadSamplingMatrices
gluLookAt
gluNewNurbsRenderer
gluNewQuadric
gluNewTess
gluNextContour
gluNurbsCallback
gluNurbsCallbackData
gluNurbsCallbackDataEXT
gluNurbsCurve
gluNurbsProperty
gluNurbsSurface
gluOrtho2D
gluPartialDisk
gluPerspective
gluPickMatrix
gluProject
gluPwlCurve
gluQuadricCallback
gluQuadricDrawStyle
gluQuadricNormals
gluQuadricOrientation
gluQuadricTexture
gluScaleImage
gluSphere
gluTessBeginContour
gluTessBeginPolygon
gluTessCallback
gluTessEndContour
gluTessEndPolygon
gluTessNormal
gluTessProperty
gluTessVertex
gluUnProject
gluUnProject4
mgluBeginCurve
mgluBeginPolygon
mgluBeginSurface
mgluBeginTrim
mgluBuild1DMipmapLevels
mgluBuild1DMipmaps
mgluBuild2DMipmapLevels
mgluBuild2DMipmaps
mgluBuild3DMipmapLevels
mgluBuild3DMipmaps
mgluCheckExtension
mgluCylinder
mgluDeleteNurbsRenderer
mgluDeleteQuadric
mgluDeleteTess
mgluDisk
mgluEndCurve
mgluEndPolygon
mgluEndSurface
mgluEndTrim
mgluErrorString
mgluGetNurbsProperty
mgluGetString
mgluGetTessProperty
mgluLoadSamplingMatrices
mgluLookAt
mgluNewNurbsRenderer
mgluNewQuadric
mgluNewTess
mgluNextContour
mgluNurbsCallback
mgluNurbsCallbackData
mgluNurbsCallbackDataEXT
mgluNurbsCurve
mgluNurbsProperty
mgluNurbsSurface
mgluOrtho2D
mgluPartialDisk
mgluPerspective
mgluPickMatrix
mgluProject
mgluPwlCurve
mgluQuadricCallback
mgluQuadricDrawStyle
mgluQuadricNormals
mgluQuadricOrientation
mgluQuadricTexture
mgluScaleImage
mgluSphere
mgluTessBeginContour
mgluTessBeginPolygon
mgluTessCallback
mgluTessEndContour
mgluTessEndPolygon
mgluTessNormal
mgluTessProperty
mgluTessVertex
mgluUnProject
mgluUnProject4

View File

@@ -1,59 +0,0 @@
_*gluBeginCurve
_*gluBeginPolygon
_*gluBeginSurface
_*gluBeginTrim
_*gluBuild1DMipmapLevels
_*gluBuild1DMipmaps
_*gluBuild2DMipmapLevels
_*gluBuild2DMipmaps
_*gluBuild3DMipmapLevels
_*gluBuild3DMipmaps
_*gluCheckExtension
_*gluCylinder
_*gluDeleteNurbsRenderer
_*gluDeleteQuadric
_*gluDeleteTess
_*gluDisk
_*gluEndCurve
_*gluEndPolygon
_*gluEndSurface
_*gluEndTrim
_*gluErrorString
_*gluGetNurbsProperty
_*gluGetString
_*gluGetTessProperty
_*gluLoadSamplingMatrices
_*gluLookAt
_*gluNewNurbsRenderer
_*gluNewQuadric
_*gluNewTess
_*gluNextContour
_*gluNurbsCallback
_*gluNurbsCallbackData
_*gluNurbsCallbackDataEXT
_*gluNurbsCurve
_*gluNurbsProperty
_*gluNurbsSurface
_*gluOrtho2D
_*gluPartialDisk
_*gluPerspective
_*gluPickMatrix
_*gluProject
_*gluPwlCurve
_*gluQuadricCallback
_*gluQuadricDrawStyle
_*gluQuadricNormals
_*gluQuadricOrientation
_*gluQuadricTexture
_*gluScaleImage
_*gluSphere
_*gluTessBeginContour
_*gluTessBeginPolygon
_*gluTessCallback
_*gluTessEndContour
_*gluTessEndPolygon
_*gluTessNormal
_*gluTessProperty
_*gluTessVertex
_*gluUnProject
_*gluUnProject4

View File

@@ -1,86 +0,0 @@
/*
** gluos.h - operating system dependencies for GLU
**
*/
#ifdef __VMS
#ifdef __cplusplus
#pragma message disable nocordel
#pragma message disable codeunreachable
#pragma message disable codcauunr
#endif
#endif
#ifdef __WATCOMC__
/* Disable *lots* of warnings to get a clean build. I can't be bothered fixing the
* code at the moment, as it is pretty ugly.
*/
#pragma warning 7 10
#pragma warning 13 10
#pragma warning 14 10
#pragma warning 367 10
#pragma warning 379 10
#pragma warning 726 10
#pragma warning 836 10
#endif
#ifdef BUILD_FOR_SNAP
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>
#elif defined(_WIN32)
#include <stdlib.h> /* For _MAX_PATH definition */
#include <stdio.h>
#include <malloc.h>
#define WIN32_LEAN_AND_MEAN
#define NOGDI
#define NOIME
#define NOMINMAX
#ifdef __MINGW64_VERSION_MAJOR
#undef _WIN32_WINNT
#endif
#ifndef _WIN32_WINNT
/* XXX: Workaround a bug in mingw-w64's headers when NOGDI is set and
* _WIN32_WINNT >= 0x0600 */
#define _WIN32_WINNT 0x0400
#endif
#ifndef STRICT
#define STRICT 1
#endif
#include <windows.h>
/* Disable warnings */
#if defined(_MSC_VER)
#pragma warning(disable : 4101)
#pragma warning(disable : 4244)
#pragma warning(disable : 4761)
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1200 && _MSC_VER < 1300
#pragma comment(linker, "/OPT:NOWIN98")
#endif
#ifndef WINGDIAPI
#define WINGDIAPI
#endif
#elif defined(__OS2__)
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>
#define WINGDIAPI
#else
/* Disable Microsoft-specific keywords */
#define GLAPIENTRY
#define WINGDIAPI
#endif

View File

@@ -1,260 +0,0 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 1.1 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
** http://oss.sgi.com/projects/FreeB
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
** Window System(R) (Version 1.3), released October 19, 1998. This software
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
**
*/
/*
*/
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <math.h>
#include "bezierEval.h"
#ifdef __WATCOMC__
#pragma warning 14 10
#endif
#define TOLERANCE 0.0001
#ifndef MAX_ORDER
#define MAX_ORDER 16
#endif
#ifndef MAX_DIMENSION
#define MAX_DIMENSION 4
#endif
static void normalize(float vec[3]);
static void crossProduct(float x[3], float y[3], float ret[3]);
#if 0 // UNUSED
static void bezierCurveEvalfast(float u0, float u1, int order, float *ctlpoints, int stride, int dimension, float u, float retpoint[]);
#endif
static float binomialCoefficients[8][8] = {
{1,0,0,0,0,0,0,0},
{1,1,0,0,0,0,0,0},
{1,2,1,0,0,0,0,0},
{1,3,3,1,0,0,0,0},
{1,4,6,4,1,0,0,0},
{1,5,10,10,5,1,0,0},
{1,6,15,20,15,6,1,0},
{1,7,21,35,35,21,7,1}
};
void bezierCurveEval(float u0, float u1, int order, float *ctlpoints, int stride, int dimension, float u, float retpoint[])
{
float uprime = (u-u0)/(u1-u0);
float *ctlptr = ctlpoints;
float oneMinusX = 1.0f-uprime;
float XPower = 1.0f;
int i,k;
for(k=0; k<dimension; k++)
retpoint[k] = (*(ctlptr + k));
for(i=1; i<order; i++){
ctlptr += stride;
XPower *= uprime;
for(k=0; k<dimension; k++) {
retpoint[k] = retpoint[k]*oneMinusX + ctlptr[k]* binomialCoefficients[order-1][i] * XPower;
}
}
}
#if 0 // UNUSED
/*order = degree +1 >=1.
*/
void bezierCurveEvalfast(float u0, float u1, int order, float *ctlpoints, int stride, int dimension, float u, float retpoint[])
{
float uprime = (u-u0)/(u1-u0);
float buf[MAX_ORDER][MAX_ORDER][MAX_DIMENSION];
float* ctlptr = ctlpoints;
int r, i,j;
for(i=0; i<order; i++) {
for(j=0; j<dimension; j++)
buf[0][i][j] = ctlptr[j];
ctlptr += stride;
}
for(r=1; r<order; r++){
for(i=0; i<order-r; i++) {
for(j=0; j<dimension; j++)
buf[r][i][j] = (1-uprime)*buf[r-1][i][j] + uprime*buf[r-1][i+1][j];
}
}
for(j=0; j<dimension; j++)
retpoint[j] = buf[order-1][0][j];
}
#endif
/*order = degree +1 >=1.
*/
void bezierCurveEvalDer(float u0, float u1, int order, float *ctlpoints, int stride, int dimension, float u, float retDer[])
{
int i,k;
float width = u1-u0;
float *ctlptr = ctlpoints;
float buf[MAX_ORDER][MAX_DIMENSION];
if(order == 1){
for(k=0; k<dimension; k++)
retDer[k]=0;
}
for(i=0; i<order-1; i++){
for(k=0; k<dimension; k++) {
buf[i][k] = (ctlptr[stride+k] - ctlptr[k])*(order-1)/width;
}
ctlptr += stride;
}
bezierCurveEval(u0, u1, order-1, (float*) buf, MAX_DIMENSION, dimension, u, retDer);
}
void bezierCurveEvalDerGen(int der, float u0, float u1, int order, float *ctlpoints, int stride, int dimension, float u, float retDer[])
{
int i,k,r;
float *ctlptr = ctlpoints;
float width=u1-u0;
float buf[MAX_ORDER][MAX_ORDER][MAX_DIMENSION];
if(der<0) der=0;
for(i=0; i<order; i++){
for(k=0; k<dimension; k++){
buf[0][i][k] = ctlptr[k];
}
ctlptr += stride;
}
for(r=1; r<=der; r++){
for(i=0; i<order-r; i++){
for(k=0; k<dimension; k++){
buf[r][i][k] = (buf[r-1][i+1][k] - buf[r-1][i][k])*(order-r)/width;
}
}
}
bezierCurveEval(u0, u1, order-der, (float *) (buf[der]), MAX_DIMENSION, dimension, u, retDer);
}
/*the Bezier bivarite polynomial is:
* sum[i:0,uorder-1][j:0,vorder-1] { ctlpoints[i*ustride+j*vstride] * B(i)*B(j)
* where B(i) and B(j) are basis functions
*/
void bezierSurfEvalDerGen(int uder, int vder, float u0, float u1, int uorder, float v0, float v1, int vorder, int dimension, float *ctlpoints, int ustride, int vstride, float u, float v, float ret[])
{
int i;
float newPoints[MAX_ORDER][MAX_DIMENSION];
for(i=0; i<uorder; i++){
bezierCurveEvalDerGen(vder, v0, v1, vorder, ctlpoints+ustride*i, vstride, dimension, v, newPoints[i]);
}
bezierCurveEvalDerGen(uder, u0, u1, uorder, (float *) newPoints, MAX_DIMENSION, dimension, u, ret);
}
/*division by w is performed*/
void bezierSurfEval(float u0, float u1, int uorder, float v0, float v1, int vorder, int dimension, float *ctlpoints, int ustride, int vstride, float u, float v, float ret[])
{
bezierSurfEvalDerGen(0, 0, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, ret);
if(dimension == 4) /*homogeneous*/{
ret[0] /= ret[3];
ret[1] /= ret[3];
ret[2] /= ret[3];
}
}
void bezierSurfEvalNormal(float u0, float u1, int uorder, float v0, float v1, int vorder, int dimension, float *ctlpoints, int ustride, int vstride, float u, float v, float retNormal[])
{
float partialU[4];
float partialV[4];
assert(dimension>=3 && dimension <=4);
bezierSurfEvalDerGen(1,0, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, partialU);
bezierSurfEvalDerGen(0,1, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, partialV);
if(dimension == 3){/*inhomogeneous*/
crossProduct(partialU, partialV, retNormal);
normalize(retNormal);
return;
}
else { /*homogeneous*/
float val[4]; /*the point coordinates (without derivative)*/
float newPartialU[MAX_DIMENSION];
float newPartialV[MAX_DIMENSION];
int i;
bezierSurfEvalDerGen(0,0, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, val);
for(i=0; i<=2; i++){
newPartialU[i] = partialU[i] * val[3] - val[i] * partialU[3];
newPartialV[i] = partialV[i] * val[3] - val[i] * partialV[3];
}
crossProduct(newPartialU, newPartialV, retNormal);
normalize(retNormal);
}
}
/*if size is 0, then nothing is done*/
static void normalize(float vec[3])
{
float size = (float)sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]);
if(size < TOLERANCE)
{
#ifdef DEBUG
fprintf(stderr, "Warning: in oglBSpline.c normal is 0\n");
#endif
return;
}
else {
vec[0] = vec[0]/size;
vec[1] = vec[1]/size;
vec[2] = vec[2]/size;
}
}
static void crossProduct(float x[3], float y[3], float ret[3])
{
ret[0] = x[1]*y[2] - y[1]*x[2];
ret[1] = x[2]*y[0] - y[2]*x[0];
ret[2] = x[0]*y[1] - y[0]*x[1];
}

View File

@@ -1,48 +0,0 @@
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and
* either this permission notice or a reference to
* http://oss.sgi.com/projects/FreeB/
* 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
* SILICON GRAPHICS, INC. 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.
*
* Except as contained in this notice, the name of Silicon Graphics, Inc.
* shall not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization from
* Silicon Graphics, Inc.
*/
/*
*/
#ifndef _BEZIEREVAL_H
#define _BEZIEREVAL_H
void bezierCurveEval(float u0, float u1, int order, float *ctlpoints, int stride, int dimension, float u, float retpoint[]);
void bezierCurveEvalDer(float u0, float u1, int order, float *ctlpoints, int stride, int dimension, float u, float retDer[]);
void bezierCurveEvalDerGen(int der, float u0, float u1, int order, float *ctlpoints, int stride, int dimension, float u, float retDer[]);
void bezierSurfEvalDerGen(int uder, int vder, float u0, float u1, int uorder, float v0, float v1, int vorder, int dimension, float *ctlpoints, int ustride, int vstride, float u, float v, float ret[]);
void bezierSurfEval(float u0, float u1, int uorder, float v0, float v1, int vorder, int dimension, float *ctlpoints, int ustride, int vstride, float u, float v, float ret[]);
void bezierSurfEvalNormal(float u0, float u1, int uorder, float v0, float v1, int vorder, int dimension, float *ctlpoints, int ustride, int vstride, float u, float v, float retNormal[]);
#endif

View File

@@ -1,206 +0,0 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 1.1 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
** http://oss.sgi.com/projects/FreeB
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
** Window System(R) (Version 1.3), released October 19, 1998. This software
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
**
*/
/*
*/
#include "gluos.h"
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <GL/glu.h> /*for drawing bzier patch*/
#include "bezierPatch.h"
#include "bezierEval.h"
/*
*allocate an instance of bezierPatch. The control points are unknown. But
*the space of this array is allocated with size of
* uorder*vorder*dimension
*
*/
bezierPatch* bezierPatchMake(float umin, float vmin, float umax, float vmax, int uorder, int vorder, int dimension)
{
bezierPatch* ret = (bezierPatch*) malloc(sizeof(bezierPatch));
assert(ret);
ret->umin = umin;
ret->vmin = vmin;
ret->umax = umax;
ret->vmax = vmax;
ret->uorder = uorder;
ret->vorder = vorder;
ret->dimension = dimension;
ret->ctlpoints = (float*) malloc(sizeof(float) * dimension * uorder * vorder);
assert(ret->ctlpoints);
ret->next = NULL;
return ret;
}
bezierPatch* bezierPatchMake2(float umin, float vmin, float umax, float vmax, int uorder, int vorder, int dimension, int ustride, int vstride, float* ctlpoints)
{
bezierPatch* ret = (bezierPatch*) malloc(sizeof(bezierPatch));
assert(ret);
ret->umin = umin;
ret->vmin = vmin;
ret->umax = umax;
ret->vmax = vmax;
ret->uorder = uorder;
ret->vorder = vorder;
ret->dimension = dimension;
ret->ctlpoints = (float*) malloc(sizeof(float) * dimension * uorder * vorder);
assert(ret->ctlpoints);
/*copy the control points there*/
int the_ustride = vorder * dimension;
int the_vstride = dimension;
for(int i=0; i<uorder; i++)
for(int j=0; j<vorder; j++)
for(int k=0; k<dimension; k++)
ret->ctlpoints[i * the_ustride + j*the_vstride+k] = ctlpoints[i*ustride+j*vstride+k];
ret->next = NULL;
return ret;
}
/*
*deallocate the space as allocated by Make
*/
void bezierPatchDelete(bezierPatch *b)
{
free(b->ctlpoints);
free(b);
}
/*delete the whole linked list
*/
void bezierPatchDeleteList(bezierPatch *b)
{
bezierPatch *temp;
while (b != NULL) {
temp = b;
b = b->next;
bezierPatchDelete(temp);
}
}
bezierPatch* bezierPatchInsert(bezierPatch *list, bezierPatch *b)
{
b->next = list;
return b;
}
/*print the data stored in this patch*/
void bezierPatchPrint(bezierPatch *b)
{
printf("bezierPatch:\n");
printf("umin,umax=(%f,%f), (vmin, vmax)=(%f,%f)\n", b->umin, b->umax, b->vmin, b->vmax);
printf("uorder=%i, vorder=%i\n", b->uorder, b->vorder);
printf("idmension = %i\n", b->dimension);
}
/*print the whole list*/
void bezierPatchPrintList(bezierPatch *list)
{
bezierPatch* temp;
for(temp=list; temp != NULL; temp = temp->next)
bezierPatchPrint(temp);
}
void bezierPatchEval(bezierPatch *b, float u, float v, float ret[])
{
if( u >= b->umin && u<= b->umax
&& v >= b->vmin && v<= b->vmax)
{
bezierSurfEval(b->umin, b->umax, b->uorder, b->vmin, b->vmax, b->vorder, b->dimension, b->ctlpoints, b->dimension * b->vorder, b->dimension, u, v, ret);
}
else if(b->next != NULL)
bezierPatchEval(b->next, u,v, ret);
else
bezierSurfEval(b->umin, b->umax, b->uorder, b->vmin, b->vmax, b->vorder, b->dimension, b->ctlpoints, b->dimension * b->vorder, b->dimension, u, v, ret);
}
/*the returned normal is normlized
*/
void bezierPatchEvalNormal(bezierPatch *b, float u, float v, float ret[])
{
bezierSurfEvalNormal(b->umin, b->umax, b->uorder, b->vmin, b->vmax, b->vorder, b->dimension, b->ctlpoints, b->dimension * b->vorder, b->dimension, u, v, ret);
if( u >= b->umin && u<= b->umax
&& v >= b->vmin && v<= b->vmax)
{
bezierSurfEvalNormal(b->umin, b->umax, b->uorder, b->vmin, b->vmax, b->vorder, b->dimension, b->ctlpoints, b->dimension * b->vorder, b->dimension, u, v, ret);
}
else if(b->next != NULL)
bezierPatchEvalNormal(b->next, u,v, ret);
else
bezierSurfEvalNormal(b->umin, b->umax, b->uorder, b->vmin, b->vmax, b->vorder, b->dimension, b->ctlpoints, b->dimension * b->vorder, b->dimension, u, v, ret);
}
void bezierPatchDraw(bezierPatch *bpatch, int u_reso, int v_reso)
{
if(bpatch->dimension == 3)
glMap2f(GL_MAP2_VERTEX_3, bpatch->umin, bpatch->umax, 3*bpatch->vorder, bpatch->uorder, bpatch->vmin, bpatch->vmax,3, bpatch->vorder, (GLfloat*) bpatch->ctlpoints);
else
glMap2f(GL_MAP2_VERTEX_4, bpatch->umin, bpatch->umax, 4*bpatch->vorder, bpatch->uorder, bpatch->vmin, bpatch->vmax,3, bpatch->vorder, (GLfloat*) bpatch->ctlpoints);
glMapGrid2f(u_reso, bpatch->umin, bpatch->umax,
v_reso, bpatch->vmin, bpatch->vmax);
glEvalMesh2(GL_LINE, 0, u_reso, 0, v_reso);
}
void bezierPatchListDraw(bezierPatch *list, int u_reso, int v_reso)
{
bezierPatch *temp;
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_MAP2_VERTEX_3);
glEnable(GL_AUTO_NORMAL);
glEnable(GL_NORMALIZE);
glColor3f(1,0,0);
#ifdef DEBUG
printf("mapmap\n");
#endif
for(temp = list; temp != NULL; temp = temp->next)
bezierPatchDraw(temp, u_reso, v_reso);
}

View File

@@ -1,104 +0,0 @@
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and
* either this permission notice or a reference to
* http://oss.sgi.com/projects/FreeB/
* 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
* SILICON GRAPHICS, INC. 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.
*
* Except as contained in this notice, the name of Silicon Graphics, Inc.
* shall not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization from
* Silicon Graphics, Inc.
*/
/*
*/
#ifndef _BEZIERPATCH_H
#define _BEZIERPATCH_H
typedef struct bezierPatch{
float umin, vmin, umax, vmax;
int uorder; /*order= degree + 1*/
int vorder;
/*
*the control points are stored in a one dimensional array.
*the surface is defined as:
* s(u,v) = sum_{i,j} P(i,j) * B_i(u) * B_j(v).
*where P(i,j) are the control points, B_i(.) are Bezier
*basis functions.
*Each control point can have dimension 3 or 4: (x,y,z,w).
*The components of P(i,j) are stored in a one dimensional
*array:
* ctlpoints[]
*in the order of:
* P[0,0], P[0,1], ..., P[0,vorder-1],
* P[1,0], P[1,1], ..., P[1,vorder-1],
* ...
* P[uorder-1,0], P[uorder-1,1], ..., P[uorder-1,vorder-1].
*/
int dimension;
float* ctlpoints;
/*
*in case we have to manage multiple bezierPatches.
*/
struct bezierPatch *next;
} bezierPatch;
#ifdef __cplusplus
extern "C" {
#endif
bezierPatch* bezierPatchMake(float umin, float vmin, float umax, float vmax, int urder, int vorder, int dimension);
bezierPatch* bezierPatchMake2(float umin, float vmin, float umax, float vmax, int urder, int vorder, int dimension, int ustride, int vstride, float *ctlpoints);
bezierPatch* bezierPatchInsert(bezierPatch *list, bezierPatch *b);
void bezierPatchDelete(bezierPatch *b);
void bezierPatchDeleteList(bezierPatch *b);
void bezierPatchPrint(bezierPatch *b);
void bezierPatchPrintList(bezierPatch *list);
void bezierPatchEval(bezierPatch *b, float u, float v, float ret[]);
void bezierPatchEvalNormal(bezierPatch *b, float u, float v, float retNormal[]);
void bezierPatchEval(bezierPatch *b, float u, float v, float ret[]);
void bezierPatchEvalNormal(bezierPatch *b, float u, float v, float ret[]);
void bezierPatchDraw(bezierPatch *bpatch, int u_reso, int v_reso);
void bezierPatchListDraw(bezierPatch *list, int u_reso, int v_reso);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,610 +0,0 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 1.1 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
** http://oss.sgi.com/projects/FreeB
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
** Window System(R) (Version 1.3), released October 19, 1998. This software
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
**
*/
/*
*/
#include "gluos.h"
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <GL/gl.h>
#include "bezierEval.h"
#include "bezierPatchMesh.h"
static int isDegenerate(float A[2], float B[2], float C[2]);
void drawStrips(float *vertex_array, float *normal_array, int *length_array, GLenum *type_array, int num_strips)
{
int i,j,k;
k=0;
/*k is the index of the first component of the current vertex*/
for(i=0; i<num_strips; i++)
{
glBegin(type_array[i]);
for(j=0; j<length_array[i]; j++)
{
glNormal3fv(normal_array+k);
glVertex3fv(vertex_array+k);
k += 3;
}
glEnd();
}
}
void bezierPatchMeshListDelDeg(bezierPatchMesh* list)
{
bezierPatchMesh* temp;
for(temp=list; temp != NULL; temp = temp->next)
{
bezierPatchMeshDelDeg(temp);
}
}
void bezierPatchMeshListDelete(bezierPatchMesh *list)
{
if(list == NULL) return;
bezierPatchMeshListDelete(list->next);
bezierPatchMeshDelete(list);
}
bezierPatchMesh* bezierPatchMeshListReverse(bezierPatchMesh* list)
{
bezierPatchMesh* ret=NULL;
bezierPatchMesh* temp;
bezierPatchMesh* nextone;
for(temp = list; temp != NULL; temp = nextone)
{
nextone = temp->next;
ret=bezierPatchMeshListInsert(ret, temp);
}
return ret;
}
/*maptype is either GL_MAP2_VERTEX_3 or GL_MAP2_VERTEX_4
*/
bezierPatchMesh *bezierPatchMeshMake(int maptype, float umin, float umax, int ustride, int uorder, float vmin, float vmax, int vstride, int vorder, float *ctlpoints, int size_UVarray, int size_length_array)
{
int i,j,k;
int dimension;
int the_ustride;
int the_vstride;
if(maptype == GL_MAP2_VERTEX_3) dimension = 3;
else if (maptype==GL_MAP2_VERTEX_4) dimension = 4;
else {
fprintf(stderr, "error in inMap2f, maptype=%i is wrong, maptype,map is invalid\n", maptype);
return NULL;
}
bezierPatchMesh *ret = (bezierPatchMesh*) malloc(sizeof(bezierPatchMesh));
assert(ret);
ret->bpatch_normal = NULL;
ret->bpatch_color = NULL;
ret->bpatch_texcoord = NULL;
ret->bpatch = bezierPatchMake(umin, vmin, umax, vmax, uorder, vorder, dimension);
/*copy the control points there*/
the_ustride = vorder * dimension;
the_vstride = dimension;
for(i=0; i<uorder; i++)
for(j=0; j<vorder; j++)
for(k=0; k<dimension; k++)
ret->bpatch->ctlpoints[i * the_ustride + j*the_vstride+k] = ctlpoints[i*ustride+j*vstride+k];
ret->size_UVarray = size_UVarray;
ret->size_length_array = size_length_array;
ret->UVarray = (float*) malloc(sizeof(float) * size_UVarray);
assert(ret->UVarray);
ret->length_array = (int *)malloc(sizeof(int) * size_length_array);
assert(ret->length_array);
ret->type_array = (GLenum *)malloc(sizeof(GLenum) * size_length_array);
assert(ret->type_array);
ret->index_UVarray = 0;
ret->index_length_array = 0;
ret->vertex_array = NULL;
ret->normal_array = NULL;
ret->color_array = NULL;
ret->texcoord_array = NULL;
ret->next = NULL;
return ret;
}
bezierPatchMesh *bezierPatchMeshMake2(int size_UVarray, int size_length_array)
{
bezierPatchMesh *ret = (bezierPatchMesh*) malloc(sizeof(bezierPatchMesh));
assert(ret);
ret->bpatch = NULL;
ret->bpatch_normal = NULL;
ret->bpatch_color = NULL;
ret->bpatch_texcoord = NULL;
ret->size_UVarray = size_UVarray;
ret->size_length_array = size_length_array;
ret->UVarray = (float*) malloc(sizeof(float) * size_UVarray);
assert(ret->UVarray);
ret->length_array = (int *)malloc(sizeof(int) * size_length_array);
assert(ret->length_array);
ret->type_array = (GLenum *)malloc(sizeof(GLenum) * size_length_array);
assert(ret->type_array);
ret->index_UVarray = 0;
ret->index_length_array = 0;
ret->vertex_array = NULL;
ret->normal_array = NULL;
ret->color_array = NULL;
ret->texcoord_array = NULL;
ret->next = NULL;
return ret;
}
void bezierPatchMeshPutPatch(bezierPatchMesh *bpm, int maptype, float umin, float umax, int ustride, int uorder, float vmin, float vmax, int vstride, int vorder, float *ctlpoints)
{
switch(maptype){
case GL_MAP2_VERTEX_3:
bpm->bpatch = bezierPatchMake2(umin, vmin, umax, vmax, uorder, vorder, 3, ustride, vstride, ctlpoints);
break;
case GL_MAP2_VERTEX_4:
bpm->bpatch = bezierPatchMake2(umin, vmin, umax, vmax, uorder, vorder, 4,ustride, vstride, ctlpoints );
break;
case GL_MAP2_NORMAL:
bpm->bpatch_normal = bezierPatchMake2(umin, vmin, umax, vmax, uorder, vorder, 3, ustride, vstride, ctlpoints);
break;
case GL_MAP2_INDEX:
bpm->bpatch_color = bezierPatchMake2(umin, vmin, umax, vmax, uorder, vorder, 1, ustride, vstride, ctlpoints);
break;
case GL_MAP2_COLOR_4:
bpm->bpatch_color = bezierPatchMake2(umin, vmin, umax, vmax, uorder, vorder, 4, ustride, vstride, ctlpoints);
break;
case GL_MAP2_TEXTURE_COORD_1:
bpm->bpatch_texcoord = bezierPatchMake2(umin, vmin, umax, vmax, uorder, vorder, 1, ustride, vstride, ctlpoints);
break;
case GL_MAP2_TEXTURE_COORD_2:
bpm->bpatch_texcoord = bezierPatchMake2(umin, vmin, umax, vmax, uorder, vorder, 2, ustride, vstride, ctlpoints);
break;
case GL_MAP2_TEXTURE_COORD_3:
bpm->bpatch_texcoord = bezierPatchMake2(umin, vmin, umax, vmax, uorder, vorder, 3, ustride, vstride, ctlpoints);
break;
case GL_MAP2_TEXTURE_COORD_4:
bpm->bpatch_texcoord = bezierPatchMake2(umin, vmin, umax, vmax, uorder, vorder, 4, ustride, vstride, ctlpoints);
break;
default:
fprintf(stderr, "error in bezierPatchMeshPutPatch, maptype=%i is wrong, maptype,map is invalid\n", maptype);
}
}
/*delete everything including the arrays. So if you want to output the
*pointers of the arrays, you should not use this function to deallocate space.
*you should dealocate manually
*/
void bezierPatchMeshDelete(bezierPatchMesh *bpm)
{
if(bpm->bpatch != NULL)
bezierPatchDelete(bpm->bpatch);
if(bpm->bpatch_normal != NULL)
bezierPatchDelete(bpm->bpatch_normal);
if(bpm->bpatch_color != NULL)
bezierPatchDelete(bpm->bpatch_color);
if(bpm->bpatch_texcoord != NULL)
bezierPatchDelete(bpm->bpatch_texcoord);
free(bpm->UVarray);
free(bpm->length_array);
free(bpm->vertex_array);
free(bpm->normal_array);
free(bpm->type_array);
free(bpm);
}
/*begin a strip
*type is the primitive type:
*/
void bezierPatchMeshBeginStrip(bezierPatchMesh *bpm, GLenum type)
{
bpm->counter = 0;
bpm->type = type;
}
/*signal the end of the current strip*/
void bezierPatchMeshEndStrip(bezierPatchMesh *bpm)
{
int i;
/*if there are no vertices in this strip, then nothing needs to be done*/
if(bpm->counter == 0) return;
/*if the length_array is full, it should be expanded*/
if(bpm->index_length_array >= bpm->size_length_array)
{
int *temp = (int*) malloc(sizeof(int) * (bpm->size_length_array*2 + 1));
assert(temp);
GLenum *temp_type = (GLenum*) malloc(sizeof(GLenum) * (bpm->size_length_array*2 + 1));
assert(temp_type);
/*update the size*/
bpm->size_length_array = bpm->size_length_array*2 + 1;
/*copy*/
for(i=0; i<bpm->index_length_array; i++)
{
temp[i] = bpm->length_array[i];
temp_type[i] = bpm->type_array[i];
}
/*deallocate old array*/
free(bpm->length_array);
free(bpm->type_array);
/*point to the new array which is twice as bigger*/
bpm->length_array = temp;
bpm->type_array = temp_type;
}
bpm->type_array[bpm->index_length_array] = bpm->type;
bpm->length_array[bpm->index_length_array++] = bpm->counter;
}
/*insert (u,v) */
void bezierPatchMeshInsertUV(bezierPatchMesh *bpm, float u, float v)
{
int i;
/*if the UVarray is full, it should be expanded*/
if(bpm->index_UVarray+1 >= bpm->size_UVarray)
{
float *temp = (float*) malloc(sizeof(float) * (bpm->size_UVarray * 2 + 2));
assert(temp);
/*update the size*/
bpm->size_UVarray = bpm->size_UVarray*2 + 2;
/*copy*/
for(i=0; i<bpm->index_UVarray; i++)
{
temp[i] = bpm->UVarray[i];
}
/*deallocate old array*/
free(bpm->UVarray);
/*pointing to the new arrays*/
bpm->UVarray = temp;
}
/*insert the new UV*/
bpm->UVarray[bpm->index_UVarray] = u;
bpm->index_UVarray++;
bpm->UVarray[bpm->index_UVarray] = v;
bpm->index_UVarray++;
/*update counter: one more vertex*/
bpm->counter++;
}
void bezierPatchMeshPrint(bezierPatchMesh *bpm)
{
int i;
printf("the bezier patch is\n");
bezierPatchPrint(bpm->bpatch);
printf("index_length_array= %i\n", bpm->index_length_array);
printf("size_length_array =%i\n", bpm->size_length_array);
printf("index_UVarray =%i\n", bpm->index_UVarray);
printf("size_UVarray =%i\n", bpm->size_UVarray);
printf("UVarray is\n");
for(i=0; i<bpm->index_UVarray; i++)
printf("%f ", bpm->UVarray[i]);
printf("length_array is\n");
for(i=0; i<bpm->index_length_array; i++)
printf("%i ", bpm->length_array[i]);
printf("\n");
}
/*insert a new patch in front of the current linked list and return the new list*/
bezierPatchMesh* bezierPatchMeshListInsert(bezierPatchMesh* list, bezierPatchMesh* bpm)
{
bpm->next=list;
return bpm;
}
/*print all the patches*/
void bezierPatchMeshListPrint(bezierPatchMesh* list)
{
bezierPatchMesh *temp;
for(temp = list; temp != NULL; temp = temp->next)
{
bezierPatchMeshPrint(temp);
}
}
int bezierPatchMeshListTotalStrips(bezierPatchMesh* list)
{
int sum=0;
bezierPatchMesh *temp;
for(temp=list; temp != NULL; temp = temp->next)
{
sum += temp->index_length_array;
}
return sum;
}
int bezierPatchMeshListTotalVert(bezierPatchMesh* list)
{
int sum=0;
bezierPatchMesh *temp;
for(temp=list; temp != NULL; temp = temp->next)
{
sum += temp->index_UVarray;
}
return sum/2;
}
int bezierPatchMeshListNumTriangles(bezierPatchMesh* list)
{
int sum=0;
bezierPatchMesh* temp;
for(temp=list; temp != NULL; temp = temp->next)
{
sum += bezierPatchMeshNumTriangles(temp);
}
return sum;
}
int bezierPatchMeshNumTriangles(bezierPatchMesh* bpm)
{
int i;
int sum=0;
for(i=0; i<bpm->index_length_array; i++)
{
switch(bpm->type_array[i])
{
case GL_TRIANGLES:
sum += bpm->length_array[i]/3;
break;
case GL_TRIANGLE_FAN:
if(bpm->length_array[i] > 2)
sum += bpm->length_array[i]-2;
break;
case GL_TRIANGLE_STRIP:
if(bpm->length_array[i] > 2)
sum += bpm->length_array[i]-2;
break;
case GL_QUAD_STRIP:
if(bpm->length_array[i]>2)
sum += (bpm->length_array[i]-2);
break;
default:
fprintf(stderr,"error in bezierPatchMeshListNumTriangles, type invalid\n");
}
}
return sum;
}
/*delete degenerate triangles*/
void bezierPatchMeshDelDeg(bezierPatchMesh* bpm)
{
if(bpm == NULL) return;
int i,j,k;
int *new_length_array;
GLenum *new_type_array;
int index_new_length_array;
float *new_UVarray;
int index_new_UVarray;
new_length_array = (int*)malloc(sizeof(int) * bpm->index_length_array);
assert(new_length_array);
new_type_array = (GLenum*)malloc(sizeof(GLenum) * bpm->index_length_array);
assert(new_length_array);
new_UVarray = (float*) malloc(sizeof(float) * bpm->index_UVarray);
assert(new_UVarray);
index_new_length_array = 0;
index_new_UVarray=0;
k=0;
for(i=0; i<bpm->index_length_array; i++){
/*(if not degenerate, we have to copy*/
if( (bpm->length_array[i] != 3) || (!isDegenerate(bpm->UVarray+k, bpm->UVarray+k+2, bpm->UVarray+k+4)))
{
for(j=0; j<2* bpm->length_array[i]; j++)
new_UVarray[index_new_UVarray++] = bpm->UVarray[k++];
new_length_array[index_new_length_array] = bpm->length_array[i];
new_type_array[index_new_length_array] = bpm->type_array[i];
index_new_length_array++;
}
else
{
k += 6;
}
}
free(bpm->UVarray);
free(bpm->length_array);
free(bpm->type_array);
bpm->UVarray=new_UVarray;
bpm->length_array=new_length_array;
bpm->type_array=new_type_array;
bpm->index_UVarray = index_new_UVarray;
bpm->index_length_array = index_new_length_array;
}
/*(u,v) to XYZ
*the xyz and normals are stored in vertex_array,
*and normal_array. the spaces of both are allocated here
*/
void bezierPatchMeshEval(bezierPatchMesh* bpm)
{
int i,j,k,l;
float u,v;
float u0 = bpm->bpatch->umin;
float u1 = bpm->bpatch->umax;
int uorder = bpm->bpatch->uorder;
float v0 = bpm->bpatch->vmin;
float v1 = bpm->bpatch->vmax;
int vorder = bpm->bpatch->vorder;
int dimension = bpm->bpatch->dimension;
int ustride = dimension * vorder;
int vstride = dimension;
float *ctlpoints = bpm->bpatch->ctlpoints;
bpm->vertex_array = (float*) malloc(sizeof(float)* (bpm->index_UVarray/2) * 3);
assert(bpm->vertex_array);
bpm->normal_array = (float*) malloc(sizeof(float)* (bpm->index_UVarray/2) * 3);
assert(bpm->normal_array);
k=0;
l=0;
for(i=0; i<bpm->index_length_array; i++)
{
for(j=0; j<bpm->length_array[i]; j++)
{
u = bpm->UVarray[k];
v = bpm->UVarray[k+1];
bezierSurfEval(u0,u1,uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u,v, bpm->vertex_array+l);
bezierSurfEvalNormal(u0,u1,uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u,v, bpm->normal_array+l);
k += 2;
l += 3;
}
}
}
void bezierPatchMeshListEval(bezierPatchMesh* list)
{
bezierPatchMesh* temp;
for(temp = list; temp != NULL; temp = temp->next)
{
bezierPatchMeshEval(temp);
}
}
void bezierPatchMeshDraw(bezierPatchMesh* bpm)
{
int i,j,k;
k=0;
/*k is the index of the first component of the current vertex*/
for(i=0; i<bpm->index_length_array; i++)
{
glBegin(bpm->type_array[i]);
for(j=0; j<bpm->length_array[i]; j++)
{
glNormal3fv(bpm->normal_array+k);
glVertex3fv(bpm->vertex_array+k);
k+= 3;
}
glEnd();
}
}
void bezierPatchMeshListDraw(bezierPatchMesh* list)
{
bezierPatchMesh* temp;
for(temp = list; temp != NULL; temp = temp->next)
{
bezierPatchMeshDraw(temp);
}
}
void bezierPatchMeshListCollect(bezierPatchMesh* list, float **vertex_array, float **normal_array, int **length_array, GLenum **type_array, int *num_strips)
{
int i,j,k,l;
bezierPatchMesh *temp;
int total_num_vertices = bezierPatchMeshListTotalVert(list);
(*vertex_array) = (float *) malloc(sizeof(float) * total_num_vertices*3);
assert(*vertex_array);
(*normal_array) = (float *) malloc(sizeof(float) * total_num_vertices*3);
assert(*normal_array);
*num_strips = bezierPatchMeshListTotalStrips(list);
*length_array = (int*) malloc(sizeof(int) * (*num_strips));
assert(*length_array);
*type_array = (GLenum*) malloc(sizeof(GLenum) * (*num_strips));
assert(*type_array);
k=0;
l=0;
for(temp = list; temp != NULL; temp = temp->next)
{
int x=0;
for(i=0; i<temp->index_length_array; i++)
{
for(j=0; j<temp->length_array[i]; j++)
{
(*vertex_array)[k] = temp->vertex_array[x];
(*vertex_array)[k+1] = temp->vertex_array[x+1];
(*vertex_array)[k+2] = temp->vertex_array[x+2];
(*normal_array)[k] = temp->normal_array[x];
(*normal_array)[k+1] = temp->normal_array[x+1];
(*normal_array)[k+2] = temp->normal_array[x+2];
x += 3;
k += 3;
}
(*type_array)[l] = temp->type_array[i];
(*length_array)[l++] = temp->length_array[i];
}
}
}
static int isDegenerate(float A[2], float B[2], float C[2])
{
if( (A[0] == B[0] && A[1]==B[1]) ||
(A[0] == C[0] && A[1]==C[1]) ||
(B[0] == C[0] && B[1]==C[1])
)
return 1;
else
return 0;
}

View File

@@ -1,121 +0,0 @@
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and
* either this permission notice or a reference to
* http://oss.sgi.com/projects/FreeB/
* 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
* SILICON GRAPHICS, INC. 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.
*
* Except as contained in this notice, the name of Silicon Graphics, Inc.
* shall not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization from
* Silicon Graphics, Inc.
*/
/*
*/
#ifndef _BEZIERPATCHMESH_H
#define _BEZIERPATCHMESH_H
#include <GL/gl.h>
#include "bezierPatch.h"
typedef struct bezierPatchMesh{
bezierPatch *bpatch; /*vertex*/
bezierPatch *bpatch_normal;
bezierPatch *bpatch_texcoord; /*s,t,r,q*/
bezierPatch *bpatch_color; /*RGBA*/
float *UVarray; /*all UV components of all vertices of all strips*/
int *length_array; /*[i] is the number of vertices in the ith strip*/
GLenum *type_array; /*[i] is the type of the ith primitive*/
/*to support dynamic insertion*/
int size_UVarray;
int index_UVarray;
int size_length_array;
int index_length_array;
int counter; /*track the current strip size*/
GLenum type; /*track the current type: 0: GL_TRIANGLES, 1: GL_TRIANGLE_STRIP*/
/*we eventually want to evaluate from (u,v) to (x,y,z) and draw them*/
float *vertex_array; /*each vertex contains three components*/
float *normal_array; /*each normal contains three components*/
float *color_array;
float *texcoord_array;
/*in case we need a linked list*/
struct bezierPatchMesh *next;
} bezierPatchMesh;
#ifdef __cplusplus
extern "C" {
#endif
bezierPatchMesh *bezierPatchMeshMake(int maptype, float umin, float umax, int ustride, int uorder, float vmin, float vmax, int vstride, int vorder, float *ctlpoints, int size_UVarray, int size_length_array);
/*initilize patches to be null*/
bezierPatchMesh *bezierPatchMeshMake2(int size_UVarray, int size_length_array);
void bezierPatchMeshPutPatch(bezierPatchMesh *bpm, int maptype, float umin, float umax, int ustride, int uorder, float vmin, float vmax, int vstride, int vorder, float *ctlpoints);
void bezierPatchMeshDelete(bezierPatchMesh *bpm);
void bezierPatchMeshBeginStrip(bezierPatchMesh *bpm, GLenum type);
void bezierPatchMeshEndStrip(bezierPatchMesh *bpm);
void bezierPatchMeshInsertUV(bezierPatchMesh *bpm, float u, float v);
void bezierPatchMeshPrint(bezierPatchMesh *bpm);
bezierPatchMesh* bezierPatchMeshListInsert(bezierPatchMesh* list, bezierPatchMesh* bpm);
void bezierPatchMeshListPrint(bezierPatchMesh* list);
int bezierPatchMeshListTotalStrips(bezierPatchMesh* list);
int bezierPatchMeshListTotalVert(bezierPatchMesh* list);
int bezierPatchMeshNumTriangles(bezierPatchMesh* bpm);
int bezierPatchMeshListNumTriangles(bezierPatchMesh* list);
void bezierPatchMeshDelDeg(bezierPatchMesh* bpm);
void bezierPatchMeshEval(bezierPatchMesh* bpm);
void bezierPatchMeshDraw(bezierPatchMesh* bpm);
void bezierPatchMeshListDraw(bezierPatchMesh* list);
void bezierPatchMeshListEval(bezierPatchMesh* list);
void bezierPatchMeshListCollect(bezierPatchMesh* list, float **vertex_array, float **normal_array, int **length_array, GLenum **type_array, int *num_strips);
void bezierPatchMeshListDelDeg(bezierPatchMesh* list);
void bezierPatchMeshListDelete(bezierPatchMesh *list);
bezierPatchMesh* bezierPatchMeshListReverse(bezierPatchMesh* list);
void drawStrips(float *vertex_array, float *normal_array, int *length_array, GLenum *type_array, int num_strips);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,402 +0,0 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 1.1 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
** http://oss.sgi.com/projects/FreeB
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
** Window System(R) (Version 1.3), released October 19, 1998. This software
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
*/
/*
* glcurveval.c++
*
*/
/* Polynomial Evaluator Interface */
#include "gluos.h"
#include "glimports.h"
#include "glrenderer.h"
#include "glcurveval.h"
#include "nurbsconsts.h"
OpenGLCurveEvaluator::OpenGLCurveEvaluator(void)
{
//no default callback functions
beginCallBackN = NULL;
endCallBackN = NULL;
vertexCallBackN = NULL;
normalCallBackN = NULL;
colorCallBackN = NULL;
texcoordCallBackN = NULL;
beginCallBackData = NULL;
endCallBackData = NULL;
vertexCallBackData = NULL;
normalCallBackData = NULL;
colorCallBackData = NULL;
texcoordCallBackData = NULL;
userData = NULL;
vertex_flag = 0;
normal_flag = 0;
color_flag = 0;
texcoord_flag = 0;
em_vertex.uprime = -1.0;
em_normal.uprime = -1.0;
em_color.uprime = -1.0;
em_texcoord.uprime = -1.0;
output_triangles = 0; // don't output triangles by default
}
OpenGLCurveEvaluator::~OpenGLCurveEvaluator(void)
{
}
/* added nonsense to avoid the warning messages at compile time */
void
OpenGLCurveEvaluator::addMap(CurveMap *m)
{
m = m;
}
void
OpenGLCurveEvaluator::range1f(long type, REAL *from, REAL *to)
{
type = type;
from = from;
to = to;
}
void
OpenGLCurveEvaluator::domain1f(REAL ulo, REAL uhi)
{
ulo = ulo;
uhi = uhi;
}
void
OpenGLCurveEvaluator::bgnline(void)
{
if(output_triangles)
beginCallBack(GL_LINE_STRIP, userData);
else
glBegin((GLenum) GL_LINE_STRIP);
}
void
OpenGLCurveEvaluator::endline(void)
{
if(output_triangles)
endCallBack(userData);
else
glEnd();
}
/*---------------------------------------------------------------------------
* disable - turn off a curve map
*---------------------------------------------------------------------------
*/
void
OpenGLCurveEvaluator::disable(long type)
{
glDisable((GLenum) type);
}
/*---------------------------------------------------------------------------
* enable - turn on a curve map
*---------------------------------------------------------------------------
*/
void
OpenGLCurveEvaluator::enable(long type)
{
glEnable((GLenum) type);
}
/*-------------------------------------------------------------------------
* mapgrid1f - define a lattice of points with origin and offset
*-------------------------------------------------------------------------
*/
void
OpenGLCurveEvaluator::mapgrid1f(long nu, REAL u0, REAL u1)
{
if(output_triangles)
{
global_grid_u0 = u0;
global_grid_u1 = u1;
global_grid_nu = (int) nu;
}
else
glMapGrid1f((GLint) nu, (GLfloat) u0, (GLfloat) u1);
}
/*-------------------------------------------------------------------------
* bgnmap1 - preamble to curve definition and evaluations
*-------------------------------------------------------------------------
*/
void
OpenGLCurveEvaluator::bgnmap1f(long)
{
if(output_triangles)
{
//initialized so that no maps are set initially
vertex_flag = 0;
normal_flag = 0;
color_flag = 0;
texcoord_flag = 0;
//no need to worry about gl states when doing callback
}
else
glPushAttrib((GLbitfield) GL_EVAL_BIT);
}
/*-------------------------------------------------------------------------
* endmap1 - postamble to a curve map
*-------------------------------------------------------------------------
*/
void
OpenGLCurveEvaluator::endmap1f(void)
{
if(output_triangles)
{
}
else
glPopAttrib();
}
/*-------------------------------------------------------------------------
* map1f - pass a desription of a curve map
*-------------------------------------------------------------------------
*/
void
OpenGLCurveEvaluator::map1f(
long type, /* map type */
REAL ulo, /* lower parametric bound */
REAL uhi, /* upper parametric bound */
long stride, /* distance to next point in REALS */
long order, /* parametric order */
REAL *pts /* control points */
)
{
if(output_triangles)
{
int dimension = 0;
int which = 0;
switch(type){
case GL_MAP1_VERTEX_3:
which = 0;
dimension = 3;
break;
case GL_MAP1_VERTEX_4:
which=0;
dimension = 4;
break;
case GL_MAP1_INDEX:
which=2;
dimension = 1;
break;
case GL_MAP1_COLOR_4:
which=2;
dimension = 4;
break;
case GL_MAP1_NORMAL:
which=1;
dimension = 3;
break;
case GL_MAP1_TEXTURE_COORD_1:
which=3;
dimension = 1;
break;
case GL_MAP1_TEXTURE_COORD_2:
which=3;
dimension = 2;
break;
case GL_MAP1_TEXTURE_COORD_3:
which=3;
dimension = 3;
break;
case GL_MAP1_TEXTURE_COORD_4:
which=3;
dimension = 4;
break;
}
inMap1f(which, dimension, ulo, uhi, stride, order, pts);
}
else
glMap1f((GLenum) type, (GLfloat) ulo, (GLfloat) uhi, (GLint) stride,
(GLint) order, (const GLfloat *) pts);
}
/*-------------------------------------------------------------------------
* mapmesh1f - evaluate a mesh of points on lattice
*-------------------------------------------------------------------------
*/
void OpenGLCurveEvaluator::mapmesh1f(long style, long from, long to)
{
if(output_triangles)
{
inMapMesh1f((int) from, (int) to);
}
else
{
switch(style) {
default:
case N_MESHFILL:
case N_MESHLINE:
glEvalMesh1((GLenum) GL_LINE, (GLint) from, (GLint) to);
break;
case N_MESHPOINT:
glEvalMesh1((GLenum) GL_POINT, (GLint) from, (GLint) to);
break;
}
}
}
/*-------------------------------------------------------------------------
* evalpoint1i - evaluate a point on a curve
*-------------------------------------------------------------------------
*/
void OpenGLCurveEvaluator::evalpoint1i(long i)
{
glEvalPoint1((GLint) i);
}
/*-------------------------------------------------------------------------
* evalcoord1f - evaluate a point on a curve
*-------------------------------------------------------------------------
*/
void OpenGLCurveEvaluator::evalcoord1f(long, REAL u)
{
glEvalCoord1f((GLfloat) u);
}
void
#ifdef _WIN32
OpenGLCurveEvaluator::putCallBack(GLenum which, void (GLAPIENTRY *fn)())
#else
OpenGLCurveEvaluator::putCallBack(GLenum which, _GLUfuncptr fn)
#endif
{
switch(which)
{
case GLU_NURBS_BEGIN:
beginCallBackN = (void (GLAPIENTRY *) (GLenum)) fn;
break;
case GLU_NURBS_END:
endCallBackN = (void (GLAPIENTRY *) (void)) fn;
break;
case GLU_NURBS_VERTEX:
vertexCallBackN = (void (GLAPIENTRY *) (const GLfloat*)) fn;
break;
case GLU_NURBS_NORMAL:
normalCallBackN = (void (GLAPIENTRY *) (const GLfloat*)) fn;
break;
case GLU_NURBS_COLOR:
colorCallBackN = (void (GLAPIENTRY *) (const GLfloat*)) fn;
break;
case GLU_NURBS_TEXTURE_COORD:
texcoordCallBackN = (void (GLAPIENTRY *) (const GLfloat*)) fn;
break;
case GLU_NURBS_BEGIN_DATA:
beginCallBackData = (void (GLAPIENTRY *) (GLenum, void*)) fn;
break;
case GLU_NURBS_END_DATA:
endCallBackData = (void (GLAPIENTRY *) (void*)) fn;
break;
case GLU_NURBS_VERTEX_DATA:
vertexCallBackData = (void (GLAPIENTRY *) (const GLfloat*, void*)) fn;
break;
case GLU_NURBS_NORMAL_DATA:
normalCallBackData = (void (GLAPIENTRY *) (const GLfloat*, void*)) fn;
break;
case GLU_NURBS_COLOR_DATA:
colorCallBackData = (void (GLAPIENTRY *) (const GLfloat*, void*)) fn;
break;
case GLU_NURBS_TEXTURE_COORD_DATA:
texcoordCallBackData = (void (GLAPIENTRY *) (const GLfloat*, void*)) fn;
break;
}
}
void
OpenGLCurveEvaluator::beginCallBack(GLenum which, void *data)
{
if(beginCallBackData)
beginCallBackData(which, data);
else if(beginCallBackN)
beginCallBackN(which);
}
void
OpenGLCurveEvaluator::endCallBack(void *data)
{
if(endCallBackData)
endCallBackData(data);
else if(endCallBackN)
endCallBackN();
}
void
OpenGLCurveEvaluator::vertexCallBack(const GLfloat *vert, void* data)
{
if(vertexCallBackData)
vertexCallBackData(vert, data);
else if(vertexCallBackN)
vertexCallBackN(vert);
}
void
OpenGLCurveEvaluator::normalCallBack(const GLfloat *normal, void* data)
{
if(normalCallBackData)
normalCallBackData(normal, data);
else if(normalCallBackN)
normalCallBackN(normal);
}
void
OpenGLCurveEvaluator::colorCallBack(const GLfloat *color, void* data)
{
if(colorCallBackData)
colorCallBackData(color, data);
else if(colorCallBackN)
colorCallBackN(color);
}
void
OpenGLCurveEvaluator::texcoordCallBack(const GLfloat *texcoord, void* data)
{
if(texcoordCallBackData)
texcoordCallBackData(texcoord, data);
else if(texcoordCallBackN)
texcoordCallBackN(texcoord);
}

View File

@@ -1,157 +0,0 @@
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and
* either this permission notice or a reference to
* http://oss.sgi.com/projects/FreeB/
* 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
* SILICON GRAPHICS, INC. 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.
*
* Except as contained in this notice, the name of Silicon Graphics, Inc.
* shall not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization from
* Silicon Graphics, Inc.
*/
/*
* glcurveval.h
*
*/
#ifndef __gluglcurveval_h_
#define __gluglcurveval_h_
#include "gluos.h"
#include <GL/gl.h>
#include <GL/glu.h>
#include "basiccrveval.h"
class CurveMap;
/*for internal evaluator callback stuff*/
#ifndef IN_MAX_BEZIER_ORDER
#define IN_MAX_BEZIER_ORDER 40 /*XXX should be bigger than machine order*/
#endif
#ifndef IN_MAX_DIMENSION
#define IN_MAX_DIMENSION 4
#endif
typedef struct curveEvalMachine{
REAL uprime; //cached previously evaluated uprime
int k; //the dimension
REAL u1;
REAL u2;
int ustride;
int uorder;
REAL ctlpoints[IN_MAX_BEZIER_ORDER*IN_MAX_DIMENSION];
REAL ucoeff[IN_MAX_BEZIER_ORDER];//cache the polynomial values
} curveEvalMachine;
class OpenGLCurveEvaluator : public BasicCurveEvaluator {
public:
OpenGLCurveEvaluator(void);
virtual ~OpenGLCurveEvaluator(void);
void range1f(long, REAL *, REAL *);
void domain1f(REAL, REAL);
void addMap(CurveMap *);
void enable(long);
void disable(long);
void bgnmap1f(long);
void map1f(long, REAL, REAL, long, long, REAL *);
void mapgrid1f(long, REAL, REAL);
void mapmesh1f(long, long, long);
void evalpoint1i(long);
void evalcoord1f(long, REAL);
void endmap1f(void);
void bgnline(void);
void endline(void);
void put_vertices_call_back(int flag)
{
output_triangles = flag;
}
#ifdef _WIN32
void putCallBack(GLenum which, void (GLAPIENTRY *fn)() );
#else
void putCallBack(GLenum which, _GLUfuncptr fn );
#endif
void set_callback_userData(void *data)
{
userData = data;
}
/*------------------begin for curveEvalMachine------------*/
curveEvalMachine em_vertex;
curveEvalMachine em_normal;
curveEvalMachine em_color;
curveEvalMachine em_texcoord;
int vertex_flag; //whether there is a vertex map or not
int normal_flag; //whether there is a normal map or not
int color_flag; //whether there is a color map or not
int texcoord_flag; //whether there is a texture map or not
REAL global_grid_u0;
REAL global_grid_u1;
int global_grid_nu;
void inMap1f(int which, //0: vert, 1: norm, 2: color, 3: tex
int dimension,
REAL ulower,
REAL uupper,
int ustride,
int uorder,
REAL *ctlpoints);
void inPreEvaluate(int order, REAL vprime, REAL *coeff);
void inDoDomain1(curveEvalMachine *em, REAL u, REAL *retPoint);
void inDoEvalCoord1(REAL u);
void inMapMesh1f(int umin, int umax);
void (GLAPIENTRY *beginCallBackN) (GLenum type);
void (GLAPIENTRY *endCallBackN) (void);
void (GLAPIENTRY *vertexCallBackN) (const GLfloat *vert);
void (GLAPIENTRY *normalCallBackN) (const GLfloat *normal);
void (GLAPIENTRY *colorCallBackN) (const GLfloat *color);
void (GLAPIENTRY *texcoordCallBackN) (const GLfloat *texcoord);
void (GLAPIENTRY *beginCallBackData) (GLenum type, void* data);
void (GLAPIENTRY *endCallBackData) (void* data);
void (GLAPIENTRY *vertexCallBackData) (const GLfloat *vert, void* data);
void (GLAPIENTRY *normalCallBackData) (const GLfloat *normal, void* data);
void (GLAPIENTRY *colorCallBackData) (const GLfloat *color, void* data);
void (GLAPIENTRY *texcoordCallBackData) (const GLfloat *texcoord, void* data);
void* userData; //the opaque pointer for Data callback functions
void beginCallBack(GLenum type, void* data);
void endCallBack(void* data);
void vertexCallBack(const GLfloat *vert, void *data);
void normalCallBack(const GLfloat *normal, void* data);
void colorCallBack(const GLfloat *color, void* data);
void texcoordCallBack(const GLfloat *texcoord, void* data);
/*------------------end for curveEvalMachine------------*/
private:
int output_triangles; //true 1; false 0
};
#endif /* __gluglcurveval_h_ */

View File

@@ -1,42 +0,0 @@
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and
* either this permission notice or a reference to
* http://oss.sgi.com/projects/FreeB/
* 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
* SILICON GRAPHICS, INC. 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.
*
* Except as contained in this notice, the name of Silicon Graphics, Inc.
* shall not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization from
* Silicon Graphics, Inc.
*/
/*
* glimports.h
*
*/
#ifndef __gluimports_h_
#define __gluimports_h_
#include "mystdlib.h"
#include "mystdio.h"
#endif /* __gluimports_h_ */

View File

@@ -1,469 +0,0 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 1.1 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
** http://oss.sgi.com/projects/FreeB
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
** Window System(R) (Version 1.3), released October 19, 1998. This software
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
**
*/
/*
*/
#include "gluos.h"
#include <GL/gl.h>
#include <GL/glu.h>
#include <stdio.h>
#include "glimports.h"
#include "glrenderer.h"
#include "nurbsconsts.h"
//#define DOWN_LOAD_NURBS
#ifdef DOWN_LOAD_NURBS
#include "oglTrimNurbs.h"
static int surfcount = 0;
static oglTrimNurbs* otn = NULL;
nurbSurf* tempNurb = NULL;
oglTrimLoops* tempTrim = NULL;
#endif
//for LOD
extern "C" {void glu_LOD_eval_list(GLUnurbs *nurb, int level);}
void glu_LOD_eval_list(GLUnurbs *nurb, int level)
{
nurb->LOD_eval_list(level);
}
GLUnurbs * GLAPIENTRY
gluNewNurbsRenderer(void)
{
GLUnurbs *t;
t = new GLUnurbs();
return t;
}
void GLAPIENTRY
gluDeleteNurbsRenderer(GLUnurbs *r)
{
delete r;
}
extern "C"
void GLAPIENTRY
gluDeleteNurbsTessellatorEXT(GLUnurbsObj *r)
{
delete r;
}
void GLAPIENTRY
gluBeginSurface(GLUnurbs *r)
{
#ifdef DOWN_LOAD_NURBS
surfcount++;
tempTrim = OTL_make(10,10);
#endif
r->bgnsurface(0);
}
void GLAPIENTRY
gluBeginCurve(GLUnurbs *r)
{
r->bgncurve(0);
}
void GLAPIENTRY
gluEndCurve(GLUnurbs *r)
{
r->endcurve();
}
void GLAPIENTRY
gluEndSurface(GLUnurbs *r)
{
#ifdef DOWN_LOAD_NURBS
if(surfcount == 1)
otn = OTN_make(1);
OTN_insert(otn, tempNurb, tempTrim);
if(surfcount >= 1)
{
#ifdef DEBUG
printf("write file\n");
#endif
OTN_write(otn, "out.otn");
}
#endif
r->endsurface();
}
void GLAPIENTRY
gluBeginTrim(GLUnurbs *r)
{
#ifdef DOWN_LOAD_NURBS
OTL_bgnTrim(tempTrim);
#endif
r->bgntrim();
}
void GLAPIENTRY
gluEndTrim(GLUnurbs *r)
{
#ifdef DOWN_LOAD_NURBS
OTL_endTrim(tempTrim);
#endif
r->endtrim();
}
void GLAPIENTRY
gluPwlCurve(GLUnurbs *r, GLint count, INREAL array[],
GLint stride, GLenum type)
{
#ifdef DOWN_LOAD_NURBS
OTL_pwlCurve(tempTrim, count, array, stride, type);
#endif
int realType;
switch(type) {
case GLU_MAP1_TRIM_2:
realType = N_P2D;
break;
case GLU_MAP1_TRIM_3:
realType = N_P2DR;
break;
default:
realType = type;
break;
}
r->pwlcurve(count, array, sizeof(INREAL) * stride, realType);
}
void GLAPIENTRY
gluNurbsCurve(GLUnurbs *r, GLint nknots, INREAL knot[], GLint stride,
INREAL ctlarray[], GLint order, GLenum type)
{
#ifdef DOWN_LOAD_NURBS
OTL_nurbsCurve(tempTrim, nknots, knot, stride, ctlarray, order, type);
#endif
int realType;
switch(type) {
case GLU_MAP1_TRIM_2:
realType = N_P2D;
break;
case GLU_MAP1_TRIM_3:
realType = N_P2DR;
break;
default:
realType = type;
break;
}
r->nurbscurve(nknots, knot, sizeof(INREAL) * stride, ctlarray, order,
realType);
}
void GLAPIENTRY
gluNurbsSurface(GLUnurbs *r, GLint sknot_count, GLfloat *sknot,
GLint tknot_count, GLfloat *tknot,
GLint s_stride, GLint t_stride,
GLfloat *ctlarray, GLint sorder, GLint torder,
GLenum type)
{
#ifdef DOWN_LOAD_NURBS
{
int dimension;
switch(type){
case GL_MAP2_VERTEX_3:
dimension = 3;
break;
case GL_MAP2_VERTEX_4:
dimension = 4;
break;
default:
fprintf(stderr, "error in glinterface.c++, type no implemented\n");
exit(1);
}
tempNurb = nurbSurfMake(sknot_count, sknot,
tknot_count, tknot,
sorder, torder,
dimension,
ctlarray,
s_stride, t_stride);
}
#endif
r->nurbssurface(sknot_count, sknot, tknot_count, tknot,
sizeof(INREAL) * s_stride, sizeof(INREAL) * t_stride,
ctlarray, sorder, torder, type);
}
void GLAPIENTRY
gluLoadSamplingMatrices(GLUnurbs *r, const GLfloat modelMatrix[16],
const GLfloat projMatrix[16],
const GLint viewport[4])
{
r->useGLMatrices(modelMatrix, projMatrix, viewport);
}
void GLAPIENTRY
gluNurbsProperty(GLUnurbs *r, GLenum property, GLfloat value)
{
GLfloat nurbsValue;
switch (property) {
case GLU_AUTO_LOAD_MATRIX:
r->setautoloadmode(value);
return;
case GLU_CULLING:
if (value != 0.0) {
nurbsValue = N_CULLINGON;
} else {
nurbsValue = N_NOCULLING;
}
r->setnurbsproperty(GL_MAP2_VERTEX_3, N_CULLING, nurbsValue);
r->setnurbsproperty(GL_MAP2_VERTEX_4, N_CULLING, nurbsValue);
r->setnurbsproperty(GL_MAP1_VERTEX_3, N_CULLING, nurbsValue);
r->setnurbsproperty(GL_MAP1_VERTEX_4, N_CULLING, nurbsValue);
return;
case GLU_SAMPLING_METHOD:
if (value == GLU_PATH_LENGTH) {
nurbsValue = N_PATHLENGTH;
} else if (value == GLU_PARAMETRIC_ERROR) {
nurbsValue = N_PARAMETRICDISTANCE;
} else if (value == GLU_DOMAIN_DISTANCE) {
nurbsValue = N_DOMAINDISTANCE;
r->set_is_domain_distance_sampling(1); //optimzing untrimmed case
} else if (value == GLU_OBJECT_PARAMETRIC_ERROR) {
nurbsValue = N_OBJECTSPACE_PARA;
r->setautoloadmode( 0.0 );
r->setSamplingMatrixIdentity();
} else if (value == GLU_OBJECT_PATH_LENGTH) {
nurbsValue = N_OBJECTSPACE_PATH;
r->setautoloadmode( 0.0 );
r->setSamplingMatrixIdentity();
} else {
r->postError(GLU_INVALID_VALUE);
return;
}
r->setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMETHOD, nurbsValue);
r->setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMETHOD, nurbsValue);
r->setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMETHOD, nurbsValue);
r->setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMETHOD, nurbsValue);
return;
case GLU_SAMPLING_TOLERANCE:
r->setnurbsproperty(GL_MAP2_VERTEX_3, N_PIXEL_TOLERANCE, value);
r->setnurbsproperty(GL_MAP2_VERTEX_4, N_PIXEL_TOLERANCE, value);
r->setnurbsproperty(GL_MAP1_VERTEX_3, N_PIXEL_TOLERANCE, value);
r->setnurbsproperty(GL_MAP1_VERTEX_4, N_PIXEL_TOLERANCE, value);
return;
case GLU_PARAMETRIC_TOLERANCE:
r->setnurbsproperty(GL_MAP2_VERTEX_3, N_ERROR_TOLERANCE, value);
r->setnurbsproperty(GL_MAP2_VERTEX_4, N_ERROR_TOLERANCE, value);
r->setnurbsproperty(GL_MAP1_VERTEX_3, N_ERROR_TOLERANCE, value);
r->setnurbsproperty(GL_MAP1_VERTEX_4, N_ERROR_TOLERANCE, value);
return;
case GLU_DISPLAY_MODE:
if (value == GLU_FILL) {
nurbsValue = N_FILL;
} else if (value == GLU_OUTLINE_POLYGON) {
nurbsValue = N_OUTLINE_POLY;
} else if (value == GLU_OUTLINE_PATCH) {
nurbsValue = N_OUTLINE_PATCH;
} else {
r->postError(GLU_INVALID_VALUE);
return;
}
r->setnurbsproperty(N_DISPLAY, nurbsValue);
break;
case GLU_U_STEP:
r->setnurbsproperty(GL_MAP1_VERTEX_3, N_S_STEPS, value);
r->setnurbsproperty(GL_MAP1_VERTEX_4, N_S_STEPS, value);
r->setnurbsproperty(GL_MAP2_VERTEX_3, N_S_STEPS, value);
r->setnurbsproperty(GL_MAP2_VERTEX_4, N_S_STEPS, value);
//added for optimizing untrimmed case
r->set_domain_distance_u_rate(value);
break;
case GLU_V_STEP:
r->setnurbsproperty(GL_MAP1_VERTEX_3, N_T_STEPS, value);
r->setnurbsproperty(GL_MAP1_VERTEX_4, N_T_STEPS, value);
r->setnurbsproperty(GL_MAP2_VERTEX_3, N_T_STEPS, value);
r->setnurbsproperty(GL_MAP2_VERTEX_4, N_T_STEPS, value);
//added for optimizing untrimmed case
r->set_domain_distance_v_rate(value);
break;
case GLU_NURBS_MODE:
if(value == GLU_NURBS_RENDERER)
r->put_callbackFlag(0);
else if(value == GLU_NURBS_TESSELLATOR)
r->put_callbackFlag(1);
else
r->postError(GLU_INVALID_ENUM);
break;
default:
r->postError(GLU_INVALID_ENUM);
return;
}
}
void GLAPIENTRY
gluGetNurbsProperty(GLUnurbs *r, GLenum property, GLfloat *value)
{
GLfloat nurbsValue;
switch(property) {
case GLU_AUTO_LOAD_MATRIX:
if (r->getautoloadmode()) {
*value = GL_TRUE;
} else {
*value = GL_FALSE;
}
break;
case GLU_CULLING:
r->getnurbsproperty(GL_MAP2_VERTEX_3, N_CULLING, &nurbsValue);
if (nurbsValue == N_CULLINGON) {
*value = GL_TRUE;
} else {
*value = GL_FALSE;
}
break;
case GLU_SAMPLING_METHOD:
r->getnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMETHOD, value);
if(*value == N_PATHLENGTH)
*value = GLU_PATH_LENGTH;
else if(*value == N_PARAMETRICDISTANCE)
*value = GLU_PARAMETRIC_ERROR;
else if(*value == N_DOMAINDISTANCE)
*value = GLU_DOMAIN_DISTANCE;
else if(*value == N_OBJECTSPACE_PATH)
*value = GLU_OBJECT_PATH_LENGTH;
else if(*value == N_OBJECTSPACE_PARA)
*value = GLU_OBJECT_PARAMETRIC_ERROR;
break;
case GLU_SAMPLING_TOLERANCE:
r->getnurbsproperty(GL_MAP2_VERTEX_3, N_PIXEL_TOLERANCE, value);
break;
case GLU_PARAMETRIC_TOLERANCE:
r->getnurbsproperty(GL_MAP2_VERTEX_3, N_ERROR_TOLERANCE, value);
break;
case GLU_U_STEP:
r->getnurbsproperty(GL_MAP2_VERTEX_3, N_S_STEPS, value);
break;
case GLU_V_STEP:
r->getnurbsproperty(GL_MAP2_VERTEX_3, N_T_STEPS, value);
break;
case GLU_DISPLAY_MODE:
r->getnurbsproperty(N_DISPLAY, &nurbsValue);
if (nurbsValue == N_FILL) {
*value = GLU_FILL;
} else if (nurbsValue == N_OUTLINE_POLY) {
*value = GLU_OUTLINE_POLYGON;
} else {
*value = GLU_OUTLINE_PATCH;
}
break;
case GLU_NURBS_MODE:
if(r->is_callback())
*value = GLU_NURBS_TESSELLATOR;
else
*value = GLU_NURBS_RENDERER;
break;
default:
r->postError(GLU_INVALID_ENUM);
return;
}
}
extern "C" void GLAPIENTRY
gluNurbsCallback(GLUnurbs *r, GLenum which, _GLUfuncptr fn )
{
switch (which) {
case GLU_NURBS_BEGIN:
case GLU_NURBS_END:
case GLU_NURBS_VERTEX:
case GLU_NURBS_NORMAL:
case GLU_NURBS_TEXTURE_COORD:
case GLU_NURBS_COLOR:
case GLU_NURBS_BEGIN_DATA:
case GLU_NURBS_END_DATA:
case GLU_NURBS_VERTEX_DATA:
case GLU_NURBS_NORMAL_DATA:
case GLU_NURBS_TEXTURE_COORD_DATA:
case GLU_NURBS_COLOR_DATA:
r->putSurfCallBack(which, fn);
break;
case GLU_NURBS_ERROR:
r->errorCallback = (void (APIENTRY *)( GLenum e )) fn;
break;
default:
r->postError(GLU_INVALID_ENUM);
return;
}
}
extern "C"
void GLAPIENTRY
gluNurbsCallbackDataEXT(GLUnurbs* r, void* userData)
{
r->setNurbsCallbackData(userData);
}
extern "C"
void GLAPIENTRY
gluNurbsCallbackData(GLUnurbs* r, void* userData)
{
gluNurbsCallbackDataEXT(r,userData);
}

View File

@@ -1,301 +0,0 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 1.1 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
** http://oss.sgi.com/projects/FreeB
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
** Window System(R) (Version 1.3), released October 19, 1998. This software
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
**
*/
/*
*/
#include "gluos.h"
#include "glimports.h"
#include "glrenderer.h"
GLUnurbs::GLUnurbs()
: NurbsTessellator(curveEvaluator, surfaceEvaluator)
{
redefineMaps();
defineMap(GL_MAP2_NORMAL, 0, 3);
defineMap(GL_MAP1_NORMAL, 0, 3);
defineMap(GL_MAP2_TEXTURE_COORD_1, 0, 1);
defineMap(GL_MAP1_TEXTURE_COORD_1, 0, 1);
defineMap(GL_MAP2_TEXTURE_COORD_2, 0, 2);
defineMap(GL_MAP1_TEXTURE_COORD_2, 0, 2);
defineMap(GL_MAP2_TEXTURE_COORD_3, 0, 3);
defineMap(GL_MAP1_TEXTURE_COORD_3, 0, 3);
defineMap(GL_MAP2_TEXTURE_COORD_4, 1, 4);
defineMap(GL_MAP1_TEXTURE_COORD_4, 1, 4);
defineMap(GL_MAP2_VERTEX_4, 1, 4);
defineMap(GL_MAP1_VERTEX_4, 1, 4);
defineMap(GL_MAP2_VERTEX_3, 0, 3);
defineMap(GL_MAP1_VERTEX_3, 0, 3);
defineMap(GL_MAP2_COLOR_4, 0, 4);
defineMap(GL_MAP1_COLOR_4, 0, 4);
defineMap(GL_MAP2_INDEX, 0, 1);
defineMap(GL_MAP1_INDEX, 0, 1);
setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMETHOD, (float) N_PATHLENGTH);
setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMETHOD, (float) N_PATHLENGTH);
setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMETHOD, (float) N_PATHLENGTH);
setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMETHOD, (float) N_PATHLENGTH);
setnurbsproperty(GL_MAP1_VERTEX_3, N_PIXEL_TOLERANCE, (float) 50.0);
setnurbsproperty(GL_MAP1_VERTEX_4, N_PIXEL_TOLERANCE, (float) 50.0);
setnurbsproperty(GL_MAP2_VERTEX_3, N_PIXEL_TOLERANCE, (float) 50.0);
setnurbsproperty(GL_MAP2_VERTEX_4, N_PIXEL_TOLERANCE, (float) 50.0);
setnurbsproperty(GL_MAP1_VERTEX_3, N_ERROR_TOLERANCE, (float) 0.50);
setnurbsproperty(GL_MAP1_VERTEX_4, N_ERROR_TOLERANCE, (float) 0.50);
setnurbsproperty(GL_MAP2_VERTEX_3, N_ERROR_TOLERANCE, (float) 0.50);
setnurbsproperty(GL_MAP2_VERTEX_4, N_ERROR_TOLERANCE, (float) 0.50);
setnurbsproperty(GL_MAP1_VERTEX_3, N_S_STEPS, (float) 100.0);
setnurbsproperty(GL_MAP1_VERTEX_4, N_S_STEPS, (float) 100.0);
setnurbsproperty(GL_MAP2_VERTEX_3, N_S_STEPS, (float) 100.0);
setnurbsproperty(GL_MAP2_VERTEX_4, N_S_STEPS, (float) 100.0);
//added for optimizing untrimmed case
set_domain_distance_u_rate(100.0);
setnurbsproperty(GL_MAP1_VERTEX_3, N_T_STEPS, (float) 100.0);
setnurbsproperty(GL_MAP1_VERTEX_4, N_T_STEPS, (float) 100.0);
setnurbsproperty(GL_MAP2_VERTEX_3, N_T_STEPS, (float) 100.0);
setnurbsproperty(GL_MAP2_VERTEX_4, N_T_STEPS, (float) 100.0);
//added for optimizing untrimmed case
set_domain_distance_v_rate(100.0);
set_is_domain_distance_sampling(0); //since the default is path_length
//default autoloadmode is true
autoloadmode = 1;
//default callbackFlag is 0
callbackFlag = 0;
errorCallback = NULL;
}
void
GLUnurbs::bgnrender(void)
{
if (autoloadmode) {
loadGLMatrices();
}
}
void
GLUnurbs::endrender(void)
{
}
void
GLUnurbs::errorHandler(int i)
{
int gluError;
gluError = i + (GLU_NURBS_ERROR1 - 1);
postError( gluError );
}
void
GLUnurbs::loadGLMatrices(void)
{
GLfloat vmat[4][4];
GLint viewport[4];
grabGLMatrix((GLfloat (*)[4]) vmat);
loadCullingMatrix((GLfloat (*)[4]) vmat);
::glGetIntegerv((GLenum) GL_VIEWPORT, (GLint *) viewport);
loadSamplingMatrix((const GLfloat (*)[4]) vmat, (const GLint *) viewport);
}
void
GLUnurbs::useGLMatrices(const GLfloat modelMatrix[16],
const GLfloat projMatrix[16],
const GLint viewport[4])
{
GLfloat vmat[4][4];
multmatrix4d(vmat, (const GLfloat (*)[4]) modelMatrix,
(const GLfloat (*)[4]) projMatrix);
loadCullingMatrix((GLfloat (*)[4]) vmat);
loadSamplingMatrix((const GLfloat (*)[4]) vmat, (const GLint *) viewport);
}
/*--------------------------------------------------------------------------
* grabGLMatrix
*--------------------------------------------------------------------------
*/
void
GLUnurbs::grabGLMatrix(GLfloat vmat[4][4])
{
GLfloat m1[4][4], m2[4][4];
::glGetFloatv((GLenum) GL_MODELVIEW_MATRIX, (GLfloat *) &(m1[0][0]));
::glGetFloatv((GLenum) GL_PROJECTION_MATRIX, (GLfloat *) &(m2[0][0]));
multmatrix4d((GLfloat (*)[4]) vmat,
(const GLfloat (*)[4]) m1, (const GLfloat (*)[4]) m2);
}
//for object space tesselation: view independent
void
GLUnurbs::setSamplingMatrixIdentity( void )
{
INREAL smat[4][4] = {
{1,0,0,0},
{0,1,0,0},
{0,0,1,0},
{0,0,0,1}
};
const long rstride = sizeof(smat[0]) / sizeof(smat[0][0]);
const long cstride = 1;
setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride,
cstride);
setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride,
cstride);
setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride,
cstride);
setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride,
cstride);
}
void
GLUnurbs::loadSamplingMatrix(const GLfloat vmat[4][4],
const GLint viewport[4])
{
/* rescale the mapping to correspond to pixels in x/y */
REAL xsize = 0.5 * (REAL) (viewport[2]);
REAL ysize = 0.5 * (REAL) (viewport[3]);
INREAL smat[4][4];
smat[0][0] = vmat[0][0] * xsize;
smat[1][0] = vmat[1][0] * xsize;
smat[2][0] = vmat[2][0] * xsize;
smat[3][0] = vmat[3][0] * xsize;
smat[0][1] = vmat[0][1] * ysize;
smat[1][1] = vmat[1][1] * ysize;
smat[2][1] = vmat[2][1] * ysize;
smat[3][1] = vmat[3][1] * ysize;
smat[0][2] = 0.0;
smat[1][2] = 0.0;
smat[2][2] = 0.0;
smat[3][2] = 0.0;
smat[0][3] = vmat[0][3];
smat[1][3] = vmat[1][3];
smat[2][3] = vmat[2][3];
smat[3][3] = vmat[3][3];
const long rstride = sizeof(smat[0]) / sizeof(smat[0][0]);
const long cstride = 1;
setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride,
cstride);
setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride,
cstride);
setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride,
cstride);
setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride,
cstride);
}
void
GLUnurbs::loadCullingMatrix(GLfloat vmat[4][4])
{
INREAL cmat[4][4];
cmat[0][0] = vmat[0][0];
cmat[0][1] = vmat[0][1];
cmat[0][2] = vmat[0][2];
cmat[0][3] = vmat[0][3];
cmat[1][0] = vmat[1][0];
cmat[1][1] = vmat[1][1];
cmat[1][2] = vmat[1][2];
cmat[1][3] = vmat[1][3];
cmat[2][0] = vmat[2][0];
cmat[2][1] = vmat[2][1];
cmat[2][2] = vmat[2][2];
cmat[2][3] = vmat[2][3];
cmat[3][0] = vmat[3][0];
cmat[3][1] = vmat[3][1];
cmat[3][2] = vmat[3][2];
cmat[3][3] = vmat[3][3];
const long rstride = sizeof(cmat[0]) / sizeof(cmat[0][0]);
const long cstride = 1;
setnurbsproperty(GL_MAP2_VERTEX_3, N_CULLINGMATRIX, &cmat[0][0], rstride,
cstride);
setnurbsproperty(GL_MAP2_VERTEX_4, N_CULLINGMATRIX, &cmat[0][0], rstride,
cstride);
//added for curves by zl
setnurbsproperty(GL_MAP1_VERTEX_3, N_CULLINGMATRIX, &cmat[0][0], rstride,
cstride);
setnurbsproperty(GL_MAP1_VERTEX_4, N_CULLINGMATRIX, &cmat[0][0], rstride,
cstride);
}
/*---------------------------------------------------------------------
* A = B * MAT ; transform a 4d vector through a 4x4 matrix
*---------------------------------------------------------------------
*/
void
GLUnurbs::transform4d(GLfloat A[4], GLfloat B[4], GLfloat mat[4][4])
{
A[0] = B[0]*mat[0][0] + B[1]*mat[1][0] + B[2]*mat[2][0] + B[3]*mat[3][0];
A[1] = B[0]*mat[0][1] + B[1]*mat[1][1] + B[2]*mat[2][1] + B[3]*mat[3][1];
A[2] = B[0]*mat[0][2] + B[1]*mat[1][2] + B[2]*mat[2][2] + B[3]*mat[3][2];
A[3] = B[0]*mat[0][3] + B[1]*mat[1][3] + B[2]*mat[2][3] + B[3]*mat[3][3];
}
/*---------------------------------------------------------------------
* new = [left][right] ; multiply two matrices together
*---------------------------------------------------------------------
*/
void
GLUnurbs::multmatrix4d (GLfloat n[4][4], const GLfloat left[4][4],
const GLfloat right[4][4])
{
transform4d ((GLfloat *) n[0],(GLfloat *) left[0],(GLfloat (*)[4]) right);
transform4d ((GLfloat *) n[1],(GLfloat *) left[1],(GLfloat (*)[4]) right);
transform4d ((GLfloat *) n[2],(GLfloat *) left[2],(GLfloat (*)[4]) right);
transform4d ((GLfloat *) n[3],(GLfloat *) left[3],(GLfloat (*)[4]) right);
}

View File

@@ -1,146 +0,0 @@
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and
* either this permission notice or a reference to
* http://oss.sgi.com/projects/FreeB/
* 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
* SILICON GRAPHICS, INC. 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.
*
* Except as contained in this notice, the name of Silicon Graphics, Inc.
* shall not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization from
* Silicon Graphics, Inc.
*/
/*
* glrenderer.h
*
*/
#ifndef __gluglrenderer_h_
#define __gluglrenderer_h_
#include <GL/gl.h>
#include <GL/glu.h>
#include "nurbstess.h"
#include "glsurfeval.h"
#include "glcurveval.h"
extern "C" {
typedef void (APIENTRY *errorCallbackType)( GLenum );
}
class GLUnurbs : public NurbsTessellator {
public:
GLUnurbs( void );
void loadGLMatrices( void );
void useGLMatrices( const GLfloat modelMatrix[16],
const GLfloat projMatrix[16],
const GLint viewport[4] );
void setSamplingMatrixIdentity( void );
void errorHandler( int );
void bgnrender( void );
void endrender( void );
void setautoloadmode( INREAL value )
{
if (value) autoloadmode = GL_TRUE;
else autoloadmode = GL_FALSE;
}
GLboolean getautoloadmode( void ) { return autoloadmode; }
errorCallbackType errorCallback;
void postError( int which )
{ if (errorCallback) (errorCallback)( (GLenum)which ); }
#ifdef _WIN32
void putSurfCallBack(GLenum which, void (GLAPIENTRY *fn)() )
#else
void putSurfCallBack(GLenum which, _GLUfuncptr fn )
#endif
{
curveEvaluator.putCallBack(which, fn);
surfaceEvaluator.putCallBack(which, fn);
}
int get_vertices_call_back()
{
return surfaceEvaluator.get_vertices_call_back();
}
void put_vertices_call_back(int flag)
{
surfaceEvaluator.put_vertices_call_back(flag);
}
int get_callback_auto_normal()
{
return surfaceEvaluator.get_callback_auto_normal();
}
void put_callback_auto_normal(int flag)
{
surfaceEvaluator.put_callback_auto_normal(flag);
}
void setNurbsCallbackData(void* userData)
{
curveEvaluator.set_callback_userData(userData);
surfaceEvaluator.set_callback_userData(userData);
}
//for LOD
void LOD_eval_list(int level)
{
surfaceEvaluator.LOD_eval_list(level);
}
//NEWCALLBACK
int is_callback()
{
return callbackFlag;
}
void put_callbackFlag(int flag)
{
callbackFlag = flag;
surfaceEvaluator.put_vertices_call_back(flag);
curveEvaluator.put_vertices_call_back(flag);
}
private:
GLboolean autoloadmode;
OpenGLSurfaceEvaluator surfaceEvaluator;
OpenGLCurveEvaluator curveEvaluator;
void loadSamplingMatrix( const GLfloat vmat[4][4],
const GLint viewport[4] );
void loadCullingMatrix( GLfloat vmat[4][4] );
static void grabGLMatrix( GLfloat vmat[4][4] );
static void transform4d( GLfloat A[4], GLfloat B[4],
GLfloat mat[4][4] );
static void multmatrix4d( GLfloat n[4][4], const GLfloat left[4][4],
const GLfloat right[4][4] );
int callbackFlag;
};
#endif /* __gluglrenderer_h_ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,404 +0,0 @@
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and
* either this permission notice or a reference to
* http://oss.sgi.com/projects/FreeB/
* 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
* SILICON GRAPHICS, INC. 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.
*
* Except as contained in this notice, the name of Silicon Graphics, Inc.
* shall not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization from
* Silicon Graphics, Inc.
*/
/*
* glsurfeval.h
*
*/
#ifndef __gluglsurfeval_h_
#define __gluglsurfeval_h_
#include "basicsurfeval.h"
#include "bezierPatchMesh.h" //in case output triangles
#include <GL/gl.h>
#include <GL/glu.h>
class SurfaceMap;
class OpenGLSurfaceEvaluator;
class StoredVertex;
#define TYPECOORD 1
#define TYPEPOINT 2
/* Cache up to 3 vertices from tmeshes */
#define VERTEX_CACHE_SIZE 3
/*for internal evaluator callback stuff*/
#ifndef IN_MAX_BEZIER_ORDER
#define IN_MAX_BEZIER_ORDER 40 /*XXX should be bigger than machine order*/
#endif
#ifndef IN_MAX_DIMENSION
#define IN_MAX_DIMENSION 4
#endif
typedef struct surfEvalMachine{
REAL uprime;//cached previusly evaluated uprime.
REAL vprime;
int k; /*the dimension*/
REAL u1;
REAL u2;
int ustride;
int uorder;
REAL v1;
REAL v2;
int vstride;
int vorder;
REAL ctlPoints[IN_MAX_BEZIER_ORDER*IN_MAX_BEZIER_ORDER*IN_MAX_DIMENSION];
REAL ucoeff[IN_MAX_BEZIER_ORDER]; /*cache the polynomial values*/
REAL vcoeff[IN_MAX_BEZIER_ORDER];
REAL ucoeffDeriv[IN_MAX_BEZIER_ORDER]; /*cache the polynomial derivatives*/
REAL vcoeffDeriv[IN_MAX_BEZIER_ORDER];
} surfEvalMachine;
class StoredVertex {
public:
StoredVertex() { type = 0; coord[0] = 0; coord[1] = 0; point[0] = 0; point[1] = 0; }
~StoredVertex(void) {}
void saveEvalCoord(REAL x, REAL y)
{coord[0] = x; coord[1] = y; type = TYPECOORD; }
void saveEvalPoint(long x, long y)
{point[0] = x; point[1] = y; type = TYPEPOINT; }
void invoke(OpenGLSurfaceEvaluator *eval);
private:
int type;
REAL coord[2];
long point[2];
};
class OpenGLSurfaceEvaluator : public BasicSurfaceEvaluator {
public:
OpenGLSurfaceEvaluator();
virtual ~OpenGLSurfaceEvaluator( void );
void polymode( long style );
void range2f( long, REAL *, REAL * );
void domain2f( REAL, REAL, REAL, REAL );
void addMap( SurfaceMap * ) { }
void enable( long );
void disable( long );
void bgnmap2f( long );
void map2f( long, REAL, REAL, long, long,
REAL, REAL, long, long, REAL * );
void mapgrid2f( long, REAL, REAL, long, REAL, REAL );
void mapmesh2f( long, long, long, long, long );
void evalcoord2f( long, REAL, REAL );
void evalpoint2i( long, long );
void endmap2f( void );
void bgnline( void );
void endline( void );
void bgnclosedline( void );
void endclosedline( void );
void bgntmesh( void );
void swaptmesh( void );
void endtmesh( void );
void bgnqstrip( void );
void endqstrip( void );
void bgntfan( void );
void endtfan( void );
void evalUStrip(int n_upper, REAL v_upper, REAL* upper_val,
int n_lower, REAL v_lower, REAL* lower_val);
void evalVStrip(int n_left, REAL u_left, REAL* left_val,
int n_right, REAL u_right, REAL* right_val);
void coord2f( REAL, REAL );
void point2i( long, long );
void newtmeshvert( REAL, REAL );
void newtmeshvert( long, long );
#ifdef _WIN32
void putCallBack(GLenum which, void (GLAPIENTRY *fn)() );
#else
void putCallBack(GLenum which, _GLUfuncptr fn );
#endif
int get_vertices_call_back()
{
return output_triangles;
}
void put_vertices_call_back(int flag)
{
output_triangles = flag;
}
void put_callback_auto_normal(int flag)
{
callback_auto_normal = flag;
}
int get_callback_auto_normal()
{
return callback_auto_normal;
}
void set_callback_userData(void* data)
{
userData = data;
}
/**************begin for LOD_eval_list***********/
void LOD_eval_list(int level);
private:
StoredVertex *vertexCache[VERTEX_CACHE_SIZE];
int tmeshing;
int which;
int vcount;
GLint gl_polygon_mode[2];/*to save and restore so that
*no side effect
*/
bezierPatchMesh *global_bpm; //for output triangles
int output_triangles; //true 1 or false 0
void (GLAPIENTRY *beginCallBackN) (GLenum type);
void (GLAPIENTRY *endCallBackN) (void);
void (GLAPIENTRY *vertexCallBackN) (const GLfloat *vert);
void (GLAPIENTRY *normalCallBackN) (const GLfloat *normal);
void (GLAPIENTRY *colorCallBackN) (const GLfloat *color);
void (GLAPIENTRY *texcoordCallBackN) (const GLfloat *texcoord);
void (GLAPIENTRY *beginCallBackData) (GLenum type, void* data);
void (GLAPIENTRY *endCallBackData) (void* data);
void (GLAPIENTRY *vertexCallBackData) (const GLfloat *vert, void* data);
void (GLAPIENTRY *normalCallBackData) (const GLfloat *normal, void* data);
void (GLAPIENTRY *colorCallBackData) (const GLfloat *color, void* data);
void (GLAPIENTRY *texcoordCallBackData) (const GLfloat *texcoord, void* data);
void beginCallBack (GLenum type, void* data);
void endCallBack (void* data);
void vertexCallBack (const GLfloat *vert, void* data);
void normalCallBack (const GLfloat *normal, void* data);
void colorCallBack (const GLfloat *color, void* data);
void texcoordCallBack (const GLfloat *texcoord, void* data);
void* userData; //the opaque pointer for Data callback functions.
/*LOD evaluation*/
void LOD_triangle(REAL A[2], REAL B[2], REAL C[2],
int level);
void LOD_eval(int num_vert, REAL* verts, int type, int level);
int LOD_eval_level; //set by LOD_eval_list()
/*************begin for internal evaluators*****************/
/*the following global variables are only defined in this file.
*They are used to cache the precomputed Bezier polynomial values.
*These calues may be used consecutively in which case we don't have
*recompute these values again.
*/
int global_uorder; /*store the uorder in the previous evaluation*/
int global_vorder; /*store the vorder in the previous evaluation*/
REAL global_uprime;
REAL global_vprime;
REAL global_vprime_BV;
REAL global_uprime_BU;
int global_uorder_BV; /*store the uorder in the previous evaluation*/
int global_vorder_BV; /*store the vorder in the previous evaluation*/
int global_uorder_BU; /*store the uorder in the previous evaluation*/
int global_vorder_BU; /*store the vorder in the previous evaluation*/
REAL global_ucoeff[IN_MAX_BEZIER_ORDER]; /*cache the polynomial values*/
REAL global_vcoeff[IN_MAX_BEZIER_ORDER];
REAL global_ucoeffDeriv[IN_MAX_BEZIER_ORDER]; /*cache the polynomial derivatives*/
REAL global_vcoeffDeriv[IN_MAX_BEZIER_ORDER];
REAL global_BV[IN_MAX_BEZIER_ORDER][IN_MAX_DIMENSION];
REAL global_PBV[IN_MAX_BEZIER_ORDER][IN_MAX_DIMENSION];
REAL global_BU[IN_MAX_BEZIER_ORDER][IN_MAX_DIMENSION];
REAL global_PBU[IN_MAX_BEZIER_ORDER][IN_MAX_DIMENSION];
REAL* global_baseData;
int global_ev_k; /*the dimension*/
REAL global_ev_u1;
REAL global_ev_u2;
int global_ev_ustride;
int global_ev_uorder;
REAL global_ev_v1;
REAL global_ev_v2;
int global_ev_vstride;
int global_ev_vorder;
REAL global_ev_ctlPoints[IN_MAX_BEZIER_ORDER*IN_MAX_BEZIER_ORDER*IN_MAX_DIMENSION];
REAL global_grid_u0;
REAL global_grid_u1;
int global_grid_nu;
REAL global_grid_v0;
REAL global_grid_v1;
int global_grid_nv;
/*functions*/
void inDoDomain2WithDerivs(int k, REAL u, REAL v,
REAL u1, REAL u2, int uorder,
REAL v1, REAL v2, int vorder,
REAL *baseData,
REAL *retPoint, REAL *retdu, REAL *retdv);
void inPreEvaluate(int order, REAL vprime, REAL *coeff);
void inPreEvaluateWithDeriv(int order, REAL vprime, REAL *coeff, REAL *coeffDeriv);
void inComputeFirstPartials(REAL *p, REAL *pu, REAL *pv);
void inComputeNormal2(REAL *pu, REAL *pv, REAL *n);
void inDoEvalCoord2(REAL u, REAL v,
REAL *retPoint, REAL *retNormal);
void inDoEvalCoord2NOGE(REAL u, REAL v,
REAL *retPoint, REAL *retNormal);
void inMap2f(int k,
REAL ulower,
REAL uupper,
int ustride,
int uorder,
REAL vlower,
REAL vupper,
int vstride,
int vorder,
REAL *ctlPoints);
void inMapGrid2f(int nu, REAL u0, REAL u1,
int nv, REAL v0, REAL v1);
void inEvalMesh2(int lowU, int lowV, int highU, int highV);
void inEvalPoint2(int i, int j);
void inEvalCoord2f(REAL u, REAL v);
void inEvalULine(int n_points, REAL v, REAL* u_vals,
int stride, REAL ret_points[][3], REAL ret_normals[][3]);
void inEvalVLine(int n_points, REAL u, REAL* v_vals,
int stride, REAL ret_points[][3], REAL ret_normals[][3]);
void inEvalUStrip(int n_upper, REAL v_upper, REAL* upper_val,
int n_lower, REAL v_lower, REAL* lower_val
);
void inEvalVStrip(int n_left, REAL u_left, REAL* left_val, int n_right, REAL u_right, REAL* right_val);
void inPreEvaluateBV(int k, int uorder, int vorder, REAL vprime, REAL *baseData);
void inPreEvaluateBU(int k, int uorder, int vorder, REAL uprime, REAL *baseData);
void inPreEvaluateBV_intfac(REAL v )
{
inPreEvaluateBV(global_ev_k, global_ev_uorder, global_ev_vorder, (v-global_ev_v1)/(global_ev_v2-global_ev_v1), global_ev_ctlPoints);
}
void inPreEvaluateBU_intfac(REAL u)
{
inPreEvaluateBU(global_ev_k, global_ev_uorder, global_ev_vorder, (u-global_ev_u1)/(global_ev_u2-global_ev_u1), global_ev_ctlPoints);
}
void inDoDomain2WithDerivsBV(int k, REAL u, REAL v,
REAL u1, REAL u2, int uorder,
REAL v1, REAL v2, int vorder,
REAL *baseData,
REAL *retPoint, REAL* retdu, REAL *retdv);
void inDoDomain2WithDerivsBU(int k, REAL u, REAL v,
REAL u1, REAL u2, int uorder,
REAL v1, REAL v2, int vorder,
REAL *baseData,
REAL *retPoint, REAL* retdu, REAL *retdv);
void inDoEvalCoord2NOGE_BV(REAL u, REAL v,
REAL *retPoint, REAL *retNormal);
void inDoEvalCoord2NOGE_BU(REAL u, REAL v,
REAL *retPoint, REAL *retNormal);
void inBPMEval(bezierPatchMesh* bpm);
void inBPMListEval(bezierPatchMesh* list);
/*-------------begin for surfEvalMachine -------------*/
surfEvalMachine em_vertex;
surfEvalMachine em_normal;
surfEvalMachine em_color;
surfEvalMachine em_texcoord;
int auto_normal_flag; //whether to output normla or not in callback
//determined by GL_AUTO_NORMAL and callback_auto_normal
int callback_auto_normal; //GLU_CALLBACK_AUTO_NORMAL_EXT
int vertex_flag;
int normal_flag;
int color_flag;
int texcoord_flag;
void inMap2fEM(int which, //0:vert,1:norm,2:color,3:tex
int dimension,
REAL ulower,
REAL uupper,
int ustride,
int uorder,
REAL vlower,
REAL vupper,
int vstride,
int vorder,
REAL *ctlPoints);
void inDoDomain2WithDerivsEM(surfEvalMachine *em, REAL u, REAL v,
REAL *retPoint, REAL *retdu, REAL *retdv);
void inDoDomain2EM(surfEvalMachine *em, REAL u, REAL v,
REAL *retPoint);
void inDoEvalCoord2EM(REAL u, REAL v);
void inBPMEvalEM(bezierPatchMesh* bpm);
void inBPMListEvalEM(bezierPatchMesh* list);
/*-------------end for surfEvalMachine -------------*/
/*************end for internal evaluators*****************/
};
inline void StoredVertex::invoke(OpenGLSurfaceEvaluator *eval)
{
switch(type) {
case TYPECOORD:
eval->coord2f(coord[0], coord[1]);
break;
case TYPEPOINT:
eval->point2i(point[0], point[1]);
break;
default:
break;
}
}
#endif /* __gluglsurfeval_h_ */

View File

@@ -1,206 +0,0 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 1.1 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
** http://oss.sgi.com/projects/FreeB
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
** Window System(R) (Version 1.3), released October 19, 1998. This software
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
**
*/
/*
*/
#include <stdlib.h>
#include <stdio.h>
#include "glcurveval.h"
/*
*compute the Bezier polynomials C[n,j](v) for all j at v with
*return values stored in coeff[], where
* C[n,j](v) = (n,j) * v^j * (1-v)^(n-j),
* j=0,1,2,...,n.
*order : n+1
*vprime: v
*coeff : coeff[j]=C[n,j](v), this array store the returned values.
*The algorithm is a recursive scheme:
* C[0,0]=1;
* C[n,j](v) = (1-v)*C[n-1,j](v) + v*C[n-1,j-1](v), n>=1
*This code is copied from opengl/soft/so_eval.c:PreEvaluate
*/
void OpenGLCurveEvaluator::inPreEvaluate(int order, REAL vprime, REAL *coeff)
{
int i, j;
REAL oldval, temp;
REAL oneMinusvprime;
/*
* Minor optimization
* Compute orders 1 and 2 outright, and set coeff[0], coeff[1] to
* their i==1 loop values to avoid the initialization and the i==1 loop.
*/
if (order == 1) {
coeff[0] = 1.0;
return;
}
oneMinusvprime = 1-vprime;
coeff[0] = oneMinusvprime;
coeff[1] = vprime;
if (order == 2) return;
for (i = 2; i < order; i++) {
oldval = coeff[0] * vprime;
coeff[0] = oneMinusvprime * coeff[0];
for (j = 1; j < i; j++) {
temp = oldval;
oldval = coeff[j] * vprime;
coeff[j] = temp + oneMinusvprime * coeff[j];
}
coeff[j] = oldval;
}
}
void OpenGLCurveEvaluator::inMap1f(int which, //0: vert, 1: norm, 2: color, 3: tex
int k, //dimension
REAL ulower,
REAL uupper,
int ustride,
int uorder,
REAL *ctlpoints)
{
int i,x;
curveEvalMachine *temp_em;
switch(which){
case 0: //vertex
vertex_flag = 1;
temp_em = &em_vertex;
break;
case 1: //normal
normal_flag = 1;
temp_em = &em_normal;
break;
case 2: //color
color_flag = 1;
temp_em = &em_color;
break;
default:
texcoord_flag = 1;
temp_em = &em_texcoord;
break;
}
REAL *data = temp_em->ctlpoints;
temp_em->uprime = -1; //initialized
temp_em->k = k;
temp_em->u1 = ulower;
temp_em->u2 = uupper;
temp_em->ustride = ustride;
temp_em->uorder = uorder;
/*copy the control points*/
for(i=0; i<uorder; i++){
for(x=0; x<k; x++){
data[x] = ctlpoints[x];
}
ctlpoints += ustride;
data += k;
}
}
void OpenGLCurveEvaluator::inDoDomain1(curveEvalMachine *em, REAL u, REAL *retPoint)
{
int j, row;
REAL the_uprime;
REAL *data;
if(em->u2 == em->u1)
return;
the_uprime = (u-em->u1) / (em->u2-em->u1);
/*use already cached values if possible*/
if(em->uprime != the_uprime){
inPreEvaluate(em->uorder, the_uprime, em->ucoeff);
em->uprime = the_uprime;
}
for(j=0; j<em->k; j++){
data = em->ctlpoints+j;
retPoint[j] = 0.0;
for(row=0; row<em->uorder; row++)
{
retPoint[j] += em->ucoeff[row] * (*data);
data += em->k;
}
}
}
void OpenGLCurveEvaluator::inDoEvalCoord1(REAL u)
{
REAL temp_vertex[4];
REAL temp_normal[3];
REAL temp_color[4];
REAL temp_texcoord[4];
if(texcoord_flag) //there is a texture map
{
inDoDomain1(&em_texcoord, u, temp_texcoord);
texcoordCallBack(temp_texcoord, userData);
}
#ifdef DEBUG
printf("color_flag = %i\n", color_flag);
#endif
if(color_flag) //there is a color map
{
inDoDomain1(&em_color, u, temp_color);
colorCallBack(temp_color, userData);
}
if(normal_flag) //there is a normal map
{
inDoDomain1(&em_normal, u, temp_normal);
normalCallBack(temp_normal, userData);
}
if(vertex_flag)
{
inDoDomain1(&em_vertex, u, temp_vertex);
vertexCallBack(temp_vertex, userData);
}
}
void OpenGLCurveEvaluator::inMapMesh1f(int umin, int umax)
{
REAL du, u;
int i;
if(global_grid_nu == 0)
return; //no points to output
du = (global_grid_u1 - global_grid_u0) / (REAL) global_grid_nu;
bgnline();
for(i=umin; i<= umax; i++){
u = (i==global_grid_nu)? global_grid_u1: global_grid_u0 + i*du;
inDoEvalCoord1(u);
}
endline();
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,60 +0,0 @@
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and
* either this permission notice or a reference to
* http://oss.sgi.com/projects/FreeB/
* 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
* SILICON GRAPHICS, INC. 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.
*
* Except as contained in this notice, the name of Silicon Graphics, Inc.
* shall not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization from
* Silicon Graphics, Inc.
*/
/*
* mystdio.h
*
*/
#ifndef __glumystdio_h_
#define __glumystdio_h_
#ifdef STANDALONE
inline void _glu_dprintf( const char *, ... ) { }
#endif
#ifdef LIBRARYBUILD
#ifndef NDEBUG
#include <stdio.h>
#define _glu_dprintf printf
#else
inline void _glu_dprintf( const char *, ... ) { }
#endif
#endif
#ifdef GLBUILD
inline void _glu_dprintf( const char *, ... ) { }
#endif
#ifndef NULL
#define NULL 0
#endif
#endif /* __glumystdio_h_ */

View File

@@ -1,57 +0,0 @@
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and
* either this permission notice or a reference to
* http://oss.sgi.com/projects/FreeB/
* 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
* SILICON GRAPHICS, INC. 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.
*
* Except as contained in this notice, the name of Silicon Graphics, Inc.
* shall not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization from
* Silicon Graphics, Inc.
*/
/*
* mystdlib.h
*
*/
#ifndef __glumystdlib_h_
#define __glumystdlib_h_
#ifdef STANDALONE
typedef unsigned int size_t;
extern "C" void abort( void );
extern "C" void * malloc( size_t );
extern "C" void free( void * );
#endif
#ifdef LIBRARYBUILD
#include <stdlib.h>
#endif
#ifdef GLBUILD
typedef unsigned int size_t;
extern "C" void abort( void );
extern "C" void * malloc( size_t );
extern "C" void free( void * );
#endif
#endif /* __glumystdlib_h_ */

View File

@@ -1,346 +0,0 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 1.1 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
** http://oss.sgi.com/projects/FreeB
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
** Window System(R) (Version 1.3), released October 19, 1998. This software
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
*/
/*
* arc.c++
*
*/
#include <stdio.h>
#include "glimports.h"
#include "mystdio.h"
#include "myassert.h"
#include "arc.h"
#include "bin.h"
#include "pwlarc.h"
#include "simplemath.h"
/* local preprocessor definitions */
#define ZERO 0.00001/*0.000001*/
const int Arc::bezier_tag = (1<<13);
const int Arc::arc_tag = (1<<3);
const int Arc::tail_tag = (1<<6);
/*--------------------------------------------------------------------------
* makeSide - attach a pwl arc to an arc and mark it as a border arc
*--------------------------------------------------------------------------
*/
void
Arc::makeSide( PwlArc *pwl, arc_side side )
{
assert( pwl != 0);
assert( pwlArc == 0 );
assert( pwl->npts > 0 );
assert( pwl->pts != 0);
pwlArc = pwl;
clearbezier();
setside( side );
}
/*--------------------------------------------------------------------------
* numpts - count number of points on arc loop
*--------------------------------------------------------------------------
*/
int
Arc::numpts( void )
{
Arc_ptr jarc = this;
int npts = 0;
do {
npts += jarc->pwlArc->npts;
jarc = jarc->next;
} while( jarc != this );
return npts;
}
/*--------------------------------------------------------------------------
* markverts - mark each point with id of arc
*--------------------------------------------------------------------------
*/
void
Arc::markverts( void )
{
Arc_ptr jarc = this;
do {
TrimVertex *p = jarc->pwlArc->pts;
for( int i=0; i<jarc->pwlArc->npts; i++ )
p[i].nuid = jarc->nuid;
jarc = jarc->next;
} while( jarc != this );
}
/*--------------------------------------------------------------------------
* getextrema - find axis extrema on arc loop
*--------------------------------------------------------------------------
*/
void
Arc::getextrema( Arc_ptr extrema[4] )
{
REAL leftpt, botpt, rightpt, toppt;
extrema[0] = extrema[1] = extrema[2] = extrema[3] = this;
leftpt = rightpt = this->tail()[0];
botpt = toppt = this->tail()[1];
for( Arc_ptr jarc = this->next; jarc != this; jarc = jarc->next ) {
if ( jarc->tail()[0] < leftpt ||
(jarc->tail()[0] <= leftpt && jarc->rhead()[0]<=leftpt)) {
leftpt = jarc->pwlArc->pts->param[0];
extrema[1] = jarc;
}
if ( jarc->tail()[0] > rightpt ||
(jarc->tail()[0] >= rightpt && jarc->rhead()[0] >= rightpt)) {
rightpt = jarc->pwlArc->pts->param[0];
extrema[3] = jarc;
}
if ( jarc->tail()[1] < botpt ||
(jarc->tail()[1] <= botpt && jarc->rhead()[1] <= botpt )) {
botpt = jarc->pwlArc->pts->param[1];
extrema[2] = jarc;
}
if ( jarc->tail()[1] > toppt ||
(jarc->tail()[1] >= toppt && jarc->rhead()[1] >= toppt)) {
toppt = jarc->pwlArc->pts->param[1];
extrema[0] = jarc;
}
}
}
/*-------------------------------------------------------------------------
* show - print to the stdout the vertices of a pwl arc
*-------------------------------------------------------------------------
*/
void
Arc::show()
{
#ifndef NDEBUG
_glu_dprintf( "\tPWLARC NP: %d FL: 1\n", pwlArc->npts );
for( int i = 0; i < pwlArc->npts; i++ ) {
_glu_dprintf( "\t\tVERTEX %f %f\n", pwlArc->pts[i].param[0],
pwlArc->pts[i].param[1] );
}
#endif
}
/*-------------------------------------------------------------------------
* print - print out the vertices of all pwl arcs on a loop
*-------------------------------------------------------------------------
*/
void
Arc::print( void )
{
Arc_ptr jarc = this;
#ifndef NDEBUG
_glu_dprintf( "BGNTRIM\n" );
#endif
do {
jarc->show( );
jarc = jarc->next;
} while (jarc != this);
#ifndef NDEBUG
_glu_dprintf("ENDTRIM\n" );
#endif
}
/*-------------------------------------------------------------------------
* isDisconnected - check if tail of arc and head of prev meet
*-------------------------------------------------------------------------
*/
int
Arc::isDisconnected( void )
{
if( pwlArc == 0 ) return 0;
if( prev->pwlArc == 0 ) return 0;
REAL *p0 = tail();
REAL *p1 = prev->rhead();
if( ((p0[0] - p1[0]) > ZERO) || ((p1[0] - p0[0]) > ZERO) ||
((p0[1] - p1[1]) > ZERO) || ((p1[1] - p0[1]) > ZERO) ) {
#ifndef NDEBUG
_glu_dprintf( "x coord = %f %f %f\n", p0[0], p1[0], p0[0] - p1[0] );
_glu_dprintf( "y coord = %f %f %f\n", p0[1], p1[1], p0[1] - p1[1] );
#endif
return 1;
} else {
/* average two points together */
p0[0] = p1[0] = (p1[0] + p0[0]) * 0.5;
p0[1] = p1[1] = (p1[1] + p0[1]) * 0.5;
return 0;
}
}
/*-------------------------------------------------------------------------
* neq_vert - assert that two 2D vertices are not equal
*-------------------------------------------------------------------------
*/
inline static int
neq_vert( REAL *v1, REAL *v2 )
{
return ((v1[0] != v2[0]) || (v1[1] != v2[1] )) ? 1 : 0;
}
/*-------------------------------------------------------------------------
* check - verify consistency of a loop, including
* 1) if pwl, no two consecutive vertices are identical
* 2) the circular link pointers are valid
* 3) the geometric info at the head and tail are consistent
*-------------------------------------------------------------------------
*/
int
Arc::check( void )
{
if( this == 0 ) return 1;
Arc_ptr jarc = this;
do {
assert( (jarc->pwlArc != 0) || (jarc->bezierArc != 0) );
if (jarc->prev == 0 || jarc->next == 0) {
#ifndef NDEBUG
_glu_dprintf( "checkjarc:null next/prev pointer\n");
jarc->print( );
#endif
return 0;
}
if (jarc->next->prev != jarc) {
#ifndef NDEBUG
_glu_dprintf( "checkjarc: pointer linkage screwed up\n");
jarc->print( );
#endif
return 0;
}
if( jarc->pwlArc ) {
#ifndef NDEBUG
assert( jarc->pwlArc->npts >= 1 );
assert( jarc->pwlArc->npts < 100000 );
/*
for( int i=0; i < jarc->pwlArc->npts-1; i++ )
assert( neq_vert( jarc->pwlArc->pts[i].param,
jarc->pwlArc->pts[i+1].param) );
*/
#endif
if( jarc->prev->pwlArc ) {
if( jarc->tail()[1] != jarc->prev->rhead()[1] ) {
#ifndef NDEBUG
_glu_dprintf( "checkjarc: geometric linkage screwed up 1\n");
jarc->prev->show();
jarc->show();
#endif
return 0;
}
if( jarc->tail()[0] != jarc->prev->rhead()[0] ) {
#ifndef NDEBUG
_glu_dprintf( "checkjarc: geometric linkage screwed up 2\n");
jarc->prev->show();
jarc->show();
#endif
return 0;
}
}
if( jarc->next->pwlArc ) {
if( jarc->next->tail()[0] != jarc->rhead()[0] ) {
#ifndef NDEBUG
_glu_dprintf( "checkjarc: geometric linkage screwed up 3\n");
jarc->show();
jarc->next->show();
#endif
return 0;
}
if( jarc->next->tail()[1] != jarc->rhead()[1] ) {
#ifndef NDEBUG
_glu_dprintf( "checkjarc: geometric linkage screwed up 4\n");
jarc->show();
jarc->next->show();
#endif
return 0;
}
}
if( jarc->isbezier() ) {
assert( jarc->pwlArc->npts == 2 );
assert( (jarc->pwlArc->pts[0].param[0] == \
jarc->pwlArc->pts[1].param[0]) ||\
(jarc->pwlArc->pts[0].param[1] == \
jarc->pwlArc->pts[1].param[1]) );
}
}
jarc = jarc->next;
} while (jarc != this);
return 1;
}
#define TOL 0.00001
inline long tooclose( REAL x, REAL y )
{
return (glu_abs(x-y) < TOL) ? 1 : 0;
}
/*--------------------------------------------------------------------------
* append - append a jordan arc to a circularly linked list
*--------------------------------------------------------------------------
*/
Arc_ptr
Arc::append( Arc_ptr jarc )
{
if( jarc != 0 ) {
next = jarc->next;
prev = jarc;
next->prev = prev->next = this;
} else {
next = prev = this;
}
return this;
}

View File

@@ -1,139 +0,0 @@
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and
* either this permission notice or a reference to
* http://oss.sgi.com/projects/FreeB/
* 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
* SILICON GRAPHICS, INC. 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.
*
* Except as contained in this notice, the name of Silicon Graphics, Inc.
* shall not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization from
* Silicon Graphics, Inc.
*/
/*
* arc.h
*
*/
#ifndef __gluarc_h_
#define __gluarc_h_
#include "myassert.h"
#include "bufpool.h"
#include "mystdio.h"
#include "types.h"
#include "pwlarc.h"
#include "trimvertex.h"
class Bin;
class Arc;
struct BezierArc;
typedef class Arc *Arc_ptr;
enum arc_side { arc_none = 0, arc_right, arc_top, arc_left, arc_bottom };
class Arc: public PooledObj { /* an arc, in two list, the trim list and bin */
public:
static const int bezier_tag;
static const int arc_tag;
static const int tail_tag;
Arc_ptr prev; /* trim list pointer */
Arc_ptr next; /* trim list pointer */
Arc_ptr link; /* bin pointers */
BezierArc * bezierArc; /* associated bezier arc */
PwlArc * pwlArc; /* associated pwl arc */
long type; /* curve type */
long nuid;
inline Arc( Arc *, PwlArc * );
inline Arc( arc_side, long );
Arc_ptr append( Arc_ptr );
int check( void );
int isMonotone( void );
int isDisconnected( void );
int numpts( void );
void markverts( void );
void getextrema( Arc_ptr[4] );
void print( void );
void show( void );
void makeSide( PwlArc *, arc_side );
inline int isTessellated() { return pwlArc ? 1 : 0; }
inline long isbezier() { return type & bezier_tag; }
inline void setbezier() { type |= bezier_tag; }
inline void clearbezier() { type &= ~bezier_tag; }
inline long npts() { return pwlArc->npts; }
inline TrimVertex * pts() { return pwlArc->pts; }
inline REAL * tail() { return pwlArc->pts[0].param; }
inline REAL * head() { return next->pwlArc->pts[0].param; }
inline REAL * rhead() { return pwlArc->pts[pwlArc->npts-1].param; }
inline long ismarked() { return type & arc_tag; }
inline void setmark() { type |= arc_tag; }
inline void clearmark() { type &= (~arc_tag); }
inline void clearside() { type &= ~(0x7 << 8); }
inline void setside( arc_side s ) { clearside(); type |= (((long)s)<<8); }
inline arc_side getside() { return (arc_side) ((type>>8) & 0x7); }
inline int getitail() { return type & tail_tag; }
inline void setitail() { type |= tail_tag; }
inline void clearitail() { type &= (~tail_tag); }
};
/*--------------------------------------------------------------------------
* Arc - initialize a new Arc with the same type and uid of
* a given Arc and a given pwl arc
*--------------------------------------------------------------------------
*/
inline
Arc::Arc( Arc *j, PwlArc *p )
{
prev = NULL;
next = NULL;
link = NULL;
bezierArc = NULL;
pwlArc = p;
type = j->type;
nuid = j->nuid;
}
/*--------------------------------------------------------------------------
* Arc - initialize a new Arc with the same type and uid of
* a given Arc and a given pwl arc
*--------------------------------------------------------------------------
*/
inline
Arc::Arc( arc_side side, long _nuid )
{
prev = NULL;
next = NULL;
link = NULL;
bezierArc = NULL;
pwlArc = NULL;
type = 0;
setside( side );
nuid = _nuid;
}
#endif /* __gluarc_h_ */

View File

@@ -1,172 +0,0 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 1.1 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
** http://oss.sgi.com/projects/FreeB
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
** Window System(R) (Version 1.3), released October 19, 1998. This software
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
*/
/*
* arcsorter.c++
*
*/
#ifndef __gluarcsorter_c_
#define __gluarcsorter_c_
#include "glimports.h"
#include "arc.h"
#include "arcsorter.h"
#include "subdivider.h"
ArcSorter::ArcSorter(Subdivider &s) : Sorter( sizeof( Arc ** ) ), subdivider(s)
{
}
int
ArcSorter::qscmp( char *, char * )
{
_glu_dprintf( "ArcSorter::qscmp: pure virtual called\n" );
return 0;
}
void
ArcSorter::qsort( Arc **a, int n )
{
Sorter::qsort( (void *) a, n );
}
void
ArcSorter::qsexc( char *i, char *j )// i<-j, j<-i
{
Arc **jarc1 = (Arc **) i;
Arc **jarc2 = (Arc **) j;
Arc *tmp = *jarc1;
*jarc1 = *jarc2;
*jarc2 = tmp;
}
void
ArcSorter::qstexc( char *i, char *j, char *k )// i<-k, k<-j, j<-i
{
Arc **jarc1 = (Arc **) i;
Arc **jarc2 = (Arc **) j;
Arc **jarc3 = (Arc **) k;
Arc *tmp = *jarc1;
*jarc1 = *jarc3;
*jarc3 = *jarc2;
*jarc2 = tmp;
}
ArcSdirSorter::ArcSdirSorter( Subdivider &s ) : ArcSorter(s)
{
}
int
ArcSdirSorter::qscmp( char *i, char *j )
{
Arc *jarc1 = *(Arc **) i;
Arc *jarc2 = *(Arc **) j;
int v1 = (jarc1->getitail() ? 0 : (jarc1->pwlArc->npts - 1));
int v2 = (jarc2->getitail() ? 0 : (jarc2->pwlArc->npts - 1));
REAL diff = jarc1->pwlArc->pts[v1].param[1] -
jarc2->pwlArc->pts[v2].param[1];
if( diff < 0.0)
return -1;
else if( diff > 0.0)
return 1;
else {
if( v1 == 0 ) {
if( jarc2->tail()[0] < jarc1->tail()[0] ) {
return subdivider.ccwTurn_sl( jarc2, jarc1 ) ? 1 : -1;
} else {
return subdivider.ccwTurn_sr( jarc2, jarc1 ) ? -1 : 1;
}
} else {
if( jarc2->head()[0] < jarc1->head()[0] ) {
return subdivider.ccwTurn_sl( jarc1, jarc2 ) ? -1 : 1;
} else {
return subdivider.ccwTurn_sr( jarc1, jarc2 ) ? 1 : -1;
}
}
}
}
ArcTdirSorter::ArcTdirSorter( Subdivider &s ) : ArcSorter(s)
{
}
/*----------------------------------------------------------------------------
* ArcTdirSorter::qscmp -
* compare two axis monotone arcs that are incident
* to the line T == compare_value. Determine which of the
* two intersects that line with a LESSER S value. If
* jarc1 does, return 1. If jarc2 does, return -1.
*----------------------------------------------------------------------------
*/
int
ArcTdirSorter::qscmp( char *i, char *j )
{
Arc *jarc1 = *(Arc **) i;
Arc *jarc2 = *(Arc **) j;
int v1 = (jarc1->getitail() ? 0 : (jarc1->pwlArc->npts - 1));
int v2 = (jarc2->getitail() ? 0 : (jarc2->pwlArc->npts - 1));
REAL diff = jarc1->pwlArc->pts[v1].param[0] -
jarc2->pwlArc->pts[v2].param[0];
if( diff < 0.0)
return 1;
else if( diff > 0.0)
return -1;
else {
if( v1 == 0 ) {
if (jarc2->tail()[1] < jarc1->tail()[1]) {
return subdivider.ccwTurn_tl( jarc2, jarc1 ) ? 1 : -1;
} else {
return subdivider.ccwTurn_tr( jarc2, jarc1 ) ? -1 : 1;
}
} else {
if( jarc2->head()[1] < jarc1->head()[1] ) {
return subdivider.ccwTurn_tl( jarc1, jarc2 ) ? -1 : 1;
} else {
return subdivider.ccwTurn_tr( jarc1, jarc2 ) ? 1 : -1;
}
}
}
}
#endif /* __gluarcsorter_c_ */

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