1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-06-25 05:49:34 +00:00

Move CombinerKey class to separate files.

This commit is contained in:
Sergey Lipskiy 2017-01-03 13:37:50 +07:00
parent 6356b1cb7a
commit 19f5f8b302
6 changed files with 80 additions and 67 deletions

View File

@ -270,6 +270,7 @@
<ClCompile Include="..\..\src\BufferCopy\DepthBufferToRDRAM.cpp" />
<ClCompile Include="..\..\src\BufferCopy\RDRAMtoColorBuffer.cpp" />
<ClCompile Include="..\..\src\Combiner.cpp" />
<ClCompile Include="..\..\src\CombinerKey.cpp" />
<ClCompile Include="..\..\src\CommonPluginAPI.cpp" />
<ClCompile Include="..\..\src\common\CommonAPIImpl_common.cpp" />
<ClCompile Include="..\..\src\Config.cpp" />
@ -395,6 +396,7 @@
<ClInclude Include="..\..\src\BufferCopy\RDRAMtoColorBuffer.h" />
<ClInclude Include="..\..\src\BufferCopy\WriteToRDRAM.h" />
<ClInclude Include="..\..\src\Combiner.h" />
<ClInclude Include="..\..\src\CombinerKey.h" />
<ClInclude Include="..\..\src\common\GLFunctions.h" />
<ClInclude Include="..\..\src\Config.h" />
<ClInclude Include="..\..\src\convert.h" />

View File

@ -296,6 +296,9 @@
<ClCompile Include="..\..\src\Graphics\OpenGLContext\opengl_BufferManipulationObjectFactory.cpp">
<Filter>Source Files\Graphics\OpenGL</Filter>
</ClCompile>
<ClCompile Include="..\..\src\CombinerKey.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\3DMath.h">
@ -541,5 +544,8 @@
<ClInclude Include="..\..\src\Graphics\OpenGLContext\opengl_BufferManipulationObjectFactory.h">
<Filter>Header Files\Graphics\OpenGL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\CombinerKey.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -90,53 +90,6 @@ void Combiner_Destroy() {
CombinerInfo::get().destroy();
}
/*---------------CombinerKey-------------*/
CombinerKey::CombinerKey(u64 _mux)
{
m_key.mux = _mux;
// High byte of muxs0 is zero. We can use it for addtional combiner flags:
// [0 - 0] polygon type: 0 - triangle, 1 - rect
// [1 - 2] cycle type
u32 flags = CombinerInfo::get().isRectMode() ? 1U : 0U;
flags |= (gDP.otherMode.cycleType << 1);
m_key.muxs0 |= (flags << 24);
}
CombinerKey::CombinerKey(const CombinerKey & _other)
{
m_key.mux = _other.m_key.mux;
}
void CombinerKey::operator=(u64 _mux)
{
m_key.mux = _mux;
}
void CombinerKey::operator=(const CombinerKey & _other)
{
m_key.mux = _other.m_key.mux;
}
bool CombinerKey::operator==(const CombinerKey & _other) const
{
return m_key.mux == _other.m_key.mux;
}
bool CombinerKey::operator<(const CombinerKey & _other) const
{
return m_key.mux < _other.m_key.mux;
}
bool CombinerKey::isRectKey() const
{
// return ((m_key.muxs0 >> 24) & 1) != 0;
bool res = ((m_key.muxs0 >> 24) & 1) != 0;
return res;
}
/*---------------CombinerInfo-------------*/
CombinerInfo & CombinerInfo::get()

View File

@ -6,7 +6,7 @@
#include "GLideN64.h"
#include "OpenGL.h"
#include "gDP.h"
#include "Types.h"
#include "CombinerKey.h"
/*
* G_SETCOMBINE: color combine modes
@ -114,25 +114,6 @@ struct CombineCycle
int sa, sb, m, a;
};
class CombinerKey {
public:
CombinerKey() = default;
explicit CombinerKey(u64 _mux);
CombinerKey(const CombinerKey & _other);
void operator=(u64 _mux);
void operator=(const CombinerKey & _other);
bool operator==(const CombinerKey & _other) const;
bool operator<(const CombinerKey & _other) const;
bool isRectKey() const;
u64 getMux() const { return m_key.mux; }
private:
gDPCombine m_key;
};
class ShaderCombiner;
class UniformCollection;
class CombinerInfo

50
src/CombinerKey.cpp Normal file
View File

@ -0,0 +1,50 @@
#include "Combiner.h"
#include "CombinerKey.h"
/*---------------CombinerKey-------------*/
CombinerKey::CombinerKey(u64 _mux)
{
m_key.mux = _mux;
// High byte of muxs0 is zero. We can use it for addtional combiner flags:
// [0 - 0] polygon type: 0 - triangle, 1 - rect
// [1 - 2] cycle type
u32 flags = CombinerInfo::get().isRectMode() ? 1U : 0U;
flags |= (gDP.otherMode.cycleType << 1);
m_key.muxs0 |= (flags << 24);
}
CombinerKey::CombinerKey(const CombinerKey & _other)
{
m_key.mux = _other.m_key.mux;
}
void CombinerKey::operator=(u64 _mux)
{
m_key.mux = _mux;
}
void CombinerKey::operator=(const CombinerKey & _other)
{
m_key.mux = _other.m_key.mux;
}
bool CombinerKey::operator==(const CombinerKey & _other) const
{
return m_key.mux == _other.m_key.mux;
}
bool CombinerKey::operator<(const CombinerKey & _other) const
{
return m_key.mux < _other.m_key.mux;
}
bool CombinerKey::isRectKey() const
{
// return ((m_key.muxs0 >> 24) & 1) != 0;
bool res = ((m_key.muxs0 >> 24) & 1) != 0;
return res;
}

21
src/CombinerKey.h Normal file
View File

@ -0,0 +1,21 @@
#pragma once
#include "gDP.h"
class CombinerKey {
public:
CombinerKey() = default;
explicit CombinerKey(u64 _mux);
CombinerKey(const CombinerKey & _other);
void operator=(u64 _mux);
void operator=(const CombinerKey & _other);
bool operator==(const CombinerKey & _other) const;
bool operator<(const CombinerKey & _other) const;
bool isRectKey() const;
u64 getMux() const { return m_key.mux; }
private:
gDPCombine m_key;
};