Run with latest clang-format.

This commit is contained in:
Ben Vanik 2015-07-15 22:44:30 -07:00
parent c3415e6332
commit f520d3a2a4
19 changed files with 307 additions and 318 deletions

View File

@ -162,7 +162,8 @@ inline WaitResult WaitAll(
WaitHandle* wait_handles[], size_t wait_handle_count, bool is_alertable,
std::chrono::milliseconds timeout = std::chrono::milliseconds::max()) {
return WaitMultiple(wait_handles, wait_handle_count, true, is_alertable,
timeout).first;
timeout)
.first;
}
inline WaitResult WaitAll(
std::vector<WaitHandle*> wait_handles, bool is_alertable,

View File

@ -61,8 +61,8 @@ void set_name(DWORD thread_id, const std::string& name) {
__try {
RaiseException(0x406D1388, 0, sizeof(info) / sizeof(ULONG_PTR),
reinterpret_cast<ULONG_PTR*>(&info));
} __except (EXCEPTION_EXECUTE_HANDLER) {
}
__except(EXCEPTION_EXECUTE_HANDLER) {}
}
void set_name(const std::string& name) {

View File

@ -118,8 +118,7 @@ typedef struct {
uint32_t LK : 1;
uint32_t AA : 1;
uint32_t LI : 24;
uint32_t:
6;
uint32_t : 6;
} I;
// kXEPPCInstrFormatB
struct {
@ -128,8 +127,7 @@ typedef struct {
uint32_t BD : 14;
uint32_t BI : 5;
uint32_t BO : 5;
uint32_t:
6;
uint32_t : 6;
} B;
// kXEPPCInstrFormatSC
@ -138,87 +136,71 @@ typedef struct {
uint32_t DS : 16;
uint32_t RA : 5;
uint32_t RT : 5;
uint32_t:
6;
uint32_t : 6;
} D;
// kXEPPCInstrFormatDS
struct {
uint32_t:
2;
uint32_t : 2;
uint32_t DS : 14;
uint32_t RA : 5;
uint32_t RT : 5;
uint32_t:
6;
uint32_t : 6;
} DS;
// kXEPPCInstrFormatX
struct {
uint32_t Rc : 1;
uint32_t:
10;
uint32_t : 10;
uint32_t RB : 5;
uint32_t RA : 5;
uint32_t RT : 5;
uint32_t:
6;
uint32_t : 6;
} X;
// kXEPPCInstrFormatXL
struct {
uint32_t LK : 1;
uint32_t:
10;
uint32_t : 10;
uint32_t BB : 5;
uint32_t BI : 5;
uint32_t BO : 5;
uint32_t:
6;
uint32_t : 6;
} XL;
// kXEPPCInstrFormatXFX
struct {
uint32_t:
1;
uint32_t:
10;
uint32_t : 1;
uint32_t : 10;
uint32_t spr : 10;
uint32_t RT : 5;
uint32_t:
6;
uint32_t : 6;
} XFX;
// kXEPPCInstrFormatXFL
struct {
uint32_t Rc : 1;
uint32_t:
10;
uint32_t : 10;
uint32_t RB : 5;
uint32_t W : 1;
uint32_t FM : 8;
uint32_t L : 1;
uint32_t:
6;
uint32_t : 6;
} XFL;
// kXEPPCInstrFormatXS
struct {
uint32_t Rc : 1;
uint32_t SH5 : 1;
uint32_t:
9;
uint32_t : 9;
uint32_t SH : 5;
uint32_t RA : 5;
uint32_t RT : 5;
uint32_t:
6;
uint32_t : 6;
} XS;
// kXEPPCInstrFormatXO
struct {
uint32_t Rc : 1;
uint32_t:
9;
uint32_t : 9;
uint32_t OE : 1;
uint32_t RB : 5;
uint32_t RA : 5;
uint32_t RT : 5;
uint32_t:
6;
uint32_t : 6;
} XO;
// kXEPPCInstrFormatA
struct {
@ -228,8 +210,7 @@ typedef struct {
uint32_t FRB : 5;
uint32_t FRA : 5;
uint32_t FRT : 5;
uint32_t:
6;
uint32_t : 6;
} A;
// kXEPPCInstrFormatM
struct {
@ -239,8 +220,7 @@ typedef struct {
uint32_t SH : 5;
uint32_t RA : 5;
uint32_t RT : 5;
uint32_t:
6;
uint32_t : 6;
} M;
// kXEPPCInstrFormatMD
struct {
@ -252,8 +232,7 @@ typedef struct {
uint32_t SH : 5;
uint32_t RA : 5;
uint32_t RT : 5;
uint32_t:
6;
uint32_t : 6;
} MD;
// kXEPPCInstrFormatMDS
struct {
@ -264,40 +243,33 @@ typedef struct {
uint32_t RB : 5;
uint32_t RA : 5;
uint32_t RT : 5;
uint32_t:
6;
uint32_t : 6;
} MDS;
// kXEPPCInstrFormatVXA
struct {
uint32_t:
6;
uint32_t : 6;
uint32_t VC : 5;
uint32_t VB : 5;
uint32_t VA : 5;
uint32_t VD : 5;
uint32_t:
6;
uint32_t : 6;
} VXA;
// kXEPPCInstrFormatVX
struct {
uint32_t:
11;
uint32_t : 11;
uint32_t VB : 5;
uint32_t VA : 5;
uint32_t VD : 5;
uint32_t:
6;
uint32_t : 6;
} VX;
// kXEPPCInstrFormatVXR
struct {
uint32_t:
10;
uint32_t : 10;
uint32_t Rc : 1;
uint32_t VB : 5;
uint32_t VA : 5;
uint32_t VD : 5;
uint32_t:
6;
uint32_t : 6;
} VXR;
// kXEPPCInstrFormatVX128
struct {
@ -306,31 +278,25 @@ typedef struct {
// VB128 = VB128l | (VB128h << 5)
uint32_t VB128h : 2;
uint32_t VD128h : 2;
uint32_t:
1;
uint32_t : 1;
uint32_t VA128h : 1;
uint32_t:
4;
uint32_t : 4;
uint32_t VA128H : 1;
uint32_t VB128l : 5;
uint32_t VA128l : 5;
uint32_t VD128l : 5;
uint32_t:
6;
uint32_t : 6;
} VX128;
// kXEPPCInstrFormatVX128_1
struct {
// VD128 = VD128l | (VD128h << 5)
uint32_t:
2;
uint32_t : 2;
uint32_t VD128h : 2;
uint32_t:
7;
uint32_t : 7;
uint32_t RB : 5;
uint32_t RA : 5;
uint32_t VD128l : 5;
uint32_t:
6;
uint32_t : 6;
} VX128_1;
// kXEPPCInstrFormatVX128_2
struct {
@ -339,18 +305,15 @@ typedef struct {
// VB128 = VB128l | (VB128h << 5)
uint32_t VB128h : 2;
uint32_t VD128h : 2;
uint32_t:
1;
uint32_t : 1;
uint32_t VA128h : 1;
uint32_t VC : 3;
uint32_t:
1;
uint32_t : 1;
uint32_t VA128H : 1;
uint32_t VB128l : 5;
uint32_t VA128l : 5;
uint32_t VD128l : 5;
uint32_t:
6;
uint32_t : 6;
} VX128_2;
// kXEPPCInstrFormatVX128_3
struct {
@ -358,13 +321,11 @@ typedef struct {
// VB128 = VB128l | (VB128h << 5)
uint32_t VB128h : 2;
uint32_t VD128h : 2;
uint32_t:
7;
uint32_t : 7;
uint32_t VB128l : 5;
uint32_t IMM : 5;
uint32_t VD128l : 5;
uint32_t:
6;
uint32_t : 6;
} VX128_3;
// kXEPPCInstrFormatVX128_4
struct {
@ -372,16 +333,13 @@ typedef struct {
// VB128 = VB128l | (VB128h << 5)
uint32_t VB128h : 2;
uint32_t VD128h : 2;
uint32_t:
2;
uint32_t : 2;
uint32_t z : 2;
uint32_t:
3;
uint32_t : 3;
uint32_t VB128l : 5;
uint32_t IMM : 5;
uint32_t VD128l : 5;
uint32_t:
6;
uint32_t : 6;
} VX128_4;
// kXEPPCInstrFormatVX128_5
struct {
@ -390,16 +348,14 @@ typedef struct {
// VB128 = VB128l | (VB128h << 5)
uint32_t VB128h : 2;
uint32_t VD128h : 2;
uint32_t:
1;
uint32_t : 1;
uint32_t VA128h : 1;
uint32_t SH : 4;
uint32_t VA128H : 1;
uint32_t VB128l : 5;
uint32_t VA128l : 5;
uint32_t VD128l : 5;
uint32_t:
6;
uint32_t : 6;
} VX128_5;
// kXEPPCInstrFormatVX128_P
struct {
@ -408,16 +364,13 @@ typedef struct {
// PERM = PERMl | (PERMh << 5)
uint32_t VB128h : 2;
uint32_t VD128h : 2;
uint32_t:
2;
uint32_t : 2;
uint32_t PERMh : 3;
uint32_t:
2;
uint32_t : 2;
uint32_t VB128l : 5;
uint32_t PERMl : 5;
uint32_t VD128l : 5;
uint32_t:
6;
uint32_t : 6;
} VX128_P;
// kXEPPCInstrFormatVX128_R
struct {
@ -426,18 +379,15 @@ typedef struct {
// VB128 = VB128l | (VB128h << 5)
uint32_t VB128h : 2;
uint32_t VD128h : 2;
uint32_t:
1;
uint32_t : 1;
uint32_t VA128h : 1;
uint32_t Rc : 1;
uint32_t:
3;
uint32_t : 3;
uint32_t VA128H : 1;
uint32_t VB128l : 5;
uint32_t VA128l : 5;
uint32_t VD128l : 5;
uint32_t:
6;
uint32_t : 6;
} VX128_R;
// kXEPPCInstrFormatXDSS
struct {

View File

@ -371,8 +371,7 @@ void ProtectedRunTest(TestSuite& test_suite, TestRunner& runner,
}
#if XE_COMPILER_MSVC
}
__except(filter(GetExceptionCode())) {
} __except (filter(GetExceptionCode())) {
XELOGE(" TEST FAILED (UNSUPPORTED INSTRUCTION)");
++failed_count;
}

View File

@ -229,7 +229,8 @@ void Debugger::OnMessage(std::vector<uint8_t> buffer) {
fbb.CreateString(xe::to_string(code_cache->file_name())),
code_cache->base_address(), code_cache->total_size(),
fbb.CreateString(xe::to_string(functions_path_)),
fbb.CreateString(xe::to_string(functions_trace_path_))).Union();
fbb.CreateString(xe::to_string(functions_trace_path_)))
.Union();
// Allow continuation if we were blocked waiting for a client.
accept_fence_.Signal();

View File

@ -99,12 +99,22 @@ enum RequestData {
};
inline const char** EnumNamesRequestData() {
static const char* names[] = {
"NONE", "AttachRequest", "ListBreakpointsRequest",
"AddBreakpointsRequest", "UpdateBreakpointsRequest",
"RemoveBreakpointsRequest", "ListModulesRequest", "GetModuleRequest",
"ListFunctionsRequest", "GetFunctionRequest", "ListThreadsRequest",
"StopRequest", "BreakRequest", "ContinueRequest", "StepRequest", nullptr};
static const char* names[] = {"NONE",
"AttachRequest",
"ListBreakpointsRequest",
"AddBreakpointsRequest",
"UpdateBreakpointsRequest",
"RemoveBreakpointsRequest",
"ListModulesRequest",
"GetModuleRequest",
"ListFunctionsRequest",
"GetFunctionRequest",
"ListThreadsRequest",
"StopRequest",
"BreakRequest",
"ContinueRequest",
"StepRequest",
nullptr};
return names;
}
@ -136,13 +146,24 @@ enum ResponseData {
};
inline const char** EnumNamesResponseData() {
static const char* names[] = {
"NONE", "AttachResponse", "ListBreakpointsResponse",
"AddBreakpointsResponse", "UpdateBreakpointsResponse",
"RemoveBreakpointsResponse", "ListModulesResponse", "GetModuleResponse",
"ListFunctionsResponse", "GetFunctionResponse", "ListThreadsResponse",
"StopResponse", "BreakResponse", "ContinueResponse", "StepResponse",
"BreakpointEvent", "AccessViolationEvent", nullptr};
static const char* names[] = {"NONE",
"AttachResponse",
"ListBreakpointsResponse",
"AddBreakpointsResponse",
"UpdateBreakpointsResponse",
"RemoveBreakpointsResponse",
"ListModulesResponse",
"GetModuleResponse",
"ListFunctionsResponse",
"GetFunctionResponse",
"ListThreadsResponse",
"StopResponse",
"BreakResponse",
"ContinueResponse",
"StepResponse",
"BreakpointEvent",
"AccessViolationEvent",
nullptr};
return names;
}

View File

@ -460,7 +460,8 @@ struct ListFunctionsResponse FLATBUFFERS_FINAL_CLASS
struct ListFunctionsResponseBuilder {
flatbuffers::FlatBufferBuilder& fbb_;
flatbuffers::uoffset_t start_;
void add_entry(flatbuffers::Offset<
void add_entry(
flatbuffers::Offset<
flatbuffers::Vector<flatbuffers::Offset<FunctionEntry>>> entry) {
fbb_.AddOffset(4, entry);
}

View File

@ -177,16 +177,15 @@ void GL4GraphicsSystem::EndTracing() { command_processor_->EndTracing(); }
void GL4GraphicsSystem::PlayTrace(const uint8_t* trace_data, size_t trace_size,
TracePlaybackMode playback_mode) {
command_processor_->CallInThread(
[this, trace_data, trace_size, playback_mode]() {
command_processor_->CallInThread([this, trace_data, trace_size,
playback_mode]() {
command_processor_->set_swap_mode(SwapMode::kIgnored);
auto trace_ptr = trace_data;
bool pending_break = false;
const PacketStartCommand* pending_packet = nullptr;
while (trace_ptr < trace_data + trace_size) {
auto type =
static_cast<TraceCommandType>(xe::load<uint32_t>(trace_ptr));
auto type = static_cast<TraceCommandType>(xe::load<uint32_t>(trace_ptr));
switch (type) {
case TraceCommandType::kPrimaryBufferStart: {
auto cmd =
@ -203,8 +202,8 @@ void GL4GraphicsSystem::PlayTrace(const uint8_t* trace_data, size_t trace_size,
break;
}
case TraceCommandType::kIndirectBufferStart: {
auto cmd = reinterpret_cast<const IndirectBufferStartCommand*>(
trace_ptr);
auto cmd =
reinterpret_cast<const IndirectBufferStartCommand*>(trace_ptr);
//
trace_ptr += sizeof(*cmd) + cmd->count * 4;
break;

View File

@ -47,9 +47,22 @@ using namespace xe::gpu::ucode;
using namespace xe::gpu::xenos;
static const char* levels[] = {
"", "\t", "\t\t", "\t\t\t", "\t\t\t\t", "\t\t\t\t\t", "\t\t\t\t\t\t",
"\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t\t", "x", "x", "x",
"x", "x", "x",
"",
"\t",
"\t\t",
"\t\t\t",
"\t\t\t\t",
"\t\t\t\t\t",
"\t\t\t\t\t\t",
"\t\t\t\t\t\t\t",
"\t\t\t\t\t\t\t\t",
"\t\t\t\t\t\t\t\t\t",
"x",
"x",
"x",
"x",
"x",
"x",
};
/*

View File

@ -508,8 +508,11 @@ void XThread::DeliverAPCs() {
// kernel_routine(apc_address, &normal_routine, &normal_context,
// &system_arg1, &system_arg2)
uint64_t kernel_args[] = {
apc_ptr, scratch_address_ + 0, scratch_address_ + 4,
scratch_address_ + 8, scratch_address_ + 12,
apc_ptr,
scratch_address_ + 0,
scratch_address_ + 4,
scratch_address_ + 8,
scratch_address_ + 12,
};
processor->Execute(thread_state_, apc->kernel_routine, kernel_args,
xe::countof(kernel_args));

View File

@ -464,8 +464,8 @@ xe::cpu::Export* RegisterExport(void (*fn)(Ps&...), const char* name,
using xe::cpu::ExportTag;
#define DECLARE_EXPORT(module_name, name, tags) \
const auto EXPORT_##module_name##_##name = \
RegisterExport_##module_name(xe::kernel::shim::RegisterExport< \
const auto EXPORT_##module_name##_##name = RegisterExport_##module_name( \
xe::kernel::shim::RegisterExport< \
xe::kernel::shim::KernelModuleId::module_name, ordinals::##name>( \
&name, #name, tags));

View File

@ -962,21 +962,11 @@ const uint32_t error_table_0xC0980001[] = {
#define MAKE_ENTRY(x) \
{ ##x, xe::countof(error_table_##x), error_table_##x }
const error_lookup_table error_tables[] = {
MAKE_ENTRY(0x00000103),
MAKE_ENTRY(0x40000002),
MAKE_ENTRY(0x40020056),
MAKE_ENTRY(0x400200AF),
MAKE_ENTRY(0x80000001),
MAKE_ENTRY(0x80000288),
MAKE_ENTRY(0x80090300),
MAKE_ENTRY(0xC0000001),
MAKE_ENTRY(0xC0000202),
MAKE_ENTRY(0xC0020001),
MAKE_ENTRY(0xC0030001),
MAKE_ENTRY(0xC0030059),
MAKE_ENTRY(0xC0050003),
MAKE_ENTRY(0xC0980001),
{0, 0, nullptr},
MAKE_ENTRY(0x00000103), MAKE_ENTRY(0x40000002), MAKE_ENTRY(0x40020056),
MAKE_ENTRY(0x400200AF), MAKE_ENTRY(0x80000001), MAKE_ENTRY(0x80000288),
MAKE_ENTRY(0x80090300), MAKE_ENTRY(0xC0000001), MAKE_ENTRY(0xC0000202),
MAKE_ENTRY(0xC0020001), MAKE_ENTRY(0xC0030001), MAKE_ENTRY(0xC0030059),
MAKE_ENTRY(0xC0050003), MAKE_ENTRY(0xC0980001), {0, 0, nullptr},
};
#undef MAKE_ENTRY

View File

@ -131,9 +131,12 @@ bool GLContext::Initialize(Window* target_window) {
context_flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
}
int attrib_list[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, 4, //
WGL_CONTEXT_MINOR_VERSION_ARB, 5, //
WGL_CONTEXT_FLAGS_ARB, context_flags, //
int attrib_list[] = {WGL_CONTEXT_MAJOR_VERSION_ARB,
4, //
WGL_CONTEXT_MINOR_VERSION_ARB,
5, //
WGL_CONTEXT_FLAGS_ARB,
context_flags, //
0};
glrc_ = wglCreateContextAttribsARB(dc_, nullptr, attrib_list);
@ -187,10 +190,14 @@ std::unique_ptr<GraphicsContext> GLContext::CreateShared() {
context_flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
}
int attrib_list[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, 4, //
WGL_CONTEXT_MINOR_VERSION_ARB, 5, //
WGL_CONTEXT_FLAGS_ARB, context_flags, //
WGL_CONTEXT_PROFILE_MASK_ARB, profile, //
int attrib_list[] = {WGL_CONTEXT_MAJOR_VERSION_ARB,
4, //
WGL_CONTEXT_MINOR_VERSION_ARB,
5, //
WGL_CONTEXT_FLAGS_ARB,
context_flags, //
WGL_CONTEXT_PROFILE_MASK_ARB,
profile, //
0};
new_glrc = wglCreateContextAttribsARB(dc_, glrc_, attrib_list);
if (!new_glrc) {
@ -234,7 +241,8 @@ void FatalGLError(std::string error) {
XEFATAL(
(error +
"\nEnsure you have the latest drivers for your GPU and that it supports "
"OpenGL 4.5. See http://xenia.jp/faq/ for more information.").c_str());
"OpenGL 4.5. See http://xenia.jp/faq/ for more information.")
.c_str());
}
void GLContext::AssertExtensionsPresent() {
@ -350,10 +358,11 @@ void GLContext::DebugMessage(GLenum source, GLenum type, GLuint id,
message);
}
void GLAPIENTRY
GLContext::DebugMessageThunk(GLenum source, GLenum type, GLuint id,
GLenum severity, GLsizei length,
const GLchar* message, GLvoid* user_param) {
void GLAPIENTRY GLContext::DebugMessageThunk(GLenum source, GLenum type,
GLuint id, GLenum severity,
GLsizei length,
const GLchar* message,
GLvoid* user_param) {
reinterpret_cast<GLContext*>(user_param)
->DebugMessage(source, type, id, severity, length, message);
}

View File

@ -58,9 +58,11 @@ class GLContext : public GraphicsContext {
void SetupDebugging();
void DebugMessage(GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei length, const GLchar* message);
static void GLAPIENTRY
DebugMessageThunk(GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei length, const GLchar* message, GLvoid* user_param);
static void GLAPIENTRY DebugMessageThunk(GLenum source, GLenum type,
GLuint id, GLenum severity,
GLsizei length,
const GLchar* message,
GLvoid* user_param);
HDC dc_ = nullptr;
HGLRC glrc_ = nullptr;

View File

@ -53,8 +53,8 @@ class Win32Window : public Window {
void OnResize(UIEvent& e) override;
static LRESULT CALLBACK
WndProcThunk(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK WndProcThunk(HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam);
virtual LRESULT WndProc(HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam);