From 8ab3ed0318a869b6357ef7de2a91253c6f8b9ede Mon Sep 17 00:00:00 2001 From: Robert Konrad Date: Thu, 28 Mar 2024 12:00:46 +0100 Subject: [PATCH] Clean up the KORE/KINC defines --- Sources/Kore/Graphics2/Graphics.cpp | 10 +++++----- Sources/Kore/Graphics2/Kravur.cpp | 2 +- Sources/Kore/Graphics3/Graphics.cpp | 4 ++-- Sources/Kore/Graphics3/Graphics.h | 2 +- Sources/Kore/Graphics3/Texture.cpp | 2 +- Sources/Kore/Graphics3/Texture.h | 4 ++-- Sources/Kore/Graphics4/Compute.cpp | 2 +- Sources/Kore/Graphics4/Compute.h | 4 ++-- Sources/Kore/Graphics4/Graphics.cpp | 4 ++-- Sources/Kore/Graphics4/Graphics.h | 4 ++-- Sources/Kore/Graphics4/Texture.cpp | 4 ++-- Sources/Kore/Graphics4/Texture.h | 4 ++-- Sources/Kore/Graphics5/CommandList.h | 2 +- Sources/Kore/Graphics5/Compute.h | 2 +- Sources/Kore/Graphics5/Texture.cpp | 4 ++-- Sources/Kore/Graphics5/Texture.h | 4 ++-- Sources/Kore/IO/Reader.cpp | 28 ++++++++++++++-------------- Sources/Kore/IO/Writer.cpp | 2 +- Sources/Kore/System.cpp | 2 +- Sources/Kore/Threads/Mutex.h | 8 ++++---- Sources/Kore/Vr/VrInterface.cpp | 2 +- 21 files changed, 50 insertions(+), 50 deletions(-) diff --git a/Sources/Kore/Graphics2/Graphics.cpp b/Sources/Kore/Graphics2/Graphics.cpp index ff85ab101..9ea63f895 100644 --- a/Sources/Kore/Graphics2/Graphics.cpp +++ b/Sources/Kore/Graphics2/Graphics.cpp @@ -8,7 +8,7 @@ using namespace Kore; -#ifdef KORE_G4 +#ifdef KINC_G4 //========== // ImageShaderPainter @@ -164,7 +164,7 @@ void Graphics2::ImageShaderPainter::drawBuffer() { Graphics4::setTextureMagnificationFilter(textureLocation, bilinear ? Graphics4::LinearFilter : Graphics4::PointFilter); Graphics4::setTextureMipmapFilter(textureLocation, Graphics4::NoMipFilter); -#ifndef KORE_G4 +#ifndef KINC_G4 // Set fixed-function projection matrix Graphics3::setProjectionMatrix(projectionMatrix); #else @@ -478,7 +478,7 @@ void Graphics2::ColoredShaderPainter::drawBuffer(bool trisDone) { Graphics4::setVertexBuffer(*rectVertexBuffer); Graphics4::setIndexBuffer(*indexBuffer); -#ifndef KORE_G4 +#ifndef KINC_G4 // Set fixed-function projection matrix Graphics3::setProjectionMatrix(projectionMatrix); #else @@ -501,7 +501,7 @@ void Graphics2::ColoredShaderPainter::drawTriBuffer(bool rectsDone) { Graphics4::setVertexBuffer(*triangleVertexBuffer); Graphics4::setIndexBuffer(*triangleIndexBuffer); -#ifndef KORE_G4 +#ifndef KINC_G4 // Set fixed-function projection matrix Graphics3::setProjectionMatrix(projectionMatrix); #else @@ -703,7 +703,7 @@ void Graphics2::TextShaderPainter::drawBuffer() { Graphics4::setIndexBuffer(*indexBuffer); Graphics4::setTexture(textureLocation, lastTexture); -#ifndef KORE_G4 +#ifndef KINC_G4 // Set fixed-function projection matrix Graphics3::setProjectionMatrix(projectionMatrix); #else diff --git a/Sources/Kore/Graphics2/Kravur.cpp b/Sources/Kore/Graphics2/Kravur.cpp index 92829a395..06209b14e 100644 --- a/Sources/Kore/Graphics2/Kravur.cpp +++ b/Sources/Kore/Graphics2/Kravur.cpp @@ -7,7 +7,7 @@ using namespace Kore; -#ifdef KORE_G4 +#ifdef KINC_G4 namespace { std::map fontCache; diff --git a/Sources/Kore/Graphics3/Graphics.cpp b/Sources/Kore/Graphics3/Graphics.cpp index 2ae5f400a..c079996f3 100644 --- a/Sources/Kore/Graphics3/Graphics.cpp +++ b/Sources/Kore/Graphics3/Graphics.cpp @@ -2,7 +2,7 @@ #include -#ifndef KORE_G4 +#ifndef KINC_G4 using namespace Kore; @@ -11,7 +11,7 @@ namespace { bool window = true; } -#if !defined(KORE_WINDOWS) +#if !defined(KINC_WINDOWS) void Graphics3::Graphics3::setup() {} #endif diff --git a/Sources/Kore/Graphics3/Graphics.h b/Sources/Kore/Graphics3/Graphics.h index 8cf9b340a..db3c54de2 100644 --- a/Sources/Kore/Graphics3/Graphics.h +++ b/Sources/Kore/Graphics3/Graphics.h @@ -1,6 +1,6 @@ #pragma once -#ifndef KORE_G4 +#ifndef KINC_G4 #include diff --git a/Sources/Kore/Graphics3/Texture.cpp b/Sources/Kore/Graphics3/Texture.cpp index 0e83696ca..ab6e14963 100644 --- a/Sources/Kore/Graphics3/Texture.cpp +++ b/Sources/Kore/Graphics3/Texture.cpp @@ -5,7 +5,7 @@ using namespace Kore; -#ifndef KORE_G4 +#ifndef KINC_G4 Graphics3::Texture::Texture(Kore::Reader &reader, const char *format, bool readable) : Image(reader, format, readable) { init(format, readable); diff --git a/Sources/Kore/Graphics3/Texture.h b/Sources/Kore/Graphics3/Texture.h index 2bee90c18..bb20f234f 100644 --- a/Sources/Kore/Graphics3/Texture.h +++ b/Sources/Kore/Graphics3/Texture.h @@ -22,7 +22,7 @@ namespace Kore { Texture(const char *filename, bool readable = false); Texture(void *data, int size, const char *format, bool readable = false); Texture(void *data, int width, int height, int format, bool readable = false); -#ifdef KORE_ANDROID +#ifdef KINC_ANDROID Texture(unsigned texid); #endif void _set(TextureUnit unit); @@ -30,7 +30,7 @@ namespace Kore { uint8_t *lock(); void unlock(); void clear(int x, int y, int z, int width, int height, int depth, unsigned color); -#ifdef KORE_IOS +#ifdef KINC_IOS void upload(u8 *data); #endif void generateMipmaps(int levels); diff --git a/Sources/Kore/Graphics4/Compute.cpp b/Sources/Kore/Graphics4/Compute.cpp index 7c13bdcf1..872fdc66a 100644 --- a/Sources/Kore/Graphics4/Compute.cpp +++ b/Sources/Kore/Graphics4/Compute.cpp @@ -24,7 +24,7 @@ Graphics4::TextureUnit Graphics4::ComputeShader::getTextureUnit(const char *name return unit; } -#ifdef KORE_OPENGL +#ifdef KINC_OPENGL Graphics4::ShaderStorageBuffer::ShaderStorageBuffer(int count, Graphics4::VertexData type) { kinc_shader_storage_buffer_init(&kincImpl, count, (kinc_g4_vertex_data_t)type); } diff --git a/Sources/Kore/Graphics4/Compute.h b/Sources/Kore/Graphics4/Compute.h index 5949f6d13..f2cbfbcbf 100644 --- a/Sources/Kore/Graphics4/Compute.h +++ b/Sources/Kore/Graphics4/Compute.h @@ -2,7 +2,7 @@ #include -#ifdef KORE_OPENGL +#ifdef KINC_OPENGL #include #endif #include @@ -22,7 +22,7 @@ namespace Kore { kinc_g4_compute_shader kincImpl; }; -#ifdef KORE_OPENGL +#ifdef KINC_OPENGL class ShaderStorageBuffer { public: ShaderStorageBuffer(int count, Graphics4::VertexData type); diff --git a/Sources/Kore/Graphics4/Graphics.cpp b/Sources/Kore/Graphics4/Graphics.cpp index 0a4ed2a40..bbb9d3590 100644 --- a/Sources/Kore/Graphics4/Graphics.cpp +++ b/Sources/Kore/Graphics4/Graphics.cpp @@ -1,5 +1,5 @@ -#ifdef KORE_G4 +#ifdef KINC_G4 #include "Graphics.h" #include "PipelineState.h" @@ -286,7 +286,7 @@ void Graphics4::_changeFramebuffer(int window, struct kinc_framebuffer_options * kinc_internal_change_framebuffer(window, frame); } -#ifdef KORE_OPENGL +#ifdef KINC_OPENGL void Graphics4::setShaderStorageBuffer(ShaderStorageBuffer *buffer, int index) { kinc_g4_set_shader_storage_buffer(&buffer->kincImpl, index); } diff --git a/Sources/Kore/Graphics4/Graphics.h b/Sources/Kore/Graphics4/Graphics.h index e6259bd7d..4a228e261 100644 --- a/Sources/Kore/Graphics4/Graphics.h +++ b/Sources/Kore/Graphics4/Graphics.h @@ -18,7 +18,7 @@ namespace Kore { class ComputeShader; class PipelineState; class TextureArray; -#ifdef KORE_OPENGL +#ifdef KINC_OPENGL class ShaderStorageBuffer; #endif @@ -182,7 +182,7 @@ namespace Kore { void setRenderTargetFace(RenderTarget *texture, int face = 0); void restoreRenderTarget(); -#ifdef KORE_OPENGL +#ifdef KINC_OPENGL void setShaderStorageBuffer(ShaderStorageBuffer *buffer, int index); #endif void setComputeShader(ComputeShader *shader); diff --git a/Sources/Kore/Graphics4/Texture.cpp b/Sources/Kore/Graphics4/Texture.cpp index bb71ffbf0..78b4da30f 100644 --- a/Sources/Kore/Graphics4/Texture.cpp +++ b/Sources/Kore/Graphics4/Texture.cpp @@ -121,7 +121,7 @@ Graphics4::Texture::~Texture() { kinc_g4_texture_destroy(&kincTexture); } -#if defined(KORE_ANDROID) && !defined(KORE_VULKAN) +#if defined(KINC_ANDROID) && !defined(KINC_VULKAN) Graphics4::Texture::Texture(unsigned texid) { kinc_g4_texture_init_from_id(&kincTexture, texid); } @@ -139,7 +139,7 @@ int Graphics4::Texture::stride() { return kinc_g4_texture_stride(&kincTexture); } -#if defined(KORE_IOS) || defined(KORE_MACOS) +#if defined(KINC_IOS) || defined(KINC_MACOS) void Graphics4::Texture::upload(u8 *data, int stride) { kinc_g4_texture_upload(&kincTexture, data, stride); } diff --git a/Sources/Kore/Graphics4/Texture.h b/Sources/Kore/Graphics4/Texture.h index 0b212164d..df62348b4 100644 --- a/Sources/Kore/Graphics4/Texture.h +++ b/Sources/Kore/Graphics4/Texture.h @@ -27,7 +27,7 @@ namespace Kore { Texture(void *data, int width, int height, Format format, bool readable = false); Texture(void *data, int width, int height, int depth, Format format, bool readable = false); virtual ~Texture(); -#if defined(KORE_ANDROID) && !defined(KORE_VULKAN) +#if defined(KINC_ANDROID) && !defined(KINC_VULKAN) Texture(unsigned texid); #endif void _set(TextureUnit unit); @@ -35,7 +35,7 @@ namespace Kore { u8 *lock(); void unlock(); void clear(int x, int y, int z, int width, int height, int depth, uint color); -#if defined(KORE_IOS) || defined(KORE_MACOS) +#if defined(KINC_IOS) || defined(KINC_MACOS) void upload(u8 *data, int stride); #endif void generateMipmaps(int levels); diff --git a/Sources/Kore/Graphics5/CommandList.h b/Sources/Kore/Graphics5/CommandList.h index e568c6a2b..a76a3f5f5 100644 --- a/Sources/Kore/Graphics5/CommandList.h +++ b/Sources/Kore/Graphics5/CommandList.h @@ -14,7 +14,7 @@ namespace Kore { class Sampler; class Texture; class VertexBuffer; -#ifdef KORE_OPENGL +#ifdef KINC_OPENGL class ShaderStorageBuffer; #endif diff --git a/Sources/Kore/Graphics5/Compute.h b/Sources/Kore/Graphics5/Compute.h index c0950955e..d88c03ef7 100644 --- a/Sources/Kore/Graphics5/Compute.h +++ b/Sources/Kore/Graphics5/Compute.h @@ -2,7 +2,7 @@ #include -#ifdef KORE_OPENGL +#ifdef KINC_OPENGL #include #endif #include diff --git a/Sources/Kore/Graphics5/Texture.cpp b/Sources/Kore/Graphics5/Texture.cpp index 44b3cad2c..70ada17a9 100644 --- a/Sources/Kore/Graphics5/Texture.cpp +++ b/Sources/Kore/Graphics5/Texture.cpp @@ -122,7 +122,7 @@ Texture::~Texture() { kinc_g5_texture_destroy(&kincTexture); } -#if defined(KORE_ANDROID) && !defined(KORE_VULKAN) +#if defined(KINC_ANDROID) && !defined(KINC_VULKAN) KINC_FUNC void kinc_g4_texture_init_from_id(kinc_g4_texture_t *texture, unsigned texid); Texture::Texture(unsigned texid) { @@ -142,7 +142,7 @@ int Texture::stride() { return kinc_g5_texture_stride(&kincTexture); } -#if defined(KORE_IOS) || defined(KORE_MACOS) +#if defined(KINC_IOS) || defined(KINC_MACOS) void Texture::upload(u8 *data, int stride) { // kinc_g5_texture_upload(&kincTexture, data, stride); } diff --git a/Sources/Kore/Graphics5/Texture.h b/Sources/Kore/Graphics5/Texture.h index fab4c37c7..6b18fe621 100644 --- a/Sources/Kore/Graphics5/Texture.h +++ b/Sources/Kore/Graphics5/Texture.h @@ -22,7 +22,7 @@ namespace Kore { Texture(void *data, int width, int height, int format, bool readable = false); Texture(void *data, int width, int height, int depth, int format, bool readable = false); virtual ~Texture(); -#if defined(KORE_ANDROID) && !defined(KORE_VULKAN) +#if defined(KINC_ANDROID) && !defined(KINC_VULKAN) Texture(unsigned texid); #endif // void _set(TextureUnit unit); @@ -30,7 +30,7 @@ namespace Kore { u8 *lock(); void unlock(); void clear(int x, int y, int z, int width, int height, int depth, uint color); -#if defined(KORE_IOS) || defined(KORE_MACOS) +#if defined(KINC_IOS) || defined(KINC_MACOS) void upload(u8 *data, int stride); #endif void generateMipmaps(int levels); diff --git a/Sources/Kore/IO/Reader.cpp b/Sources/Kore/IO/Reader.cpp index 24f4ab3df..c470d1e79 100644 --- a/Sources/Kore/IO/Reader.cpp +++ b/Sources/Kore/IO/Reader.cpp @@ -9,7 +9,7 @@ using namespace Kore; float Reader::readF32LE(u8 *data) { -#ifdef KORE_LITTLE_ENDIAN // speed optimization +#ifdef KINC_LITTLE_ENDIAN // speed optimization return *(float *)data; #else // works on all architectures int i = (data[0] << 0) | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); @@ -18,7 +18,7 @@ float Reader::readF32LE(u8 *data) { } float Reader::readF32BE(u8 *data) { -#ifdef KORE_BIG_ENDIAN // speed optimization +#ifdef KINC_BIG_ENDIAN // speed optimization return *(float *)data; #else // works on all architectures int i = (data[3] << 0) | (data[2] << 8) | (data[1] << 16) | (data[0] << 24); @@ -27,7 +27,7 @@ float Reader::readF32BE(u8 *data) { } u64 Reader::readU64LE(u8 *data) { -#ifdef KORE_LITTLE_ENDIAN +#ifdef KINC_LITTLE_ENDIAN return *(u64 *)data; #else return ((u64)data[0] << 0) | ((u64)data[1] << 8) | ((u64)data[2] << 16) | ((u64)data[3] << 24) | ((u64)data[4] << 32) | ((u64)data[5] << 40) | @@ -36,7 +36,7 @@ u64 Reader::readU64LE(u8 *data) { } u64 Reader::readU64BE(u8 *data) { -#ifdef KORE_BIG_ENDIAN +#ifdef KINC_BIG_ENDIAN return *(u64 *)data; #else return ((u64)data[7] << 0) | ((u64)data[6] << 8) | ((u64)data[5] << 16) | ((u64)data[4] << 24) | ((u64)data[3] << 32) | ((u64)data[2] << 40) | @@ -45,7 +45,7 @@ u64 Reader::readU64BE(u8 *data) { } s64 Reader::readS64LE(u8 *data) { -#ifdef KORE_LITTLE_ENDIAN +#ifdef KINC_LITTLE_ENDIAN return *(s64 *)data; #else return ((s64)data[0] << 0) | ((s64)data[1] << 8) | ((s64)data[2] << 16) | ((s64)data[3] << 24) | ((s64)data[4] << 32) | ((s64)data[5] << 40) | @@ -54,7 +54,7 @@ s64 Reader::readS64LE(u8 *data) { } s64 Reader::readS64BE(u8 *data) { -#ifdef KORE_BIG_ENDIAN +#ifdef KINC_BIG_ENDIAN return *(s64 *)data; #else return ((s64)data[7] << 0) | ((s64)data[6] << 8) | ((s64)data[5] << 16) | ((s64)data[4] << 24) | ((s64)data[3] << 32) | ((s64)data[2] << 40) | @@ -63,7 +63,7 @@ s64 Reader::readS64BE(u8 *data) { } u32 Reader::readU32LE(u8 *data) { -#ifdef KORE_LITTLE_ENDIAN +#ifdef KINC_LITTLE_ENDIAN return *(u32 *)data; #else return (data[0] << 0) | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); @@ -71,7 +71,7 @@ u32 Reader::readU32LE(u8 *data) { } u32 Reader::readU32BE(u8 *data) { -#ifdef KORE_BIG_ENDIAN +#ifdef KINC_BIG_ENDIAN return *(u32 *)data; #else return (data[3] << 0) | (data[2] << 8) | (data[1] << 16) | (data[0] << 24); @@ -79,7 +79,7 @@ u32 Reader::readU32BE(u8 *data) { } s32 Reader::readS32LE(u8 *data) { -#ifdef KORE_LITTLE_ENDIAN +#ifdef KINC_LITTLE_ENDIAN return *(s32 *)data; #else return (data[0] << 0) | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); @@ -87,7 +87,7 @@ s32 Reader::readS32LE(u8 *data) { } s32 Reader::readS32BE(u8 *data) { -#ifdef KORE_BIG_ENDIAN +#ifdef KINC_BIG_ENDIAN return *(s32 *)data; #else return (data[3] << 0) | (data[2] << 8) | (data[1] << 16) | (data[0] << 24); @@ -95,7 +95,7 @@ s32 Reader::readS32BE(u8 *data) { } u16 Reader::readU16LE(u8 *data) { -#ifdef KORE_LITTLE_ENDIAN +#ifdef KINC_LITTLE_ENDIAN return *(u16 *)data; #else return (data[0] << 0) | (data[1] << 8); @@ -103,7 +103,7 @@ u16 Reader::readU16LE(u8 *data) { } u16 Reader::readU16BE(u8 *data) { -#ifdef KORE_BIG_ENDIAN +#ifdef KINC_BIG_ENDIAN return *(u16 *)data; #else return (data[1] << 0) | (data[0] << 8); @@ -111,7 +111,7 @@ u16 Reader::readU16BE(u8 *data) { } s16 Reader::readS16LE(u8 *data) { -#ifdef KORE_LITTLE_ENDIAN +#ifdef KINC_LITTLE_ENDIAN return *(s16 *)data; #else return (data[0] << 0) | (data[1] << 8); @@ -119,7 +119,7 @@ s16 Reader::readS16LE(u8 *data) { } s16 Reader::readS16BE(u8 *data) { -#ifdef KORE_BIG_ENDIAN +#ifdef KINC_BIG_ENDIAN return *(s16 *)data; #else return (data[1] << 0) | (data[0] << 8); diff --git a/Sources/Kore/IO/Writer.cpp b/Sources/Kore/IO/Writer.cpp index 6371d35fc..1fc718cbc 100644 --- a/Sources/Kore/IO/Writer.cpp +++ b/Sources/Kore/IO/Writer.cpp @@ -70,7 +70,7 @@ void Writer::writeS8(s8 value) { write(&value, 1); } -#ifdef KORE_LITTLE_ENDIAN +#ifdef KINC_LITTLE_ENDIAN #define TO_LE(size) \ u8 *values = (u8 *)&value; \ for (int i = 0; i < size; ++i) data[i] = values[i]; diff --git a/Sources/Kore/System.cpp b/Sources/Kore/System.cpp index b0aa725b7..5fc5d0405 100644 --- a/Sources/Kore/System.cpp +++ b/Sources/Kore/System.cpp @@ -132,7 +132,7 @@ const char *Kore::System::name() { return kinc_application_name(); } -#ifdef KORE_METAL +#ifdef KINC_METAL void shutdownMetalCompute(); #endif diff --git a/Sources/Kore/Threads/Mutex.h b/Sources/Kore/Threads/Mutex.h index 279b3f178..b9ef0c480 100644 --- a/Sources/Kore/Threads/Mutex.h +++ b/Sources/Kore/Threads/Mutex.h @@ -3,7 +3,7 @@ /* #include -#if !defined(KORE_WINDOWS) && !defined(KORE_WINDOWSAPP) && defined(KORE_POSIX) +#if !defined(KINC_WINDOWS) && !defined(KINC_WINDOWSAPP) && defined(KINC_POSIX) #include #endif @@ -17,7 +17,7 @@ namespace Kore { void unlock(); private: -#if defined(KORE_WINDOWS) || defined(KORE_WINDOWSAPP) || defined(KORE_XBOX_ONE) +#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) || defined(KINC_XBOX_ONE) struct CriticalSection { void* DebugInfo; long LockCount; @@ -26,14 +26,14 @@ namespace Kore { void* LockSemaphore; unsigned long __w64 SpinCount; } criticalSection; -#elif defined(KORE_POSIX) +#elif defined(KINC_POSIX) pthread_mutex_t pthread_mutex; #endif }; class UberMutex { public: -#if defined(KORE_WINDOWS) || defined(KORE_WINDOWSAPP) +#if defined(KINC_WINDOWS) || defined(KINC_WINDOWSAPP) void* id; #endif diff --git a/Sources/Kore/Vr/VrInterface.cpp b/Sources/Kore/Vr/VrInterface.cpp index b4446bcc8..031fdd993 100644 --- a/Sources/Kore/Vr/VrInterface.cpp +++ b/Sources/Kore/Vr/VrInterface.cpp @@ -1,4 +1,4 @@ -#ifdef KORE_VR +#ifdef KINC_VR #include "VrInterface.h"