mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-30 20:51:06 +01:00 
			
		
		
		
	Backend: WebGPU: Fixed incorrect size parameters in WGPU backend (#4891)
+ squash SDL alignment bits.
This commit is contained in:
		| @@ -231,7 +231,7 @@ bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event) | |||||||
|  |  | ||||||
|     switch (event->type) |     switch (event->type) | ||||||
|     { |     { | ||||||
|     case SDL_MOUSEWHEEL: |         case SDL_MOUSEWHEEL: | ||||||
|         { |         { | ||||||
|             if (event->wheel.x > 0) io.MouseWheelH += 1; |             if (event->wheel.x > 0) io.MouseWheelH += 1; | ||||||
|             if (event->wheel.x < 0) io.MouseWheelH -= 1; |             if (event->wheel.x < 0) io.MouseWheelH -= 1; | ||||||
| @@ -239,27 +239,27 @@ bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event) | |||||||
|             if (event->wheel.y < 0) io.MouseWheel -= 1; |             if (event->wheel.y < 0) io.MouseWheel -= 1; | ||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|     case SDL_MOUSEBUTTONDOWN: |         case SDL_MOUSEBUTTONDOWN: | ||||||
|         { |         { | ||||||
|             if (event->button.button == SDL_BUTTON_LEFT) { bd->MousePressed[0] = true; } |             if (event->button.button == SDL_BUTTON_LEFT) { bd->MousePressed[0] = true; } | ||||||
|             if (event->button.button == SDL_BUTTON_RIGHT) { bd->MousePressed[1] = true; } |             if (event->button.button == SDL_BUTTON_RIGHT) { bd->MousePressed[1] = true; } | ||||||
|             if (event->button.button == SDL_BUTTON_MIDDLE) { bd->MousePressed[2] = true; } |             if (event->button.button == SDL_BUTTON_MIDDLE) { bd->MousePressed[2] = true; } | ||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|     case SDL_TEXTINPUT: |         case SDL_TEXTINPUT: | ||||||
|         { |         { | ||||||
|             io.AddInputCharactersUTF8(event->text.text); |             io.AddInputCharactersUTF8(event->text.text); | ||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|     case SDL_KEYDOWN: |         case SDL_KEYDOWN: | ||||||
|     case SDL_KEYUP: |         case SDL_KEYUP: | ||||||
|         { |         { | ||||||
|             ImGuiKey key = ImGui_ImplSDL2_KeycodeToImGuiKey(event->key.keysym.sym); |             ImGuiKey key = ImGui_ImplSDL2_KeycodeToImGuiKey(event->key.keysym.sym); | ||||||
|             io.AddKeyEvent(key, (event->type == SDL_KEYDOWN)); |             io.AddKeyEvent(key, (event->type == SDL_KEYDOWN)); | ||||||
|             io.SetKeyEventNativeData(key, event->key.keysym.sym, event->key.keysym.scancode, event->key.keysym.scancode); // To support legacy indexing (<1.87 user code). Legacy backend uses SDLK_*** as indices to IsKeyXXX() functions. |             io.SetKeyEventNativeData(key, event->key.keysym.sym, event->key.keysym.scancode, event->key.keysym.scancode); // To support legacy indexing (<1.87 user code). Legacy backend uses SDLK_*** as indices to IsKeyXXX() functions. | ||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|     case SDL_WINDOWEVENT: |         case SDL_WINDOWEVENT: | ||||||
|         { |         { | ||||||
|             if (event->window.event == SDL_WINDOWEVENT_FOCUS_GAINED) |             if (event->window.event == SDL_WINDOWEVENT_FOCUS_GAINED) | ||||||
|                 io.AddFocusEvent(true); |                 io.AddFocusEvent(true); | ||||||
|   | |||||||
| @@ -314,8 +314,8 @@ static void ImGui_ImplWGPU_SetupRenderState(ImDrawData* draw_data, WGPURenderPas | |||||||
|     wgpuRenderPassEncoderSetViewport(ctx, 0, 0, draw_data->FramebufferScale.x * draw_data->DisplaySize.x, draw_data->FramebufferScale.y * draw_data->DisplaySize.y, 0, 1); |     wgpuRenderPassEncoderSetViewport(ctx, 0, 0, draw_data->FramebufferScale.x * draw_data->DisplaySize.x, draw_data->FramebufferScale.y * draw_data->DisplaySize.y, 0, 1); | ||||||
|  |  | ||||||
|     // Bind shader and vertex buffers |     // Bind shader and vertex buffers | ||||||
|     wgpuRenderPassEncoderSetVertexBuffer(ctx, 0, fr->VertexBuffer, 0, fr->VertexBufferSize); |     wgpuRenderPassEncoderSetVertexBuffer(ctx, 0, fr->VertexBuffer, 0, fr->VertexBufferSize * sizeof(ImDrawVert)); | ||||||
|     wgpuRenderPassEncoderSetIndexBuffer(ctx, fr->IndexBuffer, sizeof(ImDrawIdx) == 2 ? WGPUIndexFormat_Uint16 : WGPUIndexFormat_Uint32, 0, fr->IndexBufferSize); |     wgpuRenderPassEncoderSetIndexBuffer(ctx, fr->IndexBuffer, sizeof(ImDrawIdx) == 2 ? WGPUIndexFormat_Uint16 : WGPUIndexFormat_Uint32, 0, fr->IndexBufferSize * sizeof(ImDrawIdx)); | ||||||
|     wgpuRenderPassEncoderSetPipeline(ctx, g_pipelineState); |     wgpuRenderPassEncoderSetPipeline(ctx, g_pipelineState); | ||||||
|     wgpuRenderPassEncoderSetBindGroup(ctx, 0, g_resources.CommonBindGroup, 0, NULL); |     wgpuRenderPassEncoderSetBindGroup(ctx, 0, g_resources.CommonBindGroup, 0, NULL); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -104,6 +104,8 @@ Other Changes: | |||||||
|   Enable with '#define IMGUI_IMPL_METAL_CPP' in your imconfig.h file. |   Enable with '#define IMGUI_IMPL_METAL_CPP' in your imconfig.h file. | ||||||
| - Backends: Metal: Ignore ImDrawCmd where ElemCount == 0, which are normally not emitted by the library but | - Backends: Metal: Ignore ImDrawCmd where ElemCount == 0, which are normally not emitted by the library but | ||||||
|   can theorically be created by user code manipulating a ImDrawList. (#4857) |   can theorically be created by user code manipulating a ImDrawList. (#4857) | ||||||
|  | - Backends: WebGPU: Fixed incorrect size parameters in wgpuRenderPassEncoderSetIndexBuffer() and | ||||||
|  |   wgpuRenderPassEncoderSetVertexBuffer() calls. (#4891) [@FeepsDev] | ||||||
|  |  | ||||||
|  |  | ||||||
| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user