More MSVC2013 buildfixes

This commit is contained in:
twinaphex 2018-01-29 17:19:36 +01:00
parent 2906744a0d
commit a6f8013c24
6 changed files with 298 additions and 265 deletions

View File

@ -2635,15 +2635,15 @@ static INLINE void D3D11SetVertexBuffer(
UINT stride, UINT stride,
UINT offset) UINT offset)
{ {
D3D11SetVertexBuffers(device_context, slot, 1, &vertex_buffer, &stride, &offset); D3D11SetVertexBuffers(device_context, slot, 1, (ID3D11Buffer** const)&vertex_buffer, &stride, &offset);
} }
static INLINE void D3D11SetVShaderConstantBuffer( static INLINE void D3D11SetVShaderConstantBuffer(
D3D11DeviceContext device_context, UINT slot, D3D11Buffer const constant_buffer) D3D11DeviceContext device_context, UINT slot, D3D11Buffer const constant_buffer)
{ {
D3D11SetVShaderConstantBuffers(device_context, slot, 1, &constant_buffer); D3D11SetVShaderConstantBuffers(device_context, slot, 1, (ID3D11Buffer** const)&constant_buffer);
} }
static INLINE void D3D11SetPShaderConstantBuffer( static INLINE void D3D11SetPShaderConstantBuffer(
D3D11DeviceContext device_context, UINT slot, D3D11Buffer const constant_buffer) D3D11DeviceContext device_context, UINT slot, D3D11Buffer const constant_buffer)
{ {
D3D11SetPShaderConstantBuffers(device_context, slot, 1, &constant_buffer); D3D11SetPShaderConstantBuffers(device_context, slot, 1, (ID3D11Buffer** const)&constant_buffer);
} }

View File

