Formatting/Whitespace Cleanup

Various fixes to formatting and whitespace
This commit is contained in:
Stevoisiak
2015-02-15 14:43:31 -05:00
parent b8edd8aedc
commit 93b16a4a2d
97 changed files with 673 additions and 657 deletions

View File

@ -39,7 +39,7 @@ static u32 InterpretDisplayList(u32 address, u32 size)
u8* startAddress;
if (g_use_deterministic_gpu_thread)
startAddress = (u8*) PopFifoAuxBuffer(size);
startAddress = (u8*)PopFifoAuxBuffer(size);
else
startAddress = Memory::GetPointer(address);

View File

@ -120,7 +120,7 @@ void Renderer::RenderToXFB(u32 xfbAddr, const EFBRectangle& sourceRc, u32 fbWidt
if (g_ActiveConfig.bUseXFB)
{
FramebufferManagerBase::CopyToXFB(xfbAddr, fbWidth, fbHeight, sourceRc,Gamma);
FramebufferManagerBase::CopyToXFB(xfbAddr, fbWidth, fbHeight, sourceRc, Gamma);
}
else
{
@ -328,7 +328,6 @@ void Renderer::DrawDebugText()
if ((u32)OSDTime > Common::Timer::GetTimeMs())
{
const char* res_text = "";
switch (g_ActiveConfig.iEFBScale)
{
@ -387,7 +386,7 @@ void Renderer::DrawDebugText()
std::string("Fog: ") + (g_ActiveConfig.bDisableFog ? "Disabled" : "Enabled"),
};
enum { lines_count = sizeof(lines)/sizeof(*lines) };
enum { lines_count = sizeof(lines) / sizeof(*lines) };
// The latest changed setting in yellow
for (int i = 0; i != lines_count; ++i)
@ -437,34 +436,34 @@ void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height)
// Update aspect ratio hack values
// Won't take effect until next frame
// Don't know if there is a better place for this code so there isn't a 1 frame delay
if ( g_ActiveConfig.bWidescreenHack )
if (g_ActiveConfig.bWidescreenHack)
{
float source_aspect = use16_9 ? (16.0f / 9.0f) : (4.0f / 3.0f);
float target_aspect;
switch ( g_ActiveConfig.iAspectRatio )
switch (g_ActiveConfig.iAspectRatio)
{
case ASPECT_FORCE_16_9 :
case ASPECT_FORCE_16_9:
target_aspect = 16.0f / 9.0f;
break;
case ASPECT_FORCE_4_3 :
case ASPECT_FORCE_4_3:
target_aspect = 4.0f / 3.0f;
break;
case ASPECT_STRETCH :
case ASPECT_STRETCH:
target_aspect = WinWidth / WinHeight;
break;
default :
default:
// ASPECT_AUTO == no hacking
target_aspect = source_aspect;
break;
}
float adjust = source_aspect / target_aspect;
if ( adjust > 1 )
if (adjust > 1)
{
// Vert+
g_Config.fAspectRatioHackW = 1;
g_Config.fAspectRatioHackH = 1/adjust;
g_Config.fAspectRatioHackH = 1 / adjust;
}
else
{

View File

@ -113,7 +113,6 @@ class ShaderCode : public ShaderGeneratorInterface
public:
ShaderCode() : buf(nullptr), write_ptr(nullptr)
{
}
void Write(const char* fmt, ...)
@ -142,7 +141,7 @@ public:
inline void SetConstantsUsed(unsigned int first_index, unsigned int last_index)
{
for (unsigned int i = first_index; i < last_index+1; ++i)
for (unsigned int i = first_index; i < last_index + 1; ++i)
constant_usage[i] = true;
}
@ -198,7 +197,7 @@ public:
u8 value = new_uid.GetUidDataRaw()[i];
if ((i % 4) == 0)
{
auto last_value = (i+3 < new_uid.GetUidDataSize()-1) ? i+3 : new_uid.GetUidDataSize();
auto last_value = (i + 3 < new_uid.GetUidDataSize() - 1) ? i + 3 : new_uid.GetUidDataSize();
file << std::setfill(' ') << std::dec;
file << "Values " << std::setw(2) << i << " - " << last_value << ": ";
}
@ -216,7 +215,7 @@ public:
}
private:
std::map<UidT,std::string> m_shaders;
std::map<UidT, std::string> m_shaders;
std::vector<UidT> m_uids;
};

View File

@ -46,9 +46,9 @@ std::string Statistics::ToString()
str += StringFromFormat("CP loads (DL): %i\n", stats.thisFrame.numCPLoadsInDL);
str += StringFromFormat("BP loads: %i\n", stats.thisFrame.numBPLoads);
str += StringFromFormat("BP loads (DL): %i\n", stats.thisFrame.numBPLoadsInDL);
str += StringFromFormat("Vertex streamed: %i kB\n", stats.thisFrame.bytesVertexStreamed/1024);
str += StringFromFormat("Index streamed: %i kB\n", stats.thisFrame.bytesIndexStreamed/1024);
str += StringFromFormat("Uniform streamed: %i kB\n", stats.thisFrame.bytesUniformStreamed/1024);
str += StringFromFormat("Vertex streamed: %i kB\n", stats.thisFrame.bytesVertexStreamed / 1024);
str += StringFromFormat("Index streamed: %i kB\n", stats.thisFrame.bytesIndexStreamed / 1024);
str += StringFromFormat("Uniform streamed: %i kB\n", stats.thisFrame.bytesUniformStreamed / 1024);
str += StringFromFormat("Vertex Loaders: %i\n", stats.numVertexLoaders);
std::string vertex_list;

View File

@ -140,7 +140,7 @@ void TextureCache::Cleanup(int _frameCount)
TexCache::iterator tcend = textures.end();
while (iter != tcend)
{
if(iter->second->frameCount == FRAMECOUNT_INVALID)
if (iter->second->frameCount == FRAMECOUNT_INVALID)
{
iter->second->frameCount = _frameCount;
}
@ -161,7 +161,7 @@ void TextureCache::Cleanup(int _frameCount)
TexPool::iterator tcend2 = texture_pool.end();
while (iter2 != tcend2)
{
if(iter2->second->frameCount == FRAMECOUNT_INVALID)
if (iter2->second->frameCount == FRAMECOUNT_INVALID)
{
iter2->second->frameCount = _frameCount;
}
@ -467,7 +467,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
}
else
{
u8* src_data_gb = &texMem[bpmem.tex[stage/4].texImage2[stage%4].tmem_odd * TMEM_LINE_SIZE];
u8* src_data_gb = &texMem[bpmem.tex[stage / 4].texImage2[stage % 4].tmem_odd * TMEM_LINE_SIZE];
TexDecoder_DecodeRGBA8FromTmem(temp, src_data, src_data_gb, expandedWidth, expandedHeight);
}
}
@ -520,8 +520,8 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
const u8* ptr_odd = nullptr;
if (from_tmem)
{
ptr_even = &texMem[bpmem.tex[stage/4].texImage1[stage%4].tmem_even * TMEM_LINE_SIZE + texture_size];
ptr_odd = &texMem[bpmem.tex[stage/4].texImage2[stage%4].tmem_odd * TMEM_LINE_SIZE];
ptr_even = &texMem[bpmem.tex[stage / 4].texImage1[stage % 4].tmem_even * TMEM_LINE_SIZE + texture_size];
ptr_odd = &texMem[bpmem.tex[stage / 4].texImage2[stage % 4].tmem_odd * TMEM_LINE_SIZE];
}
for (; level != texLevels; ++level)
@ -535,7 +535,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
? ((level % 2) ? ptr_odd : ptr_even)
: src_data;
const u8* tlut = &texMem[tlutaddr];
TexDecoder_Decode(temp, mip_src_data, expanded_mip_width, expanded_mip_height, texformat, tlut, (TlutFormat) tlutfmt);
TexDecoder_Decode(temp, mip_src_data, expanded_mip_width, expanded_mip_height, texformat, tlut, (TlutFormat)tlutfmt);
mip_src_data += TexDecoder_GetTextureSizeInBytes(expanded_mip_width, expanded_mip_height, texformat);
entry->Load(mip_width, mip_height, expanded_mip_width, level);
@ -669,7 +669,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat
}
else if (isIntensity)
{
fConstAdd[0] = fConstAdd[1] = fConstAdd[2] = 16.0f/255.0f;
fConstAdd[0] = fConstAdd[1] = fConstAdd[2] = 16.0f / 255.0f;
switch (dstFormat)
{
case 0: // I4
@ -685,7 +685,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat
if (dstFormat < 2 || dstFormat == 8)
{
colmat[12] = 0.257f; colmat[13] = 0.504f; colmat[14] = 0.098f;
fConstAdd[3] = 16.0f/255.0f;
fConstAdd[3] = 16.0f / 255.0f;
if (dstFormat == 0)
{
ColorMask[0] = ColorMask[1] = ColorMask[2] = 15.0f;
@ -841,8 +841,8 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat
}
}
const unsigned int tex_w = scaleByHalf ? srcRect.GetWidth()/2 : srcRect.GetWidth();
const unsigned int tex_h = scaleByHalf ? srcRect.GetHeight()/2 : srcRect.GetHeight();
const unsigned int tex_w = scaleByHalf ? srcRect.GetWidth() / 2 : srcRect.GetWidth();
const unsigned int tex_h = scaleByHalf ? srcRect.GetHeight() / 2 : srcRect.GetHeight();
unsigned int scaled_tex_w = g_ActiveConfig.bCopyEFBScaled ? Renderer::EFBToScaledX(tex_w) : tex_w;
unsigned int scaled_tex_h = g_ActiveConfig.bCopyEFBScaled ? Renderer::EFBToScaledY(tex_h) : tex_h;

View File

@ -41,7 +41,6 @@ public:
return std::hash<u64>::operator()(id);
}
};
};
struct TCacheEntryBase
{

View File

@ -9,7 +9,7 @@
enum
{
TMEM_SIZE = 1024*1024,
TMEM_SIZE = 1024 * 1024,
TMEM_LINE_SIZE = 32,
};
extern GC_ALIGNED16(u8 texMem[TMEM_SIZE]);

View File

@ -10,8 +10,8 @@
#include "VideoCommon/sfont.inc"
#include "VideoCommon/TextureDecoder.h"
static bool TexFmt_Overlay_Enable=false;
static bool TexFmt_Overlay_Center=false;
static bool TexFmt_Overlay_Enable = false;
static bool TexFmt_Overlay_Center = false;
// TRAM
// STATE_TO_SAVE
@ -185,11 +185,11 @@ static void TexDecoder_DrawOverlay(u8 *dst, int width, int height, int texformat
if (!TexFmt_Overlay_Center)
{
xoff=0;
yoff=0;
xoff = 0;
yoff = 0;
}
const char* fmt = texfmt[texformat&15];
const char* fmt = texfmt[texformat & 15];
while (*fmt)
{
int xcnt = 0;
@ -197,16 +197,16 @@ static void TexDecoder_DrawOverlay(u8 *dst, int width, int height, int texformat
const unsigned char *ptr = sfont_raw[nchar]; // each char is up to 9x10
for (int x = 0; x < 9;x++)
for (int x = 0; x < 9; x++)
{
if (ptr[x] == 0x78)
break;
xcnt++;
}
for (int y=0; y < 10; y++)
for (int y = 0; y < 10; y++)
{
for (int x=0; x < xcnt; x++)
for (int x = 0; x < xcnt; x++)
{
int *dtp = (int*)dst;
dtp[(y + yoff) * width + x + xoff] = ptr[x] ? 0xFFFFFFFF : 0xFF000000;
@ -230,7 +230,7 @@ static inline u32 DecodePixel_IA8(u16 val)
{
int a = val & 0xFF;
int i = val >> 8;
return i | (i<<8) | (i<<16) | (a<<24);
return i | (i << 8) | (i << 16) | (a << 24);
}
static inline u32 DecodePixel_RGB565(u16 val)

View File

@ -92,7 +92,7 @@ void VertexLoader::CompileVertexTranslator()
WriteCall(BoundingBox::SetVertexBufferPosition);
// Colors
const u64 col[2] = {m_VtxDesc.Color0, m_VtxDesc.Color1};
const u64 col[2] = { m_VtxDesc.Color0, m_VtxDesc.Color1 };
// TextureCoord
const u64 tc[8] = {
m_VtxDesc.Tex0Coord, m_VtxDesc.Tex1Coord, m_VtxDesc.Tex2Coord, m_VtxDesc.Tex3Coord,
@ -118,14 +118,14 @@ void VertexLoader::CompileVertexTranslator()
m_VertexSize += 1;
}
if (m_VtxDesc.Tex0MatIdx) {m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX0; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex1MatIdx) {m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX1; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex2MatIdx) {m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX2; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex3MatIdx) {m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX3; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex4MatIdx) {m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX4; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex5MatIdx) {m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX5; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex6MatIdx) {m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX6; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex7MatIdx) {m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX7; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex0MatIdx) { m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX0; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex1MatIdx) { m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX1; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex2MatIdx) { m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX2; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex3MatIdx) { m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX3; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex4MatIdx) { m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX4; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex5MatIdx) { m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX5; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex6MatIdx) { m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX6; WriteCall(TexMtx_ReadDirect_UByte); }
if (m_VtxDesc.Tex7MatIdx) { m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX7; WriteCall(TexMtx_ReadDirect_UByte); }
// Write vertex position loader
WriteCall(VertexLoader_Position::GetFunction(m_VtxDesc.Position, m_VtxAttr.PosFormat, m_VtxAttr.PosElements));

View File

@ -100,7 +100,7 @@ void VertexLoaderBase::AppendToString(std::string *dest) const
m_VtxAttr.NormalElements, posMode[m_VtxDesc.Normal], posFormats[m_VtxAttr.NormalFormat]));
}
u64 color_mode[2] = {m_VtxDesc.Color0, m_VtxDesc.Color1};
u64 color_mode[2] = { m_VtxDesc.Color0, m_VtxDesc.Color1 };
for (int i = 0; i < 2; i++)
{
if (color_mode[i])

View File

@ -16,7 +16,7 @@ static const X64Reg scratch3 = ABI_PARAM4;
static const X64Reg count_reg = R10;
static const X64Reg skipped_reg = R11;
VertexLoaderX64::VertexLoaderX64(const TVtxDesc& vtx_desc, const VAT& vtx_att): VertexLoaderBase(vtx_desc, vtx_att)
VertexLoaderX64::VertexLoaderX64(const TVtxDesc& vtx_desc, const VAT& vtx_att) : VertexLoaderBase(vtx_desc, vtx_att)
{
if (!IsInitialized())
return;
@ -97,7 +97,7 @@ int VertexLoaderX64::ReadVertex(OpArg data, u64 attribute, int format, int count
X64Reg coords = XMM0;
int elem_size = 1 << (format / 2);
int load_bytes = elem_size * count_in;
int load_bytes = elem_size * count_in;
if (load_bytes >= 8)
MOVDQU(coords, data);
else if (load_bytes >= 4)
@ -337,7 +337,7 @@ void VertexLoaderX64::GenerateVertexLoader()
if (m_VtxDesc.Normal)
{
static const u8 map[8] = {7, 6, 15, 14};
static const u8 map[8] = { 7, 6, 15, 14 };
u8 scaling_exponent = map[m_VtxAttr.NormalFormat];
for (int i = 0; i < (m_VtxAttr.NormalElements ? 3 : 1); i++)
@ -357,7 +357,7 @@ void VertexLoaderX64::GenerateVertexLoader()
m_native_components |= VB_HAS_NRM1 | VB_HAS_NRM2;
}
const u64 col[2] = {m_VtxDesc.Color0, m_VtxDesc.Color1};
const u64 col[2] = { m_VtxDesc.Color0, m_VtxDesc.Color1 };
for (int i = 0; i < 2; i++)
{
if (col[i])

View File

@ -100,7 +100,7 @@ template <typename I>
void Color_ReadIndex_16b_565(VertexLoader* loader)
{
auto const Index = DataRead<I>();
u16 val = Common::swap16(*(const u16 *)(cached_arraybases[ARRAY_COLOR+loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR+loader->m_colIndex])));
u16 val = Common::swap16(*(const u16 *)(cached_arraybases[ARRAY_COLOR + loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR + loader->m_colIndex])));
_SetCol565(loader, val);
}
@ -108,7 +108,7 @@ template <typename I>
void Color_ReadIndex_24b_888(VertexLoader* loader)
{
auto const Index = DataRead<I>();
const u8 *iAddress = cached_arraybases[ARRAY_COLOR+loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR+loader->m_colIndex]);
const u8 *iAddress = cached_arraybases[ARRAY_COLOR + loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR + loader->m_colIndex]);
_SetCol(loader, _Read24(iAddress));
}
@ -116,7 +116,7 @@ template <typename I>
void Color_ReadIndex_32b_888x(VertexLoader* loader)
{
auto const Index = DataRead<I>();
const u8 *iAddress = cached_arraybases[ARRAY_COLOR+loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR+loader->m_colIndex]);
const u8 *iAddress = cached_arraybases[ARRAY_COLOR + loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR + loader->m_colIndex]);
_SetCol(loader, _Read24(iAddress));
}
@ -124,7 +124,7 @@ template <typename I>
void Color_ReadIndex_16b_4444(VertexLoader* loader)
{
auto const Index = DataRead<I>();
u16 val = *(const u16 *)(cached_arraybases[ARRAY_COLOR+loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR+loader->m_colIndex]));
u16 val = *(const u16 *)(cached_arraybases[ARRAY_COLOR + loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR + loader->m_colIndex]));
_SetCol4444(loader, val);
}
@ -132,7 +132,7 @@ template <typename I>
void Color_ReadIndex_24b_6666(VertexLoader* loader)
{
auto const Index = DataRead<I>();
const u8* pData = cached_arraybases[ARRAY_COLOR+loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR+loader->m_colIndex]) - 1;
const u8* pData = cached_arraybases[ARRAY_COLOR + loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR + loader->m_colIndex]) - 1;
u32 val = Common::swap32(pData);
_SetCol6666(loader, val);
}
@ -141,7 +141,7 @@ template <typename I>
void Color_ReadIndex_32b_8888(VertexLoader* loader)
{
auto const Index = DataRead<I>();
const u8 *iAddress = cached_arraybases[ARRAY_COLOR+loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR+loader->m_colIndex]);
const u8 *iAddress = cached_arraybases[ARRAY_COLOR + loader->m_colIndex] + (Index * g_main_cp_state.array_strides[ARRAY_COLOR + loader->m_colIndex]);
_SetCol(loader, _Read32(iAddress));
}

View File

@ -31,7 +31,7 @@ void LOADERDECL Pos_ReadDirect(VertexLoader* loader)
DataReader src(g_video_buffer_read_ptr, nullptr);
for (int i = 0; i < 3; ++i)
dst.Write(i<N ? PosScale(src.Read<T>(), scale) : 0.f);
dst.Write(i < N ? PosScale(src.Read<T>(), scale) : 0.f);
g_vertex_manager_write_ptr = dst.GetPointer();
g_video_buffer_read_ptr = src.GetPointer();
@ -51,7 +51,7 @@ void LOADERDECL Pos_ReadIndex(VertexLoader* loader)
DataReader dst(g_vertex_manager_write_ptr, nullptr);
for (int i = 0; i < 3; ++i)
dst.Write(i<N ? PosScale(Common::FromBigEndian(data[i]), scale) : 0.f);
dst.Write(i < N ? PosScale(Common::FromBigEndian(data[i]), scale) : 0.f);
g_vertex_manager_write_ptr = dst.GetPointer();
LOG_VTX();

View File

@ -32,10 +32,10 @@ private:
static const u32 MAX_PRIMITIVES_PER_COMMAND = (u16)-1;
public:
static const u32 MAXVBUFFERSIZE = ROUND_UP_POW2 (MAX_PRIMITIVES_PER_COMMAND * LARGEST_POSSIBLE_VERTEX);
static const u32 MAXVBUFFERSIZE = ROUND_UP_POW2(MAX_PRIMITIVES_PER_COMMAND * LARGEST_POSSIBLE_VERTEX);
// We may convert triangle-fans to triangle-lists, almost 3x as many indices.
static const u32 MAXIBUFFERSIZE = ROUND_UP_POW2 (MAX_PRIMITIVES_PER_COMMAND * 3);
static const u32 MAXIBUFFERSIZE = ROUND_UP_POW2(MAX_PRIMITIVES_PER_COMMAND * 3);
VertexManager();
// needs to be virtual for DX11's dtor

View File

@ -133,7 +133,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
// transforms
if (components & VB_HAS_POSMTXIDX)
{
if (is_writing_shadercode && (DriverDetails::HasBug(DriverDetails::BUG_NODYNUBOACCESS) && !DriverDetails::HasBug(DriverDetails::BUG_ANNIHILATEDUBOS)) )
if (is_writing_shadercode && (DriverDetails::HasBug(DriverDetails::BUG_NODYNUBOACCESS) && !DriverDetails::HasBug(DriverDetails::BUG_ANNIHILATEDUBOS)))
{
// This'll cause issues, but it can't be helped
out.Write("float4 pos = float4(dot(" I_TRANSFORMMATRICES"[0], rawpos), dot(" I_TRANSFORMMATRICES"[1], rawpos), dot(" I_TRANSFORMMATRICES"[2], rawpos), 1);\n");
@ -218,36 +218,36 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
switch (texinfo.sourcerow)
{
case XF_SRCGEOM_INROW:
_assert_( texinfo.inputform == XF_TEXINPUT_ABC1 );
_assert_(texinfo.inputform == XF_TEXINPUT_ABC1);
out.Write("coord = rawpos;\n"); // pos.w is 1
break;
case XF_SRCNORMAL_INROW:
if (components & VB_HAS_NRM0)
{
_assert_( texinfo.inputform == XF_TEXINPUT_ABC1 );
_assert_(texinfo.inputform == XF_TEXINPUT_ABC1);
out.Write("coord = float4(rawnorm0.xyz, 1.0);\n");
}
break;
case XF_SRCCOLORS_INROW:
_assert_( texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC0 || texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC1 );
_assert_(texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC0 || texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC1);
break;
case XF_SRCBINORMAL_T_INROW:
if (components & VB_HAS_NRM1)
{
_assert_( texinfo.inputform == XF_TEXINPUT_ABC1 );
_assert_(texinfo.inputform == XF_TEXINPUT_ABC1);
out.Write("coord = float4(rawnorm1.xyz, 1.0);\n");
}
break;
case XF_SRCBINORMAL_B_INROW:
if (components & VB_HAS_NRM2)
{
_assert_( texinfo.inputform == XF_TEXINPUT_ABC1 );
_assert_(texinfo.inputform == XF_TEXINPUT_ABC1);
out.Write("coord = float4(rawnorm2.xyz, 1.0);\n");
}
break;
default:
_assert_(texinfo.sourcerow <= XF_SRCTEX7_INROW);
if (components & (VB_HAS_UV0<<(texinfo.sourcerow - XF_SRCTEX0_INROW)) )
if (components & (VB_HAS_UV0 << (texinfo.sourcerow - XF_SRCTEX0_INROW)))
out.Write("coord = float4(tex%d.x, tex%d.y, 1.0, 1.0);\n", texinfo.sourcerow - XF_SRCTEX0_INROW, texinfo.sourcerow - XF_SRCTEX0_INROW);
break;
}
@ -314,7 +314,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
out.Write("float4 P0 = " I_POSTTRANSFORMMATRICES"[%d];\n"
"float4 P1 = " I_POSTTRANSFORMMATRICES"[%d];\n"
"float4 P2 = " I_POSTTRANSFORMMATRICES"[%d];\n",
postidx&0x3f, (postidx+1)&0x3f, (postidx+2)&0x3f);
postidx & 0x3f, (postidx + 1) & 0x3f, (postidx + 2) & 0x3f);
if (texGenSpecialCase)
{

View File

@ -60,10 +60,10 @@ static float PHackValue(std::string sValue)
float f = 0;
bool fp = false;
const char *cStr = sValue.c_str();
char *c = new char[strlen(cStr)+1];
char *c = new char[strlen(cStr) + 1];
std::istringstream sTof("");
for (unsigned int i=0; i<=strlen(cStr); ++i)
for (unsigned int i = 0; i <= strlen(cStr); ++i)
{
if (i == 20)
{
@ -71,7 +71,7 @@ static float PHackValue(std::string sValue)
break;
}
c[i] = (cStr[i] == ',') ? '.' : *(cStr+i);
c[i] = (cStr[i] == ',') ? '.' : *(cStr + i);
if (c[i] == '.')
fp = true;
}
@ -83,7 +83,7 @@ static float PHackValue(std::string sValue)
if (!fp)
f /= 0xF4240;
delete [] c;
delete[] c;
return f;
}
@ -159,10 +159,10 @@ static void ViewportCorrectionMatrix(Matrix44& result)
if (Wd == 0 || Ht == 0)
return;
result.data[4*0+0] = intendedWd / Wd;
result.data[4*0+3] = (intendedWd - 2.f * (X - intendedX)) / Wd - 1.f;
result.data[4*1+1] = intendedHt / Ht;
result.data[4*1+3] = (-intendedHt + 2.f * (Y - intendedY)) / Ht + 1.f;
result.data[4*0 + 0] = intendedWd / Wd;
result.data[4*0 + 3] = (intendedWd - 2.f * (X - intendedX)) / Wd - 1.f;
result.data[4*1 + 1] = intendedHt / Ht;
result.data[4*1 + 3] = (-intendedHt + 2.f * (Y - intendedY)) / Ht + 1.f;
}
void VertexShaderManager::Init()
@ -184,7 +184,7 @@ void VertexShaderManager::Init()
bViewportChanged = false;
memset(&xfmem, 0, sizeof(xfmem));
memset(&constants, 0 , sizeof(constants));
memset(&constants, 0, sizeof(constants));
ResetView();
// TODO: should these go inside ResetView()?
@ -226,7 +226,7 @@ void VertexShaderManager::SetConstants()
{
int startn = nNormalMatricesChanged[0] / 3;
int endn = (nNormalMatricesChanged[1] + 2) / 3;
for (int i=startn; i<endn; i++)
for (int i = startn; i < endn; i++)
{
memcpy(constants.normalmatrices[i], &xfmem.normalMatrices[3*i], 12);
}
@ -237,7 +237,7 @@ void VertexShaderManager::SetConstants()
if (nPostTransformMatricesChanged[0] >= 0)
{
int startn = nPostTransformMatricesChanged[0] / 4;
int endn = (nPostTransformMatricesChanged[1] + 3 ) / 4;
int endn = (nPostTransformMatricesChanged[1] + 3) / 4;
memcpy(constants.posttransformmatrices[startn], &xfmem.postMatrices[startn * 4], (endn - startn) * 16);
dirty = true;
nPostTransformMatricesChanged[0] = nPostTransformMatricesChanged[1] = -1;
@ -315,8 +315,8 @@ void VertexShaderManager::SetConstants()
const float *pos = (const float *)xfmem.posMatrices + g_main_cp_state.matrix_index_a.PosNormalMtxIdx * 4;
const float *norm = (const float *)xfmem.normalMatrices + 3 * (g_main_cp_state.matrix_index_a.PosNormalMtxIdx & 31);
memcpy(constants.posnormalmatrix, pos, 3*16);
memcpy(constants.posnormalmatrix[3], norm, 12);
memcpy(constants.posnormalmatrix, pos, 3*16);
memcpy(constants.posnormalmatrix[3], norm, 12);
memcpy(constants.posnormalmatrix[4], norm+3, 12);
memcpy(constants.posnormalmatrix[5], norm+6, 12);
dirty = true;
@ -335,7 +335,7 @@ void VertexShaderManager::SetConstants()
for (int i = 0; i < 4; ++i)
{
memcpy(constants.texmatrices[3*i], fptrs[i], 3*16);
memcpy(constants.texmatrices[3 * i], fptrs[i], 3 * 16);
}
dirty = true;
}
@ -352,7 +352,7 @@ void VertexShaderManager::SetConstants()
for (int i = 0; i < 4; ++i)
{
memcpy(constants.texmatrices[3*i+12], fptrs[i], 3*16);
memcpy(constants.texmatrices[3*i + 12], fptrs[i], 3*16);
}
dirty = true;
}
@ -417,16 +417,16 @@ void VertexShaderManager::SetConstants()
g_fProjectionMatrix[14] = -1.0f;
g_fProjectionMatrix[15] = 0.0f;
SETSTAT_FT(stats.gproj_0, g_fProjectionMatrix[0]);
SETSTAT_FT(stats.gproj_1, g_fProjectionMatrix[1]);
SETSTAT_FT(stats.gproj_2, g_fProjectionMatrix[2]);
SETSTAT_FT(stats.gproj_3, g_fProjectionMatrix[3]);
SETSTAT_FT(stats.gproj_4, g_fProjectionMatrix[4]);
SETSTAT_FT(stats.gproj_5, g_fProjectionMatrix[5]);
SETSTAT_FT(stats.gproj_6, g_fProjectionMatrix[6]);
SETSTAT_FT(stats.gproj_7, g_fProjectionMatrix[7]);
SETSTAT_FT(stats.gproj_8, g_fProjectionMatrix[8]);
SETSTAT_FT(stats.gproj_9, g_fProjectionMatrix[9]);
SETSTAT_FT(stats.gproj_0, g_fProjectionMatrix[0]);
SETSTAT_FT(stats.gproj_1, g_fProjectionMatrix[1]);
SETSTAT_FT(stats.gproj_2, g_fProjectionMatrix[2]);
SETSTAT_FT(stats.gproj_3, g_fProjectionMatrix[3]);
SETSTAT_FT(stats.gproj_4, g_fProjectionMatrix[4]);
SETSTAT_FT(stats.gproj_5, g_fProjectionMatrix[5]);
SETSTAT_FT(stats.gproj_6, g_fProjectionMatrix[6]);
SETSTAT_FT(stats.gproj_7, g_fProjectionMatrix[7]);
SETSTAT_FT(stats.gproj_8, g_fProjectionMatrix[8]);
SETSTAT_FT(stats.gproj_9, g_fProjectionMatrix[9]);
SETSTAT_FT(stats.gproj_10, g_fProjectionMatrix[10]);
SETSTAT_FT(stats.gproj_11, g_fProjectionMatrix[11]);
SETSTAT_FT(stats.gproj_12, g_fProjectionMatrix[12]);
@ -460,28 +460,28 @@ void VertexShaderManager::SetConstants()
// Hack to fix depth clipping precision issues (such as Sonic Unleashed UI)
g_fProjectionMatrix[15] = 1.0f + FLT_EPSILON;
SETSTAT_FT(stats.g2proj_0, g_fProjectionMatrix[0]);
SETSTAT_FT(stats.g2proj_1, g_fProjectionMatrix[1]);
SETSTAT_FT(stats.g2proj_2, g_fProjectionMatrix[2]);
SETSTAT_FT(stats.g2proj_3, g_fProjectionMatrix[3]);
SETSTAT_FT(stats.g2proj_4, g_fProjectionMatrix[4]);
SETSTAT_FT(stats.g2proj_5, g_fProjectionMatrix[5]);
SETSTAT_FT(stats.g2proj_6, g_fProjectionMatrix[6]);
SETSTAT_FT(stats.g2proj_7, g_fProjectionMatrix[7]);
SETSTAT_FT(stats.g2proj_8, g_fProjectionMatrix[8]);
SETSTAT_FT(stats.g2proj_9, g_fProjectionMatrix[9]);
SETSTAT_FT(stats.g2proj_0, g_fProjectionMatrix[0]);
SETSTAT_FT(stats.g2proj_1, g_fProjectionMatrix[1]);
SETSTAT_FT(stats.g2proj_2, g_fProjectionMatrix[2]);
SETSTAT_FT(stats.g2proj_3, g_fProjectionMatrix[3]);
SETSTAT_FT(stats.g2proj_4, g_fProjectionMatrix[4]);
SETSTAT_FT(stats.g2proj_5, g_fProjectionMatrix[5]);
SETSTAT_FT(stats.g2proj_6, g_fProjectionMatrix[6]);
SETSTAT_FT(stats.g2proj_7, g_fProjectionMatrix[7]);
SETSTAT_FT(stats.g2proj_8, g_fProjectionMatrix[8]);
SETSTAT_FT(stats.g2proj_9, g_fProjectionMatrix[9]);
SETSTAT_FT(stats.g2proj_10, g_fProjectionMatrix[10]);
SETSTAT_FT(stats.g2proj_11, g_fProjectionMatrix[11]);
SETSTAT_FT(stats.g2proj_12, g_fProjectionMatrix[12]);
SETSTAT_FT(stats.g2proj_13, g_fProjectionMatrix[13]);
SETSTAT_FT(stats.g2proj_14, g_fProjectionMatrix[14]);
SETSTAT_FT(stats.g2proj_15, g_fProjectionMatrix[15]);
SETSTAT_FT(stats.proj_0, rawProjection[0]);
SETSTAT_FT(stats.proj_1, rawProjection[1]);
SETSTAT_FT(stats.proj_2, rawProjection[2]);
SETSTAT_FT(stats.proj_3, rawProjection[3]);
SETSTAT_FT(stats.proj_4, rawProjection[4]);
SETSTAT_FT(stats.proj_5, rawProjection[5]);
SETSTAT_FT(stats.proj_0, rawProjection[0]);
SETSTAT_FT(stats.proj_1, rawProjection[1]);
SETSTAT_FT(stats.proj_2, rawProjection[2]);
SETSTAT_FT(stats.proj_3, rawProjection[3]);
SETSTAT_FT(stats.proj_4, rawProjection[4]);
SETSTAT_FT(stats.proj_5, rawProjection[5]);
break;
default:
@ -549,12 +549,15 @@ void VertexShaderManager::InvalidateXFRange(int start, int end)
if (nTransformMatricesChanged[0] == -1)
{
nTransformMatricesChanged[0] = start;
nTransformMatricesChanged[1] = end>XFMEM_POSMATRICES_END?XFMEM_POSMATRICES_END:end;
nTransformMatricesChanged[1] = end > XFMEM_POSMATRICES_END ? XFMEM_POSMATRICES_END : end;
}
else
{
if (nTransformMatricesChanged[0] > start) nTransformMatricesChanged[0] = start;
if (nTransformMatricesChanged[1] < end) nTransformMatricesChanged[1] = end>XFMEM_POSMATRICES_END?XFMEM_POSMATRICES_END:end;
if (nTransformMatricesChanged[0] > start)
nTransformMatricesChanged[0] = start;
if (nTransformMatricesChanged[1] < end)
nTransformMatricesChanged[1] = end>XFMEM_POSMATRICES_END ? XFMEM_POSMATRICES_END : end;
}
}
@ -570,8 +573,11 @@ void VertexShaderManager::InvalidateXFRange(int start, int end)
}
else
{
if (nNormalMatricesChanged[0] > _start) nNormalMatricesChanged[0] = _start;
if (nNormalMatricesChanged[1] < _end) nNormalMatricesChanged[1] = _end;
if (nNormalMatricesChanged[0] > _start)
nNormalMatricesChanged[0] = _start;
if (nNormalMatricesChanged[1] < _end)
nNormalMatricesChanged[1] = _end;
}
}
@ -587,8 +593,11 @@ void VertexShaderManager::InvalidateXFRange(int start, int end)
}
else
{
if (nPostTransformMatricesChanged[0] > _start) nPostTransformMatricesChanged[0] = _start;
if (nPostTransformMatricesChanged[1] < _end) nPostTransformMatricesChanged[1] = _end;
if (nPostTransformMatricesChanged[0] > _start)
nPostTransformMatricesChanged[0] = _start;
if (nPostTransformMatricesChanged[1] < _end)
nPostTransformMatricesChanged[1] = _end;
}
}
@ -597,15 +606,18 @@ void VertexShaderManager::InvalidateXFRange(int start, int end)
int _start = start < XFMEM_LIGHTS ? XFMEM_LIGHTS : start-XFMEM_LIGHTS;
int _end = end < XFMEM_LIGHTS_END ? end-XFMEM_LIGHTS : XFMEM_LIGHTS_END-XFMEM_LIGHTS;
if (nLightsChanged[0] == -1 )
if (nLightsChanged[0] == -1)
{
nLightsChanged[0] = _start;
nLightsChanged[1] = _end;
}
else
{
if (nLightsChanged[0] > _start) nLightsChanged[0] = _start;
if (nLightsChanged[1] < _end) nLightsChanged[1] = _end;
if (nLightsChanged[0] > _start)
nLightsChanged[0] = _start;
if (nLightsChanged[1] < _end)
nLightsChanged[1] = _end;
}
}
}
@ -615,7 +627,7 @@ void VertexShaderManager::SetTexMatrixChangedA(u32 Value)
if (g_main_cp_state.matrix_index_a.Hex != Value)
{
VertexManager::Flush();
if (g_main_cp_state.matrix_index_a.PosNormalMtxIdx != (Value&0x3f))
if (g_main_cp_state.matrix_index_a.PosNormalMtxIdx != (Value & 0x3f))
bPosNormalMatrixChanged = true;
bTexMatricesChanged[0] = true;
g_main_cp_state.matrix_index_a.Hex = Value;
@ -650,7 +662,7 @@ void VertexShaderManager::SetMaterialColorChanged(int index, u32 color)
void VertexShaderManager::TranslateView(float x, float y, float z)
{
float result[3];
float vector[3] = { x,z,y };
float vector[3] = { x, z, y };
Matrix33::Multiply(s_viewInvRotationMatrix, vector, result);

View File

@ -111,7 +111,7 @@ public:
// waits until is paused and fully idle, and acquires a lock on that state.
// or, if doLock is false, releases a lock on that state and optionally unpauses.
// calls must be balanced and non-recursive (once with doLock true, then once with doLock false).
virtual void PauseAndLock(bool doLock, bool unpauseOnUnlock=true) = 0;
virtual void PauseAndLock(bool doLock, bool unpauseOnUnlock = true) = 0;
// the implementation needs not do synchronization logic, because calls to it are surrounded by PauseAndLock now
virtual void DoState(PointerWrap &p) = 0;
@ -152,7 +152,7 @@ class VideoBackendHardware : public VideoBackend
void RegisterCPMMIO(MMIO::Mapping* mmio, u32 base) override;
void PauseAndLock(bool doLock, bool unpauseOnUnlock=true) override;
void PauseAndLock(bool doLock, bool unpauseOnUnlock = true) override;
void DoState(PointerWrap &p) override;
void UpdateWantDeterminism(bool want) override;
@ -160,7 +160,7 @@ class VideoBackendHardware : public VideoBackend
bool m_invalid;
public:
void CheckInvalidState() override;
void CheckInvalidState() override;
protected:
void InitializeShared();

View File

@ -62,7 +62,7 @@ void VideoConfig::Load(const std::string& ini_file)
settings->Get("Crop", &bCrop, false);
settings->Get("UseXFB", &bUseXFB, 0);
settings->Get("UseRealXFB", &bUseRealXFB, 0);
settings->Get("SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,128);
settings->Get("SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples, 128);
settings->Get("ShowFPS", &bShowFPS, false);
settings->Get("LogRenderTimeToFile", &bLogRenderTimeToFile, false);
settings->Get("OverlayStats", &bOverlayStats, false);
@ -77,7 +77,7 @@ void VideoConfig::Load(const std::string& ini_file)
settings->Get("EnablePixelLighting", &bEnablePixelLighting, 0);
settings->Get("FastDepthCalc", &bFastDepthCalc, true);
settings->Get("MSAA", &iMultisampleMode, 0);
settings->Get("EFBScale", &iEFBScale, (int) SCALE_1X); // native
settings->Get("EFBScale", &iEFBScale, (int)SCALE_1X); // native
settings->Get("DstAlphaPass", &bDstAlphaPass, false);
settings->Get("TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0);
settings->Get("TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0);