mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-27 04:54:15 +01:00
[dxvk] Moved some SPIR-V bits to separate directory
This commit is contained in:
parent
c1e9d3236f
commit
72a87093c5
@ -4,26 +4,8 @@ namespace dxvk {
|
||||
|
||||
DxbcCompiler::DxbcCompiler(DxbcProgramVersion version)
|
||||
: m_version(version) {
|
||||
m_spvCapabilities.enable(spv::CapabilityShader);
|
||||
|
||||
m_spvEntryPoints.setMemoryModel(
|
||||
spv::AddressingModelLogical,
|
||||
spv::MemoryModelGLSL450);
|
||||
|
||||
auto id = m_counter.nextId();
|
||||
m_spvEntryPoints.addEntryPoint(id,
|
||||
spv::ExecutionModelGLCompute,
|
||||
"main", 0, nullptr);
|
||||
m_spvEntryPoints.setLocalSize(id, 64, 1, 1);
|
||||
auto ft = m_spvTypeInfo.typeFunction(m_counter,
|
||||
m_spvTypeInfo.typeVoid(m_counter), 0, nullptr);
|
||||
m_spvCode.putIns (spv::OpFunction, 5);
|
||||
m_spvCode.putWord (m_spvTypeInfo.typeVoid(m_counter));
|
||||
m_spvCode.putWord (id);
|
||||
m_spvCode.putWord (0);
|
||||
m_spvCode.putWord (ft);
|
||||
m_spvCode.putIns (spv::OpFunctionEnd, 1);
|
||||
m_entryPointId = m_counter.nextId();
|
||||
this->declareCapabilities();
|
||||
this->declareMemoryModel();
|
||||
}
|
||||
|
||||
|
||||
@ -50,4 +32,30 @@ namespace dxvk {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
@ -43,7 +43,8 @@ namespace dxvk {
|
||||
DxbcTypeInfo m_spvTypeInfo;
|
||||
DxvkSpirvCodeBuffer m_spvCode;
|
||||
|
||||
uint32_t m_entryPointId = 0;
|
||||
void declareCapabilities();
|
||||
void declareMemoryModel();
|
||||
|
||||
};
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
#include "dxvk_include.h"
|
||||
|
||||
#include "./spirv/dxvk_spirv_code_buffer.h"
|
||||
#include "./spirv/dxvk_spirv_id_counter.h"
|
||||
#include "../spirv/spirv_code_buffer.h"
|
||||
#include "../spirv/spirv_id_counter.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
|
@ -25,8 +25,6 @@ dxvk_src = files([
|
||||
'dxvk_sync.cpp',
|
||||
'dxvk_util.cpp',
|
||||
|
||||
'spirv/dxvk_spirv_code_buffer.cpp',
|
||||
|
||||
'vulkan/dxvk_vulkan_extensions.cpp',
|
||||
'vulkan/dxvk_vulkan_loader.cpp',
|
||||
'vulkan/dxvk_vulkan_names.cpp',
|
||||
@ -35,7 +33,7 @@ dxvk_src = files([
|
||||
thread_dep = dependency('threads')
|
||||
|
||||
dxvk_lib = static_library('dxvk', dxvk_src,
|
||||
link_with : [ util_lib ],
|
||||
link_with : [ util_lib, spirv_lib ],
|
||||
dependencies : [ thread_dep, lib_vulkan, lib_sdl2 ],
|
||||
include_directories : [ dxvk_include_path ])
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
subdir('util')
|
||||
subdir('spirv')
|
||||
subdir('dxvk')
|
||||
subdir('dxgi')
|
||||
subdir('dxbc')
|
||||
|
6
src/spirv/meson.build
Normal file
6
src/spirv/meson.build
Normal file
@ -0,0 +1,6 @@
|
||||
spirv_src = files([
|
||||
'spirv_code_buffer.cpp'
|
||||
])
|
||||
|
||||
spirv_lib = static_library('spirv', spirv_src,
|
||||
include_directories : [ dxvk_include_path ])
|
@ -1,7 +1,7 @@
|
||||
#include <array>
|
||||
#include <cstring>
|
||||
|
||||
#include "dxvk_spirv_code_buffer.h"
|
||||
#include "spirv_code_buffer.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "dxvk_spirv_instruction.h"
|
||||
#include "spirv_instruction.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../dxvk_include.h"
|
||||
#include "spirv_include.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
11
src/spirv/spirv_include.h
Normal file
11
src/spirv/spirv_include.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "../util/log/log.h"
|
||||
#include "../util/log/log_debug.h"
|
||||
|
||||
#include "../util/util_error.h"
|
||||
#include "../util/util_flags.h"
|
||||
#include "../util/util_string.h"
|
||||
|
||||
#include "../util/rc/util_rc.h"
|
||||
#include "../util/rc/util_rc_ptr.h"
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <spirv/spirv.hpp>
|
||||
|
||||
#include "../dxvk_include.h"
|
||||
#include "spirv_include.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include <iterator>
|
||||
#include <fstream>
|
||||
|
||||
#include <spirv/dxvk_spirv_code_buffer.h>
|
||||
#include <dxbc_module.h>
|
||||
#include <dxvk_shader.h>
|
||||
|
||||
#include <shellapi.h>
|
||||
#include <windows.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user