@ -19,7 +19,7 @@
#include "dxgi_common.h" #include "dxgi_common.h"
#include "d3dcompiler_common.h" #include "d3dcompiler_common.h"
#include "verbosity.h" #include "../verbosity.h"
#ifdef __MINGW32__ #ifdef __MINGW32__
/* clang-format off */ /* clang-format off */
@ -61,39 +61,51 @@ static const char* d3d12_dll_name = "d3d12.dll";
HRESULT WINAPI D3D12CreateDevice( HRESULT WINAPI D3D12CreateDevice(
IUnknown* pAdapter, D3D_FEATURE_LEVEL MinimumFeatureLevel, REFIID riid, void** ppDevice) IUnknown* pAdapter, D3D_FEATURE_LEVEL MinimumFeatureLevel, REFIID riid, void** ppDevice)
{ {
static PFN_D3D12_CREATE_DEVICE fp;
#ifdef HAVE_DYNAMIC
if (!d3d12_dll) if (!d3d12_dll)
d3d12_dll = dylib_load(d3d12_dll_name); d3d12_dll = dylib_load(d3d12_dll_name);
if (d3d12_dll) if (!d3d12_dll)
{ goto error;
static PFN_D3D12_CREATE_DEVICE fp;
if (!fp) if (!fp)
fp = (PFN_D3D12_CREATE_DEVICE)dylib_proc(d3d12_dll, "D3D12CreateDevice"); fp = (PFN_D3D12_CREATE_DEVICE)dylib_proc(d3d12_dll, "D3D12CreateDevice");
#else
fp = D3D12CreateDevice;
#endif
if (fp) if (fp)
return fp(pAdapter, MinimumFeatureLevel, riid, ppDevice); return fp(pAdapter, MinimumFeatureLevel, riid, ppDevice);
}
#ifdef HAVE_DYNAMIC
error:
#endif
return TYPE_E_CANTLOADLIBRARY; return TYPE_E_CANTLOADLIBRARY;
} }
HRESULT WINAPI D3D12GetDebugInterface(REFIID riid, void** ppvDebug) HRESULT WINAPI D3D12GetDebugInterface(REFIID riid, void** ppvDebug)
{ {
static PFN_D3D12_GET_DEBUG_INTERFACE fp;
#ifdef HAVE_DYNAMIC
if (!d3d12_dll) if (!d3d12_dll)
d3d12_dll = dylib_load(d3d12_dll_name); d3d12_dll = dylib_load(d3d12_dll_name);
if (d3d12_dll) if (!d3d12_dll)
{ goto error;
static PFN_D3D12_GET_DEBUG_INTERFACE fp;
if (!fp) if (!fp)
fp = (PFN_D3D12_GET_DEBUG_INTERFACE)dylib_proc(d3d12_dll, "D3D12GetDebugInterface"); fp = (PFN_D3D12_GET_DEBUG_INTERFACE)dylib_proc(d3d12_dll, "D3D12GetDebugInterface");
#else
fp = D3D12GetDebugInterface;
#endif
if (fp) if (fp)
return fp(riid, ppvDebug); return fp(riid, ppvDebug);
}
#ifdef HAVE_DYNAMIC
error:
#endif
return TYPE_E_CANTLOADLIBRARY; return TYPE_E_CANTLOADLIBRARY;
} }
@ -103,21 +115,27 @@ HRESULT WINAPI D3D12SerializeRootSignature(
ID3DBlob** ppBlob, ID3DBlob** ppBlob,
ID3DBlob** ppErrorBlob) ID3DBlob** ppErrorBlob)
{ {
static PFN_D3D12_SERIALIZE_ROOT_SIGNATURE fp;
#ifdef HAVE_DYNAMIC
if (!d3d12_dll) if (!d3d12_dll)
d3d12_dll = dylib_load(d3d12_dll_name); d3d12_dll = dylib_load(d3d12_dll_name);
if (d3d12_dll) if (!d3d12_dll)
{ goto error;
static PFN_D3D12_SERIALIZE_ROOT_SIGNATURE fp;
if (!fp) if (!fp)
fp = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)dylib_proc( fp = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)dylib_proc(
d3d12_dll, "D3D12SerializeRootSignature"); d3d12_dll, "D3D12SerializeRootSignature");
#else
fp = D3D12SerializeRootSignature;
#endif
if (fp) if (fp)
return fp(pRootSignature, Version, ppBlob, ppErrorBlob); return fp(pRootSignature, Version, ppBlob, ppErrorBlob);
}
#ifdef HAVE_DYNAMIC
error:
#endif
return TYPE_E_CANTLOADLIBRARY; return TYPE_E_CANTLOADLIBRARY;
} }
@ -126,26 +144,30 @@ HRESULT WINAPI D3D12SerializeVersionedRootSignature(
ID3DBlob** ppBlob, ID3DBlob** ppBlob,
ID3DBlob** ppErrorBlob) ID3DBlob** ppErrorBlob)
{ {
static PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE fp;
#ifdef HAVE_DYNAMIC
if (!d3d12_dll) if (!d3d12_dll)
d3d12_dll = dylib_load(d3d12_dll_name); d3d12_dll = dylib_load(d3d12_dll_name);
if (d3d12_dll) if (!d3d12_dll)
{ goto error;
static PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE fp;
if (!fp) if (!fp)
fp = (PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE)dylib_proc( fp = (PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE)dylib_proc(
d3d12_dll, "D3D12SerializeRootSignature"); d3d12_dll, "D3D12SerializeRootSignature");
#else
fp = (PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE)D3D12SerializeRootSignature;
#endif
if (fp) if (fp)
return fp(pRootSignature, ppBlob, ppErrorBlob); return fp(pRootSignature, ppBlob, ppErrorBlob);
}
#ifdef HAVE_DYNAMIC
error:
#endif
return TYPE_E_CANTLOADLIBRARY; return TYPE_E_CANTLOADLIBRARY;
} }
#include <wiiu/wiiu_dbg.h>
bool d3d12_init_base(d3d12_video_t* d3d12) bool d3d12_init_base(d3d12_video_t* d3d12)
{ {
@ -384,7 +406,7 @@ bool d3d12_init_pipeline(d3d12_video_t* d3d12)
D3DBlob ps_code; D3DBlob ps_code;
static const char stock[] = static const char stock[] =
#include "gfx/drivers/d3d_shaders/opaque_sm5.hlsl.h" #include "../drivers/d3d_shaders/opaque_sm5.hlsl.h"
; ;
static const D3D12_INPUT_ELEMENT_DESC inputElementDesc[] = { static const D3D12_INPUT_ELEMENT_DESC inputElementDesc[] = {
@ -532,13 +554,16 @@ void d3d12_init_texture(
} }
{ {
D3D12_SHADER_RESOURCE_VIEW_DESC view_desc = { D3D12_CPU_DESCRIPTOR_HANDLE handle;
.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING, D3D12_SHADER_RESOURCE_VIEW_DESC view_desc = { 0 };
.Format = texture->desc.Format,
.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D, view_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
.Texture2D.MipLevels = texture->desc.MipLevels, view_desc.Format = texture->desc.Format;
}; view_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
D3D12_CPU_DESCRIPTOR_HANDLE handle = { heap->cpu.ptr + heap_index * heap->stride }; view_desc.Texture2D.MipLevels = texture->desc.MipLevels;
handle.ptr = heap->cpu.ptr + heap_index * heap->stride;
D3D12CreateShaderResourceView(device, texture->handle, &view_desc, handle); D3D12CreateShaderResourceView(device, texture->handle, &view_desc, handle);
texture->gpu_descriptor.ptr = heap->gpu.ptr + heap_index * heap->stride; texture->gpu_descriptor.ptr = heap->gpu.ptr + heap_index * heap->stride;
} }
@ -546,17 +571,16 @@ void d3d12_init_texture(
void d3d12_upload_texture(D3D12GraphicsCommandList cmd, d3d12_texture_t* texture) void d3d12_upload_texture(D3D12GraphicsCommandList cmd, d3d12_texture_t* texture)
{ {
D3D12_TEXTURE_COPY_LOCATION src = { D3D12_TEXTURE_COPY_LOCATION src = { 0 };
.pResource = texture->upload_buffer, D3D12_TEXTURE_COPY_LOCATION dst = { 0 };
.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT,
.PlacedFootprint = texture->layout,
};
D3D12_TEXTURE_COPY_LOCATION dst = { src.pResource = texture->upload_buffer;
.pResource = texture->handle, src.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, src.PlacedFootprint = texture->layout;
.SubresourceIndex = 0,
}; dst.pResource = texture->handle;
dst.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
dst.SubresourceIndex = 0;
d3d12_resource_transition( d3d12_resource_transition(
cmd, texture->handle, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, cmd, texture->handle, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE,

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,11 @@
*/ */
#include <stdio.h> #include <stdio.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_DYNAMIC #ifdef HAVE_DYNAMIC
#include <dynamic/dylib.h> #include <dynamic/dylib.h>
#endif #endif

View File

@ -16,6 +16,7 @@
#pragma once #pragma once
#include <retro_inline.h> #include <retro_inline.h>
#include <boolean.h>
#ifdef __MINGW32__ #ifdef __MINGW32__
#define __REQUIRED_RPCNDR_H_VERSION__ 475 #define __REQUIRED_RPCNDR_H_VERSION__ 475

View File

@ -16,14 +16,15 @@
#include <assert.h> #include <assert.h>
#include <string/stdstring.h> #include <string/stdstring.h>
#include "driver.h" #include "../video_driver.h"
#include "verbosity.h" #include "../common/win32_common.h"
#include "configuration.h" #include "../common/dxgi_common.h"
#include "gfx/video_driver.h" #include "../common/d3d12_common.h"
#include "gfx/common/win32_common.h" #include "../common/d3dcompiler_common.h"
#include "gfx/common/dxgi_common.h"
#include "gfx/common/d3d12_common.h" #include "../../driver.h"
#include "gfx/common/d3dcompiler_common.h" #include "../../verbosity.h"
#include "../../configuration.h"
static void d3d12_set_filtering(void* data, unsigned index, bool smooth) static void d3d12_set_filtering(void* data, unsigned index, bool smooth)
{ {