Skip to content

Commit

Permalink
Fix windows compile
Browse files Browse the repository at this point in the history
  • Loading branch information
luboslenco committed Feb 19, 2025
1 parent 71ee0c1 commit 968a6c7
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static ID3D12RootSignature *globalComputeRootSignature = NULL;

#include <stdbool.h>

#define MAXIMUM_WINDOWS 16
#define MAXIMUM_WINDOWS 1

struct dx_ctx {
struct dx_window windows[MAXIMUM_WINDOWS];
Expand Down
15 changes: 0 additions & 15 deletions armorcore/sources/backends/direct3d12/kinc/backend/g5_raytrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,3 @@ typedef struct {
struct ID3D12Resource *bottom_level_accel[16];
struct ID3D12Resource *top_level_accel;
} kinc_g5_raytrace_acceleration_structure_impl_t;

typedef struct {
struct ID3D12Resource *renderTarget;
struct ID3D12Resource *renderTargetReadback;
struct ID3D12DescriptorHeap *renderTargetDescriptorHeap;
struct ID3D12DescriptorHeap *srvDescriptorHeap;
struct ID3D12DescriptorHeap *depthStencilDescriptorHeap;
struct ID3D12DescriptorHeap *srvDepthDescriptorHeap;
struct ID3D12Resource *depthStencilTexture;
struct D3D12Viewport viewport;
struct D3D12Rect scissor;
int stage;
int stage_depth;
int framebuffer_index;
} RenderTarget5Impl;
17 changes: 17 additions & 0 deletions armorcore/sources/backends/direct3d12/kinc/backend/g5_texture.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include "d3d12mini.h"

struct ID3D12Resource;
struct ID3D12DescriptorHeap;
struct ID3D12GraphicsCommandList;
Expand All @@ -22,3 +24,18 @@ struct kinc_g5_command_list;

void kinc_g5_internal_set_textures(struct kinc_g5_command_list *commandList);
void kinc_g5_internal_texture_set(struct kinc_g5_command_list *commandList, struct kinc_g5_texture *texture, int unit);

typedef struct {
struct ID3D12Resource *renderTarget;
struct ID3D12Resource *renderTargetReadback;
struct ID3D12DescriptorHeap *renderTargetDescriptorHeap;
struct ID3D12DescriptorHeap *srvDescriptorHeap;
struct ID3D12DescriptorHeap *depthStencilDescriptorHeap;
struct ID3D12DescriptorHeap *srvDepthDescriptorHeap;
struct ID3D12Resource *depthStencilTexture;
struct D3D12Viewport viewport;
struct D3D12Rect scissor;
int stage;
int stage_depth;
int framebuffer_index;
} RenderTarget5Impl;
52 changes: 0 additions & 52 deletions armorcore/sources/backends/windows/kinc/backend/microsoftunit.c

This file was deleted.

7 changes: 0 additions & 7 deletions armorcore/sources/backends/windows/kinc/backend/miniwindows.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
#pragma once

#ifdef _WIN64
typedef __int64 INT_PTR;
typedef unsigned __int64 UINT_PTR;
typedef __int64 LONG_PTR;
typedef unsigned __int64 ULONG_PTR;
#else
typedef _W64 int INT_PTR;
typedef _W64 unsigned int UINT_PTR;
typedef _W64 long LONG_PTR;
typedef _W64 unsigned long ULONG_PTR;
#endif // WIN64

typedef unsigned long DWORD;
typedef DWORD *LPDWORD;
Expand Down
2 changes: 1 addition & 1 deletion armorcore/sources/backends/windows/kinc/backend/system.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ LRESULT WINAPI KoreWindowsMessageProcedure(HWND hWnd, UINT msg, WPARAM wParam, L
kinc_window_resize(last_window_width, last_window_height);
}
if (last_window_x > INT_MIN && last_window_y > INT_MIN) {
kinc_window_move(slast_window_x, last_window_y);
kinc_window_move(last_window_x, last_window_y);
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions armorcore/sources/backends/windows/kinc/backend/windowsunit.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ enum tagPOINTER_INPUT_TYPE {
PT_TOUCHPAD = 5, // Touchpad
};

#include <assert.h>
#include <intrin.h>
#include <stdio.h>
#include "system_microsoft.c.h"
#include "mutex.c.h"
#include "thread.c.h"

#include "windows.c.h"
#include "base.c.h"
Expand Down
2 changes: 1 addition & 1 deletion armorcore/sources/iron.h
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ void _drop_files(wchar_t *file_path, void *data) {
POINT p;
GetCursorPos(&p);
ScreenToClient(kinc_windows_window_handle(), &p);
_mouse_move(0, p.x, p.y, 0, 0, NULL);
_mouse_move(p.x, p.y, 0, 0, NULL);
#endif

char buffer[1024];
Expand Down
4 changes: 0 additions & 4 deletions armorcore/sources/kinc/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
#define KINC_INLINE static __attribute__((always_inline)) inline
#endif

#ifdef _MSC_VER
#define KINC_MICROSOFT
#endif

#if defined(_WIN32)

#define KINC_WINDOWS
Expand Down
4 changes: 2 additions & 2 deletions armorcore/sources/kinc/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void kinc_log_args(kinc_log_level_t log_level, const char *format, va_list args)
#undef KINC_IMPLEMENTATION
#endif

#ifdef KINC_MICROSOFT
#ifdef KINC_WINDOWS
#include <kinc/backend/miniwindows.h>
#include <kinc/backend/system_microsoft.h>
#endif
Expand Down Expand Up @@ -61,7 +61,7 @@ void kinc_log_args(kinc_log_level_t level, const char *format, va_list args) {
}
va_end(args_android_copy);
#endif
#ifdef KINC_MICROSOFT
#ifdef KINC_WINDOWS
#ifdef UTF8
wchar_t buffer[4096];
kinc_microsoft_format(format, args, buffer);
Expand Down
2 changes: 1 addition & 1 deletion armorcore/sources/kinc/rootunit.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "system.h"
#include "window.h"
#include "http.h"
#include "socket.h"
// #include "socket.h"
#include "filereader.h"
#include "filewriter.h"
#include "gamepad.h"
Expand Down
11 changes: 2 additions & 9 deletions armorcore/sources/kinc/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,13 @@ typedef enum kinc_socket_family {
KINC_SOCKET_FAMILY_IP6
} kinc_socket_family_t;

#ifdef KINC_MICROSOFT
#if defined(_WIN64)
#ifdef KINC_WINDOWS
typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
#else
#if !defined _W64
#define _W64
#endif
typedef _W64 unsigned int UINT_PTR, *PUINT_PTR;
#endif
typedef UINT_PTR SOCKET;
#endif

typedef struct kinc_socket {
#ifdef KINC_MICROSOFT
#ifdef KINC_WINDOWS
SOCKET handle;
#else
int handle;
Expand Down

0 comments on commit 968a6c7

Please sign in to comment.