renderingelement2dvulkan auto buffer size
This commit is contained in:
parent
3fcea6a3d7
commit
f4a48b20c6
1 changed files with 13 additions and 0 deletions
|
|
@ -45,6 +45,9 @@ export namespace Crafter {
|
|||
std::uint16_t bufferX;
|
||||
std::uint16_t bufferY;
|
||||
std::array<VulkanBufferBase*, Window::numFrames> buffers;
|
||||
RenderingElement2DVulkanBase(Anchor2D anchor) : Transform2D(anchor) {
|
||||
|
||||
}
|
||||
RenderingElement2DVulkanBase(Anchor2D anchor, std::uint16_t bufferX, std::uint16_t bufferY) : bufferX(bufferX), bufferY(bufferY), Transform2D(anchor) {
|
||||
|
||||
}
|
||||
|
|
@ -58,6 +61,16 @@ export namespace Crafter {
|
|||
|
||||
template<bool Owning, bool Mapped>
|
||||
struct RenderingElement2DVulkan : RenderingElement2DVulkanBase {
|
||||
RenderingElement2DVulkan(Anchor2D anchor, RendertargetBase<Window::numFrames>& target, Transform2D& parent) requires(Owning) : RenderingElement2DVulkanBase(anchor) {
|
||||
renderingElement2DVulkans.push_back(this);
|
||||
UpdatePosition(target, parent);
|
||||
this->bufferX = this->scaled.size.x;
|
||||
this->bufferY = this->scaled.size.y;
|
||||
for(std::uint8_t i = 0; i < Window::numFrames; i++) {
|
||||
buffers[i] = new VulkanBuffer<Vector<_Float16, 4, 4>, Mapped>();
|
||||
reinterpret_cast<VulkanBuffer<Vector<_Float16, 4, 4>, Mapped>*>(buffers[i])->Create(VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_2_SHADER_DEVICE_ADDRESS_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, bufferX * bufferY);
|
||||
}
|
||||
}
|
||||
RenderingElement2DVulkan(Anchor2D anchor, std::uint16_t bufferX, std::uint16_t bufferY) requires(Owning) : RenderingElement2DVulkanBase(anchor, bufferX, bufferY) {
|
||||
renderingElement2DVulkans.push_back(this);
|
||||
for(std::uint8_t i = 0; i < Window::numFrames; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue