mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-07 07:46:19 +01:00
61 lines
1.4 KiB
C++
61 lines
1.4 KiB
C++
#include "dxbc_compiler.h"
|
|
|
|
namespace dxvk {
|
|
|
|
DxbcCompiler::DxbcCompiler(DxbcProgramVersion version)
|
|
: m_version(version) {
|
|
this->declareCapabilities();
|
|
this->declareMemoryModel();
|
|
}
|
|
|
|
|
|
DxbcCompiler::~DxbcCompiler() {
|
|
|
|
}
|
|
|
|
|
|
void DxbcCompiler::processInstruction(DxbcInstruction ins) {
|
|
Logger::info(str::format(
|
|
static_cast<uint32_t>(ins.opcode())));
|
|
}
|
|
|
|
|
|
Rc<DxvkShader> DxbcCompiler::finalize() {
|
|
SpirvCodeBuffer codeBuffer;
|
|
codeBuffer.putHeader(m_counter.numIds());
|
|
codeBuffer.append(m_spvCapabilities.code());
|
|
codeBuffer.append(m_spvEntryPoints.code());
|
|
codeBuffer.append(m_spvTypeInfo.code());
|
|
codeBuffer.append(m_spvCode);
|
|
|
|
return new DxvkShader(m_version.shaderStage(),
|
|
std::move(codeBuffer), 0, nullptr);
|
|
}
|
|
|
|
|
|
void DxbcCompiler::declareCapabilities() {
|
|
m_spvCapabilities.enable(spv::CapabilityShader);
|
|
|
|
switch (m_version.type()) {
|
|
case DxbcProgramType::GeometryShader:
|
|
m_spvCapabilities.enable(spv::CapabilityGeometry);
|
|
break;
|
|
|
|
case DxbcProgramType::HullShader:
|
|
case DxbcProgramType::DomainShader:
|
|
m_spvCapabilities.enable(spv::CapabilityTessellation);
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
void DxbcCompiler::declareMemoryModel() {
|
|
m_spvEntryPoints.setMemoryModel(
|
|
spv::AddressingModelLogical,
|
|
spv::MemoryModelGLSL450);
|
|
}
|
|
|
|
} |