reformat all files with clang-format

This commit is contained in:
wwylele 2018-06-29 16:56:12 +03:00
parent 7c5a76e58b
commit 0eab948728
79 changed files with 659 additions and 707 deletions

View file

@ -69,7 +69,7 @@ static void WriteUniformIntReg(Shader::ShaderSetup& setup, unsigned index,
ASSERT(index < setup.uniforms.i.size());
setup.uniforms.i[index] = values;
LOG_TRACE(HW_GPU, "Set {} integer uniform {} to {:02x} {:02x} {:02x} {:02x}",
GetShaderSetupTypeName(setup), index, values.x, values.y, values.z, values.w);
GetShaderSetupTypeName(setup), index, values.x, values.y, values.z, values.w);
}
static void WriteUniformFloatReg(ShaderRegs& config, Shader::ShaderSetup& setup,
@ -91,7 +91,7 @@ static void WriteUniformFloatReg(ShaderRegs& config, Shader::ShaderSetup& setup,
if (uniform_setup.index >= 96) {
LOG_ERROR(HW_GPU, "Invalid {} float uniform index {}", GetShaderSetupTypeName(setup),
(int)uniform_setup.index);
(int)uniform_setup.index);
} else {
// NOTE: The destination component order indeed is "backwards"
@ -109,9 +109,9 @@ static void WriteUniformFloatReg(ShaderRegs& config, Shader::ShaderSetup& setup,
}
LOG_TRACE(HW_GPU, "Set {} float uniform {:x} to ({} {} {} {})",
GetShaderSetupTypeName(setup), (int)uniform_setup.index,
uniform.x.ToFloat32(), uniform.y.ToFloat32(), uniform.z.ToFloat32(),
uniform.w.ToFloat32());
GetShaderSetupTypeName(setup), (int)uniform_setup.index,
uniform.x.ToFloat32(), uniform.y.ToFloat32(), uniform.z.ToFloat32(),
uniform.w.ToFloat32());
// TODO: Verify that this actually modifies the register!
uniform_setup.index.Assign(uniform_setup.index + 1);
@ -199,8 +199,8 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
attribute.x = float24::FromRaw(default_attr_write_buffer[2] & 0xFFFFFF);
LOG_TRACE(HW_GPU, "Set default VS attribute {:x} to ({} {} {} {})", (int)setup.index,
attribute.x.ToFloat32(), attribute.y.ToFloat32(), attribute.z.ToFloat32(),
attribute.w.ToFloat32());
attribute.x.ToFloat32(), attribute.y.ToFloat32(), attribute.z.ToFloat32(),
attribute.w.ToFloat32());
// TODO: Verify that this actually modifies the register!
if (setup.index < 15) {

View file

@ -179,11 +179,11 @@ void DumpShader(const std::string& filename, const ShaderRegs& config,
} catch (const std::out_of_range&) {
DEBUG_ASSERT_MSG(false, "Unknown output attribute mapping");
LOG_ERROR(HW_GPU,
"Unknown output attribute mapping: {:03x}, {:03x}, {:03x}, {:03x}",
(int)output_attributes[i].map_x.Value(),
(int)output_attributes[i].map_y.Value(),
(int)output_attributes[i].map_z.Value(),
(int)output_attributes[i].map_w.Value());
"Unknown output attribute mapping: {:03x}, {:03x}, {:03x}, {:03x}",
(int)output_attributes[i].map_x.Value(),
(int)output_attributes[i].map_y.Value(),
(int)output_attributes[i].map_z.Value(),
(int)output_attributes[i].map_w.Value());
}
}
}

View file

