Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
vkGenericVertexData.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31
32#pragma once
33#ifndef VK_GENERIC_VERTEX_DATA_H
34#define VK_GENERIC_VERTEX_DATA_H
35
37
38namespace Divide {
39
40FWD_DECLARE_MANAGED_STRUCT(vkBufferImpl);
41
43 public:
44 vkGenericVertexData(GFXDevice& context, const U16 ringBufferLength, const std::string_view name);
45
46 void reset() override;
47
48 void draw(const GenericDrawCommand& command, VDIUserData* data) noexcept override;
49
50 [[nodiscard]] BufferLock setIndexBuffer( const IndexBuffer& indices ) override;
51 [[nodiscard]] BufferLock setBuffer(const SetBufferParams& params) noexcept override;
52 [[nodiscard]] BufferLock updateBuffer(U32 buffer, U32 elementCountOffset, U32 elementCountRange, bufferPtr data) noexcept override;
53
54 private:
55 void bindBufferInternal(const SetBufferParams::BufferBindConfig& bindConfig, VkCommandBuffer& cmdBuffer);
56
57 private:
59 {
60 vkBufferImpl_uptr _buffer{ nullptr };
61 SetBufferParams::BufferBindConfig _bindConfig{};
62 size_t _ringSizeFactor{ 1u };
63 size_t _elementStride{ 0u };
64 };
65
67 {
68 vkBufferImpl_uptr _buffer{ nullptr };
70 size_t _ringSizeFactor{ 1u };
71 size_t _bufferSize{ 0u };
72 };
73
77 };
78
79} //namespace Divide
80
81#endif //VK_GENERIC_VERTEX_DATA_H
#define FWD_DECLARE_MANAGED_STRUCT(T)
Rough around the edges Adapter pattern abstracting the actual rendering API and access to the GPU.
Definition: GFXDevice.h:215
GFXDevice & context() const noexcept
vector< IndexBufferEntry > _idxBuffers
BufferLock updateBuffer(U32 buffer, U32 elementCountOffset, U32 elementCountRange, bufferPtr data) noexcept override
BufferLock setIndexBuffer(const IndexBuffer &indices) override
BufferLock setBuffer(const SetBufferParams &params) noexcept override
vector< GenericBufferImpl > _bufferObjects
void bindBufferInternal(const SetBufferParams::BufferBindConfig &bindConfig, VkCommandBuffer &cmdBuffer)
void draw(const GenericDrawCommand &command, VDIUserData *data) noexcept override
void reset() override
Also clears GPU memory.
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
std::shared_mutex SharedMutex
Definition: SharedMutex.h:43
eastl::vector< Type > vector
Definition: Vector.h:42
uint16_t U16
uint32_t U32
void * bufferPtr
SetBufferParams::BufferBindConfig _bindConfig
vkBufferImpl_uptr _buffer
size_t _ringSizeFactor
size_t _bufferSize
IndexBuffer _data