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, WaitHandle* wait_handles[], size_t wait_handle_count, bool is_alertable,
std::chrono::milliseconds timeout = std::chrono::milliseconds::max()) { std::chrono::milliseconds timeout = std::chrono::milliseconds::max()) {
return WaitMultiple(wait_handles, wait_handle_count, true, is_alertable, return WaitMultiple(wait_handles, wait_handle_count, true, is_alertable,
timeout).first; timeout)
.first;
} }
inline WaitResult WaitAll( inline WaitResult WaitAll(
std::vector<WaitHandle*> wait_handles, bool is_alertable, 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 { __try {
RaiseException(0x406D1388, 0, sizeof(info) / sizeof(ULONG_PTR), RaiseException(0x406D1388, 0, sizeof(info) / sizeof(ULONG_PTR),
reinterpret_cast<ULONG_PTR*>(&info)); reinterpret_cast<ULONG_PTR*>(&info));
} __except (EXCEPTION_EXECUTE_HANDLER) {
} }
__except(EXCEPTION_EXECUTE_HANDLER) {}
} }
void set_name(const std::string& name) { void set_name(const std::string& name) {

View File

@ -2979,23 +2979,23 @@ EMITTER_OPCODE_TABLE(OPCODE_COMPARE_NE, COMPARE_NE_I8, COMPARE_NE_I16,
static void Emit(X64Emitter& e, const EmitArgType& i) { \ static void Emit(X64Emitter& e, const EmitArgType& i) { \
EmitAssociativeCompareOp( \ EmitAssociativeCompareOp( \
e, i, \ e, i, \
[](X64Emitter & e, const Reg8& dest, const reg_type& src1, \ [](X64Emitter& e, const Reg8& dest, const reg_type& src1, \
const reg_type& src2, bool inverse) { \ const reg_type& src2, bool inverse) { \
e.cmp(src1, src2); \ e.cmp(src1, src2); \
if (!inverse) { \ if (!inverse) { \
e.instr(dest); \ e.instr(dest); \
} else { \ } else { \
e.inverse_instr(dest); \ e.inverse_instr(dest); \
} \ } \
}, \ }, \
[](X64Emitter & e, const Reg8& dest, const reg_type& src1, \ [](X64Emitter& e, const Reg8& dest, const reg_type& src1, \
int32_t constant, bool inverse) { \ int32_t constant, bool inverse) { \
e.cmp(src1, constant); \ e.cmp(src1, constant); \
if (!inverse) { \ if (!inverse) { \
e.instr(dest); \ e.instr(dest); \
} else { \ } else { \
e.inverse_instr(dest); \ e.inverse_instr(dest); \
} \ } \
}); \ }); \
} \ } \
}; };

View File

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

View File

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

View File

@ -22,7 +22,7 @@ using xe::cpu::frontend::PPCContext;
int main(std::vector<std::wstring>& args) { int main(std::vector<std::wstring>& args) {
std::vector<std::string> narrow_args; std::vector<std::string> narrow_args;
auto narrow_argv = new char* [args.size()]; auto narrow_argv = new char*[args.size()];
for (size_t i = 0; i < args.size(); ++i) { for (size_t i = 0; i < args.size(); ++i) {
auto narrow_arg = xe::to_string(args[i]); auto narrow_arg = xe::to_string(args[i]);
narrow_argv[i] = const_cast<char*>(narrow_arg.data()); narrow_argv[i] = const_cast<char*>(narrow_arg.data());

View File

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

View File

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

View File

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

View File

@ -204,7 +204,7 @@ struct ListThreadsResponseBuilder {
flatbuffers::FlatBufferBuilder& fbb_; flatbuffers::FlatBufferBuilder& fbb_;
flatbuffers::uoffset_t start_; flatbuffers::uoffset_t start_;
void add_thread(flatbuffers::Offset< void add_thread(flatbuffers::Offset<
flatbuffers::Vector<flatbuffers::Offset<Thread>>> thread) { flatbuffers::Vector<flatbuffers::Offset<Thread>>> thread) {
fbb_.AddOffset(4, thread); fbb_.AddOffset(4, thread);
} }
ListThreadsResponseBuilder(flatbuffers::FlatBufferBuilder& _fbb) ListThreadsResponseBuilder(flatbuffers::FlatBufferBuilder& _fbb)

View File

@ -30,15 +30,15 @@ el::Element* CpuView::BuildUI() {
.distribution(LayoutDistribution::kAvailable) .distribution(LayoutDistribution::kAvailable)
.axis(Axis::kY) .axis(Axis::kY)
.child( .child(
LayoutBoxNode() LayoutBoxNode()
.gravity(Gravity::kTop | Gravity::kLeftRight) .gravity(Gravity::kTop | Gravity::kLeftRight)
.distribution(LayoutDistribution::kAvailable) .distribution(LayoutDistribution::kAvailable)
.axis(Axis::kX) .axis(Axis::kX)
.skin("button_group") .skin("button_group")
.child(ButtonNode("?")) .child(ButtonNode("?"))
.child( .child(
DropDownButtonNode().item("Module").item("Module").item( DropDownButtonNode().item("Module").item("Module").item(
"Module"))) "Module")))
.child(ListBoxNode() .child(ListBoxNode()
.gravity(Gravity::kAll) .gravity(Gravity::kAll)
.item("fn") .item("fn")
@ -59,12 +59,12 @@ el::Element* CpuView::BuildUI() {
.distribution(LayoutDistribution::kAvailable) .distribution(LayoutDistribution::kAvailable)
.axis(Axis::kY) .axis(Axis::kY)
.child( .child(
LayoutBoxNode() LayoutBoxNode()
.gravity(Gravity::kTop | Gravity::kLeftRight) .gravity(Gravity::kTop | Gravity::kLeftRight)
.distribution(LayoutDistribution::kGravity) .distribution(LayoutDistribution::kGravity)
.distribution_position(LayoutDistributionPosition::kLeftTop) .distribution_position(LayoutDistributionPosition::kLeftTop)
.axis(Axis::kX) .axis(Axis::kX)
.child(ButtonNode("A"))) .child(ButtonNode("A")))
.child(TextBoxNode("source!") .child(TextBoxNode("source!")
.gravity(Gravity::kAll) .gravity(Gravity::kAll)
.is_multiline(true) .is_multiline(true)
@ -96,15 +96,15 @@ el::Element* CpuView::BuildUI() {
.distribution(LayoutDistribution::kAvailable) .distribution(LayoutDistribution::kAvailable)
.axis(Axis::kY) .axis(Axis::kY)
.child( .child(
LayoutBoxNode() LayoutBoxNode()
.id("source_toolbar") .id("source_toolbar")
.gravity(Gravity::kTop | Gravity::kLeftRight) .gravity(Gravity::kTop | Gravity::kLeftRight)
.distribution(LayoutDistribution::kGravity) .distribution(LayoutDistribution::kGravity)
.distribution_position(LayoutDistributionPosition::kLeftTop) .distribution_position(LayoutDistributionPosition::kLeftTop)
.axis(Axis::kX) .axis(Axis::kX)
.child(ButtonNode("button")) .child(ButtonNode("button"))
.child(ButtonNode("button")) .child(ButtonNode("button"))
.child(ButtonNode("button"))) .child(ButtonNode("button")))
.child(LayoutBoxNode() .child(LayoutBoxNode()
.gravity(Gravity::kAll) .gravity(Gravity::kAll)
.distribution(LayoutDistribution::kAvailable) .distribution(LayoutDistribution::kAvailable)

View File

@ -177,101 +177,100 @@ void GL4GraphicsSystem::EndTracing() { command_processor_->EndTracing(); }
void GL4GraphicsSystem::PlayTrace(const uint8_t* trace_data, size_t trace_size, void GL4GraphicsSystem::PlayTrace(const uint8_t* trace_data, size_t trace_size,
TracePlaybackMode playback_mode) { TracePlaybackMode playback_mode) {
command_processor_->CallInThread( command_processor_->CallInThread([this, trace_data, trace_size,
[this, trace_data, trace_size, playback_mode]() { playback_mode]() {
command_processor_->set_swap_mode(SwapMode::kIgnored); command_processor_->set_swap_mode(SwapMode::kIgnored);
auto trace_ptr = trace_data; auto trace_ptr = trace_data;
bool pending_break = false; bool pending_break = false;
const PacketStartCommand* pending_packet = nullptr; const PacketStartCommand* pending_packet = nullptr;
while (trace_ptr < trace_data + trace_size) { while (trace_ptr < trace_data + trace_size) {
auto type = auto type = static_cast<TraceCommandType>(xe::load<uint32_t>(trace_ptr));
static_cast<TraceCommandType>(xe::load<uint32_t>(trace_ptr)); switch (type) {
switch (type) { case TraceCommandType::kPrimaryBufferStart: {
case TraceCommandType::kPrimaryBufferStart: { auto cmd =
auto cmd = reinterpret_cast<const PrimaryBufferStartCommand*>(trace_ptr);
reinterpret_cast<const PrimaryBufferStartCommand*>(trace_ptr); //
// trace_ptr += sizeof(*cmd) + cmd->count * 4;
trace_ptr += sizeof(*cmd) + cmd->count * 4; break;
break; }
} case TraceCommandType::kPrimaryBufferEnd: {
case TraceCommandType::kPrimaryBufferEnd: { auto cmd =
auto cmd = reinterpret_cast<const PrimaryBufferEndCommand*>(trace_ptr);
reinterpret_cast<const PrimaryBufferEndCommand*>(trace_ptr); //
// trace_ptr += sizeof(*cmd);
trace_ptr += sizeof(*cmd); break;
break; }
} case TraceCommandType::kIndirectBufferStart: {
case TraceCommandType::kIndirectBufferStart: { auto cmd =
auto cmd = reinterpret_cast<const IndirectBufferStartCommand*>( reinterpret_cast<const IndirectBufferStartCommand*>(trace_ptr);
trace_ptr); //
// trace_ptr += sizeof(*cmd) + cmd->count * 4;
trace_ptr += sizeof(*cmd) + cmd->count * 4; break;
break; }
} case TraceCommandType::kIndirectBufferEnd: {
case TraceCommandType::kIndirectBufferEnd: { auto cmd =
auto cmd = reinterpret_cast<const IndirectBufferEndCommand*>(trace_ptr);
reinterpret_cast<const IndirectBufferEndCommand*>(trace_ptr); //
// trace_ptr += sizeof(*cmd);
trace_ptr += sizeof(*cmd); break;
break; }
} case TraceCommandType::kPacketStart: {
case TraceCommandType::kPacketStart: { auto cmd = reinterpret_cast<const PacketStartCommand*>(trace_ptr);
auto cmd = reinterpret_cast<const PacketStartCommand*>(trace_ptr); trace_ptr += sizeof(*cmd);
trace_ptr += sizeof(*cmd); std::memcpy(memory()->TranslatePhysical(cmd->base_ptr), trace_ptr,
std::memcpy(memory()->TranslatePhysical(cmd->base_ptr), trace_ptr, cmd->count * 4);
cmd->count * 4); trace_ptr += cmd->count * 4;
trace_ptr += cmd->count * 4; pending_packet = cmd;
pending_packet = cmd; break;
break; }
} case TraceCommandType::kPacketEnd: {
case TraceCommandType::kPacketEnd: { auto cmd = reinterpret_cast<const PacketEndCommand*>(trace_ptr);
auto cmd = reinterpret_cast<const PacketEndCommand*>(trace_ptr); trace_ptr += sizeof(*cmd);
trace_ptr += sizeof(*cmd); if (pending_packet) {
if (pending_packet) { command_processor_->ExecutePacket(pending_packet->base_ptr,
command_processor_->ExecutePacket(pending_packet->base_ptr, pending_packet->count);
pending_packet->count); pending_packet = nullptr;
pending_packet = nullptr; }
} if (pending_break) {
if (pending_break) { return;
return; }
} break;
break; }
} case TraceCommandType::kMemoryRead: {
case TraceCommandType::kMemoryRead: { auto cmd = reinterpret_cast<const MemoryReadCommand*>(trace_ptr);
auto cmd = reinterpret_cast<const MemoryReadCommand*>(trace_ptr); trace_ptr += sizeof(*cmd);
trace_ptr += sizeof(*cmd); std::memcpy(memory()->TranslatePhysical(cmd->base_ptr), trace_ptr,
std::memcpy(memory()->TranslatePhysical(cmd->base_ptr), trace_ptr, cmd->length);
cmd->length); trace_ptr += cmd->length;
trace_ptr += cmd->length; break;
break; }
} case TraceCommandType::kMemoryWrite: {
case TraceCommandType::kMemoryWrite: { auto cmd = reinterpret_cast<const MemoryWriteCommand*>(trace_ptr);
auto cmd = reinterpret_cast<const MemoryWriteCommand*>(trace_ptr); trace_ptr += sizeof(*cmd);
trace_ptr += sizeof(*cmd); // ?
// ? trace_ptr += cmd->length;
trace_ptr += cmd->length; break;
break; }
} case TraceCommandType::kEvent: {
case TraceCommandType::kEvent: { auto cmd = reinterpret_cast<const EventCommand*>(trace_ptr);
auto cmd = reinterpret_cast<const EventCommand*>(trace_ptr); trace_ptr += sizeof(*cmd);
trace_ptr += sizeof(*cmd); switch (cmd->event_type) {
switch (cmd->event_type) { case EventType::kSwap: {
case EventType::kSwap: { if (playback_mode == TracePlaybackMode::kBreakOnSwap) {
if (playback_mode == TracePlaybackMode::kBreakOnSwap) { pending_break = true;
pending_break = true;
}
break;
}
} }
break; break;
} }
} }
break;
} }
}
}
command_processor_->set_swap_mode(SwapMode::kNormal); command_processor_->set_swap_mode(SwapMode::kNormal);
command_processor_->IssueSwap(1280, 720); command_processor_->IssueSwap(1280, 720);
}); });
} }
void GL4GraphicsSystem::ClearCaches() { void GL4GraphicsSystem::ClearCaches() {

View File

@ -47,9 +47,22 @@ using namespace xe::gpu::ucode;
using namespace xe::gpu::xenos; using namespace xe::gpu::xenos;
static const char* levels[] = { 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", "\t",
"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",
"x",
"x",
"x",
"x",
"x",
"x",
}; };
/* /*
@ -143,36 +156,36 @@ struct {
{ {
#define INSTR(opc, num_srcs) \ #define INSTR(opc, num_srcs) \
{ num_srcs, #opc } { num_srcs, #opc }
INSTR(ADDv, 2), // 0 INSTR(ADDv, 2), // 0
INSTR(MULv, 2), // 1 INSTR(MULv, 2), // 1
INSTR(MAXv, 2), // 2 INSTR(MAXv, 2), // 2
INSTR(MINv, 2), // 3 INSTR(MINv, 2), // 3
INSTR(SETEv, 2), // 4 INSTR(SETEv, 2), // 4
INSTR(SETGTv, 2), // 5 INSTR(SETGTv, 2), // 5
INSTR(SETGTEv, 2), // 6 INSTR(SETGTEv, 2), // 6
INSTR(SETNEv, 2), // 7 INSTR(SETNEv, 2), // 7
INSTR(FRACv, 1), // 8 INSTR(FRACv, 1), // 8
INSTR(TRUNCv, 1), // 9 INSTR(TRUNCv, 1), // 9
INSTR(FLOORv, 1), // 10 INSTR(FLOORv, 1), // 10
INSTR(MULADDv, 3), // 111 INSTR(MULADDv, 3), // 111
INSTR(CNDEv, 3), // 12 INSTR(CNDEv, 3), // 12
INSTR(CNDGTEv, 3), // 13 INSTR(CNDGTEv, 3), // 13
INSTR(CNDGTv, 3), // 14 INSTR(CNDGTv, 3), // 14
INSTR(DOT4v, 2), // 15 INSTR(DOT4v, 2), // 15
INSTR(DOT3v, 2), // 16 INSTR(DOT3v, 2), // 16
INSTR(DOT2ADDv, 3), // 17 -- ??? INSTR(DOT2ADDv, 3), // 17 -- ???
INSTR(CUBEv, 2), // 18 INSTR(CUBEv, 2), // 18
INSTR(MAX4v, 1), // 19 INSTR(MAX4v, 1), // 19
INSTR(PRED_SETE_PUSHv, 2), // 20 INSTR(PRED_SETE_PUSHv, 2), // 20
INSTR(PRED_SETNE_PUSHv, 2), // 21 INSTR(PRED_SETNE_PUSHv, 2), // 21
INSTR(PRED_SETGT_PUSHv, 2), // 22 INSTR(PRED_SETGT_PUSHv, 2), // 22
INSTR(PRED_SETGTE_PUSHv, 2), // 23 INSTR(PRED_SETGTE_PUSHv, 2), // 23
INSTR(KILLEv, 2), // 24 INSTR(KILLEv, 2), // 24
INSTR(KILLGTv, 2), // 25 INSTR(KILLGTv, 2), // 25
INSTR(KILLGTEv, 2), // 26 INSTR(KILLGTEv, 2), // 26
INSTR(KILLNEv, 2), // 27 INSTR(KILLNEv, 2), // 27
INSTR(DSTv, 2), // 28 INSTR(DSTv, 2), // 28
INSTR(MOVAv, 1), // 29 INSTR(MOVAv, 1), // 29
}, },
scalar_instructions[0x40] = { scalar_instructions[0x40] = {
INSTR(ADDs, 1), // 0 INSTR(ADDs, 1), // 0

View File

@ -508,8 +508,11 @@ void XThread::DeliverAPCs() {
// kernel_routine(apc_address, &normal_routine, &normal_context, // kernel_routine(apc_address, &normal_routine, &normal_context,
// &system_arg1, &system_arg2) // &system_arg1, &system_arg2)
uint64_t kernel_args[] = { uint64_t kernel_args[] = {
apc_ptr, scratch_address_ + 0, scratch_address_ + 4, apc_ptr,
scratch_address_ + 8, scratch_address_ + 12, scratch_address_ + 0,
scratch_address_ + 4,
scratch_address_ + 8,
scratch_address_ + 12,
}; };
processor->Execute(thread_state_, apc->kernel_routine, kernel_args, processor->Execute(thread_state_, apc->kernel_routine, kernel_args,
xe::countof(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; using xe::cpu::ExportTag;
#define DECLARE_EXPORT(module_name, name, tags) \ #define DECLARE_EXPORT(module_name, name, tags) \
const auto EXPORT_##module_name##_##name = \ const auto EXPORT_##module_name##_##name = RegisterExport_##module_name( \
RegisterExport_##module_name(xe::kernel::shim::RegisterExport< \ xe::kernel::shim::RegisterExport< \
xe::kernel::shim::KernelModuleId::module_name, ordinals::##name>( \ xe::kernel::shim::KernelModuleId::module_name, ordinals::##name>( \
&name, #name, tags)); &name, #name, tags));

View File

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

View File

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

View File

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

View File

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