D3D11HostDisplay: Fix alpha channel of lightgun crosshair
This commit is contained in:
parent
8a39969a61
commit
e84fe4d948
|
@ -9,6 +9,7 @@
|
|||
#include "core/settings.h"
|
||||
#include "core/shader_cache_version.h"
|
||||
#include "display_ps.hlsl.h"
|
||||
#include "display_ps_alpha.hlsl.h"
|
||||
#include "display_vs.hlsl.h"
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_dx11.h"
|
||||
|
@ -603,7 +604,9 @@ bool D3D11HostDisplay::CreateResources()
|
|||
D3D11::ShaderCompiler::CreateVertexShader(m_device.Get(), s_display_vs_bytecode, sizeof(s_display_vs_bytecode));
|
||||
m_display_pixel_shader =
|
||||
D3D11::ShaderCompiler::CreatePixelShader(m_device.Get(), s_display_ps_bytecode, sizeof(s_display_ps_bytecode));
|
||||
if (!m_display_vertex_shader || !m_display_pixel_shader)
|
||||
m_display_alpha_pixel_shader = D3D11::ShaderCompiler::CreatePixelShader(m_device.Get(), s_display_ps_alpha_bytecode,
|
||||
sizeof(s_display_ps_alpha_bytecode));
|
||||
if (!m_display_vertex_shader || !m_display_pixel_shader || !m_display_alpha_pixel_shader)
|
||||
return false;
|
||||
|
||||
if (!m_display_uniform_buffer.Create(m_device.Get(), D3D11_BIND_CONSTANT_BUFFER, DISPLAY_UNIFORM_BUFFER_SIZE))
|
||||
|
@ -662,6 +665,7 @@ void D3D11HostDisplay::DestroyResources()
|
|||
m_display_uniform_buffer.Release();
|
||||
m_linear_sampler.Reset();
|
||||
m_point_sampler.Reset();
|
||||
m_display_alpha_pixel_shader.Reset();
|
||||
m_display_pixel_shader.Reset();
|
||||
m_display_vertex_shader.Reset();
|
||||
m_display_blend_state.Reset();
|
||||
|
@ -840,7 +844,7 @@ void D3D11HostDisplay::RenderSoftwareCursor(s32 left, s32 top, s32 width, s32 he
|
|||
{
|
||||
m_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||
m_context->VSSetShader(m_display_vertex_shader.Get(), nullptr, 0);
|
||||
m_context->PSSetShader(m_display_pixel_shader.Get(), nullptr, 0);
|
||||
m_context->PSSetShader(m_display_alpha_pixel_shader.Get(), nullptr, 0);
|
||||
m_context->PSSetShaderResources(0, 1, static_cast<D3D11HostDisplayTexture*>(texture_handle)->GetD3DSRVArray());
|
||||
m_context->PSSetSamplers(0, 1, m_linear_sampler.GetAddressOf());
|
||||
|
||||
|
|
|
@ -124,6 +124,7 @@ protected:
|
|||
ComPtr<ID3D11BlendState> m_software_cursor_blend_state;
|
||||
ComPtr<ID3D11VertexShader> m_display_vertex_shader;
|
||||
ComPtr<ID3D11PixelShader> m_display_pixel_shader;
|
||||
ComPtr<ID3D11PixelShader> m_display_alpha_pixel_shader;
|
||||
ComPtr<ID3D11SamplerState> m_point_sampler;
|
||||
ComPtr<ID3D11SamplerState> m_linear_sampler;
|
||||
|
||||
|
|
|
@ -4,5 +4,9 @@ SamplerState samp0_ss : register(s0);
|
|||
void main(in float2 v_tex0 : TEXCOORD0,
|
||||
out float4 o_col0 : SV_Target)
|
||||
{
|
||||
#ifdef ALPHA
|
||||
o_col0 = samp0.Sample(samp0_ss, v_tex0);
|
||||
#else
|
||||
o_col0 = float4(samp0.Sample(samp0_ss, v_tex0).rgb, 1.0);
|
||||
#endif
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
#if 0
|
||||
//
|
||||
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
|
||||
//
|
||||
//
|
||||
// Resource Bindings:
|
||||
//
|
||||
// Name Type Format Dim HLSL Bind Count
|
||||
// ------------------------------ ---------- ------- ----------- -------------- ------
|
||||
// samp0_ss sampler NA NA s0 1
|
||||
// samp0 texture float4 2d t0 1
|
||||
//
|
||||
//
|
||||
//
|
||||
// Input signature:
|
||||
//
|
||||
// Name Index Mask Register SysValue Format Used
|
||||
// -------------------- ----- ------ -------- -------- ------- ------
|
||||
// TEXCOORD 0 xy 0 NONE float xy
|
||||
//
|
||||
//
|
||||
// Output signature:
|
||||
//
|
||||
// Name Index Mask Register SysValue Format Used
|
||||
// -------------------- ----- ------ -------- -------- ------- ------
|
||||
// SV_Target 0 xyzw 0 TARGET float xyzw
|
||||
//
|
||||
ps_4_0
|
||||
dcl_sampler s0, mode_default
|
||||
dcl_resource_texture2d (float,float,float,float) t0
|
||||
dcl_input_ps linear v0.xy
|
||||
dcl_output o0.xyzw
|
||||
sample o0.xyzw, v0.xyxx, t0.xyzw, s0
|
||||
ret
|
||||
// Approximately 2 instruction slots used
|
||||
#endif
|
||||
|
||||
const BYTE static s_display_ps_alpha_bytecode[] =
|
||||
{
|
||||
68, 88, 66, 67, 140, 134,
|
||||
46, 29, 68, 36, 193, 23,
|
||||
94, 171, 102, 123, 183, 66,
|
||||
19, 177, 1, 0, 0, 0,
|
||||
32, 2, 0, 0, 5, 0,
|
||||
0, 0, 52, 0, 0, 0,
|
||||
208, 0, 0, 0, 4, 1,
|
||||
0, 0, 56, 1, 0, 0,
|
||||
164, 1, 0, 0, 82, 68,
|
||||
69, 70, 148, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 2, 0, 0, 0,
|
||||
28, 0, 0, 0, 0, 4,
|
||||
255, 255, 0, 129, 0, 0,
|
||||
107, 0, 0, 0, 92, 0,
|
||||
0, 0, 3, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 1, 0,
|
||||
0, 0, 1, 0, 0, 0,
|
||||
101, 0, 0, 0, 2, 0,
|
||||
0, 0, 5, 0, 0, 0,
|
||||
4, 0, 0, 0, 255, 255,
|
||||
255, 255, 0, 0, 0, 0,
|
||||
1, 0, 0, 0, 13, 0,
|
||||
0, 0, 115, 97, 109, 112,
|
||||
48, 95, 115, 115, 0, 115,
|
||||
97, 109, 112, 48, 0, 77,
|
||||
105, 99, 114, 111, 115, 111,
|
||||
102, 116, 32, 40, 82, 41,
|
||||
32, 72, 76, 83, 76, 32,
|
||||
83, 104, 97, 100, 101, 114,
|
||||
32, 67, 111, 109, 112, 105,
|
||||
108, 101, 114, 32, 49, 48,
|
||||
46, 49, 0, 171, 73, 83,
|
||||
71, 78, 44, 0, 0, 0,
|
||||
1, 0, 0, 0, 8, 0,
|
||||
0, 0, 32, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 3, 0, 0, 0,
|
||||
0, 0, 0, 0, 3, 3,
|
||||
0, 0, 84, 69, 88, 67,
|
||||
79, 79, 82, 68, 0, 171,
|
||||
171, 171, 79, 83, 71, 78,
|
||||
44, 0, 0, 0, 1, 0,
|
||||
0, 0, 8, 0, 0, 0,
|
||||
32, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
3, 0, 0, 0, 0, 0,
|
||||
0, 0, 15, 0, 0, 0,
|
||||
83, 86, 95, 84, 97, 114,
|
||||
103, 101, 116, 0, 171, 171,
|
||||
83, 72, 68, 82, 100, 0,
|
||||
0, 0, 64, 0, 0, 0,
|
||||
25, 0, 0, 0, 90, 0,
|
||||
0, 3, 0, 96, 16, 0,
|
||||
0, 0, 0, 0, 88, 24,
|
||||
0, 4, 0, 112, 16, 0,
|
||||
0, 0, 0, 0, 85, 85,
|
||||
0, 0, 98, 16, 0, 3,
|
||||
50, 16, 16, 0, 0, 0,
|
||||
0, 0, 101, 0, 0, 3,
|
||||
242, 32, 16, 0, 0, 0,
|
||||
0, 0, 69, 0, 0, 9,
|
||||
242, 32, 16, 0, 0, 0,
|
||||
0, 0, 70, 16, 16, 0,
|
||||
0, 0, 0, 0, 70, 126,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
0, 96, 16, 0, 0, 0,
|
||||
0, 0, 62, 0, 0, 1,
|
||||
83, 84, 65, 84, 116, 0,
|
||||
0, 0, 2, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 2, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
1, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 1, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0
|
||||
};
|
|
@ -1,2 +1,3 @@
|
|||
fxc /T vs_4_0 /E main /O3 /Fh display_vs.hlsl.h /Vn "static s_display_vs_bytecode" display_vs.hlsl
|
||||
fxc /T ps_4_0 /E main /O3 /Fh display_ps.hlsl.h /Vn "static s_display_ps_bytecode" display_ps.hlsl
|
||||
fxc /T ps_4_0 /E main /O3 /Fh display_ps.hlsl.h /Vn "static s_display_ps_bytecode" display_ps.hlsl
|
||||
fxc /T ps_4_0 /E main /O3 /D ALPHA=1 /Fh display_ps_alpha.hlsl.h /Vn "static s_display_ps_alpha_bytecode" display_ps.hlsl
|
Loading…
Reference in New Issue