mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Move pushbuffer map/unmap to the .cpp file to avoid inlining (for stack traces)
This commit is contained in:
parent
51a6c67502
commit
04913be779
4 changed files with 24 additions and 22 deletions
|
@ -134,6 +134,27 @@ size_t VulkanPushBuffer::GetTotalSize() const {
|
|||
return sum;
|
||||
}
|
||||
|
||||
void VulkanPushBuffer::Map() {
|
||||
assert(!writePtr_);
|
||||
VkResult res = vkMapMemory(device_, buffers_[buf_].deviceMemory, 0, size_, 0, (void **)(&writePtr_));
|
||||
assert(writePtr_);
|
||||
assert(VK_SUCCESS == res);
|
||||
}
|
||||
|
||||
void VulkanPushBuffer::Unmap() {
|
||||
assert(writePtr_);
|
||||
/*
|
||||
// Should not need this since we use coherent memory.
|
||||
VkMappedMemoryRange range = { VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE };
|
||||
range.offset = 0;
|
||||
range.size = offset_;
|
||||
range.memory = buffers_[buf_].deviceMemory;
|
||||
vkFlushMappedMemoryRanges(device_, 1, &range);
|
||||
*/
|
||||
vkUnmapMemory(device_, buffers_[buf_].deviceMemory);
|
||||
writePtr_ = nullptr;
|
||||
}
|
||||
|
||||
VulkanDeviceAllocator::VulkanDeviceAllocator(VulkanContext *vulkan, size_t minSlabSize, size_t maxSlabSize)
|
||||
: vulkan_(vulkan), lastSlab_(0), minSlabSize_(minSlabSize), maxSlabSize_(maxSlabSize), memoryTypeIndex_(UNDEFINED_MEMORY_TYPE), destroyed_(false) {
|
||||
assert((minSlabSize_ & (SLAB_GRAIN_SIZE - 1)) == 0);
|
||||
|
|
|
@ -46,26 +46,9 @@ public:
|
|||
Unmap();
|
||||
}
|
||||
|
||||
void Map() {
|
||||
assert(!writePtr_);
|
||||
VkResult res = vkMapMemory(device_, buffers_[buf_].deviceMemory, 0, size_, 0, (void **)(&writePtr_));
|
||||
assert(writePtr_);
|
||||
assert(VK_SUCCESS == res);
|
||||
}
|
||||
void Map();
|
||||
|
||||
void Unmap() {
|
||||
assert(writePtr_);
|
||||
/*
|
||||
// Should not need this since we use coherent memory.
|
||||
VkMappedMemoryRange range = { VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE };
|
||||
range.offset = 0;
|
||||
range.size = offset_;
|
||||
range.memory = buffers_[buf_].deviceMemory;
|
||||
vkFlushMappedMemoryRanges(device_, 1, &range);
|
||||
*/
|
||||
vkUnmapMemory(device_, buffers_[buf_].deviceMemory);
|
||||
writePtr_ = nullptr;
|
||||
}
|
||||
void Unmap();
|
||||
|
||||
// When using the returned memory, make sure to bind the returned vkbuf.
|
||||
// This will later allow for handling overflow correctly.
|
||||
|
|
|
@ -301,8 +301,7 @@ static VulkanPipeline *CreateVulkanPipeline(VkDevice device, VkPipelineCache pip
|
|||
|
||||
VulkanPipeline *PipelineManagerVulkan::GetOrCreatePipeline(VkPipelineLayout layout, VkRenderPass renderPass, const VulkanPipelineRasterStateKey &rasterKey, const DecVtxFormat *decFmt, VulkanVertexShader *vs, VulkanFragmentShader *fs, bool useHwTransform) {
|
||||
VulkanPipelineKey key{};
|
||||
if (!renderPass)
|
||||
Crash();
|
||||
_assert_msg_(G3D, renderPass, "Can't create a pipeline with a null renderpass");
|
||||
|
||||
key.raster = rasterKey;
|
||||
key.renderPass = renderPass;
|
||||
|
|
|
@ -1298,7 +1298,6 @@ uint32_t VKContext::GetDataFormatSupport(DataFormat fmt) const {
|
|||
// use this frame's init command buffer.
|
||||
class VKFramebuffer : public Framebuffer {
|
||||
public:
|
||||
// Inherits ownership so no AddRef.
|
||||
VKFramebuffer(VKRFramebuffer *fb) : buf_(fb) {}
|
||||
~VKFramebuffer() {
|
||||
buf_->vulkan_->Delete().QueueCallback([](void *fb) {
|
||||
|
|
Loading…
Add table
Reference in a new issue