Skip to content

Commit 42a37d9

Browse files
it almost compiles
1 parent 9ef17e2 commit 42a37d9

File tree

4 files changed

+29
-39
lines changed

4 files changed

+29
-39
lines changed

examples_tests/22.RaytracedAO/dirty_source/ExtraCrap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ constexpr uint32_t kOptiXPixelSize = sizeof(uint16_t)*3u;
503503

504504
Renderer::Renderer(IVideoDriver* _driver, IAssetManager* _assetManager, irr::scene::ISceneManager* _smgr, core::smart_refctd_ptr<video::IGPUDescriptorSet>&& globalBackendDataDS, bool useDenoiser) :
505505
m_useDenoiser(useDenoiser), m_driver(_driver), m_smgr(_smgr), m_assetManager(_assetManager),
506-
m_sceneBound(FLT_MAX,FLT_MAX,FLT_MAX,-FLT_MAX,-FLT_MAX,-FLT_MAX), m_renderSize{0u,0u}, m_rightHanded(false), m_globalBackendDataDS(std::move(globalBackendDataDS)),
506+
m_sceneBound(FLT_MAX,FLT_MAX,FLT_MAX,-FLT_MAX,-FLT_MAX,-FLT_MAX), /*m_renderSize{0u,0u}, */m_rightHanded(false), m_globalBackendDataDS(std::move(globalBackendDataDS)),
507507
#if TODO
508508
m_raygenProgram(0u), m_compostProgram(0u),
509509
m_rrManager(ext::RadeonRays::Manager::create(m_driver)),
@@ -1580,7 +1580,7 @@ void Renderer::render()
15801580
#endif
15811581
{
15821582
auto oldVP = m_driver->getViewPort();
1583-
m_driver->setViewPort({{0u,0u},{m_renderSize[0u],m_renderSize[1u]}});
1583+
m_driver->setViewPort(core::recti(0u,0u,m_renderSize[0u],m_renderSize[1u]));
15841584
m_driver->blitRenderTargets(tmpTonemapBuffer, m_colorBuffer, false, false, {}, {}, true);
15851585
m_driver->setViewPort(oldVP);
15861586
}

examples_tests/22.RaytracedAO/dirty_source/ExtraCrap.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class Renderer : public irr::core::IReferenceCounted, public irr::core::Interfac
127127
_IRR_STATIC_INLINE_CONSTEXPR uint32_t MaxResolution[2] = {7680/2,4320/2};
128128

129129

130-
Renderer(irr::video::IVideoDriver* _driver, irr::asset::IAssetManager* _assetManager, irr::scene::ISceneManager* _smgr, core::smart_refctd_ptr<video::IGPUDescriptorSet>&& globalBackendDataDS, bool useDenoiser = true);
130+
Renderer(irr::video::IVideoDriver* _driver, irr::asset::IAssetManager* _assetManager, irr::scene::ISceneManager* _smgr, irr::core::smart_refctd_ptr<irr::video::IGPUDescriptorSet>&& globalBackendDataDS, bool useDenoiser = true);
131131

