revising shader param API

pull/8/head
cosmonaut 2020-12-18 18:24:22 -08:00
parent 61bdec0357
commit bd4bd74020
4 changed files with 12 additions and 44 deletions

View File

@ -825,15 +825,6 @@ REFRESHAPI REFRESH_Buffer* REFRESH_GenIndexBuffer(
uint32_t sizeInBytes uint32_t sizeInBytes
); );
/* Creates a shader param buffer to be used by shaders.
*
* sizeInBytes: The length of the shader param buffer.
*/
REFRESHAPI REFRESH_Buffer* REFRESH_GenShaderParamBuffer(
REFRESH_Device *device,
uint32_t sizeInBytes
);
/* Setters */ /* Setters */
/* Uploads image data to a 2D texture object. /* Uploads image data to a 2D texture object.
@ -970,16 +961,14 @@ REFRESHAPI void REFRESH_SetIndexBufferData(
/* Pushes shader param data to a buffer. /* Pushes shader param data to a buffer.
* *
* shaderParamBuffer: The buffer to be updated. * pipeline: The graphics pipeline to push shader data to.
* offsetInBytes: The starting offset of the buffer to write into.
* data: The client data to write into the buffer. * data: The client data to write into the buffer.
* elementCount: The number of elements from the client buffer to write. * elementCount: The number of elements from the client buffer to write.
* elementSizeInBytes: The size of each element in the client buffer. * elementSizeInBytes: The size of each element in the client buffer.
*/ */
REFRESHAPI void REFRESH_SetShaderParamData( REFRESHAPI void REFRESH_PushShaderParamData(
REFRESH_Device *device, REFRESH_Device *device,
REFRESH_Buffer *shaderParamBuffer, REFRESH_GraphicsPipeline *pipeline,
uint32_t offsetInBytes,
void *data, void *data,
uint32_t elementCount, uint32_t elementCount,
uint32_t elementSizeInBytes uint32_t elementSizeInBytes

View File

@ -388,17 +388,6 @@ REFRESH_Buffer* REFRESH_GenIndexBuffer(
); );
} }
REFRESH_Buffer* REFRESH_GenShaderParamBuffer(
REFRESH_Device *device,
uint32_t sizeInBytes
) {
NULL_RETURN_NULL(device);
return device->GenShaderParamBuffer(
device->driverData,
sizeInBytes
);
}
void REFRESH_SetTextureData2D( void REFRESH_SetTextureData2D(
REFRESH_Device *device, REFRESH_Device *device,
REFRESH_Texture *texture, REFRESH_Texture *texture,
@ -543,19 +532,17 @@ void REFRESH_SetIndexBufferData(
); );
} }
void REFRESH_SetShaderParamData( void REFRESH_PushShaderParamData(
REFRESH_Device *device, REFRESH_Device *device,
REFRESH_Buffer *shaderParamBuffer, REFRESH_GraphicsPipeline *pipeline,
uint32_t offsetInBytes,
void *data, void *data,
uint32_t elementCount, uint32_t elementCount,
uint32_t elementSizeInBytes uint32_t elementSizeInBytes
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->SetShaderParamData( device->PushShaderParamData(
device->driverData, device->driverData,
shaderParamBuffer, pipeline,
offsetInBytes,
data, data,
elementCount, elementCount,
elementSizeInBytes elementSizeInBytes

View File

@ -284,11 +284,6 @@ struct REFRESH_Device
uint32_t sizeInBytes uint32_t sizeInBytes
); );
REFRESH_Buffer* (*GenShaderParamBuffer)(
REFRESH_Renderer *driverData,
uint32_t sizeInBytes
);
/* Setters */ /* Setters */
void(*SetTextureData2D)( void(*SetTextureData2D)(
@ -360,10 +355,9 @@ struct REFRESH_Device
uint32_t dataLength uint32_t dataLength
); );
void(*SetShaderParamData)( void(*PushShaderParamData)(
REFRESH_Renderer *driverData, REFRESH_Renderer *driverData,
REFRESH_Buffer *shaderParamBuffer, REFRESH_GraphicsPipeline *pipeline,
uint32_t offsetInBytes,
void *data, void *data,
uint32_t elementCount, uint32_t elementCount,
uint32_t elementSizeInBytes uint32_t elementSizeInBytes
@ -519,14 +513,13 @@ struct REFRESH_Device
ASSIGN_DRIVER_FUNC(GenDepthStencilTarget, name) \ ASSIGN_DRIVER_FUNC(GenDepthStencilTarget, name) \
ASSIGN_DRIVER_FUNC(GenVertexBuffer, name) \ ASSIGN_DRIVER_FUNC(GenVertexBuffer, name) \
ASSIGN_DRIVER_FUNC(GenIndexBuffer, name) \ ASSIGN_DRIVER_FUNC(GenIndexBuffer, name) \
ASSIGN_DRIVER_FUNC(GenShaderParamBuffer, name) \
ASSIGN_DRIVER_FUNC(SetTextureData2D, name) \ ASSIGN_DRIVER_FUNC(SetTextureData2D, name) \
ASSIGN_DRIVER_FUNC(SetTextureData3D, name) \ ASSIGN_DRIVER_FUNC(SetTextureData3D, name) \
ASSIGN_DRIVER_FUNC(SetTextureDataCube, name) \ ASSIGN_DRIVER_FUNC(SetTextureDataCube, name) \
ASSIGN_DRIVER_FUNC(SetTextureDataYUV, name) \ ASSIGN_DRIVER_FUNC(SetTextureDataYUV, name) \
ASSIGN_DRIVER_FUNC(SetVertexBufferData, name) \ ASSIGN_DRIVER_FUNC(SetVertexBufferData, name) \
ASSIGN_DRIVER_FUNC(SetIndexBufferData, name) \ ASSIGN_DRIVER_FUNC(SetIndexBufferData, name) \
ASSIGN_DRIVER_FUNC(SetShaderParamData, name) \ ASSIGN_DRIVER_FUNC(PushShaderParamData, name) \
ASSIGN_DRIVER_FUNC(SetVertexSamplers, name) \ ASSIGN_DRIVER_FUNC(SetVertexSamplers, name) \
ASSIGN_DRIVER_FUNC(SetFragmentSamplers, name) \ ASSIGN_DRIVER_FUNC(SetFragmentSamplers, name) \
ASSIGN_DRIVER_FUNC(GetTextureData2D, name) \ ASSIGN_DRIVER_FUNC(GetTextureData2D, name) \

View File

@ -3117,10 +3117,9 @@ static void VULKAN_SetIndexBufferData(
SDL_assert(0); SDL_assert(0);
} }
static void VULKAN_SetShaderParamData( static void VULKAN_PushShaderParamData(
REFRESH_Renderer *driverData, REFRESH_Renderer *driverData,
REFRESH_Buffer *shaderParamBuffer, REFRESH_GraphicsPipeline *pipeline,
uint32_t offsetInBytes,
void *data, void *data,
uint32_t elementCount, uint32_t elementCount,
uint32_t elementSizeInBytes uint32_t elementSizeInBytes