Compare commits

..

144 Commits

Author SHA1 Message Date
Brian Paul
7d3af894d6 docs: point to fd.o for downloads instead of SourceForge 2009-09-03 15:44:49 -06:00
Brian Paul
32156f3a11 gallium/xlib: silence unitialized var warning 2009-09-03 15:44:22 -06:00
Brian Paul
1c32caf075 gallium/xlib: silence uninitialized var warning 2009-09-03 15:23:15 -06:00
Brian Paul
67c286d20e st/mesa: silence uninitialized var warnings 2009-09-03 15:04:49 -06:00
Brian Paul
0b4e835b13 docs: prep for 7.5.1 release 2009-09-03 14:57:30 -06:00
Brian Paul
08575509e4 docs: added news entry for 7.5.1 2009-09-03 14:57:16 -06:00
Brian Paul
ccb081414b docs: update precompiled libs info 2009-09-03 14:57:04 -06:00
Brian Paul
47df7900fd docs: move SGI GLU link 2009-09-03 14:56:50 -06:00
Brian Paul
c3a0624ef0 st/mesa: fix glCopyPixels(GL_STENCIL_INDEX) inverted position
If the renderbuffer orientation is Y=0=TOP we need to invert the dstY
position.
2009-09-03 14:39:53 -06:00
Keith Whitwell
e79054cc40 st/mesa: Do GL_RGBA->GL_RGB texsubimage on hardware
State tracker currently backs GL_RGB textures with RGBA almost always.
This means we need to maintain A==1 in these textures to give correct GL_RGB
sampling results.

This change offloads the RGBA->RGB copy to hardware using the new writemask
version of u_blit_pixels.

More src/dstLogical/dstActual triples could be shifted to hardware by
this technique in future patches.
2009-09-02 18:31:48 +01:00
Keith Whitwell
de343680a3 util: add version of u_blit_pixels which takes a writemask
Values outside the writemask are set in the destination to {0,0,0,1}
2009-09-02 18:31:48 +01:00
Keith Whitwell
1d7a989b10 draw: remove unused variable 2009-09-02 18:31:47 +01:00
Brian Paul
d9b7d7875b progs/tests: re-enable exit() call
See bug 21267.
2009-09-01 08:53:34 -06:00
Brian Paul
3f785080db swrast: fix selection/feedback regression
This fixes a conform selection/feedback regression introduced by commit
8f4d66c5f8
2009-08-31 17:54:46 -06:00
Brian Paul
fcf0804c05 swrast: can't use deferred texture/shading if using KIL instruction
If the fragment program uses KIL, we have to execute it before z/stencil
testing.  Otherwise, deferred texture/shading lets us skip shading for
pixels that fail z/stencil testing.
2009-08-31 13:28:31 -06:00
Brian Paul
9f36473a8e mesa: added const qualifiers, move local var 2009-08-31 11:17:59 -06:00
Brian Paul
2241665dc6 mesa: fix saturation logic in emit_texenv()
We need to clamp/saturate after each texenv stage, not just the last one.
Fixes glean texEnv failure for softpipe (and probably other fragment program-
based drivers).
2009-08-31 11:14:16 -06:00
Brian Paul
6bf86681f5 docs: fixed glXCreateGLXPixmap() for direct rendering 2009-08-31 10:32:56 -06:00
Brian Paul
f7654faf16 docs/: document cross-compile fix 2009-08-31 10:32:14 -06:00
Marc Dietrich
a48ee529a2 mesa: fix 32bit cross compilation on a 64bit machine
When cross compiling on a 64bit machine, gen_matypes.c is build
for the host machine (64bit) but must generates code for the target
machine (32bit). This causes wrong offsets all over the place and
crashes googleearth on my machine. Solution is to add -m32 when
cross compiling.

Attached patch is compatible with linux-x86-32 and autoconf based
builds.
2009-08-31 10:32:14 -06:00
Michel Dänzer
edb1178798 glx/x11: Fix glXCreateGLXPixmap for direct rendering.
Fixes progs/xdemos/glxpixmap modified to use direct rendering.
2009-08-30 12:53:00 +02:00
José Fonseca
9399b9a0e2 util: Reset size to zero when failed to allocate buffer. 2009-08-28 12:52:31 +01:00
Brian Paul
0d7bed9f89 docs: fix selection/feedback culling bug 2009-08-27 16:50:44 -06:00
Brian Paul
8f4d66c5f8 swrast: fix incorrect tri culling in selection/feedback mode.
See bug 16866.
2009-08-27 16:50:03 -06:00
marvin24
43a064e06d mesa: direct program debug output to stderr instead of stdout 2009-08-27 09:22:51 -06:00
Brian Paul
32f95f8c17 gallium/util: added support for SRGB formats
Fixes glean/texture_srgb failure, bug #23449.
2009-08-27 09:10:38 -06:00
Brian Paul
f8ae968d28 gallium/util: added cases for SRGB formats 2009-08-27 09:09:56 -06:00
Brian Paul
babb5ba9a9 glsl: signal that the program needs to be re-translated when samplers change 2009-08-26 14:29:50 -06:00
Brian Paul
d09d03aa42 docs: document sampler array bug fix 2009-08-26 12:04:35 -06:00
Brian Paul
488b3c4d1b progs/glsl: add special Makefile rule for samplers_array 2009-08-26 11:55:15 -06:00
Brian Paul
f6d34c2058 progs/glsl: change samplers.c to better test sampler/texture indexing
Now the left half is yellow and the right half is red, with the gradients
going in opposite directions.
2009-08-26 11:53:25 -06:00
Brian Paul
04d170794a glsl: fix bug in sampler array indexing
Need to add the 'offset' parameter when indexing the parameter array.
Before, if we were setting arrays of samplers, we were actually only
setting the 0th sampler's value.

Because of how progs/glsl/samplers.c is constructed, this wasn't showing
up as a failure in the samplers_array output.
2009-08-26 11:39:31 -06:00
Brian Paul
bf7e4b10cb ARB prog: Set error instead of falling through with incorrect value
If a fragment program only parameter was queried of a vertex program
(e.g., GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB) no error would be set and
a random value would be returned.  This caused 'glxinfo -l' to show
the same values for GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB,
GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB, GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB,
GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB,
GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB,
GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB as for
GL_MAX_PROGRAM_ENV_PARAMETERS_ARB.  This is confusing and incorrect.

(cherry picked from master, commit 4bccd693a7)
2009-08-24 13:56:01 -06:00
Brian Paul
96f7b42242 docs: recent 7.5.1 bug fixes 2009-08-24 13:02:33 -06:00
Brian Paul
b5ecbbe636 xlib: fix single buffer window resize bug
When a single-buffered window was resized the new window size was never
detected.  This fix that, but there's still a bug which causes window
contents corruption for certain window sizes...
2009-08-24 12:58:49 -06:00
Brian Paul
b9b04872d5 vbo: fix divide by zero exception
Fixes bug 23489.
2009-08-24 12:44:00 -06:00
Vinson Lee
f785b35b47 glsl: Silence gcc uninitialized variable warning. 2009-08-24 11:43:02 -06:00
Brian Paul
1aba1baa62 st/mesa: flush bitmap cache if Z value changes
When adding a new bitmap to the cache we have to check if the Z value is
changing and flush first if it is.

This is a modified version of a patch from Justin Dou <justin.dou@intel.com>
2009-08-21 10:24:50 -06:00
Brian Paul
ce723d8d8b tgsi: check for SOA dependencies in SSE and PPC code generators
Fall back to interpreter for now.  This doesn't happen very often.
2009-08-20 10:34:45 -06:00
Brian Paul
4c7c294fff tgsi: handle SOA dependencies for MOV/SWZ
SOA dependencies can happen when a register is used both as a source and
destination and the source is swizzled.  For example:

MOV T, T.yxwz; would expand into:

  MOV t0, t1;
  MOV t1, t0;
  MOV t2, t3;
  MOV t3, t2;

The second instruction will produce the wrong result since we wrote to t0
in the first instruction.  We need to use an intermediate temporary to fix
this.

This will take more work to fix for all TGSI instructions.  This seems to
happen with MOV instructions more than anything else so fix that case now
and warn on others.

Fixes piglit glsl-vs-loop test (when not using SSE). See bug 23317.
2009-08-20 10:28:22 -06:00
Brian Paul
5e6d21afa4 tgsi: added tgsi_full_instruction::Flags field
Users of the parser can make use of this.
2009-08-20 10:25:55 -06:00
Brian Paul
3097d7dbf8 tgsi/ppc: we don't implement saturation modes yet 2009-08-18 17:50:52 -06:00
Brian Paul
fab17c1216 tgsi/sse: we don't implement saturation modes yet
Fixes piglit fp-generic tests/shaders/generic/lrp_sat.fp, bug 23316.
2009-08-18 17:50:00 -06:00
Brian Paul
ee0984e299 mesa: when emitting vertex program fog, set yzw=0,0,1
Fixes piglit fp-fog failure with gallium.
2009-08-18 17:39:55 -06:00
Brian Paul
e8957f4800 progs/demos: print more info in fbotexture.c 2009-08-14 17:30:32 -06:00
José Fonseca
e3bc1fb6bc gallium: Always map for READ flag when DISCARD is not set.
This prevents the driver from discarding a buffer when the whole buffer
is mapped for writing, but only a portion is effectively written.

This is a temporary fix, because WRITE shouldn't imply DISCARD.

The full fix implies using PIPE_BUFFER_USAGE_DISCARD, throughout
the code, and will go only into master.
2009-08-14 20:05:51 +01:00
José Fonseca
10430f47a4 trace: Remove space next to the class attribute of the trace. 2009-08-14 20:05:51 +01:00
José Fonseca
cdf56eb68d python/retrace: Open bz2 files correctly. 2009-08-14 20:05:51 +01:00
Brian Paul
1574b05189 docs: docs: document new --with-max-width/height config options 2009-08-14 11:24:20 -06:00
Brian Paul
a7ca80ff6a Add a FAQ about internal buffer sizes.
(cherry picked from master, commit 9a8781bd24)
2009-08-14 11:23:18 -06:00
Brian Paul
467b3d9a6f Add configure options for MAX_WIDTH/HEIGHT.
This adds two --with configure options for setting defines for
MAX_WIDTH and MAX_HEIGHT.  It's conceivably just as easy to define
these in CFLAGS manually, but this way users don't need to know
about internal Mesa details.

Patch updated by BrianP to set DEFINES, not CFLAGS.

(cherry picked from master, commit 7085dce750)
2009-08-14 11:23:00 -06:00
Brian Paul
e691b0e533 Allow external settings of MAX_WIDTH/HEIGHT.
Conditionalize MAX_WIDTH / MAX_HEIGHT defines so that users can
set them via CFLAGS.

