1
0
Fork 0
forked from wry/wry

all: use trait upcasting

This commit is contained in:
Julian Orth 2025-04-03 16:47:24 +02:00
parent f0caafc862
commit 09e5f89174
44 changed files with 90 additions and 269 deletions

View file

@ -60,6 +60,7 @@ use {
jay_algorithms::rect::Tag,
linearize::{Linearize, LinearizeExt, StaticMap, static_map},
std::{
any::Any,
borrow::Cow,
cell::{Cell, RefCell},
collections::hash_map::Entry,
@ -1967,8 +1968,7 @@ impl VulkanImage {
impl dyn GfxTexture {
fn as_vk(&self, device: &Device) -> &VulkanImage {
let img: &VulkanImage = self
.as_any()
let img: &VulkanImage = (self as &dyn Any)
.downcast_ref()
.expect("Non-vulkan texture passed into vulkan");
img.assert_device(device);
@ -1976,8 +1976,7 @@ impl dyn GfxTexture {
}
pub(super) fn into_vk(self: Rc<Self>, device: &Device) -> Rc<VulkanImage> {
let img: Rc<VulkanImage> = self
.into_any()
let img: Rc<VulkanImage> = (self as Rc<dyn Any>)
.downcast()
.expect("Non-vulkan texture passed into vulkan");
img.assert_device(device);
@ -1987,8 +1986,7 @@ impl dyn GfxTexture {
impl dyn GfxBlendBuffer {
pub(super) fn into_vk(self: Rc<Self>, device: &Device) -> Rc<VulkanImage> {
let img: Rc<VulkanImage> = self
.into_any()
let img: Rc<VulkanImage> = (self as Rc<dyn Any>)
.downcast()
.expect("Non-vulkan blend buffer passed into vulkan");
img.assert_device(device);