61 lines
1.6 KiB
C
61 lines
1.6 KiB
C
#ifndef RT_GFX_EFFECT_H
|
|
#define RT_GFX_EFFECT_H
|
|
|
|
/* A effect lists the passes during which an object needs to be rendered
|
|
* and a pipeline for each pass.
|
|
* The effect also defines the required vertex layout per pass.
|
|
*/
|
|
|
|
#include "gfx.h"
|
|
#include "renderer_api.h"
|
|
#include "runtime/resources.h"
|
|
|
|
/* *** Resource types *** */
|
|
|
|
typedef struct rt_pipeline_info_s {
|
|
rt_resource_id vertex_shader;
|
|
rt_resource_id fragment_shader;
|
|
rt_resource_id compute_shader;
|
|
|
|
/* TODO(Kevin): Fixed function settings */
|
|
} rt_pipeline_info;
|
|
|
|
typedef struct {
|
|
/* Id of the render pass during which this effect pass is run. */
|
|
uint32_t pass_id;
|
|
rt_resource_id pipeline;
|
|
} rt_effect_pass_info;
|
|
|
|
typedef struct {
|
|
uint32_t pass_count;
|
|
rt_effect_pass_info passes[RT_MAX_SUBRESOURCES];
|
|
} rt_effect_info;
|
|
|
|
/* *** Runtime types *** */
|
|
|
|
typedef struct {
|
|
uint32_t pass_id;
|
|
rt_pipeline_handle pipeline;
|
|
} rt_effect_pass;
|
|
|
|
typedef struct {
|
|
uint32_t pass_count;
|
|
rt_effect_pass passes[RT_MAX_SUBRESOURCES];
|
|
} rt_effect;
|
|
|
|
RT_DLLEXPORT uint32_t rtCalculateRenderTargetID(const char *name, size_t len);
|
|
RT_DLLEXPORT uint32_t rtCalculateRenderPassID(const char *name, size_t len);
|
|
|
|
/* Load an effect from a resource file.
|
|
* Returns:
|
|
* - RT_SUCCESS
|
|
* - RT_OUT_OF_MEMORY, if temporary memory allocations failed
|
|
* - RT_INVALID_VALUE, if id does not refer to an effect resource.
|
|
* - RT_UNKNOWN_ERROR, if a pipeline failed to compile
|
|
* - errors returned by rtGetResource() */
|
|
RT_DLLEXPORT rt_result rtLoadEffect(rt_resource_id id, const rt_effect **effect);
|
|
|
|
RT_DLLEXPORT void rtReleaseEffect(const rt_effect *effect);
|
|
|
|
#endif
|