mirror of
https://github.com/PancakeTAS/lsfg-vk.git
synced 2026-02-20 20:51:03 +00:00
get rid of d3d11 device
hopefully fixing steam deck compat while also not breaking anything
This commit is contained in:
parent
9611a70ff9
commit
ccf71234c1
15 changed files with 99 additions and 164 deletions
|
|
@ -52,13 +52,11 @@ target_compile_options(lsfg-vk PRIVATE
|
|||
-Wno-global-constructors # allow globals
|
||||
# required for vulkan
|
||||
-Wno-cast-function-type-strict
|
||||
# required for dxvk (yeah don't worry about it)
|
||||
-Qunused-arguments -Wl,--unresolved-symbols=ignore-all
|
||||
)
|
||||
|
||||
install(FILES "${CMAKE_BINARY_DIR}/peparse/src/peparse_git/pe-parser-library/build/libpe-parse.so" DESTINATION lib)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/dxvk/native/usr/lib/libdxvk_d3d11.so.0.20602" DESTINATION lib RENAME libdxvk_d3d11.so.0)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/dxvk/native/usr/lib/libdxvk_dxgi.so.0.20602" DESTINATION lib RENAME libdxvk_dxgi.so.0)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/dxvk/libdxvkinternals.so" DESTINATION lib)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/dxvk/libdxbc.so" DESTINATION lib)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/liblsfg-vk.so" DESTINATION lib)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/lsfg-vk-gen/liblsfg-vk-gen.so" DESTINATION lib)
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ ExternalProject_Add(dxvk_git
|
|||
USES_TERMINAL_BUILD true
|
||||
CONFIGURE_COMMAND
|
||||
cd ${CMAKE_BINARY_DIR}/dxvk/src/dxvk_git &&
|
||||
sed -i s/private://
|
||||
src/dxvk/dxvk_device.h &&
|
||||
sed -i s/private://g
|
||||
src/dxvk/dxvk_shader.h &&
|
||||
CFLAGS=-w CXXFLAGS=-w CC=clang CXX=clang++ meson setup
|
||||
--buildtype "release"
|
||||
--prefix "${CMAKE_BINARY_DIR}/dxvk/native/usr"
|
||||
|
|
@ -24,7 +24,7 @@ ExternalProject_Add(dxvk_git
|
|||
BUILD_COMMAND
|
||||
cd ${CMAKE_BINARY_DIR}/dxvk &&
|
||||
ninja -C build install && # sorry cursed lol
|
||||
echo "clang -shared -o libdxvkinternals.so $(find build/src/{dxbc,wsi,vulkan,dxvk,dxgi,spirv,util}/*.p -type f -name \\*.o)" > archive.sh &&
|
||||
echo "clang -shared -o libdxbc.so $(find build/src/{dxbc,dxvk,dxgi,spirv,util}/*.p -type f -name \\*.o)" > archive.sh &&
|
||||
bash archive.sh
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
|
|
@ -33,14 +33,13 @@ add_library(dxvk INTERFACE)
|
|||
add_dependencies(dxvk dxvk_git)
|
||||
|
||||
target_link_directories(dxvk
|
||||
INTERFACE ${CMAKE_BINARY_DIR}/dxvk/native/usr/lib
|
||||
INTERFACE ${CMAKE_BINARY_DIR}/dxvk)
|
||||
target_include_directories(dxvk SYSTEM
|
||||
INTERFACE ${CMAKE_BINARY_DIR}/dxvk/native/usr/include/dxvk
|
||||
INTERFACE ${CMAKE_BINARY_DIR}/dxvk/src/dxvk_git/src
|
||||
INTERFACE ${CMAKE_BINARY_DIR}/dxvk/src/dxvk_git/include/spirv/include)
|
||||
target_link_libraries(dxvk INTERFACE
|
||||
dxvk_d3d11 dxvk_dxgi display-info dxvkinternals)
|
||||
dxbc)
|
||||
|
||||
# pe-parse subproject
|
||||
|
||||
|
|
@ -115,6 +114,4 @@ target_compile_options(lsfg-vk-gen PRIVATE
|
|||
-Wno-cast-function-type-strict
|
||||
# required for peparse
|
||||
-Wno-unused-template
|
||||
# required for dxvk (yeah don't worry about it)
|
||||
-Qunused-arguments -Wl,--unresolved-symbols=ignore-all1
|
||||
)
|
||||
|
|
|
|||
|
|
@ -48,37 +48,14 @@ namespace LSFG::Pool {
|
|||
};
|
||||
|
||||
///
|
||||
/// DirectX bytecode translator class.
|
||||
/// Translate DXBC into SPIR-V.
|
||||
///
|
||||
class Translator {
|
||||
public:
|
||||
///
|
||||
/// Create a new translator.
|
||||
///
|
||||
/// @throws std::runtime_error if the initialization fails.
|
||||
///
|
||||
Translator();
|
||||
|
||||
///
|
||||
/// Translate DXBC into SPIR-V.
|
||||
///
|
||||
/// @param dxbc Bytecode to translate.
|
||||
/// @return Translated SPIR-V bytecode.
|
||||
///
|
||||
/// @throws std::runtime_error if the translation fails.
|
||||
///
|
||||
[[nodiscard]] std::vector<uint8_t> translate(const std::vector<uint8_t>& dxbc) const;
|
||||
|
||||
// Trivially copyable, moveable and destructible
|
||||
Translator(const Translator&) = delete;
|
||||
Translator& operator=(const Translator&) = delete;
|
||||
Translator(Translator&&) = default;
|
||||
Translator& operator=(Translator&&) = default;
|
||||
~Translator() = default;
|
||||
private:
|
||||
std::shared_ptr<ID3D11Device*> device;
|
||||
std::shared_ptr<ID3D11DeviceContext*> context;
|
||||
};
|
||||
/// @param dxbc Bytecode to translate.
|
||||
/// @return Translated SPIR-V bytecode.
|
||||
///
|
||||
/// @throws std::runtime_error if the translation fails.
|
||||
///
|
||||
[[nodiscard]] std::vector<uint8_t> dxbcToSpirv(const std::vector<uint8_t>& dxbc);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "core/device.hpp"
|
||||
#include "core/shadermodule.hpp"
|
||||
#include "pool/extract.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
|
@ -23,7 +24,7 @@ namespace LSFG::Pool {
|
|||
///
|
||||
/// @throws std::runtime_error if the shader pool cannot be created.
|
||||
///
|
||||
ShaderPool(const std::string& path);
|
||||
ShaderPool(const std::string& path) : extractor(path) {}
|
||||
|
||||
///
|
||||
/// Retrieve a shader module by name or create it.
|
||||
|
|
@ -39,7 +40,7 @@ namespace LSFG::Pool {
|
|||
const Core::Device& device, const std::string& name,
|
||||
const std::vector<std::pair<size_t, VkDescriptorType>>& types);
|
||||
private:
|
||||
std::unordered_map<std::string, std::vector<uint8_t>> shaderBytecodes;
|
||||
Extractor extractor;
|
||||
std::unordered_map<std::string, Core::ShaderModule> shaders;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "pool/extract.hpp"
|
||||
|
||||
#include <d3d11/d3d11_device.h>
|
||||
#include <d3d11.h>
|
||||
#include <dxbc/dxbc_modinfo.h>
|
||||
#include <dxbc/dxbc_module.h>
|
||||
#include <dxbc/dxbc_reader.h>
|
||||
#include <dxvk/dxvk_compute.h>
|
||||
#include <dxvk/dxvk_context.h>
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
using namespace LSFG;
|
||||
using namespace LSFG::Pool;
|
||||
|
||||
namespace {
|
||||
|
|
@ -64,64 +65,33 @@ std::vector<uint8_t> Extractor::getResource(const std::string& hash) const {
|
|||
throw std::runtime_error("Resource not found: " + hash);
|
||||
}
|
||||
|
||||
Translator::Translator() {
|
||||
setenv("DXVK_WSI_DRIVER", "SDL3", 0);
|
||||
setenv("DXVK_LOG_LEVEL", "error", 0);
|
||||
setenv("DXVK_LOG_PATH", "none", 0);
|
||||
std::vector<uint8_t> Pool::dxbcToSpirv(const std::vector<uint8_t>& dxbc) {
|
||||
// create sha1 hash of the dxbc data
|
||||
std::array<uint8_t, SHA_DIGEST_LENGTH> hash{};
|
||||
SHA1(dxbc.data(), dxbc.size(), hash.data());
|
||||
std::stringstream ss;
|
||||
for (const auto& byte : hash)
|
||||
ss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(byte);
|
||||
const std::string hash_str = ss.str();
|
||||
|
||||
// create d3d11 device
|
||||
ID3D11Device* device{};
|
||||
ID3D11DeviceContext* context{};
|
||||
const D3D_FEATURE_LEVEL featureLevel = D3D_FEATURE_LEVEL_11_1;
|
||||
D3D11CreateDevice(
|
||||
nullptr,
|
||||
D3D_DRIVER_TYPE::D3D_DRIVER_TYPE_HARDWARE,
|
||||
nullptr,
|
||||
0,
|
||||
&featureLevel, 1,
|
||||
D3D11_SDK_VERSION,
|
||||
&device, nullptr, &context
|
||||
);
|
||||
if (!device || !context)
|
||||
throw std::runtime_error("Failed to create D3D11 device");
|
||||
|
||||
// store device in shared ptr
|
||||
this->device = std::shared_ptr<ID3D11Device*>(
|
||||
new ID3D11Device*(device),
|
||||
[](ID3D11Device** dev) {
|
||||
(*dev)->Release();
|
||||
}
|
||||
);
|
||||
this->context = std::shared_ptr<ID3D11DeviceContext*>(
|
||||
new ID3D11DeviceContext*(context),
|
||||
[](ID3D11DeviceContext** ctx) {
|
||||
(*ctx)->Release();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
std::vector<uint8_t> Translator::translate(const std::vector<uint8_t>& dxbc) const {
|
||||
// create compute shader and pipeline
|
||||
ID3D11ComputeShader* shader = nullptr;
|
||||
(*this->device)->CreateComputeShader(dxbc.data(), dxbc.size(), nullptr, &shader);
|
||||
if (!shader)
|
||||
throw std::runtime_error("Failed to create compute shader from DXBC");
|
||||
|
||||
auto* dxvk_shader = reinterpret_cast<dxvk::D3D11ComputeShader*>(shader);
|
||||
auto* dxvk_device = reinterpret_cast<dxvk::D3D11Device*>(*this->device);
|
||||
|
||||
auto* pipeline = dxvk_device->GetDXVKDevice()->m_objects.pipelineManager().createComputePipeline({
|
||||
.cs = dxvk_shader->GetCommonShader()->GetShader()
|
||||
});
|
||||
// compile the shader
|
||||
dxvk::DxbcReader reader(reinterpret_cast<const char*>(dxbc.data()), dxbc.size());
|
||||
dxvk::DxbcModule module(reader);
|
||||
const dxvk::DxbcModuleInfo info{};
|
||||
auto shader = module.compile(info, "CS_" + hash_str);
|
||||
|
||||
// extract spir-v from d3d11 shader
|
||||
auto code = dxvk_shader->GetCommonShader()->GetShader()->getCode(
|
||||
pipeline->getBindings(), dxvk::DxvkShaderModuleCreateInfo());
|
||||
auto code = shader->getRawCode();
|
||||
|
||||
// patch binding offsets
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
|
||||
for (size_t i = 0; i < shader->m_bindingOffsets.size(); i++)
|
||||
code.data()[shader->m_bindingOffsets.at(i).bindingOffset] = static_cast<uint8_t>(i); // NOLINT
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
std::vector<uint8_t> spirv(code.size());
|
||||
std::copy_n(reinterpret_cast<uint8_t*>(code.data()),
|
||||
code.size(), spirv.data());
|
||||
|
||||
// cleanup-ish (i think the pipeline will linger)
|
||||
shader->Release();
|
||||
return spirv;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,23 +40,6 @@ const std::unordered_map<std::string, std::string> SHADERS = {
|
|||
{ "zeta/4.spv", "lHYgyCpWnMIB74HL22BKQyoqUGvUjgR79W4vXFXzXe4=" }
|
||||
};
|
||||
|
||||
ShaderPool::ShaderPool(const std::string& path) {
|
||||
const Extractor extractor(path);
|
||||
const Translator translator;
|
||||
|
||||
for (const auto& [name, hash] : SHADERS) {
|
||||
auto data = extractor.getResource(hash);
|
||||
if (data.empty())
|
||||
throw std::runtime_error("Shader code is empty: " + name);
|
||||
|
||||
auto code = translator.translate(data);
|
||||
if (code.empty())
|
||||
throw std::runtime_error("Shader code translation failed: " + name);
|
||||
|
||||
shaderBytecodes[name] = std::move(code);
|
||||
}
|
||||
}
|
||||
|
||||
Core::ShaderModule ShaderPool::getShader(
|
||||
const Core::Device& device, const std::string& name,
|
||||
const std::vector<std::pair<size_t, VkDescriptorType>>& types) {
|
||||
|
|
@ -64,13 +47,22 @@ Core::ShaderModule ShaderPool::getShader(
|
|||
if (it != shaders.end())
|
||||
return it->second;
|
||||
|
||||
// create the shader module
|
||||
auto cit = shaderBytecodes.find(name);
|
||||
if (cit == shaderBytecodes.end())
|
||||
throw std::runtime_error("Shader code translation failed: " + name);
|
||||
auto code = cit->second;
|
||||
// grab the shader
|
||||
auto hit = SHADERS.find(name);
|
||||
if (hit == SHADERS.end())
|
||||
throw std::runtime_error("Shader not found: " + name);
|
||||
auto hash = hit->second;
|
||||
|
||||
Core::ShaderModule shader(device, code, types);
|
||||
auto dxbc = this->extractor.getResource(hash);
|
||||
if (dxbc.empty())
|
||||
throw std::runtime_error("Shader code is empty: " + name);
|
||||
|
||||
// create the translated shader module
|
||||
auto spirv = dxbcToSpirv(dxbc);
|
||||
if (spirv.empty())
|
||||
throw std::runtime_error("Shader code translation failed: " + name);
|
||||
|
||||
Core::ShaderModule shader(device, spirv, types);
|
||||
shaders[name] = shader;
|
||||
return shader;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,10 +30,10 @@ Beta::Beta(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
shaderpool.getShader(device, "beta/4.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 6, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } })
|
||||
{ 6, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } })
|
||||
}};
|
||||
for (size_t i = 0; i < 5; i++) {
|
||||
this->pipelines.at(i) = Core::Pipeline(device,
|
||||
|
|
@ -115,10 +115,10 @@ Beta::Beta(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
.build();
|
||||
for (size_t i = 0; i < genc; i++) {
|
||||
this->nDescriptorSets.at(i).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i))
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs2)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->outImgs)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ Delta::Delta(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
shaderpool.getShader(device, "delta/3.spv",
|
||||
{ { 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 3, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } })
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } })
|
||||
}};
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
this->pipelines.at(i) = Core::Pipeline(device,
|
||||
|
|
@ -84,12 +84,12 @@ Delta::Delta(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
.build();
|
||||
for (size_t i = 0; i < genc; i++) {
|
||||
this->nDescriptorSets.at(i).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i))
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampEdge)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->optImg)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->outImg)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ Downsample::Downsample(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
: inImg_0(std::move(inImg_0)),
|
||||
inImg_1(std::move(inImg_1)) {
|
||||
this->shaderModule = shaderpool.getShader(device, "downsample.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 7, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } });
|
||||
{ 7, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } });
|
||||
this->pipeline = Core::Pipeline(device, this->shaderModule);
|
||||
for (size_t i = 0; i < 2; i++)
|
||||
this->descriptorSets.at(i) = Core::DescriptorSet(device, pool, this->shaderModule);
|
||||
|
|
@ -33,10 +33,10 @@ Downsample::Downsample(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
for (size_t fc = 0; fc < 2; fc++) {
|
||||
auto& inImg = (fc % 2 == 0) ? this->inImg_0 : this->inImg_1;
|
||||
this->descriptorSets.at(fc).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, inImg)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->outImgs)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ Epsilon::Epsilon(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
{ 4, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 4, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
shaderpool.getShader(device, "epsilon/3.spv",
|
||||
{ { 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 6, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } })
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } })
|
||||
}};
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
this->pipelines.at(i) = Core::Pipeline(device,
|
||||
|
|
@ -85,13 +85,13 @@ Epsilon::Epsilon(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
.build();
|
||||
for (size_t i = 0; i < genc; i++) {
|
||||
this->nDescriptorSets.at(i).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i))
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampEdge)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->optImg)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImg2)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->outImg)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ Extract::Extract(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
: inImg1(std::move(inImg1)),
|
||||
inImg2(std::move(inImg2)) {
|
||||
this->shaderModule = shaderpool.getShader(device, "extract.spv",
|
||||
{ { 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 3, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } });
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } });
|
||||
this->pipeline = Core::Pipeline(device, this->shaderModule);
|
||||
for (size_t i = 0; i < genc; i++)
|
||||
this->nDescriptorSets.emplace_back(device, pool,
|
||||
|
|
@ -40,13 +40,13 @@ Extract::Extract(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
|
||||
for (size_t i = 0; i < genc; i++) {
|
||||
this->nDescriptorSets.at(i).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i))
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampEdge)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->whiteImg)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImg1)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImg2)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->outImg)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ Gamma::Gamma(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
optImg2(std::move(optImg2)) {
|
||||
this->shaderModules = {{
|
||||
shaderpool.getShader(device, "gamma/0.spv",
|
||||
{ { 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 10, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 3, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
{ 3, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
shaderpool.getShader(device, "gamma/1.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 3, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
|
|
@ -37,15 +37,15 @@ Gamma::Gamma(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
{ 4, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 4, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
shaderpool.getShader(device, "gamma/4.spv",
|
||||
{ { 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 6, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
shaderpool.getShader(device, "gamma/5.spv",
|
||||
{ { 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } })
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } })
|
||||
}};
|
||||
for (size_t i = 0; i < 6; i++) {
|
||||
this->pipelines.at(i) = Core::Pipeline(device,
|
||||
|
|
@ -122,6 +122,7 @@ Gamma::Gamma(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
}
|
||||
for (size_t i = 0; i < genc; i++) {
|
||||
this->nSpecialDescriptorSets.at(i).at(fc).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i))
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampEdge)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, *prevImgs1)
|
||||
|
|
@ -131,7 +132,6 @@ Gamma::Gamma(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs1.at(0))
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs1.at(1))
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs1.at(2))
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
@ -154,21 +154,21 @@ Gamma::Gamma(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
.build();
|
||||
for (size_t i = 0; i < genc; i++) {
|
||||
this->n1DescriptorSets.at(i).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i))
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampEdge)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs2)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->optImg2)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImg2)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->outImg1)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i))
|
||||
.build();
|
||||
this->n2DescriptorSets.at(i).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i))
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampEdge)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->whiteImg)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->outImg1)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->outImg2)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ Magic::Magic(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
inImg2(std::move(inImg2)), inImg3(std::move(inImg3)),
|
||||
optImg(std::move(optImg)) {
|
||||
this->shaderModule = shaderpool.getShader(device, "magic.spv",
|
||||
{ { 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 4+4+2+1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 3+3+2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } });
|
||||
{ 3+3+2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } });
|
||||
this->pipeline = Core::Pipeline(device, this->shaderModule);
|
||||
for (size_t i = 0; i < genc; i++) {
|
||||
this->nDescriptorSets.emplace_back();
|
||||
|
|
@ -68,6 +68,7 @@ Magic::Magic(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
}
|
||||
for (size_t i = 0; i < genc; i++) {
|
||||
this->nDescriptorSets.at(i).at(fc).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i))
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampEdge)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, *prevImgs1)
|
||||
|
|
@ -78,7 +79,6 @@ Magic::Magic(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->outImgs3)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->outImgs2)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->outImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ Merge::Merge(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
inImg4(std::move(inImg4)),
|
||||
inImg5(std::move(inImg5)) {
|
||||
this->shaderModule = shaderpool.getShader(device, "merge.spv",
|
||||
{ { 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 5, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } });
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } });
|
||||
this->pipeline = Core::Pipeline(device, this->shaderModule);
|
||||
for (size_t i = 0; i < genc; i++) {
|
||||
this->nDescriptorSets.emplace_back();
|
||||
|
|
@ -47,6 +47,7 @@ Merge::Merge(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
for (size_t fc = 0; fc < 2; fc++) {
|
||||
for (size_t i = 0; i < genc; i++) {
|
||||
this->nDescriptorSets.at(i).at(fc).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i))
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampEdge)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, (fc % 2 == 0) ? this->inImg1 : this->inImg2)
|
||||
|
|
@ -55,7 +56,6 @@ Merge::Merge(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImg4)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImg5)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->outImgs.at(i))
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ Zeta::Zeta(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
{ 4, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 4, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
shaderpool.getShader(device, "zeta/3.spv",
|
||||
{ { 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 6, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } })
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } })
|
||||
}};
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
this->pipelines.at(i) = Core::Pipeline(device,
|
||||
|
|
@ -85,13 +85,13 @@ Zeta::Zeta(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
|||
.build();
|
||||
for (size_t i = 0; i < genc; i++) {
|
||||
this->nDescriptorSets.at(i).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i) )
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampEdge)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImg2)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImg3)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->outImg)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffers.at(i) )
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue