-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathExecuteContext.h
More file actions
111 lines (94 loc) · 4.29 KB
/
ExecuteContext.h
File metadata and controls
111 lines (94 loc) · 4.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
* Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#pragma once
#include <Platform.h>
#include <OS.h>
#include <Log.h>
#include <TaskTracker.h>
#include <Geometry.h>
#include <DenoisingContext.h>
#include <assert.h>
#include <vector>
#include <deque>
#include <list>
#include <array>
#include <memory>
#include <mutex>
#include <thread>
namespace KickstartRT_NativeLayer
{
class PersistentWorkingSet;
class TaskWorkingSet;
class Scene;
};
namespace KickstartRT
{
extern std::mutex g_APIInterfaceMutex; // DLLMain
};
namespace KickstartRT_NativeLayer
{
struct UpdateFromExecuteContext {
std::deque<std::unique_ptr<BVHTask::Geometry>> m_createdGeometries;
std::deque<std::unique_ptr<BVHTask::Instance>> m_createdInstances;
std::deque<std::unique_ptr<DenoisingContext>> m_createdDenoisingContexts;
std::deque<GeometryHandle> m_destroyedGeometries;
std::deque<InstanceHandle> m_destroyedInstances;
std::deque<DenoisingContextHandle> m_destroyedDenoisingContexts;
bool m_destroyAllGeometries = false;
bool m_destroyAllInstances = false;
bool m_destroyAllDenoisingContexts = false;
};
class ExecuteContext_impl : public ExecuteContext {
protected:
std::unique_ptr<TaskTracker> m_taskTracker;
ExecuteContext_InitSettings m_initSettings;
std::unique_ptr<Scene> m_scene;
std::unique_ptr<PersistentWorkingSet> m_persistentWorkingSet;
std::mutex m_updateFromExecuteContextMutex;
UpdateFromExecuteContext m_updateFromExecuteContext;
public:
ExecuteContext_impl();
virtual ~ExecuteContext_impl();
Status Init(const ExecuteContext_InitSettings *settings);
TaskContainer* CreateTaskContainer() override;
DenoisingContextHandle CreateDenoisingContextHandle(const DenoisingContextInput* input) override;
Status DestroyDenoisingContextHandle(DenoisingContextHandle handle) override;
Status DestroyAllDenoisingContextHandles() override;
GeometryHandle CreateGeometryHandle() override;
Status CreateGeometryHandles(GeometryHandle* handles, uint32_t nbHandles) override;
Status DestroyGeometryHandle(GeometryHandle handle) override;
Status DestroyGeometryHandles(const GeometryHandle* handles, uint32_t nbHandles) override;
Status DestroyAllGeometryHandles() override;
InstanceHandle CreateInstanceHandle() override;
Status CreateInstanceHandles(InstanceHandle* handles, uint32_t nbHandles) override;
Status DestroyInstanceHandle(InstanceHandle handle) override;
Status DestroyInstanceHandles(const InstanceHandle* handles, uint32_t nbHandles) override;
Status DestroyAllInstanceHandles() override;
Status BuildGPUTask(GPUTaskHandle *retHandle, TaskContainer *container, const BuildGPUTaskInput* input) override;
Status MarkGPUTaskAsCompleted(GPUTaskHandle handle) override;
Status ReleaseDeviceResourcesImmediately() override;
Status GetLoadedShaderList(uint32_t* loadedListBuffer, size_t bufferSize, size_t* retListSize) override;
Status GetCurrentResourceAllocations(ResourceAllocations* retStatus) override;
Status BeginLoggingResourceAllocations(const wchar_t * filePath) override;
Status EndLoggingResourceAllocations() override;
};
};