protected override void SetTextureConstant(int index, IBaseTexture texture, bool linearSampling) { var tex = texture as ITexture2D; if (tex == null) { throw new NotSupportedException("Only 2D textures are supported in OpenCL"); } Shader.SetInputTextureArg(index, tex, false); }
protected override void SetTextureConstant(int index, IBaseTexture texture, bool linearSampling) { if (texture is ITexture2D) { var tex = (ITexture2D)texture; Shader.SetTextureConstant(index, tex, linearSampling, false); } else { var tex = (ITexture3D)texture; Shader.SetTextureConstant(index, tex, linearSampling, false); } }
public static TextureSize GetSize(this IBaseTexture texture) { if (texture is ITexture2D) { var t = (ITexture2D)texture; return(new TextureSize(t.Width, t.Height)); } if (texture is ITexture3D) { var t = (ITexture3D)texture; return(new TextureSize(t.Width, t.Height, t.Depth)); } throw new ArgumentException("Invalid texture type"); }
public static TextureSize GetSize(this IBaseTexture texture) { if (texture == null) { throw new NullReferenceException("GetSize() is called on a null texture"); } if (texture is ITexture2D) { var t = (ITexture2D)texture; return(new TextureSize(t.Width, t.Height)); } if (texture is ITexture3D) { var t = (ITexture3D)texture; return(new TextureSize(t.Width, t.Height, t.Depth)); } throw new ArgumentException("Invalid texture type"); }
protected abstract void SetTextureConstant(int index, IBaseTexture texture, bool linearSampling);