mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-09-01 23:26:03 +00:00
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:
parent
4591464486
commit
31cfc73a09
189 changed files with 1250 additions and 1159 deletions
|
@ -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";
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -353,7 +353,7 @@ void FramebufferManager::ReinterpretPixelData(unsigned int convtype)
|
|||
|
||||
GLuint src_texture = 0;
|
||||
|
||||
if(m_msaaSamples > 1)
|
||||
if (m_msaaSamples > 1)
|
||||
{
|
||||
// MSAA mode, so resolve first
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, m_efbFramebuffer);
|
||||
|
|
|
@ -64,9 +64,9 @@ GLuint OpenGL_CompileProgram ( const char* vertexShader, const char* fragmentSha
|
|||
GLsizei stringBufferUsage = 0;
|
||||
glGetShaderiv(vertexShaderID, GL_COMPILE_STATUS, &Result);
|
||||
glGetShaderInfoLog(vertexShaderID, 1024, &stringBufferUsage, stringBuffer);
|
||||
if(Result && stringBufferUsage) {
|
||||
if (Result && stringBufferUsage) {
|
||||
ERROR_LOG(VIDEO, "GLSL vertex shader warnings:\n%s%s", stringBuffer, vertexShader);
|
||||
} else if(!Result) {
|
||||
} else if (!Result) {
|
||||
ERROR_LOG(VIDEO, "GLSL vertex shader error:\n%s%s", stringBuffer, vertexShader);
|
||||
} else {
|
||||
DEBUG_LOG(VIDEO, "GLSL vertex shader compiled:\n%s", vertexShader);
|
||||
|
@ -80,9 +80,9 @@ GLuint OpenGL_CompileProgram ( const char* vertexShader, const char* fragmentSha
|
|||
#if defined(_DEBUG) || defined(DEBUGFAST) || defined(DEBUG_GLSL)
|
||||
glGetShaderiv(fragmentShaderID, GL_COMPILE_STATUS, &Result);
|
||||
glGetShaderInfoLog(fragmentShaderID, 1024, &stringBufferUsage, stringBuffer);
|
||||
if(Result && stringBufferUsage) {
|
||||
if (Result && stringBufferUsage) {
|
||||
ERROR_LOG(VIDEO, "GLSL fragment shader warnings:\n%s%s", stringBuffer, fragmentShader);
|
||||
} else if(!Result) {
|
||||
} else if (!Result) {
|
||||
ERROR_LOG(VIDEO, "GLSL fragment shader error:\n%s%s", stringBuffer, fragmentShader);
|
||||
} else {
|
||||
DEBUG_LOG(VIDEO, "GLSL fragment shader compiled:\n%s", fragmentShader);
|
||||
|
@ -97,9 +97,9 @@ GLuint OpenGL_CompileProgram ( const char* vertexShader, const char* fragmentSha
|
|||
#if defined(_DEBUG) || defined(DEBUGFAST) || defined(DEBUG_GLSL)
|
||||
glGetProgramiv(programID, GL_LINK_STATUS, &Result);
|
||||
glGetProgramInfoLog(programID, 1024, &stringBufferUsage, stringBuffer);
|
||||
if(Result && stringBufferUsage) {
|
||||
if (Result && stringBufferUsage) {
|
||||
ERROR_LOG(VIDEO, "GLSL linker warnings:\n%s%s%s", stringBuffer, vertexShader, fragmentShader);
|
||||
} else if(!Result && !shader_errors) {
|
||||
} else if (!Result && !shader_errors) {
|
||||
ERROR_LOG(VIDEO, "GLSL linker error:\n%s%s%s", stringBuffer, vertexShader, fragmentShader);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -77,7 +77,7 @@ void BindTargetFramebuffer ()
|
|||
|
||||
void BlitToScreen()
|
||||
{
|
||||
if(!s_enable) return;
|
||||
if (!s_enable) return;
|
||||
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
glViewport(0, 0, s_width, s_height);
|
||||
|
@ -101,7 +101,7 @@ void Update ( u32 width, u32 height )
|
|||
{
|
||||
ApplyShader();
|
||||
|
||||
if(s_enable && (width != s_width || height != s_height)) {
|
||||
if (s_enable && (width != s_width || height != s_height)) {
|
||||
s_width = width;
|
||||
s_height = height;
|
||||
|
||||
|
@ -133,7 +133,7 @@ void ApplyShader()
|
|||
// Fallback to shared user dir
|
||||
path = File::GetSysDirectory() + SHADERS_DIR DIR_SEP + g_ActiveConfig.sPostProcessingShader + ".glsl";
|
||||
}
|
||||
if(!File::ReadFileToString(path.c_str(), code)) {
|
||||
if (!File::ReadFileToString(path.c_str(), code)) {
|
||||
ERROR_LOG(VIDEO, "Post-processing shader not found: %s", path.c_str());
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -47,9 +47,9 @@ void SHADER::SetProgramVariables()
|
|||
GLint PSBlock_id = glGetUniformBlockIndex(glprogid, "PSBlock");
|
||||
GLint VSBlock_id = glGetUniformBlockIndex(glprogid, "VSBlock");
|
||||
|
||||
if(PSBlock_id != -1)
|
||||
if (PSBlock_id != -1)
|
||||
glUniformBlockBinding(glprogid, PSBlock_id, 1);
|
||||
if(VSBlock_id != -1)
|
||||
if (VSBlock_id != -1)
|
||||
glUniformBlockBinding(glprogid, VSBlock_id, 2);
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ void SHADER::SetProgramBindings()
|
|||
glBindAttribLocation(glprogid, SHADER_NORM1_ATTRIB, "rawnorm1");
|
||||
glBindAttribLocation(glprogid, SHADER_NORM2_ATTRIB, "rawnorm2");
|
||||
|
||||
for(int i=0; i<8; i++) {
|
||||
for (int i=0; i<8; i++) {
|
||||
char attrib_name[8];
|
||||
snprintf(attrib_name, 8, "tex%d", i);
|
||||
glBindAttribLocation(glprogid, SHADER_TEXTURE0_ATTRIB+i, attrib_name);
|
||||
|
@ -98,7 +98,7 @@ void SHADER::SetProgramBindings()
|
|||
|
||||
void SHADER::Bind()
|
||||
{
|
||||
if(CurrentProgram != glprogid)
|
||||
if (CurrentProgram != glprogid)
|
||||
{
|
||||
glUseProgram(glprogid);
|
||||
CurrentProgram = glprogid;
|
||||
|
@ -107,7 +107,7 @@ void SHADER::Bind()
|
|||
|
||||
void ProgramShaderCache::UploadConstants()
|
||||
{
|
||||
if(PixelShaderManager::dirty || VertexShaderManager::dirty)
|
||||
if (PixelShaderManager::dirty || VertexShaderManager::dirty)
|
||||
{
|
||||
auto buffer = s_buffer->Map(s_ubo_buffer_size, s_ubo_align);
|
||||
|
||||
|
@ -210,7 +210,7 @@ bool ProgramShaderCache::CompileShader ( SHADER& shader, const char* vcode, cons
|
|||
GLuint vsid = CompileSingleShader(GL_VERTEX_SHADER, vcode);
|
||||
GLuint psid = CompileSingleShader(GL_FRAGMENT_SHADER, pcode);
|
||||
|
||||
if(!vsid || !psid)
|
||||
if (!vsid || !psid)
|
||||
{
|
||||
glDeleteShader(vsid);
|
||||
glDeleteShader(psid);
|
||||
|
@ -250,7 +250,7 @@ bool ProgramShaderCache::CompileShader ( SHADER& shader, const char* vcode, cons
|
|||
file << s_glsl_header << vcode << s_glsl_header << pcode << infoLog;
|
||||
file.close();
|
||||
|
||||
if(linkStatus != GL_TRUE)
|
||||
if (linkStatus != GL_TRUE)
|
||||
PanicAlert("Failed to link shaders!\nThis usually happens when trying to use Dolphin with an outdated GPU or integrated GPU like the Intel GMA series.\n\nIf you're sure this is Dolphin's error anyway, post the contents of %s along with this error message at the forums.\n\nDebug info (%s, %s, %s):\n%s",
|
||||
szTemp,
|
||||
g_ogl_config.gl_vendor,
|
||||
|
@ -308,7 +308,7 @@ GLuint ProgramShaderCache::CompileSingleShader (GLuint type, const char* code )
|
|||
file << s_glsl_header << code << infoLog;
|
||||
file.close();
|
||||
|
||||
if(compileStatus != GL_TRUE)
|
||||
if (compileStatus != GL_TRUE)
|
||||
PanicAlert("Failed to compile %s shader!\nThis usually happens when trying to use Dolphin with an outdated GPU or integrated GPU like the Intel GMA series.\n\nIf you're sure this is Dolphin's error anyway, post the contents of %s along with this error message at the forums.\n\nDebug info (%s, %s, %s):\n%s",
|
||||
type==GL_VERTEX_SHADER ? "vertex" : "pixel",
|
||||
szTemp,
|
||||
|
@ -373,7 +373,7 @@ void ProgramShaderCache::Init(void)
|
|||
{
|
||||
GLint Supported;
|
||||
glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &Supported);
|
||||
if(!Supported)
|
||||
if (!Supported)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "GL_ARB_get_program_binary is supported, but no binary format is known. So disable shader cache.");
|
||||
g_ogl_config.bSupportsGLSLCache = false;
|
||||
|
@ -406,14 +406,14 @@ void ProgramShaderCache::Shutdown(void)
|
|||
{
|
||||
for (auto& entry : pshaders)
|
||||
{
|
||||
if(entry.second.in_cache)
|
||||
if (entry.second.in_cache)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
GLint binary_size;
|
||||
glGetProgramiv(entry.second.shader.glprogid, GL_PROGRAM_BINARY_LENGTH, &binary_size);
|
||||
if(!binary_size)
|
||||
if (!binary_size)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -25,9 +25,9 @@ public:
|
|||
|
||||
bool operator <(const SHADERUID& r) const
|
||||
{
|
||||
if(puid < r.puid) return true;
|
||||
if(r.puid < puid) return false;
|
||||
if(vuid < r.vuid) return true;
|
||||
if (puid < r.puid) return true;
|
||||
if (r.puid < puid) return false;
|
||||
if (vuid < r.vuid) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -141,9 +141,9 @@ RasterFont::RasterFont()
|
|||
glActiveTexture(GL_TEXTURE0+8);
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
u32* texture_data = new u32[char_width*char_count*char_height];
|
||||
for(u32 y=0; y<char_height; y++) {
|
||||
for(u32 c=0; c<char_count; c++) {
|
||||
for(u32 x=0; x<char_width; x++) {
|
||||
for (u32 y=0; y<char_height; y++) {
|
||||
for (u32 c=0; c<char_count; c++) {
|
||||
for (u32 x=0; x<char_width; x++) {
|
||||
bool pixel = (0 != (rasters[c][y] & (1<<(char_width-x-1))));
|
||||
texture_data[char_width*char_count*y+char_width*c+x] = pixel ? -1 : 0;
|
||||
}
|
||||
|
@ -195,22 +195,22 @@ void RasterFont::printMultilineText(const char *text, double start_x, double sta
|
|||
GLfloat x = GLfloat(start_x);
|
||||
GLfloat y = GLfloat(start_y);
|
||||
|
||||
for(size_t i=0; i<length; i++) {
|
||||
for (size_t i=0; i<length; i++) {
|
||||
u8 c = text[i];
|
||||
|
||||
if(c == '\n') {
|
||||
if (c == '\n') {
|
||||
x = GLfloat(start_x);
|
||||
y -= delta_y + border_y;
|
||||
continue;
|
||||
}
|
||||
|
||||
// do not print spaces, they can be skipped easily
|
||||
if(c == ' ') {
|
||||
if (c == ' ') {
|
||||
x += delta_x + border_x;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(c < char_offset || c >= char_count+char_offset) continue;
|
||||
if (c < char_offset || c >= char_count+char_offset) continue;
|
||||
|
||||
vertices[usage++] = x;
|
||||
vertices[usage++] = y;
|
||||
|
@ -245,7 +245,7 @@ void RasterFont::printMultilineText(const char *text, double start_x, double sta
|
|||
x += delta_x + border_x;
|
||||
}
|
||||
|
||||
if(!usage) {
|
||||
if (!usage) {
|
||||
delete [] vertices;
|
||||
return;
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ void RasterFont::printMultilineText(const char *text, double start_x, double sta
|
|||
|
||||
s_shader.Bind();
|
||||
|
||||
if(color != cached_color) {
|
||||
if (color != cached_color) {
|
||||
glUniform4f(uniform_color_id, GLfloat((color>>16)&0xff)/255.f,GLfloat((color>>8)&0xff)/255.f,GLfloat((color>>0)&0xff)/255.f,GLfloat((color>>24)&0xff)/255.f);
|
||||
cached_color = color;
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ int GetNumMSAASamples(int MSAAMode)
|
|||
samples = 1;
|
||||
}
|
||||
|
||||
if(samples <= g_ogl_config.max_samples) return samples;
|
||||
if (samples <= g_ogl_config.max_samples) return samples;
|
||||
|
||||
// TODO: move this to InitBackendInfo
|
||||
OSD::AddMessage(StringFromFormat("%d Anti Aliasing samples selected, but only %d supported by your GPU.", samples, g_ogl_config.max_samples), 10000);
|
||||
|
@ -172,7 +172,7 @@ int GetNumMSAACoverageSamples(int MSAAMode)
|
|||
default:
|
||||
samples = 0;
|
||||
}
|
||||
if(g_ogl_config.bSupportCoverageMSAA || samples == 0) return samples;
|
||||
if (g_ogl_config.bSupportCoverageMSAA || samples == 0) return samples;
|
||||
|
||||
// TODO: move this to InitBackendInfo
|
||||
OSD::AddMessage("CSAA Anti Aliasing isn't supported by your GPU.", 10000);
|
||||
|
@ -183,15 +183,15 @@ void ApplySSAASettings() {
|
|||
// GLES3 doesn't support SSAA
|
||||
if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL)
|
||||
{
|
||||
if(g_ActiveConfig.iMultisampleMode == MULTISAMPLE_SSAA_4X) {
|
||||
if(g_ogl_config.bSupportSampleShading) {
|
||||
if (g_ActiveConfig.iMultisampleMode == MULTISAMPLE_SSAA_4X) {
|
||||
if (g_ogl_config.bSupportSampleShading) {
|
||||
glEnable(GL_SAMPLE_SHADING_ARB);
|
||||
glMinSampleShadingARB(s_MSAASamples);
|
||||
} else {
|
||||
// TODO: move this to InitBackendInfo
|
||||
OSD::AddMessage("SSAA Anti Aliasing isn't supported by your GPU.", 10000);
|
||||
}
|
||||
} else if(g_ogl_config.bSupportSampleShading) {
|
||||
} else if (g_ogl_config.bSupportSampleShading) {
|
||||
glDisable(GL_SAMPLE_SHADING_ARB);
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ void GLAPIENTRY ErrorCallback( GLenum source, GLenum type, GLuint id, GLenum sev
|
|||
const char *s_source;
|
||||
const char *s_type;
|
||||
|
||||
switch(source)
|
||||
switch (source)
|
||||
{
|
||||
case GL_DEBUG_SOURCE_API_ARB: s_source = "API"; break;
|
||||
case GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB: s_source = "Window System"; break;
|
||||
|
@ -212,7 +212,7 @@ void GLAPIENTRY ErrorCallback( GLenum source, GLenum type, GLuint id, GLenum sev
|
|||
case GL_DEBUG_SOURCE_OTHER_ARB: s_source = "Other"; break;
|
||||
default: s_source = "Unknown"; break;
|
||||
}
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case GL_DEBUG_TYPE_ERROR_ARB: s_type = "Error"; break;
|
||||
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB: s_type = "Deprecated"; break;
|
||||
|
@ -222,7 +222,7 @@ void GLAPIENTRY ErrorCallback( GLenum source, GLenum type, GLuint id, GLenum sev
|
|||
case GL_DEBUG_TYPE_OTHER_ARB: s_type = "Other"; break;
|
||||
default: s_type = "Unknown"; break;
|
||||
}
|
||||
switch(severity)
|
||||
switch (severity)
|
||||
{
|
||||
case GL_DEBUG_SEVERITY_HIGH_ARB: ERROR_LOG(VIDEO, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); break;
|
||||
case GL_DEBUG_SEVERITY_MEDIUM_ARB: WARN_LOG(VIDEO, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); break;
|
||||
|
@ -277,7 +277,7 @@ void InitDriverInfo()
|
|||
vendor = DriverDetails::VENDOR_VIVANTE;
|
||||
|
||||
// Get device family and driver version...if we care about it
|
||||
switch(vendor)
|
||||
switch (vendor)
|
||||
{
|
||||
case DriverDetails::VENDOR_QUALCOMM:
|
||||
{
|
||||
|
@ -292,16 +292,16 @@ void InitDriverInfo()
|
|||
case DriverDetails::VENDOR_ARM:
|
||||
if (std::string::npos != srenderer.find("Mali-T6"))
|
||||
driver = DriverDetails::DRIVER_ARM_T6XX;
|
||||
else if(std::string::npos != srenderer.find("Mali-4"))
|
||||
else if (std::string::npos != srenderer.find("Mali-4"))
|
||||
driver = DriverDetails::DRIVER_ARM_4XX;
|
||||
break;
|
||||
case DriverDetails::VENDOR_MESA:
|
||||
{
|
||||
if(svendor == "nouveau")
|
||||
if (svendor == "nouveau")
|
||||
driver = DriverDetails::DRIVER_NOUVEAU;
|
||||
else if(svendor == "Intel Open Source Technology Center")
|
||||
else if (svendor == "Intel Open Source Technology Center")
|
||||
driver = DriverDetails::DRIVER_I965;
|
||||
else if(std::string::npos != srenderer.find("AMD") || std::string::npos != srenderer.find("ATI"))
|
||||
else if (std::string::npos != srenderer.find("AMD") || std::string::npos != srenderer.find("ATI"))
|
||||
driver = DriverDetails::DRIVER_R600;
|
||||
|
||||
int major = 0;
|
||||
|
@ -474,19 +474,19 @@ Renderer::Renderer()
|
|||
g_ogl_config.eSupportedGLSLVersion = GLSLES3;
|
||||
else
|
||||
{
|
||||
if(strstr(g_ogl_config.glsl_version, "1.00") || strstr(g_ogl_config.glsl_version, "1.10") || strstr(g_ogl_config.glsl_version, "1.20"))
|
||||
if (strstr(g_ogl_config.glsl_version, "1.00") || strstr(g_ogl_config.glsl_version, "1.10") || strstr(g_ogl_config.glsl_version, "1.20"))
|
||||
{
|
||||
PanicAlert("GPU: OGL ERROR: Need at least GLSL 1.30\n"
|
||||
"GPU: Does your video card support OpenGL 3.0?\n"
|
||||
"GPU: Your driver supports GLSL %s", g_ogl_config.glsl_version);
|
||||
bSuccess = false;
|
||||
}
|
||||
else if(strstr(g_ogl_config.glsl_version, "1.30"))
|
||||
else if (strstr(g_ogl_config.glsl_version, "1.30"))
|
||||
{
|
||||
g_ogl_config.eSupportedGLSLVersion = GLSL_130;
|
||||
g_Config.backend_info.bSupportsEarlyZ = false; // layout keyword is only supported on glsl150+
|
||||
}
|
||||
else if(strstr(g_ogl_config.glsl_version, "1.40"))
|
||||
else if (strstr(g_ogl_config.glsl_version, "1.40"))
|
||||
{
|
||||
g_ogl_config.eSupportedGLSLVersion = GLSL_140;
|
||||
g_Config.backend_info.bSupportsEarlyZ = false; // layout keyword is only supported on glsl150+
|
||||
|
@ -512,7 +512,7 @@ Renderer::Renderer()
|
|||
#endif
|
||||
int samples;
|
||||
glGetIntegerv(GL_SAMPLES, &samples);
|
||||
if(samples > 1)
|
||||
if (samples > 1)
|
||||
{
|
||||
// MSAA on default framebuffer isn't working because of glBlitFramebuffer.
|
||||
// It also isn't useful as we don't render anything to the default framebuffer.
|
||||
|
@ -531,7 +531,7 @@ Renderer::Renderer()
|
|||
}
|
||||
|
||||
glGetIntegerv(GL_MAX_SAMPLES, &g_ogl_config.max_samples);
|
||||
if(g_ogl_config.max_samples < 1)
|
||||
if (g_ogl_config.max_samples < 1)
|
||||
g_ogl_config.max_samples = 1;
|
||||
|
||||
UpdateActiveConfig();
|
||||
|
@ -599,12 +599,12 @@ Renderer::Renderer()
|
|||
glBlendColor(0, 0, 0, 0.5f);
|
||||
glClearDepthf(1.0f);
|
||||
|
||||
if(g_ActiveConfig.backend_info.bSupportsPrimitiveRestart)
|
||||
if (g_ActiveConfig.backend_info.bSupportsPrimitiveRestart)
|
||||
{
|
||||
if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3)
|
||||
glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX);
|
||||
else
|
||||
if(g_ogl_config.bSupportOGL31)
|
||||
if (g_ogl_config.bSupportOGL31)
|
||||
{
|
||||
glEnable(GL_PRIMITIVE_RESTART);
|
||||
glPrimitiveRestartIndex(65535);
|
||||
|
@ -988,7 +988,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
|
|||
// Scale the 32-bit value returned by glReadPixels to a 24-bit
|
||||
// value (GC uses a 24-bit Z-buffer).
|
||||
// TODO: in RE0 this value is often off by one, which causes lighting to disappear
|
||||
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
|
||||
z = z >> 16;
|
||||
|
@ -1054,12 +1054,12 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
|
|||
{
|
||||
color = RGBA8ToRGB565ToRGBA8(color);
|
||||
}
|
||||
if(bpmem.zcontrol.pixel_format != PIXELFMT_RGBA6_Z24)
|
||||
if (bpmem.zcontrol.pixel_format != PIXELFMT_RGBA6_Z24)
|
||||
{
|
||||
color |= 0xFF000000;
|
||||
}
|
||||
if(alpha_read_mode.ReadMode == 2) return color; // GX_READ_NONE
|
||||
else if(alpha_read_mode.ReadMode == 1) return (color | 0xFF000000); // GX_READ_FF
|
||||
if (alpha_read_mode.ReadMode == 2) return color; // GX_READ_NONE
|
||||
else if (alpha_read_mode.ReadMode == 1) return (color | 0xFF000000); // GX_READ_FF
|
||||
else /*if(alpha_read_mode.ReadMode == 0)*/ return (color & 0x00FFFFFF); // GX_READ_00
|
||||
}
|
||||
|
||||
|
@ -1110,7 +1110,7 @@ void Renderer::SetViewport()
|
|||
}
|
||||
|
||||
// Update the view port
|
||||
if(g_ogl_config.bSupportViewportFloat)
|
||||
if (g_ogl_config.bSupportViewportFloat)
|
||||
{
|
||||
glViewportIndexedf(0, X, Y, Width, Height);
|
||||
}
|
||||
|
@ -1317,7 +1317,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl
|
|||
|
||||
const XFBSourceBase* xfbSource = nullptr;
|
||||
|
||||
if(g_ActiveConfig.bUseXFB)
|
||||
if (g_ActiveConfig.bUseXFB)
|
||||
{
|
||||
// Render to the real/postprocessing buffer now.
|
||||
PostProcessing::BindTargetFramebuffer();
|
||||
|
@ -1583,7 +1583,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl
|
|||
GL_REPORT_ERRORD();
|
||||
}
|
||||
|
||||
if(s_vsync != g_ActiveConfig.IsVSync())
|
||||
if (s_vsync != g_ActiveConfig.IsVSync())
|
||||
{
|
||||
s_vsync = g_ActiveConfig.IsVSync();
|
||||
GLInterface->SwapInterval(s_vsync);
|
||||
|
@ -1767,7 +1767,7 @@ void Renderer::FlipImageData(u8 *data, int w, int h, int pixel_width)
|
|||
// Flip image upside down. Damn OpenGL.
|
||||
for (int y = 0; y < h / 2; ++y)
|
||||
{
|
||||
for(int x = 0; x < w; ++x)
|
||||
for (int x = 0; x < w; ++x)
|
||||
{
|
||||
for (int delta = 0; delta < pixel_width; ++delta)
|
||||
std::swap(data[(y * w + x) * pixel_width + delta], data[((h - 1 - y) * w + x) * pixel_width + delta]);
|
||||
|
|
|
@ -66,7 +66,7 @@ static const u32 SYNC_POINTS = 16;
|
|||
void StreamBuffer::CreateFences()
|
||||
{
|
||||
fences = new GLsync[SYNC_POINTS];
|
||||
for(u32 i=0; i<SYNC_POINTS; i++)
|
||||
for (u32 i=0; i<SYNC_POINTS; i++)
|
||||
fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
}
|
||||
void StreamBuffer::DeleteFences()
|
||||
|
@ -123,7 +123,7 @@ void StreamBuffer::AllocMemory(size_t size)
|
|||
|
||||
void StreamBuffer::Align(u32 stride)
|
||||
{
|
||||
if(m_iterator && stride) {
|
||||
if (m_iterator && stride) {
|
||||
m_iterator--;
|
||||
m_iterator = m_iterator - (m_iterator % stride) + stride;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ public:
|
|||
|
||||
std::pair<u8*, size_t> Map(size_t size, u32 stride) override {
|
||||
Align(stride);
|
||||
if(m_iterator + size >= m_size) {
|
||||
if (m_iterator + size >= m_size) {
|
||||
glBufferData(m_buffertype, m_size, nullptr, GL_STREAM_DRAW);
|
||||
m_iterator = 0;
|
||||
}
|
||||
|
@ -350,9 +350,9 @@ public:
|
|||
StreamBuffer* StreamBuffer::Create(u32 type, size_t size)
|
||||
{
|
||||
// without basevertex support, only streaming methods whith uploads everything to zero works fine:
|
||||
if(!g_ogl_config.bSupportsGLBaseVertex)
|
||||
if (!g_ogl_config.bSupportsGLBaseVertex)
|
||||
{
|
||||
if(!DriverDetails::HasBug(DriverDetails::BUG_BROKENBUFFERSTREAM))
|
||||
if (!DriverDetails::HasBug(DriverDetails::BUG_BROKENBUFFERSTREAM))
|
||||
return new BufferSubData(type, size);
|
||||
|
||||
// BufferData is by far the worst way, only use it if needed
|
||||
|
@ -360,7 +360,7 @@ StreamBuffer* StreamBuffer::Create(u32 type, size_t size)
|
|||
}
|
||||
|
||||
// Prefer the syncing buffers over the orphaning one
|
||||
if(g_ogl_config.bSupportsGLSync)
|
||||
if (g_ogl_config.bSupportsGLSync)
|
||||
{
|
||||
// try to use buffer storage whenever possible
|
||||
if (g_ogl_config.bSupportsGLBufferStorage &&
|
||||
|
@ -368,16 +368,16 @@ StreamBuffer* StreamBuffer::Create(u32 type, size_t size)
|
|||
return new BufferStorage(type, size);
|
||||
|
||||
// pinned memory is almost as fine
|
||||
if(g_ogl_config.bSupportsGLPinnedMemory &&
|
||||
if (g_ogl_config.bSupportsGLPinnedMemory &&
|
||||
!(DriverDetails::HasBug(DriverDetails::BUG_BROKENPINNEDMEMORY) && type == GL_ELEMENT_ARRAY_BUFFER))
|
||||
return new PinnedMemory(type, size);
|
||||
|
||||
// don't fall back to MapAnd* for nvidia drivers
|
||||
if(DriverDetails::HasBug(DriverDetails::BUG_BROKENUNSYNCMAPPING))
|
||||
if (DriverDetails::HasBug(DriverDetails::BUG_BROKENUNSYNCMAPPING))
|
||||
return new BufferSubData(type, size);
|
||||
|
||||
// mapping fallback
|
||||
if(g_ogl_config.bSupportsGLSync)
|
||||
if (g_ogl_config.bSupportsGLSync)
|
||||
return new MapAndSync(type, size);
|
||||
}
|
||||
|
||||
|
|
|
@ -84,8 +84,8 @@ TextureCache::TCacheEntry::~TCacheEntry()
|
|||
{
|
||||
if (texture)
|
||||
{
|
||||
for(auto& gtex : s_Textures)
|
||||
if(gtex == texture)
|
||||
for (auto& gtex : s_Textures)
|
||||
if (gtex == texture)
|
||||
gtex = 0;
|
||||
glDeleteTextures(1, &texture);
|
||||
texture = 0;
|
||||
|
@ -282,14 +282,17 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
|
|||
|
||||
glViewport(0, 0, virtual_width, virtual_height);
|
||||
|
||||
if(srcFormat == PIXELFMT_Z24) {
|
||||
if (srcFormat == PIXELFMT_Z24)
|
||||
{
|
||||
s_DepthMatrixProgram.Bind();
|
||||
if(s_DepthCbufid != cbufid)
|
||||
if (s_DepthCbufid != cbufid)
|
||||
glUniform4fv(s_DepthMatrixUniform, 5, colmat);
|
||||
s_DepthCbufid = cbufid;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
s_ColorMatrixProgram.Bind();
|
||||
if(s_ColorCbufid != cbufid)
|
||||
if (s_ColorCbufid != cbufid)
|
||||
glUniform4fv(s_ColorMatrixUniform, 7, colmat);
|
||||
s_ColorCbufid = cbufid;
|
||||
}
|
||||
|
@ -391,7 +394,7 @@ TextureCache::TextureCache()
|
|||
s_DepthCopyPositionUniform = glGetUniformLocation(s_DepthMatrixProgram.glprogid, "copy_position");
|
||||
|
||||
s_ActiveTexture = -1;
|
||||
for(auto& gtex : s_Textures)
|
||||
for (auto& gtex : s_Textures)
|
||||
gtex = -1;
|
||||
}
|
||||
|
||||
|
@ -409,7 +412,7 @@ void TextureCache::DisableStage(unsigned int stage)
|
|||
void TextureCache::SetStage ()
|
||||
{
|
||||
// -1 is the initial value as we don't know which testure should be bound
|
||||
if(s_ActiveTexture != (u32)-1)
|
||||
if (s_ActiveTexture != (u32)-1)
|
||||
glActiveTexture(GL_TEXTURE0 + s_ActiveTexture);
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ void VertexManager::Draw(u32 stride)
|
|||
u32 max_index = IndexGenerator::GetNumVerts();
|
||||
GLenum primitive_mode = 0;
|
||||
|
||||
switch(current_primitive_type)
|
||||
switch (current_primitive_type)
|
||||
{
|
||||
case PRIMITIVE_POINTS:
|
||||
primitive_mode = GL_POINTS;
|
||||
|
@ -119,7 +119,7 @@ void VertexManager::Draw(u32 stride)
|
|||
break;
|
||||
}
|
||||
|
||||
if(g_ogl_config.bSupportsGLBaseVertex) {
|
||||
if (g_ogl_config.bSupportsGLBaseVertex) {
|
||||
glDrawRangeElementsBaseVertex(primitive_mode, 0, max_index, index_size, GL_UNSIGNED_SHORT, (u8*)nullptr+s_index_offset, (GLint)s_baseVertex);
|
||||
} else {
|
||||
glDrawRangeElements(primitive_mode, 0, max_index, index_size, GL_UNSIGNED_SHORT, (u8*)nullptr+s_index_offset);
|
||||
|
@ -132,7 +132,7 @@ void VertexManager::vFlush(bool useDstAlpha)
|
|||
GLVertexFormat *nativeVertexFmt = (GLVertexFormat*)g_nativeVertexFmt;
|
||||
u32 stride = nativeVertexFmt->GetVertexStride();
|
||||
|
||||
if(m_last_vao != nativeVertexFmt->VAO) {
|
||||
if (m_last_vao != nativeVertexFmt->VAO) {
|
||||
glBindVertexArray(nativeVertexFmt->VAO);
|
||||
m_last_vao = nativeVertexFmt->VAO;
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ namespace Clipper
|
|||
|
||||
if (mask != 0)
|
||||
{
|
||||
for(int i = 0; i < 3; i += 3)
|
||||
for (int i = 0; i < 3; i += 3)
|
||||
{
|
||||
int vlist[2][2*6+1];
|
||||
int *inlist = vlist[0], *outlist = vlist[1];
|
||||
|
@ -273,7 +273,7 @@ namespace Clipper
|
|||
|
||||
bool backface;
|
||||
|
||||
if(!CullTest(v0, v1, v2, backface))
|
||||
if (!CullTest(v0, v1, v2, backface))
|
||||
return;
|
||||
|
||||
int indices[NUM_INDICES] = { 0, 1, 2, SKIP_FLAG, SKIP_FLAG, SKIP_FLAG, SKIP_FLAG, SKIP_FLAG, SKIP_FLAG,
|
||||
|
@ -296,10 +296,10 @@ namespace Clipper
|
|||
|
||||
ClipTriangle(indices, numIndices);
|
||||
|
||||
for(int i = 0; i+3 <= numIndices; i+=3)
|
||||
for (int i = 0; i+3 <= numIndices; i+=3)
|
||||
{
|
||||
_assert_(i < NUM_INDICES);
|
||||
if(indices[i] != SKIP_FLAG)
|
||||
if (indices[i] != SKIP_FLAG)
|
||||
{
|
||||
PerspectiveDivide(Vertices[indices[i]]);
|
||||
PerspectiveDivide(Vertices[indices[i+1]]);
|
||||
|
@ -339,7 +339,7 @@ namespace Clipper
|
|||
|
||||
ClipLine(indices);
|
||||
|
||||
if(indices[0] != SKIP_FLAG)
|
||||
if (indices[0] != SKIP_FLAG)
|
||||
{
|
||||
OutputVertexData *v0 = Vertices[indices[0]];
|
||||
OutputVertexData *v1 = Vertices[indices[1]];
|
||||
|
@ -353,16 +353,16 @@ namespace Clipper
|
|||
float screenDx = 0;
|
||||
float screenDy = 0;
|
||||
|
||||
if(fabsf(dx) > fabsf(dy))
|
||||
if (fabsf(dx) > fabsf(dy))
|
||||
{
|
||||
if(dx > 0)
|
||||
if (dx > 0)
|
||||
screenDy = bpmem.lineptwidth.linesize / -12.0f;
|
||||
else
|
||||
screenDy = bpmem.lineptwidth.linesize / 12.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(dy > 0)
|
||||
if (dy > 0)
|
||||
screenDx = bpmem.lineptwidth.linesize / 12.0f;
|
||||
else
|
||||
screenDx = bpmem.lineptwidth.linesize / -12.0f;
|
||||
|
@ -389,7 +389,7 @@ namespace Clipper
|
|||
mask &= CalcClipMask(v1);
|
||||
mask &= CalcClipMask(v2);
|
||||
|
||||
if(mask)
|
||||
if (mask)
|
||||
{
|
||||
INCSTAT(swstats.thisFrame.numTrianglesRejected)
|
||||
return false;
|
||||
|
|
|
@ -84,7 +84,7 @@ s32 GetMaxTextureLod(u32 texmap)
|
|||
u8 mip = maxLod >> 4;
|
||||
u8 fract = maxLod & 0xf;
|
||||
|
||||
if(fract)
|
||||
if (fract)
|
||||
++mip;
|
||||
|
||||
return (s32)mip;
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace EfbCopy
|
|||
INFO_LOG(VIDEO, "xfbaddr: %x, fbwidth: %i, fbheight: %i, source: (%i, %i, %i, %i), Gamma %f",
|
||||
xfbAddr, fbWidth, fbHeight, sourceRc.top, sourceRc.left, sourceRc.bottom, sourceRc.right, Gamma);
|
||||
|
||||
if(!g_SWVideoConfig.bBypassXFB)
|
||||
if (!g_SWVideoConfig.bBypassXFB)
|
||||
{
|
||||
EfbInterface::yuv422_packed* xfb_in_ram = (EfbInterface::yuv422_packed *) Memory::GetPointer(xfbAddr);
|
||||
|
||||
|
|
|
@ -552,7 +552,7 @@ namespace EfbInterface
|
|||
|
||||
// Like CopyToXFB, but we copy directly into the opengl colour texture without going via Gamecube main memory or doing a yuyv conversion
|
||||
void BypassXFB(u8* texture, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc, float Gamma) {
|
||||
if(fbWidth*fbHeight > 640*568) {
|
||||
if (fbWidth*fbHeight > 640*568) {
|
||||
ERROR_LOG(VIDEO, "Framebuffer is too large: %ix%i", fbWidth, fbHeight);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ void DecodeStandard(u32 bufferSize)
|
|||
DebugUtil::OnObjectBegin();
|
||||
}
|
||||
#endif
|
||||
switch(Cmd)
|
||||
switch (Cmd)
|
||||
{
|
||||
case GX_NOP:
|
||||
break;
|
||||
|
@ -250,7 +250,7 @@ bool CommandRunnable(u32 iBufferSize)
|
|||
u8 Cmd = DataPeek8(0);
|
||||
u32 minSize = 1;
|
||||
|
||||
switch(Cmd)
|
||||
switch (Cmd)
|
||||
{
|
||||
case GX_LOAD_CP_REG: //0x08
|
||||
minSize = 6;
|
||||
|
|
|
@ -87,7 +87,7 @@ inline int iround(float x)
|
|||
int t;
|
||||
|
||||
t = (int)x;
|
||||
if((x - t) >= 0.5)
|
||||
if ((x - t) >= 0.5)
|
||||
return t + 1;
|
||||
|
||||
return t;
|
||||
|
@ -149,7 +149,7 @@ inline void Draw(s32 x, s32 y, s32 xi, s32 yi)
|
|||
// colors
|
||||
for (unsigned int i = 0; i < bpmem.genMode.numcolchans; i++)
|
||||
{
|
||||
for(int comp = 0; comp < 4; comp++)
|
||||
for (int comp = 0; comp < 4; comp++)
|
||||
{
|
||||
u16 color = (u16)ColorSlopes[i][comp].GetValue(dx, dy);
|
||||
|
||||
|
@ -299,7 +299,7 @@ void BuildBlock(s32 blockX, s32 blockY)
|
|||
{
|
||||
int stageOdd = i&1;
|
||||
TwoTevStageOrders &order = bpmem.tevorders[i >> 1];
|
||||
if(order.getEnable(stageOdd))
|
||||
if (order.getEnable(stageOdd))
|
||||
{
|
||||
u32 texmap = order.getTexMap(stageOdd);
|
||||
u32 texcoord = order.getTexCoord(stageOdd);
|
||||
|
@ -384,15 +384,15 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer
|
|||
if (!bpmem.genMode.zfreeze || !g_SWVideoConfig.bZFreeze)
|
||||
InitSlope(&ZSlope, v0->screenPosition[2], v1->screenPosition[2], v2->screenPosition[2], fltdx31, fltdx12, fltdy12, fltdy31);
|
||||
|
||||
for(unsigned int i = 0; i < bpmem.genMode.numcolchans; i++)
|
||||
for (unsigned int i = 0; i < bpmem.genMode.numcolchans; i++)
|
||||
{
|
||||
for(int comp = 0; comp < 4; comp++)
|
||||
for (int comp = 0; comp < 4; comp++)
|
||||
InitSlope(&ColorSlopes[i][comp], v0->color[i][comp], v1->color[i][comp], v2->color[i][comp], fltdx31, fltdx12, fltdy12, fltdy31);
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i < bpmem.genMode.numtexgens; i++)
|
||||
for (unsigned int i = 0; i < bpmem.genMode.numtexgens; i++)
|
||||
{
|
||||
for(int comp = 0; comp < 3; comp++)
|
||||
for (int comp = 0; comp < 3; comp++)
|
||||
InitSlope(&TexSlopes[i][comp], v0->texCoords[i][comp] * w[0], v1->texCoords[i][comp] * w[1], v2->texCoords[i][comp] * w[2], fltdx31, fltdx12, fltdy12, fltdy31);
|
||||
}
|
||||
|
||||
|
@ -406,14 +406,14 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer
|
|||
s32 C3 = DY31 * X3 - DX31 * Y3;
|
||||
|
||||
// Correct for fill convention
|
||||
if(DY12 < 0 || (DY12 == 0 && DX12 > 0)) C1++;
|
||||
if(DY23 < 0 || (DY23 == 0 && DX23 > 0)) C2++;
|
||||
if(DY31 < 0 || (DY31 == 0 && DX31 > 0)) C3++;
|
||||
if (DY12 < 0 || (DY12 == 0 && DX12 > 0)) C1++;
|
||||
if (DY23 < 0 || (DY23 == 0 && DX23 > 0)) C2++;
|
||||
if (DY31 < 0 || (DY31 == 0 && DX31 > 0)) C3++;
|
||||
|
||||
// Loop through blocks
|
||||
for(s32 y = miny; y < maxy; y += BLOCK_SIZE)
|
||||
for (s32 y = miny; y < maxy; y += BLOCK_SIZE)
|
||||
{
|
||||
for(s32 x = minx; x < maxx; x += BLOCK_SIZE)
|
||||
for (s32 x = minx; x < maxx; x += BLOCK_SIZE)
|
||||
{
|
||||
// Corners of block
|
||||
s32 x0 = x << 4;
|
||||
|
@ -441,17 +441,17 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer
|
|||
int c = (c00 << 0) | (c10 << 1) | (c01 << 2) | (c11 << 3);
|
||||
|
||||
// Skip block when outside an edge
|
||||
if(a == 0x0 || b == 0x0 || c == 0x0)
|
||||
if (a == 0x0 || b == 0x0 || c == 0x0)
|
||||
continue;
|
||||
|
||||
BuildBlock(x, y);
|
||||
|
||||
// Accept whole block when totally covered
|
||||
if(a == 0xF && b == 0xF && c == 0xF)
|
||||
if (a == 0xF && b == 0xF && c == 0xF)
|
||||
{
|
||||
for(s32 iy = 0; iy < BLOCK_SIZE; iy++)
|
||||
for (s32 iy = 0; iy < BLOCK_SIZE; iy++)
|
||||
{
|
||||
for(s32 ix = 0; ix < BLOCK_SIZE; ix++)
|
||||
for (s32 ix = 0; ix < BLOCK_SIZE; ix++)
|
||||
{
|
||||
Draw(x + ix, y + iy, ix, iy);
|
||||
}
|
||||
|
@ -463,15 +463,15 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer
|
|||
s32 CY2 = C2 + DX23 * y0 - DY23 * x0;
|
||||
s32 CY3 = C3 + DX31 * y0 - DY31 * x0;
|
||||
|
||||
for(s32 iy = 0; iy < BLOCK_SIZE; iy++)
|
||||
for (s32 iy = 0; iy < BLOCK_SIZE; iy++)
|
||||
{
|
||||
s32 CX1 = CY1;
|
||||
s32 CX2 = CY2;
|
||||
s32 CX3 = CY3;
|
||||
|
||||
for(s32 ix = 0; ix < BLOCK_SIZE; ix++)
|
||||
for (s32 ix = 0; ix < BLOCK_SIZE; ix++)
|
||||
{
|
||||
if(CX1 > 0 && CX2 > 0 && CX3 > 0)
|
||||
if (CX1 > 0 && CX2 > 0 && CX3 > 0)
|
||||
{
|
||||
Draw(x + ix, y + iy, ix, iy);
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ void SWRenderer::swapColorTexture() {
|
|||
|
||||
void SWRenderer::UpdateColorTexture(EfbInterface::yuv422_packed *xfb, u32 fbWidth, u32 fbHeight)
|
||||
{
|
||||
if(fbWidth*fbHeight > 640*568) {
|
||||
if (fbWidth*fbHeight > 640*568) {
|
||||
ERROR_LOG(VIDEO, "Framebuffer is too large: %ix%i", fbWidth, fbHeight);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ void VideoSoftware::Video_EndField()
|
|||
}
|
||||
if (!g_SWVideoConfig.bHwRasterizer)
|
||||
{
|
||||
if(!g_SWVideoConfig.bBypassXFB)
|
||||
if (!g_SWVideoConfig.bBypassXFB)
|
||||
{
|
||||
EfbInterface::yuv422_packed *xfb = (EfbInterface::yuv422_packed *) Memory::GetPointer(s_beginFieldArgs.xfbAddr);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ void SetupUnit::Init(u8 primitiveType)
|
|||
|
||||
void SetupUnit::SetupVertex()
|
||||
{
|
||||
switch(m_PrimType)
|
||||
switch (m_PrimType)
|
||||
{
|
||||
case GX_DRAW_QUADS:
|
||||
SetupQuad();
|
||||
|
|
|
@ -126,7 +126,7 @@ inline s16 Clamp1024(s16 in)
|
|||
|
||||
void Tev::SetRasColor(int colorChan, int swaptable)
|
||||
{
|
||||
switch(colorChan)
|
||||
switch (colorChan)
|
||||
{
|
||||
case 0: // Color0
|
||||
{
|
||||
|
@ -209,7 +209,7 @@ void Tev::DrawColorCompare(TevStageCombiner::ColorCombiner &cc)
|
|||
|
||||
InputRegType InputReg;
|
||||
|
||||
switch(cmp) {
|
||||
switch (cmp) {
|
||||
case TEVCMP_R8_GT:
|
||||
{
|
||||
a = *m_ColorInputLUT[cc.a][RED_INP] & 0xff;
|
||||
|
@ -336,7 +336,7 @@ void Tev::DrawAlphaCompare(TevStageCombiner::AlphaCombiner &ac)
|
|||
|
||||
InputRegType InputReg;
|
||||
|
||||
switch(cmp) {
|
||||
switch (cmp) {
|
||||
case TEVCMP_R8_GT:
|
||||
{
|
||||
a = m_AlphaInputLUT[ac.a][RED_C] & 0xff;
|
||||
|
@ -415,7 +415,7 @@ void Tev::DrawAlphaCompare(TevStageCombiner::AlphaCombiner &ac)
|
|||
|
||||
static bool AlphaCompare(int alpha, int ref, int comp)
|
||||
{
|
||||
switch(comp) {
|
||||
switch (comp) {
|
||||
case ALPHACMP_ALWAYS: return true;
|
||||
case ALPHACMP_NEVER: return false;
|
||||
case ALPHACMP_LEQUAL: return alpha <= ref;
|
||||
|
@ -497,7 +497,7 @@ void Tev::Indirect(unsigned int stageNum, s32 s, s32 t)
|
|||
bias[2] = indirect.bias&4?biasValue:0;
|
||||
|
||||
// format
|
||||
switch(indirect.fmt)
|
||||
switch (indirect.fmt)
|
||||
{
|
||||
case ITF_8:
|
||||
indcoord[0] = indmap[TextureSampler::ALP_SMP] + bias[0];
|
||||
|
@ -756,7 +756,7 @@ void Tev::Draw()
|
|||
|
||||
}
|
||||
|
||||
if(bpmem.fogRange.Base.Enabled)
|
||||
if (bpmem.fogRange.Base.Enabled)
|
||||
{
|
||||
// TODO: This is untested and should definitely be checked against real hw.
|
||||
// - No idea if offset is really normalized against the viewport width or against the projection matrix or yet something else
|
||||
|
|
|
@ -261,7 +261,7 @@ void EncodeRGBA6(u8 *dst, u8 *src, u32 format)
|
|||
u32 readStride = 3;
|
||||
u8 *dstBlockStart = dst;
|
||||
|
||||
switch(format)
|
||||
switch (format)
|
||||
{
|
||||
case GX_TF_I4:
|
||||
SetBlockDimensions(3, 3, sBlkCount, tBlkCount, sBlkSize, tBlkSize);
|
||||
|
@ -498,7 +498,7 @@ void EncodeRGBA6halfscale(u8 *dst, u8 *src, u32 format)
|
|||
u32 readStride = 6;
|
||||
u8 *dstBlockStart = dst;
|
||||
|
||||
switch(format)
|
||||
switch (format)
|
||||
{
|
||||
case GX_TF_I4:
|
||||
SetBlockDimensions(3, 3, sBlkCount, tBlkCount, sBlkSize, tBlkSize);
|
||||
|
@ -732,7 +732,7 @@ void EncodeRGB8(u8 *dst, u8 *src, u32 format)
|
|||
u32 readStride = 3;
|
||||
u8 *dstBlockStart = dst;
|
||||
|
||||
switch(format)
|
||||
switch (format)
|
||||
{
|
||||
case GX_TF_I4:
|
||||
SetBlockDimensions(3, 3, sBlkCount, tBlkCount, sBlkSize, tBlkSize);
|
||||
|
@ -947,7 +947,7 @@ void EncodeRGB8halfscale(u8 *dst, u8 *src, u32 format)
|
|||
u32 readStride = 6;
|
||||
u8 *dstBlockStart = dst;
|
||||
|
||||
switch(format)
|
||||
switch (format)
|
||||
{
|
||||
case GX_TF_I4:
|
||||
SetBlockDimensions(3, 3, sBlkCount, tBlkCount, sBlkSize, tBlkSize);
|
||||
|
@ -1177,7 +1177,7 @@ void EncodeZ24(u8 *dst, u8 *src, u32 format)
|
|||
u32 readStride = 3;
|
||||
u8 *dstBlockStart = dst;
|
||||
|
||||
switch(format)
|
||||
switch (format)
|
||||
{
|
||||
case GX_TF_Z8:
|
||||
SetBlockDimensions(3, 2, sBlkCount, tBlkCount, sBlkSize, tBlkSize);
|
||||
|
@ -1282,7 +1282,7 @@ void EncodeZ24halfscale(u8 *dst, u8 *src, u32 format)
|
|||
u8 r, g, b;
|
||||
u8 *dstBlockStart = dst;
|
||||
|
||||
switch(format)
|
||||
switch (format)
|
||||
{
|
||||
case GX_TF_Z8:
|
||||
SetBlockDimensions(3, 2, sBlkCount, tBlkCount, sBlkSize, tBlkSize);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue