static ITextureView loadPng(IRenderDevice device, byte[] payload) { TextureLoadInfo loadInfo = new TextureLoadInfo(false); var png = new MemoryStream(payload, false); var texture = device.LoadTexture(png, eImageFileFormat.PNG, ref loadInfo, "Mouse cursor"); return(texture.GetDefaultView(TextureViewType.ShaderResource)); }
void loadTexture(IRenderDevice device, iStorageFolder assets) { // Decode the image from embedded resource of this DLL. assets.openRead("net-core-logo.png", out var png); if (null == png) { throw new ApplicationException("The texture wasn't found"); } TextureLoadInfo loadInfo = new TextureLoadInfo(false) { IsSRGB = true }; var texture = device.LoadTexture(png, eImageFileFormat.PNG, ref loadInfo, null); // Get shader resource view from the texture textureView = texture.GetDefaultView(TextureViewType.ShaderResource); // Update the ShaderResourceBinding setting the shader resource view of the newly loaded texture resourceBinding.GetVariableByName(ShaderType.Pixel, "g_Texture").Set(textureView); }