mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 14:30:10 +01:00
Merge branch 'mesa_7_5_branch'
Conflicts: Makefile src/mesa/main/version.h src/mesa/shader/slang/slang_preprocess.c src/mesa/state_tracker/st_cb_bufferobjects.c
This commit is contained in:
commit
ee98ae5a29
16 changed files with 394 additions and 60 deletions
19
bin/mklib
19
bin/mklib
|
|
@ -885,6 +885,17 @@ case $ARCH in
|
|||
|
||||
CYGWIN*)
|
||||
# GCC-based environment
|
||||
if [ $NOPREFIX = 1 ] ; then
|
||||
# No "lib" or ".so" part
|
||||
echo "mklib: Making CYGWIN shared library: " ${LIBNAME}
|
||||
OPTS="-shared -Wl,--enable-auto-image-base"
|
||||
if [ "${ALTOPTS}" ] ; then
|
||||
OPTS=${ALTOPTS}
|
||||
fi
|
||||
rm -f ${LIBNAME}
|
||||
${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
|
||||
FINAL_LIBS=${LIBNAME}
|
||||
else
|
||||
CYGNAME="cyg${LIBNAME}" # prefix with "cyg"
|
||||
LIBNAME="lib${LIBNAME}" # prefix with "lib"
|
||||
|
||||
|
|
@ -901,11 +912,11 @@ case $ARCH in
|
|||
# finish up
|
||||
FINAL_LIBS=${LIBNAME}.a
|
||||
else
|
||||
OPTS="-shared -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a"
|
||||
OPTS="-shared -Wl,--enable-auto-image-base -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a"
|
||||
if [ "${ALTOPTS}" ] ; then
|
||||
OPTS=${ALTOPTS}
|
||||
fi
|
||||
echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}-${MAJOR}.dll
|
||||
echo "mklib: Making" $ARCH "shared library: " ${CYGNAME}-${MAJOR}.dll
|
||||
|
||||
if [ $CPLUSPLUS = 1 ] ; then
|
||||
LINK="g++"
|
||||
|
|
@ -914,7 +925,8 @@ case $ARCH in
|
|||
fi
|
||||
|
||||
# rm any old libs
|
||||
rm -f ${LIBNAME}-${MAJOR}.dll
|
||||
rm -f ${CYGNAME}-${MAJOR}.dll
|
||||
rm -f ${LIBNAME}-${MAJOR}.dll.a
|
||||
rm -f ${LIBNAME}.dll.a
|
||||
rm -f ${LIBNAME}.a
|
||||
|
||||
|
|
@ -927,6 +939,7 @@ case $ARCH in
|
|||
# special case for installing in bin
|
||||
FINAL_BINS="${CYGNAME}-${MAJOR}.dll"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
'example')
|
||||
|
|
|
|||
|
|
@ -227,6 +227,8 @@ else
|
|||
case "$host_os" in
|
||||
darwin* )
|
||||
LIB_EXTENSION='dylib' ;;
|
||||
cygwin* )
|
||||
LIB_EXTENSION='dll' ;;
|
||||
* )
|
||||
LIB_EXTENSION='so' ;;
|
||||
esac
|
||||
|
|
@ -1078,6 +1080,9 @@ if test "x$APP_LIB_DEPS" = x; then
|
|||
solaris*)
|
||||
APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
|
||||
;;
|
||||
cygwin*)
|
||||
APP_LIB_DEPS="-lX11"
|
||||
;;
|
||||
*)
|
||||
APP_LIB_DEPS="-lm"
|
||||
;;
|
||||
|
|
|
|||
2
progs/tests/.gitignore
vendored
2
progs/tests/.gitignore
vendored
|
|
@ -62,6 +62,8 @@ readrate
|
|||
readtex.c
|
||||
readtex.h
|
||||
rubberband
|
||||
scissor
|
||||
scissor-viewport
|
||||
seccolor
|
||||
shader_api
|
||||
shaderutil.c
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ SOURCES = \
|
|||
random.c \
|
||||
readrate.c \
|
||||
rubberband.c \
|
||||
scissor.c \
|
||||
scissor-viewport.c \
|
||||
seccolor.c \
|
||||
shader_api.c \
|
||||
sharedtex.c \
|
||||
|
|
|
|||
|
|
@ -95,6 +95,8 @@ progs = [
|
|||
'random',
|
||||
'readrate',
|
||||
'rubberband',
|
||||
'scissor',
|
||||
'scissor-viewport',
|
||||
'seccolor',
|
||||
'shader_api',
|
||||
'stencil_twoside',
|
||||
|
|
|
|||
138
progs/tests/scissor-viewport.c
Normal file
138
progs/tests/scissor-viewport.c
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
* Copyright (c) 2009 VMware, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
struct program
|
||||
{
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
int i;
|
||||
};
|
||||
|
||||
struct program prog;
|
||||
|
||||
static void init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
fflush(stderr);
|
||||
|
||||
prog.i = 0;
|
||||
}
|
||||
|
||||
static void reshape(int width, int height)
|
||||
{
|
||||
glViewport(0, 0, 100, 100);
|
||||
|
||||
prog.width = width;
|
||||
prog.height = height;
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
glutPostRedisplay();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void drawQuad(void)
|
||||
{
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2d(-1.0, -1.0);
|
||||
glVertex2d( 1.0, -1.0);
|
||||
glVertex2d( 1.0, 1.0);
|
||||
glVertex2d(-1.0, 1.0);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
static void draw(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
i = prog.i++;
|
||||
if (prog.i >= 3)
|
||||
prog.i = 0;
|
||||
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
{
|
||||
glColor4d(1.0, 0.0, 0.0, 1.0);
|
||||
|
||||
glScissor(i, i, 10 - 2*i, 10 - 2*i);
|
||||
drawQuad();
|
||||
}
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
//glutSwapBuffers();
|
||||
glFlush();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
prog.width = 200;
|
||||
prog.height = 200;
|
||||
|
||||
glutInitWindowPosition(100, 0);
|
||||
glutInitWindowSize(prog.width, prog.height);
|
||||
|
||||
//type = GLUT_RGB | GLUT_DOUBLE;
|
||||
type = GLUT_RGB | GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
glutReshapeFunc(reshape);
|
||||
glutKeyboardFunc(key);
|
||||
glutDisplayFunc(draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
168
progs/tests/scissor.c
Normal file
168
progs/tests/scissor.c
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
* Copyright (c) 2009 VMware, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
struct program
|
||||
{
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
unsigned quads;
|
||||
};
|
||||
|
||||
struct program prog;
|
||||
|
||||
static void init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
static void reshape(int width, int height)
|
||||
{
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
prog.width = width;
|
||||
prog.height = height;
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
prog.quads = !prog.quads;
|
||||
glutPostRedisplay();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void drawQuad(void)
|
||||
{
|
||||
|
||||
if (prog.quads) {
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2d(-1.0, -1.0);
|
||||
glVertex2d( 1.0, -1.0);
|
||||
glVertex2d( 1.0, 1.0);
|
||||
glVertex2d(-1.0, 1.0);
|
||||
glEnd();
|
||||
} else {
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void draw(void)
|
||||
{
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
printf("drawing with %s\n", prog.quads ? "quads" : "clears");
|
||||
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
{
|
||||
glClearColor(1.0, 0.0, 0.0, 1.0);
|
||||
glColor4d(1.0, 0.0, 0.0, 1.0);
|
||||
|
||||
glScissor(1, 1, 10, 10);
|
||||
drawQuad();
|
||||
glScissor(1, prog.height - 11, 10, 10);
|
||||
drawQuad();
|
||||
glScissor(prog.width - 11, prog.height - 11, 10, 10);
|
||||
drawQuad();
|
||||
}
|
||||
|
||||
{
|
||||
glClearColor(0.0, 1.0, 0.0, 1.0);
|
||||
glColor4d(0.0, 1.0, 0.0, 1.0);
|
||||
|
||||
glScissor(12, 1, 10, 10);
|
||||
drawQuad();
|
||||
glScissor(12, prog.height - 11, 10, 10);
|
||||
drawQuad();
|
||||
glScissor(prog.width - 22, prog.height - 11, 10, 10);
|
||||
drawQuad();
|
||||
}
|
||||
|
||||
{
|
||||
glClearColor(1.0, 1.0, 0.0, 1.0);
|
||||
glColor4d(1.0, 1.0, 0.0, 1.0);
|
||||
|
||||
glScissor(1, 12, 10, 10);
|
||||
drawQuad();
|
||||
glScissor(1, prog.height - 22, 10, 10);
|
||||
drawQuad();
|
||||
glScissor(prog.width - 11, prog.height - 22, 10, 10);
|
||||
drawQuad();
|
||||
}
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
//glutSwapBuffers();
|
||||
glFlush();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
prog.width = 200;
|
||||
prog.height = 200;
|
||||
|
||||
glutInitWindowPosition(100, 0);
|
||||
glutInitWindowSize(prog.width, prog.height);
|
||||
|
||||
//type = GLUT_RGB | GLUT_DOUBLE;
|
||||
type = GLUT_RGB | GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
glutReshapeFunc(reshape);
|
||||
glutKeyboardFunc(key);
|
||||
glutDisplayFunc(draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -362,23 +362,8 @@ def generate(env):
|
|||
'/GL-', # disable whole program optimization
|
||||
]
|
||||
else:
|
||||
if env['machine'] == 'x86_64':
|
||||
cflags += [
|
||||
# Same as /O2, but without global optimizations or auto-inlining
|
||||
# http://msdn.microsoft.com/en-us/library/8f8h5cxt.aspx
|
||||
'/Ob1', # enable inline expansion, disable auto-inlining
|
||||
'/Oi', # enable intrinsic functions
|
||||
'/Ot', # favors fast code
|
||||
'/Oy', # omit frame pointer
|
||||
'/Gs', # enable stack probes
|
||||
'/GF', # eliminate duplicate strings
|
||||
'/Gy', # enable function-level linking
|
||||
]
|
||||
else:
|
||||
cflags += [
|
||||
'/O2', # optimize for speed
|
||||
]
|
||||
cflags += [
|
||||
'/O2', # optimize for speed
|
||||
#'/fp:fast', # fast floating point
|
||||
]
|
||||
if env['profile']:
|
||||
|
|
|
|||
|
|
@ -200,8 +200,8 @@ mm_bufmgr_create_buffer(struct pb_manager *mgr,
|
|||
|
||||
mm_buf->block = u_mmAllocMem(mm->heap, size, mm->align2, 0);
|
||||
if(!mm_buf->block) {
|
||||
debug_printf("warning: heap full\n");
|
||||
#if 0
|
||||
debug_printf("warning: heap full\n");
|
||||
mmDumpMemInfo(mm->heap);
|
||||
#endif
|
||||
FREE(mm_buf);
|
||||
|
|
|
|||
|
|
@ -118,7 +118,8 @@ stw_call_window_proc(
|
|||
* be called from any thread.
|
||||
*/
|
||||
pipe_mutex_lock( fb->mutex );
|
||||
st_resize_framebuffer( fb->stfb, width, height );
|
||||
if (fb->stfb)
|
||||
st_resize_framebuffer( fb->stfb, width, height );
|
||||
pipe_mutex_unlock( fb->mutex );
|
||||
}
|
||||
}
|
||||
|
|
@ -379,6 +380,9 @@ stw_swap_buffers(
|
|||
if (fb == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!(fb->pfi->pfd.dwFlags & PFD_DOUBLEBUFFER))
|
||||
return TRUE;
|
||||
|
||||
pipe_mutex_lock( fb->mutex );
|
||||
|
||||
/* If we're swapping the buffer associated with the current context
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@
|
|||
/*@{*/
|
||||
#define MAX_PROGRAM_INSTRUCTIONS (16 * 1024)
|
||||
#define MAX_PROGRAM_LOCAL_PARAMS 256 /**< per-program constants (power of two) */
|
||||
#define MAX_PROGRAM_ENV_PARAMS 128
|
||||
#define MAX_PROGRAM_ENV_PARAMS 256 /**< per-context constants (power of two) */
|
||||
#define MAX_PROGRAM_MATRICES 8
|
||||
#define MAX_PROGRAM_MATRIX_STACK_DEPTH 4
|
||||
#define MAX_PROGRAM_CALL_DEPTH 8
|
||||
|
|
@ -196,7 +196,7 @@
|
|||
/*@{*/
|
||||
#define MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS 128
|
||||
#define MAX_NV_VERTEX_PROGRAM_TEMPS 12
|
||||
#define MAX_NV_VERTEX_PROGRAM_PARAMS MAX_PROGRAM_ENV_PARAMS
|
||||
#define MAX_NV_VERTEX_PROGRAM_PARAMS 96
|
||||
#define MAX_NV_VERTEX_PROGRAM_INPUTS 16
|
||||
#define MAX_NV_VERTEX_PROGRAM_OUTPUTS 15
|
||||
/*@}*/
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ write_texture_image(struct gl_texture_object *texObj)
|
|||
case MESA_FORMAT_RGB565:
|
||||
{
|
||||
GLubyte *buf2 = (GLubyte *) _mesa_malloc(img->Width * img->Height * 3);
|
||||
GLint i;
|
||||
GLuint i;
|
||||
for (i = 0; i < img->Width * img->Height; i++) {
|
||||
GLint r, g, b;
|
||||
GLushort s = ((GLushort *) img->Data)[i];
|
||||
|
|
|
|||
|
|
@ -1022,7 +1022,10 @@ parse_teximage_num (GLcontext * ctx, const GLubyte ** inst,
|
|||
GLint i = parse_integer (inst, Program);
|
||||
|
||||
if ((i < 0) || (i >= (int)ctx->Const.MaxTextureImageUnits)) {
|
||||
program_error(ctx, Program->Position, "Invalid texture image index");
|
||||
char s[100];
|
||||
_mesa_snprintf(s, sizeof(s), "Invalid texture image index %d (%u is max)",
|
||||
i, ctx->Const.MaxTextureImageUnits);
|
||||
program_error(ctx, Program->Position, s);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -245,11 +245,10 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target,
|
|||
assert(offset < obj->Size);
|
||||
assert(offset + length <= obj->Size);
|
||||
|
||||
map = obj->Pointer = pipe_buffer_map_range(pipe->screen, st_obj->buffer,
|
||||
offset, length, flags);
|
||||
if (obj->Pointer) {
|
||||
obj->Offset = 0;
|
||||
obj->Length = obj->Size;
|
||||
map = obj->Pointer = pipe_buffer_map_range(pipe->screen, st_obj->buffer, offset, length, flags);
|
||||
if(obj->Pointer) {
|
||||
obj->Offset = offset;
|
||||
obj->Length = length;
|
||||
map += offset;
|
||||
}
|
||||
|
||||
|
|
@ -268,7 +267,6 @@ st_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target,
|
|||
/* Subrange is relative to mapped range */
|
||||
assert(offset >= 0);
|
||||
assert(length >= 0);
|
||||
assert(offset < obj->Length);
|
||||
assert(offset + length <= obj->Length);
|
||||
|
||||
pipe_buffer_flush_mapped_range(pipe->screen, st_obj->buffer,
|
||||
|
|
|
|||
|
|
@ -55,20 +55,6 @@
|
|||
#define TGSI_DEBUG 0
|
||||
|
||||
|
||||
/** XXX we should use the version of this from u_memory.h but including
|
||||
* that header causes symbol collisions.
|
||||
*/
|
||||
static INLINE void *
|
||||
mem_dup(const void *src, uint size)
|
||||
{
|
||||
void *dup = _mesa_malloc(size);
|
||||
if (dup)
|
||||
_mesa_memcpy(dup, src, size);
|
||||
return dup;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Translate a Mesa vertex shader into a TGSI shader.
|
||||
* \param outputMapping to map vertex program output registers (VERT_RESULT_x)
|
||||
|
|
@ -84,7 +70,7 @@ st_translate_vertex_program(struct st_context *st,
|
|||
const ubyte *outputSemanticIndex)
|
||||
{
|
||||
struct pipe_context *pipe = st->pipe;
|
||||
struct tgsi_token tokens[ST_MAX_SHADER_TOKENS];
|
||||
struct tgsi_token *tokens;
|
||||
GLuint defaultOutputMapping[VERT_RESULT_MAX];
|
||||
struct pipe_shader_state vs;
|
||||
GLuint attr, i;
|
||||
|
|
@ -102,6 +88,13 @@ st_translate_vertex_program(struct st_context *st,
|
|||
GLbitfield input_flags[MAX_PROGRAM_INPUTS];
|
||||
GLbitfield output_flags[MAX_PROGRAM_OUTPUTS];
|
||||
|
||||
tokens = (struct tgsi_token *)MALLOC(ST_MAX_SHADER_TOKENS * sizeof *tokens);
|
||||
if(!tokens) {
|
||||
/* FIXME: propagate error to the caller */
|
||||
assert(0);
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&vs, 0, sizeof(vs));
|
||||
memset(input_flags, 0, sizeof(input_flags));
|
||||
memset(output_flags, 0, sizeof(output_flags));
|
||||
|
|
@ -297,9 +290,6 @@ st_translate_vertex_program(struct st_context *st,
|
|||
}
|
||||
}
|
||||
|
||||
assert(vs_output_semantic_name[0] == TGSI_SEMANTIC_POSITION);
|
||||
|
||||
|
||||
if (outputMapping) {
|
||||
/* find max output slot referenced to compute vs_num_outputs */
|
||||
GLuint maxSlot = 0;
|
||||
|
|
@ -347,7 +337,9 @@ st_translate_vertex_program(struct st_context *st,
|
|||
assert(num_tokens < ST_MAX_SHADER_TOKENS);
|
||||
|
||||
vs.tokens = (struct tgsi_token *)
|
||||
mem_dup(tokens, num_tokens * sizeof(tokens[0]));
|
||||
_mesa_realloc(tokens,
|
||||
ST_MAX_SHADER_TOKENS * sizeof *tokens,
|
||||
num_tokens * sizeof *tokens);
|
||||
|
||||
stvp->num_inputs = vs_num_inputs;
|
||||
stvp->state = vs; /* struct copy */
|
||||
|
|
@ -375,7 +367,7 @@ st_translate_fragment_program(struct st_context *st,
|
|||
const GLuint inputMapping[])
|
||||
{
|
||||
struct pipe_context *pipe = st->pipe;
|
||||
struct tgsi_token tokens[ST_MAX_SHADER_TOKENS];
|
||||
struct tgsi_token *tokens;
|
||||
GLuint outputMapping[FRAG_RESULT_MAX];
|
||||
GLuint defaultInputMapping[FRAG_ATTRIB_MAX];
|
||||
struct pipe_shader_state fs;
|
||||
|
|
@ -395,6 +387,13 @@ st_translate_fragment_program(struct st_context *st,
|
|||
GLbitfield input_flags[MAX_PROGRAM_INPUTS];
|
||||
GLbitfield output_flags[MAX_PROGRAM_OUTPUTS];
|
||||
|
||||
tokens = (struct tgsi_token *)MALLOC(ST_MAX_SHADER_TOKENS * sizeof *tokens);
|
||||
if(!tokens) {
|
||||
/* FIXME: propagate error to the caller */
|
||||
assert(0);
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&fs, 0, sizeof(fs));
|
||||
memset(input_flags, 0, sizeof(input_flags));
|
||||
memset(output_flags, 0, sizeof(output_flags));
|
||||
|
|
@ -536,7 +535,9 @@ st_translate_fragment_program(struct st_context *st,
|
|||
assert(num_tokens < ST_MAX_SHADER_TOKENS);
|
||||
|
||||
fs.tokens = (struct tgsi_token *)
|
||||
mem_dup(tokens, num_tokens * sizeof(tokens[0]));
|
||||
_mesa_realloc(tokens,
|
||||
ST_MAX_SHADER_TOKENS * sizeof *tokens,
|
||||
num_tokens * sizeof *tokens);
|
||||
|
||||
stfp->state = fs; /* struct copy */
|
||||
stfp->driver_shader = pipe->create_fs_state(pipe, &fs);
|
||||
|
|
|
|||
|
|
@ -727,19 +727,32 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec )
|
|||
|
||||
void vbo_exec_vtx_destroy( struct vbo_exec_context *exec )
|
||||
{
|
||||
if (exec->vtx.bufferobj->Name) {
|
||||
/* using a real VBO for vertex data */
|
||||
GLcontext *ctx = exec->ctx;
|
||||
_mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL);
|
||||
}
|
||||
else {
|
||||
/* just using malloc'd space for vertex data */
|
||||
if (exec->vtx.buffer_map) {
|
||||
/* using a real VBO for vertex data */
|
||||
GLcontext *ctx = exec->ctx;
|
||||
unsigned i;
|
||||
|
||||
/* True VBOs should already be unmapped
|
||||
*/
|
||||
if (exec->vtx.buffer_map) {
|
||||
assert (exec->vtx.bufferobj->Name == 0);
|
||||
if (exec->vtx.bufferobj->Name == 0) {
|
||||
ALIGN_FREE(exec->vtx.buffer_map);
|
||||
exec->vtx.buffer_map = NULL;
|
||||
exec->vtx.buffer_ptr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Drop any outstanding reference to the vertex buffer
|
||||
*/
|
||||
for (i = 0; i < Elements(exec->vtx.arrays); i++) {
|
||||
_mesa_reference_buffer_object(ctx,
|
||||
&exec->vtx.arrays[i].BufferObj,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/* Free the vertex buffer:
|
||||
*/
|
||||
_mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL);
|
||||
}
|
||||
|
||||
void vbo_exec_BeginVertices( GLcontext *ctx )
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue