mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Adds an interface for queries.
This commit is contained in:
parent
8da6c758fc
commit
0e7d193fcc
2 changed files with 40 additions and 1 deletions
|
|
@ -61,6 +61,8 @@ public:
|
|||
uint32_t maxTextureSize;
|
||||
bool instancing;
|
||||
bool storage;
|
||||
bool timestamps;
|
||||
double timestampMultiplier;
|
||||
};
|
||||
|
||||
virtual ~IDevice() {}
|
||||
|
|
@ -177,6 +179,32 @@ public:
|
|||
virtual Format GetPreferredDepthStencilFormat(
|
||||
const uint32_t usage, const bool depth, const bool stencil) const = 0;
|
||||
|
||||
virtual uint32_t AllocateQuery() = 0;
|
||||
|
||||
virtual void FreeQuery(const uint32_t handle) = 0;
|
||||
|
||||
/**
|
||||
* @see GetQueryResult
|
||||
*
|
||||
* It must be called only if the query was submitted via
|
||||
* IDeviceCommandContext::Flush.
|
||||
*
|
||||
* @param handle Must be a valid handle of a query.
|
||||
*
|
||||
* @return True if a result for the query is available.
|
||||
*/
|
||||
virtual bool IsQueryResultAvailable(const uint32_t handle) const = 0;
|
||||
|
||||
/**
|
||||
* After a call of the function the query result becomes invalid.
|
||||
*
|
||||
* @param handle Must be a valid handle of a query.
|
||||
*
|
||||
* @return A result for the query. The result is undefined if the query isn't
|
||||
* ready.
|
||||
*/
|
||||
virtual uint64_t GetQueryResult(const uint32_t handle) = 0;
|
||||
|
||||
virtual const Capabilities& GetCapabilities() const = 0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2024 Wildfire Games.
|
||||
/* Copyright (C) 2025 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
|
|
@ -222,6 +222,17 @@ public:
|
|||
virtual void SetUniform(
|
||||
const int32_t bindingSlot, PS::span<const float> values) = 0;
|
||||
|
||||
/**
|
||||
* Insert a timestamp query which can be later requested via IDevice.
|
||||
* @see IDevice::IsQueryResultAvailable
|
||||
* It can be used only outside of a framebuffer pass. The query must
|
||||
* not be used till Flush.
|
||||
*
|
||||
* @param handle Must be a valid handle to a query.
|
||||
* @param isScopeBegin True if it's a scope start.
|
||||
*/
|
||||
virtual void InsertTimestampQuery(const uint32_t handle, const bool isScopeBegin) = 0;
|
||||
|
||||
virtual void BeginScopedLabel(const char* name) = 0;
|
||||
virtual void EndScopedLabel() = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue