diff --git a/sources/backends/android/kinc/backend/system.c.h b/sources/backends/android/kinc/backend/system.c.h index 41417bfd..2e6a5318 100644 --- a/sources/backends/android/kinc/backend/system.c.h +++ b/sources/backends/android/kinc/backend/system.c.h @@ -1182,10 +1182,6 @@ void android_main(struct android_app *application) { (*activity->vm)->DetachCurrentThread(activity->vm); } -#ifdef KINC_KONG -void kong_init(void); -#endif - int kinc_init(const char *name, int width, int height, struct kinc_window_options *win, struct kinc_framebuffer_options *frame) { kinc_mutex_init(&unicode_mutex); @@ -1206,10 +1202,6 @@ int kinc_init(const char *name, int width, int height, struct kinc_window_option kinc_g4_internal_init(); kinc_g4_internal_init_window(0, frame->depth_bits, frame->stencil_bits, true); -#ifdef KINC_KONG - kong_init(); -#endif - kinc_internal_gamepad_trigger_connect(0); return 0; diff --git a/sources/backends/direct3d11/kinc/backend/graphics4/Direct3D11.c.h b/sources/backends/direct3d11/kinc/backend/graphics4/Direct3D11.c.h index 073c1ebc..a01d2007 100644 --- a/sources/backends/direct3d11/kinc/backend/graphics4/Direct3D11.c.h +++ b/sources/backends/direct3d11/kinc/backend/graphics4/Direct3D11.c.h @@ -6,9 +6,7 @@ // #include #include #include -#include -#include #include #include #include @@ -29,16 +27,6 @@ int antialiasingSamples(void) { } #endif -#ifdef KINC_WINDOWSAPP -IUnknown *kinc_winapp_internal_get_window(void); -#endif - -#ifdef KINC_HOLOLENS -#include "DeviceResources.winrt.h" -#include "Hololens.winrt.h" -#include -#endif - // MinGW workaround for missing defines #ifndef D3D11_MIN_DEPTH #define D3D11_MIN_DEPTH (0.0f) @@ -60,11 +48,7 @@ bool kinc_internal_scissoring = false; // static bool vsync; static D3D_FEATURE_LEVEL featureLevel; -// #ifdef KINC_WINDOWSAPP -// static IDXGISwapChain1 *swapChain = NULL; -// #else // static IDXGISwapChain *swapChain = NULL; -// #endif static D3D11_SAMPLER_DESC lastSamplers[16]; struct Sampler { @@ -202,9 +186,6 @@ static bool isWindows10OrGreater(void) { void kinc_g4_internal_init(void) { D3D_FEATURE_LEVEL featureLevels[] = { -#ifdef KINC_WINDOWSAPP - D3D_FEATURE_LEVEL_11_1, -#endif D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0, @@ -216,9 +197,6 @@ void kinc_g4_internal_init(void) { #endif IDXGIAdapter *adapter = NULL; -#ifdef KINC_HOLOLENS - adapter = holographicFrameController->getCompatibleDxgiAdapter().Get(); -#endif HRESULT result = D3D11CreateDevice(adapter, D3D_DRIVER_TYPE_HARDWARE, NULL, flags, featureLevels, ARRAYSIZE(featureLevels), D3D11_SDK_VERSION, &dx_ctx.device, &featureLevel, &dx_ctx.context); @@ -248,7 +226,6 @@ void kinc_g4_internal_init_window(int windowId, int depthBufferBits, int stencil fragmentConstants[i] = 0; struct dx_window *window = &dx_ctx.windows[windowId]; - // TODO: make WindowsApp actually work again #ifdef KINC_WINDOWS window->hwnd = kinc_windows_window_handle(windowId); #endif @@ -335,11 +312,7 @@ void kinc_g4_internal_init_window(int windowId, int depthBufferBits, int stencil rtbd.SrcBlendAlpha = D3D11_BLEND_ONE; rtbd.DestBlendAlpha = D3D11_BLEND_ZERO; rtbd.BlendOpAlpha = D3D11_BLEND_OP_ADD; -#ifdef KINC_WINDOWSAPP - rtbd.RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; -#else rtbd.RenderTargetWriteMask = D3D10_COLOR_WRITE_ENABLE_ALL; -#endif blendDesc.AlphaToCoverageEnable = false; blendDesc.RenderTarget[0] = rtbd; @@ -474,10 +447,6 @@ void kinc_g4_begin(int windowId) { createBackbuffer(window, kinc_g4_antialiasing_samples()); } kinc_g4_restore_render_target(); - // #ifdef KINC_WINDOWSAPP - // // TODO (DK) do i need to do something here? - // dx_ctx.context->lpVtbl->OMSetRenderTargets(dx_ctx.context, 1, &renderTargetView, depthStencilView); - // #endif } void kinc_g4_viewport(int x, int y, int width, int height) { @@ -1207,19 +1176,11 @@ void kinc_g4_set_index_buffer(kinc_g4_index_buffer_t *buffer) { kinc_internal_g4_index_buffer_set(buffer); } -#ifdef KINC_KONG -void kinc_internal_texture_set(kinc_g4_texture_t *texture, uint32_t unit); - -void kinc_g4_set_texture(uint32_t unit, kinc_g4_texture_t *texture) { - kinc_internal_texture_set(texture, unit); -} -#else void kinc_internal_texture_set(kinc_g4_texture_t *texture, kinc_g4_texture_unit_t unit); void kinc_g4_set_texture(kinc_g4_texture_unit_t unit, kinc_g4_texture_t *texture) { kinc_internal_texture_set(texture, unit); } -#endif void kinc_internal_texture_set_image(kinc_g4_texture_t *texture, kinc_g4_texture_unit_t unit); @@ -1227,82 +1188,6 @@ void kinc_g4_set_image_texture(kinc_g4_texture_unit_t unit, kinc_g4_texture_t *t kinc_internal_texture_set_image(texture, unit); } -static unsigned queryCount = 0; -#define QUERY_POOL_MAX_SIZE 256 -static uint32_t query_pool_size = 0; -static ID3D11Query *queryPool[QUERY_POOL_MAX_SIZE]; - -bool kinc_g4_init_occlusion_query(unsigned *occlusionQuery) { - D3D11_QUERY_DESC queryDesc; - queryDesc.Query = D3D11_QUERY_OCCLUSION; - queryDesc.MiscFlags = 0; - ID3D11Query *pQuery = NULL; - HRESULT result = dx_ctx.device->lpVtbl->CreateQuery(dx_ctx.device, &queryDesc, &pQuery); - - if (FAILED(result)) { - kinc_log(KINC_LOG_LEVEL_INFO, "Internal query creation failed, result: 0x%X.", result); - return false; - } - - assert(query_pool_size < QUERY_POOL_MAX_SIZE); - queryPool[query_pool_size++] = pQuery; - *occlusionQuery = queryCount; - ++queryCount; - - return true; -} - -void kinc_g4_delete_occlusion_query(unsigned occlusionQuery) { - if (occlusionQuery < query_pool_size) { - queryPool[occlusionQuery] = NULL; - } -} - -void kinc_g4_start_occlusion_query(unsigned occlusionQuery) { - ID3D11Query *pQuery = queryPool[occlusionQuery]; - if (pQuery != NULL) { - dx_ctx.context->lpVtbl->Begin(dx_ctx.context, (ID3D11Asynchronous *)pQuery); - } -} - -void kinc_g4_end_occlusion_query(unsigned occlusionQuery) { - ID3D11Query *pQuery = queryPool[occlusionQuery]; - if (pQuery != NULL) { - dx_ctx.context->lpVtbl->End(dx_ctx.context, (ID3D11Asynchronous *)pQuery); - } -} - -bool kinc_g4_are_query_results_available(unsigned occlusionQuery) { - ID3D11Query *pQuery = queryPool[occlusionQuery]; - if (pQuery != NULL) { - if (S_OK == dx_ctx.context->lpVtbl->GetData(dx_ctx.context, (ID3D11Asynchronous *)pQuery, 0, 0, 0)) { - return true; - } - } - return false; -} - -void kinc_g4_get_query_results(unsigned occlusionQuery, unsigned *pixelCount) { - ID3D11Query *pQuery = queryPool[occlusionQuery]; - if (pQuery != NULL) { - UINT64 numberOfPixelsDrawn; - HRESULT result = dx_ctx.context->lpVtbl->GetData(dx_ctx.context, (ID3D11Asynchronous *)pQuery, &numberOfPixelsDrawn, sizeof(UINT64), 0); - if (S_OK == result) { - *pixelCount = (unsigned)numberOfPixelsDrawn; - } - else { - kinc_log(KINC_LOG_LEVEL_INFO, "Check first if results are available"); - *pixelCount = 0; - } - } -} - -void kinc_internal_texture_array_set(kinc_g4_texture_array_t *array, kinc_g4_texture_unit_t unit); - -void kinc_g4_set_texture_array(kinc_g4_texture_unit_t unit, kinc_g4_texture_array_t *array) { - kinc_internal_texture_array_set(array, unit); -} - void kinc_internal_resize(int windowId, int width, int height) { struct dx_window *window = &dx_ctx.windows[windowId]; window->new_width = width; @@ -1339,10 +1224,3 @@ bool kinc_g4_supports_non_pow2_textures(void) { bool kinc_g4_render_targets_inverted_y(void) { return false; } - -#ifdef KINC_KONG -void kinc_g4_set_constant_buffer(uint32_t id, struct kinc_g4_constant_buffer *buffer) { - dx_ctx.context->lpVtbl->VSSetConstantBuffers(dx_ctx.context, id, 1, &buffer->impl.buffer); - dx_ctx.context->lpVtbl->PSSetConstantBuffers(dx_ctx.context, id, 1, &buffer->impl.buffer); -} -#endif diff --git a/sources/backends/direct3d11/kinc/backend/graphics4/compute.c.h b/sources/backends/direct3d11/kinc/backend/graphics4/compute.c.h index a6de166d..1ce5d2fe 100644 --- a/sources/backends/direct3d11/kinc/backend/graphics4/compute.c.h +++ b/sources/backends/direct3d11/kinc/backend/graphics4/compute.c.h @@ -20,7 +20,6 @@ void kinc_g4_compute_shader_init(kinc_g4_compute_shader *shader, void *_data, in unsigned index = 0; uint8_t *data = (uint8_t *)_data; -#ifndef KINC_KONG memset(&shader->impl.attributes, 0, sizeof(shader->impl.attributes)); int attributesCount = data[index++]; for (int i = 0; i < attributesCount; ++i) { @@ -71,7 +70,6 @@ void kinc_g4_compute_shader_init(kinc_g4_compute_shader *shader, void *_data, in shader->impl.constants[i] = constant; shader->impl.constantsSize = constant.offset + constant.size; } -#endif shader->impl.length = (int)(length - index); shader->impl.data = (uint8_t *)malloc(shader->impl.length); @@ -86,7 +84,6 @@ void kinc_g4_compute_shader_init(kinc_g4_compute_shader *shader, void *_data, in return; } -#ifndef KINC_KONG D3D11_BUFFER_DESC desc; desc.ByteWidth = getMultipleOf16(shader->impl.constantsSize); desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; @@ -95,7 +92,6 @@ void kinc_g4_compute_shader_init(kinc_g4_compute_shader *shader, void *_data, in desc.MiscFlags = 0; desc.StructureByteStride = 0; kinc_microsoft_affirm(dx_ctx.device->lpVtbl->CreateBuffer(dx_ctx.device, &desc, NULL, &shader->impl.constantBuffer)); -#endif } void kinc_g4_compute_shader_destroy(kinc_g4_compute_shader *shader) {} @@ -118,7 +114,6 @@ static kinc_internal_hash_index_t *compute_findTextureUnit(kinc_internal_hash_in return NULL; } -#ifndef KINC_KONG kinc_g4_constant_location_t kinc_g4_compute_shader_get_constant_location(kinc_g4_compute_shader *shader, const char *name) { kinc_g4_constant_location_t location = {0}; @@ -185,14 +180,11 @@ kinc_g4_texture_unit_t kinc_g4_compute_shader_get_texture_unit(kinc_g4_compute_s } return unit; } -#endif void kinc_g4_set_compute_shader(kinc_g4_compute_shader *shader) { dx_ctx.context->lpVtbl->CSSetShader(dx_ctx.context, (ID3D11ComputeShader *)shader->impl.shader, NULL, 0); -#ifndef KINC_KONG dx_ctx.context->lpVtbl->UpdateSubresource(dx_ctx.context, (ID3D11Resource *)shader->impl.constantBuffer, 0, NULL, computeConstants, 0, 0); dx_ctx.context->lpVtbl->CSSetConstantBuffers(dx_ctx.context, 0, 1, &shader->impl.constantBuffer); -#endif } void kinc_g4_compute(int x, int y, int z) { diff --git a/sources/backends/direct3d11/kinc/backend/graphics4/compute.h b/sources/backends/direct3d11/kinc/backend/graphics4/compute.h index fdda756a..b85d053c 100644 --- a/sources/backends/direct3d11/kinc/backend/graphics4/compute.h +++ b/sources/backends/direct3d11/kinc/backend/graphics4/compute.h @@ -28,13 +28,11 @@ typedef struct kinc_g4_compute_internal_shader_constant { } kinc_g4_compute_internal_shader_constant; typedef struct kinc_g4_compute_shader_impl { -#ifndef KINC_KONG kinc_g4_compute_internal_shader_constant constants[64]; int constantsSize; kinc_internal_hash_index_t attributes[64]; kinc_internal_hash_index_t textures[64]; struct ID3D11Buffer *constantBuffer; -#endif void *shader; uint8_t *data; int length; diff --git a/sources/backends/direct3d11/kinc/backend/graphics4/constantbuffer.c.h b/sources/backends/direct3d11/kinc/backend/graphics4/constantbuffer.c.h deleted file mode 100644 index fb6b9c7b..00000000 --- a/sources/backends/direct3d11/kinc/backend/graphics4/constantbuffer.c.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifdef KINC_KONG - -#include - -void kinc_g4_constant_buffer_init(kinc_g4_constant_buffer *buffer, size_t size) { - buffer->impl.size = size; - buffer->impl.last_start = 0; - buffer->impl.last_size = size; - - D3D11_BUFFER_DESC desc; - desc.ByteWidth = (UINT)get_multiple_of_16(size); - desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; - desc.Usage = D3D11_USAGE_DYNAMIC; - desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - desc.MiscFlags = 0; - desc.StructureByteStride = 0; - kinc_microsoft_affirm(dx_ctx.device->lpVtbl->CreateBuffer(dx_ctx.device, &desc, NULL, &buffer->impl.buffer)); -} - -void kinc_g4_constant_buffer_destroy(kinc_g4_constant_buffer *buffer) { - buffer->impl.buffer->lpVtbl->Release(buffer->impl.buffer); -} - -uint8_t *kinc_g4_constant_buffer_lock_all(kinc_g4_constant_buffer *buffer) { - return kinc_g4_constant_buffer_lock(buffer, 0, kinc_g4_constant_buffer_size(buffer)); -} - -uint8_t *kinc_g4_constant_buffer_lock(kinc_g4_constant_buffer *buffer, size_t start, size_t size) { - buffer->impl.last_start = start; - buffer->impl.last_size = size; - - D3D11_MAPPED_SUBRESOURCE mapped_resource; - memset(&mapped_resource, 0, sizeof(D3D11_MAPPED_SUBRESOURCE)); - dx_ctx.context->lpVtbl->Map(dx_ctx.context, (ID3D11Resource *)buffer->impl.buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped_resource); - uint8_t *data = (uint8_t *)mapped_resource.pData; - return &data[start]; -} - -void kinc_g4_constant_buffer_unlock_all(kinc_g4_constant_buffer *buffer) { - kinc_g4_constant_buffer_unlock(buffer, buffer->impl.last_size); -} - -void kinc_g4_constant_buffer_unlock(kinc_g4_constant_buffer *buffer, size_t count) { - dx_ctx.context->lpVtbl->Unmap(dx_ctx.context, (ID3D11Resource *)buffer->impl.buffer, 0); -} - -size_t kinc_g4_constant_buffer_size(kinc_g4_constant_buffer *buffer) { - return buffer->impl.size; -} - -#endif diff --git a/sources/backends/direct3d11/kinc/backend/graphics4/constantbuffer.h b/sources/backends/direct3d11/kinc/backend/graphics4/constantbuffer.h deleted file mode 100644 index 1381fac2..00000000 --- a/sources/backends/direct3d11/kinc/backend/graphics4/constantbuffer.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#ifdef KINC_KONG - -struct ID3D11Buffer; - -typedef struct kinc_g4_constant_buffer_impl { - struct ID3D11Buffer *buffer; - size_t size; - size_t last_start; - size_t last_size; -} kinc_g4_constant_buffer_impl; - -#endif diff --git a/sources/backends/direct3d11/kinc/backend/graphics4/d3d11unit.c b/sources/backends/direct3d11/kinc/backend/graphics4/d3d11unit.c index 6281dad1..424c2c23 100644 --- a/sources/backends/direct3d11/kinc/backend/graphics4/d3d11unit.c +++ b/sources/backends/direct3d11/kinc/backend/graphics4/d3d11unit.c @@ -48,12 +48,8 @@ #include -#ifdef KINC_WINDOWSAPP -#include -#else #pragma warning(disable : 4005) #include -#endif #include "Direct3D11.h" @@ -103,11 +99,9 @@ static size_t get_multiple_of_16(size_t value) { #include "Direct3D11.c.h" #include "ShaderHash.c.h" #include "compute.c.h" -#include "constantbuffer.c.h" #include "indexbuffer.c.h" #include "pipeline.c.h" #include "rendertarget.c.h" #include "shader.c.h" #include "texture.c.h" -#include "texturearray.c.h" #include "vertexbuffer.c.h" diff --git a/sources/backends/direct3d11/kinc/backend/graphics4/pipeline.c.h b/sources/backends/direct3d11/kinc/backend/graphics4/pipeline.c.h index 02ccc976..bbb84b4f 100644 --- a/sources/backends/direct3d11/kinc/backend/graphics4/pipeline.c.h +++ b/sources/backends/direct3d11/kinc/backend/graphics4/pipeline.c.h @@ -91,7 +91,6 @@ static D3D11_STENCIL_OP get_stencil_action(kinc_g4_stencil_action_t action) { } void kinc_internal_set_constants(void) { -#ifndef KINC_KONG if (currentPipeline->vertex_shader->impl.constantsSize > 0) { dx_ctx.context->lpVtbl->UpdateSubresource(dx_ctx.context, (ID3D11Resource *)currentPipeline->impl.vertexConstantBuffer, 0, NULL, vertexConstants, 0, 0); dx_ctx.context->lpVtbl->VSSetConstantBuffers(dx_ctx.context, 0, 1, ¤tPipeline->impl.vertexConstantBuffer); @@ -116,7 +115,6 @@ void kinc_internal_set_constants(void) { 0); dx_ctx.context->lpVtbl->DSSetConstantBuffers(dx_ctx.context, 0, 1, ¤tPipeline->impl.tessEvalConstantBuffer); } -#endif } void kinc_g4_pipeline_init(struct kinc_g4_pipeline *state) { @@ -211,7 +209,6 @@ void kinc_internal_pipeline_rebind() { } } -#ifndef KINC_KONG static kinc_internal_shader_constant_t *findConstant(kinc_internal_shader_constant_t *constants, uint32_t hash) { for (int i = 0; i < 64; ++i) { if (constants[i].hash == hash) { @@ -371,7 +368,6 @@ kinc_g4_texture_unit_t kinc_g4_pipeline_get_texture_unit(struct kinc_g4_pipeline return unit; } -#endif static char stringCache[1024]; static int stringCacheIndex = 0; @@ -436,7 +432,6 @@ static void createRenderTargetBlendDesc(struct kinc_g4_pipeline *pipe, D3D11_REN } void kinc_g4_pipeline_compile(struct kinc_g4_pipeline *state) { -#ifndef KINC_KONG if (state->vertex_shader->impl.constantsSize > 0) { D3D11_BUFFER_DESC desc; desc.ByteWidth = (UINT)get_multiple_of_16(state->vertex_shader->impl.constantsSize); @@ -487,7 +482,6 @@ void kinc_g4_pipeline_compile(struct kinc_g4_pipeline *state) { desc.StructureByteStride = 0; kinc_microsoft_affirm(dx_ctx.device->lpVtbl->CreateBuffer(dx_ctx.device, &desc, NULL, &state->impl.tessEvalConstantBuffer)); } -#endif int all = 0; for (int stream = 0; state->input_layout[stream] != NULL; ++stream) { @@ -501,21 +495,15 @@ void kinc_g4_pipeline_compile(struct kinc_g4_pipeline *state) { } } -#ifndef KINC_KONG bool used[usedCount]; for (int i = 0; i < usedCount; ++i) used[i] = false; for (int i = 0; i < 64; ++i) { used[state->vertex_shader->impl.attributes[i].index] = true; } -#endif stringCacheIndex = 0; D3D11_INPUT_ELEMENT_DESC *vertexDesc = (D3D11_INPUT_ELEMENT_DESC *)alloca(sizeof(D3D11_INPUT_ELEMENT_DESC) * all); -#ifdef KINC_KONG -#define getAttributeLocation(a, b, c) index -#endif - int i = 0; for (int stream = 0; state->input_layout[stream] != NULL; ++stream) { for (int index = 0; index < state->input_layout[stream]->size; ++index) { diff --git a/sources/backends/direct3d11/kinc/backend/graphics4/rendertarget.c.h b/sources/backends/direct3d11/kinc/backend/graphics4/rendertarget.c.h index 9e6e1025..34cce521 100644 --- a/sources/backends/direct3d11/kinc/backend/graphics4/rendertarget.c.h +++ b/sources/backends/direct3d11/kinc/backend/graphics4/rendertarget.c.h @@ -373,17 +373,6 @@ void kinc_g4_render_target_destroy(kinc_g4_render_target_t *renderTarget) { renderTarget->impl.textureSample->lpVtbl->Release(renderTarget->impl.textureSample); } -#ifdef KINC_KONG -void kinc_g4_render_target_use_color_as_texture(kinc_g4_render_target_t *renderTarget, uint32_t unit) { - if (renderTarget->impl.textureSample != renderTarget->impl.textureRender) { - dx_ctx.context->lpVtbl->ResolveSubresource(dx_ctx.context, (ID3D11Resource *)renderTarget->impl.textureSample, 0, - (ID3D11Resource *)renderTarget->impl.textureRender, 0, DXGI_FORMAT_R8G8B8A8_UNORM); - } - - dx_ctx.context->lpVtbl->PSSetShaderResources(dx_ctx.context, unit, 1, - renderTarget->isDepthAttachment ? &renderTarget->impl.depthStencilSRV : &renderTarget->impl.renderTargetSRV); -} -#else void kinc_g4_render_target_use_color_as_texture(kinc_g4_render_target_t *renderTarget, kinc_g4_texture_unit_t unit) { if (unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT] < 0 && unit.stages[KINC_G4_SHADER_TYPE_VERTEX] < 0) return; @@ -405,7 +394,6 @@ void kinc_g4_render_target_use_color_as_texture(kinc_g4_render_target_t *renderT : &renderTarget->impl.renderTargetSRV); } } -#endif void kinc_g4_render_target_use_depth_as_texture(kinc_g4_render_target_t *renderTarget, kinc_g4_texture_unit_t unit) { if (unit.stages[KINC_G4_SHADER_TYPE_VERTEX] >= 0) { diff --git a/sources/backends/direct3d11/kinc/backend/graphics4/shader.c.h b/sources/backends/direct3d11/kinc/backend/graphics4/shader.c.h index af95869a..70671d5b 100644 --- a/sources/backends/direct3d11/kinc/backend/graphics4/shader.c.h +++ b/sources/backends/direct3d11/kinc/backend/graphics4/shader.c.h @@ -12,7 +12,6 @@ void kinc_g4_shader_init(kinc_g4_shader_t *shader, const void *_data, size_t len uint8_t *data = (uint8_t *)_data; shader->impl.type = (int)type; -#ifndef KINC_KONG memset(&shader->impl.attributes, 0, sizeof(shader->impl.attributes)); int attributesCount = data[index++]; for (int i = 0; i < attributesCount; ++i) { @@ -63,7 +62,6 @@ void kinc_g4_shader_init(kinc_g4_shader_t *shader, const void *_data, size_t len shader->impl.constants[i] = constant; shader->impl.constantsSize = constant.offset + constant.size; } -#endif shader->impl.length = (int)(length - index); shader->impl.data = (uint8_t *)malloc(shader->impl.length); diff --git a/sources/backends/direct3d11/kinc/backend/graphics4/shader.h b/sources/backends/direct3d11/kinc/backend/graphics4/shader.h index 7ac58f62..f082fcda 100644 --- a/sources/backends/direct3d11/kinc/backend/graphics4/shader.h +++ b/sources/backends/direct3d11/kinc/backend/graphics4/shader.h @@ -18,12 +18,10 @@ typedef struct { } kinc_internal_shader_constant_t; typedef struct { -#ifndef KINC_KONG kinc_internal_shader_constant_t constants[64]; int constantsSize; kinc_internal_hash_index_t attributes[64]; kinc_internal_hash_index_t textures[64]; -#endif void *shader; uint8_t *data; int length; diff --git a/sources/backends/direct3d11/kinc/backend/graphics4/texture.c.h b/sources/backends/direct3d11/kinc/backend/graphics4/texture.c.h index 3c1bbe36..89dc7b96 100644 --- a/sources/backends/direct3d11/kinc/backend/graphics4/texture.c.h +++ b/sources/backends/direct3d11/kinc/backend/graphics4/texture.c.h @@ -207,14 +207,6 @@ void kinc_internal_texture_unmipmap(kinc_g4_texture_t *texture) { texture->impl.hasMipmaps = false; } -#ifdef KINC_KONG -void kinc_internal_texture_set(kinc_g4_texture_t *texture, uint32_t unit) { - dx_ctx.context->lpVtbl->PSSetShaderResources(dx_ctx.context, unit, 1, &texture->impl.view); - - texture->impl.stage = unit; - setTextures[unit] = texture; -} -#else void kinc_internal_texture_set(kinc_g4_texture_t *texture, kinc_g4_texture_unit_t unit) { if (unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT] < 0 && unit.stages[KINC_G4_SHADER_TYPE_VERTEX] < 0 && unit.stages[KINC_G4_SHADER_TYPE_COMPUTE] < 0) return; @@ -237,7 +229,6 @@ void kinc_internal_texture_set(kinc_g4_texture_t *texture, kinc_g4_texture_unit_ setTextures[texture->impl.stage] = texture; } } -#endif void kinc_internal_texture_set_image(kinc_g4_texture_t *texture, kinc_g4_texture_unit_t unit) { if (unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT] < 0 && unit.stages[KINC_G4_SHADER_TYPE_VERTEX] < 0 && unit.stages[KINC_G4_SHADER_TYPE_COMPUTE] < 0) diff --git a/sources/backends/direct3d11/kinc/backend/graphics4/texturearray.c.h b/sources/backends/direct3d11/kinc/backend/graphics4/texturearray.c.h deleted file mode 100644 index 598a416e..00000000 --- a/sources/backends/direct3d11/kinc/backend/graphics4/texturearray.c.h +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include - -void kinc_g4_texture_array_init(kinc_g4_texture_array_t *array, kinc_image_t *textures, int count) { - D3D11_TEXTURE2D_DESC desc; - desc.Width = textures[0].width; - desc.Height = textures[0].height; - desc.MipLevels = 1; - desc.ArraySize = 2; - desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - desc.SampleDesc.Count = 1; - desc.SampleDesc.Quality = 0; - desc.Usage = D3D11_USAGE_DEFAULT; - desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; - desc.CPUAccessFlags = 0; - desc.MiscFlags = 0; - - D3D11_SUBRESOURCE_DATA *resdata = (D3D11_SUBRESOURCE_DATA *)alloca(sizeof(D3D11_SUBRESOURCE_DATA) * count); - for (int i = 0; i < count; ++i) { - resdata[i].pSysMem = textures[i].data; - resdata[i].SysMemPitch = textures[0].width * 4; - resdata[i].SysMemSlicePitch = 0; - } - - array->impl.texture = NULL; - kinc_microsoft_affirm(dx_ctx.device->lpVtbl->CreateTexture2D(dx_ctx.device, &desc, resdata, &array->impl.texture)); - kinc_microsoft_affirm(dx_ctx.device->lpVtbl->CreateShaderResourceView(dx_ctx.device, (ID3D11Resource *)array->impl.texture, NULL, &array->impl.view)); -} - -void kinc_g4_texture_array_destroy(kinc_g4_texture_array_t *array) {} - -void kinc_internal_texture_array_set(kinc_g4_texture_array_t *array, kinc_g4_texture_unit_t unit) { - if (unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT] < 0) - return; - - dx_ctx.context->lpVtbl->PSSetShaderResources(dx_ctx.context, unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT], 1, &array->impl.view); - // this->stage = unit.unit; - // setTextures[stage] = this; -} diff --git a/sources/backends/direct3d11/kinc/backend/graphics4/texturearray.h b/sources/backends/direct3d11/kinc/backend/graphics4/texturearray.h deleted file mode 100644 index 65cc3acd..00000000 --- a/sources/backends/direct3d11/kinc/backend/graphics4/texturearray.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -struct ID3D11Texture2D; -struct ID3D11ShaderResourceView; - -typedef struct { - struct ID3D11Texture2D *texture; - struct ID3D11ShaderResourceView *view; - // void set(Kore::Graphics4::TextureUnit unit); -} kinc_g4_texture_array_impl_t; - -#ifdef __cplusplus -} -#endif diff --git a/sources/backends/direct3d12/kinc/backend/graphics5/Direct3D12.c.h b/sources/backends/direct3d12/kinc/backend/graphics5/Direct3D12.c.h index 6136c943..2ac40ecb 100644 --- a/sources/backends/direct3d12/kinc/backend/graphics5/Direct3D12.c.h +++ b/sources/backends/direct3d12/kinc/backend/graphics5/Direct3D12.c.h @@ -541,10 +541,6 @@ void kinc_g5_begin(kinc_g5_render_target_t *renderTarget, int windowId) { window->fence_values[window->current_backbuffer] = fenceValue; ++window->current_fence_value; -#ifdef KINC_WINDOWSAPP - context->OMSetRenderTargets(1, &renderTargetView, depthStencilView); -#endif - waitForFence(window->frame_fences[window->current_backbuffer], window->fence_values[window->current_backbuffer], window->frame_fence_events[window->current_backbuffer]); diff --git a/sources/backends/direct3d12/kinc/backend/graphics5/commandlist.c.h b/sources/backends/direct3d12/kinc/backend/graphics5/commandlist.c.h index 2593eb98..da50a9a7 100644 --- a/sources/backends/direct3d12/kinc/backend/graphics5/commandlist.c.h +++ b/sources/backends/direct3d12/kinc/backend/graphics5/commandlist.c.h @@ -1,6 +1,5 @@ #include #include -#include #include #include #include @@ -426,7 +425,7 @@ void kinc_g5_command_list_upload_texture(kinc_g5_command_list_t *list, kinc_g5_t } } -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) static int d3d12_textureAlignment() { return D3D12_TEXTURE_DATA_PITCH_ALIGNMENT; } @@ -569,10 +568,6 @@ void kinc_g5_command_list_set_sampler(kinc_g5_command_list_t *list, kinc_g5_text kinc_g5_internal_set_textures(list); } -bool kinc_g5_command_list_init_occlusion_query(kinc_g5_command_list_t *list, unsigned *occlusionQuery) { - return false; -} - 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) { if (unit.stages[KINC_G5_SHADER_TYPE_FRAGMENT] >= 0) { kinc_g5_internal_texture_set(list, texture, unit.stages[KINC_G5_SHADER_TYPE_FRAGMENT]); @@ -586,16 +581,6 @@ void kinc_g5_command_list_set_image_texture(kinc_g5_command_list_t *list, kinc_g kinc_g5_internal_set_textures(list); } -void kinc_g5_command_list_delete_occlusion_query(kinc_g5_command_list_t *list, unsigned occlusionQuery) {} - -void kinc_g5_command_list_render_occlusion_query(kinc_g5_command_list_t *list, unsigned occlusionQuery, int triangles) {} - -bool kinc_g5_command_list_are_query_results_available(kinc_g5_command_list_t *list, unsigned occlusionQuery) { - return false; -} - -void kinc_g5_command_list_get_query_result(kinc_g5_command_list_t *list, unsigned occlusionQuery, unsigned *pixelCount) {} - 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) { if (unit.stages[KINC_G5_SHADER_TYPE_FRAGMENT] >= 0) { target->impl.stage = unit.stages[KINC_G5_SHADER_TYPE_FRAGMENT]; diff --git a/sources/backends/direct3d12/kinc/backend/graphics5/constantbuffer.c.h b/sources/backends/direct3d12/kinc/backend/graphics5/constantbuffer.c.h index 5b16ba73..f483383d 100644 --- a/sources/backends/direct3d12/kinc/backend/graphics5/constantbuffer.c.h +++ b/sources/backends/direct3d12/kinc/backend/graphics5/constantbuffer.c.h @@ -1,4 +1,3 @@ -#include #include diff --git a/sources/backends/direct3d12/kinc/backend/graphics5/constantbuffer.h b/sources/backends/direct3d12/kinc/backend/graphics5/constantbuffer.h index 43e75ba5..3638bc48 100644 --- a/sources/backends/direct3d12/kinc/backend/graphics5/constantbuffer.h +++ b/sources/backends/direct3d12/kinc/backend/graphics5/constantbuffer.h @@ -13,8 +13,8 @@ typedef struct { int mySize; } ConstantBuffer5Impl; -KINC_FUNC extern bool kinc_g5_transposeMat3; -KINC_FUNC extern bool kinc_g5_transposeMat4; +extern bool kinc_g5_transposeMat3; +extern bool kinc_g5_transposeMat4; #ifdef __cplusplus } diff --git a/sources/backends/direct3d12/kinc/backend/graphics5/pipeline.c.h b/sources/backends/direct3d12/kinc/backend/graphics5/pipeline.c.h index 18c06ecd..2cd81b97 100644 --- a/sources/backends/direct3d12/kinc/backend/graphics5/pipeline.c.h +++ b/sources/backends/direct3d12/kinc/backend/graphics5/pipeline.c.h @@ -331,11 +331,7 @@ void kinc_g5_pipeline_compile(kinc_g5_pipeline_t *pipe) { for (int stream = 0; pipe->inputLayout[stream] != NULL; ++stream) { for (int i = 0; i < pipe->inputLayout[stream]->size; ++i) { vertexDesc[curAttr].SemanticName = "TEXCOORD"; -#ifdef KINC_KONG - vertexDesc[curAttr].SemanticIndex = i; -#else vertexDesc[curAttr].SemanticIndex = findAttribute(pipe->vertexShader, pipe->inputLayout[stream]->elements[i].name).attribute; -#endif vertexDesc[curAttr].InputSlot = stream; vertexDesc[curAttr].AlignedByteOffset = (i == 0) ? 0 : D3D12_APPEND_ALIGNED_ELEMENT; vertexDesc[curAttr].InputSlotClass = diff --git a/sources/backends/direct3d12/kinc/backend/graphics5/raytrace.c.h b/sources/backends/direct3d12/kinc/backend/graphics5/raytrace.c.h index 52239982..a9302eb5 100644 --- a/sources/backends/direct3d12/kinc/backend/graphics5/raytrace.c.h +++ b/sources/backends/direct3d12/kinc/backend/graphics5/raytrace.c.h @@ -3,7 +3,6 @@ #include #include -#include #include #include #include diff --git a/sources/backends/direct3d12/kinc/backend/graphics5/shader.c.h b/sources/backends/direct3d12/kinc/backend/graphics5/shader.c.h index 7c7586e9..d5856141 100644 --- a/sources/backends/direct3d12/kinc/backend/graphics5/shader.c.h +++ b/sources/backends/direct3d12/kinc/backend/graphics5/shader.c.h @@ -10,7 +10,6 @@ void kinc_g5_shader_init(kinc_g5_shader_t *shader, const void *_data, size_t len unsigned index = 0; uint8_t *data = (uint8_t *)_data; -#ifndef KINC_KONG int attributesCount = data[index++]; for (int i = 0; i < attributesCount; ++i) { char name[64]; @@ -57,7 +56,6 @@ void kinc_g5_shader_init(kinc_g5_shader_t *shader, const void *_data, size_t len shader->impl.constants[i] = constant; shader->impl.constantsSize = constant.offset + constant.size; } -#endif shader->impl.length = (int)length - index; shader->impl.data = (uint8_t *)malloc(shader->impl.length); diff --git a/sources/backends/direct3d12/kinc/backend/graphics5/texture.c.h b/sources/backends/direct3d12/kinc/backend/graphics5/texture.c.h index 1d3c7cf4..6b406d63 100644 --- a/sources/backends/direct3d12/kinc/backend/graphics5/texture.c.h +++ b/sources/backends/direct3d12/kinc/backend/graphics5/texture.c.h @@ -10,7 +10,7 @@ static const int heapSize = 1024; -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) /*static int d3d12_textureAlignment() { return D3D12_TEXTURE_DATA_PITCH_ALIGNMENT; }*/ diff --git a/sources/backends/g4ong5/kinc/backend/graphics4/G4.c.h b/sources/backends/g4ong5/kinc/backend/graphics4/G4.c.h index fd4b5519..ecfc8d91 100644 --- a/sources/backends/g4ong5/kinc/backend/graphics4/G4.c.h +++ b/sources/backends/g4ong5/kinc/backend/graphics4/G4.c.h @@ -7,13 +7,11 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include #include @@ -691,38 +689,6 @@ void kinc_g4_set_index_buffer(kinc_g4_index_buffer_t *buffer) { kinc_g5_command_list_set_index_buffer(&commandList, g5_index_buffer); } -#ifdef KINC_KONG -void kinc_g4_set_texture(uint32_t unit, kinc_g4_texture_t *texture) { - if (!texture->impl._uploaded) { - kinc_g5_command_list_upload_texture(&commandList, &texture->impl._texture); - texture->impl._uploaded = true; - } - - assert(KINC_G4_SHADER_TYPE_COUNT == KINC_G5_SHADER_TYPE_COUNT); - kinc_g5_texture_unit_t g5_unit = {0}; - for (int i = 0; i < KINC_G5_SHADER_TYPE_COUNT; ++i) { - g5_unit.stages[i] = unit; - } - - bool found = false; - for (int i = 0; i < current_state.texture_count; ++i) { - if (kinc_g5_texture_unit_equals(¤t_state.texture_units[i], &g5_unit)) { - current_state.textures[i] = &texture->impl._texture; - current_state.texture_units[i] = g5_unit; - found = true; - break; - } - } - if (!found) { - assert(current_state.texture_count < MAX_TEXTURES); - current_state.textures[current_state.texture_count] = &texture->impl._texture; - current_state.texture_units[current_state.texture_count] = g5_unit; - current_state.texture_count += 1; - } - - kinc_g5_command_list_set_texture(&commandList, g5_unit, &texture->impl._texture); -} -#else void kinc_g4_set_texture(kinc_g4_texture_unit_t unit, kinc_g4_texture_t *texture) { if (!texture->impl._uploaded) { kinc_g5_command_list_upload_texture(&commandList, &texture->impl._texture); @@ -751,7 +717,6 @@ void kinc_g4_set_texture(kinc_g4_texture_unit_t unit, kinc_g4_texture_t *texture kinc_g5_command_list_set_texture(&commandList, g5_unit, &texture->impl._texture); } -#endif void kinc_g4_set_image_texture(kinc_g4_texture_unit_t unit, kinc_g4_texture_t *texture) { assert(KINC_G4_SHADER_TYPE_COUNT == KINC_G5_SHADER_TYPE_COUNT); @@ -781,22 +746,6 @@ int kinc_g4_max_bound_textures(void) { return kinc_g5_max_bound_textures(); } -bool kinc_g4_init_occlusion_query(unsigned *occlusionQuery) { - return kinc_g5_command_list_init_occlusion_query(&commandList, occlusionQuery); -} - -void kinc_g4_delete_occlusion_query(unsigned occlusionQuery) { - kinc_g5_command_list_delete_occlusion_query(&commandList, occlusionQuery); -} - -bool kinc_g4_are_query_results_available(unsigned occlusionQuery) { - return kinc_g5_command_list_are_query_results_available(&commandList, occlusionQuery); -} - -void kinc_g4_get_query_result(unsigned occlusionQuery, unsigned *pixelCount) { - kinc_g5_command_list_get_query_result(&commandList, occlusionQuery, pixelCount); -} - void kinc_g4_set_pipeline(kinc_g4_pipeline_t *pipeline) { kinc_g5_pipeline_t *g5_pipeline = &pipeline->impl._pipeline; current_state.pipeline = g5_pipeline; @@ -812,8 +761,6 @@ void kinc_g4_set_blend_constant(float r, float g, float b, float a) { kinc_g5_command_list_set_blend_constant(&commandList, r, g, b, a); } -void kinc_g4_set_texture_array(kinc_g4_texture_unit_t unit, struct kinc_g4_texture_array *array) {} - bool kinc_g4_supports_instanced_rendering(void) { return kinc_g5_supports_instanced_rendering(); } @@ -834,38 +781,6 @@ bool kinc_g4_render_targets_inverted_y(void) { return kinc_g5_render_targets_inverted_y(); } -#ifdef KINC_KONG -void kinc_g4_render_target_use_color_as_texture(kinc_g4_render_target_t *render_target, uint32_t unit) { - if (render_target->impl.state != KINC_INTERNAL_RENDER_TARGET_STATE_TEXTURE) { - kinc_g5_command_list_render_target_to_texture_barrier(&commandList, &render_target->impl._renderTarget); - render_target->impl.state = KINC_INTERNAL_RENDER_TARGET_STATE_TEXTURE; - } - - assert(KINC_G4_SHADER_TYPE_COUNT == KINC_G5_SHADER_TYPE_COUNT); - kinc_g5_texture_unit_t g5_unit = {0}; - for (int i = 0; i < KINC_G5_SHADER_TYPE_COUNT; ++i) { - g5_unit.stages[i] = unit; - } - - bool found = false; - for (int i = 0; i < current_state.render_target_count; ++i) { - if (kinc_g5_texture_unit_equals(¤t_state.render_target_units[i], &g5_unit)) { - current_state.render_targets[i] = &render_target->impl._renderTarget; - current_state.render_target_units[i] = g5_unit; - found = true; - break; - } - } - if (!found) { - assert(current_state.render_target_count < MAX_TEXTURES); - current_state.render_targets[current_state.render_target_count] = &render_target->impl._renderTarget; - current_state.render_target_units[current_state.render_target_count] = g5_unit; - current_state.render_target_count += 1; - } - - kinc_g5_command_list_set_texture_from_render_target(&commandList, g5_unit, &render_target->impl._renderTarget); -} -#else void kinc_g4_render_target_use_color_as_texture(kinc_g4_render_target_t *render_target, kinc_g4_texture_unit_t unit) { if (render_target->impl.state != KINC_INTERNAL_RENDER_TARGET_STATE_TEXTURE) { kinc_g5_command_list_render_target_to_texture_barrier(&commandList, &render_target->impl._renderTarget); @@ -894,7 +809,6 @@ void kinc_g4_render_target_use_color_as_texture(kinc_g4_render_target_t *render_ kinc_g5_command_list_set_texture_from_render_target(&commandList, g5_unit, &render_target->impl._renderTarget); } -#endif void kinc_g4_render_target_use_depth_as_texture(kinc_g4_render_target_t *render_target, kinc_g4_texture_unit_t unit) { if (render_target->impl.state != KINC_INTERNAL_RENDER_TARGET_STATE_TEXTURE) { @@ -925,12 +839,6 @@ void kinc_g4_render_target_use_depth_as_texture(kinc_g4_render_target_t *render_ kinc_g5_command_list_set_texture_from_render_target_depth(&commandList, g5_unit, &render_target->impl._renderTarget); } -#ifdef KINC_KONG -void kinc_g4_set_constant_buffer(uint32_t id, struct kinc_g4_constant_buffer *buffer) { - kinc_g5_command_list_set_vertex_constant_buffer(&commandList, &buffer->impl.buffer, 0, kinc_g5_constant_buffer_size(&buffer->impl.buffer)); -} -#endif - void kinc_g4_set_compute_shader(kinc_g4_compute_shader *shader) { kinc_g5_compute_shader *g5_shader = &shader->impl.shader; current_state.compute_shader = g5_shader; diff --git a/sources/backends/g4ong5/kinc/backend/graphics4/compute.c.h b/sources/backends/g4ong5/kinc/backend/graphics4/compute.c.h index cfc687b2..bbab09bd 100644 --- a/sources/backends/g4ong5/kinc/backend/graphics4/compute.c.h +++ b/sources/backends/g4ong5/kinc/backend/graphics4/compute.c.h @@ -19,7 +19,6 @@ void kinc_g4_compute_shader_destroy(kinc_g4_compute_shader *shader) { kinc_g5_compute_shader_destroy(&shader->impl.shader); } -#ifndef KINC_KONG kinc_g4_constant_location_t kinc_g4_compute_shader_get_constant_location(kinc_g4_compute_shader *shader, const char *name) { kinc_g4_constant_location_t location; location.impl._location = kinc_g5_compute_shader_get_constant_location(&shader->impl.shader, name); @@ -34,4 +33,3 @@ kinc_g4_texture_unit_t kinc_g4_compute_shader_get_texture_unit(kinc_g4_compute_s } return g4_unit; } -#endif diff --git a/sources/backends/g4ong5/kinc/backend/graphics4/constantbuffer.c.h b/sources/backends/g4ong5/kinc/backend/graphics4/constantbuffer.c.h deleted file mode 100644 index ff6d9d00..00000000 --- a/sources/backends/g4ong5/kinc/backend/graphics4/constantbuffer.c.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifdef KINC_KONG - -#include - -void kinc_g4_constant_buffer_init(kinc_g4_constant_buffer *buffer, size_t size) { - kinc_g5_constant_buffer_init(&buffer->impl.buffer, (int)size); -} - -void kinc_g4_constant_buffer_destroy(kinc_g4_constant_buffer *buffer) { - kinc_g5_constant_buffer_destroy(&buffer->impl.buffer); -} - -uint8_t *kinc_g4_constant_buffer_lock_all(kinc_g4_constant_buffer *buffer) { - kinc_g5_constant_buffer_lock_all(&buffer->impl.buffer); - return buffer->impl.buffer.data; -} - -uint8_t *kinc_g4_constant_buffer_lock(kinc_g4_constant_buffer *buffer, size_t start, size_t size) { - kinc_g5_constant_buffer_lock(&buffer->impl.buffer, (int)start, (int)size); - return buffer->impl.buffer.data; -} - -void kinc_g4_constant_buffer_unlock_all(kinc_g4_constant_buffer *buffer) { - kinc_g5_constant_buffer_unlock(&buffer->impl.buffer); -} - -void kinc_g4_constant_buffer_unlock(kinc_g4_constant_buffer *buffer, size_t count) { - kinc_g5_constant_buffer_unlock(&buffer->impl.buffer); -} - -size_t kinc_g4_constant_buffer_size(kinc_g4_constant_buffer *buffer) { - return kinc_g5_constant_buffer_size(&buffer->impl.buffer); -} - -#endif diff --git a/sources/backends/g4ong5/kinc/backend/graphics4/constantbuffer.h b/sources/backends/g4ong5/kinc/backend/graphics4/constantbuffer.h deleted file mode 100644 index f42b6206..00000000 --- a/sources/backends/g4ong5/kinc/backend/graphics4/constantbuffer.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#ifdef KINC_KONG - -#include - -typedef struct kinc_g4_constant_buffer_impl { - kinc_g5_constant_buffer_t buffer; -} kinc_g4_constant_buffer_impl; - -#endif diff --git a/sources/backends/g4ong5/kinc/backend/graphics4/g4ong5unit.c b/sources/backends/g4ong5/kinc/backend/graphics4/g4ong5unit.c index 5a6372a0..a1a72e27 100644 --- a/sources/backends/g4ong5/kinc/backend/graphics4/g4ong5unit.c +++ b/sources/backends/g4ong5/kinc/backend/graphics4/g4ong5unit.c @@ -2,11 +2,9 @@ #include "G4.c.h" #include "compute.c.h" -#include "constantbuffer.c.h" #include "indexbuffer.c.h" #include "pipeline.c.h" #include "rendertarget.c.h" #include "shader.c.h" #include "texture.c.h" -#include "texturearray.c.h" #include "vertexbuffer.c.h" \ No newline at end of file diff --git a/sources/backends/g4ong5/kinc/backend/graphics4/pipeline.c.h b/sources/backends/g4ong5/kinc/backend/graphics4/pipeline.c.h index 5aac59c2..d73a6503 100644 --- a/sources/backends/g4ong5/kinc/backend/graphics4/pipeline.c.h +++ b/sources/backends/g4ong5/kinc/backend/graphics4/pipeline.c.h @@ -13,7 +13,6 @@ void kinc_g4_pipeline_destroy(kinc_g4_pipeline_t *pipe) { kinc_g5_pipeline_destroy(&pipe->impl._pipeline); } -#ifndef KINC_KONG kinc_g4_constant_location_t kinc_g4_pipeline_get_constant_location(kinc_g4_pipeline_t *pipe, const char *name) { kinc_g4_constant_location_t location; location.impl._location = kinc_g5_pipeline_get_constant_location(&pipe->impl._pipeline, name); @@ -29,7 +28,6 @@ kinc_g4_texture_unit_t kinc_g4_pipeline_get_texture_unit(kinc_g4_pipeline_t *pip return g4_unit; } -#endif void kinc_g4_pipeline_compile(kinc_g4_pipeline_t *pipe) { for (int i = 0; i < 16; ++i) { diff --git a/sources/backends/g4ong5/kinc/backend/graphics4/texturearray.c.h b/sources/backends/g4ong5/kinc/backend/graphics4/texturearray.c.h deleted file mode 100644 index 3841ad11..00000000 --- a/sources/backends/g4ong5/kinc/backend/graphics4/texturearray.c.h +++ /dev/null @@ -1,7 +0,0 @@ -#include - -void kinc_g4_texture_array_init(kinc_g4_texture_array_t *array, kinc_image_t *textures, int count) {} - -void kinc_g4_texture_array_destroy(kinc_g4_texture_array_t *array) {} - -// void TextureArrayImpl::set(TextureUnit unit) {} diff --git a/sources/backends/g4ong5/kinc/backend/graphics4/texturearray.h b/sources/backends/g4ong5/kinc/backend/graphics4/texturearray.h deleted file mode 100644 index 98f6bb24..00000000 --- a/sources/backends/g4ong5/kinc/backend/graphics4/texturearray.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - // void set(Kore::Graphics4::TextureUnit unit); - int nothing; -} kinc_g4_texture_array_impl_t; - -#ifdef __cplusplus -} -#endif diff --git a/sources/backends/g5ong4/kinc/backend/graphics5/commandlist.c.h b/sources/backends/g5ong4/kinc/backend/graphics5/commandlist.c.h index e7230ba7..81d70606 100644 --- a/sources/backends/g5ong4/kinc/backend/graphics5/commandlist.c.h +++ b/sources/backends/g5ong4/kinc/backend/graphics5/commandlist.c.h @@ -279,11 +279,7 @@ void kinc_g5_command_list_execute(kinc_g5_command_list_t *list) { assert(KINC_G4_SHADER_TYPE_COUNT == KINC_G5_SHADER_TYPE_COUNT); kinc_g4_texture_unit_t g4_unit; memcpy(&g4_unit.stages[0], &unit.stages[0], KINC_G4_SHADER_TYPE_COUNT * sizeof(int)); -#ifdef KINC_KONG - kinc_g4_set_texture(g4_unit.stages[0], &texture->impl.texture); -#else kinc_g4_set_texture(g4_unit, &texture->impl.texture); -#endif break; } case SetImageTexture: { @@ -383,20 +379,6 @@ void kinc_g5_command_list_set_image_texture(kinc_g5_command_list_t *list, kinc_g WRITE(kinc_g5_texture_t *, texture); } -bool kinc_g5_command_list_init_occlusion_query(kinc_g5_command_list_t *list, unsigned *occlusionQuery) { - return false; -} - -void kinc_g5_command_list_delete_occlusion_query(kinc_g5_command_list_t *list, unsigned occlusionQuery) {} - -void kinc_g5_command_list_render_occlusion_query(kinc_g5_command_list_t *list, unsigned occlusionQuery, int triangles) {} - -bool kinc_g5_command_list_are_query_results_available(kinc_g5_command_list_t *list, unsigned occlusionQuery) { - return false; -} - -void kinc_g5_command_list_get_query_result(kinc_g5_command_list_t *list, unsigned occlusionQuery, unsigned *pixelCount) {} - void kinc_g5_command_list_set_compute_shader(kinc_g5_command_list_t *list, struct kinc_g5_compute_shader *shader) {} void kinc_g5_command_list_compute(kinc_g5_command_list_t *list, int x, int y, int z) {} diff --git a/sources/backends/g5ong4/kinc/backend/graphics5/compute.c b/sources/backends/g5ong4/kinc/backend/graphics5/compute.c index 58d887fe..3d13a3b0 100644 --- a/sources/backends/g5ong4/kinc/backend/graphics5/compute.c +++ b/sources/backends/g5ong4/kinc/backend/graphics5/compute.c @@ -11,7 +11,6 @@ void kinc_g5_compute_shader_destroy(kinc_g5_compute_shader *shader) { kinc_g4_compute_shader_destroy(&shader->impl.g4); } -#ifndef KINC_KONG kinc_g5_constant_location_t kinc_g5_compute_shader_get_constant_location(kinc_g5_compute_shader *shader, const char *name) { kinc_g5_constant_location_t location = {0}; location.impl.location = kinc_g4_compute_shader_get_constant_location(&shader->impl.g4, name); @@ -27,4 +26,3 @@ kinc_g5_texture_unit_t kinc_g5_compute_shader_get_texture_unit(kinc_g5_compute_s } return g5_unit; } -#endif diff --git a/sources/backends/g5ong4/kinc/backend/graphics5/pipeline.c.h b/sources/backends/g5ong4/kinc/backend/graphics5/pipeline.c.h index 291e0623..dcc51c88 100644 --- a/sources/backends/g5ong4/kinc/backend/graphics5/pipeline.c.h +++ b/sources/backends/g5ong4/kinc/backend/graphics5/pipeline.c.h @@ -37,7 +37,6 @@ void kinc_g5_pipeline_destroy(kinc_g5_pipeline_t *pipe) { kinc_g4_pipeline_destroy(&pipe->impl.pipe); } -#ifndef KINC_KONG kinc_g5_constant_location_t kinc_g5_pipeline_get_constant_location(kinc_g5_pipeline_t *pipe, const char *name) { kinc_g5_constant_location_t location; location.impl.location = kinc_g4_pipeline_get_constant_location(&pipe->impl.pipe, name); @@ -53,7 +52,6 @@ kinc_g5_texture_unit_t kinc_g5_pipeline_get_texture_unit(kinc_g5_pipeline_t *pip return g5_unit; } -#endif void kinc_g5_pipeline_compile(kinc_g5_pipeline_t *pipe) { for (int i = 0; i < 16; ++i) { diff --git a/sources/backends/ios/kinc/backend/system.m.h b/sources/backends/ios/kinc/backend/system.m.h index 5c1a459b..c675cea6 100644 --- a/sources/backends/ios/kinc/backend/system.m.h +++ b/sources/backends/ios/kinc/backend/system.m.h @@ -82,10 +82,6 @@ void KoreUpdateKeyboard(void) { } } -#ifdef KINC_KONG -void kong_init(void); -#endif - void kinc_internal_shutdown(void) {} int kinc_init(const char *name, int width, int height, struct kinc_window_options *win, struct kinc_framebuffer_options *frame) { @@ -102,9 +98,6 @@ int kinc_init(const char *name, int width, int height, struct kinc_window_option kinc_g4_internal_init(); kinc_g4_internal_init_window(0, frame->depth_bits, frame->stencil_bits, true); -#ifdef KINC_KONG - kong_init(); -#endif return 0; } diff --git a/sources/backends/linux/kinc/backend/system.c.h b/sources/backends/linux/kinc/backend/system.c.h index 5e2d9a38..1c2e7aa7 100644 --- a/sources/backends/linux/kinc/backend/system.c.h +++ b/sources/backends/linux/kinc/backend/system.c.h @@ -152,10 +152,6 @@ void kinc_unlock_achievement(int id) {} void kinc_linux_init_procs(); -#ifdef KINC_KONG -void kong_init(void); -#endif - int kinc_init(const char *name, int width, int height, kinc_window_options_t *win, kinc_framebuffer_options_t *frame) { #ifndef __FreeBSD__ kinc_linux_initHIDGamepads(); @@ -186,9 +182,7 @@ int kinc_init(const char *name, int width, int height, kinc_window_options_t *wi } int window = kinc_window_create(win, frame); -#ifdef KINC_KONG - kong_init(); -#endif + return window; } diff --git a/sources/backends/macos/kinc/backend/system.m.h b/sources/backends/macos/kinc/backend/system.m.h index 96b5fa34..443c90a5 100644 --- a/sources/backends/macos/kinc/backend/system.m.h +++ b/sources/backends/macos/kinc/backend/system.m.h @@ -174,10 +174,6 @@ static void addMenubar(void) { [NSApp setMainMenu:menubar]; } -#ifdef KINC_KONG -void kong_init(void); -#endif - int kinc_init(const char *name, int width, int height, kinc_window_options_t *win, kinc_framebuffer_options_t *frame) { @autoreleasepool { myapp = [KincApplication sharedApplication]; @@ -213,10 +209,6 @@ int kinc_init(const char *name, int width, int height, kinc_window_options_t *wi kinc_g4_internal_init(); kinc_g4_internal_init_window(windowId, frame->depth_bits, frame->stencil_bits, true); -#ifdef KINC_KONG - kong_init(); -#endif - return 0; } diff --git a/sources/backends/metal/kinc/backend/graphics5/commandlist.m.h b/sources/backends/metal/kinc/backend/graphics5/commandlist.m.h index b9853ac1..750c42f2 100644 --- a/sources/backends/metal/kinc/backend/graphics5/commandlist.m.h +++ b/sources/backends/metal/kinc/backend/graphics5/commandlist.m.h @@ -312,20 +312,6 @@ void kinc_g5_command_list_set_image_texture(kinc_g5_command_list_t *list, kinc_g kinc_g5_command_list_set_texture(list, unit, texture); } -bool kinc_g5_command_list_init_occlusion_query(kinc_g5_command_list_t *list, unsigned *occlusionQuery) { - return false; -} - -void kinc_g5_command_list_delete_occlusion_query(kinc_g5_command_list_t *list, unsigned occlusionQuery) {} - -void kinc_g5_command_list_render_occlusion_query(kinc_g5_command_list_t *list, unsigned occlusionQuery, int triangles) {} - -bool kinc_g5_command_list_are_query_results_available(kinc_g5_command_list_t *list, unsigned occlusionQuery) { - return false; -} - -void kinc_g5_command_list_get_query_result(kinc_g5_command_list_t *list, unsigned occlusionQuery, unsigned *pixelCount) {} - void kinc_g5_command_list_set_render_target_face(kinc_g5_command_list_t *list, kinc_g5_render_target_t *texture, int face) {} 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) { @@ -367,14 +353,14 @@ void kinc_g5_command_list_set_compute_shader(kinc_g5_command_list_t *list, kinc_ end_render_pass(); compute_command_encoder = [command_buffer computeCommandEncoder]; } - + id pipeline = (__bridge id)shader->impl._pipeline; [compute_command_encoder setComputePipelineState:pipeline]; } void kinc_g5_command_list_compute(kinc_g5_command_list_t *list, int x, int y, int z) { assert(compute_command_encoder != nil); - + MTLSize perGrid; perGrid.width = x; perGrid.height = y; @@ -386,7 +372,7 @@ void kinc_g5_command_list_compute(kinc_g5_command_list_t *list, int x, int y, in [compute_command_encoder dispatchThreadgroups:perGrid threadsPerThreadgroup:perGroup]; [compute_command_encoder endEncoding]; - + compute_command_encoder = nil; start_render_pass(); diff --git a/sources/backends/metal/kinc/backend/graphics5/shader.m.h b/sources/backends/metal/kinc/backend/graphics5/shader.m.h index 0921a7de..8680319f 100644 --- a/sources/backends/metal/kinc/backend/graphics5/shader.m.h +++ b/sources/backends/metal/kinc/backend/graphics5/shader.m.h @@ -15,11 +15,6 @@ void kinc_g5_shader_destroy(kinc_g5_shader_t *shader) { } void kinc_g5_shader_init(kinc_g5_shader_t *shader, const void *source, size_t length, kinc_g5_shader_type_t type) { -#ifdef KINC_KONG - strcpy(shader->impl.name, (const char *)source); - shader->impl.mtlFunction = (__bridge_retained void *)[getMetalLibrary() newFunctionWithName:[NSString stringWithCString:shader->impl.name - encoding:NSUTF8StringEncoding]]; -#else shader->impl.name[0] = 0; { @@ -56,6 +51,6 @@ void kinc_g5_shader_init(kinc_g5_shader_t *shader, const void *source, size_t le } shader->impl.mtlFunction = (__bridge_retained void *)[library newFunctionWithName:[NSString stringWithCString:shader->impl.name encoding:NSUTF8StringEncoding]]; -#endif + assert(shader->impl.mtlFunction); } diff --git a/sources/backends/microsoft/kinc/backend/SystemMicrosoft.c.h b/sources/backends/microsoft/kinc/backend/SystemMicrosoft.c.h index 9a47a1ca..f7efb1c2 100644 --- a/sources/backends/microsoft/kinc/backend/SystemMicrosoft.c.h +++ b/sources/backends/microsoft/kinc/backend/SystemMicrosoft.c.h @@ -11,7 +11,7 @@ static void winerror(HRESULT result) { __debugbreak(); -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) if (dw != 0) { FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&buffer, 0, NULL); @@ -21,7 +21,7 @@ static void winerror(HRESULT result) { else { #endif kinc_error_message("Unknown Windows error, return value was 0x%x.", result); -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) } #endif } diff --git a/sources/backends/microsoft/kinc/backend/fiber.c.h b/sources/backends/microsoft/kinc/backend/fiber.c.h index 86c7115a..14d88153 100644 --- a/sources/backends/microsoft/kinc/backend/fiber.c.h +++ b/sources/backends/microsoft/kinc/backend/fiber.c.h @@ -1,35 +1,25 @@ #include VOID WINAPI fiber_func(LPVOID param) { -#ifndef KINC_WINDOWSAPP kinc_fiber_t *fiber = (kinc_fiber_t *)param; fiber->impl.func(fiber->impl.param); -#endif } void kinc_fiber_init_current_thread(kinc_fiber_t *fiber) { -#ifndef KINC_WINDOWSAPP fiber->impl.fiber = ConvertThreadToFiber(NULL); -#endif } void kinc_fiber_init(kinc_fiber_t *fiber, void (*func)(void *param), void *param) { -#ifndef KINC_WINDOWSAPP fiber->impl.func = func; fiber->impl.param = param; fiber->impl.fiber = CreateFiber(0, fiber_func, fiber); -#endif } void kinc_fiber_destroy(kinc_fiber_t *fiber) { -#ifndef KINC_WINDOWSAPP DeleteFiber(fiber->impl.fiber); fiber->impl.fiber = NULL; -#endif } void kinc_fiber_switch(kinc_fiber_t *fiber) { -#ifndef KINC_WINDOWSAPP SwitchToFiber(fiber->impl.fiber); -#endif } diff --git a/sources/backends/microsoft/kinc/backend/mutex.c.h b/sources/backends/microsoft/kinc/backend/mutex.c.h index 3aea9211..2913c71b 100644 --- a/sources/backends/microsoft/kinc/backend/mutex.c.h +++ b/sources/backends/microsoft/kinc/backend/mutex.c.h @@ -22,7 +22,7 @@ void kinc_mutex_unlock(kinc_mutex_t *mutex) { } bool kinc_uber_mutex_init(kinc_uber_mutex_t *mutex, const char *name) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) mutex->impl.id = (void *)CreateMutexA(NULL, FALSE, name); HRESULT res = GetLastError(); if (res && res != ERROR_ALREADY_EXISTS) { @@ -37,7 +37,7 @@ bool kinc_uber_mutex_init(kinc_uber_mutex_t *mutex, const char *name) { } void kinc_uber_mutex_destroy(kinc_uber_mutex_t *mutex) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) if (mutex->impl.id) { CloseHandle((HANDLE)mutex->impl.id); mutex->impl.id = NULL; @@ -46,14 +46,14 @@ void kinc_uber_mutex_destroy(kinc_uber_mutex_t *mutex) { } void kinc_uber_mutex_lock(kinc_uber_mutex_t *mutex) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) bool succ = WaitForSingleObject((HANDLE)mutex->impl.id, INFINITE) == WAIT_FAILED ? false : true; assert(succ); #endif } void kinc_uber_mutex_unlock(kinc_uber_mutex_t *mutex) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) bool succ = ReleaseMutex((HANDLE)mutex->impl.id) == FALSE ? false : true; assert(succ); #endif diff --git a/sources/backends/microsoft/kinc/backend/thread.c.h b/sources/backends/microsoft/kinc/backend/thread.c.h index f9988b4e..dbc84b6a 100644 --- a/sources/backends/microsoft/kinc/backend/thread.c.h +++ b/sources/backends/microsoft/kinc/backend/thread.c.h @@ -1,13 +1,5 @@ #include -#ifdef KINC_VTUNE -#include -#endif - -#ifdef KINC_SUPERLUMINAL -#include -#endif - void kinc_threads_init() {} void kinc_threads_quit() {} @@ -72,14 +64,6 @@ void kinc_thread_set_name(const char *name) { MultiByteToWideChar(CP_ACP, 0, name, -1, wide_name, 256); MySetThreadDescription(GetCurrentThread(), wide_name); } - -#ifdef KINC_VTUNE - __itt_thread_set_name(name); -#endif - -#ifdef KINC_SUPERLUMINAL - PerformanceAPI_SetCurrentThreadName(name); -#endif } void kinc_thread_sleep(int milliseconds) { diff --git a/sources/backends/opengl/kinc/backend/graphics4/OpenGL.c.h b/sources/backends/opengl/kinc/backend/graphics4/OpenGL.c.h index 4c492e93..1e342fa3 100644 --- a/sources/backends/opengl/kinc/backend/graphics4/OpenGL.c.h +++ b/sources/backends/opengl/kinc/backend/graphics4/OpenGL.c.h @@ -7,12 +7,10 @@ #include -#include #include #include #include #include -#include #include #include @@ -122,9 +120,6 @@ void kinc_internal_resize(int window, int width, int height) { void kinc_internal_change_framebuffer(int window, kinc_framebuffer_options_t *frame) { #ifdef KINC_WINDOWS if (window == 0) { -#ifdef KINC_VR - frame->vertical_sync = false; -#endif if (wglSwapIntervalEXT != NULL) wglSwapIntervalEXT(frame->vertical_sync); } @@ -214,12 +209,11 @@ void kinc_g4_internal_init() { kinc_egl_init(); #endif -#ifndef VR_RIFT for (int i = 0; i < 32; ++i) { minFilters[i] = KINC_G4_TEXTURE_FILTER_LINEAR; mipFilters[i] = KINC_G4_MIPMAP_FILTER_NONE; } -#endif + for (int i = 0; i < 256; ++i) { texModesU[i] = GL_CLAMP_TO_EDGE; texModesV[i] = GL_CLAMP_TO_EDGE; @@ -249,9 +243,6 @@ void kinc_g4_internal_init_window(int windowId, int depthBufferBits, int stencil #ifdef KINC_WINDOWS if (windowId == 0) { -#ifdef KINC_VR - vsync = false; -#endif if (wglSwapIntervalEXT != NULL) wglSwapIntervalEXT(vsync); } @@ -791,19 +782,11 @@ void kinc_g4_set_index_buffer(kinc_g4_index_buffer_t *indexBuffer) { void Kinc_G4_Internal_TextureImageSet(kinc_g4_texture_t *texture, kinc_g4_texture_unit_t unit); -#ifdef KINC_KONG -void Kinc_G4_Internal_TextureSet(kinc_g4_texture_t *texture, uint32_t unit); - -void kinc_g4_set_texture(uint32_t unit, kinc_g4_texture_t *texture) { - Kinc_G4_Internal_TextureSet(texture, unit); -} -#else void Kinc_G4_Internal_TextureSet(kinc_g4_texture_t *texture, kinc_g4_texture_unit_t unit); void kinc_g4_set_texture(kinc_g4_texture_unit_t unit, kinc_g4_texture_t *texture) { Kinc_G4_Internal_TextureSet(texture, unit); } -#endif void kinc_g4_set_image_texture(kinc_g4_texture_unit_t unit, kinc_g4_texture_t *texture) { Kinc_G4_Internal_TextureImageSet(texture, unit); @@ -874,15 +857,6 @@ static void setTextureAddressingInternal(GLenum target, kinc_g4_texture_unit_t u glCheckErrors(); } -#ifdef KINC_KONG -int Kinc_G4_Internal_TextureAddressingU(uint32_t unit) { - return texModesU[unit]; -} - -int Kinc_G4_Internal_TextureAddressingV(uint32_t unit) { - return texModesV[unit]; -} -#else int Kinc_G4_Internal_TextureAddressingU(kinc_g4_texture_unit_t unit) { return texModesU[unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]]; } @@ -890,7 +864,6 @@ int Kinc_G4_Internal_TextureAddressingU(kinc_g4_texture_unit_t unit) { int Kinc_G4_Internal_TextureAddressingV(kinc_g4_texture_unit_t unit) { return texModesV[unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]]; } -#endif void kinc_g4_set_texture_addressing(kinc_g4_texture_unit_t unit, kinc_g4_texture_direction_t dir, kinc_g4_texture_addressing_t addressing) { setTextureAddressingInternal(GL_TEXTURE_2D, unit, dir, addressing); @@ -1117,73 +1090,6 @@ void kinc_g4_restore_render_target() { #endif } -#if (defined(KINC_OPENGL) && !defined(KINC_RASPBERRY_PI) && !defined(KINC_ANDROID)) || (defined(KINC_ANDROID) && KINC_ANDROID_API >= 18) -bool kinc_g4_init_occlusion_query(unsigned *occlusionQuery) { -#if defined(KINC_OPENGL_ES) && defined(KINC_ANDROID) && KINC_ANDROID_API >= 18 - if (gles_version >= 3 && glesGenQueries) { - glesGenQueries(1, occlusionQuery); - } -#else - glGenQueries(1, occlusionQuery); -#endif - return true; -} - -void kinc_g4_delete_occlusion_query(unsigned occlusionQuery) { -#if defined(KINC_OPENGL_ES) && defined(KINC_ANDROID) && KINC_ANDROID_API >= 18 - if (gles_version >= 3 && glesGenQueries) { - glesDeleteQueries(1, &occlusionQuery); - } -#else - glDeleteQueries(1, &occlusionQuery); -#endif -} - -#if defined(KINC_OPENGL_ES) -#define SAMPLES_PASSED GL_ANY_SAMPLES_PASSED -#else -#define SAMPLES_PASSED GL_SAMPLES_PASSED -#endif - -void kinc_g4_render_occlusion_query(unsigned occlusionQuery, int triangles) { -#if defined(KINC_OPENGL_ES) && defined(KINC_ANDROID) && KINC_ANDROID_API >= 18 - if (gles_version >= 3 && glesGenQueries) { - glesBeginQuery(SAMPLES_PASSED, occlusionQuery); - glDrawArrays(GL_TRIANGLES, 0, triangles); - glCheckErrors(); - glesEndQuery(SAMPLES_PASSED); - } -#else - glBeginQuery(SAMPLES_PASSED, occlusionQuery); - glDrawArrays(GL_TRIANGLES, 0, triangles); - glCheckErrors(); - glEndQuery(SAMPLES_PASSED); -#endif -} - -bool kinc_g4_are_query_results_available(unsigned occlusionQuery) { - unsigned available = 0; -#if defined(KINC_OPENGL_ES) && defined(KINC_ANDROID) && KINC_ANDROID_API >= 18 - if (gles_version >= 3 && glesGetQueryObjectuiv) { - glesGetQueryObjectuiv(occlusionQuery, GL_QUERY_RESULT_AVAILABLE, &available); - } -#else - glGetQueryObjectuiv(occlusionQuery, GL_QUERY_RESULT_AVAILABLE, &available); -#endif - return available != 0; -} - -void kinc_g4_get_query_results(unsigned occlusionQuery, unsigned *pixelCount) { -#if defined(KINC_OPENGL_ES) && defined(KINC_ANDROID) && KINC_ANDROID_API >= 18 - if (gles_version >= 3 && glesGetQueryObjectuiv) { - glesGetQueryObjectuiv(occlusionQuery, GL_QUERY_RESULT, pixelCount); - } -#else - glGetQueryObjectuiv(occlusionQuery, GL_QUERY_RESULT, pixelCount); -#endif -} -#endif - void kinc_g4_flush() { glFlush(); glCheckErrors(); @@ -1203,12 +1109,6 @@ void kinc_g4_set_stencil_reference_value(int value) { glStencilFuncSeparate(GL_BACK, Kinc_G4_Internal_StencilFunc(lastPipeline->stencil_back_mode), value, lastPipeline->stencil_read_mask); } -void Kinc_G4_Internal_TextureArraySet(kinc_g4_texture_array_t *array, kinc_g4_texture_unit_t unit); - -void kinc_g4_set_texture_array(kinc_g4_texture_unit_t unit, kinc_g4_texture_array_t *array) { - Kinc_G4_Internal_TextureArraySet(array, unit); -} - int Kinc_G4_Internal_StencilFunc(kinc_g4_compare_mode_t mode) { switch (mode) { case KINC_G4_COMPARE_ALWAYS: @@ -1264,14 +1164,3 @@ bool kinc_g4_supports_non_pow2_textures() { bool kinc_g4_render_targets_inverted_y(void) { return true; } - -#ifdef KINC_KONG -void kinc_g4_set_constant_buffer(uint32_t id, struct kinc_g4_constant_buffer *buffer) { - glBindBufferBase(GL_UNIFORM_BUFFER, id, buffer->impl.buffer); -} - -void kinc_g4_internal_opengl_setup_uniform_block(unsigned program, const char *name, unsigned binding) { - unsigned index = glGetUniformBlockIndex(program, name); - glUniformBlockBinding(program, index, binding); -} -#endif diff --git a/sources/backends/opengl/kinc/backend/graphics4/OpenGL.h b/sources/backends/opengl/kinc/backend/graphics4/OpenGL.h index 9d88cf73..029ccae5 100644 --- a/sources/backends/opengl/kinc/backend/graphics4/OpenGL.h +++ b/sources/backends/opengl/kinc/backend/graphics4/OpenGL.h @@ -8,13 +8,8 @@ extern "C" { #endif -#ifdef KINC_KONG -int Kinc_G4_Internal_TextureAddressingU(uint32_t unit); -int Kinc_G4_Internal_TextureAddressingV(uint32_t unit); -#else int Kinc_G4_Internal_TextureAddressingU(kinc_g4_texture_unit_t unit); int Kinc_G4_Internal_TextureAddressingV(kinc_g4_texture_unit_t unit); -#endif int Kinc_G4_Internal_StencilFunc(kinc_g4_compare_mode_t mode); #ifdef __cplusplus diff --git a/sources/backends/opengl/kinc/backend/graphics4/OpenGLWindow.c.h b/sources/backends/opengl/kinc/backend/graphics4/OpenGLWindow.c.h index ffe13f67..33aae942 100644 --- a/sources/backends/opengl/kinc/backend/graphics4/OpenGLWindow.c.h +++ b/sources/backends/opengl/kinc/backend/graphics4/OpenGLWindow.c.h @@ -32,7 +32,6 @@ void Kinc_Internal_initWindowsGLContext(int window, int depthBufferBits, int ste Kinc_Internal_windows[window].depthBufferBits = depthBufferBits; -#ifndef VR_RIFT PIXELFORMATDESCRIPTOR pfd = {sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, @@ -93,14 +92,6 @@ void Kinc_Internal_initWindowsGLContext(int window, int depthBufferBits, int ste else { Kinc_Internal_windows[window].glContext = tempGlContext; } -#else - deviceContexts[window] = GetDC(windowHandle); - glContexts[window] = wglGetCurrentContext(); - if (!glewInitialized) { - glewInit(); - glewInitialized = true; - } -#endif if (window != 0) { wglShareLists(Kinc_Internal_windows[0].glContext, Kinc_Internal_windows[window].glContext); diff --git a/sources/backends/opengl/kinc/backend/graphics4/ShaderStorageBufferImpl.c.h b/sources/backends/opengl/kinc/backend/graphics4/ShaderStorageBufferImpl.c.h deleted file mode 100644 index 7c213418..00000000 --- a/sources/backends/opengl/kinc/backend/graphics4/ShaderStorageBufferImpl.c.h +++ /dev/null @@ -1,55 +0,0 @@ -#include "ogl.h" - -#include - -#if defined(KINC_WINDOWS) || (defined(KINC_LINUX) && defined(GL_VERSION_4_3)) || (defined(KINC_ANDROID) && defined(GL_ES_VERSION_3_1)) -#define HAS_COMPUTE -#endif - -kinc_shader_storage_buffer_t *currentStorageBuffer = NULL; - -static void unset(kinc_shader_storage_buffer_t *buffer) { - if (currentStorageBuffer == buffer) - currentStorageBuffer = NULL; -} - -void kinc_shader_storage_buffer_init(kinc_shader_storage_buffer_t *buffer, int indexCount, kinc_g4_vertex_data_t type) { - buffer->impl.myCount = indexCount; - buffer->impl.myStride = 0; - buffer->impl.myStride += kinc_g4_vertex_data_size(type); -#ifdef HAS_COMPUTE - glGenBuffers(1, &buffer->impl.bufferId); - glCheckErrors(); -#endif - buffer->impl.data = (int *)malloc(sizeof(int) * indexCount); -} - -void kinc_shader_storage_buffer_destroy(kinc_shader_storage_buffer_t *buffer) { - unset(buffer); - free(buffer->impl.data); -} - -int *kinc_shader_storage_buffer_lock(kinc_shader_storage_buffer_t *buffer) { - return buffer->impl.data; -} - -void kinc_shader_storage_buffer_unlock(kinc_shader_storage_buffer_t *buffer) { -#ifdef HAS_COMPUTE - glBindBuffer(GL_SHADER_STORAGE_BUFFER, buffer->impl.bufferId); - glCheckErrors(); - glBufferData(GL_SHADER_STORAGE_BUFFER, buffer->impl.myCount * buffer->impl.myStride, buffer->impl.data, GL_STATIC_DRAW); - glCheckErrors(); -#endif -} - -void kinc_shader_storage_buffer_internal_set(kinc_shader_storage_buffer_t *buffer) { - currentStorageBuffer = buffer; -#ifdef HAS_COMPUTE - glBindBuffer(GL_SHADER_STORAGE_BUFFER, buffer->impl.bufferId); - glCheckErrors(); -#endif -} - -int kinc_shader_storage_buffer_count(kinc_shader_storage_buffer_t *buffer) { - return buffer->impl.myCount; -} diff --git a/sources/backends/opengl/kinc/backend/graphics4/ShaderStorageBufferImpl.h b/sources/backends/opengl/kinc/backend/graphics4/ShaderStorageBufferImpl.h deleted file mode 100644 index d00a757b..00000000 --- a/sources/backends/opengl/kinc/backend/graphics4/ShaderStorageBufferImpl.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -typedef struct { - // ShaderStorageBufferImpl(int count, Graphics4::VertexData type); - // void unset(); - int *data; - int myCount; - int myStride; - unsigned bufferId; - // static ShaderStorageBuffer* current; -} kinc_compute_shader_storage_buffer_impl_t; diff --git a/sources/backends/opengl/kinc/backend/graphics4/VrInterface.c.h b/sources/backends/opengl/kinc/backend/graphics4/VrInterface.c.h deleted file mode 100644 index c5ba76f7..00000000 --- a/sources/backends/opengl/kinc/backend/graphics4/VrInterface.c.h +++ /dev/null @@ -1,634 +0,0 @@ -#ifdef KINC_OCULUS -#include - -#include -#include -#include - -#include "Extras/OVR_Math.h" -#include "GL/CAPI_GLE.h" -#include "OVR_CAPI_GL.h" -#include - -using namespace Kore; - -namespace { - kinc_vr_sensor_state_t sensorStates[2]; -} - -struct TextureBuffer { - ovrSession Session; - ovrTextureSwapChain TextureChain; - OVR::Sizei texSize; - - kinc_g4_render_target_t OVRRenderTarget; - bool render_target_initialized; - - TextureBuffer(ovrSession session, bool displayableOnHmd, OVR::Sizei size, int mipLevels, unsigned char *data, int sampleCount) - : Session(session), TextureChain(nullptr), texSize(size), render_target_initialized(false) { - UNREFERENCED_PARAMETER(sampleCount); - - assert(sampleCount <= 1); // The code doesn't currently handle MSAA textures. - - if (displayableOnHmd) { - // This texture isn't necessarily going to be a rendertarget, but it usually is. - - assert(session); // No HMD? A little odd. - assert(sampleCount == 1); // ovr_CreateSwapTextureSetD3D11 doesn't support MSAA. - - ovrTextureSwapChainDesc desc = {}; - desc.Type = ovrTexture_2D; - desc.ArraySize = 1; - desc.Width = size.w; - desc.Height = size.h; - desc.MipLevels = 1; - desc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB; - desc.SampleCount = 1; - desc.StaticImage = ovrFalse; - - ovrResult result = ovr_CreateTextureSwapChainGL(Session, &desc, &TextureChain); - - int length = 0; - ovr_GetTextureSwapChainLength(session, TextureChain, &length); - - if (OVR_SUCCESS(result)) { - for (int i = 0; i < length; ++i) { - GLuint chainTexId; - ovr_GetTextureSwapChainBufferGL(Session, TextureChain, i, &chainTexId); - glBindTexture(GL_TEXTURE_2D, chainTexId); - kinc_g4_render_target_init(&OVRRenderTarget, texSize.w, texSize.h, 0, false, KINC_G4_RENDER_TARGET_FORMAT_32BIT, 0, 0); - render_target_initialized = true; - } - } - } - - if (mipLevels > 1) { - glGenerateMipmap(GL_TEXTURE_2D); - } - } - - ~TextureBuffer() { - if (TextureChain) { - ovr_DestroyTextureSwapChain(Session, TextureChain); - TextureChain = nullptr; - } - if (render_target_initialized) { - kinc_g4_render_target_destroy(&OVRRenderTarget); - } - } - - OVR::Sizei GetSize() const { - return texSize; - } - - void SetAndClearRenderSurface() { - GLuint curTexId; - int curIndex; - ovr_GetTextureSwapChainCurrentIndex(Session, TextureChain, &curIndex); - ovr_GetTextureSwapChainBufferGL(Session, TextureChain, curIndex, &curTexId); - - if (render_target_initialized) { - kinc_g4_render_target_t *renderTargets[1] = {&OVRRenderTarget}; - kinc_g4_set_render_targets(renderTargets, 1); - } - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, curTexId, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, OVRRenderTarget.impl._depthTexture, 0); - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - // glEnable(GL_FRAMEBUFFER_SRGB); // TODO: too bright - } - - void UnsetRenderSurface() { - glBindFramebuffer(GL_FRAMEBUFFER, OVRRenderTarget.impl._framebuffer); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, 0, 0); - } - - void Commit() { - if (TextureChain) { - ovr_CommitTextureSwapChain(Session, TextureChain); - } - } -}; - -//------------------------------------------------------------------------------------------- -struct OGL { - HWND Window; - HDC hDC; - HGLRC WglContext; - OVR::GLEContext GLEContext; - bool Running; - bool Key[256]; - int WinSizeW; - int WinSizeH; - HINSTANCE hInstance; - - OGL() : Window(nullptr), hDC(nullptr), WglContext(nullptr), GLEContext(), Running(false), WinSizeW(0), WinSizeH(0), hInstance(nullptr) { - // Clear input - for (int i = 0; i < sizeof(Key) / sizeof(Key[0]); ++i) - Key[i] = false; - } - - ~OGL() { - ReleaseDevice(); - CloseWindow(); - } - - bool InitWindow(HINSTANCE hInst, const char *title, const char *windowClassName) { - hInstance = hInst; - Running = true; - - // Adjust the window size and show at InitDevice time - wchar_t wchTitle[256]; - MultiByteToWideChar(CP_ACP, 0, title, -1, wchTitle, 256); - wchar_t wchClassName[256]; - MultiByteToWideChar(CP_ACP, 0, windowClassName, -1, wchClassName, 256); - Window = CreateWindowW(wchClassName, wchTitle, WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, 0, 0, hInst, 0); - if (!Window) - return false; - - SetWindowLongPtr(Window, 0, LONG_PTR(this)); - - hDC = GetDC(Window); - - return true; - } - - void CloseWindow() { - if (Window) { - if (hDC) { - ReleaseDC(Window, hDC); - hDC = nullptr; - } - Window = nullptr; - } - } - - // Note: currently there is no way to get GL to use the passed pLuid - bool InitDevice(int vpW, int vpH, const LUID * /*pLuid*/, bool windowed = true) { - UNREFERENCED_PARAMETER(windowed); - - WinSizeW = vpW; - WinSizeH = vpH; - - RECT size = {0, 0, vpW, vpH}; - AdjustWindowRect(&size, WS_OVERLAPPEDWINDOW, false); - const UINT flags = SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW; - if (!SetWindowPos(Window, nullptr, 0, 0, size.right - size.left, size.bottom - size.top, flags)) - return false; - - PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARBFunc = nullptr; - PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARBFunc = nullptr; - { - // First create a context for the purpose of getting access to wglChoosePixelFormatARB / wglCreateContextAttribsARB. - PIXELFORMATDESCRIPTOR pfd; - memset(&pfd, 0, sizeof(pfd)); - pfd.nSize = sizeof(pfd); - pfd.nVersion = 1; - pfd.iPixelType = PFD_TYPE_RGBA; - pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER; - pfd.cColorBits = 32; - pfd.cDepthBits = 16; - int pf = ChoosePixelFormat(hDC, &pfd); - if (!pf) { - log(Warning, "Failed to choose pixel format."); - ReleaseDC(Window, hDC); - return false; - } - - if (!SetPixelFormat(hDC, pf, &pfd)) { - log(Warning, "Failed to set pixel format."); - ReleaseDC(Window, hDC); - return false; - } - - HGLRC context = wglCreateContext(hDC); - if (!context) { - log(Warning, "wglCreateContextfailed."); - ReleaseDC(Window, hDC); - return false; - } - if (!wglMakeCurrent(hDC, context)) { - log(Warning, "wglMakeCurrent failed."); - wglDeleteContext(context); - ReleaseDC(Window, hDC); - return false; - } - - wglChoosePixelFormatARBFunc = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB"); - wglCreateContextAttribsARBFunc = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB"); - assert(wglChoosePixelFormatARBFunc && wglCreateContextAttribsARBFunc); - - wglDeleteContext(context); - } - - // Now create the real context that we will be using. - int iAttributes[] = {// WGL_DRAW_TO_WINDOW_ARB, GL_TRUE, - WGL_SUPPORT_OPENGL_ARB, - GL_TRUE, - WGL_COLOR_BITS_ARB, - 32, - WGL_DEPTH_BITS_ARB, - 16, - WGL_DOUBLE_BUFFER_ARB, - GL_TRUE, - WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, - GL_TRUE, - 0, - 0}; - - float fAttributes[] = {0, 0}; - int pf = 0; - UINT numFormats = 0; - - if (!wglChoosePixelFormatARBFunc(hDC, iAttributes, fAttributes, 1, &pf, &numFormats)) { - log(Warning, "wglChoosePixelFormatARBFunc failed."); - ReleaseDC(Window, hDC); - return false; - } - - PIXELFORMATDESCRIPTOR pfd; - memset(&pfd, 0, sizeof(pfd)); - if (!SetPixelFormat(hDC, pf, &pfd)) { - log(Warning, "SetPixelFormat failed."); - ReleaseDC(Window, hDC); - return false; - } - - GLint attribs[16]; - int attribCount = 0; - attribs[attribCount] = 0; - - WglContext = wglCreateContextAttribsARBFunc(hDC, 0, attribs); - if (!wglMakeCurrent(hDC, WglContext)) { - log(Warning, "wglMakeCurrent failed."); - wglDeleteContext(WglContext); - ReleaseDC(Window, hDC); - return false; - } - - OVR::GLEContext::SetCurrentContext(&GLEContext); - GLEContext.Init(); - - glEnable(GL_DEPTH_TEST); - glFrontFace(GL_CW); - glEnable(GL_CULL_FACE); - - return true; - } - - void ReleaseDevice() { - if (WglContext) { - wglMakeCurrent(NULL, NULL); - wglDeleteContext(WglContext); - WglContext = nullptr; - } - GLEContext.Shutdown(); - } -}; - -namespace { - TextureBuffer *eyeRenderTexture[2] = {nullptr, nullptr}; - - ovrMirrorTexture mirrorTexture = nullptr; - uint mirrorFBO = 0; - long long frameIndex = 0; - bool isVisible = true; - - ovrSession session; - ovrHmdDesc hmdDesc; - - ovrPosef EyeRenderPose[2]; - double sensorSampleTime; - - OGL Platform; - - void done() { - if (mirrorFBO) - glDeleteFramebuffers(1, &mirrorFBO); - if (mirrorTexture) - ovr_DestroyMirrorTexture(session, mirrorTexture); - for (int eye = 0; eye < 2; ++eye) { - delete eyeRenderTexture[eye]; - } - Platform.ReleaseDevice(); - ovr_Destroy(session); - } - - void createOculusTexture() { - // Make eye render buffers - for (int eye = 0; eye < 2; ++eye) { - ovrSizei idealTextureSize = ovr_GetFovTextureSize(session, ovrEyeType(eye), hmdDesc.DefaultEyeFov[eye], 1); - eyeRenderTexture[eye] = new TextureBuffer(session, true, idealTextureSize, 1, NULL, 1); - - if (!eyeRenderTexture[eye]->TextureChain) { - log(Info, "Failed to create texture."); - done(); - } - } - - ovrMirrorTextureDesc desc; - memset(&desc, 0, sizeof(desc)); - desc.Width = Platform.WinSizeW; - desc.Height = Platform.WinSizeH; - desc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB; - - // Create mirror texture and an FBO used to copy mirror texture to back buffer - ovrResult result = ovr_CreateMirrorTextureWithOptionsGL(session, &desc, &mirrorTexture); - if (!OVR_SUCCESS(result)) { - log(Info, "Failed to create mirror texture."); - done(); - } - - // Configure the mirror read buffer - GLuint texId; - ovr_GetMirrorTextureBufferGL(session, mirrorTexture, &texId); - - glGenFramebuffers(1, &mirrorFBO); - glBindFramebuffer(GL_READ_FRAMEBUFFER, mirrorFBO); - glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texId, 0); - glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0); - glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); - } -} - -void *kinc_vr_interface_init(void *hinst, const char *title, const char *windowClassName) { - ovrInitParams initParams = {ovrInit_RequestVersion, OVR_MINOR_VERSION, NULL, 0, 0}; - ovrResult result = ovr_Initialize(&initParams); - if (!OVR_SUCCESS(result)) { - log(Warning, "Failed to initialize libOVR."); - return (0); - } - - if (!Platform.InitWindow((HINSTANCE)hinst, title, windowClassName)) { - log(Warning, "Failed to open window."); - return (0); - } - - ovrGraphicsLuid luid; - result = ovr_Create(&session, &luid); - if (!OVR_SUCCESS(result)) { - log(Info, "HMD not connected."); - return false; // TODO: retry - } - - hmdDesc = ovr_GetHmdDesc(session); - - // Setup Window and Graphics - // Note: the mirror window can be any size, for this sample we use 1/2 the HMD resolution - ovrSizei windowSize = {hmdDesc.Resolution.w / 2, hmdDesc.Resolution.h / 2}; - if (!Platform.InitDevice(windowSize.w, windowSize.h, reinterpret_cast(&luid))) { - log(Info, "Failed to init device."); - done(); - } - - // FloorLevel will give tracking poses where the floor height is 0 - ovr_SetTrackingOriginType(session, ovrTrackingOrigin_FloorLevel); - - // Return window - return Platform.Window; -} - -void kinc_vr_interface_begin() { - // Call ovr_GetRenderDesc each frame to get the ovrEyeRenderDesc, as the returned values (e.g. HmdToEyeOffset) may change at runtime. - ovrEyeRenderDesc eyeRenderDesc[2]; - eyeRenderDesc[0] = ovr_GetRenderDesc(session, ovrEye_Left, hmdDesc.DefaultEyeFov[0]); - eyeRenderDesc[1] = ovr_GetRenderDesc(session, ovrEye_Right, hmdDesc.DefaultEyeFov[1]); - - // Get both eye poses simultaneously, with IPD offset already included. - ovrPosef HmdToEyePose[2] = {eyeRenderDesc[0].HmdToEyePose, eyeRenderDesc[1].HmdToEyePose}; - - ovr_GetEyePoses(session, frameIndex, ovrTrue, HmdToEyePose, EyeRenderPose, &sensorSampleTime); -} - -void kinc_vr_interface_begin_render(int eye) { - if (eyeRenderTexture[0] == nullptr || eyeRenderTexture[1] == nullptr) - createOculusTexture(); - // Switch to eye render target - eyeRenderTexture[eye]->SetAndClearRenderSurface(); -} - -void kinc_vr_interface_end_render(int eye) { - // Avoids an error when calling SetAndClearRenderSurface during next iteration. - eyeRenderTexture[eye]->UnsetRenderSurface(); - // Commit changes to the textures so they get picked up frame - eyeRenderTexture[eye]->Commit(); -} - -namespace { - - kinc_matrix4x4_t convert(OVR::Matrix4f &m) { - kinc_matrix4x4_t mat; - kinc_matrix4x4_set(&mat, 0, 0, m.M[0][0]); - kinc_matrix4x4_set(&mat, 0, 1, m.M[0][1]); - kinc_matrix4x4_set(&mat, 0, 2, m.M[0][2]); - kinc_matrix4x4_set(&mat, 0, 3, m.M[0][3]); - kinc_matrix4x4_set(&mat, 1, 0, m.M[1][0]); - kinc_matrix4x4_set(&mat, 1, 1, m.M[1][1]); - kinc_matrix4x4_set(&mat, 1, 2, m.M[1][2]); - kinc_matrix4x4_set(&mat, 1, 3, m.M[1][3]); - kinc_matrix4x4_set(&mat, 2, 0, m.M[2][0]); - kinc_matrix4x4_set(&mat, 2, 1, m.M[2][1]); - kinc_matrix4x4_set(&mat, 2, 2, m.M[2][2]); - kinc_matrix4x4_set(&mat, 2, 3, m.M[2][3]); - kinc_matrix4x4_set(&mat, 3, 0, m.M[3][0]); - kinc_matrix4x4_set(&mat, 3, 1, m.M[3][1]); - kinc_matrix4x4_set(&mat, 3, 2, m.M[3][2]); - kinc_matrix4x4_set(&mat, 3, 3, m.M[3][3]); - return mat; - } - - // Vector vectorConvert(const OVR::Vector3f& v) { - // return { v.x, v.y, v.z }; - // } - - // OVR::Vector3f vectorConvert(const Vector& v) { - // return { v.x(), v.y(), v.z() }; - // } -} - -/*SensorState VrInterface::getSensorState(int eye, Kore::Vector& headPosition) { - VrPoseState poseState; - - ovrQuatf orientation = EyeRenderPose[eye].Orientation; - poseState.vrPose.orientation = Quaternion(orientation.x, orientation.y, orientation.z, orientation.w); - - ovrVector3f pos = EyeRenderPose[eye].Position; - poseState.vrPose.position = vec3(pos.x, pos.y, pos.z); - - ovrFovPort fov = hmdDesc.DefaultEyeFov[eye]; - poseState.vrPose.left = fov.LeftTan; - poseState.vrPose.right = fov.RightTan; - poseState.vrPose.bottom = fov.DownTan; - poseState.vrPose.top = fov.UpTan; - - // Get view and projection matrices - OVR::Matrix4f finalRollPitchYaw = OVR::Matrix4f(EyeRenderPose[eye].Orientation); - OVR::Vector3f finalUp = finalRollPitchYaw.Transform(OVR::Vector3f(0, 1, 0)); - OVR::Vector3f finalForward = finalRollPitchYaw.Transform(OVR::Vector3f(0, 0, -1)); - - Kore::Vector right = vectorConvert(finalForward).cross(vectorConvert(finalUp)).normalize() * 0.01f; - - OVR::Vector3f shiftedEyePos; - - if (eye == 0) { - shiftedEyePos = vectorConvert(headPosition - right); - } else { - shiftedEyePos = vectorConvert(headPosition + right); - } - - - OVR::Matrix4f view = OVR::Matrix4f::LookAtRH(shiftedEyePos, shiftedEyePos + finalForward, finalUp); - OVR::Matrix4f proj = ovrMatrix4f_Projection(hmdDesc.MaxEyeFov[eye], 0.2f, 1000.0f, ovrProjection_None); - - poseState.vrPose.eye = convert(view); - poseState.vrPose.projection = convert(proj); - - ovrSessionStatus sessionStatus; - ovr_GetSessionStatus(session, &sessionStatus); - if (sessionStatus.IsVisible) poseState.isVisible = true; - else poseState.isVisible = false; - if (sessionStatus.HmdPresent) poseState.hmdPresenting = true; - else poseState.hmdPresenting = false; - if (sessionStatus.HmdMounted) poseState.hmdMounted = true; - else poseState.hmdMounted = false; - if (sessionStatus.DisplayLost) poseState.displayLost = true; - else poseState.displayLost = false; - if (sessionStatus.ShouldQuit) poseState.shouldQuit = true; - else poseState.shouldQuit = false; - if (sessionStatus.ShouldRecenter) poseState.shouldRecenter = true; - else poseState.shouldRecenter = false; - - sensorStates[eye].pose = poseState; - - return sensorStates[eye]; -}*/ - -kinc_vr_sensor_state_t kinc_vr_interface_get_sensor_state(int eye) { - kinc_vr_pose_state_t poseState; - - ovrQuatf orientation = EyeRenderPose[eye].Orientation; - poseState.vrPose.orientation.x = orientation.x; - poseState.vrPose.orientation.y = orientation.y; - poseState.vrPose.orientation.z = orientation.z; - poseState.vrPose.orientation.w = orientation.w; - - ovrVector3f pos = EyeRenderPose[eye].Position; - poseState.vrPose.position.x = pos.x; - poseState.vrPose.position.y = pos.y; - poseState.vrPose.position.z = pos.z; - - ovrFovPort fov = hmdDesc.DefaultEyeFov[eye]; - poseState.vrPose.left = fov.LeftTan; - poseState.vrPose.right = fov.RightTan; - poseState.vrPose.bottom = fov.DownTan; - poseState.vrPose.top = fov.UpTan; - - // Get view and projection matrices - OVR::Matrix4f finalRollPitchYaw = OVR::Matrix4f(EyeRenderPose[eye].Orientation); - OVR::Vector3f finalUp = finalRollPitchYaw.Transform(OVR::Vector3f(0, 1, 0)); - OVR::Vector3f finalForward = finalRollPitchYaw.Transform(OVR::Vector3f(0, 0, -1)); - OVR::Vector3f shiftedEyePos = EyeRenderPose[eye].Position; - - OVR::Matrix4f view = OVR::Matrix4f::LookAtRH(shiftedEyePos, shiftedEyePos + finalForward, finalUp); - OVR::Matrix4f proj = ovrMatrix4f_Projection(hmdDesc.DefaultEyeFov[eye], 0.2f, 1000.0f, ovrProjection_None); - - poseState.vrPose.eye = convert(view); - poseState.vrPose.projection = convert(proj); - - ovrSessionStatus sessionStatus; - ovr_GetSessionStatus(session, &sessionStatus); - if (sessionStatus.IsVisible) - poseState.isVisible = true; - else - poseState.isVisible = false; - if (sessionStatus.HmdPresent) - poseState.hmdPresenting = true; - else - poseState.hmdPresenting = false; - if (sessionStatus.HmdMounted) - poseState.hmdMounted = true; - else - poseState.hmdMounted = false; - if (sessionStatus.DisplayLost) - poseState.displayLost = true; - else - poseState.displayLost = false; - if (sessionStatus.ShouldQuit) - poseState.shouldQuit = true; - else - poseState.shouldQuit = false; - if (sessionStatus.ShouldRecenter) - poseState.shouldRecenter = true; - else - poseState.shouldRecenter = false; - - sensorStates[eye].pose = poseState; - - return sensorStates[eye]; -} - -kinc_vr_pose_state_t kinc_vr_interface_get_controller(int index) { - kinc_vr_pose_state_t todo; - return todo; -} - -void kinc_vr_interface_warp_swap() { - // Initialize our single full screen Fov layer. - ovrLayerEyeFov ld; - ld.Header.Type = ovrLayerType_EyeFov; - ld.Header.Flags = ovrLayerFlag_TextureOriginAtBottomLeft; // Because OpenGL. - - if (isVisible) { - for (int eye = 0; eye < 2; ++eye) { - ld.ColorTexture[eye] = eyeRenderTexture[eye]->TextureChain; - ld.Viewport[eye] = OVR::Recti(eyeRenderTexture[eye]->GetSize()); - ld.Fov[eye] = hmdDesc.DefaultEyeFov[eye]; - ld.RenderPose[eye] = EyeRenderPose[eye]; - ld.SensorSampleTime = sensorSampleTime; - } - } - - ovrLayerHeader *layers = &ld.Header; - ovrResult result = ovr_SubmitFrame(session, frameIndex, nullptr, &layers, 1); - if (!OVR_SUCCESS(result)) { - isVisible = false; - } - else { - isVisible = true; - } - - frameIndex++; - - // Blit mirror texture to back buffer - glBindFramebuffer(GL_READ_FRAMEBUFFER, mirrorFBO); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - GLint w = Platform.WinSizeW; - GLint h = Platform.WinSizeH; - glBlitFramebuffer(0, h, w, 0, 0, 0, w, h, GL_COLOR_BUFFER_BIT, GL_NEAREST); - glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); -} - -void kinc_vr_interface_update_tracking_origin(kinc_tracking_origin_t origin) { - switch (origin) { - case KINC_TRACKING_ORIGIN_STAND: - ovr_SetTrackingOriginType(session, ovrTrackingOrigin_FloorLevel); - break; - case KINC_TRACKING_ORIGIN_SIT: - ovr_SetTrackingOriginType(session, ovrTrackingOrigin_EyeLevel); - break; - default: - ovr_SetTrackingOriginType(session, ovrTrackingOrigin_FloorLevel); - break; - } -} - -void kinc_vr_interface_reset_hmd_pose() { - ovr_RecenterTrackingOrigin(session); -} - -void kinc_vr_interface_ovr_shutdown() { - ovr_Shutdown(); -} - -#endif diff --git a/sources/backends/opengl/kinc/backend/graphics4/compute.c.h b/sources/backends/opengl/kinc/backend/graphics4/compute.c.h index 567e9bad..d7f48318 100644 --- a/sources/backends/opengl/kinc/backend/graphics4/compute.c.h +++ b/sources/backends/opengl/kinc/backend/graphics4/compute.c.h @@ -171,13 +171,6 @@ kinc_g4_texture_unit_t kinc_g4_compute_shader_get_texture_unit(kinc_g4_compute_s return unit; } -void kinc_g4_set_shader_storage_buffer(kinc_shader_storage_buffer_t *buffer, int index) { -#ifdef HAS_COMPUTE - glBindBufferBase(GL_SHADER_STORAGE_BUFFER, index, buffer->impl.bufferId); - glCheckErrors(); -#endif -} - void kinc_g4_set_compute_shader(kinc_g4_compute_shader *shader) { #ifdef HAS_COMPUTE glUseProgram(shader->impl._programid); diff --git a/sources/backends/opengl/kinc/backend/graphics4/constantbuffer.c.h b/sources/backends/opengl/kinc/backend/graphics4/constantbuffer.c.h deleted file mode 100644 index f613f41c..00000000 --- a/sources/backends/opengl/kinc/backend/graphics4/constantbuffer.c.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifdef KINC_KONG - -#include - -void kinc_g4_constant_buffer_init(kinc_g4_constant_buffer *buffer, size_t size) { - buffer->impl.size = size; - buffer->impl.last_start = 0; - buffer->impl.last_size = size; - - buffer->impl.data = malloc(size); - - buffer->impl.buffer = 0; - glGenBuffers(1, &buffer->impl.buffer); - glBindBuffer(GL_UNIFORM_BUFFER, buffer->impl.buffer); - glBufferData(GL_UNIFORM_BUFFER, size, NULL, GL_DYNAMIC_DRAW); - glBindBuffer(GL_UNIFORM_BUFFER, 0); -} - -void kinc_g4_constant_buffer_destroy(kinc_g4_constant_buffer *buffer) { - free(buffer->impl.data); - buffer->impl.data = NULL; - - glDeleteBuffers(1, &buffer->impl.buffer); - buffer->impl.buffer = 0; -} - -uint8_t *kinc_g4_constant_buffer_lock_all(kinc_g4_constant_buffer *buffer) { - return kinc_g4_constant_buffer_lock(buffer, 0, kinc_g4_constant_buffer_size(buffer)); -} - -uint8_t *kinc_g4_constant_buffer_lock(kinc_g4_constant_buffer *buffer, size_t start, size_t size) { - buffer->impl.last_start = start; - buffer->impl.last_size = size; - - uint8_t *data = (uint8_t *)buffer->impl.data; - return &data[start]; -} - -void kinc_g4_constant_buffer_unlock_all(kinc_g4_constant_buffer *buffer) { - kinc_g4_constant_buffer_unlock(buffer, buffer->impl.last_size); -} - -void kinc_g4_constant_buffer_unlock(kinc_g4_constant_buffer *buffer, size_t count) { - glBindBuffer(GL_UNIFORM_BUFFER, buffer->impl.buffer); - glBufferSubData(GL_UNIFORM_BUFFER, buffer->impl.last_start, buffer->impl.last_size, buffer->impl.data); - glBindBuffer(GL_UNIFORM_BUFFER, 0); -} - -size_t kinc_g4_constant_buffer_size(kinc_g4_constant_buffer *buffer) { - return buffer->impl.size; -} - -#endif diff --git a/sources/backends/opengl/kinc/backend/graphics4/constantbuffer.h b/sources/backends/opengl/kinc/backend/graphics4/constantbuffer.h deleted file mode 100644 index 67f25c53..00000000 --- a/sources/backends/opengl/kinc/backend/graphics4/constantbuffer.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#ifdef KINC_KONG - -#include - -typedef struct kinc_g4_constant_buffer_impl { - unsigned buffer; - void *data; - size_t size; - size_t last_start; - size_t last_size; -} kinc_g4_constant_buffer_impl; - -#endif diff --git a/sources/backends/opengl/kinc/backend/graphics4/openglunit.c b/sources/backends/opengl/kinc/backend/graphics4/openglunit.c index bd2c95e2..d46fd5f6 100644 --- a/sources/backends/opengl/kinc/backend/graphics4/openglunit.c +++ b/sources/backends/opengl/kinc/backend/graphics4/openglunit.c @@ -5,14 +5,10 @@ static int kinc_internal_opengl_max_vertex_attribute_arrays = 0; #include "OpenGL.c.h" #include "OpenGLWindow.c.h" -#include "ShaderStorageBufferImpl.c.h" -#include "VrInterface.c.h" #include "compute.c.h" -#include "constantbuffer.c.h" #include "indexbuffer.c.h" #include "pipeline.c.h" #include "rendertarget.c.h" #include "shader.c.h" #include "texture.c.h" -#include "texturearray.c.h" #include "vertexbuffer.c.h" diff --git a/sources/backends/opengl/kinc/backend/graphics4/rendertarget.c.h b/sources/backends/opengl/kinc/backend/graphics4/rendertarget.c.h index c9140aca..207701e8 100644 --- a/sources/backends/opengl/kinc/backend/graphics4/rendertarget.c.h +++ b/sources/backends/opengl/kinc/backend/graphics4/rendertarget.c.h @@ -359,21 +359,12 @@ void kinc_g4_render_target_destroy(kinc_g4_render_target_t *renderTarget) { glDeleteFramebuffers(1, framebuffers); } -#ifdef KINC_KONG -void kinc_g4_render_target_use_color_as_texture(kinc_g4_render_target_t *renderTarget, uint32_t unit) { - glActiveTexture(GL_TEXTURE0 + unit); - glCheckErrors(); - glBindTexture(renderTarget->isCubeMap ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D, renderTarget->impl._texture); - glCheckErrors(); -} -#else void kinc_g4_render_target_use_color_as_texture(kinc_g4_render_target_t *renderTarget, kinc_g4_texture_unit_t unit) { glActiveTexture(GL_TEXTURE0 + unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]); glCheckErrors(); glBindTexture(renderTarget->isCubeMap ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D, renderTarget->impl._texture); glCheckErrors(); } -#endif void kinc_g4_render_target_use_depth_as_texture(kinc_g4_render_target_t *renderTarget, kinc_g4_texture_unit_t unit) { glActiveTexture(GL_TEXTURE0 + unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]); diff --git a/sources/backends/opengl/kinc/backend/graphics4/texture.c.h b/sources/backends/opengl/kinc/backend/graphics4/texture.c.h index f28c422e..539e7d3d 100644 --- a/sources/backends/opengl/kinc/backend/graphics4/texture.c.h +++ b/sources/backends/opengl/kinc/backend/graphics4/texture.c.h @@ -503,28 +503,6 @@ void kinc_g4_texture_destroy(kinc_g4_texture_t *texture) { glFlush(); } -#ifdef KINC_KONG -void Kinc_G4_Internal_TextureSet(kinc_g4_texture_t *texture, uint32_t unit) { - GLenum target = texture->tex_depth > 1 ? GL_TEXTURE_3D : GL_TEXTURE_2D; - glActiveTexture(GL_TEXTURE0 + unit); - glCheckErrors(); -#ifdef KINC_ANDROID - if (texture->impl.external_oes) { - glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture->impl.texture); - glCheckErrors(); - } - else { - glBindTexture(target, texture->impl.texture); - glCheckErrors(); - } -#else - glBindTexture(target, texture->impl.texture); - glCheckErrors(); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, Kinc_G4_Internal_TextureAddressingU(unit)); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, Kinc_G4_Internal_TextureAddressingV(unit)); -#endif -} -#else void Kinc_G4_Internal_TextureSet(kinc_g4_texture_t *texture, kinc_g4_texture_unit_t unit) { GLenum target = texture->tex_depth > 1 ? GL_TEXTURE_3D : GL_TEXTURE_2D; for (int i = 0; i < KINC_G4_SHADER_TYPE_COUNT; ++i) { @@ -549,7 +527,6 @@ void Kinc_G4_Internal_TextureSet(kinc_g4_texture_t *texture, kinc_g4_texture_uni glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, Kinc_G4_Internal_TextureAddressingV(unit)); #endif } -#endif void Kinc_G4_Internal_TextureImageSet(kinc_g4_texture_t *texture, kinc_g4_texture_unit_t unit) { #if defined(KINC_WINDOWS) || (defined(KINC_LINUX) && defined(GL_VERSION_4_4)) diff --git a/sources/backends/opengl/kinc/backend/graphics4/texturearray.c.h b/sources/backends/opengl/kinc/backend/graphics4/texturearray.c.h deleted file mode 100644 index 9a98d82e..00000000 --- a/sources/backends/opengl/kinc/backend/graphics4/texturearray.c.h +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include - -#include - -void kinc_g4_texture_array_init(kinc_g4_texture_array_t *array, kinc_image_t *textures, int count) { -#ifdef GL_VERSION_4_2 - glGenTextures(1, &array->impl.texture); - glBindTexture(GL_TEXTURE_2D_ARRAY, array->impl.texture); - // glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, textures[0].width, textures[0].height, count, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); - glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, textures[0].width, textures[0].height, count); - for (int i = 0; i < count; ++i) { - glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, i, textures[i].width, textures[i].height, 1, GL_RGBA, GL_UNSIGNED_BYTE, textures[i].data); - } -#endif -} - -void kinc_g4_texture_array_destroy(kinc_g4_texture_array_t *array) {} - -void Kinc_G4_Internal_TextureArraySet(kinc_g4_texture_array_t *array, kinc_g4_texture_unit_t unit) { -#ifdef GL_VERSION_4_2 - glActiveTexture(GL_TEXTURE0 + unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]); - glBindTexture(GL_TEXTURE_2D_ARRAY, array->impl.texture); -#endif -} diff --git a/sources/backends/opengl/kinc/backend/graphics4/texturearray.h b/sources/backends/opengl/kinc/backend/graphics4/texturearray.h deleted file mode 100644 index dfbae9fc..00000000 --- a/sources/backends/opengl/kinc/backend/graphics4/texturearray.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - unsigned texture; -} kinc_g4_texture_array_impl_t; - -#ifdef __cplusplus -} -#endif diff --git a/sources/backends/vulkan/kinc/backend/graphics5/commandlist.c.h b/sources/backends/vulkan/kinc/backend/graphics5/commandlist.c.h index a06f9307..6ab444ba 100644 --- a/sources/backends/vulkan/kinc/backend/graphics5/commandlist.c.h +++ b/sources/backends/vulkan/kinc/backend/graphics5/commandlist.c.h @@ -892,20 +892,6 @@ void kinc_g5_command_list_set_image_texture(kinc_g5_command_list_t *list, kinc_g void kinc_g5_command_list_set_render_target_face(kinc_g5_command_list_t *list, kinc_g5_render_target_t *texture, int face) {} -bool kinc_g5_command_list_init_occlusion_query(kinc_g5_command_list_t *list, unsigned *occlusionQuery) { - return false; -} - -void kinc_g5_command_list_delete_occlusion_query(kinc_g5_command_list_t *list, unsigned occlusionQuery) {} - -void kinc_g5_command_list_render_occlusion_query(kinc_g5_command_list_t *list, unsigned occlusionQuery, int triangles) {} - -bool kinc_g5_command_list_are_query_results_available(kinc_g5_command_list_t *list, unsigned occlusionQuery) { - return false; -} - -void kinc_g5_command_list_get_query_result(kinc_g5_command_list_t *list, unsigned occlusionQuery, unsigned *pixelCount) {} - 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) { target->impl.stage = unit.stages[KINC_G5_SHADER_TYPE_FRAGMENT]; vulkanRenderTargets[unit.stages[KINC_G5_SHADER_TYPE_FRAGMENT]] = target; diff --git a/sources/backends/wasm/kinc/backend/system.c.h b/sources/backends/wasm/kinc/backend/system.c.h index f71d3f0d..615d8b49 100644 --- a/sources/backends/wasm/kinc/backend/system.c.h +++ b/sources/backends/wasm/kinc/backend/system.c.h @@ -13,10 +13,6 @@ __attribute__((import_module("imports"), import_name("js_time"))) int js_time(); extern int kinc_internal_window_width; extern int kinc_internal_window_height; -#ifdef KINC_KONG -void kong_init(void); -#endif - int kinc_init(const char *name, int width, int height, kinc_window_options_t *win, kinc_framebuffer_options_t *frame) { kinc_window_options_t defaultWin; if (win == NULL) { @@ -37,10 +33,6 @@ int kinc_init(const char *name, int width, int height, kinc_window_options_t *wi kinc_g4_internal_init(); kinc_g4_internal_init_window(0, frame->depth_bits, frame->stencil_bits, true); -#ifdef KINC_KONG - kong_init(); -#endif - return 0; } diff --git a/sources/backends/webgpu/kinc/backend/graphics5/commandlist.c b/sources/backends/webgpu/kinc/backend/graphics5/commandlist.c index 5dc02fcd..124ca492 100644 --- a/sources/backends/webgpu/kinc/backend/graphics5/commandlist.c +++ b/sources/backends/webgpu/kinc/backend/graphics5/commandlist.c @@ -139,20 +139,6 @@ void kinc_g5_command_list_set_sampler(kinc_g5_command_list_t *list, kinc_g5_text 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) {} -bool kinc_g5_command_list_init_occlusion_query(kinc_g5_command_list_t *list, unsigned *occlusionQuery) { - return false; -} - -void kinc_g5_command_list_delete_occlusion_query(kinc_g5_command_list_t *list, unsigned occlusionQuery) {} - -void kinc_g5_command_list_render_occlusion_query(kinc_g5_command_list_t *list, unsigned occlusionQuery, int triangles) {} - -bool kinc_g5_command_list_are_query_results_available(kinc_g5_command_list_t *list, unsigned occlusionQuery) { - return false; -} - -void kinc_g5_command_list_get_query_result(kinc_g5_command_list_t *list, unsigned occlusionQuery, unsigned *pixelCount) {} - 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 *renderTarget) {} 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 *renderTarget) {} diff --git a/sources/backends/webgpu/kinc/backend/graphics5/pipeline.c b/sources/backends/webgpu/kinc/backend/graphics5/pipeline.c index 28098eb3..675ebd7a 100644 --- a/sources/backends/webgpu/kinc/backend/graphics5/pipeline.c +++ b/sources/backends/webgpu/kinc/backend/graphics5/pipeline.c @@ -6,10 +6,6 @@ extern WGPUDevice device; -#ifdef KINC_KONG -extern WGPUShaderModule kinc_g5_internal_webgpu_shader_module; -#endif - void kinc_g5_pipeline_init(kinc_g5_pipeline_t *pipe) { kinc_g5_internal_pipeline_init(pipe); } @@ -187,25 +183,19 @@ void kinc_g5_pipeline_compile(kinc_g5_pipeline_t *pipe) { WGPUVertexState vsDest; memset(&vsDest, 0, sizeof(vsDest)); -#ifdef KINC_KONG - vsDest.module = kinc_g5_internal_webgpu_shader_module; - vsDest.entryPoint = pipe->vertexShader->impl.entry_name; -#else + vsDest.module = pipe->vertexShader->impl.module; vsDest.entryPoint = "main"; -#endif + vsDest.bufferCount = 1; vsDest.buffers = &vbDesc; WGPUFragmentState fragmentDest; memset(&fragmentDest, 0, sizeof(fragmentDest)); -#ifdef KINC_KONG - fragmentDest.module = kinc_g5_internal_webgpu_shader_module; - fragmentDest.entryPoint = pipe->fragmentShader->impl.entry_name; -#else + fragmentDest.module = pipe->fragmentShader->impl.module; fragmentDest.entryPoint = "main"; -#endif + fragmentDest.targetCount = 1; fragmentDest.targets = &csDesc; diff --git a/sources/backends/webgpu/kinc/backend/graphics5/shader.c b/sources/backends/webgpu/kinc/backend/graphics5/shader.c index daf79a73..4b769e51 100644 --- a/sources/backends/webgpu/kinc/backend/graphics5/shader.c +++ b/sources/backends/webgpu/kinc/backend/graphics5/shader.c @@ -4,24 +4,6 @@ extern WGPUDevice device; -#ifdef KINC_KONG -WGPUShaderModule kinc_g5_internal_webgpu_shader_module; - -void kinc_g5_internal_webgpu_create_shader_module(const void *source, size_t length) { - WGPUShaderModuleWGSLDescriptor wgsl_desc = {0}; - wgsl_desc.code = (const char *)source; - wgsl_desc.chain.sType = WGPUSType_ShaderModuleWGSLDescriptor; - - WGPUShaderModuleDescriptor desc = {0}; - desc.nextInChain = (WGPUChainedStruct *)(&wgsl_desc); - - kinc_g5_internal_webgpu_shader_module = wgpuDeviceCreateShaderModule(device, &desc); -} - -void kinc_g5_shader_init(kinc_g5_shader_t *shader, const void *source, size_t length, kinc_g5_shader_type_t type) { - strcpy(&shader->impl.entry_name[0], source); -} -#else void kinc_g5_shader_init(kinc_g5_shader_t *shader, const void *source, size_t length, kinc_g5_shader_type_t type) { WGPUShaderModuleSPIRVDescriptor smSpirvDesc; memset(&smSpirvDesc, 0, sizeof(smSpirvDesc)); @@ -33,6 +15,5 @@ void kinc_g5_shader_init(kinc_g5_shader_t *shader, const void *source, size_t le smDesc.nextInChain = &smSpirvDesc; shader->impl.module = wgpuDeviceCreateShaderModule(device, &smDesc); } -#endif void kinc_g5_shader_destroy(kinc_g5_shader_t *shader) {} diff --git a/sources/backends/webgpu/kinc/backend/graphics5/shader.h b/sources/backends/webgpu/kinc/backend/graphics5/shader.h index 125e8ebe..8a7036e5 100644 --- a/sources/backends/webgpu/kinc/backend/graphics5/shader.h +++ b/sources/backends/webgpu/kinc/backend/graphics5/shader.h @@ -9,11 +9,7 @@ extern "C" { struct WGPUShaderModuleImpl; typedef struct { -#ifdef KINC_KONG - char entry_name[256]; -#else WGPUShaderModule module; -#endif } Shader5Impl; #ifdef __cplusplus diff --git a/sources/backends/windows/kinc/backend/system.c.h b/sources/backends/windows/kinc/backend/system.c.h index ba6f832b..373dba4b 100644 --- a/sources/backends/windows/kinc/backend/system.c.h +++ b/sources/backends/windows/kinc/backend/system.c.h @@ -27,12 +27,6 @@ #include #include -#if defined(KINC_VTUNE) -#include - -__itt_domain *kinc_itt_domain; -#endif - #ifdef KINC_G4ONG5 #define Graphics Graphics5 #elif KINC_G4 @@ -1364,17 +1358,9 @@ static void init_crash_handler() { } } -#ifdef KINC_KONG -void kong_init(void); -#endif - int kinc_init(const char *name, int width, int height, kinc_window_options_t *win, kinc_framebuffer_options_t *frame) { init_crash_handler(); -#if defined(KINC_VTUNE) - kinc_itt_domain = __itt_domain_create(name); -#endif - // Pen functions are only in Windows 8 and later, so load them dynamically HMODULE user32 = LoadLibraryA("user32.dll"); MyGetPointerInfo = (GetPointerInfoType)GetProcAddress(user32, "GetPointerInfo"); @@ -1419,10 +1405,6 @@ int kinc_init(const char *name, int width, int height, kinc_window_options_t *wi loadXInput(); initializeDirectInput(); -#ifdef KINC_KONG - kong_init(); -#endif - return window; } diff --git a/sources/backends/windows/kinc/backend/window.c.h b/sources/backends/windows/kinc/backend/window.c.h index 95bd270b..eb8ee191 100644 --- a/sources/backends/windows/kinc/backend/window.c.h +++ b/sources/backends/windows/kinc/backend/window.c.h @@ -4,10 +4,6 @@ #include -#ifdef KINC_VR -#include -#endif - #undef CreateWindow struct HWND__; @@ -193,17 +189,6 @@ static int createWindow(const wchar_t *title, int x, int y, int width, int heigh int display_index = target_display_index == -1 ? kinc_primary_display() : target_display_index; -#ifdef KINC_VR - int dstx = 0; - int dsty = 0; - - char titleutf8[1024]; - char classNameutf8[1024]; - WideCharToMultiByte(CP_UTF8, 0, title, -1, titleutf8, 1024 - 1, NULL, NULL); - WideCharToMultiByte(CP_UTF8, 0, windowClassName, -1, classNameutf8, 1024 - 1, NULL, NULL); - - HWND hwnd = (HWND)kinc_vr_interface_init(inst, titleutf8, classNameutf8); -#else RECT WindowRect; WindowRect.left = 0; WindowRect.right = width; @@ -240,7 +225,6 @@ static int createWindow(const wchar_t *title, int x, int y, int width, int heigh HWND hwnd = CreateWindowExW(getDwExStyle(windowMode, features), windowClassName, title, getDwStyle(windowMode, features), dstx, dsty, dstw, dsth, NULL, NULL, inst, NULL); -#endif SetCursor(LoadCursor(NULL, IDC_ARROW)); DragAcceptFiles(hwnd, true); diff --git a/sources/kinc/audio1/audio.h b/sources/kinc/audio1/audio.h index d926002c..03547972 100644 --- a/sources/kinc/audio1/audio.h +++ b/sources/kinc/audio1/audio.h @@ -30,7 +30,7 @@ typedef struct kinc_internal_video_channel kinc_internal_video_channel_t; /// /// Initialize the Audio1-API. /// -KINC_FUNC void kinc_a1_init(void); +void kinc_a1_init(void); /// /// Plays a sound immediately. @@ -41,32 +41,32 @@ KINC_FUNC void kinc_a1_init(void); /// Makes sure that a sound is not played more than once at the same time /// A channel object that can be used to control the playing sound. Please be aware that NULL is returned when the maximum number of simultaneously /// played channels was reached. -KINC_FUNC kinc_a1_channel_t *kinc_a1_play_sound(kinc_a1_sound_t *sound, bool loop, float pitch, bool unique); +kinc_a1_channel_t *kinc_a1_play_sound(kinc_a1_sound_t *sound, bool loop, float pitch, bool unique); /// /// Stops the sound from playing. /// /// The sound to stop -KINC_FUNC void kinc_a1_stop_sound(kinc_a1_sound_t *sound); +void kinc_a1_stop_sound(kinc_a1_sound_t *sound); /// /// Starts playing a sound-stream. /// /// The stream to play -KINC_FUNC void kinc_a1_play_sound_stream(kinc_a1_sound_stream_t *stream); +void kinc_a1_play_sound_stream(kinc_a1_sound_stream_t *stream); /// /// Stops a sound-stream from playing. /// /// The stream to stop. -KINC_FUNC void kinc_a1_stop_sound_stream(kinc_a1_sound_stream_t *stream); +void kinc_a1_stop_sound_stream(kinc_a1_sound_stream_t *stream); /// /// Gets the current volume of a channel. Only works correctly if the channel is still playing. /// /// The channel to get the volume from /// The volume -KINC_FUNC float kinc_a1_channel_get_volume(kinc_a1_channel_t *channel); +float kinc_a1_channel_get_volume(kinc_a1_channel_t *channel); /// /// Sets the current volume of a channel. Only works correctly if the channel is still playing. @@ -74,9 +74,9 @@ KINC_FUNC float kinc_a1_channel_get_volume(kinc_a1_channel_t *channel); /// The channel to set the volume for /// The volume to set /// -KINC_FUNC void kinc_a1_channel_set_volume(kinc_a1_channel_t *channel, float volume); +void kinc_a1_channel_set_volume(kinc_a1_channel_t *channel, float volume); -KINC_FUNC void kinc_a1_channel_set_pitch(kinc_a1_channel_t *channel, float pitch); +void kinc_a1_channel_set_pitch(kinc_a1_channel_t *channel, float pitch); /// /// Mixes audio into the provided buffer. kinc_a1_init sets this as the callback for a2 @@ -87,7 +87,7 @@ KINC_FUNC void kinc_a1_channel_set_pitch(kinc_a1_channel_t *channel, float pitch /// /// The audio-buffer to be filled /// The number of samples to be filled in -KINC_FUNC void kinc_a1_mix(kinc_a2_buffer_t *buffer, uint32_t samples); +void kinc_a1_mix(kinc_a2_buffer_t *buffer, uint32_t samples); void kinc_internal_play_video_sound_stream(struct kinc_internal_video_sound_stream *stream); void kinc_internal_stop_video_sound_stream(struct kinc_internal_video_sound_stream *stream); diff --git a/sources/kinc/audio1/sound.h b/sources/kinc/audio1/sound.h index 84ec1cda..ebe4af9e 100644 --- a/sources/kinc/audio1/sound.h +++ b/sources/kinc/audio1/sound.h @@ -31,27 +31,27 @@ typedef struct kinc_a1_sound { /// /// Path to a wav file /// The newly created sound -KINC_FUNC kinc_a1_sound_t *kinc_a1_sound_create(const char *filename); +kinc_a1_sound_t *kinc_a1_sound_create(const char *filename); /// /// Destroy a sound. /// /// The sound to destroy. -KINC_FUNC void kinc_a1_sound_destroy(kinc_a1_sound_t *sound); +void kinc_a1_sound_destroy(kinc_a1_sound_t *sound); /// /// Gets the current volume-multiplicator that's used when playing the sound. /// /// The sound to query /// The volume-multiplicator -KINC_FUNC float kinc_a1_sound_volume(kinc_a1_sound_t *sound); +float kinc_a1_sound_volume(kinc_a1_sound_t *sound); /// /// Sets the volume-multiplicator that's used when playing the sound. /// /// The sound to modify /// The volume-multiplicator to set -KINC_FUNC void kinc_a1_sound_set_volume(kinc_a1_sound_t *sound, float value); +void kinc_a1_sound_set_volume(kinc_a1_sound_t *sound, float value); #ifdef __cplusplus } diff --git a/sources/kinc/audio1/soundstream.h b/sources/kinc/audio1/soundstream.h index 57d5a680..d9bda04a 100644 --- a/sources/kinc/audio1/soundstream.h +++ b/sources/kinc/audio1/soundstream.h @@ -33,83 +33,83 @@ typedef struct kinc_a1_sound_stream { /// A path to a wav file /// Defines whether the stream will be looped automatically /// The newly created sound-stream -KINC_FUNC kinc_a1_sound_stream_t *kinc_a1_sound_stream_create(const char *filename, bool looping); +kinc_a1_sound_stream_t *kinc_a1_sound_stream_create(const char *filename, bool looping); /// /// Gets the next audio-frame in the stream. /// /// The stream to extract the frame from /// The next sample -KINC_FUNC float *kinc_a1_sound_stream_next_frame(kinc_a1_sound_stream_t *stream); +float *kinc_a1_sound_stream_next_frame(kinc_a1_sound_stream_t *stream); /// /// Gets the number of audio-channels the stream uses. /// /// The stream to extract the number of channels from /// The number of audio-channels -KINC_FUNC int kinc_a1_sound_stream_channels(kinc_a1_sound_stream_t *stream); +int kinc_a1_sound_stream_channels(kinc_a1_sound_stream_t *stream); /// /// Gets the sample-rate used by the stream. /// /// The stream to extract the sample-rate from /// The sample-rate of the stream -KINC_FUNC int kinc_a1_sound_stream_sample_rate(kinc_a1_sound_stream_t *stream); +int kinc_a1_sound_stream_sample_rate(kinc_a1_sound_stream_t *stream); /// /// Returns whether the stream loops automatically. /// /// The stream to extract the looping-information from /// Whether the stream loops -KINC_FUNC bool kinc_a1_sound_stream_looping(kinc_a1_sound_stream_t *stream); +bool kinc_a1_sound_stream_looping(kinc_a1_sound_stream_t *stream); /// /// Changes whether the stream is looped automatically. /// /// The stream to change /// The new loop value to set -KINC_FUNC void kinc_a1_sound_stream_set_looping(kinc_a1_sound_stream_t *stream, bool loop); +void kinc_a1_sound_stream_set_looping(kinc_a1_sound_stream_t *stream, bool loop); /// /// Returns whether the stream finished playing. /// /// The stream to query /// Whether the stream finished playing -KINC_FUNC bool kinc_a1_sound_stream_ended(kinc_a1_sound_stream_t *stream); +bool kinc_a1_sound_stream_ended(kinc_a1_sound_stream_t *stream); /// /// Returns the length of the stream. /// /// The stream to query /// The length of the stream in seconds -KINC_FUNC float kinc_a1_sound_stream_length(kinc_a1_sound_stream_t *stream); +float kinc_a1_sound_stream_length(kinc_a1_sound_stream_t *stream); /// /// Returns the current playing-position of the stream. /// /// The stream to query /// The current playing-position in seconds -KINC_FUNC float kinc_a1_sound_stream_position(kinc_a1_sound_stream_t *stream); +float kinc_a1_sound_stream_position(kinc_a1_sound_stream_t *stream); /// /// Resets the stream to its start-position. /// /// The stream to change -KINC_FUNC void kinc_a1_sound_stream_reset(kinc_a1_sound_stream_t *stream); +void kinc_a1_sound_stream_reset(kinc_a1_sound_stream_t *stream); /// /// Gets the stream's volume-multiplicator. /// /// The stream to query /// The volume-multiplicator -KINC_FUNC float kinc_a1_sound_stream_volume(kinc_a1_sound_stream_t *stream); +float kinc_a1_sound_stream_volume(kinc_a1_sound_stream_t *stream); /// /// Sets the stream's volume-multiplicator. /// /// The stream to change /// The volume-multiplicator -KINC_FUNC void kinc_a1_sound_stream_set_volume(kinc_a1_sound_stream_t *stream, float value); +void kinc_a1_sound_stream_set_volume(kinc_a1_sound_stream_t *stream, float value); #ifdef __cplusplus } diff --git a/sources/kinc/audio2/audio.h b/sources/kinc/audio2/audio.h index c5492b5d..f4ba77e9 100644 --- a/sources/kinc/audio2/audio.h +++ b/sources/kinc/audio2/audio.h @@ -25,7 +25,7 @@ typedef struct kinc_a2_buffer { /// /// Initializes the Audio2-API. /// -KINC_FUNC void kinc_a2_init(void); +void kinc_a2_init(void); /// /// Sets the callback that's used to provide audio-samples. This is the primary method of operation for Audio2. The callback is expected to write the requested @@ -33,12 +33,12 @@ KINC_FUNC void kinc_a2_init(void); /// /// The callback to set /// The user data provided to the callback -KINC_FUNC void kinc_a2_set_callback(void (*kinc_a2_audio_callback)(kinc_a2_buffer_t *buffer, uint32_t samples, void *userdata), void *userdata); +void kinc_a2_set_callback(void (*kinc_a2_audio_callback)(kinc_a2_buffer_t *buffer, uint32_t samples, void *userdata), void *userdata); /// /// The current sample-rate of the system. /// -KINC_FUNC uint32_t kinc_a2_samples_per_second(void); +uint32_t kinc_a2_samples_per_second(void); /// /// Sets a callback that's called when the system's sample-rate changes. @@ -46,17 +46,17 @@ KINC_FUNC uint32_t kinc_a2_samples_per_second(void); /// The callback to set /// The user data provided to the callback /// -KINC_FUNC void kinc_a2_set_sample_rate_callback(void (*kinc_a2_sample_rate_callback)(void *userdata), void *userdata); +void kinc_a2_set_sample_rate_callback(void (*kinc_a2_sample_rate_callback)(void *userdata), void *userdata); /// /// kinc_a2_update should be called every frame. It is required by some systems to pump their audio-loops but on most systems it is a no-op. /// -KINC_FUNC void kinc_a2_update(void); +void kinc_a2_update(void); /// /// Shuts down the Audio2-API. /// -KINC_FUNC void kinc_a2_shutdown(void); +void kinc_a2_shutdown(void); void kinc_a2_internal_init(void); bool kinc_a2_internal_callback(kinc_a2_buffer_t *buffer, int samples); diff --git a/sources/kinc/color.h b/sources/kinc/color.h index 49869c3c..0c1b7e7d 100644 --- a/sources/kinc/color.h +++ b/sources/kinc/color.h @@ -15,7 +15,7 @@ extern "C" { /// /// Splits up an 32 bit ARGB color value into its components. /// -KINC_FUNC void kinc_color_components(uint32_t color, float *red, float *green, float *blue, float *alpha); +void kinc_color_components(uint32_t color, float *red, float *green, float *blue, float *alpha); #define KINC_COLOR_BLACK 0xff000000 #define KINC_COLOR_WHITE 0xffffffff diff --git a/sources/kinc/display.h b/sources/kinc/display.h index 274f4d0b..bd0aaa11 100644 --- a/sources/kinc/display.h +++ b/sources/kinc/display.h @@ -25,13 +25,13 @@ typedef struct kinc_display_mode { /// /// Allows retrieval of display values prior to the kinc_init call. /// -KINC_FUNC void kinc_display_init(void); +void kinc_display_init(void); /// /// Retrieves the index of the primary display. /// /// The index of the primary display -KINC_FUNC int kinc_primary_display(void); +int kinc_primary_display(void); /// /// Retrieves the number of displays connected to the system. @@ -40,7 +40,7 @@ KINC_FUNC int kinc_primary_display(void); /// All indices from 0 to kinc_count_displays() - 1 are legal display indices. /// /// The number of displays connected to the system -KINC_FUNC int kinc_count_displays(void); +int kinc_count_displays(void); /// /// Checks whether the display index points to an available display. @@ -50,28 +50,28 @@ KINC_FUNC int kinc_count_displays(void); /// Returns true if the index points to an available display, /// false otherwise /// -KINC_FUNC bool kinc_display_available(int display_index); +bool kinc_display_available(int display_index); /// /// Retrieves the system name of a display. /// /// Index of the display to retrieve the name from /// The system name of the display -KINC_FUNC const char *kinc_display_name(int display_index); +const char *kinc_display_name(int display_index); /// /// Retrieves the current mode of a display. /// /// Index of the display to retrieve the mode from /// The current display mode -KINC_FUNC kinc_display_mode_t kinc_display_current_mode(int display_index); +kinc_display_mode_t kinc_display_current_mode(int display_index); /// /// Retrieves the number of available modes of a display. /// /// Index of the display to retrieve the modes count from /// The number of available modes of the display -KINC_FUNC int kinc_display_count_available_modes(int display_index); +int kinc_display_count_available_modes(int display_index); /// /// Retrieves a specific mode of a display. @@ -79,7 +79,7 @@ KINC_FUNC int kinc_display_count_available_modes(int display_index); /// Index of the display to retrieve the mode from /// Index of the mode to retrieve /// The display mode -KINC_FUNC kinc_display_mode_t kinc_display_available_mode(int display_index, int mode_index); +kinc_display_mode_t kinc_display_available_mode(int display_index, int mode_index); #ifdef __cplusplus } diff --git a/sources/kinc/error.h b/sources/kinc/error.h index 78e373e8..60db4b09 100644 --- a/sources/kinc/error.h +++ b/sources/kinc/error.h @@ -30,7 +30,7 @@ extern "C" { /// Exits the program if condition is false, /// otherwise does nothing. /// -KINC_FUNC void kinc_affirm(bool condition); +void kinc_affirm(bool condition); /// /// Exits the program when a condition is untrue and shows @@ -50,7 +50,7 @@ KINC_FUNC void kinc_affirm(bool condition); /// /// The parameter is equivalent to the second printf parameter. /// -KINC_FUNC void kinc_affirm_message(bool condition, const char *format, ...); +void kinc_affirm_message(bool condition, const char *format, ...); /// /// Equivalent to kinc_affirm_message but uses a va_list parameter. @@ -68,7 +68,7 @@ KINC_FUNC void kinc_affirm_message(bool condition, const char *format, ...); /// /// The parameter is equivalent to the second vprintf parameter. /// -KINC_FUNC void kinc_affirm_args(bool condition, const char *format, va_list args); +void kinc_affirm_args(bool condition, const char *format, va_list args); /// /// Exits the program and shows a generic error message @@ -77,7 +77,7 @@ KINC_FUNC void kinc_affirm_args(bool condition, const char *format, va_list args /// Mainly this just calls exit(EXIT_FAILURE) but will also use /// Kore's log function and on Windows show an error message box. /// -KINC_FUNC void kinc_error(void); +void kinc_error(void); /// /// Exits the program and shows a provided error message. @@ -92,7 +92,7 @@ KINC_FUNC void kinc_error(void); /// /// The parameter is equivalent to the second printf parameter. /// -KINC_FUNC void kinc_error_message(const char *format, ...); +void kinc_error_message(const char *format, ...); /// /// Equivalent to kinc_error_message but uses a va_list parameter. @@ -106,7 +106,7 @@ KINC_FUNC void kinc_error_message(const char *format, ...); /// /// The parameter is equivalent to the second vprintf parameter. /// -KINC_FUNC void kinc_error_args(const char *format, va_list args); +void kinc_error_args(const char *format, va_list args); #ifdef KINC_IMPLEMENTATION_ROOT #define KINC_IMPLEMENTATION diff --git a/sources/kinc/global.h b/sources/kinc/global.h index 166f69a5..d1a0f9fc 100644 --- a/sources/kinc/global.h +++ b/sources/kinc/global.h @@ -7,17 +7,7 @@ #include #include -#if defined(KINC_PPC) -#define KINC_BIG_ENDIAN -#else -#define KINC_LITTLE_ENDIAN -#endif - -#if defined(KINC_PPC) -#define KINC_BIG_ENDIAN -#else #define KINC_LITTLE_ENDIAN -#endif #ifdef _MSC_VER #define KINC_INLINE static __forceinline @@ -27,23 +17,14 @@ #ifdef _MSC_VER #define KINC_MICROSOFT -#define KINC_MICROSOFT #endif #if defined(_WIN32) -#if defined(KINC_WINDOWSAPP) - -#define KINC_WINDOWSAPP - -#else - #ifndef KINC_CONSOLE #define KINC_WINDOWS #endif -#endif - #elif defined(__APPLE__) #include @@ -78,69 +59,4 @@ #endif -#ifdef KINC_WINDOWS -#if defined(KINC_DYNAMIC) -#define KINC_FUNC __declspec(dllimport) -#elif defined(KINC_DYNAMIC_COMPILE) -#define KINC_FUNC __declspec(dllexport) -#else -#define KINC_FUNC -#endif -#else -#define KINC_FUNC -#endif - -#ifdef __cplusplus - -namespace Kore { - typedef unsigned char u8; // 1 Byte - typedef unsigned short u16; // 2 Byte - typedef unsigned int u32; // 4 Byte - -#if defined(__LP64__) || defined(_LP64) || defined(_WIN64) -#define KINC_64 -#endif - -#ifdef KINC_WINDOWS - typedef unsigned __int64 u64; // 8 Byte -#else - typedef unsigned long long u64; -#endif - typedef char s8; // 1 Byte - typedef short s16; // 2 Byte - typedef int s32; // 4 Byte -#ifdef KINC_WINDOWS - typedef __int64 s64; // 8 Byte -#else - typedef long long s64; -#endif - - typedef u32 uint; // 4 Byte - typedef s32 sint; // 4 Byte - -#ifdef KINC_64 - typedef s64 spint; - typedef u64 upint; -#else - typedef s32 spint; - typedef u32 upint; -#endif -} - -// pseudo C++11 -#if !defined(_MSC_VER) && __cplusplus <= 199711L -#define nullptr 0 -#define override -#endif - -#define Noexcept throw() - -#endif - -#ifdef __cplusplus -extern "C" { -#endif int kickstart(int argc, char **argv); -#ifdef __cplusplus -} -#endif diff --git a/sources/kinc/graphics4/compute.h b/sources/kinc/graphics4/compute.h index fe17aaae..2e190d67 100644 --- a/sources/kinc/graphics4/compute.h +++ b/sources/kinc/graphics4/compute.h @@ -4,7 +4,6 @@ #include #ifdef KINC_OPENGL -#include #include #endif #include @@ -30,22 +29,21 @@ typedef struct kinc_g4_compute_shader { /// The shader-object to initialize /// A pointer to system-specific shader-data /// Length of the shader-data in bytes -KINC_FUNC void kinc_g4_compute_shader_init(kinc_g4_compute_shader *shader, void *source, int length); +void kinc_g4_compute_shader_init(kinc_g4_compute_shader *shader, void *source, int length); /// /// Destroy a shader-object /// /// The shader-object to destroy -KINC_FUNC void kinc_g4_compute_shader_destroy(kinc_g4_compute_shader *shader); +void kinc_g4_compute_shader_destroy(kinc_g4_compute_shader *shader); -#ifndef KINC_KONG /// /// Finds the location of a constant/uniform inside of a shader. /// /// The shader to look into /// The constant/uniform-name to look for /// The found constant-location -KINC_FUNC kinc_g4_constant_location_t kinc_g4_compute_shader_get_constant_location(kinc_g4_compute_shader *shader, const char *name); +kinc_g4_constant_location_t kinc_g4_compute_shader_get_constant_location(kinc_g4_compute_shader *shader, const char *name); /// /// Finds a texture-unit inside of a shader. @@ -53,21 +51,7 @@ KINC_FUNC kinc_g4_constant_location_t kinc_g4_compute_shader_get_constant_locati /// The shader to look into /// The texture-name to look for /// The found texture-unit -KINC_FUNC kinc_g4_texture_unit_t kinc_g4_compute_shader_get_texture_unit(kinc_g4_compute_shader *shader, const char *name); -#endif - -#ifdef KINC_OPENGL -typedef struct kinc_shader_storage_buffer { - kinc_compute_shader_storage_buffer_impl_t impl; -} kinc_shader_storage_buffer_t; - -KINC_FUNC void kinc_shader_storage_buffer_init(kinc_shader_storage_buffer_t *buffer, int count, kinc_g4_vertex_data_t type); -KINC_FUNC void kinc_shader_storage_buffer_destroy(kinc_shader_storage_buffer_t *buffer); -KINC_FUNC int *kinc_shader_storage_buffer_lock(kinc_shader_storage_buffer_t *buffer); -KINC_FUNC void kinc_shader_storage_buffer_unlock(kinc_shader_storage_buffer_t *buffer); -KINC_FUNC int kinc_shader_storage_buffer_count(kinc_shader_storage_buffer_t *buffer); -KINC_FUNC void kinc_shader_storage_buffer_internal_set(kinc_shader_storage_buffer_t *buffer); -#endif +kinc_g4_texture_unit_t kinc_g4_compute_shader_get_texture_unit(kinc_g4_compute_shader *shader, const char *name); #ifdef __cplusplus } diff --git a/sources/kinc/graphics4/constantbuffer.h b/sources/kinc/graphics4/constantbuffer.h deleted file mode 100644 index f103f9a3..00000000 --- a/sources/kinc/graphics4/constantbuffer.h +++ /dev/null @@ -1,77 +0,0 @@ -#pragma once - -#ifdef KINC_KONG - -#include - -#include - -#include -#include - -/*! \file constantbuffer.h - \brief Provides support for managing buffers of constant-data for shaders. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct kinc_g4_constant_buffer { - kinc_g4_constant_buffer_impl impl; -} kinc_g4_constant_buffer; - -/// -/// Initializes a constant-buffer. -/// -/// The buffer to initialize -/// The size of the constant-data in the buffer in bytes -KINC_FUNC void kinc_g4_constant_buffer_init(kinc_g4_constant_buffer *buffer, size_t size); - -/// -/// Destroys a buffer. -/// -/// The buffer to destroy -KINC_FUNC void kinc_g4_constant_buffer_destroy(kinc_g4_constant_buffer *buffer); - -/// -/// Locks all of a constant-buffer to modify its contents. -/// -/// The buffer to lock -/// The contents of the buffer -KINC_FUNC uint8_t *kinc_g4_constant_buffer_lock_all(kinc_g4_constant_buffer *buffer); - -/// -/// Locks part of a constant-buffer to modify its contents. -/// -/// The buffer to lock -/// The offset of where to start the lock in bytes -/// The number of bytes to lock -/// The contents of the buffer, starting at start -KINC_FUNC uint8_t *kinc_g4_constant_buffer_lock(kinc_g4_constant_buffer *buffer, size_t start, size_t count); - -/// -/// Unlocks a constant-buffer so the changed contents can be used. -/// -/// The buffer to unlock -KINC_FUNC void kinc_g4_constant_buffer_unlock_all(kinc_g4_constant_buffer *buffer); - -/// -/// Unlocks parts of a constant-buffer so the changed contents can be used. -/// -/// The buffer to unlock -/// /// The number of bytes to unlock, starting from the start-index from the previous lock-call -KINC_FUNC void kinc_g4_constant_buffer_unlock(kinc_g4_constant_buffer *buffer, size_t count); - -/// -/// Figures out the size of the constant-data in the buffer. -/// -/// The buffer to figure out the size for -/// Returns the size of the constant-data in the buffer in bytes -KINC_FUNC size_t kinc_g4_constant_buffer_size(kinc_g4_constant_buffer *buffer); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/sources/kinc/graphics4/graphics.h b/sources/kinc/graphics4/graphics.h index dfec0f36..49d8de24 100644 --- a/sources/kinc/graphics4/graphics.h +++ b/sources/kinc/graphics4/graphics.h @@ -20,13 +20,6 @@ struct kinc_g4_compute_shader; struct kinc_g4_pipeline; struct kinc_g4_render_target; struct kinc_g4_texture; -struct kinc_g4_texture_array; -#ifdef KINC_OPENGL -struct kinc_shader_storage_buffer; -#endif -#ifdef KINC_KONG -struct kinc_g4_constant_buffer; -#endif typedef enum { KINC_G4_TEXTURE_ADDRESSING_REPEAT, @@ -35,9 +28,17 @@ typedef enum { KINC_G4_TEXTURE_ADDRESSING_BORDER } kinc_g4_texture_addressing_t; -typedef enum { KINC_G4_TEXTURE_DIRECTION_U, KINC_G4_TEXTURE_DIRECTION_V, KINC_G4_TEXTURE_DIRECTION_W } kinc_g4_texture_direction_t; +typedef enum { + KINC_G4_TEXTURE_DIRECTION_U, + KINC_G4_TEXTURE_DIRECTION_V, + KINC_G4_TEXTURE_DIRECTION_W +} kinc_g4_texture_direction_t; -typedef enum { KINC_G4_TEXTURE_FILTER_POINT, KINC_G4_TEXTURE_FILTER_LINEAR, KINC_G4_TEXTURE_FILTER_ANISOTROPIC } kinc_g4_texture_filter_t; +typedef enum { + KINC_G4_TEXTURE_FILTER_POINT, + KINC_G4_TEXTURE_FILTER_LINEAR, + KINC_G4_TEXTURE_FILTER_ANISOTROPIC +} kinc_g4_texture_filter_t; typedef enum { KINC_G4_MIPMAP_FILTER_NONE, @@ -49,60 +50,60 @@ typedef enum { /// Returns whether instanced rendering (kinc_g4_draw_indexed_vertices_instanced and pals) is supported. /// /// Whether instanced rendering is supported -KINC_FUNC bool kinc_g4_supports_instanced_rendering(void); +bool kinc_g4_supports_instanced_rendering(void); /// /// Returns whether GPU-compute (the functions in kinc/compute/compute.h) is supported. /// /// Whether GPU-compute is supported -KINC_FUNC bool kinc_g4_supports_compute_shaders(void); +bool kinc_g4_supports_compute_shaders(void); /// /// Returns whether blend-constants (see kinc_g4_set_blend_constant and the blending-properties for pipelines) are supported. /// /// Whether blend-constants are supported -KINC_FUNC bool kinc_g4_supports_blend_constants(void); +bool kinc_g4_supports_blend_constants(void); /// /// Returns whether textures are supported which have widths/heights which are not powers of two. /// /// Whether non power of two texture-sizes are supported -KINC_FUNC bool kinc_g4_supports_non_pow2_textures(void); +bool kinc_g4_supports_non_pow2_textures(void); /// /// Returns whether render-targets are upside down. This happens in OpenGL and there is currently no automatic mitigation. /// /// Whether render-targets are upside down -KINC_FUNC bool kinc_g4_render_targets_inverted_y(void); +bool kinc_g4_render_targets_inverted_y(void); /// /// Returns how many textures can be used at the same time in a fragment-shader. /// /// The number of textures -KINC_FUNC int kinc_g4_max_bound_textures(void); +int kinc_g4_max_bound_textures(void); /// /// Kicks off lingering work - may or may not actually do anything depending on the underlying graphics-API. /// -KINC_FUNC void kinc_g4_flush(void); +void kinc_g4_flush(void); /// /// Needs to be called before rendering to a window. Typically called at the start of each frame. /// /// The window to render to -KINC_FUNC void kinc_g4_begin(int window); +void kinc_g4_begin(int window); /// /// Needs to be called after rendering to a window. Typically called at the end of each frame. /// /// The window to render to /// -KINC_FUNC void kinc_g4_end(int window); +void kinc_g4_end(int window); /// /// Needs to be called to make the rendered frame visible. Typically called at the very end of each frame. /// -KINC_FUNC bool kinc_g4_swap_buffers(void); +bool kinc_g4_swap_buffers(void); #define KINC_G4_CLEAR_COLOR 1 #define KINC_G4_CLEAR_DEPTH 2 @@ -115,7 +116,7 @@ KINC_FUNC bool kinc_g4_swap_buffers(void); /// The color-value to clear to in 0xAARRGGBB /// The depth-value to clear to /// The stencil-value to clear to -KINC_FUNC void kinc_g4_clear(unsigned flags, unsigned color, float depth, int stencil); +void kinc_g4_clear(unsigned flags, unsigned color, float depth, int stencil); /// /// 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 @@ -125,7 +126,7 @@ KINC_FUNC void kinc_g4_clear(unsigned flags, unsigned color, float depth, int st /// The y-offset of the viewport from the top of the screen in pixels /// The width of the viewport in pixels /// The height of the viewport in pixels -KINC_FUNC void kinc_g4_viewport(int x, int y, int width, int height); +void kinc_g4_viewport(int x, int y, int width, int height); /// /// Enables and defines the scissor-rect. When the scissor-rect is enabled, anything that's rendered outside of the scissor-rect will be ignored. @@ -134,18 +135,18 @@ KINC_FUNC void kinc_g4_viewport(int x, int y, int width, int height); /// The y-offset of the scissor-rect from the top of the screen in pixels /// The width of the scissor-rect in pixels /// The height of the scissor-rect in pixels -KINC_FUNC void kinc_g4_scissor(int x, int y, int width, int height); +void kinc_g4_scissor(int x, int y, int width, int height); /// /// Disables the scissor-rect. /// -KINC_FUNC void kinc_g4_disable_scissor(void); +void kinc_g4_disable_scissor(void); /// /// Draws the entire content of the currently set index-buffer and vertex-buffer. G4 can only draw triangle-lists using vertex-indices as this is what GPUs tend /// to be optimized for. /// -KINC_FUNC void kinc_g4_draw_indexed_vertices(void); +void kinc_g4_draw_indexed_vertices(void); /// /// 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 @@ -153,7 +154,7 @@ KINC_FUNC void kinc_g4_draw_indexed_vertices(void); /// /// The offset into the index-buffer /// The number of indices to use -KINC_FUNC void kinc_g4_draw_indexed_vertices_from_to(int start, int count); +void kinc_g4_draw_indexed_vertices_from_to(int start, int count); /// /// 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 @@ -162,39 +163,36 @@ KINC_FUNC void kinc_g4_draw_indexed_vertices_from_to(int start, int count); /// The offset into the index-buffer /// The number of indices to use /// The offset into the vertex-buffer which is added to each index read from the index-buffer -KINC_FUNC void kinc_g4_draw_indexed_vertices_from_to_from(int start, int count, int vertex_offset); +void kinc_g4_draw_indexed_vertices_from_to_from(int start, int count, int vertex_offset); -KINC_FUNC void kinc_g4_draw_indexed_vertices_instanced(int instanceCount); +void kinc_g4_draw_indexed_vertices_instanced(int instanceCount); -KINC_FUNC void kinc_g4_draw_indexed_vertices_instanced_from_to(int instanceCount, int start, int count); +void kinc_g4_draw_indexed_vertices_instanced_from_to(int instanceCount, int start, int count); -KINC_FUNC void kinc_g4_set_texture_addressing(kinc_g4_texture_unit_t unit, kinc_g4_texture_direction_t dir, kinc_g4_texture_addressing_t addressing); +void kinc_g4_set_texture_addressing(kinc_g4_texture_unit_t unit, kinc_g4_texture_direction_t dir, kinc_g4_texture_addressing_t addressing); -KINC_FUNC void kinc_g4_set_texture3d_addressing(kinc_g4_texture_unit_t unit, kinc_g4_texture_direction_t dir, kinc_g4_texture_addressing_t addressing); +void kinc_g4_set_texture3d_addressing(kinc_g4_texture_unit_t unit, kinc_g4_texture_direction_t dir, kinc_g4_texture_addressing_t addressing); /// /// Sets the pipeline for the next draw-call. The pipeline defines most rendering-state including the shaders to be used. /// /// The pipeline to set -KINC_FUNC void kinc_g4_set_pipeline(struct kinc_g4_pipeline *pipeline); +void kinc_g4_set_pipeline(struct kinc_g4_pipeline *pipeline); -KINC_FUNC void kinc_g4_set_stencil_reference_value(int value); +void kinc_g4_set_stencil_reference_value(int value); /// /// Sets the blend constant used for `KINC_G4_BLEND_CONSTANT` or `KINC_G4_INV_BLEND_CONSTANT` /// -KINC_FUNC void kinc_g4_set_blend_constant(float r, float g, float b, float a); +void kinc_g4_set_blend_constant(float r, float g, float b, float a); -#ifdef KINC_KONG -KINC_FUNC void kinc_g4_set_constant_buffer(uint32_t id, struct kinc_g4_constant_buffer *buffer); -#endif /// /// Assigns an integer to a constant/uniform in the currently set pipeline. /// /// The location of the constant/uniform to assign the value to /// The value to assign to the constant/uniform -KINC_FUNC void kinc_g4_set_int(kinc_g4_constant_location_t location, int value); +void kinc_g4_set_int(kinc_g4_constant_location_t location, int value); /// /// Assigns two integers to a constant/uniform in the currently set pipeline. @@ -202,7 +200,7 @@ KINC_FUNC void kinc_g4_set_int(kinc_g4_constant_location_t location, int value); /// The location of the constant/uniform to assign the values to /// The value to assign to the first component of the constant/uniform /// The value to assign to the second component of the constant/uniform -KINC_FUNC void kinc_g4_set_int2(kinc_g4_constant_location_t location, int value1, int value2); +void kinc_g4_set_int2(kinc_g4_constant_location_t location, int value1, int value2); /// /// Assigns three integers to a constant/uniform in the currently set pipeline. @@ -211,7 +209,7 @@ KINC_FUNC void kinc_g4_set_int2(kinc_g4_constant_location_t location, int value1 /// The value to assign to the first component of the constant/uniform /// The value to assign to the second component of the constant/uniform /// The value to assign to the third component of the constant/uniform -KINC_FUNC void kinc_g4_set_int3(kinc_g4_constant_location_t location, int value1, int value2, int value3); +void kinc_g4_set_int3(kinc_g4_constant_location_t location, int value1, int value2, int value3); /// /// Assigns four integers to a constant/uniform in the currently set pipeline. @@ -221,7 +219,7 @@ KINC_FUNC void kinc_g4_set_int3(kinc_g4_constant_location_t location, int value1 /// The value to assign to the second component of the constant/uniform /// The value to assign to the third component of the constant/uniform /// The value to assign to the fourth component of the constant/uniform -KINC_FUNC void kinc_g4_set_int4(kinc_g4_constant_location_t location, int value1, int value2, int value3, int value4); +void kinc_g4_set_int4(kinc_g4_constant_location_t location, int value1, int value2, int value3, int value4); /// /// Assigns a bunch of integers to a constant/uniform in the currently set pipeline. @@ -229,14 +227,14 @@ KINC_FUNC void kinc_g4_set_int4(kinc_g4_constant_location_t location, int value1 /// The location of the constant/uniform to assign the values to /// The values to assign to the constant/uniform /// The number of values to assign to the constant/uniform -KINC_FUNC void kinc_g4_set_ints(kinc_g4_constant_location_t location, int *values, int count); +void kinc_g4_set_ints(kinc_g4_constant_location_t location, int *values, int count); /// /// Assigns a float to a constant/uniform in the currently set pipeline. /// /// The location of the constant/uniform to assign the value to /// The value to assign to the constant/uniform -KINC_FUNC void kinc_g4_set_float(kinc_g4_constant_location_t location, float value); +void kinc_g4_set_float(kinc_g4_constant_location_t location, float value); /// /// Assigns two floats to a constant/uniform in the currently set pipeline. @@ -244,7 +242,7 @@ KINC_FUNC void kinc_g4_set_float(kinc_g4_constant_location_t location, float val /// The location of the constant/uniform to assign the values to /// The value to assign to the first constant/uniform /// The value to assign to the second constant/uniform -KINC_FUNC void kinc_g4_set_float2(kinc_g4_constant_location_t location, float value1, float value2); +void kinc_g4_set_float2(kinc_g4_constant_location_t location, float value1, float value2); /// /// Assigns three floats to a constant/uniform in the currently set pipeline. @@ -253,7 +251,7 @@ KINC_FUNC void kinc_g4_set_float2(kinc_g4_constant_location_t location, float va /// The value to assign to the first constant/uniform /// The value to assign to the second constant/uniform /// The value to assign to the third constant/uniform -KINC_FUNC void kinc_g4_set_float3(kinc_g4_constant_location_t location, float value1, float value2, float value3); +void kinc_g4_set_float3(kinc_g4_constant_location_t location, float value1, float value2, float value3); /// /// Assigns four floats to a constant/uniform in the currently set pipeline. @@ -263,7 +261,7 @@ KINC_FUNC void kinc_g4_set_float3(kinc_g4_constant_location_t location, float va /// The value to assign to the second constant/uniform /// The value to assign to the third constant/uniform /// The value to assign to the fourth constant/uniform -KINC_FUNC void kinc_g4_set_float4(kinc_g4_constant_location_t location, float value1, float value2, float value3, float value4); +void kinc_g4_set_float4(kinc_g4_constant_location_t location, float value1, float value2, float value3, float value4); /// /// Assigns a bunch of floats to a constant/uniform in the currently set pipeline. @@ -271,63 +269,63 @@ KINC_FUNC void kinc_g4_set_float4(kinc_g4_constant_location_t location, float va /// The location of the constant/uniform to assign the values to /// The values to assign to the constant/uniform /// The number of values to assign to the constant/uniform -KINC_FUNC void kinc_g4_set_floats(kinc_g4_constant_location_t location, float *values, int count); +void kinc_g4_set_floats(kinc_g4_constant_location_t location, float *values, int count); /// /// Assigns a bool to a constant/uniform in the currently set pipeline. /// /// The location of the constant/uniform to assign the value to /// The value to assign to the constant/uniform -KINC_FUNC void kinc_g4_set_bool(kinc_g4_constant_location_t location, bool value); +void kinc_g4_set_bool(kinc_g4_constant_location_t location, bool value); /// /// Assigns a 3x3-matrix to a constant/uniform in the currently set pipeline. /// /// The location of the constant/uniform to assign the value to /// The value to assign to the constant/uniform -KINC_FUNC void kinc_g4_set_matrix3(kinc_g4_constant_location_t location, kinc_matrix3x3_t *value); +void kinc_g4_set_matrix3(kinc_g4_constant_location_t location, kinc_matrix3x3_t *value); /// /// Assigns a 4x4-matrix to a constant/uniform in the currently set pipeline. /// /// The location of the constant/uniform to assign the value to /// The value to assign to the constant/uniform -KINC_FUNC void kinc_g4_set_matrix4(kinc_g4_constant_location_t location, kinc_matrix4x4_t *value); +void kinc_g4_set_matrix4(kinc_g4_constant_location_t location, kinc_matrix4x4_t *value); /// /// Set the texture-sampling-mode for upscaled textures. /// /// The texture-unit to set the texture-sampling-mode for /// The mode to set -KINC_FUNC void kinc_g4_set_texture_magnification_filter(kinc_g4_texture_unit_t unit, kinc_g4_texture_filter_t filter); +void kinc_g4_set_texture_magnification_filter(kinc_g4_texture_unit_t unit, kinc_g4_texture_filter_t filter); /// /// Set the texture-sampling-mode for upscaled 3D-textures. /// /// The texture-unit to set the texture-sampling-mode for /// The mode to set -KINC_FUNC void kinc_g4_set_texture3d_magnification_filter(kinc_g4_texture_unit_t texunit, kinc_g4_texture_filter_t filter); +void kinc_g4_set_texture3d_magnification_filter(kinc_g4_texture_unit_t texunit, kinc_g4_texture_filter_t filter); /// /// Set the texture-sampling-mode for downscaled textures. /// /// The texture-unit to set the texture-sampling-mode for /// The mode to set -KINC_FUNC void kinc_g4_set_texture_minification_filter(kinc_g4_texture_unit_t unit, kinc_g4_texture_filter_t filter); +void kinc_g4_set_texture_minification_filter(kinc_g4_texture_unit_t unit, kinc_g4_texture_filter_t filter); /// /// Set the texture-sampling-mode for downscaled 3D-textures. /// /// The texture-unit to set the texture-sampling-mode for /// The mode to set -KINC_FUNC void kinc_g4_set_texture3d_minification_filter(kinc_g4_texture_unit_t texunit, kinc_g4_texture_filter_t filter); +void kinc_g4_set_texture3d_minification_filter(kinc_g4_texture_unit_t texunit, kinc_g4_texture_filter_t filter); /// /// Sets the mipmap-sampling-mode which defines whether mipmaps are used at all and if so whether the two neighbouring mipmaps are linearly interpolated. /// /// The texture-unit to set the mipmap-sampling-mode for /// The mode to set -KINC_FUNC void kinc_g4_set_texture_mipmap_filter(kinc_g4_texture_unit_t unit, kinc_g4_mipmap_filter_t filter); +void kinc_g4_set_texture_mipmap_filter(kinc_g4_texture_unit_t unit, kinc_g4_mipmap_filter_t filter); /// /// Sets the mipmap-sampling-mode for a 3D-texture which defines whether mipmaps are used at all and if so whether the two neighbouring mipmaps are linearly @@ -335,53 +333,44 @@ KINC_FUNC void kinc_g4_set_texture_mipmap_filter(kinc_g4_texture_unit_t unit, ki /// /// The texture-unit to set the mipmap-sampling-mode for /// The mode to set -KINC_FUNC void kinc_g4_set_texture3d_mipmap_filter(kinc_g4_texture_unit_t texunit, kinc_g4_mipmap_filter_t filter); +void kinc_g4_set_texture3d_mipmap_filter(kinc_g4_texture_unit_t texunit, kinc_g4_mipmap_filter_t filter); -KINC_FUNC void kinc_g4_set_texture_compare_mode(kinc_g4_texture_unit_t unit, bool enabled); +void kinc_g4_set_texture_compare_mode(kinc_g4_texture_unit_t unit, bool enabled); -KINC_FUNC void kinc_g4_set_texture_compare_func(kinc_g4_texture_unit_t unit, kinc_g4_compare_mode_t mode); +void kinc_g4_set_texture_compare_func(kinc_g4_texture_unit_t unit, kinc_g4_compare_mode_t mode); -KINC_FUNC void kinc_g4_set_cubemap_compare_mode(kinc_g4_texture_unit_t unit, bool enabled); +void kinc_g4_set_cubemap_compare_mode(kinc_g4_texture_unit_t unit, bool enabled); -KINC_FUNC void kinc_g4_set_cubemap_compare_func(kinc_g4_texture_unit_t unit, kinc_g4_compare_mode_t mode); +void kinc_g4_set_cubemap_compare_func(kinc_g4_texture_unit_t unit, kinc_g4_compare_mode_t mode); -KINC_FUNC void kinc_g4_set_texture_max_anisotropy(kinc_g4_texture_unit_t unit, uint16_t max_anisotropy); +void kinc_g4_set_texture_max_anisotropy(kinc_g4_texture_unit_t unit, uint16_t max_anisotropy); -KINC_FUNC void kinc_g4_set_cubemap_max_anisotropy(kinc_g4_texture_unit_t unit, uint16_t max_anisotropy); +void kinc_g4_set_cubemap_max_anisotropy(kinc_g4_texture_unit_t unit, uint16_t max_anisotropy); -KINC_FUNC void kinc_g4_set_texture_lod(kinc_g4_texture_unit_t unit, float lod_min_clamp, float lod_max_clamp); +void kinc_g4_set_texture_lod(kinc_g4_texture_unit_t unit, float lod_min_clamp, float lod_max_clamp); -KINC_FUNC void kinc_g4_set_cubemap_lod(kinc_g4_texture_unit_t unit, float lod_min_clamp, float lod_max_clamp); +void kinc_g4_set_cubemap_lod(kinc_g4_texture_unit_t unit, float lod_min_clamp, float lod_max_clamp); /// /// Sets the framebuffer (aka the actual contents of the current window) to be the target of any future draw-calls. /// -KINC_FUNC void kinc_g4_restore_render_target(void); +void kinc_g4_restore_render_target(void); /// /// Sets the passed render-targets to be the target of any future draw-calls. /// /// An array of render-targets /// The number of render-targets in the render-target-array -KINC_FUNC void kinc_g4_set_render_targets(struct kinc_g4_render_target **targets, int count); +void kinc_g4_set_render_targets(struct kinc_g4_render_target **targets, int count); -KINC_FUNC void kinc_g4_set_render_target_face(struct kinc_g4_render_target *texture, int face); +void kinc_g4_set_render_target_face(struct kinc_g4_render_target *texture, int face); -#ifdef KINC_KONG /// /// Assigns a texture to a texture-unit for sampled access via GLSL's texture. /// /// The unit to assign this texture to /// The texture to assign to the unit -KINC_FUNC void kinc_g4_set_texture(uint32_t unit, struct kinc_g4_texture *texture); -#else -/// -/// Assigns a texture to a texture-unit for sampled access via GLSL's texture. -/// -/// The unit to assign this texture to -/// The texture to assign to the unit -KINC_FUNC void kinc_g4_set_texture(kinc_g4_texture_unit_t unit, struct kinc_g4_texture *texture); -#endif +void kinc_g4_set_texture(kinc_g4_texture_unit_t unit, struct kinc_g4_texture *texture); /// /// Assigns a texture to a texture-unit for direct access via GLSL's texelFetch (as @@ -390,52 +379,26 @@ KINC_FUNC void kinc_g4_set_texture(kinc_g4_texture_unit_t unit, struct kinc_g4_t /// /// The unit to assign this texture to /// The texture to assign to the unit -KINC_FUNC void kinc_g4_set_image_texture(kinc_g4_texture_unit_t unit, struct kinc_g4_texture *texture); - -KINC_FUNC bool kinc_g4_init_occlusion_query(unsigned *occlusionQuery); - -KINC_FUNC void kinc_g4_delete_occlusion_query(unsigned occlusionQuery); - -KINC_FUNC void kinc_g4_start_occlusion_query(unsigned occlusionQuery); - -KINC_FUNC void kinc_g4_end_occlusion_query(unsigned occlusionQuery); - -KINC_FUNC bool kinc_g4_are_query_results_available(unsigned occlusionQuery); - -KINC_FUNC void kinc_g4_get_query_results(unsigned occlusionQuery, unsigned *pixelCount); - -/// -/// Assigns a texture-array to a texture-unit. -/// -/// The unit to assign the texture-array to -/// The texture-array to assign to the texture-unit -KINC_FUNC void kinc_g4_set_texture_array(kinc_g4_texture_unit_t unit, struct kinc_g4_texture_array *array); +void kinc_g4_set_image_texture(kinc_g4_texture_unit_t unit, struct kinc_g4_texture *texture); /// /// Returns the currently used number of samples for hardware-antialiasing. /// /// The number of samples -KINC_FUNC int kinc_g4_antialiasing_samples(void); +int kinc_g4_antialiasing_samples(void); /// /// 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. /// /// The number of samples -KINC_FUNC void kinc_g4_set_antialiasing_samples(int samples); - -#ifdef KINC_OPENGL -/// -/// Old, hack thing, do not use. -/// -KINC_FUNC void kinc_g4_set_shader_storage_buffer(struct kinc_shader_storage_buffer *buffer, int index); -#endif +void kinc_g4_set_antialiasing_samples(int samples); /// /// Sets a shader for the next compute-run. /// /// The shader to use -KINC_FUNC void kinc_g4_set_compute_shader(struct kinc_g4_compute_shader *shader); +void kinc_g4_set_compute_shader(struct kinc_g4_compute_shader *shader); /// /// Fire off a compute-run on x * y * z elements. @@ -443,14 +406,12 @@ KINC_FUNC void kinc_g4_set_compute_shader(struct kinc_g4_compute_shader *shader) /// The x-size for the compute-run /// The y-size for the compute-run /// The z-size for the compute-run -KINC_FUNC void kinc_g4_compute(int x, int y, int z); +void kinc_g4_compute(int x, int y, int z); -#ifndef KINC_DOCS void kinc_g4_internal_init(void); void kinc_g4_internal_init_window(int window, int depth_buffer_bits, int stencil_buffer_bits, bool vsync); void kinc_g4_internal_destroy_window(int window); void kinc_g4_internal_destroy(void); -#endif #ifdef __cplusplus } diff --git a/sources/kinc/graphics4/indexbuffer.h b/sources/kinc/graphics4/indexbuffer.h index 5f820505..1d86936f 100644 --- a/sources/kinc/graphics4/indexbuffer.h +++ b/sources/kinc/graphics4/indexbuffer.h @@ -27,20 +27,20 @@ typedef struct kinc_g4_index_buffer { /// The number of indices to allocate for the buffer /// The integer-format of the buffer /// A hint for how the buffer will be used -KINC_FUNC void kinc_g4_index_buffer_init(kinc_g4_index_buffer_t *buffer, int count, kinc_g4_index_buffer_format_t format, kinc_g4_usage_t usage); +void kinc_g4_index_buffer_init(kinc_g4_index_buffer_t *buffer, int count, kinc_g4_index_buffer_format_t format, kinc_g4_usage_t usage); /// /// Destroys an index-buffer. /// /// The buffer to destroy -KINC_FUNC void kinc_g4_index_buffer_destroy(kinc_g4_index_buffer_t *buffer); +void kinc_g4_index_buffer_destroy(kinc_g4_index_buffer_t *buffer); /// /// Locks an index-buffer so its contents can be modified. /// /// The buffer to lock /// The contents of the index-buffer in uint32s or uint16s depending on the format provided when initializing -KINC_FUNC void *kinc_g4_index_buffer_lock_all(kinc_g4_index_buffer_t *buffer); +void *kinc_g4_index_buffer_lock_all(kinc_g4_index_buffer_t *buffer); /// /// Locks part of a vertex-buffer to modify its contents. @@ -49,27 +49,27 @@ KINC_FUNC void *kinc_g4_index_buffer_lock_all(kinc_g4_index_buffer_t *buffer); /// The index of the first index to lock /// The number of indices to lock /// The contents of the index-buffer, starting at start, in uint32s or uint16s depending on the format provided when initializing -KINC_FUNC void *kinc_g4_index_buffer_lock(kinc_g4_index_buffer_t *buffer, int start, int count); +void *kinc_g4_index_buffer_lock(kinc_g4_index_buffer_t *buffer, int start, int count); /// /// Unlocks an index-buffer after locking it so the changed buffer-contents can be used. /// /// The buffer to unlock -KINC_FUNC void kinc_g4_index_buffer_unlock_all(kinc_g4_index_buffer_t *buffer); +void kinc_g4_index_buffer_unlock_all(kinc_g4_index_buffer_t *buffer); /// /// Unlocks part of an index-buffer after locking so the changed buffer-contents can be used. /// /// The buffer to unlock /// The number of indices to unlock, starting from the start-index from the previous lock-call -KINC_FUNC void kinc_g4_index_buffer_unlock(kinc_g4_index_buffer_t *buffer, int count); +void kinc_g4_index_buffer_unlock(kinc_g4_index_buffer_t *buffer, int count); /// /// Returns the number of indices in the buffer. /// /// The buffer to query for its number of indices /// The number of indices -KINC_FUNC int kinc_g4_index_buffer_count(kinc_g4_index_buffer_t *buffer); +int kinc_g4_index_buffer_count(kinc_g4_index_buffer_t *buffer); void kinc_internal_g4_index_buffer_set(kinc_g4_index_buffer_t *buffer); @@ -77,7 +77,7 @@ void kinc_internal_g4_index_buffer_set(kinc_g4_index_buffer_t *buffer); /// Sets an index-buffer to be used for the next draw-command. /// /// The buffer to use -KINC_FUNC void kinc_g4_set_index_buffer(kinc_g4_index_buffer_t *buffer); +void kinc_g4_set_index_buffer(kinc_g4_index_buffer_t *buffer); #ifdef __cplusplus } diff --git a/sources/kinc/graphics4/pipeline.h b/sources/kinc/graphics4/pipeline.h index b74da371..1878cd5e 100644 --- a/sources/kinc/graphics4/pipeline.h +++ b/sources/kinc/graphics4/pipeline.h @@ -121,28 +121,27 @@ typedef struct kinc_g4_pipeline { /// Initializes a pipeline. /// /// The pipeline to initialize -KINC_FUNC void kinc_g4_pipeline_init(kinc_g4_pipeline_t *pipeline); +void kinc_g4_pipeline_init(kinc_g4_pipeline_t *pipeline); /// /// Destroys a pipeline. /// /// The pipeline to destroy -KINC_FUNC void kinc_g4_pipeline_destroy(kinc_g4_pipeline_t *pipeline); +void kinc_g4_pipeline_destroy(kinc_g4_pipeline_t *pipeline); /// /// 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. /// /// The pipeline to compile -KINC_FUNC void kinc_g4_pipeline_compile(kinc_g4_pipeline_t *pipeline); +void kinc_g4_pipeline_compile(kinc_g4_pipeline_t *pipeline); -#ifndef KINC_KONG /// /// Searches for a constant/uniform and returns a constant-location which can be used to change the constant/uniform. /// /// The pipeline to search in /// The name of the constant/uniform to find /// The constant-location of the constant/uniform -KINC_FUNC kinc_g4_constant_location_t kinc_g4_pipeline_get_constant_location(kinc_g4_pipeline_t *pipeline, const char *name); +kinc_g4_constant_location_t kinc_g4_pipeline_get_constant_location(kinc_g4_pipeline_t *pipeline, const char *name); /// /// Searches for a texture-declaration and returns a texture-unit which can be used to assign a texture. @@ -150,8 +149,7 @@ KINC_FUNC kinc_g4_constant_location_t kinc_g4_pipeline_get_constant_location(kin /// The pipeline to search in /// The name of the texture-declaration to search for /// The texture-unit of the texture-declaration -KINC_FUNC kinc_g4_texture_unit_t kinc_g4_pipeline_get_texture_unit(kinc_g4_pipeline_t *pipeline, const char *name); -#endif +kinc_g4_texture_unit_t kinc_g4_pipeline_get_texture_unit(kinc_g4_pipeline_t *pipeline, const char *name); void kinc_g4_internal_set_pipeline(kinc_g4_pipeline_t *pipeline); void kinc_g4_internal_pipeline_set_defaults(kinc_g4_pipeline_t *pipeline); diff --git a/sources/kinc/graphics4/rendertarget.h b/sources/kinc/graphics4/rendertarget.h index d48fb758..8eab6218 100644 --- a/sources/kinc/graphics4/rendertarget.h +++ b/sources/kinc/graphics4/rendertarget.h @@ -46,7 +46,7 @@ typedef struct kinc_g4_render_target { /// /// /// -KINC_FUNC void kinc_g4_render_target_init(kinc_g4_render_target_t *renderTarget, int width, int height, kinc_g4_render_target_format_t format, +void kinc_g4_render_target_init(kinc_g4_render_target_t *renderTarget, int width, int height, kinc_g4_render_target_format_t format, int depthBufferBits, int stencilBufferBits); /// @@ -60,7 +60,7 @@ KINC_FUNC void kinc_g4_render_target_init(kinc_g4_render_target_t *renderTarget, /// /// /// -KINC_FUNC void kinc_g4_render_target_init_with_multisampling(kinc_g4_render_target_t *renderTarget, int width, int height, +void kinc_g4_render_target_init_with_multisampling(kinc_g4_render_target_t *renderTarget, int width, int height, kinc_g4_render_target_format_t format, int depthBufferBits, int stencilBufferBits, int samples_per_pixel); @@ -72,7 +72,7 @@ KINC_FUNC void kinc_g4_render_target_init_with_multisampling(kinc_g4_render_targ /// /// /// -KINC_FUNC void kinc_g4_render_target_init_cube(kinc_g4_render_target_t *renderTarget, int cubeMapSize, kinc_g4_render_target_format_t format, +void kinc_g4_render_target_init_cube(kinc_g4_render_target_t *renderTarget, int cubeMapSize, kinc_g4_render_target_format_t format, int depthBufferBits, int stencilBufferBits); /// @@ -85,37 +85,28 @@ KINC_FUNC void kinc_g4_render_target_init_cube(kinc_g4_render_target_t *renderTa /// /// /// -KINC_FUNC void kinc_g4_render_target_init_cube_with_multisampling(kinc_g4_render_target_t *renderTarget, int cubeMapSize, kinc_g4_render_target_format_t format, +void kinc_g4_render_target_init_cube_with_multisampling(kinc_g4_render_target_t *renderTarget, int cubeMapSize, kinc_g4_render_target_format_t format, int depthBufferBits, int stencilBufferBits, int samples_per_pixel); /// /// Deallocates and destroys a render-target. /// /// The render-target to destroy -KINC_FUNC void kinc_g4_render_target_destroy(kinc_g4_render_target_t *renderTarget); +void kinc_g4_render_target_destroy(kinc_g4_render_target_t *renderTarget); -#ifdef KINC_KONG /// /// Uses the color-component of a render-target as a texture. /// /// The render-target to use /// The texture-unit to assign the render-target to -KINC_FUNC void kinc_g4_render_target_use_color_as_texture(kinc_g4_render_target_t *renderTarget, uint32_t unit); -#else -/// -/// Uses the color-component of a render-target as a texture. -/// -/// The render-target to use -/// The texture-unit to assign the render-target to -KINC_FUNC void kinc_g4_render_target_use_color_as_texture(kinc_g4_render_target_t *renderTarget, kinc_g4_texture_unit_t unit); -#endif +void kinc_g4_render_target_use_color_as_texture(kinc_g4_render_target_t *renderTarget, kinc_g4_texture_unit_t unit); /// /// Uses the depth-component of a render-target as a texture. /// /// The render-target to use /// The texture-unit to assign the render-target to -KINC_FUNC void kinc_g4_render_target_use_depth_as_texture(kinc_g4_render_target_t *renderTarget, kinc_g4_texture_unit_t unit); +void kinc_g4_render_target_use_depth_as_texture(kinc_g4_render_target_t *renderTarget, kinc_g4_texture_unit_t unit); /// /// Copies the depth and stencil-components of one render-target into another one. @@ -123,21 +114,21 @@ KINC_FUNC void kinc_g4_render_target_use_depth_as_texture(kinc_g4_render_target_ /// The render-target to copy the data into /// The render-target from which to copy the data /// -KINC_FUNC void kinc_g4_render_target_set_depth_stencil_from(kinc_g4_render_target_t *renderTarget, kinc_g4_render_target_t *source); +void kinc_g4_render_target_set_depth_stencil_from(kinc_g4_render_target_t *renderTarget, kinc_g4_render_target_t *source); /// /// Copies out the color-data from a render-target. Beware, this is very slow. /// /// The render-target to copy the color-data from /// A pointer to where the data will be copied to -KINC_FUNC void kinc_g4_render_target_get_pixels(kinc_g4_render_target_t *renderTarget, uint8_t *data); +void kinc_g4_render_target_get_pixels(kinc_g4_render_target_t *renderTarget, uint8_t *data); /// /// Generates the mipmap-chain for a render-target. /// /// The render-target to create the mipmaps for /// The number of mipmap-levels to generate -KINC_FUNC void kinc_g4_render_target_generate_mipmaps(kinc_g4_render_target_t *renderTarget, int levels); +void kinc_g4_render_target_generate_mipmaps(kinc_g4_render_target_t *renderTarget, int levels); #ifdef __cplusplus } diff --git a/sources/kinc/graphics4/shader.h b/sources/kinc/graphics4/shader.h index 0b8a48c5..d6857ce0 100644 --- a/sources/kinc/graphics4/shader.h +++ b/sources/kinc/graphics4/shader.h @@ -35,7 +35,7 @@ typedef struct kinc_g4_shader { /// The system-specific shader-data /// The length of the system-specific shader-data in bytes /// The type of the shader -KINC_FUNC void kinc_g4_shader_init(kinc_g4_shader_t *shader, const void *data, size_t length, kinc_g4_shader_type_t type); +void kinc_g4_shader_init(kinc_g4_shader_t *shader, const void *data, size_t length, kinc_g4_shader_type_t type); /// /// Initializes a shader from GLSL-source-code. This only works on some platforms and only if KRAFIX_LIBRARY define has been set and the krafix-shader-compiler @@ -45,13 +45,13 @@ KINC_FUNC void kinc_g4_shader_init(kinc_g4_shader_t *shader, const void *data, s /// The GLSL-shader-source-code /// The type of the shader /// The number of errors the compiler encountered - hopefully it's zero. -KINC_FUNC int kinc_g4_shader_init_from_source(kinc_g4_shader_t *shader, const char *source, kinc_g4_shader_type_t type); +int kinc_g4_shader_init_from_source(kinc_g4_shader_t *shader, const char *source, kinc_g4_shader_type_t type); /// /// Destroys a shader. /// /// The shader to destroy -KINC_FUNC void kinc_g4_shader_destroy(kinc_g4_shader_t *shader); +void kinc_g4_shader_destroy(kinc_g4_shader_t *shader); #ifdef __cplusplus } diff --git a/sources/kinc/graphics4/texture.h b/sources/kinc/graphics4/texture.h index 03ba28aa..48a62543 100644 --- a/sources/kinc/graphics4/texture.h +++ b/sources/kinc/graphics4/texture.h @@ -31,7 +31,7 @@ typedef struct kinc_g4_texture { /// The width of the texture to create /// The height of the texture to create /// The format of the texture to create -KINC_FUNC void kinc_g4_texture_init(kinc_g4_texture_t *texture, int width, int height, kinc_image_format_t format); +void kinc_g4_texture_init(kinc_g4_texture_t *texture, int width, int height, kinc_image_format_t format); /// /// Allocates and initializes a 3d-texture without copying any data into it. @@ -41,43 +41,43 @@ KINC_FUNC void kinc_g4_texture_init(kinc_g4_texture_t *texture, int width, int h /// The height of the texture to create /// The depth of the texture to create /// The format of the texture to create -KINC_FUNC void kinc_g4_texture_init3d(kinc_g4_texture_t *texture, int width, int height, int depth, kinc_image_format_t format); +void kinc_g4_texture_init3d(kinc_g4_texture_t *texture, int width, int height, int depth, kinc_image_format_t format); /// /// Allocates and initializes a texture and copies image-data into it. /// /// The texture to initialize /// The image which's data is copied into the texture -KINC_FUNC void kinc_g4_texture_init_from_image(kinc_g4_texture_t *texture, kinc_image_t *image); +void kinc_g4_texture_init_from_image(kinc_g4_texture_t *texture, kinc_image_t *image); /// /// Allocates and initializes a texture and copies image-data into it. /// /// The texture to initialize /// The image which's data is copied into the texture -KINC_FUNC void kinc_g4_texture_init_from_image3d(kinc_g4_texture_t *texture, kinc_image_t *image); +void kinc_g4_texture_init_from_image3d(kinc_g4_texture_t *texture, kinc_image_t *image); /// /// Deallocates and destroys a texture. /// /// The texture to destroy -KINC_FUNC void kinc_g4_texture_destroy(kinc_g4_texture_t *texture); +void kinc_g4_texture_destroy(kinc_g4_texture_t *texture); -KINC_FUNC unsigned char *kinc_g4_texture_lock(kinc_g4_texture_t *texture); +unsigned char *kinc_g4_texture_lock(kinc_g4_texture_t *texture); -KINC_FUNC void kinc_g4_texture_unlock(kinc_g4_texture_t *texture); +void kinc_g4_texture_unlock(kinc_g4_texture_t *texture); /// /// Clears parts of a texture to a color. /// -KINC_FUNC void kinc_g4_texture_clear(kinc_g4_texture_t *texture, int x, int y, int z, int width, int height, int depth, unsigned color); +void kinc_g4_texture_clear(kinc_g4_texture_t *texture, int x, int y, int z, int width, int height, int depth, unsigned color); /// /// Generates the mipmap-chain for a texture. /// /// The render-target to create the mipmaps for /// The number of mipmap-levels to generate -KINC_FUNC void kinc_g4_texture_generate_mipmaps(kinc_g4_texture_t *texture, int levels); +void kinc_g4_texture_generate_mipmaps(kinc_g4_texture_t *texture, int levels); /// /// Sets the mipmap for one level of a texture. @@ -85,21 +85,21 @@ KINC_FUNC void kinc_g4_texture_generate_mipmaps(kinc_g4_texture_t *texture, int /// The texture to set a mipmap-level for /// The image-data for the mipmap-level to set /// The mipmap-level to set -KINC_FUNC void kinc_g4_texture_set_mipmap(kinc_g4_texture_t *texture, kinc_image_t *mipmap, int level); +void kinc_g4_texture_set_mipmap(kinc_g4_texture_t *texture, kinc_image_t *mipmap, int level); /// /// Returns the stride of the first mipmap-layer of the texture in bytes. /// /// The texture to figure out the stride for /// The stride of the first mipmap-layer in bytes -KINC_FUNC int kinc_g4_texture_stride(kinc_g4_texture_t *texture); +int kinc_g4_texture_stride(kinc_g4_texture_t *texture); #ifdef KINC_ANDROID -KINC_FUNC void kinc_g4_texture_init_from_id(kinc_g4_texture_t *texture, unsigned texid); +void kinc_g4_texture_init_from_id(kinc_g4_texture_t *texture, unsigned texid); #endif #if defined(KINC_IOS) || defined(KINC_MACOS) -KINC_FUNC void kinc_g4_texture_upload(kinc_g4_texture_t *texture, uint8_t *data, int stride); +void kinc_g4_texture_upload(kinc_g4_texture_t *texture, uint8_t *data, int stride); #endif #ifdef __cplusplus diff --git a/sources/kinc/graphics4/texturearray.h b/sources/kinc/graphics4/texturearray.h deleted file mode 100644 index f5039a54..00000000 --- a/sources/kinc/graphics4/texturearray.h +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -#include - -#include "texture.h" - -#include - -/*! \file texturearray.h - \brief Provides functions for creating and destroying texture-arrays. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct kinc_g4_texture_array { - kinc_g4_texture_array_impl_t impl; -} kinc_g4_texture_array_t; - -/// -/// Allocates and initializes a texture-array based on an array of images. -/// -/// The texture-array to initialize -/// The images to assign to the texture-array -/// The number of images -KINC_FUNC void kinc_g4_texture_array_init(kinc_g4_texture_array_t *array, kinc_image_t *images, int count); - -/// -/// Deallocates and destroys a texture-array -/// -/// The texture-array to destroy -KINC_FUNC void kinc_g4_texture_array_destroy(kinc_g4_texture_array_t *array); - -#ifdef __cplusplus -} -#endif diff --git a/sources/kinc/graphics4/usage.h b/sources/kinc/graphics4/usage.h index 6ca16813..1cbf7f2f 100644 --- a/sources/kinc/graphics4/usage.h +++ b/sources/kinc/graphics4/usage.h @@ -8,7 +8,11 @@ extern "C" { #endif -typedef enum kinc_g4_usage { KINC_G4_USAGE_STATIC, KINC_G4_USAGE_DYNAMIC, KINC_G4_USAGE_READABLE } kinc_g4_usage_t; +typedef enum kinc_g4_usage { + KINC_G4_USAGE_STATIC, + KINC_G4_USAGE_DYNAMIC, + KINC_G4_USAGE_READABLE +} kinc_g4_usage_t; #ifdef __cplusplus } diff --git a/sources/kinc/graphics4/vertexbuffer.h b/sources/kinc/graphics4/vertexbuffer.h index f167c229..7045b820 100644 --- a/sources/kinc/graphics4/vertexbuffer.h +++ b/sources/kinc/graphics4/vertexbuffer.h @@ -29,21 +29,21 @@ typedef struct kinc_g4_vertex_buffer { /// The structure of the buffer /// A hint for how the buffer will be used /// The step-rate for instanced-rendering - use 0 if instanced-rendering will not be used with this buffer -KINC_FUNC void kinc_g4_vertex_buffer_init(kinc_g4_vertex_buffer_t *buffer, int count, kinc_g4_vertex_structure_t *structure, kinc_g4_usage_t usage, +void kinc_g4_vertex_buffer_init(kinc_g4_vertex_buffer_t *buffer, int count, kinc_g4_vertex_structure_t *structure, kinc_g4_usage_t usage, int instance_data_step_rate); /// /// Destroys a vertex-buffer. /// /// The buffer to destroy -KINC_FUNC void kinc_g4_vertex_buffer_destroy(kinc_g4_vertex_buffer_t *buffer); +void kinc_g4_vertex_buffer_destroy(kinc_g4_vertex_buffer_t *buffer); /// /// Locks all of a vertex-buffer to modify its contents. /// /// The buffer to lock /// The contents of the buffer -KINC_FUNC float *kinc_g4_vertex_buffer_lock_all(kinc_g4_vertex_buffer_t *buffer); +float *kinc_g4_vertex_buffer_lock_all(kinc_g4_vertex_buffer_t *buffer); /// /// Locks part of a vertex-buffer to modify its contents. @@ -52,34 +52,34 @@ KINC_FUNC float *kinc_g4_vertex_buffer_lock_all(kinc_g4_vertex_buffer_t *buffer) /// The index of the first vertex to lock /// The number of vertices to lock /// The contents of the buffer, starting at start -KINC_FUNC float *kinc_g4_vertex_buffer_lock(kinc_g4_vertex_buffer_t *buffer, int start, int count); +float *kinc_g4_vertex_buffer_lock(kinc_g4_vertex_buffer_t *buffer, int start, int count); /// /// Unlock all of a vertex-buffer so the changed contents can be used. /// /// The buffer to unlock -KINC_FUNC void kinc_g4_vertex_buffer_unlock_all(kinc_g4_vertex_buffer_t *buffer); +void kinc_g4_vertex_buffer_unlock_all(kinc_g4_vertex_buffer_t *buffer); /// /// Unlocks part of a vertex-buffer so the changed contents can be used. /// /// The buffer to unlock /// The number of vertices to unlock, starting from the start-vertex from the previous lock-call -KINC_FUNC void kinc_g4_vertex_buffer_unlock(kinc_g4_vertex_buffer_t *buffer, int count); +void kinc_g4_vertex_buffer_unlock(kinc_g4_vertex_buffer_t *buffer, int count); /// /// Returns the number of vertices in a buffer. /// /// The buffer to figure out the number of vertices for /// The number of vertices -KINC_FUNC int kinc_g4_vertex_buffer_count(kinc_g4_vertex_buffer_t *buffer); +int kinc_g4_vertex_buffer_count(kinc_g4_vertex_buffer_t *buffer); /// /// Returns the stride aka the size of one vertex of the buffer in bytes. /// /// The buffer to figure out the stride for /// The stride of the buffer in bytes -KINC_FUNC int kinc_g4_vertex_buffer_stride(kinc_g4_vertex_buffer_t *buffer); +int kinc_g4_vertex_buffer_stride(kinc_g4_vertex_buffer_t *buffer); int kinc_internal_g4_vertex_buffer_set(kinc_g4_vertex_buffer_t *buffer, int offset); @@ -88,13 +88,13 @@ int kinc_internal_g4_vertex_buffer_set(kinc_g4_vertex_buffer_t *buffer, int offs /// /// The buffers to set /// The number of buffers to set -KINC_FUNC void kinc_g4_set_vertex_buffers(kinc_g4_vertex_buffer_t **buffers, int count); +void kinc_g4_set_vertex_buffers(kinc_g4_vertex_buffer_t **buffers, int count); /// /// Sets a vertex-buffer for the next draw-call. /// /// The buffer to set -KINC_FUNC void kinc_g4_set_vertex_buffer(kinc_g4_vertex_buffer_t *buffer); +void kinc_g4_set_vertex_buffer(kinc_g4_vertex_buffer_t *buffer); #ifdef __cplusplus } diff --git a/sources/kinc/graphics4/vertexstructure.h b/sources/kinc/graphics4/vertexstructure.h index dfb4988f..fa605aba 100644 --- a/sources/kinc/graphics4/vertexstructure.h +++ b/sources/kinc/graphics4/vertexstructure.h @@ -141,7 +141,7 @@ typedef struct kinc_g4_vertex_structure { /// /// The structure to initialize /// -KINC_FUNC void kinc_g4_vertex_structure_init(kinc_g4_vertex_structure_t *structure); +void kinc_g4_vertex_structure_init(kinc_g4_vertex_structure_t *structure); /// /// Adds an element to a vertex-structure. @@ -150,7 +150,7 @@ KINC_FUNC void kinc_g4_vertex_structure_init(kinc_g4_vertex_structure_t *structu /// The name to use for the new element /// The type of data to assign for the new element /// -KINC_FUNC void kinc_g4_vertex_structure_add(kinc_g4_vertex_structure_t *structure, const char *name, kinc_g4_vertex_data_t data); +void kinc_g4_vertex_structure_add(kinc_g4_vertex_structure_t *structure, const char *name, kinc_g4_vertex_data_t data); #ifdef __cplusplus } diff --git a/sources/kinc/graphics5/commandlist.h b/sources/kinc/graphics5/commandlist.h index 2d6c6392..24ad0837 100644 --- a/sources/kinc/graphics5/commandlist.h +++ b/sources/kinc/graphics5/commandlist.h @@ -50,26 +50,26 @@ typedef struct kinc_g5_command_list { /// Initializes a command-list. /// /// The command-list to initialize -KINC_FUNC void kinc_g5_command_list_init(kinc_g5_command_list_t *list); +void kinc_g5_command_list_init(kinc_g5_command_list_t *list); /// /// Destroys a command-list. /// /// The command-list to destroy -KINC_FUNC void kinc_g5_command_list_destroy(kinc_g5_command_list_t *list); +void kinc_g5_command_list_destroy(kinc_g5_command_list_t *list); /// /// Starts recording commands in a command-list. /// /// The list to use -KINC_FUNC void kinc_g5_command_list_begin(kinc_g5_command_list_t *list); +void kinc_g5_command_list_begin(kinc_g5_command_list_t *list); /// /// Ends recording commands for the list. Has to be called after kinc_g5_command_list_begin and before kinc_g5_command_list_execute. /// /// /// -KINC_FUNC void kinc_g5_command_list_end(kinc_g5_command_list_t *list); +void kinc_g5_command_list_end(kinc_g5_command_list_t *list); /// /// Records a command to clear the color, depth and/or stencil-components of a render-target. @@ -80,7 +80,7 @@ KINC_FUNC void kinc_g5_command_list_end(kinc_g5_command_list_t *list); /// The color-value to clear to in 0xAARRGGBB /// The depth-value to clear to /// The stencil-value to clear to -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, +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); /// @@ -88,35 +88,35 @@ KINC_FUNC void kinc_g5_command_list_clear(kinc_g5_command_list_t *list, struct k /// /// The list to write the command to /// The render-target to use as the current framebuffer -KINC_FUNC void kinc_g5_command_list_render_target_to_framebuffer_barrier(kinc_g5_command_list_t *list, struct kinc_g5_render_target *renderTarget); +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 for regular render-target-usage after being used as the current framebuffer. /// /// The list to write the command to /// The render-target to use in regular render-target-mode -KINC_FUNC void kinc_g5_command_list_framebuffer_to_render_target_barrier(kinc_g5_command_list_t *list, struct kinc_g5_render_target *renderTarget); +void kinc_g5_command_list_framebuffer_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. /// /// The list to write the command to /// The render-target to render to -KINC_FUNC void kinc_g5_command_list_texture_to_render_target_barrier(kinc_g5_command_list_t *list, struct kinc_g5_render_target *renderTarget); +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 used for sampling/reading like a texture. /// /// The list to write the command to /// The render-target to be used like a texture -KINC_FUNC void kinc_g5_command_list_render_target_to_texture_barrier(kinc_g5_command_list_t *list, struct kinc_g5_render_target *renderTarget); +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 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. /// /// The list to write the command to -KINC_FUNC void kinc_g5_command_list_draw_indexed_vertices(kinc_g5_command_list_t *list); +void kinc_g5_command_list_draw_indexed_vertices(kinc_g5_command_list_t *list); /// /// 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 @@ -125,7 +125,7 @@ KINC_FUNC void kinc_g5_command_list_draw_indexed_vertices(kinc_g5_command_list_t /// The list to write the command to /// The offset into the index-buffer /// The number of indices to use -KINC_FUNC void kinc_g5_command_list_draw_indexed_vertices_from_to(kinc_g5_command_list_t *list, int start, int count); +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 and additionally applies a general offset into the @@ -135,10 +135,10 @@ KINC_FUNC void kinc_g5_command_list_draw_indexed_vertices_from_to(kinc_g5_comman /// The offset into the index-buffer /// The number of indices to use /// The offset into the vertex-buffer which is added to each index read from the index-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); +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); +void kinc_g5_command_list_draw_indexed_vertices_instanced(kinc_g5_command_list_t *list, int instanceCount); +void kinc_g5_command_list_draw_indexed_vertices_instanced_from_to(kinc_g5_command_list_t *list, int instanceCount, int start, int count); /// /// 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 @@ -149,7 +149,7 @@ KINC_FUNC void kinc_g5_command_list_draw_indexed_vertices_instanced_from_to(kinc /// The y-offset of the viewport from the top of the screen in pixels /// The width of the viewport in pixels /// The height of the viewport in pixels -KINC_FUNC void kinc_g5_command_list_viewport(kinc_g5_command_list_t *list, int x, int y, int width, int height); +void kinc_g5_command_list_viewport(kinc_g5_command_list_t *list, int x, int y, int width, int height); /// /// Writes a command that enables and defines the scissor-rect. When the scissor-rect is enabled, anything that's rendered outside of the scissor-rect will be @@ -160,32 +160,32 @@ KINC_FUNC void kinc_g5_command_list_viewport(kinc_g5_command_list_t *list, int x /// The y-offset of the scissor-rect from the top of the screen in pixels /// The width of the scissor-rect in pixels /// The height of the scissor-rect in pixels -KINC_FUNC void kinc_g5_command_list_scissor(kinc_g5_command_list_t *list, int x, int y, int width, int height); +void kinc_g5_command_list_scissor(kinc_g5_command_list_t *list, int x, int y, int width, int height); /// /// Writes a command to disable the scissor-rect. /// /// The list to write the command to -KINC_FUNC void kinc_g5_command_list_disable_scissor(kinc_g5_command_list_t *list); +void kinc_g5_command_list_disable_scissor(kinc_g5_command_list_t *list); /// /// Writes a command to set the pipeline for the next draw-call. The pipeline defines most rendering-state including the shaders to be used. /// /// The list to write the command to /// The pipeline to set -KINC_FUNC void kinc_g5_command_list_set_pipeline(kinc_g5_command_list_t *list, struct kinc_g5_pipeline *pipeline); +void kinc_g5_command_list_set_pipeline(kinc_g5_command_list_t *list, struct kinc_g5_pipeline *pipeline); /// /// Writes a command to set the compute shader for the next compute-call. /// /// The list to write the command to /// The compute shader to set -KINC_FUNC void kinc_g5_command_list_set_compute_shader(kinc_g5_command_list_t *list, struct kinc_g5_compute_shader *shader); +void kinc_g5_command_list_set_compute_shader(kinc_g5_command_list_t *list, struct kinc_g5_compute_shader *shader); /// /// Sets the blend constant used for `KINC_G5_BLEND_CONSTANT` or `KINC_G5_INV_BLEND_CONSTANT` /// -KINC_FUNC void kinc_g5_command_list_set_blend_constant(kinc_g5_command_list_t *list, float r, float g, float b, float a); +void kinc_g5_command_list_set_blend_constant(kinc_g5_command_list_t *list, float r, float g, float b, float a); /// /// Writes a command which sets vertex-buffers for the next draw-call. @@ -194,14 +194,14 @@ KINC_FUNC void kinc_g5_command_list_set_blend_constant(kinc_g5_command_list_t *l /// The buffers to set /// The offset to use for every buffer in number of vertices /// The number of buffers to set -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); +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 to set an index-buffer to be used for the next draw-command. /// /// The list to write the command to /// The buffer to use -KINC_FUNC void kinc_g5_command_list_set_index_buffer(kinc_g5_command_list_t *list, struct kinc_g5_index_buffer *buffer); +void kinc_g5_command_list_set_index_buffer(kinc_g5_command_list_t *list, struct kinc_g5_index_buffer *buffer); /// /// Writes a command that sets the render-targets to draw into in following draw-calls. @@ -209,28 +209,28 @@ KINC_FUNC void kinc_g5_command_list_set_index_buffer(kinc_g5_command_list_t *lis /// The list to write the command to /// The render-targets to use for following-draw calls /// The number of render-targets to use -KINC_FUNC void kinc_g5_command_list_set_render_targets(kinc_g5_command_list_t *list, struct kinc_g5_render_target **targets, int count); +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 to upload an index-buffer that's in main-memory to gpu-memory. Does nothing on unified-memory-systems. /// /// The list to write the command to /// The buffer to upload -KINC_FUNC void kinc_g5_command_list_upload_index_buffer(kinc_g5_command_list_t *list, struct kinc_g5_index_buffer *buffer); +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 a vertex-buffer that's in main-memory to gpu-memory. Does nothing on unified-memory-systems. /// /// The list to write the command to /// The buffer to upload -KINC_FUNC void kinc_g5_command_list_upload_vertex_buffer(kinc_g5_command_list_t *list, struct kinc_g5_vertex_buffer *buffer); +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 texture that's in main-memory to gpu-memory. Does nothing on unified-memory-systems. /// /// The list to write the command to /// The texture to upload -KINC_FUNC void kinc_g5_command_list_upload_texture(kinc_g5_command_list_t *list, struct kinc_g5_texture *texture); +void kinc_g5_command_list_upload_texture(kinc_g5_command_list_t *list, struct kinc_g5_texture *texture); /// /// Writes a command that sets a constant-buffer for the vertex-shader-stage. @@ -239,7 +239,7 @@ KINC_FUNC void kinc_g5_command_list_upload_texture(kinc_g5_command_list_t *list, /// The buffer to set /// The offset into the buffer in bytes to use as the start /// The size of the buffer to use in bytes starting at the offset -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); +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 fragment-shader-stage. @@ -248,7 +248,7 @@ KINC_FUNC void kinc_g5_command_list_set_vertex_constant_buffer(kinc_g5_command_l /// The buffer to set /// The offset into the buffer in bytes to use as the start /// The size of the buffer to use in bytes starting at the offset -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); +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 compute-shader-stage. @@ -257,20 +257,20 @@ KINC_FUNC void kinc_g5_command_list_set_fragment_constant_buffer(kinc_g5_command /// The buffer to set /// The offset into the buffer in bytes to use as the start /// The size of the buffer to use in bytes starting at the offset -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); +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); /// /// Kicks off execution of the commands which have been recorded in the command-list. kinc_g5_command_list_end has to be called beforehand. /// /// The command-list to execute -KINC_FUNC void kinc_g5_command_list_execute(kinc_g5_command_list_t *list); +void kinc_g5_command_list_execute(kinc_g5_command_list_t *list); /// /// Waits for execution of the command_list to finish. Make sure the command-list is executing before you wait for it. /// Also take note that waiting for a command-list to finish executing completely is a very expensive operation. /// /// The command-list to execute -KINC_FUNC void kinc_g5_command_list_wait_for_execution_to_finish(kinc_g5_command_list_t *list); +void kinc_g5_command_list_wait_for_execution_to_finish(kinc_g5_command_list_t *list); /// /// Writes a command that copies the contents of a render-target into a cpu-side buffer. Beware: This is enormously slow. @@ -278,7 +278,7 @@ KINC_FUNC void kinc_g5_command_list_wait_for_execution_to_finish(kinc_g5_command /// The list to write the command to /// The render-target to copy the data from /// The buffer to copy the data into -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); +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); /// /// Records a command that fires off a compute-run on x * y * z elements. @@ -287,7 +287,7 @@ KINC_FUNC void kinc_g5_command_list_get_render_target_pixels(kinc_g5_command_lis /// The x-size for the compute-run /// The y-size for the compute-run /// The z-size for the compute-run -KINC_FUNC void kinc_g5_command_list_compute(kinc_g5_command_list_t *list, int x, int y, int z); +void kinc_g5_command_list_compute(kinc_g5_command_list_t *list, int x, int y, int z); /// /// Assigns a texture to a texture-unit for sampled access via GLSL's texture. @@ -295,7 +295,7 @@ KINC_FUNC void kinc_g5_command_list_compute(kinc_g5_command_list_t *list, int x, /// The list to write the command to /// The unit to assign this texture to /// The texture to assign to the unit -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); +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 direct access via GLSL's texelFetch (as @@ -305,7 +305,7 @@ KINC_FUNC void kinc_g5_command_list_set_texture(kinc_g5_command_list_t *list, ki /// The list to write the command to /// The unit to assign this texture to /// The texture to assign to the unit -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); +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); /// /// Uses the color-component of a render-target as a texture. @@ -313,7 +313,7 @@ KINC_FUNC void kinc_g5_command_list_set_image_texture(kinc_g5_command_list_t *li /// The list to write the command to /// The texture-unit to assign the render-target to /// The render-target to use -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); +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 depth-component of a render-target as a texture. @@ -321,19 +321,12 @@ KINC_FUNC void kinc_g5_command_list_set_texture_from_render_target(kinc_g5_comma /// The list to write the command to /// The texture-unit to assign the render-target to /// The render-target to use -KINC_FUNC void kinc_g5_command_list_set_texture_from_render_target_depth(kinc_g5_command_list_t *list, kinc_g5_texture_unit_t unit, +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); +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); +void kinc_g5_command_list_set_sampler(kinc_g5_command_list_t *list, kinc_g5_texture_unit_t unit, kinc_g5_sampler_t *sampler); #ifdef __cplusplus } diff --git a/sources/kinc/graphics5/compute.h b/sources/kinc/graphics5/compute.h index 4fff79e8..a064aeef 100644 --- a/sources/kinc/graphics5/compute.h +++ b/sources/kinc/graphics5/compute.h @@ -25,22 +25,21 @@ typedef struct kinc_g5_compute_shader { /// The shader-object to initialize /// A pointer to system-specific shader-data /// Length of the shader-data in bytes -KINC_FUNC void kinc_g5_compute_shader_init(kinc_g5_compute_shader *shader, void *source, int length); +void kinc_g5_compute_shader_init(kinc_g5_compute_shader *shader, void *source, int length); /// /// Desotry a shader-object /// /// The shader-object to destroy -KINC_FUNC void kinc_g5_compute_shader_destroy(kinc_g5_compute_shader *shader); +void kinc_g5_compute_shader_destroy(kinc_g5_compute_shader *shader); -#ifndef KINC_KONG /// /// Finds the location of a constant/uniform inside of a shader. /// /// The shader to look into /// The constant/uniform-name to look for /// The found constant-location -KINC_FUNC kinc_g5_constant_location_t kinc_g5_compute_shader_get_constant_location(kinc_g5_compute_shader *shader, const char *name); +kinc_g5_constant_location_t kinc_g5_compute_shader_get_constant_location(kinc_g5_compute_shader *shader, const char *name); /// /// Finds a texture-unit inside of a shader. @@ -48,8 +47,7 @@ KINC_FUNC kinc_g5_constant_location_t kinc_g5_compute_shader_get_constant_locati /// The shader to look into /// The texture-name to look for /// The found texture-unit -KINC_FUNC kinc_g5_texture_unit_t kinc_g5_compute_shader_get_texture_unit(kinc_g5_compute_shader *shader, const char *name); -#endif +kinc_g5_texture_unit_t kinc_g5_compute_shader_get_texture_unit(kinc_g5_compute_shader *shader, const char *name); #ifdef __cplusplus } diff --git a/sources/kinc/graphics5/constantbuffer.h b/sources/kinc/graphics5/constantbuffer.h index 9909752e..23f788d0 100644 --- a/sources/kinc/graphics5/constantbuffer.h +++ b/sources/kinc/graphics5/constantbuffer.h @@ -25,20 +25,20 @@ typedef struct kinc_g5_constant_buffer { /// /// The buffer to initialize /// The size of the constant-data in the buffer in bytes -KINC_FUNC void kinc_g5_constant_buffer_init(kinc_g5_constant_buffer_t *buffer, int size); +void kinc_g5_constant_buffer_init(kinc_g5_constant_buffer_t *buffer, int size); /// /// Destroys a buffer. /// /// The buffer to destroy -KINC_FUNC void kinc_g5_constant_buffer_destroy(kinc_g5_constant_buffer_t *buffer); +void kinc_g5_constant_buffer_destroy(kinc_g5_constant_buffer_t *buffer); /// /// Locks all of a constant-buffer to modify its contents. /// /// The buffer to lock /// The contents of the buffer -KINC_FUNC void kinc_g5_constant_buffer_lock_all(kinc_g5_constant_buffer_t *buffer); +void kinc_g5_constant_buffer_lock_all(kinc_g5_constant_buffer_t *buffer); /// /// Locks part of a constant-buffer to modify its contents. @@ -47,34 +47,34 @@ KINC_FUNC void kinc_g5_constant_buffer_lock_all(kinc_g5_constant_buffer_t *buffe /// The offset of where to start the lock in bytes /// The number of bytes to lock /// The contents of the buffer, starting at start -KINC_FUNC void kinc_g5_constant_buffer_lock(kinc_g5_constant_buffer_t *buffer, int start, int count); +void kinc_g5_constant_buffer_lock(kinc_g5_constant_buffer_t *buffer, int start, int count); /// /// Unlocks a constant-buffer so the changed contents can be used. /// /// The buffer to unlock -KINC_FUNC void kinc_g5_constant_buffer_unlock(kinc_g5_constant_buffer_t *buffer); +void kinc_g5_constant_buffer_unlock(kinc_g5_constant_buffer_t *buffer); /// /// Figures out the size of the constant-data in the buffer. /// /// The buffer to figure out the size for /// Returns the size of the constant-data in the buffer in bytes -KINC_FUNC int kinc_g5_constant_buffer_size(kinc_g5_constant_buffer_t *buffer); +int kinc_g5_constant_buffer_size(kinc_g5_constant_buffer_t *buffer); /// /// Assigns a bool at an offset in a constant-buffer. /// /// The offset at which to write the data /// The value to write into the buffer -KINC_FUNC void kinc_g5_constant_buffer_set_bool(kinc_g5_constant_buffer_t *buffer, int offset, bool value); +void kinc_g5_constant_buffer_set_bool(kinc_g5_constant_buffer_t *buffer, int offset, bool value); /// /// Assigns an integer at an offset in a constant-buffer. /// /// The offset at which to write the data /// The value to assign to the constant/uniform -KINC_FUNC void kinc_g5_constant_buffer_set_int(kinc_g5_constant_buffer_t *buffer, int offset, int value); +void kinc_g5_constant_buffer_set_int(kinc_g5_constant_buffer_t *buffer, int offset, int value); /// /// Assigns two integers at an offset in a constant-buffer. @@ -82,7 +82,7 @@ KINC_FUNC void kinc_g5_constant_buffer_set_int(kinc_g5_constant_buffer_t *buffer /// The offset at which to write the data /// The first value to write into the buffer /// The second value to write into the buffer -KINC_FUNC void kinc_g5_constant_buffer_set_int2(kinc_g5_constant_buffer_t *buffer, int offset, int value1, int value2); +void kinc_g5_constant_buffer_set_int2(kinc_g5_constant_buffer_t *buffer, int offset, int value1, int value2); /// /// Assigns three integers at an offset in a constant-buffer. @@ -91,7 +91,7 @@ KINC_FUNC void kinc_g5_constant_buffer_set_int2(kinc_g5_constant_buffer_t *buffe /// The first value to write into the buffer /// The second value to write into the buffer /// 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); +void kinc_g5_constant_buffer_set_int3(kinc_g5_constant_buffer_t *buffer, int offset, int value1, int value2, int value3); /// /// Assigns four integers at an offset in a constant-buffer. @@ -101,7 +101,7 @@ KINC_FUNC void kinc_g5_constant_buffer_set_int3(kinc_g5_constant_buffer_t *buffe /// The second value to write into the buffer /// The third value to write into the buffer/param> /// The fourth value to write into the buffer -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); +void kinc_g5_constant_buffer_set_int4(kinc_g5_constant_buffer_t *buffer, int offset, int value1, int value2, int value3, int value4); /// /// Assigns a bunch of integers at an offset in a constant-buffer. @@ -109,14 +109,14 @@ KINC_FUNC void kinc_g5_constant_buffer_set_int4(kinc_g5_constant_buffer_t *buffe /// The location of the constant/uniform to assign the values to /// The values to write into the buffer /// The number of values to write into the buffer -KINC_FUNC void kinc_g5_constant_buffer_set_ints(kinc_g5_constant_buffer_t *buffer, int offset, int *values, int count); +void kinc_g5_constant_buffer_set_ints(kinc_g5_constant_buffer_t *buffer, int offset, int *values, int count); /// /// Assigns a float at an offset in a constant-buffer. /// /// The offset at which to write the data /// The value to write into the buffer -KINC_FUNC void kinc_g5_constant_buffer_set_float(kinc_g5_constant_buffer_t *buffer, int offset, float value); +void kinc_g5_constant_buffer_set_float(kinc_g5_constant_buffer_t *buffer, int offset, float value); /// /// Assigns two floats at an offset in a constant-buffer. @@ -124,7 +124,7 @@ KINC_FUNC void kinc_g5_constant_buffer_set_float(kinc_g5_constant_buffer_t *buff /// The offset at which to write the data /// The first value to write into the buffer /// The second value to write into the buffer -KINC_FUNC void kinc_g5_constant_buffer_set_float2(kinc_g5_constant_buffer_t *buffer, int offset, float value1, float value2); +void kinc_g5_constant_buffer_set_float2(kinc_g5_constant_buffer_t *buffer, int offset, float value1, float value2); /// /// Assigns three floats at an offset in a constant-buffer. @@ -133,7 +133,7 @@ KINC_FUNC void kinc_g5_constant_buffer_set_float2(kinc_g5_constant_buffer_t *buf /// The first value to write into the buffer /// The second value to write into the buffer /// 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); +void kinc_g5_constant_buffer_set_float3(kinc_g5_constant_buffer_t *buffer, int offset, float value1, float value2, float value3); /// /// Assigns four floats at an offset in a constant-buffer. @@ -143,7 +143,7 @@ KINC_FUNC void kinc_g5_constant_buffer_set_float3(kinc_g5_constant_buffer_t *buf /// The second value to write into the buffer /// The third value to write into the buffer/param> /// The fourth value to write into the buffer -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); +void kinc_g5_constant_buffer_set_float4(kinc_g5_constant_buffer_t *buffer, int offset, float value1, float value2, float value3, float value4); /// /// Assigns a bunch of floats at an offset in a constant-buffer. @@ -151,24 +151,24 @@ KINC_FUNC void kinc_g5_constant_buffer_set_float4(kinc_g5_constant_buffer_t *buf /// The location of the constant/uniform to assign the values to /// The values to write into the buffer /// The number of values to write into the buffer -KINC_FUNC void kinc_g5_constant_buffer_set_floats(kinc_g5_constant_buffer_t *buffer, int offset, float *values, int count); +void kinc_g5_constant_buffer_set_floats(kinc_g5_constant_buffer_t *buffer, int offset, float *values, int count); /// /// Assigns a 3x3-matrix at an offset in a constant-buffer. /// /// The offset at which to write the data /// The value to write into the buffer -KINC_FUNC void kinc_g5_constant_buffer_set_matrix3(kinc_g5_constant_buffer_t *buffer, int offset, kinc_matrix3x3_t *value); +void kinc_g5_constant_buffer_set_matrix3(kinc_g5_constant_buffer_t *buffer, int offset, kinc_matrix3x3_t *value); /// /// Assigns a 4x4-matrix at an offset in a constant-buffer. /// /// The offset at which to write the data /// The value to write into the buffer -KINC_FUNC void kinc_g5_constant_buffer_set_matrix4(kinc_g5_constant_buffer_t *buffer, int offset, kinc_matrix4x4_t *value); +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; +extern bool kinc_g5_transposeMat3; +extern bool kinc_g5_transposeMat4; #ifdef __cplusplus } diff --git a/sources/kinc/graphics5/graphics.h b/sources/kinc/graphics5/graphics.h index cdcf94e7..4d77d1ce 100644 --- a/sources/kinc/graphics5/graphics.h +++ b/sources/kinc/graphics5/graphics.h @@ -21,92 +21,90 @@ extern "C" { #endif -KINC_FUNC extern bool kinc_g5_fullscreen; +extern bool kinc_g5_fullscreen; /// /// Returns whether raytracing (see kinc/graphics5/raytrace.h) is supported. /// /// Whether raytracing is supported -KINC_FUNC bool kinc_g5_supports_raytracing(void); +bool kinc_g5_supports_raytracing(void); /// /// Returns whether instanced rendering (kinc_g5_command_list_draw_indexed_vertices_instanced and pals) is supported. /// /// Whether instanced rendering is supported -KINC_FUNC bool kinc_g5_supports_instanced_rendering(void); +bool kinc_g5_supports_instanced_rendering(void); /// /// Returns whether GPU-compute (the functions in kinc/compute/compute.h) is supported. /// /// Whether GPU-compute is supported -KINC_FUNC bool kinc_g5_supports_compute_shaders(void); +bool kinc_g5_supports_compute_shaders(void); /// /// Returns whether blend-constants (see kinc_g4_set_blend_constant and the blending-properties for pipelines) are supported. /// /// Whether blend-constants are supported -KINC_FUNC bool kinc_g5_supports_blend_constants(void); +bool kinc_g5_supports_blend_constants(void); /// /// Returns whether textures are supported which have widths/heights which are not powers of two. /// /// Whether non power of two texture-sizes are supported -KINC_FUNC bool kinc_g5_supports_non_pow2_textures(void); +bool kinc_g5_supports_non_pow2_textures(void); /// /// Returns whether render-targets are upside down. This happens in OpenGL and there is currently no automatic mitigation. /// /// Whether render-targets are upside down -KINC_FUNC bool kinc_g5_render_targets_inverted_y(void); +bool kinc_g5_render_targets_inverted_y(void); /// /// Returns how many textures can be used at the same time in a fragment-shader. /// /// The number of textures -KINC_FUNC int kinc_g5_max_bound_textures(void); +int kinc_g5_max_bound_textures(void); /// /// I think this does nothing. /// -KINC_FUNC void kinc_g5_flush(void); +void kinc_g5_flush(void); /// /// Returns the currently used number of samples for hardware-antialiasing. /// /// The number of samples -KINC_FUNC int kinc_g5_antialiasing_samples(void); +int kinc_g5_antialiasing_samples(void); /// /// 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. /// /// The number of samples -KINC_FUNC void kinc_g5_set_antialiasing_samples(int samples); +void kinc_g5_set_antialiasing_samples(int samples); /// /// Needs to be called before rendering to a window. Typically called at the start of each frame. /// /// The window to render to -KINC_FUNC void kinc_g5_begin(kinc_g5_render_target_t *renderTarget, int window); +void kinc_g5_begin(kinc_g5_render_target_t *renderTarget, int window); /// /// Needs to be called after rendering to a window. Typically called at the end of each frame. /// /// The window to render to /// -KINC_FUNC void kinc_g5_end(int window); +void kinc_g5_end(int window); /// /// Needs to be called to make the rendered frame visible. Typically called at the very end of each frame. /// -KINC_FUNC bool kinc_g5_swap_buffers(void); +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 } diff --git a/sources/kinc/graphics5/indexbuffer.h b/sources/kinc/graphics5/indexbuffer.h index 7f67352f..3f2c4aeb 100644 --- a/sources/kinc/graphics5/indexbuffer.h +++ b/sources/kinc/graphics5/indexbuffer.h @@ -24,20 +24,20 @@ typedef struct kinc_g5_index_buffer { /// The buffer to initialize /// The number of indices to allocate for the buffer /// When true, the buffer will be uploaded to gpu-memory which will make it faster to use but slower to change -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); +void kinc_g5_index_buffer_init(kinc_g5_index_buffer_t *buffer, int count, kinc_g5_index_buffer_format_t format, bool gpu_memory); /// /// Destroys an index-buffer. /// /// The buffer to destroy -KINC_FUNC void kinc_g5_index_buffer_destroy(kinc_g5_index_buffer_t *buffer); +void kinc_g5_index_buffer_destroy(kinc_g5_index_buffer_t *buffer); /// /// Locks an index-buffer so its contents can be modified. /// /// The buffer to lock /// The contents of the index-buffer in uint32s or uint16s depending on the format provided when initializing -KINC_FUNC void *kinc_g5_index_buffer_lock_all(kinc_g5_index_buffer_t *buffer); +void *kinc_g5_index_buffer_lock_all(kinc_g5_index_buffer_t *buffer); /// /// Locks part of a vertex-buffer to modify its contents. @@ -46,27 +46,27 @@ KINC_FUNC void *kinc_g5_index_buffer_lock_all(kinc_g5_index_buffer_t *buffer); /// The index of the first index to lock /// The number of indices to lock /// The contents of the index-buffer, starting at start, in uint32s or uint16s depending on the format provided when initializing -KINC_FUNC void *kinc_g5_index_buffer_lock(kinc_g5_index_buffer_t *buffer, int start, int count); +void *kinc_g5_index_buffer_lock(kinc_g5_index_buffer_t *buffer, int start, int count); /// /// Unlocks an index-buffer after locking it so the changed buffer-contents can be used. /// /// The buffer to unlock -KINC_FUNC void kinc_g5_index_buffer_unlock_all(kinc_g5_index_buffer_t *buffer); +void kinc_g5_index_buffer_unlock_all(kinc_g5_index_buffer_t *buffer); /// /// Unlocks part of an index-buffer after locking so the changed buffer-contents can be used. /// /// The buffer to unlock /// The number of indices to unlock, starting from the start-index from the previous lock-call -KINC_FUNC void kinc_g5_index_buffer_unlock(kinc_g5_index_buffer_t *buffer, int count); +void kinc_g5_index_buffer_unlock(kinc_g5_index_buffer_t *buffer, int count); /// /// Returns the number of indices in the buffer. /// /// The buffer to query for its number of indices /// The number of indices -KINC_FUNC int kinc_g5_index_buffer_count(kinc_g5_index_buffer_t *buffer); +int kinc_g5_index_buffer_count(kinc_g5_index_buffer_t *buffer); #ifdef __cplusplus } diff --git a/sources/kinc/graphics5/pipeline.h b/sources/kinc/graphics5/pipeline.h index ffa4229e..4fb1b7c6 100644 --- a/sources/kinc/graphics5/pipeline.h +++ b/sources/kinc/graphics5/pipeline.h @@ -117,7 +117,7 @@ typedef struct kinc_g5_pipeline { /// Initializes a pipeline. /// /// The pipeline to initialize -KINC_FUNC void kinc_g5_pipeline_init(kinc_g5_pipeline_t *pipeline); +void kinc_g5_pipeline_init(kinc_g5_pipeline_t *pipeline); void kinc_g5_internal_pipeline_init(kinc_g5_pipeline_t *pipeline); @@ -125,22 +125,21 @@ void kinc_g5_internal_pipeline_init(kinc_g5_pipeline_t *pipeline); /// Destroys a pipeline. /// /// The pipeline to destroy -KINC_FUNC void kinc_g5_pipeline_destroy(kinc_g5_pipeline_t *pipeline); +void kinc_g5_pipeline_destroy(kinc_g5_pipeline_t *pipeline); /// /// 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. /// /// The pipeline to compile -KINC_FUNC void kinc_g5_pipeline_compile(kinc_g5_pipeline_t *pipeline); +void kinc_g5_pipeline_compile(kinc_g5_pipeline_t *pipeline); -#ifndef KINC_KONG /// /// Searches for a constant/uniform and returns a constant-location which can be used to change the constant/uniform. /// /// The pipeline to search in /// The name of the constant/uniform to find /// The constant-location of the constant/uniform -KINC_FUNC kinc_g5_constant_location_t kinc_g5_pipeline_get_constant_location(kinc_g5_pipeline_t *pipeline, const char *name); +kinc_g5_constant_location_t kinc_g5_pipeline_get_constant_location(kinc_g5_pipeline_t *pipeline, const char *name); /// /// Searches for a texture-declaration and returns a texture-unit which can be used to assign a texture. @@ -148,8 +147,7 @@ KINC_FUNC kinc_g5_constant_location_t kinc_g5_pipeline_get_constant_location(kin /// The pipeline to search in /// The name of the texture-declaration to search for /// The texture-unit of the texture-declaration -KINC_FUNC kinc_g5_texture_unit_t kinc_g5_pipeline_get_texture_unit(kinc_g5_pipeline_t *pipeline, const char *name); -#endif +kinc_g5_texture_unit_t kinc_g5_pipeline_get_texture_unit(kinc_g5_pipeline_t *pipeline, const char *name); #ifdef __cplusplus } diff --git a/sources/kinc/graphics5/raytrace.h b/sources/kinc/graphics5/raytrace.h index 5d86a68f..8078cfaa 100644 --- a/sources/kinc/graphics5/raytrace.h +++ b/sources/kinc/graphics5/raytrace.h @@ -26,25 +26,25 @@ typedef struct kinc_raytrace_pipeline { kinc_raytrace_pipeline_impl_t impl; } kinc_raytrace_pipeline_t; -KINC_FUNC bool kinc_raytrace_supported(void); -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, +bool kinc_raytrace_supported(void); +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); +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, +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, float scale); -KINC_FUNC void kinc_raytrace_acceleration_structure_destroy(kinc_raytrace_acceleration_structure_t *accel); -KINC_FUNC void kinc_raytrace_set_textures(struct kinc_g5_render_target *texpaint0, struct kinc_g5_render_target *texpaint1, struct kinc_g5_render_target *texpaint2, struct kinc_g5_texture *texenv, struct kinc_g5_texture *texsobol, struct kinc_g5_texture *texscramble, struct kinc_g5_texture *texrank); - -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_render_target *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); +void kinc_raytrace_acceleration_structure_destroy(kinc_raytrace_acceleration_structure_t *accel); +void kinc_raytrace_set_textures(struct kinc_g5_render_target *texpaint0, struct kinc_g5_render_target *texpaint1, struct kinc_g5_render_target *texpaint2, struct kinc_g5_texture *texenv, struct kinc_g5_texture *texsobol, struct kinc_g5_texture *texscramble, struct kinc_g5_texture *texrank); + +void kinc_raytrace_set_acceleration_structure(kinc_raytrace_acceleration_structure_t *accel); +void kinc_raytrace_set_pipeline(kinc_raytrace_pipeline_t *pipeline); +void kinc_raytrace_set_target(struct kinc_g5_render_target *output); +void kinc_raytrace_dispatch_rays(struct kinc_g5_command_list *command_list); +void kinc_raytrace_copy(struct kinc_g5_command_list *command_list, struct kinc_g5_render_target *target, struct kinc_g5_texture *source); #ifdef __cplusplus } diff --git a/sources/kinc/graphics5/rendertarget.h b/sources/kinc/graphics5/rendertarget.h index c3cf2dc2..0206e18a 100644 --- a/sources/kinc/graphics5/rendertarget.h +++ b/sources/kinc/graphics5/rendertarget.h @@ -45,7 +45,7 @@ typedef struct kinc_g5_render_target { /// /// /// -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, +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); /// @@ -59,7 +59,7 @@ KINC_FUNC void kinc_g5_render_target_init(kinc_g5_render_target_t *target, int w /// /// /// -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, +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); /// @@ -72,7 +72,7 @@ KINC_FUNC void kinc_g5_render_target_init_with_multisampling(kinc_g5_render_targ /// /// /// -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, +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); /// @@ -86,7 +86,7 @@ KINC_FUNC void kinc_g5_render_target_init_framebuffer(kinc_g5_render_target_t *t /// /// /// -KINC_FUNC void kinc_g5_render_target_init_framebuffer_with_multisampling(kinc_g5_render_target_t *target, int width, int height, +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); @@ -99,7 +99,7 @@ KINC_FUNC void kinc_g5_render_target_init_framebuffer_with_multisampling(kinc_g5 /// /// /// -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, +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); /// @@ -112,14 +112,14 @@ KINC_FUNC void kinc_g5_render_target_init_cube(kinc_g5_render_target_t *target, /// /// /// -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, +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); /// /// Deallocates and destroys a render-target. /// /// The render-target to destroy -KINC_FUNC void kinc_g5_render_target_destroy(kinc_g5_render_target_t *target); +void kinc_g5_render_target_destroy(kinc_g5_render_target_t *target); /// /// Copies the depth and stencil-components of one render-target into another one. @@ -127,7 +127,7 @@ KINC_FUNC void kinc_g5_render_target_destroy(kinc_g5_render_target_t *target); /// The render-target to copy the data into /// The render-target from which to copy the data /// -KINC_FUNC void kinc_g5_render_target_set_depth_stencil_from(kinc_g5_render_target_t *target, kinc_g5_render_target_t *source); +void kinc_g5_render_target_set_depth_stencil_from(kinc_g5_render_target_t *target, kinc_g5_render_target_t *source); #ifdef __cplusplus } diff --git a/sources/kinc/graphics5/sampler.h b/sources/kinc/graphics5/sampler.h index bad5c8af..314ec896 100644 --- a/sources/kinc/graphics5/sampler.h +++ b/sources/kinc/graphics5/sampler.h @@ -56,7 +56,7 @@ typedef struct kinc_g5_sampler { /// Initializes the passed options-object with the default-options. /// /// The options-object for which the default-options will be set -KINC_FUNC void kinc_g5_sampler_options_set_defaults(kinc_g5_sampler_options_t *options); +void kinc_g5_sampler_options_set_defaults(kinc_g5_sampler_options_t *options); /// /// Creates a sampler-object. @@ -65,13 +65,13 @@ KINC_FUNC void kinc_g5_sampler_options_set_defaults(kinc_g5_sampler_options_t *o /// /// Pointer to the sampler object to initialize /// Options for the sampler -KINC_FUNC void kinc_g5_sampler_init(kinc_g5_sampler_t *sampler, const kinc_g5_sampler_options_t *options); +void kinc_g5_sampler_init(kinc_g5_sampler_t *sampler, const kinc_g5_sampler_options_t *options); /// /// Destroys a sampler-object. /// /// The sampler-object to destroy -KINC_FUNC void kinc_g5_sampler_destroy(kinc_g5_sampler_t *sampler); +void kinc_g5_sampler_destroy(kinc_g5_sampler_t *sampler); #ifdef __cplusplus } diff --git a/sources/kinc/graphics5/shader.h b/sources/kinc/graphics5/shader.h index 0e928f05..6db74d25 100644 --- a/sources/kinc/graphics5/shader.h +++ b/sources/kinc/graphics5/shader.h @@ -37,13 +37,13 @@ typedef struct kinc_g5_shader { /// The system-specific shader-data /// The length of the system-specific shader-data in bytes /// The type of the shader -KINC_FUNC void kinc_g5_shader_init(kinc_g5_shader_t *shader, const void *source, size_t length, kinc_g5_shader_type_t type); +void kinc_g5_shader_init(kinc_g5_shader_t *shader, const void *source, size_t length, kinc_g5_shader_type_t type); /// /// Destroys a shader. /// /// The shader to destroy -KINC_FUNC void kinc_g5_shader_destroy(kinc_g5_shader_t *shader); +void kinc_g5_shader_destroy(kinc_g5_shader_t *shader); #ifdef __cplusplus } diff --git a/sources/kinc/graphics5/texture.h b/sources/kinc/graphics5/texture.h index 59b48a9d..4cdd0c30 100644 --- a/sources/kinc/graphics5/texture.h +++ b/sources/kinc/graphics5/texture.h @@ -30,7 +30,7 @@ typedef struct kinc_g5_texture { /// The width of the texture to create /// The height of the texture to create /// The format of the texture to create -KINC_FUNC void kinc_g5_texture_init(kinc_g5_texture_t *texture, int width, int height, kinc_image_format_t format); +void kinc_g5_texture_init(kinc_g5_texture_t *texture, int width, int height, kinc_image_format_t format); /// /// Allocates and initializes a 3d-texture without copying any data into it. @@ -40,41 +40,41 @@ KINC_FUNC void kinc_g5_texture_init(kinc_g5_texture_t *texture, int width, int h /// The height of the texture to create /// The depth of the texture to create /// The format of the texture to create -KINC_FUNC void kinc_g5_texture_init3d(kinc_g5_texture_t *texture, int width, int height, int depth, kinc_image_format_t format); +void kinc_g5_texture_init3d(kinc_g5_texture_t *texture, int width, int height, int depth, kinc_image_format_t format); /// /// Allocates and initializes a texture and copies image-data into it. /// /// The texture to initialize /// The image which's data is copied into the texture -KINC_FUNC void kinc_g5_texture_init_from_image(kinc_g5_texture_t *texture, kinc_image_t *image); +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); +void kinc_g5_texture_init_non_sampled_access(kinc_g5_texture_t *texture, int width, int height, kinc_image_format_t format); /// /// Deallocates and destroys a texture. /// /// The texture to destroy -KINC_FUNC void kinc_g5_texture_destroy(kinc_g5_texture_t *texture); +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); +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); +uint8_t *kinc_g5_texture_lock(kinc_g5_texture_t *texture); -KINC_FUNC void kinc_g5_texture_unlock(kinc_g5_texture_t *texture); +void kinc_g5_texture_unlock(kinc_g5_texture_t *texture); /// /// Clears parts of a texture to a color. /// -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); +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); +void kinc_g5_texture_upload(kinc_g5_texture_t *texture, uint8_t *data); #endif /// @@ -82,16 +82,16 @@ KINC_FUNC void kinc_g5_texture_upload(kinc_g5_texture_t *texture, uint8_t *data) /// /// The render-target to create the mipmaps for /// The number of mipmap-levels to generate -KINC_FUNC void kinc_g5_texture_generate_mipmaps(kinc_g5_texture_t *texture, int levels); +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); +void kinc_g5_texture_set_mipmap(kinc_g5_texture_t *texture, kinc_image_t *mipmap, int level); /// /// Returns the stride of the first mipmap-layer of the texture in bytes. /// /// The texture to figure out the stride for /// The stride of the first mipmap-layer in bytes -KINC_FUNC int kinc_g5_texture_stride(kinc_g5_texture_t *texture); +int kinc_g5_texture_stride(kinc_g5_texture_t *texture); #ifdef __cplusplus } diff --git a/sources/kinc/graphics5/vertexbuffer.h b/sources/kinc/graphics5/vertexbuffer.h index 3e92ece7..4fca070b 100644 --- a/sources/kinc/graphics5/vertexbuffer.h +++ b/sources/kinc/graphics5/vertexbuffer.h @@ -26,21 +26,21 @@ typedef struct kinc_g5_vertex_buffer { /// The structure of the buffer /// If true, the vertex-buffer will reside in gpu-memory which will make it slower to update but faster to use /// The step-rate for instanced-rendering - use 0 if instanced-rendering will not be used with this buffer -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, +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); /// /// Destroys a vertex-buffer. /// /// The buffer to destroy -KINC_FUNC void kinc_g5_vertex_buffer_destroy(kinc_g5_vertex_buffer_t *buffer); +void kinc_g5_vertex_buffer_destroy(kinc_g5_vertex_buffer_t *buffer); /// /// Locks all of a vertex-buffer to modify its contents. /// /// The buffer to lock /// The contents of the buffer -KINC_FUNC float *kinc_g5_vertex_buffer_lock_all(kinc_g5_vertex_buffer_t *buffer); +float *kinc_g5_vertex_buffer_lock_all(kinc_g5_vertex_buffer_t *buffer); /// /// Locks part of a vertex-buffer to modify its contents. @@ -49,34 +49,34 @@ KINC_FUNC float *kinc_g5_vertex_buffer_lock_all(kinc_g5_vertex_buffer_t *buffer) /// The index of the first vertex to lock /// The number of vertices to lock /// The contents of the buffer, starting at start -KINC_FUNC float *kinc_g5_vertex_buffer_lock(kinc_g5_vertex_buffer_t *buffer, int start, int count); +float *kinc_g5_vertex_buffer_lock(kinc_g5_vertex_buffer_t *buffer, int start, int count); /// /// Unlock all of a vertex-buffer so the changed contents can be used. /// /// The buffer to unlock -KINC_FUNC void kinc_g5_vertex_buffer_unlock_all(kinc_g5_vertex_buffer_t *buffer); +void kinc_g5_vertex_buffer_unlock_all(kinc_g5_vertex_buffer_t *buffer); /// /// Unlocks part of a vertex-buffer so the changed contents can be used. /// /// The buffer to unlock /// The number of vertices to unlock, starting from the start-vertex from the previous lock-call -KINC_FUNC void kinc_g5_vertex_buffer_unlock(kinc_g5_vertex_buffer_t *buffer, int count); +void kinc_g5_vertex_buffer_unlock(kinc_g5_vertex_buffer_t *buffer, int count); /// /// Returns the number of vertices in a buffer. /// /// The buffer to figure out the number of vertices for /// The number of vertices -KINC_FUNC int kinc_g5_vertex_buffer_count(kinc_g5_vertex_buffer_t *buffer); +int kinc_g5_vertex_buffer_count(kinc_g5_vertex_buffer_t *buffer); /// /// Returns the stride aka the size of one vertex of the buffer in bytes. /// /// The buffer to figure out the stride for /// The stride of the buffer in bytes -KINC_FUNC int kinc_g5_vertex_buffer_stride(kinc_g5_vertex_buffer_t *buffer); +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); diff --git a/sources/kinc/image.h b/sources/kinc/image.h index a9b4dffb..3d70c295 100644 --- a/sources/kinc/image.h +++ b/sources/kinc/image.h @@ -53,25 +53,25 @@ typedef struct kinc_image_read_callbacks { /// Creates a 2D kinc_image in the provided memory. /// /// The size that's occupied by the image in memory in bytes -KINC_FUNC size_t kinc_image_init(kinc_image_t *image, void *memory, int width, int height, kinc_image_format_t format); +size_t kinc_image_init(kinc_image_t *image, void *memory, int width, int height, kinc_image_format_t format); /// /// Creates a 3D kinc_image in the provided memory. /// /// The size that's occupied by the image in memory in bytes -KINC_FUNC size_t kinc_image_init3d(kinc_image_t *image, void *memory, int width, int height, int depth, kinc_image_format_t format); +size_t kinc_image_init3d(kinc_image_t *image, void *memory, int width, int height, int depth, kinc_image_format_t format); /// /// Peeks into an image file and figures out the size it will occupy in memory. /// /// The memory size in bytes that will be used when loading the image -KINC_FUNC size_t kinc_image_size_from_file(const char *filename); +size_t kinc_image_size_from_file(const char *filename); /// /// Peeks into an image that is loaded via callback functions and figures out the size it will occupy in memory. /// /// The memory size in bytes that will be used when loading the image -KINC_FUNC size_t kinc_image_size_from_callbacks(kinc_image_read_callbacks_t callbacks, void *user_data, const char *format); +size_t kinc_image_size_from_callbacks(kinc_image_read_callbacks_t callbacks, void *user_data, const char *format); /// /// Peeks into an image file that resides in memory and figures out the size it will occupy in memory once it is uncompressed. @@ -80,64 +80,64 @@ KINC_FUNC size_t kinc_image_size_from_callbacks(kinc_image_read_callbacks_t call /// The size of the encoded data /// Something like "png" can help, it also works to just put in the filename /// The memory size in bytes that will be used when loading the image -KINC_FUNC size_t kinc_image_size_from_encoded_bytes(void *data, size_t data_size, const char *format_hint); +size_t kinc_image_size_from_encoded_bytes(void *data, size_t data_size, const char *format_hint); /// /// Loads an image from a file. /// /// The memory size in bytes that will be used when loading the image -KINC_FUNC size_t kinc_image_init_from_file(kinc_image_t *image, void *memory, const char *filename); +size_t kinc_image_init_from_file(kinc_image_t *image, void *memory, const char *filename); /// /// Loads an image file using callbacks. /// /// The memory size in bytes that will be used when loading the image -KINC_FUNC size_t kinc_image_init_from_callbacks(kinc_image_t *image, void *memory, kinc_image_read_callbacks_t callbacks, void *user_data, const char *format); +size_t kinc_image_init_from_callbacks(kinc_image_t *image, void *memory, kinc_image_read_callbacks_t callbacks, void *user_data, const char *format); /// /// Loads an image file from a memory. /// /// The memory size in bytes that will be used when loading the image -KINC_FUNC size_t kinc_image_init_from_encoded_bytes(kinc_image_t *image, void *memory, void *data, size_t data_size, const char *format); +size_t kinc_image_init_from_encoded_bytes(kinc_image_t *image, void *memory, void *data, size_t data_size, const char *format); /// /// Creates a 2D image from memory. /// -KINC_FUNC void kinc_image_init_from_bytes(kinc_image_t *image, void *data, int width, int height, kinc_image_format_t format); +void kinc_image_init_from_bytes(kinc_image_t *image, void *data, int width, int height, kinc_image_format_t format); /// /// Creates a 3D image from memory. /// -KINC_FUNC void kinc_image_init_from_bytes3d(kinc_image_t *image, void *data, int width, int height, int depth, kinc_image_format_t format); +void kinc_image_init_from_bytes3d(kinc_image_t *image, void *data, int width, int height, int depth, kinc_image_format_t format); /// /// Destroys an image. This does not free the user-provided memory. /// -KINC_FUNC void kinc_image_destroy(kinc_image_t *image); +void kinc_image_destroy(kinc_image_t *image); /// /// Gets the color value of a 32 bit pixel. If this doesn't fit the format of the image please use kinc_image_at_raw instead. /// /// One 32 bit color value -KINC_FUNC uint32_t kinc_image_at(kinc_image_t *image, int x, int y); +uint32_t kinc_image_at(kinc_image_t *image, int x, int y); /// /// Gets a pointer to the color-data of one pixel. /// /// A pointer to the color-data of the pixel pointed to by x and y -KINC_FUNC void *kinc_image_at_raw(kinc_image_t *image, int x, int y); +void *kinc_image_at_raw(kinc_image_t *image, int x, int y); /// /// Provides access to the image data. /// /// A pointer to the image data -KINC_FUNC uint8_t *kinc_image_get_pixels(kinc_image_t *image); +uint8_t *kinc_image_get_pixels(kinc_image_t *image); /// /// Gets the size in bytes of a single pixel for a given image format. /// /// The size of one pixel in bytes -KINC_FUNC int kinc_image_format_sizeof(kinc_image_format_t format); +int kinc_image_format_sizeof(kinc_image_format_t format); #ifdef KINC_IMPLEMENTATION_ROOT #define KINC_IMPLEMENTATION @@ -164,7 +164,7 @@ KINC_FUNC int kinc_image_format_sizeof(kinc_image_format_t format); #include -#define BUFFER_SIZE 4096 * 4096 * 4 +#define BUFFER_SIZE 1024 * 1024 * 4 static uint8_t buffer[BUFFER_SIZE]; static size_t buffer_offset = 0; static uint8_t *last_allocated_pointer = 0; diff --git a/sources/kinc/input/acceleration.h b/sources/kinc/input/acceleration.h index d924d87d..d01069d1 100644 --- a/sources/kinc/input/acceleration.h +++ b/sources/kinc/input/acceleration.h @@ -14,7 +14,7 @@ extern "C" { /// Sets the acceleration-callback which is called with measured acceleration-data in three dimensions. /// /// The callback -KINC_FUNC void kinc_acceleration_set_callback(void (*value)(float /*x*/, float /*y*/, float /*z*/)); +void kinc_acceleration_set_callback(void (*value)(float /*x*/, float /*y*/, float /*z*/)); void kinc_internal_on_acceleration(float x, float y, float z); diff --git a/sources/kinc/input/gamepad.h b/sources/kinc/input/gamepad.h index d2583ce7..0f54961a 100644 --- a/sources/kinc/input/gamepad.h +++ b/sources/kinc/input/gamepad.h @@ -17,49 +17,49 @@ extern "C" { /// /// The callback /// Userdata you will receive back as the 2nd callback parameter -KINC_FUNC void kinc_gamepad_set_connect_callback(void (*value)(int /*gamepad*/, void * /*userdata*/), void *userdata); +void kinc_gamepad_set_connect_callback(void (*value)(int /*gamepad*/, void * /*userdata*/), void *userdata); /// /// Sets the gamepad-disconnect-callback which is called when a gamepad is disconnected. /// /// The callback /// Userdata you will receive back as the 2nd callback parameter -KINC_FUNC void kinc_gamepad_set_disconnect_callback(void (*value)(int /*gamepad*/, void * /*userdata*/), void *userdata); +void kinc_gamepad_set_disconnect_callback(void (*value)(int /*gamepad*/, void * /*userdata*/), void *userdata); /// /// Sets the gamepad-axis-callback which is called with data about changing gamepad-sticks. /// /// The callback /// Userdata you will receive back as the 4th callback parameter -KINC_FUNC void kinc_gamepad_set_axis_callback(void (*value)(int /*gamepad*/, int /*axis*/, float /*value*/, void * /*userdata*/), void *userdata); +void kinc_gamepad_set_axis_callback(void (*value)(int /*gamepad*/, int /*axis*/, float /*value*/, void * /*userdata*/), void *userdata); /// /// Sets the gamepad-button-callback which is called with data about changing gamepad-buttons. /// /// The callback /// Userdata you will receive back as the 4th callback parameter -KINC_FUNC void kinc_gamepad_set_button_callback(void (*value)(int /*gamepad*/, int /*button*/, float /*value*/, void * /*userdata*/), void *userdata); +void kinc_gamepad_set_button_callback(void (*value)(int /*gamepad*/, int /*button*/, float /*value*/, void * /*userdata*/), void *userdata); /// /// Returns a vendor-name for a gamepad. /// /// The index of the gamepad for which to receive the vendor-name /// The vendor-name -KINC_FUNC const char *kinc_gamepad_vendor(int gamepad); +const char *kinc_gamepad_vendor(int gamepad); /// /// Returns a name for a gamepad. /// /// The index of the gamepad for which to receive the name /// The gamepad's name -KINC_FUNC const char *kinc_gamepad_product_name(int gamepad); +const char *kinc_gamepad_product_name(int gamepad); /// /// Checks whether a gamepad is connected. /// /// The index of the gamepad which's connection will be checked /// Whether a gamepad is connected for the gamepad-index -KINC_FUNC bool kinc_gamepad_connected(int gamepad); +bool kinc_gamepad_connected(int gamepad); /// /// Rumbles a gamepad. Careful here because it might just fall off your table. @@ -67,7 +67,7 @@ KINC_FUNC bool kinc_gamepad_connected(int gamepad); /// The index of the gamepad to rumble /// Rumble-strength for the left motor between 0 and 1 /// Rumble-strength for the right motor between 0 and 1 -KINC_FUNC void kinc_gamepad_rumble(int gamepad, float left, float right); +void kinc_gamepad_rumble(int gamepad, float left, float right); void kinc_internal_gamepad_trigger_connect(int gamepad); void kinc_internal_gamepad_trigger_disconnect(int gamepad); diff --git a/sources/kinc/input/keyboard.h b/sources/kinc/input/keyboard.h index 788f845c..14c90752 100644 --- a/sources/kinc/input/keyboard.h +++ b/sources/kinc/input/keyboard.h @@ -201,38 +201,38 @@ extern "C" { /// /// Show the keyboard if the system is using a software-keyboard. /// -KINC_FUNC void kinc_keyboard_show(void); +void kinc_keyboard_show(void); /// /// Hide the keyboard if the system is using a software-keyboard. /// -KINC_FUNC void kinc_keyboard_hide(void); +void kinc_keyboard_hide(void); /// /// Figure out whether the keyboard is currently shown if the system is using a software-keyboard. /// /// Whether the keyboard is currently shown -KINC_FUNC bool kinc_keyboard_active(void); +bool kinc_keyboard_active(void); /// /// Sets the keyboard-key-down-callback which is called with a key-code when a key goes down. Do not use this for text-input, that's what the key-press-callback /// is here for. /// /// The callback -KINC_FUNC void kinc_keyboard_set_key_down_callback(void (*value)(int /*key_code*/, void * /*data*/), void *data); +void kinc_keyboard_set_key_down_callback(void (*value)(int /*key_code*/, void * /*data*/), void *data); /// /// Sets the keyboard-key-up-callback which is called with a key-code when a key goes up. Do not use this for text-input, that's what the key-press-callback is /// here for. /// /// The callback -KINC_FUNC void kinc_keyboard_set_key_up_callback(void (*value)(int /*key_code*/, void * /*data*/), void *data); +void kinc_keyboard_set_key_up_callback(void (*value)(int /*key_code*/, void * /*data*/), void *data); /// /// Sets the keyboard-key-press-callback which is called when the system decides that a character came in via the keyboard. Use this for text-input. /// /// The callback -KINC_FUNC void kinc_keyboard_set_key_press_callback(void (*value)(unsigned /*character*/, void * /*data*/), void *data); +void kinc_keyboard_set_key_press_callback(void (*value)(unsigned /*character*/, void * /*data*/), void *data); void kinc_internal_keyboard_trigger_key_down(int key_code); void kinc_internal_keyboard_trigger_key_up(int key_code); diff --git a/sources/kinc/input/mouse.h b/sources/kinc/input/mouse.h index 3fec1813..6a4b3772 100644 --- a/sources/kinc/input/mouse.h +++ b/sources/kinc/input/mouse.h @@ -26,7 +26,7 @@ extern "C" { /// but can contain higher values on certain platforms when mice with a lot of buttons are used. /// /// The callback -KINC_FUNC void kinc_mouse_set_press_callback(void (*value)(int /*window*/, int /*button*/, int /*x*/, int /*y*/, void * /*data*/), void *data); +void kinc_mouse_set_press_callback(void (*value)(int /*window*/, int /*button*/, int /*x*/, int /*y*/, void * /*data*/), void *data); /// /// Sets the mouse-release-callback which is called when a mouse-button is released. @@ -34,73 +34,73 @@ KINC_FUNC void kinc_mouse_set_press_callback(void (*value)(int /*window*/, int / /// but can contain higher values on certain platforms when mice with a lot of buttons are used. /// /// The callback -KINC_FUNC void kinc_mouse_set_release_callback(void (*value)(int /*window*/, int /*button*/, int /*x*/, int /*y*/, void * /*data*/), void *data); +void kinc_mouse_set_release_callback(void (*value)(int /*window*/, int /*button*/, int /*x*/, int /*y*/, void * /*data*/), void *data); /// /// Sets the mouse-move-callback which is called when the mouse is moved. /// /// The callback -KINC_FUNC void kinc_mouse_set_move_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, int /*movement_x*/, int /*movement_y*/, void * /*data*/), +void kinc_mouse_set_move_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, int /*movement_x*/, int /*movement_y*/, void * /*data*/), void *data); /// /// Sets the mouse-scroll-callback which is called when the mouse wheel is spinning. /// /// The callback -KINC_FUNC void kinc_mouse_set_scroll_callback(void (*value)(int /*window*/, int /*delta*/, void * /*data*/), void *data); +void kinc_mouse_set_scroll_callback(void (*value)(int /*window*/, int /*delta*/, void * /*data*/), void *data); /// /// Sets the mouse-enter-window-callback which is called when the mouse-cursor enters the application-window. /// /// The callback -KINC_FUNC void kinc_mouse_set_enter_window_callback(void (*value)(int /*window*/, void * /*data*/), void *data); +void kinc_mouse_set_enter_window_callback(void (*value)(int /*window*/, void * /*data*/), void *data); /// /// Sets the mouse-leave-window-callback which is called when the mouse-cursor leaves the application-window. /// /// The callback -KINC_FUNC void kinc_mouse_set_leave_window_callback(void (*value)(int /*window*/, void * /*data*/), void *data); +void kinc_mouse_set_leave_window_callback(void (*value)(int /*window*/, void * /*data*/), void *data); /// /// Figures out whether mouse-locking is supported. /// /// Whether mouse-locking is supported -KINC_FUNC bool kinc_mouse_can_lock(void); +bool kinc_mouse_can_lock(void); /// /// Figures out whether the mouse is currently locked. /// /// Whether the mouse is currently locked -KINC_FUNC bool kinc_mouse_is_locked(void); +bool kinc_mouse_is_locked(void); /// /// Locks the mouse to a window. /// /// The window to lock the mouse to -KINC_FUNC void kinc_mouse_lock(int window); +void kinc_mouse_lock(int window); /// /// Unlocks the mouse. /// /// /// -KINC_FUNC void kinc_mouse_unlock(void); +void kinc_mouse_unlock(void); /// /// Change the cursor-image to something that's semi-randomly based on the provided int. /// /// Defines what the cursor is changed to - somehow -KINC_FUNC void kinc_mouse_set_cursor(int cursor); +void kinc_mouse_set_cursor(int cursor); /// /// Shows the mouse-cursor. /// -KINC_FUNC void kinc_mouse_show(void); +void kinc_mouse_show(void); /// /// Hides the mouse-cursor. /// -KINC_FUNC void kinc_mouse_hide(void); +void kinc_mouse_hide(void); /// /// Manually sets the mouse-cursor-position. @@ -108,7 +108,7 @@ KINC_FUNC void kinc_mouse_hide(void); /// The window to place the cursor in /// The x-position inside the window to place the cursor at /// The y-position inside the window to place the cursor at -KINC_FUNC void kinc_mouse_set_position(int window, int x, int y); +void kinc_mouse_set_position(int window, int x, int y); /// /// Gets the current mouse-position relative to a window. @@ -116,7 +116,7 @@ KINC_FUNC void kinc_mouse_set_position(int window, int x, int y); /// The window to base the returned position on /// A pointer where the cursor's x-position is put into /// A pointer where the cursor's y-position is put into -KINC_FUNC void kinc_mouse_get_position(int window, int *x, int *y); +void kinc_mouse_get_position(int window, int *x, int *y); void kinc_internal_mouse_trigger_press(int window, int button, int x, int y); void kinc_internal_mouse_trigger_release(int window, int button, int x, int y); diff --git a/sources/kinc/input/pen.h b/sources/kinc/input/pen.h index a20e1e27..70dd9cb7 100644 --- a/sources/kinc/input/pen.h +++ b/sources/kinc/input/pen.h @@ -14,37 +14,37 @@ extern "C" { /// Sets the pen-press-callback which is called when the pen is touching the drawing-surface. /// /// The callback -KINC_FUNC void kinc_pen_set_press_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/)); +void kinc_pen_set_press_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/)); /// /// Sets the pen-move-callback which is called when the pen is moved. /// /// The callback -KINC_FUNC void kinc_pen_set_move_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/)); +void kinc_pen_set_move_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/)); /// /// Sets the pen-release-callback which is called when the pen is moved away from the drawing-surface. /// /// The callback -KINC_FUNC void kinc_pen_set_release_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/)); +void kinc_pen_set_release_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/)); /// /// Sets the eraser-press-callback which is called when the pen is touching the drawing-surface in eraser-mode. /// /// The callback -KINC_FUNC void kinc_eraser_set_press_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/)); +void kinc_eraser_set_press_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/)); /// /// Sets the eraser-move-callback which is called when the pen is moved while in eraser-mode. /// /// The callback -KINC_FUNC void kinc_eraser_set_move_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/)); +void kinc_eraser_set_move_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/)); /// /// Sets the eraser-release-callback which is called when the pen is moved away from the drawing-surface when in eraser-mode. /// /// The callback -KINC_FUNC void kinc_eraser_set_release_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/)); +void kinc_eraser_set_release_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/)); void kinc_internal_pen_trigger_move(int window, int x, int y, float pressure); void kinc_internal_pen_trigger_press(int window, int x, int y, float pressure); diff --git a/sources/kinc/input/rotation.h b/sources/kinc/input/rotation.h index 7a715be7..bfab4471 100644 --- a/sources/kinc/input/rotation.h +++ b/sources/kinc/input/rotation.h @@ -14,7 +14,7 @@ extern "C" { /// Sets the rotation-callback which is called when the device is rotated. Act quickly when this is called for a desktop-system. /// /// The callback -KINC_FUNC void kinc_rotation_set_callback(void (*value)(float /*x*/, float /*y*/, float /*z*/)); +void kinc_rotation_set_callback(void (*value)(float /*x*/, float /*y*/, float /*z*/)); void kinc_internal_on_rotation(float x, float y, float z); diff --git a/sources/kinc/input/surface.h b/sources/kinc/input/surface.h index d08c50b2..2cd692b4 100644 --- a/sources/kinc/input/surface.h +++ b/sources/kinc/input/surface.h @@ -14,19 +14,19 @@ extern "C" { /// Sets the surface-touch-start-callback which is called when a finger-touch is detected. /// /// The callback -KINC_FUNC void kinc_surface_set_touch_start_callback(void (*value)(int /*index*/, int /*x*/, int /*y*/)); +void kinc_surface_set_touch_start_callback(void (*value)(int /*index*/, int /*x*/, int /*y*/)); /// /// Sets the surface-move-callback which is called when a finger is moving around. /// /// The callback -KINC_FUNC void kinc_surface_set_move_callback(void (*value)(int /*index*/, int /*x*/, int /*y*/)); +void kinc_surface_set_move_callback(void (*value)(int /*index*/, int /*x*/, int /*y*/)); /// /// Sets the surface-touch-end-callback which is called when a finger disappears. This is usually not a medical emergency. /// /// The callback -KINC_FUNC void kinc_surface_set_touch_end_callback(void (*value)(int /*index*/, int /*x*/, int /*y*/)); +void kinc_surface_set_touch_end_callback(void (*value)(int /*index*/, int /*x*/, int /*y*/)); void kinc_internal_surface_trigger_touch_start(int index, int x, int y); void kinc_internal_surface_trigger_move(int index, int x, int y); diff --git a/sources/kinc/io/filereader.h b/sources/kinc/io/filereader.h index 6b165344..ae6f55d5 100644 --- a/sources/kinc/io/filereader.h +++ b/sources/kinc/io/filereader.h @@ -45,7 +45,7 @@ typedef struct kinc_file_reader { /// A filepath to identify a file /// Looks for a regular file (KINC_FILE_TYPE_ASSET) or a save-file (KINC_FILE_TYPE_SAVE) /// Whether the file could be opened -KINC_FUNC bool kinc_file_reader_open(kinc_file_reader_t *reader, const char *filepath, int type); +bool kinc_file_reader_open(kinc_file_reader_t *reader, const char *filepath, int type); /// /// Opens a memory area for reading using the file reader API. @@ -54,20 +54,20 @@ KINC_FUNC bool kinc_file_reader_open(kinc_file_reader_t *reader, const char *fil /// A pointer to the memory area to read /// The size of the memory area /// This function always returns true -KINC_FUNC bool kinc_file_reader_from_memory(kinc_file_reader_t *reader, void *data, size_t size); +bool kinc_file_reader_from_memory(kinc_file_reader_t *reader, void *data, size_t size); /// /// Registers a file reader callback. /// /// The function to call when opening a file -KINC_FUNC void kinc_file_reader_set_callback(bool (*callback)(kinc_file_reader_t *reader, const char *filename, int type)); +void kinc_file_reader_set_callback(bool (*callback)(kinc_file_reader_t *reader, const char *filename, int type)); /// /// Closes a file. /// /// The file to close /// Whether the file could be closed -KINC_FUNC bool kinc_file_reader_close(kinc_file_reader_t *reader); +bool kinc_file_reader_close(kinc_file_reader_t *reader); /// /// Reads data from a file starting from the current reading-position and increases the reading-position accordingly. @@ -76,21 +76,21 @@ KINC_FUNC bool kinc_file_reader_close(kinc_file_reader_t *reader); /// A pointer to write the data to /// The amount of data to read in bytes /// The number of bytes that were read - can be less than size if there is not enough data in the file -KINC_FUNC size_t kinc_file_reader_read(kinc_file_reader_t *reader, void *data, size_t size); +size_t kinc_file_reader_read(kinc_file_reader_t *reader, void *data, size_t size); /// /// Figures out the size of a file. /// /// The reader which's file-size to figure out /// The size in bytes -KINC_FUNC size_t kinc_file_reader_size(kinc_file_reader_t *reader); +size_t kinc_file_reader_size(kinc_file_reader_t *reader); /// /// Figures out the current reading-position in the file. /// /// The reader which's reading-position to figure out /// The current reading-position -KINC_FUNC size_t kinc_file_reader_pos(kinc_file_reader_t *reader); +size_t kinc_file_reader_pos(kinc_file_reader_t *reader); /// /// Sets the reading-position manually. @@ -98,87 +98,87 @@ KINC_FUNC size_t kinc_file_reader_pos(kinc_file_reader_t *reader); /// The reader which's reading-position to set /// The reading-position to set /// Whether the reading position could be set -KINC_FUNC bool kinc_file_reader_seek(kinc_file_reader_t *reader, size_t pos); +bool kinc_file_reader_seek(kinc_file_reader_t *reader, size_t pos); /// /// Interprets four bytes starting at the provided pointer as a little-endian float. /// -KINC_FUNC float kinc_read_f32le(uint8_t *data); +float kinc_read_f32le(uint8_t *data); /// /// Interprets four bytes starting at the provided pointer as a big-endian float. /// -KINC_FUNC float kinc_read_f32be(uint8_t *data); +float kinc_read_f32be(uint8_t *data); /// /// Interprets eight bytes starting at the provided pointer as a little-endian uint64. /// -KINC_FUNC uint64_t kinc_read_u64le(uint8_t *data); +uint64_t kinc_read_u64le(uint8_t *data); /// /// Interprets eight bytes starting at the provided pointer as a big-endian uint64. /// -KINC_FUNC uint64_t kinc_read_u64be(uint8_t *data); +uint64_t kinc_read_u64be(uint8_t *data); /// /// Interprets eight bytes starting at the provided pointer as a little-endian int64. /// -KINC_FUNC int64_t kinc_read_s64le(uint8_t *data); +int64_t kinc_read_s64le(uint8_t *data); /// /// Interprets eight bytes starting at the provided pointer as a big-endian int64. /// -KINC_FUNC int64_t kinc_read_s64be(uint8_t *data); +int64_t kinc_read_s64be(uint8_t *data); /// /// Interprets four bytes starting at the provided pointer as a little-endian uint32. /// -KINC_FUNC uint32_t kinc_read_u32le(uint8_t *data); +uint32_t kinc_read_u32le(uint8_t *data); /// /// Interprets four bytes starting at the provided pointer as a big-endian uint32. /// -KINC_FUNC uint32_t kinc_read_u32be(uint8_t *data); +uint32_t kinc_read_u32be(uint8_t *data); /// /// Interprets four bytes starting at the provided pointer as a little-endian int32. /// -KINC_FUNC int32_t kinc_read_s32le(uint8_t *data); +int32_t kinc_read_s32le(uint8_t *data); /// /// Interprets four bytes starting at the provided pointer as a big-endian int32. /// -KINC_FUNC int32_t kinc_read_s32be(uint8_t *data); +int32_t kinc_read_s32be(uint8_t *data); /// /// Interprets two bytes starting at the provided pointer as a little-endian uint16. /// -KINC_FUNC uint16_t kinc_read_u16le(uint8_t *data); +uint16_t kinc_read_u16le(uint8_t *data); /// /// Interprets two bytes starting at the provided pointer as a big-endian uint16. /// -KINC_FUNC uint16_t kinc_read_u16be(uint8_t *data); +uint16_t kinc_read_u16be(uint8_t *data); /// /// Interprets two bytes starting at the provided pointer as a little-endian int16. /// -KINC_FUNC int16_t kinc_read_s16le(uint8_t *data); +int16_t kinc_read_s16le(uint8_t *data); /// /// Interprets two bytes starting at the provided pointer as a big-endian int16. /// -KINC_FUNC int16_t kinc_read_s16be(uint8_t *data); +int16_t kinc_read_s16be(uint8_t *data); /// /// Interprets one byte starting at the provided pointer as a uint8. /// -KINC_FUNC uint8_t kinc_read_u8(uint8_t *data); +uint8_t kinc_read_u8(uint8_t *data); /// /// Interprets one byte starting at the provided pointer as an int8. /// -KINC_FUNC int8_t kinc_read_s8(uint8_t *data); +int8_t kinc_read_s8(uint8_t *data); void kinc_internal_set_files_location(char *dir); char *kinc_internal_get_files_location(void); @@ -248,7 +248,7 @@ const char *iphonegetresourcepath(void); const char *macgetresourcepath(void); #endif -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) #include #endif @@ -274,10 +274,6 @@ bool kinc_internal_file_reader_callback(kinc_file_reader_t *reader, const char * return file_reader_callback ? file_reader_callback(reader, filename, type) : false; } -#ifdef KINC_WINDOWSAPP -void kinc_internal_uwp_installed_location_path(char *path); -#endif - #if defined(KINC_WINDOWS) static size_t kinc_libc_file_reader_read(kinc_file_reader_t *reader, void *data, size_t size) { DWORD readBytes = 0; @@ -361,11 +357,6 @@ bool kinc_internal_file_reader_open(kinc_file_reader_t *reader, const char *file if (filepath[i] == '/') filepath[i] = '\\'; #endif -#ifdef KINC_WINDOWSAPP - kinc_internal_uwp_installed_location_path(filepath); - strcat(filepath, "\\"); - strcat(filepath, filename); -#endif #if defined(KINC_LINUX) || defined(KINC_ANDROID) if (type == KINC_FILE_TYPE_SAVE) { strcpy(filepath, kinc_internal_save_path()); diff --git a/sources/kinc/io/filewriter.h b/sources/kinc/io/filewriter.h index 68528e64..dd1d5f01 100644 --- a/sources/kinc/io/filewriter.h +++ b/sources/kinc/io/filewriter.h @@ -25,7 +25,7 @@ typedef struct kinc_file_writer { /// The writer to initialize for writing /// A filepath to identify a file /// Whether the file could be opened -KINC_FUNC bool kinc_file_writer_open(kinc_file_writer_t *writer, const char *filepath); +bool kinc_file_writer_open(kinc_file_writer_t *writer, const char *filepath); /// /// Writes data to a file starting from the current writing-position and increases the writing-position accordingly. @@ -33,13 +33,13 @@ KINC_FUNC bool kinc_file_writer_open(kinc_file_writer_t *writer, const char *fil /// The writer to write to /// A pointer to read the data from /// The amount of data to write in bytes -KINC_FUNC void kinc_file_writer_write(kinc_file_writer_t *writer, void *data, int size); +void kinc_file_writer_write(kinc_file_writer_t *writer, void *data, int size); /// /// Closes a file. /// /// The file to close -KINC_FUNC void kinc_file_writer_close(kinc_file_writer_t *writer); +void kinc_file_writer_close(kinc_file_writer_t *writer); #ifdef KINC_IMPLEMENTATION_IO #define KINC_IMPLEMENTATION diff --git a/sources/kinc/log.h b/sources/kinc/log.h index 5117245e..4e56a835 100644 --- a/sources/kinc/log.h +++ b/sources/kinc/log.h @@ -38,7 +38,7 @@ typedef enum { KINC_LOG_LEVEL_INFO, KINC_LOG_LEVEL_WARNING, KINC_LOG_LEVEL_ERROR /// /// The parameter is equivalent to the first printf parameter. /// The parameter is equivalent to the second printf parameter. -KINC_FUNC void kinc_log(kinc_log_level_t log_level, const char *format, ...); +void kinc_log(kinc_log_level_t log_level, const char *format, ...); /// /// Equivalent to kinc_log but uses a va_list parameter @@ -52,7 +52,7 @@ KINC_FUNC void kinc_log(kinc_log_level_t log_level, const char *format, ...); /// /// The parameter is equivalent to the first vprintf parameter. /// The parameter is equivalent to the second vprintf parameter. -KINC_FUNC void kinc_log_args(kinc_log_level_t log_level, const char *format, va_list args); +void kinc_log_args(kinc_log_level_t log_level, const char *format, va_list args); #ifdef KINC_IMPLEMENTATION_ROOT #define KINC_IMPLEMENTATION diff --git a/sources/kinc/math/core.h b/sources/kinc/math/core.h index eab56033..00719481 100644 --- a/sources/kinc/math/core.h +++ b/sources/kinc/math/core.h @@ -14,14 +14,14 @@ extern "C" { #define KINC_PI 3.141592654 #define KINC_TAU 6.283185307 -KINC_FUNC float kinc_cot(float x); -KINC_FUNC float kinc_round(float value); -KINC_FUNC float kinc_abs(float value); -KINC_FUNC float kinc_min(float a, float b); -KINC_FUNC float kinc_max(float a, float b); -KINC_FUNC int kinc_mini(int a, int b); -KINC_FUNC int kinc_maxi(int a, int b); -KINC_FUNC float kinc_clamp(float value, float minValue, float maxValue); +float kinc_cot(float x); +float kinc_round(float value); +float kinc_abs(float value); +float kinc_min(float a, float b); +float kinc_max(float a, float b); +int kinc_mini(int a, int b); +int kinc_maxi(int a, int b); +float kinc_clamp(float value, float minValue, float maxValue); #ifdef KINC_IMPLEMENTATION_MATH #define KINC_IMPLEMENTATION diff --git a/sources/kinc/math/matrix.h b/sources/kinc/math/matrix.h index 925b987f..3df876ab 100644 --- a/sources/kinc/math/matrix.h +++ b/sources/kinc/math/matrix.h @@ -27,16 +27,16 @@ typedef union kinc_matrix3x3 { }; } kinc_matrix3x3_t; -KINC_FUNC float kinc_matrix3x3_get(kinc_matrix3x3_t *matrix, int x, int y); -KINC_FUNC void kinc_matrix3x3_set(kinc_matrix3x3_t *matrix, int x, int y, float value); -KINC_FUNC void kinc_matrix3x3_transpose(kinc_matrix3x3_t *matrix); -KINC_FUNC kinc_matrix3x3_t kinc_matrix3x3_identity(void); -KINC_FUNC kinc_matrix3x3_t kinc_matrix3x3_rotation_x(float alpha); -KINC_FUNC kinc_matrix3x3_t kinc_matrix3x3_rotation_y(float alpha); -KINC_FUNC kinc_matrix3x3_t kinc_matrix3x3_rotation_z(float alpha); -KINC_FUNC kinc_matrix3x3_t kinc_matrix3x3_translation(float x, float y); -KINC_FUNC kinc_matrix3x3_t kinc_matrix3x3_multiply(kinc_matrix3x3_t *a, kinc_matrix3x3_t *b); -KINC_FUNC kinc_vector3_t kinc_matrix3x3_multiply_vector(kinc_matrix3x3_t *a, kinc_vector3_t b); +float kinc_matrix3x3_get(kinc_matrix3x3_t *matrix, int x, int y); +void kinc_matrix3x3_set(kinc_matrix3x3_t *matrix, int x, int y, float value); +void kinc_matrix3x3_transpose(kinc_matrix3x3_t *matrix); +kinc_matrix3x3_t kinc_matrix3x3_identity(void); +kinc_matrix3x3_t kinc_matrix3x3_rotation_x(float alpha); +kinc_matrix3x3_t kinc_matrix3x3_rotation_y(float alpha); +kinc_matrix3x3_t kinc_matrix3x3_rotation_z(float alpha); +kinc_matrix3x3_t kinc_matrix3x3_translation(float x, float y); +kinc_matrix3x3_t kinc_matrix3x3_multiply(kinc_matrix3x3_t *a, kinc_matrix3x3_t *b); +kinc_vector3_t kinc_matrix3x3_multiply_vector(kinc_matrix3x3_t *a, kinc_vector3_t b); typedef union kinc_matrix4x4 { float m[4 * 4]; @@ -60,10 +60,10 @@ typedef union kinc_matrix4x4 { }; } kinc_matrix4x4_t; -KINC_FUNC float kinc_matrix4x4_get(kinc_matrix4x4_t *matrix, int x, int y); -KINC_FUNC void kinc_matrix4x4_set(kinc_matrix4x4_t *matrix, int x, int y, float value); -KINC_FUNC void kinc_matrix4x4_transpose(kinc_matrix4x4_t *matrix); -KINC_FUNC kinc_matrix4x4_t kinc_matrix4x4_multiply(kinc_matrix4x4_t *a, kinc_matrix4x4_t *b); +float kinc_matrix4x4_get(kinc_matrix4x4_t *matrix, int x, int y); +void kinc_matrix4x4_set(kinc_matrix4x4_t *matrix, int x, int y, float value); +void kinc_matrix4x4_transpose(kinc_matrix4x4_t *matrix); +kinc_matrix4x4_t kinc_matrix4x4_multiply(kinc_matrix4x4_t *a, kinc_matrix4x4_t *b); #ifdef KINC_IMPLEMENTATION_MATH #define KINC_IMPLEMENTATION diff --git a/sources/kinc/math/random.h b/sources/kinc/math/random.h index a58342ca..5c9fe6b2 100644 --- a/sources/kinc/math/random.h +++ b/sources/kinc/math/random.h @@ -14,25 +14,25 @@ extern "C" { /// Initializes the randomizer with a seed. This is optional but helpful. /// /// A value which should ideally be pretty random -KINC_FUNC void kinc_random_init(int64_t seed); +void kinc_random_init(int64_t seed); /// /// Returns a random value. /// /// A random value -KINC_FUNC int64_t kinc_random_get(void); +int64_t kinc_random_get(void); /// /// Returns a value between 0 and max (both inclusive). /// /// A random value -KINC_FUNC int64_t kinc_random_get_max(int64_t max); +int64_t kinc_random_get_max(int64_t max); /// /// Returns a value between min and max (both inclusive). /// /// A random value -KINC_FUNC int64_t kinc_random_get_in(int64_t min, int64_t max); +int64_t kinc_random_get_in(int64_t min, int64_t max); #ifdef KINC_IMPLEMENTATION_MATH #define KINC_IMPLEMENTATION diff --git a/sources/kinc/network/http.h b/sources/kinc/network/http.h index ea8ac7a4..58e1804e 100644 --- a/sources/kinc/network/http.h +++ b/sources/kinc/network/http.h @@ -22,7 +22,7 @@ typedef void (*kinc_http_callback_t)(int error, int response, const char *body, /// /// Fires off an http request. /// -KINC_FUNC void kinc_http_request(const char *url, const char *path, const char *data, int port, bool secure, int method, const char *header, +void kinc_http_request(const char *url, const char *path, const char *data, int port, bool secure, int method, const char *header, kinc_http_callback_t callback, void *callbackdata); #ifdef KINC_IMPLEMENTATION_NETWORK diff --git a/sources/kinc/network/socket.h b/sources/kinc/network/socket.h index e53dabb3..511505f2 100644 --- a/sources/kinc/network/socket.h +++ b/sources/kinc/network/socket.h @@ -49,7 +49,7 @@ typedef struct kinc_socket_options { /// Initializes a socket-options-object to the default options /// /// The new default options -KINC_FUNC void kinc_socket_options_set_defaults(kinc_socket_options_t *options); +void kinc_socket_options_set_defaults(kinc_socket_options_t *options); /// /// Initializes a socket-object. To set the host and port use kinc_socket_set. @@ -59,7 +59,7 @@ KINC_FUNC void kinc_socket_options_set_defaults(kinc_socket_options_t *options); /// Protocol will be TCP /// /// The socket to initialize -KINC_FUNC void kinc_socket_init(kinc_socket_t *socket); +void kinc_socket_init(kinc_socket_t *socket); /// /// Sets the sockets properties. @@ -70,13 +70,13 @@ KINC_FUNC void kinc_socket_init(kinc_socket_t *socket); /// The IP-family to use /// The protocol to use /// Whether the socket was set correctly -KINC_FUNC bool kinc_socket_set(kinc_socket_t *socket, const char *host, int port, kinc_socket_family_t family, kinc_socket_protocol_t protocol); +bool kinc_socket_set(kinc_socket_t *socket, const char *host, int port, kinc_socket_family_t family, kinc_socket_protocol_t protocol); /// /// Destroys a socket-object. /// /// The socket to destroy -KINC_FUNC void kinc_socket_destroy(kinc_socket_t *socket); +void kinc_socket_destroy(kinc_socket_t *socket); /// /// Opens a socket-connection. @@ -86,7 +86,7 @@ KINC_FUNC void kinc_socket_destroy(kinc_socket_t *socket); /// The port to use /// The options to use /// Whether the socket-connection could be opened -KINC_FUNC bool kinc_socket_open(kinc_socket_t *socket, kinc_socket_options_t *options); +bool kinc_socket_open(kinc_socket_t *socket, kinc_socket_options_t *options); /// /// For use with non-blocking sockets to try to see if we are connected. @@ -96,20 +96,20 @@ KINC_FUNC bool kinc_socket_open(kinc_socket_t *socket, kinc_socket_options_t *op /// Check if the socket is ready to be read from. /// Check if the socket is ready to be written to. /// Whether the socket-connection can read or write or checks both. -KINC_FUNC bool kinc_socket_select(kinc_socket_t *socket, uint32_t waittime, bool read, bool write); +bool kinc_socket_select(kinc_socket_t *socket, uint32_t waittime, bool read, bool write); /*Typically these are server actions.*/ -KINC_FUNC bool kinc_socket_bind(kinc_socket_t *socket); -KINC_FUNC bool kinc_socket_listen(kinc_socket_t *socket, int backlog); -KINC_FUNC bool kinc_socket_accept(kinc_socket_t *socket, kinc_socket_t *new_socket, unsigned *remote_address, unsigned *remote_port); +bool kinc_socket_bind(kinc_socket_t *socket); +bool kinc_socket_listen(kinc_socket_t *socket, int backlog); +bool kinc_socket_accept(kinc_socket_t *socket, kinc_socket_t *new_socket, unsigned *remote_address, unsigned *remote_port); /*Typically this is a client action.*/ -KINC_FUNC bool kinc_socket_connect(kinc_socket_t *socket); +bool kinc_socket_connect(kinc_socket_t *socket); -KINC_FUNC int kinc_socket_send(kinc_socket_t *socket, const uint8_t *data, int size); -KINC_FUNC int kinc_socket_send_address(kinc_socket_t *socket, unsigned address, int port, const uint8_t *data, int size); -KINC_FUNC int kinc_socket_send_url(kinc_socket_t *socket, const char *url, int port, const uint8_t *data, int size); -KINC_FUNC int kinc_socket_receive(kinc_socket_t *socket, uint8_t *data, int maxSize, unsigned *from_address, unsigned *from_port); +int kinc_socket_send(kinc_socket_t *socket, const uint8_t *data, int size); +int kinc_socket_send_address(kinc_socket_t *socket, unsigned address, int port, const uint8_t *data, int size); +int kinc_socket_send_url(kinc_socket_t *socket, const char *url, int port, const uint8_t *data, int size); +int kinc_socket_receive(kinc_socket_t *socket, uint8_t *data, int maxSize, unsigned *from_address, unsigned *from_port); /// /// Resolves a DNS-entry to an IP and returns its integer representation. @@ -117,7 +117,7 @@ KINC_FUNC int kinc_socket_receive(kinc_socket_t *socket, uint8_t *data, int maxS /// /// /// -KINC_FUNC unsigned kinc_url_to_int(const char *url, int port); +unsigned kinc_url_to_int(const char *url, int port); #ifdef KINC_IMPLEMENTATION_NETWORK #define KINC_IMPLEMENTATION @@ -135,7 +135,7 @@ KINC_FUNC unsigned kinc_url_to_int(const char *url, int port); #include #include -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) // Windows 7 #define WINVER 0x0601 @@ -207,7 +207,7 @@ static EMSCRIPTEN_WEBSOCKET_T bridgeSocket = 0; static int counter = 0; -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) || defined(KINC_POSIX) +#if defined(KINC_WINDOWS) || defined(KINC_POSIX) // Important: Must be cleaned with freeaddrinfo(address) later if the result is 0 in order to prevent memory leaks static int resolveAddress(const char *url, int port, struct addrinfo **result) { struct addrinfo hints = {0}; @@ -222,8 +222,8 @@ static int resolveAddress(const char *url, int port, struct addrinfo **result) { } #endif -KINC_FUNC bool kinc_socket_bind(kinc_socket_t *sock) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) || defined(KINC_POSIX) +bool kinc_socket_bind(kinc_socket_t *sock) { +#if defined(KINC_WINDOWS) || defined(KINC_POSIX) struct sockaddr_in address; address.sin_family = sock->family == KINC_SOCKET_FAMILY_IP4 ? AF_INET : AF_INET6; address.sin_addr.s_addr = sock->host; @@ -238,7 +238,7 @@ KINC_FUNC bool kinc_socket_bind(kinc_socket_t *sock) { #endif } -KINC_FUNC void kinc_socket_options_set_defaults(kinc_socket_options_t *options) { +void kinc_socket_options_set_defaults(kinc_socket_options_t *options) { options->non_blocking = true; options->broadcast = false; options->tcp_no_delay = false; @@ -247,7 +247,7 @@ KINC_FUNC void kinc_socket_options_set_defaults(kinc_socket_options_t *options) void kinc_socket_init(kinc_socket_t *sock) { sock->handle = 0; -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) || defined(KINC_POSIX) +#if defined(KINC_WINDOWS) || defined(KINC_POSIX) sock->host = INADDR_ANY; sock->port = htons((unsigned short)8080); sock->protocol = KINC_SOCKET_PROTOCOL_TCP; @@ -255,7 +255,7 @@ void kinc_socket_init(kinc_socket_t *sock) { #endif sock->connected = false; -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) if (counter == 0) { WSADATA WsaData; WSAStartup(MAKEWORD(2, 2), &WsaData); @@ -276,7 +276,7 @@ void kinc_socket_init(kinc_socket_t *sock) { } bool kinc_socket_open(kinc_socket_t *sock, struct kinc_socket_options *options) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) || defined(KINC_POSIX) +#if defined(KINC_WINDOWS) || defined(KINC_POSIX) switch (sock->protocol) { case KINC_SOCKET_PROTOCOL_UDP: sock->handle = socket(sock->family == KINC_SOCKET_FAMILY_IP4 ? AF_INET : AF_INET6, SOCK_DGRAM, IPPROTO_UDP); @@ -291,7 +291,7 @@ bool kinc_socket_open(kinc_socket_t *sock, struct kinc_socket_options *options) if (sock->handle <= 0) { kinc_log(KINC_LOG_LEVEL_ERROR, "Could not create socket."); -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) int errorCode = WSAGetLastError(); switch (errorCode) { case (WSANOTINITIALISED): @@ -352,7 +352,7 @@ bool kinc_socket_open(kinc_socket_t *sock, struct kinc_socket_options *options) if (options) { if (options->non_blocking) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) DWORD value = 1; if (ioctlsocket(sock->handle, FIONBIO, &value) != 0) { kinc_log(KINC_LOG_LEVEL_ERROR, "Could not set non-blocking mode."); @@ -368,7 +368,7 @@ bool kinc_socket_open(kinc_socket_t *sock, struct kinc_socket_options *options) } if (options->broadcast) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) || defined(KINC_POSIX) +#if defined(KINC_WINDOWS) || defined(KINC_POSIX) int value = 1; if (setsockopt(sock->handle, SOL_SOCKET, SO_BROADCAST, (const char *)&value, sizeof(value)) < 0) { kinc_log(KINC_LOG_LEVEL_ERROR, "Could not set broadcast mode."); @@ -378,7 +378,7 @@ bool kinc_socket_open(kinc_socket_t *sock, struct kinc_socket_options *options) } if (options->tcp_no_delay) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) || defined(KINC_POSIX) +#if defined(KINC_WINDOWS) || defined(KINC_POSIX) int value = 1; if (setsockopt(sock->handle, IPPROTO_TCP, TCP_NODELAY, (const char *)&value, sizeof(value)) != 0) { kinc_log(KINC_LOG_LEVEL_ERROR, "Could not set no-delay mode."); @@ -392,7 +392,7 @@ bool kinc_socket_open(kinc_socket_t *sock, struct kinc_socket_options *options) } void kinc_socket_destroy(kinc_socket_t *sock) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) closesocket(sock->handle); #elif defined(KINC_POSIX) close(sock->handle); @@ -401,7 +401,7 @@ void kinc_socket_destroy(kinc_socket_t *sock) { memset(sock, 0, sizeof(kinc_socket_t)); --counter; -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) if (counter == 0) { WSACleanup(); } @@ -409,7 +409,7 @@ void kinc_socket_destroy(kinc_socket_t *sock) { } bool kinc_socket_select(kinc_socket_t *sock, uint32_t waittime, bool read, bool write) { -#if !defined(KINC_EMSCRIPTEN) && (defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) || defined(KINC_POSIX)) +#if !defined(KINC_EMSCRIPTEN) && (defined(KINC_WINDOWS) || defined(KINC_POSIX)) fd_set r_fds, w_fds; struct timeval timeout; @@ -446,7 +446,7 @@ bool kinc_socket_select(kinc_socket_t *sock, uint32_t waittime, bool read, bool } bool kinc_socket_set(kinc_socket_t *sock, const char *host, int port, kinc_socket_family_t family, kinc_socket_protocol_t protocol) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) || defined(KINC_POSIX) +#if defined(KINC_WINDOWS) || defined(KINC_POSIX) sock->family = family; sock->protocol = protocol; @@ -487,7 +487,7 @@ bool kinc_socket_set(kinc_socket_t *sock, const char *host, int port, kinc_socke } bool kinc_socket_listen(kinc_socket_t *socket, int backlog) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) || defined(KINC_POSIX) +#if defined(KINC_WINDOWS) || defined(KINC_POSIX) int res = listen(socket->handle, backlog); return (res == 0); #else @@ -496,10 +496,10 @@ bool kinc_socket_listen(kinc_socket_t *socket, int backlog) { } bool kinc_socket_accept(kinc_socket_t *sock, kinc_socket_t *newSocket, unsigned *remoteAddress, unsigned *remotePort) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) typedef int socklen_t; #endif -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) || defined(KINC_POSIX) +#if defined(KINC_WINDOWS) || defined(KINC_POSIX) struct sockaddr_in addr; socklen_t addrLength = sizeof(addr); newSocket->handle = accept(sock->handle, (struct sockaddr *)&addr, &addrLength); @@ -521,7 +521,7 @@ bool kinc_socket_accept(kinc_socket_t *sock, kinc_socket_t *newSocket, unsigned } bool kinc_socket_connect(kinc_socket_t *sock) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) || defined(KINC_POSIX) +#if defined(KINC_WINDOWS) || defined(KINC_POSIX) struct sockaddr_in addr; addr.sin_family = sock->family == KINC_SOCKET_FAMILY_IP4 ? AF_INET : AF_INET6; addr.sin_addr.s_addr = sock->host; @@ -535,10 +535,10 @@ bool kinc_socket_connect(kinc_socket_t *sock) { } int kinc_socket_send(kinc_socket_t *sock, const uint8_t *data, int size) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) typedef int socklen_t; #endif -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) || defined(KINC_POSIX) +#if defined(KINC_WINDOWS) || defined(KINC_POSIX) if (sock->protocol == KINC_SOCKET_PROTOCOL_UDP) { struct sockaddr_in addr; addr.sin_family = sock->family == KINC_SOCKET_FAMILY_IP4 ? AF_INET : AF_INET6; @@ -570,7 +570,7 @@ int kinc_socket_send(kinc_socket_t *sock, const uint8_t *data, int size) { } int kinc_socket_send_address(kinc_socket_t *sock, unsigned address, int port, const uint8_t *data, int size) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) || defined(KINC_POSIX) +#if defined(KINC_WINDOWS) || defined(KINC_POSIX) struct sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_addr.s_addr = htonl(address); @@ -587,7 +587,7 @@ int kinc_socket_send_address(kinc_socket_t *sock, unsigned address, int port, co } int kinc_socket_send_url(kinc_socket_t *sock, const char *url, int port, const uint8_t *data, int size) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) || defined(KINC_POSIX) +#if defined(KINC_WINDOWS) || defined(KINC_POSIX) struct addrinfo *address = NULL; int res = resolveAddress(url, port, &address); if (res != 0) { @@ -607,11 +607,11 @@ int kinc_socket_send_url(kinc_socket_t *sock, const char *url, int port, const u } int kinc_socket_receive(kinc_socket_t *sock, uint8_t *data, int maxSize, unsigned *fromAddress, unsigned *fromPort) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) typedef int socklen_t; typedef int ssize_t; #endif -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) || defined(KINC_POSIX) +#if defined(KINC_WINDOWS) || defined(KINC_POSIX) if (sock->protocol == KINC_SOCKET_PROTOCOL_UDP) { struct sockaddr_in from; @@ -641,7 +641,7 @@ int kinc_socket_receive(kinc_socket_t *sock, uint8_t *data, int maxSize, unsigne } unsigned kinc_url_to_int(const char *url, int port) { -#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) +#if defined(KINC_WINDOWS) struct addrinfo *address = NULL; int res = resolveAddress(url, port, &address); if (res != 0) { diff --git a/sources/kinc/system.h b/sources/kinc/system.h index 4a10f565..c518e2d6 100644 --- a/sources/kinc/system.h +++ b/sources/kinc/system.h @@ -25,73 +25,73 @@ struct kinc_framebuffer_options; /// optionally be initialized beforehand using kinc_display_init. /// /// The id of the initial window -KINC_FUNC int kinc_init(const char *name, int width, int height, struct kinc_window_options *win, struct kinc_framebuffer_options *frame); +int kinc_init(const char *name, int width, int height, struct kinc_window_options *win, struct kinc_framebuffer_options *frame); /// /// Returns the current application name as set by kinc_init or kinc_set_application_name. /// /// The current name of the application -KINC_FUNC const char *kinc_application_name(void); +const char *kinc_application_name(void); /// /// Changes the application-name that was initially set by kinc_init. /// /// The new application-name -KINC_FUNC void kinc_set_application_name(const char *name); +void kinc_set_application_name(const char *name); /// /// Returns the current width of the initial application-window which is equivalent to calling kinc_window_width(0). /// /// The width of the initial window -KINC_FUNC int kinc_width(void); +int kinc_width(void); /// /// Returns the current height of the initial application-window which is equivalent to calling kinc_window_height(0). /// /// The height of the initial window -KINC_FUNC int kinc_height(void); +int kinc_height(void); /// /// Instruct the system to load up the provided URL which will usually open it in the system's default browser. /// /// The URL to open -KINC_FUNC void kinc_load_url(const char *url); +void kinc_load_url(const char *url); /// /// Returns an ID representing the current type of target-system. /// /// The ID representing the target system -KINC_FUNC const char *kinc_system_id(void); +const char *kinc_system_id(void); /// /// Returns the current system-language. /// /// The current system-language as a two-letter language code -KINC_FUNC const char *kinc_language(void); +const char *kinc_language(void); /// /// Vibrates the whole system if supported. This is primarily supported on mobile phones but don't blame us if your computer falls over. /// -KINC_FUNC void kinc_vibrate(int milliseconds); +void kinc_vibrate(int milliseconds); /// /// Returns the portion of the screen which can be safely used for important content. This is mostly relevant for TVs which often scale the image by default and /// thefore cut off some of the content. /// /// The safe-zone which can be multiplied with the width or height of the display to convert it to pixels -KINC_FUNC float kinc_safe_zone(void); +float kinc_safe_zone(void); /// /// Returns whether the system itself handles configuration of the safe-zone. /// /// Whether the safe-zone is handlet by the syste -KINC_FUNC bool kinc_automatic_safe_zone(void); +bool kinc_automatic_safe_zone(void); /// /// Sets the safe-zone for systems which return false for kinc_automatic_safe_zone. /// /// The safe-zone for width and height as a ratio of the full display-resolution. -KINC_FUNC void kinc_set_safe_zone(float value); +void kinc_set_safe_zone(float value); typedef uint64_t kinc_ticks_t; @@ -99,74 +99,74 @@ typedef uint64_t kinc_ticks_t; /// Returns the frequency of system-timestamps. /// /// The frequency of the system's timestamps in 1 / second -KINC_FUNC double kinc_frequency(void); +double kinc_frequency(void); /// /// Returns a timestamp for right now in a system-specific unit. /// /// The current timestamp -KINC_FUNC kinc_ticks_t kinc_timestamp(void); +kinc_ticks_t kinc_timestamp(void); /// /// Returns the number of proper CPU-cores (not the number of hardware-threads) /// /// Number of cores -KINC_FUNC int kinc_cpu_cores(void); +int kinc_cpu_cores(void); /// /// Returns the number of hardware-threads /// /// Number of hardware-threads -KINC_FUNC int kinc_hardware_threads(void); +int kinc_hardware_threads(void); /// /// Returns the current time. This can also be calculated ala kinc_timestamp() / kinc_frequency() but kinc_time is a little more precise on some systems. /// /// The current time in seconds -KINC_FUNC double kinc_time(void); +double kinc_time(void); /// /// Starts Kinc's main-loop. kinc_set_update_callback should be called before kinc_start so the main-loop actually has something to do. /// -KINC_FUNC void kinc_start(void); +void kinc_start(void); /// /// Stops Kinc's main loop and thereby returns to the function which called kinc_start. /// -KINC_FUNC void kinc_stop(void); +void kinc_stop(void); /// /// Instructs the system to login a user if that is supported. /// -KINC_FUNC void kinc_login(void); +void kinc_login(void); /// /// Returns true if kinc_login was called and the login-process is still ongoing. /// /// Whether a login-process is still in progress -KINC_FUNC bool kinc_waiting_for_login(void); +bool kinc_waiting_for_login(void); /// /// Unlocks an achievement or trophy or however you prefer to call it. /// /// The id of the achievement/tropy -KINC_FUNC void kinc_unlock_achievement(int id); +void kinc_unlock_achievement(int id); /// /// Disallows the system to logout the current user. /// -KINC_FUNC void kinc_disallow_user_change(void); +void kinc_disallow_user_change(void); /// /// Allows the system to logout the current user. /// -KINC_FUNC void kinc_allow_user_change(void); +void kinc_allow_user_change(void); /// /// Instructs the system whether it is allowed to turn off the screen while the application is running. /// /// Whether turning off the screen is allowed -KINC_FUNC void kinc_set_keep_screen_on(bool on); +void kinc_set_keep_screen_on(bool on); /// /// Tries to halt program-execution in an attached debugger when compiled in debug-mode (aka when NDEBUG is not defined). @@ -193,62 +193,62 @@ KINC_INLINE void kinc_debug_break(void) { /// Returns whether a debugger is currently attached to the running program. This is not yet working though. /// /// Whether a debugger is currently attached -KINC_FUNC bool kinc_debugger_attached(void); +bool kinc_debugger_attached(void); /// /// Copies the provided string to the system's clipboard. /// /// The text to be copied into the clipboard -KINC_FUNC void kinc_copy_to_clipboard(const char *text); +void kinc_copy_to_clipboard(const char *text); /// /// Sets the update-callback which drives the application and is called for every frame. /// /// The callback /// Arbitrary data-pointer that's passed to the callback -KINC_FUNC void kinc_set_update_callback(void (*callback)(void *), void *data); +void kinc_set_update_callback(void (*callback)(void *), void *data); /// /// Sets a callback which is called whenever the application is brought to the foreground. /// /// The foreground-callback /// Arbitrary data-pointer that's passed to the callback -KINC_FUNC void kinc_set_foreground_callback(void (*callback)(void *), void *data); +void kinc_set_foreground_callback(void (*callback)(void *), void *data); /// /// Sets a callback which is called whenever the application was paused and is being resumed. /// /// The resume-callback /// Arbitrary data-pointer that's passed to the callback -KINC_FUNC void kinc_set_resume_callback(void (*callback)(void *), void *data); +void kinc_set_resume_callback(void (*callback)(void *), void *data); /// /// Sets a callback which is called whenever the application is paused. /// /// The pause-callback /// Arbitrary data-pointer that's passed to the callback -KINC_FUNC void kinc_set_pause_callback(void (*callback)(void *), void *data); +void kinc_set_pause_callback(void (*callback)(void *), void *data); /// /// Sets a callback which is called whenever the application is brought to the background. /// /// The background-callback /// Arbitrary data-pointer that's passed to the callback -KINC_FUNC void kinc_set_background_callback(void (*callback)(void *), void *data); +void kinc_set_background_callback(void (*callback)(void *), void *data); /// /// Sets a callback which is called whenever the application is about to shut down. /// /// The shutdown-callback /// Arbitrary data-pointer that's passed to the callback -KINC_FUNC void kinc_set_shutdown_callback(void (*callback)(void *), void *data); +void kinc_set_shutdown_callback(void (*callback)(void *), void *data); /// /// Sets a callback which is called when files are dropped on the application-window. /// /// The drop-files-callback /// Arbitrary data-pointer that's passed to the callback -KINC_FUNC void kinc_set_drop_files_callback(void (*callback)(wchar_t *, void *), void *data); +void kinc_set_drop_files_callback(void (*callback)(wchar_t *, void *), void *data); /// /// Sets a callback which is called when the application is instructed to cut, typically via ctrl+x or cmd+x. @@ -256,7 +256,7 @@ KINC_FUNC void kinc_set_drop_files_callback(void (*callback)(wchar_t *, void *), /// /// The cut-callback /// Arbitrary data-pointer that's passed to the callback -KINC_FUNC void kinc_set_cut_callback(char *(*callback)(void *), void *data); +void kinc_set_cut_callback(char *(*callback)(void *), void *data); /// /// Sets a callback which is called when the application is instructed to copy, typically via ctrl+c or cmd+c. @@ -264,7 +264,7 @@ KINC_FUNC void kinc_set_cut_callback(char *(*callback)(void *), void *data); /// /// The copy-callback /// Arbitrary data-pointer that's passed to the callback -KINC_FUNC void kinc_set_copy_callback(char *(*callback)(void *), void *data); +void kinc_set_copy_callback(char *(*callback)(void *), void *data); /// /// Sets a callback which is called when the application is instructed to paste, typically via ctrl+v or cmd+v. @@ -272,78 +272,21 @@ KINC_FUNC void kinc_set_copy_callback(char *(*callback)(void *), void *data); /// /// The paste-callback /// Arbitrary data-pointer that's passed to the callback -KINC_FUNC void kinc_set_paste_callback(void (*callback)(char *, void *), void *data); +void kinc_set_paste_callback(void (*callback)(char *, void *), void *data); /// /// Sets a callback which is called when a user logs in. /// /// The login-callback /// Arbitrary data-pointer that's passed to the callback -KINC_FUNC void kinc_set_login_callback(void (*callback)(void *), void *data); +void kinc_set_login_callback(void (*callback)(void *), void *data); /// /// Sets a callback which is called when a user logs out. /// /// The logout-callback /// Arbitrary data-pointer that's passed to the callback -KINC_FUNC void kinc_set_logout_callback(void (*callback)(void *), void *data); - -#ifdef KINC_VTUNE -#include - -extern __itt_domain *kinc_itt_domain; -#endif - -#ifdef KINC_SUPERLUMINAL -#include -#endif - -/// -/// Starts a marker for profiling. Please match it with a marker_end-call in the same function. -/// -/// A unique name that will be shown in the profiler -/// A nice color in RGBX that will show up in the profiler -static inline void kinc_marker_start(const char *name, uint32_t color) { -#ifdef KINC_VTUNE - __itt_task_begin(kinc_itt_domain, __itt_null, __itt_null, __itt_string_handle_create(name)); -#endif - -#ifdef KINC_SUPERLUMINAL - PerformanceAPI_BeginEvent(name, NULL, color); -#endif -} - -/// -/// Ends the previously started marker of the same function. -/// -static inline void kinc_marker_end(const char *name) { -#ifdef KINC_VTUNE - __itt_task_end(kinc_itt_domain); -#endif - -#ifdef KINC_SUPERLUMINAL - PerformanceAPI_EndEvent(); -#endif -} - -/// -/// Currently only supported on Windows. -/// Starts up Live++ (see https://liveplusplus.tech), typically called right before kinc_start(). -/// After calling this you can hit Ctrl+Alt+F11 to hot-reload. -/// Call Project.addLivePP(path) in your kfile to make this do something. -/// The path-parameter for addLivePP is the path to the unpacked Live++-archive that has to contain a LivePP-subdirectory. -/// This will set the appropricate compiler- and linker-options and set the KINC_LIVEPP-define -/// for the Debug- and Develop-configs (it does not touch the Release-config). -/// -/// -KINC_FUNC void kinc_LivePP_start(void); - -/// -/// Stops Live++, typically called right after kinc_start(). -/// -/// -/// -KINC_FUNC void kinc_LivePP_stop(void); +void kinc_set_logout_callback(void (*callback)(void *), void *data); bool kinc_internal_frame(void); const char *kinc_internal_save_path(void); diff --git a/sources/kinc/threads/event.h b/sources/kinc/threads/event.h index aa0db97f..f236382a 100644 --- a/sources/kinc/threads/event.h +++ b/sources/kinc/threads/event.h @@ -23,25 +23,25 @@ typedef struct kinc_event { /// /// The event to initialize /// When auto-clear is true, the event is automatically reset to an unsignaled state after a successful wait-operation -KINC_FUNC void kinc_event_init(kinc_event_t *event, bool auto_clear); +void kinc_event_init(kinc_event_t *event, bool auto_clear); /// /// Destroys an event-object. /// /// The event to destroy -KINC_FUNC void kinc_event_destroy(kinc_event_t *event); +void kinc_event_destroy(kinc_event_t *event); /// /// Signals an event which allows threads which are waiting for the event to continue. /// /// The event to signal -KINC_FUNC void kinc_event_signal(kinc_event_t *event); +void kinc_event_signal(kinc_event_t *event); /// /// Waits for an event to be signaled. /// /// The event to wait for -KINC_FUNC void kinc_event_wait(kinc_event_t *event); +void kinc_event_wait(kinc_event_t *event); /// /// Waits for an event to be signaled or the provided timeout to run out - whatever happens first. @@ -49,13 +49,13 @@ KINC_FUNC void kinc_event_wait(kinc_event_t *event); /// The event to wait for /// The timeout in seconds after which the function returns if the event hasn't been signaled /// Whether the event has been signaled -KINC_FUNC bool kinc_event_try_to_wait(kinc_event_t *event, double timeout); +bool kinc_event_try_to_wait(kinc_event_t *event, double timeout); /// /// Resets an event to an unsignaled state. /// /// The event to reset -KINC_FUNC void kinc_event_reset(kinc_event_t *event); +void kinc_event_reset(kinc_event_t *event); #ifdef __cplusplus } diff --git a/sources/kinc/threads/fiber.h b/sources/kinc/threads/fiber.h index 7a94194d..abc8400f 100644 --- a/sources/kinc/threads/fiber.h +++ b/sources/kinc/threads/fiber.h @@ -20,7 +20,7 @@ typedef struct kinc_fiber { /// Uses the current thread as a fiber. /// /// The fiber-object to initialize using the current thread -KINC_FUNC void kinc_fiber_init_current_thread(kinc_fiber_t *fiber); +void kinc_fiber_init_current_thread(kinc_fiber_t *fiber); /// /// Initializes a fiber. @@ -28,19 +28,19 @@ KINC_FUNC void kinc_fiber_init_current_thread(kinc_fiber_t *fiber); /// The fiber-object to initialize /// The function to be run in the fiber-context /// A parameter to be provided to the fiber-function when it starts running -KINC_FUNC void kinc_fiber_init(kinc_fiber_t *fiber, void (*func)(void *param), void *param); +void kinc_fiber_init(kinc_fiber_t *fiber, void (*func)(void *param), void *param); /// /// Destroys a fiber. /// /// The fiber to destroy -KINC_FUNC void kinc_fiber_destroy(kinc_fiber_t *fiber); +void kinc_fiber_destroy(kinc_fiber_t *fiber); /// /// Switch the current thread to a different fiber. /// /// The fiber to switch to -KINC_FUNC void kinc_fiber_switch(kinc_fiber_t *fiber); +void kinc_fiber_switch(kinc_fiber_t *fiber); #ifdef __cplusplus } diff --git a/sources/kinc/threads/mutex.h b/sources/kinc/threads/mutex.h index 83ef475f..b3254091 100644 --- a/sources/kinc/threads/mutex.h +++ b/sources/kinc/threads/mutex.h @@ -22,33 +22,33 @@ typedef struct kinc_mutex { /// Initializes a mutex-object. /// /// The mutex to initialize -KINC_FUNC void kinc_mutex_init(kinc_mutex_t *mutex); +void kinc_mutex_init(kinc_mutex_t *mutex); /// /// Destroys a mutex-object. /// /// The mutex to destroy -KINC_FUNC void kinc_mutex_destroy(kinc_mutex_t *mutex); +void kinc_mutex_destroy(kinc_mutex_t *mutex); /// /// Locks a mutex. A mutex can only be locked from one thread - when other threads attempt to lock the mutex the function will only return once the mutex has /// been unlocked. /// /// The mutex to lock -KINC_FUNC void kinc_mutex_lock(kinc_mutex_t *mutex); +void kinc_mutex_lock(kinc_mutex_t *mutex); /// /// Attempts to lock the mutex which will only succeed if no other thread currently holds the lock. /// /// The mutex to lock /// Whether the mutex could be locked -KINC_FUNC bool kinc_mutex_try_to_lock(kinc_mutex_t *mutex); +bool kinc_mutex_try_to_lock(kinc_mutex_t *mutex); /// /// Unlocks the mutex which then allows other threads to lock it. /// /// The mutex to unlock -KINC_FUNC void kinc_mutex_unlock(kinc_mutex_t *mutex); +void kinc_mutex_unlock(kinc_mutex_t *mutex); typedef struct kinc_uber_mutex { kinc_uber_mutex_impl_t impl; @@ -60,26 +60,26 @@ typedef struct kinc_uber_mutex { /// The uber-mutex to initialize /// A name assigned to the uber-mutex - uber-mutex-creation fails if an uber-mutex of that name already exists /// Whether the uber-mutex could be created -KINC_FUNC bool kinc_uber_mutex_init(kinc_uber_mutex_t *mutex, const char *name); +bool kinc_uber_mutex_init(kinc_uber_mutex_t *mutex, const char *name); /// /// Destroys an uber-mutex-obejct. /// /// The uber-mutex to destroy -KINC_FUNC void kinc_uber_mutex_destroy(kinc_uber_mutex_t *mutex); +void kinc_uber_mutex_destroy(kinc_uber_mutex_t *mutex); /// /// Locks an uber-mutex. /// /// The uber-mutex to lock -KINC_FUNC void kinc_uber_mutex_lock(kinc_uber_mutex_t *mutex); +void kinc_uber_mutex_lock(kinc_uber_mutex_t *mutex); /// /// Unlocks an uber-mutex. /// /// The uber-mutex to unlock /// -KINC_FUNC void kinc_uber_mutex_unlock(kinc_uber_mutex_t *mutex); +void kinc_uber_mutex_unlock(kinc_uber_mutex_t *mutex); #ifdef __cplusplus } diff --git a/sources/kinc/threads/semaphore.h b/sources/kinc/threads/semaphore.h index 7aa6d237..f415e492 100644 --- a/sources/kinc/threads/semaphore.h +++ b/sources/kinc/threads/semaphore.h @@ -24,26 +24,26 @@ typedef struct kinc_semaphore { /// The semaphore to initialize /// The current count of the semaphore /// The maximum allowed count of the semaphore -KINC_FUNC void kinc_semaphore_init(kinc_semaphore_t *semaphore, int current, int max); +void kinc_semaphore_init(kinc_semaphore_t *semaphore, int current, int max); /// /// Destroys a semaphore. /// /// The semaphore to destroy -KINC_FUNC void kinc_semaphore_destroy(kinc_semaphore_t *semaphore); +void kinc_semaphore_destroy(kinc_semaphore_t *semaphore); /// /// Increases the current count of the semaphore, therefore allowing more acquires to succeed. /// /// The semaphore to increase the count on /// The amount by which the count will be increased -KINC_FUNC void kinc_semaphore_release(kinc_semaphore_t *semaphore, int count); +void kinc_semaphore_release(kinc_semaphore_t *semaphore, int count); /// /// Decreases the count of the semaphore by one. Blocks until it is possible to decrease the count if it already reached zero. /// /// The semaphore to acquire -KINC_FUNC void kinc_semaphore_acquire(kinc_semaphore_t *semaphore); +void kinc_semaphore_acquire(kinc_semaphore_t *semaphore); /// /// Attempts to decrease the count of the semaphore by one. @@ -51,7 +51,7 @@ KINC_FUNC void kinc_semaphore_acquire(kinc_semaphore_t *semaphore); /// The semaphore to acquire /// The timeout in seconds after which the function returns if the semaphore-count could not be decreased /// Whether the semaphore-count could be decreased -KINC_FUNC bool kinc_semaphore_try_to_acquire(kinc_semaphore_t *semaphore, double timeout); +bool kinc_semaphore_try_to_acquire(kinc_semaphore_t *semaphore, double timeout); #ifdef __cplusplus } diff --git a/sources/kinc/threads/thread.h b/sources/kinc/threads/thread.h index cfcfb7ba..ae6d7cec 100644 --- a/sources/kinc/threads/thread.h +++ b/sources/kinc/threads/thread.h @@ -19,14 +19,14 @@ typedef struct kinc_thread { /// /// Initializes the threading system. This has to be called before calling any kinc_thread functions. /// -KINC_FUNC void kinc_threads_init(void); +void kinc_threads_init(void); /// /// Shuts down the threading system. /// /// /// -KINC_FUNC void kinc_threads_quit(void); +void kinc_threads_quit(void); /// /// Starts a thread via the provided function. @@ -34,32 +34,32 @@ KINC_FUNC void kinc_threads_quit(void); /// The thread-object to initialize with the new thread /// The function used to start a new thread /// A parameter that is passed to the thread-function when the thread starts running -KINC_FUNC void kinc_thread_init(kinc_thread_t *thread, void (*func)(void *param), void *param); +void kinc_thread_init(kinc_thread_t *thread, void (*func)(void *param), void *param); /// /// Waits for the thread to complete execution and then destroys it. /// /// The thread to destroy -KINC_FUNC void kinc_thread_wait_and_destroy(kinc_thread_t *thread); +void kinc_thread_wait_and_destroy(kinc_thread_t *thread); /// /// Attempts to destroy a thread. /// /// The thread to destroy /// Returns if the thread is still running and therefore couldn't be destroyed -KINC_FUNC bool kinc_thread_try_to_destroy(kinc_thread_t *thread); +bool kinc_thread_try_to_destroy(kinc_thread_t *thread); /// /// Assigns a name to the current thread which will then show up in debuggers and profilers. /// /// The name to assign to the thread -KINC_FUNC void kinc_thread_set_name(const char *name); +void kinc_thread_set_name(const char *name); /// /// Puts the current thread to sleep. /// /// How long to sleep -KINC_FUNC void kinc_thread_sleep(int milliseconds); +void kinc_thread_sleep(int milliseconds); #ifdef __cplusplus } diff --git a/sources/kinc/threads/threadlocal.h b/sources/kinc/threads/threadlocal.h index dc80b72b..08e5eb03 100644 --- a/sources/kinc/threads/threadlocal.h +++ b/sources/kinc/threads/threadlocal.h @@ -20,26 +20,26 @@ typedef struct kinc_thread_local { /// Initializes a thread-specific storage-slot. /// /// The storage-slot to initialize -KINC_FUNC void kinc_thread_local_init(kinc_thread_local_t *local); +void kinc_thread_local_init(kinc_thread_local_t *local); /// /// Destroys a storage-slot. /// /// The storage-slot to destroy -KINC_FUNC void kinc_thread_local_destroy(kinc_thread_local_t *local); +void kinc_thread_local_destroy(kinc_thread_local_t *local); /// /// Gets the data in the storage-slot. /// /// The slot to query -KINC_FUNC void *kinc_thread_local_get(kinc_thread_local_t *local); +void *kinc_thread_local_get(kinc_thread_local_t *local); /// /// Sets the data in the storage-slot. /// /// The slot to put the data into /// The data to put in the slot -KINC_FUNC void kinc_thread_local_set(kinc_thread_local_t *local, void *data); +void kinc_thread_local_set(kinc_thread_local_t *local, void *data); #ifdef __cplusplus } diff --git a/sources/kinc/video.h b/sources/kinc/video.h index 3c762033..a1975961 100644 --- a/sources/kinc/video.h +++ b/sources/kinc/video.h @@ -22,80 +22,80 @@ typedef struct kinc_video { /// Returns the list of video formats which are supported on the current system. /// /// A NULL-terminated list of strings representing the supported video-formats -KINC_FUNC const char **kinc_video_formats(void); +const char **kinc_video_formats(void); /// /// Prepares a video object based on an encoded video-file. /// -KINC_FUNC void kinc_video_init(kinc_video_t *video, const char *filename); +void kinc_video_init(kinc_video_t *video, const char *filename); /// /// Destroys a video object. /// -KINC_FUNC void kinc_video_destroy(kinc_video_t *video); +void kinc_video_destroy(kinc_video_t *video); /// /// Starts playing a video. /// -KINC_FUNC void kinc_video_play(kinc_video_t *video, bool loop); +void kinc_video_play(kinc_video_t *video, bool loop); /// /// Pauses a video. /// -KINC_FUNC void kinc_video_pause(kinc_video_t *video); +void kinc_video_pause(kinc_video_t *video); /// /// Stops a video which is equivalent to pausing it and setting the position to 0. /// -KINC_FUNC void kinc_video_stop(kinc_video_t *video); +void kinc_video_stop(kinc_video_t *video); /// /// Gets the width of the video in pixels. /// /// The width of the video in pixels -KINC_FUNC int kinc_video_width(kinc_video_t *video); +int kinc_video_width(kinc_video_t *video); /// /// Gets the height of the video in pixels. /// /// The height of the video in pixels -KINC_FUNC int kinc_video_height(kinc_video_t *video); +int kinc_video_height(kinc_video_t *video); /// /// Gets the current image of a playing video which can be rendered using any of Kinc's graphics APIs. /// /// The current image of a playing video -KINC_FUNC kinc_g4_texture_t *kinc_video_current_image(kinc_video_t *video); +kinc_g4_texture_t *kinc_video_current_image(kinc_video_t *video); /// /// Gets the duration of the video in seconds. /// /// The duration of the video in seconds -KINC_FUNC double kinc_video_duration(kinc_video_t *video); +double kinc_video_duration(kinc_video_t *video); /// /// Returns the current playback-position of the video in seconds. /// /// The current playback-position in seconds -KINC_FUNC double kinc_video_position(kinc_video_t *video); +double kinc_video_position(kinc_video_t *video); /// /// Returns whether the video reached its end. /// /// the end-state of the video -KINC_FUNC bool kinc_video_finished(kinc_video_t *video); +bool kinc_video_finished(kinc_video_t *video); /// /// Returns whether the video is currently paused. /// /// The current pause state of the video -KINC_FUNC bool kinc_video_paused(kinc_video_t *video); +bool kinc_video_paused(kinc_video_t *video); /// /// Call this every frame to update the video. This is not required on all targets but where it's not required the function just does nothing - so please call /// it. /// -KINC_FUNC void kinc_video_update(kinc_video_t *video, double time); +void kinc_video_update(kinc_video_t *video, double time); #ifdef __cplusplus } diff --git a/sources/kinc/window.h b/sources/kinc/window.h index 3610f7ba..698fc567 100644 --- a/sources/kinc/window.h +++ b/sources/kinc/window.h @@ -51,120 +51,120 @@ typedef struct kinc_window_options { /// Creates a window. /// /// The id of the created window -KINC_FUNC int kinc_window_create(kinc_window_options_t *win, kinc_framebuffer_options_t *frame); +int kinc_window_create(kinc_window_options_t *win, kinc_framebuffer_options_t *frame); /// /// Closes and destroys a window. /// -KINC_FUNC void kinc_window_destroy(int window); +void kinc_window_destroy(int window); -KINC_FUNC void kinc_window_options_set_defaults(kinc_window_options_t *win); +void kinc_window_options_set_defaults(kinc_window_options_t *win); -KINC_FUNC void kinc_framebuffer_options_set_defaults(kinc_framebuffer_options_t *frame); +void kinc_framebuffer_options_set_defaults(kinc_framebuffer_options_t *frame); /// /// Counts all windows the program created, including the initial window created by kinc_init. /// /// The number of windows -KINC_FUNC int kinc_count_windows(void); +int kinc_count_windows(void); /// /// Resizes a window. /// -KINC_FUNC void kinc_window_resize(int window, int width, int height); +void kinc_window_resize(int window, int width, int height); /// /// Moves a window. /// -KINC_FUNC void kinc_window_move(int window, int x, int y); +void kinc_window_move(int window, int x, int y); /// /// Switches between window and fullscreen-modes. /// -KINC_FUNC void kinc_window_change_mode(int window, kinc_window_mode_t mode); +void kinc_window_change_mode(int window, kinc_window_mode_t mode); /// /// Applies an or-ed combination of KINC_WINDOW_FEATURE values. /// -KINC_FUNC void kinc_window_change_features(int window, int features); +void kinc_window_change_features(int window, int features); /// /// Changes the framebuffer-options of a window. /// -KINC_FUNC void kinc_window_change_framebuffer(int window, kinc_framebuffer_options_t *frame); +void kinc_window_change_framebuffer(int window, kinc_framebuffer_options_t *frame); /// /// Returns the x position of a window. /// /// The x-position -KINC_FUNC int kinc_window_x(int window); +int kinc_window_x(int window); /// /// Returns the y position of a window. /// /// The y-position -KINC_FUNC int kinc_window_y(int window); +int kinc_window_y(int window); /// /// Returns the width of a window. /// /// The window-width -KINC_FUNC int kinc_window_width(int window); +int kinc_window_width(int window); /// /// Returns the height of a window. /// /// The window-height -KINC_FUNC int kinc_window_height(int window); +int kinc_window_height(int window); /// /// Returns the id of the display the window currently is on. /// /// The display-id -KINC_FUNC int kinc_window_display(int window); +int kinc_window_display(int window); /// /// Returns the current window-mode. /// /// The window-mode -KINC_FUNC kinc_window_mode_t kinc_window_get_mode(int window); +kinc_window_mode_t kinc_window_get_mode(int window); /// /// Makes the window visible. /// -KINC_FUNC void kinc_window_show(int window); +void kinc_window_show(int window); /// /// Hides a window. /// -KINC_FUNC void kinc_window_hide(int window); +void kinc_window_hide(int window); /// /// Sets the title of a window. /// -KINC_FUNC void kinc_window_set_title(int window, const char *title); +void kinc_window_set_title(int window, const char *title); /// /// Sets a resize callback that's called whenever the window is resized. /// -KINC_FUNC void kinc_window_set_resize_callback(int window, void (*callback)(int x, int y, void *data), void *data); +void kinc_window_set_resize_callback(int window, void (*callback)(int x, int y, void *data), void *data); /// /// Sets a PPI callback that's called whenever the window moves to a display that uses a different PPI-setting. /// -KINC_FUNC void kinc_window_set_ppi_changed_callback(int window, void (*callback)(int ppi, void *data), void *data); +void kinc_window_set_ppi_changed_callback(int window, void (*callback)(int ppi, void *data), void *data); /// /// Sets a close callback that's called when the window is about to close. /// Returning false from the callback tries to stop the window from closing. /// -KINC_FUNC void kinc_window_set_close_callback(int window, bool (*callback)(void *data), void *data); +void kinc_window_set_close_callback(int window, bool (*callback)(void *data), void *data); /// /// Returns whether the window is vsynced or not. /// /// Whether the window is vsynced or not -KINC_FUNC bool kinc_window_vsynced(int window); +bool kinc_window_vsynced(int window); void kinc_internal_call_resize_callback(int window, int width, int height); void kinc_internal_call_ppi_changed_callback(int window, int ppi);