mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-10-26 12:27:30 +00:00 
			
		
		
		
	Backends: DX10, DX11, DX12, OpenGL3, Vulkan, WGPU: Assert when CreateDeviceObjects() calls return false.
This commit is contained in:
		| @@ -642,7 +642,8 @@ void ImGui_ImplDX10_NewFrame() | |||||||
|     IM_ASSERT(bd != nullptr && "Context or backend not initialized! Did you call ImGui_ImplDX10_Init()?"); |     IM_ASSERT(bd != nullptr && "Context or backend not initialized! Did you call ImGui_ImplDX10_Init()?"); | ||||||
|  |  | ||||||
|     if (!bd->pVertexShader) |     if (!bd->pVertexShader) | ||||||
|         ImGui_ImplDX10_CreateDeviceObjects(); |         if (!ImGui_ImplDX10_CreateDeviceObjects()) | ||||||
|  |             IM_ASSERT(0 && "ImGui_ImplDX10_CreateDeviceObjects() failed!"); | ||||||
| } | } | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
|   | |||||||
| @@ -662,7 +662,8 @@ void ImGui_ImplDX11_NewFrame() | |||||||
|     IM_ASSERT(bd != nullptr && "Context or backend not initialized! Did you call ImGui_ImplDX11_Init()?"); |     IM_ASSERT(bd != nullptr && "Context or backend not initialized! Did you call ImGui_ImplDX11_Init()?"); | ||||||
|  |  | ||||||
|     if (!bd->pVertexShader) |     if (!bd->pVertexShader) | ||||||
|         ImGui_ImplDX11_CreateDeviceObjects(); |         if (!ImGui_ImplDX11_CreateDeviceObjects()) | ||||||
|  |             IM_ASSERT(0 && "ImGui_ImplDX11_CreateDeviceObjects() failed!"); | ||||||
| } | } | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
|   | |||||||
| @@ -914,7 +914,8 @@ void ImGui_ImplDX12_NewFrame() | |||||||
|     IM_ASSERT(bd != nullptr && "Context or backend not initialized! Did you call ImGui_ImplDX12_Init()?"); |     IM_ASSERT(bd != nullptr && "Context or backend not initialized! Did you call ImGui_ImplDX12_Init()?"); | ||||||
|  |  | ||||||
|     if (!bd->pPipelineState) |     if (!bd->pPipelineState) | ||||||
|         ImGui_ImplDX12_CreateDeviceObjects(); |         if (!ImGui_ImplDX12_CreateDeviceObjects()) | ||||||
|  |             IM_ASSERT(0 && "ImGui_ImplDX12_CreateDeviceObjects() failed!"); | ||||||
| } | } | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
|   | |||||||
| @@ -431,7 +431,8 @@ void    ImGui_ImplOpenGL3_NewFrame() | |||||||
|     ImGui_ImplOpenGL3_InitLoader(); // Lazily init loader if not already done for e.g. DLL boundaries. |     ImGui_ImplOpenGL3_InitLoader(); // Lazily init loader if not already done for e.g. DLL boundaries. | ||||||
|  |  | ||||||
|     if (!bd->ShaderHandle) |     if (!bd->ShaderHandle) | ||||||
|         ImGui_ImplOpenGL3_CreateDeviceObjects(); |         if (!ImGui_ImplOpenGL3_CreateDeviceObjects()) | ||||||
|  |             IM_ASSERT(0 && "ImGui_ImplOpenGL3_CreateDeviceObjects() failed!"); | ||||||
| } | } | ||||||
|  |  | ||||||
| static void ImGui_ImplOpenGL3_SetupRenderState(ImDrawData* draw_data, int fb_width, int fb_height, GLuint vertex_array_object) | static void ImGui_ImplOpenGL3_SetupRenderState(ImDrawData* draw_data, int fb_width, int fb_height, GLuint vertex_array_object) | ||||||
| @@ -965,21 +966,24 @@ bool    ImGui_ImplOpenGL3_CreateDeviceObjects() | |||||||
|     GL_CALL(vert_handle = glCreateShader(GL_VERTEX_SHADER)); |     GL_CALL(vert_handle = glCreateShader(GL_VERTEX_SHADER)); | ||||||
|     glShaderSource(vert_handle, 2, vertex_shader_with_version, nullptr); |     glShaderSource(vert_handle, 2, vertex_shader_with_version, nullptr); | ||||||
|     glCompileShader(vert_handle); |     glCompileShader(vert_handle); | ||||||
|     CheckShader(vert_handle, "vertex shader"); |     if (!CheckShader(vert_handle, "vertex shader")) | ||||||
|  |         return false; | ||||||
|  |  | ||||||
|     const GLchar* fragment_shader_with_version[2] = { bd->GlslVersionString, fragment_shader }; |     const GLchar* fragment_shader_with_version[2] = { bd->GlslVersionString, fragment_shader }; | ||||||
|     GLuint frag_handle; |     GLuint frag_handle; | ||||||
|     GL_CALL(frag_handle = glCreateShader(GL_FRAGMENT_SHADER)); |     GL_CALL(frag_handle = glCreateShader(GL_FRAGMENT_SHADER)); | ||||||
|     glShaderSource(frag_handle, 2, fragment_shader_with_version, nullptr); |     glShaderSource(frag_handle, 2, fragment_shader_with_version, nullptr); | ||||||
|     glCompileShader(frag_handle); |     glCompileShader(frag_handle); | ||||||
|     CheckShader(frag_handle, "fragment shader"); |     if (!CheckShader(frag_handle, "fragment shader")) | ||||||
|  |         return false; | ||||||
|  |  | ||||||
|     // Link |     // Link | ||||||
|     bd->ShaderHandle = glCreateProgram(); |     bd->ShaderHandle = glCreateProgram(); | ||||||
|     glAttachShader(bd->ShaderHandle, vert_handle); |     glAttachShader(bd->ShaderHandle, vert_handle); | ||||||
|     glAttachShader(bd->ShaderHandle, frag_handle); |     glAttachShader(bd->ShaderHandle, frag_handle); | ||||||
|     glLinkProgram(bd->ShaderHandle); |     glLinkProgram(bd->ShaderHandle); | ||||||
|     CheckProgram(bd->ShaderHandle, "shader program"); |     if (!CheckProgram(bd->ShaderHandle, "shader program")) | ||||||
|  |         return false; | ||||||
|  |  | ||||||
|     glDetachShader(bd->ShaderHandle, vert_handle); |     glDetachShader(bd->ShaderHandle, vert_handle); | ||||||
|     glDetachShader(bd->ShaderHandle, frag_handle); |     glDetachShader(bd->ShaderHandle, frag_handle); | ||||||
|   | |||||||
| @@ -1236,7 +1236,8 @@ bool    ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info) | |||||||
|     } |     } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|     ImGui_ImplVulkan_CreateDeviceObjects(); |     if (!ImGui_ImplVulkan_CreateDeviceObjects()) | ||||||
|  |         IM_ASSERT(0 && "ImGui_ImplVulkan_CreateDeviceObjects() failed!"); // <- Can't be hit yet. | ||||||
|  |  | ||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -901,7 +901,8 @@ void ImGui_ImplWGPU_NewFrame() | |||||||
| { | { | ||||||
|     ImGui_ImplWGPU_Data* bd = ImGui_ImplWGPU_GetBackendData(); |     ImGui_ImplWGPU_Data* bd = ImGui_ImplWGPU_GetBackendData(); | ||||||
|     if (!bd->pipelineState) |     if (!bd->pipelineState) | ||||||
|         ImGui_ImplWGPU_CreateDeviceObjects(); |         if (!ImGui_ImplWGPU_CreateDeviceObjects()) | ||||||
|  |             IM_ASSERT(0 && "ImGui_ImplWGPU_CreateDeviceObjects() failed!"); | ||||||
| } | } | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 ocornut
					ocornut