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

Potential fix with texture and sampler for grid.vert

parent c9c9bfc0
No related branches found
No related tags found
1 merge request!103Added project wobble_bobble and refactored some parts of the framework
#version 450
layout(set=0, binding=0, rgba32f) readonly uniform image3D gridImage;
layout(set=0, binding=0) uniform texture3D gridImage;
layout(set=0, binding=1) uniform sampler gridSampler;
layout(location = 0) in vec2 vertexPos;
......@@ -16,7 +17,7 @@ ivec3 actual_mod(ivec3 x, ivec3 y) {
}
void main() {
ivec3 gridResolution = imageSize(gridImage);
ivec3 gridResolution = textureSize(sampler3D(gridImage, gridSampler), 0);
ivec3 gridID = ivec3(
gl_InstanceIndex,
......@@ -29,7 +30,7 @@ void main() {
vec3 position = (vec3(gridID) + vec3(0.5f)) / gridResolution;
float size = 1.0f / length(vec3(gridResolution));
vec4 gridData = imageLoad(gridImage, gridID);
vec4 gridData = texture(sampler3D(gridImage, gridSampler), position);
float mass = gridData.w;
......
......@@ -330,7 +330,8 @@ int main(int argc, const char **argv) {
{
vkcv::DescriptorWrites writes;
writes.storageImageWrites.push_back(vkcv::StorageImageDescriptorWrite(0, tmpGrid.getHandle()));
writes.sampledImageWrites.push_back(vkcv::SampledImageDescriptorWrite(0, tmpGrid.getHandle()));
writes.samplerWrites.push_back(vkcv::SamplerDescriptorWrite(1, gridSampler));
core.writeDescriptorSet(gfxSetGrid, writes);
}
......@@ -375,7 +376,6 @@ int main(int argc, const char **argv) {
gfxPipelineConfigParticles.m_VertexLayout = vertexLayoutParticles;
gfxPipelineConfigParticles.m_DescriptorLayouts = { gfxSetLayoutParticles };
gfxPipelineConfigParticles.m_UseDynamicViewport = true;
gfxPipelineConfigParticles.m_blendMode = vkcv::BlendMode::Additive;
vkcv::GraphicsPipelineHandle gfxPipelineGrid = core.createGraphicsPipeline(gfxPipelineConfigGrid);
vkcv::GraphicsPipelineHandle gfxPipelineParticles = core.createGraphicsPipeline(gfxPipelineConfigParticles);
......@@ -570,7 +570,6 @@ int main(int argc, const char **argv) {
if (renderGrid) {
core.recordBeginDebugLabel(cmdStream, "RENDER GRID", { 0.13f, 0.20f, 0.22f, 1.0f });
core.prepareImageForStorage(cmdStream, tmpGrid.getHandle());
core.recordDrawcallsToCmdStream(
cmdStream,
......
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