Skip to content

Commit

Permalink
commit some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtleP committed Nov 14, 2024
1 parent 2aede94 commit 6090002
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 35 deletions.
2 changes: 1 addition & 1 deletion platform/hac/include/driver/display/deko.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ namespace love
Framebuffer framebuffers[MAX_RENDERTARGETS];
Framebuffer depthbuffer;

CCmdMemRing<2> commands;
CCmdMemRing<MAX_RENDERTARGETS> commands;
std::array<DkImage const*, MAX_RENDERTARGETS> targets;

BitwiseAlloc<MAX_OBJECTS> textureHandles;
Expand Down
17 changes: 9 additions & 8 deletions platform/hac/source/boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ namespace love
// clang-format off
static constexpr std::array<const Service, 8> services =
{{
{ "bsd", BIND(socketInitializeDefault), &socketExit },
{ "pl:u", BIND(plInitialize, PlServiceType_User), &plExit },
{ "acc:a", BIND(accountInitialize, AccountServiceType_Application), &accountExit },
{ "set", BIND(setInitialize), &setExit },
{ "set:sys", BIND(setsysInitialize), &setsysExit },
{ "psm", BIND(psmInitialize), &psmExit },
{ "friend:u", BIND(friendsInitialize, FriendsServiceType_User), &friendsExit },
{ "nifm:u", BIND(nifmInitialize, NifmServiceType_User), &nifmExit }
{ "bsd", BIND(socketInitializeDefault), &socketExit },
{ "pl:u", BIND(plInitialize, PlServiceType_User), &plExit },
{ "acc:a", BIND(accountInitialize, AccountServiceType_Application), &accountExit },
{ "set", BIND(setInitialize), &setExit },
{ "set:sys", BIND(setsysInitialize), &setsysExit },
{ "psm", BIND(psmInitialize), &psmExit },
{ "friend:u", BIND(friendsInitialize, FriendsServiceType_User), &friendsExit },
{ "nifm:u", BIND(nifmInitialize, NifmServiceType_User), &nifmExit }
}};
// clang-format on

Expand Down Expand Up @@ -65,6 +65,7 @@ namespace love
}

padConfigureInput(8, HidNpadStyleSet_NpadStandard);
hidInitializeTouchScreen();

romfsInit();

Expand Down
8 changes: 8 additions & 0 deletions platform/hac/source/driver/EventQueue.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "common/screen.hpp"

#include "driver/EventQueue.hpp"

#include "modules/joystick/JoystickModule.hpp"
Expand Down Expand Up @@ -60,7 +62,13 @@ namespace love
}
case AppletMessage_OperationModeChanged:
{
auto info = love::getScreenInfo(Screen(0));
EventQueue::getInstance().sendResize(info.width, info.height);

break;
}
default:
break;
}
}
}
Expand Down
9 changes: 6 additions & 3 deletions platform/hac/source/driver/display/deko.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace love
{
deko3d::deko3d() :
context {},
transform {},
device(dk::DeviceMaker {}.setFlags(DkDeviceFlags_DepthMinusOneToOne).create()),
mainQueue(dk::QueueMaker { this->device }.setFlags(DkQueueFlags_Graphics).create()),
Expand All @@ -14,7 +15,6 @@ namespace love
images(CMemPool(this->device, GPU_USE_FLAGS, GPU_POOL_SIZE)),
data(CMemPool(this->device, CPU_USE_FLAGS, CPU_POOL_SIZE)),
code(CMemPool(this->device, SHADER_USE_FLAGS, SHADER_POOL_SIZE)),
context {},
framebufferSlot(-1)
{}

Expand Down Expand Up @@ -210,7 +210,7 @@ namespace love
this->commandBuffer.barrier(DkBarrier_Primitives, DkInvalidateFlags_Descriptors);
this->context.descriptorsDirty = false;
}
std::printf("Texture Handle id: %u\n", texture);

this->commandBuffer.bindTextures(DkStage_Fragment, 0, texture);
}

Expand All @@ -232,6 +232,9 @@ namespace love
this->commandBuffer.bindColorWriteState(this->context.colorWrite);
this->commandBuffer.bindBlendStates(0, this->context.blend);

