This commit is contained in:
luboslenco
2025-03-18 16:04:16 +01:00
parent e0588a028c
commit 9d2f93ff45
9 changed files with 1254 additions and 1513 deletions
File diff suppressed because it is too large Load Diff
+13 -57
View File
@@ -3,12 +3,24 @@
#include <stdbool.h>
#include <stdint.h>
#define QUEUE_SLOT_COUNT 2
#define IRON_INTERNAL_G5_TEXTURE_COUNT 16
struct ID3D12CommandAllocator;
struct ID3D12GraphicsCommandList;
struct ID3D12Fence;
struct ID3D12Resource;
struct ID3D12DescriptorHeap;
struct IDXGISwapChain;
struct ID3D12PipelineState;
struct ID3D12RootSignature;
struct ID3D12StateObject;
struct iron_gpu_pipeline;
struct iron_gpu_texture;
struct iron_gpu_sampler;
struct iron_gpu_shader;
struct iron_gpu_command_list;
struct iron_gpu_buffer;
typedef void *HANDLE;
typedef unsigned __int64 UINT64;
@@ -29,8 +41,6 @@ struct D3D12Rect {
long bottom;
};
#define QUEUE_SLOT_COUNT 2
struct dx_window {
struct IDXGISwapChain *swapChain;
UINT64 current_fence_value;
@@ -45,12 +55,6 @@ struct dx_window {
bool vsync;
};
struct iron_gpu_pipeline;
struct iron_gpu_texture;
struct iron_gpu_sampler;
#define IRON_INTERNAL_G5_TEXTURE_COUNT 16
typedef struct {
struct ID3D12CommandAllocator *_commandAllocator;
struct ID3D12GraphicsCommandList *_commandList;
@@ -72,18 +76,6 @@ typedef struct {
struct ID3D12DescriptorHeap *samplerHeap;
} gpu_command_list_impl_t;
typedef struct {
uint32_t hash;
uint32_t index;
} iron_internal_hash_index_t;
struct iron_gpu_shader;
struct ID3D12PipelineState;
struct ID3D12GraphicsCommandList;
struct ID3D12RootSignature;
struct ID3D12DescriptorHeap;
typedef struct {
struct ID3D12PipelineState *pso;
int textures;
@@ -94,19 +86,8 @@ typedef struct {
uint32_t vertexSize;
int fragmentOffset;
uint32_t fragmentSize;
int geometryOffset;
uint32_t geometrySize;
int tessEvalOffset;
uint32_t tessEvalSize;
int tessControlOffset;
uint32_t tessControlSize;
} gpu_constant_location_impl_t;
struct iron_gpu_pipeline;
struct iron_gpu_command_list;
void iron_gpu_internal_setConstants(struct iron_gpu_command_list *commandList, struct iron_gpu_pipeline *pipeline);
typedef struct iron_gpu_sampler_impl {
struct ID3D12DescriptorHeap *sampler_heap;
} gpu_sampler_impl_t;
@@ -138,14 +119,6 @@ typedef struct {
int length;
} gpu_shader_impl_t;
struct ID3D12Resource;
struct ID3D12DescriptorHeap;
struct ID3D12GraphicsCommandList;
typedef struct {
int unit;
} TextureUnit5Impl;
typedef struct {
bool mipmap;
int stage;
@@ -157,25 +130,16 @@ 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;
} gpu_texture_impl_t;
struct iron_gpu_texture;
struct iron_gpu_command_list;
void iron_gpu_internal_set_textures(struct iron_gpu_command_list *commandList);
void iron_gpu_internal_texture_set(struct iron_gpu_command_list *commandList, struct iron_gpu_texture *texture, int unit);
struct ID3D12Resource;
struct D3D12VertexBufferView {
__int64 BufferLocation;
unsigned int SizeInBytes;
@@ -206,16 +170,8 @@ typedef struct {
struct ID3D12Resource *constant_buffer;
int mySize;
} gpu_buffer_impl_t;
struct iron_gpu_buffer;
void iron_gpu_internal_index_buffer_upload(struct iron_gpu_buffer *buffer, struct ID3D12GraphicsCommandList *commandList);
struct ID3D12StateObject;
struct ID3D12Resource;
typedef struct {
struct ID3D12StateObject *dxr_state;
struct ID3D12Resource *raygen_shader_table;
-5
View File
@@ -43,11 +43,6 @@ typedef struct {
void *_accelerationStructure;
} gpu_raytrace_acceleration_structure_impl_t;
typedef struct {
int index;
bool vertex;
} TextureUnit5Impl;
typedef struct {
void *_tex;
void *data;
-2
View File
@@ -3106,8 +3106,6 @@ void iron_gpu_texture_destroy(iron_gpu_texture_t *target) {
}
}
void iron_gpu_internal_texture_set(iron_gpu_texture_t *texture, int unit) {}
int iron_gpu_texture_stride(iron_gpu_texture_t *texture) {
return texture->impl.stride;
}
-5
View File
@@ -13,11 +13,6 @@ typedef struct {
uint32_t number;
} iron_internal_named_number;
typedef struct {
uint32_t hash;
uint32_t index;
} iron_internal_hash_index_t;
struct indexed_name {
uint32_t id;
char *name;
+4 -4
View File
@@ -147,12 +147,12 @@ static bool initDefaultDevice() {
a2_buffer.channel_count = 2;
bufferFrames = 0;
iron_microsoft_affirm(audioClient->lpVtbl->GetBufferSize(audioClient, &bufferFrames));
iron_microsoft_affirm(audioClient->lpVtbl->GetService(audioClient, &IID_IAudioRenderClient, (void **)&renderClient));
audioClient->lpVtbl->GetBufferSize(audioClient, &bufferFrames);
audioClient->lpVtbl->GetService(audioClient, &IID_IAudioRenderClient, (void **)&renderClient);
bufferEndEvent = CreateEvent(0, FALSE, FALSE, 0);
iron_microsoft_affirm(audioClient->lpVtbl->SetEventHandle(audioClient, bufferEndEvent));
audioClient->lpVtbl->SetEventHandle(audioClient, bufferEndEvent);
return true;
}
@@ -277,7 +277,7 @@ void iron_a2_init() {
audioProcessingDoneEvent = CreateEvent(0, FALSE, FALSE, 0);
iron_windows_co_initialize();
iron_microsoft_affirm(CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &IID_IMMDeviceEnumerator, (void **)&deviceEnumerator));
CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &IID_IMMDeviceEnumerator, (void **)&deviceEnumerator);
if (initDefaultDevice()) {
CreateThread(0, 65536, audioThread, NULL, 0, 0);
+1 -30
View File
@@ -136,35 +136,6 @@ enum tagPOINTER_INPUT_TYPE {
#define S_OK ((HRESULT)0L)
static void winerror(HRESULT result) {
LPVOID buffer = NULL;
DWORD dw = GetLastError();
__debugbreak();
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);
iron_error("Error: %s", buffer);
}
else {
iron_error("Unknown Windows error, return value was 0x%x.", result);
}
}
void iron_microsoft_affirm(HRESULT result) {
if (result != S_OK) {
winerror(result);
}
}
void iron_microsoft_affirm_message(HRESULT result, const char *format, ...) {
}
void iron_microsoft_format(const char *format, va_list args, wchar_t *buffer) {
char cbuffer[4096];
vsprintf(cbuffer, format, args);
@@ -1552,7 +1523,7 @@ static bool co_initialized = false;
void iron_windows_co_initialize(void) {
if (!co_initialized) {
iron_microsoft_affirm(CoInitializeEx(0, COINIT_MULTITHREADED));
CoInitializeEx(0, COINIT_MULTITHREADED);
co_initialized = true;
}
}
-2
View File
@@ -7,8 +7,6 @@ typedef long HRESULT;
struct HMONITOR__;
struct HWND__;
void iron_microsoft_affirm(HRESULT result);
void iron_microsoft_affirm_message(HRESULT result, const char *format, ...);
void iron_microsoft_format(const char *format, va_list args, wchar_t *buffer);
int iron_windows_get_display_for_monitor(struct HMONITOR__ *monitor);