[host] windows: fix compilation under gcc

This commit is contained in:
Geoffrey McRae 2024-01-31 01:33:43 +11:00
parent 72b25b99bc
commit cae4b2f4f9
6 changed files with 31 additions and 7 deletions

View File

@ -16,7 +16,7 @@ add_library(platform_Windows STATIC
# allow use of functions for Windows 7 or later
add_compile_definitions(WINVER=0x0601 _WIN32_WINNT=0x0601)
add_definitions("-DCOBJMACROS -DINITGUID -DWIDL_C_INLINE_WRAPPERS")
add_definitions("-DCOBJMACROS -DINITGUID")
add_subdirectory("capture")

View File

@ -6,10 +6,9 @@ add_library(capture_D12 STATIC
backend/dd.c
)
add_definitions("-DCOBJMACROS -DINITGUID -DWIDL_C_INLINE_WRAPPERS")
target_link_libraries(capture_D12
lg_common
platform_Windows
d3d11
dxgi
dwmapi

View File

@ -111,6 +111,19 @@ static ID3D12Resource * d12_frameBufferToResource(
FrameBuffer * frameBuffer,
unsigned size);
// workarounds
static D3D12_HEAP_DESC _ID3D12Heap_GetDesc(ID3D12Heap* This)
{
D3D12_HEAP_DESC __ret;
return *This->lpVtbl->GetDesc(This, &__ret);
}
static D3D12_RESOURCE_DESC _ID3D12Resource_GetDesc(ID3D12Resource* This) {
D3D12_RESOURCE_DESC __ret;
return *This->lpVtbl->GetDesc(This,&__ret);
}
// implementation
static const char * d12_getName(void)
@ -262,7 +275,7 @@ retryCreateCommandQueue:
}
// Adjust the alignSize based on the required heap alignment
D3D12_HEAP_DESC heapDesc = ID3D12Heap_GetDesc(*ivshmemHeap);
D3D12_HEAP_DESC heapDesc = _ID3D12Heap_GetDesc(*ivshmemHeap);
*alignSize = heapDesc.Alignment;
// initialize the backend
@ -329,7 +342,7 @@ static CaptureResult d12_waitFrame(unsigned frameBufferIndex,
goto exit;
}
D3D12_RESOURCE_DESC desc = ID3D12Resource_GetDesc(*src);
D3D12_RESOURCE_DESC desc = _ID3D12Resource_GetDesc(*src);
if (desc.Width != this->lastFormat.Width ||
desc.Height != this->lastFormat.Height ||
desc.Format != this->lastFormat.Format)
@ -384,7 +397,7 @@ static CaptureResult d12_getFrame(unsigned frameBufferIndex,
goto exit;
// copy into the framebuffer resource
D3D12_RESOURCE_DESC desc = ID3D12Resource_GetDesc(*src);
D3D12_RESOURCE_DESC desc = _ID3D12Resource_GetDesc(*src);
D3D12_TEXTURE_COPY_LOCATION srcLoc =
{
.pResource = *src,

View File

@ -15,6 +15,7 @@ add_library(capture_DXGI STATIC
target_link_libraries(capture_DXGI
lg_common
platform_Windows
d3d11
dxgi
dwmapi

View File

@ -95,6 +95,12 @@ typedef HRESULT (*D3D12GetDebugInterface_t)(
void **ppvDebug
);
static D3D12_HEAP_DESC _ID3D12Heap_GetDesc(ID3D12Heap* This)
{
D3D12_HEAP_DESC __ret;
return *This->lpVtbl->GetDesc(This, &__ret);
}
static void d3d12_free(void);
static bool d3d12_create(
@ -189,7 +195,7 @@ static bool d3d12_create(
return false;
}
D3D12_HEAP_DESC heapDesc = ID3D12Heap_GetDesc(*heap);
D3D12_HEAP_DESC heapDesc = _ID3D12Heap_GetDesc(*heap);
DEBUG_INFO("ID3D12Heap : Size:%I64u Alignment:%I64u",
heapDesc.SizeInBytes, heapDesc.Alignment);
*alignSize = heapDesc.Alignment;

View File

@ -18,6 +18,9 @@
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _H_COMREF_
#define _H_COMREF_
#include <stdbool.h>
#include <windows.h>
#include <malloc.h>
@ -96,3 +99,5 @@ inline static ULONG comRef_release(IUnknown ** ref)
}
#define comRef_release(ref) comRef_release((IUnknown **)(ref))
#endif