|
Kore
|
Contains functions for building command-lists to send commands to the GPU. More...
#include <kinc/global.h>#include "rendertarget.h"#include "sampler.h"#include "texture.h"#include "textureunit.h"#include <kinc/backend/graphics5/commandlist.h>#include <stddef.h>Go to the source code of this file.
Data Structures | |
| struct | kinc_g5_command_list |
Macros | |
| #define | KINC_G5_CLEAR_COLOR 1 |
| #define | KINC_G5_CLEAR_DEPTH 2 |
| #define | KINC_G5_CLEAR_STENCIL 4 |
Typedefs | |
| typedef struct kinc_g5_command_list | kinc_g5_command_list_t |
Functions | |
| KINC_FUNC void | kinc_g5_command_list_init (kinc_g5_command_list_t *list) |
| Initializes a command-list. | |
| KINC_FUNC void | kinc_g5_command_list_destroy (kinc_g5_command_list_t *list) |
| Destroys a command-list. | |
| KINC_FUNC void | kinc_g5_command_list_begin (kinc_g5_command_list_t *list) |
| Starts recording commands in a command-list. | |
| KINC_FUNC void | kinc_g5_command_list_end (kinc_g5_command_list_t *list) |
| Ends recording commands for the list. Has to be called after kinc_g5_command_list_begin and before kinc_g5_command_list_execute. | |
| KINC_FUNC void | kinc_g5_command_list_clear (kinc_g5_command_list_t *list, struct kinc_g5_render_target *render_target, unsigned flags, unsigned color, float depth, int stencil) |
| Records a command to clear the color, depth and/or stencil-components of a render-target. | |
| KINC_FUNC void | kinc_g5_command_list_render_target_to_framebuffer_barrier (kinc_g5_command_list_t *list, struct kinc_g5_render_target *renderTarget) |
| Records a command that prepares a render-target to be used as the current framebuffer. | |
| KINC_FUNC void | kinc_g5_command_list_framebuffer_to_render_target_barrier (kinc_g5_command_list_t *list, struct kinc_g5_render_target *renderTarget) |
| Records a command that prepares a render-target for regular render-target-usage after being used as the current framebuffer. | |
| KINC_FUNC void | kinc_g5_command_list_texture_to_render_target_barrier (kinc_g5_command_list_t *list, struct kinc_g5_render_target *renderTarget) |
| Writes a command that prepares a render-target to be rendered to. | |
| KINC_FUNC void | kinc_g5_command_list_render_target_to_texture_barrier (kinc_g5_command_list_t *list, struct kinc_g5_render_target *renderTarget) |
| Writes a command that prepares a render-target to be used for sampling/reading like a texture. | |
| KINC_FUNC void | kinc_g5_command_list_draw_indexed_vertices (kinc_g5_command_list_t *list) |
| Writes a command that draws the entire content of the currently set index-buffer and vertex-buffer. G4 can only draw triangle-lists using vertex-indices as this is what GPUs tend to be optimized for. | |
| KINC_FUNC void | kinc_g5_command_list_draw_indexed_vertices_from_to (kinc_g5_command_list_t *list, int start, int count) |
| Writes a command that draws a part of the content of the currently set index-buffer and vertex-buffer. G4 can only draw triangle-lists using vertex-indices as this is what GPUs tend to be optimized for. | |
| KINC_FUNC void | kinc_g5_command_list_draw_indexed_vertices_from_to_from (kinc_g5_command_list_t *list, int start, int count, int vertex_offset) |
| Writes a command that draws a part of the content of the currently set index-buffer and vertex-buffer and additionally applies a general offset into the vertex-buffer. G4 can only draw triangle-lists using vertex-indices as this is what GPUs tend to be optimized for. | |
| KINC_FUNC void | kinc_g5_command_list_draw_indexed_vertices_instanced (kinc_g5_command_list_t *list, int instanceCount) |
| KINC_FUNC void | kinc_g5_command_list_draw_indexed_vertices_instanced_from_to (kinc_g5_command_list_t *list, int instanceCount, int start, int count) |
| KINC_FUNC void | kinc_g5_command_list_viewport (kinc_g5_command_list_t *list, int x, int y, int width, int height) |
| Writes a command that sets the viewport which defines the portion of the framebuffer or render-target things are rendered into. By default the viewport is equivalent to the full size of the current render-target or framebuffer. | |
| KINC_FUNC void | kinc_g5_command_list_scissor (kinc_g5_command_list_t *list, int x, int y, int width, int height) |
| Writes a command that enables and defines the scissor-rect. When the scissor-rect is enabled, anything that's rendered outside of the scissor-rect will be ignored. | |
| KINC_FUNC void | kinc_g5_command_list_disable_scissor (kinc_g5_command_list_t *list) |
| Writes a command to disable the scissor-rect. | |
| KINC_FUNC void | kinc_g5_command_list_set_pipeline (kinc_g5_command_list_t *list, struct kinc_g5_pipeline *pipeline) |
| Writes a command to set the pipeline for the next draw-call. The pipeline defines most rendering-state including the shaders to be used. | |
| KINC_FUNC void | kinc_g5_command_list_set_compute_shader (kinc_g5_command_list_t *list, struct kinc_g5_compute_shader *shader) |
| Writes a command to set the compute shader for the next compute-call. | |
| KINC_FUNC void | kinc_g5_command_list_set_blend_constant (kinc_g5_command_list_t *list, float r, float g, float b, float a) |
| Sets the blend constant used for KINC_G5_BLEND_CONSTANT or KINC_G5_INV_BLEND_CONSTANT. | |
| KINC_FUNC void | kinc_g5_command_list_set_vertex_buffers (kinc_g5_command_list_t *list, struct kinc_g5_vertex_buffer **buffers, int *offsets, int count) |
| Writes a command which sets vertex-buffers for the next draw-call. | |
| KINC_FUNC void | kinc_g5_command_list_set_index_buffer (kinc_g5_command_list_t *list, struct kinc_g5_index_buffer *buffer) |
| Writes a command to set an index-buffer to be used for the next draw-command. | |
| KINC_FUNC void | kinc_g5_command_list_set_render_targets (kinc_g5_command_list_t *list, struct kinc_g5_render_target **targets, int count) |
| Writes a command that sets the render-targets to draw into in following draw-calls. | |
| KINC_FUNC void | kinc_g5_command_list_upload_index_buffer (kinc_g5_command_list_t *list, struct kinc_g5_index_buffer *buffer) |
| Writes a command to upload an index-buffer that's in main-memory to gpu-memory. Does nothing on unified-memory-systems. | |
| KINC_FUNC void | kinc_g5_command_list_upload_vertex_buffer (kinc_g5_command_list_t *list, struct kinc_g5_vertex_buffer *buffer) |
| Writes a command to upload a vertex-buffer that's in main-memory to gpu-memory. Does nothing on unified-memory-systems. | |
| KINC_FUNC void | kinc_g5_command_list_upload_texture (kinc_g5_command_list_t *list, struct kinc_g5_texture *texture) |
| Writes a command to upload a texture that's in main-memory to gpu-memory. Does nothing on unified-memory-systems. | |
| KINC_FUNC void | kinc_g5_command_list_set_vertex_constant_buffer (kinc_g5_command_list_t *list, struct kinc_g5_constant_buffer *buffer, int offset, size_t size) |
| Writes a command that sets a constant-buffer for the vertex-shader-stage. | |
| KINC_FUNC void | kinc_g5_command_list_set_fragment_constant_buffer (kinc_g5_command_list_t *list, struct kinc_g5_constant_buffer *buffer, int offset, size_t size) |
| Writes a command that sets a constant-buffer for the fragment-shader-stage. | |
| KINC_FUNC void | kinc_g5_command_list_set_compute_constant_buffer (kinc_g5_command_list_t *list, struct kinc_g5_constant_buffer *buffer, int offset, size_t size) |
| Writes a command that sets a constant-buffer for the compute-shader-stage. | |
| KINC_FUNC void | kinc_g5_command_list_execute (kinc_g5_command_list_t *list) |
| Kicks off execution of the commands which have been recorded in the command-list. kinc_g5_command_list_end has to be called beforehand. | |
| KINC_FUNC void | kinc_g5_command_list_wait_for_execution_to_finish (kinc_g5_command_list_t *list) |
| Waits for execution of the command_list to finish. Make sure the command-list is executing before you wait for it. Also take note that waiting for a command-list to finish executing completely is a very expensive operation. | |
| KINC_FUNC void | kinc_g5_command_list_get_render_target_pixels (kinc_g5_command_list_t *list, struct kinc_g5_render_target *render_target, uint8_t *data) |
| Writes a command that copies the contents of a render-target into a cpu-side buffer. Beware: This is enormously slow. | |
| KINC_FUNC void | kinc_g5_command_list_compute (kinc_g5_command_list_t *list, int x, int y, int z) |
| Records a command that fires off a compute-run on x * y * z elements. | |
| KINC_FUNC void | kinc_g5_command_list_set_texture (kinc_g5_command_list_t *list, kinc_g5_texture_unit_t unit, kinc_g5_texture_t *texture) |
| Assigns a texture to a texture-unit for sampled access via GLSL's texture. | |
| KINC_FUNC void | kinc_g5_command_list_set_image_texture (kinc_g5_command_list_t *list, kinc_g5_texture_unit_t unit, kinc_g5_texture_t *texture) |
| Assigns a texture to a texture-unit for direct access via GLSL's texelFetch (as opposed to GLSL's texture). The name of this functions is unfortunately based on OpenGL's confusing terminology. | |
| KINC_FUNC void | kinc_g5_command_list_set_texture_from_render_target (kinc_g5_command_list_t *list, kinc_g5_texture_unit_t unit, kinc_g5_render_target_t *target) |
| Uses the color-component of a render-target as a texture. | |
| KINC_FUNC void | kinc_g5_command_list_set_texture_from_render_target_depth (kinc_g5_command_list_t *list, kinc_g5_texture_unit_t unit, kinc_g5_render_target_t *target) |
| Uses the depth-component of a render-target as a texture. | |
| KINC_FUNC void | kinc_g5_command_list_set_render_target_face (kinc_g5_command_list_t *list, kinc_g5_render_target_t *texture, int face) |
| KINC_FUNC void | kinc_g5_command_list_set_sampler (kinc_g5_command_list_t *list, kinc_g5_texture_unit_t unit, kinc_g5_sampler_t *sampler) |
| KINC_FUNC bool | kinc_g5_command_list_init_occlusion_query (kinc_g5_command_list_t *list, unsigned *occlusionQuery) |
| KINC_FUNC void | kinc_g5_command_list_delete_occlusion_query (kinc_g5_command_list_t *list, unsigned occlusionQuery) |
| KINC_FUNC void | kinc_g5_command_list_render_occlusion_query (kinc_g5_command_list_t *list, unsigned occlusionQuery, int triangles) |
| KINC_FUNC bool | kinc_g5_command_list_are_query_results_available (kinc_g5_command_list_t *list, unsigned occlusionQuery) |
| KINC_FUNC void | kinc_g5_command_list_get_query_result (kinc_g5_command_list_t *list, unsigned occlusionQuery, unsigned *pixelCount) |
Contains functions for building command-lists to send commands to the GPU.
| KINC_FUNC void kinc_g5_command_list_begin | ( | kinc_g5_command_list_t * | list | ) |
Starts recording commands in a command-list.
| list | The list to use |
| KINC_FUNC void kinc_g5_command_list_clear | ( | kinc_g5_command_list_t * | list, |
| struct kinc_g5_render_target * | render_target, | ||
| unsigned | flags, | ||
| unsigned | color, | ||
| float | depth, | ||
| int | stencil ) |
Records a command to clear the color, depth and/or stencil-components of a render-target.
| list | The list to write the command to |
| render_target | The render-target to clear |
| flags | Defines what components to clear |
| color | The color-value to clear to in 0xAARRGGBB |
| depth | The depth-value to clear to |
| stencil | The stencil-value to clear to |
| KINC_FUNC void kinc_g5_command_list_compute | ( | kinc_g5_command_list_t * | list, |
| int | x, | ||
| int | y, | ||
| int | z ) |
Records a command that fires off a compute-run on x * y * z elements.
| list | The list to write the command to |
| x | The x-size for the compute-run |
| y | The y-size for the compute-run |
| z | The z-size for the compute-run |
| KINC_FUNC void kinc_g5_command_list_destroy | ( | kinc_g5_command_list_t * | list | ) |
Destroys a command-list.
| list | The command-list to destroy |
| KINC_FUNC void kinc_g5_command_list_disable_scissor | ( | kinc_g5_command_list_t * | list | ) |
Writes a command to disable the scissor-rect.
| list | The list to write the command to |
| KINC_FUNC void kinc_g5_command_list_draw_indexed_vertices | ( | kinc_g5_command_list_t * | list | ) |
Writes a command that draws the entire content of the currently set index-buffer and vertex-buffer. G4 can only draw triangle-lists using vertex-indices as this is what GPUs tend to be optimized for.
| list | The list to write the command to |
| KINC_FUNC void kinc_g5_command_list_draw_indexed_vertices_from_to | ( | kinc_g5_command_list_t * | list, |
| int | start, | ||
| int | count ) |
Writes a command that draws a part of the content of the currently set index-buffer and vertex-buffer. G4 can only draw triangle-lists using vertex-indices as this is what GPUs tend to be optimized for.
| list | The list to write the command to |
| start | The offset into the index-buffer |
| count | The number of indices to use |
| KINC_FUNC void kinc_g5_command_list_draw_indexed_vertices_from_to_from | ( | kinc_g5_command_list_t * | list, |
| int | start, | ||
| int | count, | ||
| int | vertex_offset ) |
Writes a command that draws a part of the content of the currently set index-buffer and vertex-buffer and additionally applies a general offset into the vertex-buffer. G4 can only draw triangle-lists using vertex-indices as this is what GPUs tend to be optimized for.
| list | The list to write the command to |
| start | The offset into the index-buffer |
| count | The number of indices to use |
| vertex_offset | The offset into the vertex-buffer which is added to each index read from the index-buffer |
| KINC_FUNC void kinc_g5_command_list_end | ( | kinc_g5_command_list_t * | list | ) |
Ends recording commands for the list. Has to be called after kinc_g5_command_list_begin and before kinc_g5_command_list_execute.
| list |
| KINC_FUNC void kinc_g5_command_list_execute | ( | kinc_g5_command_list_t * | list | ) |
Kicks off execution of the commands which have been recorded in the command-list. kinc_g5_command_list_end has to be called beforehand.
| list | The command-list to execute |
| KINC_FUNC void kinc_g5_command_list_framebuffer_to_render_target_barrier | ( | kinc_g5_command_list_t * | list, |
| struct kinc_g5_render_target * | renderTarget ) |
Records a command that prepares a render-target for regular render-target-usage after being used as the current framebuffer.
| list | The list to write the command to |
| renderTarget | The render-target to use in regular render-target-mode |
| KINC_FUNC void kinc_g5_command_list_get_render_target_pixels | ( | kinc_g5_command_list_t * | list, |
| struct kinc_g5_render_target * | render_target, | ||
| uint8_t * | data ) |
Writes a command that copies the contents of a render-target into a cpu-side buffer. Beware: This is enormously slow.
| list | The list to write the command to |
| render_target | The render-target to copy the data from |
| data | The buffer to copy the data into |
| KINC_FUNC void kinc_g5_command_list_init | ( | kinc_g5_command_list_t * | list | ) |
Initializes a command-list.
| list | The command-list to initialize |
| KINC_FUNC void kinc_g5_command_list_render_target_to_framebuffer_barrier | ( | kinc_g5_command_list_t * | list, |
| struct kinc_g5_render_target * | renderTarget ) |
Records a command that prepares a render-target to be used as the current framebuffer.
| list | The list to write the command to |
| renderTarget | The render-target to use as the current framebuffer |
| KINC_FUNC void kinc_g5_command_list_render_target_to_texture_barrier | ( | kinc_g5_command_list_t * | list, |
| struct kinc_g5_render_target * | renderTarget ) |
Writes a command that prepares a render-target to be used for sampling/reading like a texture.
| list | The list to write the command to |
| renderTarget | The render-target to be used like a texture |
| KINC_FUNC void kinc_g5_command_list_scissor | ( | kinc_g5_command_list_t * | list, |
| int | x, | ||
| int | y, | ||
| int | width, | ||
| int | height ) |
Writes a command that enables and defines the scissor-rect. When the scissor-rect is enabled, anything that's rendered outside of the scissor-rect will be ignored.
| list | The list to write the command to |
| x | The x-offset of the scissor-rect from the left of the screen in pixels |
| y | The y-offset of the scissor-rect from the top of the screen in pixels |
| width | The width of the scissor-rect in pixels |
| height | The height of the scissor-rect in pixels |
| KINC_FUNC void kinc_g5_command_list_set_compute_constant_buffer | ( | kinc_g5_command_list_t * | list, |
| struct kinc_g5_constant_buffer * | buffer, | ||
| int | offset, | ||
| size_t | size ) |
Writes a command that sets a constant-buffer for the compute-shader-stage.
| list | The list to write the command to |
| buffer | The buffer to set |
| offset | The offset into the buffer in bytes to use as the start |
| size | The size of the buffer to use in bytes starting at the offset |
| KINC_FUNC void kinc_g5_command_list_set_compute_shader | ( | kinc_g5_command_list_t * | list, |
| struct kinc_g5_compute_shader * | shader ) |
Writes a command to set the compute shader for the next compute-call.
| list | The list to write the command to |
| pipeline | The compute shader to set |
| KINC_FUNC void kinc_g5_command_list_set_fragment_constant_buffer | ( | kinc_g5_command_list_t * | list, |
| struct kinc_g5_constant_buffer * | buffer, | ||
| int | offset, | ||
| size_t | size ) |
Writes a command that sets a constant-buffer for the fragment-shader-stage.
| list | The list to write the command to |
| buffer | The buffer to set |
| offset | The offset into the buffer in bytes to use as the start |
| size | The size of the buffer to use in bytes starting at the offset |
| KINC_FUNC void kinc_g5_command_list_set_image_texture | ( | kinc_g5_command_list_t * | list, |
| kinc_g5_texture_unit_t | unit, | ||
| kinc_g5_texture_t * | texture ) |
Assigns a texture to a texture-unit for direct access via GLSL's texelFetch (as opposed to GLSL's texture). The name of this functions is unfortunately based on OpenGL's confusing terminology.
| list | The list to write the command to |
| unit | The unit to assign this texture to |
| texture | The texture to assign to the unit |
| KINC_FUNC void kinc_g5_command_list_set_index_buffer | ( | kinc_g5_command_list_t * | list, |
| struct kinc_g5_index_buffer * | buffer ) |
Writes a command to set an index-buffer to be used for the next draw-command.
| list | The list to write the command to |
| buffer | The buffer to use |
| KINC_FUNC void kinc_g5_command_list_set_pipeline | ( | kinc_g5_command_list_t * | list, |
| struct kinc_g5_pipeline * | pipeline ) |
Writes a command to set the pipeline for the next draw-call. The pipeline defines most rendering-state including the shaders to be used.
| list | The list to write the command to |
| pipeline | The pipeline to set |
| KINC_FUNC void kinc_g5_command_list_set_render_targets | ( | kinc_g5_command_list_t * | list, |
| struct kinc_g5_render_target ** | targets, | ||
| int | count ) |
Writes a command that sets the render-targets to draw into in following draw-calls.
| list | The list to write the command to |
| targets | The render-targets to use for following-draw calls |
| count | The number of render-targets to use |
| KINC_FUNC void kinc_g5_command_list_set_texture | ( | kinc_g5_command_list_t * | list, |
| kinc_g5_texture_unit_t | unit, | ||
| kinc_g5_texture_t * | texture ) |
Assigns a texture to a texture-unit for sampled access via GLSL's texture.
| list | The list to write the command to |
| unit | The unit to assign this texture to |
| texture | The texture to assign to the unit |
| KINC_FUNC void kinc_g5_command_list_set_texture_from_render_target | ( | kinc_g5_command_list_t * | list, |
| kinc_g5_texture_unit_t | unit, | ||
| kinc_g5_render_target_t * | target ) |
Uses the color-component of a render-target as a texture.
| list | The list to write the command to |
| unit | The texture-unit to assign the render-target to |
| target | The render-target to use |
| KINC_FUNC void kinc_g5_command_list_set_texture_from_render_target_depth | ( | kinc_g5_command_list_t * | list, |
| kinc_g5_texture_unit_t | unit, | ||
| kinc_g5_render_target_t * | target ) |
Uses the depth-component of a render-target as a texture.
| list | The list to write the command to |
| unit | The texture-unit to assign the render-target to |
| target | The render-target to use |
| KINC_FUNC void kinc_g5_command_list_set_vertex_buffers | ( | kinc_g5_command_list_t * | list, |
| struct kinc_g5_vertex_buffer ** | buffers, | ||
| int * | offsets, | ||
| int | count ) |
Writes a command which sets vertex-buffers for the next draw-call.
| list | The list to write the command to |
| buffers | The buffers to set |
| offsets | The offset to use for every buffer in number of vertices |
| count | The number of buffers to set |
| KINC_FUNC void kinc_g5_command_list_set_vertex_constant_buffer | ( | kinc_g5_command_list_t * | list, |
| struct kinc_g5_constant_buffer * | buffer, | ||
| int | offset, | ||
| size_t | size ) |
Writes a command that sets a constant-buffer for the vertex-shader-stage.
| list | The list to write the command to |
| buffer | The buffer to set |
| offset | The offset into the buffer in bytes to use as the start |
| size | The size of the buffer to use in bytes starting at the offset |
| KINC_FUNC void kinc_g5_command_list_texture_to_render_target_barrier | ( | kinc_g5_command_list_t * | list, |
| struct kinc_g5_render_target * | renderTarget ) |
Writes a command that prepares a render-target to be rendered to.
| list | The list to write the command to |
| renderTarget | The render-target to render to |
| KINC_FUNC void kinc_g5_command_list_upload_index_buffer | ( | kinc_g5_command_list_t * | list, |
| struct kinc_g5_index_buffer * | buffer ) |
Writes a command to upload an index-buffer that's in main-memory to gpu-memory. Does nothing on unified-memory-systems.
| list | The list to write the command to |
| buffer | The buffer to upload |
| KINC_FUNC void kinc_g5_command_list_upload_texture | ( | kinc_g5_command_list_t * | list, |
| struct kinc_g5_texture * | texture ) |
Writes a command to upload a texture that's in main-memory to gpu-memory. Does nothing on unified-memory-systems.
| list | The list to write the command to |
| buffer | The texture to upload |
| KINC_FUNC void kinc_g5_command_list_upload_vertex_buffer | ( | kinc_g5_command_list_t * | list, |
| struct kinc_g5_vertex_buffer * | buffer ) |
Writes a command to upload a vertex-buffer that's in main-memory to gpu-memory. Does nothing on unified-memory-systems.
| list | The list to write the command to |
| buffer | The buffer to upload |
| KINC_FUNC void kinc_g5_command_list_viewport | ( | kinc_g5_command_list_t * | list, |
| int | x, | ||
| int | y, | ||
| int | width, | ||
| int | height ) |
Writes a command that sets the viewport which defines the portion of the framebuffer or render-target things are rendered into. By default the viewport is equivalent to the full size of the current render-target or framebuffer.
| list | The list to write the command to |
| x | The x-offset of the viewport from the left of the screen in pixels |
| y | The y-offset of the viewport from the top of the screen in pixels |
| width | The width of the viewport in pixels |
| height | The height of the viewport in pixels |
| KINC_FUNC void kinc_g5_command_list_wait_for_execution_to_finish | ( | kinc_g5_command_list_t * | list | ) |
Waits for execution of the command_list to finish. Make sure the command-list is executing before you wait for it. Also take note that waiting for a command-list to finish executing completely is a very expensive operation.
| list | The command-list to execute |