@ -43,9 +43,8 @@ RasterizerOpenGL::RasterizerOpenGL()
allow_shadow = GLAD_GL_ARB_shader_image_load_store && GLAD_GL_ARB_shader_image_size &&
GLAD_GL_ARB_framebuffer_no_attachments;
if (!allow_shadow) {
LOG_WARNING(
Render_OpenGL,
"Shadow might not be able to render because of unsupported OpenGL extensions.");
LOG_WARNING(Render_OpenGL,
"Shadow might not be able to render because of unsupported OpenGL extensions.");
}
// Clipping plane 0 is always enabled for PICA fixed clip plane z <= 0
@ -1601,7 +1600,7 @@ void RasterizerOpenGL::SyncCullMode() {
default:
LOG_CRITICAL(Render_OpenGL, "Unknown cull mode {}",
static_cast<u32>(regs.rasterizer.cull_mode.Value()));
static_cast<u32>(regs.rasterizer.cull_mode.Value()));
UNIMPLEMENTED();
break;
}

View file

@ -1391,7 +1391,7 @@ SurfaceSurfaceRect_Tuple RasterizerCacheOpenGL::GetFramebufferSurfaces(
if (using_color_fb && using_depth_fb &&
boost::icl::length(color_vp_interval & depth_vp_interval)) {
LOG_CRITICAL(Render_OpenGL, "Color and depth framebuffer memory regions overlap; "
"overlapping framebuffers not supported!");
"overlapping framebuffers not supported!");
using_depth_fb = false;
}

View file

@ -573,8 +573,8 @@ private:
default: {
LOG_ERROR(HW_GPU, "Unhandled arithmetic instruction: 0x{:02x} ({}): 0x{:08x}",
(int)instr.opcode.Value().EffectiveOpCode(),
instr.opcode.Value().GetInfo().name, instr.hex);
(int)instr.opcode.Value().EffectiveOpCode(),
instr.opcode.Value().GetInfo().name, instr.hex);
throw DecompileFail("Unhandled instruction");
break;
}
@ -617,8 +617,8 @@ private:
}
} else {
LOG_ERROR(HW_GPU, "Unhandled multiply-add instruction: 0x{:02x} ({}): 0x{:08x}",
(int)instr.opcode.Value().EffectiveOpCode(),
instr.opcode.Value().GetInfo().name, instr.hex);
(int)instr.opcode.Value().EffectiveOpCode(),
instr.opcode.Value().GetInfo().name, instr.hex);
throw DecompileFail("Unhandled instruction");
}
break;
@ -771,8 +771,8 @@ private:
default: {
LOG_ERROR(HW_GPU, "Unhandled instruction: 0x{:02x} ({}): 0x{:08x}",
(int)instr.opcode.Value().EffectiveOpCode(),
instr.opcode.Value().GetInfo().name, instr.hex);
(int)instr.opcode.Value().EffectiveOpCode(),
instr.opcode.Value().GetInfo().name, instr.hex);
throw DecompileFail("Unhandled instruction");
break;
}

View file

@ -270,7 +270,7 @@ void PicaGSConfigCommonRaw::Init(const Pica::Regs& regs) {
semantic_maps[static_cast<size_t>(semantic)] = {attrib, comp};
} else if (semantic != VSOutputAttributes::INVALID) {
LOG_ERROR(Render_OpenGL, "Invalid/unknown semantic id: {}",
static_cast<u32>(semantic));
static_cast<u32>(semantic));
}
}
}
@ -321,7 +321,7 @@ static std::string SampleTexture(const PicaFSConfig& config, unsigned texture_un
return "shadowTextureCube(texcoord0, texcoord0_w)";
default:
LOG_CRITICAL(HW_GPU, "Unhandled texture type {:x}",
static_cast<int>(state.texture0_type));
static_cast<int>(state.texture0_type));
UNIMPLEMENTED();
return "texture(tex0, texcoord0)";
}
@ -535,7 +535,7 @@ static void AppendColorCombiner(std::string& out, TevStageConfig::Operation oper
default:
out += "vec3(0.0)";
LOG_CRITICAL(Render_OpenGL, "Unknown color combiner operation: {}",
static_cast<u32>(operation));
static_cast<u32>(operation));
break;
}
out += ", vec3(0.0), vec3(1.0))"; // Clamp result to 0.0, 1.0
@ -576,7 +576,7 @@ static void AppendAlphaCombiner(std::string& out, TevStageConfig::Operation oper
default:
out += "0.0";
LOG_CRITICAL(Render_OpenGL, "Unknown alpha combiner operation: {}",
static_cast<u32>(operation));
static_cast<u32>(operation));
break;
}
out += ", 0.0, 1.0)";

