Microcode disassembler skeleton.

This commit is contained in:
Ben Vanik 2013-10-07 19:58:24 -07:00
parent 651954ccae
commit 17be429244
12 changed files with 5807 additions and 7 deletions

View File

@ -58,7 +58,7 @@ public:
XE_GPU_SHADER_TYPE type,
uint32_t address,
uint32_t start,
uint32_t size_dwords) = 0;
uint32_t length) = 0;
virtual void DrawIndexed(
XE_GPU_PRIMITIVE_TYPE prim_type,
uint32_t index_count) = 0;

View File

@ -10,11 +10,13 @@
#include <xenia/gpu/nop/nop_graphics_driver.h>
#include <xenia/gpu/gpu-private.h>
#include <xenia/gpu/ucode/ucode_disassembler.h>
using namespace xe;
using namespace xe::gpu;
using namespace xe::gpu::nop;
using namespace xe::gpu::ucode;
NopGraphicsDriver::NopGraphicsDriver(xe_memory_ref memory) :
@ -44,9 +46,20 @@ void NopGraphicsDriver::SetShader(
XE_GPU_SHADER_TYPE type,
uint32_t address,
uint32_t start,
uint32_t size_dwords) {
uint32_t length) {
XELOGGPU("NOP: set shader %d at %0.8X (%db)",
type, address, size_dwords * 4);
type, address, length);
uint8_t* p = xe_memory_addr(memory_, address);
uint32_t dw0 = XEGETUINT32BE(p + 0);
uint32_t* dws = (uint32_t*)xe_malloc(length);
for (int n = 0; n < length; n += 4) {
dws[n / 4] = XEGETUINT32BE(p + n);
}
UcodeDisassembler disasm;
//
}
void NopGraphicsDriver::DrawIndexed(
@ -54,4 +67,4 @@ void NopGraphicsDriver::DrawIndexed(
uint32_t index_count) {
XELOGGPU("NOP: draw indexed %d (%d indicies)",
prim_type, index_count);
}
}

View File

@ -34,7 +34,7 @@ public:
XE_GPU_SHADER_TYPE type,
uint32_t address,
uint32_t start,
uint32_t size_dwords);
uint32_t length);
virtual void DrawIndexed(
XE_GPU_PRIMITIVE_TYPE prim_type,
uint32_t index_count);

View File

@ -300,7 +300,7 @@ void RingBufferWorker::ExecuteSegment(uint32_t ptr, uint32_t length) {
(XE_GPU_SHADER_TYPE)type,
TRANSLATE_ADDR(addr),
start,
size);
size * 4);
}
break;
case PM4_IM_LOAD_IMMEDIATE:
@ -317,7 +317,7 @@ void RingBufferWorker::ExecuteSegment(uint32_t ptr, uint32_t length) {
(XE_GPU_SHADER_TYPE)type,
ptr + n * 4 + 3 * 4,
start,
size);
size * 4);
}
break;

View File

@ -15,6 +15,7 @@
'includes': [
'nop/sources.gypi',
'ucode/sources.gypi',
'xenos/sources.gypi',
],

View File

@ -0,0 +1,11 @@
# Copyright 2013 Ben Vanik. All Rights Reserved.
{
'sources': [
'ucode.cc',
'ucode.h',
'ucode_disassembler.cc',
'ucode_disassembler.h',
'ucode_ops.cc',
'ucode_ops.h',
],
}

View File

@ -0,0 +1,15 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/gpu/ucode/ucode.h>
using namespace xe;
using namespace xe::gpu;
using namespace xe::gpu::ucode;

View File

@ -0,0 +1,28 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_GPU_UCODE_UCODE_H_
#define XENIA_GPU_UCODE_UCODE_H_
#include <xenia/core.h>
namespace xe {
namespace gpu {
namespace ucode {
} // namespace ucode
} // namespace gpu
} // namespace xe
#endif // XENIA_GPU_UCODE_UCODE_H_

View File

@ -0,0 +1,22 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/gpu/ucode/ucode_disassembler.h>
using namespace xe;
using namespace xe::gpu;
using namespace xe::gpu::ucode;
UcodeDisassembler::UcodeDisassembler() {
}
UcodeDisassembler::~UcodeDisassembler() {
}

View File

@ -0,0 +1,37 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_GPU_UCODE_UCODE_DISASSEMBLER_H_
#define XENIA_GPU_UCODE_UCODE_DISASSEMBLER_H_
#include <xenia/core.h>
#include <xenia/gpu/ucode/ucode.h>
namespace xe {
namespace gpu {
namespace ucode {
class UcodeDisassembler {
public:
UcodeDisassembler();
~UcodeDisassembler();
private:
};
} // namespace ucode
} // namespace gpu
} // namespace xe
#endif // XENIA_GPU_UCODE_UCODE_DISASSEMBLER_H_

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,77 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_GPU_UCODE_UCODE_OPS_H_
#define XENIA_GPU_UCODE_UCODE_OPS_H_
#include <xenia/core.h>
#include <xenia/gpu/ucode/ucode.h>
namespace xe {
namespace gpu {
namespace ucode {
// This code comes from libxemit by GliGli.
typedef enum {
XEMR_NONE = -1,
XEMR_TEMP = 0,
XEMR_CONST = 1,
XEMR_COLOR_OUT = 2,
XEMR_TEX_FETCH = 3,
} ucode_reg_type_t;
typedef enum {
XEMO_NONE = -1,
XEMO_SEQUENCER = 0,
XEMO_ALU_VECTOR = 1,
XEMO_ALU_VECTOR_SAT = 2,
XEMO_ALU_SCALAR = 3,
XEMO_ALU_SCALAR_SAT = 4,
XEMO_FETCHES = 5,
} ucode_op_type_t;
typedef struct {
int8_t start;
int8_t end;
} ucode_mask_t;
typedef struct {
ucode_reg_type_t reg_type;
ucode_mask_t reg_mask[2]; // there can be 2 reg masks
uint8_t swizzle_count;
ucode_mask_t swizzle_mask[2]; // there can be 2 swizzle masks
} ucode_reg_t;
typedef struct {
const char* name;
ucode_op_type_t op_type;
uint8_t base_bin[12];
ucode_mask_t out_mask;
ucode_reg_t regs[4];
} ucode_op_t;
extern const ucode_op_t ucode_ops[];
} // namespace ucode
} // namespace gpu
} // namespace xe
#endif // XENIA_GPU_UCODE_UCODE_OPS_H_