public static Type GetTypeFromParameterType(EShaderParameterType type) { switch (type) { case EShaderParameterType.Scalar: return(typeof(float)); case EShaderParameterType.Vector: return(typeof(Vector3)); case EShaderParameterType.Color: return(typeof(Color4)); case EShaderParameterType.Matrix: return(typeof(Matrix)); } return(null); }
public static int GetSizeFromParameterType(EShaderParameterType type) { switch (type) { case EShaderParameterType.Scalar: return(4); case EShaderParameterType.Vector: return(Vector3.SizeInBytes); case EShaderParameterType.Color: return(SharpDX.Utilities.SizeOf <Color4>()); case EShaderParameterType.Matrix: return(Matrix.SizeInBytes); case EShaderParameterType.Texture: return(-1); } return(-1); }
public void AddParameterTarget(SHashedName name, EShaderParameterType type) { SShaderParameterTarget newParameterTarget; newParameterTarget.parameterName = name; newParameterTarget.parameterType = type; int sizeInBytes = ShaderHelpers.GetSizeFromParameterType(type); if (m_currentRegisterSizeLeft >= sizeInBytes && !m_bInArray) { m_currentRegisterSizeLeft -= sizeInBytes; newParameterTarget.offset = m_currentOffset; } else { m_currentOffset += m_currentRegisterSizeLeft; newParameterTarget.offset = m_currentOffset; m_currentRegisterSizeLeft = (16 - sizeInBytes % 16) % 16; } m_currentOffset += sizeInBytes; parameterTargets.Add(newParameterTarget); }
public SShaderParameter(EShaderParameterType type, object data) { parameterType = type; parameterData = data; }