MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / ShaderVarOffset

Class ShaderVarOffset

Source/Falcor/Core/Program/ProgramReflection.h:359–504  ·  view source on GitHub ↗

* Represents the offset of a shader variable relative to its enclosing type/buffer/block. * * A `ShaderVarOffset` can be used to store the offset of a shader variable that might use * ordinary/uniform data, resources like textures/buffers/samplers, or some combination. * It effectively stores both a `UniformShaderVarOffset` and a `ResourceShaderVarOffset` * * A `ShaderVarOffset` can also enc

Source from the content-addressed store, hash-verified

357 *
358 */
359struct ShaderVarOffset
360{
361public:
362 /**
363 * Construct a shader variable offset from its underlying uniform and resource offsets.
364 */
365 ShaderVarOffset(UniformShaderVarOffset uniform, ResourceShaderVarOffset resource) : mUniform(uniform), mResource(resource) {}
366
367 /**
368 * Custom enumeration type used to represent an invalid offset.
369 *
370 * Can be used to initialize a `ShaderVarOffset` when an explicit invalid is desired:
371 *
372 * ShaderVarOffset myOffset = ShaderVarOffset::kInvalid;
373 *
374 * Note that the default constructor also constructs an invalid offset, so this
375 * could be written more simply as:
376 *
377 * ShaderVarOffset myOffset;
378 *
379 */
380 enum Invalid
381 {
382 kInvalid = -1
383 };
384
385 /**
386 * Default constructor: constructs an invalid offset.
387 */
388 ShaderVarOffset(Invalid _ = kInvalid) : mUniform(UniformShaderVarOffset::kInvalid), mResource(ResourceShaderVarOffset::kInvalid) {}
389
390 /**
391 * Custom enumeration type used to represent a zero offset.
392 *
393 * Can be used to initialize a `ShaderVarOffset` when an explicit zero offset is desired:
394 *
395 * ShaderVarOffset myOffset = ShaderVarOffset::kZero;
396 */
397 enum Zero
398 {
399 kZero = 0
400 };
401
402 /**
403 * Construct an explicit zero offset.
404 */
405 ShaderVarOffset(Zero) : mUniform(UniformShaderVarOffset::kZero), mResource(ResourceShaderVarOffset::kZero) {}
406
407 /**
408 * Check if this is a valid offset.
409 */
410 bool isValid() const { return mUniform.isValid(); }
411
412 /**
413 * Get the underlying uniform offset.
414 */
415 UniformShaderVarOffset getUniform() const { return mUniform; }
416

Callers 3

operator[]Method · 0.85
reflectVariableFunction · 0.85
operator+Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected