summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c282
-rw-r--r--src/gallium/auxiliary/Makefile3
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_interp.c1
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c6
-rw-r--r--src/gallium/auxiliary/os/os_thread.h94
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c18
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c2
-rw-r--r--src/gallium/auxiliary/util/u_timed_winsys.c32
-rw-r--r--src/gallium/drivers/i965/brw_swtnl.c6
-rw-r--r--src/gallium/drivers/i965/brw_vs_emit.c3
-rw-r--r--src/gallium/drivers/llvmpipe/Makefile6
-rw-r--r--src/gallium/drivers/llvmpipe/lp_context.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_jit.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.c157
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.h4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast_priv.h34
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c23
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_tri.c5
-rw-r--r--src/gallium/drivers/nouveau/nouveau_screen.c10
-rw-r--r--src/gallium/drivers/nv10/nv10_state.c590
-rw-r--r--src/gallium/drivers/nv20/nv20_state.c583
-rw-r--r--src/gallium/drivers/nv30/nv30_context.c1
-rw-r--r--src/gallium/drivers/nv30/nv30_screen.c4
-rw-r--r--src/gallium/drivers/nv30/nv30_surface.c1
-rw-r--r--src/gallium/drivers/nv30/nv30_vbo.c10
-rw-r--r--src/gallium/drivers/nv40/nv40_context.c1
-rw-r--r--src/gallium/drivers/nv40/nv40_draw.c5
-rw-r--r--src/gallium/drivers/nv40/nv40_vbo.c10
-rw-r--r--src/gallium/drivers/nv50/nv50_context.c1
-rw-r--r--src/gallium/drivers/nv50/nv50_surface.c1
-rw-r--r--src/gallium/drivers/nv50/nv50_transfer.c4
-rw-r--r--src/gallium/drivers/r300/r300_emit.c15
-rw-r--r--src/gallium/drivers/r300/r300_fs.c1
-rw-r--r--src/gallium/drivers/r300/r300_screen.c4
-rw-r--r--src/gallium/drivers/r300/r300_state.c41
-rw-r--r--src/gallium/drivers/r300/r300_texture.c1
-rw-r--r--src/gallium/drivers/r300/r300_tgsi_to_rc.c8
-rw-r--r--src/gallium/drivers/r300/r300_tgsi_to_rc.h6
-rw-r--r--src/gallium/drivers/r300/r300_vs.c1
-rw-r--r--src/gallium/drivers/svga/svga_draw.c8
-rw-r--r--src/gallium/drivers/svga/svga_screen.c2
-rw-r--r--src/gallium/drivers/svga/svgadump/svga_shader.h31
-rw-r--r--src/gallium/drivers/svga/svgadump/svga_shader_dump.c520
-rw-r--r--src/gallium/drivers/svga/svgadump/svga_shader_op.c194
-rw-r--r--src/gallium/drivers/svga/svgadump/svga_shader_op.h2
-rw-r--r--src/gallium/drivers/trace/tr_rbug.c4
-rw-r--r--src/gallium/state_trackers/dri/dri_drawable.c2
-rw-r--r--src/gallium/state_trackers/dri/dri_screen.c9
-rw-r--r--src/gallium/state_trackers/wgl/stw_context.c6
-rw-r--r--src/gallium/state_trackers/wgl/stw_device.c22
-rw-r--r--src/gallium/state_trackers/wgl/stw_framebuffer.c17
-rw-r--r--src/gallium/state_trackers/wgl/stw_getprocaddress.c5
-rw-r--r--src/gallium/state_trackers/wgl/stw_pixelformat.c3
-rw-r--r--src/gallium/state_trackers/xorg/xorg_xv.c11
-rw-r--r--src/gallium/winsys/drm/intel/dri/SConscript9
-rw-r--r--src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c10
-rw-r--r--src/gallium/winsys/gdi/gdi_softpipe_winsys.c10
-rw-r--r--src/glsl/apps/compile.c4
-rw-r--r--src/glsl/apps/process.c4
-rw-r--r--src/glsl/pp/sl_pp_context.h4
-rw-r--r--src/glsl/pp/sl_pp_extension.c28
-rw-r--r--src/glsl/pp/sl_pp_if.c72
-rw-r--r--src/glsl/pp/sl_pp_public.h3
-rw-r--r--src/glu/sgi/libnurbs/internals/arc.h6
-rw-r--r--src/glu/sgi/libnurbs/internals/bin.cc1
-rw-r--r--src/glu/sgi/libnurbs/internals/uarray.cc1
-rw-r--r--src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc2
-rw-r--r--src/mesa/drivers/dri/common/utils.c5
-rw-r--r--src/mesa/drivers/dri/common/utils.h3
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_xmesa.c2
-rw-r--r--src/mesa/drivers/dri/i810/i810screen.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c7
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.h2
-rw-r--r--src/mesa/drivers/dri/intel/intel_regions.c5
-rw-r--r--src/mesa/drivers/dri/intel/intel_regions.h3
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c73
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.h42
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c8
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_screen.c2
-rw-r--r--src/mesa/drivers/dri/mga/mga_xmesa.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_screen.c3
-rw-r--r--src/mesa/drivers/dri/r128/r128_screen.c2
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.c2
-rw-r--r--src/mesa/drivers/dri/r200/r200_state_init.c5
-rw-r--r--src/mesa/drivers/dri/r200/r200_texstate.c8
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r500_fragprog.c2
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c15
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.c3
-rw-r--r--src/mesa/drivers/dri/r300/r300_texstate.c8
-rw-r--r--src/mesa/drivers/dri/r600/r600_context.c2
-rw-r--r--src/mesa/drivers/dri/r600/r600_texstate.c6
-rw-r--r--src/mesa/drivers/dri/r600/r700_chip.c13
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_common.h7
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_context.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_fbo.c53
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.c9
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_span.c8
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texstate.c8
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.c12
-rw-r--r--src/mesa/drivers/dri/savage/savage_xmesa.c2
-rw-r--r--src/mesa/drivers/dri/sis/sis_screen.c2
-rw-r--r--src/mesa/drivers/dri/swrast/swrast.c3
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_screen.c3
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.c2
-rw-r--r--src/mesa/drivers/windows/gdi/mesa.def1
-rw-r--r--src/mesa/glapi/glapi.h8
-rw-r--r--src/mesa/main/context.c65
-rw-r--r--src/mesa/main/texstore.c4
-rw-r--r--src/mesa/shader/slang/library/SConscript4
-rw-r--r--src/mesa/shader/slang/slang_compile.c4
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c3
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c14
-rw-r--r--src/mesa/swrast_setup/ss_tritmp.h2
113 files changed, 1303 insertions, 2105 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 92378892e5b..5d36c49b2c9 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -58,15 +58,16 @@ struct dri2_egl_driver
struct dri2_egl_display
{
- xcb_connection_t *conn;
- int dri2_major;
- int dri2_minor;
- __DRIscreen *dri_screen;
- void *driver;
- __DRIcoreExtension *core;
- __DRIdri2Extension *dri2;
- __DRI2flushExtension *flush;
- int fd;
+ xcb_connection_t *conn;
+ int dri2_major;
+ int dri2_minor;
+ __DRIscreen *dri_screen;
+ void *driver;
+ __DRIcoreExtension *core;
+ __DRIdri2Extension *dri2;
+ __DRI2flushExtension *flush;
+ __DRItexBufferExtension *tex_buffer;
+ int fd;
__DRIdri2LoaderExtension loader_extension;
const __DRIextension *extensions[2];
@@ -86,7 +87,6 @@ struct dri2_egl_surface
__DRIbuffer buffers[5];
int buffer_count;
xcb_xfixes_region_t region;
- int have_back;
int have_fake_front;
int swap_interval;
};
@@ -107,7 +107,7 @@ EGLint dri2_to_egl_attribute_map[] = {
EGL_RED_SIZE, /* __DRI_ATTRIB_RED_SIZE */
EGL_GREEN_SIZE, /* __DRI_ATTRIB_GREEN_SIZE */
EGL_BLUE_SIZE, /* __DRI_ATTRIB_BLUE_SIZE */
- 0, /* __DRI_ATTRIB_LUMINANCE_SIZE */
+ EGL_LUMINANCE_SIZE, /* __DRI_ATTRIB_LUMINANCE_SIZE */
EGL_ALPHA_SIZE, /* __DRI_ATTRIB_ALPHA_SIZE */
0, /* __DRI_ATTRIB_ALPHA_MASK_SIZE */
EGL_DEPTH_SIZE, /* __DRI_ATTRIB_DEPTH_SIZE */
@@ -152,28 +152,22 @@ EGLint dri2_to_egl_attribute_map[] = {
};
static void
-dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id)
+dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
+ int depth, xcb_visualtype_t *visual)
{
struct dri2_egl_config *conf;
struct dri2_egl_display *dri2_dpy;
+ _EGLConfig base;
unsigned int attrib, value, double_buffer;
EGLint key, bind_to_texture_rgb, bind_to_texture_rgba;
int i;
dri2_dpy = disp->DriverData;
- conf = malloc(sizeof *conf);
- if (conf == NULL)
- return;
-
- conf->dri_config = dri_config;
- _eglInitConfig(&conf->base, disp, id);
+ _eglInitConfig(&base, disp, id);
i = 0;
while (dri2_dpy->core->indexConfigAttrib(dri_config, i++, &attrib, &value)) {
switch (attrib) {
- case 0:
- break;
-
case __DRI_ATTRIB_RENDER_TYPE:
if (value & __DRI_ATTRIB_RGBA_BIT)
value = EGL_RGB_BUFFER;
@@ -181,7 +175,7 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id)
value = EGL_LUMINANCE_BUFFER;
else
/* not valid */;
- _eglSetConfigKey(&conf->base, EGL_COLOR_BUFFER_TYPE, value);
+ _eglSetConfigKey(&base, EGL_COLOR_BUFFER_TYPE, value);
break;
case __DRI_ATTRIB_CONFIG_CAVEAT:
@@ -191,7 +185,7 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id)
value = EGL_SLOW_CONFIG;
else
value = EGL_NONE;
- _eglSetConfigKey(&conf->base, EGL_CONFIG_CAVEAT, value);
+ _eglSetConfigKey(&base, EGL_CONFIG_CAVEAT, value);
break;
case __DRI_ATTRIB_BIND_TO_TEXTURE_RGB:
@@ -209,39 +203,57 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id)
default:
key = dri2_to_egl_attribute_map[attrib];
if (key != 0)
- _eglSetConfigKey(&conf->base, key, value);
+ _eglSetConfigKey(&base, key, value);
break;
}
}
- /* EGL_SWAP_BEHAVIOR_PRESERVED_BIT */
+ /* In EGL, double buffer or not isn't a config attribute. Pixmaps
+ * surfaces are always single buffered, pbuffer surfaces are always
+ * back buffers and windows can be either, selected by passing an
+ * attribute at window surface construction time. To support this
+ * we ignore all double buffer configs and manipulate the buffer we
+ * return in the getBuffer callback to get the behaviour we want. */
- if (double_buffer) {
- /* FIXME: Figure out how to get the visual ID and types */
- _eglSetConfigKey(&conf->base, EGL_SURFACE_TYPE, EGL_WINDOW_BIT);
- _eglSetConfigKey(&conf->base, EGL_NATIVE_VISUAL_ID, 0x21);
- _eglSetConfigKey(&conf->base, EGL_NATIVE_VISUAL_TYPE,
- XCB_VISUAL_CLASS_TRUE_COLOR);
+ if (double_buffer)
+ return;
+
+ if (visual != NULL) {
+ if (depth != _eglGetConfigKey(&base, EGL_BUFFER_SIZE))
+ return;
+
+ _eglSetConfigKey(&base, EGL_SURFACE_TYPE,
+ EGL_WINDOW_BIT | EGL_PIXMAP_BIT | EGL_PBUFFER_BIT |
+ EGL_SWAP_BEHAVIOR_PRESERVED_BIT);
+
+ _eglSetConfigKey(&base, EGL_NATIVE_VISUAL_ID, visual->visual_id);
+ _eglSetConfigKey(&base, EGL_NATIVE_VISUAL_TYPE, visual->_class);
} else {
- _eglSetConfigKey(&conf->base,
- EGL_SURFACE_TYPE, EGL_PIXMAP_BIT | EGL_PBUFFER_BIT);
- _eglSetConfigKey(&conf->base,
- EGL_BIND_TO_TEXTURE_RGB, bind_to_texture_rgb);
- _eglSetConfigKey(&conf->base,
- EGL_BIND_TO_TEXTURE_RGBA, bind_to_texture_rgba);
+ _eglSetConfigKey(&base, EGL_SURFACE_TYPE,
+ EGL_PIXMAP_BIT | EGL_PBUFFER_BIT);
}
+ _eglSetConfigKey(&base, EGL_NATIVE_RENDERABLE, EGL_TRUE);
+ _eglSetConfigKey(&base, EGL_BIND_TO_TEXTURE_RGB, bind_to_texture_rgb);
+ if (_eglGetConfigKey(&base, EGL_ALPHA_SIZE) > 0)
+ _eglSetConfigKey(&base,
+ EGL_BIND_TO_TEXTURE_RGBA, bind_to_texture_rgba);
+
/* EGL_OPENGL_ES_BIT, EGL_OPENVG_BIT, EGL_OPENGL_ES2_BIT */
- _eglSetConfigKey(&conf->base, EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT);
- _eglSetConfigKey(&conf->base, EGL_CONFORMANT, EGL_OPENGL_BIT);
+ _eglSetConfigKey(&base, EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT);
+ _eglSetConfigKey(&base, EGL_CONFORMANT, EGL_OPENGL_BIT);
- if (!_eglValidateConfig(&conf->base, EGL_FALSE)) {
+ if (!_eglValidateConfig(&base, EGL_FALSE)) {
_eglLog(_EGL_DEBUG, "DRI2: failed to validate config %d", id);
- free(conf);
return;
}
- _eglAddConfig(disp, &conf->base);
+ conf = malloc(sizeof *conf);
+ if (conf != NULL) {
+ memcpy(&conf->base, &base, sizeof base);
+ conf->dri_config = dri_config;
+ _eglAddConfig(disp, &conf->base);
+ }
}
/**
@@ -261,7 +273,6 @@ dri2_process_buffers(struct dri2_egl_surface *dri2_surf,
dri2_surf->buffer_count = count;
dri2_surf->have_fake_front = 0;
- dri2_surf->have_back = 0;
/* This assumes the DRI2 buffer attachment tokens matches the
* __DRIbuffer tokens. */
@@ -271,10 +282,14 @@ dri2_process_buffers(struct dri2_egl_surface *dri2_surf,
dri2_surf->buffers[i].pitch = buffers[i].pitch;
dri2_surf->buffers[i].cpp = buffers[i].cpp;
dri2_surf->buffers[i].flags = buffers[i].flags;
+
+ /* We only use the DRI drivers single buffer configs. This
+ * means that if we try to render to a window, DRI2 will give us
+ * the fake front buffer, which we'll use as a back buffer.
+ * Note that EGL doesn't require that several clients rendering
+ * to the same window must see the same aux buffers. */
if (dri2_surf->buffers[i].attachment == __DRI_BUFFER_FAKE_FRONT_LEFT)
dri2_surf->have_fake_front = 1;
- if (dri2_surf->buffers[i].attachment == __DRI_BUFFER_BACK_LEFT)
- dri2_surf->have_back = 1;
}
if (dri2_surf->region != XCB_NONE)
@@ -375,6 +390,57 @@ static const char dri_driver_format[] = "%.*s/%.*s_dri.so";
static const char dri_driver_path[] = DEFAULT_DRIVER_DIR;
+struct dri2_extension_match {
+ const char *name;
+ int version;
+ int offset;
+};
+
+static struct dri2_extension_match dri2_driver_extensions[] = {
+ { __DRI_CORE, 1, offsetof(struct dri2_egl_display, core) },
+ { __DRI_DRI2, 1, offsetof(struct dri2_egl_display, dri2) },
+ { NULL }
+};
+
+static struct dri2_extension_match dri2_core_extensions[] = {
+ { __DRI2_FLUSH, 1, offsetof(struct dri2_egl_display, flush) },
+ { __DRI_TEX_BUFFER, 2, offsetof(struct dri2_egl_display, tex_buffer) },
+ { NULL }
+};
+
+static EGLBoolean
+dri2_bind_extensions(struct dri2_egl_display *dri2_dpy,
+ struct dri2_extension_match *matches,
+ const __DRIextension **extensions)
+{
+ int i, j, ret = EGL_TRUE;
+ void *field;
+
+ for (i = 0; extensions[i]; i++) {
+ _eglLog(_EGL_DEBUG, "DRI2: found extension `%s'", extensions[i]->name);
+ for (j = 0; matches[j].name; j++) {
+ if (strcmp(extensions[i]->name, matches[j].name) == 0 &&
+ extensions[i]->version >= matches[j].version) {
+ field = ((char *) dri2_dpy + matches[j].offset);
+ *(const __DRIextension **) field = extensions[i];
+ _eglLog(_EGL_INFO, "DRI2: found extension %s version %d",
+ extensions[i]->name, extensions[i]->version);
+ }
+ }
+ }
+
+ for (j = 0; matches[j].name; j++) {
+ field = ((char *) dri2_dpy + matches[j].offset);
+ if (*(const __DRIextension **) field == NULL) {
+ _eglLog(_EGL_FATAL, "DRI2: did not find extension %s version %d",
+ matches[j].name, matches[j].version);
+ ret = EGL_FALSE;
+ }
+ }
+
+ return ret;
+}
+
/**
* Called via eglInitialize(), GLX_drv->API.Initialize().
*/
@@ -397,7 +463,9 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp,
xcb_generic_error_t *error;
drm_magic_t magic;
xcb_screen_iterator_t s;
- int i;
+ xcb_depth_iterator_t d;
+ xcb_visualtype_t *visuals;
+ int i, j, id;
dri2_dpy = malloc(sizeof *dri2_dpy);
if (!dri2_dpy)
@@ -497,24 +565,8 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp,
goto cleanup_driver;
}
- for (i = 0; extensions[i]; i++) {
- _eglLog(_EGL_DEBUG, "DRI2: found driver extension `%s'",
- extensions[i]->name);
- if (strcmp(extensions[i]->name, __DRI_CORE) == 0)
- dri2_dpy->core = (__DRIcoreExtension *) extensions[i];
- if (strcmp(extensions[i]->name, __DRI_DRI2) == 0)
- dri2_dpy->dri2 = (__DRIdri2Extension *) extensions[i];
- }
-
- if (dri2_dpy->core == NULL) {
- _eglLog(_EGL_FATAL, "DRI2: driver has no core extension");
+ if (!dri2_bind_extensions(dri2_dpy, dri2_driver_extensions, extensions))
goto cleanup_driver;
- }
-
- if (dri2_dpy->dri2 == NULL) {
- _eglLog(_EGL_FATAL, "DRI2: driver has no dri2 extension");
- goto cleanup_driver;
- }
snprintf(path, sizeof path, "%.*s",
xcb_dri2_connect_device_name_length (connect),
@@ -570,20 +622,30 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp,
}
extensions = dri2_dpy->core->getExtensions(dri2_dpy->dri_screen);
- for (i = 0; extensions[i]; i++) {
- _eglLog(_EGL_DEBUG, "DRI2: found core extension `%s'",
- extensions[i]->name);
- if ((strcmp(extensions[i]->name, __DRI2_FLUSH) == 0))
- dri2_dpy->flush = (__DRI2flushExtension *) extensions[i];
- }
-
- if (dri2_dpy->flush == NULL) {
- _eglLog(_EGL_FATAL, "DRI2: driver doesn't support the flush extension");
+ if (!dri2_bind_extensions(dri2_dpy, dri2_core_extensions, extensions))
goto cleanup_dri_screen;
+
+ s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn));
+ d = xcb_screen_allowed_depths_iterator(s.data);
+ id = 1;
+ while (d.rem > 0) {
+ EGLBoolean class_added[6] = { 0, };
+
+ visuals = xcb_depth_visuals(d.data);
+ for (i = 0; i < xcb_depth_visuals_length(d.data); i++) {
+ if (class_added[visuals[i]._class])
+ continue;
+
+ class_added[visuals[i]._class] = EGL_TRUE;
+ for (j = 0; driver_configs[j]; j++)
+ dri2_add_config(disp, driver_configs[j],
+ id++, d.data->depth, &visuals[i]);
+
+ }
+
+ xcb_depth_next(&d);
}
- for (i = 0; driver_configs[i]; i++)
- dri2_add_config(disp, driver_configs[i], i + 1);
if (!disp->NumConfigs) {
_eglLog(_EGL_WARNING, "DRI2: failed to create any config");
goto cleanup_configs;
@@ -852,21 +914,22 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
#if 0
/* FIXME: Add support for dri swapbuffers, that'll give us swap
* interval and page flipping (at least for fullscreen windows) as
- * well as the page flip event. */
+ * well as the page flip event. Unless surface->SwapBehavior is
+ * EGL_BUFFER_PRESERVED. */
#if __DRI2_FLUSH_VERSION >= 2
if (pdraw->psc->f)
(*pdraw->psc->f->flushInvalidate)(pdraw->driDrawable);
#endif
#endif
- if (!dri2_surf->have_back)
+ if (!dri2_surf->have_fake_front)
return EGL_TRUE;
cookie = xcb_dri2_copy_region_unchecked(dri2_dpy->conn,
dri2_surf->drawable,
dri2_surf->region,
XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT,
- XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT);
+ XCB_DRI2_ATTACHMENT_BUFFER_FAKE_FRONT_LEFT);
free(xcb_dri2_copy_region_reply(dri2_dpy->conn, cookie, NULL));
return EGL_TRUE;
@@ -939,6 +1002,69 @@ dri2_copy_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
return EGL_TRUE;
}
+static EGLBoolean
+dri2_bind_tex_image(_EGLDriver *drv,
+ _EGLDisplay *disp, _EGLSurface *surf, EGLint buffer)
+{
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+ struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
+ struct dri2_egl_context *dri2_ctx;
+ _EGLContext *ctx;
+ GLint format, target;
+
+ ctx = _eglGetCurrentContext();
+ dri2_ctx = dri2_egl_context(ctx);
+
+ if (buffer != EGL_BACK_BUFFER) {
+ _eglError(EGL_BAD_PARAMETER, "eglBindTexImage");
+ return EGL_FALSE;
+ }
+
+ /* We allow binding pixmaps too... Not conformat, but we can do it
+ * for free and it's useful for X compositors. Supposedly there's
+ * a EGL_NOKIA_texture_from_pixmap extension that allows that, but
+ * I couldn't find it at this time. */
+ if ((dri2_surf->base.Type & (EGL_PBUFFER_BIT | EGL_PIXMAP_BIT)) == 0) {
+ _eglError(EGL_BAD_SURFACE, "eglBindTexImage");
+ return EGL_FALSE;
+ }
+
+ switch (dri2_surf->base.TextureFormat) {
+ case EGL_TEXTURE_RGB:
+ format = __DRI_TEXTURE_FORMAT_RGB;
+ break;
+ case EGL_TEXTURE_RGBA:
+ format = __DRI_TEXTURE_FORMAT_RGBA;
+ break;
+ default:
+ _eglError(EGL_BAD_MATCH, "eglBindTexImage");
+ return EGL_FALSE;
+ }
+
+ switch (dri2_surf->base.TextureTarget) {
+ case EGL_TEXTURE_2D:
+ target = GL_TEXTURE_2D;
+ break;
+ default:
+ _eglError(EGL_BAD_PARAMETER, "eglBindTexImage");
+ return EGL_FALSE;
+ }
+
+ (*dri2_dpy->tex_buffer->setTexBuffer2)(dri2_ctx->dri_context,
+ target, format,
+ dri2_surf->dri_drawable);
+
+ return dri2_surf->base.BoundToTexture = EGL_TRUE;
+}
+
+static EGLBoolean
+dri2_release_tex_image(_EGLDriver *drv,
+ _EGLDisplay *disp, _EGLSurface *surf, EGLint buffer)
+{
+ return EGL_TRUE;
+}
+
+
/**
* This is the main entrypoint into the driver, called by libEGL.
* Create a new _EGLDriver object and init its dispatch table.
@@ -966,6 +1092,8 @@ _eglMain(const char *args)
dri2_drv->base.API.WaitClient = dri2_wait_client;
dri2_drv->base.API.WaitNative = dri2_wait_native;
dri2_drv->base.API.CopyBuffers = dri2_copy_buffers;
+ dri2_drv->base.API.BindTexImage = dri2_bind_tex_image;
+ dri2_drv->base.API.ReleaseTexImage = dri2_release_tex_image;
dri2_drv->base.Name = "DRI2";
dri2_drv->base.Unload = dri2_unload;
diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile
index 02c65a9b2d9..507ca6e6aaa 100644
--- a/src/gallium/auxiliary/Makefile
+++ b/src/gallium/auxiliary/Makefile
@@ -166,6 +166,9 @@ CPP_SOURCES += \
endif
+LIBRARY_DEFINES += -D__STDC_CONSTANT_MACROS
+
+
include ../Makefile.template
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_interp.c b/src/gallium/auxiliary/gallivm/lp_bld_interp.c
index a6acaead887..2fc894017d8 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_interp.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_interp.c
@@ -376,6 +376,7 @@ lp_build_interp_soa_init(struct lp_build_interp_soa_context *bld,
case TGSI_TOKEN_TYPE_INSTRUCTION:
case TGSI_TOKEN_TYPE_IMMEDIATE:
+ case TGSI_TOKEN_TYPE_PROPERTY:
break;
default:
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index a52c6c50288..4cf28a9f934 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -1403,8 +1403,7 @@ emit_instruction(
break;
case TGSI_OPCODE_CONT:
- /* deprecated? */
- assert(0);
+ /* FIXME */
return 0;
break;
@@ -1499,6 +1498,9 @@ lp_build_tgsi_soa(LLVMBuilderRef builder,
}
break;
+ case TGSI_TOKEN_TYPE_PROPERTY:
+ break;
+
default:
assert( 0 );
}
diff --git a/src/gallium/auxiliary/os/os_thread.h b/src/gallium/auxiliary/os/os_thread.h
index 8ae90308c53..a04df4106f2 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -116,25 +116,6 @@ typedef pthread_cond_t pipe_condvar;
pthread_cond_broadcast(&(cond))
-/* pipe_barrier
- */
-typedef pthread_barrier_t pipe_barrier;
-
-static INLINE void pipe_barrier_init(pipe_barrier *barrier, unsigned count)
-{
- pthread_barrier_init(barrier, NULL, count);
-}
-
-static INLINE void pipe_barrier_destroy(pipe_barrier *barrier)
-{
- pthread_barrier_destroy(barrier);
-}
-
-static INLINE void pipe_barrier_wait(pipe_barrier *barrier)
-{
- pthread_barrier_wait(barrier);
-}
-
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
@@ -208,26 +189,6 @@ typedef unsigned pipe_condvar;
(void) cond
-/* pipe_barrier (XXX FIX THIS)
- */
-typedef unsigned pipe_barrier;
-
-static INLINE void pipe_barrier_init(pipe_barrier *barrier, unsigned count)
-{
- /* XXX we could implement barriers with a mutex and condition var */
-}
-
-static INLINE void pipe_barrier_destroy(pipe_barrier *barrier)
-{
-}
-
-static INLINE void pipe_barrier_wait(pipe_barrier *barrier)
-{
- assert(0);
-}
-
-
-
#else
/** Dummy definitions */
@@ -254,7 +215,6 @@ static INLINE int pipe_thread_destroy( pipe_thread thread )
typedef unsigned pipe_mutex;
typedef unsigned pipe_condvar;
-typedef unsigned pipe_barrier;
#define pipe_static_mutex(mutex) \
static pipe_mutex mutex = 0
@@ -290,6 +250,57 @@ typedef unsigned pipe_barrier;
(void) condvar
+#endif /* PIPE_OS_? */
+
+
+/*
+ * pipe_barrier
+ */
+
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU)
+
+typedef pthread_barrier_t pipe_barrier;
+
+static INLINE void pipe_barrier_init(pipe_barrier *barrier, unsigned count)
+{
+ pthread_barrier_init(barrier, NULL, count);
+}
+
+static INLINE void pipe_barrier_destroy(pipe_barrier *barrier)
+{
+ pthread_barrier_destroy(barrier);
+}
+
+static INLINE void pipe_barrier_wait(pipe_barrier *barrier)
+{
+ pthread_barrier_wait(barrier);
+}
+
+
+#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+
+/* XXX FIX THIS */
+typedef unsigned pipe_barrier;
+
+static INLINE void pipe_barrier_init(pipe_barrier *barrier, unsigned count)
+{
+ /* XXX we could implement barriers with a mutex and condition var */
+}
+
+static INLINE void pipe_barrier_destroy(pipe_barrier *barrier)
+{
+}
+
+static INLINE void pipe_barrier_wait(pipe_barrier *barrier)
+{
+ assert(0);
+}
+
+
+#else
+
+typedef unsigned pipe_barrier;
+
static INLINE void pipe_barrier_init(pipe_barrier *barrier, unsigned count)
{
/* XXX we could implement barriers with a mutex and condition var */
@@ -307,8 +318,7 @@ static INLINE void pipe_barrier_wait(pipe_barrier *barrier)
}
-
-#endif /* PIPE_OS_? */
+#endif
/*
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
index c1498318dfb..53bc019a204 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
@@ -65,7 +65,7 @@ struct pb_cache_buffer
struct pb_cache_manager *mgr;
/** Caching time interval */
- struct util_time start, end;
+ int64_t start, end;
struct list_head head;
};
@@ -126,16 +126,16 @@ _pb_cache_buffer_list_check_free(struct pb_cache_manager *mgr)
{
struct list_head *curr, *next;
struct pb_cache_buffer *buf;
- struct util_time now;
+ int64_t now;
- util_time_get(&now);
+ now = os_time_get();
curr = mgr->delayed.next;
next = curr->next;
while(curr != &mgr->delayed) {
buf = LIST_ENTRY(struct pb_cache_buffer, curr, head);
- if(!util_time_timeout(&buf->start, &buf->end, &now))
+ if(!os_time_timeout(buf->start, buf->end, now))
break;
_pb_cache_buffer_destroy(buf);
@@ -157,8 +157,8 @@ pb_cache_buffer_destroy(struct pb_buffer *_buf)
_pb_cache_buffer_list_check_free(mgr);
- util_time_get(&buf->start);
- util_time_add(&buf->start, mgr->usecs, &buf->end);
+ buf->start = os_time_get();
+ buf->end = buf->start + mgr->usecs;
LIST_ADDTAIL(&buf->head, &mgr->delayed);
++mgr->numDelayed;
pipe_mutex_unlock(mgr->mutex);
@@ -253,7 +253,7 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr,
struct pb_cache_buffer *buf;
struct pb_cache_buffer *curr_buf;
struct list_head *curr, *next;
- struct util_time now;
+ int64_t now;
pipe_mutex_lock(mgr->mutex);
@@ -262,12 +262,12 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr,
next = curr->next;
/* search in the expired buffers, freeing them in the process */
- util_time_get(&now);
+ now = os_time_get();
while(curr != &mgr->delayed) {
curr_buf = LIST_ENTRY(struct pb_cache_buffer, curr, head);
if(!buf && pb_cache_is_buffer_compat(curr_buf, size, desc))
buf = curr_buf;
- else if(util_time_timeout(&curr_buf->start, &curr_buf->end, &now))
+ else if(os_time_timeout(curr_buf->start, curr_buf->end, now))
_pb_cache_buffer_destroy(curr_buf);
else
/* This buffer (and all hereafter) are still hot in cache */
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
index 93f8960641f..c2593cf1653 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
@@ -349,7 +349,7 @@ pb_debug_manager_dump(struct pb_debug_manager *mgr)
while(curr != &mgr->list) {
buf = LIST_ENTRY(struct pb_debug_buffer, curr, head);
- debug_printf("buffer = %p\n", buf);
+ debug_printf("buffer = %p\n", (void *) buf);
debug_printf(" .size = 0x%x\n", buf->base.base.size);
debug_backtrace_dump(buf->create_backtrace, PB_DEBUG_CREATE_BACKTRACE);
diff --git a/src/gallium/auxiliary/util/u_timed_winsys.c b/src/gallium/auxiliary/util/u_timed_winsys.c
index 59bdcd2c451..d88298bc14c 100644
--- a/src/gallium/auxiliary/util/u_timed_winsys.c
+++ b/src/gallium/auxiliary/util/u_timed_winsys.c
@@ -33,7 +33,7 @@
#include "util/u_simple_screen.h"
#include "u_timed_winsys.h"
#include "util/u_memory.h"
-#include "util/u_time.h"
+#include "os/os_time.h"
struct timed_winsys {
@@ -54,12 +54,6 @@ static struct timed_winsys *timed_winsys( struct pipe_winsys *winsys )
}
-static uint64_t time_start( void )
-{
- return util_time_micros();
-}
-
-
static void time_display( struct pipe_winsys *winsys )
{
struct timed_winsys *tws = timed_winsys(winsys);
@@ -90,7 +84,7 @@ static void time_finish( struct pipe_winsys *winsys,
const char *name )
{
struct timed_winsys *tws = timed_winsys(winsys);
- uint64_t endval = util_time_micros();
+ int64_t endval = os_time_get();
double elapsed = (endval - startval)/1000.0;
if (endval - startval > 1000LL)
@@ -120,7 +114,7 @@ timed_buffer_create(struct pipe_winsys *winsys,
unsigned size )
{
struct pipe_winsys *backend = timed_winsys(winsys)->backend;
- uint64_t start = time_start();
+ int64_t start = os_time_get();
struct pipe_buffer *buf =
backend->buffer_create( backend, alignment, usage, size );
@@ -139,7 +133,7 @@ timed_user_buffer_create(struct pipe_winsys *winsys,
unsigned bytes)
{
struct pipe_winsys *backend = timed_winsys(winsys)->backend;
- uint64_t start = time_start();
+ int64_t start = os_time_get();
struct pipe_buffer *buf = backend->user_buffer_create( backend, data, bytes );
@@ -155,7 +149,7 @@ timed_buffer_map(struct pipe_winsys *winsys,
unsigned flags)
{
struct pipe_winsys *backend = timed_winsys(winsys)->backend;
- uint64_t start = time_start();
+ int64_t start = os_time_get();
void *map = backend->buffer_map( backend, buf, flags );
@@ -170,7 +164,7 @@ timed_buffer_unmap(struct pipe_winsys *winsys,
struct pipe_buffer *buf)
{
struct pipe_winsys *backend = timed_winsys(winsys)->backend;
- uint64_t start = time_start();
+ int64_t start = os_time_get();
backend->buffer_unmap( backend, buf );
@@ -183,7 +177,7 @@ timed_buffer_destroy(struct pipe_buffer *buf)
{
struct pipe_winsys *winsys = buf->screen->winsys;
struct pipe_winsys *backend = timed_winsys(winsys)->backend;
- uint64_t start = time_start();
+ int64_t start = os_time_get();
backend->buffer_destroy( buf );
@@ -197,7 +191,7 @@ timed_flush_frontbuffer( struct pipe_winsys *winsys,
void *context_private)
{
struct pipe_winsys *backend = timed_winsys(winsys)->backend;
- uint64_t start = time_start();
+ int64_t start = os_time_get();
backend->flush_frontbuffer( backend, surf, context_private );
@@ -216,7 +210,7 @@ timed_surface_buffer_create(struct pipe_winsys *winsys,
unsigned *stride)
{
struct pipe_winsys *backend = timed_winsys(winsys)->backend;
- uint64_t start = time_start();
+ int64_t start = os_time_get();
struct pipe_buffer *ret = backend->surface_buffer_create( backend, width, height,
format, usage, tex_usage, stride );
@@ -231,7 +225,7 @@ static const char *
timed_get_name( struct pipe_winsys *winsys )
{
struct pipe_winsys *backend = timed_winsys(winsys)->backend;
- uint64_t start = time_start();
+ int64_t start = os_time_get();
const char *ret = backend->get_name( backend );
@@ -246,7 +240,7 @@ timed_fence_reference(struct pipe_winsys *winsys,
struct pipe_fence_handle *fence)
{
struct pipe_winsys *backend = timed_winsys(winsys)->backend;
- uint64_t start = time_start();
+ int64_t start = os_time_get();
backend->fence_reference( backend, ptr, fence );
@@ -260,7 +254,7 @@ timed_fence_signalled( struct pipe_winsys *winsys,
unsigned flag )
{
struct pipe_winsys *backend = timed_winsys(winsys)->backend;
- uint64_t start = time_start();
+ int64_t start = os_time_get();
int ret = backend->fence_signalled( backend, fence, flag );
@@ -275,7 +269,7 @@ timed_fence_finish( struct pipe_winsys *winsys,
unsigned flag )
{
struct pipe_winsys *backend = timed_winsys(winsys)->backend;
- uint64_t start = time_start();
+ int64_t start = os_time_get();
int ret = backend->fence_finish( backend, fence, flag );
diff --git a/src/gallium/drivers/i965/brw_swtnl.c b/src/gallium/drivers/i965/brw_swtnl.c
index 464013e7c40..f96301e99e6 100644
--- a/src/gallium/drivers/i965/brw_swtnl.c
+++ b/src/gallium/drivers/i965/brw_swtnl.c
@@ -3,6 +3,8 @@
#include "brw_pipe_rast.h"
+#if 0
+
static GLboolean need_swtnl( struct brw_context *brw )
{
const struct pipe_rasterizer_state *rast = &brw->curr.rast->templ;
@@ -90,6 +92,4 @@ static GLboolean need_swtnl( struct brw_context *brw )
return FALSE;
}
-
-
-
+#endif
diff --git a/src/gallium/drivers/i965/brw_vs_emit.c b/src/gallium/drivers/i965/brw_vs_emit.c
index 8a16205d2f6..5dcbd597ddc 100644
--- a/src/gallium/drivers/i965/brw_vs_emit.c
+++ b/src/gallium/drivers/i965/brw_vs_emit.c
@@ -908,6 +908,7 @@ get_constant(struct brw_vs_compile *c,
}
+#if 0
/* TODO: relative addressing!
*/
@@ -936,6 +937,8 @@ static struct brw_reg get_reg( struct brw_vs_compile *c,
}
}
+#endif
+
/**
* Indirect addressing: get reg[[arg] + offset].
diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile
index e880042b71e..31732514379 100644
--- a/src/gallium/drivers/llvmpipe/Makefile
+++ b/src/gallium/drivers/llvmpipe/Makefile
@@ -37,7 +37,6 @@ C_SOURCES = \
lp_surface.c \
lp_tex_sample_llvm.c \
lp_texture.c \
- lp_tile_surface.c \
lp_tile_soa.c
CPP_SOURCES = \
@@ -49,11 +48,6 @@ lp_tile_soa.c: lp_tile_soa.py ../../auxiliary/util/u_format_parse.py ../../auxil
python lp_tile_soa.py ../../auxiliary/util/u_format.csv > $@
-# to make a .s file to inspect assembly code
-.c.s:
- $(CC) -S $(INCLUDES) $(DEFINES) $(CFLAGS) $(LIBRARY_DEFINES) $<
-
-
testprogs := lp_test_format \
lp_test_blend \
lp_test_conv
diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c
index 808f4903615..9120226de0c 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.c
+++ b/src/gallium/drivers/llvmpipe/lp_context.c
@@ -42,8 +42,6 @@
#include "lp_perf.h"
#include "lp_state.h"
#include "lp_surface.h"
-#include "lp_texture.h"
-#include "lp_winsys.h"
#include "lp_query.h"
#include "lp_setup.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c
index 27b54c59598..d3d7e26882d 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.c
+++ b/src/gallium/drivers/llvmpipe/lp_jit.c
@@ -40,7 +40,6 @@
#include "lp_debug.h"
#include "lp_screen.h"
#include "gallivm/lp_bld_intr.h"
-#include "gallivm/lp_bld_misc.h"
#include "lp_jit.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index 5ae323fd96c..6dbcb3c9b31 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -229,13 +229,58 @@ void lp_rast_clear_zstencil( struct lp_rasterizer *rast,
unsigned thread_index,
const union lp_rast_cmd_arg arg)
{
- unsigned i;
- uint32_t *depth_tile = rast->tasks[thread_index].tile.depth;
-
+ struct lp_rasterizer_task *task = &rast->tasks[thread_index];
+ const unsigned tile_x = task->x;
+ const unsigned tile_y = task->y;
+ const unsigned height = TILE_SIZE/TILE_VECTOR_HEIGHT;
+ const unsigned width = TILE_SIZE*TILE_VECTOR_HEIGHT;
+ unsigned block_size = util_format_get_blocksize(rast->zsbuf_transfer->texture->format);
+ uint8_t *dst;
+ unsigned dst_stride = rast->zsbuf_transfer->stride*TILE_VECTOR_HEIGHT;
+ unsigned i, j;
+
LP_DBG(DEBUG_RAST, "%s 0x%x\n", __FUNCTION__, arg.clear_zstencil);
- for (i = 0; i < TILE_SIZE * TILE_SIZE; i++)
- depth_tile[i] = arg.clear_zstencil;
+ assert(rast->zsbuf_map);
+ if (!rast->zsbuf_map)
+ return;
+
+ LP_DBG(DEBUG_RAST, "%s\n", __FUNCTION__);
+
+ /*
+ * Clear the aera of the swizzled depth/depth buffer matching this tile, in
+ * stripes of TILE_VECTOR_HEIGHT x TILE_SIZE at a time.
+ *
+ * The swizzled depth format is such that the depths for
+ * TILE_VECTOR_HEIGHT x TILE_VECTOR_WIDTH pixels have consecutive offsets.
+ */
+
+ dst = lp_rast_depth_pointer(rast, tile_x, tile_y);
+
+ switch (block_size) {
+ case 1:
+ memset(dst, (uint8_t) arg.clear_zstencil, height * width);
+ break;
+ case 2:
+ for (i = 0; i < height; i++) {
+ uint16_t *row = (uint16_t *)dst;
+ for (j = 0; j < width; j++)
+ *row++ = (uint16_t) arg.clear_zstencil;
+ dst += dst_stride;
+ }
+ break;
+ case 4:
+ for (i = 0; i < height; i++) {
+ uint32_t *row = (uint32_t *)dst;
+ for (j = 0; j < width; j++)
+ *row++ = arg.clear_zstencil;
+ dst += dst_stride;
+ }
+ break;
+ default:
+ assert(0);
+ break;
+ }
}
@@ -282,53 +327,6 @@ void lp_rast_load_color( struct lp_rasterizer *rast,
}
-static void
-lp_tile_read_z32(uint32_t *tile,
- const uint8_t *map,
- unsigned map_stride,
- unsigned x0, unsigned y0, unsigned w, unsigned h)
-{
- unsigned x, y;
- const uint8_t *map_row = map + y0*map_stride;
- for (y = 0; y < h; ++y) {
- const uint32_t *map_pixel = (uint32_t *)(map_row + x0*4);
- for (x = 0; x < w; ++x) {
- *tile++ = *map_pixel++;
- }
- map_row += map_stride;
- }
-}
-
-/**
- * Load tile z/stencil from the framebuffer surface.
- * This is a bin command called during bin processing.
- */
-void lp_rast_load_zstencil( struct lp_rasterizer *rast,
- unsigned thread_index,
- const union lp_rast_cmd_arg arg )
-{
- struct lp_rasterizer_task *task = &rast->tasks[thread_index];
- const unsigned x = task->x;
- const unsigned y = task->y;
- unsigned w = TILE_SIZE;
- unsigned h = TILE_SIZE;
-
- if (x + w > rast->state.fb.width)
- w -= x + w - rast->state.fb.width;
-
- if (y + h > rast->state.fb.height)
- h -= y + h - rast->state.fb.height;
-
- LP_DBG(DEBUG_RAST, "%s %d,%d %dx%d\n", __FUNCTION__, x, y, w, h);
-
- assert(rast->zsbuf_transfer->texture->format == PIPE_FORMAT_Z32_UNORM);
- lp_tile_read_z32(task->tile.depth,
- rast->zsbuf_map,
- rast->zsbuf_transfer->stride,
- x, y, w, h);
-}
-
-
void lp_rast_set_state( struct lp_rasterizer *rast,
unsigned thread_index,
const union lp_rast_cmd_arg arg )
@@ -377,7 +375,7 @@ void lp_rast_shade_tile( struct lp_rasterizer *rast,
color[i] = tile->color[i] + 4 * block_offset;
/* depth buffer */
- depth = tile->depth + block_offset;
+ depth = lp_rast_depth_pointer(rast, tile_x + x, tile_y + y);
/* run shader */
state->jit_function[0]( &state->jit_context,
@@ -435,12 +433,11 @@ void lp_rast_shade_quads( struct lp_rasterizer *rast,
color[i] = tile->color[i] + 4 * block_offset;
/* depth buffer */
- depth = tile->depth + block_offset;
+ depth = lp_rast_depth_pointer(rast, x, y);
#ifdef DEBUG
- assert(lp_check_alignment(tile->depth, 16));
assert(lp_check_alignment(tile->color[0], 16));
assert(lp_check_alignment(state->jit_context.blend_color, 16));
@@ -557,49 +554,6 @@ static void lp_rast_store_color( struct lp_rasterizer *rast,
}
-static void
-lp_tile_write_z32(const uint32_t *src, uint8_t *dst, unsigned dst_stride,
- unsigned x0, unsigned y0, unsigned w, unsigned h)
-{
- unsigned x, y;
- uint8_t *dst_row = dst + y0*dst_stride;
- for (y = 0; y < h; ++y) {
- uint32_t *dst_pixel = (uint32_t *)(dst_row + x0*4);
- for (x = 0; x < w; ++x) {
- *dst_pixel++ = *src++;
- }
- dst_row += dst_stride;
- }
-}
-
-/**
- * Write the rasterizer's z/stencil tile to the framebuffer.
- */
-static void lp_rast_store_zstencil( struct lp_rasterizer *rast,
- unsigned thread_index )
-{
- struct lp_rasterizer_task *task = &rast->tasks[thread_index];
- const unsigned x = task->x;
- const unsigned y = task->y;
- unsigned w = TILE_SIZE;
- unsigned h = TILE_SIZE;
-
- if (x + w > rast->state.fb.width)
- w -= x + w - rast->state.fb.width;
-
- if (y + h > rast->state.fb.height)
- h -= y + h - rast->state.fb.height;
-
- LP_DBG(DEBUG_RAST, "%s %d,%d %dx%d\n", __FUNCTION__, x, y, w, h);
-
- assert(rast->zsbuf_transfer->texture->format == PIPE_FORMAT_Z32_UNORM);
- lp_tile_write_z32(task->tile.depth,
- rast->zsbuf_map,
- rast->zsbuf_transfer->stride,
- x, y, w, h);
-}
-
-
/**
* Write the rasterizer's tiles to the framebuffer.
*/
@@ -611,9 +565,6 @@ lp_rast_end_tile( struct lp_rasterizer *rast,
if (rast->state.write_color)
lp_rast_store_color(rast, thread_index);
-
- if (rast->state.write_zstencil)
- lp_rast_store_zstencil(rast, thread_index);
}
@@ -694,7 +645,6 @@ static struct {
} cmd_names[] =
{
RAST(load_color),
- RAST(load_zstencil),
RAST(clear_color),
RAST(clear_zstencil),
RAST(triangle),
@@ -753,7 +703,6 @@ is_empty_bin( const struct cmd_bin *bin )
for (i = 0; i < head->count; i++)
if (head->cmd[i] != lp_rast_load_color &&
- head->cmd[i] != lp_rast_load_zstencil &&
head->cmd[i] != lp_rast_set_state) {
return FALSE;
}
@@ -993,7 +942,6 @@ lp_rast_create( struct pipe_screen *screen, struct lp_scene_queue *empty )
for (cbuf = 0; cbuf < PIPE_MAX_COLOR_BUFS; cbuf++ )
task->tile.color[cbuf] = align_malloc(TILE_SIZE * TILE_SIZE * 4, 16);
- task->tile.depth = align_malloc(TILE_SIZE * TILE_SIZE * 4, 16);
task->rast = rast;
task->thread_index = i;
}
@@ -1016,7 +964,6 @@ void lp_rast_destroy( struct lp_rasterizer *rast )
util_unreference_framebuffer_state(&rast->state.fb);
for (i = 0; i < Elements(rast->tasks); i++) {
- align_free(rast->tasks[i].tile.depth);
for (cbuf = 0; cbuf < PIPE_MAX_COLOR_BUFS; cbuf++ )
align_free(rast->tasks[i].tile.color[cbuf]);
}
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h
index 34da73eb50e..875f18e0c0c 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast.h
@@ -213,10 +213,6 @@ void lp_rast_load_color( struct lp_rasterizer *,
unsigned thread_index,
const union lp_rast_cmd_arg );
-void lp_rast_load_zstencil( struct lp_rasterizer *,
- unsigned thread_index,
- const union lp_rast_cmd_arg );
-
void lp_rast_set_state( struct lp_rasterizer *,
unsigned thread_index,
const union lp_rast_cmd_arg );
diff --git a/src/gallium/drivers/llvmpipe/lp_rast_priv.h b/src/gallium/drivers/llvmpipe/lp_rast_priv.h
index 71e3a301e61..5c5497e0929 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast_priv.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast_priv.h
@@ -29,6 +29,8 @@
#define LP_RAST_PRIV_H
#include "os/os_thread.h"
+#include "util/u_format.h"
+#include "gallivm/lp_bld_debug.h"
#include "lp_rast.h"
#include "lp_tile_soa.h"
@@ -48,8 +50,6 @@ struct lp_rasterizer;
struct lp_rast_tile
{
uint8_t *color[PIPE_MAX_COLOR_BUFS];
-
- uint32_t *depth;
};
@@ -91,7 +91,7 @@ struct lp_rasterizer
struct pipe_transfer *cbuf_transfer[PIPE_MAX_COLOR_BUFS];
struct pipe_transfer *zsbuf_transfer;
void *cbuf_map[PIPE_MAX_COLOR_BUFS];
- void *zsbuf_map;
+ uint8_t *zsbuf_map;
struct {
struct pipe_framebuffer_state fb;
@@ -129,6 +129,31 @@ void lp_rast_shade_quads( struct lp_rasterizer *rast,
/**
+ * Get the pointer to the depth buffer for a block.
+ * \param x, y location of 4x4 block in window coords
+ */
+static INLINE void *
+lp_rast_depth_pointer( struct lp_rasterizer *rast,
+ unsigned x, unsigned y )
+{
+ void * depth;
+ assert((x % TILE_VECTOR_WIDTH) == 0);
+ assert((y % TILE_VECTOR_HEIGHT) == 0);
+ if(!rast->zsbuf_map)
+ return NULL;
+ assert(rast->zsbuf_transfer);
+ depth = rast->zsbuf_map +
+ y*rast->zsbuf_transfer->stride +
+ TILE_VECTOR_HEIGHT*x*util_format_get_blocksize(rast->zsbuf_transfer->texture->format);
+#ifdef DEBUG
+ assert(lp_check_alignment(depth, 16));
+#endif
+ return depth;
+}
+
+
+
+/**
* Shade all pixels in a 4x4 block. The fragment code omits the
* triangle in/out tests.
* \param x, y location of 4x4 block in window coords
@@ -153,8 +178,7 @@ lp_rast_shade_quads_all( struct lp_rasterizer *rast,
for (i = 0; i < rast->state.fb.nr_cbufs; i++)
color[i] = tile->color[i] + 4 * block_offset;
- /* depth buffer */
- depth = tile->depth + block_offset;
+ depth = lp_rast_depth_pointer(rast, x, y);
/* run shader */
state->jit_function[0]( &state->jit_context,
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 3186069899d..538492bebac 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -45,6 +45,8 @@
#include "lp_fence.h"
#include "lp_rast.h"
#include "lp_setup_context.h"
+#include "lp_screen.h"
+#include "lp_winsys.h"
#include "draw/draw_context.h"
#include "draw/draw_vbuf.h"
@@ -172,10 +174,6 @@ begin_binning( struct setup_context *setup )
lp_scene_bin_everywhere( scene,
lp_rast_clear_zstencil,
setup->clear.zstencil );
- else
- lp_scene_bin_everywhere( scene,
- lp_rast_load_zstencil,
- lp_rast_arg_null() );
}
LP_DBG(DEBUG_SETUP, "%s done\n", __FUNCTION__);
@@ -476,11 +474,20 @@ lp_setup_set_sampler_textures( struct setup_context *setup,
jit_tex->width = tex->width0;
jit_tex->height = tex->height0;
jit_tex->stride = lp_tex->stride[0];
- if(!lp_tex->dt)
+ if(!lp_tex->dt) {
jit_tex->data = lp_tex->data;
- else
- /* FIXME: map the rendertarget */
- assert(0);
+ }
+ else {
+ /*
+ * XXX: Where should this be unmapped?
+ */
+
+ struct llvmpipe_screen *screen = llvmpipe_screen(tex->screen);
+ struct llvmpipe_winsys *winsys = screen->winsys;
+ jit_tex->data = winsys->displaytarget_map(winsys, lp_tex->dt,
+ PIPE_BUFFER_USAGE_CPU_READ);
+ assert(jit_tex->data);
+ }
/* the scene references this texture */
{
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index 9e59a6602cc..a8bf540803b 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -442,8 +442,11 @@ do_triangle_ccw(struct setup_context *setup,
maxx = maxx / TILE_SIZE;
maxy = maxy / TILE_SIZE;
- /* Clamp maxx, maxy to framebuffer size
+ /*
+ * Clamp to framebuffer size
*/
+ minx = MAX2(minx, 0);
+ miny = MAX2(miny, 0);
maxx = MIN2(maxx, scene->tiles_x - 1);
maxy = MIN2(maxy, scene->tiles_y - 1);
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c
index 156cb2d229b..81bc296ab44 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -55,7 +55,7 @@ nouveau_screen_bo_new(struct pipe_screen *pscreen, unsigned alignment,
{
struct nouveau_device *dev = nouveau_screen(pscreen)->device;
struct nouveau_bo *bo = NULL;
- uint32_t flags = NOUVEAU_BO_MAP;
+ uint32_t flags = NOUVEAU_BO_MAP, tile_mode = 0, tile_flags = 0;
int ret;
if (usage & NOUVEAU_BUFFER_USAGE_TRANSFER)
@@ -77,13 +77,15 @@ nouveau_screen_bo_new(struct pipe_screen *pscreen, unsigned alignment,
flags |= NOUVEAU_BO_VRAM;
if (dev->chipset == 0x50 || dev->chipset >= 0x80) {
- flags |= NOUVEAU_BO_TILED;
if (usage & NOUVEAU_BUFFER_USAGE_ZETA)
- flags |= NOUVEAU_BO_ZTILE;
+ tile_flags = 0x2800;
+ else
+ tile_flags = 0x7000;
}
}
- ret = nouveau_bo_new(dev, flags, alignment, size, &bo);
+ ret = nouveau_bo_new_tile(dev, flags, alignment, size,
+ tile_mode, tile_flags, &bo);
if (ret)
return NULL;
diff --git a/src/gallium/drivers/nv10/nv10_state.c b/src/gallium/drivers/nv10/nv10_state.c
deleted file mode 100644
index 6f674d6e13f..00000000000
--- a/src/gallium/drivers/nv10/nv10_state.c
+++ /dev/null
@@ -1,590 +0,0 @@
-#include "draw/draw_context.h"
-#include "pipe/p_state.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_shader_tokens.h"
-#include "pipe/p_inlines.h"
-
-#include "tgsi/tgsi_parse.h"
-
-#include "nv10_context.h"
-#include "nv10_state.h"
-
-static void *
-nv10_blend_state_create(struct pipe_context *pipe,
- const struct pipe_blend_state *cso)
-{
- struct nv10_blend_state *cb;
-
- cb = MALLOC(sizeof(struct nv10_blend_state));
-
- cb->b_enable = cso->blend_enable ? 1 : 0;
- cb->b_srcfunc = ((nvgl_blend_func(cso->alpha_src_factor)<<16) |
- (nvgl_blend_func(cso->rgb_src_factor)));
- cb->b_dstfunc = ((nvgl_blend_func(cso->alpha_dst_factor)<<16) |
- (nvgl_blend_func(cso->rgb_dst_factor)));
-
- cb->c_mask = (((cso->colormask & PIPE_MASK_A) ? (0x01<<24) : 0) |
- ((cso->colormask & PIPE_MASK_R) ? (0x01<<16) : 0) |
- ((cso->colormask & PIPE_MASK_G) ? (0x01<< 8) : 0) |
- ((cso->colormask & PIPE_MASK_B) ? (0x01<< 0) : 0));
-
- cb->d_enable = cso->dither ? 1 : 0;
-
- return (void *)cb;
-}
-
-static void
-nv10_blend_state_bind(struct pipe_context *pipe, void *blend)
-{
- struct nv10_context *nv10 = nv10_context(pipe);
-
- nv10->blend = (struct nv10_blend_state*)blend;
-
- nv10->dirty |= NV10_NEW_BLEND;
-}
-
-static void
-nv10_blend_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- FREE(hwcso);
-}
-
-
-static INLINE unsigned
-wrap_mode(unsigned wrap) {
- unsigned ret;
-
- switch (wrap) {
- case PIPE_TEX_WRAP_REPEAT:
- ret = NV10TCL_TX_FORMAT_WRAP_S_REPEAT;
- break;
- case PIPE_TEX_WRAP_MIRROR_REPEAT:
- ret = NV10TCL_TX_FORMAT_WRAP_S_MIRRORED_REPEAT;
- break;
- case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
- ret = NV10TCL_TX_FORMAT_WRAP_S_CLAMP_TO_EDGE;
- break;
- case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
- ret = NV10TCL_TX_FORMAT_WRAP_S_CLAMP_TO_BORDER;
- break;
- case PIPE_TEX_WRAP_CLAMP:
- ret = NV10TCL_TX_FORMAT_WRAP_S_CLAMP;
- break;
- case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
- case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
- case PIPE_TEX_WRAP_MIRROR_CLAMP:
- default:
- NOUVEAU_ERR("unknown wrap mode: %d\n", wrap);
- ret = NV10TCL_TX_FORMAT_WRAP_S_REPEAT;
- break;
- }
-
- return ret >> NV10TCL_TX_FORMAT_WRAP_S_SHIFT;
-}
-
-static void *
-nv10_sampler_state_create(struct pipe_context *pipe,
- const struct pipe_sampler_state *cso)
-{
- struct nv10_sampler_state *ps;
- uint32_t filter = 0;
-
- ps = MALLOC(sizeof(struct nv10_sampler_state));
-
- ps->wrap = ((wrap_mode(cso->wrap_s) << NV10TCL_TX_FORMAT_WRAP_S_SHIFT) |
- (wrap_mode(cso->wrap_t) << NV10TCL_TX_FORMAT_WRAP_T_SHIFT));
-
- ps->en = 0;
- if (cso->max_anisotropy > 1.0) {
- /* no idea, binary driver sets it, works without it.. meh.. */
- ps->wrap |= (1 << 5);
-
-/* if (cso->max_anisotropy >= 16.0) {
- ps->en |= NV10TCL_TX_ENABLE_ANISO_16X;
- } else
- if (cso->max_anisotropy >= 12.0) {
- ps->en |= NV10TCL_TX_ENABLE_ANISO_12X;
- } else
- if (cso->max_anisotropy >= 10.0) {
- ps->en |= NV10TCL_TX_ENABLE_ANISO_10X;
- } else
- if (cso->max_anisotropy >= 8.0) {
- ps->en |= NV10TCL_TX_ENABLE_ANISO_8X;
- } else
- if (cso->max_anisotropy >= 6.0) {
- ps->en |= NV10TCL_TX_ENABLE_ANISO_6X;
- } else
- if (cso->max_anisotropy >= 4.0) {
- ps->en |= NV10TCL_TX_ENABLE_ANISO_4X;
- } else {
- ps->en |= NV10TCL_TX_ENABLE_ANISO_2X;
- }*/
- }
-
- switch (cso->mag_img_filter) {
- case PIPE_TEX_FILTER_LINEAR:
- filter |= NV10TCL_TX_FILTER_MAGNIFY_LINEAR;
- break;
- case PIPE_TEX_FILTER_NEAREST:
- default:
- filter |= NV10TCL_TX_FILTER_MAGNIFY_NEAREST;
- break;
- }
-
- switch (cso->min_img_filter) {
- case PIPE_TEX_FILTER_LINEAR:
- switch (cso->min_mip_filter) {
- case PIPE_TEX_MIPFILTER_NEAREST:
- filter |= NV10TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_NEAREST;
- break;
- case PIPE_TEX_MIPFILTER_LINEAR:
- filter |= NV10TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_LINEAR;
- break;
- case PIPE_TEX_MIPFILTER_NONE:
- default:
- filter |= NV10TCL_TX_FILTER_MINIFY_LINEAR;
- break;
- }
- break;
- case PIPE_TEX_FILTER_NEAREST:
- default:
- switch (cso->min_mip_filter) {
- case PIPE_TEX_MIPFILTER_NEAREST:
- filter |= NV10TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_NEAREST;
- break;
- case PIPE_TEX_MIPFILTER_LINEAR:
- filter |= NV10TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_LINEAR;
- break;
- case PIPE_TEX_MIPFILTER_NONE:
- default:
- filter |= NV10TCL_TX_FILTER_MINIFY_NEAREST;
- break;
- }
- break;
- }
-
- ps->filt = filter;
-
-/* if (cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) {
- switch (cso->compare_func) {
- case PIPE_FUNC_NEVER:
- ps->wrap |= NV10TCL_TX_WRAP_RCOMP_NEVER;
- break;
- case PIPE_FUNC_GREATER:
- ps->wrap |= NV10TCL_TX_WRAP_RCOMP_GREATER;
- break;
- case PIPE_FUNC_EQUAL:
- ps->wrap |= NV10TCL_TX_WRAP_RCOMP_EQUAL;
- break;
- case PIPE_FUNC_GEQUAL:
- ps->wrap |= NV10TCL_TX_WRAP_RCOMP_GEQUAL;
- break;
- case PIPE_FUNC_LESS:
- ps->wrap |= NV10TCL_TX_WRAP_RCOMP_LESS;
- break;
- case PIPE_FUNC_NOTEQUAL:
- ps->wrap |= NV10TCL_TX_WRAP_RCOMP_NOTEQUAL;
- break;
- case PIPE_FUNC_LEQUAL:
- ps->wrap |= NV10TCL_TX_WRAP_RCOMP_LEQUAL;
- break;
- case PIPE_FUNC_ALWAYS:
- ps->wrap |= NV10TCL_TX_WRAP_RCOMP_ALWAYS;
- break;
- default:
- break;
- }
- }*/
-
- ps->bcol = ((float_to_ubyte(cso->border_color[3]) << 24) |
- (float_to_ubyte(cso->border_color[0]) << 16) |
- (float_to_ubyte(cso->border_color[1]) << 8) |
- (float_to_ubyte(cso->border_color[2]) << 0));
-
- return (void *)ps;
-}
-
-static void
-nv10_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler)
-{
- struct nv10_context *nv10 = nv10_context(pipe);
- unsigned unit;
-
- for (unit = 0; unit < nr; unit++) {
- nv10->tex_sampler[unit] = sampler[unit];
- nv10->dirty_samplers |= (1 << unit);
- }
-}
-
-static void
-nv10_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- FREE(hwcso);
-}
-
-static void
-nv10_set_sampler_texture(struct pipe_context *pipe, unsigned nr,
- struct pipe_texture **miptree)
-{
- struct nv10_context *nv10 = nv10_context(pipe);
- unsigned unit;
-
- for (unit = 0; unit < nr; unit++) {
- nv10->tex_miptree[unit] = (struct nv10_miptree *)miptree[unit];
- nv10->dirty_samplers |= (1 << unit);
- }
-}
-
-static void *
-nv10_rasterizer_state_create(struct pipe_context *pipe,
- const struct pipe_rasterizer_state *cso)
-{
- struct nv10_rasterizer_state *rs;
- int i;
-
- /*XXX: ignored:
- * light_twoside
- * offset_cw/ccw -nohw
- * scissor
- * point_smooth -nohw
- * multisample
- * offset_units / offset_scale
- */
- rs = MALLOC(sizeof(struct nv10_rasterizer_state));
-
- rs->templ = cso;
-
- rs->shade_model = cso->flatshade ? 0x1d00 : 0x1d01;
-
- rs->line_width = (unsigned char)(cso->line_width * 8.0) & 0xff;
- rs->line_smooth_en = cso->line_smooth ? 1 : 0;
-
- rs->point_size = *(uint32_t*)&cso->point_size;
-
- rs->poly_smooth_en = cso->poly_smooth ? 1 : 0;
-
- if (cso->front_winding == PIPE_WINDING_CCW) {
- rs->front_face = NV10TCL_FRONT_FACE_CCW;
- rs->poly_mode_front = nvgl_polygon_mode(cso->fill_ccw);
- rs->poly_mode_back = nvgl_polygon_mode(cso->fill_cw);
- } else {
- rs->front_face = NV10TCL_FRONT_FACE_CW;
- rs->poly_mode_front = nvgl_polygon_mode(cso->fill_cw);
- rs->poly_mode_back = nvgl_polygon_mode(cso->fill_ccw);
- }
-
- switch (cso->cull_mode) {
- case PIPE_WINDING_CCW:
- rs->cull_face_en = 1;
- if (cso->front_winding == PIPE_WINDING_CCW)
- rs->cull_face = NV10TCL_CULL_FACE_FRONT;
- else
- rs->cull_face = NV10TCL_CULL_FACE_BACK;
- break;
- case PIPE_WINDING_CW:
- rs->cull_face_en = 1;
- if (cso->front_winding == PIPE_WINDING_CW)
- rs->cull_face = NV10TCL_CULL_FACE_FRONT;
- else
- rs->cull_face = NV10TCL_CULL_FACE_BACK;
- break;
- case PIPE_WINDING_BOTH:
- rs->cull_face_en = 1;
- rs->cull_face = NV10TCL_CULL_FACE_FRONT_AND_BACK;
- break;
- case PIPE_WINDING_NONE:
- default:
- rs->cull_face_en = 0;
- rs->cull_face = 0;
- break;
- }
-
- if (cso->sprite_coord_enable) {
- rs->point_sprite = (1 << 0);
- for (i = 0; i < 8; i++) {
- if ((cso->sprite_coord_enable >> i) & 1)
- rs->point_sprite |= (1 << (8 + i));
- }
- } else {
- rs->point_sprite = 0;
- }
-
- return (void *)rs;
-}
-
-static void
-nv10_rasterizer_state_bind(struct pipe_context *pipe, void *rast)
-{
- struct nv10_context *nv10 = nv10_context(pipe);
-
- nv10->rast = (struct nv10_rasterizer_state*)rast;
-
- draw_set_rasterizer_state(nv10->draw, (nv10->rast ? nv10->rast->templ : NULL));
-
- nv10->dirty |= NV10_NEW_RAST;
-}
-
-static void
-nv10_rasterizer_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- FREE(hwcso);
-}
-
-static void *
-nv10_depth_stencil_alpha_state_create(struct pipe_context *pipe,
- const struct pipe_depth_stencil_alpha_state *cso)
-{
- struct nv10_depth_stencil_alpha_state *hw;
-
- hw = MALLOC(sizeof(struct nv10_depth_stencil_alpha_state));
-
- hw->depth.func = nvgl_comparison_op(cso->depth.func);
- hw->depth.write_enable = cso->depth.writemask ? 1 : 0;
- hw->depth.test_enable = cso->depth.enabled ? 1 : 0;
-
- hw->stencil.enable = cso->stencil[0].enabled ? 1 : 0;
- hw->stencil.wmask = cso->stencil[0].writemask;
- hw->stencil.func = nvgl_comparison_op(cso->stencil[0].func);
- hw->stencil.ref = cso->stencil[0].ref_value;
- hw->stencil.vmask = cso->stencil[0].valuemask;
- hw->stencil.fail = nvgl_stencil_op(cso->stencil[0].fail_op);
- hw->stencil.zfail = nvgl_stencil_op(cso->stencil[0].zfail_op);
- hw->stencil.zpass = nvgl_stencil_op(cso->stencil[0].zpass_op);
-
- hw->alpha.enabled = cso->alpha.enabled ? 1 : 0;
- hw->alpha.func = nvgl_comparison_op(cso->alpha.func);
- hw->alpha.ref = float_to_ubyte(cso->alpha.ref_value);
-
- return (void *)hw;
-}
-
-static void
-nv10_depth_stencil_alpha_state_bind(struct pipe_context *pipe, void *dsa)
-{
- struct nv10_context *nv10 = nv10_context(pipe);
-
- nv10->dsa = (struct nv10_depth_stencil_alpha_state*)dsa;
-
- nv10->dirty |= NV10_NEW_DSA;
-}
-
-static void
-nv10_depth_stencil_alpha_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- FREE(hwcso);
-}
-
-static void *
-nv10_vp_state_create(struct pipe_context *pipe,
- const struct pipe_shader_state *templ)
-{
- struct nv10_context *nv10 = nv10_context(pipe);
-
- return draw_create_vertex_shader(nv10->draw, templ);
-}
-
-static void
-nv10_vp_state_bind(struct pipe_context *pipe, void *shader)
-{
- struct nv10_context *nv10 = nv10_context(pipe);
-
- draw_bind_vertex_shader(nv10->draw, (struct draw_vertex_shader *) shader);
-
- nv10->dirty |= NV10_NEW_VERTPROG;
-}
-
-static void
-nv10_vp_state_delete(struct pipe_context *pipe, void *shader)
-{
- struct nv10_context *nv10 = nv10_context(pipe);
-
- draw_delete_vertex_shader(nv10->draw, (struct draw_vertex_shader *) shader);
-}
-
-static void *
-nv10_fp_state_create(struct pipe_context *pipe,
- const struct pipe_shader_state *cso)
-{
- struct nv10_fragment_program *fp;
-
- fp = CALLOC(1, sizeof(struct nv10_fragment_program));
- fp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
-
- tgsi_scan_shader(cso->tokens, &fp->info);
-
- return (void *)fp;
-}
-
-static void
-nv10_fp_state_bind(struct pipe_context *pipe, void *hwcso)
-{
- struct nv10_context *nv10 = nv10_context(pipe);
- struct nv10_fragment_program *fp = hwcso;
-
- nv10->fragprog.current = fp;
- nv10->dirty |= NV10_NEW_FRAGPROG;
-}
-
-static void
-nv10_fp_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- struct nv10_context *nv10 = nv10_context(pipe);
- struct nv10_fragment_program *fp = hwcso;
-
- nv10_fragprog_destroy(nv10, fp);
- FREE((void*)fp->pipe.tokens);
- FREE(fp);
-}
-
-static void
-nv10_set_blend_color(struct pipe_context *pipe,
- const struct pipe_blend_color *bcol)
-{
- struct nv10_context *nv10 = nv10_context(pipe);
-
- nv10->blend_color = (struct pipe_blend_color*)bcol;
-
- nv10->dirty |= NV10_NEW_BLENDCOL;
-}
-
-static void
-nv10_set_clip_state(struct pipe_context *pipe,
- const struct pipe_clip_state *clip)
-{
- struct nv10_context *nv10 = nv10_context(pipe);
-
- draw_set_clip_state(nv10->draw, clip);
-}
-
-static void
-nv10_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
- const struct pipe_constant_buffer *buf )
-{
- struct nv10_context *nv10 = nv10_context(pipe);
- struct pipe_screen *pscreen = pipe->screen;
-
- assert(shader < PIPE_SHADER_TYPES);
- assert(index == 0);
-
- if (buf) {
- void *mapped;
- if (buf->buffer && buf->buffer->size &&
- (mapped = pipe_buffer_map(pscreen, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
- {
- memcpy(nv10->constbuf[shader], mapped, buf->buffer->size);
- nv10->constbuf_nr[shader] =
- buf->buffer->size / (4 * sizeof(float));
- pipe_buffer_unmap(pscreen, buf->buffer);
- }
- }
-}
-
-static void
-nv10_set_framebuffer_state(struct pipe_context *pipe,
- const struct pipe_framebuffer_state *fb)
-{
- struct nv10_context *nv10 = nv10_context(pipe);
-
- nv10->framebuffer = (struct pipe_framebuffer_state*)fb;
-
- nv10->dirty |= NV10_NEW_FRAMEBUFFER;
-}
-
-static void
-nv10_set_polygon_stipple(struct pipe_context *pipe,
- const struct pipe_poly_stipple *stipple)
-{
- NOUVEAU_ERR("line stipple hahaha\n");
-}
-
-static void
-nv10_set_scissor_state(struct pipe_context *pipe,
- const struct pipe_scissor_state *s)
-{
- struct nv10_context *nv10 = nv10_context(pipe);
-
- nv10->scissor = (struct pipe_scissor_state*)s;
-
- nv10->dirty |= NV10_NEW_SCISSOR;
-}
-
-static void
-nv10_set_viewport_state(struct pipe_context *pipe,
- const struct pipe_viewport_state *vpt)
-{
- struct nv10_context *nv10 = nv10_context(pipe);
-
- nv10->viewport = (struct pipe_viewport_state*)vpt;
-
- draw_set_viewport_state(nv10->draw, nv10->viewport);
-
- nv10->dirty |= NV10_NEW_VIEWPORT;
-}
-
-static void
-nv10_set_vertex_buffers(struct pipe_context *pipe, unsigned count,
- const struct pipe_vertex_buffer *vb)
-{
- struct nv10_context *nv10 = nv10_context(pipe);
-
- memcpy(nv10->vtxbuf, vb, sizeof(*vb) * count);
- nv10->dirty |= NV10_NEW_VTXARRAYS;
-
- draw_set_vertex_buffers(nv10->draw, count, vb);
-}
-
-static void
-nv10_set_vertex_elements(struct pipe_context *pipe, unsigned count,
- const struct pipe_vertex_element *ve)
-{
- struct nv10_context *nv10 = nv10_context(pipe);
-
- memcpy(nv10->vtxelt, ve, sizeof(*ve) * count);
- nv10->dirty |= NV10_NEW_VTXARRAYS;
-
- draw_set_vertex_elements(nv10->draw, count, ve);
-}
-
-void
-nv10_init_state_functions(struct nv10_context *nv10)
-{
- nv10->pipe.create_blend_state = nv10_blend_state_create;
- nv10->pipe.bind_blend_state = nv10_blend_state_bind;
- nv10->pipe.delete_blend_state = nv10_blend_state_delete;
-
- nv10->pipe.create_sampler_state = nv10_sampler_state_create;
- nv10->pipe.bind_fragment_sampler_states = nv10_sampler_state_bind;
- nv10->pipe.delete_sampler_state = nv10_sampler_state_delete;
- nv10->pipe.set_fragment_sampler_textures = nv10_set_sampler_texture;
-
- nv10->pipe.create_rasterizer_state = nv10_rasterizer_state_create;
- nv10->pipe.bind_rasterizer_state = nv10_rasterizer_state_bind;
- nv10->pipe.delete_rasterizer_state = nv10_rasterizer_state_delete;
-
- nv10->pipe.create_depth_stencil_alpha_state =
- nv10_depth_stencil_alpha_state_create;
- nv10->pipe.bind_depth_stencil_alpha_state =
- nv10_depth_stencil_alpha_state_bind;
- nv10->pipe.delete_depth_stencil_alpha_state =
- nv10_depth_stencil_alpha_state_delete;
-
- nv10->pipe.create_vs_state = nv10_vp_state_create;
- nv10->pipe.bind_vs_state = nv10_vp_state_bind;
- nv10->pipe.delete_vs_state = nv10_vp_state_delete;
-
- nv10->pipe.create_fs_state = nv10_fp_state_create;
- nv10->pipe.bind_fs_state = nv10_fp_state_bind;
- nv10->pipe.delete_fs_state = nv10_fp_state_delete;
-
- nv10->pipe.set_blend_color = nv10_set_blend_color;
- nv10->pipe.set_clip_state = nv10_set_clip_state;
- nv10->pipe.set_constant_buffer = nv10_set_constant_buffer;
- nv10->pipe.set_framebuffer_state = nv10_set_framebuffer_state;
- nv10->pipe.set_polygon_stipple = nv10_set_polygon_stipple;
- nv10->pipe.set_scissor_state = nv10_set_scissor_state;
- nv10->pipe.set_viewport_state = nv10_set_viewport_state;
-
- nv10->pipe.set_vertex_buffers = nv10_set_vertex_buffers;
- nv10->pipe.set_vertex_elements = nv10_set_vertex_elements;
-}
-
diff --git a/src/gallium/drivers/nv20/nv20_state.c b/src/gallium/drivers/nv20/nv20_state.c
deleted file mode 100644
index 3d9a276fa12..00000000000
--- a/src/gallium/drivers/nv20/nv20_state.c
+++ /dev/null
@@ -1,583 +0,0 @@
-#include "draw/draw_context.h"
-#include "pipe/p_state.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_shader_tokens.h"
-#include "pipe/p_inlines.h"
-
-#include "tgsi/tgsi_parse.h"
-
-#include "nv20_context.h"
-#include "nv20_state.h"
-
-static void *
-nv20_blend_state_create(struct pipe_context *pipe,
- const struct pipe_blend_state *cso)
-{
- struct nv20_blend_state *cb;
-
- cb = MALLOC(sizeof(struct nv20_blend_state));
-
- cb->b_enable = cso->blend_enable ? 1 : 0;
- cb->b_srcfunc = ((nvgl_blend_func(cso->alpha_src_factor)<<16) |
- (nvgl_blend_func(cso->rgb_src_factor)));
- cb->b_dstfunc = ((nvgl_blend_func(cso->alpha_dst_factor)<<16) |
- (nvgl_blend_func(cso->rgb_dst_factor)));
-
- cb->c_mask = (((cso->colormask & PIPE_MASK_A) ? (0x01<<24) : 0) |
- ((cso->colormask & PIPE_MASK_R) ? (0x01<<16) : 0) |
- ((cso->colormask & PIPE_MASK_G) ? (0x01<< 8) : 0) |
- ((cso->colormask & PIPE_MASK_B) ? (0x01<< 0) : 0));
-
- cb->d_enable = cso->dither ? 1 : 0;
-
- return (void *)cb;
-}
-
-static void
-nv20_blend_state_bind(struct pipe_context *pipe, void *blend)
-{
- struct nv20_context *nv20 = nv20_context(pipe);
-
- nv20->blend = (struct nv20_blend_state*)blend;
-
- nv20->dirty |= NV20_NEW_BLEND;
-}
-
-static void
-nv20_blend_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- FREE(hwcso);
-}
-
-
-static INLINE unsigned
-wrap_mode(unsigned wrap) {
- unsigned ret;
-
- switch (wrap) {
- case PIPE_TEX_WRAP_REPEAT:
- ret = NV20TCL_TX_WRAP_S_REPEAT;
- break;
- case PIPE_TEX_WRAP_MIRROR_REPEAT:
- ret = NV20TCL_TX_WRAP_S_MIRRORED_REPEAT;
- break;
- case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
- ret = NV20TCL_TX_WRAP_S_CLAMP_TO_EDGE;
- break;
- case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
- ret = NV20TCL_TX_WRAP_S_CLAMP_TO_BORDER;
- break;
- case PIPE_TEX_WRAP_CLAMP:
- ret = NV20TCL_TX_WRAP_S_CLAMP;
- break;
- case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
- case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
- case PIPE_TEX_WRAP_MIRROR_CLAMP:
- default:
- NOUVEAU_ERR("unknown wrap mode: %d\n", wrap);
- ret = NV20TCL_TX_WRAP_S_REPEAT;
- break;
- }
-
- return (ret >> NV20TCL_TX_WRAP_S_SHIFT);
-}
-
-static void *
-nv20_sampler_state_create(struct pipe_context *pipe,
- const struct pipe_sampler_state *cso)
-{
- struct nv20_sampler_state *ps;
- uint32_t filter = 0;
-
- ps = MALLOC(sizeof(struct nv20_sampler_state));
-
- ps->wrap = ((wrap_mode(cso->wrap_s) << NV20TCL_TX_WRAP_S_SHIFT) |
- (wrap_mode(cso->wrap_t) << NV20TCL_TX_WRAP_T_SHIFT));
-
- ps->en = 0;
- if (cso->max_anisotropy > 1.0) {
- /* no idea, binary driver sets it, works without it.. meh.. */
- ps->wrap |= (1 << 5);
-
-/* if (cso->max_anisotropy >= 8.0) {
- ps->en |= NV20TCL_TX_ENABLE_ANISO_8X;
- } else
- if (cso->max_anisotropy >= 4.0) {
- ps->en |= NV20TCL_TX_ENABLE_ANISO_4X;
- } else {
- ps->en |= NV20TCL_TX_ENABLE_ANISO_2X;
- }*/
- }
-
- switch (cso->mag_img_filter) {
- case PIPE_TEX_FILTER_LINEAR:
- filter |= NV20TCL_TX_FILTER_MAGNIFY_LINEAR;
- break;
- case PIPE_TEX_FILTER_NEAREST:
- default:
- filter |= NV20TCL_TX_FILTER_MAGNIFY_NEAREST;
- break;
- }
-
- switch (cso->min_img_filter) {
- case PIPE_TEX_FILTER_LINEAR:
- switch (cso->min_mip_filter) {
- case PIPE_TEX_MIPFILTER_NEAREST:
- filter |=
- NV20TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_NEAREST;
- break;
- case PIPE_TEX_MIPFILTER_LINEAR:
- filter |= NV20TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_LINEAR;
- break;
- case PIPE_TEX_MIPFILTER_NONE:
- default:
- filter |= NV20TCL_TX_FILTER_MINIFY_LINEAR;
- break;
- }
- break;
- case PIPE_TEX_FILTER_NEAREST:
- default:
- switch (cso->min_mip_filter) {
- case PIPE_TEX_MIPFILTER_NEAREST:
- filter |=
- NV20TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_NEAREST;
- break;
- case PIPE_TEX_MIPFILTER_LINEAR:
- filter |=
- NV20TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_LINEAR;
- break;
- case PIPE_TEX_MIPFILTER_NONE:
- default:
- filter |= NV20TCL_TX_FILTER_MINIFY_NEAREST;
- break;
- }
- break;
- }
-
- ps->filt = filter;
-
-/* if (cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) {
- switch (cso->compare_func) {
- case PIPE_FUNC_NEVER:
- ps->wrap |= NV10TCL_TX_WRAP_RCOMP_NEVER;
- break;
- case PIPE_FUNC_GREATER:
- ps->wrap |= NV10TCL_TX_WRAP_RCOMP_GREATER;
- break;
- case PIPE_FUNC_EQUAL:
- ps->wrap |= NV10TCL_TX_WRAP_RCOMP_EQUAL;
- break;
- case PIPE_FUNC_GEQUAL:
- ps->wrap |= NV10TCL_TX_WRAP_RCOMP_GEQUAL;
- break;
- case PIPE_FUNC_LESS:
- ps->wrap |= NV10TCL_TX_WRAP_RCOMP_LESS;
- break;
- case PIPE_FUNC_NOTEQUAL:
- ps->wrap |= NV10TCL_TX_WRAP_RCOMP_NOTEQUAL;
- break;
- case PIPE_FUNC_LEQUAL:
- ps->wrap |= NV10TCL_TX_WRAP_RCOMP_LEQUAL;
- break;
- case PIPE_FUNC_ALWAYS:
- ps->wrap |= NV10TCL_TX_WRAP_RCOMP_ALWAYS;
- break;
- default:
- break;
- }
- }*/
-
- ps->bcol = ((float_to_ubyte(cso->border_color[3]) << 24) |
- (float_to_ubyte(cso->border_color[0]) << 16) |
- (float_to_ubyte(cso->border_color[1]) << 8) |
- (float_to_ubyte(cso->border_color[2]) << 0));
-
- return (void *)ps;
-}
-
-static void
-nv20_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler)
-{
- struct nv20_context *nv20 = nv20_context(pipe);
- unsigned unit;
-
- for (unit = 0; unit < nr; unit++) {
- nv20->tex_sampler[unit] = sampler[unit];
- nv20->dirty_samplers |= (1 << unit);
- }
-}
-
-static void
-nv20_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- FREE(hwcso);
-}
-
-static void
-nv20_set_sampler_texture(struct pipe_context *pipe, unsigned nr,
- struct pipe_texture **miptree)
-{
- struct nv20_context *nv20 = nv20_context(pipe);
- unsigned unit;
-
- for (unit = 0; unit < nr; unit++) {
- nv20->tex_miptree[unit] = (struct nv20_miptree *)miptree[unit];
- nv20->dirty_samplers |= (1 << unit);
- }
-}
-
-static void *
-nv20_rasterizer_state_create(struct pipe_context *pipe,
- const struct pipe_rasterizer_state *cso)
-{
- struct nv20_rasterizer_state *rs;
- int i;
-
- /*XXX: ignored:
- * light_twoside
- * offset_cw/ccw -nohw
- * scissor
- * point_smooth -nohw
- * multisample
- * offset_units / offset_scale
- */
- rs = MALLOC(sizeof(struct nv20_rasterizer_state));
-
- rs->templ = cso;
-
- rs->shade_model = cso->flatshade ? NV20TCL_SHADE_MODEL_FLAT :
- NV20TCL_SHADE_MODEL_SMOOTH;
-
- rs->line_width = (unsigned char)(cso->line_width * 8.0) & 0xff;
- rs->line_smooth_en = cso->line_smooth ? 1 : 0;
-
- /* XXX: nv20 and nv25 different! */
- rs->point_size = *(uint32_t*)&cso->point_size;
-
- rs->poly_smooth_en = cso->poly_smooth ? 1 : 0;
-
- if (cso->front_winding == PIPE_WINDING_CCW) {
- rs->front_face = NV20TCL_FRONT_FACE_CCW;
- rs->poly_mode_front = nvgl_polygon_mode(cso->fill_ccw);
- rs->poly_mode_back = nvgl_polygon_mode(cso->fill_cw);
- } else {
- rs->front_face = NV20TCL_FRONT_FACE_CW;
- rs->poly_mode_front = nvgl_polygon_mode(cso->fill_cw);
- rs->poly_mode_back = nvgl_polygon_mode(cso->fill_ccw);
- }
-
- switch (cso->cull_mode) {
- case PIPE_WINDING_CCW:
- rs->cull_face_en = 1;
- if (cso->front_winding == PIPE_WINDING_CCW)
- rs->cull_face = NV20TCL_CULL_FACE_FRONT;
- else
- rs->cull_face = NV20TCL_CULL_FACE_BACK;
- break;
- case PIPE_WINDING_CW:
- rs->cull_face_en = 1;
- if (cso->front_winding == PIPE_WINDING_CW)
- rs->cull_face = NV20TCL_CULL_FACE_FRONT;
- else
- rs->cull_face = NV20TCL_CULL_FACE_BACK;
- break;
- case PIPE_WINDING_BOTH:
- rs->cull_face_en = 1;
- rs->cull_face = NV20TCL_CULL_FACE_FRONT_AND_BACK;
- break;
- case PIPE_WINDING_NONE:
- default:
- rs->cull_face_en = 0;
- rs->cull_face = 0;
- break;
- }
-
- if (cso->sprite_coord_enable) {
- rs->point_sprite = (1 << 0);
- for (i = 0; i < 8; i++) {
- if ((cso->sprite_coord_enable >> i) & 1)
- rs->point_sprite |= (1 << (8 + i));
- }
- } else {
- rs->point_sprite = 0;
- }
-
- return (void *)rs;
-}
-
-static void
-nv20_rasterizer_state_bind(struct pipe_context *pipe, void *rast)
-{
- struct nv20_context *nv20 = nv20_context(pipe);
-
- nv20->rast = (struct nv20_rasterizer_state*)rast;
-
- draw_set_rasterizer_state(nv20->draw, (nv20->rast ? nv20->rast->templ : NULL));
-
- nv20->dirty |= NV20_NEW_RAST;
-}
-
-static void
-nv20_rasterizer_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- FREE(hwcso);
-}
-
-static void *
-nv20_depth_stencil_alpha_state_create(struct pipe_context *pipe,
- const struct pipe_depth_stencil_alpha_state *cso)
-{
- struct nv20_depth_stencil_alpha_state *hw;
-
- hw = MALLOC(sizeof(struct nv20_depth_stencil_alpha_state));
-
- hw->depth.func = nvgl_comparison_op(cso->depth.func);
- hw->depth.write_enable = cso->depth.writemask ? 1 : 0;
- hw->depth.test_enable = cso->depth.enabled ? 1 : 0;
-
- hw->stencil.enable = cso->stencil[0].enabled ? 1 : 0;
- hw->stencil.wmask = cso->stencil[0].writemask;
- hw->stencil.func = nvgl_comparison_op(cso->stencil[0].func);
- hw->stencil.ref = cso->stencil[0].ref_value;
- hw->stencil.vmask = cso->stencil[0].valuemask;
- hw->stencil.fail = nvgl_stencil_op(cso->stencil[0].fail_op);
- hw->stencil.zfail = nvgl_stencil_op(cso->stencil[0].zfail_op);
- hw->stencil.zpass = nvgl_stencil_op(cso->stencil[0].zpass_op);
-
- hw->alpha.enabled = cso->alpha.enabled ? 1 : 0;
- hw->alpha.func = nvgl_comparison_op(cso->alpha.func);
- hw->alpha.ref = float_to_ubyte(cso->alpha.ref_value);
-
- return (void *)hw;
-}
-
-static void
-nv20_depth_stencil_alpha_state_bind(struct pipe_context *pipe, void *dsa)
-{
- struct nv20_context *nv20 = nv20_context(pipe);
-
- nv20->dsa = (struct nv20_depth_stencil_alpha_state*)dsa;
-
- nv20->dirty |= NV20_NEW_DSA;
-}
-
-static void
-nv20_depth_stencil_alpha_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- FREE(hwcso);
-}
-
-static void *
-nv20_vp_state_create(struct pipe_context *pipe,
- const struct pipe_shader_state *templ)
-{
- struct nv20_context *nv20 = nv20_context(pipe);
-
- return draw_create_vertex_shader(nv20->draw, templ);
-}
-
-static void
-nv20_vp_state_bind(struct pipe_context *pipe, void *shader)
-{
- struct nv20_context *nv20 = nv20_context(pipe);
-
- draw_bind_vertex_shader(nv20->draw, (struct draw_vertex_shader *) shader);
-
- nv20->dirty |= NV20_NEW_VERTPROG;
-}
-
-static void
-nv20_vp_state_delete(struct pipe_context *pipe, void *shader)
-{
- struct nv20_context *nv20 = nv20_context(pipe);
-
- draw_delete_vertex_shader(nv20->draw, (struct draw_vertex_shader *) shader);
-}
-
-static void *
-nv20_fp_state_create(struct pipe_context *pipe,
- const struct pipe_shader_state *cso)
-{
- struct nv20_fragment_program *fp;
-
- fp = CALLOC(1, sizeof(struct nv20_fragment_program));
- fp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
-
- tgsi_scan_shader(cso->tokens, &fp->info);
-
- return (void *)fp;
-}
-
-static void
-nv20_fp_state_bind(struct pipe_context *pipe, void *hwcso)
-{
- struct nv20_context *nv20 = nv20_context(pipe);
- struct nv20_fragment_program *fp = hwcso;
-
- nv20->fragprog.current = fp;
- nv20->dirty |= NV20_NEW_FRAGPROG;
-}
-
-static void
-nv20_fp_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- struct nv20_context *nv20 = nv20_context(pipe);
- struct nv20_fragment_program *fp = hwcso;
-
- nv20_fragprog_destroy(nv20, fp);
- FREE((void*)fp->pipe.tokens);
- FREE(fp);
-}
-
-static void
-nv20_set_blend_color(struct pipe_context *pipe,
- const struct pipe_blend_color *bcol)
-{
- struct nv20_context *nv20 = nv20_context(pipe);
-
- nv20->blend_color = (struct pipe_blend_color*)bcol;
-
- nv20->dirty |= NV20_NEW_BLENDCOL;
-}
-
-static void
-nv20_set_clip_state(struct pipe_context *pipe,
- const struct pipe_clip_state *clip)
-{
- struct nv20_context *nv20 = nv20_context(pipe);
-
- draw_set_clip_state(nv20->draw, clip);
-}
-
-static void
-nv20_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
- const struct pipe_constant_buffer *buf )
-{
- struct nv20_context *nv20 = nv20_context(pipe);
- struct pipe_screen *pscreen = pipe->screen;
-
- assert(shader < PIPE_SHADER_TYPES);
- assert(index == 0);
-
- if (buf) {
- void *mapped;
- if (buf->buffer && buf->buffer->size &&
- (mapped = pipe_buffer_map(pscreen, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
- {
- memcpy(nv20->constbuf[shader], mapped, buf->buffer->size);
- nv20->constbuf_nr[shader] =
- buf->buffer->size / (4 * sizeof(float));
- pipe_buffer_unmap(pscreen, buf->buffer);
- }
- }
-}
-
-static void
-nv20_set_framebuffer_state(struct pipe_context *pipe,
- const struct pipe_framebuffer_state *fb)
-{
- struct nv20_context *nv20 = nv20_context(pipe);
-
- nv20->framebuffer = (struct pipe_framebuffer_state*)fb;
-
- nv20->dirty |= NV20_NEW_FRAMEBUFFER;
-}
-
-static void
-nv20_set_polygon_stipple(struct pipe_context *pipe,
- const struct pipe_poly_stipple *stipple)
-{
- NOUVEAU_ERR("line stipple hahaha\n");
-}
-
-static void
-nv20_set_scissor_state(struct pipe_context *pipe,
- const struct pipe_scissor_state *s)
-{
- struct nv20_context *nv20 = nv20_context(pipe);
-
- nv20->scissor = (struct pipe_scissor_state*)s;
-
- nv20->dirty |= NV20_NEW_SCISSOR;
-}
-
-static void
-nv20_set_viewport_state(struct pipe_context *pipe,
- const struct pipe_viewport_state *vpt)
-{
- struct nv20_context *nv20 = nv20_context(pipe);
-
- nv20->viewport = (struct pipe_viewport_state*)vpt;
-
- draw_set_viewport_state(nv20->draw, nv20->viewport);
-
- nv20->dirty |= NV20_NEW_VIEWPORT;
-}
-
-static void
-nv20_set_vertex_buffers(struct pipe_context *pipe, unsigned count,
- const struct pipe_vertex_buffer *vb)
-{
- struct nv20_context *nv20 = nv20_context(pipe);
-
- memcpy(nv20->vtxbuf, vb, sizeof(*vb) * count);
- nv20->dirty |= NV20_NEW_VTXARRAYS;
-
- draw_set_vertex_buffers(nv20->draw, count, vb);
-}
-
-static void
-nv20_set_vertex_elements(struct pipe_context *pipe, unsigned count,
- const struct pipe_vertex_element *ve)
-{
- struct nv20_context *nv20 = nv20_context(pipe);
-
- memcpy(nv20->vtxelt, ve, sizeof(*ve) * count);
- nv20->dirty |= NV20_NEW_VTXARRAYS;
-
- draw_set_vertex_elements(nv20->draw, count, ve);
-}
-
-void
-nv20_init_state_functions(struct nv20_context *nv20)
-{
- nv20->pipe.create_blend_state = nv20_blend_state_create;
- nv20->pipe.bind_blend_state = nv20_blend_state_bind;
- nv20->pipe.delete_blend_state = nv20_blend_state_delete;
-
- nv20->pipe.create_sampler_state = nv20_sampler_state_create;
- nv20->pipe.bind_fragment_sampler_states = nv20_sampler_state_bind;
- nv20->pipe.delete_sampler_state = nv20_sampler_state_delete;
- nv20->pipe.set_fragment_sampler_textures = nv20_set_sampler_texture;
-
- nv20->pipe.create_rasterizer_state = nv20_rasterizer_state_create;
- nv20->pipe.bind_rasterizer_state = nv20_rasterizer_state_bind;
- nv20->pipe.delete_rasterizer_state = nv20_rasterizer_state_delete;
-
- nv20->pipe.create_depth_stencil_alpha_state =
- nv20_depth_stencil_alpha_state_create;
- nv20->pipe.bind_depth_stencil_alpha_state =
- nv20_depth_stencil_alpha_state_bind;
- nv20->pipe.delete_depth_stencil_alpha_state =
- nv20_depth_stencil_alpha_state_delete;
-
- nv20->pipe.create_vs_state = nv20_vp_state_create;
- nv20->pipe.bind_vs_state = nv20_vp_state_bind;
- nv20->pipe.delete_vs_state = nv20_vp_state_delete;
-
- nv20->pipe.create_fs_state = nv20_fp_state_create;
- nv20->pipe.bind_fs_state = nv20_fp_state_bind;
- nv20->pipe.delete_fs_state = nv20_fp_state_delete;
-
- nv20->pipe.set_blend_color = nv20_set_blend_color;
- nv20->pipe.set_clip_state = nv20_set_clip_state;
- nv20->pipe.set_constant_buffer = nv20_set_constant_buffer;
- nv20->pipe.set_framebuffer_state = nv20_set_framebuffer_state;
- nv20->pipe.set_polygon_stipple = nv20_set_polygon_stipple;
- nv20->pipe.set_scissor_state = nv20_set_scissor_state;
- nv20->pipe.set_viewport_state = nv20_set_viewport_state;
-
- nv20->pipe.set_vertex_buffers = nv20_set_vertex_buffers;
- nv20->pipe.set_vertex_elements = nv20_set_vertex_elements;
-}
-
diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c
index 8bfd7b2c909..279b74445ca 100644
--- a/src/gallium/drivers/nv30/nv30_context.c
+++ b/src/gallium/drivers/nv30/nv30_context.c
@@ -1,6 +1,5 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
-#include "util/u_simple_screen.h"
#include "nv30_context.h"
#include "nv30_screen.h"
diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c
index 8f9b26ea56f..aef37d303d8 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -28,7 +28,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, int param)
{
switch (param) {
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
- return 16;
+ return 8;
case PIPE_CAP_NPOT_TEXTURES:
return 0;
case PIPE_CAP_TWO_SIDED_STENCIL:
@@ -64,6 +64,8 @@ nv30_screen_get_param(struct pipe_screen *pscreen, int param)
case NOUVEAU_CAP_HW_VTXBUF:
case NOUVEAU_CAP_HW_IDXBUF:
return 1;
+ case PIPE_CAP_MAX_COMBINED_SAMPLERS:
+ return 16;
case PIPE_CAP_INDEP_BLEND_ENABLE:
return 0;
case PIPE_CAP_INDEP_BLEND_FUNC:
diff --git a/src/gallium/drivers/nv30/nv30_surface.c b/src/gallium/drivers/nv30/nv30_surface.c
index b48c5ab51a0..bc18e577eee 100644
--- a/src/gallium/drivers/nv30/nv30_surface.c
+++ b/src/gallium/drivers/nv30/nv30_surface.c
@@ -28,7 +28,6 @@
#include "nv30_context.h"
#include "pipe/p_defines.h"
-#include "util/u_simple_screen.h"
#include "util/u_inlines.h"
#include "util/u_tile.h"
diff --git a/src/gallium/drivers/nv30/nv30_vbo.c b/src/gallium/drivers/nv30/nv30_vbo.c
index a83ddf11546..f406fa0c1d6 100644
--- a/src/gallium/drivers/nv30/nv30_vbo.c
+++ b/src/gallium/drivers/nv30/nv30_vbo.c
@@ -185,7 +185,7 @@ nv30_draw_arrays(struct pipe_context *pipe,
nv30_state_emit(nv30);
- vc = nouveau_vbuf_split(chan->pushbuf->remaining, 6, 256,
+ vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256,
mode, start, count, &restart);
if (!vc) {
FIRE_RING(chan);
@@ -239,7 +239,7 @@ nv30_draw_elements_u08(struct nv30_context *nv30, void *ib,
nv30_state_emit(nv30);
- vc = nouveau_vbuf_split(chan->pushbuf->remaining, 6, 2,
+ vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2,
mode, start, count, &restart);
if (vc == 0) {
FIRE_RING(chan);
@@ -290,7 +290,7 @@ nv30_draw_elements_u16(struct nv30_context *nv30, void *ib,
nv30_state_emit(nv30);
- vc = nouveau_vbuf_split(chan->pushbuf->remaining, 6, 2,
+ vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2,
mode, start, count, &restart);
if (vc == 0) {
FIRE_RING(chan);
@@ -341,7 +341,7 @@ nv30_draw_elements_u32(struct nv30_context *nv30, void *ib,
nv30_state_emit(nv30);
- vc = nouveau_vbuf_split(chan->pushbuf->remaining, 5, 1,
+ vc = nouveau_vbuf_split(AVAIL_RING(chan), 5, 1,
mode, start, count, &restart);
if (vc == 0) {
FIRE_RING(chan);
@@ -417,7 +417,7 @@ nv30_draw_elements_vbo(struct pipe_context *pipe,
nv30_state_emit(nv30);
- vc = nouveau_vbuf_split(chan->pushbuf->remaining, 6, 256,
+ vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256,
mode, start, count, &restart);
if (!vc) {
FIRE_RING(chan);
diff --git a/src/gallium/drivers/nv40/nv40_context.c b/src/gallium/drivers/nv40/nv40_context.c
index b0b90032de1..65dc73e88b3 100644
--- a/src/gallium/drivers/nv40/nv40_context.c
+++ b/src/gallium/drivers/nv40/nv40_context.c
@@ -1,6 +1,5 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
-#include "util/u_simple_screen.h"
#include "nv40_context.h"
#include "nv40_screen.h"
diff --git a/src/gallium/drivers/nv40/nv40_draw.c b/src/gallium/drivers/nv40/nv40_draw.c
index 60ab49fad1c..48bd84d16c5 100644
--- a/src/gallium/drivers/nv40/nv40_draw.c
+++ b/src/gallium/drivers/nv40/nv40_draw.c
@@ -88,12 +88,11 @@ nv40_render_prim(struct draw_stage *stage, struct prim_header *prim,
struct nv40_screen *screen = nv40->screen;
struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_pushbuf *pb = chan->pushbuf;
struct nouveau_grobj *curie = screen->curie;
unsigned i;
/* Ensure there's room for 4xfloat32 + potentially 3 begin/end */
- if (pb->remaining < ((count * 20) + 6)) {
+ if (AVAIL_RING(chan) < ((count * 20) + 6)) {
if (rs->prim != NV40TCL_BEGIN_END_STOP) {
NOUVEAU_ERR("AIII, missed flush\n");
assert(0);
@@ -121,7 +120,7 @@ nv40_render_prim(struct draw_stage *stage, struct prim_header *prim,
/* If it's likely we'll need to empty the push buffer soon, finish
* off the primitive now.
*/
- if (pb->remaining < ((count * 20) + 6)) {
+ if (AVAIL_RING(chan) < ((count * 20) + 6)) {
BEGIN_RING(chan, curie, NV40TCL_BEGIN_END, 1);
OUT_RING (chan, NV40TCL_BEGIN_END_STOP);
rs->prim = NV40TCL_BEGIN_END_STOP;
diff --git a/src/gallium/drivers/nv40/nv40_vbo.c b/src/gallium/drivers/nv40/nv40_vbo.c
index 1e14edc56a7..f2048eb8693 100644
--- a/src/gallium/drivers/nv40/nv40_vbo.c
+++ b/src/gallium/drivers/nv40/nv40_vbo.c
@@ -186,7 +186,7 @@ nv40_draw_arrays(struct pipe_context *pipe,
nv40_state_emit(nv40);
- vc = nouveau_vbuf_split(chan->pushbuf->remaining, 6, 256,
+ vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256,
mode, start, count, &restart);
if (!vc) {
FIRE_RING(chan);
@@ -240,7 +240,7 @@ nv40_draw_elements_u08(struct nv40_context *nv40, void *ib,
nv40_state_emit(nv40);
- vc = nouveau_vbuf_split(chan->pushbuf->remaining, 6, 2,
+ vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2,
mode, start, count, &restart);
if (vc == 0) {
FIRE_RING(chan);
@@ -291,7 +291,7 @@ nv40_draw_elements_u16(struct nv40_context *nv40, void *ib,
nv40_state_emit(nv40);
- vc = nouveau_vbuf_split(chan->pushbuf->remaining, 6, 2,
+ vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2,
mode, start, count, &restart);
if (vc == 0) {
FIRE_RING(chan);
@@ -342,7 +342,7 @@ nv40_draw_elements_u32(struct nv40_context *nv40, void *ib,
nv40_state_emit(nv40);
- vc = nouveau_vbuf_split(chan->pushbuf->remaining, 5, 1,
+ vc = nouveau_vbuf_split(AVAIL_RING(chan), 5, 1,
mode, start, count, &restart);
if (vc == 0) {
FIRE_RING(chan);
@@ -418,7 +418,7 @@ nv40_draw_elements_vbo(struct pipe_context *pipe,
nv40_state_emit(nv40);
- vc = nouveau_vbuf_split(chan->pushbuf->remaining, 6, 256,
+ vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256,
mode, start, count, &restart);
if (!vc) {
FIRE_RING(chan);
diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c
index 867bd03e69d..7be12fcdef4 100644
--- a/src/gallium/drivers/nv50/nv50_context.c
+++ b/src/gallium/drivers/nv50/nv50_context.c
@@ -22,7 +22,6 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
-#include "util/u_simple_screen.h"
#include "nv50_context.h"
#include "nv50_screen.h"
diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c
index ac0c1d02703..7405b67414a 100644
--- a/src/gallium/drivers/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nv50/nv50_surface.c
@@ -25,7 +25,6 @@
#include "nouveau/nouveau_pushbuf.h"
#include "nv50_context.h"
#include "pipe/p_defines.h"
-#include "util/u_simple_screen.h"
#include "util/u_inlines.h"
#include "util/u_tile.h"
diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c
index d08b4d7354c..7c360e9e73a 100644
--- a/src/gallium/drivers/nv50/nv50_transfer.c
+++ b/src/gallium/drivers/nv50/nv50_transfer.c
@@ -313,7 +313,7 @@ nv50_upload_sifc(struct nv50_context *nv50,
while (count) {
unsigned nr = MIN2(count, 1792);
- if (chan->pushbuf->remaining <= nr) {
+ if (AVAIL_RING(chan) <= nr) {
FIRE_RING (chan);
BEGIN_RING(chan, eng2d,
@@ -321,7 +321,7 @@ nv50_upload_sifc(struct nv50_context *nv50,
OUT_RELOCh(chan, bo, dst_offset, reloc);
OUT_RELOCl(chan, bo, dst_offset, reloc);
}
- assert(chan->pushbuf->remaining > nr);
+ assert(AVAIL_RING(chan) > nr);
BEGIN_RING(chan, eng2d,
NV50_2D_SIFC_DATA | (2 << 29), nr);
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 59709e7d648..d31336ed76f 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -382,6 +382,7 @@ void r500_emit_fs_constant_buffer(struct r300_context* r300,
void r300_emit_fb_state(struct r300_context* r300, void* state)
{
struct pipe_framebuffer_state* fb = (struct pipe_framebuffer_state*)state;
+ struct r300_screen* r300screen = r300_screen(r300->context.screen);
struct r300_texture* tex;
struct pipe_surface* surf;
int i;
@@ -400,10 +401,16 @@ void r300_emit_fb_state(struct r300_context* r300, void* state)
/* Set the number of colorbuffers. */
if (fb->nr_cbufs > 1) {
- OUT_CS_REG(R300_RB3D_CCTL,
- R300_RB3D_CCTL_NUM_MULTIWRITES(fb->nr_cbufs) |
- R300_RB3D_CCTL_INDEPENDENT_COLOR_CHANNEL_MASK_ENABLE |
- R300_RB3D_CCTL_INDEPENDENT_COLORFORMAT_ENABLE_ENABLE);
+ if (r300screen->caps->is_r500) {
+ OUT_CS_REG(R300_RB3D_CCTL,
+ R300_RB3D_CCTL_NUM_MULTIWRITES(fb->nr_cbufs) |
+ R300_RB3D_CCTL_INDEPENDENT_COLORFORMAT_ENABLE_ENABLE |
+ R300_RB3D_CCTL_INDEPENDENT_COLOR_CHANNEL_MASK_ENABLE);
+ } else {
+ OUT_CS_REG(R300_RB3D_CCTL,
+ R300_RB3D_CCTL_NUM_MULTIWRITES(fb->nr_cbufs) |
+ R300_RB3D_CCTL_INDEPENDENT_COLORFORMAT_ENABLE_ENABLE);
+ }
} else {
OUT_CS_REG(R300_RB3D_CCTL, 0x0);
}
diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c
index 75a05498eb3..ae4c62b2f1d 100644
--- a/src/gallium/drivers/r300/r300_fs.c
+++ b/src/gallium/drivers/r300/r300_fs.c
@@ -179,6 +179,7 @@ static void r300_translate_fragment_shader(
/* Translate TGSI to our internal representation */
ttr.compiler = &compiler.Base;
ttr.info = &fs->info;
+ ttr.use_half_swizzles = TRUE;
r300_tgsi_to_rc(&ttr, fs->state.tokens);
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index da4ec542ade..13cd04a80cc 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -186,8 +186,10 @@ static float r300_get_paramf(struct pipe_screen* pscreen, int param)
* rendering limits. 2048 pixels should be enough for anybody. */
if (r300screen->caps->is_r500) {
return 4096.0f;
+ } else if (r300screen->caps->is_r400) {
+ return 4021.0f;
} else {
- return 2048.0f;
+ return 2560.0f;
}
case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
return 16.0f;
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 8d68aa230bf..4d158cff7c7 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -501,6 +501,8 @@ static void
const struct pipe_framebuffer_state* state)
{
struct r300_context* r300 = r300_context(pipe);
+ struct r300_screen* r300screen = r300_screen(pipe->screen);
+ unsigned max_width, max_height;
uint32_t zbuffer_bpp = 0;
r300->fb_state.size = (10 * state->nr_cbufs) +
@@ -513,6 +515,20 @@ static void
return;
}
+ if (r300screen->caps->is_r500) {
+ max_width = max_height = 4096;
+ } else if (r300screen->caps->is_r400) {
+ max_width = max_height = 4021;
+ } else {
+ max_width = max_height = 2560;
+ }
+
+ if (state->width > max_width || state->height > max_height) {
+ debug_printf("r300: Implementation error: Render targets are too "
+ "big in %s, refusing to bind framebuffer state!\n", __FUNCTION__);
+ return;
+ }
+
if (r300->draw) {
draw_flush(r300->draw);
}
@@ -615,6 +631,7 @@ static void r300_set_polygon_stipple(struct pipe_context* pipe,
static void* r300_create_rs_state(struct pipe_context* pipe,
const struct pipe_rasterizer_state* state)
{
+ struct r300_screen* r300screen = r300_screen(pipe->screen);
struct r300_rs_state* rs = CALLOC_STRUCT(r300_rs_state);
/* Copy rasterizer state for Draw. */
@@ -629,20 +646,28 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
/* If bypassing TCL, or if no TCL engine is present, turn off the HW TCL.
* Else, enable HW TCL and force Draw's TCL off. */
if (state->bypass_vs_clip_and_viewport ||
- !r300_screen(pipe->screen)->caps->has_tcl) {
+ !r300screen->caps->has_tcl) {
rs->vap_control_status |= R300_VAP_TCL_BYPASS;
}
rs->point_size = pack_float_16_6x(state->point_size) |
(pack_float_16_6x(state->point_size) << R300_POINTSIZE_X_SHIFT);
- /* set hw limits - clamping done by state tracker in vs or point_size
- XXX always need to emit this? */
- rs->point_minmax =
- ((int)(0.0 * 6.0) <<
- R300_GA_POINT_MINMAX_MIN_SHIFT) |
- ((int)(4096.0 * 6.0) <<
- R300_GA_POINT_MINMAX_MAX_SHIFT);
+ /* Point minimum and maximum sizes. This register has to be emitted,
+ * and it'd be a step backwards to put it in invariant state. */
+ if (r300screen->caps->is_r500) {
+ rs->point_minmax =
+ ((int)(0.0 * 6.0) << R300_GA_POINT_MINMAX_MIN_SHIFT) |
+ ((int)(4096.0 * 6.0) << R300_GA_POINT_MINMAX_MAX_SHIFT);
+ } else if (r300screen->caps->is_r400) {
+ rs->point_minmax =
+ ((int)(0.0 * 6.0) << R300_GA_POINT_MINMAX_MIN_SHIFT) |
+ ((int)(4021.0 * 6.0) << R300_GA_POINT_MINMAX_MAX_SHIFT);
+ } else {
+ rs->point_minmax =
+ ((int)(0.0 * 6.0) << R300_GA_POINT_MINMAX_MIN_SHIFT) |
+ ((int)(2560.0 * 6.0) << R300_GA_POINT_MINMAX_MAX_SHIFT);
+ }
rs->line_control = pack_float_16_6x(state->line_width) |
R300_GA_LINE_CNTL_END_TYPE_COMP;
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 67bf8ce13fd..417a57384c4 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -80,7 +80,6 @@ static void r300_setup_texture_state(struct r300_screen* screen, struct r300_tex
state->format2 |= R500_TXHEIGHT_BIT11;
}
}
- assert(is_r500 || (pt->width0 <= 2048 && pt->height0 <= 2048));
SCREEN_DBG(screen, DBG_TEX, "r300: Set texture state (%dx%d, %d levels)\n",
pt->width0, pt->height0, pt->last_level);
diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c
index 941ec17016b..aff4ddd4e23 100644
--- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c
+++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c
@@ -29,6 +29,7 @@
#include "tgsi/tgsi_scan.h"
#include "tgsi/tgsi_util.h"
+#include "util/u_debug.h"
static unsigned translate_opcode(unsigned opcode)
{
@@ -144,7 +145,7 @@ static unsigned translate_opcode(unsigned opcode)
case TGSI_OPCODE_KIL: return RC_OPCODE_KIL;
}
- fprintf(stderr, "Unknown opcode: %i\n", opcode);
+ debug_printf("r300: Unknown TGSI/RC opcode: %i\n", opcode);
return RC_OPCODE_ILLEGAL_OPCODE;
}
@@ -306,7 +307,7 @@ static void handle_immediate(struct tgsi_to_rc * ttr,
for (i = 0; i < 4; i++) {
if (imm->u[i].Float == 0.0f) {
swizzle |= RC_SWIZZLE_ZERO << (i * 3);
- } else if (imm->u[i].Float == 0.5f) {
+ } else if (imm->u[i].Float == 0.5f && ttr->use_half_swizzles) {
swizzle |= RC_SWIZZLE_HALF << (i * 3);
} else if (imm->u[i].Float == 1.0f) {
swizzle |= RC_SWIZZLE_ONE << (i * 3);
@@ -329,7 +330,8 @@ static void handle_immediate(struct tgsi_to_rc * ttr,
}
}
-void r300_tgsi_to_rc(struct tgsi_to_rc * ttr, const struct tgsi_token * tokens)
+void r300_tgsi_to_rc(struct tgsi_to_rc * ttr,
+ const struct tgsi_token * tokens)
{
struct tgsi_parse_context parser;
unsigned imm_index = 0;
diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.h b/src/gallium/drivers/r300/r300_tgsi_to_rc.h
index 39b473c7bf5..97641a954b9 100644
--- a/src/gallium/drivers/r300/r300_tgsi_to_rc.h
+++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.h
@@ -23,6 +23,8 @@
#ifndef R300_TGSI_TO_RC_H
#define R300_TGSI_TO_RC_H
+#include "pipe/p_compiler.h"
+
struct radeon_compiler;
struct tgsi_full_declaration;
@@ -41,6 +43,10 @@ struct tgsi_to_rc {
int immediate_offset;
struct swizzled_imms * imms_to_swizzle;
unsigned imms_to_swizzle_count;
+
+ /* Vertex shaders have no half swizzles, and no way to handle them, so
+ * until rc grows proper support, indicate if they're safe to use. */
+ boolean use_half_swizzles;
};
void r300_tgsi_to_rc(struct tgsi_to_rc * ttr, const struct tgsi_token * tokens);
diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c
index fb81b2439b6..a6786c321c6 100644
--- a/src/gallium/drivers/r300/r300_vs.c
+++ b/src/gallium/drivers/r300/r300_vs.c
@@ -340,6 +340,7 @@ void r300_translate_vertex_shader(struct r300_context* r300,
/* Translate TGSI to our internal representation */
ttr.compiler = &compiler.Base;
ttr.info = &vs->info;
+ ttr.use_half_swizzles = FALSE;
r300_tgsi_to_rc(&ttr, vs->state.tokens);
diff --git a/src/gallium/drivers/svga/svga_draw.c b/src/gallium/drivers/svga/svga_draw.c
index f4d2d8992c8..8b7ca2e1123 100644
--- a/src/gallium/drivers/svga/svga_draw.c
+++ b/src/gallium/drivers/svga/svga_draw.c
@@ -253,7 +253,9 @@ enum pipe_error svga_hwtnl_prim( struct svga_hwtnl *hwtnl,
assert(index_bias >= 0);
assert(min_index <= max_index);
assert(offset + index_bias*stride < size);
- assert(offset + (index_bias + min_index)*stride < size);
+ if (min_index != ~0) {
+ assert(offset + (index_bias + min_index) * stride < size);
+ }
switch (hwtnl->cmd.vdecl[i].identity.type) {
case SVGA3D_DECLTYPE_FLOAT1:
@@ -314,7 +316,9 @@ enum pipe_error svga_hwtnl_prim( struct svga_hwtnl *hwtnl,
}
assert(!stride || width <= stride);
- assert(offset + (index_bias + max_index)*stride + width <= size);
+ if (max_index != ~0) {
+ assert(offset + (index_bias + max_index) * stride + width <= size);
+ }
}
assert(range->indexWidth == range->indexArray.stride);
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
index 8143be50244..735cdfdae99 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -111,6 +111,8 @@ svga_get_paramf(struct pipe_screen *screen, int param)
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
return 16;
+ case PIPE_CAP_MAX_COMBINED_SAMPLERS:
+ return 16;
case PIPE_CAP_NPOT_TEXTURES:
return 1;
case PIPE_CAP_TWO_SIDED_STENCIL:
diff --git a/src/gallium/drivers/svga/svgadump/svga_shader.h b/src/gallium/drivers/svga/svgadump/svga_shader.h
index 9217af2dd99..5db64bf135b 100644
--- a/src/gallium/drivers/svga/svgadump/svga_shader.h
+++ b/src/gallium/drivers/svga/svgadump/svga_shader.h
@@ -98,21 +98,33 @@ struct sh_defi
#define PS_TEXTURETYPE_CUBE SVGA3DSAMP_CUBE
#define PS_TEXTURETYPE_VOLUME SVGA3DSAMP_VOLUME
-struct ps_sampleinfo
+struct sh_sampleinfo
{
unsigned unused:27;
unsigned texture_type:4;
unsigned is_reg:1;
};
-struct vs_semantic
+struct sh_semantic
{
- unsigned usage:5;
- unsigned unused1:11;
+ unsigned usage:4;
+ unsigned unused1:12;
unsigned usage_index:4;
- unsigned unused2:12;
+ unsigned unused2:11;
+ unsigned is_reg:1;
};
+#define SH_WRITEMASK_0 0x1
+#define SH_WRITEMASK_1 0x2
+#define SH_WRITEMASK_2 0x4
+#define SH_WRITEMASK_3 0x8
+#define SH_WRITEMASK_ALL 0xf
+
+#define SH_DSTMOD_NONE 0x0
+#define SH_DSTMOD_SATURATE 0x1
+#define SH_DSTMOD_PARTIALPRECISION 0x2
+#define SH_DSTMOD_MSAMPCENTROID 0x4
+
struct sh_dstreg
{
unsigned number:11;
@@ -136,17 +148,12 @@ struct sh_dcl
{
struct sh_op op;
union {
- struct {
- struct ps_sampleinfo sampleinfo;
- } ps;
- struct {
- struct vs_semantic semantic;
- } vs;
+ struct sh_sampleinfo sampleinfo;
+ struct sh_semantic semantic;
} u;
struct sh_dstreg reg;
};
-
struct sh_srcreg
{
unsigned number:11;
diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
index 70e27d86d30..d2bfb439f38 100644
--- a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
+++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
@@ -40,102 +40,139 @@
struct dump_info
{
- SVGA3dShaderVersion version;
+ uint32 version;
boolean is_ps;
+ int indent;
};
-static void dump_op( struct sh_op op, const char *mnemonic )
+#define DUMP_MAX_OP_SRC 4
+
+struct dump_op
{
- assert( op.predicated == 0 );
- assert( op.is_reg == 0 );
+ struct sh_op op;
+ struct sh_dstreg dst;
+ struct sh_srcreg dstind;
+ struct sh_srcreg src[DUMP_MAX_OP_SRC];
+ struct sh_srcreg srcind[DUMP_MAX_OP_SRC];
+ struct sh_srcreg p0;
+};
- if (op.coissue)
- _debug_printf( "+" );
- _debug_printf( "%s", mnemonic );
- switch (op.control) {
- case 0:
- break;
- case SVGA3DOPCONT_PROJECT:
- _debug_printf( "p" );
- break;
- case SVGA3DOPCONT_BIAS:
- _debug_printf( "b" );
- break;
- default:
- assert( 0 );
+static void
+dump_indent(int indent)
+{
+ int i;
+
+ for (i = 0; i < indent; ++i) {
+ _debug_printf(" ");
}
}
-
-static void dump_comp_op( struct sh_op op, const char *mnemonic )
+static void dump_op( struct sh_op op, const char *mnemonic )
{
assert( op.is_reg == 0 );
+ if (op.predicated) {
+ _debug_printf("(p0) ");
+ }
if (op.coissue)
_debug_printf( "+" );
_debug_printf( "%s", mnemonic );
- switch (op.control) {
- case SVGA3DOPCOMP_RESERVED0:
- break;
- case SVGA3DOPCOMP_GT:
- _debug_printf("_gt");
- break;
- case SVGA3DOPCOMP_EQ:
- _debug_printf("_eq");
- break;
- case SVGA3DOPCOMP_GE:
- _debug_printf("_ge");
- break;
- case SVGA3DOPCOMP_LT:
- _debug_printf("_lt");
- break;
- case SVGA3DOPCOMPC_NE:
- _debug_printf("_ne");
+
+ switch (op.opcode) {
+ case SVGA3DOP_TEX:
+ switch (op.control) {
+ case 0:
+ break;
+ case 1 /* PROJECT */:
+ _debug_printf("p");
+ break;
+ case 2 /* BIAS */:
+ _debug_printf("b");
+ break;
+ default:
+ assert(0);
+ }
break;
- case SVGA3DOPCOMP_LE:
- _debug_printf("_le");
+
+ case SVGA3DOP_IFC:
+ case SVGA3DOP_BREAKC:
+ case SVGA3DOP_SETP:
+ switch (op.control) {
+ case SVGA3DOPCOMP_GT:
+ _debug_printf("_gt");
+ break;
+ case SVGA3DOPCOMP_EQ:
+ _debug_printf("_eq");
+ break;
+ case SVGA3DOPCOMP_GE:
+ _debug_printf("_ge");
+ break;
+ case SVGA3DOPCOMP_LT:
+ _debug_printf("_lt");
+ break;
+ case SVGA3DOPCOMPC_NE:
+ _debug_printf("_ne");
+ break;
+ case SVGA3DOPCOMP_LE:
+ _debug_printf("_le");
+ break;
+ default:
+ assert(0);
+ }
break;
- case SVGA3DOPCOMP_RESERVED1:
+
default:
- assert( 0 );
+ assert(op.control == 0);
}
}
+static void
+format_reg(const char *name,
+ const struct sh_reg reg,
+ const struct sh_srcreg *indreg)
+{
+ if (reg.relative) {
+ assert(indreg);
+
+ if (sh_srcreg_type(*indreg) == SVGA3DREG_LOOP) {
+ _debug_printf("%s[aL+%u]", name, reg.number);
+ } else {
+ _debug_printf("%s[a%u.x+%u]", name, indreg->number, reg.number);
+ }
+ } else {
+ _debug_printf("%s%u", name, reg.number);
+ }
+}
static void dump_reg( struct sh_reg reg, struct sh_srcreg *indreg, const struct dump_info *di )
{
- assert( sh_reg_type( reg ) == SVGA3DREG_CONST || reg.relative == 0 );
assert( reg.is_reg == 1 );
switch (sh_reg_type( reg )) {
case SVGA3DREG_TEMP:
- _debug_printf( "r%u", reg.number );
+ format_reg("r", reg, NULL);
break;
case SVGA3DREG_INPUT:
- _debug_printf( "v%u", reg.number );
+ format_reg("v", reg, indreg);
break;
case SVGA3DREG_CONST:
- if (reg.relative) {
- if (sh_srcreg_type( *indreg ) == SVGA3DREG_LOOP)
- _debug_printf( "c[aL+%u]", reg.number );
- else
- _debug_printf( "c[a%u.x+%u]", indreg->number, reg.number );
- }
- else
- _debug_printf( "c%u", reg.number );
+ format_reg("c", reg, indreg);
break;
case SVGA3DREG_ADDR: /* VS */
/* SVGA3DREG_TEXTURE */ /* PS */
- if (di->is_ps)
- _debug_printf( "t%u", reg.number );
- else
- _debug_printf( "a%u", reg.number );
+ assert(!reg.relative);
+ if (di->is_ps) {
+ format_reg("t", reg, NULL);
+ } else {
+ format_reg("a", reg, NULL);
+ }
break;
case SVGA3DREG_RASTOUT:
+ assert(!reg.relative);
switch (reg.number) {
case 0 /*POSITION*/:
_debug_printf( "oPos" );
@@ -154,64 +191,69 @@ static void dump_reg( struct sh_reg reg, struct sh_srcreg *indreg, const struct
case SVGA3DREG_ATTROUT:
assert( reg.number < 2 );
- _debug_printf( "oD%u", reg.number );
+ format_reg("oD", reg, NULL);
break;
- case SVGA3DREG_TEXCRDOUT:
- /* SVGA3DREG_OUTPUT */
- _debug_printf( "oT%u", reg.number );
+ case SVGA3DREG_TEXCRDOUT: /* VS */
+ /* SVGA3DREG_OUTPUT */ /* VS3.0+ */
+ if (!di->is_ps && di->version >= SVGA3D_VS_30) {
+ format_reg("o", reg, indreg);
+ } else {
+ format_reg("oT", reg, NULL);
+ }
break;
case SVGA3DREG_COLOROUT:
- _debug_printf( "oC%u", reg.number );
+ format_reg("oC", reg, NULL);
break;
case SVGA3DREG_DEPTHOUT:
- _debug_printf( "oD%u", reg.number );
+ assert(!reg.relative);
+ assert(reg.number == 0);
+ _debug_printf("oDepth");
break;
case SVGA3DREG_SAMPLER:
- _debug_printf( "s%u", reg.number );
+ format_reg("s", reg, NULL);
break;
case SVGA3DREG_CONSTBOOL:
- assert( !reg.relative );
- _debug_printf( "b%u", reg.number );
+ format_reg("b", reg, NULL);
break;
case SVGA3DREG_CONSTINT:
- assert( !reg.relative );
- _debug_printf( "i%u", reg.number );
+ format_reg("i", reg, NULL);
break;
case SVGA3DREG_LOOP:
+ assert(!reg.relative);
assert( reg.number == 0 );
_debug_printf( "aL" );
break;
case SVGA3DREG_MISCTYPE:
+ assert(!reg.relative);
switch (reg.number) {
case SVGA3DMISCREG_POSITION:
- _debug_printf( "vPos" );
+ _debug_printf("vPos");
break;
case SVGA3DMISCREG_FACE:
- _debug_printf( "vFace" );
+ _debug_printf("vFace");
break;
default:
assert(0);
- break;
+ _debug_printf("???");
}
break;
case SVGA3DREG_LABEL:
- _debug_printf( "l%u", reg.number );
+ format_reg("l", reg, NULL);
break;
case SVGA3DREG_PREDICATE:
- _debug_printf( "p%u", reg.number );
+ format_reg("p", reg, NULL);
break;
-
default:
assert( 0 );
_debug_printf( "???" );
@@ -233,8 +275,11 @@ static void dump_bdata( boolean bdata )
_debug_printf( bdata ? "TRUE" : "FALSE" );
}
-static void dump_sampleinfo( struct ps_sampleinfo sampleinfo )
+static void
+dump_sampleinfo(struct sh_sampleinfo sampleinfo)
{
+ assert( sampleinfo.is_reg == 1 );
+
switch (sampleinfo.texture_type) {
case SVGA3DSAMP_2D:
_debug_printf( "_2d" );
@@ -250,63 +295,67 @@ static void dump_sampleinfo( struct ps_sampleinfo sampleinfo )
}
}
-
-static void dump_usageinfo( struct vs_semantic semantic )
+static void
+dump_semantic(uint usage,
+ uint usage_index)
{
- switch (semantic.usage) {
+ switch (usage) {
case SVGA3D_DECLUSAGE_POSITION:
- _debug_printf("_position" );
+ _debug_printf("_position");
break;
case SVGA3D_DECLUSAGE_BLENDWEIGHT:
- _debug_printf("_blendweight" );
+ _debug_printf("_blendweight");
break;
case SVGA3D_DECLUSAGE_BLENDINDICES:
- _debug_printf("_blendindices" );
+ _debug_printf("_blendindices");
break;
case SVGA3D_DECLUSAGE_NORMAL:
- _debug_printf("_normal" );
+ _debug_printf("_normal");
break;
case SVGA3D_DECLUSAGE_PSIZE:
- _debug_printf("_psize" );
+ _debug_printf("_psize");
break;
case SVGA3D_DECLUSAGE_TEXCOORD:
_debug_printf("_texcoord");
break;
case SVGA3D_DECLUSAGE_TANGENT:
- _debug_printf("_tangent" );
+ _debug_printf("_tangent");
break;
case SVGA3D_DECLUSAGE_BINORMAL:
- _debug_printf("_binormal" );
+ _debug_printf("_binormal");
break;
case SVGA3D_DECLUSAGE_TESSFACTOR:
- _debug_printf("_tessfactor" );
+ _debug_printf("_tessfactor");
break;
case SVGA3D_DECLUSAGE_POSITIONT:
- _debug_printf("_positiont" );
+ _debug_printf("_positiont");
break;
case SVGA3D_DECLUSAGE_COLOR:
- _debug_printf("_color" );
+ _debug_printf("_color");
break;
case SVGA3D_DECLUSAGE_FOG:
- _debug_printf("_fog" );
+ _debug_printf("_fog");
break;
case SVGA3D_DECLUSAGE_DEPTH:
- _debug_printf("_depth" );
+ _debug_printf("_depth");
break;
case SVGA3D_DECLUSAGE_SAMPLE:
_debug_printf("_sample");
break;
default:
- assert( 0 );
- return;
+ assert(!"Unknown usage");
+ _debug_printf("_???");
}
- if (semantic.usage_index != 0) {
- _debug_printf("%d", semantic.usage_index );
+ if (usage_index) {
+ _debug_printf("%u", usage_index);
}
}
-static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di )
+static void
+dump_dstreg(struct sh_dstreg dstreg,
+ struct sh_srcreg *indreg,
+ const struct dump_info *di)
{
union {
struct sh_reg reg;
@@ -346,7 +395,7 @@ static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di )
_debug_printf( " " );
u.dstreg = dstreg;
- dump_reg( u.reg, NULL, di );
+ dump_reg( u.reg, indreg, di);
if (dstreg.write_mask != SVGA3DWRITEMASK_ALL) {
_debug_printf( "." );
if (dstreg.write_mask & SVGA3DWRITEMASK_0)
@@ -362,23 +411,13 @@ static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di )
static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, const struct dump_info *di )
{
- union {
- struct sh_reg reg;
- struct sh_srcreg srcreg;
- } u;
-
switch (srcreg.modifier) {
case SVGA3DSRCMOD_NEG:
case SVGA3DSRCMOD_BIASNEG:
case SVGA3DSRCMOD_SIGNNEG:
case SVGA3DSRCMOD_X2NEG:
- _debug_printf( "-" );
- break;
- case SVGA3DSRCMOD_ABS:
- _debug_printf( "|" );
- break;
case SVGA3DSRCMOD_ABSNEG:
- _debug_printf( "-|" );
+ _debug_printf( "-" );
break;
case SVGA3DSRCMOD_COMP:
_debug_printf( "1-" );
@@ -386,19 +425,13 @@ static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, cons
case SVGA3DSRCMOD_NOT:
_debug_printf( "!" );
}
-
- u.srcreg = srcreg;
- dump_reg( u.reg, indreg, di );
+ dump_reg( *(struct sh_reg *) &srcreg, indreg, di );
switch (srcreg.modifier) {
case SVGA3DSRCMOD_NONE:
case SVGA3DSRCMOD_NEG:
case SVGA3DSRCMOD_COMP:
case SVGA3DSRCMOD_NOT:
break;
- case SVGA3DSRCMOD_ABS:
- case SVGA3DSRCMOD_ABSNEG:
- _debug_printf( "|" );
- break;
case SVGA3DSRCMOD_BIAS:
case SVGA3DSRCMOD_BIASNEG:
_debug_printf( "_bias" );
@@ -417,6 +450,10 @@ static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, cons
case SVGA3DSRCMOD_DW:
_debug_printf( "_dw" );
break;
+ case SVGA3DSRCMOD_ABS:
+ case SVGA3DSRCMOD_ABSNEG:
+ _debug_printf("_abs");
+ break;
default:
assert( 0 );
}
@@ -434,58 +471,132 @@ static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, cons
}
}
+static void
+parse_op(struct dump_info *di,
+ const uint **token,
+ struct dump_op *op,
+ uint num_dst,
+ uint num_src)
+{
+ uint i;
+
+ assert(num_dst <= 1);
+ assert(num_src <= DUMP_MAX_OP_SRC);
+
+ op->op = *(struct sh_op *)*token;
+ *token += sizeof(struct sh_op) / sizeof(uint);
+
+ if (num_dst >= 1) {
+ op->dst = *(struct sh_dstreg *)*token;
+ *token += sizeof(struct sh_dstreg) / sizeof(uint);
+ if (op->dst.relative &&
+ (!di->is_ps && di->version >= SVGA3D_VS_30)) {
+ op->dstind = *(struct sh_srcreg *)*token;
+ *token += sizeof(struct sh_srcreg) / sizeof(uint);
+ }
+ }
+
+ if (op->op.predicated) {
+ op->p0 = *(struct sh_srcreg *)*token;
+ *token += sizeof(struct sh_srcreg) / sizeof(uint);
+ }
+
+ for (i = 0; i < num_src; ++i) {
+ op->src[i] = *(struct sh_srcreg *)*token;
+ *token += sizeof(struct sh_srcreg) / sizeof(uint);
+ if (op->src[i].relative &&
+ ((!di->is_ps && di->version >= SVGA3D_VS_20) ||
+ (di->is_ps && di->version >= SVGA3D_PS_30))) {
+ op->srcind[i] = *(struct sh_srcreg *)*token;
+ *token += sizeof(struct sh_srcreg) / sizeof(uint);
+ }
+ }
+}
+
+static void
+dump_inst(struct dump_info *di,
+ const unsigned **assem,
+ struct sh_op op,
+ const struct sh_opcode_info *info)
+{
+ struct dump_op dop;
+ boolean not_first_arg = FALSE;
+ uint i;
+
+ assert(info->num_dst <= 1);
+
+ di->indent -= info->pre_dedent;
+ dump_indent(di->indent);
+ di->indent += info->post_indent;
+
+ dump_op(op, info->mnemonic);
+
+ parse_op(di, assem, &dop, info->num_dst, info->num_src);
+ if (info->num_dst > 0) {
+ dump_dstreg(dop.dst, &dop.dstind, di);
+ not_first_arg = TRUE;
+ }
+
+ for (i = 0; i < info->num_src; i++) {
+ if (not_first_arg) {
+ _debug_printf(", ");
+ } else {
+ _debug_printf(" ");
+ }
+ dump_srcreg(dop.src[i], &dop.srcind[i], di);
+ not_first_arg = TRUE;
+ }
+
+ _debug_printf("\n");
+}
+
void
svga_shader_dump(
const unsigned *assem,
unsigned dwords,
unsigned do_binary )
{
- const unsigned *start = assem;
boolean finished = FALSE;
struct dump_info di;
- unsigned i;
- if (do_binary) {
- for (i = 0; i < dwords; i++)
- _debug_printf(" 0x%08x,\n", assem[i]);
-
- _debug_printf("\n\n");
- }
-
- di.version.value = *assem++;
- di.is_ps = (di.version.type == SVGA3D_PS_TYPE);
+ di.version = *assem++;
+ di.is_ps = (di.version & 0xFFFF0000) == 0xFFFF0000;
+ di.indent = 0;
_debug_printf(
"%s_%u_%u\n",
di.is_ps ? "ps" : "vs",
- di.version.major,
- di.version.minor );
+ (di.version >> 8) & 0xff,
+ di.version & 0xff );
while (!finished) {
struct sh_op op = *(struct sh_op *) assem;
- if (assem - start >= dwords) {
- _debug_printf("... ran off end of buffer\n");
- assert(0);
- return;
- }
-
switch (op.opcode) {
case SVGA3DOP_DCL:
{
struct sh_dcl dcl = *(struct sh_dcl *) assem;
_debug_printf( "dcl" );
- if (sh_dstreg_type( dcl.reg ) == SVGA3DREG_SAMPLER)
- dump_sampleinfo( dcl.u.ps.sampleinfo );
- else if (di.is_ps) {
- if (di.version.major == 3 &&
- sh_dstreg_type( dcl.reg ) != SVGA3DREG_MISCTYPE)
- dump_usageinfo( dcl.u.vs.semantic );
+ switch (sh_dstreg_type(dcl.reg)) {
+ case SVGA3DREG_INPUT:
+ if ((di.is_ps && di.version >= SVGA3D_PS_30) ||
+ (!di.is_ps && di.version >= SVGA3D_VS_30)) {
+ dump_semantic(dcl.u.semantic.usage,
+ dcl.u.semantic.usage_index);
+ }
+ break;
+ case SVGA3DREG_TEXCRDOUT:
+ if (!di.is_ps && di.version >= SVGA3D_VS_30) {
+ dump_semantic(dcl.u.semantic.usage,
+ dcl.u.semantic.usage_index);
+ }
+ break;
+ case SVGA3DREG_SAMPLER:
+ dump_sampleinfo( dcl.u.sampleinfo );
+ break;
}
- else
- dump_usageinfo( dcl.u.vs.semantic );
- dump_dstreg( dcl.reg, &di );
+ dump_dstreg(dcl.reg, NULL, &di);
_debug_printf( "\n" );
assem += sizeof( struct sh_dcl ) / sizeof( unsigned );
}
@@ -518,54 +629,38 @@ svga_shader_dump(
break;
case SVGA3DOP_TEXCOORD:
- assert( di.is_ps );
- dump_op( op, "texcoord" );
- if (0) {
- struct sh_dstop dstop = *(struct sh_dstop *) assem;
- dump_dstreg( dstop.dst, &di );
- assem += sizeof( struct sh_dstop ) / sizeof( unsigned );
- }
- else {
- struct sh_unaryop unaryop = *(struct sh_unaryop *) assem;
- dump_dstreg( unaryop.dst, &di );
- _debug_printf( ", " );
- dump_srcreg( unaryop.src, NULL, &di );
- assem += sizeof( struct sh_unaryop ) / sizeof( unsigned );
+ {
+ struct sh_opcode_info info = *svga_opcode_info(op.opcode);
+
+ assert(di.is_ps);
+ if (di.version > SVGA3D_PS_13) {
+ assert(info.num_src == 0);
+
+ info.num_src = 1;
+ }
+
+ dump_inst(&di, &assem, op, &info);
}
- _debug_printf( "\n" );
break;
case SVGA3DOP_TEX:
- assert( di.is_ps );
- if (0) {
- dump_op( op, "tex" );
- if (0) {
- struct sh_dstop dstop = *(struct sh_dstop *) assem;
-
- dump_dstreg( dstop.dst, &di );
- assem += sizeof( struct sh_dstop ) / sizeof( unsigned );
- }
- else {
- struct sh_unaryop unaryop = *(struct sh_unaryop *) assem;
+ {
+ struct sh_opcode_info info = *svga_opcode_info(op.opcode);
- dump_dstreg( unaryop.dst, &di );
- _debug_printf( ", " );
- dump_srcreg( unaryop.src, NULL, &di );
- assem += sizeof( struct sh_unaryop ) / sizeof( unsigned );
+ assert(di.is_ps);
+ if (di.version > SVGA3D_PS_13) {
+ assert(info.num_src == 0);
+
+ if (di.version > SVGA3D_PS_14) {
+ info.num_src = 2;
+ info.mnemonic = "texld";
+ } else {
+ info.num_src = 1;
+ }
}
- }
- else {
- struct sh_binaryop binaryop = *(struct sh_binaryop *) assem;
- dump_op( op, "texld" );
- dump_dstreg( binaryop.dst, &di );
- _debug_printf( ", " );
- dump_srcreg( binaryop.src0, NULL, &di );
- _debug_printf( ", " );
- dump_srcreg( binaryop.src1, NULL, &di );
- assem += sizeof( struct sh_binaryop ) / sizeof( unsigned );
+ dump_inst(&di, &assem, op, &info);
}
- _debug_printf( "\n" );
break;
case SVGA3DOP_DEF:
@@ -581,6 +676,21 @@ svga_shader_dump(
}
break;
+ case SVGA3DOP_SINCOS:
+ {
+ struct sh_opcode_info info = *svga_opcode_info(op.opcode);
+
+ if ((di.is_ps && di.version >= SVGA3D_PS_30) ||
+ (!di.is_ps && di.version >= SVGA3D_VS_30)) {
+ assert(info.num_src == 3);
+
+ info.num_src = 1;
+ }
+
+ dump_inst(&di, &assem, op, &info);
+ }
+ break;
+
case SVGA3DOP_PHASE:
_debug_printf( "phase\n" );
assem += sizeof( struct sh_op ) / sizeof( unsigned );
@@ -595,59 +705,15 @@ svga_shader_dump(
}
break;
- case SVGA3DOP_RET:
- _debug_printf( "ret\n" );
- assem += sizeof( struct sh_op ) / sizeof( unsigned );
- break;
-
case SVGA3DOP_END:
- _debug_printf( "end\n" );
finished = TRUE;
break;
default:
{
- const struct sh_opcode_info *info = svga_opcode_info( op.opcode );
- uint i;
- uint num_src = info->num_src + op.predicated;
- boolean not_first_arg = FALSE;
-
- assert( info->num_dst <= 1 );
-
- if (op.opcode == SVGA3DOP_SINCOS && di.version.major < 3)
- num_src += 2;
-
- dump_comp_op( op, info->mnemonic );
- assem += sizeof( struct sh_op ) / sizeof( unsigned );
-
- if (info->num_dst > 0) {
- struct sh_dstreg dstreg = *(struct sh_dstreg *) assem;
+ const struct sh_opcode_info *info = svga_opcode_info(op.opcode);
- dump_dstreg( dstreg, &di );
- assem += sizeof( struct sh_dstreg ) / sizeof( unsigned );
- not_first_arg = TRUE;
- }
-
- for (i = 0; i < num_src; i++) {
- struct sh_srcreg srcreg;
- struct sh_srcreg indreg;
-
- srcreg = *(struct sh_srcreg *) assem;
- assem += sizeof( struct sh_srcreg ) / sizeof( unsigned );
- if (srcreg.relative && !di.is_ps && di.version.major >= 2) {
- indreg = *(struct sh_srcreg *) assem;
- assem += sizeof( struct sh_srcreg ) / sizeof( unsigned );
- }
-
- if (not_first_arg)
- _debug_printf( ", " );
- else
- _debug_printf( " " );
- dump_srcreg( srcreg, &indreg, &di );
- not_first_arg = TRUE;
- }
-
- _debug_printf( "\n" );
+ dump_inst(&di, &assem, op, info);
}
}
}
diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_op.c b/src/gallium/drivers/svga/svgadump/svga_shader_op.c
index 8343bfdaab4..95612a80063 100644
--- a/src/gallium/drivers/svga/svgadump/svga_shader_op.c
+++ b/src/gallium/drivers/svga/svgadump/svga_shader_op.c
@@ -41,103 +41,103 @@
static struct sh_opcode_info opcode_info[] =
{
- { "nop", 0, 0, SVGA3DOP_NOP },
- { "mov", 1, 1, SVGA3DOP_MOV, },
- { "add", 1, 2, SVGA3DOP_ADD, },
- { "sub", 1, 2, SVGA3DOP_SUB, },
- { "mad", 1, 3, SVGA3DOP_MAD, },
- { "mul", 1, 2, SVGA3DOP_MUL, },
- { "rcp", 1, 1, SVGA3DOP_RCP, },
- { "rsq", 1, 1, SVGA3DOP_RSQ, },
- { "dp3", 1, 2, SVGA3DOP_DP3, },
- { "dp4", 1, 2, SVGA3DOP_DP4, },
- { "min", 1, 2, SVGA3DOP_MIN, },
- { "max", 1, 2, SVGA3DOP_MAX, },
- { "slt", 1, 2, SVGA3DOP_SLT, },
- { "sge", 1, 2, SVGA3DOP_SGE, },
- { "exp", 1, 1, SVGA3DOP_EXP, },
- { "log", 1, 1, SVGA3DOP_LOG, },
- { "lit", 1, 1, SVGA3DOP_LIT, },
- { "dst", 1, 2, SVGA3DOP_DST, },
- { "lrp", 1, 3, SVGA3DOP_LRP, },
- { "frc", 1, 1, SVGA3DOP_FRC, },
- { "m4x4", 1, 2, SVGA3DOP_M4x4, },
- { "m4x3", 1, 2, SVGA3DOP_M4x3, },
- { "m3x4", 1, 2, SVGA3DOP_M3x4, },
- { "m3x3", 1, 2, SVGA3DOP_M3x3, },
- { "m3x2", 1, 2, SVGA3DOP_M3x2, },
- { "call", 0, 1, SVGA3DOP_CALL, },
- { "callnz", 0, 2, SVGA3DOP_CALLNZ, },
- { "loop", 0, 2, SVGA3DOP_LOOP, },
- { "ret", 0, 0, SVGA3DOP_RET, },
- { "endloop", 0, 0, SVGA3DOP_ENDLOOP, },
- { "label", 0, 1, SVGA3DOP_LABEL, },
- { "dcl", 0, 0, SVGA3DOP_DCL, },
- { "pow", 1, 2, SVGA3DOP_POW, },
- { "crs", 1, 2, SVGA3DOP_CRS, },
- { "sgn", 1, 3, SVGA3DOP_SGN, },
- { "abs", 1, 1, SVGA3DOP_ABS, },
- { "nrm", 1, 1, SVGA3DOP_NRM, }, /* 3-componenet normalization */
- { "sincos", 1, 1, SVGA3DOP_SINCOS, },
- { "rep", 0, 1, SVGA3DOP_REP, },
- { "endrep", 0, 0, SVGA3DOP_ENDREP, },
- { "if", 0, 1, SVGA3DOP_IF, },
- { "ifc", 0, 2, SVGA3DOP_IFC, },
- { "else", 0, 0, SVGA3DOP_ELSE, },
- { "endif", 0, 0, SVGA3DOP_ENDIF, },
- { "break", 0, 0, SVGA3DOP_BREAK, },
- { "breakc", 0, 0, SVGA3DOP_BREAKC, },
- { "mova", 1, 1, SVGA3DOP_MOVA, },
- { "defb", 0, 0, SVGA3DOP_DEFB, },
- { "defi", 0, 0, SVGA3DOP_DEFI, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "texcoord", 0, 0, SVGA3DOP_TEXCOORD, },
- { "texkill", 1, 0, SVGA3DOP_TEXKILL, },
- { "tex", 0, 0, SVGA3DOP_TEX, },
- { "texbem", 1, 1, SVGA3DOP_TEXBEM, },
- { "texbeml", 1, 1, SVGA3DOP_TEXBEML, },
- { "texreg2ar", 1, 1, SVGA3DOP_TEXREG2AR, },
- { "texreg2gb", 1, 1, SVGA3DOP_TEXREG2GB, },
- { "texm3x2pad", 1, 1, SVGA3DOP_TEXM3x2PAD, },
- { "texm3x2tex", 1, 1, SVGA3DOP_TEXM3x2TEX, },
- { "texm3x3pad", 1, 1, SVGA3DOP_TEXM3x3PAD, },
- { "texm3x3tex", 1, 1, SVGA3DOP_TEXM3x3TEX, },
- { "reserved0", 0, 0, SVGA3DOP_RESERVED0, },
- { "texm3x3spec", 1, 2, SVGA3DOP_TEXM3x3SPEC, },
- { "texm3x3vspec", 1, 1, SVGA3DOP_TEXM3x3VSPEC,},
- { "expp", 1, 1, SVGA3DOP_EXPP, },
- { "logp", 1, 1, SVGA3DOP_LOGP, },
- { "cnd", 1, 3, SVGA3DOP_CND, },
- { "def", 0, 0, SVGA3DOP_DEF, },
- { "texreg2rgb", 1, 1, SVGA3DOP_TEXREG2RGB, },
- { "texdp3tex", 1, 1, SVGA3DOP_TEXDP3TEX, },
- { "texm3x2depth", 1, 1, SVGA3DOP_TEXM3x2DEPTH,},
- { "texdp3", 1, 1, SVGA3DOP_TEXDP3, },
- { "texm3x3", 1, 1, SVGA3DOP_TEXM3x3, },
- { "texdepth", 1, 0, SVGA3DOP_TEXDEPTH, },
- { "cmp", 1, 3, SVGA3DOP_CMP, },
- { "bem", 1, 2, SVGA3DOP_BEM, },
- { "dp2add", 1, 3, SVGA3DOP_DP2ADD, },
- { "dsx", 1, 1, SVGA3DOP_INVALID, },
- { "dsy", 1, 1, SVGA3DOP_INVALID, },
- { "texldd", 1, 1, SVGA3DOP_INVALID, },
- { "setp", 1, 2, SVGA3DOP_SETP, },
- { "texldl", 1, 1, SVGA3DOP_INVALID, },
- { "breakp", 1, 1, SVGA3DOP_INVALID, },
+ { "nop", 0, 0, 0, 0, SVGA3DOP_NOP },
+ { "mov", 1, 1, 0, 0, SVGA3DOP_MOV, },
+ { "add", 1, 2, 0, 0, SVGA3DOP_ADD, },
+ { "sub", 1, 2, 0, 0, SVGA3DOP_SUB, },
+ { "mad", 1, 3, 0, 0, SVGA3DOP_MAD, },
+ { "mul", 1, 2, 0, 0, SVGA3DOP_MUL, },
+ { "rcp", 1, 1, 0, 0, SVGA3DOP_RCP, },
+ { "rsq", 1, 1, 0, 0, SVGA3DOP_RSQ, },
+ { "dp3", 1, 2, 0, 0, SVGA3DOP_DP3, },
+ { "dp4", 1, 2, 0, 0, SVGA3DOP_DP4, },
+ { "min", 1, 2, 0, 0, SVGA3DOP_MIN, },
+ { "max", 1, 2, 0, 0, SVGA3DOP_MAX, },
+ { "slt", 1, 2, 0, 0, SVGA3DOP_SLT, },
+ { "sge", 1, 2, 0, 0, SVGA3DOP_SGE, },
+ { "exp", 1, 1, 0, 0, SVGA3DOP_EXP, },
+ { "log", 1, 1, 0, 0, SVGA3DOP_LOG, },
+ { "lit", 1, 1, 0, 0, SVGA3DOP_LIT, },
+ { "dst", 1, 2, 0, 0, SVGA3DOP_DST, },
+ { "lrp", 1, 3, 0, 0, SVGA3DOP_LRP, },
+ { "frc", 1, 1, 0, 0, SVGA3DOP_FRC, },
+ { "m4x4", 1, 2, 0, 0, SVGA3DOP_M4x4, },
+ { "m4x3", 1, 2, 0, 0, SVGA3DOP_M4x3, },
+ { "m3x4", 1, 2, 0, 0, SVGA3DOP_M3x4, },
+ { "m3x3", 1, 2, 0, 0, SVGA3DOP_M3x3, },
+ { "m3x2", 1, 2, 0, 0, SVGA3DOP_M3x2, },
+ { "call", 0, 1, 0, 0, SVGA3DOP_CALL, },
+ { "callnz", 0, 2, 0, 0, SVGA3DOP_CALLNZ, },
+ { "loop", 0, 2, 0, 1, SVGA3DOP_LOOP, },
+ { "ret", 0, 0, 0, 0, SVGA3DOP_RET, },
+ { "endloop", 0, 0, 1, 0, SVGA3DOP_ENDLOOP, },
+ { "label", 0, 1, 0, 0, SVGA3DOP_LABEL, },
+ { "dcl", 0, 0, 0, 0, SVGA3DOP_DCL, },
+ { "pow", 1, 2, 0, 0, SVGA3DOP_POW, },
+ { "crs", 1, 2, 0, 0, SVGA3DOP_CRS, },
+ { "sgn", 1, 3, 0, 0, SVGA3DOP_SGN, },
+ { "abs", 1, 1, 0, 0, SVGA3DOP_ABS, },
+ { "nrm", 1, 1, 0, 0, SVGA3DOP_NRM, }, /* 3-componenet normalization */
+ { "sincos", 1, 3, 0, 0, SVGA3DOP_SINCOS, },
+ { "rep", 0, 1, 0, 1, SVGA3DOP_REP, },
+ { "endrep", 0, 0, 1, 0, SVGA3DOP_ENDREP, },
+ { "if", 0, 1, 0, 1, SVGA3DOP_IF, },
+ { "ifc", 0, 2, 0, 1, SVGA3DOP_IFC, },
+ { "else", 0, 0, 1, 1, SVGA3DOP_ELSE, },
+ { "endif", 0, 0, 1, 0, SVGA3DOP_ENDIF, },
+ { "break", 0, 0, 0, 0, SVGA3DOP_BREAK, },
+ { "breakc", 0, 2, 0, 0, SVGA3DOP_BREAKC, },
+ { "mova", 1, 1, 0, 0, SVGA3DOP_MOVA, },
+ { "defb", 0, 0, 0, 0, SVGA3DOP_DEFB, },
+ { "defi", 0, 0, 0, 0, SVGA3DOP_DEFI, },
+ { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, },
+ { "texcoord", 1, 0, 0, 0, SVGA3DOP_TEXCOORD, },
+ { "texkill", 1, 0, 0, 0, SVGA3DOP_TEXKILL, },
+ { "tex", 1, 0, 0, 0, SVGA3DOP_TEX, },
+ { "texbem", 1, 1, 0, 0, SVGA3DOP_TEXBEM, },
+ { "texbeml", 1, 1, 0, 0, SVGA3DOP_TEXBEML, },
+ { "texreg2ar", 1, 1, 0, 0, SVGA3DOP_TEXREG2AR, },
+ { "texreg2gb", 1, 1, 0, 0, SVGA3DOP_TEXREG2GB, },
+ { "texm3x2pad", 1, 1, 0, 0, SVGA3DOP_TEXM3x2PAD, },
+ { "texm3x2tex", 1, 1, 0, 0, SVGA3DOP_TEXM3x2TEX, },
+ { "texm3x3pad", 1, 1, 0, 0, SVGA3DOP_TEXM3x3PAD, },
+ { "texm3x3tex", 1, 1, 0, 0, SVGA3DOP_TEXM3x3TEX, },
+ { "reserved0", 0, 0, 0, 0, SVGA3DOP_RESERVED0, },
+ { "texm3x3spec", 1, 2, 0, 0, SVGA3DOP_TEXM3x3SPEC, },
+ { "texm3x3vspec", 1, 1, 0, 0, SVGA3DOP_TEXM3x3VSPEC,},
+ { "expp", 1, 1, 0, 0, SVGA3DOP_EXPP, },
+ { "logp", 1, 1, 0, 0, SVGA3DOP_LOGP, },
+ { "cnd", 1, 3, 0, 0, SVGA3DOP_CND, },
+ { "def", 0, 0, 0, 0, SVGA3DOP_DEF, },
+ { "texreg2rgb", 1, 1, 0, 0, SVGA3DOP_TEXREG2RGB, },
+ { "texdp3tex", 1, 1, 0, 0, SVGA3DOP_TEXDP3TEX, },
+ { "texm3x2depth", 1, 1, 0, 0, SVGA3DOP_TEXM3x2DEPTH,},
+ { "texdp3", 1, 1, 0, 0, SVGA3DOP_TEXDP3, },
+ { "texm3x3", 1, 1, 0, 0, SVGA3DOP_TEXM3x3, },
+ { "texdepth", 1, 0, 0, 0, SVGA3DOP_TEXDEPTH, },
+ { "cmp", 1, 3, 0, 0, SVGA3DOP_CMP, },
+ { "bem", 1, 2, 0, 0, SVGA3DOP_BEM, },
+ { "dp2add", 1, 3, 0, 0, SVGA3DOP_DP2ADD, },
+ { "dsx", 1, 1, 0, 0, SVGA3DOP_INVALID, },
+ { "dsy", 1, 1, 0, 0, SVGA3DOP_INVALID, },
+ { "texldd", 1, 4, 0, 0, SVGA3DOP_INVALID, },
+ { "setp", 1, 2, 0, 0, SVGA3DOP_SETP, },
+ { "texldl", 1, 2, 0, 0, SVGA3DOP_INVALID, },
+ { "breakp", 0, 1, 0, 0, SVGA3DOP_INVALID, },
};
const struct sh_opcode_info *svga_opcode_info( uint op )
diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_op.h b/src/gallium/drivers/svga/svgadump/svga_shader_op.h
index e558de02c53..a5ccae5ae58 100644
--- a/src/gallium/drivers/svga/svgadump/svga_shader_op.h
+++ b/src/gallium/drivers/svga/svgadump/svga_shader_op.h
@@ -38,6 +38,8 @@ struct sh_opcode_info
const char *mnemonic;
unsigned num_dst:8;
unsigned num_src:8;
+ unsigned pre_dedent:1;
+ unsigned post_indent:1;
unsigned svga_opcode:16;
};
diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c
index 691b83c63fb..a43adac6940 100644
--- a/src/gallium/drivers/trace/tr_rbug.c
+++ b/src/gallium/drivers/trace/tr_rbug.c
@@ -32,7 +32,7 @@
#include "util/u_memory.h"
#include "util/u_simple_list.h"
#include "util/u_network.h"
-#include "util/u_time.h"
+#include "os/os_time.h"
#include "tgsi/tgsi_parse.h"
@@ -798,7 +798,7 @@ PIPE_THREAD_ROUTINE(trace_rbug_thread, void_tr_rbug)
debug_printf("trace_rbug - remote debugging listening on port %u\n", --port);
while(tr_rbug->running) {
- util_time_sleep(1);
+ os_time_sleep(1);
c = u_socket_accept(s);
if (c < 0)
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index f7ed6605bf8..ff21f2f9580 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -268,7 +268,7 @@ void dri2_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target,
void dri2_set_tex_buffer(__DRIcontext *pDRICtx, GLint target,
__DRIdrawable *dPriv)
{
- dri2_set_tex_buffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv);
+ dri2_set_tex_buffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv);
}
void
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index 2052867309c..4064976b234 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -157,7 +157,8 @@ dri_fill_in_modes(struct dri_screen *screen,
depth_bits_array, stencil_bits_array,
depth_buffer_factor, back_buffer_modes,
back_buffer_factor,
- msaa_samples_array, msaa_samples_factor);
+ msaa_samples_array, msaa_samples_factor,
+ GL_TRUE);
} else {
__DRIconfig **configs_a8r8g8b8 = NULL;
__DRIconfig **configs_x8r8g8b8 = NULL;
@@ -170,7 +171,8 @@ dri_fill_in_modes(struct dri_screen *screen,
back_buffer_modes,
back_buffer_factor,
msaa_samples_array,
- msaa_samples_factor);
+ msaa_samples_factor,
+ GL_TRUE);
if (pf_x8r8g8b8)
configs_x8r8g8b8 = driCreateConfigs(GL_BGR, GL_UNSIGNED_INT_8_8_8_8_REV,
depth_bits_array,
@@ -179,7 +181,8 @@ dri_fill_in_modes(struct dri_screen *screen,
back_buffer_modes,
back_buffer_factor,
msaa_samples_array,
- msaa_samples_factor);
+ msaa_samples_factor,
+ GL_TRUE);
if (configs_a8r8g8b8 && configs_x8r8g8b8)
configs = driConcatConfigs(configs_x8r8g8b8, configs_a8r8g8b8);
diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c
index 0785d2c6b85..c2f9c7550ed 100644
--- a/src/gallium/state_trackers/wgl/stw_context.c
+++ b/src/gallium/state_trackers/wgl/stw_context.c
@@ -75,6 +75,9 @@ DrvCopyContext(
struct stw_context *dst;
BOOL ret = FALSE;
+ if (!stw_dev)
+ return FALSE;
+
pipe_mutex_lock( stw_dev->ctx_mutex );
src = stw_lookup_context_locked( dhrcSource );
@@ -102,6 +105,9 @@ DrvShareLists(
struct stw_context *ctx2;
BOOL ret = FALSE;
+ if (!stw_dev)
+ return FALSE;
+
pipe_mutex_lock( stw_dev->ctx_mutex );
ctx1 = stw_lookup_context_locked( dhglrc1 );
diff --git a/src/gallium/state_trackers/wgl/stw_device.c b/src/gallium/state_trackers/wgl/stw_device.c
index 7785aba4677..ce6fe5f4ef5 100644
--- a/src/gallium/state_trackers/wgl/stw_device.c
+++ b/src/gallium/state_trackers/wgl/stw_device.c
@@ -152,24 +152,26 @@ stw_cleanup_thread(void)
void
stw_cleanup(void)
{
- unsigned i;
+ DHGLRC dhglrc;
debug_printf("%s\n", __FUNCTION__);
if (!stw_dev)
return;
+ /*
+ * Abort cleanup if there are still active contexts. In some situations
+ * this DLL may be unloaded before the DLL that is using GL contexts is.
+ */
pipe_mutex_lock( stw_dev->ctx_mutex );
- {
- /* Ensure all contexts are destroyed */
- i = handle_table_get_first_handle(stw_dev->ctx_table);
- while (i) {
- DrvDeleteContext(i);
- i = handle_table_get_next_handle(stw_dev->ctx_table, i);
- }
- handle_table_destroy(stw_dev->ctx_table);
- }
+ dhglrc = handle_table_get_first_handle(stw_dev->ctx_table);
pipe_mutex_unlock( stw_dev->ctx_mutex );
+ if (dhglrc) {
+ debug_printf("%s: contexts still active -- cleanup aborted\n", __FUNCTION__);
+ return;
+ }
+
+ handle_table_destroy(stw_dev->ctx_table);
stw_framebuffer_cleanup();
diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c
index 129a6298a77..02de21ccb2b 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c
@@ -179,7 +179,7 @@ stw_call_window_proc(
if(!tls_data)
return 0;
- if (nCode < 0)
+ if (nCode < 0 || !stw_dev)
return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam);
if (pParams->message == WM_WINDOWPOSCHANGED) {
@@ -332,6 +332,9 @@ stw_framebuffer_cleanup( void )
struct stw_framebuffer *fb;
struct stw_framebuffer *next;
+ if (!stw_dev)
+ return;
+
pipe_mutex_lock( stw_dev->fb_mutex );
fb = stw_dev->fb_head;
@@ -387,6 +390,9 @@ stw_framebuffer_from_hdc(
{
struct stw_framebuffer *fb;
+ if (!stw_dev)
+ return NULL;
+
pipe_mutex_lock( stw_dev->fb_mutex );
fb = stw_framebuffer_from_hdc_locked(hdc);
pipe_mutex_unlock( stw_dev->fb_mutex );
@@ -421,6 +427,9 @@ DrvSetPixelFormat(
uint index;
struct stw_framebuffer *fb;
+ if (!stw_dev)
+ return FALSE;
+
index = (uint) iPixelFormat - 1;
count = stw_pixelformat_get_extended_count();
if (index >= count)
@@ -475,6 +484,9 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data)
struct pipe_screen *screen;
struct pipe_surface *surface;
+ if (!stw_dev)
+ return FALSE;
+
fb = stw_framebuffer_from_hdc( hdc );
if (fb == NULL)
return FALSE;
@@ -576,6 +588,9 @@ DrvSwapBuffers(
struct stw_framebuffer *fb;
struct pipe_surface *surface = NULL;
+ if (!stw_dev)
+ return FALSE;
+
fb = stw_framebuffer_from_hdc( hdc );
if (fb == NULL)
return FALSE;
diff --git a/src/gallium/state_trackers/wgl/stw_getprocaddress.c b/src/gallium/state_trackers/wgl/stw_getprocaddress.c
index 8875dc22f3d..d43a55fa9e6 100644
--- a/src/gallium/state_trackers/wgl/stw_getprocaddress.c
+++ b/src/gallium/state_trackers/wgl/stw_getprocaddress.c
@@ -34,6 +34,8 @@
#include "glapi/glapi.h"
#include "stw_ext_gallium.h"
+#include "stw_device.h"
+#include "stw_icd.h"
struct stw_extension_entry
{
@@ -73,6 +75,9 @@ DrvGetProcAddress(
{
const struct stw_extension_entry *entry;
+ if (!stw_dev)
+ return NULL;
+
if (lpszProc[0] == 'w' && lpszProc[1] == 'g' && lpszProc[2] == 'l')
for (entry = stw_extension_entries; entry->name; entry++)
if (strcmp( lpszProc, entry->name ) == 0)
diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.c b/src/gallium/state_trackers/wgl/stw_pixelformat.c
index 7d4c2430b0c..b750b03695f 100644
--- a/src/gallium/state_trackers/wgl/stw_pixelformat.c
+++ b/src/gallium/state_trackers/wgl/stw_pixelformat.c
@@ -302,6 +302,9 @@ DrvDescribePixelFormat(
(void) hdc;
+ if (!stw_dev)
+ return 0;
+
count = stw_pixelformat_get_extended_count();
index = (uint) iPixelFormat - 1;
diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c
index 3dcef22c132..e37a1c39596 100644
--- a/src/gallium/state_trackers/xorg/xorg_xv.c
+++ b/src/gallium/state_trackers/xorg/xorg_xv.c
@@ -388,6 +388,9 @@ draw_yuv(struct xorg_xv_port_priv *port,
{
struct pipe_texture **textures = port->yuv[port->current_set];
+ /*debug_printf(" draw_yuv([%d, %d, %d ,%d], [%d, %d, %d, %d])\n",
+ src_x, src_y, src_w, src_h,
+ dst_x, dst_y, dst_w, dst_h);*/
renderer_draw_yuv(port->r,
src_x, src_y, src_w, src_h,
dst_x, dst_y, dst_w, dst_h,
@@ -489,6 +492,9 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
exaMoveInPixmap(pPixmap);
dst = exaGetPixmapDriverPrivate(pPixmap);
+ /*debug_printf("display_video([%d, %d, %d, %d], [%d, %d, %d, %d])\n",
+ src_x, src_y, src_w, src_h, dstX, dstY, dst_w, dst_h);*/
+
if (dst && !dst->tex) {
xorg_exa_set_shared_usage(pPixmap);
pScrn->pScreen->ModifyPixmapHeader(pPixmap, 0, 0, 0, 0, 0, NULL);
@@ -539,8 +545,9 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
offset_w = dst_w - w;
offset_h = dst_h - h;
- draw_yuv(pPriv, src_x + offset_x*diff_x, src_y + offset_y*diff_y,
- src_w - offset_w*diff_x, src_h - offset_h*diff_x,
+ draw_yuv(pPriv,
+ src_x + offset_x*diff_x, src_y + offset_y*diff_y,
+ src_w - offset_w*diff_x, src_h - offset_h*diff_y,
x, y, w, h);
pbox++;
diff --git a/src/gallium/winsys/drm/intel/dri/SConscript b/src/gallium/winsys/drm/intel/dri/SConscript
index 104e987083f..0df841d8798 100644
--- a/src/gallium/winsys/drm/intel/dri/SConscript
+++ b/src/gallium/winsys/drm/intel/dri/SConscript
@@ -4,17 +4,18 @@ env = drienv.Clone()
env.ParseConfig('pkg-config --cflags --libs libdrm_intel')
-drivers = [
+env.Prepend(LIBS = [
st_dri,
inteldrm,
- softpipe,
i915,
trace,
-]
+ mesa,
+ glsl,
+ gallium
+])
env.LoadableModule(
target ='i915_dri.so',
source = COMMON_GALLIUM_SOURCES,
- LIBS = drivers + mesa + gallium + env['LIBS'],
SHLIBPREFIX = '',
)
diff --git a/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c b/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c
index 03dbd76c375..e9e5990cf53 100644
--- a/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c
+++ b/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c
@@ -251,13 +251,13 @@ DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
{
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
- if (!stw_init(&stw_winsys)) {
- return FALSE;
- }
- return stw_init_thread();
+ stw_init(&stw_winsys);
+ stw_init_thread();
+ break;
case DLL_THREAD_ATTACH:
- return stw_init_thread();
+ stw_init_thread();
+ break;
case DLL_THREAD_DETACH:
stw_cleanup_thread();
diff --git a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c
index 2078020f8f7..71360e55aac 100644
--- a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c
+++ b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c
@@ -297,13 +297,13 @@ DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
{
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
- if (!stw_init(&stw_winsys)) {
- return FALSE;
- }
- return stw_init_thread();
+ stw_init(&stw_winsys);
+ stw_init_thread();
+ break;
case DLL_THREAD_ATTACH:
- return stw_init_thread();
+ stw_init_thread();
+ break;
case DLL_THREAD_DETACH:
stw_cleanup_thread();
diff --git a/src/glsl/apps/compile.c b/src/glsl/apps/compile.c
index c9a830b9f3c..3b3c083c2e1 100644
--- a/src/glsl/apps/compile.c
+++ b/src/glsl/apps/compile.c
@@ -134,8 +134,8 @@ main(int argc,
return 0;
}
- if (sl_pp_context_add_extension(context, "ARB_draw_buffers", "GL_ARB_draw_buffers") ||
- sl_pp_context_add_extension(context, "ARB_texture_rectangle", "GL_ARB_texture_rectangle")) {
+ if (sl_pp_context_add_extension(context, "GL_ARB_draw_buffers") ||
+ sl_pp_context_add_extension(context, "GL_ARB_texture_rectangle")) {
fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context));
printf("Error: %s\n", sl_pp_context_error_message(context));
diff --git a/src/glsl/apps/process.c b/src/glsl/apps/process.c
index 569890210f2..2d2ab911ac4 100644
--- a/src/glsl/apps/process.c
+++ b/src/glsl/apps/process.c
@@ -106,8 +106,8 @@ main(int argc,
return -1;
}
- if (sl_pp_context_add_extension(context, "ARB_draw_buffers", "GL_ARB_draw_buffers") ||
- sl_pp_context_add_extension(context, "ARB_texture_rectangle", "GL_ARB_texture_rectangle")) {
+ if (sl_pp_context_add_extension(context, "GL_ARB_draw_buffers") ||
+ sl_pp_context_add_extension(context, "GL_ARB_texture_rectangle")) {
fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context));
printf("Error: %s\n", sl_pp_context_error_message(context));
diff --git a/src/glsl/pp/sl_pp_context.h b/src/glsl/pp/sl_pp_context.h
index 3eada380cd1..983a09c02af 100644
--- a/src/glsl/pp/sl_pp_context.h
+++ b/src/glsl/pp/sl_pp_context.h
@@ -44,8 +44,8 @@
#define SL_PP_MAX_PREDEFINED 16
struct sl_pp_extension {
- int name; /*< VENDOR_extension_name */
- int name_string; /*< GL_VENDOR_extension_name */
+ int name; /*< GL_VENDOR_extension_name */
+ int enabled;
};
struct sl_pp_predefined {
diff --git a/src/glsl/pp/sl_pp_extension.c b/src/glsl/pp/sl_pp_extension.c
index 8af5731e840..777e42d0fc9 100644
--- a/src/glsl/pp/sl_pp_extension.c
+++ b/src/glsl/pp/sl_pp_extension.c
@@ -32,10 +32,15 @@
#include "sl_pp_public.h"
+/**
+ * Declare an extension to the preprocessor. This tells the preprocessor
+ * which extensions are supported by Mesa.
+ * The shader still needs to have a "#extension name: behavior" line to enable
+ * the extension.
+ */
int
sl_pp_context_add_extension(struct sl_pp_context *context,
- const char *name,
- const char *name_string)
+ const char *name)
{
struct sl_pp_extension ext;
@@ -48,15 +53,18 @@ sl_pp_context_add_extension(struct sl_pp_context *context,
return -1;
}
- ext.name_string = sl_pp_context_add_unique_str(context, name_string);
- if (ext.name_string == -1) {
- return -1;
- }
+ ext.enabled = 0;
context->extensions[context->num_extensions++] = ext;
+
+ assert(context->num_extensions <= sizeof(context->extensions));
+
return 0;
}
+/**
+ * Process a "#extension name: behavior" directive.
+ */
int
sl_pp_process_extension(struct sl_pp_context *context,
const struct sl_pp_token_info *input,
@@ -67,6 +75,7 @@ sl_pp_process_extension(struct sl_pp_context *context,
int extension_name = -1;
int behavior = -1;
struct sl_pp_token_info out;
+ struct sl_pp_extension *extension = NULL;
/* Grab the extension name. */
if (first < last && input[first].token == SL_PP_IDENTIFIER) {
@@ -86,8 +95,9 @@ sl_pp_process_extension(struct sl_pp_context *context,
out.data.extension = -1;
for (i = 0; i < context->num_extensions; i++) {
- if (extension_name == context->extensions[i].name_string) {
+ if (extension_name == context->extensions[i].name) {
out.data.extension = extension_name;
+ extension = &context->extensions[i];
break;
}
}
@@ -127,6 +137,7 @@ sl_pp_process_extension(struct sl_pp_context *context,
return -1;
}
out.token = SL_PP_EXTENSION_REQUIRE;
+ extension->enabled = 1;
} else if (behavior == context->dict.enable) {
if (out.data.extension == -1) {
/* Warning: the extension cannot be enabled. */
@@ -137,18 +148,21 @@ sl_pp_process_extension(struct sl_pp_context *context,
return -1;
}
out.token = SL_PP_EXTENSION_ENABLE;
+ extension->enabled = 1;
} else if (behavior == context->dict.warn) {
if (out.data.extension == -1) {
/* Warning: the extension is not supported. */
return 0;
}
out.token = SL_PP_EXTENSION_WARN;
+ extension->enabled = 0;
} else if (behavior == context->dict.disable) {
if (out.data.extension == -1) {
/* Warning: the extension is not supported. */
return 0;
}
out.token = SL_PP_EXTENSION_DISABLE;
+ extension->enabled = 0;
} else {
strcpy(context->error_msg, "unrecognised behavior name");
return -1;
diff --git a/src/glsl/pp/sl_pp_if.c b/src/glsl/pp/sl_pp_if.c
index f12f0f142c6..272c3a23cce 100644
--- a/src/glsl/pp/sl_pp_if.c
+++ b/src/glsl/pp/sl_pp_if.c
@@ -32,15 +32,35 @@
static int
+_macro_is_defined(struct sl_pp_context *context,
+ int macro_name)
+{
+ unsigned int i;
+ struct sl_pp_macro *macro;
+
+ for (i = 0; i < context->num_extensions; i++) {
+ if (macro_name == context->extensions[i].name) {
+ return context->extensions[i].enabled;
+ }
+ }
+
+ for (macro = context->macro; macro; macro = macro->next) {
+ if (macro_name == macro->name) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+static int
_parse_defined(struct sl_pp_context *context,
struct sl_pp_token_buffer *buffer,
struct sl_pp_process_state *state)
{
struct sl_pp_token_info input;
int parens = 0;
- int macro_name;
- struct sl_pp_macro *macro;
- int defined = 0;
+ int defined;
struct sl_pp_token_info result;
if (sl_pp_token_buffer_skip_white(buffer, &input)) {
@@ -59,13 +79,7 @@ _parse_defined(struct sl_pp_context *context,
return -1;
}
- macro_name = input.data.identifier;
- for (macro = context->macro; macro; macro = macro->next) {
- if (macro->name == macro_name) {
- defined = 1;
- break;
- }
- }
+ defined = _macro_is_defined(context, input.data.identifier);
if (parens) {
if (sl_pp_token_buffer_skip_white(buffer, &input)) {
@@ -218,22 +232,9 @@ sl_pp_process_ifdef(struct sl_pp_context *context,
for (i = first; i < last; i++) {
switch (input[i].token) {
case SL_PP_IDENTIFIER:
- {
- struct sl_pp_macro *macro;
- int macro_name = input[i].data.identifier;
- int defined = 0;
-
- for (macro = context->macro; macro; macro = macro->next) {
- if (macro->name == macro_name) {
- defined = 1;
- break;
- }
- }
-
- context->if_ptr--;
- context->if_stack[context->if_ptr] = defined ? 1 : 0;
- context->if_value = _evaluate_if_stack(context);
- }
+ context->if_ptr--;
+ context->if_stack[context->if_ptr] = _macro_is_defined(context, input[i].data.identifier);
+ context->if_value = _evaluate_if_stack(context);
return 0;
case SL_PP_WHITESPACE:
@@ -265,22 +266,9 @@ sl_pp_process_ifndef(struct sl_pp_context *context,
for (i = first; i < last; i++) {
switch (input[i].token) {
case SL_PP_IDENTIFIER:
- {
- struct sl_pp_macro *macro;
- int macro_name = input[i].data.identifier;
- int defined = 0;
-
- for (macro = context->macro; macro; macro = macro->next) {
- if (macro->name == macro_name) {
- defined = 1;
- break;
- }
- }
-
- context->if_ptr--;
- context->if_stack[context->if_ptr] = defined ? 0 : 1;
- context->if_value = _evaluate_if_stack(context);
- }
+ context->if_ptr--;
+ context->if_stack[context->if_ptr] = !_macro_is_defined(context, input[i].data.identifier);
+ context->if_value = _evaluate_if_stack(context);
return 0;
case SL_PP_WHITESPACE:
diff --git a/src/glsl/pp/sl_pp_public.h b/src/glsl/pp/sl_pp_public.h
index 12528d6f8d1..ca6f722543d 100644
--- a/src/glsl/pp/sl_pp_public.h
+++ b/src/glsl/pp/sl_pp_public.h
@@ -53,8 +53,7 @@ sl_pp_context_error_position(const struct sl_pp_context *context,
int
sl_pp_context_add_extension(struct sl_pp_context *context,
- const char *name,
- const char *name_string);
+ const char *name);
int
sl_pp_context_add_predefined(struct sl_pp_context *context,
diff --git a/src/glu/sgi/libnurbs/internals/arc.h b/src/glu/sgi/libnurbs/internals/arc.h
index e986019c3a7..ca397f3b1fd 100644
--- a/src/glu/sgi/libnurbs/internals/arc.h
+++ b/src/glu/sgi/libnurbs/internals/arc.h
@@ -108,6 +108,9 @@ public:
inline
Arc::Arc( Arc *j, PwlArc *p )
{
+ prev = NULL;
+ next = NULL;
+ link = NULL;
bezierArc = NULL;
pwlArc = p;
type = j->type;
@@ -123,6 +126,9 @@ Arc::Arc( Arc *j, PwlArc *p )
inline
Arc::Arc( arc_side side, long _nuid )
{
+ prev = NULL;
+ next = NULL;
+ link = NULL;
bezierArc = NULL;
pwlArc = NULL;
type = 0;
diff --git a/src/glu/sgi/libnurbs/internals/bin.cc b/src/glu/sgi/libnurbs/internals/bin.cc
index 54b406147be..ff75b86bedc 100644
--- a/src/glu/sgi/libnurbs/internals/bin.cc
+++ b/src/glu/sgi/libnurbs/internals/bin.cc
@@ -49,6 +49,7 @@
Bin::Bin()
{
head = NULL;
+ current = NULL;
}
Bin::~Bin()
diff --git a/src/glu/sgi/libnurbs/internals/uarray.cc b/src/glu/sgi/libnurbs/internals/uarray.cc
index f0e23643737..4b3329c0f27 100644
--- a/src/glu/sgi/libnurbs/internals/uarray.cc
+++ b/src/glu/sgi/libnurbs/internals/uarray.cc
@@ -47,6 +47,7 @@ Uarray::Uarray( void )
{
uarray = 0;
size = 0;
+ ulines = 0;
}
Uarray::~Uarray( void )
diff --git a/src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc b/src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc
index 26d05342f97..dfdbd4e8448 100644
--- a/src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc
+++ b/src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc
@@ -156,6 +156,8 @@ primStream::primStream(Int sizeLengths, Int sizeVertices)
index_vertices = 0;
size_lengths = sizeLengths;
size_vertices = sizeVertices;
+
+ counter = 0;
}
primStream::~primStream()
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
index 81d026a697c..833f9ad232a 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -424,7 +424,8 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
const uint8_t * depth_bits, const uint8_t * stencil_bits,
unsigned num_depth_stencil_bits,
const GLenum * db_modes, unsigned num_db_modes,
- const uint8_t * msaa_samples, unsigned num_msaa_modes)
+ const uint8_t * msaa_samples, unsigned num_msaa_modes,
+ GLboolean enable_accum)
{
static const uint8_t bits_table[4][4] = {
/* R G B A */
@@ -486,7 +487,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
__GLcontextModes *modes;
unsigned i, j, k, h;
unsigned num_modes;
- unsigned num_accum_bits = 2;
+ unsigned num_accum_bits = (enable_accum) ? 2 : 1;
switch ( fb_type ) {
case GL_UNSIGNED_BYTE_3_3_2:
diff --git a/src/mesa/drivers/dri/common/utils.h b/src/mesa/drivers/dri/common/utils.h
index 2aa6de66c18..02ca3feb739 100644
--- a/src/mesa/drivers/dri/common/utils.h
+++ b/src/mesa/drivers/dri/common/utils.h
@@ -104,7 +104,8 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
const uint8_t * depth_bits, const uint8_t * stencil_bits,
unsigned num_depth_stencil_bits,
const GLenum * db_modes, unsigned num_db_modes,
- const uint8_t * msaa_samples, unsigned num_msaa_modes);
+ const uint8_t * msaa_samples, unsigned num_msaa_modes,
+ GLboolean enable_accum);
__DRIconfig **driConcatConfigs(__DRIconfig **a,
__DRIconfig **b);
diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c
index 6a846514795..bd1044a2bff 100644
--- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c
+++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c
@@ -658,7 +658,7 @@ ffbFillInModes( __DRIscreen *psp,
depth_bits_array, stencil_bits_array,
depth_buffer_factor, back_buffer_modes,
back_buffer_factor,
- msaa_samples_array, 1);
+ msaa_samples_array, 1, GL_TRUE);
if (configs == NULL) {
fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
__LINE__);
diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c
index 476c8013580..1c4deef319f 100644
--- a/src/mesa/drivers/dri/i810/i810screen.c
+++ b/src/mesa/drivers/dri/i810/i810screen.c
@@ -92,7 +92,7 @@ i810FillInModes( __DRIscreen *psp,
depth_bits_array, stencil_bits_array,
depth_buffer_factor,
back_buffer_modes, back_buffer_factor,
- msaa_samples_array, 1);
+ msaa_samples_array, 1, GL_TRUE);
if (configs == NULL) {
fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
__func__, __LINE__ );
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 0adee6131ed..e9315a50fe7 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -581,7 +581,7 @@ intelInitContext(struct intel_context *intel,
GLcontext *ctx = &intel->ctx;
GLcontext *shareCtx = (GLcontext *) sharedContextPrivate;
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
- intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;
+ struct intel_screen *intelScreen = sPriv->private;
int bo_reuse_mode;
if (!_mesa_initialize_context(&intel->ctx, mesaVis, shareCtx,
@@ -718,11 +718,6 @@ intelInitContext(struct intel_context *intel,
intel->RenderIndex = ~0;
- if (intel->gen >= 4 && !intel->intelScreen->irq_active) {
- _mesa_printf("IRQs not active. Exiting\n");
- exit(1);
- }
-
intelInitExtensions(ctx);
INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index 36abef470a0..0f0a194b3f5 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -246,7 +246,7 @@ struct intel_context
__DRIdrawable *driDrawable;
__DRIdrawable *driReadDrawable;
__DRIscreen *driScreen;
- intelScreenPrivate *intelScreen;
+ struct intel_screen *intelScreen;
/**
* Configuration cache
diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c
index 301c3df17cf..e2859e44f95 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -287,11 +287,6 @@ intel_region_release(struct intel_region **region_handle)
region->pbo = NULL;
dri_bo_unreference(region->buffer);
- if (region->classic_map != NULL) {
- drmUnmap(region->classic_map,
- region->pitch * region->cpp * region->height);
- }
-
free(region);
}
*region_handle = NULL;
diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h
index 535fcd7be0b..860ae11bd23 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.h
+++ b/src/mesa/drivers/dri/intel/intel_regions.h
@@ -52,7 +52,7 @@ struct intel_buffer_object;
*/
struct intel_region
{
- dri_bo *buffer; /**< buffer manager's buffer */
+ drm_intel_bo *buffer; /**< buffer manager's buffer */
GLuint refcount; /**< Reference count for region */
GLuint cpp; /**< bytes per pixel */
GLuint width; /**< in pixels */
@@ -66,7 +66,6 @@ struct intel_region
uint32_t tiling; /**< Which tiling mode the region is in */
uint32_t bit_6_swizzle; /**< GEM flag for address swizzling requirement */
- drmAddress classic_map; /**< drmMap of the region when not in GEM mode */
struct intel_buffer_object *pbo; /* zero-copy uploads */
};
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index c9ef1647a32..6dc20d0fefe 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -169,7 +169,7 @@ intel_get_param(__DRIscreen *psp, int param, int *value)
static void
intelDestroyScreen(__DRIscreen * sPriv)
{
- intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;
+ struct intel_screen *intelScreen = sPriv->private;
dri_bufmgr_destroy(intelScreen->bufmgr);
driDestroyOptionInfo(&intelScreen->optionCache);
@@ -283,7 +283,7 @@ intelCreateContext(const __GLcontextModes * mesaVis,
void *sharedContextPrivate)
{
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
- intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;
+ struct intel_screen *intelScreen = sPriv->private;
#ifdef I915
if (IS_9XX(intelScreen->deviceID)) {
@@ -304,7 +304,7 @@ intelCreateContext(const __GLcontextModes * mesaVis,
}
static GLboolean
-intel_init_bufmgr(intelScreenPrivate *intelScreen)
+intel_init_bufmgr(struct intel_screen *intelScreen)
{
__DRIscreen *spriv = intelScreen->driScrnPriv;
int num_fences = 0;
@@ -336,20 +336,19 @@ intel_init_bufmgr(intelScreenPrivate *intelScreen)
static const
__DRIconfig **intelInitScreen2(__DRIscreen *psp)
{
- intelScreenPrivate *intelScreen;
+ struct intel_screen *intelScreen;
GLenum fb_format[3];
GLenum fb_type[3];
static const GLenum back_buffer_modes[] = {
- GLX_NONE, GLX_SWAP_UNDEFINED_OML,
- GLX_SWAP_EXCHANGE_OML, GLX_SWAP_COPY_OML
+ GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
};
uint8_t depth_bits[4], stencil_bits[4], msaa_samples_array[1];
int color;
__DRIconfig **configs = NULL;
/* Allocate the private area */
- intelScreen = (intelScreenPrivate *) CALLOC(sizeof(intelScreenPrivate));
+ intelScreen = CALLOC(sizeof *intelScreen);
if (!intelScreen) {
fprintf(stderr, "\nERROR! Allocating private area failed\n");
return GL_FALSE;
@@ -361,8 +360,6 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
intelScreen->driScrnPriv = psp;
psp->private = (void *) intelScreen;
- intelScreen->drmMinor = psp->drm_version.minor;
-
/* Determine chipset ID */
if (!intel_get_param(psp, I915_PARAM_CHIPSET_ID,
&intelScreen->deviceID))
@@ -371,18 +368,8 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
if (!intel_init_bufmgr(intelScreen))
return GL_FALSE;
- intelScreen->irq_active = 1;
psp->extensions = intelScreenExtensions;
- depth_bits[0] = 0;
- stencil_bits[0] = 0;
- depth_bits[1] = 16;
- stencil_bits[1] = 0;
- depth_bits[2] = 24;
- stencil_bits[2] = 0;
- depth_bits[3] = 24;
- stencil_bits[3] = 8;
-
msaa_samples_array[0] = 0;
fb_format[0] = GL_RGB;
@@ -397,27 +384,27 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
depth_bits[0] = 0;
stencil_bits[0] = 0;
+ /* Generate a rich set of useful configs that do not include an
+ * accumulation buffer.
+ */
for (color = 0; color < ARRAY_SIZE(fb_format); color++) {
__DRIconfig **new_configs;
int depth_factor;
- /* With DRI2 right now, GetBuffers always returns a depth/stencil buffer
- * with the same cpp as the drawable. So we can't support depth cpp !=
- * color cpp currently.
+ /* Starting with DRI2 protocol version 1.1 we can request a depth/stencil
+ * buffer that has a diffferent number of bits per pixel than the color
+ * buffer. This isn't yet supported here.
*/
if (fb_type[color] == GL_UNSIGNED_SHORT_5_6_5) {
depth_bits[1] = 16;
stencil_bits[1] = 0;
-
- depth_factor = 2;
} else {
depth_bits[1] = 24;
- stencil_bits[1] = 0;
- depth_bits[2] = 24;
- stencil_bits[2] = 8;
-
- depth_factor = 3;
+ stencil_bits[1] = 8;
}
+
+ depth_factor = 2;
+
new_configs = driCreateConfigs(fb_format[color], fb_type[color],
depth_bits,
stencil_bits,
@@ -425,7 +412,33 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
back_buffer_modes,
ARRAY_SIZE(back_buffer_modes),
msaa_samples_array,
- ARRAY_SIZE(msaa_samples_array));
+ ARRAY_SIZE(msaa_samples_array),
+ GL_FALSE);
+ if (configs == NULL)
+ configs = new_configs;
+ else
+ configs = driConcatConfigs(configs, new_configs);
+ }
+
+ /* Generate the minimum possible set of configs that include an
+ * accumulation buffer.
+ */
+ for (color = 0; color < ARRAY_SIZE(fb_format); color++) {
+ __DRIconfig **new_configs;
+
+ if (fb_type[color] == GL_UNSIGNED_SHORT_5_6_5) {
+ depth_bits[0] = 16;
+ stencil_bits[0] = 0;
+ } else {
+ depth_bits[0] = 24;
+ stencil_bits[0] = 8;
+ }
+
+ new_configs = driCreateConfigs(fb_format[color], fb_type[color],
+ depth_bits, stencil_bits, 1,
+ back_buffer_modes + 1, 1,
+ msaa_samples_array, 1,
+ GL_TRUE);
if (configs == NULL)
configs = new_configs;
else
diff --git a/src/mesa/drivers/dri/intel/intel_screen.h b/src/mesa/drivers/dri/intel/intel_screen.h
index e87e306d86b..c31b8365525 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.h
+++ b/src/mesa/drivers/dri/intel/intel_screen.h
@@ -34,46 +34,14 @@
#include "i915_drm.h"
#include "xmlconfig.h"
-/* XXX: change name or eliminate to avoid conflict with "struct
- * intel_region"!!!
- */
-typedef struct
+struct intel_screen
{
- drm_handle_t handle;
- drmSize size; /* region size in bytes */
- char *map; /* memory map */
- int offset; /* from start of video mem, in bytes */
- unsigned int bo_handle; /* buffer object id if available, or -1 */
- /**
- * Flags if the region is tiled.
- *
- * Not included is Y versus X tiling.
- */
- GLboolean tiled;
-} intelRegion;
-
-typedef struct
-{
- intelRegion front;
- intelRegion back;
- intelRegion depth;
- intelRegion tex;
-
int deviceID;
- int width;
- int height;
- int pitch; /* common row stride, in pixels */
int logTextureGranularity;
__DRIscreen *driScrnPriv;
- volatile drm_i915_sarea_t *sarea;
-
- int drmMinor;
-
- int irq_active;
-
GLboolean no_hw;
GLboolean no_vbo;
@@ -84,14 +52,10 @@ typedef struct
* Configuration cache with default values for all contexts
*/
driOptionCache optionCache;
-} intelScreenPrivate;
-
-
+};
extern GLboolean intelMapScreenRegions(__DRIscreen * sPriv);
-extern void intelUnmapScreenRegions(intelScreenPrivate * intelScreen);
-
extern void intelDestroyContext(__DRIcontext * driContextPriv);
extern GLboolean intelUnbindContext(__DRIcontext * driContextPriv);
@@ -101,6 +65,4 @@ intelMakeCurrent(__DRIcontext * driContextPriv,
__DRIdrawable * driDrawPriv,
__DRIdrawable * driReadPriv);
-extern struct intel_context *intelScreenContext(intelScreenPrivate *intelScreen);
-
#endif
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 6402141170d..d63292edd31 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -728,7 +728,7 @@ intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname,
void
intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
- GLint glx_texture_format,
+ GLint texture_format,
__DRIdrawable *dPriv)
{
struct gl_framebuffer *fb = dPriv->driverPrivate;
@@ -758,7 +758,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
if (rb->region == NULL)
return;
- if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT)
+ if (texture_format == __DRI_TEXTURE_FORMAT_RGB)
internalFormat = GL_RGB;
else
internalFormat = GL_RGBA;
@@ -788,7 +788,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
intelImage->face = target_to_face(target);
intelImage->level = level;
- if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT)
+ if (texture_format == __DRI_TEXTURE_FORMAT_RGB)
texImage->TexFormat = MESA_FORMAT_XRGB8888;
else
texImage->TexFormat = MESA_FORMAT_ARGB8888;
@@ -808,7 +808,7 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
/* The old interface didn't have the format argument, so copy our
* implementation's behavior at the time.
*/
- intelSetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv);
+ intelSetTexBuffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv);
}
diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c
index 5cbfb85627a..4bd6dee6c0e 100644
--- a/src/mesa/drivers/dri/mach64/mach64_screen.c
+++ b/src/mesa/drivers/dri/mach64/mach64_screen.c
@@ -119,7 +119,7 @@ mach64FillInModes( __DRIscreen *psp,
depth_bits_array, stencil_bits_array,
depth_buffer_factor, back_buffer_modes,
back_buffer_factor,
- msaa_samples_array, 1);
+ msaa_samples_array, 1, GL_TRUE);
if (configs == NULL) {
fprintf(stderr, "[%s:%u] Error creating FBConfig!\n",
__func__, __LINE__);
diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c
index e7813b63725..687412bca55 100644
--- a/src/mesa/drivers/dri/mga/mga_xmesa.c
+++ b/src/mesa/drivers/dri/mga/mga_xmesa.c
@@ -160,7 +160,7 @@ mgaFillInModes( __DRIscreen *psp,
depth_bits_array, stencil_bits_array,
depth_buffer_factor,
back_buffer_modes, back_buffer_factor,
- msaa_samples_array, 1);
+ msaa_samples_array, 1, GL_TRUE);
if (configs == NULL) {
fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
__func__, __LINE__ );
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index de6328251ea..6abab8c9656 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -83,7 +83,8 @@ nouveau_get_configs(void)
back_buffer_modes,
Elements(back_buffer_modes),
msaa_samples,
- Elements(msaa_samples));
+ Elements(msaa_samples),
+ GL_TRUE);
assert(config);
configs = configs ? driConcatConfigs(configs, config)
diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c
index ef6b5a35c4a..2d918028236 100644
--- a/src/mesa/drivers/dri/r128/r128_screen.c
+++ b/src/mesa/drivers/dri/r128/r128_screen.c
@@ -449,7 +449,7 @@ r128FillInModes( __DRIscreen *psp,
depth_bits_array, stencil_bits_array,
depth_buffer_factor, back_buffer_modes,
back_buffer_factor,
- msaa_samples_array, 1);
+ msaa_samples_array, 1, GL_TRUE);
if (configs == NULL) {
fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
__LINE__);
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index 8986191c393..6ecd46ecd9e 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -360,6 +360,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
ctx->Const.Max3DTextureLevels = 9;
ctx->Const.MaxCubeTextureLevels = 12;
ctx->Const.MaxTextureRectSize = 2048;
+ ctx->Const.MaxRenderbufferSize = 2048;
ctx->Const.MaxTextureMaxAnisotropy = 16.0;
@@ -390,6 +391,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
ctx->Const.VertexProgram.MaxNativeAddressRegs = 1;
ctx->Const.MaxDrawBuffers = 1;
+ ctx->Const.MaxColorAttachments = 1;
_mesa_set_mvp_with_dp4( ctx, GL_TRUE );
diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c
index e06437bd502..16065530093 100644
--- a/src/mesa/drivers/dri/r200/r200_state_init.c
+++ b/src/mesa/drivers/dri/r200/r200_state_init.c
@@ -894,7 +894,10 @@ void r200InitState( r200ContextPtr rmesa )
}
}
- ALLOC_STATE( stp, polygon_stipple, STP_STATE_SIZE, "STP/stp", 0 );
+ if (rmesa->radeon.radeonScreen->kernel_mm)
+ ALLOC_STATE( stp, polygon_stipple, STP_STATE_SIZE, "STP/stp", 0 );
+ else
+ ALLOC_STATE( stp, never, STP_STATE_SIZE, "STP/stp", 0 );
for (i = 0; i < 6; i++)
if (rmesa->radeon.radeonScreen->kernel_mm)
diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c
index 458de085223..9ccf30c3ac9 100644
--- a/src/mesa/drivers/dri/r200/r200_texstate.c
+++ b/src/mesa/drivers/dri/r200/r200_texstate.c
@@ -764,7 +764,7 @@ void r200SetTexOffset(__DRIcontext * pDRICtx, GLint texname,
}
}
-void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format,
+void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format,
__DRIdrawable *dPriv)
{
struct gl_texture_unit *texUnit;
@@ -781,7 +781,7 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
type = GL_BGRA;
format = GL_UNSIGNED_BYTE;
- internalFormat = (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT ? 3 : 4);
+ internalFormat = (texture_format == __DRI_TEXTURE_FORMAT_RGB ? 3 : 4);
radeon = pDRICtx->driverPrivate;
rmesa = pDRICtx->driverPrivate;
@@ -832,7 +832,7 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
pitch_val = rb->pitch;
switch (rb->cpp) {
case 4:
- if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT)
+ if (texture_format == __DRI_TEXTURE_FORMAT_RGB)
t->pp_txformat = tx_table_le[MESA_FORMAT_RGB888].format;
else
t->pp_txformat = tx_table_le[MESA_FORMAT_ARGB8888].format;
@@ -862,7 +862,7 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
void r200SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
{
- r200SetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv);
+ r200SetTexBuffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv);
}
diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c
index d87acecdabe..b0fb8e970b7 100644
--- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c
@@ -295,7 +295,7 @@ static char *toswiz(int swiz_val) {
case 2: return "B";
case 3: return "A";
case 4: return "0";
- case 5: return "1/2";
+ case 5: return "H";
case 6: return "1";
case 7: return "U";
}
diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
index c2eb613b23f..829f028950c 100644
--- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
+++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
@@ -121,8 +121,19 @@ static unsigned int translate_alpha_op(struct r300_fragment_program_compiler *c,
static unsigned int fix_hw_swizzle(unsigned int swz)
{
- if (swz == 5) swz = 6;
- if (swz == RC_SWIZZLE_UNUSED) swz = 4;
+ switch (swz) {
+ case RC_SWIZZLE_ZERO:
+ case RC_SWIZZLE_UNUSED:
+ swz = 4;
+ break;
+ case RC_SWIZZLE_HALF:
+ swz = 5;
+ break;
+ case RC_SWIZZLE_ONE:
+ swz = 6;
+ break;
+ }
+
return swz;
}
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index 7c21efb1ded..fe2ed22dc24 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -345,11 +345,13 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
ctx->Const.MaxTextureLevels = 13;
ctx->Const.MaxCubeTextureLevels = 13;
ctx->Const.MaxTextureRectSize = 4096;
+ ctx->Const.MaxRenderbufferSize = 4096;
}
else {
ctx->Const.MaxTextureLevels = 12;
ctx->Const.MaxCubeTextureLevels = 12;
ctx->Const.MaxTextureRectSize = 2048;
+ ctx->Const.MaxRenderbufferSize = 2048;
}
ctx->Const.MinPointSize = 1.0;
@@ -363,6 +365,7 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
ctx->Const.MaxLineWidthAA = R300_LINESIZE_MAX;
ctx->Const.MaxDrawBuffers = 1;
+ ctx->Const.MaxColorAttachments = 1;
/* currently bogus data */
if (r300->options.hw_tcl_enabled) {
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index 09e046859a4..4ba6740e3d9 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -415,7 +415,7 @@ void r300SetTexOffset(__DRIcontext * pDRICtx, GLint texname,
t->pp_txpitch |= pitch_val;
}
-void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format, __DRIdrawable *dPriv)
+void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format, __DRIdrawable *dPriv)
{
struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
@@ -431,7 +431,7 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
type = GL_BGRA;
format = GL_UNSIGNED_BYTE;
- internalFormat = (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT ? 3 : 4);
+ internalFormat = (texture_format == __DRI_TEXTURE_FORMAT_RGB ? 3 : 4);
radeon = pDRICtx->driverPrivate;
rmesa = pDRICtx->driverPrivate;
@@ -481,7 +481,7 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
pitch_val = rb->pitch;
switch (rb->cpp) {
case 4:
- if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT)
+ if (texture_format == __DRI_TEXTURE_FORMAT_RGB)
t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8);
else
t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8);
@@ -520,5 +520,5 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
void r300SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
{
- r300SetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv);
+ r300SetTexBuffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv);
}
diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c
index 5b7d7c28ec1..f575e74c3ed 100644
--- a/src/mesa/drivers/dri/r600/r600_context.c
+++ b/src/mesa/drivers/dri/r600/r600_context.c
@@ -270,6 +270,8 @@ static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
ctx->Const.MaxLineWidthAA = 0xffff / 8.0;
ctx->Const.MaxDrawBuffers = 1; /* hw supports 8 */
+ ctx->Const.MaxColorAttachments = 1;
+ ctx->Const.MaxRenderbufferSize = 4096;
/* 256 for reg-based consts, inline consts also supported */
ctx->Const.VertexProgram.MaxInstructions = 8192; /* in theory no limit */
diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c
index 8228cd67c8e..dd33ef3c6a2 100644
--- a/src/mesa/drivers/dri/r600/r600_texstate.c
+++ b/src/mesa/drivers/dri/r600/r600_texstate.c
@@ -988,7 +988,7 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
type = GL_BGRA;
format = GL_UNSIGNED_BYTE;
- internalFormat = (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT ? 3 : 4);
+ internalFormat = (glx_texture_format == __DRI_TEXTURE_FORMAT_RGB ? 3 : 4);
radeon = pDRICtx->driverPrivate;
rmesa = pDRICtx->driverPrivate;
@@ -1037,7 +1037,7 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
pitch_val = rb->pitch;
switch (rb->cpp) {
case 4:
- if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT) {
+ if (glx_texture_format == __DRI_TEXTURE_FORMAT_RGB) {
SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8,
SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
@@ -1116,5 +1116,5 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
void r600SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
{
- r600SetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv);
+ r600SetTexBuffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv);
}
diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c
index e0be74935b9..a742dbcf129 100644
--- a/src/mesa/drivers/dri/r600/r700_chip.c
+++ b/src/mesa/drivers/dri/r600/r700_chip.c
@@ -200,7 +200,8 @@ static void r700SetupVTXConstants(GLcontext * ctx,
}
else
{
- nVBsize = paos->count * pStreamDesc->stride;
+ nVBsize = (paos->count - 1) * pStreamDesc->stride
+ + pStreamDesc->size * getTypeSize(pStreamDesc->type);
}
uSQ_VTX_CONSTANT_WORD0_0 = paos->offset;
@@ -218,11 +219,11 @@ static void r700SetupVTXConstants(GLcontext * ctx,
SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_NORM,
SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask);
}
- //else
- //{
- // SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_INT,
- // SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask);
- //}
+ else
+ {
+ SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_SCALED,
+ SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask);
+ }
if(1 == pStreamDesc->_signed)
{
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.h b/src/mesa/drivers/dri/radeon/radeon_common.h
index f31f08edf36..cd01c9984e3 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.h
+++ b/src/mesa/drivers/dri/radeon/radeon_common.h
@@ -48,6 +48,9 @@ void radeon_check_front_buffer_rendering(GLcontext *ctx);
static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb)
{
struct radeon_renderbuffer *rrb = (struct radeon_renderbuffer *)rb;
+ radeon_print(RADEON_MEMORY, RADEON_TRACE,
+ "%s(rb %p)\n",
+ __func__, rb);
if (rrb && rrb->base.ClassID == RADEON_RB_CLASS)
return rrb;
else
@@ -56,6 +59,10 @@ static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbu
static inline struct radeon_renderbuffer *radeon_get_renderbuffer(struct gl_framebuffer *fb, int att_index)
{
+ radeon_print(RADEON_MEMORY, RADEON_TRACE,
+ "%s(fb %p, index %d)\n",
+ __func__, fb, att_index);
+
if (att_index >= 0)
return radeon_renderbuffer(fb->Attachment[att_index].Renderbuffer);
else
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index 475e93bc05f..4625af14ad8 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -317,6 +317,8 @@ r100CreateContext( const __GLcontextModes *glVisual,
rmesa->boxes = 0;
ctx->Const.MaxDrawBuffers = 1;
+ ctx->Const.MaxColorAttachments = 1;
+ ctx->Const.MaxRenderbufferSize = 2048;
_mesa_set_mvp_with_dp4( ctx, GL_TRUE );
diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c
index e780b9eef1b..56dcc50785c 100644
--- a/src/mesa/drivers/dri/radeon/radeon_fbo.c
+++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c
@@ -29,6 +29,7 @@
#include "main/imports.h"
#include "main/macros.h"
#include "main/mtypes.h"
+#include "main/enums.h"
#include "main/fbobject.h"
#include "main/framebuffer.h"
#include "main/renderbuffer.h"
@@ -56,6 +57,10 @@ radeon_delete_renderbuffer(struct gl_renderbuffer *rb)
{
struct radeon_renderbuffer *rrb = radeon_renderbuffer(rb);
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "%s(rb %p, rrb %p) \n",
+ __func__, rb, rrb);
+
ASSERT(rrb);
if (rrb && rrb->bo) {
@@ -68,6 +73,10 @@ static void *
radeon_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb,
GLint x, GLint y)
{
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "%s(%p, rb %p) \n",
+ __func__, ctx, rb);
+
return NULL;
}
@@ -85,6 +94,10 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
GLboolean software_buffer = GL_FALSE;
int cpp;
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "%s(%p, rb %p) \n",
+ __func__, ctx, rb);
+
ASSERT(rb->Name != 0);
switch (internalFormat) {
case GL_R3_G3_B2:
@@ -200,6 +213,10 @@ radeon_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
rb->Width = width;
rb->Height = height;
rb->InternalFormat = internalFormat;
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "%s(%p, rb %p) \n",
+ __func__, ctx, rb);
+
return GL_TRUE;
}
@@ -212,6 +229,10 @@ radeon_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb,
struct radeon_framebuffer *radeon_fb = (struct radeon_framebuffer*)fb;
int i;
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "%s(%p, fb %p) \n",
+ __func__, ctx, fb);
+
_mesa_resize_framebuffer(ctx, fb, width, height);
fb->Initialized = GL_TRUE; /* XXX remove someday */
@@ -252,6 +273,11 @@ radeon_create_renderbuffer(gl_format format, __DRIdrawable *driDrawPriv)
struct radeon_renderbuffer *rrb;
rrb = CALLOC_STRUCT(radeon_renderbuffer);
+
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "%s( rrb %p ) \n",
+ __func__, rrb);
+
if (!rrb)
return NULL;
@@ -331,6 +357,11 @@ radeon_new_renderbuffer(GLcontext * ctx, GLuint name)
struct radeon_renderbuffer *rrb;
rrb = CALLOC_STRUCT(radeon_renderbuffer);
+
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "%s(%p, rrb %p) \n",
+ __func__, ctx, rrb);
+
if (!rrb)
return NULL;
@@ -348,6 +379,11 @@ static void
radeon_bind_framebuffer(GLcontext * ctx, GLenum target,
struct gl_framebuffer *fb, struct gl_framebuffer *fbread)
{
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "%s(%p, fb %p, target %s) \n",
+ __func__, ctx, fb,
+ _mesa_lookup_enum_by_nr(target));
+
if (target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER_EXT) {
radeon_draw_buffer(ctx, fb);
}
@@ -365,6 +401,10 @@ radeon_framebuffer_renderbuffer(GLcontext * ctx,
if (ctx->Driver.Flush)
ctx->Driver.Flush(ctx); /* +r6/r7 */
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "%s(%p, fb %p, rb %p) \n",
+ __func__, ctx, fb, rb);
+
_mesa_framebuffer_renderbuffer(ctx, fb, attachment, rb);
radeon_draw_buffer(ctx, fb);
}
@@ -383,6 +423,10 @@ radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb,
int retry = 0;
gl_format texFormat;
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "%s(%p, rrb %p, texImage %p) \n",
+ __func__, ctx, rrb, texImage);
+
restart:
if (texImage->TexFormat == _dri_texformat_argb8888) {
rrb->base.DataType = GL_UNSIGNED_BYTE;
@@ -453,6 +497,11 @@ radeon_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage)
/* make an radeon_renderbuffer to wrap the texture image */
rrb = CALLOC_STRUCT(radeon_renderbuffer);
+
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "%s(%p, rrb %p, texImage %p) \n",
+ __func__, ctx, rrb, texImage);
+
if (!rrb) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glFramebufferTexture");
return NULL;
@@ -480,6 +529,10 @@ radeon_render_texture(GLcontext * ctx,
radeon_texture_image *radeon_image;
GLuint imageOffset;
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "%s(%p, fb %p, rrb %p, att %p)\n",
+ __func__, ctx, fb, rrb, att);
+
(void) fb;
ASSERT(newImage);
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 93b6399a669..631f729048a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -293,18 +293,18 @@ radeonFillInModes( __DRIscreen *psp,
depth_bits_array, stencil_bits_array,
depth_buffer_factor, back_buffer_modes,
back_buffer_factor, msaa_samples_array,
- 1);
+ 1, GL_TRUE);
configs_a8r8g8b8 = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
depth_bits_array, stencil_bits_array,
1, back_buffer_modes, 1,
- msaa_samples_array, 1);
+ msaa_samples_array, 1, GL_TRUE);
configs = driConcatConfigs(configs_r5g6b5, configs_a8r8g8b8);
} else
configs = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
depth_bits_array, stencil_bits_array,
depth_buffer_factor,
back_buffer_modes, back_buffer_factor,
- msaa_samples_array, 1);
+ msaa_samples_array, 1, GL_TRUE);
if (configs == NULL) {
fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
@@ -1676,7 +1676,8 @@ __DRIconfig **radeonInitScreen2(__DRIscreen *psp)
back_buffer_modes,
ARRAY_SIZE(back_buffer_modes),
msaa_samples_array,
- ARRAY_SIZE(msaa_samples_array));
+ ARRAY_SIZE(msaa_samples_array),
+ GL_TRUE);
if (configs == NULL)
configs = new_configs;
else
diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c
index 8db3d2b143b..1adb6096033 100644
--- a/src/mesa/drivers/dri/radeon/radeon_span.c
+++ b/src/mesa/drivers/dri/radeon/radeon_span.c
@@ -810,6 +810,10 @@ static void map_unmap_rb(struct gl_renderbuffer *rb, int flag)
if (rrb == NULL || !rrb->bo)
return;
+ radeon_print(RADEON_MEMORY, RADEON_TRACE,
+ "%s( rb %p, flag %s )\n",
+ __func__, rb, flag ? "true":"false");
+
if (flag) {
radeon_bo_wait(rrb->bo);
r = radeon_bo_map(rrb->bo, 1);
@@ -832,6 +836,10 @@ radeon_map_unmap_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb,
{
GLuint i, j;
+ radeon_print(RADEON_MEMORY, RADEON_TRACE,
+ "%s( %p , fb %p, map %s )\n",
+ __func__, ctx, fb, map ? "true":"false");
+
/* color draw buffers */
for (j = 0; j < ctx->DrawBuffer->_NumColorDrawBuffers; j++)
map_unmap_rb(fb->_ColorDrawBuffers[j], map);
diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c
index 84ddcfd4fd3..f852116deeb 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texstate.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c
@@ -639,7 +639,7 @@ void radeonSetTexOffset(__DRIcontext * pDRICtx, GLint texname,
}
}
-void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format,
+void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format,
__DRIdrawable *dPriv)
{
struct gl_texture_unit *texUnit;
@@ -656,7 +656,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_
type = GL_BGRA;
format = GL_UNSIGNED_BYTE;
- internalFormat = (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT ? 3 : 4);
+ internalFormat = (texture_format == __DRI_TEXTURE_FORMAT_RGB ? 3 : 4);
radeon = pDRICtx->driverPrivate;
rmesa = pDRICtx->driverPrivate;
@@ -705,7 +705,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_
t->override_offset = 0;
switch (rb->cpp) {
case 4:
- if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT)
+ if (texture_format == __DRI_TEXTURE_FORMAT_RGB)
t->pp_txformat = tx_table[MESA_FORMAT_RGB888].format;
else
t->pp_txformat = tx_table[MESA_FORMAT_ARGB8888].format;
@@ -740,7 +740,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_
void radeonSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
{
- radeonSetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv);
+ radeonSetTexBuffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv);
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 86b213c05cb..9b9d90bdd02 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -129,6 +129,10 @@ static void teximage_set_map_data(radeon_texture_image *image)
*/
void radeon_teximage_map(radeon_texture_image *image, GLboolean write_enable)
{
+ radeon_print(RADEON_TEXTURE, RADEON_VERBOSE,
+ "%s(img %p), write_enable %s.\n",
+ __func__, image,
+ write_enable ? "true": "false");
if (image->mt) {
assert(!image->base.Data);
@@ -140,6 +144,9 @@ void radeon_teximage_map(radeon_texture_image *image, GLboolean write_enable)
void radeon_teximage_unmap(radeon_texture_image *image)
{
+ radeon_print(RADEON_TEXTURE, RADEON_VERBOSE,
+ "%s(img %p)\n",
+ __func__, image);
if (image->mt) {
assert(image->base.Data);
@@ -275,6 +282,11 @@ void radeonGenerateMipmap(GLcontext* ctx, GLenum target, struct gl_texture_objec
radeon_texture_image *baseimage = get_radeon_texture_image(texObj->Image[face][texObj->BaseLevel]);
bo = !baseimage->mt ? baseimage->bo : baseimage->mt->bo;
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "%s(%p, target %s, tex %p)\n",
+ __func__, ctx, _mesa_lookup_enum_by_nr(target),
+ texObj);
+
if (bo && radeon_bo_is_referenced_by_cs(bo, rmesa->cmdbuf.cs)) {
radeon_print(RADEON_TEXTURE, RADEON_NORMAL,
"%s(%p, tex %p) Trying to generate mipmap for texture "
diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c
index 8e879ca41c0..74a001b7898 100644
--- a/src/mesa/drivers/dri/savage/savage_xmesa.c
+++ b/src/mesa/drivers/dri/savage/savage_xmesa.c
@@ -939,7 +939,7 @@ savageFillInModes( __DRIscreen *psp,
depth_bits_array, stencil_bits_array,
depth_buffer_factor,
back_buffer_modes, back_buffer_factor,
- msaa_samples_array, 1);
+ msaa_samples_array, 1, GL_TRUE);
if (configs == NULL) {
fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
__func__, __LINE__ );
diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c
index cb7ed8a08bb..80fb455ec75 100644
--- a/src/mesa/drivers/dri/sis/sis_screen.c
+++ b/src/mesa/drivers/dri/sis/sis_screen.c
@@ -103,7 +103,7 @@ sisFillInModes(__DRIscreen *psp, int bpp)
configs = driCreateConfigs(fb_format, fb_type, depth_bits_array,
stencil_bits_array, depth_buffer_factor,
back_buffer_modes, back_buffer_factor,
- msaa_samples_array, 1);
+ msaa_samples_array, 1, GL_TRUE);
if (configs == NULL) {
fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__);
return NULL;
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index 4e823669bfc..40535b03b95 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -132,7 +132,8 @@ swrastFillInModes(__DRIscreen *psp,
configs = driCreateConfigs(fb_format, fb_type,
depth_bits_array, stencil_bits_array,
depth_buffer_factor, back_buffer_modes,
- back_buffer_factor, msaa_samples_array, 1);
+ back_buffer_factor, msaa_samples_array, 1,
+ GL_TRUE);
if (configs == NULL) {
fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
__LINE__);
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c
index 9f6b35faa28..d554bcdc92c 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c
@@ -383,7 +383,8 @@ tdfxFillInModes(__DRIscreen *psp,
stencil_bits_array,
deep ? 2 : 4,
db_modes, 2,
- msaa_samples_array, 1);
+ msaa_samples_array, 1,
+ GL_TRUE);
}
/**
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c
index 8c91c937c68..ee10b569bf1 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.c
+++ b/src/mesa/drivers/dri/unichrome/via_screen.c
@@ -354,7 +354,7 @@ viaFillInModes( __DRIscreen *psp,
depth_bits_array, stencil_bits_array,
depth_buffer_factor, back_buffer_modes,
back_buffer_factor,
- msaa_samples_array, 1);
+ msaa_samples_array, 1, GL_TRUE);
if (configs == NULL) {
fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
__LINE__);
diff --git a/src/mesa/drivers/windows/gdi/mesa.def b/src/mesa/drivers/windows/gdi/mesa.def
index 700e3334295..a31dc55e3fa 100644
--- a/src/mesa/drivers/windows/gdi/mesa.def
+++ b/src/mesa/drivers/windows/gdi/mesa.def
@@ -869,6 +869,7 @@ EXPORTS
_mesa_add_renderbuffer
_mesa_bzero
_mesa_calloc
+ _mesa_check_conditional_render
_mesa_choose_tex_format
_mesa_create_framebuffer
_mesa_create_visual
diff --git a/src/mesa/glapi/glapi.h b/src/mesa/glapi/glapi.h
index 47ea23e92b5..f802a61d3bd 100644
--- a/src/mesa/glapi/glapi.h
+++ b/src/mesa/glapi/glapi.h
@@ -46,8 +46,6 @@
#define GL_GLEXT_PROTOTYPES
-#include "GL/gl.h"
-#include "GL/glext.h"
#include "glthread.h"
@@ -136,7 +134,7 @@ struct _glapi_table *
_glapi_get_override_dispatch(int layer);
-extern GLuint
+extern unsigned int
_glapi_get_dispatch_table_size(void);
@@ -148,7 +146,7 @@ extern int
_glapi_add_dispatch( const char * const * function_names,
const char * parameter_signature );
-extern GLint
+extern int
_glapi_get_proc_offset(const char *funcName);
@@ -157,7 +155,7 @@ _glapi_get_proc_address(const char *funcName);
extern const char *
-_glapi_get_proc_name(GLuint offset);
+_glapi_get_proc_name(unsigned int offset);
#endif
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 591aa1121d1..c292d1fea5e 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -495,12 +495,6 @@ _mesa_init_constants(GLcontext *ctx)
{
assert(ctx);
- assert(MAX_TEXTURE_LEVELS >= MAX_3D_TEXTURE_LEVELS);
- assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS);
-
- /* Max texture size should be <= max viewport size (render to texture) */
- assert((1 << (MAX_TEXTURE_LEVELS - 1)) <= MAX_WIDTH);
-
/* Constants, may be overriden (usually only reduced) by device drivers */
ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS;
ctx->Const.Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS;
@@ -571,26 +565,6 @@ _mesa_init_constants(GLcontext *ctx)
/* GL_EXT_provoking_vertex */
ctx->Const.QuadsFollowProvokingVertexConvention = GL_TRUE;
-
- /* sanity checks */
- ASSERT(ctx->Const.MaxTextureUnits == MIN2(ctx->Const.MaxTextureImageUnits,
- ctx->Const.MaxTextureCoordUnits));
- ASSERT(ctx->Const.FragmentProgram.MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS);
- ASSERT(ctx->Const.VertexProgram.MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS);
- ASSERT(ctx->Const.MaxCombinedTextureImageUnits <= MAX_COMBINED_TEXTURE_IMAGE_UNITS);
- ASSERT(ctx->Const.MaxTextureCoordUnits <= MAX_COMBINED_TEXTURE_IMAGE_UNITS);
- ASSERT(MAX_COMBINED_TEXTURE_IMAGE_UNITS <= 32); /* GLbitfield size limit */
-
- ASSERT(MAX_NV_FRAGMENT_PROGRAM_TEMPS <= MAX_PROGRAM_TEMPS);
- ASSERT(MAX_NV_VERTEX_PROGRAM_TEMPS <= MAX_PROGRAM_TEMPS);
- ASSERT(MAX_NV_VERTEX_PROGRAM_INPUTS <= VERT_ATTRIB_MAX);
- ASSERT(MAX_NV_VERTEX_PROGRAM_OUTPUTS <= VERT_RESULT_MAX);
-
- /* check that we don't exceed the size of various bitfields */
- ASSERT(VERT_RESULT_MAX <=
- (8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten)));
- ASSERT(FRAG_ATTRIB_MAX <=
- (8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead)));
}
@@ -601,17 +575,41 @@ _mesa_init_constants(GLcontext *ctx)
static void
check_context_limits(GLcontext *ctx)
{
- /* Many context limits/constants are limited by the size of
- * internal arrays.
- */
+ /* check that we don't exceed the size of various bitfields */
+ assert(VERT_RESULT_MAX <=
+ (8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten)));
+ assert(FRAG_ATTRIB_MAX <=
+ (8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead)));
+
+ assert(MAX_COMBINED_TEXTURE_IMAGE_UNITS <= 8 * sizeof(GLbitfield));
+
+ /* shader-related checks */
+ assert(ctx->Const.FragmentProgram.MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS);
+ assert(ctx->Const.VertexProgram.MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS);
+
+ assert(MAX_NV_FRAGMENT_PROGRAM_TEMPS <= MAX_PROGRAM_TEMPS);
+ assert(MAX_NV_VERTEX_PROGRAM_TEMPS <= MAX_PROGRAM_TEMPS);
+ assert(MAX_NV_VERTEX_PROGRAM_INPUTS <= VERT_ATTRIB_MAX);
+ assert(MAX_NV_VERTEX_PROGRAM_OUTPUTS <= VERT_RESULT_MAX);
+
+ /* Texture unit checks */
+ assert(ctx->Const.MaxTextureImageUnits > 0);
assert(ctx->Const.MaxTextureImageUnits <= MAX_TEXTURE_IMAGE_UNITS);
+ assert(ctx->Const.MaxTextureCoordUnits > 0);
assert(ctx->Const.MaxTextureCoordUnits <= MAX_TEXTURE_COORD_UNITS);
+ assert(ctx->Const.MaxTextureUnits > 0);
assert(ctx->Const.MaxTextureUnits <= MAX_TEXTURE_IMAGE_UNITS);
assert(ctx->Const.MaxTextureUnits <= MAX_TEXTURE_COORD_UNITS);
-
+ assert(ctx->Const.MaxTextureUnits == MIN2(ctx->Const.MaxTextureImageUnits,
+ ctx->Const.MaxTextureCoordUnits));
+ assert(ctx->Const.MaxCombinedTextureImageUnits > 0);
+ assert(ctx->Const.MaxCombinedTextureImageUnits <= MAX_COMBINED_TEXTURE_IMAGE_UNITS);
+ assert(ctx->Const.MaxTextureCoordUnits <= MAX_COMBINED_TEXTURE_IMAGE_UNITS);
/* number of coord units cannot be greater than number of image units */
assert(ctx->Const.MaxTextureCoordUnits <= ctx->Const.MaxTextureImageUnits);
+
+ /* Texture size checks */
assert(ctx->Const.MaxTextureLevels <= MAX_TEXTURE_LEVELS);
assert(ctx->Const.Max3DTextureLevels <= MAX_3D_TEXTURE_LEVELS);
assert(ctx->Const.MaxCubeTextureLevels <= MAX_CUBE_TEXTURE_LEVELS);
@@ -622,6 +620,13 @@ check_context_limits(GLcontext *ctx)
assert((1 << (ctx->Const.MaxCubeTextureLevels - 1)) <= MAX_WIDTH);
assert((1 << (ctx->Const.Max3DTextureLevels - 1)) <= MAX_WIDTH);
+ /* Texture level checks */
+ assert(MAX_TEXTURE_LEVELS >= MAX_3D_TEXTURE_LEVELS);
+ assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS);
+
+ /* Max texture size should be <= max viewport size (render to texture) */
+ assert((1 << (MAX_TEXTURE_LEVELS - 1)) <= MAX_WIDTH);
+
assert(ctx->Const.MaxViewportWidth <= MAX_WIDTH);
assert(ctx->Const.MaxViewportHeight <= MAX_WIDTH);
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index fcd0a56d76a..78612b08560 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -2678,7 +2678,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS)
static GLboolean
_mesa_texstore_z24_s8(TEXSTORE_PARAMS)
{
- const GLfloat depthScale = (GLfloat) 0xffffff;
+ const GLuint depthScale = 0xffffff;
const GLint srcRowStride
= _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType)
/ sizeof(GLuint);
@@ -2752,7 +2752,7 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
_mesa_unpack_depth_span(ctx, srcWidth,
GL_UNSIGNED_INT_24_8_EXT, /* dst type */
dstRow, /* dst addr */
- (GLuint) depthScale,
+ depthScale,
srcType, src, srcPacking);
/* get the 8-bit stencil values */
_mesa_unpack_stencil_span(ctx, srcWidth,
diff --git a/src/mesa/shader/slang/library/SConscript b/src/mesa/shader/slang/library/SConscript
index ef131146be5..0b25467a4e8 100644
--- a/src/mesa/shader/slang/library/SConscript
+++ b/src/mesa/shader/slang/library/SConscript
@@ -12,13 +12,13 @@ def glsl_compile_emitter(target, source, env):
return (target, source)
bld_frag = Builder(
- action = glsl_compile[0].abspath + ' fragment $SOURCE $TARGET',
+ action = Action(glsl_compile[0].abspath + ' fragment $SOURCE $TARGET', '$CODEGENCODESTR'),
emitter = glsl_compile_emitter,
suffix = '.gc',
src_suffix = '_gc.h')
bld_vert = Builder(
- action = glsl_compile[0].abspath + ' vertex $SOURCE $TARGET',
+ action = Action(glsl_compile[0].abspath + ' vertex $SOURCE $TARGET', '$CODEGENCODESTR'),
emitter = glsl_compile_emitter,
suffix = '.gc',
src_suffix = '_gc.h')
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index 63d10f45978..852274119cf 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -2608,8 +2608,8 @@ compile_with_grammar(const char *source,
return GL_FALSE;
}
- if (sl_pp_context_add_extension(context, "ARB_draw_buffers", "GL_ARB_draw_buffers") ||
- sl_pp_context_add_extension(context, "ARB_texture_rectangle", "GL_ARB_texture_rectangle")) {
+ if (sl_pp_context_add_extension(context, "GL_ARB_draw_buffers") ||
+ sl_pp_context_add_extension(context, "GL_ARB_texture_rectangle")) {
slang_info_log_error(infolog, "%s", sl_pp_context_error_message(context));
sl_pp_context_destroy(context);
return GL_FALSE;
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index 85420a950f4..25430bba77d 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -637,7 +637,7 @@ accum_bitmap(struct st_context *st,
const GLubyte *bitmap )
{
struct bitmap_cache *cache = st->bitmap.cache;
- int px = -999, py;
+ int px = -999, py = -999;
const GLfloat z = st->ctx->Current.RasterPos[2];
if (width > BITMAP_CACHE_WIDTH ||
@@ -671,6 +671,7 @@ accum_bitmap(struct st_context *st,
}
assert(px != -999);
+ assert(py != -999);
if (x < cache->xmin)
cache->xmin = x;
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 9f2fe7420d4..4638879fc2b 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -37,6 +37,7 @@
#include "main/context.h"
#include "main/fbobject.h"
#include "main/framebuffer.h"
+#include "main/macros.h"
#include "main/renderbuffer.h"
#include "pipe/p_context.h"
@@ -340,12 +341,17 @@ st_render_texture(GLcontext *ctx,
struct gl_renderbuffer *rb;
struct pipe_texture *pt = st_get_texobj_texture(att->Texture);
struct st_texture_object *stObj;
- const struct gl_texture_image *texImage =
- att->Texture->Image[att->CubeMapFace][att->TextureLevel];
+ const struct gl_texture_image *texImage;
+ GLint pt_level;
+ /* When would this fail? Perhaps assert? */
if (!pt)
return;
+ /* The first gallium texture level = Mesa BaseLevel */
+ pt_level = MAX2(0, (GLint) att->TextureLevel - att->Texture->BaseLevel);
+ texImage = att->Texture->Image[att->CubeMapFace][pt_level];
+
/* create new renderbuffer which wraps the texture image */
rb = st_new_renderbuffer(ctx, 0);
if (!rb) {
@@ -365,7 +371,7 @@ st_render_texture(GLcontext *ctx,
/* point renderbuffer at texobject */
strb->rtt = stObj;
- strb->rtt_level = att->TextureLevel;
+ strb->rtt_level = pt_level;
strb->rtt_face = att->CubeMapFace;
strb->rtt_slice = att->Zoffset;
@@ -380,6 +386,8 @@ st_render_texture(GLcontext *ctx,
pipe_surface_reference(&strb->surface, NULL);
+ assert(strb->rtt_level <= strb->texture->last_level);
+
/* new surface for rendering into the texture */
strb->surface = screen->get_tex_surface(screen,
strb->texture,
diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h
index 8484aab5a93..d9bf54dd46e 100644
--- a/src/mesa/swrast_setup/ss_tritmp.h
+++ b/src/mesa/swrast_setup/ss_tritmp.h
@@ -40,7 +40,7 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
GLfloat offset, oz0, oz1, oz2;
GLenum mode = GL_FILL;
GLuint facing = 0;
- GLchan saved_color[3][4];
+ GLchan saved_color[3][4] = { { 0 } };
GLfloat saved_col0[3][4] = { { 0 } };
GLfloat saved_spec[3][4] = { { 0 } };
GLfloat saved_index[3] = { 0 };