132132
void init( const irr::asset::SAssetBundle& meshes,
133133
bool isCameraRightHanded,
@@ -152,7 +152,7 @@ class Renderer : public irr::core::IReferenceCounted, public irr::core::Interfac
152152
~Renderer();
153153

154154

155-
core::smart_refctd_ptr<video::IGPUImageView> createScreenSizedTexture(asset::E_FORMAT format);
155+
irr::core::smart_refctd_ptr<irr::video::IGPUImageView> createScreenSizedTexture(irr::asset::E_FORMAT format);
156156

157157
#if TODO
158158
core::smart_refctd_ptr<video::IGPUDescriptorSetLayout> createDS2layoutCompost(bool useDenoiser, core::smart_refctd_ptr<video::IGPUSampler>& nearstSampler);
@@ -178,7 +178,7 @@ class Renderer : public irr::core::IReferenceCounted, public irr::core::Interfac
178178
uint32_t m_renderSize[2u];
179179
bool m_rightHanded;
180180

181-
irr::core::smart_refctd_ptr<video::IGPUDescriptorSet> m_globalBackendDataDS;
181+
irr::core::smart_refctd_ptr<irr::video::IGPUDescriptorSet> m_globalBackendDataDS;
182182

183183
#if TODO
184184
irr::core::smart_refctd_ptr<irr::ext::RadeonRays::Manager> m_rrManager;

include/irr/ext/RadeonRays/RadeonRays.h

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#undef USE_OPENCL
1010
#undef RR_STATIC_LIBRARY
1111

12-
#include "irr/ext/RadeonRays/RadeonRaysIncludeLoader.h"
1312

1413
namespace irr
1514
{
@@ -33,14 +32,16 @@ class Manager final : public core::IReferenceCounted
3332

3433

3534
using MeshBufferRRShapeCache = core::unordered_map<const asset::ICPUMeshBuffer*,::RadeonRays::Shape*>;
35+
#ifdef TODO
3636
using MeshNodeRRInstanceCache = core::unordered_map<scene::IMeshSceneNode*, core::smart_refctd_dynamic_array<::RadeonRays::Shape*> >;
37-
37+
#endif
3838

3939
template<typename Iterator>
4040
inline void makeRRShapes(MeshBufferRRShapeCache& shapeCache, Iterator _begin, Iterator _end)
4141
{
4242
shapeCache.reserve(std::distance(_begin,_end));
4343

44+
#ifdef TODO
4445
uint32_t maxIndexCount = 0u;
4546
for (auto it=_begin; it!=_end; it++)
4647
{
@@ -79,6 +80,7 @@ class Manager final : public core::IReferenceCounted
7980
for (auto it=_begin; it!=_end; it++)
8081
makeShape(shapeCache,static_cast<irr::asset::ICPUMeshBuffer*>(*it),indices);
8182
delete[] indices;
83+
#endif
8284
}
8385

8486
template<typename Iterator>
@@ -88,6 +90,7 @@ class Manager final : public core::IReferenceCounted
8890
rr->DeleteShape(std::get<::RadeonRays::Shape*>(*it));
8991
}
9092

93+
#ifdef TODO
9194
template<typename Iterator>
9295
inline void makeRRInstances(MeshNodeRRInstanceCache& instanceCache, const MeshBufferRRShapeCache& shapeCache,
9396
asset::IAssetManager* _assetManager, Iterator _begin, Iterator _end, const int32_t* _id_begin=nullptr)
@@ -175,36 +178,31 @@ class Manager final : public core::IReferenceCounted
175178
if (needToCommit)
176179
rr->Commit();
177180
}
181+
#endif
178182

179-
inline RadeonRaysIncludeLoader* getRadeonRaysGLSLIncludes()
180-
{
181-
return radeonRaysIncludes.get();
182-
}
183-
184-
inline bool hasImplicitCL2GLSync() const { return automaticOpenCLSync; }
183+
inline bool hasImplicitCL2GLSync() const { return m_automaticOpenCLSync; }
185184

186185

187186
inline auto* getRadeonRaysAPI() {return rr;}
188187

189188
inline cl_command_queue getCLCommandQueue() { return commandQueue; }
190189

191190
protected:
192-
Manager(video::IVideoDriver* _driver);
191+
Manager(video::IVideoDriver* _driver, cl_context context, bool automaticOpenCLSync);
193192
~Manager();
194193

194+
#ifdef TODO
195195
void makeShape(MeshBufferRRShapeCache& shapeCache, const asset::ICPUMeshBuffer* mb, int32_t* indices);
196196
void makeInstance( MeshNodeRRInstanceCache& instanceCache,
197197
const core::unordered_map<const video::IGPUMeshBuffer*,MeshBufferRRShapeCache::value_type>& GPU2CPUTable,
198198
scene::IMeshSceneNode* node, const int32_t* id_it);
199-
200-
201-
static core::smart_refctd_ptr<RadeonRaysIncludeLoader> radeonRaysIncludes;
202-
static cl_context context;
203-
static bool automaticOpenCLSync;
199+
#endif
204200

205201
video::IVideoDriver* driver;
206-
cl_command_queue commandQueue;
207202
::RadeonRays::IntersectionApi* rr;
203+
cl_context m_context;
204+
cl_command_queue commandQueue;
205+
bool m_automaticOpenCLSync;
208206
};
209207

210208
}

src/irr/ext/RadeonRays/RadeonRays.cpp

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,26 @@ using namespace irr::ext::RadeonRays;
1313

1414

1515

