public void SurfaceFactory_CreatesSurfaceSucceeds_ComponentsAreNotNullAndTypeIsCorrect() { var messenger = Substitute.For <IFrameworkMessenger>(); var components = new FakeComponents(); IGpuSurfaceFactory factory = new GpuSurfaceFactory(messenger, components); var surface = factory.CreateGpuSurface(true, 100, 100, Veldrid.PixelFormat.R32_G32_B32_A32_Float, false, SamplerType.Anisotropic, 1, false); Assert.Equal(GpuSurfaceType.RenderTarget | GpuSurfaceType.Internal, surface.Type); Assert.NotNull(surface.Texture); Assert.NotNull(surface.TextureView); Assert.NotNull(surface.ResourceSet_TexMirror); Assert.NotNull(surface.ResourceSet_TexWrap); components.ReleaseResources(); }
public void SurfaceFactory_CreatesSurfaceFromTextureSucceeds_ComponentsAreNotNull() { var messenger = Substitute.For <IFrameworkMessenger>(); var components = new FakeComponents(); IGpuSurfaceFactory factory = new GpuSurfaceFactory(messenger, components); Veldrid.Texture texture = components.Factory.CreateTexture(new Veldrid.TextureDescription { Width = 64, Height = 64, ArrayLayers = 1, Depth = 1, Format = Veldrid.PixelFormat.R32_G32_B32_A32_Float, MipLevels = 1, SampleCount = Veldrid.TextureSampleCount.Count1, Type = Veldrid.TextureType.Texture2D, Usage = Veldrid.TextureUsage.Sampled }); var surface = factory.CreateGpuSurfaceFromTexture(texture, false, false, SamplerType.Anisotropic); Assert.Equal(texture, surface.Texture); Assert.NotNull(surface.TextureView); Assert.NotNull(surface.ResourceSet_TexMirror); Assert.NotNull(surface.ResourceSet_TexWrap); components.ReleaseResources(); }