ObjectivelyGPU
Object oriented graphics framework for SDL3 and C
Loading...
Searching...
No Matches
Texture.c File Reference
#include <assert.h>
#include <math.h>
#include <string.h>
#include "CommandBuffer.h"
#include "CopyPass.h"
#include "Fence.h"
#include "RenderDevice.h"
#include "Texture.h"

Macros

#define _Class   _Texture

Functions

static void dealloc (Object *self)
static void uploadPixels (Texture *self, const void *pixels, Uint32 size, Uint32 pixelsPerRow)
 Uploads size bytes of pixel data into mip level 0 of this texture.
static Texture * initWithDevice (Texture *self, RenderDevice *device, const SDL_GPUTextureCreateInfo *info, const void *pixels)
static Texture * initWithSurface (Texture *self, RenderDevice *device, SDL_Surface *surface, SDL_GPUTextureUsageFlags usage, bool generateMipmaps)
static void setName (Texture *self, const char *name)
static void * downloadPixels (const Texture *self)
static void initialize (Class *clazz)
Class * _Texture (void)

Macro Definition Documentation

◆ _Class

#define _Class   _Texture

Function Documentation

◆ _Texture()

Class * _Texture ( void )

◆ dealloc()

void dealloc ( Object * self)
static
See also
Object::dealloc(Object *)

◆ downloadPixels()

void * downloadPixels ( const Texture * self)
static

◆ initialize()

void initialize ( Class * clazz)
static
See also
Class::initialize(Class *)

◆ initWithDevice()

Texture * initWithDevice ( Texture * self,
RenderDevice * device,
const SDL_GPUTextureCreateInfo * info,
const void * pixels )
static

◆ initWithSurface()

Texture * initWithSurface ( Texture * self,
RenderDevice * device,
SDL_Surface * surface,
SDL_GPUTextureUsageFlags usage,
bool generateMipmaps )
static

◆ setName()

void setName ( Texture * self,
const char * name )
static

◆ uploadPixels()

void uploadPixels ( Texture * self,
const void * pixels,
Uint32 size,
Uint32 pixelsPerRow )
static

Uploads size bytes of pixel data into mip level 0 of this texture.

The source data is laid out at pixelsPerRow pixels (texels) per row, so callers can pass strided data (e.g. an SDL_Surface with row padding) without first tightening it. The texture's dimensions and layer count come from its metadata, so this must be called after initWithDevice has populated them.