Skylicht Engine
Loading...
Searching...
No Matches
IHardwareBuffer.h
1// Copyright (C) 2002-2009 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_HARDWARE_BUFFER_H_INCLUDED__
6#define __I_HARDWARE_BUFFER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "EDriverTypes.h"
10#include "EHardwareBufferFlags.h"
11
12namespace irr
13{
14namespace video
15{
16
36
37enum E_HARDWARE_BUFFER_ACCESS
38{
39 EHBA_DYNAMIC = 0,
40 EHBA_DEFAULT,
41 EHBA_IMMUTABLE,
42 EHBA_SYSTEM_MEMORY
43};
44
45enum E_HARDWARE_BUFFER_FLAGS
46{
47 EHBF_INDEX_16_BITS = 1,
48 EHBF_INDEX_32_BITS = 1 << 1,
49 EHBF_VERTEX_ADDITIONAL_BIND = 1 << 2,
50 EHBF_INDEX_ADDITIONAL_BIND = 1 << 3,
51 EHBF_SHADER_ADDITIONAL_BIND = 1 << 4,
52 EHBF_DRAW_INDIRECT_ARGS = 1 << 5,
53 EHBF_COMPUTE_RAW = 1 << 6,
54 EHBF_COMPUTE_STRUCTURED = 1 << 7,
55 EHBF_COMPUTE_APPEND = 1 << 8,
56 EHBF_COMPUTE_CONSUME = 1 << 9
57};
58
59class IHardwareBuffer : public virtual IReferenceCounted
60{
61public:
62 IHardwareBuffer(const scene::E_HARDWARE_MAPPING mapping, const u32 flags, const u32 size, const E_HARDWARE_BUFFER_TYPE type, const E_DRIVER_TYPE driverType) :
63 Mapping(mapping), Flags(flags), Size(size), Type(type), DriverType(driverType), RequiredUpdate(true)
64 {
65 }
66
67 virtual ~IHardwareBuffer()
68 {
69 }
70
71 // Update hardware buffer.
72 virtual bool update(const scene::E_HARDWARE_MAPPING mapping, const u32 size, const void* data) = 0;
73
74 // Inform if update is required.
75 inline bool isRequiredUpdate() const
76 {
77 return RequiredUpdate;
78 }
79
80 // Request update.
81 inline void requestUpdate()
82 {
83 RequiredUpdate = true;
84 }
85
88 {
89 return Mapping;
90 }
91
93 inline u32 getFlags() const
94 {
95 return Flags;
96 }
97
99 inline u32 size() const
100 {
101 return Size;
102 }
103
106 {
107 return Type;
108 }
109
112 {
113 return DriverType;
114 }
115
116protected:
118 u32 Flags;
119 u32 Size;
121 E_DRIVER_TYPE DriverType;
122
123 bool RequiredUpdate;
124};
125
126}
127}
128
129#endif
IReferenceCounted()
Constructor.
Definition IReferenceCounted.h:50
u32 size() const
Get size of buffer in bytes.
Definition IHardwareBuffer.h:99
E_HARDWARE_BUFFER_TYPE getType() const
Get type of buffer.
Definition IHardwareBuffer.h:105
u32 getFlags() const
Get flags for buffer.
Definition IHardwareBuffer.h:93
E_DRIVER_TYPE getDriverType() const
Get driver type of buffer.
Definition IHardwareBuffer.h:111
scene::E_HARDWARE_MAPPING getMapping() const
Get mapping for buffer.
Definition IHardwareBuffer.h:87
E_HARDWARE_MAPPING
Definition EHardwareBufferFlags.h:14
The video namespace contains classes for accessing the video driver. All 2d and 3d rendering is done ...
Definition EDriverFeatures.h:11
E_HARDWARE_BUFFER_TYPE
Definition IHardwareBuffer.h:18
@ EHBT_STREAM_OUTPUT
Change the stream output/feedback mapping (stream output also include vertex).
Definition IHardwareBuffer.h:26
@ EHBT_COMPUTE
Change the compute mapping.
Definition IHardwareBuffer.h:30
@ EHBT_SYSTEM
Change the system mapping.
Definition IHardwareBuffer.h:34
@ EHBT_INDEX
Change the index mapping.
Definition IHardwareBuffer.h:24
@ EHBT_NONE
Does not change anything.
Definition IHardwareBuffer.h:20
@ EHBT_VERTEX
Change the vertex mapping.
Definition IHardwareBuffer.h:22
@ EHBT_CONSTANTS
Change the constants mapping.
Definition IHardwareBuffer.h:32
@ EHBT_SHADER_RESOURCE
Change the shader resource mapping.
Definition IHardwareBuffer.h:28
E_DRIVER_TYPE
An enum for all types of drivers the Irrlicht Engine supports.
Definition EDriverTypes.h:15
Everything in the Irrlicht Engine can be found in this namespace.
Definition Skylicht.h:33
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.h:58