summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-extract-value-from-type.h
blob: fa824db815aae60ce266530121d3a4ab13d7b478 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// slang-ir-extract-value-from-type.h
#pragma once

#include "slang-ir.h"
#include "slang-type-layout.h"

namespace Slang
{

// Emit code using builder that yields an `IRInst` representing a value of `size` bytes
// starting at `offset` in `src`. `src` must be a value of `struct`, array, vector or basic type.
// `size` can be either 1, 2 or 4. The resulting `IRInst` value will have an `uint` type.
IRInst* extractValueAtOffset(
    IRBuilder& builder,
    TargetProgram* targetReq,
    IRInst* src,
    uint32_t offset,
    uint32_t size);

} // namespace Slang