View file

@ -43,7 +43,7 @@ GLuint LoadShader(const char* source, GLenum type) {
LOG_DEBUG(Render_OpenGL, "{}", &shader_error[0]);
} else {
LOG_ERROR(Render_OpenGL, "Error compiling {} shader:\n{}", debug_type,
&shader_error[0]);
&shader_error[0]);
LOG_ERROR(Render_OpenGL, "Shader source code:\n{}", source);
}
}

View file

@ -172,8 +172,8 @@ void RendererOpenGL::LoadFBToScreenInfo(const GPU::Regs::FramebufferConfig& fram
: (!right_eye ? framebuffer.address_left2 : framebuffer.address_right2);
LOG_TRACE(Render_OpenGL, "0x{:08x} bytes from 0x{:08x}({}x{}), fmt {:x}",
framebuffer.stride * framebuffer.height, framebuffer_addr, (int)framebuffer.width,
(int)framebuffer.height, (int)framebuffer.format);
framebuffer.stride * framebuffer.height, framebuffer_addr, (int)framebuffer.width,
(int)framebuffer.height, (int)framebuffer.format);
int bpp = GPU::Regs::BytesPerPixel(framebuffer.color_format);
size_t pixel_stride = framebuffer.stride / bpp;
@ -494,8 +494,8 @@ static void APIENTRY DebugHandler(GLenum source, GLenum type, GLuint id, GLenum
level = Log::Level::Debug;
break;
}
LOG_GENERIC(Log::Class::Render_OpenGL, level, "{} {} {}: {}", GetSource(source),
GetType(type), id, message);
LOG_GENERIC(Log::Class::Render_OpenGL, level, "{} {} {}: {}", GetSource(source), GetType(type),
id, message);
}
/// Initialize the renderer

View file

@ -66,14 +66,14 @@ OutputVertex OutputVertex::FromAttributeBuffer(const RasterizerRegs& regs,
}
LOG_TRACE(HW_GPU,
"Output vertex: pos({:.2}, {:.2}, {:.2}, {:.2}), quat({:.2}, {:.2}, {:.2}, {:.2}), "
"col({:.2}, {:.2}, {:.2}, {:.2}), tc0({:.2}, {:.2}), view({:.2}, {:.2}, {:.2})",
ret.pos.x.ToFloat32(), ret.pos.y.ToFloat32(), ret.pos.z.ToFloat32(),
ret.pos.w.ToFloat32(), ret.quat.x.ToFloat32(), ret.quat.y.ToFloat32(),
ret.quat.z.ToFloat32(), ret.quat.w.ToFloat32(), ret.color.x.ToFloat32(),
ret.color.y.ToFloat32(), ret.color.z.ToFloat32(), ret.color.w.ToFloat32(),
ret.tc0.u().ToFloat32(), ret.tc0.v().ToFloat32(), ret.view.x.ToFloat32(),
ret.view.y.ToFloat32(), ret.view.z.ToFloat32());
"Output vertex: pos({:.2}, {:.2}, {:.2}, {:.2}), quat({:.2}, {:.2}, {:.2}, {:.2}), "
"col({:.2}, {:.2}, {:.2}, {:.2}), tc0({:.2}, {:.2}), view({:.2}, {:.2}, {:.2})",
ret.pos.x.ToFloat32(), ret.pos.y.ToFloat32(), ret.pos.z.ToFloat32(),
ret.pos.w.ToFloat32(), ret.quat.x.ToFloat32(), ret.quat.y.ToFloat32(),
ret.quat.z.ToFloat32(), ret.quat.w.ToFloat32(), ret.color.x.ToFloat32(),
ret.color.y.ToFloat32(), ret.color.z.ToFloat32(), ret.color.w.ToFloat32(),
ret.tc0.u().ToFloat32(), ret.tc0.v().ToFloat32(), ret.view.x.ToFloat32(),
ret.view.y.ToFloat32(), ret.view.z.ToFloat32());
return ret;
}

View file

@ -447,8 +447,8 @@ static void RunInterpreter(const ShaderSetup& setup, UnitState& state, DebugData
default:
LOG_ERROR(HW_GPU, "Unhandled arithmetic instruction: 0x{:02x} ({}): 0x{:08x}",
(int)instr.opcode.Value().EffectiveOpCode(),
instr.opcode.Value().GetInfo().name, instr.hex);
(int)instr.opcode.Value().EffectiveOpCode(),
instr.opcode.Value().GetInfo().name, instr.hex);
DEBUG_ASSERT(false);
break;
}
@ -536,8 +536,8 @@ static void RunInterpreter(const ShaderSetup& setup, UnitState& state, DebugData
Record<DebugDataRecord::DEST_OUT>(debug_data, iteration, dest);
} else {
LOG_ERROR(HW_GPU, "Unhandled multiply-add instruction: 0x{:02x} ({}): 0x{:08x}",
(int)instr.opcode.Value().EffectiveOpCode(),
instr.opcode.Value().GetInfo().name, instr.hex);
(int)instr.opcode.Value().EffectiveOpCode(),
instr.opcode.Value().GetInfo().name, instr.hex);
}
break;
}
@ -654,8 +654,8 @@ static void RunInterpreter(const ShaderSetup& setup, UnitState& state, DebugData
default:
LOG_ERROR(HW_GPU, "Unhandled instruction: 0x{:02x} ({}): 0x{:08x}",
(int)instr.opcode.Value().EffectiveOpCode(),
instr.opcode.Value().GetInfo().name, instr.hex);
(int)instr.opcode.Value().EffectiveOpCode(),
instr.opcode.Value().GetInfo().name, instr.hex);
break;
}

View file

@ -859,7 +859,7 @@ void JitShader::Compile_NextInstr() {
} else {
// Unhandled instruction
LOG_CRITICAL(HW_GPU, "Unhandled instruction: 0x{:02x} (0x{:08x})",
static_cast<u32>(instr.opcode.Value().EffectiveOpCode()), instr.hex);
static_cast<u32>(instr.opcode.Value().EffectiveOpCode()), instr.hex);
}
}

View file

@ -58,7 +58,7 @@ void DrawPixel(int x, int y, const Math::Vec4<u8>& color) {
default:
LOG_CRITICAL(Render_Software, "Unknown framebuffer color format {:x}",
static_cast<u32>(framebuffer.color_format.Value()));
static_cast<u32>(framebuffer.color_format.Value()));
UNIMPLEMENTED();
}
}
@ -94,7 +94,7 @@ const Math::Vec4<u8> GetPixel(int x, int y) {
default:
LOG_CRITICAL(Render_Software, "Unknown framebuffer color format {:x}",
static_cast<u32>(framebuffer.color_format.Value()));
static_cast<u32>(framebuffer.color_format.Value()));
UNIMPLEMENTED();
}
@ -124,7 +124,7 @@ u32 GetDepth(int x, int y) {
return Color::DecodeD24S8(src_pixel).x;
default:
LOG_CRITICAL(HW_GPU, "Unimplemented depth format {}",
static_cast<u32>(framebuffer.depth_format.Value()));
static_cast<u32>(framebuffer.depth_format.Value()));
UNIMPLEMENTED();
return 0;
}
@ -186,7 +186,7 @@ void SetDepth(int x, int y, u32 value) {
default:
LOG_CRITICAL(HW_GPU, "Unimplemented depth format {}",
static_cast<u32>(framebuffer.depth_format.Value()));
static_cast<u32>(framebuffer.depth_format.Value()));
UNIMPLEMENTED();
break;
}
@ -218,7 +218,7 @@ void SetStencil(int x, int y, u8 value) {
default:
LOG_CRITICAL(HW_GPU, "Unimplemented depth format {}",
static_cast<u32>(framebuffer.depth_format.Value()));
static_cast<u32>(framebuffer.depth_format.Value()));
UNIMPLEMENTED();
break;
}

