[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 # allow use of functions for Windows 7 or later
add_compile_definitions(WINVER=0x0601 _WIN32_WINNT=0x0601) add_compile_definitions(WINVER=0x0601 _WIN32_WINNT=0x0601)
add_definitions("-DCOBJMACROS -DINITGUID -DWIDL_C_INLINE_WRAPPERS") add_definitions("-DCOBJMACROS -DINITGUID")
add_subdirectory("capture") add_subdirectory("capture")

View File

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

View File

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

View File

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

View File

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

View File

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