public static GalTextureSampler MakeSampler(NvGpu gpu, NvGpuVmm vmm, long tscPosition) { int[] tsc = ReadWords(vmm, tscPosition, 8); GalTextureWrap addressU = (GalTextureWrap)((tsc[0] >> 0) & 7); GalTextureWrap addressV = (GalTextureWrap)((tsc[0] >> 3) & 7); GalTextureWrap addressP = (GalTextureWrap)((tsc[0] >> 6) & 7); bool depthCompare = ((tsc[0] >> 9) & 1) == 1; DepthCompareFunc depthCompareFunc = (DepthCompareFunc)((tsc[0] >> 10) & 7); GalTextureFilter magFilter = (GalTextureFilter)((tsc[1] >> 0) & 3); GalTextureFilter minFilter = (GalTextureFilter)((tsc[1] >> 4) & 3); GalTextureMipFilter mipFilter = (GalTextureMipFilter)((tsc[1] >> 6) & 3); GalColorF borderColor = new GalColorF( BitConverter.Int32BitsToSingle(tsc[4]), BitConverter.Int32BitsToSingle(tsc[5]), BitConverter.Int32BitsToSingle(tsc[6]), BitConverter.Int32BitsToSingle(tsc[7])); return(new GalTextureSampler( addressU, addressV, addressP, minFilter, magFilter, mipFilter, borderColor, depthCompare, depthCompareFunc)); }
public static All GetDepthCompareFunc(DepthCompareFunc depthCompareFunc) { switch (depthCompareFunc) { case DepthCompareFunc.LEqual: return(All.Lequal); case DepthCompareFunc.GEqual: return(All.Gequal); case DepthCompareFunc.Less: return(All.Less); case DepthCompareFunc.Greater: return(All.Greater); case DepthCompareFunc.Equal: return(All.Equal); case DepthCompareFunc.NotEqual: return(All.Notequal); case DepthCompareFunc.Always: return(All.Always); case DepthCompareFunc.Never: return(All.Never); default: throw new ArgumentException(nameof(depthCompareFunc) + " \"" + depthCompareFunc + "\" is not valid!"); } }
public GalTextureSampler( GalTextureWrap addressU, GalTextureWrap addressV, GalTextureWrap addressP, GalTextureFilter minFilter, GalTextureFilter magFilter, GalTextureMipFilter mipFilter, GalColorF borderColor, bool depthCompare, DepthCompareFunc depthCompareFunc) { AddressU = addressU; AddressV = addressV; AddressP = addressP; MinFilter = minFilter; MagFilter = magFilter; MipFilter = mipFilter; BorderColor = borderColor; DepthCompare = depthCompare; DepthCompareFunc = depthCompareFunc; }