Skip to content
Snippets Groups Projects
Verified Commit bfeb93f8 authored by Tobias Frisch's avatar Tobias Frisch
Browse files

[#70] Fixed shader-compiler and push contants in voxelization reset

parent 924388a6
No related branches found
No related tags found
1 merge request!57Resolve "Basic voxelization"
Pipeline #25823 passed
...@@ -168,12 +168,13 @@ namespace vkcv::shader { ...@@ -168,12 +168,13 @@ namespace vkcv::shader {
} }
std::streamsize fileSize = file.tellg(); std::streamsize fileSize = file.tellg();
std::vector<char> buffer (fileSize); std::vector<char> buffer (fileSize + 1);
file.seekg(0); file.seekg(0);
file.read(buffer.data(), fileSize); file.read(buffer.data(), fileSize);
file.close(); file.close();
buffer[fileSize] = '\0';
return buffer; return buffer;
} }
......
cmd_sync_test voxelization
\ No newline at end of file \ No newline at end of file
...@@ -7,7 +7,7 @@ layout(set=0, binding=0) buffer voxelizationBuffer{ ...@@ -7,7 +7,7 @@ layout(set=0, binding=0) buffer voxelizationBuffer{
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
layout( push_constant ) uniform constants{ layout( push_constant ) uniform constants{
int voxelCount; uint voxelCount;
}; };
void main(){ void main(){
......
...@@ -59,7 +59,7 @@ vkcv::ShaderProgram loadVoxelBufferToImageShader() { ...@@ -59,7 +59,7 @@ vkcv::ShaderProgram loadVoxelBufferToImageShader() {
} }
const uint32_t voxelResolution = 128; const uint32_t voxelResolution = 128;
const size_t voxelCount = voxelResolution * voxelResolution * voxelResolution; uint32_t voxelCount = voxelResolution * voxelResolution * voxelResolution;
const vk::Format voxelizationDummyFormat = vk::Format::eR8Unorm; const vk::Format voxelizationDummyFormat = vk::Format::eR8Unorm;
Voxelization::Voxelization(vkcv::Core* corePtr, const Dependencies& dependencies) Voxelization::Voxelization(vkcv::Core* corePtr, const Dependencies& dependencies)
...@@ -225,7 +225,7 @@ void Voxelization::voxelizeMeshes( ...@@ -225,7 +225,7 @@ void Voxelization::voxelizeMeshes(
m_voxelResetPipe, m_voxelResetPipe,
resetVoxelDispatchCount, resetVoxelDispatchCount,
{ vkcv::DescriptorSetUsage(0, m_corePtr->getDescriptorSet(m_voxelResetDescriptorSet).vulkanHandle) }, { vkcv::DescriptorSetUsage(0, m_corePtr->getDescriptorSet(m_voxelResetDescriptorSet).vulkanHandle) },
vkcv::PushConstantData(nullptr, 0)); vkcv::PushConstantData(&voxelCount, sizeof(voxelCount)));
m_corePtr->recordBufferMemoryBarrier(cmdStream, m_voxelBuffer.getHandle()); m_corePtr->recordBufferMemoryBarrier(cmdStream, m_voxelBuffer.getHandle());
// voxelization // voxelization
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment