summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2009-10-14 11:57:11 -0700
committerIan Romanick <ian.d.romanick@intel.com>2009-10-14 11:57:11 -0700
commitea92bef2898bc3391407702b0843ebb9d5e083fc (patch)
tree5ac8881794eacb11984ad5b276f95d2d893ceb24
parent731ccd5813762be0742afe49aa66ba0efaeba6be (diff)
ARB prog: Refactor code to set native limits to _mesa_init_native_program_limits
This change was suggest by Brian Paul, and this is a nice clean-up.
-rw-r--r--src/mesa/drivers/common/driverfuncs.c14
-rw-r--r--src/mesa/drivers/common/driverfuncs.h4
-rw-r--r--src/mesa/drivers/dri/swrast/swrast.c35
-rw-r--r--src/mesa/drivers/x11/xm_api.c35
4 files changed, 22 insertions, 66 deletions
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 0f8447cb70..a9bfe90568 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -352,3 +352,17 @@ _mesa_init_driver_state(GLcontext *ctx)
ctx->Driver.DrawBuffer(ctx, ctx->Color.DrawBuffer[0]);
}
+
+
+void
+_mesa_init_native_program_limits(struct gl_program_constants *pc)
+{
+ pc->MaxNativeInstructions = pc->MaxInstructions;
+ pc->MaxNativeAluInstructions = pc->MaxAluInstructions;
+ pc->MaxNativeTexInstructions = pc->MaxTexInstructions;
+ pc->MaxNativeTexIndirections = pc->MaxTexIndirections;
+ pc->MaxNativeAttribs = pc->MaxAttribs;
+ pc->MaxNativeTemps = pc->MaxTemps;
+ pc->MaxNativeAddressRegs = pc->MaxAddressRegs;
+ pc->MaxNativeParameters = pc->MaxParameters;
+}
diff --git a/src/mesa/drivers/common/driverfuncs.h b/src/mesa/drivers/common/driverfuncs.h
index 4c90ed12f6..fe527d748f 100644
--- a/src/mesa/drivers/common/driverfuncs.h
+++ b/src/mesa/drivers/common/driverfuncs.h
@@ -34,4 +34,8 @@ extern void
_mesa_init_driver_state(GLcontext *ctx);
+/** Set native fields to value of non-native fields. */
+void
+_mesa_init_native_program_limits(struct gl_program_constants *pc);
+
#endif
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index cd9d234a42..821d54515a 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -652,39 +652,8 @@ driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
_mesa_enable_2_0_extensions(mesaCtx);
_mesa_enable_2_1_extensions(mesaCtx);
- mesaCtx->Const.VertexProgram.MaxNativeInstructions =
- mesaCtx->Const.VertexProgram.MaxInstructions;
- mesaCtx->Const.VertexProgram.MaxNativeAluInstructions =
- mesaCtx->Const.VertexProgram.MaxAluInstructions;
- mesaCtx->Const.VertexProgram.MaxNativeTexInstructions =
- mesaCtx->Const.VertexProgram.MaxTexInstructions;
- mesaCtx->Const.VertexProgram.MaxNativeTexIndirections =
- mesaCtx->Const.VertexProgram.MaxTexIndirections;
- mesaCtx->Const.VertexProgram.MaxNativeAttribs =
- mesaCtx->Const.VertexProgram.MaxAttribs;
- mesaCtx->Const.VertexProgram.MaxNativeTemps =
- mesaCtx->Const.VertexProgram.MaxTemps;
- mesaCtx->Const.VertexProgram.MaxNativeAddressRegs =
- mesaCtx->Const.VertexProgram.MaxAddressRegs;
- mesaCtx->Const.VertexProgram.MaxNativeParameters =
- mesaCtx->Const.VertexProgram.MaxParameters;
-
- mesaCtx->Const.FragmentProgram.MaxNativeInstructions =
- mesaCtx->Const.FragmentProgram.MaxInstructions;
- mesaCtx->Const.FragmentProgram.MaxNativeAluInstructions =
- mesaCtx->Const.FragmentProgram.MaxAluInstructions;
- mesaCtx->Const.FragmentProgram.MaxNativeTexInstructions =
- mesaCtx->Const.FragmentProgram.MaxTexInstructions;
- mesaCtx->Const.FragmentProgram.MaxNativeTexIndirections =
- mesaCtx->Const.FragmentProgram.MaxTexIndirections;
- mesaCtx->Const.FragmentProgram.MaxNativeAttribs =
- mesaCtx->Const.FragmentProgram.MaxAttribs;
- mesaCtx->Const.FragmentProgram.MaxNativeTemps =
- mesaCtx->Const.FragmentProgram.MaxTemps;
- mesaCtx->Const.FragmentProgram.MaxNativeAddressRegs =
- mesaCtx->Const.FragmentProgram.MaxAddressRegs;
- mesaCtx->Const.FragmentProgram.MaxNativeParameters =
- mesaCtx->Const.FragmentProgram.MaxParameters;
+ _mesa_init_native_program_limits(&mesaCtx->Const.VertexProgram);
+ _mesa_init_native_program_limits(&mesaCtx->Const.FragmentProgram);
_mesa_meta_init(mesaCtx);
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index a5b0d62bc1..23812a2c6a 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -1649,39 +1649,8 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
xmesa_register_swrast_functions( mesaCtx );
_swsetup_Wakeup(mesaCtx);
- mesaCtx->Const.VertexProgram.MaxNativeInstructions =
- mesaCtx->Const.VertexProgram.MaxInstructions;
- mesaCtx->Const.VertexProgram.MaxNativeAluInstructions =
- mesaCtx->Const.VertexProgram.MaxAluInstructions;
- mesaCtx->Const.VertexProgram.MaxNativeTexInstructions =
- mesaCtx->Const.VertexProgram.MaxTexInstructions;
- mesaCtx->Const.VertexProgram.MaxNativeTexIndirections =
- mesaCtx->Const.VertexProgram.MaxTexIndirections;
- mesaCtx->Const.VertexProgram.MaxNativeAttribs =
- mesaCtx->Const.VertexProgram.MaxAttribs;
- mesaCtx->Const.VertexProgram.MaxNativeTemps =
- mesaCtx->Const.VertexProgram.MaxTemps;
- mesaCtx->Const.VertexProgram.MaxNativeAddressRegs =
- mesaCtx->Const.VertexProgram.MaxAddressRegs;
- mesaCtx->Const.VertexProgram.MaxNativeParameters =
- mesaCtx->Const.VertexProgram.MaxParameters;
-
- mesaCtx->Const.FragmentProgram.MaxNativeInstructions =
- mesaCtx->Const.FragmentProgram.MaxInstructions;
- mesaCtx->Const.FragmentProgram.MaxNativeAluInstructions =
- mesaCtx->Const.FragmentProgram.MaxAluInstructions;
- mesaCtx->Const.FragmentProgram.MaxNativeTexInstructions =
- mesaCtx->Const.FragmentProgram.MaxTexInstructions;
- mesaCtx->Const.FragmentProgram.MaxNativeTexIndirections =
- mesaCtx->Const.FragmentProgram.MaxTexIndirections;
- mesaCtx->Const.FragmentProgram.MaxNativeAttribs =
- mesaCtx->Const.FragmentProgram.MaxAttribs;
- mesaCtx->Const.FragmentProgram.MaxNativeTemps =
- mesaCtx->Const.FragmentProgram.MaxTemps;
- mesaCtx->Const.FragmentProgram.MaxNativeAddressRegs =
- mesaCtx->Const.FragmentProgram.MaxAddressRegs;
- mesaCtx->Const.FragmentProgram.MaxNativeParameters =
- mesaCtx->Const.FragmentProgram.MaxParameters;
+ _mesa_init_native_program_limits(&mesaCtx->Const.VertexProgram);
+ _mesa_init_native_program_limits(&mesaCtx->Const.FragmentProgram);
_mesa_meta_init(mesaCtx);