From 3e8efc3753e0aa248ba91f42a05a8794e4343f3d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 20 Jul 2005 23:24:55 +0000 Subject: [PATCH] Clean up warnings in r300 code by making some symbols static, adding prototypes for others, and being cleaner with types in fragment/vertex program structures. One warning in r300_shader.c is still concerning. --- src/mesa/drivers/dri/r300/Makefile | 2 +- src/mesa/drivers/dri/r300/r300_context.c | 5 +++-- src/mesa/drivers/dri/r300/r300_context.h | 1 + src/mesa/drivers/dri/r300/r300_fragprog.c | 5 +++-- src/mesa/drivers/dri/r300/r300_fragprog.h | 4 +++- src/mesa/drivers/dri/r300/r300_program.h | 3 +++ src/mesa/drivers/dri/r300/r300_render.c | 9 ++++++--- src/mesa/drivers/dri/r300/r300_shader.c | 4 ++-- src/mesa/drivers/dri/r300/r300_state.c | 13 +++++++------ src/mesa/drivers/dri/r300/r300_state.h | 5 +++++ src/mesa/drivers/dri/r300/r300_vertexprog.c | 3 ++- 11 files changed, 36 insertions(+), 18 deletions(-) diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile index 520b395997e..42197324744 100644 --- a/src/mesa/drivers/dri/r300/Makefile +++ b/src/mesa/drivers/dri/r300/Makefile @@ -5,7 +5,7 @@ TOP = ../../../../.. include $(TOP)/configs/current LIBNAME = r300_dri.so -DEFINES += -DCOMPILE_R300 -DGLX_DIRECT_RENDERING +DEFINES += -DCOMPILE_R300 -DGLX_DIRECT_RENDERING -DR200_MERGED=0 MINIGLX_SOURCES = server/radeon_dri.c diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 7dedf2f5e4f..9100ac2565b 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -40,6 +40,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "matrix.h" #include "extensions.h" #include "state.h" +#include "bufferobj.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" @@ -191,7 +192,7 @@ static const struct tnl_pipeline_stage *r300_pipeline[] = { 0, }; -void r300BufferData(GLcontext *ctx, GLenum target, GLsizeiptrARB size, +static void r300BufferData(GLcontext *ctx, GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage, struct gl_buffer_object *obj) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -239,7 +240,7 @@ void r300BufferData(GLcontext *ctx, GLenum target, GLsizeiptrARB size, #endif } -void r300DeleteBuffer(GLcontext *ctx, struct gl_buffer_object *obj) +static void r300DeleteBuffer(GLcontext *ctx, struct gl_buffer_object *obj) { r300ContextPtr rmesa = R300_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 7b575bd4d00..b59f184e38f 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -80,6 +80,7 @@ typedef struct r300_context *r300ContextPtr; typedef GLuint uint32_t; typedef GLubyte uint8_t; +struct r300_fragment_program; /* We should probably change types within vertex_shader and pixel_shader structure later on */ diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index 19dab8f84b6..f43b50e34df 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -46,6 +46,7 @@ #include "glheader.h" #include "macros.h" #include "enums.h" +#include "arbfragparse.h" #include "program.h" #include "nvfragprog.h" @@ -905,7 +906,7 @@ static GLboolean parse_program(struct r300_fragment_program *rp) /* - Init structures * - Determine what hwregs each input corresponds to */ -void init_program(struct r300_fragment_program *rp) +static void init_program(struct r300_fragment_program *rp) { struct fragment_program *mp = &rp->mesa_program; struct fp_instruction *fpi; @@ -1003,7 +1004,7 @@ void init_program(struct r300_fragment_program *rp) rp->temp_in_use = temps_used; } -void update_params(struct r300_fragment_program *rp) { +static void update_params(struct r300_fragment_program *rp) { struct fragment_program *mp = &rp->mesa_program; int i; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.h b/src/mesa/drivers/dri/r300/r300_fragprog.h index b60f6743352..ed318eb6a75 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.h +++ b/src/mesa/drivers/dri/r300/r300_fragprog.h @@ -43,5 +43,7 @@ typedef struct _pfs_reg_t { #define PFS_FLAG_SAT (1 << 0) #define PFS_FLAG_ABS (1 << 1) -#endif +extern void translate_fragment_shader(struct r300_fragment_program *rp); + +#endif /* __R300_FRAGPROG_H_ */ diff --git a/src/mesa/drivers/dri/r300/r300_program.h b/src/mesa/drivers/dri/r300/r300_program.h index b78ac17d223..d1754c06653 100644 --- a/src/mesa/drivers/dri/r300/r300_program.h +++ b/src/mesa/drivers/dri/r300/r300_program.h @@ -145,4 +145,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ((arg1) << R300_FPI2_ARG1A_SHIFT) | \ ((arg2) << R300_FPI2_ARG2A_SHIFT)) +extern void debug_vp(GLcontext *ctx, struct vertex_program *vp); +extern void dump_program_params(GLcontext *ctx, struct vertex_program *vp); + #endif /* __R300_PROGRAM_H__ */ diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index 047a63e2866..a0769e27f89 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -44,6 +44,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "swrast_setup/swrast_setup.h" #include "array_cache/acache.h" #include "tnl/tnl.h" +#include "tnl/t_vp_build.h" #include "radeon_reg.h" #include "radeon_macros.h" @@ -646,7 +647,9 @@ static void dtr(struct tnl_pipeline_stage *stage) (void)stage; } -GLboolean r300_create_render(GLcontext *ctx, struct tnl_pipeline_stage *stage){ +static GLboolean r300_create_render(GLcontext *ctx, + struct tnl_pipeline_stage *stage) +{ return GL_TRUE; } @@ -678,12 +681,12 @@ static GLboolean r300_run_tcl_render(GLcontext *ctx, if(ctx->VertexProgram._Enabled == GL_FALSE){ _tnl_UpdateFixedFunctionProgram(ctx); } - vp = CURRENT_VERTEX_SHADER(ctx); + vp = (struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx); if(vp->translated == GL_FALSE) translate_vertex_shader(vp); if(vp->translated == GL_FALSE){ fprintf(stderr, "Failing back to sw-tcl\n"); - debug_vp(ctx, vp); + debug_vp(ctx, &vp->mesa_program); hw_tcl_on=future_hw_tcl_on=0; r300ResetHwState(rmesa); return GL_TRUE; diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c index 0613dd887fb..9c6788ec3e3 100644 --- a/src/mesa/drivers/dri/r300/r300_shader.c +++ b/src/mesa/drivers/dri/r300/r300_shader.c @@ -71,8 +71,8 @@ static void r300DeleteProgram(GLcontext *ctx, struct program *prog) _mesa_delete_program(ctx, prog); } - -void r300ProgramStringNotify(GLcontext *ctx, GLenum target, + +static void r300ProgramStringNotify(GLcontext *ctx, GLenum target, struct program *prog) { struct r300_vertex_program *vp=(void *)prog; diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 2280be36560..b6a03a22743 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -832,7 +832,7 @@ static void r300ClearStencil(GLcontext * ctx, GLint s) #define SUBPIXEL_X 0.125 #define SUBPIXEL_Y 0.125 -void r300UpdateWindow(GLcontext * ctx) +static void r300UpdateWindow(GLcontext * ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); __DRIdrawablePrivate *dPriv = rmesa->radeon.dri.drawable; @@ -1326,7 +1326,7 @@ void r300SetupVertexProgram(r300ContextPtr rmesa); while leaving colors intact. Nothing fancy (like lights) If implementing lights make a copy first, so it is easy to switch between the two versions */ -void r300GenerateSimpleVertexShader(r300ContextPtr r300) +static void r300GenerateSimpleVertexShader(r300ContextPtr r300) { int i; GLuint o_reg = 0; @@ -1559,7 +1559,7 @@ void r300SetupVertexProgram(r300ContextPtr rmesa) * But it works for most things. I'll fix it later if someone * else with a better clue doesn't */ -unsigned int r300PackFloat24(float f) +static unsigned int r300PackFloat24(float f) { float mantissa; int exponent; @@ -1587,13 +1587,14 @@ unsigned int r300PackFloat24(float f) void r300SetupPixelShader(r300ContextPtr rmesa) { GLcontext *ctx = rmesa->radeon.glCtx; - struct r300_fragment_program *rp = ctx->FragmentProgram._Current; + struct r300_fragment_program *rp = + (struct r300_fragment_program *)ctx->FragmentProgram._Current; int i,k; if (!rp) /* should only happenen once, just after context is created */ return; - translate_fragment_shader(ctx->FragmentProgram._Current); + translate_fragment_shader(rp); if (!rp->translated) { fprintf(stderr, "%s: No valid fragment shader, exiting\n", __func__); exit(-1); @@ -1849,7 +1850,7 @@ static void r300InvalidateState(GLcontext * ctx, GLuint new_state) /* Checks that r300ResetHwState actually modifies all states. Should probably be burried in somewhere else as this file is getting longish. */ -void verify_r300ResetHwState(r300ContextPtr r300, int stage) +static void verify_r300ResetHwState(r300ContextPtr r300, int stage) { struct r300_state_atom* atom; int i; diff --git a/src/mesa/drivers/dri/r300/r300_state.h b/src/mesa/drivers/dri/r300/r300_state.h index c161978e5ad..131834fa782 100644 --- a/src/mesa/drivers/dri/r300/r300_state.h +++ b/src/mesa/drivers/dri/r300/r300_state.h @@ -60,5 +60,10 @@ extern void r300ResetHwState(r300ContextPtr r300); extern void r300InitState(r300ContextPtr r300); extern void r300InitStateFuncs(struct dd_function_table* functions); +extern void r300SetupVertexShader(r300ContextPtr rmesa); +extern void r300SetupPixelShader(r300ContextPtr rmesa); + +extern void r300_setup_textures(GLcontext *ctx); +extern void r300_setup_rs_unit(GLcontext *ctx); #endif /* __R300_STATE_H__ */ diff --git a/src/mesa/drivers/dri/r300/r300_vertexprog.c b/src/mesa/drivers/dri/r300/r300_vertexprog.c index 178ca7635dc..717832048cf 100644 --- a/src/mesa/drivers/dri/r300/r300_vertexprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertexprog.c @@ -35,6 +35,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "program.h" #include "r300_context.h" +#include "r300_program.h" #include "nvvertprog.h" #define SCALAR_FLAG (1<<31) @@ -365,7 +366,7 @@ static unsigned long t_swizzle(GLubyte swizzle) } } -void vp_dump_inputs(struct r300_vertex_program *vp, char *caller) +static void vp_dump_inputs(struct r300_vertex_program *vp, char *caller) { int i; -- 2.30.2