wgpu: Don't create cacheAsBitmap for textures that are too large
This commit is contained in:
parent
0ca206ce4f
commit
fd4eaef2b6
|
@ -9,6 +9,9 @@ pub enum Error {
|
|||
#[error("Bitmap texture is larger than the rendering device supports")]
|
||||
TooLarge,
|
||||
|
||||
#[error("Bitmap texture has a size of 0 and is invalid")]
|
||||
InvalidSize,
|
||||
|
||||
#[error("Unknown bitmap format")]
|
||||
UnknownType,
|
||||
|
||||
|
|
|
@ -928,6 +928,15 @@ impl<T: RenderTarget + 'static> RenderBackend for WgpuRenderBackend<T> {
|
|||
width: u32,
|
||||
height: u32,
|
||||
) -> Result<BitmapHandle, BitmapError> {
|
||||
if width == 0 || height == 0 {
|
||||
return Err(BitmapError::InvalidSize);
|
||||
}
|
||||
if width > self.descriptors.limits.max_texture_dimension_2d
|
||||
|| height > self.descriptors.limits.max_texture_dimension_2d
|
||||
{
|
||||
return Err(BitmapError::TooLarge);
|
||||
}
|
||||
|
||||
let extent = wgpu::Extent3d {
|
||||
width,
|
||||
height,
|
||||
|
|
Loading…
Reference in New Issue