summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorNeoBrainX <NeoBrainX@gmail.com>2013-07-02 14:32:52 +0200
committerNeoBrainX <NeoBrainX@gmail.com>2013-07-02 14:48:08 +0200
commit1f92ccc228bcb97893598ca1788fb2f459a078c0 (patch)
tree0059627c7fc8a85cb840cfa0b12a7381ede1ac42 /Source/Core/VideoCommon
parentde369dcc607a62320994ee77d61c071e0393ce1b (diff)
ShaderGen: Use u8 as uid storage base type. Fixes an off-by-one error introduced in revision bdc28106eed0 that caused some lighting issues.
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/Src/PixelShaderGen.cpp2
-rw-r--r--Source/Core/VideoCommon/Src/ShaderGenCommon.h4
-rw-r--r--Source/Core/VideoCommon/Src/VertexShaderGen.cpp2
-rw-r--r--Source/Core/VideoCommon/Src/VertexShaderGen.h4
4 files changed, 4 insertions, 8 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
index 1c10459160..cf0dc8e959 100644
--- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
@@ -537,7 +537,7 @@ static void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_TYPE Api
#define MY_STRUCT_OFFSET(str,elem) ((u32)((u64)&(str).elem-(u64)&(str)))
bool enable_pl = g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting;
- uid_data.num_values = (enable_pl) ? sizeof(uid_data)/sizeof(32) : MY_STRUCT_OFFSET(uid_data,stagehash[numStages])/sizeof(u32);
+ uid_data.num_values = (enable_pl) ? sizeof(uid_data) : MY_STRUCT_OFFSET(uid_data,stagehash[numStages]);
if (numStages)
diff --git a/Source/Core/VideoCommon/Src/ShaderGenCommon.h b/Source/Core/VideoCommon/Src/ShaderGenCommon.h
index c8f8ff8345..ec4fe27416 100644
--- a/Source/Core/VideoCommon/Src/ShaderGenCommon.h
+++ b/Source/Core/VideoCommon/Src/ShaderGenCommon.h
@@ -120,7 +120,7 @@ private:
union
{
uid_data data;
- u32 values[sizeof(uid_data) / sizeof(u32)];
+ u8 values[sizeof(uid_data)];
};
};
@@ -212,7 +212,7 @@ struct LightingUidData
u32 attnfunc : 8; // 4x2 bits
u32 light_mask : 32; // 4x8 bits
- u32 NumValues() const { return sizeof(LightingUidData) / sizeof(u32); }
+ u32 NumValues() const { return sizeof(LightingUidData); }
};
#pragma pack()
diff --git a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp
index 63b752b838..a682b4ea21 100644
--- a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp
+++ b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp
@@ -74,8 +74,6 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
vertex_shader_uid_data& uid_data = (&out.template GetUidData<vertex_shader_uid_data>() != NULL)
? out.template GetUidData<vertex_shader_uid_data>() : dummy_data;
- uid_data.num_values = sizeof(uid_data)/sizeof(u32);
-
out.SetBuffer(text);
#ifndef ANDROID
locale_t locale;
diff --git a/Source/Core/VideoCommon/Src/VertexShaderGen.h b/Source/Core/VideoCommon/Src/VertexShaderGen.h
index a28f4758fa..eef0646e6f 100644
--- a/Source/Core/VideoCommon/Src/VertexShaderGen.h
+++ b/Source/Core/VideoCommon/Src/VertexShaderGen.h
@@ -67,11 +67,9 @@ const s_svar VSVar_Loc[] = { {I_POSNORMALMATRIX, C_POSNORMALMATRIX, 6 },
struct vertex_shader_uid_data
{
-
- u32 NumValues() const { return num_values; }
+ u32 NumValues() const { return sizeof(vertex_shader_uid_data); }
u32 components;
- u32 num_values : 16; // TODO: u8 might be enough, actually
u32 numColorChans : 2;
u32 numTexGens : 4;