Merge pull request #6179 from aliaspider/master

(D3D11) add the remaining menu shaders.
This commit is contained in:
Twinaphex 2018-01-25 17:18:59 +01:00 committed by GitHub
commit f97ebfbf1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 681 additions and 311 deletions

View File

@ -14,7 +14,7 @@
*/
#include "d3d11_common.h"
#include "d3dcompiler_common.h"
#include <dynamic/dylib.h>
static dylib_t d3d11_dll;
@ -70,7 +70,7 @@ void d3d11_init_texture(D3D11Device device, d3d11_texture_t* texture)
if (texture->desc.MiscFlags & D3D11_RESOURCE_MISC_GENERATE_MIPS)
{
texture->desc.BindFlags |= D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
unsigned width = texture->desc.Width >> 5;
unsigned width = texture->desc.Width >> 5;
unsigned height = texture->desc.Height >> 5;
while (width && height)
{
@ -145,3 +145,58 @@ d3d11_get_closest_match(D3D11Device device, DXGI_FORMAT desired_format, UINT des
assert(*format);
return *format;
}
bool d3d11_init_shader(
D3D11Device device,
void* src,
size_t size,
LPCSTR vs_entry,
LPCSTR ps_entry,
LPCSTR gs_entry,
D3D11_INPUT_ELEMENT_DESC* input_element_descs,
UINT num_elements,
d3d11_shader_t* out)
{
D3DBlob vs_code;
D3DBlob ps_code;
D3DBlob gs_code;
if (size) /* char array */
{
if (!d3d_compile(src, size, vs_entry, "vs_5_0", &vs_code))
return false;
if (!d3d_compile(src, size, ps_entry, "ps_5_0", &ps_code))
return false;
if (gs_entry && !d3d_compile(src, size, gs_entry, "gs_5_0", &gs_code))
return false;
}
else /* LPCWSTR filename */
{
if (!d3d_compile_from_file(src, vs_entry, "vs_5_0", &vs_code))
return false;
if (!d3d_compile_from_file(src, ps_entry, "ps_5_0", &ps_code))
return false;
if (gs_entry && !d3d_compile_from_file(src, gs_entry, "gs_5_0", &gs_code))
return false;
}
D3D11CreateVertexShader(
device, D3DGetBufferPointer(vs_code), D3DGetBufferSize(vs_code), NULL, &out->vs);
D3D11CreateInputLayout(
device, input_element_descs, num_elements, D3DGetBufferPointer(vs_code),
D3DGetBufferSize(vs_code), &out->layout);
Release(vs_code);
D3D11CreatePixelShader(
device, D3DGetBufferPointer(ps_code), D3DGetBufferSize(ps_code), NULL, &out->ps);
Release(ps_code);
if (gs_entry)
{
D3D11CreateGeometryShader(
device, D3DGetBufferPointer(gs_code), D3DGetBufferSize(gs_code), NULL, &out->gs);
Release(gs_code);
}
return true;
}

View File

@ -2500,7 +2500,6 @@ typedef struct
#endif
#endif
typedef struct ALIGN(16)
{
math_matrix_4x4 mvp;
@ -2512,7 +2511,15 @@ typedef struct ALIGN(16)
float time;
} d3d11_uniform_t;
static_assert(!(sizeof(d3d11_uniform_t)&0xF), "sizeof(d3d11_uniform_t) must be a multiple of 16");
static_assert(!(sizeof(d3d11_uniform_t) & 0xF), "sizeof(d3d11_uniform_t) must be a multiple of 16");
typedef struct
{
D3D11VertexShader vs;
D3D11PixelShader ps;
D3D11GeometryShader gs;
D3D11InputLayout layout;
} d3d11_shader_t;
typedef struct
{
@ -2523,20 +2530,14 @@ typedef struct
D3D11DeviceContext ctx;
D3D11RasterizerState state;
D3D11RenderTargetView renderTargetView;
D3D11InputLayout layout;
D3D11Buffer ubo;
d3d11_uniform_t ubo_values;
D3D11VertexShader vs;
D3D11PixelShader ps;
D3D11SamplerState sampler_nearest;
D3D11SamplerState sampler_linear;
D3D11BlendState blend_enable;
D3D11BlendState blend_disable;
D3D11BlendState blend_pipeline;
D3D11Buffer menu_pipeline_vbo;
D3D11VertexShader ribbon_vs;
D3D11PixelShader ribbon_ps;
D3D11InputLayout ribbon_layout;
math_matrix_4x4 mvp, mvp_no_rot;
struct video_viewport vp;
D3D11_VIEWPORT viewport;
@ -2563,17 +2564,14 @@ typedef struct
} frame;
struct
{
D3D11VertexShader vs;
D3D11PixelShader ps;
D3D11PixelShader ps_8bit;
D3D11GeometryShader gs;
D3D11Buffer vbo;
D3D11InputLayout layout;
int offset;
int capacity;
bool enabled;
d3d11_shader_t shader;
d3d11_shader_t shader_font;
D3D11Buffer vbo;
int offset;
int capacity;
bool enabled;
} sprites;
d3d11_shader_t shaders[GFX_MAX_SHADERS];
} d3d11_video_t;
void d3d11_init_texture(D3D11Device device, d3d11_texture_t* texture);
@ -2596,9 +2594,55 @@ d3d11_get_closest_match_texture2D(D3D11Device device, DXGI_FORMAT desired_format
D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_SHADER_SAMPLE);
}
static inline void d3d11_set_texture_and_sampler(
D3D11DeviceContext ctx, UINT slot, d3d11_texture_t* texture)
static inline void
d3d11_set_texture_and_sampler(D3D11DeviceContext ctx, UINT slot, d3d11_texture_t* texture)
{
D3D11SetPShaderResources(ctx, slot, 1, &texture->view);
D3D11SetPShaderSamplers(ctx, slot, 1, &texture->sampler);
}
bool d3d11_init_shader(
D3D11Device device,
void* src,
size_t size,
LPCSTR vs_entry,
LPCSTR ps_entry,
LPCSTR gs_entry,
D3D11_INPUT_ELEMENT_DESC* input_element_descs,
UINT num_elements,
d3d11_shader_t* out);
static inline void d3d11_release_shader(d3d11_shader_t* shader)
{
Release(shader->layout);
Release(shader->vs);
Release(shader->ps);
Release(shader->gs);
}
static inline void d3d11_set_shader(D3D11DeviceContext ctx, d3d11_shader_t* shader)
{
D3D11SetInputLayout(ctx, shader->layout);
D3D11SetVShader(ctx, shader->vs, NULL, 0);
D3D11SetPShader(ctx, shader->ps, NULL, 0);
D3D11SetGShader(ctx, shader->gs, NULL, 0);
}
static inline void D3D11SetVertexBuffer(
D3D11DeviceContext device_context,
UINT slot,
D3D11Buffer const vertex_buffer,
UINT stride,
UINT offset)
{
D3D11SetVertexBuffers(device_context, slot, 1, &vertex_buffer, &stride, &offset);
}
static inline void D3D11SetVShaderConstantBuffer(
D3D11DeviceContext device_context, UINT slot, D3D11Buffer const constant_buffer)
{
D3D11SetVShaderConstantBuffers(device_context, slot, 1, &constant_buffer);
}
static inline void D3D11SetPShaderConstantBuffer(
D3D11DeviceContext device_context, UINT slot, D3D11Buffer const constant_buffer)
{
D3D11SetPShaderConstantBuffers(device_context, slot, 1, &constant_buffer);
}

View File

@ -93,27 +93,35 @@ static void d3d11_gfx_free(void* data)
Release(d3d11->menu.texture.view);
Release(d3d11->menu.vbo);
Release(d3d11->sprites.vs);
Release(d3d11->sprites.ps);
Release(d3d11->sprites.ps_8bit);
Release(d3d11->sprites.gs);
Release(d3d11->sprites.shader.vs);
Release(d3d11->sprites.shader.ps);
Release(d3d11->sprites.shader.gs);
Release(d3d11->sprites.shader.layout);
Release(d3d11->sprites.shader_font.vs);
Release(d3d11->sprites.shader_font.ps);
Release(d3d11->sprites.shader_font.gs);
Release(d3d11->sprites.shader_font.layout);
Release(d3d11->sprites.vbo);
Release(d3d11->sprites.layout);
d3d11_release_shader(&d3d11->shaders[VIDEO_SHADER_STOCK_BLEND]);
d3d11_release_shader(&d3d11->shaders[VIDEO_SHADER_MENU]);
d3d11_release_shader(&d3d11->shaders[VIDEO_SHADER_MENU_2]);
d3d11_release_shader(&d3d11->shaders[VIDEO_SHADER_MENU_3]);
d3d11_release_shader(&d3d11->shaders[VIDEO_SHADER_MENU_4]);
d3d11_release_shader(&d3d11->shaders[VIDEO_SHADER_MENU_5]);
d3d11_release_shader(&d3d11->shaders[VIDEO_SHADER_MENU_6]);
Release(d3d11->menu_pipeline_vbo);
Release(d3d11->ribbon_vs);
Release(d3d11->ribbon_ps);
Release(d3d11->ribbon_layout);
Release(d3d11->blend_pipeline);
Release(d3d11->ubo);
Release(d3d11->blend_enable);
Release(d3d11->blend_disable);
Release(d3d11->blend_pipeline);
Release(d3d11->sampler_nearest);
Release(d3d11->sampler_linear);
Release(d3d11->ps);
Release(d3d11->vs);
Release(d3d11->layout);
Release(d3d11->state);
Release(d3d11->renderTargetView);
Release(d3d11->swapChain);
@ -284,13 +292,6 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i
}
{
D3DBlob vs_code;
D3DBlob ps_code;
static const char stock[] =
#include "d3d_shaders/opaque_sm5.hlsl.h"
;
D3D11_INPUT_ELEMENT_DESC desc[] = {
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_vertex_t, position),
D3D11_INPUT_PER_VERTEX_DATA, 0 },
@ -300,33 +301,17 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i
D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
d3d_compile(stock, sizeof(stock), "VSMain", "vs_5_0", &vs_code);
d3d_compile(stock, sizeof(stock), "PSMain", "ps_5_0", &ps_code);
static const char shader[] =
#include "d3d_shaders/opaque_sm5.hlsl.h"
;
D3D11CreateVertexShader(
d3d11->device, D3DGetBufferPointer(vs_code), D3DGetBufferSize(vs_code), NULL,
&d3d11->vs);
D3D11CreatePixelShader(
d3d11->device, D3DGetBufferPointer(ps_code), D3DGetBufferSize(ps_code), NULL,
&d3d11->ps);
D3D11CreateInputLayout(
d3d11->device, desc, countof(desc), D3DGetBufferPointer(vs_code),
D3DGetBufferSize(vs_code), &d3d11->layout);
Release(vs_code);
Release(ps_code);
if (!d3d11_init_shader(
d3d11->device, shader, sizeof(shader), "VSMain", "PSMain", NULL, desc,
countof(desc), &d3d11->shaders[VIDEO_SHADER_STOCK_BLEND]))
goto error;
}
{
D3DBlob vs_code;
D3DBlob ps_code;
D3DBlob ps_A8_code;
D3DBlob gs_code;
static const char sprite[] =
#include "d3d_shaders/sprite_sm4.hlsl.h"
;
D3D11_INPUT_ELEMENT_DESC desc[] = {
{ "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, offsetof(d3d11_sprite_t, pos),
D3D11_INPUT_PER_VERTEX_DATA, 0 },
@ -343,83 +328,83 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i
{ "PARAMS", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_sprite_t, params),
D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
#if 1
d3d_compile(sprite, sizeof(sprite), "VSMain", "vs_5_0", &vs_code);
d3d_compile(sprite, sizeof(sprite), "PSMain", "ps_5_0", &ps_code);
d3d_compile(sprite, sizeof(sprite), "PSMainA8", "ps_5_0", &ps_A8_code);
d3d_compile(sprite, sizeof(sprite), "GSMain", "gs_5_0", &gs_code);
#else
if (!d3d_compile_from_file(
L"gfx/drivers/d3d_shaders/sprite_sm4.hlsl", "VSMain", "vs_5_0", &vs_code))
goto error;
if (!d3d_compile_from_file(
L"gfx/drivers/d3d_shaders/sprite_sm4.hlsl", "PSMain", "ps_5_0", &ps_code))
goto error;
if (!d3d_compile_from_file(
L"gfx/drivers/d3d_shaders/sprite_sm4.hlsl", "PSMainA8", "ps_5_0", &ps_A8_code))
goto error;
if (!d3d_compile_from_file(
L"gfx/drivers/d3d_shaders/sprite_sm4.hlsl", "GSMain", "gs_5_0", &gs_code))
goto error;
#endif
D3D11CreateVertexShader(
d3d11->device, D3DGetBufferPointer(vs_code), D3DGetBufferSize(vs_code), NULL,
&d3d11->sprites.vs);
D3D11CreatePixelShader(
d3d11->device, D3DGetBufferPointer(ps_code), D3DGetBufferSize(ps_code), NULL,
&d3d11->sprites.ps);
D3D11CreatePixelShader(
d3d11->device, D3DGetBufferPointer(ps_A8_code), D3DGetBufferSize(ps_A8_code), NULL,
&d3d11->sprites.ps_8bit);
D3D11CreateGeometryShader(
d3d11->device, D3DGetBufferPointer(gs_code), D3DGetBufferSize(gs_code), NULL,
&d3d11->sprites.gs);
D3D11CreateInputLayout(
d3d11->device, desc, countof(desc), D3DGetBufferPointer(vs_code),
D3DGetBufferSize(vs_code), &d3d11->sprites.layout);
static const char shader[] =
#include "d3d_shaders/sprite_sm4.hlsl.h"
;
Release(vs_code);
Release(ps_code);
Release(ps_A8_code);
Release(gs_code);
if (!d3d11_init_shader(
d3d11->device, shader, sizeof(shader), "VSMain", "PSMain", "GSMain", desc,
countof(desc), &d3d11->sprites.shader))
goto error;
if (!d3d11_init_shader(
d3d11->device, shader, sizeof(shader), "VSMain", "PSMainA8", "GSMain", desc,
countof(desc), &d3d11->sprites.shader_font))
goto error;
}
{
D3DBlob vs_code;
D3DBlob ps_code;
static const char shader[] =
#include "d3d_shaders/ribbon_sm4.hlsl.h"
;
D3D11_INPUT_ELEMENT_DESC desc[] = {
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
#if 1
d3d_compile(shader, sizeof(shader), "VSMain", "vs_5_0", &vs_code);
d3d_compile(shader, sizeof(shader), "PSMain", "ps_5_0", &ps_code);
#else
if (!d3d_compile_from_file(
L"gfx/drivers/d3d_shaders/ribbon_sm4.hlsl", "VSMain", "vs_5_0", &vs_code))
goto error;
if (!d3d_compile_from_file(
L"gfx/drivers/d3d_shaders/ribbon_sm4.hlsl", "PSMain", "ps_5_0", &ps_code))
goto error;
#endif
D3D11CreateVertexShader(
d3d11->device, D3DGetBufferPointer(vs_code), D3DGetBufferSize(vs_code), NULL,
&d3d11->ribbon_vs);
D3D11CreatePixelShader(
d3d11->device, D3DGetBufferPointer(ps_code), D3DGetBufferSize(ps_code), NULL,
&d3d11->ribbon_ps);
D3D11CreateInputLayout(
d3d11->device, desc, countof(desc), D3DGetBufferPointer(vs_code),
D3DGetBufferSize(vs_code), &d3d11->ribbon_layout);
static const char ribbon[] =
#include "d3d_shaders/ribbon_sm4.hlsl.h"
;
static const char ribbon_simple[] =
#include "d3d_shaders/ribbon_simple_sm4.hlsl.h"
;
Release(vs_code);
Release(ps_code);
if (!d3d11_init_shader(
d3d11->device, ribbon, sizeof(ribbon), "VSMain", "PSMain", NULL, desc,
countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU]))
goto error;
if (!d3d11_init_shader(
d3d11->device, ribbon_simple, sizeof(ribbon_simple), "VSMain", "PSMain", NULL, desc,
countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_2]))
goto error;
}
{
D3D11_INPUT_ELEMENT_DESC desc[] = {
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_vertex_t, position),
D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_vertex_t, texcoord),
D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
static const char simple_snow[] =
#include "d3d_shaders/simple_snow_sm4.hlsl.h"
;
static const char snow[] =
#include "d3d_shaders/snow_sm4.hlsl.h"
;
static const char bokeh[] =
#include "d3d_shaders/bokeh_sm4.hlsl.h"
;
static const char snowflake[] =
#include "d3d_shaders/snowflake_sm4.hlsl.h"
;
if (!d3d11_init_shader(
d3d11->device, simple_snow, sizeof(simple_snow), "VSMain", "PSMain", NULL, desc,
countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_3]))
goto error;
if (!d3d11_init_shader(
d3d11->device, snow, sizeof(snow), "VSMain", "PSMain", NULL, desc, countof(desc),
&d3d11->shaders[VIDEO_SHADER_MENU_4]))
goto error;
if (!d3d11_init_shader(
d3d11->device, bokeh, sizeof(bokeh), "VSMain", "PSMain", NULL, desc, countof(desc),
&d3d11->shaders[VIDEO_SHADER_MENU_5]))
goto error;
if (!d3d11_init_shader(
d3d11->device, snowflake, sizeof(snowflake), "VSMain", "PSMain", NULL, desc,
countof(desc), &d3d11->shaders[VIDEO_SHADER_MENU_6]))
goto error;
}
{
@ -440,7 +425,7 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i
};
D3D11CreateBlendState(d3d11->device, &blend_desc, &d3d11->blend_enable);
blend_desc.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE;
blend_desc.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE;
blend_desc.RenderTarget[0].DestBlend = D3D11_BLEND_ONE;
D3D11CreateBlendState(d3d11->device, &blend_desc, &d3d11->blend_pipeline);
@ -449,8 +434,8 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i
}
{
D3D11_RASTERIZER_DESC desc = {
.FillMode = D3D11_FILL_SOLID,
.CullMode = D3D11_CULL_NONE,
.FillMode = D3D11_FILL_SOLID,
.CullMode = D3D11_CULL_NONE,
};
D3D11CreateRasterizerState(d3d11->device, &desc, &d3d11->state);
}
@ -503,10 +488,7 @@ static bool d3d11_gfx_frame(
PERF_START();
D3D11ClearRenderTargetView(d3d11->ctx, d3d11->renderTargetView, d3d11->clearcolor);
D3D11SetVShader(d3d11->ctx, d3d11->vs, NULL, 0);
D3D11SetPShader(d3d11->ctx, d3d11->ps, NULL, 0);
D3D11SetGShader(d3d11->ctx, NULL, NULL, 0);
D3D11SetInputLayout(d3d11->ctx, d3d11->layout);
d3d11_set_shader(d3d11->ctx, &d3d11->shaders[VIDEO_SHADER_STOCK_BLEND]);
D3D11SetPrimitiveTopology(d3d11->ctx, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
if (frame && width && height)
@ -522,62 +504,53 @@ static bool d3d11_gfx_frame(
d3d11->ctx, width, height, pitch, d3d11->format, frame, &d3d11->frame.texture);
}
{
UINT stride = sizeof(d3d11_vertex_t);
UINT offset = 0;
#if 0 /* custom viewport doesn't call apply_state_changes, so we can't rely on this for now */
if (d3d11->resize_viewport)
#endif
d3d11_update_viewport(d3d11, false);
d3d11_update_viewport(d3d11, false);
D3D11SetViewports(d3d11->ctx, 1, &d3d11->frame.viewport);
d3d11_set_texture_and_sampler(d3d11->ctx, 0, &d3d11->frame.texture);
D3D11SetViewports(d3d11->ctx, 1, &d3d11->frame.viewport);
d3d11_set_texture_and_sampler(d3d11->ctx, 0, &d3d11->frame.texture);
D3D11SetVertexBuffers(d3d11->ctx, 0, 1, &d3d11->frame.vbo, &stride, &offset);
D3D11SetVShaderConstantBuffers(d3d11->ctx, 0, 1, &d3d11->frame.ubo);
D3D11SetBlendState(d3d11->ctx, d3d11->blend_disable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
D3D11Draw(d3d11->ctx, 4, 0);
// D3D11SetBlendState(d3d11->ctx, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
D3D11SetVertexBuffer(d3d11->ctx, 0, d3d11->frame.vbo, sizeof(d3d11_vertex_t), 0);
D3D11SetVShaderConstantBuffers(d3d11->ctx, 0, 1, &d3d11->frame.ubo);
if (d3d11->menu.enabled && d3d11->menu.texture.handle)
{
if (d3d11->menu.fullscreen)
D3D11SetViewports(d3d11->ctx, 1, &d3d11->viewport);
D3D11SetVertexBuffers(d3d11->ctx, 0, 1, &d3d11->menu.vbo, &stride, &offset);
D3D11SetVShaderConstantBuffers(d3d11->ctx, 0, 1, &d3d11->ubo);
d3d11_set_texture_and_sampler(d3d11->ctx, 0, &d3d11->menu.texture);
D3D11SetBlendState(d3d11->ctx, d3d11->blend_disable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
D3D11Draw(d3d11->ctx, 4, 0);
D3D11Draw(d3d11->ctx, 4, 0);
}
}
D3D11SetBlendState(d3d11->ctx, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
if (d3d11->menu.enabled && d3d11->menu.texture.handle)
{
UINT sprite_stride = sizeof(d3d11_sprite_t);
UINT offset = 0;
D3D11SetViewports(d3d11->ctx, 1, &d3d11->viewport);
D3D11SetVShader(d3d11->ctx, d3d11->sprites.vs, NULL, 0);
D3D11SetPShader(d3d11->ctx, d3d11->sprites.ps, NULL, 0);
D3D11SetGShader(d3d11->ctx, d3d11->sprites.gs, NULL, 0);
D3D11SetInputLayout(d3d11->ctx, d3d11->sprites.layout);
D3D11SetPrimitiveTopology(d3d11->ctx, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
D3D11SetVertexBuffers(d3d11->ctx, 0, 1, &d3d11->sprites.vbo, &sprite_stride, &offset);
D3D11SetBlendState(d3d11->ctx, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
if (d3d11->menu.fullscreen)
D3D11SetViewports(d3d11->ctx, 1, &d3d11->viewport);
D3D11SetVertexBuffer(d3d11->ctx, 0, d3d11->menu.vbo, sizeof(d3d11_vertex_t), 0);
D3D11SetVShaderConstantBuffers(d3d11->ctx, 0, 1, &d3d11->ubo);
D3D11SetPShaderConstantBuffers(d3d11->ctx, 0, 1, &d3d11->ubo);
d3d11->sprites.enabled = true;
if (d3d11->menu.enabled)
menu_driver_frame(video_info);
if (msg && *msg)
{
font_driver_render_msg(video_info, NULL, msg, NULL);
gfx_ctx_d3d.update_window_title(NULL, video_info);
}
d3d11->sprites.enabled = false;
d3d11_set_texture_and_sampler(d3d11->ctx, 0, &d3d11->menu.texture);
D3D11Draw(d3d11->ctx, 4, 0);
}
D3D11SetViewports(d3d11->ctx, 1, &d3d11->viewport);
d3d11_set_shader(d3d11->ctx, &d3d11->sprites.shader);
D3D11SetPrimitiveTopology(d3d11->ctx, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
D3D11SetVertexBuffer(d3d11->ctx, 0, d3d11->sprites.vbo, sizeof(d3d11_sprite_t), 0);
D3D11SetVShaderConstantBuffer(d3d11->ctx, 0, d3d11->ubo);
D3D11SetPShaderConstantBuffer(d3d11->ctx, 0, d3d11->ubo);
d3d11->sprites.enabled = true;
if (d3d11->menu.enabled)
menu_driver_frame(video_info);
if (msg && *msg)
{
font_driver_render_msg(video_info, NULL, msg, NULL);
gfx_ctx_d3d.update_window_title(NULL, video_info);
}
d3d11->sprites.enabled = false;
DXGIPresent(d3d11->swapChain, !!d3d11->vsync, 0);
PERF_STOP();

View File

@ -0,0 +1,41 @@
#define SRC(src) #src
SRC(
struct UBO
{
float4x4 modelViewProj;
float2 OutputSize;
float time;
};
uniform UBO global;
float4 VSMain(float4 position : POSITION, float2 texcoord : TEXCOORD0) : SV_POSITION
{
return mul(global.modelViewProj, position);
}
float4 PSMain(float4 position : SV_POSITION) : SV_TARGET
{
float speed = global.time * 4.0;
float2 uv = -1.0 + 2.0 * position.xy / global.OutputSize;
uv.x *= global.OutputSize.x / global.OutputSize.y;
float3 color = float3(0.0, 0.0, 0.0);
for( int i=0; i < 8; i++ )
{
float pha = sin(float(i) * 546.13 + 1.0) * 0.5 + 0.5;
float siz = pow(sin(float(i) * 651.74 + 5.0) * 0.5 + 0.5, 4.0);
float pox = sin(float(i) * 321.55 + 4.1) * global.OutputSize.x / global.OutputSize.y;
float rad = 0.1 + 0.5 * siz + sin(pha + siz) / 4.0;
float2 pos = float2(pox + sin(speed / 15. + pha + siz), - 1.0 - rad + (2.0 + 2.0 * rad) * frac(pha + 0.3 * (speed / 7.) * (0.2 + 0.8 * siz)));
float dis = length(uv - pos);
if(dis < rad)
{
float3 col = lerp(float3(0.194 * sin(speed / 6.0) + 0.3, 0.2, 0.3 * pha), float3(1.1 * sin(speed / 9.0) + 0.3, 0.2 * pha, 0.4), 0.5 + 0.5 * sin(float(i)));
color += col.zyx * (1.0 - smoothstep(rad * 0.15, rad, dis));
}
}
color *= sqrt(1.5 - 0.5 * length(uv));
return float4(color.r, color.g, color.b , 0.5);
};
)

View File

@ -1,17 +1,24 @@
#define SRC(src) #src
SRC(
struct UBO
{
float4x4 modelViewProj;
float2 Outputsize;
float time;
};
uniform UBO global;
struct PSInput
{
float4 position : SV_POSITION;
float2 texcoord : TEXCOORD0;
float4 color : COLOR;
};
uniform float4x4 modelViewProj;
PSInput VSMain(float4 position : POSITION, float2 texcoord : TEXCOORD0, float4 color : COLOR)
{
PSInput result;
result.position = mul(modelViewProj, position);
result.position = mul(global.modelViewProj, position);
result.texcoord = texcoord;
result.color = color;
return result;
@ -21,6 +28,5 @@ SRC(
float4 PSMain(PSInput input) : SV_TARGET
{
return input.color * t0.Sample(s0, input.texcoord);
// return input.color;
};
)

View File

@ -0,0 +1,51 @@
#define SRC(src) #src
SRC(
struct UBO
{
float4x4 modelViewProj;
float2 Outputsize;
float time;
};
uniform UBO global;
float iqhash(float n)
{
return frac(sin(n) * 43758.5453);
}
float noise(float3 x)
{
float3 p = floor(x);
float3 f = frac(x);
f = f * f * (3.0 - 2.0 * f);
float n = p.x + p.y * 57.0 + 113.0 * p.z;
return lerp(lerp(lerp(iqhash(n), iqhash(n + 1.0), f.x),
lerp(iqhash(n + 57.0), iqhash(n + 58.0), f.x), f.y),
lerp(lerp(iqhash(n + 113.0), iqhash(n + 114.0), f.x),
lerp(iqhash(n + 170.0), iqhash(n + 171.0), f.x), f.y), f.z);
}
float xmb_noise2(float3 x)
{
return cos(x.z * 4.0) * cos(x.z + global.time / 10.0 + x.x);
}
float4 VSMain(float2 position : POSITION) : SV_POSITION
{
float3 v = float3(position.x, 0.0, position.y);
float3 v2 = v;
v2.x = v2.x + global.time / 2.0;
v2.z = v.z * 3.0;
v.y = cos((v.x + v.z / 3.0 + global.time) * 2.0) / 10.0 + noise(v2.xyz) / 4.0;
v.y = -v.y;
return float4(v.xy, 0.0, 1.0);
}
float4 PSMain() : SV_TARGET
{
return float4(0.05, 0.05, 0.05, 1.0);
};
)

View File

@ -0,0 +1,89 @@
#define SRC(src) #src
SRC(
struct UBO
{
float4x4 modelViewProj;
float2 OutputSize;
float time;
};
uniform UBO global;
struct PSInput
{
float4 position : SV_POSITION;
float2 texcoord : TEXCOORD0;
};
PSInput VSMain(float4 position : POSITION, float2 texcoord : TEXCOORD0)
{
PSInput result;
result.position = mul(global.modelViewProj, position);
result.texcoord = texcoord;
return result;
}
static const float baseScale = 1.25; // [1.0 .. 10.0]
static const float density = 0.5; // [0.01 .. 1.0]
static const float speed = 0.15; // [0.1 .. 1.0]
float rand(float2 co)
{
return frac(sin(dot(co.xy, float2(12.9898, 78.233))) * 43758.5453);
}
float dist_func(float2 distv)
{
float dist = sqrt((distv.x * distv.x) + (distv.y * distv.y)) * (40.0 / baseScale);
dist = clamp(dist, 0.0, 1.0);
return cos(dist * (3.14159265358 * 0.5)) * 0.5;
}
float random_dots(float2 co)
{
float part = 1.0 / 20.0;
float2 cd = floor(co / part);
float p = rand(cd);
if (p > 0.005 * (density * 40.0))
return 0.0;
float2 dpos = (float2(frac(p * 2.0) , p) + float2(2.0, 2.0)) * 0.25;
float2 cellpos = frac(co / part);
float2 distv = (cellpos - dpos);
return dist_func(distv);
}
float snow(float2 pos, float time, float scale)
{
// add wobble
pos.x += cos(pos.y * 1.2 + time * 3.14159 * 2.0 + 1.0 / scale) / (8.0 / scale) * 4.0;
// add gravity
pos += time * scale * float2(-0.5, 1.0) * 4.0;
return random_dots(pos / scale) * (scale * 0.5 + 0.5);
}
float4 PSMain(PSInput input) : SV_TARGET
{
float tim = global.time * 0.4 * speed;
float2 pos = input.position.xy / global.OutputSize.xx;
pos.y = 1.0 - pos.y; // Flip Y
float a = 0.0;
// Each of these is a layer of snow
// Remove some for better performance
// Changing the scale (3rd value) will mess with the looping
a += snow(pos, tim, 1.0);
a += snow(pos, tim, 0.7);
a += snow(pos, tim, 0.6);
a += snow(pos, tim, 0.5);
a += snow(pos, tim, 0.4);
a += snow(pos, tim, 0.3);
a += snow(pos, tim, 0.25);
a += snow(pos, tim, 0.125);
a = a * min(pos.y * 4.0, 1.0);
return float4(1.0, 1.0, 1.0, a);
};
)

View File

@ -0,0 +1,89 @@
#define SRC(src) #src
SRC(
struct UBO
{
float4x4 modelViewProj;
float2 OutputSize;
float time;
};
uniform UBO global;
struct PSInput
{
float4 position : SV_POSITION;
float2 texcoord : TEXCOORD0;
};
PSInput VSMain(float4 position : POSITION, float2 texcoord : TEXCOORD0)
{
PSInput result;
result.position = mul(global.modelViewProj, position);
result.texcoord = texcoord;
return result;
}
static const float baseScale = 3.5; // [1.0 .. 10.0]
static const float density = 0.7; // [0.01 .. 1.0]
static const float speed = 0.25; // [0.1 .. 1.0]
float rand(float2 co)
{
return frac(sin(dot(co.xy, float2(12.9898, 78.233))) * 43758.5453);
}
float dist_func(float2 distv)
{
float dist = sqrt((distv.x * distv.x) + (distv.y * distv.y)) * (40.0 / baseScale);
dist = clamp(dist, 0.0, 1.0);
return cos(dist * (3.14159265358 * 0.5)) * 0.5;
}
float random_dots(float2 co)
{
float part = 1.0 / 20.0;
float2 cd = floor(co / part);
float p = rand(cd);
if (p > 0.005 * (density * 40.0))
return 0.0;
float2 dpos = (float2(frac(p * 2.0) , p) + float2(2.0, 2.0)) * 0.25;
float2 cellpos = frac(co / part);
float2 distv = (cellpos - dpos);
return dist_func(distv);
}
float snow(float2 pos, float time, float scale)
{
// add wobble
pos.x += cos(pos.y * 1.2 + time * 3.14159 * 2.0 + 1.0 / scale) / (8.0 / scale) * 4.0;
// add gravity
pos += time * scale * float2(-0.5, 1.0) * 4.0;
return random_dots(pos / scale) * (scale * 0.5 + 0.5);
}
float4 PSMain(PSInput input) : SV_TARGET
{
float tim = global.time * 0.4 * speed;
float2 pos = input.position.xy / global.OutputSize.xx;
pos.y = 1.0 - pos.y; // Flip Y
float a = 0.0;
// Each of these is a layer of snow
// Remove some for better performance
// Changing the scale (3rd value) will mess with the looping
a += snow(pos, tim, 1.0);
a += snow(pos, tim, 0.7);
a += snow(pos, tim, 0.6);
a += snow(pos, tim, 0.5);
a += snow(pos, tim, 0.4);
a += snow(pos, tim, 0.3);
a += snow(pos, tim, 0.25);
a += snow(pos, tim, 0.125);
a = a * min(pos.y * 4.0, 1.0);
return float4(1.0, 1.0, 1.0, a);
};
)

View File

@ -0,0 +1,81 @@
#define SRC(src) #src
SRC(
struct UBO
{
float4x4 modelViewProj;
float2 OutputSize;
float time;
};
uniform UBO global;
float4 VSMain(float4 position : POSITION, float2 texcoord : TEXCOORD0) : SV_POSITION
{
return mul(global.modelViewProj, position);
}
static const float atime = (global.time + 1.0) / 4.0;
float rand(float2 co)
{
return frac(sin(dot(co.xy, float2(12.9898, 78.233))) * 43758.5453);
}
float rand_float(float x)
{
return rand(float2(x, 1.0));
}
float snow(float3 pos, float2 uv, float o)
{
float2 d = (pos.xy - uv);
float a = atan(d.y / d.x) + sin(atime*1.0 + o) * 10.0;
float dist = d.x*d.x + d.y*d.y;
if(dist < pos.z/400.0)
{
float col = 0.0;
if(sin(a * 8.0) < 0.0)
{
col=1.0;
}
if(dist < pos.z/800.0)
{
col+=1.0;
}
return col * pos.z;
}
return 0.0;
}
float col(float2 c)
{
float color = 0.0;
for (int i = 1; i < 15; i++)
{
float o = rand_float(float(i) / 3.0) * 15.0;
float z = rand_float(float(i) + 13.0);
float x = 1.8 - (3.6) * (rand_float(floor((global.time*((z + 1.0) / 2.0) +o) / 2.0)) + sin(global.time * o /1000.0) / 10.0);
float y = 1.0 - fmod((global.time * ((z + 1.0)/2.0)) + o, 2.0);
color += snow(float3(x,y,z), c, o);
}
return color;
}
float4 PSMain(float4 position : SV_POSITION) : SV_TARGET
{
float2 uv = position.xy / global.OutputSize.xy;
uv = uv * 2.0 - 1.0;
float2 p = uv;
p.x *= global.OutputSize.x / global.OutputSize.y;
p.y =- p.y;
float c = col(p);
return float4(c,c,c,c);
};
)

View File

@ -210,10 +210,12 @@ static void d3d11_font_render_line(
font->atlas->dirty = false;
}
D3D11SetPShader(d3d11->ctx, d3d11->sprites.ps_8bit, NULL, 0);
d3d11_set_texture_and_sampler(d3d11->ctx, 0, &font->texture);
D3D11SetBlendState(d3d11->ctx, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
D3D11SetPShader(d3d11->ctx, d3d11->sprites.shader_font.ps, NULL, 0);
D3D11Draw(d3d11->ctx, count, d3d11->sprites.offset);
D3D11SetPShader(d3d11->ctx, d3d11->sprites.ps, NULL, 0);
D3D11SetPShader(d3d11->ctx, d3d11->sprites.shader.ps, NULL, 0);
d3d11->sprites.offset += count;
}

View File

@ -32,9 +32,17 @@ static const float* menu_display_d3d11_get_default_tex_coords(void) { return NUL
static void* menu_display_d3d11_get_default_mvp(void) { return NULL; }
static void menu_display_d3d11_blend_begin(void) {}
static void menu_display_d3d11_blend_begin(void)
{
d3d11_video_t* d3d11 = (d3d11_video_t*)video_driver_get_ptr(false);
D3D11SetBlendState(d3d11->ctx, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
}
static void menu_display_d3d11_blend_end(void) {}
static void menu_display_d3d11_blend_end(void)
{
d3d11_video_t* d3d11 = (d3d11_video_t*)video_driver_get_ptr(false);
D3D11SetBlendState(d3d11->ctx, d3d11->blend_disable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
}
static void menu_display_d3d11_viewport(void* data) {}
@ -46,79 +54,22 @@ static void menu_display_d3d11_draw(void* data)
if (!d3d11 || !draw || !draw->texture)
return;
if (draw->pipeline.id)
switch (draw->pipeline.id)
{
switch (draw->pipeline.id)
{
case VIDEO_SHADER_MENU:
D3D11SetInputLayout(d3d11->ctx, d3d11->ribbon_layout);
D3D11SetVShader(d3d11->ctx, d3d11->ribbon_vs, NULL, 0);
D3D11SetPShader(d3d11->ctx, d3d11->ribbon_ps, NULL, 0);
D3D11SetGShader(d3d11->ctx, NULL, NULL, 0);
break;
#if 0
case VIDEO_SHADER_MENU:
case VIDEO_SHADER_MENU_2:
D3D11SetVShader(d3d11->ctx, d3d11->ribbon_simple_vs, NULL, 0);
D3D11SetPShader(d3d11->ctx, d3d11->ribbon_simple_ps, NULL, 0);
D3D11SetGShader(d3d11->ctx, NULL, NULL, 0);
break;
case VIDEO_SHADER_MENU_3:
D3D11SetVShader(d3d11->ctx, d3d11->snow_simple_vs, NULL, 0);
D3D11SetPShader(d3d11->ctx, d3d11->snow_simple_ps, NULL, 0);
D3D11SetGShader(d3d11->ctx, NULL, NULL, 0);
break;
case VIDEO_SHADER_MENU_4:
D3D11SetVShader(d3d11->ctx, d3d11->snow_vs, NULL, 0);
D3D11SetPShader(d3d11->ctx, d3d11->snow_ps, NULL, 0);
D3D11SetGShader(d3d11->ctx, NULL, NULL, 0);
break;
case VIDEO_SHADER_MENU_5:
D3D11SetVShader(d3d11->ctx, d3d11->bokeh_vs, NULL, 0);
D3D11SetPShader(d3d11->ctx, d3d11->bokeh_ps, NULL, 0);
D3D11SetGShader(d3d11->ctx, NULL, NULL, 0);
break;
case VIDEO_SHADER_MENU_6:
D3D11SetVShader(d3d11->ctx, d3d11->snowflake_vs, NULL, 0);
D3D11SetPShader(d3d11->ctx, d3d11->snowflake_ps, NULL, 0);
D3D11SetGShader(d3d11->ctx, NULL, NULL, 0);
break;
#endif
default:
break;
}
d3d11_set_shader(d3d11->ctx, &d3d11->shaders[draw->pipeline.id]);
D3D11Draw(d3d11->ctx, draw->coords->vertices, 0);
switch (draw->pipeline.id)
{
case VIDEO_SHADER_MENU:
#if 0
case VIDEO_SHADER_MENU_2:
#endif
D3D11Draw(d3d11->ctx, draw->coords->vertices, 0);
D3D11SetBlendState(d3d11->ctx, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
#if 0
case VIDEO_SHADER_MENU_3:
case VIDEO_SHADER_MENU_4:
case VIDEO_SHADER_MENU_5:
case VIDEO_SHADER_MENU_6:
D3D11Draw(d3d11->ctx, 1, 0);
break;
#endif
}
{
UINT stride = sizeof(d3d11_sprite_t);
UINT offset = 0;
D3D11SetVertexBuffers(d3d11->ctx, 0, 1, &d3d11->sprites.vbo, &stride, &offset);
}
D3D11SetInputLayout(d3d11->ctx, d3d11->sprites.layout);
D3D11SetPrimitiveTopology(d3d11->ctx, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
D3D11SetVShader(d3d11->ctx, d3d11->sprites.vs, NULL, 0);
D3D11SetPShader(d3d11->ctx, d3d11->sprites.ps, NULL, 0);
D3D11SetGShader(d3d11->ctx, d3d11->sprites.gs, NULL, 0);
return;
D3D11SetBlendState(d3d11->ctx, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
d3d11_set_shader(d3d11->ctx, &d3d11->sprites.shader);
D3D11SetVertexBuffer(d3d11->ctx, 0, d3d11->sprites.vbo, sizeof(d3d11_sprite_t), 0);
D3D11SetPrimitiveTopology(d3d11->ctx, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
return;
}
if (!d3d11->sprites.enabled)
@ -127,45 +78,46 @@ static void menu_display_d3d11_draw(void* data)
if (d3d11->sprites.offset + 1 > d3d11->sprites.capacity)
d3d11->sprites.offset = 0;
D3D11_MAPPED_SUBRESOURCE mapped_vbo;
D3D11MapBuffer(d3d11->ctx, d3d11->sprites.vbo, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mapped_vbo);
d3d11_sprite_t* v = (d3d11_sprite_t*)mapped_vbo.pData + d3d11->sprites.offset;
{
D3D11_MAPPED_SUBRESOURCE mapped_vbo;
D3D11MapBuffer(
d3d11->ctx, d3d11->sprites.vbo, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mapped_vbo);
d3d11_sprite_t* 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;
v->pos.w = draw->width / (float)d3d11->viewport.Width;
v->pos.h = draw->height / (float)d3d11->viewport.Height;
v->pos.x = draw->x / (float)d3d11->viewport.Width;
v->pos.y = (d3d11->viewport.Height - draw->y - draw->height) / (float)d3d11->viewport.Height;
v->pos.w = draw->width / (float)d3d11->viewport.Width;
v->pos.h = draw->height / (float)d3d11->viewport.Height;
v->coords.u = 0.0f;
v->coords.v = 0.0f;
v->coords.w = 1.0f;
v->coords.h = 1.0f;
v->coords.u = 0.0f;
v->coords.v = 0.0f;
v->coords.w = 1.0f;
v->coords.h = 1.0f;
if (draw->scale_factor)
v->params.scaling = draw->scale_factor;
else
v->params.scaling = 1.0f;
v->params.rotation = draw->rotation;
if (draw->scale_factor)
v->params.scaling = draw->scale_factor;
else
v->params.scaling = 1.0f;
v->colors[3] = DXGI_COLOR_RGBA(
0xFF * draw->coords->color[0], 0xFF * draw->coords->color[1],
0xFF * draw->coords->color[2], 0xFF * draw->coords->color[3]);
v->colors[2] = DXGI_COLOR_RGBA(
0xFF * draw->coords->color[4], 0xFF * draw->coords->color[5],
0xFF * draw->coords->color[6], 0xFF * draw->coords->color[7]);
v->colors[1] = DXGI_COLOR_RGBA(
0xFF * draw->coords->color[8], 0xFF * draw->coords->color[9],
0xFF * draw->coords->color[10], 0xFF * draw->coords->color[11]);
v->colors[0] = DXGI_COLOR_RGBA(
0xFF * draw->coords->color[12], 0xFF * draw->coords->color[13],
0xFF * draw->coords->color[14], 0xFF * draw->coords->color[15]);
v->params.rotation = draw->rotation;
v->colors[3] = DXGI_COLOR_RGBA(
0xFF * draw->coords->color[0], 0xFF * draw->coords->color[1],
0xFF * draw->coords->color[2], 0xFF * draw->coords->color[3]);
v->colors[2] = DXGI_COLOR_RGBA(
0xFF * draw->coords->color[4], 0xFF * draw->coords->color[5],
0xFF * draw->coords->color[6], 0xFF * draw->coords->color[7]);
v->colors[1] = DXGI_COLOR_RGBA(
0xFF * draw->coords->color[8], 0xFF * draw->coords->color[9],
0xFF * draw->coords->color[10], 0xFF * draw->coords->color[11]);
v->colors[0] = DXGI_COLOR_RGBA(
0xFF * draw->coords->color[12], 0xFF * draw->coords->color[13],
0xFF * draw->coords->color[14], 0xFF * draw->coords->color[15]);
D3D11UnmapBuffer(d3d11->ctx, d3d11->sprites.vbo, 0);
}
D3D11UnmapBuffer(d3d11->ctx, d3d11->sprites.vbo, 0);
#if 0
D3D11SetPShader(d3d11->ctx, d3d11->sprites.ps, NULL, 0);
#endif
d3d11_set_texture_and_sampler(d3d11->ctx, 0, (d3d11_texture_t*)draw->texture);
D3D11Draw(d3d11->ctx, 1, d3d11->sprites.offset);
d3d11->sprites.offset++;
return;
@ -184,9 +136,7 @@ static void menu_display_d3d11_draw_pipeline(void* data)
switch (draw->pipeline.id)
{
case VIDEO_SHADER_MENU:
#if 0
case VIDEO_SHADER_MENU_2:
#endif
case VIDEO_SHADER_MENU_2:
{
ca = menu_display_get_coords_array();
@ -200,30 +150,19 @@ static void menu_display_d3d11_draw_pipeline(void* data)
D3D11_SUBRESOURCE_DATA vertexData = { ca->coords.vertex };
D3D11CreateBuffer(d3d11->device, &desc, &vertexData, &d3d11->menu_pipeline_vbo);
}
D3D11SetVertexBuffer(d3d11->ctx, 0, d3d11->menu_pipeline_vbo, 2 * sizeof(float), 0);
draw->coords->vertices = ca->coords.vertices;
{
UINT stride = 2 * sizeof(float);
UINT offset = 0;
D3D11SetVertexBuffers(d3d11->ctx, 0, 1, &d3d11->menu_pipeline_vbo, &stride, &offset);
}
D3D11SetBlendState(d3d11->ctx, d3d11->blend_pipeline, NULL, D3D11_DEFAULT_SAMPLE_MASK);
break;
}
break;
#if 0
case VIDEO_SHADER_MENU_3:
case VIDEO_SHADER_MENU_4:
case VIDEO_SHADER_MENU_5:
case VIDEO_SHADER_MENU_6:
{
UINT stride = sizeof(d3d11_sprite_t);
UINT offset = 0;
D3D11SetVertexBuffers(d3d11->ctx, 0, 1, &d3d11->frame.vbo, &stride, &offset);
D3D11SetInputLayout(d3d11->ctx, d3d11->layout);
}
break;
#endif
D3D11SetVertexBuffer(d3d11->ctx, 0, d3d11->frame.vbo, sizeof(d3d11_vertex_t), 0);
draw->coords->vertices = 4;
break;
default:
return;
}
@ -243,8 +182,7 @@ static void menu_display_d3d11_restore_clear_color(void) {}
static void menu_display_d3d11_clear_color(menu_display_ctx_clearcolor_t* clearcolor)
{
DWORD clear_color = 0;
d3d11_video_t* d3d11 = (d3d11_video_t*)video_driver_get_ptr(false);
d3d11_video_t* d3d11 = (d3d11_video_t*)video_driver_get_ptr(false);
if (!d3d11 || !clearcolor)
return;

View File

@ -1136,6 +1136,7 @@ void menu_display_draw_cursor(
draw.matrix_data = NULL;
draw.texture = texture;
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline.id = 0;
menu_display_draw(&draw);