16-
cl_context Manager::context = nullptr;
17-
core::smart_refctd_ptr<RadeonRaysIncludeLoader> Manager::radeonRaysIncludes = nullptr;
18-
bool Manager::automaticOpenCLSync = false;
19-
2016
core::smart_refctd_ptr<Manager> Manager::create(video::IVideoDriver* _driver)
2117
{
22-
if (!_driver || context)
18+
if (!_driver)
2319
return nullptr;
2420

2521
auto* glDriver = static_cast<COpenGLDriver*>(_driver);
26-
context = clCreateContext(glDriver->getOpenCLAssociatedContextProperties(),1u,&glDriver->getOpenCLAssociatedDevice(),nullptr,nullptr,nullptr);
22+
cl_context context = clCreateContext(glDriver->getOpenCLAssociatedContextProperties(),1u,&glDriver->getOpenCLAssociatedDevice(),nullptr,nullptr,nullptr);
2723

2824
if (!context)
2925
return nullptr;
3026

31-
if (!radeonRaysIncludes)
32-
radeonRaysIncludes = core::make_smart_refctd_ptr<RadeonRaysIncludeLoader>();
33-
34-
automaticOpenCLSync = ocl::COpenCLHandler::getPlatformInfo(glDriver->getOpenCLAssociatedPlatformID()).FeatureAvailable[ocl::COpenCLHandler::SOpenCLPlatformInfo::IRR_KHR_GL_EVENT];
35-
36-
auto manager = new Manager(_driver);
27+
auto manager = new Manager(_driver,context,ocl::COpenCLHandler::getPlatformInfo(glDriver->getOpenCLAssociatedPlatformID()).FeatureAvailable[ocl::COpenCLHandler::SOpenCLPlatformInfo::IRR_KHR_GL_EVENT]);
3728
return core::smart_refctd_ptr<Manager>(manager,core::dont_grab);
3829
}
3930

40-
Manager::Manager(video::IVideoDriver* _driver) : driver(_driver), commandQueue(nullptr), rr(nullptr)
31+
Manager::Manager(video::IVideoDriver* _driver, cl_context context, bool automaticOpenCLSync) : driver(_driver), rr(nullptr), m_context(context), commandQueue(nullptr), m_automaticOpenCLSync(automaticOpenCLSync)
4132
{
4233
auto* glDriver = static_cast<COpenGLDriver*>(driver);
43-
commandQueue = clCreateCommandQueue(context, glDriver->getOpenCLAssociatedDevice(),/*CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE*/0,nullptr);
44-
rr = ::RadeonRays::CreateFromOpenClContext(context, glDriver->getOpenCLAssociatedDevice(), commandQueue);
34+
commandQueue = clCreateCommandQueue(m_context, glDriver->getOpenCLAssociatedDevice(),/*CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE*/0,nullptr);
35+
rr = ::RadeonRays::CreateFromOpenClContext(m_context, glDriver->getOpenCLAssociatedDevice(), commandQueue);
4536
}
4637

4738
Manager::~Manager()
@@ -54,8 +45,8 @@ Manager::~Manager()
5445
clReleaseCommandQueue(commandQueue);
5546
commandQueue = nullptr;
5647

57-
clReleaseContext(context);
58-
context = nullptr;
48+
clReleaseContext(m_context);
49+
m_context = nullptr;
5950
}
6051

6152

@@ -66,7 +57,7 @@ std::pair<::RadeonRays::Buffer*,cl_mem> Manager::linkBuffer(const video::IGPUBuf
6657
return {nullptr,nullptr};
6758

6859
cl_int error = CL_SUCCESS;
69-
cl_mem clbuff = clCreateFromGLBuffer(context,access,static_cast<const COpenGLBuffer*>(buffer)->getOpenGLName(),&error);
60+
cl_mem clbuff = clCreateFromGLBuffer(m_context,access,static_cast<const COpenGLBuffer*>(buffer)->getOpenGLName(),&error);
7061
switch (error)
7162
{
7263
case CL_SUCCESS:
@@ -78,7 +69,7 @@ std::pair<::RadeonRays::Buffer*,cl_mem> Manager::linkBuffer(const video::IGPUBuf
7869
return {nullptr,nullptr};
7970
}
8071

81-
72+
#ifdef TODO
8273
void Manager::makeShape(MeshBufferRRShapeCache& shapeCache, const asset::ICPUMeshBuffer* mb, int32_t* indices)
8374
{
8475
auto found = shapeCache.find(mb);
@@ -242,3 +233,4 @@ void Manager::makeInstance( MeshNodeRRInstanceCache& instanceCache,
242233
}
243234
instanceCache.insert({node,output});
244235
}
236+
#endif

0 commit comments

Comments
 (0)