New upstream version 25.0.3+dfsg1
This commit is contained in:
parent
04fe0efc67
commit
8b2e5f2130
569 changed files with 62491 additions and 5875 deletions
|
|
@ -251,6 +251,67 @@ void gs_timer_range::Rebuild(ID3D11Device *dev)
|
|||
throw HRError("Failed to create timer", hr);
|
||||
}
|
||||
|
||||
void gs_texture_3d::RebuildSharedTextureFallback()
|
||||
{
|
||||
td = {};
|
||||
td.Width = 2;
|
||||
td.Height = 2;
|
||||
td.Depth = 2;
|
||||
td.MipLevels = 1;
|
||||
td.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
td.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
|
||||
width = td.Width;
|
||||
height = td.Height;
|
||||
depth = td.Depth;
|
||||
dxgiFormat = td.Format;
|
||||
levels = 1;
|
||||
|
||||
resourceDesc = {};
|
||||
resourceDesc.Format = td.Format;
|
||||
resourceDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D;
|
||||
resourceDesc.Texture3D.MostDetailedMip = 0;
|
||||
resourceDesc.Texture3D.MipLevels = 1;
|
||||
|
||||
isShared = false;
|
||||
}
|
||||
|
||||
void gs_texture_3d::Rebuild(ID3D11Device *dev)
|
||||
{
|
||||
HRESULT hr;
|
||||
if (isShared) {
|
||||
hr = dev->OpenSharedResource((HANDLE)(uintptr_t)sharedHandle,
|
||||
__uuidof(ID3D11Texture3D),
|
||||
(void **)&texture);
|
||||
if (FAILED(hr)) {
|
||||
blog(LOG_WARNING,
|
||||
"Failed to rebuild shared texture: ", "0x%08lX",
|
||||
hr);
|
||||
RebuildSharedTextureFallback();
|
||||
}
|
||||
}
|
||||
|
||||
if (!isShared) {
|
||||
hr = dev->CreateTexture3D(
|
||||
&td, data.size() ? srd.data() : nullptr, &texture);
|
||||
if (FAILED(hr))
|
||||
throw HRError("Failed to create 3D texture", hr);
|
||||
}
|
||||
|
||||
hr = dev->CreateShaderResourceView(texture, &resourceDesc, &shaderRes);
|
||||
if (FAILED(hr))
|
||||
throw HRError("Failed to create resource view", hr);
|
||||
|
||||
acquired = false;
|
||||
|
||||
if ((td.MiscFlags & D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX) != 0) {
|
||||
ComQIPtr<IDXGIResource> dxgi_res(texture);
|
||||
if (dxgi_res)
|
||||
GetSharedHandle(dxgi_res);
|
||||
device_texture_acquire_sync(this, 0, INFINITE);
|
||||
}
|
||||
}
|
||||
|
||||
void SavedBlendState::Rebuild(ID3D11Device *dev)
|
||||
{
|
||||
HRESULT hr = dev->CreateBlendState(&bd, &state);
|
||||
|
|
@ -276,7 +337,6 @@ const static D3D_FEATURE_LEVEL featureLevels[] = {
|
|||
D3D_FEATURE_LEVEL_11_0,
|
||||
D3D_FEATURE_LEVEL_10_1,
|
||||
D3D_FEATURE_LEVEL_10_0,
|
||||
D3D_FEATURE_LEVEL_9_3,
|
||||
};
|
||||
|
||||
void gs_device::RebuildDevice()
|
||||
|
|
@ -288,6 +348,9 @@ try {
|
|||
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
for (gs_device_loss &callback : loss_callbacks)
|
||||
callback.device_loss_release(callback.data);
|
||||
|
||||
gs_obj *obj = first_obj;
|
||||
|
||||
while (obj) {
|
||||
|
|
@ -328,6 +391,9 @@ try {
|
|||
case gs_type::gs_timer_range:
|
||||
((gs_timer_range *)obj)->Release();
|
||||
break;
|
||||
case gs_type::gs_texture_3d:
|
||||
((gs_texture_3d *)obj)->Release();
|
||||
break;
|
||||
}
|
||||
|
||||
obj = obj->next;
|
||||
|
|
@ -341,6 +407,7 @@ try {
|
|||
state.Release();
|
||||
|
||||
context->ClearState();
|
||||
context->Flush();
|
||||
|
||||
context.Release();
|
||||
device.Release();
|
||||
|
|
@ -410,6 +477,9 @@ try {
|
|||
case gs_type::gs_timer_range:
|
||||
((gs_timer_range *)obj)->Rebuild(dev);
|
||||
break;
|
||||
case gs_type::gs_texture_3d:
|
||||
((gs_texture_3d *)obj)->Rebuild(dev);
|
||||
break;
|
||||
}
|
||||
|
||||
obj = obj->next;
|
||||
|
|
@ -440,6 +510,9 @@ try {
|
|||
for (auto &state : blendStates)
|
||||
state.Rebuild(dev);
|
||||
|
||||
for (gs_device_loss &callback : loss_callbacks)
|
||||
callback.device_loss_rebuild(device.Get(), callback.data);
|
||||
|
||||
} catch (const char *error) {
|
||||
bcrash("Failed to recreate D3D11: %s", error);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue