Kore
Loading...
Searching...
No Matches
commandlist.h
Go to the documentation of this file.
1#pragma once
2
3#include <kinc/global.h>
4
5#include "rendertarget.h"
6#include "sampler.h"
7#include "texture.h"
8#include "textureunit.h"
9
10#include <kinc/backend/graphics5/commandlist.h>
11
12#include <stddef.h>
13
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22#define KINC_G5_CLEAR_COLOR 1
23#define KINC_G5_CLEAR_DEPTH 2
24#define KINC_G5_CLEAR_STENCIL 4
25
29struct kinc_g5_pipeline;
31struct kinc_g5_texture;
34
35/*typedef enum kinc_g5_render_target_format {
36 KINC_G5_RENDER_TARGET_FORMAT_32BIT,
37 KINC_G5_RENDER_TARGET_FORMAT_64BIT_FLOAT,
38 KINC_G5_RENDER_TARGET_FORMAT_32BIT_RED_FLOAT,
39 KINC_G5_RENDER_TARGET_FORMAT_128BIT_FLOAT,
40 KINC_G5_RENDER_TARGET_FORMAT_16BIT_DEPTH,
41 KINC_G5_RENDER_TARGET_FORMAT_8BIT_RED
42} kinc_g5_render_target_format_t;*/
43// typedef kinc_g4_render_target_format_t kinc_g5_render_target_format_t;
44
45typedef struct kinc_g5_command_list {
46 CommandList5Impl impl;
47} kinc_g5_command_list_t;
48
53KINC_FUNC void kinc_g5_command_list_init(kinc_g5_command_list_t *list);
54
59KINC_FUNC void kinc_g5_command_list_destroy(kinc_g5_command_list_t *list);
60
65KINC_FUNC void kinc_g5_command_list_begin(kinc_g5_command_list_t *list);
66
72KINC_FUNC void kinc_g5_command_list_end(kinc_g5_command_list_t *list);
73
83KINC_FUNC void kinc_g5_command_list_clear(kinc_g5_command_list_t *list, struct kinc_g5_render_target *render_target, unsigned flags, unsigned color,
84 float depth, int stencil);
85
91KINC_FUNC void kinc_g5_command_list_render_target_to_framebuffer_barrier(kinc_g5_command_list_t *list, struct kinc_g5_render_target *renderTarget);
92
98KINC_FUNC void kinc_g5_command_list_framebuffer_to_render_target_barrier(kinc_g5_command_list_t *list, struct kinc_g5_render_target *renderTarget);
99
105KINC_FUNC void kinc_g5_command_list_texture_to_render_target_barrier(kinc_g5_command_list_t *list, struct kinc_g5_render_target *renderTarget);
106
112KINC_FUNC void kinc_g5_command_list_render_target_to_texture_barrier(kinc_g5_command_list_t *list, struct kinc_g5_render_target *renderTarget);
113
119KINC_FUNC void kinc_g5_command_list_draw_indexed_vertices(kinc_g5_command_list_t *list);
120
128KINC_FUNC void kinc_g5_command_list_draw_indexed_vertices_from_to(kinc_g5_command_list_t *list, int start, int count);
129
138KINC_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);
139
140KINC_FUNC void kinc_g5_command_list_draw_indexed_vertices_instanced(kinc_g5_command_list_t *list, int instanceCount);
141KINC_FUNC void kinc_g5_command_list_draw_indexed_vertices_instanced_from_to(kinc_g5_command_list_t *list, int instanceCount, int start, int count);
142
152KINC_FUNC void kinc_g5_command_list_viewport(kinc_g5_command_list_t *list, int x, int y, int width, int height);
153
163KINC_FUNC void kinc_g5_command_list_scissor(kinc_g5_command_list_t *list, int x, int y, int width, int height);
164
169KINC_FUNC void kinc_g5_command_list_disable_scissor(kinc_g5_command_list_t *list);
170
176KINC_FUNC void kinc_g5_command_list_set_pipeline(kinc_g5_command_list_t *list, struct kinc_g5_pipeline *pipeline);
177
183KINC_FUNC void kinc_g5_command_list_set_compute_shader(kinc_g5_command_list_t *list, struct kinc_g5_compute_shader *shader);
184
188KINC_FUNC void kinc_g5_command_list_set_blend_constant(kinc_g5_command_list_t *list, float r, float g, float b, float a);
189
197KINC_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);
198
204KINC_FUNC void kinc_g5_command_list_set_index_buffer(kinc_g5_command_list_t *list, struct kinc_g5_index_buffer *buffer);
205
212KINC_FUNC void kinc_g5_command_list_set_render_targets(kinc_g5_command_list_t *list, struct kinc_g5_render_target **targets, int count);
213
219KINC_FUNC void kinc_g5_command_list_upload_index_buffer(kinc_g5_command_list_t *list, struct kinc_g5_index_buffer *buffer);
220
226KINC_FUNC void kinc_g5_command_list_upload_vertex_buffer(kinc_g5_command_list_t *list, struct kinc_g5_vertex_buffer *buffer);
227
233KINC_FUNC void kinc_g5_command_list_upload_texture(kinc_g5_command_list_t *list, struct kinc_g5_texture *texture);
234
242KINC_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);
243
251KINC_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);
252
260KINC_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);
261
266KINC_FUNC void kinc_g5_command_list_execute(kinc_g5_command_list_t *list);
267
273KINC_FUNC void kinc_g5_command_list_wait_for_execution_to_finish(kinc_g5_command_list_t *list);
274
281KINC_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);
282
290KINC_FUNC void kinc_g5_command_list_compute(kinc_g5_command_list_t *list, int x, int y, int z);
291
298KINC_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);
299
308KINC_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);
309
316KINC_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);
317
324KINC_FUNC void kinc_g5_command_list_set_texture_from_render_target_depth(kinc_g5_command_list_t *list, kinc_g5_texture_unit_t unit,
325 kinc_g5_render_target_t *target);
326
327KINC_FUNC void kinc_g5_command_list_set_render_target_face(kinc_g5_command_list_t *list, kinc_g5_render_target_t *texture, int face);
328
329KINC_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);
330
331// Occlusion Query
332KINC_FUNC bool kinc_g5_command_list_init_occlusion_query(kinc_g5_command_list_t *list, unsigned *occlusionQuery);
333KINC_FUNC void kinc_g5_command_list_delete_occlusion_query(kinc_g5_command_list_t *list, unsigned occlusionQuery);
334KINC_FUNC void kinc_g5_command_list_render_occlusion_query(kinc_g5_command_list_t *list, unsigned occlusionQuery, int triangles);
335KINC_FUNC bool kinc_g5_command_list_are_query_results_available(kinc_g5_command_list_t *list, unsigned occlusionQuery);
336KINC_FUNC void kinc_g5_command_list_get_query_result(kinc_g5_command_list_t *list, unsigned occlusionQuery, unsigned *pixelCount);
337
338#ifdef __cplusplus
339}
340#endif
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_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_execute(kinc_g5_command_list_t *list)
Kicks off execution of the commands which have been recorded in the command-list. kinc_g5_command_lis...
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_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_destroy(kinc_g5_command_list_t *list)
Destroys a command-list.
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_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_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-mem...
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_disable_scissor(kinc_g5_command_list_t *list)
Writes a command to disable the scissor-rect.
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....
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_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_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_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_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...
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 tex...
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...
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,...
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 ki...
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_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_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_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....
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...
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_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_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 unifi...
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-stat...
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...
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_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_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 unifi...
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 t...
Provides basic functionality that's used all over the place. There's usually no need to manually incl...
Provides functions for handling render-targets.
Provides functions for handling textures.
Provides a texture-unit-struct which is used for setting textures in a shader.
Provides functions for sampler objects.
Definition commandlist.h:45
Definition compute.h:18
Definition constantbuffer.h:18
Definition indexbuffer.h:17
Definition pipeline.h:71
Definition rendertarget.h:28
Definition texture.h:19
Definition vertexbuffer.h:17