(cherry picked from master, commit 66bc17e80e)
2009-08-14 11:22:37 -06:00
Brian Paul
3ffaa11f88 mesa: move assertions in test_attachment_completeness()
Put the assertions after the error checks.
2009-08-14 10:30:10 -06:00
Brian Paul
1e0f621b50 mesa: fix some invalid memory reads
We were passing the address of a float to functions that would deref the
pointer as an array.
2009-08-13 14:38:27 -06:00
Brian Paul
6d55fd705d progs/tests: hack a PBO/dlist test 2009-08-13 14:07:25 -06:00
Brian Paul
ecb177eaea mesa: fix warnings about locals hiding function params 2009-08-13 14:05:52 -06:00
Brian Paul
36df6a6e91 mesa: add missing PBO mapping code in unpack_image() 2009-08-13 14:00:21 -06:00
Brian Paul
ad8a6937ae main: fix some potential memory leaks
Allocate dlist images after error checking.
Record GL_OUT_OF_MEMORY when we can't make a copy of an image.
2009-08-13 13:48:36 -06:00
Brian Paul
f418d18ea6 mesa: fix some potential uninitialized memory references 2009-08-13 13:44:31 -06:00
Brian Paul
a531a5cf94 glsl: fix some uninitialized pointers 2009-08-13 13:44:01 -06:00
Keith Whitwell
1ce3f5a806 draw: cope with more primitives in draw_pipeline_run
This previously was used only for decomposed (POINT/LINE/TRI) primitives,
but for some time a full range of primitives could end up in here.

Fixes trivial/lineloop-clip on softpipe, among others.
(cherry picked from commit 87cd8a3b8a2407b30916be418ff2f95dfea5d2ad)
2009-08-13 15:56:17 +01:00
Pauli Nieminen
d80b36f64f dri: Fix problems with unitialized values in dri screen object.
This fixes crash in r200 KMS driver when pSAREA was set to 1 randomly because of memory wasn't cleared.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-07 11:24:47 -06:00
Brian Paul
9676ed27fe util: fix incorrect assertion
Check that the dest surface/format is renderable.
2009-08-06 14:58:06 -06:00
Brian Paul
98f00e8eb9 util: include u_surface.h, added comment 2009-08-06 14:54:25 -06:00
Brian Paul
24fdf8aadb util: use util_same_surface() to compare surface pointers 2009-08-06 09:47:13 -06:00
Brian Paul
ffb1f9bded util: added util_same_surface() helper function 2009-08-06 09:47:13 -06:00
Alan Hourihane
8c223e8eb6 Ensure GL_EXT_blend_equation_separate is enabled when 2.0 is enabled. 2009-08-06 16:16:55 +01:00
Brian Paul
5b3428d745 docs:fix glBlitFramebuffer() for Gallium 2009-08-05 13:50:21 -06:00
Brian Paul
a59579c983 st/mesa: implement BlitFramebuffer() for depth/stencil (incomplete)
We now handle the case of blitting Z+stencil to/from combined Z/stencil
surfaces.  But Z-only or stencil-only and separate depth/stencil surfaces
are not yet implemented.
2009-08-05 13:46:47 -06:00
Brian Paul
dcebe220f4 mesa: generate GL_INVALID_OPERATION for missing z/stencil when blitting
If glBlitFramebuffer() is called with GL_DEPTH_BUFFER_BIT or
GL_STENCIL_BUFFER_BIT and the src/dst depth/stencil buffers are absent,
report an error.
2009-08-05 13:44:59 -06:00
Brian Paul
f792137593 st/mesa: fix Y inversion and optimize st_BlitFramebuffer()
Need to check for Y inversion separately for src/dest buffers.

If both the src and dest regions are upside down, make them right-side
up for a better chance at a fast path.

progs/tests/copypixrate -blit is much faster now.
2009-08-05 13:26:19 -06:00
Brian Paul
2cd33afa00 util: added comment/question about blit clipping 2009-08-05 13:22:26 -06:00
Brian Paul
727b2d747e mesa: make _mesa_clip_blit() a shared function 2009-08-05 13:21:59 -06:00
Brian Paul
4f36164024 util: added util_blit_pixels() overlap test
A comment alluded to this.  Now it's checked.
2009-08-05 13:19:03 -06:00
Brian Paul
05d393f59f util: fix util_blit_pixels() test for surface_copy() path
For the surface_copy() path require same format, no flipping and no stretching.

Fixes progs/tests/copypixrate -blit
2009-08-05 13:09:15 -06:00
Brian Paul
854ea483d4 util: reformatting and comments 2009-08-05 13:08:19 -06:00
Brian Paul
3a221a9018 docs: 7.5.1 bug fixes 2009-08-04 09:27:49 -06:00
Brian Paul
61673aebb0 intel: Fix inverted test for disabling flushing of front buffer output.
The comment disagreed with the code, and nicely drew my eyes to what was
going wrong.

Bug #21774 (blender)
Bug #21788 (readpix)

(cherry picked from master, commit fd65418f60)
2009-08-04 09:23:17 -06:00
Brian Paul
f5f8be8bb2 intel: Wait on the last swapbuffers to complete before queuing a new one.
This fixes jerkiness in doom3 and other apps since the kernel change to
throttle less absurdly, which led to a thundering herd of frames.

Because this is a rather minimal fix, there is at least one downside: If
the whole scene completes in one batchbuffer, we'll end up stalling the GPU.

Thanks to Michel Dänzer for suggesting using glFlush to signal frame end
instead of going to all the effort of adding a new DRI2 extension.

(cherry picked from master, commit 0828579a65)
2009-08-04 09:22:15 -06:00
Brian Paul
2bec909c69 texenv: Use VP->Current, since _Current isn't updated at this point.
(cherry picked from master, commit a9ba1bfeb3)
2009-08-04 09:15:33 -06:00
Brian Paul
f0df08abbe texenv: Match state.c in deciding whether we'll be using a vertex shader.
(cherry picked from master, commit 40990d9dfb)
2009-08-04 09:15:09 -06:00
Brian Paul
9d3929b60c texenv: Add missing dependency on VP changes.
Funny thing is I annotated this dependency in
e5f63c403b, but didn't actually use it.

(cherry picked from master, commit 03187571b6)

Conflicts:
	src/mesa/main/state.c
2009-08-04 09:14:33 -06:00
Dan Nicholson
9185a61c8a mklib: Ensure target directory exists for library
Instead of relying on the Makefile to always generate $(TOP)/$(LIB_DIR),
just have mklib handle creating the directory. This should fix any races
when using parallel make.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
(cherry picked from commit 23671e5358)
2009-08-04 06:30:46 -07:00
Peter Hutterer
0ce73f84e9 Add missing X11_INCLUDES to egl/drivers/demo and egl/main.
Compiling mesa on a system with no X headers installed in the default
include paths fails due to missing X11 includes. The header includes are
picked up by configure but not applied.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 5358e54d1a)
2009-08-04 06:30:30 -07:00
Pauli Nieminen
fb7cf731f9 xdemo/glxswapcontrol: Move get_framge_usage after the swap.
This fixes the problem that first frame would report bogus usage values.
Problem was caused because get_frame_usage returned data from previous buffer
swap.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-03 13:42:05 -06:00
Pauli Nieminen
b59eb3b8b1 xdemos/glxcontexts: Don't leak visual info when choosing visual again.
Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-03 11:55:29 -06:00
Brian Paul
ed6125fe9b st/mesa: we don't support GL_NV_point_sprite (see comment) 2009-08-03 11:16:23 -06:00
Brian Paul
35e3449ad7 mesa: move misplaced return statement
Fixes regression from commit 7d93f817c9
2009-07-30 09:02:36 -06:00
Brian Paul
7d93f817c9 mesa: add missing return after catching program error 2009-07-30 08:23:26 -06:00
Keith Whitwell
6842829539 mesa/st: short-circuit glFinish calls on WIN32 only
Windows opengl32.dll calls glFinish prior to every swapbuffers, which
makes it pretty hard to get decent performance...

Work around by mapping finish to flush on PIPE_OS_WINDOWS.  This is
conformant, though it might confuse poorly-written benchmarks which
attempt to measure a single event rather than figuring out the rate of
continuous processing.
2009-07-29 12:48:05 +01:00
Keith Whitwell
2420b283b7 mesa/st: recognize no-op scissor state when checking clear_with_quads
Some apps enable scissor but set the rectangle to the dimensions of
the window.  Don't let this force us onto a slower clear path.
2009-07-29 12:48:04 +01:00
Keith Whitwell
4d99e14535 util: _debug_printf should print even when DEBUG is not defined
The leading underscore is meaningful...  This function is used by
_warning and _error functions as well as the more common
debug_printf().

debug_printf (without underscore) gets turned off when DEBUG is
disabled, but warning/error messages still use this function to get
their message out.
(cherry picked from commit 0ac879dca7)
2009-07-29 12:48:04 +01:00
RALOVICH, Kristóf
45f4e8842e glx: assign per screen driver configs (DRISW) 2009-07-28 10:35:56 -06:00
RALOVICH, Kristóf
d090ba9e00 glx: assign per screen driver configs (DRI) 2009-07-28 10:35:56 -06:00
RALOVICH, Kristóf
82f4dc21cc glx: assign per screen driver configs (DRI2) 2009-07-28 10:35:56 -06:00
RALOVICH, Kristóf
e32b601e7d glx: properly release DRI configs
Release per screen DRI driver configs during screen destruction.
2009-07-28 10:35:56 -06:00
RALOVICH, Kristóf
ce0ad53281 glx: cache DRI configs in __GLXscreenConfigsRec 2009-07-28 10:35:56 -06:00
Vinson Lee
bc60b88411 progs/trivial: add missing files to Makefile, .gitignore 2009-07-28 08:54:48 -06:00
Brian Paul
3dbaf68bdc intel: Fix leak of DRI option info due to using the wrong free routine.
(cherry picked from commit 6d66f23c50)
2009-07-27 15:33:07 -06:00
Brian Paul
722d136f7b intel: Clean up leak of driver context structure on context destroy.
(cherry picked from commit ddef7dc87b)
2009-07-27 15:33:07 -06:00
Brian Paul
a7427b0f7b st/mesa: silence warning 2009-07-27 15:10:28 -06:00
Brian Paul
0ad9eba333 mesa: separate some finite/pragma Watcom stuff 2009-07-27 15:10:00 -06:00
Brian Paul
7e2f26cbbf softpipe: include sp_winsys.h to silence function prototype warning 2009-07-27 15:08:44 -06:00
Brian Paul
d2f56fe687 intel: Use _mesa_warning() to report GEM warnings 2009-07-27 14:35:18 -06:00
Karl Schultz
09ef339b69 windows: updated VC8 project files
See bug 22882.
2009-07-27 13:38:35 -06:00
Brian Paul
25e371fb7b docs: 7.5 tarball md5sums 2009-07-27 13:27:54 -06:00
José Fonseca
5276b049b4 util: fix typo. 2009-07-26 20:31:59 +01:00
Brian Paul
c57d81ddc9 mesa: include glew headers in MesaDemos tarballs 2009-07-23 20:20:39 -06:00
Brian Paul
b4ba6a66b7 docs: initial release notes for 7.5.1 2009-07-22 12:49:34 -06:00
Brian Paul
9c4b877519 mesa: bump version to 7.5.1 2009-07-22 12:46:53 -06:00
Brian Paul
b9e2e32daf mesa: include GLEW sources in MesaDemos tarball 2009-07-22 12:34:07 -06: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
Brian Paul
cd10996d4f progs/util: remove extfuncs.h (we use GLEW instead) 2009-07-17 14:43:29 -06:00
Brian Paul
ee0b1bc7d3 progs/glsl: finish conversion to GLEW
This is a follow-on to b799af91d5.
Remove _func function suffix and unneeded #includes.
2009-07-17 13:23:11 -06:00
Brian Paul
a77b455af0 mesa: set version to 7.5 2009-07-17 12:40:48 -06:00
Brian Paul
71b9e10291 mesa: set version to 7.5 2009-07-17 12:40:44 -06:00
Brian Paul
7fd3674672 docs: set date for 7.5 release 2009-07-17 12:40:24 -06:00
Brian Paul
27587f46e5 docs: news entry for 7.5 release 2009-07-17 09:40:59 -06:00
Brian Paul
8c6e81f97d docs: update links to Gallium wiki page on freedesktop.org 2009-07-17 09:40:59 -06:00
José Fonseca
2ba98efdf6 python/retrace: Process the call no passed to --to option inclusively. 2009-07-16 19:34:44 +01:00
José Fonseca
cf7e8fbc2e python/retrace: Dump the surface copy contents. 2009-07-16 19:32:40 +01:00
José Fonseca
5807ccb41b python/retrace: Flush stdout before calling the pipe driver.
So that messages are in sync with stderr.
2009-07-16 19:31:36 +01:00
José Fonseca
d4e6df9ab6 mesa: Fix logbase2.
It was providing 1 too many for non power two values.
2009-07-16 19:20:25 +01:00
José Fonseca
0c4350790a python: Hack to prevent segmentation faults when python exits. 2009-07-16 11:22:56 +01:00
José Fonseca
4e1e18a772 wgl: Expose pipe_screen/pipe_context via an extension. 2009-07-16 11:22:56 +01:00
José Fonseca
3ab3209a1f python: Obtain pipe_screen/pipe_context from the system's OpenGL driver. 2009-07-16 11:22:56 +01:00
Luca Barbieri
6b7b13b5eb softpipe: limit blend results to [0,1] 2009-07-15 11:34:36 -06:00
Brian Paul
d970313b66 Fix state flag dependencies for fixed function fragment program updates.
I started looking into why _NEW_ARRAY punishes us, and while annotating
dependencies noticed that a bunch of dependencies were missing.

