-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathVulkanRTShader.cpp
36 lines (31 loc) · 1018 Bytes
/
VulkanRTShader.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/******************************************************************************
This file is part of the Newcastle Vulkan Tutorial Series
Author:Rich Davison
Contact:richgdavison@gmail.com
License: MIT (see LICENSE file at the top of the source tree)
*//////////////////////////////////////////////////////////////////////////////
#include "VulkanRTShader.h"
#include "Assets.h"
using namespace NCL;
using namespace Rendering;
using namespace Vulkan;
VulkanRTShader::VulkanRTShader(const std::string& filename, vk::Device device) {
char* data;
size_t dataSize = 0;
Assets::ReadBinaryFile(Assets::SHADERDIR + "VK/" + filename, &data, dataSize);
if (dataSize > 0) {
shaderModule = device.createShaderModuleUnique(
{
.flags = {},
.codeSize = dataSize,
.pCode = (uint32_t*)data
}
);
}
else {
std::cout << __FUNCTION__ << " Problem loading shader file " << filename << "!\n";
}
AddReflectionData(dataSize, data, vk::ShaderStageFlagBits::eCompute);
BuildLayouts(device);
delete data;
}