Game no longer crashes on Dolphin
This commit is contained in:
63
src/duskdolphin/display/texture/texturedolphin.h
Normal file
63
src/duskdolphin/display/texture/texturedolphin.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "dusk.h"
|
||||
|
||||
typedef union texturedata_u texturedata_t;
|
||||
|
||||
typedef enum {
|
||||
TEXTURE_FORMAT_RGBA = GX_TF_RGBA8,
|
||||
TEXTURE_FORMAT_PALETTE = GX_TF_CI8,
|
||||
} textureformatdolphin_t;
|
||||
|
||||
typedef struct {
|
||||
GXTexObj texObj;
|
||||
textureformatdolphin_t format;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
} texturedolphin_t;
|
||||
|
||||
/**
|
||||
* Initializes a texture.
|
||||
*
|
||||
* @param texture The texture to initialize.
|
||||
* @param width The width of the texture.
|
||||
* @param height The height of the texture.
|
||||
* @param format The format of the texture (e.g., GX_TF_RGBA8, GX_TF_CI8).
|
||||
* @param data The data for the texture, the format changes per format.
|
||||
* @return An error if the texture failed to initialize, otherwise success.
|
||||
*/
|
||||
errorret_t textureInitDolphin(
|
||||
texturedolphin_t *texture,
|
||||
const int32_t width,
|
||||
const int32_t height,
|
||||
const textureformatdolphin_t format,
|
||||
const texturedata_t data
|
||||
);
|
||||
|
||||
/**
|
||||
* Binds a texture for rendering. Providing NULL will unbind any texture.
|
||||
*
|
||||
* @param texture The texture to bind.
|
||||
* @return An error if the texture failed to bind, otherwise success.
|
||||
*/
|
||||
errorret_t textureBindDolphin(texturedolphin_t *texture);
|
||||
|
||||
/**
|
||||
* Disposes a texture.
|
||||
*
|
||||
* @param texture The texture to dispose.
|
||||
* @return An error if the texture failed to dispose, otherwise success.
|
||||
*/
|
||||
errorret_t textureDisposeDolphin(texturedolphin_t *texture);
|
||||
|
||||
/**
|
||||
* Internal method that uploads the texture environment variables to the GPU
|
||||
* for rendering. This is basically uploading the shader information.
|
||||
*/
|
||||
void textureDolphinUploadTEV(void);
|
||||
Reference in New Issue
Block a user