(D3D10/D3D11/D3D12) Don't load menu pipeline shaders unless XMB

is selected
This commit is contained in:
twinaphex 2018-04-23 12:59:28 +02:00
parent 5370c59201
commit 6f3003554e
3 changed files with 207 additions and 197 deletions

View File

@ -801,6 +801,8 @@ d3d10_gfx_init(const video_info_t* video, const input_driver_t** input, void** i
goto error; goto error;
} }
if (string_is_equal(settings->arrays.menu_driver, "xmb"))
{
{ {
D3D10_INPUT_ELEMENT_DESC desc[] = { D3D10_INPUT_ELEMENT_DESC desc[] = {
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
@ -864,6 +866,7 @@ d3d10_gfx_init(const video_info_t* video, const input_driver_t** input, void** i
countof(desc), &d3d10->shaders[VIDEO_SHADER_MENU_6])) countof(desc), &d3d10->shaders[VIDEO_SHADER_MENU_6]))
goto error; goto error;
} }
}
{ {
D3D10_BLEND_DESC blend_desc = { 0 }; D3D10_BLEND_DESC blend_desc = { 0 };

View File

@ -850,6 +850,8 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i
goto error; goto error;
} }
if (string_is_equal(settings->arrays.menu_driver, "xmb"))
{
{ {
D3D11_INPUT_ELEMENT_DESC desc[] = { D3D11_INPUT_ELEMENT_DESC desc[] = {
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
@ -913,6 +915,7 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i
countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_6])) countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_6]))
goto error; goto error;
} }
}
{ {
D3D11_BLEND_DESC blend_desc = { 0 }; D3D11_BLEND_DESC blend_desc = { 0 };

View File

@ -544,6 +544,7 @@ static bool d3d12_gfx_init_pipelines(d3d12_video_t* d3d12)
D3DBlob ps_code = NULL; D3DBlob ps_code = NULL;
D3DBlob gs_code = NULL; D3DBlob gs_code = NULL;
D3DBlob cs_code = NULL; D3DBlob cs_code = NULL;
settings_t * settings = config_get_ptr();
D3D12_GRAPHICS_PIPELINE_STATE_DESC desc = { d3d12->desc.rootSignature }; D3D12_GRAPHICS_PIPELINE_STATE_DESC desc = { d3d12->desc.rootSignature };
desc.BlendState.RenderTarget[0] = d3d12_blend_enable_desc; desc.BlendState.RenderTarget[0] = d3d12_blend_enable_desc;
@ -643,6 +644,56 @@ static bool d3d12_gfx_init_pipelines(d3d12_video_t* d3d12)
gs_code = NULL; gs_code = NULL;
} }
if (string_is_equal(settings->arrays.menu_driver, "xmb"))
{
{
static const char ribbon[] =
#include "d3d_shaders/ribbon_sm4.hlsl.h"
;
static const char ribbon_simple[] =
#include "d3d_shaders/ribbon_simple_sm4.hlsl.h"
;
D3D12_INPUT_ELEMENT_DESC inputElementDesc[] = {
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0,
D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
};
desc.BlendState.RenderTarget[0].SrcBlend = D3D12_BLEND_ONE;
desc.BlendState.RenderTarget[0].DestBlend = D3D12_BLEND_ONE;
desc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
desc.InputLayout.pInputElementDescs = inputElementDesc;
desc.InputLayout.NumElements = countof(inputElementDesc);
if (!d3d_compile(ribbon, sizeof(ribbon), NULL, "VSMain", "vs_5_0", &vs_code))
goto error;
if (!d3d_compile(ribbon, sizeof(ribbon), NULL, "PSMain", "ps_5_0", &ps_code))
goto error;
if (!d3d12_init_pipeline(
d3d12->device, vs_code, ps_code, NULL, &desc, &d3d12->pipes[VIDEO_SHADER_MENU]))
goto error;
Release(vs_code);
Release(ps_code);
vs_code = NULL;
ps_code = NULL;
if (!d3d_compile(ribbon_simple, sizeof(ribbon_simple), NULL, "VSMain", "vs_5_0", &vs_code))
goto error;
if (!d3d_compile(ribbon_simple, sizeof(ribbon_simple), NULL, "PSMain", "ps_5_0", &ps_code))
goto error;
if (!d3d12_init_pipeline(
d3d12->device, vs_code, ps_code, NULL, &desc, &d3d12->pipes[VIDEO_SHADER_MENU_2]))
goto error;
Release(vs_code);
Release(ps_code);
vs_code = NULL;
ps_code = NULL;
}
{ {
static const char simple_snow[] = static const char simple_snow[] =
#include "d3d_shaders/simple_snow_sm4.hlsl.h" #include "d3d_shaders/simple_snow_sm4.hlsl.h"
@ -724,53 +775,6 @@ static bool d3d12_gfx_init_pipelines(d3d12_video_t* d3d12)
vs_code = NULL; vs_code = NULL;
ps_code = NULL; ps_code = NULL;
} }
{
static const char ribbon[] =
#include "d3d_shaders/ribbon_sm4.hlsl.h"
;
static const char ribbon_simple[] =
#include "d3d_shaders/ribbon_simple_sm4.hlsl.h"
;
D3D12_INPUT_ELEMENT_DESC inputElementDesc[] = {
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0,
D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
};
desc.BlendState.RenderTarget[0].SrcBlend = D3D12_BLEND_ONE;
desc.BlendState.RenderTarget[0].DestBlend = D3D12_BLEND_ONE;
desc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
desc.InputLayout.pInputElementDescs = inputElementDesc;
desc.InputLayout.NumElements = countof(inputElementDesc);
if (!d3d_compile(ribbon, sizeof(ribbon), NULL, "VSMain", "vs_5_0", &vs_code))
goto error;
if (!d3d_compile(ribbon, sizeof(ribbon), NULL, "PSMain", "ps_5_0", &ps_code))
goto error;
if (!d3d12_init_pipeline(
d3d12->device, vs_code, ps_code, NULL, &desc, &d3d12->pipes[VIDEO_SHADER_MENU]))
goto error;
Release(vs_code);
Release(ps_code);
vs_code = NULL;
ps_code = NULL;
if (!d3d_compile(ribbon_simple, sizeof(ribbon_simple), NULL, "VSMain", "vs_5_0", &vs_code))
goto error;
if (!d3d_compile(ribbon_simple, sizeof(ribbon_simple), NULL, "PSMain", "ps_5_0", &ps_code))
goto error;
if (!d3d12_init_pipeline(
d3d12->device, vs_code, ps_code, NULL, &desc, &d3d12->pipes[VIDEO_SHADER_MENU_2]))
goto error;
Release(vs_code);
Release(ps_code);
vs_code = NULL;
ps_code = NULL;
} }
{ {