Compare commits

...

112 Commits

Author SHA1 Message Date
Brian Paul
d0c391b6a2 docs: set 7.4.4 release date 2009-06-23 18:53:31 -06:00
Brian Paul
eaed8dc609 mesa: bump version to 7.4.4 2009-06-22 15:27:03 -06:00
Brian Paul
b5609e6444 docs: release notes for 7.4.4 2009-06-22 15:26:19 -06:00
Brian Paul
0b870bbb2a docs: 7.4.3 MD5 checksums 2009-06-22 11:24:09 -06:00
Brian Paul
1dbbc39f48 intel: added a null ptr check
This was hit during screen tear-down.
2009-06-22 11:23:44 -06:00
Brian Paul
4b8cd0b0ad intel: call _mesa_unreference_framebuffer() in intelDestroyBuffer()
This was a call to _mesa_reference_framebuffer(ptr, NULL) but the NULL
pointer is incorrect in Mesa 7.4.x.

Fixes a failed assertion during screen tear-down.
2009-06-22 11:23:13 -06:00
Brian Paul
5d387a35ff docs: set 7.4.3 release date 2009-06-19 15:16:01 -06:00
Brian Paul
2ae6859215 docs: bump version to 7.4.3 2009-06-19 15:14:49 -06:00
Brian Paul
afe0ca1f3f mesa: rework viewport/scissor initialization code
The first time a context is bound to a drawable, the viewport and scissor
bounds are initialized to the buffer's size.  This is actually a bit tricky.

A new _mesa_check_init_viewport() function is called in several places
to check if the viewport has been initialized.  We also use a new
ctx->ViewportInitialized flag instead of the overloaded
ctx->FirstTimeCurrent flag.

Hand-picked from mesa_7_5_branch, commit 3f856c6b6b
2009-06-17 08:43:17 -06:00
Brian Paul
6b782231d0 mesa: added null ptr check in Fake_glXCreatePixmap()
Fixes segfault in progs/xdemos/glxgears_pixmap.c

(cherry picked from master, commit d18c57aaea)
2009-06-17 08:40:16 -06:00
Brian Paul
2b890c9818 docs: document GLX/glean makeCurrent fix 2009-06-17 08:06:50 -06:00
Brian Paul
e0b13e15f1 GLX: attempt to fix glean makeCurrent test cases.
Two parts to this:

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

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

(cherry picked from master, commit 77506dac8e)
2009-06-17 08:05:54 -06:00
Brian Paul
420c74b870 docs: document viewport clamping bug 2009-06-16 09:40:22 -06:00
Brian Paul
a64f994a3a mesa: fix incorrect viewport clamping in _mesa_set_viewport()
A 0 by 0 viewport size is legal.  Don't clamp against lower bound of one.
The error checking earlier in the function prevents negative values.
2009-06-16 09:39:33 -06:00
Brian Paul
c568446dc6 docs: fixed bug 21872 2009-06-16 08:48:26 -06:00
Brian Paul
acbf9c6f3c mesa: fix REMAINDER() macro
The results were incorrect for some negative values of A.
See bug 21872.

(cherry picked from mesa_7_5_branch, commit ed7f4b4230)
2009-06-16 08:48:12 -06:00
Brian Paul
3b842feead docs: recent fixes for 7.4.3 2009-06-15 16:24:03 -06:00
Brian Paul
6d62b8d5c1 intel: Release fb backing regions in intelDestroyBuffer()
Fixes memory leak when destroying framebuffers.

(cherry picked from mesa_7_5_branch, commit d027e8feff)
2009-06-15 16:22:54 -06:00
Brian Paul
02659868e8 glsl: fix warnings, update comments, s/TRUE/GL_TRUE/
(cherry picked from master, commit 7fdd64ab29)
2009-06-10 12:26:12 -06:00
Brian Paul
457f4efab0 glsl: Handle continuation characters in preprocessor.
(cherry picked from master, commit cc22620e4b)
2009-06-10 12:25:35 -06:00
Brian Paul
0269eb5e3f glsl: Fix symbol replacement handling in preprocessor.
(cherry picked from master, commit d9617deb00)
2009-06-10 12:25:11 -06:00
Brian Paul
b7d9be69b2 glsl: Expand nested preprocessor macros.
(cherry picked from master, commit ef8caec29a)
2009-06-10 12:24:52 -06:00
Brian Paul
7b8b856c97 glsl: Fix preprocessor define argument parsing for dead sections.
(cherry picked from master, commit 19a54d9f10)
2009-06-10 12:24:32 -06:00
Brian Paul
24bffc4cc2 glsl: preprocessor debug code (disabled)
(cherry picked from master, commit 854151ba62)
2009-06-10 12:24:11 -06:00
Brian Paul
586341afd9 docs: document recent bug fixes for 7.4.x 2009-06-05 17:30:51 -06:00
Dan Nicholson
1e4334f623 osmesa: Link with -ldl for dlopen code
Now that the dlopen wrappers are built into libmesa.a, we need to link
standalone libOSMesa with libdl to resolve dlopen and friends on
platforms that need it.
(cherry picked from commit 4795dd5950)
2009-06-04 19:45:58 -07:00
Dan Nicholson
8861577fd1 osmesa: Allow building standalone in all three channel widths
autoconf had been designating the 8 bit libOSMesa as the default
standalone osmesa, but the Makefile expected it to be linked to libGL.
Fix up the osmesa Makefile so that it allows any of the combinations of
standalone and channel width to be built.

Fixes bug #21980.
(cherry picked from commit 7441dcd90b)
2009-06-04 19:05:48 -07:00
Brian Paul
cf997e0d2e mesa: fix loop over generic attribs in update_arrays()
(cherry picked from commit 1045481dd9)
2009-06-01 15:04:35 -06:00
Brian Paul
506d340363 demos: fix multitex.c VertCoord attribute mapping
If the multitex.vert shader uses the VertCoord generic vertex attribute
instead of the pre-defined gl_Vertex attribute, we need to make sure that
VertCoord gets bound to generic vertex attribute zero.

That's because we need to call glVertexAttrib2fv(0, xy) after all the other
vertex attributes have been set since setting generic attribute 0 triggers
vertex submission.  Before, we wound up issuing the vertex attributes in
the order 0, 1, 2 which caused the first vertex to be submitted before all
the attributes were set.  Now, the attributes are set in 1, 2, 0 order.

(cherry picked from commit 58fadc6242)
2009-05-22 13:20:48 -06:00
Brian Paul
9dbe32f5eb vbo: fix crash in vbo_exec_bind_arrays()
When a vertex shader uses generic vertex attribute 0, but not gl_Vertex,
we need to set attribute[16] to point to attribute[0].  We were setting the
attribute size, but not the pointer.

Fixes crash in glsl/multitex.c when using the VertCoord attribute instead
of gl_Vertex.

(cherry picked from commit c3538969e1)
2009-05-22 13:19:42 -06:00
Brian Paul
9adca8814d mesa: allow GL_BITMAP type in _mesa_image_image_stride()
It's possible to hand a GL_COLOR_INDEX/GL_BITMAP image to glTexImage3D()
which gets converted to RGBA via the glPixelMap tables.

This fixes a failure with piglit/fdo10370 with Gallium.

(cherry picked from commit 995456f930)
2009-05-22 09:38:18 -06:00
Brian Paul
8125c5ce92 docs: updates for version 7.4.3 2009-05-22 07:13:47 -06:00
Brian Paul
ba3f8dc0aa mesa: bump version to 7.4.3 2009-05-22 07:13:34 -06:00
Brian Paul
85cf1675d4 mesa: bump version to 7.4.3 2009-05-22 07:13:30 -06:00
Brian Paul
3aeace2928 vbo: fix incorrect loop limit in bind_array_obj()
The generic_array[] is 16 elements in size, but the loop was doing 32
iterations.  The out of bounds array write was clobbering the following
inputs[] array but as luck would have it, that didn't matter.

(cherry picked from commit 8da09e6924)
2009-05-22 07:10:47 -06:00
Brian Paul
0edb61afef docs: add glGet case for GL_VERTEX_ARRAY_BINDING_APPLE 2009-05-22 07:08:38 -06:00
Brian Paul
accffe2b73 mesa: add missing glGet*() case for GL_VERTEX_ARRAY_BINDING_APPLE
(cherry picked from commit 70c4b81e88)
2009-05-22 07:07:38 -06:00
Brian Paul
35f5222ae0 mesa: remove texUnit->_Current = NULL assignment
A follow-on to commit 46a2aad2cf which
fixes a texture object memory leak.

See bug 21756.
2009-05-20 08:14:45 -06:00
Brian Paul
1096a6c579 docs: 7.4.3 relnotes edits 2009-05-19 10:06:58 -06:00
Brian Paul
1eb59f49a4 docs: start 7.4.3 release notes 2009-05-19 10:06:09 -06:00
Brian Paul
63d1e89138 mesa: allow depth/stencil textures to be attached to GL_STENCIL_ATTACHMENT
See sourceforge bug #2793846.

(cherry picked from commit 042d9a5132)
2009-05-19 10:04:17 -06:00
Brian Paul
3ed7e9bfcc mesa: assign trb->Base.StencilBits in update_wrapper().
When we render to a depth/stencil texture there are stencil bits.

(cherry picked from commit c99a60c40d)
2009-05-19 10:02:55 -06:00
Brian Paul
46a2aad2cf mesa: fix texture object reference counting in texture_override()
Fixes bug 21756: r200: Mesa-7.4.2 release regression: "Quit on exit".
2009-05-19 09:03:19 -06:00
Aidan Thornton
b5eafa2d51 Initialize psp->waitX/waitGL for swrast_dri.so.
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21053 .
(cherry picked from commit f2445dfd85)
2009-05-18 12:51:12 +02:00
Brian Paul
d1fcb4a263 docs 7.4.2 tarball md5 sums 2009-05-15 06:32:24 -06:00
Brian Paul
da709f163f docs: set 7.4.2 release date 2009-05-15 06:21:56 -06:00
Brian Paul
3a1bcbe579 mesa: bump version to 7.4.2 2009-05-14 13:20:13 -06:00
Brian Paul
ec863602f2 i965: fix render to FBO/texture orientation bugs
Anytime we're not rendering to the default/window FBO, need to invert
rendering, not just when rendering to a texture.  Otherwise, if a FBO
consists of a mix of textures and renderbuffers the up/down orientation
was inconsistant.

