Skip to content

Commit fc8d8c7

Browse files
[Rendering] Fixes to flickering;
1 parent 5e04be7 commit fc8d8c7

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

Engine/Staple.Core/Rendering/RenderSystem/Backend/Impls/SDLGPU/Commands/SDLGPUUpdateIndexBufferCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void Update(IRendererBackend rendererBackend)
3131
buffer.buffer = nint.Zero;
3232
}
3333

34-
var usageFlags = SDL.SDL_GPUBufferUsageFlags.SDL_GPU_BUFFERUSAGE_VERTEX;
34+
var usageFlags = SDL.SDL_GPUBufferUsageFlags.SDL_GPU_BUFFERUSAGE_INDEX;
3535

3636
if (buffer.flags.HasFlag(RenderBufferFlags.GraphicsRead))
3737
{
@@ -95,7 +95,7 @@ public void Update(IRendererBackend rendererBackend)
9595
return;
9696
}
9797

98-
var mapData = SDL.SDL_MapGPUTransferBuffer(backend.device, buffer.transferBuffer, true);
98+
var mapData = SDL.SDL_MapGPUTransferBuffer(backend.device, buffer.transferBuffer, false);
9999

100100
unsafe
101101
{
@@ -122,6 +122,6 @@ public void Update(IRendererBackend rendererBackend)
122122
size = (uint)data.Length,
123123
};
124124

125-
SDL.SDL_UploadToGPUBuffer(backend.copyPass, in location, in region, true);
125+
SDL.SDL_UploadToGPUBuffer(backend.copyPass, in location, in region, false);
126126
}
127127
}

Engine/Staple.Core/Rendering/RenderSystem/Backend/Impls/SDLGPU/Commands/SDLGPUUpdateTextureCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,6 @@ public void Update(IRendererBackend rendererBackend)
8282
d = 1,
8383
};
8484

85-
SDL.SDL_UploadToGPUTexture(backend.copyPass, in textureInfo, in destination, true);
85+
SDL.SDL_UploadToGPUTexture(backend.copyPass, in textureInfo, in destination, false);
8686
}
8787
}

Engine/Staple.Core/Rendering/RenderSystem/Backend/Impls/SDLGPU/Commands/SDLGPUUpdateVertexBufferCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public void Update(IRendererBackend rendererBackend)
9595
return;
9696
}
9797

98-
var mapData = SDL.SDL_MapGPUTransferBuffer(backend.device, buffer.transferBuffer, true);
98+
var mapData = SDL.SDL_MapGPUTransferBuffer(backend.device, buffer.transferBuffer, false);
9999

100100
unsafe
101101
{
@@ -122,6 +122,6 @@ public void Update(IRendererBackend rendererBackend)
122122
size = (uint)data.Length,
123123
};
124124

125-
SDL.SDL_UploadToGPUBuffer(backend.copyPass, in location, in region, true);
125+
SDL.SDL_UploadToGPUBuffer(backend.copyPass, in location, in region, false);
126126
}
127127
}

Engine/Staple.Core/Rendering/RenderSystem/Backend/Impls/SDLGPU/SDLGPURendererBackend.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,11 @@ public void Destroy()
290290
ReleaseBufferResource(resource);
291291
}
292292

293+
foreach(var resource in textures)
294+
{
295+
ReleaseTextureResource(resource);
296+
}
297+
293298
depthTexture?.Destroy();
294299

295300
depthTexture = null;

0 commit comments

Comments
 (0)