mirror of
https://github.com/encounter/aurora.git
synced 2026-07-09 18:19:33 -07:00
c05e7aace1
This is a breaking change: `GXSetViewport`, `GXSetScissor`, `GXSetTexCopySrc`, `GXSetTexCopyDst` now accept logical coords relative to the `VIConfigure` EFB size. `GXSetViewportRender` and `GXSetScissorRender` are used to override the scaled viewport/scissor from the logical coords.
130 lines
4.1 KiB
C
130 lines
4.1 KiB
C
#ifndef DOLPHIN_GXAURORA_H
|
|
#define DOLPHIN_GXAURORA_H
|
|
|
|
#include <dolphin/types.h>
|
|
|
|
#if __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
//
|
|
// Subcommands for GX_LOAD_AURORA.
|
|
//
|
|
|
|
/**
|
|
* Sets the actual render viewport in native framebuffer coordinates.
|
|
* Must be followed by six f32 values: left, top, width, height, nearz, farz.
|
|
*/
|
|
#define GX_LOAD_AURORA_VIEWPORT_RENDER 0x0001
|
|
|
|
/**
|
|
* Sets the actual render scissor in native framebuffer coordinates.
|
|
* Must be followed by four u32 values: left, top, width, height.
|
|
*/
|
|
#define GX_LOAD_AURORA_SCISSOR_RENDER 0x0002
|
|
|
|
/**
|
|
* Aurora equivalent of CP_REG_ARRAYBASE_ID: sets the base address and size of a vertex array.
|
|
* This command must be followed by a 64-bit memory address, 32-bit size, and 1-byte little-endian flag.
|
|
* The index of the vertex array is given by the lowest 4 bits of the command ID,
|
|
* e.g. writing GX_LOAD_AURORA_ARRAYBASE + 5 will set the vertex array for the sixth vertex attribute.
|
|
* To set strides, use the normal CP_REG_ARRAYSTRIDE_ID register.
|
|
*/
|
|
#define GX_LOAD_AURORA_ARRAYBASE 0x0010
|
|
|
|
/**
|
|
* Pushes a debug group to the backend graphics API. These may show in debugging tools such as RenderDoc.
|
|
* Must be followed by a u16 string length and that many UTF-8 characters (no null terminator required).
|
|
* It is considered an error to have unpopped debug groups at the end of the frame. They will be automatically cleared.
|
|
*/
|
|
#define GX_LOAD_AURORA_DEBUG_GROUP_PUSH 0x0020
|
|
|
|
/**
|
|
* Pops a previously pushed debug group.
|
|
* Followed by nothing.
|
|
*/
|
|
#define GX_LOAD_AURORA_DEBUG_GROUP_POP 0x0021
|
|
|
|
/**
|
|
* Sends a debug marker to the backend graphics API.
|
|
* Must be followed by a u16 string length and that many UTF-8 characters (no null terminator required).
|
|
*/
|
|
#define GX_LOAD_AURORA_DEBUG_MARKER_INSERT 0x0022
|
|
|
|
#define GX_LOAD_AURORA_TEXOBJ 0x0030
|
|
|
|
#define GX_LOAD_AURORA_TLUT 0x0031
|
|
|
|
#define GX_LOAD_AURORA_DESTROY_TEXOBJ 0x0032
|
|
|
|
#define GX_LOAD_AURORA_DESTROY_TLUT 0x0033
|
|
|
|
|
|
/*
|
|
* Debug marker stuff
|
|
*/
|
|
|
|
/**
|
|
* Pushes a debug group to the backend graphics API. These may show in debugging tools such as RenderDoc.
|
|
* It is considered an error to have unpopped debug groups at the end of the frame. They will be automatically cleared.
|
|
*/
|
|
void GXPushDebugGroup(const char* label);
|
|
|
|
/**
|
|
* Pop a debug group previously pushed via GXPushDebugGroup().
|
|
*/
|
|
void GXPopDebugGroup();
|
|
|
|
/**
|
|
* Sends a debug marker to the backend graphics API. These may show in debugging tools such as RenderDoc.
|
|
*/
|
|
void GXInsertDebugMarker(const char* label);
|
|
|
|
typedef enum _AuroraViewportPolicy {
|
|
AURORA_VIEWPORT_FIT = 0, // Scale logical viewport to fit
|
|
AURORA_VIEWPORT_STRETCH = 1, // Stretch logical viewport to fit (widescreen enabled)
|
|
AURORA_VIEWPORT_NATIVE = 2, // Use native framebuffer resolution
|
|
} AuroraViewportPolicy;
|
|
|
|
/**
|
|
* Configures how GXSetViewport/GXSetScissor parameters are applied to the actual render viewport.
|
|
* When AURORA_VIEWPORT_NATIVE is used, GXSetTexCopySrc/GXSetTexCopyDst will use native framebuffer resolution.
|
|
*/
|
|
void AuroraSetViewportPolicy(AuroraViewportPolicy policy);
|
|
|
|
/**
|
|
* Retrieves the current render size based on the framebuffer size and viewport policy.
|
|
*/
|
|
void AuroraGetRenderSize(u32* width, u32* height);
|
|
|
|
/**
|
|
* Sets the actual render viewport in native framebuffer coordinates.
|
|
* Overrides the automatically scaled values set by the logical GXSetViewport.
|
|
*/
|
|
void GXSetViewportRender(f32 left, f32 top, f32 wd, f32 ht, f32 nearz, f32 farz);
|
|
|
|
/**
|
|
* Sets the actual render scissor in native framebuffer coordinates.
|
|
* Overrides the automatically scaled values set by the logical GXSetScissor.
|
|
*/
|
|
void GXSetScissorRender(u32 left, u32 top, u32 wd, u32 ht);
|
|
|
|
/**
|
|
* Create an offscreen framebuffer and switch rendering to it.
|
|
* All subsequent GX rendering will target this framebuffer until GXRestoreFrameBuffer() is called.
|
|
* Use GXCopyTex to resolve the offscreen content into a texture.
|
|
*/
|
|
void GXCreateFrameBuffer(u32 width, u32 height);
|
|
|
|
/**
|
|
* Restore rendering to the main EFB framebuffer.
|
|
* Must be called after GXCreateFrameBuffer() to resume normal rendering.
|
|
*/
|
|
void GXRestoreFrameBuffer(void);
|
|
|
|
#if __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|