clang-modernize -loop-convert

and some manual adjustments
This commit is contained in:
Tillmann Karras
2014-03-03 06:25:15 +01:00
parent f401263867
commit c89f04a7c5
22 changed files with 339 additions and 293 deletions

View File

@ -404,21 +404,26 @@ void ProgramShaderCache::Shutdown(void)
// store all shaders in cache on disk
if (g_ogl_config.bSupportsGLSLCache && !g_Config.bEnableShaderDebugging)
{
PCache::iterator iter = pshaders.begin();
for (; iter != pshaders.end(); ++iter)
for (auto& entry : pshaders)
{
if(iter->second.in_cache) continue;
if(entry.second.in_cache)
{
continue;
}
GLint binary_size;
glGetProgramiv(iter->second.shader.glprogid, GL_PROGRAM_BINARY_LENGTH, &binary_size);
if(!binary_size) continue;
glGetProgramiv(entry.second.shader.glprogid, GL_PROGRAM_BINARY_LENGTH, &binary_size);
if(!binary_size)
{
continue;
}
u8 *data = new u8[binary_size+sizeof(GLenum)];
u8 *binary = data + sizeof(GLenum);
GLenum *prog_format = (GLenum*)data;
glGetProgramBinary(iter->second.shader.glprogid, binary_size, NULL, prog_format, binary);
glGetProgramBinary(entry.second.shader.glprogid, binary_size, NULL, prog_format, binary);
g_program_disk_cache.Append(iter->first, data, binary_size+sizeof(GLenum));
g_program_disk_cache.Append(entry.first, data, binary_size+sizeof(GLenum));
delete [] data;
}
@ -428,9 +433,10 @@ void ProgramShaderCache::Shutdown(void)
glUseProgram(0);
PCache::iterator iter = pshaders.begin();
for (; iter != pshaders.end(); ++iter)
iter->second.Destroy();
for (auto& entry : pshaders)
{
entry.second.Destroy();
}
pshaders.clear();
pixel_uid_checker.Invalidate();

View File

@ -54,12 +54,12 @@ void DoState(PointerWrap &p)
{
ZSlope.DoState(p);
WSlope.DoState(p);
for (auto& ColorSlope : ColorSlopes)
for (int n=0; n<4; ++n)
ColorSlope[n].DoState(p);
for (auto& TexSlope : TexSlopes)
for (int n=0; n<3; ++n)
TexSlope[n].DoState(p);
for (auto& color_slopes_1d : ColorSlopes)
for (Slope& color_slope : color_slopes_1d)
color_slope.DoState(p);
for (auto& tex_slopes_1d : TexSlopes)
for (Slope& tex_slope : tex_slopes_1d)
tex_slope.DoState(p);
p.Do(vertex0X);
p.Do(vertex0Y);
p.Do(vertexOffsetX);

View File

@ -33,8 +33,10 @@ void Tev::Init()
FixedConstants[7] = 223;
FixedConstants[8] = 255;
for (int i = 0; i < 4; i++)
Zero16[i] = 0;
for (s16& comp : Zero16)
{
comp = 0;
}
m_ColorInputLUT[0][RED_INP] = &Reg[0][RED_C]; m_ColorInputLUT[0][GRN_INP] = &Reg[0][GRN_C]; m_ColorInputLUT[0][BLU_INP] = &Reg[0][BLU_C]; // prev.rgb
m_ColorInputLUT[1][RED_INP] = &Reg[0][ALP_C]; m_ColorInputLUT[1][GRN_INP] = &Reg[0][ALP_C]; m_ColorInputLUT[1][BLU_INP] = &Reg[0][ALP_C]; // prev.aaa
@ -148,21 +150,27 @@ void Tev::SetRasColor(int colorChan, int swaptable)
break;
case 5: // alpha bump
{
for(int i = 0; i < 4; i++)
RasColor[i] = AlphaBump;
for (s16& comp : RasColor)
{
comp = AlphaBump;
}
}
break;
case 6: // alpha bump normalized
{
u8 normalized = AlphaBump | AlphaBump >> 5;
for(int i = 0; i < 4; i++)
RasColor[i] = normalized;
for (s16& comp : RasColor)
{
comp = normalized;
}
}
break;
default: // zero
{
for(int i = 0; i < 4; i++)
RasColor[i] = 0;
for (s16& comp : RasColor)
{
comp = 0;
}
}
break;
}