This commit is contained in:
1 parent
ae47dc8a3f
commit
29df541ea1
3 files changed
+2344
-118
No files matched your search
+411
-87
@@ -22,6 +22,20 @@ type
|
||||
trsiTileRecords
|
||||
);
|
||||
|
||||
TGraphicsReadinessDiagnosticStageId = (
|
||||
grsiContextReady, grsiPhysicalSurface, grsiRendererSizeMatch,
|
||||
grsiTextureBackend, grsiSampledProgram, grsiMaxTextureSize
|
||||
);
|
||||
TGraphicsTextureDiagnosticStageId = (
|
||||
gtsiInitialCreate, gtsiNonZeroTextureId, gtsiFirstBind,
|
||||
gtsiReplacementUpdate, gtsiSecondBind, gtsiTextureDelete,
|
||||
gtsiResourceCleanup
|
||||
);
|
||||
TGraphicsVisibleDrawDiagnosticStageId = (
|
||||
gvsiPreparation, gvsiSampledRgbaPhase, gvsiBrightnessPhase,
|
||||
gvsiTextureDelete, gvsiResourceCleanup
|
||||
);
|
||||
|
||||
TOptionalString = record
|
||||
HasValue: Boolean;
|
||||
Value: string;
|
||||
@@ -47,6 +61,21 @@ type
|
||||
Value: TTerrainReadinessDiagnosticStageId;
|
||||
end;
|
||||
|
||||
TOptionalGraphicsReadinessDiagnosticStageId = record
|
||||
HasValue: Boolean;
|
||||
Value: TGraphicsReadinessDiagnosticStageId;
|
||||
end;
|
||||
|
||||
TOptionalGraphicsTextureDiagnosticStageId = record
|
||||
HasValue: Boolean;
|
||||
Value: TGraphicsTextureDiagnosticStageId;
|
||||
end;
|
||||
|
||||
TOptionalGraphicsVisibleDrawDiagnosticStageId = record
|
||||
HasValue: Boolean;
|
||||
Value: TGraphicsVisibleDrawDiagnosticStageId;
|
||||
end;
|
||||
|
||||
TDiagnosticError = record
|
||||
Present: Boolean;
|
||||
ClassName: TOptionalString;
|
||||
@@ -92,6 +121,58 @@ type
|
||||
Evidence: TTerrainReadinessDiagnosticEvidence;
|
||||
end;
|
||||
|
||||
TGraphicsReadinessDiagnosticEvidence = record
|
||||
ContextAvailable, RendererContextSynced, PhysicalSizeKnown,
|
||||
TextureBackendReady, SampledProgramReady: TOptionalBoolean;
|
||||
PhysicalWidth, PhysicalHeight, RendererWidth, RendererHeight,
|
||||
MaxTextureSize: TOptionalInt64;
|
||||
end;
|
||||
|
||||
TGraphicsTextureDiagnosticEvidence = record
|
||||
InitialWidth, InitialHeight, ReplacementWidth, ReplacementHeight: TOptionalInt64;
|
||||
InitialFormat, ReplacementFormat, MinFilter, MagFilter: TOptionalString;
|
||||
GenTextureCompleted, NonZeroTextureId, FirstBindCompleted,
|
||||
ReplacementUpdateCompleted, SecondBindCompleted, DeleteAttempted,
|
||||
DeleteCompleted, CleanupCompleted, ContextLost,
|
||||
CleanupBlockedByContext: TOptionalBoolean;
|
||||
SecondaryCleanupError: TDiagnosticError;
|
||||
end;
|
||||
|
||||
TGraphicsVisibleDrawDiagnosticEvidence = record
|
||||
TextureWidth, TextureHeight, BaseFramesCompleted,
|
||||
BrightnessFramesCompleted, BrightnessAmount: TOptionalInt64;
|
||||
TextureFormat, MinFilter, MagFilter: TOptionalString;
|
||||
TextureCreated, NonZeroTextureId, BaseTripleRgbaDrawsCompleted,
|
||||
BrightnessTripleRgbaDrawsCompleted, BrightnessOverlayAppliedAfterDraws,
|
||||
ContextLost, DeleteAttempted, DeleteCompleted, CleanupCompleted,
|
||||
CleanupBlockedByContext: TOptionalBoolean;
|
||||
SecondaryCleanupError: TDiagnosticError;
|
||||
end;
|
||||
|
||||
TGraphicsReadinessDiagnosticResult = record
|
||||
Status: TDiagnosticStatus;
|
||||
FailureStage: TOptionalGraphicsReadinessDiagnosticStageId;
|
||||
Error: TDiagnosticError;
|
||||
Stages: array[TGraphicsReadinessDiagnosticStageId] of TDiagnosticStatus;
|
||||
Evidence: TGraphicsReadinessDiagnosticEvidence;
|
||||
end;
|
||||
|
||||
TGraphicsTextureDiagnosticResult = record
|
||||
Status: TDiagnosticStatus;
|
||||
FailureStage: TOptionalGraphicsTextureDiagnosticStageId;
|
||||
Error: TDiagnosticError;
|
||||
Stages: array[TGraphicsTextureDiagnosticStageId] of TDiagnosticStatus;
|
||||
Evidence: TGraphicsTextureDiagnosticEvidence;
|
||||
end;
|
||||
|
||||
TGraphicsVisibleDrawDiagnosticResult = record
|
||||
Status: TDiagnosticStatus;
|
||||
FailureStage: TOptionalGraphicsVisibleDrawDiagnosticStageId;
|
||||
Error: TDiagnosticError;
|
||||
Stages: array[TGraphicsVisibleDrawDiagnosticStageId] of TDiagnosticStatus;
|
||||
Evidence: TGraphicsVisibleDrawDiagnosticEvidence;
|
||||
end;
|
||||
|
||||
TDiagnosticApplicationMetadata = record
|
||||
Name: string;
|
||||
PackageName: string;
|
||||
@@ -119,16 +200,31 @@ type
|
||||
OverallStatus: TDiagnosticStatus;
|
||||
FileIO: TFileIODiagnosticResult;
|
||||
TerrainReadiness: TTerrainReadinessDiagnosticResult;
|
||||
GraphicsReadiness: TGraphicsReadinessDiagnosticResult;
|
||||
GraphicsTexture: TGraphicsTextureDiagnosticResult;
|
||||
GraphicsVisibleDraw: TGraphicsVisibleDrawDiagnosticResult;
|
||||
end;
|
||||
|
||||
function CurrentDiagnosticReport: TDiagnosticReportState;
|
||||
procedure ReplaceFileIODiagnosticResult(const AResult: TFileIODiagnosticResult);
|
||||
procedure ReplaceTerrainReadinessDiagnosticResult(
|
||||
const AResult: TTerrainReadinessDiagnosticResult);
|
||||
procedure ReplaceGraphicsReadinessDiagnosticResult(
|
||||
const AResult: TGraphicsReadinessDiagnosticResult);
|
||||
procedure ReplaceGraphicsTextureDiagnosticResult(
|
||||
const AResult: TGraphicsTextureDiagnosticResult);
|
||||
procedure ReplaceGraphicsVisibleDrawDiagnosticResult(
|
||||
const AResult: TGraphicsVisibleDrawDiagnosticResult);
|
||||
function DiagnosticStatusToken(const AStatus: TDiagnosticStatus): string;
|
||||
function DiagnosticStageIdToken(const AStage: TDiagnosticStageId): string;
|
||||
function TerrainReadinessDiagnosticStageIdToken(
|
||||
const AStage: TTerrainReadinessDiagnosticStageId): string;
|
||||
function GraphicsReadinessDiagnosticStageIdToken(
|
||||
const AStage: TGraphicsReadinessDiagnosticStageId): string;
|
||||
function GraphicsTextureDiagnosticStageIdToken(
|
||||
const AStage: TGraphicsTextureDiagnosticStageId): string;
|
||||
function GraphicsVisibleDrawDiagnosticStageIdToken(
|
||||
const AStage: TGraphicsVisibleDrawDiagnosticStageId): string;
|
||||
function DiagnosticReportJsonSnapshot: string;
|
||||
|
||||
implementation
|
||||
@@ -139,6 +235,9 @@ uses
|
||||
var
|
||||
CurrentFileIO: TFileIODiagnosticResult;
|
||||
CurrentTerrainReadiness: TTerrainReadinessDiagnosticResult;
|
||||
CurrentGraphicsReadiness: TGraphicsReadinessDiagnosticResult;
|
||||
CurrentGraphicsTexture: TGraphicsTextureDiagnosticResult;
|
||||
CurrentGraphicsVisibleDraw: TGraphicsVisibleDrawDiagnosticResult;
|
||||
|
||||
function DiagnosticStatusToken(const AStatus: TDiagnosticStatus): string;
|
||||
begin
|
||||
@@ -149,6 +248,45 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function GraphicsReadinessDiagnosticStageIdToken(
|
||||
const AStage: TGraphicsReadinessDiagnosticStageId): string;
|
||||
begin
|
||||
case AStage of
|
||||
grsiContextReady: Result := 'context_ready';
|
||||
grsiPhysicalSurface: Result := 'physical_surface';
|
||||
grsiRendererSizeMatch: Result := 'renderer_size_match';
|
||||
grsiTextureBackend: Result := 'texture_backend';
|
||||
grsiSampledProgram: Result := 'sampled_program';
|
||||
grsiMaxTextureSize: Result := 'max_texture_size';
|
||||
end;
|
||||
end;
|
||||
|
||||
function GraphicsTextureDiagnosticStageIdToken(
|
||||
const AStage: TGraphicsTextureDiagnosticStageId): string;
|
||||
begin
|
||||
case AStage of
|
||||
gtsiInitialCreate: Result := 'initial_create';
|
||||
gtsiNonZeroTextureId: Result := 'non_zero_texture_id';
|
||||
gtsiFirstBind: Result := 'first_bind';
|
||||
gtsiReplacementUpdate: Result := 'replacement_update';
|
||||
gtsiSecondBind: Result := 'second_bind';
|
||||
gtsiTextureDelete: Result := 'texture_delete';
|
||||
gtsiResourceCleanup: Result := 'resource_cleanup';
|
||||
end;
|
||||
end;
|
||||
|
||||
function GraphicsVisibleDrawDiagnosticStageIdToken(
|
||||
const AStage: TGraphicsVisibleDrawDiagnosticStageId): string;
|
||||
begin
|
||||
case AStage of
|
||||
gvsiPreparation: Result := 'preparation';
|
||||
gvsiSampledRgbaPhase: Result := 'sampled_rgba_phase';
|
||||
gvsiBrightnessPhase: Result := 'brightness_phase';
|
||||
gvsiTextureDelete: Result := 'texture_delete';
|
||||
gvsiResourceCleanup: Result := 'resource_cleanup';
|
||||
end;
|
||||
end;
|
||||
|
||||
function DiagnosticStageIdToken(const AStage: TDiagnosticStageId): string;
|
||||
begin
|
||||
case AStage of
|
||||
@@ -186,11 +324,20 @@ begin
|
||||
Result.SelectedMap.Url := SelectedMapUrl;
|
||||
Result.FileIO := CurrentFileIO;
|
||||
Result.TerrainReadiness := CurrentTerrainReadiness;
|
||||
Result.GraphicsReadiness := CurrentGraphicsReadiness;
|
||||
Result.GraphicsTexture := CurrentGraphicsTexture;
|
||||
Result.GraphicsVisibleDraw := CurrentGraphicsVisibleDraw;
|
||||
if (Result.FileIO.Status = dsFail)
|
||||
or (Result.TerrainReadiness.Status = dsFail) then
|
||||
or (Result.TerrainReadiness.Status = dsFail)
|
||||
or (Result.GraphicsReadiness.Status = dsFail)
|
||||
or (Result.GraphicsTexture.Status = dsFail)
|
||||
or (Result.GraphicsVisibleDraw.Status = dsFail) then
|
||||
Result.OverallStatus := dsFail
|
||||
else if (Result.FileIO.Status = dsPass)
|
||||
and (Result.TerrainReadiness.Status = dsPass) then
|
||||
and (Result.TerrainReadiness.Status = dsPass)
|
||||
and (Result.GraphicsReadiness.Status = dsPass)
|
||||
and (Result.GraphicsTexture.Status = dsPass)
|
||||
and (Result.GraphicsVisibleDraw.Status = dsPass) then
|
||||
Result.OverallStatus := dsPass
|
||||
else
|
||||
Result.OverallStatus := dsNotRun;
|
||||
@@ -207,6 +354,24 @@ begin
|
||||
CurrentTerrainReadiness := AResult;
|
||||
end;
|
||||
|
||||
procedure ReplaceGraphicsReadinessDiagnosticResult(
|
||||
const AResult: TGraphicsReadinessDiagnosticResult);
|
||||
begin
|
||||
CurrentGraphicsReadiness := AResult;
|
||||
end;
|
||||
|
||||
procedure ReplaceGraphicsTextureDiagnosticResult(
|
||||
const AResult: TGraphicsTextureDiagnosticResult);
|
||||
begin
|
||||
CurrentGraphicsTexture := AResult;
|
||||
end;
|
||||
|
||||
procedure ReplaceGraphicsVisibleDrawDiagnosticResult(
|
||||
const AResult: TGraphicsVisibleDrawDiagnosticResult);
|
||||
begin
|
||||
CurrentGraphicsVisibleDraw := AResult;
|
||||
end;
|
||||
|
||||
function OptionalStringJson(const AValue: TOptionalString): TJSONData;
|
||||
begin
|
||||
if AValue.HasValue then
|
||||
@@ -231,14 +396,246 @@ begin
|
||||
Result := TJSONNull.Create;
|
||||
end;
|
||||
|
||||
function DiagnosticErrorJson(const AError: TDiagnosticError): TJSONData;
|
||||
var
|
||||
ObjectValue: TJSONObject;
|
||||
begin
|
||||
if not AError.Present then
|
||||
Exit(TJSONNull.Create);
|
||||
ObjectValue := TJSONObject.Create;
|
||||
ObjectValue.Add('class', OptionalStringJson(AError.ClassName));
|
||||
ObjectValue.Add('message', OptionalStringJson(AError.MessageText));
|
||||
Result := ObjectValue;
|
||||
end;
|
||||
|
||||
procedure AppendFileIOJson(AActions: TJSONArray; const AResult: TFileIODiagnosticResult);
|
||||
var
|
||||
Action, Stage, Stream: TJSONObject;
|
||||
Stages: TJSONArray;
|
||||
StageId: TDiagnosticStageId;
|
||||
begin
|
||||
Action := TJSONObject.Create;
|
||||
Action.Add('id', 'file_io');
|
||||
Action.Add('status', DiagnosticStatusToken(AResult.Status));
|
||||
if AResult.FailureStage.HasValue then
|
||||
Action.Add('failure_stage', DiagnosticStageIdToken(AResult.FailureStage.Value))
|
||||
else
|
||||
Action.Add('failure_stage', TJSONNull.Create);
|
||||
Action.Add('error', DiagnosticErrorJson(AResult.Error));
|
||||
Stages := TJSONArray.Create;
|
||||
for StageId := Low(TDiagnosticStageId) to High(TDiagnosticStageId) do
|
||||
begin
|
||||
Stage := TJSONObject.Create;
|
||||
Stage.Add('id', DiagnosticStageIdToken(StageId));
|
||||
Stage.Add('status', DiagnosticStatusToken(AResult.Stages[StageId]));
|
||||
Stages.Add(Stage);
|
||||
end;
|
||||
Action.Add('stages', Stages);
|
||||
Stream := TJSONObject.Create;
|
||||
Stream.Add('size', OptionalInt64Json(AResult.Stream.Size));
|
||||
Stream.Add('position_after_load', OptionalInt64Json(AResult.Stream.PositionAfterLoad));
|
||||
Stream.Add('read_offset', OptionalInt64Json(AResult.Stream.ReadOffset));
|
||||
Stream.Add('requested_read_count', OptionalInt64Json(AResult.Stream.RequestedReadCount));
|
||||
Stream.Add('first_read_count', OptionalInt64Json(AResult.Stream.FirstReadCount));
|
||||
Stream.Add('position_after_first_read', OptionalInt64Json(AResult.Stream.PositionAfterFirstRead));
|
||||
Stream.Add('seek_back_position', OptionalInt64Json(AResult.Stream.SeekBackPosition));
|
||||
Stream.Add('second_read_count', OptionalInt64Json(AResult.Stream.SecondReadCount));
|
||||
Stream.Add('position_after_second_read', OptionalInt64Json(AResult.Stream.PositionAfterSecondRead));
|
||||
Stream.Add('repeat_equal', OptionalBooleanJson(AResult.Stream.RepeatEqual));
|
||||
Action.Add('stream', Stream);
|
||||
AActions.Add(Action);
|
||||
end;
|
||||
|
||||
procedure AppendTerrainReadinessJson(AActions: TJSONArray; const AResult: TTerrainReadinessDiagnosticResult);
|
||||
var
|
||||
Action, Stage, Evidence: TJSONObject;
|
||||
Stages: TJSONArray;
|
||||
TerrainStageId: TTerrainReadinessDiagnosticStageId;
|
||||
begin
|
||||
Action := TJSONObject.Create;
|
||||
Action.Add('id', 'terrain_readiness');
|
||||
Action.Add('status', DiagnosticStatusToken(AResult.Status));
|
||||
if AResult.FailureStage.HasValue then
|
||||
Action.Add('failure_stage', TerrainReadinessDiagnosticStageIdToken(
|
||||
AResult.FailureStage.Value))
|
||||
else
|
||||
Action.Add('failure_stage', TJSONNull.Create);
|
||||
Action.Add('error', DiagnosticErrorJson(AResult.Error));
|
||||
Stages := TJSONArray.Create;
|
||||
for TerrainStageId := Low(TTerrainReadinessDiagnosticStageId)
|
||||
to High(TTerrainReadinessDiagnosticStageId) do
|
||||
begin
|
||||
Stage := TJSONObject.Create;
|
||||
Stage.Add('id', TerrainReadinessDiagnosticStageIdToken(TerrainStageId));
|
||||
Stage.Add('status', DiagnosticStatusToken(
|
||||
AResult.Stages[TerrainStageId]));
|
||||
Stages.Add(Stage);
|
||||
end;
|
||||
Action.Add('stages', Stages);
|
||||
Evidence := TJSONObject.Create;
|
||||
Evidence.Add('rx_tiles_loaded', OptionalBooleanJson(
|
||||
AResult.Evidence.RxTilesLoaded));
|
||||
Evidence.Add('generated_transitions_ready', OptionalBooleanJson(
|
||||
AResult.Evidence.GeneratedTransitionsReady));
|
||||
Evidence.Add('map_x', OptionalInt64Json(AResult.Evidence.MapX));
|
||||
Evidence.Add('map_y', OptionalInt64Json(AResult.Evidence.MapY));
|
||||
Evidence.Add('game_rev', OptionalInt64Json(AResult.Evidence.GameRev));
|
||||
Evidence.Add('expected_tile_count', OptionalInt64Json(
|
||||
AResult.Evidence.ExpectedTileCount));
|
||||
Evidence.Add('completed_tile_count', OptionalInt64Json(
|
||||
AResult.Evidence.CompletedTileCount));
|
||||
Action.Add('evidence', Evidence);
|
||||
AActions.Add(Action);
|
||||
end;
|
||||
|
||||
procedure AppendGraphicsReadinessJson(AActions: TJSONArray; const AResult: TGraphicsReadinessDiagnosticResult);
|
||||
var
|
||||
Action, Stage, Evidence: TJSONObject;
|
||||
Stages: TJSONArray;
|
||||
GraphicsReadinessStageId: TGraphicsReadinessDiagnosticStageId;
|
||||
begin
|
||||
Action := TJSONObject.Create;
|
||||
Action.Add('id', 'graphics_readiness');
|
||||
Action.Add('status', DiagnosticStatusToken(AResult.Status));
|
||||
if AResult.FailureStage.HasValue then
|
||||
Action.Add('failure_stage', GraphicsReadinessDiagnosticStageIdToken(
|
||||
AResult.FailureStage.Value))
|
||||
else
|
||||
Action.Add('failure_stage', TJSONNull.Create);
|
||||
Action.Add('error', DiagnosticErrorJson(AResult.Error));
|
||||
Stages := TJSONArray.Create;
|
||||
for GraphicsReadinessStageId := Low(TGraphicsReadinessDiagnosticStageId)
|
||||
to High(TGraphicsReadinessDiagnosticStageId) do
|
||||
begin
|
||||
Stage := TJSONObject.Create;
|
||||
Stage.Add('id', GraphicsReadinessDiagnosticStageIdToken(GraphicsReadinessStageId));
|
||||
Stage.Add('status', DiagnosticStatusToken(
|
||||
AResult.Stages[GraphicsReadinessStageId]));
|
||||
Stages.Add(Stage);
|
||||
end;
|
||||
Action.Add('stages', Stages);
|
||||
Evidence := TJSONObject.Create;
|
||||
Evidence.Add('context_available', OptionalBooleanJson(AResult.Evidence.ContextAvailable));
|
||||
Evidence.Add('renderer_context_synced', OptionalBooleanJson(AResult.Evidence.RendererContextSynced));
|
||||
Evidence.Add('physical_size_known', OptionalBooleanJson(AResult.Evidence.PhysicalSizeKnown));
|
||||
Evidence.Add('texture_backend_ready', OptionalBooleanJson(AResult.Evidence.TextureBackendReady));
|
||||
Evidence.Add('sampled_program_ready', OptionalBooleanJson(AResult.Evidence.SampledProgramReady));
|
||||
Evidence.Add('physical_width', OptionalInt64Json(AResult.Evidence.PhysicalWidth));
|
||||
Evidence.Add('physical_height', OptionalInt64Json(AResult.Evidence.PhysicalHeight));
|
||||
Evidence.Add('renderer_width', OptionalInt64Json(AResult.Evidence.RendererWidth));
|
||||
Evidence.Add('renderer_height', OptionalInt64Json(AResult.Evidence.RendererHeight));
|
||||
Evidence.Add('max_texture_size', OptionalInt64Json(AResult.Evidence.MaxTextureSize));
|
||||
Action.Add('evidence', Evidence);
|
||||
AActions.Add(Action);
|
||||
end;
|
||||
|
||||
procedure AppendGraphicsTextureJson(AActions: TJSONArray; const AResult: TGraphicsTextureDiagnosticResult);
|
||||
var
|
||||
Action, Stage, Evidence: TJSONObject;
|
||||
Stages: TJSONArray;
|
||||
GraphicsTextureStageId: TGraphicsTextureDiagnosticStageId;
|
||||
begin
|
||||
Action := TJSONObject.Create;
|
||||
Action.Add('id', 'graphics_texture');
|
||||
Action.Add('status', DiagnosticStatusToken(AResult.Status));
|
||||
if AResult.FailureStage.HasValue then
|
||||
Action.Add('failure_stage', GraphicsTextureDiagnosticStageIdToken(
|
||||
AResult.FailureStage.Value))
|
||||
else
|
||||
Action.Add('failure_stage', TJSONNull.Create);
|
||||
Action.Add('error', DiagnosticErrorJson(AResult.Error));
|
||||
Stages := TJSONArray.Create;
|
||||
for GraphicsTextureStageId := Low(TGraphicsTextureDiagnosticStageId)
|
||||
to High(TGraphicsTextureDiagnosticStageId) do
|
||||
begin
|
||||
Stage := TJSONObject.Create;
|
||||
Stage.Add('id', GraphicsTextureDiagnosticStageIdToken(GraphicsTextureStageId));
|
||||
Stage.Add('status', DiagnosticStatusToken(
|
||||
AResult.Stages[GraphicsTextureStageId]));
|
||||
Stages.Add(Stage);
|
||||
end;
|
||||
Action.Add('stages', Stages);
|
||||
Evidence := TJSONObject.Create;
|
||||
Evidence.Add('initial_width', OptionalInt64Json(AResult.Evidence.InitialWidth));
|
||||
Evidence.Add('initial_height', OptionalInt64Json(AResult.Evidence.InitialHeight));
|
||||
Evidence.Add('replacement_width', OptionalInt64Json(AResult.Evidence.ReplacementWidth));
|
||||
Evidence.Add('replacement_height', OptionalInt64Json(AResult.Evidence.ReplacementHeight));
|
||||
Evidence.Add('initial_format', OptionalStringJson(AResult.Evidence.InitialFormat));
|
||||
Evidence.Add('replacement_format', OptionalStringJson(AResult.Evidence.ReplacementFormat));
|
||||
Evidence.Add('min_filter', OptionalStringJson(AResult.Evidence.MinFilter));
|
||||
Evidence.Add('mag_filter', OptionalStringJson(AResult.Evidence.MagFilter));
|
||||
Evidence.Add('gen_texture_completed', OptionalBooleanJson(AResult.Evidence.GenTextureCompleted));
|
||||
Evidence.Add('non_zero_texture_id', OptionalBooleanJson(AResult.Evidence.NonZeroTextureId));
|
||||
Evidence.Add('first_bind_completed', OptionalBooleanJson(AResult.Evidence.FirstBindCompleted));
|
||||
Evidence.Add('replacement_update_completed', OptionalBooleanJson(AResult.Evidence.ReplacementUpdateCompleted));
|
||||
Evidence.Add('second_bind_completed', OptionalBooleanJson(AResult.Evidence.SecondBindCompleted));
|
||||
Evidence.Add('delete_attempted', OptionalBooleanJson(AResult.Evidence.DeleteAttempted));
|
||||
Evidence.Add('delete_completed', OptionalBooleanJson(AResult.Evidence.DeleteCompleted));
|
||||
Evidence.Add('cleanup_completed', OptionalBooleanJson(AResult.Evidence.CleanupCompleted));
|
||||
Evidence.Add('context_lost', OptionalBooleanJson(AResult.Evidence.ContextLost));
|
||||
Evidence.Add('cleanup_blocked_by_context', OptionalBooleanJson(AResult.Evidence.CleanupBlockedByContext));
|
||||
Evidence.Add('secondary_cleanup_error',
|
||||
DiagnosticErrorJson(AResult.Evidence.SecondaryCleanupError));
|
||||
Action.Add('evidence', Evidence);
|
||||
AActions.Add(Action);
|
||||
end;
|
||||
|
||||
procedure AppendGraphicsVisibleDrawJson(AActions: TJSONArray; const AResult: TGraphicsVisibleDrawDiagnosticResult);
|
||||
var
|
||||
Action, Stage, Evidence: TJSONObject;
|
||||
Stages: TJSONArray;
|
||||
GraphicsVisibleDrawStageId: TGraphicsVisibleDrawDiagnosticStageId;
|
||||
begin
|
||||
Action := TJSONObject.Create;
|
||||
Action.Add('id', 'graphics_visible_draw');
|
||||
Action.Add('status', DiagnosticStatusToken(AResult.Status));
|
||||
if AResult.FailureStage.HasValue then
|
||||
Action.Add('failure_stage', GraphicsVisibleDrawDiagnosticStageIdToken(
|
||||
AResult.FailureStage.Value))
|
||||
else
|
||||
Action.Add('failure_stage', TJSONNull.Create);
|
||||
Action.Add('error', DiagnosticErrorJson(AResult.Error));
|
||||
Stages := TJSONArray.Create;
|
||||
for GraphicsVisibleDrawStageId := Low(TGraphicsVisibleDrawDiagnosticStageId)
|
||||
to High(TGraphicsVisibleDrawDiagnosticStageId) do
|
||||
begin
|
||||
Stage := TJSONObject.Create;
|
||||
Stage.Add('id', GraphicsVisibleDrawDiagnosticStageIdToken(GraphicsVisibleDrawStageId));
|
||||
Stage.Add('status', DiagnosticStatusToken(
|
||||
AResult.Stages[GraphicsVisibleDrawStageId]));
|
||||
Stages.Add(Stage);
|
||||
end;
|
||||
Action.Add('stages', Stages);
|
||||
Evidence := TJSONObject.Create;
|
||||
Evidence.Add('texture_width', OptionalInt64Json(AResult.Evidence.TextureWidth));
|
||||
Evidence.Add('texture_height', OptionalInt64Json(AResult.Evidence.TextureHeight));
|
||||
Evidence.Add('base_frames_completed', OptionalInt64Json(AResult.Evidence.BaseFramesCompleted));
|
||||
Evidence.Add('brightness_frames_completed', OptionalInt64Json(AResult.Evidence.BrightnessFramesCompleted));
|
||||
Evidence.Add('brightness_amount', OptionalInt64Json(AResult.Evidence.BrightnessAmount));
|
||||
Evidence.Add('texture_format', OptionalStringJson(AResult.Evidence.TextureFormat));
|
||||
Evidence.Add('min_filter', OptionalStringJson(AResult.Evidence.MinFilter));
|
||||
Evidence.Add('mag_filter', OptionalStringJson(AResult.Evidence.MagFilter));
|
||||
Evidence.Add('texture_created', OptionalBooleanJson(AResult.Evidence.TextureCreated));
|
||||
Evidence.Add('non_zero_texture_id', OptionalBooleanJson(AResult.Evidence.NonZeroTextureId));
|
||||
Evidence.Add('base_triple_rgba_draws_completed', OptionalBooleanJson(AResult.Evidence.BaseTripleRgbaDrawsCompleted));
|
||||
Evidence.Add('brightness_triple_rgba_draws_completed', OptionalBooleanJson(AResult.Evidence.BrightnessTripleRgbaDrawsCompleted));
|
||||
Evidence.Add('brightness_overlay_applied_after_draws', OptionalBooleanJson(AResult.Evidence.BrightnessOverlayAppliedAfterDraws));
|
||||
Evidence.Add('context_lost', OptionalBooleanJson(AResult.Evidence.ContextLost));
|
||||
Evidence.Add('delete_attempted', OptionalBooleanJson(AResult.Evidence.DeleteAttempted));
|
||||
Evidence.Add('delete_completed', OptionalBooleanJson(AResult.Evidence.DeleteCompleted));
|
||||
Evidence.Add('cleanup_completed', OptionalBooleanJson(AResult.Evidence.CleanupCompleted));
|
||||
Evidence.Add('cleanup_blocked_by_context', OptionalBooleanJson(AResult.Evidence.CleanupBlockedByContext));
|
||||
Evidence.Add('secondary_cleanup_error',
|
||||
DiagnosticErrorJson(AResult.Evidence.SecondaryCleanupError));
|
||||
Action.Add('evidence', Evidence);
|
||||
AActions.Add(Action);
|
||||
end;
|
||||
|
||||
function DiagnosticReportJsonSnapshot: string;
|
||||
var
|
||||
State: TDiagnosticReportState;
|
||||
Root, ObjectValue, Action, Stage, Stream: TJSONObject;
|
||||
Actions, Stages: TJSONArray;
|
||||
StageId: TDiagnosticStageId;
|
||||
TerrainStageId: TTerrainReadinessDiagnosticStageId;
|
||||
Evidence: TJSONObject;
|
||||
Root, ObjectValue: TJSONObject;
|
||||
Actions: TJSONArray;
|
||||
begin
|
||||
State := CurrentDiagnosticReport;
|
||||
Root := TJSONObject.Create;
|
||||
@@ -263,86 +660,13 @@ begin
|
||||
Root.Add('selected_map', ObjectValue);
|
||||
Root.Add('overall_status', DiagnosticStatusToken(State.OverallStatus));
|
||||
Actions := TJSONArray.Create;
|
||||
Action := TJSONObject.Create;
|
||||
Action.Add('id', 'file_io');
|
||||
Action.Add('status', DiagnosticStatusToken(State.FileIO.Status));
|
||||
if State.FileIO.FailureStage.HasValue then
|
||||
Action.Add('failure_stage', DiagnosticStageIdToken(State.FileIO.FailureStage.Value))
|
||||
else
|
||||
Action.Add('failure_stage', TJSONNull.Create);
|
||||
if State.FileIO.Error.Present then
|
||||
begin
|
||||
ObjectValue := TJSONObject.Create;
|
||||
ObjectValue.Add('class', OptionalStringJson(State.FileIO.Error.ClassName));
|
||||
ObjectValue.Add('message', OptionalStringJson(State.FileIO.Error.MessageText));
|
||||
Action.Add('error', ObjectValue);
|
||||
end else
|
||||
Action.Add('error', TJSONNull.Create);
|
||||
Stages := TJSONArray.Create;
|
||||
for StageId := Low(TDiagnosticStageId) to High(TDiagnosticStageId) do
|
||||
begin
|
||||
Stage := TJSONObject.Create;
|
||||
Stage.Add('id', DiagnosticStageIdToken(StageId));
|
||||
Stage.Add('status', DiagnosticStatusToken(State.FileIO.Stages[StageId]));
|
||||
Stages.Add(Stage);
|
||||
end;
|
||||
Action.Add('stages', Stages);
|
||||
Stream := TJSONObject.Create;
|
||||
Stream.Add('size', OptionalInt64Json(State.FileIO.Stream.Size));
|
||||
Stream.Add('position_after_load', OptionalInt64Json(State.FileIO.Stream.PositionAfterLoad));
|
||||
Stream.Add('read_offset', OptionalInt64Json(State.FileIO.Stream.ReadOffset));
|
||||
Stream.Add('requested_read_count', OptionalInt64Json(State.FileIO.Stream.RequestedReadCount));
|
||||
Stream.Add('first_read_count', OptionalInt64Json(State.FileIO.Stream.FirstReadCount));
|
||||
Stream.Add('position_after_first_read', OptionalInt64Json(State.FileIO.Stream.PositionAfterFirstRead));
|
||||
Stream.Add('seek_back_position', OptionalInt64Json(State.FileIO.Stream.SeekBackPosition));
|
||||
Stream.Add('second_read_count', OptionalInt64Json(State.FileIO.Stream.SecondReadCount));
|
||||
Stream.Add('position_after_second_read', OptionalInt64Json(State.FileIO.Stream.PositionAfterSecondRead));
|
||||
Stream.Add('repeat_equal', OptionalBooleanJson(State.FileIO.Stream.RepeatEqual));
|
||||
Action.Add('stream', Stream);
|
||||
Actions.Add(Action);
|
||||
Action := TJSONObject.Create;
|
||||
Action.Add('id', 'terrain_readiness');
|
||||
Action.Add('status', DiagnosticStatusToken(State.TerrainReadiness.Status));
|
||||
if State.TerrainReadiness.FailureStage.HasValue then
|
||||
Action.Add('failure_stage', TerrainReadinessDiagnosticStageIdToken(
|
||||
State.TerrainReadiness.FailureStage.Value))
|
||||
else
|
||||
Action.Add('failure_stage', TJSONNull.Create);
|
||||
if State.TerrainReadiness.Error.Present then
|
||||
begin
|
||||
ObjectValue := TJSONObject.Create;
|
||||
ObjectValue.Add('class', OptionalStringJson(
|
||||
State.TerrainReadiness.Error.ClassName));
|
||||
ObjectValue.Add('message', OptionalStringJson(
|
||||
State.TerrainReadiness.Error.MessageText));
|
||||
Action.Add('error', ObjectValue);
|
||||
end else
|
||||
Action.Add('error', TJSONNull.Create);
|
||||
Stages := TJSONArray.Create;
|
||||
for TerrainStageId := Low(TTerrainReadinessDiagnosticStageId)
|
||||
to High(TTerrainReadinessDiagnosticStageId) do
|
||||
begin
|
||||
Stage := TJSONObject.Create;
|
||||
Stage.Add('id', TerrainReadinessDiagnosticStageIdToken(TerrainStageId));
|
||||
Stage.Add('status', DiagnosticStatusToken(
|
||||
State.TerrainReadiness.Stages[TerrainStageId]));
|
||||
Stages.Add(Stage);
|
||||
end;
|
||||
Action.Add('stages', Stages);
|
||||
Evidence := TJSONObject.Create;
|
||||
Evidence.Add('rx_tiles_loaded', OptionalBooleanJson(
|
||||
State.TerrainReadiness.Evidence.RxTilesLoaded));
|
||||
Evidence.Add('generated_transitions_ready', OptionalBooleanJson(
|
||||
State.TerrainReadiness.Evidence.GeneratedTransitionsReady));
|
||||
Evidence.Add('map_x', OptionalInt64Json(State.TerrainReadiness.Evidence.MapX));
|
||||
Evidence.Add('map_y', OptionalInt64Json(State.TerrainReadiness.Evidence.MapY));
|
||||
Evidence.Add('game_rev', OptionalInt64Json(State.TerrainReadiness.Evidence.GameRev));
|
||||
Evidence.Add('expected_tile_count', OptionalInt64Json(
|
||||
State.TerrainReadiness.Evidence.ExpectedTileCount));
|
||||
Evidence.Add('completed_tile_count', OptionalInt64Json(
|
||||
State.TerrainReadiness.Evidence.CompletedTileCount));
|
||||
Action.Add('evidence', Evidence);
|
||||
Actions.Add(Action);
|
||||
AppendFileIOJson(Actions, State.FileIO);
|
||||
AppendTerrainReadinessJson(Actions, State.TerrainReadiness);
|
||||
AppendGraphicsReadinessJson(Actions, State.GraphicsReadiness);
|
||||
|
||||
AppendGraphicsTextureJson(Actions, State.GraphicsTexture);
|
||||
|
||||
AppendGraphicsVisibleDrawJson(Actions, State.GraphicsVisibleDraw);
|
||||
Root.Add('actions', Actions);
|
||||
Result := Root.AsJSON;
|
||||
finally
|
||||
|
||||
Reference in new issue
Block a user