TextureBorderColor & cellFont problems fixed

* Fixed tabs/spaces problem in cellSysutil.h too.

NOTE: The problem with cellFont (crash on line 604) has been fixed, but
for a high price: There is now a huge memory leak when a NULL pointer is
passed to cellFontRenderSurfaceInit.
This commit is contained in:
Alexandro Sánchez Bach 2014-03-18 17:45:26 +01:00
parent fb38897b8f
commit 2601933bdc
8 changed files with 96 additions and 93 deletions

View File

@ -1150,10 +1150,6 @@ void GLGSRender::Flip()
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_ONE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
if(m_set_texture_border_color)
{
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_BORDER_COLOR,(GLint)m_border_color);
}
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

View File

@ -241,6 +241,10 @@ public:
checkForGlError("GLTexture::Init() -> filters");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, (tex.GetBorderColor() << 8) | (tex.GetBorderColor() >> 24));
checkForGlError("GLTexture::Init() -> border color");
//Unbind();
if(is_swizzled && format == CELL_GCM_TEXTURE_A8R8G8B8)

View File

@ -38,6 +38,9 @@ void RSXTexture::Init()
// Image Rect
methodRegisters[NV4097_SET_TEXTURE_IMAGE_RECT + (m_index*32)] = (/*height*/1) | ((/*width*/1) << 16);
// Border Color
methodRegisters[NV4097_SET_TEXTURE_BORDER_COLOR + (m_index*32)] = 0;
}
u32 RSXTexture::GetOffset() const
@ -195,6 +198,11 @@ u16 RSXTexture::GetHeight() const
return ((methodRegisters[NV4097_SET_TEXTURE_IMAGE_RECT + (m_index*32)]) & 0xffff);
}
u32 RSXTexture::GetBorderColor() const
{
return methodRegisters[NV4097_SET_TEXTURE_BORDER_COLOR + (m_index*32)];
}
void RSXTexture::SetControl3(u16 depth, u32 pitch)
{
m_depth = depth;

View File

@ -58,5 +58,8 @@ public:
u16 GetWidth() const;
u16 GetHeight() const;
// Border Color
u32 GetBorderColor() const;
void SetControl3(u16 depth, u32 pitch);
};

View File

@ -322,12 +322,8 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
}
break;
case NV4097_SET_TEXTURE_BORDER_COLOR:
case_16(NV4097_SET_TEXTURE_BORDER_COLOR,0x20):
{
m_set_texture_border_color = true;
u32 tmp = ARGS(0);
m_border_color=((tmp & 0x00FFFFFF)<<8)|((tmp & 0xFF000000)>>24);
break;
}
case NV4097_SET_SURFACE_FORMAT:

View File

@ -272,9 +272,6 @@ public:
u8 m_blend_color_b;
u8 m_blend_color_a;
bool m_set_texture_border_color;
u32 m_border_color;
u8 m_clear_color_r;
u8 m_clear_color_g;
u8 m_clear_color_b;
@ -403,7 +400,6 @@ protected:
{
m_set_alpha_test = false;
m_set_blend = false;
m_set_texture_border_color = false;
m_set_depth_bounds_test = false;
m_depth_test_enable = false;
m_set_logic_op = false;
@ -423,8 +419,6 @@ protected:
m_clear_z = 0xffffff;
m_clear_s = 0;
m_border_color = 0;
m_depth_bounds_min = 0.0;
m_depth_bounds_max = 1.0;
m_restart_index = 0xffffffff;
@ -448,7 +442,6 @@ protected:
void Reset()
{
m_set_color_mask = false;
m_set_texture_border_color = false;
m_set_clip = false;
m_set_depth_func = false;
m_set_depth_bounds = false;

View File

@ -459,6 +459,9 @@ void cellFontRenderSurfaceInit(mem_ptr_t<CellFontRenderSurface> surface, u32 buf
surface->pixelSizeByte = pixelSizeByte;
surface->width = w;
surface->height = h;
if (!buffer_addr)
surface->buffer_addr = Memory.Alloc(bufferWidthByte * h, 1); // TODO: Huge memory leak
}
void cellFontRenderSurfaceSetScissor(mem_ptr_t<CellFontRenderSurface> surface, s32 x0, s32 y0, s32 w, s32 h)