summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct45
-rw-r--r--common.py160
-rw-r--r--progs/trivial/Makefile3
-rw-r--r--progs/trivial/point-wide-smooth.c145
-rw-r--r--progs/trivial/point-wide.c15
-rw-r--r--progs/trivial/tri-orig.c136
-rw-r--r--progs/trivial/tri-unfilled-edgeflag.c141
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_cache.c4
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c42
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.h8
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_hash.h4
-rw-r--r--src/gallium/auxiliary/draw/Makefile1
-rw-r--r--src/gallium/auxiliary/draw/SConscript1
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe.c19
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe.h11
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aaline.c16
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aapoint.c13
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_clip.c56
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_flatshade.c6
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_offset.c3
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_pstipple.c37
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_stipple.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_twoside.c3
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_unfilled.c24
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_vbuf.c1
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_wide_line.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_private.h47
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.c28
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.h10
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_emit.c71
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch.c93
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_emit.c20
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_post_vs.c14
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_varray.c250
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_varray_tmp.h144
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_vcache.c354
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h174
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c11
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr.h3
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c12
-rw-r--r--src/gallium/auxiliary/tgsi/exec/tgsi_exec.c18
-rwxr-xr-xsrc/gallium/auxiliary/tgsi/exec/tgsi_sse2.c6
-rw-r--r--src/gallium/auxiliary/translate/Makefile3
-rw-r--r--src/gallium/auxiliary/translate/SConscript1
-rw-r--r--src/gallium/auxiliary/translate/translate.h1
-rw-r--r--src/gallium/auxiliary/translate/translate_cache.c101
-rw-r--r--src/gallium/auxiliary/translate/translate_cache.h54
-rw-r--r--src/gallium/auxiliary/util/p_debug.c14
-rw-r--r--src/gallium/auxiliary/util/p_debug_mem.c6
-rw-r--r--src/gallium/auxiliary/util/p_tile.c52
-rw-r--r--src/gallium/auxiliary/util/u_blit.h8
-rw-r--r--src/gallium/auxiliary/util/u_gen_mipmap.c2
-rw-r--r--src/gallium/auxiliary/util/u_gen_mipmap.h10
-rw-r--r--src/gallium/auxiliary/util/u_pack_color.h38
-rw-r--r--src/gallium/auxiliary/util/u_time.c38
-rw-r--r--src/gallium/auxiliary/util/u_time.h8
-rw-r--r--src/gallium/drivers/i915simple/i915_state.c3
-rw-r--r--src/gallium/drivers/softpipe/sp_context.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_draw_arrays.c9
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_blend.c27
-rw-r--r--src/gallium/drivers/softpipe/sp_setup.c24
-rw-r--r--src/gallium/drivers/softpipe/sp_state.h3
-rw-r--r--src/gallium/include/pipe/p_compiler.h2
-rw-r--r--src/gallium/include/pipe/p_config.h112
-rw-r--r--src/gallium/include/pipe/p_format.h114
-rw-r--r--src/gallium/include/pipe/p_screen.h22
-rw-r--r--src/gallium/include/pipe/p_util.h9
-rw-r--r--src/gallium/include/pipe/p_winsys.h37
-rw-r--r--src/gallium/winsys/xlib/fakeglx.c10
-rw-r--r--src/mesa/SConscript18
-rw-r--r--src/mesa/main/bufferobj.c4
-rw-r--r--src/mesa/main/bufferobj.h4
-rw-r--r--src/mesa/main/drawpix.c5
-rw-r--r--src/mesa/shader/prog_statevars.c8
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c30
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c9
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c4
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c191
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c8
-rw-r--r--src/mesa/state_tracker/st_cb_program.c12
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c47
-rw-r--r--src/mesa/state_tracker/st_context.c11
-rw-r--r--src/mesa/state_tracker/st_context.h4
-rw-r--r--src/mesa/state_tracker/st_draw.c134
-rw-r--r--src/mesa/state_tracker/st_draw.h7
-rw-r--r--src/mesa/state_tracker/st_extensions.c6
-rw-r--r--src/mesa/state_tracker/st_program.c2
-rw-r--r--src/mesa/state_tracker/st_texture.c5
-rw-r--r--src/mesa/swrast/s_drawpix.c2
-rw-r--r--winddk.py101
91 files changed, 2388 insertions, 1093 deletions
diff --git a/SConstruct b/SConstruct
index 4785e39ec5..e7c10fcf52 100644
--- a/SConstruct
+++ b/SConstruct
@@ -65,7 +65,7 @@ platform = env['platform']
# derived options
x86 = machine == 'x86'
gcc = platform in ('linux', 'freebsd', 'darwin')
-msvc = platform in ('win32', 'winddk')
+msvc = platform in ('windows', 'winddk')
Export([
'debug',
@@ -84,8 +84,6 @@ Export([
# TODO: put the compiler specific settings in separate files
# TODO: auto-detect as much as possible
-common.generate(env)
-
if platform == 'winddk':
env.Tool('winddk', ['.'])
@@ -96,37 +94,7 @@ if platform == 'winddk':
env['CRT_INC_PATH'],
])
-# Optimization flags
-if gcc:
- if debug:
- env.Append(CFLAGS = '-O0 -g3')
- env.Append(CXXFLAGS = '-O0 -g3')
- else:
- env.Append(CFLAGS = '-O3 -g3')
- env.Append(CXXFLAGS = '-O3 -g3')
-
- env.Append(CFLAGS = '-Wall -Wmissing-prototypes -Wno-long-long -ffast-math -pedantic')
- env.Append(CXXFLAGS = '-Wall -pedantic')
-
- # Be nice to Eclipse
- env.Append(CFLAGS = '-fmessage-length=0')
- env.Append(CXXFLAGS = '-fmessage-length=0')
-
-if msvc:
- cflags = [
- #'/Wp64', # enable 64 bit porting warnings
- ]
- env.Append(CFLAGS = cflags)
- env.Append(CXXFLAGS = cflags)
- # Put debugging information in a separate .pdb file for each object file as
- # descrived in the scons manpage
- env['CCPDBFLAGS'] = '/Zi /Fd${TARGET}.pdb'
-
-# Defines
-if debug:
- env.Append(CPPDEFINES = ['DEBUG'])
-else:
- env.Append(CPPDEFINES = ['NDEBUG'])
+common.generate(env)
# Includes
@@ -140,12 +108,6 @@ env.Append(CPPPATH = [
# x86 assembly
if x86:
- env.Append(CPPDEFINES = [
- 'USE_X86_ASM',
- 'USE_MMX_ASM',
- 'USE_3DNOW_ASM',
- 'USE_SSE_ASM',
- ])
if gcc:
env.Append(CFLAGS = '-m32')
env.Append(CXXFLAGS = '-m32')
@@ -188,12 +150,11 @@ if llvm:
# See also http://www.scons.org/wiki/UsingPkgConfig
env.ParseConfig('llvm-config --cflags --ldflags --libs')
env.Append(CPPDEFINES = ['MESA_LLVM'])
- env.Append(CXXFLAGS = ['-Wno-long-long'])
# Force C++ linkage
env['LINK'] = env['CXX']
# libGL
-if platform not in ('winddk',):
+if platform in ('linux', 'freebsd', 'darwin'):
env.Append(LIBS = [
'X11',
'Xext',
diff --git a/common.py b/common.py
index b836a8b41d..1c939e0e24 100644
--- a/common.py
+++ b/common.py
@@ -34,7 +34,7 @@ default_machine = _machine_map.get(default_machine, 'generic')
if default_platform in ('linux', 'freebsd', 'darwin'):
default_dri = 'yes'
-elif default_platform in ('winddk',):
+elif default_platform in ('winddk', 'windows'):
default_dri = 'no'
else:
default_dri = 'no'
@@ -51,7 +51,7 @@ def AddOptions(opts):
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
allowed_values=('generic', 'x86', 'x86_64')))
opts.Add(EnumOption('platform', 'target platform', default_platform,
- allowed_values=('linux', 'cell', 'winddk')))
+ allowed_values=('linux', 'cell', 'windows', 'winddk')))
opts.Add(BoolOption('llvm', 'use LLVM', 'no'))
opts.Add(BoolOption('dri', 'build DRI drivers', default_dri))
@@ -133,8 +133,162 @@ def generate(env):
# FIXME: this is already too late
#if env.get('quiet', False):
# quietCommandLines(env)
- createConvenienceLibBuilder(env)
+
+ # shortcuts
+ debug = env['debug']
+ machine = env['machine']
+ platform = env['platform']
+ x86 = env['machine'] == 'x86'
+ gcc = env['platform'] in ('linux', 'freebsd', 'darwin')
+ msvc = env['platform'] in ('windows', 'winddk')
+
+ # C preprocessor options
+ cppdefines = []
+ if debug:
+ cppdefines += ['DEBUG']
+ else:
+ cppdefines += ['NDEBUG']
+ if platform == 'windows':
+ cppdefines += [
+ 'WIN32',
+ '_WINDOWS',
+ '_UNICODE',
+ 'UNICODE',
+ # http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx,
+ 'WIN32_LEAN_AND_MEAN',
+ 'VC_EXTRALEAN',
+ '_CRT_SECURE_NO_DEPRECATE',
+ ]
+ if debug:
+ cppdefines += ['_DEBUG']
+ if platform == 'winddk':
+ # Mimic WINDDK's builtin flags. See also:
+ # - WINDDK's bin/makefile.new i386mk.inc for more info.
+ # - buildchk_wxp_x86.log files, generated by the WINDDK's build
+ # - http://alter.org.ua/docs/nt_kernel/vc8_proj/
+ cppdefines += [
+ ('_X86_', '1'),
+ ('i386', '1'),
+ 'STD_CALL',
+ ('CONDITION_HANDLING', '1'),
+ ('NT_INST', '0'),
+ ('WIN32', '100'),
+ ('_NT1X_', '100'),
+ ('WINNT', '1'),
+ ('_WIN32_WINNT', '0x0501'), # minimum required OS version
+ ('WINVER', '0x0501'),
+ ('_WIN32_IE', '0x0603'),
+ ('WIN32_LEAN_AND_MEAN', '1'),
+ ('DEVL', '1'),
+ ('__BUILDMACHINE__', 'WinDDK'),
+ ('FPO', '0'),
+ ]
+ if debug:
+ cppdefines += [('DBG', 1)]
+ if platform == 'windows':
+ cppdefines += ['PIPE_SUBSYSTEM_USER']
+ if platform == 'winddk':
+ cppdefines += ['PIPE_SUBSYSTEM_KERNEL']
+ env.Append(CPPDEFINES = cppdefines)
+
+ # C compiler options
+ cflags = []
+ if gcc:
+ if debug:
+ cflags += ['-O0', '-g3']
+ else:
+ cflags += ['-O3', '-g3']
+ cflags += [
+ '-Wall',
+ '-Wmissing-prototypes',
+ '-Wno-long-long',
+ '-ffast-math',
+ '-pedantic',
+ '-fmessage-length=0', # be nice to Eclipse
+ ]
+ if msvc:
+ # See also:
+ # - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
+ # - cl /?
+ if debug:
+ cflags += [
+ '/Od', # disable optimizations
+ '/Oi', # enable intrinsic functions
+ '/Oy-', # disable frame pointer omission
+ ]
+ else:
+ cflags += [
+ '/Ox', # maximum optimizations
+ '/Oi', # enable intrinsic functions
+ '/Os', # favor code space
+ ]
+ if platform == 'windows':
+ cflags += [
+ # TODO
+ #'/Wp64', # enable 64 bit porting warnings
+ ]
+ if platform == 'winddk':
+ cflags += [
+ '/Zl', # omit default library name in .OBJ
+ '/Zp8', # 8bytes struct member alignment
+ '/Gy', # separate functions for linker
+ '/Gm-', # disable minimal rebuild
+ '/W3', # warning level
+ '/WX', # treat warnings as errors
+ '/Gz', # __stdcall Calling convention
+ '/GX-', # disable C++ EH
+ '/GR-', # disable C++ RTTI
+ '/GF', # enable read-only string pooling
+ '/GS', # enable security checks
+ '/G6', # optimize for PPro, P-II, P-III
+ '/Ze', # enable extensions
+ #'/Gi-', # ???
+ '/QIfdiv-', # disable Pentium FDIV fix
+ #'/hotpatch', # ???
+ #'/Z7', #enable old-style debug info
+ ]
+ # Put debugging information in a separate .pdb file for each object file as
+ # descrived in the scons manpage
+ env['CCPDBFLAGS'] = '/Zi /Fd${TARGET}.pdb'
+ env.Append(CFLAGS = cflags)
+ env.Append(CXXFLAGS = cflags)
+ # Linker options
+ if platform == 'winddk':
+ # See also:
+ # - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
+ env.Append(LINKFLAGS = [
+ '/merge:_PAGE=PAGE',
+ '/merge:_TEXT=.text',
+ '/section:INIT,d',
+ '/opt:ref',
+ '/opt:icf',
+ '/ignore:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221',
+ '/incremental:no',
+ '/fullbuild',
+ '/release',
+ '/nodefaultlib',
+ '/wx',
+ '/debug',
+ '/debugtype:cv',
+ '/version:5.1',
+ '/osversion:5.1',
+ '/functionpadmin:5',
+ '/safeseh',
+ '/pdbcompress',
+ '/stack:0x40000,0x1000',
+ '/driver',
+ '/align:0x80',
+ '/subsystem:native,5.01',
+ '/base:0x10000',
+
+ '/entry:DrvEnableDriver',
+ ])
+
+
+ createConvenienceLibBuilder(env)
+
+
# for debugging
#print env.Dump()
diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile
index 8bc6ad4e38..1dbc4721e8 100644
--- a/progs/trivial/Makefile
+++ b/progs/trivial/Makefile
@@ -45,6 +45,7 @@ SOURCES = \
point-param.c \
point-sprite.c \
point-wide.c \
+ point-wide-smooth.c \
point.c \
poly-flat.c \
poly-unfilled.c \
@@ -69,6 +70,7 @@ SOURCES = \
quadstrip-cont.c \
quadstrip-flat.c \
quadstrip.c \
+ tri-orig.c \
tri-alpha.c \
tri-blend-color.c \
tri-blend-max.c \
@@ -92,6 +94,7 @@ SOURCES = \
tri-stencil.c \
tri-tex-3d.c \
tri-tri.c \
+ tri-unfilled-edgeflag.c \
tri-unfilled-clip.c \
tri-unfilled-smooth.c \
tri-unfilled-userclip-stip.c \
diff --git a/progs/trivial/point-wide-smooth.c b/progs/trivial/point-wide-smooth.c
new file mode 100644
index 0000000000..55cbcaec70
--- /dev/null
+++ b/progs/trivial/point-wide-smooth.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 1991, 1992, 1993 Silicon Graphics, 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>
+
+
+#define CI_OFFSET_1 16
+#define CI_OFFSET_2 32
+
+
+GLenum doubleBuffer;
+
+
+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));
+
+ glClearColor(0.0, 0.0, 1.0, 0.0);
+}
+
+static void Reshape(int width, int height)
+{
+
+ glViewport(0, 0, (GLint)width, (GLint)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:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glPointSize(8.0);
+
+ glEnable(GL_POINT_SMOOTH);
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ glBegin(GL_POINTS);
+ glColor3f(1,0,0);
+ glVertex3f( 0.9, -0.9, -30.0);
+ glColor3f(1,1,0);
+ glVertex3f( 0.9, 0.9, -30.0);
+ glColor3f(1,0,1);
+ glVertex3f(-0.9, 0.9, -30.0);
+ glColor3f(0,1,1);
+ glVertex3f(-0.9, -0.9, -30.0);
+ glEnd();
+
+ glFlush();
+
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ doubleBuffer = GL_FALSE;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } else {
+ fprintf(stderr, "%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ GLenum type;
+
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
+
+ type = GLUT_RGB | GLUT_ALPHA;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("First Tri") == GL_FALSE) {
+ exit(1);
+ }
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/progs/trivial/point-wide.c b/progs/trivial/point-wide.c
index d1038ecfa1..265b20097b 100644
--- a/progs/trivial/point-wide.c
+++ b/progs/trivial/point-wide.c
@@ -33,7 +33,6 @@
GLenum doubleBuffer;
-static GLboolean smooth = GL_FALSE;
static void Init(void)
@@ -60,9 +59,6 @@ static void Key(unsigned char key, int x, int y)
{
switch (key) {
- case 's':
- smooth = !smooth;
- break;
case 27:
exit(1);
default:
@@ -75,19 +71,10 @@ static void Key(unsigned char key, int x, int y)
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
+ glDisable(GL_DEPTH_TEST);
glPointSize(8.0);
- if (smooth) {
- glEnable(GL_POINT_SMOOTH);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- }
- else {
- glDisable(GL_POINT_SMOOTH);
- glDisable(GL_BLEND);
- }
-
glBegin(GL_POINTS);
glColor3f(1,0,0);
glVertex3f( 0.9, -0.9, -30.0);
diff --git a/progs/trivial/tri-orig.c b/progs/trivial/tri-orig.c
new file mode 100644
index 0000000000..d5e6742ce1
--- /dev/null
+++ b/progs/trivial/tri-orig.c
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 1991, 1992, 1993 Silicon Graphics, 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>
+
+
+#define CI_OFFSET_1 16
+#define CI_OFFSET_2 32
+
+
+GLenum doubleBuffer;
+
+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));
+
+ glClearColor(0.0, 0.0, 1.0, 0.0);
+}
+
+static void Reshape(int width, int height)
+{
+
+ glViewport(0, 0, (GLint)width, (GLint)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:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glBegin(GL_TRIANGLES);
+ glColor3f(0,0,.7);
+ glVertex3f( 0.9, -0.9, -0.0);
+ glColor3f(.8,0,0);
+ glVertex3f( 0.9, 0.9, -0.0);
+ glColor3f(0,.9,0);
+ glVertex3f(-0.9, 0.0, -0.0);
+ glEnd();
+
+ glFlush();
+
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ doubleBuffer = GL_FALSE;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } else {
+ fprintf(stderr, "%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ GLenum type;
+
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
+
+ type = GLUT_RGB | GLUT_ALPHA;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("First Tri") == GL_FALSE) {
+ exit(1);
+ }
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/progs/trivial/tri-unfilled-edgeflag.c b/progs/trivial/tri-unfilled-edgeflag.c
new file mode 100644
index 0000000000..31f41f6220
--- /dev/null
+++ b/progs/trivial/tri-unfilled-edgeflag.c
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 1991, 1992, 1993 Silicon Graphics, 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>
+
+
+#define CI_OFFSET_1 16
+#define CI_OFFSET_2 32
+
+
+GLenum doubleBuffer;
+
+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));
+
+ glClearColor(0.0, 0.0, 1.0, 0.0);
+}
+
+static void Reshape(int width, int height)
+{
+
+ glViewport(0, 0, (GLint)width, (GLint)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:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+ glClear(GL_COLOR_BUFFER_BIT);
+ glPolygonMode(GL_FRONT, GL_LINE);
+ glPolygonMode(GL_BACK, GL_LINE);
+
+ glBegin(GL_TRIANGLES);
+ glEdgeFlag(1);
+ glColor3f(0,0,.7);
+ glVertex3f( 0.9, -0.9, -0.0);
+ glEdgeFlag(0);
+ glColor3f(.8,0,0);
+ glVertex3f( 0.9, 0.9, -0.0);
+ glEdgeFlag(1);
+ glColor3f(0,.9,0);
+ glVertex3f(-0.9, 0.0, -0.0);
+ glEnd();
+
+ glFlush();
+
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ doubleBuffer = GL_FALSE;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } else {
+ fprintf(stderr, "%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ GLenum type;
+
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
+
+ type = GLUT_RGB | GLUT_ALPHA;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("First Tri") == GL_FALSE) {
+ exit(1);
+ }
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/src/gallium/auxiliary/cso_cache/cso_cache.c b/src/gallium/auxiliary/cso_cache/cso_cache.c
index 63464e0705..096875807b 100644
--- a/src/gallium/auxiliary/cso_cache/cso_cache.c
+++ b/src/gallium/auxiliary/cso_cache/cso_cache.c
@@ -255,9 +255,9 @@ void *cso_hash_find_data_from_template( struct cso_hash *hash,
while (!cso_hash_iter_is_null(iter)) {
void *iter_data = cso_hash_iter_data(iter);
if (!memcmp(iter_data, templ, size)) {
- /* Return the payload:
+ /* We found a match
*/
- return (unsigned char *)iter_data + size;
+ return iter_data;
}
iter = cso_hash_iter_next(iter);
}
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 0523cb1949..b4609e999b 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -102,8 +102,14 @@ out:
return NULL;
}
-static void cso_release_all( struct cso_context *ctx )
+
+/**
+ * Prior to context destruction, this function unbinds all state objects.
+ */
+void cso_release_all( struct cso_context *ctx )
{
+ unsigned i;
+
if (ctx->pipe) {
ctx->pipe->bind_blend_state( ctx->pipe, NULL );
ctx->pipe->bind_rasterizer_state( ctx->pipe, NULL );
@@ -113,6 +119,11 @@ static void cso_release_all( struct cso_context *ctx )
ctx->pipe->bind_vs_state( ctx->pipe, NULL );
}
+ for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
+ pipe_texture_reference(&ctx->textures[i], NULL);
+ pipe_texture_reference(&ctx->textures_saved[i], NULL);
+ }
+
if (ctx->cache) {
cso_cache_delete( ctx->cache );
ctx->cache = NULL;
@@ -122,10 +133,10 @@ static void cso_release_all( struct cso_context *ctx )
void cso_destroy_context( struct cso_context *ctx )
{
- if (ctx)
- cso_release_all( ctx );
-
- FREE( ctx );
+ if (ctx) {
+ //cso_release_all( ctx );
+ FREE( ctx );
+ }
}
@@ -464,6 +475,8 @@ void cso_restore_rasterizer(struct cso_context *ctx)
ctx->rasterizer_saved = NULL;
}
+
+
enum pipe_error cso_set_fragment_shader_handle(struct cso_context *ctx,
void *handle )
{
@@ -474,6 +487,15 @@ enum pipe_error cso_set_fragment_shader_handle(struct cso_context *ctx,
return PIPE_OK;
}
+void cso_delete_fragment_shader(struct cso_context *ctx, void *handle )
+{
+ if (handle == ctx->fragment_shader) {
+ /* unbind before deleting */
+ ctx->pipe->bind_fs_state(ctx->pipe, NULL);
+ ctx->fragment_shader = NULL;
+ }
+ ctx->pipe->delete_fs_state(ctx->pipe, handle);
+}
/* Not really working:
*/
@@ -546,6 +568,16 @@ enum pipe_error cso_set_vertex_shader_handle(struct cso_context *ctx,
return PIPE_OK;
}
+void cso_delete_vertex_shader(struct cso_context *ctx, void *handle )
+{
+ if (handle == ctx->vertex_shader) {
+ /* unbind before deleting */
+ ctx->pipe->bind_vs_state(ctx->pipe, NULL);
+ ctx->vertex_shader = NULL;
+ }
+ ctx->pipe->delete_vs_state(ctx->pipe, handle);
+}
+
/* Not really working:
*/
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h
index 0405944132..b04e98bfa1 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.h
+++ b/src/gallium/auxiliary/cso_cache/cso_context.h
@@ -42,6 +42,8 @@ struct cso_context;
struct cso_context *cso_create_context( struct pipe_context *pipe );
+void cso_release_all( struct cso_context *ctx );
+
void cso_destroy_context( struct cso_context *cso );
@@ -99,16 +101,22 @@ void cso_restore_sampler_textures( struct cso_context *cso );
*/
enum pipe_error cso_set_fragment_shader_handle(struct cso_context *ctx,
void *handle );
+void cso_delete_fragment_shader(struct cso_context *ctx, void *handle );
+/*
enum pipe_error cso_set_fragment_shader( struct cso_context *cso,
const struct pipe_shader_state *shader );
+*/
void cso_save_fragment_shader(struct cso_context *cso);
void cso_restore_fragment_shader(struct cso_context *cso);
enum pipe_error cso_set_vertex_shader_handle(struct cso_context *ctx,
void *handle );
+void cso_delete_vertex_shader(struct cso_context *ctx, void *handle );
+/*
enum pipe_error cso_set_vertex_shader( struct cso_context *cso,
const struct pipe_shader_state *shader );
+*/
void cso_save_vertex_shader(struct cso_context *cso);
void cso_restore_vertex_shader(struct cso_context *cso);
diff --git a/src/gallium/auxiliary/cso_cache/cso_hash.h b/src/gallium/auxiliary/cso_cache/cso_hash.h
index 73c4742006..85f3e276c6 100644
--- a/src/gallium/auxiliary/cso_cache/cso_hash.h
+++ b/src/gallium/auxiliary/cso_cache/cso_hash.h
@@ -106,12 +106,12 @@ struct cso_hash_iter cso_hash_iter_prev(struct cso_hash_iter iter);
/**
- * Convenience routine to iterate over the collision list while doing a memory
+ * Convenience routine to iterate over the collision list while doing a memory
* comparison to see which entry in the list is a direct copy of our template
* and returns that entry.
*/
void *cso_hash_find_data_from_template( struct cso_hash *hash,
- unsigned hash_key,
+ unsigned hash_key,
void *templ,
int size );
diff --git a/src/gallium/auxiliary/draw/Makefile b/src/gallium/auxiliary/draw/Makefile
index bc6acfe458..da7eded21f 100644
--- a/src/gallium/auxiliary/draw/Makefile
+++ b/src/gallium/auxiliary/draw/Makefile
@@ -28,6 +28,7 @@ C_SOURCES = \
draw_pt_fetch_emit.c \
draw_pt_fetch_shade_pipeline.c \
draw_pt_post_vs.c \
+ draw_pt_varray.c \
draw_pt_vcache.c \
draw_vertex.c \
draw_vs.c \
diff --git a/src/gallium/auxiliary/draw/SConscript b/src/gallium/auxiliary/draw/SConscript
index 0b9852f633..3b5d5ed492 100644
--- a/src/gallium/auxiliary/draw/SConscript
+++ b/src/gallium/auxiliary/draw/SConscript
@@ -27,6 +27,7 @@ draw = env.ConvenienceLibrary(
'draw_pt_fetch_emit.c',
'draw_pt_fetch_shade_pipeline.c',
'draw_pt_post_vs.c',
+ 'draw_pt_varray.c',
'draw_pt_vcache.c',
'draw_vertex.c',
'draw_vs.c',
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index f90187816b..98e23fa830 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -367,8 +367,10 @@ draw_set_mapped_element_buffer( struct draw_context *draw,
*/
void draw_do_flush( struct draw_context *draw, unsigned flags )
{
- if (!draw->flushing && !draw->vcache_flushing)
+ if (!draw->suspend_flushing)
{
+ assert(!draw->flushing); /* catch inadvertant recursion */
+
draw->flushing = TRUE;
draw_pipeline_flush( draw, flags );
diff --git a/src/gallium/auxiliary/draw/draw_pipe.c b/src/gallium/auxiliary/draw/draw_pipe.c
index d0890203a5..46afb0f41f 100644
--- a/src/gallium/auxiliary/draw/draw_pipe.c
+++ b/src/gallium/auxiliary/draw/draw_pipe.c
@@ -116,8 +116,7 @@ static void do_point( struct draw_context *draw,
{
struct prim_header prim;
- prim.reset_line_stipple = 0;
- prim.edgeflags = 1;
+ prim.flags = 0;
prim.pad = 0;
prim.v[0] = (struct vertex_header *)v0;
@@ -126,13 +125,13 @@ static void do_point( struct draw_context *draw,
static void do_line( struct draw_context *draw,
+ ushort flags,
const char *v0,
const char *v1 )
{
struct prim_header prim;
- prim.reset_line_stipple = 1; /* fixme */
- prim.edgeflags = 1;
+ prim.flags = flags;
prim.pad = 0;
prim.v[0] = (struct vertex_header *)v0;
prim.v[1] = (struct vertex_header *)v1;
@@ -142,6 +141,7 @@ static void do_line( struct draw_context *draw,
static void do_triangle( struct draw_context *draw,
+ ushort flags,
char *v0,
char *v1,
char *v2 )
@@ -151,10 +151,7 @@ static void do_triangle( struct draw_context *draw,
prim.v[0] = (struct vertex_header *)v0;
prim.v[1] = (struct vertex_header *)v1;
prim.v[2] = (struct vertex_header *)v2;
- prim.reset_line_stipple = 1;
- prim.edgeflags = ((prim.v[0]->edgeflag) |
- (prim.v[1]->edgeflag << 1) |
- (prim.v[2]->edgeflag << 2));
+ prim.flags = flags;
prim.pad = 0;
draw->pipeline.first->tri( draw->pipeline.first, &prim );
@@ -197,13 +194,15 @@ void draw_pipeline_run( struct draw_context *draw,
case PIPE_PRIM_LINES:
for (i = 0; i+1 < count; i += 2)
do_line( draw,
- verts + stride * elts[i+0],
+ elts[i+0], /* flags */
+ verts + stride * (elts[i+0] & ~DRAW_PIPE_FLAG_MASK),
verts + stride * elts[i+1]);
break;
case PIPE_PRIM_TRIANGLES:
for (i = 0; i+2 < count; i += 3)
do_triangle( draw,
- verts + stride * elts[i+0],
+ elts[i+0], /* flags */
+ verts + stride * (elts[i+0] & ~DRAW_PIPE_FLAG_MASK),
verts + stride * elts[i+1],
verts + stride * elts[i+2]);
break;
diff --git a/src/gallium/auxiliary/draw/draw_pipe.h b/src/gallium/auxiliary/draw/draw_pipe.h
index 2476abb2b2..f1cb0891ca 100644
--- a/src/gallium/auxiliary/draw/draw_pipe.h
+++ b/src/gallium/auxiliary/draw/draw_pipe.h
@@ -37,6 +37,17 @@
#include "draw_private.h" /* for sizeof(vertex_header) */
+/**
+ * Basic info for a point/line/triangle primitive.
+ */
+struct prim_header {
+ float det; /**< front/back face determinant */
+ ushort flags;
+ ushort pad;
+ struct vertex_header *v[3]; /**< 1 to 3 vertex pointers */
+};
+
+
/**
* Base class for all primitive drawing stages.
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index 7e5f8bd281..f05641dee6 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -485,11 +485,16 @@ aaline_create_sampler(struct aaline_stage *aaline)
static boolean
bind_aaline_fragment_shader(struct aaline_stage *aaline)
{
+ struct draw_context *draw = aaline->stage.draw;
+
if (!aaline->fs->aaline_fs &&
!generate_aaline_fs(aaline))
return FALSE;
+ draw->suspend_flushing = TRUE;
aaline->driver_bind_fs_state(aaline->pipe, aaline->fs->aaline_fs);
+ draw->suspend_flushing = FALSE;
+
return TRUE;
}
@@ -663,8 +668,10 @@ aaline_first_line(struct draw_stage *stage, struct prim_header *header)
pipe_texture_reference(&aaline->state.texture[aaline->fs->sampler_unit],
aaline->texture);
+ draw->suspend_flushing = TRUE;
aaline->driver_bind_sampler_states(pipe, num_samplers, aaline->state.sampler);
aaline->driver_set_sampler_textures(pipe, num_samplers, aaline->state.texture);
+ draw->suspend_flushing = FALSE;
/* now really draw first line */
stage->line = aaline_line;
@@ -682,14 +689,14 @@ aaline_flush(struct draw_stage *stage, unsigned flags)
stage->line = aaline_first_line;
stage->next->flush( stage->next, flags );
- /* restore original frag shader */
+ /* restore original frag shader, texture, sampler state */
+ draw->suspend_flushing = TRUE;
aaline->driver_bind_fs_state(pipe, aaline->fs->driver_fs);
-
- /* XXX restore original texture, sampler state */
aaline->driver_bind_sampler_states(pipe, aaline->num_samplers,
aaline->state.sampler);
aaline->driver_set_sampler_textures(pipe, aaline->num_textures,
aaline->state.texture);
+ draw->suspend_flushing = FALSE;
draw->extra_vp_outputs.slot = 0;
}
@@ -783,6 +790,7 @@ aaline_bind_fs_state(struct pipe_context *pipe, void *fs)
{
struct aaline_stage *aaline = aaline_stage_from_pipe(pipe);
struct aaline_fragment_shader *aafs = (struct aaline_fragment_shader *) fs;
+
/* save current */
aaline->fs = aafs;
/* pass-through */
@@ -807,9 +815,11 @@ aaline_bind_sampler_states(struct pipe_context *pipe,
unsigned num, void **sampler)
{
struct aaline_stage *aaline = aaline_stage_from_pipe(pipe);
+
/* save current */
memcpy(aaline->state.sampler, sampler, num * sizeof(void *));
aaline->num_samplers = num;
+
/* pass-through */
aaline->driver_bind_sampler_states(aaline->pipe, num, sampler);
}
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
index ac0aa4cd7c..122a48660a 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
@@ -481,7 +481,7 @@ aa_transform_inst(struct tgsi_transform_context *ctx,
/**
- * Generate the frag shader we'll use for drawing AA lines.
+ * Generate the frag shader we'll use for drawing AA points.
* This will be the user's shader plus some texture/modulate instructions.
*/
static boolean
@@ -531,17 +531,22 @@ generate_aapoint_fs(struct aapoint_stage *aapoint)
/**
- * When we're about to draw our first AA line in a batch, this function is
+ * When we're about to draw our first AA point in a batch, this function is
* called to tell the driver to bind our modified fragment shader.
*/
static boolean
bind_aapoint_fragment_shader(struct aapoint_stage *aapoint)
{
+ struct draw_context *draw = aapoint->stage.draw;
+
if (!aapoint->fs->aapoint_fs &&
!generate_aapoint_fs(aapoint))
return FALSE;
+ draw->suspend_flushing = TRUE;
aapoint->driver_bind_fs_state(aapoint->pipe, aapoint->fs->aapoint_fs);
+ draw->suspend_flushing = FALSE;
+
return TRUE;
}
@@ -697,7 +702,7 @@ aapoint_first_point(struct draw_stage *stage, struct prim_header *header)
}
}
- /* now really draw first line */
+ /* now really draw first point */
stage->point = aapoint_point;
stage->point(stage, header);
}
@@ -714,7 +719,9 @@ aapoint_flush(struct draw_stage *stage, unsigned flags)
stage->next->flush( stage->next, flags );
/* restore original frag shader */
+ draw->suspend_flushing = TRUE;
aapoint->driver_bind_fs_state(pipe, aapoint->fs->driver_fs);
+ draw->suspend_flushing = FALSE;
draw->extra_vp_outputs.slot = 0;
}
diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c
index 21216addea..ce80c94163 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_clip.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c
@@ -119,7 +119,7 @@ static void interp( const struct clipper *clip,
*/
{
dst->clipmask = 0;
- dst->edgeflag = 0;
+ dst->edgeflag = 0; /* will get overwritten later */
dst->pad = 0;
dst->vertex_id = UNDEFINED_VERTEX_ID;
}
@@ -162,45 +162,39 @@ static void emit_poly( struct draw_stage *stage,
struct prim_header header;
unsigned i;
+ const ushort edge_first = DRAW_PIPE_EDGE_FLAG_2;
+ const ushort edge_middle = DRAW_PIPE_EDGE_FLAG_0;
+ const ushort edge_last = DRAW_PIPE_EDGE_FLAG_1;
+
/* later stages may need the determinant, but only the sign matters */
header.det = origPrim->det;
+ header.flags = DRAW_PIPE_RESET_STIPPLE | edge_first | edge_middle;
+ header.pad = 0;
- for (i = 2; i < n; i++) {
+ for (i = 2; i < n; i++, header.flags = 0) {
header.v[0] = inlist[i-1];
header.v[1] = inlist[i];
header.v[2] = inlist[0]; /* keep in v[2] for flatshading */
-
- {
- unsigned tmp1 = header.v[1]->edgeflag;
- unsigned tmp2 = header.v[2]->edgeflag;
-
- if (i != n-1) header.v[1]->edgeflag = 0;
- if (i != 2) header.v[2]->edgeflag = 0;
-
- header.edgeflags = ((header.v[0]->edgeflag << 0) |
- (header.v[1]->edgeflag << 1) |
- (header.v[2]->edgeflag << 2));
-
- if (0) {
- const struct draw_vertex_shader *vs = stage->draw->vertex_shader;
- uint j, k;
- debug_printf("Clipped tri:\n");
- for (j = 0; j < 3; j++) {
- for (k = 0; k < vs->info.num_outputs; k++) {
- debug_printf(" Vert %d: Attr %d: %f %f %f %f\n", j, k,
- header.v[j]->data[k][0],
- header.v[j]->data[k][1],
- header.v[j]->data[k][2],
- header.v[j]->data[k][3]);
- }
+
+ if (i == n-1)
+ header.flags |= edge_last;
+
+ if (0) {
+ const struct draw_vertex_shader *vs = stage->draw->vertex_shader;
+ uint j, k;
+ debug_printf("Clipped tri:\n");
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < vs->info.num_outputs; k++) {
+ debug_printf(" Vert %d: Attr %d: %f %f %f %f\n", j, k,
+ header.v[j]->data[k][0],
+ header.v[j]->data[k][1],
+ header.v[j]->data[k][2],
+ header.v[j]->data[k][3]);
}
}
-
- stage->next->tri( stage->next, &header );
-
- header.v[1]->edgeflag = tmp1;
- header.v[2]->edgeflag = tmp2;
}
+
+ stage->next->tri( stage->next, &header );
}
}
diff --git a/src/gallium/auxiliary/draw/draw_pipe_flatshade.c b/src/gallium/auxiliary/draw/draw_pipe_flatshade.c
index 205000cbea..09b68c4559 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_flatshade.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_flatshade.c
@@ -91,7 +91,8 @@ static void flatshade_tri_0( struct draw_stage *stage,
struct prim_header tmp;
tmp.det = header->det;
- tmp.edgeflags = header->edgeflags;
+ tmp.flags = header->flags;
+ tmp.pad = header->pad;
tmp.v[0] = header->v[0];
tmp.v[1] = dup_vert(stage, header->v[1], 0);
tmp.v[2] = dup_vert(stage, header->v[2], 1);
@@ -108,7 +109,8 @@ static void flatshade_tri_2( struct draw_stage *stage,
struct prim_header tmp;
tmp.det = header->det;
- tmp.edgeflags = header->edgeflags;
+ tmp.flags = header->flags;
+ tmp.pad = header->pad;
tmp.v[0] = dup_vert(stage, header->v[0], 0);
tmp.v[1] = dup_vert(stage, header->v[1], 1);
tmp.v[2] = header->v[2];
diff --git a/src/gallium/auxiliary/draw/draw_pipe_offset.c b/src/gallium/auxiliary/draw/draw_pipe_offset.c
index ffec85ccdd..ea6de8c571 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_offset.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_offset.c
@@ -106,7 +106,8 @@ static void offset_tri( struct draw_stage *stage,
struct prim_header tmp;
tmp.det = header->det;
- tmp.edgeflags = header->edgeflags;
+ tmp.flags = header->flags;
+ tmp.pad = header->pad;
tmp.v[0] = dup_vert(stage, header->v[0], 0);
tmp.v[1] = dup_vert(stage, header->v[1], 1);
tmp.v[2] = dup_vert(stage, header->v[2], 2);
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index aec485a6e7..d1d63d73be 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -433,9 +433,7 @@ pstip_create_texture(struct pstip_stage *pstip)
/**
- * Create the sampler CSO that'll be used for antialiasing.
- * By using a mipmapped texture, we don't have to generate a different
- * texture image for each line size.
+ * Create the sampler CSO that'll be used for stippling.
*/
static boolean
pstip_create_sampler(struct pstip_stage *pstip)
@@ -463,22 +461,24 @@ pstip_create_sampler(struct pstip_stage *pstip)
/**
- * When we're about to draw our first AA line in a batch, this function is
- * called to tell the driver to bind our modified fragment shader.
+ * When we're about to draw our first stipple polygon in a batch, this function
+ * is called to tell the driver to bind our modified fragment shader.
*/
static boolean
bind_pstip_fragment_shader(struct pstip_stage *pstip)
{
+ struct draw_context *draw = pstip->stage.draw;
if (!pstip->fs->pstip_fs &&
!generate_pstip_fs(pstip))
return FALSE;
+ draw->suspend_flushing = TRUE;
pstip->driver_bind_fs_state(pstip->pipe, pstip->fs->pstip_fs);
+ draw->suspend_flushing = FALSE;
return TRUE;
}
-
static INLINE struct pstip_stage *
pstip_stage( struct draw_stage *stage )
{
@@ -486,14 +486,12 @@ pstip_stage( struct draw_stage *stage )
}
-
-
-
static void
pstip_first_tri(struct draw_stage *stage, struct prim_header *header)
{
struct pstip_stage *pstip = pstip_stage(stage);
struct pipe_context *pipe = pstip->pipe;
+ struct draw_context *draw = stage->draw;
uint num_samplers;
assert(stage->draw->rasterizer->poly_stipple_enable);
@@ -518,10 +516,12 @@ pstip_first_tri(struct draw_stage *stage, struct prim_header *header)
assert(num_samplers <= PIPE_MAX_SAMPLERS);
+ draw->suspend_flushing = TRUE;
pstip->driver_bind_sampler_states(pipe, num_samplers, pstip->state.samplers);
pstip->driver_set_sampler_textures(pipe, num_samplers, pstip->state.textures);
+ draw->suspend_flushing = FALSE;
- /* now really draw first line */
+ /* now really draw first triangle */
stage->tri = draw_pipe_passthrough_tri;
stage->tri(stage, header);
}
@@ -530,21 +530,21 @@ pstip_first_tri(struct draw_stage *stage, struct prim_header *header)
static void
pstip_flush(struct draw_stage *stage, unsigned flags)
{
- /*struct draw_context *draw = stage->draw;*/
+ struct draw_context *draw = stage->draw;
struct pstip_stage *pstip = pstip_stage(stage);
struct pipe_context *pipe = pstip->pipe;
stage->tri = pstip_first_tri;
stage->next->flush( stage->next, flags );
- /* restore original frag shader */
+ /* restore original frag shader, texture, sampler state */
+ draw->suspend_flushing = TRUE;
pstip->driver_bind_fs_state(pipe, pstip->fs->driver_fs);
-
- /* XXX restore original texture, sampler state */
pstip->driver_bind_sampler_states(pipe, pstip->num_samplers,
pstip->state.samplers);
pstip->driver_set_sampler_textures(pipe, pstip->num_textures,
pstip->state.textures);
+ draw->suspend_flushing = FALSE;
}
@@ -689,8 +689,10 @@ pstip_set_polygon_stipple(struct pipe_context *pipe,
const struct pipe_poly_stipple *stipple)
{
struct pstip_stage *pstip = pstip_stage_from_pipe(pipe);
+
/* save current */
pstip->state.stipple = stipple;
+
/* pass-through */
pstip->driver_set_polygon_stipple(pstip->pipe, stipple);
@@ -698,11 +700,10 @@ pstip_set_polygon_stipple(struct pipe_context *pipe,
}
-
/**
- * Called by drivers that want to install this AA line prim stage
+ * Called by drivers that want to install this polygon stipple stage
* into the draw module's pipeline. This will not be used if the
- * hardware has native support for AA lines.
+ * hardware has native support for polygon stipple.
*/
boolean
draw_install_pstipple_stage(struct draw_context *draw,
@@ -713,7 +714,7 @@ draw_install_pstipple_stage(struct draw_context *draw,
pipe->draw = (void *) draw;
/*
- * Create / install AA line drawing / prim stage
+ * Create / install pgon stipple drawing / prim stage
*/
pstip = draw_pstip_stage( draw );
if (pstip == NULL)
diff --git a/src/gallium/auxiliary/draw/draw_pipe_stipple.c b/src/gallium/auxiliary/draw/draw_pipe_stipple.c
index 9cf5840cce..3cbced362e 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_stipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_stipple.c
@@ -135,6 +135,10 @@ stipple_line(struct draw_stage *stage, struct prim_header *header)
float length = MAX2(dx, dy);
int i;
+ if (header->flags & DRAW_PIPE_RESET_STIPPLE)
+ stipple->counter = 0;
+
+
/* XXX ToDo: intead of iterating pixel-by-pixel, use a look-up table.
*/
for (i = 0; i < length; i++) {
diff --git a/src/gallium/auxiliary/draw/draw_pipe_twoside.c b/src/gallium/auxiliary/draw/draw_pipe_twoside.c
index 5910dccc43..50872fdbe9 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_twoside.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_twoside.c
@@ -85,7 +85,8 @@ static void twoside_tri( struct draw_stage *stage,
struct prim_header tmp;
tmp.det = header->det;
- tmp.edgeflags = header->edgeflags;
+ tmp.flags = header->flags;
+ tmp.pad = header->pad;
/* copy back attribs to front attribs */
tmp.v[0] = copy_bfc(twoside, header->v[0], 0);
tmp.v[1] = copy_bfc(twoside, header->v[1], 1);
diff --git a/src/gallium/auxiliary/draw/draw_pipe_unfilled.c b/src/gallium/auxiliary/draw/draw_pipe_unfilled.c
index eeb2bc43f9..8f97fdedaa 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_unfilled.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_unfilled.c
@@ -83,9 +83,9 @@ static void points( struct draw_stage *stage,
struct vertex_header *v1 = header->v[1];
struct vertex_header *v2 = header->v[2];
- if (header->edgeflags & 0x1) point( stage, v0 );
- if (header->edgeflags & 0x2) point( stage, v1 );
- if (header->edgeflags & 0x4) point( stage, v2 );
+ if ((header->flags & DRAW_PIPE_EDGE_FLAG_0) && v0->edgeflag) point( stage, v0 );
+ if ((header->flags & DRAW_PIPE_EDGE_FLAG_1) && v1->edgeflag) point( stage, v1 );
+ if ((header->flags & DRAW_PIPE_EDGE_FLAG_2) && v2->edgeflag) point( stage, v2 );
}
@@ -96,22 +96,22 @@ static void lines( struct draw_stage *stage,
struct vertex_header *v1 = header->v[1];
struct vertex_header *v2 = header->v[2];
-#if 0
- assert(((header->edgeflags & 0x1) >> 0) == header->v[0]->edgeflag);
- assert(((header->edgeflags & 0x2) >> 1) == header->v[1]->edgeflag);
- assert(((header->edgeflags & 0x4) >> 2) == header->v[2]->edgeflag);
-#endif
+ if (header->flags & DRAW_PIPE_RESET_STIPPLE)
+ stage->next->reset_stipple_counter( stage->next );
- if (header->edgeflags & 0x4) line( stage, v2, v0 );
- if (header->edgeflags & 0x1) line( stage, v0, v1 );
- if (header->edgeflags & 0x2) line( stage, v1, v2 );
+ if ((header->flags & DRAW_PIPE_EDGE_FLAG_2) && v2->edgeflag) line( stage, v2, v0 );
+ if ((header->flags & DRAW_PIPE_EDGE_FLAG_0) && v0->edgeflag) line( stage, v0, v1 );
+ if ((header->flags & DRAW_PIPE_EDGE_FLAG_1) && v1->edgeflag) line( stage, v1, v2 );
}
/* Unfilled tri:
*
* Note edgeflags in the vertex struct is not sufficient as we will
- * need to manipulate them when decomposing primitives???
+ * need to manipulate them when decomposing primitives.
+ *
+ * We currently keep the vertex edgeflag and primitive edgeflag mask
+ * separate until the last possible moment.
*/
static void unfilled_tri( struct draw_stage *stage,
struct prim_header *header )
diff --git a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
index afd5f5544d..2a19e6916a 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
@@ -254,6 +254,7 @@ vbuf_set_prim( struct vbuf_stage *vbuf, uint prim )
case EMIT_4UB:
output_format = PIPE_FORMAT_B8G8R8A8_UNORM;
emit_sz = 4 * sizeof(ubyte);
+ break;
default:
assert(0);
output_format = PIPE_FORMAT_NONE;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
index 452732e662..878c9c7169 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c
@@ -169,7 +169,7 @@ struct draw_stage *draw_wide_line_stage( struct draw_context *draw )
wide->stage.next = NULL;
wide->stage.point = draw_pipe_passthrough_point;
wide->stage.line = wideline_line;
- wide->stage.tri = draw_pipe_passthrough_point;
+ wide->stage.tri = draw_pipe_passthrough_tri;
wide->stage.flush = wideline_flush;
wide->stage.reset_stipple_counter = wideline_reset_stipple_counter;
wide->stage.destroy = wideline_destroy;
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index 39aa81b43c..cee58bbf73 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -79,25 +79,6 @@ struct vertex_header {
/**
- * Basic info for a point/line/triangle primitive.
- */
-struct prim_header {
- float det; /**< front/back face determinant */
- unsigned reset_line_stipple:1;
- unsigned edgeflags:3;
- unsigned pad:28;
- struct vertex_header *v[3]; /**< 1 to 3 vertex pointers */
-};
-
-
-
-
-#define PT_SHADE 0x1
-#define PT_CLIPTEST 0x2
-#define PT_PIPELINE 0x4
-#define PT_MAX_MIDDLE 0x8
-
-/**
* Private context for the drawing module.
*/
struct draw_context
@@ -148,6 +129,7 @@ struct draw_context
struct {
struct draw_pt_front_end *vcache;
+ struct draw_pt_front_end *varray;
} front;
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
@@ -178,9 +160,9 @@ struct draw_context
boolean bypass_clipping;
} driver;
- boolean flushing;
- boolean vcache_flushing;
- boolean bypass_clipping; /* set if either api or driver bypass_clipping true */
+ boolean flushing; /**< debugging/sanity */
+ boolean suspend_flushing; /**< internally set */
+ boolean bypass_clipping; /**< set if either api or driver bypass_clipping true */
/* pipe state that we need: */
const struct pipe_rasterizer_state *rasterizer;
@@ -238,6 +220,25 @@ void draw_pt_reset_vertex_ids( struct draw_context *draw );
boolean draw_pipeline_init( struct draw_context *draw );
void draw_pipeline_destroy( struct draw_context *draw );
+
+
+
+
+/* We use the top few bits in the elts[] parameter to convey a little
+ * API information. This limits the number of vertices we can address
+ * to only 4096 -- if that becomes a problem, we can switch to 32-bit
+ * draw indices.
+ *
+ * These flags expected at first vertex of lines & triangles when
+ * unfilled and/or line stipple modes are operational.
+ */
+#define DRAW_PIPE_EDGE_FLAG_0 (0x1<<12)
+#define DRAW_PIPE_EDGE_FLAG_1 (0x2<<12)
+#define DRAW_PIPE_EDGE_FLAG_2 (0x4<<12)
+#define DRAW_PIPE_EDGE_FLAG_ALL (0x7<<12)
+#define DRAW_PIPE_RESET_STIPPLE (0x8<<12)
+#define DRAW_PIPE_FLAG_MASK (0xf<<12)
+
void draw_pipeline_run( struct draw_context *draw,
unsigned prim,
struct vertex_header *vertices,
@@ -246,6 +247,8 @@ void draw_pipeline_run( struct draw_context *draw,
const ushort *elts,
unsigned count );
+
+
void draw_pipeline_flush( struct draw_context *draw,
unsigned flags );
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index f5a3bf390e..c9c5d18313 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -58,7 +58,7 @@ draw_pt_arrays(struct draw_context *draw,
opt |= PT_PIPELINE;
}
- if (draw_need_pipeline(draw,
+ if (draw_need_pipeline(draw,
draw->rasterizer,
prim)) {
opt |= PT_PIPELINE;
@@ -78,16 +78,21 @@ draw_pt_arrays(struct draw_context *draw,
middle = draw->pt.middle.fetch_emit;
- /* May create a short-circuited version of this for small primitives:
+ /* Pick the right frontend
*/
- frontend = draw->pt.front.vcache;
+ if (draw->pt.user.elts ||
+ count >= 256) {
+ frontend = draw->pt.front.vcache;
+ } else {
+ frontend = draw->pt.front.varray;
+ }
frontend->prepare( frontend, prim, middle, opt );
- frontend->run( frontend,
- draw_pt_elt_func( draw ),
- draw_pt_elt_ptr( draw, start ),
- count );
+ frontend->run(frontend,
+ draw_pt_elt_func(draw),
+ draw_pt_elt_ptr(draw, start),
+ count);
frontend->finish( frontend );
@@ -101,6 +106,10 @@ boolean draw_pt_init( struct draw_context *draw )
if (!draw->pt.front.vcache)
return FALSE;
+ draw->pt.front.varray = draw_pt_varray(draw);
+ if (!draw->pt.front.varray)
+ return FALSE;
+
draw->pt.middle.fetch_emit = draw_pt_fetch_emit( draw );
if (!draw->pt.middle.fetch_emit)
return FALSE;
@@ -129,6 +138,11 @@ void draw_pt_destroy( struct draw_context *draw )
draw->pt.front.vcache->destroy( draw->pt.front.vcache );
draw->pt.front.vcache = NULL;
}
+
+ if (draw->pt.front.varray) {
+ draw->pt.front.varray->destroy( draw->pt.front.varray );
+ draw->pt.front.varray = NULL;
+ }
}
diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h
index fd0d158fcf..2dec376cee 100644
--- a/src/gallium/auxiliary/draw/draw_pt.h
+++ b/src/gallium/auxiliary/draw/draw_pt.h
@@ -40,15 +40,6 @@ typedef unsigned (*pt_elt_func)( const void *elts, unsigned idx );
struct draw_pt_middle_end;
struct draw_context;
-/* We use the top couple of bits in the vertex fetch index to convey a
- * little API information. This limits the number of vertices we can
- * address to only 1 billion -- if that becomes a problem, these could
- * be moved out & passed separately.
- */
-#define DRAW_PT_EDGEFLAG (1<<30)
-#define DRAW_PT_RESET_STIPPLE (1<<31)
-#define DRAW_PT_FLAG_MASK (3<<30)
-
#define PT_SHADE 0x1
#define PT_CLIPTEST 0x2
@@ -124,6 +115,7 @@ const void *draw_pt_elt_ptr( struct draw_context *draw,
* a special case for tiny vertex buffers.
*/
struct draw_pt_front_end *draw_pt_vcache( struct draw_context *draw );
+struct draw_pt_front_end *draw_pt_varray(struct draw_context *draw);
/* Middle-ends:
*
diff --git a/src/gallium/auxiliary/draw/draw_pt_emit.c b/src/gallium/auxiliary/draw/draw_pt_emit.c
index d35329aba0..35707af8a8 100644
--- a/src/gallium/auxiliary/draw/draw_pt_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_emit.c
@@ -32,68 +32,16 @@
#include "draw/draw_vertex.h"
#include "draw/draw_pt.h"
#include "translate/translate.h"
-
-#include "cso_cache/cso_cache.h"
-#include "cso_cache/cso_hash.h"
+#include "translate/translate_cache.h"
struct pt_emit {
struct draw_context *draw;
struct translate *translate;
- struct cso_hash *hash;
+ struct translate_cache *cache;
};
-static INLINE unsigned translate_hash_key_size(struct translate_key *key)
-{
- unsigned size = sizeof(struct translate_key) -
- sizeof(struct translate_element) * (PIPE_MAX_ATTRIBS - key->nr_elements);
- return size;
-}
-
-static INLINE unsigned create_key(struct translate_key *key)
-{
- unsigned hash_key;
- unsigned size = translate_hash_key_size(key);
- /*debug_printf("key size = %d, (els = %d)\n",
- size, key->nr_elements);*/
- hash_key = cso_construct_key(key, size);
- return hash_key;
-}
-
-static struct translate *cached_translate(struct pt_emit *emit,
- struct translate_key *key)
-{
- unsigned hash_key = create_key(key);
- struct cso_hash_iter iter = cso_hash_find(emit->hash, hash_key);
- struct translate *translate = 0;
-
- if (cso_hash_iter_is_null(iter)) {
- translate = translate_create(key);
- cso_hash_insert(emit->hash, hash_key, translate);
- /*debug_printf("\tCREATED with %d\n", hash_key);*/
- } else {
- translate = cso_hash_iter_data(iter);
- /*debug_printf("\tOK with %d\n", hash_key);*/
- }
-
- return translate;
-}
-
-
-static INLINE void delete_translates(struct pt_emit *emit)
-{
- struct cso_hash *hash = emit->hash;
- struct cso_hash_iter iter = cso_hash_first_node(hash);
- while (!cso_hash_iter_is_null(iter)) {
- struct translate *state = (struct translate*)cso_hash_iter_data(iter);
- iter = cso_hash_iter_next(iter);
- if (state) {
- state->release(state);
- }
- }
-}
-
void draw_pt_emit_prepare( struct pt_emit *emit,
unsigned prim )
{
@@ -171,12 +119,10 @@ void draw_pt_emit_prepare( struct pt_emit *emit,
hw_key.nr_elements = vinfo->num_attribs;
hw_key.output_stride = vinfo->size * 4;
- /* Don't bother with caching at this stage:
- */
if (!emit->translate ||
- memcmp(&emit->translate->key, &hw_key, sizeof(hw_key)) != 0)
+ memcmp(&emit->translate->key, &hw_key, sizeof(hw_key)) != 0)
{
- emit->translate = cached_translate(emit, &hw_key);
+ emit->translate = translate_cache_find(emit->cache, &hw_key);
}
}
@@ -238,15 +184,18 @@ struct pt_emit *draw_pt_emit_create( struct draw_context *draw )
return NULL;
emit->draw = draw;
- emit->hash = cso_hash_create();
+ emit->cache = translate_cache_create();
+ if (!emit->cache) {
+ FREE(emit);
+ return NULL;
+ }
return emit;
}
void draw_pt_emit_destroy( struct pt_emit *emit )
{
- delete_translates(emit);
- cso_hash_delete(emit->hash);
+ translate_cache_destroy(emit->cache);
FREE(emit);
}
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch.c b/src/gallium/auxiliary/draw/draw_pt_fetch.c
index 93da811ed8..1f765b73ad 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch.c
@@ -32,9 +32,8 @@
#include "draw/draw_vertex.h"
#include "draw/draw_pt.h"
#include "translate/translate.h"
+#include "translate/translate_cache.h"
-#include "cso_cache/cso_cache.h"
-#include "cso_cache/cso_hash.h"
struct pt_fetch {
struct draw_context *draw;
@@ -42,59 +41,11 @@ struct pt_fetch {
struct translate *translate;
unsigned vertex_size;
+ boolean need_edgeflags;
- struct cso_hash *hash;
+ struct translate_cache *cache;
};
-static INLINE unsigned translate_hash_key_size(struct translate_key *key)
-{
- unsigned size = sizeof(struct translate_key) -
- sizeof(struct translate_element) * (PIPE_MAX_ATTRIBS - key->nr_elements);
- return size;
-}
-
-static INLINE unsigned create_key(struct translate_key *key)
-{
- unsigned hash_key;
- unsigned size = translate_hash_key_size(key);
- /*debug_printf("key size = %d, (els = %d)\n",
- size, key->nr_elements);*/
- hash_key = cso_construct_key(key, size);
- return hash_key;
-}
-
-static struct translate *cached_translate(struct pt_fetch *fetch,
- struct translate_key *key)
-{
- unsigned hash_key = create_key(key);
- struct cso_hash_iter iter = cso_hash_find(fetch->hash, hash_key);
- struct translate *translate = 0;
-
- if (cso_hash_iter_is_null(iter)) {
- translate = translate_create(key);
- cso_hash_insert(fetch->hash, hash_key, translate);
- /*debug_printf("\tCREATED with %d\n", hash_key);*/
- } else {
- translate = cso_hash_iter_data(iter);
- /*debug_printf("\tOK with %d\n", hash_key);*/
- }
-
- return translate;
-}
-
-static INLINE void delete_translates(struct pt_fetch *fetch)
-{
- struct cso_hash *hash = fetch->hash;
- struct cso_hash_iter iter = cso_hash_first_node(hash);
- while (!cso_hash_iter_is_null(iter)) {
- struct translate *state = (struct translate*)cso_hash_iter_data(iter);
- iter = cso_hash_iter_next(iter);
- if (state) {
- state->release(state);
- }
- }
-}
-
/* Perform the fetch from API vertex elements & vertex buffers, to a
* contiguous set of float[4] attributes as required for the
* vertex_shader->run_linear() method.
@@ -158,21 +109,23 @@ void draw_pt_fetch_prepare( struct pt_fetch *fetch,
key.output_stride = vertex_size;
- /* Don't bother with caching at this stage:
- */
if (!fetch->translate ||
- memcmp(&fetch->translate->key, &key, sizeof(key)) != 0)
+ memcmp(&fetch->translate->key, &key, sizeof(key)) != 0)
{
- fetch->translate = cached_translate(fetch, &key);
+ fetch->translate = translate_cache_find(fetch->cache, &key);
{
- static struct vertex_header vh = { 0, 0, 0, 0xffff };
- fetch->translate->set_buffer(fetch->translate,
- draw->pt.nr_vertex_buffers,
+ static struct vertex_header vh = { 0, 1, 0, 0xffff };
+ fetch->translate->set_buffer(fetch->translate,
+ draw->pt.nr_vertex_buffers,
&vh,
0);
}
}
+
+ fetch->need_edgeflags = ((draw->rasterizer->fill_cw != PIPE_POLYGON_MODE_FILL ||
+ draw->rasterizer->fill_ccw != PIPE_POLYGON_MODE_FILL) &&
+ draw->pt.user.edgeflag);
}
@@ -199,6 +152,18 @@ void draw_pt_fetch_run( struct pt_fetch *fetch,
elts,
count,
verts );
+
+ /* Edgeflags are hard to fit into a translate program, populate
+ * them separately if required. In the setup above they are
+ * defaulted to one, so only need this if there is reason to change
+ * that default:
+ */
+ if (fetch->need_edgeflags) {
+ for (i = 0; i < count; i++) {
+ struct vertex_header *vh = (struct vertex_header *)(verts + i * fetch->vertex_size);
+ vh->edgeflag = draw_pt_get_edgeflag( draw, elts[i] );
+ }
+ }
}
@@ -209,14 +174,18 @@ struct pt_fetch *draw_pt_fetch_create( struct draw_context *draw )
return NULL;
fetch->draw = draw;
- fetch->hash = cso_hash_create();
+ fetch->cache = translate_cache_create();
+ if (!fetch->cache) {
+ FREE(fetch);
+ return NULL;
+ }
+
return fetch;
}
void draw_pt_fetch_destroy( struct pt_fetch *fetch )
{
- delete_translates(fetch);
- cso_hash_delete(fetch->hash);
+ translate_cache_destroy(fetch->cache);
FREE(fetch);
}
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
index 68b2c5b1e3..a4de341df8 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
@@ -37,6 +37,7 @@
#include "draw/draw_vertex.h"
#include "draw/draw_pt.h"
#include "translate/translate.h"
+#include "translate/translate_cache.h"
/* The simplest 'middle end' in the new vertex code.
*
@@ -81,6 +82,7 @@ struct fetch_emit_middle_end {
*/
float point_size;
+ struct translate_cache *cache;
};
@@ -174,10 +176,9 @@ static void fetch_emit_prepare( struct draw_pt_middle_end *middle,
if (!feme->translate ||
memcmp(&feme->translate->key, &key, sizeof(key)) != 0)
{
- if (feme->translate)
- feme->translate->release(feme->translate);
+ feme->translate = translate_cache_find(feme->cache,
+ &key);
- feme->translate = translate_create( &key );
feme->translate->set_buffer(feme->translate,
draw->pt.nr_vertex_buffers,
@@ -266,9 +267,8 @@ static void fetch_emit_destroy( struct draw_pt_middle_end *middle )
{
struct fetch_emit_middle_end *feme = (struct fetch_emit_middle_end *)middle;
- if (feme->translate)
- feme->translate->release( feme->translate );
-
+ translate_cache_destroy(feme->cache);
+
FREE(middle);
}
@@ -278,7 +278,13 @@ struct draw_pt_middle_end *draw_pt_fetch_emit( struct draw_context *draw )
struct fetch_emit_middle_end *fetch_emit = CALLOC_STRUCT( fetch_emit_middle_end );
if (fetch_emit == NULL)
return NULL;
-
+
+ fetch_emit->cache = translate_cache_create();
+ if (!fetch_emit->cache) {
+ FREE(fetch_emit);
+ return NULL;
+ }
+
fetch_emit->base.prepare = fetch_emit_prepare;
fetch_emit->base.run = fetch_emit_run;
fetch_emit->base.finish = fetch_emit_finish;
diff --git a/src/gallium/auxiliary/draw/draw_pt_post_vs.c b/src/gallium/auxiliary/draw/draw_pt_post_vs.c
index f98e130ed6..c4a67c8289 100644
--- a/src/gallium/auxiliary/draw/draw_pt_post_vs.c
+++ b/src/gallium/auxiliary/draw/draw_pt_post_vs.c
@@ -61,6 +61,12 @@ compute_clipmask_gl(const float *clip, /*const*/ float plane[][4], unsigned nr)
unsigned mask = 0x0;
unsigned i;
+#if 0
+ debug_printf("compute clipmask %f %f %f %f\n",
+ clip[0], clip[1], clip[2], clip[3]);
+ assert(clip[3] != 0.0);
+#endif
+
/* Do the hardwired planes first:
*/
if (-clip[0] + clip[3] < 0) mask |= (1<<0);
@@ -106,7 +112,6 @@ static boolean post_vs_cliptest_viewport_gl( struct pt_post_vs *pvs,
out->clip[3] = out->data[0][3];
out->vertex_id = 0xffff;
- out->edgeflag = 1;
out->clipmask = compute_clipmask_gl(out->clip,
pvs->draw->plane,
pvs->draw->nr_planes);
@@ -122,6 +127,13 @@ static boolean post_vs_cliptest_viewport_gl( struct pt_post_vs *pvs,
out->data[0][1] = out->data[0][1] * w * scale[1] + trans[1];
out->data[0][2] = out->data[0][2] * w * scale[2] + trans[2];
out->data[0][3] = w;
+#if 0
+ debug_printf("post viewport: %f %f %f %f\n",
+ out->data[0][0],
+ out->data[0][1],
+ out->data[0][2],
+ out->data[0][3]);
+#endif
}
out = (struct vertex_header *)( (char *)out + stride );
diff --git a/src/gallium/auxiliary/draw/draw_pt_varray.c b/src/gallium/auxiliary/draw/draw_pt_varray.c
new file mode 100644
index 0000000000..c85d8ded50
--- /dev/null
+++ b/src/gallium/auxiliary/draw/draw_pt_varray.c
@@ -0,0 +1,250 @@
+/**************************************************************************
+ *
+ * Copyright 2008 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 "pipe/p_util.h"
+#include "draw/draw_context.h"
+#include "draw/draw_private.h"
+#include "draw/draw_pt.h"
+
+#define FETCH_MAX 256
+#define DRAW_MAX (16*FETCH_MAX)
+
+struct varray_frontend {
+ struct draw_pt_front_end base;
+ struct draw_context *draw;
+
+ ushort draw_elts[DRAW_MAX];
+ unsigned fetch_elts[FETCH_MAX];
+
+ unsigned draw_count;
+ unsigned fetch_count;
+
+ struct draw_pt_middle_end *middle;
+
+ unsigned input_prim;
+ unsigned output_prim;
+};
+
+static void varray_flush(struct varray_frontend *varray)
+{
+ if (varray->draw_count) {
+#if 0
+ debug_printf("FLUSH fc = %d, dc = %d\n",
+ varray->fetch_count,
+ varray->draw_count);
+#endif
+ varray->middle->run(varray->middle,
+ varray->fetch_elts,
+ varray->fetch_count,
+ varray->draw_elts,
+ varray->draw_count);
+ }
+
+ varray->fetch_count = 0;
+ varray->draw_count = 0;
+}
+
+#if 0
+static void varray_check_flush(struct varray_frontend *varray)
+{
+ if (varray->draw_count + 6 >= DRAW_MAX/* ||
+ varray->fetch_count + 4 >= FETCH_MAX*/) {
+ varray_flush(varray);
+ }
+}
+#endif
+
+static INLINE void add_draw_el(struct varray_frontend *varray,
+ int idx, ushort flags)
+{
+ varray->draw_elts[varray->draw_count++] = idx | flags;
+}
+
+
+static INLINE void varray_triangle( struct varray_frontend *varray,
+ unsigned i0,
+ unsigned i1,
+ unsigned i2 )
+{
+ add_draw_el(varray, i0, 0);
+ add_draw_el(varray, i1, 0);
+ add_draw_el(varray, i2, 0);
+}
+
+static INLINE void varray_triangle_flags( struct varray_frontend *varray,
+ ushort flags,
+ unsigned i0,
+ unsigned i1,
+ unsigned i2 )
+{
+ add_draw_el(varray, i0, flags);
+ add_draw_el(varray, i1, 0);
+ add_draw_el(varray, i2, 0);
+}
+
+static INLINE void varray_line( struct varray_frontend *varray,
+ unsigned i0,
+ unsigned i1 )
+{
+ add_draw_el(varray, i0, 0);
+ add_draw_el(varray, i1, 0);
+}
+
+
+static INLINE void varray_line_flags( struct varray_frontend *varray,
+ ushort flags,
+ unsigned i0,
+ unsigned i1 )
+{
+ add_draw_el(varray, i0, flags);
+ add_draw_el(varray, i1, 0);
+}
+
+
+static INLINE void varray_point( struct varray_frontend *varray,
+ unsigned i0 )
+{
+ add_draw_el(varray, i0, 0);
+}
+
+static INLINE void varray_quad( struct varray_frontend *varray,
+ unsigned i0,
+ unsigned i1,
+ unsigned i2,
+ unsigned i3 )
+{
+ varray_triangle( varray, i0, i1, i3 );
+ varray_triangle( varray, i1, i2, i3 );
+}
+
+static INLINE void varray_ef_quad( struct varray_frontend *varray,
+ unsigned i0,
+ unsigned i1,
+ unsigned i2,
+ unsigned i3 )
+{
+ const unsigned omitEdge1 = DRAW_PIPE_EDGE_FLAG_0 | DRAW_PIPE_EDGE_FLAG_2;
+ const unsigned omitEdge2 = DRAW_PIPE_EDGE_FLAG_0 | DRAW_PIPE_EDGE_FLAG_1;
+
+ varray_triangle_flags( varray,
+ DRAW_PIPE_RESET_STIPPLE | omitEdge1,
+ i0, i1, i3 );
+
+ varray_triangle_flags( varray,
+ omitEdge2,
+ i1, i2, i3 );
+}
+
+/* At least for now, we're back to using a template include file for
+ * this. The two paths aren't too different though - it may be
+ * possible to reunify them.
+ */
+#define TRIANGLE(vc,flags,i0,i1,i2) varray_triangle_flags(vc,flags,i0,i1,i2)
+#define QUAD(vc,i0,i1,i2,i3) varray_ef_quad(vc,i0,i1,i2,i3)
+#define LINE(vc,flags,i0,i1) varray_line_flags(vc,flags,i0,i1)
+#define POINT(vc,i0) varray_point(vc,i0)
+#define FUNC varray_run_extras
+#include "draw_pt_varray_tmp.h"
+
+#define TRIANGLE(vc,flags,i0,i1,i2) varray_triangle(vc,i0,i1,i2)
+#define QUAD(vc,i0,i1,i2,i3) varray_quad(vc,i0,i1,i2,i3)
+#define LINE(vc,flags,i0,i1) varray_line(vc,i0,i1)
+#define POINT(vc,i0) varray_point(vc,i0)
+#define FUNC varray_run
+#include "draw_pt_varray_tmp.h"
+
+
+
+static unsigned reduced_prim[PIPE_PRIM_POLYGON + 1] = {
+ PIPE_PRIM_POINTS,
+ PIPE_PRIM_LINES,
+ PIPE_PRIM_LINES,
+ PIPE_PRIM_LINES,
+ PIPE_PRIM_TRIANGLES,
+ PIPE_PRIM_TRIANGLES,
+ PIPE_PRIM_TRIANGLES,
+ PIPE_PRIM_TRIANGLES,
+ PIPE_PRIM_TRIANGLES,
+ PIPE_PRIM_TRIANGLES
+};
+
+
+
+static void varray_prepare(struct draw_pt_front_end *frontend,
+ unsigned prim,
+ struct draw_pt_middle_end *middle,
+ unsigned opt)
+{
+ struct varray_frontend *varray = (struct varray_frontend *)frontend;
+ const struct pipe_rasterizer_state *rasterizer = varray->draw->rasterizer;
+
+ if (opt & PT_PIPELINE)
+ {
+ varray->base.run = varray_run_extras;
+ }
+ else
+ {
+ varray->base.run = varray_run;
+ }
+
+ varray->input_prim = prim;
+ varray->output_prim = reduced_prim[prim];
+
+ varray->middle = middle;
+ middle->prepare(middle, varray->output_prim, opt);
+}
+
+
+
+
+static void varray_finish(struct draw_pt_front_end *frontend)
+{
+ struct varray_frontend *varray = (struct varray_frontend *)frontend;
+ varray->middle->finish(varray->middle);
+ varray->middle = NULL;
+}
+
+static void varray_destroy(struct draw_pt_front_end *frontend)
+{
+ FREE(frontend);
+}
+
+
+struct draw_pt_front_end *draw_pt_varray(struct draw_context *draw)
+{
+ struct varray_frontend *varray = CALLOC_STRUCT(varray_frontend);
+ if (varray == NULL)
+ return NULL;
+
+ varray->base.prepare = varray_prepare;
+ varray->base.run = NULL;
+ varray->base.finish = varray_finish;
+ varray->base.destroy = varray_destroy;
+ varray->draw = draw;
+
+ return &varray->base;
+}
diff --git a/src/gallium/auxiliary/draw/draw_pt_varray_tmp.h b/src/gallium/auxiliary/draw/draw_pt_varray_tmp.h
new file mode 100644
index 0000000000..b9a319b253
--- /dev/null
+++ b/src/gallium/auxiliary/draw/draw_pt_varray_tmp.h
@@ -0,0 +1,144 @@
+
+static void FUNC(struct draw_pt_front_end *frontend,
+ pt_elt_func get_elt,
+ const void *elts,
+ unsigned count)
+{
+ struct varray_frontend *varray = (struct varray_frontend *)frontend;
+ struct draw_context *draw = varray->draw;
+ unsigned start = (unsigned)elts;
+
+ boolean flatfirst = (draw->rasterizer->flatshade &&
+ draw->rasterizer->flatshade_first);
+ unsigned i, flags;
+
+#if 0
+ debug_printf("%s (%d) %d/%d\n", __FUNCTION__, draw->prim, start, count);
+#endif
+#if 0
+ debug_printf("INPUT PRIM = %d (start = %d, count = %d)\n", varray->input_prim,
+ start, count);
+#endif
+
+ for (i = 0; i < count; ++i) {
+ varray->fetch_elts[i] = start + i;
+ }
+ varray->fetch_count = count;
+
+ switch (varray->input_prim) {
+ case PIPE_PRIM_POINTS:
+ for (i = 0; i < count; i ++) {
+ POINT(varray, i + 0);
+ }
+ break;
+
+ case PIPE_PRIM_LINES:
+ for (i = 0; i+1 < count; i += 2) {
+ LINE(varray, DRAW_PIPE_RESET_STIPPLE,
+ i + 0, i + 1);
+ }
+ break;
+
+ case PIPE_PRIM_LINE_LOOP:
+ if (count >= 2) {
+ flags = DRAW_PIPE_RESET_STIPPLE;
+
+ for (i = 1; i < count; i++, flags = 0) {
+ LINE(varray, flags, i - 1, i);
+ }
+ LINE(varray, flags, i - 1, 0);
+ }
+ break;
+
+ case PIPE_PRIM_LINE_STRIP:
+ flags = DRAW_PIPE_RESET_STIPPLE;
+ for (i = 1; i < count; i++, flags = 0) {
+ LINE(varray, flags, i - 1, i);
+ }
+ break;
+
+ case PIPE_PRIM_TRIANGLES:
+ for (i = 0; i+2 < count; i += 3) {
+ TRIANGLE(varray, DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL,
+ i + 0, i + 1, i + 2);
+ }
+ break;
+
+ case PIPE_PRIM_TRIANGLE_STRIP:
+ if (flatfirst) {
+ for (i = 0; i+2 < count; i++) {
+ TRIANGLE(varray, DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL,
+ i + 0, i + 1 + (i&1), i + 2 - (i&1));
+ }
+ }
+ else {
+ for (i = 0; i+2 < count; i++) {
+ TRIANGLE(varray, DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL,
+ i + 0 + (i&1), i + 1 - (i&1), i + 2);
+ }
+ }
+ break;
+
+ case PIPE_PRIM_TRIANGLE_FAN:
+ if (count >= 3) {
+ if (flatfirst) {
+ flags = DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL;
+ for (i = 0; i+2 < count; i++) {
+ TRIANGLE(varray, flags, i + 1, i + 2, 0);
+ }
+ }
+ else {
+ flags = DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL;
+ for (i = 0; i+2 < count; i++) {
+ TRIANGLE(varray, flags, 0, i + 1, i + 2);
+ }
+ }
+ }
+ break;
+
+ case PIPE_PRIM_QUADS:
+ for (i = 0; i+3 < count; i += 4) {
+ QUAD(varray, i + 0, i + 1, i + 2, i + 3);
+ }
+ break;
+
+ case PIPE_PRIM_QUAD_STRIP:
+ for (i = 0; i+3 < count; i += 2) {
+ QUAD(varray, i + 2, i + 0, i + 1, i + 3);
+ }
+ break;
+
+ case PIPE_PRIM_POLYGON:
+ {
+ /* These bitflags look a little odd because we submit the
+ * vertices as (1,2,0) to satisfy flatshade requirements.
+ */
+ const unsigned edge_first = DRAW_PIPE_EDGE_FLAG_2;
+ const unsigned edge_middle = DRAW_PIPE_EDGE_FLAG_0;
+ const unsigned edge_last = DRAW_PIPE_EDGE_FLAG_1;
+
+ flags = DRAW_PIPE_RESET_STIPPLE | edge_first | edge_middle;
+
+ for (i = 0; i+2 < count; i++, flags = edge_middle) {
+
+ if (i + 3 == count)
+ flags |= edge_last;
+
+ TRIANGLE(varray, flags, i + 1, i + 2, 0);
+ }
+ }
+ break;
+
+ default:
+ assert(0);
+ break;
+ }
+
+ varray_flush(varray);
+}
+
+#undef TRIANGLE
+#undef QUAD
+#undef POINT
+#undef LINE
+#undef FUNC
diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache.c b/src/gallium/auxiliary/draw/draw_pt_vcache.c
index afcff41043..2f9775814f 100644
--- a/src/gallium/auxiliary/draw/draw_pt_vcache.c
+++ b/src/gallium/auxiliary/draw/draw_pt_vcache.c
@@ -33,8 +33,6 @@
#include "pipe/p_util.h"
#include "draw/draw_context.h"
#include "draw/draw_private.h"
-//#include "draw/draw_vbuf.h"
-//#include "draw/draw_vertex.h"
#include "draw/draw_pt.h"
@@ -63,7 +61,6 @@ struct vcache_frontend {
static void vcache_flush( struct vcache_frontend *vcache )
{
- vcache->draw->vcache_flushing = TRUE;
if (vcache->draw_count) {
vcache->middle->run( vcache->middle,
vcache->fetch_elts,
@@ -75,7 +72,6 @@ static void vcache_flush( struct vcache_frontend *vcache )
memset(vcache->in, ~0, sizeof(vcache->in));
vcache->fetch_count = 0;
vcache->draw_count = 0;
- vcache->draw->vcache_flushing = FALSE;
}
static void vcache_check_flush( struct vcache_frontend *vcache )
@@ -88,8 +84,9 @@ static void vcache_check_flush( struct vcache_frontend *vcache )
}
-static void vcache_elt( struct vcache_frontend *vcache,
- unsigned felt )
+static INLINE void vcache_elt( struct vcache_frontend *vcache,
+ unsigned felt,
+ ushort flags )
{
unsigned idx = felt % CACHE_MAX;
@@ -101,28 +98,9 @@ static void vcache_elt( struct vcache_frontend *vcache,
vcache->fetch_elts[vcache->fetch_count++] = felt;
}
- vcache->draw_elts[vcache->draw_count++] = vcache->out[idx];
+ vcache->draw_elts[vcache->draw_count++] = vcache->out[idx] | flags;
}
-static unsigned add_edgeflag( struct vcache_frontend *vcache,
- unsigned idx,
- unsigned mask )
-{
- if (0 && mask && draw_pt_get_edgeflag(vcache->draw, idx))
- return idx | DRAW_PT_EDGEFLAG;
- else
- return idx;
-}
-
-
-static unsigned add_reset_stipple( unsigned idx,
- unsigned reset )
-{
- if (0 && reset)
- return idx | DRAW_PT_RESET_STIPPLE;
- else
- return idx;
-}
static void vcache_triangle( struct vcache_frontend *vcache,
@@ -130,49 +108,42 @@ static void vcache_triangle( struct vcache_frontend *vcache,
unsigned i1,
unsigned i2 )
{
- vcache_elt(vcache, i0 /* | DRAW_PT_EDGEFLAG | DRAW_PT_RESET_STIPPLE */ );
- vcache_elt(vcache, i1 /* | DRAW_PT_EDGEFLAG */);
- vcache_elt(vcache, i2 /* | DRAW_PT_EDGEFLAG */);
+ vcache_elt(vcache, i0, 0);
+ vcache_elt(vcache, i1, 0);
+ vcache_elt(vcache, i2, 0);
vcache_check_flush(vcache);
}
-static void vcache_ef_triangle( struct vcache_frontend *vcache,
- boolean reset_stipple,
- unsigned ef_mask,
- unsigned i0,
- unsigned i1,
- unsigned i2 )
+static void vcache_triangle_flags( struct vcache_frontend *vcache,
+ ushort flags,
+ unsigned i0,
+ unsigned i1,
+ unsigned i2 )
{
-/*
- i0 = add_edgeflag( vcache, i0, (ef_mask >> 0) & 1 );
- i1 = add_edgeflag( vcache, i1, (ef_mask >> 1) & 1 );
- i2 = add_edgeflag( vcache, i2, (ef_mask >> 2) & 1 );
- i0 = add_reset_stipple( i0, reset_stipple );
-*/
-
- vcache_elt(vcache, i0);
- vcache_elt(vcache, i1);
- vcache_elt(vcache, i2);
+ vcache_elt(vcache, i0, flags);
+ vcache_elt(vcache, i1, 0);
+ vcache_elt(vcache, i2, 0);
vcache_check_flush(vcache);
-
- if (0) debug_printf("emit tri ef: %d %d %d\n",
- !!(i0 & DRAW_PT_EDGEFLAG),
- !!(i1 & DRAW_PT_EDGEFLAG),
- !!(i2 & DRAW_PT_EDGEFLAG));
-
}
-
static void vcache_line( struct vcache_frontend *vcache,
- boolean reset_stipple,
unsigned i0,
unsigned i1 )
{
- i0 = add_reset_stipple( i0, reset_stipple );
+ vcache_elt(vcache, i0, 0);
+ vcache_elt(vcache, i1, 0);
+ vcache_check_flush(vcache);
+}
+
- vcache_elt(vcache, i0);
- vcache_elt(vcache, i1);
+static void vcache_line_flags( struct vcache_frontend *vcache,
+ ushort flags,
+ unsigned i0,
+ unsigned i1 )
+{
+ vcache_elt(vcache, i0, flags);
+ vcache_elt(vcache, i1, 0);
vcache_check_flush(vcache);
}
@@ -180,7 +151,7 @@ static void vcache_line( struct vcache_frontend *vcache,
static void vcache_point( struct vcache_frontend *vcache,
unsigned i0 )
{
- vcache_elt(vcache, i0);
+ vcache_elt(vcache, i0, 0);
vcache_check_flush(vcache);
}
@@ -200,237 +171,36 @@ static void vcache_ef_quad( struct vcache_frontend *vcache,
unsigned i2,
unsigned i3 )
{
- const unsigned omitEdge2 = ~(1 << 1);
- const unsigned omitEdge3 = ~(1 << 2);
- vcache_ef_triangle( vcache, 1, omitEdge2, i0, i1, i3 );
- vcache_ef_triangle( vcache, 0, omitEdge3, i1, i2, i3 );
-}
+ const unsigned omitEdge1 = DRAW_PIPE_EDGE_FLAG_0 | DRAW_PIPE_EDGE_FLAG_2;
+ const unsigned omitEdge2 = DRAW_PIPE_EDGE_FLAG_0 | DRAW_PIPE_EDGE_FLAG_1;
+ vcache_triangle_flags( vcache,
+ DRAW_PIPE_RESET_STIPPLE | omitEdge1,
+ i0, i1, i3 );
+ vcache_triangle_flags( vcache,
+ omitEdge2,
+ i1, i2, i3 );
+}
+/* At least for now, we're back to using a template include file for
+ * this. The two paths aren't too different though - it may be
+ * possible to reunify them.
+ */
+#define TRIANGLE(vc,flags,i0,i1,i2) vcache_triangle_flags(vc,flags,i0,i1,i2)
+#define QUAD(vc,i0,i1,i2,i3) vcache_ef_quad(vc,i0,i1,i2,i3)
+#define LINE(vc,flags,i0,i1) vcache_line_flags(vc,flags,i0,i1)
+#define POINT(vc,i0) vcache_point(vc,i0)
+#define FUNC vcache_run_extras
+#include "draw_pt_vcache_tmp.h"
+
+#define TRIANGLE(vc,flags,i0,i1,i2) vcache_triangle(vc,i0,i1,i2)
+#define QUAD(vc,i0,i1,i2,i3) vcache_quad(vc,i0,i1,i2,i3)
+#define LINE(vc,flags,i0,i1) vcache_line(vc,i0,i1)
+#define POINT(vc,i0) vcache_point(vc,i0)
+#define FUNC vcache_run
+#include "draw_pt_vcache_tmp.h"
-static void vcache_run( struct draw_pt_front_end *frontend,
- pt_elt_func get_elt,
- const void *elts,
- unsigned count )
-{
- struct vcache_frontend *vcache = (struct vcache_frontend *)frontend;
- struct draw_context *draw = vcache->draw;
-
- boolean unfilled = (draw->rasterizer->fill_cw != PIPE_POLYGON_MODE_FILL ||
- draw->rasterizer->fill_ccw != PIPE_POLYGON_MODE_FILL);
-
- boolean flatfirst = (draw->rasterizer->flatshade &&
- draw->rasterizer->flatshade_first);
- unsigned i;
-
-// debug_printf("%s (%d) %d/%d\n", __FUNCTION__, draw->prim, start, count );
-
- switch (vcache->input_prim) {
- case PIPE_PRIM_POINTS:
- for (i = 0; i < count; i ++) {
- vcache_point( vcache,
- get_elt(elts, i + 0) );
- }
- break;
-
- case PIPE_PRIM_LINES:
- for (i = 0; i+1 < count; i += 2) {
- vcache_line( vcache,
- TRUE,
- get_elt(elts, i + 0),
- get_elt(elts, i + 1));
- }
- break;
-
- case PIPE_PRIM_LINE_LOOP:
- if (count >= 2) {
- for (i = 1; i < count; i++) {
- vcache_line( vcache,
- i == 1, /* XXX: only if vb not split */
- get_elt(elts, i - 1),
- get_elt(elts, i ));
- }
-
- vcache_line( vcache,
- 0,
- get_elt(elts, count - 1),
- get_elt(elts, 0 ));
- }
- break;
-
- case PIPE_PRIM_LINE_STRIP:
- for (i = 1; i < count; i++) {
- vcache_line( vcache,
- i == 1,
- get_elt(elts, i - 1),
- get_elt(elts, i ));
- }
- break;
-
- case PIPE_PRIM_TRIANGLES:
- if (unfilled) {
- for (i = 0; i+2 < count; i += 3) {
- vcache_ef_triangle( vcache,
- 1,
- ~0,
- get_elt(elts, i + 0),
- get_elt(elts, i + 1),
- get_elt(elts, i + 2 ));
- }
- }
- else {
- for (i = 0; i+2 < count; i += 3) {
- vcache_triangle( vcache,
- get_elt(elts, i + 0),
- get_elt(elts, i + 1),
- get_elt(elts, i + 2 ));
- }
- }
- break;
-
- case PIPE_PRIM_TRIANGLE_STRIP:
- if (flatfirst) {
- for (i = 0; i+2 < count; i++) {
- if (i & 1) {
- vcache_triangle( vcache,
- get_elt(elts, i + 0),
- get_elt(elts, i + 2),
- get_elt(elts, i + 1 ));
- }
- else {
- vcache_triangle( vcache,
- get_elt(elts, i + 0),
- get_elt(elts, i + 1),
- get_elt(elts, i + 2 ));
- }
- }
- }
- else {
- for (i = 0; i+2 < count; i++) {
- if (i & 1) {
- vcache_triangle( vcache,
- get_elt(elts, i + 1),
- get_elt(elts, i + 0),
- get_elt(elts, i + 2 ));
- }
- else {
- vcache_triangle( vcache,
- get_elt(elts, i + 0),
- get_elt(elts, i + 1),
- get_elt(elts, i + 2 ));
- }
- }
- }
- break;
-
- case PIPE_PRIM_TRIANGLE_FAN:
- if (count >= 3) {
- if (flatfirst) {
- for (i = 0; i+2 < count; i++) {
- vcache_triangle( vcache,
- get_elt(elts, i + 1),
- get_elt(elts, i + 2),
- get_elt(elts, 0 ));
- }
- }
- else {
- for (i = 0; i+2 < count; i++) {
- vcache_triangle( vcache,
- get_elt(elts, 0),
- get_elt(elts, i + 1),
- get_elt(elts, i + 2 ));
- }
- }
- }
- break;
-
-
- case PIPE_PRIM_QUADS:
- if (unfilled) {
- for (i = 0; i+3 < count; i += 4) {
- vcache_ef_quad( vcache,
- get_elt(elts, i + 0),
- get_elt(elts, i + 1),
- get_elt(elts, i + 2),
- get_elt(elts, i + 3));
- }
- }
- else {
- for (i = 0; i+3 < count; i += 4) {
- vcache_quad( vcache,
- get_elt(elts, i + 0),
- get_elt(elts, i + 1),
- get_elt(elts, i + 2),
- get_elt(elts, i + 3));
- }
- }
- break;
-
- case PIPE_PRIM_QUAD_STRIP:
- if (unfilled) {
- for (i = 0; i+3 < count; i += 2) {
- vcache_ef_quad( vcache,
- get_elt(elts, i + 2),
- get_elt(elts, i + 0),
- get_elt(elts, i + 1),
- get_elt(elts, i + 3));
- }
- }
- else {
- for (i = 0; i+3 < count; i += 2) {
- vcache_quad( vcache,
- get_elt(elts, i + 2),
- get_elt(elts, i + 0),
- get_elt(elts, i + 1),
- get_elt(elts, i + 3));
- }
- }
- break;
-
- case PIPE_PRIM_POLYGON:
- if (unfilled) {
- /* These bitflags look a little odd because we submit the
- * vertices as (1,2,0) to satisfy flatshade requirements.
- */
- const unsigned edge_first = (1<<2);
- const unsigned edge_middle = (1<<0);
- const unsigned edge_last = (1<<1);
-
- for (i = 0; i+2 < count; i++) {
- unsigned ef_mask = edge_middle;
-
- if (i == 0)
- ef_mask |= edge_first;
-
- if (i + 3 == count)
- ef_mask |= edge_last;
-
- vcache_ef_triangle( vcache,
- i == 0,
- ef_mask,
- get_elt(elts, i + 1),
- get_elt(elts, i + 2),
- get_elt(elts, 0));
- }
- }
- else {
- for (i = 0; i+2 < count; i++) {
- vcache_triangle( vcache,
- get_elt(elts, i + 1),
- get_elt(elts, i + 2),
- get_elt(elts, 0));
- }
- }
- break;
-
- default:
- assert(0);
- break;
- }
-
- vcache_flush( vcache );
-}
@@ -455,15 +225,17 @@ static void vcache_prepare( struct draw_pt_front_end *frontend,
unsigned opt )
{
struct vcache_frontend *vcache = (struct vcache_frontend *)frontend;
+ const struct pipe_rasterizer_state *rasterizer = vcache->draw->rasterizer;
-/*
- if (vcache->draw->rasterizer->flatshade_first)
- vcache->base.run = vcache_run_pv0;
- else
- vcache->base.run = vcache_run_pv2;
-*/
+ if (opt & PT_PIPELINE)
+ {
+ vcache->base.run = vcache_run_extras;
+ }
+ else
+ {
+ vcache->base.run = vcache_run;
+ }
- vcache->base.run = vcache_run;
vcache->input_prim = prim;
vcache->output_prim = reduced_prim[prim];
diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h b/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h
new file mode 100644
index 0000000000..cf9f394aa3
--- /dev/null
+++ b/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h
@@ -0,0 +1,174 @@
+
+
+static void FUNC( struct draw_pt_front_end *frontend,
+ pt_elt_func get_elt,
+ const void *elts,
+ unsigned count )
+{
+ struct vcache_frontend *vcache = (struct vcache_frontend *)frontend;
+ struct draw_context *draw = vcache->draw;
+
+ boolean flatfirst = (draw->rasterizer->flatshade &&
+ draw->rasterizer->flatshade_first);
+ unsigned i, flags;
+
+
+ switch (vcache->input_prim) {
+ case PIPE_PRIM_POINTS:
+ for (i = 0; i < count; i ++) {
+ POINT( vcache,
+ get_elt(elts, i + 0) );
+ }
+ break;
+
+ case PIPE_PRIM_LINES:
+ for (i = 0; i+1 < count; i += 2) {
+ LINE( vcache,
+ DRAW_PIPE_RESET_STIPPLE,
+ get_elt(elts, i + 0),
+ get_elt(elts, i + 1));
+ }
+ break;
+
+ case PIPE_PRIM_LINE_LOOP:
+ if (count >= 2) {
+ flags = DRAW_PIPE_RESET_STIPPLE;
+
+ for (i = 1; i < count; i++, flags = 0) {
+ LINE( vcache,
+ flags,
+ get_elt(elts, i - 1),
+ get_elt(elts, i ));
+ }
+
+ LINE( vcache,
+ flags,
+ get_elt(elts, i - 1),
+ get_elt(elts, 0 ));
+ }
+ break;
+
+ case PIPE_PRIM_LINE_STRIP:
+ flags = DRAW_PIPE_RESET_STIPPLE;
+ for (i = 1; i < count; i++, flags = 0) {
+ LINE( vcache,
+ flags,
+ get_elt(elts, i - 1),
+ get_elt(elts, i ));
+ }
+ break;
+
+ case PIPE_PRIM_TRIANGLES:
+ for (i = 0; i+2 < count; i += 3) {
+ TRIANGLE( vcache,
+ DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL,
+ get_elt(elts, i + 0),
+ get_elt(elts, i + 1),
+ get_elt(elts, i + 2 ));
+ }
+ break;
+
+ case PIPE_PRIM_TRIANGLE_STRIP:
+ if (flatfirst) {
+ for (i = 0; i+2 < count; i++) {
+ TRIANGLE( vcache,
+ DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL,
+ get_elt(elts, i + 0),
+ get_elt(elts, i + 1 + (i&1)),
+ get_elt(elts, i + 2 - (i&1)));
+ }
+ }
+ else {
+ for (i = 0; i+2 < count; i++) {
+ TRIANGLE( vcache,
+ DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL,
+ get_elt(elts, i + 0 + (i&1)),
+ get_elt(elts, i + 1 - (i&1)),
+ get_elt(elts, i + 2 ));
+ }
+ }
+ break;
+
+ case PIPE_PRIM_TRIANGLE_FAN:
+ if (count >= 3) {
+ if (flatfirst) {
+ for (i = 0; i+2 < count; i++) {
+ TRIANGLE( vcache,
+ DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL,
+ get_elt(elts, i + 1),
+ get_elt(elts, i + 2),
+ get_elt(elts, 0 ));
+ }
+ }
+ else {
+ for (i = 0; i+2 < count; i++) {
+ TRIANGLE( vcache,
+ DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL,
+ get_elt(elts, 0),
+ get_elt(elts, i + 1),
+ get_elt(elts, i + 2 ));
+ }
+ }
+ }
+ break;
+
+
+ case PIPE_PRIM_QUADS:
+ for (i = 0; i+3 < count; i += 4) {
+ QUAD( vcache,
+ get_elt(elts, i + 0),
+ get_elt(elts, i + 1),
+ get_elt(elts, i + 2),
+ get_elt(elts, i + 3));
+ }
+ break;
+
+ case PIPE_PRIM_QUAD_STRIP:
+ for (i = 0; i+3 < count; i += 2) {
+ QUAD( vcache,
+ get_elt(elts, i + 2),
+ get_elt(elts, i + 0),
+ get_elt(elts, i + 1),
+ get_elt(elts, i + 3));
+ }
+ break;
+
+ case PIPE_PRIM_POLYGON:
+ {
+ /* These bitflags look a little odd because we submit the
+ * vertices as (1,2,0) to satisfy flatshade requirements.
+ */
+ const unsigned edge_first = DRAW_PIPE_EDGE_FLAG_2;
+ const unsigned edge_middle = DRAW_PIPE_EDGE_FLAG_0;
+ const unsigned edge_last = DRAW_PIPE_EDGE_FLAG_1;
+
+ flags = DRAW_PIPE_RESET_STIPPLE | edge_first | edge_middle;
+
+ for (i = 0; i+2 < count; i++, flags = edge_middle) {
+
+ if (i + 3 == count)
+ flags |= edge_last;
+
+ TRIANGLE( vcache,
+ flags,
+ get_elt(elts, i + 1),
+ get_elt(elts, i + 2),
+ get_elt(elts, 0));
+ }
+ }
+ break;
+
+ default:
+ assert(0);
+ break;
+ }
+
+ vcache_flush( vcache );
+}
+
+
+#undef TRIANGLE
+#undef QUAD
+#undef POINT
+#undef LINE
+#undef FUNC
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index 27032b0c4c..d3c1ec4fbe 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
@@ -34,6 +34,12 @@
*/
+#include "pipe/p_config.h"
+
+#if defined(PIPE_OS_LINUX)
+#include <unistd.h>
+#endif
+
#include "pipe/p_compiler.h"
#include "pipe/p_error.h"
#include "pipe/p_debug.h"
@@ -45,9 +51,6 @@
#include "pb_buffer.h"
#include "pb_buffer_fenced.h"
-#ifndef WIN32
-#include <unistd.h>
-#endif
/**
@@ -425,7 +428,7 @@ fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list)
/* Wait on outstanding fences */
while (fenced_list->numDelayed) {
_glthread_UNLOCK_MUTEX(fenced_list->mutex);
-#ifndef WIN32
+#if defined(PIPE_OS_LINUX)
sched_yield();
#endif
_fenced_buffer_list_check_free(fenced_list, 1);
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
index 96f9af3825..8de286e3f9 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
@@ -144,6 +144,9 @@ struct pb_manager *
pb_cache_manager_create(struct pb_manager *provider,
unsigned usecs);
+void
+pb_cache_flush(struct pb_manager *mgr);
+
/**
* Fenced buffer manager.
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
index 543fd51253..4bd3f94a6c 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
@@ -294,8 +294,8 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr,
}
-static void
-pb_cache_manager_destroy(struct pb_manager *_mgr)
+void
+pb_cache_flush(struct pb_manager *_mgr)
{
struct pb_cache_manager *mgr = pb_cache_manager(_mgr);
struct list_head *curr, *next;
@@ -311,7 +311,13 @@ pb_cache_manager_destroy(struct pb_manager *_mgr)
next = curr->next;
}
_glthread_UNLOCK_MUTEX(mgr->mutex);
-
+}
+
+
+static void
+pb_cache_manager_destroy(struct pb_manager *mgr)
+{
+ pb_cache_flush(mgr);
FREE(mgr);
}
diff --git a/src/gallium/auxiliary/tgsi/exec/tgsi_exec.c b/src/gallium/auxiliary/tgsi/exec/tgsi_exec.c
index 29e104bbd1..d55f907c0d 100644
--- a/src/gallium/auxiliary/tgsi/exec/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/exec/tgsi_exec.c
@@ -517,6 +517,20 @@ micro_lg2(
}
static void
+micro_le(
+ union tgsi_exec_channel *dst,
+ const union tgsi_exec_channel *src0,
+ const union tgsi_exec_channel *src1,
+ const union tgsi_exec_channel *src2,
+ const union tgsi_exec_channel *src3 )
+{
+ dst->f[0] = src0->f[0] <= src1->f[0] ? src2->f[0] : src3->f[0];
+ dst->f[1] = src0->f[1] <= src1->f[1] ? src2->f[1] : src3->f[1];
+ dst->f[2] = src0->f[2] <= src1->f[2] ? src2->f[2] : src3->f[2];
+ dst->f[3] = src0->f[3] <= src1->f[3] ? src2->f[3] : src3->f[3];
+}
+
+static void
micro_lt(
union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src0,
@@ -1975,7 +1989,7 @@ exec_instruction(
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
FETCH( &r[1], 1, chan_index );
- micro_lt( &r[0], &r[0], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C] );
+ micro_le( &r[0], &r[0], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C] );
STORE( &r[0], 0, chan_index );
}
break;
@@ -1992,7 +2006,7 @@ exec_instruction(
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
FETCH( &r[1], 1, chan_index );
- micro_ge( &r[0], &r[0], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C] );
+ micro_le( &r[0], &r[0], &r[1], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] );
STORE( &r[0], 0, chan_index );
}
break;
diff --git a/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
index c3295a27ff..9061e00b63 100755
--- a/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
+++ b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
@@ -34,7 +34,7 @@
#include "rtasm/rtasm_x86sse.h"
-#if defined(__i386__) || defined(__386__)
+#ifdef PIPE_ARCH_X86
#define HIGH_PRECISION 1 /* for 1/sqrt() */
@@ -854,7 +854,7 @@ emit_rsqrt(
/* On Intel CPUs at least, this is only accurate to 12 bits -- not
* good enough.
*/
- emit_rsqrtps(
+ sse_rsqrtps(
func,
make_xmm( xmm_dst ),
make_xmm( xmm_src ) );
@@ -2181,4 +2181,4 @@ tgsi_emit_sse2(
return ok;
}
-#endif /* i386 */
+#endif /* PIPE_ARCH_X86 */
diff --git a/src/gallium/auxiliary/translate/Makefile b/src/gallium/auxiliary/translate/Makefile
index 39dfb0de30..ad2a5b705e 100644
--- a/src/gallium/auxiliary/translate/Makefile
+++ b/src/gallium/auxiliary/translate/Makefile
@@ -6,7 +6,8 @@ LIBNAME = translate
C_SOURCES = \
translate_generic.c \
translate_sse.c \
- translate.c
+ translate.c \
+ translate_cache.c
include ../../Makefile.template
diff --git a/src/gallium/auxiliary/translate/SConscript b/src/gallium/auxiliary/translate/SConscript
index 7608908915..9553a67537 100644
--- a/src/gallium/auxiliary/translate/SConscript
+++ b/src/gallium/auxiliary/translate/SConscript
@@ -6,6 +6,7 @@ translate = env.ConvenienceLibrary(
'translate_generic.c',
'translate_sse.c',
'translate.c',
+ 'translate_cache.c',
])
auxiliaries.insert(0, translate)
diff --git a/src/gallium/auxiliary/translate/translate.h b/src/gallium/auxiliary/translate/translate.h
index d95d1ac4f3..6c15d7e4dc 100644
--- a/src/gallium/auxiliary/translate/translate.h
+++ b/src/gallium/auxiliary/translate/translate.h
@@ -96,7 +96,6 @@ struct translate *translate_lookup_or_create( struct translate_context *tctx,
struct translate *translate_create( const struct translate_key *key );
-
/*******************************************************************************
* Private:
*/
diff --git a/src/gallium/auxiliary/translate/translate_cache.c b/src/gallium/auxiliary/translate/translate_cache.c
new file mode 100644
index 0000000000..e91d648eba
--- /dev/null
+++ b/src/gallium/auxiliary/translate/translate_cache.c
@@ -0,0 +1,101 @@
+/**************************************************************************
+ *
+ * Copyright 2008 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 "pipe/p_util.h"
+#include "pipe/p_state.h"
+#include "translate.h"
+
+#include "cso_cache/cso_cache.h"
+#include "cso_cache/cso_hash.h"
+
+struct translate_cache {
+ struct cso_hash *hash;
+};
+
+struct translate_cache * translate_cache_create()
+{
+ struct translate_cache *cache = MALLOC_STRUCT(translate_cache);
+ cache->hash = cso_hash_create();
+ return cache;
+}
+
+
+static INLINE void delete_translates(struct translate_cache *cache)
+{
+ struct cso_hash *hash = cache->hash;
+ struct cso_hash_iter iter = cso_hash_first_node(hash);
+ while (!cso_hash_iter_is_null(iter)) {
+ struct translate *state = (struct translate*)cso_hash_iter_data(iter);
+ iter = cso_hash_iter_next(iter);
+ if (state) {
+ state->release(state);
+ }
+ }
+}
+
+void translate_cache_destroy(struct translate_cache *cache)
+{
+ delete_translates(cache);
+ cso_hash_delete(cache->hash);
+ FREE(cache);
+}
+
+
+static INLINE unsigned translate_hash_key_size(struct translate_key *key)
+{
+ unsigned size = sizeof(struct translate_key) -
+ sizeof(struct translate_element) * (PIPE_MAX_ATTRIBS - key->nr_elements);
+ return size;
+}
+
+static INLINE unsigned create_key(struct translate_key *key)
+{
+ unsigned hash_key;
+ unsigned size = translate_hash_key_size(key);
+ /*debug_printf("key size = %d, (els = %d)\n",
+ size, key->nr_elements);*/
+ hash_key = cso_construct_key(key, size);
+ return hash_key;
+}
+
+struct translate * translate_cache_find(struct translate_cache *cache,
+ struct translate_key *key)
+{
+ unsigned hash_key = create_key(key);
+ struct translate *translate = (struct translate*)
+ cso_hash_find_data_from_template(cache->hash,
+ hash_key,
+ key, sizeof(*key));
+
+ if (!translate) {
+ /* create/insert */
+ translate = translate_create(key);
+ cso_hash_insert(cache->hash, hash_key, translate);
+ }
+
+ return translate;
+}
diff --git a/src/gallium/auxiliary/translate/translate_cache.h b/src/gallium/auxiliary/translate/translate_cache.h
new file mode 100644
index 0000000000..63fc57b7ea
--- /dev/null
+++ b/src/gallium/auxiliary/translate/translate_cache.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Tungsten Graphics, inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on 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 THEIR 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.
+ */
+#ifndef _TRANSLATE_CACHE_H
+#define _TRANSLATE_CACHE_H
+
+
+/*******************************************************************************
+ * Translate cache.
+ * Simply used to cache created translates. Avoids unecessary creation of
+ * translate's if one suitable for a given translate_key has already been
+ * created.
+ *
+ * Note: this functionality depends and requires the CSO module.
+ */
+struct translate_cache;
+
+struct translate_key;
+struct translate;
+
+struct translate_cache *translate_cache_create();
+void translate_cache_destroy(struct translate_cache *cache);
+
+/**
+ * Will try to find a translate structure matched by the given key.
+ * If such a structure doesn't exist in the cache the function
+ * will automatically create it, insert it in the cache and
+ * return the created version.
+ *
+ */
+struct translate *translate_cache_find(struct translate_cache *cache,
+ struct translate_key *key);
+
+#endif
diff --git a/src/gallium/auxiliary/util/p_debug.c b/src/gallium/auxiliary/util/p_debug.c
index 25b132b40c..cd612e23b3 100644
--- a/src/gallium/auxiliary/util/p_debug.c
+++ b/src/gallium/auxiliary/util/p_debug.c
@@ -26,9 +26,11 @@
**************************************************************************/
+#include "pipe/p_config.h"
+
#include <stdarg.h>
-#ifdef WIN32
+#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
#include <windows.h>
#include <winddi.h>
#else
@@ -42,7 +44,7 @@
#include "util/u_string.h"
-#ifdef WIN32
+#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
static INLINE void
_EngDebugPrint(const char *format, ...)
{
@@ -56,7 +58,7 @@ _EngDebugPrint(const char *format, ...)
void _debug_vprintf(const char *format, va_list ap)
{
-#ifdef WIN32
+#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
#ifndef WINCE
/* EngDebugPrint does not handle float point arguments, so we need to use
* our own vsnprintf implementation. It is also very slow, so buffer until
@@ -101,7 +103,7 @@ void _debug_break(void)
__asm("int3");
#elif (defined(__i386__) || defined(__386__)) && defined(__MSC__)
_asm {int 3};
-#elif defined(WIN32) && !defined(WINCE)
+#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) && !defined(WINCE)
EngDebugBreak();
#else
abort();
@@ -109,7 +111,7 @@ void _debug_break(void)
}
-#ifdef WIN32
+#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
static const char *
find(const char *start, const char *end, char c)
{
@@ -150,7 +152,7 @@ const char *
debug_get_option(const char *name, const char *dfault)
{
const char *result;
-#ifdef WIN32
+#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
ULONG_PTR iFile = 0;
const void *pMap = NULL;
const char *sol, *eol, *sep;
diff --git a/src/gallium/auxiliary/util/p_debug_mem.c b/src/gallium/auxiliary/util/p_debug_mem.c
index aba69c0294..9321cf71bb 100644
--- a/src/gallium/auxiliary/util/p_debug_mem.c
+++ b/src/gallium/auxiliary/util/p_debug_mem.c
@@ -32,7 +32,9 @@
* @author José Fonseca <jrfonseca@tungstengraphics.com>
*/
-#ifdef WIN32
+#include "pipe/p_config.h"
+
+#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
#include <windows.h>
#include <winddi.h>
#else
@@ -47,7 +49,7 @@
#define DEBUG_MEMORY_MAGIC 0x6e34090aU
-#if defined(WIN32) && !defined(WINCE)
+#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) && !defined(WINCE)
#define real_malloc(_size) EngAllocMem(0, _size, 'D3AG')
#define real_free(_ptr) EngFreeMem(_ptr)
#else
diff --git a/src/gallium/auxiliary/util/p_tile.c b/src/gallium/auxiliary/util/p_tile.c
index 520da5cecd..91283a9ab0 100644
--- a/src/gallium/auxiliary/util/p_tile.c
+++ b/src/gallium/auxiliary/util/p_tile.c
@@ -169,6 +169,52 @@ a8r8g8b8_put_tile_rgba(unsigned *dst,
}
+/*** PIPE_FORMAT_A8R8G8B8_UNORM ***/
+
+static void
+x8r8g8b8_get_tile_rgba(unsigned *src,
+ unsigned w, unsigned h,
+ float *p,
+ unsigned dst_stride)
+{
+ unsigned i, j;
+
+ for (i = 0; i < h; i++) {
+ float *pRow = p;
+ for (j = 0; j < w; j++, pRow += 4) {
+ const unsigned pixel = *src++;
+ pRow[0] = UBYTE_TO_FLOAT((pixel >> 16) & 0xff);
+ pRow[1] = UBYTE_TO_FLOAT((pixel >> 8) & 0xff);
+ pRow[2] = UBYTE_TO_FLOAT((pixel >> 0) & 0xff);
+ pRow[3] = UBYTE_TO_FLOAT(0xff);
+ }
+ p += dst_stride;
+ }
+}
+
+
+static void
+x8r8g8b8_put_tile_rgba(unsigned *dst,
+ unsigned w, unsigned h,
+ const float *p,
+ unsigned src_stride)
+{
+ unsigned i, j;
+
+ for (i = 0; i < h; i++) {
+ const float *pRow = p;
+ for (j = 0; j < w; j++, pRow += 4) {
+ unsigned r, g, b;
+ UNCLAMPED_FLOAT_TO_UBYTE(r, pRow[0]);
+ UNCLAMPED_FLOAT_TO_UBYTE(g, pRow[1]);
+ UNCLAMPED_FLOAT_TO_UBYTE(b, pRow[2]);
+ *dst++ = (0xff << 24) | (r << 16) | (g << 8) | b;
+ }
+ p += src_stride;
+ }
+}
+
+
/*** PIPE_FORMAT_B8G8R8A8_UNORM ***/
static void
@@ -647,6 +693,9 @@ pipe_get_tile_rgba(struct pipe_context *pipe,
case PIPE_FORMAT_A8R8G8B8_UNORM:
a8r8g8b8_get_tile_rgba((unsigned *) packed, w, h, p, dst_stride);
break;
+ case PIPE_FORMAT_X8R8G8B8_UNORM:
+ x8r8g8b8_get_tile_rgba((unsigned *) packed, w, h, p, dst_stride);
+ break;
case PIPE_FORMAT_B8G8R8A8_UNORM:
b8g8r8a8_get_tile_rgba((unsigned *) packed, w, h, p, dst_stride);
break;
@@ -723,6 +772,9 @@ pipe_put_tile_rgba(struct pipe_context *pipe,
case PIPE_FORMAT_A8R8G8B8_UNORM:
a8r8g8b8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);
break;
+ case PIPE_FORMAT_X8R8G8B8_UNORM:
+ x8r8g8b8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);
+ break;
case PIPE_FORMAT_B8G8R8A8_UNORM:
b8g8r8a8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);
break;
diff --git a/src/gallium/auxiliary/util/u_blit.h b/src/gallium/auxiliary/util/u_blit.h
index 61f1d9bb32..0ce9732e62 100644
--- a/src/gallium/auxiliary/util/u_blit.h
+++ b/src/gallium/auxiliary/util/u_blit.h
@@ -30,7 +30,11 @@
#define U_BLIT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct pipe_context;
struct pipe_surface;
struct cso_context;
@@ -58,4 +62,8 @@ util_blit_pixels(struct blit_state *ctx,
float z, uint filter);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index dfdb5f16fe..b8dc6c66c0 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -475,7 +475,9 @@ format_to_type_comps(enum pipe_format pformat,
{
switch (pformat) {
case PIPE_FORMAT_A8R8G8B8_UNORM:
+ case PIPE_FORMAT_X8R8G8B8_UNORM:
case PIPE_FORMAT_B8G8R8A8_UNORM:
+ case PIPE_FORMAT_B8G8R8X8_UNORM:
*datatype = UBYTE;
*comps = 4;
return;
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.h b/src/gallium/auxiliary/util/u_gen_mipmap.h
index bd9af54fb7..3277024f07 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.h
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.h
@@ -31,6 +31,11 @@
#include "pipe/p_state.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
struct pipe_context;
struct pipe_texture;
struct cso_context;
@@ -52,4 +57,9 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
struct pipe_texture *pt,
uint face, uint baseLevel, uint lastLevel, uint filter);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h
index 1f6604c554..50ef44992b 100644
--- a/src/gallium/auxiliary/util/u_pack_color.h
+++ b/src/gallium/auxiliary/util/u_pack_color.h
@@ -53,18 +53,36 @@ util_pack_color_ub(ubyte r, ubyte g, ubyte b, ubyte a,
*d = (r << 24) | (g << 16) | (b << 8) | a;
}
return;
+ case PIPE_FORMAT_R8G8B8X8_UNORM:
+ {
+ uint *d = (uint *) dest;
+ *d = (r << 24) | (g << 16) | (b << 8) | 0xff;
+ }
+ return;
case PIPE_FORMAT_A8R8G8B8_UNORM:
{
uint *d = (uint *) dest;
*d = (a << 24) | (r << 16) | (g << 8) | b;
}
return;
+ case PIPE_FORMAT_X8R8G8B8_UNORM:
+ {
+ uint *d = (uint *) dest;
+ *d = (0xff << 24) | (r << 16) | (g << 8) | b;
+ }
+ return;
case PIPE_FORMAT_B8G8R8A8_UNORM:
{
uint *d = (uint *) dest;
*d = (b << 24) | (g << 16) | (r << 8) | a;
}
return;
+ case PIPE_FORMAT_B8G8R8X8_UNORM:
+ {
+ uint *d = (uint *) dest;
+ *d = (b << 24) | (g << 16) | (r << 8) | 0xff;
+ }
+ return;
case PIPE_FORMAT_R5G6B5_UNORM:
{
ushort *d = (ushort *) dest;
@@ -101,18 +119,36 @@ util_pack_color(const float rgba[4], enum pipe_format format, void *dest)
*d = (r << 24) | (g << 16) | (b << 8) | a;
}
return;
+ case PIPE_FORMAT_R8G8B8X8_UNORM:
+ {
+ uint *d = (uint *) dest;
+ *d = (r << 24) | (g << 16) | (b << 8) | 0xff;
+ }
+ return;
case PIPE_FORMAT_A8R8G8B8_UNORM:
{
uint *d = (uint *) dest;
*d = (a << 24) | (r << 16) | (g << 8) | b;
}
return;
+ case PIPE_FORMAT_X8R8G8B8_UNORM:
+ {
+ uint *d = (uint *) dest;
+ *d = (0xff << 24) | (r << 16) | (g << 8) | b;
+ }
+ return;
case PIPE_FORMAT_B8G8R8A8_UNORM:
{
uint *d = (uint *) dest;
*d = (b << 24) | (g << 16) | (r << 8) | a;
}
return;
+ case PIPE_FORMAT_B8G8R8X8_UNORM:
+ {
+ uint *d = (uint *) dest;
+ *d = (b << 24) | (g << 16) | (r << 8) | 0xff;
+ }
+ return;
case PIPE_FORMAT_R5G6B5_UNORM:
{
ushort *d = (ushort *) dest;
@@ -159,8 +195,10 @@ util_pack_z(enum pipe_format format, double z)
else
return (uint) (z * 0xffffffff);
case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_X8Z24_UNORM:
return (uint) (z * 0xffffff);
case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24X8_UNORM:
return ((uint) (z * 0xffffff)) << 8;
default:
debug_printf("gallium: unhandled fomrat in util_pack_z()");
diff --git a/src/gallium/auxiliary/util/u_time.c b/src/gallium/auxiliary/util/u_time.c
index 01112ebe5a..dd28ff4134 100644
--- a/src/gallium/auxiliary/util/u_time.c
+++ b/src/gallium/auxiliary/util/u_time.c
@@ -33,27 +33,35 @@
*/
-#ifndef WIN32
+#include "util/u_time.h"
+
+#if defined(PIPE_OS_LINUX)
#include <sys/time.h>
-#else
+#elif defined(PIPE_OS_WINDOWS)
#include <windows.h>
+#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
#include <winddi.h>
#endif
-
-#include "util/u_time.h"
+#else
+#error Unsupported OS
+#endif
-#ifdef WIN32
+#if defined(PIPE_OS_WINDOWS)
static LONGLONG frequency = 0;
+#if !defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
+#define EngQueryPerformanceFrequency(p) QueryPerformanceFrequency((LARGE_INTEGER*)(p))
+#define EngQueryPerformanceCounter(p) QueryPerformanceCounter((LARGE_INTEGER*)(p))
+#endif
#endif
void
util_time_get(struct util_time *t)
{
-#ifndef WIN32
+#if defined(PIPE_OS_LINUX)
gettimeofday(&t->tv, NULL);
-#else
+#elif defined(PIPE_OS_WINDOWS)
EngQueryPerformanceCounter(&t->counter);
#endif
}
@@ -64,10 +72,10 @@ util_time_add(const struct util_time *t1,
int64_t usecs,
struct util_time *t2)
{
-#ifndef WIN32
+#if defined(PIPE_OS_LINUX)
t2->tv.tv_sec = t1->tv.tv_sec + usecs / 1000000;
t2->tv.tv_usec = t1->tv.tv_usec + usecs % 1000000;
-#else
+#elif defined(PIPE_OS_WINDOWS)
if(!frequency)
EngQueryPerformanceFrequency(&frequency);
t2->counter = t1->counter + (usecs * frequency + 999999LL)/1000000LL;
@@ -79,10 +87,12 @@ int64_t
util_time_diff(const struct util_time *t1,
const struct util_time *t2)
{
-#ifndef WIN32
+#if defined(PIPE_OS_LINUX)
return (t2->tv.tv_usec - t1->tv.tv_usec) +
(t2->tv.tv_sec - t1->tv.tv_sec)*1000000;
-#else
+#elif defined(PIPE_OS_WINDOWS)
+ if(!frequency)
+ EngQueryPerformanceFrequency(&frequency);
return (t2->counter - t1->counter)*1000000LL/frequency;
#endif
}
@@ -98,7 +108,7 @@ static INLINE int
util_time_compare(const struct util_time *t1,
const struct util_time *t2)
{
-#ifndef WIN32
+#if defined(PIPE_OS_LINUX)
if (t1->tv.tv_sec < t2->tv.tv_sec)
return -1;
else if(t1->tv.tv_sec > t2->tv.tv_sec)
@@ -109,7 +119,7 @@ util_time_compare(const struct util_time *t1,
return 1;
else
return 0;
-#else
+#elif defined(PIPE_OS_WINDOWS)
if (t1->counter < t2->counter)
return -1;
else if(t1->counter > t2->counter)
@@ -132,7 +142,7 @@ util_time_timeout(const struct util_time *start,
}
-#ifdef WIN32
+#if defined(PIPE_OS_WINDOWS)
void util_time_sleep(unsigned usecs)
{
LONGLONG start, curr, end;
diff --git a/src/gallium/auxiliary/util/u_time.h b/src/gallium/auxiliary/util/u_time.h
index c8836c137f..48ec7a4a96 100644
--- a/src/gallium/auxiliary/util/u_time.h
+++ b/src/gallium/auxiliary/util/u_time.h
@@ -36,7 +36,9 @@
#define U_TIME_H_
-#ifndef WIN32
+#include "pipe/p_config.h"
+
+#if defined(PIPE_OS_LINUX)
#include <time.h> /* timeval */
#include <unistd.h> /* usleep */
#endif
@@ -56,7 +58,7 @@ extern "C" {
*/
struct util_time
{
-#ifndef WIN32
+#if defined(PIPE_OS_LINUX)
struct timeval tv;
#else
long long counter;
@@ -84,7 +86,7 @@ util_time_timeout(const struct util_time *start,
const struct util_time *end,
const struct util_time *curr);
-#ifndef WIN32
+#if defined(PIPE_OS_LINUX)
#define util_time_sleep usleep
#else
void
diff --git a/src/gallium/drivers/i915simple/i915_state.c b/src/gallium/drivers/i915simple/i915_state.c
index 24d31ad740..3d94b52366 100644
--- a/src/gallium/drivers/i915simple/i915_state.c
+++ b/src/gallium/drivers/i915simple/i915_state.c
@@ -549,6 +549,9 @@ static void i915_set_sampler_textures(struct pipe_context *pipe,
!memcmp(i915->texture, texture, num * sizeof(struct pipe_texture *)))
return;
+ /* Fixes wrong texture in texobj with VBUF */
+ draw_flush(i915->draw);
+
for (i = 0; i < num; i++)
pipe_texture_reference((struct pipe_texture **) &i915->texture[i],
texture[i]);
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c
index 200fb415ac..f2ce0fdc6e 100644
--- a/src/gallium/drivers/softpipe/sp_context.c
+++ b/src/gallium/drivers/softpipe/sp_context.c
@@ -178,6 +178,8 @@ softpipe_create( struct pipe_screen *screen,
softpipe->pipe.draw_arrays = softpipe_draw_arrays;
softpipe->pipe.draw_elements = softpipe_draw_elements;
+ softpipe->pipe.set_edgeflags = softpipe_set_edgeflags;
+
softpipe->pipe.clear = softpipe_clear;
softpipe->pipe.flush = softpipe_flush;
diff --git a/src/gallium/drivers/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c
index 778291dded..6c58f9909d 100644
--- a/src/gallium/drivers/softpipe/sp_draw_arrays.c
+++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c
@@ -170,3 +170,12 @@ softpipe_draw_elements(struct pipe_context *pipe,
return TRUE;
}
+
+
+void
+softpipe_set_edgeflags(struct pipe_context *pipe, const unsigned *edgeflags)
+{
+ struct softpipe_context *sp = softpipe_context(pipe);
+ draw_set_edgeflags(sp->draw, edgeflags);
+}
+
diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c
index 802472df45..74c6bff84a 100644
--- a/src/gallium/drivers/softpipe/sp_quad_blend.c
+++ b/src/gallium/drivers/softpipe/sp_quad_blend.c
@@ -232,6 +232,11 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
struct softpipe_context *softpipe = qs->softpipe;
uint cbuf;
+ if (softpipe->blend->logicop_enable) {
+ logicop_quad(qs, quad);
+ return;
+ }
+
/* loop over colorbuffer outputs */
for (cbuf = 0; cbuf < softpipe->framebuffer.num_cbufs; cbuf++) {
float source[4][QUAD_SIZE], dest[4][QUAD_SIZE];
@@ -242,11 +247,6 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
float (*quadColor)[4] = quad->outputs.color[cbuf];
uint i, j;
- if (softpipe->blend->logicop_enable) {
- logicop_quad(qs, quad);
- return;
- }
-
/* get/swizzle dest colors */
for (j = 0; j < QUAD_SIZE; j++) {
int x = (quad->x0 & (TILE_SIZE-1)) + (j & 1);
@@ -294,11 +294,12 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE:
{
const float *alpha = quadColor[3];
- float diff[4];
+ float diff[4], temp[4];
VEC4_SUB(diff, one, dest[3]);
- VEC4_MIN(source[0], alpha, diff); /* R */
- VEC4_MIN(source[1], alpha, diff); /* G */
- VEC4_MIN(source[2], alpha, diff); /* B */
+ VEC4_MIN(temp, alpha, diff);
+ VEC4_MUL(source[0], quadColor[0], temp); /* R */
+ VEC4_MUL(source[1], quadColor[1], temp); /* G */
+ VEC4_MUL(source[2], quadColor[2], temp); /* B */
}
break;
case PIPE_BLENDFACTOR_CONST_COLOR:
@@ -426,12 +427,8 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
VEC4_MUL(source[3], quadColor[3], dest[3]); /* A */
break;
case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE:
- {
- const float *alpha = quadColor[3];
- float diff[4];
- VEC4_SUB(diff, one, dest[3]);
- VEC4_MIN(source[3], alpha, diff); /* A */
- }
+ /* multiply alpha by 1.0 */
+ VEC4_COPY(source[3], quadColor[3]); /* A */
break;
case PIPE_BLENDFACTOR_CONST_COLOR:
/* fall-through */
diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c
index 7df8fc5f67..df7be01fcd 100644
--- a/src/gallium/drivers/softpipe/sp_setup.c
+++ b/src/gallium/drivers/softpipe/sp_setup.c
@@ -719,6 +719,13 @@ void setup_tri( struct setup_context *setup,
{
float det = calc_det(v0, v1, v2);
+#if DEBUG_VERTS
+ debug_printf("Setup triangle:\n");
+ print_vertex(setup, v0);
+ print_vertex(setup, v1);
+ print_vertex(setup, v2);
+#endif
+
if (setup->softpipe->no_rast)
return;
@@ -731,13 +738,6 @@ void setup_tri( struct setup_context *setup,
setup->numFragsWritten = 0;
#endif
-#if DEBUG_VERTS
- debug_printf("Triangle:\n");
- print_vertex(setup, v0);
- print_vertex(setup, v1);
- print_vertex(setup, v2);
-#endif
-
if (cull_tri( setup, det ))
return;
@@ -935,6 +935,12 @@ setup_line(struct setup_context *setup,
int dy = y1 - y0;
int xstep, ystep;
+#if DEBUG_VERTS
+ debug_printf("Setup line:\n");
+ print_vertex(setup, v0);
+ print_vertex(setup, v1);
+#endif
+
if (setup->softpipe->no_rast)
return;
@@ -1056,6 +1062,10 @@ setup_point( struct setup_context *setup,
const struct vertex_info *vinfo = softpipe_get_vertex_info(softpipe);
uint fragSlot;
+#if DEBUG_VERTS
+ debug_printf("Setup point:\n");
+ print_vertex(setup, v0);
+#endif
if (softpipe->no_rast)
return;
diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h
index 6e6501f5bc..45056502b8 100644
--- a/src/gallium/drivers/softpipe/sp_state.h
+++ b/src/gallium/drivers/softpipe/sp_state.h
@@ -171,6 +171,9 @@ boolean softpipe_draw_elements(struct pipe_context *pipe,
unsigned indexSize,
unsigned mode, unsigned start, unsigned count);
+void
+softpipe_set_edgeflags(struct pipe_context *pipe, const unsigned *edgeflags);
+
void
softpipe_map_surfaces(struct softpipe_context *sp);
diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index 91f3d2ac2d..a4b772bc4f 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -29,6 +29,8 @@
#define P_COMPILER_H
+#include "p_config.h"
+
#include <stdlib.h>
#include <string.h>
diff --git a/src/gallium/include/pipe/p_config.h b/src/gallium/include/pipe/p_config.h
new file mode 100644
index 0000000000..e44fafeae9
--- /dev/null
+++ b/src/gallium/include/pipe/p_config.h
@@ -0,0 +1,112 @@
+/**************************************************************************
+ *
+ * Copyright 2008 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.
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ * Gallium configuration defines.
+ *
+ * This header file sets several defines based on the compiler, processor
+ * architecture, and operating system being used. These defines should be used
+ * throughout the code to facilitate porting to new platforms. It is likely that
+ * this file is auto-generated by an autoconf-like tool at some point, as some
+ * things cannot be determined by existing defines alone.
+ *
+ * @author José Fonseca <jrfonseca@tungstengraphics.com>
+ */
+
+#ifndef P_CONFIG_H_
+#define P_CONFIG_H_
+
+
+/*
+ * Compiler
+ */
+
+#if defined(__GNUC__)
+#define PIPE_CC_GCC
+#endif
+
+#if defined(_MSC_VER) || defined(__MSC__)
+#define PIPE_CC_MSVC
+#endif
+
+#if defined(__ICL)
+#define PIPE_CC_ICL
+#endif
+
+
+/*
+ * Processor architecture
+ */
+
+#if defined(_X86_) || defined(__i386__) || defined(__386__) || defined(i386)
+#define PIPE_ARCH_X86
+#endif
+
+#if 0 /* FIXME */
+#define PIPE_ARCH_X86_64
+#endif
+
+#if 0 /* FIXME */
+#define PIPE_ARCH_PPC
+#endif
+
+
+/*
+ * Operating system
+ */
+
+#if defined(__linux__)
+#define PIPE_OS_LINUX
+#endif
+
+#if defined(_WIN32) || defined(WIN32)
+#define PIPE_OS_WINDOWS
+#endif
+
+
+/*
+ * Subsystem
+ *
+ * XXX: There is no way to autodetect this.
+ */
+
+#if defined(PIPE_OS_LINUX)
+#define PIPE_SUBSYSTEM_DRI
+#endif
+
+#if defined(PIPE_OS_WINDOWS)
+#if !defined(PIPE_SUBSYSTEM_USER) && !defined(PIPE_SUBSYSTEM_KERNEL)
+#error Neither PIPE_SUBSYSTEM_USER or PIPE_SUBSYSTEM_KERNEL defined.
+#endif
+#if defined(PIPE_SUBSYSTEM_KERNEL)
+#define PIPE_SUBSYSTEM_WINDOWS_DISPLAY
+#endif
+#endif
+
+
+#endif /* P_CONFIG_H_ */
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index ef9e3a3d6c..94c2eeb62b 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -163,18 +163,21 @@ static INLINE uint pf_get(pipe_format_rgbazs_t f, uint shift, uint mask)
/**
* Shorthand macro for common format swizzles.
*/
-#define _PIPE_FORMAT_R000 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0 )
-#define _PIPE_FORMAT_RG00 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_G, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0 )
-#define _PIPE_FORMAT_RGB0 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_G, PIPE_FORMAT_COMP_B, PIPE_FORMAT_COMP_0 )
+#define _PIPE_FORMAT_R001 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_1 )
+#define _PIPE_FORMAT_RG01 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_G, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_1 )
+#define _PIPE_FORMAT_RGB1 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_G, PIPE_FORMAT_COMP_B, PIPE_FORMAT_COMP_1 )
#define _PIPE_FORMAT_RGBA _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_G, PIPE_FORMAT_COMP_B, PIPE_FORMAT_COMP_A )
#define _PIPE_FORMAT_ARGB _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_A, PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_G, PIPE_FORMAT_COMP_B )
#define _PIPE_FORMAT_BGRA _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_B, PIPE_FORMAT_COMP_G, PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_A )
+#define _PIPE_FORMAT_1RGB _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_1, PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_G, PIPE_FORMAT_COMP_B )
+#define _PIPE_FORMAT_BGR1 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_B, PIPE_FORMAT_COMP_G, PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_1 )
#define _PIPE_FORMAT_0000 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0 )
#define _PIPE_FORMAT_000R _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_R )
#define _PIPE_FORMAT_RRR1 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_1 )
#define _PIPE_FORMAT_RRRR _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_R )
#define _PIPE_FORMAT_RRRG _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_G )
#define _PIPE_FORMAT_Z000 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_Z, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0 )
+#define _PIPE_FORMAT_0Z00 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_Z, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0 )
#define _PIPE_FORMAT_SZ00 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_S, PIPE_FORMAT_COMP_Z, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0 )
#define _PIPE_FORMAT_ZS00 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_Z, PIPE_FORMAT_COMP_S, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0 )
#define _PIPE_FORMAT_S000 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_S, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0 )
@@ -229,12 +232,14 @@ static INLINE uint pf_rev(pipe_format_ycbcr_t f)
enum pipe_format {
PIPE_FORMAT_NONE = _PIPE_FORMAT_RGBAZS_1 ( _PIPE_FORMAT_0000, 0, 0, 0, 0, PIPE_FORMAT_TYPE_UNKNOWN ),
PIPE_FORMAT_A8R8G8B8_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_ARGB, 1, 1, 1, 1, PIPE_FORMAT_TYPE_UNORM ),
+ PIPE_FORMAT_X8R8G8B8_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_1RGB, 1, 1, 1, 1, PIPE_FORMAT_TYPE_UNORM ),
PIPE_FORMAT_B8G8R8A8_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_BGRA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_UNORM ),
+ PIPE_FORMAT_B8G8R8X8_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_BGR1, 1, 1, 1, 1, PIPE_FORMAT_TYPE_UNORM ),
PIPE_FORMAT_A1R5G5B5_UNORM = _PIPE_FORMAT_RGBAZS_1 ( _PIPE_FORMAT_ARGB, 1, 5, 5, 5, PIPE_FORMAT_TYPE_UNORM ),
PIPE_FORMAT_A4R4G4B4_UNORM = _PIPE_FORMAT_RGBAZS_1 ( _PIPE_FORMAT_ARGB, 4, 4, 4, 4, PIPE_FORMAT_TYPE_UNORM ),
- PIPE_FORMAT_R5G6B5_UNORM = _PIPE_FORMAT_RGBAZS_1 ( _PIPE_FORMAT_RGB0, 5, 6, 5, 0, PIPE_FORMAT_TYPE_UNORM ),
- PIPE_FORMAT_U_L8 = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RRR1, 1, 1, 1, 1, PIPE_FORMAT_TYPE_UNORM ), /**< ubyte luminance */
- PIPE_FORMAT_U_A8 = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_000R, 1, 1, 1, 1, PIPE_FORMAT_TYPE_UNORM ), /**< ubyte alpha */
+ PIPE_FORMAT_R5G6B5_UNORM = _PIPE_FORMAT_RGBAZS_1 ( _PIPE_FORMAT_RGB1, 5, 6, 5, 0, PIPE_FORMAT_TYPE_UNORM ),
+ PIPE_FORMAT_U_L8 = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RRR1, 1, 1, 1, 0, PIPE_FORMAT_TYPE_UNORM ), /**< ubyte luminance */
+ PIPE_FORMAT_U_A8 = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_000R, 0, 0, 0, 1, PIPE_FORMAT_TYPE_UNORM ), /**< ubyte alpha */
PIPE_FORMAT_U_I8 = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RRRR, 1, 1, 1, 1, PIPE_FORMAT_TYPE_UNORM ), /**< ubyte intensity */
PIPE_FORMAT_U_A8_L8 = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RRRG, 1, 1, 1, 1, PIPE_FORMAT_TYPE_UNORM ), /**< ubyte alpha, luminance */
PIPE_FORMAT_YCBCR = _PIPE_FORMAT_YCBCR( 0 ),
@@ -244,68 +249,75 @@ enum pipe_format {
PIPE_FORMAT_Z32_FLOAT = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_Z000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_FLOAT ),
PIPE_FORMAT_S8Z24_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_SZ00, 1, 3, 0, 0, PIPE_FORMAT_TYPE_UNORM ),
PIPE_FORMAT_Z24S8_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_ZS00, 3, 1, 0, 0, PIPE_FORMAT_TYPE_UNORM ),
+ PIPE_FORMAT_X8Z24_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_0Z00, 1, 3, 0, 0, PIPE_FORMAT_TYPE_UNORM ),
+ PIPE_FORMAT_Z24X8_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_Z000, 3, 1, 0, 0, PIPE_FORMAT_TYPE_UNORM ),
PIPE_FORMAT_S8_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_S000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ), /**< ubyte stencil */
- PIPE_FORMAT_R64_FLOAT = _PIPE_FORMAT_RGBAZS_64( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_FLOAT ),
- PIPE_FORMAT_R64G64_FLOAT = _PIPE_FORMAT_RGBAZS_64( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_FLOAT ),
- PIPE_FORMAT_R64G64B64_FLOAT = _PIPE_FORMAT_RGBAZS_64( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_FLOAT ),
+ PIPE_FORMAT_R64_FLOAT = _PIPE_FORMAT_RGBAZS_64( _PIPE_FORMAT_R001, 1, 0, 0, 0, PIPE_FORMAT_TYPE_FLOAT ),
+ PIPE_FORMAT_R64G64_FLOAT = _PIPE_FORMAT_RGBAZS_64( _PIPE_FORMAT_RG01, 1, 1, 0, 0, PIPE_FORMAT_TYPE_FLOAT ),
+ PIPE_FORMAT_R64G64B64_FLOAT = _PIPE_FORMAT_RGBAZS_64( _PIPE_FORMAT_RGB1, 1, 1, 1, 0, PIPE_FORMAT_TYPE_FLOAT ),
PIPE_FORMAT_R64G64B64A64_FLOAT = _PIPE_FORMAT_RGBAZS_64( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_FLOAT ),
- PIPE_FORMAT_R32_FLOAT = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_FLOAT ),
- PIPE_FORMAT_R32G32_FLOAT = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_FLOAT ),
- PIPE_FORMAT_R32G32B32_FLOAT = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_FLOAT ),
+ PIPE_FORMAT_R32_FLOAT = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R001, 4, 0, 0, 0, PIPE_FORMAT_TYPE_FLOAT ),
+ PIPE_FORMAT_R32G32_FLOAT = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG01, 4, 4, 0, 0, PIPE_FORMAT_TYPE_FLOAT ),
+ PIPE_FORMAT_R32G32B32_FLOAT = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 4, 4, 4, 0, PIPE_FORMAT_TYPE_FLOAT ),
PIPE_FORMAT_R32G32B32A32_FLOAT = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_FLOAT ),
- PIPE_FORMAT_R32_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ),
- PIPE_FORMAT_R32G32_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_UNORM ),
- PIPE_FORMAT_R32G32B32_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_UNORM ),
+ PIPE_FORMAT_R32_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R001, 4, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ),
+ PIPE_FORMAT_R32G32_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG01, 4, 4, 0, 0, PIPE_FORMAT_TYPE_UNORM ),
+ PIPE_FORMAT_R32G32B32_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 4, 4, 4, 0, PIPE_FORMAT_TYPE_UNORM ),
PIPE_FORMAT_R32G32B32A32_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_UNORM ),
- PIPE_FORMAT_R32_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_USCALED ),
- PIPE_FORMAT_R32G32_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_USCALED ),
- PIPE_FORMAT_R32G32B32_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_USCALED ),
+ PIPE_FORMAT_R32_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R001, 4, 0, 0, 0, PIPE_FORMAT_TYPE_USCALED ),
+ PIPE_FORMAT_R32G32_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG01, 4, 4, 0, 0, PIPE_FORMAT_TYPE_USCALED ),
+ PIPE_FORMAT_R32G32B32_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 4, 4, 4, 0, PIPE_FORMAT_TYPE_USCALED ),
PIPE_FORMAT_R32G32B32A32_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_USCALED ),
- PIPE_FORMAT_R32_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_SNORM ),
- PIPE_FORMAT_R32G32_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_SNORM ),
- PIPE_FORMAT_R32G32B32_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_SNORM ),
+ PIPE_FORMAT_R32_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R001, 4, 0, 0, 0, PIPE_FORMAT_TYPE_SNORM ),
+ PIPE_FORMAT_R32G32_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG01, 4, 4, 0, 0, PIPE_FORMAT_TYPE_SNORM ),
+ PIPE_FORMAT_R32G32B32_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 4, 4, 4, 0, PIPE_FORMAT_TYPE_SNORM ),
PIPE_FORMAT_R32G32B32A32_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_SNORM ),
- PIPE_FORMAT_R32_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_SSCALED ),
- PIPE_FORMAT_R32G32_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_SSCALED ),
- PIPE_FORMAT_R32G32B32_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_SSCALED ),
+ PIPE_FORMAT_R32_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R001, 4, 0, 0, 0, PIPE_FORMAT_TYPE_SSCALED ),
+ PIPE_FORMAT_R32G32_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG01, 4, 4, 0, 0, PIPE_FORMAT_TYPE_SSCALED ),
+ PIPE_FORMAT_R32G32B32_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 4, 4, 4, 0, PIPE_FORMAT_TYPE_SSCALED ),
PIPE_FORMAT_R32G32B32A32_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_SSCALED ),
- PIPE_FORMAT_R16_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ),
- PIPE_FORMAT_R16G16_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 2, 2, 0, 0, PIPE_FORMAT_TYPE_UNORM ),
- PIPE_FORMAT_R16G16B16_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 2, 2, 2, 0, PIPE_FORMAT_TYPE_UNORM ),
+ PIPE_FORMAT_R16_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R001, 2, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ),
+ PIPE_FORMAT_R16G16_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG01, 2, 2, 0, 0, PIPE_FORMAT_TYPE_UNORM ),
+ PIPE_FORMAT_R16G16B16_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 2, 2, 2, 0, PIPE_FORMAT_TYPE_UNORM ),
PIPE_FORMAT_R16G16B16A16_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 2, 2, 2, 2, PIPE_FORMAT_TYPE_UNORM ),
- PIPE_FORMAT_R16_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_USCALED ),
- PIPE_FORMAT_R16G16_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 2, 2, 0, 0, PIPE_FORMAT_TYPE_USCALED ),
- PIPE_FORMAT_R16G16B16_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 2, 2, 2, 0, PIPE_FORMAT_TYPE_USCALED ),
+ PIPE_FORMAT_R16_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R001, 2, 0, 0, 0, PIPE_FORMAT_TYPE_USCALED ),
+ PIPE_FORMAT_R16G16_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG01, 2, 2, 0, 0, PIPE_FORMAT_TYPE_USCALED ),
+ PIPE_FORMAT_R16G16B16_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 2, 2, 2, 0, PIPE_FORMAT_TYPE_USCALED ),
PIPE_FORMAT_R16G16B16A16_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 2, 2, 2, 2, PIPE_FORMAT_TYPE_USCALED ),
- PIPE_FORMAT_R16_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_SNORM ),
- PIPE_FORMAT_R16G16_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 2, 2, 0, 0, PIPE_FORMAT_TYPE_SNORM ),
- PIPE_FORMAT_R16G16B16_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 2, 2, 2, 0, PIPE_FORMAT_TYPE_SNORM ),
+ PIPE_FORMAT_R16_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R001, 2, 0, 0, 0, PIPE_FORMAT_TYPE_SNORM ),
+ PIPE_FORMAT_R16G16_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG01, 2, 2, 0, 0, PIPE_FORMAT_TYPE_SNORM ),
+ PIPE_FORMAT_R16G16B16_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 2, 2, 2, 0, PIPE_FORMAT_TYPE_SNORM ),
PIPE_FORMAT_R16G16B16A16_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 2, 2, 2, 2, PIPE_FORMAT_TYPE_SNORM ),
- PIPE_FORMAT_R16_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_SSCALED ),
- PIPE_FORMAT_R16G16_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 2, 2, 0, 0, PIPE_FORMAT_TYPE_SSCALED ),
- PIPE_FORMAT_R16G16B16_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 2, 2, 2, 0, PIPE_FORMAT_TYPE_SSCALED ),
+ PIPE_FORMAT_R16_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R001, 2, 0, 0, 0, PIPE_FORMAT_TYPE_SSCALED ),
+ PIPE_FORMAT_R16G16_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG01, 2, 2, 0, 0, PIPE_FORMAT_TYPE_SSCALED ),
+ PIPE_FORMAT_R16G16B16_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 2, 2, 2, 0, PIPE_FORMAT_TYPE_SSCALED ),
PIPE_FORMAT_R16G16B16A16_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 2, 2, 2, 2, PIPE_FORMAT_TYPE_SSCALED ),
- PIPE_FORMAT_R8_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ),
- PIPE_FORMAT_R8G8_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_UNORM ),
- PIPE_FORMAT_R8G8B8_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_UNORM ),
+ PIPE_FORMAT_R8_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R001, 1, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ),
+ PIPE_FORMAT_R8G8_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG01, 1, 1, 0, 0, PIPE_FORMAT_TYPE_UNORM ),
+ PIPE_FORMAT_R8G8B8_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 1, 1, 1, 0, PIPE_FORMAT_TYPE_UNORM ),
PIPE_FORMAT_R8G8B8A8_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_UNORM ),
- PIPE_FORMAT_R8_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_USCALED ),
- PIPE_FORMAT_R8G8_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_USCALED ),
- PIPE_FORMAT_R8G8B8_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_USCALED ),
+ PIPE_FORMAT_R8G8B8X8_UNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 1, 1, 1, 1, PIPE_FORMAT_TYPE_UNORM ),
+ PIPE_FORMAT_R8_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R001, 1, 0, 0, 0, PIPE_FORMAT_TYPE_USCALED ),
+ PIPE_FORMAT_R8G8_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG01, 1, 1, 0, 0, PIPE_FORMAT_TYPE_USCALED ),
+ PIPE_FORMAT_R8G8B8_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 1, 1, 1, 0, PIPE_FORMAT_TYPE_USCALED ),
PIPE_FORMAT_R8G8B8A8_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_USCALED ),
- PIPE_FORMAT_R8_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_SNORM ),
- PIPE_FORMAT_R8G8_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_SNORM ),
- PIPE_FORMAT_R8G8B8_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_SNORM ),
+ PIPE_FORMAT_R8G8B8X8_USCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 1, 1, 1, 1, PIPE_FORMAT_TYPE_USCALED ),
+ PIPE_FORMAT_R8_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R001, 1, 0, 0, 0, PIPE_FORMAT_TYPE_SNORM ),
+ PIPE_FORMAT_R8G8_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG01, 1, 1, 0, 0, PIPE_FORMAT_TYPE_SNORM ),
+ PIPE_FORMAT_R8G8B8_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 1, 1, 1, 0, PIPE_FORMAT_TYPE_SNORM ),
PIPE_FORMAT_R8G8B8A8_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_SNORM ),
- PIPE_FORMAT_R8_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_SSCALED ),
- PIPE_FORMAT_R8G8_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_SSCALED ),
- PIPE_FORMAT_R8G8B8_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_SSCALED ),
+ PIPE_FORMAT_R8G8B8X8_SNORM = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 1, 1, 1, 1, PIPE_FORMAT_TYPE_SNORM ),
+ PIPE_FORMAT_R8_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R001, 1, 0, 0, 0, PIPE_FORMAT_TYPE_SSCALED ),
+ PIPE_FORMAT_R8G8_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG01, 1, 1, 0, 0, PIPE_FORMAT_TYPE_SSCALED ),
+ PIPE_FORMAT_R8G8B8_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 1, 1, 1, 0, PIPE_FORMAT_TYPE_SSCALED ),
PIPE_FORMAT_R8G8B8A8_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_SSCALED ),
+ PIPE_FORMAT_R8G8B8X8_SSCALED = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 1, 1, 1, 1, PIPE_FORMAT_TYPE_SSCALED ),
/* sRGB formats */
- PIPE_FORMAT_L8_SRGB = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RRR1, 1, 1, 1, 1, PIPE_FORMAT_TYPE_SRGB ),
+ PIPE_FORMAT_L8_SRGB = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RRR1, 1, 1, 1, 0, PIPE_FORMAT_TYPE_SRGB ),
PIPE_FORMAT_A8_L8_SRGB = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RRRG, 1, 1, 1, 1, PIPE_FORMAT_TYPE_SRGB ),
- PIPE_FORMAT_R8G8B8_SRGB = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_SRGB ),
+ PIPE_FORMAT_R8G8B8_SRGB = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 1, 1, 1, 0, PIPE_FORMAT_TYPE_SRGB ),
PIPE_FORMAT_R8G8B8A8_SRGB = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_SRGB ),
+ PIPE_FORMAT_R8G8B8X8_SRGB = _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB1, 1, 1, 1, 1, PIPE_FORMAT_TYPE_SRGB ),
/* compressed formats */
PIPE_FORMAT_DXT1_RGB = _PIPE_FORMAT_DXT( 1, 8, 8, 8, 0 ),
@@ -442,6 +454,8 @@ static INLINE uint pf_get_bits( enum pipe_format format )
switch (pf_layout(format)) {
case PIPE_FORMAT_LAYOUT_RGBAZS:
return
+ pf_get_component_bits( format, PIPE_FORMAT_COMP_0 ) +
+ pf_get_component_bits( format, PIPE_FORMAT_COMP_1 ) +
pf_get_component_bits( format, PIPE_FORMAT_COMP_R ) +
pf_get_component_bits( format, PIPE_FORMAT_COMP_G ) +
pf_get_component_bits( format, PIPE_FORMAT_COMP_B ) +
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index 35bd46d691..26ac99d287 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -58,25 +58,33 @@ struct pipe_screen {
void (*destroy)( struct pipe_screen * );
- /*
- * Capability queries
- */
const char *(*get_name)( struct pipe_screen * );
const char *(*get_vendor)( struct pipe_screen * );
+ /**
+ * Query an integer-valued capability/parameter/limit
+ * \param param one of PIPE_CAP_x
+ */
int (*get_param)( struct pipe_screen *, int param );
+ /**
+ * Query a float-valued capability/parameter/limit
+ * \param param one of PIPE_CAP_x
+ */
float (*get_paramf)( struct pipe_screen *, int param );
- /**< type is one of PIPE_TEXTURE, PIPE_SURFACE */
+ /**
+ * Check if the given pipe_format is supported as a texture or
+ * drawing surface.
+ * \param type one of PIPE_TEXTURE, PIPE_SURFACE
+ */
boolean (*is_format_supported)( struct pipe_screen *,
enum pipe_format format,
uint type );
-
- /*
- * Texture functions
+ /**
+ * Create a new texture object, using the given template info.
*/
struct pipe_texture * (*texture_create)(struct pipe_screen *,
const struct pipe_texture *templat);
diff --git a/src/gallium/include/pipe/p_util.h b/src/gallium/include/pipe/p_util.h
index 43d94ec4ba..63301ae3aa 100644
--- a/src/gallium/include/pipe/p_util.h
+++ b/src/gallium/include/pipe/p_util.h
@@ -28,6 +28,7 @@
#ifndef P_UTIL_H
#define P_UTIL_H
+#include "p_config.h"
#include "p_compiler.h"
#include "p_debug.h"
#include "p_pointer.h"
@@ -40,7 +41,7 @@ extern "C" {
#endif
-#if defined(WIN32) && defined(DEBUG) /* memory debugging */
+#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) && defined(DEBUG) /* memory debugging */
#include "p_debug.h"
@@ -55,7 +56,7 @@ extern "C" {
#else
-#ifdef WIN32
+#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
void * __stdcall
EngAllocMem(
@@ -118,7 +119,7 @@ REALLOC( void *old_ptr, unsigned old_size, unsigned new_size )
return new_ptr;
}
-#else /* !WIN32 */
+#else /* !PIPE_SUBSYSTEM_WINDOWS_DISPLAY */
#define MALLOC( SIZE ) malloc( SIZE )
@@ -128,7 +129,7 @@ REALLOC( void *old_ptr, unsigned old_size, unsigned new_size )
#define REALLOC( OLDPTR, OLDSIZE, NEWSIZE ) realloc( OLDPTR, NEWSIZE )
-#endif /* !WIN32 */
+#endif /* !PIPE_SUBSYSTEM_WINDOWS_DISPLAY */
#endif /* !DEBUG */
#define MALLOC_STRUCT(T) (struct T *) MALLOC(sizeof(struct T))
diff --git a/src/gallium/include/pipe/p_winsys.h b/src/gallium/include/pipe/p_winsys.h
index bf5aad7351..3005ec2d94 100644
--- a/src/gallium/include/pipe/p_winsys.h
+++ b/src/gallium/include/pipe/p_winsys.h
@@ -63,13 +63,13 @@ struct pipe_surface;
struct pipe_winsys
{
/** Returns name of this winsys interface */
- const char *(*get_name)( struct pipe_winsys *sws );
+ const char *(*get_name)( struct pipe_winsys *ws );
/**
* Do any special operations to ensure frontbuffer contents are
* displayed, eg copy fake frontbuffer.
*/
- void (*flush_frontbuffer)( struct pipe_winsys *sws,
+ void (*flush_frontbuffer)( struct pipe_winsys *ws,
struct pipe_surface *surf,
void *context_private );
@@ -79,8 +79,8 @@ struct pipe_winsys
/**
* Allocate storage for a pipe_surface.
- * Returns 0 if succeeds.
- * XXX: flags is unused and will be removed someday.
+ * \param flags XXX unused, remove someday
+ * \return 0 if succeeds.
*/
int (*surface_alloc_storage)(struct pipe_winsys *ws,
struct pipe_surface *surf,
@@ -105,7 +105,7 @@ struct pipe_winsys
* alignment indicates the client's alignment requirements, eg for
* SSE instructions.
*/
- struct pipe_buffer *(*buffer_create)( struct pipe_winsys *sws,
+ struct pipe_buffer *(*buffer_create)( struct pipe_winsys *ws,
unsigned alignment,
unsigned usage,
unsigned size );
@@ -131,7 +131,7 @@ struct pipe_winsys
* Note that ptr may be accessed at any time upto the time when the
* buffer is destroyed, so the data must not be freed before then.
*/
- struct pipe_buffer *(*user_buffer_create)(struct pipe_winsys *sws,
+ struct pipe_buffer *(*user_buffer_create)(struct pipe_winsys *ws,
void *ptr,
unsigned bytes);
@@ -139,45 +139,40 @@ struct pipe_winsys
* Map the entire data store of a buffer object into the client's address.
* flags is bitmask of PIPE_BUFFER_USAGE_CPU_READ/WRITE flags.
*/
- void *(*buffer_map)( struct pipe_winsys *sws,
+ void *(*buffer_map)( struct pipe_winsys *ws,
struct pipe_buffer *buf,
unsigned usage );
- void (*buffer_unmap)( struct pipe_winsys *sws,
+ void (*buffer_unmap)( struct pipe_winsys *ws,
struct pipe_buffer *buf );
- void (*buffer_destroy)( struct pipe_winsys *sws,
+ void (*buffer_destroy)( struct pipe_winsys *ws,
struct pipe_buffer *buf );
/** Set ptr = fence, with reference counting */
- void (*fence_reference)( struct pipe_winsys *sws,
+ void (*fence_reference)( struct pipe_winsys *ws,
struct pipe_fence_handle **ptr,
struct pipe_fence_handle *fence );
/**
* Checks whether the fence has been signalled.
- *
- * The meaning of flag is pipe-driver specific.
- *
- * Returns zero if it has.
+ * \param flags driver-specific meaning
+ * \return zero on success.
*/
- int (*fence_signalled)( struct pipe_winsys *sws,
+ int (*fence_signalled)( struct pipe_winsys *ws,
struct pipe_fence_handle *fence,
unsigned flag );
/**
* Wait for the fence to finish.
- *
- * The meaning of flag is pipe-driver specific.
- *
- * Returns zero on success.
+ * \param flags driver-specific meaning
+ * \return zero on success.
*/
- int (*fence_finish)( struct pipe_winsys *sws,
+ int (*fence_finish)( struct pipe_winsys *ws,
struct pipe_fence_handle *fence,
unsigned flag );
-
};
diff --git a/src/gallium/winsys/xlib/fakeglx.c b/src/gallium/winsys/xlib/fakeglx.c
index 6e04cb4117..ec77e81fed 100644
--- a/src/gallium/winsys/xlib/fakeglx.c
+++ b/src/gallium/winsys/xlib/fakeglx.c
@@ -1459,6 +1459,13 @@ Fake_glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
GLXDrawable read, GLXContext ctx )
{
struct fake_glx_context *glxCtx = (struct fake_glx_context *) ctx;
+ static boolean firsttime = 1, no_rast = 0;
+
+ if (firsttime) {
+ no_rast = getenv("SP_NO_RAST") != NULL;
+ firsttime = 0;
+ }
+
if (ctx && draw && read) {
XMesaBuffer drawBuffer, readBuffer;
@@ -1504,7 +1511,8 @@ Fake_glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
#endif
}
- if (MakeCurrent_PrevContext == ctx &&
+ if (no_rast &&
+ MakeCurrent_PrevContext == ctx &&
MakeCurrent_PrevDrawable == draw &&
MakeCurrent_PrevReadable == read &&
MakeCurrent_PrevDrawBuffer == drawBuffer &&
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index 80fbdb41f0..6b99dacf2a 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -12,9 +12,19 @@ env.Append(CPPPATH = [
'#/src/mesa/main',
])
-env.Append(CFLAGS = [
- '-std=c99',
-])
+if gcc:
+ env.Append(CFLAGS = [
+ '-std=c99',
+ ])
+
+# x86 assembly
+if x86 and gcc:
+ env.Append(CPPDEFINES = [
+ 'USE_X86_ASM',
+ 'USE_MMX_ASM',
+ 'USE_3DNOW_ASM',
+ 'USE_SSE_ASM',
+ ])
#######################################################################
@@ -269,7 +279,7 @@ SPARC_API = [
'sparc/glapi_sparc.S',
]
-if x86:
+if x86 and gcc:
ASM_SOURCES = ASM_C_SOURCES + X86_SOURCES
API_SOURCES = X86_API
else:
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index e762eb3b63..dc0307feb5 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -551,8 +551,8 @@ _mesa_map_drawpix_pbo(GLcontext *ctx,
* \sa _mesa_unmap_bitmap_pbo
*/
void
-_mesa_unmap_drapix_pbo(GLcontext *ctx,
- const struct gl_pixelstore_attrib *unpack)
+_mesa_unmap_drawpix_pbo(GLcontext *ctx,
+ const struct gl_pixelstore_attrib *unpack)
{
if (unpack->BufferObj->Name) {
ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index 46525f08ae..024e5a8c3c 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -101,8 +101,8 @@ _mesa_map_drawpix_pbo(GLcontext *ctx,
const GLvoid *pixels);
extern void
-_mesa_unmap_drapix_pbo(GLcontext *ctx,
- const struct gl_pixelstore_attrib *unpack);
+_mesa_unmap_drawpix_pbo(GLcontext *ctx,
+ const struct gl_pixelstore_attrib *unpack);
extern void *
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index 0f64f1c1c0..fa422bb3c7 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -377,8 +377,9 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
if (ctx->RenderMode == GL_RENDER) {
/* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */
- GLint x = IFLOOR(ctx->Current.RasterPos[0] - xorig);
- GLint y = IFLOOR(ctx->Current.RasterPos[1] - yorig);
+ const GLfloat epsilon = 0.0001;
+ GLint x = IFLOOR(ctx->Current.RasterPos[0] + epsilon - xorig);
+ GLint y = IFLOOR(ctx->Current.RasterPos[1] + epsilon - yorig);
if (ctx->Unpack.BufferObj->Name) {
/* unpack from PBO */
diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c
index 45352d30b5..eee4d2d925 100644
--- a/src/mesa/shader/prog_statevars.c
+++ b/src/mesa/shader/prog_statevars.c
@@ -253,7 +253,8 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
value[0] = ctx->Fog.Density;
value[1] = ctx->Fog.Start;
value[2] = ctx->Fog.End;
- value[3] = 1.0F / (ctx->Fog.End - ctx->Fog.Start);
+ value[3] = (ctx->Fog.End == ctx->Fog.Start)
+ ? 1.0 : 1.0F / (ctx->Fog.End - ctx->Fog.Start);
return;
case STATE_CLIPPLANE:
{
@@ -424,8 +425,9 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
* exp: 2^-(density/ln(2) * fogcoord)
* exp2: 2^-((density/(ln(2)^2) * fogcoord)^2)
*/
- value[0] = -1.0F / (ctx->Fog.End - ctx->Fog.Start);
- value[1] = ctx->Fog.End / (ctx->Fog.End - ctx->Fog.Start);
+ value[0] = (ctx->Fog.End == ctx->Fog.Start)
+ ? 1.0 : -1.0F / (ctx->Fog.End - ctx->Fog.Start);
+ value[1] = ctx->Fog.End * -value[0];
value[2] = ctx->Fog.Density * ONE_DIV_LN2;
value[3] = ctx->Fog.Density * ONE_DIV_SQRT_LN2;
return;
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index 01c07dc26d..d15da5895a 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -38,6 +38,23 @@
#include "st_cb_texture.h"
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
+#include "cso_cache/cso_context.h"
+#include "util/u_simple_shaders.h"
+
+
+static void *
+get_passthrough_fs(struct st_context *st)
+{
+ struct pipe_shader_state shader;
+
+ if (!st->passthrough_fs) {
+ st->passthrough_fs =
+ util_make_fragment_passthrough_shader(st->pipe, &shader);
+ free((void *) shader.tokens);
+ }
+
+ return st->passthrough_fs;
+}
/**
@@ -49,6 +66,7 @@ update_textures(struct st_context *st)
{
struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current;
GLuint su;
+ GLboolean missing_textures = GL_FALSE;
st->state.num_textures = 0;
@@ -67,6 +85,7 @@ update_textures(struct st_context *st)
retval = st_finalize_texture(st->ctx, st->pipe, texObj, &flush);
if (!retval) {
/* out of mem */
+ missing_textures = GL_TRUE;
continue;
}
@@ -79,8 +98,15 @@ update_textures(struct st_context *st)
pipe_texture_reference(&st->state.sampler_texture[su], pt);
}
- st->pipe->set_sampler_textures(st->pipe, st->state.num_textures,
- st->state.sampler_texture);
+ cso_set_sampler_textures(st->cso_context,
+ st->state.num_textures,
+ st->state.sampler_texture);
+
+ if (missing_textures) {
+ /* use a pass-through frag shader that uses no textures */
+ void *fs = get_passthrough_fs(st);
+ cso_set_fragment_shader_handle(st->cso_context, fs);
+ }
}
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index 7752b40e8b..6c2d9a4b89 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -355,11 +355,8 @@ setup_bitmap_vertex_data(struct st_context *st,
const GLfloat x1 = x + width;
const GLfloat y0 = y;
const GLfloat y1 = y + height;
- const GLfloat bias = st->bitmap_texcoord_bias;
- const GLfloat xBias = bias / (x1-x0);
- const GLfloat yBias = bias / (y1-y0);
- const GLfloat sLeft = 0.0 + xBias, sRight = 1.0 + xBias;
- const GLfloat tTop = yBias, tBot = 1.0 - tTop - yBias;
+ const GLfloat sLeft = 0.0F, sRight = 1.0F;
+ const GLfloat tTop = 0.0, tBot = 1.0 - tTop;
const GLfloat clip_x0 = x0 / fb_width * 2.0 - 1.0;
const GLfloat clip_y0 = y0 / fb_height * 2.0 - 1.0;
const GLfloat clip_x1 = x1 / fb_width * 2.0 - 1.0;
@@ -803,7 +800,7 @@ st_destroy_bitmap(struct st_context *st)
}
#endif
if (st->bitmap.vs) {
- pipe->delete_vs_state(pipe, st->bitmap.vs);
+ cso_delete_vertex_shader(st->cso_context, st->bitmap.vs);
st->bitmap.vs = NULL;
}
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index dac346a06c..95a5fb8db4 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -98,11 +98,11 @@ st_destroy_clear(struct st_context *st)
struct pipe_context *pipe = st->pipe;
if (st->clear.fs) {
- pipe->delete_fs_state(pipe, st->clear.fs);
+ cso_delete_fragment_shader(st->cso_context, st->clear.fs);
st->clear.fs = NULL;
}
if (st->clear.vs) {
- pipe->delete_vs_state(pipe, st->clear.vs);
+ cso_delete_vertex_shader(st->cso_context, st->clear.vs);
st->clear.vs = NULL;
}
if (st->clear.vbuf) {
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 3921500659..047ea3816b 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -349,7 +349,7 @@ make_texture(struct st_context *st,
pt = st_texture_create(st, PIPE_TEXTURE_2D, pipeFormat, 0, width, height,
1, 0);
if (!pt) {
- _mesa_unmap_drapix_pbo(ctx, unpack);
+ _mesa_unmap_drawpix_pbo(ctx, unpack);
return NULL;
}
@@ -395,111 +395,109 @@ make_texture(struct st_context *st,
ctx->_ImageTransferState = imageTransferStateSave;
}
- _mesa_unmap_drapix_pbo(ctx, unpack);
+ _mesa_unmap_drawpix_pbo(ctx, unpack);
return pt;
}
/**
- * Draw textured quad.
+ * Draw quad with texcoords and optional color.
* Coords are window coords with y=0=bottom.
+ * \param color may be null
+ * \param invertTex if true, flip texcoords vertically
*/
static void
draw_quad(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z,
- GLfloat x1, GLfloat y1, GLboolean invertTex)
+ GLfloat x1, GLfloat y1, const GLfloat *color,
+ GLboolean invertTex)
{
- GLfloat verts[4][2][4]; /* four verts, two attribs, XYZW */
- GLuint i;
- GLfloat sLeft = 0.0, sRight = 1.0;
- GLfloat tTop = invertTex, tBot = 1.0 - tTop;
-
- /* upper-left */
- verts[0][0][0] = x0; /* attr[0].x */
- verts[0][0][1] = y0; /* attr[0].y */
- verts[0][1][0] = sLeft; /* attr[1].s */
- verts[0][1][1] = tTop; /* attr[1].t */
-
- /* upper-right */
- verts[1][0][0] = x1;
- verts[1][0][1] = y0;
- verts[1][1][0] = sRight;
- verts[1][1][1] = tTop;
-
- /* lower-right */
- verts[2][0][0] = x1;
- verts[2][0][1] = y1;
- verts[2][1][0] = sRight;
- verts[2][1][1] = tBot;
-
- /* lower-left */
- verts[3][0][0] = x0;
- verts[3][0][1] = y1;
- verts[3][1][0] = sLeft;
- verts[3][1][1] = tBot;
-
- /* same for all verts: */
- for (i = 0; i < 4; i++) {
- verts[i][0][2] = z; /*Z*/
- verts[i][0][3] = 1.0; /*W*/
- verts[i][1][2] = 0.0; /*R*/
- verts[i][1][3] = 1.0; /*Q*/
- }
-
- st_draw_vertices(ctx, PIPE_PRIM_QUADS, 4, (float *) verts, 2, GL_FALSE);
-}
-
-
-static void
-draw_quad_colored(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z,
- GLfloat x1, GLfloat y1, const GLfloat *color,
- GLboolean invertTex)
-{
- GLfloat bias = ctx->st->bitmap_texcoord_bias;
+ struct st_context *st = ctx->st;
+ struct pipe_context *pipe = ctx->st->pipe;
GLfloat verts[4][3][4]; /* four verts, three attribs, XYZW */
- GLuint i;
- GLfloat xBias = bias / (x1-x0);
- GLfloat yBias = bias / (y1-y0);
- GLfloat sLeft = 0.0 + xBias, sRight = 1.0 + xBias;
- GLfloat tTop = invertTex - yBias, tBot = 1.0 - tTop - yBias;
-
- /* upper-left */
- verts[0][0][0] = x0; /* attr[0].x */
- verts[0][0][1] = y0; /* attr[0].y */
- verts[0][2][0] = sLeft; /* attr[2].s */
- verts[0][2][1] = tTop; /* attr[2].t */
-
- /* upper-right */
- verts[1][0][0] = x1;
- verts[1][0][1] = y0;
- verts[1][2][0] = sRight;
- verts[1][2][1] = tTop;
-
- /* lower-right */
- verts[2][0][0] = x1;
- verts[2][0][1] = y1;
- verts[2][2][0] = sRight;
- verts[2][2][1] = tBot;
-
- /* lower-left */
- verts[3][0][0] = x0;
- verts[3][0][1] = y1;
- verts[3][2][0] = sLeft;
- verts[3][2][1] = tBot;
-
- /* same for all verts: */
- for (i = 0; i < 4; i++) {
- verts[i][0][2] = z; /*Z*/
- verts[i][0][3] = 1.0; /*W*/
- verts[i][1][0] = color[0];
- verts[i][1][1] = color[1];
- verts[i][1][2] = color[2];
- verts[i][1][3] = color[3];
- verts[i][2][2] = 0.0; /*R*/
- verts[i][2][3] = 1.0; /*Q*/
+
+ /* setup vertex data */
+ {
+ const struct gl_framebuffer *fb = st->ctx->DrawBuffer;
+ const GLfloat fb_width = fb->Width;
+ const GLfloat fb_height = fb->Height;
+ const GLfloat clip_x0 = x0 / fb_width * 2.0 - 1.0;
+ const GLfloat clip_y0 = y0 / fb_height * 2.0 - 1.0;
+ const GLfloat clip_x1 = x1 / fb_width * 2.0 - 1.0;
+ const GLfloat clip_y1 = y1 / fb_height * 2.0 - 1.0;
+ const GLfloat sLeft = 0.0F, sRight = 1.0F;
+ const GLfloat tTop = invertTex, tBot = 1.0 - tTop;
+ GLuint tex, i;
+
+ /* upper-left */
+ verts[0][0][0] = clip_x0; /* v[0].attr[0].x */
+ verts[0][0][1] = clip_y0; /* v[0].attr[0].y */
+
+ /* upper-right */
+ verts[1][0][0] = clip_x1;
+ verts[1][0][1] = clip_y0;
+
+ /* lower-right */
+ verts[2][0][0] = clip_x1;
+ verts[2][0][1] = clip_y1;
+
+ /* lower-left */
+ verts[3][0][0] = clip_x0;
+ verts[3][0][1] = clip_y1;
+
+ tex = color ? 2 : 1;
+ verts[0][tex][0] = sLeft; /* v[0].attr[tex].s */
+ verts[0][tex][1] = tTop; /* v[0].attr[tex].t */
+ verts[1][tex][0] = sRight;
+ verts[1][tex][1] = tTop;
+ verts[2][tex][0] = sRight;
+ verts[2][tex][1] = tBot;
+ verts[3][tex][0] = sLeft;
+ verts[3][tex][1] = tBot;
+
+ /* same for all verts: */
+ if (color) {
+ for (i = 0; i < 4; i++) {
+ verts[i][0][2] = z; /*Z*/
+ verts[i][0][3] = 1.0; /*W*/
+ verts[i][1][0] = color[0];
+ verts[i][1][1] = color[1];
+ verts[i][1][2] = color[2];
+ verts[i][1][3] = color[3];
+ verts[i][2][2] = 0.0; /*R*/
+ verts[i][2][3] = 1.0; /*Q*/
+ }
+ }
+ else {
+ for (i = 0; i < 4; i++) {
+ verts[i][0][2] = z; /*Z*/
+ verts[i][0][3] = 1.0; /*W*/
+ verts[i][1][2] = 0.0; /*R*/
+ verts[i][1][3] = 1.0; /*Q*/
+ }
+ }
}
- st_draw_vertices(ctx, PIPE_PRIM_QUADS, 4, (float *) verts, 3, GL_FALSE);
+ {
+ struct pipe_buffer *buf;
+ ubyte *map;
+
+ /* allocate/load buffer object with vertex data */
+ buf = pipe->winsys->buffer_create(pipe->winsys, 32,
+ PIPE_BUFFER_USAGE_VERTEX,
+ sizeof(verts));
+ map = pipe->winsys->buffer_map(pipe->winsys, buf,
+ PIPE_BUFFER_USAGE_CPU_WRITE);
+ memcpy(map, verts, sizeof(verts));
+ pipe->winsys->buffer_unmap(pipe->winsys, buf);
+
+ util_draw_vertex_buffer(pipe, buf,
+ PIPE_PRIM_QUADS,
+ 4, /* verts */
+ 3); /* attribs/vert */
+
+ pipe->winsys->buffer_destroy(pipe->winsys, buf);
+ }
}
@@ -605,12 +603,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
x1 = x + width * ctx->Pixel.ZoomX;
y0 = y;
y1 = y + height * ctx->Pixel.ZoomY;
-
- /* draw textured quad */
- if (color)
- draw_quad_colored(ctx, x0, y0, z, x1, y1, color, invertTex);
- else
- draw_quad(ctx, x0, y0, z, x1, y1, invertTex);
+ draw_quad(ctx, x0, y0, z, x1, y1, color, invertTex);
/* restore state */
cso_restore_rasterizer(cso);
@@ -878,9 +871,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
GLsizei width, GLsizei height,
GLint dstx, GLint dsty)
{
- struct st_renderbuffer *rbRead = st_renderbuffer(ctx->ReadBuffer->_StencilBuffer);
struct st_renderbuffer *rbDraw = st_renderbuffer(ctx->DrawBuffer->_StencilBuffer);
- struct pipe_surface *psRead = rbRead->surface;
struct pipe_surface *psDraw = rbDraw->surface;
ubyte *drawMap;
ubyte *buffer;
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index b1a56f3ca6..69dde56e55 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -252,6 +252,8 @@ st_new_renderbuffer_fb(enum pipe_format format)
switch (format) {
case PIPE_FORMAT_A8R8G8B8_UNORM:
case PIPE_FORMAT_B8G8R8A8_UNORM:
+ case PIPE_FORMAT_X8R8G8B8_UNORM:
+ case PIPE_FORMAT_B8G8R8X8_UNORM:
case PIPE_FORMAT_A1R5G5B5_UNORM:
case PIPE_FORMAT_A4R4G4B4_UNORM:
case PIPE_FORMAT_R5G6B5_UNORM:
@@ -268,6 +270,8 @@ st_new_renderbuffer_fb(enum pipe_format format)
break;
case PIPE_FORMAT_S8Z24_UNORM:
case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_X8Z24_UNORM:
+ case PIPE_FORMAT_Z24X8_UNORM:
strb->Base.InternalFormat = GL_DEPTH24_STENCIL8_EXT;
strb->Base._BaseFormat = GL_DEPTH_STENCIL_EXT;
break;
@@ -396,6 +400,10 @@ st_finish_render_texture(GLcontext *ctx,
ctx->st->pipe->flush(ctx->st->pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
+ ctx->st->pipe->texture_update(ctx->st->pipe,
+ st_get_texobj_texture(att->Texture),
+ att->CubeMapFace, 1 << att->TextureLevel);
+
/*
printf("FINISH RENDER TO TEXTURE surf=%p\n", strb->surface);
*/
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index 67f8b1f8eb..a293ec3f0b 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -39,7 +39,7 @@
#include "shader/programopt.h"
#include "shader/shader_api.h"
-#include "cso_cache/cso_cache.h"
+#include "cso_cache/cso_context.h"
#include "draw/draw_context.h"
#include "st_context.h"
@@ -127,7 +127,6 @@ void
st_delete_program(GLcontext *ctx, struct gl_program *prog)
{
struct st_context *st = st_context(ctx);
- struct pipe_context *pipe = st->pipe;
switch( prog->Target ) {
case GL_VERTEX_PROGRAM_ARB:
@@ -135,7 +134,7 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog)
struct st_vertex_program *stvp = (struct st_vertex_program *) prog;
if (stvp->driver_shader) {
- pipe->delete_vs_state(pipe, stvp->driver_shader);
+ cso_delete_vertex_shader(st->cso_context, stvp->driver_shader);
stvp->driver_shader = NULL;
}
@@ -150,7 +149,7 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog)
struct st_fragment_program *stfp = (struct st_fragment_program *) prog;
if (stfp->driver_shader) {
- pipe->delete_fs_state(pipe, stfp->driver_shader);
+ cso_delete_fragment_shader(st->cso_context, stfp->driver_shader);
stfp->driver_shader = NULL;
}
@@ -187,7 +186,6 @@ static void st_program_string_notify( GLcontext *ctx,
struct gl_program *prog )
{
struct st_context *st = st_context(ctx);
- struct pipe_context *pipe = st->pipe;
if (target == GL_FRAGMENT_PROGRAM_ARB) {
struct st_fragment_program *stfp = (struct st_fragment_program *) prog;
@@ -195,7 +193,7 @@ static void st_program_string_notify( GLcontext *ctx,
stfp->serialNo++;
if (stfp->driver_shader) {
- pipe->delete_fs_state(pipe, stfp->driver_shader);
+ cso_delete_fragment_shader(st->cso_context, stfp->driver_shader);
stfp->driver_shader = NULL;
}
@@ -215,7 +213,7 @@ static void st_program_string_notify( GLcontext *ctx,
stvp->serialNo++;
if (stvp->driver_shader) {
- pipe->delete_vs_state(pipe, stvp->driver_shader);
+ cso_delete_vertex_shader(st->cso_context, stvp->driver_shader);
stvp->driver_shader = NULL;
}
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 3db2790267..005bb2e54d 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -49,6 +49,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "util/p_tile.h"
+#include "util/u_blit.h"
#define DBG if (0) printf
@@ -895,6 +896,11 @@ st_TexSubimage(GLcontext * ctx,
dstRowStride = stImage->surface->pitch * stImage->surface->cpp;
}
+ if (!texImage->Data) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage");
+ return;
+ }
+
src = (const GLubyte *) pixels;
for (i = 0; i++ < depth;) {
@@ -906,10 +912,11 @@ st_TexSubimage(GLcontext * ctx,
texImage->ImageOffsets,
width, height, 1,
format, type, src, packing)) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "st_TexSubImage");
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage");
}
if (stImage->pt && i < depth) {
+ /* map next slice of 3D texture */
st_texture_image_unmap(stImage);
texImage->Data = st_texture_image_map(ctx->st, stImage, zoffset + i);
src += srcImageStride;
@@ -1134,11 +1141,9 @@ do_copy_texsubimage(GLcontext *ctx,
dest_surface = screen->get_tex_surface(screen, stImage->pt, stImage->face,
stImage->level, destZ);
- if (src_format == dest_format &&
- ctx->_ImageTransferState == 0x0 &&
+ if (ctx->_ImageTransferState == 0x0 &&
strb->surface->buffer &&
- dest_surface->buffer &&
- strb->surface->cpp == stImage->pt->cpp) {
+ dest_surface->buffer) {
/* do blit-style copy */
/* XXX may need to invert image depending on window
@@ -1162,16 +1167,26 @@ do_copy_texsubimage(GLcontext *ctx,
GL_COPY); /* ? */
#else
- pipe->surface_copy(pipe,
- do_flip,
- /* dest */
- dest_surface,
- destX, destY,
- /* src */
- strb->surface,
- srcX, srcY,
- /* size */
- width, height);
+ if (src_format == dest_format) {
+ pipe->surface_copy(pipe,
+ do_flip,
+ /* dest */
+ dest_surface,
+ destX, destY,
+ /* src */
+ strb->surface,
+ srcX, srcY,
+ /* size */
+ width, height);
+ } else {
+ util_blit_pixels(ctx->st->blit,
+ strb->surface,
+ srcX, do_flip ? srcY + height : srcY,
+ srcX + width, do_flip ? srcY : srcY + height,
+ dest_surface,
+ destX, destY, destX + width, destY + height,
+ 0.0, PIPE_TEX_MIPFILTER_NEAREST);
+ }
#endif
}
else {
@@ -1358,7 +1373,7 @@ copy_image_data_to_texture(struct st_context *st,
pipe_texture_release(&stImage->pt);
}
- else {
+ else if (stImage->base.Data) {
assert(stImage->base.Data != NULL);
/* More straightforward upload.
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index dadc524b51..8a30871fa0 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -176,22 +176,29 @@ static void st_destroy_context_priv( struct st_context *st )
}
}
- st->pipe->destroy( st->pipe );
free( st );
}
void st_destroy_context( struct st_context *st )
{
+ struct pipe_context *pipe = st->pipe;
+ struct cso_context *cso = st->cso_context;
GLcontext *ctx = st->ctx;
/* need to unbind and destroy CSO objects before anything else */
- cso_destroy_context(st->cso_context);
+ cso_release_all(st->cso_context);
_mesa_delete_program_cache(st->ctx, st->pixel_xfer.cache);
_mesa_free_context_data(ctx);
+
st_destroy_context_priv(st);
+
+ cso_destroy_context(cso);
+
+ pipe->destroy( pipe );
+
free(ctx);
}
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 2851770d4c..80a71d1766 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -123,8 +123,6 @@ struct st_context
GLfloat polygon_offset_scale; /* ?? */
- GLfloat bitmap_texcoord_bias;
-
/** Mapping from VERT_RESULT_x to post-transformed vertex slot */
const GLuint *vertex_result_to_slot;
@@ -165,6 +163,8 @@ struct st_context
struct pipe_buffer *vbuf;
} clear;
+ void *passthrough_fs; /**< simple pass-through frag shader */
+
struct gen_mipmap_state *gen_mipmap;
struct blit_state *blit;
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index befcb96bd8..6c20120ac7 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -190,6 +190,61 @@ pipe_vertex_format(GLenum type, GLuint size, GLboolean normalized)
}
+/*
+ * If edge flags are needed, setup an bitvector of flags and call
+ * pipe->set_edgeflags().
+ * XXX memleak: need to free the returned pointer at some point
+ */
+static void *
+setup_edgeflags(GLcontext *ctx, GLenum primMode, GLint start, GLint count,
+ const struct gl_client_array *array)
+{
+ struct pipe_context *pipe = ctx->st->pipe;
+
+ if ((primMode == GL_TRIANGLES ||
+ primMode == GL_QUADS ||
+ primMode == GL_POLYGON) &&
+ (ctx->Polygon.FrontMode != GL_FILL ||
+ ctx->Polygon.BackMode != GL_FILL)) {
+ /* need edge flags */
+ GLuint i;
+ unsigned *vec;
+ struct st_buffer_object *stobj = st_buffer_object(array->BufferObj);
+ ubyte *map;
+
+ if (!stobj)
+ return NULL;
+
+ vec = (unsigned *) calloc(sizeof(unsigned), (count + 31) / 32);
+ if (!vec)
+ return NULL;
+
+ map = pipe->winsys->buffer_map(pipe->winsys, stobj->buffer,
+ PIPE_BUFFER_USAGE_CPU_READ);
+ map = ADD_POINTERS(map, array->Ptr);
+
+ for (i = 0; i < count; i++) {
+ if (*((float *) map))
+ vec[i/32] |= 1 << (i % 32);
+
+ map += array->StrideB;
+ }
+
+ pipe->winsys->buffer_unmap(pipe->winsys, stobj->buffer);
+
+ pipe->set_edgeflags(pipe, vec);
+
+ return vec;
+ }
+ else {
+ /* edge flags not needed */
+ pipe->set_edgeflags(pipe, NULL);
+ return NULL;
+ }
+}
+
+
+
/**
* This function gets plugged into the VBO module and is called when
* we have something to render.
@@ -277,7 +332,6 @@ st_draw_vbo(GLcontext *ctx,
pipe->set_vertex_buffers(pipe, vp->num_inputs, vbuffer);
pipe->set_vertex_elements(pipe, vp->num_inputs, velements);
-
/* do actual drawing */
if (ib) {
/* indexed primitive */
@@ -317,6 +371,10 @@ st_draw_vbo(GLcontext *ctx,
/* draw */
for (i = 0; i < nr_prims; i++) {
+ setup_edgeflags(ctx, prims[i].mode,
+ prims[i].start + indexOffset, prims[i].count,
+ arrays[VERT_ATTRIB_EDGEFLAG]);
+
pipe->draw_elements(pipe, indexBuf, indexSize,
prims[i].mode,
prims[i].start + indexOffset, prims[i].count);
@@ -328,6 +386,10 @@ st_draw_vbo(GLcontext *ctx,
/* non-indexed */
GLuint i;
for (i = 0; i < nr_prims; i++) {
+ setup_edgeflags(ctx, prims[i].mode,
+ prims[i].start, prims[i].count,
+ arrays[VERT_ATTRIB_EDGEFLAG]);
+
pipe->draw_arrays(pipe, prims[i].mode, prims[i].start, prims[i].count);
}
}
@@ -343,76 +405,6 @@ st_draw_vbo(GLcontext *ctx,
/**
- * Utility function for drawing simple primitives (such as quads for
- * glClear and glDrawPixels). Coordinates are in screen space.
- * \param mode one of PIPE_PRIM_x
- * \param numVertex number of vertices
- * \param verts vertex data (all attributes are float[4])
- * \param numAttribs number of attributes per vertex
- */
-void
-st_draw_vertices(GLcontext *ctx, unsigned prim,
- unsigned numVertex, float *verts,
- unsigned numAttribs,
- GLboolean inClipCoords)
-{
- const float width = ctx->DrawBuffer->Width;
- const float height = ctx->DrawBuffer->Height;
- const unsigned vertex_bytes = numVertex * numAttribs * 4 * sizeof(float);
- struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_buffer *vbuf;
- struct pipe_vertex_buffer vbuffer;
- struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
- unsigned i;
-
- assert(numAttribs > 0);
-
- if (!inClipCoords) {
- /* convert to clip coords */
- for (i = 0; i < numVertex; i++) {
- float x = verts[i * numAttribs * 4 + 0];
- float y = verts[i * numAttribs * 4 + 1];
- x = x / width * 2.0 - 1.0;
- y = y / height * 2.0 - 1.0;
- verts[i * numAttribs * 4 + 0] = x;
- verts[i * numAttribs * 4 + 1] = y;
- }
- }
-
- /* XXX create one-time */
- vbuf = pipe->winsys->buffer_create(pipe->winsys, 32,
- PIPE_BUFFER_USAGE_VERTEX, vertex_bytes);
- assert(vbuf);
-
- memcpy(pipe->winsys->buffer_map(pipe->winsys, vbuf,
- PIPE_BUFFER_USAGE_CPU_WRITE),
- verts, vertex_bytes);
- pipe->winsys->buffer_unmap(pipe->winsys, vbuf);
-
- /* tell pipe about the vertex buffer */
- vbuffer.buffer = vbuf;
- vbuffer.pitch = numAttribs * 4 * sizeof(float); /* vertex size */
- vbuffer.buffer_offset = 0;
- pipe->set_vertex_buffers(pipe, 1, &vbuffer);
-
- /* tell pipe about the vertex attributes */
- for (i = 0; i < numAttribs; i++) {
- velements[i].src_offset = i * 4 * sizeof(GLfloat);
- velements[i].vertex_buffer_index = 0;
- velements[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
- velements[i].nr_components = 4;
- }
- pipe->set_vertex_elements(pipe, numAttribs, velements);
-
- /* draw */
- pipe->draw_arrays(pipe, prim, 0, numVertex);
-
- /* XXX: do one-time */
- pipe_buffer_reference(pipe->winsys, &vbuf, NULL);
-}
-
-
-/**
* Set the (private) draw module's post-transformed vertex format when in
* GL_SELECT or GL_FEEDBACK mode or for glRasterPos.
*/
diff --git a/src/mesa/state_tracker/st_draw.h b/src/mesa/state_tracker/st_draw.h
index 171bde57e5..c81f2b25da 100644
--- a/src/mesa/state_tracker/st_draw.h
+++ b/src/mesa/state_tracker/st_draw.h
@@ -59,11 +59,4 @@ st_feedback_draw_vbo(GLcontext *ctx,
GLuint min_index,
GLuint max_index);
-void
-st_draw_vertices(GLcontext *ctx, unsigned prim,
- unsigned numVertex, float *verts,
- unsigned numAttribs,
- GLboolean inClipCoords);
-
-
#endif
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index f2d40e84b3..260a2efe88 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -109,9 +109,6 @@ void st_init_limits(struct st_context *st)
c->MaxTextureLodBias
= screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_LOD_BIAS);
- st->bitmap_texcoord_bias
- = screen->get_paramf(screen, PIPE_CAP_BITMAP_TEXCOORD_BIAS);
-
c->MaxDrawBuffers
= CLAMP(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS),
1, MAX_DRAW_BUFFERS);
@@ -220,11 +217,12 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
}
+#if 01
if (screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA,
PIPE_TEXTURE)) {
ctx->Extensions.EXT_texture_compression_s3tc = GL_TRUE;
}
-
+#endif
if (screen->is_format_supported(screen, PIPE_FORMAT_YCBCR, PIPE_TEXTURE) ||
screen->is_format_supported(screen, PIPE_FORMAT_YCBCR_REV, PIPE_TEXTURE)) {
ctx->Extensions.MESA_ycbcr_texture = GL_TRUE;
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 3648ded8a1..d450c30694 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -270,7 +270,7 @@ st_translate_vertex_program(struct st_context *st,
stvp->state.tokens = NULL;
}
if (stvp->driver_shader) {
- pipe->delete_vs_state(pipe, stvp->driver_shader);
+ cso_delete_vertex_shader(st->cso_context, stvp->driver_shader);
stvp->driver_shader = NULL;
}
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index 8e3235cc99..66d81e2b95 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -290,8 +290,7 @@ st_texture_image_copy(struct pipe_context *pipe,
GLuint i;
/* XXX this is a hack */
- if (dst->compressed)
- height /= 4;
+ const GLuint copyHeight = dst->compressed ? height / 4 : height;
for (i = 0; i < depth; i++) {
GLuint srcLevel;
@@ -315,7 +314,7 @@ st_texture_image_copy(struct pipe_context *pipe,
0, 0, /* destX, Y */
src_surface,
0, 0, /* srcX, Y */
- width, height);
+ width, copyHeight);
pipe_surface_reference(&dst_surface, NULL);
pipe_surface_reference(&src_surface, NULL);
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index fb04d9f746..cbf6617058 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -877,7 +877,7 @@ end:
RENDER_FINISH(swrast,ctx);
- _mesa_unmap_drapix_pbo(ctx, unpack);
+ _mesa_unmap_drawpix_pbo(ctx, unpack);
}
diff --git a/winddk.py b/winddk.py
index c112329cd6..58de183857 100644
--- a/winddk.py
+++ b/winddk.py
@@ -89,105 +89,6 @@ def get_winddk_paths(env, version=None):
exe_path = string.join(exe_paths, os.pathsep )
return (include_path, lib_path, exe_path)
-def set_winddk_flags(env):
- """Mimic WINDDK's builtin flags.
-
- See also:
- - WINDDK's bin/makefile.new i386mk.inc for more info.
- - buildchk_wxp_x86.log files, generated by the WINDDK's build
- - http://alter.org.ua/docs/nt_kernel/vc8_proj/
- """
-
- cppdefines = [
- ('_X86_', '1'),
- ('i386', '1'),
- 'STD_CALL',
- ('CONDITION_HANDLING', '1'),
- ('NT_INST', '0'),
- ('WIN32', '100'),
- ('_NT1X_', '100'),
- ('WINNT', '1'),
- ('_WIN32_WINNT', '0x0501'), # minimum required OS version
- ('WINVER', '0x0501'),
- ('_WIN32_IE', '0x0603'),
- ('WIN32_LEAN_AND_MEAN', '1'),
- ('DEVL', '1'),
- ('__BUILDMACHINE__', 'WinDDK'),
- ('FPO', '0'),
- ]
- if env.get('DEBUG', False):
- cppdefines += [
- ('DBG', 1),
- ]
- env.Append(CPPDEFINES = cppdefines)
-
- # See also:
- # - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
- # - cl /?
- cflags = [
- '/Zl', # omit default library name in .OBJ
- '/Zp8', # 8bytes struct member alignment
- '/Gy', # separate functions for linker
- '/Gm-', # disable minimal rebuild
- '/W3', # warning level
- '/WX', # treat warnings as errors
- '/Gz', # __stdcall Calling convention
- '/GX-', # disable C++ EH
- '/GR-', # disable C++ RTTI
- '/GF', # enable read-only string pooling
- '/GS', # enable security checks
- '/G6', # optimize for PPro, P-II, P-III
- '/Ze', # enable extensions
- #'/Gi-', # ???
- '/QIfdiv-', # disable Pentium FDIV fix
- #'/hotpatch', # ???
- #'/Z7', #enable old-style debug info
- ]
- if env.get('debug', False):
- cflags += [
- '/Od', # disable optimizations
- '/Oi', # enable intrinsic functions
- '/Oy-', # disable frame pointer omission
- ]
- else:
- cflags += [
- '/Ox', # maximum optimizations
- '/Oi', # enable intrinsic functions
- '/Os', # favor code space
- ]
- env.Append(CFLAGS = cflags)
- env.Append(CXXFLAGS = cflags)
-
- # See also:
- # - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
- env.Append(LINKFLAGS = [
- '/merge:_PAGE=PAGE',
- '/merge:_TEXT=.text',
- '/section:INIT,d',
- '/opt:ref',
- '/opt:icf',
- '/ignore:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221',
- '/incremental:no',
- '/fullbuild',
- '/release',
- '/nodefaultlib',
- '/wx',
- '/debug',
- '/debugtype:cv',
- '/version:5.1',
- '/osversion:5.1',
- '/functionpadmin:5',
- '/safeseh',
- '/pdbcompress',
- '/stack:0x40000,0x1000',
- '/driver',
- '/align:0x80',
- '/subsystem:native,5.01',
- '/base:0x10000',
-
- '/entry:DrvEnableDriver',
- ])
-
def validate_vars(env):
"""Validate the PCH and PCHSTOP construction variables."""
if env.has_key('PCH') and env['PCH']:
@@ -314,8 +215,6 @@ def generate(env):
SCons.Tool.mslink.generate(env)
- set_winddk_flags(env)
-
if not env.has_key('ENV'):
env['ENV'] = {}