Fixes shadowtex.c bad rendering.
(cherry picked from commit ba367f68cc)
2009-05-13 14:13:46 -07:00
Brian Paul
2ff47b80f5 docs: updated bug fix list for 7.4.2 2009-05-11 09:49:46 -06:00
Brian Paul
63cde0ea0e mesa: Fixed a texture memory leak
The current texture for any particular texture unit is given an additional
reference in update_texture_state(); but if the context is closed before
that texture can be released (which is quite frequent in normal use, unless
a program unbinds and deletes the texture and renders without it to force
a call to update_texture_state(), the memory is lost.

This affects general Mesa; but the i965 is particularly affected because
it allocates a considerable amount of additional memory for each allocated
texture.

(cherry picked from master, commit c230767d69)
2009-05-11 09:47:17 -06:00
Eric Anholt
c521d4629b Flag GLSL programs as depending on constant state when they use uniforms.
This is not a cherry-pick, as it got fixed in master with the
_NEW_PROGRAM_CONSTANTS change.  Fixes bad rendering with various GLSL programs
idr and I have been writing.
2009-05-05 12:14:29 -07:00
Brian Paul
e9d5569bf3 glx: replace Xmalloc() calls with Xcalloc()
Fixes a bug where psp->WaitX was uninitialized.  Reported by Chris Clayton.

(cherry picked from commit dd4c142e90)
2009-05-04 08:34:20 -06:00
Brian Paul
6337525497 mesa: fix state validation bug for glCopyTex[Sub]Image()
We need to make sure the framebuffer state is up to date to make sure we
read pixels from the right buffer when doing a texture image copy.

(cherry-picked from master, commit 63f0130980)
2009-05-01 20:24:39 -06:00
Brian Paul
7541c3806a docs: fix typos 2009-04-30 17:08:37 -06:00
Michel Dänzer
a1ce4efefb r300: Increase reference count of texture objects referenced by current state.
Fixes a use-after-free reported in
http://bugs.freedesktop.org/show_bug.cgi?id=20539, so this possibly fixes that
bug. It has been confirmed to fix
http://bugs.freedesktop.org/show_bug.cgi?id=17895 .
(cherry picked from commit c28707b507)
2009-04-30 13:50:36 +02:00
Brian Paul
656cd707db mesa: Fix buffer overflow when parsing generic vertex attributes.
(cherry picked from master, commit fa92756400)
2009-04-28 10:58:13 -06:00
Alex Deucher
ce7f78694d R300: add quadpipe overrides
RV410 SE chips only have 1 quadpipe.
Also, handle other R300 chip with quadpipe override
2009-04-28 12:40:04 -04:00
Brian Paul
fd95e8ee33 docs: fix swrast texrect bug 21461 2009-04-28 09:11:05 -06:00
Brian Paul
d2b8c41b7a swrast: add missing break in clamp_rect_coord_linear()
See bug 21461.

(cherry picked from master, commit dcf571aff9)
2009-04-28 09:09:41 -06:00
Alan Hourihane
bfd6bb31a6 demos: ensure display lists are destroyed for next generation 2009-04-24 17:22:52 +01:00
Eric Anholt
c3e7fc394f i965: Support drawing to FBO cube faces other than positive X.
Also fixes drawing to 3D texture depth levels.
(cherry picked from commit 8374379572)
2009-04-23 14:05:58 -07:00
Eric Anholt
dd56897b27 intel: Fix commented-out glViewport in intel_meta_set_passthrough_transform.
Too much commit -a while debugging.
(cherry picked from commit 8910da5b7a)
2009-04-23 14:00:56 -07:00
Brian Paul
e8807a14a6 fixed intel front-buffer rendering segfault 2009-04-20 16:13:04 -06:00
Brian Paul
c38397866d intel: added null screen->dri2.loader pointer check
Fixes front-buffer rendering with DRI1.
2009-04-20 16:12:16 -06:00
Brian Paul
dce84002c2 docs: create 7.4.2 release notes page 2009-04-18 11:12:41 -06:00
Brian Paul
c490349825 docs: remove unused sections 2009-04-18 11:12:33 -06:00
Brian Paul
f62d45fd0d docs: MD5 sums for 7.4.1 release 2009-04-18 11:03:25 -06:00
Brian Paul
b2dfc29a82 intel: update driver date, remove RC3 designation 2009-04-18 10:51:41 -06:00
Brian Paul
7c1e61f41c mesa: bump version to 7.4.1 2009-04-18 10:49:35 -06:00
Brian Paul
5654197d12 docs: prep for 7.4.1 release 2009-04-18 10:49:08 -06:00
Brian Paul
87cb55e9c6 mesa: bump version to 7.4.1 2009-04-18 10:48:57 -06:00
Brian Paul
e7d499f935 mesa: add switch case for GL_VERTEX_STATE_PROGRAM_NV in _mesa_new_program()
Fixes bug seen in progs/tests/vptest1.c

(cherry picked from master, commit c5af2ed60f)
2009-04-18 10:21:00 -06:00
Michel Dänzer
51e7600d77 intel: Handle ARB_vertex_buffer_object state in intel_clear_tris().
Fixes gearsvbo app by Michael Clark.
(cherry picked from commit 54fb6f0053)
2009-04-18 15:53:08 +02:00
Brian Paul
69b17abd6b intel: make sure polygon mode is set properly in intel_clear_tris()
Fixes progs/glsl/skinning.c demo.

(cherry picked from master, commit 794d488e6d)
2009-04-17 16:14:39 -06:00
Brian Paul
a975da7aca docs: fixed user clip plane restore bug in glPopAttrib() 2009-04-16 10:16:38 -06:00
Brian Paul
ecf47b5046 mesa: fix bad mask bit in clip plane restore code for glPopAttrib()
(cherry picked from master commit d82876e850)
2009-04-16 10:16:26 -06:00
Brian Paul
fed8dc53ad mesa: add distclean target to top-level Makefile
(cherry picked from master, commit 666702baec)
2009-04-16 09:34:06 -06:00
Brian Paul
1f462e26c0 demos: use larger buffer for snprintf() call, see bug 21220
(cherry picked from master, commit 0d0028e6df)
2009-04-16 09:26:54 -06:00
Ian Romanick
85396d8ef4 intel: Bump driver date 2009-04-15 15:12:48 -07:00
Ian Romanick
f11b84998d docs: more bug fixes for Mesa 7.4.1 2009-04-15 15:10:33 -07:00
Brian Paul
d2f6791062 glx: added null pointer check in glXGetFBConfigs()
Fixes segfault seen with glxinfo with NVIDIA OpenGL.

(cherry picked from master, commit 05471828dc)
2009-04-15 08:02:38 -06:00
Ian Romanick
49e0c74ddd DRI2: Don't fault on NULL DrawBuffer
It is possible for ctx->DrawBuffer to be NULL, so don't fault when
that happens.  This change is not being committed to master because it
doesn't appear to be necessary there.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2009-04-11 20:24:15 -07:00
Eric Anholt
83e14773c5 dri2: Don't crash if the server returns more buffers than expected.
(cherry picked from commit f967e8b507)
2009-04-09 15:15:33 -07:00
Ian Romanick
4605937843 intel / DRI2: Accept fake front-buffer from loader
Handle the loader returning a fake front-buffer.  Since the driver
never specifically requests a fake front-buffer, the driver assumes
that it will never receive both a fake and a real front-buffer.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@redhat.com>
(cherry picked from commit 6a6e478e55)
2009-04-09 14:44:53 -07:00
Ian Romanick
b8ef30c45c DRI2: Assume that there is always a front buffer
Assume that the front-buffer exists even if the server didn't tell the
client that it exists.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@redhat.com>
(cherry picked from commit e6386e0d9a)
2009-04-09 14:44:44 -07:00
Ian Romanick
4f17040cb1 intel / DRI2: Track and flush front-buffer rendering
Track two flags:  whether or not front-buffer rendering is currently
enabled and whether or not front-buffer rendering has been enabled
since the last glFlush.  If the second flag is set, the front-buffer
is flushed via a loader call back.  If the first flag is cleared, the
second flag is cleared at this time.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@redhat.com>
(cherry picked from commit 43cf0d1eeb)
2009-04-09 14:44:34 -07:00
Ian Romanick
98c2c9ef8c DRI2: Provide an interface for drivers to flush front-buffer rendering
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@redhat.com>
(cherry picked from commit 82634ee8df)
2009-04-09 14:44:17 -07:00
Brian Paul
d805c82068 mesa: fix potential recursive locking deadlock in _mesa_HashWalk()
If the walk callback called _mesa_HashRemove() we'd deadlock.

(cherry picked from master, commit deff099215)
2009-04-09 10:55:06 -06:00
Brian Paul
6c3bec4387 swrast: fix point rendering function selection
Need to clamp default point size to min/max range before checking if it's one.
Fixes glean pointAtten test.

(cherry picked from master, commit 228f20e324)
2009-04-07 13:44:50 -06:00
Brian Paul
7d3561c871 docs: more bug fixes for Mesa 7.4.1 2009-04-07 08:37:22 -06:00
Brian Paul
5c47d53924 mesa: in mesa_add_named_constant(), avoid adding duplicate constants
(cherry picked from master, commit 80197a0c1b)
2009-04-07 08:35:01 -06:00
Brian Paul
a18216308a mesa: fix parameter counting in ARB vertex/fragment program parsing
Duplicated unnamed constants were getting counted more than once.

(cherry picked from master, commit 866bdd0509)
2009-04-07 08:34:32 -06:00
Brian Paul
14f13fbcfa mesa: replace >= with > when testing if we've exceeded max local params
Now a program that uses 256 locals works as it should.

(cherry picked from master, commit a4173956eb)
2009-04-07 08:34:04 -06:00
Brian Paul
ca24095c1e mesa: only clear matrix MAT_DIRTY_INVERSE flag when we actually compute the inverse
If _math_matrix_analyse() got called before we allocated the inverse
matrix array we could lose the flag indicating that we needed to compute
the inverse.  This could happen with certain vertex shader cases.

(cherry picked from master, commit ce461ffc5a)
2009-04-07 08:33:43 -06:00
Brian Paul
d5e0e03d43 mesa: for OPCODE_LIT, use _mesa_pow() instead of exp() and log()
Also, s/pow/_mesa_pow/

(cherry picked from master, commit b8a200ac9d)
2009-04-07 08:32:42 -06:00
Michel Dänzer
775ca8e3fa radeon: Expose a 32 bit RGBA fbconfig even when the screen depth is 16.
Otherwise current xserver / libGL no longer expose a 32 bit RGBA GLX visual,
and compiz fails.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=20479 .

(Cherry picked from commit e798bf8053)
2009-04-06 09:27:17 +02:00
Brian Paul
39345a4928 mesa: don't normalize spot light direction until validation time
In glLight() we're only supposed to transform the direction by the modelview
matrix, not normalized it too.

(cherry picked from commit 650d147289)
2009-04-03 10:16:31 -06:00
Roland Scheidegger
7be149cfd1 mesa: fix TexParameter functions
premature return in TexParameterf caused mesa to never call Driver.TexParameter
breaking drivers relying on this (fix bug #20966).
While here, also fix using ctx->ErrorValue when deciding to call
Driver.TexParameter. Errors are sticky and uncleared errors thus would cause
this to no longer get called. Since we thus need return value of
set_tex_parameter[if] can also optimize this to only call when value changed.
2009-04-03 00:00:40 +02:00
Brian Paul
8c9d7b2474 docs: fix TXB texture unit bias error 2009-04-02 13:11:56 -06:00
Brian Paul
6ef0951b17 mesa: don't call ctx->Driver.ReadPixels() if width or height is zero
(cherry picked from commit master, 7b9bf39543)
2009-04-02 13:11:33 -06:00
Brian Paul
2b33b77337 mesa: don't call ctx->Driver.Draw/CopyPixels() if width or height is zero
(cherry picked from master, commit f6a3f1f52a)
2009-04-02 13:10:41 -06:00
Brian Paul
0590edeea0 mesa: use correct tex unit lod bias for TXB instruction
(cherry picked from master, commit 1ab225017e)
2009-04-02 13:09:32 -06:00
Brian Paul
7511d76bd7 swrast: fix glDrawBuffer(GL_FRONT_AND_BACK)
We weren't putting the right colors into the back buffer in this mode.

(cherry picked from master, commit 9cc79fc2dc)
2009-04-02 13:07:53 -06:00
Brian Paul
7f30aba920 docs: fix bug 20986 2009-04-01 07:39:43 -06:00
Brian Paul
4fa700260e glsl: fix texgen state variable tokens in emit_statevars()
This fixes broken variable indexing into the gl_Eye/ObjectPlaneS/T/R/Q arrays.
See bug 20986.

(cherry picked from master, commit f8dd6594bf)
2009-04-01 07:39:26 -06:00
Brian Paul
781fb79c59 docs: first 7.4.1 bug fixes 2009-03-31 16:29:23 -06:00
Brian Paul
5b7e9f2f3a mesa: fix bug in GPU codegen for fixed-function two-sided lighting
The 'dots' register wasn't getting properly un-negated and un-swizzled
after emitting the code for back-face lighting.  So, if more than one
light source was enabled, the specular exponent for the next light source
was wrong.

During execution we were evaluating pow(x, y) where y was negative instead
of positive.  This led to the outcome being zero or NaN.

This fixes the occasional black triangles seen in isosurf when hacked to
enable two-sided lighting.

(cherry picked from master, commit 919f57078b)
2009-03-31 16:28:17 -06:00
Brian Paul
d4d4b63d7f docs: prep for Mesa 7.4.1 release notes 2009-03-31 16:26:24 -06:00
Jeremy Huddleston
9e9fe51acd Updated CPU_TO_LE32 to work on darwin 2009-03-31 14:59:28 -07:00
Jeremy Huddleston
b65bc1b6cb Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined 2009-03-31 14:48:19 -07:00
Jeremy Huddleston
6cb796f6fc Updated darwin config for when X11 is not in the same location as we're installing to
(cherry picked from commit 7817fea0b6)
2009-03-31 14:37:27 -07:00
Brian Paul
de197cf991 docs: 7.4 release md5 sums 2009-03-27 19:12:16 -06:00
74 changed files with 1058 additions and 294 deletions

View File

@@ -35,6 +35,8 @@ realclean: clean
-name depend -o -name depend.bak ')' -exec rm -f '{}' ';'
distclean: realclean
install:
@for dir in $(SUBDIRS) ; do \
@@ -48,7 +50,9 @@ install:
linux-directfb-install:
cd src/mesa/drivers/directfb && $(MAKE) install
.PHONY: default doxygen clean realclean install linux-directfb-install
.PHONY: default doxygen clean realclean distclean install linux-directfb-install
# If there's no current configuration file
$(TOP)/configs/current:
@@ -174,7 +178,7 @@ ultrix-gcc:
# Rules for making release tarballs
VERSION=7.4
VERSION=7.4.4
DIRECTORY = Mesa-$(VERSION)
LIB_NAME = MesaLib-$(VERSION)
DEMO_NAME = MesaDemos-$(VERSION)

View File

@@ -6,6 +6,8 @@ CONFIG_NAME = darwin
INSTALL_DIR = /usr/X11
X11_DIR = $(INSTALL_DIR)
# Compiler and flags
CC = gcc
CXX = gcc
@@ -21,9 +23,9 @@ DEFINES = -D_DARWIN_C_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L \
ARCH_FLAGS += $(RC_CFLAGS)
CFLAGS = -ggdb3 -Os -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing \
-I$(INSTALL_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
-I$(INSTALL_DIR)/include -I$(X11_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
CXXFLAGS = -ggdb3 -Os -Wall -fno-strict-aliasing \
-I$(INSTALL_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
-I$(INSTALL_DIR)/include -I$(X11_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
# Library names (actual file names)
GL_LIB_NAME = libGL.dylib
@@ -39,12 +41,12 @@ GLUT_LIB_GLOB = libglut.*dylib
GLW_LIB_GLOB = libGLw.*dylib
OSMESA_LIB_GLOB = libOSMesa.*dylib
GL_LIB_DEPS = -L$(INSTALL_DIR)/$(LIB_DIR) -lX11 -lXext -lm -lpthread
GL_LIB_DEPS = -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXext -lm -lpthread
OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -lX11 -lXmu -lXi -lXext
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -lX11 -lXt
APP_LIB_DEPS = -L$(TOP)/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -lX11 -lXmu -lXt -lXi -lm
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXi -lXext
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXt
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXt -lXi -lm
# omit glw lib for now:
SRC_DIRS = glx/x11 mesa glu glut/glx

View File

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

View File

@@ -786,12 +786,12 @@ case "$mesa_driver" in
osmesa)
# only link libraries with osmesa if shared
if test "$enable_static" = no; then
OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
else
OSMESA_LIB_DEPS=""
fi
OSMESA_MESA_DEPS=""
OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS"
OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
;;
*)
# Link OSMesa to libGL otherwise
@@ -805,9 +805,6 @@ osmesa)
OSMESA_PC_REQ="gl"
;;
esac
if test "$enable_static" = no; then
OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS"
fi
OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
AC_SUBST([OSMESA_LIB_DEPS])
AC_SUBST([OSMESA_MESA_DEPS])

View File

@@ -9,9 +9,7 @@
<H1>Downloading</H1>
<p>
Current stable release: <b>7.4</b>
<br>
Last unstable/development release: <b>7.3</b>
Current stable release: <b>7.4.3</b>
</p>
<p>

View File

@@ -11,6 +11,35 @@
<H1>News</H1>
<h2>June 23, 2009</h2>
<p>
<a href="relnotes-7.4.4.html">Mesa 7.4.4</a> is released.
This is a stable release that fixes a regression in the i915/i965 drivers
that slipped into the 7.4.3 release.
</p>
<h2>June 19, 2009</h2>
<p>
<a href="relnotes-7.4.3.html">Mesa 7.4.3</a> is released.
This is a stable release fixing bugs since the 7.4.2 release.
</p>
<h2>May 15, 2009</h2>
<p>
<a href="relnotes-7.4.2.html">Mesa 7.4.2</a> is released.
This is a stable release fixing bugs since the 7.4.1 release.
</p>
<h2>April 18, 2009</h2>
<p>
<a href="relnotes-7.4.1.html">Mesa 7.4.1</a> is released.
This is a stable release fixing bugs since the 7.4 release.
</p>
<h2>March 27, 2009</h2>
<p>
<a href="relnotes-7.4.html">Mesa 7.4</a> is released.

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

@@ -0,0 +1,79 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.4.1 Release Notes / 18 April 2009</H1>
<p>
Mesa 7.4.1 is a stable development release fixing bugs since the 7.4 release.
</p>
<p>
Mesa 7.4.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>
0c3a72f3295a53a134c04bd7d209ea62 MesaLib-7.4.1.tar.gz
423260578b653818ba66c2fcbde6d7ad MesaLib-7.4.1.tar.bz2
84f78b154d4bd5c3ecc42eeff2e56676 MesaLib-7.4.1.zip
aa0ad323e59d6d10ff33ac0dde462a60 MesaDemos-7.4.1.tar.gz
1e169fb6abc2b45613f1c98a82dfe690 MesaDemos-7.4.1.tar.bz2
294e42be2d74176596c994ec23322fcf MesaDemos-7.4.1.zip
92373bfa48e7b68dddf356e86b0e5699 MesaGLUT-7.4.1.tar.gz
336f3824b578b072211e0beecf4f04f4 MesaGLUT-7.4.1.tar.bz2
20751388d8ef16b42d25d9e3d705d101 MesaGLUT-7.4.1.zip
</pre>
<h2>Bug fixes</h2>
<ul>
<li>Fixed a two-sided lighting bug in fixed-function-to-GPU code generation
<li>Fixed some Darwin issues (Jeremy Huddleston)
<li>Indexing the GLSL gl_EyePlane[] or gl_ObjectPlane[] arrays with a variable
was broken, bug 20986
<li>Fixed incorrect texture unit bias in TXB instruction
<li>glTexParameter settings weren't always propogated to drivers
<li>Assorted vertex/fragment program bug fixes
<li>Fixed point rendering in software rasterizer
<li>Fixed potential deadlock in object hash functions
<li>Fix a couple bugs surrounding front-buffer rendering with DRI2, but this
is not quite complete.
<li>Fixed glPopAttrib() bug when restoring user clip planes
</ul>
<h2>Driver Status</h2>
<pre>
Driver Status
---------------------- ----------------------
DRI drivers varies with the driver
XMesa/GLX (on Xlib) implements OpenGL 2.1
OSMesa (off-screen) implements OpenGL 2.1
Windows/Win32 implements OpenGL 2.1
Glide (3dfx Voodoo1/2) implements OpenGL 1.3
SVGA unsupported
Wind River UGL unsupported
DJGPP unsupported
GGI unsupported
BeOS unsupported
Allegro unsupported
D3D unsupported
</pre>
</body>
</html>

74
docs/relnotes-7.4.2.html Normal file
View File

@@ -0,0 +1,74 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.4.2 Release Notes / May 15, 2009</H1>
<p>
Mesa 7.4.2 is a stable development release fixing bugs since the 7.4.1 release.
</p>
<p>
Mesa 7.4.2 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>
172f5193154dad731387f97bd44ab68f MesaLib-7.4.2.tar.gz
b10a76e32bde4645cfc34ea0416d7d8b MesaLib-7.4.2.tar.bz2
cc6dfc2efd424cc342b84e6bcd78ce5d MesaLib-7.4.2.zip
182a7e78aa7a480b3650a5c956dbddd1 MesaDemos-7.4.2.tar.gz
bf559a0485667a3bfa4513a23501579b MesaDemos-7.4.2.tar.bz2
5379e622b65e8c22022dba34aeb6f4f9 MesaDemos-7.4.2.zip
7cc43c1c35bf6a279a16e063dea3b8c5 MesaGLUT-7.4.2.tar.gz
e0dfc44d537904a030861e5b3c760c11 MesaGLUT-7.4.2.tar.bz2
4a6cf5bbbac190d6ba97448b3098b7f4 MesaGLUT-7.4.2.zip
</pre>
<h2>Bug fixes</h2>
<ul>
<li>Fixed segfault when rendering to front buffer with DRI 1.
<li>Fixed swrast texture rectangle bug when wrap mode = GL_CLAMP_TO_BORDER and
filter mode = GL_LINEAR. (bug 21461)
<li>Fixed texture object mem leak during context destruction.
<li>Fixed a state validation bug in glCopyTex[Sub]Image()
<li>Fixed some i965 GLSL bugs.
<li>Fixed an R300 driver texture object bad memory reference.
</ul>
<h2>Driver Status</h2>
<pre>
Driver Status
---------------------- ----------------------
DRI drivers varies with the driver
XMesa/GLX (on Xlib) implements OpenGL 2.1
OSMesa (off-screen) implements OpenGL 2.1
Windows/Win32 implements OpenGL 2.1
Glide (3dfx Voodoo1/2) implements OpenGL 1.3
SVGA unsupported
Wind River UGL unsupported
DJGPP unsupported
GGI unsupported
BeOS unsupported
Allegro unsupported
D3D unsupported
</pre>
</body>
</html>

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

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

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

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

View File

@@ -20,13 +20,21 @@ 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 ardware acceleration.
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
tbd
ed6bd7437177307e51e16d0c7c381dfa MesaLib-7.4.tar.gz
7ecddb341a2691e0dfdb02f697109834 MesaLib-7.4.tar.bz2
433e823f8245f9fd5f397e7b719a8e47 MesaLib-7.4.zip
656eee6128016fb237e01aa8dabbc703 MesaDemos-7.4.tar.gz
02816f10f30b1dc5e069e0f68c177c98 MesaDemos-7.4.tar.bz2
44a70d6db4aa4c64ecc47871b6aceee8 MesaDemos-7.4.zip
25f80db4f8645cd3e58e2c9af53ec341 MesaGLUT-7.4.tar.gz
04ec01caebde44f5b0d619f00716b368 MesaGLUT-7.4.tar.bz2
019dc213baecaa3cb1278847d41b8591 MesaGLUT-7.4.zip
</pre>

View File

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

View File

@@ -636,7 +636,7 @@ struct __DRIbufferRec {
};
#define __DRI_DRI2_LOADER "DRI_DRI2Loader"
#define __DRI_DRI2_LOADER_VERSION 1
#define __DRI_DRI2_LOADER_VERSION 2
struct __DRIdri2LoaderExtensionRec {
__DRIextension base;
@@ -644,6 +644,19 @@ struct __DRIdri2LoaderExtensionRec {
int *width, int *height,
unsigned int *attachments, int count,
int *out_count, void *loaderPrivate);
/**
* Flush pending front-buffer rendering
*
* Any rendering that has been performed to the
* \c __DRI_BUFFER_FAKE_FRONT_LEFT will be flushed to the
* \c __DRI_BUFFER_FRONT_LEFT.
*
* \param driDrawable Drawable whose front-buffer is to be flushed
* \param loaderPrivate Loader's private data that was previously passed
* into __DRIdri2ExtensionRec::createNewDrawable
*/
void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate);
};
/**

View File

@@ -271,9 +271,24 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile,
InitUniforms(program, uniforms);
VertCoord_attr = glGetAttribLocation_func(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");
/* re-link */
glLinkProgram_func(program);
/* VertCoord_attr should be zero now */
VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
assert(VertCoord_attr == 0);
}
TexCoord0_attr = glGetAttribLocation_func(program, "TexCoord0");
TexCoord1_attr = glGetAttribLocation_func(program, "TexCoord1");
VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
printf("TexCoord0_attr = %d\n", TexCoord0_attr);
printf("TexCoord1_attr = %d\n", TexCoord1_attr);
printf("VertCoord_attr = %d\n", VertCoord_attr);

View File

@@ -103,7 +103,7 @@ static void PrintColorStrings( void )
{
GLubyte ubbuf[3];
int i, xleft, xright;
char colorString[18];
char colorString[100];
xleft = 5 + windW/4;
xright = 5 + windW/2;

View File

@@ -385,6 +385,10 @@ draw( Display *dpy, Window win )
} else
do_draw();
glDeleteLists(gear1, 1);
glDeleteLists(gear2, 1);
glDeleteLists(gear3, 1);
glXSwapBuffers(dpy, win);
glXDestroyContext(dpy, ctx);
}

View File

@@ -253,7 +253,7 @@ DRI2Buffer *DRI2GetBuffers(Display *dpy, XID drawable,
*height = rep.height;
*outCount = rep.count;
buffers = Xmalloc(count * sizeof buffers[0]);
buffers = Xmalloc(rep.count * sizeof buffers[0]);
if (buffers == NULL) {
_XEatData(dpy, rep.count * sizeof repBuffer);
UnlockDisplay(dpy);

View File

@@ -74,7 +74,6 @@ struct __GLXDRIdrawablePrivateRec {
int bufferCount;
int width, height;
int have_back;
int have_front;
int have_fake_front;
};
@@ -195,7 +194,7 @@ static void dri2CopySubBuffer(__GLXDRIdrawable *pdraw,
XserverRegion region;
/* Check we have the right attachments */
if (!(priv->have_front && priv->have_back))
if (!priv->have_back)
return;
xrect.x = x;
@@ -223,7 +222,7 @@ static void dri2WaitX(__GLXDRIdrawable *pdraw)
XserverRegion region;
/* Check we have the right attachments */
if (!(priv->have_fake_front && priv->have_front))
if (!priv->have_fake_front)
return;
xrect.x = 0;
@@ -243,7 +242,7 @@ static void dri2WaitGL(__GLXDRIdrawable *pdraw)
XRectangle xrect;
XserverRegion region;
if (!(priv->have_fake_front && priv->have_front))
if (!priv->have_fake_front)
return;
xrect.x = 0;
@@ -257,6 +256,15 @@ static void dri2WaitGL(__GLXDRIdrawable *pdraw)
XFixesDestroyRegion(pdraw->psc->dpy, region);
}
static void dri2FlushFrontBuffer(__DRIdrawable *driDrawable,
void *loaderPrivate)
{
(void) driDrawable;
dri2WaitGL((__GLXDRIdrawable *) loaderPrivate);
}
static void dri2DestroyScreen(__GLXscreenConfigs *psc)
{
/* Free the direct rendering per screen data */
@@ -283,7 +291,6 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
pdraw->width = *width;
pdraw->height = *height;
pdraw->bufferCount = *out_count;
pdraw->have_front = 0;
pdraw->have_fake_front = 0;
pdraw->have_back = 0;
@@ -295,8 +302,6 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
pdraw->buffers[i].pitch = buffers[i].pitch;
pdraw->buffers[i].cpp = buffers[i].cpp;
pdraw->buffers[i].flags = buffers[i].flags;
if (pdraw->buffers[i].attachment == __DRI_BUFFER_FRONT_LEFT)
pdraw->have_front = 1;
if (pdraw->buffers[i].attachment == __DRI_BUFFER_FAKE_FRONT_LEFT)
pdraw->have_fake_front = 1;
if (pdraw->buffers[i].attachment == __DRI_BUFFER_BACK_LEFT)
@@ -311,6 +316,7 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
static const __DRIdri2LoaderExtension dri2LoaderExtension = {
{ __DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION },
dri2GetBuffers,
dri2FlushFrontBuffer
};
static const __DRIextension *loader_extensions[] = {

View File

@@ -600,7 +600,7 @@ static __GLXDRIscreen *driCreateScreen(__GLXscreenConfigs *psc, int screen,
char *driverName;
int i;
psp = Xmalloc(sizeof *psp);
psp = Xcalloc(1, sizeof *psp);
if (psp == NULL)
return NULL;

View File

@@ -359,7 +359,7 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen,
const char *driverName = "swrast";
int i;
psp = Xmalloc(sizeof *psp);
psp = Xcalloc(1, sizeof *psp);
if (psp == NULL)
return NULL;
@@ -405,6 +405,8 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen,
psp->createContext = driCreateContext;
psp->createDrawable = driCreateDrawable;
psp->swapBuffers = driSwapBuffers;
psp->waitX = NULL;
psp->waitGL = NULL;
return psp;

View File

@@ -1702,7 +1702,8 @@ PUBLIC GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements)
int i;
*nelements = 0;
if ( (priv->screenConfigs != NULL)
if ( priv
&& (priv->screenConfigs != NULL)
&& (screen >= 0) && (screen <= ScreenCount(dpy))
&& (priv->screenConfigs[screen].configs != NULL)
&& (priv->screenConfigs[screen].configs->fbconfigID != GLX_DONT_CARE) ) {

View File

@@ -429,7 +429,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
&dummy_reply);
}
#ifdef GLX_DIRECT_RENDERING
else if (oldGC->driContext) {
else if (oldGC->driContext && oldGC != gc) {
oldGC->driContext->unbindContext(oldGC->driContext);
}
#endif

View File

@@ -5198,9 +5198,13 @@ glDeleteTexturesEXT(GLsizei n, const GLuint * textures)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_DeleteTextures(GET_DISPATCH(), (n, textures));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
@@ -5266,9 +5270,13 @@ glGenTexturesEXT(GLsizei n, GLuint * textures)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GenTextures(GET_DISPATCH(), (n, textures));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 4;
@@ -5328,9 +5336,13 @@ glIsTextureEXT(GLuint texture)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
return CALL_IsTexture(GET_DISPATCH(), (texture));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
GLboolean retval = (GLboolean) 0;
@@ -5641,9 +5653,13 @@ glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid * table)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
@@ -5714,10 +5730,14 @@ glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetColorTableParameterfv(GET_DISPATCH(),
(target, pname, params));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -5784,10 +5804,14 @@ glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetColorTableParameteriv(GET_DISPATCH(),
(target, pname, params));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -6107,10 +6131,14 @@ gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type,
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetConvolutionFilter(GET_DISPATCH(),
(target, format, type, image));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
@@ -6182,10 +6210,14 @@ gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetConvolutionParameterfv(GET_DISPATCH(),
(target, pname, params));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -6252,10 +6284,14 @@ gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetConvolutionParameteriv(GET_DISPATCH(),
(target, pname, params));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -6329,10 +6365,14 @@ gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format,
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetHistogram(GET_DISPATCH(),
(target, reset, format, type, values));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
@@ -6403,9 +6443,13 @@ gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -6471,9 +6515,13 @@ gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -6543,9 +6591,13 @@ gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format,
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
Display *const dpy = gc->currentDpy;
@@ -6614,9 +6666,13 @@ gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
@@ -6679,9 +6735,13 @@ gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params));
} else {
#else
{
#endif
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
const GLuint cmdlen = 8;

View File

@@ -119,6 +119,9 @@ static int driUnbindContext(__DRIcontext *pcp)
pdp = pcp->driDrawablePriv;
prp = pcp->driReadablePriv;
/* already unbound */
if (!pdp && !prp)
return GL_TRUE;
/* Let driver unbind drawable from context */
(*psp->DriverAPI.UnbindContext)(pcp);
@@ -143,9 +146,10 @@ static int driUnbindContext(__DRIcontext *pcp)
* window we can determine the last context bound to the window and
* use that context's lock. (BrianP, 2-Dec-2000)
*/
pcp->driDrawablePriv = pcp->driReadablePriv = NULL;
#if 0
/* Unbind the drawable */
pcp->driDrawablePriv = NULL;
pdp->driContextPriv = &psp->dummyContextPriv;
#endif

View File

@@ -43,10 +43,11 @@ static void upload_sf_vp(struct brw_context *brw)
const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
struct brw_sf_viewport sfv;
GLfloat y_scale, y_bias;
const GLboolean render_to_fbo = (ctx->DrawBuffer->Name != 0);
memset(&sfv, 0, sizeof(sfv));
if (intel_rendering_to_texture(ctx)) {
if (render_to_fbo) {
y_scale = 1.0;
y_bias = 0;
}
@@ -75,7 +76,7 @@ static void upload_sf_vp(struct brw_context *brw)
* Note that the hardware's coordinates are inclusive, while Mesa's min is
* inclusive but max is exclusive.
*/
if (intel_rendering_to_texture(ctx)) {
if (render_to_fbo) {
/* texmemory: Y=0=bottom */
sfv.scissor.xmin = ctx->DrawBuffer->_Xmin;
sfv.scissor.xmax = ctx->DrawBuffer->_Xmax - 1;
@@ -114,7 +115,7 @@ struct brw_sf_unit_key {
GLboolean scissor, line_smooth, point_sprite, point_attenuated;
float line_width;
float point_size;
GLboolean render_to_texture;
GLboolean render_to_fbo;
};
static void
@@ -147,7 +148,7 @@ sf_unit_populate_key(struct brw_context *brw, struct brw_sf_unit_key *key)
key->point_size = ctx->Point.Size;
key->point_attenuated = ctx->Point._Attenuated;
key->render_to_texture = intel_rendering_to_texture(&brw->intel.ctx);
key->render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
}
static dri_bo *
@@ -194,10 +195,10 @@ sf_unit_create_from_key(struct brw_context *brw, struct brw_sf_unit_key *key,
else
sf.sf5.front_winding = BRW_FRONTWINDING_CW;
/* The viewport is inverted for rendering to texture, and that inverts
/* The viewport is inverted for rendering to a FBO, and that inverts
* polygon front/back orientation.
*/
sf.sf5.front_winding ^= key->render_to_texture;
sf.sf5.front_winding ^= key->render_to_fbo;
switch (key->cull_face) {
case GL_FRONT:

View File

@@ -310,6 +310,7 @@ brw_update_region_surface(struct brw_context *brw, struct intel_region *region,
GLubyte color_mask[4];
GLboolean color_blend;
uint32_t tiling;
uint32_t draw_offset;
} key;
memset(&key, 0, sizeof(key));
@@ -326,6 +327,7 @@ brw_update_region_surface(struct brw_context *brw, struct intel_region *region,
key.width = region->pitch; /* XXX: not really! */
key.height = region->height;
key.cpp = region->cpp;
key.draw_offset = region->draw_offset; /* cur 3d or cube face offset */
} else {
key.surface_type = BRW_SURFACE_NULL;
key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
@@ -333,6 +335,7 @@ brw_update_region_surface(struct brw_context *brw, struct intel_region *region,
key.width = 1;
key.height = 1;
key.cpp = 4;
key.draw_offset = 0;
}
memcpy(key.color_mask, ctx->Color.ColorMask,
sizeof(key.color_mask));
@@ -354,8 +357,9 @@ brw_update_region_surface(struct brw_context *brw, struct intel_region *region,
surf.ss0.surface_format = key.surface_format;
surf.ss0.surface_type = key.surface_type;
surf.ss1.base_addr = key.draw_offset;
if (region_bo != NULL)
surf.ss1.base_addr = region_bo->offset; /* reloc */
surf.ss1.base_addr += region_bo->offset; /* reloc */
surf.ss2.width = key.width - 1;
surf.ss2.height = key.height - 1;
@@ -380,12 +384,12 @@ brw_update_region_surface(struct brw_context *brw, struct intel_region *region,
* them both. We might be able to figure out from other state
* a more restrictive relocation to emit.
*/
dri_bo_emit_reloc(brw->wm.surf_bo[unit],
I915_GEM_DOMAIN_RENDER,
I915_GEM_DOMAIN_RENDER,
0,
offsetof(struct brw_surface_state, ss1),
region_bo);
drm_intel_bo_emit_reloc(brw->wm.surf_bo[unit],
offsetof(struct brw_surface_state, ss1),
region_bo,
key.draw_offset,
I915_GEM_DOMAIN_RENDER,
I915_GEM_DOMAIN_RENDER);
}
}
}

View File

@@ -204,6 +204,8 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
intel_batchbuffer_flush(intel->batch);
intel->front_cliprects = GL_TRUE;
colorRegions[0] = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);
intel->front_buffer_dirty = GL_TRUE;
}
else {
if (!intel->constant_cliprect && intel->front_cliprects)
@@ -328,6 +330,12 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
static void
intelDrawBuffer(GLcontext * ctx, GLenum mode)
{
if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) {
struct intel_context *const intel = intel_context(ctx);
intel->is_front_buffer_rendering = (mode == GL_FRONT_LEFT);
}
intel_draw_buffer(ctx, ctx->DrawBuffer);
}

View File

@@ -93,6 +93,7 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask)
GL_CURRENT_BIT |
GL_DEPTH_BUFFER_BIT |
GL_ENABLE_BIT |
GL_POLYGON_BIT |
GL_STENCIL_BUFFER_BIT |
GL_TRANSFORM_BIT |
GL_CURRENT_BIT);
@@ -114,6 +115,7 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask)
_mesa_Disable(GL_CLIP_PLANE3);
_mesa_Disable(GL_CLIP_PLANE4);
_mesa_Disable(GL_CLIP_PLANE5);
_mesa_PolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (ctx->Extensions.ARB_fragment_program && ctx->FragmentProgram.Enabled) {
saved_fp_enable = GL_TRUE;
_mesa_Disable(GL_FRAGMENT_PROGRAM_ARB);
@@ -146,6 +148,11 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask)
}
}
#if FEATURE_ARB_vertex_buffer_object
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
_mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
#endif
intel_meta_set_passthrough_transform(intel);
for (i = 0; i < 4; i++) {

View File

@@ -97,7 +97,7 @@ int INTEL_DEBUG = (0);
#include "extension_helper.h"
#define DRIVER_DATE "20090326 2009Q1 RC2"
#define DRIVER_DATE "20090418 2009Q1"
#define DRIVER_DATE_GEM "GEM " DRIVER_DATE
static const GLubyte *
@@ -265,6 +265,11 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
region_name = "dri2 front buffer";
break;
case __DRI_BUFFER_FAKE_FRONT_LEFT:
rb = intel_fb->color_rb[0];
region_name = "dri2 fake front buffer";
break;
case __DRI_BUFFER_BACK_LEFT:
rb = intel_fb->color_rb[1];
region_name = "dri2 back buffer";
@@ -525,6 +530,27 @@ intel_flush(GLcontext *ctx, GLboolean needs_mi_flush)
if (intel->batch->map != intel->batch->ptr)
intel_batchbuffer_flush(intel->batch);
if ((ctx->DrawBuffer->Name == 0) && intel->front_buffer_dirty) {
__DRIscreen *const screen = intel->intelScreen->driScrnPriv;
if (screen->dri2.loader
&& (screen->dri2.loader->base.version >= 2)
&& (screen->dri2.loader->flushFrontBuffer != NULL)) {
(*screen->dri2.loader->flushFrontBuffer)(intel->driDrawable,
intel->driDrawable->loaderPrivate);
/* Only clear the dirty bit if front-buffer rendering is no longer
* enabled. This is done so that the dirty bit can only be set in
* glDrawBuffer. Otherwise the dirty bit would have to be set at
* 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) {
intel->front_buffer_dirty = GL_FALSE;
}
}
}
}
void

View File

@@ -260,11 +260,29 @@ struct intel_context
* flush time while the lock is held.
*/
GLboolean constant_cliprect;
/**
* In !constant_cliprect mode, set to true if the front cliprects should be
* used instead of back.
*/
GLboolean front_cliprects;
/**
* Set if rendering has occured to the drawable's front buffer.
*
* This is used in the DRI2 case to detect that glFlush should also copy
* the contents of the fake front buffer to the real front buffer.
*/
GLboolean front_buffer_dirty;
/**
* Track whether front-buffer rendering is currently enabled
*
* A separate flag is used to track this in order to support MRT more
* easily.
*/
GLboolean is_front_buffer_rendering;
drm_clip_rect_t fboRect; /**< cliprect for FBO rendering */
int perf_boxes;

View File

@@ -345,7 +345,8 @@ intel_renderbuffer_set_region(struct intel_renderbuffer *rb,
intel_region_reference(&rb->region, region);
intel_region_release(&old);
rb->pfPitch = region->pitch;
if (region)
rb->pfPitch = region->pitch;
}
/**

View File

@@ -183,7 +183,7 @@ intel_meta_set_passthrough_transform(struct intel_context *intel)
intel->meta.saved_vp_height = ctx->Viewport.Height;
intel->meta.saved_matrix_mode = ctx->Transform.MatrixMode;
/* _mesa_Viewport(0, 0, ctx->DrawBuffer->Width, ctx->DrawBuffer->Height);*/
_mesa_Viewport(0, 0, ctx->DrawBuffer->Width, ctx->DrawBuffer->Height);
_mesa_MatrixMode(GL_PROJECTION);
_mesa_PushMatrix();
@@ -205,8 +205,8 @@ intel_meta_restore_transform(struct intel_context *intel)
_mesa_MatrixMode(intel->meta.saved_matrix_mode);
/* _mesa_Viewport(intel->meta.saved_vp_x, intel->meta.saved_vp_y,
intel->meta.saved_vp_width, intel->meta.saved_vp_height);*/
_mesa_Viewport(intel->meta.saved_vp_x, intel->meta.saved_vp_y,
intel->meta.saved_vp_width, intel->meta.saved_vp_height);
}
/**

View File

@@ -385,6 +385,30 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
static void
intelDestroyBuffer(__DRIdrawablePrivate * driDrawPriv)
{
struct intel_framebuffer *intel_fb = driDrawPriv->driverPrivate;
struct intel_renderbuffer *depth_rb;
struct intel_renderbuffer *stencil_rb;
if (intel_fb) {
if (intel_fb->color_rb[0]) {
intel_renderbuffer_set_region(intel_fb->color_rb[0], NULL);
}
if (intel_fb->color_rb[1]) {
intel_renderbuffer_set_region(intel_fb->color_rb[1], NULL);
}
depth_rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
if (depth_rb) {
intel_renderbuffer_set_region(depth_rb, NULL);
}
stencil_rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);
if (stencil_rb) {
intel_renderbuffer_set_region(stencil_rb, NULL);
}
}
_mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}

View File

@@ -211,7 +211,7 @@ struct r300_tex_obj {
};
struct r300_texture_env_state {
r300TexObjPtr texobj;
struct gl_texture_object *texobj;
GLenum format;
GLenum envMode;
};

View File

@@ -1487,7 +1487,7 @@ static void r300SetupTextures(GLcontext * ctx)
#endif
tmu_mappings[i] = hw_tmu;
t = r300->state.texture.unit[i].texobj;
t = (r300TexObjPtr) r300->state.texture.unit[i].texobj->DriverData;
/* XXX questionable fix for bug 9170: */
if (!t)
continue;

View File

@@ -44,6 +44,7 @@ SOFTWARE.
#include "main/colormac.h"
#include "main/macros.h"
#include "main/simple_list.h"
#include "main/texobj.h"
#include "radeon_reg.h" /* gets definition for usleep */
#include "r300_context.h"
#include "r300_state.h"
@@ -71,8 +72,8 @@ void r300DestroyTexObj(r300ContextPtr rmesa, r300TexObjPtr t)
}
for (i = 0; i < rmesa->radeon.glCtx->Const.MaxTextureUnits; i++) {
if (rmesa->state.texture.unit[i].texobj == t) {
rmesa->state.texture.unit[i].texobj = NULL;
if (rmesa->state.texture.unit[i].texobj == t->base.tObj) {
_mesa_reference_texobj(&rmesa->state.texture.unit[i].texobj, NULL);
}
}
}

View File

@@ -567,19 +567,20 @@ static GLboolean r300UpdateTexture(GLcontext * ctx, int unit)
/* Update state if this is a different texture object to last
* time.
*/
if (rmesa->state.texture.unit[unit].texobj != t) {
if (rmesa->state.texture.unit[unit].texobj != tObj) {
if (rmesa->state.texture.unit[unit].texobj != NULL) {
r300TexObjPtr t_old = (r300TexObjPtr) rmesa->state.texture.unit[unit].texobj->DriverData;
/* The old texture is no longer bound to this texture unit.
* Mark it as such.
*/
rmesa->state.texture.unit[unit].texobj->base.bound &=
~(1 << unit);
t_old->base.bound &= ~(1 << unit);
}
rmesa->state.texture.unit[unit].texobj = t;
_mesa_reference_texobj(&rmesa->state.texture.unit[unit].texobj, tObj);
t->base.bound |= (1 << unit);
driUpdateTextureLRU((driTextureObject *) t); /* XXX: should be locked! */
driUpdateTextureLRU(&t->base); /* XXX: should be locked! */
}
return !t->border_fallback;

View File

@@ -259,8 +259,6 @@ radeonFillInModes( __DRIscreenPrivate *psp,
__GLcontextModes *m;
unsigned depth_buffer_factor;
unsigned back_buffer_factor;
GLenum fb_format;
GLenum fb_type;
int i;
/* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy
@@ -289,19 +287,24 @@ radeonFillInModes( __DRIscreenPrivate *psp,
depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1;
back_buffer_factor = (have_back_buffer) ? 2 : 1;
if ( pixel_bits == 16 ) {
fb_format = GL_RGB;
fb_type = GL_UNSIGNED_SHORT_5_6_5;
}
else {
fb_format = GL_BGRA;
fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
if (pixel_bits == 16) {
__DRIconfig **configs_a8r8g8b8;
__DRIconfig **configs_r5g6b5;
configs_r5g6b5 = driCreateConfigs(GL_RGB, GL_UNSIGNED_SHORT_5_6_5,
depth_bits_array, stencil_bits_array,
depth_buffer_factor, back_buffer_modes,
back_buffer_factor);
configs_a8r8g8b8 = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
depth_bits_array, stencil_bits_array,
1, back_buffer_modes, 1);
configs = driConcatConfigs(configs_r5g6b5, configs_a8r8g8b8);
} else
configs = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
depth_bits_array, stencil_bits_array,
depth_buffer_factor,
back_buffer_modes, back_buffer_factor);
configs = driCreateConfigs(fb_format, fb_type,
depth_bits_array, stencil_bits_array,
depth_buffer_factor,
back_buffer_modes, back_buffer_factor);
if (configs == NULL) {
fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
__func__, __LINE__ );
@@ -551,11 +554,8 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
screen->chip_family = CHIP_FAMILY_RS300;
break;
/* 9500 with 1 pipe verified by: Reid Linnemann <lreid@cs.okstate.edu> */
case PCI_CHIP_R300_AD:
screen->chip_family = CHIP_FAMILY_RV350;
screen->chip_flags = RADEON_CHIPSET_TCL;
break;
case PCI_CHIP_R300_AE:
case PCI_CHIP_R300_AF:
case PCI_CHIP_R300_AG:
@@ -883,6 +883,18 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
} else {
screen->num_gb_pipes = temp;
}
/* pipe overrides */
switch (dri_priv->deviceID) {
case PCI_CHIP_R300_AD: /* 9500 with 1 quadpipe verified by: Reid Linnemann <lreid@cs.okstate.edu> */
case PCI_CHIP_RV410_5E4C: /* RV410 SE only have 1 quadpipe */
case PCI_CHIP_RV410_5E4F: /* RV410 SE only have 1 quadpipe */
screen->num_gb_pipes = 1;
break;
default:
break;
}
}
if ( sPriv->drm_version.minor >= 10 ) {

View File

@@ -19,11 +19,12 @@ INCLUDE_DIRS = \
-I$(TOP)/src/mesa \
-I$(TOP)/src/mesa/main
# Standalone osmesa needs to be linked with core Mesa APIs
ifeq ($(DRIVER_DIRS), osmesa)
CORE_MESA = $(TOP)/src/mesa/libmesa.a $(TOP)/src/mesa/libglapi.a
.PHONY: osmesa8
.PHONY: osmesa16
else
CORE_MESA =
endif
.c.o:
@@ -31,31 +32,12 @@ CORE_MESA = $(TOP)/src/mesa/libmesa.a $(TOP)/src/mesa/libglapi.a
default: $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)
@ if [ "${DRIVER_DIRS}" = "osmesa" ] ; then \
$(MAKE) osmesa16 ; \
else \
$(MAKE) osmesa8 ; \
fi
# The normal libOSMesa is used in conjuction with libGL
osmesa8: $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)
$(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OBJECTS)
$(MKLIB) -o $(OSMESA_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
-id $(INSTALL_LIB_DIR)/lib$(OSMESA_LIB).$(MESA_MAJOR).dylib \
$(OSMESA_LIB_DEPS) $(OBJECTS)
# The libOSMesa16/libOSMesa32 libraries do not use libGL but rather are built
# with all the other Mesa sources (compiled with -DCHAN_BITS=16/32
osmesa16: $(OBJECTS) $(CORE_MESA)
# libOSMesa can be used in conjuction with libGL or with all other Mesa
# sources. We can also build libOSMesa16/libOSMesa32 by setting
# -DCHAN_BITS=16/32.
$(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OBJECTS) $(CORE_MESA)
$(MKLIB) -o $(OSMESA_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \

View File

@@ -2218,7 +2218,7 @@ Fake_glXCreatePixmap( Display *dpy, GLXFBConfig config, Pixmap pixmap,
if (!dpy || !config || !pixmap)
return 0;
for (attr = attribList; *attr; attr++) {
for (attr = attribList; attr && *attr; attr++) {
switch (*attr) {
case GLX_TEXTURE_FORMAT_EXT:
attr++;

View File

@@ -1176,7 +1176,7 @@ _mesa_PopAttrib(void)
/* restore clip planes */
for (i = 0; i < MAX_CLIP_PLANES; i++) {
const GLuint mask = 1 << 1;
const GLuint mask = 1 << i;
const GLfloat *eyePlane = xform->EyeUserPlane[i];
COPY_4V(ctx->Transform.EyeUserPlane[i], eyePlane);
if (xform->ClipPlanesEnabled & mask) {

View File

@@ -1549,6 +1549,24 @@ initialize_framebuffer_size(GLcontext *ctx, GLframebuffer *fb)
}
/**
* Check if the viewport/scissor size has not yet been initialized.
* Initialize the size if the given width and height are non-zero.
*/
void
_mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height)
{
if (!ctx->ViewportInitialized && width > 0 && height > 0) {
/* Note: set flag here, before calling _mesa_set_viewport(), to prevent
* potential infinite recursion.
*/
ctx->ViewportInitialized = GL_TRUE;
_mesa_set_viewport(ctx, 0, 0, width, height);
_mesa_set_scissor(ctx, 0, 0, width, height);
}
}
/**
* Bind the given context to the given drawBuffer and readBuffer and
* make it the current context for the calling thread.
@@ -1651,25 +1669,24 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
ASSERT(drawBuffer->Height > 0);
#endif
if (newCtx->FirstTimeCurrent) {
/* set initial viewport and scissor size now */
_mesa_set_viewport(newCtx, 0, 0,
drawBuffer->Width, drawBuffer->Height);
_mesa_set_scissor(newCtx, 0, 0,
drawBuffer->Width, drawBuffer->Height );
check_context_limits(newCtx);
if (drawBuffer) {
_mesa_check_init_viewport(newCtx,
drawBuffer->Width, drawBuffer->Height);
}
}
/* We can use this to help debug user's problems. Tell them to set
* the MESA_INFO env variable before running their app. Then the
* first time each context is made current we'll print some useful
* information.
*/
if (newCtx->FirstTimeCurrent) {
check_context_limits(newCtx);
/* We can use this to help debug user's problems. Tell them to set
* the MESA_INFO env variable before running their app. Then the
* first time each context is made current we'll print some useful
* information.
*/
if (_mesa_getenv("MESA_INFO")) {
_mesa_print_info();
}
newCtx->FirstTimeCurrent = GL_FALSE;
}
}

View File

@@ -132,6 +132,9 @@ extern void
_mesa_make_current( GLcontext *ctx, GLframebuffer *drawBuffer,
GLframebuffer *readBuffer );
extern void
_mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height);
extern GLboolean
_mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare);

View File

@@ -77,28 +77,30 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
}
if (ctx->RenderMode == GL_RENDER) {
/* Round, to satisfy conformance tests (matches SGI's OpenGL) */
GLint x = IROUND(ctx->Current.RasterPos[0]);
GLint y = IROUND(ctx->Current.RasterPos[1]);
if (width > 0 && height > 0) {
/* Round, to satisfy conformance tests (matches SGI's OpenGL) */
GLint x = IROUND(ctx->Current.RasterPos[0]);
GLint y = IROUND(ctx->Current.RasterPos[1]);
if (ctx->Unpack.BufferObj->Name) {
/* unpack from PBO */
if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1,
format, type, pixels)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDrawPixels(invalid PBO access)");
return;
}
if (ctx->Unpack.BufferObj->Pointer) {
/* buffer is mapped - that's an error */
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDrawPixels(PBO is mapped)");
return;
if (ctx->Unpack.BufferObj->Name) {
/* unpack from PBO */
if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1,
format, type, pixels)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDrawPixels(invalid PBO access)");
return;
}
if (ctx->Unpack.BufferObj->Pointer) {
/* buffer is mapped - that's an error */
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDrawPixels(PBO is mapped)");
return;
}
}
ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type,
&ctx->Unpack, pixels);
}
ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type,
&ctx->Unpack, pixels);
}
else if (ctx->RenderMode == GL_FEEDBACK) {
/* Feedback the current raster pos info */
@@ -159,10 +161,12 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
if (ctx->RenderMode == GL_RENDER) {
/* Round to satisfy conformance tests (matches SGI's OpenGL) */
GLint destx = IROUND(ctx->Current.RasterPos[0]);
GLint desty = IROUND(ctx->Current.RasterPos[1]);
ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty,
type );
if (width > 0 && height > 0) {
GLint destx = IROUND(ctx->Current.RasterPos[0]);
GLint desty = IROUND(ctx->Current.RasterPos[1]);
ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty,
type );
}
}
else if (ctx->RenderMode == GL_FEEDBACK) {
FLUSH_CURRENT( ctx, 0 );

View File

@@ -323,6 +323,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
/* OK */
}
else if (ctx->Extensions.EXT_packed_depth_stencil &&
ctx->Extensions.ARB_depth_texture &&
texImage->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT) {
/* OK */
}
@@ -332,9 +333,18 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
}
}
else {
/* no such thing as stencil textures */
att->Complete = GL_FALSE;
return;
ASSERT(format == GL_STENCIL);
ASSERT(att->Renderbuffer->StencilBits);
if (ctx->Extensions.EXT_packed_depth_stencil &&
ctx->Extensions.ARB_depth_texture &&
att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
/* OK */
}
else {
/* no such thing as stencil-only textures */
att->Complete = GL_FALSE;
return;
}
}
}
else if (att->Type == GL_RENDERBUFFER_EXT) {

View File

@@ -1104,6 +1104,9 @@ static void build_lighting( struct tnl_program *p )
if (twoside) {
if (!p->state->material_shininess_is_zero) {
/* Note that we negate the back-face specular exponent here.
* The negation will be un-done later in the back-face code below.
*/
struct ureg shininess = get_material(p, 1, STATE_SHININESS);
emit_op1(p, OPCODE_MOV, dots, WRITEMASK_Z,
negate(swizzle1(shininess,X)));
@@ -1309,6 +1312,11 @@ static void build_lighting( struct tnl_program *p )
mask1 = 0;
}
/* For the back face we need to negate the X and Y component
* dot products. dots.Z has the negated back-face specular
* exponent. We swizzle that into the W position. This
* negation makes the back-face specular term positive again.
*/
dots = negate(swizzle(dots,X,Y,W,Z));
if (!is_undef(att)) {
@@ -1327,8 +1335,10 @@ static void build_lighting( struct tnl_program *p )
emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _bfc0);
emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _bfc1);
/* restore negate flag for next lighting */
dots = negate(dots);
/* restore dots to its original state for subsequent lights
* by negating and swizzling again.
*/
dots = negate(swizzle(dots,X,Y,W,Z));
release_temp(p, ambient);
release_temp(p, diffuse);

View File

@@ -1905,6 +1905,10 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
CHECK_EXT1(ARB_shader_objects, "GetBooleanv");
params[0] = INT_TO_BOOLEAN(ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0);
break;
case GL_VERTEX_ARRAY_BINDING_APPLE:
CHECK_EXT1(APPLE_vertex_array_object, "GetBooleanv");
params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Name);
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname);
}
@@ -3753,6 +3757,10 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
CHECK_EXT1(ARB_shader_objects, "GetFloatv");
params[0] = (GLfloat)(ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0);
break;
case GL_VERTEX_ARRAY_BINDING_APPLE:
CHECK_EXT1(APPLE_vertex_array_object, "GetFloatv");
params[0] = (GLfloat)(ctx->Array.ArrayObj->Name);
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(pname=0x%x)", pname);
}
@@ -5601,6 +5609,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
CHECK_EXT1(ARB_shader_objects, "GetIntegerv");
params[0] = ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0;
break;
case GL_VERTEX_ARRAY_BINDING_APPLE:
CHECK_EXT1(APPLE_vertex_array_object, "GetIntegerv");
params[0] = ctx->Array.ArrayObj->Name;
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname);
}

