Compare commits

..

127 Commits

Author SHA1 Message Date
Brice Goglin
04493de67b Prepare changelog for upload 2009-07-21 22:22:07 +02:00
Brice Goglin
e06e2b001f Install the upstream ChangeLog 2009-07-21 22:21:47 +02:00
Brice Goglin
d740456ee5 Install the upstream ChangeLog 2009-07-21 20:42:50 +02:00
Brice Goglin
45c5ed4bb8 Pull from upstream mesa_7_5_branch 2009-07-21 20:38:30 +02:00
Brice Goglin
19a8ce6f70 Merge branch 'mesa_7_5_branch' of git://anongit.freedesktop.org/mesa/mesa into debian-unstable 2009-07-21 20:05:24 +02:00
Eric Anholt
a6b314150c intel: Fall back on glBitmap with fog enabled.
We would have to build the program with the appropriate fog mode, and
also supply the fog coordinate if appropriate.

Bug #19413.
(cherry picked from commit 8ae02a3919)
2009-07-20 19:10:32 -07:00
Eric Anholt
1b445f9673 i965: Don't clip everything if FRONT_AND_BACK culling while culling disabled.
Fixes everything-black with meta_clear_tris on quake4-mpdemo and doom3-demo.

Bug #18844, 22077.
(cherry picked from commit 81d5550684)
2009-07-20 19:10:20 -07:00
Michel Dänzer
5ed4404005 radeon: With DRI1, if we have HW stencil, only expose fbconfigs with stencil.
Otherwise simple apps like glxgears pick up a DirectColor visual since the X
server mixes the depth 32 visual in with the other GLX visuals, and this seems
to result in a (mostly) black screen due to a bad ColorMap for a lot of people.

The bad ColorMap may be a bug in the apps, the X server or X driver, and
regardless of that I think the X server should ideally make the depth 32 GLX
visual separate from the rest again, but in the meantime this makes us cope.

(depth_bits is either 16 or 24, never 0)
2009-07-20 20:34:04 +02:00
Brice Goglin
767c0b16f3 Prepare changelog for upload 2009-07-19 12:54:22 +02:00
Brice Goglin
3041819a4e New upstream release 2009-07-19 12:51:08 +02:00
Brice Goglin
4a9beaf2e9 Merge tag 'mesa_7_5' into debian-experimental
Conflicts:
	progs/tests/.gitignore
	progs/tests/Makefile
	progs/tests/SConscript
	progs/trivial/Makefile
	scons/dxsdk.py
	scons/gallium.py
