Make XPS happy and remove some GPU address munging.

This commit is contained in:
Ben Vanik 2014-11-02 00:02:17 -07:00
parent 3ed9685244
commit 8c314225bb
7 changed files with 15 additions and 22 deletions

View File

@ -64,9 +64,6 @@ void CommandProcessor::Initialize(GraphicsDriver* driver,
uint32_t original_size = 1 << (0x1C - page_count - 1);
primary_buffer_size_ = original_size;
read_ptr_index_ = 0;
// Tell the driver what to use for translation.
driver_->set_address_translation(primary_buffer_ptr_ & ~0x1FFFFFFF);
}
void CommandProcessor::EnableReadPointerWriteBack(uint32_t ptr,
@ -553,7 +550,7 @@ uint32_t CommandProcessor::ExecutePacket(PacketArgs& args) {
// TODO(benvanik): detect subregions of larger index buffers!
uint32_t index_base = READ_PTR();
uint32_t index_size = READ_PTR();
uint32_t endianness = index_size >> 29;
uint32_t endianness = index_size >> 30;
index_size &= 0x00FFFFFF;
bool index_32bit = (d1 >> 11) & 0x1;
index_size *= index_32bit ? 4 : 2;

View File

@ -53,7 +53,8 @@ int D3D11IndexBufferResource::InvalidateRegion(
SCOPE_profile_cpu_f("gpu");
// All that's done so far:
assert_true(info_.endianness == 0x2);
assert_true(info_.endianness == XE_GPU_ENDIAN_8IN16 ||
info_.endianness == XE_GPU_ENDIAN_8IN32);
D3D11_MAPPED_SUBRESOURCE res;
HRESULT hr = resource_cache_->context()->Map(

View File

@ -14,13 +14,9 @@ using namespace xe;
using namespace xe::gpu;
using namespace xe::gpu::xenos;
GraphicsDriver::GraphicsDriver(Memory* memory) : memory_(memory) {}
GraphicsDriver::GraphicsDriver(Memory* memory) :
memory_(memory), address_translation_(0) {
}
GraphicsDriver::~GraphicsDriver() {
}
GraphicsDriver::~GraphicsDriver() = default;
int GraphicsDriver::LoadShader(XE_GPU_SHADER_TYPE type,
uint32_t address, uint32_t length,
@ -114,7 +110,6 @@ int GraphicsDriver::PrepareDrawIndexBuffer(
IndexFormat format) {
SCOPE_profile_cpu_f("gpu");
address += address_translation_;
MemoryRange memory_range(memory_->Translate(address), address, length);
IndexBufferResource::Info info;
@ -209,7 +204,7 @@ int GraphicsDriver::PopulateInputAssembly(DrawCommand& command) {
const auto& info = desc.info;
MemoryRange memory_range;
memory_range.guest_base = (fetch->address << 2) + address_translation_;
memory_range.guest_base = fetch->address << 2;
memory_range.host_base = memory_->Translate(memory_range.guest_base);
memory_range.length = fetch->size * 4;
// TODO(benvanik): if the memory range is within the command buffer, we
@ -282,7 +277,7 @@ int GraphicsDriver::PopulateSamplerSet(
// TODO(benvanik): quick validate without refetching intraframe.
// Fetch texture from the cache.
MemoryRange memory_range;
memory_range.guest_base = (fetch.address << 12) + address_translation_;
memory_range.guest_base = fetch.address << 12;
memory_range.host_base = memory_->Translate(memory_range.guest_base);
memory_range.length = info.input_length;

View File

@ -28,9 +28,6 @@ public:
Memory* memory() const { return memory_; }
virtual ResourceCache* resource_cache() const = 0;
RegisterFile* register_file() { return &register_file_; };
void set_address_translation(uint32_t value) {
address_translation_ = value;
}
virtual int Initialize() = 0;
@ -61,7 +58,6 @@ protected:
Memory* memory_;
RegisterFile register_file_;
uint32_t address_translation_;
VertexShaderResource* vertex_shader_;
PixelShaderResource* pixel_shader_;

View File

@ -373,7 +373,7 @@ SHIM_CALL VdSwap_shim(PPCContext* ppc_state, KernelState* state) {
uint32_t unk3 = SHIM_GET_ARG_32(3); // ptr to 0xBEEF0000
uint32_t unk4 = SHIM_GET_ARG_32(4); // 0xBEEF0001
uint32_t unk5 = SHIM_GET_ARG_32(5);
uint32_t unk6 = SHIM_GET_ARG_32(6);
uint32_t unk6 = SHIM_GET_ARG_32(6); // ptr to 6?
uint32_t unk7 = SHIM_GET_ARG_32(7);
XELOGD("VdSwap(%.8X, %.8X, %.8X, %.8X, %.8X, %.8X, %.8X, %.8X)", unk0, unk1,

View File

@ -192,7 +192,7 @@ int Memory::Initialize() {
// GPU writeback.
// 0xC... is physical, 0x7F... is virtual. We may need to overlay these.
VirtualAlloc(Translate(0xC0000000), 0x00100000, MEM_COMMIT, PAGE_READWRITE);
VirtualAlloc(Translate(0x00000000), 0x00100000, MEM_COMMIT, PAGE_READWRITE);
// Add handlers for MMIO.
mmio_handler_ = cpu::MMIOHandler::Install(mapping_base_);
@ -217,7 +217,9 @@ const static struct {
uint64_t target_address;
} map_info[] = {
0x00000000, 0x3FFFFFFF, 0x00000000, // (1024mb) - virtual 4k pages
0x40000000, 0x7FFFFFFF, 0x40000000, // (1024mb) - virtual 64k pages
0x40000000, 0x7EFFFFFF, 0x40000000, // (1024mb) - virtual 64k pages (cont)
0x7F000000, 0x7F0FFFFF, 0x00000000, // (1mb) - GPU writeback
0x7F100000, 0x7FFFFFFF, 0x00100000, // (15mb) - XPS?
0x80000000, 0x8FFFFFFF, 0x80000000, // (256mb) - xex 64k pages
0x90000000, 0x9FFFFFFF, 0x80000000, // (256mb) - xex 4k pages
0xA0000000, 0xBFFFFFFF, 0x00000000, // (512mb) - physical 64k pages

View File

@ -86,13 +86,15 @@ class Memory : public alloy::Memory {
struct {
uint8_t* v00000000;
uint8_t* v40000000;
uint8_t* v7F000000;
uint8_t* v7F100000;
uint8_t* v80000000;
uint8_t* v90000000;
uint8_t* vA0000000;
uint8_t* vC0000000;
uint8_t* vE0000000;
};
uint8_t* all_views[7];
uint8_t* all_views[9];
} views_;
std::unique_ptr<cpu::MMIOHandler> mmio_handler_;