HybridXFB: Fix lint errors

This commit is contained in:
iwubcode
2017-09-02 21:30:34 -05:00
parent 725d14e4c6
commit 53684701fa
39 changed files with 207 additions and 204 deletions

View File

@ -22,9 +22,9 @@ void copy_region(const T* const source, const MathUtil::Rectangle<int>& srcrect,
int destination_y = i + dstrect.top;
int destination_offset = (destination_y * dstrect.GetWidth()) + destination_x;
double src_x = std::round(destination_x*x_ratio) + srcrect.left;
double src_y = std::round(destination_y*y_ratio) + srcrect.top;
int src_offset = static_cast<int>((src_y*srcrect.GetWidth()) + src_x);
double src_x = std::round(destination_x * x_ratio) + srcrect.left;
double src_y = std::round(destination_y * y_ratio) + srcrect.top;
int src_offset = static_cast<int>((src_y * srcrect.GetWidth()) + src_x);
destination[destination_offset] = source[src_offset];
}

View File

@ -14,7 +14,6 @@
namespace EfbCopy
{
void ClearEfb()
{
u32 clearColor = (bpmem.clearcolorAR & 0xff) << 24 | bpmem.clearcolorGB << 8 |
@ -34,5 +33,4 @@ void ClearEfb()
}
}
}
}

View File

@ -497,7 +497,8 @@ u8* GetPixelPointer(u16 x, u16 y, bool depth)
return &efb[GetColorOffset(x, y)];
}
void EncodeXFB(yuv422_packed* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rect, float y_scale)
void EncodeXFB(yuv422_packed* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rect,
float y_scale)
{
if (!xfb_in_ram)
{
@ -543,8 +544,7 @@ void EncodeXFB(yuv422_packed* xfb_in_ram, u32 memory_stride, const EFBRectangle&
src_ptr[x].Y = scanline[i].Y + 16;
// we mix our color differences in 10 bit space so it will round more accurately
// U[i] = 1/4 * U[i-1] + 1/2 * U[i] + 1/4 * U[i+1]
src_ptr[x].UV =
128 + ((scanline[i - 1].U + (scanline[i].U << 1) + scanline[i + 1].U) >> 2);
src_ptr[x].UV = 128 + ((scanline[i - 1].U + (scanline[i].U << 1) + scanline[i + 1].U) >> 2);
// YV pixel
src_ptr[x + 1].Y = scanline[i + 1].Y + 16;
@ -556,7 +556,9 @@ void EncodeXFB(yuv422_packed* xfb_in_ram, u32 memory_stride, const EFBRectangle&
}
// Apply y scaling and copy to the xfb memory location
SW::copy_region(source.data(), source_rect, xfb_in_ram, EFBRectangle{ source_rect.left, source_rect.top, source_rect.right, static_cast<int>(static_cast<float>(source_rect.bottom) * y_scale) });
SW::copy_region(source.data(), source_rect, xfb_in_ram,
EFBRectangle{source_rect.left, source_rect.top, source_rect.right,
static_cast<int>(static_cast<float>(source_rect.bottom) * y_scale)});
}
bool ZCompare(u16 x, u16 y, u32 z)

View File

@ -57,7 +57,8 @@ u32 GetDepth(u16 x, u16 y);
u8* GetPixelPointer(u16 x, u16 y, bool depth);
void EncodeXFB(yuv422_packed* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rect, float y_scale);
void EncodeXFB(yuv422_packed* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rect,
float y_scale);
extern u32 perf_values[PQ_NUM_MEMBERS];
inline void IncPerfCounterQuadCount(PerfQueryType type)

View File

@ -92,7 +92,7 @@ void SWOGLWindow::PrintText(const std::string& text, int x, int y, u32 color)
void SWOGLWindow::ShowImage(AbstractTexture* image, float aspect)
{
SW::SWTexture * sw_image = static_cast<SW::SWTexture*>(image);
SW::SWTexture* sw_image = static_cast<SW::SWTexture*>(image);
GLInterface->Update(); // just updates the render window position and the backbuffer size
GLsizei glWidth = (GLsizei)GLInterface->GetBackBufferWidth();

View File

@ -31,7 +31,6 @@ public:
private:
SWOGLWindow() {}
struct TextData
{
std::string text;

View File

@ -10,7 +10,6 @@
namespace SW
{
SWTexture::SWTexture(const TextureConfig& tex_config) : AbstractTexture(tex_config)
{
}
@ -23,11 +22,12 @@ void SWTexture::CopyRectangleFromTexture(const AbstractTexture* source,
const MathUtil::Rectangle<int>& srcrect,
const MathUtil::Rectangle<int>& dstrect)
{
const SWTexture * software_source_texture = static_cast<const SWTexture*>(source);
const SWTexture* software_source_texture = static_cast<const SWTexture*>(source);
if (srcrect.GetWidth() == dstrect.GetWidth() && srcrect.GetHeight() == dstrect.GetHeight())
{
m_data.assign(software_source_texture->GetData(), software_source_texture->GetData() + m_data.size());
m_data.assign(software_source_texture->GetData(),
software_source_texture->GetData() + m_data.size());
}
else
{
@ -53,8 +53,8 @@ u8* SWTexture::GetData()
std::optional<AbstractTexture::RawTextureInfo> SWTexture::MapFullImpl()
{
return AbstractTexture::RawTextureInfo{ GetData(),
m_config.width * 4, m_config.width, m_config.height };
return AbstractTexture::RawTextureInfo{GetData(), m_config.width * 4, m_config.width,
m_config.height};
}
} // namespace SW

View File

@ -30,7 +30,6 @@ public:
u8* GetData();
private:
std::optional<RawTextureInfo> MapFullImpl() override;
std::vector<u8> m_data;

View File

@ -7,23 +7,21 @@
namespace SW
{
class TextureCache : public TextureCacheBase
{
public:
bool CompileShaders() override { return true; }
void DeleteShaders() override {}
void ConvertTexture(TCacheEntry* entry, TCacheEntry* unconverted, const void* palette,
TLUTFormat format) override
TLUTFormat format) override
{
}
void CopyEFB(u8* dst, const EFBCopyParams& params, u32 native_width, u32 bytes_per_row,
u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect,
bool scale_by_half) override
{
TextureEncoder::Encode(dst, params, native_width, bytes_per_row,
num_blocks_y, memory_stride, src_rect,
scale_by_half);
TextureEncoder::Encode(dst, params, native_width, bytes_per_row, num_blocks_y, memory_stride,
src_rect, scale_by_half);
}
private:
@ -31,7 +29,7 @@ private:
{
return std::make_unique<SWTexture>(config);
}
void CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_copy, const EFBRectangle& src_rect,
bool scale_by_half, unsigned int cbuf_id, const float* colmat) override
{
@ -39,4 +37,4 @@ private:
}
};
} // namespace SW
} // namespace SW

View File

@ -1419,63 +1419,63 @@ static void EncodeZ24halfscale(u8* dst, const u8* src, EFBCopyFormat format)
namespace
{
void EncodeEfbCopy(u8* dst, const EFBCopyParams& params, u32 native_width, u32 bytes_per_row,
u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect,
bool scale_by_half)
{
const u8* src =
EfbInterface::GetPixelPointer(src_rect.left, src_rect.top, params.depth);
if (scale_by_half)
{
switch (params.efb_format)
{
case PEControl::RGBA6_Z24:
EncodeRGBA6halfscale(dst, src, params.copy_format, params.yuv);
break;
case PEControl::RGB8_Z24:
EncodeRGB8halfscale(dst, src, params.copy_format, params.yuv);
break;
case PEControl::RGB565_Z16:
EncodeRGB8halfscale(dst, src, params.copy_format, params.yuv);
break;
case PEControl::Z24:
EncodeZ24halfscale(dst, src, params.copy_format);
break;
}
}
else
{
switch (params.efb_format)
{
case PEControl::RGBA6_Z24:
EncodeRGBA6(dst, src, params.copy_format, params.yuv);
break;
case PEControl::RGB8_Z24:
EncodeRGB8(dst, src, params.copy_format, params.yuv);
break;
case PEControl::RGB565_Z16:
EncodeRGB8(dst, src, params.copy_format, params.yuv);
break;
case PEControl::Z24:
EncodeZ24(dst, src, params.copy_format);
break;
}
}
}
}
void Encode(u8* dst, const EFBCopyParams& params, u32 native_width, u32 bytes_per_row,
u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect,
bool scale_by_half)
void EncodeEfbCopy(u8* dst, const EFBCopyParams& params, u32 native_width, u32 bytes_per_row,
u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect,
bool scale_by_half)
{
if (params.copy_format == EFBCopyFormat::XFB)
const u8* src = EfbInterface::GetPixelPointer(src_rect.left, src_rect.top, params.depth);
if (scale_by_half)
{
EfbInterface::EncodeXFB(reinterpret_cast<EfbInterface::yuv422_packed*>(dst), native_width, src_rect, params.y_scale);
switch (params.efb_format)
{
case PEControl::RGBA6_Z24:
EncodeRGBA6halfscale(dst, src, params.copy_format, params.yuv);
break;
case PEControl::RGB8_Z24:
EncodeRGB8halfscale(dst, src, params.copy_format, params.yuv);
break;
case PEControl::RGB565_Z16:
EncodeRGB8halfscale(dst, src, params.copy_format, params.yuv);
break;
case PEControl::Z24:
EncodeZ24halfscale(dst, src, params.copy_format);
break;
}
}
else
{
EncodeEfbCopy(dst, params, native_width, bytes_per_row, num_blocks_y, memory_stride, src_rect, scale_by_half);
switch (params.efb_format)
{
case PEControl::RGBA6_Z24:
EncodeRGBA6(dst, src, params.copy_format, params.yuv);
break;
case PEControl::RGB8_Z24:
EncodeRGB8(dst, src, params.copy_format, params.yuv);
break;
case PEControl::RGB565_Z16:
EncodeRGB8(dst, src, params.copy_format, params.yuv);
break;
case PEControl::Z24:
EncodeZ24(dst, src, params.copy_format);
break;
}
}
}
}
void Encode(u8* dst, const EFBCopyParams& params, u32 native_width, u32 bytes_per_row,
u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect, bool scale_by_half)
{
if (params.copy_format == EFBCopyFormat::XFB)
{
EfbInterface::EncodeXFB(reinterpret_cast<EfbInterface::yuv422_packed*>(dst), native_width,
src_rect, params.y_scale);
}
else
{
EncodeEfbCopy(dst, params, native_width, bytes_per_row, num_blocks_y, memory_stride, src_rect,
scale_by_half);
}
}
}

View File

@ -12,6 +12,5 @@ struct EFBCopyParams;
namespace TextureEncoder
{
void Encode(u8* dst, const EFBCopyParams& params, u32 native_width, u32 bytes_per_row,
u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect,
bool scale_by_half);
u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect, bool scale_by_half);
}