mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
VertexLoader: Move the old Datareader function into VertexLoader
This commit is contained in:
parent
21970c4a2a
commit
50de4238bb
@ -14,8 +14,8 @@
|
||||
#include "VideoBackends/Software/SWVertexLoader.h"
|
||||
#include "VideoBackends/Software/SWVideoConfig.h"
|
||||
#include "VideoBackends/Software/XFMemLoader.h"
|
||||
#include "VideoCommon/DataReader.h"
|
||||
#include "VideoCommon/Fifo.h"
|
||||
#include "VideoCommon/VertexLoaderUtils.h"
|
||||
|
||||
typedef void (*DecodingFunction)(u32);
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
#include "VideoBackends/Software/SWCommandProcessor.h"
|
||||
#include "VideoBackends/Software/VideoBackend.h"
|
||||
|
||||
#include "VideoCommon/DataReader.h"
|
||||
#include "VideoCommon/Fifo.h"
|
||||
#include "VideoCommon/VertexLoaderUtils.h"
|
||||
|
||||
namespace SWCommandProcessor
|
||||
{
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "VideoBackends/Software/TransformUnit.h"
|
||||
#include "VideoBackends/Software/XFMemLoader.h"
|
||||
|
||||
#include "VideoCommon/DataReader.h"
|
||||
#include "VideoCommon/VertexLoader.h"
|
||||
#include "VideoCommon/VertexLoader_Color.h"
|
||||
#include "VideoCommon/VertexLoader_Normal.h"
|
||||
|
@ -5,9 +5,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "VideoCommon/VertexManagerBase.h"
|
||||
|
||||
extern u8* g_video_buffer_read_ptr;
|
||||
|
||||
class DataReader
|
||||
{
|
||||
@ -66,86 +63,3 @@ private:
|
||||
u8* __restrict buffer;
|
||||
u8* end;
|
||||
};
|
||||
|
||||
__forceinline void DataSkip(u32 skip)
|
||||
{
|
||||
g_video_buffer_read_ptr += skip;
|
||||
}
|
||||
|
||||
// probably unnecessary
|
||||
template <int count>
|
||||
__forceinline void DataSkip()
|
||||
{
|
||||
g_video_buffer_read_ptr += count;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline T DataPeek(int _uOffset, u8** bufp = &g_video_buffer_read_ptr)
|
||||
{
|
||||
auto const result = Common::FromBigEndian(*reinterpret_cast<T*>(*bufp + _uOffset));
|
||||
return result;
|
||||
}
|
||||
|
||||
// TODO: kill these
|
||||
__forceinline u8 DataPeek8(int _uOffset)
|
||||
{
|
||||
return DataPeek<u8>(_uOffset);
|
||||
}
|
||||
|
||||
__forceinline u16 DataPeek16(int _uOffset)
|
||||
{
|
||||
return DataPeek<u16>(_uOffset);
|
||||
}
|
||||
|
||||
__forceinline u32 DataPeek32(int _uOffset)
|
||||
{
|
||||
return DataPeek<u32>(_uOffset);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline T DataRead(u8** bufp = &g_video_buffer_read_ptr)
|
||||
{
|
||||
auto const result = DataPeek<T>(0, bufp);
|
||||
*bufp += sizeof(T);
|
||||
return result;
|
||||
}
|
||||
|
||||
// TODO: kill these
|
||||
__forceinline u8 DataReadU8()
|
||||
{
|
||||
return DataRead<u8>();
|
||||
}
|
||||
|
||||
__forceinline s8 DataReadS8()
|
||||
{
|
||||
return DataRead<s8>();
|
||||
}
|
||||
|
||||
__forceinline u16 DataReadU16()
|
||||
{
|
||||
return DataRead<u16>();
|
||||
}
|
||||
|
||||
__forceinline u32 DataReadU32()
|
||||
{
|
||||
return DataRead<u32>();
|
||||
}
|
||||
|
||||
__forceinline u32 DataReadU32Unswapped()
|
||||
{
|
||||
u32 tmp = *(u32*)g_video_buffer_read_ptr;
|
||||
g_video_buffer_read_ptr += 4;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
__forceinline u8* DataGetPosition()
|
||||
{
|
||||
return g_video_buffer_read_ptr;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline void DataWrite(T data)
|
||||
{
|
||||
*(T*)VertexManager::s_pCurBufferPointer = data;
|
||||
VertexManager::s_pCurBufferPointer += sizeof(T);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "VideoCommon/CPMemory.h"
|
||||
#include "VideoCommon/DataReader.h"
|
||||
#include "VideoCommon/NativeVertexFormat.h"
|
||||
#include "VideoCommon/VertexLoaderUtils.h"
|
||||
|
||||
#if _M_SSE >= 0x401
|
||||
#include <smmintrin.h>
|
||||
|
93
Source/Core/VideoCommon/VertexLoaderUtils.h
Normal file
93
Source/Core/VideoCommon/VertexLoaderUtils.h
Normal file
@ -0,0 +1,93 @@
|
||||
// Copyright 2014 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "VideoCommon/VertexManagerBase.h"
|
||||
|
||||
extern u8* g_video_buffer_read_ptr;
|
||||
|
||||
|
||||
__forceinline void DataSkip(u32 skip)
|
||||
{
|
||||
g_video_buffer_read_ptr += skip;
|
||||
}
|
||||
|
||||
// probably unnecessary
|
||||
template <int count>
|
||||
__forceinline void DataSkip()
|
||||
{
|
||||
g_video_buffer_read_ptr += count;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline T DataPeek(int _uOffset, u8** bufp = &g_video_buffer_read_ptr)
|
||||
{
|
||||
auto const result = Common::FromBigEndian(*reinterpret_cast<T*>(*bufp + _uOffset));
|
||||
return result;
|
||||
}
|
||||
|
||||
// TODO: kill these
|
||||
__forceinline u8 DataPeek8(int _uOffset)
|
||||
{
|
||||
return DataPeek<u8>(_uOffset);
|
||||
}
|
||||
|
||||
__forceinline u16 DataPeek16(int _uOffset)
|
||||
{
|
||||
return DataPeek<u16>(_uOffset);
|
||||
}
|
||||
|
||||
__forceinline u32 DataPeek32(int _uOffset)
|
||||
{
|
||||
return DataPeek<u32>(_uOffset);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline T DataRead(u8** bufp = &g_video_buffer_read_ptr)
|
||||
{
|
||||
auto const result = DataPeek<T>(0, bufp);
|
||||
*bufp += sizeof(T);
|
||||
return result;
|
||||
}
|
||||
|
||||
// TODO: kill these
|
||||
__forceinline u8 DataReadU8()
|
||||
{
|
||||
return DataRead<u8>();
|
||||
}
|
||||
|
||||
__forceinline s8 DataReadS8()
|
||||
{
|
||||
return DataRead<s8>();
|
||||
}
|
||||
|
||||
__forceinline u16 DataReadU16()
|
||||
{
|
||||
return DataRead<u16>();
|
||||
}
|
||||
|
||||
__forceinline u32 DataReadU32()
|
||||
{
|
||||
return DataRead<u32>();
|
||||
}
|
||||
|
||||
__forceinline u32 DataReadU32Unswapped()
|
||||
{
|
||||
u32 tmp = *(u32*)g_video_buffer_read_ptr;
|
||||
g_video_buffer_read_ptr += 4;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
__forceinline u8* DataGetPosition()
|
||||
{
|
||||
return g_video_buffer_read_ptr;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline void DataWrite(T data)
|
||||
{
|
||||
*(T*)VertexManager::s_pCurBufferPointer = data;
|
||||
VertexManager::s_pCurBufferPointer += sizeof(T);
|
||||
}
|
@ -117,6 +117,7 @@
|
||||
<ClInclude Include="TextureDecoder.h" />
|
||||
<ClInclude Include="VertexLoader.h" />
|
||||
<ClInclude Include="VertexLoaderManager.h" />
|
||||
<ClInclude Include="VertexLoaderUtils.h" />
|
||||
<ClInclude Include="VertexLoader_Color.h" />
|
||||
<ClInclude Include="VertexLoader_Normal.h" />
|
||||
<ClInclude Include="VertexLoader_Position.h" />
|
||||
|
@ -275,6 +275,9 @@
|
||||
<ClInclude Include="VertexLoaderManager.h">
|
||||
<Filter>Vertex Loading</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VertexLoaderUtils.h">
|
||||
<Filter>Vertex Loading</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BoundingBox.h">
|
||||
<Filter>Util</Filter>
|
||||
</ClInclude>
|
||||
|
Loading…
Reference in New Issue
Block a user