Merge pull request #6166 from aliaspider/master

(D3D12) add remaining guids.
This commit is contained in:
Twinaphex 2018-01-24 07:59:53 +01:00 committed by GitHub
commit f86b80e2b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 764 additions and 481 deletions

View File

@ -49,16 +49,16 @@ HRESULT WINAPI D3D10CreateDeviceAndSwapChain(
return TYPE_E_CANTLOADLIBRARY;
if (!fp)
fp = (PFN_D3D10_CREATE_DEVICE_AND_SWAP_CHAIN)dylib_proc(d3d10_dll, "D3D10CreateDeviceAndSwapChain");
fp = (PFN_D3D10_CREATE_DEVICE_AND_SWAP_CHAIN)dylib_proc(
d3d10_dll, "D3D10CreateDeviceAndSwapChain");
if (!fp)
return TYPE_E_CANTLOADLIBRARY;
return fp(pAdapter,DriverType,Software, Flags, SDKVersion, pSwapChainDesc, ppSwapChain, ppDevice);
return fp(
pAdapter, DriverType, Software, Flags, SDKVersion, pSwapChainDesc, ppSwapChain, ppDevice);
}
void d3d10_init_texture(D3D10Device device, d3d10_texture_t* texture)
{
Release(texture->handle);
@ -78,8 +78,7 @@ void d3d10_init_texture(D3D10Device device, d3d10_texture_t* texture)
D3D10CreateTexture2D(device, &texture->desc, NULL, &texture->handle);
{
D3D10_SHADER_RESOURCE_VIEW_DESC view_desc =
{
D3D10_SHADER_RESOURCE_VIEW_DESC view_desc = {
.Format = texture->desc.Format,
.ViewDimension = D3D_SRV_DIMENSION_TEXTURE2D,
.Texture2D.MostDetailedMip = 0,
@ -97,13 +96,28 @@ void d3d10_init_texture(D3D10Device device, d3d10_texture_t* texture)
}
}
void d3d10_update_texture(int width, int height, int pitch, DXGI_FORMAT format, const void* data, d3d10_texture_t* texture)
#include <gfx/scaler/pixconv.h>
void d3d10_update_texture(
int width,
int height,
int pitch,
DXGI_FORMAT format,
const void* data,
d3d10_texture_t* texture)
{
D3D10_MAPPED_TEXTURE2D mapped_texture;
D3D10MapTexture2D(texture->staging, 0, D3D10_MAP_WRITE, 0, &mapped_texture);
dxgi_copy(width, height, format, pitch, data, texture->desc.Format, mapped_texture.RowPitch, mapped_texture.pData);
#if 0
PERF_START();
conv_rgb565_argb8888(mapped_texture.pData, data, width, height, mapped_texture.RowPitch, pitch);
PERF_STOP();
#else
dxgi_copy(
width, height, format, pitch, data, texture->desc.Format, mapped_texture.RowPitch,
mapped_texture.pData);
#endif
D3D10UnmapTexture2D(texture->staging, 0);
@ -111,15 +125,16 @@ void d3d10_update_texture(int width, int height, int pitch, DXGI_FORMAT format,
texture->dirty = true;
}
DXGI_FORMAT d3d10_get_closest_match(D3D10Device device, DXGI_FORMAT desired_format, UINT desired_format_support)
DXGI_FORMAT
d3d10_get_closest_match(D3D10Device device, DXGI_FORMAT desired_format, UINT desired_format_support)
{
DXGI_FORMAT* format = dxgi_get_format_fallback_list(desired_format);
UINT format_support;
while (*format != DXGI_FORMAT_UNKNOWN)
{
if(SUCCEEDED(D3D10CheckFormatSupport(device, *format, &format_support))
&& ((format_support & desired_format_support) == desired_format_support))
if (SUCCEEDED(D3D10CheckFormatSupport(device, *format, &format_support)) &&
((format_support & desired_format_support) == desired_format_support))
break;
format++;
}

View File

@ -19,9 +19,19 @@
static dylib_t d3d11_dll;
HRESULT WINAPI D3D11CreateDeviceAndSwapChain( IDXGIAdapter* pAdapter,D3D_DRIVER_TYPE DriverType, HMODULE Software, UINT Flags,
CONST D3D_FEATURE_LEVEL* pFeatureLevels, UINT FeatureLevels, UINT SDKVersion, CONST DXGI_SWAP_CHAIN_DESC* pSwapChainDesc,
IDXGISwapChain** ppSwapChain, ID3D11Device** ppDevice, D3D_FEATURE_LEVEL* pFeatureLevel, ID3D11DeviceContext** ppImmediateContext)
HRESULT WINAPI D3D11CreateDeviceAndSwapChain(
IDXGIAdapter* pAdapter,
D3D_DRIVER_TYPE DriverType,
HMODULE Software,
UINT Flags,
CONST D3D_FEATURE_LEVEL* pFeatureLevels,
UINT FeatureLevels,
UINT SDKVersion,
CONST DXGI_SWAP_CHAIN_DESC* pSwapChainDesc,
IDXGISwapChain** ppSwapChain,
ID3D11Device** ppDevice,
D3D_FEATURE_LEVEL* pFeatureLevel,
ID3D11DeviceContext** ppImmediateContext)
{
static PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN fp;
@ -32,14 +42,15 @@ HRESULT WINAPI D3D11CreateDeviceAndSwapChain( IDXGIAdapter* pAdapter,D3D_DRIVER_
return TYPE_E_CANTLOADLIBRARY;
if (!fp)
fp = (PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN)dylib_proc(d3d11_dll, "D3D11CreateDeviceAndSwapChain");
fp = (PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN)dylib_proc(
d3d11_dll, "D3D11CreateDeviceAndSwapChain");
if (!fp)
return TYPE_E_CANTLOADLIBRARY;
return fp(pAdapter,DriverType,Software, Flags,pFeatureLevels, FeatureLevels, SDKVersion, pSwapChainDesc,
ppSwapChain, ppDevice, pFeatureLevel, ppImmediateContext);
return fp(
pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion,
pSwapChainDesc, ppSwapChain, ppDevice, pFeatureLevel, ppImmediateContext);
}
void d3d11_init_texture(D3D11Device device, d3d11_texture_t* texture)
@ -61,8 +72,7 @@ void d3d11_init_texture(D3D11Device device, d3d11_texture_t* texture)
D3D11CreateTexture2D(device, &texture->desc, NULL, &texture->handle);
{
D3D11_SHADER_RESOURCE_VIEW_DESC view_desc =
{
D3D11_SHADER_RESOURCE_VIEW_DESC view_desc = {
.Format = texture->desc.Format,
.ViewDimension = D3D_SRV_DIMENSION_TEXTURE2D,
.Texture2D.MostDetailedMip = 0,
@ -80,13 +90,22 @@ void d3d11_init_texture(D3D11Device device, d3d11_texture_t* texture)
}
}
void d3d11_update_texture(D3D11DeviceContext ctx, int width, int height, int pitch, DXGI_FORMAT format, const void* data, d3d11_texture_t* texture)
void d3d11_update_texture(
D3D11DeviceContext ctx,
int width,
int height,
int pitch,
DXGI_FORMAT format,
const void* data,
d3d11_texture_t* texture)
{
D3D11_MAPPED_SUBRESOURCE mapped_texture;
D3D11MapTexture2D(ctx, texture->staging, 0, D3D11_MAP_WRITE, 0, &mapped_texture);
dxgi_copy(width, height, format, pitch, data, texture->desc.Format, mapped_texture.RowPitch, mapped_texture.pData);
dxgi_copy(
width, height, format, pitch, data, texture->desc.Format, mapped_texture.RowPitch,
mapped_texture.pData);
D3D11UnmapTexture2D(ctx, texture->staging, 0);
@ -94,15 +113,15 @@ void d3d11_update_texture(D3D11DeviceContext ctx, int width, int height, int pit
texture->dirty = true;
}
DXGI_FORMAT d3d11_get_closest_match(D3D11Device device, DXGI_FORMAT desired_format, UINT desired_format_support)
DXGI_FORMAT
d3d11_get_closest_match(D3D11Device device, DXGI_FORMAT desired_format, UINT desired_format_support)
{
DXGI_FORMAT* format = dxgi_get_format_fallback_list(desired_format);
UINT format_support;
while (*format != DXGI_FORMAT_UNKNOWN)
{
if(SUCCEEDED(D3D11CheckFormatSupport(device, *format, &format_support))
&& ((format_support & desired_format_support) == desired_format_support))
if (SUCCEEDED(D3D11CheckFormatSupport(device, *format, &format_support)) &&
((format_support & desired_format_support) == desired_format_support))
break;
format++;
}

View File

@ -22,6 +22,7 @@
#include "verbosity.h"
#ifdef __MINGW32__
/* clang-format off */
#define DEFINE_GUIDW(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) const GUID DECLSPEC_SELECTANY name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUIDW(IID_ID3D12PipelineState, 0x765a30f3, 0xf624, 0x4c6f, 0xa8, 0x28, 0xac, 0xe9, 0x48, 0x62, 0x24, 0x45);
@ -33,6 +34,25 @@ DEFINE_GUIDW(IID_ID3D12DescriptorHeap, 0x8efb471d, 0x616c, 0x4f49, 0x90, 0xf7, 0
DEFINE_GUIDW(IID_ID3D12GraphicsCommandList, 0x5b160d0f, 0xac1b, 0x4185, 0x8b, 0xa8, 0xb3, 0xae, 0x42, 0xa5, 0xa4, 0x55);
DEFINE_GUIDW(IID_ID3D12CommandQueue, 0x0ec870a6, 0x5d7e, 0x4c22, 0x8c, 0xfc, 0x5b, 0xaa, 0xe0, 0x76, 0x16, 0xed);
DEFINE_GUIDW(IID_ID3D12Device, 0x189819f1, 0x1db6, 0x4b57, 0xbe, 0x54, 0x18, 0x21, 0x33, 0x9b, 0x85, 0xf7);
DEFINE_GUIDW(IID_ID3D12Object, 0xc4fec28f, 0x7966, 0x4e95, 0x9f, 0x94, 0xf4, 0x31, 0xcb, 0x56, 0xc3, 0xb8);
DEFINE_GUIDW(IID_ID3D12DeviceChild, 0x905db94b, 0xa00c, 0x4140, 0x9d, 0xf5, 0x2b, 0x64, 0xca, 0x9e, 0xa3, 0x57);
DEFINE_GUIDW(IID_ID3D12RootSignatureDeserializer, 0x34AB647B, 0x3CC8, 0x46AC, 0x84, 0x1B, 0xC0, 0x96, 0x56, 0x45, 0xC0, 0x46);
DEFINE_GUIDW(IID_ID3D12VersionedRootSignatureDeserializer, 0x7F91CE67, 0x090C, 0x4BB7, 0xB7, 0x8E, 0xED, 0x8F, 0xF2, 0xE3, 0x1D, 0xA0);
DEFINE_GUIDW(IID_ID3D12Pageable, 0x63ee58fb, 0x1268, 0x4835, 0x86, 0xda, 0xf0, 0x08, 0xce, 0x62, 0xf0, 0xd6);
DEFINE_GUIDW(IID_ID3D12Heap, 0x6b3b2502, 0x6e51, 0x45b3, 0x90, 0xee, 0x98, 0x84, 0x26, 0x5e, 0x8d, 0xf3);
DEFINE_GUIDW(IID_ID3D12QueryHeap, 0x0d9658ae, 0xed45, 0x469e, 0xa6, 0x1d, 0x97, 0x0e, 0xc5, 0x83, 0xca, 0xb4);
DEFINE_GUIDW(IID_ID3D12CommandSignature, 0xc36a797c, 0xec80, 0x4f0a, 0x89, 0x85, 0xa7, 0xb2, 0x47, 0x50, 0x82, 0xd1);
DEFINE_GUIDW(IID_ID3D12CommandList, 0x7116d91c, 0xe7e4, 0x47ce, 0xb8, 0xc6, 0xec, 0x81, 0x68, 0xf4, 0x37, 0xe5);
DEFINE_GUIDW(IID_ID3D12PipelineLibrary, 0xc64226a8, 0x9201, 0x46af, 0xb4, 0xcc, 0x53, 0xfb, 0x9f, 0xf7, 0x41, 0x4f);
DEFINE_GUIDW(IID_ID3D12Device1, 0x77acce80, 0x638e, 0x4e65, 0x88, 0x95, 0xc1, 0xf2, 0x33, 0x86, 0x86, 0x3e);
DEFINE_GUIDW(IID_ID3D12Debug, 0x344488b7, 0x6846, 0x474b, 0xb9, 0x89, 0xf0, 0x27, 0x44, 0x82, 0x45, 0xe0);
DEFINE_GUIDW(IID_ID3D12Debug1, 0xaffaa4ca, 0x63fe, 0x4d8e, 0xb8, 0xad, 0x15, 0x90, 0x00, 0xaf, 0x43, 0x04);
DEFINE_GUIDW(IID_ID3D12DebugDevice1, 0xa9b71770, 0xd099, 0x4a65, 0xa6, 0x98, 0x3d, 0xee, 0x10, 0x02, 0x0f, 0x88);
DEFINE_GUIDW(IID_ID3D12DebugDevice, 0x3febd6dd, 0x4973, 0x4787, 0x81, 0x94, 0xe4, 0x5f, 0x9e, 0x28, 0x92, 0x3e);
DEFINE_GUIDW(IID_ID3D12DebugCommandQueue, 0x09e0bf36, 0x54ac, 0x484f, 0x88, 0x47, 0x4b, 0xae, 0xea, 0xb6, 0x05, 0x3a);
DEFINE_GUIDW(IID_ID3D12DebugCommandList1, 0x102ca951, 0x311b, 0x4b01, 0xb1, 0x1f, 0xec, 0xb8, 0x3e, 0x06, 0x1b, 0x37);
DEFINE_GUIDW(IID_ID3D12DebugCommandList, 0x09e0bf36, 0x54ac, 0x484f, 0x88, 0x47, 0x4b, 0xae, 0xea, 0xb6, 0x05, 0x3f);
/* clang-format on */
#endif
static dylib_t d3d12_dll;
@ -77,7 +97,8 @@ HRESULT WINAPI D3D12GetDebugInterface(REFIID riid, void **ppvDebug)
return TYPE_E_CANTLOADLIBRARY;
}
HRESULT WINAPI D3D12SerializeRootSignature(const D3D12_ROOT_SIGNATURE_DESC *pRootSignature,
HRESULT WINAPI D3D12SerializeRootSignature(
const D3D12_ROOT_SIGNATURE_DESC* pRootSignature,
D3D_ROOT_SIGNATURE_VERSION Version,
ID3DBlob** ppBlob,
ID3DBlob** ppErrorBlob)
@ -160,14 +181,16 @@ bool d3d12_init_queue(d3d12_video_t *d3d12)
.Type = D3D12_COMMAND_LIST_TYPE_DIRECT,
.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE,
};
D3D12CreateCommandQueue(d3d12->device, (D3D12_COMMAND_QUEUE_DESC*)&desc, &d3d12->queue.handle);
D3D12CreateCommandQueue(
d3d12->device, (D3D12_COMMAND_QUEUE_DESC*)&desc, &d3d12->queue.handle);
}
D3D12CreateCommandAllocator(
d3d12->device, D3D12_COMMAND_LIST_TYPE_DIRECT, &d3d12->queue.allocator);
D3D12CreateGraphicsCommandList(d3d12->device, 0, D3D12_COMMAND_LIST_TYPE_DIRECT,
d3d12->queue.allocator, d3d12->pipe.handle, &d3d12->queue.cmd);
D3D12CreateGraphicsCommandList(
d3d12->device, 0, D3D12_COMMAND_LIST_TYPE_DIRECT, d3d12->queue.allocator,
d3d12->pipe.handle, &d3d12->queue.cmd);
D3D12CloseGraphicsCommandList(d3d12->queue.cmd);
@ -233,7 +256,8 @@ static void d3d12_init_descriptor_heap(D3D12Device device, d3d12_descriptor_heap
out->stride = D3D12GetDescriptorHandleIncrementSize(device, out->desc.Type);
}
static void d3d12_init_sampler(D3D12Device device,
static void d3d12_init_sampler(
D3D12Device device,
d3d12_descriptor_heap_t* heap,
descriptor_heap_slot_t heap_index,
D3D12_FILTER filter,
@ -306,14 +330,16 @@ bool d3d12_init_descriptors(d3d12_video_t *d3d12)
if (error)
{
RARCH_ERR("[D3D12]: CreateRootSignature failed :\n%s\n",
RARCH_ERR(
"[D3D12]: CreateRootSignature failed :\n%s\n",
(const char*)D3DGetBufferPointer(error));
Release(error);
return false;
}
D3D12CreateRootSignature(d3d12->device, 0, D3DGetBufferPointer(signature),
D3DGetBufferSize(signature), &d3d12->pipe.rootSignature);
D3D12CreateRootSignature(
d3d12->device, 0, D3DGetBufferPointer(signature), D3DGetBufferSize(signature),
&d3d12->pipe.rootSignature);
Release(signature);
}
@ -332,10 +358,12 @@ bool d3d12_init_descriptors(d3d12_video_t *d3d12)
d3d12->pipe.sampler_heap.desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
d3d12_init_descriptor_heap(d3d12->device, &d3d12->pipe.sampler_heap);
d3d12_init_sampler(d3d12->device, &d3d12->pipe.sampler_heap, SAMPLER_HEAP_SLOT_LINEAR,
d3d12_init_sampler(
d3d12->device, &d3d12->pipe.sampler_heap, SAMPLER_HEAP_SLOT_LINEAR,
D3D12_FILTER_MIN_MAG_MIP_LINEAR, D3D12_TEXTURE_ADDRESS_MODE_BORDER,
&d3d12->sampler_linear);
d3d12_init_sampler(d3d12->device, &d3d12->pipe.sampler_heap, SAMPLER_HEAP_SLOT_NEAREST,
d3d12_init_sampler(
d3d12->device, &d3d12->pipe.sampler_heap, SAMPLER_HEAP_SLOT_NEAREST,
D3D12_FILTER_MIN_MAG_MIP_POINT, D3D12_TEXTURE_ADDRESS_MODE_BORDER,
&d3d12->sampler_nearest);
return true;
@ -445,14 +473,14 @@ void d3d12_create_vertex_buffer(
.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR,
};
D3D12CreateCommittedResource(device,
(D3D12_HEAP_PROPERTIES*)&heap_props,
D3D12_HEAP_FLAG_NONE, &resource_desc,
D3D12CreateCommittedResource(
device, (D3D12_HEAP_PROPERTIES*)&heap_props, D3D12_HEAP_FLAG_NONE, &resource_desc,
D3D12_RESOURCE_STATE_GENERIC_READ, NULL, vbo);
view->BufferLocation = D3D12GetGPUVirtualAddress(*vbo);
}
void d3d12_init_texture(D3D12Device device,
void d3d12_init_texture(
D3D12Device device,
d3d12_descriptor_heap_t* heap,
descriptor_heap_slot_t heap_index,
d3d12_texture_t* texture)
@ -467,11 +495,13 @@ void d3d12_init_texture(D3D12Device device,
texture->desc.SampleDesc.Count = 1;
D3D12_HEAP_PROPERTIES heap_props = { D3D12_HEAP_TYPE_DEFAULT, 0, 0, 1, 1 };
D3D12CreateCommittedResource(device, &heap_props, D3D12_HEAP_FLAG_NONE, &texture->desc,
D3D12CreateCommittedResource(
device, &heap_props, D3D12_HEAP_FLAG_NONE, &texture->desc,
D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, NULL, &texture->handle);
}
D3D12GetCopyableFootprints(device, &texture->desc, 0, 1, 0, &texture->layout, &texture->num_rows,
D3D12GetCopyableFootprints(
device, &texture->desc, 0, 1, 0, &texture->layout, &texture->num_rows,
&texture->row_size_in_bytes, &texture->total_bytes);
{
@ -486,7 +516,8 @@ void d3d12_init_texture(D3D12Device device,
};
D3D12_HEAP_PROPERTIES heap_props = { D3D12_HEAP_TYPE_UPLOAD, 0, 0, 1, 1 };
D3D12CreateCommittedResource(device, &heap_props, D3D12_HEAP_FLAG_NONE, &buffer_desc,
D3D12CreateCommittedResource(
device, &heap_props, D3D12_HEAP_FLAG_NONE, &buffer_desc,
D3D12_RESOURCE_STATE_GENERIC_READ, NULL, &texture->upload_buffer);
}
@ -517,12 +548,14 @@ void d3d12_upload_texture(D3D12GraphicsCommandList cmd, d3d12_texture_t *texture
.SubresourceIndex = 0,
};
d3d12_resource_transition(cmd, texture->handle, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE,
d3d12_resource_transition(
cmd, texture->handle, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE,
D3D12_RESOURCE_STATE_COPY_DEST);
D3D12CopyTextureRegion(cmd, &dst, 0, 0, 0, &src, NULL);
d3d12_resource_transition(cmd, texture->handle, D3D12_RESOURCE_STATE_COPY_DEST,
d3d12_resource_transition(
cmd, texture->handle, D3D12_RESOURCE_STATE_COPY_DEST,
D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
texture->dirty = false;

File diff suppressed because it is too large Load Diff

View File

@ -19,30 +19,25 @@
#include "gfx/common/d3dcompiler_common.h"
#include "verbosity.h"
HRESULT WINAPI
D3DCompile(LPCVOID pSrcData, SIZE_T SrcDataSize, LPCSTR pSourceName,
CONST D3D_SHADER_MACRO *pDefines, ID3DInclude *pInclude, LPCSTR pEntrypoint,
LPCSTR pTarget, UINT Flags1, UINT Flags2, ID3DBlob **ppCode, ID3DBlob **ppErrorMsgs)
HRESULT WINAPI D3DCompile(
LPCVOID pSrcData,
SIZE_T SrcDataSize,
LPCSTR pSourceName,
CONST D3D_SHADER_MACRO* pDefines,
ID3DInclude* pInclude,
LPCSTR pEntrypoint,
LPCSTR pTarget,
UINT Flags1,
UINT Flags2,
ID3DBlob** ppCode,
ID3DBlob** ppErrorMsgs)
{
static dylib_t d3dcompiler_dll;
static const char *dll_list[] =
{
"D3DCompiler_47.dll",
"D3DCompiler_46.dll",
"D3DCompiler_45.dll",
"D3DCompiler_44.dll",
"D3DCompiler_43.dll",
"D3DCompiler_42.dll",
"D3DCompiler_41.dll",
"D3DCompiler_40.dll",
"D3DCompiler_39.dll",
"D3DCompiler_38.dll",
"D3DCompiler_37.dll",
"D3DCompiler_36.dll",
"D3DCompiler_35.dll",
"D3DCompiler_34.dll",
"D3DCompiler_33.dll",
NULL,
static const char* dll_list[] = {
"D3DCompiler_47.dll", "D3DCompiler_46.dll", "D3DCompiler_45.dll", "D3DCompiler_44.dll",
"D3DCompiler_43.dll", "D3DCompiler_42.dll", "D3DCompiler_41.dll", "D3DCompiler_40.dll",
"D3DCompiler_39.dll", "D3DCompiler_38.dll", "D3DCompiler_37.dll", "D3DCompiler_36.dll",
"D3DCompiler_35.dll", "D3DCompiler_34.dll", "D3DCompiler_33.dll", NULL,
};
const char** dll_name = dll_list;
@ -57,14 +52,14 @@ D3DCompile(LPCVOID pSrcData, SIZE_T SrcDataSize, LPCSTR pSourceName,
fp = (pD3DCompile)dylib_proc(d3dcompiler_dll, "D3DCompile");
if (fp)
return fp(pSrcData, SrcDataSize, pSourceName, pDefines, pInclude, pEntrypoint, pTarget, Flags1,
return fp(
pSrcData, SrcDataSize, pSourceName, pDefines, pInclude, pEntrypoint, pTarget, Flags1,
Flags2, ppCode, ppErrorMsgs);
}
return TYPE_E_CANTLOADLIBRARY;
}
bool d3d_compile(const char* src, size_t size, LPCSTR entrypoint, LPCSTR target, D3DBlob* out)
{
D3DBlob error_msg;
@ -74,7 +69,8 @@ bool d3d_compile(const char *src, size_t size, LPCSTR entrypoint, LPCSTR target,
compileflags |= D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;
#endif
if(FAILED(D3DCompile(src, size, NULL, NULL, NULL, entrypoint, target, compileflags, 0, out, &error_msg)))
if (FAILED(D3DCompile(
src, size, NULL, NULL, NULL, entrypoint, target, compileflags, 0, out, &error_msg)))
return false;
if (error_msg)

View File

@ -41,12 +41,16 @@
#if defined(__cplusplus) && !defined(CINTERFACE)
static inline ULONG Release(IUnknown* object)
{
if (object)
return object->Release();
return 0;
}
#else
static inline ULONG Release(void* object)
{
if (object)
return ((IUnknown*)object)->lpVtbl->Release(object);
return 0;
}
#endif
#endif
@ -56,33 +60,32 @@ static inline ULONG Release(void* object)
typedef ID3DBlob* D3DBlob;
typedef ID3DDestructionNotifier* D3DDestructionNotifier;
static inline ULONG D3DReleaseBlob(D3DBlob blob)
{
return blob->lpVtbl->Release(blob);
}
static inline ULONG D3DReleaseBlob(D3DBlob blob) { return blob->lpVtbl->Release(blob); }
static inline LPVOID D3DGetBufferPointer(D3DBlob blob)
{
return blob->lpVtbl->GetBufferPointer(blob);
}
static inline SIZE_T D3DGetBufferSize(D3DBlob blob)
{
return blob->lpVtbl->GetBufferSize(blob);
}
static inline SIZE_T D3DGetBufferSize(D3DBlob blob) { return blob->lpVtbl->GetBufferSize(blob); }
static inline ULONG D3DReleaseDestructionNotifier(D3DDestructionNotifier destruction_notifier)
{
return destruction_notifier->lpVtbl->Release(destruction_notifier);
}
static inline HRESULT D3DRegisterDestructionCallback(D3DDestructionNotifier destruction_notifier, PFN_DESTRUCTION_CALLBACK callback_fn, void* data, UINT* callback_id)
static inline HRESULT D3DRegisterDestructionCallback(
D3DDestructionNotifier destruction_notifier,
PFN_DESTRUCTION_CALLBACK callback_fn,
void* data,
UINT* callback_id)
{
return destruction_notifier->lpVtbl->RegisterDestructionCallback(destruction_notifier, callback_fn, data, callback_id);
return destruction_notifier->lpVtbl->RegisterDestructionCallback(
destruction_notifier, callback_fn, data, callback_id);
}
static inline HRESULT D3DUnregisterDestructionCallback(D3DDestructionNotifier destruction_notifier, UINT callback_id)
static inline HRESULT
D3DUnregisterDestructionCallback(D3DDestructionNotifier destruction_notifier, UINT callback_id)
{
return destruction_notifier->lpVtbl->UnregisterDestructionCallback(destruction_notifier, callback_id);
return destruction_notifier->lpVtbl->UnregisterDestructionCallback(
destruction_notifier, callback_id);
}
/* end of auto-generated */
bool d3d_compile(const char* src, size_t size, LPCSTR entrypoint, LPCSTR target, D3DBlob* out);

View File

@ -179,7 +179,8 @@ DXGI_FORMAT *dxgi_get_format_fallback_list(DXGI_FORMAT format)
break; \
}
/* r, g, b, a r, g, b, a */
/* clang-format off */
/* r, g, b, a, r, g, b, a */
#define DXGI_FORMAT_R8G8B8A8_UNORM_DESCS UINT32, 8, 8, 8, 8, 0, 8, 16, 24
#define DXGI_FORMAT_B8G8R8X8_UNORM_DESCS UINT32, 8, 8, 8, 0, 16, 8, 0, 0
#define DXGI_FORMAT_B8G8R8A8_UNORM_DESCS UINT32, 8, 8, 8, 8, 16, 8, 0, 24
@ -205,6 +206,7 @@ DXGI_FORMAT *dxgi_get_format_fallback_list(DXGI_FORMAT format)
FORMAT_DST(srcfmt, DXGI_FORMAT_B4G4R4A4_UNORM); \
FORMAT_DST(srcfmt, DXGI_FORMAT_B8G8R8A8_UNORM); \
FORMAT_DST(srcfmt, DXGI_FORMAT_EX_A4R4G4B4_UNORM)
/* clang-format on */
#ifdef _MSC_VER
#pragma warning(disable : 4293)

View File

@ -227,7 +227,8 @@ static bool d3d10_gfx_frame(
DXGIResizeBuffers(d3d10->swapChain, 0, 0, 0, 0, 0);
DXGIGetSwapChainBufferD3D10(d3d10->swapChain, 0, &backBuffer);
D3D10CreateTexture2DRenderTargetView(d3d10->device, backBuffer, NULL, &d3d10->renderTargetView);
D3D10CreateTexture2DRenderTargetView(
d3d10->device, backBuffer, NULL, &d3d10->renderTargetView);
Release(backBuffer);
D3D10SetRenderTargets(d3d10->device, 1, &d3d10->renderTargetView, NULL);
@ -236,7 +237,6 @@ static bool d3d10_gfx_frame(
d3d10->need_resize = false;
}
PERF_START();
D3D10ClearRenderTargetView(d3d10->device, d3d10->renderTargetView, d3d10->clearcolor);

View File

@ -240,7 +240,8 @@ static bool d3d11_gfx_frame(
DXGIResizeBuffers(d3d11->swapChain, 0, 0, 0, 0, 0);
DXGIGetSwapChainBufferD3D11(d3d11->swapChain, 0, &backBuffer);
D3D11CreateTexture2DRenderTargetView(d3d11->device, backBuffer, NULL, &d3d11->renderTargetView);
D3D11CreateTexture2DRenderTargetView(
d3d11->device, backBuffer, NULL, &d3d11->renderTargetView);
Release(backBuffer);
D3D11SetRenderTargets(d3d11->ctx, 1, &d3d11->renderTargetView, NULL);