diff --git a/gfx/common/d3d10_common.c b/gfx/common/d3d10_common.c index 5d91071db6..77ebb31a3a 100644 --- a/gfx/common/d3d10_common.c +++ b/gfx/common/d3d10_common.c @@ -13,6 +13,8 @@ * If not, see . */ +#define CINTERFACE + #include #include "d3d10_common.h" diff --git a/gfx/common/d3d10_common.h b/gfx/common/d3d10_common.h index d3e72a3fa0..4ae2074295 100644 --- a/gfx/common/d3d10_common.h +++ b/gfx/common/d3d10_common.h @@ -50,111 +50,56 @@ typedef ID3D10Debug* D3D10Debug; typedef ID3D10SwitchToRef* D3D10SwitchToRef; typedef ID3D10InfoQueue* D3D10InfoQueue; +#if !defined(__cplusplus) || defined(CINTERFACE) static INLINE void D3D10SetResourceEvictionPriority(D3D10Resource resource, UINT eviction_priority) { -#ifdef __cplusplus - resource->SetEvictionPriority(eviction_priority); -#else resource->lpVtbl->SetEvictionPriority(resource, eviction_priority); -#endif } static INLINE UINT D3D10GetResourceEvictionPriority(D3D10Resource resource) { -#ifdef __cplusplus - return resource->GetEvictionPriority(); -#else return resource->lpVtbl->GetEvictionPriority(resource); -#endif } static INLINE void D3D10SetBufferEvictionPriority(D3D10Buffer buffer, UINT eviction_priority) { -#ifdef __cplusplus - buffer->SetEvictionPriority(eviction_priority); -#else buffer->lpVtbl->SetEvictionPriority(buffer, eviction_priority); -#endif } static INLINE UINT D3D10GetBufferEvictionPriority(D3D10Buffer buffer) { -#ifdef __cplusplus - return buffer->GetEvictionPriority(); -#else return buffer->lpVtbl->GetEvictionPriority(buffer); -#endif } - static INLINE HRESULT D3D10MapBuffer(D3D10Buffer buffer, D3D10_MAP map_type, UINT map_flags, void** data) { -#ifdef __cplusplus - return buffer->Map(map_type, map_flags, data); -#else return buffer->lpVtbl->Map(buffer, map_type, map_flags, data); -#endif -} -static INLINE void D3D10UnmapBuffer(D3D10Buffer buffer) -{ -#ifdef __cplusplus - buffer->Unmap(); -#else - buffer->lpVtbl->Unmap(buffer); -#endif } +static INLINE void D3D10UnmapBuffer(D3D10Buffer buffer) { buffer->lpVtbl->Unmap(buffer); } static INLINE void -D3D10SetTexture1DEvictionPriority(D3D10Texture1D texture1d, - UINT eviction_priority) +D3D10SetTexture1DEvictionPriority(D3D10Texture1D texture1d, UINT eviction_priority) { -#ifdef __cplusplus - texture1d->SetEvictionPriority(eviction_priority); -#else texture1d->lpVtbl->SetEvictionPriority(texture1d, eviction_priority); -#endif } static INLINE UINT D3D10GetTexture1DEvictionPriority(D3D10Texture1D texture1d) { -#ifdef __cplusplus - return texture1d->GetEvictionPriority(); -#else return texture1d->lpVtbl->GetEvictionPriority(texture1d); -#endif } static INLINE HRESULT D3D10MapTexture1D( D3D10Texture1D texture1d, UINT subresource, D3D10_MAP map_type, UINT map_flags, void** data) { -#ifdef __cplusplus - return texture1d->Map(subresource, map_type, map_flags, data); -#else - return texture1d->lpVtbl->Map(texture1d, subresource, - map_type, map_flags, data); -#endif + return texture1d->lpVtbl->Map(texture1d, subresource, map_type, map_flags, data); } static INLINE void D3D10UnmapTexture1D(D3D10Texture1D texture1d, UINT subresource) { -#ifdef __cplusplus - texture1d->Unmap(subresource); -#else texture1d->lpVtbl->Unmap(texture1d, subresource); -#endif } static INLINE void D3D10SetTexture2DEvictionPriority(D3D10Texture2D texture2d, UINT eviction_priority) { -#ifdef __cplusplus - texture2d->SetEvictionPriority(eviction_priority); -#else texture2d->lpVtbl->SetEvictionPriority(texture2d, eviction_priority); -#endif } - static INLINE UINT D3D10GetTexture2DEvictionPriority(D3D10Texture2D texture2d) { -#ifdef __cplusplus - return texture2d->GetEvictionPriority(); -#else return texture2d->lpVtbl->GetEvictionPriority(texture2d); -#endif } - static INLINE HRESULT D3D10MapTexture2D( D3D10Texture2D texture2d, UINT subresource, @@ -162,40 +107,20 @@ static INLINE HRESULT D3D10MapTexture2D( UINT map_flags, D3D10_MAPPED_TEXTURE2D* mapped_tex2d) { -#ifdef __cplusplus - return texture2d->Map(subresource, map_type, map_flags, mapped_tex2d); -#else - return texture2d->lpVtbl->Map(texture2d, subresource, map_type, - map_flags, mapped_tex2d); -#endif + return texture2d->lpVtbl->Map(texture2d, subresource, map_type, map_flags, mapped_tex2d); } - static INLINE void D3D10UnmapTexture2D(D3D10Texture2D texture2d, UINT subresource) { -#ifdef __cplusplus - texture2d->Unmap(subresource); -#else texture2d->lpVtbl->Unmap(texture2d, subresource); -#endif } - static INLINE void -D3D10SetTexture3DEvictionPriority(D3D10Texture3D texture3d, - UINT eviction_priority) +D3D10SetTexture3DEvictionPriority(D3D10Texture3D texture3d, UINT eviction_priority) { -#ifdef __cplusplus - texture3d->SetEvictionPriority(eviction_priority); -#else texture3d->lpVtbl->SetEvictionPriority(texture3d, eviction_priority); -#endif } static INLINE UINT D3D10GetTexture3DEvictionPriority(D3D10Texture3D texture3d) { -#ifdef __cplusplus - return texture3d->GetEvictionPriority(); -#else return texture3d->lpVtbl->GetEvictionPriority(texture3d); -#endif } static INLINE HRESULT D3D10MapTexture3D( D3D10Texture3D texture3d, @@ -204,231 +129,91 @@ static INLINE HRESULT D3D10MapTexture3D( UINT map_flags, D3D10_MAPPED_TEXTURE3D* mapped_tex3d) { -#ifdef __cplusplus - return texture3d->Map(subresource, - map_type, map_flags, mapped_tex3d); -#else - return texture3d->lpVtbl->Map(texture3d, subresource, - map_type, map_flags, mapped_tex3d); -#endif + return texture3d->lpVtbl->Map(texture3d, subresource, map_type, map_flags, mapped_tex3d); } -static INLINE void D3D10UnmapTexture3D(D3D10Texture3D texture3d, - UINT subresource) +static INLINE void D3D10UnmapTexture3D(D3D10Texture3D texture3d, UINT subresource) { -#ifdef __cplusplus - texture3d->Unmap(subresource); -#else texture3d->lpVtbl->Unmap(texture3d, subresource); -#endif } - -static INLINE void D3D10GetViewResource(D3D10View view, - D3D10Resource* resource) +static INLINE void D3D10GetViewResource(D3D10View view, D3D10Resource* resource) { -#ifdef __cplusplus - view->GetResource(resource); -#else view->lpVtbl->GetResource(view, resource); -#endif } - static INLINE void D3D10GetShaderResourceViewResource( D3D10ShaderResourceView shader_resource_view, D3D10Resource* resource) { -#ifdef __cplusplus - shader_resource_view->GetResource(resource); -#else shader_resource_view->lpVtbl->GetResource(shader_resource_view, resource); -#endif } - static INLINE void -D3D10GetRenderTargetViewResource(D3D10RenderTargetView render_target_view, - D3D10Resource* resource) +D3D10GetRenderTargetViewResource(D3D10RenderTargetView render_target_view, D3D10Resource* resource) { -#ifdef __cplusplus - render_target_view->GetResource(resource); -#else render_target_view->lpVtbl->GetResource(render_target_view, resource); -#endif } - static INLINE void -D3D10GetDepthStencilViewResource(D3D10DepthStencilView depth_stencil_view, - D3D10Resource* resource) +D3D10GetDepthStencilViewResource(D3D10DepthStencilView depth_stencil_view, D3D10Resource* resource) { -#ifdef __cplusplus - depth_stencil_view->GetResource(resource); -#else depth_stencil_view->lpVtbl->GetResource(depth_stencil_view, resource); -#endif } - static INLINE void D3D10BeginAsynchronous(D3D10Asynchronous asynchronous) { -#ifdef __cplusplus - asynchronous->Begin(); -#else asynchronous->lpVtbl->Begin(asynchronous); -#endif } - static INLINE void D3D10EndAsynchronous(D3D10Asynchronous asynchronous) { -#ifdef __cplusplus - asynchronous->End(); -#else asynchronous->lpVtbl->End(asynchronous); -#endif } - static INLINE HRESULT D3D10GetAsynchronousData( - D3D10Asynchronous asynchronous, void* data, - UINT data_size, UINT get_data_flags) + D3D10Asynchronous asynchronous, void* data, UINT data_size, UINT get_data_flags) { -#ifdef __cplusplus - return asynchronous->GetData(data, - data_size, get_data_flags); -#else - return asynchronous->lpVtbl->GetData(asynchronous, data, - data_size, get_data_flags); -#endif + return asynchronous->lpVtbl->GetData(asynchronous, data, data_size, get_data_flags); } - -static INLINE UINT D3D10GetAsynchronousDataSize( - D3D10Asynchronous asynchronous) +static INLINE UINT D3D10GetAsynchronousDataSize(D3D10Asynchronous asynchronous) { -#ifdef __cplusplus - return asynchronous->GetDataSize(); -#else return asynchronous->lpVtbl->GetDataSize(asynchronous); -#endif } - -static INLINE void D3D10BeginQuery(D3D10Query query) -{ -#ifdef __cplusplus - query->Begin(); -#else - query->lpVtbl->Begin(query); -#endif -} - -static INLINE void D3D10EndQuery(D3D10Query query) -{ -#ifdef __cplusplus - query->End(); -#else - query->lpVtbl->End(query); -#endif -} - +static INLINE void D3D10BeginQuery(D3D10Query query) { query->lpVtbl->Begin(query); } +static INLINE void D3D10EndQuery(D3D10Query query) { query->lpVtbl->End(query); } static INLINE HRESULT -D3D10GetQueryData(D3D10Query query, void* data, - UINT data_size, UINT get_data_flags) +D3D10GetQueryData(D3D10Query query, void* data, UINT data_size, UINT get_data_flags) { -#ifdef __cplusplus - return query->GetData(data, data_size, get_data_flags); -#else return query->lpVtbl->GetData(query, data, data_size, get_data_flags); -#endif } - static INLINE UINT D3D10GetQueryDataSize(D3D10Query query) { -#ifdef __cplusplus - return query->GetDataSize(); -#else return query->lpVtbl->GetDataSize(query); -#endif } - static INLINE void D3D10BeginPredicate(D3D10Predicate predicate) { -#ifdef __cplusplus - predicate->Begin(); -#else predicate->lpVtbl->Begin(predicate); -#endif } - static INLINE void D3D10EndPredicate(D3D10Predicate predicate) { -#ifdef __cplusplus - predicate->End(); -#else predicate->lpVtbl->End(predicate); -#endif } - static INLINE HRESULT -D3D10GetPredicateData(D3D10Predicate predicate, void* data, - UINT data_size, UINT get_data_flags) +D3D10GetPredicateData(D3D10Predicate predicate, void* data, UINT data_size, UINT get_data_flags) { -#ifdef __cplusplus - return predicate->GetData(data, data_size, get_data_flags); -#else - return predicate->lpVtbl->GetData(predicate, data, - data_size, get_data_flags); -#endif + return predicate->lpVtbl->GetData(predicate, data, data_size, get_data_flags); } static INLINE UINT D3D10GetPredicateDataSize(D3D10Predicate predicate) { -#ifdef __cplusplus - return predicate->GetDataSize(); -#else return predicate->lpVtbl->GetDataSize(predicate); -#endif } - -static INLINE void D3D10BeginCounter(D3D10Counter counter) -{ -#ifdef __cplusplus - counter->Begin(); -#else - counter->lpVtbl->Begin(counter); -#endif -} - -static INLINE void D3D10EndCounter(D3D10Counter counter) -{ -#ifdef __cplusplus - counter->End(); -#else - counter->lpVtbl->End(counter); -#endif -} - +static INLINE void D3D10BeginCounter(D3D10Counter counter) { counter->lpVtbl->Begin(counter); } +static INLINE void D3D10EndCounter(D3D10Counter counter) { counter->lpVtbl->End(counter); } static INLINE HRESULT -D3D10GetCounterData(D3D10Counter counter, void* data, - UINT data_size, UINT get_data_flags) +D3D10GetCounterData(D3D10Counter counter, void* data, UINT data_size, UINT get_data_flags) { -#ifdef __cplusplus - return counter->GetData(data, data_size, get_data_flags); -#else return counter->lpVtbl->GetData(counter, data, data_size, get_data_flags); -#endif } - static INLINE UINT D3D10GetCounterDataSize(D3D10Counter counter) { -#ifdef __cplusplus - return counter->GetDataSize(); -#else return counter->lpVtbl->GetDataSize(counter); -#endif } - static INLINE void D3D10SetVShaderConstantBuffers( - D3D10Device device, UINT start_slot, UINT num_buffers, - D3D10Buffer* const constant_buffers) + D3D10Device device, UINT start_slot, UINT num_buffers, D3D10Buffer* const constant_buffers) { -#ifdef __cplusplus - device->VSSetConstantBuffers(start_slot, num_buffers, constant_buffers); -#else - device->lpVtbl->VSSetConstantBuffers(device, start_slot, - num_buffers, constant_buffers); -#endif + device->lpVtbl->VSSetConstantBuffers(device, start_slot, num_buffers, constant_buffers); } static INLINE void D3D10SetPShaderResources( D3D10Device device, @@ -436,92 +221,39 @@ static INLINE void D3D10SetPShaderResources( UINT num_views, D3D10ShaderResourceView* const shader_resource_views) { -#ifdef __cplusplus - device->PSSetShaderResources(start_slot, num_views, - shader_resource_views); -#else - device->lpVtbl->PSSetShaderResources(device, start_slot, - num_views, shader_resource_views); -#endif + device->lpVtbl->PSSetShaderResources(device, start_slot, num_views, shader_resource_views); } - -static INLINE void D3D10SetPShader(D3D10Device device, - D3D10PixelShader pixel_shader) +static INLINE void D3D10SetPShader(D3D10Device device, D3D10PixelShader pixel_shader) { -#ifdef __cplusplus - device->PSSetShader(pixel_shader); -#else device->lpVtbl->PSSetShader(device, pixel_shader); -#endif } - static INLINE void D3D10SetPShaderSamplers( - D3D10Device device, UINT start_slot, UINT num_samplers, - D3D10SamplerState* const samplers) + D3D10Device device, UINT start_slot, UINT num_samplers, D3D10SamplerState* const samplers) { -#ifdef __cplusplus - device->PSSetSamplers(start_slot, num_samplers, samplers); -#else - device->lpVtbl->PSSetSamplers(device, start_slot, - num_samplers, samplers); -#endif + device->lpVtbl->PSSetSamplers(device, start_slot, num_samplers, samplers); } - -static INLINE void D3D10SetVShader(D3D10Device device, - D3D10VertexShader vertex_shader) +static INLINE void D3D10SetVShader(D3D10Device device, D3D10VertexShader vertex_shader) { -#ifdef __cplusplus - device->VSSetShader(vertex_shader); -#else device->lpVtbl->VSSetShader(device, vertex_shader); -#endif } - static INLINE void D3D10DrawIndexed( - D3D10Device device, UINT index_count, - UINT start_index_location, INT base_vertex_location) + D3D10Device device, UINT index_count, UINT start_index_location, INT base_vertex_location) { -#ifdef __cplusplus - device->DrawIndexed(index_count, - start_index_location, base_vertex_location); -#else - device->lpVtbl->DrawIndexed(device, index_count, - start_index_location, base_vertex_location); -#endif + device->lpVtbl->DrawIndexed(device, index_count, start_index_location, base_vertex_location); } -static INLINE void D3D10Draw(D3D10Device device, - UINT vertex_count, UINT start_vertex_location) +static INLINE void D3D10Draw(D3D10Device device, UINT vertex_count, UINT start_vertex_location) { -#ifdef __cplusplus - device->Draw(vertex_count, start_vertex_location); -#else device->lpVtbl->Draw(device, vertex_count, start_vertex_location); -#endif } - static INLINE void D3D10SetPShaderConstantBuffers( - D3D10Device device, UINT start_slot, - UINT num_buffers, D3D10Buffer* const constant_buffers) + D3D10Device device, UINT start_slot, UINT num_buffers, D3D10Buffer* const constant_buffers) { -#ifdef __cplusplus - device->PSSetConstantBuffers(start_slot, - num_buffers, constant_buffers); -#else - device->lpVtbl->PSSetConstantBuffers(device, start_slot, - num_buffers, constant_buffers); -#endif + device->lpVtbl->PSSetConstantBuffers(device, start_slot, num_buffers, constant_buffers); } - -static INLINE void D3D10SetInputLayout(D3D10Device device, - D3D10InputLayout input_layout) +static INLINE void D3D10SetInputLayout(D3D10Device device, D3D10InputLayout input_layout) { -#ifdef __cplusplus - device->IASetInputLayout(input_layout); -#else device->lpVtbl->IASetInputLayout(device, input_layout); -#endif } - static INLINE void D3D10SetVertexBuffers( D3D10Device device, UINT start_slot, @@ -530,28 +262,14 @@ static INLINE void D3D10SetVertexBuffers( UINT* strides, UINT* offsets) { -#ifdef __cplusplus - device->IASetVertexBuffers( - start_slot, num_buffers, - vertex_buffers, strides, offsets); -#else device->lpVtbl->IASetVertexBuffers( - device, start_slot, num_buffers, - vertex_buffers, strides, offsets); -#endif + device, start_slot, num_buffers, vertex_buffers, strides, offsets); } - static INLINE void -D3D10SetIndexBuffer(D3D10Device device, - D3D10Buffer index_buffer, DXGI_FORMAT format, UINT offset) +D3D10SetIndexBuffer(D3D10Device device, D3D10Buffer index_buffer, DXGI_FORMAT format, UINT offset) { -#ifdef __cplusplus - device->IASetIndexBuffer(index_buffer, format, offset); -#else device->lpVtbl->IASetIndexBuffer(device, index_buffer, format, offset); -#endif } - static INLINE void D3D10DrawIndexedInstanced( D3D10Device device, UINT index_count_per_instance, @@ -560,19 +278,10 @@ static INLINE void D3D10DrawIndexedInstanced( INT base_vertex_location, UINT start_instance_location) { -#ifdef __cplusplus - device->DrawIndexedInstanced( - index_count_per_instance, - instance_count, start_index_location, - base_vertex_location, start_instance_location); -#else device->lpVtbl->DrawIndexedInstanced( - device, index_count_per_instance, - instance_count, start_index_location, + device, index_count_per_instance, instance_count, start_index_location, base_vertex_location, start_instance_location); -#endif } - static INLINE void D3D10DrawInstanced( D3D10Device device, UINT vertex_count_per_instance, @@ -580,209 +289,91 @@ static INLINE void D3D10DrawInstanced( UINT start_vertex_location, UINT start_instance_location) { -#ifdef __cplusplus - device->DrawInstanced( - vertex_count_per_instance, - instance_count, start_vertex_location, - start_instance_location); -#else device->lpVtbl->DrawInstanced( - device, vertex_count_per_instance, - instance_count, start_vertex_location, + device, vertex_count_per_instance, instance_count, start_vertex_location, start_instance_location); -#endif } - static INLINE void D3D10SetGShaderConstantBuffers( - D3D10Device device, UINT start_slot, - UINT num_buffers, D3D10Buffer* const constant_buffers) + D3D10Device device, UINT start_slot, UINT num_buffers, D3D10Buffer* const constant_buffers) { -#ifdef __cplusplus - device->GSSetConstantBuffers(start_slot, - num_buffers, constant_buffers); -#else - device->lpVtbl->GSSetConstantBuffers(device, start_slot, - num_buffers, constant_buffers); -#endif + device->lpVtbl->GSSetConstantBuffers(device, start_slot, num_buffers, constant_buffers); } - -static INLINE void D3D10SetGShader(D3D10Device device, - D3D10GeometryShader shader) +static INLINE void D3D10SetGShader(D3D10Device device, D3D10GeometryShader shader) { -#ifdef __cplusplus - device->GSSetShader(shader); -#else device->lpVtbl->GSSetShader(device, shader); -#endif } - -static INLINE void D3D10SetPrimitiveTopology(D3D10Device device, - D3D10_PRIMITIVE_TOPOLOGY topology) +static INLINE void D3D10SetPrimitiveTopology(D3D10Device device, D3D10_PRIMITIVE_TOPOLOGY topology) { -#ifdef __cplusplus - device->IASetPrimitiveTopology(topology); -#else device->lpVtbl->IASetPrimitiveTopology(device, topology); -#endif } - static INLINE void D3D10SetVShaderResources( D3D10Device device, UINT start_slot, UINT num_views, D3D10ShaderResourceView* const shader_resource_views) { -#ifdef __cplusplus - device->VSSetShaderResources(start_slot, - num_views, shader_resource_views); -#else - device->lpVtbl->VSSetShaderResources(device, start_slot, - num_views, shader_resource_views); -#endif + device->lpVtbl->VSSetShaderResources(device, start_slot, num_views, shader_resource_views); } - static INLINE void D3D10SetVShaderSamplers( - D3D10Device device, UINT start_slot, - UINT num_samplers, D3D10SamplerState* const samplers) + D3D10Device device, UINT start_slot, UINT num_samplers, D3D10SamplerState* const samplers) { -#ifdef __cplusplus - device->VSSetSamplers(start_slot, num_samplers, samplers); -#else - device->lpVtbl->VSSetSamplers(device, start_slot, - num_samplers, samplers); -#endif + device->lpVtbl->VSSetSamplers(device, start_slot, num_samplers, samplers); } - static INLINE void -D3D10SetPredication(D3D10Device device, D3D10Predicate predicate, - BOOL predicate_value) +D3D10SetPredication(D3D10Device device, D3D10Predicate predicate, BOOL predicate_value) { -#ifdef __cplusplus - device->SetPredication(predicate, predicate_value); -#else device->lpVtbl->SetPredication(device, predicate, predicate_value); -#endif } - static INLINE void D3D10SetGShaderResources( D3D10Device device, UINT start_slot, UINT num_views, D3D10ShaderResourceView* const shader_resource_views) { -#ifdef __cplusplus - device->GSSetShaderResources(start_slot, - num_views, shader_resource_views); -#else - device->lpVtbl->GSSetShaderResources(device, start_slot, - num_views, shader_resource_views); -#endif + device->lpVtbl->GSSetShaderResources(device, start_slot, num_views, shader_resource_views); } - static INLINE void D3D10SetGShaderSamplers( - D3D10Device device, UINT start_slot, - UINT num_samplers, D3D10SamplerState* const samplers) + D3D10Device device, UINT start_slot, UINT num_samplers, D3D10SamplerState* const samplers) { -#ifdef __cplusplus - device->GSSetSamplers(start_slot, - num_samplers, samplers); -#else - device->lpVtbl->GSSetSamplers(device, start_slot, - num_samplers, samplers); -#endif + device->lpVtbl->GSSetSamplers(device, start_slot, num_samplers, samplers); } - static INLINE void D3D10SetRenderTargets( D3D10Device device, UINT num_views, D3D10RenderTargetView* const render_target_views, D3D10DepthStencilView depth_stencil_view) { -#ifdef __cplusplus - device->OMSetRenderTargets(num_views, - render_target_views, depth_stencil_view); -#else - device->lpVtbl->OMSetRenderTargets(device, num_views, - render_target_views, depth_stencil_view); -#endif + device->lpVtbl->OMSetRenderTargets(device, num_views, render_target_views, depth_stencil_view); } - static INLINE void D3D10SetBlendState( - D3D10Device device, D3D10BlendState blend_state, - FLOAT blend_factor[4], UINT sample_mask) + D3D10Device device, D3D10BlendState blend_state, FLOAT blend_factor[4], UINT sample_mask) { -#ifdef __cplusplus - device->OMSetBlendState(blend_state, - blend_factor, sample_mask); -#else - device->lpVtbl->OMSetBlendState(device, blend_state, - blend_factor, sample_mask); -#endif + device->lpVtbl->OMSetBlendState(device, blend_state, blend_factor, sample_mask); } - static INLINE void D3D10SetDepthStencilState( - D3D10Device device, - D3D10DepthStencilState depth_stencil_state, UINT stencil_ref) + D3D10Device device, D3D10DepthStencilState depth_stencil_state, UINT stencil_ref) { -#ifdef __cplusplus - device->OMSetDepthStencilState(depth_stencil_state, stencil_ref); -#else - device->lpVtbl->OMSetDepthStencilState(device, depth_stencil_state, - stencil_ref); -#endif + device->lpVtbl->OMSetDepthStencilState(device, depth_stencil_state, stencil_ref); } - static INLINE void -D3D10SOSetTargets(D3D10Device device, UINT num_buffers, - D3D10Buffer* const sotargets, UINT* offsets) +D3D10SOSetTargets(D3D10Device device, UINT num_buffers, D3D10Buffer* const sotargets, UINT* offsets) { -#ifdef __cplusplus - device->SOSetTargets(num_buffers, sotargets, offsets); -#else device->lpVtbl->SOSetTargets(device, num_buffers, sotargets, offsets); -#endif } - -static INLINE void D3D10DrawAuto(D3D10Device device) +static INLINE void D3D10DrawAuto(D3D10Device device) { device->lpVtbl->DrawAuto(device); } +static INLINE void D3D10SetState(D3D10Device device, D3D10RasterizerState rasterizer_state) { -#ifdef __cplusplus - device->DrawAuto(); -#else - device->lpVtbl->DrawAuto(device); -#endif -} - -static INLINE void D3D10SetState(D3D10Device device, - D3D10RasterizerState rasterizer_state) -{ -#ifdef __cplusplus - device->RSSetState(rasterizer_state); -#else device->lpVtbl->RSSetState(device, rasterizer_state); -#endif } - static INLINE void -D3D10SetViewports(D3D10Device device, - UINT num_viewports, D3D10_VIEWPORT* viewports) +D3D10SetViewports(D3D10Device device, UINT num_viewports, D3D10_VIEWPORT* viewports) { -#ifdef __cplusplus - device->RSSetViewports(num_viewports, viewports); -#else device->lpVtbl->RSSetViewports(device, num_viewports, viewports); -#endif } - -static INLINE void D3D10SetScissorRects(D3D10Device device, - UINT num_rects, D3D10_RECT* rects) +static INLINE void D3D10SetScissorRects(D3D10Device device, UINT num_rects, D3D10_RECT* rects) { -#ifdef __cplusplus - device->RSSetScissorRects(num_rects, rects); -#else device->lpVtbl->RSSetScissorRects(device, num_rects, rects); -#endif } - static INLINE void D3D10CopySubresourceRegionDevice( D3D10Device device, D3D10Resource dst_resource, @@ -794,32 +385,15 @@ static INLINE void D3D10CopySubresourceRegionDevice( UINT src_subresource, D3D10_BOX* src_box) { -#ifdef __cplusplus - device->CopySubresourceRegion( - dst_resource, - dst_subresource, dst_x, dst_y, dst_z, - src_resource, src_subresource, - src_box); -#else device->lpVtbl->CopySubresourceRegion( - device, dst_resource, - dst_subresource, dst_x, dst_y, dst_z, - src_resource, src_subresource, + device, dst_resource, dst_subresource, dst_x, dst_y, dst_z, src_resource, src_subresource, src_box); -#endif } - static INLINE void -D3D10CopyResource(D3D10Device device, - D3D10Resource dst_resource, D3D10Resource src_resource) +D3D10CopyResource(D3D10Device device, D3D10Resource dst_resource, D3D10Resource src_resource) { -#ifdef __cplusplus - device->CopyResource(dst_resource, src_resource); -#else device->lpVtbl->CopyResource(device, dst_resource, src_resource); -#endif } - static INLINE void D3D10UpdateSubresource( D3D10Device device, D3D10Resource dst_resource, @@ -829,29 +403,14 @@ static INLINE void D3D10UpdateSubresource( UINT src_row_pitch, UINT src_depth_pitch) { -#ifdef __cplusplus - device->UpdateSubresource( - dst_resource, dst_subresource, - dst_box, src_data, src_row_pitch, src_depth_pitch); -#else device->lpVtbl->UpdateSubresource( - device, dst_resource, dst_subresource, - dst_box, src_data, src_row_pitch, src_depth_pitch); -#endif + device, dst_resource, dst_subresource, dst_box, src_data, src_row_pitch, src_depth_pitch); } - static INLINE void D3D10ClearRenderTargetView( - D3D10Device device, D3D10RenderTargetView render_target_view, - FLOAT color_rgba[4]) + D3D10Device device, D3D10RenderTargetView render_target_view, FLOAT color_rgba[4]) { -#ifdef __cplusplus - device->ClearRenderTargetView(render_target_view, color_rgba); -#else - device->lpVtbl->ClearRenderTargetView(device, - render_target_view, color_rgba); -#endif + device->lpVtbl->ClearRenderTargetView(device, render_target_view, color_rgba); } - static INLINE void D3D10ClearDepthStencilView( D3D10Device device, D3D10DepthStencilView depth_stencil_view, @@ -859,26 +418,13 @@ static INLINE void D3D10ClearDepthStencilView( FLOAT depth, UINT8 stencil) { -#ifdef __cplusplus - device->ClearDepthStencilView(depth_stencil_view, - clear_flags, depth, stencil); -#else - device->lpVtbl->ClearDepthStencilView(device, - depth_stencil_view, clear_flags, depth, stencil); -#endif + device->lpVtbl->ClearDepthStencilView(device, depth_stencil_view, clear_flags, depth, stencil); } - static INLINE void -D3D10GenerateMips(D3D10Device device, - D3D10ShaderResourceView shader_resource_view) +D3D10GenerateMips(D3D10Device device, D3D10ShaderResourceView shader_resource_view) { -#ifdef __cplusplus - device->GenerateMips(shader_resource_view); -#else device->lpVtbl->GenerateMips(device, shader_resource_view); -#endif } - static INLINE void D3D10ResolveSubresource( D3D10Device device, D3D10Resource dst_resource, @@ -887,101 +433,44 @@ static INLINE void D3D10ResolveSubresource( UINT src_subresource, DXGI_FORMAT format) { -#ifdef __cplusplus - device->ResolveSubresource( - dst_resource, dst_subresource, - src_resource, src_subresource, format); -#else device->lpVtbl->ResolveSubresource( - device, dst_resource, dst_subresource, - src_resource, src_subresource, format); -#endif + device, dst_resource, dst_subresource, src_resource, src_subresource, format); } - static INLINE void D3D10GetVShaderConstantBuffers( - D3D10Device device, UINT start_slot, - UINT num_buffers, D3D10Buffer* constant_buffers) + D3D10Device device, UINT start_slot, UINT num_buffers, D3D10Buffer* constant_buffers) { -#ifdef __cplusplus - device->VSGetConstantBuffers(start_slot, - num_buffers, constant_buffers); -#else - device->lpVtbl->VSGetConstantBuffers(device, start_slot, - num_buffers, constant_buffers); -#endif + device->lpVtbl->VSGetConstantBuffers(device, start_slot, num_buffers, constant_buffers); } - static INLINE void D3D10GetPShaderResources( D3D10Device device, UINT start_slot, UINT num_views, D3D10ShaderResourceView* shader_resource_views) { -#ifdef __cplusplus - device->PSGetShaderResources(start_slot, - num_views, shader_resource_views); -#else - device->lpVtbl->PSGetShaderResources(device, start_slot, - num_views, shader_resource_views); -#endif + device->lpVtbl->PSGetShaderResources(device, start_slot, num_views, shader_resource_views); } - -static INLINE void D3D10GetPShader(D3D10Device device, - D3D10PixelShader* pixel_shader) +static INLINE void D3D10GetPShader(D3D10Device device, D3D10PixelShader* pixel_shader) { -#ifdef __cplusplus - device->PSGetShader(pixel_shader); -#else device->lpVtbl->PSGetShader(device, pixel_shader); -#endif } - static INLINE void D3D10GetPShaderSamplers( - D3D10Device device, UINT start_slot, - UINT num_samplers, D3D10SamplerState* samplers) + D3D10Device device, UINT start_slot, UINT num_samplers, D3D10SamplerState* samplers) { -#ifdef __cplusplus - device->PSGetSamplers(start_slot, - num_samplers, samplers); -#else - device->lpVtbl->PSGetSamplers(device, start_slot, - num_samplers, samplers); -#endif + device->lpVtbl->PSGetSamplers(device, start_slot, num_samplers, samplers); } - -static INLINE void D3D10GetVShader(D3D10Device device, - D3D10VertexShader* vertex_shader) +static INLINE void D3D10GetVShader(D3D10Device device, D3D10VertexShader* vertex_shader) { -#ifdef __cplusplus - device->VSGetShader(vertex_shader); -#else device->lpVtbl->VSGetShader(device, vertex_shader); -#endif } - static INLINE void D3D10GetPShaderConstantBuffers( - D3D10Device device, UINT start_slot, - UINT num_buffers, D3D10Buffer* constant_buffers) + D3D10Device device, UINT start_slot, UINT num_buffers, D3D10Buffer* constant_buffers) { -#ifdef __cplusplus - device->PSGetConstantBuffers(start_slot, - num_buffers, constant_buffers); -#else - device->lpVtbl->PSGetConstantBuffers(device, start_slot, - num_buffers, constant_buffers); -#endif + device->lpVtbl->PSGetConstantBuffers(device, start_slot, num_buffers, constant_buffers); } - -static INLINE void D3D10GetInputLayout(D3D10Device device, - D3D10InputLayout* input_layout) +static INLINE void D3D10GetInputLayout(D3D10Device device, D3D10InputLayout* input_layout) { -#ifdef __cplusplus - device->IAGetInputLayout(input_layout); -#else device->lpVtbl->IAGetInputLayout(device, input_layout); -#endif } - static INLINE void D3D10GetVertexBuffers( D3D10Device device, UINT start_slot, @@ -990,296 +479,131 @@ static INLINE void D3D10GetVertexBuffers( UINT* strides, UINT* offsets) { -#ifdef __cplusplus - device->IAGetVertexBuffers( - start_slot, num_buffers, - vertex_buffers, strides, offsets); -#else device->lpVtbl->IAGetVertexBuffers( - device, start_slot, num_buffers, - vertex_buffers, strides, offsets); -#endif + device, start_slot, num_buffers, vertex_buffers, strides, offsets); } - static INLINE void D3D10GetIndexBuffer( - D3D10Device device, D3D10Buffer* index_buffer, - DXGI_FORMAT* format, UINT* offset) + D3D10Device device, D3D10Buffer* index_buffer, DXGI_FORMAT* format, UINT* offset) { -#ifdef __cplusplus - device->IAGetIndexBuffer(index_buffer, format, offset); -#else device->lpVtbl->IAGetIndexBuffer(device, index_buffer, format, offset); -#endif } - static INLINE void D3D10GetGShaderConstantBuffers( - D3D10Device device, UINT start_slot, - UINT num_buffers, D3D10Buffer* constant_buffers) + D3D10Device device, UINT start_slot, UINT num_buffers, D3D10Buffer* constant_buffers) { -#ifdef __cplusplus - device->GSGetConstantBuffers(start_slot, - num_buffers, constant_buffers); -#else - device->lpVtbl->GSGetConstantBuffers(device, start_slot, - num_buffers, constant_buffers); -#endif + device->lpVtbl->GSGetConstantBuffers(device, start_slot, num_buffers, constant_buffers); } - -static INLINE void D3D10GetGShader(D3D10Device device, - D3D10GeometryShader* geometry_shader) +static INLINE void D3D10GetGShader(D3D10Device device, D3D10GeometryShader* geometry_shader) { -#ifdef __cplusplus - device->GSGetShader(geometry_shader); -#else device->lpVtbl->GSGetShader(device, geometry_shader); -#endif } - -static INLINE void D3D10GetPrimitiveTopology(D3D10Device device, - D3D10_PRIMITIVE_TOPOLOGY* topology) +static INLINE void D3D10GetPrimitiveTopology(D3D10Device device, D3D10_PRIMITIVE_TOPOLOGY* topology) { -#ifdef __cplusplus - device->IAGetPrimitiveTopology(topology); -#else device->lpVtbl->IAGetPrimitiveTopology(device, topology); -#endif } - static INLINE void D3D10GetVShaderResources( D3D10Device device, UINT start_slot, UINT num_views, D3D10ShaderResourceView* shader_resource_views) { -#ifdef __cplusplus - device->VSGetShaderResources(start_slot, - num_views, shader_resource_views); -#else - device->lpVtbl->VSGetShaderResources(device, start_slot, - num_views, shader_resource_views); -#endif + device->lpVtbl->VSGetShaderResources(device, start_slot, num_views, shader_resource_views); } static INLINE void D3D10GetVShaderSamplers( - D3D10Device device, UINT start_slot, - UINT num_samplers, D3D10SamplerState* samplers) + D3D10Device device, UINT start_slot, UINT num_samplers, D3D10SamplerState* samplers) { -#ifdef __cplusplus - device->VSGetSamplers(start_slot, num_samplers, samplers); -#else - device->lpVtbl->VSGetSamplers(device, start_slot, - num_samplers, samplers); -#endif + device->lpVtbl->VSGetSamplers(device, start_slot, num_samplers, samplers); } - static INLINE void -D3D10GetPredication(D3D10Device device, - D3D10Predicate* predicate, BOOL* predicate_value) +D3D10GetPredication(D3D10Device device, D3D10Predicate* predicate, BOOL* predicate_value) { -#ifdef __cplusplus - device->GetPredication(predicate, predicate_value); -#else device->lpVtbl->GetPredication(device, predicate, predicate_value); -#endif } - static INLINE void D3D10GetGShaderResources( D3D10Device device, UINT start_slot, UINT num_views, D3D10ShaderResourceView* shader_resource_views) { -#ifdef __cplusplus - device->GSGetShaderResources(start_slot, - num_views, shader_resource_views); -#else - device->lpVtbl->GSGetShaderResources(device, start_slot, - num_views, shader_resource_views); -#endif + device->lpVtbl->GSGetShaderResources(device, start_slot, num_views, shader_resource_views); } - static INLINE void D3D10GetGShaderSamplers( - D3D10Device device, UINT start_slot, - UINT num_samplers, D3D10SamplerState* samplers) + D3D10Device device, UINT start_slot, UINT num_samplers, D3D10SamplerState* samplers) { -#ifdef __cplusplus - device->GSGetSamplers(start_slot, num_samplers, samplers); -#else - device->lpVtbl->GSGetSamplers(device, start_slot, - num_samplers, samplers); -#endif + device->lpVtbl->GSGetSamplers(device, start_slot, num_samplers, samplers); } - static INLINE void D3D10GetRenderTargets( D3D10Device device, UINT num_views, D3D10RenderTargetView* render_target_views, D3D10DepthStencilView* depth_stencil_view) { -#ifdef __cplusplus - device->OMGetRenderTargets(num_views, - render_target_views, depth_stencil_view); -#else - device->lpVtbl->OMGetRenderTargets(device, num_views, - render_target_views, depth_stencil_view); -#endif + device->lpVtbl->OMGetRenderTargets(device, num_views, render_target_views, depth_stencil_view); } - static INLINE void D3D10GetBlendState( - D3D10Device device, - D3D10BlendState* blend_state, - FLOAT blend_factor[4], UINT* sample_mask) + D3D10Device device, D3D10BlendState* blend_state, FLOAT blend_factor[4], UINT* sample_mask) { -#ifdef __cplusplus - device->OMGetBlendState(blend_state, blend_factor, sample_mask); -#else - device->lpVtbl->OMGetBlendState(device, blend_state, - blend_factor, sample_mask); -#endif + device->lpVtbl->OMGetBlendState(device, blend_state, blend_factor, sample_mask); } - static INLINE void D3D10GetDepthStencilState( - D3D10Device device, - D3D10DepthStencilState* depth_stencil_state, UINT* stencil_ref) + D3D10Device device, D3D10DepthStencilState* depth_stencil_state, UINT* stencil_ref) { -#ifdef __cplusplus - device->OMGetDepthStencilState(depth_stencil_state, stencil_ref); -#else - device->lpVtbl->OMGetDepthStencilState(device, - depth_stencil_state, stencil_ref); -#endif + device->lpVtbl->OMGetDepthStencilState(device, depth_stencil_state, stencil_ref); } - static INLINE void -D3D10SOGetTargets(D3D10Device device, - UINT num_buffers, D3D10Buffer* sotargets, UINT* offsets) +D3D10SOGetTargets(D3D10Device device, UINT num_buffers, D3D10Buffer* sotargets, UINT* offsets) { -#ifdef __cplusplus - device->SOGetTargets(num_buffers, sotargets, offsets); -#else device->lpVtbl->SOGetTargets(device, num_buffers, sotargets, offsets); -#endif } - -static INLINE void D3D10GetState(D3D10Device device, - D3D10RasterizerState* rasterizer_state) +static INLINE void D3D10GetState(D3D10Device device, D3D10RasterizerState* rasterizer_state) { -#ifdef __cplusplus - device->RSGetState(rasterizer_state); -#else device->lpVtbl->RSGetState(device, rasterizer_state); -#endif } - static INLINE void -D3D10GetViewports(D3D10Device device, - UINT* num_viewports, D3D10_VIEWPORT* viewports) +D3D10GetViewports(D3D10Device device, UINT* num_viewports, D3D10_VIEWPORT* viewports) { -#ifdef __cplusplus - device->RSGetViewports(num_viewports, viewports); -#else device->lpVtbl->RSGetViewports(device, num_viewports, viewports); -#endif } - -static INLINE void D3D10GetScissorRects(D3D10Device device, - UINT* num_rects, D3D10_RECT* rects) +static INLINE void D3D10GetScissorRects(D3D10Device device, UINT* num_rects, D3D10_RECT* rects) { -#ifdef __cplusplus - device->RSGetScissorRects(num_rects, rects); -#else device->lpVtbl->RSGetScissorRects(device, num_rects, rects); -#endif } - static INLINE HRESULT D3D10GetDeviceRemovedReason(D3D10Device device) { -#ifdef __cplusplus - return device->GetDeviceRemovedReason(); -#else return device->lpVtbl->GetDeviceRemovedReason(device); -#endif } - -static INLINE HRESULT D3D10SetExceptionMode(D3D10Device device, - UINT raise_flags) +static INLINE HRESULT D3D10SetExceptionMode(D3D10Device device, UINT raise_flags) { -#ifdef __cplusplus - return device->SetExceptionMode(raise_flags); -#else return device->lpVtbl->SetExceptionMode(device, raise_flags); -#endif } - static INLINE UINT D3D10GetExceptionMode(D3D10Device device) { -#ifdef __cplusplus - return device->GetExceptionMode(); -#else return device->lpVtbl->GetExceptionMode(device); -#endif } - -static INLINE void D3D10ClearState(D3D10Device device) -{ -#ifdef __cplusplus - device->ClearState(); -#else - device->lpVtbl->ClearState(device); -#endif -} - -static INLINE void D3D10Flush(D3D10Device device) -{ -#ifdef __cplusplus - device->Flush(); -#else - device->lpVtbl->Flush(device); -#endif -} - +static INLINE void D3D10ClearState(D3D10Device device) { device->lpVtbl->ClearState(device); } +static INLINE void D3D10Flush(D3D10Device device) { device->lpVtbl->Flush(device); } static INLINE HRESULT D3D10CreateBuffer( D3D10Device device, D3D10_BUFFER_DESC* desc, D3D10_SUBRESOURCE_DATA* initial_data, D3D10Buffer* buffer) { -#ifdef __cplusplus - return device->CreateBuffer( - desc, initial_data, buffer); -#else - return device->lpVtbl->CreateBuffer(device, - desc, initial_data, buffer); -#endif + return device->lpVtbl->CreateBuffer(device, desc, initial_data, buffer); } - static INLINE HRESULT D3D10CreateTexture1D( D3D10Device device, D3D10_TEXTURE1D_DESC* desc, D3D10_SUBRESOURCE_DATA* initial_data, D3D10Texture1D* texture1d) { -#ifdef __cplusplus - return device->CreateTexture1D( - desc, initial_data, texture1d); -#else - return device->lpVtbl->CreateTexture1D(device, - desc, initial_data, texture1d); -#endif + return device->lpVtbl->CreateTexture1D(device, desc, initial_data, texture1d); } - static INLINE HRESULT D3D10CreateTexture2D( D3D10Device device, D3D10_TEXTURE2D_DESC* desc, D3D10_SUBRESOURCE_DATA* initial_data, D3D10Texture2D* texture2d) { -#ifdef __cplusplus - return device->CreateTexture2D( - desc, initial_data, texture2d); -#else - return device->lpVtbl->CreateTexture2D(device, - desc, initial_data, texture2d); -#endif + return device->lpVtbl->CreateTexture2D(device, desc, initial_data, texture2d); } static INLINE HRESULT D3D10CreateTexture3D( D3D10Device device, @@ -1287,28 +611,15 @@ static INLINE HRESULT D3D10CreateTexture3D( D3D10_SUBRESOURCE_DATA* initial_data, D3D10Texture3D* texture3d) { -#ifdef __cplusplus - return device->CreateTexture3D( - desc, initial_data, texture3d); -#else - return device->lpVtbl->CreateTexture3D(device, - desc, initial_data, texture3d); -#endif + return device->lpVtbl->CreateTexture3D(device, desc, initial_data, texture3d); } - static INLINE HRESULT D3D10CreateShaderResourceViewDevice( D3D10Device device, D3D10Resource resource, D3D10_SHADER_RESOURCE_VIEW_DESC* desc, D3D10ShaderResourceView* srview) { -#ifdef __cplusplus - return device->CreateShaderResourceView( - resource, desc, srview); -#else - return device->lpVtbl->CreateShaderResourceView(device, - resource, desc, srview); -#endif + return device->lpVtbl->CreateShaderResourceView(device, resource, desc, srview); } static INLINE HRESULT D3D10CreateRenderTargetViewDevice( D3D10Device device, @@ -1316,30 +627,16 @@ static INLINE HRESULT D3D10CreateRenderTargetViewDevice( D3D10_RENDER_TARGET_VIEW_DESC* desc, D3D10RenderTargetView* rtview) { -#ifdef __cplusplus - return device->CreateRenderTargetView( - resource, desc, rtview); -#else - return device->lpVtbl->CreateRenderTargetView(device, - resource, desc, rtview); -#endif + return device->lpVtbl->CreateRenderTargetView(device, resource, desc, rtview); } - static INLINE HRESULT D3D10CreateDepthStencilView( D3D10Device device, D3D10Resource resource, D3D10_DEPTH_STENCIL_VIEW_DESC* desc, D3D10DepthStencilView* depth_stencil_view) { -#ifdef __cplusplus - return device->CreateDepthStencilView( - resource, desc, depth_stencil_view); -#else - return device->lpVtbl->CreateDepthStencilView(device, - resource, desc, depth_stencil_view); -#endif + return device->lpVtbl->CreateDepthStencilView(device, resource, desc, depth_stencil_view); } - static INLINE HRESULT D3D10CreateInputLayout( D3D10Device device, D3D10_INPUT_ELEMENT_DESC* input_element_descs, @@ -1348,47 +645,27 @@ static INLINE HRESULT D3D10CreateInputLayout( SIZE_T bytecode_length, D3D10InputLayout* input_layout) { -#ifdef __cplusplus - return device->CreateInputLayout( - input_element_descs, - num_elements, shader_bytecode_with_input_signature, - bytecode_length, input_layout); -#else return device->lpVtbl->CreateInputLayout( - device, input_element_descs, - num_elements, shader_bytecode_with_input_signature, + device, input_element_descs, num_elements, shader_bytecode_with_input_signature, bytecode_length, input_layout); -#endif } - static INLINE HRESULT D3D10CreateVertexShader( D3D10Device device, void* shader_bytecode, SIZE_T bytecode_length, D3D10VertexShader* vertex_shader) { -#ifdef __cplusplus - return device->CreateVertexShader( - shader_bytecode, bytecode_length, vertex_shader); -#else return device->lpVtbl->CreateVertexShader( device, shader_bytecode, bytecode_length, vertex_shader); -#endif } - static INLINE HRESULT D3D10CreateGeometryShader( D3D10Device device, void* shader_bytecode, SIZE_T bytecode_length, D3D10GeometryShader* geometry_shader) { -#ifdef __cplusplus - return device->CreateGeometryShader( - shader_bytecode, bytecode_length, geometry_shader); -#else return device->lpVtbl->CreateGeometryShader( device, shader_bytecode, bytecode_length, geometry_shader); -#endif } static INLINE HRESULT D3D10CreateGeometryShaderWithStreamOutput( D3D10Device device, @@ -1399,158 +676,72 @@ static INLINE HRESULT D3D10CreateGeometryShaderWithStreamOutput( UINT output_stream_stride, D3D10GeometryShader* geometry_shader) { -#ifdef __cplusplus - return device->CreateGeometryShaderWithStreamOutput( - shader_bytecode, bytecode_length, - sodeclaration, num_entries, output_stream_stride, - geometry_shader); -#else return device->lpVtbl->CreateGeometryShaderWithStreamOutput( - device, shader_bytecode, bytecode_length, - sodeclaration, num_entries, output_stream_stride, + device, shader_bytecode, bytecode_length, sodeclaration, num_entries, output_stream_stride, geometry_shader); -#endif } - static INLINE HRESULT D3D10CreatePixelShader( D3D10Device device, void* shader_bytecode, SIZE_T bytecode_length, D3D10PixelShader* pixel_shader) { -#ifdef __cplusplus - return device->CreatePixelShader( - shader_bytecode, bytecode_length, pixel_shader); -#else - return device->lpVtbl->CreatePixelShader(device, - shader_bytecode, bytecode_length, pixel_shader); -#endif + return device->lpVtbl->CreatePixelShader(device, shader_bytecode, bytecode_length, pixel_shader); } - static INLINE HRESULT D3D10CreateBlendState( - D3D10Device device, - D3D10_BLEND_DESC* blend_state_desc, D3D10BlendState* blend_state) + D3D10Device device, D3D10_BLEND_DESC* blend_state_desc, D3D10BlendState* blend_state) { -#ifdef __cplusplus - return device->CreateBlendState( - blend_state_desc, blend_state); -#else - return device->lpVtbl->CreateBlendState(device, - blend_state_desc, blend_state); -#endif + return device->lpVtbl->CreateBlendState(device, blend_state_desc, blend_state); } - static INLINE HRESULT D3D10CreateDepthStencilState( D3D10Device device, D3D10_DEPTH_STENCIL_DESC* depth_stencil_desc, D3D10DepthStencilState* depth_stencil_state) { -#ifdef __cplusplus - return device->CreateDepthStencilState( - depth_stencil_desc, depth_stencil_state); -#else - return device->lpVtbl->CreateDepthStencilState(device, - depth_stencil_desc, depth_stencil_state); -#endif + return device->lpVtbl->CreateDepthStencilState(device, depth_stencil_desc, depth_stencil_state); } - static INLINE HRESULT D3D10CreateRasterizerState( D3D10Device device, D3D10_RASTERIZER_DESC* rasterizer_desc, D3D10RasterizerState* rasterizer_state) { -#ifdef __cplusplus - return device->CreateRasterizerState( - rasterizer_desc, rasterizer_state); -#else - return device->lpVtbl->CreateRasterizerState(device, - rasterizer_desc, rasterizer_state); -#endif + return device->lpVtbl->CreateRasterizerState(device, rasterizer_desc, rasterizer_state); } - static INLINE HRESULT D3D10CreateSamplerState( - D3D10Device device, - D3D10_SAMPLER_DESC* sampler_desc, - D3D10SamplerState* sampler_state) + D3D10Device device, D3D10_SAMPLER_DESC* sampler_desc, D3D10SamplerState* sampler_state) { -#ifdef __cplusplus - return device->CreateSamplerState( - sampler_desc, sampler_state); -#else - return device->lpVtbl->CreateSamplerState(device, - sampler_desc, sampler_state); -#endif + return device->lpVtbl->CreateSamplerState(device, sampler_desc, sampler_state); } - static INLINE HRESULT -D3D10CreateQuery(D3D10Device device, - D3D10_QUERY_DESC* query_desc, D3D10Query* query) +D3D10CreateQuery(D3D10Device device, D3D10_QUERY_DESC* query_desc, D3D10Query* query) { -#ifdef __cplusplus - return device->CreateQuery(query_desc, query); -#else return device->lpVtbl->CreateQuery(device, query_desc, query); -#endif } - static INLINE HRESULT D3D10CreatePredicate( - D3D10Device device, - D3D10_QUERY_DESC* predicate_desc, D3D10Predicate* predicate) + D3D10Device device, D3D10_QUERY_DESC* predicate_desc, D3D10Predicate* predicate) { -#ifdef __cplusplus - return device->CreatePredicate( - predicate_desc, predicate); -#else - return device->lpVtbl->CreatePredicate(device, - predicate_desc, predicate); -#endif + return device->lpVtbl->CreatePredicate(device, predicate_desc, predicate); } - static INLINE HRESULT -D3D10CreateCounter(D3D10Device device, - D3D10_COUNTER_DESC* counter_desc, D3D10Counter* counter) +D3D10CreateCounter(D3D10Device device, D3D10_COUNTER_DESC* counter_desc, D3D10Counter* counter) { -#ifdef __cplusplus - return device->CreateCounter(counter_desc, counter); -#else return device->lpVtbl->CreateCounter(device, counter_desc, counter); -#endif } - static INLINE HRESULT -D3D10CheckFormatSupport(D3D10Device device, - DXGI_FORMAT format, UINT* format_support) +D3D10CheckFormatSupport(D3D10Device device, DXGI_FORMAT format, UINT* format_support) { -#ifdef __cplusplus - return device->CheckFormatSupport(format, format_support); -#else return device->lpVtbl->CheckFormatSupport(device, format, format_support); -#endif } - static INLINE HRESULT D3D10CheckMultisampleQualityLevels( - D3D10Device device, DXGI_FORMAT format, - UINT sample_count, UINT* num_quality_levels) + D3D10Device device, DXGI_FORMAT format, UINT sample_count, UINT* num_quality_levels) { -#ifdef __cplusplus - return device->CheckMultisampleQualityLevels( - format, sample_count, num_quality_levels); -#else return device->lpVtbl->CheckMultisampleQualityLevels( device, format, sample_count, num_quality_levels); -#endif } - -static INLINE void D3D10CheckCounterInfo(D3D10Device device, - D3D10_COUNTER_INFO* counter_info) +static INLINE void D3D10CheckCounterInfo(D3D10Device device, D3D10_COUNTER_INFO* counter_info) { -#ifdef __cplusplus - device->CheckCounterInfo(counter_info); -#else device->lpVtbl->CheckCounterInfo(device, counter_info); -#endif } - static INLINE HRESULT D3D10CheckCounter( D3D10Device device, D3D10_COUNTER_DESC* desc, @@ -1563,448 +754,188 @@ static INLINE HRESULT D3D10CheckCounter( LPSTR sz_description, UINT* description_length) { -#ifdef __cplusplus - return device->CheckCounter( - desc, type, active_counters, - sz_name, name_length, sz_units, units_length, - sz_description, description_length); -#else return device->lpVtbl->CheckCounter( - device, desc, type, active_counters, - sz_name, name_length, sz_units, units_length, + device, desc, type, active_counters, sz_name, name_length, sz_units, units_length, sz_description, description_length); -#endif } - static INLINE UINT D3D10GetCreationFlags(D3D10Device device) { -#ifdef __cplusplus - return device->GetCreationFlags(); -#else return device->lpVtbl->GetCreationFlags(device); -#endif } - static INLINE HRESULT -D3D10OpenSharedResource(D3D10Device device, - HANDLE h_resource, ID3D10Resource** out) +D3D10OpenSharedResource(D3D10Device device, HANDLE h_resource, ID3D10Resource** out) { -#ifdef __cplusplus - return device->OpenSharedResource( - h_resource, uuidof(ID3D10Resource), (void**)out); -#else return device->lpVtbl->OpenSharedResource( device, h_resource, uuidof(ID3D10Resource), (void**)out); -#endif } - -static INLINE void D3D10SetTextFilterSize(D3D10Device device, - UINT width, UINT height) +static INLINE void D3D10SetTextFilterSize(D3D10Device device, UINT width, UINT height) { -#ifdef __cplusplus - device->SetTextFilterSize(width, height); -#else device->lpVtbl->SetTextFilterSize(device, width, height); -#endif } - -static INLINE void D3D10GetTextFilterSize(D3D10Device device, - UINT* width, UINT* height) +static INLINE void D3D10GetTextFilterSize(D3D10Device device, UINT* width, UINT* height) { -#ifdef __cplusplus - device->GetTextFilterSize(width, height); -#else device->lpVtbl->GetTextFilterSize(device, width, height); -#endif } - static INLINE void D3D10Enter(D3D10Multithread multithread) { -#ifdef __cplusplus - multithread->Enter(); -#else multithread->lpVtbl->Enter(multithread); -#endif } - static INLINE void D3D10Leave(D3D10Multithread multithread) { -#ifdef __cplusplus - multithread->Leave(); -#else multithread->lpVtbl->Leave(multithread); -#endif } - -static INLINE BOOL D3D10SetMultithreadProtected( - D3D10Multithread multithread, BOOL mtprotect) +static INLINE BOOL D3D10SetMultithreadProtected(D3D10Multithread multithread, BOOL mtprotect) { -#ifdef __cplusplus - return multithread->SetMultithreadProtected( - mtprotect); -#else - return multithread->lpVtbl->SetMultithreadProtected( - multithread, mtprotect); -#endif + return multithread->lpVtbl->SetMultithreadProtected(multithread, mtprotect); } - -static INLINE BOOL D3D10GetMultithreadProtected( - D3D10Multithread multithread) +static INLINE BOOL D3D10GetMultithreadProtected(D3D10Multithread multithread) { -#ifdef __cplusplus - return multithread->GetMultithreadProtected(); -#else return multithread->lpVtbl->GetMultithreadProtected(multithread); -#endif } - -static INLINE HRESULT D3D10SetDebugFeatureMask( - D3D10Debug debug, UINT mask) +static INLINE HRESULT D3D10SetDebugFeatureMask(D3D10Debug debug, UINT mask) { -#ifdef __cplusplus - return debug->SetFeatureMask(mask); -#else return debug->lpVtbl->SetFeatureMask(debug, mask); -#endif } - static INLINE UINT D3D10GetDebugFeatureMask(D3D10Debug debug) { -#ifdef __cplusplus - return debug->GetFeatureMask(); -#else return debug->lpVtbl->GetFeatureMask(debug); -#endif } - -static INLINE HRESULT D3D10SetPresentPerRenderOpDelay( - D3D10Debug debug, UINT milliseconds) +static INLINE HRESULT D3D10SetPresentPerRenderOpDelay(D3D10Debug debug, UINT milliseconds) { -#ifdef __cplusplus - return debug->SetPresentPerRenderOpDelay(milliseconds); -#else return debug->lpVtbl->SetPresentPerRenderOpDelay(debug, milliseconds); -#endif } - static INLINE UINT D3D10GetPresentPerRenderOpDelay(D3D10Debug debug) { -#ifdef __cplusplus - return debug->GetPresentPerRenderOpDelay(); -#else return debug->lpVtbl->GetPresentPerRenderOpDelay(debug); -#endif } - -static INLINE HRESULT D3D10SetSwapChain(D3D10Debug debug, - IDXGISwapChain* swap_chain) +static INLINE HRESULT D3D10SetSwapChain(D3D10Debug debug, IDXGISwapChain* swap_chain) { -#ifdef __cplusplus - return debug->SetSwapChain((IDXGISwapChain*)swap_chain); -#else return debug->lpVtbl->SetSwapChain(debug, (IDXGISwapChain*)swap_chain); -#endif } - -static INLINE HRESULT D3D10GetSwapChain(D3D10Debug debug, - IDXGISwapChain** swap_chain) +static INLINE HRESULT D3D10GetSwapChain(D3D10Debug debug, IDXGISwapChain** swap_chain) { -#ifdef __cplusplus - return debug->GetSwapChain((IDXGISwapChain**)swap_chain); -#else return debug->lpVtbl->GetSwapChain(debug, (IDXGISwapChain**)swap_chain); -#endif } - -static INLINE HRESULT D3D10Validate(D3D10Debug debug) +static INLINE HRESULT D3D10Validate(D3D10Debug debug) { return debug->lpVtbl->Validate(debug); } +static INLINE BOOL D3D10SetUseRef(D3D10SwitchToRef switch_to_ref, BOOL use_ref) { -#ifdef __cplusplus - return debug->Validate(); -#else - return debug->lpVtbl->Validate(debug); -#endif -} - -static INLINE BOOL D3D10SetUseRef(D3D10SwitchToRef switch_to_ref, - BOOL use_ref) -{ -#ifdef __cplusplus - return switch_to_ref->SetUseRef(use_ref); -#else return switch_to_ref->lpVtbl->SetUseRef(switch_to_ref, use_ref); -#endif } - static INLINE BOOL D3D10GetUseRef(D3D10SwitchToRef switch_to_ref) { -#ifdef __cplusplus - return switch_to_ref->GetUseRef(); -#else return switch_to_ref->lpVtbl->GetUseRef(switch_to_ref); -#endif } - static INLINE HRESULT -D3D10SetMessageCountLimit(D3D10InfoQueue info_queue, - UINT64 message_count_limit) +D3D10SetMessageCountLimit(D3D10InfoQueue info_queue, UINT64 message_count_limit) { -#ifdef __cplusplus - return info_queue->SetMessageCountLimit( - message_count_limit); -#else - return info_queue->lpVtbl->SetMessageCountLimit(info_queue, - message_count_limit); -#endif + return info_queue->lpVtbl->SetMessageCountLimit(info_queue, message_count_limit); } - static INLINE void D3D10ClearStoredMessages(D3D10InfoQueue info_queue) { -#ifdef __cplusplus - info_queue->ClearStoredMessages(); -#else info_queue->lpVtbl->ClearStoredMessages(info_queue); -#endif } - static INLINE HRESULT D3D10GetMessageA( D3D10InfoQueue info_queue, UINT64 message_index, D3D10_MESSAGE* message, SIZE_T* message_byte_length) { -#ifdef __cplusplus - return info_queue->GetMessageA( - message_index, message, message_byte_length); -#else - return info_queue->lpVtbl->GetMessageA(info_queue, - message_index, message, message_byte_length); -#endif + return info_queue->lpVtbl->GetMessageA(info_queue, message_index, message, message_byte_length); } - -static INLINE UINT64 D3D10GetNumMessagesAllowedByStorageFilter( - D3D10InfoQueue info_queue) +static INLINE UINT64 D3D10GetNumMessagesAllowedByStorageFilter(D3D10InfoQueue info_queue) { -#ifdef __cplusplus - return info_queue->GetNumMessagesAllowedByStorageFilter(); -#else - return info_queue->lpVtbl->GetNumMessagesAllowedByStorageFilter( - info_queue); -#endif + return info_queue->lpVtbl->GetNumMessagesAllowedByStorageFilter(info_queue); } - -static INLINE UINT64 D3D10GetNumMessagesDeniedByStorageFilter( - D3D10InfoQueue info_queue) +static INLINE UINT64 D3D10GetNumMessagesDeniedByStorageFilter(D3D10InfoQueue info_queue) { -#ifdef __cplusplus - return info_queue->GetNumMessagesDeniedByStorageFilter(); -#else - return info_queue->lpVtbl->GetNumMessagesDeniedByStorageFilter( - info_queue); -#endif + return info_queue->lpVtbl->GetNumMessagesDeniedByStorageFilter(info_queue); } - static INLINE UINT64 D3D10GetNumStoredMessages(D3D10InfoQueue info_queue) { -#ifdef __cplusplus - return info_queue->GetNumStoredMessages(); -#else return info_queue->lpVtbl->GetNumStoredMessages(info_queue); -#endif } - -static INLINE UINT64 D3D10GetNumStoredMessagesAllowedByRetrievalFilter( - D3D10InfoQueue info_queue) +static INLINE UINT64 D3D10GetNumStoredMessagesAllowedByRetrievalFilter(D3D10InfoQueue info_queue) { -#ifdef __cplusplus - return info_queue->GetNumStoredMessagesAllowedByRetrievalFilter(); -#else - return info_queue->lpVtbl->GetNumStoredMessagesAllowedByRetrievalFilter( - info_queue); -#endif + return info_queue->lpVtbl->GetNumStoredMessagesAllowedByRetrievalFilter(info_queue); } - -static INLINE UINT64 D3D10GetNumMessagesDiscardedByMessageCountLimit( - D3D10InfoQueue info_queue) +static INLINE UINT64 D3D10GetNumMessagesDiscardedByMessageCountLimit(D3D10InfoQueue info_queue) { -#ifdef __cplusplus - return info_queue->GetNumMessagesDiscardedByMessageCountLimit(); -#else - return info_queue->lpVtbl->GetNumMessagesDiscardedByMessageCountLimit( - info_queue); -#endif + return info_queue->lpVtbl->GetNumMessagesDiscardedByMessageCountLimit(info_queue); } - static INLINE UINT64 D3D10GetMessageCountLimit(D3D10InfoQueue info_queue) { -#ifdef __cplusplus - return info_queue->GetMessageCountLimit(); -#else return info_queue->lpVtbl->GetMessageCountLimit(info_queue); -#endif } - static INLINE HRESULT -D3D10AddStorageFilterEntries(D3D10InfoQueue info_queue, - D3D10_INFO_QUEUE_FILTER* filter) +D3D10AddStorageFilterEntries(D3D10InfoQueue info_queue, D3D10_INFO_QUEUE_FILTER* filter) { -#ifdef __cplusplus - return info_queue->AddStorageFilterEntries(filter); -#else return info_queue->lpVtbl->AddStorageFilterEntries(info_queue, filter); -#endif } - static INLINE HRESULT D3D10GetStorageFilter( - D3D10InfoQueue info_queue, - D3D10_INFO_QUEUE_FILTER* filter, SIZE_T* filter_byte_length) + D3D10InfoQueue info_queue, D3D10_INFO_QUEUE_FILTER* filter, SIZE_T* filter_byte_length) { -#ifdef __cplusplus - return info_queue->GetStorageFilter( - filter, filter_byte_length); -#else - return info_queue->lpVtbl->GetStorageFilter( - info_queue, filter, filter_byte_length); -#endif + return info_queue->lpVtbl->GetStorageFilter(info_queue, filter, filter_byte_length); } - static INLINE void D3D10ClearStorageFilter(D3D10InfoQueue info_queue) { -#ifdef __cplusplus - info_queue->ClearStorageFilter(); -#else info_queue->lpVtbl->ClearStorageFilter(info_queue); -#endif } - static INLINE HRESULT D3D10PushEmptyStorageFilter(D3D10InfoQueue info_queue) { -#ifdef __cplusplus - return info_queue->PushEmptyStorageFilter(); -#else return info_queue->lpVtbl->PushEmptyStorageFilter(info_queue); -#endif } - static INLINE HRESULT D3D10PushCopyOfStorageFilter(D3D10InfoQueue info_queue) { -#ifdef __cplusplus - return info_queue->PushCopyOfStorageFilter(); -#else return info_queue->lpVtbl->PushCopyOfStorageFilter(info_queue); -#endif } - static INLINE HRESULT -D3D10PushStorageFilter(D3D10InfoQueue info_queue, - D3D10_INFO_QUEUE_FILTER* filter) +D3D10PushStorageFilter(D3D10InfoQueue info_queue, D3D10_INFO_QUEUE_FILTER* filter) { -#ifdef __cplusplus - return info_queue->PushStorageFilter(filter); -#else return info_queue->lpVtbl->PushStorageFilter(info_queue, filter); -#endif } - static INLINE void D3D10PopStorageFilter(D3D10InfoQueue info_queue) { -#ifdef __cplusplus - info_queue->PopStorageFilter(); -#else info_queue->lpVtbl->PopStorageFilter(info_queue); -#endif } - static INLINE UINT D3D10GetStorageFilterStackSize(D3D10InfoQueue info_queue) { -#ifdef __cplusplus - return info_queue->GetStorageFilterStackSize(); -#else return info_queue->lpVtbl->GetStorageFilterStackSize(info_queue); -#endif } - static INLINE HRESULT -D3D10AddRetrievalFilterEntries(D3D10InfoQueue info_queue, - D3D10_INFO_QUEUE_FILTER* filter) +D3D10AddRetrievalFilterEntries(D3D10InfoQueue info_queue, D3D10_INFO_QUEUE_FILTER* filter) { -#ifdef __cplusplus - return info_queue->AddRetrievalFilterEntries(filter); -#else return info_queue->lpVtbl->AddRetrievalFilterEntries(info_queue, filter); -#endif } - static INLINE HRESULT D3D10GetRetrievalFilter( - D3D10InfoQueue info_queue, - D3D10_INFO_QUEUE_FILTER* filter, SIZE_T* filter_byte_length) + D3D10InfoQueue info_queue, D3D10_INFO_QUEUE_FILTER* filter, SIZE_T* filter_byte_length) { -#ifdef __cplusplus - return info_queue->GetRetrievalFilter( - filter, filter_byte_length); -#else - return info_queue->lpVtbl->GetRetrievalFilter(info_queue, - filter, filter_byte_length); -#endif + return info_queue->lpVtbl->GetRetrievalFilter(info_queue, filter, filter_byte_length); } - static INLINE void D3D10ClearRetrievalFilter(D3D10InfoQueue info_queue) { -#ifdef __cplusplus - info_queue->ClearRetrievalFilter(); -#else info_queue->lpVtbl->ClearRetrievalFilter(info_queue); -#endif } - -static INLINE HRESULT D3D10PushEmptyRetrievalFilter( - D3D10InfoQueue info_queue) +static INLINE HRESULT D3D10PushEmptyRetrievalFilter(D3D10InfoQueue info_queue) { -#ifdef __cplusplus - return info_queue->PushEmptyRetrievalFilter(); -#else return info_queue->lpVtbl->PushEmptyRetrievalFilter(info_queue); -#endif } - -static INLINE HRESULT D3D10PushCopyOfRetrievalFilter( - D3D10InfoQueue info_queue) +static INLINE HRESULT D3D10PushCopyOfRetrievalFilter(D3D10InfoQueue info_queue) { -#ifdef __cplusplus - return info_queue->PushCopyOfRetrievalFilter(); -#else return info_queue->lpVtbl->PushCopyOfRetrievalFilter(info_queue); -#endif } - static INLINE HRESULT -D3D10PushRetrievalFilter(D3D10InfoQueue info_queue, - D3D10_INFO_QUEUE_FILTER* filter) +D3D10PushRetrievalFilter(D3D10InfoQueue info_queue, D3D10_INFO_QUEUE_FILTER* filter) { -#ifdef __cplusplus - return info_queue->PushRetrievalFilter(filter); -#else return info_queue->lpVtbl->PushRetrievalFilter(info_queue, filter); -#endif } - static INLINE void D3D10PopRetrievalFilter(D3D10InfoQueue info_queue) { -#ifdef __cplusplus - info_queue->PopRetrievalFilter(); -#else info_queue->lpVtbl->PopRetrievalFilter(info_queue); -#endif } - static INLINE UINT D3D10GetRetrievalFilterStackSize(D3D10InfoQueue info_queue) { -#ifdef __cplusplus - return info_queue->GetRetrievalFilterStackSize(); -#else return info_queue->lpVtbl->GetRetrievalFilterStackSize(info_queue); -#endif } - static INLINE HRESULT D3D10AddMessage( D3D10InfoQueue info_queue, D3D10_MESSAGE_CATEGORY category, @@ -2012,129 +943,57 @@ static INLINE HRESULT D3D10AddMessage( D3D10_MESSAGE_ID id, LPCSTR description) { -#ifdef __cplusplus - return info_queue->AddMessage( - category, severity, id, description); -#else - return info_queue->lpVtbl->AddMessage(info_queue, - category, severity, id, description); -#endif + return info_queue->lpVtbl->AddMessage(info_queue, category, severity, id, description); } - static INLINE HRESULT D3D10AddApplicationMessage( - D3D10InfoQueue info_queue, - D3D10_MESSAGE_SEVERITY severity, LPCSTR description) + D3D10InfoQueue info_queue, D3D10_MESSAGE_SEVERITY severity, LPCSTR description) { -#ifdef __cplusplus - return info_queue->AddApplicationMessage( - severity, description); -#else - return info_queue->lpVtbl->AddApplicationMessage( - info_queue, severity, description); -#endif + return info_queue->lpVtbl->AddApplicationMessage(info_queue, severity, description); } - static INLINE HRESULT -D3D10SetBreakOnCategory(D3D10InfoQueue info_queue, - D3D10_MESSAGE_CATEGORY category, BOOL enable) +D3D10SetBreakOnCategory(D3D10InfoQueue info_queue, D3D10_MESSAGE_CATEGORY category, BOOL enable) { -#ifdef __cplusplus - return info_queue->SetBreakOnCategory( - category, enable); -#else - return info_queue->lpVtbl->SetBreakOnCategory( - info_queue, category, enable); -#endif + return info_queue->lpVtbl->SetBreakOnCategory(info_queue, category, enable); } - static INLINE HRESULT -D3D10SetBreakOnSeverity(D3D10InfoQueue info_queue, - D3D10_MESSAGE_SEVERITY severity, BOOL enable) +D3D10SetBreakOnSeverity(D3D10InfoQueue info_queue, D3D10_MESSAGE_SEVERITY severity, BOOL enable) { -#ifdef __cplusplus - return info_queue->SetBreakOnSeverity(severity, enable); -#else - return info_queue->lpVtbl->SetBreakOnSeverity(info_queue, - severity, enable); -#endif + return info_queue->lpVtbl->SetBreakOnSeverity(info_queue, severity, enable); } - -static INLINE HRESULT D3D10SetBreakOnID(D3D10InfoQueue info_queue, - D3D10_MESSAGE_ID id, BOOL enable) +static INLINE HRESULT D3D10SetBreakOnID(D3D10InfoQueue info_queue, D3D10_MESSAGE_ID id, BOOL enable) { -#ifdef __cplusplus - return info_queue->SetBreakOnID(id, enable); -#else return info_queue->lpVtbl->SetBreakOnID(info_queue, id, enable); -#endif } - static INLINE BOOL -D3D10GetBreakOnCategory(D3D10InfoQueue info_queue, - D3D10_MESSAGE_CATEGORY category) +D3D10GetBreakOnCategory(D3D10InfoQueue info_queue, D3D10_MESSAGE_CATEGORY category) { -#ifdef __cplusplus - return info_queue->GetBreakOnCategory(category); -#else return info_queue->lpVtbl->GetBreakOnCategory(info_queue, category); -#endif } - static INLINE BOOL -D3D10GetBreakOnSeverity(D3D10InfoQueue info_queue, - D3D10_MESSAGE_SEVERITY severity) +D3D10GetBreakOnSeverity(D3D10InfoQueue info_queue, D3D10_MESSAGE_SEVERITY severity) { -#ifdef __cplusplus - return info_queue->GetBreakOnSeverity(severity); -#else return info_queue->lpVtbl->GetBreakOnSeverity(info_queue, severity); -#endif } - -static INLINE BOOL D3D10GetBreakOnID(D3D10InfoQueue info_queue, - D3D10_MESSAGE_ID id) +static INLINE BOOL D3D10GetBreakOnID(D3D10InfoQueue info_queue, D3D10_MESSAGE_ID id) { -#ifdef __cplusplus - return info_queue->GetBreakOnID(id); -#else return info_queue->lpVtbl->GetBreakOnID(info_queue, id); -#endif } - -static INLINE void D3D10SetMuteDebugOutput( - D3D10InfoQueue info_queue, BOOL mute) +static INLINE void D3D10SetMuteDebugOutput(D3D10InfoQueue info_queue, BOOL mute) { -#ifdef __cplusplus - info_queue->SetMuteDebugOutput(mute); -#else info_queue->lpVtbl->SetMuteDebugOutput(info_queue, mute); -#endif } - static INLINE BOOL D3D10GetMuteDebugOutput(D3D10InfoQueue info_queue) { -#ifdef __cplusplus - return info_queue->GetMuteDebugOutput(); -#else return info_queue->lpVtbl->GetMuteDebugOutput(info_queue); -#endif } /* end of auto-generated */ static INLINE HRESULT -DXGIGetSwapChainBufferD3D10(DXGISwapChain swap_chain, UINT buffer, - D3D10Texture2D* out) +DXGIGetSwapChainBufferD3D10(DXGISwapChain swap_chain, UINT buffer, D3D10Texture2D* out) { -#ifdef __cplusplus - return swap_chain->GetBuffer(buffer, - uuidof(ID3D10Texture2D), (void**)out); -#else - return swap_chain->lpVtbl->GetBuffer(swap_chain, buffer, - uuidof(ID3D10Texture2D), (void**)out); -#endif + return swap_chain->lpVtbl->GetBuffer(swap_chain, buffer, uuidof(ID3D10Texture2D), (void**)out); } - static INLINE void D3D10CopyTexture2DSubresourceRegion( D3D10Device device, D3D10Texture2D dst_texture, @@ -2146,17 +1005,9 @@ static INLINE void D3D10CopyTexture2DSubresourceRegion( UINT src_subresource, D3D10_BOX* src_box) { -#ifdef __cplusplus - device->CopySubresourceRegion( - (D3D10Resource)dst_texture, - dst_subresource, dst_x, dst_y, dst_z, - (D3D10Resource)src_texture, src_subresource, src_box); -#else device->lpVtbl->CopySubresourceRegion( - device, (D3D10Resource)dst_texture, - dst_subresource, dst_x, dst_y, dst_z, + device, (D3D10Resource)dst_texture, dst_subresource, dst_x, dst_y, dst_z, (D3D10Resource)src_texture, src_subresource, src_box); -#endif } static INLINE HRESULT D3D10CreateTexture2DRenderTargetView( D3D10Device device, @@ -2164,13 +1015,7 @@ static INLINE HRESULT D3D10CreateTexture2DRenderTargetView( D3D10_RENDER_TARGET_VIEW_DESC* desc, D3D10RenderTargetView* rtview) { -#ifdef __cplusplus - return device->CreateRenderTargetView( - (D3D10Resource)texture, desc, rtview); -#else - return device->lpVtbl->CreateRenderTargetView(device, - (D3D10Resource)texture, desc, rtview); -#endif + return device->lpVtbl->CreateRenderTargetView(device, (D3D10Resource)texture, desc, rtview); } static INLINE HRESULT D3D10CreateTexture2DShaderResourceView( D3D10Device device, @@ -2178,15 +1023,9 @@ static INLINE HRESULT D3D10CreateTexture2DShaderResourceView( D3D10_SHADER_RESOURCE_VIEW_DESC* desc, D3D10ShaderResourceView* srview) { -#ifdef __cplusplus - return device->CreateShaderResourceView((D3D10Resource)texture, - desc, srview); -#else - return device->lpVtbl->CreateShaderResourceView(device, - (D3D10Resource)texture, desc, srview); -#endif + return device->lpVtbl->CreateShaderResourceView(device, (D3D10Resource)texture, desc, srview); } - +#endif /* internal */ #include diff --git a/gfx/common/d3d11_common.c b/gfx/common/d3d11_common.c index 29db2222f5..18484b3bb1 100644 --- a/gfx/common/d3d11_common.c +++ b/gfx/common/d3d11_common.c @@ -13,6 +13,8 @@ * If not, see . */ +#define CINTERFACE + #include #include "d3d11_common.h" @@ -122,9 +124,9 @@ void d3d11_init_texture(D3D11Device device, d3d11_texture_t* texture) void d3d11_update_texture( D3D11DeviceContext ctx, - int width, - int height, - int pitch, + unsigned width, + unsigned height, + unsigned pitch, DXGI_FORMAT format, const void* data, d3d11_texture_t* texture) diff --git a/gfx/common/d3d11_common.h b/gfx/common/d3d11_common.h index 1ef9d08002..0e7f72538c 100644 --- a/gfx/common/d3d11_common.h +++ b/gfx/common/d3d11_common.h @@ -18,6 +18,9 @@ #include #include "dxgi_common.h" +#ifdef CINTERFACE +#define D3D11_NO_HELPERS +#endif #include typedef const ID3D11ShaderResourceView* D3D11ShaderResourceViewRef; @@ -2578,9 +2581,9 @@ static INLINE void d3d11_release_texture(d3d11_texture_t* texture) void d3d11_update_texture( D3D11DeviceContext ctx, - int width, - int height, - int pitch, + unsigned width, + unsigned height, + unsigned pitch, DXGI_FORMAT format, const void* data, d3d11_texture_t* texture); diff --git a/gfx/common/d3d12_common.c b/gfx/common/d3d12_common.c index a92986b5c2..ac2b82f636 100644 --- a/gfx/common/d3d12_common.c +++ b/gfx/common/d3d12_common.c @@ -13,6 +13,8 @@ * If not, see . */ +#define CINTERFACE + #include "d3d12_common.h" #include "dxgi_common.h" #include "d3dcompiler_common.h" @@ -25,7 +27,11 @@ #ifdef __MINGW32__ /* clang-format off */ +#ifdef __cplusplus +#define DEFINE_GUIDW(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) EXTERN_C const GUID DECLSPEC_SELECTANY name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } +#else #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 } } +#endif DEFINE_GUIDW(IID_ID3D12PipelineState, 0x765a30f3, 0xf624, 0x4c6f, 0xa8, 0x28, 0xac, 0xe9, 0x48, 0x62, 0x24, 0x45); DEFINE_GUIDW(IID_ID3D12RootSignature, 0xc54a6b66, 0x72df, 0x4ee8, 0x8b, 0xe5, 0xa9, 0x46, 0xa1, 0x42, 0x92, 0x14); @@ -64,7 +70,7 @@ static const char* d3d12_dll_name = "d3d12.dll"; HRESULT WINAPI D3D12CreateDevice( IUnknown* pAdapter, D3D_FEATURE_LEVEL MinimumFeatureLevel, REFIID riid, void** ppDevice) { - static PFN_D3D12_CREATE_DEVICE fp; + static PFN_D3D12_CREATE_DEVICE fp; if (!d3d12_dll) d3d12_dll = dylib_load(d3d12_dll_name); @@ -75,7 +81,7 @@ HRESULT WINAPI D3D12CreateDevice( fp = (PFN_D3D12_CREATE_DEVICE)dylib_proc(d3d12_dll, "D3D12CreateDevice"); if (fp) - return fp(pAdapter, MinimumFeatureLevel, riid, ppDevice); + return fp(pAdapter, MinimumFeatureLevel, riid, ppDevice); error: return TYPE_E_CANTLOADLIBRARY; @@ -88,13 +94,13 @@ HRESULT WINAPI D3D12GetDebugInterface(REFIID riid, void** ppvDebug) d3d12_dll = dylib_load(d3d12_dll_name); if (!d3d12_dll) - goto error; + goto error; if (!fp) fp = (PFN_D3D12_GET_DEBUG_INTERFACE)dylib_proc(d3d12_dll, "D3D12GetDebugInterface"); - if (fp) - return fp(riid, ppvDebug); + if (fp) + return fp(riid, ppvDebug); error: return TYPE_E_CANTLOADLIBRARY; @@ -114,8 +120,7 @@ HRESULT WINAPI D3D12SerializeRootSignature( goto error; if (!fp) - fp = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)dylib_proc( - d3d12_dll, "D3D12SerializeRootSignature"); + fp = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)dylib_proc(d3d12_dll, "D3D12SerializeRootSignature"); if (fp) return fp(pRootSignature, Version, ppBlob, ppErrorBlob); @@ -138,10 +143,10 @@ HRESULT WINAPI D3D12SerializeVersionedRootSignature( if (!fp) fp = (PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE)dylib_proc( - d3d12_dll, "D3D12SerializeRootSignature"); + d3d12_dll, "D3D12SerializeRootSignature"); if (fp) - return fp(pRootSignature, ppBlob, ppErrorBlob); + return fp(pRootSignature, ppBlob, ppErrorBlob); error: return TYPE_E_CANTLOADLIBRARY; @@ -179,10 +184,8 @@ bool d3d12_init_base(d3d12_video_t* d3d12) bool d3d12_init_queue(d3d12_video_t* d3d12) { { - static const D3D12_COMMAND_QUEUE_DESC desc = { - .Type = D3D12_COMMAND_LIST_TYPE_DIRECT, - .Flags = D3D12_COMMAND_QUEUE_FLAG_NONE, - }; + static const D3D12_COMMAND_QUEUE_DESC desc = { D3D12_COMMAND_LIST_TYPE_DIRECT, 0, + D3D12_COMMAND_QUEUE_FLAG_NONE, 0 }; D3D12CreateCommandQueue( d3d12->device, (D3D12_COMMAND_QUEUE_DESC*)&desc, &d3d12->queue.handle); } @@ -206,26 +209,25 @@ bool d3d12_init_queue(d3d12_video_t* d3d12) bool d3d12_init_swapchain(d3d12_video_t* d3d12, int width, int height, HWND hwnd) { { - DXGI_SWAP_CHAIN_DESC desc = { - .BufferCount = countof(d3d12->chain.renderTargets), - .BufferDesc.Width = width, - .BufferDesc.Height = height, - .BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM, - .SampleDesc.Count = 1, + DXGI_SWAP_CHAIN_DESC desc = { 0 }; + desc.BufferCount = countof(d3d12->chain.renderTargets); + desc.BufferDesc.Width = width; + desc.BufferDesc.Height = height; + desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + desc.SampleDesc.Count = 1; #if 0 - .BufferDesc.RefreshRate.Numerator = 60, - .BufferDesc.RefreshRate.Denominator = 1, - .SampleDesc.Quality = 0, + desc.BufferDesc.RefreshRate.Numerator = 60; + desc.BufferDesc.RefreshRate.Denominator = 1; + desc.SampleDesc.Quality = 0; #endif - .BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT, - .OutputWindow = hwnd, - .Windowed = TRUE, + desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + desc.OutputWindow = hwnd; + desc.Windowed = TRUE; #if 0 - .SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL, + desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; #else - .SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD, + desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; #endif - }; DXGICreateSwapChain(d3d12->factory, d3d12->queue.handle, &desc, &d3d12->chain.handle); } @@ -285,7 +287,7 @@ static void d3d12_init_sampler( bool d3d12_init_descriptors(d3d12_video_t* d3d12) { - D3D12_ROOT_SIGNATURE_DESC desc; + D3D12_ROOT_SIGNATURE_DESC desc; static const D3D12_DESCRIPTOR_RANGE srv_table[] = { { .RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV, @@ -308,30 +310,22 @@ bool d3d12_init_descriptors(d3d12_video_t* d3d12) }, }; - D3D12_ROOT_PARAMETER rootParameters[ROOT_INDEX_MAX] = { - { - D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE, - {{0}}, - D3D12_SHADER_VISIBILITY_PIXEL, - }, - { - D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE, - {{0}}, - D3D12_SHADER_VISIBILITY_PIXEL, - }, - { - D3D12_ROOT_PARAMETER_TYPE_CBV, - {{0}}, - D3D12_SHADER_VISIBILITY_VERTEX, - } - }; + D3D12_ROOT_PARAMETER rootParameters[ROOT_ID_MAX] = {}; - rootParameters[0].DescriptorTable.NumDescriptorRanges = countof(srv_table); - rootParameters[0].DescriptorTable.pDescriptorRanges = srv_table; - rootParameters[1].DescriptorTable.NumDescriptorRanges = countof(sampler_table); - rootParameters[1].DescriptorTable.pDescriptorRanges = sampler_table; - rootParameters[2].Descriptor.RegisterSpace = 0; - rootParameters[2].Descriptor.ShaderRegister = 0; + rootParameters[ROOT_ID_TEXTURE_T].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; + rootParameters[ROOT_ID_TEXTURE_T].DescriptorTable.NumDescriptorRanges = countof(srv_table); + rootParameters[ROOT_ID_TEXTURE_T].DescriptorTable.pDescriptorRanges = srv_table; + rootParameters[ROOT_ID_TEXTURE_T].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; + + rootParameters[ROOT_ID_SAMPLER_T].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; + rootParameters[ROOT_ID_SAMPLER_T].DescriptorTable.NumDescriptorRanges = countof(sampler_table); + rootParameters[ROOT_ID_SAMPLER_T].DescriptorTable.pDescriptorRanges = sampler_table; + rootParameters[ROOT_ID_SAMPLER_T].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; + + rootParameters[ROOT_ID_UBO].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; + rootParameters[ROOT_ID_UBO].Descriptor.RegisterSpace = 0; + rootParameters[ROOT_ID_UBO].Descriptor.ShaderRegister = 0; + rootParameters[ROOT_ID_UBO].ShaderVisibility = D3D12_SHADER_VISIBILITY_VERTEX; desc.NumParameters = countof(rootParameters); desc.pParameters = rootParameters; @@ -417,24 +411,6 @@ bool d3d12_init_pipeline(d3d12_video_t* d3d12) .ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF, }; - static const D3D12_BLEND_DESC blendDesc = { - .AlphaToCoverageEnable = FALSE, - .IndependentBlendEnable = FALSE, - .RenderTarget[0] = - { - .BlendEnable = TRUE, - .LogicOpEnable = FALSE, - D3D12_BLEND_SRC_ALPHA, - D3D12_BLEND_INV_SRC_ALPHA, - D3D12_BLEND_OP_ADD, - D3D12_BLEND_SRC_ALPHA, - D3D12_BLEND_INV_SRC_ALPHA, - D3D12_BLEND_OP_ADD, - D3D12_LOGIC_OP_NOOP, - D3D12_COLOR_WRITE_ENABLE_ALL, - }, - }; - if (!d3d_compile(stock, sizeof(stock), NULL, "VSMain", "vs_5_0", &vs_code)) return false; @@ -442,48 +418,44 @@ bool d3d12_init_pipeline(d3d12_video_t* d3d12) return false; { - D3D12_GRAPHICS_PIPELINE_STATE_DESC psodesc = { - .pRootSignature = d3d12->pipe.rootSignature, - .VS.pShaderBytecode = D3DGetBufferPointer(vs_code), - .VS.BytecodeLength = D3DGetBufferSize(vs_code), - .PS.pShaderBytecode = D3DGetBufferPointer(ps_code), - .PS.BytecodeLength = D3DGetBufferSize(ps_code), - .BlendState.AlphaToCoverageEnable = FALSE, - .BlendState.IndependentBlendEnable = FALSE, - .BlendState.RenderTarget[0] = - { - .BlendEnable = TRUE, - .LogicOpEnable = FALSE, - D3D12_BLEND_SRC_ALPHA, - D3D12_BLEND_INV_SRC_ALPHA, - D3D12_BLEND_OP_ADD, - D3D12_BLEND_SRC_ALPHA, - D3D12_BLEND_INV_SRC_ALPHA, - D3D12_BLEND_OP_ADD, - D3D12_LOGIC_OP_NOOP, - D3D12_COLOR_WRITE_ENABLE_ALL, - }, - .SampleMask = UINT_MAX, - .RasterizerState.FillMode = D3D12_FILL_MODE_SOLID, - .RasterizerState.CullMode = D3D12_CULL_MODE_BACK, - .RasterizerState.FrontCounterClockwise = FALSE, - .RasterizerState.DepthBias = D3D12_DEFAULT_DEPTH_BIAS, - .RasterizerState.DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP, - .RasterizerState.SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS, - .RasterizerState.DepthClipEnable = TRUE, - .RasterizerState.MultisampleEnable = FALSE, - .RasterizerState.AntialiasedLineEnable = FALSE, - .RasterizerState.ForcedSampleCount = 0, - .RasterizerState.ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF, - .DepthStencilState.DepthEnable = FALSE, - .DepthStencilState.StencilEnable = FALSE, - .InputLayout.pInputElementDescs = inputElementDesc, - .InputLayout.NumElements = countof(inputElementDesc), - .PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, - .NumRenderTargets = 1, - .RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM, - .SampleDesc.Count = 1, - }; + D3D12_GRAPHICS_PIPELINE_STATE_DESC psodesc = { 0 }; + psodesc.pRootSignature = d3d12->pipe.rootSignature; + psodesc.VS.pShaderBytecode = D3DGetBufferPointer(vs_code); + psodesc.VS.BytecodeLength = D3DGetBufferSize(vs_code); + psodesc.PS.pShaderBytecode = D3DGetBufferPointer(ps_code); + psodesc.PS.BytecodeLength = D3DGetBufferSize(ps_code); + psodesc.BlendState.AlphaToCoverageEnable = FALSE; + psodesc.BlendState.IndependentBlendEnable = FALSE; + psodesc.BlendState.RenderTarget[0].BlendEnable = TRUE; + psodesc.BlendState.RenderTarget[0].LogicOpEnable = FALSE; + psodesc.BlendState.RenderTarget[0].SrcBlend = D3D12_BLEND_SRC_ALPHA; + psodesc.BlendState.RenderTarget[0].DestBlend = D3D12_BLEND_INV_SRC_ALPHA; + psodesc.BlendState.RenderTarget[0].BlendOp = D3D12_BLEND_OP_ADD; + psodesc.BlendState.RenderTarget[0].SrcBlendAlpha = D3D12_BLEND_SRC_ALPHA; + psodesc.BlendState.RenderTarget[0].DestBlendAlpha = D3D12_BLEND_INV_SRC_ALPHA; + psodesc.BlendState.RenderTarget[0].BlendOpAlpha = D3D12_BLEND_OP_ADD; + psodesc.BlendState.RenderTarget[0].LogicOp = D3D12_LOGIC_OP_NOOP; + psodesc.BlendState.RenderTarget[0].RenderTargetWriteMask = D3D12_COLOR_WRITE_ENABLE_ALL; + psodesc.SampleMask = UINT_MAX; + psodesc.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID; + psodesc.RasterizerState.CullMode = D3D12_CULL_MODE_BACK; + psodesc.RasterizerState.FrontCounterClockwise = FALSE; + psodesc.RasterizerState.DepthBias = D3D12_DEFAULT_DEPTH_BIAS; + psodesc.RasterizerState.DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP; + psodesc.RasterizerState.SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; + psodesc.RasterizerState.DepthClipEnable = TRUE; + psodesc.RasterizerState.MultisampleEnable = FALSE; + psodesc.RasterizerState.AntialiasedLineEnable = FALSE; + psodesc.RasterizerState.ForcedSampleCount = 0; + psodesc.RasterizerState.ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF; + psodesc.DepthStencilState.DepthEnable = FALSE; + psodesc.DepthStencilState.StencilEnable = FALSE; + psodesc.InputLayout.pInputElementDescs = inputElementDesc; + psodesc.InputLayout.NumElements = countof(inputElementDesc); + psodesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; + psodesc.NumRenderTargets = 1; + psodesc.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM; + psodesc.SampleDesc.Count = 1; D3D12CreateGraphicsPipelineState(d3d12->device, &psodesc, &d3d12->pipe.handle); } @@ -497,21 +469,16 @@ bool d3d12_init_pipeline(d3d12_video_t* d3d12) D3D12_GPU_VIRTUAL_ADDRESS d3d12_create_buffer(D3D12Device device, UINT size_in_bytes, D3D12Resource* buffer) { - static const D3D12_HEAP_PROPERTIES heap_props = { - .Type = D3D12_HEAP_TYPE_UPLOAD, - .CreationNodeMask = 1, - .VisibleNodeMask = 1, - }; + D3D12_HEAP_PROPERTIES heap_props = { D3D12_HEAP_TYPE_UPLOAD, D3D12_CPU_PAGE_PROPERTY_UNKNOWN, + D3D12_MEMORY_POOL_UNKNOWN, 1, 1 }; + D3D12_RESOURCE_DESC resource_desc = { D3D12_RESOURCE_DIMENSION_BUFFER }; - D3D12_RESOURCE_DESC resource_desc = { - .Dimension = D3D12_RESOURCE_DIMENSION_BUFFER, - .Width = size_in_bytes, - .Height = 1, - .DepthOrArraySize = 1, - .MipLevels = 1, - .SampleDesc.Count = 1, - .Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR, - }; + resource_desc.Width = size_in_bytes; + resource_desc.Height = 1; + resource_desc.DepthOrArraySize = 1; + resource_desc.MipLevels = 1; + resource_desc.SampleDesc.Count = 1; + resource_desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; D3D12CreateCommittedResource( device, (D3D12_HEAP_PROPERTIES*)&heap_props, D3D12_HEAP_FLAG_NONE, &resource_desc, @@ -530,12 +497,14 @@ void d3d12_init_texture( Release(texture->upload_buffer); { + D3D12_HEAP_PROPERTIES heap_props = { D3D12_HEAP_TYPE_DEFAULT, D3D12_CPU_PAGE_PROPERTY_UNKNOWN, + D3D12_MEMORY_POOL_UNKNOWN, 1, 1 }; + texture->desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; texture->desc.DepthOrArraySize = 1; texture->desc.MipLevels = 1; 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, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, NULL, &texture->handle); @@ -546,16 +515,16 @@ void d3d12_init_texture( &texture->row_size_in_bytes, &texture->total_bytes); { - D3D12_RESOURCE_DESC buffer_desc = { - .Dimension = D3D12_RESOURCE_DIMENSION_BUFFER, - .Width = texture->total_bytes, - .Height = 1, - .DepthOrArraySize = 1, - .MipLevels = 1, - .SampleDesc.Count = 1, - .Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR, - }; - D3D12_HEAP_PROPERTIES heap_props = { D3D12_HEAP_TYPE_UPLOAD, 0, 0, 1, 1 }; + D3D12_HEAP_PROPERTIES heap_props = { D3D12_HEAP_TYPE_UPLOAD, D3D12_CPU_PAGE_PROPERTY_UNKNOWN, + D3D12_MEMORY_POOL_UNKNOWN, 1, 1 }; + D3D12_RESOURCE_DESC buffer_desc = { D3D12_RESOURCE_DIMENSION_BUFFER }; + + buffer_desc.Width = texture->total_bytes; + buffer_desc.Height = 1; + buffer_desc.DepthOrArraySize = 1; + buffer_desc.MipLevels = 1; + buffer_desc.SampleDesc.Count = 1; + buffer_desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; D3D12CreateCommittedResource( device, &heap_props, D3D12_HEAP_FLAG_NONE, &buffer_desc, @@ -563,15 +532,15 @@ void d3d12_init_texture( } { - D3D12_CPU_DESCRIPTOR_HANDLE handle; - D3D12_SHADER_RESOURCE_VIEW_DESC view_desc = { 0 }; + D3D12_CPU_DESCRIPTOR_HANDLE handle; + D3D12_SHADER_RESOURCE_VIEW_DESC view_desc = { DXGI_FORMAT_UNKNOWN }; - view_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; - view_desc.Format = texture->desc.Format; - view_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; - view_desc.Texture2D.MipLevels = texture->desc.MipLevels; + view_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; + view_desc.Format = texture->desc.Format; + view_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; + view_desc.Texture2D.MipLevels = texture->desc.MipLevels; - handle.ptr = heap->cpu.ptr + heap_index * heap->stride; + handle.ptr = heap->cpu.ptr + heap_index * heap->stride; D3D12CreateShaderResourceView(device, texture->handle, &view_desc, handle); texture->gpu_descriptor.ptr = heap->gpu.ptr + heap_index * heap->stride; @@ -583,9 +552,9 @@ void d3d12_upload_texture(D3D12GraphicsCommandList cmd, d3d12_texture_t* texture D3D12_TEXTURE_COPY_LOCATION src = { 0 }; D3D12_TEXTURE_COPY_LOCATION dst = { 0 }; - src.pResource = texture->upload_buffer; - src.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; - src.PlacedFootprint = texture->layout; + src.pResource = texture->upload_buffer; + src.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; + src.PlacedFootprint = texture->layout; dst.pResource = texture->handle; dst.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; @@ -631,10 +600,10 @@ void d3d12_create_fullscreen_quad_vbo( DXGI_FORMAT d3d12_get_closest_match( D3D12Device device, DXGI_FORMAT desired_format, D3D12_FORMAT_SUPPORT1 desired_format_support) { - DXGI_FORMAT default_list[] = {desired_format, DXGI_FORMAT_UNKNOWN}; - DXGI_FORMAT* format = dxgi_get_format_fallback_list(desired_format); + DXGI_FORMAT default_list[] = { desired_format, DXGI_FORMAT_UNKNOWN }; + DXGI_FORMAT* format = dxgi_get_format_fallback_list(desired_format); - if(!format) + if (!format) format = default_list; while (*format != DXGI_FORMAT_UNKNOWN) diff --git a/gfx/common/d3d12_common.h b/gfx/common/d3d12_common.h index 58b3c985d2..d79c1ebc4a 100644 --- a/gfx/common/d3d12_common.h +++ b/gfx/common/d3d12_common.h @@ -1365,10 +1365,10 @@ typedef struct enum { - ROOT_INDEX_TEXTURE_TABLE = 0, - ROOT_INDEX_SAMPLER_TABLE, - ROOT_INDEX_UBO, - ROOT_INDEX_MAX, + ROOT_ID_TEXTURE_T = 0, + ROOT_ID_SAMPLER_T, + ROOT_ID_UBO, + ROOT_ID_MAX, } root_signature_parameter_index_t; typedef enum { @@ -1420,13 +1420,13 @@ static INLINE void d3d12_resource_transition( static INLINE void d3d12_set_texture(D3D12GraphicsCommandList cmd, const d3d12_texture_t* texture) { - D3D12SetGraphicsRootDescriptorTable(cmd, ROOT_INDEX_TEXTURE_TABLE, texture->gpu_descriptor); + D3D12SetGraphicsRootDescriptorTable(cmd, ROOT_ID_TEXTURE_T, texture->gpu_descriptor); } static INLINE void d3d12_set_sampler(D3D12GraphicsCommandList cmd, D3D12_GPU_DESCRIPTOR_HANDLE sampler) { - D3D12SetGraphicsRootDescriptorTable(cmd, ROOT_INDEX_SAMPLER_TABLE, sampler); + D3D12SetGraphicsRootDescriptorTable(cmd, ROOT_ID_SAMPLER_T, sampler); } static INLINE void d3d12_update_texture( diff --git a/gfx/common/d3dcompiler_common.c b/gfx/common/d3dcompiler_common.c index f28bde2789..45e3f7bbb5 100644 --- a/gfx/common/d3dcompiler_common.c +++ b/gfx/common/d3dcompiler_common.c @@ -13,6 +13,8 @@ * If not, see . */ +#define CINTERFACE + #include #ifdef HAVE_CONFIG_H diff --git a/gfx/common/dxgi_common.c b/gfx/common/dxgi_common.c index dae80ff877..b1fdda3c9a 100644 --- a/gfx/common/dxgi_common.c +++ b/gfx/common/dxgi_common.c @@ -143,8 +143,8 @@ DXGI_FORMAT* dxgi_get_format_fallback_list(DXGI_FORMAT format) ((src_bs == dst_bs && src_bb == dst_bb) || !dst_bb) && \ ((src_as == dst_as && src_ab == dst_ab) || !dst_ab)) \ { \ - const UINT8* in = src_data; \ - UINT8* out = dst_data; \ + const UINT8* in = (const UINT8*)src_data; \ + UINT8* out = (UINT8*)dst_data; \ for (i = 0; i < height; i++) \ { \ memcpy(out, in, width * sizeof(src_type)); \ diff --git a/gfx/common/dxgi_common.h b/gfx/common/dxgi_common.h index d5f09e78f4..cab548975d 100644 --- a/gfx/common/dxgi_common.h +++ b/gfx/common/dxgi_common.h @@ -247,17 +247,9 @@ #endif #endif +#if !defined(__cplusplus) || defined(CINTERFACE) #ifndef COM_RELEASE_DECLARED #define COM_RELEASE_DECLARED -#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) diff --git a/gfx/display_servers/dispserv_win32.c b/gfx/display_servers/dispserv_win32.c index 620b4f5cf2..6bc3895f10 100644 --- a/gfx/display_servers/dispserv_win32.c +++ b/gfx/display_servers/dispserv_win32.c @@ -85,7 +85,7 @@ static void* win32_display_server_init(void) if (!SUCCEEDED(hr)) { - g_taskbarList = false; + g_taskbarList = NULL; RARCH_ERR("[dispserv]: CoCreateInstance of ITaskbarList3 failed.\n"); } #endif diff --git a/gfx/drivers/d3d10.c b/gfx/drivers/d3d10.c index e0c2bb78d7..4cfb21512c 100644 --- a/gfx/drivers/d3d10.c +++ b/gfx/drivers/d3d10.c @@ -13,6 +13,8 @@ * If not, see . */ +#define CINTERFACE + #include #include diff --git a/gfx/drivers/d3d11.c b/gfx/drivers/d3d11.c index 3698afae39..fdcf1f00df 100644 --- a/gfx/drivers/d3d11.c +++ b/gfx/drivers/d3d11.c @@ -13,6 +13,8 @@ * If not, see . */ +#define CINTERFACE + #include #include @@ -39,7 +41,7 @@ static void d3d11_set_filtering(void* data, unsigned index, bool smooth) { - unsigned i; + unsigned i; d3d11_video_t* d3d11 = (d3d11_video_t*)data; for (i = 0; i < RARCH_WRAP_MAX; i++) @@ -141,8 +143,9 @@ static void d3d11_free_shader_preset(d3d11_video_t* d3d11) static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const char* path) { #if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS) - unsigned i; - d3d11_video_t* d3d11 = (d3d11_video_t*)data; + unsigned i; + d3d11_texture_t* source; + d3d11_video_t* d3d11 = (d3d11_video_t*)data; if (!d3d11) return false; @@ -171,8 +174,7 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const video_shader_resolve_relative(d3d11->shader_preset, path); - d3d11_texture_t* source = &d3d11->frame.texture[0]; - + source = &d3d11->frame.texture[0]; for (i = 0; i < d3d11->shader_preset->passes; source = &d3d11->pass[i++].rt) { unsigned j; @@ -219,16 +221,16 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const /* clang-format on */ if (!slang_process( - d3d11->shader_preset, i, RARCH_SHADER_HLSL, 50, &semantics_map, - &d3d11->pass[i].semantics)) + d3d11->shader_preset, i, RARCH_SHADER_HLSL, 50, &semantics_map, + &d3d11->pass[i].semantics)) goto error; { static const D3D11_INPUT_ELEMENT_DESC desc[] = { { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_vertex_t, position), - D3D11_INPUT_PER_VERTEX_DATA, 0 }, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 1, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_vertex_t, texcoord), - D3D11_INPUT_PER_VERTEX_DATA, 0 }, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, }; #ifdef DEBUG bool save_hlsl = true; @@ -253,13 +255,13 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const strncpy(ps_path + base_len, ps_ext, sizeof(ps_ext)); if (!d3d11_init_shader( - d3d11->device, vs_src, 0, vs_path, "main", NULL, NULL, desc, countof(desc), - &d3d11->pass[i].shader)) + d3d11->device, vs_src, 0, vs_path, "main", NULL, NULL, desc, countof(desc), + &d3d11->pass[i].shader)) save_hlsl = true; if (!d3d11_init_shader( - d3d11->device, ps_src, 0, ps_path, NULL, "main", NULL, NULL, 0, - &d3d11->pass[i].shader)) + d3d11->device, ps_src, 0, ps_path, NULL, "main", NULL, NULL, 0, + &d3d11->pass[i].shader)) save_hlsl = true; if (save_hlsl) @@ -342,7 +344,7 @@ error: static void d3d11_gfx_free(void* data) { - unsigned i; + unsigned i; d3d11_video_t* d3d11 = (d3d11_video_t*)data; if (!d3d11) @@ -400,7 +402,7 @@ static void d3d11_gfx_free(void* data) static void* d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** input_data) { - unsigned i; + unsigned i; WNDCLASSEX wndclass = { 0 }; MONITORINFOEX current_mon; HMONITOR hm_to_use; @@ -436,25 +438,25 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i { UINT flags = 0; D3D_FEATURE_LEVEL requested_feature_level = D3D_FEATURE_LEVEL_11_0; - DXGI_SWAP_CHAIN_DESC desc = { - .BufferCount = 1, - .BufferDesc.Width = d3d11->vp.full_width, - .BufferDesc.Height = d3d11->vp.full_height, - .BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM, - .BufferDesc.RefreshRate.Numerator = 60, - .BufferDesc.RefreshRate.Denominator = 1, - .BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT, - .OutputWindow = main_window.hwnd, - .SampleDesc.Count = 1, - .SampleDesc.Quality = 0, - .Windowed = TRUE, - .SwapEffect = DXGI_SWAP_EFFECT_SEQUENTIAL, + DXGI_SWAP_CHAIN_DESC desc = { 0 }; + + desc.BufferCount = 1; + desc.BufferDesc.Width = d3d11->vp.full_width; + desc.BufferDesc.Height = d3d11->vp.full_height; + desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + desc.BufferDesc.RefreshRate.Numerator = 60; + desc.BufferDesc.RefreshRate.Denominator = 1; + desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + desc.OutputWindow = main_window.hwnd; + desc.SampleDesc.Count = 1; + desc.SampleDesc.Quality = 0; + desc.Windowed = TRUE; + desc.SwapEffect = DXGI_SWAP_EFFECT_SEQUENTIAL; #if 0 - .SwapEffect = DXGI_SWAP_EFFECT_DISCARD, - .SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL, - .SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD, + desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; + desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; + desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; #endif - }; #ifdef DEBUG flags |= D3D11_CREATE_DEVICE_DEBUG; @@ -508,12 +510,12 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i d3d11_gfx_set_rotation(d3d11, 0); { - D3D11_SAMPLER_DESC desc = { - .MaxAnisotropy = 1, - .ComparisonFunc = D3D11_COMPARISON_NEVER, - .MinLOD = -D3D11_FLOAT32_MAX, - .MaxLOD = D3D11_FLOAT32_MAX, - }; + D3D11_SAMPLER_DESC desc = { D3D11_FILTER_MIN_MAG_MIP_POINT }; + desc.MaxAnisotropy = 1; + desc.ComparisonFunc = D3D11_COMPARISON_NEVER; + desc.MinLOD = -D3D11_FLOAT32_MAX; + desc.MaxLOD = D3D11_FLOAT32_MAX; + /* Initialize samplers */ for (i = 0; i < RARCH_WRAP_MAX; i++) { @@ -557,11 +559,11 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i }; { - D3D11_BUFFER_DESC desc = { - .Usage = D3D11_USAGE_IMMUTABLE, - .ByteWidth = sizeof(vertices), - .BindFlags = D3D11_BIND_VERTEX_BUFFER, - }; + D3D11_BUFFER_DESC desc = { 0 }; + desc.Usage = D3D11_USAGE_IMMUTABLE; + desc.ByteWidth = sizeof(vertices); + desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + D3D11_SUBRESOURCE_DATA vertexData = { vertices }; D3D11CreateBuffer(d3d11->device, &desc, &vertexData, &d3d11->frame.vbo); desc.Usage = D3D11_USAGE_DYNAMIC; @@ -691,21 +693,18 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i } { - D3D11_BLEND_DESC blend_desc = { - .AlphaToCoverageEnable = FALSE, - .IndependentBlendEnable = FALSE, - .RenderTarget[0] = - { - .BlendEnable = TRUE, - D3D11_BLEND_SRC_ALPHA, - D3D11_BLEND_INV_SRC_ALPHA, - D3D11_BLEND_OP_ADD, - D3D11_BLEND_SRC_ALPHA, - D3D11_BLEND_INV_SRC_ALPHA, - D3D11_BLEND_OP_ADD, - D3D11_COLOR_WRITE_ENABLE_ALL, - }, - }; + D3D11_BLEND_DESC blend_desc = { 0 }; + + blend_desc.AlphaToCoverageEnable = FALSE; + blend_desc.IndependentBlendEnable = FALSE; + blend_desc.RenderTarget[0].BlendEnable = TRUE; + blend_desc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA; + blend_desc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; + blend_desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; + blend_desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA; + blend_desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA; + blend_desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; + blend_desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; D3D11CreateBlendState(d3d11->device, &blend_desc, &d3d11->blend_enable); blend_desc.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE; @@ -716,10 +715,11 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i D3D11CreateBlendState(d3d11->device, &blend_desc, &d3d11->blend_disable); } { - D3D11_RASTERIZER_DESC desc = { - .FillMode = D3D11_FILL_SOLID, - .CullMode = D3D11_CULL_NONE, - }; + D3D11_RASTERIZER_DESC desc = { 0 }; + + desc.FillMode = D3D11_FILL_SOLID; + desc.CullMode = D3D11_CULL_NONE; + D3D11CreateRasterizerState(d3d11->device, &desc, &d3d11->state); } D3D11SetState(d3d11->context, d3d11->state); @@ -873,8 +873,8 @@ static bool d3d11_gfx_frame( const char* msg, video_frame_info_t* video_info) { - unsigned i; - d3d11_texture_t* texture = NULL; + unsigned i; + d3d11_texture_t* texture = NULL; d3d11_video_t* d3d11 = (d3d11_video_t*)data; D3D11DeviceContext context = d3d11->context; @@ -883,7 +883,7 @@ static bool d3d11_gfx_frame( D3D11Texture2D backBuffer; Release(d3d11->renderTargetView); - DXGIResizeBuffers(d3d11->swapChain, 0, 0, 0, 0, 0); + DXGIResizeBuffers(d3d11->swapChain, 0, 0, 0, DXGI_FORMAT_UNKNOWN, 0); DXGIGetSwapChainBufferD3D11(d3d11->swapChain, 0, &backBuffer); D3D11CreateTexture2DRenderTargetView( @@ -1176,8 +1176,9 @@ static bool d3d11_gfx_read_viewport(void* data, uint8_t* buffer, bool is_idle) static void d3d11_set_menu_texture_frame( void* data, const void* frame, bool rgb32, unsigned width, unsigned height, float alpha) { - d3d11_video_t* d3d11 = (d3d11_video_t*)data; - DXGI_FORMAT format = rgb32 ? DXGI_FORMAT_B8G8R8A8_UNORM : DXGI_FORMAT_EX_A4R4G4B4_UNORM; + d3d11_video_t* d3d11 = (d3d11_video_t*)data; + DXGI_FORMAT format = + rgb32 ? DXGI_FORMAT_B8G8R8A8_UNORM : (DXGI_FORMAT)DXGI_FORMAT_EX_A4R4G4B4_UNORM; if (d3d11->menu.texture.desc.Width != width || d3d11->menu.texture.desc.Height != height) { @@ -1247,7 +1248,7 @@ static uintptr_t d3d11_gfx_load_texture( if (!d3d11) return 0; - texture = (d3d11_texture_t*)calloc(1, sizeof(*texture)); + texture = (d3d11_texture_t*)calloc(1, sizeof(*texture)); if (!texture) return 0; diff --git a/gfx/drivers/d3d12.c b/gfx/drivers/d3d12.c index f1c48a1ad2..b4d1690818 100644 --- a/gfx/drivers/d3d12.c +++ b/gfx/drivers/d3d12.c @@ -13,6 +13,8 @@ * If not, see . */ +#define CINTERFACE + #include #include @@ -236,7 +238,7 @@ static bool d3d12_gfx_frame( D3D12RSSetScissorRects(d3d12->queue.cmd, 1, &d3d12->frame.scissorRect); D3D12SetGraphicsRootConstantBufferView( - d3d12->queue.cmd, ROOT_INDEX_UBO, d3d12->frame.ubo_view.BufferLocation); + d3d12->queue.cmd, ROOT_ID_UBO, d3d12->frame.ubo_view.BufferLocation); d3d12_set_texture(d3d12->queue.cmd, &d3d12->frame.texture); d3d12_set_sampler(d3d12->queue.cmd, d3d12->frame.sampler); D3D12IASetVertexBuffers(d3d12->queue.cmd, 0, 1, &d3d12->frame.vbo_view); @@ -248,7 +250,7 @@ static bool d3d12_gfx_frame( d3d12_upload_texture(d3d12->queue.cmd, &d3d12->menu.texture); D3D12SetGraphicsRootConstantBufferView( - d3d12->queue.cmd, ROOT_INDEX_UBO, d3d12->ubo_view.BufferLocation); + d3d12->queue.cmd, ROOT_ID_UBO, d3d12->ubo_view.BufferLocation); if (d3d12->menu.fullscreen) { diff --git a/gfx/drivers_font/d3d11_font.c b/gfx/drivers_font/d3d11_font.c index 6008a74747..7b75949259 100644 --- a/gfx/drivers_font/d3d11_font.c +++ b/gfx/drivers_font/d3d11_font.c @@ -13,6 +13,8 @@ * If not, see . */ +#define CINTERFACE + #include #include #include diff --git a/libretro-common/streams/file_stream.c b/libretro-common/streams/file_stream.c index 38efa2d7c5..cc062f4169 100644 --- a/libretro-common/streams/file_stream.c +++ b/libretro-common/streams/file_stream.c @@ -31,6 +31,7 @@ #endif #include +#define VFS_FRONTEND #include static const int64_t vfs_error_return_value = -1; diff --git a/menu/drivers_display/menu_display_d3d11.c b/menu/drivers_display/menu_display_d3d11.c index e601d86ce0..111b9befb8 100644 --- a/menu/drivers_display/menu_display_d3d11.c +++ b/menu/drivers_display/menu_display_d3d11.c @@ -13,6 +13,8 @@ * If not, see . */ +#define CINTERFACE + #include #ifdef HAVE_CONFIG_H @@ -80,12 +82,12 @@ static void menu_display_d3d11_draw(void* data) { D3D11_MAPPED_SUBRESOURCE mapped_vbo; - d3d11_sprite_t *v = NULL; + d3d11_sprite_t* v = NULL; D3D11MapBuffer( d3d11->context, d3d11->sprites.vbo, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mapped_vbo); - v = (d3d11_sprite_t*)mapped_vbo.pData + d3d11->sprites.offset; + v = (d3d11_sprite_t*)mapped_vbo.pData + d3d11->sprites.offset; v->pos.x = draw->x / (float)d3d11->viewport.Width; v->pos.y = (d3d11->viewport.Height - draw->y - draw->height) / (float)d3d11->viewport.Height; @@ -139,15 +141,15 @@ static void menu_display_d3d11_draw_pipeline(void* data) case VIDEO_SHADER_MENU: case VIDEO_SHADER_MENU_2: { - video_coord_array_t *ca = menu_display_get_coords_array(); + video_coord_array_t* ca = menu_display_get_coords_array(); if (!d3d11->menu_pipeline_vbo) { - D3D11_BUFFER_DESC desc = { - .Usage = D3D11_USAGE_IMMUTABLE, - .ByteWidth = ca->coords.vertices * 2 * sizeof(float), - .BindFlags = D3D11_BIND_VERTEX_BUFFER, - }; + D3D11_BUFFER_DESC desc = { 0 }; + desc.Usage = D3D11_USAGE_IMMUTABLE; + desc.ByteWidth = ca->coords.vertices * 2 * sizeof(float); + desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + D3D11_SUBRESOURCE_DATA vertexData = { ca->coords.vertex }; D3D11CreateBuffer(d3d11->device, &desc, &vertexData, &d3d11->menu_pipeline_vbo); } @@ -199,12 +201,12 @@ static bool menu_display_d3d11_font_init_first( float font_size, bool is_threaded) { - font_data_t** handle = (font_data_t**)font_handle; - font_data_t *new_handle = font_driver_init_first( - video_data, font_path, font_size, true, is_threaded, FONT_DRIVER_RENDER_D3D11_API); + font_data_t** handle = (font_data_t**)font_handle; + font_data_t* new_handle = font_driver_init_first( + video_data, font_path, font_size, true, is_threaded, FONT_DRIVER_RENDER_D3D11_API); if (!new_handle) - return false; - *handle = new_handle; + return false; + *handle = new_handle; return true; } diff --git a/network/netplay/netplay_sync.c b/network/netplay/netplay_sync.c index da8bcfc1bd..aff2359cf8 100644 --- a/network/netplay/netplay_sync.c +++ b/network/netplay/netplay_sync.c @@ -426,8 +426,8 @@ bool netplay_resolve_input(netplay_t *netplay, size_t sim_ptr, bool resim) { /* Merge them */ /* Most devices have all the digital parts in the first word. */ - static const uint32_t digital_common[3] = {-1, 0, 0}; - static const uint32_t digital_keyboard[5] = {-1, -1, -1, -1, -1}; + static const uint32_t digital_common[3] = {~0u, 0u, 0u}; + static const uint32_t digital_keyboard[5] = {~0u, ~0u, ~0u, ~0u, ~0u}; const uint32_t *digital; if (dtype == RETRO_DEVICE_KEYBOARD) digital = digital_keyboard; diff --git a/tasks/task_autodetect.c b/tasks/task_autodetect.c index 09b0ee76c5..384ab17d6b 100644 --- a/tasks/task_autodetect.c +++ b/tasks/task_autodetect.c @@ -50,8 +50,11 @@ #include #include -#ifndef __cplusplus /* Why doesn't including cguid.h work to get a GUID_NULL instead? */ +#ifdef __cplusplus +EXTERN_C __attribute__((weak)) +const GUID GUID_NULL = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}}; +#else __attribute__((weak)) const GUID GUID_NULL = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}}; #endif