Skip to content

Commit

Permalink
Clean up the KORE/KINC defines
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Mar 28, 2024
1 parent 6c81e44 commit 8ab3ed0
Show file tree
Hide file tree
Showing 21 changed files with 50 additions and 50 deletions.
10 changes: 5 additions & 5 deletions Sources/Kore/Graphics2/Graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

using namespace Kore;

#ifdef KORE_G4
#ifdef KINC_G4

//==========
// ImageShaderPainter
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Sources/Kore/Graphics2/Kravur.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

using namespace Kore;

#ifdef KORE_G4
#ifdef KINC_G4

namespace {
std::map<std::string, Kravur *> fontCache;
Expand Down
4 changes: 2 additions & 2 deletions Sources/Kore/Graphics3/Graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <limits>

#ifndef KORE_G4
#ifndef KINC_G4

using namespace Kore;

Expand All @@ -11,7 +11,7 @@ namespace {
bool window = true;
}

#if !defined(KORE_WINDOWS)
#if !defined(KINC_WINDOWS)
void Graphics3::Graphics3::setup() {}
#endif

Expand Down
2 changes: 1 addition & 1 deletion Sources/Kore/Graphics3/Graphics.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#ifndef KORE_G4
#ifndef KINC_G4

#include <Kore/global.h>

Expand Down
2 changes: 1 addition & 1 deletion Sources/Kore/Graphics3/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Sources/Kore/Graphics3/Texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ 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);
void _setImage(TextureUnit unit);
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);
Expand Down
2 changes: 1 addition & 1 deletion Sources/Kore/Graphics4/Compute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Kore/Graphics4/Compute.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <kinc/graphics4/compute.h>

#ifdef KORE_OPENGL
#ifdef KINC_OPENGL
#include <kinc/backend/graphics4/ShaderStorageBufferImpl.h>
#endif
#include <Kore/Graphics4/Graphics.h>
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Sources/Kore/Graphics4/Graphics.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#ifdef KORE_G4
#ifdef KINC_G4

#include "Graphics.h"
#include "PipelineState.h"
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Kore/Graphics4/Graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Kore {
class ComputeShader;
class PipelineState;
class TextureArray;
#ifdef KORE_OPENGL
#ifdef KINC_OPENGL
class ShaderStorageBuffer;
#endif

Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Sources/Kore/Graphics4/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Kore/Graphics4/Texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ 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);
void _setImage(TextureUnit unit);
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);
Expand Down
2 changes: 1 addition & 1 deletion Sources/Kore/Graphics5/CommandList.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Kore {
class Sampler;
class Texture;
class VertexBuffer;
#ifdef KORE_OPENGL
#ifdef KINC_OPENGL
class ShaderStorageBuffer;
#endif

Expand Down
2 changes: 1 addition & 1 deletion Sources/Kore/Graphics5/Compute.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <kinc/graphics5/compute.h>

#ifdef KORE_OPENGL
#ifdef KINC_OPENGL
#include <kinc/backend/graphics4/ShaderStorageBufferImpl.h>
#endif
#include <Kore/Graphics5/Graphics.h>
Expand Down
4 changes: 2 additions & 2 deletions Sources/Kore/Graphics5/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Kore/Graphics5/Texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ 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);
// void _setImage(TextureUnit unit);
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);
Expand Down
28 changes: 14 additions & 14 deletions Sources/Kore/IO/Reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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) |
Expand All @@ -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) |
Expand All @@ -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) |
Expand All @@ -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) |
Expand All @@ -63,63 +63,63 @@ 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);
#endif
}

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);
#endif
}

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);
#endif
}

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);
#endif
}

u16 Reader::readU16LE(u8 *data) {
#ifdef KORE_LITTLE_ENDIAN
#ifdef KINC_LITTLE_ENDIAN
return *(u16 *)data;
#else
return (data[0] << 0) | (data[1] << 8);
#endif
}

u16 Reader::readU16BE(u8 *data) {
#ifdef KORE_BIG_ENDIAN
#ifdef KINC_BIG_ENDIAN
return *(u16 *)data;
#else
return (data[1] << 0) | (data[0] << 8);
#endif
}

s16 Reader::readS16LE(u8 *data) {
#ifdef KORE_LITTLE_ENDIAN
#ifdef KINC_LITTLE_ENDIAN
return *(s16 *)data;
#else
return (data[0] << 0) | (data[1] << 8);
#endif
}

s16 Reader::readS16BE(u8 *data) {
#ifdef KORE_BIG_ENDIAN
#ifdef KINC_BIG_ENDIAN
return *(s16 *)data;
#else
return (data[1] << 0) | (data[0] << 8);
Expand Down
2 changes: 1 addition & 1 deletion Sources/Kore/IO/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
Loading

0 comments on commit 8ab3ed0

Please sign in to comment.