View File

@@ -1009,7 +1009,10 @@ StateVars = [
# close enough for now.
( "GL_CURRENT_PROGRAM", GLint,
["ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0"],
"", ["ARB_shader_objects"] )
"", ["ARB_shader_objects"] ),
( "GL_VERTEX_ARRAY_BINDING_APPLE", GLint, ["ctx->Array.ArrayObj->Name"], "",
["APPLE_vertex_array_object"] ),
]

View File

@@ -145,7 +145,10 @@
#if defined(__linux__)
#include <byteswap.h>
#define CPU_TO_LE32( x ) bswap_32( x )
#else /*__linux__*/
#elif defined(__APPLE__)
#include <CoreFoundation/CFByteOrder.h>
#define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x )
#else /*__linux__ __APPLE__*/
#include <sys/endian.h>
#define CPU_TO_LE32( x ) bswap32( x )
#endif /*__linux__*/

View File

@@ -63,6 +63,7 @@ struct _mesa_HashTable {
struct HashEntry *Table[TABLE_SIZE]; /**< the lookup table */
GLuint MaxKey; /**< highest key inserted so far */
_glthread_Mutex Mutex; /**< mutual exclusion lock */
_glthread_Mutex WalkMutex; /**< for _mesa_HashWalk() */
GLboolean InDeleteAll; /**< Debug check */
};
@@ -79,6 +80,7 @@ _mesa_NewHashTable(void)
struct _mesa_HashTable *table = CALLOC_STRUCT(_mesa_HashTable);
if (table) {
_glthread_INIT_MUTEX(table->Mutex);
_glthread_INIT_MUTEX(table->WalkMutex);
}
return table;
}
@@ -111,6 +113,7 @@ _mesa_DeleteHashTable(struct _mesa_HashTable *table)
}
}
_glthread_DESTROY_MUTEX(table->Mutex);
_glthread_DESTROY_MUTEX(table->WalkMutex);
_mesa_free(table);
}
@@ -285,6 +288,11 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table,
/**
* Walk over all entries in a hash table, calling callback function for each.
* Note: we use a separate mutex in this function to avoid a recursive
* locking deadlock (in case the callback calls _mesa_HashRemove()) and to
* prevent multiple threads/contexts from getting tangled up.
* A lock-less version of this function could be used when the table will
* not be modified.
* \param table the hash table to walk
* \param callback the callback function
* \param userData arbitrary pointer to pass along to the callback
@@ -300,14 +308,16 @@ _mesa_HashWalk(const struct _mesa_HashTable *table,
GLuint pos;
ASSERT(table);
ASSERT(callback);
_glthread_LOCK_MUTEX(table2->Mutex);
_glthread_LOCK_MUTEX(table2->WalkMutex);
for (pos = 0; pos < TABLE_SIZE; pos++) {
struct HashEntry *entry;
for (entry = table->Table[pos]; entry; entry = entry->Next) {
struct HashEntry *entry, *next;
for (entry = table->Table[pos]; entry; entry = next) {
/* save 'next' pointer now in case the callback deletes the entry */
next = entry->Next;
callback(entry->Key, entry->Data, userData);
}
}
_glthread_UNLOCK_MUTEX(table2->Mutex);
_glthread_UNLOCK_MUTEX(table2->WalkMutex);
}

View File

@@ -1,8 +1,9 @@
/*
* Mesa 3-D graphics library
* Version: 7.1
* Version: 7.5
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
* Copyright (C) 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"),
@@ -738,12 +739,20 @@ _mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
GLint width, GLint height,
GLenum format, GLenum type )
{
ASSERT(packing);
ASSERT(type != GL_BITMAP);
GLint bytesPerRow, bytesPerImage, remainder;
{
ASSERT(packing);
if (type == GL_BITMAP) {
if (packing->RowLength == 0) {
bytesPerRow = (width + 7) / 8;
}
else {
bytesPerRow = (packing->RowLength + 7) / 8;
}
}
else {
const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type);
GLint bytesPerRow, bytesPerImage, remainder;
if (bytesPerPixel <= 0)
return -1; /* error */
@@ -753,17 +762,18 @@ _mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
else {
bytesPerRow = bytesPerPixel * packing->RowLength;
}
remainder = bytesPerRow % packing->Alignment;
if (remainder > 0)
bytesPerRow += (packing->Alignment - remainder);
if (packing->ImageHeight == 0)
bytesPerImage = bytesPerRow * height;
else
bytesPerImage = bytesPerRow * packing->ImageHeight;
return bytesPerImage;
}
remainder = bytesPerRow % packing->Alignment;
if (remainder > 0)
bytesPerRow += (packing->Alignment - remainder);
if (packing->ImageHeight == 0)
bytesPerImage = bytesPerRow * height;
else
bytesPerImage = bytesPerRow * packing->ImageHeight;
return bytesPerImage;
}

View File

@@ -209,7 +209,6 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
_math_matrix_analyse(ctx->ModelviewMatrixStack.Top);
}
TRANSFORM_DIRECTION(temp, params, ctx->ModelviewMatrixStack.Top->m);
NORMALIZE_3FV(temp);
params = temp;
break;
case GL_SPOT_EXPONENT:
@@ -1137,12 +1136,18 @@ compute_light_positions( GLcontext *ctx )
}
if (light->_Flags & LIGHT_SPOT) {
/* Note: we normalize the spot direction now */
if (ctx->_NeedEyeCoords) {
COPY_3V( light->_NormDirection, light->EyeDirection );
NORMALIZE_3FV( light->_NormDirection );
}
else {
GLfloat spotDir[3];
COPY_3V(spotDir, light->EyeDirection);
NORMALIZE_3FV(spotDir);
TRANSFORM_NORMAL( light->_NormDirection,
light->EyeDirection,
spotDir,
ctx->ModelviewMatrixStack.Top->m);
}

View File

@@ -580,8 +580,8 @@ _mesa_set_viewport( GLcontext *ctx, GLint x, GLint y,
}
/* clamp width and height to the implementation dependent range */
width = CLAMP(width, 1, (GLsizei) ctx->Const.MaxViewportWidth);
height = CLAMP(height, 1, (GLsizei) ctx->Const.MaxViewportHeight);
width = MIN2(width, (GLsizei) ctx->Const.MaxViewportWidth);
height = MIN2(height, (GLsizei) ctx->Const.MaxViewportHeight);
ctx->Viewport.X = x;
ctx->Viewport.Width = width;

View File

@@ -3063,6 +3063,8 @@ struct __GLcontextRec
GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */
GLbitfield NewState; /**< bitwise-or of _NEW_* flags */
GLboolean ViewportInitialized; /**< has viewport size been initialized? */
/** \name Derived state */
/*@{*/
/** Bitwise-or of DD_* flags. Note that this bitfield may be used before

View File

@@ -170,6 +170,9 @@ _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
return;
}
if (width == 0 || height == 0)
return; /* nothing to do */
if (ctx->Pack.BufferObj->Name) {
if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1,
format, type, pixels)) {

View File

@@ -157,7 +157,7 @@ update_arrays( GLcontext *ctx )
/* 16..31 */
if (ctx->VertexProgram._Current) {
for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) {
for (i = 0; i < Elements(ctx->Array.ArrayObj->VertexAttrib); i++) {
if (ctx->Array.ArrayObj->VertexAttrib[i].Enabled) {
min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[i]._MaxElement);
}

View File

@@ -49,6 +49,17 @@
#include "mtypes.h"
/**
* State changes which we care about for glCopyTex[Sub]Image() calls.
* In particular, we care about pixel transfer state and buffer state
* (such as glReadBuffer to make sure we read from the right renderbuffer).
*/
#define NEW_COPY_TEX_STATE (_IMAGE_NEW_TRANSFER_STATE | \
_NEW_BUFFERS | \
_NEW_PIXEL)
/**
* We allocate texture memory on 512-byte boundaries so we can use MMX/SSE
* elsewhere.
@@ -2918,7 +2929,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
if (ctx->NewState & NEW_COPY_TEX_STATE)
_mesa_update_state(ctx);
#if FEATURE_convolve
@@ -2983,7 +2994,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
if (ctx->NewState & NEW_COPY_TEX_STATE)
_mesa_update_state(ctx);
#if FEATURE_convolve
@@ -3051,7 +3062,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
if (ctx->NewState & NEW_COPY_TEX_STATE)
_mesa_update_state(ctx);
if (copytexsubimage_error_check1(ctx, 1, target, level))
@@ -3106,7 +3117,7 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
if (ctx->NewState & NEW_COPY_TEX_STATE)
_mesa_update_state(ctx);
if (copytexsubimage_error_check1(ctx, 2, target, level))
@@ -3161,7 +3172,7 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
if (ctx->NewState & NEW_COPY_TEX_STATE)
_mesa_update_state(ctx);
if (copytexsubimage_error_check1(ctx, 3, target, level))

View File

@@ -139,8 +139,11 @@ flush(GLcontext *ctx, struct gl_texture_object *texObj)
}
/** Set an integer-valued texture parameter */
static void
/**
* Set an integer-valued texture parameter
* \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
*/
static GLboolean
set_tex_parameteri(GLcontext *ctx,
struct gl_texture_object *texObj,
GLenum pname, const GLint *params)
@@ -148,13 +151,13 @@ set_tex_parameteri(GLcontext *ctx,
switch (pname) {
case GL_TEXTURE_MIN_FILTER:
if (texObj->MinFilter == params[0])
return;
return GL_FALSE;
switch (params[0]) {
case GL_NEAREST:
case GL_LINEAR:
flush(ctx, texObj);
texObj->MinFilter = params[0];
return;
return GL_TRUE;
case GL_NEAREST_MIPMAP_NEAREST:
case GL_LINEAR_MIPMAP_NEAREST:
case GL_NEAREST_MIPMAP_LINEAR:
@@ -162,77 +165,80 @@ set_tex_parameteri(GLcontext *ctx,
if (texObj->Target != GL_TEXTURE_RECTANGLE_NV) {
flush(ctx, texObj);
texObj->MinFilter = params[0];
return;
return GL_TRUE;
}
/* fall-through */
default:
_mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
}
return;
return GL_FALSE;
case GL_TEXTURE_MAG_FILTER:
if (texObj->MagFilter == params[0])
return;
return GL_FALSE;
switch (params[0]) {
case GL_NEAREST:
case GL_LINEAR:
flush(ctx, texObj);
texObj->MagFilter = params[0];
return;
return GL_TRUE;
default:
_mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
}
return;
return GL_FALSE;
case GL_TEXTURE_WRAP_S:
if (texObj->WrapS == params[0])
return;
return GL_FALSE;
if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
flush(ctx, texObj);
texObj->WrapS = params[0];
return GL_TRUE;
}
return;
return GL_FALSE;
case GL_TEXTURE_WRAP_T:
if (texObj->WrapT == params[0])
return;
return GL_FALSE;
if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
flush(ctx, texObj);
texObj->WrapT = params[0];
return GL_TRUE;
}
return;
return GL_FALSE;
case GL_TEXTURE_WRAP_R:
if (texObj->WrapR == params[0])
return;
return GL_FALSE;
if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
flush(ctx, texObj);
texObj->WrapR = params[0];
return GL_TRUE;
}
return;
return GL_FALSE;
case GL_TEXTURE_BASE_LEVEL:
if (texObj->BaseLevel == params[0])
return;
return GL_FALSE;
if (params[0] < 0 ||
(texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0] != 0)) {
_mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)");
return;
return GL_FALSE;
}
flush(ctx, texObj);
texObj->BaseLevel = params[0];
return;
return GL_TRUE;
case GL_TEXTURE_MAX_LEVEL:
if (texObj->MaxLevel == params[0])
return;
return GL_FALSE;
if (params[0] < 0 || texObj->Target == GL_TEXTURE_RECTANGLE_ARB) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(param)");
return;
return GL_FALSE;
}
flush(ctx, texObj);
texObj->MaxLevel = params[0];
return;
return GL_TRUE;
case GL_TEXTURE_COMPARE_SGIX:
if (ctx->Extensions.SGIX_shadow) {
@@ -243,7 +249,7 @@ set_tex_parameteri(GLcontext *ctx,
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexParameter(pname=GL_TEXTURE_COMPARE_SGIX)");
}
return;
return GL_TRUE;
case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
if (ctx->Extensions.SGIX_shadow &&
@@ -256,20 +262,22 @@ set_tex_parameteri(GLcontext *ctx,
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexParameter(GL_TEXTURE_COMPARE_OPERATOR_SGIX)");
}
return;
return GL_TRUE;
case GL_GENERATE_MIPMAP_SGIS:
if (ctx->Extensions.SGIS_generate_mipmap) {
if (texObj->GenerateMipmap != params[0]) {
flush(ctx, texObj);
texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE;
return GL_TRUE;
}
return GL_FALSE;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexParameter(pname=GL_GENERATE_MIPMAP_SGIS)");
}
return;
return GL_FALSE;
case GL_TEXTURE_COMPARE_MODE_ARB:
if (ctx->Extensions.ARB_shadow &&
@@ -278,24 +286,26 @@ set_tex_parameteri(GLcontext *ctx,
if (texObj->CompareMode != params[0]) {
flush(ctx, texObj);
texObj->CompareMode = params[0];
return GL_TRUE;
}
return GL_FALSE;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexParameter(GL_TEXTURE_COMPARE_MODE_ARB)");
}
return;
return GL_FALSE;
case GL_TEXTURE_COMPARE_FUNC_ARB:
if (ctx->Extensions.ARB_shadow) {
if (texObj->CompareFunc == params[0])
return;
return GL_FALSE;
switch (params[0]) {
case GL_LEQUAL:
case GL_GEQUAL:
flush(ctx, texObj);
texObj->CompareFunc = params[0];
return;
return GL_TRUE;
case GL_EQUAL:
case GL_NOTEQUAL:
case GL_LESS:
@@ -305,7 +315,7 @@ set_tex_parameteri(GLcontext *ctx,
if (ctx->Extensions.EXT_shadow_funcs) {
flush(ctx, texObj);
texObj->CompareFunc = params[0];
return;
return GL_TRUE;
}
/* fall-through */
default:
@@ -316,7 +326,7 @@ set_tex_parameteri(GLcontext *ctx,
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(param)");
}
return;
return GL_FALSE;
case GL_DEPTH_TEXTURE_MODE_ARB:
if (ctx->Extensions.ARB_depth_texture &&
@@ -326,13 +336,14 @@ set_tex_parameteri(GLcontext *ctx,
if (texObj->DepthMode != params[0]) {
flush(ctx, texObj);
texObj->DepthMode = params[0];
return GL_TRUE;
}
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexParameter(GL_DEPTH_TEXTURE_MODE_ARB)");
}
return;
return GL_FALSE;
#ifdef FEATURE_OES_draw_texture
case GL_TEXTURE_CROP_RECT_OES:
@@ -340,17 +351,21 @@ set_tex_parameteri(GLcontext *ctx,
texObj->CropRect[1] = params[1];
texObj->CropRect[2] = params[2];
texObj->CropRect[3] = params[3];
break;
return GL_TRUE;
#endif
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname);
}
return GL_FALSE;
}
/** Set a float-valued texture parameter */
static void
/**
* Set a float-valued texture parameter
* \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
*/
static GLboolean
set_tex_parameterf(GLcontext *ctx,
struct gl_texture_object *texObj,
GLenum pname, const GLfloat *params)
@@ -358,54 +373,56 @@ set_tex_parameterf(GLcontext *ctx,
switch (pname) {
case GL_TEXTURE_MIN_LOD:
if (texObj->MinLod == params[0])
return;
return GL_FALSE;
flush(ctx, texObj);
texObj->MinLod = params[0];
return;
return GL_TRUE;
case GL_TEXTURE_MAX_LOD:
if (texObj->MaxLod == params[0])
return;
return GL_FALSE;
flush(ctx, texObj);
texObj->MaxLod = params[0];
return;
return GL_TRUE;
case GL_TEXTURE_PRIORITY:
flush(ctx, texObj);
texObj->Priority = CLAMP(params[0], 0.0F, 1.0F);
return;
return GL_TRUE;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
if (ctx->Extensions.EXT_texture_filter_anisotropic) {
if (texObj->MaxAnisotropy == params[0])
return;
return GL_FALSE;
if (params[0] < 1.0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
return;
return GL_FALSE;
}
flush(ctx, texObj);
/* clamp to max, that's what NVIDIA does */
texObj->MaxAnisotropy = MIN2(params[0],
ctx->Const.MaxTextureMaxAnisotropy);
return GL_TRUE;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)");
}
return;
return GL_FALSE;
case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
if (ctx->Extensions.SGIX_shadow_ambient) {
if (texObj->ShadowAmbient != params[0]) {
flush(ctx, texObj);
texObj->ShadowAmbient = CLAMP(params[0], 0.0F, 1.0F);
return GL_TRUE;
}
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexParameter(pname=GL_SHADOW_AMBIENT_SGIX)");
}
return;
return GL_FALSE;
case GL_TEXTURE_LOD_BIAS:
/* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias */
@@ -413,7 +430,9 @@ set_tex_parameterf(GLcontext *ctx,
if (texObj->LodBias != params[0]) {
flush(ctx, texObj);
texObj->LodBias = params[0];
return GL_TRUE;
}
return GL_FALSE;
}
break;
@@ -427,17 +446,19 @@ set_tex_parameterf(GLcontext *ctx,
UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[GCOMP], params[1]);
UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[BCOMP], params[2]);
UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[ACOMP], params[3]);
return;
return GL_TRUE;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname);
}
return GL_FALSE;
}
void GLAPIENTRY
_mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
{
GLboolean need_update;
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -463,15 +484,15 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
{
/* convert float param to int */
GLint p = (GLint) param;
set_tex_parameteri(ctx, texObj, pname, &p);
need_update = set_tex_parameteri(ctx, texObj, pname, &p);
}
return;
break;
default:
/* this will generate an error if pname is illegal */
set_tex_parameterf(ctx, texObj, pname, &param);
need_update = set_tex_parameterf(ctx, texObj, pname, &param);
}
if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
if (ctx->Driver.TexParameter && need_update) {
ctx->Driver.TexParameter(ctx, target, texObj, pname, &param);
}
}
@@ -480,6 +501,7 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
void GLAPIENTRY
_mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
{
GLboolean need_update;
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -505,7 +527,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
{
/* convert float param to int */
GLint p = (GLint) params[0];
set_tex_parameteri(ctx, texObj, pname, &p);
need_update = set_tex_parameteri(ctx, texObj, pname, &p);
}
break;
@@ -518,17 +540,17 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
iparams[1] = (GLint) params[1];
iparams[2] = (GLint) params[2];
iparams[3] = (GLint) params[3];
set_tex_parameteri(ctx, target, iparams);
need_update = set_tex_parameteri(ctx, target, iparams);
}
break;
#endif
default:
/* this will generate an error if pname is illegal */
set_tex_parameterf(ctx, texObj, pname, params);
need_update = set_tex_parameterf(ctx, texObj, pname, params);
}
if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
if (ctx->Driver.TexParameter && need_update) {
ctx->Driver.TexParameter(ctx, target, texObj, pname, params);
}
}
@@ -537,6 +559,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
void GLAPIENTRY
_mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
{
GLboolean need_update;
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -555,15 +578,15 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
{
GLfloat fparam = (GLfloat) param;
/* convert int param to float */
set_tex_parameterf(ctx, texObj, pname, &fparam);
need_update = set_tex_parameterf(ctx, texObj, pname, &fparam);
}
break;
default:
/* this will generate an error if pname is illegal */
set_tex_parameteri(ctx, texObj, pname, &param);
need_update = set_tex_parameteri(ctx, texObj, pname, &param);
}
if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
if (ctx->Driver.TexParameter && need_update) {
GLfloat fparam = (GLfloat) param;
ctx->Driver.TexParameter(ctx, target, texObj, pname, &fparam);
}
@@ -573,6 +596,7 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
void GLAPIENTRY
_mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
{
GLboolean need_update;
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -590,7 +614,7 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
fparams[1] = INT_TO_FLOAT(params[1]);
fparams[2] = INT_TO_FLOAT(params[2]);
fparams[3] = INT_TO_FLOAT(params[3]);
set_tex_parameterf(ctx, texObj, pname, fparams);
need_update = set_tex_parameterf(ctx, texObj, pname, fparams);
}
break;
case GL_TEXTURE_MIN_LOD:
@@ -602,15 +626,15 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
{
/* convert int param to float */
GLfloat fparam = (GLfloat) params[0];
set_tex_parameterf(ctx, texObj, pname, &fparam);
need_update = set_tex_parameterf(ctx, texObj, pname, &fparam);
}
break;
default:
/* this will generate an error if pname is illegal */
set_tex_parameteri(ctx, texObj, pname, params);
need_update = set_tex_parameteri(ctx, texObj, pname, params);
}
if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
if (ctx->Driver.TexParameter && need_update) {
GLfloat fparams[4];
fparams[0] = INT_TO_FLOAT(params[0]);
if (pname == GL_TEXTURE_BORDER_COLOR ||

View File

@@ -507,6 +507,7 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att)
trb->Base.BlueBits = trb->TexImage->TexFormat->BlueBits;
trb->Base.AlphaBits = trb->TexImage->TexFormat->AlphaBits;
trb->Base.DepthBits = trb->TexImage->TexFormat->DepthBits;
trb->Base.StencilBits = trb->TexImage->TexFormat->StencilBits;
}

View File

@@ -429,7 +429,7 @@ texture_override(GLcontext *ctx,
}
if (texObj->_Complete) {
texUnit->_ReallyEnabled = textureBit;
texUnit->_Current = texObj;
_mesa_reference_texobj(&texUnit->_Current, texObj);
update_texture_compare_function(ctx, texObj);
}
}
@@ -485,7 +485,6 @@ update_texture_state( GLcontext *ctx )
GLbitfield enableBits;
GLuint tex;
texUnit->_Current = NULL;
texUnit->_ReallyEnabled = 0;
texUnit->_GenFlags = 0;
@@ -802,6 +801,9 @@ _mesa_free_texture_data(GLcontext *ctx)
/* unreference current textures */
for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) {
struct gl_texture_unit *unit = ctx->Texture.Unit + u;
/* The _Current texture could account for another reference */
_mesa_reference_texobj(&ctx->Texture.Unit[u]._Current, NULL);
for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) {
_mesa_reference_texobj(&unit->CurrentTex[tgt], NULL);
}

View File

@@ -1,8 +1,9 @@
/*
* Mesa 3-D graphics library
* Version: 7.4
* Version: 7.4.4
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
* Copyright (C) 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"),
@@ -30,8 +31,8 @@
/* Mesa version */
#define MESA_MAJOR 7
#define MESA_MINOR 4
#define MESA_PATCH 0
#define MESA_VERSION_STRING "7.4"
#define MESA_PATCH 4
#define MESA_VERSION_STRING "7.4.4"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

View File

@@ -1379,11 +1379,10 @@ _math_matrix_analyse( GLmatrix *mat )
if (mat->inv && (mat->flags & MAT_DIRTY_INVERSE)) {
matrix_invert( mat );
mat->flags &= ~MAT_DIRTY_INVERSE;
}
mat->flags &= ~(MAT_DIRTY_FLAGS|
MAT_DIRTY_TYPE|
MAT_DIRTY_INVERSE);
mat->flags &= ~(MAT_DIRTY_FLAGS | MAT_DIRTY_TYPE);
}
/*@}*/

View File

