mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-03-11 10:14:12 +00:00
Don't zero-initialize non-dummy textures
This commit is contained in:
parent
0e92bdd29c
commit
abf4ab42a0
@ -1106,6 +1106,8 @@ namespace platf::dxgi {
|
|||||||
t.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
|
t.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
|
||||||
t.MiscFlags = D3D11_RESOURCE_MISC_SHARED_NTHANDLE | D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX;
|
t.MiscFlags = D3D11_RESOURCE_MISC_SHARED_NTHANDLE | D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX;
|
||||||
|
|
||||||
|
HRESULT status;
|
||||||
|
if (dummy) {
|
||||||
auto dummy_data = std::make_unique<std::uint8_t[]>(img->row_pitch * img->height);
|
auto dummy_data = std::make_unique<std::uint8_t[]>(img->row_pitch * img->height);
|
||||||
std::fill_n(dummy_data.get(), img->row_pitch * img->height, 0);
|
std::fill_n(dummy_data.get(), img->row_pitch * img->height, 0);
|
||||||
D3D11_SUBRESOURCE_DATA initial_data {
|
D3D11_SUBRESOURCE_DATA initial_data {
|
||||||
@ -1113,8 +1115,11 @@ namespace platf::dxgi {
|
|||||||
(UINT) img->row_pitch,
|
(UINT) img->row_pitch,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
status = device->CreateTexture2D(&t, &initial_data, &img->capture_texture);
|
||||||
auto status = device->CreateTexture2D(&t, &initial_data, &img->capture_texture);
|
}
|
||||||
|
else {
|
||||||
|
status = device->CreateTexture2D(&t, nullptr, &img->capture_texture);
|
||||||
|
}
|
||||||
if (FAILED(status)) {
|
if (FAILED(status)) {
|
||||||
BOOST_LOG(error) << "Failed to create img buf texture [0x"sv << util::hex(status).to_string_view() << ']';
|
BOOST_LOG(error) << "Failed to create img buf texture [0x"sv << util::hex(status).to_string_view() << ']';
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user