mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Merge pull request #1847 from nikeinikei/12.0-development
vulkan: fix crashes
This commit is contained in:
@@ -869,7 +869,7 @@ void Graphics::setStencilMode(StencilAction action, CompareMode compare, int val
|
||||
|
||||
if (!isRenderTargetActive() && !windowHasStencil)
|
||||
throw love::Exception("The window must have stenciling enabled to draw to the main screen's stencil buffer");
|
||||
if (isRenderTargetActive() && (rts.temporaryRTFlags & TEMPORARY_RT_STENCIL) == 0 && dsTexture == nullptr || !isPixelFormatStencil(dsTexture->getPixelFormat()))
|
||||
else if (isRenderTargetActive() && (rts.temporaryRTFlags & TEMPORARY_RT_STENCIL) == 0 && (dsTexture == nullptr || !isPixelFormatStencil(dsTexture->getPixelFormat())))
|
||||
throw love::Exception("drawing to the stencil buffer with a render target active requires either stencil=true or a custom stencil-type to be used, in setRenderTarget");
|
||||
}
|
||||
|
||||
@@ -942,6 +942,11 @@ bool Graphics::isPixelFormatSupported(PixelFormat format, uint32 usage, bool sRG
|
||||
{
|
||||
(void)sRGB; // fixme: sRGB
|
||||
|
||||
bool rendertarget = (usage & PIXELFORMATUSAGEFLAGS_RENDERTARGET) != 0;
|
||||
bool readable = (usage & PIXELFORMATUSAGEFLAGS_SAMPLE) != 0;
|
||||
|
||||
format = getSizedFormat(format, rendertarget, readable);
|
||||
|
||||
auto vulkanFormat = Vulkan::getTextureFormat(format);
|
||||
|
||||
VkFormatProperties formatProperties;
|
||||
|
||||
@@ -306,8 +306,11 @@ TextureFormat Vulkan::getTextureFormat(PixelFormat format)
|
||||
textureFormat.internalFormat = VK_FORMAT_R5G6B5_UNORM_PACK16;
|
||||
break;
|
||||
case PIXELFORMAT_RGB10A2_UNORM: // LSB->MSB: [r: g: b: a]
|
||||
textureFormat.internalFormat = VK_FORMAT_A2R10G10B10_UNORM_PACK32;
|
||||
break;
|
||||
case PIXELFORMAT_RG11B10_FLOAT: // LSB->MSB: [r: g: b]
|
||||
throw love::Exception("unimplemented pixel format (rgb10a2, rg11b10)");
|
||||
textureFormat.internalFormat = VK_FORMAT_B10G11R11_UFLOAT_PACK32;
|
||||
break;
|
||||
case PIXELFORMAT_STENCIL8:
|
||||
textureFormat.internalFormat = VK_FORMAT_S8_UINT;
|
||||
textureFormat.internalFormatRepresentation = FORMATREPRESENTATION_UINT;
|
||||
@@ -370,7 +373,8 @@ TextureFormat Vulkan::getTextureFormat(PixelFormat format)
|
||||
textureFormat.internalFormat = VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG;
|
||||
break;
|
||||
case PIXELFORMAT_ETC1_UNORM:
|
||||
throw love::Exception("unimplemented pixel format: etc1");
|
||||
textureFormat.internalFormat = VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK;
|
||||
break;
|
||||
case PIXELFORMAT_ETC2_RGB_UNORM:
|
||||
textureFormat.internalFormat = VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user