mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 02:52:10 +01:00
[spirv] Remove SPIR-V tools integration
SPIR-V tools did not turn out to be useful, but increased the binary size by a significant amount and caused build problems. - spirv-opt: Far too slow for the intended purpose, and Nvidia specific shader issues have been reported and fixed. - spirv-val: Not much value in practice since shaders can be written to a directory and validated manually.
This commit is contained in:
parent
8e9d0878e6
commit
25cae39cdb
@ -55,8 +55,6 @@ The behaviour of DXVK can be modified with environment variables.
|
||||
- `DXVK_CUSTOM_DEVICE_ID=<ID>` Specifces a custom PCI device identifier (Device ID)
|
||||
- `DXVK_SHADER_DUMP_PATH=directory` Writes all DXBC and SPIR-V shaders to the given directory
|
||||
- `DXVK_SHADER_READ_PATH=directory` Reads SPIR-V shaders from the given directory rather than using the shader compiler.
|
||||
- `DXVK_SHADER_VALIDATE=1` Enables SPIR-V shader validation. Useful for debugging purposes.
|
||||
- `DXVK_SHADER_OPTIMIZE=1` Enables SPIR-V shader optimization. Experimental, use with care.
|
||||
- `DXVK_LOG_LEVEL=error|warn|info|debug|trace` Controls message logging.
|
||||
- `DXVK_HUD=1` Enables the HUD
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -18,13 +18,10 @@ else
|
||||
dxvk_library_path = meson.source_root() + '/lib32'
|
||||
endif
|
||||
|
||||
lib_vulkan = dxvk_compiler.find_library('vulkan-1', dirs : dxvk_library_path)
|
||||
lib_vulkan = dxvk_compiler.find_library('vulkan-1', dirs : dxvk_library_path)
|
||||
lib_d3d11 = dxvk_compiler.find_library('d3d11')
|
||||
lib_dxgi = dxvk_compiler.find_library('dxgi')
|
||||
|
||||
lib_spirvtools = dxvk_compiler.find_library('libSPIRV-Tools', dirs : dxvk_library_path)
|
||||
lib_spirvtools_opt = dxvk_compiler.find_library('libSPIRV-Tools-opt', dirs : dxvk_library_path)
|
||||
|
||||
lib_d3d11 = dxvk_compiler.find_library('d3d11')
|
||||
lib_dxgi = dxvk_compiler.find_library('dxgi')
|
||||
if dxvk_compiler.get_id() != 'msvc'
|
||||
lib_d3dcompiler_47 = dxvk_compiler.find_library('d3dcompiler_47')
|
||||
endif
|
||||
|
@ -39,18 +39,6 @@ namespace dxvk {
|
||||
m_shader = module.compile(*pDxbcOptions);
|
||||
m_shader->setDebugName(m_name);
|
||||
|
||||
// FIXME this is currently way too slow to be viable
|
||||
// as a default option, but may help Nvidia users.
|
||||
if (env::getEnvVar(L"DXVK_SHADER_OPTIMIZE") == "1") {
|
||||
if (!m_shader->optimize())
|
||||
Logger::warn(str::format("Failed to optimize: ", m_name));
|
||||
}
|
||||
|
||||
if (env::getEnvVar(L"DXVK_SHADER_VALIDATE") == "1") {
|
||||
if (!m_shader->validate())
|
||||
Logger::warn(str::format("Invalid shader: ", m_name));
|
||||
}
|
||||
|
||||
if (dumpPath.size() != 0) {
|
||||
m_shader->dump(std::ofstream(str::format(dumpPath, "/", m_name, ".spv"),
|
||||
std::ios_base::binary | std::ios_base::trunc));
|
||||
|
@ -86,16 +86,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
bool DxvkShader::optimize() {
|
||||
return m_code.optimize();
|
||||
}
|
||||
|
||||
|
||||
bool DxvkShader::validate() const {
|
||||
return m_code.validate();
|
||||
}
|
||||
|
||||
|
||||
void DxvkShader::dump(std::ostream&& outputStream) const {
|
||||
m_code.store(std::move(outputStream));
|
||||
}
|
||||
|
@ -131,18 +131,6 @@ namespace dxvk {
|
||||
return m_interface;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Optimizes SPIR-V shader code
|
||||
* \returns \c true on success
|
||||
*/
|
||||
bool optimize();
|
||||
|
||||
/**
|
||||
* \brief Validates SPIR-V shader code
|
||||
* \returns \c true if the code is valid
|
||||
*/
|
||||
bool validate() const;
|
||||
|
||||
/**
|
||||
* \brief Dumps SPIR-V shader
|
||||
*
|
||||
|
@ -5,5 +5,4 @@ spirv_src = files([
|
||||
|
||||
spirv_lib = static_library('spirv', spirv_src,
|
||||
include_directories : [ dxvk_include_path ],
|
||||
dependencies : [ lib_spirvtools, lib_spirvtools_opt ],
|
||||
override_options : ['cpp_std='+dxvk_cpp_std])
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "spirv_code_buffer.h"
|
||||
|
||||
#include <spirv-tools/libspirv.hpp>
|
||||
#include <spirv-tools/optimizer.hpp>
|
||||
|
||||
using namespace spvtools;
|
||||
|
||||
@ -133,33 +132,4 @@ namespace dxvk {
|
||||
sizeof(uint32_t) * m_code.size());
|
||||
}
|
||||
|
||||
|
||||
bool SpirvCodeBuffer::optimize() {
|
||||
Optimizer optimizer(SPV_ENV_VULKAN_1_0);
|
||||
optimizer.RegisterPass(CreateUnifyConstantPass());
|
||||
optimizer.RegisterPass(CreateInlineExhaustivePass());
|
||||
optimizer.RegisterPass(CreateEliminateDeadFunctionsPass());
|
||||
optimizer.RegisterPass(CreatePrivateToLocalPass());
|
||||
optimizer.RegisterPass(CreateScalarReplacementPass());
|
||||
optimizer.RegisterPass(CreateLocalSingleBlockLoadStoreElimPass());
|
||||
optimizer.RegisterPass(CreateLocalSingleStoreElimPass());
|
||||
optimizer.RegisterPass(CreateLocalMultiStoreElimPass());
|
||||
optimizer.RegisterPass(CreateInsertExtractElimPass());
|
||||
optimizer.RegisterPass(CreateDeadInsertElimPass());
|
||||
optimizer.RegisterPass(CreateStrengthReductionPass());
|
||||
optimizer.RegisterPass(CreateAggressiveDCEPass());
|
||||
optimizer.RegisterPass(CreateCompactIdsPass());
|
||||
|
||||
return optimizer.Run(
|
||||
m_code.data(),
|
||||
m_code.size(),
|
||||
&m_code);
|
||||
}
|
||||
|
||||
|
||||
bool SpirvCodeBuffer::validate() const {
|
||||
static const SpirvTools tools(SPV_ENV_VULKAN_1_0);
|
||||
return tools.Validate(m_code);
|
||||
}
|
||||
|
||||
}
|
@ -184,24 +184,6 @@ namespace dxvk {
|
||||
m_ptr = m_code.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Performs in-place optimization
|
||||
*
|
||||
* This requires the code buffer to
|
||||
* contain a complete SPIR-V module.
|
||||
* \returns \c true on success
|
||||
*/
|
||||
bool optimize();
|
||||
|
||||
/**
|
||||
* \brief Validates shader code
|
||||
*
|
||||
* This requires the code buffer to
|
||||
* contain a complete SPIR-V module.
|
||||
* \returns \c true if the code is valid
|
||||
*/
|
||||
bool validate() const;
|
||||
|
||||
private:
|
||||
|
||||
std::vector<uint32_t> m_code;
|
||||
|
Loading…
x
Reference in New Issue
Block a user