forked from OpenXRay/xray-16
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port changes from OGSR to fix OpenXRay#1748
- Loading branch information
Showing
11 changed files
with
49 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,26 @@ | ||
#include "stdafx.h" | ||
#include "dxUIShader.h" | ||
|
||
xr_unordered_map<std::string, ref_shader> g_UIShadersCache; | ||
|
||
static ref_shader& GetCachedUIShader(const char* sh, const char* tex) | ||
{ | ||
std::string key{ tex ? tex : "" }; | ||
key += "_"; | ||
key += sh; | ||
|
||
if (const auto it = g_UIShadersCache.find(key); it != g_UIShadersCache.end()) | ||
{ | ||
return it->second; | ||
} | ||
else | ||
{ | ||
auto& shader = g_UIShadersCache[key]; | ||
shader.create(sh, tex); | ||
return shader; | ||
} | ||
} | ||
|
||
void dxUIShader::Copy(IUIShader& _in) { *this = *((dxUIShader*)&_in); } | ||
void dxUIShader::create(LPCSTR sh, LPCSTR tex) { hShader.create(sh, tex); } | ||
void dxUIShader::destroy() { hShader.destroy(); } | ||
void dxUIShader::create(LPCSTR sh, LPCSTR tex, bool no_cache) { hShader = GetCachedUIShader(sh, tex); } | ||
//void dxUIShader::destroy() { hShader.destroy(); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters