From e3c771de812c40a0b6dc2b13be3c24e17a68a969 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 13 Dec 2023 17:41:08 +0100 Subject: [PATCH] [GL] Fix issue with texture targets and multisampling If a texture with samples > 1 is to be created with a format that does not support multisampling, the effective texture target was wrong. --- .../Resources/Textures/Texture.fs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Aardvark.Rendering.GL/Resources/Textures/Texture.fs b/src/Aardvark.Rendering.GL/Resources/Textures/Texture.fs index d18b6b8f..6a1f6e2e 100644 --- a/src/Aardvark.Rendering.GL/Resources/Textures/Texture.fs +++ b/src/Aardvark.Rendering.GL/Resources/Textures/Texture.fs @@ -414,13 +414,14 @@ module TextureCreationExtensions = if Vec.anyGreater size x.MaxTextureSize then failf $"cannot create 2D texture with size {size} (maximum is {x.MaxTextureSize})" + let samples = + if samples <= 1 then 1 + else Image.validateSampleCount x ImageTarget.Texture2DMultisample format samples + let target = if samples = 1 then TextureTarget.Texture2D else TextureTarget.Texture2DMultisample - let samples = - Image.validateSampleCount x (unbox target) format samples - let h = GL.GenTexture() GL.Check "could not create texture" @@ -533,13 +534,14 @@ module TextureCreationExtensions = if count > x.MaxTextureArrayLayers then failf $"cannot create 2D array texture with {count} layers (maximum is {x.MaxTextureArrayLayers})" + let samples = + if samples <= 1 then 1 + else Image.validateSampleCount x ImageTarget.Texture2DMultisampleArray format samples + let target = if samples = 1 then TextureTarget.Texture2DArray else TextureTarget.Texture2DMultisampleArray - let samples = - Image.validateSampleCount x (unbox target) format samples - let h = GL.GenTexture() GL.Check "could not create texture"