2017-10-16 17:50:09 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../dxvk/dxvk_shader.h"
|
|
|
|
|
2017-11-01 00:01:40 +01:00
|
|
|
#include "dxbc_chunk_isgn.h"
|
2017-10-16 17:50:09 +02:00
|
|
|
#include "dxbc_chunk_shex.h"
|
|
|
|
#include "dxbc_header.h"
|
|
|
|
#include "dxbc_reader.h"
|
|
|
|
|
|
|
|
// References used for figuring out DXBC:
|
|
|
|
// - https://github.com/tgjones/slimshader-cpp
|
|
|
|
// - Wine
|
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief DXBC shader module
|
|
|
|
*
|
|
|
|
* Reads the DXBC byte code and extracts information
|
|
|
|
* about the resource bindings and the instruction
|
|
|
|
* stream. A module can then be compiled to SPIR-V.
|
|
|
|
*/
|
|
|
|
class DxbcModule {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
DxbcModule(DxbcReader& reader);
|
|
|
|
~DxbcModule();
|
|
|
|
|
2017-12-06 18:54:01 +01:00
|
|
|
/**
|
|
|
|
* \brief Shader type and version
|
|
|
|
* \returns Shader type and version
|
|
|
|
*/
|
|
|
|
DxbcProgramVersion version() const {
|
|
|
|
return m_shexChunk->version();
|
|
|
|
}
|
|
|
|
|
2017-12-07 12:45:02 +01:00
|
|
|
/**
|
|
|
|
* \brief Input and output signature chunks
|
|
|
|
*
|
|
|
|
* Parts of the D3D11 API need access to the
|
|
|
|
* input or output signature of the shader.
|
|
|
|
*/
|
|
|
|
Rc<DxbcIsgn> isgn() const { return m_isgnChunk; }
|
|
|
|
Rc<DxbcIsgn> osgn() const { return m_osgnChunk; }
|
|
|
|
|
2017-10-16 17:50:09 +02:00
|
|
|
/**
|
|
|
|
* \brief Compiles DXBC shader to SPIR-V module
|
|
|
|
* \returns The compiled DXVK shader object
|
|
|
|
*/
|
2017-11-20 14:03:00 +01:00
|
|
|
SpirvCodeBuffer compile() const;
|
2017-10-16 17:50:09 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
DxbcHeader m_header;
|
|
|
|
|
2017-11-01 00:01:40 +01:00
|
|
|
Rc<DxbcIsgn> m_isgnChunk;
|
|
|
|
Rc<DxbcIsgn> m_osgnChunk;
|
2017-10-16 17:50:09 +02:00
|
|
|
Rc<DxbcShex> m_shexChunk;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|