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

Used 16bit floats for grid format

parent 0958f9a2
No related branches found
No related tags found
1 merge request!103Added project wobble_bobble and refactored some parts of the framework
...@@ -62,17 +62,6 @@ float cube_radius(float volume) { ...@@ -62,17 +62,6 @@ float cube_radius(float volume) {
return pow(volume / 8.0f, 1.0f / 3.0f); return pow(volume / 8.0f, 1.0f / 3.0f);
} }
float simulationMass(float density, float size, int form) {
switch (form) {
case SIM_FORM_SPHERE:
return density * sphere_volume(size);
case SIM_FORM_CUBE:
return density * cube_volume(size);
default:
return 0.0f;
}
}
float weight_A(float x) { float weight_A(float x) {
return max(1.0f - x, 0.0f); return max(1.0f - x, 0.0f);
} }
......
...@@ -13,7 +13,7 @@ layout(set=0, binding=1) uniform simulationBlock { ...@@ -13,7 +13,7 @@ layout(set=0, binding=1) uniform simulationBlock {
Simulation simulation; Simulation simulation;
}; };
layout(set=0, binding=2, rgba32f) restrict writeonly uniform image3D gridImage; layout(set=0, binding=2, rgba16f) restrict writeonly uniform image3D gridImage;
layout( push_constant ) uniform constants { layout( push_constant ) uniform constants {
float t; float t;
......
...@@ -308,7 +308,7 @@ int main(int argc, const char **argv) { ...@@ -308,7 +308,7 @@ int main(int argc, const char **argv) {
); );
vkcv::Image grid = core.createImage( vkcv::Image grid = core.createImage(
vk::Format::eR32G32B32A32Sfloat, vk::Format::eR16G16B16A16Sfloat,
64, 64,
64, 64,
64, 64,
...@@ -316,14 +316,6 @@ int main(int argc, const char **argv) { ...@@ -316,14 +316,6 @@ int main(int argc, const char **argv) {
true true
); );
std::vector<glm::vec4> grid_vec (grid.getWidth() * grid.getHeight() * grid.getDepth());
for (size_t i = 0; i < grid_vec.size(); i++) {
grid_vec[i] = glm::vec4(0.0f);
}
grid.fill(grid_vec.data());
vkcv::SamplerHandle gridSampler = core.createSampler( vkcv::SamplerHandle gridSampler = core.createSampler(
vkcv::SamplerFilterType::LINEAR, vkcv::SamplerFilterType::LINEAR,
vkcv::SamplerFilterType::LINEAR, vkcv::SamplerFilterType::LINEAR,
......
...@@ -353,6 +353,8 @@ namespace vkcv { ...@@ -353,6 +353,8 @@ namespace vkcv {
return 4; return 4;
case vk::Format::eR8G8B8A8Unorm: case vk::Format::eR8G8B8A8Unorm:
return 4; return 4;
case vk::Format::eR16G16B16A16Sfloat:
return 8;
case vk::Format::eR32G32B32A32Sfloat: case vk::Format::eR32G32B32A32Sfloat:
return 16; return 16;
default: default:
......
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