veldrid / veldrid

A low-level, portable graphics library for .NET.
https://veldrid.dev/
MIT License
2.5k stars 272 forks source link

CreateBuffer being public and not overridable undermines DisposableResourceCollector #59

Closed geoeo closed 6 years ago

geoeo commented 6 years ago

By making this method public and non-overridable it obfuscates the interface to resource generation. It is too easy to accidentally create an object of type DeviceBuffer through CreateBuffer rather than CreateBufferCore when using the DeviceResourceCollector.

https://github.com/mellinoe/veldrid/blob/d5122453394665e446c95b4ebed5eba93c575af4/src/Veldrid/ResourceFactory.cs#L151

mellinoe commented 6 years ago

Could you clarify what the issue is about? Is the problem that the validation logic will run twice in DisposeCollectorResourceFactory?

geoeo commented 6 years ago

Nevermind. I should read the source more carefully. Just ignore my issue