Fix Windows x64 type inconsistency regarding RageTexture
This commit is contained in:
+2
-2
@@ -185,8 +185,8 @@ void ImageCache::ReadFromDisk()
|
||||
|
||||
struct ImageTexture: public RageTexture
|
||||
{
|
||||
unsigned m_uTexHandle;
|
||||
unsigned GetTexHandle() const { return m_uTexHandle; }; // accessed by RageDisplay
|
||||
uintptr_t m_uTexHandle;
|
||||
uintptr_t GetTexHandle() const { return m_uTexHandle; }; // accessed by RageDisplay
|
||||
/* This is a reference to a pointer in g_ImagePathToImage. */
|
||||
RageSurface *&m_pImage;
|
||||
int m_iWidth, m_iHeight;
|
||||
|
||||
@@ -13,12 +13,12 @@ public:
|
||||
/* only called by RageTextureManager::InvalidateTextures */
|
||||
virtual void Invalidate() { m_uTexHandle = 0; /* don't Destroy() */}
|
||||
virtual void Reload();
|
||||
virtual unsigned GetTexHandle() const { return m_uTexHandle; }; // accessed by RageDisplay
|
||||
virtual uintptr_t GetTexHandle() const { return m_uTexHandle; }; // accessed by RageDisplay
|
||||
|
||||
private:
|
||||
void Create(); // called by constructor and Reload
|
||||
void Destroy();
|
||||
unsigned m_uTexHandle; // treat as unsigned in OpenGL, ID3D8Texture* for D3D
|
||||
uintptr_t m_uTexHandle; // treat as unsigned in OpenGL, IDirect3DTexture9* for D3D
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+10
-10
@@ -205,7 +205,7 @@ struct RageTextureLock
|
||||
|
||||
/* Given a surface with a format and no pixel data, lock the texture into the
|
||||
* surface. The data is write-only. */
|
||||
virtual void Lock( unsigned iTexHandle, RageSurface *pSurface ) = 0;
|
||||
virtual void Lock( uintptr_t iTexHandle, RageSurface *pSurface ) = 0;
|
||||
|
||||
/* Unlock and update the texture. If bChanged is false, the texture update
|
||||
* may be omitted. */
|
||||
@@ -261,23 +261,23 @@ public:
|
||||
|
||||
/* return 0 if failed or internal texture resource handle
|
||||
* (unsigned in OpenGL, texture pointer in D3D) */
|
||||
virtual unsigned CreateTexture(
|
||||
virtual uintptr_t CreateTexture(
|
||||
RagePixelFormat pixfmt, // format of img and of texture in video mem
|
||||
RageSurface* img, // must be in pixfmt
|
||||
bool bGenerateMipMaps
|
||||
) = 0;
|
||||
virtual void UpdateTexture(
|
||||
unsigned iTexHandle,
|
||||
uintptr_t iTexHandle,
|
||||
RageSurface* img,
|
||||
int xoffset, int yoffset, int width, int height
|
||||
) = 0;
|
||||
virtual void DeleteTexture( unsigned iTexHandle ) = 0;
|
||||
virtual void DeleteTexture( uintptr_t iTexHandle ) = 0;
|
||||
/* Return an object to lock pixels for streaming. If not supported, returns nullptr.
|
||||
* Delete the object normally. */
|
||||
virtual RageTextureLock *CreateTextureLock() { return nullptr; }
|
||||
virtual void ClearAllTextures() = 0;
|
||||
virtual int GetNumTextureUnits() = 0;
|
||||
virtual void SetTexture( TextureUnit, unsigned /* iTexture */ ) = 0;
|
||||
virtual void SetTexture( TextureUnit, uintptr_t /* iTexture */ ) = 0;
|
||||
virtual void SetTextureMode( TextureUnit, TextureMode ) = 0;
|
||||
virtual void SetTextureWrapping( TextureUnit, bool ) = 0;
|
||||
virtual int GetMaxTextureSize() const = 0;
|
||||
@@ -293,9 +293,9 @@ public:
|
||||
* DeleteTexture. (UpdateTexture is not permitted.) Returns 0 if render-to-
|
||||
* texture is unsupported.
|
||||
*/
|
||||
virtual unsigned CreateRenderTarget( const RenderTargetParam &, int & /* iTextureWidthOut */, int & /* iTextureHeightOut */ ) { return 0; }
|
||||
virtual uintptr_t CreateRenderTarget( const RenderTargetParam &, int & /* iTextureWidthOut */, int & /* iTextureHeightOut */ ) { return 0; }
|
||||
|
||||
virtual unsigned GetRenderTarget() { return 0; }
|
||||
virtual uintptr_t GetRenderTarget() { return 0; }
|
||||
|
||||
/* Set the render target, or 0 to resume rendering to the framebuffer. An active render
|
||||
* target may not be used as a texture. If bPreserveTexture is true, the contents
|
||||
@@ -303,7 +303,7 @@ public:
|
||||
* bPreserveTexture is true the first time a render target is used, behave as if
|
||||
* bPreserveTexture was false.
|
||||
*/
|
||||
virtual void SetRenderTarget( unsigned /* iHandle */, bool /* bPreserveTexture */ = true ) { }
|
||||
virtual void SetRenderTarget( uintptr_t /* iHandle */, bool /* bPreserveTexture */ = true ) { }
|
||||
|
||||
virtual bool IsZTestEnabled() const = 0;
|
||||
virtual bool IsZWriteEnabled() const = 0;
|
||||
@@ -364,9 +364,9 @@ public:
|
||||
};
|
||||
bool SaveScreenshot( RString sPath, GraphicsFileFormat format );
|
||||
|
||||
virtual RString GetTextureDiagnostics( unsigned /* id */ ) const { return RString(); }
|
||||
virtual RString GetTextureDiagnostics( uintptr_t /* id */ ) const { return RString(); }
|
||||
virtual RageSurface* CreateScreenshot() = 0; // allocates a surface. Caller must delete it.
|
||||
virtual RageSurface *GetTexture( unsigned /* iTexture */ ) { return nullptr; } // allocates a surface. Caller must delete it.
|
||||
virtual RageSurface *GetTexture( uintptr_t /* iTexture */ ) { return nullptr; } // allocates a surface. Caller must delete it.
|
||||
|
||||
protected:
|
||||
virtual void DrawQuadsInternal( const RageSpriteVertex v[], int iNumVerts ) = 0;
|
||||
|
||||
+26
-26
@@ -52,13 +52,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. */
|
||||
map<unsigned,int> g_TexResourceToPaletteIndex;
|
||||
list<int> g_PaletteIndex;
|
||||
std::map<uintptr_t, size_t> g_TexResourceToPaletteIndex;
|
||||
std::list<size_t> g_PaletteIndex;
|
||||
struct TexturePalette { PALETTEENTRY p[256]; };
|
||||
map<unsigned,TexturePalette> g_TexResourceToTexturePalette;
|
||||
std::map<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( unsigned TexResource )
|
||||
static void SetPalette( uintptr_t TexResource )
|
||||
{
|
||||
// If the texture isn't paletted, we have nothing to do.
|
||||
if( g_TexResourceToTexturePalette.find(TexResource) == g_TexResourceToTexturePalette.end() )
|
||||
@@ -68,10 +68,10 @@ static void SetPalette( unsigned TexResource )
|
||||
if( g_TexResourceToPaletteIndex.find(TexResource) == g_TexResourceToPaletteIndex.end() )
|
||||
{
|
||||
// It's not. Grab the least recently used slot.
|
||||
int iPalIndex = g_PaletteIndex.front();
|
||||
UINT iPalIndex = static_cast<UINT>(g_PaletteIndex.front());
|
||||
|
||||
// If any other texture is currently using this slot, mark that palette unloaded.
|
||||
for( map<unsigned,int>::iterator i = g_TexResourceToPaletteIndex.begin(); i != g_TexResourceToPaletteIndex.end(); ++i )
|
||||
for( std::map<uintptr_t, size_t>::iterator i = g_TexResourceToPaletteIndex.begin(); i != g_TexResourceToPaletteIndex.end(); ++i )
|
||||
{
|
||||
if( i->second != iPalIndex )
|
||||
continue;
|
||||
@@ -89,7 +89,7 @@ static void SetPalette( unsigned TexResource )
|
||||
const int iPalIndex = g_TexResourceToPaletteIndex[TexResource];
|
||||
|
||||
// Find this palette index in the least-recently-used queue and move it to the end.
|
||||
for(list<int>::iterator i = g_PaletteIndex.begin(); i != g_PaletteIndex.end(); ++i)
|
||||
for(std::list<size_t>::iterator i = g_PaletteIndex.begin(); i != g_PaletteIndex.end(); ++i)
|
||||
{
|
||||
if( *i != iPalIndex )
|
||||
continue;
|
||||
@@ -335,7 +335,7 @@ D3DFORMAT FindBackBufferType(bool bWindowed, int iBPP)
|
||||
}
|
||||
|
||||
// Test each back buffer format until we find something that works.
|
||||
for( unsigned i=0; i < vBackBufferFormats.size(); i++ )
|
||||
for( size_t i=0; i < vBackBufferFormats.size(); i++ )
|
||||
{
|
||||
D3DFORMAT fmtBackBuffer = vBackBufferFormats[i];
|
||||
|
||||
@@ -775,18 +775,18 @@ public:
|
||||
}
|
||||
void Change( const vector<msMesh> &vMeshes )
|
||||
{
|
||||
for( unsigned i=0; i<vMeshes.size(); i++ )
|
||||
for( size_t i=0; i<vMeshes.size(); i++ )
|
||||
{
|
||||
const MeshInfo& meshInfo = m_vMeshInfo[i];
|
||||
const msMesh& mesh = vMeshes[i];
|
||||
const vector<RageModelVertex> &Vertices = mesh.Vertices;
|
||||
const vector<msTriangle> &Triangles = mesh.Triangles;
|
||||
|
||||
for( unsigned j=0; j<Vertices.size(); j++ )
|
||||
for( size_t j=0; j<Vertices.size(); j++ )
|
||||
m_vVertex[meshInfo.iVertexStart+j] = Vertices[j];
|
||||
|
||||
for( unsigned j=0; j<Triangles.size(); j++ )
|
||||
for( unsigned k=0; k<3; k++ )
|
||||
for( size_t j=0; j<Triangles.size(); j++ )
|
||||
for( size_t k=0; k<3; k++ )
|
||||
m_vTriangles[meshInfo.iTriangleStart+j].nVertexIndices[k] = (uint16_t) meshInfo.iVertexStart + Triangles[j].nVertexIndices[k];
|
||||
}
|
||||
}
|
||||
@@ -844,8 +844,8 @@ void RageDisplay_D3D::DrawQuadsInternal( const RageSpriteVertex v[], int iNumVer
|
||||
|
||||
// make a temporary index buffer
|
||||
static vector<uint16_t> vIndices;
|
||||
unsigned uOldSize = vIndices.size();
|
||||
unsigned uNewSize = max(uOldSize,(unsigned)iNumIndices);
|
||||
size_t uOldSize = vIndices.size();
|
||||
size_t uNewSize = max(uOldSize, static_cast<size_t>(iNumIndices));
|
||||
vIndices.resize( uNewSize );
|
||||
for( uint16_t i=(uint16_t)uOldSize/6; i<(uint16_t)iNumQuads; i++ )
|
||||
{
|
||||
@@ -880,8 +880,8 @@ void RageDisplay_D3D::DrawQuadStripInternal( const RageSpriteVertex v[], int iNu
|
||||
|
||||
// make a temporary index buffer
|
||||
static vector<uint16_t> vIndices;
|
||||
unsigned uOldSize = vIndices.size();
|
||||
unsigned uNewSize = max(uOldSize,(unsigned)iNumIndices);
|
||||
size_t uOldSize = vIndices.size();
|
||||
size_t uNewSize = max(uOldSize, static_cast<size_t>(iNumIndices));
|
||||
vIndices.resize( uNewSize );
|
||||
for( uint16_t i=(uint16_t)uOldSize/6; i<(uint16_t)iNumQuads; i++ )
|
||||
{
|
||||
@@ -915,8 +915,8 @@ void RageDisplay_D3D::DrawSymmetricQuadStripInternal( const RageSpriteVertex v[]
|
||||
|
||||
// make a temporary index buffer
|
||||
static vector<uint16_t> vIndices;
|
||||
unsigned uOldSize = vIndices.size();
|
||||
unsigned uNewSize = max(uOldSize,(unsigned)iNumIndices);
|
||||
size_t uOldSize = vIndices.size();
|
||||
size_t uNewSize = max(uOldSize, static_cast<size_t>(iNumIndices));
|
||||
vIndices.resize( uNewSize );
|
||||
for( uint16_t i=(uint16_t)uOldSize/12; i<(uint16_t)iNumPieces; i++ )
|
||||
{
|
||||
@@ -1041,7 +1041,7 @@ int RageDisplay_D3D::GetNumTextureUnits()
|
||||
return g_DeviceCaps.MaxSimultaneousTextures;
|
||||
}
|
||||
|
||||
void RageDisplay_D3D::SetTexture( TextureUnit tu, unsigned iTexture )
|
||||
void RageDisplay_D3D::SetTexture( TextureUnit tu, uintptr_t iTexture )
|
||||
{
|
||||
// g_DeviceCaps.MaxSimultaneousTextures = 1;
|
||||
if( tu >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
|
||||
@@ -1058,7 +1058,7 @@ void RageDisplay_D3D::SetTexture( TextureUnit tu, unsigned iTexture )
|
||||
}
|
||||
else
|
||||
{
|
||||
IDirect3DTexture9* pTex = (IDirect3DTexture9*) iTexture;
|
||||
IDirect3DTexture9* pTex = reinterpret_cast<IDirect3DTexture9*>(iTexture);
|
||||
g_pd3dDevice->SetTexture( tu, pTex );
|
||||
|
||||
/* Intentionally commented out. Don't mess with texture stage state
|
||||
@@ -1349,12 +1349,12 @@ void RageDisplay_D3D::SetCullMode( CullMode mode )
|
||||
}
|
||||
}
|
||||
|
||||
void RageDisplay_D3D::DeleteTexture( unsigned iTexHandle )
|
||||
void RageDisplay_D3D::DeleteTexture( uintptr_t iTexHandle )
|
||||
{
|
||||
if( iTexHandle == 0 )
|
||||
return;
|
||||
|
||||
IDirect3DTexture9* pTex = (IDirect3DTexture9*) iTexHandle;
|
||||
IDirect3DTexture9* pTex = reinterpret_cast<IDirect3DTexture9*>(iTexHandle);
|
||||
pTex->Release();
|
||||
|
||||
// Delete palette (if any)
|
||||
@@ -1365,7 +1365,7 @@ void RageDisplay_D3D::DeleteTexture( unsigned iTexHandle )
|
||||
}
|
||||
|
||||
|
||||
unsigned RageDisplay_D3D::CreateTexture(
|
||||
uintptr_t RageDisplay_D3D::CreateTexture(
|
||||
RagePixelFormat pixfmt,
|
||||
RageSurface* img,
|
||||
bool bGenerateMipMaps )
|
||||
@@ -1378,7 +1378,7 @@ unsigned RageDisplay_D3D::CreateTexture(
|
||||
RageException::Throw( "CreateTexture(%i,%i,%s) failed: %s",
|
||||
img->w, img->h, RagePixelFormatToString(pixfmt).c_str(), GetErrorString(hr).c_str() );
|
||||
|
||||
unsigned uTexHandle = (unsigned)pTex;
|
||||
uintptr_t uTexHandle = reinterpret_cast<uintptr_t>(pTex);
|
||||
|
||||
if( pixfmt == RagePixelFormat_PAL )
|
||||
{
|
||||
@@ -1404,11 +1404,11 @@ unsigned RageDisplay_D3D::CreateTexture(
|
||||
}
|
||||
|
||||
void RageDisplay_D3D::UpdateTexture(
|
||||
unsigned uTexHandle,
|
||||
uintptr_t uTexHandle,
|
||||
RageSurface* img,
|
||||
int xoffset, int yoffset, int width, int height )
|
||||
{
|
||||
IDirect3DTexture9* pTex = (IDirect3DTexture9*)uTexHandle;
|
||||
IDirect3DTexture9* pTex = reinterpret_cast<IDirect3DTexture9*>(uTexHandle);
|
||||
ASSERT( pTex != nullptr );
|
||||
|
||||
RECT rect;
|
||||
|
||||
@@ -22,19 +22,19 @@ public:
|
||||
bool SupportsTextureFormat( RagePixelFormat pixfmt, bool realtime=false );
|
||||
bool SupportsThreadedRendering();
|
||||
bool SupportsPerVertexMatrixScale() { return false; }
|
||||
unsigned CreateTexture(
|
||||
uintptr_t CreateTexture(
|
||||
RagePixelFormat pixfmt,
|
||||
RageSurface* img,
|
||||
bool bGenerateMipMaps );
|
||||
void UpdateTexture(
|
||||
unsigned iTexHandle,
|
||||
uintptr_t iTexHandle,
|
||||
RageSurface* img,
|
||||
int xoffset, int yoffset, int width, int height
|
||||
);
|
||||
void DeleteTexture( unsigned iTexHandle );
|
||||
void DeleteTexture( uintptr_t iTexHandle );
|
||||
void ClearAllTextures();
|
||||
int GetNumTextureUnits();
|
||||
void SetTexture( TextureUnit tu, unsigned iTexture );
|
||||
void SetTexture( TextureUnit tu, uintptr_t iTexture );
|
||||
void SetTextureMode( TextureUnit tu, TextureMode tm );
|
||||
void SetTextureWrapping( TextureUnit tu, bool b );
|
||||
int GetMaxTextureSize() const;
|
||||
|
||||
@@ -19,19 +19,19 @@ public:
|
||||
void SetBlendMode( BlendMode ) { }
|
||||
bool SupportsTextureFormat( RagePixelFormat, bool /* realtime */ =false ) { return true; }
|
||||
bool SupportsPerVertexMatrixScale() { return false; }
|
||||
unsigned CreateTexture(
|
||||
uintptr_t CreateTexture(
|
||||
RagePixelFormat,
|
||||
RageSurface* /* img */,
|
||||
bool /* bGenerateMipMaps */ ) { return 1; }
|
||||
void UpdateTexture(
|
||||
unsigned /* iTexHandle */,
|
||||
uintptr_t /* iTexHandle */,
|
||||
RageSurface* /* img */,
|
||||
int /* xoffset */, int /* yoffset */, int /* width */, int /* height */
|
||||
) { }
|
||||
void DeleteTexture( unsigned /* iTexHandle */ ) { }
|
||||
void DeleteTexture( uintptr_t /* iTexHandle */ ) { }
|
||||
void ClearAllTextures() { }
|
||||
int GetNumTextureUnits() { return 1; }
|
||||
void SetTexture( TextureUnit, unsigned /* iTexture */ ) { }
|
||||
void SetTexture( TextureUnit, uintptr_t /* iTexture */ ) { }
|
||||
void SetTextureMode( TextureUnit, TextureMode ) { }
|
||||
void SetTextureWrapping( TextureUnit, bool ) { }
|
||||
int GetMaxTextureSize() const { return 2048; }
|
||||
|
||||
+29
-29
@@ -62,7 +62,7 @@ static const GLenum RageSpriteVertexFormat = GL_T2F_C4F_N3F_V3F;
|
||||
/* If we support texture matrix scaling, a handle to the vertex program: */
|
||||
static GLhandleARB g_bTextureMatrixShader = 0;
|
||||
|
||||
static std::map<unsigned, RenderTarget *> g_mapRenderTargets;
|
||||
static std::map<uintptr_t, RenderTarget *> g_mapRenderTargets;
|
||||
static RenderTarget *g_pCurrentRenderTarget = nullptr;
|
||||
|
||||
static LowLevelWindow *g_pWind;
|
||||
@@ -795,7 +795,7 @@ RString RageDisplay_Legacy::TryVideoMode( const VideoModeParams &p, bool &bNewDe
|
||||
|
||||
/* Delete all render targets. They may have associated resources other than
|
||||
* the texture itself. */
|
||||
for (std::pair<unsigned const, RenderTarget *> &rt : g_mapRenderTargets)
|
||||
for (std::pair<uintptr_t const, RenderTarget *> &rt : g_mapRenderTargets)
|
||||
delete rt.second;
|
||||
g_mapRenderTargets.clear();
|
||||
|
||||
@@ -922,14 +922,14 @@ RageSurface* RageDisplay_Legacy::CreateScreenshot()
|
||||
return image;
|
||||
}
|
||||
|
||||
RageSurface *RageDisplay_Legacy::GetTexture( unsigned iTexture )
|
||||
RageSurface *RageDisplay_Legacy::GetTexture( uintptr_t iTexture )
|
||||
{
|
||||
if (iTexture == 0)
|
||||
return nullptr; // XXX
|
||||
|
||||
FlushGLErrors();
|
||||
|
||||
glBindTexture( GL_TEXTURE_2D, iTexture );
|
||||
glBindTexture( GL_TEXTURE_2D, static_cast<GLuint>(iTexture) );
|
||||
GLint iHeight, iWidth, iAlphaBits;
|
||||
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &iHeight );
|
||||
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &iWidth );
|
||||
@@ -1677,7 +1677,7 @@ int RageDisplay_Legacy::GetNumTextureUnits()
|
||||
return g_iMaxTextureUnits;
|
||||
}
|
||||
|
||||
void RageDisplay_Legacy::SetTexture( TextureUnit tu, unsigned iTexture )
|
||||
void RageDisplay_Legacy::SetTexture( TextureUnit tu, uintptr_t iTexture )
|
||||
{
|
||||
if (!SetTextureUnit( tu ))
|
||||
return;
|
||||
@@ -1685,7 +1685,7 @@ void RageDisplay_Legacy::SetTexture( TextureUnit tu, unsigned iTexture )
|
||||
if (iTexture)
|
||||
{
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
glBindTexture( GL_TEXTURE_2D, iTexture );
|
||||
glBindTexture( GL_TEXTURE_2D, static_cast<GLuint>(iTexture) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2104,7 +2104,7 @@ void RageDisplay_Legacy::EndConcurrentRendering()
|
||||
g_pWind->EndConcurrentRendering();
|
||||
}
|
||||
|
||||
void RageDisplay_Legacy::DeleteTexture( unsigned iTexture )
|
||||
void RageDisplay_Legacy::DeleteTexture( uintptr_t iTexture )
|
||||
{
|
||||
if (iTexture == 0)
|
||||
return;
|
||||
@@ -2189,7 +2189,7 @@ void SetPixelMapForSurface( int glImageFormat, int glTexFormat, const RageSurfac
|
||||
DebugAssertNoGLError();
|
||||
}
|
||||
|
||||
unsigned RageDisplay_Legacy::CreateTexture(
|
||||
uintptr_t RageDisplay_Legacy::CreateTexture(
|
||||
RagePixelFormat pixfmt,
|
||||
RageSurface* pImg,
|
||||
bool bGenerateMipMaps )
|
||||
@@ -2234,11 +2234,11 @@ unsigned RageDisplay_Legacy::CreateTexture(
|
||||
SetTextureUnit( TextureUnit_1 );
|
||||
|
||||
// allocate OpenGL texture resource
|
||||
unsigned int iTexHandle;
|
||||
uintptr_t iTexHandle;
|
||||
glGenTextures( 1, reinterpret_cast<GLuint*>(&iTexHandle) );
|
||||
ASSERT( iTexHandle != 0 );
|
||||
|
||||
glBindTexture( GL_TEXTURE_2D, iTexHandle );
|
||||
glBindTexture( GL_TEXTURE_2D, static_cast<GLuint>(iTexHandle) );
|
||||
|
||||
if (g_pWind->GetActualVideoModeParams().bAnisotropicFiltering &&
|
||||
GLEW_EXT_texture_filter_anisotropic )
|
||||
@@ -2350,7 +2350,7 @@ public:
|
||||
m_iTexHandle = 0;
|
||||
}
|
||||
|
||||
void Lock( unsigned iTexHandle, RageSurface *pSurface )
|
||||
void Lock( uintptr_t iTexHandle, RageSurface *pSurface )
|
||||
{
|
||||
ASSERT( m_iTexHandle == 0 );
|
||||
ASSERT( pSurface->pixels == nullptr );
|
||||
@@ -2396,7 +2396,7 @@ private:
|
||||
|
||||
GLuint m_iBuffer;
|
||||
|
||||
unsigned m_iTexHandle;
|
||||
uintptr_t m_iTexHandle;
|
||||
};
|
||||
|
||||
RageTextureLock *RageDisplay_Legacy::CreateTextureLock()
|
||||
@@ -2408,11 +2408,11 @@ RageTextureLock *RageDisplay_Legacy::CreateTextureLock()
|
||||
}
|
||||
|
||||
void RageDisplay_Legacy::UpdateTexture(
|
||||
unsigned iTexHandle,
|
||||
uintptr_t iTexHandle,
|
||||
RageSurface* pImg,
|
||||
int iXOffset, int iYOffset, int iWidth, int iHeight )
|
||||
{
|
||||
glBindTexture( GL_TEXTURE_2D, iTexHandle );
|
||||
glBindTexture( GL_TEXTURE_2D, static_cast<GLuint>(iTexHandle) );
|
||||
|
||||
bool bFreeImg;
|
||||
RagePixelFormat SurfacePixFmt = GetImgPixelFormat( pImg, bFreeImg, iWidth, iHeight, false );
|
||||
@@ -2450,16 +2450,16 @@ public:
|
||||
RenderTarget_FramebufferObject();
|
||||
~RenderTarget_FramebufferObject();
|
||||
void Create( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut );
|
||||
unsigned GetTexture() const { return m_iTexHandle; }
|
||||
uintptr_t GetTexture() const { return m_iTexHandle; }
|
||||
void StartRenderingTo();
|
||||
void FinishRenderingTo();
|
||||
|
||||
virtual bool InvertY() const { return true; }
|
||||
|
||||
private:
|
||||
unsigned int m_iFrameBufferHandle;
|
||||
unsigned int m_iTexHandle;
|
||||
unsigned int m_iDepthBufferHandle;
|
||||
uintptr_t m_iFrameBufferHandle;
|
||||
uintptr_t m_iTexHandle;
|
||||
uintptr_t m_iDepthBufferHandle;
|
||||
};
|
||||
|
||||
RenderTarget_FramebufferObject::RenderTarget_FramebufferObject()
|
||||
@@ -2495,7 +2495,7 @@ void RenderTarget_FramebufferObject::Create( const RenderTargetParam ¶m, int
|
||||
iTextureWidthOut = iTextureWidth;
|
||||
iTextureHeightOut = iTextureHeight;
|
||||
|
||||
glBindTexture( GL_TEXTURE_2D, m_iTexHandle );
|
||||
glBindTexture( GL_TEXTURE_2D, static_cast<GLuint>(m_iTexHandle) );
|
||||
GLenum internalformat;
|
||||
GLenum type = param.bWithAlpha? GL_RGBA:GL_RGB;
|
||||
if (param.bFloat && GLEW_ARB_texture_float)
|
||||
@@ -2517,8 +2517,8 @@ void RenderTarget_FramebufferObject::Create( const RenderTargetParam ¶m, int
|
||||
ASSERT( m_iFrameBufferHandle != 0 );
|
||||
|
||||
/* Attach the texture to it. */
|
||||
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, m_iFrameBufferHandle );
|
||||
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_iTexHandle, 0 );
|
||||
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, static_cast<GLuint>(m_iFrameBufferHandle) );
|
||||
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, static_cast<GLuint>(m_iTexHandle), 0 );
|
||||
DebugAssertNoGLError();
|
||||
|
||||
/* Attach a depth buffer, if requested. */
|
||||
@@ -2527,9 +2527,9 @@ void RenderTarget_FramebufferObject::Create( const RenderTargetParam ¶m, int
|
||||
glGenRenderbuffersEXT( 1, reinterpret_cast<GLuint*>(&m_iDepthBufferHandle) );
|
||||
ASSERT( m_iDepthBufferHandle != 0 );
|
||||
|
||||
glBindRenderbufferEXT( GL_RENDERBUFFER, m_iDepthBufferHandle );
|
||||
glBindRenderbufferEXT( GL_RENDERBUFFER, static_cast<GLuint>(m_iDepthBufferHandle) );
|
||||
glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16, iTextureWidth, iTextureHeight );
|
||||
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_iDepthBufferHandle );
|
||||
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, static_cast<GLuint>(m_iDepthBufferHandle) );
|
||||
}
|
||||
|
||||
GLenum status = glCheckFramebufferStatusEXT( GL_FRAMEBUFFER_EXT );
|
||||
@@ -2555,7 +2555,7 @@ void RenderTarget_FramebufferObject::Create( const RenderTargetParam ¶m, int
|
||||
|
||||
void RenderTarget_FramebufferObject::StartRenderingTo()
|
||||
{
|
||||
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, m_iFrameBufferHandle );
|
||||
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, static_cast<GLuint>(m_iFrameBufferHandle) );
|
||||
}
|
||||
|
||||
void RenderTarget_FramebufferObject::FinishRenderingTo()
|
||||
@@ -2582,7 +2582,7 @@ bool RageDisplay_Legacy::SupportsFullscreenBorderlessWindow() const
|
||||
* particularly GeForce 2, but is simpler and faster when available.
|
||||
*/
|
||||
|
||||
unsigned RageDisplay_Legacy::CreateRenderTarget( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut )
|
||||
uintptr_t RageDisplay_Legacy::CreateRenderTarget( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut )
|
||||
{
|
||||
RenderTarget *pTarget;
|
||||
if (GLEW_EXT_framebuffer_object)
|
||||
@@ -2592,22 +2592,22 @@ unsigned RageDisplay_Legacy::CreateRenderTarget( const RenderTargetParam ¶m,
|
||||
|
||||
pTarget->Create( param, iTextureWidthOut, iTextureHeightOut );
|
||||
|
||||
unsigned iTexture = pTarget->GetTexture();
|
||||
uintptr_t iTexture = pTarget->GetTexture();
|
||||
|
||||
ASSERT( g_mapRenderTargets.find(iTexture) == g_mapRenderTargets.end() );
|
||||
g_mapRenderTargets[iTexture] = pTarget;
|
||||
return iTexture;
|
||||
}
|
||||
|
||||
unsigned RageDisplay_Legacy::GetRenderTarget( )
|
||||
uintptr_t RageDisplay_Legacy::GetRenderTarget()
|
||||
{
|
||||
for( map<unsigned, RenderTarget*>::const_iterator it = g_mapRenderTargets.begin( ); it != g_mapRenderTargets.end( ); ++it )
|
||||
for( map<uintptr_t, RenderTarget*>::const_iterator it = g_mapRenderTargets.begin(); it != g_mapRenderTargets.end(); ++it )
|
||||
if( it->second == g_pCurrentRenderTarget )
|
||||
return it->first;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RageDisplay_Legacy::SetRenderTarget( unsigned iTexture, bool bPreserveTexture )
|
||||
void RageDisplay_Legacy::SetRenderTarget( uintptr_t iTexture, bool bPreserveTexture )
|
||||
{
|
||||
if (iTexture == 0)
|
||||
{
|
||||
|
||||
@@ -53,23 +53,23 @@ public:
|
||||
void SetBlendMode( BlendMode mode );
|
||||
bool SupportsTextureFormat( RagePixelFormat pixfmt, bool realtime=false );
|
||||
bool SupportsPerVertexMatrixScale();
|
||||
unsigned CreateTexture(
|
||||
uintptr_t CreateTexture(
|
||||
RagePixelFormat pixfmt,
|
||||
RageSurface* img,
|
||||
bool bGenerateMipMaps );
|
||||
void UpdateTexture(
|
||||
unsigned iTexHandle,
|
||||
uintptr_t iTexHandle,
|
||||
RageSurface* img,
|
||||
int xoffset, int yoffset, int width, int height
|
||||
);
|
||||
void DeleteTexture( unsigned iTexHandle );
|
||||
void DeleteTexture( uintptr_t iTexHandle );
|
||||
bool UseOffscreenRenderTarget();
|
||||
RageSurface *GetTexture( unsigned iTexture );
|
||||
RageSurface *GetTexture( uintptr_t iTexture );
|
||||
RageTextureLock *CreateTextureLock();
|
||||
|
||||
void ClearAllTextures();
|
||||
int GetNumTextureUnits();
|
||||
void SetTexture( TextureUnit tu, unsigned iTexture );
|
||||
void SetTexture( TextureUnit tu, uintptr_t iTexture );
|
||||
void SetTextureMode( TextureUnit tu, TextureMode tm );
|
||||
void SetTextureWrapping( TextureUnit tu, bool b );
|
||||
int GetMaxTextureSize() const;
|
||||
@@ -78,9 +78,9 @@ public:
|
||||
bool IsEffectModeSupported( EffectMode effect );
|
||||
bool SupportsRenderToTexture() const;
|
||||
bool SupportsFullscreenBorderlessWindow() const;
|
||||
unsigned CreateRenderTarget( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut );
|
||||
unsigned GetRenderTarget();
|
||||
void SetRenderTarget( unsigned iHandle, bool bPreserveTexture );
|
||||
uintptr_t CreateRenderTarget( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut );
|
||||
uintptr_t GetRenderTarget();
|
||||
void SetRenderTarget( uintptr_t iHandle, bool bPreserveTexture );
|
||||
bool IsZWriteEnabled() const;
|
||||
bool IsZTestEnabled() const;
|
||||
void SetZWrite( bool b );
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
virtual ~RenderTarget() { }
|
||||
virtual void Create( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut ) = 0;
|
||||
|
||||
virtual unsigned GetTexture() const = 0;
|
||||
virtual uintptr_t GetTexture() const = 0;
|
||||
|
||||
/* Render to this RenderTarget. */
|
||||
virtual void StartRenderingTo() = 0;
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ public:
|
||||
virtual void Update( float /* fDeltaTime */ ) {}
|
||||
virtual void Reload() {}
|
||||
virtual void Invalidate() { } /* only called by RageTextureManager::InvalidateTextures */
|
||||
virtual unsigned GetTexHandle() const = 0; // accessed by RageDisplay
|
||||
virtual uintptr_t GetTexHandle() const = 0; // accessed by RageDisplay
|
||||
|
||||
// movie texture/animated texture stuff
|
||||
virtual void SetPosition( float /* fSeconds */ ) {} // seek
|
||||
|
||||
@@ -132,10 +132,10 @@ public:
|
||||
m_iImageWidth = m_iImageHeight = 1;
|
||||
CreateFrameRects();
|
||||
}
|
||||
unsigned GetTexHandle() const { return m_uTexHandle; }
|
||||
uintptr_t GetTexHandle() const { return m_uTexHandle; }
|
||||
|
||||
private:
|
||||
unsigned m_uTexHandle;
|
||||
uintptr_t m_uTexHandle;
|
||||
};
|
||||
|
||||
// Load and unload textures from disk.
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
virtual ~RageTextureRenderTarget();
|
||||
virtual void Invalidate() { m_iTexHandle = 0; /* don't Destroy() */ }
|
||||
virtual void Reload();
|
||||
virtual unsigned GetTexHandle() const { return m_iTexHandle; }
|
||||
virtual uintptr_t GetTexHandle() const { return m_iTexHandle; }
|
||||
|
||||
void BeginRenderingTo( bool bPreserveTexture = true );
|
||||
void FinishRenderingTo();
|
||||
@@ -26,8 +26,8 @@ private:
|
||||
|
||||
void Create();
|
||||
void Destroy();
|
||||
unsigned m_iTexHandle;
|
||||
unsigned m_iPreviousRenderTarget;
|
||||
uintptr_t m_iTexHandle;
|
||||
uintptr_t m_iPreviousRenderTarget;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,8 +31,10 @@ inline float max( float a, int b ) { return a > b? a:b; }
|
||||
inline float max( int a, float b ) { return a > b? a:b; }
|
||||
inline unsigned long min( unsigned int a, unsigned long b ) { return a < b? a:b; }
|
||||
inline unsigned long min( unsigned long a, unsigned int b ) { return a < b? a:b; }
|
||||
inline size_t min( unsigned int a, size_t b ) { return a < b? a:b; }
|
||||
inline unsigned long max( unsigned int a, unsigned long b ) { return a > b? a:b; }
|
||||
inline unsigned long max( unsigned long a, unsigned int b ) { return a > b? a:b; }
|
||||
inline size_t max( unsigned int a, size_t b ) { return a > b? a:b; }
|
||||
|
||||
/** @brief If outside the range from low to high, bring it within range. */
|
||||
#define clamp(val,low,high) ( max( (low), min((val),(high)) ) )
|
||||
|
||||
@@ -318,7 +318,7 @@ public:
|
||||
virtual ~RenderTarget_Win32();
|
||||
|
||||
void Create( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut );
|
||||
unsigned int GetTexture() const { return m_texHandle; }
|
||||
uintptr_t GetTexture() const { return static_cast<uintptr_t>(m_texHandle); }
|
||||
void StartRenderingTo();
|
||||
void FinishRenderingTo();
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
|
||||
virtual void Invalidate() { m_uTexHandle = 0; }
|
||||
virtual void Reload() { }
|
||||
virtual unsigned GetTexHandle() const
|
||||
virtual uintptr_t GetTexHandle() const
|
||||
{
|
||||
return m_uTexHandle;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ private:
|
||||
delete pSurface;
|
||||
}
|
||||
|
||||
unsigned m_uTexHandle;
|
||||
uintptr_t m_uTexHandle;
|
||||
RageSurfaceFormat m_SurfaceFormat;
|
||||
RagePixelFormat m_PixFmt;
|
||||
};
|
||||
@@ -449,7 +449,7 @@ void MovieTexture_Generic::UpdateFrame()
|
||||
|
||||
if( m_pTextureLock != nullptr )
|
||||
{
|
||||
int iHandle = m_pTextureIntermediate != nullptr? m_pTextureIntermediate->GetTexHandle(): this->GetTexHandle();
|
||||
uintptr_t iHandle = m_pTextureIntermediate != nullptr? m_pTextureIntermediate->GetTexHandle(): this->GetTexHandle();
|
||||
m_pTextureLock->Lock( iHandle, m_pSurface );
|
||||
}
|
||||
|
||||
@@ -518,7 +518,7 @@ void MovieTexture_Generic::SetPosition( float fSeconds )
|
||||
m_bWantRewind = true;
|
||||
}
|
||||
|
||||
unsigned MovieTexture_Generic::GetTexHandle() const
|
||||
uintptr_t MovieTexture_Generic::GetTexHandle() const
|
||||
{
|
||||
if( m_pRenderTarget != nullptr )
|
||||
return m_pRenderTarget->GetTexHandle();
|
||||
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
virtual void DecodeSeconds( float fSeconds );
|
||||
virtual void SetPlaybackRate( float fRate ) { m_fRate = fRate; }
|
||||
void SetLooping( bool bLooping=true ) { m_bLoop = bLooping; }
|
||||
unsigned GetTexHandle() const;
|
||||
uintptr_t GetTexHandle() const;
|
||||
|
||||
static EffectMode GetEffectMode( MovieDecoderPixelFormatYCbCr fmt );
|
||||
|
||||
@@ -110,7 +110,7 @@ private:
|
||||
|
||||
enum State { DECODER_QUIT, DECODER_RUNNING } m_State;
|
||||
|
||||
unsigned m_uTexHandle;
|
||||
uintptr_t m_uTexHandle;
|
||||
RageTextureRenderTarget *m_pRenderTarget;
|
||||
RageTexture *m_pTextureIntermediate;
|
||||
Sprite *m_pSprite;
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
MovieTexture_Null(RageTextureID ID);
|
||||
virtual ~MovieTexture_Null();
|
||||
void Invalidate() { texHandle = 0; }
|
||||
unsigned GetTexHandle() const { return texHandle; }
|
||||
uintptr_t GetTexHandle() const { return texHandle; }
|
||||
void Update(float /* delta */) { }
|
||||
void Reload() { }
|
||||
void SetPosition(float /* seconds */) { }
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
private:
|
||||
bool playing;
|
||||
bool loop;
|
||||
unsigned texHandle;
|
||||
uintptr_t texHandle;
|
||||
};
|
||||
|
||||
MovieTexture_Null::MovieTexture_Null(RageTextureID ID) : RageMovieTexture(ID)
|
||||
|
||||
+4
-4
@@ -60,7 +60,7 @@ namespace
|
||||
#endif
|
||||
|
||||
int MAXCON;
|
||||
int sock;
|
||||
uintptr_t sock;
|
||||
struct sockaddr_in addr;
|
||||
|
||||
struct sockaddr_in fromAddr;
|
||||
@@ -439,7 +439,7 @@ int EzSockets::ReadPack(char *data, unsigned int max)
|
||||
int size = PeekPack(data, max);
|
||||
|
||||
if (size != -1)
|
||||
inBuffer = inBuffer.substr(size+4);
|
||||
inBuffer = inBuffer.substr(static_cast<size_t>(size) + 4);
|
||||
|
||||
return size;
|
||||
}
|
||||
@@ -466,10 +466,10 @@ int EzSockets::PeekPack(char *data, unsigned int max)
|
||||
size = ntohl(size);
|
||||
|
||||
if (blocking)
|
||||
while (inBuffer.length()<(size+4) && !IsError())
|
||||
while (inBuffer.length()<(static_cast<size_t>(size) + 4) && !IsError())
|
||||
pUpdateRead();
|
||||
else
|
||||
if (inBuffer.length()<(size+4) || inBuffer.length()<=4)
|
||||
if (inBuffer.length()<(static_cast<size_t>(size) + 4) || inBuffer.length()<=4)
|
||||
return -1;
|
||||
|
||||
if (IsError())
|
||||
|
||||
Reference in New Issue
Block a user