summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorNicolai Hähnle <nhaehnle@gmail.com>2009-10-07 20:45:08 +0200
committerNicolai Hähnle <nhaehnle@gmail.com>2009-10-07 20:45:08 +0200
commit7ca7220ea1d31dbdbf1fe7e6f3e6cc4ff8b0abde (patch)
treea4e50f36da7c75c945a2418738e2a84af2b3789d /src/mesa/state_tracker
parent57abb76e1095d14f54ea8b8d0d2220e209b8656f (diff)
parent5b4c0b864a25fa193e7ba828cf5ce483ca05bd4e (diff)
Merge branch 'master' into r300g-glsl
Conflicts: src/gallium/drivers/r300/r300_tgsi_to_rc.c Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom_constbuf.c3
-rw-r--r--src/mesa/state_tracker/st_atom_pixeltransfer.c3
-rw-r--r--src/mesa/state_tracker/st_cb_accum.c11
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c21
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c16
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c4
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c13
-rw-r--r--src/mesa/state_tracker/st_context.c4
-rw-r--r--src/mesa/state_tracker/st_debug.c28
-rw-r--r--src/mesa/state_tracker/st_debug.h36
-rw-r--r--src/mesa/state_tracker/st_format.c12
-rw-r--r--src/mesa/state_tracker/st_format.h5
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.c4
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c21
-rw-r--r--src/mesa/state_tracker/st_program.c20
15 files changed, 159 insertions, 42 deletions
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
index 5d4d8eee02..77153889b6 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -39,6 +39,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
+#include "st_debug.h"
#include "st_context.h"
#include "st_atom.h"
#include "st_atom_constbuf.h"
@@ -75,7 +76,7 @@ void st_upload_constants( struct st_context *st,
PIPE_BUFFER_USAGE_CONSTANT,
paramBytes );
- if (0) {
+ if (ST_DEBUG & DEBUG_CONSTANTS) {
debug_printf("%s(shader=%d, numParams=%d, stateFlags=0x%x)\n",
__FUNCTION__, shader_type, params->NumParameters,
params->StateFlags);
diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c
index eff3666ca8..babfcc87b4 100644
--- a/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -122,7 +122,8 @@ create_color_map_texture(GLcontext *ctx)
const uint texSize = 256; /* simple, and usually perfect */
/* find an RGBA texture format */
- format = st_choose_format(pipe, GL_RGBA, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER);
+ format = st_choose_format(pipe->screen, GL_RGBA,
+ PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER);
/* create texture for color map/table */
pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, 0,
diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c
index 3d1d0f71d5..a6b9765452 100644
--- a/src/mesa/state_tracker/st_cb_accum.c
+++ b/src/mesa/state_tracker/st_cb_accum.c
@@ -34,6 +34,7 @@
#include "main/image.h"
#include "main/macros.h"
+#include "st_debug.h"
#include "st_context.h"
#include "st_cb_accum.h"
#include "st_cb_fbo.h"
@@ -136,6 +137,9 @@ accum_accum(struct st_context *st, GLfloat value,
GLubyte *data = acc_strb->data;
GLfloat *buf;
+ if (ST_DEBUG & DEBUG_FALLBACK)
+ debug_printf("%s: fallback processing\n", __FUNCTION__);
+
color_trans = st_cond_flush_get_tex_transfer(st, color_strb->texture,
0, 0, 0,
PIPE_TRANSFER_READ, xpos, ypos,
@@ -181,6 +185,10 @@ accum_load(struct st_context *st, GLfloat value,
GLubyte *data = acc_strb->data;
GLfloat *buf;
+
+ if (ST_DEBUG & DEBUG_FALLBACK)
+ debug_printf("%s: fallback processing\n", __FUNCTION__);
+
color_trans = st_cond_flush_get_tex_transfer(st, color_strb->texture,
0, 0, 0,
PIPE_TRANSFER_READ, xpos, ypos,
@@ -228,6 +236,9 @@ accum_return(GLcontext *ctx, GLfloat value,
const GLubyte *data = acc_strb->data;
GLfloat *buf;
+ if (ST_DEBUG & DEBUG_FALLBACK)
+ debug_printf("%s: fallback processing\n", __FUNCTION__);
+
buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3])
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 99f3ba678b..5c3413f905 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -40,6 +40,7 @@
#include "shader/prog_parameter.h"
#include "shader/prog_print.h"
+#include "st_debug.h"
#include "st_context.h"
#include "st_atom.h"
#include "st_atom_constbuf.h"
@@ -598,15 +599,15 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
/* viewport state: viewport matching window dims */
{
- const float width = (float) ctx->DrawBuffer->Width;
- const float height = (float) ctx->DrawBuffer->Height;
+ const float w = (float) ctx->DrawBuffer->Width;
+ const float h = (float) ctx->DrawBuffer->Height;
struct pipe_viewport_state vp;
- vp.scale[0] = 0.5f * width;
- vp.scale[1] = -0.5f * height;
+ vp.scale[0] = 0.5f * w;
+ vp.scale[1] = -0.5f * h;
vp.scale[2] = 1.0f;
vp.scale[3] = 1.0f;
- vp.translate[0] = 0.5f * width;
- vp.translate[1] = 0.5f * height;
+ vp.translate[0] = 0.5f * w;
+ vp.translate[1] = 0.5f * h;
vp.translate[2] = 0.0f;
vp.translate[3] = 0.0f;
cso_set_viewport(cso, &vp);
@@ -1014,13 +1015,14 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
else {
/* srcFormat can't be used as a texture format */
if (type == GL_DEPTH) {
- texFormat = st_choose_format(pipe, GL_DEPTH_COMPONENT, PIPE_TEXTURE_2D,
+ texFormat = st_choose_format(screen, GL_DEPTH_COMPONENT,
+ PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_DEPTH_STENCIL);
assert(texFormat != PIPE_FORMAT_NONE); /* XXX no depth texture formats??? */
}
else {
/* default color format */
- texFormat = st_choose_format(pipe, GL_RGBA, PIPE_TEXTURE_2D,
+ texFormat = st_choose_format(screen, GL_RGBA, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_SAMPLER);
assert(texFormat != PIPE_FORMAT_NONE);
}
@@ -1090,6 +1092,9 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
struct pipe_transfer *ptTex;
enum pipe_transfer_usage transfer_usage;
+ if (ST_DEBUG & DEBUG_FALLBACK)
+ debug_printf("%s: fallback processing\n", __FUNCTION__);
+
if (type == GL_DEPTH && pf_is_depth_and_stencil(pt->format))
transfer_usage = PIPE_TRANSFER_READ_WRITE;
else
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index fe0a121493..864f5d3ca3 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -93,7 +93,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
if (strb->format != PIPE_FORMAT_NONE)
format = strb->format;
else
- format = st_choose_renderbuffer_format(pipe, internalFormat);
+ format = st_choose_renderbuffer_format(pipe->screen, internalFormat);
/* init renderbuffer fields */
strb->Base.Width = width;
@@ -165,12 +165,12 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
strb->texture,
0, 0, 0,
surface_usage );
-
- assert(strb->surface->texture);
- assert(strb->surface->format);
- assert(strb->surface->width == width);
- assert(strb->surface->height == height);
-
+ if (strb->surface) {
+ assert(strb->surface->texture);
+ assert(strb->surface->format);
+ assert(strb->surface->width == width);
+ assert(strb->surface->height == height);
+ }
return strb->surface != NULL;
}
@@ -298,6 +298,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw)
default:
_mesa_problem(NULL,
"Unexpected format in st_new_renderbuffer_fb");
+ _mesa_free(strb);
return NULL;
}
@@ -383,6 +384,7 @@ st_render_texture(GLcontext *ctx,
rb->Width = texImage->Width2;
rb->Height = texImage->Height2;
+ rb->_BaseFormat = texImage->_BaseFormat;
/*printf("***** render to texture level %d: %d x %d\n", att->TextureLevel, rb->Width, rb->Height);*/
/*printf("***** pipe texture %d x %d\n", pt->width[0], pt->height[0]);*/
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 75424aa2e7..772bb3bb69 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -43,6 +43,7 @@
#include "pipe/p_inlines.h"
#include "util/u_tile.h"
+#include "st_debug.h"
#include "st_context.h"
#include "st_cb_bitmap.h"
#include "st_cb_readpixels.h"
@@ -416,6 +417,9 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
yStep = 1;
}
+ if (ST_DEBUG & DEBUG_FALLBACK)
+ debug_printf("%s: fallback processing\n", __FUNCTION__);
+
/*
* Copy pixels from pipe_transfer to user memory
*/
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 9a634bb930..b943787106 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -43,6 +43,7 @@
#include "main/texobj.h"
#include "main/texstore.h"
+#include "state_tracker/st_debug.h"
#include "state_tracker/st_context.h"
#include "state_tracker/st_cb_fbo.h"
#include "state_tracker/st_cb_texture.h"
@@ -903,6 +904,9 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
GLvoid *dest = _mesa_image_address2d(&ctx->Pack, pixels, width,
height, format, type, row, 0);
+ if (ST_DEBUG & DEBUG_FALLBACK)
+ debug_printf("%s: fallback format translation\n", __FUNCTION__);
+
/* get float[4] rgba row from surface */
pipe_get_tile_rgba(tex_xfer, 0, row, width, 1, rgba);
@@ -1294,6 +1298,9 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level,
struct pipe_transfer *src_trans;
GLvoid *texDest;
enum pipe_transfer_usage transfer_usage;
+
+ if (ST_DEBUG & DEBUG_FALLBACK)
+ debug_printf("%s: fallback processing\n", __FUNCTION__);
assert(width <= MAX_WIDTH);
@@ -1419,6 +1426,12 @@ compatible_src_dst_formats(const struct gl_renderbuffer *src,
return TGSI_WRITEMASK_XYZ; /* A ==> 1.0 */
}
else {
+ if (ST_DEBUG & DEBUG_FALLBACK)
+ debug_printf("%s failed for src %s, dst %s\n",
+ __FUNCTION__,
+ _mesa_lookup_enum_by_nr(srcFormat),
+ _mesa_lookup_enum_by_nr(dstLogicalFormat));
+
/* Otherwise fail.
*/
return 0;
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 96969c736c..f0eddafd33 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -36,6 +36,7 @@
#include "shader/shader_api.h"
#include "glapi/glapi.h"
#include "st_public.h"
+#include "st_debug.h"
#include "st_context.h"
#include "st_cb_accum.h"
#include "st_cb_bitmap.h"
@@ -113,6 +114,9 @@ st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe )
st->ctx = ctx;
st->pipe = pipe;
+ /* XXX: this is one-off, per-screen init: */
+ st_debug_init();
+
/* state tracker needs the VBO module */
_vbo_CreateContext(ctx);
diff --git a/src/mesa/state_tracker/st_debug.c b/src/mesa/state_tracker/st_debug.c
index c7d26ce33c..3009cde9d5 100644
--- a/src/mesa/state_tracker/st_debug.c
+++ b/src/mesa/state_tracker/st_debug.c
@@ -41,6 +41,32 @@
+#ifdef DEBUG
+int ST_DEBUG = 0;
+
+static const struct debug_named_value st_debug_flags[] = {
+ { "mesa", DEBUG_MESA },
+ { "tgsi", DEBUG_TGSI },
+ { "pipe", DEBUG_PIPE },
+ { "tex", DEBUG_TEX },
+ { "fallback", DEBUG_FALLBACK },
+ { "screen", DEBUG_SCREEN },
+ { "query", DEBUG_QUERY },
+ {NULL, 0}
+};
+#endif
+
+
+void
+st_debug_init(void)
+{
+#ifdef DEBUG
+ ST_DEBUG = debug_get_flags_option("ST_DEBUG", st_debug_flags, 0 );
+#endif
+}
+
+
+
/**
* Print current state. May be called from inside gdb to see currently
* bound vertex/fragment shaders and associated constants.
@@ -68,3 +94,5 @@ st_print_current(void)
if (st->fp->Base.Base.Parameters)
_mesa_print_parameter_list(st->fp->Base.Base.Parameters);
}
+
+
diff --git a/src/mesa/state_tracker/st_debug.h b/src/mesa/state_tracker/st_debug.h
index 49d752e1b2..4a060d7759 100644
--- a/src/mesa/state_tracker/st_debug.h
+++ b/src/mesa/state_tracker/st_debug.h
@@ -29,8 +29,44 @@
#ifndef ST_DEBUG_H
#define ST_DEBUG_H
+#include "pipe/p_compiler.h"
+#include "util/u_debug.h"
+
extern void
st_print_current(void);
+#define DEBUG_MESA 0x1
+#define DEBUG_TGSI 0x2
+#define DEBUG_CONSTANTS 0x4
+#define DEBUG_PIPE 0x8
+#define DEBUG_TEX 0x10
+#define DEBUG_FALLBACK 0x20
+#define DEBUG_QUERY 0x40
+#define DEBUG_SCREEN 0x80
+
+#ifdef DEBUG
+extern int ST_DEBUG;
+#define DBSTR(x) x
+#else
+#define ST_DEBUG 0
+#define DBSTR(x) ""
+#endif
+
+void st_debug_init( void );
+
+static INLINE void
+ST_DBG( unsigned flag, const char *fmt, ... )
+{
+ if (ST_DEBUG & flag)
+ {
+ va_list args;
+
+ va_start( args, fmt );
+ debug_vprintf( fmt, args );
+ va_end( args );
+ }
+}
+
+
#endif /* ST_DEBUG_H */
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index dcb90a3107..3e0db37414 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -392,10 +392,9 @@ default_depth_format(struct pipe_screen *screen,
* or PIPE_TEXTURE_USAGE_SAMPLER
*/
enum pipe_format
-st_choose_format(struct pipe_context *pipe, GLenum internalFormat,
+st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
enum pipe_texture_target target, unsigned tex_usage)
{
- struct pipe_screen *screen = pipe->screen;
unsigned geom_flags = 0;
switch (internalFormat) {
@@ -618,14 +617,15 @@ is_depth_or_stencil_format(GLenum internalFormat)
* Called by FBO code to choose a PIPE_FORMAT_ for drawing surfaces.
*/
enum pipe_format
-st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat)
+st_choose_renderbuffer_format(struct pipe_screen *screen,
+ GLenum internalFormat)
{
uint usage;
if (is_depth_or_stencil_format(internalFormat))
usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL;
else
usage = PIPE_TEXTURE_USAGE_RENDER_TARGET;
- return st_choose_format(pipe, internalFormat, PIPE_TEXTURE_2D, usage);
+ return st_choose_format(screen, internalFormat, PIPE_TEXTURE_2D, usage);
}
@@ -713,8 +713,8 @@ st_ChooseTextureFormat(GLcontext *ctx, GLint internalFormat,
(void) format;
(void) type;
- pFormat = st_choose_format(ctx->st->pipe, internalFormat, PIPE_TEXTURE_2D,
- PIPE_TEXTURE_USAGE_SAMPLER);
+ pFormat = st_choose_format(ctx->st->pipe->screen, internalFormat,
+ PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER);
if (pFormat == PIPE_FORMAT_NONE)
return NULL;
diff --git a/src/mesa/state_tracker/st_format.h b/src/mesa/state_tracker/st_format.h
index 9d9e02fe9b..e4a788c89b 100644
--- a/src/mesa/state_tracker/st_format.h
+++ b/src/mesa/state_tracker/st_format.h
@@ -64,11 +64,12 @@ st_mesa_format_to_pipe_format(GLuint mesaFormat);
extern enum pipe_format
-st_choose_format(struct pipe_context *pipe, GLenum internalFormat,
+st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
enum pipe_texture_target target, unsigned tex_usage);
extern enum pipe_format
-st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat);
+st_choose_renderbuffer_format(struct pipe_screen *screen,
+ GLenum internalFormat);
extern const struct gl_texture_format *
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index f75b2348b8..16ca2771b0 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -42,6 +42,7 @@
#include "cso_cache/cso_cache.h"
#include "cso_cache/cso_context.h"
+#include "st_debug.h"
#include "st_context.h"
#include "st_draw.h"
#include "st_gen_mipmap.h"
@@ -113,6 +114,9 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
uint dstLevel;
GLenum datatype;
GLuint comps;
+
+ if (ST_DEBUG & DEBUG_FALLBACK)
+ debug_printf("%s: fallback processing\n", __FUNCTION__);
assert(target != GL_TEXTURE_3D); /* not done yet */
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index b0a1b529f1..70d7c4fee2 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -151,7 +151,7 @@ dst_register( struct st_translate *t,
return t->address[index];
default:
- assert( 0 );
+ debug_assert( 0 );
return ureg_dst_undef();
}
}
@@ -173,8 +173,9 @@ src_register( struct st_translate *t,
case PROGRAM_STATE_VAR:
case PROGRAM_NAMED_PARAM:
+ case PROGRAM_ENV_PARAM:
case PROGRAM_UNIFORM:
- case PROGRAM_CONSTANT:
+ case PROGRAM_CONSTANT: /* ie, immediate */
return t->constants[index];
case PROGRAM_INPUT:
@@ -187,7 +188,7 @@ src_register( struct st_translate *t,
return ureg_src(t->address[index]);
default:
- assert( 0 );
+ debug_assert( 0 );
return ureg_src_undef();
}
}
@@ -216,7 +217,7 @@ translate_texture_target( GLuint textarget,
case TEXTURE_CUBE_INDEX: return TGSI_TEXTURE_CUBE;
case TEXTURE_RECT_INDEX: return TGSI_TEXTURE_RECT;
default:
- assert( 0 );
+ debug_assert( 0 );
return TGSI_TEXTURE_1D;
}
}
@@ -386,7 +387,7 @@ static void emit_swz( struct st_translate *t,
swizzle_4v( imm, add_swizzle ) );
}
else {
- assert(0);
+ debug_assert(0);
}
#undef IMM_ZERO
@@ -539,7 +540,7 @@ translate_opcode( unsigned op )
case OPCODE_END:
return TGSI_OPCODE_END;
default:
- assert( 0 );
+ debug_assert( 0 );
return TGSI_OPCODE_NOP;
}
}
@@ -578,7 +579,7 @@ compile_instruction(
case OPCODE_ELSE:
case OPCODE_ENDLOOP:
case OPCODE_IF:
- assert(num_dst == 0);
+ debug_assert(num_dst == 0);
ureg_label_insn( ureg,
translate_opcode( inst->Opcode ),
src, num_src,
@@ -761,7 +762,7 @@ st_translate_mesa_program(
outputSemanticIndex[i] );
break;
default:
- assert(0);
+ debug_assert(0);
return 0;
}
}
@@ -781,7 +782,7 @@ st_translate_mesa_program(
/* Declare address register.
*/
if (program->NumAddressRegs > 0) {
- assert( program->NumAddressRegs == 1 );
+ debug_assert( program->NumAddressRegs == 1 );
t->address[0] = ureg_DECL_address( ureg );
}
@@ -864,7 +865,7 @@ out:
if (!tokens) {
debug_printf("%s: failed to translate Mesa program:\n", __FUNCTION__);
_mesa_print_program(program);
- assert(0);
+ debug_assert(0);
}
return tokens;
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 927f60cc7e..a9be80ce8f 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -42,6 +42,7 @@
#include "draw/draw_context.h"
#include "tgsi/tgsi_dump.h"
+#include "st_debug.h"
#include "st_context.h"
#include "st_atom.h"
#include "st_program.h"
@@ -49,9 +50,6 @@
#include "cso_cache/cso_context.h"
-#define TGSI_DEBUG 0
-
-
/**
* Translate a Mesa vertex shader into a TGSI shader.
* \param outputMapping to map vertex program output registers (VERT_RESULT_x)
@@ -346,11 +344,15 @@ st_translate_vertex_program(struct st_context *st,
stvp->num_inputs = vs_num_inputs;
stvp->driver_shader = pipe->create_vs_state(pipe, &stvp->state);
- if (0)
+ if ((ST_DEBUG & DEBUG_TGSI) && (ST_DEBUG & DEBUG_MESA)) {
_mesa_print_program(&stvp->Base.Base);
+ debug_printf("\n");
+ }
- if (TGSI_DEBUG)
+ if (ST_DEBUG & DEBUG_TGSI) {
tgsi_dump( stvp->state.tokens, 0 );
+ debug_printf("\n");
+ }
}
@@ -526,11 +528,15 @@ st_translate_fragment_program(struct st_context *st,
stfp->driver_shader = pipe->create_fs_state(pipe, &stfp->state);
- if (0)
+ if ((ST_DEBUG & DEBUG_TGSI) && (ST_DEBUG & DEBUG_MESA)) {
_mesa_print_program(&stfp->Base.Base);
+ debug_printf("\n");
+ }
- if (TGSI_DEBUG)
+ if (ST_DEBUG & DEBUG_TGSI) {
tgsi_dump( stfp->state.tokens, 0/*TGSI_DUMP_VERBOSE*/ );
+ debug_printf("\n");
+ }
}