Compare commits
73 Commits
mesa-7.5.1
...
mesa_7_5_2
Author | SHA1 | Date | |
---|---|---|---|
|
18f3afbe88 | ||
|
b807d49f18 | ||
|
d09941c8cc | ||
|
fc613848e6 | ||
|
c7d0f0b46c | ||
|
c7fddaf612 | ||
|
e3a6f57ad6 | ||
|
41d0606b7f | ||
|
126d62edd1 | ||
|
1730b8db12 | ||
|
60b152a1b3 | ||
|
adfa778c8e | ||
|
2acd5de226 | ||
|
890f37d4d9 | ||
|
ad935c3f47 | ||
|
be66ff51ec | ||
|
bc75464760 | ||
|
52cadf7592 | ||
|
e857303305 | ||
|
2b83483fb4 | ||
|
5a0b29050f | ||
|
077e3de989 | ||
|
999592745f | ||
|
c4ce6f6a7c | ||
|
9666529b5a | ||
|
08d39251a7 | ||
|
cfa1a0a609 | ||
|
2921a2555d | ||
|
d9ddbc3f47 | ||
|
41fff1b9a1 | ||
|
6681981fe1 | ||
|
3ad108b77f | ||
|
f42c66c138 | ||
|
81de9d68f7 | ||
|
1f309c40b8 | ||
|
799631acb1 | ||
|
ac3c8e3b53 | ||
|
3129b2403e | ||
|
b8b774c775 | ||
|
1402ea8f39 | ||
|
9c8b69302c | ||
|
0fa1692f14 | ||
|
4d9bbabb83 | ||
|
3f4d776199 | ||
|
988db64119 | ||
|
79a3e298c5 | ||
|
2dd3da3a4a | ||
|
d27d659043 | ||
|
42943a4cf9 | ||
|
8de625c7cf | ||
|
18bdb6e712 | ||
|
bf19638a00 | ||
|
b2cba25f9e | ||
|
cf820a045f | ||
|
2855ee82c6 | ||
|
04081a164c | ||
|
1d1dfc96c4 | ||
|
a9504edee3 | ||
|
945d34e88a | ||
|
94d3b832cc | ||
|
8c764d5c34 | ||
|
a0b7850f1d | ||
|
3d6c73513c | ||
|
83e6c67363 | ||
|
f396263651 | ||
|
63b3fa2bce | ||
|
217af32c2d | ||
|
456a16491b | ||
|
9eca0e5350 | ||
|
7e26bdb849 | ||
|
213ac4bb5d | ||
|
cab307ce6b | ||
|
1960da2e09 |
2
Makefile
2
Makefile
@@ -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)
|
||||
|
@@ -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'
|
||||
|
@@ -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
|
||||
|
@@ -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],
|
||||
|
@@ -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
67
docs/relnotes-7.5.2.html
Normal 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>
|
@@ -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>
|
||||
|
@@ -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
|
||||
|
@@ -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)
|
||||
|
||||
|
@@ -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));
|
||||
}
|
||||
|
||||
|
@@ -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)) {
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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:
|
||||
|
@@ -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;
|
||||
|
@@ -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)
|
||||
|
||||
|
@@ -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
|
||||
{
|
||||
|
@@ -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);
|
||||
}
|
1
src/mesa/drivers/dri/i915/intel_pixel_read.c
Symbolic link
1
src/mesa/drivers/dri/i915/intel_pixel_read.c
Symbolic link
@@ -0,0 +1 @@
|
||||
../intel/intel_pixel_read.c
|
@@ -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 \
|
||||
|
@@ -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)
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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:
|
||||
*/
|
||||
|
@@ -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 )
|
||||
|
@@ -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,
|
||||
|
@@ -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)
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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) {
|
||||
|
@@ -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);
|
||||
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
1
src/mesa/drivers/dri/i965/intel_pixel_read.c
Symbolic link
1
src/mesa/drivers/dri/i965/intel_pixel_read.c
Symbolic link
@@ -0,0 +1 @@
|
||||
../intel/intel_pixel_read.c
|
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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))
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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 */
|
||||
|
||||
|
@@ -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:
|
||||
|
@@ -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
|
||||
|
321
src/mesa/drivers/dri/intel/intel_pixel_read.c
Normal file
321
src/mesa/drivers/dri/intel/intel_pixel_read.c
Normal 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);
|
||||
}
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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))
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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) {
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user