summaryrefslogtreecommitdiffstats
path: root/src/libs/dxvk-native-1.9.2a/src/dxso/dxso_code.h
blob: 51fdab78e0b9fc8d59b67165df6203fcfcd736c8 (plain)
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
#pragma once

#include "dxso_include.h"
#include "dxso_reader.h"

#include <vector>
#include <cstdint>

namespace dxvk {

  /**
   * \brief DXBC code iterator
   * 
   * Convenient pointer wrapper that allows
   * reading the code token stream.
   */
  class DxsoCodeIter {
    
  public:
    
    DxsoCodeIter(
      const uint32_t* ptr)
    : m_ptr(ptr) { }
    
    const uint32_t* ptrAt(uint32_t id) const;
    
    uint32_t at(uint32_t id) const;
    uint32_t read();
    
    DxsoCodeIter skip(uint32_t n) const;
    
  private:
    
    const uint32_t* m_ptr = nullptr;
    
  };

  class DxsoCode {

  public:

    DxsoCode(DxsoReader& reader);

    DxsoCodeIter iter() const {
      return DxsoCodeIter(m_code);
    }

  private:

    const uint32_t* m_code;

  };

}