OWL
Loading...
Searching...
No Matches
Variable.h
1// ======================================================================== //
2// Copyright 2019-2020 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 "Object.h"
20
21namespace owl {
22
23 struct Buffer;
24 struct Group;
25 struct Texture;
26
41 struct Variable : public Object {
42 typedef std::shared_ptr<Variable> SP;
43
44 Variable(const OWLVarDecl *const varDecl)
46 { assert(varDecl); }
47
48 // -------------------------------------------------------
49 // bool
50 // -------------------------------------------------------
51 virtual void set(const bool &value);
52 virtual void set(const vec2b &value);
53 virtual void set(const vec3b &value);
54 virtual void set(const vec4b &value);
55
56 // -------------------------------------------------------
57 // 8 bit
58 // -------------------------------------------------------
59 virtual void set(const uint8_t &value);
60 virtual void set(const vec2uc &value);
61 virtual void set(const vec3uc &value);
62 virtual void set(const vec4uc &value);
63
64 virtual void set(const int8_t &value);
65 virtual void set(const vec2c &value);
66 virtual void set(const vec3c &value);
67 virtual void set(const vec4c &value);
68
69 // -------------------------------------------------------
70 // 16 bit
71 // -------------------------------------------------------
72 virtual void set(const uint16_t &value);
73 virtual void set(const vec2us &value);
74 virtual void set(const vec3us &value);
75 virtual void set(const vec4us &value);
76
77 virtual void set(const int16_t &value);
78 virtual void set(const vec2s &value);
79 virtual void set(const vec3s &value);
80 virtual void set(const vec4s &value);
81
82 // -------------------------------------------------------
83 // 32 bit
84 // -------------------------------------------------------
85 virtual void set(const int32_t &value);
86 virtual void set(const vec2i &value);
87 virtual void set(const vec3i &value);
88 virtual void set(const vec4i &value);
89
90 virtual void set(const uint32_t &value);
91 virtual void set(const vec2ui &value);
92 virtual void set(const vec3ui &value);
93 virtual void set(const vec4ui &value);
94
95 virtual void set(const float &value);
96 virtual void set(const vec2f &value);
97 virtual void set(const vec3f &value);
98 virtual void set(const vec4f &value);
99
100 // -------------------------------------------------------
101 // 64 bit
102 // -------------------------------------------------------
103 virtual void set(const int64_t &value);
104 virtual void set(const vec2l &value);
105 virtual void set(const vec3l &value);
106 virtual void set(const vec4l &value);
107
108 virtual void set(const uint64_t &value);
109 virtual void set(const vec2ul &value);
110 virtual void set(const vec3ul &value);
111 virtual void set(const vec4ul &value);
112
113 virtual void set(const double &value);
114 virtual void set(const vec2d &value);
115 virtual void set(const vec3d &value);
116 virtual void set(const vec4d &value);
117
118 // -------------------------------------------------------
119 // meta/other
120 // -------------------------------------------------------
121
122 virtual void set(const affine3f &value);
123
124 virtual void set(const std::shared_ptr<Buffer> &value);
125 virtual void set(const std::shared_ptr<Group> &value);
126 virtual void set(const std::shared_ptr<Texture> &value);
127
128 virtual void setRaw(const void *ptr, int devID);
129
130
131 virtual std::string toString() const { return "Variable"; }
132
135 void mismatchingType(const std::string &attemptedType);
136
138 virtual void writeToSBT(uint8_t *sbtEntry,
139 const DeviceContext::SP &device) const = 0;
140
144 static Variable::SP createInstanceOf(const OWLVarDecl *decl);
145
147 const OWLVarDecl *const varDecl;
148 };
149
150} // ::owl
Definition: owl_host.h:266
Definition: Object.h:31
Definition: Variable.h:41
virtual void writeToSBT(uint8_t *sbtEntry, const DeviceContext::SP &device) const =0
const OWLVarDecl *const varDecl
Definition: Variable.h:147
static Variable::SP createInstanceOf(const OWLVarDecl *decl)
Definition: Variable.cpp:409
void mismatchingType(const std::string &attemptedType)
Definition: Variable.cpp:27
virtual std::string toString() const
Definition: Variable.h:131
Definition: AffineSpace.h:52