mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-11 15:33:34 +00:00
working on d3d11 backend
This commit is contained in:
@@ -8,11 +8,14 @@
|
||||
#include "D3D11.h"
|
||||
#include "D3D11Device.h"
|
||||
|
||||
#pragma comment(lib,"d3d11.lib")
|
||||
#pragma comment(lib,"d3dcompiler.lib")
|
||||
|
||||
PulseBackendFlags Direct3D11CheckSupport(PulseBackendFlags candidates, PulseShaderFormatsFlags shader_formats_used)
|
||||
{
|
||||
if(candidates != PULSE_BACKEND_ANY && (candidates & PULSE_BACKEND_D3D11) == 0)
|
||||
return PULSE_BACKEND_INVALID;
|
||||
if((shader_formats_used & PULSE_SHADER_FORMAT_DXBC_BIT) == 0)
|
||||
if((shader_formats_used & PULSE_SHADER_FORMAT_DXBC_BIT) == 0 && (shader_formats_used & PULSE_SHADER_FORMAT_HLSL_BIT) == 0)
|
||||
return PULSE_BACKEND_INVALID;
|
||||
return PULSE_BACKEND_D3D11;
|
||||
}
|
||||
@@ -28,11 +31,58 @@ void Direct3D11UnloadBackend(PulseBackend backend)
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef D3D11_ERROR_FILE_NOT_FOUND
|
||||
#define D3D11_ERROR_FILE_NOT_FOUND 0x887C0002
|
||||
#endif
|
||||
|
||||
#ifndef D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS
|
||||
#define D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS 0x887C0001
|
||||
#endif
|
||||
|
||||
#ifndef D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS
|
||||
#define D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS 0x887C0003
|
||||
#endif
|
||||
|
||||
#ifndef D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD
|
||||
#define D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD 0x887C0004
|
||||
#endif
|
||||
|
||||
#ifndef D3DERR_INVALIDCALL
|
||||
#define D3DERR_INVALIDCALL 0x887A0001
|
||||
#endif
|
||||
|
||||
#ifndef D3DERR_WASSTILLDRAWING
|
||||
#define D3DERR_WASSTILLDRAWING 0x887A000A
|
||||
#endif
|
||||
|
||||
const char* D3D11VerbaliseResult(HRESULT res)
|
||||
{
|
||||
switch(res)
|
||||
{
|
||||
case S_OK:
|
||||
case S_FALSE: return "success";
|
||||
|
||||
case D3D11_ERROR_FILE_NOT_FOUND: return "a file was not found";
|
||||
case D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS: return "too many instances of a particular state objects";
|
||||
case D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS: return "too many instances of a particular view objects";
|
||||
case D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD: return "deffered context mapped without initial discard";
|
||||
case D3DERR_INVALIDCALL: return "invalid call";
|
||||
case D3DERR_WASSTILLDRAWING: return "was still drawing";
|
||||
case E_FAIL: return "attempted to create a device with the debug layer enabled and the layer is not installed";
|
||||
case E_INVALIDARG: return "an invalid parameter was passed to the returning function";
|
||||
case E_OUTOFMEMORY: return "could not allocate sufficient memory to complete the call";
|
||||
case E_NOTIMPL: return "method call isn't implemented with the passed parameter combination";
|
||||
|
||||
default: return "Unknown D3D11 error";
|
||||
}
|
||||
return "Unknown D3D11 error"; // Just to avoid warnings
|
||||
}
|
||||
|
||||
PulseBackendHandler D3D11Driver = {
|
||||
.PFN_LoadBackend = Direct3D11LoadBackend,
|
||||
.PFN_UnloadBackend = Direct3D11UnloadBackend,
|
||||
.PFN_CreateDevice = Direct3D11CreateDevice,
|
||||
.backend = PULSE_BACKEND_D3D11,
|
||||
.supported_shader_formats = PULSE_SHADER_FORMAT_DXBC_BIT,
|
||||
.supported_shader_formats = PULSE_SHADER_FORMAT_DXBC_BIT | PULSE_SHADER_FORMAT_HLSL_BIT,
|
||||
.driver_data = PULSE_NULLPTR
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user