@ -8,6 +8,8 @@
# include "vkr_common.h"
# include "vkr_context.h"
struct vkr_device {
struct vkr_object base ;
@ -53,4 +55,38 @@ vkr_context_init_device_dispatch(struct vkr_context *ctx);
void
vkr_device_destroy ( struct vkr_context * ctx , struct vkr_device * dev ) ;
static inline bool
vkr_device_should_track_object ( const struct vkr_object * obj )
{
assert ( vkr_is_recognized_object_type ( obj - > type ) ) ;
switch ( obj - > type ) {
case VK_OBJECT_TYPE_INSTANCE : /* non-device objects */
case VK_OBJECT_TYPE_PHYSICAL_DEVICE : /* non-device objects */
case VK_OBJECT_TYPE_DEVICE : /* device itself */
case VK_OBJECT_TYPE_QUEUE : /* not tracked as device objects */
case VK_OBJECT_TYPE_COMMAND_BUFFER : /* pool objects */
case VK_OBJECT_TYPE_DESCRIPTOR_SET : /* pool objects */
return false ;
default :
return true ;
}
}
static inline void
vkr_device_add_object ( struct vkr_context * ctx , struct vkr_object * obj )
{
assert ( vkr_device_should_track_object ( obj ) ) ;
/* TODO add to dev->objects */
vkr_context_add_object ( ctx , obj ) ;
}
static inline void
vkr_device_remove_object ( struct vkr_context * ctx , struct vkr_object * obj )
{
/* TODO remove from dev->objects */
vkr_context_remove_object ( ctx , obj ) ;
}
# endif /* VKR_DEVICE_H */