diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2008-11-24 14:08:58 -0700 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2008-11-24 14:08:58 -0700 |
commit | df6155fcff66034457b3165f5df0a61ccfc41314 (patch) | |
tree | 533a3edc14a84d654ce5dd1f2eb305a42a138991 /src | |
parent | 868c607c1751fc3e6df1a8dc45e8b70e6bc315f6 (diff) | |
parent | b730d0d3e9b202b17a0815cb820fc9905f35cb98 (diff) |
Merge commit 'origin/master' into gallium-0.2
Conflicts:
progs/glsl/Makefile
Diffstat (limited to 'src')
-rw-r--r-- | src/glx/x11/single2.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/windows/gdi/wmesa.c | 2 | ||||
-rw-r--r-- | src/mesa/main/config.h | 2 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 3 | ||||
-rw-r--r-- | src/mesa/shader/prog_execute.h | 6 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_link.c | 42 |
6 files changed, 35 insertions, 21 deletions
diff --git a/src/glx/x11/single2.c b/src/glx/x11/single2.c index b008c6996c..83a2505222 100644 --- a/src/glx/x11/single2.c +++ b/src/glx/x11/single2.c @@ -40,6 +40,7 @@ #ifdef USE_XCB #include <xcb/xcb.h> #include <xcb/glx.h> +#include <X11/Xlib-xcb.h> #endif /* USE_XCB */ diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c index 9dafb74723..1ddea33e35 100644 --- a/src/mesa/drivers/windows/gdi/wmesa.c +++ b/src/mesa/drivers/windows/gdi/wmesa.c @@ -60,7 +60,7 @@ wmesa_free_framebuffer(HDC hdc) FirstFramebuffer = pwfb->next; else prev->next = pwfb->next; - free(pwfb); + _mesa_unreference_framebuffer(&pwfb->Base); } } diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 3b340c476c..e29964a1e8 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -191,6 +191,8 @@ #define MAX_UNIFORMS 128 /**< number of float components */ #define MAX_VARYING 8 /**< number of float[4] vectors */ #define MAX_SAMPLERS 8 +#define MAX_PROGRAM_INPUTS 32 +#define MAX_PROGRAM_OUTPUTS 32 /*@}*/ /** For GL_NV_vertex_program */ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 5e920f7aeb..556b4ed016 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1874,10 +1874,13 @@ struct gl_program GLbitfield InputsRead; /**< Bitmask of which input regs are read */ GLbitfield OutputsWritten; /**< Bitmask of which output regs are written to */ + GLbitfield InputFlags[MAX_PROGRAM_INPUTS]; /**< PROG_PARAM_BIT_x flags */ + GLbitfield OutputFlags[MAX_PROGRAM_OUTPUTS]; /**< PROG_PARAM_BIT_x flags */ GLbitfield TexturesUsed[MAX_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_BIT bitmask */ GLbitfield SamplersUsed; /**< Bitfield of which samplers are used */ GLbitfield ShadowSamplers; /**< Texture units used for shadow sampling. */ + /** Named parameters, constants, etc. from program text */ struct gl_program_parameter_list *Parameters; /** Numbered local parameters */ diff --git a/src/mesa/shader/prog_execute.h b/src/mesa/shader/prog_execute.h index 18b13e11a4..8ceb7b092e 100644 --- a/src/mesa/shader/prog_execute.h +++ b/src/mesa/shader/prog_execute.h @@ -25,6 +25,8 @@ #ifndef PROG_EXECUTE_H #define PROG_EXECUTE_H +#include "main/config.h" + typedef void (*FetchTexelLodFunc)(GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda, GLuint unit, GLfloat color[4]); @@ -36,10 +38,6 @@ typedef void (*FetchTexelDerivFunc)(GLcontext *ctx, const GLfloat texcoord[4], GLuint unit, GLfloat color[4]); -/** The larger of VERT_RESULT_MAX, FRAG_RESULT_MAX */ -#define MAX_PROGRAM_OUTPUTS VERT_RESULT_MAX - - /** * Virtual machine state used during execution of vertex/fragment programs. */ diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index c389d92d59..2cd02d7214 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -89,16 +89,39 @@ bits_agree(GLbitfield flags1, GLbitfield flags2, GLbitfield bit) * Linking varying vars involves rearranging varying vars so that the * vertex program's output varyings matches the order of the fragment * program's input varyings. + * We'll then rewrite instructions to replace PROGRAM_VARYING with either + * PROGRAM_INPUT or PROGRAM_OUTPUT depending on whether it's a vertex or + * fragment shader. + * This is also where we set program Input/OutputFlags to indicate + * which inputs are centroid-sampled, invariant, etc. */ static GLboolean link_varying_vars(struct gl_shader_program *shProg, struct gl_program *prog) { GLuint *map, i, firstVarying, newFile; + GLbitfield *inOutFlags; map = (GLuint *) malloc(prog->Varying->NumParameters * sizeof(GLuint)); if (!map) return GL_FALSE; + /* Varying variables are treated like other vertex program outputs + * (and like other fragment program inputs). The position of the + * first varying differs for vertex/fragment programs... + * Also, replace File=PROGRAM_VARYING with File=PROGRAM_INPUT/OUTPUT. + */ + if (prog->Target == GL_VERTEX_PROGRAM_ARB) { + firstVarying = VERT_RESULT_VAR0; + newFile = PROGRAM_OUTPUT; + inOutFlags = prog->OutputFlags; + } + else { + assert(prog->Target == GL_FRAGMENT_PROGRAM_ARB); + firstVarying = FRAG_ATTRIB_VAR0; + newFile = PROGRAM_INPUT; + inOutFlags = prog->InputFlags; + } + for (i = 0; i < prog->Varying->NumParameters; i++) { /* see if this varying is in the linked varying list */ const struct gl_program_parameter *var = prog->Varying->Parameters + i; @@ -132,12 +155,14 @@ link_varying_vars(struct gl_shader_program *shProg, struct gl_program *prog) var->Flags); } - /* map varying[i] to varying[j]. + /* Map varying[i] to varying[j]. + * Plus, set prog->Input/OutputFlags[] as described above. * Note: the loop here takes care of arrays or large (sz>4) vars. */ { GLint sz = var->Size; while (sz > 0) { + inOutFlags[firstVarying + j] = var->Flags; /*printf("Link varying from %d to %d\n", i, j);*/ map[i++] = j++; sz -= 4; @@ -147,21 +172,6 @@ link_varying_vars(struct gl_shader_program *shProg, struct gl_program *prog) } - /* Varying variables are treated like other vertex program outputs - * (and like other fragment program inputs). The position of the - * first varying differs for vertex/fragment programs... - * Also, replace File=PROGRAM_VARYING with File=PROGRAM_INPUT/OUTPUT. - */ - if (prog->Target == GL_VERTEX_PROGRAM_ARB) { - firstVarying = VERT_RESULT_VAR0; - newFile = PROGRAM_OUTPUT; - } - else { - assert(prog->Target == GL_FRAGMENT_PROGRAM_ARB); - firstVarying = FRAG_ATTRIB_VAR0; - newFile = PROGRAM_INPUT; - } - /* OK, now scan the program/shader instructions looking for varying vars, * replacing the old index with the new index. */ |