载入中...
搜索中...
未找到
VulkanGpuBuffer.h
浏览该文件的文档.
1#pragma once
2
3#include "gpgpu/GpuBuffer.h"
4#include "vkbuilder.hpp"
5
6#include <string>
7
8namespace eve::gpgpu {
9
11class VulkanGpuBuffer final : public GpuBuffer {
12public:
14 ~VulkanGpuBuffer() override;
15
17 int getSize() const override { return int(size_); }
19 std::string getUsage() const override { return usage_; }
20
22 void writeData(data::ByteData *data, int dstOffset = 0) override;
24 data::ByteData *readData(int srcOffset = 0, int size = -1) override;
26 void writeFloat32(int floatIndex, float value) override;
28 float readFloat32(int floatIndex) override;
30 void fillFloat32(float value) override;
32 void writeFloat32s(const float *data, int count, int startIndex = 0) override;
34 void readFloat32s(float *out, int count, int startIndex = 0) const override;
36 void uploadBytes(const void *src, uint64_t nbytes, uint64_t dstOffset = 0) override;
38 void downloadBytes(void *dst, uint64_t nbytes, uint64_t srcOffset = 0) const override;
40 GpuResidentBufferView residentView() const override;
41
42 vkb::Device *device_ = nullptr;
43 vk::Buffer buffer_{};
44 vk::DeviceMemory memory_{};
45#if defined(VKB_ENABLE_VMA)
46 VmaAllocation vmaAllocation_ = VK_NULL_HANDLE;
47#endif
48 vk::DeviceSize size_ = 0;
49 std::string usage_ = "storage";
50 bool hostVisible_ = false;
51};
52
53} // namespace eve::gpgpu
double value
std::uint32_t count
float size
Definition TreeMesh.cpp:156
In-memory byte buffer implementing eve::Data (ref-counted).
Definition ByteData.h:13
Backend-agnostic GPU buffer for compute (storage) or CPU staging transfers. Squirrel-owned; derived c...
Definition GpuBuffer.h:18
Vulkan 计算缓冲区实现(storage/vertex buffer + device memory)。
data::ByteData * readData(int srcOffset=0, int size=-1) override
Reads data.
void writeData(data::ByteData *data, int dstOffset=0) override
读写数据(ByteData / 浮点 / 原始字节)。
void writeFloat32s(const float *data, int count, int startIndex=0) override
Writes float 32 s.
void uploadBytes(const void *src, uint64_t nbytes, uint64_t dstOffset=0) override
Uploads bytes.
float readFloat32(int floatIndex) override
Reads float 32.
GpuResidentBufferView residentView() const override
Resident view.
void fillFloat32(float value) override
Fill float 32.
void writeFloat32(int floatIndex, float value) override
Writes float 32.
std::string getUsage() const override
Returns the usage.
void downloadBytes(void *dst, uint64_t nbytes, uint64_t srcOffset=0) const override
Downloads bytes.
int getSize() const override
缓冲区字节数 / 用途。
~VulkanGpuBuffer() override
Releases VulkanGpuBuffer resources.
void readFloat32s(float *out, int count, int startIndex=0) const override
Reads float 32 s.
Fluids module — interactive surface fluid simulation.
Definition Fluids.h:34
Transient backend buffer slice shared between sibling GPU modules. @ownership Non-owning; nativeHandl...