summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gles3/shader_gles3.cpp12
-rw-r--r--drivers/gles3/storage/config.cpp2
-rw-r--r--drivers/gles3/storage/utilities.cpp6
-rw-r--r--drivers/vulkan/vulkan_context.cpp16
4 files changed, 18 insertions, 18 deletions
diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp
index 0341f531d9..77b870f8b2 100644
--- a/drivers/gles3/shader_gles3.cpp
+++ b/drivers/gles3/shader_gles3.cpp
@@ -141,12 +141,12 @@ void ShaderGLES3::_setup(const char *p_vertex_code, const char *p_fragment_code,
tohash.append(p_fragment_code ? p_fragment_code : "");
tohash.append("[gl_implementation]");
- const char *vendor = (const char *)glGetString(GL_VENDOR);
- tohash.append(vendor ? vendor : "unknown");
- const char *renderer = (const char *)glGetString(GL_RENDERER);
- tohash.append(renderer ? renderer : "unknown");
- const char *version = (const char *)glGetString(GL_VERSION);
- tohash.append(version ? version : "unknown");
+ const String &vendor = String::utf8((const char *)glGetString(GL_VENDOR));
+ tohash.append(vendor.is_empty() ? "unknown" : vendor);
+ const String &renderer = String::utf8((const char *)glGetString(GL_RENDERER));
+ tohash.append(renderer.is_empty() ? "unknown" : renderer);
+ const String &version = String::utf8((const char *)glGetString(GL_VERSION));
+ tohash.append(version.is_empty() ? "unknown" : version);
base_sha256 = tohash.as_string().sha256_text();
}
diff --git a/drivers/gles3/storage/config.cpp b/drivers/gles3/storage/config.cpp
index be7555788a..4bf6165fe9 100644
--- a/drivers/gles3/storage/config.cpp
+++ b/drivers/gles3/storage/config.cpp
@@ -109,7 +109,7 @@ Config::Config() {
if (use_depth_prepass) {
String vendors = GLOBAL_GET("rendering/driver/depth_prepass/disable_for_vendors");
Vector<String> vendor_match = vendors.split(",");
- String renderer = (const char *)glGetString(GL_RENDERER);
+ const String &renderer = String::utf8((const char *)glGetString(GL_RENDERER));
for (int i = 0; i < vendor_match.size(); i++) {
String v = vendor_match[i].strip_edges();
if (v == String()) {
diff --git a/drivers/gles3/storage/utilities.cpp b/drivers/gles3/storage/utilities.cpp
index 7deeefc37d..72bcbe879c 100644
--- a/drivers/gles3/storage/utilities.cpp
+++ b/drivers/gles3/storage/utilities.cpp
@@ -372,13 +372,13 @@ uint64_t Utilities::get_rendering_info(RS::RenderingInfo p_info) {
}
String Utilities::get_video_adapter_name() const {
- const String rendering_device_name = (const char *)glGetString(GL_RENDERER);
+ const String rendering_device_name = String::utf8((const char *)glGetString(GL_RENDERER));
// NVIDIA suffixes all GPU model names with "/PCIe/SSE2" in OpenGL (but not Vulkan). This isn't necessary to display nowadays, so it can be trimmed.
return rendering_device_name.trim_suffix("/PCIe/SSE2");
}
String Utilities::get_video_adapter_vendor() const {
- const String rendering_device_vendor = (const char *)glGetString(GL_VENDOR);
+ const String rendering_device_vendor = String::utf8((const char *)glGetString(GL_VENDOR));
// NVIDIA suffixes its vendor name with " Corporation". This is neither necessary to process nor display.
return rendering_device_vendor.trim_suffix(" Corporation");
}
@@ -388,7 +388,7 @@ RenderingDevice::DeviceType Utilities::get_video_adapter_type() const {
}
String Utilities::get_video_adapter_api_version() const {
- return (const char *)glGetString(GL_VERSION);
+ return String::utf8((const char *)glGetString(GL_VERSION));
}
Size2i Utilities::get_maximum_viewport_size() const {
diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp
index 890fd7277f..7a397a170d 100644
--- a/drivers/vulkan/vulkan_context.cpp
+++ b/drivers/vulkan/vulkan_context.cpp
@@ -448,7 +448,7 @@ Error VulkanContext::_initialize_instance_extensions() {
}
#ifdef DEV_ENABLED
for (uint32_t i = 0; i < instance_extension_count; i++) {
- print_verbose(String("VULKAN: Found instance extension ") + String(instance_extensions[i].extensionName));
+ print_verbose(String("VULKAN: Found instance extension ") + String::utf8(instance_extensions[i].extensionName));
}
#endif
@@ -465,9 +465,9 @@ Error VulkanContext::_initialize_instance_extensions() {
if (!enabled_instance_extension_names.has(requested_extension.key)) {
if (requested_extension.value) {
free(instance_extensions);
- ERR_FAIL_V_MSG(ERR_BUG, String("Required extension ") + String(requested_extension.key) + String(" not found, is a driver installed?"));
+ ERR_FAIL_V_MSG(ERR_BUG, String("Required extension ") + String::utf8(requested_extension.key) + String(" not found, is a driver installed?"));
} else {
- print_verbose(String("Optional extension ") + String(requested_extension.key) + String(" not found"));
+ print_verbose(String("Optional extension ") + String::utf8(requested_extension.key) + String(" not found"));
}
}
}
@@ -546,7 +546,7 @@ Error VulkanContext::_initialize_device_extensions() {
#ifdef DEV_ENABLED
for (uint32_t i = 0; i < device_extension_count; i++) {
- print_verbose(String("VULKAN: Found device extension ") + String(device_extensions[i].extensionName));
+ print_verbose(String("VULKAN: Found device extension ") + String::utf8(device_extensions[i].extensionName));
}
#endif
@@ -564,9 +564,9 @@ Error VulkanContext::_initialize_device_extensions() {
if (requested_extension.value) {
free(device_extensions);
ERR_FAIL_V_MSG(ERR_BUG,
- String("vkEnumerateDeviceExtensionProperties failed to find the ") + String(requested_extension.key) + String(" extension.\n\nDo you have a compatible Vulkan installable client driver (ICD) installed?\nvkCreateInstance Failure"));
+ String("vkEnumerateDeviceExtensionProperties failed to find the ") + String::utf8(requested_extension.key) + String(" extension.\n\nDo you have a compatible Vulkan installable client driver (ICD) installed?\nvkCreateInstance Failure"));
} else {
- print_verbose(String("Optional extension ") + String(requested_extension.key) + String(" not found"));
+ print_verbose(String("Optional extension ") + String::utf8(requested_extension.key) + String(" not found"));
}
}
}
@@ -1248,7 +1248,7 @@ Error VulkanContext::_create_physical_device(VkSurfaceKHR p_surface) {
}
}
}
- String name = props.deviceName;
+ String name = String::utf8(props.deviceName);
String vendor = "Unknown";
String dev_type;
switch (props.deviceType) {
@@ -1330,7 +1330,7 @@ Error VulkanContext::_create_physical_device(VkSurfaceKHR p_surface) {
// Get identifier properties.
vkGetPhysicalDeviceProperties(gpu, &gpu_props);
- device_name = gpu_props.deviceName;
+ device_name = String::utf8(gpu_props.deviceName);
device_type = gpu_props.deviceType;
pipeline_cache_id = String::hex_encode_buffer(gpu_props.pipelineCacheUUID, VK_UUID_SIZE);
pipeline_cache_id += "-driver-" + itos(gpu_props.driverVersion);