OWL
Loading...
Searching...
No Matches
MissProg.h
1// ======================================================================== //
2// Copyright 2019 Ingo Wald //
3// //
4// Licensed under the Apache License, Version 2.0 (the "License"); //
5// you may not use this file except in compliance with the License. //
6// You may obtain a copy of the License at //
7// //
8// http://www.apache.org/licenses/LICENSE-2.0 //
9// //
10// Unless required by applicable law or agreed to in writing, software //
11// distributed under the License is distributed on an "AS IS" BASIS, //
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
13// See the License for the specific language governing permissions and //
14// limitations under the License. //
15// ======================================================================== //
16
17#pragma once
18
19#include "SBTObject.h"
20#include "Module.h"
21
22namespace owl {
23
25 struct MissProgType : public SBTObjectType {
26 typedef std::shared_ptr<MissProgType> SP;
27 MissProgType(Context *const context,
28 Module::SP module,
29 const std::string &progName,
30 size_t varStructSize,
31 const std::vector<OWLVarDecl> &varDecls);
32
34 struct DeviceData : public RegisteredObject::DeviceData {
35 typedef std::shared_ptr<DeviceData> SP;
36
38 DeviceData(const DeviceContext::SP &device);
39
42 OptixProgramGroup pg = 0;
43 };
44
46 inline DeviceData &getDD(const DeviceContext::SP &device) const;
47
49 RegisteredObject::DeviceData::SP createOn(const DeviceContext::SP &device) override;
50
52 std::string toString() const override;
53
55 Module::SP module;
56
58 const std::string progName;
60 const std::string annotatedProgName;
61 };
62
65 struct MissProg : public SBTObject<MissProgType> {
66 typedef std::shared_ptr<MissProg> SP;
67
69 MissProg(Context *const context,
70 MissProgType::SP type);
71
74 void writeSBTRecord(uint8_t *const sbtRecord,
75 const DeviceContext::SP &device);
76
78 std::string toString() const override;
79 };
80
81 // ------------------------------------------------------------------
82 // implementation section
83 // ------------------------------------------------------------------
84
86 inline MissProgType::DeviceData &MissProgType::getDD(const DeviceContext::SP &device) const
87 {
88 assert(device && device->ID >= 0 && device->ID < (int)deviceData.size());
89 return deviceData[device->ID]->as<DeviceData>();
90 }
91
92} // ::owl
93
Definition: Context.h:32
Definition: MissProg.h:34
OptixProgramGroup pg
Definition: MissProg.h:42
Definition: MissProg.h:25
std::string toString() const override
Definition: MissProg.cpp:47
RegisteredObject::DeviceData::SP createOn(const DeviceContext::SP &device) override
Definition: MissProg.cpp:54
const std::string annotatedProgName
Definition: MissProg.h:60
DeviceData & getDD(const DeviceContext::SP &device) const
Definition: MissProg.h:86
const std::string progName
Definition: MissProg.h:58
Module::SP module
Definition: MissProg.h:55
Definition: MissProg.h:65
std::string toString() const override
Definition: MissProg.cpp:69
void writeSBTRecord(uint8_t *const sbtRecord, const DeviceContext::SP &device)
Definition: MissProg.cpp:76
std::vector< DeviceData::SP > deviceData
Definition: Object.h:86
Definition: SBTObject.h:33
const std::vector< OWLVarDecl > varDecls
Definition: SBTObject.h:70
const size_t varStructSize
Definition: SBTObject.h:66
Definition: SBTObject.h:118
std::shared_ptr< MissProgType > const type
Definition: SBTObject.h:134