17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 15:39:20 +02:00
Files
maszyna/betterRenderer/renderer/source/shaders_d3d12.cpp
maj00r 26501b0fd7 hoist standard includes above everything else
Ordering them before the imports in the same file was not enough: a
project header on line 1 can import a module several levels down whose
global module fragment already pulled in the same standard header, and
that include guard does not cross the module boundary. Putting them
first means the guard is set before anything can import.

Skips vendored single-header libraries and anything inside an #if.
2026-09-10 01:02:17 +02:00

33 lines
1.0 KiB
C++

#include <string>
#include <yaml-cpp/yaml.h>
#include "nvrenderer_d3d12.h"
#if LIBMANUL_WITH_D3D12
void NvRendererBackend_D3D12::LoadShaderBlobs() {
auto root = YAML::LoadFile("shaders/shaders_dxil.manul");
for (const auto entry : root["materials"]) {
std::string_view material = entry.first.as<std::string_view>();
for (const auto shader : entry.second) {
auto binary = shader.second["binary"].as<YAML::Binary>();
auto entrypoint = shader.second["entrypoint"].as<std::string>();
AddMaterialShaderBlob(
material, shader.first.as<std::string_view>(),
std::string(binary.data(), binary.data() + binary.size()),
entrypoint);
}
}
for (const auto shader : root["utility"]) {
auto binary = shader.second["binary"].as<YAML::Binary>();
auto entrypoint = shader.second["entrypoint"].as<std::string>();
AddShaderBlob(shader.first.as<std::string_view>(),
std::string(binary.data(), binary.data() + binary.size()),
entrypoint);
}
}
#endif