(cherry picked from master, commit e5f63c403b)
2009-07-15 11:12:44 -06:00
José Fonseca
0474b5cb2a python/retrace: Interpret surface_copy. 2009-07-15 16:02:39 +01:00
José Fonseca
c68f659be3 python/samples: Use PIPE_FORMAT_Z16_UNORM instead of PIPE_FORMAT_Z32_UNORM.
More common. True fix would be to use whatever the screen supports though.
2009-07-15 16:02:39 +01:00
Keith Whitwell
fdeb778990 mesa: recognize and eliminate repeated error messages 2009-07-15 13:31:51 +01:00
Keith Whitwell
59de430de7 mesa: split out errorstring switch from _mesa_error
Move a chunk of code out of _mesa_error()
2009-07-15 13:31:51 +01:00
Keith Whitwell
df5f7a6761 mesa: remove dead code in _mesa_error
Remove early and unused snprintf and where[] string.
2009-07-15 13:31:51 +01:00
Keith Whitwell
6c9d8a6f24 mesa: don't call getenv every time _mesa_error is called
Buggy apps can generate thousands of mesa_error calls.  Don't need
to keep calling getenv to retreive the same MESA_DEBUG string each
time.
2009-07-15 13:31:50 +01:00
Brian Paul
9aca6769df mesa: fix texture border color code for glPopAttrib()
The texture object's border color used to be stored as GLchan but it's
been GLfloat for a while now.
2009-07-14 14:28:01 -06:00
Jakob Bornecrantz
26e58a42b0 progs/tests: Use compressed texture in mipmap_comp_tests 2009-07-14 17:11:07 +01:00
Jakob Bornecrantz
b0a17581e2 progs/tests: Tests more views in mipmap_comp_tests 2009-07-14 17:11:05 +01:00
Jakob Bornecrantz
a36b9987cd progs/tests: Add yet another mipmap test 2009-07-14 17:11:01 +01:00
Brian Paul
6ec955efaf mesa: regenerated enums.c file 2009-07-14 07:58:43 -06:00
José Fonseca
7325c1ebc8 scons: Monkey patch os.spawnve on Windows to become thread safe.
See also:
- http://bugs.python.org/issue6476
- http://scons.tigris.org/issues/show_bug.cgi?id=2449
2009-07-14 12:21:25 +01:00
José Fonseca
4ed1de8b84 mesa: Report the true face number when flushing. 2009-07-14 12:20:43 +01:00
Peteri Andras
680f7d09b0 r128: fix two-sided lighting segfault seen in GLUT's olight demo 2009-07-13 08:04:08 -06:00
142 changed files with 2631 additions and 1017 deletions

View File

@@ -182,7 +182,7 @@ ultrix-gcc:
# Rules for making release tarballs
VERSION=7.5-rc4
VERSION=7.5.1
DIRECTORY = Mesa-$(VERSION)
LIB_NAME = MesaLib-$(VERSION)
DEMO_NAME = MesaDemos-$(VERSION)
@@ -388,7 +388,17 @@ GLW_FILES = \
$(DIRECTORY)/src/glw/glw.pc.in \
$(DIRECTORY)/src/glw/depend
GLEW_FILES = \
$(DIRECTORY)/include/GL/glew.h \
$(DIRECTORY)/include/GL/glxew.h \
$(DIRECTORY)/include/GL/wglew.h \
$(DIRECTORY)/src/glew/*.c \
$(DIRECTORY)/src/glew/Makefile \
$(DIRECTORY)/src/glew/SConscript \
$(DIRECTORY)/src/glew/LICENSE.txt
DEMO_FILES = \
$(GLEW_FILES) \
$(DIRECTORY)/progs/beos/*.cpp \
$(DIRECTORY)/progs/beos/Makefile \
$(DIRECTORY)/progs/images/*.rgb \

View File

@@ -971,5 +971,6 @@ esac
#
if [ ${INSTALLDIR} != "." ] ; then
echo "mklib: Installing" ${FINAL_LIBS} "in" ${INSTALLDIR}
test -d ${INSTALLDIR} || mkdir -p ${INSTALLDIR}
mv ${FINAL_LIBS} ${INSTALLDIR}/
fi

View File

@@ -10,7 +10,7 @@ CONFIG_NAME = default
# Version info
MESA_MAJOR=7
MESA_MINOR=5
MESA_TINY=0
MESA_TINY=1
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
# external projects. This should be useless now that we use libdrm.

View File

@@ -121,6 +121,7 @@ AC_ARG_ENABLE([32-bit],
if test "x$enable_32bit" = xyes; then
if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -m32"
ARCH_FLAGS="$ARCH_FLAGS -m32"
fi
if test "x$GXX" = xyes; then
CXXFLAGS="$CXXFLAGS -m32"
@@ -1145,6 +1146,21 @@ AC_ARG_WITH([xorg-driver-dir],
[XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
AC_SUBST([XORG_DRIVER_INSTALL_DIR])
AC_ARG_WITH([max-width],
[AS_HELP_STRING([--with-max-width=N],
[Maximum framebuffer width (4096)])],
[DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
AS_IF([test "${withval}" -gt "4096"],
[AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
)
AC_ARG_WITH([max-height],
[AS_HELP_STRING([--with-max-height=N],
[Maximum framebuffer height (4096)])],
[DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
AS_IF([test "${withval}" -gt "4096"],
[AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
)
dnl
dnl Gallium Intel configuration
dnl

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

@@ -39,7 +39,6 @@ a:visited {
<ul>
<li><a href="download.html" target="MainFrame">Downloading / Unpacking</a>
<li><a href="install.html" target="MainFrame">Compiling / Installing</a>
<li><a href="glu.html" target="MainFrame">SGI's GLU</a>
<li><a href="precompiled.html" target="MainFrame">Precompiled Libraries</a>
</ul>
@@ -68,6 +67,7 @@ a:visited {
<li><a href="repository.html" target="MainFrame">Source Code Repository</a>
<li><a href="memory.html" target="MainFrame">DRI Memory Management</a>
<li><a href="shading.html" target="MainFrame">Shading Language</a>
<li><a href="glu.html" target="MainFrame">SGI's GLU</a>
<li><a href="utilities.html" target="MainFrame">Utilities</a>
<li><a href="helpwanted.html" target="MainFrame">Help Wanted</a>
<li><a href="devinfo.html" target="MainFrame">Development Notes</a>

View File

@@ -9,14 +9,14 @@
<H1>Downloading</H1>
<p>
Primary download site:
<a href="http://sourceforge.net/project/showfiles.php?group_id=3"
target="_parent">SourceForge</a>
Primary Mesa download site:
<a href="ftp://ftp.freedesktop.org/pub/mesa/"
target="_parent">freedesktop.org</a> (FTP)
</p>
<p>
When a new release is coming, release candidates (betas) can be found
<a href="http://www.mesa3d.org/beta/">here</a>.
When a new release is coming, release candidates (betas) may be found
<a href="ftp://ftp.freedesktop.org/pub/mesa/beta/" target="_parent">here</a>.
</p>

View File

@@ -316,6 +316,19 @@ Basically, applying a translation of (0.375, 0.375, 0.0) to your coordinates
will fix the problem.
</p>
<h2>3.6 How can I change the maximum framebuffer size in Mesa's
<tt>swrast</tt> backend?</h2>
<p>
These can be overridden by using the <tt>--with-max-width</tt> and
<tt>--with-max-height</tt> options. The two need not be equal.
</p><p>
Do note that Mesa uses these values to size some internal buffers,
so increasing these sizes will cause Mesa to require additional
memory. Furthermore, increasing these limits beyond <tt>4096</tt>
may introduce rasterization artifacts; see the leading comments in
<tt>src/mesa/swrast/s_tritemp.h</tt>.
</p>
<br>
<br>

View File

@@ -11,6 +11,21 @@
<H1>News</H1>
<h2>September 3, 2009</h2>
<p>
<a href="relnotes-7.5.1.html">Mesa 7.5.1</a> is released.
This is a bug-fix release which fixes bugs found in version 7.5.
</p>
<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 +114,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

@@ -9,17 +9,11 @@
<H1>Precompiled Libraries</H1>
<p>
In general, precompiled libraries are not available.
However, people occasionally prepare packages of precompiled libraries
for some systems.
In general, precompiled Mesa libraries are not available.
</p>
<H2>Mesa-6.0 for Solaris</H2>
<p>
Steve Christensen has submitted precompiled Mesa-6.0 libraries for
Solaris at <a href="http://sunfreeware.com/" target="_parent">
sunfreeware.com</a>.
However, some Linux distros (such as Ubuntu) seem to closely track
Mesa and often have the latest Mesa release available as an update.
</p>
</BODY>

64
docs/relnotes-7.5.1.html Normal file
View File

@@ -0,0 +1,64 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.5.1 Release Notes, 3 September 2009</H1>
<p>
Mesa 7.5.1 is a bug-fix release fixing issues found since the 7.5 release.
</p>
<p>
The main new feature of Mesa 7.5.x is the
<a href="http://wiki.freedesktop.org/wiki/Software/gallium"
target="_parent">Gallium3D</a> infrastructure.
</p>
<p>
Mesa 7.5.1 implements the OpenGL 2.1 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 2.1.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
tbd
</pre>
<h2>New features</h2>
<ul>
<li>Added configure --with-max-width=W, --with-max-height=H options to specify
max framebuffer, viewport size.
</ul>
<h2>Bug fixes</h2>
<ul>
<li>Added missing GLEW library to MesaDemos tarballs.
<li>Fixed swapbuffers jerkiness in Doom3/etc in Intel drivers.
<li>Fixed front buffer rendering bug in Intel drivers.
<li>Fixed minor GLX memory leaks.
<li>Fixed some texture env / fragment program state bugs.
<li>Fixed some Gallium glBlitFramebuffer() bugs
<li>Empty glBegin/glEnd() pair could cause divide by zero (bug 23489)
<li>Fixed Gallium glBitmap() Z position bug
<li>Setting arrays of sampler uniforms did not work
<li>Selection/Feedback mode didn't handle polygon culling correctly (bug 16866)
<li>Fixed 32/64-bit cross compilation issue in gen_matypes.c
<li>Fixed glXCreateGLXPixmap() for direct rendering.
<li>Fixed Gallium glCopyPixels(GL_STENCIL_INDEX) mispositioned image bug.
</ul>
</body>
</html>

View File

@@ -8,7 +8,7 @@
<body bgcolor="#eeeeee">
<H1>Mesa 7.5 Release Notes / date TBD</H1>
<H1>Mesa 7.5 Release Notes / 17 July 2009</H1>
<p>
Mesa 7.5 is a new development release.
@@ -17,7 +17,7 @@ with the 7.4.x branch or wait for Mesa 7.5.1.
</p>
<p>
The main new feature of Mesa 7.5 is the
<a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D"
<a href="http://wiki.freedesktop.org/wiki/Software/gallium"
target="_parent">Gallium3D</a> infrastructure.
</p>
<p>
@@ -40,7 +40,15 @@ If you're especially concerned with stability you should probably look for
<h2>MD5 checksums</h2>
<pre>
tbd
553fd956e544727f30fbe249619b6286 MesaLib-7.5.tar.gz
459f332551f6ebb86f384d21dd15e1f0 MesaLib-7.5.tar.bz2
8c02c0e17a9025250d20424ae32f5163 MesaLib-7.5.zip
a188da2886fa5496ea0c2cda602b2eeb MesaDemos-7.5.tar.gz
398ee8801814a00e47f6c2314e3dfddc MesaDemos-7.5.tar.bz2
15a0c8ae013c54335a26335e1a98d609 MesaDemos-7.5.zip
81010147def5a644ba14f9bbb7a49a2a MesaGLUT-7.5.tar.gz
baa7a1e850b6e39bae58868fd0684004 MesaGLUT-7.5.tar.bz2
265228418e4423fa328f2f5b7970cf08 MesaGLUT-7.5.zip
</pre>

View File

@@ -13,6 +13,7 @@ The release notes summarize what's new or changed in each Mesa release.
</p>
<UL>
<LI><A HREF="relnotes-7.5.1.html">7.5.1 release notes</A>
<LI><A HREF="relnotes-7.5.html">7.5 release notes</A>
<LI><A HREF="relnotes-7.4.4.html">7.4.4 release notes</A>
<LI><A HREF="relnotes-7.4.3.html">7.4.3 release notes</A>

View File

@@ -498,7 +498,7 @@ SetupFunctionPointers(void)
* Make FBO to render into given texture.
*/
static GLuint
MakeFBO_RenderTexture(GLuint TexObj)
MakeFBO_RenderTexture(GLuint texObj)
{
GLuint fb;
GLint sizeFudge = 0;
@@ -507,7 +507,7 @@ MakeFBO_RenderTexture(GLuint TexObj)
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, fb);
/* Render color to texture */
glFramebufferTexture2D_func(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
TexTarget, TexObj, TextureLevel);
TexTarget, texObj, TextureLevel);
if (Use_ARB_fbo) {
/* use a smaller depth buffer to see what happens */
@@ -541,7 +541,7 @@ MakeFBO_RenderTexture(GLuint TexObj)
/* queries */
{
GLint bits, w, h;
GLint bits, w, h, name;
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, DepthRB);
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
@@ -559,8 +559,28 @@ MakeFBO_RenderTexture(GLuint TexObj)
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
GL_RENDERBUFFER_STENCIL_SIZE_EXT, &bits);
printf("Stencil renderbuffer size = %d bits\n", bits);
}
glGetFramebufferAttachmentParameteriv_func(GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0,
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
&name);
printf("Render to texture name: %d\n", texObj);
printf("Color attachment[0] name: %d\n", name);
assert(texObj == name);
glGetFramebufferAttachmentParameteriv_func(GL_FRAMEBUFFER_EXT,
GL_STENCIL_ATTACHMENT,
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
&name);
printf("Stencil attachment name: %d\n", name);
glGetFramebufferAttachmentParameteriv_func(GL_FRAMEBUFFER_EXT,
GL_DEPTH_ATTACHMENT,
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
&name);
printf("Depth attachment name: %d\n", name);
}
/* bind the regular framebuffer */
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, 0);

View File

@@ -32,6 +32,7 @@ DEMO_SOURCES = \
pointcoord.c \
points.c \
samplers.c \
samplers_array.c \
shadow_sampler.c \
skinning.c \
texaaline.c \
@@ -188,7 +189,8 @@ samplers.o: $(UTIL_HEADERS)
samplers: samplers.o $(UTIL_OBJS)
samplers_array.o: $(UTIL_HEADERS)
samplers_array.o: samplers.c $(UTIL_HEADERS)
$(APP_CC) $(CFLAGS) -DSAMPLERS_ARRAY $< -c -o $@
samplers_array: samplers_array.o $(UTIL_OBJS)

View File

@@ -10,9 +10,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.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);

View File

@@ -10,10 +10,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -79,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);
}
@@ -106,7 +103,7 @@ Redisplay(void)
glTexCoord2f(0, 1); glVertex3fv(nx);
glEnd();
glUseProgram_func(0);
glUseProgram(0);
}
glPopMatrix();
@@ -161,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);
}
@@ -278,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);

View File

@@ -10,10 +10,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -83,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);
}
@@ -145,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);
@@ -161,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);
}

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);

View File

@@ -14,10 +14,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -71,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);
}
@@ -178,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);*/
@@ -198,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);
}

View File

@@ -13,10 +13,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -86,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);
}
@@ -130,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);*/
@@ -144,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);
}

View File

@@ -10,10 +10,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -70,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);
}
@@ -142,8 +139,6 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
if (FragProgFile)
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
else
@@ -156,7 +151,7 @@ Init(void)
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
/*assert(glGetError() == 0);*/
@@ -165,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);
}

View File

@@ -10,10 +10,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -133,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);
}
@@ -176,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);
}
}
@@ -192,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);
@@ -201,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);
@@ -229,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);
}

View File

@@ -10,10 +10,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -57,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);
@@ -95,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);
}
@@ -156,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);
@@ -176,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);
}

View File

@@ -9,10 +9,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
static const char *VertShaderText =
"void main() {\n"
@@ -108,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);
}
@@ -144,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();
@@ -187,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);
}
@@ -209,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 {
@@ -234,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);

View File

@@ -31,7 +31,6 @@
#include <GL/glew.h>
#include "GL/glut.h"
#include "readtex.h"
#include "extfuncs.h"
#include "shaderutil.h"
static const char *Demo = "multitex";
@@ -81,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);
}
@@ -110,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]);
}
@@ -268,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);
@@ -316,8 +315,6 @@ InitGL(void)
}
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
GetExtensionFuncs();
InitTextures();
InitPrograms();

View File

@@ -9,10 +9,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -68,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);
@@ -104,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);
}
@@ -176,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);
@@ -192,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);
}

View File

@@ -11,10 +11,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -65,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);
}
@@ -142,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);*/
@@ -161,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();

View File

@@ -11,10 +11,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -100,7 +97,7 @@ Redisplay(void)
*/
glPushMatrix();
glTranslatef(0, 1.2, 0);
glUseProgram_func(0);
glUseProgram(0);
DrawPoints(GL_FALSE);
glPopMatrix();
@@ -109,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();
@@ -151,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);
}
@@ -226,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);
}

View File

@@ -42,7 +42,6 @@
#include <GL/glew.h>
#include "GL/glut.h"
#include "readtex.h"
#include "extfuncs.h"
#include "shaderutil.h"
@@ -212,10 +211,18 @@ InitTextures(void)
for (y = 0; y < stripeSize; y++) {
for (x = 0; x < size; x++) {
GLint k = 4 * ((ypos + y) * size + x);
texImage[k + 0] = intensity;
texImage[k + 1] = intensity;
texImage[k + 2] = 0;
texImage[k + 3] = 255;
if (x < size / 2) {
texImage[k + 0] = intensity;
texImage[k + 1] = intensity;
texImage[k + 2] = 0;
texImage[k + 3] = 255;
}
else {
texImage[k + 0] = 255 - intensity;
texImage[k + 1] = 0;
texImage[k + 2] = 0;
texImage[k + 3] = 255;
}
}
}
@@ -291,7 +298,7 @@ CreateProgram(void)
assert(vertShader);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
free(fragShaderText);
@@ -316,10 +323,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);
}
}
@@ -334,8 +341,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;

View File

@@ -11,10 +11,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
/** Use GL_RECTANGLE texture (with projective texcoords)? */
@@ -67,7 +64,7 @@ Redisplay(void)
glPushMatrix();
CheckError(__LINE__);
glUseProgram_func(program);
glUseProgram(program);
CheckError(__LINE__);
glBegin(GL_POLYGON);
@@ -87,7 +84,7 @@ Redisplay(void)
glPopMatrix();
glUseProgram_func(0);
glUseProgram(0);
glWindowPos2iARB(80, 20);
PrintString("white black white black");
@@ -111,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);
}
@@ -179,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);
}
@@ -223,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);
}
}
@@ -267,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__);

View File

@@ -13,10 +13,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -65,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);
}
@@ -107,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);
@@ -149,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);
}
@@ -222,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);

View File

@@ -12,10 +12,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
static GLint WinWidth = 300, WinHeight = 300;
@@ -329,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));

View File

@@ -31,7 +31,6 @@
#include <GL/glew.h>
#include "GL/glut.h"
#include "readtex.h"
#include "extfuncs.h"
#include "shaderutil.h"
static const char *Demo = "texdemo1";
@@ -98,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);
@@ -117,7 +116,7 @@ draw(void)
glPopMatrix();
/* ground */
glUseProgram_func(Program2);
glUseProgram(Program2);
glTranslatef(0, -1.0, 0);
DrawGround(5);
@@ -381,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);
@@ -408,8 +407,6 @@ Init(GLboolean useImageFiles)
}
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
GetExtensionFuncs();
InitTextures(useImageFiles);
InitPrograms();

View File

@@ -10,10 +10,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -100,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);
}
@@ -170,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);

View File

@@ -16,10 +16,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -86,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);
@@ -133,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);
}
@@ -197,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);*/
@@ -217,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);
}

View File

@@ -13,10 +13,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -60,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);
}
@@ -76,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);
@@ -126,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);
}
@@ -230,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);*/
@@ -247,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);

View File

@@ -12,10 +12,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -59,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();
@@ -91,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);
}
@@ -130,8 +127,6 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
if (FragProgFile)
FragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
else
@@ -150,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);
}

View File

@@ -10,10 +10,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -134,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);
}
@@ -240,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);

View File

@@ -5,6 +5,7 @@ arbfpspec
arbfptest1
arbfptexture
arbfptrig
arbgpuprog
arbnpot
arbnpot-mipmap
arbvptest1
@@ -38,6 +39,7 @@ fptest1
fptexture
getprocaddress
getproclist.h
getteximage
glutfx
interleave
invert
@@ -49,11 +51,13 @@ mapvbo
minmag
mipgen
mipmap_comp
mipmap_comp_tests
mipmap_limits
mipmap_view
multipal
no_s3tc
packedpixels
persp_hint
pbo
prim
prog_parameter

View File

@@ -59,6 +59,7 @@ SOURCES = \
minmag.c \
mipgen.c \
mipmap_comp.c \
mipmap_comp_tests.c \
mipmap_limits.c \
mipmap_view.c \
multipal.c \

View File

@@ -82,6 +82,7 @@ progs = [
'minmag',
'mipgen',
'mipmap_comp',
'mipmap_comp_tests',
'mipmap_limits',
'mipmap_view',
'multipal',

View File

@@ -127,7 +127,7 @@ Init( void )
if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
printf("GL_EXT_framebuffer_object not found!\n");
/*exit(0);*/
exit(0);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

View File

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

View File

@@ -258,8 +258,26 @@ static void Init( void )
}
glBindTexture(GL_TEXTURE_2D, BORDER_TEXTURE);
#ifdef TEST_PBO_DLIST
/* test fetching teximage from PBO in display list */
{
GLuint b = 42, l = 10;
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER, b);
glBufferDataARB(GL_PIXEL_UNPACK_BUFFER, sizeof(BorderImage),
BorderImage, GL_STREAM_DRAW);
glNewList(l, GL_COMPILE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SIZE+2, SIZE+2, 1,
GL_RGBA, GL_UNSIGNED_BYTE, (void *) 0/* BorderImage*/);
glEndList();
glCallList(l);
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER, 0);
}
#else
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SIZE+2, SIZE+2, 1,
GL_RGBA, GL_UNSIGNED_BYTE, (void *) BorderImage);
#endif
for (i = 0; i < SIZE; i++) {
for (j = 0; j < SIZE; j++) {

View File

@@ -5,10 +5,17 @@ clear-random
clear-repeat
clear-scissor
clear-undefined
createwin
dlist-begin-call-end
dlist-dangling
dlist-degenerate
dlist-edgeflag
dlist-edgeflag-dangling
dlist-flat-tri
dlist-mat-tri
dlist-recursive-call
dlist-tri-flat-tri
dlist-tri-mat-tri
draw2arrays
drawarrays
drawelements
@@ -30,6 +37,7 @@ lineloop
lineloop-clip
lineloop-elts
linestrip
linestrip-clip
linestrip-flat-stipple
linestrip-stipple
linestrip-stipple-wide
@@ -70,8 +78,10 @@ quadstrip-cont
quadstrip-flat
readtex.c
readtex.h
readpixels
tri
tri-alpha
tri-alpha-tex
tri-array-interleaved
tri-blend
tri-blend-color
@@ -79,6 +89,7 @@ tri-blend-max
tri-blend-min
tri-blend-revsub
tri-blend-sub
tri-clear
tri-clip
tri-cull
tri-cull-both
@@ -93,6 +104,7 @@ tri-fog
tri-fp
tri-fp-const-imm
tri-lit
tri-lit-material
tri-logicop-none
tri-logicop-xor
tri-mask-tri
@@ -101,6 +113,7 @@ tri-orig
tri-query
tri-repeat
tri-scissor-tri
tri-square
tri-stencil
tri-stipple
tri-tex
@@ -110,6 +123,7 @@ tri-unfilled
tri-unfilled-clip
tri-unfilled-edgeflag
tri-unfilled-fog
tri-unfilled-point
tri-unfilled-smooth
tri-unfilled-tri
tri-unfilled-tri-lit
@@ -118,6 +132,7 @@ tri-unfilled-userclip-stip
tri-userclip
tri-viewport
tri-z
tri-z-9
tri-z-eq
trifan
trifan-flat

View File

@@ -18,6 +18,7 @@ SOURCES = \
clear-repeat.c \
clear-random.c \
clear.c \
createwin.c \
dlist-dangling.c \
dlist-flat-tri.c \
dlist-mat-tri.c \
@@ -48,6 +49,7 @@ SOURCES = \
lineloop-clip.c \
lineloop-elts.c \
lineloop.c \
linestrip-clip.c \
linestrip-flat-stipple.c \
linestrip-stipple-wide.c \
linestrip-stipple.c \
@@ -87,7 +89,9 @@ SOURCES = \
quadstrip-cont.c \
quadstrip-flat.c \
quadstrip.c \
readpixels.c \
tri-alpha.c \
tri-alpha-tex.c \
tri-array-interleaved.c \
tri-blend-color.c \
tri-blend-max.c \
@@ -95,6 +99,7 @@ SOURCES = \
tri-blend-revsub.c \
tri-blend-sub.c \
tri-blend.c \
tri-clear.c \
tri-clip.c \
tri-cull-both.c \
tri-cull.c \
@@ -117,6 +122,7 @@ SOURCES = \
tri-query.c \
tri-repeat.c \
tri-scissor-tri.c \
tri-square.c \
tri-stencil.c \
tri-stipple.c \
tri-multitex-vbo.c \
@@ -126,6 +132,7 @@ SOURCES = \
tri-unfilled-fog.c \
tri-unfilled-edgeflag.c \
tri-unfilled-clip.c \
tri-unfilled-point.c \
tri-unfilled-smooth.c \
tri-unfilled-tri.c \
tri-unfilled-tri-lit.c \
@@ -134,6 +141,7 @@ SOURCES = \
tri-unfilled.c \
tri-userclip.c \
tri-viewport.c \
tri-z-9.c \
tri-z-eq.c \
tri-z.c \
tri.c \

View File

@@ -11,7 +11,6 @@
#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -20,7 +19,6 @@ Init(void)
{
static GLboolean firstCall = GL_TRUE;
if (firstCall) {
GetExtensionFuncs();
firstCall = GL_FALSE;
}
}
@@ -51,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);
}
@@ -110,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;
}
@@ -144,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);
@@ -152,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

@@ -378,6 +378,9 @@ make_window( Display *dpy, const char *name,
scrnum = DefaultScreen( dpy );
root = RootWindow( dpy, scrnum );
if (visinfo)
XFree(visinfo);
visinfo = glXChooseVisual( dpy, scrnum, attribs );
if (!visinfo) {
printf("Error: couldn't get an RGB, Double-buffered visual\n");

View File

@@ -587,6 +587,9 @@ event_loop(Display *dpy, Window win)
angle += 2.0;
draw();
glXSwapBuffers(dpy, win);
if ( get_frame_usage != NULL ) {
GLfloat temp;
@@ -594,8 +597,6 @@ event_loop(Display *dpy, Window win)
frame_usage += temp;
}
glXSwapBuffers(dpy, win);
/* calc framerate */
{
static int t0 = -1;

27
scons/fixes.py Normal file
View File

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

View File

@@ -38,6 +38,8 @@ import SCons.Action
import SCons.Builder
import SCons.Scanner
import fixes
def quietCommandLines(env):
# Quiet command lines

View File

@@ -4,7 +4,7 @@ TOP = ../../../..
include $(TOP)/configs/current
INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/egl/main
INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/egl/main $(X11_INCLUDES)
SOURCES = demo.c

View File

@@ -4,7 +4,7 @@ TOP = ../../..
include $(TOP)/configs/current
INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/mesa/glapi
INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/mesa/glapi $(X11_INCLUDES)
HEADERS = \
eglconfig.h \

View File

@@ -158,6 +158,60 @@ static void do_triangle( struct draw_context *draw,
#define QUAD(i0,i1,i2,i3) \
do_triangle( draw, \
( DRAW_PIPE_RESET_STIPPLE | \
DRAW_PIPE_EDGE_FLAG_0 | \
DRAW_PIPE_EDGE_FLAG_2 ), \
verts + stride * elts[i0], \
verts + stride * elts[i1], \
verts + stride * elts[i3]); \
do_triangle( draw, \
( DRAW_PIPE_EDGE_FLAG_0 | \
DRAW_PIPE_EDGE_FLAG_1 ), \
verts + stride * elts[i1], \
verts + stride * elts[i2], \
verts + stride * elts[i3])
#define TRIANGLE(flags,i0,i1,i2) \
do_triangle( draw, \
elts[i0], /* flags */ \
verts + stride * (elts[i0] & ~DRAW_PIPE_FLAG_MASK), \
verts + stride * elts[i1], \
verts + stride * elts[i2])
#define LINE(flags,i0,i1) \
do_line( draw, \
elts[i0], \
verts + stride * (elts[i0] & ~DRAW_PIPE_FLAG_MASK), \
verts + stride * elts[i1])
#define POINT(i0) \
do_point( draw, \
verts + stride * elts[i0] )
#define FUNC pipe_run
#define ARGS \
struct draw_context *draw, \
unsigned prim, \
struct vertex_header *vertices, \
unsigned stride, \
const ushort *elts
#define LOCAL_VARS \
char *verts = (char *)vertices; \
boolean flatfirst = (draw->rasterizer->flatshade && \
draw->rasterizer->flatshade_first); \
unsigned i; \
ushort flags
#define FLUSH
#include "draw_pt_decompose.h"
#undef ARGS
#undef LOCAL_VARS
/* Code to run the pipeline on a fairly arbitary collection of vertices.
*
@@ -178,34 +232,12 @@ void draw_pipeline_run( struct draw_context *draw,
unsigned count )
{
char *verts = (char *)vertices;
unsigned i;
draw->pipeline.verts = verts;
draw->pipeline.vertex_stride = stride;
draw->pipeline.vertex_count = vertex_count;
switch (prim) {
case PIPE_PRIM_POINTS:
for (i = 0; i < count; i++)
do_point( draw,
verts + stride * elts[i] );
break;
case PIPE_PRIM_LINES:
for (i = 0; i+1 < count; i += 2)
do_line( draw,
elts[i+0], /* flags */
verts + stride * (elts[i+0] & ~DRAW_PIPE_FLAG_MASK),
verts + stride * elts[i+1]);
break;
case PIPE_PRIM_TRIANGLES:
for (i = 0; i+2 < count; i += 3)
do_triangle( draw,
elts[i+0], /* flags */
verts + stride * (elts[i+0] & ~DRAW_PIPE_FLAG_MASK),
verts + stride * elts[i+1],
verts + stride * elts[i+2]);
break;
}
pipe_run(draw, prim, vertices, stride, elts, count);
draw->pipeline.verts = NULL;
draw->pipeline.vertex_count = 0;

View File

@@ -477,6 +477,8 @@ tgsi_default_full_instruction( void )
full_instruction.FullSrcRegisters[i] = tgsi_default_full_src_register();
}
full_instruction.Flags = 0x0;
return full_instruction;
}

View File

