9 changed files with 113 additions and 9 deletions
-
2src/citra_qt/debugger/graphics_cmdlists.cpp
-
8src/core/hw/gpu.cpp
-
7src/video_core/CMakeLists.txt
-
60src/video_core/command_processor.cpp
-
31src/video_core/command_processor.h
-
8src/video_core/gpu_debugger.h
-
2src/video_core/pica.h
-
2src/video_core/video_core.vcxproj
-
2src/video_core/video_core.vcxproj.filters
@ -1,11 +1,14 @@ |
|||||
set(SRCS video_core.cpp |
|
||||
|
set(SRCS command_processor.cpp |
||||
utils.cpp |
utils.cpp |
||||
|
video_core.cpp |
||||
renderer_opengl/renderer_opengl.cpp) |
renderer_opengl/renderer_opengl.cpp) |
||||
|
|
||||
set(HEADERS math.h |
|
||||
|
set(HEADERS command_processor.h |
||||
|
math.h |
||||
utils.h |
utils.h |
||||
video_core.h |
video_core.h |
||||
renderer_base.h |
renderer_base.h |
||||
|
video_core.h |
||||
renderer_opengl/renderer_opengl.h) |
renderer_opengl/renderer_opengl.h) |
||||
|
|
||||
add_library(video_core STATIC ${SRCS} ${HEADERS}) |
add_library(video_core STATIC ${SRCS} ${HEADERS}) |
||||
@ -0,0 +1,60 @@ |
|||||
|
// Copyright 2014 Citra Emulator Project
|
||||
|
// Licensed under GPLv2
|
||||
|
// Refer to the license.txt file included.
|
||||
|
|
||||
|
#include "pica.h"
|
||||
|
#include "command_processor.h"
|
||||
|
|
||||
|
|
||||
|
namespace Pica { |
||||
|
|
||||
|
Regs registers; |
||||
|
|
||||
|
namespace CommandProcessor { |
||||
|
|
||||
|
static inline void WritePicaReg(u32 id, u32 value) { |
||||
|
u32 old_value = registers[id]; |
||||
|
registers[id] = value; |
||||
|
|
||||
|
switch(id) { |
||||
|
// TODO: Perform actions for anything which requires special treatment here...
|
||||
|
|
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
static std::ptrdiff_t ExecuteCommandBlock(const u32* first_command_word) { |
||||
|
const CommandHeader& header = *(const CommandHeader*)(&first_command_word[1]); |
||||
|
|
||||
|
u32* read_pointer = (u32*)first_command_word; |
||||
|
|
||||
|
// TODO: Take parameter mask into consideration!
|
||||
|
|
||||
|
WritePicaReg(header.cmd_id, *read_pointer); |
||||
|
read_pointer += 2; |
||||
|
|
||||
|
for (int i = 1; i < 1+header.extra_data_length; ++i) { |
||||
|
u32 cmd = header.cmd_id + ((header.group_commands) ? i : 0); |
||||
|
WritePicaReg(cmd, *read_pointer); |
||||
|
++read_pointer; |
||||
|
} |
||||
|
|
||||
|
// align read pointer to 8 bytes
|
||||
|
if ((first_command_word - read_pointer) % 2) |
||||
|
++read_pointer; |
||||
|
|
||||
|
return read_pointer - first_command_word; |
||||
|
} |
||||
|
|
||||
|
void ProcessCommandList(const u32* list, u32 size) { |
||||
|
u32* read_pointer = (u32*)list; |
||||
|
|
||||
|
while (read_pointer < list + size) { |
||||
|
read_pointer += ExecuteCommandBlock(read_pointer); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} // namespace
|
||||
|
|
||||
|
} // namespace
|
||||
@ -0,0 +1,31 @@ |
|||||
|
// Copyright 2014 Citra Emulator Project |
||||
|
// Licensed under GPLv2 |
||||
|
// Refer to the license.txt file included. |
||||
|
|
||||
|
#pragma once |
||||
|
|
||||
|
#include "common/bit_field.h" |
||||
|
#include "common/common_types.h" |
||||
|
|
||||
|
#include "pica.h" |
||||
|
|
||||
|
namespace Pica { |
||||
|
|
||||
|
namespace CommandProcessor { |
||||
|
|
||||
|
union CommandHeader { |
||||
|
u32 hex; |
||||
|
|
||||
|
BitField< 0, 16, u32> cmd_id; |
||||
|
BitField<16, 4, u32> parameter_mask; |
||||
|
BitField<20, 11, u32> extra_data_length; |
||||
|
BitField<31, 1, u32> group_commands; |
||||
|
}; |
||||
|
static_assert(std::is_standard_layout<CommandHeader>::value == true, "CommandHeader does not use standard layout"); |
||||
|
static_assert(sizeof(CommandHeader) == sizeof(u32), "CommandHeader has incorrect size!"); |
||||
|
|
||||
|
void ProcessCommandList(const u32* list, u32 size); |
||||
|
|
||||
|
} // namespace |
||||
|
|
||||
|
} // namespace |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue