Add semaphore functions for gx2/dmae

This commit is contained in:
GaryOderNichts 2026-03-23 13:41:39 +01:00
parent 2016e429c1
commit aad202b56c
3 changed files with 57 additions and 0 deletions

View File

@ -1,5 +1,6 @@
#pragma once
#include <wut.h>
#include <gx2/semaphore.h>
/**
* \defgroup dmae_sync Synchronization
@ -14,6 +15,12 @@ extern "C" {
//! Timestamp for a DMAE operation.
typedef uint64_t DMAETimeStamp;
DMAETimeStamp
DMAEGetLastSubmittedTimeStamp(void);
DMAETimeStamp
DMAEGetRetiredTimeStamp(void);
/**
* Waits for a DMAE operation to complete.
*
@ -26,6 +33,16 @@ typedef uint64_t DMAETimeStamp;
BOOL
DMAEWaitDone(DMAETimeStamp timestamp);
uint32_t
DMAEGetTimeout(void);
void
DMAESetTimeout(uint32_t timeout);
void
DMAESemaphore(GX2Semaphore *semaphore,
GX2SemaphoreAction action);
#ifdef __cplusplus
}
#endif

View File

@ -348,6 +348,12 @@ typedef enum GX2ScanTarget
WUT_ENUM_BITMASK_TYPE(GX2ScanTarget)
typedef enum GX2SemaphoreAction
{
GX2_SEMAPHORE_ACTION_WAIT = 0,
GX2_SEMAPHORE_ACTION_SIGNAL = 1,
} GX2SemaphoreAction;
typedef enum GX2ShaderMode
{
GX2_SHADER_MODE_UNIFORM_REGISTER = 0,

34
include/gx2/semaphore.h Normal file
View File

@ -0,0 +1,34 @@
#pragma once
#include <wut.h>
#include "enum.h"
/**
* \defgroup gx2_semaphore Semaphore
* \ingroup gx2
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef uint64_t GX2Semaphore;
/**
* Inserts a semaphore into the command stream.
*
* \param semaphore
* Address of the semaphore. Must be aligned by \c 0x8.
*
* \param action
* Semaphore operation to perform.
*/
void
GX2SetSemaphore(GX2Semaphore *semaphore,
GX2SemaphoreAction action);
#ifdef __cplusplus
}
#endif
/** @} */