if (!this->uniform)
return;

this->commandBuffer.pushConstants(this->uniform.getGpuAddr(), this->uniform.getSize(), 0,
TRANSFORM_SIZE, &this->transform);
}
Expand Down Expand Up @@ -370,7 +373,7 @@ namespace love

dk::SamplerDescriptor samplerDescriptor {};
samplerDescriptor.initialize(*sampler);
std::printf("updating index %u\n", index);

this->imageSet.update(this->commandBuffer, index, imageDescriptor);
this->samplerSet.update(this->commandBuffer, index, samplerDescriptor);

Expand Down
3 changes: 2 additions & 1 deletion source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ static DoneAction runLove(char** argv, int argc, int& result, love::Variant& res
{
if (lua_type(L, index) == LUA_TSTRING && strcmp(lua_tostring(L, index), "restart") == 0)
action = DONE_RESTART;
else if (lua_isnumber(L, index))

if (lua_isnumber(L, index))
result = lua_tonumber(L, index);

if (index < lua_gettop(L))
Expand Down
4 changes: 4 additions & 0 deletions source/modules/event/Event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ namespace love
result = new Message("focus", args);
break;
}
case SUBTYPE_RESIZE:
args.emplace_back(event.resize.width);
args.emplace_back(event.resize.height);
result = new Message("resize", args);
default:
break;
}
Expand Down
15 changes: 8 additions & 7 deletions source/modules/graphics/Graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ namespace love

if (this->batchedDrawState.indexBuffer)
this->batchedDrawState.indexBuffer->release();

Volatile::unloadAll();
}

void GraphicsBase::resetProjection()
Expand Down Expand Up @@ -222,10 +224,12 @@ namespace love
if (this->batchedDrawState.vertexCount > 0)
stats.drawCalls++;

stats.drawCallsBatched = this->drawCallsBatched;
stats.textures = TextureBase::textureCount;
stats.textureMemory = TextureBase::totalGraphicsMemory;
stats.shaderSwitches = ShaderBase::shaderSwitches;
stats.drawCallsBatched = this->drawCallsBatched;
stats.textures = TextureBase::textureCount;
stats.textureMemory = TextureBase::totalGraphicsMemory;
stats.shaderSwitches = ShaderBase::shaderSwitches;
stats.cpuProcessingTime = GraphicsBase::cpuProcessingTime;
stats.gpuDrawingTime = GraphicsBase::gpuDrawingTime;

return stats;
}
Expand Down Expand Up @@ -450,9 +454,6 @@ namespace love
command.texture = state.texture;
command.isFont = state.isFont;

debugVertices((Vertex*)state.vertexBuffer->getData(), state.lastVertexCount);
debugIndices((uint16_t*)state.indexBuffer->getData(), state.lastIndexCount);

this->draw(command);

state.indexBufferMap = MapInfo<uint16_t>();
Expand Down
30 changes: 15 additions & 15 deletions source/modules/love/love.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,20 +164,20 @@ static int love_atpanic(lua_State* L)
return 0;
}

#if __DEBUG__
static void love_atcpanic()
{
try
{
throw;
}
catch (const std::exception& e)
{
std::printf("Uncaught exception: %s", e.what());
std::exit(EXIT_FAILURE);
}
}
#endif
// #if __DEBUG__
// static void love_atcpanic()
// {
// try
// {
// throw;
// }
// catch (const std::exception& e)
// {
// std::printf("Uncaught exception: %s", e.what());
// std::exit(EXIT_FAILURE);
// }
// }
// #endif

static void luax_addcompatibilityalias(lua_State* L, const char* module, const char* name, const char* alias)
{
Expand Down Expand Up @@ -269,7 +269,7 @@ int love_initialize(lua_State* L)
lua_atpanic(L, love_atpanic);

#if __DEBUG__
std::set_terminate(love_atcpanic);
// std::set_terminate(love_atcpanic);
#endif

return 1;
Expand Down

0 comments on commit 6090002

Please sign in to comment.