Fixes spacing for "for", "while", "switch" and "if"

Also moved && and || to ends of lines instead of start.
Fixed misc vertical alignments and some { needed newlining.
This commit is contained in:
Matthew Parlane
2014-03-11 00:30:55 +13:00
parent 4591464486
commit 31cfc73a09
189 changed files with 1250 additions and 1159 deletions

View File

@ -126,7 +126,7 @@ void UnloadDXGI()
if (!dxgi_dll_ref) return;
if (--dxgi_dll_ref != 0) return;
if(hDXGIDll) FreeLibrary(hDXGIDll);
if (hDXGIDll) FreeLibrary(hDXGIDll);
hDXGIDll = nullptr;
PCreateDXGIFactory = nullptr;
}
@ -136,7 +136,7 @@ void UnloadD3D()
if (!d3d_dll_ref) return;
if (--d3d_dll_ref != 0) return;
if(hD3DDll) FreeLibrary(hD3DDll);
if (hD3DDll) FreeLibrary(hD3DDll);
hD3DDll = nullptr;
PD3D11CreateDevice = nullptr;
PD3D11CreateDeviceAndSwapChain = nullptr;
@ -365,22 +365,22 @@ void Close()
const char* VertexShaderVersionString()
{
if(featlevel == D3D_FEATURE_LEVEL_11_0) return "vs_5_0";
else if(featlevel == D3D_FEATURE_LEVEL_10_1) return "vs_4_1";
if (featlevel == D3D_FEATURE_LEVEL_11_0) return "vs_5_0";
else if (featlevel == D3D_FEATURE_LEVEL_10_1) return "vs_4_1";
else /*if(featlevel == D3D_FEATURE_LEVEL_10_0)*/ return "vs_4_0";
}
const char* GeometryShaderVersionString()
{
if(featlevel == D3D_FEATURE_LEVEL_11_0) return "gs_5_0";
else if(featlevel == D3D_FEATURE_LEVEL_10_1) return "gs_4_1";
if (featlevel == D3D_FEATURE_LEVEL_11_0) return "gs_5_0";
else if (featlevel == D3D_FEATURE_LEVEL_10_1) return "gs_4_1";
else /*if(featlevel == D3D_FEATURE_LEVEL_10_0)*/ return "gs_4_0";
}
const char* PixelShaderVersionString()
{
if(featlevel == D3D_FEATURE_LEVEL_11_0) return "ps_5_0";
else if(featlevel == D3D_FEATURE_LEVEL_10_1) return "ps_4_1";
if (featlevel == D3D_FEATURE_LEVEL_11_0) return "ps_5_0";
else if (featlevel == D3D_FEATURE_LEVEL_10_1) return "ps_4_1";
else /*if(featlevel == D3D_FEATURE_LEVEL_10_0)*/ return "ps_4_0";
}

View File

@ -35,13 +35,13 @@ public:
int AppendData(void* data, int size, int vertex_size)
{
D3D11_MAPPED_SUBRESOURCE map;
if(offset + size >= max_size)
if (offset + size >= max_size)
{
// wrap buffer around and notify observers
offset = 0;
context->Map(buf, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
for(bool* observer : observers)
for (bool* observer : observers)
*observer = true;
}
else
@ -623,10 +623,10 @@ void drawColorQuad(u32 Color, float x1, float y1, float x2, float y2)
{ x2, y1, 0.f, Color },
};
if(cq_observer ||
draw_quad_data.x1 != x1 || draw_quad_data.y1 != y1 ||
draw_quad_data.x2 != x2 || draw_quad_data.y2 != y2 ||
draw_quad_data.col != Color)
if (cq_observer ||
draw_quad_data.x1 != x1 || draw_quad_data.y1 != y1 ||
draw_quad_data.x2 != x2 || draw_quad_data.y2 != y2 ||
draw_quad_data.col != Color)
{
cq_offset = util_vbuf->AppendData(coords, sizeof(coords), sizeof(ColVertex));
cq_observer = false;

View File

@ -29,7 +29,7 @@ template<typename T> AutoState<T>::AutoState(const AutoState<T> &source)
template<typename T> AutoState<T>::~AutoState()
{
if(state) ((T*)state)->Release();
if (state) ((T*)state)->Release();
state = nullptr;
}
@ -77,4 +77,4 @@ void StateManager::Apply()
} // namespace
} // namespace DX11
} // namespace DX11

View File

@ -174,7 +174,7 @@ const char reint_rgba6_to_rgb8_msaa[] = {
" int width, height, samples;\n"
" Tex0.GetDimensions(width, height, samples);\n"
" float4 texcol = 0;\n"
" for(int i = 0; i < samples; ++i)\n"
" for (int i = 0; i < samples; ++i)\n"
" texcol += Tex0.Load(int2(uv0.x*(width), uv0.y*(height)), i);\n"
" texcol /= samples;\n"
" int4 src6 = round(texcol * 63.f);\n"
@ -216,7 +216,7 @@ const char reint_rgb8_to_rgba6_msaa[] = {
" int width, height, samples;\n"
" Tex0.GetDimensions(width, height, samples);\n"
" float4 texcol = 0;\n"
" for(int i = 0; i < samples; ++i)\n"
" for (int i = 0; i < samples; ++i)\n"
" texcol += Tex0.Load(int2(uv0.x*(width), uv0.y*(height)), i);\n"
" texcol /= samples;\n"
" int4 src8 = round(texcol * 255.f);\n"

View File

@ -233,7 +233,7 @@ Renderer::Renderer()
0.f, 1 << g_ActiveConfig.iMaxAnisotropy,
D3D11_COMPARISON_ALWAYS, border,
-D3D11_FLOAT32_MAX, D3D11_FLOAT32_MAX);
if(g_ActiveConfig.iMaxAnisotropy != 0) gx_state.sampdc[k].Filter = D3D11_FILTER_ANISOTROPIC;
if (g_ActiveConfig.iMaxAnisotropy != 0) gx_state.sampdc[k].Filter = D3D11_FILTER_ANISOTROPIC;
}
// Clear EFB textures
@ -362,7 +362,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
// Take the mean of the resulting dimensions; TODO: Don't use the center pixel, compute the average color instead
D3D11_RECT RectToLock;
if(type == PEEK_COLOR || type == PEEK_Z)
if (type == PEEK_COLOR || type == PEEK_Z)
{
RectToLock.left = (targetPixelRc.left + targetPixelRc.right) / 2;
RectToLock.top = (targetPixelRc.top + targetPixelRc.bottom) / 2;
@ -409,7 +409,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
float val = *(float*)map.pData;
u32 ret = 0;
if(bpmem.zcontrol.pixel_format == PIXELFMT_RGB565_Z16)
if (bpmem.zcontrol.pixel_format == PIXELFMT_RGB565_Z16)
{
// if Z is in 16 bit format you must return a 16 bit integer
ret = ((u32)(val * 0xffff));
@ -433,7 +433,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
// read the data from system memory
D3D::context->Map(read_tex, 0, D3D11_MAP_READ, 0, &map);
u32 ret = 0;
if(map.pData)
if (map.pData)
ret = *(u32*)map.pData;
D3D::context->Unmap(read_tex, 0);
@ -448,13 +448,13 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
{
ret = RGBA8ToRGB565ToRGBA8(ret);
}
if(bpmem.zcontrol.pixel_format != PIXELFMT_RGBA6_Z24)
if (bpmem.zcontrol.pixel_format != PIXELFMT_RGBA6_Z24)
{
ret |= 0xFF000000;
}
if(alpha_read_mode.ReadMode == 2) return ret; // GX_READ_NONE
else if(alpha_read_mode.ReadMode == 1) return (ret | 0xFF000000); // GX_READ_FF
if (alpha_read_mode.ReadMode == 2) return ret; // GX_READ_NONE
else if (alpha_read_mode.ReadMode == 1) return (ret | 0xFF000000); // GX_READ_FF
else /*if(alpha_read_mode.ReadMode == 0)*/ return (ret & 0x00FFFFFF); // GX_READ_00
}
else //if(type == POKE_COLOR)
@ -784,7 +784,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl
s_television.Submit(xfbAddr, fbWidth, fbHeight);
s_television.Render();
}
else if(g_ActiveConfig.bUseXFB)
else if (g_ActiveConfig.bUseXFB)
{
const XFBSourceBase* xfbSource;
@ -1084,7 +1084,7 @@ void Renderer::ApplyState(bool bUseDstAlpha)
// TODO: unnecessary state changes, we should store a list of shader resources
//if (shader_resources[stage])
{
if(g_ActiveConfig.iMaxAnisotropy > 0) gx_state.sampdc[stage].Filter = D3D11_FILTER_ANISOTROPIC;
if (g_ActiveConfig.iMaxAnisotropy > 0) gx_state.sampdc[stage].Filter = D3D11_FILTER_ANISOTROPIC;
hr = D3D::device->CreateSamplerState(&gx_state.sampdc[stage], &samplerstate[stage]);
if (FAILED(hr)) PanicAlert("Fail %s %d, stage=%d\n", __FILE__, __LINE__, stage);
else D3D::SetDebugObjectName((ID3D11DeviceChild*)samplerstate[stage], "sampler state used to emulate the GX pipeline");