nouveau: NVSDBG macro
authorBen Skeggs <skeggsb@gmail.com>
Tue, 20 Mar 2007 04:05:35 +0000 (15:05 +1100)
committerBen Skeggs <skeggsb@gmail.com>
Tue, 20 Mar 2007 05:08:01 +0000 (16:08 +1100)
src/mesa/drivers/dri/nouveau/nouveau_shader.c
src/mesa/drivers/dri/nouveau/nouveau_shader.h
src/mesa/drivers/dri/nouveau/nouveau_shader_0.c
src/mesa/drivers/dri/nouveau/nouveau_shader_1.c
src/mesa/drivers/dri/nouveau/nouveau_shader_2.c

index ba47132..9cb837f 100644 (file)
@@ -48,6 +48,7 @@
 static void
 nouveauBindProgram(GLcontext *ctx, GLenum target, struct gl_program *prog)
 {
+   NVSDBG("target=%s, prog=%p\n", _mesa_lookup_enum_by_nr(target), prog);
 }
 
 static struct gl_program *
@@ -55,7 +56,10 @@ nouveauNewProgram(GLcontext *ctx, GLenum target, GLuint id)
 {
    nouveauShader *nvs;
 
+   NVSDBG("target=%s, id=%d\n", _mesa_lookup_enum_by_nr(target), id);
+
    nvs = CALLOC_STRUCT(_nouveauShader);
+   NVSDBG("prog=%p\n", nvs);
    switch (target) {
    case GL_VERTEX_PROGRAM_ARB:
       return _mesa_init_vertex_program(ctx, &nvs->mesa.vp, target, id);
@@ -75,6 +79,8 @@ nouveauDeleteProgram(GLcontext *ctx, struct gl_program *prog)
 {
    nouveauShader *nvs = (nouveauShader *)prog;
 
+   NVSDBG("prog=%p\n", prog);
+
    if (nvs->translated)
       FREE(nvs->program);
    _mesa_delete_program(ctx, prog);
@@ -86,6 +92,8 @@ nouveauProgramStringNotify(GLcontext *ctx, GLenum target,
 {
    nouveauShader *nvs = (nouveauShader *)prog;
 
+   NVSDBG("target=%s, prog=%p\n", _mesa_lookup_enum_by_nr(target), prog);
+
    if (nvs->translated)
       FREE(nvs->program);
    nvs->translated = 0;
@@ -98,6 +106,8 @@ nouveauIsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog)
 {
    nouveauShader *nvs = (nouveauShader *)prog;
 
+   NVSDBG("target=%s, prog=%p\n", _mesa_lookup_enum_by_nr(target), prog);
+
    return nvs->translated;
 }
 
@@ -108,6 +118,8 @@ nvsUpdateShader(GLcontext *ctx, nouveauShader *nvs)
    struct gl_program_parameter_list *plist;
    int i;
 
+   NVSDBG("prog=%p\n", nvs);
+
    /* Translate to HW format now if necessary */
    if (!nvs->translated) {
       /* Mesa ASM shader -> nouveauShader */
index b2df354..56ae270 100644 (file)
@@ -4,6 +4,12 @@
 #include "mtypes.h"
 #include "bufferobj.h"
 
+#define NVSDBG(fmt, args...) do {                             \
+       if (NOUVEAU_DEBUG & DEBUG_SHADERS) {                  \
+               fprintf(stderr, "%s: "fmt, __func__, ##args); \
+       }                                                     \
+} while(0)
+
 typedef struct _nvsFunc nvsFunc;
 
 #define NVS_MAX_TEMPS   32
index 211483d..0308a6c 100644 (file)
@@ -974,6 +974,8 @@ nouveau_shader_pass0(GLcontext *ctx, nouveauShader *nvs)
        struct pass0_rec *rec;
        int ret = GL_FALSE;
 
+       NVSDBG("start: nvs=%p\n", nvs);
+
        rec = CALLOC_STRUCT(pass0_rec);
        if (!rec)
                return GL_FALSE;
index 90c57d3..78c1401 100644 (file)
@@ -2,11 +2,13 @@
 #include "macros.h"
 #include "enums.h"
 
+#include "nouveau_context.h"
 #include "nouveau_shader.h"
 
 GLboolean
 nouveau_shader_pass1(nvsPtr nvs)
 {
+   NVSDBG("start: nvs=%p\n", nvs);
 
    return GL_TRUE;
 }
index b043f87..130ef35 100644 (file)
@@ -209,6 +209,8 @@ nouveau_shader_pass2(nvsPtr nvs)
        struct pass2_rec *rec;
        int i;
 
+       NVSDBG("start: nvs=%p\n", nvs);
+
        rec = calloc(1, sizeof(struct pass2_rec));
        for (i=0; i<NVS_MAX_TEMPS; i++)
                rec->temps[i] = -1;