Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update with premultiplied backbuffer flag #30

Merged
merged 20 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
226 changes: 135 additions & 91 deletions 3rdparty/cgltf/cgltf.h

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion 3rdparty/cgltf/cgltf_write.h
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ static const char* cgltf_write_str_path_type(cgltf_animation_path_type path_type
return "scale";
case cgltf_animation_path_type_weights:
return "weights";
case cgltf_animation_path_type_invalid:
default:
break;
}
return "invalid";
Expand All @@ -815,6 +815,8 @@ static const char* cgltf_write_str_interpolation_type(cgltf_interpolation_type i
return "STEP";
case cgltf_interpolation_type_cubic_spline:
return "CUBICSPLINE";
default:
break;
}
return "invalid";
}
Expand Down
740 changes: 487 additions & 253 deletions 3rdparty/dear-imgui/imgui.cpp

Large diffs are not rendered by default.

229 changes: 114 additions & 115 deletions 3rdparty/dear-imgui/imgui.h

Large diffs are not rendered by default.

158 changes: 94 additions & 64 deletions 3rdparty/dear-imgui/imgui_demo.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion 3rdparty/dear-imgui/imgui_draw.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// dear imgui, v1.88 WIP
// dear imgui, v1.89 WIP
// (drawing and font code)

/*
Expand Down
266 changes: 158 additions & 108 deletions 3rdparty/dear-imgui/imgui_internal.h

Large diffs are not rendered by default.

41 changes: 22 additions & 19 deletions 3rdparty/dear-imgui/imgui_tables.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// dear imgui, v1.88 WIP
// dear imgui, v1.89 WIP
// (tables and columns code)

/*
Expand Down Expand Up @@ -539,7 +539,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
if (table->RefScale != 0.0f && table->RefScale != new_ref_scale_unit)
{
const float scale_factor = new_ref_scale_unit / table->RefScale;
//IMGUI_DEBUG_LOG("[table] %08X RefScaleUnit %.3f -> %.3f, scaling width by %.3f\n", table->ID, table->RefScaleUnit, new_ref_scale_unit, scale_factor);
//IMGUI_DEBUG_PRINT("[table] %08X RefScaleUnit %.3f -> %.3f, scaling width by %.3f\n", table->ID, table->RefScaleUnit, new_ref_scale_unit, scale_factor);
for (int n = 0; n < columns_count; n++)
table->Columns[n].WidthRequest = table->Columns[n].WidthRequest * scale_factor;
}
Expand Down Expand Up @@ -1105,18 +1105,10 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
table->IsUsingHeaders = false;

// [Part 11] Context menu
if (table->IsContextPopupOpen && table->InstanceCurrent == table->InstanceInteracted)
if (TableBeginContextMenuPopup(table))
{
const ImGuiID context_menu_id = ImHashStr("##ContextMenu", 0, table->ID);
if (BeginPopupEx(context_menu_id, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings))
{
TableDrawContextMenu(table);
EndPopup();
}
else
{
table->IsContextPopupOpen = false;
}
TableDrawContextMenu(table);
EndPopup();
}

// [Part 13] Sanitize and build sort specs before we have a change to use them for display.
Expand Down Expand Up @@ -2100,7 +2092,7 @@ void ImGui::TableSetColumnWidth(int column_n, float width)
if (column_0->WidthGiven == column_0_width || column_0->WidthRequest == column_0_width)
return;

//IMGUI_DEBUG_LOG("TableSetColumnWidth(%d, %.1f->%.1f)\n", column_0_idx, column_0->WidthGiven, column_0_width);
//IMGUI_DEBUG_PRINT("TableSetColumnWidth(%d, %.1f->%.1f)\n", column_0_idx, column_0->WidthGiven, column_0_width);
ImGuiTableColumn* column_1 = (column_0->NextEnabledColumn != -1) ? &table->Columns[column_0->NextEnabledColumn] : NULL;

// In this surprisingly not simple because of how we support mixing Fixed and multiple Stretch columns.
Expand Down Expand Up @@ -2370,7 +2362,7 @@ void ImGui::TableMergeDrawChannels(ImGuiTable* table)

// Don't attempt to merge if there are multiple draw calls within the column
ImDrawChannel* src_channel = &splitter->_Channels[channel_no];
if (src_channel->_CmdBuffer.Size > 0 && src_channel->_CmdBuffer.back().ElemCount == 0 && src_channel->_CmdBuffer.back().UserCallback != NULL) // Equivalent of PopUnusedDrawCmd()
if (src_channel->_CmdBuffer.Size > 0 && src_channel->_CmdBuffer.back().ElemCount == 0 && src_channel->_CmdBuffer.back().UserCallback == NULL) // Equivalent of PopUnusedDrawCmd()
src_channel->_CmdBuffer.pop_back();
if (src_channel->_CmdBuffer.Size != 1)
continue;
Expand Down Expand Up @@ -3035,6 +3027,17 @@ void ImGui::TableOpenContextMenu(int column_n)
}
}

bool ImGui::TableBeginContextMenuPopup(ImGuiTable* table)
{
if (!table->IsContextPopupOpen || table->InstanceCurrent != table->InstanceInteracted)
return false;
const ImGuiID context_menu_id = ImHashStr("##ContextMenu", 0, table->ID);
if (BeginPopupEx(context_menu_id, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings))
return true;
table->IsContextPopupOpen = false;
return false;
}

// Output context menu into current window (generally a popup)
// FIXME-TABLE: Ideally this should be writable by the user. Full programmatic access to that data?
void ImGui::TableDrawContextMenu(ImGuiTable* table)
Expand Down Expand Up @@ -3464,7 +3467,7 @@ void ImGui::TableSettingsAddSettingsHandler()
// Remove Table (currently only used by TestEngine)
void ImGui::TableRemove(ImGuiTable* table)
{
//IMGUI_DEBUG_LOG("TableRemove() id=0x%08X\n", table->ID);
//IMGUI_DEBUG_PRINT("TableRemove() id=0x%08X\n", table->ID);
ImGuiContext& g = *GImGui;
int table_idx = g.Tables.GetIndex(table);
//memset(table->RawData.Data, 0, table->RawData.size_in_bytes());
Expand All @@ -3476,7 +3479,7 @@ void ImGui::TableRemove(ImGuiTable* table)
// Free up/compact internal Table buffers for when it gets unused
void ImGui::TableGcCompactTransientBuffers(ImGuiTable* table)
{
//IMGUI_DEBUG_LOG("TableGcCompactTransientBuffers() id=0x%08X\n", table->ID);
//IMGUI_DEBUG_PRINT("TableGcCompactTransientBuffers() id=0x%08X\n", table->ID);
ImGuiContext& g = *GImGui;
IM_ASSERT(table->MemoryCompacted == false);
table->SortSpecs.Specs = NULL;
Expand Down Expand Up @@ -3520,7 +3523,7 @@ void ImGui::TableGcCompactSettings()
// - DebugNodeTable() [Internal]
//-------------------------------------------------------------------------

#ifndef IMGUI_DISABLE_METRICS_WINDOW
#ifndef IMGUI_DISABLE_DEBUG_TOOLS

static const char* DebugNodeTableGetSizingPolicyDesc(ImGuiTableFlags sizing_policy)
{
Expand Down Expand Up @@ -3614,7 +3617,7 @@ void ImGui::DebugNodeTableSettings(ImGuiTableSettings* settings)
TreePop();
}

#else // #ifndef IMGUI_DISABLE_METRICS_WINDOW
#else // #ifndef IMGUI_DISABLE_DEBUG_TOOLS

void ImGui::DebugNodeTable(ImGuiTable*) {}
void ImGui::DebugNodeTableSettings(ImGuiTableSettings*) {}
Expand Down
Loading