@@ -62,6 +62,9 @@
#define FAST_MATH 1
/** for tgsi_full_instruction::Flags */
#define SOA_DEPENDENCY_FLAG 0x1
#define TILE_TOP_LEFT 0
#define TILE_TOP_RIGHT 1
#define TILE_BOTTOM_LEFT 2
@@ -182,7 +185,7 @@ print_temp(const struct tgsi_exec_machine *mach, uint index)
* MOV t3, t2;
* The second instruction will have the wrong value for t0 if executed as-is.
*/
static boolean
boolean
tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst)
{
uint i, chan;
@@ -328,20 +331,25 @@ tgsi_exec_machine_bind_shader(
* sizeof(struct tgsi_full_instruction));
maxInstructions += 10;
}
if (tgsi_check_soa_dependencies(&parse.FullToken.FullInstruction)) {
uint opcode = parse.FullToken.FullInstruction.Instruction.Opcode;
parse.FullToken.FullInstruction.Flags = SOA_DEPENDENCY_FLAG;
/* XXX we only handle SOA dependencies properly for MOV/SWZ
* at this time!
*/
if (opcode != TGSI_OPCODE_MOV && opcode != TGSI_OPCODE_SWZ) {
debug_printf("Warning: SOA dependency in instruction"
" is not handled:\n");
tgsi_dump_instruction(&parse.FullToken.FullInstruction,
numInstructions);
}
}
memcpy(instructions + numInstructions,
&parse.FullToken.FullInstruction,
sizeof(instructions[0]));
#if 0
if (tgsi_check_soa_dependencies(&parse.FullToken.FullInstruction)) {
debug_printf("SOA dependency in instruction:\n");
tgsi_dump_instruction(&parse.FullToken.FullInstruction,
numInstructions);
}
#else
(void) tgsi_check_soa_dependencies;
#endif
numInstructions++;
break;
@@ -2018,9 +2026,23 @@ exec_instruction(
case TGSI_OPCODE_MOV:
case TGSI_OPCODE_SWZ:
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
STORE( &r[0], 0, chan_index );
if (inst->Flags & SOA_DEPENDENCY_FLAG) {
/* Do all fetches into temp regs, then do all stores to avoid
* intermediate/accidental clobbering. This could be done all the
* time for MOV but for other instructions we'll need more temps...
*/
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[chan_index], 0, chan_index );
}
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
STORE( &r[chan_index], 0, chan_index );
}
}
else {
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
STORE( &r[0], 0, chan_index );
}
}
break;

View File

@@ -272,6 +272,10 @@ void
tgsi_exec_machine_free_data(struct tgsi_exec_machine *mach);
boolean
tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst);
static INLINE void
tgsi_set_kill_mask(struct tgsi_exec_machine *mach, unsigned mask)
{

View File

@@ -91,6 +91,7 @@ struct tgsi_full_instruction
struct tgsi_instruction_ext_texture InstructionExtTexture;
struct tgsi_full_dst_register FullDstRegisters[TGSI_FULL_MAX_DST_REGISTERS];
struct tgsi_full_src_register FullSrcRegisters[TGSI_FULL_MAX_SRC_REGISTERS];
uint Flags; /**< user-defined usage */
};
union tgsi_full_token

View File

@@ -1107,6 +1107,15 @@ static int
emit_instruction(struct gen_context *gen,
struct tgsi_full_instruction *inst)
{
/* we don't handle saturation/clamping yet */
if (inst->Instruction.Saturate != TGSI_SAT_NONE)
return 0;
/* need to use extra temps to fix SOA dependencies : */
if (tgsi_check_soa_dependencies(inst))
return FALSE;
switch (inst->Instruction.Opcode) {
case TGSI_OPCODE_MOV:
case TGSI_OPCODE_SWZ:

View File

@@ -1502,6 +1502,14 @@ emit_instruction(
if (indirect_temp_reference(inst))
return FALSE;
/* we don't handle saturation/clamping yet */
if (inst->Instruction.Saturate != TGSI_SAT_NONE)
return FALSE;
/* need to use extra temps to fix SOA dependencies : */
if (tgsi_check_soa_dependencies(inst))
return FALSE;
switch (inst->Instruction.Opcode) {
case TGSI_OPCODE_ARL:
FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) {

View File

@@ -45,6 +45,7 @@
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_simple_shaders.h"
#include "util/u_surface.h"
#include "cso_cache/cso_context.h"
@@ -61,7 +62,7 @@ struct blit_state
struct pipe_viewport_state viewport;
void *vs;
void *fs;
void *fs[TGSI_WRITEMASK_XYZW + 1];
struct pipe_buffer *vbuf; /**< quad vertices */
unsigned vbuf_slot;
@@ -124,7 +125,7 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso)
}
/* fragment shader */
ctx->fs = util_make_fragment_tex_shader(pipe);
ctx->fs[TGSI_WRITEMASK_XYZW] = util_make_fragment_tex_shader(pipe);
ctx->vbuf = NULL;
/* init vertex data that doesn't change */
@@ -145,9 +146,13 @@ void
util_destroy_blit(struct blit_state *ctx)
{
struct pipe_context *pipe = ctx->pipe;
unsigned i;
pipe->delete_vs_state(pipe, ctx->vs);
pipe->delete_fs_state(pipe, ctx->fs);
for (i = 0; i < Elements(ctx->fs); i++)
if (ctx->fs[i])
pipe->delete_fs_state(pipe, ctx->fs[i]);
pipe_buffer_reference(&ctx->vbuf, NULL);
@@ -155,7 +160,11 @@ util_destroy_blit(struct blit_state *ctx)
}
static unsigned get_next_slot( struct blit_state *ctx )
/**
* Get offset of next free slot in vertex buffer for quad vertices.
*/
static unsigned
get_next_slot( struct blit_state *ctx )
{
const unsigned max_slots = 4096 / sizeof ctx->vertices;
@@ -173,7 +182,6 @@ static unsigned get_next_slot( struct blit_state *ctx )
}
/**
* Setup vertex data for the textured quad we'll draw.
* Note: y=0=top
@@ -260,20 +268,50 @@ setup_vertex_data_tex(struct blit_state *ctx,
return offset;
}
/**
* \return TRUE if two regions overlap, FALSE otherwise
*/
static boolean
regions_overlap(int srcX0, int srcY0,
int srcX1, int srcY1,
int dstX0, int dstY0,
int dstX1, int dstY1)
{
if (MAX2(srcX0, srcX1) < MIN2(dstX0, dstX1))
return FALSE; /* src completely left of dst */
if (MAX2(dstX0, dstX1) < MIN2(srcX0, srcX1))
return FALSE; /* dst completely left of src */
if (MAX2(srcY0, srcY1) < MIN2(dstY0, dstY1))
return FALSE; /* src completely above dst */
if (MAX2(dstY0, dstY1) < MIN2(srcY0, srcY1))
return FALSE; /* dst completely above src */
return TRUE; /* some overlap */
}
/**
* Copy pixel block from src surface to dst surface.
* Overlapping regions are acceptable.
* Flipping and stretching are supported.
* XXX what about clipping???
* XXX need some control over blitting Z and/or stencil.
*/
void
util_blit_pixels(struct blit_state *ctx,
struct pipe_surface *src,
int srcX0, int srcY0,
int srcX1, int srcY1,
struct pipe_surface *dst,
int dstX0, int dstY0,
int dstX1, int dstY1,
float z, uint filter)
util_blit_pixels_writemask(struct blit_state *ctx,
struct pipe_surface *src,
int srcX0, int srcY0,
int srcX1, int srcY1,
struct pipe_surface *dst,
int dstX0, int dstY0,
int dstX1, int dstY1,
float z, uint filter,
uint writemask)
{
struct pipe_context *pipe = ctx->pipe;
struct pipe_screen *screen = pipe->screen;
@@ -285,10 +323,41 @@ util_blit_pixels(struct blit_state *ctx,
const int srcLeft = MIN2(srcX0, srcX1);
const int srcTop = MIN2(srcY0, srcY1);
unsigned offset;
boolean overlap;
assert(filter == PIPE_TEX_MIPFILTER_NEAREST ||
filter == PIPE_TEX_MIPFILTER_LINEAR);
assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_SAMPLER, 0));
assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0));
/* do the regions overlap? */
overlap = util_same_surface(src, dst) &&
regions_overlap(srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1);
/*
* Check for simple case: no format conversion, no flipping, no stretching,
* no overlapping.
* Filter mode should not matter since there's no stretching.
*/
if (dst->format == src->format &&
srcX0 < srcX1 &&
dstX0 < dstX1 &&
srcY0 < srcY1 &&
dstY0 < dstY1 &&
(dstX1 - dstX0) == (srcX1 - srcX0) &&
(dstY1 - dstY0) == (srcY1 - srcY0) &&
!overlap) {
pipe->surface_copy(pipe,
dst, dstX0, dstY0, /* dest */
src, srcX0, srcY0, /* src */
srcW, srcH); /* size */
return;
}
if (srcLeft != srcX0) {
/* left-right flip */
int tmp = dstX0;
@@ -303,20 +372,6 @@ util_blit_pixels(struct blit_state *ctx,
dstY1 = tmp;
}
assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_SAMPLER, 0));
assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_SAMPLER, 0));
if(dst->format == src->format && (dstX1 - dstX0) == srcW && (dstY1 - dstY0) == srcH) {
/* FIXME: this will most surely fail for overlapping rectangles */
pipe->surface_copy(pipe,
dst, dstX0, dstY0, /* dest */
src, srcX0, srcY0, /* src */
srcW, srcH); /* size */
return;
}
assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0));
@@ -376,8 +431,11 @@ util_blit_pixels(struct blit_state *ctx,
/* texture */
cso_set_sampler_textures(ctx->cso, 1, &tex);
if (ctx->fs[writemask] == NULL)
ctx->fs[writemask] = util_make_fragment_tex_shader_writemask(pipe, writemask);
/* shaders */
cso_set_fragment_shader_handle(ctx->cso, ctx->fs);
cso_set_fragment_shader_handle(ctx->cso, ctx->fs[writemask]);
cso_set_vertex_shader_handle(ctx->cso, ctx->vs);
/* drawing dest */
@@ -412,6 +470,27 @@ util_blit_pixels(struct blit_state *ctx,
}
void
util_blit_pixels(struct blit_state *ctx,
struct pipe_surface *src,
int srcX0, int srcY0,
int srcX1, int srcY1,
struct pipe_surface *dst,
int dstX0, int dstY0,
int dstX1, int dstY1,
float z, uint filter )
{
util_blit_pixels_writemask( ctx, src,
srcX0, srcY0,
srcX1, srcY1,
dst,
dstX0, dstY0,
dstX1, dstY1,
z, filter,
TGSI_WRITEMASK_XYZW );
}
/* Release vertex buffer at end of frame to avoid synchronous
* rendering.
*/
@@ -485,7 +564,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_set_sampler_textures(ctx->cso, 1, &tex);
/* shaders */
cso_set_fragment_shader_handle(ctx->cso, ctx->fs);
cso_set_fragment_shader_handle(ctx->cso, ctx->fs[TGSI_WRITEMASK_XYZW]);
cso_set_vertex_shader_handle(ctx->cso, ctx->vs);
/* drawing dest */

View File

@@ -60,6 +60,17 @@ util_blit_pixels(struct blit_state *ctx,
int dstX1, int dstY1,
float z, uint filter);
void
util_blit_pixels_writemask(struct blit_state *ctx,
struct pipe_surface *src,
int srcX0, int srcY0,
int srcX1, int srcY1,
struct pipe_surface *dst,
int dstX0, int dstY0,
int dstX1, int dstY1,
float z, uint filter,
uint writemask);
extern void
util_blit_pixels_tex(struct blit_state *ctx,
struct pipe_texture *tex,

View File

@@ -143,11 +143,9 @@ void _debug_vprintf(const char *format, va_list ap)
#elif defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)
/* TODO */
#else /* !PIPE_SUBSYSTEM_WINDOWS */
#ifdef DEBUG
fflush(stdout);
vfprintf(stderr, format, ap);
#endif
#endif
}

View File

@@ -921,11 +921,19 @@ static void
format_to_type_comps(enum pipe_format pformat,
enum dtype *datatype, uint *comps)
{
/* XXX I think this could be implemented in terms of the pf_*() functions */
switch (pformat) {
case PIPE_FORMAT_A8R8G8B8_UNORM:
case PIPE_FORMAT_X8R8G8B8_UNORM:
case PIPE_FORMAT_B8G8R8A8_UNORM:
case PIPE_FORMAT_B8G8R8X8_UNORM:
case PIPE_FORMAT_R8G8B8A8_SRGB:
case PIPE_FORMAT_R8G8B8X8_SRGB:
case PIPE_FORMAT_A8R8G8B8_SRGB:
case PIPE_FORMAT_X8R8G8B8_SRGB:
case PIPE_FORMAT_B8G8R8A8_SRGB:
case PIPE_FORMAT_B8G8R8X8_SRGB:
case PIPE_FORMAT_R8G8B8_SRGB:
*datatype = DTYPE_UBYTE;
*comps = 4;
return;
@@ -942,12 +950,14 @@ format_to_type_comps(enum pipe_format pformat,
*comps = 3;
return;
case PIPE_FORMAT_L8_UNORM:
case PIPE_FORMAT_L8_SRGB:
case PIPE_FORMAT_A8_UNORM:
case PIPE_FORMAT_I8_UNORM:
*datatype = DTYPE_UBYTE;
*comps = 1;
return;
case PIPE_FORMAT_A8L8_UNORM:
case PIPE_FORMAT_A8L8_SRGB:
*datatype = DTYPE_UBYTE;
*comps = 2;
return;

View File

@@ -152,11 +152,14 @@ util_make_vertex_passthrough_shader(struct pipe_context *pipe,
/**
* Make simple fragment texture shader:
* TEX OUT[0], IN[0], SAMP[0], 2D;
* IMM {0,0,0,1} // (if writemask != 0xf)
* MOV OUT[0], IMM[0] // (if writemask != 0xf)
* TEX OUT[0].writemask, IN[0], SAMP[0], 2D;
* END;
*/
void *
util_make_fragment_tex_shader(struct pipe_context *pipe)
util_make_fragment_tex_shader_writemask(struct pipe_context *pipe,
unsigned writemask )
{
struct pipe_shader_state shader;
struct tgsi_token tokens[100];
@@ -217,12 +220,43 @@ util_make_fragment_tex_shader(struct pipe_context *pipe)
header,
Elements(tokens) - ti);
if (writemask != TGSI_WRITEMASK_XYZW) {
struct tgsi_full_immediate imm;
static const float value[4] = { 0, 0, 0, 1 };
imm = tgsi_default_full_immediate();
imm.Immediate.NrTokens += 4;
imm.Immediate.DataType = TGSI_IMM_FLOAT32;
imm.u.Pointer = value;
ti += tgsi_build_full_immediate(&imm,
&tokens[ti],
header,
Elements(tokens) - ti );
/* MOV instruction */
inst = tgsi_default_full_instruction();
inst.Instruction.Opcode = TGSI_OPCODE_MOV;
inst.Instruction.NumDstRegs = 1;
inst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_OUTPUT;
inst.FullDstRegisters[0].DstRegister.Index = 0;
inst.Instruction.NumSrcRegs = 1;
inst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_IMMEDIATE;
inst.FullSrcRegisters[0].SrcRegister.Index = 0;
ti += tgsi_build_full_instruction(&inst,
&tokens[ti],
header,
Elements(tokens) - ti );
}
/* TEX instruction */
inst = tgsi_default_full_instruction();
inst.Instruction.Opcode = TGSI_OPCODE_TEX;
inst.Instruction.NumDstRegs = 1;
inst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_OUTPUT;
inst.FullDstRegisters[0].DstRegister.Index = 0;
inst.FullDstRegisters[0].DstRegister.WriteMask = writemask;
inst.Instruction.NumSrcRegs = 2;
inst.InstructionExtTexture.Texture = TGSI_TEXTURE_2D;
inst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_INPUT;
@@ -253,6 +287,13 @@ util_make_fragment_tex_shader(struct pipe_context *pipe)
return pipe->create_fs_state(pipe, &shader);
}
void *
util_make_fragment_tex_shader(struct pipe_context *pipe )
{
return util_make_fragment_tex_shader_writemask( pipe,
TGSI_WRITEMASK_XYZW );
}

View File

@@ -49,6 +49,10 @@ util_make_vertex_passthrough_shader(struct pipe_context *pipe,
const uint *semantic_indexes);
extern void *
util_make_fragment_tex_shader_writemask(struct pipe_context *pipe,
unsigned writemask );
extern void *
util_make_fragment_tex_shader(struct pipe_context *pipe);

View File

@@ -37,6 +37,23 @@ struct pipe_texture;
struct pipe_surface;
/**
* Are s1 and s2 the same surface?
* Surfaces are basically views into textures so check if the two surfaces
* name the same part of the same texture.
*/
static INLINE boolean
util_same_surface(const struct pipe_surface *s1, const struct pipe_surface *s2)
{
return (s1->texture == s2->texture &&
s1->face == s2->face &&
s1->level == s2->level &&
s1->zslice == s2->zslice);
}
extern boolean
util_create_rgba_surface(struct pipe_screen *screen,
uint width, uint height,

View File

@@ -153,7 +153,7 @@ a8r8g8b8_put_tile_rgba(unsigned *dst,
}
/*** PIPE_FORMAT_A8R8G8B8_UNORM ***/
/*** PIPE_FORMAT_X8R8G8B8_UNORM ***/
static void
x8r8g8b8_get_tile_rgba(const unsigned *src,
@@ -596,6 +596,184 @@ r16g16b16a16_put_tile_rgba(short *dst,
}
/*** PIPE_FORMAT_R8G8B8A8_SRGB ***/
/**
* Convert an 8-bit sRGB value from non-linear space to a
* linear RGB value in [0, 1].
* Implemented with a 256-entry lookup table.
*/
static INLINE float
srgb_to_linear(ubyte cs8)
{
static float table[256];
static boolean tableReady = FALSE;
if (!tableReady) {
/* compute lookup table now */
uint i;
for (i = 0; i < 256; i++) {
const float cs = ubyte_to_float(i);
if (cs <= 0.04045) {
table[i] = cs / 12.92f;
}
else {
table[i] = (float) powf((cs + 0.055) / 1.055, 2.4);
}
}
tableReady = TRUE;
}
return table[cs8];
}
/**
* Convert linear float in [0,1] to an srgb ubyte value in [0,255].
* XXX this hasn't been tested (render to srgb surface).
* XXX this needs optimization.
*/
static INLINE ubyte
linear_to_srgb(float cl)
{
if (cl >= 1.0F)
return 255;
else if (cl >= 0.0031308F)
return float_to_ubyte(1.055F * powf(cl, 0.41666F) - 0.055F);
else if (cl > 0.0F)
return float_to_ubyte(12.92F * cl);
else
return 0.0;
}
static void
a8r8g8b8_srgb_get_tile_rgba(const unsigned *src,
unsigned w, unsigned h,
float *p,
unsigned dst_stride)
{
unsigned i, j;
for (i = 0; i < h; i++) {
float *pRow = p;
for (j = 0; j < w; j++, pRow += 4) {
const unsigned pixel = *src++;
pRow[0] = srgb_to_linear((pixel >> 16) & 0xff);
pRow[1] = srgb_to_linear((pixel >> 8) & 0xff);
pRow[2] = srgb_to_linear((pixel >> 0) & 0xff);
pRow[3] = ubyte_to_float((pixel >> 24) & 0xff);
}
p += dst_stride;
}
}
static void
a8r8g8b8_srgb_put_tile_rgba(unsigned *dst,
unsigned w, unsigned h,
const float *p,
unsigned src_stride)
{
unsigned i, j;
for (i = 0; i < h; i++) {
const float *pRow = p;
for (j = 0; j < w; j++, pRow += 4) {
unsigned r, g, b, a;
r = linear_to_srgb(pRow[0]);
g = linear_to_srgb(pRow[1]);
b = linear_to_srgb(pRow[2]);
a = float_to_ubyte(pRow[3]);
*dst++ = (a << 24) | (r << 16) | (g << 8) | b;
}
p += src_stride;
}
}
/*** PIPE_FORMAT_A8L8_SRGB ***/
static void
a8l8_srgb_get_tile_rgba(const ushort *src,
unsigned w, unsigned h,
float *p,
unsigned dst_stride)
{
unsigned i, j;
for (i = 0; i < h; i++) {
float *pRow = p;
for (j = 0; j < w; j++, pRow += 4) {
ushort p = *src++;
pRow[0] =
pRow[1] =
pRow[2] = srgb_to_linear(p & 0xff);
pRow[3] = ubyte_to_float(p >> 8);
}
p += dst_stride;
}
}
static void
a8l8_srgb_put_tile_rgba(ushort *dst,
unsigned w, unsigned h,
const float *p,
unsigned src_stride)
{
unsigned i, j;
for (i = 0; i < h; i++) {
const float *pRow = p;
for (j = 0; j < w; j++, pRow += 4) {
unsigned r, a;
r = linear_to_srgb(pRow[0]);
a = float_to_ubyte(pRow[3]);
*dst++ = (a << 8) | r;
}
p += src_stride;
}
}
/*** PIPE_FORMAT_L8_SRGB ***/
static void
l8_srgb_get_tile_rgba(const ubyte *src,
unsigned w, unsigned h,
float *p,
unsigned dst_stride)
{
unsigned i, j;
for (i = 0; i < h; i++) {
float *pRow = p;
for (j = 0; j < w; j++, src++, pRow += 4) {
pRow[0] =
pRow[1] =
pRow[2] = srgb_to_linear(*src);
pRow[3] = 1.0;
}
p += dst_stride;
}
}
static void
l8_srgb_put_tile_rgba(ubyte *dst,
unsigned w, unsigned h,
const float *p,
unsigned src_stride)
{
unsigned i, j;
for (i = 0; i < h; i++) {
const float *pRow = p;
for (j = 0; j < w; j++, pRow += 4) {
unsigned r;
r = linear_to_srgb(pRow[0]);
*dst++ = (ubyte) r;
}
p += src_stride;
}
}
/*** PIPE_FORMAT_I8_UNORM ***/
@@ -946,6 +1124,15 @@ pipe_tile_raw_to_rgba(enum pipe_format format,
case PIPE_FORMAT_R16G16B16A16_SNORM:
r16g16b16a16_get_tile_rgba((short *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_A8R8G8B8_SRGB:
a8r8g8b8_srgb_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_A8L8_SRGB:
a8l8_srgb_get_tile_rgba((ushort *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_L8_SRGB:
l8_srgb_get_tile_rgba((ubyte *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_Z16_UNORM:
z16_get_tile_rgba((ushort *) src, w, h, dst, dst_stride);
break;
@@ -1059,6 +1246,15 @@ pipe_put_tile_rgba(struct pipe_transfer *pt,
case PIPE_FORMAT_R16G16B16A16_SNORM:
r16g16b16a16_put_tile_rgba((short *) packed, w, h, p, src_stride);
break;
case PIPE_FORMAT_A8R8G8B8_SRGB:
a8r8g8b8_srgb_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);
break;
case PIPE_FORMAT_A8L8_SRGB:
a8l8_srgb_put_tile_rgba((ushort *) packed, w, h, p, src_stride);
break;
case PIPE_FORMAT_L8_SRGB:
l8_srgb_put_tile_rgba((ubyte *) packed, w, h, p, src_stride);
break;
case PIPE_FORMAT_Z16_UNORM:
/*z16_put_tile_rgba((ushort *) packed, w, h, p, src_stride);*/
break;

View File

@@ -123,21 +123,25 @@ static enum pipe_error
u_upload_alloc_buffer( struct u_upload_mgr *upload,
unsigned min_size )
{
unsigned size;
/* Release old buffer, if present:
*/
u_upload_flush( upload );
/* Allocate a new one:
*/
upload->size = align(MAX2(upload->default_size, min_size), 4096);
size = align(MAX2(upload->default_size, min_size), 4096);
upload->buffer = pipe_buffer_create( upload->screen,
upload->alignment,
upload->usage | PIPE_BUFFER_USAGE_CPU_WRITE,
upload->size );
size );
if (upload->buffer == NULL)
goto fail;
upload->size = size;
upload->offset = 0;
return 0;

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

@@ -42,6 +42,7 @@
#include "sp_texture.h"
#include "sp_tile_cache.h"
#include "sp_screen.h"
#include "sp_winsys.h"
/* Simple, maximally packed layout.

View File

@@ -351,7 +351,7 @@ void trace_dump_call_begin_locked(const char *klass, const char *method)
trace_dump_indent(1);
trace_dump_writes("<call no=\'");
trace_dump_writef("%lu", call_no);
trace_dump_writes("\' class =\'");
trace_dump_writes("\' class=\'");
trace_dump_escape(klass);
trace_dump_writes("\' method=\'");
trace_dump_escape(method);

View File

@@ -63,6 +63,13 @@ pipe_buffer_map(struct pipe_screen *screen,
if(screen->buffer_map_range) {
unsigned offset = 0;
unsigned length = buf->size;
/* XXX: Actually we should be using/detecting DISCARD
* instead of assuming that WRITE implies discard */
if((usage & PIPE_BUFFER_USAGE_CPU_WRITE) &&
!(usage & PIPE_BUFFER_USAGE_DISCARD))
usage |= PIPE_BUFFER_USAGE_CPU_READ;
return screen->buffer_map_range(screen, buf, offset, length, usage);
}
else

View File

@@ -743,7 +743,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
{
static GLboolean firstTime = GL_TRUE;
struct pipe_screen *screen;
struct pipe_context *pipe;
struct pipe_context *pipe = NULL;
XMesaContext c;
GLcontext *mesaCtx;
uint pf;

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

@@ -371,7 +371,7 @@ class Main:
stream = GzipFile(arg, 'rt')
elif arg.endswith('.bz2'):
from bz2 import BZ2File
stream = BZ2File(arg, 'rt')
stream = BZ2File(arg, 'rU')
else:
stream = open(arg, 'rt')
self.process_arg(stream, options)

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

@@ -29,6 +29,7 @@ if env['platform'] in ['windows']:
'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

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

@@ -34,6 +34,7 @@
#include "glapi/glapi.h"
#include "stw_public.h"
#include "stw_extgallium.h"
struct stw_extension_entry
{
@@ -60,6 +61,10 @@ static const struct stw_extension_entry stw_extension_entries[] = {
STW_EXTENSION_ENTRY( wglGetSwapIntervalEXT ),
STW_EXTENSION_ENTRY( wglSwapIntervalEXT ),
/* WGL_EXT_gallium ? */
STW_EXTENSION_ENTRY( wglGetGalliumScreenMESA ),
STW_EXTENSION_ENTRY( wglCreateGalliumContextMESA ),
{ NULL, NULL }
};
@@ -75,7 +80,7 @@ stw_get_proc_address(
return entry->proc;
if (lpszProc[0] == 'g' && lpszProc[1] == 'l')
return (PROC) _glapi_get_proc_address( lpszProc );
return (PROC) _glapi_get_proc_address( lpszProc );
return NULL;
}

View File

@@ -364,7 +364,7 @@ void xlib_brw_buffer_subdata_typed( struct pipe_winsys *pws,
unsigned data_type )
{
unsigned aub_type = DW_GENERAL_STATE;
unsigned aub_sub_type;
unsigned aub_sub_type = 0;
switch (data_type) {
case BRW_CC_VP:

View File

@@ -303,6 +303,7 @@ xm_flush_frontbuffer(struct pipe_winsys *pws,
*/
XMesaContext xmctx = (XMesaContext) context_private;
xlib_softpipe_display_surface(xmctx->xm_buffer, surf);
xmesa_check_and_update_buffer_size(xmctx, xmctx->xm_buffer);
}

View File

@@ -481,6 +481,8 @@ static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen,
psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
psc->driver_configs = driver_configs;
psp->destroyScreen = dri2DestroyScreen;
psp->createContext = dri2CreateContext;
psp->createDrawable = dri2CreateDrawable;

View File

@@ -418,6 +418,8 @@ 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);
psc->driver_configs = 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.

View File

@@ -401,7 +401,7 @@ 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);
psc->driver_configs = driver_configs;
psp->destroyScreen = driDestroyScreen;
psp->createContext = driCreateContext;

View File

@@ -501,6 +501,8 @@ struct __GLXscreenConfigsRec {
__GLXDRIscreen *driScreen;
const __DRIconfig** driver_configs;
#ifdef __DRI_COPY_SUB_BUFFER
const __DRIcopySubBufferExtension *driCopySubBuffer;
#endif

View File

@@ -845,6 +845,34 @@ PUBLIC GLXPixmap glXCreateGLXPixmap(Display *dpy, XVisualInfo *vis,
req->glxpixmap = xid = XAllocID(dpy);
UnlockDisplay(dpy);
SyncHandle();
#ifdef GLX_DIRECT_RENDERING
do {
/* FIXME: Maybe delay __DRIdrawable creation until the drawable
* is actually bound to a context... */
__GLXdisplayPrivate *const priv = __glXInitialize(dpy);
__GLXDRIdrawable *pdraw;
__GLXscreenConfigs *psc;
__GLcontextModes *modes;
psc = &priv->screenConfigs[vis->screen];
if (psc->driScreen == NULL)
break;
modes = _gl_context_modes_find_visual(psc->visuals, vis->visualid);
pdraw = psc->driScreen->createDrawable(psc, pixmap, req->glxpixmap, modes);
if (pdraw == NULL) {
fprintf(stderr, "failed to create pixmap\n");
break;
}
if (__glxHashInsert(psc->drawHash, req->glxpixmap, pdraw)) {
(*pdraw->destroyDrawable) (pdraw);
return None; /* FIXME: Check what we're supposed to do here... */
}
} while (0);
#endif
return xid;
}

View File

@@ -149,6 +149,12 @@ FreeScreenConfigs(__GLXdisplayPrivate * priv)
Xfree((char *) psc->serverGLXexts);
#ifdef GLX_DIRECT_RENDERING
if (psc->driver_configs) {
for(unsigned int i = 0; psc->driver_configs[i]; i++)
free((__DRIconfig*)psc->driver_configs[i]);
free(psc->driver_configs);
psc->driver_configs = NULL;
}
if (psc->driScreen) {
psc->driScreen->destroyScreen(psc);
__glxHashDestroy(psc->drawHash);

View File

@@ -763,7 +763,7 @@ dri2CreateNewScreen(int scrn, int fd,
if (driDriverAPI.InitScreen2 == NULL)
return NULL;
psp = _mesa_malloc(sizeof(*psp));
psp = _mesa_calloc(sizeof(*psp));
if (!psp)
return 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

@@ -197,6 +197,11 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file,
GLuint used = batch->ptr - batch->map;
GLboolean was_locked = intel->locked;
if (intel->first_post_swapbuffers_batch == NULL) {
intel->first_post_swapbuffers_batch = intel->batch->buf;
drm_intel_bo_reference(intel->first_post_swapbuffers_batch);
}
if (used == 0) {
batch->cliprect_mode = IGNORE_CLIPRECTS;
return;

View File

@@ -505,7 +505,7 @@ intel_flush(GLcontext *ctx, GLboolean needs_mi_flush)
* each of N places that do rendering. This has worse performances,
* but it is much easier to get correct.
*/
if (intel->is_front_buffer_rendering) {
if (!intel->is_front_buffer_rendering) {
intel->front_buffer_dirty = GL_FALSE;
}
}
@@ -521,7 +521,27 @@ intelFlush(GLcontext * ctx)
static void
intel_glFlush(GLcontext *ctx)
{
struct intel_context *intel = intel_context(ctx);
intel_flush(ctx, GL_TRUE);
/* We're using glFlush as an indicator that a frame is done, which is
* what DRI2 does before calling SwapBuffers (and means we should catch
* people doing front-buffer rendering, as well)..
*
* Wait for the swapbuffers before the one we just emitted, so we don't
* get too many swaps outstanding for apps that are GPU-heavy but not
* CPU-heavy.
*
* Unfortunately, we don't have a handle to the batch containing the swap,
* and getting our hands on that doesn't seem worth it, so we just us the
* first batch we emitted after the last swap.
*/
if (intel->first_post_swapbuffers_batch != NULL) {
drm_intel_bo_wait_rendering(intel->first_post_swapbuffers_batch);
drm_intel_bo_unreference(intel->first_post_swapbuffers_batch);
intel->first_post_swapbuffers_batch = NULL;
}
}
void
@@ -787,6 +807,8 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
intel->prim.vb = NULL;
dri_bo_unreference(intel->prim.vb_bo);
intel->prim.vb_bo = NULL;
dri_bo_unreference(intel->first_post_swapbuffers_batch);
intel->first_post_swapbuffers_batch = NULL;
if (release_texture_heaps) {
/* This share group is about to go away, free our private
@@ -804,6 +826,9 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
/* free the Mesa context */
_mesa_free_context_data(&intel->ctx);
FREE(intel);
driContextPriv->driverPrivate = NULL;
}
}

View File

@@ -191,6 +191,7 @@ struct intel_context
GLboolean ttm;
struct intel_batchbuffer *batch;
drm_intel_bo *first_post_swapbuffers_batch;
GLboolean no_batch_wrap;
unsigned batch_id;

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

@@ -305,7 +305,7 @@ intelDestroyScreen(__DRIscreenPrivate * sPriv)
dri_bufmgr_destroy(intelScreen->bufmgr);
intelUnmapScreenRegions(intelScreen);
driDestroyOptionCache(&intelScreen->optionCache);
driDestroyOptionInfo(&intelScreen->optionCache);
FREE(intelScreen);
sPriv->private = NULL;
@@ -617,10 +617,10 @@ intel_init_bufmgr(intelScreenPrivate *intelScreen)
/* Otherwise, use the classic buffer manager. */
if (intelScreen->bufmgr == NULL) {
if (gem_disable) {
fprintf(stderr, "GEM disabled. Using classic.\n");
_mesa_warning(NULL, "GEM disabled. Using classic.");
} else {
fprintf(stderr, "Failed to initialize GEM. "
"Falling back to classic.\n");
_mesa_warning(NULL,
"Failed to initialize GEM. Falling back to classic.");
}
if (intelScreen->tex.size == 0) {

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