|
@@ -1293,7 +1293,7 @@ def get_num_shader_models():
|
|
|
|
|
|
def build_shader_model_hash_idx_map():
|
|
def build_shader_model_hash_idx_map():
|
|
#must match get_shader_models.
|
|
#must match get_shader_models.
|
|
- result = "const static std::unordered_map<unsigned, unsigned> hashToIdxMap = {\n"
|
|
|
|
|
|
+ result = "const static std::pair<unsigned, unsigned> hashToIdxMap[] = {\n"
|
|
count = 0
|
|
count = 0
|
|
for profile in shader_profiles:
|
|
for profile in shader_profiles:
|
|
min_sm = profile.start_sm
|
|
min_sm = profile.start_sm
|
|
@@ -1386,11 +1386,12 @@ def get_dxil_version():
|
|
return result
|
|
return result
|
|
|
|
|
|
def get_shader_model_get():
|
|
def get_shader_model_get():
|
|
- # const static std::unordered_map<unsigned, unsigned> hashToIdxMap = {};
|
|
|
|
|
|
+ # const static std::pair<unsigned, unsigned> hashToIdxMap[] = {};
|
|
result = build_shader_model_hash_idx_map()
|
|
result = build_shader_model_hash_idx_map()
|
|
result += "unsigned hash = (unsigned)Kind << 16 | Major << 8 | Minor;\n"
|
|
result += "unsigned hash = (unsigned)Kind << 16 | Major << 8 | Minor;\n"
|
|
- result += "auto it = hashToIdxMap.find(hash);\n"
|
|
|
|
- result += "if (it == hashToIdxMap.end())\n"
|
|
|
|
|
|
+ result += "auto pred = [](const std::pair<unsigned, unsigned>& elem, unsigned val){ return elem.first < val;};\n"
|
|
|
|
+ result += "auto it = std::lower_bound(std::begin(hashToIdxMap), std::end(hashToIdxMap), hash, pred);\n"
|
|
|
|
+ result += "if (it == std::end(hashToIdxMap))\n"
|
|
result += " return GetInvalid();\n"
|
|
result += " return GetInvalid();\n"
|
|
result += "return &ms_ShaderModels[it->second];"
|
|
result += "return &ms_ShaderModels[it->second];"
|
|
return result
|
|
return result
|