@@ -1496,10 +1496,16 @@ generic_attrib_check(struct var_cache *vc_head)
curr = vc_head;
while (curr) {
if (curr->type == vt_attrib) {
if (curr->attrib_is_generic)
genericAttrib[ curr->attrib_binding ] = GL_TRUE;
else
if (curr->attrib_is_generic) {
GLuint attr = (curr->attrib_binding == 0)
? 0 : (curr->attrib_binding - VERT_ATTRIB_GENERIC0);
assert(attr < MAX_VERTEX_PROGRAM_ATTRIBS);
genericAttrib[attr] = GL_TRUE;
}
else {
assert(curr->attrib_binding < MAX_VERTEX_PROGRAM_ATTRIBS);
explicitAttrib[ curr->attrib_binding ] = GL_TRUE;
}
}
curr = curr->next;
@@ -1823,7 +1829,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
if (param_var->param_binding_begin == ~0U)
param_var->param_binding_begin = idx;
param_var->param_binding_length++;
Program->Base.NumParameters++;
}
}
else {
@@ -1832,7 +1837,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
if (param_var->param_binding_begin == ~0U)
param_var->param_binding_begin = idx;
param_var->param_binding_length++;
Program->Base.NumParameters++;
}
break;
@@ -1843,7 +1847,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
if (param_var->param_binding_begin == ~0U)
param_var->param_binding_begin = idx;
param_var->param_binding_length++;
Program->Base.NumParameters++;
/* Check if there is more: 0 -> we're done, else its an integer */
if (**inst) {
@@ -1879,7 +1882,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
idx = _mesa_add_state_reference(Program->Base.Parameters,
state_tokens);
param_var->param_binding_length++;
Program->Base.NumParameters++;
}
}
else {
@@ -1897,7 +1899,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
param_var->param_binding_begin = idx;
param_var->param_binding_type = PROGRAM_CONSTANT;
param_var->param_binding_length++;
Program->Base.NumParameters++;
break;
default:
@@ -1906,12 +1907,14 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
return 1;
}
Program->Base.NumParameters = Program->Base.Parameters->NumParameters;
/* Make sure we haven't blown past our parameter limits */
if (((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) &&
(Program->Base.NumParameters >=
(Program->Base.NumParameters >
ctx->Const.VertexProgram.MaxLocalParams))
|| ((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB)
&& (Program->Base.NumParameters >=
&& (Program->Base.NumParameters >
ctx->Const.FragmentProgram.MaxLocalParams))) {
program_error(ctx, Program->Position, "Too many parameter variables");
return 1;

View File

@@ -873,7 +873,7 @@ _mesa_execute_program(GLcontext * ctx,
* result.z = result.x * APPX(result.y)
* We do what the ARB extension says.
*/
q[2] = (GLfloat) pow(2.0, t[0]);
q[2] = (GLfloat) _mesa_pow(2.0, t[0]);
}
q[1] = t[0] - floor_t0;
q[3] = 1.0F;
@@ -986,7 +986,7 @@ _mesa_execute_program(GLcontext * ctx,
if (a[1] == 0.0 && a[3] == 0.0)
result[2] = 1.0;
else
result[2] = EXPF(a[3] * LOGF(a[1]));
result[2] = (GLfloat) _mesa_pow(a[1], a[3]);
}
else {
result[2] = 0.0;
@@ -1577,8 +1577,8 @@ _mesa_execute_program(GLcontext * ctx,
case OPCODE_TXB: /* GL_ARB_fragment_program only */
/* Texel lookup with LOD bias */
{
const struct gl_texture_unit *texUnit
= &ctx->Texture.Unit[inst->TexSrcUnit];
const GLuint unit = machine->Samplers[inst->TexSrcUnit];
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
GLfloat texcoord[4], color[4], lodBias;
fetch_vector4(&inst->SrcReg[0], machine, texcoord);

View File

@@ -178,15 +178,20 @@ _mesa_add_named_constant(struct gl_program_parameter_list *paramList,
const char *name, const GLfloat values[4],
GLuint size)
{
#if 0 /* disable this for now -- we need to save the name! */
/* first check if this is a duplicate constant */
GLint pos;
GLuint swizzle;
ASSERT(size == 4); /* XXX future feature */
/* check if we already have this constant */
if (_mesa_lookup_parameter_constant(paramList, values, 4, &pos, &swizzle)) {
return pos;
for (pos = 0; pos < paramList->NumParameters; pos++) {
const GLfloat *pvals = paramList->ParameterValues[pos];
if (pvals[0] == values[0] &&
pvals[1] == values[1] &&
pvals[2] == values[2] &&
pvals[3] == values[3] &&
_mesa_strcmp(paramList->Parameters[pos].Name, name) == 0) {
/* Same name and value is already in the param list - reuse it */
return pos;
}
}
#endif
/* not found, add new parameter */
return _mesa_add_parameter(paramList, PROGRAM_CONSTANT, name,
size, GL_NONE, values, NULL, 0x0);
}

View File

@@ -296,6 +296,7 @@ _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id)
struct gl_program *prog;
switch (target) {
case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */
case GL_VERTEX_STATE_PROGRAM_NV:
prog = _mesa_init_vertex_program(ctx, CALLOC_STRUCT(gl_vertex_program),
target, id );
break;

View File

@@ -457,28 +457,36 @@ emit_statevars(const char *name, int array_len,
tokens[0] = STATE_TEXENV_COLOR;
}
else if (strcmp(name, "gl_EyePlaneS") == 0) {
tokens[0] = STATE_TEXGEN_EYE_S;
tokens[0] = STATE_TEXGEN;
tokens[2] = STATE_TEXGEN_EYE_S;
}
else if (strcmp(name, "gl_EyePlaneT") == 0) {
tokens[0] = STATE_TEXGEN_EYE_T;
tokens[0] = STATE_TEXGEN;
tokens[2] = STATE_TEXGEN_EYE_T;
}
else if (strcmp(name, "gl_EyePlaneR") == 0) {
tokens[0] = STATE_TEXGEN_EYE_R;
tokens[0] = STATE_TEXGEN;
tokens[2] = STATE_TEXGEN_EYE_R;
}
else if (strcmp(name, "gl_EyePlaneQ") == 0) {
tokens[0] = STATE_TEXGEN_EYE_Q;
tokens[0] = STATE_TEXGEN;
tokens[2] = STATE_TEXGEN_EYE_Q;
}
else if (strcmp(name, "gl_ObjectPlaneS") == 0) {
tokens[0] = STATE_TEXGEN_OBJECT_S;
tokens[0] = STATE_TEXGEN;
tokens[2] = STATE_TEXGEN_OBJECT_S;
}
else if (strcmp(name, "gl_ObjectPlaneT") == 0) {
tokens[0] = STATE_TEXGEN_OBJECT_T;
tokens[0] = STATE_TEXGEN;
tokens[2] = STATE_TEXGEN_OBJECT_T;
}
else if (strcmp(name, "gl_ObjectPlaneR") == 0) {
tokens[0] = STATE_TEXGEN_OBJECT_R;
tokens[0] = STATE_TEXGEN;
tokens[2] = STATE_TEXGEN_OBJECT_R;
}
else if (strcmp(name, "gl_ObjectPlaneQ") == 0) {
tokens[0] = STATE_TEXGEN_OBJECT_Q;
tokens[0] = STATE_TEXGEN;
tokens[2] = STATE_TEXGEN_OBJECT_Q;
}
else {
return -1; /* invalid array name */

View File

@@ -249,6 +249,11 @@ link_uniform_vars(GLcontext *ctx,
_mesa_append_uniform(shProg->Uniforms, p->Name, prog->Target, i);
if (uniform)
uniform->Initialized = p->Initialized;
/* Add the flag indicating that the program is dependent on constant
* state.
*/
prog->Parameters->StateFlags |= _NEW_PROGRAM;
}
/* The samplerMap[] table we build here is used to remap/re-index

View File

@@ -1041,11 +1041,11 @@ preprocess_source (slang_string *output, const char *source,
/* Parse optional macro parameters. */
while (prod[i++] != PARAM_END) {
if (state.cond.top->effective) {
pp_symbol *param;
pp_symbol *param;
id = (const char *) (&prod[i]);
idlen = _mesa_strlen (id);
id = (const char *) (&prod[i]);
idlen = _mesa_strlen (id);
if (state.cond.top->effective) {
pp_annotate (output, "%s, ", id);
param = pp_symbols_push (&symbol->parameters);
if (param == NULL)
@@ -1059,8 +1059,23 @@ preprocess_source (slang_string *output, const char *source,
id = (const char *) (&prod[i]);
idlen = _mesa_strlen (id);
if (state.cond.top->effective) {
slang_string replacement;
expand_state es;
pp_annotate (output, ") %s", id);
slang_string_pushs (&symbol->replacement, id, idlen);
slang_string_init(&replacement);
slang_string_pushs(&replacement, id, idlen);
/* Expand macro replacement. */
es.output = &symbol->replacement;
es.input = slang_string_cstr(&replacement);
es.state = &state;
if (!expand(&es, &state.symbols)) {
slang_string_free(&replacement);
goto error;
}
slang_string_free(&replacement);
}
i += idlen + 1;
}
@@ -1291,6 +1306,45 @@ error:
}
/**
* Remove the continuation characters from the input string.
* This is the very first step in preprocessing and is effective
* even inside comment blocks.
* If there is a whitespace between a backslash and a newline,
* this is not considered as a line continuation.
* \return GL_TRUE for success, GL_FALSE otherwise.
*/
static GLboolean
_slang_preprocess_backslashes(slang_string *output,
const char *input)
{
while (*input) {
if (input[0] == '\\') {
/* If a newline follows, eat the backslash and the newline. */
if (input[1] == '\r') {
if (input[2] == '\n') {
input += 3;
} else {
input += 2;
}
} else if (input[1] == '\n') {
if (input[2] == '\r') {
input += 3;
} else {
input += 2;
}
} else {
/* Leave the backslash alone. */
slang_string_pushc(output, *input++);
}
} else {
slang_string_pushc(output, *input++);
}
}
return GL_TRUE;
}
/**
* Run preprocessor on source code.
* \param extensions indicates which GL extensions are enabled
@@ -1308,6 +1362,7 @@ _slang_preprocess_directives(slang_string *output,
{
grammar pid, eid;
GLboolean success;
slang_string without_backslashes;
pid = grammar_load_from_text ((const byte *) (slang_pp_directives_syn));
if (pid == 0) {
@@ -1320,9 +1375,36 @@ _slang_preprocess_directives(slang_string *output,
grammar_destroy (pid);
return GL_FALSE;
}
success = preprocess_source (output, input, pid, eid, elog, extensions, pragmas);
slang_string_init(&without_backslashes);
success = _slang_preprocess_backslashes(&without_backslashes, input);
if (0) {
_mesa_printf("Pre-processed shader:\n");
_mesa_printf("%s", slang_string_cstr(&without_backslashes));
_mesa_printf("----------------------\n");
}
if (success) {
success = preprocess_source(output,
slang_string_cstr(&without_backslashes),
pid,
eid,
elog,
extensions,
pragmas);
}
slang_string_free(&without_backslashes);
grammar_destroy (eid);
grammar_destroy (pid);
if (0) {
_mesa_printf("Post-processed shader:\n");
_mesa_printf("%s", slang_string_cstr(output));
_mesa_printf("----------------------\n");
}
return success;
}

View File

@@ -570,6 +570,9 @@ void
_swrast_choose_point(GLcontext *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLfloat size = CLAMP(ctx->Point.Size,
ctx->Point.MinSize,
ctx->Point.MaxSize);
if (ctx->RenderMode == GL_RENDER) {
if (ctx->Point.PointSprite) {
@@ -578,7 +581,7 @@ _swrast_choose_point(GLcontext *ctx)
else if (ctx->Point.SmoothFlag) {
swrast->Point = smooth_point;
}
else if (ctx->Point.Size > 1.0 ||
else if (size > 1.0 ||
ctx->Point._Attenuated ||
ctx->VertexProgram.PointSizeEnabled) {
swrast->Point = large_point;

View File

@@ -1399,11 +1399,17 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
}
/*
* Write to renderbuffers
* Write to renderbuffers.
* Depending on glDrawBuffer() state and the which color outputs are
* written by the fragment shader, we may either replicate one color to
* all renderbuffers or write a different color to each renderbuffer.
* multiFragOutputs=TRUE for the later case.
*/
{
const GLuint numBuffers = fb->_NumColorDrawBuffers;
const GLboolean multiFragOutputs = numBuffers > 1;
const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
const GLboolean multiFragOutputs =
(fp && fp->Base.OutputsWritten >= (1 << FRAG_RESULT_DATA0));
GLuint buf;
for (buf = 0; buf < numBuffers; buf++) {

View File

@@ -226,7 +226,7 @@ lerp_rgba_3d(GLchan result[4], GLfloat a, GLfloat b, GLfloat c,
* If A is a signed integer, A % B doesn't give the right value for A < 0
* (in terms of texture repeat). Just casting to unsigned fixes that.
*/
#define REMAINDER(A, B) ((unsigned) (A) % (unsigned) (B))
#define REMAINDER(A, B) (((A) + (B) * 1024) % (B))
/**
@@ -2061,6 +2061,7 @@ clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max,
fcol -= 0.5F;
i0 = IFLOOR(fcol);
i1 = i0 + 1;
break;
default:
_mesa_problem(NULL, "bad wrapMode in clamp_rect_coord_linear");
i0 = i1 = 0;

View File

@@ -114,8 +114,11 @@ static void bind_array_obj( GLcontext *ctx )
for (i = 0; i < 8; i++)
exec->array.legacy_array[VERT_ATTRIB_TEX0 + i] = &ctx->Array.ArrayObj->TexCoord[i];
for (i = 0; i < VERT_ATTRIB_MAX; i++)
for (i = 0; i < MAX_VERTEX_ATTRIBS; i++) {
assert(i < Elements(ctx->Array.ArrayObj->VertexAttrib));
assert(i < Elements(exec->array.generic_array));
exec->array.generic_array[i] = &ctx->Array.ArrayObj->VertexAttrib[i];
}
exec->array.array_obj = ctx->Array.ArrayObj->Name;
}

View File

@@ -184,6 +184,7 @@ static void vbo_exec_bind_arrays( GLcontext *ctx )
(ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_GENERIC0)) {
exec->vtx.inputs[16] = exec->vtx.inputs[0];
exec->vtx.attrsz[16] = exec->vtx.attrsz[0];
exec->vtx.attrptr[16] = exec->vtx.attrptr[0];
exec->vtx.attrsz[0] = 0;
}
break;