View file

@ -54,7 +54,7 @@ std::tuple<Math::Vec4<u8>, Math::Vec4<u8>> ComputeFragmentsColors(
surface_tangent = perturbation;
} else {
LOG_ERROR(HW_GPU, "Unknown bump mode {}",
static_cast<u32>(lighting.config0.bump_mode.Value()));
static_cast<u32>(lighting.config0.bump_mode.Value()));
}
} else {
surface_normal = Math::MakeVec(0.0f, 0.0f, 1.0f);

View file

@ -363,8 +363,7 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve
}
default:
// TODO: Change to LOG_ERROR when more types are handled.
LOG_DEBUG(HW_GPU, "Unhandled texture type {:x}",
(int)texture.config.type);
LOG_DEBUG(HW_GPU, "Unhandled texture type {:x}", (int)texture.config.type);
UNIMPLEMENTED();
break;
}
@ -844,8 +843,7 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve
return std::min(combiner_output.a(), static_cast<u8>(255 - dest.a()));
default:
LOG_CRITICAL(HW_GPU, "Unknown blend factor {:x}",
static_cast<u32>(factor));
LOG_CRITICAL(HW_GPU, "Unknown blend factor {:x}", static_cast<u32>(factor));
UNIMPLEMENTED();
break;
}

View file

@ -37,10 +37,9 @@ void VertexLoader::Setup(const PipelineRegs& regs) {
// TODO: What happens if a loader overwrites a previous one's data?
for (unsigned component = 0; component < loader_config.component_count; ++component) {
if (component >= 12) {
LOG_ERROR(
HW_GPU,
"Overflow in the vertex attribute loader {} trying to load component {}",
loader, component);
LOG_ERROR(HW_GPU,
"Overflow in the vertex attribute loader {} trying to load component {}",
loader, component);
continue;
}
@ -138,12 +137,12 @@ void VertexLoader::LoadVertex(u32 base_address, int index, int vertex,
}
LOG_TRACE(HW_GPU,
"Loaded {} components of attribute {:x} for vertex {:x} (index {:x}) from "
"0x{:08x} + 0x{:08x} + 0x{:04x}: {} {} {} {}",
vertex_attribute_elements[i], i, vertex, index, base_address,
vertex_attribute_sources[i], vertex_attribute_strides[i] * vertex,
input.attr[i][0].ToFloat32(), input.attr[i][1].ToFloat32(),
input.attr[i][2].ToFloat32(), input.attr[i][3].ToFloat32());
"Loaded {} components of attribute {:x} for vertex {:x} (index {:x}) from "
"0x{:08x} + 0x{:08x} + 0x{:04x}: {} {} {} {}",
vertex_attribute_elements[i], i, vertex, index, base_address,
vertex_attribute_sources[i], vertex_attribute_strides[i] * vertex,
input.attr[i][0].ToFloat32(), input.attr[i][1].ToFloat32(),
input.attr[i][2].ToFloat32(), input.attr[i][3].ToFloat32());
} else if (vertex_attribute_is_default[i]) {
// Load the default attribute if we're configured to do so
input.attr[i] = g_state.input_default_attributes.attr[i];