Compare commits

...

299 Commits

Author SHA1 Message Date
Brian Paul
cd10996d4f progs/util: remove extfuncs.h (we use GLEW instead) 2009-07-17 14:43:29 -06:00
Brian Paul
ee0b1bc7d3 progs/glsl: finish conversion to GLEW
This is a follow-on to b799af91d5.
Remove _func function suffix and unneeded #includes.
2009-07-17 13:23:11 -06:00
Brian Paul
a77b455af0 mesa: set version to 7.5 2009-07-17 12:40:48 -06:00
Brian Paul
71b9e10291 mesa: set version to 7.5 2009-07-17 12:40:44 -06:00
Brian Paul
7fd3674672 docs: set date for 7.5 release 2009-07-17 12:40:24 -06:00
Brian Paul
27587f46e5 docs: news entry for 7.5 release 2009-07-17 09:40:59 -06:00
Brian Paul
8c6e81f97d docs: update links to Gallium wiki page on freedesktop.org 2009-07-17 09:40:59 -06:00
José Fonseca
2ba98efdf6 python/retrace: Process the call no passed to --to option inclusively. 2009-07-16 19:34:44 +01:00
José Fonseca
cf7e8fbc2e python/retrace: Dump the surface copy contents. 2009-07-16 19:32:40 +01:00
José Fonseca
5807ccb41b python/retrace: Flush stdout before calling the pipe driver.
So that messages are in sync with stderr.
2009-07-16 19:31:36 +01:00
José Fonseca
d4e6df9ab6 mesa: Fix logbase2.
It was providing 1 too many for non power two values.
2009-07-16 19:20:25 +01:00
José Fonseca
0c4350790a python: Hack to prevent segmentation faults when python exits. 2009-07-16 11:22:56 +01:00
José Fonseca
4e1e18a772 wgl: Expose pipe_screen/pipe_context via an extension. 2009-07-16 11:22:56 +01:00
José Fonseca
3ab3209a1f python: Obtain pipe_screen/pipe_context from the system's OpenGL driver. 2009-07-16 11:22:56 +01:00
Luca Barbieri
6b7b13b5eb softpipe: limit blend results to [0,1] 2009-07-15 11:34:36 -06:00
Brian Paul
d970313b66 Fix state flag dependencies for fixed function fragment program updates.
I started looking into why _NEW_ARRAY punishes us, and while annotating
dependencies noticed that a bunch of dependencies were missing.

(cherry picked from master, commit e5f63c403b)
2009-07-15 11:12:44 -06:00
José Fonseca
0474b5cb2a python/retrace: Interpret surface_copy. 2009-07-15 16:02:39 +01:00
José Fonseca
c68f659be3 python/samples: Use PIPE_FORMAT_Z16_UNORM instead of PIPE_FORMAT_Z32_UNORM.
More common. True fix would be to use whatever the screen supports though.
2009-07-15 16:02:39 +01:00
Keith Whitwell
fdeb778990 mesa: recognize and eliminate repeated error messages 2009-07-15 13:31:51 +01:00
Keith Whitwell
59de430de7 mesa: split out errorstring switch from _mesa_error
Move a chunk of code out of _mesa_error()
2009-07-15 13:31:51 +01:00
Keith Whitwell
df5f7a6761 mesa: remove dead code in _mesa_error
Remove early and unused snprintf and where[] string.
2009-07-15 13:31:51 +01:00
Keith Whitwell
6c9d8a6f24 mesa: don't call getenv every time _mesa_error is called
Buggy apps can generate thousands of mesa_error calls.  Don't need
to keep calling getenv to retreive the same MESA_DEBUG string each
time.
2009-07-15 13:31:50 +01:00
Brian Paul
9aca6769df mesa: fix texture border color code for glPopAttrib()
The texture object's border color used to be stored as GLchan but it's
been GLfloat for a while now.
2009-07-14 14:28:01 -06:00
Jakob Bornecrantz
26e58a42b0 progs/tests: Use compressed texture in mipmap_comp_tests 2009-07-14 17:11:07 +01:00
Jakob Bornecrantz
b0a17581e2 progs/tests: Tests more views in mipmap_comp_tests 2009-07-14 17:11:05 +01:00
Jakob Bornecrantz
a36b9987cd progs/tests: Add yet another mipmap test 2009-07-14 17:11:01 +01:00
Brian Paul
6ec955efaf mesa: regenerated enums.c file 2009-07-14 07:58:43 -06:00
José Fonseca
7325c1ebc8 scons: Monkey patch os.spawnve on Windows to become thread safe.
See also:
- http://bugs.python.org/issue6476
- http://scons.tigris.org/issues/show_bug.cgi?id=2449
2009-07-14 12:21:25 +01:00
José Fonseca
4ed1de8b84 mesa: Report the true face number when flushing. 2009-07-14 12:20:43 +01:00
Peteri Andras
680f7d09b0 r128: fix two-sided lighting segfault seen in GLUT's olight demo 2009-07-13 08:04:08 -06:00
Ian Romanick
022e8e582e intel: Bump driver data, add RC3 tag 2009-07-12 21:07:38 -07:00
Zack Rusin
1c1307e7c5 gallium: compare the actual register, not all the inputs
otherwise we decrement indexes for all registers
2009-07-11 13:48:41 -04:00
Brian Paul
cff2126f52 tgsi: update some assertions 2009-07-10 16:26:09 -06:00
Brian Paul
a79586ce18 tgsi: tgsi: add semantic_names[] string for TGSI_SEMANTIC_FACE
Same story as in the tgsi_dump.c code (see prev commit).
2009-07-10 15:44:48 -06:00
Brian Paul
f01af4dbd2 tgsi: add semantic_names[] string for TGSI_SEMANTIC_FACE
Fixes TGSI dump output when front/back-face register is declared.

Also, add some assertions to make sure the semantic/interpolate string
arrays have as many elements as there are tokens in the p_shader_tokens.h
file.  That should catch problems like this in the future.
2009-07-10 15:41:26 -06:00
Brian Paul
762c1d11ff st/mesa: implement indirect addressing for destination registers 2009-07-10 13:09:09 -06:00
Brian Paul
baa7ff47d5 tgis: implement indirect addressing for destination registers
Includes the TGSI interpreter, but not the SSE/PPC/etc code generators.
2009-07-10 13:09:09 -06:00
Brian Paul
ca1b71b78d vbo: fix vbo/dlist memory leak
Based on a patch by kristof.ralovich@gmail.com
2009-07-10 13:09:09 -06:00
Brian Paul
6ff1a5385e demos: set 4th component of texcoord to 1.0
Avoid potential randomness in resulting texcoords.
2009-07-10 13:09:09 -06:00
Michel Dänzer
cade071d52 Remove stale reference to non-Gallium nouveau driver from configure.ac. 2009-07-10 14:49:46 +02:00
Ian Romanick
fcd3572edf mesa: From float type modifier from values to large for singles
The values 2147483648.0 and 4294967294.0 are too larget to be stored in single
precision floats.  Forcing these to be singles causes bits to be lost, which
results in errors in some pixel transfer tests.

This fixes bug #22344.
(cherry picked from commit 70e72070fc)
2009-07-09 16:07:05 -07:00
Brian Paul
78af70be37 docs: document gl_TextureMatrix[i][j] array indexing bug fix 2009-07-09 08:04:07 -06:00
Brian Paul
c86b076668 glsl: do const parameter optimization for array element actual parameters
When a function parameter is const-qualified we can avoid making a copy
of the actual parameter (we basically do a search/replace when inlining).
This is now done for array element params too, resulting in better code
(fewer MOV instructions).

We should allow some other types of function arguments here but let's be
conservative for the moment.
2009-07-09 07:58:50 -06:00
Brian Paul
abdb0fdcc0 glsl: fix incorrect indexing for gl_TextureMatrix[i][j]
The two indexes were mixed up when accessing a row of a matrix in an array
of matrices.
2009-07-09 07:57:29 -06:00
Brian Paul
36e906aad6 docs: document glMaterial/glShadeModel display list optimization 2009-07-08 14:14:03 -06:00
Brian Paul
4adc9b4a5b mesa: only use fallback texture when using shaders, not fixed-function (take two)
The semantics are a little different for shaders vs. fixed-function when
trying to use an incomplete texture.  The fallback texture returning
(0,0,0,1) should only be used with shaders.  For fixed function, the texture
unit is truly disabled/ignored.

Fixes glean fbo test regression.
(cherry picked from commit 01e16befd4)
(cherry picked from commit 51325f44d1)
[anholt: squashed these two together from master, skipping the mess in between]
2009-07-07 16:02:45 -07:00
Zack Rusin
7b861b9b9e gallium: fixup register indexes for fog/frontface/point coord 2009-07-07 12:48:50 -07:00
Michel Dänzer
71633abafc gallium: Fixes for clobbering stencil values in combined depth/stencil textures.
Also fix one case where a 32 bit depth value was incorrectly converted to a
combined depth/stencil value.
2009-07-07 14:49:52 +02:00
Michel Dänzer
25b492b976 GLX/DRI1: Mark GLX visuals with depth != screen depth non-conformant.
Such visuals are subject to automatic compositing in the X server, so DRI1
can't render to them properly.
2009-07-07 13:59:59 +02:00
Michel Dänzer
96601ec8e0 gallium: Only set FRONT_STATUS_COPY_OF_BACK if there is a back buffer.
Fixes potential crash when SwapBuffers is called but there's no back buffer.
2009-07-07 12:17:04 +02:00
Zack Rusin
a4d952358d gallium: more fog extraction fixes
fix the cases when fog coord/front face/point coord are used in the same
shader.
2009-07-06 21:35:15 -04:00
Ian Romanick
7fb4becf98 demos: Fix vsync checking in glxgears
Of course glXGetVideoSyncSGI doesn't return the swap interval.  The feature
only exists in the Mesa extension... which is the whole reason I created the
Mesa extension!  Note that the Mesa extension allows drivers to default to a
swap interval of 0.  If the Mesa extension exists, use its value.  Only
consider the SGI extension when the Mesa extension is not available.

Fixes bug #22604.
2009-07-06 11:42:12 -07:00
José Fonseca
1068c15c61 wgl: Make the stw_framebuffer destructions threadsafe.
Ensure no other thread is accessing a framebuffer when it is being destroyed by
acquiring both the global and per-framebuffer mutexes. Normal access only
needs the global lock to walk the linked list and acquire the per-framebuffer
mutex.
2009-07-06 18:23:37 +01:00
José Fonseca
6f4167c8a2 wgl: Check for multiple threads before GET_CURRENT_CONTEXT.
Fixes wglthreads -- the 2nd thread MakeCurrent call was trying to flush
the first thread context while still in use.
2009-07-06 17:40:08 +01:00
José Fonseca
5470a67335 wgl: Listen to WM_WINDOWPOSCHANGED instead of WM_SIZE messages.
According to
http://blogs.msdn.com/oldnewthing/archive/2008/01/15/7113860.aspx
WM_SIZE is generated from WM_WINDOWPOSCHANGED by DefWindowProc so it
can be masked out by the application.

Also there were some weird bogus WM_SIZE 0x0 messages when starting
sharedtex_mt which we don't get like this.
2009-07-06 17:08:37 +01:00
Roland Scheidegger
fc6e02ce62 i965: fix fetching constants from constant buffer in glsl path
the driver used to overwrite grf0 then use implicit move by send instruction
to move contents of grf0 to mrf1. However, we must not overwrite grf0 since
it's still used later for fb write.
Instead, do the move directly do mrf1 (we could use implicit move from another
grf reg to mrf1 but since we need a mov to encode the data anyway it doesn't
seem to make sense).
I think the dp_READ/WRITE_16 functions may suffer from the same issue.
While here also remove unnecessary msg_reg_nr parameter from the dataport
functions since always message register 1 is used.
2009-07-04 15:35:07 +02:00
Eric Anholt
c30f23c123 i965: Remove bad constant buffer constant-reg-already-loaded optimization.
Thanks to branching, the state of c->current_const[i].index at the point
of emitting constant loads for this instruction may not match the actual
constant currently loaded in the reg at runtime.  Fixes a regression in my
GLSL program for idr's class since b58b3a786a.
2009-07-04 15:32:56 +02:00
Michel Dänzer
94e1117c9b intel: Also update stencil bits in intel_update_wrapper().
Fixes assertion failure when binding depth/stencil texture to FBO stencil
attachment.
2009-07-03 17:54:34 +02:00
Keith Whitwell
f580494bef progs: revert damage to progs/SConscript from recent compressed texture commit 2009-07-03 16:40:03 +01:00
Keith Whitwell
b928d18398 mesa/shaders: fix gl_NormalMatrix state parameters
gl_NormalMatrix is the inverse transpose of the modelview matrix, but
as every matrix here needs to be transposed, we end up with
{MODELVIEW_MATRIX, INVERSE}.
2009-07-03 14:31:07 +01:00
Keith Whitwell
aa98575ebb st/wgl: don't advertise WGL_EXT_swap_interval string
This is a tweak to a previous fix -- it's not necessary to actually
advertise this extension to prevent these games from crashing -- they
ignore the extension string anyway. It's sufficient to just have
GetProcAddress return some dummy function addresses for SwapInterval.

Given we don't really implement this funcitonality, this is a better
fix.
2009-07-03 14:31:06 +01:00
José Fonseca
cffe7c8bd0 wgl: Lookup framebuffers by HWND whenever possible.
Some applications create several HDCs for the same window, so spite the WGL
API is geared towards HDCs it is not reliable searching by HDC.
2009-07-03 14:21:55 +01:00
José Fonseca
2a2236606f mesa: Assume depth textures have a single level unless told otherwise. 2009-07-02 17:24:50 +01:00
Keith Whitwell
588c862571 mesa: s/TRUE/GL_TRUE
Fix compile breakage on Linux.
2009-07-02 14:44:06 +01:00
Keith Whitwell
798cd2a98d glapi: ensure _mesa_lookup_prim_by_nr() is not clobbered on regeneration
Propogate changes to enums.c back up to the python source.
2009-07-02 13:33:20 +01:00
Keith Whitwell
1668a679c4 Merge commit 'origin/dlist-statechange-shortcircuit' into mesa_7_5_branch
Conflicts:
	progs/trivial/Makefile

Pull in a minimal version of statechange shortcircuiting in display
list compilation.  This affects only glMaterial and glShadeModel state,
and includes quite a few tests to exercise various tricky cases.

If this goes well, will consider extending to all state in the future.
2009-07-02 13:29:46 +01:00
Keith Whitwell
b3e8e1cd4c mesa: ensure UsesFogFragCoord value is set for non-glsl shaders
With recent changes to support frontfacing in glsl, it is necessary
to ensure that the UsesFogFragCoord value is accurate in all shaders.
We were previously not setting it for fixed-function and ARB_fs shaders.
2009-07-02 11:28:56 +01:00
Keith Whitwell
1fa4cde757 mesa/vbo: fix compile and replay of nodes ending in a FALLBACK
Where vbo save nodes are terminated with a call to DO_FALLBACK(), as in
the case of a recursive CallList which is itself within a Begin/End pair,
there two problems:
1) The display list node's primitive information was incorrect, stating
the cut-off prim had zero vertices
2) On replay, we would get confused by a primitive that started in a
node, but was terminated by individual opcodes.

This change fixes the first problem by correctly terminating the last
primitive on fallback, and the second by forcing the display list to
use the Loopback path, converting all nodes into immediate-mode rendering.

The loopback fix is a performance hit, but avoiding this would require
a fairly large rework of this code.
2009-06-30 19:52:44 +01:00
Keith Whitwell
70ae7ba818 mesa/dlist: fixes and improvements for material caching
Only short-circuit material call if *all* statechanges from this call
are cached.  Some material calls (eg with FRONT_AND_BACK) change more
than one piece of state -- need to check all of them before returning.

Also, Material calls are legal inside begin/end pairs, so don't need
to be as careful about begin/end state as with regular statechanges
(like ShadeModel) when caching.  Take advantage of this and do better
caching.
2009-06-30 18:40:20 +01:00
Keith Whitwell
c48c01c9e7 progs/trivial: add dlist-mat-tri.c 2009-06-30 18:37:34 +01:00
Keith Whitwell
1ca836f0de progs/trivial: add test case for short-circuiting material changes
Similar to dlist-tri-flat-tri, but using glMaterial calls, which
have the extra property of being legal within Begin/End calls.
2009-06-30 18:17:39 +01:00
Keith Whitwell
d6c2347d79 mesa/dlist: don't cache state which may not be replayed on CallList
Statechanges which occur before the first End in a display list may
not be replayed when the list is called, in particular if it is called
from within a begin/end pair.

Recognize vulnerable statechanges and do not use them to fill in the
state cache.
2009-06-30 17:10:56 +01:00
Keith Whitwell
09a3a28fc8 progs/trivial: add dlist-flat-tri.c
State-change functions which precede the first call to glEnd() in
a compiled list are vulnerable to not being executed when that list
is called.

In particular this can happen if a list is invoked from within a
begin/end pair, as in this example.
2009-06-30 17:06:50 +01:00
Keith Whitwell
7e91d035b9 mesa/dlist: invalidate cached dlist compile state after CallList
When compiling a display list containing a CallList, it is necessary to
invalidate any assumption about the GL state after the recursive call
completes.
2009-06-30 17:04:11 +01:00
Keith Whitwell
2e570be852 progs/trivial: add dlist-recursive-call
When one display list calls another display list, it is possible
that the calling display list makes state-changes or other actions which
invalidate any attempt at caching or state-change elimination in the
calling list.

This test exercises one such case, where the called list consists of just
a single glShadeModel() call.
2009-06-30 17:02:16 +01:00
Keith Whitwell
1730eaa2a2 dlist-tri-flat-tri: make tri render differently if flatshade not enabled
When testing flat-shading, it helps to specify per-vertex colors so
that you can distinguish between flat & smooth shading.
2009-06-30 16:57:21 +01:00
Keith Whitwell
4147bb24d4 Merge branch 'mesa_7_5_branch' into dlist-statechange-shortcircuit
Need this to pick up fixes for per-vertex materials.
2009-06-30 16:28:54 +01:00
Keith Whitwell
6af783bea0 progs/trivial: add test case for lighting plus per-vertex materials
Exercise material-within-begin/end case.
2009-06-30 16:19:23 +01:00
Keith Whitwell
a9ae89d104 progs/isosurf: add materials mode for glVertex + TRISTRIP 2009-06-30 16:14:08 +01:00
Keith Whitwell
6dfb89e4a0 mesa: remove whitespace 2009-06-30 16:14:05 +01:00
Keith Whitwell
cea259f039 mesa: remove dead constant pointsize code from ffvertex_prog.c 2009-06-30 16:13:58 +01:00
Keith Whitwell
79047cc1dd mesa: remove dead vertex fog code from ffvertex_prog.c 2009-06-30 16:13:53 +01:00
Keith Whitwell
f6c8ca06f6 mesa: fix material inputs in ffvertex_prog.c
Varying material inputs were not being picked up from the same slots
where the VBO code is currently placing them (GENERIC0 and above).
Most often they were just being ignored.
2009-06-30 16:13:22 +01:00
Arthur HUILLET
4c31632817 mesa: fix transform_points_3d_no_rot using undefined values in %xmm0
Signed-off-by: Arthur HUILLET <arthur.huillet@free.fr>
2009-06-30 08:43:23 -06:00
Kristof Ralovich
fa5b0364f9 glx: plug a leak
Swrast was missing a free for the culmination of driConcatConfigs.

Use free(), not _mesa_free() since we shouldn't be calling any Mesa
functions from the GLX code.  driConcatConfigs() should probably use
regular malloc/free to be consistant but the Mesa functions just wrap
the libc functions anyway.
2009-06-30 08:43:22 -06:00
Brian Paul
52f895df51 glx: fix null pointer dereference segfault (bug 22546) 2009-06-30 08:43:22 -06:00
Keith Whitwell
14a2b5445a progs/util: make sure function pointers are initialized
Call Init() from CompileShaderFile, was previously only called for the
Text version of this function.
2009-06-30 15:41:43 +01:00
José Fonseca
6e09c1fd08 mesa: Set FLUSH_EXPLICIT_BIT flags when calling FlushMappedBufferRange.
As prescribed by ARB_map_buffer_range.
2009-06-30 15:33:53 +01:00
José Fonseca
18a6f0f1a7 util: Set PIPE_BUFFER_USAGE_FLUSH_EXPLICIT when calling buffer_flush_mapped_range. 2009-06-30 15:33:53 +01:00
José Fonseca
4ffe2844a4 gallium: New PIPE_BUFFER_USAGE_FLUSH_EXPLICIT flag for buffer_flush_mapped_range.
When a buffer was mapped for write and no explicit flush range was provided
the existing semantics were that the whole buffer would be flushed, mostly
for backwards compatability with non map-buffer-range aware code.

However if the buffer was mapped/unmapped with nothing really written --
something that often happens with the vbo -- we were unnecessarily assuming
that the whole buffer was written.

The new PIPE_BUFFER_USAGE_FLUSH_EXPLICIT flag (based from ARB_map_buffer_range
's GL_MAP_FLUSH_EXPLICIT_BIT flag) allows to clearly distinguish the
legacy usage from the nothing written usage.
2009-06-30 15:33:53 +01:00
Jakob Bornecrantz
578230dbbf st/gl: Add stubs for CompressedTexSubImage[1D|3D] 2009-06-30 14:11:49 +02:00
Jakob Bornecrantz
a4fd94a54a st/gl: Add support for glCompressedTexSubImage 2009-06-30 14:11:45 +02:00
Jakob Bornecrantz
ba7f45ac0c progs/tests: Add tests for glCompressedTexSubImage 2009-06-30 14:11:29 +02:00
José Fonseca
f2de2d5f37 util: Increase OutputDebugStringA to 4k.
According to http://unixwiz.net/techtips/outputdebugstring.html that's
how big the buffer is.

The 512bytes limitation is in kernel mode.
2009-07-01 19:10:50 +01:00
José Fonseca
e2a8ef4430 mesa: Unbind depth/stencil surface from pipe_framebuffer when none is attached. 2009-07-01 19:10:49 +01:00
Keith Whitwell
6c913411d3 st/wgl: dummy implementation of wgl swapinterval extension
Required as some applications
retrieve and call these functions regardless of the fact that we
don't advertise the extension and further more the results of
wglGetProcAddress are NULL.
2009-07-01 17:37:15 +01:00
Zack Rusin
1c04731b87 gallium: fix the front face semantics
mesa allocates both frontface and pointcoord registers within the fog
coordinate register, by using swizzling. to make it cleaner and easier
for drivers we want each of them in its own register. so when doing
compilation from the mesa IR to tgsi allocate new registers for both
and add new semantics to the respective declarations.
2009-07-01 10:45:55 -04:00
José Fonseca
e8c4663c11 wgl: Optimize wglGetProcAddress.
Do linear search only if prefix matches.
2009-07-01 10:03:59 +01:00
Eric Anholt
c72261f2a8 i915: Fix assertion failure on remapping a non-BO-backed VBO.
Failure to set the obj->Pointer back to null tripped up the assertion.
Bug #22428.
(cherry picked from commit 57a06d3a48)
2009-06-30 13:29:37 -07:00
Jon TURNEY
57955451f8 xdemos: Fix xdemos which default to using display :0.0 to default to $DISPLAY
Fix xdemos which default to using display :0.0 to default to $DISPLAY,
this is kind of irritating when testing on a display other than :0.0

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-06-30 13:58:21 -06:00
Keith Whitwell
e5cb11adda mesa/vbo: fix compile and replay of nodes ending in a FALLBACK
Where vbo save nodes are terminated with a call to DO_FALLBACK(), as in
the case of a recursive CallList which is itself within a Begin/End pair,
there two problems:
1) The display list node's primitive information was incorrect, stating
the cut-off prim had zero vertices
2) On replay, we would get confused by a primitive that started in a
node, but was terminated by individual opcodes.

This change fixes the first problem by correctly terminating the last
primitive on fallback, and the second by forcing the display list to
use the Loopback path, converting all nodes into immediate-mode rendering.

The loopback fix is a performance hit, but avoiding this would require
a fairly large rework of this code.
2009-06-30 19:59:38 +01:00
Keith Whitwell
53f8dccd0c progs/trivial: test case for dlist statechange elimination
Creates a display list with redundant call to glShadeModel.

View dlist contents with MESA_VERBOSE=list
2009-06-30 12:20:24 +01:00
Keith Whitwell
00438bb94a mesa/dlist: restore missing SAVE_FLUSH_VERTICES in save_ShadeModel
Reorganization of ShadeModel to avoid flushing vertices too often
ended up never flushing vertices due to omitted line of code.
2009-06-30 12:19:11 +01:00
Keith Whitwell
0846c88ec3 mesa/vbo: use _lookup_prim_by_nr for debugging
Switch over to specialized enum lookup for primitives
2009-06-30 12:16:41 +01:00
Keith Whitwell
aa688d1579 mesa: add debug printer for primitive name
Add a simple version of _mesa_lookup_enum_by_nr() which expects a primitive
enum (GL_POINTS..GL_POLYGON).  This avoids some annoying duplicates
when looking up primitives, such as the GL_FALSE/GL_POINTS clash.
2009-06-30 12:13:59 +01:00
Brian Paul
8d24160a40 progs/glsl: link with GLEW library
(cherry picked from commit b1f2f92d9b)
2009-06-30 11:47:51 +01:00
Keith Whitwell
47173cf67f mesa/dlist: shortcircuit some redundant statechanges at compile time
Currently, state-changes in mesa display lists are more or less
a verbatim recording of the GL calls made during compilation.

This change introduces a minor optimization to recognize and eliminate
cases where the application emits redundant state changes, eg:

  glShadeModel( GL_FLAT );
  glBegin( prim )
  ...
  glEnd()
  glShadeModel( GL_FLAT );
  glBegin( prim )
  ...
  glEnd()

The big win is when we can eliminate all the statechanges between two
primitive blocks and combine them into a single VBO node.

This commit implements state-change elimination for Material and ShadeModel
only.  This is enough to make a start on debugging, etc.
2009-06-30 09:55:33 +01:00
Brian Paul
4e43126a59 intel: added null ptr check
This fixes a segfault seen with piglit's fdo20701 test.
2009-06-29 15:26:28 -06:00
Brian Paul
b1f2f92d9b progs/glsl: link with GLEW library 2009-06-29 10:32:04 -06:00
Keith Whitwell
9014f475ff progs/util: make sure function pointers are initialized
Call Init() from CompileShaderFile, was previously only called for the
Text version of this function.
2009-06-29 16:07:14 +01:00
Keith Whitwell
b799af91d5 progs/glsl: compile with scons and glew
Get most of these working with scons.
2009-06-29 14:15:08 +01:00
José Fonseca
9a5ee12434 scons: Don't raise an exception when DXSDK is not found.
Unfortunately scons does not check if a tool exists before it invokes
its generate function.
2009-06-29 12:56:47 +01:00
José Fonseca
bb8f3090ba scons: Disable optimizations only for gcc-4.2
gcc-4.2's optimizer has a strange bug where it looses code from inner
loops in certain situations. For example, if the appearently innocent
looking code below is compiled with gcc-4.2 -S -O1, the inner loop's
code is missing from the outputed assembly.

   struct Size {
      unsigned width;
   };

   struct Command {
      unsigned length;
      struct Size sizes[32];
   };

   extern void emit_command(void *command, unsigned length);

   void
   create_surface( struct Size size, unsigned faces, unsigned levels)
   {
      struct Command cmd;
      unsigned face;
      unsigned level;

      cmd.length = faces*levels*sizeof(cmd.sizes[0]);

      for(face = 0; face < faces; ++face) {
	 for(level = 0; level < levels; ++level) {
	    cmd.sizes[face*levels + level] = size;
	    // This should generate a shrl statement, but the whole for body
	    // disappears in gcc-4.2 -O1/-O2/-O3!
	    size.width >>= 1;
	 }
      }

      emit(&cmd, sizeof cmd.length + cmd.length);
   }

Note that this is not specific to MinGW's gcc-4.2 crosscompiler (the
version typically found in debian/ubuntu's mingw32 packages). gcc-4.2 on
Linux also displays the same error. gcc-4.3 and above gets this
correctly though.

Updated MinGW debian packages with gcc-4.3 are available from
http://people.freedesktop.org/~jrfonseca/debian/pool/main/m/
2009-06-28 11:12:22 +01:00
José Fonseca
72ad039d19 scons: Use -Bsymbolic linker option.
This prevents the error

  relocation R_X86_64_PC32 against symbol `_gl_DispatchTSD' can not be used when making a shared object; recompile with -fPIC

when building on x86_64 architecture.
2009-06-28 10:54:23 +01:00
Brian Paul
418987ff05 docs: detect when too many varying vars are used 2009-06-26 16:54:44 -06:00
Brian Paul
21320b24c5 glsl: check number of varying variables against the limit
Link fails if too many varying vars.

(cherry picked from master, commit cc58fbcf2c)
2009-06-26 16:53:46 -06:00
Brian Paul
4181a107cb docs: fix typos, remove old text from relnotes file 2009-06-26 16:47:57 -06:00
Brian Paul
2a41df86a3 docs: bring over news updates from 7.4 branch 2009-06-26 16:46:21 -06:00
Brian Paul
318122b60a docs: bring in 7.4.3 and 7.4.4 release notes, news 2009-06-26 16:45:54 -06:00
Brian Paul
dd585db687 docs: increase max varying vars to 16 2009-06-26 16:41:54 -06:00
Brian Paul
f08bebfe24 mesa: raise MAX_VARYING (number of shader varying vars) to 16
16 is the limit for now because of various 32-bit bitfields.

(cherry picked from master, commit 4e762395ef)
2009-06-26 16:41:04 -06:00
Ian Romanick
2d86503471 intel / DRI2: Additional flush of fake front-buffer to real front-buffer
To maintain correctness, the server will copy the real front-buffer to
a newly allocated fake front-buffer in DRI2GetBuffersWithFormat.
However, if the DRI2GetBuffersWithFormat is triggered by glViewport,
this will copy stale data into the new buffer.  Fix this by flushing
the current fake front-buffer to the real front-buffer in
intel_viewport.

Fixes bug #22288.
2009-06-26 13:32:26 -07:00
Brian Paul
077a06c140 mesa: bump version to 7.5-rc4 2009-06-26 13:16:34 -06:00
Brian Paul
62ad606065 docs: document for/continue bug fix 2009-06-26 13:16:34 -06:00
Brian Paul
928e1ce47f cell: PIPE_CAP_TGSI_CONT_SUPPORTED query 2009-06-26 13:16:34 -06:00
Brian Paul
af7fb892d8 softpipe: PIPE_CAP_TGSI_CONT_SUPPORTED query 2009-06-26 13:16:34 -06:00
Brian Paul
f5dc352e5f gallium: added PIPE_CAP_TGSI_CONT_SUPPORTED 2009-06-26 13:16:34 -06:00
Brian Paul
e80ecdf659 glsl: move/simplify error checking for 'return' statements 2009-06-26 13:16:34 -06:00
Brian Paul
8e6dd8bf79 glsl: overhaul 'return' statement handling
A new node type (SLANG_OPER_RETURN_INLINED) is used to denote 'return'
statements inside inlined functions which need special handling.

All glean glsl1 tests pass for EmitContReturn=FALSE and TRUE.
2009-06-26 13:16:34 -06:00
Brian Paul
aa48becb82 glsl: predicate assignments according to __returnFlag
Fixes glean "function with early return (3)" case (when EmitContReturn=FALSE).
2009-06-26 13:16:34 -06:00
Brian Paul
16787c513b glsl: added slang_variable::is_global field 2009-06-26 13:16:34 -06:00
Brian Paul
ac05996b81 glsl: silence a problem warning 2009-06-26 13:16:34 -06:00
Brian Paul
0efd25b502 glsl: code refactoring for return statements 2009-06-26 13:16:34 -06:00
Brian Paul
2ae297c318 glsl: fix assorted regressions related to early-return-removal 2009-06-26 13:16:34 -06:00
Brian Paul
ddf64be258 glsl: comments, field reordering 2009-06-26 13:16:34 -06:00
Brian Paul
f652f15e6d glsl: rework loop nesting code 2009-06-26 13:16:34 -06:00
Brian Paul
dd453fa37c glsl: remove test for loop unrolling when we hit conditional cont/break
This is no longer needed since we added the new
_slang_loop_contains_continue_or_break() function/test.
2009-06-26 13:16:34 -06:00
Brian Paul
2f1c5c58b3 glsl: checkpoint: predicate __retVal = expr with __returnFlag
The glean "function with early return (1)" test passes now.
2009-06-26 13:16:34 -06:00
Brian Paul
65eaafee25 glsl: use new helper functions in _slang_gen_logical_and/or() 2009-06-26 13:16:33 -06:00
Brian Paul
e139434d44 glsl: add comments 2009-06-26 13:16:33 -06:00
Brian Paul
b04605d544 glsl: checkpoint: replace 'return' with __returnFlag=true;
Needed for "remove early returns" transformation.
2009-06-26 13:16:33 -06:00
Brian Paul
515513b409 glsl: fix up scoping for parent/children in slang_operation_copy()
This will need more testing, but no regressions seen so far.
2009-06-26 13:16:33 -06:00
Brian Paul
09313043e7 glsl: fix uninitialized var in _slang_gen_for_without_continue() 2009-06-26 13:16:33 -06:00
Brian Paul
5951ab311d glsl: added slang_operation_free_children() 2009-06-26 13:16:33 -06:00
Brian Paul
e5b53c071b glsl: added slang_oper_num_children() helper 2009-06-26 13:16:33 -06:00
Brian Paul
3c6480ea42 glsl: check-point: declare _returnFlag 2009-06-26 13:16:33 -06:00
Brian Paul
fc0896b50b glsl: added slang_operation_insert_child() 2009-06-26 13:16:33 -06:00
Brian Paul
f4b1a69b7d glsl: use slang_generate_declaration() to consolidate some code 2009-06-26 13:16:33 -06:00
Brian Paul
454a717d94 glsl: remove obsolete comment 2009-06-26 13:16:33 -06:00
Brian Paul
02edc8da36 st/mesa: query PIPE_CAP_TGSI_CONT_SUPPORTED 2009-06-26 13:16:33 -06:00
Brian Paul
08025cd4a5 glsl: implement _slang_gen_while_without_continue() 2009-06-26 13:16:33 -06:00
Brian Paul
2102e301a7 glsl: fix a bug involving 'continue' in 'for' loops
Need to execute the for loop's increment code before we continue.
Add a slang_assemble_ctx::CurLoopOper field to keep track of the containing
loop and avoid the "cont if true" path in this situation.

Plus, assorted clean-ups.
2009-06-26 13:16:33 -06:00
Brian Paul
541594b044 glsl: added slang_oper_child_const() 2009-06-26 13:16:32 -06:00
Brian Paul
38ddbc5588 glsl: use _slang_loop_contains_continue_or_break() to check for unrolling
The previous test failed for nested loops.
2009-06-26 13:16:32 -06:00
Brian Paul
4dafac2b2f glsl: use new _slang_loop_contains_continue() helper function 2009-06-26 13:16:32 -06:00
Brian Paul
aba93643be glsl: implement continue->break translation for do-while loops 2009-06-26 13:16:32 -06:00
Brian Paul
7e0eaca201 glsl: added slang_operation_literal_int/bool() helper functions 2009-06-26 13:16:32 -06:00
Brian Paul
c1f74a6734 glsl: don't allocate 0-length children array in slang_operation_copy() 2009-06-26 13:16:32 -06:00
Brian Paul
f38872473c glsl: remove debug code, misc clean-up 2009-06-26 13:16:32 -06:00
Brian Paul
f66733bbee glsl: implement continue->break transformation for for-loops 2009-06-26 13:16:32 -06:00
Brian Paul
c4fd947bee glsl: added slang_operation_add_children() and slang_oper_child() helpers 2009-06-26 13:16:32 -06:00
Brian Paul
c20bb48d3a glsl: added slang_assemble_ctx::EmitContReturn field, init 2009-06-26 13:16:32 -06:00
Brian Paul
eb1eee03a6 demos: improve argv parsing in fslight.c 2009-06-26 13:16:32 -06:00
Brian Paul
4bc74a0756 glsl: don't unroll loops containing continue/break
Just search the AST in _slang_can_unroll_for_loop().
2009-06-26 13:16:32 -06:00
Brian Paul
625b0fe268 Revert "slang: if/else/break & if/else/continue work for unrolled loops"
We should just check if the loop contains a continue/break in the
_slang_can_unroll_for_loop() test function...

This reverts commit 989856bde4.

Conflicts:

	src/mesa/shader/slang/slang_codegen.h
2009-06-26 13:16:32 -06:00
Brian Paul
4031ea1520 glsl: Added gl_shader_state::EmitContReturn field
This is the start of a glsl-continue-return feature branch to support
a GLSL code generator option for 'continue' and 'return' statements.
Some targets don't support CONT or RET statements so we'll need to
try to generate code that does not use them...
2009-06-26 13:16:32 -06:00
Brian Paul
84c5e4805b docs: updated Mesa release instructions 2009-06-26 13:16:32 -06:00
José Fonseca
72aed16aee scons: Tool to build with DirectX SDK.
Also works with MinGW, as long as the path to the DirectX SDK top
directory is set in the DXSDK_DIR environment variable.
2009-06-26 19:57:47 +01:00
José Fonseca
25f6c936fe scons: Don't use C specific options with g++ 2009-06-26 19:57:46 +01:00
Keith Whitwell
3e94521912 tgsi: correct handling of return value from util_vsnprintf
We were failing to deal with:
  - vsnprintf returns negative value on error.
  - vsnprintf returns the number of chars that *would* have been
    written on truncation.
2009-06-26 13:45:34 +01:00
Keith Whitwell
c9f8c400ab aux/indices: don't use 'prim' value once it is known to be bad
Theoretical bugfix only - no known case where this might happen.
2009-06-26 13:44:20 +01:00
José Fonseca
c25534f30d wgl: Handle flush after a window is destroyed.
Fixes assertion failure with conform.
2009-06-24 15:23:44 +01:00
Brian Paul
b79e6a59d8 demos: fix issues in glxcontexts.c
The reshape() function was called when there was no GLX context so
the viewport/modelview/projection setup wasn't doing anything.  Move
the call to reshape() into draw().

Also, remove -stereo, -fullscreen options and do some general clean-up.
2009-06-23 09:31:27 -06:00
Roland Scheidegger
2f184d0d9f i965: handle OPCODE_SWZ in the glsl path
glsl compiler will not generate OPCODE_SWZ, and as a first step it would
be translated away to a MOV anyway (why?), but later internally this opcode is
generated (for EXT_texture_swizzling).
(cherry picked from commit 4ef1f8e3b5)
2009-06-22 15:15:20 -07:00
Owen W. Taylor
9d367d43b2 Disable SGI_swap_control extension for DRI2
We currently don't have support for SGI_swap_control for direct
contexts with DRI2, so disable reporting the extension. Reporting
the extension, and then having glXSwapIntervalSGI() "succeed"
but do nothing can confuse applications.

https://bugs.freedesktop.org/show_bug.cgi?id=22123
(cherry picked from commit 279143c6e8)
2009-06-22 15:15:20 -07:00
Michel Dänzer
0584b6e433 intel: intel_texture_drawpixels() can't handle GL_DEPTH_STENCIL.
Fixes glean depthStencil test.
(cherry picked from commit 3885b708fd)
2009-06-22 15:15:20 -07:00
Brian Paul
19218fe712 i965: added intelFlush() call in intel_get_tex_image()
Fixes the render-to-texture test in progs/tests/getteximage.c
(cherry picked from commit a03b349153)
2009-06-22 15:15:20 -07:00
Brian Paul
a5b7e0c7d7 mesa: s/MAX_VERTEX_PROGRAM_ATTRIBS/MAX_NV_VERTEX_PROGRAM_INPUTS/ in NV funcs
(cherry picked from commit 4dc426c016)
2009-06-22 15:15:20 -07:00
Brian Paul
54f425b5ce mesa: rename MAX_VERTEX_ATTRIBS to MAX_VERTEX_GENERIC_ATTRIBS
Be clearer that this is the number of generic vertex program/shader
attributes, not counting the legacy attributes (pos, normal, color, etc).
(cherry picked from commit 4a95185c9f)
2009-06-22 15:15:19 -07:00
Brian Paul
810df8317d mesa: s/MAX_VERTEX_PROGRAM_ATTRIBS/MAX_NV_VERTEX_PROGRAM_INPUTS
(cherry picked from commit d2a74d76c9)
2009-06-22 15:15:19 -07:00
Brian Paul
19ca5ee1db mesa: fix some potential state-restore issues in pop_texture_group()
Call the _mesa_set_enable() functions instead of driver functions, etc.

Also, add missing code for 1D/2D texture arrays.
(cherry picked from commit aac19609bf)
2009-06-22 15:15:19 -07:00
Brian Paul
ad0514b24d vbo: return VP_NONE from get_program_mode() if running fixed-func vertex program
If we're running a vertex program to emulated fixed-function, we still need
to treat vertex arrays/attributes as if we're in fixed-function mode.

This should probably be back-ported to Mesa 7.5 after a bit more testing.
(cherry picked from commit dda82137d2)
2009-06-22 15:15:19 -07:00
Brian Paul
00e203fe17 mesa: create/use a fallback texture when bound texture is incomplete
When a GLSL sampler reads from an incomplete texture it should
return (0,0,0,1).  Instead of jumping through hoops in all the drivers
to make this happen, just create/install a fallback texture with those
texel values.

Fixes piglit/fp-incomplete-tex on i965 and more importantly, fixes some
GPU lockups when trying to sample from missing surfaces.  If a binding
table entry is NULL, it seems that sampling sometimes works, but not
always (lockup).

Todo: create a fallback texture for each type of texture target?
(cherry picked from commit 3f25219c7b)
2009-06-22 15:15:19 -07:00
Eric Anholt
abfd56c24c intel: Fix other metaops versus GL_COMPILE_AND_EXECUTE dlists.
Fixes oglconform zbfunc.c and pxtrans-cidraw.c, at least.

(cherry picked from commit 405300bb19)
2009-06-19 16:57:06 -07:00
Eric Anholt
daacac1c24 intel: Fix glClear behavior versus display lists.
The CALL_DrawArrays was leaking the clear's primitives into the display
list with GL_COMPILE_AND_EXECUTE.  Use _mesa_DrawArrays instead, which
doesn't appear to leak.  Fixes piglit dlist-clear test.
(cherry picked from commit 64edde1004)
2009-06-19 16:54:59 -07:00
Roland Scheidegger
43bb78f2bb radeons: use dp4 for position invariant vertex programs
Fixes #22181. R200 requires this since DP4 is used in hw tnl mode.
R300 prefers it (should be faster due to no instruction dependencies), but
both methods should be correct (when sw tcl is used though, MUL/MAD might
be faster). Probably doesn't make much difference for R100 since vertex progs
are executed in software anyway, but let's just keep it the same there too.
2009-06-19 20:00:55 +02:00
Michel Dänzer
9dfce365c7 Also release direct rendering resources in glXDestroyGLXPixmap.
Fixes leak running compiz with direct rendering.
2009-06-19 18:00:49 +02:00
Michel Dänzer
a120778c72 Always free image offsets memory when re-initializing texture image fields.
Fixes leak running compiz with direct rendering.
2009-06-19 18:00:33 +02:00
José Fonseca
3cf92e936a scons: Output the friendly "Linking ..." message when creating DLLs with MinGW. 2009-06-19 16:08:38 +01:00
Brian Paul
0487656245 softpipe: return alpha=1 in shadow_compare() function
The alpha value wasn't set at all before so we got unpredictable results.

Note that we don't currently obey GL_DEPTH_TEXTURE_MODE in the state
tracker.  For now, we return the result in the default mode (r,r,r,1).
2009-06-19 08:53:15 -06:00
José Fonseca
8f382fd3f3 util: Add cast.
It is expected to loose precision here.
2009-06-18 14:54:09 +01:00
José Fonseca
21bfd0f4bd draw: Replace pointer arithmetic with cast.
Using uintptr_t as intermediate type for pointer -> integer conversions is
easier to understand and does not cause any size mismatch warnings.
uintptr_t is part of C99, and we already provide a suitable replacement
definition for all platforms we care about.
2009-06-18 14:54:09 +01:00
José Fonseca
d609df1dae trace: Use size_t consistently. 2009-06-18 14:54:09 +01:00
José Fonseca
2af0173e9e pipebuffer: Use a type consistently for sizes/offsets.
Avoids warnings on 64bit builds.

Use regular unsigned since that's what gallium expects, but use a
typedef to facilitate possible changes in the future.
2009-06-18 14:54:08 +01:00
José Fonseca
42882897c6 wgl: Fix window resizing in multithread applications.
In multithreading stw_call_window_proc can be called by a thread other
than the thread where the context is bound.
2009-06-18 14:54:07 +01:00
José Fonseca
4b4855c717 wgl: Move all thread related code together.
Not only for cosmetic reasons, but also because we need to set the
SetWindowsHookEx hook for threads created before the DllMain is called
(threads for each we don't get the DLL_THREAD_ATTACH notification).
2009-06-18 14:54:07 +01:00
Keith Whitwell
1b05b5b4fe glew: correct misspelling of glFramebufferTextureLayer
This was misspelt as glFramebufferTexturLayer (missing e), causing
conflicts with the correctly spelt version in glext.h and extfuncs.h.
2009-06-18 10:13:55 +01:00
Keith Whitwell
0491142152 mesa: protect Elements against multiple definitions
Mesa and gallium both have a definition of this macro
2009-06-18 09:53:45 +01:00
Brian Paul
39366ed995 intel: remove extra \n from warning string
(cherry picked from commit 42e9bde0fa)
2009-06-17 12:55:26 -07:00
Robert Ellison
d446d3acac i965: fix 1D texture borders with GL_CLAMP_TO_BORDER
With 1D textures, GL_TEXTURE_WRAP_T should be ignored (only
GL_TEXTURE_WRAP_S should be respected).  But the i965 hardware
seems to follow the value of GL_TEXTURE_WRAP_T even when sampling
1D textures.

This fix forces GL_TEXTURE_WRAP_T to be GL_REPEAT whenever 1D
textures are used; this allows the texture to be sampled
correctly, avoiding "imaginary" border elements in the T direction.

This bug was demonstrated in the Piglit tex1d-2dborder test.
With this fix, that test passes.
(cherry picked from commit ab6c4fa582)
2009-06-17 12:55:26 -07:00
Robert Ellison
56235ae504 i965: send all warnings through _mesa_warning()
One warning message:
   drm_i915_getparam: -22

was still being sent to fprintf().  This causes all Piglit tests to fail,
even with MESA_DEBUG=0.

Using _mesa_warning() to emit the message allows the general Mesa controls
for messages like this to be applied.
(cherry picked from commit bc3270e99f)
2009-06-17 12:55:26 -07:00
Robert Ellison
e15aebe10e i965: fix segfault on low memory conditions
When out of memory (in at least one case, triggered by a longrunning
memory leak), this code will segfault and crash.  By checking for the
out-of-memory condition, the system can continue, and will report
the out-of-memory error later, a much preferable outcome.
(cherry picked from commit 44a4abfd4f)
2009-06-17 12:55:26 -07:00
Ian Romanick
a70c45bdab Fast path when rebinding the same texture in single context environment
If there is no shared context, there is no purpose in rebinding the same
texture.  In some artificial tests this improves performance 10% - 30%.
(cherry picked from commit 7f8000db8b)
2009-06-17 12:55:26 -07:00
Eric Anholt
ff3da0966f i915: Don't put VBOs in graphics memory unless required for an operation.
This saves doing swtnl from uncached memory, which is painful.  Improves
clutter test-text performance by 10% since it started using VBOs.
(cherry picked from commit a945e203d4)
2009-06-17 11:08:36 -07:00
Eric Anholt
1b8e4dd2c8 i915: Fall back on NPOT textured metaops on 830-class.
(cherry picked from commit 8ec6e03679)
2009-06-17 11:08:28 -07:00
Eric Anholt
cee73ffdaf i915: Restore the Viewport and DepthRange functions on 8xx.
Fixes failed viewport updates on glxgears (and other apps) resize since
e41780fedc.

Bug #20473.
(cherry picked from commit 0e83e8f51a)
2009-06-17 11:08:13 -07:00
Eric Anholt
7805c3b57b i956: Make state dependency of SF on drawbuffer bounds match Mesa's.
Noticed while debugging a weird 1D FBO testcase that left its existing
viewport and projection matrix in place when switching drawbuffers.  Didn't
fix the testcase, though.
(cherry picked from commit 3a521d84ec)
2009-06-17 11:07:03 -07:00
Eric Anholt
97974b7e51 intel: Don't complain on falling back from PBO fastpaths.
Instead, stash the debug info under the handy debug flag.

Bug #20053
(cherry picked from commit 22690482e6)
2009-06-17 11:06:52 -07:00
Eric Anholt
957f3c8c3d mesa: Mark FBOs with compressed color attachments as FBO-incomplete.
Both EXT_fbo and ARB_fbo agree on this.  Fixes a segfault in the metaops
mipmap generation in Intel for SGIS_generate_mipmap of S3TC textures in
Regnum Online.

Bug #21654.
(cherry picked from commit 0307e609aa)
2009-06-17 11:06:46 -07:00
Eric Anholt
66bfd025c8 i915: Use Stencil.Enabled instead of Stencil._Enabled in DrawBuffers.
The _Enabled field isn't updated at the point that DrawBuffers is called,
and the Driver.Enable() function does the testing for stencil buffer
presence anyway.

bug #21608 for Radeon
(cherry picked from commit 4c6f829899)
2009-06-17 11:06:38 -07:00
Eric Anholt
fbd554d074 i915: Only use the new 945 cube layout for compressed textures.
The docs actually explain this, but not in a terribly clear manner.
This nearly fixes the piglit cubemap testcase, except that something's
going wrong with the nearest filtering at 2x2 sizes in the testcase.
Looks good by visual inspection, though.

Bug #21692
(cherry picked from commit 5c5a468848)
2009-06-17 11:06:25 -07:00
Eric Anholt
6e0df938d4 i965: Fix varying payload reg assignment for the non-GLSL-instructions path.
I don't have a testcase for this, but it seems clearly wrong.
(cherry picked from commit dc657f3929)
2009-06-17 11:05:55 -07:00
Eric Anholt
988b61be27 i965: Fix register allocation of GLSL fp inputs.
Before, if the VP output something that is in the attributes coming into
the WM but which isn't used by the WM, then WM would end up reading subsequent
varyings from the wrong places.  This was visible with a GLSL demo
using gl_PointSize in the VS and a varying in the WM, as point size is in
the VUE but not used by the WM.  There is now a regression test in piglit,
glsl-unused-varying.

(cherry picked from commit 0f5113deed)
2009-06-17 11:04:31 -07:00
Eric Anholt
320a303be0 intel: Use FRONT_AND_BACK for StencilOp as well.
(cherry picked from commit 64980125c7)
2009-06-17 10:52:56 -07:00
Eric Anholt
d9e35d51fd intel: Use GL_FRONT_AND_BACK for stencil clearing.
This comes from a radeon-rewrite fallback fix, but may also fix stencil
clear failure when the polygon winding mode is flipped.
(cherry picked from commit d866abeffc)
2009-06-17 10:52:54 -07:00
Eric Anholt
61a2c9668f intel: Skip the DRI2 renderbuffer update when doing Viewport on an FBO.
(cherry picked from commit d4a42b0ce6)
2009-06-17 10:52:49 -07:00
Eric Anholt
2770107d87 intel: Map write-only buffer objects through the GTT when possible.
This looks to be a win of a few percent in cairogears with new vbo code,
thanks to not polluting caches.
(cherry picked from commit aa422b2625)
2009-06-17 10:52:30 -07:00
Brian Paul
3f856c6b6b mesa: rework viewport/scissor initialization code
The first time a context is bound to a drawable, the viewport and scissor
bounds are initialized to the buffer's size.  This is actually a bit tricky.

A new _mesa_check_init_viewport() function is called in several places
to check if the viewport has been initialized.  We also use a new
ctx->ViewportInitialized flag instead of the overloaded
ctx->FirstTimeCurrent flag.
2009-06-17 08:38:38 -06:00
Brian Paul
d18c57aaea mesa: added null ptr check in Fake_glXCreatePixmap()
Fixes segfault in progs/xdemos/glxgears_pixmap.c
2009-06-17 08:38:38 -06:00
Brian Paul
3705f48688 st/glx: added null ptr check in Fake_glXCreatePixmap()
Fixes segfault in progs/xdemos/glxgears_pixmap.c
2009-06-17 08:38:38 -06:00
José Fonseca
c6f71eabd8 Revert "scons: Debug build by default."
Per Brian's request.

This reverts commit 25f0c33bb3.
2009-06-17 15:24:06 +01:00
José Fonseca
1bee650ef3 progs/wgl: Fix shreadtex_mt too. 2009-06-17 15:23:25 +01:00
José Fonseca
6e24fdeae5 progs/wgl: Tweak the initialization wait in wglthreads.
There was still a non-zero probability for wglShareLists of failing.
2009-06-17 15:23:25 +01:00
José Fonseca
557421b6de progs/wgl: Get wglShareLists working in wglthreads.
wglShareLists is a little picky -- it seems to check if it has exclusive
access to a lock, and fails if it doesn't.

This allows the texture to be shared with all windows.
2009-06-17 15:23:25 +01:00
José Fonseca
25f0c33bb3 scons: Debug build by default.
Match what autotools and other build systems do by default.
2009-06-17 15:23:24 +01:00
Brian Paul
c53705ed7b GLX: attempt to fix glean makeCurrent test cases.
Two parts to this:

One we don't keep pointers to possibly freed memory anymore once we unbind the
drawables from the context. Brian I need to figure out what the comment
you made there, can we get a glean/piglit test so we can fix it properly?

If the new gc is the same as the oldGC, we call the unbind even though
we just bound it in that function. doh.

(cherry picked from master, commit 77506dac8e)
2009-06-17 08:03:19 -06:00
José Fonseca
ebe0796ba2 docs: Document building with SCons. 2009-06-17 10:12:11 +01:00
José Fonseca
d22828f716 wgl: Factor out some repetitive code into inline functions. 2009-06-17 10:08:25 +01:00
José Fonseca
992000cce7 progs/wgl: Allow resizing wglthreads' windows. 2009-06-17 10:08:24 +01:00
Brian Paul
6b917d0b17 i965: fix bugs in projective texture coordinates
For the TXP instruction we check if the texcoord is really a 4-component
atttibute which requires the divide by W step.  This check involved the
projtex_mask field.  However, the projtex_mask field was being miscalculated
because of some confusion between vertex program outputs and fragment
program inputs.

1. Rework the size_masks calculation so we correctly set bits corresponding
to fragment program input attributes.

2. Rename projtex_mask to proj_attrib_mask since we're interested in more
than just texcoords (generic varying vars too).

3. Simply the indexing of the size_masks and proj_attrib_mask fields.

4. The tracker::active[] array was mis-dimensioned.  Use MAX_PROGRAM_TEMPS
instead of a magic number.

5. Update comments, add new assertions.

With these changes the Lightsmark demo/benchmark renders correctly, until
we eventually hit a GPU lockup...
2009-06-16 18:21:26 -06:00
Brian Paul
742ba08406 softpipe: fix out of bounds quad rasterization bug
For some triangles we can generate quads which lie just outside the
surface bounds.  Just check the quad's mask before trying to emit/process
the quad.

Fixes failed assertion in Lightsmark.
2009-06-16 15:41:49 -06:00
Brian Paul
3e48dd0445 mesa: fix incorrect viewport clamping in _mesa_set_viewport()
A 0 by 0 viewport size is legal.  Don't clamp against lower bound of one.
The error checking earlier in the function prevents negative values.
2009-06-16 09:34:35 -06:00
Brian Paul
ed7f4b4230 mesa: fix REMAINDER() macro
The results were incorrect for some negative values of A.
See bug 21872.
2009-06-16 08:45:56 -06:00
José Fonseca
3463b1479d gallium: Avoid atomic ops / locking when src is dst. 2009-06-16 13:05:25 +01:00
José Fonseca
077c5e62d8 progs/wgl: Quit after displaying usage for -h option. 2009-06-16 12:34:29 +01:00
José Fonseca
06075711af progs/wgl: Use appropriate types to silence msvc warnings. 2009-06-16 12:29:58 +01:00
José Fonseca
566bdbe67d progs/wgl: Fix assertion failure in wglthreads' texture creation. 2009-06-16 12:29:58 +01:00
Shuang He
d027e8feff intel: Release fb backing regions in intelDestroyBuffer()
Fixes memory leak when destroying framebuffers.
2009-06-15 16:19:30 -06:00
José Fonseca
227d233cff python/tests: Add is_depth_stencil_format utility function. 2009-06-15 19:22:35 +01:00
José Fonseca
7585cbffe0 python/tests: Cleanup texture_sample. 2009-06-15 19:21:58 +01:00
José Fonseca
c6af9b2947 mesa: Always return a value. 2009-06-15 19:20:25 +01:00
José Fonseca
053d8eb891 mesa: Use appropriate float/integer types. 2009-06-15 19:20:05 +01:00
José Fonseca
6214c7262f mesa: Use type modifier for float constants. 2009-06-15 19:19:29 +01:00
José Fonseca
37f2117cd1 mesa: Use integer type with appropriate sign. 2009-06-15 19:17:07 +01:00
José Fonseca
c33ef1f7c6 rtasm: Use 32bit constant.
As we're only using 32bit bitmasks.
2009-06-15 19:04:04 +01:00
José Fonseca
940cb7ce16 gallium: Ensure assert macro is defined before being used in p_thread.h 2009-06-15 18:57:45 +01:00
José Fonseca
5d0cf9ebb4 softpipe: Fix softpipe_is_texture_referenced.
Render results are only visible when the render cache is flushed.
softpipe_is_texture_referenced must reflect that or transfers to/from the
textures bound in the framebuffer won't be proceeded of the necessary
flush, causing transfer data to be outdated/clobbered.

This fixes conform drawpix test with softpipe.
2009-06-15 18:42:13 +01:00
José Fonseca
0e1abced56 progs/tests: Use opaque colors.
Transparency is not relevant for this example, and leads to distraction
due to different results in alpha visuals, when capturing images to disk.
2009-06-15 15:40:10 +01:00
Thomas Hellstrom
db22b35d21 dri st: Don't require the PIPE_TEXTURE_USAGE_RENDER_TARGET property for depth- and stencil renderbuffers.
Signed-off-by: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
2009-06-15 11:48:57 +02:00
Thomas Hellstrom
cbe5af766e gallium: Fix segfault and valgrind error introduced with commit 3f2e006b75
Signed-off-by: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
2009-06-15 11:22:06 +02:00
Brian Paul
fb64365642 demos: update fbotexture.c to use EXT or ARB functions exclusively
When the -arb option is specified we use GL_ARB_framebuffer_object intead
of GL_EXT_framebuffer_object.

For some vendors' OpenGL it's important to call the ARB entrypoints
instead of the EXT entrypoints to get correct behaviour.  Use some
function pointer tricks to do this (instead of GLEW).
2009-06-12 08:15:33 -06:00
Brian Paul
476685c63c util: additional function pointers 2009-06-12 08:15:33 -06:00
Jakob Bornecrantz
c6de08fff4 mesa: Enable uploads of only depth to z24s8 textures 2009-06-12 12:29:02 +01:00
Brian Paul
3754c4135c mesa: rework vertex shader output / fragment shader input attribute matching
Before, if a vertex shader's outputs didn't exactly match a fragment
shader's inputs we could wind up with invalid TGSI shader declarations.
For example:

Before patch:
DCL OUT[0], POSITION
DCL OUT[1], COLOR[1]
DCL OUT[2], GENERIC[0]
DCL OUT[3], GENERIC[0] <- note duplicate [0]
DCL OUT[4], GENERIC[2]

After patch:
DCL OUT[0], POSITION
DCL OUT[1], COLOR[1]
DCL OUT[2], GENERIC[0]
DCL OUT[3], GENERIC[1]
DCL OUT[4], GENERIC[2]
2009-06-11 14:58:25 -06:00
Brian Paul
322e8556b9 mesa: add default function for ctx->Driver.CheckQuery() hook 2009-06-11 14:58:25 -06:00
José Fonseca
0ddc38309a python/retrace: Show the contents of the depth/stencil and surfaces before/after transfers. 2009-06-11 20:46:07 +01:00
José Fonseca
e1700009b7 python/retrace: Interpret is_texture_referenced/is_buffer_referenced. 2009-06-11 19:24:48 +01:00
José Fonseca
d5ba39ad08 wgl: Fix prototype. 2009-06-11 19:05:46 +01:00
José Fonseca
de413b1ba9 mesa: Use new pf_is_depth_and_stencil inline. 2009-06-11 19:02:59 +01:00
José Fonseca
3f2e006b75 gallium: New pf_is_depth_and_stencil / pf_is_depth_or_stencil inlines. 2009-06-11 19:02:59 +01:00
José Fonseca
7cafd49c93 mesa: Use PIPE_TEXTURE_USAGE_DEPTH_STENCIL for any depth or stencil format. 2009-06-11 19:02:59 +01:00
José Fonseca
862c7b8cd3 mesa: Remove dead code. 2009-06-11 19:02:59 +01:00
Brian Paul
bb0b954f12 st/mesa: fix typo s/BFC0/BFC1/ 2009-06-11 10:40:19 -06:00
Brian Paul
9d5479eeeb vbo: fix assertion, #define IMM_BUFFER_NAME
This was sometimes seen when Glean exited upon test failure when using
Gallium.
2009-06-11 09:46:02 -06:00
José Fonseca
cc09724a50 python/tests: Test sampling from a depth texture. 2009-06-11 16:22:17 +01:00
Jakob Bornecrantz
41cf681535 mesa: Only do read write when we don't have a depth value to write 2009-06-11 15:37:53 +01:00
José Fonseca
e3f14f2f3b progs: Port fp programs to GLEW. 2009-06-11 13:19:34 +01:00
José Fonseca
48d816b8ff mesa: Take the format from the right structure. 2009-06-11 12:23:09 +01:00
José Fonseca
96aca15c9d meas: Use a read/write transfer when writing stencil component, but not touching the depth component. 2009-06-11 11:47:20 +01:00
José Fonseca
337f559cd2 mesa: Reverse s8z24 into z24s8 as required by EXT_packed_depth_stencil.
Actually, after spotting this problem, I realized this is unreachable
code. However don't bother to enable this fast path now, given the normal
path is working just fine.
2009-06-10 21:29:25 +01:00
José Fonseca
8fa8669aeb mesa: Fix typo in bitmask. 2009-06-10 21:25:54 +01:00
José Fonseca
0a4fcabe44 mesa: Fix draw_stencil_pixels for PIPE_FORMAT_Z24S8_UNORM.
Reversed component order.

This fixes glean depthStencil test failures for PIPE_FORMAT_Z24S8_UNORM
visuals.
2009-06-10 20:05:00 +01:00
Brian Paul
dbab657fe7 glsl: fix warnings, update comments, s/TRUE/GL_TRUE/
(cherry picked from master, commit 7fdd64ab29)
2009-06-10 12:22:36 -06:00
Brian Paul
9225b67383 glsl: Handle continuation characters in preprocessor.
(cherry picked from master, commit cc22620e4b)
2009-06-10 12:21:56 -06:00
Brian Paul
88527220e4 swrast: fix state validation bug for changing program constants
Add _NEW_PROGRAM_CONSTANTS to _SWRAST_NEW_DERIVED.
This makes sure that we update the fragment shader's constants when state
vars (such as point size) changes.
Fixes the progs/glsl/points.c demo.
2009-06-10 09:31:01 -06:00
Brian Paul
506989b20e glsl: Fix symbol replacement handling in preprocessor.
(cherry picked from master, commit d9617deb00)
2009-06-10 09:31:01 -06:00
Brian Paul
6f50c9865d mesa: disable texture unit error check in _mesa_MatrixMode()
See comments for details.
2009-06-10 09:31:01 -06:00
Brian Paul
5450281ff7 docs: document GLSL preprocessor fixes 2009-06-10 09:31:01 -06:00
José Fonseca
4d16eb5e18 util: Single precision constants. 2009-06-10 15:39:47 +01:00
José Fonseca
978bca8b2a mesa: Single precision constants. 2009-06-10 15:39:34 +01:00
José Fonseca
52411a1951 mesa: Pure software accum buffer.
The existing implementation was already implemented on software, but relied
on the pipe driver to always support the R16G16B16A16_SNORM format. This
patch eliminates that, without prejudice against a future hardware-only
implementation.

It also avoids some of the short <-> float conversions, and only does a read
transfer of the color buffer on GL_RETURN if absolutely necessary.
2009-06-10 15:39:02 +01:00
José Fonseca
8bfbb7ec8b gallium: Shorthand functions for computing stride and sizes for a rect. 2009-06-10 15:31:12 +01:00
Keith Whitwell
76a1017e97 mesa/st: fix tracking of mapped buffer ranges
In st_bufferobj_map_range(), set obj->Offset consistently with its
usage elsewhere.
2009-06-09 18:32:18 +01:00
Keith Whitwell
9192347443 stw: ignore swapbuffer requests on singlebuffer
Return TRUE in this case.  Returning FALSE seems to result in
mis-rendering -- possibly opengl32.dll is trying to compensate by
doing a software blit??
2009-06-09 16:37:38 +01:00
Brian Paul
cb549775a5 glsl: Expand nested preprocessor macros.
(cherry picked from master, commit ef8caec29a)
2009-06-09 09:14:38 -06:00
Brian Paul
34bb024cf2 st/mesa: fix incorrect bufObj Length assignment, remove unneeded assertion 2009-06-08 16:11:17 -06:00
Jon TURNEY
7eed6ab5b5 Cygwin build fixes
Fix mklib to deal with NOPREFIX and use --enable-auto-image-base for cygwin
Teach configure.ac some basic facts about cygwin

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-06-08 14:30:46 -06:00
Brian Paul
304ba4bba4 glsl: Fix preprocessor define argument parsing for dead sections.
(cherry picked from master, commit 19a54d9f10)
2009-06-08 13:53:33 -06:00
Jakob Bornecrantz
77c329a277 pipebuffer: Silence out of heap space debug print 2009-06-08 19:54:55 +02:00
Brian Paul
b6753adbc7 st/mesa: remove invalid assertion
It's legal for ARB_vertex_program programs to not write to result.position.
The results are undefined in that case.  This assertion was causing us to
abort/exit though.
2009-06-08 10:46:46 -06:00
José Fonseca
e09f78d8dc mesa: Use matching signedness for the counter as upper bound. 2009-06-08 16:56:41 +01:00
José Fonseca
42678dba94 mesa: Allocate tokens from the heap.
The recent increase ST_MAX_SHADER_TOKENS to 8K causes stack overflows on
windows.

Failure to allocate is not being propagated to the caller. This is not
a regression since the previous _mesa_malloc result wasn't being
checked as well. Unfortunately it is not easy to fix, as the callers of
these functions do not have failure propagation mechanism either, and
so on. So leaving a just fixme note for now.
2009-06-08 16:56:41 +01:00
Brian Paul
33d6327770 mesa: better error message for invalid texture unit index 2009-06-08 09:53:00 -06:00
Brian Paul
0bced6a326 mesa: bump MAX_PROGRAM_ENV_PARAMS from 128 to 256
Also, MAX_NV_VERTEX_PROGRAM_PARAMS should be 96, not 128 (or 256).
2009-06-08 09:53:00 -06:00
Keith Whitwell
0d3c8fbf12 mesa/vbo: drop all references to vbo on destroy
We were adding references to the input arrays, but failing to drop
them on destruction.  This could lead to a 64kb buffer being leaked
each context destruction.
2009-06-08 16:27:43 +01:00
Brian Paul
fce4ee12a6 mesa: EXT_vertex_array_bgra fixes
1) Pass the correct format when calling update_array in
   _mesa_VertexAttribPointerARB.
2) glVertexAttribPointerNV accepts GL_BGRA format too.
3) raise INVALID_VALUE error when format is BGRA and normalized is
   false in glVertexAttribPointerARB

(cherry picked from commit 4adb190a16)
2009-06-08 07:25:24 -06:00
Jakob Bornecrantz
4d9d0e6230 stw: If stfb not set don't call into mesa 2009-06-08 14:45:56 +02:00
Jakob Bornecrantz
283e84bfb3 progs/tests: Add some scissor tests 2009-06-08 14:45:40 +02:00
José Fonseca
78dad27564 Revert "scons: Less aggressive optimizations for MSVC 64bit compiler."
This reverts commit fc7f924782.
2009-06-08 11:13:41 +01:00
274 changed files with 11743 additions and 2415 deletions

View File

@@ -182,7 +182,7 @@ ultrix-gcc:
# Rules for making release tarballs
VERSION=7.5-rc3
VERSION=7.5
DIRECTORY = Mesa-$(VERSION)
LIB_NAME = MesaLib-$(VERSION)
DEMO_NAME = MesaDemos-$(VERSION)

View File

@@ -885,6 +885,17 @@ case $ARCH in
CYGWIN*)
# GCC-based environment
if [ $NOPREFIX = 1 ] ; then
# No "lib" or ".so" part
echo "mklib: Making CYGWIN shared library: " ${LIBNAME}
OPTS="-shared -Wl,--enable-auto-image-base"
if [ "${ALTOPTS}" ] ; then
OPTS=${ALTOPTS}
fi
rm -f ${LIBNAME}
${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
FINAL_LIBS=${LIBNAME}
else
CYGNAME="cyg${LIBNAME}" # prefix with "cyg"
LIBNAME="lib${LIBNAME}" # prefix with "lib"
@@ -901,11 +912,11 @@ case $ARCH in
# finish up
FINAL_LIBS=${LIBNAME}.a
else
OPTS="-shared -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a"
OPTS="-shared -Wl,--enable-auto-image-base -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a"
if [ "${ALTOPTS}" ] ; then
OPTS=${ALTOPTS}
fi
echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}-${MAJOR}.dll
echo "mklib: Making" $ARCH "shared library: " ${CYGNAME}-${MAJOR}.dll
if [ $CPLUSPLUS = 1 ] ; then
LINK="g++"
@@ -914,7 +925,8 @@ case $ARCH in
fi
# rm any old libs
rm -f ${LIBNAME}-${MAJOR}.dll
rm -f ${CYGNAME}-${MAJOR}.dll
rm -f ${LIBNAME}-${MAJOR}.dll.a
rm -f ${LIBNAME}.dll.a
rm -f ${LIBNAME}.a
@@ -927,6 +939,7 @@ case $ARCH in
# special case for installing in bin
FINAL_BINS="${CYGNAME}-${MAJOR}.dll"
fi
fi
;;
'example')

View File

@@ -222,6 +222,8 @@ else
case "$host_os" in
darwin* )
LIB_EXTENSION='dylib' ;;
cygwin* )
LIB_EXTENSION='dll' ;;
* )
LIB_EXTENSION='so' ;;
esac
@@ -640,7 +642,7 @@ dnl Which drivers to build - default is chosen by platform
AC_ARG_WITH([dri-drivers],
[AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
[comma delimited DRI drivers list, e.g.
"swrast,i965,radeon,nouveau" @<:@default=auto@:>@])],
"swrast,i965,radeon" @<:@default=auto@:>@])],
[with_dri_drivers="$withval"],
[with_dri_drivers=yes])
if test "x$with_dri_drivers" = x; then
@@ -1073,6 +1075,9 @@ if test "x$APP_LIB_DEPS" = x; then
solaris*)
APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
;;
cygwin*)
APP_LIB_DEPS="-lX11"
;;
*)
APP_LIB_DEPS="-lm"
;;

View File

@@ -12,7 +12,7 @@
The Mesa
<a href="http://en.wikipedia.org/wiki/Cell_%28microprocessor%29" target="_parent">Cell</a>
driver is part of the
<a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D" target="_parent">Gallium3D</a>
<a href="http://wiki.freedesktop.org/wiki/Software/gallium" target="_parent">Gallium3D</a>
architecture.
Tungsten Graphics did the original implementation of the Cell driver.
</p>

View File

@@ -123,48 +123,46 @@ These are the instructions for making a new Mesa release.
<H3>Get latest source files</H3>
<p>
Use "cvs update -dAP " to get the latest Mesa files from CVS.
Use git to get the latest Mesa files from the git repository, from whatever
branch is relevant.
</p>
<H3>Verify and update version info</H3>
<p>
Create/edit the docs/RELNOTES-X.Y file to document what's new in the release.
Add the new RELNOTES-X.Y file to <a href="relnotes.html">relnotes.html</a>.
Update the docs/VERSIONS file too.
Create/edit the docs/relnotes-x.y.html file to document what's new in the release.
Add the new relnotes-x.y.html file to <a href="relnotes.html">relnotes.html</a>.
</p>
<p>
Edit the MESA_MAJOR, MESA_MINOR and MESA_TINY version numbers in
Update the MESA_MAJOR, MESA_MINOR and MESA_TINY version numbers in
configs/default.
Also update the VERSION line in the top-level Makefile.
</p>
<p>
Make sure the values in src/mesa/main/version.h are correct.
</p>
<p>
Edit the top-level Makefile and verify that DIRECTORY, LIB_NAME and
DEMO_NAME are correct.
</p>
<p>
Update the docs/news.html file and docs/download.html files.
</p>
<p>
Check in all updates to CVS.
Check in all updates to git.
</p>
<p>
Tag the CVS files with the release name (in the form <b>mesa_X_Y</b>).
Tag the files with the release name (in the form <b>mesa_X_Y</b>)
with: <code>git tag -a mesa_X_Y</code>
Then: <code>git push origin mesa_X_Y</code>
</p>
<H3>Make the tarballs</H3>
<p>
Make a symbolic link from $(DIRECTORY) to 'Mesa'. For example,
ln -s Mesa Mesa-6.3
<code>ln -s Mesa Mesa-7.5</code>
This is needed in order to make a correct tar file in the next step.
</p>
@@ -177,7 +175,7 @@ Make the distribution files. From inside the Mesa directory:
<p>
After the tarballs are created, the md5 checksums for the files will
be computed.
Add them to the docs/news.html file.
Add them to the docs/relnotes-X.Y.html file.
</p>
<p>
@@ -191,9 +189,21 @@ Follow the directions on SourceForge for creating a new "release" and
uploading the tarballs.
</p>
<p>
Basically, to upload the tarball files with:
<br>
<code>
rsync -avP ssh Mesa*-X.Y.* USERNAME@frs.sourceforge.net:uploads/
</code>
</p>
<p>
Update the web site by copying the docs/ directory's files to
/home/users/b/br/brianp/mesa-www/htdocs/
/home/users/b/br/brianp/mesa-www/htdocs/ with:
<br>
<code>
sftp USERNAME,mesa3d@web.sourceforge.net
</code>
</p>
<p>

View File

@@ -21,6 +21,7 @@
<li><a href="#pkg-config">Building OpenGL programs with pkg-config
</ul>
<li><a href="#windows">Windows</a>
<li><a href="#scons">SCons</a>
<li><a href="#other">Other</a>
</ol>
<br>
@@ -328,13 +329,60 @@ For example, compiling and linking a GLUT application can be done with:
<H2>2. Windows Compilation and Installation</H1>
<p>
Please see the <a href="README.WIN32">README.WIN32</a> file.
Please see the <a href="#scons">instructions on building with SCons</a>.
Alternatively see <a href="README.WIN32">README.WIN32</a> file.
</p>
<a name="scons">
<H2>3. Building with SCons</H1>
<p>
To build Mesa with SCons on Linux or Windows do
</p>
<pre>
scons
</pre>
<p>
The build output will be placed in
build/<i>platform</i>-<i>machine</i>-<i>debug</i>/..., where <i>platform</i> is for
example linux or windows, <i>machine</i> is x86 or x86_64, optionally followed
by -debug for debug builds.
</p>
<p>
The sample programs are built seperately. To build them do
<pre>
scons -C progs
</pre>
And the build output will be placed in progs/build/...
</p>
<p>
To build Mesa with SCons for Windows on Linux using the MinGW crosscompiler toolchain do
</p>
<pre>
scons platform=windows toolchain=crossmingw machine=x86 statetrackers=mesa drivers=softpipe,trace winsys=gdi
scons -C progs platform=windows toolchain=crossmingw machine=x86 -k
</pre>
<p>
This will create:
</p>
<ul>
<li>build/windows-x86-debug/gallium/winsys/gdi/opengl32.dll &mdash; Mesa + Gallium + softpipe, binary compatible with Windows's opengl32.dll
<li>build/windows-x86-debug/glut/glx/glut32.dll
<li>progs/build/windows-x86-debug/wgl/wglinfo.exe
<li>progs/build/windows-x86-debug/trivial/tri.exe
<li>and many other samples in progs/build/windows-x86-debug/...
</ul>
<p>
Put them all in the same directory to test them.
</p>
<a name="other">
<H2>3. Other systems</H1>
<H2>4. Other systems</H1>
<p>
Documentation for other environments (some may be very out of date):

View File

@@ -11,6 +11,29 @@
<H1>News</H1>
<h2>July 17, 2009</h2>
<p>
<a href="relnotes-7.5.html">Mesa 7.5</a> is released.
This is a new features release. People especially concerned about
stability may want to wait for the follow-on 7.5.1 bug-fix release.
</p>
<h2>June 23, 2009</h2>
<p>
<a href="relnotes-7.4.4.html">Mesa 7.4.4</a> is released.
This is a stable release that fixes a regression in the i915/i965 drivers
that slipped into the 7.4.3 release.
</p>
<h2>June 19, 2009</h2>
<p>
<a href="relnotes-7.4.3.html">Mesa 7.4.3</a> is released.
This is a stable release fixing bugs since the 7.4.2 release.
</p>
<h2>May 15, 2009</h2>
<p>
<a href="relnotes-7.4.2.html">Mesa 7.4.2</a> is released.
@@ -84,7 +107,7 @@ Added a new page describing the <a href="cell.html">Mesa Cell driver</a>.
<p>
Gallium3D is the codename for the new Mesa device driver architecture
which is currently under development.
A <a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D"
A <a href="http://wiki.freedesktop.org/wiki/Software/gallium"
target="_parent"> summary</a> of the architecture can be found on the
Tungsten Graphics website.
</p>

79
docs/relnotes-7.4.3.html Normal file
View File

@@ -0,0 +1,79 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.4.3 Release Notes / 19 June 2009</H1>
<p>
Mesa 7.4.3 is a stable development release fixing bugs since the 7.4.2 release.
</p>
<p>
Mesa 7.4.3 implements the OpenGL 2.1 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 2.1.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
34c5a6c47ed51f31c4fa36e269831352 MesaLib-7.4.3.tar.gz
70a983ba3deaa8bd63b18bbab283f698 MesaLib-7.4.3.tar.bz2
34f21b3205b271d575030aa98a2dda51 MesaLib-7.4.3.zip
56752b7adede212e6097afb10d0c0d59 MesaDemos-7.4.3.tar.gz
8ffa51c4833b1e298300a005e2d7ca2a MesaDemos-7.4.3.tar.bz2
0037d24d41400d6fb9800ae55b8c863f MesaDemos-7.4.3.zip
20e24f6692c0c90e7e3b220f79c4108d MesaGLUT-7.4.3.tar.gz
03a4beeef74fc5ef0b1d6d04710e5a8a MesaGLUT-7.4.3.tar.bz2
273788230adbdb9d57371309adedcf5f MesaGLUT-7.4.3.zip
</pre>
<h2>Bug fixes</h2>
<ul>
<li>Fixed texture object reference counting bug (bug 21756)
<li>Allow depth/stencil textures to be attached to GL_STENCIL_ATTACHMENT point
(SF bug 2793846)
<li>Added missing glGet case for GL_VERTEX_ARRAY_BINDING_APPLE
<li>Fixed some OSMesa build issues
<li>Fixed a vertex buffer object crash
<li>Fixed broken glTexImage3D() when image type = GL_BITMAP
<li>Fixed some GLSL preprocessor bugs
<li>Fixed framebuffer mem leak in i945/i965 DRI drivers
<li>Fixed texture coordinate repeat bug in swrast (bug 21872)
<li>Fixed incorrect viewport clamping (lower bound is zero, not one)
<li>GLX fix for glean's makeCurrent test case
</ul>
<h2>Driver Status</h2>
<pre>
Driver Status
---------------------- ----------------------
DRI drivers varies with the driver
XMesa/GLX (on Xlib) implements OpenGL 2.1
OSMesa (off-screen) implements OpenGL 2.1
Windows/Win32 implements OpenGL 2.1
Glide (3dfx Voodoo1/2) implements OpenGL 1.3
SVGA unsupported
Wind River UGL unsupported
DJGPP unsupported
GGI unsupported
BeOS unsupported
Allegro unsupported
D3D unsupported
</pre>
</body>
</html>

68
docs/relnotes-7.4.4.html Normal file
View File

@@ -0,0 +1,68 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.4.4 Release Notes / 23 June 2009</H1>
<p>
Mesa 7.4.4 is a stable development release fixing bugs since the 7.4.3 release.
</p>
<p>
Mesa 7.4.4 implements the OpenGL 2.1 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 2.1.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
0b56fe5a88ab0c3c5b2da5068f63f416 MesaLib-7.4.4.tar.gz
b66528d314c574dccbe0ed963cac5e93 MesaLib-7.4.4.tar.bz2
2818076f3ba23fa87fdfe4602a637a18 MesaLib-7.4.4.zip
3e77b208386c47b18165bce5ae317e2c MesaDemos-7.4.4.tar.gz
628142ec9a54cd28cc027e6ce26cff47 MesaDemos-7.4.4.tar.bz2
d08a30d30ab7174859aa709cba6c726d MesaDemos-7.4.4.zip
e6e91ba16e274d40cf3a97ad3218af01 MesaGLUT-7.4.4.tar.gz
e14bbb52517e8121b31f1387515365ab MesaGLUT-7.4.4.tar.bz2
f10ed20469753c2b3d68c99854f80fd4 MesaGLUT-7.4.4.zip
</pre>
<h2>Bug fixes</h2>
<ul>
<li>Fixed i965/i915 segfault in screen destruction (bug 22408)
</ul>
<h2>Driver Status</h2>
<pre>
Driver Status
---------------------- ----------------------
DRI drivers varies with the driver
XMesa/GLX (on Xlib) implements OpenGL 2.1
OSMesa (off-screen) implements OpenGL 2.1
Windows/Win32 implements OpenGL 2.1
Glide (3dfx Voodoo1/2) implements OpenGL 1.3
SVGA unsupported
Wind River UGL unsupported
DJGPP unsupported
GGI unsupported
BeOS unsupported
Allegro unsupported
D3D unsupported
</pre>
</body>
</html>

View File

@@ -8,7 +8,7 @@
<body bgcolor="#eeeeee">
<H1>Mesa 7.5 Release Notes / date TBD</H1>
<H1>Mesa 7.5 Release Notes / 17 July 2009</H1>
<p>
Mesa 7.5 is a new development release.
@@ -17,7 +17,7 @@ with the 7.4.x branch or wait for Mesa 7.5.1.
</p>
<p>
The main new feature of Mesa 7.5 is the
<a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D"
<a href="http://wiki.freedesktop.org/wiki/Software/gallium"
target="_parent">Gallium3D</a> infrastructure.
</p>
<p>
@@ -68,12 +68,18 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0
<li>GL_EXT_texture_swizzle extension (software drivers, i965 driver)
<li>Updated SPARC assembly optimizations (David S. Miller)
<li>Initial support for separate compilation units in GLSL compiler.
<li>Increased max number of generic GLSL varying variables to 16 (formerly 8).
<li>GLSL linker now detects when too many varying variables are used.
<li>Optimize-out redundant glMaterial and glShadeModel calls in display lists
<li>Fixed gl_TextureMatrix[i][j] array indexing bug in GLSL compiler.
</ul>
<h2>Bug fixes</h2>
<ul>
<li>Lots of i965 driver bug fixes
<li>Fixed some GLSL preprocessor bugs
<li>GLSL: continue inside of a for-loop didn't work
</ul>

View File

@@ -8,19 +8,14 @@
<H1>Release Notes</H1>
<p>
Mesa uses an even/odd version number scheme like the Linux kernel.
Odd numbered versions (such as 6.5) designate new developmental releases.
Even numbered versions (such as 6.4) designate stable releases.
</p>
<p>
The release notes summarize what's new or changed in each Mesa release.
</p>
<UL>
<LI><A HREF="relnotes-7.5.html">7.5 release notes</A>
<LI><A HREF="relnotes-7.4.4.html">7.4.4 release notes</A>
<LI><A HREF="relnotes-7.4.3.html">7.4.3 release notes</A>
<LI><A HREF="relnotes-7.4.2.html">7.4.2 release notes</A>
<LI><A HREF="relnotes-7.4.1.html">7.4.1 release notes</A>
<LI><A HREF="relnotes-7.4.html">7.4 release notes</A>

View File

@@ -2702,7 +2702,7 @@ typedef GLenum (GLAPIENTRY * PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
typedef void (GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint* framebuffers);
typedef void (GLAPIENTRY * PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint* renderbuffers);
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURLAYERPROC) (GLenum target,GLenum attachment, GLuint texture,GLint level,GLint layer);
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target,GLenum attachment, GLuint texture,GLint level,GLint layer);
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint layer);
@@ -2723,7 +2723,7 @@ typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum targ
#define glDeleteFramebuffers GLEW_GET_FUN(__glewDeleteFramebuffers)
#define glDeleteRenderbuffers GLEW_GET_FUN(__glewDeleteRenderbuffers)
#define glFramebufferRenderbuffer GLEW_GET_FUN(__glewFramebufferRenderbuffer)
#define glFramebufferTexturLayer GLEW_GET_FUN(__glewFramebufferTexturLayer)
#define glFramebufferTextureLayer GLEW_GET_FUN(__glewFramebufferTextureLayer)
#define glFramebufferTexture1D GLEW_GET_FUN(__glewFramebufferTexture1D)
#define glFramebufferTexture2D GLEW_GET_FUN(__glewFramebufferTexture2D)
#define glFramebufferTexture3D GLEW_GET_FUN(__glewFramebufferTexture3D)
@@ -10563,7 +10563,7 @@ GLEW_FUN_EXPORT PFNGLCHECKFRAMEBUFFERSTATUSPROC __glewCheckFramebufferStatus;
GLEW_FUN_EXPORT PFNGLDELETEFRAMEBUFFERSPROC __glewDeleteFramebuffers;
GLEW_FUN_EXPORT PFNGLDELETERENDERBUFFERSPROC __glewDeleteRenderbuffers;
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERRENDERBUFFERPROC __glewFramebufferRenderbuffer;
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURLAYERPROC __glewFramebufferTexturLayer;
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYERPROC __glewFramebufferTextureLayer;
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE1DPROC __glewFramebufferTexture1D;
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE2DPROC __glewFramebufferTexture2D;
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE3DPROC __glewFramebufferTexture3D;

View File

@@ -1,6 +1,7 @@
SConscript([
'util/SConscript',
'demos/SConscript',
'glsl/SConscript',
'redbook/SConscript',
'samples/SConscript',
'tests/SConscript',

View File

@@ -145,6 +145,13 @@ engine.o: engine.c trackball.h
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) engine.c
fbotexture: fbotexture.o
$(APP_CC) $(CFLAGS) $(LDFLAGS) fbotexture.o $(LIBS) -o $@
fbotexture.o: fbotexture.c extfuncs.h
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) fbotexture.c
fslight: fslight.o
$(APP_CC) $(CFLAGS) $(LDFLAGS) fslight.o $(LIBS) -o $@

View File

@@ -9,13 +9,13 @@
*/
#include <GL/glew.h>
#include <GL/glut.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "extfuncs.h"
/* For debug */
#define DEPTH 1
@@ -80,9 +80,9 @@ RenderTexture(void)
glTranslatef(0.0, 0.0, -15.0);
/* draw to texture image */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, MyFB);
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
printf("Framebuffer incomplete!!!\n");
}
@@ -171,7 +171,7 @@ RenderTexture(void)
#if DRAW
/* Bind normal framebuffer */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, 0);
#endif
CheckError(__LINE__);
@@ -252,12 +252,12 @@ static void
CleanUp(void)
{
#if DEPTH
glDeleteRenderbuffersEXT(1, &DepthRB);
glDeleteRenderbuffers_func(1, &DepthRB);
#endif
#if STENCIL
glDeleteRenderbuffersEXT(1, &StencilRB);
glDeleteRenderbuffers_func(1, &StencilRB);
#endif
glDeleteFramebuffersEXT(1, &MyFB);
glDeleteFramebuffers_func(1, &MyFB);
glDeleteTextures(1, &TexObj);
@@ -318,14 +318,14 @@ AttachDepthAndStencilBuffers(GLuint fbo,
*depthRbOut = *stencilRbOut = 0;
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, fbo);
if (tryDepthStencil) {
GLuint rb;
glGenRenderbuffersEXT(1, &rb);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
glGenRenderbuffers_func(1, &rb);
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, rb);
glRenderbufferStorage_func(GL_RENDERBUFFER_EXT,
GL_DEPTH24_STENCIL8_EXT,
width, height);
if (glGetError())
@@ -333,7 +333,7 @@ AttachDepthAndStencilBuffers(GLuint fbo,
if (bindDepthStencil) {
/* attach to both depth and stencil at once */
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
GL_DEPTH_STENCIL_ATTACHMENT,
GL_RENDERBUFFER_EXT, rb);
if (glGetError())
@@ -341,21 +341,21 @@ AttachDepthAndStencilBuffers(GLuint fbo,
}
else {
/* attach to depth attachment point */
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
GL_DEPTH_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, rb);
if (glGetError())
return GL_FALSE;
/* and attach to stencil attachment point */
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
GL_STENCIL_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, rb);
if (glGetError())
return GL_FALSE;
}
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
return GL_FALSE;
@@ -367,22 +367,22 @@ AttachDepthAndStencilBuffers(GLuint fbo,
{
GLuint rb;
glGenRenderbuffersEXT(1, &rb);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
glGenRenderbuffers_func(1, &rb);
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, rb);
glRenderbufferStorage_func(GL_RENDERBUFFER_EXT,
GL_DEPTH_COMPONENT,
width, height);
if (glGetError())
return GL_FALSE;
/* attach to depth attachment point */
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
GL_DEPTH_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, rb);
if (glGetError())
return GL_FALSE;
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
return GL_FALSE;
@@ -393,26 +393,26 @@ AttachDepthAndStencilBuffers(GLuint fbo,
{
GLuint rb;
glGenRenderbuffersEXT(1, &rb);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
glGenRenderbuffers_func(1, &rb);
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, rb);
glRenderbufferStorage_func(GL_RENDERBUFFER_EXT,
GL_STENCIL_INDEX,
width, height);
if (glGetError())
return GL_FALSE;
/* attach to depth attachment point */
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
GL_STENCIL_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, rb);
if (glGetError())
return GL_FALSE;
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
glDeleteRenderbuffersEXT(1, depthRbOut);
glDeleteRenderbuffers_func(1, depthRbOut);
*depthRbOut = 0;
glDeleteRenderbuffersEXT(1, &rb);
glDeleteRenderbuffers_func(1, &rb);
return GL_FALSE;
}
@@ -463,6 +463,37 @@ ParseArgs(int argc, char *argv[])
}
static void
SetupFunctionPointers(void)
{
GetExtensionFuncs();
if (Use_ARB_fbo) {
/* no-op: use the ARB functions as-is */
}
else {
/* set the ARB-flavor function pointers to point to the EXT functions */
glIsRenderbuffer_func = glIsRenderbufferEXT_func;
glBindRenderbuffer_func = glBindRenderbufferEXT_func;
glDeleteRenderbuffers_func = glDeleteRenderbuffersEXT_func;
glGenRenderbuffers_func = glGenRenderbuffersEXT_func;
glRenderbufferStorage_func = glRenderbufferStorageEXT_func;
glGetRenderbufferParameteriv_func = glGetRenderbufferParameterivEXT_func;
glIsFramebuffer_func = glIsFramebufferEXT_func;
glBindFramebuffer_func = glBindFramebufferEXT_func;
glDeleteFramebuffers_func = glDeleteFramebuffersEXT_func;
glGenFramebuffers_func = glGenFramebuffersEXT_func;
glCheckFramebufferStatus_func = glCheckFramebufferStatusEXT_func;
glFramebufferTexture1D_func = glFramebufferTexture1DEXT_func;
glFramebufferTexture2D_func = glFramebufferTexture2DEXT_func;
glFramebufferTexture3D_func = glFramebufferTexture3DEXT_func;
glFramebufferRenderbuffer_func = glFramebufferRenderbufferEXT_func;
glGetFramebufferAttachmentParameteriv_func = glGetFramebufferAttachmentParameterivEXT_func;
glGenerateMipmap_func = glGenerateMipmapEXT_func;
}
}
/*
* Make FBO to render into given texture.
*/
@@ -472,10 +503,10 @@ MakeFBO_RenderTexture(GLuint TexObj)
GLuint fb;
GLint sizeFudge = 0;
glGenFramebuffersEXT(1, &fb);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
glGenFramebuffers_func(1, &fb);
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, fb);
/* Render color to texture */
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
glFramebufferTexture2D_func(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
TexTarget, TexObj, TextureLevel);
if (Use_ARB_fbo) {
@@ -512,26 +543,26 @@ MakeFBO_RenderTexture(GLuint TexObj)
{
GLint bits, w, h;
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRB);
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, DepthRB);
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
GL_RENDERBUFFER_WIDTH_EXT, &w);
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
GL_RENDERBUFFER_HEIGHT_EXT, &h);
printf("Color/Texture size: %d x %d\n", TexWidth, TexHeight);
printf("Depth buffer size: %d x %d\n", w, h);
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
GL_RENDERBUFFER_DEPTH_SIZE_EXT, &bits);
printf("Depth renderbuffer size = %d bits\n", bits);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, StencilRB);
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, StencilRB);
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
GL_RENDERBUFFER_STENCIL_SIZE_EXT, &bits);
printf("Stencil renderbuffer size = %d bits\n", bits);
}
/* bind the regular framebuffer */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, 0);
return fb;
}
@@ -547,6 +578,8 @@ Init(void)
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
SetupFunctionPointers();
/* lighting */
{
static const GLfloat mat[4] = { 1.0, 0.5, 0.5, 1.0 };
@@ -605,7 +638,6 @@ main(int argc, char *argv[])
glutInitWindowSize(Width, Height);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
Win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Display);

View File

@@ -583,10 +583,14 @@ ParseOptions(int argc, char *argv[])
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-fs") == 0) {
FragProgFile = argv[i+1];
FragProgFile = argv[++i];
}
else if (strcmp(argv[i], "-vs") == 0) {
VertProgFile = argv[i+1];
VertProgFile = argv[++i];
}
else {
fprintf(stderr, "unknown option %s\n", argv[i]);
break;
}
}
}

View File

@@ -514,12 +514,27 @@ static void draw_surface( unsigned int with_state )
break;
case (GLVERTEX|STRIPS):
glBegin( GL_TRIANGLE_STRIP );
for (i=0;i<numverts;i++) {
glNormal3fv( &data[i][3] );
glVertex3fv( &data[i][0] );
if (with_state & MATERIALS) {
glBegin( GL_TRIANGLE_STRIP );
for (i=0;i<numverts;i++) {
if (i % 600 == 0 && i != 0) {
unsigned j = i / 600;
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, col[j]);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, col[j]);
}
glNormal3fv( &data[i][3] );
glVertex3fv( &data[i][0] );
}
glEnd();
}
else {
glBegin( GL_TRIANGLE_STRIP );
for (i=0;i<numverts;i++) {
glNormal3fv( &data[i][3] );
glVertex3fv( &data[i][0] );
}
glEnd();
}
glEnd();
break;
default:

View File

@@ -11,7 +11,20 @@ env.Prepend(CPPPATH = [
env.Prepend(LIBS = ['$GLUT_LIB'])
env.Program(
target = 'fp-tri',
source = ['fp-tri.c'],
progs = [
'fp-tri',
'tri-depth',
'tri-depth2',
'tri-depthwrite',
'tri-depthwrite2',
'tri-inv',
'tri-param',
'tri-tex',
'point-position',
]
for prog in progs:
env.Program(
target = prog,
source = [prog + '.c'],
)

View File

@@ -89,7 +89,7 @@ static void Init( void )
}
fprintf(stderr, "%.*s\n", sz, buf);
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
if (!GLEW_ARB_fragment_program) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}

View File

@@ -2,9 +2,8 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glew.h>
#include <GL/glut.h>
#include "GL/gl.h"
@@ -17,7 +16,7 @@ static void Init( void )
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
if (!GLEW_ARB_fragment_program) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
@@ -109,6 +108,8 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
Init();
glutReshapeFunc(Reshape);

View File

@@ -2,9 +2,8 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glew.h>
#include <GL/glut.h>
#include "GL/gl.h"
@@ -19,7 +18,7 @@ static void Init( void )
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
if (!GLEW_ARB_fragment_program) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
@@ -89,8 +88,6 @@ int main(int argc, char **argv)
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
@@ -101,6 +98,8 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
Init();
glutReshapeFunc(Reshape);

View File

@@ -2,9 +2,8 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glew.h>
#include <GL/glut.h>
#include "GL/gl.h"
@@ -21,7 +20,7 @@ static void Init( void )
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
if (!GLEW_ARB_fragment_program) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
@@ -106,6 +105,8 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
Init();
glutReshapeFunc(Reshape);

View File

@@ -2,7 +2,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glew.h>
#include <GL/glut.h>
@@ -16,7 +16,7 @@ static void Init(void)
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
if (!GLEW_ARB_fragment_program) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
@@ -97,6 +97,8 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
Init();
glutReshapeFunc(Reshape);

View File

@@ -2,7 +2,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glew.h>
#include <GL/glut.h>
@@ -16,7 +16,7 @@ static void Init(void)
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
if (!GLEW_ARB_fragment_program) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
@@ -97,6 +97,8 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
Init();
glutReshapeFunc(Reshape);

View File

@@ -2,7 +2,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glew.h>
#include <GL/glut.h>
@@ -17,7 +17,7 @@ static void Init( void )
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
if (!GLEW_ARB_fragment_program) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
@@ -99,6 +99,8 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
Init();
glutReshapeFunc(Reshape);

View File

@@ -2,9 +2,9 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glew.h>
#include <GL/glut.h>
#include "GL/gl.h"
static void Init( void )
{
@@ -15,7 +15,7 @@ static void Init( void )
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
if (!GLEW_ARB_fragment_program) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
@@ -104,6 +104,8 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
Init();
glutReshapeFunc(Reshape);

View File

@@ -3,7 +3,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glew.h>
#include <GL/glut.h>
#include "readtex.c"
@@ -23,7 +23,7 @@ static void Init( void )
GLuint modulateProg;
GLuint Texture;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
if (!GLEW_ARB_fragment_program) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
@@ -120,6 +120,8 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
Init();
glutReshapeFunc(Reshape);

View File

@@ -10,7 +10,7 @@ LIB_DEP = \
$(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) \
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
INCLUDE_DIRS = -I$(TOP)/progs/util

55
progs/glsl/SConscript Normal file
View File

@@ -0,0 +1,55 @@
Import('*')
if not env['GLUT']:
Return()
env = env.Clone()
env.Prepend(CPPPATH = [
'../util',
])
env.Prepend(LIBS = [
util,
'$GLUT_LIB'
])
if env['platform'] == 'windows':
env.Append(CPPDEFINES = ['NOMINMAX'])
env.Prepend(LIBS = ['winmm'])
progs = [
'array',
'bitmap',
'brick',
'bump',
'convolutions',
'deriv',
'fragcoord',
'identity',
'linktest',
'mandelbrot',
'multinoise',
'multitex',
'noise',
'noise2',
'pointcoord',
'points',
'samplers',
'shadow_sampler',
'skinning',
'texaaline',
'texdemo1',
'toyball',
'trirast',
'twoside',
'vert-or-frag-only',
'vert-tex',
]
for prog in progs:
env.Program(
target = prog,
source = prog + '.c',
)

View File

@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -144,9 +142,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -219,19 +217,17 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
/* Setup the HeightArray[] uniform */
for (i = 0; i < 20; i++)
HeightArray[i] = i / 20.0;
u = glGetUniformLocation_func(program, "HeightArray");
glUniform1fv_func(u, 20, HeightArray);
u = glGetUniformLocation(program, "HeightArray");
glUniform1fv(u, 20, HeightArray);
assert(glGetError() == 0);
@@ -248,6 +244,7 @@ main(int argc, char *argv[])
glutInitWindowSize(500, 500);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -78,11 +76,11 @@ Redisplay(void)
BitmapText("-X");
}
else {
glUseProgram_func(Program);
glUseProgram(Program);
/* vertex positions (deltas) depend on texture size and window size */
if (uScale != -1) {
glUniform2f_func(uScale,
glUniform2f(uScale,
2.0 * TEX_WIDTH / WinWidth,
2.0 * TEX_HEIGHT / WinHeight);
}
@@ -105,7 +103,7 @@ Redisplay(void)
glTexCoord2f(0, 1); glVertex3fv(nx);
glEnd();
glUseProgram_func(0);
glUseProgram(0);
}
glPopMatrix();
@@ -160,9 +158,9 @@ Key(unsigned char key, int x, int y)
printf("Using billboard texture\n");
break;
case 27:
glDeleteShader_func(FragShader);
glDeleteShader_func(VertShader);
glDeleteProgram_func(Program);
glDeleteShader(FragShader);
glDeleteShader(VertShader);
glDeleteProgram(Program);
glutDestroyWindow(Win);
exit(0);
}
@@ -277,21 +275,19 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
VertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
FragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
Program = LinkShaders(VertShader, FragShader);
glUseProgram_func(Program);
glUseProgram(Program);
uScale = glGetUniformLocation_func(Program, "scale");
uTex = glGetUniformLocation_func(Program, "tex2d");
uScale = glGetUniformLocation(Program, "scale");
uTex = glGetUniformLocation(Program, "tex2d");
if (uTex != -1) {
glUniform1i_func(uTex, 0); /* tex unit 0 */
glUniform1i(uTex, 0); /* tex unit 0 */
}
glUseProgram_func(0);
glUseProgram(0);
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
glEnable(GL_DEPTH_TEST);
@@ -309,6 +305,7 @@ main(int argc, char *argv[])
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
Win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -82,9 +80,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -144,13 +142,11 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
InitUniforms(program, Uniforms);
@@ -160,9 +156,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
@@ -191,6 +187,7 @@ main(int argc, char *argv[])
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glu.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -60,7 +58,7 @@ static void
Square(GLfloat size)
{
glNormal3f(0, 0, 1);
glVertexAttrib3f_func(tangentAttrib, 1, 0, 0);
glVertexAttrib3f(tangentAttrib, 1, 0, 0);
glBegin(GL_POLYGON);
glTexCoord2f(0, 0); glVertex2f(-size, -size);
glTexCoord2f(1, 0); glVertex2f( size, -size);
@@ -164,9 +162,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -230,17 +228,15 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
assert(glGetError() == 0);
@@ -250,7 +246,7 @@ Init(void)
CheckError(__LINE__);
tangentAttrib = glGetAttribLocation_func(program, "Tangent");
tangentAttrib = glGetAttribLocation(program, "Tangent");
printf("Tangent Attrib: %d\n", tangentAttrib);
assert(tangentAttrib >= 0);
@@ -288,6 +284,7 @@ main(int argc, char *argv[])
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -5,6 +5,8 @@
* Author: Zack Rusin
*/
#include <GL/glew.h>
#define GL_GLEXT_PROTOTYPES
#include "readtex.h"
@@ -455,6 +457,7 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
init();
glutReshapeFunc(reshape);

View File

@@ -13,10 +13,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -70,9 +68,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -177,13 +175,11 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
/*assert(glGetError() == 0);*/
@@ -197,9 +193,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
@@ -228,6 +224,7 @@ main(int argc, char *argv[])
glutInitWindowSize(200, 200);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -12,10 +12,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -85,9 +83,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -129,13 +127,11 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
/*assert(glGetError() == 0);*/
@@ -143,9 +139,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
@@ -174,6 +170,7 @@ main(int argc, char *argv[])
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Redisplay);

View File

@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -69,9 +67,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -141,8 +139,6 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
if (FragProgFile)
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
else
@@ -155,7 +151,7 @@ Init(void)
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
/*assert(glGetError() == 0);*/
@@ -164,9 +160,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
@@ -195,6 +191,7 @@ main(int argc, char *argv[])
glutInitWindowSize(200, 200);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -132,11 +130,11 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(VertShader1);
glDeleteShader_func(VertShader2);
glDeleteShader_func(FragShader1);
glDeleteShader_func(FragShader2);
glDeleteProgram_func(Program);
glDeleteShader(VertShader1);
glDeleteShader(VertShader2);
glDeleteShader(FragShader1);
glDeleteShader(FragShader2);
glDeleteProgram(Program);
glutDestroyWindow(Win);
}
@@ -175,11 +173,11 @@ static void
CheckLink(GLuint prog)
{
GLint stat;
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
glGetProgramiv(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog_func(prog, 1000, &len, log);
glGetProgramInfoLog(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
}
@@ -191,8 +189,6 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
VertShader1 = CompileShaderText(GL_VERTEX_SHADER, VertShaderSource1);
@@ -200,26 +196,26 @@ Init(void)
FragShader1 = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderSource1);
FragShader2 = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderSource2);
Program = glCreateProgram_func();
glAttachShader_func(Program, VertShader1);
glAttachShader_func(Program, VertShader2);
glAttachShader_func(Program, FragShader1);
glAttachShader_func(Program, FragShader2);
Program = glCreateProgram();
glAttachShader(Program, VertShader1);
glAttachShader(Program, VertShader2);
glAttachShader(Program, FragShader1);
glAttachShader(Program, FragShader2);
glLinkProgram_func(Program);
glLinkProgram(Program);
CheckLink(Program);
glUseProgram_func(Program);
glUseProgram(Program);
uDiffuse = glGetUniformLocation_func(Program, "diffuse");
uSpecular = glGetUniformLocation_func(Program, "specular");
uTexture = glGetUniformLocation_func(Program, "texture");
uDiffuse = glGetUniformLocation(Program, "diffuse");
uSpecular = glGetUniformLocation(Program, "specular");
uTexture = glGetUniformLocation(Program, "texture");
printf("DiffusePos %d SpecularPos %d TexturePos %d\n",
uDiffuse, uSpecular, uTexture);
glUniform4fv_func(uDiffuse, 1, diffuse);
glUniform4fv_func(uSpecular, 1, specular);
glUniform4fv(uDiffuse, 1, diffuse);
glUniform4fv(uSpecular, 1, specular);
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
glEnable(GL_DEPTH_TEST);
@@ -228,11 +224,11 @@ Init(void)
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 10.0f);
assert(glIsProgram_func(Program));
assert(glIsShader_func(VertShader1));
assert(glIsShader_func(VertShader2));
assert(glIsShader_func(FragShader1));
assert(glIsShader_func(FragShader2));
assert(glIsProgram(Program));
assert(glIsShader(VertShader1));
assert(glIsShader(VertShader2));
assert(glIsShader(FragShader1));
assert(glIsShader(FragShader2));
glColor3f(1, 0, 0);
}
@@ -245,6 +241,7 @@ main(int argc, char *argv[])
glutInitWindowSize(300, 300);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
Win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Redisplay);

View File

@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -56,9 +54,9 @@ Redisplay(void)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/* set interactive uniform parameters */
glUniform1fv_func(uZoom, 1, &zoom);
glUniform1fv_func(uXcenter, 1, &xCenter);
glUniform1fv_func(uYcenter, 1, &yCenter);
glUniform1fv(uZoom, 1, &zoom);
glUniform1fv(uXcenter, 1, &xCenter);
glUniform1fv(uYcenter, 1, &yCenter);
glPushMatrix();
glRotatef(xRot, 1.0f, 0.0f, 0.0f);
@@ -94,9 +92,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -155,19 +153,17 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
InitUniforms(program, Uniforms);
uZoom = glGetUniformLocation_func(program, "Zoom");
uXcenter = glGetUniformLocation_func(program, "Xcenter");
uYcenter = glGetUniformLocation_func(program, "Ycenter");
uZoom = glGetUniformLocation(program, "Zoom");
uXcenter = glGetUniformLocation(program, "Xcenter");
uYcenter = glGetUniformLocation(program, "Ycenter");
assert(glGetError() == 0);
@@ -175,9 +171,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
@@ -206,6 +202,7 @@ main(int argc, char *argv[])
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -8,10 +8,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
static const char *VertShaderText =
"void main() {\n"
@@ -107,10 +105,10 @@ CleanUp(void)
{
GLint i;
glDeleteShader_func(vertShader);
glDeleteShader(vertShader);
for( i = 0; i < 4; i++ ) {
glDeleteShader_func(fragShader[ i ]);
glDeleteProgram_func(program[ i ]);
glDeleteShader(fragShader[ i ]);
glDeleteProgram(program[ i ]);
}
glutDestroyWindow(win);
}
@@ -143,7 +141,7 @@ Key(unsigned char key, int x, int y)
case '2':
case '3':
case '4':
glUseProgram_func(program[ key - '1' ]);
glUseProgram(program[ key - '1' ]);
break;
case 27:
CleanUp();
@@ -186,15 +184,15 @@ LoadAndCompileShader(GLuint shader, const char *text)
{
GLint stat;
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
glShaderSource(shader, 1, (const GLchar **) &text, NULL);
glCompileShader_func(shader);
glCompileShader(shader);
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
glGetShaderiv(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog_func(shader, 1000, &len, log);
glGetShaderInfoLog(shader, 1000, &len, log);
fprintf(stderr, "noise: problem compiling shader: %s\n", log);
exit(1);
}
@@ -208,11 +206,11 @@ static void
CheckLink(GLuint prog)
{
GLint stat;
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
glGetProgramiv(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog_func(prog, 1000, &len, log);
glGetProgramInfoLog(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
else {
@@ -233,22 +231,20 @@ Init(void)
/*exit(1);*/
}
GetExtensionFuncs();
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
vertShader = glCreateShader(GL_VERTEX_SHADER);
LoadAndCompileShader(vertShader, VertShaderText);
for( i = 0; i < 4; i++ ) {
fragShader[ i ] = glCreateShader_func(GL_FRAGMENT_SHADER);
fragShader[ i ] = glCreateShader(GL_FRAGMENT_SHADER);
LoadAndCompileShader(fragShader[ i ], FragShaderText[ i ]);
program[ i ] = glCreateProgram_func();
glAttachShader_func(program[ i ], fragShader[ i ]);
glAttachShader_func(program[ i ], vertShader);
glLinkProgram_func(program[ i ]);
program[ i ] = glCreateProgram();
glAttachShader(program[ i ], fragShader[ i ]);
glAttachShader(program[ i ], vertShader);
glLinkProgram(program[ i ]);
CheckLink(program[ i ]);
}
glUseProgram_func(program[ 0 ]);
glUseProgram(program[ 0 ]);
assert(glGetError() == 0);
@@ -270,6 +266,7 @@ main(int argc, char *argv[])
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -28,9 +28,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glew.h>
#include "GL/glut.h"
#include "readtex.h"
#include "extfuncs.h"
#include "shaderutil.h"
static const char *Demo = "multitex";
@@ -80,22 +80,22 @@ static void
DrawPolygonArray(void)
{
if (VertCoord_attr >= 0) {
glVertexAttribPointer_func(VertCoord_attr, 2, GL_FLOAT, GL_FALSE,
glVertexAttribPointer(VertCoord_attr, 2, GL_FLOAT, GL_FALSE,
0, VertCoords);
glEnableVertexAttribArray_func(VertCoord_attr);
glEnableVertexAttribArray(VertCoord_attr);
}
else {
glVertexPointer(2, GL_FLOAT, 0, VertCoords);
glEnable(GL_VERTEX_ARRAY);
}
glVertexAttribPointer_func(TexCoord0_attr, 2, GL_FLOAT, GL_FALSE,
glVertexAttribPointer(TexCoord0_attr, 2, GL_FLOAT, GL_FALSE,
0, Tex0Coords);
glEnableVertexAttribArray_func(TexCoord0_attr);
glEnableVertexAttribArray(TexCoord0_attr);
glVertexAttribPointer_func(TexCoord1_attr, 2, GL_FLOAT, GL_FALSE,
glVertexAttribPointer(TexCoord1_attr, 2, GL_FLOAT, GL_FALSE,
0, Tex1Coords);
glEnableVertexAttribArray_func(TexCoord1_attr);
glEnableVertexAttribArray(TexCoord1_attr);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
@@ -109,11 +109,11 @@ DrawPolygonVert(void)
glBegin(GL_TRIANGLE_FAN);
for (i = 0; i < 4; i++) {
glVertexAttrib2fv_func(TexCoord0_attr, Tex0Coords[i]);
glVertexAttrib2fv_func(TexCoord1_attr, Tex1Coords[i]);
glVertexAttrib2fv(TexCoord0_attr, Tex0Coords[i]);
glVertexAttrib2fv(TexCoord1_attr, Tex1Coords[i]);
if (VertCoord_attr >= 0)
glVertexAttrib2fv_func(VertCoord_attr, VertCoords[i]);
glVertexAttrib2fv(VertCoord_attr, VertCoords[i]);
else
glVertex2fv(VertCoords[i]);
}
@@ -267,27 +267,27 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile,
assert(vertShader);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
InitUniforms(program, uniforms);
VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
VertCoord_attr = glGetAttribLocation(program, "VertCoord");
if (VertCoord_attr > 0) {
/* We want the VertCoord attrib to have position zero so that
* the call to glVertexAttrib(0, xyz) triggers vertex processing.
* Otherwise, if TexCoord0 or TexCoord1 gets position 0 we'd have
* to set that attribute last (which is a PITA to manage).
*/
glBindAttribLocation_func(program, 0, "VertCoord");
glBindAttribLocation(program, 0, "VertCoord");
/* re-link */
glLinkProgram_func(program);
glLinkProgram(program);
/* VertCoord_attr should be zero now */
VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
VertCoord_attr = glGetAttribLocation(program, "VertCoord");
assert(VertCoord_attr == 0);
}
TexCoord0_attr = glGetAttribLocation_func(program, "TexCoord0");
TexCoord1_attr = glGetAttribLocation_func(program, "TexCoord1");
TexCoord0_attr = glGetAttribLocation(program, "TexCoord0");
TexCoord1_attr = glGetAttribLocation(program, "TexCoord1");
printf("TexCoord0_attr = %d\n", TexCoord0_attr);
printf("TexCoord1_attr = %d\n", TexCoord1_attr);
@@ -315,8 +315,6 @@ InitGL(void)
}
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
GetExtensionFuncs();
InitTextures();
InitPrograms();
@@ -334,6 +332,7 @@ main(int argc, char *argv[])
glutInitWindowSize(500, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
glutCreateWindow(Demo);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(key);
glutSpecialFunc(specialkey);

View File

@@ -8,10 +8,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -67,7 +65,7 @@ Redisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUniform1fv_func(Uniforms[2].location, 1, &Slice);
glUniform1fv(Uniforms[2].location, 1, &Slice);
glPushMatrix();
glRotatef(xRot, 1.0f, 0.0f, 0.0f);
@@ -103,9 +101,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -175,13 +173,11 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
InitUniforms(program, Uniforms);
@@ -191,9 +187,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
@@ -207,6 +203,7 @@ main(int argc, char *argv[])
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -10,10 +10,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -64,9 +62,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -141,18 +139,16 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
tex0 = glGetUniformLocation_func(program, "tex0");
tex0 = glGetUniformLocation(program, "tex0");
printf("Uniforms: tex0: %d\n", tex0);
glUniform1i_func(tex0, 0); /* tex unit 0 */
glUniform1i(tex0, 0); /* tex unit 0 */
/*assert(glGetError() == 0);*/
@@ -160,9 +156,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
MakeTexture();
@@ -195,6 +191,7 @@ main(int argc, char *argv[])
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Redisplay);

View File

@@ -10,10 +10,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -99,7 +97,7 @@ Redisplay(void)
*/
glPushMatrix();
glTranslatef(0, 1.2, 0);
glUseProgram_func(0);
glUseProgram(0);
DrawPoints(GL_FALSE);
glPopMatrix();
@@ -108,9 +106,9 @@ Redisplay(void)
*/
glPushMatrix();
glTranslatef(0, -1.2, 0);
glUseProgram_func(Program);
glUseProgram(Program);
if (uViewportInv != -1) {
glUniform2f_func(uViewportInv, 1.0 / WinWidth, 1.0 / WinHeight);
glUniform2f(uViewportInv, 1.0 / WinWidth, 1.0 / WinHeight);
}
DrawPoints(GL_TRUE);
glPopMatrix();
@@ -150,9 +148,9 @@ Key(unsigned char key, int x, int y)
Smooth = !Smooth;
break;
case 27:
glDeleteShader_func(FragShader);
glDeleteShader_func(VertShader);
glDeleteProgram_func(Program);
glDeleteShader(FragShader);
glDeleteShader(VertShader);
glDeleteProgram(Program);
glutDestroyWindow(Win);
exit(0);
}
@@ -225,17 +223,15 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
VertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
FragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
Program = LinkShaders(VertShader, FragShader);
glUseProgram_func(Program);
glUseProgram(Program);
uViewportInv = glGetUniformLocation_func(Program, "viewportInv");
uViewportInv = glGetUniformLocation(Program, "viewportInv");
glUseProgram_func(0);
glUseProgram(0);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
@@ -248,6 +244,7 @@ main(int argc, char *argv[])
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
Win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -11,6 +11,7 @@ void main()
float two_n_dot_u = 2.0 * dot(n, u);
vec4 f;
f.xyz = u - n * two_n_dot_u;
f.w = 1.0;
// outputs
normal = n;

View File

@@ -39,9 +39,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glew.h>
#include "GL/glut.h"
#include "readtex.h"
#include "extfuncs.h"
#include "shaderutil.h"
@@ -290,7 +290,7 @@ CreateProgram(void)
assert(vertShader);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
free(fragShaderText);
@@ -315,10 +315,10 @@ InitProgram(void)
#else
sprintf(uname, "tex[%d]", s);
#endif
loc = glGetUniformLocation_func(Program, uname);
loc = glGetUniformLocation(Program, uname);
assert(loc >= 0);
glUniform1i_func(loc, s);
glUniform1i(loc, s);
}
}
@@ -333,8 +333,6 @@ InitGL(void)
printf("GL_RENDERER = %s\n", (const char *) glGetString(GL_RENDERER));
GetExtensionFuncs();
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &NumSamplers);
if (NumSamplers > MAX_SAMPLERS)
NumSamplers = MAX_SAMPLERS;
@@ -357,6 +355,7 @@ main(int argc, char *argv[])
glutInitWindowSize(500, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
glutCreateWindow(Demo);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(key);
glutSpecialFunc(specialkey);

View File

@@ -10,10 +10,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
/** Use GL_RECTANGLE texture (with projective texcoords)? */
@@ -66,7 +64,7 @@ Redisplay(void)
glPushMatrix();
CheckError(__LINE__);
glUseProgram_func(program);
glUseProgram(program);
CheckError(__LINE__);
glBegin(GL_POLYGON);
@@ -86,7 +84,7 @@ Redisplay(void)
glPopMatrix();
glUseProgram_func(0);
glUseProgram(0);
glWindowPos2iARB(80, 20);
PrintString("white black white black");
@@ -110,9 +108,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -178,13 +176,13 @@ static void
LoadAndCompileShader(GLuint shader, const char *text)
{
GLint stat;
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
glCompileShader_func(shader);
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
glShaderSource(shader, 1, (const GLchar **) &text, NULL);
glCompileShader(shader);
glGetShaderiv(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog_func(shader, 1000, &len, log);
glGetShaderInfoLog(shader, 1000, &len, log);
fprintf(stderr, "fslight: problem compiling shader:\n%s\n", log);
exit(1);
}
@@ -222,11 +220,11 @@ static void
CheckLink(GLuint prog)
{
GLint stat;
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
glGetProgramiv(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog_func(prog, 1000, &len, log);
glGetProgramInfoLog(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
}
@@ -266,35 +264,33 @@ Init(void)
}
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
GetExtensionFuncs();
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
fragShader = glCreateShader(GL_FRAGMENT_SHADER);
if (FragProgFile)
ReadShader(fragShader, FragProgFile);
else
LoadAndCompileShader(fragShader, fragShaderText);
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
vertShader = glCreateShader(GL_VERTEX_SHADER);
if (VertProgFile)
ReadShader(vertShader, VertProgFile);
else
LoadAndCompileShader(vertShader, vertShaderText);
program = glCreateProgram_func();
glAttachShader_func(program, fragShader);
glAttachShader_func(program, vertShader);
glLinkProgram_func(program);
program = glCreateProgram();
glAttachShader(program, fragShader);
glAttachShader(program, vertShader);
glLinkProgram(program);
CheckLink(program);
glUseProgram_func(program);
glUseProgram(program);
uTexture2D = glGetUniformLocation_func(program, "shadowTex2D");
uTextureRect = glGetUniformLocation_func(program, "shadowTexRect");
uTexture2D = glGetUniformLocation(program, "shadowTex2D");
uTextureRect = glGetUniformLocation(program, "shadowTexRect");
printf("uTexture2D %d uTextureRect %d\n", uTexture2D, uTextureRect);
if (uTexture2D >= 0) {
glUniform1i_func(uTexture2D, 0); /* use texture unit 0 */
glUniform1i(uTexture2D, 0); /* use texture unit 0 */
}
if (uTextureRect >= 0) {
glUniform1i_func(uTextureRect, 1); /* use texture unit 0 */
glUniform1i(uTextureRect, 1); /* use texture unit 0 */
}
CheckError(__LINE__);
@@ -329,6 +325,7 @@ main(int argc, char *argv[])
glutInitWindowSize(400, 300);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Redisplay);

View File

@@ -12,10 +12,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -64,11 +62,11 @@ Cylinder(GLfloat length, GLfloat radius, GLint slices, GLint stacks)
float a = (float) i / (slices - 1) * M_PI * 2.0;
float x = radius * cos(a);
float y = radius * sin(a);
glVertexAttrib1f_func(WeightAttr, w0);
glVertexAttrib1f(WeightAttr, w0);
glNormal3f(x, y, 0.0);
glVertex3f(x, y, z0);
glVertexAttrib1f_func(WeightAttr, w0 + dw);
glVertexAttrib1f(WeightAttr, w0 + dw);
glNormal3f(x, y, 0.0);
glVertex3f(x, y, z0 + dz);
}
@@ -106,8 +104,8 @@ Redisplay(void)
{
UpdateMatrices();
glUniformMatrix4fv_func(uMat0, 1, GL_FALSE, Matrices[0]);
glUniformMatrix4fv_func(uMat1, 1, GL_FALSE, Matrices[1]);
glUniformMatrix4fv(uMat0, 1, GL_FALSE, Matrices[0]);
glUniformMatrix4fv(uMat1, 1, GL_FALSE, Matrices[1]);
if (WireFrame)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
@@ -148,9 +146,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -221,18 +219,16 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
uMat0 = glGetUniformLocation_func(program, "mat0");
uMat1 = glGetUniformLocation_func(program, "mat1");
uMat0 = glGetUniformLocation(program, "mat0");
uMat1 = glGetUniformLocation(program, "mat1");
WeightAttr = glGetAttribLocation_func(program, "weight");
WeightAttr = glGetAttribLocation(program, "weight");
assert(glGetError() == 0);
@@ -266,6 +262,7 @@ main(int argc, char *argv[])
glutInitWindowSize(500, 500);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -11,10 +11,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
static GLint WinWidth = 300, WinHeight = 300;
@@ -328,8 +326,6 @@ Init(void)
exit(1);
}
GetExtensionFuncs();
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
@@ -359,6 +355,7 @@ main(int argc, char *argv[])
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Redisplay);

View File

@@ -28,9 +28,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glew.h>
#include "GL/glut.h"
#include "readtex.h"
#include "extfuncs.h"
#include "shaderutil.h"
static const char *Demo = "texdemo1";
@@ -97,7 +97,7 @@ draw(void)
/* sphere w/ reflection map */
glPushMatrix();
glTranslatef(0, 1, 0);
glUseProgram_func(Program1);
glUseProgram(Program1);
/* setup texture matrix */
glActiveTexture(GL_TEXTURE0);
@@ -116,7 +116,7 @@ draw(void)
glPopMatrix();
/* ground */
glUseProgram_func(Program2);
glUseProgram(Program2);
glTranslatef(0, -1.0, 0);
DrawGround(5);
@@ -380,7 +380,7 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile,
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, fragProgFile);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
InitUniforms(program, uniforms);
@@ -407,8 +407,6 @@ Init(GLboolean useImageFiles)
}
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
GetExtensionFuncs();
InitTextures(useImageFiles);
InitPrograms();
@@ -426,6 +424,7 @@ main(int argc, char *argv[])
glutInitWindowSize(500, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
win = glutCreateWindow(Demo);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(key);
glutSpecialFunc(specialkey);

View File

@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -99,9 +97,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -169,13 +167,11 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
InitUniforms(program, Uniforms);
@@ -212,6 +208,7 @@ main(int argc, char *argv[])
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -15,10 +15,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -85,9 +83,9 @@ Redisplay(void)
RotateVerts(Zrot, 3, TriVerts, v);
ComputeBounds(3, v, &xmin, &ymin, &xmax, &ymax);
glUniform2fv_func(uv0, 1, v[0]);
glUniform2fv_func(uv1, 1, v[1]);
glUniform2fv_func(uv2, 1, v[2]);
glUniform2fv(uv0, 1, v[0]);
glUniform2fv(uv1, 1, v[1]);
glUniform2fv(uv2, 1, v[2]);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -132,9 +130,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -196,17 +194,15 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
uv0 = glGetUniformLocation_func(program, "v0");
uv1 = glGetUniformLocation_func(program, "v1");
uv2 = glGetUniformLocation_func(program, "v2");
uv0 = glGetUniformLocation(program, "v0");
uv1 = glGetUniformLocation(program, "v1");
uv2 = glGetUniformLocation(program, "v2");
printf("Uniforms: %d %d %d\n", uv0, uv1, uv2);
/*assert(glGetError() == 0);*/
@@ -216,9 +212,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
@@ -247,6 +243,7 @@ main(int argc, char *argv[])
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Redisplay);

View File

@@ -12,10 +12,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -59,11 +57,11 @@ Redisplay(void)
glFrontFace(FrontWinding);
if (DetermineFacingInFragProg) {
glUniform1i_func(u_fragface, 1);
glUniform1i(u_fragface, 1);
glDisable(GL_VERTEX_PROGRAM_TWO_SIDE);
}
else {
glUniform1i_func(u_fragface, 0);
glUniform1i(u_fragface, 0);
glEnable(GL_VERTEX_PROGRAM_TWO_SIDE);
}
@@ -75,7 +73,7 @@ Redisplay(void)
/* Draw a tristrip ring */
glBegin(GL_TRIANGLE_STRIP);
glColor4fv(Red);
glSecondaryColor3fv_func(Green);
glSecondaryColor3fv(Green);
for (i = 0; i <= sections; i++) {
float a = (float) i / (sections) * M_PI * 2.0;
float x = radius * cos(a);
@@ -125,9 +123,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -229,15 +227,13 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
u_fragface = glGetUniformLocation_func(program, "fragface");
u_fragface = glGetUniformLocation(program, "fragface");
printf("Uniforms: %d\n", u_fragface);
/*assert(glGetError() == 0);*/
@@ -246,9 +242,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
glEnable(GL_DEPTH_TEST);
@@ -293,6 +289,7 @@ main(int argc, char *argv[])
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Redisplay);

View File

@@ -11,10 +11,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -58,14 +56,14 @@ Redisplay(void)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/* render with vertex shader only */
glUseProgram_func(VertProgram);
glUseProgram(VertProgram);
glPushMatrix();
glTranslatef(-1.5, 0, 0);
DrawQuadTex();
glPopMatrix();
/* render with fragment shader only */
glUseProgram_func(FragProgram);
glUseProgram(FragProgram);
glPushMatrix();
glTranslatef(+1.5, 0, 0);
DrawQuadColor();
@@ -90,10 +88,10 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(FragShader);
glDeleteShader_func(VertShader);
glDeleteProgram_func(VertProgram);
glDeleteProgram_func(FragProgram);
glDeleteShader(FragShader);
glDeleteShader(VertShader);
glDeleteProgram(VertProgram);
glDeleteProgram(FragProgram);
glutDestroyWindow(Win);
}
@@ -129,8 +127,6 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
if (FragProgFile)
FragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
else
@@ -149,10 +145,10 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(VertProgram));
assert(glIsProgram_func(FragProgram));
assert(glIsShader_func(FragShader));
assert(glIsShader_func(VertShader));
assert(glIsProgram(VertProgram));
assert(glIsProgram(FragProgram));
assert(glIsShader(FragShader));
assert(glIsShader(VertShader));
glColor3f(1, 0, 0);
}
@@ -181,6 +177,7 @@ main(int argc, char *argv[])
glutInitWindowSize(400, 200);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
Win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Redisplay);

View File

@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -133,9 +131,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -239,13 +237,11 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
assert(glGetError() == 0);
@@ -266,6 +262,7 @@ main(int argc, char *argv[])
glutInitWindowSize(500, 500);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -5,6 +5,7 @@ arbfpspec
arbfptest1
arbfptexture
arbfptrig
arbgpuprog
arbnpot
arbnpot-mipmap
arbvptest1
@@ -38,6 +39,7 @@ fptest1
fptexture
getprocaddress
getproclist.h
getteximage
glutfx
interleave
invert
@@ -49,12 +51,15 @@ mapvbo
minmag
mipgen
mipmap_comp
mipmap_comp_tests
mipmap_limits
mipmap_view
multipal
no_s3tc
packedpixels
persp_hint
pbo
prim
prog_parameter
quads
random
@@ -62,6 +67,8 @@ readrate
readtex.c
readtex.h
rubberband
scissor
scissor-viewport
seccolor
shader_api
shaderutil.c
@@ -75,6 +82,7 @@ subtex
subtexrate
tex1d
texcompress2
texcompsub
texdown
texfilt
texline

View File

@@ -59,6 +59,7 @@ SOURCES = \
minmag.c \
mipgen.c \
mipmap_comp.c \
mipmap_comp_tests.c \
mipmap_limits.c \
mipmap_view.c \
multipal.c \
@@ -70,6 +71,8 @@ SOURCES = \
random.c \
readrate.c \
rubberband.c \
scissor.c \
scissor-viewport.c \
seccolor.c \
shader_api.c \
sharedtex.c \
@@ -81,6 +84,7 @@ SOURCES = \
subtexrate.c \
tex1d.c \
texcompress2.c \
texcompsub.c \
texdown \
texfilt.c \
texline.c \

View File

@@ -82,6 +82,7 @@ progs = [
'minmag',
'mipgen',
'mipmap_comp',
'mipmap_comp_tests',
'mipmap_limits',
'mipmap_view',
'multipal',
@@ -95,6 +96,8 @@ progs = [
'random',
'readrate',
'rubberband',
'scissor',
'scissor-viewport',
'seccolor',
'shader_api',
'stencil_twoside',
@@ -106,6 +109,7 @@ progs = [
'tex1d',
'texcmp',
'texcompress2',
'texcompsub',
'texdown',
'texfilt',
'texgenmix',

View File

@@ -0,0 +1,318 @@
/* Copyright (c) Mark J. Kilgard, 1994. */
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
* GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
* SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
* KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
* LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
* THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
* clause at DFARS 252.227-7013 and/or in similar or successor
* clauses in the FAR or the DOD or NASA FAR Supplement.
* Unpublished-- rights reserved under the copyright laws of the
* United States. Contractor/manufacturer is Silicon Graphics,
* Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
*
* OpenGL(TM) is a trademark of Silicon Graphics, Inc.
*/
/* mipmap_comp
* Test compressed texture mipmaps
*
* Based on mipmap_limits
*/
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include "readtex.h"
#define SIZE 16 /* not larger then 16 */
static GLint BaseLevel = 0, MaxLevel ;
static GLfloat MinLod, MaxLod;
static GLfloat LodBias;
static GLboolean NearestFilter;
static GLuint texImage;
static GLuint View;
struct view {
GLfloat minLod;
GLfloat maxLod;
const char *string;
};
static struct view views[] =
{
{ 0, 0, "Green" },
{ 0, 1, "Green, Red" },
{ 0, 2, "Green, Red, Blue" },
{ 0, 3, "Green, Red, Blue, Black" },
{ 0, 4, "Green, Red, Blue, Black, White" },
{ 1, 4, "Red, Blue, Black, White" },
{ 2, 4, "Blue, Black, White" },
{ 3, 4, "Black, White" },
{ 4, 4, "White" },
{ 3, 3, "Black" },
{ 2, 2, "Blue" },
{ 1, 1, "Red" },
{ 1, 3, "Red, Blue, Black" },
{ 1, 2, "Red, Blue" },
{ 2, 3, "Blue, Black" },
{ 0, 0, NULL },
};
static void
initValues(void)
{
View = 12;
BaseLevel = 0;
MaxLevel = 9;
MinLod = views[View].minLod;
MaxLod = views[View].maxLod;
LodBias = 5.0;
NearestFilter = GL_TRUE;
}
static void
changeView(void)
{
if (views[++View].string == NULL)
View = 0;
MinLod = views[View].minLod;
MaxLod = views[View].maxLod;
}
static void
makeImage(int level, int width, int height)
{
GLubyte img[SIZE*SIZE*3];
GLubyte color[5][3] = {
{ 0, 255, 0 },
{ 255, 0, 0 },
{ 0, 0, 255 },
{ 0, 0, 0 },
{ 255, 255, 255 },
};
int i, j;
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
int k = (i * width + j) * 3;
img[k + 0] = color[level][0];
img[k + 1] = color[level][1];
img[k + 2] = color[level][2];
}
}
glTexImage2D(GL_TEXTURE_2D, level,
GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
width, height, 0,
GL_RGB, GL_UNSIGNED_BYTE, img);
}
static void
makeImages(void)
{
int i, sz;
for (i = 0, sz = SIZE; sz >= 1; i++, sz /= 2) {
makeImage(i, sz, sz);
printf("Level %d size: %d x %d\n", i, sz, sz);
}
}
static void
myInit(void)
{
initValues();
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glShadeModel(GL_FLAT);
glTranslatef(0.0, 0.0, -3.6);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGenTextures(1, &texImage);
glBindTexture(GL_TEXTURE_2D, texImage);
makeImages();
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glEnable(GL_TEXTURE_2D);
}
static void
display(void)
{
GLfloat tcm = 1.0;
glBindTexture(GL_TEXTURE_2D, texImage);
printf("BASE_LEVEL=%d MAX_LEVEL=%d MIN_LOD=%.2g MAX_LOD=%.2g Bias=%.2g Filter=%s\n",
BaseLevel, MaxLevel, MinLod, MaxLod, LodBias,
NearestFilter ? "NEAREST" : "LINEAR");
printf("You should see: %s\n", views[View].string );
fflush(stdout);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, MaxLevel);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, MinLod);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, MaxLod);
if (NearestFilter) {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_NEAREST_MIPMAP_NEAREST);
}
else {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
}
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, LodBias);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0);
glTexCoord2f(0.0, tcm); glVertex3f(-2.0, 1.0, 0.0);
glTexCoord2f(tcm * 3000.0, tcm); glVertex3f(3000.0, 1.0, -6000.0);
glTexCoord2f(tcm * 3000.0, 0.0); glVertex3f(3000.0, -1.0, -6000.0);
glEnd();
glFlush();
}
static void
myReshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
static void
key(unsigned char k, int x, int y)
{
(void) x;
(void) y;
switch (k) {
#if 0
case 'b':
BaseLevel--;
if (BaseLevel < 0)
BaseLevel = 0;
break;
case 'B':
BaseLevel++;
if (BaseLevel > 10)
BaseLevel = 10;
break;
case 'm':
MaxLevel--;
if (MaxLevel < 0)
MaxLevel = 0;
break;
case 'M':
MaxLevel++;
if (MaxLevel > 10)
MaxLevel = 10;
break;
case 'l':
LodBias -= 0.25;
break;
case 'L':
LodBias += 0.25;
break;
case 'n':
MinLod -= 0.25;
break;
case 'N':
MinLod += 0.25;
break;
case 'x':
MaxLod -= 0.25;
break;
case 'X':
MaxLod += 0.25;
break;
case 'f':
NearestFilter = !NearestFilter;
break;
#endif
case ' ':
initValues();
break;
case 27: /* Escape */
exit(0);
break;
default:
changeView();
break;
}
glutPostRedisplay();
}
static void
usage(void)
{
printf("usage:\n");
printf(" Any Change view\n");
printf(" SPACE reset values\n");
}
int
main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize (600, 600);
glutCreateWindow (argv[0]);
glewInit();
myInit();
glutReshapeFunc (myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
usage();
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -0,0 +1,138 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
* Copyright (c) 2009 VMware, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
struct program
{
unsigned width;
unsigned height;
int i;
};
struct program prog;
static void init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fflush(stderr);
prog.i = 0;
}
static void reshape(int width, int height)
{
glViewport(0, 0, 100, 100);
prog.width = width;
prog.height = height;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
glutPostRedisplay();
return;
}
}
static void drawQuad(void)
{
glBegin(GL_QUADS);
glVertex2d(-1.0, -1.0);
glVertex2d( 1.0, -1.0);
glVertex2d( 1.0, 1.0);
glVertex2d(-1.0, 1.0);
glEnd();
}
static void draw(void)
{
int i;
glClearColor(0.0, 0.0, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
i = prog.i++;
if (prog.i >= 3)
prog.i = 0;
glEnable(GL_SCISSOR_TEST);
{
glColor4d(1.0, 0.0, 0.0, 1.0);
glScissor(i, i, 10 - 2*i, 10 - 2*i);
drawQuad();
}
glDisable(GL_SCISSOR_TEST);
//glutSwapBuffers();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
prog.width = 200;
prog.height = 200;
glutInitWindowPosition(100, 0);
glutInitWindowSize(prog.width, prog.height);
//type = GLUT_RGB | GLUT_DOUBLE;
type = GLUT_RGB | GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}
init();
glutReshapeFunc(reshape);
glutKeyboardFunc(key);
glutDisplayFunc(draw);
glutMainLoop();
return 0;
}

168
progs/tests/scissor.c Normal file
View File

@@ -0,0 +1,168 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
* Copyright (c) 2009 VMware, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
struct program
{
unsigned width;
unsigned height;
unsigned quads;
};
struct program prog;
static void init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fflush(stderr);
}
static void reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
prog.width = width;
prog.height = height;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
prog.quads = !prog.quads;
glutPostRedisplay();
return;
}
}
static void drawQuad(void)
{
if (prog.quads) {
glBegin(GL_QUADS);
glVertex2d(-1.0, -1.0);
glVertex2d( 1.0, -1.0);
glVertex2d( 1.0, 1.0);
glVertex2d(-1.0, 1.0);
glEnd();
} else {
glClear(GL_COLOR_BUFFER_BIT);
}
}
static void draw(void)
{
glClearColor(0.0, 0.0, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
printf("drawing with %s\n", prog.quads ? "quads" : "clears");
glEnable(GL_SCISSOR_TEST);
{
glClearColor(1.0, 0.0, 0.0, 1.0);
glColor4d(1.0, 0.0, 0.0, 1.0);
glScissor(1, 1, 10, 10);
drawQuad();
glScissor(1, prog.height - 11, 10, 10);
drawQuad();
glScissor(prog.width - 11, prog.height - 11, 10, 10);
drawQuad();
}
{
glClearColor(0.0, 1.0, 0.0, 1.0);
glColor4d(0.0, 1.0, 0.0, 1.0);
glScissor(12, 1, 10, 10);
drawQuad();
glScissor(12, prog.height - 11, 10, 10);
drawQuad();
glScissor(prog.width - 22, prog.height - 11, 10, 10);
drawQuad();
}
{
glClearColor(1.0, 1.0, 0.0, 1.0);
glColor4d(1.0, 1.0, 0.0, 1.0);
glScissor(1, 12, 10, 10);
drawQuad();
glScissor(1, prog.height - 22, 10, 10);
drawQuad();
glScissor(prog.width - 11, prog.height - 22, 10, 10);
drawQuad();
}
glDisable(GL_SCISSOR_TEST);
//glutSwapBuffers();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
prog.width = 200;
prog.height = 200;
glutInitWindowPosition(100, 0);
glutInitWindowSize(prog.width, prog.height);
//type = GLUT_RGB | GLUT_DOUBLE;
type = GLUT_RGB | GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}
init();
glutReshapeFunc(reshape);
glutKeyboardFunc(key);
glutDisplayFunc(draw);
glutMainLoop();
return 0;
}

4100
progs/tests/texcomp_image.h Normal file

File diff suppressed because it is too large Load Diff

165
progs/tests/texcompsub.c Normal file
View File

@@ -0,0 +1,165 @@
/*
* Test texture compression.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include "texcomp_image.h"
static int ImgWidth = 512;
static int ImgHeight = 512;
static GLenum CompFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
static GLfloat EyeDist = 5.0;
static GLfloat Rot = 0.0;
const GLenum Target = GL_TEXTURE_2D;
static void
CheckError(int line)
{
GLenum err = glGetError();
if (err) {
printf("GL Error %d at line %d\n", (int) err, line);
}
}
static void
LoadCompressedImage(void)
{
const GLenum filter = GL_LINEAR;
glTexImage2D(Target, 0, CompFormat, ImgWidth, ImgHeight, 0,
GL_RGB, GL_UNSIGNED_BYTE, NULL);
/* bottom half */
glCompressedTexSubImage2DARB(Target, 0,
0, 0, /* pos */
ImgWidth, ImgHeight / 2,
CompFormat, ImgSize / 2, ImgData + ImgSize / 2);
/* top half */
glCompressedTexSubImage2DARB(Target, 0,
0, ImgHeight / 2, /* pos */
ImgWidth, ImgHeight / 2,
CompFormat, ImgSize / 2, ImgData);
glTexParameteri(Target, GL_TEXTURE_MIN_FILTER, filter);
glTexParameteri(Target, GL_TEXTURE_MAG_FILTER, filter);
}
static void
Init()
{
GLint numFormats, formats[100];
GLint p;
if (!glutExtensionSupported("GL_ARB_texture_compression")) {
printf("Sorry, GL_ARB_texture_compression is required.\n");
exit(1);
}
if (!glutExtensionSupported("GL_EXT_texture_compression_s3tc")) {
printf("Sorry, GL_EXT_texture_compression_s3tc is required.\n");
exit(1);
}
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, &numFormats);
glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS_ARB, formats);
printf("%d supported compression formats: ", numFormats);
for (p = 0; p < numFormats; p++)
printf("0x%x ", formats[p]);
printf("\n");
glEnable(GL_TEXTURE_2D);
LoadCompressedImage();
}
static void
Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum(-1, 1, -1, 1, 4, 100);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
}
static void
Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 'd':
EyeDist -= 1.0;
if (EyeDist < 4.0)
EyeDist = 4.0;
break;
case 'D':
EyeDist += 1.0;
break;
case 'z':
Rot += 5.0;
break;
case 'Z':
Rot -= 5.0;
break;
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void
Draw( void )
{
glClearColor(0.3, 0.3, .8, 0);
glClear(GL_COLOR_BUFFER_BIT);
CheckError(__LINE__);
glPushMatrix();
glTranslatef(0, 0, -(EyeDist+0.01));
glRotatef(Rot, 0, 0, 1);
glBegin(GL_POLYGON);
glTexCoord2f(0, 0); glVertex2f(-1, -1);
glTexCoord2f(1, 0); glVertex2f( 1, -1);
glTexCoord2f(1, 1); glVertex2f( 1, 1);
glTexCoord2f(0, 1); glVertex2f(-1, 1);
glEnd();
glPopMatrix();
glutSwapBuffers();
}
int
main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowSize( 600, 600 );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Draw );
Init();
glutMainLoop();
return 0;
}

View File

@@ -21,7 +21,7 @@ static void Display(void)
GLfloat min, max;
int i;
glClearColor(0.5, 0.5, 0.5, 0);
glClearColor(0.5, 0.5, 0.5, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/* draw a sphere */
@@ -82,7 +82,7 @@ static void Key(unsigned char key, int x, int y)
static void Init(void)
{
const GLfloat blue[4] = {.1, .1, 1.0, 0.0};
const GLfloat blue[4] = {.1, .1, 1.0, 1.0};
const GLfloat gray[4] = {0.2, 0.2, 0.2, 1.0};
const GLfloat white[4] = {1.0, 1.0, 1.0, 1.0};
const GLfloat pos[4] = {0, 0, 10, 0};

View File

@@ -19,6 +19,12 @@ SOURCES = \
clear-random.c \
clear.c \
dlist-dangling.c \
dlist-flat-tri.c \
dlist-mat-tri.c \
dlist-tri-flat-tri.c \
dlist-tri-mat-tri.c \
dlist-recursive-call.c \
dlist-begin-call-end.c \
dlist-edgeflag-dangling.c \
dlist-edgeflag.c \
dlist-degenerate.c \
@@ -105,6 +111,7 @@ SOURCES = \
tri-fp.c \
tri-fp-const-imm.c \
tri-lit.c \
tri-lit-material.c \
tri-mask-tri.c \
tri-orig.c \
tri-query.c \

View File

@@ -0,0 +1,159 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
#define CI_OFFSET_1 16
#define CI_OFFSET_2 32
GLenum doubleBuffer;
GLint first_list, list;
static void Init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
/* First list will disrupt state which might potentially be
* short-circuited in calling list:
*/
first_list = glGenLists(1);
glNewList(first_list, GL_COMPILE);
// glColor3f(0,1,0);
glEndList();
/* List that looks like it might have redundant state:
*/
list = glGenLists(1);
glNewList(list, GL_COMPILE);
glShadeModel(GL_FLAT);
glBegin(GL_TRIANGLES);
glColor3f(1,0,0);
glVertex3f( -0.9, 0.9, -30.0);
glVertex3f( -0.9, -0.9, -30.0);
glCallList( first_list );
glVertex3f( 0.9, 0.0, -30.0);
glEnd();
glEndList();
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glShadeModel( GL_SMOOTH );
glCallList(list);
glFlush();
if (doubleBuffer) {
glutSwapBuffers();
}
}
static GLenum Args(int argc, char **argv)
{
GLint i;
doubleBuffer = GL_FALSE;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-sb") == 0) {
doubleBuffer = GL_FALSE;
} else if (strcmp(argv[i], "-db") == 0) {
doubleBuffer = GL_TRUE;
} else {
fprintf(stderr, "%s (Bad option).\n", argv[i]);
return GL_FALSE;
}
}
return GL_TRUE;
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
if (Args(argc, argv) == GL_FALSE) {
exit(1);
}
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB | GLUT_ALPHA;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

View File

@@ -0,0 +1,171 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
#define CI_OFFSET_1 16
#define CI_OFFSET_2 32
GLenum doubleBuffer;
GLint list;
static void Init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
list = glGenLists(1);
glNewList(list, GL_COMPILE);
/* XXX: this state-change will only be executed if list is called
* from outside a begin/end pair:
*/
glShadeModel( GL_FLAT );
glBegin(GL_TRIANGLES);
glColor3f(0,0,.7);
glVertex3f( -0.9, 0.9, -30.0);
glColor3f(0,.9,0);
glVertex3f( -0.9, -0.9, -30.0);
glColor3f(.8,0,0);
glVertex3f( 0.9, 0.0, -30.0);
glEnd();
/* This statechange is potentially NOT redundant:
*/
glShadeModel( GL_FLAT );
glBegin(GL_TRIANGLES);
glColor3f(0,1,0);
glVertex3f( -0.5, 0.5, -30.0);
glColor3f(0,0,1);
glVertex3f( -0.5, -0.5, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.5, 0.0, -30.0);
glEnd();
glEndList();
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glShadeModel( GL_SMOOTH );
glBegin(GL_TRIANGLES);
/* Note: call the list from inside a begin/end pair. The end is
* provided by the display list...
*/
glCallList(list);
glFlush();
if (doubleBuffer) {
glutSwapBuffers();
}
}
static GLenum Args(int argc, char **argv)
{
GLint i;
doubleBuffer = GL_FALSE;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-sb") == 0) {
doubleBuffer = GL_FALSE;
} else if (strcmp(argv[i], "-db") == 0) {
doubleBuffer = GL_TRUE;
} else {
fprintf(stderr, "%s (Bad option).\n", argv[i]);
return GL_FALSE;
}
}
return GL_TRUE;
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
if (Args(argc, argv) == GL_FALSE) {
exit(1);
}
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB | GLUT_ALPHA;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

View File

@@ -0,0 +1,182 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
#define CI_OFFSET_1 16
#define CI_OFFSET_2 32
GLenum doubleBuffer;
GLint list;
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
/*static GLfloat blue[4] = {0.2, 0.2, .7, 1.0};*/
static void Init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fflush(stderr);
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glClearColor(0.0, 0.0, 1.0, 0.0);
list = glGenLists(1);
glNewList(list, GL_COMPILE);
/* XXX: this state-change will be executed regardless of whether
* the list is called from outside a begin/end pair:
*/
glMaterialfv(GL_FRONT, GL_AMBIENT, red);
glBegin(GL_TRIANGLES);
glVertex3f( -0.9, 0.9, -30.0);
glVertex3f( -0.9, -0.9, -30.0);
glVertex3f( 0.9, 0.0, -30.0);
glEnd();
glMaterialfv(GL_FRONT, GL_DIFFUSE, red);
glBegin(GL_TRIANGLES);
glVertex3f( -0.7, 0.7, -30.0);
glVertex3f( -0.7, -0.7, -30.0);
glVertex3f( 0.7, 0.0, -30.0);
glEnd();
/* This statechange is redundant:
*/
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
glBegin(GL_TRIANGLES);
glVertex3f( -0.5, 0.5, -30.0);
glVertex3f( -0.5, -0.5, -30.0);
glVertex3f( 0.5, 0.0, -30.0);
glEnd();
glEndList();
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glShadeModel( GL_SMOOTH );
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
glBegin(GL_TRIANGLES);
/* Note: call the list from inside a begin/end pair. The end is
* provided by the display list...
*/
glCallList(list);
glFlush();
if (doubleBuffer) {
glutSwapBuffers();
}
}
static GLenum Args(int argc, char **argv)
{
GLint i;
doubleBuffer = GL_FALSE;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-sb") == 0) {
doubleBuffer = GL_FALSE;
} else if (strcmp(argv[i], "-db") == 0) {
doubleBuffer = GL_TRUE;
} else {
fprintf(stderr, "%s (Bad option).\n", argv[i]);
return GL_FALSE;
}
}
return GL_TRUE;
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
if (Args(argc, argv) == GL_FALSE) {
exit(1);
}
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB | GLUT_ALPHA;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

View File

@@ -0,0 +1,190 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
#define CI_OFFSET_1 16
#define CI_OFFSET_2 32
GLenum doubleBuffer;
GLint first_list, list;
static void Init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
/* First list will disrupt state which might potentially be
* short-circuited in calling list:
*/
first_list = glGenLists(1);
glNewList(first_list, GL_COMPILE);
glShadeModel( GL_SMOOTH );
glEndList();
/* List that looks like it might have redundant state:
*/
list = glGenLists(1);
glNewList(list, GL_COMPILE);
glBegin(GL_TRIANGLES);
glColor3f(0,0,.7);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(.8,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,.9,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glShadeModel( GL_FLAT );
glBegin(GL_TRIANGLES);
glColor3f(0,0,.7);
glVertex3f( -0.9, 0.9, -30.0);
glColor3f(0,.9,0);
glVertex3f( -0.9, -0.9, -30.0);
glColor3f(.8,0,0);
glVertex3f( 0.9, 0.0, -30.0);
glEnd();
glCallList( first_list );
/* Do a quick begin/end to ensure we are not inside a dangling
* primitive from the called list:
*/
glBegin( GL_POINTS );
glEnd();
/* This statechange is NOT redundant:
*/
glShadeModel( GL_FLAT );
glBegin(GL_TRIANGLES);
glColor3f(1,0,0);
glVertex3f( -0.5, 0.5, -30.0);
glColor3f(0,1,0);
glVertex3f( -0.5, -0.5, -30.0);
glColor3f(0,0,1);
glVertex3f( 0.5, 0.0, -30.0);
glEnd();
glEndList();
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glShadeModel( GL_SMOOTH );
glCallList(list);
glFlush();
if (doubleBuffer) {
glutSwapBuffers();
}
}
static GLenum Args(int argc, char **argv)
{
GLint i;
doubleBuffer = GL_FALSE;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-sb") == 0) {
doubleBuffer = GL_FALSE;
} else if (strcmp(argv[i], "-db") == 0) {
doubleBuffer = GL_TRUE;
} else {
fprintf(stderr, "%s (Bad option).\n", argv[i]);
return GL_FALSE;
}
}
return GL_TRUE;
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
if (Args(argc, argv) == GL_FALSE) {
exit(1);
}
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB | GLUT_ALPHA;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

View File

@@ -0,0 +1,171 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
#define CI_OFFSET_1 16
#define CI_OFFSET_2 32
GLenum doubleBuffer;
GLint list;
static void Init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
list = glGenLists(1);
glNewList(list, GL_COMPILE);
glBegin(GL_TRIANGLES);
glColor3f(0,0,.7);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(.8,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,.9,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glShadeModel( GL_FLAT );
glBegin(GL_TRIANGLES);
glColor3f(0,0,.7);
glVertex3f( -0.9, 0.9, -30.0);
glColor3f(0,.9,0);
glVertex3f( -0.9, -0.9, -30.0);
glColor3f(.8,0,0);
glVertex3f( 0.9, 0.0, -30.0);
glEnd();
/* This statechange is redundant:
*/
glShadeModel( GL_FLAT );
glBegin(GL_TRIANGLES);
glColor3f(1,0,0);
glVertex3f( -0.5, 0.5, -30.0);
glColor3f(0,1,0);
glVertex3f( -0.5, -0.5, -30.0);
glColor3f(0,0,1);
glVertex3f( 0.5, 0.0, -30.0);
glEnd();
glEndList();
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glShadeModel( GL_SMOOTH );
glCallList(list);
glFlush();
if (doubleBuffer) {
glutSwapBuffers();
}
}
static GLenum Args(int argc, char **argv)
{
GLint i;
doubleBuffer = GL_FALSE;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-sb") == 0) {
doubleBuffer = GL_FALSE;
} else if (strcmp(argv[i], "-db") == 0) {
doubleBuffer = GL_TRUE;
} else {
fprintf(stderr, "%s (Bad option).\n", argv[i]);
return GL_FALSE;
}
}
return GL_TRUE;
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
if (Args(argc, argv) == GL_FALSE) {
exit(1);
}
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB | GLUT_ALPHA;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

View File

@@ -0,0 +1,174 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
#define CI_OFFSET_1 16
#define CI_OFFSET_2 32
GLenum doubleBuffer;
GLint list;
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
static GLfloat blue[4] = {0.2, 0.2, .9, 1.0};
static void Init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fflush(stderr);
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glClearColor(0.0, 0.0, 1.0, 0.0);
list = glGenLists(1);
glNewList(list, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
glBegin(GL_TRIANGLES);
glNormal3f(0,0,.7);
glVertex3f( 0.9, -0.9, -30.0);
glVertex3f( 0.9, 0.9, -30.0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
glBegin(GL_TRIANGLES);
glVertex3f( -0.9, 0.9, -30.0);
glVertex3f( -0.9, -0.9, -30.0);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
glVertex3f( 0.9, 0.0, -30.0);
glEnd();
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
glBegin(GL_TRIANGLES);
glVertex3f( -0.5, 0.5, -30.0);
glVertex3f( -0.5, -0.5, -30.0);
glVertex3f( 0.5, 0.0, -30.0);
glEnd();
glEndList();
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glShadeModel( GL_SMOOTH );
glCallList(list);
glFlush();
if (doubleBuffer) {
glutSwapBuffers();
}
}
static GLenum Args(int argc, char **argv)
{
GLint i;
doubleBuffer = GL_FALSE;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-sb") == 0) {
doubleBuffer = GL_FALSE;
} else if (strcmp(argv[i], "-db") == 0) {
doubleBuffer = GL_TRUE;
} else {
fprintf(stderr, "%s (Bad option).\n", argv[i]);
return GL_FALSE;
}
}
return GL_TRUE;
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
if (Args(argc, argv) == GL_FALSE) {
exit(1);
}
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB | GLUT_ALPHA;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

View File

@@ -0,0 +1,149 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
#define CI_OFFSET_1 16
#define CI_OFFSET_2 32
GLenum doubleBuffer;
static void Init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fflush(stderr);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
/* glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
static GLfloat blue[4] = {0.2, 0.2, .9, 1.0};
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
glNormal3f(0,0,.7);
glVertex3f( 0.9, -0.9, -0.0);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
glNormal3f(0,0,.8);
glVertex3f( 0.9, 0.9, -0.0);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
glNormal3f(0,0,.9);
glVertex3f(-0.9, 0.0, -0.0);
glEnd();
glFlush();
if (doubleBuffer) {
glutSwapBuffers();
}
}
static GLenum Args(int argc, char **argv)
{
GLint i;
doubleBuffer = GL_FALSE;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-sb") == 0) {
doubleBuffer = GL_FALSE;
} else if (strcmp(argv[i], "-db") == 0) {
doubleBuffer = GL_TRUE;
} else {
fprintf(stderr, "%s (Bad option).\n", argv[i]);
return GL_FALSE;
}
}
return GL_TRUE;
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
if (Args(argc, argv) == GL_FALSE) {
exit(1);
}
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB | GLUT_ALPHA;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

View File

@@ -86,6 +86,57 @@ static PFNGLISVERTEXARRAYAPPLEPROC glIsVertexArrayAPPLE_func = NULL;
/* GL_EXT_stencil_two_side */
static PFNGLACTIVESTENCILFACEEXTPROC glActiveStencilFaceEXT_func = NULL;
/* GL_ARB_buffer_object */
static PFNGLGENBUFFERSARBPROC glGenBuffersARB_func = NULL;
static PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB_func = NULL;
static PFNGLBINDBUFFERARBPROC glBindBufferARB_func = NULL;
static PFNGLBUFFERDATAARBPROC glBufferDataARB_func = NULL;
static PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB_func = NULL;
static PFNGLMAPBUFFERARBPROC glMapBufferARB_func = NULL;
static PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB_func = NULL;
/* GL_EXT_framebuffer_object */
static PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT_func = NULL;
static PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT_func = NULL;
static PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT_func = NULL;
static PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT_func = NULL;
static PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT_func = NULL;
static PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT_func = NULL;
static PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT_func = NULL;
static PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT_func = NULL;
static PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT_func = NULL;
static PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT_func = NULL;
static PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT_func = NULL;
static PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT_func = NULL;
static PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT_func = NULL;
static PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT_func = NULL;
static PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT_func = NULL;
static PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT_func = NULL;
static PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT_func = NULL;
/* GL_ARB_framebuffer_object */
static PFNGLISRENDERBUFFERPROC glIsRenderbuffer_func = NULL;
static PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer_func = NULL;
static PFNGLDELETERENDERBUFFERSPROC glDeleteRenderbuffers_func = NULL;
static PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers_func = NULL;
static PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage_func = NULL;
static PFNGLGETRENDERBUFFERPARAMETERIVPROC glGetRenderbufferParameteriv_func = NULL;
static PFNGLISFRAMEBUFFERPROC glIsFramebuffer_func = NULL;
static PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer_func = NULL;
static PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers_func = NULL;
static PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers_func = NULL;
static PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus_func = NULL;
static PFNGLFRAMEBUFFERTEXTURE1DPROC glFramebufferTexture1D_func = NULL;
static PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D_func = NULL;
static PFNGLFRAMEBUFFERTEXTURE3DPROC glFramebufferTexture3D_func = NULL;
static PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer_func = NULL;
static PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glGetFramebufferAttachmentParameteriv_func = NULL;
static PFNGLGENERATEMIPMAPPROC glGenerateMipmap_func = NULL;
static PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer_func = NULL;
static PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glRenderbufferStorageMultisample_func = NULL;
static PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer_func = NULL;
static void
GetExtensionFuncs(void)
@@ -173,5 +224,55 @@ GetExtensionFuncs(void)
/* GL_EXT_stencil_two_side */
glActiveStencilFaceEXT_func = (PFNGLACTIVESTENCILFACEEXTPROC) glutGetProcAddress("glActiveStencilFaceEXT");
/* GL_ARB_vertex_buffer_object */
glGenBuffersARB_func = (PFNGLGENBUFFERSARBPROC) glutGetProcAddress("glGenBuffersARB");
glDeleteBuffersARB_func = (PFNGLDELETEBUFFERSARBPROC) glutGetProcAddress("glDeleteBuffersARB");
glBindBufferARB_func = (PFNGLBINDBUFFERARBPROC) glutGetProcAddress("glBindBufferARB");
glBufferDataARB_func = (PFNGLBUFFERDATAARBPROC) glutGetProcAddress("glBufferDataARB");
glBufferSubDataARB_func = (PFNGLBUFFERSUBDATAARBPROC) glutGetProcAddress("glBufferSubDataARB");
glMapBufferARB_func = (PFNGLMAPBUFFERARBPROC) glutGetProcAddress("glMapBufferARB");
glUnmapBufferARB_func = (PFNGLUNMAPBUFFERARBPROC) glutGetProcAddress("glUnmapBufferARB");
/* GL_EXT_framebuffer_object */
glIsRenderbufferEXT_func = (PFNGLISRENDERBUFFEREXTPROC) glutGetProcAddress("glIsRenderbufferEXT");
glBindRenderbufferEXT_func = (PFNGLBINDRENDERBUFFEREXTPROC) glutGetProcAddress("glBindRenderbufferEXT");
glDeleteRenderbuffersEXT_func = (PFNGLDELETERENDERBUFFERSEXTPROC) glutGetProcAddress("glDeleteRenderbuffersEXT");
glGenRenderbuffersEXT_func = (PFNGLGENRENDERBUFFERSEXTPROC) glutGetProcAddress("glGenRenderbuffersEXT");
glRenderbufferStorageEXT_func = (PFNGLRENDERBUFFERSTORAGEEXTPROC) glutGetProcAddress("glRenderbufferStorageEXT");
glGetRenderbufferParameterivEXT_func = (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) glutGetProcAddress("glGetRenderbufferParameterivEXT");
glIsFramebufferEXT_func = (PFNGLISFRAMEBUFFEREXTPROC) glutGetProcAddress("glIsFramebufferEXT");
glBindFramebufferEXT_func = (PFNGLBINDFRAMEBUFFEREXTPROC) glutGetProcAddress("glBindFramebufferEXT");
glDeleteFramebuffersEXT_func = (PFNGLDELETEFRAMEBUFFERSEXTPROC) glutGetProcAddress("glDeleteFramebuffersEXT");
glGenFramebuffersEXT_func = (PFNGLGENFRAMEBUFFERSEXTPROC) glutGetProcAddress("glGenFramebuffersEXT");
glCheckFramebufferStatusEXT_func = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) glutGetProcAddress("glCheckFramebufferStatusEXT");
glFramebufferTexture1DEXT_func = (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) glutGetProcAddress("glFramebufferTexture1DEXT");
glFramebufferTexture2DEXT_func = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) glutGetProcAddress("glFramebufferTexture2DEXT");
glFramebufferTexture3DEXT_func = (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) glutGetProcAddress("glFramebufferTexture3DEXT");
glFramebufferRenderbufferEXT_func = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) glutGetProcAddress("glFramebufferRenderbufferEXT");
glGetFramebufferAttachmentParameterivEXT_func = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) glutGetProcAddress("glGetFramebufferAttachmentParameterivEXT");
glGenerateMipmapEXT_func = (PFNGLGENERATEMIPMAPEXTPROC) glutGetProcAddress("glGenerateMipmapEXT");
/* GL_ARB_framebuffer_object */
glIsRenderbuffer_func = (PFNGLISRENDERBUFFERPROC) glutGetProcAddress("glIsRenderbuffer");
glBindRenderbuffer_func = (PFNGLBINDRENDERBUFFERPROC) glutGetProcAddress("glBindRenderbuffer");
glDeleteRenderbuffers_func = (PFNGLDELETERENDERBUFFERSPROC) glutGetProcAddress("glDeleteRenderbuffers");
glGenRenderbuffers_func = (PFNGLGENRENDERBUFFERSPROC) glutGetProcAddress("glGenRenderbuffers");
glRenderbufferStorage_func = (PFNGLRENDERBUFFERSTORAGEPROC) glutGetProcAddress("glRenderbufferStorage");
glGetRenderbufferParameteriv_func = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) glutGetProcAddress("glGetRenderbufferParameteriv");
glIsFramebuffer_func = (PFNGLISFRAMEBUFFERPROC) glutGetProcAddress("glIsFramebuffer");
glBindFramebuffer_func = (PFNGLBINDFRAMEBUFFERPROC) glutGetProcAddress("glBindFramebuffer");
glDeleteFramebuffers_func = (PFNGLDELETEFRAMEBUFFERSPROC) glutGetProcAddress("glDeleteFramebuffers");
glGenFramebuffers_func = (PFNGLGENFRAMEBUFFERSPROC) glutGetProcAddress("glGenFramebuffers");
glCheckFramebufferStatus_func = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) glutGetProcAddress("glCheckFramebufferStatus");
glFramebufferTexture1D_func = (PFNGLFRAMEBUFFERTEXTURE1DPROC) glutGetProcAddress("glFramebufferTexture1D");
glFramebufferTexture2D_func = (PFNGLFRAMEBUFFERTEXTURE2DPROC) glutGetProcAddress("glFramebufferTexture2D");
glFramebufferTexture3D_func = (PFNGLFRAMEBUFFERTEXTURE3DPROC) glutGetProcAddress("glFramebufferTexture3D");
glFramebufferRenderbuffer_func = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) glutGetProcAddress("glFramebufferRenderbuffer");
glGetFramebufferAttachmentParameteriv_func = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) glutGetProcAddress("glGetFramebufferAttachmentParameteriv");
glGenerateMipmap_func = (PFNGLGENERATEMIPMAPPROC) glutGetProcAddress("glGenerateMipmap");
glBlitFramebuffer_func = (PFNGLBLITFRAMEBUFFERPROC) glutGetProcAddress("glBlitFramebuffer");
glRenderbufferStorageMultisample_func = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) glutGetProcAddress("glRenderbufferStorageMultisample");
glFramebufferTextureLayer_func = (PFNGLFRAMEBUFFERTEXTURELAYERPROC) glutGetProcAddress("glFramebufferTextureLayer");
}

View File

@@ -9,8 +9,8 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -19,7 +19,6 @@ Init(void)
{
static GLboolean firstCall = GL_TRUE;
if (firstCall) {
GetExtensionFuncs();
firstCall = GL_FALSE;
}
}
@@ -50,14 +49,14 @@ CompileShaderText(GLenum shaderType, const char *text)
Init();
shader = glCreateShader_func(shaderType);
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
glCompileShader_func(shader);
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
shader = glCreateShader(shaderType);
glShaderSource(shader, 1, (const GLchar **) &text, NULL);
glCompileShader(shader);
glGetShaderiv(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog_func(shader, 1000, &len, log);
glGetShaderInfoLog(shader, 1000, &len, log);
fprintf(stderr, "Error: problem compiling shader: %s\n", log);
exit(1);
}
@@ -78,8 +77,12 @@ CompileShaderFile(GLenum shaderType, const char *filename)
int n;
char *buffer = (char*) malloc(max);
GLuint shader;
FILE *f;
FILE *f = fopen(filename, "r");
Init();
f = fopen(filename, "r");
if (!f) {
fprintf(stderr, "Unable to open shader file %s\n", filename);
return 0;
@@ -105,24 +108,24 @@ CompileShaderFile(GLenum shaderType, const char *filename)
GLuint
LinkShaders(GLuint vertShader, GLuint fragShader)
{
GLuint program = glCreateProgram_func();
GLuint program = glCreateProgram();
assert(vertShader || fragShader);
if (fragShader)
glAttachShader_func(program, fragShader);
glAttachShader(program, fragShader);
if (vertShader)
glAttachShader_func(program, vertShader);
glLinkProgram_func(program);
glAttachShader(program, vertShader);
glLinkProgram(program);
/* check link */
{
GLint stat;
glGetProgramiv_func(program, GL_LINK_STATUS, &stat);
glGetProgramiv(program, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog_func(program, 1000, &len, log);
glGetProgramInfoLog(program, 1000, &len, log);
fprintf(stderr, "Shader link error:\n%s\n", log);
return 0;
}
@@ -139,7 +142,7 @@ InitUniforms(GLuint program, struct uniform_info uniforms[])
for (i = 0; uniforms[i].name; i++) {
uniforms[i].location
= glGetUniformLocation_func(program, uniforms[i].name);
= glGetUniformLocation(program, uniforms[i].name);
printf("Uniform %s location: %d\n", uniforms[i].name,
uniforms[i].location);
@@ -147,19 +150,19 @@ InitUniforms(GLuint program, struct uniform_info uniforms[])
switch (uniforms[i].size) {
case 1:
if (uniforms[i].type == GL_INT)
glUniform1i_func(uniforms[i].location,
glUniform1i(uniforms[i].location,
(GLint) uniforms[i].value[0]);
else
glUniform1fv_func(uniforms[i].location, 1, uniforms[i].value);
glUniform1fv(uniforms[i].location, 1, uniforms[i].value);
break;
case 2:
glUniform2fv_func(uniforms[i].location, 1, uniforms[i].value);
glUniform2fv(uniforms[i].location, 1, uniforms[i].value);
break;
case 3:
glUniform3fv_func(uniforms[i].location, 1, uniforms[i].value);
glUniform3fv(uniforms[i].location, 1, uniforms[i].value);
break;
case 4:
glUniform4fv_func(uniforms[i].location, 1, uniforms[i].value);
glUniform4fv(uniforms[i].location, 1, uniforms[i].value);
break;
default:
abort();

View File

@@ -50,6 +50,7 @@ struct window {
float Angle;
int Id;
HGLRC sharedContext;
HANDLE hEventInitialised;
};
@@ -414,6 +415,10 @@ threadRunner (void *arg)
Error("Couldn't obtain HDC");
}
/* Wait for the previous thread */
if(tia->id > 0)
WaitForSingleObject(Windows[tia->id - 1].hEventInitialised, INFINITE);
pfd.cColorBits = 24;
pfd.cDepthBits = 24;
pfd.dwFlags = PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
@@ -434,9 +439,16 @@ threadRunner (void *arg)
}
if (win->sharedContext) {
wglShareLists(win->sharedContext, win->Context);
if(!wglShareLists(win->sharedContext, win->Context))
Error("Couldn't share WGL context lists");
}
SetEvent(win->hEventInitialised);
/* Wait for all threads to initialize otherwise wglShareLists will fail */
if(tia->id < NumWindows - 1)
WaitForSingleObject(Windows[NumWindows - 1].hEventInitialised, INFINITE);
SendMessage(win->Win, WM_SIZE, 0, 0);
while (1) {
@@ -511,20 +523,26 @@ main(int argc, char *argv[])
h[2] = AddWindow( 10, 350, gCtx);
h[3] = AddWindow(330, 350, gCtx);
if (!wglMakeCurrent(gHDC, gCtx)) {
Error("wglMakeCurrent failed for init thread.");
return -1;
for (i = 0; i < NumWindows; i++) {
Windows[i].hEventInitialised = CreateEvent(NULL, TRUE, FALSE, NULL);
}
InitGLstuff();
for (i = 0; i < NumWindows; i++) {
DWORD id;
tia[i].id = i;
threads[i] = CreateThread(NULL, 0, threadRunner, &tia[i], 0, &id);
WaitForSingleObject(Windows[i].hEventInitialised, INFINITE);
}
if (!wglMakeCurrent(gHDC, gCtx)) {
Error("wglMakeCurrent failed for init thread.");
return -1;
}
InitGLstuff();
while (1) {
MSG msg;

View File

@@ -72,6 +72,7 @@ struct winthread {
int WinWidth, WinHeight;
GLboolean NewSize;
HANDLE hEventInitialised;
GLboolean Initialized;
GLboolean MakeNewTexture;
HANDLE hEventRedraw;
};
@@ -114,20 +115,20 @@ static void
MakeNewTexture(struct winthread *wt)
{
#define TEX_SIZE 128
static float step = 0.0;
static float step = 0.0f;
GLfloat image[TEX_SIZE][TEX_SIZE][4];
GLint width;
int i, j;
for (j = 0; j < TEX_SIZE; j++) {
for (i = 0; i < TEX_SIZE; i++) {
float dt = 5.0 * (j - 0.5 * TEX_SIZE) / TEX_SIZE;
float ds = 5.0 * (i - 0.5 * TEX_SIZE) / TEX_SIZE;
float dt = 5.0f * (j - 0.5f * TEX_SIZE) / TEX_SIZE;
float ds = 5.0f * (i - 0.5f * TEX_SIZE) / TEX_SIZE;
float r = dt * dt + ds * ds + step;
image[j][i][0] =
image[j][i][1] =
image[j][i][2] = 0.75 + 0.25 * cos(r);
image[j][i][3] = 1.0;
image[j][i][2] = 0.75f + 0.25f * (float) cos(r);
image[j][i][3] = 1.0f;
}
}
@@ -159,7 +160,7 @@ static void
draw_object(void)
{
glPushMatrix();
glScalef(0.75, 0.75, 0.75);
glScalef(0.75f, 0.75f, 0.75f);
glColor3f(1, 0, 0);
@@ -288,6 +289,15 @@ draw_loop(struct winthread *wt)
wglMakeCurrent(wt->hDC, wt->Context);
if (!wt->Initialized) {
printf("wglthreads: %d: GL_RENDERER = %s\n", wt->Index,
(char *) glGetString(GL_RENDERER));
if (Texture /*&& wt->Index == 0*/) {
MakeNewTexture(wt);
}
wt->Initialized = GL_TRUE;
}
if (Locking)
LeaveCriticalSection(&Mutex);
@@ -315,13 +325,15 @@ draw_loop(struct winthread *wt)
glPushMatrix();
glRotatef(wt->Angle, 0, 1, 0);
glRotatef(wt->Angle, 1, 0, 0);
glScalef(0.7, 0.7, 0.7);
glScalef(0.7f, 0.7f, 0.7f);
draw_object();
glPopMatrix();
if (Locking)
EnterCriticalSection(&Mutex);
SwapBuffers(wt->hDC);
if (Locking)
LeaveCriticalSection(&Mutex);
@@ -433,7 +445,7 @@ create_window(struct winthread *wt, HGLRC shareCtx)
win = CreateWindowEx(0,
wc.lpszClassName,
"wglthreads",
WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TILEDWINDOW,
xpos,
ypos,
width,
@@ -471,7 +483,8 @@ create_window(struct winthread *wt, HGLRC shareCtx)
}
if (shareCtx) {
wglShareLists(shareCtx, ctx);
if(!wglShareLists(shareCtx, ctx))
Error("Couldn't share WGL context lists");
}
/* save the info for this window/context */
@@ -482,14 +495,6 @@ create_window(struct winthread *wt, HGLRC shareCtx)
wt->WinWidth = width;
wt->WinHeight = height;
wt->NewSize = GL_TRUE;
wglMakeCurrent(hdc, ctx);
printf("wglthreads: %d: GL_RENDERER = %s\n", wt->Index, (char *) glGetString(GL_RENDERER));
wglMakeCurrent(NULL, NULL);
if (Texture/* && wt->Index == 0*/) {
MakeNewTexture(wt);
}
}
@@ -502,10 +507,22 @@ ThreadProc(void *p)
struct winthread *wt = (struct winthread *) p;
HGLRC share;
/* Wait for the previous thread */
if(Texture && wt->Index > 0) {
WaitForSingleObject(WinThreads[wt->Index - 1].hEventInitialised, INFINITE);
share = WinThreads[0].Context;
}
else
share = 0;
share = (Texture && wt->Index > 0) ? WinThreads[0].Context : 0;
create_window(wt, share);
SetEvent(wt->hEventInitialised);
/* Wait for all threads to initialize otherwise wglShareLists will fail */
if(wt->Index < NumWinThreads - 1)
WaitForSingleObject(WinThreads[NumWinThreads - 1].hEventInitialised, INFINITE);
draw_loop(wt);
return 0;
}
@@ -539,6 +556,7 @@ main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-h") == 0) {
usage();
exit(0);
}
else if (strcmp(argv[i], "-l") == 0) {
Locking = 1;
@@ -588,13 +606,17 @@ main(int argc, char *argv[])
printf("wglthreads: creating threads\n");
/* Create the events */
for (i = 0; i < NumWinThreads; i++) {
WinThreads[i].Index = i;
WinThreads[i].hEventInitialised = CreateEvent(NULL, TRUE, FALSE, NULL);
WinThreads[i].hEventRedraw = CreateEvent(NULL, FALSE, FALSE, NULL);
}
/* Create the threads */
for (i = 0; i < NumWinThreads; i++) {
DWORD id;
WinThreads[i].Index = i;
WinThreads[i].hEventInitialised = CreateEvent(NULL, TRUE, FALSE, NULL);
WinThreads[i].hEventRedraw = CreateEvent(NULL, FALSE, FALSE, NULL);
WinThreads[i].Thread = CreateThread(NULL,
0,
ThreadProc,
@@ -603,8 +625,6 @@ main(int argc, char *argv[])
&id);
printf("wglthreads: Created thread %p\n", (void *) WinThreads[i].Thread);
WaitForSingleObject(WinThreads[i].hEventInitialised, INFINITE);
threads[i] = WinThreads[i].Thread;
}

View File

@@ -26,7 +26,7 @@
* -p Open a display connection for each thread
* -l Enable application-side locking
* -n <num threads> Number of threads to create (default is 2)
* -display <display name> Specify X display (default is :0.0)
* -display <display name> Specify X display (default is $DISPLAY)
* -t Use texture mapping
*
* Brian Paul 20 July 2000
@@ -573,7 +573,7 @@ usage(void)
int
main(int argc, char *argv[])
{
char *displayName = ":0.0";
char *displayName = NULL;
int numThreads = 2;
Display *dpy = NULL;
int i;

View File

@@ -20,16 +20,17 @@
*/
/*
* This is a port of the infamous "gears" demo to straight GLX (i.e. no GLUT)
* Port by Brian Paul 23 March 2001
* Version of glxgears that creates/destroys the rendering context for each
* frame. Also periodically destroy/recreate the window.
* Good for finding memory leaks, etc.
*
* Command line options:
* -info print GL implementation information
* -stereo use stereo enabled GLX visual
*
*/
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
@@ -92,13 +93,8 @@ static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
static GLint gear1, gear2, gear3;
static GLfloat angle = 0.0;
static GLboolean fullscreen = GL_FALSE; /* Create a single fullscreen window */
static GLboolean stereo = GL_FALSE; /* Enable stereo. */
static GLfloat eyesep = 5.0; /* Eye separation. */
static GLfloat fix_point = 40.0; /* Fixation point distance. */
static GLfloat left, right, asp; /* Stereo frustum params. */
XVisualInfo *visinfo;
static XVisualInfo *visinfo = NULL;
static int WinWidth = 300, WinHeight = 300;
/*
@@ -272,22 +268,13 @@ do_draw(void)
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
glViewport(0, 0, (GLint) width, (GLint) height);
if (stereo) {
GLfloat w;
asp = (GLfloat) height / (GLfloat) width;
w = fix_point * (1.0 / 5.0);
left = -5.0 * ((w - 0.5 * eyesep) / fix_point);
right = 5.0 * ((w + 0.5 * eyesep) / fix_point);
} else {
{
GLfloat h = (GLfloat) height / (GLfloat) width;
glMatrixMode(GL_PROJECTION);
@@ -299,7 +286,6 @@ reshape(int width, int height)
glLoadIdentity();
glTranslatef(0.0, 0.0, -40.0);
}
static void
@@ -337,7 +323,7 @@ init(void)
glEnable(GL_NORMALIZE);
}
static void
draw( Display *dpy, Window win )
@@ -354,36 +340,9 @@ draw( Display *dpy, Window win )
init();
if (stereo) {
/* First left eye. */
glDrawBuffer(GL_BACK_LEFT);
reshape(WinWidth, WinHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(left, right, -asp, asp, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glTranslated(+0.5 * eyesep, 0.0, 0.0);
do_draw();
glPopMatrix();
/* Then right eye. */
glDrawBuffer(GL_BACK_RIGHT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-right, -left, -asp, asp, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glTranslated(-0.5 * eyesep, 0.0, 0.0);
do_draw();
glPopMatrix();
} else
do_draw();
do_draw();
glDeleteLists(gear1, 1);
glDeleteLists(gear2, 1);
@@ -410,14 +369,6 @@ make_window( Display *dpy, const char *name,
GLX_DOUBLEBUFFER,
GLX_DEPTH_SIZE, 1,
None };
int stereoAttribs[] = { GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER,
GLX_DEPTH_SIZE, 1,
GLX_STEREO,
None };
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
@@ -427,22 +378,9 @@ make_window( Display *dpy, const char *name,
scrnum = DefaultScreen( dpy );
root = RootWindow( dpy, scrnum );
if (fullscreen) {
x = 0; y = 0;
width = DisplayWidth( dpy, scrnum );
height = DisplayHeight( dpy, scrnum );
}
if (stereo)
visinfo = glXChooseVisual( dpy, scrnum, stereoAttribs );
else
visinfo = glXChooseVisual( dpy, scrnum, attribs );
visinfo = glXChooseVisual( dpy, scrnum, attribs );
if (!visinfo) {
if (stereo) {
printf("Error: couldn't get an RGB, "
"Double-buffered, Stereo visual\n");
} else
printf("Error: couldn't get an RGB, Double-buffered visual\n");
printf("Error: couldn't get an RGB, Double-buffered visual\n");
exit(1);
}
@@ -451,7 +389,7 @@ make_window( Display *dpy, const char *name,
attr.border_pixel = 0;
attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
attr.override_redirect = fullscreen;
attr.override_redirect = 0;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect;
win = XCreateWindow( dpy, root, x, y, width, height,
@@ -479,10 +417,9 @@ static void
event_loop(Display *dpy)
{
Window win;
make_window(dpy, "glxgears", 0, 0, 300, 300, &win);
make_window(dpy, "glxgears", 0, 0, WinWidth, WinHeight, &win);
XMapWindow(dpy, win);
while (1) {
while (XPending(dpy) > 0) {
XEvent event;
@@ -492,34 +429,35 @@ event_loop(Display *dpy)
/* we'll redraw below */
break;
case ConfigureNotify:
reshape(event.xconfigure.width, event.xconfigure.height);
WinWidth = event.xconfigure.width;
WinHeight = event.xconfigure.height;
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return;
}
}
}
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return;
}
}
}
}
}
@@ -550,9 +488,12 @@ event_loop(Display *dpy)
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds,
fps);
tRate0 = t;
/* Destroy window and create new one */
XDestroyWindow(dpy, win);
make_window(dpy, "glxgears", (int)(fps * 100) % 100, (int)(fps * 100) % 100, 300, 300, &win);
make_window(dpy, "glxgears",
(int)(fps * 100) % 100, (int)(fps * 100) % 100, /* x,y */
WinWidth, WinHeight, &win);
XMapWindow(dpy, win);
frames = 0;
@@ -562,7 +503,6 @@ event_loop(Display *dpy)
}
int
main(int argc, char *argv[])
{
@@ -579,12 +519,6 @@ main(int argc, char *argv[])
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else if (strcmp(argv[i], "-stereo") == 0) {
stereo = GL_TRUE;
}
else if (strcmp(argv[i], "-fullscreen") == 0) {
fullscreen = GL_TRUE;
}
else
printf("Warrning: unknown parameter: %s\n", argv[i]);
}
@@ -596,7 +530,6 @@ main(int argc, char *argv[])
return -1;
}
if (printInfo) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
@@ -604,7 +537,6 @@ main(int argc, char *argv[])
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
event_loop(dpy);
XCloseDisplay(dpy);

View File

@@ -39,6 +39,12 @@
#include <GL/gl.h>
#include <GL/glx.h>
#ifndef GLX_MESA_swap_control
#define GLX_MESA_swap_control 1
typedef int (*PFNGLXGETSWAPINTERVALMESAPROC)(void);
#endif
static int is_glx_extension_supported(Display *dpy, const char *query);
static void query_vsync(Display *dpy);
@@ -592,31 +598,22 @@ query_vsync(Display *dpy)
int interval = 0;
#ifdef GLX_MESA_swap_control
if ((interval <= 0)
&& is_glx_extension_supported(dpy, "GLX_MESA_swap_control")) {
if (is_glx_extension_supported(dpy, "GLX_MESA_swap_control")) {
PFNGLXGETSWAPINTERVALMESAPROC pglXGetSwapIntervalMESA =
(PFNGLXGETSWAPINTERVALMESAPROC)
glXGetProcAddressARB((const GLubyte *) "glXGetSwapIntervalMESA");
interval = (*pglXGetSwapIntervalMESA)();
} else if (is_glx_extension_supported(dpy, "GLX_SGI_swap_control")) {
/* The default swap interval with this extension is 1. Assume that it
* is set to the default.
*
* Many Mesa-based drivers default to 0, but all of these drivers also
* export GLX_MESA_swap_control. In that case, this branch will never
* be taken, and the correct result should be reported.
*/
interval = 1;
}
#endif
#ifdef GLX_SGI_video_sync
if ((interval <= 0)
&& is_glx_extension_supported(dpy, "GLX_SGI_video_sync")) {
PFNGLXGETVIDEOSYNCSGIPROC pglXGetVideoSyncSGI =
(PFNGLXGETVIDEOSYNCSGIPROC)
glXGetProcAddressARB((const GLubyte *) "glXGetVideoSyncSGI");
unsigned count;
if ((*pglXGetVideoSyncSGI)(& count) == 0) {
interval = (int) count;
}
}
#endif
if (interval > 0) {

View File

@@ -267,7 +267,8 @@ main(int argc, char *argv[])
printf(" glxheads xdisplayname ...\n");
printf("Example:\n");
printf(" glxheads :0 mars:0 venus:1\n");
h = AddHead(":0");
h = AddHead(XDisplayName(NULL));
if (h)
PrintInfo(h);
}

View File

@@ -759,7 +759,7 @@ main(int argc, char *argv[])
Display *dpy;
Window win;
GLXContext ctx;
char *dpyName = ":0";
char *dpyName = NULL;
int swap_interval = 1;
GLboolean do_swap_interval = GL_FALSE;
GLboolean force_get_rate = GL_FALSE;

View File

@@ -158,7 +158,7 @@ main(int argc, char *argv[])
Display *dpy;
Window win;
GLXContext ctx;
char *dpyName = ":0";
char *dpyName = NULL;
int i;
for (i = 1; i < argc; i++) {

View File

@@ -108,7 +108,7 @@ def shlib_emitter(target, source, env):
return (target, source)
shlib_action = SCons.Action.Action(shlib_generator, generator=1)
shlib_action = SCons.Action.Action(shlib_generator, '$SHLINKCOMSTR', generator=1)
res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR')

64
scons/dxsdk.py Normal file
View File

@@ -0,0 +1,64 @@
"""dxsdk
Tool-specific initialization for Microsoft DirectX SDK
"""
#
# Copyright (c) 2009 VMware, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
import os
import os.path
import SCons.Errors
import SCons.Util
def get_dxsdk_root(env):
try:
return os.environ['DXSDK_DIR']
except KeyError:
return None
def generate(env):
dxsdk_root = get_dxsdk_root(env)
if dxsdk_root is None:
# DirectX SDK not found
return
if env['machine'] in ('generic', 'x86'):
target_cpu = 'x86'
elif env['machine'] == 'x86_64':
target_cpu = 'x64'
else:
raise SCons.Errors.InternalError, "Unsupported target machine"
include_dir = 'Include'
env.Append(CPPDEFINES = [('HAVE_DXSDK', '1')])
env.Prepend(CPPPATH = [os.path.join(dxsdk_root, 'Include')])
env.Prepend(LIBPATH = [os.path.join(dxsdk_root, 'Lib', target_cpu)])
def exists(env):
return get_dxsdk_root(env) is not None
# vim:set ts=4 sw=4 et:

27
scons/fixes.py Normal file
View File

@@ -0,0 +1,27 @@
import sys
# Monkey patch os.spawnve on windows to become thread safe
if sys.platform == 'win32':
import os
import threading
from os import spawnve as old_spawnve
spawn_lock = threading.Lock()
def new_spawnve(mode, file, args, env):
spawn_lock.acquire()
try:
if mode == os.P_WAIT:
ret = old_spawnve(os.P_NOWAIT, file, args, env)
else:
ret = old_spawnve(mode, file, args, env)
finally:
spawn_lock.release()
if mode == os.P_WAIT:
pid, status = os.waitpid(ret, 0)
ret = status >> 8
return ret
os.spawnve = new_spawnve

View File

@@ -38,6 +38,8 @@ import SCons.Action
import SCons.Builder
import SCons.Scanner
import fixes
def quietCommandLines(env):
# Quiet command lines
@@ -318,89 +320,80 @@ def generate(env):
env.Append(CPPDEFINES = cppdefines)
# C compiler options
cflags = []
cflags = [] # C
cxxflags = [] # C++
ccflags = [] # C & C++
if gcc:
if debug:
cflags += ['-O0', '-g3']
elif env['toolchain'] == 'crossmingw':
cflags += ['-O0', '-g3'] # mingw 4.2.1 optimizer is broken
ccflags += ['-O0', '-g3']
elif env['CCVERSION'].startswith('4.2.'):
# gcc 4.2.x optimizer is broken
print "warning: gcc 4.2.x optimizer is broken -- disabling optimizations"
ccflags += ['-O0', '-g3']
else:
cflags += ['-O3', '-g3']
ccflags += ['-O3', '-g3']
if env['profile']:
cflags += ['-pg']
ccflags += ['-pg']
if env['machine'] == 'x86':
cflags += [
ccflags += [
'-m32',
#'-march=pentium4',
'-mmmx', '-msse', '-msse2', # enable SIMD intrinsics
#'-mfpmath=sse',
]
if env['machine'] == 'x86_64':
cflags += ['-m64']
ccflags += ['-m64']
# See also:
# - http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
cflags += [
'-Werror=declaration-after-statement',
ccflags += [
'-Wall',
'-Wmissing-prototypes',
'-Wmissing-field-initializers',
'-Wpointer-arith',
'-Wno-long-long',
'-ffast-math',
'-std=gnu99',
'-fmessage-length=0', # be nice to Eclipse
]
cflags += [
'-Werror=declaration-after-statement',
'-Wmissing-prototypes',
'-std=gnu99',
]
if msvc:
# See also:
# - http://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
# - cl /?
if debug:
cflags += [
ccflags += [
'/Od', # disable optimizations
'/Oi', # enable intrinsic functions
'/Oy-', # disable frame pointer omission
'/GL-', # disable whole program optimization
]
else:
if env['machine'] == 'x86_64':
cflags += [
# Same as /O2, but without global optimizations or auto-inlining
# http://msdn.microsoft.com/en-us/library/8f8h5cxt.aspx
'/Ob1', # enable inline expansion, disable auto-inlining
'/Oi', # enable intrinsic functions
'/Ot', # favors fast code
'/Oy', # omit frame pointer
'/Gs', # enable stack probes
'/GF', # eliminate duplicate strings
'/Gy', # enable function-level linking
]
else:
cflags += [
'/O2', # optimize for speed
]
cflags += [
ccflags += [
'/O2', # optimize for speed
#'/fp:fast', # fast floating point
]
if env['profile']:
cflags += [
ccflags += [
'/Gh', # enable _penter hook function
'/GH', # enable _pexit hook function
]
cflags += [
ccflags += [
'/W3', # warning level
#'/Wp64', # enable 64 bit porting warnings
]
if env['machine'] == 'x86':
cflags += [
ccflags += [
#'/QIfist', # Suppress _ftol
#'/arch:SSE2', # use the SSE2 instructions
]
if platform == 'windows':
cflags += [
ccflags += [
# TODO
]
if platform == 'winddk':
cflags += [
ccflags += [
'/Zl', # omit default library name in .OBJ
'/Zp8', # 8bytes struct member alignment
'/Gy', # separate functions for linker
@@ -419,7 +412,7 @@ def generate(env):
]
if platform == 'wince':
# See also C:\WINCE600\public\common\oak\misc\makefile.def
cflags += [
ccflags += [
'/Zl', # omit default library name in .OBJ
'/GF', # enable read-only string pooling
'/GR-', # disable C++ RTTI
@@ -436,8 +429,9 @@ def generate(env):
# See http://scons.tigris.org/issues/show_bug.cgi?id=1656
env.EnsureSConsVersion(0, 98, 0)
env['PDB'] = '${TARGET.base}.pdb'
env.Append(CCFLAGS = ccflags)
env.Append(CFLAGS = cflags)
env.Append(CXXFLAGS = cflags)
env.Append(CXXFLAGS = cxxflags)
if env['platform'] == 'windows' and msvc:
# Choose the appropriate MSVC CRT
@@ -458,11 +452,15 @@ def generate(env):
# Linker options
linkflags = []
shlinkflags = []
if gcc:
if env['machine'] == 'x86':
linkflags += ['-m32']
if env['machine'] == 'x86_64':
linkflags += ['-m64']
shlinkflags += [
'-Wl,-Bsymbolic',
]
if platform == 'windows' and msvc:
# See also:
# - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
@@ -510,6 +508,7 @@ def generate(env):
'/entry:_DllMainCRTStartup',
]
env.Append(LINKFLAGS = linkflags)
env.Append(SHLINKFLAGS = shlinkflags)
# Default libs
env.Append(LIBS = [])

View File

@@ -416,16 +416,18 @@ def generate(env):
# See also:
# - http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
ccflags += [
'-Werror=declaration-after-statement',
'-Wall',
'-Wmissing-prototypes',
'-Wmissing-field-initializers',
'-Wpointer-arith',
'-Wno-long-long',
'-ffast-math',
'-std=gnu99',
'-fmessage-length=0', # be nice to Eclipse
]
cflags += [
'-Werror=declaration-after-statement',
'-Wmissing-prototypes',
'-std=gnu99',
]
if msvc:
# See also:
# - http://msdn.microsoft.com/en-us/library/19z1t1wy.aspx

View File

@@ -54,7 +54,8 @@ static unsigned elt_ubyte( const void *elts, unsigned idx )
static unsigned elt_vert( const void *elts, unsigned idx )
{
return (const ubyte *)elts - (const ubyte *)NULL + idx;
/* unsigned index is packed in the pointer */
return (unsigned)(uintptr_t)elts + idx;
}
pt_elt_func draw_pt_elt_func( struct draw_context *draw )

View File

@@ -244,7 +244,7 @@ int u_index_generator( unsigned hw_mask,
default:
assert(0);
*out_generate = generate[out_idx][in_pv][out_pv][prim];
*out_generate = generate[out_idx][in_pv][out_pv][PIPE_PRIM_POINTS];
*out_prim = PIPE_PRIM_POINTS;
*out_nr = nr;
return U_TRANSLATE_ERROR;

View File

@@ -71,6 +71,12 @@ struct pb_desc
};
/**
* Size. Regular (32bit) unsigned for now.
*/
typedef unsigned pb_size;
/**
* Base class for all pb_* buffers.
*/
@@ -126,7 +132,7 @@ struct pb_vtbl
*/
void (*get_base_buffer)( struct pb_buffer *buf,
struct pb_buffer **base_buf,
unsigned *offset );
pb_size *offset );
};
@@ -177,7 +183,7 @@ pb_unmap(struct pb_buffer *buf)
static INLINE void
pb_get_base_buffer( struct pb_buffer *buf,
struct pb_buffer **base_buf,
unsigned *offset )
pb_size *offset )
{
assert(buf);
if(!buf) {
@@ -241,7 +247,7 @@ pb_reference(struct pb_buffer **dst,
* the requested or not.
*/
static INLINE boolean
pb_check_alignment(size_t requested, size_t provided)
pb_check_alignment(pb_size requested, pb_size provided)
{
if(!requested)
return TRUE;
@@ -269,7 +275,7 @@ pb_check_usage(unsigned requested, unsigned provided)
* hardware.
*/
struct pb_buffer *
pb_malloc_buffer_create(size_t size,
pb_malloc_buffer_create(pb_size size,
const struct pb_desc *desc);

View File

@@ -65,11 +65,11 @@ struct fenced_buffer_list
struct pb_fence_ops *ops;
size_t numDelayed;
pb_size numDelayed;
struct list_head delayed;
#ifdef DEBUG
size_t numUnfenced;
pb_size numUnfenced;
struct list_head unfenced;
#endif
};
@@ -433,7 +433,7 @@ fenced_buffer_fence(struct pb_buffer *buf,
static void
fenced_buffer_get_base_buffer(struct pb_buffer *buf,
struct pb_buffer **base_buf,
unsigned *offset)
pb_size *offset)
{
struct fenced_buffer *fenced_buf = fenced_buffer(buf);
pb_get_base_buffer(fenced_buf->buffer, base_buf, offset);

View File

@@ -102,7 +102,7 @@ malloc_buffer_fence(struct pb_buffer *buf,
static void
malloc_buffer_get_base_buffer(struct pb_buffer *buf,
struct pb_buffer **base_buf,
unsigned *offset)
pb_size *offset)
{
*base_buf = buf;
*offset = 0;
@@ -121,7 +121,7 @@ malloc_buffer_vtbl = {
struct pb_buffer *
pb_malloc_buffer_create(size_t size,
pb_malloc_buffer_create(pb_size size,
const struct pb_desc *desc)
{
struct malloc_buffer *buf;
@@ -150,7 +150,7 @@ pb_malloc_buffer_create(size_t size,
static struct pb_buffer *
pb_malloc_bufmgr_create_buffer(struct pb_manager *mgr,
size_t size,
pb_size size,
const struct pb_desc *desc)
{
return pb_malloc_buffer_create(size, desc);

View File

@@ -73,7 +73,7 @@ struct pb_manager
struct pb_buffer *
(*create_buffer)( struct pb_manager *mgr,
size_t size,
pb_size size,
const struct pb_desc *desc);
/**
@@ -106,7 +106,7 @@ pb_malloc_bufmgr_create(void);
*/
struct pb_manager *
pool_bufmgr_create(struct pb_manager *provider,
size_t n, size_t size,
pb_size n, pb_size size,
const struct pb_desc *desc);
@@ -119,7 +119,7 @@ pool_bufmgr_create(struct pb_manager *provider,
*/
struct pb_manager *
mm_bufmgr_create(struct pb_manager *provider,
size_t size, size_t align2);
pb_size size, pb_size align2);
/**
* Same as mm_bufmgr_create.
@@ -128,7 +128,7 @@ mm_bufmgr_create(struct pb_manager *provider,
*/
struct pb_manager *
mm_bufmgr_create_from_buffer(struct pb_buffer *buffer,
size_t size, size_t align2);
pb_size size, pb_size align2);
/**
@@ -136,8 +136,8 @@ mm_bufmgr_create_from_buffer(struct pb_buffer *buffer,
*/
struct pb_manager *
pb_slab_manager_create(struct pb_manager *provider,
size_t bufSize,
size_t slabSize,
pb_size bufSize,
pb_size slabSize,
const struct pb_desc *desc);
/**
@@ -146,9 +146,9 @@ pb_slab_manager_create(struct pb_manager *provider,
*/
struct pb_manager *
pb_slab_range_manager_create(struct pb_manager *provider,
size_t minBufSize,
size_t maxBufSize,
size_t slabSize,
pb_size minBufSize,
pb_size maxBufSize,
pb_size slabSize,
const struct pb_desc *desc);
@@ -204,7 +204,7 @@ pb_ondemand_manager_create(struct pb_manager *provider);
*/
struct pb_manager *
pb_debug_manager_create(struct pb_manager *provider,
size_t underflow_size, size_t overflow_size);
pb_size underflow_size, pb_size overflow_size);
#ifdef __cplusplus

View File

@@ -60,7 +60,7 @@ pb_alt_manager(struct pb_manager *mgr)
static struct pb_buffer *
pb_alt_manager_create_buffer(struct pb_manager *_mgr,
size_t size,
pb_size size,
const struct pb_desc *desc)
{
struct pb_alt_manager *mgr = pb_alt_manager(_mgr);

View File

@@ -81,7 +81,7 @@ struct pb_cache_manager
pipe_mutex mutex;
struct list_head delayed;
size_t numDelayed;
pb_size numDelayed;
};
@@ -204,7 +204,7 @@ pb_cache_buffer_fence(struct pb_buffer *_buf,
static void
pb_cache_buffer_get_base_buffer(struct pb_buffer *_buf,
struct pb_buffer **base_buf,
unsigned *offset)
pb_size *offset)
{
struct pb_cache_buffer *buf = pb_cache_buffer(_buf);
pb_get_base_buffer(buf->buffer, base_buf, offset);
@@ -224,7 +224,7 @@ pb_cache_buffer_vtbl = {
static INLINE boolean
pb_cache_is_buffer_compat(struct pb_cache_buffer *buf,
size_t size,
pb_size size,
const struct pb_desc *desc)
{
if(buf->base.base.size < size)
@@ -246,7 +246,7 @@ pb_cache_is_buffer_compat(struct pb_cache_buffer *buf,
static struct pb_buffer *
pb_cache_manager_create_buffer(struct pb_manager *_mgr,
size_t size,
pb_size size,
const struct pb_desc *desc)
{
struct pb_cache_manager *mgr = pb_cache_manager(_mgr);

View File

@@ -72,8 +72,8 @@ struct pb_debug_buffer
struct pb_buffer *buffer;
struct pb_debug_manager *mgr;
size_t underflow_size;
size_t overflow_size;
pb_size underflow_size;
pb_size overflow_size;
struct debug_stack_frame create_backtrace[PB_DEBUG_CREATE_BACKTRACE];
@@ -91,8 +91,8 @@ struct pb_debug_manager
struct pb_manager *provider;
size_t underflow_size;
size_t overflow_size;
pb_size underflow_size;
pb_size overflow_size;
pipe_mutex mutex;
struct list_head list;
@@ -124,9 +124,9 @@ static const uint8_t random_pattern[32] = {
static INLINE void
fill_random_pattern(uint8_t *dst, size_t size)
fill_random_pattern(uint8_t *dst, pb_size size)
{
size_t i = 0;
pb_size i = 0;
while(size--) {
*dst++ = random_pattern[i++];
i &= sizeof(random_pattern) - 1;
@@ -135,11 +135,11 @@ fill_random_pattern(uint8_t *dst, size_t size)
static INLINE boolean
check_random_pattern(const uint8_t *dst, size_t size,
size_t *min_ofs, size_t *max_ofs)
check_random_pattern(const uint8_t *dst, pb_size size,
pb_size *min_ofs, pb_size *max_ofs)
{
boolean result = TRUE;
size_t i;
pb_size i;
*min_ofs = size;
*max_ofs = 0;
for(i = 0; i < size; ++i) {
@@ -183,7 +183,7 @@ pb_debug_buffer_check(struct pb_debug_buffer *buf)
assert(map);
if(map) {
boolean underflow, overflow;
size_t min_ofs, max_ofs;
pb_size min_ofs, max_ofs;
underflow = !check_random_pattern(map, buf->underflow_size,
&min_ofs, &max_ofs);
@@ -287,7 +287,7 @@ pb_debug_buffer_unmap(struct pb_buffer *_buf)
static void
pb_debug_buffer_get_base_buffer(struct pb_buffer *_buf,
struct pb_buffer **base_buf,
unsigned *offset)
pb_size *offset)
{
struct pb_debug_buffer *buf = pb_debug_buffer(_buf);
pb_get_base_buffer(buf->buffer, base_buf, offset);
@@ -363,13 +363,13 @@ pb_debug_manager_dump(struct pb_debug_manager *mgr)
static struct pb_buffer *
pb_debug_manager_create_buffer(struct pb_manager *_mgr,
size_t size,
pb_size size,
const struct pb_desc *desc)
{
struct pb_debug_manager *mgr = pb_debug_manager(_mgr);
struct pb_debug_buffer *buf;
struct pb_desc real_desc;
size_t real_size;
pb_size real_size;
buf = CALLOC_STRUCT(pb_debug_buffer);
if(!buf)
@@ -455,7 +455,7 @@ pb_debug_manager_destroy(struct pb_manager *_mgr)
struct pb_manager *
pb_debug_manager_create(struct pb_manager *provider,
size_t underflow_size, size_t overflow_size)
pb_size underflow_size, pb_size overflow_size)
{
struct pb_debug_manager *mgr;
@@ -485,7 +485,7 @@ pb_debug_manager_create(struct pb_manager *provider,
struct pb_manager *
pb_debug_manager_create(struct pb_manager *provider,
size_t underflow_size, size_t overflow_size)
pb_size underflow_size, pb_size overflow_size)
{
return provider;
}

View File

@@ -62,7 +62,7 @@ fenced_pb_manager(struct pb_manager *mgr)
static struct pb_buffer *
fenced_bufmgr_create_buffer(struct pb_manager *mgr,
size_t size,
pb_size size,
const struct pb_desc *desc)
{
struct fenced_pb_manager *fenced_mgr = fenced_pb_manager(mgr);

View File

@@ -55,10 +55,10 @@ struct mm_pb_manager
pipe_mutex mutex;
size_t size;
pb_size size;
struct mem_block *heap;
size_t align2;
pb_size align2;
struct pb_buffer *buffer;
void *map;
@@ -148,7 +148,7 @@ mm_buffer_fence(struct pb_buffer *buf,
static void
mm_buffer_get_base_buffer(struct pb_buffer *buf,
struct pb_buffer **base_buf,
unsigned *offset)
pb_size *offset)
{
struct mm_buffer *mm_buf = mm_buffer(buf);
struct mm_pb_manager *mm = mm_buf->mgr;
@@ -170,15 +170,15 @@ mm_buffer_vtbl = {
static struct pb_buffer *
mm_bufmgr_create_buffer(struct pb_manager *mgr,
size_t size,
pb_size size,
const struct pb_desc *desc)
{
struct mm_pb_manager *mm = mm_pb_manager(mgr);
struct mm_buffer *mm_buf;
/* We don't handle alignments larger then the one initially setup */
assert(pb_check_alignment(desc->alignment, 1 << mm->align2));
if(!pb_check_alignment(desc->alignment, 1 << mm->align2))
assert(pb_check_alignment(desc->alignment, (pb_size)1 << mm->align2));
if(!pb_check_alignment(desc->alignment, (pb_size)1 << mm->align2))
return NULL;
pipe_mutex_lock(mm->mutex);
@@ -198,10 +198,10 @@ mm_bufmgr_create_buffer(struct pb_manager *mgr,
mm_buf->mgr = mm;
mm_buf->block = u_mmAllocMem(mm->heap, size, mm->align2, 0);
mm_buf->block = u_mmAllocMem(mm->heap, (int)size, (int)mm->align2, 0);
if(!mm_buf->block) {
debug_printf("warning: heap full\n");
#if 0
debug_printf("warning: heap full\n");
mmDumpMemInfo(mm->heap);
#endif
FREE(mm_buf);
@@ -210,8 +210,8 @@ mm_bufmgr_create_buffer(struct pb_manager *mgr,
}
/* Some sanity checks */
assert(0 <= (unsigned)mm_buf->block->ofs && (unsigned)mm_buf->block->ofs < mm->size);
assert(size <= (unsigned)mm_buf->block->size && (unsigned)mm_buf->block->ofs + (unsigned)mm_buf->block->size <= mm->size);
assert(0 <= (pb_size)mm_buf->block->ofs && (pb_size)mm_buf->block->ofs < mm->size);
assert(size <= (pb_size)mm_buf->block->size && (pb_size)mm_buf->block->ofs + (pb_size)mm_buf->block->size <= mm->size);
pipe_mutex_unlock(mm->mutex);
return SUPER(mm_buf);
@@ -245,7 +245,7 @@ mm_bufmgr_destroy(struct pb_manager *mgr)
struct pb_manager *
mm_bufmgr_create_from_buffer(struct pb_buffer *buffer,
size_t size, size_t align2)
pb_size size, pb_size align2)
{
struct mm_pb_manager *mm;
@@ -273,7 +273,7 @@ mm_bufmgr_create_from_buffer(struct pb_buffer *buffer,
if(!mm->map)
goto failure;
mm->heap = u_mmInit(0, size);
mm->heap = u_mmInit(0, (int)size);
if (!mm->heap)
goto failure;
@@ -292,7 +292,7 @@ if(mm->heap)
struct pb_manager *
mm_bufmgr_create(struct pb_manager *provider,
size_t size, size_t align2)
pb_size size, pb_size align2)
{
struct pb_buffer *buffer;
struct pb_manager *mgr;

View File

@@ -55,7 +55,7 @@ struct pb_ondemand_buffer
/** Real buffer */
struct pb_buffer *buffer;
size_t size;
pb_size size;
struct pb_desc desc;
};
@@ -204,7 +204,7 @@ pb_ondemand_buffer_fence(struct pb_buffer *_buf,
static void
pb_ondemand_buffer_get_base_buffer(struct pb_buffer *_buf,
struct pb_buffer **base_buf,
unsigned *offset)
pb_size *offset)
{
struct pb_ondemand_buffer *buf = pb_ondemand_buffer(_buf);
@@ -232,7 +232,7 @@ pb_ondemand_buffer_vtbl = {
static struct pb_buffer *
pb_ondemand_manager_create_buffer(struct pb_manager *_mgr,
size_t size,
pb_size size,
const struct pb_desc *desc)
{
struct pb_ondemand_manager *mgr = pb_ondemand_manager(_mgr);

View File

@@ -58,11 +58,11 @@ struct pool_pb_manager
pipe_mutex mutex;
size_t bufSize;
size_t bufAlign;
pb_size bufSize;
pb_size bufAlign;
size_t numFree;
size_t numTot;
pb_size numFree;
pb_size numTot;
struct list_head free;
@@ -89,7 +89,7 @@ struct pool_buffer
struct list_head head;
size_t start;
pb_size start;
};
@@ -162,7 +162,7 @@ pool_buffer_fence(struct pb_buffer *buf,
static void
pool_buffer_get_base_buffer(struct pb_buffer *buf,
struct pb_buffer **base_buf,
unsigned *offset)
pb_size *offset)
{
struct pool_buffer *pool_buf = pool_buffer(buf);
struct pool_pb_manager *pool = pool_buf->mgr;
@@ -184,7 +184,7 @@ pool_buffer_vtbl = {
static struct pb_buffer *
pool_bufmgr_create_buffer(struct pb_manager *mgr,
size_t size,
pb_size size,
const struct pb_desc *desc)
{
struct pool_pb_manager *pool = pool_pb_manager(mgr);
@@ -251,13 +251,13 @@ pool_bufmgr_destroy(struct pb_manager *mgr)
struct pb_manager *
pool_bufmgr_create(struct pb_manager *provider,
size_t numBufs,
size_t bufSize,
pb_size numBufs,
pb_size bufSize,
const struct pb_desc *desc)
{
struct pool_pb_manager *pool;
struct pool_buffer *pool_buf;
size_t i;
pb_size i;
if(!provider)
return NULL;

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