diff --git a/sunshine/platform/windows/display_vram.cpp b/sunshine/platform/windows/display_vram.cpp index 55fce9a4..0d87b40c 100644 --- a/sunshine/platform/windows/display_vram.cpp +++ b/sunshine/platform/windows/display_vram.cpp @@ -99,6 +99,7 @@ util::buffer_t make_cursor_image(util::buffer_t &&im class hwdevice_t : public platf::hwdevice_t { public: + hwdevice_t(std::vector *hwdevices_p) : hwdevices_p { hwdevices_p } {} hwdevice_t() = delete; @@ -168,8 +169,8 @@ public: auto &processor_in = it->second; D3D11_VIDEO_PROCESSOR_STREAM stream[] { - { TRUE, 0, 0, 0, 0, nullptr, processor_in.get(), nullptr }, - { TRUE, 0, 0, 0, 0, nullptr, cursor_in.get(), nullptr } + { TRUE, 0, 0, 0, 0, nullptr, processor_in.get() }, + { TRUE, 0, 0, 0, 0, nullptr, cursor_in.get() } }; auto status = ctx->VideoProcessorBlt(processor.get(), processor_out.get(), 0, cursor_visible ? 2 : 1, stream); @@ -233,6 +234,12 @@ public: } processor_e.reset(vp_e_p); + D3D11_VIDEO_PROCESSOR_CAPS proc_caps; + processor_e->GetVideoProcessorCaps(&proc_caps); + if(!(proc_caps.FeatureCaps & D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_STREAM)) { + BOOST_LOG(warning) << "VideoProcessorSetStreamAlpha() not supported, hardware accelerated mouse cannot be added to the video stream"sv; + } + video::processor_t::pointer processor_p; status = device->CreateVideoProcessor(processor_e.get(), 0, &processor_p); if(FAILED(status)) { @@ -241,6 +248,9 @@ public: } processor.reset(processor_p); + // Tell video processor alpha values need to be enabled + ctx->VideoProcessorSetStreamAlpha(processor.get(), 1, TRUE, 1.0f); + D3D11_TEXTURE2D_DESC t {}; t.Width = out_width; t.Height = out_height; @@ -275,9 +285,6 @@ public: } processor_out.reset(processor_out_p); - // Tell video processor alpha values need to be enabled - ctx->VideoProcessorSetStreamAlpha(processor.get(), 1, TRUE, 1.0f); - device_p->AddRef(); data = device_p; return 0; @@ -373,7 +380,7 @@ capture_e display_vram_t::snapshot(platf::img_t *img_base, std::chrono::millisec dxgi::texture2d_t::pointer tex_p {}; auto status = device->CreateTexture2D(&t, &data, &tex_p); if(FAILED(status)) { - BOOST_LOG(error) << "Failed to create dummy texture [0x"sv << util::hex(status).to_string_view() << ']'; + BOOST_LOG(error) << "Failed to create mouse texture [0x"sv << util::hex(status).to_string_view() << ']'; return capture_e::error; } texture2d_t texture { tex_p }; diff --git a/sunshine/platform/windows/input.cpp b/sunshine/platform/windows/input.cpp index e69fea96..284f3c83 100755 --- a/sunshine/platform/windows/input.cpp +++ b/sunshine/platform/windows/input.cpp @@ -188,7 +188,7 @@ retry: } void button_mouse(input_t &input, int button, bool release) { - constexpr SHORT KEY_STATE_DOWN = 0x8000; + constexpr auto KEY_STATE_DOWN = (SHORT)0x8000; INPUT i {}; @@ -370,7 +370,7 @@ HDESK pairInputDesktop() { } return hDesk; -}; +} void freeInput(void *p) { auto vigem = (vigem_t*)p;