2009-07-19 12:50:28 +02:00
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
Brice Goglin
fe9b9fec39 Enable i686 optimized libraries on kfreebsd-i386 2009-07-17 18:21:27 +02: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
Timo Aaltonen
082f547492 Move dri.pc to mesa-common-dev (closes: #521667) 2009-06-29 15:22:21 +03: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
127 changed files with 162030 additions and 1067 deletions

160006
ChangeLog Normal file

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -642,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

24
debian/changelog vendored
View File

@@ -1,3 +1,27 @@
mesa (7.5-2) unstable; urgency=low
* Pull from upstream mesa_7_5_branch up to commit a6b31415
+ radeon/DRI1: if we have HW stencil, only expose fbconfigs with stencil,
closes: #537732.
* Install the upstream changelog.
-- Brice Goglin <bgoglin@debian.org> Tue, 21 Jul 2009 22:21:50 +0200
mesa (7.5-1) unstable; urgency=low
[ Timo Aaltonen ]
* Move dri.pc to mesa-common-dev (closes: #521667)
[ Brice Goglin ]
* Enable i686 optimized libraries on kfreebsd-i386, closes: #537345.
* New upstream release:
+ i915: Fix assertion failure on remapping a non-BO-backed VBO,
closes: #537147.
+ GLX/DRI1: Mark GLX visuals with depth != screen depth non-conformant,
closes: #532980.
-- Brice Goglin <bgoglin@debian.org> Sun, 19 Jul 2009 12:53:41 +0200
mesa (7.5~rc4-1) experimental; urgency=low
[ Timo Aaltonen ]

8
debian/control vendored
View File

@@ -64,7 +64,7 @@ Description: A free implementation of the OpenGL API -- debugging symbols
Package: libgl1-mesa-swx11-i686
Section: libs
Priority: extra
Architecture: i386
Architecture: i386 kfreebsd-i386
Depends: libgl1-mesa-swx11 (= ${binary:Version}), ${shlibs:Depends}
Description: Mesa OpenGL runtime [i686 optimized]
Mesa is a 3-D graphics library with an API which is very similar to
@@ -143,7 +143,7 @@ Description: Debugging symbols for the Mesa GLX runtime
#Package: libgl1-mesa-glx-i686
#Section: libs
#Priority: extra
#Architecture: i386
#Architecture: i386 kfreebsd-i386
#Pre-Depends: libgl1-mesa-glx
#Description: A free implementation of the OpenGL API -- GLX runtime [i686 optimized]
# This version of Mesa provides GLX and DRI capabilities: it is capable of
@@ -204,7 +204,7 @@ Description: Debugging symbols for the Mesa DRI modules
#Package: libgl1-mesa-dri-i686
#Section: libs
#Priority: extra
#Architecture: i386
#Architecture: i386 kfreebsd-i386
#Pre-Depends: libgl1-mesa-dri
#Description: A free implementation of the OpenGL API -- DRI modules [i686 optimized]
# This version of Mesa provides GLX and DRI capabilities: it is capable of
@@ -243,7 +243,7 @@ Description: A free implementation of the OpenGL API -- GLX development files
Package: mesa-common-dev
Section: libdevel
Architecture: any
Replaces: xlibmesa-gl-dev (<< 1:7), xlibosmesa-dev, libgl1-mesa-swx11-dev (<< 6.5.2), libgl1-mesa-dev (<< 6.5.2)
Replaces: xlibmesa-gl-dev (<< 1:7), xlibosmesa-dev, libgl1-mesa-swx11-dev (<< 6.5.2), libgl1-mesa-dev (<< 7.5~rc4-2)
Depends: libx11-dev
Description: Developer documentation for Mesa
This package includes the specifications for the Mesa-specific OpenGL

View File

@@ -1,3 +1,2 @@
usr/lib/libGL.so
usr/lib/pkgconfig/gl.pc
usr/lib/glx/pkgconfig/dri.pc usr/lib/pkgconfig/

View File

@@ -5,3 +5,4 @@ usr/include/GL/glx.h
usr/include/GL/glxext.h
usr/include/GL/glx_mangle.h
usr/include/GL/internal/dri_interface.h
usr/lib/glx/pkgconfig/dri.pc usr/lib/pkgconfig/

2
debian/rules vendored
View File

@@ -222,7 +222,7 @@ binary-indep: install
binary-arch: install
dh_testdir
dh_testroot
dh_installchangelogs -s
dh_installchangelogs -s ChangeLog
dh_installdocs -s
dh_installexamples -s
dh_install -s --sourcedir=debian/tmp --list-missing

View File

@@ -37,7 +37,7 @@ endif
##############################################################################
## CPU-optimized configurations ##############################################
ifeq ($(DEB_BUILD_ARCH), i386)
ifneq (,$(filter $(DEB_BUILD_ARCH), i386 kfreebsd-i386))
SWX11_GLU_CONFIGS += swx11+glu-i386-i686
# DRI_CONFIGS += debian-dri-i386-i686
endif

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

@@ -11,6 +11,14 @@
<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.
@@ -99,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>

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>
@@ -70,6 +70,8 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0
<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>

View File

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

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

@@ -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

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

@@ -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

@@ -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

@@ -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

@@ -139,8 +139,8 @@ tgsi_build_declaration(
{
struct tgsi_declaration declaration;
assert( file <= TGSI_FILE_IMMEDIATE );
assert( interpolate <= TGSI_INTERPOLATE_PERSPECTIVE );
assert( file < TGSI_FILE_COUNT );
assert( interpolate < TGSI_INTERPOLATE_COUNT );
declaration = tgsi_default_declaration();
declaration.File = file;
@@ -584,6 +584,7 @@ tgsi_build_full_instruction(
*dst_register = tgsi_build_dst_register(
reg->DstRegister.File,
reg->DstRegister.WriteMask,
reg->DstRegister.Indirect,
reg->DstRegister.Index,
instruction,
header );
@@ -631,6 +632,28 @@ tgsi_build_full_instruction(
header );
prev_token = (struct tgsi_token *) dst_register_ext_modulate;
}
if( reg->DstRegister.Indirect ) {
struct tgsi_src_register *ind;
if( maxsize <= size )
return 0;
ind = (struct tgsi_src_register *) &tokens[size];
size++;
*ind = tgsi_build_src_register(
reg->DstRegisterInd.File,
reg->DstRegisterInd.SwizzleX,
reg->DstRegisterInd.SwizzleY,
reg->DstRegisterInd.SwizzleZ,
reg->DstRegisterInd.SwizzleW,
reg->DstRegisterInd.Negate,
reg->DstRegisterInd.Indirect,
reg->DstRegisterInd.Dimension,
reg->DstRegisterInd.Index,
instruction,
header );
}
}
for( i = 0; i < full_inst->Instruction.NumSrcRegs; i++ ) {
@@ -973,7 +996,7 @@ tgsi_build_src_register(
{
struct tgsi_src_register src_register;
assert( file <= TGSI_FILE_IMMEDIATE );
assert( file < TGSI_FILE_COUNT );
assert( swizzle_x <= TGSI_SWIZZLE_W );
assert( swizzle_y <= TGSI_SWIZZLE_W );
assert( swizzle_z <= TGSI_SWIZZLE_W );
@@ -1194,13 +1217,14 @@ struct tgsi_dst_register
tgsi_build_dst_register(
unsigned file,
unsigned mask,
unsigned indirect,
int index,
struct tgsi_instruction *instruction,
struct tgsi_header *header )
{
struct tgsi_dst_register dst_register;
assert( file <= TGSI_FILE_IMMEDIATE );
assert( file < TGSI_FILE_COUNT );
assert( mask <= TGSI_WRITEMASK_XYZW );
assert( index >= -32768 && index <= 32767 );
@@ -1208,6 +1232,7 @@ tgsi_build_dst_register(
dst_register.File = file;
dst_register.WriteMask = mask;
dst_register.Index = index;
dst_register.Indirect = indirect;
instruction_grow( instruction, header );
@@ -1220,6 +1245,7 @@ tgsi_default_full_dst_register( void )
struct tgsi_full_dst_register full_dst_register;
full_dst_register.DstRegister = tgsi_default_dst_register();
full_dst_register.DstRegisterInd = tgsi_default_src_register();
full_dst_register.DstRegisterExtConcode =
tgsi_default_dst_register_ext_concode();
full_dst_register.DstRegisterExtModulate =

View File

@@ -289,6 +289,7 @@ struct tgsi_dst_register
tgsi_build_dst_register(
unsigned file,
unsigned mask,
unsigned indirect,
int index,
struct tgsi_instruction *instruction,
struct tgsi_header *header );

View File

@@ -28,6 +28,7 @@
#include "util/u_debug.h"
#include "util/u_string.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "tgsi_dump.h"
#include "tgsi_info.h"
#include "tgsi_iterate.h"
@@ -108,7 +109,8 @@ static const char *semantic_names[] =
"FOG",
"PSIZE",
"GENERIC",
"NORMAL"
"NORMAL",
"FACE"
};
static const char *immediate_type_names[] =
@@ -224,6 +226,9 @@ iter_declaration(
{
struct dump_ctx *ctx = (struct dump_ctx *)iter;
assert(Elements(semantic_names) == TGSI_SEMANTIC_COUNT);
assert(Elements(interpolate_names) == TGSI_INTERPOLATE_COUNT);
TXT( "DCL " );
_dump_register(
@@ -355,11 +360,22 @@ iter_instruction(
CHR( ',' );
CHR( ' ' );
_dump_register(
ctx,
dst->DstRegister.File,
dst->DstRegister.Index,
dst->DstRegister.Index );
if (dst->DstRegister.Indirect) {
_dump_register_ind(
ctx,
dst->DstRegister.File,
dst->DstRegister.Index,
dst->DstRegisterInd.File,
dst->DstRegisterInd.Index,
dst->DstRegisterInd.SwizzleX );
}
else {
_dump_register(
ctx,
dst->DstRegister.File,
dst->DstRegister.Index,
dst->DstRegister.Index );
}
ENM( dst->DstRegisterExtModulate.Modulate, modulate_names );
_dump_writemask( ctx, dst->DstRegister.WriteMask );

View File

@@ -1395,28 +1395,69 @@ store_dest(
union tgsi_exec_channel null;
union tgsi_exec_channel *dst;
uint execmask = mach->ExecMask;
int offset = 0; /* indirection offset */
int index;
#ifdef DEBUG
check_inf_or_nan(chan);
#endif
/* There is an extra source register that indirectly subscripts
* a register file. The direct index now becomes an offset
* that is being added to the indirect register.
*
* file[ind[2].x+1],
* where:
* ind = DstRegisterInd.File
* [2] = DstRegisterInd.Index
* .x = DstRegisterInd.SwizzleX
*/
if (reg->DstRegister.Indirect) {
union tgsi_exec_channel index;
union tgsi_exec_channel indir_index;
uint swizzle;
/* which address register (always zero for now) */
index.i[0] =
index.i[1] =
index.i[2] =
index.i[3] = reg->DstRegisterInd.Index;
/* get current value of address register[swizzle] */
swizzle = tgsi_util_get_src_register_swizzle( &reg->DstRegisterInd, CHAN_X );
/* fetch values from the address/indirection register */
fetch_src_file_channel(
mach,
reg->DstRegisterInd.File,
swizzle,
&index,
&indir_index );
/* save indirection offset */
offset = (int) indir_index.f[0];
}
switch (reg->DstRegister.File) {
case TGSI_FILE_NULL:
dst = &null;
break;
case TGSI_FILE_OUTPUT:
dst = &mach->Outputs[mach->Temps[TEMP_OUTPUT_I].xyzw[TEMP_OUTPUT_C].u[0]
+ reg->DstRegister.Index].xyzw[chan_index];
index = mach->Temps[TEMP_OUTPUT_I].xyzw[TEMP_OUTPUT_C].u[0]
+ reg->DstRegister.Index;
dst = &mach->Outputs[offset + index].xyzw[chan_index];
break;
case TGSI_FILE_TEMPORARY:
assert( reg->DstRegister.Index < TGSI_EXEC_NUM_TEMPS );
dst = &mach->Temps[reg->DstRegister.Index].xyzw[chan_index];
index = reg->DstRegister.Index;
assert( index < TGSI_EXEC_NUM_TEMPS );
dst = &mach->Temps[offset + index].xyzw[chan_index];
break;
case TGSI_FILE_ADDRESS:
dst = &mach->Addrs[reg->DstRegister.Index].xyzw[chan_index];
index = reg->DstRegister.Index;
dst = &mach->Addrs[index].xyzw[chan_index];
break;
default:

View File

@@ -219,7 +219,6 @@ tgsi_parse_token(
/*
* No support for indirect or multi-dimensional addressing.
*/
assert( !inst->FullDstRegisters[i].DstRegister.Indirect );
assert( !inst->FullDstRegisters[i].DstRegister.Dimension );
extended = inst->FullDstRegisters[i].DstRegister.Extended;
@@ -246,6 +245,17 @@ tgsi_parse_token(
extended = token.Extended;
}
if( inst->FullDstRegisters[i].DstRegister.Indirect ) {
next_token( ctx, &inst->FullDstRegisters[i].DstRegisterInd );
/*
* No support for indirect or multi-dimensional addressing.
*/
assert( !inst->FullDstRegisters[i].DstRegisterInd.Indirect );
assert( !inst->FullDstRegisters[i].DstRegisterInd.Dimension );
assert( !inst->FullDstRegisters[i].DstRegisterInd.Extended );
}
}
assert( inst->Instruction.NumSrcRegs <= TGSI_FULL_MAX_SRC_REGISTERS );

View File

@@ -48,6 +48,7 @@ struct tgsi_full_header
struct tgsi_full_dst_register
{
struct tgsi_dst_register DstRegister;
struct tgsi_src_register DstRegisterInd;
struct tgsi_dst_register_ext_concode DstRegisterExtConcode;
struct tgsi_dst_register_ext_modulate DstRegisterExtModulate;
};

View File

@@ -26,6 +26,7 @@
**************************************************************************/
#include "util/u_debug.h"
#include "util/u_memory.h"
#include "tgsi_text.h"
#include "tgsi_build.h"
#include "tgsi_info.h"
@@ -927,7 +928,8 @@ static const char *semantic_names[TGSI_SEMANTIC_COUNT] =
"FOG",
"PSIZE",
"GENERIC",
"NORMAL"
"NORMAL",
"FACE"
};
static const char *interpolate_names[TGSI_INTERPOLATE_COUNT] =
@@ -947,6 +949,9 @@ static boolean parse_declaration( struct translate_ctx *ctx )
const char *cur;
uint advance;
assert(Elements(semantic_names) == TGSI_SEMANTIC_COUNT);
assert(Elements(interpolate_names) == TGSI_INTERPOLATE_COUNT);
if (!eat_white( &ctx->cur )) {
report_error( ctx, "Syntax error" );
return FALSE;

View File

@@ -97,10 +97,8 @@ void _debug_vprintf(const char *format, va_list ap)
buf[0] = '\0';
}
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
/* EngDebugPrint does not handle float point arguments, so we need to use
* our own vsnprintf implementation. It is also very slow, so buffer until
* we find a newline. */
static char buf[512 + 1] = {'\0'};
/* OutputDebugStringA can be very slow, so buffer until we find a newline. */
static char buf[4096] = {'\0'};
size_t len = strlen(buf);
int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap);
if(ret > (int)(sizeof(buf) - len - 1) || util_strchr(buf + len, '\n')) {

View File

@@ -1202,6 +1202,19 @@ pipe_put_tile_z(struct pipe_transfer *pt,
}
break;
case PIPE_FORMAT_S8Z24_UNORM:
{
uint *pDest = (uint *) (map + y * pt->stride + x*4);
assert(pt->usage == PIPE_TRANSFER_READ_WRITE);
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
/* convert 32-bit Z to 24-bit Z, preserve stencil */
pDest[j] = (pDest[j] & 0xff000000) | ptrc[j] >> 8;
}
pDest += pt->stride/4;
ptrc += srcStride;
}
}
break;
case PIPE_FORMAT_X8Z24_UNORM:
{
uint *pDest = (uint *) (map + y * pt->stride + x*4);
@@ -1216,13 +1229,26 @@ pipe_put_tile_z(struct pipe_transfer *pt,
}
break;
case PIPE_FORMAT_Z24S8_UNORM:
{
uint *pDest = (uint *) (map + y * pt->stride + x*4);
assert(pt->usage == PIPE_TRANSFER_READ_WRITE);
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
/* convert 32-bit Z to 24-bit Z, preserve stencil */
pDest[j] = (pDest[j] & 0xff) | (ptrc[j] & 0xffffff00);
}
pDest += pt->stride/4;
ptrc += srcStride;
}
}
break;
case PIPE_FORMAT_Z24X8_UNORM:
{
uint *pDest = (uint *) (map + y * pt->stride + x*4);
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
/* convert 32-bit Z to 24-bit Z (0 stencil) */
pDest[j] = ptrc[j] << 8;
pDest[j] = ptrc[j] & 0xffffff00;
}
pDest += pt->stride/4;
ptrc += srcStride;

View File

@@ -83,7 +83,9 @@ my_buffer_write(struct pipe_screen *screen,
assert(dirty_size >= size);
assert(size);
map = pipe_buffer_map_range(screen, buf, offset, size, PIPE_BUFFER_USAGE_CPU_WRITE);
map = pipe_buffer_map_range(screen, buf, offset, size,
PIPE_BUFFER_USAGE_CPU_WRITE |
PIPE_BUFFER_USAGE_FLUSH_EXPLICIT);
if (map == NULL)
return PIPE_ERROR_OUT_OF_MEMORY;

View File

@@ -72,6 +72,24 @@ do { \
R[3] = A[3] - B[3]; \
} while (0)
/** Add and limit result to ceiling of 1.0 */
#define VEC4_ADD_SAT(R, A, B) \
do { \
R[0] = A[0] + B[0]; if (R[0] > 1.0f) R[0] = 1.0f; \
R[1] = A[1] + B[1]; if (R[1] > 1.0f) R[1] = 1.0f; \
R[2] = A[2] + B[2]; if (R[2] > 1.0f) R[2] = 1.0f; \
R[3] = A[3] + B[3]; if (R[3] > 1.0f) R[3] = 1.0f; \
} while (0)
/** Subtract and limit result to floor of 0.0 */
#define VEC4_SUB_SAT(R, A, B) \
do { \
R[0] = A[0] - B[0]; if (R[0] < 0.0f) R[0] = 0.0f; \
R[1] = A[1] - B[1]; if (R[1] < 0.0f) R[1] = 0.0f; \
R[2] = A[2] - B[2]; if (R[2] < 0.0f) R[2] = 0.0f; \
R[3] = A[3] - B[3]; if (R[3] < 0.0f) R[3] = 0.0f; \
} while (0)
#define VEC4_MUL(R, A, B) \
do { \
R[0] = A[0] * B[0]; \
@@ -676,19 +694,19 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
*/
switch (softpipe->blend->rgb_func) {
case PIPE_BLEND_ADD:
VEC4_ADD(quadColor[0], source[0], dest[0]); /* R */
VEC4_ADD(quadColor[1], source[1], dest[1]); /* G */
VEC4_ADD(quadColor[2], source[2], dest[2]); /* B */
VEC4_ADD_SAT(quadColor[0], source[0], dest[0]); /* R */
VEC4_ADD_SAT(quadColor[1], source[1], dest[1]); /* G */
VEC4_ADD_SAT(quadColor[2], source[2], dest[2]); /* B */
break;
case PIPE_BLEND_SUBTRACT:
VEC4_SUB(quadColor[0], source[0], dest[0]); /* R */
VEC4_SUB(quadColor[1], source[1], dest[1]); /* G */
VEC4_SUB(quadColor[2], source[2], dest[2]); /* B */
VEC4_SUB_SAT(quadColor[0], source[0], dest[0]); /* R */
VEC4_SUB_SAT(quadColor[1], source[1], dest[1]); /* G */
VEC4_SUB_SAT(quadColor[2], source[2], dest[2]); /* B */
break;
case PIPE_BLEND_REVERSE_SUBTRACT:
VEC4_SUB(quadColor[0], dest[0], source[0]); /* R */
VEC4_SUB(quadColor[1], dest[1], source[1]); /* G */
VEC4_SUB(quadColor[2], dest[2], source[2]); /* B */
VEC4_SUB_SAT(quadColor[0], dest[0], source[0]); /* R */
VEC4_SUB_SAT(quadColor[1], dest[1], source[1]); /* G */
VEC4_SUB_SAT(quadColor[2], dest[2], source[2]); /* B */
break;
case PIPE_BLEND_MIN:
VEC4_MIN(quadColor[0], source[0], dest[0]); /* R */
@@ -709,13 +727,13 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
*/
switch (softpipe->blend->alpha_func) {
case PIPE_BLEND_ADD:
VEC4_ADD(quadColor[3], source[3], dest[3]); /* A */
VEC4_ADD_SAT(quadColor[3], source[3], dest[3]); /* A */
break;
case PIPE_BLEND_SUBTRACT:
VEC4_SUB(quadColor[3], source[3], dest[3]); /* A */
VEC4_SUB_SAT(quadColor[3], source[3], dest[3]); /* A */
break;
case PIPE_BLEND_REVERSE_SUBTRACT:
VEC4_SUB(quadColor[3], dest[3], source[3]); /* A */
VEC4_SUB_SAT(quadColor[3], dest[3], source[3]); /* A */
break;
case PIPE_BLEND_MIN:
VEC4_MIN(quadColor[3], source[3], dest[3]); /* A */

View File

@@ -785,11 +785,10 @@ static void setup_tri_coefficients( struct setup_context *setup )
assert(0);
}
if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FOG) {
/* FOG.y = front/back facing XXX fix this */
setup->coef[fragSlot].a0[1] = 1.0f - setup->quad.input.facing;
setup->coef[fragSlot].dadx[1] = 0.0;
setup->coef[fragSlot].dady[1] = 0.0;
if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) {
setup->coef[fragSlot].a0[0] = 1.0f - setup->quad.input.facing;
setup->coef[fragSlot].dadx[0] = 0.0;
setup->coef[fragSlot].dady[0] = 0.0;
}
}
}
@@ -1096,11 +1095,10 @@ setup_line_coefficients(struct setup_context *setup,
assert(0);
}
if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FOG) {
/* FOG.y = front/back facing XXX fix this */
setup->coef[fragSlot].a0[1] = 1.0f - setup->quad.input.facing;
setup->coef[fragSlot].dadx[1] = 0.0;
setup->coef[fragSlot].dady[1] = 0.0;
if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) {
setup->coef[fragSlot].a0[0] = 1.0f - setup->quad.input.facing;
setup->coef[fragSlot].dadx[0] = 0.0;
setup->coef[fragSlot].dady[0] = 0.0;
}
}
return TRUE;
@@ -1342,11 +1340,10 @@ setup_point( struct setup_context *setup,
assert(0);
}
if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FOG) {
/* FOG.y = front/back facing XXX fix this */
setup->coef[fragSlot].a0[1] = 1.0f - setup->quad.input.facing;
setup->coef[fragSlot].dadx[1] = 0.0;
setup->coef[fragSlot].dady[1] = 0.0;
if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) {
setup->coef[fragSlot].a0[0] = 1.0f - setup->quad.input.facing;
setup->coef[fragSlot].dadx[0] = 0.0;
setup->coef[fragSlot].dady[0] = 0.0;
}
}

View File

@@ -110,6 +110,7 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
break;
case TGSI_SEMANTIC_GENERIC:
case TGSI_SEMANTIC_FACE:
/* this includes texcoords and varying vars */
src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_GENERIC,
spfs->info.input_semantic_index[i]);

View File

@@ -217,6 +217,7 @@ enum pipe_transfer_usage {
#define PIPE_BUFFER_USAGE_CONSTANT (1 << 7)
#define PIPE_BUFFER_USAGE_DISCARD (1 << 8)
#define PIPE_BUFFER_USAGE_DONTBLOCK (1 << 9)
#define PIPE_BUFFER_USAGE_FLUSH_EXPLICIT (1 << 10) /**< See pipe_screen::buffer_flush_mapped_range */
/** Pipe driver custom usage flags should be greater or equal to this value */
#define PIPE_BUFFER_USAGE_CUSTOM (1 << 16)

View File

@@ -117,7 +117,9 @@ pipe_buffer_write(struct pipe_screen *screen,
assert(offset + size <= buf->size);
assert(size);
map = pipe_buffer_map_range(screen, buf, offset, size, PIPE_BUFFER_USAGE_CPU_WRITE);
map = pipe_buffer_map_range(screen, buf, offset, size,
PIPE_BUFFER_USAGE_CPU_WRITE |
PIPE_BUFFER_USAGE_FLUSH_EXPLICIT);
assert(map);
if(map) {
memcpy(map + offset, data, size);

View File

@@ -221,23 +221,31 @@ struct pipe_screen {
/**
* Notify a range that was actually written into.
*
* Can only be used if the buffer was mapped with the
* PIPE_BUFFER_USAGE_CPU_WRITE and PIPE_BUFFER_USAGE_FLUSH_EXPLICIT flags
* set.
*
* The range is relative to the buffer start, regardless of the range
* specified to buffer_map_range. This is different from the
* ARB_map_buffer_range semantics because we don't forbid multiple mappings
* of the same buffer (yet).
*
* If the buffer was mapped for writing and no buffer_flush_mapped_range
* call was done until the buffer_unmap is called then the pipe driver will
* assumed that the whole buffer was written. This is for backward
* compatibility purposes and may affect performance -- the state tracker
* should always specify exactly what got written while the buffer was
* mapped.
*/
void (*buffer_flush_mapped_range)( struct pipe_screen *screen,
struct pipe_buffer *buf,
unsigned offset,
unsigned length);
/**
* Unmap buffer.
*
* If the buffer was mapped with PIPE_BUFFER_USAGE_CPU_WRITE flag but not
* PIPE_BUFFER_USAGE_FLUSH_EXPLICIT then the pipe driver will
* assume that the whole buffer was written. This is mostly for backward
* compatibility purposes and may affect performance -- the state tracker
* should always specify exactly what got written while the buffer was
* mapped.
*/
void (*buffer_unmap)( struct pipe_screen *screen,
struct pipe_buffer *buf );

View File

@@ -131,7 +131,8 @@ struct tgsi_declaration_range
#define TGSI_SEMANTIC_PSIZE 4
#define TGSI_SEMANTIC_GENERIC 5
#define TGSI_SEMANTIC_NORMAL 6
#define TGSI_SEMANTIC_COUNT 7 /**< number of semantic values */
#define TGSI_SEMANTIC_FACE 7
#define TGSI_SEMANTIC_COUNT 8 /**< number of semantic values */
struct tgsi_declaration_semantic
{

View File

@@ -15,6 +15,19 @@ if 'python' in env['statetrackers']:
env.Append(CPPPATH = '.')
if env['platform'] == 'windows':
env.Append(LIBS = [
'opengl32',
'gdi32',
'user32',
'kernel32',
])
else:
env.Append(LIBS = [
'GL',
'X11',
])
pyst = env.ConvenienceLibrary(
target = 'pyst',
source = [

View File

@@ -456,6 +456,7 @@ class Context(Object):
x, y, z, w = unpack_from(format, data, offset)
sys.stdout.write('\tCONST[%2u] = {%10.4f, %10.4f, %10.4f, %10.4f}\n' % (index, x, y, z, w))
index += 1
sys.stdout.flush()
def set_constant_buffer(self, shader, index, buffer):
if buffer is not None:
@@ -537,6 +538,7 @@ class Context(Object):
sys.stdout.write('\t\t{' + ', '.join(map(str, values)) + '},\n')
assert len(values) == velem.nr_components
sys.stdout.write('\t},\n')
sys.stdout.flush()
def dump_indices(self, ibuf, isize, start, count):
if not self.interpreter.verbosity(2):
@@ -564,6 +566,7 @@ class Context(Object):
minindex = min(minindex, index)
maxindex = max(maxindex, index)
sys.stdout.write('\t},\n')
sys.stdout.flush()
return minindex, maxindex
@@ -591,6 +594,20 @@ class Context(Object):
self.real.draw_range_elements(indexBuffer, indexSize, minIndex, maxIndex, mode, start, count)
self._set_dirty()
def surface_copy(self, dest, destx, desty, src, srcx, srcy, width, height):
if dest is not None and src is not None:
if self.interpreter.options.all:
self.interpreter.present(src, 'surface_copy_src', srcx, srcy, width, height)
self.real.surface_copy(dest, destx, desty, src, srcx, srcy, width, height)
if dest in self.cbufs:
self._set_dirty()
flags = gallium.PIPE_FLUSH_FRAME
else:
flags = 0
self.flush(flags)
if self.interpreter.options.all:
self.interpreter.present(dest, 'surface_copy_dest', destx, desty, width, height)
def is_texture_referenced(self, texture, face, level):
#return self.real.is_texture_referenced(format, texture, face, level)
pass
@@ -660,7 +677,7 @@ class Interpreter(parser.TraceDumper):
self.interpret_call(call)
def handle_call(self, call):
if self.options.stop and call.no >= self.options.stop:
if self.options.stop and call.no > self.options.stop:
sys.exit(0)
if (call.klass, call.method) in self.ignore_calls:
@@ -670,6 +687,7 @@ class Interpreter(parser.TraceDumper):
if self.verbosity(1):
parser.TraceDumper.handle_call(self, call)
sys.stdout.flush()
args = [(str(name), self.interpret_arg(arg)) for name, arg in call.args]

View File

@@ -139,7 +139,7 @@ def test(dev):
tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET,
).get_surface()
zbuf = dev.texture_create(
PIPE_FORMAT_Z32_UNORM,
PIPE_FORMAT_Z16_UNORM,
width, height,
tex_usage=PIPE_TEXTURE_USAGE_DEPTH_STENCIL,
).get_surface()

View File

@@ -44,8 +44,14 @@
static void
st_device_really_destroy(struct st_device *st_dev)
{
if(st_dev->screen)
if(st_dev->screen) {
/* FIXME: Don't really destroy until we keep track of every single
* reference or we end up causing a segmentation fault every time
* python exits. */
#if 0
st_dev->screen->destroy(st_dev->screen);
#endif
}
FREE(st_dev);
}

View File

@@ -28,31 +28,206 @@
/**
* @file
* Stub for hardware pipe driver support.
* Get a hardware accelerated Gallium screen/context from the OpenGL driver.
*/
#include "pipe/p_compiler.h"
#ifdef PIPE_OS_WINDOWS
#include <windows.h>
#include <GL/gl.h>
#else
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <GL/gl.h>
#include <GL/glx.h>
#endif
#include "st_winsys.h"
typedef struct pipe_screen * (GLAPIENTRY *PFNGETGALLIUMSCREENMESAPROC) (void);
typedef struct pipe_context * (GLAPIENTRY* PFNCREATEGALLIUMCONTEXTMESAPROC) (void);
static PFNGETGALLIUMSCREENMESAPROC pfnGetGalliumScreenMESA = NULL;
static PFNCREATEGALLIUMCONTEXTMESAPROC pfnCreateGalliumContextMESA = NULL;
/* XXX: Force init_gallium symbol to be linked */
extern void init_gallium(void);
void (*force_init_gallium_linkage)(void) = &init_gallium;
#ifdef PIPE_OS_WINDOWS
static INLINE boolean
st_hardpipe_load(void)
{
WNDCLASS wc;
HWND hwnd;
HGLRC hglrc;
HDC hdc;
PIXELFORMATDESCRIPTOR pfd;
int iPixelFormat;
if(pfnGetGalliumScreenMESA && pfnCreateGalliumContextMESA)
return TRUE;
memset(&wc, 0, sizeof wc);
wc.lpfnWndProc = DefWindowProc;
wc.lpszClassName = "gallium";
wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
RegisterClass(&wc);
hwnd = CreateWindow(wc.lpszClassName, "gallium", 0, 0, 0, 0, 0, NULL, 0, wc.hInstance, NULL);
if (!hwnd)
return FALSE;
hdc = GetDC(hwnd);
if (!hdc)
return FALSE;
pfd.cColorBits = 3;
pfd.cRedBits = 1;
pfd.cGreenBits = 1;
pfd.cBlueBits = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
pfd.iLayerType = PFD_MAIN_PLANE;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.nSize = sizeof(pfd);
pfd.nVersion = 1;
iPixelFormat = ChoosePixelFormat(hdc, &pfd);
if (!iPixelFormat) {
pfd.dwFlags |= PFD_DOUBLEBUFFER;
iPixelFormat = ChoosePixelFormat(hdc, &pfd);
}
if (!iPixelFormat)
return FALSE;
SetPixelFormat(hdc, iPixelFormat, &pfd);
hglrc = wglCreateContext(hdc);
if (!hglrc)
return FALSE;
if (!wglMakeCurrent(hdc, hglrc))
return FALSE;
pfnGetGalliumScreenMESA = (PFNGETGALLIUMSCREENMESAPROC)wglGetProcAddress("wglGetGalliumScreenMESA");
if(!pfnGetGalliumScreenMESA)
return FALSE;
pfnCreateGalliumContextMESA = (PFNCREATEGALLIUMCONTEXTMESAPROC)wglGetProcAddress("wglCreateGalliumContextMESA");
if(!pfnCreateGalliumContextMESA)
return FALSE;
DestroyWindow(hwnd);
return TRUE;
}
#else
static INLINE boolean
st_hardpipe_load(void)
{
Display *dpy;
int scrnum;
Window root;
int attribSingle[] = {
GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
None };
int attribDouble[] = {
GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER,
None };
XVisualInfo *visinfo;
GLXContext ctx = NULL;
XSetWindowAttributes attr;
unsigned long mask;
int width = 100, height = 100;
Window win;
dpy = XOpenDisplay(NULL);
if (!dpy)
return FALSE;
scrnum = 0;
root = RootWindow(dpy, scrnum);
visinfo = glXChooseVisual(dpy, scrnum, attribSingle);
if (!visinfo)
visinfo = glXChooseVisual(dpy, scrnum, attribDouble);
if (!visinfo)
return FALSE;
ctx = glXCreateContext( dpy, visinfo, NULL, True );
if (!ctx)
return FALSE;
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow(dpy, root, 0, 0, width, height,
0, visinfo->depth, InputOutput,
visinfo->visual, mask, &attr);
if (!glXMakeCurrent(dpy, win, ctx))
return FALSE;
pfnGetGalliumScreenMESA = (PFNGETGALLIUMSCREENMESAPROC)glXGetProcAddressARB((const GLubyte *)"glXGetGalliumScreenMESA");
if(!pfnGetGalliumScreenMESA)
return FALSE;
pfnCreateGalliumContextMESA = (PFNCREATEGALLIUMCONTEXTMESAPROC)glXGetProcAddressARB((const GLubyte *)"glXCreateGalliumContextMESA");
if(!pfnCreateGalliumContextMESA)
return FALSE;
glXDestroyContext(dpy, ctx);
XFree(visinfo);
XDestroyWindow(dpy, win);
XCloseDisplay(dpy);
return TRUE;
}
#endif
static struct pipe_screen *
st_hardpipe_screen_create(void)
{
return st_softpipe_winsys.screen_create();
if(st_hardpipe_load())
return pfnGetGalliumScreenMESA();
else
return st_softpipe_winsys.screen_create();
}
static struct pipe_context *
st_hardpipe_context_create(struct pipe_screen *screen)
{
return st_softpipe_winsys.context_create(screen);
if(st_hardpipe_load()) {
if(screen == pfnGetGalliumScreenMESA())
return pfnCreateGalliumContextMESA();
else
return NULL;
}
else
return st_softpipe_winsys.context_create(screen);
}

View File

@@ -27,7 +27,9 @@ if env['platform'] in ['windows']:
'shared/stw_framebuffer.c',
'shared/stw_pixelformat.c',
'shared/stw_extensionsstring.c',
'shared/stw_extswapinterval.c',
'shared/stw_getprocaddress.c',
'shared/stw_extgallium.c',
'shared/stw_arbpixelformat.c',
'shared/stw_tls.c',
]

View File

@@ -60,8 +60,14 @@ stw_context(GLcontext *glctx)
static INLINE struct stw_context *
stw_current_context(void)
{
GET_CURRENT_CONTEXT( glctx );
return stw_context(glctx);
/* We must check if multiple threads are being used or GET_CURRENT_CONTEXT
* might return the current context of the thread first seen. */
_glapi_check_multithread();
{
GET_CURRENT_CONTEXT( glctx );
return stw_context(glctx);
}
}
BOOL
@@ -74,7 +80,7 @@ stw_copy_context(
struct stw_context *dst;
BOOL ret = FALSE;
pipe_mutex_lock( stw_dev->mutex );
pipe_mutex_lock( stw_dev->ctx_mutex );
src = stw_lookup_context_locked( hglrcSrc );
dst = stw_lookup_context_locked( hglrcDst );
@@ -87,7 +93,7 @@ stw_copy_context(
(void) mask;
}
pipe_mutex_unlock( stw_dev->mutex );
pipe_mutex_unlock( stw_dev->ctx_mutex );
return ret;
}
@@ -101,7 +107,7 @@ stw_share_lists(
struct stw_context *ctx2;
BOOL ret = FALSE;
pipe_mutex_lock( stw_dev->mutex );
pipe_mutex_lock( stw_dev->ctx_mutex );
ctx1 = stw_lookup_context_locked( hglrc1 );
ctx2 = stw_lookup_context_locked( hglrc2 );
@@ -111,7 +117,7 @@ stw_share_lists(
ret = _mesa_share_state(ctx2->st->ctx, ctx1->st->ctx);
}
pipe_mutex_unlock( stw_dev->mutex );
pipe_mutex_unlock( stw_dev->ctx_mutex );
return ret;
}
@@ -124,8 +130,10 @@ stw_viewport(GLcontext * glctx, GLint x, GLint y,
struct stw_framebuffer *fb;
fb = stw_framebuffer_from_hdc( ctx->hdc );
if(fb)
if(fb) {
stw_framebuffer_update(fb);
stw_framebuffer_release(fb);
}
}
UINT_PTR
@@ -189,9 +197,9 @@ stw_create_layer_context(
ctx->st->ctx->DriverCtx = ctx;
ctx->st->ctx->Driver.Viewport = stw_viewport;
pipe_mutex_lock( stw_dev->mutex );
pipe_mutex_lock( stw_dev->ctx_mutex );
ctx->hglrc = handle_table_add(stw_dev->ctx_table, ctx);
pipe_mutex_unlock( stw_dev->mutex );
pipe_mutex_unlock( stw_dev->ctx_mutex );
if (!ctx->hglrc)
goto no_hglrc;
@@ -218,10 +226,10 @@ stw_delete_context(
if (!stw_dev)
return FALSE;
pipe_mutex_lock( stw_dev->mutex );
pipe_mutex_lock( stw_dev->ctx_mutex );
ctx = stw_lookup_context_locked(hglrc);
handle_table_remove(stw_dev->ctx_table, hglrc);
pipe_mutex_unlock( stw_dev->mutex );
pipe_mutex_unlock( stw_dev->ctx_mutex );
if (ctx) {
struct stw_context *curctx = stw_current_context();
@@ -248,9 +256,9 @@ stw_release_context(
if (!stw_dev)
return FALSE;
pipe_mutex_lock( stw_dev->mutex );
pipe_mutex_lock( stw_dev->ctx_mutex );
ctx = stw_lookup_context_locked( hglrc );
pipe_mutex_unlock( stw_dev->mutex );
pipe_mutex_unlock( stw_dev->ctx_mutex );
if (!ctx)
return FALSE;
@@ -298,9 +306,9 @@ stw_make_current(
HDC hdc,
UINT_PTR hglrc )
{
struct stw_context *curctx;
struct stw_context *ctx;
struct stw_framebuffer *fb;
struct stw_context *curctx = NULL;
struct stw_context *ctx = NULL;
struct stw_framebuffer *fb = NULL;
if (!stw_dev)
goto fail;
@@ -322,13 +330,13 @@ stw_make_current(
return st_make_current( NULL, NULL, NULL );
}
pipe_mutex_lock( stw_dev->mutex );
pipe_mutex_lock( stw_dev->ctx_mutex );
ctx = stw_lookup_context_locked( hglrc );
pipe_mutex_unlock( stw_dev->ctx_mutex );
if(!ctx)
goto fail;
fb = stw_framebuffer_from_hdc_locked( hdc );
fb = stw_framebuffer_from_hdc( hdc );
if(!fb) {
/* Applications should call SetPixelFormat before creating a context,
* but not all do, and the opengl32 runtime seems to use a default pixel
@@ -336,13 +344,11 @@ stw_make_current(
*/
int iPixelFormat = GetPixelFormat(hdc);
if(iPixelFormat)
fb = stw_framebuffer_create_locked( hdc, iPixelFormat );
fb = stw_framebuffer_create( hdc, iPixelFormat );
if(!fb)
goto fail;
}
pipe_mutex_unlock( stw_dev->mutex );
if(fb->iPixelFormat != ctx->iPixelFormat)
goto fail;
@@ -361,12 +367,16 @@ stw_make_current(
success:
assert(fb);
if(fb)
if(fb) {
stw_framebuffer_update(fb);
stw_framebuffer_release(fb);
}
return TRUE;
fail:
if(fb)
stw_framebuffer_release(fb);
st_make_current( NULL, NULL, NULL );
return FALSE;
}

View File

@@ -69,8 +69,6 @@ stw_flush_frontbuffer(struct pipe_screen *screen,
fb = stw_framebuffer_from_hdc( hdc );
/* fb can be NULL if window was destroyed already */
if (fb) {
pipe_mutex_lock( fb->mutex );
#if DEBUG
{
struct pipe_surface *surface2;
@@ -94,8 +92,7 @@ stw_flush_frontbuffer(struct pipe_screen *screen,
if(fb) {
stw_framebuffer_update(fb);
pipe_mutex_unlock( fb->mutex );
stw_framebuffer_release(fb);
}
}
@@ -138,7 +135,8 @@ stw_init(const struct stw_winsys *stw_winsys)
stw_dev->screen->flush_frontbuffer = &stw_flush_frontbuffer;
pipe_mutex_init( stw_dev->mutex );
pipe_mutex_init( stw_dev->ctx_mutex );
pipe_mutex_init( stw_dev->fb_mutex );
stw_dev->ctx_table = handle_table_create();
if (!stw_dev->ctx_table) {
@@ -179,7 +177,7 @@ stw_cleanup(void)
if (!stw_dev)
return;
pipe_mutex_lock( stw_dev->mutex );
pipe_mutex_lock( stw_dev->ctx_mutex );
{
/* Ensure all contexts are destroyed */
i = handle_table_get_first_handle(stw_dev->ctx_table);
@@ -189,11 +187,12 @@ stw_cleanup(void)
}
handle_table_destroy(stw_dev->ctx_table);
}
pipe_mutex_unlock( stw_dev->mutex );
pipe_mutex_unlock( stw_dev->ctx_mutex );
stw_framebuffer_cleanup();
pipe_mutex_destroy( stw_dev->mutex );
pipe_mutex_destroy( stw_dev->fb_mutex );
pipe_mutex_destroy( stw_dev->ctx_mutex );
stw_dev->screen->destroy(stw_dev->screen);

View File

@@ -57,10 +57,10 @@ struct stw_device
unsigned pixelformat_count;
unsigned pixelformat_extended_count;
pipe_mutex mutex;
pipe_mutex ctx_mutex;
struct handle_table *ctx_table;
pipe_mutex fb_mutex;
struct stw_framebuffer *fb_head;
#ifdef DEBUG

View File

@@ -38,6 +38,7 @@ static const char *stw_extension_string =
"WGL_ARB_extensions_string "
"WGL_ARB_multisample "
"WGL_ARB_pixel_format "
/* "WGL_EXT_swap_interval " */
"WGL_EXT_extensions_string";

View File

@@ -0,0 +1,79 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#include "pipe/p_screen.h"
#include "stw_public.h"
#include "stw_device.h"
#include "stw_winsys.h"
#ifdef DEBUG
#include "trace/tr_screen.h"
#include "trace/tr_context.h"
#endif
struct pipe_screen * APIENTRY
wglGetGalliumScreenMESA(void)
{
return stw_dev ? stw_dev->screen : NULL;
}
/* XXX: Unify with stw_create_layer_context */
struct pipe_context * APIENTRY
wglCreateGalliumContextMESA(void)
{
struct pipe_screen *screen = NULL;
struct pipe_context *pipe = NULL;
if(!stw_dev)
return NULL;
screen = stw_dev->screen;
#ifdef DEBUG
/* Unwrap screen */
if(stw_dev->trace_running)
screen = trace_screen(screen)->screen;
#endif
pipe = stw_dev->stw_winsys->create_context( screen );
if (pipe == NULL)
goto no_pipe;
#ifdef DEBUG
/* Wrap context */
if(stw_dev->trace_running)
pipe = trace_context_create(stw_dev->screen, pipe);
#endif
return pipe;
no_pipe:
return NULL;
}

View File

@@ -0,0 +1,47 @@
/**************************************************************************
*
* Copyright 2009 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#ifndef STW_EXTGALLIUM_H_
#define STW_EXTGALLIUM_H_
#include <windows.h>
struct pipe_screen;
struct pipe_context;
struct pipe_screen * APIENTRY
wglGetGalliumScreenMESA(void);
struct pipe_context * APIENTRY
wglCreateGalliumContextMESA(void);
#endif /* STW_EXTGALLIUM_H_ */

View File

@@ -0,0 +1,57 @@
/**************************************************************************
*
* Copyright 2009 VMware, Inc.
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#include <windows.h>
#define WGL_WGLEXT_PROTOTYPES
#include <GL/gl.h>
#include <GL/wglext.h>
#include "util/u_debug.h"
/* A dummy implementation of this 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.
*/
WINGDIAPI BOOL APIENTRY
wglSwapIntervalEXT(int interval)
{
(void) interval;
debug_printf("%s: %d\n", __FUNCTION__, interval);
return TRUE;
}
WINGDIAPI int APIENTRY
wglGetSwapIntervalEXT(void)
{
return 0;
}

View File

@@ -45,6 +45,10 @@
#include "stw_tls.h"
/**
* Search the framebuffer with the matching HWND while holding the
* stw_dev::fb_mutex global lock.
*/
static INLINE struct stw_framebuffer *
stw_framebuffer_from_hwnd_locked(
HWND hwnd )
@@ -52,13 +56,20 @@ stw_framebuffer_from_hwnd_locked(
struct stw_framebuffer *fb;
for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next)
if (fb->hWnd == hwnd)
if (fb->hWnd == hwnd) {
pipe_mutex_lock(fb->mutex);
break;
}
return fb;
}
/**
* Destroy this framebuffer. Both stw_dev::fb_mutex and stw_framebuffer::mutex
* must be held, by this order. Obviously no further access to fb can be done
* after this.
*/
static INLINE void
stw_framebuffer_destroy_locked(
struct stw_framebuffer *fb )
@@ -74,68 +85,24 @@ stw_framebuffer_destroy_locked(
st_unreference_framebuffer(fb->stfb);
pipe_mutex_unlock( fb->mutex );
pipe_mutex_destroy( fb->mutex );
FREE( fb );
}
/**
* @sa http://msdn.microsoft.com/en-us/library/ms644975(VS.85).aspx
* @sa http://msdn.microsoft.com/en-us/library/ms644960(VS.85).aspx
*/
LRESULT CALLBACK
stw_call_window_proc(
int nCode,
WPARAM wParam,
LPARAM lParam )
void
stw_framebuffer_release(
struct stw_framebuffer *fb)
{
struct stw_tls_data *tls_data;
PCWPSTRUCT pParams = (PCWPSTRUCT)lParam;
tls_data = stw_tls_get_data();
if(!tls_data)
return 0;
if (nCode < 0)
return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam);
if (pParams->message == WM_SIZE && pParams->wParam != SIZE_MINIMIZED) {
struct stw_framebuffer *fb;
pipe_mutex_lock( stw_dev->mutex );
fb = stw_framebuffer_from_hwnd_locked( pParams->hwnd );
pipe_mutex_unlock( stw_dev->mutex );
if(fb) {
unsigned width = LOWORD( pParams->lParam );
unsigned height = HIWORD( pParams->lParam );
pipe_mutex_lock( fb->mutex );
fb->must_resize = TRUE;
fb->width = width;
fb->height = height;
pipe_mutex_unlock( fb->mutex );
}
}
if (pParams->message == WM_DESTROY) {
struct stw_framebuffer *fb;
pipe_mutex_lock( stw_dev->mutex );
fb = stw_framebuffer_from_hwnd_locked( pParams->hwnd );
if(fb)
stw_framebuffer_destroy_locked(fb);
pipe_mutex_unlock( stw_dev->mutex );
}
return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam);
assert(fb);
pipe_mutex_unlock( fb->mutex );
}
static void
static INLINE void
stw_framebuffer_get_size( struct stw_framebuffer *fb )
{
unsigned width, height;
@@ -161,10 +128,57 @@ stw_framebuffer_get_size( struct stw_framebuffer *fb )
/**
* Create a new framebuffer object which will correspond to the given HDC.
* @sa http://msdn.microsoft.com/en-us/library/ms644975(VS.85).aspx
* @sa http://msdn.microsoft.com/en-us/library/ms644960(VS.85).aspx
*/
LRESULT CALLBACK
stw_call_window_proc(
int nCode,
WPARAM wParam,
LPARAM lParam )
{
struct stw_tls_data *tls_data;
PCWPSTRUCT pParams = (PCWPSTRUCT)lParam;
struct stw_framebuffer *fb;
tls_data = stw_tls_get_data();
if(!tls_data)
return 0;
if (nCode < 0)
return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam);
if (pParams->message == WM_WINDOWPOSCHANGED) {
/* We handle WM_WINDOWPOSCHANGED instead of WM_SIZE because 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. */
LPWINDOWPOS lpWindowPos = (LPWINDOWPOS)pParams->lParam;
if((lpWindowPos->flags & SWP_SHOWWINDOW) ||
!(lpWindowPos->flags & SWP_NOSIZE)) {
fb = stw_framebuffer_from_hwnd( pParams->hwnd );
if(fb) {
/* Size in WINDOWPOS includes the window frame, so get the size
* of the client area via GetClientRect. */
stw_framebuffer_get_size(fb);
stw_framebuffer_release(fb);
}
}
}
else if (pParams->message == WM_DESTROY) {
pipe_mutex_lock( stw_dev->fb_mutex );
fb = stw_framebuffer_from_hwnd_locked( pParams->hwnd );
if(fb)
stw_framebuffer_destroy_locked(fb);
pipe_mutex_unlock( stw_dev->fb_mutex );
}
return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam);
}
struct stw_framebuffer *
stw_framebuffer_create_locked(
stw_framebuffer_create(
HDC hdc,
int iPixelFormat )
{
@@ -193,8 +207,16 @@ stw_framebuffer_create_locked(
pipe_mutex_init( fb->mutex );
/* This is the only case where we lock the stw_framebuffer::mutex before
* stw_dev::fb_mutex, since no other thread can know about this framebuffer
* and we must prevent any other thread from destroying it before we return.
*/
pipe_mutex_lock( fb->mutex );
pipe_mutex_lock( stw_dev->fb_mutex );
fb->next = stw_dev->fb_head;
stw_dev->fb_head = fb;
pipe_mutex_unlock( stw_dev->fb_mutex );
return fb;
}
@@ -204,8 +226,8 @@ BOOL
stw_framebuffer_allocate(
struct stw_framebuffer *fb)
{
pipe_mutex_lock( fb->mutex );
assert(fb);
if(!fb->stfb) {
const struct stw_pixelformat_info *pfi = fb->pfi;
enum pipe_format colorFormat, depthFormat, stencilFormat;
@@ -241,8 +263,6 @@ stw_framebuffer_allocate(
fb->must_resize = TRUE;
}
pipe_mutex_unlock( fb->mutex );
return fb->stfb ? TRUE : FALSE;
}
@@ -279,32 +299,47 @@ stw_framebuffer_cleanup( void )
struct stw_framebuffer *fb;
struct stw_framebuffer *next;
pipe_mutex_lock( stw_dev->mutex );
pipe_mutex_lock( stw_dev->fb_mutex );
fb = stw_dev->fb_head;
while (fb) {
next = fb->next;
pipe_mutex_lock(fb->mutex);
stw_framebuffer_destroy_locked(fb);
fb = next;
}
stw_dev->fb_head = NULL;
pipe_mutex_unlock( stw_dev->mutex );
pipe_mutex_unlock( stw_dev->fb_mutex );
}
/**
* Given an hdc, return the corresponding stw_framebuffer.
*/
struct stw_framebuffer *
static INLINE struct stw_framebuffer *
stw_framebuffer_from_hdc_locked(
HDC hdc )
{
HWND hwnd;
struct stw_framebuffer *fb;
/*
* Some applications create and use several HDCs for the same window, so
* looking up the framebuffer by the HDC is not reliable. Use HWND whenever
* possible.
*/
hwnd = WindowFromDC(hdc);
if(hwnd)
return stw_framebuffer_from_hwnd_locked(hwnd);
for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next)
if (fb->hDC == hdc)
if (fb->hDC == hdc) {
pipe_mutex_lock(fb->mutex);
break;
}
return fb;
}
@@ -319,9 +354,26 @@ stw_framebuffer_from_hdc(
{
struct stw_framebuffer *fb;
pipe_mutex_lock( stw_dev->mutex );
pipe_mutex_lock( stw_dev->fb_mutex );
fb = stw_framebuffer_from_hdc_locked(hdc);
pipe_mutex_unlock( stw_dev->mutex );
pipe_mutex_unlock( stw_dev->fb_mutex );
return fb;
}
/**
* Given an hdc, return the corresponding stw_framebuffer.
*/
struct stw_framebuffer *
stw_framebuffer_from_hwnd(
HWND hwnd )
{
struct stw_framebuffer *fb;
pipe_mutex_lock( stw_dev->fb_mutex );
fb = stw_framebuffer_from_hwnd_locked(hwnd);
pipe_mutex_unlock( stw_dev->fb_mutex );
return fb;
}
@@ -341,22 +393,19 @@ stw_pixelformat_set(
if (index >= count)
return FALSE;
pipe_mutex_lock( stw_dev->mutex );
fb = stw_framebuffer_from_hdc_locked(hdc);
if(fb) {
/* SetPixelFormat must be called only once */
pipe_mutex_unlock( stw_dev->mutex );
stw_framebuffer_release( fb );
return FALSE;
}
fb = stw_framebuffer_create_locked(hdc, iPixelFormat);
fb = stw_framebuffer_create(hdc, iPixelFormat);
if(!fb) {
pipe_mutex_unlock( stw_dev->mutex );
return FALSE;
}
pipe_mutex_unlock( stw_dev->mutex );
stw_framebuffer_release( fb );
/* Some applications mistakenly use the undocumented wglSetPixelFormat
* function instead of SetPixelFormat, so we call SetPixelFormat here to
@@ -373,13 +422,16 @@ int
stw_pixelformat_get(
HDC hdc )
{
int iPixelFormat = 0;
struct stw_framebuffer *fb;
fb = stw_framebuffer_from_hdc(hdc);
if(!fb)
return 0;
if(fb) {
iPixelFormat = fb->iPixelFormat;
stw_framebuffer_release(fb);
}
return fb->iPixelFormat;
return iPixelFormat;
}
@@ -395,10 +447,10 @@ stw_swap_buffers(
if (fb == NULL)
return FALSE;
if (!(fb->pfi->pfd.dwFlags & PFD_DOUBLEBUFFER))
if (!(fb->pfi->pfd.dwFlags & PFD_DOUBLEBUFFER)) {
stw_framebuffer_release(fb);
return TRUE;
pipe_mutex_lock( fb->mutex );
}
/* If we're swapping the buffer associated with the current context
* we have to flush any pending rendering commands first.
@@ -409,7 +461,7 @@ stw_swap_buffers(
if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT, &surface )) {
/* FIXME: this shouldn't happen, but does on glean */
pipe_mutex_unlock( fb->mutex );
stw_framebuffer_release(fb);
return FALSE;
}
@@ -423,8 +475,7 @@ stw_swap_buffers(
stw_dev->stw_winsys->flush_frontbuffer( screen, surface, hdc );
stw_framebuffer_update(fb);
pipe_mutex_unlock( fb->mutex );
stw_framebuffer_release(fb);
return TRUE;
}

View File

@@ -41,6 +41,23 @@ struct stw_pixelformat_info;
*/
struct stw_framebuffer
{
/**
* This mutex has two purposes:
* - protect the access to the mutable data members below
* - prevent the the framebuffer from being deleted while being accessed.
*
* It is OK to lock this mutex while holding the stw_device::fb_mutex lock,
* but the opposite must never happen.
*/
pipe_mutex mutex;
/*
* Immutable members.
*
* Note that even access to immutable members implies acquiring the mutex
* above, to prevent the framebuffer from being destroyed.
*/
HDC hDC;
HWND hWnd;
@@ -48,7 +65,10 @@ struct stw_framebuffer
const struct stw_pixelformat_info *pfi;
GLvisual visual;
pipe_mutex mutex;
/*
* Mutable members.
*/
struct st_framebuffer *stfb;
/* FIXME: Make this work for multiple contexts bound to the same framebuffer */
@@ -56,15 +76,52 @@ struct stw_framebuffer
unsigned width;
unsigned height;
/** This is protected by stw_device::mutex, not the mutex above */
/**
* This is protected by stw_device::fb_mutex, not the mutex above.
*
* Deletions must be done by first acquiring stw_device::fb_mutex, and then
* acquiring the stw_framebuffer::mutex of the framebuffer to be deleted.
* This ensures that nobody else is reading/writing to the.
*
* It is not necessary to aquire the mutex above to navigate the linked list
* given that deletions are done with stw_device::fb_mutex held, so no other
* thread can delete.
*/
struct stw_framebuffer *next;
};
/**
* Create a new framebuffer object which will correspond to the given HDC.
*
* This function will acquire stw_framebuffer::mutex. stw_framebuffer_release
* must be called when done
*/
struct stw_framebuffer *
stw_framebuffer_create_locked(
stw_framebuffer_create(
HDC hdc,
int iPixelFormat );
/**
* Search a framebuffer with a matching HWND.
*
* This function will acquire stw_framebuffer::mutex. stw_framebuffer_release
* must be called when done
*/
struct stw_framebuffer *
stw_framebuffer_from_hwnd(
HWND hwnd );
/**
* Search a framebuffer with a matching HDC.
*
* This function will acquire stw_framebuffer::mutex. stw_framebuffer_release
* must be called when done
*/
struct stw_framebuffer *
stw_framebuffer_from_hdc(
HDC hdc );
BOOL
stw_framebuffer_allocate(
struct stw_framebuffer *fb );
@@ -73,15 +130,19 @@ void
stw_framebuffer_update(
struct stw_framebuffer *fb);
/**
* Release stw_framebuffer::mutex lock. This framebuffer must not be accessed
* after calling this function, as it may have been deleted by another thread
* in the meanwhile.
*/
void
stw_framebuffer_release(
struct stw_framebuffer *fb);
/**
* Cleanup any existing framebuffers when exiting application.
*/
void
stw_framebuffer_cleanup(void);
struct stw_framebuffer *
stw_framebuffer_from_hdc_locked(
HDC hdc );
struct stw_framebuffer *
stw_framebuffer_from_hdc(
HDC hdc );
#endif /* STW_FRAMEBUFFER_H */

View File

@@ -34,6 +34,7 @@
#include "glapi/glapi.h"
#include "stw_public.h"
#include "stw_extgallium.h"
struct stw_extension_entry
{
@@ -56,6 +57,14 @@ static const struct stw_extension_entry stw_extension_entries[] = {
/* WGL_EXT_extensions_string */
STW_EXTENSION_ENTRY( wglGetExtensionsStringEXT ),
/* WGL_EXT_swap_interval */
STW_EXTENSION_ENTRY( wglGetSwapIntervalEXT ),
STW_EXTENSION_ENTRY( wglSwapIntervalEXT ),
/* WGL_EXT_gallium ? */
STW_EXTENSION_ENTRY( wglGetGalliumScreenMESA ),
STW_EXTENSION_ENTRY( wglCreateGalliumContextMESA ),
{ NULL, NULL }
};
@@ -65,13 +74,13 @@ stw_get_proc_address(
{
const struct stw_extension_entry *entry;
PROC p = (PROC) _glapi_get_proc_address( lpszProc );
if (p)
return p;
if (lpszProc[0] == 'w' && lpszProc[1] == 'g' && lpszProc[2] == 'l')
for (entry = stw_extension_entries; entry->name; entry++)
if (strcmp( lpszProc, entry->name ) == 0)
return entry->proc;
for (entry = stw_extension_entries; entry->name; entry++)
if (strcmp( lpszProc, entry->name ) == 0)
return entry->proc;
if (lpszProc[0] == 'g' && lpszProc[1] == 'l')
return (PROC) _glapi_get_proc_address( lpszProc );
return NULL;
}

View File

@@ -305,6 +305,7 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc,
drm_handle_t hFB;
int junk;
const __DRIconfig **driver_configs;
__GLcontextModes *visual;
/* DRI protocol version. */
dri_version.major = driDpy->driMajor;
@@ -417,6 +418,28 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc,
psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
/* Visuals with depth != screen depth are subject to automatic compositing
* in the X server, so DRI1 can't render to them properly. Mark them as
* non-conformant to prevent apps from picking them up accidentally.
*/
for (visual = psc->visuals; visual; visual = visual->next) {
XVisualInfo template;
XVisualInfo *visuals;
int num_visuals;
long mask;
template.visualid = visual->visualID;
mask = VisualIDMask;
visuals = XGetVisualInfo(dpy, mask, &template, &num_visuals);
if (visuals) {
if (num_visuals > 0 && visuals->depth != DefaultDepth(dpy, scrn))
visual->visualRating = GLX_NON_CONFORMANT_CONFIG;
XFree(visuals);
}
}
return psp;
handle_error:

View File

@@ -401,6 +401,8 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen,
psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
free(driver_configs);
psp->destroyScreen = driDestroyScreen;
psp->createContext = driCreateContext;
psp->createDrawable = driCreateDrawable;

View File

@@ -164,7 +164,7 @@ GetGLXScreenConfigs(Display *dpy, int scrn)
{
__GLXdisplayPrivate * const priv = __glXInitialize(dpy);
return (priv->screenConfigs != NULL) ? &priv->screenConfigs[scrn] : NULL;
return (priv && priv->screenConfigs != NULL) ? &priv->screenConfigs[scrn] : NULL;
}

View File

@@ -152,7 +152,8 @@ static void upload_clip_prog(struct brw_context *brw)
/* _NEW_POLYGON */
if (key.primitive == GL_TRIANGLES) {
if (ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
if (ctx->Polygon.CullFlag &&
ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
key.clip_mode = BRW_CLIPMODE_REJECT_ALL;
else {
GLuint fill_front = CLIP_CULL;

View File

@@ -855,12 +855,10 @@ void brw_math( struct brw_compile *p,
void brw_dp_READ_16( struct brw_compile *p,
struct brw_reg dest,
GLuint msg_reg_nr,
GLuint scratch_offset );
void brw_dp_READ_4( struct brw_compile *p,
struct brw_reg dest,
GLuint msg_reg_nr,
GLboolean relAddr,
GLuint location,
GLuint bind_table_index );
@@ -875,7 +873,6 @@ void brw_dp_READ_4_vs( struct brw_compile *p,
void brw_dp_WRITE_16( struct brw_compile *p,
struct brw_reg src,
GLuint msg_reg_nr,
GLuint scratch_offset );
/* If/else/endif. Works by manipulating the execution flags on each

View File

@@ -865,9 +865,9 @@ void brw_math_16( struct brw_compile *p,
*/
void brw_dp_WRITE_16( struct brw_compile *p,
struct brw_reg src,
GLuint msg_reg_nr,
GLuint scratch_offset )
{
GLuint msg_reg_nr = 1;
{
brw_push_insn_state(p);
brw_set_mask_control(p, BRW_MASK_DISABLE);
@@ -877,7 +877,7 @@ void brw_dp_WRITE_16( struct brw_compile *p,
brw_MOV(p,
retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_D),
brw_imm_d(scratch_offset));
brw_pop_insn_state(p);
}
@@ -912,9 +912,9 @@ void brw_dp_WRITE_16( struct brw_compile *p,
*/
void brw_dp_READ_16( struct brw_compile *p,
struct brw_reg dest,
GLuint msg_reg_nr,
GLuint scratch_offset )
{
GLuint msg_reg_nr = 1;
{
brw_push_insn_state(p);
brw_set_compression_control(p, BRW_COMPRESSION_NONE);
@@ -924,7 +924,7 @@ void brw_dp_READ_16( struct brw_compile *p,
brw_MOV(p,
retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_D),
brw_imm_d(scratch_offset));
brw_pop_insn_state(p);
}
@@ -958,21 +958,26 @@ void brw_dp_READ_16( struct brw_compile *p,
*/
void brw_dp_READ_4( struct brw_compile *p,
struct brw_reg dest,
GLuint msg_reg_nr,
GLboolean relAddr,
GLuint location,
GLuint bind_table_index )
{
/* XXX: relAddr not implemented */
GLuint msg_reg_nr = 1;
{
struct brw_reg b;
brw_push_insn_state(p);
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
brw_set_compression_control(p, BRW_COMPRESSION_NONE);
brw_set_mask_control(p, BRW_MASK_DISABLE);
/* set message header global offset field (reg 0, element 2) */
/* Note that grf[0] will be copied to mrf[1] implicitly by the SEND instr */
brw_MOV(p,
retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_UD),
brw_imm_d(location));
/* Setup MRF[1] with location/offset into const buffer */
b = brw_message_reg(msg_reg_nr);
b = retype(b, BRW_REGISTER_TYPE_UD);
/* XXX I think we're setting all the dwords of MRF[1] to 'location'.
* when the docs say only dword[2] should be set. Hmmm. But it works.
*/
brw_MOV(p, b, brw_imm_ud(location));
brw_pop_insn_state(p);
}
@@ -988,7 +993,7 @@ void brw_dp_READ_4( struct brw_compile *p,
dest = retype(vec8(dest), BRW_REGISTER_TYPE_UW);
brw_set_dest(insn, dest);
brw_set_src0(insn, retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW));
brw_set_src0(insn, brw_null_reg());
brw_set_dp_read_message(insn,
bind_table_index,

View File

@@ -1044,7 +1044,6 @@ static void emit_spill( struct brw_wm_compile *c,
*/
brw_dp_WRITE_16(p,
retype(vec16(brw_vec8_grf(0, 0)), BRW_REGISTER_TYPE_UW),
1,
slot);
}
@@ -1072,7 +1071,6 @@ static void emit_unspill( struct brw_wm_compile *c,
brw_dp_READ_16(p,
retype(vec16(reg), BRW_REGISTER_TYPE_UW),
1,
slot);
}

View File

@@ -294,23 +294,20 @@ static void fetch_constants(struct brw_wm_compile *c,
if (src->File == PROGRAM_STATE_VAR ||
src->File == PROGRAM_CONSTANT ||
src->File == PROGRAM_UNIFORM) {
if (c->current_const[i].index != src->Index) {
c->current_const[i].index = src->Index;
c->current_const[i].index = src->Index;
#if 0
printf(" fetch const[%d] for arg %d into reg %d\n",
src->Index, i, c->current_const[i].reg.nr);
printf(" fetch const[%d] for arg %d into reg %d\n",
src->Index, i, c->current_const[i].reg.nr);
#endif
/* need to fetch the constant now */
brw_dp_READ_4(p,
c->current_const[i].reg, /* writeback dest */
1, /* msg_reg */
src->RelAddr, /* relative indexing? */
16 * src->Index, /* byte offset */
SURF_INDEX_FRAG_CONST_BUFFER/* binding table index */
);
}
/* need to fetch the constant now */
brw_dp_READ_4(p,
c->current_const[i].reg, /* writeback dest */
src->RelAddr, /* relative indexing? */
16 * src->Index, /* byte offset */
SURF_INDEX_FRAG_CONST_BUFFER/* binding table index */
);
}
}
}

View File

@@ -265,7 +265,10 @@ intel_bufferobj_unmap(GLcontext * ctx,
struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
assert(intel_obj);
if (intel_obj->buffer != NULL) {
if (intel_obj->sys_buffer != NULL) {
assert(obj->Pointer);
obj->Pointer = NULL;
} else if (intel_obj->buffer != NULL) {
assert(obj->Pointer);
if (intel_obj->mapped_gtt) {
drm_intel_gem_bo_unmap_gtt(intel_obj->buffer);

View File

@@ -67,7 +67,7 @@ int INTEL_DEBUG = (0);
#endif
#define DRIVER_DATE "20090114"
#define DRIVER_DATE "20090712 2009Q2 RC3"
#define DRIVER_DATE_GEM "GEM " DRIVER_DATE
@@ -537,7 +537,7 @@ intelFinish(GLcontext * ctx)
irb = intel_renderbuffer(fb->_ColorDrawBuffers[i]);
if (irb->region)
if (irb && irb->region)
dri_bo_wait_rendering(irb->region->buffer);
}
if (fb->_DepthBuffer) {

View File

@@ -515,6 +515,7 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb,
irb->Base.BlueBits = texImage->TexFormat->BlueBits;
irb->Base.AlphaBits = texImage->TexFormat->AlphaBits;
irb->Base.DepthBits = texImage->TexFormat->DepthBits;
irb->Base.StencilBits = texImage->TexFormat->StencilBits;
irb->Base.Delete = intel_delete_renderbuffer;
irb->Base.AllocStorage = intel_nop_alloc_storage;

View File

@@ -409,6 +409,12 @@ intel_texture_bitmap(GLcontext * ctx,
return GL_FALSE;
}
if (ctx->Fog.Enabled) {
if (INTEL_DEBUG & DEBUG_FALLBACKS)
fprintf(stderr, "glBitmap() fallback: fog\n");
return GL_FALSE;
}
/* Check that we can load in a texture this big. */
if (width > (1 << (ctx->Const.MaxTextureLevels - 1)) ||
height > (1 << (ctx->Const.MaxTextureLevels - 1))) {

View File

@@ -771,6 +771,11 @@ static void r128DDLightModelfv( GLcontext *ctx, GLenum pname,
FLUSH_BATCH( rmesa );
updateSpecularLighting(ctx);
}
if ( pname == GL_LIGHT_MODEL_TWO_SIDE ) {
FLUSH_BATCH( rmesa );
r128ChooseRenderState( ctx );
}
}
static void r128DDShadeModel( GLcontext *ctx, GLenum mode )

View File

@@ -426,7 +426,7 @@ r128_fallback_point( r128ContextPtr rmesa,
#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
#define _R128_NEW_RENDER_STATE (ANY_FALLBACK_FLAGS | ANY_RASTER_FLAGS)
static void r128ChooseRenderState(GLcontext *ctx)
void r128ChooseRenderState(GLcontext *ctx)
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
GLuint flags = ctx->_TriangleCaps;

View File

@@ -38,7 +38,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/mtypes.h"
extern void r128InitTriFuncs( GLcontext *ctx );
extern void r128ChooseRenderState( GLcontext *ctx );
extern void r128Fallback( GLcontext *ctx, GLuint bit, GLboolean mode );
#define FALLBACK( rmesa, bit, mode ) r128Fallback( rmesa->glCtx, bit, mode )

View File

@@ -283,12 +283,12 @@ radeonFillInModes( __DRIscreenPrivate *psp,
* with a stencil buffer. It will be a sw fallback, but some apps won't
* care about that.
*/
stencil_bits_array[0] = 0;
stencil_bits_array[0] = stencil_bits;
stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits;
msaa_samples_array[0] = 0;
depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1;
depth_buffer_factor = (stencil_bits == 0) ? 2 : 1;
back_buffer_factor = (have_back_buffer) ? 2 : 1;
if (pixel_bits == 16) {

View File

@@ -110,6 +110,29 @@ const char *_mesa_lookup_enum_by_nr( int nr )
}
}
/* Get the name of an enum given that it is a primitive type. Avoids
* GL_FALSE/GL_POINTS ambiguity and others.
*/
const char *_mesa_lookup_prim_by_nr( int nr )
{
switch (nr) {
case GL_POINTS: return "GL_POINTS";
case GL_LINES: return "GL_LINES";
case GL_LINE_STRIP: return "GL_LINE_STRIP";
case GL_LINE_LOOP: return "GL_LINE_LOOP";
case GL_TRIANGLES: return "GL_TRIANGLES";
case GL_TRIANGLE_STRIP: return "GL_TRIANGLE_STRIP";
case GL_TRIANGLE_FAN: return "GL_TRIANGLE_FAN";
case GL_QUADS: return "GL_QUADS";
case GL_QUAD_STRIP: return "GL_QUAD_STRIP";
case GL_POLYGON: return "GL_POLYGON";
case GL_POLYGON+1: return "OUTSIDE_BEGIN_END";
default: return "<invalid>";
}
}
int _mesa_lookup_enum_by_name( const char *symbol )
{
enum_elt * f = NULL;

View File

@@ -849,7 +849,6 @@ pop_texture_group(GLcontext *ctx, struct texture_state *texstate)
/* Restore texture object state for each target */
for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) {
const struct gl_texture_object *obj = NULL;
GLfloat bordColor[4];
GLenum target;
obj = &texstate->SavedObj[u][tgt];
@@ -875,12 +874,7 @@ pop_texture_group(GLcontext *ctx, struct texture_state *texstate)
_mesa_BindTexture(target, obj->Name);
bordColor[0] = CHAN_TO_FLOAT(obj->BorderColor[0]);
bordColor[1] = CHAN_TO_FLOAT(obj->BorderColor[1]);
bordColor[2] = CHAN_TO_FLOAT(obj->BorderColor[2]);
bordColor[3] = CHAN_TO_FLOAT(obj->BorderColor[3]);
_mesa_TexParameterfv(target, GL_TEXTURE_BORDER_COLOR, bordColor);
_mesa_TexParameterfv(target, GL_TEXTURE_BORDER_COLOR, obj->BorderColor);
_mesa_TexParameterf(target, GL_TEXTURE_PRIORITY, obj->Priority);
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, obj->WrapS);
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, obj->WrapT);

View File

@@ -957,6 +957,20 @@ save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
}
}
static void invalidate_saved_current_state( GLcontext *ctx )
{
GLint i;
for (i = 0; i < VERT_ATTRIB_MAX; i++)
ctx->ListState.ActiveAttribSize[i] = 0;
for (i = 0; i < MAT_ATTRIB_MAX; i++)
ctx->ListState.ActiveMaterialSize[i] = 0;
memset(&ctx->ListState.Current, 0, sizeof ctx->ListState.Current);
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
}
void GLAPIENTRY
_mesa_save_CallList(GLuint list)
@@ -970,9 +984,10 @@ _mesa_save_CallList(GLuint list)
n[1].ui = list;
}
/* After this, we don't know what begin/end state we're in:
/* After this, we don't know what state we're in. Invalidate all
* cached information previously gathered:
*/
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
invalidate_saved_current_state( ctx );
if (ctx->ExecuteFlag) {
_mesa_CallList(list);
@@ -1015,9 +1030,10 @@ _mesa_save_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
}
}
/* After this, we don't know what begin/end state we're in:
/* After this, we don't know what state we're in. Invalidate all
* cached information previously gathered:
*/
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
invalidate_saved_current_state( ctx );
if (ctx->ExecuteFlag) {
CALL_CallLists(ctx->Exec, (n, type, lists));
@@ -3177,14 +3193,26 @@ save_ShadeModel(GLenum mode)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx);
if (ctx->ExecuteFlag) {
CALL_ShadeModel(ctx->Exec, (mode));
}
if (ctx->ListState.Current.ShadeModel == mode)
return;
SAVE_FLUSH_VERTICES(ctx);
/* Only save the value if we know the statechange will take effect:
*/
if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END)
ctx->ListState.Current.ShadeModel = mode;
n = ALLOC_INSTRUCTION(ctx, OPCODE_SHADE_MODEL, 1);
if (n) {
n[1].e = mode;
}
if (ctx->ExecuteFlag) {
CALL_ShadeModel(ctx->Exec, (mode));
}
}
@@ -5146,14 +5174,21 @@ save_EdgeFlag(GLboolean x)
save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? (GLfloat)1.0 : (GLfloat)0.0);
}
static INLINE GLboolean compare4fv( const GLfloat *a,
const GLfloat *b,
GLuint count )
{
return memcmp( a, b, count * sizeof(GLfloat) ) == 0;
}
static void GLAPIENTRY
save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
int args, i;
SAVE_FLUSH_VERTICES(ctx);
GLuint bitmask;
switch (face) {
case GL_BACK:
@@ -5183,6 +5218,36 @@ save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
_mesa_compile_error(ctx, GL_INVALID_ENUM, "material(pname)");
return;
}
if (ctx->ExecuteFlag) {
CALL_Materialfv(ctx->Exec, (face, pname, param));
}
bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL);
/* Try to eliminate redundant statechanges. Because it is legal to
* call glMaterial even inside begin/end calls, don't need to worry
* about ctx->Driver.CurrentSavePrimitive here.
*/
for (i = 0; i < MAT_ATTRIB_MAX; i++) {
if (bitmask & (1 << i)) {
if (ctx->ListState.ActiveMaterialSize[i] == args &&
compare4fv(ctx->ListState.CurrentMaterial[i], param, args)) {
bitmask &= ~(1 << i);
}
else {
ctx->ListState.ActiveMaterialSize[i] = args;
COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param);
}
}
}
/* If this call has effect, return early:
*/
if (bitmask == 0)
return;
SAVE_FLUSH_VERTICES(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_MATERIAL, 6);
if (n) {
@@ -5191,19 +5256,6 @@ save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
for (i = 0; i < args; i++)
n[3 + i].f = param[i];
}
{
GLuint bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL);
for (i = 0; i < MAT_ATTRIB_MAX; i++)
if (bitmask & (1 << i)) {
ctx->ListState.ActiveMaterialSize[i] = args;
COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param);
}
}
if (ctx->ExecuteFlag) {
CALL_Materialfv(ctx->Exec, (face, pname, param));
}
}
static void GLAPIENTRY
@@ -6771,7 +6823,6 @@ void GLAPIENTRY
_mesa_NewList(GLuint name, GLenum mode)
{
GET_CURRENT_CONTEXT(ctx);
GLint i;
FLUSH_CURRENT(ctx, 0); /* must be called before assert */
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -6799,20 +6850,15 @@ _mesa_NewList(GLuint name, GLenum mode)
ctx->CompileFlag = GL_TRUE;
ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
/* Reset acumulated list state:
*/
invalidate_saved_current_state( ctx );
/* Allocate new display list */
ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
ctx->ListState.CurrentPos = 0;
/* Reset acumulated list state:
*/
for (i = 0; i < VERT_ATTRIB_MAX; i++)
ctx->ListState.ActiveAttribSize[i] = 0;
for (i = 0; i < MAT_ATTRIB_MAX; i++)
ctx->ListState.ActiveMaterialSize[i] = 0;
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
ctx->Driver.NewList(ctx, name, mode);
ctx->CurrentDispatch = ctx->Save;

View File

@@ -948,8 +948,8 @@ LONGSTRING static const char enum_string_table[] =
"GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV\0"
"GL_MAX_VARYING_FLOATS\0"
"GL_MAX_VARYING_FLOATS_ARB\0"
"GL_MAX_VERTEX_GENERIC_ATTRIBS\0"
"GL_MAX_VERTEX_GENERIC_ATTRIBS_ARB\0"
"GL_MAX_VERTEX_ATTRIBS\0"
"GL_MAX_VERTEX_ATTRIBS_ARB\0"
"GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS\0"
"GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB\0"
"GL_MAX_VERTEX_UNIFORM_COMPONENTS\0"
@@ -2772,8 +2772,8 @@ static const enum_elt all_enums[1820] =
{ 19417, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */
{ 19452, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */
{ 19474, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */
{ 19500, 0x00008869 }, /* GL_MAX_VERTEX_GENERIC_ATTRIBS */
{ 19522, 0x00008869 }, /* GL_MAX_VERTEX_GENERIC_ATTRIBS_ARB */
{ 19500, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */
{ 19522, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */
{ 19548, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
{ 19582, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
{ 19620, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
@@ -4733,7 +4733,7 @@ static const unsigned reduced_enums[1319] =
317, /* GL_CURRENT_QUERY */
1259, /* GL_QUERY_RESULT */
1261, /* GL_QUERY_RESULT_AVAILABLE */
912, /* GL_MAX_VERTEX_GENERIC_ATTRIBS */
912, /* GL_MAX_VERTEX_ATTRIBS */
1778, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
368, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
367, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
@@ -5059,6 +5059,29 @@ const char *_mesa_lookup_enum_by_nr( int nr )
}
}
/* Get the name of an enum given that it is a primitive type. Avoids
* GL_FALSE/GL_POINTS ambiguity and others.
*/
const char *_mesa_lookup_prim_by_nr( int nr )
{
switch (nr) {
case GL_POINTS: return "GL_POINTS";
case GL_LINES: return "GL_LINES";
case GL_LINE_STRIP: return "GL_LINE_STRIP";
case GL_LINE_LOOP: return "GL_LINE_LOOP";
case GL_TRIANGLES: return "GL_TRIANGLES";
case GL_TRIANGLE_STRIP: return "GL_TRIANGLE_STRIP";
case GL_TRIANGLE_FAN: return "GL_TRIANGLE_FAN";
case GL_QUADS: return "GL_QUADS";
case GL_QUAD_STRIP: return "GL_QUAD_STRIP";
case GL_POLYGON: return "GL_POLYGON";
case GL_POLYGON+1: return "OUTSIDE_BEGIN_END";
default: return "<invalid>";
}
}
int _mesa_lookup_enum_by_name( const char *symbol )
{
enum_elt * f = NULL;

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