diff --git a/src/d3d8/d3d8_device.cpp b/src/d3d8/d3d8_device.cpp index 9eee94f05358..fdb881e75cb3 100644 --- a/src/d3d8/d3d8_device.cpp +++ b/src/d3d8/d3d8_device.cpp @@ -454,7 +454,11 @@ namespace dxvk { UINT Height, D3DFORMAT Format, IDirect3DSurface8** ppSurface) { - // FIXME: Handle D3DPOOL_SCRATCH in CopyRects + // Workaround for Chrome: Gold Edition + if (m_d3d8Options.useX8R8G8B8forR8G8B8 && Format == D3DFMT_R8G8B8) + Format = D3DFMT_X8R8G8B8; + + // TODO: Handle D3DPOOL_SCRATCH in CopyRects D3DPOOL pool = isUnsupportedSurfaceFormat(Format) ? D3DPOOL_SCRATCH : D3DPOOL_SYSTEMMEM; Com pSurf = nullptr; diff --git a/src/d3d8/d3d8_options.h b/src/d3d8/d3d8_options.h index 67bdf35927cd..09707f8a8d10 100644 --- a/src/d3d8/d3d8_options.h +++ b/src/d3d8/d3d8_options.h @@ -34,11 +34,23 @@ namespace dxvk { /// and above. Most likely ATI/AMD drivers never supported P8 in the first place. bool placeP8InScratch = false; + /// Chrome: Gold Edition ends up on a path calling CopyRects on a D3DPOOL_DEFAULT source + /// surface using the X8R8G8B8 format and a D3DPOOL_SYSTEMMEM (or D3DPOOL_SCRATCH) + /// destination surface using R8G8B8, and crashes should that call fail. + /// + /// Since CopyRects does not perform format conversions, we need to handle it ourselves + /// before it gets to that point, by swapping R8G8B8 with X8R8G8B8 during the call to + /// CreateImageSurface (which creates the destination surface for CopyRects). + /// + /// I am unsure how this entire thing even ever worked on native... + bool useX8R8G8B8forR8G8B8 = false; + D3D8Options() {} D3D8Options(const Config& config) { auto forceVsDeclStr = config.getOption("d3d8.forceVsDecl", ""); batching = config.getOption ("d3d8.batching", batching); placeP8InScratch = config.getOption ("d3d8.placeP8InScratch", placeP8InScratch); + useX8R8G8B8forR8G8B8 = config.getOption ("d3d8.useX8R8G8B8forR8G8B8", useX8R8G8B8forR8G8B8); parseVsDecl(forceVsDeclStr); } diff --git a/src/d3d8/d3d8_surface.cpp b/src/d3d8/d3d8_surface.cpp index 8d7c970bbcd3..7828f239bee1 100644 --- a/src/d3d8/d3d8_surface.cpp +++ b/src/d3d8/d3d8_surface.cpp @@ -16,11 +16,11 @@ namespace dxvk { d3d9::D3DMULTISAMPLE_NONE, 0, FALSE, &image, - NULL); - + NULL); + if (FAILED(res)) - throw new DxvkError("D3D8: Failed to create blit image"); - + Logger::err(str::format("Failed to create blit image for format: ", desc.Format)); + return image; } } \ No newline at end of file diff --git a/src/util/config/config.cpp b/src/util/config/config.cpp index 66d426125af8..f50451d82d51 100644 --- a/src/util/config/config.cpp +++ b/src/util/config/config.cpp @@ -1116,6 +1116,13 @@ namespace dxvk { { R"(\\SplinterCell2\.exe$)", {{ { "d3d9.maxFrameRate", "60" }, }} }, + /* Chrome: Gold Edition * + * Relies on some form of R8G8B8 support and * + * has broken character motion at high FPS */ + { R"(\\Chrome(Single|Net)\.exe$)", {{ + { "d3d8.useX8R8G8B8forR8G8B8", "True" }, + { "d3d9.maxFrameRate", "60" }, + }} }, }};