This commit finishes removing the uses of the integer to float vertex buffer fetch mode. Previous commits noted below already started that process. The last usage was geometry attributes. Now integers are converted to floats as part of the existing upload process. The change makes the Vulkan vertex buffer type conversion unused, so it's removed. That's nice because Vulkan vertex buffers go from 1040 to 568 bytes in size and have significantly less overhead on creation. Related: -153abc372e-1e1ac2bb9b-617858e453Pull Request: https://projects.blender.org/blender/blender/pulls/138873
61 lines
1.3 KiB
C++
61 lines
1.3 KiB
C++
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/** \file
|
|
* \ingroup gpu
|
|
*
|
|
* Mimics old style OpenGL immediate mode drawing.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
#include "gpu_immediate_private.hh"
|
|
#include "gpu_vertex_format_private.hh"
|
|
|
|
#include "vk_buffer.hh"
|
|
#include "vk_data_conversion.hh"
|
|
#include "vk_mem_alloc.h"
|
|
#include "vk_resource_tracker.hh"
|
|
#include "vk_vertex_attribute_object.hh"
|
|
|
|
namespace blender::gpu {
|
|
|
|
class VKDevice;
|
|
|
|
/* Size of internal buffer. */
|
|
constexpr size_t DEFAULT_INTERNAL_BUFFER_SIZE = 4 * 1024 * 1024;
|
|
|
|
class VKImmediate : public Immediate {
|
|
private:
|
|
VKVertexAttributeObject vertex_attributes_;
|
|
|
|
VkDeviceSize buffer_offset_ = 0;
|
|
VkDeviceSize current_subbuffer_len_ = 0;
|
|
|
|
Vector<std::unique_ptr<VKBuffer>> active_buffers_;
|
|
Vector<std::unique_ptr<VKBuffer>> recycling_buffers_;
|
|
|
|
public:
|
|
VKImmediate();
|
|
virtual ~VKImmediate();
|
|
void deinit(VKDevice &device);
|
|
|
|
void reset();
|
|
|
|
uchar *begin() override;
|
|
void end() override;
|
|
|
|
friend class VKVertexAttributeObject;
|
|
|
|
private:
|
|
VKBufferWithOffset active_buffer() const;
|
|
VkDeviceSize buffer_bytes_free();
|
|
|
|
VKBuffer &ensure_space(VkDeviceSize bytes_needed, VkDeviceSize offset_allignment);
|
|
};
|
|
|
|
} // namespace blender::gpu
|