mirror of https://github.com/doitsujin/dxvk
[dxbc] Add Xfb structures to DxbcModuleInfo
This commit is contained in:
parent
eff81c7edf
commit
a42f03e32d
|
@ -622,6 +622,7 @@ namespace dxvk {
|
||||||
DxbcModuleInfo moduleInfo;
|
DxbcModuleInfo moduleInfo;
|
||||||
moduleInfo.options = m_dxbcOptions;
|
moduleInfo.options = m_dxbcOptions;
|
||||||
moduleInfo.tess = nullptr;
|
moduleInfo.tess = nullptr;
|
||||||
|
moduleInfo.xfb = nullptr;
|
||||||
|
|
||||||
if (FAILED(this->CreateShaderModule(&module,
|
if (FAILED(this->CreateShaderModule(&module,
|
||||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||||
|
@ -647,6 +648,7 @@ namespace dxvk {
|
||||||
DxbcModuleInfo moduleInfo;
|
DxbcModuleInfo moduleInfo;
|
||||||
moduleInfo.options = m_dxbcOptions;
|
moduleInfo.options = m_dxbcOptions;
|
||||||
moduleInfo.tess = nullptr;
|
moduleInfo.tess = nullptr;
|
||||||
|
moduleInfo.xfb = nullptr;
|
||||||
|
|
||||||
if (FAILED(this->CreateShaderModule(&module,
|
if (FAILED(this->CreateShaderModule(&module,
|
||||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||||
|
@ -691,6 +693,7 @@ namespace dxvk {
|
||||||
DxbcModuleInfo moduleInfo;
|
DxbcModuleInfo moduleInfo;
|
||||||
moduleInfo.options = m_dxbcOptions;
|
moduleInfo.options = m_dxbcOptions;
|
||||||
moduleInfo.tess = nullptr;
|
moduleInfo.tess = nullptr;
|
||||||
|
moduleInfo.xfb = nullptr;
|
||||||
|
|
||||||
if (FAILED(this->CreateShaderModule(&module,
|
if (FAILED(this->CreateShaderModule(&module,
|
||||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||||
|
@ -719,6 +722,7 @@ namespace dxvk {
|
||||||
DxbcModuleInfo moduleInfo;
|
DxbcModuleInfo moduleInfo;
|
||||||
moduleInfo.options = m_dxbcOptions;
|
moduleInfo.options = m_dxbcOptions;
|
||||||
moduleInfo.tess = nullptr;
|
moduleInfo.tess = nullptr;
|
||||||
|
moduleInfo.xfb = nullptr;
|
||||||
|
|
||||||
if (tessInfo.maxTessFactor >= 8.0f)
|
if (tessInfo.maxTessFactor >= 8.0f)
|
||||||
moduleInfo.tess = &tessInfo;
|
moduleInfo.tess = &tessInfo;
|
||||||
|
@ -747,6 +751,7 @@ namespace dxvk {
|
||||||
DxbcModuleInfo moduleInfo;
|
DxbcModuleInfo moduleInfo;
|
||||||
moduleInfo.options = m_dxbcOptions;
|
moduleInfo.options = m_dxbcOptions;
|
||||||
moduleInfo.tess = nullptr;
|
moduleInfo.tess = nullptr;
|
||||||
|
moduleInfo.xfb = nullptr;
|
||||||
|
|
||||||
if (FAILED(this->CreateShaderModule(&module,
|
if (FAILED(this->CreateShaderModule(&module,
|
||||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||||
|
@ -772,6 +777,7 @@ namespace dxvk {
|
||||||
DxbcModuleInfo moduleInfo;
|
DxbcModuleInfo moduleInfo;
|
||||||
moduleInfo.options = m_dxbcOptions;
|
moduleInfo.options = m_dxbcOptions;
|
||||||
moduleInfo.tess = nullptr;
|
moduleInfo.tess = nullptr;
|
||||||
|
moduleInfo.xfb = nullptr;
|
||||||
|
|
||||||
if (FAILED(this->CreateShaderModule(&module,
|
if (FAILED(this->CreateShaderModule(&module,
|
||||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||||
|
|
|
@ -199,7 +199,12 @@ namespace dxvk {
|
||||||
m_entryPointInterfaces.size(),
|
m_entryPointInterfaces.size(),
|
||||||
m_entryPointInterfaces.data());
|
m_entryPointInterfaces.data());
|
||||||
m_module.setDebugName(m_entryPointId, "main");
|
m_module.setDebugName(m_entryPointId, "main");
|
||||||
|
|
||||||
|
DxvkShaderOptions shaderOptions = { };
|
||||||
|
|
||||||
|
if (m_moduleInfo.xfb != nullptr)
|
||||||
|
shaderOptions.rasterizedStream = m_moduleInfo.xfb->rasterizedStream;
|
||||||
|
|
||||||
// Create the shader module object
|
// Create the shader module object
|
||||||
return new DxvkShader(
|
return new DxvkShader(
|
||||||
m_programInfo.shaderStage(),
|
m_programInfo.shaderStage(),
|
||||||
|
@ -207,6 +212,7 @@ namespace dxvk {
|
||||||
m_resourceSlots.data(),
|
m_resourceSlots.data(),
|
||||||
m_interfaceSlots,
|
m_interfaceSlots,
|
||||||
m_module.compile(),
|
m_module.compile(),
|
||||||
|
shaderOptions,
|
||||||
std::move(m_immConstData));
|
std::move(m_immConstData));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -488,7 +488,7 @@ namespace dxvk {
|
||||||
// Inter-stage shader interface slots. Also
|
// Inter-stage shader interface slots. Also
|
||||||
// covers vertex input and fragment output.
|
// covers vertex input and fragment output.
|
||||||
DxvkInterfaceSlots m_interfaceSlots;
|
DxvkInterfaceSlots m_interfaceSlots;
|
||||||
|
|
||||||
///////////////////////////////////
|
///////////////////////////////////
|
||||||
// Shader-specific data structures
|
// Shader-specific data structures
|
||||||
DxbcCompilerVsPart m_vs;
|
DxbcCompilerVsPart m_vs;
|
||||||
|
|
|
@ -14,6 +14,35 @@ namespace dxvk {
|
||||||
float maxTessFactor;
|
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
|
* \brief Shader module info
|
||||||
|
@ -24,6 +53,7 @@ namespace dxvk {
|
||||||
struct DxbcModuleInfo {
|
struct DxbcModuleInfo {
|
||||||
DxbcOptions options;
|
DxbcOptions options;
|
||||||
DxbcTessInfo* tess;
|
DxbcTessInfo* tess;
|
||||||
|
DxbcXfbInfo* xfb;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
|
@ -186,8 +186,9 @@ namespace dxvk {
|
||||||
const DxvkInterfaceSlots& iface,
|
const DxvkInterfaceSlots& iface,
|
||||||
const SpirvCodeBuffer& code) {
|
const SpirvCodeBuffer& code) {
|
||||||
return new DxvkShader(stage,
|
return new DxvkShader(stage,
|
||||||
slotCount, slotInfos, iface,
|
slotCount, slotInfos, iface, code,
|
||||||
code, DxvkShaderConstData());
|
DxvkShaderOptions(),
|
||||||
|
DxvkShaderConstData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -81,9 +81,10 @@ namespace dxvk {
|
||||||
const DxvkResourceSlot* slotInfos,
|
const DxvkResourceSlot* slotInfos,
|
||||||
const DxvkInterfaceSlots& iface,
|
const DxvkInterfaceSlots& iface,
|
||||||
const SpirvCodeBuffer& code,
|
const SpirvCodeBuffer& code,
|
||||||
|
const DxvkShaderOptions& options,
|
||||||
DxvkShaderConstData&& constData)
|
DxvkShaderConstData&& constData)
|
||||||
: m_stage(stage), m_code(code), m_interface(iface),
|
: 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
|
// Write back resource slot infos
|
||||||
for (uint32_t i = 0; i < slotCount; i++)
|
for (uint32_t i = 0; i < slotCount; i++)
|
||||||
m_slots.push_back(slotInfos[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
|
* \brief Shader constants
|
||||||
*
|
*
|
||||||
|
@ -107,6 +119,7 @@ namespace dxvk {
|
||||||
const DxvkResourceSlot* slotInfos,
|
const DxvkResourceSlot* slotInfos,
|
||||||
const DxvkInterfaceSlots& iface,
|
const DxvkInterfaceSlots& iface,
|
||||||
const SpirvCodeBuffer& code,
|
const SpirvCodeBuffer& code,
|
||||||
|
const DxvkShaderOptions& options,
|
||||||
DxvkShaderConstData&& constData);
|
DxvkShaderConstData&& constData);
|
||||||
|
|
||||||
~DxvkShader();
|
~DxvkShader();
|
||||||
|
@ -164,6 +177,14 @@ namespace dxvk {
|
||||||
return m_interface;
|
return m_interface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Shader options
|
||||||
|
* \returns Shader options
|
||||||
|
*/
|
||||||
|
DxvkShaderOptions shaderOptions() const {
|
||||||
|
return m_options;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Shader constant data
|
* \brief Shader constant data
|
||||||
*
|
*
|
||||||
|
@ -216,6 +237,7 @@ namespace dxvk {
|
||||||
std::vector<DxvkResourceSlot> m_slots;
|
std::vector<DxvkResourceSlot> m_slots;
|
||||||
std::vector<size_t> m_idOffsets;
|
std::vector<size_t> m_idOffsets;
|
||||||
DxvkInterfaceSlots m_interface;
|
DxvkInterfaceSlots m_interface;
|
||||||
|
DxvkShaderOptions m_options;
|
||||||
DxvkShaderConstData m_constData;
|
DxvkShaderConstData m_constData;
|
||||||
DxvkShaderKey m_key;
|
DxvkShaderKey m_key;
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
|
||||||
|
|
||||||
DxbcModuleInfo moduleInfo;
|
DxbcModuleInfo moduleInfo;
|
||||||
moduleInfo.options = DxbcOptions();
|
moduleInfo.options = DxbcOptions();
|
||||||
|
moduleInfo.xfb = nullptr;
|
||||||
|
|
||||||
Rc<DxvkShader> shader = module.compile(moduleInfo, ifileName);
|
Rc<DxvkShader> shader = module.compile(moduleInfo, ifileName);
|
||||||
std::ofstream ofile(str::fromws(argv[2]), std::ios::binary);
|
std::ofstream ofile(str::fromws(argv[2]), std::ios::binary);
|
||||||
|
|
Loading…
Reference in New Issue