Compare commits

...

34 Commits

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
2009-09-12 09:35:43 -07:00
Vinson Lee
0fa1692f14 mesa: raise GL_INVALID_ENUM not GL_INVALID_VALUE for glTexParamter errors
Signed-off-by: Brian Paul <brianp@vmware.com>
2009-09-11 08:04:37 -06:00
23 changed files with 820 additions and 38 deletions

View File

@@ -23,6 +23,7 @@ HOST_CC = $(CC)
CFLAGS = -O
CXXFLAGS = -O
LDFLAGS =
HOST_CFLAGS = $(CFLAGS)
GLU_CFLAGS =
# Compiler for building demos/tests/etc

View File

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

View File

@@ -45,6 +45,10 @@ tbd
<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
</ul>

View File

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

View File

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

View File

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

View File

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

View File

@@ -77,6 +77,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define HASH_MAGIC 0xdeadbeef
#define HASH_DEBUG 0
@@ -87,9 +88,13 @@
#define HASH_ALLOC malloc
#define HASH_FREE free
#define HASH_RANDOM_DECL
#define HASH_RANDOM_INIT(seed) srandom(seed)
#define HASH_RANDOM random()
#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
typedef struct __glxHashBucket

View File

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

View File

@@ -500,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);
@@ -840,6 +841,14 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
GLboolean
intelUnbindContext(__DRIcontextPrivate * driContextPriv)
{
struct intel_context *intel =
(struct intel_context *) driContextPriv->driverPrivate;
/* Deassociate the context with the drawables.
*/
intel->driDrawable = NULL;
intel->driReadDrawable = NULL;
return GL_TRUE;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1527,17 +1527,12 @@ _mesa_execute_program(GLcontext * ctx,
case OPCODE_TXB: /* GL_ARB_fragment_program only */
/* Texel lookup with LOD bias */
{
const GLuint unit = machine->Samplers[inst->TexSrcUnit];
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
GLfloat texcoord[4], color[4], lodBias;
fetch_vector4(&inst->SrcReg[0], machine, texcoord);
/* texcoord[3] is the bias to add to lambda */
lodBias = texUnit->LodBias + texcoord[3];
if (texUnit->_Current) {
lodBias += texUnit->_Current->LodBias;
}
lodBias = texcoord[3];
fetch_texel(ctx, machine, inst, texcoord, lodBias, color);

View File

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

View File

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

View File

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

View File

@@ -661,8 +661,10 @@ st_TexImage(GLcontext * ctx,
format, type,
pixels, unpack, "glTexImage");
}
if (!pixels)
return;
/* Note: we can't check for pixels==NULL until after we've allocated
* memory for the texture.
*/
/* See if we can do texture compression with a blit/render.
*/
@@ -673,6 +675,9 @@ st_TexImage(GLcontext * ctx,
stImage->pt->format,
stImage->pt->target,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) {
if (!pixels)
goto done;
if (compress_with_blit(ctx, target, level, 0, 0, 0, width, height, depth,
format, type, pixels, unpack, texImage)) {
goto done;
@@ -714,6 +719,9 @@ st_TexImage(GLcontext * ctx,
return;
}
if (!pixels)
goto done;
DBG("Upload image %dx%dx%d row_len %x pitch %x\n",
width, height, depth, width * texelBytes, dstRowStride);
@@ -756,9 +764,9 @@ st_TexImage(GLcontext * ctx,
}
}
done:
_mesa_unmap_teximage_pbo(ctx, unpack);
done:
if (stImage->pt && texImage->Data) {
st_texture_image_unmap(ctx->st, stImage);
texImage->Data = NULL;
@@ -1099,7 +1107,7 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
if (!texImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage");
return;
goto done;
}
src = (const GLubyte *) pixels;
@@ -1130,9 +1138,9 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
}
}
done:
_mesa_unmap_teximage_pbo(ctx, packing);
done:
if (stImage->pt) {
st_texture_image_unmap(ctx->st, stImage);
texImage->Data = NULL;

View File

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

View File

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

View File

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