implement texture creation

submit_rewrite
cosmonaut 2020-12-18 14:35:33 -08:00
parent 5e5515fbe8
commit a6f13dff8d
4 changed files with 1036 additions and 20 deletions

View File

@ -57,6 +57,7 @@ extern "C" {
typedef struct REFRESH_Device REFRESH_Device;
typedef struct REFRESH_Buffer REFRESH_Buffer;
typedef struct REFRESH_Texture REFRESH_Texture;
typedef struct REFRESH_DepthStencilTexture REFRESH_DepthStencilTexture;
typedef struct REFRESH_Sampler REFRESH_Sampler;
typedef struct REFRESH_ColorTarget REFRESH_ColorTarget;
typedef struct REFRESH_DepthStencilTarget REFRESH_DepthStencilTarget;
@ -735,7 +736,8 @@ REFRESHAPI REFRESH_Texture* REFRESH_CreateTexture2D(
REFRESH_SurfaceFormat format,
uint32_t width,
uint32_t height,
uint32_t levelCount
uint32_t levelCount,
uint8_t canBeRenderTarget
);
/* Creates a 3D texture.
@ -755,7 +757,8 @@ REFRESHAPI REFRESH_Texture* REFRESH_CreateTexture3D(
uint32_t width,
uint32_t height,
uint32_t depth,
uint32_t levelCount
uint32_t levelCount,
uint8_t canBeRenderTarget
);
/* Creates a texture cube.
@ -771,7 +774,24 @@ REFRESHAPI REFRESH_Texture* REFRESH_CreateTextureCube(
REFRESH_Device *device,
REFRESH_SurfaceFormat format,
uint32_t size,
uint32_t levelCount
uint32_t levelCount,
uint8_t canBeRenderTarget
);
/* Creates a depth/stencil texture to be used with a DepthStencilTarget.
*
* format: The pixel format of the depth/stencil data.
* width: The width of the texture.
* height: The height of the texture.
*
* Returns an allocated REFRESH_Texture* object. Note that the contents of
* the texture are undefined until SetData is called.
*/
REFRESHAPI REFRESH_DepthStencilTexture* REFRESH_CreateTextureDepthStencil(
REFRESH_Device *device,
REFRESH_DepthFormat format,
uint32_t width,
uint32_t height
);
/* Creates a color target.

View File

@ -286,7 +286,8 @@ REFRESH_Texture* REFRESH_CreateTexture2D(
REFRESH_SurfaceFormat format,
uint32_t width,
uint32_t height,
uint32_t levelCount
uint32_t levelCount,
uint8_t canBeRenderTarget
) {
NULL_RETURN_NULL(device);
return device->CreateTexture2D(
@ -294,7 +295,8 @@ REFRESH_Texture* REFRESH_CreateTexture2D(
format,
width,
height,
levelCount
levelCount,
canBeRenderTarget
);
}
@ -304,7 +306,8 @@ REFRESH_Texture* REFRESH_CreateTexture3D(
uint32_t width,
uint32_t height,
uint32_t depth,
uint32_t levelCount
uint32_t levelCount,
uint8_t canBeRenderTarget
) {
NULL_RETURN_NULL(device);
return device->CreateTexture3D(
@ -313,7 +316,8 @@ REFRESH_Texture* REFRESH_CreateTexture3D(
width,
height,
depth,
levelCount
levelCount,
canBeRenderTarget
);
}
@ -321,14 +325,31 @@ REFRESH_Texture* REFRESH_CreateTextureCube(
REFRESH_Device *device,
REFRESH_SurfaceFormat format,
uint32_t size,
uint32_t levelCount
uint32_t levelCount,
uint8_t canBeRenderTarget
) {
NULL_RETURN_NULL(device);
return device->CreateTextureCube(
device->driverData,
format,
size,
levelCount
levelCount,
canBeRenderTarget
);
}
REFRESH_DepthStencilTexture* REFRESH_CreateTextureDepthStencil(
REFRESH_Device *device,
REFRESH_DepthFormat format,
uint32_t width,
uint32_t height
) {
NULL_RETURN_NULL(device);
return device->CreateTextureDepthStencil(
device->driverData,
format,
width,
height
);
}

View File

@ -239,7 +239,8 @@ struct REFRESH_Device
REFRESH_SurfaceFormat format,
uint32_t width,
uint32_t height,
uint32_t levelCount
uint32_t levelCount,
uint8_t canBeRenderTarget
);
REFRESH_Texture* (*CreateTexture3D)(
@ -248,14 +249,23 @@ struct REFRESH_Device
uint32_t width,
uint32_t height,
uint32_t depth,
uint32_t levelCount
uint32_t levelCount,
uint8_t canBeRenderTarget
);
REFRESH_Texture* (*CreateTextureCube)(
REFRESH_Renderer *driverData,
REFRESH_SurfaceFormat format,
uint32_t size,
uint32_t levelCount
uint32_t levelCount,
uint8_t canBeRenderTarget
);
REFRESH_DepthStencilTexture* (*CreateTextureDepthStencil)(
REFRESH_Renderer *driverData,
REFRESH_DepthFormat format,
uint32_t width,
uint32_t height
);
REFRESH_ColorTarget* (*GenColorTarget)(
@ -516,6 +526,7 @@ struct REFRESH_Device
ASSIGN_DRIVER_FUNC(CreateTexture2D, name) \
ASSIGN_DRIVER_FUNC(CreateTexture3D, name) \
ASSIGN_DRIVER_FUNC(CreateTextureCube, name) \
ASSIGN_DRIVER_FUNC(CreateTextureDepthStencil, name) \
ASSIGN_DRIVER_FUNC(GenColorTarget, name) \
ASSIGN_DRIVER_FUNC(GenDepthStencilTarget, name) \
ASSIGN_DRIVER_FUNC(GenVertexBuffer, name) \

File diff suppressed because it is too large Load Diff