Skip to content

Commit 960041e

Browse files
committed
🚨 Fixed warning with dim3 by placing the export on public math and not on class
1 parent 126f7b7 commit 960041e

File tree

3 files changed

+44
-41
lines changed

3 files changed

+44
-41
lines changed

‎Plugin/PluginInteropUnityCUDA/include/Buffer/vertex_buffer.h

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
#include "cuda_include.h"
55
#include "log.h"
66

7-
UNITY_INTERFACE_EXPORT struct dim3;
8-
9-
class UNITY_INTERFACE_EXPORT VertexBuffer
7+
class VertexBuffer
108
{
119
public:
1210

@@ -16,25 +14,25 @@ class UNITY_INTERFACE_EXPORT VertexBuffer
1614
/// <param name="bufferHandle">A pointer of computeBuffer with float4 that has been generated with Unity (see function
1715
/// GetNativeBufferPtr https://docs.unity3d.com/ScriptReference/ComputeBuffer.GetNativeBufferPtr.html) </param>
1816
/// <param name="size">the size of the computeBuffer</param>
19-
VertexBuffer(void* bufferHandle, int size);
17+
UNITY_INTERFACE_EXPORT VertexBuffer(void* bufferHandle, int size);
2018

2119
/// <summary>
2220
/// Register the buffer in CUDA, this has to be override because it depends on the graphics api
2321
/// </summary>
24-
virtual void registerBufferInCUDA() = 0;
22+
UNITY_INTERFACE_EXPORT virtual void registerBufferInCUDA() = 0;
2523

2624
/// <summary>
2725
/// Unregisteregister the buffer in CUDA, this has to be override because it depends on the graphics api
2826
/// </summary>
29-
virtual void unRegisterBufferInCUDA() = 0;
27+
UNITY_INTERFACE_EXPORT virtual void unRegisterBufferInCUDA() = 0;
3028

3129

3230
/// <summary>
3331
/// Map resources to CUDA
3432
/// </summary>
3533
/// <returns>an array of float4* defined on device memory and which can be edited in cuda</returns>
3634
template <typename T>
37-
T* mapResources()
35+
UNITY_INTERFACE_EXPORT T* mapResources()
3836
{
3937
// map resource
4038
CUDA_CHECK(cudaGraphicsMapResources(1, &_pGraphicsResource, 0));
@@ -52,23 +50,23 @@ class UNITY_INTERFACE_EXPORT VertexBuffer
5250
/// Unmap resources from CUDA
5351
/// This function will wait for all previous GPU activity to complete
5452
/// </summary>
55-
void unmapResources();
53+
UNITY_INTERFACE_EXPORT void unmapResources();
5654

5755
/// <summary>
5856
/// Get the default dimension block (8,1,1)
5957
/// </summary>
60-
dim3 getDimBlock() const;
58+
UNITY_INTERFACE_EXPORT dim3 getDimBlock() const;
6159

6260

6361
/// <summary>
6462
/// Get the default dimension grid ((sizeBuffer + 7)/8,1,1)
6563
/// </summary>
66-
dim3 getDimGrid() const;
64+
UNITY_INTERFACE_EXPORT dim3 getDimGrid() const;
6765

6866
/// <summary>
6967
/// Get the size of the buffer
7068
/// </summary>
71-
int getSize() const;
69+
UNITY_INTERFACE_EXPORT int getSize() const;
7270

7371

7472

‎Plugin/PluginInteropUnityCUDA/include/Texture/texture.h

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "cuda_include.h"
44
#include "log.h"
55

6-
class UNITY_INTERFACE_EXPORT Texture
6+
class Texture
77
{
88
public:
99
/// <summary>
@@ -15,20 +15,21 @@ class UNITY_INTERFACE_EXPORT Texture
1515
/// </param> <param name="textureWidth">the width of the texture</param>
1616
/// <param name="textureHeight">the height of the texture</param>
1717
/// <param name="textureDepth">the depth of the texture</param>
18-
Texture(void *textureHandle, int textureWidth, int textureHeight,
18+
UNITY_INTERFACE_EXPORT Texture(void *textureHandle, int textureWidth,
19+
int textureHeight,
1920
int textureDepth);
2021

2122
/// <summary>
2223
/// Register the texture in CUDA, this has to be override because it depends
2324
/// on the graphics api
2425
/// </summary>
25-
virtual void registerTextureInCUDA() = 0;
26+
UNITY_INTERFACE_EXPORT virtual void registerTextureInCUDA() = 0;
2627

2728
/// <summary>
2829
/// Unregister the texture in CUDA, this has to be override because it
2930
/// depends on the graphics api
3031
/// </summary>
31-
virtual void unRegisterTextureInCUDA() = 0;
32+
UNITY_INTERFACE_EXPORT virtual void unRegisterTextureInCUDA() = 0;
3233

3334
/// <summary>
3435
/// Map a cuda array to the graphics resources and wrap it into a surface
@@ -38,7 +39,8 @@ class UNITY_INTERFACE_EXPORT Texture
3839
/// face index as defined by cudaGraphicsCubeFace for cubemap textures for
3940
/// the subresource to access </param> <returns>a cuda surface object on
4041
/// device memory and which can be edited in cuda</returns>
41-
cudaSurfaceObject_t mapTextureToSurfaceObject(int indexInArray = 0);
42+
UNITY_INTERFACE_EXPORT cudaSurfaceObject_t mapTextureToSurfaceObject(
43+
int indexInArray = 0);
4244

4345

4446
/// <summary>
@@ -47,42 +49,45 @@ class UNITY_INTERFACE_EXPORT Texture
4749
/// </summary>
4850
/// <param name="inputSurfObj">the surface object that has been created with
4951
/// <c>mapTextureToSurfaceObject</c> function</param>
50-
void unMapTextureToSurfaceObject(cudaSurfaceObject_t &inputSurfObj);
52+
UNITY_INTERFACE_EXPORT void unMapTextureToSurfaceObject(
53+
cudaSurfaceObject_t &inputSurfObj);
5154

52-
cudaTextureObject_t mapTextureToTextureObject(int indexInArray = 0);
55+
UNITY_INTERFACE_EXPORT cudaTextureObject_t mapTextureToTextureObject(
56+
int indexInArray = 0);
5357

54-
void unMapTextureToTextureObject(cudaTextureObject_t &texObj);
58+
UNITY_INTERFACE_EXPORT void unMapTextureToTextureObject(
59+
cudaTextureObject_t &texObj);
5560

5661
/// <summary>
5762
/// Get the default dimension block (8,8,1)
5863
/// </summary>
59-
dim3 getDimBlock() const;
64+
UNITY_INTERFACE_EXPORT dim3 getDimBlock() const;
6065

6166
/// <summary>
6267
/// Get the default dimension grid ((sizeBuffer + 7)/8,((sizeBuffer +
6368
/// 7)/8,1)
6469
/// </summary>
65-
dim3 getDimGrid() const;
70+
UNITY_INTERFACE_EXPORT dim3 getDimGrid() const;
6671

6772
/// <summary>
6873
/// Get the width of the texture
6974
/// </summary>
70-
int getWidth() const;
75+
UNITY_INTERFACE_EXPORT int getWidth() const;
7176

7277
/// <summary>
7378
/// Get the height of the texture
7479
/// </summary>
75-
int getHeight() const;
80+
UNITY_INTERFACE_EXPORT int getHeight() const;
7681

7782
/// <summary>
7883
/// Get the depth of the texture
7984
/// </summary>
80-
int getDepth() const;
85+
UNITY_INTERFACE_EXPORT int getDepth() const;
8186

8287
/// <summary>
8388
/// Get the native texture pointer
8489
/// </summary>
85-
void *getNativeTexturePtr() const;
90+
UNITY_INTERFACE_EXPORT void *getNativeTexturePtr() const;
8691

8792
protected:
8893
// Pointer to the texture created in Unity

‎Plugin/Utilities/include/log.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extern "C"
2525
/// <param name="type">Type of log to get</param>
2626
void UTILITIES_API GetLastLog(const char*& data, logType type);
2727

28-
class UTILITIES_API Log
28+
class Log
2929
{
3030
private:
3131

@@ -42,36 +42,36 @@ extern "C"
4242

4343
public:
4444
// SINGLETON
45-
static Log& log();
45+
UTILITIES_API static Log& log();
4646

47-
Log(const Log&) = delete;
48-
Log& operator=(const Log&) = delete;
49-
Log(Log&&) = delete;
50-
Log& operator=(Log&&) = delete;
47+
UTILITIES_API Log(const Log&) = delete;
48+
UTILITIES_API Log& operator=(const Log&) = delete;
49+
UTILITIES_API Log(Log&&) = delete;
50+
UTILITIES_API Log& operator=(Log&&) = delete;
5151

5252

53-
Log();
54-
~Log();
53+
UTILITIES_API Log();
54+
UTILITIES_API ~Log();
5555

5656
/// <summary>
5757
/// This function is called when debulLog is called, it will write the string in parameters
5858
/// and the fstream is the log file
5959
/// </summary>
60-
void setInfoPrintFunction(std::function<void(std::string, std::fstream&)> printFunc);
60+
UTILITIES_API void setInfoPrintFunction(std::function<void(std::string, std::fstream&)> printFunc);
6161

6262

6363
/// <summary>
6464
/// This function is called when debulLogWarning is called, it will write the string in parameters
6565
/// and the fstream is the log file
6666
/// </summary>
67-
void setWarningPrintFunction(std::function<void(std::string, std::fstream&)> printFunc);
67+
UTILITIES_API void setWarningPrintFunction(std::function<void(std::string, std::fstream&)> printFunc);
6868

6969

7070
/// <summary>
7171
/// This function is called when debulLogError is called, it will write the string in parameters
7272
/// and the fstream is the log file
7373
/// </summary>
74-
void setErrorPrintFunction(std::function<void(std::string, std::fstream&)> printFunc);
74+
UTILITIES_API void setErrorPrintFunction(std::function<void(std::string, std::fstream&)> printFunc);
7575

7676
/// <summary>
7777
/// It will merge all log and separate them by '\n'
@@ -80,30 +80,30 @@ extern "C"
8080
/// merge of all log and separate them by '\n'. We use a reference to
8181
/// a const char* to permit marshalling</param>
8282
/// <param name="type">Type of log to get</param>
83-
void getMergedLog(const char*& data, logType type);
83+
UTILITIES_API void getMergedLog(const char*& data, logType type);
8484

8585
/// <summary>
8686
/// Call this function to write an info in log
8787
/// </summary>
8888
/// <param name="text">info to write in log</param>
89-
void debugLog(const std::string text);
89+
UTILITIES_API void debugLog(const std::string text);
9090

9191
/// <summary>
9292
/// Call this function to write an warning in log
9393
/// This will add Warning : before message
9494
/// </summary>
9595
/// <param name="text">warning to write in log</param>
96-
void debugLogWarning(const std::string text);
96+
UTILITIES_API void debugLogWarning(const std::string text);
9797

9898

9999
/// <summary>
100100
/// Call this function to write an error in log
101101
/// This will add Error : before message
102102
/// </summary>
103103
/// <param name="text">error to write in log</param>
104-
void debugLogError(const std::string text);
104+
UTILITIES_API void debugLogError(const std::string text);
105105

106-
void extractLog(std::vector<std::string>& logVector);
106+
UTILITIES_API void extractLog(std::vector<std::string>& logVector);
107107
};
108108

109109
}

0 commit comments

Comments
 (0)