From 060bd3035e3fc08f82bd51919b084adc7df60f6d Mon Sep 17 00:00:00 2001 From: kaetemi Date: Mon, 9 Sep 2013 01:53:02 +0200 Subject: [PATCH] Builtin parameter set functions --- code/nel/include/nel/3d/driver.h | 12 ++++++++---- code/nel/include/nel/3d/gpu_program_params.h | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/code/nel/include/nel/3d/driver.h b/code/nel/include/nel/3d/driver.h index 3e6b1e856..540b17962 100644 --- a/code/nel/include/nel/3d/driver.h +++ b/code/nel/include/nel/3d/driver.h @@ -1125,6 +1125,9 @@ public: virtual void setVertexProgram4f(uint index, const NLMISC::CVector& v, float f3) = 0; virtual void setVertexProgram4x4f(uint index, const NLMISC::CMatrix& m) = 0; virtual void setVertexProgram4fv(uint index, size_t num, const float *src) = 0; + // Set builtin parameters + virtual void setVertexProgramMatrix(uint index, TMatrix matrix, TTransform transform) = 0; + virtual void setVertexProgramFog(uint index) = 0; // @} @@ -1168,6 +1171,9 @@ public: virtual void setPixelProgram4f(uint index, const NLMISC::CVector& v, float f3) = 0; virtual void setPixelProgram4x4f(uint index, const NLMISC::CMatrix& m) = 0; virtual void setPixelProgram4fv(uint index, size_t num, const float *src) = 0; + // Set builtin parameters + virtual void setPixelProgramMatrix(uint index, TMatrix matrix, TTransform transform) = 0; + virtual void setPixelProgramFog(uint index) = 0; // @} @@ -1183,8 +1189,6 @@ public: inline void setConstant(uint index, const NLMISC::CVectorD &value) { setVertexProgram4f(index, (float)value.x, (float)value.y, (float)value.z, 0.f); } /// setup several 4 float csts taken from the given tab inline void setConstant(uint index, uint num, const float *src) { setVertexProgram4fv(index, num, src); } - /// setup several 4 double csts taken from the given tab (convert to float) - virtual void setConstant(uint index, uint num, const double *src) = 0; /** * Setup constants with a current matrix. @@ -1197,7 +1201,7 @@ public: * \param transform is the transformation to apply to the matrix before store it in the constants. * */ - virtual void setConstantMatrix(uint index, TMatrix matrix, TTransform transform) = 0; + inline void setConstantMatrix(uint index, TMatrix matrix, TTransform transform) { setVertexProgramMatrix(index, matrix, transform); }; /** * Setup the constant with the fog vector. This vector must be used to get the final fog value in a vertex shader. @@ -1211,7 +1215,7 @@ public: * \param index is the index where to store the vector. * */ - virtual void setConstantFog(uint index) = 0; + inline void setConstantFog(uint index) { setVertexProgramFog(index); }; // @} diff --git a/code/nel/include/nel/3d/gpu_program_params.h b/code/nel/include/nel/3d/gpu_program_params.h index ce454b2ed..270c6cff5 100644 --- a/code/nel/include/nel/3d/gpu_program_params.h +++ b/code/nel/include/nel/3d/gpu_program_params.h @@ -52,6 +52,9 @@ namespace NL3D { * Allows for fast updating and iteration of parameters. * NOTE TO DRIVER IMPLEMENTORS: DO NOT USE FOR STORING COPIES * OF HARDCODED DRIVER MATERIAL PARAMETERS OR DRIVER PARAMETERS!!! + * The 4-component alignment that is done in this storage + * class is necessary to simplify support for register-based + * assembly shaders, which require setting per 4 components. */ class CGPUProgramParams {