Compare commits

...

73 Commits

Author SHA1 Message Date
Ian Romanick
18f3afbe88 docs: 7.5.2 md5 sums 2009-09-28 11:41:23 -07:00
Ian Romanick
b807d49f18 Prep for 7.5.2 release 2009-09-28 11:33:52 -07:00
Robert Noland
d09941c8cc Fix build on non GLIBC platforms (FreeBSD at least)
Build was broken by commit 9666529b5a

I'm not certain that this is entirely the correct fix since the demo
from bug #23774 seemed to work before the commit that broke the build.

Signed-off-by: Robert Noland <rnoland@2hip.net>
Signed-off-by: Brian Paul <brianp@vmware.com>
2009-09-28 09:48:45 -06:00
Brian Paul
fc613848e6 docs: list additional 7.5.2 bug fixes 2009-09-28 09:43:42 -06:00
Brian Paul
c7d0f0b46c docs: document gallium mipmap generation fix 2009-09-28 09:38:50 -06:00
Brian Paul
c7fddaf612 st/mesa: fix st_generate_mipmap() issues
The main issue is we didn't always have a gallium texture object with
enough space to store the to-be-generated mipmap levels.  When that's
the case, allocate a new gallium texture and use st_texure_finalize()
to copy images from the old texture to the new one.

We also had the baseLevel parameter to st_render_mipmap() wrong.
2009-09-28 09:37:16 -06:00
Brian Paul
e3a6f57ad6 st/mesa: fix/simplify st_texture_object::lastLevel calculation
Don't compute the st_texture_object::lastLevel field based on the texture
filters.  Use the _MaxLevel value that core Mesa computes for us.
When called from the GenerateMipmap path, we'll use the lastLevel field
as-is.
2009-09-28 09:35:08 -06:00
Brian Paul
41d0606b7f gallium/util: add sanity check assertions 2009-09-28 09:35:04 -06:00
Eric Anholt
126d62edd1 i915: Fix GetBufferSubData in the case of a system-memory BO.
Bug #23760 (crashes in wine)
2009-09-24 20:04:42 -07:00
Vinson Lee
1730b8db12 softpipe: Increase GL_MAX_3D_TEXTURE_SIZE to 256. 2009-09-24 15:59:57 -06:00
Brian Paul
60b152a1b3 mesa: remove glEnable(GL_DEPTH_BOUNDS_TEST_EXT) check/warning
At the time of the enable there may not be a Z buffer, but one
may be attached to the FBO later.
2009-09-24 14:24:14 -06:00
Brian Paul
adfa778c8e mesa: remove rgbMode check in enable_texture()
If the currently bound FBO isn't yet validated it's possible for
rgbMode to be zero so we'll lose the texture enable.
This could fix some FBO rendering glitches, but I don't know of
any specific instances.
2009-09-24 14:19:06 -06:00
Brian Paul
2acd5de226 swrast: add lod bias when texture sampling
Mostly fixes progs/demos/lodbias when MESA_TEX_PROG=1.  But the LOD still
seems off by -1 or so.
May be an issue with the params passed to _swrast_compute_lambda()
2009-09-23 13:36:44 -06:00
Brian Paul
890f37d4d9 mesa: don't bias LOD in shader interpreter; do it in swrast 2009-09-23 13:36:44 -06:00
Brian Paul
ad935c3f47 swrast: fix typo in partial derivatives parameter passing 2009-09-23 13:36:43 -06:00
Keith Whitwell
be66ff51ec st/mesa: trim calculated userbuffer size
In get_array_bounds we were previously defining a user buffer sized as
(nr_vertices * stride).  The trouble is that if the vertex data
occupies less than stride bytes, the extra tailing (stride - size)
bytes may extend outside the memory actually allocated by the app and
caused a segfault.

To fix this, define a the buffer bounds to be:

   ptr .. ptr + (nr-1)*stride + element_size
2009-09-23 18:55:46 +01:00
Brian Paul
bc75464760 glx: include string.h to silence missing memset() prototype warning 2009-09-22 13:19:15 -06:00
Brian Paul
52cadf7592 mesa: fix error message text 2009-09-22 13:19:11 -06:00
Tormod Volden
e857303305 GLX: Warn only once about applications calling GLX 1.3 functions
The warnings introduced in 1f309c40b8
would pour out generously from some applications. This patch adds a
"warn once" wrapper macro, heavily inspired by
src/mesa/drivers/dri/r600/radeon_debug.h

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2009-09-21 15:29:52 -07:00
Eric Anholt
2b83483fb4 intel: Mark the FBO as incomplete if there's no intel_renderbuffer for it.
This happens to rendering with textures with a border, which had resulted
in a segfault on dereferencing the irb.

(cherry-picked from commit 8bba183b9e)
2009-09-21 10:02:38 -06:00
Brian Paul
5a0b29050f softpipe: Fix cube face selection.
If arx and ary are equal, we still want to choose from one of them,
and not arz.

(cherry picked from commit de685b37a9)
2009-09-21 08:36:05 -06:00
Brian Paul
077e3de989 swrast: fix cube face selection
If arx and ary are equal, we still want to choose from one of them,
and not arz.

