mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 02:52:10 +01:00
[dxbc] Add Xfb structures to DxbcModuleInfo
This commit is contained in:
parent
eff81c7edf
commit
a42f03e32d
@ -622,6 +622,7 @@ namespace dxvk {
|
||||
DxbcModuleInfo moduleInfo;
|
||||
moduleInfo.options = m_dxbcOptions;
|
||||
moduleInfo.tess = nullptr;
|
||||
moduleInfo.xfb = nullptr;
|
||||
|
||||
if (FAILED(this->CreateShaderModule(&module,
|
||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||
@ -647,6 +648,7 @@ namespace dxvk {
|
||||
DxbcModuleInfo moduleInfo;
|
||||
moduleInfo.options = m_dxbcOptions;
|
||||
moduleInfo.tess = nullptr;
|
||||
moduleInfo.xfb = nullptr;
|
||||
|
||||
if (FAILED(this->CreateShaderModule(&module,
|
||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||
@ -691,6 +693,7 @@ namespace dxvk {
|
||||
DxbcModuleInfo moduleInfo;
|
||||
moduleInfo.options = m_dxbcOptions;
|
||||
moduleInfo.tess = nullptr;
|
||||
moduleInfo.xfb = nullptr;
|
||||
|
||||
if (FAILED(this->CreateShaderModule(&module,
|
||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||
@ -719,6 +722,7 @@ namespace dxvk {
|
||||
DxbcModuleInfo moduleInfo;
|
||||
moduleInfo.options = m_dxbcOptions;
|
||||
moduleInfo.tess = nullptr;
|
||||
moduleInfo.xfb = nullptr;
|
||||
|
||||
if (tessInfo.maxTessFactor >= 8.0f)
|
||||
moduleInfo.tess = &tessInfo;
|
||||
@ -747,6 +751,7 @@ namespace dxvk {
|
||||
DxbcModuleInfo moduleInfo;
|
||||
moduleInfo.options = m_dxbcOptions;
|
||||
moduleInfo.tess = nullptr;
|
||||
moduleInfo.xfb = nullptr;
|
||||
|
||||
if (FAILED(this->CreateShaderModule(&module,
|
||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||
@ -772,6 +777,7 @@ namespace dxvk {
|
||||
DxbcModuleInfo moduleInfo;
|
||||
moduleInfo.options = m_dxbcOptions;
|
||||
moduleInfo.tess = nullptr;
|
||||
moduleInfo.xfb = nullptr;
|
||||
|
||||
if (FAILED(this->CreateShaderModule(&module,
|
||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||
|
@ -199,7 +199,12 @@ namespace dxvk {
|
||||
m_entryPointInterfaces.size(),
|
||||
m_entryPointInterfaces.data());
|
||||
m_module.setDebugName(m_entryPointId, "main");
|
||||
|
||||
|
||||
DxvkShaderOptions shaderOptions = { };
|
||||
|
||||
if (m_moduleInfo.xfb != nullptr)
|
||||
shaderOptions.rasterizedStream = m_moduleInfo.xfb->rasterizedStream;
|
||||
|
||||
// Create the shader module object
|
||||
return new DxvkShader(
|
||||
m_programInfo.shaderStage(),
|
||||
@ -207,6 +212,7 @@ namespace dxvk {
|
||||
m_resourceSlots.data(),
|
||||
m_interfaceSlots,
|
||||
m_module.compile(),
|
||||
shaderOptions,
|
||||
std::move(m_immConstData));
|
||||
}
|
||||
|
||||
|
@ -488,7 +488,7 @@ namespace dxvk {
|
||||
// Inter-stage shader interface slots. Also
|
||||
// covers vertex input and fragment output.
|
||||
DxvkInterfaceSlots m_interfaceSlots;
|
||||
|
||||
|
||||
///////////////////////////////////
|
||||
// Shader-specific data structures
|
||||
DxbcCompilerVsPart m_vs;
|
||||
|
@ -14,6 +14,35 @@ namespace dxvk {
|
||||
float maxTessFactor;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Xfb capture entry
|
||||
*
|
||||
* Stores an output variable to capture,
|
||||
* as well as the buffer to write it to.
|
||||
*/
|
||||
struct DxbcXfbEntry {
|
||||
const char* semanticName;
|
||||
uint32_t semanticIndex;
|
||||
uint32_t componentIndex;
|
||||
uint32_t componentCount;
|
||||
uint32_t streamId;
|
||||
uint32_t bufferId;
|
||||
uint32_t offset;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Xfb info
|
||||
*
|
||||
* Stores capture entries and output buffer
|
||||
* strides. This structure must only be
|
||||
* defined if \c entryCount is non-zero.
|
||||
*/
|
||||
struct DxbcXfbInfo {
|
||||
uint32_t entryCount;
|
||||
DxbcXfbEntry entries[128];
|
||||
uint32_t strides[4];
|
||||
int32_t rasterizedStream;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Shader module info
|
||||
@ -24,6 +53,7 @@ namespace dxvk {
|
||||
struct DxbcModuleInfo {
|
||||
DxbcOptions options;
|
||||
DxbcTessInfo* tess;
|
||||
DxbcXfbInfo* xfb;
|
||||
};
|
||||
|
||||
}
|
@ -186,8 +186,9 @@ namespace dxvk {
|
||||
const DxvkInterfaceSlots& iface,
|
||||
const SpirvCodeBuffer& code) {
|
||||
return new DxvkShader(stage,
|
||||
slotCount, slotInfos, iface,
|
||||
code, DxvkShaderConstData());
|
||||
slotCount, slotInfos, iface, code,
|
||||
DxvkShaderOptions(),
|
||||
DxvkShaderConstData());
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,9 +81,10 @@ namespace dxvk {
|
||||
const DxvkResourceSlot* slotInfos,
|
||||
const DxvkInterfaceSlots& iface,
|
||||
const SpirvCodeBuffer& code,
|
||||
const DxvkShaderOptions& options,
|
||||
DxvkShaderConstData&& constData)
|
||||
: m_stage(stage), m_code(code), m_interface(iface),
|
||||
m_constData(std::move(constData)) {
|
||||
m_options(options), m_constData(std::move(constData)) {
|
||||
// Write back resource slot infos
|
||||
for (uint32_t i = 0; i < slotCount; i++)
|
||||
m_slots.push_back(slotInfos[i]);
|
||||
|
@ -50,6 +50,18 @@ namespace dxvk {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Additional shader options
|
||||
*
|
||||
* Contains additional properties that should be
|
||||
* taken into account when creating pipelines.
|
||||
*/
|
||||
struct DxvkShaderOptions {
|
||||
/// Rasterized stream, or -1
|
||||
int32_t rasterizedStream;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Shader constants
|
||||
*
|
||||
@ -107,6 +119,7 @@ namespace dxvk {
|
||||
const DxvkResourceSlot* slotInfos,
|
||||
const DxvkInterfaceSlots& iface,
|
||||
const SpirvCodeBuffer& code,
|
||||
const DxvkShaderOptions& options,
|
||||
DxvkShaderConstData&& constData);
|
||||
|
||||
~DxvkShader();
|
||||
@ -164,6 +177,14 @@ namespace dxvk {
|
||||
return m_interface;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Shader options
|
||||
* \returns Shader options
|
||||
*/
|
||||
DxvkShaderOptions shaderOptions() const {
|
||||
return m_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Shader constant data
|
||||
*
|
||||
@ -216,6 +237,7 @@ namespace dxvk {
|
||||
std::vector<DxvkResourceSlot> m_slots;
|
||||
std::vector<size_t> m_idOffsets;
|
||||
DxvkInterfaceSlots m_interface;
|
||||
DxvkShaderOptions m_options;
|
||||
DxvkShaderConstData m_constData;
|
||||
DxvkShaderKey m_key;
|
||||
|
||||
|
@ -43,6 +43,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
|
||||
|
||||
DxbcModuleInfo moduleInfo;
|
||||
moduleInfo.options = DxbcOptions();
|
||||
moduleInfo.xfb = nullptr;
|
||||
|
||||
Rc<DxvkShader> shader = module.compile(moduleInfo, ifileName);
|
||||
std::ofstream ofile(str::fromws(argv[2]), std::ios::binary);
|
||||
|
Loading…
x
Reference in New Issue
Block a user