From 175707739e60c9c3ac593689e9e786e73514bedb Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Wed, 4 Sep 2013 21:47:21 +0200 Subject: [PATCH] Move LightingUidData to the LightingShaderGen header --- Source/Core/VideoCommon/Src/LightingShaderGen.h | 13 +++++++++++++ Source/Core/VideoCommon/Src/PixelShaderGen.h | 1 + Source/Core/VideoCommon/Src/ShaderGenCommon.h | 17 ----------------- Source/Core/VideoCommon/Src/VertexShaderGen.h | 1 + 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Source/Core/VideoCommon/Src/LightingShaderGen.h b/Source/Core/VideoCommon/Src/LightingShaderGen.h index fc107a2e2b..09b2dfd257 100644 --- a/Source/Core/VideoCommon/Src/LightingShaderGen.h +++ b/Source/Core/VideoCommon/Src/LightingShaderGen.h @@ -25,6 +25,19 @@ #define LIGHT_DIR "%s[5*%d+4]" #define LIGHT_DIR_PARAMS(lightsName, index) (lightsName), (index) +/** + * Common uid data used for shader generators that use lighting calculations. + */ +struct LightingUidData +{ + u32 matsource : 4; // 4x1 bit + u32 enablelighting : 4; // 4x1 bit + u32 ambsource : 4; // 4x1 bit + u32 diffusefunc : 8; // 4x2 bits + u32 attnfunc : 8; // 4x2 bits + u32 light_mask : 32; // 4x8 bits +}; + template static void GenerateLightShader(T& object, LightingUidData& uid_data, int index, int litchan_index, const char* lightsName, int coloralpha) diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.h b/Source/Core/VideoCommon/Src/PixelShaderGen.h index 7763cbd574..5fbf28cd69 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.h +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.h @@ -8,6 +8,7 @@ #include "VideoCommon.h" #include "ShaderGenCommon.h" #include "BPMemory.h" +#include "LightingShaderGen.h" #define I_COLORS "color" #define I_KCOLORS "k" diff --git a/Source/Core/VideoCommon/Src/ShaderGenCommon.h b/Source/Core/VideoCommon/Src/ShaderGenCommon.h index a804c08f13..d2c8ec3710 100644 --- a/Source/Core/VideoCommon/Src/ShaderGenCommon.h +++ b/Source/Core/VideoCommon/Src/ShaderGenCommon.h @@ -199,23 +199,6 @@ static inline void DeclareUniform(T& object, API_TYPE api_type, bool using_ubos, object.Write(";\n"); } -#pragma pack(1) -/** - * Common uid data used for shader generators that use lighting calculations. - */ -struct LightingUidData -{ - u32 matsource : 4; // 4x1 bit - u32 enablelighting : 4; // 4x1 bit - u32 ambsource : 4; // 4x1 bit - u32 diffusefunc : 8; // 4x2 bits - u32 attnfunc : 8; // 4x2 bits - u32 light_mask : 32; // 4x8 bits - - u32 NumValues() const { return sizeof(LightingUidData); } -}; -#pragma pack() - /** * Checks if there has been */ diff --git a/Source/Core/VideoCommon/Src/VertexShaderGen.h b/Source/Core/VideoCommon/Src/VertexShaderGen.h index ab9a378107..0ec703c07f 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderGen.h +++ b/Source/Core/VideoCommon/Src/VertexShaderGen.h @@ -9,6 +9,7 @@ #include "XFMemory.h" #include "VideoCommon.h" #include "ShaderGenCommon.h" +#include "LightingShaderGen.h" // TODO should be reordered #define SHADER_POSITION_ATTRIB 0