Skip to content
Permalink
Browse files

[Vulkan] CommandList: Don't use ImageView.Null in DescriptorImageInfo

  • Loading branch information
xen2 committed Sep 5, 2019
1 parent 4249625 commit b5b645029db1b29bedf1ec06d2b78bfbf5820f4c
@@ -334,7 +334,7 @@ private unsafe void PrepareDraw()
{
case DescriptorType.SampledImage:
var texture = heapObject.Value as Texture;
descriptorData->ImageInfo = new DescriptorImageInfo { ImageView = texture?.NativeImageView ?? ImageView.Null, ImageLayout = ImageLayout.ShaderReadOnlyOptimal };
descriptorData->ImageInfo = new DescriptorImageInfo { ImageView = texture?.NativeImageView ?? GraphicsDevice.EmptyTexture.NativeImageView, ImageLayout = ImageLayout.ShaderReadOnlyOptimal };
write->ImageInfo = new IntPtr(descriptorData);
break;

@@ -64,6 +64,7 @@ public partial class GraphicsDevice
};

internal Buffer EmptyTexelBuffer;
internal Texture EmptyTexture;

internal PhysicalDevice NativePhysicalDevice => Adapter.GetPhysicalDevice(IsDebugMode);

@@ -361,7 +362,9 @@ private unsafe void InitializePlatformDevice(GraphicsProfile[] graphicsProfiles,
graphicsResourceLinkCollector = new GraphicsResourceLinkCollector(this);

EmptyTexelBuffer = Buffer.Typed.New(this, 1, PixelFormat.R32G32B32A32_Float);
EmptyTexture = Texture.New2D(this, 1, 1, PixelFormat.R8G8B8A8_UNorm_SRgb, TextureFlags.ShaderResource);
}

internal unsafe IntPtr AllocateUploadBuffer(int size, out SharpVulkan.Buffer resource, out int offset)
{
// TODO D3D12 thread safety, should we simply use locks?
@@ -451,6 +454,9 @@ private unsafe void ReleaseDevice()
EmptyTexelBuffer.Dispose();
EmptyTexelBuffer = null;

EmptyTexture.Dispose();
EmptyTexture = null;

// Wait for all queues to be idle
nativeDevice.WaitIdle();

0 comments on commit b5b6450

Please sign in to comment.
You can’t perform that action at this time.