summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2010-08-18 14:37:47 +0200
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>2010-08-18 14:37:47 +0200
commit3e54d63429fe7ca5db3c75c181abbaf7a7f55724 (patch)
treee129c36aaef712525f0a04fc5b06c445e3cf84df /src/mesa/state_tracker
parenteaab76457818fad0926b84c663440e8987e1f19f (diff)
parent85d9bc236d6a8ff8f12cbc2150f8c3740354f573 (diff)
Merge remote branch 'origin/master' into nv50-compiler
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom.h2
-rw-r--r--src/mesa/state_tracker/st_atom_constbuf.h3
-rw-r--r--src/mesa/state_tracker/st_atom_depth.c2
-rw-r--r--src/mesa/state_tracker/st_atom_pixeltransfer.c1
-rw-r--r--src/mesa/state_tracker/st_atom_shader.c1
-rw-r--r--src/mesa/state_tracker/st_atom_shader.h3
-rw-r--r--src/mesa/state_tracker/st_atom_stipple.c2
-rw-r--r--src/mesa/state_tracker/st_cache.h5
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c1
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.h5
-rw-r--r--src/mesa/state_tracker/st_cb_blit.h6
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.h7
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c1
-rw-r--r--src/mesa/state_tracker/st_cb_clear.h3
-rw-r--r--src/mesa/state_tracker/st_cb_condrender.h2
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.h5
-rw-r--r--src/mesa/state_tracker/st_cb_drawtex.c1
-rw-r--r--src/mesa/state_tracker/st_cb_drawtex.h5
-rw-r--r--src/mesa/state_tracker/st_cb_eglimage.c1
-rw-r--r--src/mesa/state_tracker/st_cb_eglimage.h5
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.h9
-rw-r--r--src/mesa/state_tracker/st_cb_feedback.h4
-rw-r--r--src/mesa/state_tracker/st_cb_flush.h6
-rw-r--r--src/mesa/state_tracker/st_cb_program.h4
-rw-r--r--src/mesa/state_tracker/st_cb_rasterpos.h4
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.h4
-rw-r--r--src/mesa/state_tracker/st_cb_strings.h2
-rw-r--r--src/mesa/state_tracker/st_cb_texture.h7
-rw-r--r--src/mesa/state_tracker/st_cb_viewport.h7
-rw-r--r--src/mesa/state_tracker/st_cb_xformfb.h4
-rw-r--r--src/mesa/state_tracker/st_context.c6
-rw-r--r--src/mesa/state_tracker/st_context.h15
-rw-r--r--src/mesa/state_tracker/st_debug.c4
-rw-r--r--src/mesa/state_tracker/st_draw.c169
-rw-r--r--src/mesa/state_tracker/st_draw.h7
-rw-r--r--src/mesa/state_tracker/st_extensions.h2
-rw-r--r--src/mesa/state_tracker/st_format.h5
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.h4
-rw-r--r--src/mesa/state_tracker/st_gl_api.h2
-rw-r--r--src/mesa/state_tracker/st_manager.h7
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c40
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.h4
-rw-r--r--src/mesa/state_tracker/st_program.c1
-rw-r--r--src/mesa/state_tracker/st_program.h7
-rw-r--r--src/mesa/state_tracker/st_texture.c4
45 files changed, 241 insertions, 148 deletions
diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h
index 1f0fef63df..c7a04951bf 100644
--- a/src/mesa/state_tracker/st_atom.h
+++ b/src/mesa/state_tracker/st_atom.h
@@ -34,6 +34,8 @@
#ifndef ST_ATOM_H
#define ST_ATOM_H
+#include "main/glheader.h"
+
struct st_context;
struct st_tracked_state;
diff --git a/src/mesa/state_tracker/st_atom_constbuf.h b/src/mesa/state_tracker/st_atom_constbuf.h
index f707534e2c..97b076629e 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.h
+++ b/src/mesa/state_tracker/st_atom_constbuf.h
@@ -29,6 +29,9 @@
#ifndef ST_ATOM_CONSTBUF_H
#define ST_ATOM_CONSTBUF_H
+struct gl_program_parameter_list;
+struct st_context;
+
void st_upload_constants( struct st_context *st,
struct gl_program_parameter_list *params,
diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c
index 3c07afba9a..1616e945fe 100644
--- a/src/mesa/state_tracker/st_atom_depth.c
+++ b/src/mesa/state_tracker/st_atom_depth.c
@@ -33,6 +33,8 @@
*/
+#include <assert.h>
+
#include "st_context.h"
#include "st_atom.h"
#include "pipe/p_context.h"
diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c
index b88c74fa03..8a8d17599e 100644
--- a/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -37,6 +37,7 @@
#include "main/image.h"
#include "main/macros.h"
#include "program/program.h"
+#include "program/prog_cache.h"
#include "program/prog_instruction.h"
#include "program/prog_parameter.h"
#include "program/prog_print.h"
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index cebaad5f00..05442ef91b 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -40,7 +40,6 @@
#include "program/program.h"
#include "pipe/p_context.h"
-#include "pipe/p_shader_tokens.h"
#include "util/u_simple_shaders.h"
diff --git a/src/mesa/state_tracker/st_atom_shader.h b/src/mesa/state_tracker/st_atom_shader.h
index 8403bc66c9..56d4c68f4f 100644
--- a/src/mesa/state_tracker/st_atom_shader.h
+++ b/src/mesa/state_tracker/st_atom_shader.h
@@ -30,6 +30,9 @@
#define ST_ATOM_SHADER_H
+struct st_context;
+struct translated_vertex_program;
+
extern void
st_free_translated_vertex_programs(struct st_context *st,
struct translated_vertex_program *xvp);
diff --git a/src/mesa/state_tracker/st_atom_stipple.c b/src/mesa/state_tracker/st_atom_stipple.c
index 31e124b329..ecdd9f06f6 100644
--- a/src/mesa/state_tracker/st_atom_stipple.c
+++ b/src/mesa/state_tracker/st_atom_stipple.c
@@ -33,6 +33,8 @@
*/
+#include <assert.h>
+
#include "st_context.h"
#include "st_atom.h"
#include "pipe/p_context.h"
diff --git a/src/mesa/state_tracker/st_cache.h b/src/mesa/state_tracker/st_cache.h
index b81de316ec..6d5de7b13a 100644
--- a/src/mesa/state_tracker/st_cache.h
+++ b/src/mesa/state_tracker/st_cache.h
@@ -33,10 +33,11 @@
#ifndef ST_CACHE_H
#define ST_CACHE_H
-#include "cso_cache/cso_cache.h"
-
struct pipe_blend_state;
+struct pipe_depth_stencil_alpha_state;
+struct pipe_rasterizer_state;
struct pipe_sampler_state;
+struct pipe_shader_state;
struct st_context;
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index ba600ccef6..0b8ecd27cb 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -46,6 +46,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
+#include "pipe/p_shader_tokens.h"
#include "util/u_inlines.h"
#include "util/u_draw_quad.h"
#include "util/u_simple_shaders.h"
diff --git a/src/mesa/state_tracker/st_cb_bitmap.h b/src/mesa/state_tracker/st_cb_bitmap.h
index 8af975b74f..d04b2b6779 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.h
+++ b/src/mesa/state_tracker/st_cb_bitmap.h
@@ -30,7 +30,10 @@
#define ST_CB_BITMAP_H
-#include "main/mtypes.h"
+#include "main/compiler.h"
+
+struct dd_function_table;
+struct st_context;
#if FEATURE_drawpix
diff --git a/src/mesa/state_tracker/st_cb_blit.h b/src/mesa/state_tracker/st_cb_blit.h
index 7ab9a54df9..c230652cef 100644
--- a/src/mesa/state_tracker/st_cb_blit.h
+++ b/src/mesa/state_tracker/st_cb_blit.h
@@ -29,8 +29,10 @@
#define ST_CB_BLIT_H
-#include "main/mtypes.h"
-#include "st_context.h"
+#include "main/compiler.h"
+
+struct dd_function_table;
+struct st_context;
extern void
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.h b/src/mesa/state_tracker/st_cb_bufferobjects.h
index a27daac2bf..1c991d2083 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.h
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.h
@@ -28,9 +28,12 @@
#ifndef ST_CB_BUFFEROBJECTS_H
#define ST_CB_BUFFEROBJECTS_H
-struct st_context;
-struct gl_buffer_object;
+#include "main/compiler.h"
+#include "main/mtypes.h"
+
+struct dd_function_table;
struct pipe_resource;
+struct st_context;
/**
* State_tracker vertex/pixel buffer object, derived from Mesa's
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index ea2414c4a0..246ab2e957 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -45,6 +45,7 @@
#include "st_program.h"
#include "pipe/p_context.h"
+#include "pipe/p_shader_tokens.h"
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "util/u_format.h"
diff --git a/src/mesa/state_tracker/st_cb_clear.h b/src/mesa/state_tracker/st_cb_clear.h
index bc035ac25c..b27c09d10e 100644
--- a/src/mesa/state_tracker/st_cb_clear.h
+++ b/src/mesa/state_tracker/st_cb_clear.h
@@ -30,6 +30,9 @@
#define ST_CB_CLEAR_H
+struct dd_function_table;
+struct st_context;
+
extern void
st_init_clear(struct st_context *st);
diff --git a/src/mesa/state_tracker/st_cb_condrender.h b/src/mesa/state_tracker/st_cb_condrender.h
index 891f1cbcd8..79d0db8d08 100644
--- a/src/mesa/state_tracker/st_cb_condrender.h
+++ b/src/mesa/state_tracker/st_cb_condrender.h
@@ -29,6 +29,8 @@
#define ST_CB_CONDRENDER_H
+struct dd_function_table;
+
extern void st_init_cond_render_functions(struct dd_function_table *functions);
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.h b/src/mesa/state_tracker/st_cb_drawpixels.h
index 7d5e901ccc..575f169e08 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.h
+++ b/src/mesa/state_tracker/st_cb_drawpixels.h
@@ -30,7 +30,10 @@
#define ST_CB_DRAWPIXELS_H
-#include "main/mtypes.h"
+#include "main/compiler.h"
+
+struct dd_function_table;
+struct st_context;
#if FEATURE_drawpix
diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c
index b191a7f890..c99a8d792e 100644
--- a/src/mesa/state_tracker/st_cb_drawtex.c
+++ b/src/mesa/state_tracker/st_cb_drawtex.c
@@ -14,7 +14,6 @@
#include "main/imports.h"
#include "main/image.h"
-#include "main/bufferobj.h"
#include "main/macros.h"
#include "program/program.h"
#include "program/prog_print.h"
diff --git a/src/mesa/state_tracker/st_cb_drawtex.h b/src/mesa/state_tracker/st_cb_drawtex.h
index a3f54a349c..d21262f897 100644
--- a/src/mesa/state_tracker/st_cb_drawtex.h
+++ b/src/mesa/state_tracker/st_cb_drawtex.h
@@ -10,7 +10,10 @@
#define ST_CB_DRAWTEX_H
-#include "main/mtypes.h"
+#include "main/compiler.h"
+
+struct dd_function_table;
+struct st_context;
#if FEATURE_OES_draw_texture
diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c
index 4aaf91d5a1..037e576fab 100644
--- a/src/mesa/state_tracker/st_cb_eglimage.c
+++ b/src/mesa/state_tracker/st_cb_eglimage.c
@@ -33,6 +33,7 @@
#include "util/u_format.h"
#include "st_cb_eglimage.h"
#include "st_cb_fbo.h"
+#include "st_context.h"
#include "st_texture.h"
#include "st_format.h"
#include "st_manager.h"
diff --git a/src/mesa/state_tracker/st_cb_eglimage.h b/src/mesa/state_tracker/st_cb_eglimage.h
index d6953e99f6..b6e44d5aff 100644
--- a/src/mesa/state_tracker/st_cb_eglimage.h
+++ b/src/mesa/state_tracker/st_cb_eglimage.h
@@ -29,8 +29,9 @@
#ifndef ST_CB_EGLIMAGE_H
#define ST_CB_EGLIMAGE_H
-#include "main/mtypes.h"
-#include "main/dd.h"
+#include "main/compiler.h"
+
+struct dd_function_table;
#if FEATURE_OES_EGL_image
diff --git a/src/mesa/state_tracker/st_cb_fbo.h b/src/mesa/state_tracker/st_cb_fbo.h
index 43b6c1e75f..62a9bbcb25 100644
--- a/src/mesa/state_tracker/st_cb_fbo.h
+++ b/src/mesa/state_tracker/st_cb_fbo.h
@@ -29,6 +29,15 @@
#ifndef ST_CB_FBO_H
#define ST_CB_FBO_H
+#include "main/compiler.h"
+#include "main/glheader.h"
+#include "main/mtypes.h"
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_format.h"
+
+struct dd_function_table;
+struct pipe_context;
/**
* Derived renderbuffer class. Just need to add a pointer to the
diff --git a/src/mesa/state_tracker/st_cb_feedback.h b/src/mesa/state_tracker/st_cb_feedback.h
index 706d84960f..f2342f5823 100644
--- a/src/mesa/state_tracker/st_cb_feedback.h
+++ b/src/mesa/state_tracker/st_cb_feedback.h
@@ -30,7 +30,9 @@
#define ST_CB_FEEDBACK_H
-#include "main/mtypes.h"
+#include "main/compiler.h"
+
+struct dd_function_table;
#if FEATURE_feedback
diff --git a/src/mesa/state_tracker/st_cb_flush.h b/src/mesa/state_tracker/st_cb_flush.h
index 7fca0176a3..7672b4cf1d 100644
--- a/src/mesa/state_tracker/st_cb_flush.h
+++ b/src/mesa/state_tracker/st_cb_flush.h
@@ -30,6 +30,12 @@
#define ST_CB_FLUSH_H
+#include "pipe/p_compiler.h"
+
+struct dd_function_table;
+struct pipe_fence_handle;
+struct st_context;
+
extern void
st_init_flush_functions(struct dd_function_table *functions);
diff --git a/src/mesa/state_tracker/st_cb_program.h b/src/mesa/state_tracker/st_cb_program.h
index 0de96f2fd2..0fd179ef3d 100644
--- a/src/mesa/state_tracker/st_cb_program.h
+++ b/src/mesa/state_tracker/st_cb_program.h
@@ -29,6 +29,10 @@
#define ST_CB_PROGRAM_H
+#include "main/mtypes.h"
+
+struct dd_function_table;
+
extern void
st_init_program_functions(struct dd_function_table *functions);
diff --git a/src/mesa/state_tracker/st_cb_rasterpos.h b/src/mesa/state_tracker/st_cb_rasterpos.h
index d2ed7297f1..2dc109bb18 100644
--- a/src/mesa/state_tracker/st_cb_rasterpos.h
+++ b/src/mesa/state_tracker/st_cb_rasterpos.h
@@ -29,7 +29,9 @@
#define ST_CB_RASTERPOS_H
-#include "main/mtypes.h"
+#include "main/compiler.h"
+
+struct dd_function_table;
#if FEATURE_rastpos
diff --git a/src/mesa/state_tracker/st_cb_readpixels.h b/src/mesa/state_tracker/st_cb_readpixels.h
index c90ef02906..9e1f7b4925 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.h
+++ b/src/mesa/state_tracker/st_cb_readpixels.h
@@ -29,6 +29,10 @@
#ifndef ST_CB_READPIXELS_H
#define ST_CB_READPIXELS_H
+#include "main/mtypes.h"
+
+struct dd_function_table;
+
extern struct st_renderbuffer *
st_get_color_read_renderbuffer(GLcontext *ctx);
diff --git a/src/mesa/state_tracker/st_cb_strings.h b/src/mesa/state_tracker/st_cb_strings.h
index 3b765aaa59..92d5d2d9ba 100644
--- a/src/mesa/state_tracker/st_cb_strings.h
+++ b/src/mesa/state_tracker/st_cb_strings.h
@@ -30,6 +30,8 @@
#define ST_CB_STRINGS_H
+struct dd_function_table;
+
extern void
st_init_string_functions(struct dd_function_table *functions);
diff --git a/src/mesa/state_tracker/st_cb_texture.h b/src/mesa/state_tracker/st_cb_texture.h
index 1cd9fc3a50..6942478e81 100644
--- a/src/mesa/state_tracker/st_cb_texture.h
+++ b/src/mesa/state_tracker/st_cb_texture.h
@@ -30,6 +30,13 @@
#define ST_CB_TEXTURE_H
+#include "main/glheader.h"
+#include "main/mtypes.h"
+
+struct dd_function_table;
+struct pipe_context;
+struct st_context;
+
extern GLboolean
st_finalize_texture(GLcontext *ctx,
struct pipe_context *pipe,
diff --git a/src/mesa/state_tracker/st_cb_viewport.h b/src/mesa/state_tracker/st_cb_viewport.h
index db7dd6eab8..bcfd7cb68a 100644
--- a/src/mesa/state_tracker/st_cb_viewport.h
+++ b/src/mesa/state_tracker/st_cb_viewport.h
@@ -25,5 +25,12 @@
*
**************************************************************************/
+#ifndef ST_CB_VIEWPORT_H
+#define ST_CB_VIEWPORT_H
+
+struct dd_function_table;
+
extern void
st_init_viewport_functions(struct dd_function_table *functions);
+
+#endif /* ST_CB_VIEW_PORT_H */
diff --git a/src/mesa/state_tracker/st_cb_xformfb.h b/src/mesa/state_tracker/st_cb_xformfb.h
index 50efcb9293..574cf481e1 100644
--- a/src/mesa/state_tracker/st_cb_xformfb.h
+++ b/src/mesa/state_tracker/st_cb_xformfb.h
@@ -29,6 +29,10 @@
#define ST_CB_XFORMFB_H
+#include "main/compiler.h"
+
+struct dd_function_table;
+
#if FEATURE_EXT_transform_feedback
extern void
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 7eb5f32611..2ce5f08753 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -28,6 +28,7 @@
#include "main/imports.h"
#include "main/context.h"
#include "main/shaderobj.h"
+#include "program/prog_cache.h"
#include "vbo/vbo.h"
#include "glapi/glapi.h"
#include "st_context.h"
@@ -62,6 +63,9 @@
#include "cso_cache/cso_context.h"
+DEBUG_GET_ONCE_BOOL_OPTION(mesa_mvp_dp4, "MESA_MVP_DP4", FALSE)
+
+
/**
* Called via ctx->Driver.UpdateState()
*/
@@ -169,7 +173,7 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
/* XXX: need a capability bit in gallium to query if the pipe
* driver prefers DP4 or MUL/MAD for vertex transformation.
*/
- if (debug_get_bool_option("MESA_MVP_DP4", FALSE))
+ if (debug_get_option_mesa_mvp_dp4())
_mesa_set_mvp_with_dp4( ctx, GL_TRUE );
return st_create_context_priv(ctx, pipe);
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index a147a02117..60c25fb8f0 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -1,3 +1,4 @@
+//struct dd_function_table;
/**************************************************************************
*
* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
@@ -29,21 +30,17 @@
#define ST_CONTEXT_H
#include "main/mtypes.h"
-#include "program/prog_cache.h"
#include "pipe/p_state.h"
#include "state_tracker/st_api.h"
-
-struct st_context;
-struct st_texture_object;
-struct st_fragment_program;
+struct bitmap_cache;
+struct blit_state;
+struct dd_function_table;
struct draw_context;
struct draw_stage;
-struct cso_cache;
-struct cso_blend;
struct gen_mipmap_state;
-struct blit_state;
-struct bitmap_cache;
+struct st_context;
+struct st_fragment_program;
#define ST_NEW_MESA 0x1 /* Mesa state has changed */
diff --git a/src/mesa/state_tracker/st_debug.c b/src/mesa/state_tracker/st_debug.c
index ebf6ec6e7e..df32491d04 100644
--- a/src/mesa/state_tracker/st_debug.c
+++ b/src/mesa/state_tracker/st_debug.c
@@ -55,6 +55,8 @@ static const struct debug_named_value st_debug_flags[] = {
{ "query", DEBUG_QUERY, NULL },
DEBUG_NAMED_VALUE_END
};
+
+DEBUG_GET_ONCE_FLAGS_OPTION(st_debug, "ST_DEBUG", st_debug_flags, 0)
#endif
@@ -62,7 +64,7 @@ void
st_debug_init(void)
{
#ifdef DEBUG
- ST_DEBUG = debug_get_flags_option("ST_DEBUG", st_debug_flags, 0 );
+ ST_DEBUG = debug_get_option_st_debug();
#endif
}
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 5821da4889..5b05489270 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -58,6 +58,7 @@
#include "util/u_inlines.h"
#include "util/u_format.h"
#include "util/u_prim.h"
+#include "util/u_draw_quad.h"
#include "draw/draw_context.h"
#include "cso_cache/cso_context.h"
@@ -494,6 +495,49 @@ setup_non_interleaved_attribs(GLcontext *ctx,
}
+static void
+setup_index_buffer(GLcontext *ctx,
+ const struct _mesa_index_buffer *ib,
+ struct pipe_index_buffer *ibuffer)
+{
+ struct st_context *st = st_context(ctx);
+ struct pipe_context *pipe = st->pipe;
+
+ memset(ibuffer, 0, sizeof(*ibuffer));
+ if (ib) {
+ struct gl_buffer_object *bufobj = ib->obj;
+
+ switch (ib->type) {
+ case GL_UNSIGNED_INT:
+ ibuffer->index_size = 4;
+ break;
+ case GL_UNSIGNED_SHORT:
+ ibuffer->index_size = 2;
+ break;
+ case GL_UNSIGNED_BYTE:
+ ibuffer->index_size = 1;
+ break;
+ default:
+ assert(0);
+ return;
+ }
+
+ /* get/create the index buffer object */
+ if (bufobj && bufobj->Name) {
+ /* elements/indexes are in a real VBO */
+ struct st_buffer_object *stobj = st_buffer_object(bufobj);
+ pipe_resource_reference(&ibuffer->buffer, stobj->buffer);
+ ibuffer->offset = pointer_to_offset(ib->ptr);
+ }
+ else {
+ /* element/indicies are in user space memory */
+ ibuffer->buffer =
+ pipe_user_buffer_create(pipe->screen, (void *) ib->ptr,
+ ib->count * ibuffer->index_size,
+ PIPE_BIND_INDEX_BUFFER);
+ }
+ }
+}
/**
* Prior to drawing, check that any uniforms referenced by the
@@ -568,8 +612,11 @@ st_draw_vbo(GLcontext *ctx,
GLuint attr;
struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
unsigned num_vbuffers, num_velements;
+ struct pipe_index_buffer ibuffer;
GLboolean userSpace = GL_FALSE;
GLboolean vertDataEdgeFlags;
+ struct pipe_draw_info info;
+ unsigned i;
/* Mesa core state should have been validated already */
assert(ctx->NewState == 0x0);
@@ -647,113 +694,35 @@ st_draw_vbo(GLcontext *ctx,
if (num_vbuffers == 0 || num_velements == 0)
return;
- /* do actual drawing */
- if (ib) {
- /* indexed primitive */
- struct gl_buffer_object *bufobj = ib->obj;
- struct pipe_resource *indexBuf = NULL;
- unsigned indexSize, indexOffset, i;
+ setup_index_buffer(ctx, ib, &ibuffer);
+ pipe->set_index_buffer(pipe, &ibuffer);
- switch (ib->type) {
- case GL_UNSIGNED_INT:
- indexSize = 4;
- break;
- case GL_UNSIGNED_SHORT:
- indexSize = 2;
- break;
- case GL_UNSIGNED_BYTE:
- indexSize = 1;
- break;
- default:
- assert(0);
- return;
- }
-
- /* get/create the index buffer object */
- if (bufobj && bufobj->Name) {
- /* elements/indexes are in a real VBO */
- struct st_buffer_object *stobj = st_buffer_object(bufobj);
- pipe_resource_reference(&indexBuf, stobj->buffer);
- indexOffset = pointer_to_offset(ib->ptr) / indexSize;
- }
- else {
- /* element/indicies are in user space memory */
- indexBuf = pipe_user_buffer_create(pipe->screen, (void *) ib->ptr,
- ib->count * indexSize,
- PIPE_BIND_INDEX_BUFFER);
- indexOffset = 0;
+ util_draw_init_info(&info);
+ if (ib) {
+ info.indexed = TRUE;
+ if (min_index != ~0 && max_index != ~0) {
+ info.min_index = min_index;
+ info.max_index = max_index;
}
+ }
- /* draw */
- if (pipe->draw_range_elements && min_index != ~0 && max_index != ~0) {
- /* XXX: exercise temporary path to pass min/max directly
- * through to driver & draw module. These interfaces still
- * need a bit of work...
- */
- for (i = 0; i < nr_prims; i++) {
- unsigned vcount = prims[i].count;
- unsigned prim = translate_prim(ctx, prims[i].mode);
-
- if (u_trim_pipe_prim(prims[i].mode, &vcount)) {
- pipe->draw_range_elements(pipe, indexBuf, indexSize,
- prims[i].basevertex,
- min_index, max_index, prim,
- prims[i].start + indexOffset, vcount);
- }
- }
- }
- else {
- for (i = 0; i < nr_prims; i++) {
- unsigned vcount = prims[i].count;
- unsigned prim = translate_prim(ctx, prims[i].mode);
-
- if (u_trim_pipe_prim(prims[i].mode, &vcount)) {
- if (prims[i].num_instances == 1) {
- pipe->draw_elements(pipe, indexBuf,
- indexSize,
- prims[i].basevertex,
- prim,
- prims[i].start + indexOffset,
- vcount);
- }
- else {
- pipe->draw_elements_instanced(pipe, indexBuf,
- indexSize,
- prims[i].basevertex,
- prim,
- prims[i].start + indexOffset,
- vcount,
- 0, /* startInstance */
- prims[i].num_instances);
- }
- }
- }
+ /* do actual drawing */
+ for (i = 0; i < nr_prims; i++) {
+ info.mode = translate_prim( ctx, prims[i].mode );
+ info.start = prims[i].start;
+ info.count = prims[i].count;
+ info.instance_count = prims[i].num_instances;
+ info.index_bias = prims[i].basevertex;
+ if (!ib) {
+ info.min_index = info.start;
+ info.max_index = info.start + info.count - 1;
}
- pipe_resource_reference(&indexBuf, NULL);
+ if (u_trim_pipe_prim(info.mode, &info.count))
+ pipe->draw_vbo(pipe, &info);
}
- else {
- /* non-indexed */
- GLuint i;
-
- for (i = 0; i < nr_prims; i++) {
- unsigned vcount = prims[i].count;
- unsigned prim = translate_prim(ctx, prims[i].mode);
- if (u_trim_pipe_prim(prims[i].mode, &vcount)) {
- if (prims[i].num_instances == 1) {
- pipe->draw_arrays(pipe, prim, prims[i].start, vcount);
- }
- else {
- pipe->draw_arrays_instanced(pipe, prim,
- prims[i].start,
- vcount,
- 0, /* startInstance */
- prims[i].num_instances);
- }
- }
- }
- }
+ pipe_resource_reference(&ibuffer.buffer, NULL);
/* unreference buffers (frees wrapped user-space buffer objects) */
for (attr = 0; attr < num_vbuffers; attr++) {
diff --git a/src/mesa/state_tracker/st_draw.h b/src/mesa/state_tracker/st_draw.h
index 3e0face656..f36184487a 100644
--- a/src/mesa/state_tracker/st_draw.h
+++ b/src/mesa/state_tracker/st_draw.h
@@ -34,8 +34,13 @@
#ifndef ST_DRAW_H
#define ST_DRAW_H
-struct _mesa_prim;
+#include "main/compiler.h"
+#include "main/glheader.h"
+#include "main/mtypes.h"
+
struct _mesa_index_buffer;
+struct _mesa_prim;
+struct st_context;
void st_init_draw( struct st_context *st );
diff --git a/src/mesa/state_tracker/st_extensions.h b/src/mesa/state_tracker/st_extensions.h
index 2994f16dd3..aa9b2b2b91 100644
--- a/src/mesa/state_tracker/st_extensions.h
+++ b/src/mesa/state_tracker/st_extensions.h
@@ -30,6 +30,8 @@
#define ST_EXTENSIONS_H
+struct st_context;
+
extern void st_init_limits(struct st_context *st);
extern void st_init_extensions(struct st_context *st);
diff --git a/src/mesa/state_tracker/st_format.h b/src/mesa/state_tracker/st_format.h
index 29768f296d..841c58cadc 100644
--- a/src/mesa/state_tracker/st_format.h
+++ b/src/mesa/state_tracker/st_format.h
@@ -31,7 +31,12 @@
#define ST_FORMAT_H
#include "main/formats.h"
+#include "main/mtypes.h"
+#include "pipe/p_defines.h"
+#include "pipe/p_format.h"
+
+struct pipe_screen;
extern GLenum
st_format_datatype(enum pipe_format format);
diff --git a/src/mesa/state_tracker/st_gen_mipmap.h b/src/mesa/state_tracker/st_gen_mipmap.h
index 00fbae9302..016bf3f4bb 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.h
+++ b/src/mesa/state_tracker/st_gen_mipmap.h
@@ -30,6 +30,10 @@
#define ST_GEN_MIPMAP_H
+#include "main/mtypes.h"
+
+struct st_context;
+
extern void
st_init_generate_mipmap(struct st_context *st);
diff --git a/src/mesa/state_tracker/st_gl_api.h b/src/mesa/state_tracker/st_gl_api.h
index fe1aec207e..57c6d9f24d 100644
--- a/src/mesa/state_tracker/st_gl_api.h
+++ b/src/mesa/state_tracker/st_gl_api.h
@@ -2,8 +2,6 @@
#ifndef ST_GL_API_H
#define ST_GL_API_H
-#include "state_tracker/st_api.h"
-
struct st_api *st_gl_api_create(void);
struct st_api *st_gl_api_create_es1(void);
struct st_api *st_gl_api_create_es2(void);
diff --git a/src/mesa/state_tracker/st_manager.h b/src/mesa/state_tracker/st_manager.h
index cd2887b1e0..48a9d4d99a 100644
--- a/src/mesa/state_tracker/st_manager.h
+++ b/src/mesa/state_tracker/st_manager.h
@@ -29,8 +29,11 @@
#ifndef ST_MANAGER_H
#define ST_MANAGER_H
-#include "state_tracker/st_api.h"
-#include "st_context.h"
+#include "main/mtypes.h"
+
+#include "pipe/p_compiler.h"
+
+struct st_context;
struct pipe_surface *
st_manager_get_egl_image_surface(struct st_context *st,
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index bacd091853..a19dcc9253 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -44,6 +44,15 @@
#include "util/u_math.h"
#include "util/u_memory.h"
+
+#define PROGRAM_ANY_CONST ((1 << PROGRAM_LOCAL_PARAM) | \
+ (1 << PROGRAM_ENV_PARAM) | \
+ (1 << PROGRAM_STATE_VAR) | \
+ (1 << PROGRAM_NAMED_PARAM) | \
+ (1 << PROGRAM_CONSTANT) | \
+ (1 << PROGRAM_UNIFORM))
+
+
struct label {
unsigned branch_target;
unsigned token;
@@ -205,7 +214,7 @@ src_register( struct st_translate *t,
return ureg_src_undef();
case PROGRAM_TEMPORARY:
- ASSERT(index >= 0);
+ assert(index >= 0);
if (ureg_dst_is_undef(t->temps[index]))
t->temps[index] = ureg_DECL_temporary( t->ureg );
assert(index < Elements(t->temps));
@@ -215,7 +224,7 @@ src_register( struct st_translate *t,
case PROGRAM_ENV_PARAM:
case PROGRAM_LOCAL_PARAM:
case PROGRAM_UNIFORM:
- ASSERT(index >= 0);
+ assert(index >= 0);
return t->constants[index];
case PROGRAM_STATE_VAR:
case PROGRAM_CONSTANT: /* ie, immediate */
@@ -738,9 +747,11 @@ emit_adjusted_wpos( struct st_translate *t,
struct ureg_dst wpos_temp = ureg_DECL_temporary(ureg);
struct ureg_src wpos_input = t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]];
- ureg_ADD(ureg,
- ureg_writemask(wpos_temp, TGSI_WRITEMASK_X | TGSI_WRITEMASK_Y),
- wpos_input, ureg_imm1f(ureg, value));
+ /* Note that we bias X and Y and pass Z and W through unchanged.
+ * The shader might also use gl_FragCoord.w and .z.
+ */
+ ureg_ADD(ureg, wpos_temp, wpos_input,
+ ureg_imm4f(ureg, value, value, 0.0f, 0.0f));
t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]] = ureg_src(wpos_temp);
}
@@ -1057,6 +1068,16 @@ st_translate_mesa_program(
t->address[0] = ureg_DECL_address( ureg );
}
+ if (program->IndirectRegisterFiles & (1 << PROGRAM_TEMPORARY)) {
+ /* If temps are accessed with indirect addressing, declare temporaries
+ * in sequential order. Else, we declare them on demand elsewhere.
+ */
+ for (i = 0; i < program->NumTemporaries; i++) {
+ /* XXX use TGSI_FILE_TEMPORARY_ARRAY when it's supported by ureg */
+ t->temps[i] = ureg_DECL_temporary( t->ureg );
+ }
+ }
+
/* Emit constants and immediates. Mesa uses a single index space
* for these, so we put all the translated regs in t->constants.
*/
@@ -1067,7 +1088,7 @@ st_translate_mesa_program(
ret = PIPE_ERROR_OUT_OF_MEMORY;
goto out;
}
-
+
for (i = 0; i < program->Parameters->NumParameters; i++) {
switch (program->Parameters->Parameters[i].Type) {
case PROGRAM_ENV_PARAM:
@@ -1078,13 +1099,14 @@ st_translate_mesa_program(
t->constants[i] = ureg_DECL_constant( ureg, i );
break;
- /* Emit immediates only when there is no address register
- * in use. FIXME: Be smarter and recognize param arrays:
+ /* Emit immediates only when there's no indirect addressing of
+ * the const buffer.
+ * FIXME: Be smarter and recognize param arrays:
* indirect addressing is only valid within the referenced
* array.
*/
case PROGRAM_CONSTANT:
- if (program->NumAddressRegs > 0)
+ if (program->IndirectRegisterFiles & PROGRAM_ANY_CONST)
t->constants[i] = ureg_DECL_constant( ureg, i );
else
t->constants[i] =
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.h b/src/mesa/state_tracker/st_mesa_to_tgsi.h
index e3c5bd1d94..ca076ce362 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.h
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.h
@@ -30,8 +30,10 @@
#define ST_MESA_TO_TGSI_H
#include "main/mtypes.h"
-#include "tgsi/tgsi_ureg.h"
+#include "pipe/p_compiler.h"
+
+struct ureg_program;
#if defined __cplusplus
extern "C" {
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 6f3ecdbce1..91528c227b 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -41,6 +41,7 @@
#include "pipe/p_shader_tokens.h"
#include "draw/draw_context.h"
#include "tgsi/tgsi_dump.h"
+#include "tgsi/tgsi_ureg.h"
#include "st_debug.h"
#include "st_context.h"
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index d779d5a6dd..3805b9a725 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -36,11 +36,8 @@
#include "main/mtypes.h"
#include "program/program.h"
-#include "pipe/p_shader_tokens.h"
-
-
-struct cso_fragment_shader;
-struct cso_vertex_shader;
+#include "pipe/p_state.h"
+#include "st_context.h"
/**
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index dbdf1ea1ad..add6e949df 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -25,14 +25,14 @@
*
**************************************************************************/
+#include <stdio.h>
+
#include "st_context.h"
#include "st_format.h"
#include "st_texture.h"
#include "st_cb_fbo.h"
#include "main/enums.h"
-#undef Elements /* fix re-defined macro warning */
-
#include "pipe/p_state.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"