This is the same as Michal's softpipe fix.
2009-09-21 08:36:05 -06:00
Michel Dänzer
999592745f intel: Fix crash in intel_flush().
Since commit 2921a2555d ('intel: Deassociated
drawables from private context struct in intelUnbindContext'),
intel->driDrawable may be NULL in intel_flush().
2009-09-21 10:28:37 +02:00
Nicolai Hähnle
c4ce6f6a7c mesa/st: Initialize format bits of framebuffer renderbuffers
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-09-20 16:54:40 +02:00
Ian Romanick
9666529b5a glx: Use initstate_r / random_r instead of corrupting global random number state
Previously srandom and random were used.  This cause the global random
number generator state to be modified.  This caused problems for
applications that called srandom before calling into GLX.  By using
local state the global state is left unmodified.

This should fix bug #23774.
2009-09-16 16:43:50 -07:00
Brian Paul
08d39251a7 st/mesa: fix some incorrect branching/clean-up code in TexImage functions
We need to be sure to call the _mesa_unmap_teximage_pbo() function if we
called _mesa_validate_pbo_teximage().
2009-09-16 13:07:15 -06:00
Brian Paul
cfa1a0a609 st/mesa: fix texture memory allocation bug
The following example caused an incorrect GL_OUT_OF_MEMORY error to be
raised in glTexSubImage2D:

   glTexImage2D(level=0, width=32, height=32, pixels=NULL);
   glTexImage2D(level=0, width=64, height=64, pixels=NULL);
   glTexSubImage2D(level=0, pixels!=NULL);

The second glTexImage2D() call needs to cause the first image to be
deallocated then reallocated at the new size.  This was not happening
because we were testing for pixels==NULL too early.
2009-09-16 12:57:26 -06:00
Ian Romanick
2921a2555d intel: Deassociated drawables from private context struct in intelUnbindContext
The generic DRI infrastructure makes sure that __DRIcontextRec::driDrawablePriv
and __DRIcontextRec::driReadablePriv are set to NULL after unbinding a
context.  However, the intel_context structure keeps cached copies of
these pointers.  If these cached pointers are not NULLed and the
drawable is actually destroyed after unbinding the context (typically
by way of glXDestroyWindow), freed memory will be dereferenced in
intelDestroyContext.

This should fix bug #23418.
2009-09-16 07:39:58 -07:00
Brian Paul
d9ddbc3f47 docs: glUniform functions are now compiled into display lists 2009-09-15 15:12:29 -06:00
Brian Paul
41fff1b9a1 mesa: compile glUniformMatrix() functions into display lists
I believe this is the last of the shader-related functions that needed
display list treatment.
2009-09-15 15:10:29 -06:00
Brian Paul
6681981fe1 mesa: implement more glUniform display list functions 2009-09-15 14:56:55 -06:00
Brian Paul
3ad108b77f docs: document glUseProgram display list fix 2009-09-15 14:38:52 -06:00
Brian Paul
f42c66c138 mesa: compile glUniform4f() into display lists
Note: there are more glUniform functions to compile...
2009-09-15 14:37:45 -06:00
Brian Paul
81de9d68f7 mesa: compile glUseProgram/glUseProgramObjectARB into display lists
Fixes bug 23746
2009-09-15 14:37:45 -06:00
Ian Romanick
1f309c40b8 GLX: Complain when buggy applications call GLX 1.3 functions. 2009-09-15 13:12:22 -07:00
Brian Paul
799631acb1 progs/vp: print program and error info when program does not compile 2009-09-14 17:48:17 -06:00
Brian Paul
ac3c8e3b53 glsl: added some link debug code (disabled) 2009-09-14 17:32:03 -06:00
Brian Paul
3129b2403e docs: document linker/preprocessor bug fix 2009-09-14 17:27:47 -06:00
Brian Paul
b8b774c775 glsl: remove extra #version directives from concatenated shader sources
When we concatenate shaders to do our form of poor-man linking, if there's
multiple #version directives, preprocessing fails.  This change disables
the extra #version directives by changing the first two chars to //.

This should help with some Wine issues such as bug 23946.
2009-09-14 17:24:25 -06:00
Thierry Vignaud
1402ea8f39 configure: fix comment 2009-09-14 11:48:51 -06:00
Dan Nicholson
9c8b69302c Use CFLAGS as HOST_CFLAGS by default
Unless we're cross compiling, the HOST_CFLAGS should be the same as the
normal CFLAGS. This allows the x86 and x86_64 asm to be built correctly
with a native compiler using -m32/-m64.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
2009-09-12 09:35:43 -07:00
Vinson Lee
0fa1692f14 mesa: raise GL_INVALID_ENUM not GL_INVALID_VALUE for glTexParamter errors
Signed-off-by: Brian Paul <brianp@vmware.com>
2009-09-11 08:04:37 -06:00
Brian Paul
4d9bbabb83 docs: document Gallium glDrawPixels(GL_STENCIL_INDEX) fix 2009-09-10 14:15:07 -06:00
Brian Paul
3f4d776199 softpipe: minor indentation fix 2009-09-10 14:14:18 -06:00
Brian Paul
988db64119 softpipe: set dirty_render_cache in softpipe_clear()
This fixes a bug seen when doing a glDrawPixels(GL_STENCIL_INDEX) right
after a glClear().  The check-for-flush test was failing because we
didn't set the dirty_render_cache flag in softpipe_clear().  So we saw
stale data when we mapped the stencil buffer.
2009-09-10 14:11:41 -06:00
Brian Paul
79a3e298c5 docs: initial 7.5.2 release notes page 2009-09-10 12:50:08 -06:00
Zhenyu Wang
2dd3da3a4a intel: add B43 chipset support
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>

Hopefully this will be one of the last cherry-picks.

(cherry picked from commit ca246dd186)
2009-09-10 11:18:41 -07:00
Vinson Lee
d27d659043 scons: Set default_dri to no for Mac OS.
Mac OS does not have libdrm.
2009-09-09 08:21:07 -06:00
Brian Paul
42943a4cf9 mesa: bump version to 7.5.2
I'm not 100% sure there'll be a 7.5.2 release, but just in case.
2009-09-08 14:45:27 -06:00
Brian Paul
8de625c7cf i965: fix incorrect test for vertex position attribute 2009-09-08 12:21:42 -06:00
Brian Paul
18bdb6e712 egl: also use X types for building on Apple/MacOS X
See bug 20413.
2009-09-08 09:20:43 -06:00
Peter Hutterer
bf19638a00 prog/glsl: fix Makefile for samplers_array.
The rule added in 488b3c4d1b does not use the
right INCDIR, breaking the build when GL isn't installed in the default include
paths.

7.5 branch only fix, already fixed in master by rewriting the Makefile
(ceb9459ed5)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-07 12:37:54 +10:00
Eric Anholt
b2cba25f9e i965: Fix warnings in intel_pixel_read.c.
(cherry picked from commit c80ce5ac90)
2009-09-04 14:41:33 -07:00
Eric Anholt
cf820a045f intel: Also get the DRI2 front buffer when doing front buffer reading.
(cherry picked from commit df70d3049a)
2009-09-04 14:40:21 -07:00
Eric Anholt
2855ee82c6 intel: Update Mesa state before span setup in glReadPixels.
We could have mapped the wrong set of draw buffers.  Noticed while looking
into a DRI2 glean ReadPixels issue.
(cherry picked from commit afc981ee46)
2009-09-04 14:40:15 -07:00
Eric Anholt
04081a164c intel: Move intel_pixel_read.c to shared for use with i965.
(cherry picked from commit dcfe0d66bf)
2009-09-04 14:40:12 -07:00
Eric Anholt
1d1dfc96c4 i965: Add missing state dependency of sf_unit on _NEW_BUFFERS.
(cherry picked from commit 99174e7630)
2009-09-04 14:12:37 -07:00
Eric Anholt
a9504edee3 intel: Align cubemap texture height to its padding requirements.
(cherry picked from commit a70e131584)
(cherry picked from commit 29e51c3872)
2009-09-04 14:12:37 -07:00
Eric Anholt
945d34e88a intel: Align untiled region height to 2 according to 965 docs.
This may or may not be required pre-965, but it doesn't seem unlikely, and
I'd rather be safe.
(cherry picked from commit b053474378)
2009-09-04 14:12:36 -07:00
Eric Anholt
94d3b832cc i965: Fix source depth reg setting for FSes reading and writing to depth.
For some IZ setups, we'd forget to account for the source depth register
being present, so we'd both read the wrong reg, and write output depth to
the wrong reg.

Bug #22603.
(cherry picked from commit f44916414e)
2009-09-04 14:12:36 -07:00
Eric Anholt
8c764d5c34 i965: Respect CondSwizzle in OPCODE_IF.
Fixes piglit glsl-vs-if-bool and progs/glsl/twoside, and will likely be
useful for the looping code.

Bug #18992
(cherry picked from commit 78c022acd0)
(cherry picked from commit 63d7a2f53f)
2009-09-04 14:12:36 -07:00
Brian Paul
a0b7850f1d i965: asst clean-ups, etc in brw_vs_emit()
(cherry picked from commit fd7d764514)
2009-09-04 14:12:36 -07:00
Eric Anholt
3d6c73513c i965: Emit conditional code updates as required for GLSL VS if statements.
Previously, we'd be branching based on whatever condition code happened to be
laying around.
(cherry picked from commit 7007f8b352)
2009-09-04 14:12:36 -07:00
Eric Anholt
83e6c67363 i965: Spell "conditional" correctly. 2009-09-04 14:12:36 -07:00
Eric Anholt
f396263651 i965: Fix RECT shadow sampling by not losing the other texcoords.
Bug #20821
(cherry picked from commit 191e028de2)
2009-09-04 14:12:36 -07:00
Eric Anholt
63b3fa2bce i965: Assert that the offset in the VBO is below the VBO size.
This avoids sending a bad buffer address to the GPU due to programmer error,
and is permitted by the ARB_vbo spec.  Note that we still have the opportunity
to dereference past the end of the GPU, because we aren't clipping to a
correct _MaxElement, but that appears to be harder than it should be.  This
gets us the 90% solution.

Bug #19911.
(cherry picked from commit d7430d942f)
2009-09-04 14:12:36 -07:00
Eric Anholt
217af32c2d i965: Even if no VS inputs are set, still load some amount of URB as required.
See comment on Vertex URB Entry Read Length for VS_STATE.

This, combined with the previous three commits, fixes #22945.
(cherry picked from commit e340d4f986)
2009-09-04 14:12:35 -07:00
Eric Anholt
456a16491b i965: Make sure the VS URB size is big enough to fit a VF VUE.
This fix is just from code and docs inspection, but it may fix hangs on
some applications.

(cherry picked from commit e93848e595)
2009-09-04 14:12:35 -07:00
Eric Anholt
9eca0e5350 i965: Don't emit bad packets when no VBs are referenced.
It appears that sometimes Mesa (and I suppose a VS could as well) emits
a program which references no vertex data, and thus we end up with
nr_enabled == 0 even though some VBs are enabled.  We'd end up emitting
VB/VE packet headers of 0xffffffff in that case, leading to GPU hangs.

Bug #22945 (wine with an uncompiled VS)
(cherry picked from commit d1fbfd0f96)
2009-09-04 14:12:35 -07:00
Eric Anholt
7e26bdb849 i965: Calculate enabled[] and nr_enabled once and re-use the values.
The code duplication bothered me.
(cherry picked from commit 9b9cb30d12)
2009-09-04 14:12:35 -07:00
Eric Anholt
213ac4bb5d i965: Set the max index buffer address correctly according to the docs.
It's the last addressable byte, not the byte after the end of the buffer.
(cherry picked from commit b72dea5441)
2009-09-04 14:12:35 -07:00
Brian Paul
cab307ce6b i965: rename var: s/tmp/vs_inputs/
(cherry picked from commit 840c09fc71)
2009-09-04 14:12:35 -07:00
Brian Paul
1960da2e09 docs: 7.5.1 md5 sums 2009-09-03 15:49:10 -06:00
55 changed files with 1543 additions and 481 deletions

View File

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

View File

@@ -33,9 +33,9 @@ else:
default_machine = _platform.machine()
default_machine = _machine_map.get(default_machine, 'generic')
if default_platform in ('linux', 'freebsd', 'darwin'):
if default_platform in ('linux', 'freebsd'):
default_dri = 'yes'
elif default_platform in ('winddk', 'windows', 'wince'):
elif default_platform in ('winddk', 'windows', 'wince', 'darwin'):
default_dri = 'no'
else:
default_dri = 'no'

View File

@@ -10,7 +10,7 @@ CONFIG_NAME = default
# Version info
MESA_MAJOR=7
MESA_MINOR=5
MESA_TINY=1
MESA_TINY=2
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
# external projects. This should be useless now that we use libdrm.
@@ -23,6 +23,7 @@ HOST_CC = $(CC)
CFLAGS = -O
CXXFLAGS = -O
LDFLAGS =
HOST_CFLAGS = $(CFLAGS)
GLU_CFLAGS =
# Compiler for building demos/tests/etc

View File

@@ -1188,7 +1188,7 @@ if test "x$enable_gallium_radeon" = xyes; then
fi
dnl
dnl Gallium Radeon configuration
dnl Gallium Nouveau configuration
dnl
AC_ARG_ENABLE([gallium-nouveau],
[AS_HELP_STRING([--enable-gallium-nouveau],

View File

@@ -31,7 +31,15 @@ for DRI hardware acceleration.
<h2>MD5 checksums</h2>
<pre>
tbd
d7269e93bc7484430637d54ced250876 MesaLib-7.5.1.tar.gz
877d6a4b24efc2b1d02aa553f262cba8 MesaLib-7.5.1.tar.bz2
23f4fb757a05c8396425681234ae20e5 MesaLib-7.5.1.zip
5af4bd113652108f5cec5113dad813f2 MesaDemos-7.5.1.tar.gz
785402e3b9f0e335538fcc6bf19f6987 MesaDemos-7.5.1.tar.bz2
950058cc6d6106e9c7d5876a03789fe9 MesaDemos-7.5.1.zip
cb52ce2c93389c2711cbe8d857ec5303 MesaGLUT-7.5.1.tar.gz
e3a9892e056d625c5353617a7c5b7e9c MesaGLUT-7.5.1.tar.bz2
da1de364df148c94b4994006191a1e69 MesaGLUT-7.5.1.zip
</pre>

67
docs/relnotes-7.5.2.html Normal file
View File

@@ -0,0 +1,67 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.5.2 Release Notes, 28 September 2009</H1>
<p>
Mesa 7.5.2 is a bug-fix release fixing issues found since the 7.5.1 release.
</p>
<p>
The main new feature of Mesa 7.5.x is the
<a href="http://wiki.freedesktop.org/wiki/Software/gallium"
target="_parent">Gallium3D</a> infrastructure.
</p>
<p>
Mesa 7.5.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>
43a90191dd9f76cd65dcc1ac91f3be70 MesaLib-7.5.2.tar.gz
94e47a499f1226803869c2e37a6a8e3a MesaLib-7.5.2.tar.bz2
1ecb822b567ad67a0617361d45206b67 MesaLib-7.5.2.zip
2718fdce7e075911d6147beb8f27104b MesaDemos-7.5.2.tar.gz
4e0f5ccd58afe21eddcd94327d926e86 MesaDemos-7.5.2.tar.bz2
f621f8c223b278d7c8e49a012d56ca25 MesaDemos-7.5.2.zip
83c16c1d6bcfcc3f97aab5d2fe430b4c MesaGLUT-7.5.2.tar.gz
e5d03bedae369ea3705783573bb33813 MesaGLUT-7.5.2.tar.bz2
e82ba28e00d653e6f437d32be8ca8481 MesaGLUT-7.5.2.zip
</pre>
<h2>New features</h2>
<ul>
<li>Detect B43 chipset in Intel driver
</ul>
<h2>Bug fixes</h2>
<ul>
<li>Assorted bug fixes for i965/i945 drivers
<li>Fixed Gallium glDrawPixels(GL_STENCIL_INDEX) failure.
<li>Fixed GLSL linker/preprocessor version directive issue seen in Wine
(such as bug 23946)
<li>glUseProgram() is now compiled into display lists (bug 23746).
<li>glUniform functions are now compiled into display lists
<li>Auto mipmap generation didn't work reliably with Gallium.
<li>Fixed random number usage in GLX code.
<li>Fixed invalid GL_OUT_OF_MEMORY error sometimes raised by glTexSubImage2D
when using Gallium.
</ul>
</body>
</html>

View File

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

View File

@@ -69,7 +69,8 @@ typedef HWND NativeWindowType;
typedef HBITMAP NativePixmapType;
/** END Added for Windows **/
#elif defined(__gnu_linux__) || defined(__FreeBSD__) || defined(__sun)
#elif defined(__gnu_linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__APPLE__)
/** BEGIN Added for X (Mesa) **/
#ifndef EGLAPI

View File

@@ -190,7 +190,7 @@ samplers: samplers.o $(UTIL_OBJS)
samplers_array.o: samplers.c $(UTIL_HEADERS)
$(APP_CC) $(CFLAGS) -DSAMPLERS_ARRAY $< -c -o $@
$(APP_CC) -I$(INCDIR) $(CFLAGS) -DSAMPLERS_ARRAY $< -c -o $@
samplers_array: samplers_array.o $(UTIL_OBJS)

View File

@@ -119,6 +119,12 @@ static void Init( void )
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
sz, (const GLubyte *) buf);
if (glGetError()) {
printf("Program failed to compile:\n%s\n", buf);
printf("Error: %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
exit(1);
}
assert(glIsProgramARB(prognum));
}

View File

@@ -1519,6 +1519,17 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
uint zslice = 0;
uint offset;
/* The texture object should have room for the levels which we're
* about to generate.
*/
assert(lastLevel <= pt->last_level);
/* If this fails, why are we here? */
assert(lastLevel > baseLevel);
assert(filter == PIPE_TEX_FILTER_LINEAR ||
filter == PIPE_TEX_FILTER_NEAREST);
/* check if we can render in the texture's format */
if (!screen->is_format_supported(screen, pt->format, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) {

View File

@@ -85,5 +85,7 @@ softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
/* non-cached surface */
pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, cv);
#endif
}
}
softpipe->dirty_render_cache = TRUE;
}

View File

@@ -84,7 +84,7 @@ softpipe_get_param(struct pipe_screen *screen, int param)
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return 12; /* max 2Kx2K */
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
return 8; /* max 128x128x128 */
return 9; /* max 256x256x256 */
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return 12; /* max 2Kx2K */
case PIPE_CAP_TGSI_CONT_SUPPORTED:

View File

@@ -464,7 +464,7 @@ choose_cube_face(float rx, float ry, float rz, float *newS, float *newT)
unsigned face;
float sc, tc, ma;
if (arx > ary && arx > arz) {
if (arx >= ary && arx >= arz) {
if (rx >= 0.0F) {
face = PIPE_TEX_FACE_POS_X;
sc = -rz;
@@ -478,7 +478,7 @@ choose_cube_face(float rx, float ry, float rz, float *newS, float *newT)
ma = arx;
}
}
else if (ary > arx && ary > arz) {
else if (ary >= arx && ary >= arz) {
if (ry >= 0.0F) {
face = PIPE_TEX_FACE_POS_Y;
sc = rx;

View File

@@ -39,6 +39,30 @@
#include "glxextensions.h"
#include "glcontextmodes.h"
#define WARN_ONCE_GLX_1_3(a, b) { \
static int warned=1; \
if(warned) { \
warn_GLX_1_3((a), b ); \
warned=0; \
} \
}
/**
* Emit a warning when clients use GLX 1.3 functions on pre-1.3 systems.
*/
static void
warn_GLX_1_3(Display *dpy, const char *function_name)
{
__GLXdisplayPrivate *priv = __glXInitialize(dpy);
if (priv->minorVersion < 3) {
fprintf(stderr,
"WARNING: Application calling GLX 1.3 function \"%s\" "
"when GLX 1.3 is not supported! This is an application bug!\n",
function_name);
}
}
/**
* Change a drawable's attribute.
@@ -559,6 +583,8 @@ glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list)
width = 0;
height = 0;
WARN_ONCE_GLX_1_3(dpy, __func__);
for (i = 0; attrib_list[i * 2]; i++) {
switch (attrib_list[i * 2]) {
case GLX_PBUFFER_WIDTH:
@@ -592,6 +618,7 @@ PUBLIC void
glXQueryDrawable(Display * dpy, GLXDrawable drawable,
int attribute, unsigned int *value)
{
WARN_ONCE_GLX_1_3(dpy, __func__);
GetDrawableAttribute(dpy, drawable, attribute, value);
}
@@ -645,6 +672,8 @@ PUBLIC GLXPixmap
glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap,
const int *attrib_list)
{
WARN_ONCE_GLX_1_3(dpy, __func__);
return CreateDrawable(dpy, (__GLcontextModes *) config,
(Drawable) pixmap, attrib_list, X_GLXCreatePixmap);
}
@@ -654,6 +683,8 @@ PUBLIC GLXWindow
glXCreateWindow(Display * dpy, GLXFBConfig config, Window win,
const int *attrib_list)
{
WARN_ONCE_GLX_1_3(dpy, __func__);
return CreateDrawable(dpy, (__GLcontextModes *) config,
(Drawable) win, attrib_list, X_GLXCreateWindow);
}
@@ -662,6 +693,8 @@ glXCreateWindow(Display * dpy, GLXFBConfig config, Window win,
PUBLIC void
glXDestroyPixmap(Display * dpy, GLXPixmap pixmap)
{
WARN_ONCE_GLX_1_3(dpy, __func__);
DestroyDrawable(dpy, (GLXDrawable) pixmap, X_GLXDestroyPixmap);
}
@@ -669,6 +702,8 @@ glXDestroyPixmap(Display * dpy, GLXPixmap pixmap)
PUBLIC void
glXDestroyWindow(Display * dpy, GLXWindow win)
{
WARN_ONCE_GLX_1_3(dpy, __func__);
DestroyDrawable(dpy, (GLXDrawable) win, X_GLXDestroyWindow);
}
@@ -689,3 +724,4 @@ GLX_ALIAS_VOID(glXGetSelectedEventSGIX,
(Display * dpy, GLXDrawable drawable,
unsigned long *mask), (dpy, drawable, mask),
glXGetSelectedEvent)

View File

@@ -77,6 +77,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define HASH_MAGIC 0xdeadbeef
#define HASH_DEBUG 0
@@ -87,10 +88,21 @@
#define HASH_ALLOC malloc
#define HASH_FREE free
#define HASH_RANDOM_DECL
#define HASH_RANDOM_INIT(seed) srandom(seed)
#define HASH_RANDOM random()
#ifndef __GLIBC__
#define HASH_RANDOM_DECL char *ps, rs[256]
#define HASH_RANDOM_INIT(seed) ps = initstate(seed, rs, sizeof(rs))
#define HASH_RANDOM random()
#define HASH_RANDOM_DESTROY setstate(ps)
#else
#define HASH_RANDOM_DECL struct random_data rd; int32_t rv; char rs[256]
#define HASH_RANDOM_INIT(seed) \
do { \
(void) memset(&rd, 0, sizeof(rd)); \
(void) initstate_r(seed, rs, sizeof(rs), &rd); \
} while(0)
#define HASH_RANDOM ((void) random_r(&rd, &rv), rv)
#define HASH_RANDOM_DESTROY
#endif
typedef struct __glxHashBucket
{

View File

@@ -1,306 +0,0 @@
/**************************************************************************
*
* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#include "main/glheader.h"
#include "main/enums.h"
#include "main/mtypes.h"
#include "main/macros.h"
#include "main/image.h"
#include "main/bufferobj.h"
#include "swrast/swrast.h"
#include "intel_screen.h"
#include "intel_context.h"
#include "intel_batchbuffer.h"
#include "intel_blit.h"
#include "intel_buffers.h"
#include "intel_regions.h"
#include "intel_pixel.h"
#include "intel_buffer_objects.h"
/* For many applications, the new ability to pull the source buffers
* back out of the GTT and then do the packing/conversion operations
* in software will be as much of an improvement as trying to get the
* blitter and/or texture engine to do the work.
*
* This step is gated on private backbuffers.
*
* Obviously the frontbuffer can't be pulled back, so that is either
* an argument for blit/texture readpixels, or for blitting to a
* temporary and then pulling that back.
*
* When the destination is a pbo, however, it's not clear if it is
* ever going to be pulled to main memory (though the access param
* will be a good hint). So it sounds like we do want to be able to
* choose between blit/texture implementation on the gpu and pullback
* and cpu-based copying.
*
* Unless you can magically turn client memory into a PBO for the
* duration of this call, there will be a cpu-based copying step in
* any case.
*/
static GLboolean
do_texture_readpixels(GLcontext * ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack,
struct intel_region *dest_region)
{
#if 0
struct intel_context *intel = intel_context(ctx);
intelScreenPrivate *screen = intel->intelScreen;
GLint pitch = pack->RowLength ? pack->RowLength : width;
__DRIdrawablePrivate *dPriv = intel->driDrawable;
int textureFormat;
GLenum glTextureFormat;
int destFormat, depthFormat, destPitch;
drm_clip_rect_t tmp;
if (INTEL_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s\n", __FUNCTION__);
if (ctx->_ImageTransferState ||
pack->SwapBytes || pack->LsbFirst || !pack->Invert) {
if (INTEL_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s: check_color failed\n", __FUNCTION__);
return GL_FALSE;
}
intel->vtbl.meta_texrect_source(intel, intel_readbuf_region(intel));
if (!intel->vtbl.meta_render_dest(intel, dest_region, type, format)) {
if (INTEL_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s: couldn't set dest %s/%s\n",
__FUNCTION__,
_mesa_lookup_enum_by_nr(type),
_mesa_lookup_enum_by_nr(format));
return GL_FALSE;
}
LOCK_HARDWARE(intel);
if (intel->driDrawable->numClipRects) {
intel->vtbl.install_meta_state(intel);
intel->vtbl.meta_no_depth_write(intel);
intel->vtbl.meta_no_stencil_write(intel);
if (!driClipRectToFramebuffer(ctx->ReadBuffer, &x, &y, &width, &height)) {
UNLOCK_HARDWARE(intel);
SET_STATE(i830, state);
if (INTEL_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s: cliprect failed\n", __FUNCTION__);
return GL_TRUE;
}
y = dPriv->h - y - height;
x += dPriv->x;
y += dPriv->y;
/* Set the frontbuffer up as a large rectangular texture.
*/
intel->vtbl.meta_tex_rect_source(intel, src_region, textureFormat);
intel->vtbl.meta_texture_blend_replace(i830, glTextureFormat);
/* Set the 3d engine to draw into the destination region:
*/
intel->vtbl.meta_draw_region(intel, dest_region);
intel->vtbl.meta_draw_format(intel, destFormat, depthFormat); /* ?? */
/* Draw a single quad, no cliprects:
*/
intel->vtbl.meta_disable_cliprects(intel);
intel->vtbl.draw_quad(intel,
0, width, 0, height,
0x00ff00ff, x, x + width, y, y + height);
intel->vtbl.leave_meta_state(intel);
}
UNLOCK_HARDWARE(intel);
intel_region_wait_fence(ctx, dest_region); /* required by GL */
return GL_TRUE;
#endif
return GL_FALSE;
}
static GLboolean
do_blit_readpixels(GLcontext * ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack, GLvoid * pixels)
{
struct intel_context *intel = intel_context(ctx);
struct intel_region *src = intel_readbuf_region(intel);
struct intel_buffer_object *dst = intel_buffer_object(pack->BufferObj);
GLuint dst_offset;
GLuint rowLength;
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s\n", __FUNCTION__);
if (!src)
return GL_FALSE;
if (dst) {
/* XXX This validation should be done by core mesa:
*/
if (!_mesa_validate_pbo_access(2, pack, width, height, 1,
format, type, pixels)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels");
return GL_TRUE;
}
}
else {
/* PBO only for now:
*/
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - not PBO\n", __FUNCTION__);
return GL_FALSE;
}
if (ctx->_ImageTransferState ||
!intel_check_blit_format(src, format, type)) {
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - bad format for blit\n", __FUNCTION__);
return GL_FALSE;
}
if (pack->Alignment != 1 || pack->SwapBytes || pack->LsbFirst) {
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: bad packing params\n", __FUNCTION__);
return GL_FALSE;
}
if (pack->RowLength > 0)
rowLength = pack->RowLength;
else
rowLength = width;
if (pack->Invert) {
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: MESA_PACK_INVERT not done yet\n", __FUNCTION__);
return GL_FALSE;
}
else {
rowLength = -rowLength;
}
/* XXX 64-bit cast? */
dst_offset = (GLuint) _mesa_image_address(2, pack, pixels, width, height,
format, type, 0, 0, 0);
/* Although the blits go on the command buffer, need to do this and
* fire with lock held to guarentee cliprects are correct.
*/
intelFlush(&intel->ctx);
LOCK_HARDWARE(intel);
if (intel->driDrawable->numClipRects) {
GLboolean all = (width * height * src->cpp == dst->Base.Size &&
x == 0 && dst_offset == 0);
dri_bo *dst_buffer = intel_bufferobj_buffer(intel, dst,
all ? INTEL_WRITE_FULL :
INTEL_WRITE_PART);
__DRIdrawablePrivate *dPriv = intel->driDrawable;
int nbox = dPriv->numClipRects;
drm_clip_rect_t *box = dPriv->pClipRects;
drm_clip_rect_t rect;
drm_clip_rect_t src_rect;
int i;
src_rect.x1 = dPriv->x + x;
src_rect.y1 = dPriv->y + dPriv->h - (y + height);
src_rect.x2 = src_rect.x1 + width;
src_rect.y2 = src_rect.y1 + height;
for (i = 0; i < nbox; i++) {
if (!intel_intersect_cliprects(&rect, &src_rect, &box[i]))
continue;
intelEmitCopyBlit(intel,
src->cpp,
src->pitch, src->buffer, 0, src->tiling,
rowLength, dst_buffer, dst_offset, GL_FALSE,
rect.x1,
rect.y1,
rect.x1 - src_rect.x1,
rect.y2 - src_rect.y2,
rect.x2 - rect.x1, rect.y2 - rect.y1,
GL_COPY);
}
}
UNLOCK_HARDWARE(intel);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - DONE\n", __FUNCTION__);
return GL_TRUE;
}
void
intelReadPixels(GLcontext * ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack, GLvoid * pixels)
{
if (INTEL_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s\n", __FUNCTION__);
intelFlush(ctx);
if (do_blit_readpixels
(ctx, x, y, width, height, format, type, pack, pixels))
return;
if (do_texture_readpixels
(ctx, x, y, width, height, format, type, pack, pixels))
return;
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
_swrast_ReadPixels(ctx, x, y, width, height, format, type, pack, pixels);
}

View File

@@ -0,0 +1 @@
../intel/intel_pixel_read.c

View File

@@ -22,6 +22,7 @@ DRIVER_SOURCES = \
intel_pixel_bitmap.c \
intel_pixel_copy.c \
intel_pixel_draw.c \
intel_pixel_read.c \
intel_state.c \
intel_swapbuffers.c \
intel_tex.c \

View File

@@ -386,6 +386,8 @@ struct brw_cached_batch_item {
struct brw_vertex_element {
const struct gl_client_array *glarray;
/** The corresponding Mesa vertex attribute */
gl_vert_attrib attrib;
/** Size of a complete element */
GLuint element_size;
/** Number of uploaded elements for this input. */
@@ -477,6 +479,9 @@ struct brw_context
struct {
struct brw_vertex_element inputs[VERT_ATTRIB_MAX];
struct brw_vertex_element *enabled[VERT_ATTRIB_MAX];
GLuint nr_enabled;
#define BRW_NR_UPLOAD_BUFS 17
#define BRW_UPLOAD_INIT_SIZE (128*1024)

View File

@@ -185,6 +185,7 @@ static void brw_merge_inputs( struct brw_context *brw,
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
brw->vb.inputs[i].glarray = arrays[i];
brw->vb.inputs[i].attrib = (gl_vert_attrib) i;
if (arrays[i]->StrideB != 0)
brw->vb.info.varying |= 1 << i;

View File

@@ -343,16 +343,13 @@ static void brw_prepare_vertices(struct brw_context *brw)
{
GLcontext *ctx = &brw->intel.ctx;
struct intel_context *intel = intel_context(ctx);
GLuint tmp = brw->vs.prog_data->inputs_read;
GLbitfield vs_inputs = brw->vs.prog_data->inputs_read;
GLuint i;
const unsigned char *ptr = NULL;
GLuint interleave = 0;
unsigned int min_index = brw->vb.min_index;
unsigned int max_index = brw->vb.max_index;
struct brw_vertex_element *enabled[VERT_ATTRIB_MAX];
GLuint nr_enabled = 0;
struct brw_vertex_element *upload[VERT_ATTRIB_MAX];
GLuint nr_uploads = 0;
@@ -362,12 +359,13 @@ static void brw_prepare_vertices(struct brw_context *brw)
_mesa_printf("%s %d..%d\n", __FUNCTION__, min_index, max_index);
/* Accumulate the list of enabled arrays. */
while (tmp) {
GLuint i = _mesa_ffsll(tmp)-1;
brw->vb.nr_enabled = 0;
while (vs_inputs) {
GLuint i = _mesa_ffsll(vs_inputs) - 1;
struct brw_vertex_element *input = &brw->vb.inputs[i];
tmp &= ~(1<<i);
enabled[nr_enabled++] = input;
vs_inputs &= ~(1 << i);
brw->vb.enabled[brw->vb.nr_enabled++] = input;
}
/* XXX: In the rare cases where this happens we fallback all
@@ -376,13 +374,13 @@ static void brw_prepare_vertices(struct brw_context *brw)
* cases with > 17 vertex attributes enabled, so it probably
* isn't an issue at this point.
*/
if (nr_enabled >= BRW_VEP_MAX) {
if (brw->vb.nr_enabled >= BRW_VEP_MAX) {
intel->Fallback = 1;
return;
}
for (i = 0; i < nr_enabled; i++) {
struct brw_vertex_element *input = enabled[i];
for (i = 0; i < brw->vb.nr_enabled; i++) {
struct brw_vertex_element *input = brw->vb.enabled[i];
input->element_size = get_size(input->glarray->Type) * input->glarray->Size;
input->count = input->glarray->StrideB ? max_index + 1 - min_index : 1;
@@ -398,6 +396,20 @@ static void brw_prepare_vertices(struct brw_context *brw)
dri_bo_reference(input->bo);
input->offset = (unsigned long)input->glarray->Ptr;
input->stride = input->glarray->StrideB;
/* This is a common place to reach if the user mistakenly supplies
* a pointer in place of a VBO offset. If we just let it go through,
* we may end up dereferencing a pointer beyond the bounds of the
* GTT. We would hope that the VBO's max_index would save us, but
* Mesa appears to hand us min/max values not clipped to the
* array object's _MaxElement, and _MaxElement frequently appears
* to be wrong anyway.
*
* The VBO spec allows application termination in this case, and it's
* probably a service to the poor programmer to do so rather than
* trying to just not render.
*/
assert(input->offset < input->bo->size);
} else {
if (input->bo != NULL) {
/* Already-uploaded vertex data is present from a previous
@@ -410,7 +422,7 @@ static void brw_prepare_vertices(struct brw_context *brw)
/* Queue the buffer object up to be uploaded in the next pass,
* when we've decided if we're doing interleaved or not.
*/
if (i == 0) {
if (input->attrib == VERT_ATTRIB_POS) {
/* Position array not properly enabled:
*/
if (input->glarray->StrideB == 0) {
@@ -466,8 +478,8 @@ static void brw_prepare_vertices(struct brw_context *brw)
brw_prepare_query_begin(brw);
for (i = 0; i < nr_enabled; i++) {
struct brw_vertex_element *input = enabled[i];
for (i = 0; i < brw->vb.nr_enabled; i++) {
struct brw_vertex_element *input = brw->vb.enabled[i];
brw_add_validated_bo(brw, input->bo);
}
@@ -477,34 +489,44 @@ static void brw_emit_vertices(struct brw_context *brw)
{
GLcontext *ctx = &brw->intel.ctx;
struct intel_context *intel = intel_context(ctx);
GLuint tmp = brw->vs.prog_data->inputs_read;
struct brw_vertex_element *enabled[VERT_ATTRIB_MAX];
GLuint i;
GLuint nr_enabled = 0;
/* Accumulate the list of enabled arrays. */
while (tmp) {
i = _mesa_ffsll(tmp)-1;
struct brw_vertex_element *input = &brw->vb.inputs[i];
tmp &= ~(1<<i);
enabled[nr_enabled++] = input;
}
brw_emit_query_begin(brw);
/* If the VS doesn't read any inputs (calculating vertex position from
* a state variable for some reason, for example), emit a single pad
* VERTEX_ELEMENT struct and bail.
*
* The stale VB state stays in place, but they don't do anything unless
* a VE loads from them.
*/
if (brw->vb.nr_enabled == 0) {
BEGIN_BATCH(3, IGNORE_CLIPRECTS);
OUT_BATCH((CMD_VERTEX_ELEMENT << 16) | 1);
OUT_BATCH((0 << BRW_VE0_INDEX_SHIFT) |
BRW_VE0_VALID |
(BRW_SURFACEFORMAT_R32G32B32A32_FLOAT << BRW_VE0_FORMAT_SHIFT) |
(0 << BRW_VE0_SRC_OFFSET_SHIFT));
OUT_BATCH((BRW_VE1_COMPONENT_STORE_0 << BRW_VE1_COMPONENT_0_SHIFT) |
(BRW_VE1_COMPONENT_STORE_0 << BRW_VE1_COMPONENT_1_SHIFT) |
(BRW_VE1_COMPONENT_STORE_0 << BRW_VE1_COMPONENT_2_SHIFT) |
(BRW_VE1_COMPONENT_STORE_1_FLT << BRW_VE1_COMPONENT_3_SHIFT));
ADVANCE_BATCH();
return;
}
/* Now emit VB and VEP state packets.
*
* This still defines a hardware VB for each input, even if they
* are interleaved or from the same VBO. TBD if this makes a
* performance difference.
*/
BEGIN_BATCH(1 + nr_enabled * 4, IGNORE_CLIPRECTS);
BEGIN_BATCH(1 + brw->vb.nr_enabled * 4, IGNORE_CLIPRECTS);
OUT_BATCH((CMD_VERTEX_BUFFER << 16) |
((1 + nr_enabled * 4) - 2));
((1 + brw->vb.nr_enabled * 4) - 2));
for (i = 0; i < nr_enabled; i++) {
struct brw_vertex_element *input = enabled[i];
for (i = 0; i < brw->vb.nr_enabled; i++) {
struct brw_vertex_element *input = brw->vb.enabled[i];
OUT_BATCH((i << BRW_VB0_INDEX_SHIFT) |
BRW_VB0_ACCESS_VERTEXDATA |
@@ -517,10 +539,10 @@ static void brw_emit_vertices(struct brw_context *brw)
}
ADVANCE_BATCH();
BEGIN_BATCH(1 + nr_enabled * 2, IGNORE_CLIPRECTS);
OUT_BATCH((CMD_VERTEX_ELEMENT << 16) | ((1 + nr_enabled * 2) - 2));
for (i = 0; i < nr_enabled; i++) {
struct brw_vertex_element *input = enabled[i];
BEGIN_BATCH(1 + brw->vb.nr_enabled * 2, IGNORE_CLIPRECTS);
OUT_BATCH((CMD_VERTEX_ELEMENT << 16) | ((1 + brw->vb.nr_enabled * 2) - 2));
for (i = 0; i < brw->vb.nr_enabled; i++) {
struct brw_vertex_element *input = brw->vb.enabled[i];
uint32_t format = get_surface_type(input->glarray->Type,
input->glarray->Size,
input->glarray->Format,
@@ -635,7 +657,7 @@ static void brw_emit_indices(struct brw_context *brw)
if (index_buffer == NULL)
return;
ib_size = get_size(index_buffer->type) * index_buffer->count;
ib_size = get_size(index_buffer->type) * index_buffer->count - 1;
/* Emit the indexbuffer packet:
*/

View File

@@ -62,7 +62,7 @@ void brw_set_predicate_control( struct brw_compile *p, GLuint pc )
void brw_set_conditionalmod( struct brw_compile *p, GLuint conditional )
{
p->current->header.destreg__conditonalmod = conditional;
p->current->header.destreg__conditionalmod = conditional;
}
void brw_set_access_mode( struct brw_compile *p, GLuint access_mode )

View File

@@ -377,8 +377,8 @@ static struct brw_instruction *next_insn( struct brw_compile *p,
/* Reset this one-shot flag:
*/
if (p->current->header.destreg__conditonalmod) {
p->current->header.destreg__conditonalmod = 0;
if (p->current->header.destreg__conditionalmod) {
p->current->header.destreg__conditionalmod = 0;
p->current->header.predicate_control = BRW_PREDICATE_NORMAL;
}
@@ -746,7 +746,7 @@ void brw_CMP(struct brw_compile *p,
{
struct brw_instruction *insn = next_insn(p, BRW_OPCODE_CMP);
insn->header.destreg__conditonalmod = conditional;
insn->header.destreg__conditionalmod = conditional;
brw_set_dest(insn, dest);
brw_set_src0(insn, src0);
brw_set_src1(insn, src1);
@@ -790,7 +790,7 @@ void brw_math( struct brw_compile *p,
* instructions.
*/
insn->header.predicate_control = 0;
insn->header.destreg__conditonalmod = msg_reg_nr;
insn->header.destreg__conditionalmod = msg_reg_nr;
brw_set_dest(insn, dest);
brw_set_src0(insn, src);
@@ -826,7 +826,7 @@ void brw_math_16( struct brw_compile *p,
brw_set_compression_control(p, BRW_COMPRESSION_NONE);
insn = next_insn(p, BRW_OPCODE_SEND);
insn->header.destreg__conditonalmod = msg_reg_nr;
insn->header.destreg__conditionalmod = msg_reg_nr;
brw_set_dest(insn, dest);
brw_set_src0(insn, src);
@@ -842,7 +842,7 @@ void brw_math_16( struct brw_compile *p,
*/
insn = next_insn(p, BRW_OPCODE_SEND);
insn->header.compression_control = BRW_COMPRESSION_2NDHALF;
insn->header.destreg__conditonalmod = msg_reg_nr+1;
insn->header.destreg__conditionalmod = msg_reg_nr+1;
brw_set_dest(insn, offset(dest,1));
brw_set_src0(insn, src);
@@ -888,7 +888,7 @@ void brw_dp_WRITE_16( struct brw_compile *p,
insn->header.predicate_control = 0; /* XXX */
insn->header.compression_control = BRW_COMPRESSION_NONE;
insn->header.destreg__conditonalmod = msg_reg_nr;
insn->header.destreg__conditionalmod = msg_reg_nr;
brw_set_dest(insn, dest);
brw_set_src0(insn, src);
@@ -933,7 +933,7 @@ void brw_dp_READ_16( struct brw_compile *p,
insn->header.predicate_control = 0; /* XXX */
insn->header.compression_control = BRW_COMPRESSION_NONE;
insn->header.destreg__conditonalmod = msg_reg_nr;
insn->header.destreg__conditionalmod = msg_reg_nr;
brw_set_dest(insn, dest); /* UW? */
brw_set_src0(insn, retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW));
@@ -986,7 +986,7 @@ void brw_dp_READ_4( struct brw_compile *p,
insn->header.predicate_control = BRW_PREDICATE_NONE;
insn->header.compression_control = BRW_COMPRESSION_NONE;
insn->header.destreg__conditonalmod = msg_reg_nr;
insn->header.destreg__conditionalmod = msg_reg_nr;
insn->header.mask_control = BRW_MASK_DISABLE;
/* cast dest to a uword[8] vector */
@@ -1059,7 +1059,7 @@ void brw_dp_READ_4_vs(struct brw_compile *p,
insn->header.predicate_control = BRW_PREDICATE_NONE;
insn->header.compression_control = BRW_COMPRESSION_NONE;
insn->header.destreg__conditonalmod = msg_reg_nr;
insn->header.destreg__conditionalmod = msg_reg_nr;
insn->header.mask_control = BRW_MASK_DISABLE;
/*insn->header.access_mode = BRW_ALIGN_16;*/
@@ -1092,7 +1092,7 @@ void brw_fb_WRITE(struct brw_compile *p,
insn->header.predicate_control = 0; /* XXX */
insn->header.compression_control = BRW_COMPRESSION_NONE;
insn->header.destreg__conditonalmod = msg_reg_nr;
insn->header.destreg__conditionalmod = msg_reg_nr;
brw_set_dest(insn, dest);
brw_set_src0(insn, src0);
@@ -1187,7 +1187,7 @@ void brw_SAMPLE(struct brw_compile *p,
insn->header.predicate_control = 0; /* XXX */
insn->header.compression_control = BRW_COMPRESSION_NONE;
insn->header.destreg__conditonalmod = msg_reg_nr;
insn->header.destreg__conditionalmod = msg_reg_nr;
brw_set_dest(insn, dest);
brw_set_src0(insn, src0);
@@ -1238,7 +1238,7 @@ void brw_urb_WRITE(struct brw_compile *p,
brw_set_src0(insn, src0);
brw_set_src1(insn, brw_imm_d(0));
insn->header.destreg__conditonalmod = msg_reg_nr;
insn->header.destreg__conditionalmod = msg_reg_nr;
brw_set_urb_message(insn,
allocate,

View File

@@ -233,7 +233,7 @@ sf_unit_create_from_key(struct brw_context *brw, struct brw_sf_unit_key *key,
else if (sf.sf6.line_width <= 0x2)
sf.sf6.line_width = 0;
/* _NEW_POINT */
/* _NEW_BUFFERS */
key->render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
if (!key->render_to_fbo) {
/* Rendering to an OpenGL window */
@@ -263,6 +263,7 @@ sf_unit_create_from_key(struct brw_context *brw, struct brw_sf_unit_key *key,
}
/* XXX clamp max depends on AA vs. non-AA */
/* _NEW_POINT */
sf.sf7.sprite_point = key->point_sprite;
sf.sf7.point_size = CLAMP(rint(key->point_size), 1, 255) * (1<<3);
sf.sf7.use_point_size_state = !key->point_attenuated;
@@ -328,7 +329,8 @@ const struct brw_tracked_state brw_sf_unit = {
.mesa = (_NEW_POLYGON |
_NEW_LINE |
_NEW_POINT |
_NEW_SCISSOR),
_NEW_SCISSOR |
_NEW_BUFFERS),
.brw = BRW_NEW_URB_FENCE,
.cache = (CACHE_NEW_SF_VP |
CACHE_NEW_SF_PROG)

View File

@@ -1168,7 +1168,7 @@ struct brw_instruction
GLuint predicate_control:4;
GLuint predicate_inverse:1;
GLuint execution_size:3;
GLuint destreg__conditonalmod:4; /* destreg - send, conditionalmod - others */
GLuint destreg__conditionalmod:4; /* destreg - send, conditionalmod - others */
GLuint pad0:2;
GLuint debug_control:1;
GLuint saturate:1;

View File

@@ -119,6 +119,16 @@ GLboolean brw_miptree_layout( struct intel_context *intel, struct intel_mipmap_t
}
}
/* The 965's sampler lays cachelines out according to how accesses
* in the texture surfaces run, so they may be "vertical" through
* memory. As a result, the docs say in Surface Padding Requirements:
* Sampling Engine Surfaces that two extra rows of padding are required.
* We don't know of similar requirements for pre-965, but given that
* those docs are silent on padding requirements in general, let's play
* it safe.
*/
if (mt->target == GL_TEXTURE_CUBE_MAP)
mt->total_height += 2;
break;
}

View File

@@ -68,6 +68,7 @@ static void release_tmps( struct brw_vs_compile *c )
static void brw_vs_alloc_regs( struct brw_vs_compile *c )
{
GLuint i, reg = 0, mrf;
int attributes_in_vue;
#if 0
if (c->vp->program.Base.Parameters->NumParameters >= 6)
@@ -123,6 +124,11 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
reg++;
}
}
/* If there are no inputs, we'll still be reading one attribute's worth
* because it's required -- see urb_read_length setting.
*/
if (c->nr_inputs == 0)
reg++;
/* Allocate outputs: TODO: could organize the non-position outputs
* to go straight into message regs.
@@ -200,8 +206,20 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
* vertex urb, so is half the amount:
*/
c->prog_data.urb_read_length = (c->nr_inputs + 1) / 2;
/* Setting this field to 0 leads to undefined behavior according to the
* the VS_STATE docs. Our VUEs will always have at least one attribute
* sitting in them, even if it's padding.
*/
if (c->prog_data.urb_read_length == 0)
c->prog_data.urb_read_length = 1;
/* The VS VUEs are shared by VF (outputting our inputs) and VS, so size
* them to fit the biggest thing they need to.
*/
attributes_in_vue = MAX2(c->nr_outputs, c->nr_inputs);
c->prog_data.urb_entry_size = (attributes_in_vue + 2 + 3) / 4;
c->prog_data.urb_entry_size = (c->nr_outputs + 2 + 3) / 4;
c->prog_data.total_grf = reg;
if (INTEL_DEBUG & DEBUG_VS) {
@@ -1172,20 +1190,36 @@ post_vs_emit( struct brw_vs_compile *c,
brw_set_src1(end_inst, brw_imm_d(offset * 16));
}
static uint32_t
get_predicate(uint32_t swizzle)
{
switch (swizzle) {
case SWIZZLE_XXXX:
return BRW_PREDICATE_ALIGN16_REPLICATE_X;
case SWIZZLE_YYYY:
return BRW_PREDICATE_ALIGN16_REPLICATE_Y;
case SWIZZLE_ZZZZ:
return BRW_PREDICATE_ALIGN16_REPLICATE_Z;
case SWIZZLE_WWWW:
return BRW_PREDICATE_ALIGN16_REPLICATE_W;
default:
_mesa_problem(NULL, "Unexpected predicate: 0x%08x\n", swizzle);
return BRW_PREDICATE_NORMAL;
}
}
/* Emit the vertex program instructions here.
*/
void brw_vs_emit(struct brw_vs_compile *c )
{
#define MAX_IFSN 32
#define MAX_IF_DEPTH 32
struct brw_compile *p = &c->func;
GLuint nr_insns = c->vp->program.Base.NumInstructions;
GLuint insn, if_insn = 0;
const GLuint nr_insns = c->vp->program.Base.NumInstructions;
GLuint insn, if_depth = 0;
GLuint end_offset = 0;
struct brw_instruction *end_inst, *last_inst;
struct brw_instruction *if_inst[MAX_IFSN];
struct brw_indirect stack_index = brw_indirect(0, 0);
struct brw_instruction *if_inst[MAX_IF_DEPTH];
const struct brw_indirect stack_index = brw_indirect(0, 0);
GLuint index;
GLuint file;
@@ -1376,15 +1410,18 @@ void brw_vs_emit(struct brw_vs_compile *c )
emit_xpd(p, dst, args[0], args[1]);
break;
case OPCODE_IF:
assert(if_insn < MAX_IFSN);
if_inst[if_insn++] = brw_IF(p, BRW_EXECUTE_8);
assert(if_depth < MAX_IF_DEPTH);
if_inst[if_depth] = brw_IF(p, BRW_EXECUTE_8);
if_inst[if_depth]->header.predicate_control =
get_predicate(inst->DstReg.CondSwizzle);
if_depth++;
break;
case OPCODE_ELSE:
if_inst[if_insn-1] = brw_ELSE(p, if_inst[if_insn-1]);
if_inst[if_depth-1] = brw_ELSE(p, if_inst[if_depth-1]);
break;
case OPCODE_ENDIF:
assert(if_insn > 0);
brw_ENDIF(p, if_inst[--if_insn]);
assert(if_depth > 0);
brw_ENDIF(p, if_inst[--if_depth]);
break;
case OPCODE_BRA:
brw_set_predicate_control(p, BRW_PREDICATE_NORMAL);
@@ -1430,6 +1467,19 @@ void brw_vs_emit(struct brw_vs_compile *c )
"unknown");
}
/* Set the predication update on the last instruction of the native
* instruction sequence.
*
* This would be problematic if it was set on a math instruction,
* but that shouldn't be the case with the current GLSL compiler.
*/
if (inst->CondUpdate) {
struct brw_instruction *hw_insn = &p->store[p->nr_insn - 1];
assert(hw_insn->header.destreg__conditionalmod == 0);
hw_insn->header.destreg__conditionalmod = BRW_CONDITIONAL_NZ;
}
if ((inst->DstReg.File == PROGRAM_OUTPUT)
&& (inst->DstReg.Index != VERT_RESULT_HPOS)
&& c->output_regs[inst->DstReg.Index].used_in_src) {

View File

@@ -202,6 +202,7 @@ static void brw_wm_populate_key( struct brw_context *brw,
/* BRW_NEW_FRAGMENT_PROGRAM */
const struct brw_fragment_program *fp =
(struct brw_fragment_program *)brw->fragment_program;
GLboolean uses_depth = (fp->program.Base.InputsRead & (1 << FRAG_ATTRIB_WPOS)) != 0;
GLuint lookup = 0;
GLuint line_aa;
GLuint i;
@@ -263,6 +264,7 @@ static void brw_wm_populate_key( struct brw_context *brw,
brw_wm_lookup_iz(line_aa,
lookup,
uses_depth,
key);

View File

@@ -286,6 +286,7 @@ void brw_wm_print_program( struct brw_wm_compile *c,
void brw_wm_lookup_iz( GLuint line_aa,
GLuint lookup,
GLboolean ps_uses_depth,
struct brw_wm_prog_key *key );
GLboolean brw_wm_is_glsl(const struct gl_fragment_program *fp);

View File

@@ -705,7 +705,11 @@ static void precalc_tex( struct brw_wm_compile *c,
tmpcoord,
0,
inst->SrcReg[0],
scale,
src_swizzle(scale,
SWIZZLE_X,
SWIZZLE_Y,
SWIZZLE_ONE,
SWIZZLE_ONE),
src_undef());
coord = src_reg_from_dst(tmpcoord);

View File

@@ -118,6 +118,7 @@ const struct {
void brw_wm_lookup_iz( GLuint line_aa,
GLuint lookup,
GLboolean ps_uses_depth,
struct brw_wm_prog_key *key )
{
GLuint reg = 2;
@@ -127,7 +128,7 @@ void brw_wm_lookup_iz( GLuint line_aa,
if (lookup & IZ_PS_COMPUTES_DEPTH_BIT)
key->computes_depth = 1;
if (wm_iz_table[lookup].sd_present) {
if (wm_iz_table[lookup].sd_present || ps_uses_depth) {
key->source_depth_reg = reg;
reg += 2;
}

View File

@@ -0,0 +1 @@
../intel/intel_pixel_read.c

View File

@@ -209,7 +209,10 @@ intel_bufferobj_get_subdata(GLcontext * ctx,
struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
assert(intel_obj);
dri_bo_get_subdata(intel_obj->buffer, offset, size, data);
if (intel_obj->sys_buffer)
memcpy(data, (char *)intel_obj->sys_buffer + offset, size);
else
dri_bo_get_subdata(intel_obj->buffer, offset, size, data);
}

View File

@@ -345,6 +345,23 @@ intelDrawBuffer(GLcontext * ctx, GLenum mode)
static void
intelReadBuffer(GLcontext * ctx, GLenum mode)
{
if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) {
struct intel_context *const intel = intel_context(ctx);
const GLboolean was_front_buffer_reading =
intel->is_front_buffer_reading;
intel->is_front_buffer_reading = (mode == GL_FRONT_LEFT)
|| (mode == GL_FRONT);
/* If we weren't front-buffer reading before but we are now, make sure
* that the front-buffer has actually been allocated.
*/
if (!was_front_buffer_reading && intel->is_front_buffer_reading) {
intel_update_renderbuffers(intel->driContext,
intel->driContext->driDrawablePriv);
}
}
if (ctx->ReadBuffer == ctx->DrawBuffer) {
/* This will update FBO completeness status.
* A framebuffer will be incomplete if the GL_READ_BUFFER setting

View File

@@ -66,6 +66,7 @@
#define PCI_CHIP_Q45_G 0x2E12
#define PCI_CHIP_G45_G 0x2E22
#define PCI_CHIP_G41_G 0x2E32
#define PCI_CHIP_B43_G 0x2E42
#define IS_MOBILE(devid) (devid == PCI_CHIP_I855_GM || \
devid == PCI_CHIP_I915_GM || \
@@ -78,7 +79,8 @@
#define IS_G45(devid) (devid == PCI_CHIP_IGD_E_G || \
devid == PCI_CHIP_Q45_G || \
devid == PCI_CHIP_G45_G || \
devid == PCI_CHIP_G41_G)
devid == PCI_CHIP_G41_G || \
devid == PCI_CHIP_B43_G)
#define IS_GM45(devid) (devid == PCI_CHIP_GM45_GM)
#define IS_G4X(devid) (IS_G45(devid) || IS_GM45(devid))

View File

@@ -161,6 +161,9 @@ intelGetString(GLcontext * ctx, GLenum name)
case PCI_CHIP_G41_G:
chipset = "Intel(R) G41";
break;
case PCI_CHIP_B43_G:
chipset = "Intel(R) B43";
break;
default:
chipset = "Unknown Intel Chipset";
break;
@@ -220,7 +223,9 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
struct intel_renderbuffer *stencil_rb;
i = 0;
if ((intel->is_front_buffer_rendering || !intel_fb->color_rb[1])
if ((intel->is_front_buffer_rendering ||
intel->is_front_buffer_reading ||
!intel_fb->color_rb[1])
&& intel_fb->color_rb[0]) {
attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
attachments[i++] = intel_bits_per_pixel(intel_fb->color_rb[0]);
@@ -495,7 +500,8 @@ intel_flush(GLcontext *ctx, GLboolean needs_mi_flush)
if (screen->dri2.loader &&
(screen->dri2.loader->base.version >= 2)
&& (screen->dri2.loader->flushFrontBuffer != NULL)) {
&& (screen->dri2.loader->flushFrontBuffer != NULL) &&
intel->driDrawable && intel->driDrawable->loaderPrivate) {
(*screen->dri2.loader->flushFrontBuffer)(intel->driDrawable,
intel->driDrawable->loaderPrivate);
@@ -835,6 +841,14 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
GLboolean
intelUnbindContext(__DRIcontextPrivate * driContextPriv)
{
struct intel_context *intel =
(struct intel_context *) driContextPriv->driverPrivate;
/* Deassociate the context with the drawables.
*/
intel->driDrawable = NULL;
intel->driReadDrawable = NULL;
return GL_TRUE;
}

View File

@@ -295,6 +295,14 @@ struct intel_context
* easily.
*/
GLboolean is_front_buffer_rendering;
/**
* Track whether front-buffer is the current read target.
*
* This is closely associated with is_front_buffer_rendering, but may
* be set separately. The DRI2 fake front buffer must be referenced
* either way.
*/
GLboolean is_front_buffer_reading;
drm_clip_rect_t fboRect; /**< cliprect for FBO rendering */

View File

@@ -680,6 +680,11 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
if (rb == NULL)
continue;
if (irb == NULL) {
fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
continue;
}
switch (irb->texformat->MesaFormat) {
case MESA_FORMAT_ARGB8888:
case MESA_FORMAT_RGB565:

View File

@@ -342,10 +342,8 @@ intelInitPixelFuncs(struct dd_function_table *functions)
functions->Bitmap = intelBitmap;
functions->CopyPixels = intelCopyPixels;
functions->DrawPixels = intelDrawPixels;
#ifdef I915
functions->ReadPixels = intelReadPixels;
#endif
}
functions->ReadPixels = intelReadPixels;
}
void

View File

@@ -0,0 +1,321 @@
/**************************************************************************
*
* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#include "main/glheader.h"
#include "main/enums.h"
#include "main/mtypes.h"
#include "main/macros.h"
#include "main/image.h"
#include "main/bufferobj.h"
#include "main/state.h"
#include "swrast/swrast.h"
#include "intel_screen.h"
#include "intel_context.h"
#include "intel_batchbuffer.h"
#include "intel_blit.h"
#include "intel_buffers.h"
#include "intel_regions.h"
#include "intel_pixel.h"
#include "intel_buffer_objects.h"
/* For many applications, the new ability to pull the source buffers
* back out of the GTT and then do the packing/conversion operations
* in software will be as much of an improvement as trying to get the
* blitter and/or texture engine to do the work.
*
* This step is gated on private backbuffers.
*
* Obviously the frontbuffer can't be pulled back, so that is either
* an argument for blit/texture readpixels, or for blitting to a
* temporary and then pulling that back.
*
* When the destination is a pbo, however, it's not clear if it is
* ever going to be pulled to main memory (though the access param
* will be a good hint). So it sounds like we do want to be able to
* choose between blit/texture implementation on the gpu and pullback
* and cpu-based copying.
*
* Unless you can magically turn client memory into a PBO for the
* duration of this call, there will be a cpu-based copying step in
* any case.
*/
static GLboolean
do_texture_readpixels(GLcontext * ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack,
struct intel_region *dest_region)
{
#if 0
struct intel_context *intel = intel_context(ctx);
intelScreenPrivate *screen = intel->intelScreen;
GLint pitch = pack->RowLength ? pack->RowLength : width;
__DRIdrawablePrivate *dPriv = intel->driDrawable;
int textureFormat;
GLenum glTextureFormat;
int destFormat, depthFormat, destPitch;
drm_clip_rect_t tmp;
if (INTEL_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s\n", __FUNCTION__);
if (ctx->_ImageTransferState ||
pack->SwapBytes || pack->LsbFirst || !pack->Invert) {
if (INTEL_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s: check_color failed\n", __FUNCTION__);
return GL_FALSE;
}
intel->vtbl.meta_texrect_source(intel, intel_readbuf_region(intel));
if (!intel->vtbl.meta_render_dest(intel, dest_region, type, format)) {
if (INTEL_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s: couldn't set dest %s/%s\n",
__FUNCTION__,
_mesa_lookup_enum_by_nr(type),
_mesa_lookup_enum_by_nr(format));
return GL_FALSE;
}
LOCK_HARDWARE(intel);
if (intel->driDrawable->numClipRects) {
intel->vtbl.install_meta_state(intel);
intel->vtbl.meta_no_depth_write(intel);
intel->vtbl.meta_no_stencil_write(intel);
if (!driClipRectToFramebuffer(ctx->ReadBuffer, &x, &y, &width, &height)) {
UNLOCK_HARDWARE(intel);
SET_STATE(i830, state);
if (INTEL_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s: cliprect failed\n", __FUNCTION__);
return GL_TRUE;
}
y = dPriv->h - y - height;
x += dPriv->x;
y += dPriv->y;
/* Set the frontbuffer up as a large rectangular texture.
*/
intel->vtbl.meta_tex_rect_source(intel, src_region, textureFormat);
intel->vtbl.meta_texture_blend_replace(i830, glTextureFormat);
/* Set the 3d engine to draw into the destination region:
*/
intel->vtbl.meta_draw_region(intel, dest_region);
intel->vtbl.meta_draw_format(intel, destFormat, depthFormat); /* ?? */
/* Draw a single quad, no cliprects:
*/
intel->vtbl.meta_disable_cliprects(intel);
intel->vtbl.draw_quad(intel,
0, width, 0, height,
0x00ff00ff, x, x + width, y, y + height);
intel->vtbl.leave_meta_state(intel);
}
UNLOCK_HARDWARE(intel);
intel_region_wait_fence(ctx, dest_region); /* required by GL */
return GL_TRUE;
#endif
return GL_FALSE;
}
static GLboolean
do_blit_readpixels(GLcontext * ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack, GLvoid * pixels)
{
struct intel_context *intel = intel_context(ctx);
struct intel_region *src = intel_readbuf_region(intel);
struct intel_buffer_object *dst = intel_buffer_object(pack->BufferObj);
GLuint dst_offset;
GLuint rowLength;
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s\n", __FUNCTION__);
if (!src)
return GL_FALSE;
if (dst) {
/* XXX This validation should be done by core mesa:
*/
if (!_mesa_validate_pbo_access(2, pack, width, height, 1,
format, type, pixels)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels");
return GL_TRUE;
}
}
else {
/* PBO only for now:
*/
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - not PBO\n", __FUNCTION__);
return GL_FALSE;
}
if (ctx->_ImageTransferState ||
!intel_check_blit_format(src, format, type)) {
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - bad format for blit\n", __FUNCTION__);
return GL_FALSE;
}
if (pack->Alignment != 1 || pack->SwapBytes || pack->LsbFirst) {
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: bad packing params\n", __FUNCTION__);
return GL_FALSE;
}
if (pack->RowLength > 0)
rowLength = pack->RowLength;
else
rowLength = width;
if (pack->Invert) {
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: MESA_PACK_INVERT not done yet\n", __FUNCTION__);
return GL_FALSE;
}
else {
rowLength = -rowLength;
}
/* XXX 64-bit cast? */
dst_offset = (GLuint) _mesa_image_address(2, pack, pixels, width, height,
format, type, 0, 0, 0);
/* Although the blits go on the command buffer, need to do this and
* fire with lock held to guarentee cliprects are correct.
*/
intelFlush(&intel->ctx);
LOCK_HARDWARE(intel);
if (intel->driDrawable->numClipRects) {
GLboolean all = (width * height * src->cpp == dst->Base.Size &&
x == 0 && dst_offset == 0);
dri_bo *dst_buffer = intel_bufferobj_buffer(intel, dst,
all ? INTEL_WRITE_FULL :
INTEL_WRITE_PART);
__DRIdrawablePrivate *dPriv = intel->driDrawable;
int nbox = dPriv->numClipRects;
drm_clip_rect_t *box = dPriv->pClipRects;
drm_clip_rect_t rect;
drm_clip_rect_t src_rect;
int i;
src_rect.x1 = dPriv->x + x;
src_rect.y1 = dPriv->y + dPriv->h - (y + height);
src_rect.x2 = src_rect.x1 + width;
src_rect.y2 = src_rect.y1 + height;
for (i = 0; i < nbox; i++) {
if (!intel_intersect_cliprects(&rect, &src_rect, &box[i]))
continue;
intelEmitCopyBlit(intel,
src->cpp,
src->pitch, src->buffer, 0, src->tiling,
rowLength, dst_buffer, dst_offset, GL_FALSE,
rect.x1,
rect.y1,
rect.x1 - src_rect.x1,
rect.y2 - src_rect.y2,
rect.x2 - rect.x1, rect.y2 - rect.y1,
GL_COPY);
}
}
UNLOCK_HARDWARE(intel);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - DONE\n", __FUNCTION__);
return GL_TRUE;
}
void
intelReadPixels(GLcontext * ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack, GLvoid * pixels)
{
if (INTEL_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s\n", __FUNCTION__);
intelFlush(ctx);
#ifdef I915
if (do_blit_readpixels
(ctx, x, y, width, height, format, type, pack, pixels))
return;
if (do_texture_readpixels
(ctx, x, y, width, height, format, type, pack, pixels))
return;
#else
(void)do_blit_readpixels;
(void)do_texture_readpixels;
#endif
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
/* Update Mesa state before calling down into _swrast_ReadPixels, as
* the spans code requires the computed buffer states to be up to date,
* but _swrast_ReadPixels only updates Mesa state after setting up
* the spans code.
*/
if (ctx->NewState)
_mesa_update_state(ctx);
_swrast_ReadPixels(ctx, x, y, width, height, format, type, pack, pixels);
}

View File

@@ -114,6 +114,13 @@ intel_region_alloc(struct intel_context *intel,
{
dri_bo *buffer;
/* If we're untiled, we have to align to 2 rows high because the
* data port accesses 2x2 blocks even if the bottom row isn't to be
* rendered, so failure to align means we could walk off the end of the
* GTT and fault.
*/
height = ALIGN(height, 2);
if (expect_accelerated_upload) {
buffer = drm_intel_bo_alloc_for_render(intel->bufmgr, "region",
pitch * cpp * height, 64);

View File

@@ -1040,7 +1040,7 @@ _mesa_MapBufferARB(GLenum target, GLenum access)
ASSERT(ctx->Driver.MapBuffer);
bufObj->Pointer = ctx->Driver.MapBuffer( ctx, target, access, bufObj );
if (!bufObj->Pointer) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(access)");
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(map failed)");
}
bufObj->Access = access;

View File

@@ -329,6 +329,34 @@ typedef enum
OPCODE_STENCIL_OP_SEPARATE,
OPCODE_STENCIL_MASK_SEPARATE,
/* GL_ARB_shader_objects */
OPCODE_USE_PROGRAM,
OPCODE_UNIFORM_1F,
OPCODE_UNIFORM_2F,
OPCODE_UNIFORM_3F,
OPCODE_UNIFORM_4F,
OPCODE_UNIFORM_1FV,
OPCODE_UNIFORM_2FV,
OPCODE_UNIFORM_3FV,
OPCODE_UNIFORM_4FV,
OPCODE_UNIFORM_1I,
OPCODE_UNIFORM_2I,
OPCODE_UNIFORM_3I,
OPCODE_UNIFORM_4I,
OPCODE_UNIFORM_1IV,
OPCODE_UNIFORM_2IV,
OPCODE_UNIFORM_3IV,
OPCODE_UNIFORM_4IV,
OPCODE_UNIFORM_MATRIX22,
OPCODE_UNIFORM_MATRIX33,
OPCODE_UNIFORM_MATRIX44,
OPCODE_UNIFORM_MATRIX23,
OPCODE_UNIFORM_MATRIX32,
OPCODE_UNIFORM_MATRIX24,
OPCODE_UNIFORM_MATRIX42,
OPCODE_UNIFORM_MATRIX34,
OPCODE_UNIFORM_MATRIX43,
/* GL_EXT_framebuffer_blit */
OPCODE_BLIT_FRAMEBUFFER,
@@ -573,6 +601,30 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist)
n += InstSize[n[0].opcode];
break;
#endif
case OPCODE_UNIFORM_1FV:
case OPCODE_UNIFORM_2FV:
case OPCODE_UNIFORM_3FV:
case OPCODE_UNIFORM_4FV:
case OPCODE_UNIFORM_1IV:
case OPCODE_UNIFORM_2IV:
case OPCODE_UNIFORM_3IV:
case OPCODE_UNIFORM_4IV:
_mesa_free(n[3].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_UNIFORM_MATRIX22:
case OPCODE_UNIFORM_MATRIX33:
case OPCODE_UNIFORM_MATRIX44:
case OPCODE_UNIFORM_MATRIX24:
case OPCODE_UNIFORM_MATRIX42:
case OPCODE_UNIFORM_MATRIX23:
case OPCODE_UNIFORM_MATRIX32:
case OPCODE_UNIFORM_MATRIX34:
case OPCODE_UNIFORM_MATRIX43:
_mesa_free(n[4].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_CONTINUE:
n = (Node *) n[1].next;
_mesa_free(block);
@@ -5783,6 +5835,494 @@ save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
#endif
/* aka UseProgram() */
static void GLAPIENTRY
save_UseProgramObjectARB(GLhandleARB program)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_USE_PROGRAM, 1);
if (n) {
n[1].ui = program;
}
if (ctx->ExecuteFlag) {
CALL_UseProgramObjectARB(ctx->Exec, (program));
}
}
static void GLAPIENTRY
save_Uniform1fARB(GLint location, GLfloat x)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_1F, 2);
if (n) {
n[1].i = location;
n[2].f = x;
}
if (ctx->ExecuteFlag) {
CALL_Uniform1fARB(ctx->Exec, (location, x));
}
}
static void GLAPIENTRY
save_Uniform2fARB(GLint location, GLfloat x, GLfloat y)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_2F, 3);
if (n) {
n[1].i = location;
n[2].f = x;
n[3].f = y;
}
if (ctx->ExecuteFlag) {
CALL_Uniform2fARB(ctx->Exec, (location, x, y));
}
}
static void GLAPIENTRY
save_Uniform3fARB(GLint location, GLfloat x, GLfloat y, GLfloat z)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_3F, 4);
if (n) {
n[1].i = location;
n[2].f = x;
n[3].f = y;
n[4].f = z;
}
if (ctx->ExecuteFlag) {
CALL_Uniform3fARB(ctx->Exec, (location, x, y, z));
}
}
static void GLAPIENTRY
save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_4F, 5);
if (n) {
n[1].i = location;
n[2].f = x;
n[3].f = y;
n[4].f = z;
n[5].f = w;
}
if (ctx->ExecuteFlag) {
CALL_Uniform4fARB(ctx->Exec, (location, x, y, z, w));
}
}
/** Return copy of memory */
static void *
memdup(const void *src, GLsizei bytes)
{
void *b = bytes >= 0 ? _mesa_malloc(bytes) : NULL;
if (b)
_mesa_memcpy(b, src, bytes);
return b;
}
static void GLAPIENTRY
save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_1FV, 3);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].data = memdup(v, count * 1 * sizeof(GLfloat));
}
if (ctx->ExecuteFlag) {
CALL_Uniform1fvARB(ctx->Exec, (location, count, v));
}
}
static void GLAPIENTRY
save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_2FV, 3);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].data = memdup(v, count * 2 * sizeof(GLfloat));
}
if (ctx->ExecuteFlag) {
CALL_Uniform2fvARB(ctx->Exec, (location, count, v));
}
}
static void GLAPIENTRY
save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_3FV, 3);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].data = memdup(v, count * 3 * sizeof(GLfloat));
}
if (ctx->ExecuteFlag) {
CALL_Uniform3fvARB(ctx->Exec, (location, count, v));
}
}
static void GLAPIENTRY
save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_4FV, 3);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].data = memdup(v, count * 4 * sizeof(GLfloat));
}
if (ctx->ExecuteFlag) {
CALL_Uniform4fvARB(ctx->Exec, (location, count, v));
}
}
static void GLAPIENTRY
save_Uniform1iARB(GLint location, GLint x)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_1I, 2);
if (n) {
n[1].i = location;
n[2].i = x;
}
if (ctx->ExecuteFlag) {
CALL_Uniform1iARB(ctx->Exec, (location, x));
}
}
static void GLAPIENTRY
save_Uniform2iARB(GLint location, GLint x, GLint y)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_2I, 3);
if (n) {
n[1].i = location;
n[2].i = x;
n[3].i = y;
}
if (ctx->ExecuteFlag) {
CALL_Uniform2iARB(ctx->Exec, (location, x, y));
}
}
static void GLAPIENTRY
save_Uniform3iARB(GLint location, GLint x, GLint y, GLint z)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_3I, 4);
if (n) {
n[1].i = location;
n[2].i = x;
n[3].i = y;
n[4].i = z;
}
if (ctx->ExecuteFlag) {
CALL_Uniform3iARB(ctx->Exec, (location, x, y, z));
}
}
static void GLAPIENTRY
save_Uniform4iARB(GLint location, GLint x, GLint y, GLint z, GLint w)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_4I, 5);
if (n) {
n[1].i = location;
n[2].i = x;
n[3].i = y;
n[4].i = z;
n[5].i = w;
}
if (ctx->ExecuteFlag) {
CALL_Uniform4iARB(ctx->Exec, (location, x, y, z, w));
}
}
static void GLAPIENTRY
save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_1IV, 3);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].data = memdup(v, count * 1 * sizeof(GLint));
}
if (ctx->ExecuteFlag) {
CALL_Uniform1ivARB(ctx->Exec, (location, count, v));
}
}
static void GLAPIENTRY
save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_2IV, 3);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].data = memdup(v, count * 2 * sizeof(GLint));
}
if (ctx->ExecuteFlag) {
CALL_Uniform2ivARB(ctx->Exec, (location, count, v));
}
}
static void GLAPIENTRY
save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_3IV, 3);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].data = memdup(v, count * 3 * sizeof(GLint));
}
if (ctx->ExecuteFlag) {
CALL_Uniform3ivARB(ctx->Exec, (location, count, v));
}
}
static void GLAPIENTRY
save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_4IV, 3);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].data = memdup(v, count * 4 * sizeof(GLfloat));
}
if (ctx->ExecuteFlag) {
CALL_Uniform4ivARB(ctx->Exec, (location, count, v));
}
}
static void GLAPIENTRY
save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
const GLfloat *m)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX22, 4);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].b = transpose;
n[4].data = memdup(m, count * 2 * 2 * sizeof(GLfloat));
}
if (ctx->ExecuteFlag) {
CALL_UniformMatrix2fvARB(ctx->Exec, (location, count, transpose, m));
}
}
static void GLAPIENTRY
save_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
const GLfloat *m)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX33, 4);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].b = transpose;
n[4].data = memdup(m, count * 3 * 3 * sizeof(GLfloat));
}
if (ctx->ExecuteFlag) {
CALL_UniformMatrix3fvARB(ctx->Exec, (location, count, transpose, m));
}
}
static void GLAPIENTRY
save_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
const GLfloat *m)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX44, 4);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].b = transpose;
n[4].data = memdup(m, count * 4 * 4 * sizeof(GLfloat));
}
if (ctx->ExecuteFlag) {
CALL_UniformMatrix4fvARB(ctx->Exec, (location, count, transpose, m));
}
}
static void GLAPIENTRY
save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
const GLfloat *m)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX23, 4);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].b = transpose;
n[4].data = memdup(m, count * 2 * 3 * sizeof(GLfloat));
}
if (ctx->ExecuteFlag) {
CALL_UniformMatrix2x3fv(ctx->Exec, (location, count, transpose, m));
}
}
static void GLAPIENTRY
save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
const GLfloat *m)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX32, 4);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].b = transpose;
n[4].data = memdup(m, count * 3 * 2 * sizeof(GLfloat));
}
if (ctx->ExecuteFlag) {
CALL_UniformMatrix3x2fv(ctx->Exec, (location, count, transpose, m));
}
}
static void GLAPIENTRY
save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
const GLfloat *m)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX24, 4);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].b = transpose;
n[4].data = memdup(m, count * 2 * 4 * sizeof(GLfloat));
}
if (ctx->ExecuteFlag) {
CALL_UniformMatrix2x4fv(ctx->Exec, (location, count, transpose, m));
}
}
static void GLAPIENTRY
save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
const GLfloat *m)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX42, 4);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].b = transpose;
n[4].data = memdup(m, count * 4 * 2 * sizeof(GLfloat));
}
if (ctx->ExecuteFlag) {
CALL_UniformMatrix4x2fv(ctx->Exec, (location, count, transpose, m));
}
}
static void GLAPIENTRY
save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
const GLfloat *m)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX34, 4);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].b = transpose;
n[4].data = memdup(m, count * 3 * 4 * sizeof(GLfloat));
}
if (ctx->ExecuteFlag) {
CALL_UniformMatrix3x4fv(ctx->Exec, (location, count, transpose, m));
}
}
static void GLAPIENTRY
save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
const GLfloat *m)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX43, 4);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].b = transpose;
n[4].data = memdup(m, count * 4 * 3 * sizeof(GLfloat));
}
if (ctx->ExecuteFlag) {
CALL_UniformMatrix4x3fv(ctx->Exec, (location, count, transpose, m));
}
}
/**
* Save an error-generating command into display list.
*
@@ -6615,6 +7155,98 @@ execute_list(GLcontext *ctx, GLuint list)
n[9].i, n[10].e));
break;
#endif
case OPCODE_USE_PROGRAM:
CALL_UseProgramObjectARB(ctx->Exec, (n[1].ui));
break;
case OPCODE_UNIFORM_1F:
CALL_Uniform1fARB(ctx->Exec, (n[1].i, n[2].f));
break;
case OPCODE_UNIFORM_2F:
CALL_Uniform2fARB(ctx->Exec, (n[1].i, n[2].f, n[3].f));
break;
case OPCODE_UNIFORM_3F:
CALL_Uniform3fARB(ctx->Exec, (n[1].i, n[2].f, n[3].f, n[4].f));
break;
case OPCODE_UNIFORM_4F:
CALL_Uniform4fARB(ctx->Exec,
(n[1].i, n[2].f, n[3].f, n[4].f, n[5].f));
break;
case OPCODE_UNIFORM_1FV:
CALL_Uniform1fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
break;
case OPCODE_UNIFORM_2FV:
CALL_Uniform2fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
break;
case OPCODE_UNIFORM_3FV:
CALL_Uniform3fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
break;
case OPCODE_UNIFORM_4FV:
CALL_Uniform4fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
break;
case OPCODE_UNIFORM_1I:
CALL_Uniform1iARB(ctx->Exec, (n[1].i, n[2].i));
break;
case OPCODE_UNIFORM_2I:
CALL_Uniform2iARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));
break;
case OPCODE_UNIFORM_3I:
CALL_Uniform3iARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
break;
case OPCODE_UNIFORM_4I:
CALL_Uniform4iARB(ctx->Exec,
(n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
break;
case OPCODE_UNIFORM_1IV:
CALL_Uniform1ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
break;
case OPCODE_UNIFORM_2IV:
CALL_Uniform2ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
break;
case OPCODE_UNIFORM_3IV:
CALL_Uniform3ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
break;
case OPCODE_UNIFORM_4IV:
CALL_Uniform4ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
break;
case OPCODE_UNIFORM_MATRIX22:
CALL_UniformMatrix2fvARB(ctx->Exec,
(n[1].i, n[2].i, n[3].b, n[4].data));
break;
case OPCODE_UNIFORM_MATRIX33:
CALL_UniformMatrix3fvARB(ctx->Exec,
(n[1].i, n[2].i, n[3].b, n[4].data));
break;
case OPCODE_UNIFORM_MATRIX44:
CALL_UniformMatrix4fvARB(ctx->Exec,
(n[1].i, n[2].i, n[3].b, n[4].data));
break;
case OPCODE_UNIFORM_MATRIX23:
CALL_UniformMatrix2x3fv(ctx->Exec,
(n[1].i, n[2].i, n[3].b, n[4].data));
break;
case OPCODE_UNIFORM_MATRIX32:
CALL_UniformMatrix3x2fv(ctx->Exec,
(n[1].i, n[2].i, n[3].b, n[4].data));
break;
case OPCODE_UNIFORM_MATRIX24:
CALL_UniformMatrix2x4fv(ctx->Exec,
(n[1].i, n[2].i, n[3].b, n[4].data));
break;
case OPCODE_UNIFORM_MATRIX42:
CALL_UniformMatrix4x2fv(ctx->Exec,
(n[1].i, n[2].i, n[3].b, n[4].data));
break;
case OPCODE_UNIFORM_MATRIX34:
CALL_UniformMatrix3x4fv(ctx->Exec,
(n[1].i, n[2].i, n[3].b, n[4].data));
break;
case OPCODE_UNIFORM_MATRIX43:
CALL_UniformMatrix4x3fv(ctx->Exec,
(n[1].i, n[2].i, n[3].b, n[4].data));
break;
case OPCODE_TEX_BUMP_PARAMETER_ATI:
{
GLfloat values[4];
@@ -8297,6 +8929,34 @@ _mesa_init_dlist_table(struct _glapi_table *table)
SET_BlitFramebufferEXT(table, save_BlitFramebufferEXT);
#endif
/* GL_ARB_shader_objects */
SET_UseProgramObjectARB(table, save_UseProgramObjectARB);
SET_Uniform1fARB(table, save_Uniform1fARB);
SET_Uniform2fARB(table, save_Uniform2fARB);
SET_Uniform3fARB(table, save_Uniform3fARB);
SET_Uniform4fARB(table, save_Uniform4fARB);
SET_Uniform1fvARB(table, save_Uniform1fvARB);
SET_Uniform2fvARB(table, save_Uniform2fvARB);
SET_Uniform3fvARB(table, save_Uniform3fvARB);
SET_Uniform4fvARB(table, save_Uniform4fvARB);
SET_Uniform1iARB(table, save_Uniform1iARB);
SET_Uniform2iARB(table, save_Uniform2iARB);
SET_Uniform3iARB(table, save_Uniform3iARB);
SET_Uniform4iARB(table, save_Uniform4iARB);
SET_Uniform1ivARB(table, save_Uniform1ivARB);
SET_Uniform2ivARB(table, save_Uniform2ivARB);
SET_Uniform3ivARB(table, save_Uniform3ivARB);
SET_Uniform4ivARB(table, save_Uniform4ivARB);
SET_UniformMatrix2fvARB(table, save_UniformMatrix2fvARB);
SET_UniformMatrix3fvARB(table, save_UniformMatrix3fvARB);
SET_UniformMatrix4fvARB(table, save_UniformMatrix4fvARB);
SET_UniformMatrix2x3fv(table, save_UniformMatrix2x3fv);
SET_UniformMatrix3x2fv(table, save_UniformMatrix3x2fv);
SET_UniformMatrix2x4fv(table, save_UniformMatrix2x4fv);
SET_UniformMatrix4x2fv(table, save_UniformMatrix4x2fv);
SET_UniformMatrix3x4fv(table, save_UniformMatrix3x4fv);
SET_UniformMatrix4x3fv(table, save_UniformMatrix4x3fv);
/* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
SET_BindAttribLocationARB(table, exec_BindAttribLocationARB);
SET_GetAttribLocationARB(table, exec_GetAttribLocationARB);

View File

@@ -231,7 +231,7 @@ enable_texture(GLcontext *ctx, GLboolean state, GLbitfield bit)
const GLuint newenabled = (!state)
? (texUnit->Enabled & ~bit) : (texUnit->Enabled | bit);
if (!ctx->DrawBuffer->Visual.rgbMode || texUnit->Enabled == newenabled)
if (texUnit->Enabled == newenabled)
return GL_FALSE;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
@@ -933,11 +933,6 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
/* GL_EXT_depth_bounds_test */
case GL_DEPTH_BOUNDS_TEST_EXT:
CHECK_EXTENSION(EXT_depth_bounds_test, cap);
if (state && ctx->DrawBuffer->Visual.depthBits == 0) {
_mesa_warning(ctx,
"glEnable(GL_DEPTH_BOUNDS_TEST_EXT) but no depth buffer");
return;
}
if (ctx->Depth.BoundsTest == state)
return;
FLUSH_VERTICES(ctx, _NEW_DEPTH);

View File

@@ -69,7 +69,7 @@ validate_texture_wrap_mode(GLcontext * ctx, GLenum target, GLenum wrap)
return GL_TRUE;
}
_mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param=0x%x)", wrap );
_mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(param=0x%x)", wrap );
return GL_FALSE;
}
@@ -209,7 +209,7 @@ set_tex_parameteri(GLcontext *ctx,
}
/* fall-through */
default:
_mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param=0x%x)",
_mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(param=0x%x)",
params[0] );
}
return GL_FALSE;
@@ -224,7 +224,7 @@ set_tex_parameteri(GLcontext *ctx,
texObj->MagFilter = params[0];
return GL_TRUE;
default:
_mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param=0x%x)",
_mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(param=0x%x)",
params[0]);
}
return GL_FALSE;

View File

@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
* Version: 7.5.1
* Version: 7.5.2
*
* Copyright (C) 1999-2009 Brian Paul All Rights Reserved.
*
@@ -30,8 +30,8 @@
/* Mesa version */
#define MESA_MAJOR 7
#define MESA_MINOR 5
#define MESA_PATCH 1
#define MESA_VERSION_STRING "7.5.1"
#define MESA_PATCH 2
#define MESA_VERSION_STRING "7.5.2"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

View File

@@ -1527,17 +1527,12 @@ _mesa_execute_program(GLcontext * ctx,
case OPCODE_TXB: /* GL_ARB_fragment_program only */
/* Texel lookup with LOD bias */
{
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);
/* texcoord[3] is the bias to add to lambda */
lodBias = texUnit->LodBias + texcoord[3];
if (texUnit->_Current) {
lodBias += texUnit->_Current->LodBias;
}
lodBias = texcoord[3];
fetch_texel(ctx, machine, inst, texcoord, lodBias, color);

View File

@@ -1471,6 +1471,21 @@ _mesa_link_program(GLcontext *ctx, GLuint program)
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
_slang_link(ctx, program, shProg);
/* debug code */
if (0) {
GLuint i;
_mesa_printf("Link %u shaders in program %u: %s\n",
shProg->NumShaders, shProg->Name,
shProg->LinkStatus ? "Success" : "Failed");
for (i = 0; i < shProg->NumShaders; i++) {
_mesa_printf(" shader %u, type 0x%x\n",
shProg->Shaders[i]->Name,
shProg->Shaders[i]->Type);
}
}
}

View File

@@ -540,6 +540,32 @@ _slang_update_inputs_outputs(struct gl_program *prog)
/**
* Remove extra #version directives from the concatenated source string.
* Disable the extra ones by converting first two chars to //, a comment.
* This is a bit of hack to work around a preprocessor bug that only
* allows one #version directive per source.
*/
static void
remove_extra_version_directives(GLchar *source)
{
GLuint verCount = 0;
while (1) {
char *ver = _mesa_strstr(source, "#version");
if (ver) {
verCount++;
if (verCount > 1) {
ver[0] = '/';
ver[1] = '/';
}
source += 8;
}
else {
break;
}
}
}
/**
@@ -587,6 +613,8 @@ concat_shaders(struct gl_shader_program *shProg, GLenum shaderType)
_mesa_printf("---NEW CONCATENATED SHADER---:\n%s\n------------\n", source);
*/
remove_extra_version_directives(source);
newShader = CALLOC_STRUCT(gl_shader);
newShader->Type = shaderType;
newShader->Source = source;

View File

@@ -256,6 +256,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw)
strb->Base.ClassID = 0x4242; /* just a unique value */
strb->Base.NumSamples = samples;
strb->format = format;
init_renderbuffer_bits(strb, format);
strb->software = sw;
switch (format) {

View File

@@ -661,8 +661,10 @@ st_TexImage(GLcontext * ctx,
format, type,
pixels, unpack, "glTexImage");
}
if (!pixels)
return;
/* Note: we can't check for pixels==NULL until after we've allocated
* memory for the texture.
*/
/* See if we can do texture compression with a blit/render.
*/
@@ -673,6 +675,9 @@ st_TexImage(GLcontext * ctx,
stImage->pt->format,
stImage->pt->target,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) {
if (!pixels)
goto done;
if (compress_with_blit(ctx, target, level, 0, 0, 0, width, height, depth,
format, type, pixels, unpack, texImage)) {
goto done;
@@ -714,6 +719,9 @@ st_TexImage(GLcontext * ctx,
return;
}
if (!pixels)
goto done;
DBG("Upload image %dx%dx%d row_len %x pitch %x\n",
width, height, depth, width * texelBytes, dstRowStride);
@@ -756,9 +764,9 @@ st_TexImage(GLcontext * ctx,
}
}
done:
_mesa_unmap_teximage_pbo(ctx, unpack);
done:
if (stImage->pt && texImage->Data) {
st_texture_image_unmap(ctx->st, stImage);
texImage->Data = NULL;
@@ -1099,7 +1107,7 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
if (!texImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage");
return;
goto done;
}
src = (const GLubyte *) pixels;
@@ -1130,9 +1138,9 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
}
}
done:
_mesa_unmap_teximage_pbo(ctx, packing);
done:
if (stImage->pt) {
st_texture_image_unmap(ctx->st, stImage);
texImage->Data = NULL;
@@ -1700,53 +1708,6 @@ st_CopyTexSubImage3D(GLcontext * ctx, GLenum target, GLint level,
}
/**
* Compute which mipmap levels that really need to be sent to the hardware.
* This depends on the base image size, GL_TEXTURE_MIN_LOD,
* GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL.
*/
static void
calculate_first_last_level(struct st_texture_object *stObj)
{
struct gl_texture_object *tObj = &stObj->base;
/* These must be signed values. MinLod and MaxLod can be negative numbers,
* and having firstLevel and lastLevel as signed prevents the need for
* extra sign checks.
*/
GLint firstLevel;
GLint lastLevel;
/* Yes, this looks overly complicated, but it's all needed.
*/
switch (tObj->Target) {
case GL_TEXTURE_1D:
case GL_TEXTURE_2D:
case GL_TEXTURE_3D:
case GL_TEXTURE_CUBE_MAP:
if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) {
/* GL_NEAREST and GL_LINEAR only care about GL_TEXTURE_BASE_LEVEL.
*/
firstLevel = lastLevel = tObj->BaseLevel;
}
else {
firstLevel = 0;
lastLevel = MIN2(tObj->MaxLevel,
(int) tObj->Image[0][tObj->BaseLevel]->WidthLog2);
}
break;
case GL_TEXTURE_RECTANGLE_NV:
case GL_TEXTURE_4D_SGIS:
firstLevel = lastLevel = 0;
break;
default:
return;
}
stObj->lastLevel = lastLevel;
}
static void
copy_image_data_to_texture(struct st_context *st,
struct st_texture_object *stObj,
@@ -1810,13 +1771,16 @@ st_finalize_texture(GLcontext *ctx,
*needFlush = GL_FALSE;
/* We know/require this is true by now:
*/
assert(stObj->base._Complete);
if (stObj->base._Complete) {
/* The texture is complete and we know exactly how many mipmap levels
* are present/needed. This is conditional because we may be called
* from the st_generate_mipmap() function when the texture object is
* incomplete. In that case, we'll have set stObj->lastLevel before
* we get here.
*/
stObj->lastLevel = stObj->base._MaxLevel - stObj->base.BaseLevel;
}
/* What levels must the texture include at a minimum?
*/
calculate_first_last_level(stObj);
firstImage = st_texture_image(stObj->base.Image[0][stObj->base.BaseLevel]);
/* If both firstImage and stObj point to a texture which can contain

View File

@@ -317,23 +317,29 @@ get_arrays_bounds(const struct st_vertex_program *vp,
const GLubyte **low, const GLubyte **high)
{
const GLubyte *low_addr = NULL;
const GLubyte *high_addr = NULL;
GLuint attr;
GLint stride;
for (attr = 0; attr < vp->num_inputs; attr++) {
const GLuint mesaAttr = vp->index_to_input[attr];
const GLint stride = arrays[mesaAttr]->StrideB;
const GLubyte *start = arrays[mesaAttr]->Ptr;
stride = arrays[mesaAttr]->StrideB;
const unsigned sz = (arrays[mesaAttr]->Size *
_mesa_sizeof_type(arrays[mesaAttr]->Type));
const GLubyte *end = start + (max_index * stride) + sz;
if (attr == 0) {
low_addr = start;
high_addr = end;
}
else {
low_addr = MIN2(low_addr, start);
high_addr = MAX2(high_addr, end);
}
}
*low = low_addr;
*high = low_addr + (max_index + 1) * stride;
*high = high_addr;
}

View File

@@ -27,6 +27,7 @@
#include "main/imports.h"
#include "main/macros.h"
#include "main/mipmap.h"
#include "main/teximage.h"
#include "main/texformat.h"
@@ -161,6 +162,43 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
}
/**
* Compute the expected number of mipmap levels in the texture given
* the width/height/depth of the base image and the GL_TEXTURE_BASE_LEVEL/
* GL_TEXTURE_MAX_LEVEL settings. This will tell us how many mipmap
* level should be generated.
*/
static GLuint
compute_num_levels(GLcontext *ctx,
struct gl_texture_object *texObj,
GLenum target)
{
if (target == GL_TEXTURE_RECTANGLE_ARB) {
return 1;
}
else {
const GLuint maxLevels = texObj->MaxLevel - texObj->BaseLevel + 1;
const struct gl_texture_image *baseImage =
_mesa_get_tex_image(ctx, texObj, target, texObj->BaseLevel);
GLuint size, numLevels;
size = MAX2(baseImage->Width2, baseImage->Height2);
size = MAX2(size, baseImage->Depth2);
numLevels = 0;
while (size > 0) {
numLevels++;
size >>= 1;
}
numLevels = MIN2(numLevels, maxLevels);
return numLevels;
}
}
void
st_generate_mipmap(GLcontext *ctx, GLenum target,
struct gl_texture_object *texObj)
@@ -174,9 +212,49 @@ st_generate_mipmap(GLcontext *ctx, GLenum target,
if (!pt)
return;
lastLevel = pt->last_level;
/* find expected last mipmap level */
lastLevel = compute_num_levels(ctx, texObj, target) - 1;
if (!st_render_mipmap(st, target, pt, baseLevel, lastLevel)) {
if (pt->last_level < lastLevel) {
/* The current gallium texture doesn't have space for all the
* mipmap levels we need to generate. So allocate a new texture.
*/
struct st_texture_object *stObj = st_texture_object(texObj);
struct pipe_texture *oldTex = stObj->pt;
GLboolean needFlush;
/* create new texture with space for more levels */
stObj->pt = st_texture_create(st,
oldTex->target,
oldTex->format,
lastLevel,
oldTex->width[0],
oldTex->height[0],
oldTex->depth[0],
oldTex->tex_usage);
/* The texture isn't in a "complete" state yet so set the expected
* lastLevel here, since it won't get done in st_finalize_texture().
*/
stObj->lastLevel = lastLevel;
/* This will copy the old texture's base image into the new texture
* which we just allocated.
*/
st_finalize_texture(ctx, st->pipe, texObj, &needFlush);
/* release the old tex (will likely be freed too) */
pipe_texture_reference(&oldTex, NULL);
pt = stObj->pt;
}
assert(lastLevel <= pt->last_level);
/* Recall that the Mesa BaseLevel image is stored in the gallium
* texture's level[0] position. So pass baseLevel=0 here.
*/
if (!st_render_mipmap(st, target, pt, 0, lastLevel)) {
fallback_generate_mipmap(ctx, target, texObj);
}

View File

@@ -89,6 +89,8 @@ fetch_texel_lod( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda,
* Fetch a texel with the given partial derivatives to compute a level
* of detail in the mipmap.
* Called via machine->FetchTexelDeriv()
* \param lodBias the lod bias which may be specified by a TXB instruction,
* otherwise zero.
*/
static void
fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
@@ -96,7 +98,8 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
GLfloat lodBias, GLuint unit, GLfloat color[4] )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current;
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
const struct gl_texture_object *texObj = texUnit->_Current;
if (texObj) {
const struct gl_texture_image *texImg =
@@ -108,10 +111,12 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
lambda = _swrast_compute_lambda(texdx[0], texdy[0], /* ds/dx, ds/dy */
texdx[1], texdy[1], /* dt/dx, dt/dy */
texdx[3], texdy[2], /* dq/dx, dq/dy */
texdx[3], texdy[3], /* dq/dx, dq/dy */
texW, texH,
texcoord[0], texcoord[1], texcoord[3],
1.0F / texcoord[3]) + lodBias;
1.0F / texcoord[3]);
lambda += lodBias + texUnit->LodBias + texObj->LodBias;
lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod);

View File

@@ -1863,7 +1863,7 @@ choose_cube_face(const struct gl_texture_object *texObj,
GLuint face;
GLfloat sc, tc, ma;
if (arx > ary && arx > arz) {
if (arx >= ary && arx >= arz) {
if (rx >= 0.0F) {
face = FACE_POS_X;
sc = -rz;
@@ -1877,7 +1877,7 @@ choose_cube_face(const struct gl_texture_object *texObj,
ma = arx;
}
}
else if (ary > arx && ary > arz) {
else if (ary >= arx && ary >= arz) {
if (ry >= 0.0F) {
face = FACE_POS_Y;
sc = rx;