(D3D9) Cleanups - get rid of more inline functions

This commit is contained in:
twinaphex 2022-04-24 15:07:56 +02:00
parent 96d7c31983
commit d6aa3fdce5
7 changed files with 38 additions and 627 deletions

View File

@ -166,21 +166,6 @@ static INLINE void D3D11SetGShaderConstantBuffers(
device_context, start_slot, num_buffers, constant_buffers);
}
static INLINE void
D3D11SetPrimitiveTopology(D3D11DeviceContext device_context, D3D11_PRIMITIVE_TOPOLOGY topology)
{
device_context->lpVtbl->IASetPrimitiveTopology(device_context, topology);
}
static INLINE void D3D11SetVShaderResources(
D3D11DeviceContext device_context,
UINT start_slot,
UINT num_views,
D3D11ShaderResourceView* const shader_resource_views)
{
device_context->lpVtbl->VSSetShaderResources(
device_context, start_slot, num_views, shader_resource_views);
}
static INLINE HRESULT D3D11GetData(
D3D11DeviceContext device_context,
D3D11Asynchronous async,
@ -195,102 +180,7 @@ static INLINE void D3D11SetPredication(
{
device_context->lpVtbl->SetPredication(device_context, predicate, predicate_value);
}
static INLINE void D3D11SetGShaderResources(
D3D11DeviceContext device_context,
UINT start_slot,
UINT num_views,
D3D11ShaderResourceView* const shader_resource_views)
{
device_context->lpVtbl->GSSetShaderResources(
device_context, start_slot, num_views, shader_resource_views);
}
static INLINE void D3D11SetGShaderSamplers(
D3D11DeviceContext device_context,
UINT start_slot,
UINT num_samplers,
D3D11SamplerState* const samplers)
{
device_context->lpVtbl->GSSetSamplers(device_context, start_slot, num_samplers, samplers);
}
static INLINE void D3D11DispatchIndirect(
D3D11DeviceContext device_context,
D3D11Buffer buffer_for_args,
UINT aligned_byte_offset_for_args)
{
device_context->lpVtbl->DispatchIndirect(
device_context, buffer_for_args, aligned_byte_offset_for_args);
}
static INLINE void D3D11CopySubresourceRegion(
D3D11DeviceContext device_context,
D3D11Resource dst_resource,
UINT dst_subresource,
UINT dst_x,
UINT dst_y,
UINT dst_z,
D3D11Resource src_resource,
UINT src_subresource,
D3D11_BOX* src_box)
{
device_context->lpVtbl->CopySubresourceRegion(
device_context, dst_resource, dst_subresource, dst_x, dst_y, dst_z, src_resource,
src_subresource, src_box);
}
static INLINE void D3D11CopyResource(
D3D11DeviceContext device_context, D3D11Resource dst_resource, D3D11Resource src_resource)
{
device_context->lpVtbl->CopyResource(device_context, dst_resource, src_resource);
}
static INLINE void D3D11UpdateSubresource(
D3D11DeviceContext device_context,
D3D11Resource dst_resource,
UINT dst_subresource,
D3D11_BOX* dst_box,
void* src_data,
UINT src_row_pitch,
UINT src_depth_pitch)
{
device_context->lpVtbl->UpdateSubresource(
device_context, dst_resource, dst_subresource, dst_box, src_data, src_row_pitch,
src_depth_pitch);
}
static INLINE void D3D11CopyStructureCount(
D3D11DeviceContext device_context,
D3D11Buffer dst_buffer,
UINT dst_aligned_byte_offset,
D3D11UnorderedAccessView src_view)
{
device_context->lpVtbl->CopyStructureCount(
device_context, dst_buffer, dst_aligned_byte_offset, src_view);
}
static INLINE void D3D11ClearUnorderedAccessViewUint(
D3D11DeviceContext device_context,
D3D11UnorderedAccessView unordered_access_view,
UINT values[4])
{
device_context->lpVtbl->ClearUnorderedAccessViewUint(
device_context, unordered_access_view, values);
}
static INLINE void D3D11ClearUnorderedAccessViewFloat(
D3D11DeviceContext device_context,
D3D11UnorderedAccessView unordered_access_view,
FLOAT values[4])
{
device_context->lpVtbl->ClearUnorderedAccessViewFloat(
device_context, unordered_access_view, values);
}
static INLINE void D3D11ClearDepthStencilView(
D3D11DeviceContext device_context,
D3D11DepthStencilView depth_stencil_view,
UINT clear_flags,
FLOAT depth,
UINT8 stencil)
{
device_context->lpVtbl->ClearDepthStencilView(
device_context, depth_stencil_view, clear_flags, depth, stencil);
}
static INLINE void
D3D11GenerateMips(D3D11DeviceContext device_context, D3D11ShaderResourceView shader_resource_view)
{
@ -306,119 +196,6 @@ D3D11GetResourceMinLOD(D3D11DeviceContext device_context, D3D11Resource resource
{
return device_context->lpVtbl->GetResourceMinLOD(device_context, resource);
}
static INLINE void D3D11ResolveSubresource(
D3D11DeviceContext device_context,
D3D11Resource dst_resource,
UINT dst_subresource,
D3D11Resource src_resource,
UINT src_subresource,
DXGI_FORMAT format)
{
device_context->lpVtbl->ResolveSubresource(
device_context, dst_resource, dst_subresource, src_resource, src_subresource, format);
}
static INLINE void D3D11HSSetShaderResources(
D3D11DeviceContext device_context,
UINT start_slot,
UINT num_views,
D3D11ShaderResourceView* const shader_resource_views)
{
device_context->lpVtbl->HSSetShaderResources(
device_context, start_slot, num_views, shader_resource_views);
}
static INLINE void D3D11HSSetShader(
D3D11DeviceContext device_context,
D3D11HullShader hull_shader,
D3D11ClassInstance* const class_instances,
UINT num_class_instances)
{
device_context->lpVtbl->HSSetShader(
device_context, hull_shader, class_instances, num_class_instances);
}
static INLINE void D3D11HSSetSamplers(
D3D11DeviceContext device_context,
UINT start_slot,
UINT num_samplers,
D3D11SamplerState* const samplers)
{
device_context->lpVtbl->HSSetSamplers(device_context, start_slot, num_samplers, samplers);
}
static INLINE void D3D11HSSetConstantBuffers(
D3D11DeviceContext device_context,
UINT start_slot,
UINT num_buffers,
D3D11Buffer* const constant_buffers)
{
device_context->lpVtbl->HSSetConstantBuffers(
device_context, start_slot, num_buffers, constant_buffers);
}
static INLINE void D3D11GetPShaderResources(
D3D11DeviceContext device_context,
UINT start_slot,
UINT num_views,
D3D11ShaderResourceView* shader_resource_views)
{
device_context->lpVtbl->PSGetShaderResources(
device_context, start_slot, num_views, shader_resource_views);
}
static INLINE void D3D11GetPShaderSamplers(
D3D11DeviceContext device_context,
UINT start_slot,
UINT num_samplers,
D3D11SamplerState* samplers)
{
device_context->lpVtbl->PSGetSamplers(device_context, start_slot, num_samplers, samplers);
}
static INLINE void D3D11GetPShaderConstantBuffers(
D3D11DeviceContext device_context,
UINT start_slot,
UINT num_buffers,
D3D11Buffer* constant_buffers)
{
device_context->lpVtbl->PSGetConstantBuffers(
device_context, start_slot, num_buffers, constant_buffers);
}
static INLINE void
D3D11GetInputLayout(D3D11DeviceContext device_context, D3D11InputLayout* input_layout)
{
device_context->lpVtbl->IAGetInputLayout(device_context, input_layout);
}
static INLINE void D3D11GetVertexBuffers(
D3D11DeviceContext device_context,
UINT start_slot,
UINT num_buffers,
D3D11Buffer* vertex_buffers,
UINT* strides,
UINT* offsets)
{
device_context->lpVtbl->IAGetVertexBuffers(
device_context, start_slot, num_buffers, vertex_buffers, strides, offsets);
}
static INLINE void D3D11GetIndexBuffer(
D3D11DeviceContext device_context,
D3D11Buffer* index_buffer,
DXGI_FORMAT* format,
UINT* offset)
{
device_context->lpVtbl->IAGetIndexBuffer(device_context, index_buffer, format, offset);
}
static INLINE void
D3D11GetPrimitiveTopology(D3D11DeviceContext device_context, D3D11_PRIMITIVE_TOPOLOGY* topology)
{
device_context->lpVtbl->IAGetPrimitiveTopology(device_context, topology);
}
static INLINE void D3D11GetDepthStencilState(
D3D11DeviceContext device_context,
D3D11DepthStencilState* depth_stencil_state,
UINT* stencil_ref)
{
device_context->lpVtbl->OMGetDepthStencilState(device_context, depth_stencil_state, stencil_ref);
}
static INLINE void
D3D11GetState(D3D11DeviceContext device_context, D3D11RasterizerState* rasterizer_state)
@ -426,58 +203,11 @@ D3D11GetState(D3D11DeviceContext device_context, D3D11RasterizerState* rasterize
device_context->lpVtbl->RSGetState(device_context, rasterizer_state);
}
static INLINE void D3D11HSGetShaderResources(
D3D11DeviceContext device_context,
UINT start_slot,
UINT num_views,
D3D11ShaderResourceView* shader_resource_views)
{
device_context->lpVtbl->HSGetShaderResources(
device_context, start_slot, num_views, shader_resource_views);
}
static INLINE void D3D11HSGetShader(
D3D11DeviceContext device_context,
D3D11HullShader* hull_shader,
D3D11ClassInstance* class_instances,
UINT* num_class_instances)
{
device_context->lpVtbl->HSGetShader(
device_context, hull_shader, class_instances, num_class_instances);
}
static INLINE void D3D11HSGetSamplers(
D3D11DeviceContext device_context,
UINT start_slot,
UINT num_samplers,
D3D11SamplerState* samplers)
{
device_context->lpVtbl->HSGetSamplers(device_context, start_slot, num_samplers, samplers);
}
static INLINE void D3D11HSGetConstantBuffers(
D3D11DeviceContext device_context,
UINT start_slot,
UINT num_buffers,
D3D11Buffer* constant_buffers)
{
device_context->lpVtbl->HSGetConstantBuffers(
device_context, start_slot, num_buffers, constant_buffers);
}
static INLINE UINT D3D11GetDeviceContextContextFlags(D3D11DeviceContext device_context)
{
return device_context->lpVtbl->GetContextFlags(device_context);
}
static INLINE HRESULT D3D11GetCreationParameters(
D3D11VideoDecoder video_decoder,
D3D11_VIDEO_DECODER_DESC* video_desc,
D3D11_VIDEO_DECODER_CONFIG* config)
{
return video_decoder->lpVtbl->GetCreationParameters(video_decoder, video_desc, config);
}
static INLINE HRESULT D3D11GetDriverHandle(D3D11VideoDecoder video_decoder, HANDLE* driver_handle)
{
return video_decoder->lpVtbl->GetDriverHandle(video_decoder, driver_handle);
}
static INLINE HRESULT D3D11GetAuthenticatedChannelCertificateSize(
D3D11AuthenticatedChannel authenticated_channel, UINT* certificate_size)
{
@ -518,37 +248,6 @@ D3D11GetCryptoSessionHandle(D3D11CryptoSession crypto_session, HANDLE* crypto_se
{
crypto_session->lpVtbl->GetCryptoSessionHandle(crypto_session, crypto_session_handle);
}
static INLINE void D3D11GetVideoDecoderOutputViewResource(
D3D11VideoDecoderOutputView video_decoder_output_view, D3D11Resource* resource)
{
video_decoder_output_view->lpVtbl->GetResource(video_decoder_output_view, resource);
}
static INLINE HRESULT D3D11GetDecoderBuffer(
D3D11VideoContext video_context,
D3D11VideoDecoder decoder,
D3D11_VIDEO_DECODER_BUFFER_TYPE type,
UINT* buffer_size,
void** buffer)
{
return video_context->lpVtbl->GetDecoderBuffer(
video_context, decoder, type, buffer_size, buffer);
}
static INLINE HRESULT D3D11ReleaseDecoderBuffer(
D3D11VideoContext video_context,
D3D11VideoDecoder decoder,
D3D11_VIDEO_DECODER_BUFFER_TYPE type)
{
return video_context->lpVtbl->ReleaseDecoderBuffer(video_context, decoder, type);
}
static INLINE HRESULT D3D11SubmitDecoderBuffers(
D3D11VideoContext video_context,
D3D11VideoDecoder decoder,
UINT num_buffers,
D3D11_VIDEO_DECODER_BUFFER_DESC* buffer_desc)
{
return video_context->lpVtbl->SubmitDecoderBuffers(
video_context, decoder, num_buffers, buffer_desc);
}
static INLINE HRESULT D3D11NegotiateCryptoSessionKeyExchange(
D3D11VideoContext video_context,
@ -658,14 +357,6 @@ static INLINE void D3D11VideoProcessorGetStreamRotation(
video_context->lpVtbl->VideoProcessorGetStreamRotation(
video_context, video_processor, stream_index, enable, rotation);
}
static INLINE HRESULT D3D11CreateVideoDecoder(
D3D11VideoDevice video_device,
D3D11_VIDEO_DECODER_DESC* video_desc,
D3D11_VIDEO_DECODER_CONFIG* config,
D3D11VideoDecoder* decoder)
{
return video_device->lpVtbl->CreateVideoDecoder(video_device, video_desc, config, decoder);
}
static INLINE HRESULT D3D11CreateAuthenticatedChannel(
D3D11VideoDevice video_device,
D3D11_AUTHENTICATED_CHANNEL_TYPE channel_type,
@ -684,62 +375,6 @@ static INLINE HRESULT D3D11CreateCryptoSession(
return video_device->lpVtbl->CreateCryptoSession(
video_device, crypto_type, decoder_profile, key_exchange_type, crypto_session);
}
static INLINE HRESULT D3D11CreateVideoDecoderOutputView(
D3D11VideoDevice video_device,
D3D11Resource resource,
D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC* desc,
D3D11VideoDecoderOutputView* vdovview)
{
return video_device->lpVtbl->CreateVideoDecoderOutputView(
video_device, resource, desc, vdovview);
}
static INLINE UINT D3D11GetVideoDecoderProfileCount(D3D11VideoDevice video_device)
{
return video_device->lpVtbl->GetVideoDecoderProfileCount(video_device);
}
static INLINE HRESULT
D3D11GetVideoDecoderProfile(D3D11VideoDevice video_device, UINT index, GUID* decoder_profile)
{
return video_device->lpVtbl->GetVideoDecoderProfile(video_device, index, decoder_profile);
}
static INLINE HRESULT D3D11CheckVideoDecoderFormat(
D3D11VideoDevice video_device, GUID* decoder_profile, DXGI_FORMAT format, BOOL* supported)
{
return video_device->lpVtbl->CheckVideoDecoderFormat(
video_device, decoder_profile, format, supported);
}
static INLINE HRESULT D3D11GetVideoDecoderConfigCount(
D3D11VideoDevice video_device, D3D11_VIDEO_DECODER_DESC* desc, UINT* count)
{
return video_device->lpVtbl->GetVideoDecoderConfigCount(video_device, desc, count);
}
static INLINE HRESULT D3D11GetVideoDecoderConfig(
D3D11VideoDevice video_device,
D3D11_VIDEO_DECODER_DESC* desc,
UINT index,
D3D11_VIDEO_DECODER_CONFIG* config)
{
return video_device->lpVtbl->GetVideoDecoderConfig(video_device, desc, index, config);
}
static INLINE HRESULT D3D11GetContentProtectionCaps(
D3D11VideoDevice video_device,
GUID* crypto_type,
GUID* decoder_profile,
D3D11_VIDEO_CONTENT_PROTECTION_CAPS* caps)
{
return video_device->lpVtbl->GetContentProtectionCaps(
video_device, crypto_type, decoder_profile, caps);
}
static INLINE HRESULT D3D11CheckCryptoKeyExchange(
D3D11VideoDevice video_device,
GUID* crypto_type,
GUID* decoder_profile,
UINT index,
GUID* key_exchange_type)
{
return video_device->lpVtbl->CheckCryptoKeyExchange(
video_device, crypto_type, decoder_profile, index, key_exchange_type);
}
static INLINE HRESULT D3D11CreateBuffer(
D3D11Device device,
D3D11_BUFFER_DESC* desc,
@ -952,116 +587,6 @@ static INLINE UINT D3D11GetCreationFlags(D3D11Device device)
{
return device->lpVtbl->GetCreationFlags(device);
}
static INLINE HRESULT D3D11GetDeviceRemovedReason(D3D11Device device)
{
return device->lpVtbl->GetDeviceRemovedReason(device);
}
static INLINE void
D3D11GetImmediateContext(D3D11Device device, D3D11DeviceContext* immediate_context)
{
device->lpVtbl->GetImmediateContext(device, immediate_context);
}
static INLINE HRESULT D3D11SetExceptionMode(D3D11Device device, UINT raise_flags)
{
return device->lpVtbl->SetExceptionMode(device, raise_flags);
}
static INLINE UINT D3D11GetExceptionMode(D3D11Device device)
{
return device->lpVtbl->GetExceptionMode(device);
}
static INLINE HRESULT D3D11SetShaderTrackingOptionsByType(
D3D11TracingDevice tracing_device, UINT resource_type_flags, UINT options)
{
return tracing_device->lpVtbl->SetShaderTrackingOptionsByType(
tracing_device, resource_type_flags, options);
}
static INLINE HRESULT
D3D11SetShaderTrackingOptions(D3D11TracingDevice tracing_device, void* shader, UINT options)
{
return tracing_device->lpVtbl->SetShaderTrackingOptions(
tracing_device, (IUnknown*)shader, options);
}
static INLINE HRESULT
D3D11SetMessageCountLimit(D3D11InfoQueue info_queue, UINT64 message_count_limit)
{
return info_queue->lpVtbl->SetMessageCountLimit(info_queue, message_count_limit);
}
static INLINE void D3D11ClearStoredMessages(D3D11InfoQueue info_queue)
{
info_queue->lpVtbl->ClearStoredMessages(info_queue);
}
static INLINE HRESULT
D3D11AddStorageFilterEntries(D3D11InfoQueue info_queue, D3D11_INFO_QUEUE_FILTER* filter)
{
return info_queue->lpVtbl->AddStorageFilterEntries(info_queue, filter);
}
static INLINE HRESULT D3D11GetStorageFilter(
D3D11InfoQueue info_queue, D3D11_INFO_QUEUE_FILTER* filter, SIZE_T* filter_byte_length)
{
return info_queue->lpVtbl->GetStorageFilter(info_queue, filter, filter_byte_length);
}
static INLINE void D3D11ClearStorageFilter(D3D11InfoQueue info_queue)
{
info_queue->lpVtbl->ClearStorageFilter(info_queue);
}
static INLINE HRESULT D3D11PushEmptyStorageFilter(D3D11InfoQueue info_queue)
{
return info_queue->lpVtbl->PushEmptyStorageFilter(info_queue);
}
static INLINE HRESULT D3D11PushCopyOfStorageFilter(D3D11InfoQueue info_queue)
{
return info_queue->lpVtbl->PushCopyOfStorageFilter(info_queue);
}
static INLINE HRESULT
D3D11PushStorageFilter(D3D11InfoQueue info_queue, D3D11_INFO_QUEUE_FILTER* filter)
{
return info_queue->lpVtbl->PushStorageFilter(info_queue, filter);
}
static INLINE void D3D11PopStorageFilter(D3D11InfoQueue info_queue)
{
info_queue->lpVtbl->PopStorageFilter(info_queue);
}
static INLINE UINT D3D11GetStorageFilterStackSize(D3D11InfoQueue info_queue)
{
return info_queue->lpVtbl->GetStorageFilterStackSize(info_queue);
}
static INLINE HRESULT
D3D11AddRetrievalFilterEntries(D3D11InfoQueue info_queue, D3D11_INFO_QUEUE_FILTER* filter)
{
return info_queue->lpVtbl->AddRetrievalFilterEntries(info_queue, filter);
}
static INLINE HRESULT D3D11GetRetrievalFilter(
D3D11InfoQueue info_queue, D3D11_INFO_QUEUE_FILTER* filter, SIZE_T* filter_byte_length)
{
return info_queue->lpVtbl->GetRetrievalFilter(info_queue, filter, filter_byte_length);
}
static INLINE void D3D11ClearRetrievalFilter(D3D11InfoQueue info_queue)
{
info_queue->lpVtbl->ClearRetrievalFilter(info_queue);
}
static INLINE HRESULT D3D11PushEmptyRetrievalFilter(D3D11InfoQueue info_queue)
{
return info_queue->lpVtbl->PushEmptyRetrievalFilter(info_queue);
}
static INLINE HRESULT D3D11PushCopyOfRetrievalFilter(D3D11InfoQueue info_queue)
{
return info_queue->lpVtbl->PushCopyOfRetrievalFilter(info_queue);
}
static INLINE HRESULT
D3D11PushRetrievalFilter(D3D11InfoQueue info_queue, D3D11_INFO_QUEUE_FILTER* filter)
{
return info_queue->lpVtbl->PushRetrievalFilter(info_queue, filter);
}
static INLINE void D3D11PopRetrievalFilter(D3D11InfoQueue info_queue)
{
info_queue->lpVtbl->PopRetrievalFilter(info_queue);
}
static INLINE UINT D3D11GetRetrievalFilterStackSize(D3D11InfoQueue info_queue)
{
return info_queue->lpVtbl->GetRetrievalFilterStackSize(info_queue);
}
/* end of auto-generated */

View File

@ -340,7 +340,7 @@ void d3d9_vertex_buffer_free(void *vertex_data, void *vertex_declaration)
{
LPDIRECT3DVERTEXDECLARATION9 vertex_decl =
(LPDIRECT3DVERTEXDECLARATION9)vertex_declaration;
d3d9_vertex_declaration_free(vertex_decl);
IDirect3DVertexDeclaration9_Release(vertex_decl);
vertex_decl = NULL;
}
}
@ -1073,8 +1073,8 @@ void d3d9_overlay_render(d3d9_video_t *d3d,
/* set vertex declaration for overlay. */
d3d9_vertex_declaration_new(dev, &vElems, (void**)&vertex_decl);
d3d9_set_vertex_declaration(dev, vertex_decl);
d3d9_vertex_declaration_free(vertex_decl);
IDirect3DDevice9_SetVertexDeclaration(dev, vertex_decl);
IDirect3DVertexDeclaration9_Release(vertex_decl);
d3d9_set_stream_source(dev, 0, (LPDIRECT3DVERTEXBUFFER9)overlay->vert_buf,
0, sizeof(*vert));
@ -1388,7 +1388,8 @@ bool d3d9_read_viewport(void *data, uint8_t *buffer, bool is_idle)
goto end;
}
if (d3d9_surface_lock_rect(dest, &rect))
IDirect3DSurface9_LockRect(dest, &rect, NULL, D3DLOCK_READONLY);
{
unsigned x, y;
unsigned pitchpix = rect.Pitch / 4;
@ -1410,14 +1411,12 @@ bool d3d9_read_viewport(void *data, uint8_t *buffer, bool is_idle)
IDirect3DSurface9_UnlockRect(dest);
}
else
ret = false;
end:
if (target)
d3d9_surface_free(target);
IDirect3DSurface9_Release(target);
if (dest)
d3d9_surface_free(dest);
IDirect3DSurface9_Release(dest);
return ret;
}

View File

@ -104,20 +104,6 @@ static INLINE void d3d9_vertex_buffer_unlock(LPDIRECT3DVERTEXBUFFER9 vertbuf)
void d3d9_vertex_buffer_free(void *vertex_data, void *vertex_declaration);
static INLINE bool d3d9_texture_get_level_desc(
LPDIRECT3DTEXTURE9 tex,
unsigned idx,
D3DSURFACE_DESC *_ppsurface_level)
{
#if defined(_XBOX)
D3DTexture_GetLevelDesc(tex, idx, _ppsurface_level);
#else
if (FAILED(IDirect3DTexture9_GetLevelDesc(tex, idx, _ppsurface_level)))
return false;
#endif
return true;
}
static INLINE bool d3d9_texture_get_surface_level(
LPDIRECT3DTEXTURE9 tex,
unsigned idx, void **_ppsurface_level)
@ -179,16 +165,6 @@ static INLINE void d3d9_lock_rectangle_clear(void *tex,
IDirect3DTexture9_UnlockRect((LPDIRECT3DTEXTURE9)tex, 0);
}
static INLINE void d3d9_set_texture(
LPDIRECT3DDEVICE9 dev,
unsigned sampler,
LPDIRECT3DTEXTURE9 tex)
{
if (dev && tex)
IDirect3DDevice9_SetTexture(dev, sampler,
(IDirect3DBaseTexture9*)tex);
}
static INLINE bool d3d9_create_vertex_shader(
LPDIRECT3DDEVICE9 dev, const DWORD *a, void **b)
{
@ -208,20 +184,6 @@ static INLINE bool d3d9_create_pixel_shader(
return false;
}
static INLINE void d3d9_free_vertex_shader(
LPDIRECT3DDEVICE9 dev, IDirect3DVertexShader9 *vs)
{
if (dev && vs)
IDirect3DVertexShader9_Release(vs);
}
static INLINE void d3d9_free_pixel_shader(LPDIRECT3DDEVICE9 dev,
IDirect3DPixelShader9 *ps)
{
if (dev && ps)
IDirect3DPixelShader9_Release(ps);
}
static INLINE void d3d9_texture_blit(
unsigned pixel_size,
void *tex,
@ -233,7 +195,7 @@ static INLINE void d3d9_texture_blit(
for (y = 0; y < height; y++)
{
const uint8_t *in = (const uint8_t*)frame + y * pitch;
uint8_t *out = (uint8_t*)lr->pBits + y * lr->Pitch;
uint8_t *out = (uint8_t*)lr->pBits + y * lr->Pitch;
memcpy(out, in, width * pixel_size);
}
}
@ -252,29 +214,8 @@ static INLINE bool d3d9_vertex_declaration_new(
return false;
}
static INLINE void d3d9_vertex_declaration_free(
LPDIRECT3DVERTEXDECLARATION9 decl)
{
if (decl)
IDirect3DVertexDeclaration9_Release(decl);
}
static INLINE void
d3d9_set_vertex_declaration(LPDIRECT3DDEVICE9 dev,
LPDIRECT3DVERTEXDECLARATION9 vertex_data)
{
if (dev)
IDirect3DDevice9_SetVertexDeclaration(dev, vertex_data);
}
void d3d9_frame_postprocess(void *data);
static INLINE void d3d9_surface_free(LPDIRECT3DSURFACE9 surf)
{
if (surf)
IDirect3DSurface9_Release(surf);
}
static INLINE bool d3d9_device_get_render_target_data(
LPDIRECT3DDEVICE9 dev,
LPDIRECT3DSURFACE9 src, LPDIRECT3DSURFACE9 dst)
@ -300,31 +241,6 @@ static INLINE bool d3d9_device_get_render_target(
return false;
}
static INLINE void d3d9_device_set_render_target(
LPDIRECT3DDEVICE9 dev, unsigned idx,
LPDIRECT3DSURFACE9 surf)
{
if (dev)
IDirect3DDevice9_SetRenderTarget(dev, idx, surf);
}
static INLINE bool d3d9_get_render_state(
LPDIRECT3DDEVICE9 dev, INT32 state, DWORD *value)
{
if (!dev)
return false;
#ifdef _XBOX
IDirect3DDevice9_GetRenderState(dev,
(D3DRENDERSTATETYPE)state, value);
#else
if (IDirect3DDevice9_GetRenderState(dev,
(D3DRENDERSTATETYPE)state, value) != D3D_OK)
return false;
#endif
return true;
}
static INLINE bool d3d9_device_create_offscreen_plain_surface(
LPDIRECT3DDEVICE9 dev,
unsigned width,
@ -345,23 +261,6 @@ static INLINE bool d3d9_device_create_offscreen_plain_surface(
return false;
}
static INLINE bool d3d9_surface_lock_rect(LPDIRECT3DSURFACE9 surf,
D3DLOCKED_RECT *data2)
{
if (!surf)
return false;
#if defined(_XBOX)
IDirect3DSurface9_LockRect(surf,
data2, NULL, D3DLOCK_READONLY);
#else
if (FAILED(IDirect3DSurface9_LockRect(surf,
data2, NULL, D3DLOCK_READONLY)))
return false;
#endif
return true;
}
static INLINE bool d3d9_get_adapter_display_mode(
LPDIRECT3D9 d3d,
unsigned idx,
@ -387,20 +286,6 @@ bool d3d9_create_device(void *dev,
bool d3d9_reset(void *dev, void *d3dpp);
static INLINE bool d3d9_device_get_backbuffer(
LPDIRECT3DDEVICE9 dev,
unsigned idx, unsigned swapchain_idx,
unsigned backbuffer_type, void **data)
{
if (dev &&
SUCCEEDED(IDirect3DDevice9_GetBackBuffer(dev,
swapchain_idx, idx,
(D3DBACKBUFFER_TYPE)backbuffer_type,
(LPDIRECT3DSURFACE9*)data)))
return true;
return false;
}
static INLINE void d3d9_device_free(LPDIRECT3DDEVICE9 dev, LPDIRECT3D9 pd3d)
{
if (dev)

View File

@ -1908,7 +1908,7 @@ uuidof(ID3D11Texture2D), (void**)&back_buffer);
{
D3D11_SHADER_RESOURCE_VIEW_DESC hw_desc;
D3D11ShaderResourceView hw_view = NULL;
D3D11GetPShaderResources(context, 0, 1, &hw_view);
context->lpVtbl->PSGetShaderResources(context, 0, 1, &hw_view);
D3D11GetShaderResourceViewDesc(hw_view, &hw_desc);
D3D11GetShaderResourceViewTexture2D(hw_view, &hw_texture);

View File

@ -126,10 +126,10 @@ static INLINE bool d3d9_renderchain_add_pass(d3d9_renderchain_t *chain,
pass->tex = tex;
d3d9_set_texture(chain->dev, 0, pass->tex);
IDirect3DDevice9_SetTexture(chain->dev, 0, (IDirect3DBaseTexture9*)pass->tex);
IDirect3DDevice9_SetSamplerState(chain->dev, 0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
IDirect3DDevice9_SetSamplerState(chain->dev, 0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
d3d9_set_texture(chain->dev, 0, NULL);
IDirect3DDevice9_SetTexture(chain->dev, 0, (IDirect3DBaseTexture9*)NULL);
shader_pass_vector_list_append(chain->passes, *pass);
@ -166,10 +166,10 @@ static INLINE bool d3d9_renderchain_add_lut(d3d9_renderchain_t *chain,
if (!lut)
return false;
d3d9_set_texture(chain->dev, 0, lut);
IDirect3DDevice9_SetTexture(chain->dev, 0, (IDirect3DBaseTexture9*)lut);
IDirect3DDevice9_SetSamplerState(chain->dev, 0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
IDirect3DDevice9_SetSamplerState(chain->dev, 0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
d3d9_set_texture(chain->dev, 0, NULL);
IDirect3DDevice9_SetTexture(chain->dev, 0, (IDirect3DBaseTexture9*)NULL);
lut_info_vector_list_append(chain->luts, info);
@ -207,7 +207,7 @@ static INLINE void d3d9_renderchain_add_lut_internal(
d3d9_renderchain_t *chain,
unsigned index, unsigned i)
{
d3d9_set_texture(chain->dev, index, chain->luts->data[i].tex);
IDirect3DDevice9_SetTexture(chain->dev, index, (IDirect3DBaseTexture9*)chain->luts->data[i].tex);
IDirect3DDevice9_SetSamplerState(chain->dev, index, D3DSAMP_MAGFILTER,
d3d_translate_filter(chain->luts->data[i].smooth ? RARCH_FILTER_LINEAR : RARCH_FILTER_NEAREST));
IDirect3DDevice9_SetSamplerState(chain->dev, index, D3DSAMP_MINFILTER,
@ -249,8 +249,8 @@ static INLINE void d3d9_renderchain_unbind_all(d3d9_renderchain_t *chain)
chain->bound_tex->data[i], D3DSAMP_MINFILTER, D3DTEXF_POINT);
IDirect3DDevice9_SetSamplerState(chain->dev,
chain->bound_tex->data[i], D3DSAMP_MAGFILTER, D3DTEXF_POINT);
d3d9_set_texture(chain->dev,
chain->bound_tex->data[i], NULL);
IDirect3DDevice9_SetTexture(chain->dev,
chain->bound_tex->data[i], (IDirect3DBaseTexture9*)NULL);
}
for (i = 0; i < chain->bound_vert->count; i++)
@ -295,10 +295,10 @@ static INLINE bool d3d9_renderchain_set_pass_size(
if (!pass->tex)
return false;
d3d9_set_texture(dev, 0, pass->tex);
IDirect3DDevice9_SetTexture(dev, 0, (IDirect3DBaseTexture9*)pass->tex);
IDirect3DDevice9_SetSamplerState(dev, 0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
IDirect3DDevice9_SetSamplerState(dev, 0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
d3d9_set_texture(dev, 0, NULL);
IDirect3DDevice9_SetTexture(dev, 0, (IDirect3DBaseTexture9*)NULL);
}
return true;

View File

@ -477,7 +477,7 @@ static void d3d9_cg_renderchain_bind_orig(
if (param)
{
unsigned index = cgGetParameterResourceIndex(param);
d3d9_set_texture(chain->dev, index, first_pass->tex);
IDirect3DDevice9_SetTexture(chain->dev, index, (IDirect3DBaseTexture9*)first_pass->tex);
IDirect3DDevice9_SetSamplerState(chain->dev,
index, D3DSAMP_MINFILTER, d3d_translate_filter(first_pass->info.pass->filter));
IDirect3DDevice9_SetSamplerState(chain->dev,
@ -565,7 +565,7 @@ static void d3d9_cg_renderchain_bind_prev(d3d9_renderchain_t *chain,
chain->prev.tex[
(chain->prev.ptr - (i + 1)) & TEXTURESMASK];
d3d9_set_texture(chain->dev, index, tex);
IDirect3DDevice9_SetTexture(chain->dev, index, (IDirect3DBaseTexture9*)tex);
unsigned_vector_list_append(chain->bound_tex, index);
IDirect3DDevice9_SetSamplerState(chain->dev, index, D3DSAMP_MINFILTER,
@ -646,7 +646,7 @@ static void d3d9_cg_renderchain_bind_pass(
unsigned index = cgGetParameterResourceIndex(param);
unsigned_vector_list_append(chain->bound_tex, index);
d3d9_set_texture(chain->dev, index, curr_pass->tex);
IDirect3DDevice9_SetTexture(chain->dev, index, (IDirect3DBaseTexture9*)curr_pass->tex);
IDirect3DDevice9_SetSamplerState(chain->dev, index, D3DSAMP_MINFILTER,
d3d_translate_filter(curr_pass->info.pass->filter));
IDirect3DDevice9_SetSamplerState(chain->dev, index, D3DSAMP_MAGFILTER,
@ -819,14 +819,14 @@ static bool d3d9_cg_renderchain_create_first_pass(
if (!chain->prev.tex[i])
return false;
d3d9_set_texture(chain->dev, 0, chain->prev.tex[i]);
IDirect3DDevice9_SetTexture(chain->dev, 0, (IDirect3DBaseTexture9*)chain->prev.tex[i]);
IDirect3DDevice9_SetSamplerState(dev,
0, D3DSAMP_MINFILTER, d3d_translate_filter(info->pass->filter));
IDirect3DDevice9_SetSamplerState(dev,
0, D3DSAMP_MAGFILTER, d3d_translate_filter(info->pass->filter));
IDirect3DDevice9_SetSamplerState(dev, 0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
IDirect3DDevice9_SetSamplerState(dev, 0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
d3d9_set_texture(chain->dev, 0, NULL);
IDirect3DDevice9_SetTexture(chain->dev, 0, NULL);
}
d3d9_cg_load_program((cg_renderchain_t*)cg_chain, &pass, info->pass->source.path, true);
@ -1049,13 +1049,13 @@ static void d3d9_cg_renderchain_render_pass(
cgD3D9BindProgram((CGprogram)pass->fprg);
cgD3D9BindProgram((CGprogram)pass->vprg);
d3d9_set_texture(chain->dev, 0, pass->tex);
IDirect3DDevice9_SetTexture(chain->dev, 0, (IDirect3DBaseTexture9*)pass->tex);
IDirect3DDevice9_SetSamplerState(chain->dev,
0, D3DSAMP_MINFILTER, d3d_translate_filter(pass->info.pass->filter));
IDirect3DDevice9_SetSamplerState(chain->dev,
0, D3DSAMP_MAGFILTER, d3d_translate_filter(pass->info.pass->filter));
d3d9_set_vertex_declaration(chain->dev, pass->vertex_decl);
IDirect3DDevice9_SetVertexDeclaration(chain->dev, pass->vertex_decl);
for (i = 0; i < 4; i++)
d3d9_set_stream_source(chain->dev, i,
pass->vertex_buf, 0,
@ -1159,7 +1159,7 @@ static bool d3d9_cg_renderchain_render(
d3d9_texture_get_surface_level(to_pass->tex, 0, (void**)&target);
d3d9_device_set_render_target(chain->dev, 0, target);
IDirect3DDevice9_SetRenderTarget(chain->dev, 0, target);
d3d9_convert_geometry(&from_pass->info,
&out_width, &out_height,
@ -1190,13 +1190,13 @@ static bool d3d9_cg_renderchain_render(
from_pass,
i + 1);
current_width = out_width;
current_width = out_width;
current_height = out_height;
d3d9_surface_free(target);
IDirect3DSurface9_Release(target);
}
/* Final pass */
d3d9_device_set_render_target(chain->dev, 0, back_buffer);
IDirect3DDevice9_SetRenderTarget(chain->dev, 0, back_buffer);
last_pass = (struct shader_pass*)&chain->passes->
data[chain->passes->count - 1];
@ -1221,7 +1221,8 @@ static bool d3d9_cg_renderchain_render(
chain->frame_count++;
d3d9_surface_free(back_buffer);
if (back_buffer)
IDirect3DSurface9_Release(back_buffer);
d3d9_renderchain_end_render(chain);
cgD3D9BindProgram((CGprogram)&_chain->stock_shader.fprg);
@ -1853,7 +1854,7 @@ static bool d3d9_cg_frame(void *data, const void *frame,
d3d9_overlay_render(d3d, width, height, d3d->menu, false);
d3d->menu_display.offset = 0;
d3d9_set_vertex_declaration(d3d->dev, (LPDIRECT3DVERTEXDECLARATION9)d3d->menu_display.decl);
IDirect3DDevice9_SetVertexDeclaration(d3d->dev, (LPDIRECT3DVERTEXDECLARATION9)d3d->menu_display.decl);
d3d9_set_stream_source(d3d->dev, 0, (LPDIRECT3DVERTEXBUFFER9)d3d->menu_display.buffer, 0, sizeof(Vertex));
IDirect3DDevice9_SetViewport(d3d->dev, (D3DVIEWPORT9*)&screen_vp);

View File

@ -713,7 +713,7 @@ static bool hlsl_d3d9_renderchain_render(
d3d9_texture_get_surface_level(to_pass->tex, 0, (void**)&target);
d3d9_device_set_render_target(chain->chain.dev, 0, target);
IDirect3DDevice9_SetRenderTarget(chain->chain.dev, 0, target);
d3d9_convert_geometry(&from_pass->info,
&out_width, &out_height,
@ -749,13 +749,13 @@ static bool hlsl_d3d9_renderchain_render(
from_pass,
i + 1);
current_width = out_width;
current_width = out_width;
current_height = out_height;
d3d9_surface_free(target);
IDirect3DSurface9_Release(target);
}
/* Final pass */
d3d9_device_set_render_target(chain->chain.dev, 0, back_buffer);
IDirect3DDevice9_SetRenderTarget(chain->chain.dev, 0, back_buffer);
last_pass = (struct shader_pass*)&chain->chain.passes->
data[chain->chain.passes->count - 1];
@ -781,7 +781,8 @@ static bool hlsl_d3d9_renderchain_render(
chain->chain.frame_count++;
d3d9_surface_free(back_buffer);
if (back_buffer)
IDirect3DSurface9_Release(back_buffer);
d3d9_renderchain_end_render(&chain->chain);
d3d9_hlsl_bind_program(chain->chain.dev, &chain->stock_shader);