private static DXEffectObject.d3dx_parameter GetParameterFromSymbol(MojoShader.MOJOSHADER_symbol symbol)
        {
            var param = new DXEffectObject.d3dx_parameter();
            param.rows = symbol.info.rows;
            param.columns = symbol.info.columns;
            param.name = symbol.name ?? string.Empty;
            param.semantic = string.Empty; // TODO: How do i do this with only MojoShader?

            var registerSize = (symbol.register_set == MojoShader.MOJOSHADER_symbolRegisterSet.MOJOSHADER_SYMREGSET_BOOL ? 1 : 4) * 4;
            var offset = (int)symbol.register_index * registerSize;
            param.bufferOffset = offset;

            switch (symbol.info.parameter_class)
            {
                case MojoShader.MOJOSHADER_symbolClass.MOJOSHADER_SYMCLASS_SCALAR:
                    param.class_ = DXEffectObject.D3DXPARAMETER_CLASS.SCALAR;
                    break;

                case MojoShader.MOJOSHADER_symbolClass.MOJOSHADER_SYMCLASS_VECTOR:
                    param.class_ = DXEffectObject.D3DXPARAMETER_CLASS.VECTOR;
                    break;

                case MojoShader.MOJOSHADER_symbolClass.MOJOSHADER_SYMCLASS_MATRIX_COLUMNS:
                    param.class_ = DXEffectObject.D3DXPARAMETER_CLASS.MATRIX_COLUMNS;
                    break;

                default:
                    throw new Exception("Unsupported parameter class!");
            }

            switch (symbol.info.parameter_type)
            {
                case MojoShader.MOJOSHADER_symbolType.MOJOSHADER_SYMTYPE_BOOL:
                    param.type = DXEffectObject.D3DXPARAMETER_TYPE.BOOL;
                    break;

                case MojoShader.MOJOSHADER_symbolType.MOJOSHADER_SYMTYPE_FLOAT:
                    param.type = DXEffectObject.D3DXPARAMETER_TYPE.FLOAT;
                    break;

                case MojoShader.MOJOSHADER_symbolType.MOJOSHADER_SYMTYPE_INT:
                    param.type = DXEffectObject.D3DXPARAMETER_TYPE.INT;
                    break;

                default:
                    throw new Exception("Unsupported parameter type!");
            }

            // HACK: We don't have real default parameters from mojoshader! 
            param.data = new byte[param.rows * param.columns * 4];

            param.member_count = symbol.info.member_count;
            param.element_count = symbol.info.elements > 1 ? symbol.info.elements : 0;

            if (param.member_count > 0)
            {
                param.member_handles = new DXEffectObject.d3dx_parameter[param.member_count];

                var members = DXHelper.UnmarshalArray<MojoShader.MOJOSHADER_symbol>(
                    symbol.info.members, (int)symbol.info.member_count);

                for (var i = 0; i < param.member_count; i++)
                {
                    var mparam = GetParameterFromSymbol(members[i]);
                    param.member_handles[i] = mparam;
                }
            }
            else
            {
                param.member_handles = new DXEffectObject.d3dx_parameter[param.element_count];
                for (var i = 0; i < param.element_count; i++)
                {
                    var mparam = new DXEffectObject.d3dx_parameter();

                    mparam.name = string.Empty;
                    mparam.semantic = string.Empty;
                    mparam.type = param.type;
                    mparam.class_ = param.class_;
                    mparam.rows = param.rows;
                    mparam.columns = param.columns;
                    mparam.data = new byte[param.columns * param.rows * 4];

                    param.member_handles[i] = mparam;
                }
            }

            return param;
        }
        private static DXEffectObject.d3dx_parameter GetParameterFromType(SharpDX.D3DCompiler.ShaderReflectionType type)
        {
            var param = new DXEffectObject.d3dx_parameter();

            param.rows         = (uint)type.Description.RowCount;
            param.columns      = (uint)type.Description.ColumnCount;
            param.name         = type.Description.Name ?? string.Empty;
            param.semantic     = string.Empty;
            param.bufferOffset = type.Description.Offset;

            switch (type.Description.Class)
            {
            case SharpDX.D3DCompiler.ShaderVariableClass.Scalar:
                param.class_ = DXEffectObject.D3DXPARAMETER_CLASS.SCALAR;
                break;

            case SharpDX.D3DCompiler.ShaderVariableClass.Vector:
                param.class_ = DXEffectObject.D3DXPARAMETER_CLASS.VECTOR;
                break;

            case SharpDX.D3DCompiler.ShaderVariableClass.MatrixColumns:
                param.class_ = DXEffectObject.D3DXPARAMETER_CLASS.MATRIX_COLUMNS;
                break;

            default:
                throw new Exception("Unsupported parameter class!");
            }

            switch (type.Description.Type)
            {
            case SharpDX.D3DCompiler.ShaderVariableType.Bool:
                param.type = DXEffectObject.D3DXPARAMETER_TYPE.BOOL;
                break;

            case SharpDX.D3DCompiler.ShaderVariableType.Float:
                param.type = DXEffectObject.D3DXPARAMETER_TYPE.FLOAT;
                break;

            case SharpDX.D3DCompiler.ShaderVariableType.Int:
                param.type = DXEffectObject.D3DXPARAMETER_TYPE.INT;
                break;

            default:
                throw new Exception("Unsupported parameter type!");
            }

            param.member_count  = (uint)type.Description.MemberCount;
            param.element_count = (uint)type.Description.ElementCount;

            if (param.member_count > 0)
            {
                param.member_handles = new DXEffectObject.d3dx_parameter[param.member_count];
                for (var i = 0; i < param.member_count; i++)
                {
                    var mparam = GetParameterFromType(type.GetMemberType(i));
                    mparam.name             = type.GetMemberTypeName(i) ?? string.Empty;
                    param.member_handles[i] = mparam;
                }
            }
            else
            {
                param.member_handles = new DXEffectObject.d3dx_parameter[param.element_count];
                for (var i = 0; i < param.element_count; i++)
                {
                    var mparam = new DXEffectObject.d3dx_parameter();

                    mparam.name     = string.Empty;
                    mparam.semantic = string.Empty;
                    mparam.type     = param.type;
                    mparam.class_   = param.class_;
                    mparam.rows     = param.rows;
                    mparam.columns  = param.columns;
                    mparam.data     = new byte[param.columns * param.rows * 4];

                    param.member_handles[i] = mparam;
                }
            }

            return(param);
        }
        private static DXEffectObject.d3dx_parameter GetParameterFromSymbol(MojoShader.MOJOSHADER_symbol symbol)
        {
            var param = new DXEffectObject.d3dx_parameter();

            param.rows     = symbol.info.rows;
            param.columns  = symbol.info.columns;
            param.name     = symbol.name ?? string.Empty;
            param.semantic = string.Empty; // TODO: How do i do this with only MojoShader?

            var registerSize = (symbol.register_set == MojoShader.MOJOSHADER_symbolRegisterSet.MOJOSHADER_SYMREGSET_BOOL ? 1 : 4) * 4;
            var offset       = (int)symbol.register_index * registerSize;

            param.bufferOffset = offset;

            switch (symbol.info.parameter_class)
            {
            case MojoShader.MOJOSHADER_symbolClass.MOJOSHADER_SYMCLASS_SCALAR:
                param.class_ = DXEffectObject.D3DXPARAMETER_CLASS.SCALAR;
                break;

            case MojoShader.MOJOSHADER_symbolClass.MOJOSHADER_SYMCLASS_VECTOR:
                param.class_ = DXEffectObject.D3DXPARAMETER_CLASS.VECTOR;
                break;

            case MojoShader.MOJOSHADER_symbolClass.MOJOSHADER_SYMCLASS_MATRIX_COLUMNS:
                param.class_ = DXEffectObject.D3DXPARAMETER_CLASS.MATRIX_COLUMNS;
                break;

            default:
                throw new Exception("Unsupported parameter class!");
            }

            switch (symbol.info.parameter_type)
            {
            case MojoShader.MOJOSHADER_symbolType.MOJOSHADER_SYMTYPE_BOOL:
                param.type = DXEffectObject.D3DXPARAMETER_TYPE.BOOL;
                break;

            case MojoShader.MOJOSHADER_symbolType.MOJOSHADER_SYMTYPE_FLOAT:
                param.type = DXEffectObject.D3DXPARAMETER_TYPE.FLOAT;
                break;

            case MojoShader.MOJOSHADER_symbolType.MOJOSHADER_SYMTYPE_INT:
                param.type = DXEffectObject.D3DXPARAMETER_TYPE.INT;
                break;

            default:
                throw new Exception("Unsupported parameter type!");
            }

            // HACK: We don't have real default parameters from mojoshader!
            param.data = new byte[param.rows * param.columns * 4];

            param.member_count  = symbol.info.member_count;
            param.element_count = symbol.info.elements > 1 ? symbol.info.elements : 0;

            if (param.member_count > 0)
            {
                param.member_handles = new DXEffectObject.d3dx_parameter[param.member_count];

                var members = DXHelper.UnmarshalArray <MojoShader.MOJOSHADER_symbol>(
                    symbol.info.members, (int)symbol.info.member_count);

                for (var i = 0; i < param.member_count; i++)
                {
                    var mparam = GetParameterFromSymbol(members[i]);
                    param.member_handles[i] = mparam;
                }
            }
            else
            {
                param.member_handles = new DXEffectObject.d3dx_parameter[param.element_count];
                for (var i = 0; i < param.element_count; i++)
                {
                    var mparam = new DXEffectObject.d3dx_parameter();

                    mparam.name     = string.Empty;
                    mparam.semantic = string.Empty;
                    mparam.type     = param.type;
                    mparam.class_   = param.class_;
                    mparam.rows     = param.rows;
                    mparam.columns  = param.columns;
                    mparam.data     = new byte[param.columns * param.rows * 4];

                    param.member_handles[i] = mparam;
                }
            }

            return(param);
        }
        private static DXEffectObject.d3dx_parameter GetParameterFromType(SharpDX.D3DCompiler.ShaderReflectionType type)
        {
            var param = new DXEffectObject.d3dx_parameter();
            param.rows = (uint)type.Description.RowCount;
            param.columns = (uint)type.Description.ColumnCount;
            param.name = type.Description.Name ?? string.Empty;
            param.semantic = string.Empty;
            param.bufferOffset = type.Description.Offset;

            switch (type.Description.Class)
            {
                case SharpDX.D3DCompiler.ShaderVariableClass.Scalar:
                    param.class_ = DXEffectObject.D3DXPARAMETER_CLASS.SCALAR;
                    break;

                case SharpDX.D3DCompiler.ShaderVariableClass.Vector:
                    param.class_ = DXEffectObject.D3DXPARAMETER_CLASS.VECTOR;
                    break;

                case SharpDX.D3DCompiler.ShaderVariableClass.MatrixColumns:
                    param.class_ = DXEffectObject.D3DXPARAMETER_CLASS.MATRIX_COLUMNS;
                    break;

                default:
                    throw new Exception("Unsupported parameter class!");
            }

            switch (type.Description.Type)
            {
                case SharpDX.D3DCompiler.ShaderVariableType.Bool:
                    param.type = DXEffectObject.D3DXPARAMETER_TYPE.BOOL;
                    break;

                case SharpDX.D3DCompiler.ShaderVariableType.Float:
                    param.type = DXEffectObject.D3DXPARAMETER_TYPE.FLOAT;
                    break;

                case SharpDX.D3DCompiler.ShaderVariableType.Int:
                    param.type = DXEffectObject.D3DXPARAMETER_TYPE.INT;
                    break;

                default:
                    throw new Exception("Unsupported parameter type!");
            }

            param.member_count = (uint)type.Description.MemberCount;
            param.element_count = (uint)type.Description.ElementCount;

            if (param.member_count > 0)
            {
                param.member_handles = new DXEffectObject.d3dx_parameter[param.member_count];
                for (var i = 0; i < param.member_count; i++)
                {
                    var mparam = GetParameterFromType(type.GetMemberType(i));
                    mparam.name = type.GetMemberTypeName(i) ?? string.Empty;
                    param.member_handles[i] = mparam;
                }
            }
            else
            {
                param.member_handles = new DXEffectObject.d3dx_parameter[param.element_count];
                for (var i = 0; i < param.element_count; i++)
                {
                    var mparam = new DXEffectObject.d3dx_parameter();

                    mparam.name = string.Empty;
                    mparam.semantic = string.Empty;
                    mparam.type = param.type;
                    mparam.class_ = param.class_;
                    mparam.rows = param.rows;
                    mparam.columns = param.columns;
                    mparam.data = new byte[param.columns * param.rows * 4];

                    param.member_handles[i] = mparam;
                }
            }

            return param;
        }