Finishing touches.
This commit is contained in:
parent
ba310ce096
commit
166a9c5637
|
@ -11,7 +11,6 @@ set(SRCS Src/BPFunctions.cpp
|
|||
Src/HiresTextures.cpp
|
||||
Src/ImageWrite.cpp
|
||||
Src/IndexGenerator.cpp
|
||||
Src/LightingShaderGen.cpp
|
||||
Src/MainBase.cpp
|
||||
Src/OnScreenDisplay.cpp
|
||||
Src/OpcodeDecoding.cpp
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
// Copyright 2013 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "LightingShaderGen.h"
|
||||
#include "NativeVertexFormat.h"
|
||||
#include "XFMemory.h"
|
|
@ -55,14 +55,13 @@ const s_svar PSVar_Loc[] = { {I_COLORS, C_COLORS, 4 },
|
|||
{I_PMATERIALS, C_PMATERIALS, 4 },
|
||||
};
|
||||
|
||||
// TODO: Should compact packing be enabled?
|
||||
//#pragma pack(4)
|
||||
#pragma pack(1)
|
||||
struct pixel_shader_uid_data
|
||||
{
|
||||
// TODO: Optimize field order for easy access!
|
||||
|
||||
u32 num_values; // TODO: Shouldn't be a u32
|
||||
u32 NumValues() const { return num_values; } // TODO: Can be optimized :)
|
||||
u32 NumValues() const { return num_values; }
|
||||
|
||||
u32 components;
|
||||
u32 dstAlphaMode : 2;
|
||||
|
@ -117,6 +116,7 @@ struct pixel_shader_uid_data
|
|||
u32 xfregs_numTexGen_numTexGens : 4;
|
||||
|
||||
struct {
|
||||
// TODO: Can save a lot space by removing the padding bits
|
||||
u32 cc : 24;
|
||||
u32 ac : 24;
|
||||
|
||||
|
@ -147,7 +147,7 @@ struct pixel_shader_uid_data
|
|||
// TODO: I think we're fine without an enablePixelLighting field, should probably double check, though..
|
||||
LightingUidData lighting;
|
||||
};
|
||||
//#pragma pack()
|
||||
#pragma pack()
|
||||
|
||||
typedef ShaderUid<pixel_shader_uid_data> PixelShaderUid;
|
||||
typedef ShaderCode PixelShaderCode; // TODO: Obsolete
|
||||
|
|
|
@ -199,10 +199,9 @@ static void DeclareUniform(T& object, API_TYPE api_type, bool using_ubos, const
|
|||
object.Write(";\n");
|
||||
}
|
||||
|
||||
#pragma pack(4)
|
||||
#pragma pack(1)
|
||||
/**
|
||||
* Common uid data used for shader generators that use lighting calculations.
|
||||
* Expected to be stored as a member called "lighting".
|
||||
*/
|
||||
struct LightingUidData
|
||||
{
|
||||
|
|
|
@ -401,7 +401,7 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
|
|||
{
|
||||
const PostMtxInfo& postInfo = xfregs.postMtxInfo[i];
|
||||
|
||||
uid_data.postMtxInfo[i] = xfregs.postMtxInfo[i].index;
|
||||
uid_data.postMtxInfo[i].index = xfregs.postMtxInfo[i].index;
|
||||
int postidx = postInfo.index;
|
||||
out.Write("float4 P0 = " I_POSTTRANSFORMMATRICES"[%d];\n"
|
||||
"float4 P1 = " I_POSTTRANSFORMMATRICES"[%d];\n"
|
||||
|
@ -419,7 +419,7 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
|
|||
}
|
||||
else
|
||||
{
|
||||
uid_data.postMtxInfo[i] |= xfregs.postMtxInfo[i].normalize << 6;
|
||||
uid_data.postMtxInfo[i].normalize = xfregs.postMtxInfo[i].normalize;
|
||||
if (postInfo.normalize)
|
||||
out.Write("o.tex%d.xyz = normalize(o.tex%d.xyz);\n", i, i);
|
||||
|
||||
|
|
|
@ -71,22 +71,26 @@ struct vertex_shader_uid_data
|
|||
u32 NumValues() const { return num_values; }
|
||||
|
||||
u32 components;
|
||||
u32 num_values : 16; // TODO: Shouldn't be a u32
|
||||
u32 num_values : 16; // TODO: u8 might be enough, actually
|
||||
u32 numColorChans : 2;
|
||||
u32 numTexGens : 4;
|
||||
|
||||
u32 dualTexTrans_enabled : 1;
|
||||
|
||||
u32 texMtxInfo_n_projection : 16; // XF_TEXPROJ_X
|
||||
u32 texMtxInfo_n_projection : 16; // Stored separately to guarantee that the texMtxInfo struct is 8 bits wide
|
||||
struct {
|
||||
u32 inputform : 2; // XF_TEXINPUT_X
|
||||
u32 texgentype : 3; // XF_TEXGEN_X
|
||||
u32 sourcerow : 5; // XF_SRCGEOM_X
|
||||
u32 embosssourceshift : 3; // what generated texcoord to use
|
||||
u32 embosslightshift : 3; // light index that is used
|
||||
} texMtxInfo[8]; // TODO: Wasting space
|
||||
u32 inputform : 2;
|
||||
u32 texgentype : 3;
|
||||
u32 sourcerow : 5;
|
||||
u32 embosssourceshift : 3;
|
||||
u32 embosslightshift : 3;
|
||||
} texMtxInfo[8];
|
||||
|
||||
u8 postMtxInfo[8]; // index + normalize + 1 padding bit, TODO: Can be made a struct again..
|
||||
struct {
|
||||
u32 index : 6;
|
||||
u32 normalize : 1;
|
||||
u32 pad : 1;
|
||||
} postMtxInfo[8];
|
||||
|
||||
LightingUidData lighting;
|
||||
};
|
||||
|
|
|
@ -190,7 +190,6 @@
|
|||
<ClCompile Include="Src\HiresTextures.cpp" />
|
||||
<ClCompile Include="Src\ImageWrite.cpp" />
|
||||
<ClCompile Include="Src\IndexGenerator.cpp" />
|
||||
<ClCompile Include="Src\LightingShaderGen.cpp" />
|
||||
<ClCompile Include="Src\MainBase.cpp" />
|
||||
<ClCompile Include="Src\memcpy_amd.cpp" />
|
||||
<ClCompile Include="Src\OnScreenDisplay.cpp" />
|
||||
|
|
|
@ -113,9 +113,6 @@
|
|||
<ClCompile Include="Src\VertexManagerBase.cpp">
|
||||
<Filter>Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Src\LightingShaderGen.cpp">
|
||||
<Filter>Shader Generators</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Src\FPSCounter.cpp">
|
||||
<Filter>Util</Filter>
|
||||
</ClCompile>
|
||||
|
@ -294,4 +291,4 @@
|
|||
<UniqueIdentifier>{e2a527a2-ccc8-4ab8-a93e-dd2628c0f3b6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
Loading…
Reference in New Issue