PeriDyno
1.0.0
Loading...
Searching...
No Matches
D:
Peridyno
peridyno
src
Rendering
Engine
OpenGL
GraphicsObject
GPUTexture.h
Go to the documentation of this file.
1
16
17
#pragma once
18
19
#include "
Texture.h
"
20
#include <
Vector.h
>
21
#include <
Array/Array2D.h
>
22
23
#ifdef CUDA_BACKEND
24
struct
cudaGraphicsResource;
25
#endif
26
27
#ifdef VK_BACKEND
28
#include <
VkDeviceArray.h
>
29
#endif
30
31
namespace
dyno
{
32
33
// texture for loading data from cuda/vulkan api
34
template
<
typename
T>
35
class
XTexture2D
:
public
Texture2D
36
{
37
public
:
38
XTexture2D
() {}
39
~XTexture2D
() {}
40
41
virtual
void
create
()
override
;
42
bool
isValid
()
const
;
43
44
// update OpenGL texture within GL context
45
void
updateGL
();
46
47
// load data to into an intermediate buffer
48
void
load
(
dyno::DArray2D<T>
data);
49
50
private
:
51
int
width
= -1;
52
int
height
= -1;
53
54
#ifdef CUDA_BACKEND
55
dyno::DArray2D<T>
buffer;
56
cudaGraphicsResource* resource = 0;
57
#endif
58
59
#ifdef VK_BACKEND
60
dyno::CArray2D<T>
temp;
61
62
VkBuffer buffer = VK_NULL_HANDLE;
63
VkDeviceMemory memory = VK_NULL_HANDLE;
64
bool
resized =
false
;
65
#ifdef WIN32
66
HANDLE handle =
nullptr
;
// The Win32 handle
67
#else
68
int
fd = -1;
69
#endif
70
// command for copy buffer
71
VkCommandBuffer copyCmd = VK_NULL_HANDLE;
72
// OpenGL memory object
73
unsigned
int
memoryObject = 0;
74
#endif
75
};
76
77
template
class
XTexture2D<dyno::Vec4f>
;
78
template
class
XTexture2D<dyno::Vec3f>
;
79
template
class
XTexture2D<dyno::Vec3u>
;
80
}
Array2D.h
Texture.h
Vector.h
VkDeviceArray.h
dyno::Texture2D::Texture2D
Texture2D()
Definition
Texture.cpp:56
dyno::XTexture2D
Definition
GPUTexture.h:36
dyno::XTexture2D::updateGL
void updateGL()
Definition
GPUTexture.cpp:202
dyno::XTexture2D::~XTexture2D
~XTexture2D()
Definition
GPUTexture.h:39
dyno::XTexture2D::isValid
bool isValid() const
Definition
GPUTexture.cpp:49
dyno::XTexture2D::create
virtual void create() override
Definition
GPUTexture.cpp:27
dyno::XTexture2D::width
int width
Definition
GPUTexture.h:51
dyno::XTexture2D::XTexture2D
XTexture2D()
Definition
GPUTexture.h:38
dyno::XTexture2D::height
int height
Definition
GPUTexture.h:52
dyno::XTexture2D::load
void load(dyno::DArray2D< T > data)
Definition
GPUTexture.cpp:56
dyno
This is an implementation of AdditiveCCD based on peridyno.
Definition
Array.h:25
dyno::CArray2D
Array2D< T, DeviceType::CPU > CArray2D
Definition
Array2D.h:131
dyno::DArray2D
Array2D< T, DeviceType::GPU > DArray2D
Definition
Array2D.inl:90
Generated by
1.13.2