mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-08 07:05:40 +12:00
Add thread logger, split renderer from PICA
This commit is contained in:
parent
672a893938
commit
9f792c2cf5
5 changed files with 28 additions and 25 deletions
|
@ -59,8 +59,10 @@ set(SERVICE_SOURCE_FILES src/core/services/service_manager.cpp src/core/services
|
||||||
src/core/services/ptm.cpp src/core/services/mic.cpp src/core/services/cecd.cpp
|
src/core/services/ptm.cpp src/core/services/mic.cpp src/core/services/cecd.cpp
|
||||||
)
|
)
|
||||||
set(PICA_SOURCE_FILES src/core/PICA/gpu.cpp src/core/PICA/regs.cpp src/core/PICA/shader_unit.cpp
|
set(PICA_SOURCE_FILES src/core/PICA/gpu.cpp src/core/PICA/regs.cpp src/core/PICA/shader_unit.cpp
|
||||||
src/core/PICA/shader_interpreter.cpp src/core/PICA/renderer_opengl.cpp
|
src/core/PICA/shader_interpreter.cpp
|
||||||
)
|
)
|
||||||
|
set(RENDERER_GL_SOURCE_FILES src/core/renderer_gl/renderer_gl.cpp)
|
||||||
|
|
||||||
set(LOADER_SOURCE_FILES src/core/loader/elf.cpp src/core/loader/ncsd.cpp src/core/loader/ncch.cpp)
|
set(LOADER_SOURCE_FILES src/core/loader/elf.cpp src/core/loader/ncsd.cpp src/core/loader/ncch.cpp)
|
||||||
set(FS_SOURCE_FILES src/core/fs/archive_ncch.cpp src/core/fs/archive_save_data.cpp src/core/fs/archive_sdmc.cpp)
|
set(FS_SOURCE_FILES src/core/fs/archive_ncch.cpp src/core/fs/archive_save_data.cpp src/core/fs/archive_sdmc.cpp)
|
||||||
|
|
||||||
|
@ -95,8 +97,9 @@ source_group("Source Files\\Core\\Kernel" FILES ${KERNEL_SOURCE_FILES})
|
||||||
source_group("Source Files\\Core\\Loader" FILES ${LOADER_SOURCE_FILES})
|
source_group("Source Files\\Core\\Loader" FILES ${LOADER_SOURCE_FILES})
|
||||||
source_group("Source Files\\Core\\Services" FILES ${SERVICE_SOURCE_FILES})
|
source_group("Source Files\\Core\\Services" FILES ${SERVICE_SOURCE_FILES})
|
||||||
source_group("Source Files\\Core\\PICA" FILES ${PICA_SOURCE_FILES})
|
source_group("Source Files\\Core\\PICA" FILES ${PICA_SOURCE_FILES})
|
||||||
|
source_group("Source Files\\Core\\OpenGL Renderer" FILES ${RENDERER_GL_SOURCE_FILES})
|
||||||
source_group("Source Files\\Third Party" FILES ${THIRD_PARTY_SOURCE_FILES})
|
source_group("Source Files\\Third Party" FILES ${THIRD_PARTY_SOURCE_FILES})
|
||||||
|
|
||||||
add_executable(Alber ${SOURCE_FILES} ${FS_SOURCE_FILES} ${KERNEL_SOURCE_FILES} ${LOADER_SOURCE_FILES} ${SERVICE_SOURCE_FILES}
|
add_executable(Alber ${SOURCE_FILES} ${FS_SOURCE_FILES} ${KERNEL_SOURCE_FILES} ${LOADER_SOURCE_FILES} ${SERVICE_SOURCE_FILES}
|
||||||
${PICA_SOURCE_FILES} ${THIRD_PARTY_SOURCE_FILES} ${HEADER_FILES})
|
${PICA_SOURCE_FILES} ${RENDERER_GL_SOURCE_FILES} ${THIRD_PARTY_SOURCE_FILES} ${HEADER_FILES})
|
||||||
target_link_libraries(Alber PRIVATE dynarmic SDL2-static)
|
target_link_libraries(Alber PRIVATE dynarmic SDL2-static)
|
|
@ -81,6 +81,7 @@ private:
|
||||||
|
|
||||||
MAKE_LOG_FUNCTION(log, kernelLogger)
|
MAKE_LOG_FUNCTION(log, kernelLogger)
|
||||||
MAKE_LOG_FUNCTION(logSVC, svcLogger)
|
MAKE_LOG_FUNCTION(logSVC, svcLogger)
|
||||||
|
MAKE_LOG_FUNCTION(logThread, threadLogger)
|
||||||
MAKE_LOG_FUNCTION(logDebugString, debugStringLogger)
|
MAKE_LOG_FUNCTION(logDebugString, debugStringLogger)
|
||||||
MAKE_LOG_FUNCTION(logError, errorLogger)
|
MAKE_LOG_FUNCTION(logError, errorLogger)
|
||||||
MAKE_LOG_FUNCTION(logFileIO, fileIOLogger)
|
MAKE_LOG_FUNCTION(logFileIO, fileIOLogger)
|
||||||
|
|
|
@ -18,26 +18,27 @@ namespace Log {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Our loggers here. Enable/disable by toggling the template param
|
// Our loggers here. Enable/disable by toggling the template param
|
||||||
static Logger<true> kernelLogger;
|
static Logger<false> kernelLogger;
|
||||||
static Logger<true> debugStringLogger; // Enables output for the outputDebugString SVC
|
static Logger<false> debugStringLogger; // Enables output for the outputDebugString SVC
|
||||||
static Logger<true> errorLogger;
|
static Logger<false> errorLogger;
|
||||||
static Logger<true> fileIOLogger;
|
static Logger<false> fileIOLogger;
|
||||||
static Logger<true> svcLogger;
|
static Logger<false> svcLogger;
|
||||||
static Logger<true> gpuLogger;
|
static Logger<false> threadLogger;
|
||||||
|
static Logger<false> gpuLogger;
|
||||||
|
|
||||||
// Service loggers
|
// Service loggers
|
||||||
static Logger<true> aptLogger;
|
static Logger<false> aptLogger;
|
||||||
static Logger<true> cecdLogger;
|
static Logger<false> cecdLogger;
|
||||||
static Logger<true> cfgLogger;
|
static Logger<false> cfgLogger;
|
||||||
static Logger<true> dspServiceLogger;
|
static Logger<false> dspServiceLogger;
|
||||||
static Logger<true> fsLogger;
|
static Logger<false> fsLogger;
|
||||||
static Logger<true> hidLogger;
|
static Logger<false> hidLogger;
|
||||||
static Logger<true> gspGPULogger;
|
static Logger<false> gspGPULogger;
|
||||||
static Logger<true> gspLCDLogger;
|
static Logger<false> gspLCDLogger;
|
||||||
static Logger<true> micLogger;
|
static Logger<false> micLogger;
|
||||||
static Logger<true> ndmLogger;
|
static Logger<false> ndmLogger;
|
||||||
static Logger<true> ptmLogger;
|
static Logger<false> ptmLogger;
|
||||||
static Logger<true> srvLogger;
|
static Logger<false> srvLogger;
|
||||||
|
|
||||||
#define MAKE_LOG_FUNCTION(functionName, logger) \
|
#define MAKE_LOG_FUNCTION(functionName, logger) \
|
||||||
template <typename... Args> \
|
template <typename... Args> \
|
||||||
|
|
|
@ -11,7 +11,7 @@ void Kernel::switchThread(int newThreadIndex) {
|
||||||
auto& oldThread = threads[currentThreadIndex];
|
auto& oldThread = threads[currentThreadIndex];
|
||||||
auto& newThread = threads[newThreadIndex];
|
auto& newThread = threads[newThreadIndex];
|
||||||
newThread.status = ThreadStatus::Running;
|
newThread.status = ThreadStatus::Running;
|
||||||
printf("Switching from thread %d to %d\n", currentThreadIndex, newThreadIndex);
|
logThread("Switching from thread %d to %d\n", currentThreadIndex, newThreadIndex);
|
||||||
|
|
||||||
// Bail early if the new thread is actually the old thread
|
// Bail early if the new thread is actually the old thread
|
||||||
if (currentThreadIndex == newThreadIndex) [[unlikely]] {
|
if (currentThreadIndex == newThreadIndex) [[unlikely]] {
|
||||||
|
@ -70,8 +70,6 @@ std::optional<int> Kernel::getNextThread() {
|
||||||
if (canThreadRun(t)) {
|
if (canThreadRun(t)) {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Check timeouts here
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// No thread was found
|
// No thread was found
|
||||||
|
|
|
@ -191,8 +191,8 @@ void GPU::drawVertices(OpenGL::Primitives primType, Vertex* vertices, u32 count)
|
||||||
f24 depthOffset = f24::fromRaw(regs[PICAInternalRegs::DepthOffset] & 0xffffff);
|
f24 depthOffset = f24::fromRaw(regs[PICAInternalRegs::DepthOffset] & 0xffffff);
|
||||||
printf("Depth enable: %d, func: %d, writeEnable: %d\n", depthEnable, depthFunc, depthWriteEnable);
|
printf("Depth enable: %d, func: %d, writeEnable: %d\n", depthEnable, depthFunc, depthWriteEnable);
|
||||||
|
|
||||||
if (depthScale.toFloat32() != -1.0 || depthOffset.toFloat32() != 0.0)
|
//if (depthScale.toFloat32() != -1.0 || depthOffset.toFloat32() != 0.0)
|
||||||
Helpers::panic("TODO: Implement depth scale/offset. Remove the depth *= -1.0 from vertex shader");
|
// Helpers::panic("TODO: Implement depth scale/offset. Remove the depth *= -1.0 from vertex shader");
|
||||||
|
|
||||||
// TODO: Actually use this
|
// TODO: Actually use this
|
||||||
float viewportWidth = f24::fromRaw(regs[PICAInternalRegs::ViewportWidth] & 0xffffff).toFloat32() * 2.0;
|
float viewportWidth = f24::fromRaw(regs[PICAInternalRegs::ViewportWidth] & 0xffffff).toFloat32() * 2.0;
|
Loading…
Add table
Reference in a new issue