Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
PushConstants.h
Go to the documentation of this file.
1/*
2Copyright (c) 2018 DIVIDE-Studio
3Copyright (c) 2009 Ionut Cava
4
5This file is part of DIVIDE Framework.
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software
9and associated documentation files (the "Software"), to deal in the Software
10without restriction,
11including without limitation the rights to use, copy, modify, merge, publish,
12distribute, sublicense,
13and/or sell copies of the Software, and to permit persons to whom the
14Software is furnished to do so,
15subject to the following conditions:
16
17The above copyright notice and this permission notice shall be included in
18all copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21IMPLIED,
22INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23PARTICULAR PURPOSE AND NONINFRINGEMENT.
24IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25DAMAGES OR OTHER LIABILITY,
26WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27IN CONNECTION WITH THE SOFTWARE
28OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30*/
31
32#pragma once
33#ifndef DVD_PUSH_CONSTANTS_H_
34#define DVD_PUSH_CONSTANTS_H_
35
37
38namespace Divide
39{
41{
43
44 [[nodiscard]] inline bool set() const noexcept
45 {
46 return data[0] != MAT4_NEGATIVE_ONE ||
48 }
49
50 [[nodiscard]] static constexpr size_t Size() noexcept { return 2 * sizeof(mat4<F32>); }
51 [[nodiscard]] inline const F32* dataPtr() const { return data[0].mat; }
52
53
54 bool operator==(const PushConstantsStruct& rhs) const = default;
55};
56
58{
59 struct Entry
60 {
64 };
65
67
68 template<typename T>
69 void set(U64 bindingHash, PushConstantType type, const T& value);
70
71 template<typename T> requires (!std::is_same_v<bool, T>)
72 void set(U64 bindingHash, PushConstantType type, const T* values, size_t count);
73
74 bool remove( U64 bindingHash );
75
76 [[nodiscard]] const UniformDataContainer& entries() const noexcept;
77 [[nodiscard]] const Byte* data( size_t offset ) const noexcept;
78
79private:
80 friend bool Merge( UniformData& lhs, UniformData& rhs, bool& partial );
81
83 eastl::fixed_vector<Byte, 32, true> _buffer;
84};
85
86}; //namespace Divide
87
88#endif //DVD_PUSH_CONSTANTS_H_
89
90#include "PushConstants.inl"
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
std::byte Byte
static const mat4< F32 > MAT4_NEGATIVE_ONE
Definition: MathMatrices.h:734
eastl::vector< Type > vector
Definition: Vector.h:42
uint64_t U64
const F32 * dataPtr() const
Definition: PushConstants.h:51
bool operator==(const PushConstantsStruct &rhs) const =default
bool set() const noexcept
Definition: PushConstants.h:44
static constexpr size_t Size() noexcept
Definition: PushConstants.h:50
Definition: PushConstants.h:60
BufferRange _range
Definition: PushConstants.h:62
PushConstantType _type
Definition: PushConstants.h:63
U64 _bindingHash
Definition: PushConstants.h:61
const Byte * data(size_t offset) const noexcept
vector< Entry > UniformDataContainer
Definition: PushConstants.h:66
UniformDataContainer _data
Definition: PushConstants.h:82
friend bool Merge(UniformData &lhs, UniformData &rhs, bool &partial)
bool remove(U64 bindingHash)
const UniformDataContainer & entries() const noexcept
void set(U64 bindingHash, PushConstantType type, const T &value)
eastl::fixed_vector< Byte, 32, true > _buffer
Definition: PushConstants.h:83