public static DebugSamplerState Parse(DebugBytecodeReader reader, DebugBytecodeReader stateReader)
        {
            var result          = new DebugSamplerState();
            var assignmentCount = stateReader.ReadUInt32("AssignmentCount");

            for (int j = 0; j < assignmentCount; j++)
            {
                stateReader.AddIndent($"Assignment {j}");
                result.Assignments.Add(DebugAssignment.Parse(reader, stateReader));
                stateReader.RemoveIndent();
            }
            return(result);
        }
        public static DebugVariable Parse(DebugBytecodeReader reader, DebugBytecodeReader variableReader)
        {
            var result = new DebugVariable();

            result.ParameterOffset    = variableReader.ReadUInt32("ParameterOffset");
            result.DefaultValueOffset = variableReader.ReadUInt32("DefaultValueOffset");
            result.IsShared           = variableReader.ReadUInt32("IsShared");
            result.AnnotationCount    = variableReader.ReadUInt32("AnnotationCount");
            for (int i = 0; i < result.AnnotationCount; i++)
            {
                variableReader.AddIndent($"Annotation {i}");
                result.Annotations.Add(DebugAnnotation.Parse(reader, variableReader));
                variableReader.RemoveIndent();
            }
            var paramterReader = reader.CopyAtOffset("ParameterReader", variableReader, (int)result.ParameterOffset);

            result.Parameter = DebugParameter.Parse(reader, paramterReader);

            if (result.Parameter.ParameterType.IsSampler())
            {
                var elementCount       = result.Parameter.Elements > 0 ? result.Parameter.Elements : 1;
                var samplerStateReader = reader.CopyAtOffset("SamplerStateReader", variableReader, (int)result.DefaultValueOffset);
                for (int i = 0; i < elementCount; i++)
                {
                    samplerStateReader.AddIndent($"SamplerState {i}");
                    result.SamplerStates.Add(DebugSamplerState.Parse(reader, samplerStateReader));
                    samplerStateReader.RemoveIndent();
                }
            }
            else
            {
                var valueReader = reader.CopyAtOffset("ValueReader", variableReader, (int)result.DefaultValueOffset);
                result.Value = result.Parameter.ReadParameterValue(valueReader);
            }
            return(result);
        }