mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-23 21:11:53 +01:00
Avoid crashing on unmapped buffers
Just log a warning instead
This commit is contained in:
parent
9f2b20443b
commit
498b4966d3
@ -24,19 +24,26 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
void VertexBufferState::Flush(InterconnectContext &ctx, StateUpdateBuilder &builder) {
|
void VertexBufferState::Flush(InterconnectContext &ctx, StateUpdateBuilder &builder) {
|
||||||
size_t size{engine->vertexStreamLimit - engine->vertexStream.location + 1};
|
size_t size{engine->vertexStreamLimit - engine->vertexStream.location + 1};
|
||||||
|
|
||||||
if (engine->vertexStream.format.enable && engine->vertexStream.location != 0) {
|
if (engine->vertexStream.format.enable && engine->vertexStream.location != 0 && size) {
|
||||||
view.Update(ctx, engine->vertexStream.location, size);
|
view.Update(ctx, engine->vertexStream.location, size);
|
||||||
ctx.executor.AttachBuffer(*view);
|
if (*view) {
|
||||||
|
ctx.executor.AttachBuffer(*view);
|
||||||
|
|
||||||
if (megaBufferBinding = view->TryMegaBuffer(ctx.executor.cycle, ctx.executor.AcquireMegaBufferAllocator(), ctx.executor.executionNumber);
|
if (megaBufferBinding = view->TryMegaBuffer(ctx.executor.cycle, ctx.executor.AcquireMegaBufferAllocator(), ctx.executor.executionNumber);
|
||||||
megaBufferBinding)
|
megaBufferBinding)
|
||||||
builder.SetVertexBuffer(index, megaBufferBinding);
|
builder.SetVertexBuffer(index, megaBufferBinding);
|
||||||
else
|
else
|
||||||
builder.SetVertexBuffer(index, *view);
|
builder.SetVertexBuffer(index, *view);
|
||||||
} else {
|
|
||||||
// TODO: null descriptor
|
return;
|
||||||
megaBufferBinding = {};
|
} else {
|
||||||
|
Logger::Warn("Unmapped vertex buffer: 0x{:X}", engine->vertexStream.location);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: null descriptor
|
||||||
|
megaBufferBinding = {};
|
||||||
|
builder.SetVertexBuffer(index, {ctx.executor.AcquireMegaBufferAllocator().Allocate(ctx.executor.cycle, 0).buffer});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VertexBufferState::Refresh(InterconnectContext &ctx, StateUpdateBuilder &builder) {
|
bool VertexBufferState::Refresh(InterconnectContext &ctx, StateUpdateBuilder &builder) {
|
||||||
@ -113,6 +120,11 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
|
|
||||||
size_t size{GetIndexBufferSize(engine->indexBuffer.indexSize, elementCount)};
|
size_t size{GetIndexBufferSize(engine->indexBuffer.indexSize, elementCount)};
|
||||||
view.Update(ctx, engine->indexBuffer.address, size);
|
view.Update(ctx, engine->indexBuffer.address, size);
|
||||||
|
if (!*view) {
|
||||||
|
Logger::Warn("Unmapped index buffer: 0x{:X}", engine->indexBuffer.address);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ctx.executor.AttachBuffer(*view);
|
ctx.executor.AttachBuffer(*view);
|
||||||
|
|
||||||
indexType = ConvertIndexType(engine->indexBuffer.indexSize);
|
indexType = ConvertIndexType(engine->indexBuffer.indexSize);
|
||||||
@ -170,14 +182,20 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
if (engine->streamOutEnable) {
|
if (engine->streamOutEnable) {
|
||||||
if (engine->streamOutBuffer.size) {
|
if (engine->streamOutBuffer.size) {
|
||||||
view.Update(ctx, engine->streamOutBuffer.address + engine->streamOutBuffer.loadWritePointerStartOffset, engine->streamOutBuffer.size);
|
view.Update(ctx, engine->streamOutBuffer.address + engine->streamOutBuffer.loadWritePointerStartOffset, engine->streamOutBuffer.size);
|
||||||
ctx.executor.AttachBuffer(*view);
|
|
||||||
|
|
||||||
// view.GetBuffer()->MarkGpuDirty();
|
if (*view) {
|
||||||
builder.SetTransformFeedbackBuffer(index, *view);
|
ctx.executor.AttachBuffer(*view);
|
||||||
} else {
|
|
||||||
// Bind an empty buffer ourselves since Vulkan doesn't support passing a VK_NULL_HANDLE xfb buffer
|
// view.GetBuffer()->MarkGpuDirty();
|
||||||
builder.SetTransformFeedbackBuffer(index, {ctx.executor.AcquireMegaBufferAllocator().Allocate(ctx.executor.cycle, 0).buffer});
|
builder.SetTransformFeedbackBuffer(index, *view);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
Logger::Warn("Unmapped transform feedback buffer: 0x{:X}", engine->streamOutBuffer.address);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bind an empty buffer ourselves since Vulkan doesn't support passing a VK_NULL_HANDLE xfb buffer
|
||||||
|
builder.SetTransformFeedbackBuffer(index, {ctx.executor.AcquireMegaBufferAllocator().Allocate(ctx.executor.cycle, 0).buffer});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user