Update Files
This commit is contained in:
1
Kha/Kinc/Sources/kinc/graphics5/commandlist.c.h
Normal file
1
Kha/Kinc/Sources/kinc/graphics5/commandlist.c.h
Normal file
@ -0,0 +1 @@
|
||||
#include "commandlist.h"
|
340
Kha/Kinc/Sources/kinc/graphics5/commandlist.h
Normal file
340
Kha/Kinc/Sources/kinc/graphics5/commandlist.h
Normal file
@ -0,0 +1,340 @@
|
||||
#pragma once
|
||||
|
||||
#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>
|
||||
|
||||
/*! \file commandlist.h
|
||||
\brief Contains functions for building command-lists to send commands to the GPU.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define KINC_G5_CLEAR_COLOR 1
|
||||
#define KINC_G5_CLEAR_DEPTH 2
|
||||
#define KINC_G5_CLEAR_STENCIL 4
|
||||
|
||||
struct kinc_g5_compute_shader;
|
||||
struct kinc_g5_constant_buffer;
|
||||
struct kinc_g5_index_buffer;
|
||||
struct kinc_g5_pipeline;
|
||||
struct kinc_g5_render_target;
|
||||
struct kinc_g5_texture;
|
||||
struct kinc_g5_vertex_buffer;
|
||||
struct kinc_g5_render_target;
|
||||
|
||||
/*typedef enum kinc_g5_render_target_format {
|
||||
KINC_G5_RENDER_TARGET_FORMAT_32BIT,
|
||||
KINC_G5_RENDER_TARGET_FORMAT_64BIT_FLOAT,
|
||||
KINC_G5_RENDER_TARGET_FORMAT_32BIT_RED_FLOAT,
|
||||
KINC_G5_RENDER_TARGET_FORMAT_128BIT_FLOAT,
|
||||
KINC_G5_RENDER_TARGET_FORMAT_16BIT_DEPTH,
|
||||
KINC_G5_RENDER_TARGET_FORMAT_8BIT_RED
|
||||
} kinc_g5_render_target_format_t;*/
|
||||
// typedef kinc_g4_render_target_format_t kinc_g5_render_target_format_t;
|
||||
|
||||
typedef struct kinc_g5_command_list {
|
||||
CommandList5Impl impl;
|
||||
} kinc_g5_command_list_t;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a command-list.
|
||||
/// </summary>
|
||||
/// <param name="list">The command-list to initialize</param>
|
||||
KINC_FUNC void kinc_g5_command_list_init(kinc_g5_command_list_t *list);
|
||||
|
||||
/// <summary>
|
||||
/// Destroys a command-list.
|
||||
/// </summary>
|
||||
/// <param name="list">The command-list to destroy</param>
|
||||
KINC_FUNC void kinc_g5_command_list_destroy(kinc_g5_command_list_t *list);
|
||||
|
||||
/// <summary>
|
||||
/// Starts recording commands in a command-list.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to use</param>
|
||||
KINC_FUNC void kinc_g5_command_list_begin(kinc_g5_command_list_t *list);
|
||||
|
||||
/// <summary>
|
||||
/// Ends recording commands for the list. Has to be called after kinc_g5_command_list_begin and before kinc_g5_command_list_execute.
|
||||
/// </summary>
|
||||
/// <param name="list"></param>
|
||||
/// <returns></returns>
|
||||
KINC_FUNC void kinc_g5_command_list_end(kinc_g5_command_list_t *list);
|
||||
|
||||
/// <summary>
|
||||
/// Records a command to clear the color, depth and/or stencil-components of a render-target.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="render_target">The render-target to clear</param>
|
||||
/// <param name="flags">Defines what components to clear</param>
|
||||
/// <param name="color">The color-value to clear to in 0xAARRGGBB</param>
|
||||
/// <param name="depth">The depth-value to clear to</param>
|
||||
/// <param name="stencil">The stencil-value to clear to</param>
|
||||
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);
|
||||
|
||||
/// <summary>
|
||||
/// Records a command that prepares a render-target to be used as the current framebuffer.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="renderTarget">The render-target to use as the current framebuffer</param>
|
||||
KINC_FUNC void kinc_g5_command_list_render_target_to_framebuffer_barrier(kinc_g5_command_list_t *list, struct kinc_g5_render_target *renderTarget);
|
||||
|
||||
/// <summary>
|
||||
/// Records a command that prepares a render-target for regular render-target-usage after being used as the current framebuffer.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="renderTarget">The render-target to use in regular render-target-mode</param>
|
||||
KINC_FUNC void kinc_g5_command_list_framebuffer_to_render_target_barrier(kinc_g5_command_list_t *list, struct kinc_g5_render_target *renderTarget);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a command that prepares a render-target to be rendered to.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="renderTarget">The render-target to render to</param>
|
||||
KINC_FUNC void kinc_g5_command_list_texture_to_render_target_barrier(kinc_g5_command_list_t *list, struct kinc_g5_render_target *renderTarget);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a command that prepares a render-target to be used for sampling/reading like a texture.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="renderTarget">The render-target to be used like a texture</param>
|
||||
KINC_FUNC void kinc_g5_command_list_render_target_to_texture_barrier(kinc_g5_command_list_t *list, struct kinc_g5_render_target *renderTarget);
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
KINC_FUNC void kinc_g5_command_list_draw_indexed_vertices(kinc_g5_command_list_t *list);
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="start">The offset into the index-buffer</param>
|
||||
/// <param name="count">The number of indices to use</param>
|
||||
KINC_FUNC void kinc_g5_command_list_draw_indexed_vertices_from_to(kinc_g5_command_list_t *list, int start, int count);
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="start">The offset into the index-buffer</param>
|
||||
/// <param name="count">The number of indices to use</param>
|
||||
/// <param name="vertex_offset">The offset into the vertex-buffer which is added to each index read from the index-buffer</param>
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="x">The x-offset of the viewport from the left of the screen in pixels</param>
|
||||
/// <param name="y">The y-offset of the viewport from the top of the screen in pixels</param>
|
||||
/// <param name="width">The width of the viewport in pixels</param>
|
||||
/// <param name="height">The height of the viewport in pixels</param>
|
||||
KINC_FUNC void kinc_g5_command_list_viewport(kinc_g5_command_list_t *list, int x, int y, int width, int height);
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="x">The x-offset of the scissor-rect from the left of the screen in pixels</param>
|
||||
/// <param name="y">The y-offset of the scissor-rect from the top of the screen in pixels</param>
|
||||
/// <param name="width">The width of the scissor-rect in pixels</param>
|
||||
/// <param name="height">The height of the scissor-rect in pixels</param>
|
||||
KINC_FUNC void kinc_g5_command_list_scissor(kinc_g5_command_list_t *list, int x, int y, int width, int height);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a command to disable the scissor-rect.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
KINC_FUNC void kinc_g5_command_list_disable_scissor(kinc_g5_command_list_t *list);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a command to set the pipeline for the next draw-call. The pipeline defines most rendering-state including the shaders to be used.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="pipeline">The pipeline to set</param>
|
||||
KINC_FUNC void kinc_g5_command_list_set_pipeline(kinc_g5_command_list_t *list, struct kinc_g5_pipeline *pipeline);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a command to set the compute shader for the next compute-call.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="pipeline">The compute shader to set</param>
|
||||
KINC_FUNC void kinc_g5_command_list_set_compute_shader(kinc_g5_command_list_t *list, struct kinc_g5_compute_shader *shader);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the blend constant used for `KINC_G5_BLEND_CONSTANT` or `KINC_G5_INV_BLEND_CONSTANT`
|
||||
/// </summary>
|
||||
KINC_FUNC void kinc_g5_command_list_set_blend_constant(kinc_g5_command_list_t *list, float r, float g, float b, float a);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a command which sets vertex-buffers for the next draw-call.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="buffers">The buffers to set</param>
|
||||
/// <param name="offsets">The offset to use for every buffer in number of vertices</param>
|
||||
/// <param name="count">The number of buffers to set</param>
|
||||
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);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a command to set an index-buffer to be used for the next draw-command.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="buffer">The buffer to use</param>
|
||||
KINC_FUNC void kinc_g5_command_list_set_index_buffer(kinc_g5_command_list_t *list, struct kinc_g5_index_buffer *buffer);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a command that sets the render-targets to draw into in following draw-calls.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="targets">The render-targets to use for following-draw calls</param>
|
||||
/// <param name="count">The number of render-targets to use</param>
|
||||
KINC_FUNC void kinc_g5_command_list_set_render_targets(kinc_g5_command_list_t *list, struct kinc_g5_render_target **targets, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a command to upload an index-buffer that's in main-memory to gpu-memory. Does nothing on unified-memory-systems.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="buffer">The buffer to upload</param>
|
||||
KINC_FUNC void kinc_g5_command_list_upload_index_buffer(kinc_g5_command_list_t *list, struct kinc_g5_index_buffer *buffer);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a command to upload a vertex-buffer that's in main-memory to gpu-memory. Does nothing on unified-memory-systems.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="buffer">The buffer to upload</param>
|
||||
KINC_FUNC void kinc_g5_command_list_upload_vertex_buffer(kinc_g5_command_list_t *list, struct kinc_g5_vertex_buffer *buffer);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a command to upload a texture that's in main-memory to gpu-memory. Does nothing on unified-memory-systems.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="buffer">The texture to upload</param>
|
||||
KINC_FUNC void kinc_g5_command_list_upload_texture(kinc_g5_command_list_t *list, struct kinc_g5_texture *texture);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a command that sets a constant-buffer for the vertex-shader-stage.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="buffer">The buffer to set</param>
|
||||
/// <param name="offset">The offset into the buffer in bytes to use as the start</param>
|
||||
/// <param name="size">The size of the buffer to use in bytes starting at the offset</param>
|
||||
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);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a command that sets a constant-buffer for the fragment-shader-stage.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="buffer">The buffer to set</param>
|
||||
/// <param name="offset">The offset into the buffer in bytes to use as the start</param>
|
||||
/// <param name="size">The size of the buffer to use in bytes starting at the offset</param>
|
||||
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);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a command that sets a constant-buffer for the compute-shader-stage.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="buffer">The buffer to set</param>
|
||||
/// <param name="offset">The offset into the buffer in bytes to use as the start</param>
|
||||
/// <param name="size">The size of the buffer to use in bytes starting at the offset</param>
|
||||
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);
|
||||
|
||||
/// <summary>
|
||||
/// Kicks off execution of the commands which have been recorded in the command-list. kinc_g5_command_list_end has to be called beforehand.
|
||||
/// </summary>
|
||||
/// <param name="list">The command-list to execute</param>
|
||||
KINC_FUNC void kinc_g5_command_list_execute(kinc_g5_command_list_t *list);
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="list">The command-list to execute</param>
|
||||
KINC_FUNC void kinc_g5_command_list_wait_for_execution_to_finish(kinc_g5_command_list_t *list);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a command that copies the contents of a render-target into a cpu-side buffer. Beware: This is enormously slow.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="render_target">The render-target to copy the data from</param>
|
||||
/// <param name="data">The buffer to copy the data into</param>
|
||||
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);
|
||||
|
||||
/// <summary>
|
||||
/// Records a command that fires off a compute-run on x * y * z elements.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="x">The x-size for the compute-run</param>
|
||||
/// <param name="y">The y-size for the compute-run</param>
|
||||
/// <param name="z">The z-size for the compute-run</param>
|
||||
KINC_FUNC void kinc_g5_command_list_compute(kinc_g5_command_list_t *list, int x, int y, int z);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns a texture to a texture-unit for sampled access via GLSL's texture.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="unit">The unit to assign this texture to</param>
|
||||
/// <param name="texture">The texture to assign to the unit</param>
|
||||
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);
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="unit">The unit to assign this texture to</param>
|
||||
/// <param name="texture">The texture to assign to the unit</param>
|
||||
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);
|
||||
|
||||
/// <summary>
|
||||
/// Uses the color-component of a render-target as a texture.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="unit">The texture-unit to assign the render-target to</param>
|
||||
/// <param name="target">The render-target to use</param>
|
||||
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);
|
||||
|
||||
/// <summary>
|
||||
/// Uses the depth-component of a render-target as a texture.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to write the command to</param>
|
||||
/// <param name="unit">The texture-unit to assign the render-target to</param>
|
||||
/// <param name="target">The render-target to use</param>
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
// Occlusion Query
|
||||
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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
56
Kha/Kinc/Sources/kinc/graphics5/compute.h
Normal file
56
Kha/Kinc/Sources/kinc/graphics5/compute.h
Normal file
@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
|
||||
#include <kinc/global.h>
|
||||
|
||||
#include <kinc/backend/graphics5/compute.h>
|
||||
|
||||
#include <kinc/graphics5/constantlocation.h>
|
||||
#include <kinc/graphics5/textureunit.h>
|
||||
|
||||
/*! \file compute.h
|
||||
\brief Provides support for running compute-shaders.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct kinc_g5_compute_shader {
|
||||
kinc_g5_compute_shader_impl impl;
|
||||
} kinc_g5_compute_shader;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize a compute-shader from system-specific shader-data.
|
||||
/// </summary>
|
||||
/// <param name="shader">The shader-object to initialize</param>
|
||||
/// <param name="source">A pointer to system-specific shader-data</param>
|
||||
/// <param name="length">Length of the shader-data in bytes</param>
|
||||
KINC_FUNC void kinc_g5_compute_shader_init(kinc_g5_compute_shader *shader, void *source, int length);
|
||||
|
||||
/// <summary>
|
||||
/// Desotry a shader-object
|
||||
/// </summary>
|
||||
/// <param name="shader">The shader-object to destroy</param>
|
||||
KINC_FUNC void kinc_g5_compute_shader_destroy(kinc_g5_compute_shader *shader);
|
||||
|
||||
#ifndef KINC_KONG
|
||||
/// <summary>
|
||||
/// Finds the location of a constant/uniform inside of a shader.
|
||||
/// </summary>
|
||||
/// <param name="shader">The shader to look into</param>
|
||||
/// <param name="name">The constant/uniform-name to look for</param>
|
||||
/// <returns>The found constant-location</returns>
|
||||
KINC_FUNC kinc_g5_constant_location_t kinc_g5_compute_shader_get_constant_location(kinc_g5_compute_shader *shader, const char *name);
|
||||
|
||||
/// <summary>
|
||||
/// Finds a texture-unit inside of a shader.
|
||||
/// </summary>
|
||||
/// <param name="shader">The shader to look into</param>
|
||||
/// <param name="name">The texture-name to look for</param>
|
||||
/// <returns>The found texture-unit</returns>
|
||||
KINC_FUNC kinc_g5_texture_unit_t kinc_g5_compute_shader_get_texture_unit(kinc_g5_compute_shader *shader, const char *name);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
112
Kha/Kinc/Sources/kinc/graphics5/constantbuffer.c.h
Normal file
112
Kha/Kinc/Sources/kinc/graphics5/constantbuffer.c.h
Normal file
@ -0,0 +1,112 @@
|
||||
#include "constantbuffer.h"
|
||||
|
||||
void kinc_g5_constant_buffer_set_int(kinc_g5_constant_buffer_t *buffer, int offset, int value) {
|
||||
int *ints = (int *)(&buffer->data[offset]);
|
||||
ints[0] = value;
|
||||
}
|
||||
|
||||
void kinc_g5_constant_buffer_set_int2(kinc_g5_constant_buffer_t *buffer, int offset, int value1, int value2) {
|
||||
int *ints = (int *)(&buffer->data[offset]);
|
||||
ints[0] = value1;
|
||||
ints[1] = value2;
|
||||
}
|
||||
|
||||
void kinc_g5_constant_buffer_set_int3(kinc_g5_constant_buffer_t *buffer, int offset, int value1, int value2, int value3) {
|
||||
int *ints = (int *)(&buffer->data[offset]);
|
||||
ints[0] = value1;
|
||||
ints[1] = value2;
|
||||
ints[2] = value3;
|
||||
}
|
||||
|
||||
void kinc_g5_constant_buffer_set_int4(kinc_g5_constant_buffer_t *buffer, int offset, int value1, int value2, int value3, int value4) {
|
||||
int *ints = (int *)(&buffer->data[offset]);
|
||||
ints[0] = value1;
|
||||
ints[1] = value2;
|
||||
ints[2] = value3;
|
||||
ints[3] = value4;
|
||||
}
|
||||
|
||||
void kinc_g5_constant_buffer_set_ints(kinc_g5_constant_buffer_t *buffer, int offset, int *values, int count) {
|
||||
int *ints = (int *)(&buffer->data[offset]);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
ints[i] = values[i];
|
||||
}
|
||||
}
|
||||
|
||||
void kinc_g5_constant_buffer_set_float(kinc_g5_constant_buffer_t *buffer, int offset, float value) {
|
||||
float *floats = (float *)(&buffer->data[offset]);
|
||||
floats[0] = value;
|
||||
}
|
||||
|
||||
void kinc_g5_constant_buffer_set_float2(kinc_g5_constant_buffer_t *buffer, int offset, float value1, float value2) {
|
||||
float *floats = (float *)(&buffer->data[offset]);
|
||||
floats[0] = value1;
|
||||
floats[1] = value2;
|
||||
}
|
||||
|
||||
void kinc_g5_constant_buffer_set_float3(kinc_g5_constant_buffer_t *buffer, int offset, float value1, float value2, float value3) {
|
||||
float *floats = (float *)(&buffer->data[offset]);
|
||||
floats[0] = value1;
|
||||
floats[1] = value2;
|
||||
floats[2] = value3;
|
||||
}
|
||||
|
||||
void kinc_g5_constant_buffer_set_float4(kinc_g5_constant_buffer_t *buffer, int offset, float value1, float value2, float value3, float value4) {
|
||||
float *floats = (float *)(&buffer->data[offset]);
|
||||
floats[0] = value1;
|
||||
floats[1] = value2;
|
||||
floats[2] = value3;
|
||||
floats[3] = value4;
|
||||
}
|
||||
|
||||
void kinc_g5_constant_buffer_set_floats(kinc_g5_constant_buffer_t *buffer, int offset, float *values, int count) {
|
||||
float *floats = (float *)(&buffer->data[offset]);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
floats[i] = values[i];
|
||||
}
|
||||
}
|
||||
|
||||
void kinc_g5_constant_buffer_set_bool(kinc_g5_constant_buffer_t *buffer, int offset, bool value) {
|
||||
int *ints = (int *)(&buffer->data[offset]);
|
||||
ints[0] = value ? 1 : 0;
|
||||
}
|
||||
|
||||
static void set_matrix3(uint8_t *constants, int offset, kinc_matrix3x3_t *value) {
|
||||
float *floats = (float *)(&constants[offset]);
|
||||
for (int y = 0; y < 3; ++y) {
|
||||
for (int x = 0; x < 3; ++x) {
|
||||
floats[x + y * 4] = kinc_matrix3x3_get(value, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void kinc_g5_constant_buffer_set_matrix3(kinc_g5_constant_buffer_t *buffer, int offset, kinc_matrix3x3_t *value) {
|
||||
if (kinc_g5_transposeMat3) {
|
||||
kinc_matrix3x3_t m = *value;
|
||||
kinc_matrix3x3_transpose(&m);
|
||||
set_matrix3(buffer->data, offset, &m);
|
||||
}
|
||||
else {
|
||||
set_matrix3(buffer->data, offset, value);
|
||||
}
|
||||
}
|
||||
|
||||
static void set_matrix4(uint8_t *constants, int offset, kinc_matrix4x4_t *value) {
|
||||
float *floats = (float *)(&constants[offset]);
|
||||
for (int y = 0; y < 4; ++y) {
|
||||
for (int x = 0; x < 4; ++x) {
|
||||
floats[x + y * 4] = kinc_matrix4x4_get(value, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void kinc_g5_constant_buffer_set_matrix4(kinc_g5_constant_buffer_t *buffer, int offset, kinc_matrix4x4_t *value) {
|
||||
if (kinc_g5_transposeMat4) {
|
||||
kinc_matrix4x4_t m = *value;
|
||||
kinc_matrix4x4_transpose(&m);
|
||||
set_matrix4(buffer->data, offset, &m);
|
||||
}
|
||||
else {
|
||||
set_matrix4(buffer->data, offset, value);
|
||||
}
|
||||
}
|
175
Kha/Kinc/Sources/kinc/graphics5/constantbuffer.h
Normal file
175
Kha/Kinc/Sources/kinc/graphics5/constantbuffer.h
Normal file
@ -0,0 +1,175 @@
|
||||
#pragma once
|
||||
|
||||
#include <kinc/global.h>
|
||||
|
||||
#include <kinc/backend/graphics5/constantbuffer.h>
|
||||
|
||||
#include <kinc/math/matrix.h>
|
||||
#include <kinc/math/vector.h>
|
||||
|
||||
/*! \file constantbuffer.h
|
||||
\brief Provides support for managing buffers of constant-data for shaders.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct kinc_g5_constant_buffer {
|
||||
uint8_t *data;
|
||||
ConstantBuffer5Impl impl;
|
||||
} kinc_g5_constant_buffer_t;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a constant-buffer.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to initialize</param>
|
||||
/// <param name="size">The size of the constant-data in the buffer in bytes</param>
|
||||
KINC_FUNC void kinc_g5_constant_buffer_init(kinc_g5_constant_buffer_t *buffer, int size);
|
||||
|
||||
/// <summary>
|
||||
/// Destroys a buffer.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to destroy</param>
|
||||
KINC_FUNC void kinc_g5_constant_buffer_destroy(kinc_g5_constant_buffer_t *buffer);
|
||||
|
||||
/// <summary>
|
||||
/// Locks all of a constant-buffer to modify its contents.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to lock</param>
|
||||
/// <returns>The contents of the buffer</returns>
|
||||
KINC_FUNC void kinc_g5_constant_buffer_lock_all(kinc_g5_constant_buffer_t *buffer);
|
||||
|
||||
/// <summary>
|
||||
/// Locks part of a constant-buffer to modify its contents.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to lock</param>
|
||||
/// <param name="start">The offset of where to start the lock in bytes</param>
|
||||
/// <param name="count">The number of bytes to lock</param>
|
||||
/// <returns>The contents of the buffer, starting at start</returns>
|
||||
KINC_FUNC void kinc_g5_constant_buffer_lock(kinc_g5_constant_buffer_t *buffer, int start, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Unlocks a constant-buffer so the changed contents can be used.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to unlock</param>
|
||||
KINC_FUNC void kinc_g5_constant_buffer_unlock(kinc_g5_constant_buffer_t *buffer);
|
||||
|
||||
/// <summary>
|
||||
/// Figures out the size of the constant-data in the buffer.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to figure out the size for</param>
|
||||
/// <returns>Returns the size of the constant-data in the buffer in bytes</returns>
|
||||
KINC_FUNC int kinc_g5_constant_buffer_size(kinc_g5_constant_buffer_t *buffer);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns a bool at an offset in a constant-buffer.
|
||||
/// </summary>
|
||||
/// <param name="offset">The offset at which to write the data</param>
|
||||
/// <param name="value">The value to write into the buffer</param>
|
||||
KINC_FUNC void kinc_g5_constant_buffer_set_bool(kinc_g5_constant_buffer_t *buffer, int offset, bool value);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns an integer at an offset in a constant-buffer.
|
||||
/// </summary>
|
||||
/// <param name="offset">The offset at which to write the data</param>
|
||||
/// <param name="value">The value to assign to the constant/uniform</param>
|
||||
KINC_FUNC void kinc_g5_constant_buffer_set_int(kinc_g5_constant_buffer_t *buffer, int offset, int value);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns two integers at an offset in a constant-buffer.
|
||||
/// </summary>
|
||||
/// <param name="offset">The offset at which to write the data</param>
|
||||
/// <param name="value1">The first value to write into the buffer</param>
|
||||
/// <param name="value2">The second value to write into the buffer</param>
|
||||
KINC_FUNC void kinc_g5_constant_buffer_set_int2(kinc_g5_constant_buffer_t *buffer, int offset, int value1, int value2);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns three integers at an offset in a constant-buffer.
|
||||
/// </summary>
|
||||
/// <param name="offset">The offset at which to write the data</param>
|
||||
/// <param name="value1">The first value to write into the buffer</param>
|
||||
/// <param name="value2">The second value to write into the buffer</param>
|
||||
/// <param name="value3">The third value to write into the buffer/param>
|
||||
KINC_FUNC void kinc_g5_constant_buffer_set_int3(kinc_g5_constant_buffer_t *buffer, int offset, int value1, int value2, int value3);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns four integers at an offset in a constant-buffer.
|
||||
/// </summary>
|
||||
/// <param name="offset">The offset at which to write the data</param>
|
||||
/// <param name="value1">The first value to write into the buffer</param>
|
||||
/// <param name="value2">The second value to write into the buffer</param>
|
||||
/// <param name="value3">The third value to write into the buffer/param>
|
||||
/// <param name="value4">The fourth value to write into the buffer</param>
|
||||
KINC_FUNC void kinc_g5_constant_buffer_set_int4(kinc_g5_constant_buffer_t *buffer, int offset, int value1, int value2, int value3, int value4);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns a bunch of integers at an offset in a constant-buffer.
|
||||
/// </summary>
|
||||
/// <param name="location">The location of the constant/uniform to assign the values to</param>
|
||||
/// <param name="value">The values to write into the buffer</param>
|
||||
/// <param name="value">The number of values to write into the buffer</param>
|
||||
KINC_FUNC void kinc_g5_constant_buffer_set_ints(kinc_g5_constant_buffer_t *buffer, int offset, int *values, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns a float at an offset in a constant-buffer.
|
||||
/// </summary>
|
||||
/// <param name="offset">The offset at which to write the data</param>
|
||||
/// <param name="value">The value to write into the buffer</param>
|
||||
KINC_FUNC void kinc_g5_constant_buffer_set_float(kinc_g5_constant_buffer_t *buffer, int offset, float value);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns two floats at an offset in a constant-buffer.
|
||||
/// </summary>
|
||||
/// <param name="offset">The offset at which to write the data</param>
|
||||
/// <param name="value1">The first value to write into the buffer</param>
|
||||
/// <param name="value2">The second value to write into the buffer</param>
|
||||
KINC_FUNC void kinc_g5_constant_buffer_set_float2(kinc_g5_constant_buffer_t *buffer, int offset, float value1, float value2);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns three floats at an offset in a constant-buffer.
|
||||
/// </summary>
|
||||
/// <param name="offset">The offset at which to write the data</param>
|
||||
/// <param name="value1">The first value to write into the buffer</param>
|
||||
/// <param name="value2">The second value to write into the buffer</param>
|
||||
/// <param name="value3">The third value to write into the buffer/param>
|
||||
KINC_FUNC void kinc_g5_constant_buffer_set_float3(kinc_g5_constant_buffer_t *buffer, int offset, float value1, float value2, float value3);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns four floats at an offset in a constant-buffer.
|
||||
/// </summary>
|
||||
/// <param name="offset">The offset at which to write the data</param>
|
||||
/// <param name="value1">The first value to write into the buffer</param>
|
||||
/// <param name="value2">The second value to write into the buffer</param>
|
||||
/// <param name="value3">The third value to write into the buffer/param>
|
||||
/// <param name="value4">The fourth value to write into the buffer</param>
|
||||
KINC_FUNC void kinc_g5_constant_buffer_set_float4(kinc_g5_constant_buffer_t *buffer, int offset, float value1, float value2, float value3, float value4);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns a bunch of floats at an offset in a constant-buffer.
|
||||
/// </summary>
|
||||
/// <param name="location">The location of the constant/uniform to assign the values to</param>
|
||||
/// <param name="value">The values to write into the buffer</param>
|
||||
/// <param name="value">The number of values to write into the buffer</param>
|
||||
KINC_FUNC void kinc_g5_constant_buffer_set_floats(kinc_g5_constant_buffer_t *buffer, int offset, float *values, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns a 3x3-matrix at an offset in a constant-buffer.
|
||||
/// </summary>
|
||||
/// <param name="offset">The offset at which to write the data</param>
|
||||
/// <param name="value">The value to write into the buffer</param>
|
||||
KINC_FUNC void kinc_g5_constant_buffer_set_matrix3(kinc_g5_constant_buffer_t *buffer, int offset, kinc_matrix3x3_t *value);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns a 4x4-matrix at an offset in a constant-buffer.
|
||||
/// </summary>
|
||||
/// <param name="offset">The offset at which to write the data</param>
|
||||
/// <param name="value">The value to write into the buffer</param>
|
||||
KINC_FUNC void kinc_g5_constant_buffer_set_matrix4(kinc_g5_constant_buffer_t *buffer, int offset, kinc_matrix4x4_t *value);
|
||||
|
||||
KINC_FUNC extern bool kinc_g5_transposeMat3;
|
||||
KINC_FUNC extern bool kinc_g5_transposeMat4;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
21
Kha/Kinc/Sources/kinc/graphics5/constantlocation.h
Normal file
21
Kha/Kinc/Sources/kinc/graphics5/constantlocation.h
Normal file
@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <kinc/global.h>
|
||||
|
||||
#include <kinc/backend/graphics5/pipeline.h>
|
||||
|
||||
/*! \file constantlocation.h
|
||||
\brief Provides the constant_location-struct which is used for setting constants/uniforms in a shader.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct kinc_g5_constant_location {
|
||||
ConstantLocation5Impl impl;
|
||||
} kinc_g5_constant_location_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
7
Kha/Kinc/Sources/kinc/graphics5/g5unit.c
Normal file
7
Kha/Kinc/Sources/kinc/graphics5/g5unit.c
Normal file
@ -0,0 +1,7 @@
|
||||
#include "commandlist.c.h"
|
||||
#include "constantbuffer.c.h"
|
||||
#include "graphics.c.h"
|
||||
#include "pipeline.c.h"
|
||||
#include "rendertarget.c.h"
|
||||
#include "sampler.c.h"
|
||||
#include "texture.c.h"
|
22
Kha/Kinc/Sources/kinc/graphics5/graphics.c.h
Normal file
22
Kha/Kinc/Sources/kinc/graphics5/graphics.c.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef OPENGL_1_X
|
||||
|
||||
#include "graphics.h"
|
||||
|
||||
static int samples = 1;
|
||||
|
||||
int kinc_g5_antialiasing_samples(void) {
|
||||
return samples;
|
||||
}
|
||||
|
||||
void kinc_g5_set_antialiasing_samples(int samples_) {
|
||||
samples = samples_;
|
||||
}
|
||||
|
||||
bool kinc_g5_fullscreen = false;
|
||||
|
||||
// void Graphics5::setVertexBuffer(VertexBuffer& vertexBuffer) {
|
||||
// VertexBuffer* vertexBuffers[1] = {&vertexBuffer};
|
||||
// setVertexBuffers(vertexBuffers, 1);
|
||||
//}
|
||||
|
||||
#endif
|
113
Kha/Kinc/Sources/kinc/graphics5/graphics.h
Normal file
113
Kha/Kinc/Sources/kinc/graphics5/graphics.h
Normal file
@ -0,0 +1,113 @@
|
||||
#pragma once
|
||||
|
||||
#include <kinc/global.h>
|
||||
|
||||
#include <kinc/image.h>
|
||||
|
||||
#include "rendertarget.h"
|
||||
#include "shader.h"
|
||||
#include "vertexstructure.h"
|
||||
|
||||
#include <kinc/backend/graphics5/graphics.h>
|
||||
|
||||
#include <kinc/math/matrix.h>
|
||||
#include <kinc/math/vector.h>
|
||||
|
||||
/*! \file graphics.h
|
||||
\brief Contains the base G5-functionality.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
KINC_FUNC extern bool kinc_g5_fullscreen;
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether raytracing (see kinc/graphics5/raytrace.h) is supported.
|
||||
/// </summary>
|
||||
/// <returns>Whether raytracing is supported</returns>
|
||||
KINC_FUNC bool kinc_g5_supports_raytracing(void);
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether instanced rendering (kinc_g5_command_list_draw_indexed_vertices_instanced and pals) is supported.
|
||||
/// </summary>
|
||||
/// <returns>Whether instanced rendering is supported</returns>
|
||||
KINC_FUNC bool kinc_g5_supports_instanced_rendering(void);
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether GPU-compute (the functions in kinc/compute/compute.h) is supported.
|
||||
/// </summary>
|
||||
/// <returns>Whether GPU-compute is supported</returns>
|
||||
KINC_FUNC bool kinc_g5_supports_compute_shaders(void);
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether blend-constants (see kinc_g4_set_blend_constant and the blending-properties for pipelines) are supported.
|
||||
/// </summary>
|
||||
/// <returns>Whether blend-constants are supported</returns>
|
||||
KINC_FUNC bool kinc_g5_supports_blend_constants(void);
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether textures are supported which have widths/heights which are not powers of two.
|
||||
/// </summary>
|
||||
/// <returns>Whether non power of two texture-sizes are supported</returns>
|
||||
KINC_FUNC bool kinc_g5_supports_non_pow2_textures(void);
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether render-targets are upside down. This happens in OpenGL and there is currently no automatic mitigation.
|
||||
/// </summary>
|
||||
/// <returns>Whether render-targets are upside down</returns>
|
||||
KINC_FUNC bool kinc_g5_render_targets_inverted_y(void);
|
||||
|
||||
/// <summary>
|
||||
/// Returns how many textures can be used at the same time in a fragment-shader.
|
||||
/// </summary>
|
||||
/// <returns>The number of textures</returns>
|
||||
KINC_FUNC int kinc_g5_max_bound_textures(void);
|
||||
|
||||
/// <summary>
|
||||
/// I think this does nothing.
|
||||
/// </summary>
|
||||
KINC_FUNC void kinc_g5_flush(void);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the currently used number of samples for hardware-antialiasing.
|
||||
/// </summary>
|
||||
/// <returns>The number of samples</returns>
|
||||
KINC_FUNC int kinc_g5_antialiasing_samples(void);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the number of samples used for hardware-antialiasing. This typically uses multisampling and typically only works with a few specific numbers of
|
||||
/// sample-counts - 2 and 4 are pretty safe bets. It also might do nothing at all.
|
||||
/// </summary>
|
||||
/// <param name="samples">The number of samples</param>
|
||||
KINC_FUNC void kinc_g5_set_antialiasing_samples(int samples);
|
||||
|
||||
/// <summary>
|
||||
/// Needs to be called before rendering to a window. Typically called at the start of each frame.
|
||||
/// </summary>
|
||||
/// <param name="window">The window to render to</param>
|
||||
KINC_FUNC void kinc_g5_begin(kinc_g5_render_target_t *renderTarget, int window);
|
||||
|
||||
/// <summary>
|
||||
/// Needs to be called after rendering to a window. Typically called at the end of each frame.
|
||||
/// </summary>
|
||||
/// <param name="window">The window to render to</param>
|
||||
/// <returns></returns>
|
||||
KINC_FUNC void kinc_g5_end(int window);
|
||||
|
||||
/// <summary>
|
||||
/// Needs to be called to make the rendered frame visible. Typically called at the very end of each frame.
|
||||
/// </summary>
|
||||
KINC_FUNC bool kinc_g5_swap_buffers(void);
|
||||
|
||||
#ifndef KINC_DOCS
|
||||
void kinc_g5_internal_init(void);
|
||||
void kinc_g5_internal_init_window(int window, int depth_buffer_bits, int stencil_buffer_bits, bool vsync);
|
||||
void kinc_g5_internal_destroy_window(int window);
|
||||
void kinc_g5_internal_destroy(void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
73
Kha/Kinc/Sources/kinc/graphics5/indexbuffer.h
Normal file
73
Kha/Kinc/Sources/kinc/graphics5/indexbuffer.h
Normal file
@ -0,0 +1,73 @@
|
||||
#pragma once
|
||||
|
||||
#include <kinc/global.h>
|
||||
|
||||
#include <kinc/backend/graphics5/indexbuffer.h>
|
||||
|
||||
/*! \file indexbuffer.h
|
||||
\brief Provides functions for setting up and using index-buffers.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum kinc_g5_index_buffer_format { KINC_G5_INDEX_BUFFER_FORMAT_32BIT, KINC_G5_INDEX_BUFFER_FORMAT_16BIT } kinc_g5_index_buffer_format_t;
|
||||
|
||||
typedef struct kinc_g5_index_buffer {
|
||||
IndexBuffer5Impl impl;
|
||||
} kinc_g5_index_buffer_t;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an index-buffer.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to initialize</param>
|
||||
/// <param name="count">The number of indices to allocate for the buffer</param>
|
||||
/// <param name="gpu_memory">When true, the buffer will be uploaded to gpu-memory which will make it faster to use but slower to change</param>
|
||||
KINC_FUNC void kinc_g5_index_buffer_init(kinc_g5_index_buffer_t *buffer, int count, kinc_g5_index_buffer_format_t format, bool gpu_memory);
|
||||
|
||||
/// <summary>
|
||||
/// Destroys an index-buffer.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to destroy</param>
|
||||
KINC_FUNC void kinc_g5_index_buffer_destroy(kinc_g5_index_buffer_t *buffer);
|
||||
|
||||
/// <summary>
|
||||
/// Locks an index-buffer so its contents can be modified.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to lock</param>
|
||||
/// <returns>The contents of the index-buffer in uint32s or uint16s depending on the format provided when initializing</returns>
|
||||
KINC_FUNC void *kinc_g5_index_buffer_lock_all(kinc_g5_index_buffer_t *buffer);
|
||||
|
||||
/// <summary>
|
||||
/// Locks part of a vertex-buffer to modify its contents.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to lock</param>
|
||||
/// <param name="start">The index of the first index to lock</param>
|
||||
/// <param name="count">The number of indices to lock</param>
|
||||
/// <returns>The contents of the index-buffer, starting at start, in uint32s or uint16s depending on the format provided when initializing</returns>
|
||||
KINC_FUNC void *kinc_g5_index_buffer_lock(kinc_g5_index_buffer_t *buffer, int start, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Unlocks an index-buffer after locking it so the changed buffer-contents can be used.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to unlock</param>
|
||||
KINC_FUNC void kinc_g5_index_buffer_unlock_all(kinc_g5_index_buffer_t *buffer);
|
||||
|
||||
/// <summary>
|
||||
/// Unlocks part of an index-buffer after locking so the changed buffer-contents can be used.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to unlock</param>
|
||||
/// <param name="count">The number of indices to unlock, starting from the start-index from the previous lock-call</param>
|
||||
KINC_FUNC void kinc_g5_index_buffer_unlock(kinc_g5_index_buffer_t *buffer, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of indices in the buffer.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to query for its number of indices</param>
|
||||
/// <returns>The number of indices</returns>
|
||||
KINC_FUNC int kinc_g5_index_buffer_count(kinc_g5_index_buffer_t *buffer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
47
Kha/Kinc/Sources/kinc/graphics5/pipeline.c.h
Normal file
47
Kha/Kinc/Sources/kinc/graphics5/pipeline.c.h
Normal file
@ -0,0 +1,47 @@
|
||||
#include "pipeline.h"
|
||||
|
||||
void kinc_g5_internal_pipeline_init(kinc_g5_pipeline_t *pipe) {
|
||||
for (int i = 0; i < 16; ++i)
|
||||
pipe->inputLayout[i] = NULL;
|
||||
pipe->vertexShader = NULL;
|
||||
pipe->fragmentShader = NULL;
|
||||
pipe->geometryShader = NULL;
|
||||
pipe->tessellationControlShader = NULL;
|
||||
pipe->tessellationEvaluationShader = NULL;
|
||||
|
||||
pipe->cullMode = KINC_G5_CULL_MODE_NEVER;
|
||||
|
||||
pipe->depthWrite = false;
|
||||
pipe->depthMode = KINC_G5_COMPARE_MODE_ALWAYS;
|
||||
|
||||
pipe->stencilMode = KINC_G5_COMPARE_MODE_ALWAYS;
|
||||
pipe->stencilBothPass = KINC_G5_STENCIL_ACTION_KEEP;
|
||||
pipe->stencilDepthFail = KINC_G5_STENCIL_ACTION_KEEP;
|
||||
pipe->stencilFail = KINC_G5_STENCIL_ACTION_KEEP;
|
||||
pipe->stencilReferenceValue = 0;
|
||||
pipe->stencilReadMask = 0xff;
|
||||
pipe->stencilWriteMask = 0xff;
|
||||
|
||||
pipe->blend_source = KINC_G5_BLEND_ONE;
|
||||
pipe->blend_destination = KINC_G5_BLEND_ZERO;
|
||||
pipe->blend_operation = KINC_G5_BLENDOP_ADD;
|
||||
pipe->alpha_blend_source = KINC_G5_BLEND_ONE;
|
||||
pipe->alpha_blend_destination = KINC_G5_BLEND_ZERO;
|
||||
pipe->alpha_blend_operation = KINC_G5_BLENDOP_ADD;
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
pipe->colorWriteMaskRed[i] = true;
|
||||
for (int i = 0; i < 8; ++i)
|
||||
pipe->colorWriteMaskGreen[i] = true;
|
||||
for (int i = 0; i < 8; ++i)
|
||||
pipe->colorWriteMaskBlue[i] = true;
|
||||
for (int i = 0; i < 8; ++i)
|
||||
pipe->colorWriteMaskAlpha[i] = true;
|
||||
|
||||
pipe->colorAttachmentCount = 1;
|
||||
for (int i = 0; i < 8; ++i)
|
||||
pipe->colorAttachment[i] = KINC_G5_RENDER_TARGET_FORMAT_32BIT;
|
||||
|
||||
pipe->depthAttachmentBits = 0;
|
||||
pipe->stencilAttachmentBits = 0;
|
||||
}
|
156
Kha/Kinc/Sources/kinc/graphics5/pipeline.h
Normal file
156
Kha/Kinc/Sources/kinc/graphics5/pipeline.h
Normal file
@ -0,0 +1,156 @@
|
||||
#pragma once
|
||||
|
||||
#include <kinc/global.h>
|
||||
|
||||
#include <kinc/backend/graphics5/pipeline.h>
|
||||
|
||||
#include <kinc/graphics5/vertexstructure.h>
|
||||
|
||||
#include "constantlocation.h"
|
||||
#include "graphics.h"
|
||||
|
||||
/*! \file pipeline.h
|
||||
\brief Provides functions for creating and using pipelines which configure the GPU for rendering.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct kinc_g5_shader;
|
||||
|
||||
// identical to kinc_g4_blending_factor_t
|
||||
typedef enum {
|
||||
KINC_G5_BLEND_ONE,
|
||||
KINC_G5_BLEND_ZERO,
|
||||
KINC_G5_BLEND_SOURCE_ALPHA,
|
||||
KINC_G5_BLEND_DEST_ALPHA,
|
||||
KINC_G5_BLEND_INV_SOURCE_ALPHA,
|
||||
KINC_G5_BLEND_INV_DEST_ALPHA,
|
||||
KINC_G5_BLEND_SOURCE_COLOR,
|
||||
KINC_G5_BLEND_DEST_COLOR,
|
||||
KINC_G5_BLEND_INV_SOURCE_COLOR,
|
||||
KINC_G5_BLEND_INV_DEST_COLOR,
|
||||
KINC_G5_BLEND_CONSTANT,
|
||||
KINC_G5_BLEND_INV_CONSTANT
|
||||
} kinc_g5_blending_factor_t;
|
||||
|
||||
// identical to kinc_g4_blending_operation_t
|
||||
typedef enum {
|
||||
KINC_G5_BLENDOP_ADD,
|
||||
KINC_G5_BLENDOP_SUBTRACT,
|
||||
KINC_G5_BLENDOP_REVERSE_SUBTRACT,
|
||||
KINC_G5_BLENDOP_MIN,
|
||||
KINC_G5_BLENDOP_MAX
|
||||
} kinc_g5_blending_operation_t;
|
||||
|
||||
typedef enum kinc_g5_cull_mode { KINC_G5_CULL_MODE_CLOCKWISE, KINC_G5_CULL_MODE_COUNTERCLOCKWISE, KINC_G5_CULL_MODE_NEVER } kinc_g5_cull_mode_t;
|
||||
|
||||
typedef enum kinc_g5_compare_mode {
|
||||
KINC_G5_COMPARE_MODE_ALWAYS,
|
||||
KINC_G5_COMPARE_MODE_NEVER,
|
||||
KINC_G5_COMPARE_MODE_EQUAL,
|
||||
KINC_G5_COMPARE_MODE_NOT_EQUAL,
|
||||
KINC_G5_COMPARE_MODE_LESS,
|
||||
KINC_G5_COMPARE_MODE_LESS_EQUAL,
|
||||
KINC_G5_COMPARE_MODE_GREATER,
|
||||
KINC_G5_COMPARE_MODE_GREATER_EQUAL
|
||||
} kinc_g5_compare_mode_t;
|
||||
|
||||
typedef enum kinc_g5_stencil_action {
|
||||
KINC_G5_STENCIL_ACTION_KEEP,
|
||||
KINC_G5_STENCIL_ACTION_ZERO,
|
||||
KINC_G5_STENCIL_ACTION_REPLACE,
|
||||
KINC_G5_STENCIL_ACTION_INCREMENT,
|
||||
KINC_G5_STENCIL_ACTION_INCREMENT_WRAP,
|
||||
KINC_G5_STENCIL_ACTION_DECREMENT,
|
||||
KINC_G5_STENCIL_ACTION_DECREMENT_WRAP,
|
||||
KINC_G5_STENCIL_ACTION_INVERT
|
||||
} kinc_g5_stencil_action_t;
|
||||
|
||||
typedef struct kinc_g5_pipeline {
|
||||
kinc_g5_vertex_structure_t *inputLayout[16];
|
||||
struct kinc_g5_shader *vertexShader;
|
||||
struct kinc_g5_shader *fragmentShader;
|
||||
struct kinc_g5_shader *geometryShader;
|
||||
struct kinc_g5_shader *tessellationControlShader;
|
||||
struct kinc_g5_shader *tessellationEvaluationShader;
|
||||
|
||||
kinc_g5_cull_mode_t cullMode;
|
||||
|
||||
bool depthWrite;
|
||||
kinc_g5_compare_mode_t depthMode;
|
||||
|
||||
kinc_g5_compare_mode_t stencilMode;
|
||||
kinc_g5_stencil_action_t stencilBothPass;
|
||||
kinc_g5_stencil_action_t stencilDepthFail;
|
||||
kinc_g5_stencil_action_t stencilFail;
|
||||
int stencilReferenceValue;
|
||||
int stencilReadMask;
|
||||
int stencilWriteMask;
|
||||
|
||||
// One, Zero deactivates blending
|
||||
kinc_g5_blending_factor_t blend_source;
|
||||
kinc_g5_blending_factor_t blend_destination;
|
||||
kinc_g5_blending_operation_t blend_operation;
|
||||
kinc_g5_blending_factor_t alpha_blend_source;
|
||||
kinc_g5_blending_factor_t alpha_blend_destination;
|
||||
kinc_g5_blending_operation_t alpha_blend_operation;
|
||||
|
||||
bool colorWriteMaskRed[8]; // Per render target
|
||||
bool colorWriteMaskGreen[8];
|
||||
bool colorWriteMaskBlue[8];
|
||||
bool colorWriteMaskAlpha[8];
|
||||
|
||||
int colorAttachmentCount;
|
||||
kinc_g5_render_target_format_t colorAttachment[8];
|
||||
|
||||
int depthAttachmentBits;
|
||||
int stencilAttachmentBits;
|
||||
|
||||
bool conservativeRasterization;
|
||||
|
||||
PipelineState5Impl impl;
|
||||
} kinc_g5_pipeline_t;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a pipeline.
|
||||
/// </summary>
|
||||
/// <param name="state">The pipeline to initialize</param>
|
||||
KINC_FUNC void kinc_g5_pipeline_init(kinc_g5_pipeline_t *pipeline);
|
||||
|
||||
void kinc_g5_internal_pipeline_init(kinc_g5_pipeline_t *pipeline);
|
||||
|
||||
/// <summary>
|
||||
/// Destroys a pipeline.
|
||||
/// </summary>
|
||||
/// <param name="pipeline">The pipeline to destroy</param>
|
||||
KINC_FUNC void kinc_g5_pipeline_destroy(kinc_g5_pipeline_t *pipeline);
|
||||
|
||||
/// <summary>
|
||||
/// Compiles a pipeline. After a pipeline has been compiled it is finalized. It cannot be compiled again and further changes to the pipeline are ignored.
|
||||
/// </summary>
|
||||
/// <param name="pipeline">The pipeline to compile</param>
|
||||
KINC_FUNC void kinc_g5_pipeline_compile(kinc_g5_pipeline_t *pipeline);
|
||||
|
||||
#ifndef KINC_KONG
|
||||
/// <summary>
|
||||
/// Searches for a constant/uniform and returns a constant-location which can be used to change the constant/uniform.
|
||||
/// </summary>
|
||||
/// <param name="pipeline">The pipeline to search in</param>
|
||||
/// <param name="name">The name of the constant/uniform to find</param>
|
||||
/// <returns>The constant-location of the constant/uniform</returns>
|
||||
KINC_FUNC kinc_g5_constant_location_t kinc_g5_pipeline_get_constant_location(kinc_g5_pipeline_t *pipeline, const char *name);
|
||||
|
||||
/// <summary>
|
||||
/// Searches for a texture-declaration and returns a texture-unit which can be used to assign a texture.
|
||||
/// </summary>
|
||||
/// <param name="pipeline">The pipeline to search in</param>
|
||||
/// <param name="name">The name of the texture-declaration to search for</param>
|
||||
/// <returns>The texture-unit of the texture-declaration</returns>
|
||||
KINC_FUNC kinc_g5_texture_unit_t kinc_g5_pipeline_get_texture_unit(kinc_g5_pipeline_t *pipeline, const char *name);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
49
Kha/Kinc/Sources/kinc/graphics5/raytrace.h
Normal file
49
Kha/Kinc/Sources/kinc/graphics5/raytrace.h
Normal file
@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
/*! \file raytrace.h
|
||||
\brief Preliminary API, requires some actual D3D12/Vulkan code to fill in
|
||||
the acceleration-structure and pipeline-details. Also requires manually
|
||||
compiled shaders. Use with caution.
|
||||
*/
|
||||
|
||||
#include <kinc/global.h>
|
||||
|
||||
#include <kinc/backend/graphics5/raytrace.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct kinc_g5_command_list;
|
||||
struct kinc_g5_constant_buffer;
|
||||
struct kinc_g5_index_buffer;
|
||||
struct kinc_g5_render_target;
|
||||
struct kinc_g5_texture;
|
||||
struct kinc_g5_vertex_buffer;
|
||||
|
||||
typedef struct kinc_raytrace_pipeline {
|
||||
struct kinc_g5_constant_buffer *_constant_buffer;
|
||||
kinc_raytrace_pipeline_impl_t impl;
|
||||
} kinc_raytrace_pipeline_t;
|
||||
|
||||
KINC_FUNC void kinc_raytrace_pipeline_init(kinc_raytrace_pipeline_t *pipeline, struct kinc_g5_command_list *command_list, void *ray_shader, int ray_shader_size,
|
||||
struct kinc_g5_constant_buffer *constant_buffer);
|
||||
KINC_FUNC void kinc_raytrace_pipeline_destroy(kinc_raytrace_pipeline_t *pipeline);
|
||||
|
||||
typedef struct kinc_raytrace_acceleration_structure {
|
||||
kinc_raytrace_acceleration_structure_impl_t impl;
|
||||
} kinc_raytrace_acceleration_structure_t;
|
||||
|
||||
KINC_FUNC void kinc_raytrace_acceleration_structure_init(kinc_raytrace_acceleration_structure_t *accel, struct kinc_g5_command_list *command_list,
|
||||
struct kinc_g5_vertex_buffer *vb, struct kinc_g5_index_buffer *ib);
|
||||
KINC_FUNC void kinc_raytrace_acceleration_structure_destroy(kinc_raytrace_acceleration_structure_t *accel);
|
||||
|
||||
KINC_FUNC void kinc_raytrace_set_acceleration_structure(kinc_raytrace_acceleration_structure_t *accel);
|
||||
KINC_FUNC void kinc_raytrace_set_pipeline(kinc_raytrace_pipeline_t *pipeline);
|
||||
KINC_FUNC void kinc_raytrace_set_target(struct kinc_g5_texture *output);
|
||||
KINC_FUNC void kinc_raytrace_dispatch_rays(struct kinc_g5_command_list *command_list);
|
||||
KINC_FUNC void kinc_raytrace_copy(struct kinc_g5_command_list *command_list, struct kinc_g5_render_target *target, struct kinc_g5_texture *source);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
16
Kha/Kinc/Sources/kinc/graphics5/rendertarget.c.h
Normal file
16
Kha/Kinc/Sources/kinc/graphics5/rendertarget.c.h
Normal file
@ -0,0 +1,16 @@
|
||||
#include "rendertarget.h"
|
||||
|
||||
void kinc_g5_render_target_init(kinc_g5_render_target_t *render_target, int width, int height, kinc_g5_render_target_format_t format, int depthBufferBits,
|
||||
int stencilBufferBits) {
|
||||
kinc_g5_render_target_init_with_multisampling(render_target, width, height, format, depthBufferBits, stencilBufferBits, 1);
|
||||
}
|
||||
|
||||
void kinc_g5_render_target_init_framebuffer(kinc_g5_render_target_t *render_target, int width, int height, kinc_g5_render_target_format_t format,
|
||||
int depthBufferBits, int stencilBufferBits) {
|
||||
kinc_g5_render_target_init_framebuffer_with_multisampling(render_target, width, height, format, depthBufferBits, stencilBufferBits, 1);
|
||||
}
|
||||
|
||||
void kinc_g5_render_target_init_cube(kinc_g5_render_target_t *render_target, int cubeMapSize, kinc_g5_render_target_format_t format, int depthBufferBits,
|
||||
int stencilBufferBits) {
|
||||
kinc_g5_render_target_init_cube_with_multisampling(render_target, cubeMapSize, format, depthBufferBits, stencilBufferBits, 1);
|
||||
}
|
134
Kha/Kinc/Sources/kinc/graphics5/rendertarget.h
Normal file
134
Kha/Kinc/Sources/kinc/graphics5/rendertarget.h
Normal file
@ -0,0 +1,134 @@
|
||||
#pragma once
|
||||
|
||||
#include <kinc/global.h>
|
||||
|
||||
#include "textureunit.h"
|
||||
|
||||
#include <kinc/backend/graphics5/rendertarget.h>
|
||||
|
||||
/*! \file rendertarget.h
|
||||
\brief Provides functions for handling render-targets.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum kinc_g5_render_target_format {
|
||||
KINC_G5_RENDER_TARGET_FORMAT_32BIT,
|
||||
KINC_G5_RENDER_TARGET_FORMAT_64BIT_FLOAT,
|
||||
KINC_G5_RENDER_TARGET_FORMAT_32BIT_RED_FLOAT,
|
||||
KINC_G5_RENDER_TARGET_FORMAT_128BIT_FLOAT,
|
||||
KINC_G5_RENDER_TARGET_FORMAT_16BIT_DEPTH,
|
||||
KINC_G5_RENDER_TARGET_FORMAT_8BIT_RED,
|
||||
KINC_G5_RENDER_TARGET_FORMAT_16BIT_RED_FLOAT
|
||||
} kinc_g5_render_target_format_t;
|
||||
|
||||
typedef struct kinc_g5_render_target {
|
||||
int width;
|
||||
int height;
|
||||
int texWidth;
|
||||
int texHeight;
|
||||
int framebuffer_index;
|
||||
bool isCubeMap;
|
||||
bool isDepthAttachment;
|
||||
RenderTarget5Impl impl;
|
||||
} kinc_g5_render_target_t;
|
||||
|
||||
/// <summary>
|
||||
/// Allocates and initializes a regular render-target. The contents of the render-target are undefined.
|
||||
/// </summary>
|
||||
/// <param name="target"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
/// <param name="format"></param>
|
||||
/// <param name="depthBufferBits"></param>
|
||||
/// <param name="stencilBufferBits"></param>
|
||||
/// <returns></returns>
|
||||
KINC_FUNC void kinc_g5_render_target_init(kinc_g5_render_target_t *target, int width, int height, kinc_g5_render_target_format_t format, int depthBufferBits,
|
||||
int stencilBufferBits);
|
||||
|
||||
/// <summary>
|
||||
/// Allocates and initializes a regular render-target. Can fall back to a regular render-target. The contents of the render-target are undefined.
|
||||
/// </summary>
|
||||
/// <param name="target"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
/// <param name="format"></param>
|
||||
/// <param name="depthBufferBits"></param>
|
||||
/// <param name="stencilBufferBits"></param>
|
||||
/// <param name="samples_per_pixel"></param>
|
||||
/// <returns></returns>
|
||||
KINC_FUNC void kinc_g5_render_target_init_with_multisampling(kinc_g5_render_target_t *target, int width, int height, kinc_g5_render_target_format_t format,
|
||||
int depthBufferBits, int stencilBufferBits, int samples_per_pixel);
|
||||
|
||||
/// <summary>
|
||||
/// Allocates and initializes a framebuffer. The contents of the framebuffer are undefined.
|
||||
/// </summary>
|
||||
/// <param name="target"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
/// <param name="format"></param>
|
||||
/// <param name="depthBufferBits"></param>
|
||||
/// <param name="stencilBufferBits"></param>
|
||||
/// <returns></returns>
|
||||
KINC_FUNC void kinc_g5_render_target_init_framebuffer(kinc_g5_render_target_t *target, int width, int height, kinc_g5_render_target_format_t format,
|
||||
int depthBufferBits, int stencilBufferBits);
|
||||
|
||||
/// <summary>
|
||||
/// Allocates and initializes a multisampled framebuffer. Can fall back to a regular framebuffer. The contents of the framebuffer are undefined.
|
||||
/// </summary>
|
||||
/// <param name="target"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
/// <param name="format"></param>
|
||||
/// <param name="depthBufferBits"></param>
|
||||
/// <param name="stencilBufferBits"></param>
|
||||
/// <param name="samples_per_pixel"></param>
|
||||
/// <returns></returns>
|
||||
KINC_FUNC void kinc_g5_render_target_init_framebuffer_with_multisampling(kinc_g5_render_target_t *target, int width, int height,
|
||||
kinc_g5_render_target_format_t format, int depthBufferBits, int stencilBufferBits,
|
||||
int samples_per_pixel);
|
||||
|
||||
/// <summary>
|
||||
/// Allocates and initializes a render-target-cube-map. The contents of the render-target are undefined.
|
||||
/// </summary>
|
||||
/// <param name="target"></param>
|
||||
/// <param name="cubeMapSize"></param>
|
||||
/// <param name="format"></param>
|
||||
/// <param name="depthBufferBits"></param>
|
||||
/// <param name="stencilBufferBits"></param>
|
||||
/// <returns></returns>
|
||||
KINC_FUNC void kinc_g5_render_target_init_cube(kinc_g5_render_target_t *target, int cubeMapSize, kinc_g5_render_target_format_t format, int depthBufferBits,
|
||||
int stencilBufferBits);
|
||||
|
||||
/// <summary>
|
||||
/// Allocates and initializes a multisampled render-target-cube-map. Can fall back to a regular cube-map. The contents of the render-target are undefined.
|
||||
/// </summary>
|
||||
/// <param name="target"></param>
|
||||
/// <param name="cubeMapSize"></param>
|
||||
/// <param name="format"></param>
|
||||
/// <param name="depthBufferBits"></param>
|
||||
/// <param name="stencilBufferBits"></param>
|
||||
/// <param name="samples_per_pixel"></param>
|
||||
/// <returns></returns>
|
||||
KINC_FUNC void kinc_g5_render_target_init_cube_with_multisampling(kinc_g5_render_target_t *target, int cubeMapSize, kinc_g5_render_target_format_t format,
|
||||
int depthBufferBits, int stencilBufferBits, int samples_per_pixel);
|
||||
|
||||
/// <summary>
|
||||
/// Deallocates and destroys a render-target.
|
||||
/// </summary>
|
||||
/// <param name="renderTarget">The render-target to destroy</param>
|
||||
KINC_FUNC void kinc_g5_render_target_destroy(kinc_g5_render_target_t *target);
|
||||
|
||||
/// <summary>
|
||||
/// Copies the depth and stencil-components of one render-target into another one.
|
||||
/// </summary>
|
||||
/// <param name="renderTarget">The render-target to copy the data into</param>
|
||||
/// <param name="source">The render-target from which to copy the data</param>
|
||||
/// <returns></returns>
|
||||
KINC_FUNC void kinc_g5_render_target_set_depth_stencil_from(kinc_g5_render_target_t *target, kinc_g5_render_target_t *source);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
19
Kha/Kinc/Sources/kinc/graphics5/sampler.c.h
Normal file
19
Kha/Kinc/Sources/kinc/graphics5/sampler.c.h
Normal file
@ -0,0 +1,19 @@
|
||||
#include "sampler.h"
|
||||
|
||||
void kinc_g5_sampler_options_set_defaults(kinc_g5_sampler_options_t *options) {
|
||||
options->u_addressing = KINC_G5_TEXTURE_ADDRESSING_CLAMP;
|
||||
options->v_addressing = KINC_G5_TEXTURE_ADDRESSING_CLAMP;
|
||||
options->w_addressing = KINC_G5_TEXTURE_ADDRESSING_CLAMP;
|
||||
|
||||
options->magnification_filter = KINC_G5_TEXTURE_FILTER_POINT;
|
||||
options->minification_filter = KINC_G5_TEXTURE_FILTER_POINT;
|
||||
options->mipmap_filter = KINC_G5_MIPMAP_FILTER_POINT;
|
||||
|
||||
options->lod_min_clamp = 0.0f;
|
||||
options->lod_max_clamp = 32.0f;
|
||||
|
||||
options->is_comparison = false;
|
||||
options->compare_mode = KINC_G5_COMPARE_MODE_ALWAYS;
|
||||
|
||||
options->max_anisotropy = 1;
|
||||
}
|
78
Kha/Kinc/Sources/kinc/graphics5/sampler.h
Normal file
78
Kha/Kinc/Sources/kinc/graphics5/sampler.h
Normal file
@ -0,0 +1,78 @@
|
||||
#pragma once
|
||||
|
||||
#include <kinc/backend/graphics5/sampler.h>
|
||||
#include <kinc/graphics5/pipeline.h>
|
||||
|
||||
/*! \file sampler.h
|
||||
\brief Provides functions for sampler objects.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum kinc_g5_texture_addressing {
|
||||
KINC_G5_TEXTURE_ADDRESSING_REPEAT,
|
||||
KINC_G5_TEXTURE_ADDRESSING_MIRROR,
|
||||
KINC_G5_TEXTURE_ADDRESSING_CLAMP,
|
||||
KINC_G5_TEXTURE_ADDRESSING_BORDER
|
||||
} kinc_g5_texture_addressing_t;
|
||||
|
||||
typedef enum kinc_g5_texture_filter {
|
||||
KINC_G5_TEXTURE_FILTER_POINT,
|
||||
KINC_G5_TEXTURE_FILTER_LINEAR,
|
||||
KINC_G5_TEXTURE_FILTER_ANISOTROPIC
|
||||
} kinc_g5_texture_filter_t;
|
||||
|
||||
typedef enum kinc_g5_mipmap_filter {
|
||||
KINC_G5_MIPMAP_FILTER_NONE,
|
||||
KINC_G5_MIPMAP_FILTER_POINT,
|
||||
KINC_G5_MIPMAP_FILTER_LINEAR // linear texture filter + linear mip filter -> trilinear filter
|
||||
} kinc_g5_mipmap_filter_t;
|
||||
|
||||
typedef struct kinc_g5_sampler_options {
|
||||
kinc_g5_texture_addressing_t u_addressing;
|
||||
kinc_g5_texture_addressing_t v_addressing;
|
||||
kinc_g5_texture_addressing_t w_addressing;
|
||||
|
||||
kinc_g5_texture_filter_t minification_filter;
|
||||
kinc_g5_texture_filter_t magnification_filter;
|
||||
kinc_g5_mipmap_filter_t mipmap_filter;
|
||||
|
||||
float lod_min_clamp;
|
||||
float lod_max_clamp;
|
||||
|
||||
uint16_t max_anisotropy;
|
||||
|
||||
bool is_comparison;
|
||||
kinc_g5_compare_mode_t compare_mode;
|
||||
} kinc_g5_sampler_options_t;
|
||||
|
||||
typedef struct kinc_g5_sampler {
|
||||
kinc_g5_sampler_impl_t impl;
|
||||
} kinc_g5_sampler_t;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the passed options-object with the default-options.
|
||||
/// </summary>
|
||||
/// <param name="options">The options-object for which the default-options will be set</param>
|
||||
KINC_FUNC void kinc_g5_sampler_options_set_defaults(kinc_g5_sampler_options_t *options);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a sampler-object.
|
||||
///
|
||||
/// On platforms such as older OpenGL not all sampler attributes may be available.
|
||||
/// </summary>
|
||||
/// <param name="sampler">Pointer to the sampler object to initialize</param>
|
||||
/// <param name="descriptor">Options for the sampler</param>
|
||||
KINC_FUNC void kinc_g5_sampler_init(kinc_g5_sampler_t *sampler, const kinc_g5_sampler_options_t *options);
|
||||
|
||||
/// <summary>
|
||||
/// Destroys a sampler-object.
|
||||
/// </summary>
|
||||
/// <param name="sampler">The sampler-object to destroy</param>
|
||||
KINC_FUNC void kinc_g5_sampler_destroy(kinc_g5_sampler_t *sampler);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
50
Kha/Kinc/Sources/kinc/graphics5/shader.h
Normal file
50
Kha/Kinc/Sources/kinc/graphics5/shader.h
Normal file
@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#include <kinc/global.h>
|
||||
|
||||
#include <kinc/backend/graphics5/shader.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/*! \file shader.h
|
||||
\brief Provides functions for creating and destroying shaders.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum kinc_g5_shader_type {
|
||||
KINC_G5_SHADER_TYPE_FRAGMENT,
|
||||
KINC_G5_SHADER_TYPE_VERTEX,
|
||||
KINC_G5_SHADER_TYPE_COMPUTE,
|
||||
KINC_G5_SHADER_TYPE_GEOMETRY,
|
||||
KINC_G5_SHADER_TYPE_TESSELLATION_CONTROL,
|
||||
KINC_G5_SHADER_TYPE_TESSELLATION_EVALUATION,
|
||||
|
||||
KINC_G5_SHADER_TYPE_COUNT
|
||||
} kinc_g5_shader_type_t;
|
||||
|
||||
typedef struct kinc_g5_shader {
|
||||
Shader5Impl impl;
|
||||
} kinc_g5_shader_t;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a shader based on system-specific shader-data. The system-specific shader-data is usually created per system by the krafix-shader-compiler which
|
||||
/// is automatically called by kincmake.
|
||||
/// </summary>
|
||||
/// <param name="shader">The shader to initialize</param>
|
||||
/// <param name="data">The system-specific shader-data</param>
|
||||
/// <param name="length">The length of the system-specific shader-data in bytes</param>
|
||||
/// <param name="type">The type of the shader</param>
|
||||
KINC_FUNC void kinc_g5_shader_init(kinc_g5_shader_t *shader, const void *source, size_t length, kinc_g5_shader_type_t type);
|
||||
|
||||
/// <summary>
|
||||
/// Destroys a shader.
|
||||
/// </summary>
|
||||
/// <param name="shader">The shader to destroy</param>
|
||||
KINC_FUNC void kinc_g5_shader_destroy(kinc_g5_shader_t *shader);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
32
Kha/Kinc/Sources/kinc/graphics5/texture.c.h
Normal file
32
Kha/Kinc/Sources/kinc/graphics5/texture.c.h
Normal file
@ -0,0 +1,32 @@
|
||||
#include "texture.h"
|
||||
|
||||
/*
|
||||
Graphics5::Texture::Texture(Kore::Reader& reader, const char* format, bool readable) : Image(reader, format, readable) {
|
||||
_init(format, readable);
|
||||
}
|
||||
|
||||
Graphics5::Texture::Texture(const char* filename, bool readable) {
|
||||
FileReader reader(filename);
|
||||
Image::init(reader, filename, readable);
|
||||
_init(filename, readable);
|
||||
}
|
||||
|
||||
Graphics5::Texture::Texture(void* data, int size, const char* format, bool readable) {
|
||||
BufferReader reader(data, size);
|
||||
Image::init(reader, format, readable);
|
||||
_init(format, readable);
|
||||
}
|
||||
|
||||
Graphics5::Texture::Texture(void* data, int width, int height, int format, bool readable) : Image(data, width, height, Image::Format(format), readable) {
|
||||
_init("", readable);
|
||||
}
|
||||
*/
|
||||
|
||||
bool kinc_g5_texture_unit_equals(kinc_g5_texture_unit_t *unit1, kinc_g5_texture_unit_t *unit2) {
|
||||
for (int i = 0; i < KINC_G5_SHADER_TYPE_COUNT; ++i) {
|
||||
if (unit1->stages[i] != unit2->stages[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
98
Kha/Kinc/Sources/kinc/graphics5/texture.h
Normal file
98
Kha/Kinc/Sources/kinc/graphics5/texture.h
Normal file
@ -0,0 +1,98 @@
|
||||
#pragma once
|
||||
|
||||
#include <kinc/global.h>
|
||||
|
||||
#include <kinc/image.h>
|
||||
|
||||
#include "textureunit.h"
|
||||
|
||||
#include <kinc/backend/graphics5/texture.h>
|
||||
|
||||
/*! \file texture.h
|
||||
\brief Provides functions for handling textures.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct kinc_g5_texture {
|
||||
int texWidth;
|
||||
int texHeight;
|
||||
kinc_image_format_t format;
|
||||
Texture5Impl impl;
|
||||
} kinc_g5_texture_t;
|
||||
|
||||
/// <summary>
|
||||
/// Allocates and initializes a texture without copying any data into it.
|
||||
/// </summary>
|
||||
/// <param name="texture">The texture to initialize</param>
|
||||
/// <param name="width">The width of the texture to create</param>
|
||||
/// <param name="height">The height of the texture to create</param>
|
||||
/// <param name="format">The format of the texture to create</param>
|
||||
KINC_FUNC void kinc_g5_texture_init(kinc_g5_texture_t *texture, int width, int height, kinc_image_format_t format);
|
||||
|
||||
/// <summary>
|
||||
/// Allocates and initializes a 3d-texture without copying any data into it.
|
||||
/// </summary>
|
||||
/// <param name="texture">The texture to initialize</param>
|
||||
/// <param name="width">The width of the texture to create</param>
|
||||
/// <param name="height">The height of the texture to create</param>
|
||||
/// <param name="depth">The depth of the texture to create</param>
|
||||
/// <param name="format">The format of the texture to create</param>
|
||||
KINC_FUNC void kinc_g5_texture_init3d(kinc_g5_texture_t *texture, int width, int height, int depth, kinc_image_format_t format);
|
||||
|
||||
/// <summary>
|
||||
/// Allocates and initializes a texture and copies image-data into it.
|
||||
/// </summary>
|
||||
/// <param name="texture">The texture to initialize</param>
|
||||
/// <param name="image">The image which's data is copied into the texture</param>
|
||||
KINC_FUNC void kinc_g5_texture_init_from_image(kinc_g5_texture_t *texture, kinc_image_t *image);
|
||||
|
||||
// void kinc_g5_texture_init_from_encoded_data(kinc_g5_texture_t *texture, void *data, int size, const char *format, bool readable);
|
||||
// void kinc_g5_texture_init_from_data(kinc_g5_texture_t *texture, void *data, int width, int height, int format, bool readable);
|
||||
|
||||
KINC_FUNC void kinc_g5_texture_init_non_sampled_access(kinc_g5_texture_t *texture, int width, int height, kinc_image_format_t format);
|
||||
|
||||
/// <summary>
|
||||
/// Deallocates and destroys a texture.
|
||||
/// </summary>
|
||||
/// <param name="texture">The texture to destroy</param>
|
||||
KINC_FUNC void kinc_g5_texture_destroy(kinc_g5_texture_t *texture);
|
||||
|
||||
#ifdef KINC_ANDROID
|
||||
KINC_FUNC void kinc_g5_texture_init_from_id(kinc_g5_texture_t *texture, unsigned texid);
|
||||
#endif
|
||||
|
||||
KINC_FUNC uint8_t *kinc_g5_texture_lock(kinc_g5_texture_t *texture);
|
||||
|
||||
KINC_FUNC void kinc_g5_texture_unlock(kinc_g5_texture_t *texture);
|
||||
|
||||
/// <summary>
|
||||
/// Clears parts of a texture to a color.
|
||||
/// </summary>
|
||||
KINC_FUNC void kinc_g5_texture_clear(kinc_g5_texture_t *texture, int x, int y, int z, int width, int height, int depth, unsigned color);
|
||||
|
||||
#if defined(KINC_IOS) || defined(KINC_MACOS)
|
||||
KINC_FUNC void kinc_g5_texture_upload(kinc_g5_texture_t *texture, uint8_t *data);
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Generates the mipmap-chain for a texture.
|
||||
/// </summary>
|
||||
/// <param name="renderTarget">The render-target to create the mipmaps for</param>
|
||||
/// <param name="levels">The number of mipmap-levels to generate</param>
|
||||
KINC_FUNC void kinc_g5_texture_generate_mipmaps(kinc_g5_texture_t *texture, int levels);
|
||||
|
||||
KINC_FUNC void kinc_g5_texture_set_mipmap(kinc_g5_texture_t *texture, kinc_image_t *mipmap, int level);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the stride of the first mipmap-layer of the texture in bytes.
|
||||
/// </summary>
|
||||
/// <param name="texture">The texture to figure out the stride for</param>
|
||||
/// <returns>The stride of the first mipmap-layer in bytes</returns>
|
||||
KINC_FUNC int kinc_g5_texture_stride(kinc_g5_texture_t *texture);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
24
Kha/Kinc/Sources/kinc/graphics5/textureunit.h
Normal file
24
Kha/Kinc/Sources/kinc/graphics5/textureunit.h
Normal file
@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <kinc/global.h>
|
||||
|
||||
#include <kinc/backend/graphics5/texture.h>
|
||||
#include <kinc/graphics5/shader.h>
|
||||
|
||||
/*! \file textureunit.h
|
||||
\brief Provides a texture-unit-struct which is used for setting textures in a shader.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct kinc_g5_texture_unit {
|
||||
int stages[KINC_G5_SHADER_TYPE_COUNT];
|
||||
} kinc_g5_texture_unit_t;
|
||||
|
||||
bool kinc_g5_texture_unit_equals(kinc_g5_texture_unit_t *unit1, kinc_g5_texture_unit_t *unit2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
85
Kha/Kinc/Sources/kinc/graphics5/vertexbuffer.h
Normal file
85
Kha/Kinc/Sources/kinc/graphics5/vertexbuffer.h
Normal file
@ -0,0 +1,85 @@
|
||||
#pragma once
|
||||
|
||||
#include <kinc/global.h>
|
||||
|
||||
#include "vertexstructure.h"
|
||||
|
||||
#include <kinc/backend/graphics5/vertexbuffer.h>
|
||||
|
||||
/*! \file vertexbuffer.h
|
||||
\brief Provides functions for setting up and using vertex-buffers.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct kinc_g5_vertex_buffer {
|
||||
VertexBuffer5Impl impl;
|
||||
} kinc_g5_vertex_buffer_t;
|
||||
|
||||
/// <summary>
|
||||
/// Allocate and initialize a vertex-buffer.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to initialize</param>
|
||||
/// <param name="count">The number of vertices in the buffer</param>
|
||||
/// <param name="structure">The structure of the buffer</param>
|
||||
/// <param name="gpu_memory">If true, the vertex-buffer will reside in gpu-memory which will make it slower to update but faster to use</param>
|
||||
/// <param name="instance_data_step_rate">The step-rate for instanced-rendering - use 0 if instanced-rendering will not be used with this buffer</param>
|
||||
KINC_FUNC void kinc_g5_vertex_buffer_init(kinc_g5_vertex_buffer_t *buffer, int count, kinc_g5_vertex_structure_t *structure, bool gpu_memory,
|
||||
int instance_data_step_rate);
|
||||
|
||||
/// <summary>
|
||||
/// Destroys a vertex-buffer.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to destroy</param>
|
||||
KINC_FUNC void kinc_g5_vertex_buffer_destroy(kinc_g5_vertex_buffer_t *buffer);
|
||||
|
||||
/// <summary>
|
||||
/// Locks all of a vertex-buffer to modify its contents.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to lock</param>
|
||||
/// <returns>The contents of the buffer</returns>
|
||||
KINC_FUNC float *kinc_g5_vertex_buffer_lock_all(kinc_g5_vertex_buffer_t *buffer);
|
||||
|
||||
/// <summary>
|
||||
/// Locks part of a vertex-buffer to modify its contents.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to lock</param>
|
||||
/// <param name="start">The index of the first vertex to lock</param>
|
||||
/// <param name="count">The number of vertices to lock</param>
|
||||
/// <returns>The contents of the buffer, starting at start</returns>
|
||||
KINC_FUNC float *kinc_g5_vertex_buffer_lock(kinc_g5_vertex_buffer_t *buffer, int start, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Unlock all of a vertex-buffer so the changed contents can be used.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to unlock</param>
|
||||
KINC_FUNC void kinc_g5_vertex_buffer_unlock_all(kinc_g5_vertex_buffer_t *buffer);
|
||||
|
||||
/// <summary>
|
||||
/// Unlocks part of a vertex-buffer so the changed contents can be used.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to unlock</param>
|
||||
/// <param name="count">The number of vertices to unlock, starting from the start-vertex from the previous lock-call</param>
|
||||
KINC_FUNC void kinc_g5_vertex_buffer_unlock(kinc_g5_vertex_buffer_t *buffer, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of vertices in a buffer.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to figure out the number of vertices for</param>
|
||||
/// <returns>The number of vertices</returns>
|
||||
KINC_FUNC int kinc_g5_vertex_buffer_count(kinc_g5_vertex_buffer_t *buffer);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the stride aka the size of one vertex of the buffer in bytes.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The buffer to figure out the stride for</param>
|
||||
/// <returns>The stride of the buffer in bytes</returns>
|
||||
KINC_FUNC int kinc_g5_vertex_buffer_stride(kinc_g5_vertex_buffer_t *buffer);
|
||||
|
||||
int kinc_g5_internal_vertex_buffer_set(kinc_g5_vertex_buffer_t *buffer, int offset);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
45
Kha/Kinc/Sources/kinc/graphics5/vertexstructure.h
Normal file
45
Kha/Kinc/Sources/kinc/graphics5/vertexstructure.h
Normal file
@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include <kinc/global.h>
|
||||
|
||||
#include <kinc/graphics4/vertexstructure.h>
|
||||
|
||||
/*! \file vertexstructure.h
|
||||
\brief Provides types for setting up the structure of vertices in a vertex-buffer.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef kinc_g4_vertex_data_t kinc_g5_vertex_data_t;
|
||||
|
||||
// typedef kinc_g4_vertex_attribute_t kinc_g5_vertex_attribute_t;
|
||||
|
||||
typedef kinc_g4_vertex_element_t kinc_g5_vertex_element_t;
|
||||
|
||||
typedef kinc_g4_vertex_structure_t kinc_g5_vertex_structure_t;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a vertex-structure.
|
||||
/// </summary>
|
||||
/// <param name="structure">The structure to initialize</param>
|
||||
/// <returns></returns>
|
||||
static inline void kinc_g5_vertex_structure_init(kinc_g5_vertex_structure_t *structure) {
|
||||
kinc_g4_vertex_structure_init(structure);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an element to a vertex-structure.
|
||||
/// </summary>
|
||||
/// <param name="structure">The structure to add an element to</param>
|
||||
/// <param name="name">The name to use for the new element</param>
|
||||
/// <param name="data">The type of data to assign for the new element</param>
|
||||
/// <returns></returns>
|
||||
static inline void kinc_g5_vertex_structure_add(kinc_g5_vertex_structure_t *structure, const char *name, kinc_g5_vertex_data_t data) {
|
||||
kinc_g4_vertex_structure_add(structure, name, data);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user