Decouple <cstdint>
This commit is contained in:
+17
-16
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <list>
|
||||
|
||||
// Globals
|
||||
@@ -45,13 +46,13 @@ const D3DFORMAT g_DefaultAdapterFormat = D3DFMT_X8R8G8B8;
|
||||
/* Direct3D doesn't associate a palette with textures. Instead, we load a
|
||||
* palette into a slot. We need to keep track of which texture's palette is
|
||||
* stored in what slot. */
|
||||
std::map<uintptr_t, std::size_t> g_TexResourceToPaletteIndex;
|
||||
std::map<std::uintptr_t, std::size_t> g_TexResourceToPaletteIndex;
|
||||
std::list<std::size_t> g_PaletteIndex;
|
||||
struct TexturePalette { PALETTEENTRY p[256]; };
|
||||
std::map<uintptr_t, TexturePalette> g_TexResourceToTexturePalette;
|
||||
std::map<std::uintptr_t, TexturePalette> g_TexResourceToTexturePalette;
|
||||
|
||||
// Load the palette, if any, for the given texture into a palette slot, and make it current.
|
||||
static void SetPalette( uintptr_t TexResource )
|
||||
static void SetPalette( std::uintptr_t TexResource )
|
||||
{
|
||||
// If the texture isn't paletted, we have nothing to do.
|
||||
if( g_TexResourceToTexturePalette.find(TexResource) == g_TexResourceToTexturePalette.end() )
|
||||
@@ -64,7 +65,7 @@ static void SetPalette( uintptr_t TexResource )
|
||||
UINT iPalIndex = static_cast<UINT>(g_PaletteIndex.front());
|
||||
|
||||
// If any other texture is currently using this slot, mark that palette unloaded.
|
||||
for( std::map<uintptr_t, std::size_t>::iterator i = g_TexResourceToPaletteIndex.begin(); i != g_TexResourceToPaletteIndex.end(); ++i )
|
||||
for( std::map<std::uintptr_t, std::size_t>::iterator i = g_TexResourceToPaletteIndex.begin(); i != g_TexResourceToPaletteIndex.end(); ++i )
|
||||
{
|
||||
if( i->second != iPalIndex )
|
||||
continue;
|
||||
@@ -795,7 +796,7 @@ public:
|
||||
|
||||
for( std::size_t j=0; j<Triangles.size(); j++ )
|
||||
for( std::size_t k=0; k<3; k++ )
|
||||
m_vTriangles[meshInfo.iTriangleStart+j].nVertexIndices[k] = (uint16_t) meshInfo.iVertexStart + Triangles[j].nVertexIndices[k];
|
||||
m_vTriangles[meshInfo.iTriangleStart+j].nVertexIndices[k] = (std::uint16_t) meshInfo.iVertexStart + Triangles[j].nVertexIndices[k];
|
||||
}
|
||||
}
|
||||
void Draw( int iMeshIndex ) const
|
||||
@@ -851,11 +852,11 @@ void RageDisplay_D3D::DrawQuadsInternal( const RageSpriteVertex v[], int iNumVer
|
||||
int iNumIndices = iNumTriangles*3;
|
||||
|
||||
// make a temporary index buffer
|
||||
static std::vector<uint16_t> vIndices;
|
||||
static std::vector<std::uint16_t> vIndices;
|
||||
std::size_t uOldSize = vIndices.size();
|
||||
std::size_t uNewSize = std::max(uOldSize, static_cast<std::size_t>(iNumIndices));
|
||||
vIndices.resize( uNewSize );
|
||||
for( uint16_t i=(uint16_t)uOldSize/6; i<(uint16_t)iNumQuads; i++ )
|
||||
for( std::uint16_t i=(std::uint16_t)uOldSize/6; i<(std::uint16_t)iNumQuads; i++ )
|
||||
{
|
||||
vIndices[i*6+0] = i*4+0;
|
||||
vIndices[i*6+1] = i*4+1;
|
||||
@@ -887,11 +888,11 @@ void RageDisplay_D3D::DrawQuadStripInternal( const RageSpriteVertex v[], int iNu
|
||||
int iNumIndices = iNumTriangles*3;
|
||||
|
||||
// make a temporary index buffer
|
||||
static std::vector<uint16_t> vIndices;
|
||||
static std::vector<std::uint16_t> vIndices;
|
||||
std::size_t uOldSize = vIndices.size();
|
||||
std::size_t uNewSize = std::max(uOldSize, static_cast<std::size_t>(iNumIndices));
|
||||
vIndices.resize( uNewSize );
|
||||
for( uint16_t i=(uint16_t)uOldSize/6; i<(uint16_t)iNumQuads; i++ )
|
||||
for( std::uint16_t i=(std::uint16_t)uOldSize/6; i<(std::uint16_t)iNumQuads; i++ )
|
||||
{
|
||||
vIndices[i*6+0] = i*2+0;
|
||||
vIndices[i*6+1] = i*2+1;
|
||||
@@ -922,11 +923,11 @@ void RageDisplay_D3D::DrawSymmetricQuadStripInternal( const RageSpriteVertex v[]
|
||||
int iNumIndices = iNumTriangles*3;
|
||||
|
||||
// make a temporary index buffer
|
||||
static std::vector<uint16_t> vIndices;
|
||||
static std::vector<std::uint16_t> vIndices;
|
||||
std::size_t uOldSize = vIndices.size();
|
||||
std::size_t uNewSize = std::max(uOldSize, static_cast<std::size_t>(iNumIndices));
|
||||
vIndices.resize( uNewSize );
|
||||
for( uint16_t i=(uint16_t)uOldSize/12; i<(uint16_t)iNumPieces; i++ )
|
||||
for( std::uint16_t i=(std::uint16_t)uOldSize/12; i<(std::uint16_t)iNumPieces; i++ )
|
||||
{
|
||||
// { 1, 3, 0 } { 1, 4, 3 } { 1, 5, 4 } { 1, 2, 5 }
|
||||
vIndices[i*12+0] = i*3+1;
|
||||
@@ -1049,7 +1050,7 @@ int RageDisplay_D3D::GetNumTextureUnits()
|
||||
return g_DeviceCaps.MaxSimultaneousTextures;
|
||||
}
|
||||
|
||||
void RageDisplay_D3D::SetTexture( TextureUnit tu, uintptr_t iTexture )
|
||||
void RageDisplay_D3D::SetTexture( TextureUnit tu, std::uintptr_t iTexture )
|
||||
{
|
||||
// g_DeviceCaps.MaxSimultaneousTextures = 1;
|
||||
if( tu >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
|
||||
@@ -1357,7 +1358,7 @@ void RageDisplay_D3D::SetCullMode( CullMode mode )
|
||||
}
|
||||
}
|
||||
|
||||
void RageDisplay_D3D::DeleteTexture( uintptr_t iTexHandle )
|
||||
void RageDisplay_D3D::DeleteTexture( std::uintptr_t iTexHandle )
|
||||
{
|
||||
if( iTexHandle == 0 )
|
||||
return;
|
||||
@@ -1373,7 +1374,7 @@ void RageDisplay_D3D::DeleteTexture( uintptr_t iTexHandle )
|
||||
}
|
||||
|
||||
|
||||
uintptr_t RageDisplay_D3D::CreateTexture(
|
||||
std::uintptr_t RageDisplay_D3D::CreateTexture(
|
||||
RagePixelFormat pixfmt,
|
||||
RageSurface* img,
|
||||
bool bGenerateMipMaps )
|
||||
@@ -1386,7 +1387,7 @@ uintptr_t RageDisplay_D3D::CreateTexture(
|
||||
RageException::Throw( "CreateTexture(%i,%i,%s) failed: %s",
|
||||
img->w, img->h, RagePixelFormatToString(pixfmt).c_str(), GetErrorString(hr).c_str() );
|
||||
|
||||
uintptr_t uTexHandle = reinterpret_cast<uintptr_t>(pTex);
|
||||
std::uintptr_t uTexHandle = reinterpret_cast<std::uintptr_t>(pTex);
|
||||
|
||||
if( pixfmt == RagePixelFormat_PAL )
|
||||
{
|
||||
@@ -1412,7 +1413,7 @@ uintptr_t RageDisplay_D3D::CreateTexture(
|
||||
}
|
||||
|
||||
void RageDisplay_D3D::UpdateTexture(
|
||||
uintptr_t uTexHandle,
|
||||
std::uintptr_t uTexHandle,
|
||||
RageSurface* img,
|
||||
int xoffset, int yoffset, int width, int height )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user