dxgsg9: fix debug messages not protected by is_debug() check

This commit is contained in:
rdb 2020-01-13 16:22:04 +01:00
parent 8d472dfbcc
commit b9aa4f2448
2 changed files with 26 additions and 12 deletions

View File

@ -1001,8 +1001,10 @@ begin_frame(Thread *current_thread) {
GraphicsStateGuardian::begin_frame(current_thread);
if (_d3d_device == nullptr) {
dxgsg9_cat.debug()
<< this << "::begin_frame(): no device.\n";
if (dxgsg9_cat.is_debug()) {
dxgsg9_cat.debug()
<< this << "::begin_frame(): no device.\n";
}
return false;
}
@ -1955,9 +1957,11 @@ framebuffer_copy_to_texture(Texture *tex, int view, int z,
tex_level_0, &src_rect,
filter);
if (FAILED(hr)) {
dxgsg9_cat.debug()
<< "StretchRect failed in framebuffer_copy_to_texture"
<< D3DERRORSTRING(hr);
if (dxgsg9_cat.is_debug()) {
dxgsg9_cat.debug()
<< "StretchRect failed in framebuffer_copy_to_texture"
<< D3DERRORSTRING(hr);
}
okflag = false;
}
@ -2399,7 +2403,7 @@ reset() {
hr = _d3d_device->CreateQuery(D3DQUERYTYPE_OCCLUSION, nullptr);
_supports_occlusion_query = !FAILED(hr);
if (dxgsg9_cat.is_error()) {
if (dxgsg9_cat.is_debug()) {
dxgsg9_cat.debug()
<< "\nHwTransformAndLight = " << ((d3d_caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) != 0)
<< "\nMaxTextureWidth = " << d3d_caps.MaxTextureWidth
@ -4628,8 +4632,10 @@ reset_d3d_device(D3DPRESENT_PARAMETERS *presentation_params,
// release the old swapchain and create a new one
if (_screen && _screen->_swap_chain) {
_screen->_swap_chain->Release();
wdxdisplay9_cat.debug()
<< "swap chain " << _screen->_swap_chain << " is released\n";
if (wdxdisplay9_cat.is_debug()) {
wdxdisplay9_cat.debug()
<< "swap chain " << _screen->_swap_chain << " is released\n";
}
_screen->_swap_chain = nullptr;
hr = _d3d_device->CreateAdditionalSwapChain(presentation_params, &_screen->_swap_chain);
}
@ -4749,7 +4755,10 @@ create_swap_chain(DXScreenData *new_context) {
HRESULT hr;
hr = new_context->_d3d_device->CreateAdditionalSwapChain(&new_context->_presentation_params, &new_context->_swap_chain);
if (FAILED(hr)) {
wdxdisplay9_cat.debug() << "Swapchain creation failed :"<<D3DERRORSTRING(hr)<<"\n";
if (wdxdisplay9_cat.is_debug()) {
wdxdisplay9_cat.debug()
<< "Swapchain creation failed :" << D3DERRORSTRING(hr) << "\n";
}
return false;
}
return true;
@ -4764,7 +4773,10 @@ release_swap_chain(DXScreenData *new_context) {
if (new_context->_swap_chain) {
hr = new_context->_swap_chain->Release();
if (FAILED(hr)) {
wdxdisplay9_cat.debug() << "Swapchain release failed:" << D3DERRORSTRING(hr) << "\n";
if (wdxdisplay9_cat.is_debug()) {
wdxdisplay9_cat.debug()
<< "Swapchain release failed:" << D3DERRORSTRING(hr) << "\n";
}
return false;
}
}

View File

@ -2014,8 +2014,10 @@ fill_d3d_texture_pixels(DXScreenData &scrn, bool compress_texture) {
// on the fly
int miplevel_count = _d3d_texture->GetLevelCount();
if (miplevel_count <= tex->get_num_loadable_ram_mipmap_images()) {
dxgsg9_cat.debug()
<< "Using pre-calculated mipmap levels for texture " << tex->get_name() << "\n";
if (dxgsg9_cat.is_debug()) {
dxgsg9_cat.debug()
<< "Using pre-calculated mipmap levels for texture " << tex->get_name() << "\n";
}
for (int mip_level = 1; mip_level < miplevel_count; ++mip_level) {
hr = fill_d3d_texture_mipmap_pixels(mip_level, di, source_format);