mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Fix bug in vulkan init. Add some sanity checks to GL shader cache loading.
This commit is contained in:
parent
6a0f65764d
commit
871fa713ed
2 changed files with 19 additions and 15 deletions
|
@ -136,13 +136,6 @@ VkResult VulkanContext::CreateInstance(const char *app_name, int app_ver, uint32
|
|||
// init_error_ = "Failed to validate instance layers";
|
||||
// return;
|
||||
}
|
||||
|
||||
GetDeviceLayerProperties();
|
||||
if (!CheckLayers(device_layer_properties_, device_layer_names_)) {
|
||||
WLOG("CheckLayers failed (2)");
|
||||
// init_error_ = "Failed to validate device layers";
|
||||
// return;
|
||||
}
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -534,6 +527,13 @@ bool VulkanContext::CheckLayers(const std::vector<LayerProperties> &layer_props,
|
|||
void VulkanContext::ChooseDevice(int physical_device) {
|
||||
physical_device_ = physical_device;
|
||||
|
||||
GetDeviceLayerProperties();
|
||||
if (!CheckLayers(device_layer_properties_, device_layer_names_)) {
|
||||
WLOG("CheckLayers failed (2)");
|
||||
// init_error_ = "Failed to validate device layers";
|
||||
// return;
|
||||
}
|
||||
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(physical_devices_[physical_device_], &queue_count, nullptr);
|
||||
assert(queue_count >= 1);
|
||||
|
||||
|
|
|
@ -1009,21 +1009,25 @@ void ShaderManagerGLES::LoadAndPrecompile(const std::string &filename) {
|
|||
time_update();
|
||||
double start = time_now_d();
|
||||
|
||||
// Sanity check the file contents
|
||||
if (header.numFragmentShaders > 1000 || header.numVertexShaders > 1000 || header.numLinkedPrograms > 1000)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < header.numVertexShaders; i++) {
|
||||
ShaderID id;
|
||||
if (!f.ReadArray(&id, 1)) {
|
||||
ERROR_LOG(G3D, "Truncated shader cache file, aborting.");
|
||||
return;
|
||||
}
|
||||
Shader *vs = CompileVertexShader(id);
|
||||
if (vs->Failed()) {
|
||||
// Give up on using the cache, just bail. We can't safely create the fallback shaders here
|
||||
// without trying to deduce the vertType from the VSID.
|
||||
ERROR_LOG(G3D, "Failed to compile a vertex shader loading from cache. Skipping rest of shader cache.");
|
||||
delete vs;
|
||||
return;
|
||||
}
|
||||
if (!vsCache_.Get(id)) {
|
||||
Shader *vs = CompileVertexShader(id);
|
||||
if (vs->Failed()) {
|
||||
// Give up on using the cache, just bail. We can't safely create the fallback shaders here
|
||||
// without trying to deduce the vertType from the VSID.
|
||||
ERROR_LOG(G3D, "Failed to compile a vertex shader loading from cache. Skipping rest of shader cache.");
|
||||
delete vs;
|
||||
return;
|
||||
}
|
||||
vsCache_.Insert(id, vs);
|
||||
} else {
|
||||
WARN_LOG(G3D, "Duplicate vertex shader found in GL shader cache, ignoring");
|
||||
|
|
Loading…
Add table
Reference in a new issue