From 3478f661b6ce4c735908bc66e5d50660d454ce78 Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Wed, 28 Jun 2023 15:07:16 -0500 Subject: [PATCH 01/34] Correction to Reporting Problem The code was skipping partitions for updating the outside face flux in the heat balance because there is no outside face--the surface is adiatic. However, the code to skip that forgot that interzone partitions do need to figure this out. This was noticed by a user and the code before the fix resulted in output that made it look like the surface was accumulating energy gain/loss for interzone surfaces over an annual simulation eventhough this value should be relatively small. With the fix, the outside face flux is now no longer zero all the time and the summation of heat storage in the surface is more appropriate as well. --- src/EnergyPlus/HeatBalanceSurfaceManager.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index 124d72bb845..036abfff4ea 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.cc +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.cc @@ -5175,7 +5175,9 @@ void UpdateThermalHistories(EnergyPlusData &state) state.dataHeatBalFanSys->CTFTuserConstPart(SurfNum); } - if (surface.ExtBoundCond > 0) continue; // Don't need to evaluate outside for partitions + // Don't need to evaluate outside for partitions (so continue), + // but do need to do remaining calculations for interzone partitions. + if (surface.ExtBoundCond > 0 && surface.ExtBoundCond == SurfNum) continue; // Set current outside flux: if (construct.SourceSinkPresent) { From 6512859730624770960fc92f1d39408188690f06 Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Thu, 29 Jun 2023 08:10:30 -0500 Subject: [PATCH 02/34] Outside Face Variable Unit Test and Docs Unit test added for the outside face flux reporting problem for interzone partition. Also modified the documentation slightly in the IO Ref to clarify what happens when there are partitions and interzone partitions. --- ...roup-thermal-zone-description-geometry.tex | 6 +- .../unit/HeatBalanceSurfaceManager.unit.cc | 75 +++++++++++++++++++ 2 files changed, 79 insertions(+), 2 deletions(-) diff --git a/doc/input-output-reference/src/overview/group-thermal-zone-description-geometry.tex b/doc/input-output-reference/src/overview/group-thermal-zone-description-geometry.tex index 9dd0fac5a84..4a489d1989f 100644 --- a/doc/input-output-reference/src/overview/group-thermal-zone-description-geometry.tex +++ b/doc/input-output-reference/src/overview/group-thermal-zone-description-geometry.tex @@ -3331,7 +3331,7 @@ \subsubsection{Surface Inside Face Conduction Heat Loss Rate {[}W{]}}\label{surf These ``inside face conduction'' output variables describe heat flow by conduction right at the inside face of an opaque heat transfer surface. A positive value means that the conduction is from just inside the inside face toward the inside face. A negative value means that the conduction is from the inside face into the core of the heat transfer surface. -Note that Inside Face Conduction, when positive, does \textbf{not} indicate the heat flow from the surface to the zone air, which is governed by the inside face convection coefficient and the difference in temperature between the inside face and the zone air. +Note that Inside Face Conduction, when positive, does \textbf{not} necessarily indicate the heat flow from the surface to the zone air, which is governed by the inside face convection coefficient, the difference in temperature between the inside face and the zone air, and various radiation terms due to solar, internal gains, and radiant exchange with other surfaces in the zone. Different versions of the reports are available. The basic heat gain rate (W) and a per unit area flux (W/m\(^{2}\)) can have positive or negative values with the sign convention that positive indicates heat flowing toward the face itself. There are also directed ``gain'' and ``loss'' versions that have only positive values or zero when the heat flow direction opposes. @@ -3349,7 +3349,9 @@ \subsubsection{Surface Outside Face Conduction Heat Loss Rate {[}W{]}}\label{sur These ``outside face conduction'' output variables describe heat flow by conduction right at the outside face of an opaque heat transfer surface. A positive value means that the conduction is from just inside the outside face toward the outside face. A negative value means that the conduction is from the outside face into the core of the heat transfer surface. -Note that outside face conduction, when positive, does \textbf{not} indicate the heat flow from the surface to the surrounding air, which is governed by the outside face convection coefficient and the difference in temperature between the inside face and the surrounding air. +Note that outside face conduction, when positive, does \textbf{not} necessarily indicate the heat flow from the surface to the surrounding air, due to the fact that there could be various terms such as convection and/or radiation terms based on whatever is the ''outside'' environment for this surface. + +When the surface in question is a partition, the output for this variable is set to zero because there is no outside face because the surface is fully exposed to the zone. When the surface is an interzone partition, the value will be non-zero because there will potentially be conduction into or out of the zone on the other side at this surface. Different versions of the reports are available. The basic heat transfer rate (W) and a per unit area flux (W/m\(^{2}\)) can have positive or negative values with the sign convention that positive indicates heat flowing toward the face itself. There are also directed ``gain'' and ``loss'' versions that have only positive values or zero when the heat flow direction opposes. diff --git a/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc index 9927ca044c2..4fee8a5a93f 100644 --- a/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc @@ -8552,4 +8552,79 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestUpdateVariableAbsorptanc EXPECT_NEAR(state->dataHeatBalSurf->SurfAbsSolarExt(2), 0.5, 1e-6); } +TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_UpdateThermalHistoriesIZSurfaceCheck) +{ + state->dataSurface->TotSurfaces = 2; + state->dataGlobal->NumOfZones = 2; + state->dataHeatBal->TotConstructs = 1; + state->dataHeatBal->Zone.allocate(state->dataGlobal->NumOfZones); + state->dataSurface->Surface.allocate(state->dataSurface->TotSurfaces); + state->dataSurface->SurfaceWindow.allocate(state->dataSurface->TotSurfaces); + state->dataConstruction->Construct.allocate(state->dataHeatBal->TotConstructs); + state->dataHeatBal->AnyInternalHeatSourceInInput = false; + state->dataHeatBal->SimpleCTFOnly = false; + + AllocateSurfaceHeatBalArrays(*state); // allocates a host of variables related to CTF calculations + + state->dataSurface->Surface(1).Class = DataSurfaces::SurfaceClass::Wall; + state->dataSurface->Surface(1).HeatTransSurf = true; + state->dataSurface->Surface(1).HeatTransferAlgorithm = DataSurfaces::HeatTransferModel::CTF; + state->dataSurface->Surface(1).Construction = 1; + state->dataSurface->Surface(2).Class = DataSurfaces::SurfaceClass::Wall; + state->dataSurface->Surface(2).HeatTransSurf = true; + state->dataSurface->Surface(2).HeatTransferAlgorithm = DataSurfaces::HeatTransferModel::CTF; + state->dataSurface->Surface(2).Construction = 1; + state->dataHeatBal->space.allocate(2); + state->dataHeatBal->Zone(1).spaceIndexes.emplace_back(1); + state->dataHeatBal->space(1).OpaqOrIntMassSurfaceFirst = 1; + state->dataHeatBal->space(1).OpaqOrIntMassSurfaceLast = 1; + state->dataHeatBal->space(1).HTSurfaceFirst = 1; + state->dataHeatBal->space(1).HTSurfaceLast = 1; + state->dataHeatBal->Zone(2).spaceIndexes.emplace_back(2); + state->dataHeatBal->space(2).OpaqOrIntMassSurfaceFirst = 2; + state->dataHeatBal->space(2).OpaqOrIntMassSurfaceLast = 2; + state->dataHeatBal->space(2).HTSurfaceFirst = 2; + state->dataHeatBal->space(2).HTSurfaceLast = 2; + + state->dataConstruction->Construct(1).NumCTFTerms = 2; + state->dataConstruction->Construct(1).SourceSinkPresent = false; + state->dataConstruction->Construct(1).NumHistories = 1; + state->dataConstruction->Construct(1).CTFOutside[0] = 1.5; + state->dataConstruction->Construct(1).CTFCross[0] = 1.5; + state->dataConstruction->Construct(1).CTFInside[0] = 1.5; + + state->dataHeatBalSurf->SurfCurrNumHist(1) = 0; + state->dataHeatBalSurf->SurfOutsideTempHist(1)(1) = 20.0; + state->dataHeatBalSurf->SurfTempIn(1) = 10.0; + state->dataHeatBalSurf->SurfCTFConstInPart(1) = 0.0; + state->dataHeatBalSurf->SurfCurrNumHist(2) = 0; + state->dataHeatBalSurf->SurfOutsideTempHist(1)(2) = 10.0; + state->dataHeatBalSurf->SurfTempIn(2) = 20.0; + state->dataHeatBalSurf->SurfCTFConstInPart(2) = 0.0; + + // Test 1: Partition--outside should still be zero + state->dataSurface->Surface(1).ExtBoundCond = 1; + state->dataSurface->Surface(2).ExtBoundCond = 2; + + UpdateThermalHistories(*state); // Test to make sure that the outside surface flux is being set properly for interzone surfaces + + EXPECT_EQ(15.0, state->dataHeatBalSurf->SurfOpaqInsFaceCondFlux(1)); + EXPECT_EQ(0.0, state->dataHeatBalSurf->SurfOpaqOutFaceCondFlux(1)); + EXPECT_EQ(-15.0, state->dataHeatBalSurf->SurfOpaqInsFaceCondFlux(2)); + EXPECT_EQ(0.0, state->dataHeatBalSurf->SurfOpaqOutFaceCondFlux(2)); + + // Test 2: Interzone Partition--outside should have a non-zero value + state->dataSurface->Surface(1).ExtBoundCond = 2; + state->dataSurface->Surface(2).ExtBoundCond = 1; + state->dataHeatBalSurf->SurfOpaqInsFaceCondFlux = 0.0; + state->dataHeatBalSurf->SurfOpaqOutFaceCondFlux = 0.0; + + UpdateThermalHistories(*state); // Test to make sure that the outside surface flux is being set properly for interzone surfaces + + EXPECT_EQ(15.0, state->dataHeatBalSurf->SurfOpaqInsFaceCondFlux(1)); + EXPECT_EQ(-15.0, state->dataHeatBalSurf->SurfOpaqOutFaceCondFlux(1)); + EXPECT_EQ(-15.0, state->dataHeatBalSurf->SurfOpaqInsFaceCondFlux(2)); + EXPECT_EQ(15.0, state->dataHeatBalSurf->SurfOpaqOutFaceCondFlux(2)); +} + } // namespace EnergyPlus From 2e167dd02bc6cb68166ab4a1f74b767767e1ecab Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Tue, 8 Aug 2023 14:40:03 -0500 Subject: [PATCH 03/34] Address 10089 Review Comments Followed @energyarchmage suggestion and got rid of the if->continue. Changed unit test since the result in it was modified. --- src/EnergyPlus/HeatBalanceSurfaceManager.cc | 4 --- .../unit/HeatBalanceSurfaceManager.unit.cc | 28 +++++++++---------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index 564ba448904..a11a54d62be 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.cc +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.cc @@ -5176,10 +5176,6 @@ void UpdateThermalHistories(EnergyPlusData &state) state.dataHeatBalFanSys->CTFTuserConstPart(SurfNum); } - // Don't need to evaluate outside for partitions (so continue), - // but do need to do remaining calculations for interzone partitions. - if (surface.ExtBoundCond > 0 && surface.ExtBoundCond == SurfNum) continue; - // Set current outside flux: if (construct.SourceSinkPresent) { state.dataHeatBalSurf->SurfOutsideFluxHist(1)(SurfNum) = diff --git a/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc index 67cd382aa35..6cf0e6baefc 100644 --- a/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc @@ -8564,9 +8564,9 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_UpdateThermalHistoriesIZSurf state->dataConstruction->Construct.allocate(state->dataHeatBal->TotConstructs); state->dataHeatBal->AnyInternalHeatSourceInInput = false; state->dataHeatBal->SimpleCTFOnly = false; - + AllocateSurfaceHeatBalArrays(*state); // allocates a host of variables related to CTF calculations - + state->dataSurface->Surface(1).Class = DataSurfaces::SurfaceClass::Wall; state->dataSurface->Surface(1).HeatTransSurf = true; state->dataSurface->Surface(1).HeatTransferAlgorithm = DataSurfaces::HeatTransferModel::CTF; @@ -8586,14 +8586,14 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_UpdateThermalHistoriesIZSurf state->dataHeatBal->space(2).OpaqOrIntMassSurfaceLast = 2; state->dataHeatBal->space(2).HTSurfaceFirst = 2; state->dataHeatBal->space(2).HTSurfaceLast = 2; - + state->dataConstruction->Construct(1).NumCTFTerms = 2; state->dataConstruction->Construct(1).SourceSinkPresent = false; state->dataConstruction->Construct(1).NumHistories = 1; state->dataConstruction->Construct(1).CTFOutside[0] = 1.5; state->dataConstruction->Construct(1).CTFCross[0] = 1.5; state->dataConstruction->Construct(1).CTFInside[0] = 1.5; - + state->dataHeatBalSurf->SurfCurrNumHist(1) = 0; state->dataHeatBalSurf->SurfOutsideTempHist(1)(1) = 20.0; state->dataHeatBalSurf->SurfTempIn(1) = 10.0; @@ -8602,32 +8602,32 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_UpdateThermalHistoriesIZSurf state->dataHeatBalSurf->SurfOutsideTempHist(1)(2) = 10.0; state->dataHeatBalSurf->SurfTempIn(2) = 20.0; state->dataHeatBalSurf->SurfCTFConstInPart(2) = 0.0; - - // Test 1: Partition--outside should still be zero + + // Test 1: Partition--outside should have a non-zero value (interzone and regular partitions treated the same) state->dataSurface->Surface(1).ExtBoundCond = 1; state->dataSurface->Surface(2).ExtBoundCond = 2; - + UpdateThermalHistories(*state); // Test to make sure that the outside surface flux is being set properly for interzone surfaces - + EXPECT_EQ(15.0, state->dataHeatBalSurf->SurfOpaqInsFaceCondFlux(1)); - EXPECT_EQ(0.0, state->dataHeatBalSurf->SurfOpaqOutFaceCondFlux(1)); + EXPECT_EQ(-15.0, state->dataHeatBalSurf->SurfOpaqOutFaceCondFlux(1)); EXPECT_EQ(-15.0, state->dataHeatBalSurf->SurfOpaqInsFaceCondFlux(2)); - EXPECT_EQ(0.0, state->dataHeatBalSurf->SurfOpaqOutFaceCondFlux(2)); - + EXPECT_EQ(15.0, state->dataHeatBalSurf->SurfOpaqOutFaceCondFlux(2)); + // Test 2: Interzone Partition--outside should have a non-zero value state->dataSurface->Surface(1).ExtBoundCond = 2; state->dataSurface->Surface(2).ExtBoundCond = 1; state->dataHeatBalSurf->SurfOpaqInsFaceCondFlux = 0.0; state->dataHeatBalSurf->SurfOpaqOutFaceCondFlux = 0.0; - + UpdateThermalHistories(*state); // Test to make sure that the outside surface flux is being set properly for interzone surfaces - + EXPECT_EQ(15.0, state->dataHeatBalSurf->SurfOpaqInsFaceCondFlux(1)); EXPECT_EQ(-15.0, state->dataHeatBalSurf->SurfOpaqOutFaceCondFlux(1)); EXPECT_EQ(-15.0, state->dataHeatBalSurf->SurfOpaqInsFaceCondFlux(2)); EXPECT_EQ(15.0, state->dataHeatBalSurf->SurfOpaqOutFaceCondFlux(2)); } - + TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_SurroundingSurfacesTempTest) { std::string_view constexpr idf_objects = R"IDF( From 6bd505dd9739317b8b2d8461d2e550d997085bd4 Mon Sep 17 00:00:00 2001 From: Mark Lemay Date: Wed, 23 Aug 2023 12:16:21 -0400 Subject: [PATCH 04/34] escape objectName for xml --- src/EnergyPlus/OutputReportTabular.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 78798f7a909..cfd7b32dc93 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -16640,7 +16640,7 @@ void WriteReportHeaders(EnergyPlusData &state, tbl_stream << "prevReportName << ">\n"; // close the last element if it was used. } tbl_stream << "<" << ConvertToElementTag(modifiedReportName) << ">\n"; - tbl_stream << " " << objectName << "\n"; + tbl_stream << " " << ConvertToEscaped(objectName) << "\n"; ort->prevReportName = ConvertToElementTag(modifiedReportName); // save the name for next time } } From 8e446f4ce5683fc46e976bd744249feb3fc68553 Mon Sep 17 00:00:00 2001 From: Mark Lemay Date: Thu, 24 Aug 2023 15:07:26 -0400 Subject: [PATCH 05/34] also escape the building name BuildingName --- src/EnergyPlus/OutputReportTabular.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 49205bf50d5..34363e4136b 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -3138,7 +3138,7 @@ void OpenOutputTabularFile(EnergyPlusData &state) open_tbl_stream(state, iStyle, state.dataStrGlobals->outputTblXmlFilePath, state.files.outputControl.tabular); tbl_stream << "\n"; tbl_stream << "\n"; - tbl_stream << " BuildingName>" << state.dataHeatBal->BuildingName << "BuildingName>\n"; + tbl_stream << " BuildingName>" << ConvertToEscaped(state.dataHeatBal->BuildingName) << "BuildingName>\n"; tbl_stream << " " << state.dataEnvrn->EnvironmentName << "\n"; tbl_stream << " " << state.dataEnvrn->WeatherFileLocationTitle << "\n"; tbl_stream << " " << state.dataStrGlobals->VerStringVar << "\n"; From 68995abb02622d331c4c567ebaad92503010f84c Mon Sep 17 00:00:00 2001 From: Jason Glazer Date: Tue, 29 Aug 2023 14:27:10 -0500 Subject: [PATCH 06/34] Fix to 9241 related to accumulation of values to leap day --- src/EnergyPlus/WeatherManager.cc | 3 ++- src/EnergyPlus/WeatherManager.hh | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/EnergyPlus/WeatherManager.cc b/src/EnergyPlus/WeatherManager.cc index 4051c7ce412..8958e7aba36 100644 --- a/src/EnergyPlus/WeatherManager.cc +++ b/src/EnergyPlus/WeatherManager.cc @@ -854,6 +854,7 @@ namespace WeatherManager { } if (state.dataEnvrn->CurrentYearIsLeapYear) { ActEndDayOfMonth(2) = state.dataWeatherManager->EndDayOfMonth(2) + state.dataWeatherManager->LeapYearAdd; + state.dataWeatherManager->EndDayOfMonthWithLeapDay(2) = state.dataWeatherManager->EndDayOfMonth(2) + state.dataWeatherManager->LeapYearAdd; } state.dataWeatherManager->UseDaylightSaving = state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).UseDST; state.dataWeatherManager->UseSpecialDays = state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).UseHolidays; @@ -1894,7 +1895,7 @@ namespace WeatherManager { } state.dataEnvrn->EndYearFlag = false; - if (state.dataEnvrn->DayOfMonth == state.dataWeatherManager->EndDayOfMonth(state.dataEnvrn->Month)) { + if (state.dataEnvrn->DayOfMonth == state.dataWeatherManager->EndDayOfMonthWithLeapDay(state.dataEnvrn->Month)) { state.dataEnvrn->EndMonthFlag = true; state.dataEnvrn->EndYearFlag = (state.dataEnvrn->Month == 12); } diff --git a/src/EnergyPlus/WeatherManager.hh b/src/EnergyPlus/WeatherManager.hh index 21560b0c3b4..1bb34dd429d 100644 --- a/src/EnergyPlus/WeatherManager.hh +++ b/src/EnergyPlus/WeatherManager.hh @@ -974,6 +974,7 @@ struct WeatherManagerData : BaseGlobalStruct Array1D Interpolation; // Interpolation values based on Number of Time Steps in Hour NOLINT(cert-err58-cpp) Array1D SolarInterpolation; // Solar Interpolation values based on Number of Time Steps in Hour NOLINT(cert-err58-cpp) Array1D_int EndDayOfMonth; // NOLINT(cert-err58-cpp) + Array1D_int EndDayOfMonthWithLeapDay; // end day of the month including Feb 29 for leap years instead of Feb 28 int LeapYearAdd; // Set during environment if leap year is active (adds 1 to number days in Feb) bool DatesShouldBeReset; // True when weekdays should be reset bool StartDatesCycleShouldBeReset; // True when start dates on repeat should be reset @@ -1284,6 +1285,7 @@ struct WeatherManagerData : BaseGlobalStruct DaylightSavingIsActive(false), WFAllowsLeapYears(false), curSimDayForEndOfRunPeriod(0), Envrn(0), NumOfEnvrn(0), NumEPWTypExtSets(0), NumWPSkyTemperatures(0), RptIsRain(0), RptIsSnow(0), RptDayType(0), HrAngle(0.0), SolarAltitudeAngle(0.0), SolarAzimuthAngle(0.0), HorizIRSky(0.0), TimeStepFraction(0.0), NumSPSiteScheduleNamePtrs(0), EndDayOfMonth(12, {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}), + EndDayOfMonthWithLeapDay(12, {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}), LeapYearAdd(0), DatesShouldBeReset(false), StartDatesCycleShouldBeReset(false), Jan1DatesShouldBeReset(false), RPReadAllWeatherData(false) { } From 9a487bda36c7bc13d63c7aedccccdf6dc2857b08 Mon Sep 17 00:00:00 2001 From: Jason Glazer Date: Tue, 29 Aug 2023 15:28:39 -0500 Subject: [PATCH 07/34] Remove other temporary arrays that adjusted for the end of the month related to leap year --- src/EnergyPlus/WeatherManager.cc | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/EnergyPlus/WeatherManager.cc b/src/EnergyPlus/WeatherManager.cc index 8958e7aba36..650f79fed2f 100644 --- a/src/EnergyPlus/WeatherManager.cc +++ b/src/EnergyPlus/WeatherManager.cc @@ -844,8 +844,6 @@ namespace WeatherManager { (state.dataGlobal->KindOfSim == Constant::KindOfSim::RunPeriodDesign)) { std::string kindOfRunPeriod = state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).cKindOfEnvrn; state.dataEnvrn->RunPeriodEnvironment = state.dataGlobal->KindOfSim == Constant::KindOfSim::RunPeriodWeather; - Array1D_int ActEndDayOfMonth(12); - ActEndDayOfMonth = state.dataWeatherManager->EndDayOfMonth; state.dataEnvrn->CurrentYearIsLeapYear = state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).IsLeapYear; if (state.dataEnvrn->CurrentYearIsLeapYear && state.dataWeatherManager->WFAllowsLeapYears) { state.dataWeatherManager->LeapYearAdd = 1; @@ -853,7 +851,6 @@ namespace WeatherManager { state.dataWeatherManager->LeapYearAdd = 0; } if (state.dataEnvrn->CurrentYearIsLeapYear) { - ActEndDayOfMonth(2) = state.dataWeatherManager->EndDayOfMonth(2) + state.dataWeatherManager->LeapYearAdd; state.dataWeatherManager->EndDayOfMonthWithLeapDay(2) = state.dataWeatherManager->EndDayOfMonth(2) + state.dataWeatherManager->LeapYearAdd; } state.dataWeatherManager->UseDaylightSaving = state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).UseDST; @@ -1579,11 +1576,8 @@ namespace WeatherManager { int ActStartDay; // Actual Start Day of Month int ActEndMonth; // Actual End Month int ActEndDay; // Actual End Day of Month - Array1D_int ActEndDayOfMonth(12); bool ErrorsFound = false; - ActEndDayOfMonth = state.dataWeatherManager->EndDayOfMonth; - ActEndDayOfMonth(2) = state.dataWeatherManager->EndDayOfMonth(2) + state.dataWeatherManager->LeapYearAdd; if (state.dataWeatherManager->DST.StDateType == DateType::MonthDay) { ActStartMonth = state.dataWeatherManager->DST.StMon; ActStartDay = state.dataWeatherManager->DST.StDay; @@ -1593,7 +1587,7 @@ namespace WeatherManager { ThisDay += 7; } ThisDay += 7 * (state.dataWeatherManager->DST.StDay - 1); - if (ThisDay > ActEndDayOfMonth(state.dataWeatherManager->DST.StMon)) { + if (ThisDay > state.dataWeatherManager->EndDayOfMonthWithLeapDay(state.dataWeatherManager->DST.StMon)) { ShowSevereError(state, format("{}Determining DST: DST Start Date, Nth Day of Month, not enough Nths", RoutineName)); ErrorsFound = true; } else { @@ -1602,7 +1596,7 @@ namespace WeatherManager { } } else { // LastWeekDayInMonth int ThisDay = state.dataWeatherManager->DST.StWeekDay - MonWeekDay(state.dataWeatherManager->DST.StMon) + 1; - while (ThisDay + 7 <= ActEndDayOfMonth(state.dataWeatherManager->DST.StMon)) { + while (ThisDay + 7 <= state.dataWeatherManager->EndDayOfMonthWithLeapDay(state.dataWeatherManager->DST.StMon)) { ThisDay += 7; } ActStartMonth = state.dataWeatherManager->DST.StMon; @@ -1618,7 +1612,7 @@ namespace WeatherManager { ThisDay += 7; } ThisDay += 7 * (state.dataWeatherManager->DST.EnDay - 1); - if (ThisDay > ActEndDayOfMonth(state.dataWeatherManager->DST.EnMon)) { + if (ThisDay >> state.dataWeatherManager->EndDayOfMonthWithLeapDay(state.dataWeatherManager->DST.EnMon)) { ActEndMonth = 0; // Suppress uninitialized warning ActEndDay = 0; // Suppress uninitialized warning ShowSevereError(state, format("{}Determining DST: DST End Date, Nth Day of Month, not enough Nths", RoutineName)); @@ -1629,7 +1623,7 @@ namespace WeatherManager { } } else { // LastWeekDayInMonth int ThisDay = state.dataWeatherManager->DST.EnWeekDay - MonWeekDay(state.dataWeatherManager->DST.EnMon) + 1; - while (ThisDay + 7 <= ActEndDayOfMonth(state.dataWeatherManager->DST.EnMon)) { + while (ThisDay + 7 <= state.dataWeatherManager->EndDayOfMonthWithLeapDay(state.dataWeatherManager->DST.EnMon)) { ThisDay += 7; } ActEndMonth = state.dataWeatherManager->DST.EnMon; @@ -1675,11 +1669,8 @@ namespace WeatherManager { static constexpr std::string_view RoutineName("SetSpecialDayDates: "); int JDay; - Array1D_int ActEndDayOfMonth(12); bool ErrorsFound = false; - ActEndDayOfMonth = state.dataWeatherManager->EndDayOfMonth; - ActEndDayOfMonth(2) = state.dataWeatherManager->EndDayOfMonth(2) + state.dataWeatherManager->LeapYearAdd; state.dataWeatherManager->SpecialDayTypes = 0; for (int i = 1; i <= state.dataWeatherManager->NumSpecialDays; ++i) { if (state.dataWeatherManager->SpecialDays(i).WthrFile && !state.dataWeatherManager->UseSpecialDays) continue; @@ -1710,7 +1701,7 @@ namespace WeatherManager { ThisDay += 7; } ThisDay += 7 * (state.dataWeatherManager->SpecialDays(i).Day - 1); - if (ThisDay > ActEndDayOfMonth(state.dataWeatherManager->SpecialDays(i).Month)) { + if (ThisDay > state.dataWeatherManager->EndDayOfMonthWithLeapDay(state.dataWeatherManager->SpecialDays(i).Month)) { ShowSevereError(state, format("{}Special Day Date, Nth Day of Month, not enough Nths, for SpecialDay={}", RoutineName, @@ -1723,7 +1714,7 @@ namespace WeatherManager { JDay = General::OrdinalDay(state.dataWeatherManager->SpecialDays(i).Month, ThisDay, state.dataWeatherManager->LeapYearAdd); } else { // LastWeekDayInMonth int ThisDay = state.dataWeatherManager->SpecialDays(i).WeekDay - MonWeekDay(state.dataWeatherManager->SpecialDays(i).Month) + 1; - while (ThisDay + 7 <= ActEndDayOfMonth(state.dataWeatherManager->SpecialDays(i).Month)) { + while (ThisDay + 7 <= state.dataWeatherManager->EndDayOfMonthWithLeapDay(state.dataWeatherManager->SpecialDays(i).Month)) { ThisDay += 7; } state.dataWeatherManager->SpecialDays(i).ActStMon = state.dataWeatherManager->SpecialDays(i).Month; @@ -2936,6 +2927,7 @@ namespace WeatherManager { if (hour == 1 && CurTimeStep == 1) { if (WMonth == 2 && WDay == 29 && (!state.dataEnvrn->CurrentYearIsLeapYear || !state.dataWeatherManager->WFAllowsLeapYears)) { state.dataWeatherManager->EndDayOfMonth(2) = 28; + state.dataWeatherManager->EndDayOfMonthWithLeapDay(2) = 28; SkipThisDay = true; TryAgain = true; ShowWarningError(state, "ReadEPlusWeatherForDay: Feb29 data encountered but will not be processed."); From 98d23e047bb92a555b7a5ec163fb9e3ccd13ccdf Mon Sep 17 00:00:00 2001 From: Jason Glazer Date: Tue, 29 Aug 2023 16:23:14 -0500 Subject: [PATCH 08/34] Fix SQL reporting portion of issue. Fix calls to createSQLTimeIndexRecord --- src/EnergyPlus/OutputProcessor.cc | 8 ++- src/EnergyPlus/SQLiteProcedures.cc | 6 ++- src/EnergyPlus/SQLiteProcedures.hh | 1 + tst/EnergyPlus/unit/OutputProcessor.unit.cc | 16 +++--- tst/EnergyPlus/unit/SQLite.unit.cc | 54 ++++++++++----------- 5 files changed, 48 insertions(+), 37 deletions(-) diff --git a/src/EnergyPlus/OutputProcessor.cc b/src/EnergyPlus/OutputProcessor.cc index 1c5fb2b04ea..94833c5a869 100644 --- a/src/EnergyPlus/OutputProcessor.cc +++ b/src/EnergyPlus/OutputProcessor.cc @@ -3219,6 +3219,7 @@ namespace OutputProcessor { state.dataGlobal->DayOfSim, state.dataEnvrn->CurEnvirNum, state.dataGlobal->CalendarYear, + state.dataEnvrn->CurrentYearIsLeapYear, Month, DayOfMonth, Hour, @@ -3247,6 +3248,7 @@ namespace OutputProcessor { state.dataGlobal->DayOfSim, state.dataEnvrn->CurEnvirNum, state.dataGlobal->CalendarYear, + state.dataEnvrn->CurrentYearIsLeapYear, Month, DayOfMonth, Hour, @@ -3272,6 +3274,7 @@ namespace OutputProcessor { state.dataGlobal->DayOfSim, state.dataEnvrn->CurEnvirNum, state.dataGlobal->CalendarYear, + state.dataEnvrn->CurrentYearIsLeapYear, Month, DayOfMonth, _, @@ -3290,6 +3293,7 @@ namespace OutputProcessor { state.dataGlobal->DayOfSim, state.dataEnvrn->CurEnvirNum, state.dataGlobal->CalendarYear, + state.dataEnvrn->CurrentYearIsLeapYear, Month); } break; @@ -3300,7 +3304,9 @@ namespace OutputProcessor { reportID, state.dataGlobal->DayOfSim, state.dataEnvrn->CurEnvirNum, - state.dataGlobal->CalendarYear); + state.dataGlobal->CalendarYear, + state.dataEnvrn->CurrentYearIsLeapYear + ); } break; default: diff --git a/src/EnergyPlus/SQLiteProcedures.cc b/src/EnergyPlus/SQLiteProcedures.cc index 01f9b3872d4..a53b7adc395 100644 --- a/src/EnergyPlus/SQLiteProcedures.cc +++ b/src/EnergyPlus/SQLiteProcedures.cc @@ -1602,6 +1602,7 @@ void SQLite::createSQLiteTimeIndexRecord(int const reportingInterval, int const cumlativeSimulationDays, int const curEnvirNum, int const simulationYear, + bool const curYearIsLeapYear, ObjexxFCL::Optional_int_const month, ObjexxFCL::Optional_int_const dayOfMonth, ObjexxFCL::Optional_int_const hour, @@ -1615,7 +1616,10 @@ void SQLite::createSQLiteTimeIndexRecord(int const reportingInterval, int intStartMinute = 0; int intervalInMinutes = 60; - static const std::vector lastDayOfMonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + static std::vector lastDayOfMonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + if (curYearIsLeapYear) { + lastDayOfMonth[2] = 29; + } switch (reportingInterval) { case LocalReportEach: diff --git a/src/EnergyPlus/SQLiteProcedures.hh b/src/EnergyPlus/SQLiteProcedures.hh index 956a83827a6..31218178c22 100644 --- a/src/EnergyPlus/SQLiteProcedures.hh +++ b/src/EnergyPlus/SQLiteProcedures.hh @@ -194,6 +194,7 @@ public: int const CumlativeSimulationDays, int const curEnvirNum, int const simulationYear, + bool const curYearIsLeapYear, ObjexxFCL::Optional_int_const Month = _, ObjexxFCL::Optional_int_const DayOfMonth = _, ObjexxFCL::Optional_int_const Hour = _, diff --git a/tst/EnergyPlus/unit/OutputProcessor.unit.cc b/tst/EnergyPlus/unit/OutputProcessor.unit.cc index fd2fc95fe16..0d9f97e7e20 100644 --- a/tst/EnergyPlus/unit/OutputProcessor.unit.cc +++ b/tst/EnergyPlus/unit/OutputProcessor.unit.cc @@ -775,7 +775,7 @@ namespace OutputProcessor { { state->dataGlobal->MinutesPerTimeStep = 10; - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017, false); state->dataSQLiteProcedures->sqlite->createSQLiteReportDictionaryRecord( 1, 1, "Zone", "Environment", "Site Outdoor Air Drybulb Temperature", 1, "C", 1, false); @@ -868,7 +868,7 @@ namespace OutputProcessor { TEST_F(SQLiteFixture, OutputProcessor_writeReportRealData) { - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017, false); state->dataSQLiteProcedures->sqlite->createSQLiteReportDictionaryRecord( 1, 1, "Zone", "Environment", "Site Outdoor Air Drybulb Temperature", 1, "C", 1, false); @@ -1032,7 +1032,7 @@ namespace OutputProcessor { TEST_F(SQLiteFixture, OutputProcessor_writeReportIntegerData) { - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017, false); state->dataSQLiteProcedures->sqlite->createSQLiteReportDictionaryRecord( 1, 1, "Zone", "Environment", "Site Outdoor Air Drybulb Temperature", 1, "C", 1, false); @@ -1117,7 +1117,7 @@ namespace OutputProcessor { TEST_F(SQLiteFixture, OutputProcessor_writeNumericData_1) { - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017, false); state->dataSQLiteProcedures->sqlite->createSQLiteReportDictionaryRecord( 1, 1, "Zone", "Environment", "Site Outdoor Air Drybulb Temperature", 1, "C", 1, false); @@ -1392,7 +1392,7 @@ namespace OutputProcessor { { InitializeOutput(*state); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017, false); WriteMeterDictionaryItem(*state, ReportingFrequency::TimeStep, @@ -1826,7 +1826,7 @@ namespace OutputProcessor { { InitializeOutput(*state); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017, false); // Store expected results std::vector> expectedReportDataDictionary; @@ -2383,7 +2383,7 @@ namespace OutputProcessor { TEST_F(SQLiteFixture, OutputProcessor_writeCumulativeReportMeterData) { - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017, false); state->dataSQLiteProcedures->sqlite->createSQLiteReportDictionaryRecord( 1, 1, "Zone", "Environment", "Site Outdoor Air Drybulb Temperature", 1, "C", 1, false); @@ -2419,7 +2419,7 @@ namespace OutputProcessor { TEST_F(SQLiteFixture, OutputProcessor_writeNumericData_2) { - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017, false); state->dataSQLiteProcedures->sqlite->createSQLiteReportDictionaryRecord( 1, 1, "Zone", "Environment", "Site Outdoor Air Drybulb Temperature", 1, "C", 1, false); diff --git a/tst/EnergyPlus/unit/SQLite.unit.cc b/tst/EnergyPlus/unit/SQLite.unit.cc index cd0bbaf6982..aec4886b273 100644 --- a/tst/EnergyPlus/unit/SQLite.unit.cc +++ b/tst/EnergyPlus/unit/SQLite.unit.cc @@ -293,13 +293,13 @@ TEST_F(SQLiteFixture, SQLiteProcedures_createSQLiteReportDictionaryRecord) TEST_F(SQLiteFixture, SQLiteProcedures_createSQLiteTimeIndexRecord) { state->dataSQLiteProcedures->sqlite->sqliteBegin(); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(3, 1, 1, 0, 2017, 1); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(2, 1, 1, 0, 2017, 1, 1, 1, _, _, 0, "WinterDesignDay"); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(1, 1, 1, 0, 2017, 1, 2, 2, _, _, 0, "SummerDesignDay"); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(0, 1, 1, 0, 2017, 1, 1, 1, 60, 0, 0, "WinterDesignDay"); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(-1, 1, 1, 0, 2017, 1, 2, 2, 60, 0, 0, "SummerDesignDay"); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(-1, 1, 1, 1, 2017, 1, 3, 3, 60, 0, 0, "SummerDesignDay", true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017, false); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(3, 1, 1, 0, 2017, false, 1); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(2, 1, 1, 0, 2017, false, 1, 1, 1, _, _, 0, "WinterDesignDay"); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(1, 1, 1, 0, 2017, false, 1, 2, 2, _, _, 0, "SummerDesignDay"); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(0, 1, 1, 0, 2017, false, 1, 1, 1, 60, 0, 0, "WinterDesignDay"); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(-1, 1, 1, 0, 2017, false, 1, 2, 2, 60, 0, 0, "SummerDesignDay"); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(-1, 1, 1, 1, 2017, false, 1, 3, 3, 60, 0, 0, "SummerDesignDay", true); auto result = queryResult("SELECT * FROM Time;", "Time"); state->dataSQLiteProcedures->sqlite->sqliteCommit(); @@ -321,7 +321,7 @@ TEST_F(SQLiteFixture, SQLiteProcedures_createSQLiteTimeIndexRecord) EXPECT_EQ(testResult6, result[6]); state->dataSQLiteProcedures->sqlite->sqliteBegin(); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(-999, 1, 1, 0, 2017); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(-999, 1, 1, 0, 2017, false); state->dataSQLiteProcedures->sqlite->sqliteCommit(); EXPECT_EQ("SQLite3 message, Illegal reportingInterval passed to CreateSQLiteTimeIndexRecord: -999\n", ss->str()); ss->str(std::string()); @@ -329,31 +329,31 @@ TEST_F(SQLiteFixture, SQLiteProcedures_createSQLiteTimeIndexRecord) EXPECT_EQ(7ul, result.size()); state->dataSQLiteProcedures->sqlite->sqliteBegin(); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(0, 1, 1, 1, 2017, 1, 3, 3, 60, 0, 0, _, true); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(0, 1, 1, 1, 2017, 1, 3, 3, 60, 0, _, "SummerDesignDay", true); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(0, 1, 1, 1, 2017, 1, 3, 3, 60, _, 0, "SummerDesignDay", true); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(0, 1, 1, 1, 2017, 1, 3, 3, _, 0, 0, "SummerDesignDay", true); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(0, 1, 1, 1, 2017, 1, 3, _, 60, 0, 0, "SummerDesignDay", true); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(0, 1, 1, 1, 2017, 1, _, 3, 60, 0, 0, "SummerDesignDay", true); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(0, 1, 1, 1, 2017, _, 3, 3, 60, 0, 0, "SummerDesignDay", true); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(1, 1, 1, 1, 2017, 1, 3, 3, 60, 0, 0, _, true); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(1, 1, 1, 1, 2017, 1, 3, 3, 60, 0, _, "SummerDesignDay", true); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(1, 1, 1, 1, 2017, 1, 3, _, 60, 0, 0, "SummerDesignDay", true); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(1, 1, 1, 1, 2017, 1, _, 3, 60, 0, 0, "SummerDesignDay", true); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(1, 1, 1, 1, 2017, _, 3, 3, 60, 0, 0, "SummerDesignDay", true); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(2, 1, 1, 1, 2017, 1, 3, 3, 60, 0, 0, _, true); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(2, 1, 1, 1, 2017, 1, 3, 3, 60, 0, _, "SummerDesignDay", true); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(2, 1, 1, 1, 2017, 1, 3, _, 60, 0, 0, "SummerDesignDay", true); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(2, 1, 1, 1, 2017, 1, _, 3, 60, 0, 0, "SummerDesignDay", true); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(2, 1, 1, 1, 2017, _, 3, 3, 60, 0, 0, "SummerDesignDay", true); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(3, 1, 1, 1, 2017, _, 3, 3, 60, 0, 0, "SummerDesignDay", true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(0, 1, 1, 1, 2017, false, 1, 3, 3, 60, 0, 0, _, true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(0, 1, 1, 1, 2017, false, 1, 3, 3, 60, 0, _, "SummerDesignDay", true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(0, 1, 1, 1, 2017, false, 1, 3, 3, 60, _, 0, "SummerDesignDay", true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(0, 1, 1, 1, 2017, false, 1, 3, 3, _, 0, 0, "SummerDesignDay", true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(0, 1, 1, 1, 2017, false, 1, 3, _, 60, 0, 0, "SummerDesignDay", true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(0, 1, 1, 1, 2017, false, 1, _, 3, 60, 0, 0, "SummerDesignDay", true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(0, 1, 1, 1, 2017, false, _, 3, 3, 60, 0, 0, "SummerDesignDay", true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(1, 1, 1, 1, 2017, false, 1, 3, 3, 60, 0, 0, _, true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(1, 1, 1, 1, 2017, false, 1, 3, 3, 60, 0, _, "SummerDesignDay", true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(1, 1, 1, 1, 2017, false, 1, 3, _, 60, 0, 0, "SummerDesignDay", true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(1, 1, 1, 1, 2017, false, 1, _, 3, 60, 0, 0, "SummerDesignDay", true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(1, 1, 1, 1, 2017, false, _, 3, 3, 60, 0, 0, "SummerDesignDay", true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(2, 1, 1, 1, 2017, false, 1, 3, 3, 60, 0, 0, _, true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(2, 1, 1, 1, 2017, false, 1, 3, 3, 60, 0, _, "SummerDesignDay", true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(2, 1, 1, 1, 2017, false, 1, 3, _, 60, 0, 0, "SummerDesignDay", true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(2, 1, 1, 1, 2017, false, 1, _, 3, 60, 0, 0, "SummerDesignDay", true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(2, 1, 1, 1, 2017, false, _, 3, 3, 60, 0, 0, "SummerDesignDay", true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(3, 1, 1, 1, 2017, false, _, 3, 3, 60, 0, 0, "SummerDesignDay", true); state->dataSQLiteProcedures->sqlite->sqliteCommit(); } TEST_F(SQLiteFixture, SQLiteProcedures_createSQLiteReportDataRecord) { state->dataSQLiteProcedures->sqlite->sqliteBegin(); - state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017, false); state->dataSQLiteProcedures->sqlite->createSQLiteReportDictionaryRecord( 1, 1, "Zone", "Environment", "Site Outdoor Air Drybulb Temperature", 1, "C", 1, false); state->dataSQLiteProcedures->sqlite->createSQLiteReportDataRecord(1, 999.9); From 4a6d80057af8d80c17149109a27f2d254672620c Mon Sep 17 00:00:00 2001 From: Jason Glazer Date: Wed, 30 Aug 2023 07:54:53 -0500 Subject: [PATCH 09/34] Fix the SQL bug right this time like C not fortran --- src/EnergyPlus/SQLiteProcedures.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/SQLiteProcedures.cc b/src/EnergyPlus/SQLiteProcedures.cc index a53b7adc395..20016536130 100644 --- a/src/EnergyPlus/SQLiteProcedures.cc +++ b/src/EnergyPlus/SQLiteProcedures.cc @@ -1618,7 +1618,7 @@ void SQLite::createSQLiteTimeIndexRecord(int const reportingInterval, static std::vector lastDayOfMonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; if (curYearIsLeapYear) { - lastDayOfMonth[2] = 29; + lastDayOfMonth[1] = 29; } switch (reportingInterval) { From a945fdafe52e814ee1816c820f25715fa87e7181 Mon Sep 17 00:00:00 2001 From: Jason Glazer Date: Wed, 30 Aug 2023 10:30:01 -0500 Subject: [PATCH 10/34] Fix some clang issue --- src/EnergyPlus/OutputProcessor.cc | 3 +-- src/EnergyPlus/WeatherManager.cc | 3 ++- src/EnergyPlus/WeatherManager.hh | 22 +++++++++++----------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/EnergyPlus/OutputProcessor.cc b/src/EnergyPlus/OutputProcessor.cc index 94833c5a869..b11cbaddef8 100644 --- a/src/EnergyPlus/OutputProcessor.cc +++ b/src/EnergyPlus/OutputProcessor.cc @@ -3305,8 +3305,7 @@ namespace OutputProcessor { state.dataGlobal->DayOfSim, state.dataEnvrn->CurEnvirNum, state.dataGlobal->CalendarYear, - state.dataEnvrn->CurrentYearIsLeapYear - ); + state.dataEnvrn->CurrentYearIsLeapYear); } break; default: diff --git a/src/EnergyPlus/WeatherManager.cc b/src/EnergyPlus/WeatherManager.cc index 650f79fed2f..ba7e65b6027 100644 --- a/src/EnergyPlus/WeatherManager.cc +++ b/src/EnergyPlus/WeatherManager.cc @@ -851,7 +851,8 @@ namespace WeatherManager { state.dataWeatherManager->LeapYearAdd = 0; } if (state.dataEnvrn->CurrentYearIsLeapYear) { - state.dataWeatherManager->EndDayOfMonthWithLeapDay(2) = state.dataWeatherManager->EndDayOfMonth(2) + state.dataWeatherManager->LeapYearAdd; + state.dataWeatherManager->EndDayOfMonthWithLeapDay(2) = + state.dataWeatherManager->EndDayOfMonth(2) + state.dataWeatherManager->LeapYearAdd; } state.dataWeatherManager->UseDaylightSaving = state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).UseDST; state.dataWeatherManager->UseSpecialDays = state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).UseHolidays; diff --git a/src/EnergyPlus/WeatherManager.hh b/src/EnergyPlus/WeatherManager.hh index 1bb34dd429d..f3c990a79b2 100644 --- a/src/EnergyPlus/WeatherManager.hh +++ b/src/EnergyPlus/WeatherManager.hh @@ -971,15 +971,15 @@ struct WeatherManagerData : BaseGlobalStruct Array1D_string SPSiteScheduleUnits; // SP Site Schedule Units NOLINT(cert-err58-cpp) int NumSPSiteScheduleNamePtrs; // Number of SP Site Schedules (DesignDay only) // Number of hours of missing data - Array1D Interpolation; // Interpolation values based on Number of Time Steps in Hour NOLINT(cert-err58-cpp) - Array1D SolarInterpolation; // Solar Interpolation values based on Number of Time Steps in Hour NOLINT(cert-err58-cpp) - Array1D_int EndDayOfMonth; // NOLINT(cert-err58-cpp) - Array1D_int EndDayOfMonthWithLeapDay; // end day of the month including Feb 29 for leap years instead of Feb 28 - int LeapYearAdd; // Set during environment if leap year is active (adds 1 to number days in Feb) - bool DatesShouldBeReset; // True when weekdays should be reset - bool StartDatesCycleShouldBeReset; // True when start dates on repeat should be reset - bool Jan1DatesShouldBeReset; // True if Jan 1 should signal reset of dates - bool RPReadAllWeatherData; // True if need to read all weather data prior to simulation + Array1D Interpolation; // Interpolation values based on Number of Time Steps in Hour NOLINT(cert-err58-cpp) + Array1D SolarInterpolation; // Solar Interpolation values based on Number of Time Steps in Hour NOLINT(cert-err58-cpp) + Array1D_int EndDayOfMonth; // NOLINT(cert-err58-cpp) + Array1D_int EndDayOfMonthWithLeapDay; // end day of the month including Feb 29 for leap years instead of Feb 28 + int LeapYearAdd; // Set during environment if leap year is active (adds 1 to number days in Feb) + bool DatesShouldBeReset; // True when weekdays should be reset + bool StartDatesCycleShouldBeReset; // True when start dates on repeat should be reset + bool Jan1DatesShouldBeReset; // True if Jan 1 should signal reset of dates + bool RPReadAllWeatherData; // True if need to read all weather data prior to simulation // Object Data // NOLINTNEXTLINE(cert-err58-cpp) @@ -1285,8 +1285,8 @@ struct WeatherManagerData : BaseGlobalStruct DaylightSavingIsActive(false), WFAllowsLeapYears(false), curSimDayForEndOfRunPeriod(0), Envrn(0), NumOfEnvrn(0), NumEPWTypExtSets(0), NumWPSkyTemperatures(0), RptIsRain(0), RptIsSnow(0), RptDayType(0), HrAngle(0.0), SolarAltitudeAngle(0.0), SolarAzimuthAngle(0.0), HorizIRSky(0.0), TimeStepFraction(0.0), NumSPSiteScheduleNamePtrs(0), EndDayOfMonth(12, {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}), - EndDayOfMonthWithLeapDay(12, {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}), - LeapYearAdd(0), DatesShouldBeReset(false), StartDatesCycleShouldBeReset(false), Jan1DatesShouldBeReset(false), RPReadAllWeatherData(false) + EndDayOfMonthWithLeapDay(12, {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}), LeapYearAdd(0), DatesShouldBeReset(false), + StartDatesCycleShouldBeReset(false), Jan1DatesShouldBeReset(false), RPReadAllWeatherData(false) { } }; From b197d9383bbfa633e8490ce667fc8ea97e558927 Mon Sep 17 00:00:00 2001 From: Jason Glazer Date: Wed, 30 Aug 2023 15:51:53 -0500 Subject: [PATCH 11/34] Add SQL unit test to highlight leap day handling --- tst/EnergyPlus/unit/SQLite.unit.cc | 50 ++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tst/EnergyPlus/unit/SQLite.unit.cc b/tst/EnergyPlus/unit/SQLite.unit.cc index aec4886b273..372e314cae2 100644 --- a/tst/EnergyPlus/unit/SQLite.unit.cc +++ b/tst/EnergyPlus/unit/SQLite.unit.cc @@ -350,6 +350,56 @@ TEST_F(SQLiteFixture, SQLiteProcedures_createSQLiteTimeIndexRecord) state->dataSQLiteProcedures->sqlite->sqliteCommit(); } +TEST_F(SQLiteFixture, SQLiteProcedures_createSQLiteTimeIndexRecord_NonLeapDay) +{ + // set the leap year flag to false (6th argument) and expect the last day of february to be the 28th + state->dataSQLiteProcedures->sqlite->sqliteBegin(); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2012, false); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(3, 1, 1, 0, 2012, false, 1); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(3, 1, 1, 0, 2012, false, 2); // February + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(3, 1, 1, 0, 2012, false, 3); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(3, 1, 1, 0, 2012, false, 4); + auto result = queryResult("SELECT * FROM Time;", "Time"); + state->dataSQLiteProcedures->sqlite->sqliteCommit(); + + ASSERT_EQ(5ul, result.size()); + std::vector testResult0{"1", "", "", "", "", "", "", "1440", "4", "1", "", "0", ""}; + std::vector testResult1{"2", "2012", "1", "31", "24", "0", "", "44640", "3", "1", "", "0", ""}; + std::vector testResult2{"3", "2012", "2", "28", "24", "0", "", "40320", "3", "1", "", "0", ""}; // February + std::vector testResult3{"4", "2012", "3", "31", "24", "0", "", "44640", "3", "1", "", "0", ""}; + std::vector testResult4{"5", "2012", "4", "30", "24", "0", "", "43200", "3", "1", "", "0", ""}; + EXPECT_EQ(testResult0, result[0]); + EXPECT_EQ(testResult1, result[1]); + EXPECT_EQ(testResult2, result[2]); + EXPECT_EQ(testResult3, result[3]); + EXPECT_EQ(testResult4, result[4]); +} + +TEST_F(SQLiteFixture, SQLiteProcedures_createSQLiteTimeIndexRecord_LeapDay) +{ + // set the leap year flag to true (6th argument) and expect the last day of february to be the 29th + state->dataSQLiteProcedures->sqlite->sqliteBegin(); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2012, true); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(3, 1, 1, 0, 2012, true, 1); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(3, 1, 1, 0, 2012, true, 2); // February + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(3, 1, 1, 0, 2012, true, 3); + state->dataSQLiteProcedures->sqlite->createSQLiteTimeIndexRecord(3, 1, 1, 0, 2012, true, 4); + auto result = queryResult("SELECT * FROM Time;", "Time"); + state->dataSQLiteProcedures->sqlite->sqliteCommit(); + + ASSERT_EQ(5ul, result.size()); + std::vector testResult0{"1", "", "", "", "", "", "", "1440", "4", "1", "", "0", ""}; + std::vector testResult1{"2", "2012", "1", "31", "24", "0", "", "44640", "3", "1", "", "0", ""}; + std::vector testResult2{"3", "2012", "2", "29", "24", "0", "", "41760", "3", "1", "", "0", ""}; // February + std::vector testResult3{"4", "2012", "3", "31", "24", "0", "", "44640", "3", "1", "", "0", ""}; + std::vector testResult4{"5", "2012", "4", "30", "24", "0", "", "43200", "3", "1", "", "0", ""}; + EXPECT_EQ(testResult0, result[0]); + EXPECT_EQ(testResult1, result[1]); + EXPECT_EQ(testResult2, result[2]); + EXPECT_EQ(testResult3, result[3]); + EXPECT_EQ(testResult4, result[4]); +} + TEST_F(SQLiteFixture, SQLiteProcedures_createSQLiteReportDataRecord) { state->dataSQLiteProcedures->sqlite->sqliteBegin(); From 476e0c30a524758de68a328c541fac7c7c5b79d2 Mon Sep 17 00:00:00 2001 From: Neal Kruis Date: Fri, 1 Sep 2023 15:00:59 -0600 Subject: [PATCH 12/34] Initial update of Penumbra. --- third_party/.gitignore | 20 + third_party/CMakeLists.txt | 1 - third_party/penumbra/.gitignore | 2 +- third_party/penumbra/.travis.yml | 55 - third_party/penumbra/CMakeLists.txt | 36 +- third_party/penumbra/README.md | 17 +- .../penumbra/cmake/compiler-flags.cmake | 273 +- .../cmake/initialize-submodules.cmake | 27 + third_party/penumbra/examples/CMakeLists.txt | 38 - third_party/penumbra/examples/awning.cpp | 77 - third_party/penumbra/examples/glfw.icns | Bin 27988 -> 0 bytes third_party/penumbra/examples/glfw.ico | Bin 21630 -> 0 bytes third_party/penumbra/examples/glfw.rc | 3 - .../penumbra/include/penumbra/logging.h | 56 + .../penumbra/include/penumbra/penumbra.h | 91 +- .../penumbra/include/penumbra/surface.h | 19 +- third_party/penumbra/src/CMakeLists.txt | 50 +- third_party/penumbra/src/error.cpp | 30 - third_party/penumbra/src/error.h | 18 - third_party/penumbra/src/gl/context.cpp | 651 ++-- third_party/penumbra/src/gl/context.h | 132 +- third_party/penumbra/src/gl/model.cpp | 83 +- third_party/penumbra/src/gl/model.h | 40 +- third_party/penumbra/src/gl/program.cpp | 27 +- third_party/penumbra/src/gl/program.h | 9 +- third_party/penumbra/src/gl/shader.cpp | 24 +- third_party/penumbra/src/gl/shader.h | 12 +- .../penumbra/src/penumbra-implementation.cpp | 37 + .../penumbra/src/penumbra-implementation.h | 39 + third_party/penumbra/src/penumbra-private.h | 34 - third_party/penumbra/src/penumbra.cpp | 336 +- third_party/penumbra/src/sun.cpp | 46 +- third_party/penumbra/src/sun.h | 30 +- .../penumbra/src/surface-implementation.cpp | 65 + .../penumbra/src/surface-implementation.h | 37 + third_party/penumbra/src/surface-private.h | 35 - third_party/penumbra/src/surface.cpp | 91 +- third_party/penumbra/test/CMakeLists.txt | 18 - third_party/penumbra/test/penumbra_test.cpp | 424 --- third_party/penumbra/vendor/CMakeLists.txt | 59 +- .../penumbra/vendor/courierr/.clang-format | 126 + .../penumbra/vendor/courierr/.gitignore | 4 + .../penumbra/vendor/courierr/CMakeLists.txt | 44 + .../penumbra/vendor/courierr/LICENSE.txt | 11 + .../cmake/initialize-submodules.cmake | 27 + .../courierr/include/courierr/CMakeLists.txt | 8 + .../courierr/include/courierr/courierr.h | 72 + .../vendor/courierr/vendor/CMakeLists.txt | 21 + .../penumbra/vendor/glad/CMakeLists.txt | 10 +- .../vendor/glad/include/KHR/khrplatform.h | 26 +- .../penumbra/vendor/glad/include/glad/glad.h | 117 +- third_party/penumbra/vendor/glad/src/glad.c | 531 ++-- .../penumbra/vendor/glfw/.appveyor.yml | 60 - third_party/penumbra/vendor/glfw/.travis.yml | 106 - .../vendor/glfw/CMake/GenerateMappings.cmake | 19 +- .../glfw/CMake/modules/FindEpollShim.cmake | 2 +- .../penumbra/vendor/glfw/CMakeLists.txt | 29 +- .../penumbra/vendor/glfw/CONTRIBUTORS.md | 250 ++ third_party/penumbra/vendor/glfw/README.md | 309 +- .../vendor/glfw/deps/glad/vk_platform.h | 20 +- .../penumbra/vendor/glfw/deps/glad/vulkan.h | 2734 ++++++++++++++--- .../penumbra/vendor/glfw/deps/glad_vulkan.c | 556 ++-- .../penumbra/vendor/glfw/deps/linmath.h | 4 +- .../vendor/glfw/deps/stb_image_write.h | 930 +++++- .../penumbra/vendor/glfw/docs/CMakeLists.txt | 32 - .../penumbra/vendor/glfw/docs/CODEOWNERS | 10 - .../penumbra/vendor/glfw/docs/CONTRIBUTING.md | 391 --- .../penumbra/vendor/glfw/docs/Doxyfile.in | 1848 ----------- .../vendor/glfw/docs/DoxygenLayout.xml | 71 - .../penumbra/vendor/glfw/docs/SUPPORT.md | 14 - .../penumbra/vendor/glfw/docs/build.dox | 342 --- .../penumbra/vendor/glfw/docs/compat.dox | 285 -- .../penumbra/vendor/glfw/docs/compile.dox | 290 -- .../penumbra/vendor/glfw/docs/context.dox | 346 --- .../penumbra/vendor/glfw/docs/extra.css | 1 - .../penumbra/vendor/glfw/docs/extra.less | 414 --- .../penumbra/vendor/glfw/docs/footer.html | 7 - .../penumbra/vendor/glfw/docs/header.html | 33 - .../penumbra/vendor/glfw/docs/input.dox | 945 ------ .../penumbra/vendor/glfw/docs/internal.dox | 115 - .../penumbra/vendor/glfw/docs/intro.dox | 454 --- .../penumbra/vendor/glfw/docs/main.dox | 46 - .../penumbra/vendor/glfw/docs/monitor.dox | 268 -- .../penumbra/vendor/glfw/docs/moving.dox | 513 ---- .../penumbra/vendor/glfw/docs/news.dox | 856 ------ .../penumbra/vendor/glfw/docs/quick.dox | 362 --- .../penumbra/vendor/glfw/docs/spaces.svg | 877 ------ .../penumbra/vendor/glfw/docs/vulkan.dox | 230 -- .../penumbra/vendor/glfw/docs/window.dox | 1434 --------- .../vendor/glfw/examples/CMakeLists.txt | 88 - .../penumbra/vendor/glfw/examples/boing.c | 679 ---- .../penumbra/vendor/glfw/examples/gears.c | 360 --- .../penumbra/vendor/glfw/examples/glfw.icns | Bin 27988 -> 0 bytes .../penumbra/vendor/glfw/examples/glfw.ico | Bin 21630 -> 0 bytes .../penumbra/vendor/glfw/examples/glfw.rc | 3 - .../penumbra/vendor/glfw/examples/heightmap.c | 512 --- .../penumbra/vendor/glfw/examples/offscreen.c | 176 -- .../penumbra/vendor/glfw/examples/particles.c | 1073 ------- .../penumbra/vendor/glfw/examples/sharing.c | 234 -- .../penumbra/vendor/glfw/examples/simple.c | 166 - .../penumbra/vendor/glfw/examples/splitview.c | 546 ---- .../penumbra/vendor/glfw/examples/wave.c | 462 --- .../penumbra/vendor/glfw/include/GLFW/glfw3.h | 198 +- .../vendor/glfw/include/GLFW/glfw3native.h | 173 +- .../penumbra/vendor/glfw/src/CMakeLists.txt | 51 +- .../penumbra/vendor/glfw/src/cocoa_init.m | 28 +- .../penumbra/vendor/glfw/src/cocoa_joystick.h | 1 + .../penumbra/vendor/glfw/src/cocoa_joystick.m | 15 +- .../penumbra/vendor/glfw/src/cocoa_monitor.m | 115 +- .../penumbra/vendor/glfw/src/cocoa_platform.h | 25 +- .../penumbra/vendor/glfw/src/cocoa_window.m | 214 +- .../penumbra/vendor/glfw/src/context.c | 14 +- .../penumbra/vendor/glfw/src/egl_context.c | 42 +- .../penumbra/vendor/glfw/src/egl_context.h | 6 +- .../penumbra/vendor/glfw/src/glfw_config.h.in | 2 - .../penumbra/vendor/glfw/src/glx_context.c | 23 +- .../penumbra/vendor/glfw/src/glx_context.h | 2 - third_party/penumbra/vendor/glfw/src/init.c | 120 +- third_party/penumbra/vendor/glfw/src/input.c | 82 +- .../penumbra/vendor/glfw/src/internal.h | 52 +- .../penumbra/vendor/glfw/src/linux_joystick.c | 8 +- .../penumbra/vendor/glfw/src/linux_joystick.h | 1 + .../penumbra/vendor/glfw/src/mappings.h | 723 ++++- .../penumbra/vendor/glfw/src/mappings.h.in | 15 +- .../penumbra/vendor/glfw/src/monitor.c | 8 +- .../penumbra/vendor/glfw/src/nsgl_context.h | 8 +- .../penumbra/vendor/glfw/src/nsgl_context.m | 4 +- .../penumbra/vendor/glfw/src/null_window.c | 3 + .../penumbra/vendor/glfw/src/osmesa_context.c | 16 +- .../penumbra/vendor/glfw/src/osmesa_context.h | 2 - .../penumbra/vendor/glfw/src/posix_thread.h | 2 - .../penumbra/vendor/glfw/src/posix_time.h | 1 - third_party/penumbra/vendor/glfw/src/vulkan.c | 2 + .../penumbra/vendor/glfw/src/wgl_context.c | 12 +- .../penumbra/vendor/glfw/src/wgl_context.h | 6 - .../penumbra/vendor/glfw/src/win32_init.c | 33 +- .../penumbra/vendor/glfw/src/win32_joystick.c | 24 +- .../penumbra/vendor/glfw/src/win32_joystick.h | 1 + .../penumbra/vendor/glfw/src/win32_monitor.c | 17 +- .../penumbra/vendor/glfw/src/win32_platform.h | 42 +- .../penumbra/vendor/glfw/src/win32_time.c | 24 +- .../penumbra/vendor/glfw/src/win32_window.c | 298 +- third_party/penumbra/vendor/glfw/src/window.c | 48 +- .../penumbra/vendor/glfw/src/wl_init.c | 853 +---- .../penumbra/vendor/glfw/src/wl_monitor.c | 94 +- .../penumbra/vendor/glfw/src/wl_platform.h | 98 +- .../penumbra/vendor/glfw/src/wl_window.c | 2248 ++++++++++---- .../penumbra/vendor/glfw/src/x11_init.c | 418 ++- .../penumbra/vendor/glfw/src/x11_monitor.c | 2 +- .../penumbra/vendor/glfw/src/x11_platform.h | 12 +- .../penumbra/vendor/glfw/src/x11_window.c | 438 +-- .../penumbra/vendor/glfw/src/xkb_unicode.c | 4 +- .../penumbra/vendor/glfw/src/xkb_unicode.h | 4 +- .../penumbra/vendor/glfw/tests/CMakeLists.txt | 94 - .../penumbra/vendor/glfw/tests/clipboard.c | 145 - .../penumbra/vendor/glfw/tests/cursor.c | 493 --- .../penumbra/vendor/glfw/tests/empty.c | 132 - .../penumbra/vendor/glfw/tests/events.c | 650 ---- .../penumbra/vendor/glfw/tests/gamma.c | 179 -- .../penumbra/vendor/glfw/tests/glfwinfo.c | 920 ------ third_party/penumbra/vendor/glfw/tests/icon.c | 149 - .../penumbra/vendor/glfw/tests/iconify.c | 297 -- .../penumbra/vendor/glfw/tests/inputlag.c | 308 -- .../penumbra/vendor/glfw/tests/joysticks.c | 344 --- .../penumbra/vendor/glfw/tests/monitors.c | 260 -- third_party/penumbra/vendor/glfw/tests/msaa.c | 220 -- .../penumbra/vendor/glfw/tests/opacity.c | 108 - .../penumbra/vendor/glfw/tests/reopen.c | 240 -- .../penumbra/vendor/glfw/tests/tearing.c | 250 -- .../penumbra/vendor/glfw/tests/threads.c | 152 - .../penumbra/vendor/glfw/tests/timeout.c | 98 - .../penumbra/vendor/glfw/tests/title.c | 72 - .../vendor/glfw/tests/triangle-vulkan.c | 2229 -------------- .../penumbra/vendor/glfw/tests/windows.c | 174 -- .../vendor/libtess2/Include/tesselator.h | 4 +- .../vendor/libtess2/Source/bucketalloc.c | 6 +- .../penumbra/vendor/libtess2/Source/geom.c | 62 +- .../penumbra/vendor/libtess2/Source/mesh.c | 2 +- .../penumbra/vendor/libtess2/Source/mesh.h | 2 +- .../vendor/libtess2/Source/priorityq.c | 6 +- .../penumbra/vendor/libtess2/Source/sweep.c | 8 +- .../penumbra/vendor/libtess2/Source/tess.c | 16 +- .../penumbra/vendor/libtess2/Source/tess.h | 2 +- 183 files changed, 9870 insertions(+), 27925 deletions(-) delete mode 100644 third_party/penumbra/.travis.yml create mode 100644 third_party/penumbra/cmake/initialize-submodules.cmake delete mode 100644 third_party/penumbra/examples/CMakeLists.txt delete mode 100644 third_party/penumbra/examples/awning.cpp delete mode 100644 third_party/penumbra/examples/glfw.icns delete mode 100644 third_party/penumbra/examples/glfw.ico delete mode 100644 third_party/penumbra/examples/glfw.rc create mode 100644 third_party/penumbra/include/penumbra/logging.h delete mode 100644 third_party/penumbra/src/error.cpp delete mode 100644 third_party/penumbra/src/error.h create mode 100644 third_party/penumbra/src/penumbra-implementation.cpp create mode 100644 third_party/penumbra/src/penumbra-implementation.h delete mode 100644 third_party/penumbra/src/penumbra-private.h create mode 100644 third_party/penumbra/src/surface-implementation.cpp create mode 100644 third_party/penumbra/src/surface-implementation.h delete mode 100644 third_party/penumbra/src/surface-private.h delete mode 100644 third_party/penumbra/test/CMakeLists.txt delete mode 100644 third_party/penumbra/test/penumbra_test.cpp create mode 100644 third_party/penumbra/vendor/courierr/.clang-format create mode 100644 third_party/penumbra/vendor/courierr/.gitignore create mode 100644 third_party/penumbra/vendor/courierr/CMakeLists.txt create mode 100644 third_party/penumbra/vendor/courierr/LICENSE.txt create mode 100644 third_party/penumbra/vendor/courierr/cmake/initialize-submodules.cmake create mode 100644 third_party/penumbra/vendor/courierr/include/courierr/CMakeLists.txt create mode 100644 third_party/penumbra/vendor/courierr/include/courierr/courierr.h create mode 100644 third_party/penumbra/vendor/courierr/vendor/CMakeLists.txt delete mode 100644 third_party/penumbra/vendor/glfw/.appveyor.yml delete mode 100644 third_party/penumbra/vendor/glfw/.travis.yml create mode 100644 third_party/penumbra/vendor/glfw/CONTRIBUTORS.md delete mode 100644 third_party/penumbra/vendor/glfw/docs/CMakeLists.txt delete mode 100644 third_party/penumbra/vendor/glfw/docs/CODEOWNERS delete mode 100644 third_party/penumbra/vendor/glfw/docs/CONTRIBUTING.md delete mode 100644 third_party/penumbra/vendor/glfw/docs/Doxyfile.in delete mode 100644 third_party/penumbra/vendor/glfw/docs/DoxygenLayout.xml delete mode 100644 third_party/penumbra/vendor/glfw/docs/SUPPORT.md delete mode 100644 third_party/penumbra/vendor/glfw/docs/build.dox delete mode 100644 third_party/penumbra/vendor/glfw/docs/compat.dox delete mode 100644 third_party/penumbra/vendor/glfw/docs/compile.dox delete mode 100644 third_party/penumbra/vendor/glfw/docs/context.dox delete mode 100644 third_party/penumbra/vendor/glfw/docs/extra.css delete mode 100644 third_party/penumbra/vendor/glfw/docs/extra.less delete mode 100644 third_party/penumbra/vendor/glfw/docs/footer.html delete mode 100644 third_party/penumbra/vendor/glfw/docs/header.html delete mode 100644 third_party/penumbra/vendor/glfw/docs/input.dox delete mode 100644 third_party/penumbra/vendor/glfw/docs/internal.dox delete mode 100644 third_party/penumbra/vendor/glfw/docs/intro.dox delete mode 100644 third_party/penumbra/vendor/glfw/docs/main.dox delete mode 100644 third_party/penumbra/vendor/glfw/docs/monitor.dox delete mode 100644 third_party/penumbra/vendor/glfw/docs/moving.dox delete mode 100644 third_party/penumbra/vendor/glfw/docs/news.dox delete mode 100644 third_party/penumbra/vendor/glfw/docs/quick.dox delete mode 100644 third_party/penumbra/vendor/glfw/docs/spaces.svg delete mode 100644 third_party/penumbra/vendor/glfw/docs/vulkan.dox delete mode 100644 third_party/penumbra/vendor/glfw/docs/window.dox delete mode 100644 third_party/penumbra/vendor/glfw/examples/CMakeLists.txt delete mode 100644 third_party/penumbra/vendor/glfw/examples/boing.c delete mode 100644 third_party/penumbra/vendor/glfw/examples/gears.c delete mode 100644 third_party/penumbra/vendor/glfw/examples/glfw.icns delete mode 100644 third_party/penumbra/vendor/glfw/examples/glfw.ico delete mode 100644 third_party/penumbra/vendor/glfw/examples/glfw.rc delete mode 100644 third_party/penumbra/vendor/glfw/examples/heightmap.c delete mode 100644 third_party/penumbra/vendor/glfw/examples/offscreen.c delete mode 100644 third_party/penumbra/vendor/glfw/examples/particles.c delete mode 100644 third_party/penumbra/vendor/glfw/examples/sharing.c delete mode 100644 third_party/penumbra/vendor/glfw/examples/simple.c delete mode 100644 third_party/penumbra/vendor/glfw/examples/splitview.c delete mode 100644 third_party/penumbra/vendor/glfw/examples/wave.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/CMakeLists.txt delete mode 100644 third_party/penumbra/vendor/glfw/tests/clipboard.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/cursor.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/empty.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/events.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/gamma.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/glfwinfo.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/icon.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/iconify.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/inputlag.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/joysticks.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/monitors.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/msaa.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/opacity.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/reopen.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/tearing.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/threads.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/timeout.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/title.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/triangle-vulkan.c delete mode 100644 third_party/penumbra/vendor/glfw/tests/windows.c diff --git a/third_party/.gitignore b/third_party/.gitignore index 77ac8acc764..21a9b6f243e 100644 --- a/third_party/.gitignore +++ b/third_party/.gitignore @@ -33,9 +33,29 @@ libtk205/.gitmodules # unused repo directories/files btwxt/vendor/googletest +penumbra/.github +penumbra/examples +penumbra/test +penumbra/vendor/courierr/.codecov.yml +penumbra/vendor/courierr/.github +penumbra/vendor/courierr/.gitmodules +penumbra/vendor/courierr/README.md +penumbra/vendor/courierr/test +penumbra/vendor/courierr/vendor/fmt +penumbra/vendor/courierr/vendor/googletest +penumbra/vendor/glfw/.github +penumbra/vendor/glfw/.appveyor.yml +penumbra/vendor/glfw/docs +penumbra/vendor/glfw/examples +penumbra/vendor/glfw/tests penumbra/vendor/googletest libtk205/.github libtk205/examples libtk205/test libtk205/vendor/btwxt libtk205/vendor/json + +FindGcov.cmake +FindLcov.cmake +Findcodecov.cmake +llvm-cov-wrapper \ No newline at end of file diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 425f5d0bdd5..86ca75f54e5 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -179,7 +179,6 @@ if(OPENGL_FOUND) OFF CACHE BOOL "" FORCE) add_subdirectory(penumbra) - set_target_properties(awning PROPERTIES FOLDER ThirdParty/Penumbra) set_target_properties(glfw PROPERTIES FOLDER ThirdParty/Penumbra/GLFW) set_target_properties(glad PROPERTIES FOLDER ThirdParty/Penumbra) set_target_properties(penumbra PROPERTIES FOLDER ThirdParty/Penumbra) diff --git a/third_party/penumbra/.gitignore b/third_party/penumbra/.gitignore index 759cfcd131a..d6218789c07 100644 --- a/third_party/penumbra/.gitignore +++ b/third_party/penumbra/.gitignore @@ -4,4 +4,4 @@ builds/ .DS_Store cmake-build-*/ .vscode - +.vs/ diff --git a/third_party/penumbra/.travis.yml b/third_party/penumbra/.travis.yml deleted file mode 100644 index 283d556e9a1..00000000000 --- a/third_party/penumbra/.travis.yml +++ /dev/null @@ -1,55 +0,0 @@ -language: cpp -git: - depth: 100 -notifications: - email: false -matrix: - include: - - os: osx - compiler: clang - osx_image: xcode10.1 - - os: linux - compiler: gcc - dist: xenial - services: xvfb - - os: linux - compiler: gcc - dist: xenial - env: COVERAGE="ON" - services: xvfb - - os: windows - -before_install: -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - sudo apt-get -y install xorg-dev libgl1-mesa-dev; - fi - -script: -- mkdir build -- cd build -- if [[ "$COVERAGE" == "ON" ]]; then - export CONFIG="Debug"; - export STATIC_LIB="OFF"; - else - export CONFIG="Release"; - export COVERAGE="OFF"; - export STATIC_LIB="ON"; - fi -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - export TESTING="ON"; - else - export TESTING="OFF"; - fi -- cmake -DBUILD_PENUMBRA_TESTING="$TESTING" -DPENUMBRA_STATIC_LIB="$STATIC_LIB" -DPENUMBRA_COVERAGE="$COVERAGE" -DCMAKE_BUILD_TYPE="$CONFIG" .. -- cmake --build . --config "$CONFIG" -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - ctest --output-on-failure -C "$CONFIG" || travis_terminate 1; - if [[ "$COVERAGE" == "ON" ]]; then - make gcov || travis_terminate 1; - fi - fi - -after_success: -- if [[ "$COVERAGE" == "ON" ]]; then - bash <(curl -s https://codecov.io/bash) -X gcov || travis_terminate 1; - fi diff --git a/third_party/penumbra/CMakeLists.txt b/third_party/penumbra/CMakeLists.txt index 60efe67a6fd..37c546f6f7f 100644 --- a/third_party/penumbra/CMakeLists.txt +++ b/third_party/penumbra/CMakeLists.txt @@ -1,5 +1,8 @@ cmake_minimum_required(VERSION 3.7) -project(penumbra) +cmake_policy(SET CMP0091 NEW) +project(penumbra LANGUAGES CXX C) + +cmake_policy(SET CMP0079 NEW) # target_link_libraries() allows use with targets in other directories. # Set a default build type if none was specified if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) @@ -11,21 +14,31 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) endif() find_package(Git QUIET) + +set(OpenGL_GL_PREFERENCE "GLVND") find_package(OpenGL) set( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH} ) -set (CMAKE_MODULE_PATH "${penumbra_SOURCE_DIR}/cmake") +set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") -include(compiler-flags) +include(CMakeDependentOption) + +cmake_dependent_option( ${PROJECT_NAME}_BUILD_TESTING "Build ${PROJECT_NAME} testing targets" ON "${PROJECT_NAME}_IS_TOP_LEVEL" OFF ) +option( ${PROJECT_NAME}_COVERAGE "Add ${PROJECT_NAME} coverage reports" OFF ) +cmake_dependent_option( ${PROJECT_NAME}_BUILD_EXAMPLES "Build ${PROJECT_NAME} examples" ON "${PROJECT_NAME}_IS_TOP_LEVEL" OFF ) +cmake_dependent_option( ${PROJECT_NAME}_WARNINGS_AS_ERRORS "Treat warnings in ${PROJECT_NAME} as errors" ON "${PROJECT_NAME}_IS_TOP_LEVEL" OFF ) -option( BUILD_PENUMBRA_TESTING "Build Penumbra testing targets" OFF ) -option( PENUMBRA_COVERAGE "Add coverage reports" OFF) +if (NOT ${PROJECT_NAME}_STATIC_LIB) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) +endif () + +include(compiler-flags) # Set up testing/coverage -if (BUILD_PENUMBRA_TESTING) +if (${PROJECT_NAME}_BUILD_TESTING) enable_testing() - if (PENUMBRA_COVERAGE) + if (${PROJECT_NAME}_COVERAGE) set(ENABLE_COVERAGE ON CACHE BOOL "" FORCE) find_package(codecov) endif() @@ -36,11 +49,14 @@ endif() add_subdirectory(vendor) add_subdirectory(src) -add_subdirectory(examples) -if (BUILD_PENUMBRA_TESTING) +if (${PROJECT_NAME}_BUILD_EXAMPLES) + add_subdirectory(examples) +endif() + +if (${PROJECT_NAME}_BUILD_TESTING) add_subdirectory(test) - if (PENUMBRA_COVERAGE) + if (${PROJECT_NAME}_COVERAGE) coverage_evaluate() endif() endif() diff --git a/third_party/penumbra/README.md b/third_party/penumbra/README.md index 47ddc107cc6..7293e72321d 100644 --- a/third_party/penumbra/README.md +++ b/third_party/penumbra/README.md @@ -1,6 +1,19 @@ -[![Build Status](https://travis-ci.org/bigladder/penumbra.svg?branch=develop)](https://travis-ci.org/bigladder/penumbra) +[![Build and Test](https://github.com/bigladder/penumbra/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/bigladder/penumbra/actions/workflows/build-and-test.yml) [![codecov](https://codecov.io/gh/bigladder/penumbra/branch/develop/graph/badge.svg)](https://codecov.io/gh/bigladder/penumbra) # Penumbra -Penumbra is a free and open source library for GPU accelerated solar shading calculations using [pixel counting](http://www.ibpsa.org/proceedings/BS2011/P_1271.pdf). +Penumbra is a free and open source library for GPU accelerated solar shading calculations using [pixel counting](http://www.ibpsa.org/proceedings/BS2011/P_1271.pdf). It is configured as a cross-platform CMake project. + +## Pre-requisites: + +1. A C++ compiler (e.g., Clang, GCC, MSVC) +2. CMake + +## Building penumbra from source + +1. Clone the git repository. +2. Make a directory called `build` inside the top level of your source. +3. Open a console in the `build` directory. +4. Type `cmake ..`. +5. Type `cmake --build . --config Release`. diff --git a/third_party/penumbra/cmake/compiler-flags.cmake b/third_party/penumbra/cmake/compiler-flags.cmake index fb9f0b3dc2b..a32b2d0891c 100644 --- a/third_party/penumbra/cmake/compiler-flags.cmake +++ b/third_party/penumbra/cmake/compiler-flags.cmake @@ -1,168 +1,107 @@ -macro( ADD_CXX_DEFINITIONS NEWFLAGS ) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${NEWFLAGS}") +# '*' indicates CMake default option +# '+' indicates default compiler behavior +add_library(penumbra_common_interface INTERFACE) + + #==================# + # Compiler options # + #==================# + +target_compile_options(penumbra_common_interface INTERFACE + $<$: # Visual C++ (VS 2013) + /GR + /nologo + /W4 + $<$: + /WX # Turn warnings into errors + > + $<$: + /GS- # Disable buffer overrun checks for performance in release mode + > + > + # GCC And Clang + $<$: + -pthread + -pipe # Faster compiler processing + $<$: # Adds flag only to C++ + -pedantic # Turn on warnings about constructs/situations that may be non-portable or outside of the standard + > + -Wall # Turn on warnings + -Wextra # Turn on warnings + $<$: + -Werror # Turn warnings into errors + > + $<$: + -fno-stack-protector # Produces debugging information specifically for gdb + > + $<$: + $<$: + -ffloat-store # Improve debug run solution stability + -fsignaling-nans # Disable optimizations that may have concealed NaN behavior + > + > + # -finline-limit=2000 # More aggressive inlining This is causing unit test failures on Ubuntu 14.04 + > +) + +#======================# +# Compiler definitions # +#======================# + +target_compile_definitions(penumbra_common_interface INTERFACE + # GCC + $<$: + $<$: + _GLIBCXX_DEBUG # Standard container debug mode (bounds checking, ...) + > + > +) + +#==================# +# Linker options # +#==================# + +target_link_options(penumbra_common_interface INTERFACE + $<$: + -pthread + > + +) + +# This macro will encapsulate the CMAKE_CXX flags that should only be set for executables +macro (SET_CXX_FLAGS) +# Remove unwanted CMake defaults from global flags +if (MSVC) + # See https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/Platform/Windows-MSVC.cmake + set(CMAKE_CXX_FLAGS + /EHsc #*Specifies the model of exception handling (sc options). + /DWIN32 #*Windows Platform (regardless of architecture) + /D_WINDOWS #* + ) + set(CMAKE_CXX_FLAGS_RELEASE + /O2 #*Creates fast code (Og+Oi+Ot+Oy+Ob2+GF+Gy). + # /Ob2 #*Controls inline expansion (level 2). (part of O2) + /DNDEBUG #*Enables or disables compilation of assertions + ) + set(CMAKE_CXX_FLAGS_DEBUG + /Ob0 #*Controls inline expansion (level 0 -- disabled). + /Od #*Disables optimization. + /Zi #*Generates complete debugging information. + /RTC1 #*Enables run-time error checking. + ) +else () # GCC or Clang or AppleClang + # See https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/Compiler/GNU.cmake + set(CMAKE_CXX_FLAGS "") + set(CMAKE_CXX_FLAGS_RELEASE + -O3 #*Maximum optimization (see https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#Optimize-Options). + -DNDEBUG #*Enables or disables compilation of assertions + ) + set(CMAKE_CXX_FLAGS_DEBUG + -g #*Produce debugging information in the operating system’s native format. + ) +endif() + +# Convert lists to space-separated strings +list(JOIN CMAKE_CXX_FLAGS " " CMAKE_CXX_FLAGS) +list(JOIN CMAKE_CXX_FLAGS_RELEASE " " CMAKE_CXX_FLAGS_RELEASE) +list(JOIN CMAKE_CXX_FLAGS_DEBUG " " CMAKE_CXX_FLAGS_DEBUG) endmacro() - -macro( ADD_CXX_DEBUG_DEFINITIONS NEWFLAGS ) - SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${NEWFLAGS}") -endmacro() - -macro( ADD_CXX_RELEASE_DEFINITIONS NEWFLAGS ) - SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${NEWFLAGS}") -endmacro() - -IF ( MSVC AND NOT ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" ) ) # Visual C++ (VS 2013) - - # Disabled Warnings: Enable some of these as more serious warnings are addressed - # 4068 Unknown pragma - # 4101 Unreferenced local variable - # 4102 Unreferenced label - # 4244 Narrowing conversions - # 4258 Definition from the loop is ignored - # 4355 Passing this pointer in class initializer (object is incomplete so bases/members can only use this in limited ways) - # 4996 Deprecated functions (/D_SCL_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS) - - # need to figure out how to set this to avoid the major slow-down in debugging: - # Configuration Properties ->Debugging -> Environment, use drop-down list to choose and type _NO_DEBUG_HEAP=1 then click OK - - # COMPILER FLAGS - ADD_CXX_DEFINITIONS("/nologo") - ADD_CXX_DEFINITIONS("/EHsc") - STRING (REGEX REPLACE "/W3" "/W1" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # Increase to /W2 then /W3 as more serious warnings are addressed (using regex to avoid VC override warnings) - - ADD_CXX_DEFINITIONS("/wd4068 /wd4101 /wd4102 /wd4244 /wd4258 /wd4355 /wd4996") # Disables warning messages listed above - ADD_CXX_DEFINITIONS("/DNOMINMAX") # Avoid build errors due to STL/Windows min-max conflicts - ADD_CXX_DEFINITIONS("/DWIN32_LEAN_AND_MEAN") # Excludes rarely used services and headers from compilation - - # ADDITIONAL RELEASE-MODE-SPECIFIC FLAGS - ADD_CXX_RELEASE_DEFINITIONS("/GS-") # Disable buffer overrun checks for performance in release mode - - # ADDITIONAL DEBUG-MODE-SPECIFIC FLAGS - ADD_CXX_DEBUG_DEFINITIONS("/Ob0") # Disable inlining - ADD_CXX_DEBUG_DEFINITIONS("/RTCsu") # Runtime checks - ADD_CXX_DEBUG_DEFINITIONS("/Zi") - -ELSEIF ( CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") # g++/Clang - if(CMAKE_HOST_UNIX) - if(NOT APPLE) - set(LINKER_FLAGS "${LINKER_FLAGS} -pthread") - ADD_DEFINITIONS("-pthread") - endif() - endif() - - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}") - - # COMPILER FLAGS - ADD_CXX_DEFINITIONS("-pipe") # Faster compiler processing - ADD_CXX_DEFINITIONS("-std=c++11") # Enable C++11 features in g++ - ADD_CXX_DEFINITIONS("-pedantic") # Turn on warnings about constructs/situations that may be non-portable or outside of the standard - #ADD_CXX_DEFINITIONS("-ffor-scope") - ADD_CXX_DEFINITIONS("-Wall -Wextra") # Turn on warnings - ADD_CXX_DEFINITIONS("-Wno-unknown-pragmas") - if ( CMAKE_COMPILER_IS_GNUCXX ) # g++ - ADD_CXX_DEFINITIONS("-Wno-unused-but-set-parameter -Wno-unused-but-set-variable") # Suppress unused-but-set warnings until more serious ones are addressed - ADD_CXX_DEFINITIONS("-Wno-maybe-uninitialized") - elseif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) - ADD_CXX_DEFINITIONS("-Wno-invalid-source-encoding") - endif() - - if (UNIX) - ADD_CXX_DEFINITIONS("-fPIC") - endif() - - # ADDITIONAL GCC-SPECIFIC FLAGS - if ( CMAKE_COMPILER_IS_GNUCXX ) # g++ - ADD_CXX_DEBUG_DEFINITIONS("-ffloat-store") # Improve debug run solution stability - ADD_CXX_DEBUG_DEFINITIONS("-fsignaling-nans") # Disable optimizations that may have concealed NaN behavior - ADD_CXX_DEBUG_DEFINITIONS("-D_GLIBCXX_DEBUG") # Standard container debug mode (bounds checking, ...) - # ADD_CXX_RELEASE_DEFINITIONS("-finline-limit=2000") # More aggressive inlining This is causing unit test failures on Ubuntu 14.04 - endif() - - ADD_CXX_DEBUG_DEFINITIONS("-ggdb") # Produces debugging information specifically for gdb - ADD_CXX_RELEASE_DEFINITIONS("-fno-stack-protector") - # ADD_CXX_RELEASE_DEFINITIONS("-Ofast") # -Ofast (or -ffast-math) needed to auto-vectorize floating point loops - -ELSEIF ( WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" ) - - # Disabled Warnings: Enable some of these as more serious warnings are addressed - # 161 Unrecognized pragma - # 177 Variable declared but never referenced - # 488 Template parameter not used ... - # 809 Exception specification consistency warnings that fire in gtest code - # 869 Parameter never referenced - # 1786 Use of deprecated items - # 2259 Non-pointer conversions may lose significant bits - # 3280 Declaration hides variable - # 10382 xHOST remark - # 11074 Inlining inhibited - # 11075 Inlining inhibited - - # COMPILER FLAGS - ADD_CXX_DEFINITIONS("/nologo") # Skip banner text - ADD_CXX_DEFINITIONS("/Qstd=c++11") # Specify C++11 language - ADD_CXX_DEFINITIONS("/Qcxx-features") # Enables standard C++ features without disabling Microsoft extensions - ADD_CXX_DEFINITIONS("/Wall") # Enable "all" warnings - ADD_CXX_DEFINITIONS("/Qdiag-disable:161,177,488,809,869,1786,2259,3280,10382,11074,11075") # Disable warnings listed above - ADD_CXX_DEFINITIONS("/DNOMINMAX") # Avoid build errors due to STL/Windows min-max conflicts - ADD_CXX_DEFINITIONS("/DWIN32_LEAN_AND_MEAN") # Excludes rarely used services and headers from compilation - - # ADDITIONAL RELEASE-MODE-SPECIFIC FLAGS - ADD_CXX_RELEASE_DEFINITIONS("/O3") # Agressive optimization - ADD_CXX_RELEASE_DEFINITIONS("/Qprec-div-") # Faster division - ADD_CXX_RELEASE_DEFINITIONS("/Qansi-alias") # Better optimization via strict aliasing rules - ADD_CXX_RELEASE_DEFINITIONS("/Qip") # Inter-procedural optimnization within a single file - ADD_CXX_RELEASE_DEFINITIONS("/Qinline-factor:225") # Aggressive inlining - # ADD_CXX_RELEASE_DEFINITIONS("/fp:fast=2") # Aggressive optimizations on floating-point data - - # ADDITIONAL DEBUG-MODE-SPECIFIC FLAGS - ADD_CXX_DEBUG_DEFINITIONS("/fp:source") # Use source-specified floating point precision - ADD_CXX_DEBUG_DEFINITIONS("/Qtrapuv") # Initialize local variables to unusual values to help detect use uninitialized - ADD_CXX_DEBUG_DEFINITIONS("/check:stack,uninit") # Enables runtime checking of the stack (buffer over and underruns; pointer verification) and uninitialized variables - ADD_CXX_DEBUG_DEFINITIONS("/Gs0") # Enable stack checking for all functions - ADD_CXX_DEBUG_DEFINITIONS("/GS") # Buffer overrun detection - ADD_CXX_DEBUG_DEFINITIONS("/Qfp-stack-check") # Tells the compiler to generate extra code after every function call to ensure fp stack is as expected - ADD_CXX_DEBUG_DEFINITIONS("/traceback") # Enables traceback on error - -ELSEIF ( UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" ) - - # Disabled Warnings: Enable some of these as more serious warnings are addressed - # 161 Unrecognized pragma - # 177 Variable declared but never referenced - # 488 Template parameter not used ... - # 809 Exception specification consistency warnings that fire in gtest code - # 869 Parameter never referenced - # 1786 Use of deprecated items - # 2259 Non-pointer conversions may lose significant bits - # 3280 Declaration hides variable - # 10382 xHOST remark - # 11074 Inlining inhibited - # 11075 Inlining inhibited - - # COMPILER FLAGS - ADD_CXX_DEFINITIONS("-std=c++11") # Specify C++11 language - ADD_CXX_DEFINITIONS("-Wall") # Enable "all" warnings - ADD_CXX_DEFINITIONS("-diag-disable:161,177,488,809,869,1786,2259,3280,10382,11074,11075") # Disable warnings listed above - - IF(NOT APPLE) - ADD_CXX_DEFINITIONS(-pthread) - ENDIF() - - # ADDITIONAL RELEASE-MODE-SPECIFIC FLAGS - ADD_CXX_RELEASE_DEFINITIONS("-O3") # Agressive optimization - # ADD_CXX_RELEASE_DEFINITIONS("-Ofast") # More aggressive optimizations (instead of -O3) (enables -no-prec-div and -fp-model fast=2) - ADD_CXX_RELEASE_DEFINITIONS("-no-prec-div") # Faster division (enabled by -Ofast) - ADD_CXX_RELEASE_DEFINITIONS("-ansi-alias") # Enables more aggressive optimizations on floating-point data - ADD_CXX_RELEASE_DEFINITIONS("-ip") # Enables inter-procedural optimnization within a single file - ADD_CXX_RELEASE_DEFINITIONS("-inline-factor=225") # Enables more aggressive inlining - - # ADDITIONAL DEBUG-MODE-SPECIFIC FLAGS - ADD_CXX_DEBUG_DEFINITIONS("-strict-ansi") # Strict language conformance: Performance impact so limit to debug build - ADD_CXX_DEBUG_DEFINITIONS("-fp-model source") # Use source-specified floating point precision - ADD_CXX_DEBUG_DEFINITIONS("-ftrapuv") # Initialize local variables to unusual values to help detect use uninitialized - ADD_CXX_DEBUG_DEFINITIONS("-check=stack,uninit") # Enables runtime checking of the stack (buffer over and underruns; pointer verification) and uninitialized variables - ADD_CXX_DEBUG_DEFINITIONS("-fstack-security-check") # Buffer overrun detection - ADD_CXX_DEBUG_DEFINITIONS("-fp-stack-check") # Check the floating point stack after every function call - ADD_CXX_DEBUG_DEFINITIONS("-traceback") # Enables traceback on error - -ENDIF () # COMPILER TYPE diff --git a/third_party/penumbra/cmake/initialize-submodules.cmake b/third_party/penumbra/cmake/initialize-submodules.cmake new file mode 100644 index 00000000000..ba17543f48e --- /dev/null +++ b/third_party/penumbra/cmake/initialize-submodules.cmake @@ -0,0 +1,27 @@ +macro(initialize_submodules) + if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") + set(git_modules_file "${PROJECT_SOURCE_DIR}/.gitmodules") + if (EXISTS ${git_modules_file}) + file(STRINGS ${git_modules_file} file_lines) + foreach(line ${file_lines}) + if (${line} MATCHES "url =") + string(REGEX REPLACE "\\s*url = .*/(.*).git" "\\1" submodule "${line}") + string(STRIP "${submodule}" submodule) + if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${submodule}") + message(FATAL_ERROR "Submodule directory \"${CMAKE_CURRENT_SOURCE_DIR}/${submodule}\" does not exist") + endif() + # Initialize submodule if it hasn't already been cloned + if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${submodule}/.git") + message(STATUS "Initialize ${submodule} submodule") + execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive "${CMAKE_CURRENT_SOURCE_DIR}/${submodule}" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE GIT_SUBMOD_RESULT) + if(NOT GIT_SUBMOD_RESULT EQUAL "0") + message(FATAL_ERROR "git submodule update --init --recursive ${CMAKE_CURRENT_SOURCE_DIR}/${submodule} failed with ${GIT_SUBMOD_RESULT}, please checkout submodules") + endif() + endif() + endif() + endforeach() + endif() + endif() +endmacro() \ No newline at end of file diff --git a/third_party/penumbra/examples/CMakeLists.txt b/third_party/penumbra/examples/CMakeLists.txt deleted file mode 100644 index e17e3038bd0..00000000000 --- a/third_party/penumbra/examples/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -include_directories("${penumbra_SOURCE_DIR}/include") - -if (MSVC) - add_definitions(-D_CRT_SECURE_NO_WARNINGS) -endif() - -if (WIN32) - set(ICON glfw.rc) -elseif (APPLE) - set(ICON glfw.icns) - set_source_files_properties(glfw.icns PROPERTIES - MAXOSX_PACKAGE_LOCATION "Resources") -endif() - -link_libraries(penumbra) - -add_executable(awning WIN32 MACOSX_BUNDLE awning.cpp ${ICON}) - -set(EXE_BINARIES awning) - -if (MSVC) - # Tell MSVC to use main instead of WinMain for Windows subsystem executables - set_target_properties(${EXE_BINARIES} PROPERTIES - LINK_FLAGS "/ENTRY:mainCRTStartup") - set_target_properties(${EXE_BINARIES} PROPERTIES - LINK_FLAGS "/SUBSYSTEM:CONSOLE") - set_target_properties(${EXE_BINARIES} PROPERTIES COMPILE_DEFINITIONS "_CONSOLE") -endif() - -if (APPLE) - set_target_properties(awning PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Awning") - - set_target_properties(${EXE_BINARIES} PROPERTIES - RESOURCE glfw.icns - MACOSX_BUNDLE_SHORT_VERSION_STRING "0" - MACOSX_BUNDLE_LONG_VERSION_STRING "0" - MACOSX_BUNDLE_ICON_FILE glfw.icns ) -endif() diff --git a/third_party/penumbra/examples/awning.cpp b/third_party/penumbra/examples/awning.cpp deleted file mode 100644 index ef4f1a45a42..00000000000 --- a/third_party/penumbra/examples/awning.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* Copyright (c) 2017 Big Ladder Software and Chip Barnaby. All rights reserved. - * See the LICENSE file for additional terms and conditions. */ - -// Standard -#include - -// Penumbra -#include - -void errorCallback(const int messageType, const std::string &message, void * /*contextPtr*/ -) { - if (messageType == Pumbra::MSG_INFO) { - std::cout << " NOTE: " << message << std::endl; - } else if (messageType == Pumbra::MSG_WARN) { - std::cout << " WARNING: " << message << std::endl; - } else if (messageType == Pumbra::MSG_ERR) { - std::cout << " ERROR: " << message << std::endl; - exit(EXIT_FAILURE); - } -} - -int main(void) { - Pumbra::Polygon wallVerts = {0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 1.f, 0.f, 1.f, 0.f, 0.f, 1.f}; - - Pumbra::Polygon windowVerts = {0.25f, 0.f, 0.25f, 0.75f, 0.f, 0.25f, - 0.75f, 0.f, 0.5f, 0.25f, 0.f, 0.5f}; - - Pumbra::Polygon awningVerts = {0.25f, 0.f, 0.5f, 0.75f, 0.f, 0.5f, - 0.75f, -0.5f, 0.5f, 0.25f, -0.5f, 0.5f}; - - Pumbra::Surface wall(wallVerts); - wall.addHole(windowVerts); - - Pumbra::Surface window(windowVerts); - Pumbra::Surface awning(awningVerts); - - Pumbra::Penumbra::isValidContext(); - - Pumbra::Penumbra pumbra(errorCallback); - - unsigned wallId = pumbra.addSurface(wall); - unsigned windowId = pumbra.addSurface(window); - // unsigned awningId = pumbra.addSurface(awning); - - pumbra.setModel(); - pumbra.setSunPosition(2.50f, 0.3f); - // pumbra.setSunPosition(3.14f, 0.0f); - pumbra.renderScene(wallId); - float wallPSSA = pumbra.calculatePSSA(wallId); - - std::cout << "Wall PSSA: " << wallPSSA << std::endl; - - pumbra.renderScene(windowId); - float windowPSSA = pumbra.calculatePSSA(windowId); - - std::cout << "Window PSSA: " << windowPSSA << std::endl; - - pumbra.clearModel(); - - Pumbra::Polygon finVerts = {0.75f, -0.25f, 0.5f, 0.75f, -0.25f, 0.25f, - 0.75f, 0.0f, 0.25f, 0.75f, 0.0f, 0.5f}; - - Pumbra::Surface fin(finVerts); - - windowId = pumbra.addSurface(window); - // awningId = pumbra.addSurface(awning); - /*unsigned finID = */ pumbra.addSurface(fin); - - pumbra.setModel(); - - pumbra.renderScene(windowId); - windowPSSA = pumbra.calculatePSSA(windowId); - - std::cout << "Window PSSA with fin: " << windowPSSA << std::endl; - - return 0; -} diff --git a/third_party/penumbra/examples/glfw.icns b/third_party/penumbra/examples/glfw.icns deleted file mode 100644 index ad98f39752132003199572e951ee6d99dcceb823..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 27988 zcmeI)`CC(08VB%`#c-tog0dGS$YQIq6hwk$35!Z9A`(Q9U6h)#FKSo{0YP8@6^j%V z8`?nysw^TF5FrS~TD2gHRA@m>5d~SpXp|zo$qdiKbpC-(dAUE_b9nB_C7MLj z=W+tWq7e#pbK7Z8M+iA`qD@Wkvr;r8G#DWQ#tD)386na>8RNuA`Xow>w9mvifyNAk zWKZB{3xw3?7sk)e&Cbp9W_k12EVl4k^Gp0^!E%0X@iBorEj}i2v&F{*wqU=+`QYt? zz>*eNsJ(c7MvE)RQfnvwsbVg!o`3&#@}Jg+#cRdiznzRNB#$Ls3gFFy00@8p2!H?x zfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=9 z00@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2!Oy}L}1~`Lzynl+vH?5Wbub$$gvz9 zT=AzC;Y|XCh96*SXle7ER@P0QXo6K9x#{b8=a3nnABs-E8yL%i$U^r_Y>?FTVBWj=9PxdxAcYS^Jqdt<3QD>x!u#_Vvz69yR`Mk{p6!*4-Kl_ezVSWxLMT39PhoAK zSg0N4W#VIcT*>a;sX$6~MqREb%>GJh;rnOL-Ho>S&AMjY*X`ZqW%&ngu5w6FJFd5} z$iIa;zS*OaU{Z22o!Yo6Vi%i4a>{e*cFj}Eyc8gRU@Ufs*Am%UAa}X*=IDx&MUW>)*YUmwkgtT%S77p^*bukNd@ zeo7OU<2ySll4f431kdIca@O;?GJ+QQYXzjKw-ttSmFuUg>7#(DLa?6~2}HolO3%`1-e<0nRr6^`Hk!0$GYV+D4u?tVF7`5m``Yd|R! z-0bOjRmG@C*-LU>rp&cXH(*qUzOxVR+ip+mWoBU~~ZX#jwv)R{ENj~Zg=fcd+DNHtwh{^s!VUUPF6cjDo zKGQ^rxbwTJCyL~*sCjY>A&M)@!PbpS80&79L)tV_mC!eDhY-{4Qwx`gbXSkRFR~z# zPZ5($YC6c6C4ux<5ldZ0W!5G!%BTSOWw}=$FcjI$1m8V6gsTiXt(_7a1qu)_-C69o8X|x%? zg$&#RpkPM9=K>1I|6!$#Ah_-!r)o9Ci12`kSX-PO%I*A979N24zj2g^Uq$?P9G&5I zzlAsoaTMa{QjMd^xBe4HA67}@X!Eenj~64!D?(p-%dGZ$T-9sI*J1Jyfk<{GCat?t zNycb&CQpFJOiLpEON@res-fo2E&9@nD0s${Hf#wbx<~yF(yIjs4_A_5^bhJnq6D3$ic`2=D=;K{Y@y4KSDn_~HrG z0Hy&<14*`oMFFY-OasYRFIW_y8o)GweFNB$f$byMnEUJRA_|t-?xUo-Utj+7fB*X@ M%pLDj?WqX;0VcM~e*gdg diff --git a/third_party/penumbra/examples/glfw.ico b/third_party/penumbra/examples/glfw.ico deleted file mode 100644 index 882a66051e351ce313238ca673bd11812ea77fd6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21630 zcmeI4ze{9S6vvOrWSIpM)N!y z<+8}P+}hln`D-FC-W7TBWbpUj7WsKYeVrJ|vn7$wJ{0ah_`kd*^3_M`YyMbXjzzxs zShqLC_aBKo`oy+R{5_E`Keg?TW&a(K)z3wqaqkHbqQ0lB8Ps-flqT^L3WNfoKqwFj zgaV;JC=d#S0t=$Ry@p`E6WXV2!XCWoQ{Kn%V?ho_Jj_ra6bJ=Eflwe62n9lcP#_ct z1ww&PAQT7%LV-{q6bJ=Eflwe62n9lc1yR6X4-0>;3g~r8{RZX)-dv~TyPWsNf;=7L zVTJ;KsKC7!#9y1Z`#Kx-J5O(ILSKW*Fs35>$aFdw*4&h{voov)TK|#O^cJw_6ssR* z%70-yW9G?pk4neKfd}+ z&fC}hJn+*8-^lal-)p9fMk5)I$FjVIS8yk{RlC7;R+1}ok zot+)o-QAVFy*hj*Vor_b92+rLx~zP6sXYaXOi7Yh5{8DXkr3(Ed?qx&^sr{KnYTzfo?ECh60o# z4Rj|7GH?!;3VL2-wlA4=feH<@m<$CfG|=J_WGGOfffk$~LxBnn^g$%ZP@qBseP9VP z6sXXE9kA!zm%_S20~H`ah5{8Ds3-{vRA`_gCCE^qLIV{pL52bq8mO2FG8CxLfDKWL zR#Ey=S@Tyj)WSSuC{Uq+9*6`P3RGyI2PZ*>3JsPxSP3!|sL((UV1f({hYSTOG++bN!aNkH(149n3-kJc0xC3MN7TYR6sXXEowEz(p+JS#F+zb*U||*D zWb~jzKc{TM9xTc50cCpYbIO19dHl~lx7p`6i+gKvZ+)KmKF@rMduwrTeV+L~&wPt} zYjJOVp7}n{e2aT)ac_N|`99Bli+gKvZ+)KmKF@rMduwrTeV+L~&wPt}YjJOVp7}n{ ze2aT)ac_N|`99Bli+gKvZ+)KmKF@rMduwrTeV+L~&wPt}YjJOVp7}n{e2aT)ac?=j z#dtsk?!M2=`r*g73W|PM+cj;?v<=gii+-ZFQ`$Odo1`s~wm;hHXltWwjJ7P=o@gtg zZHKlP40=-*x$Gv*mTRm0 VVj`~F&hZW6f3mCD+3;_h-vJ|L*B$@> diff --git a/third_party/penumbra/examples/glfw.rc b/third_party/penumbra/examples/glfw.rc deleted file mode 100644 index f2b62f6c40b..00000000000 --- a/third_party/penumbra/examples/glfw.rc +++ /dev/null @@ -1,3 +0,0 @@ - -GLFW_ICON ICON "glfw.ico" - diff --git a/third_party/penumbra/include/penumbra/logging.h b/third_party/penumbra/include/penumbra/logging.h new file mode 100644 index 00000000000..3c37a4b44fb --- /dev/null +++ b/third_party/penumbra/include/penumbra/logging.h @@ -0,0 +1,56 @@ +/* Copyright (c) 2023 Big Ladder Software LLC. All rights reserved. + * See the LICENSE file for additional terms and conditions. */ + +#ifndef PENUMBRA_LOGGING_H_ +#define PENUMBRA_LOGGING_H_ + +#include + +namespace Penumbra { + +class PenumbraLogger : public Courierr::Courierr { +public: + void error(const std::string_view message) override { + write_message("ERROR", message); + } + + void warning(const std::string_view message) override { + write_message("WARNING", message); + } + + void info(const std::string_view message) override { + write_message("NOTE", message); + } + + void debug(const std::string_view message) override { + write_message("DEBUG", message); + } + +protected: + void write_message(const std::string_view message_type, const std::string_view message) { + std::string context_string = + message_context ? fmt::format(" ({})", *(reinterpret_cast(message_context))) + : ""; + std::cout << fmt::format(" [{}]{} {}", message_type, context_string, message) << std::endl; + } +}; + +class PenumbraException : public Courierr::CourierrException { +public: + explicit PenumbraException(const std::string &message, Courierr::Courierr &logger) + : CourierrException(message, logger) {} +}; + +class SurfaceException : public PenumbraException { +public: + explicit SurfaceException(const unsigned int surface_index, + const std::string_view &surface_context, Courierr::Courierr &logger) + : PenumbraException(fmt::format(error_message_format, surface_context, surface_index), + logger) {} + +private: + static constexpr std::string_view error_message_format = "{} index, {}, does not exist."; +}; +} // namespace Penumbra + +#endif // define PENUMBRA_LOGGING_H_ \ No newline at end of file diff --git a/third_party/penumbra/include/penumbra/penumbra.h b/third_party/penumbra/include/penumbra/penumbra.h index e0841502c7d..22f34719255 100644 --- a/third_party/penumbra/include/penumbra/penumbra.h +++ b/third_party/penumbra/include/penumbra/penumbra.h @@ -9,78 +9,61 @@ #include #include #include -#include +#include // Penumbra #include +#include -namespace Pumbra { +namespace Penumbra { -const int PN_SUCCESS = 0; -const int PN_FAILURE = 1; -const int MSG_INFO = 0; -const int MSG_WARN = 1; -const int MSG_ERR = 2; +enum class VendorType { unknown, nvidia, amd, intel, vmware, mesa }; -enum class VendorName { - None, - NVIDIA, - AMD, - Intel, - VMware -}; - -typedef void (*PenumbraCallbackFunction)(const int messageType, const std::string &message, - void *contextPtr); - -class PenumbraPrivate; - -void penumbraTerminate(); // Call once before exiting calling program to ensure safe cleanup of - // OpenGL memory +class PenumbraImplementation; class Penumbra { public: - Penumbra(unsigned size = 512u); - - Penumbra(PenumbraCallbackFunction callbackFunction, unsigned size = 512u); + explicit Penumbra(unsigned int size = 512u, const std::shared_ptr &logger = + std::make_shared()); - Penumbra(PenumbraCallbackFunction callbackFunction, void *contextPtr, unsigned size = 512u); + explicit Penumbra(const std::shared_ptr &logger); ~Penumbra(); public: - static bool isValidContext(); - unsigned addSurface(const Surface &surface); - int setModel(); - int clearModel(); - int setSunPosition(const float azm, // in radians, clockwise, north = 0 - const float alt // in radians, horizon = 0, vertical = pi/2 + static bool is_valid_context(); + unsigned int add_surface(const Surface &surface); + void set_model(); + void clear_model(); + void set_sun_position(float azimuth, // in radians, clockwise, north = 0 + float altitude // in radians, horizon = 0, vertical = pi/2 ); - float getSunAzimuth(); - float getSunAltitude(); - void submitPSSA(unsigned surfaceIndex); - void submitPSSA(const std::vector &surfaceIndices); - void submitPSSA(); - unsigned getNumSurfaces(); - float fetchPSSA(unsigned surfaceIndex); - std::vector fetchPSSA(const std::vector &surfaceIndices); - std::vector fetchPSSA(); - float calculatePSSA(unsigned surfaceIndex); - std::vector calculatePSSA(const std::vector &surfaceIndices); - std::vector calculatePSSA(); - std::map calculateInteriorPSSAs(const std::vector &transparentSurfaceIndices, - const std::vector &interiorSurfaceIndices); - int renderScene(unsigned surfaceIndex); // Primarily for debug purposes - int renderInteriorScene( - std::vector transparentSurfaceIndices, - std::vector interiorSurfaceIndices); // Primarily for debug purposes - void setMessageCallback(PenumbraCallbackFunction callbackFunction, void *contextPtr); - VendorName getVendorName(); + float get_sun_azimuth(); + float get_sun_altitude(); + void submit_pssa(unsigned int surface_index); + void submit_pssa(const std::vector &surface_indices); + void submit_pssa(); + unsigned int get_number_of_surfaces(); + float retrieve_pssa(unsigned int surface_index); + std::vector retrieve_pssa(const std::vector &surface_indices); + std::vector retrieve_pssa(); + float calculate_pssa(unsigned int surface_index); + std::vector calculate_pssa(const std::vector &surface_indices); + std::vector calculate_pssa(); + std::unordered_map + calculate_interior_pssas(const std::vector &transparent_surface_indices, + const std::vector &interior_surface_indices); + void render_scene(unsigned int surface_index); // Primarily for debug purposes + void render_interior_scene( + const std::vector &transparent_surface_indices, + const std::vector &interior_surface_indices); // Primarily for debug purposes + VendorType get_vendor_name(); + std::shared_ptr get_logger(); private: - std::unique_ptr penumbra; + std::unique_ptr penumbra; }; -} // namespace Pumbra +} // namespace Penumbra #endif /* PENUMBRA_H_ */ diff --git a/third_party/penumbra/include/penumbra/surface.h b/third_party/penumbra/include/penumbra/surface.h index 1458a9e6190..433f639abd4 100644 --- a/third_party/penumbra/include/penumbra/surface.h +++ b/third_party/penumbra/include/penumbra/surface.h @@ -8,28 +8,27 @@ #include #include #include +#include -namespace Pumbra { +namespace Penumbra { typedef std::vector Polygon; // Implicit list of 3D coordinates -class SurfacePrivate; +class SurfaceImplementation; class Surface { - friend class PenumbraPrivate; + friend class PenumbraImplementation; public: Surface(); - Surface(const Polygon &polygon); - Surface(const Surface &srf); + explicit Surface(const Polygon &polygon, const std::string &name = ""); + Surface(const Surface &surface); ~Surface(); - int setOuterPolygon( - const Polygon &polygon); // Defined in counter-clockwise order when facing front - int addHole(const Polygon &hole); // Defined in counter-clockwise order when facing front + void add_hole(const Polygon &hole); // Defined in counter-clockwise order when facing front private: - std::shared_ptr surface; + std::shared_ptr surface; }; -} // namespace Pumbra +} // namespace Penumbra #endif // SURFACE_H_ diff --git a/third_party/penumbra/src/CMakeLists.txt b/third_party/penumbra/src/CMakeLists.txt index 8212e99c35a..eef03e9d994 100644 --- a/third_party/penumbra/src/CMakeLists.txt +++ b/third_party/penumbra/src/CMakeLists.txt @@ -1,7 +1,7 @@ # Main library -file(GLOB_RECURSE sources "${penumbra_SOURCE_DIR}/src/[a-zA-Z]*.cpp") -file(GLOB_RECURSE public_headers "${penumbra_SOURCE_DIR}/include/penumbra/[a-zA-Z]*.h") -file(GLOB_RECURSE private_headers "${penumbra_SOURCE_DIR}/src/[a-zA-Z]*.h") +file(GLOB_RECURSE sources "${PROJECT_SOURCE_DIR}/src/[a-zA-Z]*.cpp") +file(GLOB_RECURSE public_headers "${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/[a-zA-Z]*.h") +file(GLOB_RECURSE private_headers "${PROJECT_SOURCE_DIR}/src/[a-zA-Z]*.h") set(library_sources ${sources} @@ -9,31 +9,37 @@ set(library_sources ${private_headers} ) -include_directories(${penumbra_SOURCE_DIR}/include) -include_directories(${penumbra_SOURCE_DIR}/src) -include_directories(SYSTEM ${penumbra_SOURCE_DIR}/vendor/glad/include) -include_directories(SYSTEM ${penumbra_SOURCE_DIR}/vendor/glfw/include) -include_directories(SYSTEM ${penumbra_SOURCE_DIR}/vendor/glfw/deps) -include_directories(SYSTEM ${penumbra_SOURCE_DIR}/vendor/libtess2/Include) +option( ${PROJECT_NAME}_STATIC_LIB "Make ${PROJECT_NAME} a static library" ON ) -option( PENUMBRA_STATIC_LIB "Make penumbra a static library" ON ) - -if (PENUMBRA_STATIC_LIB) - add_library(penumbra STATIC ${library_sources}) - set_target_properties(penumbra PROPERTIES COMPILE_FLAGS "-DPENUMBRA_STATIC_DEFINE") +if (${PROJECT_NAME}_STATIC_LIB) + add_library(${PROJECT_NAME} STATIC ${library_sources}) + set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-D${PROJECT_NAME}_STATIC_DEFINE") else() set(CMAKE_MACOSX_RPATH 1) - add_library(penumbra SHARED ${library_sources}) - if(UNIX) - set_target_properties(tess2 PROPERTIES COMPILE_FLAGS "-fPIC") - endif() + add_library(${PROJECT_NAME} SHARED ${library_sources}) endif() +target_include_directories(${PROJECT_NAME} + PUBLIC + ${PROJECT_SOURCE_DIR}/include + PRIVATE + ${PROJECT_SOURCE_DIR}/src +) + include(GenerateExportHeader) -generate_export_header(penumbra) +generate_export_header(${PROJECT_NAME}) -target_link_libraries(penumbra glad glfw tess2) +target_link_libraries(${PROJECT_NAME} PRIVATE glad glfw tess2 penumbra_common_interface PUBLIC courierr fmt) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) + +# If MSVC_RUNTIME_LIBRARY is not by a parent project use the default. +# It's not clear why this is needed, since documentation indicates it +# should be happening with the CMP0091 policy set to NEW. +get_target_property(RTL ${PROJECT_NAME} MSVC_RUNTIME_LIBRARY) +if ("${RTL}" STREQUAL "RTL-NOTFOUND") + set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") +endif() -if (PENUMBRA_COVERAGE) - add_coverage(penumbra) +if (${PROJECT_NAME}_COVERAGE) + add_coverage(${PROJECT_NAME}) endif() diff --git a/third_party/penumbra/src/error.cpp b/third_party/penumbra/src/error.cpp deleted file mode 100644 index ef4f2b9cfab..00000000000 --- a/third_party/penumbra/src/error.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2017 Big Ladder Software LLC. All rights reserved. - * See the LICENSE file for additional terms and conditions. */ - -// Standard -#include - -// Penumbra -#include "error.h" - -namespace Pumbra { - -PenumbraCallbackFunction penumbraCallbackFunction; -void *messageCallbackContextPtr; - -void showMessage(const int messageType, const std::string message) { - if (penumbraCallbackFunction != nullptr) { - (*penumbraCallbackFunction)(messageType, message, messageCallbackContextPtr); - } else { - if (messageType == MSG_ERR) { - std::cerr << "Error: " << message << std::endl; - exit(EXIT_FAILURE); - } else if (messageType == MSG_WARN) { - std::cerr << "Warning: " << message << std::endl; - } else /*if (messageType == MSG_INFO)*/ { - std::cout << "Note: " << message << std::endl; - } - } -} - -} // namespace Pumbra diff --git a/third_party/penumbra/src/error.h b/third_party/penumbra/src/error.h deleted file mode 100644 index 8325c3df022..00000000000 --- a/third_party/penumbra/src/error.h +++ /dev/null @@ -1,18 +0,0 @@ -/* Copyright (c) 2017 Big Ladder Software LLC. All rights reserved. - * See the LICENSE file for additional terms and conditions. */ - -#ifndef PENUMBRA_ERROR_H_ -#define PENUMBRA_ERROR_H_ - -// Penumbra -#include - -namespace Pumbra { - -extern PenumbraCallbackFunction penumbraCallbackFunction; -extern void *messageCallbackContextPtr; - -void showMessage(const int messageType, const std::string message); - -} // namespace Pumbra -#endif // PENUMBRA_ERROR_H_ diff --git a/third_party/penumbra/src/gl/context.cpp b/third_party/penumbra/src/gl/context.cpp index a240e02a5c8..9fe66dbe833 100644 --- a/third_party/penumbra/src/gl/context.cpp +++ b/third_party/penumbra/src/gl/context.cpp @@ -8,12 +8,12 @@ #endif // Penumbra +#include #include "context.h" -#include "../error.h" -namespace Pumbra { +namespace Penumbra { -const char *Context::renderVertexShaderSource = +const char *Context::render_vertex_shader_source = R"src( #version 120 uniform mat4 MVP; @@ -27,7 +27,7 @@ const char *Context::renderVertexShaderSource = } )src"; -const char *Context::renderFragmentShaderSource = +const char *Context::render_fragment_shader_source = R"src( #version 120 varying vec3 color; @@ -37,7 +37,7 @@ const char *Context::renderFragmentShaderSource = } )src"; -const char *Context::calculationVertexShaderSource = +const char *Context::calculation_vertex_shader_source = R"src( #version 120 uniform mat4 MVP; @@ -48,19 +48,24 @@ const char *Context::calculationVertexShaderSource = } )src"; -static void glErrorCallback(int, const char *description) { - showMessage(MSG_INFO, description); +thread_local static Courierr::Courierr *glfw_logger{nullptr}; + +static void glfw_error_callback(int, const char *description) { + if (glfw_logger) { + glfw_logger->info(fmt::format("GLFW message: {}", description)); + } } -Context::Context(unsigned size) - : size(size), modelSet(false), isWireFrame(false), isCameraMode(false), viewScale(1.f), - cameraRotAngleX(0.f), cameraRotAngleY(0.f), lbutton_down(true), isRenderMode(false) { +Context::Context(GLint size_in, Courierr::Courierr *logger_in) : size(size_in), logger(logger_in) { - glfwSetErrorCallback(glErrorCallback); + glfw_logger = logger; + glfwSetErrorCallback(glfw_error_callback); if (!glfwInit()) { - showMessage(MSG_ERR, "Unable to initialize GLFW."); - showMessage(MSG_ERR, "Either there is no GPU, libraries are missing, or some other error happened."); + throw PenumbraException( + "Unable to initialize GLFW. Either there is no GPU, libraries are missing, or " + "some other error happened.", + *logger); } glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); @@ -72,7 +77,7 @@ Context::Context(unsigned size) fedisableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); #endif #endif - window = glfwCreateWindow(1, 1, "Penumbra", NULL, NULL); + window = glfwCreateWindow(1, 1, "Penumbra", nullptr, nullptr); #ifndef NDEBUG #ifdef __unix__ feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); @@ -80,37 +85,39 @@ Context::Context(unsigned size) #endif glfwMakeContextCurrent(window); if (!window) { - showMessage( - MSG_ERR, - "Unable to create OpenGL context. OpenGL 2.1+ is required to perform GPU accelerated shading calculations."); + throw PenumbraException( + "Unable to create OpenGL context. OpenGL 2.1+ is required to perform GPU " + "accelerated shading calculations.", + *logger); } // OpenGL extension loader if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { - showMessage(MSG_ERR, "Failed to load OpenGL extensions."); + throw PenumbraException("Failed to load required OpenGL extensions.", *logger); } if (!glfwExtensionSupported("GL_ARB_vertex_array_object") && !glfwExtensionSupported("GL_APPLE_vertex_array_object")) { - showMessage(MSG_ERR, "The current version of OpenGL does not support vertex array objects."); + throw PenumbraException("The current version of OpenGL does not support vertex array objects.", + *logger); } if (!glfwExtensionSupported("GL_EXT_framebuffer_object")) { - showMessage(MSG_ERR, "The current version of OpenGL does not support framebuffer objects."); + throw PenumbraException("The current version of OpenGL does not support framebuffer objects.", + *logger); } - // std::string glVersion = (char*)glGetString(GL_VERSION); - // showMessage(MSG_INFO, "OpenGL version = " + glVersion); GLint max_view_size[2]; glGetIntegerv(GL_MAX_VIEWPORT_DIMS, &max_view_size[0]); - GLuint max_res = std::min(GL_MAX_RENDERBUFFER_SIZE_EXT, max_view_size[0]); + GLint max_res = std::min(GL_MAX_RENDERBUFFER_SIZE_EXT, max_view_size[0]); if (size >= max_res) { - showMessage(MSG_WARN, - "The selected resolution is larger than the maximum allowable by your hardware. " - "The size will be reset to be equal to the maximum allowable."); // TODO: Format - this->size = max_res; + logger->warning( + fmt::format("The selected resolution, {}, is larger than the maximum allowable by your " + "hardware, {}. The size will be reset to be equal to the maximum allowable.", + size, max_res)); + size = max_res; } - glViewport(0, 0, this->size, this->size); + glViewport(0, 0, size, size); // Input callbacks for orbit mode glfwSetWindowUserPointer(window, this); @@ -118,61 +125,65 @@ Context::Context(unsigned size) auto key_callback = [](GLFWwindow *w, int key, int /*scancode*/, int action, int /*mods*/) { if (key == GLFW_KEY_W && action == GLFW_PRESS) { - glfwWPtr(w)->toggleWireFrame(); + glfwWPtr(w)->toggle_wire_frame_mode(); } if (key == GLFW_KEY_O && action == GLFW_PRESS) { - glfwWPtr(w)->toggleCameraMode(); + glfwWPtr(w)->toggle_camera_mode(); } }; auto scroll_callback = [](GLFWwindow *w, double /*xOffset*/, double yOffset) { - glfwWPtr(w)->viewScale += 0.1f * yOffset; + glfwWPtr(w)->view_scale += static_cast(0.1 * yOffset); - if (glfwWPtr(w)->isCameraMode) { - glfwWPtr(w)->setCameraMVP(); + if (glfwWPtr(w)->is_camera_mode) { + glfwWPtr(w)->set_camera_mvp(); } }; auto mouse_callback = [](GLFWwindow *w, int button, int action, int /*mods*/) { - // Set a booleon to tell if the left button is down. And at the actual press, initialize the - // curosor position. Note that you only come in here the moments the button is pressed and + // Set a boolean to tell if the left button is down. And at the actual press, initialize the + // cursor position. Note that you only come in here the moments the button is pressed and // released, not between. if (button == GLFW_MOUSE_BUTTON_LEFT) { if (GLFW_PRESS == action) { - glfwWPtr(w)->lbutton_down = true; - glfwGetCursorPos(w, &glfwWPtr(w)->prevPosX, &glfwWPtr(w)->prevPosY); + glfwWPtr(w)->left_mouse_button_pressed = true; + glfwGetCursorPos(w, &glfwWPtr(w)->previous_x_position, &glfwWPtr(w)->previous_y_position); } else if (GLFW_RELEASE == action) { - glfwWPtr(w)->lbutton_down = false; + glfwWPtr(w)->left_mouse_button_pressed = false; } } }; - auto cursor_Pos_callback = [](GLFWwindow *w, double xPos, double yPos) { + auto cursor_position_callback = [](GLFWwindow *w, double x_position, double y_position) { // Constantly monitored cursor position. - if (glfwWPtr(w)->lbutton_down && glfwWPtr(w)->isCameraMode) { + if (glfwWPtr(w)->left_mouse_button_pressed && glfwWPtr(w)->is_camera_mode) { - static const double rotationSpeed = 1. / 300.; + static constexpr double rotation_speed = 1. / 300.; - glfwWPtr(w)->cameraRotAngleX = - -(yPos - glfwWPtr(w)->prevPosY) * rotationSpeed; // Y motion should produce x rotation - glfwWPtr(w)->cameraRotAngleY = - (xPos - glfwWPtr(w)->prevPosX) * rotationSpeed; // X motion should produce -y rotation + glfwWPtr(w)->camera_x_rotation_angle = + static_cast(-(y_position - glfwWPtr(w)->previous_y_position) * + rotation_speed); // Y motion should produce x rotation + glfwWPtr(w)->camera_y_rotation_angle = + static_cast((x_position - glfwWPtr(w)->previous_x_position) * + rotation_speed); // X motion should produce -y rotation - glfwWPtr(w)->prevPosX = xPos; - glfwWPtr(w)->prevPosY = yPos; + glfwWPtr(w)->previous_x_position = x_position; + glfwWPtr(w)->previous_y_position = y_position; - glfwWPtr(w)->calcCameraView(); - glfwWPtr(w)->setCameraMVP(); + glfwWPtr(w)->calculate_camera_view(); + glfwWPtr(w)->set_camera_mvp(); } }; +#undef glfwWPtr + glfwSetKeyCallback(window, key_callback); glfwSetScrollCallback(window, scroll_callback); glfwSetMouseButtonCallback(window, mouse_callback); - glfwSetCursorPosCallback(window, cursor_Pos_callback); + glfwSetCursorPosCallback(window, cursor_position_callback); glfwSwapInterval(1); @@ -181,118 +192,120 @@ Context::Context(unsigned size) // Shader programs // Program for off-screen calculation - calcProgram = std::unique_ptr(new GLProgram(calculationVertexShaderSource, nullptr)); + calculation_program = + std::make_unique(calculation_vertex_shader_source, nullptr, logger); - glBindAttribLocation(calcProgram->getInt(), 0, "vPos"); + glBindAttribLocation(calculation_program->get(), 0, "vPos"); // Program for on-screen rendering (mostly for debugging) - renderProgram = std::unique_ptr( - new GLProgram(renderVertexShaderSource, renderFragmentShaderSource)); - glBindAttribLocation(renderProgram->getInt(), 0, "vPos"); - vColLocation = glGetUniformLocation(renderProgram->getInt(), "vCol"); + render_program = std::make_unique(render_vertex_shader_source, + render_fragment_shader_source, logger); + glBindAttribLocation(render_program->get(), 0, "vPos"); + vertex_color_location = glGetUniformLocation(render_program->get(), "vCol"); // Frame and render buffers - glGenFramebuffersEXT(1, &fbo); - glGenRenderbuffersEXT(1, &rbo); + glGenFramebuffersEXT(1, &framebuffer_object); + glGenRenderbuffersEXT(1, &renderbuffer_object); // Start in off-screen mode - initOffScreenMode(); + initialize_off_screen_mode(); } Context::~Context() { - glDeleteQueries(queries.size(), queries.data()); - glDeleteFramebuffersEXT(1, &fbo); - glDeleteRenderbuffersEXT(1, &rbo); - glDeleteProgram(calcProgram->getInt()); - glDeleteProgram(renderProgram->getInt()); - glfwDestroyWindow(window); + glDeleteQueries(static_cast(queries.size()), queries.data()); + glDeleteFramebuffersEXT(1, &framebuffer_object); + glDeleteRenderbuffersEXT(1, &renderbuffer_object); + glDeleteProgram(calculation_program->get()); + glDeleteProgram(render_program->get()); + model.clear_model(); + glfwTerminate(); } -void Context::toggleWireFrame() { - isWireFrame = !isWireFrame; - if (isWireFrame) { +void Context::toggle_wire_frame_mode() { + is_wire_frame_mode = !is_wire_frame_mode; + if (is_wire_frame_mode) { glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); } else { glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } } -void Context::toggleCameraMode() { - isCameraMode = !isCameraMode; - lbutton_down = +void Context::toggle_camera_mode() { + is_camera_mode = !is_camera_mode; + left_mouse_button_pressed = false; // There are things, like killing the last window, that may have left this true. - if (isCameraMode) { - viewScale = 1.0; - mat4x4_dup(cameraView, view); - setCameraMVP(); + if (is_camera_mode) { + view_scale = 1.0; + mat4x4_dup(camera_view, view); + set_camera_mvp(); } else { - setMVP(); + set_mvp(); } } -std::string Context::vendorName() { - return reinterpret_cast(glGetString(GL_VENDOR)); +std::string Context::get_vendor_name() { + return reinterpret_cast(glGetString(GL_VENDOR)); } -void Context::clearModel() { - model.clearModel(); - glDeleteQueries(queries.size(), queries.data()); - modelSet = false; +void Context::clear_model() { + model.clear_model(); + glDeleteQueries(static_cast(queries.size()), queries.data()); + model_is_set = false; } -void Context::setModel(const std::vector &vertices, const std::vector &surfaceBuffers) { - if (modelSet) { - clearModel(); +void Context::set_model(const std::vector &vertices, + const std::vector &surface_buffers) { + if (model_is_set) { + clear_model(); } // set model vertices - model.setVertices(vertices); - model.setSurfaceBuffers(surfaceBuffers); - queries.resize(surfaceBuffers.size()); - // queries.resize(bufferSize); - // indexBuffer = std::vector(bufferSize, -1); - pixelAreas.resize(surfaceBuffers.size()); - pixelCounts = std::vector(surfaceBuffers.size(), -1); + model.set_vertices(vertices); + model.set_surface_buffers(surface_buffers); + queries.resize(surface_buffers.size()); + pixel_areas.resize(surface_buffers.size()); + pixel_counts = std::vector(surface_buffers.size(), -1); - glGenQueries(queries.size(), queries.data()); + glGenQueries(static_cast(queries.size()), queries.data()); - float bLeft = MAX_FLOAT, bBottom = MAX_FLOAT, bFront = MAX_FLOAT; - float bRight = -MAX_FLOAT, bTop = -MAX_FLOAT, bBack = -MAX_FLOAT; + float box_left = MAX_FLOAT, box_bottom = MAX_FLOAT, box_front = MAX_FLOAT; + float box_right = -MAX_FLOAT, box_top = -MAX_FLOAT, box_back = -MAX_FLOAT; // calculate bounding box - for (int i = 0; i < (int)vertices.size(); i += model.vertexSize) { + for (int i = 0; i < (int)vertices.size(); i += GLModel::vertex_size) { float x = vertices[i]; float y = vertices[i + 1]; float z = vertices[i + 2]; - bLeft = std::min(x, bLeft); - bRight = std::max(x, bRight); - bFront = std::min(y, bFront); - bBack = std::max(y, bBack); - bBottom = std::min(z, bBottom); - bTop = std::max(z, bTop); + box_left = std::min(x, box_left); + box_right = std::max(x, box_right); + box_front = std::min(y, box_front); + box_back = std::max(y, box_back); + box_bottom = std::min(z, box_bottom); + box_top = std::max(z, box_top); } - float tempBox[8][4] = {{bLeft, bFront, bBottom, 0.0}, {bLeft, bFront, bTop, 0.0}, - {bLeft, bBack, bBottom, 0.0}, {bLeft, bBack, bTop, 0.0}, - {bRight, bFront, bBottom, 0.0}, {bRight, bFront, bTop, 0.0}, - {bRight, bBack, bBottom, 0.0}, {bRight, bBack, bTop, 0.0}}; + float tempBox[8][4] = { + {box_left, box_front, box_bottom, 0.0}, {box_left, box_front, box_top, 0.0}, + {box_left, box_back, box_bottom, 0.0}, {box_left, box_back, box_top, 0.0}, + {box_right, box_front, box_bottom, 0.0}, {box_right, box_front, box_top, 0.0}, + {box_right, box_back, box_bottom, 0.0}, {box_right, box_back, box_top, 0.0}}; for (std::size_t i = 0; i < 8; i++) { for (std::size_t j = 0; j < 4; j++) { - modelBox[i][j] = tempBox[i][j]; + model_bounding_box[i][j] = tempBox[i][j]; } } - modelSet = true; + model_is_set = true; } -float Context::setScene(mat4x4 sunView, const SurfaceBuffer *surfaceBuffer, bool clipFar) { +float Context::set_scene(mat4x4 sun_view, const SurfaceBuffer *surface_buffer, bool clip_far) { - if (!modelSet) { - showMessage(MSG_ERR, "Model has not been set. Cannot set OpenGL scene."); + if (!model_is_set) { + throw PenumbraException("Model has not been set. Cannot set OpenGL scene.", *logger); } - mat4x4_dup(view, sunView); + mat4x4_dup(view, sun_view); - // calculate clipping planes in rendered coorinates + // calculate clipping planes in rendered coordinates left = MAX_FLOAT; right = -MAX_FLOAT; bottom = MAX_FLOAT; @@ -301,110 +314,110 @@ float Context::setScene(mat4x4 sunView, const SurfaceBuffer *surfaceBuffer, bool far_ = MAX_FLOAT; // If surface buffer has not been set use entire model instead. - GLuint beg = surfaceBuffer ? surfaceBuffer->begin * model.vertexSize : 0; - GLuint end = surfaceBuffer ? surfaceBuffer->begin * model.vertexSize + surfaceBuffer->count * model.vertexSize : model.vertexArray.size(); - - for (GLuint i = beg; i < end; i += model.vertexSize) { - vec4 point = {model.vertexArray[i], model.vertexArray[i + 1], model.vertexArray[i + 2], 0}; - vec4 trans; - mat4x4_mul_vec4(trans, view, point); - left = std::min(trans[0], left); - right = std::max(trans[0], right); - bottom = std::min(trans[1], bottom); - top = std::max(trans[1], top); - // near_ = min(trans[2], near_); - far_ = std::min(trans[2], far_); + GLuint beg = surface_buffer ? surface_buffer->begin * GLModel::vertex_size : 0; + GLuint end = surface_buffer ? surface_buffer->begin * GLModel::vertex_size + + surface_buffer->count * GLModel::vertex_size + : static_cast(model.vertex_array.size()); + + for (GLuint i = beg; i < end; i += GLModel::vertex_size) { + vec4 translation; + vec4 point = {model.vertex_array[i], model.vertex_array[i + 1], model.vertex_array[i + 2], 0}; + mat4x4_mul_vec4(translation, view, point); + left = std::min(translation[0], left); + right = std::max(translation[0], right); + bottom = std::min(translation[1], bottom); + top = std::max(translation[1], top); + // near_ = min(translation[2], near_); + far_ = std::min(translation[2], far_); } // Use model box to determine near clipping plane (and far if looking interior) - for (std::size_t i = 0; i < 8; i++) { - vec4 trans; - mat4x4_mul_vec4(trans, view, modelBox[i]); - near_ = std::max(trans[2], near_); - if (!clipFar) { - far_ = std::min(trans[2], far_); + for (auto const coordinate : model_bounding_box) { + vec4 translation; + mat4x4_mul_vec4(translation, view, coordinate); + near_ = std::max(translation[2], near_); + if (!clip_far) { + far_ = std::min(translation[2], far_); } } // account for camera position near_ -= 0.999f; // For some reason, -1. is too tight when sun is perpendicular to the surface. - far_ -= 1.001f; // For some reason, -1. is too tight when sun is perpendicular to the surface. + far_ -= 1.001f; // For some reason, -1. is too tight when sun is perpendicular to the surface. // Grow horizontal extents of view by one pixel on each side - float deltaX = (right - left) / size; - left -= deltaX; - right += deltaX; + + const float inverse_size = 1.f / static_cast(size); + + const float delta_x = (right - left) * inverse_size; + left -= delta_x; + right += delta_x; // Grow vertical extents of view by one pixel on each side - float deltaY = (top - bottom) / size; - bottom -= deltaY; - top += deltaY; + const float delta_y = (top - bottom) * inverse_size; + bottom -= delta_y; + top += delta_y; // calculate pixel area (A[i]*cos(theta) for each pixel of the surface) // multiplies by the number of pixels to get projected sunlit surface area - auto const pixelArea = (right - left) * (top - bottom) / (size * size); + auto const pixel_area = (right - left) * (top - bottom) * inverse_size * inverse_size; - if (pixelArea > 0.0) - { - mat4x4_ortho(projection, left, right, bottom, top, -near_, -far_); - mat4x4_mul(mvp, projection, view); + if (pixel_area > 0.0) { + mat4x4_ortho(projection, left, right, bottom, top, -near_, -far_); + mat4x4_mul(mvp, projection, view); - setMVP(); + set_mvp(); } - // TODO: Consider what to do with the camera if pixelArea happens to be zero + // TODO: Consider what to do with the camera if pixel_area happens to be zero - return pixelArea; + return pixel_area; } -void Context::calcCameraView() { - // Do something here to give the appearance of rotating the scene. - mat4x4 - tempMat; // Transpose changes the affects of consecutive rotations from local to global space. - mat4x4_transpose(tempMat, cameraView); - mat4x4_rotate_X(cameraView, tempMat, cameraRotAngleX); - mat4x4_rotate_Y(tempMat, cameraView, cameraRotAngleY); - mat4x4_transpose(cameraView, tempMat); // Transpose back. +void Context::calculate_camera_view() { + // Transpose changes the affects of consecutive rotations from local to global space. + mat4x4 temporary_matrix; + mat4x4_transpose(temporary_matrix, camera_view); + mat4x4_rotate_X(camera_view, temporary_matrix, camera_x_rotation_angle); + mat4x4_rotate_Y(temporary_matrix, camera_view, camera_y_rotation_angle); + mat4x4_transpose(camera_view, temporary_matrix); // Transpose back. } -void Context::setMVP() { - glUniformMatrix4fv(mvpLocation, 1, GL_FALSE, (const GLfloat *)mvp); +void Context::set_mvp() { + glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat *)mvp); } -void Context::setCameraMVP() { - float deltaW, deltaH; - float cRight = right; - float cLeft = left; - float cTop = top; - float cBottom = bottom; - float cNear = near_; - float cFar = far_; - - deltaW = (cRight - cLeft) / 2.; - deltaH = (cTop - cBottom) / 2.; - - if (deltaW > deltaH) { - cTop += (deltaW - deltaH); - cBottom -= (deltaW - deltaH); +void Context::set_camera_mvp() { + float delta_width, delta_height; + float camera_right = right; + float camera_left = left; + float camera_top = top; + float camera_bottom = bottom; + float camera_near = 100.; // Set near and far to something now and make it tighter later. + float camera_far = -100.; // To tighten, look at the sphere of possible rotations. + + delta_width = (camera_right - camera_left) / 2.f; + delta_height = (camera_top - camera_bottom) / 2.f; + + if (delta_width > delta_height) { + camera_top += (delta_width - delta_height); + camera_bottom -= (delta_width - delta_height); } else { - cLeft -= (deltaH - deltaW); - cRight += (deltaW - deltaH); + camera_left -= (delta_height - delta_width); + camera_right += (delta_width - delta_height); } - cNear = 100.; // Set near and far to something now and make it tighter later. - cFar = -100.; // To tighten, look at the sphere of possible rotations. - - mat4x4 cProjection; - mat4x4 cMVP; + mat4x4 camera_projection; + mat4x4 camera_mvp; - mat4x4_ortho(cProjection, viewScale * cLeft, viewScale * cRight, viewScale * cBottom, - viewScale * cTop, -cNear, -cFar); - mat4x4_mul(cMVP, cProjection, cameraView); - glUniformMatrix4fv(mvpLocation, 1, GL_FALSE, (const GLfloat *)cMVP); + mat4x4_ortho(camera_projection, view_scale * camera_left, view_scale * camera_right, + view_scale * camera_bottom, view_scale * camera_top, -camera_near, -camera_far); + mat4x4_mul(camera_mvp, camera_projection, camera_view); + glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat *)camera_mvp); } -void Context::drawModel() { +void Context::draw_model() { glClearColor(0.0f, 0.0f, 0.0f, 1.0f); #ifndef NDEBUG #ifdef __unix__ @@ -413,17 +426,17 @@ void Context::drawModel() { #endif #endif glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glDepthFunc(GL_LESS); + model.draw_all(); + glDepthFunc(GL_EQUAL); #ifndef NDEBUG #ifdef __unix__ feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); #endif #endif - glDepthFunc(GL_LESS); - model.drawAll(); - glDepthFunc(GL_EQUAL); } -void Context::drawExcept(const std::vector &hiddenSurfaces) { +void Context::draw_except(const std::vector &hidden_surfaces) { glClearColor(0.0f, 0.0f, 0.0f, 1.0f); #ifndef NDEBUG #ifdef __unix__ @@ -432,244 +445,172 @@ void Context::drawExcept(const std::vector &hiddenSurfaces) { #endif #endif glClear(GL_DEPTH_BUFFER_BIT); + glDepthFunc(GL_LESS); + model.draw_except(hidden_surfaces); + glDepthFunc(GL_EQUAL); #ifndef NDEBUG #ifdef __unix__ feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); #endif #endif - glDepthFunc(GL_LESS); - model.drawExcept(hiddenSurfaces); - glDepthFunc(GL_EQUAL); } -void Context::showRendering(const unsigned surfaceIndex, mat4x4 sunView) { +void Context::show_rendering(const unsigned int surface_index, mat4x4 sun_view) { glfwSetWindowSize(window, size, size); glfwShowWindow(window); - if (!isRenderMode) { // if not currently render mode, switch to it - initRenderMode(); - isRenderMode = true; - } + initialize_render_mode(); - auto const & surfaceBuffer = model.surfaceBuffers[surfaceIndex]; - setScene(sunView, &surfaceBuffer); + auto const &surface_buffer = model.surface_buffers[surface_index]; + set_scene(sun_view, &surface_buffer); while (!glfwWindowShouldClose(window)) { - glUniform3f(vColLocation, 0.5f, 0.5f, 0.5f); - drawModel(); - glUniform3f(vColLocation, 1.f, 1.f, 1.f); - model.drawSurface(surfaceBuffer); + glUniform3f(vertex_color_location, 0.5f, 0.5f, 0.5f); + draw_model(); + glUniform3f(vertex_color_location, 1.f, 1.f, 1.f); + GLModel::draw_surface(surface_buffer); glfwSwapBuffers(window); glfwPollEvents(); } glfwSetWindowShouldClose(window, 0); glfwHideWindow(window); + + initialize_off_screen_mode(); } -void Context::showInteriorRendering(const std::vector &hiddenSurfaceIndices, - const unsigned interiorSurfaceIndex, - mat4x4 sunView) { +void Context::show_interior_rendering(const std::vector &hidden_surface_indices, + const unsigned interior_surface_index, mat4x4 sun_view) { glfwSetWindowSize(window, size, size); glfwShowWindow(window); - if (!isRenderMode) { /// if not currently render mode, switch to it - initRenderMode(); - isRenderMode = true; - } + initialize_render_mode(); - auto const & interiorSurface = model.surfaceBuffers[interiorSurfaceIndex]; - std::vector hiddenSurfaces; - for (auto const hiddenSurf : hiddenSurfaceIndices) { - hiddenSurfaces.push_back(model.surfaceBuffers[hiddenSurf]); + auto const &interior_surface = model.surface_buffers[interior_surface_index]; + std::vector hidden_surfaces; + hidden_surfaces.reserve(hidden_surface_indices.size()); + for (auto const hidden_surface : hidden_surface_indices) { + hidden_surfaces.push_back(model.surface_buffers[hidden_surface]); } - setScene(sunView, &model.surfaceBuffers[hiddenSurfaceIndices.at(0)], false); + set_scene(sun_view, &model.surface_buffers[hidden_surface_indices.at(0)], false); while (!glfwWindowShouldClose(window)) { - glUniform3f(vColLocation, 0.5f, 0.5f, 0.5f); - drawExcept(hiddenSurfaces); - glUniform3f(vColLocation, 1.f, 1.f, 1.f); - model.drawSurface(interiorSurface); + glUniform3f(vertex_color_location, 0.5f, 0.5f, 0.5f); + draw_except(hidden_surfaces); + glUniform3f(vertex_color_location, 1.f, 1.f, 1.f); + GLModel::draw_surface(interior_surface); glfwSwapBuffers(window); glfwPollEvents(); } glfwSetWindowShouldClose(window, 0); glfwHideWindow(window); -} - -void Context::submitPSSA(const unsigned surfaceIndex, mat4x4 sunView) { - auto const & surfaceBuffer = model.surfaceBuffers[surfaceIndex]; - auto const pixelArea = setScene(sunView, &surfaceBuffer); - drawModel(); - glBeginQuery(GL_SAMPLES_PASSED, queries.at(surfaceBuffer.index)); - model.drawSurface(surfaceBuffer); - glEndQuery(GL_SAMPLES_PASSED); - pixelAreas.at(surfaceBuffer.index) = pixelArea; -} - -void Context::bufferedQuery(const unsigned surfaceIndex) { - int i = 0; - for (; i < bufferSize; ++i) { - if (indexBuffer[i] == static_cast(surfaceIndex)) break; - } - if (i == bufferSize) return; - glGetQueryObjectiv(queries[i], GL_QUERY_RESULT, &(pixelCounts.at(indexBuffer[i]))); - indexBuffer[i] = -1; + initialize_off_screen_mode(); } -void Context::bufferedQuery(const SurfaceBuffer &surfaceBuffer) { - if (indexBuffer[currentBufferIndex] > -1) { - glGetQueryObjectiv(queries[currentBufferIndex], GL_QUERY_RESULT, &(pixelCounts.at(indexBuffer[currentBufferIndex]))); - } - - glBeginQuery(GL_SAMPLES_PASSED, queries[currentBufferIndex]); - model.drawSurface(surfaceBuffer); +void Context::submit_pssa(const SurfaceBuffer &surface_buffer, mat4x4 sun_view) { + auto const pixel_area = set_scene(sun_view, &surface_buffer); + draw_model(); + glBeginQuery(GL_SAMPLES_PASSED, queries.at(surface_buffer.index)); + GLModel::draw_surface(surface_buffer); glEndQuery(GL_SAMPLES_PASSED); - pixelCounts.at(surfaceBuffer.index) = -1; - indexBuffer[currentBufferIndex] = surfaceBuffer.index; - currentBufferIndex++; - if (currentBufferIndex % bufferSize == 0) { - currentBufferIndex = 0; - } + pixel_areas.at(surface_buffer.index) = pixel_area; } -void Context::submitPSSA(const std::vector &surfaceIndices, mat4x4 sunView) { - for (auto const surfaceIndex : surfaceIndices) { - auto const & surfaceBuffer = model.surfaceBuffers[surfaceIndex]; - auto const pixelArea = setScene(sunView, &surfaceBuffer); - drawModel(); - glBeginQuery(GL_SAMPLES_PASSED, queries.at(surfaceBuffer.index)); - model.drawSurface(surfaceBuffer); - glEndQuery(GL_SAMPLES_PASSED); - pixelAreas.at(surfaceBuffer.index) = pixelArea; - } +void Context::submit_pssa(const unsigned int surface_index, mat4x4 sun_view) { + submit_pssa(model.surface_buffers[surface_index], sun_view); } -void Context::submitPSSA(mat4x4 sunView) { - for (auto const & surfaceBuffer : model.surfaceBuffers) { - auto const pixelArea = setScene(sunView, &surfaceBuffer); - drawModel(); - glBeginQuery(GL_SAMPLES_PASSED, queries.at(surfaceBuffer.index)); - model.drawSurface(surfaceBuffer); - glEndQuery(GL_SAMPLES_PASSED); - // bufferedQuery(surfaceBuffer); - pixelAreas.at(surfaceBuffer.index) = pixelArea; +void Context::submit_pssas(const std::vector &surface_indices, mat4x4 sun_view) { + for (auto const surface_index : surface_indices) { + submit_pssa(surface_index, sun_view); } } -float Context::calculatePSSA(const unsigned surfaceIndex) { - - if (isRenderMode) { // if currently render mode, switch to off screen mode - initOffScreenMode(); - isRenderMode = false; - } - - // wait until the result is available - GLint ready(0); - while (!ready) { - glGetQueryObjectiv(queries[surfaceIndex], GL_QUERY_RESULT_AVAILABLE, &ready); +void Context::submit_pssa(mat4x4 sun_view) { + for (auto const &surface_buffer : model.surface_buffers) { + submit_pssa(surface_buffer, sun_view); } - - // retrieve result - glGetQueryObjectiv(queries[surfaceIndex], GL_QUERY_RESULT, &(pixelCounts.at(surfaceIndex))); - - return pixelCounts[surfaceIndex] * pixelAreas[surfaceIndex]; } -std::vector Context::calculatePSSA(const std::vector &surfaceIndices) { - - if (isRenderMode) { // if currently render mode, switch to off screen mode - initOffScreenMode(); - isRenderMode = false; - } - - // retrieve result - std::vector results; - results.reserve(surfaceIndices.size()); - for (auto const & surfaceIndex : surfaceIndices) { - glGetQueryObjectiv(queries[surfaceIndex], GL_QUERY_RESULT, &(pixelCounts.at(surfaceIndex))); - results.emplace_back(pixelCounts[surfaceIndex] * pixelAreas[surfaceIndex]); - } - - return results; +float Context::retrieve_pssa(const unsigned int surface_index) { + glGetQueryObjectiv(queries[surface_index], GL_QUERY_RESULT, &(pixel_counts.at(surface_index))); + return static_cast(pixel_counts[surface_index]) * pixel_areas[surface_index]; } -std::vector Context::calculatePSSA() { - - if (isRenderMode) { // if currently render mode, switch to off screen mode - initOffScreenMode(); - isRenderMode = false; +std::vector Context::retrieve_pssas(const std::vector &surface_indices) { + std::vector pssas; + pssas.reserve(surface_indices.size()); + for (const unsigned int surface_index : surface_indices) { + pssas.emplace_back(retrieve_pssa(surface_index)); } + return pssas; +} - // retrieve result - std::vector results; - results.reserve(model.surfaceBuffers.size()); - for (auto const & surfaceBuffer : model.surfaceBuffers) { - glGetQueryObjectiv(queries[surfaceBuffer.index], GL_QUERY_RESULT, &(pixelCounts.at(surfaceBuffer.index))); - results.emplace_back(pixelCounts[surfaceBuffer.index] * pixelAreas[surfaceBuffer.index]); +std::vector Context::retrieve_pssa() { + std::vector pssas; + pssas.reserve(model.surface_buffers.size()); + for (auto const &surface_buffer : model.surface_buffers) { + pssas.emplace_back(retrieve_pssa(surface_buffer.index)); } - - return results; + return pssas; } -std::map -Context::calculateInteriorPSSAs(const std::vector &hiddenSurfaceIndices, - const std::vector &interiorSurfaceIndices, mat4x4 sunView) { +std::unordered_map +Context::calculate_interior_pssas(const std::vector &hidden_surface_indices, + const std::vector &interior_surface_indices, + mat4x4 sun_view) { - if (isRenderMode) { // if currently render mode, switch to off screen mode - initOffScreenMode(); - isRenderMode = false; - } - - std::vector pssasQueries(interiorSurfaceIndices.size()); - std::map pssas; + std::vector interior_queries(interior_surface_indices.size()); + std::unordered_map pssas; - glGenQueries(pssasQueries.size(), pssasQueries.data()); + glGenQueries(static_cast(interior_queries.size()), interior_queries.data()); - auto const pixelArea = setScene( sunView, &model.surfaceBuffers[hiddenSurfaceIndices.at(0)], false); + auto const pixel_area = + set_scene(sun_view, &model.surface_buffers[hidden_surface_indices.at(0)], false); - std::vector hiddenSurfaces; - for (auto const hiddenSurf : hiddenSurfaceIndices) { - hiddenSurfaces.push_back(model.surfaceBuffers[hiddenSurf]); + std::vector hidden_surfaces; + hidden_surfaces.reserve(hidden_surface_indices.size()); + for (auto const hidden_surface : hidden_surface_indices) { + hidden_surfaces.push_back(model.surface_buffers[hidden_surface]); } - std::vector interiorSurfaces; - for (auto &intSurf : interiorSurfaceIndices) { - interiorSurfaces.push_back(model.surfaceBuffers[intSurf]); + std::vector interior_surfaces; + interior_surfaces.reserve(interior_surface_indices.size()); + for (auto const interior_surface : interior_surface_indices) { + interior_surfaces.push_back(model.surface_buffers[interior_surface]); } - drawExcept(hiddenSurfaces); + draw_except(hidden_surfaces); - for (size_t i = 0; i < interiorSurfaces.size(); ++i) { - glBeginQuery(GL_SAMPLES_PASSED, pssasQueries[i]); - model.drawSurface(interiorSurfaces[i]); + for (size_t i = 0; i < interior_surfaces.size(); ++i) { + glBeginQuery(GL_SAMPLES_PASSED, interior_queries[i]); + GLModel::draw_surface(interior_surfaces[i]); glEndQuery(GL_SAMPLES_PASSED); } - for (size_t i = 0; i < interiorSurfaces.size(); ++i) { - // retrieve result - GLint pixelCount; - glGetQueryObjectiv(pssasQueries[i], GL_QUERY_RESULT, &pixelCount); + for (size_t i = 0; i < interior_surfaces.size(); ++i) { + GLint pixel_count; + glGetQueryObjectiv(interior_queries[i], GL_QUERY_RESULT, &pixel_count); - pssas[interiorSurfaces[i].index] = pixelCount * pixelArea; + pssas[interior_surfaces[i].index] = static_cast(pixel_count) * pixel_area; } - glDeleteQueries(pssasQueries.size(), pssasQueries.data()); + glDeleteQueries(static_cast(interior_queries.size()), interior_queries.data()); return pssas; } -void Context::initOffScreenMode() { - glUseProgram(calcProgram->getInt()); - mvpLocation = glGetUniformLocation(calcProgram->getInt(), "MVP"); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); +void Context::initialize_off_screen_mode() { + glUseProgram(calculation_program->get()); + mvp_location = glGetUniformLocation(calculation_program->get(), "MVP"); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer_object); glDrawBuffer(GL_NONE); glReadBuffer(GL_NONE); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rbo); + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, renderbuffer_object); glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, size, size); glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, - rbo); + renderbuffer_object); GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { @@ -697,20 +638,20 @@ void Context::initOffScreenMode() { reason = "Reason unknown."; } } - showMessage(MSG_ERR, "Unable to create framebuffer. " + reason); + throw PenumbraException(fmt::format("Unable to create framebuffer. {}", reason), *logger); } glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); } -void Context::initRenderMode() { +void Context::initialize_render_mode() { // set to default framebuffer and renderbuffer - glUseProgram(renderProgram->getInt()); - mvpLocation = glGetUniformLocation(renderProgram->getInt(), "MVP"); - setMVP(); + glUseProgram(render_program->get()); + mvp_location = glGetUniformLocation(render_program->get(), "MVP"); + set_mvp(); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); } -} +} // namespace Penumbra diff --git a/third_party/penumbra/src/gl/context.h b/third_party/penumbra/src/gl/context.h index 94716535c5c..bc49c22a058 100644 --- a/third_party/penumbra/src/gl/context.h +++ b/third_party/penumbra/src/gl/context.h @@ -4,94 +4,94 @@ #ifndef CONTEXT_H_ #define CONTEXT_H_ -// Vendor -#include -#include - // Standard #include #include #include -#include +#include #include #include +// Vendor +#include +#include +#include +#include // Part of GLFW + // Penumbra -#include -#include -#include -#include +#include "gl/model.h" +#include "gl/shader.h" +#include "gl/program.h" #define MAX_FLOAT std::numeric_limits::max() -namespace Pumbra { +namespace Penumbra { class Context { public: - Context(unsigned size = 512); + Context(GLint size, Courierr::Courierr *logger); ~Context(); - void showRendering(const unsigned surfaceIndex, mat4x4 sunView); - void setModel(const std::vector &vertices, const std::vector &surfaceBuffers); - float setScene(mat4x4 sunView, const SurfaceBuffer *surfaceBuffer=nullptr, bool clipFar = true); - void bufferedQuery(const unsigned surfaceIndex); - void bufferedQuery(const SurfaceBuffer &surfaceBuffer); - void submitPSSA(const unsigned surfaceIndex, mat4x4 sunView); - void submitPSSA(const std::vector &surfaceIndices, mat4x4 sunView); - void submitPSSA(mat4x4 sunView); - float calculatePSSA(const unsigned surfaceIndex); - std::vector calculatePSSA(const std::vector &surfaceIndices); - std::vector calculatePSSA(); - std::map - calculateInteriorPSSAs(const std::vector &hiddenSurfaces, - const std::vector &interiorSurfaces, mat4x4 sunView); - void showInteriorRendering(const std::vector &hiddenSurfaceIndices, - const unsigned interiorSurfaceIndex, - mat4x4 sunView); - void clearModel(); - std::string vendorName(); + void show_rendering(unsigned int surface_index, mat4x4 sun_view); + void set_model(const std::vector &vertices, + const std::vector &surface_buffers); + float set_scene(mat4x4 sun_view, const SurfaceBuffer *surface_buffer = nullptr, + bool clip_far = true); + void submit_pssa(unsigned int surface_index, mat4x4 sun_view); + void submit_pssas(const std::vector &surface_indices, mat4x4 sun_view); + void submit_pssa(mat4x4 sun_view); + float retrieve_pssa(unsigned int surface_index); + std::vector retrieve_pssas(const std::vector &surface_indices); + std::vector retrieve_pssa(); + + std::unordered_map + calculate_interior_pssas(const std::vector &hidden_surface_indices, + const std::vector &interior_surface_indices, + mat4x4 sun_view); + void show_interior_rendering(const std::vector &hidden_surface_indices, + unsigned int interior_surface_index, mat4x4 sun_view); + void clear_model(); + static std::string get_vendor_name(); private: - GLFWwindow *window; - GLuint fbo, rbo; - static const char *renderVertexShaderSource; - static const char *renderFragmentShaderSource; - static const char *calculationVertexShaderSource; - unsigned size; + GLFWwindow *window{nullptr}; + GLuint framebuffer_object{}, renderbuffer_object{}; + static const char *render_vertex_shader_source; + static const char *render_fragment_shader_source; + static const char *calculation_vertex_shader_source; + GLint size; GLModel model; - std::unique_ptr renderProgram; - std::unique_ptr calcProgram; - bool modelSet; - float modelBox[8][4]; - mat4x4 projection, view, mvp; - mat4x4 cameraView; - GLint mvpLocation, vColLocation; - bool isWireFrame; - bool isCameraMode; - float left, right, bottom, top, near_, far_; - float viewScale; - double prevPosX, prevPosY; - float cameraRotAngleX, cameraRotAngleY; - bool lbutton_down; - bool isRenderMode; + std::unique_ptr render_program; + std::unique_ptr calculation_program; + bool model_is_set{false}; + float model_bounding_box[8][4] = {}; + mat4x4 projection = {}, view = {}, mvp = {}; + mat4x4 camera_view = {}; + GLint mvp_location{}, vertex_color_location{}; + bool is_wire_frame_mode{false}; + bool is_camera_mode{false}; + float left{0}, right{0}, bottom{0}, top{0}, near_{0}, far_{0}; + float view_scale{1.f}; + double previous_x_position, previous_y_position; + float camera_x_rotation_angle{0.f}, camera_y_rotation_angle{0.f}; + bool left_mouse_button_pressed{true}; std::vector queries; - std::vector pixelAreas; - std::vector pixelCounts; - std::vector indexBuffer; - int currentBufferIndex = 0; - int bufferSize = 16; + std::vector pixel_areas; + std::vector pixel_counts; + Courierr::Courierr *logger; - void drawModel(); - void drawExcept(const std::vector &hiddenSurfaces); - void setMVP(); - void setCameraMVP(); - void calcCameraView(); - void toggleWireFrame(); - void toggleCameraMode(); - void initOffScreenMode(); - void initRenderMode(); + void submit_pssa(const SurfaceBuffer &surface_buffer, mat4x4 sun_view); + void draw_model(); + void draw_except(const std::vector &hidden_surfaces); + void set_mvp(); + void set_camera_mvp(); + void calculate_camera_view(); + void toggle_wire_frame_mode(); + void toggle_camera_mode(); + void initialize_off_screen_mode(); + void initialize_render_mode(); }; -} // namespace Pumbra +} // namespace Penumbra #endif // CONTEXT_H_ diff --git a/third_party/penumbra/src/gl/model.cpp b/third_party/penumbra/src/gl/model.cpp index fa07cb0c3dc..a31fb1c79c4 100644 --- a/third_party/penumbra/src/gl/model.cpp +++ b/third_party/penumbra/src/gl/model.cpp @@ -5,7 +5,7 @@ #include // Penumbra -#include +#include "model.h" #ifdef __APPLE__ #define glGenVertexArraysX glGenVertexArraysAPPLE @@ -17,88 +17,91 @@ #define glDeleteVertexArraysX glDeleteVertexArrays #endif -namespace Pumbra { +namespace Penumbra { SurfaceBuffer::SurfaceBuffer(GLuint begin, GLuint count, GLint index) : begin(begin), count(count), index(index) {} -GLModel::~GLModel() { clearModel(); } - -void GLModel::clearModel() { - if (objectsSet) - { - glDeleteVertexArraysX(1, &vao); - glDeleteBuffers(1, &vbo); +void GLModel::clear_model() { + if (objects_set) { + glDeleteVertexArraysX(1, &vertex_array_object); + glDeleteBuffers(1, &vertex_buffer_object); } - surfaceBuffers.clear(); + surface_buffers.clear(); } -void GLModel::setVertices(const std::vector &vertices) { +void GLModel::set_vertices(const std::vector &vertices) { - vertexArray = vertices; - numPoints = vertices.size() / vertexSize; + vertex_array = vertices; + number_of_points = static_cast(vertices.size()) / vertex_size; // Set up vertex array object - glGenVertexArraysX(1, &vao); - glBindVertexArrayX(vao); + glGenVertexArraysX(1, &vertex_array_object); + glBindVertexArrayX(vertex_array_object); // Set up array buffer to store vertex information - glGenBuffers(1, &vbo); - glBindBuffer(GL_ARRAY_BUFFER, vbo); - glBufferData(GL_ARRAY_BUFFER, sizeof(float) * vertices.size(), &vertices[0], GL_STATIC_DRAW); + glGenBuffers(1, &vertex_buffer_object); + glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer_object); + glBufferData(GL_ARRAY_BUFFER, static_cast(sizeof(float) * vertices.size()), &vertices[0], + GL_STATIC_DRAW); // Set drawing pointers for current vertex buffer glEnableVertexAttribArray(0); - glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 3, (void *)0); + glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 3, nullptr); - objectsSet = true; + objects_set = true; } -void GLModel::setSurfaceBuffers(const std::vector &surfaceBuffers) { - this->surfaceBuffers = surfaceBuffers; +void GLModel::set_surface_buffers(const std::vector &surface_buffers_in) { + this->surface_buffers = surface_buffers_in; } -void GLModel::drawSurface(SurfaceBuffer surfaceBuffer) { - glDrawArrays(GL_TRIANGLES, surfaceBuffer.begin, surfaceBuffer.count); +void GLModel::draw_surface(SurfaceBuffer surface_buffer) { + glDrawArrays(GL_TRIANGLES, static_cast(surface_buffer.begin), + static_cast(surface_buffer.count)); } -void GLModel::drawAll() { glDrawArrays(GL_TRIANGLES, 0, numPoints); } +void GLModel::draw_all() const { + glDrawArrays(GL_TRIANGLES, 0, static_cast(number_of_points)); +} -void GLModel::drawExcept(std::vector hiddenSurfaces) { +void GLModel::draw_except(std::vector hidden_surfaces) const { - if (hiddenSurfaces.size() == 0) { // draw all if no hidden surfaces - drawAll(); + if (hidden_surfaces.empty()) { // draw all if no hidden surfaces + draw_all(); return; } // Sort vector std::sort( - hiddenSurfaces.begin(), hiddenSurfaces.end(), + hidden_surfaces.begin(), hidden_surfaces.end(), [](const SurfaceBuffer &a, const SurfaceBuffer &b) -> bool { return a.begin > b.begin; }); // Begin (if first hidden surface isn't first surface) - if (hiddenSurfaces[0].begin != 0u) { - glDrawArrays(GL_TRIANGLES, 0, hiddenSurfaces[0].begin); + if (hidden_surfaces[0].begin != 0u) { + glDrawArrays(GL_TRIANGLES, 0, static_cast(hidden_surfaces[0].begin)); } - GLuint nextBegin = hiddenSurfaces[0].begin + hiddenSurfaces[0].count; + GLuint nextBegin = hidden_surfaces[0].begin + hidden_surfaces[0].count; // Loop through all exceptions - for (std::size_t i = 1; i < hiddenSurfaces.size(); ++i) { - if (nextBegin == numPoints) { + for (std::size_t i = 1; i < hidden_surfaces.size(); ++i) { + if (nextBegin == number_of_points) { // This is the last surface return; } - if (nextBegin == hiddenSurfaces[i].begin) { + if (nextBegin == hidden_surfaces[i].begin) { // Next surface is also hidden - nextBegin = hiddenSurfaces[i].begin + hiddenSurfaces[i].count; + nextBegin = hidden_surfaces[i].begin + hidden_surfaces[i].count; break; } - glDrawArrays(GL_TRIANGLES, nextBegin, hiddenSurfaces[i + 1].begin - 1); + glDrawArrays(GL_TRIANGLES, static_cast(nextBegin), + static_cast(hidden_surfaces[i + 1].begin - 1)); } - if (nextBegin < numPoints) { - glDrawArrays(GL_TRIANGLES, nextBegin, numPoints - nextBegin); + if (nextBegin < number_of_points) { + glDrawArrays(GL_TRIANGLES, static_cast(nextBegin), + static_cast(number_of_points - nextBegin)); } } -} // namespace Pumbra +} // namespace Penumbra diff --git a/third_party/penumbra/src/gl/model.h b/third_party/penumbra/src/gl/model.h index 3dd9553883c..e53b3b028ed 100644 --- a/third_party/penumbra/src/gl/model.h +++ b/third_party/penumbra/src/gl/model.h @@ -4,18 +4,18 @@ #ifndef MODEL_H_ #define MODEL_H_ +// Standard +#include + // Vendor #include #include -// Standard -#include - -namespace Pumbra { +namespace Penumbra { class SurfaceBuffer { public: - SurfaceBuffer(GLuint begin = 0u, GLuint count = 0u, GLint index = -1); + explicit SurfaceBuffer(GLuint begin = 0u, GLuint count = 0u, GLint index = -1); GLuint begin; GLuint count; GLint index; @@ -23,23 +23,23 @@ class SurfaceBuffer { class GLModel { public: - GLModel() : objectsSet(false) {}; - ~GLModel(); - void setVertices(const std::vector &vertices); - void setSurfaceBuffers(const std::vector &surfaceBuffers); - void drawSurface(SurfaceBuffer surfaceBuffer); - void drawAll(); - void drawExcept(std::vector hiddenSurfaces); - void clearModel(); - std::vector vertexArray; - std::vector surfaceBuffers; - unsigned numPoints; - static const int vertexSize = 3; // i.e., 3D + GLModel() = default; + ~GLModel() = default; + void set_vertices(const std::vector &vertices); + void set_surface_buffers(const std::vector &surface_buffers); + static void draw_surface(SurfaceBuffer surface_buffer); + void draw_all() const; + void draw_except(std::vector hidden_surfaces) const; + void clear_model(); + std::vector vertex_array; + std::vector surface_buffers; + unsigned int number_of_points{0u}; + static const int vertex_size{3}; // i.e., 3D private: - GLuint vbo, vao; - bool objectsSet; + GLuint vertex_buffer_object{}, vertex_array_object{}; + bool objects_set{false}; }; -} // namespace Pumbra +} // namespace Penumbra #endif // MODEL_H_ diff --git a/third_party/penumbra/src/gl/program.cpp b/third_party/penumbra/src/gl/program.cpp index d82a0233784..3b214981cab 100644 --- a/third_party/penumbra/src/gl/program.cpp +++ b/third_party/penumbra/src/gl/program.cpp @@ -2,24 +2,27 @@ * See the LICENSE file for additional terms and conditions. */ // Penumbra -#include -#include +#include "program.h" +#include "shader.h" -namespace Pumbra { +namespace Penumbra { -GLProgram::GLProgram(const char *vertexSource, const char *fragmentSource) { +GLProgram::GLProgram(const char *vertex_source, const char *fragment_source, + Courierr::Courierr *logger) { program = glCreateProgram(); - GLShader vertex(GL_VERTEX_SHADER, vertexSource); - glAttachShader(program, vertex.getInt()); - if (fragmentSource) { - GLShader fragment(GL_FRAGMENT_SHADER, fragmentSource); - glAttachShader(program, fragment.getInt()); + GLShader vertex(GL_VERTEX_SHADER, vertex_source, logger); + glAttachShader(program, vertex.get()); + if (fragment_source) { + GLShader fragment(GL_FRAGMENT_SHADER, fragment_source, logger); + glAttachShader(program, fragment.get()); } glLinkProgram(program); } -GLProgram::~GLProgram() {} +GLProgram::~GLProgram() = default; -GLuint GLProgram::getInt() { return program; } +GLuint GLProgram::get() const { + return program; +} -} // namespace Pumbra +} // namespace Penumbra diff --git a/third_party/penumbra/src/gl/program.h b/third_party/penumbra/src/gl/program.h index f0ba8dc0909..415d55964ae 100644 --- a/third_party/penumbra/src/gl/program.h +++ b/third_party/penumbra/src/gl/program.h @@ -7,19 +7,20 @@ // Vendor #include #include +#include -namespace Pumbra { +namespace Penumbra { class GLProgram { public: - GLProgram(const char *vertexSource, const char *fragmentSource); + GLProgram(const char *vertex_source, const char *fragment_source, Courierr::Courierr *logger); ~GLProgram(); - GLuint getInt(); + [[nodiscard]] GLuint get() const; private: GLuint program; }; -} // namespace Pumbra +} // namespace Penumbra #endif // PROGRAM_H_ diff --git a/third_party/penumbra/src/gl/shader.cpp b/third_party/penumbra/src/gl/shader.cpp index 1133975274e..b10e9c951c2 100644 --- a/third_party/penumbra/src/gl/shader.cpp +++ b/third_party/penumbra/src/gl/shader.cpp @@ -5,33 +5,35 @@ #include // Penumbra +#include #include "shader.h" -#include "../error.h" -namespace Pumbra { -GLShader::GLShader(GLenum type, const char *source) { +namespace Penumbra { +GLShader::GLShader(GLenum type, const char *source, Courierr::Courierr *logger_in) + : logger(logger_in) { GLint shader_ok; GLsizei log_length; char info_log[8192]; shader = glCreateShader(type); if (shader != 0) { - glShaderSource(shader, 1, (const GLchar **)&source, NULL); + glShaderSource(shader, 1, (const GLchar **)&source, nullptr); glCompileShader(shader); glGetShaderiv(shader, GL_COMPILE_STATUS, &shader_ok); if (shader_ok != GL_TRUE) { glGetShaderInfoLog(shader, 8192, &log_length, info_log); glDeleteShader(shader); shader = 0; - std::string shaderTypeStr = (type == GL_FRAGMENT_SHADER) ? "fragment" : "vertex"; - showMessage(MSG_INFO, "OpenGL " + shaderTypeStr + " shader: " + info_log); - showMessage(MSG_ERR, "Unable to compile " + shaderTypeStr + " shader."); + std::string shader_type_string = (type == GL_FRAGMENT_SHADER) ? "fragment" : "vertex"; + logger->info(fmt::format("OpenGL {} shader: {}", shader_type_string, info_log)); + throw PenumbraException(fmt::format("Unable to compile {} shader.", shader_type_string), + *logger); } } } -GLShader::~GLShader() {} - -GLuint GLShader::getInt() { return shader; } +GLuint GLShader::get() const { + return shader; +} -} // namespace Pumbra +} // namespace Penumbra diff --git a/third_party/penumbra/src/gl/shader.h b/third_party/penumbra/src/gl/shader.h index 512e00e378d..a9127524cde 100644 --- a/third_party/penumbra/src/gl/shader.h +++ b/third_party/penumbra/src/gl/shader.h @@ -7,19 +7,21 @@ // Vendor #include #include +#include -namespace Pumbra { +namespace Penumbra { class GLShader { public: - GLShader(GLenum type, const char *source); - ~GLShader(); - GLuint getInt(); + GLShader(GLenum type, const char *source, Courierr::Courierr *logger); + ~GLShader() = default; + [[nodiscard]] GLuint get() const; private: GLuint shader; + Courierr::Courierr *logger; }; -} // namespace Pumbra +} // namespace Penumbra #endif // SHADER_H_ diff --git a/third_party/penumbra/src/penumbra-implementation.cpp b/third_party/penumbra/src/penumbra-implementation.cpp new file mode 100644 index 00000000000..63787ffc8df --- /dev/null +++ b/third_party/penumbra/src/penumbra-implementation.cpp @@ -0,0 +1,37 @@ +/* Copyright (c) 2017 Big Ladder Software LLC. All rights reserved. + * See the LICENSE file for additional terms and conditions. */ + +// Standard +#include + +#ifndef NDEBUG +#ifdef __unix__ +#include +#endif +#endif + +// Penumbra +#include "penumbra-implementation.h" + +namespace Penumbra { + +PenumbraImplementation::PenumbraImplementation(int size, + const std::shared_ptr &logger_in) + : context(size, logger_in.get()), logger(logger_in) {} + +void PenumbraImplementation::add_surface(const Surface &surface) { + surface.surface->logger = logger; + if (surface.surface->name.empty()) { + surface.surface->name = fmt::format("Surface {}", surfaces.size()); + } + surfaces.push_back(*surface.surface); +} + +void PenumbraImplementation::check_surface(const unsigned int surface_index, + const std::string_view &surface_context) const { + if (surface_index >= surfaces.size()) { + throw SurfaceException(surface_index, surface_context, *(logger)); + } +} + +} // namespace Penumbra diff --git a/third_party/penumbra/src/penumbra-implementation.h b/third_party/penumbra/src/penumbra-implementation.h new file mode 100644 index 00000000000..f1e04cf586a --- /dev/null +++ b/third_party/penumbra/src/penumbra-implementation.h @@ -0,0 +1,39 @@ +/* Copyright (c) 2017 Big Ladder Software LLC. All rights reserved. + * See the LICENSE file for additional terms and conditions. */ + +#ifndef PENUMBRA_IMPLEMENTATION_H_ +#define PENUMBRA_IMPLEMENTATION_H_ + +// Standard +#include + +// vendor +#include + +// Penumbra +#include +#include +#include "surface-implementation.h" +#include "sun.h" +#include "gl/context.h" + +namespace Penumbra { + +class PenumbraImplementation { + +public: + PenumbraImplementation(int size, const std::shared_ptr &logger); + ~PenumbraImplementation() = default; + +public: + void add_surface(const Surface &surface); + Context context; + Sun sun; + std::vector model; + std::vector surfaces; + std::shared_ptr logger; + void check_surface(unsigned int index, const std::string_view &surface_context = "Surface") const; +}; + +} // namespace Penumbra +#endif // PENUMBRA_IMPLEMENTATION_H_ diff --git a/third_party/penumbra/src/penumbra-private.h b/third_party/penumbra/src/penumbra-private.h deleted file mode 100644 index 0b13f2bd1ce..00000000000 --- a/third_party/penumbra/src/penumbra-private.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (c) 2017 Big Ladder Software LLC. All rights reserved. - * See the LICENSE file for additional terms and conditions. */ - -#ifndef PENUMBRA_PRIVATE_H_ -#define PENUMBRA_PRIVATE_H_ - -// Standard -#include - -// Penumbra -#include -#include -#include -#include - -namespace Pumbra { - -class PenumbraPrivate { - -public: - PenumbraPrivate(unsigned size = 512); - ~PenumbraPrivate(); - -public: - void addSurface(const Surface &surface); - Context context; - Sun sun; - std::vector model; - std::vector surfaces; - bool checkSurface(const unsigned index); -}; - -} // namespace Pumbra -#endif // PENUMBRA_PRIVATE_H_ diff --git a/third_party/penumbra/src/penumbra.cpp b/third_party/penumbra/src/penumbra.cpp index c962160f6ae..401772219c5 100644 --- a/third_party/penumbra/src/penumbra.cpp +++ b/third_party/penumbra/src/penumbra.cpp @@ -13,284 +13,212 @@ // Penumbra #include -#include -#include "error.h" +#include "penumbra-implementation.h" -namespace Pumbra { +namespace Penumbra { -void penumbraTerminate() { glfwTerminate(); } +Penumbra::Penumbra(unsigned int size, const std::shared_ptr &logger) + : penumbra(std::make_unique(static_cast(size), logger)) {} -Penumbra::Penumbra(unsigned int size) { - penumbra = std::unique_ptr(new PenumbraPrivate(size)); -} - -Penumbra::Penumbra(PenumbraCallbackFunction callbackFunction, unsigned size) { - setMessageCallback(callbackFunction, nullptr); - penumbra = std::unique_ptr(new PenumbraPrivate(size)); -} +Penumbra::Penumbra(const std::shared_ptr &logger) + : penumbra(std::make_unique(512, logger)) {} -Penumbra::Penumbra(PenumbraCallbackFunction callbackFunction, void *contextPtr, unsigned size) { - setMessageCallback(callbackFunction, contextPtr); - penumbra = std::unique_ptr(new PenumbraPrivate(size)); -} +Penumbra::~Penumbra() = default; -Penumbra::~Penumbra() {} - -bool Penumbra::isValidContext() { - bool invalid(false); - if (!glfwInit()) { - invalid = true; - } +bool Penumbra::is_valid_context() { + bool invalid(false); + if (!glfwInit()) { + invalid = true; + } - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); - glfwWindowHint(GLFW_VISIBLE, GL_FALSE); + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); + glfwWindowHint(GLFW_VISIBLE, GL_FALSE); #ifndef NDEBUG #ifdef __unix__ // Temporarily Disable floating point exceptions fedisableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); #endif #endif - GLFWwindow* window = glfwCreateWindow(1, 1, "Penumbra", NULL, NULL); + GLFWwindow *window = glfwCreateWindow(1, 1, "Penumbra", nullptr, nullptr); #ifndef NDEBUG #ifdef __unix__ feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); #endif #endif - glfwMakeContextCurrent(window); - invalid |= !window; - glfwDestroyWindow(window); - return !invalid; -} - -VendorName Penumbra::getVendorName() { - auto vendorType = VendorName::None; - auto vendorName = penumbra->context.vendorName(); - if (vendorName == "NVIDIA") { - vendorType = VendorName::NVIDIA; - } else if (vendorName == "AMD" || vendorName == "ATI" || vendorName == "Advanced Micro Devices" || vendorName == "ATI Technologies Inc.") { - vendorType = VendorName::AMD; - } else if (vendorName == "Intel" || vendorName == "INTEL" || "Intel Inc.") { - vendorType = VendorName::Intel; - } else if (vendorName == "VMware, Inc.") { - vendorType = VendorName::VMware; + glfwMakeContextCurrent(window); + invalid |= !window; + glfwDestroyWindow(window); + return !invalid; +} + +VendorType Penumbra::get_vendor_name() { + VendorType vendor_type; + auto vendor_name = Context::get_vendor_name(); + if (vendor_name == "NVIDIA") { + vendor_type = VendorType::nvidia; + } else if (vendor_name == "AMD" || vendor_name == "ATI" || + vendor_name == "Advanced Micro Devices" || vendor_name == "ATI Technologies Inc.") { + vendor_type = VendorType::amd; + } else if (vendor_name == "Intel" || vendor_name == "INTEL" || vendor_name == "Intel Inc.") { + vendor_type = VendorType::intel; + } else if (vendor_name == "VMware, Inc.") { + vendor_type = VendorType::vmware; + } else if (vendor_name == "Mesa" || vendor_name == "Mesa/X.org") { + vendor_type = VendorType::mesa; } else { - showMessage(MSG_ERR, "Failed to find GPU or vendor name (" + vendorName + ") is not in list."); + throw PenumbraException( + fmt::format("Failed to find GPU or vendor name ({}) is not in list.", vendor_name), + *(penumbra->logger)); } - return vendorType; + return vendor_type; } -unsigned Penumbra::addSurface(const Surface &surface) { - penumbra->addSurface(surface); - return penumbra->surfaces.size() - 1u; +unsigned int Penumbra::add_surface(const Surface &surface) { + penumbra->add_surface(surface); + return static_cast(penumbra->surfaces.size()) - 1u; } -unsigned Penumbra::getNumSurfaces() { - return penumbra->surfaces.size(); +unsigned int Penumbra::get_number_of_surfaces() { + return static_cast(penumbra->surfaces.size()); } -int Penumbra::setModel() { - if (penumbra->surfaces.size() > 0) { +void Penumbra::set_model() { + if (!penumbra->surfaces.empty()) { - // Tesselate each surface into triangles - std::vector surfaceBuffers; - unsigned nextStartingIndex = 0; - unsigned surfNum = 0; + // Tessellate each surface into triangles + std::vector surface_buffers; + unsigned int next_starting_index{0u}; + unsigned int surface_index{0u}; for (auto &surface : penumbra->surfaces) { TessData tess = surface.tessellate(); - surfaceBuffers.emplace_back(nextStartingIndex / TessData::vertexSize, - tess.numVerts / TessData::vertexSize, surfNum); - for (unsigned i = 0; i < tess.numVerts; ++i) { + surface_buffers.emplace_back(next_starting_index / TessData::vertex_size, + tess.number_of_vertices / TessData::vertex_size, surface_index); + for (unsigned int i = 0; i < tess.number_of_vertices; ++i) { penumbra->model.push_back(tess.vertices[i]); } - nextStartingIndex += tess.numVerts; - ++surfNum; + next_starting_index += tess.number_of_vertices; + ++surface_index; } - penumbra->context.setModel(penumbra->model, surfaceBuffers); + penumbra->context.set_model(penumbra->model, surface_buffers); } else { - showMessage(MSG_WARN, "No surfaces added to Penumbra before calling setModel()."); + penumbra->logger->warning("No surfaces added to Penumbra before calling set_model()."); } - return PN_SUCCESS; } -int Penumbra::clearModel() { +void Penumbra::clear_model() { penumbra->surfaces.clear(); penumbra->model.clear(); - penumbra->context.clearModel(); - return PN_SUCCESS; + penumbra->context.clear_model(); } -int Penumbra::setSunPosition(const float azm, // in radians, clockwise, north = 0 - const float alt // in radians, horizon = 0, vertical = pi/2 +void Penumbra::set_sun_position(const float azimuth, // in radians, clockwise, north = 0 + const float altitude // in radians, horizon = 0, vertical = pi/2 ) { - penumbra->sun.setView(azm, alt); - return PN_SUCCESS; + penumbra->sun.set_view(azimuth, altitude); } -float Penumbra::getSunAzimuth() { - return penumbra->sun.getAzimuth(); +float Penumbra::get_sun_azimuth() { + return penumbra->sun.get_azimuth(); } -float Penumbra::getSunAltitude() { - return penumbra->sun.getAltitude(); +float Penumbra::get_sun_altitude() { + return penumbra->sun.get_altitude(); } -void Penumbra::submitPSSA(unsigned surfaceIndex) { - if (penumbra->checkSurface(surfaceIndex)) { - penumbra->context.submitPSSA(surfaceIndex, penumbra->sun.getView()); - } else { - showMessage(MSG_ERR, - "Surface index, X, does not exist. Cannot calculate PSSA."); // TODO format string - } +void Penumbra::submit_pssa(unsigned int surface_index) { + penumbra->check_surface(surface_index); + penumbra->context.submit_pssa(surface_index, penumbra->sun.get_view()); } -void Penumbra::submitPSSA(const std::vector &surfaceIndices) { - for (auto const surfaceIndex : surfaceIndices) { - if (!penumbra->checkSurface(surfaceIndex)) { - showMessage(MSG_ERR, "Surface index, X, does not exist. Cannot calculate PSSA."); // TODO format string - return; - } +void Penumbra::submit_pssa(const std::vector &surface_indices) { + for (auto const surface_index : surface_indices) { + penumbra->check_surface(surface_index); } - penumbra->context.submitPSSA(surfaceIndices, penumbra->sun.getView()); + penumbra->context.submit_pssas(surface_indices, penumbra->sun.get_view()); } -void Penumbra::submitPSSA() { - penumbra->context.submitPSSA(penumbra->sun.getView()); +void Penumbra::submit_pssa() { + penumbra->context.submit_pssa(penumbra->sun.get_view()); } -float Penumbra::fetchPSSA(unsigned surfaceIndex) { - if (penumbra->checkSurface(surfaceIndex)) { - return penumbra->context.calculatePSSA(surfaceIndex); - } else { - showMessage(MSG_ERR, - "Surface index, X, does not exist. Cannot calculate PSSA."); // TODO format string - return -1.f; - } +float Penumbra::retrieve_pssa(unsigned int surface_index) { + penumbra->check_surface(surface_index); + return penumbra->context.retrieve_pssa(surface_index); } -std::vector Penumbra::fetchPSSA(const std::vector &surfaceIndices) { - for (auto const surfaceIndex : surfaceIndices) { - if (!penumbra->checkSurface(surfaceIndex)) { - showMessage(MSG_ERR, "Surface index, X, does not exist. Cannot calculate PSSA."); // TODO format string - return {}; - } +std::vector Penumbra::retrieve_pssa(const std::vector &surface_indices) { + for (auto const surface_index : surface_indices) { + penumbra->check_surface(surface_index); } - return penumbra->context.calculatePSSA(surfaceIndices); + return penumbra->context.retrieve_pssas(surface_indices); } -std::vector Penumbra::fetchPSSA() { - return penumbra->context.calculatePSSA();; +std::vector Penumbra::retrieve_pssa() { + return penumbra->context.retrieve_pssa(); } -float Penumbra::calculatePSSA(unsigned surfaceIndex) { - submitPSSA(surfaceIndex); - return fetchPSSA(surfaceIndex); +float Penumbra::calculate_pssa(unsigned int surface_index) { + submit_pssa(surface_index); + return retrieve_pssa(surface_index); } -std::vector Penumbra::calculatePSSA(const std::vector &surfaceIndices) { - submitPSSA(surfaceIndices); - return fetchPSSA(surfaceIndices); +std::vector Penumbra::calculate_pssa(const std::vector &surface_indices) { + submit_pssa(surface_indices); + return retrieve_pssa(surface_indices); } -std::vector Penumbra::calculatePSSA() { - submitPSSA(); - return fetchPSSA(); +std::vector Penumbra::calculate_pssa() { + submit_pssa(); + return retrieve_pssa(); } -std::map -Penumbra::calculateInteriorPSSAs(const std::vector &transparentSurfaceIndices, - const std::vector &interiorSurfaceIndices) { - std::map pssas; - if (transparentSurfaceIndices.size() > 0) { - if (penumbra->checkSurface(transparentSurfaceIndices[0])) { - for (auto &transSurf : transparentSurfaceIndices) { - if (!penumbra->checkSurface(transSurf)) { - showMessage( - MSG_ERR, - "Transparent surface index, X, does not exist. Cannot calculate PSSA."); // TODO format string - } - } - for (auto &intSurf : interiorSurfaceIndices) { - if (!penumbra->checkSurface(intSurf)) { - showMessage( - MSG_ERR, - "Interior surface index, X, does not exist. Cannot calculate PSSA."); // TODO format - // string - } - } - pssas = penumbra->context.calculateInteriorPSSAs(transparentSurfaceIndices, interiorSurfaceIndices, penumbra->sun.getView()); - } else { - showMessage( - MSG_ERR, - "Transparent surface index, X, does not exist. Cannot calculate PSSA."); // TODO format - // string +std::unordered_map +Penumbra::calculate_interior_pssas(const std::vector &transparent_surface_indices, + const std::vector &interior_surface_indices) { + std::unordered_map pssas; + if (!transparent_surface_indices.empty()) { + for (auto const transparent_surface_index : transparent_surface_indices) { + penumbra->check_surface(transparent_surface_index, "Transparent surface"); } + for (auto const interior_surface_index : interior_surface_indices) { + penumbra->check_surface(interior_surface_index, "Interior surface"); + } + pssas = penumbra->context.calculate_interior_pssas( + transparent_surface_indices, interior_surface_indices, penumbra->sun.get_view()); + } else { - showMessage(MSG_ERR, "Cannot calculate interior PSSAs without defining at least one " - "transparent surface index."); // TODO format string + throw PenumbraException( + "Cannot calculate interior PSSAs without defining at least one transparent surface index.", + *(penumbra->logger)); } return pssas; } -int Penumbra::renderScene(unsigned surfaceIndex) { - if (penumbra->checkSurface(surfaceIndex)) { - penumbra->context.showRendering(surfaceIndex, penumbra->sun.getView()); - return PN_SUCCESS; - } else { - showMessage(MSG_ERR, - "Surface index, X, does not exist. Cannot render scene."); // TODO format string - return PN_FAILURE; - } +void Penumbra::render_scene(unsigned int surface_index) { + penumbra->check_surface(surface_index); + penumbra->context.show_rendering(surface_index, penumbra->sun.get_view()); } -int Penumbra::renderInteriorScene(std::vector transparentSurfaceIndices, - std::vector interiorSurfaceIndices) { - if (transparentSurfaceIndices.size() > 0) { - if (penumbra->checkSurface(transparentSurfaceIndices[0])) { - for (auto &transSurf : transparentSurfaceIndices) { - if (!penumbra->checkSurface(transSurf)) { - showMessage( - MSG_ERR, - "Transparent surface index, X, does not exist. Cannot calculate PSSA."); // TODO format string - } - } - for (auto &intSurf : interiorSurfaceIndices) { - if (penumbra->checkSurface(intSurf)) { - penumbra->context.showInteriorRendering(transparentSurfaceIndices, intSurf, penumbra->sun.getView()); - } else { - showMessage( - MSG_ERR, - "Interior surface index, X, does not exist. Cannot calculate PSSA."); // TODO format - // string - return PN_FAILURE; - } - } - return PN_SUCCESS; - } else { - showMessage( - MSG_ERR, - "Transparent surface index, X, does not exist. Cannot calculate PSSA."); // TODO format - // string - return PN_FAILURE; - } - } else { - showMessage(MSG_ERR, "Cannot calculate interior PSSAs without defining at least one " - "transparent surface index."); // TODO format string - return PN_FAILURE; - } +void Penumbra::render_interior_scene(const std::vector &transparent_surface_indices, + const std::vector &interior_surface_indices) { + if (!transparent_surface_indices.empty()) { + for (auto const transparent_surface_index : transparent_surface_indices) { + penumbra->check_surface(transparent_surface_index, "Transparent surface"); + } + for (auto const interior_surface_index : interior_surface_indices) { + penumbra->check_surface(interior_surface_index, "Interior surface"); + penumbra->context.show_interior_rendering(transparent_surface_indices, interior_surface_index, + penumbra->sun.get_view()); + } + } else { + throw PenumbraException("Cannot render interior scene without defining at least one " + "transparent surface index.", + *(penumbra->logger)); + } } - -void Penumbra::setMessageCallback(PenumbraCallbackFunction callBackFunction, void *contextPtr) { - penumbraCallbackFunction = callBackFunction; - messageCallbackContextPtr = contextPtr; +std::shared_ptr Penumbra::get_logger() { + return penumbra->logger; } -PenumbraPrivate::PenumbraPrivate(unsigned size) : context(size) {} - -PenumbraPrivate::~PenumbraPrivate() {} - -void PenumbraPrivate::addSurface(const Surface &surface) { surfaces.push_back(*surface.surface); } - -bool PenumbraPrivate::checkSurface(const unsigned index) { return index < surfaces.size(); } - -} // namespace Pumbra +} // namespace Penumbra diff --git a/third_party/penumbra/src/sun.cpp b/third_party/penumbra/src/sun.cpp index 39e00f80c7a..96cbfd075ab 100644 --- a/third_party/penumbra/src/sun.cpp +++ b/third_party/penumbra/src/sun.cpp @@ -2,31 +2,27 @@ * See the LICENSE file for additional terms and conditions. */ // Penumbra -#include -#include "error.h" +#include "sun.h" -namespace Pumbra { +namespace Penumbra { -Sun::Sun() : azimuth(0.f), altitude(0.f), posSet(false) {} +Sun::Sun() : azimuth(0.f), altitude(0.f) {} -Sun::Sun(float azm, float alt) : azimuth(azm), altitude(alt), posSet(true) { setView(); } - -void Sun::setAzimuth(float azm) { azimuth = azm; } - -void Sun::setAltitude(float alt) { altitude = alt; } +void Sun::set_azimuth(float azimuth_in) { + azimuth = azimuth_in; +} -void Sun::setView(float azm, float alt) { - setAzimuth(azm); - setAltitude(alt); - posSet = true; - setView(); +void Sun::set_altitude(float altitude_in) { + altitude = altitude_in; } -void Sun::setView() { +void Sun::set_view(float azimuth_in, float altitude_in) { + set_azimuth(azimuth_in); + set_altitude(altitude_in); + set_view(); +} - if (!posSet) { - showMessage(MSG_WARN, "setView() called, but azimuth and altitude have not yet been set."); - } +void Sun::set_view() { float cosAlt = std::cos(altitude); @@ -37,9 +33,15 @@ void Sun::setView() { mat4x4_look_at(view, eye, center, up); } -mat4x4_ptr Sun::getView() { return view; } +mat4x4_ptr Sun::get_view() { + return view; +} -float Sun::getAzimuth() { return azimuth; } +float Sun::get_azimuth() const { + return azimuth; +} -float Sun::getAltitude() { return altitude; } -} // namespace Pumbra +float Sun::get_altitude() const { + return altitude; +} +} // namespace Penumbra diff --git a/third_party/penumbra/src/sun.h b/third_party/penumbra/src/sun.h index 4047c2bcb0e..f3a8051374f 100644 --- a/third_party/penumbra/src/sun.h +++ b/third_party/penumbra/src/sun.h @@ -4,39 +4,39 @@ #ifndef SUN_H_ #define SUN_H_ +// Standard #include -#include -namespace Pumbra { +// Vendor +#include // Part of GLFW +#include + +namespace Penumbra { -// typedef std::array, 4> mat4x4_std; typedef float (*mat4x4_ptr)[4]; class Sun { public: - Sun(float azm, float alt); Sun(); // Member functions public: - mat4x4_ptr getView(); - void setView(float azm, float alt); - // void setView(mat4x4 view); - float getAzimuth(); - float getAltitude(); + mat4x4_ptr get_view(); + void set_view(float azimuth, float altitude); + [[nodiscard]] float get_azimuth() const; + [[nodiscard]] float get_altitude() const; private: - void setView(); - void setAzimuth(float azm); - void setAltitude(float alt); + void set_view(); + void set_azimuth(float azimuth); + void set_altitude(float altitude); // Data Members private: - mat4x4 view; + mat4x4 view = {}; float azimuth, altitude; - bool posSet; }; -} // namespace Pumbra +} // namespace Penumbra #endif // SUN_H_ diff --git a/third_party/penumbra/src/surface-implementation.cpp b/third_party/penumbra/src/surface-implementation.cpp new file mode 100644 index 00000000000..78284250d7b --- /dev/null +++ b/third_party/penumbra/src/surface-implementation.cpp @@ -0,0 +1,65 @@ +/* Copyright (c) 2017 Big Ladder Software LLC. All rights reserved. + * See the LICENSE file for additional terms and conditions. */ + +// Standard +#include +#include + +// Penumbra +#include +#include +#include "surface-implementation.h" + +namespace Penumbra { + +TessData::TessData(const float *array, unsigned number_of_vertices) + : number_of_vertices(number_of_vertices) { + vertices.insert(vertices.end(), (const float *)array, (const float *)array + number_of_vertices); +} + +SurfaceImplementation::SurfaceImplementation(Polygon polygon) : polygon(std::move(polygon)) {} + +TessData SurfaceImplementation::tessellate() { + TESStesselator *tess = tessNewTess(nullptr); + + if (!tess) { + throw PenumbraException(fmt::format("Unable to create tessellator for surface, \"{}\".", name), + *logger); + } + + // Add primary polygon + tessAddContour(tess, TessData::polygon_size, &polygon[0], sizeof(float) * TessData::vertex_size, + (int)polygon.size() / TessData::vertex_size); + + // Add holes + for (auto &hole : holes) { + tessAddContour(tess, TessData::polygon_size, &hole[0], sizeof(float) * TessData::vertex_size, + (int)hole.size() / TessData::vertex_size); + } + + if (!tessTesselate(tess, TESS_WINDING_ODD, TESS_POLYGONS, TessData::polygon_size, + TessData::vertex_size, nullptr)) { + throw PenumbraException(fmt::format("Unable to tessellate surface, \"{}\".", name), *logger); + } + + // For now convert to glDrawArrays() style of vertices, sometime may change to glDrawElements + // (with element buffers) + std::vector vertex_array; + const TESSreal *vertices = tessGetVertices(tess); + const int number_of_elements = tessGetElementCount(tess); + const TESSindex *elements = tessGetElements(tess); + for (int i = 0; i < number_of_elements * TessData::polygon_size; ++i) { + const int vertex = *(elements + i); + for (int j = 0; j < TessData::vertex_size; ++j) { + vertex_array.push_back(vertices[vertex * TessData::vertex_size + j]); + } + } + + TessData data(&vertex_array[0], static_cast(vertex_array.size())); + + tessDeleteTess(tess); + + return data; +} + +} // namespace Penumbra diff --git a/third_party/penumbra/src/surface-implementation.h b/third_party/penumbra/src/surface-implementation.h new file mode 100644 index 00000000000..078c657c84b --- /dev/null +++ b/third_party/penumbra/src/surface-implementation.h @@ -0,0 +1,37 @@ +/* Copyright (c) 2017 Big Ladder Software LLC. All rights reserved. + * See the LICENSE file for additional terms and conditions. */ + +#ifndef SURFACE_IMPLEMENTATION_H_ +#define SURFACE_IMPLEMENTATION_H_ + +// Standard +#include +#include + +// Vendor +#include +#include + +namespace Penumbra { + +struct TessData { + TessData(const float *array, unsigned int number_of_vertices); + std::vector vertices; + unsigned int number_of_vertices; + static const int polygon_size{3}; // making triangles + static const int vertex_size{3}; // i.e., 3D +}; + +class SurfaceImplementation { +public: + SurfaceImplementation() = default; + explicit SurfaceImplementation(Polygon polygon); + TessData tessellate(); + Polygon polygon; + std::vector holes; + std::shared_ptr logger; + std::string name; +}; + +} // namespace Penumbra +#endif // SURFACE_IMPLEMENTATION_H_ diff --git a/third_party/penumbra/src/surface-private.h b/third_party/penumbra/src/surface-private.h deleted file mode 100644 index 8f27138a458..00000000000 --- a/third_party/penumbra/src/surface-private.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2017 Big Ladder Software LLC. All rights reserved. - * See the LICENSE file for additional terms and conditions. */ - -#ifndef SURFACE_PRIVATE_H_ -#define SURFACE_PRIVATE_H_ - -// Vendor -#include - -// Standard -#include -#include - -namespace Pumbra { - -struct TessData { - TessData(const float *array, unsigned numVerts); - std::vector vertices; - unsigned numVerts; - static const int polySize = 3; // making triangles - static const int vertexSize = 3; // i.e., 3D -}; - -class SurfacePrivate { -public: - SurfacePrivate(); - SurfacePrivate(const Polygon &polygon); - Polygon polygon; - std::vector holes; - TessData tessellate(); - std::shared_ptr vertPtr; -}; - -} // namespace Pumbra -#endif // SURFACE_PRIVATE_H_ diff --git a/third_party/penumbra/src/surface.cpp b/third_party/penumbra/src/surface.cpp index 4f802c70afa..c765dfcd1de 100644 --- a/third_party/penumbra/src/surface.cpp +++ b/third_party/penumbra/src/surface.cpp @@ -7,94 +7,27 @@ // Penumbra #include -#include -#include "error.h" +#include "surface-implementation.h" -namespace Pumbra { +namespace Penumbra { -/* -void* stdAlloc(void* userData, unsigned size) -{ - int* allocated = ( int*)userData; - TESS_NOTUSED(userData); - *allocated += (int)size; - return malloc(size); +Surface::Surface() { + surface = std::make_shared(); } -void stdFree(void* userData, void* ptr) -{ - TESS_NOTUSED(userData); - free(ptr); +Surface::Surface(const Polygon &polygon, const std::string &name_in) { + surface = std::make_shared(polygon); + surface->name = name_in; } -*/ -TessData::TessData(const float *array, unsigned numVerts) : numVerts(numVerts) { - vertices.insert(vertices.end(), (const float *)array, (const float *)array + numVerts); +Surface::Surface(const Surface &surface_in) { + surface = surface_in.surface; } -Surface::Surface() { surface = std::make_shared(); } +Surface::~Surface() = default; -Surface::Surface(const Polygon &polygon) { surface = std::make_shared(polygon); } - -Surface::Surface(const Surface &srf) { surface = srf.surface; } - -Surface::~Surface() {} - -int Surface::setOuterPolygon(const Polygon &polygon) { - surface->polygon = polygon; - return 0; -} - -int Surface::addHole(const Polygon &hole) { +void Surface::add_hole(const Polygon &hole) { surface->holes.push_back(hole); - return 0; -} - -SurfacePrivate::SurfacePrivate() {} - -SurfacePrivate::SurfacePrivate(const Polygon &polygon) : polygon(polygon) {} - -TessData SurfacePrivate::tessellate() { - TESStesselator *tess = 0; - tess = tessNewTess(nullptr); - - if (!tess) { - showMessage(MSG_ERR, "Unable to create tessellator."); - } - - // Add primary polygon - tessAddContour(tess, TessData::polySize, &polygon[0], sizeof(float) * TessData::vertexSize, - (int)polygon.size() / TessData::vertexSize); - - // Add holes - for (auto &hole : holes) { - tessAddContour(tess, TessData::polySize, &hole[0], sizeof(float) * TessData::vertexSize, - (int)hole.size() / TessData::vertexSize); - } - - if (!tessTesselate(tess, TESS_WINDING_ODD, TESS_POLYGONS, TessData::polySize, - TessData::vertexSize, nullptr)) { - showMessage(MSG_ERR, "Unable to tessellate surface."); - } - - // For now convert to glDrawArrays() style of vertices, sometime may change to glDrawElements - // (with element buffers) - std::vector vertexArray; - const TESSreal *verts = tessGetVertices(tess); - const int nelems = tessGetElementCount(tess); - const TESSindex *elems = tessGetElements(tess); - for (int i = 0; i < nelems * TessData::polySize; ++i) { - const int vert = *(elems + i); - for (int j = 0; j < TessData::vertexSize; ++j) { - vertexArray.push_back(verts[vert * TessData::vertexSize + j]); - } - } - - TessData data(&vertexArray[0], vertexArray.size()); - - tessDeleteTess(tess); - - return data; } -} // namespace Pumbra +} // namespace Penumbra diff --git a/third_party/penumbra/test/CMakeLists.txt b/third_party/penumbra/test/CMakeLists.txt deleted file mode 100644 index 6c1cbf77472..00000000000 --- a/third_party/penumbra/test/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -include_directories("${penumbra_SOURCE_DIR}/src" - "${penumbra_SOURCE_DIR}/include" - "${gtest_SOURCE_DIR}/include") - -set(test_sources - penumbra_test.cpp) - -link_libraries(penumbra gtest) - -add_executable(penumbra_tests ${test_sources}) - -include(GoogleTest) - -if (OPENGL_FOUND) - gtest_discover_tests(penumbra_tests) -else() - message("Penumbra: OpenGL not found. Relevant unit tests will not be executed.") -endif() \ No newline at end of file diff --git a/third_party/penumbra/test/penumbra_test.cpp b/third_party/penumbra/test/penumbra_test.cpp deleted file mode 100644 index 8df8dbdc6d2..00000000000 --- a/third_party/penumbra/test/penumbra_test.cpp +++ /dev/null @@ -1,424 +0,0 @@ -/* Copyright (c) 2017 Big Ladder Software LLC. All rights reserved. - * See the LICENSE file for additional terms and conditions. */ - -#define _USE_MATH_DEFINES -#include - -#include "gtest/gtest.h" - -#include - -float calculate_surface_exposure(float azimuth, float altitude){ - - // Due to the one sided nature of shaded surfaces, we will revert - // negative values to zero, as this indicates that the opposite side - // of the surface is shaded. This shading should be disregarded. - auto incident_azimuth = cos(azimuth); - if (incident_azimuth< 0){ - incident_azimuth=0; - } - auto incident_altitude = cos(altitude); - if (incident_altitude< 0){ - incident_altitude=0; - } - return incident_azimuth*incident_altitude; -} - -Pumbra::PenumbraCallbackFunction penumbraCallbackFunction; -void *messageCallbackContextPtr; - -const std::string invalid_context_str = "A valid context could not be created. Test skipped."; - -TEST(PenumbraTest, check_azimuth) { - - if (!Pumbra::Penumbra::isValidContext()) - { - EXPECT_TRUE(true) << invalid_context_str << std::endl; - return; - } - - Pumbra::Penumbra pumbra; - - // Loop azimuth (with zero altitude). - for (float azm = 0.0f; azm <= 2 * M_PI; azm += M_PI_4) { - pumbra.setSunPosition(azm, 0.0f); - float check_azimuth = pumbra.getSunAzimuth(); - EXPECT_FLOAT_EQ(azm, check_azimuth); - } -} - -TEST(PenumbraTest, check_altitude) { - if (!Pumbra::Penumbra::isValidContext()) - { - EXPECT_TRUE(true) << invalid_context_str << std::endl; - return; - } - Pumbra::Penumbra pumbra; - - // Loop altitude around the axis (with zero azimuth). - for (float alt = 0.0f; alt <= 2 * M_PI; alt += M_PI_4) { - pumbra.setSunPosition(0.0f, alt); - float check_altitude = pumbra.getSunAltitude(); - EXPECT_FLOAT_EQ(alt, check_altitude); - } -} - -TEST(PenumbraTest, azimuth) { - if (!Pumbra::Penumbra::isValidContext()) - { - EXPECT_TRUE(true) << invalid_context_str << std::endl; - return; - } - Pumbra::Polygon wallVerts = {0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 1.f, 0.f, 1.f, 0.f, 0.f, 1.f}; - Pumbra::Surface wall(wallVerts); - Pumbra::Penumbra pumbra; - unsigned wallId = pumbra.addSurface(wall); - pumbra.setModel(); - // Loop azimuth around the surface (with zero altitude). - for (float azm = 0.0f; azm <= 2 * M_PI; azm += M_PI_4) { - pumbra.setSunPosition(azm, 0.0f); - float wallPSSA = pumbra.calculatePSSA(wallId); - EXPECT_NEAR(wallPSSA, std::abs(cos(azm)), 0.01) << "azm evaluates to " << azm; - // pumbra.renderScene(wallId); - } -} - -TEST(PenumbraTest, interior) { - if (!Pumbra::Penumbra::isValidContext()) - { - EXPECT_TRUE(true) << invalid_context_str << std::endl; - return; - } - float const r_W = 2., r_D = 1., r_H = 1.; // Overall dimensions - float const w_W = 1., w_H = .5; // Window dimensions - - Pumbra::Polygon wallFrontVerts = { - -r_W / 2.f, r_D / 2.f, -r_H / 2.f, r_W / 2.f, r_D / 2.f, -r_H / 2.f, - r_W / 2.f, r_D / 2.f, r_H / 2.f, -r_W / 2.f, r_D / 2.f, r_H / 2.f, - }; - - Pumbra::Polygon wallFrontWindowVerts = { - -w_W / 2.f, r_D / 2.f, -w_H / 2.f, w_W / 2.f, r_D / 2.f, -w_H / 2.f, - w_W / 2.f, r_D / 2.f, w_H / 2.f, -w_W / 2.f, r_D / 2.f, w_H / 2.f, - }; - - Pumbra::Polygon wallBackVerts = { - r_W / 2.f, -r_D / 2.f, -r_H / 2.f, -r_W / 2.f, -r_D / 2.f, -r_H / 2.f, - -r_W / 2.f, -r_D / 2.f, r_H / 2.f, r_W / 2.f, -r_D / 2.f, r_H / 2.f, - }; - - /* Pumbra::Polygon wallBackVerts = //Can use this to check changing norm of back wall. - { - -r_W / 2.f, -r_D / 2.f, -r_H / 2.f, - r_W / 2.f, -r_D / 2.f, -r_H / 2.f, - r_W / 2.f, -r_D / 2.f, r_H / 2.f, - -r_W / 2.f, -r_D / 2.f, r_H / 2.f, - }; - */ - Pumbra::Polygon roofVerts = { - -r_W / 2.f, r_D / 2.f, r_H / 2.f, r_W / 2.f, r_D / 2.f, r_H / 2.f, - r_W / 2.f, -r_D / 2.f, r_H / 2.f, -r_W / 2.f, -r_D / 2.f, r_H / 2.f, - }; - - Pumbra::Polygon floorVerts = { - -r_W / 2.f, r_D / 2.f, -r_H / 2.f, r_W / 2.f, r_D / 2.f, -r_H / 2.f, - r_W / 2.f, -r_D / 2.f, -r_H / 2.f, -r_W / 2.f, -r_D / 2.f, -r_H / 2.f, - }; - - Pumbra::Polygon sideWallLeftVerts = { - -r_W / 2.f, r_D / 2.f, -r_H / 2.f, -r_W / 2.f, r_D / 2.f, r_H / 2.f, - -r_W / 2.f, -r_D / 2.f, r_H / 2.f, -r_W / 2.f, -r_D / 2.f, -r_H / 2.f, - }; - - Pumbra::Polygon sideWallRightVerts = { - r_W / 2.f, r_D / 2.f, -r_H / 2.f, r_W / 2.f, r_D / 2.f, r_H / 2.f, - r_W / 2.f, -r_D / 2.f, r_H / 2.f, r_W / 2.f, -r_D / 2.f, -r_H / 2.f, - }; - - Pumbra::Surface wallFront(wallFrontVerts); - wallFront.addHole(wallFrontWindowVerts); - - Pumbra::Surface window(wallFrontWindowVerts); - Pumbra::Surface wallBack(wallBackVerts); - Pumbra::Surface roof(roofVerts); - Pumbra::Surface floor(floorVerts); - Pumbra::Surface sideWallLeft(sideWallLeftVerts); - Pumbra::Surface sideWallRight(sideWallRightVerts); - - Pumbra::Penumbra pumbra2; - - unsigned wallFrontId = pumbra2.addSurface(wallFront); - unsigned windowId = pumbra2.addSurface(window); - unsigned wallBackId = pumbra2.addSurface(wallBack); - /* unsigned roofId = */ pumbra2.addSurface(roof); - unsigned floorId = pumbra2.addSurface(floor); - unsigned sideWallLeftId = pumbra2.addSurface(sideWallLeft); - unsigned sideWallRightId = pumbra2.addSurface(sideWallRight); - - pumbra2.setModel(); - pumbra2.setSunPosition(0.0f, 0.f); - float wallPSSA2 = pumbra2.calculatePSSA(wallFrontId); - EXPECT_NEAR(wallPSSA2, r_W * r_H - w_W * w_H, 0.01); - // pumbra2.renderScene(wallFrontId); - - float backWallInteriorPSSA = pumbra2.calculateInteriorPSSAs({windowId}, {wallBackId})[wallBackId]; - EXPECT_NEAR(backWallInteriorPSSA, w_W * w_H, 0.01); - // pumbra2.renderInteriorScene({windowId},{wallBackId}); - - pumbra2.setSunPosition(3.1415f, 0.f); - float wallPSSA3 = pumbra2.calculatePSSA(wallFrontId); - EXPECT_NEAR(wallPSSA3, 0.f, 0.01); // WallFront should be blocked by back wall. - // pumbra2.renderScene(wallFrontId); - - pumbra2.setSunPosition(0.5f, 0.5f); - std::map intPSSAs = pumbra2.calculateInteriorPSSAs( - {windowId}, {wallBackId, floorId, sideWallLeftId, sideWallRightId}); - backWallInteriorPSSA = intPSSAs[wallBackId]; - float floorInteriorPSSA = intPSSAs[floorId]; - float leftWallInteriorPSSA = intPSSAs[sideWallLeftId]; - float rightWallInteriorPSSA = intPSSAs[sideWallRightId]; - EXPECT_GT(backWallInteriorPSSA, 0.f); - EXPECT_GT(floorInteriorPSSA, 0.f); - EXPECT_GT(leftWallInteriorPSSA, 0.f); - EXPECT_EQ(rightWallInteriorPSSA, 0.f); - // pumbra2.renderInteriorScene({windowId},{wallBackId, floorId, sideWallLeftId, sideWallRightId}); -} - -TEST(PenumbraTest, calculatePSSA_multiple_surfaces) { - if (!Pumbra::Penumbra::isValidContext()) - { - EXPECT_TRUE(true) << invalid_context_str << std::endl; - return; - } - //create a cube - float const r_W = 1.f, r_D = 1.f, r_H = 1.f; // Overall dimensions - - Pumbra::Polygon wallFrontVerts = { - -r_W / 2.f, r_D / 2.f, -r_H / 2.f, - r_W / 2.f, r_D / 2.f, -r_H / 2.f, - r_W / 2.f, r_D / 2.f, r_H / 2.f, - -r_W / 2.f, r_D / 2.f, r_H / 2.f, - }; - - Pumbra::Polygon wallBackVerts = { - r_W / 2.f, -r_D / 2.f, -r_H / 2.f, - -r_W / 2.f, -r_D / 2.f, -r_H / 2.f, - -r_W / 2.f, -r_D / 2.f, r_H / 2.f, - r_W / 2.f, -r_D / 2.f, r_H / 2.f, - }; - - Pumbra::Polygon roofVerts = { - -r_W / 2.f, r_D / 2.f, r_H / 2.f, - r_W / 2.f, r_D / 2.f, r_H / 2.f, - r_W / 2.f, -r_D / 2.f, r_H / 2.f, - -r_W / 2.f, -r_D / 2.f, r_H / 2.f, - }; - - Pumbra::Polygon floorVerts = { - -r_W / 2.f, r_D / 2.f, -r_H / 2.f, - r_W / 2.f, r_D / 2.f, -r_H / 2.f, - r_W / 2.f, -r_D / 2.f, -r_H / 2.f, - -r_W / 2.f, -r_D / 2.f, -r_H / 2.f, - }; - - Pumbra::Polygon sideWallLeftVerts = { - -r_W / 2.f, r_D / 2.f, -r_H / 2.f, - -r_W / 2.f, r_D / 2.f, r_H / 2.f, - -r_W / 2.f, -r_D / 2.f, r_H / 2.f, - -r_W / 2.f, -r_D / 2.f, -r_H / 2.f, - }; - - Pumbra::Polygon sideWallRightVerts = { - r_W / 2.f, r_D / 2.f, -r_H / 2.f, - r_W / 2.f, r_D / 2.f, r_H / 2.f, - r_W / 2.f, -r_D / 2.f, r_H / 2.f, - r_W / 2.f, -r_D / 2.f, -r_H / 2.f, - }; - - Pumbra::Surface wallFront(wallFrontVerts); - Pumbra::Surface wallBack(wallBackVerts); - Pumbra::Surface roof(roofVerts); - Pumbra::Surface floor(floorVerts); - Pumbra::Surface sideWallLeft(sideWallLeftVerts); - Pumbra::Surface sideWallRight(sideWallRightVerts); - - Pumbra::Penumbra pumbra; - - const unsigned wallFrontId = pumbra.addSurface(wallFront); - const unsigned wallBackId = pumbra.addSurface(wallBack); - const unsigned roofId = pumbra.addSurface(roof); - const unsigned floorId = pumbra.addSurface(floor); - const unsigned sideWallLeftId = pumbra.addSurface(sideWallLeft); - const unsigned sideWallRightId = pumbra.addSurface(sideWallRight); - - const std::vector test_cube{wallFrontId, wallBackId, roofId, floorId, sideWallLeftId, sideWallRightId}; - - pumbra.setModel(); - - pumbra.setSunPosition(0.0f, 0.0f); - std::vector results = pumbra.calculatePSSA(test_cube); - - float M_PI_3_4 = M_PI_4+M_PI_2; - - const std::vector> angular_test_data{ - { 0.0f, 0.0f }, // wallFront full shade - { M_PI_4, 0.0f }, // wallFront half shade, sideWallRightId half shade - { M_PI_2, 0.0f }, // sideWallRight full shade !! - { M_PI_3_4, 0.0f }, // wallBack half shade, sideWallRight half shade - { -M_PI_2, 0.0f }, // sideWallLeft full shade !! - { M_PI, 0.0f }, // wallBack full shade - { 0.0f, M_PI_2 }, // roof full shade !! - { 0.0f, -M_PI_2 }, // floor full shade !! - }; - - for( auto const& sunPosition : angular_test_data ) - { - pumbra.setSunPosition(sunPosition.first, sunPosition.second); - results = pumbra.calculatePSSA(); - float azimuth, altitude; - for( auto side : test_cube){ - switch (side) { - case 0: //wallFrontId - azimuth = sunPosition.first; - altitude = sunPosition.second; - break; - case 1: //wallBackId - azimuth = sunPosition.first + M_PI; - altitude = sunPosition.second; - break; - case 2: //roofId - azimuth = sunPosition.first; - altitude = sunPosition.second - M_PI_2; - break; - case 3: //floorId - azimuth = sunPosition.first; - altitude = sunPosition.second + M_PI_2; - break; - case 4: //sideWallLeftId - azimuth = sunPosition.first + M_PI_2; - altitude = sunPosition.second; - break; - case 5: //sideWallRightId - azimuth = sunPosition.first - M_PI_2; - altitude = sunPosition.second; - break; - default: - FAIL() << "Side not found."; - } - - float expectedResults = calculate_surface_exposure(azimuth, altitude); - - //pumbra.renderScene(side); - - EXPECT_NEAR(results[side], expectedResults, 0.01); - } - } -} - -TEST(PenumbraTest, vendor_name) { - if (!Pumbra::Penumbra::isValidContext()) - { - EXPECT_TRUE(true) << invalid_context_str << std::endl; - return; - } - - Pumbra::Penumbra pumbra; - Pumbra::VendorName vname = pumbra.getVendorName(); - - switch(vname) { - case Pumbra::VendorName::None: - SUCCEED(); - break; - case Pumbra::VendorName::NVIDIA: - SUCCEED(); - break; - case Pumbra::VendorName::AMD: - SUCCEED(); - break; - case Pumbra::VendorName::Intel: - SUCCEED(); - break; - case Pumbra::VendorName::VMware: - SUCCEED(); - break; - default: - FAIL() << "Vendor Name not found."; - } -} - -TEST(PenumbraTest, side_count_check) { - if (!Pumbra::Penumbra::isValidContext()) - { - EXPECT_TRUE(true) << invalid_context_str << std::endl; - return; - } - - Pumbra::Polygon wallVerts = {0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 1.f, 0.f, 1.f, 0.f, 0.f, 1.f}; - Pumbra::Surface wall(wallVerts); - Pumbra::Penumbra pumbra; - - pumbra.addSurface(wall); - pumbra.setModel(); - - EXPECT_EQ(pumbra.getNumSurfaces(), 1u); - - pumbra.clearModel(); - - Pumbra::Polygon wallFrontVerts = { -.5f, .5f, -.5f, .5f, .5f, -.5f, .5f, .5f, .5f, -.5f, .5f, .5f }; - - Pumbra::Polygon wallBackVerts = { .5f, -.5f, -.5f, -.5f, -.5f, -.5f, -.5f, -.5f, .5f, .5f, -.5f, .5f }; - - Pumbra::Polygon roofVerts = { -.5f, .5f, .5f, .5f, .5f, .5f, .5f, -.5f, .5f, -.5f, -.5f, .5f }; - - Pumbra::Surface wallFront(wallFrontVerts); - Pumbra::Surface wallBack(wallBackVerts); - Pumbra::Surface roof(roofVerts); - - pumbra.addSurface(wallFront); - pumbra.addSurface(wallBack); - pumbra.addSurface(roof); - - pumbra.setModel(); - - EXPECT_EQ(pumbra.getNumSurfaces(), 3u); -} - -TEST(PenumbraTest, bad_surface_input_errors) { - if (!Pumbra::Penumbra::isValidContext()) - { - EXPECT_TRUE(true) << invalid_context_str << std::endl; - return; - } - - const std::vector bad_test_cube{5, 6, 7, 8, 9, 10}; - - Pumbra::Polygon wallFrontVerts = { -.5f, .5f, -.5f, .5f, .5f, -.5f, .5f, .5f, .5f, -.5f, .5f, .5f }; - - Pumbra::Polygon wallBackVerts = { .5f, -.5f, -.5f, -.5f, -.5f, -.5f, -.5f, -.5f, .5f, .5f, -.5f, .5f }; - - Pumbra::Polygon roofVerts = { -.5f, .5f, .5f, .5f, .5f, .5f, .5f, -.5f, .5f, -.5f, -.5f, .5f }; - - Pumbra::Surface wallFront(wallFrontVerts); - Pumbra::Surface wallBack(wallBackVerts); - Pumbra::Surface roof(roofVerts); - - Pumbra::Penumbra pumbra(penumbraCallbackFunction, messageCallbackContextPtr); - - pumbra.addSurface(wallFront); - pumbra.addSurface(wallBack); - pumbra.addSurface(roof); - - pumbra.setModel(); - - EXPECT_EXIT(pumbra.calculatePSSA(bad_test_cube), ::testing::ExitedWithCode(EXIT_FAILURE), "Error: Surface index, X, does not exist. Cannot calculate PSSA."); - - EXPECT_DEATH(pumbra.renderScene(11), "Surface index, X, does not exist. Cannot render scene."); - - EXPECT_DEATH(pumbra.fetchPSSA(bad_test_cube), "Surface index, X, does not exist. Cannot calculate PSSA."); -} - -int main(int argc, char **argv) { - ::testing::InitGoogleTest(&argc, argv); - - return RUN_ALL_TESTS(); -} diff --git a/third_party/penumbra/vendor/CMakeLists.txt b/third_party/penumbra/vendor/CMakeLists.txt index 904d1154d42..c81a1b284a9 100644 --- a/third_party/penumbra/vendor/CMakeLists.txt +++ b/third_party/penumbra/vendor/CMakeLists.txt @@ -1,57 +1,60 @@ -# GLAD library -add_subdirectory(glad) - -if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") - # Update submodules as needed - option(GIT_SUBMODULE "Check submodules during build" ON) - if(GIT_SUBMODULE) - message(STATUS "Submodule update") - execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - RESULT_VARIABLE GIT_SUBMOD_RESULT) - if(NOT GIT_SUBMOD_RESULT EQUAL "0") - message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules") - endif() - endif() -endif() +include(initialize-submodules) +initialize_submodules() -#if(NOT EXISTS "${PROJECT_SOURCE_DIR}/extern/repo/CMakeLists.txt") -# message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.") -#endif() +# GLAD +add_subdirectory(glad) +target_include_directories(glad PUBLIC ${PROJECT_SOURCE_DIR}/vendor/glad/include) -# GLFW libaray +# GLFW library set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) set(GLFW_INSTALL OFF CACHE BOOL "" FORCE) - if (APPLE) set(GLFW_USE_MENUBAR OFF CACHE BOOL "" FORCE) endif() +mark_as_advanced( + GLFW_BUILD_DOCS + GLFW_BUILD_TESTS + GLFW_BUILD_EXAMPLES + GLFW_INSTALL + GLFW_USE_MENUBAR + GLFW_USE_OSMESA + GLFW_VULKAN_STATIC + BUILD_SHARED_LIBS +) + add_subdirectory(glfw) +target_include_directories(glfw PUBLIC + ${PROJECT_SOURCE_DIR}/vendor/glfw/include + ${PROJECT_SOURCE_DIR}/vendor/glfw/deps +) # tess2 library file(GLOB libtess2_sources "${CMAKE_CURRENT_SOURCE_DIR}/libtess2/Source/[a-zA-Z]*.c") -if (UNIX) - ADD_DEFINITIONS("-fPIC") -endif() - add_library(tess2 ${libtess2_sources}) target_include_directories(tess2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libtess2/Include) target_include_directories(tess2 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/libtess2/Source) +if (NOT TARGET courierr) + add_subdirectory(courierr) + mark_as_advanced(courierr_BUILD_TESTING courierr_COVERAGE courierr_STATIC_LIB) +endif () # googletest library -if (BUILD_PENUMBRA_TESTING AND NOT TARGET gtest) +if (${PROJECT_NAME}_BUILD_TESTING AND NOT TARGET gtest) # Prevent GoogleTest from overriding our compiler/linker options # when building with Visual Studio set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) - set(BUILD_GTEST ON CACHE BOOL "" FORCE) + set(BUILD_GTEST ON CACHE BOOL "" FORCE MARK) + set(BUILD_GMOCK ON CACHE BOOL "" FORCE) + set(INSTALL_GTEST OFF CACHE BOOL "" FORCE) + mark_as_advanced(BUILD_GTEST BUILD_GMOCK INSTALL_GTEST) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/googletest ${googletest_BINARY_DIR}) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/googletest) endif() diff --git a/third_party/penumbra/vendor/courierr/.clang-format b/third_party/penumbra/vendor/courierr/.clang-format new file mode 100644 index 00000000000..eee15149644 --- /dev/null +++ b/third_party/penumbra/vendor/courierr/.clang-format @@ -0,0 +1,126 @@ +# Supports clang-format 10 +--- +Language: Cpp +AccessModifierOffset: -2 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: None +AlignConsecutiveDeclarations: None +AlignConsecutiveMacros: None +AlignEscapedNewlines: Right +#CF12# AlignOperands: Align +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true # depr. after CF14, see PackConstructorInitializers +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +#CF12# AllowShortEnumsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: Yes +#CF12# AttributeMacros: [] +BinPackArguments: false +BinPackParameters: false +#CF12# BitFieldColonSpacing: +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Stroustrup +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeComma +BreakInheritanceList: AfterComma +BreakStringLiterals: true +ColumnLimit: 100 +CommentPragmas: '' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +#CF11# DeriveLindEnding: false +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: [] +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '(test)?$' +IncludeIsMainSourceRegex: '' +#CF13# IndentAccessModifiers: +#CF11# IndentCaseBlocks: +IndentCaseLabels: false +#CF12# IndentExternBlock +IndentGotoLabels: false +IndentPPDirectives: None +IndentWidth: 4 +IndentWrappedFunctionNames: false +#CF12# InsertTrailingCommas: +KeepEmptyLinesAtTheStartOfBlocks: true +#CF13# LambdaBodyIndentation: Signature +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +NamespaceMacros: [] +#CF14# PPIndentWidth: +#CF14# PackConstructorInitializers: Never +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +#CF12# PenaltyIndentedWhitespace: +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Left +#CF14# QualifierAlignment +#CF14# QualifierOrder +RawStringFormats: [] +#CF14# ReferenceAlignment: Right +ReflowComments: true +#CF14# ShortNamespaceLines: +SortIncludes: Never +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +#CF12# SpaceAroundPointerQualifiers: Default +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: true +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +#CF14# SpaceBeforeParensOptions: + # AfterControlStatements: true + # AfterFunctionDefinitionName: true +SpaceBeforeRangeBasedForLoopColon: true +#CF11# SpaceBeforeSquareBrackets: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +#CF14# SpacesInAngles: false +SpacesInCStyleCastParentheses: false +#CF11# SpacesInConditionalStatement: false +SpacesInContainerLiterals: true +#CF14# SpacesInLineCommentPrefix: + # Minimum: 0 + # Maximum: 1 +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp11 +#CF12# StatementAttributeLikeMacros: +StatementMacros: [] +TabWidth: 4 +#CF11# UseCRLF: Never +UseTab: Never +#CF12# WhitespaceSensitiveMacros [] + diff --git a/third_party/penumbra/vendor/courierr/.gitignore b/third_party/penumbra/vendor/courierr/.gitignore new file mode 100644 index 00000000000..7af89100558 --- /dev/null +++ b/third_party/penumbra/vendor/courierr/.gitignore @@ -0,0 +1,4 @@ +build/ +builds/ +.idea/ +.DS_Store diff --git a/third_party/penumbra/vendor/courierr/CMakeLists.txt b/third_party/penumbra/vendor/courierr/CMakeLists.txt new file mode 100644 index 00000000000..58c52b9d0d6 --- /dev/null +++ b/third_party/penumbra/vendor/courierr/CMakeLists.txt @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 3.10) # required for gtest_discover_tests + +project(courierr) + +# Set a default build type if none was specified +if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" + "MinSizeRel" "RelWithDebInfo") +endif () + +find_package(Git QUIET) + +set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") + +option(${PROJECT_NAME}_BUILD_TESTING "Build ${PROJECT_NAME} testing targets" OFF) +option(${PROJECT_NAME}_COVERAGE "Generate ${PROJECT_NAME} coverage reports" OFF) +option(${PROJECT_NAME}_STATIC_LIB "Make ${PROJECT_NAME} a static library" ON) + +if (NOT ${PROJECT_NAME}_STATIC_LIB) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) +endif () + +# Set up testing/coverage +if (${PROJECT_NAME}_BUILD_TESTING) + enable_testing() + if (${PROJECT_NAME}_COVERAGE) + set(ENABLE_COVERAGE ON CACHE BOOL "" FORCE) + find_package(codecov) + endif () +endif () + +# Add subdirectories +add_subdirectory("include/${PROJECT_NAME}") +add_subdirectory(vendor) + +if (${PROJECT_NAME}_BUILD_TESTING) + add_subdirectory(test) + if (${PROJECT_NAME}_COVERAGE) + coverage_evaluate() + endif () +endif () diff --git a/third_party/penumbra/vendor/courierr/LICENSE.txt b/third_party/penumbra/vendor/courierr/LICENSE.txt new file mode 100644 index 00000000000..11964308807 --- /dev/null +++ b/third_party/penumbra/vendor/courierr/LICENSE.txt @@ -0,0 +1,11 @@ +Copyright (c) 2019 Big Ladder Software, LLC + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/third_party/penumbra/vendor/courierr/cmake/initialize-submodules.cmake b/third_party/penumbra/vendor/courierr/cmake/initialize-submodules.cmake new file mode 100644 index 00000000000..ba17543f48e --- /dev/null +++ b/third_party/penumbra/vendor/courierr/cmake/initialize-submodules.cmake @@ -0,0 +1,27 @@ +macro(initialize_submodules) + if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") + set(git_modules_file "${PROJECT_SOURCE_DIR}/.gitmodules") + if (EXISTS ${git_modules_file}) + file(STRINGS ${git_modules_file} file_lines) + foreach(line ${file_lines}) + if (${line} MATCHES "url =") + string(REGEX REPLACE "\\s*url = .*/(.*).git" "\\1" submodule "${line}") + string(STRIP "${submodule}" submodule) + if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${submodule}") + message(FATAL_ERROR "Submodule directory \"${CMAKE_CURRENT_SOURCE_DIR}/${submodule}\" does not exist") + endif() + # Initialize submodule if it hasn't already been cloned + if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${submodule}/.git") + message(STATUS "Initialize ${submodule} submodule") + execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive "${CMAKE_CURRENT_SOURCE_DIR}/${submodule}" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE GIT_SUBMOD_RESULT) + if(NOT GIT_SUBMOD_RESULT EQUAL "0") + message(FATAL_ERROR "git submodule update --init --recursive ${CMAKE_CURRENT_SOURCE_DIR}/${submodule} failed with ${GIT_SUBMOD_RESULT}, please checkout submodules") + endif() + endif() + endif() + endforeach() + endif() + endif() +endmacro() \ No newline at end of file diff --git a/third_party/penumbra/vendor/courierr/include/courierr/CMakeLists.txt b/third_party/penumbra/vendor/courierr/include/courierr/CMakeLists.txt new file mode 100644 index 00000000000..9c4a9867a74 --- /dev/null +++ b/third_party/penumbra/vendor/courierr/include/courierr/CMakeLists.txt @@ -0,0 +1,8 @@ +file(GLOB_RECURSE public_headers "${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/[a-zA-Z]*.h") + +add_library(${PROJECT_NAME} INTERFACE ${public_headers}) +target_include_directories(${PROJECT_NAME} INTERFACE "${PROJECT_SOURCE_DIR}/include") + +if (${PROJECT_NAME}_COVERAGE) + add_coverage(${PROJECT_NAME}) +endif () \ No newline at end of file diff --git a/third_party/penumbra/vendor/courierr/include/courierr/courierr.h b/third_party/penumbra/vendor/courierr/include/courierr/courierr.h new file mode 100644 index 00000000000..acc7604a958 --- /dev/null +++ b/third_party/penumbra/vendor/courierr/include/courierr/courierr.h @@ -0,0 +1,72 @@ +/* Copyright (c) 2019 Big Ladder Software LLC. All rights reserved. + * See the LICENSE file for additional terms and conditions. */ + +#pragma once + +#include +#include +#include +#include + +#include + +namespace Courierr { + +class Courierr { + public: + virtual ~Courierr() = default; + + virtual void error(const std::string_view message) = 0; + virtual void warning(const std::string_view message) = 0; + virtual void info(const std::string_view message) = 0; + virtual void debug(const std::string_view message) = 0; + + void set_message_context(void* message_context_in) { message_context = message_context_in; }; + + protected: + void* message_context {nullptr}; +}; + +class SimpleCourierr : public Courierr { + public: + void error(const std::string_view message) override { write_message("ERROR", message); } + void warning(const std::string_view message) override { write_message("WARNING", message); } + void info(const std::string_view message) override { write_message("INFO", message); } + void debug(const std::string_view message) override { write_message("DEBUG", message); } + + private: + void write_message(const std::string_view message_type, const std::string_view message) + { + std::cout << fmt::format("[{}] {}", message_type, message) << std::endl; + } +}; + +class CourierrException : public std::exception { + public: + explicit CourierrException(const char* message, Courierr& courierr) + : message(message) + { + write_error(courierr); + } + explicit CourierrException(const std::string& message, Courierr& courierr) + : message(message) + { + write_error(courierr); + } + explicit CourierrException(const std::string_view message, Courierr& courierr) + : message(message) + { + write_error(courierr); + } + + virtual ~CourierrException() noexcept = default; + virtual const char* what() const noexcept { return message.c_str(); } + + protected: + std::string message; + + private: + void write_error(Courierr& courierr) { courierr.error(message); } +}; + +} // namespace Courierr diff --git a/third_party/penumbra/vendor/courierr/vendor/CMakeLists.txt b/third_party/penumbra/vendor/courierr/vendor/CMakeLists.txt new file mode 100644 index 00000000000..9dbf1404ebb --- /dev/null +++ b/third_party/penumbra/vendor/courierr/vendor/CMakeLists.txt @@ -0,0 +1,21 @@ +include(initialize-submodules) +initialize_submodules() + +if (NOT TARGET fmt) + add_subdirectory(fmt) +endif () + +# googletest library +if (${PROJECT_NAME}_BUILD_TESTING AND NOT TARGET gtest) + + # Prevent GoogleTest from overriding our compiler/linker options + # when building with Visual Studio + set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + set(BUILD_GTEST ON CACHE BOOL "" FORCE MARK) + set(BUILD_GMOCK ON CACHE BOOL "" FORCE) + set(INSTALL_GTEST OFF CACHE BOOL "" FORCE) + mark_as_advanced(BUILD_GTEST BUILD_GMOCK INSTALL_GTEST) + + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/googletest) + +endif() diff --git a/third_party/penumbra/vendor/glad/CMakeLists.txt b/third_party/penumbra/vendor/glad/CMakeLists.txt index 0e772dab0d2..8457748dd26 100644 --- a/third_party/penumbra/vendor/glad/CMakeLists.txt +++ b/third_party/penumbra/vendor/glad/CMakeLists.txt @@ -1,9 +1,5 @@ -project(GLAD) - -include_directories(include) - -if (UNIX) - add_definitions("-fPIC") -endif() +project(GLAD LANGUAGES C) add_library(glad src/glad.c) + +target_include_directories(glad PUBLIC include) diff --git a/third_party/penumbra/vendor/glad/include/KHR/khrplatform.h b/third_party/penumbra/vendor/glad/include/KHR/khrplatform.h index 1ad3554a76e..dd22d927018 100644 --- a/third_party/penumbra/vendor/glad/include/KHR/khrplatform.h +++ b/third_party/penumbra/vendor/glad/include/KHR/khrplatform.h @@ -2,7 +2,7 @@ #define __khrplatform_h_ /* -** Copyright (c) 2008-2009 The Khronos Group Inc. +** Copyright (c) 2008-2018 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the @@ -26,18 +26,16 @@ /* Khronos platform-specific types and definitions. * - * $Revision: 32517 $ on $Date: 2016-03-11 02:41:19 -0800 (Fri, 11 Mar 2016) $ + * The master copy of khrplatform.h is maintained in the Khronos EGL + * Registry repository at https://github.com/KhronosGroup/EGL-Registry + * The last semantic modification to khrplatform.h was at commit ID: + * 67a3e0864c2d75ea5287b9f3d2eb74a745936692 * * Adopters may modify this file to suit their platform. Adopters are * encouraged to submit platform specific modifications to the Khronos * group so that they can be included in future versions of this file. - * Please submit changes by sending them to the public Khronos Bugzilla - * (http://khronos.org/bugzilla) by filing a bug against product - * "Khronos (general)" component "Registry". - * - * A predefined template which fills in some of the bug fields can be - * reached using http://tinyurl.com/khrplatform-h-bugreport, but you - * must create a Bugzilla login first. + * Please submit changes by filing pull requests or issues on + * the EGL Registry repository linked above. * * * See the Implementer's Guidelines for information about where this file @@ -92,12 +90,20 @@ * int arg2) KHRONOS_APIATTRIBUTES; */ +#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC) +# define KHRONOS_STATIC 1 +#endif + /*------------------------------------------------------------------------- * Definition of KHRONOS_APICALL *------------------------------------------------------------------------- * This precedes the return type of the function in the function prototype. */ -#if defined(_WIN32) && !defined(__SCITECH_SNAP__) +#if defined(KHRONOS_STATIC) + /* If the preprocessor constant KHRONOS_STATIC is defined, make the + * header compatible with static linking. */ +# define KHRONOS_APICALL +#elif defined(_WIN32) # define KHRONOS_APICALL __declspec(dllimport) #elif defined (__SYMBIAN32__) # define KHRONOS_APICALL IMPORT_C diff --git a/third_party/penumbra/vendor/glad/include/glad/glad.h b/third_party/penumbra/vendor/glad/include/glad/glad.h index 755de8e66bf..41a7dbc2c00 100644 --- a/third_party/penumbra/vendor/glad/include/glad/glad.h +++ b/third_party/penumbra/vendor/glad/include/glad/glad.h @@ -1,6 +1,6 @@ /* - OpenGL loader generated by glad 0.1.15a0 on Wed Nov 8 00:15:02 2017. + OpenGL loader generated by glad 0.1.34 on Wed Sep 29 18:24:50 2021. Language/Generator: C/C++ Specification: gl @@ -14,11 +14,12 @@ Loader: False Local files: False Omit khrplatform: False + Reproducible: False Commandline: --profile="core" --api="gl=2.1" --generator="c" --spec="gl" --no-loader --extensions="GL_APPLE_vertex_array_object,GL_ARB_framebuffer_object,GL_ARB_vertex_array_object,GL_EXT_framebuffer_object" Online: - http://glad.dav1d.de/#profile=core&language=c&specification=gl&api=gl%3D2.1&extensions=GL_APPLE_vertex_array_object&extensions=GL_ARB_framebuffer_object&extensions=GL_ARB_vertex_array_object&extensions=GL_EXT_framebuffer_object + https://glad.dav1d.de/#profile=core&language=c&specification=gl&api=gl%3D2.1&extensions=GL_APPLE_vertex_array_object&extensions=GL_ARB_framebuffer_object&extensions=GL_ARB_vertex_array_object&extensions=GL_EXT_framebuffer_object */ @@ -31,13 +32,7 @@ #define __gl_h_ #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN 1 -#endif -#ifndef NOMINMAX -#define NOMINMAX 1 -#endif -#include +#define APIENTRY __stdcall #endif #ifndef APIENTRY @@ -47,6 +42,10 @@ #define APIENTRYP APIENTRY * #endif +#ifndef GLAPIENTRY +#define GLAPIENTRY APIENTRY +#endif + #ifdef __cplusplus extern "C" { #endif @@ -87,59 +86,21 @@ typedef void* (* GLADloadproc)(const char *name); GLAPI struct gladGLversionStruct GLVersion; GLAPI int gladLoadGLLoader(GLADloadproc); -#include #include -#ifndef GLEXT_64_TYPES_DEFINED -/* This code block is duplicated in glxext.h, so must be protected */ -#define GLEXT_64_TYPES_DEFINED -/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ -/* (as used in the GL_EXT_timer_query extension). */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#include -#elif defined(__sun__) || defined(__digital__) -#include -#if defined(__STDC__) -#if defined(__arch64__) || defined(_LP64) -typedef long int int64_t; -typedef unsigned long int uint64_t; -#else -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#endif /* __arch64__ */ -#endif /* __STDC__ */ -#elif defined( __VMS ) || defined(__sgi) -#include -#elif defined(__SCO__) || defined(__USLC__) -#include -#elif defined(__UNIXOS2__) || defined(__SOL64__) -typedef long int int32_t; -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#elif defined(_WIN32) && defined(__GNUC__) -#include -#elif defined(_WIN32) -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#else -/* Fallback if nothing above works */ -#include -#endif -#endif typedef unsigned int GLenum; typedef unsigned char GLboolean; typedef unsigned int GLbitfield; typedef void GLvoid; -typedef signed char GLbyte; -typedef short GLshort; +typedef khronos_int8_t GLbyte; +typedef khronos_uint8_t GLubyte; +typedef khronos_int16_t GLshort; +typedef khronos_uint16_t GLushort; typedef int GLint; -typedef int GLclampx; -typedef unsigned char GLubyte; -typedef unsigned short GLushort; typedef unsigned int GLuint; +typedef khronos_int32_t GLclampx; typedef int GLsizei; -typedef float GLfloat; -typedef float GLclampf; +typedef khronos_float_t GLfloat; +typedef khronos_float_t GLclampf; typedef double GLdouble; typedef double GLclampd; typedef void *GLeglClientBufferEXT; @@ -151,33 +112,17 @@ typedef void *GLhandleARB; #else typedef unsigned int GLhandleARB; #endif -typedef unsigned short GLhalfARB; -typedef unsigned short GLhalf; -typedef GLint GLfixed; -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) -typedef long GLintptr; -#else -typedef ptrdiff_t GLintptr; -#endif -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) -typedef long GLsizeiptr; -#else -typedef ptrdiff_t GLsizeiptr; -#endif -typedef int64_t GLint64; -typedef uint64_t GLuint64; -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) -typedef long GLintptrARB; -#else -typedef ptrdiff_t GLintptrARB; -#endif -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) -typedef long GLsizeiptrARB; -#else -typedef ptrdiff_t GLsizeiptrARB; -#endif -typedef int64_t GLint64EXT; -typedef uint64_t GLuint64EXT; +typedef khronos_uint16_t GLhalf; +typedef khronos_uint16_t GLhalfARB; +typedef khronos_int32_t GLfixed; +typedef khronos_intptr_t GLintptr; +typedef khronos_intptr_t GLintptrARB; +typedef khronos_ssize_t GLsizeiptr; +typedef khronos_ssize_t GLsizeiptrARB; +typedef khronos_int64_t GLint64; +typedef khronos_int64_t GLint64EXT; +typedef khronos_uint64_t GLuint64; +typedef khronos_uint64_t GLuint64EXT; typedef struct __GLsync *GLsync; struct _cl_context; struct _cl_event; @@ -706,10 +651,10 @@ GLAPI PFNGLDISABLEPROC glad_glDisable; typedef void (APIENTRYP PFNGLENABLEPROC)(GLenum cap); GLAPI PFNGLENABLEPROC glad_glEnable; #define glEnable glad_glEnable -typedef void (APIENTRYP PFNGLFINISHPROC)(); +typedef void (APIENTRYP PFNGLFINISHPROC)(void); GLAPI PFNGLFINISHPROC glad_glFinish; #define glFinish glad_glFinish -typedef void (APIENTRYP PFNGLFLUSHPROC)(); +typedef void (APIENTRYP PFNGLFLUSHPROC)(void); GLAPI PFNGLFLUSHPROC glad_glFlush; #define glFlush glad_glFlush typedef void (APIENTRYP PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor); @@ -745,7 +690,7 @@ GLAPI PFNGLGETBOOLEANVPROC glad_glGetBooleanv; typedef void (APIENTRYP PFNGLGETDOUBLEVPROC)(GLenum pname, GLdouble *data); GLAPI PFNGLGETDOUBLEVPROC glad_glGetDoublev; #define glGetDoublev glad_glGetDoublev -typedef GLenum (APIENTRYP PFNGLGETERRORPROC)(); +typedef GLenum (APIENTRYP PFNGLGETERRORPROC)(void); GLAPI PFNGLGETERRORPROC glad_glGetError; #define glGetError glad_glGetError typedef void (APIENTRYP PFNGLGETFLOATVPROC)(GLenum pname, GLfloat *data); @@ -775,7 +720,7 @@ GLAPI PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv; typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC)(GLenum cap); GLAPI PFNGLISENABLEDPROC glad_glIsEnabled; #define glIsEnabled glad_glIsEnabled -typedef void (APIENTRYP PFNGLDEPTHRANGEPROC)(GLdouble near, GLdouble far); +typedef void (APIENTRYP PFNGLDEPTHRANGEPROC)(GLdouble n, GLdouble f); GLAPI PFNGLDEPTHRANGEPROC glad_glDepthRange; #define glDepthRange glad_glDepthRange typedef void (APIENTRYP PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height); @@ -991,7 +936,7 @@ GLAPI PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation; typedef void (APIENTRYP PFNGLCOMPILESHADERPROC)(GLuint shader); GLAPI PFNGLCOMPILESHADERPROC glad_glCompileShader; #define glCompileShader glad_glCompileShader -typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC)(); +typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC)(void); GLAPI PFNGLCREATEPROGRAMPROC glad_glCreateProgram; #define glCreateProgram glad_glCreateProgram typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC)(GLenum type); diff --git a/third_party/penumbra/vendor/glad/src/glad.c b/third_party/penumbra/vendor/glad/src/glad.c index 9fb3477df30..3faf453df70 100644 --- a/third_party/penumbra/vendor/glad/src/glad.c +++ b/third_party/penumbra/vendor/glad/src/glad.c @@ -1,6 +1,6 @@ /* - OpenGL loader generated by glad 0.1.15a0 on Wed Nov 8 00:15:02 2017. + OpenGL loader generated by glad 0.1.34 on Wed Sep 29 18:24:50 2021. Language/Generator: C/C++ Specification: gl @@ -14,11 +14,12 @@ Loader: False Local files: False Omit khrplatform: False + Reproducible: False Commandline: --profile="core" --api="gl=2.1" --generator="c" --spec="gl" --no-loader --extensions="GL_APPLE_vertex_array_object,GL_ARB_framebuffer_object,GL_ARB_vertex_array_object,GL_EXT_framebuffer_object" Online: - http://glad.dav1d.de/#profile=core&language=c&specification=gl&api=gl%3D2.1&extensions=GL_APPLE_vertex_array_object&extensions=GL_ARB_framebuffer_object&extensions=GL_ARB_vertex_array_object&extensions=GL_EXT_framebuffer_object + https://glad.dav1d.de/#profile=core&language=c&specification=gl&api=gl%3D2.1&extensions=GL_APPLE_vertex_array_object&extensions=GL_ARB_framebuffer_object&extensions=GL_ARB_vertex_array_object&extensions=GL_EXT_framebuffer_object */ #include @@ -26,7 +27,7 @@ #include #include -struct gladGLversionStruct GLVersion; +struct gladGLversionStruct GLVersion = { 0, 0 }; #if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0) #define _GLAD_IS_SOME_NEW_VERSION 1 @@ -37,7 +38,7 @@ static int max_loaded_minor; static const char *exts = NULL; static int num_exts_i = 0; -static const char **exts_i = NULL; +static char **exts_i = NULL; static int get_exts(void) { #ifdef _GLAD_IS_SOME_NEW_VERSION @@ -51,7 +52,7 @@ static int get_exts(void) { num_exts_i = 0; glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i); if (num_exts_i > 0) { - exts_i = (const char **)realloc((void *)exts_i, (size_t)num_exts_i * (sizeof *exts_i)); + exts_i = (char **)malloc((size_t)num_exts_i * (sizeof *exts_i)); } if (exts_i == NULL) { @@ -62,9 +63,9 @@ static int get_exts(void) { const char *gl_str_tmp = (const char*)glGetStringi(GL_EXTENSIONS, index); size_t len = strlen(gl_str_tmp); - char *local_str = (char*)malloc((len+1) * sizeof(*exts_i)); + char *local_str = (char*)malloc((len+1) * sizeof(char)); if(local_str != NULL) { - strncpy(local_str, gl_str_tmp, len+1); + memcpy(local_str, gl_str_tmp, (len+1) * sizeof(char)); } exts_i[index] = local_str; } @@ -125,264 +126,264 @@ static int has_ext(const char *ext) { return 0; } -int GLAD_GL_VERSION_1_0; -int GLAD_GL_VERSION_1_1; -int GLAD_GL_VERSION_1_2; -int GLAD_GL_VERSION_1_3; -int GLAD_GL_VERSION_1_4; -int GLAD_GL_VERSION_1_5; -int GLAD_GL_VERSION_2_0; -int GLAD_GL_VERSION_2_1; -PFNGLFLUSHPROC glad_glFlush; -PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D; -PFNGLCLEARCOLORPROC glad_glClearColor; -PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv; -PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate; -PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv; -PFNGLLINKPROGRAMPROC glad_glLinkProgram; -PFNGLBINDTEXTUREPROC glad_glBindTexture; -PFNGLGETSTRINGPROC glad_glGetString; -PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D; -PFNGLDETACHSHADERPROC glad_glDetachShader; -PFNGLGENBUFFERSPROC glad_glGenBuffers; -PFNGLENDQUERYPROC glad_glEndQuery; -PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv; -PFNGLLINEWIDTHPROC glad_glLineWidth; -PFNGLUNIFORM2FVPROC glad_glUniform2fv; -PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation; -PFNGLCOMPILESHADERPROC glad_glCompileShader; -PFNGLDELETETEXTURESPROC glad_glDeleteTextures; -PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate; -PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv; -PFNGLPOLYGONMODEPROC glad_glPolygonMode; -PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f; -PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d; -PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f; -PFNGLUNIFORM4IVPROC glad_glUniform4iv; -PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv; -PFNGLCLEARSTENCILPROC glad_glClearStencil; -PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv; -PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s; -PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage; -PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv; -PFNGLGENTEXTURESPROC glad_glGenTextures; -PFNGLDEPTHFUNCPROC glad_glDepthFunc; -PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D; -PFNGLUNIFORM1FPROC glad_glUniform1f; -PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv; -PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv; -PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv; -PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage; -PFNGLCREATESHADERPROC glad_glCreateShader; -PFNGLISBUFFERPROC glad_glIsBuffer; -PFNGLUNIFORM1IPROC glad_glUniform1i; -PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s; -PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib; -PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D; -PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv; -PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D; -PFNGLDISABLEPROC glad_glDisable; -PFNGLUNIFORM2IPROC glad_glUniform2i; -PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate; -PFNGLLOGICOPPROC glad_glLogicOp; -PFNGLGETPROGRAMIVPROC glad_glGetProgramiv; -PFNGLCOLORMASKPROC glad_glColorMask; -PFNGLHINTPROC glad_glHint; -PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s; -PFNGLBLENDEQUATIONPROC glad_glBlendEquation; -PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation; -PFNGLCULLFACEPROC glad_glCullFace; -PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv; -PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv; -PFNGLUNIFORM4FVPROC glad_glUniform4fv; -PFNGLPOINTSIZEPROC glad_glPointSize; -PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv; -PFNGLDELETEPROGRAMPROC glad_glDeleteProgram; -PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv; -PFNGLGENQUERIESPROC glad_glGenQueries; -PFNGLATTACHSHADERPROC glad_glAttachShader; -PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv; -PFNGLUNIFORM3IPROC glad_glUniform3i; -PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D; -PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D; -PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D; -PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D; -PFNGLUNIFORM3FPROC glad_glUniform3f; -PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv; -PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv; -PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv; -PFNGLDRAWELEMENTSPROC glad_glDrawElements; -PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv; -PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements; -PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv; -PFNGLBUFFERSUBDATAPROC glad_glBufferSubData; -PFNGLUNIFORM1IVPROC glad_glUniform1iv; -PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv; -PFNGLREADBUFFERPROC glad_glReadBuffer; -PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv; -PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays; -PFNGLGETSHADERIVPROC glad_glGetShaderiv; -PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv; -PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f; -PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv; -PFNGLPOINTPARAMETERIPROC glad_glPointParameteri; -PFNGLBLENDCOLORPROC glad_glBlendColor; -PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray; -PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer; -PFNGLDEPTHMASKPROC glad_glDepthMask; -PFNGLPOINTPARAMETERFPROC glad_glPointParameterf; -PFNGLGETDOUBLEVPROC glad_glGetDoublev; -PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv; -PFNGLSHADERSOURCEPROC glad_glShaderSource; -PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D; -PFNGLDRAWARRAYSPROC glad_glDrawArrays; -PFNGLISPROGRAMPROC glad_glIsProgram; -PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv; -PFNGLGETUNIFORMIVPROC glad_glGetUniformiv; -PFNGLUNIFORM4IPROC glad_glUniform4i; -PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d; -PFNGLCLEARPROC glad_glClear; -PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv; -PFNGLUNIFORM2FPROC glad_glUniform2f; -PFNGLACTIVETEXTUREPROC glad_glActiveTexture; -PFNGLBEGINQUERYPROC glad_glBeginQuery; -PFNGLUNIFORM2IVPROC glad_glUniform2iv; -PFNGLBINDBUFFERPROC glad_glBindBuffer; -PFNGLISENABLEDPROC glad_glIsEnabled; -PFNGLSTENCILOPPROC glad_glStencilOp; -PFNGLREADPIXELSPROC glad_glReadPixels; -PFNGLCLEARDEPTHPROC glad_glClearDepth; -PFNGLUNIFORM4FPROC glad_glUniform4f; -PFNGLMAPBUFFERPROC glad_glMapBuffer; -PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d; -PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub; -PFNGLUNIFORM3FVPROC glad_glUniform3fv; -PFNGLGETUNIFORMFVPROC glad_glGetUniformfv; -PFNGLBUFFERDATAPROC glad_glBufferData; -PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D; -PFNGLTEXIMAGE1DPROC glad_glTexImage1D; -PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D; -PFNGLGETERRORPROC glad_glGetError; -PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv; -PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv; -PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements; -PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv; -PFNGLGETFLOATVPROC glad_glGetFloatv; -PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D; -PFNGLUNIFORM3IVPROC glad_glUniform3iv; -PFNGLGETTEXIMAGEPROC glad_glGetTexImage; -PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv; -PFNGLUSEPROGRAMPROC glad_glUseProgram; -PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv; -PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv; -PFNGLDRAWBUFFERSPROC glad_glDrawBuffers; -PFNGLSTENCILFUNCPROC glad_glStencilFunc; -PFNGLGETINTEGERVPROC glad_glGetIntegerv; -PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders; -PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv; -PFNGLDRAWBUFFERPROC glad_glDrawBuffer; -PFNGLUNIFORM1FVPROC glad_glUniform1fv; -PFNGLISQUERYPROC glad_glIsQuery; -PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv; -PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv; -PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray; -PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv; -PFNGLGETQUERYIVPROC glad_glGetQueryiv; -PFNGLTEXIMAGE2DPROC glad_glTexImage2D; -PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog; -PFNGLSTENCILMASKPROC glad_glStencilMask; -PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv; -PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog; -PFNGLISTEXTUREPROC glad_glIsTexture; -PFNGLISSHADERPROC glad_glIsShader; -PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource; -PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv; -PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer; -PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv; -PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData; -PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv; -PFNGLENABLEPROC glad_glEnable; -PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate; -PFNGLDELETEQUERIESPROC glad_glDeleteQueries; -PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv; -PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate; -PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D; -PFNGLFINISHPROC glad_glFinish; -PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation; -PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv; -PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv; -PFNGLDELETESHADERPROC glad_glDeleteShader; -PFNGLBLENDFUNCPROC glad_glBlendFunc; -PFNGLCREATEPROGRAMPROC glad_glCreateProgram; -PFNGLTEXIMAGE3DPROC glad_glTexImage3D; -PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv; -PFNGLVIEWPORTPROC glad_glViewport; -PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d; -PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f; -PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv; -PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset; -PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s; -PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv; -PFNGLDEPTHRANGEPROC glad_glDepthRange; -PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform; -PFNGLTEXPARAMETERFPROC glad_glTexParameterf; -PFNGLTEXPARAMETERIPROC glad_glTexParameteri; -PFNGLFRONTFACEPROC glad_glFrontFace; -PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers; -PFNGLSCISSORPROC glad_glScissor; -PFNGLGETBOOLEANVPROC glad_glGetBooleanv; -PFNGLPIXELSTOREIPROC glad_glPixelStorei; -PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram; -PFNGLPIXELSTOREFPROC glad_glPixelStoref; -int GLAD_GL_ARB_framebuffer_object; -int GLAD_GL_EXT_framebuffer_object; -int GLAD_GL_ARB_vertex_array_object; -int GLAD_GL_APPLE_vertex_array_object; -PFNGLBINDVERTEXARRAYAPPLEPROC glad_glBindVertexArrayAPPLE; -PFNGLDELETEVERTEXARRAYSAPPLEPROC glad_glDeleteVertexArraysAPPLE; -PFNGLGENVERTEXARRAYSAPPLEPROC glad_glGenVertexArraysAPPLE; -PFNGLISVERTEXARRAYAPPLEPROC glad_glIsVertexArrayAPPLE; -PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer; -PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer; -PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers; -PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers; -PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage; -PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv; -PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer; -PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer; -PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers; -PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers; -PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus; -PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D; -PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D; -PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D; -PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer; -PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv; -PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap; -PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer; -PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample; -PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer; -PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray; -PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays; -PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays; -PFNGLISVERTEXARRAYPROC glad_glIsVertexArray; -PFNGLISRENDERBUFFEREXTPROC glad_glIsRenderbufferEXT; -PFNGLBINDRENDERBUFFEREXTPROC glad_glBindRenderbufferEXT; -PFNGLDELETERENDERBUFFERSEXTPROC glad_glDeleteRenderbuffersEXT; -PFNGLGENRENDERBUFFERSEXTPROC glad_glGenRenderbuffersEXT; -PFNGLRENDERBUFFERSTORAGEEXTPROC glad_glRenderbufferStorageEXT; -PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glad_glGetRenderbufferParameterivEXT; -PFNGLISFRAMEBUFFEREXTPROC glad_glIsFramebufferEXT; -PFNGLBINDFRAMEBUFFEREXTPROC glad_glBindFramebufferEXT; -PFNGLDELETEFRAMEBUFFERSEXTPROC glad_glDeleteFramebuffersEXT; -PFNGLGENFRAMEBUFFERSEXTPROC glad_glGenFramebuffersEXT; -PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glad_glCheckFramebufferStatusEXT; -PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glad_glFramebufferTexture1DEXT; -PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glad_glFramebufferTexture2DEXT; -PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glad_glFramebufferTexture3DEXT; -PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glad_glFramebufferRenderbufferEXT; -PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glad_glGetFramebufferAttachmentParameterivEXT; -PFNGLGENERATEMIPMAPEXTPROC glad_glGenerateMipmapEXT; +int GLAD_GL_VERSION_1_0 = 0; +int GLAD_GL_VERSION_1_1 = 0; +int GLAD_GL_VERSION_1_2 = 0; +int GLAD_GL_VERSION_1_3 = 0; +int GLAD_GL_VERSION_1_4 = 0; +int GLAD_GL_VERSION_1_5 = 0; +int GLAD_GL_VERSION_2_0 = 0; +int GLAD_GL_VERSION_2_1 = 0; +PFNGLACTIVETEXTUREPROC glad_glActiveTexture = NULL; +PFNGLATTACHSHADERPROC glad_glAttachShader = NULL; +PFNGLBEGINQUERYPROC glad_glBeginQuery = NULL; +PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation = NULL; +PFNGLBINDBUFFERPROC glad_glBindBuffer = NULL; +PFNGLBINDTEXTUREPROC glad_glBindTexture = NULL; +PFNGLBLENDCOLORPROC glad_glBlendColor = NULL; +PFNGLBLENDEQUATIONPROC glad_glBlendEquation = NULL; +PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate = NULL; +PFNGLBLENDFUNCPROC glad_glBlendFunc = NULL; +PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate = NULL; +PFNGLBUFFERDATAPROC glad_glBufferData = NULL; +PFNGLBUFFERSUBDATAPROC glad_glBufferSubData = NULL; +PFNGLCLEARPROC glad_glClear = NULL; +PFNGLCLEARCOLORPROC glad_glClearColor = NULL; +PFNGLCLEARDEPTHPROC glad_glClearDepth = NULL; +PFNGLCLEARSTENCILPROC glad_glClearStencil = NULL; +PFNGLCOLORMASKPROC glad_glColorMask = NULL; +PFNGLCOMPILESHADERPROC glad_glCompileShader = NULL; +PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D = NULL; +PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D = NULL; +PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D = NULL; +PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D = NULL; +PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D = NULL; +PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D = NULL; +PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D = NULL; +PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D = NULL; +PFNGLCREATEPROGRAMPROC glad_glCreateProgram = NULL; +PFNGLCREATESHADERPROC glad_glCreateShader = NULL; +PFNGLCULLFACEPROC glad_glCullFace = NULL; +PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers = NULL; +PFNGLDELETEPROGRAMPROC glad_glDeleteProgram = NULL; +PFNGLDELETEQUERIESPROC glad_glDeleteQueries = NULL; +PFNGLDELETESHADERPROC glad_glDeleteShader = NULL; +PFNGLDELETETEXTURESPROC glad_glDeleteTextures = NULL; +PFNGLDEPTHFUNCPROC glad_glDepthFunc = NULL; +PFNGLDEPTHMASKPROC glad_glDepthMask = NULL; +PFNGLDEPTHRANGEPROC glad_glDepthRange = NULL; +PFNGLDETACHSHADERPROC glad_glDetachShader = NULL; +PFNGLDISABLEPROC glad_glDisable = NULL; +PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray = NULL; +PFNGLDRAWARRAYSPROC glad_glDrawArrays = NULL; +PFNGLDRAWBUFFERPROC glad_glDrawBuffer = NULL; +PFNGLDRAWBUFFERSPROC glad_glDrawBuffers = NULL; +PFNGLDRAWELEMENTSPROC glad_glDrawElements = NULL; +PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements = NULL; +PFNGLENABLEPROC glad_glEnable = NULL; +PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray = NULL; +PFNGLENDQUERYPROC glad_glEndQuery = NULL; +PFNGLFINISHPROC glad_glFinish = NULL; +PFNGLFLUSHPROC glad_glFlush = NULL; +PFNGLFRONTFACEPROC glad_glFrontFace = NULL; +PFNGLGENBUFFERSPROC glad_glGenBuffers = NULL; +PFNGLGENQUERIESPROC glad_glGenQueries = NULL; +PFNGLGENTEXTURESPROC glad_glGenTextures = NULL; +PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib = NULL; +PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform = NULL; +PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders = NULL; +PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation = NULL; +PFNGLGETBOOLEANVPROC glad_glGetBooleanv = NULL; +PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv = NULL; +PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv = NULL; +PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData = NULL; +PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage = NULL; +PFNGLGETDOUBLEVPROC glad_glGetDoublev = NULL; +PFNGLGETERRORPROC glad_glGetError = NULL; +PFNGLGETFLOATVPROC glad_glGetFloatv = NULL; +PFNGLGETINTEGERVPROC glad_glGetIntegerv = NULL; +PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog = NULL; +PFNGLGETPROGRAMIVPROC glad_glGetProgramiv = NULL; +PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv = NULL; +PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv = NULL; +PFNGLGETQUERYIVPROC glad_glGetQueryiv = NULL; +PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog = NULL; +PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource = NULL; +PFNGLGETSHADERIVPROC glad_glGetShaderiv = NULL; +PFNGLGETSTRINGPROC glad_glGetString = NULL; +PFNGLGETTEXIMAGEPROC glad_glGetTexImage = NULL; +PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv = NULL; +PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv = NULL; +PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv = NULL; +PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv = NULL; +PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation = NULL; +PFNGLGETUNIFORMFVPROC glad_glGetUniformfv = NULL; +PFNGLGETUNIFORMIVPROC glad_glGetUniformiv = NULL; +PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv = NULL; +PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv = NULL; +PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv = NULL; +PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv = NULL; +PFNGLHINTPROC glad_glHint = NULL; +PFNGLISBUFFERPROC glad_glIsBuffer = NULL; +PFNGLISENABLEDPROC glad_glIsEnabled = NULL; +PFNGLISPROGRAMPROC glad_glIsProgram = NULL; +PFNGLISQUERYPROC glad_glIsQuery = NULL; +PFNGLISSHADERPROC glad_glIsShader = NULL; +PFNGLISTEXTUREPROC glad_glIsTexture = NULL; +PFNGLLINEWIDTHPROC glad_glLineWidth = NULL; +PFNGLLINKPROGRAMPROC glad_glLinkProgram = NULL; +PFNGLLOGICOPPROC glad_glLogicOp = NULL; +PFNGLMAPBUFFERPROC glad_glMapBuffer = NULL; +PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays = NULL; +PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements = NULL; +PFNGLPIXELSTOREFPROC glad_glPixelStoref = NULL; +PFNGLPIXELSTOREIPROC glad_glPixelStorei = NULL; +PFNGLPOINTPARAMETERFPROC glad_glPointParameterf = NULL; +PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv = NULL; +PFNGLPOINTPARAMETERIPROC glad_glPointParameteri = NULL; +PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv = NULL; +PFNGLPOINTSIZEPROC glad_glPointSize = NULL; +PFNGLPOLYGONMODEPROC glad_glPolygonMode = NULL; +PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset = NULL; +PFNGLREADBUFFERPROC glad_glReadBuffer = NULL; +PFNGLREADPIXELSPROC glad_glReadPixels = NULL; +PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage = NULL; +PFNGLSCISSORPROC glad_glScissor = NULL; +PFNGLSHADERSOURCEPROC glad_glShaderSource = NULL; +PFNGLSTENCILFUNCPROC glad_glStencilFunc = NULL; +PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate = NULL; +PFNGLSTENCILMASKPROC glad_glStencilMask = NULL; +PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate = NULL; +PFNGLSTENCILOPPROC glad_glStencilOp = NULL; +PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate = NULL; +PFNGLTEXIMAGE1DPROC glad_glTexImage1D = NULL; +PFNGLTEXIMAGE2DPROC glad_glTexImage2D = NULL; +PFNGLTEXIMAGE3DPROC glad_glTexImage3D = NULL; +PFNGLTEXPARAMETERFPROC glad_glTexParameterf = NULL; +PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv = NULL; +PFNGLTEXPARAMETERIPROC glad_glTexParameteri = NULL; +PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv = NULL; +PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D = NULL; +PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D = NULL; +PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D = NULL; +PFNGLUNIFORM1FPROC glad_glUniform1f = NULL; +PFNGLUNIFORM1FVPROC glad_glUniform1fv = NULL; +PFNGLUNIFORM1IPROC glad_glUniform1i = NULL; +PFNGLUNIFORM1IVPROC glad_glUniform1iv = NULL; +PFNGLUNIFORM2FPROC glad_glUniform2f = NULL; +PFNGLUNIFORM2FVPROC glad_glUniform2fv = NULL; +PFNGLUNIFORM2IPROC glad_glUniform2i = NULL; +PFNGLUNIFORM2IVPROC glad_glUniform2iv = NULL; +PFNGLUNIFORM3FPROC glad_glUniform3f = NULL; +PFNGLUNIFORM3FVPROC glad_glUniform3fv = NULL; +PFNGLUNIFORM3IPROC glad_glUniform3i = NULL; +PFNGLUNIFORM3IVPROC glad_glUniform3iv = NULL; +PFNGLUNIFORM4FPROC glad_glUniform4f = NULL; +PFNGLUNIFORM4FVPROC glad_glUniform4fv = NULL; +PFNGLUNIFORM4IPROC glad_glUniform4i = NULL; +PFNGLUNIFORM4IVPROC glad_glUniform4iv = NULL; +PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv = NULL; +PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv = NULL; +PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv = NULL; +PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv = NULL; +PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv = NULL; +PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv = NULL; +PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv = NULL; +PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv = NULL; +PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv = NULL; +PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer = NULL; +PFNGLUSEPROGRAMPROC glad_glUseProgram = NULL; +PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram = NULL; +PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d = NULL; +PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv = NULL; +PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f = NULL; +PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv = NULL; +PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s = NULL; +PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv = NULL; +PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d = NULL; +PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv = NULL; +PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f = NULL; +PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv = NULL; +PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s = NULL; +PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv = NULL; +PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d = NULL; +PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv = NULL; +PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f = NULL; +PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv = NULL; +PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s = NULL; +PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv = NULL; +PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv = NULL; +PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv = NULL; +PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv = NULL; +PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub = NULL; +PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv = NULL; +PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv = NULL; +PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv = NULL; +PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv = NULL; +PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d = NULL; +PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv = NULL; +PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f = NULL; +PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv = NULL; +PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv = NULL; +PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s = NULL; +PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv = NULL; +PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv = NULL; +PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv = NULL; +PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv = NULL; +PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer = NULL; +PFNGLVIEWPORTPROC glad_glViewport = NULL; +int GLAD_GL_APPLE_vertex_array_object = 0; +int GLAD_GL_ARB_framebuffer_object = 0; +int GLAD_GL_ARB_vertex_array_object = 0; +int GLAD_GL_EXT_framebuffer_object = 0; +PFNGLBINDVERTEXARRAYAPPLEPROC glad_glBindVertexArrayAPPLE = NULL; +PFNGLDELETEVERTEXARRAYSAPPLEPROC glad_glDeleteVertexArraysAPPLE = NULL; +PFNGLGENVERTEXARRAYSAPPLEPROC glad_glGenVertexArraysAPPLE = NULL; +PFNGLISVERTEXARRAYAPPLEPROC glad_glIsVertexArrayAPPLE = NULL; +PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer = NULL; +PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer = NULL; +PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers = NULL; +PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers = NULL; +PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage = NULL; +PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv = NULL; +PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer = NULL; +PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer = NULL; +PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers = NULL; +PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers = NULL; +PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus = NULL; +PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D = NULL; +PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D = NULL; +PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D = NULL; +PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer = NULL; +PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv = NULL; +PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap = NULL; +PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer = NULL; +PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample = NULL; +PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer = NULL; +PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray = NULL; +PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays = NULL; +PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays = NULL; +PFNGLISVERTEXARRAYPROC glad_glIsVertexArray = NULL; +PFNGLISRENDERBUFFEREXTPROC glad_glIsRenderbufferEXT = NULL; +PFNGLBINDRENDERBUFFEREXTPROC glad_glBindRenderbufferEXT = NULL; +PFNGLDELETERENDERBUFFERSEXTPROC glad_glDeleteRenderbuffersEXT = NULL; +PFNGLGENRENDERBUFFERSEXTPROC glad_glGenRenderbuffersEXT = NULL; +PFNGLRENDERBUFFERSTORAGEEXTPROC glad_glRenderbufferStorageEXT = NULL; +PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glad_glGetRenderbufferParameterivEXT = NULL; +PFNGLISFRAMEBUFFEREXTPROC glad_glIsFramebufferEXT = NULL; +PFNGLBINDFRAMEBUFFEREXTPROC glad_glBindFramebufferEXT = NULL; +PFNGLDELETEFRAMEBUFFERSEXTPROC glad_glDeleteFramebuffersEXT = NULL; +PFNGLGENFRAMEBUFFERSEXTPROC glad_glGenFramebuffersEXT = NULL; +PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glad_glCheckFramebufferStatusEXT = NULL; +PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glad_glFramebufferTexture1DEXT = NULL; +PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glad_glFramebufferTexture2DEXT = NULL; +PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glad_glFramebufferTexture3DEXT = NULL; +PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glad_glFramebufferRenderbufferEXT = NULL; +PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glad_glGetFramebufferAttachmentParameterivEXT = NULL; +PFNGLGENERATEMIPMAPEXTPROC glad_glGenerateMipmapEXT = NULL; static void load_GL_VERSION_1_0(GLADloadproc load) { if(!GLAD_GL_VERSION_1_0) return; glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace"); diff --git a/third_party/penumbra/vendor/glfw/.appveyor.yml b/third_party/penumbra/vendor/glfw/.appveyor.yml deleted file mode 100644 index a21829a619d..00000000000 --- a/third_party/penumbra/vendor/glfw/.appveyor.yml +++ /dev/null @@ -1,60 +0,0 @@ -image: - - Visual Studio 2015 - - Visual Studio 2019 -branches: - only: - - ci - - master - - 3.3-stable -skip_tags: true -environment: - matrix: - - GENERATOR: MinGW Makefiles - BUILD_SHARED_LIBS: ON - CFLAGS: -Werror - - GENERATOR: MinGW Makefiles - BUILD_SHARED_LIBS: OFF - CFLAGS: -Werror - - GENERATOR: Visual Studio 10 2010 - BUILD_SHARED_LIBS: ON - CFLAGS: /WX - - GENERATOR: Visual Studio 10 2010 - BUILD_SHARED_LIBS: OFF - CFLAGS: /WX - - GENERATOR: Visual Studio 16 2019 - BUILD_SHARED_LIBS: ON - CFLAGS: /WX - - GENERATOR: Visual Studio 16 2019 - BUILD_SHARED_LIBS: OFF - CFLAGS: /WX -matrix: - fast_finish: true - exclude: - - image: Visual Studio 2015 - GENERATOR: Visual Studio 16 2019 - - image: Visual Studio 2019 - GENERATOR: Visual Studio 10 2010 - - image: Visual Studio 2019 - GENERATOR: MinGW Makefiles -for: -- - matrix: - except: - - GENERATOR: Visual Studio 10 2010 - build_script: - - set PATH=%PATH:C:\Program Files\Git\usr\bin=C:\MinGW\bin% - - cmake -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% - - cmake --build build -- - matrix: - only: - - GENERATOR: Visual Studio 10 2010 - build_script: - - cmake -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% - - cmake --build build --target glfw -notifications: - - provider: Email - to: - - ci@glfw.org - on_build_failure: true - on_build_success: false diff --git a/third_party/penumbra/vendor/glfw/.travis.yml b/third_party/penumbra/vendor/glfw/.travis.yml deleted file mode 100644 index 5f3b7393605..00000000000 --- a/third_party/penumbra/vendor/glfw/.travis.yml +++ /dev/null @@ -1,106 +0,0 @@ -language: c -compiler: clang -branches: - only: - - ci - - master - - 3.3-stable -matrix: - include: - - os: linux - dist: xenial - sudo: false - name: "X11 shared library" - addons: - apt: - packages: - - libxrandr-dev - - libxinerama-dev - - libxcursor-dev - - libxi-dev - env: - - BUILD_SHARED_LIBS=ON - - CFLAGS=-Werror - - os: linux - dist: xenial - sudo: false - name: "X11 static library" - addons: - apt: - packages: - - libxrandr-dev - - libxinerama-dev - - libxcursor-dev - - libxi-dev - env: - - BUILD_SHARED_LIBS=OFF - - CFLAGS=-Werror - - os: linux - dist: xenial - sudo: required - name: "Wayland shared library" - addons: - apt: - sources: - - ppa:kubuntu-ppa/backports - packages: - - extra-cmake-modules - - libwayland-dev - - libxkbcommon-dev - - libegl1-mesa-dev - env: - - USE_WAYLAND=ON - - BUILD_SHARED_LIBS=ON - - CFLAGS=-Werror - - os: linux - dist: xenial - sudo: required - name: "Wayland static library" - addons: - apt: - sources: - - ppa:kubuntu-ppa/backports - packages: - - extra-cmake-modules - - libwayland-dev - - libxkbcommon-dev - - libegl1-mesa-dev - env: - - USE_WAYLAND=ON - - BUILD_SHARED_LIBS=OFF - - CFLAGS=-Werror - - os: osx - sudo: false - name: "Cocoa shared library" - env: - - BUILD_SHARED_LIBS=ON - - CFLAGS=-Werror - - MACOSX_DEPLOYMENT_TARGET=10.8 - - os: osx - sudo: false - name: "Cocoa static library" - env: - - BUILD_SHARED_LIBS=OFF - - CFLAGS=-Werror - - MACOSX_DEPLOYMENT_TARGET=10.8 -script: - - if grep -Inr '\s$' src include docs tests examples CMake *.md .gitattributes .gitignore; then - echo Trailing whitespace found, aborting; - exit 1; - fi - - mkdir build - - cd build - - if test -n "${USE_WAYLAND}"; then - git clone git://anongit.freedesktop.org/wayland/wayland-protocols; - pushd wayland-protocols; - git checkout 1.15 && ./autogen.sh --prefix=/usr && make && sudo make install; - popd; - fi - - cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -DGLFW_USE_WAYLAND=${USE_WAYLAND} .. - - cmake --build . -notifications: - email: - recipients: - - ci@glfw.org - on_success: never - on_failure: always diff --git a/third_party/penumbra/vendor/glfw/CMake/GenerateMappings.cmake b/third_party/penumbra/vendor/glfw/CMake/GenerateMappings.cmake index 7a88e3d4457..47e63741dce 100644 --- a/third_party/penumbra/vendor/glfw/CMake/GenerateMappings.cmake +++ b/third_party/penumbra/vendor/glfw/CMake/GenerateMappings.cmake @@ -23,8 +23,23 @@ endif() file(STRINGS "${source_path}" lines) foreach(line ${lines}) - if ("${line}" MATCHES "^[0-9a-fA-F].*$") - set(GLFW_GAMEPAD_MAPPINGS "${GLFW_GAMEPAD_MAPPINGS}\"${line}\",\n") + if (line MATCHES "^[0-9a-fA-F]") + if (line MATCHES "platform:Windows") + if (GLFW_WIN32_MAPPINGS) + set(GLFW_WIN32_MAPPINGS "${GLFW_WIN32_MAPPINGS}\n") + endif() + set(GLFW_WIN32_MAPPINGS "${GLFW_WIN32_MAPPINGS}\"${line}\",") + elseif (line MATCHES "platform:Mac OS X") + if (GLFW_COCOA_MAPPINGS) + set(GLFW_COCOA_MAPPINGS "${GLFW_COCOA_MAPPINGS}\n") + endif() + set(GLFW_COCOA_MAPPINGS "${GLFW_COCOA_MAPPINGS}\"${line}\",") + elseif (line MATCHES "platform:Linux") + if (GLFW_LINUX_MAPPINGS) + set(GLFW_LINUX_MAPPINGS "${GLFW_LINUX_MAPPINGS}\n") + endif() + set(GLFW_LINUX_MAPPINGS "${GLFW_LINUX_MAPPINGS}\"${line}\",") + endif() endif() endforeach() diff --git a/third_party/penumbra/vendor/glfw/CMake/modules/FindEpollShim.cmake b/third_party/penumbra/vendor/glfw/CMake/modules/FindEpollShim.cmake index 2facb4192cf..f34d07090ef 100644 --- a/third_party/penumbra/vendor/glfw/CMake/modules/FindEpollShim.cmake +++ b/third_party/penumbra/vendor/glfw/CMake/modules/FindEpollShim.cmake @@ -13,5 +13,5 @@ if (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES) endif (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(EPOLLSHIM DEFAULT_MSG EPOLLSHIM_LIBRARIES EPOLLSHIM_INCLUDE_DIRS) +find_package_handle_standard_args(EpollShim DEFAULT_MSG EPOLLSHIM_LIBRARIES EPOLLSHIM_INCLUDE_DIRS) mark_as_advanced(EPOLLSHIM_INCLUDE_DIRS EPOLLSHIM_LIBRARIES) diff --git a/third_party/penumbra/vendor/glfw/CMakeLists.txt b/third_party/penumbra/vendor/glfw/CMakeLists.txt index e98886249fc..75069161fc3 100644 --- a/third_party/penumbra/vendor/glfw/CMakeLists.txt +++ b/third_party/penumbra/vendor/glfw/CMakeLists.txt @@ -1,6 +1,6 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.0...3.20 FATAL_ERROR) -project(GLFW VERSION 3.3.2 LANGUAGES C) +project(GLFW VERSION 3.3.8 LANGUAGES C) set(CMAKE_LEGACY_CYGWIN_WIN32 OFF) @@ -8,6 +8,10 @@ if (POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() +if (POLICY CMP0069) + cmake_policy(SET CMP0069 NEW) +endif() + if (POLICY CMP0077) cmake_policy(SET CMP0077 NEW) endif() @@ -63,7 +67,8 @@ if (GLFW_BUILD_DOCS) endif() #-------------------------------------------------------------------- -# Set compiler specific flags +# Apply Microsoft C runtime library option +# This is here because it also applies to tests and examples #-------------------------------------------------------------------- if (MSVC) if (MSVC90) @@ -76,22 +81,26 @@ if (MSVC) # Workaround for VS 2008 not shipping with stdint.h list(APPEND glfw_INCLUDE_DIRS "${GLFW_SOURCE_DIR}/deps/vs2008") endif() +endif() - if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL) +if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL) + if (CMAKE_VERSION VERSION_LESS 3.15) foreach (flag CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) - if (${flag} MATCHES "/MD") + if (flag MATCHES "/MD") string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}") endif() - if (${flag} MATCHES "/MDd") + if (flag MATCHES "/MDd") string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}") endif() endforeach() + else() + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif() endif() @@ -128,6 +137,9 @@ if (MINGW) if (_GLFW_HAS_64ASLR) set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--high-entropy-va ${CMAKE_SHARED_LINKER_FLAGS}") endif() + + # Clear flags again to avoid breaking later tests + set(CMAKE_REQUIRED_FLAGS) endif() #-------------------------------------------------------------------- @@ -244,7 +256,7 @@ if (_GLFW_WAYLAND) find_package(WaylandScanner REQUIRED) find_package(WaylandProtocols 1.15 REQUIRED) - list(APPEND glfw_PKG_DEPS "wayland-egl") + list(APPEND glfw_PKG_DEPS "wayland-client") list(APPEND glfw_INCLUDE_DIRS "${Wayland_INCLUDE_DIRS}") list(APPEND glfw_LIBRARIES "${Wayland_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}") @@ -254,10 +266,9 @@ if (_GLFW_WAYLAND) include(CheckIncludeFiles) include(CheckFunctionExists) - check_include_files(xkbcommon/xkbcommon-compose.h HAVE_XKBCOMMON_COMPOSE_H) check_function_exists(memfd_create HAVE_MEMFD_CREATE) - if (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")) + if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") find_package(EpollShim) if (EPOLLSHIM_FOUND) list(APPEND glfw_INCLUDE_DIRS "${EPOLLSHIM_INCLUDE_DIRS}") diff --git a/third_party/penumbra/vendor/glfw/CONTRIBUTORS.md b/third_party/penumbra/vendor/glfw/CONTRIBUTORS.md new file mode 100644 index 00000000000..0c7141b82ba --- /dev/null +++ b/third_party/penumbra/vendor/glfw/CONTRIBUTORS.md @@ -0,0 +1,250 @@ +# Acknowledgements + +GLFW exists because people around the world donated their time and lent their +skills. This list only includes contributions to the main repository and +excludes other invaluable contributions like language bindings and text and +video tutorials. + + - Bobyshev Alexander + - Laurent Aphecetche + - Matt Arsenault + - ashishgamedev + - David Avedissian + - Keith Bauer + - John Bartholomew + - Coşku Baş + - Niklas Behrens + - Andrew Belt + - Nevyn Bengtsson + - Niklas Bergström + - Denis Bernard + - BiBi + - Doug Binks + - blanco + - Waris Boonyasiriwat + - Kyle Brenneman + - Rok Breulj + - TheBrokenRail + - Kai Burjack + - Martin Capitanio + - Nicolas Caramelli + - David Carlier + - Arturo Castro + - Chi-kwan Chan + - TheChocolateOre + - Joseph Chua + - Ian Clarkson + - Michał Cichoń + - Lambert Clara + - Anna Clarke + - Josh Codd + - Yaron Cohen-Tal + - Omar Cornut + - Andrew Corrigan + - Bailey Cosier + - Noel Cower + - CuriouserThing + - Jason Daly + - danhambleton + - Jarrod Davis + - Olivier Delannoy + - Paul R. Deppe + - Michael Dickens + - Роман Донченко + - Mario Dorn + - Wolfgang Draxinger + - Jonathan Dummer + - Ralph Eastwood + - Fredrik Ehnbom + - Robin Eklind + - Jan Ekström + - Siavash Eliasi + - TheExileFox + - Nikita Fediuchin + - Felipe Ferreira + - Michael Fogleman + - Jason Francis + - Gerald Franz + - Mário Freitas + - GeO4d + - Marcus Geelnard + - ghuser404 + - Charles Giessen + - Ryan C. Gordon + - Stephen Gowen + - Kovid Goyal + - Kevin Grandemange + - Eloi Marín Gratacós + - Stefan Gustavson + - Andrew Gutekanst + - Stephen Gutekanst + - Jonathan Hale + - hdf89shfdfs + - Sylvain Hellegouarch + - Matthew Henry + - heromyth + - Lucas Hinderberger + - Paul Holden + - Hajime Hoshi + - Warren Hu + - Charles Huber + - Brent Huisman + - illustris + - InKryption + - IntellectualKitty + - Aaron Jacobs + - JannikGM + - Erik S. V. Jansson + - jjYBdx4IL + - Toni Jovanoski + - Arseny Kapoulkine + - Cem Karan + - Osman Keskin + - Koray Kilinc + - Josh Kilmer + - Byunghoon Kim + - Cameron King + - Peter Knut + - Christoph Kubisch + - Yuri Kunde Schlesner + - Rokas Kupstys + - Konstantin Käfer + - Eric Larson + - Francis Lecavalier + - Jong Won Lee + - Robin Leffmann + - Glenn Lewis + - Shane Liesegang + - Anders Lindqvist + - Leon Linhart + - Marco Lizza + - Eyal Lotem + - Aaron Loucks + - Luflosi + - lukect + - Tristam MacDonald + - Hans Mackowiak + - Дмитри Малышев + - Zbigniew Mandziejewicz + - Adam Marcus + - Célestin Marot + - Kyle McDonald + - David V. McKay + - David Medlock + - Bryce Mehring + - Jonathan Mercier + - Marcel Metz + - Liam Middlebrook + - Ave Milia + - Jonathan Miller + - Kenneth Miller + - Bruce Mitchener + - Jack Moffitt + - Ravi Mohan + - Jeff Molofee + - Alexander Monakov + - Pierre Morel + - Jon Morton + - Pierre Moulon + - Martins Mozeiko + - James Murphy + - Julian Møller + - ndogxj + - F. Nedelec + - Kristian Nielsen + - Joel Niemelä + - Kamil Nowakowski + - onox + - Denis Ovod + - Ozzy + - Andri Pálsson + - Peoro + - Braden Pellett + - Christopher Pelloux + - Arturo J. Pérez + - Vladimir Perminov + - Olivier Perret + - Anthony Pesch + - Orson Peters + - Emmanuel Gil Peyrot + - Cyril Pichard + - Pilzschaf + - Keith Pitt + - Stanislav Podgorskiy + - Konstantin Podsvirov + - Nathan Poirier + - Alexandre Pretyman + - Pablo Prietz + - przemekmirek + - pthom + - Martin Pulec + - Guillaume Racicot + - Philip Rideout + - Eddie Ringle + - Max Risuhin + - Jorge Rodriguez + - Luca Rood + - Ed Ropple + - Aleksey Rybalkin + - Mikko Rytkönen + - Riku Salminen + - Brandon Schaefer + - Sebastian Schuberth + - Christian Sdunek + - Matt Sealey + - Steve Sexton + - Arkady Shapkin + - Ali Sherief + - Yoshiki Shibukawa + - Dmitri Shuralyov + - Joao da Silva + - Daniel Sieger + - Daniel Skorupski + - Slemmie + - Bradley Smith + - Cliff Smolinsky + - Patrick Snape + - Erlend Sogge Heggen + - Olivier Sohn + - Julian Squires + - Johannes Stein + - Pontus Stenetorp + - Michael Stocker + - Justin Stoecker + - Elviss Strazdins + - Paul Sultana + - Nathan Sweet + - TTK-Bandit + - Sergey Tikhomirov + - Arthur Tombs + - TronicLabs + - Ioannis Tsakpinis + - Samuli Tuomola + - Matthew Turner + - urraka + - Elias Vanderstuyft + - Stef Velzel + - Jari Vetoniemi + - Ricardo Vieira + - Nicholas Vitovitch + - Simon Voordouw + - Corentin Wallez + - Torsten Walluhn + - Patrick Walton + - Xo Wang + - Jay Weisskopf + - Frank Wille + - Richard A. Wilkes + - Tatsuya Yatagawa + - Ryogo Yoshimura + - Rácz Zalán + - Lukas Zanner + - Andrey Zholos + - Aihui Zhu + - Santi Zupancic + - Jonas Ådahl + - Lasse Öörni + - Leonard König + - All the unmentioned and anonymous contributors in the GLFW community, for bug + reports, patches, feedback, testing and encouragement + diff --git a/third_party/penumbra/vendor/glfw/README.md b/third_party/penumbra/vendor/glfw/README.md index 76c7a96b594..4abb16c709a 100644 --- a/third_party/penumbra/vendor/glfw/README.md +++ b/third_party/penumbra/vendor/glfw/README.md @@ -1,6 +1,6 @@ # GLFW -[![Build status](https://travis-ci.org/glfw/glfw.svg?branch=master)](https://travis-ci.org/glfw/glfw) +[![Build status](https://github.com/glfw/glfw/actions/workflows/build.yml/badge.svg)](https://github.com/glfw/glfw/actions) [![Build status](https://ci.appveyor.com/api/projects/status/0kf0ct9831i5l6sp/branch/master?svg=true)](https://ci.appveyor.com/project/elmindreda/glfw) [![Coverity Scan](https://scan.coverity.com/projects/4884/badge.svg)](https://scan.coverity.com/projects/glfw-glfw) @@ -14,18 +14,18 @@ GLFW natively supports Windows, macOS and Linux and other Unix-like systems. On Linux both X11 and Wayland are supported. GLFW is licensed under the [zlib/libpng -license](http://www.glfw.org/license.html). +license](https://www.glfw.org/license.html). -You can [download](http://www.glfw.org/download.html) the latest stable release +You can [download](https://www.glfw.org/download.html) the latest stable release as source or Windows binaries, or fetch the `latest` branch from GitHub. Each release starting with 3.0 also has a corresponding [annotated tag](https://github.com/glfw/glfw/releases) with source and binary archives. -The [documentation](http://www.glfw.org/docs/latest/) is available online and is +The [documentation](https://www.glfw.org/docs/latest/) is available online and is included in all source and binary archives. See the [release notes](https://www.glfw.org/docs/latest/news.html) for new features, caveats and deprecations in the latest release. For more details see the [version -history](http://www.glfw.org/changelog.html). +history](https://www.glfw.org/changelog.html). The `master` branch is the stable integration branch and _should_ always compile and run on all supported platforms, although details of newly added features may @@ -34,11 +34,16 @@ fixes live in [other branches](https://github.com/glfw/glfw/branches/all) until they are stable enough to merge. If you are new to GLFW, you may find the -[tutorial](http://www.glfw.org/docs/latest/quick.html) for GLFW 3 useful. If +[tutorial](https://www.glfw.org/docs/latest/quick.html) for GLFW 3 useful. If you have used GLFW 2 in the past, there is a [transition -guide](http://www.glfw.org/docs/latest/moving.html) for moving to the GLFW +guide](https://www.glfw.org/docs/latest/moving.html) for moving to the GLFW 3 API. +GLFW exists because of the contributions of [many people](CONTRIBUTORS.md) +around the world, whether by reporting bugs, providing community support, adding +features, reviewing or testing code, debugging, proofreading docs, suggesting +features or fixing bugs. + ## Compiling GLFW @@ -52,16 +57,16 @@ MinGW-w64, on macOS with Clang and on Linux and other Unix-like systems with GCC and Clang. It will likely compile in other environments as well, but this is not regularly tested. -There are [pre-compiled Windows binaries](http://www.glfw.org/download.html) +There are [pre-compiled Windows binaries](https://www.glfw.org/download.html) available for all supported compilers. -See the [compilation guide](http://www.glfw.org/docs/latest/compile.html) for +See the [compilation guide](https://www.glfw.org/docs/latest/compile.html) for more information about how to compile GLFW yourself. ## Using GLFW -See the [documentation](http://www.glfw.org/docs/latest/) for tutorials, guides +See the [documentation](https://www.glfw.org/docs/latest/) for tutorials, guides and the API reference. @@ -79,7 +84,7 @@ Unix-like systems running the X Window System are supported even without a desktop environment or modern extensions, although some features require a running window or clipboard manager. The OSMesa backend requires Mesa 6.3. -See the [compatibility guide](http://www.glfw.org/docs/latest/compat.html) +See the [compatibility guide](https://www.glfw.org/docs/latest/compat.html) in the documentation for more information. @@ -101,10 +106,10 @@ located in the `deps/` directory. functions - [linmath.h](https://github.com/datenwolf/linmath.h) for linear algebra in examples - - [Nuklear](https://github.com/vurtun/nuklear) for test and example UI + - [Nuklear](https://github.com/Immediate-Mode-UI/Nuklear) for test and example UI - [stb\_image\_write](https://github.com/nothings/stb) for writing images to disk -The documentation is generated with [Doxygen](http://doxygen.org/) if CMake can +The documentation is generated with [Doxygen](https://doxygen.org/) if CMake can find that tool. @@ -118,26 +123,84 @@ information on what to include when reporting a bug. ## Changelog - - [Win32] Bugfix: Super key was not released after Win+V hotkey (#1622) - - [Win32] Bugfix: `glfwGetKeyName` could access out of bounds and return an - invalid pointer - - [Win32] Bugfix: Some synthetic key events were reported as `GLFW_KEY_UNKNOWN` - (#1623) - - [Cocoa] Added support for `VK_EXT_metal_surface` (#1619) - - [Cocoa] Added locating the Vulkan loader at runtime in an application bundle - - [X11] Bugfix: `glfwFocusWindow` could terminate on older WMs or without a WM - - [X11] Bugfix: Creating an undecorated window could fail with BadMatch (#1620) - - [X11] Bugfix: Querying a disconnected monitor could segfault (#1602) + - Added `GLFW_NATIVE_INCLUDE_NONE` for disabling inclusion of native headers (#1348) + - Bugfix: `glfwMakeContextCurrent` would access TLS slot before initialization + - Bugfix: `glfwSetGammaRamp` could emit `GLFW_INVALID_VALUE` before initialization + - Bugfix: `glfwGetJoystickUserPointer` returned `NULL` during disconnection (#2092) + - [Win32] Bugfix: `Alt+PrtSc` would emit `GLFW_KEY_UNKNOWN` and a different + scancode than `PrtSc` (#1993) + - [Win32] Bugfix: `GLFW_KEY_PAUSE` scancode from `glfwGetKeyScancode` did not + match event scancode (#1993) + - [Win32] Bugfix: Instance-local operations used executable instance (#469,#1296,#1395) + - [Win32] Bugfix: The OSMesa library was not unloaded on termination + - [Win32] Bugfix: Right shift emitted `GLFW_KEY_UNKNOWN` when using a CJK IME (#2050) + - [Cocoa] Disabled macOS fullscreen when `GLFW_RESIZABLE` is false + - [Cocoa] Bugfix: A connected Apple AirPlay would emit a useless error (#1791) + - [Cocoa] Bugfix: The EGL and OSMesa libraries were not unloaded on termination + - [Cocoa] Bugfix: `GLFW_MAXIMIZED` was always true when `GLFW_RESIZABLE` was false + - [Cocoa] Bugfix: Changing `GLFW_DECORATED` in macOS fullscreen would abort + application (#1886) + - [Cocoa] Bugfix: Setting a monitor from macOS fullscreen would abort + application (#2110) + - [Cocoa] Bugfix: The Vulkan loader was not loaded from the `Frameworks` bundle + subdirectory (#2113,#2120) + - [X11] Bugfix: The OSMesa libray was not unloaded on termination + - [X11] Bugfix: A malformed response during selection transfer could cause a segfault + - [X11] Bugfix: Some calls would reset Xlib to the default error handler (#2108) + - [Wayland] Added support for file path drop events (#2040) + - [Wayland] Added support for more human-readable monitor names where available + - [Wayland] Removed support for the deprecated wl\_shell protocol + - [Wayland] Bugfix: `glfwSetClipboardString` would fail if set to result of + `glfwGetClipboardString` + - [Wayland] Bugfix: Data source creation error would cause double free at termination + - [Wayland] Bugfix: Partial writes of clipboard string would cause beginning to repeat + - [Wayland] Bugfix: Some errors would cause clipboard string transfer to hang + - [Wayland] Bugfix: Drag and drop data was misinterpreted as clipboard string + - [Wayland] Bugfix: MIME type matching was not performed for clipboard string + - [Wayland] Bugfix: The OSMesa library was not unloaded on termination + - [Wayland] Bugfix: `glfwCreateWindow` could emit `GLFW_PLATFORM_ERROR` + - [Wayland] Bugfix: Lock key modifier bits were only set when lock keys were pressed + - [Wayland] Bugfix: A window leaving full screen mode would be iconified (#1995) + - [Wayland] Bugfix: A window leaving full screen mode ignored its desired size + - [Wayland] Bugfix: `glfwSetWindowMonitor` did not update windowed mode size + - [Wayland] Bugfix: `glfwRestoreWindow` would make a full screen window windowed + - [Wayland] Bugfix: A window maximized or restored by the user would enter an + inconsistent state + - [Wayland] Bugfix: Window maximization events were not emitted + - [Wayland] Bugfix: `glfwRestoreWindow` assumed it was always in windowed mode + - [Wayland] Bugfix: `glfwSetWindowSize` would resize a full screen window + - [Wayland] Bugfix: A window content scale event would be emitted every time + the window resized + - [Wayland] Bugfix: If `glfwInit` failed it would close stdin + - [Wayland] Bugfix: Manual resizing with fallback decorations behaved erratically + (#1991,#2115,#2127) + - [Wayland] Bugfix: Size limits included frame size for fallback decorations + - [Wayland] Bugfix: Updating `GLFW_DECORATED` had no effect on server-side + decorations + - [Wayland] Bugfix: A monitor would be reported as connected again if its scale + changed + - [Wayland] Bugfix: `glfwTerminate` would segfault if any monitor had changed + scale + - [Wayland] Bugfix: Window content scale events were not emitted when monitor + scale changed + - [Wayland] Bugfix: `glfwSetWindowAspectRatio` reported an error instead of + applying the specified ratio + - [Wayland] Bugfix: `GLFW_MAXIMIZED` window hint had no effect + - [Wayland] Bugfix: `glfwRestoreWindow` had no effect before first show + - [Wayland] Bugfix: Hiding and then showing a window caused program abort on + wlroots compositors (#1268) + - [Wayland] Bugfix: `GLFW_DECORATED` was ignored when showing a window with XDG + decorations ## Contact -On [glfw.org](http://www.glfw.org/) you can find the latest version of GLFW, as +On [glfw.org](https://www.glfw.org/) you can find the latest version of GLFW, as well as news, documentation and other information about the project. If you have questions related to the use of GLFW, we have a [forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on -[Freenode](http://freenode.net/). +[Libera.Chat](https://libera.chat/). If you have a bug to report, a patch to submit or a feature you'd like to request, please file it in the @@ -146,199 +209,3 @@ request, please file it in the Finally, if you're interested in helping out with the development of GLFW or porting it to your favorite platform, join us on the forum, GitHub or IRC. - -## Acknowledgements - -GLFW exists because people around the world donated their time and lent their -skills. - - - Bobyshev Alexander - - Matt Arsenault - - David Avedissian - - Keith Bauer - - John Bartholomew - - Coşku Baş - - Niklas Behrens - - Andrew Belt - - Niklas Bergström - - Denis Bernard - - Doug Binks - - blanco - - Kyle Brenneman - - Rok Breulj - - Kai Burjack - - Martin Capitanio - - David Carlier - - Arturo Castro - - Chi-kwan Chan - - Ian Clarkson - - Michał Cichoń - - Lambert Clara - - Anna Clarke - - Yaron Cohen-Tal - - Omar Cornut - - Andrew Corrigan - - Bailey Cosier - - Noel Cower - - Jason Daly - - Jarrod Davis - - Olivier Delannoy - - Paul R. Deppe - - Michael Dickens - - Роман Донченко - - Mario Dorn - - Wolfgang Draxinger - - Jonathan Dummer - - Ralph Eastwood - - Fredrik Ehnbom - - Robin Eklind - - Siavash Eliasi - - Felipe Ferreira - - Michael Fogleman - - Gerald Franz - - Mário Freitas - - GeO4d - - Marcus Geelnard - - Charles Giessen - - Ryan C. Gordon - - Stephen Gowen - - Kovid Goyal - - Eloi Marín Gratacós - - Stefan Gustavson - - Jonathan Hale - - Sylvain Hellegouarch - - Matthew Henry - - heromyth - - Lucas Hinderberger - - Paul Holden - - Warren Hu - - Charles Huber - - IntellectualKitty - - Aaron Jacobs - - Erik S. V. Jansson - - Toni Jovanoski - - Arseny Kapoulkine - - Cem Karan - - Osman Keskin - - Josh Kilmer - - Byunghoon Kim - - Cameron King - - Peter Knut - - Christoph Kubisch - - Yuri Kunde Schlesner - - Rokas Kupstys - - Konstantin Käfer - - Eric Larson - - Francis Lecavalier - - Robin Leffmann - - Glenn Lewis - - Shane Liesegang - - Anders Lindqvist - - Leon Linhart - - Eyal Lotem - - Aaron Loucks - - Luflosi - - lukect - - Tristam MacDonald - - Hans Mackowiak - - Дмитри Малышев - - Zbigniew Mandziejewicz - - Adam Marcus - - Célestin Marot - - Kyle McDonald - - David Medlock - - Bryce Mehring - - Jonathan Mercier - - Marcel Metz - - Liam Middlebrook - - Ave Milia - - Jonathan Miller - - Kenneth Miller - - Bruce Mitchener - - Jack Moffitt - - Jeff Molofee - - Alexander Monakov - - Pierre Morel - - Jon Morton - - Pierre Moulon - - Martins Mozeiko - - Julian Møller - - ndogxj - - Kristian Nielsen - - Kamil Nowakowski - - Denis Ovod - - Ozzy - - Andri Pálsson - - Peoro - - Braden Pellett - - Christopher Pelloux - - Arturo J. Pérez - - Anthony Pesch - - Orson Peters - - Emmanuel Gil Peyrot - - Cyril Pichard - - Keith Pitt - - Stanislav Podgorskiy - - Konstantin Podsvirov - - Nathan Poirier - - Alexandre Pretyman - - Pablo Prietz - - przemekmirek - - pthom - - Guillaume Racicot - - Philip Rideout - - Eddie Ringle - - Max Risuhin - - Jorge Rodriguez - - Ed Ropple - - Aleksey Rybalkin - - Riku Salminen - - Brandon Schaefer - - Sebastian Schuberth - - Christian Sdunek - - Matt Sealey - - Steve Sexton - - Arkady Shapkin - - Yoshiki Shibukawa - - Dmitri Shuralyov - - Daniel Skorupski - - Bradley Smith - - Cliff Smolinsky - - Patrick Snape - - Erlend Sogge Heggen - - Julian Squires - - Johannes Stein - - Pontus Stenetorp - - Michael Stocker - - Justin Stoecker - - Elviss Strazdins - - Paul Sultana - - Nathan Sweet - - TTK-Bandit - - Sergey Tikhomirov - - Arthur Tombs - - Ioannis Tsakpinis - - Samuli Tuomola - - Matthew Turner - - urraka - - Elias Vanderstuyft - - Stef Velzel - - Jari Vetoniemi - - Ricardo Vieira - - Nicholas Vitovitch - - Simon Voordouw - - Corentin Wallez - - Torsten Walluhn - - Patrick Walton - - Xo Wang - - Jay Weisskopf - - Frank Wille - - Ryogo Yoshimura - - Lukas Zanner - - Andrey Zholos - - Santi Zupancic - - Jonas Ådahl - - Lasse Öörni - - All the unmentioned and anonymous contributors in the GLFW community, for bug - reports, patches, feedback, testing and encouragement - diff --git a/third_party/penumbra/vendor/glfw/deps/glad/vk_platform.h b/third_party/penumbra/vendor/glfw/deps/glad/vk_platform.h index d7d22e1e77b..277e96a06ea 100644 --- a/third_party/penumbra/vendor/glfw/deps/glad/vk_platform.h +++ b/third_party/penumbra/vendor/glfw/deps/glad/vk_platform.h @@ -2,19 +2,9 @@ /* File: vk_platform.h */ /* */ /* -** Copyright (c) 2014-2017 The Khronos Group Inc. +** Copyright 2014-2022 The Khronos Group Inc. ** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. +** SPDX-License-Identifier: Apache-2.0 */ @@ -52,7 +42,7 @@ extern "C" #define VKAPI_CALL __stdcall #define VKAPI_PTR VKAPI_CALL #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 - #error "Vulkan isn't supported for the 'armeabi' NDK ABI" + #error "Vulkan is not supported for the 'armeabi' NDK ABI" #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) /* On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" */ /* calling convention, i.e. float parameters are passed in registers. This */ @@ -68,7 +58,9 @@ extern "C" #define VKAPI_PTR #endif -#include +#if !defined(VK_NO_STDDEF_H) + #include +#endif /* !defined(VK_NO_STDDEF_H) */ #if !defined(VK_NO_STDINT_H) #if defined(_MSC_VER) && (_MSC_VER < 1600) diff --git a/third_party/penumbra/vendor/glfw/deps/glad/vulkan.h b/third_party/penumbra/vendor/glfw/deps/glad/vulkan.h index 6bace71d86d..39288ee0418 100644 --- a/third_party/penumbra/vendor/glfw/deps/glad/vulkan.h +++ b/third_party/penumbra/vendor/glfw/deps/glad/vulkan.h @@ -1,26 +1,27 @@ /** - * Loader generated by glad 2.0.0-beta on Sun Apr 14 17:03:38 2019 + * Loader generated by glad 2.0.0-beta on Wed Jul 13 21:24:58 2022 * * Generator: C/C++ * Specification: vk - * Extensions: 3 + * Extensions: 4 * * APIs: - * - vulkan=1.1 + * - vulkan=1.3 * * Options: - * - MX_GLOBAL = False - * - LOADER = False * - ALIAS = False - * - HEADER_ONLY = False * - DEBUG = False + * - HEADER_ONLY = False + * - LOADER = False * - MX = False + * - MX_GLOBAL = False + * - ON_DEMAND = False * * Commandline: - * --api='vulkan=1.1' --extensions='VK_EXT_debug_report,VK_KHR_surface,VK_KHR_swapchain' c + * --api='vulkan=1.3' --extensions='VK_EXT_debug_report,VK_KHR_portability_enumeration,VK_KHR_surface,VK_KHR_swapchain' c * * Online: - * http://glad.sh/#api=vulkan%3D1.1&extensions=VK_EXT_debug_report%2CVK_KHR_surface%2CVK_KHR_swapchain&generator=c&options= + * http://glad.sh/#api=vulkan%3D1.3&extensions=VK_EXT_debug_report%2CVK_KHR_portability_enumeration%2CVK_KHR_surface%2CVK_KHR_swapchain&generator=c&options= * */ @@ -28,12 +29,12 @@ #define GLAD_VULKAN_H_ #ifdef VULKAN_H_ - #error header already included (API: vulkan), remove previous include! + #error header already included (API: vulkan), remove previous include! #endif #define VULKAN_H_ 1 #ifdef VULKAN_CORE_H_ - #error header already included (API: vulkan), remove previous include! + #error header already included (API: vulkan), remove previous include! #endif #define VULKAN_CORE_H_ 1 @@ -142,15 +143,16 @@ extern "C" { #define GLAPIENTRY GLAD_API_PTR #endif - #define GLAD_MAKE_VERSION(major, minor) (major * 10000 + minor) #define GLAD_VERSION_MAJOR(version) (version / 10000) #define GLAD_VERSION_MINOR(version) (version % 10000) +#define GLAD_GENERATOR_VERSION "2.0.0-beta" + typedef void (*GLADapiproc)(void); typedef GLADapiproc (*GLADloadfunc)(const char *name); -typedef GLADapiproc (*GLADuserptrloadfunc)(const char *name, void *userptr); +typedef GLADapiproc (*GLADuserptrloadfunc)(void *userptr, const char *name); typedef void (*GLADprecallback)(const char *name, GLADapiproc apiproc, int len_args, ...); typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apiproc, int len_args, ...); @@ -159,21 +161,25 @@ typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apipro #define VK_ATTACHMENT_UNUSED (~0U) #define VK_EXT_DEBUG_REPORT_EXTENSION_NAME "VK_EXT_debug_report" -#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 9 +#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 10 #define VK_FALSE 0 +#define VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME "VK_KHR_portability_enumeration" +#define VK_KHR_PORTABILITY_ENUMERATION_SPEC_VERSION 1 #define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface" #define VK_KHR_SURFACE_SPEC_VERSION 25 #define VK_KHR_SWAPCHAIN_EXTENSION_NAME "VK_KHR_swapchain" #define VK_KHR_SWAPCHAIN_SPEC_VERSION 70 -#define VK_LOD_CLAMP_NONE 1000.0f +#define VK_LOD_CLAMP_NONE 1000.0F #define VK_LUID_SIZE 8 #define VK_MAX_DESCRIPTION_SIZE 256 #define VK_MAX_DEVICE_GROUP_SIZE 32 +#define VK_MAX_DRIVER_INFO_SIZE 256 +#define VK_MAX_DRIVER_NAME_SIZE 256 #define VK_MAX_EXTENSION_NAME_SIZE 256 #define VK_MAX_MEMORY_HEAPS 16 #define VK_MAX_MEMORY_TYPES 32 #define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256 -#define VK_QUEUE_FAMILY_EXTERNAL (~0U-1) +#define VK_QUEUE_FAMILY_EXTERNAL (~1U) #define VK_QUEUE_FAMILY_IGNORED (~0U) #define VK_REMAINING_ARRAY_LAYERS (~0U) #define VK_REMAINING_MIP_LEVELS (~0U) @@ -183,29 +189,65 @@ typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apipro #define VK_WHOLE_SIZE (~0ULL) -#include +#include "vk_platform.h" +/* DEPRECATED: This define is deprecated. VK_MAKE_API_VERSION should be used instead. */ #define VK_MAKE_VERSION(major, minor, patch) \ - (((major) << 22) | ((minor) << 12) | (patch)) + ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) +/* DEPRECATED: This define is deprecated. VK_API_VERSION_MAJOR should be used instead. */ #define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22) -#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff) -#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff) +/* DEPRECATED: This define is deprecated. VK_API_VERSION_MINOR should be used instead. */ +#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3FFU) +/* DEPRECATED: This define is deprecated. VK_API_VERSION_PATCH should be used instead. */ +#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xFFFU) +#define VK_MAKE_API_VERSION(variant, major, minor, patch) \ + ((((uint32_t)(variant)) << 29) | (((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) +#define VK_API_VERSION_VARIANT(version) ((uint32_t)(version) >> 29) +#define VK_API_VERSION_MAJOR(version) (((uint32_t)(version) >> 22) & 0x7FU) +#define VK_API_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3FFU) +#define VK_API_VERSION_PATCH(version) ((uint32_t)(version) & 0xFFFU) /* DEPRECATED: This define has been removed. Specific version defines (e.g. VK_API_VERSION_1_0), or the VK_MAKE_VERSION macro, should be used instead. */ /*#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 0) // Patch version should always be set to 0 */ /* Vulkan 1.0 version number */ -#define VK_API_VERSION_1_0 VK_MAKE_VERSION(1, 0, 0)/* Patch version should always be set to 0 */ +#define VK_API_VERSION_1_0 VK_MAKE_API_VERSION(0, 1, 0, 0)/* Patch version should always be set to 0 */ /* Vulkan 1.1 version number */ -#define VK_API_VERSION_1_1 VK_MAKE_VERSION(1, 1, 0)/* Patch version should always be set to 0 */ +#define VK_API_VERSION_1_1 VK_MAKE_API_VERSION(0, 1, 1, 0)/* Patch version should always be set to 0 */ +/* Vulkan 1.2 version number */ +#define VK_API_VERSION_1_2 VK_MAKE_API_VERSION(0, 1, 2, 0)/* Patch version should always be set to 0 */ +/* Vulkan 1.3 version number */ +#define VK_API_VERSION_1_3 VK_MAKE_API_VERSION(0, 1, 3, 0)/* Patch version should always be set to 0 */ /* Version of this file */ -#define VK_HEADER_VERSION 106 +#define VK_HEADER_VERSION 220 +/* Complete version of this file */ +#define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, 1, 3, VK_HEADER_VERSION) #define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; -#if !defined(VK_DEFINE_NON_DISPATCHABLE_HANDLE) -#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) +#ifndef VK_USE_64_BIT_PTR_DEFINES + #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) + #define VK_USE_64_BIT_PTR_DEFINES 1 + #else + #define VK_USE_64_BIT_PTR_DEFINES 0 + #endif +#endif +#ifndef VK_DEFINE_NON_DISPATCHABLE_HANDLE + #if (VK_USE_64_BIT_PTR_DEFINES==1) + #if (defined(__cplusplus) && (__cplusplus >= 201103L)) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201103L)) + #define VK_NULL_HANDLE nullptr + #else + #define VK_NULL_HANDLE ((void*)0) + #endif + #else + #define VK_NULL_HANDLE 0ULL + #endif +#endif +#ifndef VK_NULL_HANDLE + #define VK_NULL_HANDLE 0 +#endif +#ifndef VK_DEFINE_NON_DISPATCHABLE_HANDLE + #if (VK_USE_64_BIT_PTR_DEFINES==1) #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object; -#else + #else #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object; + #endif #endif -#endif -#define VK_NULL_HANDLE 0 @@ -241,17 +283,21 @@ VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkRenderPass) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineCache) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorUpdateTemplate) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSamplerYcbcrConversion) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPrivateDataSlot) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSwapchainKHR) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT) typedef enum VkAttachmentLoadOp { VK_ATTACHMENT_LOAD_OP_LOAD = 0, VK_ATTACHMENT_LOAD_OP_CLEAR = 1, - VK_ATTACHMENT_LOAD_OP_DONT_CARE = 2 + VK_ATTACHMENT_LOAD_OP_DONT_CARE = 2, + VK_ATTACHMENT_LOAD_OP_MAX_ENUM = 0x7FFFFFFF } VkAttachmentLoadOp; typedef enum VkAttachmentStoreOp { VK_ATTACHMENT_STORE_OP_STORE = 0, - VK_ATTACHMENT_STORE_OP_DONT_CARE = 1 + VK_ATTACHMENT_STORE_OP_DONT_CARE = 1, + VK_ATTACHMENT_STORE_OP_NONE = 1000301000, + VK_ATTACHMENT_STORE_OP_MAX_ENUM = 0x7FFFFFFF } VkAttachmentStoreOp; typedef enum VkBlendFactor { VK_BLEND_FACTOR_ZERO = 0, @@ -272,14 +318,16 @@ typedef enum VkBlendFactor { VK_BLEND_FACTOR_SRC1_COLOR = 15, VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = 16, VK_BLEND_FACTOR_SRC1_ALPHA = 17, - VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 18 + VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 18, + VK_BLEND_FACTOR_MAX_ENUM = 0x7FFFFFFF } VkBlendFactor; typedef enum VkBlendOp { VK_BLEND_OP_ADD = 0, VK_BLEND_OP_SUBTRACT = 1, VK_BLEND_OP_REVERSE_SUBTRACT = 2, VK_BLEND_OP_MIN = 3, - VK_BLEND_OP_MAX = 4 + VK_BLEND_OP_MAX = 4, + VK_BLEND_OP_MAX_ENUM = 0x7FFFFFFF } VkBlendOp; typedef enum VkBorderColor { VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0, @@ -287,21 +335,45 @@ typedef enum VkBorderColor { VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 2, VK_BORDER_COLOR_INT_OPAQUE_BLACK = 3, VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 4, - VK_BORDER_COLOR_INT_OPAQUE_WHITE = 5 + VK_BORDER_COLOR_INT_OPAQUE_WHITE = 5, + VK_BORDER_COLOR_MAX_ENUM = 0x7FFFFFFF } VkBorderColor; - +typedef enum VkFramebufferCreateFlagBits { + VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT = 1, + VK_FRAMEBUFFER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkFramebufferCreateFlagBits; typedef enum VkPipelineCacheHeaderVersion { - VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1 + VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1, + VK_PIPELINE_CACHE_HEADER_VERSION_MAX_ENUM = 0x7FFFFFFF } VkPipelineCacheHeaderVersion; - +typedef enum VkPipelineCacheCreateFlagBits { + VK_PIPELINE_CACHE_CREATE_EXTERNALLY_SYNCHRONIZED_BIT = 1, + VK_PIPELINE_CACHE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkPipelineCacheCreateFlagBits; +typedef enum VkPipelineShaderStageCreateFlagBits { + VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT = 1, + VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT = 2, + VK_PIPELINE_SHADER_STAGE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkPipelineShaderStageCreateFlagBits; +typedef enum VkDescriptorSetLayoutCreateFlagBits { + VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT = 2, + VK_DESCRIPTOR_SET_LAYOUT_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkDescriptorSetLayoutCreateFlagBits; +typedef enum VkInstanceCreateFlagBits { + VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR = 1, + VK_INSTANCE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkInstanceCreateFlagBits; typedef enum VkDeviceQueueCreateFlagBits { - VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT = 1 + VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT = 1, + VK_DEVICE_QUEUE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkDeviceQueueCreateFlagBits; typedef enum VkBufferCreateFlagBits { VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 1, VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 2, VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 4, - VK_BUFFER_CREATE_PROTECTED_BIT = 8 + VK_BUFFER_CREATE_PROTECTED_BIT = 8, + VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT = 16, + VK_BUFFER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkBufferCreateFlagBits; typedef enum VkBufferUsageFlagBits { VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 1, @@ -312,13 +384,16 @@ typedef enum VkBufferUsageFlagBits { VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 32, VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 64, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 128, - VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 256 + VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 256, + VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT = 131072, + VK_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkBufferUsageFlagBits; typedef enum VkColorComponentFlagBits { VK_COLOR_COMPONENT_R_BIT = 1, VK_COLOR_COMPONENT_G_BIT = 2, VK_COLOR_COMPONENT_B_BIT = 4, - VK_COLOR_COMPONENT_A_BIT = 8 + VK_COLOR_COMPONENT_A_BIT = 8, + VK_COLOR_COMPONENT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkColorComponentFlagBits; typedef enum VkComponentSwizzle { VK_COMPONENT_SWIZZLE_IDENTITY = 0, @@ -327,27 +402,33 @@ typedef enum VkComponentSwizzle { VK_COMPONENT_SWIZZLE_R = 3, VK_COMPONENT_SWIZZLE_G = 4, VK_COMPONENT_SWIZZLE_B = 5, - VK_COMPONENT_SWIZZLE_A = 6 + VK_COMPONENT_SWIZZLE_A = 6, + VK_COMPONENT_SWIZZLE_MAX_ENUM = 0x7FFFFFFF } VkComponentSwizzle; typedef enum VkCommandPoolCreateFlagBits { VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 1, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 2, - VK_COMMAND_POOL_CREATE_PROTECTED_BIT = 4 + VK_COMMAND_POOL_CREATE_PROTECTED_BIT = 4, + VK_COMMAND_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkCommandPoolCreateFlagBits; typedef enum VkCommandPoolResetFlagBits { - VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 1 + VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 1, + VK_COMMAND_POOL_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkCommandPoolResetFlagBits; typedef enum VkCommandBufferResetFlagBits { - VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 1 + VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 1, + VK_COMMAND_BUFFER_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkCommandBufferResetFlagBits; typedef enum VkCommandBufferLevel { VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0, - VK_COMMAND_BUFFER_LEVEL_SECONDARY = 1 + VK_COMMAND_BUFFER_LEVEL_SECONDARY = 1, + VK_COMMAND_BUFFER_LEVEL_MAX_ENUM = 0x7FFFFFFF } VkCommandBufferLevel; typedef enum VkCommandBufferUsageFlagBits { VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 1, VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 2, - VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 4 + VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 4, + VK_COMMAND_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkCommandBufferUsageFlagBits; typedef enum VkCompareOp { VK_COMPARE_OP_NEVER = 0, @@ -357,13 +438,15 @@ typedef enum VkCompareOp { VK_COMPARE_OP_GREATER = 4, VK_COMPARE_OP_NOT_EQUAL = 5, VK_COMPARE_OP_GREATER_OR_EQUAL = 6, - VK_COMPARE_OP_ALWAYS = 7 + VK_COMPARE_OP_ALWAYS = 7, + VK_COMPARE_OP_MAX_ENUM = 0x7FFFFFFF } VkCompareOp; typedef enum VkCullModeFlagBits { VK_CULL_MODE_NONE = 0, VK_CULL_MODE_FRONT_BIT = 1, VK_CULL_MODE_BACK_BIT = 2, - VK_CULL_MODE_FRONT_AND_BACK = 0x00000003 + VK_CULL_MODE_FRONT_AND_BACK = 0x00000003, + VK_CULL_MODE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkCullModeFlagBits; typedef enum VkDescriptorType { VK_DESCRIPTOR_TYPE_SAMPLER = 0, @@ -376,7 +459,9 @@ typedef enum VkDescriptorType { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 7, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 8, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9, - VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10 + VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10, + VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK = 1000138000, + VK_DESCRIPTOR_TYPE_MAX_ENUM = 0x7FFFFFFF } VkDescriptorType; typedef enum VkDynamicState { VK_DYNAMIC_STATE_VIEWPORT = 0, @@ -388,15 +473,32 @@ typedef enum VkDynamicState { VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 6, VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 7, VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8, - VK_DYNAMIC_STATE_RANGE_SIZE = (VK_DYNAMIC_STATE_STENCIL_REFERENCE - VK_DYNAMIC_STATE_VIEWPORT + 1) + VK_DYNAMIC_STATE_CULL_MODE = 1000267000, + VK_DYNAMIC_STATE_FRONT_FACE = 1000267001, + VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY = 1000267002, + VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT = 1000267003, + VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT = 1000267004, + VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE = 1000267005, + VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE = 1000267006, + VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE = 1000267007, + VK_DYNAMIC_STATE_DEPTH_COMPARE_OP = 1000267008, + VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE = 1000267009, + VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE = 1000267010, + VK_DYNAMIC_STATE_STENCIL_OP = 1000267011, + VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE = 1000377001, + VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE = 1000377002, + VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE = 1000377004, + VK_DYNAMIC_STATE_MAX_ENUM = 0x7FFFFFFF } VkDynamicState; typedef enum VkFenceCreateFlagBits { - VK_FENCE_CREATE_SIGNALED_BIT = 1 + VK_FENCE_CREATE_SIGNALED_BIT = 1, + VK_FENCE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkFenceCreateFlagBits; typedef enum VkPolygonMode { VK_POLYGON_MODE_FILL = 0, VK_POLYGON_MODE_LINE = 1, - VK_POLYGON_MODE_POINT = 2 + VK_POLYGON_MODE_POINT = 2, + VK_POLYGON_MODE_MAX_ENUM = 0x7FFFFFFF } VkPolygonMode; typedef enum VkFormat { VK_FORMAT_UNDEFINED = 0, @@ -617,7 +719,28 @@ typedef enum VkFormat { VK_FORMAT_G16_B16R16_2PLANE_420_UNORM = 1000156030, VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM = 1000156031, VK_FORMAT_G16_B16R16_2PLANE_422_UNORM = 1000156032, - VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM = 1000156033 + VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM = 1000156033, + VK_FORMAT_G8_B8R8_2PLANE_444_UNORM = 1000330000, + VK_FORMAT_G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16 = 1000330001, + VK_FORMAT_G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16 = 1000330002, + VK_FORMAT_G16_B16R16_2PLANE_444_UNORM = 1000330003, + VK_FORMAT_A4R4G4B4_UNORM_PACK16 = 1000340000, + VK_FORMAT_A4B4G4R4_UNORM_PACK16 = 1000340001, + VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK = 1000066000, + VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK = 1000066001, + VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK = 1000066002, + VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK = 1000066003, + VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK = 1000066004, + VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK = 1000066005, + VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK = 1000066006, + VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK = 1000066007, + VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK = 1000066008, + VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK = 1000066009, + VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK = 1000066010, + VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK = 1000066011, + VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK = 1000066012, + VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK = 1000066013, + VK_FORMAT_MAX_ENUM = 0x7FFFFFFF } VkFormat; typedef enum VkFormatFeatureFlagBits { VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 1, @@ -641,11 +764,14 @@ typedef enum VkFormatFeatureFlagBits { VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT = 1048576, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT = 2097152, VK_FORMAT_FEATURE_DISJOINT_BIT = 4194304, - VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT = 8388608 + VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT = 8388608, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT = 65536, + VK_FORMAT_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkFormatFeatureFlagBits; typedef enum VkFrontFace { VK_FRONT_FACE_COUNTER_CLOCKWISE = 0, - VK_FRONT_FACE_CLOCKWISE = 1 + VK_FRONT_FACE_CLOCKWISE = 1, + VK_FRONT_FACE_MAX_ENUM = 0x7FFFFFFF } VkFrontFace; typedef enum VkImageAspectFlagBits { VK_IMAGE_ASPECT_COLOR_BIT = 1, @@ -654,7 +780,9 @@ typedef enum VkImageAspectFlagBits { VK_IMAGE_ASPECT_METADATA_BIT = 8, VK_IMAGE_ASPECT_PLANE_0_BIT = 16, VK_IMAGE_ASPECT_PLANE_1_BIT = 32, - VK_IMAGE_ASPECT_PLANE_2_BIT = 64 + VK_IMAGE_ASPECT_PLANE_2_BIT = 64, + VK_IMAGE_ASPECT_NONE = 0, + VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkImageAspectFlagBits; typedef enum VkImageCreateFlagBits { VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 1, @@ -668,7 +796,8 @@ typedef enum VkImageCreateFlagBits { VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT = 128, VK_IMAGE_CREATE_EXTENDED_USAGE_BIT = 256, VK_IMAGE_CREATE_PROTECTED_BIT = 2048, - VK_IMAGE_CREATE_DISJOINT_BIT = 512 + VK_IMAGE_CREATE_DISJOINT_BIT = 512, + VK_IMAGE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkImageCreateFlagBits; typedef enum VkImageLayout { VK_IMAGE_LAYOUT_UNDEFINED = 0, @@ -682,16 +811,25 @@ typedef enum VkImageLayout { VK_IMAGE_LAYOUT_PREINITIALIZED = 8, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL = 1000117000, VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL = 1000117001, - VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002 + VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL = 1000241000, + VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL = 1000241001, + VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL = 1000241002, + VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL = 1000241003, + VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL = 1000314000, + VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL = 1000314001, + VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002, + VK_IMAGE_LAYOUT_MAX_ENUM = 0x7FFFFFFF } VkImageLayout; typedef enum VkImageTiling { VK_IMAGE_TILING_OPTIMAL = 0, - VK_IMAGE_TILING_LINEAR = 1 + VK_IMAGE_TILING_LINEAR = 1, + VK_IMAGE_TILING_MAX_ENUM = 0x7FFFFFFF } VkImageTiling; typedef enum VkImageType { VK_IMAGE_TYPE_1D = 0, VK_IMAGE_TYPE_2D = 1, - VK_IMAGE_TYPE_3D = 2 + VK_IMAGE_TYPE_3D = 2, + VK_IMAGE_TYPE_MAX_ENUM = 0x7FFFFFFF } VkImageType; typedef enum VkImageUsageFlagBits { VK_IMAGE_USAGE_TRANSFER_SRC_BIT = 1, @@ -701,9 +839,9 @@ typedef enum VkImageUsageFlagBits { VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 16, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 32, VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 64, - VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 128 + VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 128, + VK_IMAGE_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkImageUsageFlagBits; - typedef enum VkImageViewType { VK_IMAGE_VIEW_TYPE_1D = 0, VK_IMAGE_VIEW_TYPE_2D = 1, @@ -711,15 +849,18 @@ typedef enum VkImageViewType { VK_IMAGE_VIEW_TYPE_CUBE = 3, VK_IMAGE_VIEW_TYPE_1D_ARRAY = 4, VK_IMAGE_VIEW_TYPE_2D_ARRAY = 5, - VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 6 + VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 6, + VK_IMAGE_VIEW_TYPE_MAX_ENUM = 0x7FFFFFFF } VkImageViewType; typedef enum VkSharingMode { VK_SHARING_MODE_EXCLUSIVE = 0, - VK_SHARING_MODE_CONCURRENT = 1 + VK_SHARING_MODE_CONCURRENT = 1, + VK_SHARING_MODE_MAX_ENUM = 0x7FFFFFFF } VkSharingMode; typedef enum VkIndexType { VK_INDEX_TYPE_UINT16 = 0, - VK_INDEX_TYPE_UINT32 = 1 + VK_INDEX_TYPE_UINT32 = 1, + VK_INDEX_TYPE_MAX_ENUM = 0x7FFFFFFF } VkIndexType; typedef enum VkLogicOp { VK_LOGIC_OP_CLEAR = 0, @@ -737,11 +878,13 @@ typedef enum VkLogicOp { VK_LOGIC_OP_COPY_INVERTED = 12, VK_LOGIC_OP_OR_INVERTED = 13, VK_LOGIC_OP_NAND = 14, - VK_LOGIC_OP_SET = 15 + VK_LOGIC_OP_SET = 15, + VK_LOGIC_OP_MAX_ENUM = 0x7FFFFFFF } VkLogicOp; typedef enum VkMemoryHeapFlagBits { VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 1, - VK_MEMORY_HEAP_MULTI_INSTANCE_BIT = 2 + VK_MEMORY_HEAP_MULTI_INSTANCE_BIT = 2, + VK_MEMORY_HEAP_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkMemoryHeapFlagBits; typedef enum VkAccessFlagBits { VK_ACCESS_INDIRECT_COMMAND_READ_BIT = 1, @@ -760,7 +903,9 @@ typedef enum VkAccessFlagBits { VK_ACCESS_HOST_READ_BIT = 8192, VK_ACCESS_HOST_WRITE_BIT = 16384, VK_ACCESS_MEMORY_READ_BIT = 32768, - VK_ACCESS_MEMORY_WRITE_BIT = 65536 + VK_ACCESS_MEMORY_WRITE_BIT = 65536, + VK_ACCESS_NONE = 0, + VK_ACCESS_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkAccessFlagBits; typedef enum VkMemoryPropertyFlagBits { VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 1, @@ -768,25 +913,32 @@ typedef enum VkMemoryPropertyFlagBits { VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 4, VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 8, VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 16, - VK_MEMORY_PROPERTY_PROTECTED_BIT = 32 + VK_MEMORY_PROPERTY_PROTECTED_BIT = 32, + VK_MEMORY_PROPERTY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkMemoryPropertyFlagBits; typedef enum VkPhysicalDeviceType { VK_PHYSICAL_DEVICE_TYPE_OTHER = 0, VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 1, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 2, VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 3, - VK_PHYSICAL_DEVICE_TYPE_CPU = 4 + VK_PHYSICAL_DEVICE_TYPE_CPU = 4, + VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM = 0x7FFFFFFF } VkPhysicalDeviceType; typedef enum VkPipelineBindPoint { VK_PIPELINE_BIND_POINT_GRAPHICS = 0, - VK_PIPELINE_BIND_POINT_COMPUTE = 1 + VK_PIPELINE_BIND_POINT_COMPUTE = 1, + VK_PIPELINE_BIND_POINT_MAX_ENUM = 0x7FFFFFFF } VkPipelineBindPoint; typedef enum VkPipelineCreateFlagBits { VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 1, VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 2, VK_PIPELINE_CREATE_DERIVATIVE_BIT = 4, VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT = 8, - VK_PIPELINE_CREATE_DISPATCH_BASE = 16 + VK_PIPELINE_CREATE_DISPATCH_BASE_BIT = 16, + VK_PIPELINE_CREATE_DISPATCH_BASE = VK_PIPELINE_CREATE_DISPATCH_BASE_BIT, + VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT = 256, + VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT = 512, + VK_PIPELINE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkPipelineCreateFlagBits; typedef enum VkPrimitiveTopology { VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0, @@ -799,10 +951,12 @@ typedef enum VkPrimitiveTopology { VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 7, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 8, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 9, - VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 10 + VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 10, + VK_PRIMITIVE_TOPOLOGY_MAX_ENUM = 0x7FFFFFFF } VkPrimitiveTopology; typedef enum VkQueryControlFlagBits { - VK_QUERY_CONTROL_PRECISE_BIT = 1 + VK_QUERY_CONTROL_PRECISE_BIT = 1, + VK_QUERY_CONTROL_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkQueryControlFlagBits; typedef enum VkQueryPipelineStatisticFlagBits { VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 1, @@ -815,29 +969,34 @@ typedef enum VkQueryPipelineStatisticFlagBits { VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 128, VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 256, VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 512, - VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 1024 + VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 1024, + VK_QUERY_PIPELINE_STATISTIC_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkQueryPipelineStatisticFlagBits; typedef enum VkQueryResultFlagBits { VK_QUERY_RESULT_64_BIT = 1, VK_QUERY_RESULT_WAIT_BIT = 2, VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 4, - VK_QUERY_RESULT_PARTIAL_BIT = 8 + VK_QUERY_RESULT_PARTIAL_BIT = 8, + VK_QUERY_RESULT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkQueryResultFlagBits; typedef enum VkQueryType { VK_QUERY_TYPE_OCCLUSION = 0, VK_QUERY_TYPE_PIPELINE_STATISTICS = 1, - VK_QUERY_TYPE_TIMESTAMP = 2 + VK_QUERY_TYPE_TIMESTAMP = 2, + VK_QUERY_TYPE_MAX_ENUM = 0x7FFFFFFF } VkQueryType; typedef enum VkQueueFlagBits { VK_QUEUE_GRAPHICS_BIT = 1, VK_QUEUE_COMPUTE_BIT = 2, VK_QUEUE_TRANSFER_BIT = 4, VK_QUEUE_SPARSE_BINDING_BIT = 8, - VK_QUEUE_PROTECTED_BIT = 16 + VK_QUEUE_PROTECTED_BIT = 16, + VK_QUEUE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkQueueFlagBits; typedef enum VkSubpassContents { VK_SUBPASS_CONTENTS_INLINE = 0, - VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 1 + VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 1, + VK_SUBPASS_CONTENTS_MAX_ENUM = 0x7FFFFFFF } VkSubpassContents; typedef enum VkResult { VK_SUCCESS = 0, @@ -858,13 +1017,18 @@ typedef enum VkResult { VK_ERROR_TOO_MANY_OBJECTS = -10, VK_ERROR_FORMAT_NOT_SUPPORTED = -11, VK_ERROR_FRAGMENTED_POOL = -12, + VK_ERROR_UNKNOWN = -13, VK_ERROR_OUT_OF_POOL_MEMORY = -1000069000, VK_ERROR_INVALID_EXTERNAL_HANDLE = -1000072003, + VK_ERROR_FRAGMENTATION = -1000161000, + VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS = -1000257000, + VK_PIPELINE_COMPILE_REQUIRED = 1000297000, VK_ERROR_SURFACE_LOST_KHR = -1000000000, VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001, VK_SUBOPTIMAL_KHR = 1000001003, VK_ERROR_OUT_OF_DATE_KHR = -1000001004, - VK_ERROR_VALIDATION_FAILED_EXT = -1000011001 + VK_ERROR_VALIDATION_FAILED_EXT = -1000011001, + VK_RESULT_MAX_ENUM = 0x7FFFFFFF } VkResult; typedef enum VkShaderStageFlagBits { VK_SHADER_STAGE_VERTEX_BIT = 1, @@ -874,15 +1038,19 @@ typedef enum VkShaderStageFlagBits { VK_SHADER_STAGE_FRAGMENT_BIT = 16, VK_SHADER_STAGE_COMPUTE_BIT = 32, VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F, - VK_SHADER_STAGE_ALL = 0x7FFFFFFF + VK_SHADER_STAGE_ALL = 0x7FFFFFFF, + VK_SHADER_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkShaderStageFlagBits; typedef enum VkSparseMemoryBindFlagBits { - VK_SPARSE_MEMORY_BIND_METADATA_BIT = 1 + VK_SPARSE_MEMORY_BIND_METADATA_BIT = 1, + VK_SPARSE_MEMORY_BIND_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkSparseMemoryBindFlagBits; typedef enum VkStencilFaceFlagBits { VK_STENCIL_FACE_FRONT_BIT = 1, VK_STENCIL_FACE_BACK_BIT = 2, - VK_STENCIL_FRONT_AND_BACK = 0x00000003 + VK_STENCIL_FACE_FRONT_AND_BACK = 0x00000003, + VK_STENCIL_FRONT_AND_BACK = VK_STENCIL_FACE_FRONT_AND_BACK, + VK_STENCIL_FACE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkStencilFaceFlagBits; typedef enum VkStencilOp { VK_STENCIL_OP_KEEP = 0, @@ -892,7 +1060,8 @@ typedef enum VkStencilOp { VK_STENCIL_OP_DECREMENT_AND_CLAMP = 4, VK_STENCIL_OP_INVERT = 5, VK_STENCIL_OP_INCREMENT_AND_WRAP = 6, - VK_STENCIL_OP_DECREMENT_AND_WRAP = 7 + VK_STENCIL_OP_DECREMENT_AND_WRAP = 7, + VK_STENCIL_OP_MAX_ENUM = 0x7FFFFFFF } VkStencilOp; typedef enum VkStructureType { VK_STRUCTURE_TYPE_APPLICATION_INFO = 0, @@ -1011,6 +1180,108 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT = 1000168001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES = 1000063000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES = 49, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES = 50, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES = 51, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES = 52, + VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO = 1000147000, + VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2 = 1000109000, + VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2 = 1000109001, + VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2 = 1000109002, + VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2 = 1000109003, + VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2 = 1000109004, + VK_STRUCTURE_TYPE_SUBPASS_BEGIN_INFO = 1000109005, + VK_STRUCTURE_TYPE_SUBPASS_END_INFO = 1000109006, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES = 1000177000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES = 1000196000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES = 1000180000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES = 1000082000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES = 1000197000, + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO = 1000161000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES = 1000161001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES = 1000161002, + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO = 1000161003, + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT = 1000161004, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES = 1000199000, + VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE = 1000199001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES = 1000221000, + VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO = 1000246000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES = 1000130000, + VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO = 1000130001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES = 1000211000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES = 1000108000, + VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO = 1000108001, + VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO = 1000108002, + VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO = 1000108003, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES = 1000253000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES = 1000175000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES = 1000241000, + VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT = 1000241001, + VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT = 1000241002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES = 1000261000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES = 1000207000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES = 1000207001, + VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO = 1000207002, + VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO = 1000207003, + VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO = 1000207004, + VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO = 1000207005, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES = 1000257000, + VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO = 1000244001, + VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO = 1000257002, + VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO = 1000257003, + VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO = 1000257004, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES = 53, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES = 54, + VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO = 1000192000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES = 1000215000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TOOL_PROPERTIES = 1000245000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES = 1000276000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES = 1000295000, + VK_STRUCTURE_TYPE_DEVICE_PRIVATE_DATA_CREATE_INFO = 1000295001, + VK_STRUCTURE_TYPE_PRIVATE_DATA_SLOT_CREATE_INFO = 1000295002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES = 1000297000, + VK_STRUCTURE_TYPE_MEMORY_BARRIER_2 = 1000314000, + VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2 = 1000314001, + VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2 = 1000314002, + VK_STRUCTURE_TYPE_DEPENDENCY_INFO = 1000314003, + VK_STRUCTURE_TYPE_SUBMIT_INFO_2 = 1000314004, + VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO = 1000314005, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_SUBMIT_INFO = 1000314006, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES = 1000314007, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES = 1000325000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES = 1000335000, + VK_STRUCTURE_TYPE_COPY_BUFFER_INFO_2 = 1000337000, + VK_STRUCTURE_TYPE_COPY_IMAGE_INFO_2 = 1000337001, + VK_STRUCTURE_TYPE_COPY_BUFFER_TO_IMAGE_INFO_2 = 1000337002, + VK_STRUCTURE_TYPE_COPY_IMAGE_TO_BUFFER_INFO_2 = 1000337003, + VK_STRUCTURE_TYPE_BLIT_IMAGE_INFO_2 = 1000337004, + VK_STRUCTURE_TYPE_RESOLVE_IMAGE_INFO_2 = 1000337005, + VK_STRUCTURE_TYPE_BUFFER_COPY_2 = 1000337006, + VK_STRUCTURE_TYPE_IMAGE_COPY_2 = 1000337007, + VK_STRUCTURE_TYPE_IMAGE_BLIT_2 = 1000337008, + VK_STRUCTURE_TYPE_BUFFER_IMAGE_COPY_2 = 1000337009, + VK_STRUCTURE_TYPE_IMAGE_RESOLVE_2 = 1000337010, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES = 1000225000, + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO = 1000225001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES = 1000225002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES = 1000138000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES = 1000138001, + VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK = 1000138002, + VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO = 1000138003, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES = 1000066000, + VK_STRUCTURE_TYPE_RENDERING_INFO = 1000044000, + VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO = 1000044001, + VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO = 1000044002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES = 1000044003, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDERING_INFO = 1000044004, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES = 1000280000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES = 1000280001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES = 1000281001, + VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3 = 1000360000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES = 1000413000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES = 1000413001, + VK_STRUCTURE_TYPE_DEVICE_BUFFER_MEMORY_REQUIREMENTS = 1000413002, + VK_STRUCTURE_TYPE_DEVICE_IMAGE_MEMORY_REQUIREMENTS = 1000413003, VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 1000001000, VK_STRUCTURE_TYPE_PRESENT_INFO_KHR = 1000001001, VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR = 1000060007, @@ -1020,35 +1291,43 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR = 1000060011, VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR = 1000060012, VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT = 1000011000, - VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT + VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT, + VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF } VkStructureType; typedef enum VkSystemAllocationScope { VK_SYSTEM_ALLOCATION_SCOPE_COMMAND = 0, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = 1, VK_SYSTEM_ALLOCATION_SCOPE_CACHE = 2, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = 3, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 4 + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 4, + VK_SYSTEM_ALLOCATION_SCOPE_MAX_ENUM = 0x7FFFFFFF } VkSystemAllocationScope; typedef enum VkInternalAllocationType { - VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0 + VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0, + VK_INTERNAL_ALLOCATION_TYPE_MAX_ENUM = 0x7FFFFFFF } VkInternalAllocationType; typedef enum VkSamplerAddressMode { VK_SAMPLER_ADDRESS_MODE_REPEAT = 0, VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 1, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 2, - VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3 + VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3, + VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4, + VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = 0x7FFFFFFF } VkSamplerAddressMode; typedef enum VkFilter { VK_FILTER_NEAREST = 0, - VK_FILTER_LINEAR = 1 + VK_FILTER_LINEAR = 1, + VK_FILTER_MAX_ENUM = 0x7FFFFFFF } VkFilter; typedef enum VkSamplerMipmapMode { VK_SAMPLER_MIPMAP_MODE_NEAREST = 0, - VK_SAMPLER_MIPMAP_MODE_LINEAR = 1 + VK_SAMPLER_MIPMAP_MODE_LINEAR = 1, + VK_SAMPLER_MIPMAP_MODE_MAX_ENUM = 0x7FFFFFFF } VkSamplerMipmapMode; typedef enum VkVertexInputRate { VK_VERTEX_INPUT_RATE_VERTEX = 0, - VK_VERTEX_INPUT_RATE_INSTANCE = 1 + VK_VERTEX_INPUT_RATE_INSTANCE = 1, + VK_VERTEX_INPUT_RATE_MAX_ENUM = 0x7FFFFFFF } VkVertexInputRate; typedef enum VkPipelineStageFlagBits { VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 1, @@ -1067,12 +1346,15 @@ typedef enum VkPipelineStageFlagBits { VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT = 8192, VK_PIPELINE_STAGE_HOST_BIT = 16384, VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 32768, - VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 65536 + VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 65536, + VK_PIPELINE_STAGE_NONE = 0, + VK_PIPELINE_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkPipelineStageFlagBits; typedef enum VkSparseImageFormatFlagBits { VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 1, VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 2, - VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 4 + VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 4, + VK_SPARSE_IMAGE_FORMAT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkSparseImageFormatFlagBits; typedef enum VkSampleCountFlagBits { VK_SAMPLE_COUNT_1_BIT = 1, @@ -1081,18 +1363,23 @@ typedef enum VkSampleCountFlagBits { VK_SAMPLE_COUNT_8_BIT = 8, VK_SAMPLE_COUNT_16_BIT = 16, VK_SAMPLE_COUNT_32_BIT = 32, - VK_SAMPLE_COUNT_64_BIT = 64 + VK_SAMPLE_COUNT_64_BIT = 64, + VK_SAMPLE_COUNT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkSampleCountFlagBits; typedef enum VkAttachmentDescriptionFlagBits { - VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 1 + VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 1, + VK_ATTACHMENT_DESCRIPTION_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkAttachmentDescriptionFlagBits; typedef enum VkDescriptorPoolCreateFlagBits { - VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 1 + VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 1, + VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT = 2, + VK_DESCRIPTOR_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkDescriptorPoolCreateFlagBits; typedef enum VkDependencyFlagBits { VK_DEPENDENCY_BY_REGION_BIT = 1, VK_DEPENDENCY_DEVICE_GROUP_BIT = 4, - VK_DEPENDENCY_VIEW_LOCAL_BIT = 2 + VK_DEPENDENCY_VIEW_LOCAL_BIT = 2, + VK_DEPENDENCY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkDependencyFlagBits; typedef enum VkObjectType { VK_OBJECT_TYPE_UNKNOWN = 0, @@ -1123,33 +1410,252 @@ typedef enum VkObjectType { VK_OBJECT_TYPE_COMMAND_POOL = 25, VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION = 1000156000, VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE = 1000085000, + VK_OBJECT_TYPE_PRIVATE_DATA_SLOT = 1000295000, VK_OBJECT_TYPE_SURFACE_KHR = 1000000000, VK_OBJECT_TYPE_SWAPCHAIN_KHR = 1000001000, - VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT = 1000011000 + VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT = 1000011000, + VK_OBJECT_TYPE_MAX_ENUM = 0x7FFFFFFF } VkObjectType; +typedef enum VkEventCreateFlagBits { + VK_EVENT_CREATE_DEVICE_ONLY_BIT = 1, + VK_EVENT_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkEventCreateFlagBits; typedef enum VkDescriptorUpdateTemplateType { - VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET = 0 + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET = 0, + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_MAX_ENUM = 0x7FFFFFFF } VkDescriptorUpdateTemplateType; - typedef enum VkPointClippingBehavior { VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES = 0, - VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY = 1 + VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY = 1, + VK_POINT_CLIPPING_BEHAVIOR_MAX_ENUM = 0x7FFFFFFF } VkPointClippingBehavior; +typedef enum VkResolveModeFlagBits { + VK_RESOLVE_MODE_NONE = 0, + VK_RESOLVE_MODE_SAMPLE_ZERO_BIT = 1, + VK_RESOLVE_MODE_AVERAGE_BIT = 2, + VK_RESOLVE_MODE_MIN_BIT = 4, + VK_RESOLVE_MODE_MAX_BIT = 8, + VK_RESOLVE_MODE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkResolveModeFlagBits; +typedef enum VkDescriptorBindingFlagBits { + VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT = 1, + VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT = 2, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT = 4, + VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT = 8, + VK_DESCRIPTOR_BINDING_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkDescriptorBindingFlagBits; +typedef enum VkSemaphoreType { + VK_SEMAPHORE_TYPE_BINARY = 0, + VK_SEMAPHORE_TYPE_TIMELINE = 1, + VK_SEMAPHORE_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkSemaphoreType; +typedef enum VkPipelineCreationFeedbackFlagBits { + VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT = 1, + VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT_EXT = VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT, + VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT = 2, + VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT_EXT = VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT, + VK_PIPELINE_CREATION_FEEDBACK_BASE_PIPELINE_ACCELERATION_BIT = 4, + VK_PIPELINE_CREATION_FEEDBACK_BASE_PIPELINE_ACCELERATION_BIT_EXT = VK_PIPELINE_CREATION_FEEDBACK_BASE_PIPELINE_ACCELERATION_BIT, + VK_PIPELINE_CREATION_FEEDBACK_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkPipelineCreationFeedbackFlagBits; +typedef enum VkSemaphoreWaitFlagBits { + VK_SEMAPHORE_WAIT_ANY_BIT = 1, + VK_SEMAPHORE_WAIT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkSemaphoreWaitFlagBits; +typedef enum VkToolPurposeFlagBits { + VK_TOOL_PURPOSE_VALIDATION_BIT = 1, + VK_TOOL_PURPOSE_VALIDATION_BIT_EXT = VK_TOOL_PURPOSE_VALIDATION_BIT, + VK_TOOL_PURPOSE_PROFILING_BIT = 2, + VK_TOOL_PURPOSE_PROFILING_BIT_EXT = VK_TOOL_PURPOSE_PROFILING_BIT, + VK_TOOL_PURPOSE_TRACING_BIT = 4, + VK_TOOL_PURPOSE_TRACING_BIT_EXT = VK_TOOL_PURPOSE_TRACING_BIT, + VK_TOOL_PURPOSE_ADDITIONAL_FEATURES_BIT = 8, + VK_TOOL_PURPOSE_ADDITIONAL_FEATURES_BIT_EXT = VK_TOOL_PURPOSE_ADDITIONAL_FEATURES_BIT, + VK_TOOL_PURPOSE_MODIFYING_FEATURES_BIT = 16, + VK_TOOL_PURPOSE_MODIFYING_FEATURES_BIT_EXT = VK_TOOL_PURPOSE_MODIFYING_FEATURES_BIT, + VK_TOOL_PURPOSE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkToolPurposeFlagBits; +typedef uint64_t VkAccessFlagBits2; +static const VkAccessFlagBits2 VK_ACCESS_2_NONE = 0; +static const VkAccessFlagBits2 VK_ACCESS_2_NONE_KHR = 0; +static const VkAccessFlagBits2 VK_ACCESS_2_INDIRECT_COMMAND_READ_BIT = 1; +static const VkAccessFlagBits2 VK_ACCESS_2_INDIRECT_COMMAND_READ_BIT_KHR = 1; +static const VkAccessFlagBits2 VK_ACCESS_2_INDEX_READ_BIT = 2; +static const VkAccessFlagBits2 VK_ACCESS_2_INDEX_READ_BIT_KHR = 2; +static const VkAccessFlagBits2 VK_ACCESS_2_VERTEX_ATTRIBUTE_READ_BIT = 4; +static const VkAccessFlagBits2 VK_ACCESS_2_VERTEX_ATTRIBUTE_READ_BIT_KHR = 4; +static const VkAccessFlagBits2 VK_ACCESS_2_UNIFORM_READ_BIT = 8; +static const VkAccessFlagBits2 VK_ACCESS_2_UNIFORM_READ_BIT_KHR = 8; +static const VkAccessFlagBits2 VK_ACCESS_2_INPUT_ATTACHMENT_READ_BIT = 16; +static const VkAccessFlagBits2 VK_ACCESS_2_INPUT_ATTACHMENT_READ_BIT_KHR = 16; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_READ_BIT = 32; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_READ_BIT_KHR = 32; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_WRITE_BIT = 64; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_WRITE_BIT_KHR = 64; +static const VkAccessFlagBits2 VK_ACCESS_2_COLOR_ATTACHMENT_READ_BIT = 128; +static const VkAccessFlagBits2 VK_ACCESS_2_COLOR_ATTACHMENT_READ_BIT_KHR = 128; +static const VkAccessFlagBits2 VK_ACCESS_2_COLOR_ATTACHMENT_WRITE_BIT = 256; +static const VkAccessFlagBits2 VK_ACCESS_2_COLOR_ATTACHMENT_WRITE_BIT_KHR = 256; +static const VkAccessFlagBits2 VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_READ_BIT = 512; +static const VkAccessFlagBits2 VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_READ_BIT_KHR = 512; +static const VkAccessFlagBits2 VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = 1024; +static const VkAccessFlagBits2 VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT_KHR = 1024; +static const VkAccessFlagBits2 VK_ACCESS_2_TRANSFER_READ_BIT = 2048; +static const VkAccessFlagBits2 VK_ACCESS_2_TRANSFER_READ_BIT_KHR = 2048; +static const VkAccessFlagBits2 VK_ACCESS_2_TRANSFER_WRITE_BIT = 4096; +static const VkAccessFlagBits2 VK_ACCESS_2_TRANSFER_WRITE_BIT_KHR = 4096; +static const VkAccessFlagBits2 VK_ACCESS_2_HOST_READ_BIT = 8192; +static const VkAccessFlagBits2 VK_ACCESS_2_HOST_READ_BIT_KHR = 8192; +static const VkAccessFlagBits2 VK_ACCESS_2_HOST_WRITE_BIT = 16384; +static const VkAccessFlagBits2 VK_ACCESS_2_HOST_WRITE_BIT_KHR = 16384; +static const VkAccessFlagBits2 VK_ACCESS_2_MEMORY_READ_BIT = 32768; +static const VkAccessFlagBits2 VK_ACCESS_2_MEMORY_READ_BIT_KHR = 32768; +static const VkAccessFlagBits2 VK_ACCESS_2_MEMORY_WRITE_BIT = 65536; +static const VkAccessFlagBits2 VK_ACCESS_2_MEMORY_WRITE_BIT_KHR = 65536; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_SAMPLED_READ_BIT = 4294967296; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_SAMPLED_READ_BIT_KHR = 4294967296; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_READ_BIT = 8589934592; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_READ_BIT_KHR = 8589934592; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT = 17179869184; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT_KHR = 17179869184; + +typedef uint64_t VkPipelineStageFlagBits2; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_NONE = 0; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_NONE_KHR = 0; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT = 1; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT_KHR = 1; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT = 2; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT_KHR = 2; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT = 4; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT_KHR = 4; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_SHADER_BIT = 8; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_SHADER_BIT_KHR = 8; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TESSELLATION_CONTROL_SHADER_BIT = 16; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TESSELLATION_CONTROL_SHADER_BIT_KHR = 16; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TESSELLATION_EVALUATION_SHADER_BIT = 32; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TESSELLATION_EVALUATION_SHADER_BIT_KHR = 32; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_GEOMETRY_SHADER_BIT = 64; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_GEOMETRY_SHADER_BIT_KHR = 64; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT = 128; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT_KHR = 128; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT = 256; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT_KHR = 256; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT = 512; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT_KHR = 512; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT = 1024; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT_KHR = 1024; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT = 2048; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR = 2048; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT = 4096; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT_KHR = 4096; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TRANSFER_BIT = 4096; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TRANSFER_BIT_KHR = 4096; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT = 8192; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT_KHR = 8192; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_HOST_BIT = 16384; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_HOST_BIT_KHR = 16384; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT = 32768; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR = 32768; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT = 65536; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR = 65536; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COPY_BIT = 4294967296; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COPY_BIT_KHR = 4294967296; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_RESOLVE_BIT = 8589934592; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_RESOLVE_BIT_KHR = 8589934592; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_BLIT_BIT = 17179869184; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_BLIT_BIT_KHR = 17179869184; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_CLEAR_BIT = 34359738368; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_CLEAR_BIT_KHR = 34359738368; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT = 68719476736; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT_KHR = 68719476736; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT = 137438953472; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT_KHR = 137438953472; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT = 274877906944; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT_KHR = 274877906944; + +typedef uint64_t VkFormatFeatureFlagBits2; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT = 1; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT_KHR = 1; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT = 2; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT_KHR = 2; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BIT = 4; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BIT_KHR = 4; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_UNIFORM_TEXEL_BUFFER_BIT = 8; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_UNIFORM_TEXEL_BUFFER_BIT_KHR = 8; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_BIT = 16; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_BIT_KHR = 16; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 32; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_ATOMIC_BIT_KHR = 32; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_VERTEX_BUFFER_BIT = 64; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_VERTEX_BUFFER_BIT_KHR = 64; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT = 128; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT_KHR = 128; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BLEND_BIT = 256; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BLEND_BIT_KHR = 256; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT = 512; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT_KHR = 512; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_BLIT_SRC_BIT = 1024; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_BLIT_SRC_BIT_KHR = 1024; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_BLIT_DST_BIT = 2048; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_BLIT_DST_BIT_KHR = 2048; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 4096; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT_KHR = 4096; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_CUBIC_BIT = 8192; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT = 8192; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT = 16384; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT_KHR = 16384; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT = 32768; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT_KHR = 32768; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_MINMAX_BIT = 65536; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_MINMAX_BIT_KHR = 65536; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_MIDPOINT_CHROMA_SAMPLES_BIT = 131072; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_MIDPOINT_CHROMA_SAMPLES_BIT_KHR = 131072; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT = 262144; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT_KHR = 262144; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT = 524288; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT_KHR = 524288; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT = 1048576; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT_KHR = 1048576; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT = 2097152; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT_KHR = 2097152; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_DISJOINT_BIT = 4194304; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_DISJOINT_BIT_KHR = 4194304; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_COSITED_CHROMA_SAMPLES_BIT = 8388608; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_COSITED_CHROMA_SAMPLES_BIT_KHR = 8388608; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT = 2147483648; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT_KHR = 2147483648; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT = 4294967296; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT_KHR = 4294967296; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT = 8589934592; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT_KHR = 8589934592; + +typedef enum VkRenderingFlagBits { + VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT = 1, + VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT_KHR = VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT, + VK_RENDERING_SUSPENDING_BIT = 2, + VK_RENDERING_SUSPENDING_BIT_KHR = VK_RENDERING_SUSPENDING_BIT, + VK_RENDERING_RESUMING_BIT = 4, + VK_RENDERING_RESUMING_BIT_KHR = VK_RENDERING_RESUMING_BIT, + VK_RENDERING_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkRenderingFlagBits; typedef enum VkColorSpaceKHR { VK_COLOR_SPACE_SRGB_NONLINEAR_KHR = 0, - VK_COLORSPACE_SRGB_NONLINEAR_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR + VK_COLORSPACE_SRGB_NONLINEAR_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, + VK_COLOR_SPACE_MAX_ENUM_KHR = 0x7FFFFFFF } VkColorSpaceKHR; typedef enum VkCompositeAlphaFlagBitsKHR { VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 1, VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 2, VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 4, - VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 8 + VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 8, + VK_COMPOSITE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF } VkCompositeAlphaFlagBitsKHR; typedef enum VkPresentModeKHR { VK_PRESENT_MODE_IMMEDIATE_KHR = 0, VK_PRESENT_MODE_MAILBOX_KHR = 1, VK_PRESENT_MODE_FIFO_KHR = 2, - VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3 + VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3, + VK_PRESENT_MODE_MAX_ENUM_KHR = 0x7FFFFFFF } VkPresentModeKHR; typedef enum VkSurfaceTransformFlagBitsKHR { VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR = 1, @@ -1160,14 +1666,16 @@ typedef enum VkSurfaceTransformFlagBitsKHR { VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR = 32, VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = 64, VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = 128, - VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 256 + VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 256, + VK_SURFACE_TRANSFORM_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF } VkSurfaceTransformFlagBitsKHR; typedef enum VkDebugReportFlagBitsEXT { VK_DEBUG_REPORT_INFORMATION_BIT_EXT = 1, VK_DEBUG_REPORT_WARNING_BIT_EXT = 2, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 4, VK_DEBUG_REPORT_ERROR_BIT_EXT = 8, - VK_DEBUG_REPORT_DEBUG_BIT_EXT = 16 + VK_DEBUG_REPORT_DEBUG_BIT_EXT = 16, + VK_DEBUG_REPORT_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF } VkDebugReportFlagBitsEXT; typedef enum VkDebugReportObjectTypeEXT { VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = 0, @@ -1202,12 +1710,11 @@ typedef enum VkDebugReportObjectTypeEXT { VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_KHR_EXT = 29, VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_MODE_KHR_EXT = 30, - VK_DEBUG_REPORT_OBJECT_TYPE_OBJECT_TABLE_NVX_EXT = 31, - VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT = 32, VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT = 33, VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_EXT = 1000156000, - VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT = 1000085000 + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT = 1000085000, + VK_DEBUG_REPORT_OBJECT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF } VkDebugReportObjectTypeEXT; typedef enum VkExternalMemoryHandleTypeFlagBits { VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT = 1, @@ -1216,58 +1723,73 @@ typedef enum VkExternalMemoryHandleTypeFlagBits { VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT = 8, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT = 16, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT = 32, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT = 64 + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT = 64, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkExternalMemoryHandleTypeFlagBits; typedef enum VkExternalMemoryFeatureFlagBits { VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT = 1, VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT = 2, - VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT = 4 + VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT = 4, + VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkExternalMemoryFeatureFlagBits; typedef enum VkExternalSemaphoreHandleTypeFlagBits { VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT = 1, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT = 2, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = 4, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT = 8, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT = 16 + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE_BIT = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT = 16, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkExternalSemaphoreHandleTypeFlagBits; typedef enum VkExternalSemaphoreFeatureFlagBits { VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT = 1, - VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT = 2 + VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT = 2, + VK_EXTERNAL_SEMAPHORE_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkExternalSemaphoreFeatureFlagBits; typedef enum VkSemaphoreImportFlagBits { - VK_SEMAPHORE_IMPORT_TEMPORARY_BIT = 1 + VK_SEMAPHORE_IMPORT_TEMPORARY_BIT = 1, + VK_SEMAPHORE_IMPORT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkSemaphoreImportFlagBits; typedef enum VkExternalFenceHandleTypeFlagBits { VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT = 1, VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT = 2, VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = 4, - VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT = 8 + VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT = 8, + VK_EXTERNAL_FENCE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkExternalFenceHandleTypeFlagBits; typedef enum VkExternalFenceFeatureFlagBits { VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT = 1, - VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT = 2 + VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT = 2, + VK_EXTERNAL_FENCE_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkExternalFenceFeatureFlagBits; typedef enum VkFenceImportFlagBits { - VK_FENCE_IMPORT_TEMPORARY_BIT = 1 + VK_FENCE_IMPORT_TEMPORARY_BIT = 1, + VK_FENCE_IMPORT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkFenceImportFlagBits; typedef enum VkPeerMemoryFeatureFlagBits { VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT = 1, VK_PEER_MEMORY_FEATURE_COPY_DST_BIT = 2, VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT = 4, - VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT = 8 + VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT = 8, + VK_PEER_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkPeerMemoryFeatureFlagBits; typedef enum VkMemoryAllocateFlagBits { - VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT = 1 + VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT = 1, + VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT = 2, + VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT = 4, + VK_MEMORY_ALLOCATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkMemoryAllocateFlagBits; typedef enum VkDeviceGroupPresentModeFlagBitsKHR { VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR = 1, VK_DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHR = 2, VK_DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHR = 4, - VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR = 8 + VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR = 8, + VK_DEVICE_GROUP_PRESENT_MODE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF } VkDeviceGroupPresentModeFlagBitsKHR; typedef enum VkSwapchainCreateFlagBitsKHR { VK_SWAPCHAIN_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR = 1, - VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR = 2 + VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR = 2, + VK_SWAPCHAIN_CREATE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF } VkSwapchainCreateFlagBitsKHR; typedef enum VkSubgroupFeatureFlagBits { VK_SUBGROUP_FEATURE_BASIC_BIT = 1, @@ -1277,32 +1799,84 @@ typedef enum VkSubgroupFeatureFlagBits { VK_SUBGROUP_FEATURE_SHUFFLE_BIT = 16, VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT = 32, VK_SUBGROUP_FEATURE_CLUSTERED_BIT = 64, - VK_SUBGROUP_FEATURE_QUAD_BIT = 128 + VK_SUBGROUP_FEATURE_QUAD_BIT = 128, + VK_SUBGROUP_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkSubgroupFeatureFlagBits; typedef enum VkTessellationDomainOrigin { VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT = 0, - VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT = 1 + VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT = 1, + VK_TESSELLATION_DOMAIN_ORIGIN_MAX_ENUM = 0x7FFFFFFF } VkTessellationDomainOrigin; typedef enum VkSamplerYcbcrModelConversion { VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY = 0, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY = 1, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709 = 2, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601 = 3, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020 = 4 + VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020 = 4, + VK_SAMPLER_YCBCR_MODEL_CONVERSION_MAX_ENUM = 0x7FFFFFFF } VkSamplerYcbcrModelConversion; typedef enum VkSamplerYcbcrRange { VK_SAMPLER_YCBCR_RANGE_ITU_FULL = 0, - VK_SAMPLER_YCBCR_RANGE_ITU_NARROW = 1 + VK_SAMPLER_YCBCR_RANGE_ITU_NARROW = 1, + VK_SAMPLER_YCBCR_RANGE_MAX_ENUM = 0x7FFFFFFF } VkSamplerYcbcrRange; typedef enum VkChromaLocation { VK_CHROMA_LOCATION_COSITED_EVEN = 0, - VK_CHROMA_LOCATION_MIDPOINT = 1 + VK_CHROMA_LOCATION_MIDPOINT = 1, + VK_CHROMA_LOCATION_MAX_ENUM = 0x7FFFFFFF } VkChromaLocation; +typedef enum VkSamplerReductionMode { + VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE = 0, + VK_SAMPLER_REDUCTION_MODE_MIN = 1, + VK_SAMPLER_REDUCTION_MODE_MAX = 2, + VK_SAMPLER_REDUCTION_MODE_MAX_ENUM = 0x7FFFFFFF +} VkSamplerReductionMode; +typedef enum VkShaderFloatControlsIndependence { + VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY = 0, + VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL = 1, + VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE = 2, + VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_MAX_ENUM = 0x7FFFFFFF +} VkShaderFloatControlsIndependence; +typedef enum VkSubmitFlagBits { + VK_SUBMIT_PROTECTED_BIT = 1, + VK_SUBMIT_PROTECTED_BIT_KHR = VK_SUBMIT_PROTECTED_BIT, + VK_SUBMIT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkSubmitFlagBits; typedef enum VkVendorId { VK_VENDOR_ID_VIV = 0x10001, VK_VENDOR_ID_VSI = 0x10002, - VK_VENDOR_ID_KAZAN = 0x10003 + VK_VENDOR_ID_KAZAN = 0x10003, + VK_VENDOR_ID_CODEPLAY = 0x10004, + VK_VENDOR_ID_MESA = 0x10005, + VK_VENDOR_ID_POCL = 0x10006, + VK_VENDOR_ID_MAX_ENUM = 0x7FFFFFFF } VkVendorId; +typedef enum VkDriverId { + VK_DRIVER_ID_AMD_PROPRIETARY = 1, + VK_DRIVER_ID_AMD_OPEN_SOURCE = 2, + VK_DRIVER_ID_MESA_RADV = 3, + VK_DRIVER_ID_NVIDIA_PROPRIETARY = 4, + VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS = 5, + VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA = 6, + VK_DRIVER_ID_IMAGINATION_PROPRIETARY = 7, + VK_DRIVER_ID_QUALCOMM_PROPRIETARY = 8, + VK_DRIVER_ID_ARM_PROPRIETARY = 9, + VK_DRIVER_ID_GOOGLE_SWIFTSHADER = 10, + VK_DRIVER_ID_GGP_PROPRIETARY = 11, + VK_DRIVER_ID_BROADCOM_PROPRIETARY = 12, + VK_DRIVER_ID_MESA_LLVMPIPE = 13, + VK_DRIVER_ID_MOLTENVK = 14, + VK_DRIVER_ID_COREAVI_PROPRIETARY = 15, + VK_DRIVER_ID_JUICE_PROPRIETARY = 16, + VK_DRIVER_ID_VERISILICON_PROPRIETARY = 17, + VK_DRIVER_ID_MESA_TURNIP = 18, + VK_DRIVER_ID_MESA_V3DV = 19, + VK_DRIVER_ID_MESA_PANVK = 20, + VK_DRIVER_ID_SAMSUNG_PROPRIETARY = 21, + VK_DRIVER_ID_MESA_VENUS = 22, + VK_DRIVER_ID_MESA_DOZEN = 23, + VK_DRIVER_ID_MAX_ENUM = 0x7FFFFFFF +} VkDriverId; typedef void (VKAPI_PTR *PFN_vkInternalAllocationNotification)( void* pUserData, size_t size, @@ -1332,28 +1906,34 @@ typedef struct VkBaseOutStructure { VkStructureType sType; struct VkBaseOutStructure * pNext; } VkBaseOutStructure; + typedef struct VkBaseInStructure { VkStructureType sType; const struct VkBaseInStructure * pNext; } VkBaseInStructure; + typedef struct VkOffset2D { int32_t x; int32_t y; } VkOffset2D; + typedef struct VkOffset3D { int32_t x; int32_t y; int32_t z; } VkOffset3D; + typedef struct VkExtent2D { uint32_t width; uint32_t height; } VkExtent2D; + typedef struct VkExtent3D { uint32_t width; uint32_t height; uint32_t depth; } VkExtent3D; + typedef struct VkViewport { float x; float y; @@ -1362,31 +1942,37 @@ typedef struct VkViewport { float minDepth; float maxDepth; } VkViewport; + typedef struct VkRect2D { VkOffset2D offset; VkExtent2D extent; } VkRect2D; + typedef struct VkClearRect { VkRect2D rect; uint32_t baseArrayLayer; uint32_t layerCount; } VkClearRect; + typedef struct VkComponentMapping { VkComponentSwizzle r; VkComponentSwizzle g; VkComponentSwizzle b; VkComponentSwizzle a; } VkComponentMapping; + typedef struct VkExtensionProperties { char extensionName [ VK_MAX_EXTENSION_NAME_SIZE ]; uint32_t specVersion; } VkExtensionProperties; + typedef struct VkLayerProperties { char layerName [ VK_MAX_EXTENSION_NAME_SIZE ]; uint32_t specVersion; uint32_t implementationVersion; char description [ VK_MAX_DESCRIPTION_SIZE ]; } VkLayerProperties; + typedef struct VkApplicationInfo { VkStructureType sType; const void * pNext; @@ -1396,6 +1982,7 @@ typedef struct VkApplicationInfo { uint32_t engineVersion; uint32_t apiVersion; } VkApplicationInfo; + typedef struct VkAllocationCallbacks { void * pUserData; PFN_vkAllocationFunction pfnAllocation; @@ -1404,11 +1991,13 @@ typedef struct VkAllocationCallbacks { PFN_vkInternalAllocationNotification pfnInternalAllocation; PFN_vkInternalFreeNotification pfnInternalFree; } VkAllocationCallbacks; + typedef struct VkDescriptorImageInfo { VkSampler sampler; VkImageView imageView; VkImageLayout imageLayout; } VkDescriptorImageInfo; + typedef struct VkCopyDescriptorSet { VkStructureType sType; const void * pNext; @@ -1420,10 +2009,12 @@ typedef struct VkCopyDescriptorSet { uint32_t dstArrayElement; uint32_t descriptorCount; } VkCopyDescriptorSet; + typedef struct VkDescriptorPoolSize { VkDescriptorType type; uint32_t descriptorCount; } VkDescriptorPoolSize; + typedef struct VkDescriptorSetAllocateInfo { VkStructureType sType; const void * pNext; @@ -1431,28 +2022,33 @@ typedef struct VkDescriptorSetAllocateInfo { uint32_t descriptorSetCount; const VkDescriptorSetLayout * pSetLayouts; } VkDescriptorSetAllocateInfo; + typedef struct VkSpecializationMapEntry { uint32_t constantID; uint32_t offset; size_t size; } VkSpecializationMapEntry; + typedef struct VkSpecializationInfo { uint32_t mapEntryCount; const VkSpecializationMapEntry * pMapEntries; size_t dataSize; const void * pData; } VkSpecializationInfo; + typedef struct VkVertexInputBindingDescription { uint32_t binding; uint32_t stride; VkVertexInputRate inputRate; } VkVertexInputBindingDescription; + typedef struct VkVertexInputAttributeDescription { uint32_t location; uint32_t binding; VkFormat format; uint32_t offset; } VkVertexInputAttributeDescription; + typedef struct VkStencilOpState { VkStencilOp failOp; VkStencilOp passOp; @@ -1462,6 +2058,15 @@ typedef struct VkStencilOpState { uint32_t writeMask; uint32_t reference; } VkStencilOpState; + +typedef struct VkPipelineCacheHeaderVersionOne { + uint32_t headerSize; + VkPipelineCacheHeaderVersion headerVersion; + uint32_t vendorID; + uint32_t deviceID; + uint8_t pipelineCacheUUID [ VK_UUID_SIZE ]; +} VkPipelineCacheHeaderVersionOne; + typedef struct VkCommandBufferAllocateInfo { VkStructureType sType; const void * pNext; @@ -1469,29 +2074,35 @@ typedef struct VkCommandBufferAllocateInfo { VkCommandBufferLevel level; uint32_t commandBufferCount; } VkCommandBufferAllocateInfo; + typedef union VkClearColorValue { float float32 [4]; int32_t int32 [4]; uint32_t uint32 [4]; } VkClearColorValue; + typedef struct VkClearDepthStencilValue { float depth; uint32_t stencil; } VkClearDepthStencilValue; + typedef union VkClearValue { VkClearColorValue color; VkClearDepthStencilValue depthStencil; } VkClearValue; + typedef struct VkAttachmentReference { uint32_t attachment; VkImageLayout layout; } VkAttachmentReference; + typedef struct VkDrawIndirectCommand { uint32_t vertexCount; uint32_t instanceCount; uint32_t firstVertex; uint32_t firstInstance; } VkDrawIndirectCommand; + typedef struct VkDrawIndexedIndirectCommand { uint32_t indexCount; uint32_t instanceCount; @@ -1499,15 +2110,18 @@ typedef struct VkDrawIndexedIndirectCommand { int32_t vertexOffset; uint32_t firstInstance; } VkDrawIndexedIndirectCommand; + typedef struct VkDispatchIndirectCommand { uint32_t x; uint32_t y; uint32_t z; } VkDispatchIndirectCommand; + typedef struct VkSurfaceFormatKHR { VkFormat format; VkColorSpaceKHR colorSpace; } VkSurfaceFormatKHR; + typedef struct VkPresentInfoKHR { VkStructureType sType; const void * pNext; @@ -1518,27 +2132,54 @@ typedef struct VkPresentInfoKHR { const uint32_t * pImageIndices; VkResult * pResults; } VkPresentInfoKHR; + +typedef struct VkDevicePrivateDataCreateInfo { + VkStructureType sType; + const void * pNext; + uint32_t privateDataSlotRequestCount; +} VkDevicePrivateDataCreateInfo; + +typedef struct VkConformanceVersion { + uint8_t major; + uint8_t minor; + uint8_t subminor; + uint8_t patch; +} VkConformanceVersion; + +typedef struct VkPhysicalDeviceDriverProperties { + VkStructureType sType; + void * pNext; + VkDriverId driverID; + char driverName [ VK_MAX_DRIVER_NAME_SIZE ]; + char driverInfo [ VK_MAX_DRIVER_INFO_SIZE ]; + VkConformanceVersion conformanceVersion; +} VkPhysicalDeviceDriverProperties; + typedef struct VkPhysicalDeviceExternalImageFormatInfo { VkStructureType sType; const void * pNext; VkExternalMemoryHandleTypeFlagBits handleType; } VkPhysicalDeviceExternalImageFormatInfo; + typedef struct VkPhysicalDeviceExternalSemaphoreInfo { VkStructureType sType; const void * pNext; VkExternalSemaphoreHandleTypeFlagBits handleType; } VkPhysicalDeviceExternalSemaphoreInfo; + typedef struct VkPhysicalDeviceExternalFenceInfo { VkStructureType sType; const void * pNext; VkExternalFenceHandleTypeFlagBits handleType; } VkPhysicalDeviceExternalFenceInfo; + typedef struct VkPhysicalDeviceMultiviewProperties { VkStructureType sType; void * pNext; uint32_t maxMultiviewViewCount; uint32_t maxMultiviewInstanceIndex; } VkPhysicalDeviceMultiviewProperties; + typedef struct VkRenderPassMultiviewCreateInfo { VkStructureType sType; const void * pNext; @@ -1549,12 +2190,14 @@ typedef struct VkRenderPassMultiviewCreateInfo { uint32_t correlationMaskCount; const uint32_t * pCorrelationMasks; } VkRenderPassMultiviewCreateInfo; + typedef struct VkBindBufferMemoryDeviceGroupInfo { VkStructureType sType; const void * pNext; uint32_t deviceIndexCount; const uint32_t * pDeviceIndices; } VkBindBufferMemoryDeviceGroupInfo; + typedef struct VkBindImageMemoryDeviceGroupInfo { VkStructureType sType; const void * pNext; @@ -1563,6 +2206,7 @@ typedef struct VkBindImageMemoryDeviceGroupInfo { uint32_t splitInstanceBindRegionCount; const VkRect2D * pSplitInstanceBindRegions; } VkBindImageMemoryDeviceGroupInfo; + typedef struct VkDeviceGroupRenderPassBeginInfo { VkStructureType sType; const void * pNext; @@ -1570,11 +2214,13 @@ typedef struct VkDeviceGroupRenderPassBeginInfo { uint32_t deviceRenderAreaCount; const VkRect2D * pDeviceRenderAreas; } VkDeviceGroupRenderPassBeginInfo; + typedef struct VkDeviceGroupCommandBufferBeginInfo { VkStructureType sType; const void * pNext; uint32_t deviceMask; } VkDeviceGroupCommandBufferBeginInfo; + typedef struct VkDeviceGroupSubmitInfo { VkStructureType sType; const void * pNext; @@ -1585,23 +2231,27 @@ typedef struct VkDeviceGroupSubmitInfo { uint32_t signalSemaphoreCount; const uint32_t * pSignalSemaphoreDeviceIndices; } VkDeviceGroupSubmitInfo; + typedef struct VkDeviceGroupBindSparseInfo { VkStructureType sType; const void * pNext; uint32_t resourceDeviceIndex; uint32_t memoryDeviceIndex; } VkDeviceGroupBindSparseInfo; + typedef struct VkImageSwapchainCreateInfoKHR { VkStructureType sType; const void * pNext; VkSwapchainKHR swapchain; } VkImageSwapchainCreateInfoKHR; + typedef struct VkBindImageMemorySwapchainInfoKHR { VkStructureType sType; const void * pNext; VkSwapchainKHR swapchain; uint32_t imageIndex; } VkBindImageMemorySwapchainInfoKHR; + typedef struct VkAcquireNextImageInfoKHR { VkStructureType sType; const void * pNext; @@ -1611,6 +2261,7 @@ typedef struct VkAcquireNextImageInfoKHR { VkFence fence; uint32_t deviceMask; } VkAcquireNextImageInfoKHR; + typedef struct VkDeviceGroupPresentInfoKHR { VkStructureType sType; const void * pNext; @@ -1618,12 +2269,14 @@ typedef struct VkDeviceGroupPresentInfoKHR { const uint32_t * pDeviceMasks; VkDeviceGroupPresentModeFlagBitsKHR mode; } VkDeviceGroupPresentInfoKHR; + typedef struct VkDeviceGroupDeviceCreateInfo { VkStructureType sType; const void * pNext; uint32_t physicalDeviceCount; const VkPhysicalDevice * pPhysicalDevices; } VkDeviceGroupDeviceCreateInfo; + typedef struct VkDescriptorUpdateTemplateEntry { uint32_t dstBinding; uint32_t dstArrayElement; @@ -1632,61 +2285,243 @@ typedef struct VkDescriptorUpdateTemplateEntry { size_t offset; size_t stride; } VkDescriptorUpdateTemplateEntry; + typedef struct VkBufferMemoryRequirementsInfo2 { VkStructureType sType; const void * pNext; VkBuffer buffer; } VkBufferMemoryRequirementsInfo2; + typedef struct VkImageMemoryRequirementsInfo2 { VkStructureType sType; const void * pNext; VkImage image; } VkImageMemoryRequirementsInfo2; + typedef struct VkImageSparseMemoryRequirementsInfo2 { VkStructureType sType; const void * pNext; VkImage image; } VkImageSparseMemoryRequirementsInfo2; + typedef struct VkPhysicalDevicePointClippingProperties { VkStructureType sType; void * pNext; - VkPointClippingBehavior pointClippingBehavior; + VkPointClippingBehavior pointClippingBehavior; } VkPhysicalDevicePointClippingProperties; + typedef struct VkMemoryDedicatedAllocateInfo { VkStructureType sType; const void * pNext; VkImage image; VkBuffer buffer; } VkMemoryDedicatedAllocateInfo; + typedef struct VkPipelineTessellationDomainOriginStateCreateInfo { VkStructureType sType; const void * pNext; VkTessellationDomainOrigin domainOrigin; } VkPipelineTessellationDomainOriginStateCreateInfo; + typedef struct VkSamplerYcbcrConversionInfo { VkStructureType sType; const void * pNext; VkSamplerYcbcrConversion conversion; } VkSamplerYcbcrConversionInfo; + typedef struct VkBindImagePlaneMemoryInfo { VkStructureType sType; const void * pNext; VkImageAspectFlagBits planeAspect; } VkBindImagePlaneMemoryInfo; + typedef struct VkImagePlaneMemoryRequirementsInfo { VkStructureType sType; const void * pNext; VkImageAspectFlagBits planeAspect; } VkImagePlaneMemoryRequirementsInfo; + typedef struct VkSamplerYcbcrConversionImageFormatProperties { VkStructureType sType; void * pNext; uint32_t combinedImageSamplerDescriptorCount; } VkSamplerYcbcrConversionImageFormatProperties; + +typedef struct VkSamplerReductionModeCreateInfo { + VkStructureType sType; + const void * pNext; + VkSamplerReductionMode reductionMode; +} VkSamplerReductionModeCreateInfo; + +typedef struct VkPhysicalDeviceInlineUniformBlockProperties { + VkStructureType sType; + void * pNext; + uint32_t maxInlineUniformBlockSize; + uint32_t maxPerStageDescriptorInlineUniformBlocks; + uint32_t maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks; + uint32_t maxDescriptorSetInlineUniformBlocks; + uint32_t maxDescriptorSetUpdateAfterBindInlineUniformBlocks; +} VkPhysicalDeviceInlineUniformBlockProperties; + +typedef struct VkWriteDescriptorSetInlineUniformBlock { + VkStructureType sType; + const void * pNext; + uint32_t dataSize; + const void * pData; +} VkWriteDescriptorSetInlineUniformBlock; + +typedef struct VkDescriptorPoolInlineUniformBlockCreateInfo { + VkStructureType sType; + const void * pNext; + uint32_t maxInlineUniformBlockBindings; +} VkDescriptorPoolInlineUniformBlockCreateInfo; + +typedef struct VkImageFormatListCreateInfo { + VkStructureType sType; + const void * pNext; + uint32_t viewFormatCount; + const VkFormat * pViewFormats; +} VkImageFormatListCreateInfo; + +typedef struct VkDescriptorSetVariableDescriptorCountAllocateInfo { + VkStructureType sType; + const void * pNext; + uint32_t descriptorSetCount; + const uint32_t * pDescriptorCounts; +} VkDescriptorSetVariableDescriptorCountAllocateInfo; + +typedef struct VkDescriptorSetVariableDescriptorCountLayoutSupport { + VkStructureType sType; + void * pNext; + uint32_t maxVariableDescriptorCount; +} VkDescriptorSetVariableDescriptorCountLayoutSupport; + +typedef struct VkSubpassBeginInfo { + VkStructureType sType; + const void * pNext; + VkSubpassContents contents; +} VkSubpassBeginInfo; + +typedef struct VkSubpassEndInfo { + VkStructureType sType; + const void * pNext; +} VkSubpassEndInfo; + +typedef struct VkPhysicalDeviceTimelineSemaphoreProperties { + VkStructureType sType; + void * pNext; + uint64_t maxTimelineSemaphoreValueDifference; +} VkPhysicalDeviceTimelineSemaphoreProperties; + +typedef struct VkSemaphoreTypeCreateInfo { + VkStructureType sType; + const void * pNext; + VkSemaphoreType semaphoreType; + uint64_t initialValue; +} VkSemaphoreTypeCreateInfo; + +typedef struct VkTimelineSemaphoreSubmitInfo { + VkStructureType sType; + const void * pNext; + uint32_t waitSemaphoreValueCount; + const uint64_t * pWaitSemaphoreValues; + uint32_t signalSemaphoreValueCount; + const uint64_t * pSignalSemaphoreValues; +} VkTimelineSemaphoreSubmitInfo; + +typedef struct VkSemaphoreSignalInfo { + VkStructureType sType; + const void * pNext; + VkSemaphore semaphore; + uint64_t value; +} VkSemaphoreSignalInfo; + +typedef struct VkBufferDeviceAddressInfo { + VkStructureType sType; + const void * pNext; + VkBuffer buffer; +} VkBufferDeviceAddressInfo; + +typedef struct VkBufferOpaqueCaptureAddressCreateInfo { + VkStructureType sType; + const void * pNext; + uint64_t opaqueCaptureAddress; +} VkBufferOpaqueCaptureAddressCreateInfo; + +typedef struct VkRenderPassAttachmentBeginInfo { + VkStructureType sType; + const void * pNext; + uint32_t attachmentCount; + const VkImageView * pAttachments; +} VkRenderPassAttachmentBeginInfo; + +typedef struct VkAttachmentReferenceStencilLayout { + VkStructureType sType; + void * pNext; + VkImageLayout stencilLayout; +} VkAttachmentReferenceStencilLayout; + +typedef struct VkAttachmentDescriptionStencilLayout { + VkStructureType sType; + void * pNext; + VkImageLayout stencilInitialLayout; + VkImageLayout stencilFinalLayout; +} VkAttachmentDescriptionStencilLayout; + +typedef struct VkPipelineShaderStageRequiredSubgroupSizeCreateInfo { + VkStructureType sType; + void * pNext; + uint32_t requiredSubgroupSize; +} VkPipelineShaderStageRequiredSubgroupSizeCreateInfo; + +typedef struct VkMemoryOpaqueCaptureAddressAllocateInfo { + VkStructureType sType; + const void * pNext; + uint64_t opaqueCaptureAddress; +} VkMemoryOpaqueCaptureAddressAllocateInfo; + +typedef struct VkDeviceMemoryOpaqueCaptureAddressInfo { + VkStructureType sType; + const void * pNext; + VkDeviceMemory memory; +} VkDeviceMemoryOpaqueCaptureAddressInfo; + +typedef struct VkCommandBufferSubmitInfo { + VkStructureType sType; + const void * pNext; + VkCommandBuffer commandBuffer; + uint32_t deviceMask; +} VkCommandBufferSubmitInfo; + +typedef struct VkPipelineRenderingCreateInfo { + VkStructureType sType; + const void * pNext; + uint32_t viewMask; + uint32_t colorAttachmentCount; + const VkFormat * pColorAttachmentFormats; + VkFormat depthAttachmentFormat; + VkFormat stencilAttachmentFormat; +} VkPipelineRenderingCreateInfo; + +typedef struct VkRenderingAttachmentInfo { + VkStructureType sType; + const void * pNext; + VkImageView imageView; + VkImageLayout imageLayout; + VkResolveModeFlagBits resolveMode; + VkImageView resolveImageView; + VkImageLayout resolveImageLayout; + VkAttachmentLoadOp loadOp; + VkAttachmentStoreOp storeOp; + VkClearValue clearValue; +} VkRenderingAttachmentInfo; + typedef uint32_t VkSampleMask; typedef uint32_t VkBool32; typedef uint32_t VkFlags; +typedef uint64_t VkFlags64; typedef uint64_t VkDeviceSize; +typedef uint64_t VkDeviceAddress; typedef VkFlags VkFramebufferCreateFlags; typedef VkFlags VkQueryPoolCreateFlags; typedef VkFlags VkRenderPassCreateFlags; @@ -1746,7 +2581,14 @@ typedef VkFlags VkDescriptorPoolCreateFlags; typedef VkFlags VkDescriptorPoolResetFlags; typedef VkFlags VkDependencyFlags; typedef VkFlags VkSubgroupFeatureFlags; +typedef VkFlags VkPrivateDataSlotCreateFlags; typedef VkFlags VkDescriptorUpdateTemplateCreateFlags; +typedef VkFlags VkPipelineCreationFeedbackFlags; +typedef VkFlags VkSemaphoreWaitFlags; +typedef VkFlags64 VkAccessFlags2; +typedef VkFlags64 VkPipelineStageFlags2; +typedef VkFlags64 VkFormatFeatureFlags2; +typedef VkFlags VkRenderingFlags; typedef VkFlags VkCompositeAlphaFlagsKHR; typedef VkFlags VkSurfaceTransformFlagsKHR; typedef VkFlags VkSwapchainCreateFlagsKHR; @@ -1763,6 +2605,10 @@ typedef VkFlags VkSemaphoreImportFlags; typedef VkFlags VkExternalFenceHandleTypeFlags; typedef VkFlags VkExternalFenceFeatureFlags; typedef VkFlags VkFenceImportFlags; +typedef VkFlags VkDescriptorBindingFlags; +typedef VkFlags VkResolveModeFlags; +typedef VkFlags VkToolPurposeFlags; +typedef VkFlags VkSubmitFlags; typedef VkBool32 (VKAPI_PTR *PFN_vkDebugReportCallbackEXT)( VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, @@ -1780,6 +2626,7 @@ typedef struct VkDeviceQueueCreateInfo { uint32_t queueCount; const float * pQueuePriorities; } VkDeviceQueueCreateInfo; + typedef struct VkInstanceCreateInfo { VkStructureType sType; const void * pNext; @@ -1790,28 +2637,33 @@ typedef struct VkInstanceCreateInfo { uint32_t enabledExtensionCount; const char * const* ppEnabledExtensionNames; } VkInstanceCreateInfo; + typedef struct VkQueueFamilyProperties { VkQueueFlags queueFlags; uint32_t queueCount; uint32_t timestampValidBits; VkExtent3D minImageTransferGranularity; } VkQueueFamilyProperties; + typedef struct VkMemoryAllocateInfo { VkStructureType sType; const void * pNext; VkDeviceSize allocationSize; uint32_t memoryTypeIndex; } VkMemoryAllocateInfo; + typedef struct VkMemoryRequirements { VkDeviceSize size; VkDeviceSize alignment; uint32_t memoryTypeBits; } VkMemoryRequirements; + typedef struct VkSparseImageFormatProperties { - VkImageAspectFlags aspectMask; - VkExtent3D imageGranularity; + VkImageAspectFlags aspectMask; + VkExtent3D imageGranularity; VkSparseImageFormatFlags flags; } VkSparseImageFormatProperties; + typedef struct VkSparseImageMemoryRequirements { VkSparseImageFormatProperties formatProperties; uint32_t imageMipTailFirstLod; @@ -1819,14 +2671,17 @@ typedef struct VkSparseImageMemoryRequirements { VkDeviceSize imageMipTailOffset; VkDeviceSize imageMipTailStride; } VkSparseImageMemoryRequirements; + typedef struct VkMemoryType { VkMemoryPropertyFlags propertyFlags; uint32_t heapIndex; } VkMemoryType; + typedef struct VkMemoryHeap { VkDeviceSize size; VkMemoryHeapFlags flags; } VkMemoryHeap; + typedef struct VkMappedMemoryRange { VkStructureType sType; const void * pNext; @@ -1834,11 +2689,13 @@ typedef struct VkMappedMemoryRange { VkDeviceSize offset; VkDeviceSize size; } VkMappedMemoryRange; + typedef struct VkFormatProperties { VkFormatFeatureFlags linearTilingFeatures; VkFormatFeatureFlags optimalTilingFeatures; VkFormatFeatureFlags bufferFeatures; } VkFormatProperties; + typedef struct VkImageFormatProperties { VkExtent3D maxExtent; uint32_t maxMipLevels; @@ -1846,11 +2703,13 @@ typedef struct VkImageFormatProperties { VkSampleCountFlags sampleCounts; VkDeviceSize maxResourceSize; } VkImageFormatProperties; + typedef struct VkDescriptorBufferInfo { VkBuffer buffer; VkDeviceSize offset; VkDeviceSize range; } VkDescriptorBufferInfo; + typedef struct VkWriteDescriptorSet { VkStructureType sType; const void * pNext; @@ -1863,6 +2722,7 @@ typedef struct VkWriteDescriptorSet { const VkDescriptorBufferInfo * pBufferInfo; const VkBufferView * pTexelBufferView; } VkWriteDescriptorSet; + typedef struct VkBufferCreateInfo { VkStructureType sType; const void * pNext; @@ -1873,6 +2733,7 @@ typedef struct VkBufferCreateInfo { uint32_t queueFamilyIndexCount; const uint32_t * pQueueFamilyIndices; } VkBufferCreateInfo; + typedef struct VkBufferViewCreateInfo { VkStructureType sType; const void * pNext; @@ -1882,17 +2743,20 @@ typedef struct VkBufferViewCreateInfo { VkDeviceSize offset; VkDeviceSize range; } VkBufferViewCreateInfo; + typedef struct VkImageSubresource { VkImageAspectFlags aspectMask; uint32_t mipLevel; uint32_t arrayLayer; } VkImageSubresource; + typedef struct VkImageSubresourceLayers { VkImageAspectFlags aspectMask; uint32_t mipLevel; uint32_t baseArrayLayer; uint32_t layerCount; } VkImageSubresourceLayers; + typedef struct VkImageSubresourceRange { VkImageAspectFlags aspectMask; uint32_t baseMipLevel; @@ -1900,12 +2764,14 @@ typedef struct VkImageSubresourceRange { uint32_t baseArrayLayer; uint32_t layerCount; } VkImageSubresourceRange; + typedef struct VkMemoryBarrier { VkStructureType sType; const void * pNext; VkAccessFlags srcAccessMask; VkAccessFlags dstAccessMask; } VkMemoryBarrier; + typedef struct VkBufferMemoryBarrier { VkStructureType sType; const void * pNext; @@ -1917,6 +2783,7 @@ typedef struct VkBufferMemoryBarrier { VkDeviceSize offset; VkDeviceSize size; } VkBufferMemoryBarrier; + typedef struct VkImageMemoryBarrier { VkStructureType sType; const void * pNext; @@ -1929,6 +2796,7 @@ typedef struct VkImageMemoryBarrier { VkImage image; VkImageSubresourceRange subresourceRange; } VkImageMemoryBarrier; + typedef struct VkImageCreateInfo { VkStructureType sType; const void * pNext; @@ -1946,6 +2814,7 @@ typedef struct VkImageCreateInfo { const uint32_t * pQueueFamilyIndices; VkImageLayout initialLayout; } VkImageCreateInfo; + typedef struct VkSubresourceLayout { VkDeviceSize offset; VkDeviceSize size; @@ -1953,6 +2822,7 @@ typedef struct VkSubresourceLayout { VkDeviceSize arrayPitch; VkDeviceSize depthPitch; } VkSubresourceLayout; + typedef struct VkImageViewCreateInfo { VkStructureType sType; const void * pNext; @@ -1963,11 +2833,13 @@ typedef struct VkImageViewCreateInfo { VkComponentMapping components; VkImageSubresourceRange subresourceRange; } VkImageViewCreateInfo; + typedef struct VkBufferCopy { VkDeviceSize srcOffset; VkDeviceSize dstOffset; VkDeviceSize size; } VkBufferCopy; + typedef struct VkSparseMemoryBind { VkDeviceSize resourceOffset; VkDeviceSize size; @@ -1975,6 +2847,7 @@ typedef struct VkSparseMemoryBind { VkDeviceSize memoryOffset; VkSparseMemoryBindFlags flags; } VkSparseMemoryBind; + typedef struct VkSparseImageMemoryBind { VkImageSubresource subresource; VkOffset3D offset; @@ -1983,21 +2856,25 @@ typedef struct VkSparseImageMemoryBind { VkDeviceSize memoryOffset; VkSparseMemoryBindFlags flags; } VkSparseImageMemoryBind; + typedef struct VkSparseBufferMemoryBindInfo { VkBuffer buffer; uint32_t bindCount; const VkSparseMemoryBind * pBinds; } VkSparseBufferMemoryBindInfo; + typedef struct VkSparseImageOpaqueMemoryBindInfo { VkImage image; uint32_t bindCount; const VkSparseMemoryBind * pBinds; } VkSparseImageOpaqueMemoryBindInfo; + typedef struct VkSparseImageMemoryBindInfo { VkImage image; uint32_t bindCount; const VkSparseImageMemoryBind * pBinds; } VkSparseImageMemoryBindInfo; + typedef struct VkBindSparseInfo { VkStructureType sType; const void * pNext; @@ -2012,6 +2889,7 @@ typedef struct VkBindSparseInfo { uint32_t signalSemaphoreCount; const VkSemaphore * pSignalSemaphores; } VkBindSparseInfo; + typedef struct VkImageCopy { VkImageSubresourceLayers srcSubresource; VkOffset3D srcOffset; @@ -2019,12 +2897,14 @@ typedef struct VkImageCopy { VkOffset3D dstOffset; VkExtent3D extent; } VkImageCopy; + typedef struct VkImageBlit { VkImageSubresourceLayers srcSubresource; VkOffset3D srcOffsets [2]; VkImageSubresourceLayers dstSubresource; VkOffset3D dstOffsets [2]; } VkImageBlit; + typedef struct VkBufferImageCopy { VkDeviceSize bufferOffset; uint32_t bufferRowLength; @@ -2033,6 +2913,7 @@ typedef struct VkBufferImageCopy { VkOffset3D imageOffset; VkExtent3D imageExtent; } VkBufferImageCopy; + typedef struct VkImageResolve { VkImageSubresourceLayers srcSubresource; VkOffset3D srcOffset; @@ -2040,6 +2921,7 @@ typedef struct VkImageResolve { VkOffset3D dstOffset; VkExtent3D extent; } VkImageResolve; + typedef struct VkShaderModuleCreateInfo { VkStructureType sType; const void * pNext; @@ -2047,6 +2929,7 @@ typedef struct VkShaderModuleCreateInfo { size_t codeSize; const uint32_t * pCode; } VkShaderModuleCreateInfo; + typedef struct VkDescriptorSetLayoutBinding { uint32_t binding; VkDescriptorType descriptorType; @@ -2054,6 +2937,7 @@ typedef struct VkDescriptorSetLayoutBinding { VkShaderStageFlags stageFlags; const VkSampler * pImmutableSamplers; } VkDescriptorSetLayoutBinding; + typedef struct VkDescriptorSetLayoutCreateInfo { VkStructureType sType; const void * pNext; @@ -2061,6 +2945,7 @@ typedef struct VkDescriptorSetLayoutCreateInfo { uint32_t bindingCount; const VkDescriptorSetLayoutBinding * pBindings; } VkDescriptorSetLayoutCreateInfo; + typedef struct VkDescriptorPoolCreateInfo { VkStructureType sType; const void * pNext; @@ -2069,6 +2954,7 @@ typedef struct VkDescriptorPoolCreateInfo { uint32_t poolSizeCount; const VkDescriptorPoolSize * pPoolSizes; } VkDescriptorPoolCreateInfo; + typedef struct VkPipelineShaderStageCreateInfo { VkStructureType sType; const void * pNext; @@ -2078,6 +2964,7 @@ typedef struct VkPipelineShaderStageCreateInfo { const char * pName; const VkSpecializationInfo * pSpecializationInfo; } VkPipelineShaderStageCreateInfo; + typedef struct VkComputePipelineCreateInfo { VkStructureType sType; const void * pNext; @@ -2087,6 +2974,7 @@ typedef struct VkComputePipelineCreateInfo { VkPipeline basePipelineHandle; int32_t basePipelineIndex; } VkComputePipelineCreateInfo; + typedef struct VkPipelineVertexInputStateCreateInfo { VkStructureType sType; const void * pNext; @@ -2096,6 +2984,7 @@ typedef struct VkPipelineVertexInputStateCreateInfo { uint32_t vertexAttributeDescriptionCount; const VkVertexInputAttributeDescription * pVertexAttributeDescriptions; } VkPipelineVertexInputStateCreateInfo; + typedef struct VkPipelineInputAssemblyStateCreateInfo { VkStructureType sType; const void * pNext; @@ -2103,12 +2992,14 @@ typedef struct VkPipelineInputAssemblyStateCreateInfo { VkPrimitiveTopology topology; VkBool32 primitiveRestartEnable; } VkPipelineInputAssemblyStateCreateInfo; + typedef struct VkPipelineTessellationStateCreateInfo { VkStructureType sType; const void * pNext; VkPipelineTessellationStateCreateFlags flags; uint32_t patchControlPoints; } VkPipelineTessellationStateCreateInfo; + typedef struct VkPipelineViewportStateCreateInfo { VkStructureType sType; const void * pNext; @@ -2118,6 +3009,7 @@ typedef struct VkPipelineViewportStateCreateInfo { uint32_t scissorCount; const VkRect2D * pScissors; } VkPipelineViewportStateCreateInfo; + typedef struct VkPipelineRasterizationStateCreateInfo { VkStructureType sType; const void * pNext; @@ -2133,6 +3025,7 @@ typedef struct VkPipelineRasterizationStateCreateInfo { float depthBiasSlopeFactor; float lineWidth; } VkPipelineRasterizationStateCreateInfo; + typedef struct VkPipelineMultisampleStateCreateInfo { VkStructureType sType; const void * pNext; @@ -2144,6 +3037,7 @@ typedef struct VkPipelineMultisampleStateCreateInfo { VkBool32 alphaToCoverageEnable; VkBool32 alphaToOneEnable; } VkPipelineMultisampleStateCreateInfo; + typedef struct VkPipelineColorBlendAttachmentState { VkBool32 blendEnable; VkBlendFactor srcColorBlendFactor; @@ -2154,6 +3048,7 @@ typedef struct VkPipelineColorBlendAttachmentState { VkBlendOp alphaBlendOp; VkColorComponentFlags colorWriteMask; } VkPipelineColorBlendAttachmentState; + typedef struct VkPipelineColorBlendStateCreateInfo { VkStructureType sType; const void * pNext; @@ -2164,6 +3059,7 @@ typedef struct VkPipelineColorBlendStateCreateInfo { const VkPipelineColorBlendAttachmentState * pAttachments; float blendConstants [4]; } VkPipelineColorBlendStateCreateInfo; + typedef struct VkPipelineDynamicStateCreateInfo { VkStructureType sType; const void * pNext; @@ -2171,6 +3067,7 @@ typedef struct VkPipelineDynamicStateCreateInfo { uint32_t dynamicStateCount; const VkDynamicState * pDynamicStates; } VkPipelineDynamicStateCreateInfo; + typedef struct VkPipelineDepthStencilStateCreateInfo { VkStructureType sType; const void * pNext; @@ -2185,6 +3082,7 @@ typedef struct VkPipelineDepthStencilStateCreateInfo { float minDepthBounds; float maxDepthBounds; } VkPipelineDepthStencilStateCreateInfo; + typedef struct VkGraphicsPipelineCreateInfo { VkStructureType sType; const void * pNext; @@ -2206,6 +3104,7 @@ typedef struct VkGraphicsPipelineCreateInfo { VkPipeline basePipelineHandle; int32_t basePipelineIndex; } VkGraphicsPipelineCreateInfo; + typedef struct VkPipelineCacheCreateInfo { VkStructureType sType; const void * pNext; @@ -2213,11 +3112,13 @@ typedef struct VkPipelineCacheCreateInfo { size_t initialDataSize; const void * pInitialData; } VkPipelineCacheCreateInfo; + typedef struct VkPushConstantRange { VkShaderStageFlags stageFlags; uint32_t offset; uint32_t size; } VkPushConstantRange; + typedef struct VkPipelineLayoutCreateInfo { VkStructureType sType; const void * pNext; @@ -2227,6 +3128,7 @@ typedef struct VkPipelineLayoutCreateInfo { uint32_t pushConstantRangeCount; const VkPushConstantRange * pPushConstantRanges; } VkPipelineLayoutCreateInfo; + typedef struct VkSamplerCreateInfo { VkStructureType sType; const void * pNext; @@ -2247,12 +3149,14 @@ typedef struct VkSamplerCreateInfo { VkBorderColor borderColor; VkBool32 unnormalizedCoordinates; } VkSamplerCreateInfo; + typedef struct VkCommandPoolCreateInfo { VkStructureType sType; const void * pNext; VkCommandPoolCreateFlags flags; uint32_t queueFamilyIndex; } VkCommandPoolCreateInfo; + typedef struct VkCommandBufferInheritanceInfo { VkStructureType sType; const void * pNext; @@ -2263,12 +3167,14 @@ typedef struct VkCommandBufferInheritanceInfo { VkQueryControlFlags queryFlags; VkQueryPipelineStatisticFlags pipelineStatistics; } VkCommandBufferInheritanceInfo; + typedef struct VkCommandBufferBeginInfo { VkStructureType sType; const void * pNext; VkCommandBufferUsageFlags flags; const VkCommandBufferInheritanceInfo * pInheritanceInfo; } VkCommandBufferBeginInfo; + typedef struct VkRenderPassBeginInfo { VkStructureType sType; const void * pNext; @@ -2278,11 +3184,13 @@ typedef struct VkRenderPassBeginInfo { uint32_t clearValueCount; const VkClearValue * pClearValues; } VkRenderPassBeginInfo; + typedef struct VkClearAttachment { VkImageAspectFlags aspectMask; uint32_t colorAttachment; VkClearValue clearValue; } VkClearAttachment; + typedef struct VkAttachmentDescription { VkAttachmentDescriptionFlags flags; VkFormat format; @@ -2294,6 +3202,7 @@ typedef struct VkAttachmentDescription { VkImageLayout initialLayout; VkImageLayout finalLayout; } VkAttachmentDescription; + typedef struct VkSubpassDescription { VkSubpassDescriptionFlags flags; VkPipelineBindPoint pipelineBindPoint; @@ -2306,6 +3215,7 @@ typedef struct VkSubpassDescription { uint32_t preserveAttachmentCount; const uint32_t * pPreserveAttachments; } VkSubpassDescription; + typedef struct VkSubpassDependency { uint32_t srcSubpass; uint32_t dstSubpass; @@ -2315,10 +3225,11 @@ typedef struct VkSubpassDependency { VkAccessFlags dstAccessMask; VkDependencyFlags dependencyFlags; } VkSubpassDependency; + typedef struct VkRenderPassCreateInfo { VkStructureType sType; const void * pNext; - VkRenderPassCreateFlags flags; + VkRenderPassCreateFlags flags; uint32_t attachmentCount; const VkAttachmentDescription * pAttachments; uint32_t subpassCount; @@ -2326,16 +3237,19 @@ typedef struct VkRenderPassCreateInfo { uint32_t dependencyCount; const VkSubpassDependency * pDependencies; } VkRenderPassCreateInfo; + typedef struct VkEventCreateInfo { VkStructureType sType; const void * pNext; VkEventCreateFlags flags; } VkEventCreateInfo; + typedef struct VkFenceCreateInfo { VkStructureType sType; const void * pNext; VkFenceCreateFlags flags; } VkFenceCreateInfo; + typedef struct VkPhysicalDeviceFeatures { VkBool32 robustBufferAccess; VkBool32 fullDrawIndexUint32; @@ -2393,13 +3307,15 @@ typedef struct VkPhysicalDeviceFeatures { VkBool32 variableMultisampleRate; VkBool32 inheritedQueries; } VkPhysicalDeviceFeatures; + typedef struct VkPhysicalDeviceSparseProperties { - VkBool32 residencyStandard2DBlockShape; - VkBool32 residencyStandard2DMultisampleBlockShape; - VkBool32 residencyStandard3DBlockShape; - VkBool32 residencyAlignedMipSize; - VkBool32 residencyNonResidentStrict; + VkBool32 residencyStandard2DBlockShape; + VkBool32 residencyStandard2DMultisampleBlockShape; + VkBool32 residencyStandard3DBlockShape; + VkBool32 residencyAlignedMipSize; + VkBool32 residencyNonResidentStrict; } VkPhysicalDeviceSparseProperties; + typedef struct VkPhysicalDeviceLimits { uint32_t maxImageDimension1D; uint32_t maxImageDimension2D; @@ -2456,28 +3372,28 @@ typedef struct VkPhysicalDeviceLimits { uint32_t maxComputeWorkGroupCount [3]; uint32_t maxComputeWorkGroupInvocations; uint32_t maxComputeWorkGroupSize [3]; - uint32_t subPixelPrecisionBits; - uint32_t subTexelPrecisionBits; - uint32_t mipmapPrecisionBits; + uint32_t subPixelPrecisionBits; + uint32_t subTexelPrecisionBits; + uint32_t mipmapPrecisionBits; uint32_t maxDrawIndexedIndexValue; uint32_t maxDrawIndirectCount; float maxSamplerLodBias; float maxSamplerAnisotropy; uint32_t maxViewports; uint32_t maxViewportDimensions [2]; - float viewportBoundsRange [2]; - uint32_t viewportSubPixelBits; - size_t minMemoryMapAlignment; - VkDeviceSize minTexelBufferOffsetAlignment; - VkDeviceSize minUniformBufferOffsetAlignment; - VkDeviceSize minStorageBufferOffsetAlignment; + float viewportBoundsRange [2]; + uint32_t viewportSubPixelBits; + size_t minMemoryMapAlignment; + VkDeviceSize minTexelBufferOffsetAlignment; + VkDeviceSize minUniformBufferOffsetAlignment; + VkDeviceSize minStorageBufferOffsetAlignment; int32_t minTexelOffset; uint32_t maxTexelOffset; int32_t minTexelGatherOffset; uint32_t maxTexelGatherOffset; float minInterpolationOffset; float maxInterpolationOffset; - uint32_t subPixelInterpolationOffsetBits; + uint32_t subPixelInterpolationOffsetBits; uint32_t maxFramebufferWidth; uint32_t maxFramebufferHeight; uint32_t maxFramebufferLayers; @@ -2492,27 +3408,29 @@ typedef struct VkPhysicalDeviceLimits { VkSampleCountFlags sampledImageStencilSampleCounts; VkSampleCountFlags storageImageSampleCounts; uint32_t maxSampleMaskWords; - VkBool32 timestampComputeAndGraphics; - float timestampPeriod; + VkBool32 timestampComputeAndGraphics; + float timestampPeriod; uint32_t maxClipDistances; uint32_t maxCullDistances; uint32_t maxCombinedClipAndCullDistances; uint32_t discreteQueuePriorities; - float pointSizeRange [2]; - float lineWidthRange [2]; - float pointSizeGranularity; - float lineWidthGranularity; - VkBool32 strictLines; - VkBool32 standardSampleLocations; - VkDeviceSize optimalBufferCopyOffsetAlignment; - VkDeviceSize optimalBufferCopyRowPitchAlignment; - VkDeviceSize nonCoherentAtomSize; + float pointSizeRange [2]; + float lineWidthRange [2]; + float pointSizeGranularity; + float lineWidthGranularity; + VkBool32 strictLines; + VkBool32 standardSampleLocations; + VkDeviceSize optimalBufferCopyOffsetAlignment; + VkDeviceSize optimalBufferCopyRowPitchAlignment; + VkDeviceSize nonCoherentAtomSize; } VkPhysicalDeviceLimits; + typedef struct VkSemaphoreCreateInfo { VkStructureType sType; const void * pNext; VkSemaphoreCreateFlags flags; } VkSemaphoreCreateInfo; + typedef struct VkQueryPoolCreateInfo { VkStructureType sType; const void * pNext; @@ -2521,17 +3439,19 @@ typedef struct VkQueryPoolCreateInfo { uint32_t queryCount; VkQueryPipelineStatisticFlags pipelineStatistics; } VkQueryPoolCreateInfo; + typedef struct VkFramebufferCreateInfo { VkStructureType sType; const void * pNext; VkFramebufferCreateFlags flags; - VkRenderPass renderPass; + VkRenderPass renderPass; uint32_t attachmentCount; const VkImageView * pAttachments; uint32_t width; uint32_t height; uint32_t layers; } VkFramebufferCreateInfo; + typedef struct VkSubmitInfo { VkStructureType sType; const void * pNext; @@ -2543,6 +3463,7 @@ typedef struct VkSubmitInfo { uint32_t signalSemaphoreCount; const VkSemaphore * pSignalSemaphores; } VkSubmitInfo; + typedef struct VkSurfaceCapabilitiesKHR { uint32_t minImageCount; uint32_t maxImageCount; @@ -2555,6 +3476,7 @@ typedef struct VkSurfaceCapabilitiesKHR { VkCompositeAlphaFlagsKHR supportedCompositeAlpha; VkImageUsageFlags supportedUsageFlags; } VkSurfaceCapabilitiesKHR; + typedef struct VkSwapchainCreateInfoKHR { VkStructureType sType; const void * pNext; @@ -2575,6 +3497,7 @@ typedef struct VkSwapchainCreateInfoKHR { VkBool32 clipped; VkSwapchainKHR oldSwapchain; } VkSwapchainCreateInfoKHR; + typedef struct VkDebugReportCallbackCreateInfoEXT { VkStructureType sType; const void * pNext; @@ -2582,21 +3505,37 @@ typedef struct VkDebugReportCallbackCreateInfoEXT { PFN_vkDebugReportCallbackEXT pfnCallback; void * pUserData; } VkDebugReportCallbackCreateInfoEXT; + +typedef struct VkPrivateDataSlotCreateInfo { + VkStructureType sType; + const void * pNext; + VkPrivateDataSlotCreateFlags flags; +} VkPrivateDataSlotCreateInfo; + +typedef struct VkPhysicalDevicePrivateDataFeatures { + VkStructureType sType; + void * pNext; + VkBool32 privateData; +} VkPhysicalDevicePrivateDataFeatures; + typedef struct VkPhysicalDeviceFeatures2 { VkStructureType sType; void * pNext; VkPhysicalDeviceFeatures features; } VkPhysicalDeviceFeatures2; + typedef struct VkFormatProperties2 { VkStructureType sType; void * pNext; VkFormatProperties formatProperties; } VkFormatProperties2; + typedef struct VkImageFormatProperties2 { VkStructureType sType; void * pNext; VkImageFormatProperties imageFormatProperties; } VkImageFormatProperties2; + typedef struct VkPhysicalDeviceImageFormatInfo2 { VkStructureType sType; const void * pNext; @@ -2606,16 +3545,19 @@ typedef struct VkPhysicalDeviceImageFormatInfo2 { VkImageUsageFlags usage; VkImageCreateFlags flags; } VkPhysicalDeviceImageFormatInfo2; + typedef struct VkQueueFamilyProperties2 { VkStructureType sType; void * pNext; - VkQueueFamilyProperties queueFamilyProperties; + VkQueueFamilyProperties queueFamilyProperties; } VkQueueFamilyProperties2; + typedef struct VkSparseImageFormatProperties2 { VkStructureType sType; void * pNext; - VkSparseImageFormatProperties properties; + VkSparseImageFormatProperties properties; } VkSparseImageFormatProperties2; + typedef struct VkPhysicalDeviceSparseImageFormatInfo2 { VkStructureType sType; const void * pNext; @@ -2625,23 +3567,28 @@ typedef struct VkPhysicalDeviceSparseImageFormatInfo2 { VkImageUsageFlags usage; VkImageTiling tiling; } VkPhysicalDeviceSparseImageFormatInfo2; + typedef struct VkPhysicalDeviceVariablePointersFeatures { VkStructureType sType; void * pNext; VkBool32 variablePointersStorageBuffer; VkBool32 variablePointers; } VkPhysicalDeviceVariablePointersFeatures; -typedef struct VkPhysicalDeviceVariablePointerFeatures VkPhysicalDeviceVariablePointerFeatures; + +typedef struct VkPhysicalDeviceVariablePointersFeatures VkPhysicalDeviceVariablePointerFeatures; + typedef struct VkExternalMemoryProperties { VkExternalMemoryFeatureFlags externalMemoryFeatures; VkExternalMemoryHandleTypeFlags exportFromImportedHandleTypes; VkExternalMemoryHandleTypeFlags compatibleHandleTypes; } VkExternalMemoryProperties; + typedef struct VkExternalImageFormatProperties { VkStructureType sType; void * pNext; VkExternalMemoryProperties externalMemoryProperties; } VkExternalImageFormatProperties; + typedef struct VkPhysicalDeviceExternalBufferInfo { VkStructureType sType; const void * pNext; @@ -2649,35 +3596,41 @@ typedef struct VkPhysicalDeviceExternalBufferInfo { VkBufferUsageFlags usage; VkExternalMemoryHandleTypeFlagBits handleType; } VkPhysicalDeviceExternalBufferInfo; + typedef struct VkExternalBufferProperties { VkStructureType sType; void * pNext; VkExternalMemoryProperties externalMemoryProperties; } VkExternalBufferProperties; + typedef struct VkPhysicalDeviceIDProperties { VkStructureType sType; void * pNext; - uint8_t deviceUUID [ VK_UUID_SIZE ]; - uint8_t driverUUID [ VK_UUID_SIZE ]; - uint8_t deviceLUID [ VK_LUID_SIZE ]; - uint32_t deviceNodeMask; - VkBool32 deviceLUIDValid; + uint8_t deviceUUID [ VK_UUID_SIZE ]; + uint8_t driverUUID [ VK_UUID_SIZE ]; + uint8_t deviceLUID [ VK_LUID_SIZE ]; + uint32_t deviceNodeMask; + VkBool32 deviceLUIDValid; } VkPhysicalDeviceIDProperties; + typedef struct VkExternalMemoryImageCreateInfo { VkStructureType sType; const void * pNext; VkExternalMemoryHandleTypeFlags handleTypes; } VkExternalMemoryImageCreateInfo; + typedef struct VkExternalMemoryBufferCreateInfo { VkStructureType sType; const void * pNext; VkExternalMemoryHandleTypeFlags handleTypes; } VkExternalMemoryBufferCreateInfo; + typedef struct VkExportMemoryAllocateInfo { VkStructureType sType; const void * pNext; VkExternalMemoryHandleTypeFlags handleTypes; } VkExportMemoryAllocateInfo; + typedef struct VkExternalSemaphoreProperties { VkStructureType sType; void * pNext; @@ -2685,11 +3638,13 @@ typedef struct VkExternalSemaphoreProperties { VkExternalSemaphoreHandleTypeFlags compatibleHandleTypes; VkExternalSemaphoreFeatureFlags externalSemaphoreFeatures; } VkExternalSemaphoreProperties; + typedef struct VkExportSemaphoreCreateInfo { VkStructureType sType; const void * pNext; VkExternalSemaphoreHandleTypeFlags handleTypes; } VkExportSemaphoreCreateInfo; + typedef struct VkExternalFenceProperties { VkStructureType sType; void * pNext; @@ -2697,11 +3652,13 @@ typedef struct VkExternalFenceProperties { VkExternalFenceHandleTypeFlags compatibleHandleTypes; VkExternalFenceFeatureFlags externalFenceFeatures; } VkExternalFenceProperties; + typedef struct VkExportFenceCreateInfo { VkStructureType sType; const void * pNext; VkExternalFenceHandleTypeFlags handleTypes; } VkExportFenceCreateInfo; + typedef struct VkPhysicalDeviceMultiviewFeatures { VkStructureType sType; void * pNext; @@ -2709,6 +3666,7 @@ typedef struct VkPhysicalDeviceMultiviewFeatures { VkBool32 multiviewGeometryShader; VkBool32 multiviewTessellationShader; } VkPhysicalDeviceMultiviewFeatures; + typedef struct VkPhysicalDeviceGroupProperties { VkStructureType sType; void * pNext; @@ -2716,12 +3674,14 @@ typedef struct VkPhysicalDeviceGroupProperties { VkPhysicalDevice physicalDevices [ VK_MAX_DEVICE_GROUP_SIZE ]; VkBool32 subsetAllocation; } VkPhysicalDeviceGroupProperties; + typedef struct VkMemoryAllocateFlagsInfo { VkStructureType sType; const void * pNext; VkMemoryAllocateFlags flags; uint32_t deviceMask; } VkMemoryAllocateFlagsInfo; + typedef struct VkBindBufferMemoryInfo { VkStructureType sType; const void * pNext; @@ -2729,6 +3689,7 @@ typedef struct VkBindBufferMemoryInfo { VkDeviceMemory memory; VkDeviceSize memoryOffset; } VkBindBufferMemoryInfo; + typedef struct VkBindImageMemoryInfo { VkStructureType sType; const void * pNext; @@ -2736,17 +3697,20 @@ typedef struct VkBindImageMemoryInfo { VkDeviceMemory memory; VkDeviceSize memoryOffset; } VkBindImageMemoryInfo; + typedef struct VkDeviceGroupPresentCapabilitiesKHR { VkStructureType sType; - const void * pNext; + void * pNext; uint32_t presentMask [ VK_MAX_DEVICE_GROUP_SIZE ]; VkDeviceGroupPresentModeFlagsKHR modes; } VkDeviceGroupPresentCapabilitiesKHR; + typedef struct VkDeviceGroupSwapchainCreateInfoKHR { VkStructureType sType; const void * pNext; VkDeviceGroupPresentModeFlagsKHR modes; } VkDeviceGroupSwapchainCreateInfoKHR; + typedef struct VkDescriptorUpdateTemplateCreateInfo { VkStructureType sType; const void * pNext; @@ -2759,17 +3723,20 @@ typedef struct VkDescriptorUpdateTemplateCreateInfo { VkPipelineLayout pipelineLayout; uint32_t set; } VkDescriptorUpdateTemplateCreateInfo; + typedef struct VkInputAttachmentAspectReference { uint32_t subpass; uint32_t inputAttachmentIndex; VkImageAspectFlags aspectMask; } VkInputAttachmentAspectReference; + typedef struct VkRenderPassInputAttachmentAspectCreateInfo { VkStructureType sType; const void * pNext; uint32_t aspectReferenceCount; const VkInputAttachmentAspectReference * pAspectReferences; } VkRenderPassInputAttachmentAspectCreateInfo; + typedef struct VkPhysicalDevice16BitStorageFeatures { VkStructureType sType; void * pNext; @@ -2778,36 +3745,60 @@ typedef struct VkPhysicalDevice16BitStorageFeatures { VkBool32 storagePushConstant16; VkBool32 storageInputOutput16; } VkPhysicalDevice16BitStorageFeatures; + typedef struct VkPhysicalDeviceSubgroupProperties { VkStructureType sType; void * pNext; - uint32_t subgroupSize; + uint32_t subgroupSize; VkShaderStageFlags supportedStages; VkSubgroupFeatureFlags supportedOperations; VkBool32 quadOperationsInAllStages; } VkPhysicalDeviceSubgroupProperties; + +typedef struct VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures { + VkStructureType sType; + void * pNext; + VkBool32 shaderSubgroupExtendedTypes; +} VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures; + +typedef struct VkDeviceBufferMemoryRequirements { + VkStructureType sType; + const void * pNext; + const VkBufferCreateInfo * pCreateInfo; +} VkDeviceBufferMemoryRequirements; + +typedef struct VkDeviceImageMemoryRequirements { + VkStructureType sType; + const void * pNext; + const VkImageCreateInfo * pCreateInfo; + VkImageAspectFlagBits planeAspect; +} VkDeviceImageMemoryRequirements; + typedef struct VkMemoryRequirements2 { VkStructureType sType; void * pNext; VkMemoryRequirements memoryRequirements; } VkMemoryRequirements2; -typedef struct VkMemoryRequirements2KHR VkMemoryRequirements2KHR; + typedef struct VkSparseImageMemoryRequirements2 { VkStructureType sType; void * pNext; VkSparseImageMemoryRequirements memoryRequirements; } VkSparseImageMemoryRequirements2; + typedef struct VkMemoryDedicatedRequirements { VkStructureType sType; void * pNext; VkBool32 prefersDedicatedAllocation; VkBool32 requiresDedicatedAllocation; } VkMemoryDedicatedRequirements; + typedef struct VkImageViewUsageCreateInfo { VkStructureType sType; const void * pNext; VkImageUsageFlags usage; } VkImageViewUsageCreateInfo; + typedef struct VkSamplerYcbcrConversionCreateInfo { VkStructureType sType; const void * pNext; @@ -2820,26 +3811,31 @@ typedef struct VkSamplerYcbcrConversionCreateInfo { VkFilter chromaFilter; VkBool32 forceExplicitReconstruction; } VkSamplerYcbcrConversionCreateInfo; + typedef struct VkPhysicalDeviceSamplerYcbcrConversionFeatures { VkStructureType sType; void * pNext; VkBool32 samplerYcbcrConversion; } VkPhysicalDeviceSamplerYcbcrConversionFeatures; + typedef struct VkProtectedSubmitInfo { VkStructureType sType; const void * pNext; VkBool32 protectedSubmit; } VkProtectedSubmitInfo; + typedef struct VkPhysicalDeviceProtectedMemoryFeatures { VkStructureType sType; void * pNext; VkBool32 protectedMemory; } VkPhysicalDeviceProtectedMemoryFeatures; + typedef struct VkPhysicalDeviceProtectedMemoryProperties { VkStructureType sType; void * pNext; VkBool32 protectedNoFault; } VkPhysicalDeviceProtectedMemoryProperties; + typedef struct VkDeviceQueueInfo2 { VkStructureType sType; const void * pNext; @@ -2847,23 +3843,887 @@ typedef struct VkDeviceQueueInfo2 { uint32_t queueFamilyIndex; uint32_t queueIndex; } VkDeviceQueueInfo2; + +typedef struct VkPhysicalDeviceSamplerFilterMinmaxProperties { + VkStructureType sType; + void * pNext; + VkBool32 filterMinmaxSingleComponentFormats; + VkBool32 filterMinmaxImageComponentMapping; +} VkPhysicalDeviceSamplerFilterMinmaxProperties; + +typedef struct VkPhysicalDeviceInlineUniformBlockFeatures { + VkStructureType sType; + void * pNext; + VkBool32 inlineUniformBlock; + VkBool32 descriptorBindingInlineUniformBlockUpdateAfterBind; +} VkPhysicalDeviceInlineUniformBlockFeatures; + typedef struct VkPhysicalDeviceMaintenance3Properties { VkStructureType sType; void * pNext; uint32_t maxPerSetDescriptors; VkDeviceSize maxMemoryAllocationSize; } VkPhysicalDeviceMaintenance3Properties; + +typedef struct VkPhysicalDeviceMaintenance4Features { + VkStructureType sType; + void * pNext; + VkBool32 maintenance4; +} VkPhysicalDeviceMaintenance4Features; + +typedef struct VkPhysicalDeviceMaintenance4Properties { + VkStructureType sType; + void * pNext; + VkDeviceSize maxBufferSize; +} VkPhysicalDeviceMaintenance4Properties; + typedef struct VkDescriptorSetLayoutSupport { VkStructureType sType; void * pNext; VkBool32 supported; } VkDescriptorSetLayoutSupport; + typedef struct VkPhysicalDeviceShaderDrawParametersFeatures { VkStructureType sType; void * pNext; VkBool32 shaderDrawParameters; } VkPhysicalDeviceShaderDrawParametersFeatures; -typedef struct VkPhysicalDeviceShaderDrawParameterFeatures VkPhysicalDeviceShaderDrawParameterFeatures; + +typedef struct VkPhysicalDeviceShaderDrawParametersFeatures VkPhysicalDeviceShaderDrawParameterFeatures; + +typedef struct VkPhysicalDeviceShaderFloat16Int8Features { + VkStructureType sType; + void * pNext; + VkBool32 shaderFloat16; + VkBool32 shaderInt8; +} VkPhysicalDeviceShaderFloat16Int8Features; + +typedef struct VkPhysicalDeviceFloatControlsProperties { + VkStructureType sType; + void * pNext; + VkShaderFloatControlsIndependence denormBehaviorIndependence; + VkShaderFloatControlsIndependence roundingModeIndependence; + VkBool32 shaderSignedZeroInfNanPreserveFloat16; + VkBool32 shaderSignedZeroInfNanPreserveFloat32; + VkBool32 shaderSignedZeroInfNanPreserveFloat64; + VkBool32 shaderDenormPreserveFloat16; + VkBool32 shaderDenormPreserveFloat32; + VkBool32 shaderDenormPreserveFloat64; + VkBool32 shaderDenormFlushToZeroFloat16; + VkBool32 shaderDenormFlushToZeroFloat32; + VkBool32 shaderDenormFlushToZeroFloat64; + VkBool32 shaderRoundingModeRTEFloat16; + VkBool32 shaderRoundingModeRTEFloat32; + VkBool32 shaderRoundingModeRTEFloat64; + VkBool32 shaderRoundingModeRTZFloat16; + VkBool32 shaderRoundingModeRTZFloat32; + VkBool32 shaderRoundingModeRTZFloat64; +} VkPhysicalDeviceFloatControlsProperties; + +typedef struct VkPhysicalDeviceHostQueryResetFeatures { + VkStructureType sType; + void * pNext; + VkBool32 hostQueryReset; +} VkPhysicalDeviceHostQueryResetFeatures; + +typedef struct VkPhysicalDeviceDescriptorIndexingFeatures { + VkStructureType sType; + void * pNext; + VkBool32 shaderInputAttachmentArrayDynamicIndexing; + VkBool32 shaderUniformTexelBufferArrayDynamicIndexing; + VkBool32 shaderStorageTexelBufferArrayDynamicIndexing; + VkBool32 shaderUniformBufferArrayNonUniformIndexing; + VkBool32 shaderSampledImageArrayNonUniformIndexing; + VkBool32 shaderStorageBufferArrayNonUniformIndexing; + VkBool32 shaderStorageImageArrayNonUniformIndexing; + VkBool32 shaderInputAttachmentArrayNonUniformIndexing; + VkBool32 shaderUniformTexelBufferArrayNonUniformIndexing; + VkBool32 shaderStorageTexelBufferArrayNonUniformIndexing; + VkBool32 descriptorBindingUniformBufferUpdateAfterBind; + VkBool32 descriptorBindingSampledImageUpdateAfterBind; + VkBool32 descriptorBindingStorageImageUpdateAfterBind; + VkBool32 descriptorBindingStorageBufferUpdateAfterBind; + VkBool32 descriptorBindingUniformTexelBufferUpdateAfterBind; + VkBool32 descriptorBindingStorageTexelBufferUpdateAfterBind; + VkBool32 descriptorBindingUpdateUnusedWhilePending; + VkBool32 descriptorBindingPartiallyBound; + VkBool32 descriptorBindingVariableDescriptorCount; + VkBool32 runtimeDescriptorArray; +} VkPhysicalDeviceDescriptorIndexingFeatures; + +typedef struct VkPhysicalDeviceDescriptorIndexingProperties { + VkStructureType sType; + void * pNext; + uint32_t maxUpdateAfterBindDescriptorsInAllPools; + VkBool32 shaderUniformBufferArrayNonUniformIndexingNative; + VkBool32 shaderSampledImageArrayNonUniformIndexingNative; + VkBool32 shaderStorageBufferArrayNonUniformIndexingNative; + VkBool32 shaderStorageImageArrayNonUniformIndexingNative; + VkBool32 shaderInputAttachmentArrayNonUniformIndexingNative; + VkBool32 robustBufferAccessUpdateAfterBind; + VkBool32 quadDivergentImplicitLod; + uint32_t maxPerStageDescriptorUpdateAfterBindSamplers; + uint32_t maxPerStageDescriptorUpdateAfterBindUniformBuffers; + uint32_t maxPerStageDescriptorUpdateAfterBindStorageBuffers; + uint32_t maxPerStageDescriptorUpdateAfterBindSampledImages; + uint32_t maxPerStageDescriptorUpdateAfterBindStorageImages; + uint32_t maxPerStageDescriptorUpdateAfterBindInputAttachments; + uint32_t maxPerStageUpdateAfterBindResources; + uint32_t maxDescriptorSetUpdateAfterBindSamplers; + uint32_t maxDescriptorSetUpdateAfterBindUniformBuffers; + uint32_t maxDescriptorSetUpdateAfterBindUniformBuffersDynamic; + uint32_t maxDescriptorSetUpdateAfterBindStorageBuffers; + uint32_t maxDescriptorSetUpdateAfterBindStorageBuffersDynamic; + uint32_t maxDescriptorSetUpdateAfterBindSampledImages; + uint32_t maxDescriptorSetUpdateAfterBindStorageImages; + uint32_t maxDescriptorSetUpdateAfterBindInputAttachments; +} VkPhysicalDeviceDescriptorIndexingProperties; + +typedef struct VkDescriptorSetLayoutBindingFlagsCreateInfo { + VkStructureType sType; + const void * pNext; + uint32_t bindingCount; + const VkDescriptorBindingFlags * pBindingFlags; +} VkDescriptorSetLayoutBindingFlagsCreateInfo; + +typedef struct VkAttachmentDescription2 { + VkStructureType sType; + const void * pNext; + VkAttachmentDescriptionFlags flags; + VkFormat format; + VkSampleCountFlagBits samples; + VkAttachmentLoadOp loadOp; + VkAttachmentStoreOp storeOp; + VkAttachmentLoadOp stencilLoadOp; + VkAttachmentStoreOp stencilStoreOp; + VkImageLayout initialLayout; + VkImageLayout finalLayout; +} VkAttachmentDescription2; + +typedef struct VkAttachmentReference2 { + VkStructureType sType; + const void * pNext; + uint32_t attachment; + VkImageLayout layout; + VkImageAspectFlags aspectMask; +} VkAttachmentReference2; + +typedef struct VkSubpassDescription2 { + VkStructureType sType; + const void * pNext; + VkSubpassDescriptionFlags flags; + VkPipelineBindPoint pipelineBindPoint; + uint32_t viewMask; + uint32_t inputAttachmentCount; + const VkAttachmentReference2 * pInputAttachments; + uint32_t colorAttachmentCount; + const VkAttachmentReference2 * pColorAttachments; + const VkAttachmentReference2 * pResolveAttachments; + const VkAttachmentReference2 * pDepthStencilAttachment; + uint32_t preserveAttachmentCount; + const uint32_t * pPreserveAttachments; +} VkSubpassDescription2; + +typedef struct VkSubpassDependency2 { + VkStructureType sType; + const void * pNext; + uint32_t srcSubpass; + uint32_t dstSubpass; + VkPipelineStageFlags srcStageMask; + VkPipelineStageFlags dstStageMask; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; + VkDependencyFlags dependencyFlags; + int32_t viewOffset; +} VkSubpassDependency2; + +typedef struct VkRenderPassCreateInfo2 { + VkStructureType sType; + const void * pNext; + VkRenderPassCreateFlags flags; + uint32_t attachmentCount; + const VkAttachmentDescription2 * pAttachments; + uint32_t subpassCount; + const VkSubpassDescription2 * pSubpasses; + uint32_t dependencyCount; + const VkSubpassDependency2 * pDependencies; + uint32_t correlatedViewMaskCount; + const uint32_t * pCorrelatedViewMasks; +} VkRenderPassCreateInfo2; + +typedef struct VkPhysicalDeviceTimelineSemaphoreFeatures { + VkStructureType sType; + void * pNext; + VkBool32 timelineSemaphore; +} VkPhysicalDeviceTimelineSemaphoreFeatures; + +typedef struct VkSemaphoreWaitInfo { + VkStructureType sType; + const void * pNext; + VkSemaphoreWaitFlags flags; + uint32_t semaphoreCount; + const VkSemaphore * pSemaphores; + const uint64_t * pValues; +} VkSemaphoreWaitInfo; + +typedef struct VkPhysicalDevice8BitStorageFeatures { + VkStructureType sType; + void * pNext; + VkBool32 storageBuffer8BitAccess; + VkBool32 uniformAndStorageBuffer8BitAccess; + VkBool32 storagePushConstant8; +} VkPhysicalDevice8BitStorageFeatures; + +typedef struct VkPhysicalDeviceVulkanMemoryModelFeatures { + VkStructureType sType; + void * pNext; + VkBool32 vulkanMemoryModel; + VkBool32 vulkanMemoryModelDeviceScope; + VkBool32 vulkanMemoryModelAvailabilityVisibilityChains; +} VkPhysicalDeviceVulkanMemoryModelFeatures; + +typedef struct VkPhysicalDeviceShaderAtomicInt64Features { + VkStructureType sType; + void * pNext; + VkBool32 shaderBufferInt64Atomics; + VkBool32 shaderSharedInt64Atomics; +} VkPhysicalDeviceShaderAtomicInt64Features; + +typedef struct VkPhysicalDeviceDepthStencilResolveProperties { + VkStructureType sType; + void * pNext; + VkResolveModeFlags supportedDepthResolveModes; + VkResolveModeFlags supportedStencilResolveModes; + VkBool32 independentResolveNone; + VkBool32 independentResolve; +} VkPhysicalDeviceDepthStencilResolveProperties; + +typedef struct VkSubpassDescriptionDepthStencilResolve { + VkStructureType sType; + const void * pNext; + VkResolveModeFlagBits depthResolveMode; + VkResolveModeFlagBits stencilResolveMode; + const VkAttachmentReference2 * pDepthStencilResolveAttachment; +} VkSubpassDescriptionDepthStencilResolve; + +typedef struct VkImageStencilUsageCreateInfo { + VkStructureType sType; + const void * pNext; + VkImageUsageFlags stencilUsage; +} VkImageStencilUsageCreateInfo; + +typedef struct VkPhysicalDeviceScalarBlockLayoutFeatures { + VkStructureType sType; + void * pNext; + VkBool32 scalarBlockLayout; +} VkPhysicalDeviceScalarBlockLayoutFeatures; + +typedef struct VkPhysicalDeviceUniformBufferStandardLayoutFeatures { + VkStructureType sType; + void * pNext; + VkBool32 uniformBufferStandardLayout; +} VkPhysicalDeviceUniformBufferStandardLayoutFeatures; + +typedef struct VkPhysicalDeviceBufferDeviceAddressFeatures { + VkStructureType sType; + void * pNext; + VkBool32 bufferDeviceAddress; + VkBool32 bufferDeviceAddressCaptureReplay; + VkBool32 bufferDeviceAddressMultiDevice; +} VkPhysicalDeviceBufferDeviceAddressFeatures; + +typedef struct VkPhysicalDeviceImagelessFramebufferFeatures { + VkStructureType sType; + void * pNext; + VkBool32 imagelessFramebuffer; +} VkPhysicalDeviceImagelessFramebufferFeatures; + +typedef struct VkFramebufferAttachmentImageInfo { + VkStructureType sType; + const void * pNext; + VkImageCreateFlags flags; + VkImageUsageFlags usage; + uint32_t width; + uint32_t height; + uint32_t layerCount; + uint32_t viewFormatCount; + const VkFormat * pViewFormats; +} VkFramebufferAttachmentImageInfo; + +typedef struct VkPhysicalDeviceTextureCompressionASTCHDRFeatures { + VkStructureType sType; + void * pNext; + VkBool32 textureCompressionASTC_HDR; +} VkPhysicalDeviceTextureCompressionASTCHDRFeatures; + +typedef struct VkPipelineCreationFeedback { + VkPipelineCreationFeedbackFlags flags; + uint64_t duration; +} VkPipelineCreationFeedback; + +typedef struct VkPipelineCreationFeedbackCreateInfo { + VkStructureType sType; + const void * pNext; + VkPipelineCreationFeedback * pPipelineCreationFeedback; + uint32_t pipelineStageCreationFeedbackCount; + VkPipelineCreationFeedback * pPipelineStageCreationFeedbacks; +} VkPipelineCreationFeedbackCreateInfo; + +typedef struct VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures { + VkStructureType sType; + void * pNext; + VkBool32 separateDepthStencilLayouts; +} VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures; + +typedef struct VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures { + VkStructureType sType; + void * pNext; + VkBool32 shaderDemoteToHelperInvocation; +} VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures; + +typedef struct VkPhysicalDeviceTexelBufferAlignmentProperties { + VkStructureType sType; + void * pNext; + VkDeviceSize storageTexelBufferOffsetAlignmentBytes; + VkBool32 storageTexelBufferOffsetSingleTexelAlignment; + VkDeviceSize uniformTexelBufferOffsetAlignmentBytes; + VkBool32 uniformTexelBufferOffsetSingleTexelAlignment; +} VkPhysicalDeviceTexelBufferAlignmentProperties; + +typedef struct VkPhysicalDeviceSubgroupSizeControlFeatures { + VkStructureType sType; + void * pNext; + VkBool32 subgroupSizeControl; + VkBool32 computeFullSubgroups; +} VkPhysicalDeviceSubgroupSizeControlFeatures; + +typedef struct VkPhysicalDeviceSubgroupSizeControlProperties { + VkStructureType sType; + void * pNext; + uint32_t minSubgroupSize; + uint32_t maxSubgroupSize; + uint32_t maxComputeWorkgroupSubgroups; + VkShaderStageFlags requiredSubgroupSizeStages; +} VkPhysicalDeviceSubgroupSizeControlProperties; + +typedef struct VkPhysicalDevicePipelineCreationCacheControlFeatures { + VkStructureType sType; + void * pNext; + VkBool32 pipelineCreationCacheControl; +} VkPhysicalDevicePipelineCreationCacheControlFeatures; + +typedef struct VkPhysicalDeviceVulkan11Features { + VkStructureType sType; + void * pNext; + VkBool32 storageBuffer16BitAccess; + VkBool32 uniformAndStorageBuffer16BitAccess; + VkBool32 storagePushConstant16; + VkBool32 storageInputOutput16; + VkBool32 multiview; + VkBool32 multiviewGeometryShader; + VkBool32 multiviewTessellationShader; + VkBool32 variablePointersStorageBuffer; + VkBool32 variablePointers; + VkBool32 protectedMemory; + VkBool32 samplerYcbcrConversion; + VkBool32 shaderDrawParameters; +} VkPhysicalDeviceVulkan11Features; + +typedef struct VkPhysicalDeviceVulkan11Properties { + VkStructureType sType; + void * pNext; + uint8_t deviceUUID [ VK_UUID_SIZE ]; + uint8_t driverUUID [ VK_UUID_SIZE ]; + uint8_t deviceLUID [ VK_LUID_SIZE ]; + uint32_t deviceNodeMask; + VkBool32 deviceLUIDValid; + uint32_t subgroupSize; + VkShaderStageFlags subgroupSupportedStages; + VkSubgroupFeatureFlags subgroupSupportedOperations; + VkBool32 subgroupQuadOperationsInAllStages; + VkPointClippingBehavior pointClippingBehavior; + uint32_t maxMultiviewViewCount; + uint32_t maxMultiviewInstanceIndex; + VkBool32 protectedNoFault; + uint32_t maxPerSetDescriptors; + VkDeviceSize maxMemoryAllocationSize; +} VkPhysicalDeviceVulkan11Properties; + +typedef struct VkPhysicalDeviceVulkan12Features { + VkStructureType sType; + void * pNext; + VkBool32 samplerMirrorClampToEdge; + VkBool32 drawIndirectCount; + VkBool32 storageBuffer8BitAccess; + VkBool32 uniformAndStorageBuffer8BitAccess; + VkBool32 storagePushConstant8; + VkBool32 shaderBufferInt64Atomics; + VkBool32 shaderSharedInt64Atomics; + VkBool32 shaderFloat16; + VkBool32 shaderInt8; + VkBool32 descriptorIndexing; + VkBool32 shaderInputAttachmentArrayDynamicIndexing; + VkBool32 shaderUniformTexelBufferArrayDynamicIndexing; + VkBool32 shaderStorageTexelBufferArrayDynamicIndexing; + VkBool32 shaderUniformBufferArrayNonUniformIndexing; + VkBool32 shaderSampledImageArrayNonUniformIndexing; + VkBool32 shaderStorageBufferArrayNonUniformIndexing; + VkBool32 shaderStorageImageArrayNonUniformIndexing; + VkBool32 shaderInputAttachmentArrayNonUniformIndexing; + VkBool32 shaderUniformTexelBufferArrayNonUniformIndexing; + VkBool32 shaderStorageTexelBufferArrayNonUniformIndexing; + VkBool32 descriptorBindingUniformBufferUpdateAfterBind; + VkBool32 descriptorBindingSampledImageUpdateAfterBind; + VkBool32 descriptorBindingStorageImageUpdateAfterBind; + VkBool32 descriptorBindingStorageBufferUpdateAfterBind; + VkBool32 descriptorBindingUniformTexelBufferUpdateAfterBind; + VkBool32 descriptorBindingStorageTexelBufferUpdateAfterBind; + VkBool32 descriptorBindingUpdateUnusedWhilePending; + VkBool32 descriptorBindingPartiallyBound; + VkBool32 descriptorBindingVariableDescriptorCount; + VkBool32 runtimeDescriptorArray; + VkBool32 samplerFilterMinmax; + VkBool32 scalarBlockLayout; + VkBool32 imagelessFramebuffer; + VkBool32 uniformBufferStandardLayout; + VkBool32 shaderSubgroupExtendedTypes; + VkBool32 separateDepthStencilLayouts; + VkBool32 hostQueryReset; + VkBool32 timelineSemaphore; + VkBool32 bufferDeviceAddress; + VkBool32 bufferDeviceAddressCaptureReplay; + VkBool32 bufferDeviceAddressMultiDevice; + VkBool32 vulkanMemoryModel; + VkBool32 vulkanMemoryModelDeviceScope; + VkBool32 vulkanMemoryModelAvailabilityVisibilityChains; + VkBool32 shaderOutputViewportIndex; + VkBool32 shaderOutputLayer; + VkBool32 subgroupBroadcastDynamicId; +} VkPhysicalDeviceVulkan12Features; + +typedef struct VkPhysicalDeviceVulkan12Properties { + VkStructureType sType; + void * pNext; + VkDriverId driverID; + char driverName [ VK_MAX_DRIVER_NAME_SIZE ]; + char driverInfo [ VK_MAX_DRIVER_INFO_SIZE ]; + VkConformanceVersion conformanceVersion; + VkShaderFloatControlsIndependence denormBehaviorIndependence; + VkShaderFloatControlsIndependence roundingModeIndependence; + VkBool32 shaderSignedZeroInfNanPreserveFloat16; + VkBool32 shaderSignedZeroInfNanPreserveFloat32; + VkBool32 shaderSignedZeroInfNanPreserveFloat64; + VkBool32 shaderDenormPreserveFloat16; + VkBool32 shaderDenormPreserveFloat32; + VkBool32 shaderDenormPreserveFloat64; + VkBool32 shaderDenormFlushToZeroFloat16; + VkBool32 shaderDenormFlushToZeroFloat32; + VkBool32 shaderDenormFlushToZeroFloat64; + VkBool32 shaderRoundingModeRTEFloat16; + VkBool32 shaderRoundingModeRTEFloat32; + VkBool32 shaderRoundingModeRTEFloat64; + VkBool32 shaderRoundingModeRTZFloat16; + VkBool32 shaderRoundingModeRTZFloat32; + VkBool32 shaderRoundingModeRTZFloat64; + uint32_t maxUpdateAfterBindDescriptorsInAllPools; + VkBool32 shaderUniformBufferArrayNonUniformIndexingNative; + VkBool32 shaderSampledImageArrayNonUniformIndexingNative; + VkBool32 shaderStorageBufferArrayNonUniformIndexingNative; + VkBool32 shaderStorageImageArrayNonUniformIndexingNative; + VkBool32 shaderInputAttachmentArrayNonUniformIndexingNative; + VkBool32 robustBufferAccessUpdateAfterBind; + VkBool32 quadDivergentImplicitLod; + uint32_t maxPerStageDescriptorUpdateAfterBindSamplers; + uint32_t maxPerStageDescriptorUpdateAfterBindUniformBuffers; + uint32_t maxPerStageDescriptorUpdateAfterBindStorageBuffers; + uint32_t maxPerStageDescriptorUpdateAfterBindSampledImages; + uint32_t maxPerStageDescriptorUpdateAfterBindStorageImages; + uint32_t maxPerStageDescriptorUpdateAfterBindInputAttachments; + uint32_t maxPerStageUpdateAfterBindResources; + uint32_t maxDescriptorSetUpdateAfterBindSamplers; + uint32_t maxDescriptorSetUpdateAfterBindUniformBuffers; + uint32_t maxDescriptorSetUpdateAfterBindUniformBuffersDynamic; + uint32_t maxDescriptorSetUpdateAfterBindStorageBuffers; + uint32_t maxDescriptorSetUpdateAfterBindStorageBuffersDynamic; + uint32_t maxDescriptorSetUpdateAfterBindSampledImages; + uint32_t maxDescriptorSetUpdateAfterBindStorageImages; + uint32_t maxDescriptorSetUpdateAfterBindInputAttachments; + VkResolveModeFlags supportedDepthResolveModes; + VkResolveModeFlags supportedStencilResolveModes; + VkBool32 independentResolveNone; + VkBool32 independentResolve; + VkBool32 filterMinmaxSingleComponentFormats; + VkBool32 filterMinmaxImageComponentMapping; + uint64_t maxTimelineSemaphoreValueDifference; + VkSampleCountFlags framebufferIntegerColorSampleCounts; +} VkPhysicalDeviceVulkan12Properties; + +typedef struct VkPhysicalDeviceVulkan13Features { + VkStructureType sType; + void * pNext; + VkBool32 robustImageAccess; + VkBool32 inlineUniformBlock; + VkBool32 descriptorBindingInlineUniformBlockUpdateAfterBind; + VkBool32 pipelineCreationCacheControl; + VkBool32 privateData; + VkBool32 shaderDemoteToHelperInvocation; + VkBool32 shaderTerminateInvocation; + VkBool32 subgroupSizeControl; + VkBool32 computeFullSubgroups; + VkBool32 synchronization2; + VkBool32 textureCompressionASTC_HDR; + VkBool32 shaderZeroInitializeWorkgroupMemory; + VkBool32 dynamicRendering; + VkBool32 shaderIntegerDotProduct; + VkBool32 maintenance4; +} VkPhysicalDeviceVulkan13Features; + +typedef struct VkPhysicalDeviceVulkan13Properties { + VkStructureType sType; + void * pNext; + uint32_t minSubgroupSize; + uint32_t maxSubgroupSize; + uint32_t maxComputeWorkgroupSubgroups; + VkShaderStageFlags requiredSubgroupSizeStages; + uint32_t maxInlineUniformBlockSize; + uint32_t maxPerStageDescriptorInlineUniformBlocks; + uint32_t maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks; + uint32_t maxDescriptorSetInlineUniformBlocks; + uint32_t maxDescriptorSetUpdateAfterBindInlineUniformBlocks; + uint32_t maxInlineUniformTotalSize; + VkBool32 integerDotProduct8BitUnsignedAccelerated; + VkBool32 integerDotProduct8BitSignedAccelerated; + VkBool32 integerDotProduct8BitMixedSignednessAccelerated; + VkBool32 integerDotProduct4x8BitPackedUnsignedAccelerated; + VkBool32 integerDotProduct4x8BitPackedSignedAccelerated; + VkBool32 integerDotProduct4x8BitPackedMixedSignednessAccelerated; + VkBool32 integerDotProduct16BitUnsignedAccelerated; + VkBool32 integerDotProduct16BitSignedAccelerated; + VkBool32 integerDotProduct16BitMixedSignednessAccelerated; + VkBool32 integerDotProduct32BitUnsignedAccelerated; + VkBool32 integerDotProduct32BitSignedAccelerated; + VkBool32 integerDotProduct32BitMixedSignednessAccelerated; + VkBool32 integerDotProduct64BitUnsignedAccelerated; + VkBool32 integerDotProduct64BitSignedAccelerated; + VkBool32 integerDotProduct64BitMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating8BitUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating8BitSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating16BitUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating16BitSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating32BitUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating32BitSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating64BitUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating64BitSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated; + VkDeviceSize storageTexelBufferOffsetAlignmentBytes; + VkBool32 storageTexelBufferOffsetSingleTexelAlignment; + VkDeviceSize uniformTexelBufferOffsetAlignmentBytes; + VkBool32 uniformTexelBufferOffsetSingleTexelAlignment; + VkDeviceSize maxBufferSize; +} VkPhysicalDeviceVulkan13Properties; + +typedef struct VkPhysicalDeviceToolProperties { + VkStructureType sType; + void * pNext; + char name [ VK_MAX_EXTENSION_NAME_SIZE ]; + char version [ VK_MAX_EXTENSION_NAME_SIZE ]; + VkToolPurposeFlags purposes; + char description [ VK_MAX_DESCRIPTION_SIZE ]; + char layer [ VK_MAX_EXTENSION_NAME_SIZE ]; +} VkPhysicalDeviceToolProperties; + +typedef struct VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures { + VkStructureType sType; + void * pNext; + VkBool32 shaderZeroInitializeWorkgroupMemory; +} VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures; + +typedef struct VkPhysicalDeviceImageRobustnessFeatures { + VkStructureType sType; + void * pNext; + VkBool32 robustImageAccess; +} VkPhysicalDeviceImageRobustnessFeatures; + +typedef struct VkBufferCopy2 { + VkStructureType sType; + const void * pNext; + VkDeviceSize srcOffset; + VkDeviceSize dstOffset; + VkDeviceSize size; +} VkBufferCopy2; + +typedef struct VkImageCopy2 { + VkStructureType sType; + const void * pNext; + VkImageSubresourceLayers srcSubresource; + VkOffset3D srcOffset; + VkImageSubresourceLayers dstSubresource; + VkOffset3D dstOffset; + VkExtent3D extent; +} VkImageCopy2; + +typedef struct VkImageBlit2 { + VkStructureType sType; + const void * pNext; + VkImageSubresourceLayers srcSubresource; + VkOffset3D srcOffsets [2]; + VkImageSubresourceLayers dstSubresource; + VkOffset3D dstOffsets [2]; +} VkImageBlit2; + +typedef struct VkBufferImageCopy2 { + VkStructureType sType; + const void * pNext; + VkDeviceSize bufferOffset; + uint32_t bufferRowLength; + uint32_t bufferImageHeight; + VkImageSubresourceLayers imageSubresource; + VkOffset3D imageOffset; + VkExtent3D imageExtent; +} VkBufferImageCopy2; + +typedef struct VkImageResolve2 { + VkStructureType sType; + const void * pNext; + VkImageSubresourceLayers srcSubresource; + VkOffset3D srcOffset; + VkImageSubresourceLayers dstSubresource; + VkOffset3D dstOffset; + VkExtent3D extent; +} VkImageResolve2; + +typedef struct VkCopyBufferInfo2 { + VkStructureType sType; + const void * pNext; + VkBuffer srcBuffer; + VkBuffer dstBuffer; + uint32_t regionCount; + const VkBufferCopy2 * pRegions; +} VkCopyBufferInfo2; + +typedef struct VkCopyImageInfo2 { + VkStructureType sType; + const void * pNext; + VkImage srcImage; + VkImageLayout srcImageLayout; + VkImage dstImage; + VkImageLayout dstImageLayout; + uint32_t regionCount; + const VkImageCopy2 * pRegions; +} VkCopyImageInfo2; + +typedef struct VkBlitImageInfo2 { + VkStructureType sType; + const void * pNext; + VkImage srcImage; + VkImageLayout srcImageLayout; + VkImage dstImage; + VkImageLayout dstImageLayout; + uint32_t regionCount; + const VkImageBlit2 * pRegions; + VkFilter filter; +} VkBlitImageInfo2; + +typedef struct VkCopyBufferToImageInfo2 { + VkStructureType sType; + const void * pNext; + VkBuffer srcBuffer; + VkImage dstImage; + VkImageLayout dstImageLayout; + uint32_t regionCount; + const VkBufferImageCopy2 * pRegions; +} VkCopyBufferToImageInfo2; + +typedef struct VkCopyImageToBufferInfo2 { + VkStructureType sType; + const void * pNext; + VkImage srcImage; + VkImageLayout srcImageLayout; + VkBuffer dstBuffer; + uint32_t regionCount; + const VkBufferImageCopy2 * pRegions; +} VkCopyImageToBufferInfo2; + +typedef struct VkResolveImageInfo2 { + VkStructureType sType; + const void * pNext; + VkImage srcImage; + VkImageLayout srcImageLayout; + VkImage dstImage; + VkImageLayout dstImageLayout; + uint32_t regionCount; + const VkImageResolve2 * pRegions; +} VkResolveImageInfo2; + +typedef struct VkPhysicalDeviceShaderTerminateInvocationFeatures { + VkStructureType sType; + void * pNext; + VkBool32 shaderTerminateInvocation; +} VkPhysicalDeviceShaderTerminateInvocationFeatures; + +typedef struct VkMemoryBarrier2 { + VkStructureType sType; + const void * pNext; + VkPipelineStageFlags2 srcStageMask; + VkAccessFlags2 srcAccessMask; + VkPipelineStageFlags2 dstStageMask; + VkAccessFlags2 dstAccessMask; +} VkMemoryBarrier2; + +typedef struct VkImageMemoryBarrier2 { + VkStructureType sType; + const void * pNext; + VkPipelineStageFlags2 srcStageMask; + VkAccessFlags2 srcAccessMask; + VkPipelineStageFlags2 dstStageMask; + VkAccessFlags2 dstAccessMask; + VkImageLayout oldLayout; + VkImageLayout newLayout; + uint32_t srcQueueFamilyIndex; + uint32_t dstQueueFamilyIndex; + VkImage image; + VkImageSubresourceRange subresourceRange; +} VkImageMemoryBarrier2; + +typedef struct VkBufferMemoryBarrier2 { + VkStructureType sType; + const void * pNext; + VkPipelineStageFlags2 srcStageMask; + VkAccessFlags2 srcAccessMask; + VkPipelineStageFlags2 dstStageMask; + VkAccessFlags2 dstAccessMask; + uint32_t srcQueueFamilyIndex; + uint32_t dstQueueFamilyIndex; + VkBuffer buffer; + VkDeviceSize offset; + VkDeviceSize size; +} VkBufferMemoryBarrier2; + +typedef struct VkDependencyInfo { + VkStructureType sType; + const void * pNext; + VkDependencyFlags dependencyFlags; + uint32_t memoryBarrierCount; + const VkMemoryBarrier2 * pMemoryBarriers; + uint32_t bufferMemoryBarrierCount; + const VkBufferMemoryBarrier2 * pBufferMemoryBarriers; + uint32_t imageMemoryBarrierCount; + const VkImageMemoryBarrier2 * pImageMemoryBarriers; +} VkDependencyInfo; + +typedef struct VkSemaphoreSubmitInfo { + VkStructureType sType; + const void * pNext; + VkSemaphore semaphore; + uint64_t value; + VkPipelineStageFlags2 stageMask; + uint32_t deviceIndex; +} VkSemaphoreSubmitInfo; + +typedef struct VkSubmitInfo2 { + VkStructureType sType; + const void * pNext; + VkSubmitFlags flags; + uint32_t waitSemaphoreInfoCount; + const VkSemaphoreSubmitInfo * pWaitSemaphoreInfos; + uint32_t commandBufferInfoCount; + const VkCommandBufferSubmitInfo * pCommandBufferInfos; + uint32_t signalSemaphoreInfoCount; + const VkSemaphoreSubmitInfo * pSignalSemaphoreInfos; +} VkSubmitInfo2; + +typedef struct VkPhysicalDeviceSynchronization2Features { + VkStructureType sType; + void * pNext; + VkBool32 synchronization2; +} VkPhysicalDeviceSynchronization2Features; + +typedef struct VkPhysicalDeviceShaderIntegerDotProductFeatures { + VkStructureType sType; + void * pNext; + VkBool32 shaderIntegerDotProduct; +} VkPhysicalDeviceShaderIntegerDotProductFeatures; + +typedef struct VkPhysicalDeviceShaderIntegerDotProductProperties { + VkStructureType sType; + void * pNext; + VkBool32 integerDotProduct8BitUnsignedAccelerated; + VkBool32 integerDotProduct8BitSignedAccelerated; + VkBool32 integerDotProduct8BitMixedSignednessAccelerated; + VkBool32 integerDotProduct4x8BitPackedUnsignedAccelerated; + VkBool32 integerDotProduct4x8BitPackedSignedAccelerated; + VkBool32 integerDotProduct4x8BitPackedMixedSignednessAccelerated; + VkBool32 integerDotProduct16BitUnsignedAccelerated; + VkBool32 integerDotProduct16BitSignedAccelerated; + VkBool32 integerDotProduct16BitMixedSignednessAccelerated; + VkBool32 integerDotProduct32BitUnsignedAccelerated; + VkBool32 integerDotProduct32BitSignedAccelerated; + VkBool32 integerDotProduct32BitMixedSignednessAccelerated; + VkBool32 integerDotProduct64BitUnsignedAccelerated; + VkBool32 integerDotProduct64BitSignedAccelerated; + VkBool32 integerDotProduct64BitMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating8BitUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating8BitSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating16BitUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating16BitSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating32BitUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating32BitSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating64BitUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating64BitSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated; +} VkPhysicalDeviceShaderIntegerDotProductProperties; + +typedef struct VkFormatProperties3 { + VkStructureType sType; + void * pNext; + VkFormatFeatureFlags2 linearTilingFeatures; + VkFormatFeatureFlags2 optimalTilingFeatures; + VkFormatFeatureFlags2 bufferFeatures; +} VkFormatProperties3; + +typedef struct VkRenderingInfo { + VkStructureType sType; + const void * pNext; + VkRenderingFlags flags; + VkRect2D renderArea; + uint32_t layerCount; + uint32_t viewMask; + uint32_t colorAttachmentCount; + const VkRenderingAttachmentInfo * pColorAttachments; + const VkRenderingAttachmentInfo * pDepthAttachment; + const VkRenderingAttachmentInfo * pStencilAttachment; +} VkRenderingInfo; + +typedef struct VkPhysicalDeviceDynamicRenderingFeatures { + VkStructureType sType; + void * pNext; + VkBool32 dynamicRendering; +} VkPhysicalDeviceDynamicRenderingFeatures; + +typedef struct VkCommandBufferInheritanceRenderingInfo { + VkStructureType sType; + const void * pNext; + VkRenderingFlags flags; + uint32_t viewMask; + uint32_t colorAttachmentCount; + const VkFormat * pColorAttachmentFormats; + VkFormat depthAttachmentFormat; + VkFormat stencilAttachmentFormat; + VkSampleCountFlagBits rasterizationSamples; +} VkCommandBufferInheritanceRenderingInfo; + typedef struct VkPhysicalDeviceProperties { uint32_t apiVersion; uint32_t driverVersion; @@ -2875,6 +4735,7 @@ typedef struct VkPhysicalDeviceProperties { VkPhysicalDeviceLimits limits; VkPhysicalDeviceSparseProperties sparseProperties; } VkPhysicalDeviceProperties; + typedef struct VkDeviceCreateInfo { VkStructureType sType; const void * pNext; @@ -2887,218 +4748,285 @@ typedef struct VkDeviceCreateInfo { const char * const* ppEnabledExtensionNames; const VkPhysicalDeviceFeatures * pEnabledFeatures; } VkDeviceCreateInfo; + typedef struct VkPhysicalDeviceMemoryProperties { uint32_t memoryTypeCount; VkMemoryType memoryTypes [ VK_MAX_MEMORY_TYPES ]; uint32_t memoryHeapCount; VkMemoryHeap memoryHeaps [ VK_MAX_MEMORY_HEAPS ]; } VkPhysicalDeviceMemoryProperties; + typedef struct VkPhysicalDeviceProperties2 { VkStructureType sType; void * pNext; VkPhysicalDeviceProperties properties; } VkPhysicalDeviceProperties2; + typedef struct VkPhysicalDeviceMemoryProperties2 { VkStructureType sType; void * pNext; VkPhysicalDeviceMemoryProperties memoryProperties; } VkPhysicalDeviceMemoryProperties2; +typedef struct VkFramebufferAttachmentsCreateInfo { + VkStructureType sType; + const void * pNext; + uint32_t attachmentImageInfoCount; + const VkFramebufferAttachmentImageInfo * pAttachmentImageInfos; +} VkFramebufferAttachmentsCreateInfo; + + #define VK_VERSION_1_0 1 GLAD_API_CALL int GLAD_VK_VERSION_1_0; #define VK_VERSION_1_1 1 GLAD_API_CALL int GLAD_VK_VERSION_1_1; +#define VK_VERSION_1_2 1 +GLAD_API_CALL int GLAD_VK_VERSION_1_2; +#define VK_VERSION_1_3 1 +GLAD_API_CALL int GLAD_VK_VERSION_1_3; #define VK_EXT_debug_report 1 GLAD_API_CALL int GLAD_VK_EXT_debug_report; +#define VK_KHR_portability_enumeration 1 +GLAD_API_CALL int GLAD_VK_KHR_portability_enumeration; #define VK_KHR_surface 1 GLAD_API_CALL int GLAD_VK_KHR_surface; #define VK_KHR_swapchain 1 GLAD_API_CALL int GLAD_VK_KHR_swapchain; -typedef VkResult (GLAD_API_PTR *PFN_vkAcquireNextImage2KHR)(VkDevice device, const VkAcquireNextImageInfoKHR * pAcquireInfo, uint32_t * pImageIndex); -typedef VkResult (GLAD_API_PTR *PFN_vkAcquireNextImageKHR)(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t * pImageIndex); -typedef VkResult (GLAD_API_PTR *PFN_vkAllocateCommandBuffers)(VkDevice device, const VkCommandBufferAllocateInfo * pAllocateInfo, VkCommandBuffer * pCommandBuffers); -typedef VkResult (GLAD_API_PTR *PFN_vkAllocateDescriptorSets)(VkDevice device, const VkDescriptorSetAllocateInfo * pAllocateInfo, VkDescriptorSet * pDescriptorSets); -typedef VkResult (GLAD_API_PTR *PFN_vkAllocateMemory)(VkDevice device, const VkMemoryAllocateInfo * pAllocateInfo, const VkAllocationCallbacks * pAllocator, VkDeviceMemory * pMemory); -typedef VkResult (GLAD_API_PTR *PFN_vkBeginCommandBuffer)(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo * pBeginInfo); -typedef VkResult (GLAD_API_PTR *PFN_vkBindBufferMemory)(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset); -typedef VkResult (GLAD_API_PTR *PFN_vkBindBufferMemory2)(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo * pBindInfos); -typedef VkResult (GLAD_API_PTR *PFN_vkBindImageMemory)(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset); -typedef VkResult (GLAD_API_PTR *PFN_vkBindImageMemory2)(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo * pBindInfos); -typedef void (GLAD_API_PTR *PFN_vkCmdBeginQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags); -typedef void (GLAD_API_PTR *PFN_vkCmdBeginRenderPass)(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo * pRenderPassBegin, VkSubpassContents contents); -typedef void (GLAD_API_PTR *PFN_vkCmdBindDescriptorSets)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet * pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t * pDynamicOffsets); -typedef void (GLAD_API_PTR *PFN_vkCmdBindIndexBuffer)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType); -typedef void (GLAD_API_PTR *PFN_vkCmdBindPipeline)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline); -typedef void (GLAD_API_PTR *PFN_vkCmdBindVertexBuffers)(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer * pBuffers, const VkDeviceSize * pOffsets); -typedef void (GLAD_API_PTR *PFN_vkCmdBlitImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit * pRegions, VkFilter filter); -typedef void (GLAD_API_PTR *PFN_vkCmdClearAttachments)(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment * pAttachments, uint32_t rectCount, const VkClearRect * pRects); -typedef void (GLAD_API_PTR *PFN_vkCmdClearColorImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue * pColor, uint32_t rangeCount, const VkImageSubresourceRange * pRanges); -typedef void (GLAD_API_PTR *PFN_vkCmdClearDepthStencilImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue * pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange * pRanges); -typedef void (GLAD_API_PTR *PFN_vkCmdCopyBuffer)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy * pRegions); -typedef void (GLAD_API_PTR *PFN_vkCmdCopyBufferToImage)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy * pRegions); -typedef void (GLAD_API_PTR *PFN_vkCmdCopyImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy * pRegions); -typedef void (GLAD_API_PTR *PFN_vkCmdCopyImageToBuffer)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy * pRegions); -typedef void (GLAD_API_PTR *PFN_vkCmdCopyQueryPoolResults)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags); -typedef void (GLAD_API_PTR *PFN_vkCmdDispatch)(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); -typedef void (GLAD_API_PTR *PFN_vkCmdDispatchBase)(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); -typedef void (GLAD_API_PTR *PFN_vkCmdDispatchIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset); -typedef void (GLAD_API_PTR *PFN_vkCmdDraw)(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance); -typedef void (GLAD_API_PTR *PFN_vkCmdDrawIndexed)(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance); -typedef void (GLAD_API_PTR *PFN_vkCmdDrawIndexedIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); -typedef void (GLAD_API_PTR *PFN_vkCmdDrawIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); -typedef void (GLAD_API_PTR *PFN_vkCmdEndQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query); -typedef void (GLAD_API_PTR *PFN_vkCmdEndRenderPass)(VkCommandBuffer commandBuffer); -typedef void (GLAD_API_PTR *PFN_vkCmdExecuteCommands)(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer * pCommandBuffers); -typedef void (GLAD_API_PTR *PFN_vkCmdFillBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data); -typedef void (GLAD_API_PTR *PFN_vkCmdNextSubpass)(VkCommandBuffer commandBuffer, VkSubpassContents contents); -typedef void (GLAD_API_PTR *PFN_vkCmdPipelineBarrier)(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier * pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier * pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier * pImageMemoryBarriers); -typedef void (GLAD_API_PTR *PFN_vkCmdPushConstants)(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void * pValues); -typedef void (GLAD_API_PTR *PFN_vkCmdResetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask); -typedef void (GLAD_API_PTR *PFN_vkCmdResetQueryPool)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount); -typedef void (GLAD_API_PTR *PFN_vkCmdResolveImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve * pRegions); -typedef void (GLAD_API_PTR *PFN_vkCmdSetBlendConstants)(VkCommandBuffer commandBuffer, const float blendConstants [4]); -typedef void (GLAD_API_PTR *PFN_vkCmdSetDepthBias)(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor); -typedef void (GLAD_API_PTR *PFN_vkCmdSetDepthBounds)(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds); -typedef void (GLAD_API_PTR *PFN_vkCmdSetDeviceMask)(VkCommandBuffer commandBuffer, uint32_t deviceMask); -typedef void (GLAD_API_PTR *PFN_vkCmdSetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask); -typedef void (GLAD_API_PTR *PFN_vkCmdSetLineWidth)(VkCommandBuffer commandBuffer, float lineWidth); -typedef void (GLAD_API_PTR *PFN_vkCmdSetScissor)(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D * pScissors); -typedef void (GLAD_API_PTR *PFN_vkCmdSetStencilCompareMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask); -typedef void (GLAD_API_PTR *PFN_vkCmdSetStencilReference)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference); -typedef void (GLAD_API_PTR *PFN_vkCmdSetStencilWriteMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask); -typedef void (GLAD_API_PTR *PFN_vkCmdSetViewport)(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport * pViewports); -typedef void (GLAD_API_PTR *PFN_vkCmdUpdateBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void * pData); -typedef void (GLAD_API_PTR *PFN_vkCmdWaitEvents)(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent * pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier * pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier * pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier * pImageMemoryBarriers); -typedef void (GLAD_API_PTR *PFN_vkCmdWriteTimestamp)(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateBuffer)(VkDevice device, const VkBufferCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkBuffer * pBuffer); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateBufferView)(VkDevice device, const VkBufferViewCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkBufferView * pView); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateCommandPool)(VkDevice device, const VkCommandPoolCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkCommandPool * pCommandPool); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateComputePipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo * pCreateInfos, const VkAllocationCallbacks * pAllocator, VkPipeline * pPipelines); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateDebugReportCallbackEXT)(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkDebugReportCallbackEXT * pCallback); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateDescriptorPool)(VkDevice device, const VkDescriptorPoolCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkDescriptorPool * pDescriptorPool); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateDescriptorSetLayout)(VkDevice device, const VkDescriptorSetLayoutCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkDescriptorSetLayout * pSetLayout); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateDescriptorUpdateTemplate)(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkDescriptorUpdateTemplate * pDescriptorUpdateTemplate); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateDevice)(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkDevice * pDevice); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateEvent)(VkDevice device, const VkEventCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkEvent * pEvent); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateFence)(VkDevice device, const VkFenceCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkFence * pFence); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateFramebuffer)(VkDevice device, const VkFramebufferCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkFramebuffer * pFramebuffer); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateGraphicsPipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo * pCreateInfos, const VkAllocationCallbacks * pAllocator, VkPipeline * pPipelines); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateImage)(VkDevice device, const VkImageCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkImage * pImage); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateImageView)(VkDevice device, const VkImageViewCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkImageView * pView); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateInstance)(const VkInstanceCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkInstance * pInstance); -typedef VkResult (GLAD_API_PTR *PFN_vkCreatePipelineCache)(VkDevice device, const VkPipelineCacheCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkPipelineCache * pPipelineCache); -typedef VkResult (GLAD_API_PTR *PFN_vkCreatePipelineLayout)(VkDevice device, const VkPipelineLayoutCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkPipelineLayout * pPipelineLayout); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateQueryPool)(VkDevice device, const VkQueryPoolCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkQueryPool * pQueryPool); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateRenderPass)(VkDevice device, const VkRenderPassCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkRenderPass * pRenderPass); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateSampler)(VkDevice device, const VkSamplerCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkSampler * pSampler); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateSamplerYcbcrConversion)(VkDevice device, const VkSamplerYcbcrConversionCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkSamplerYcbcrConversion * pYcbcrConversion); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateSemaphore)(VkDevice device, const VkSemaphoreCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkSemaphore * pSemaphore); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateShaderModule)(VkDevice device, const VkShaderModuleCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkShaderModule * pShaderModule); -typedef VkResult (GLAD_API_PTR *PFN_vkCreateSwapchainKHR)(VkDevice device, const VkSwapchainCreateInfoKHR * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkSwapchainKHR * pSwapchain); -typedef void (GLAD_API_PTR *PFN_vkDebugReportMessageEXT)(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char * pLayerPrefix, const char * pMessage); -typedef void (GLAD_API_PTR *PFN_vkDestroyBuffer)(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyBufferView)(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyCommandPool)(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyDescriptorSetLayout)(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyDescriptorUpdateTemplate)(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyDevice)(VkDevice device, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyEvent)(VkDevice device, VkEvent event, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyFence)(VkDevice device, VkFence fence, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyFramebuffer)(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyImage)(VkDevice device, VkImage image, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyImageView)(VkDevice device, VkImageView imageView, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyInstance)(VkInstance instance, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyPipeline)(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyPipelineCache)(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyPipelineLayout)(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyQueryPool)(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyRenderPass)(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroySampler)(VkDevice device, VkSampler sampler, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroySamplerYcbcrConversion)(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroySemaphore)(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroyShaderModule)(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroySurfaceKHR)(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkDestroySwapchainKHR)(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks * pAllocator); -typedef VkResult (GLAD_API_PTR *PFN_vkDeviceWaitIdle)(VkDevice device); -typedef VkResult (GLAD_API_PTR *PFN_vkEndCommandBuffer)(VkCommandBuffer commandBuffer); -typedef VkResult (GLAD_API_PTR *PFN_vkEnumerateDeviceExtensionProperties)(VkPhysicalDevice physicalDevice, const char * pLayerName, uint32_t * pPropertyCount, VkExtensionProperties * pProperties); -typedef VkResult (GLAD_API_PTR *PFN_vkEnumerateDeviceLayerProperties)(VkPhysicalDevice physicalDevice, uint32_t * pPropertyCount, VkLayerProperties * pProperties); -typedef VkResult (GLAD_API_PTR *PFN_vkEnumerateInstanceExtensionProperties)(const char * pLayerName, uint32_t * pPropertyCount, VkExtensionProperties * pProperties); -typedef VkResult (GLAD_API_PTR *PFN_vkEnumerateInstanceLayerProperties)(uint32_t * pPropertyCount, VkLayerProperties * pProperties); -typedef VkResult (GLAD_API_PTR *PFN_vkEnumerateInstanceVersion)(uint32_t * pApiVersion); -typedef VkResult (GLAD_API_PTR *PFN_vkEnumeratePhysicalDeviceGroups)(VkInstance instance, uint32_t * pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties * pPhysicalDeviceGroupProperties); -typedef VkResult (GLAD_API_PTR *PFN_vkEnumeratePhysicalDevices)(VkInstance instance, uint32_t * pPhysicalDeviceCount, VkPhysicalDevice * pPhysicalDevices); -typedef VkResult (GLAD_API_PTR *PFN_vkFlushMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange * pMemoryRanges); -typedef void (GLAD_API_PTR *PFN_vkFreeCommandBuffers)(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer * pCommandBuffers); -typedef VkResult (GLAD_API_PTR *PFN_vkFreeDescriptorSets)(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet * pDescriptorSets); -typedef void (GLAD_API_PTR *PFN_vkFreeMemory)(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks * pAllocator); -typedef void (GLAD_API_PTR *PFN_vkGetBufferMemoryRequirements)(VkDevice device, VkBuffer buffer, VkMemoryRequirements * pMemoryRequirements); -typedef void (GLAD_API_PTR *PFN_vkGetBufferMemoryRequirements2)(VkDevice device, const VkBufferMemoryRequirementsInfo2 * pInfo, VkMemoryRequirements2 * pMemoryRequirements); -typedef void (GLAD_API_PTR *PFN_vkGetDescriptorSetLayoutSupport)(VkDevice device, const VkDescriptorSetLayoutCreateInfo * pCreateInfo, VkDescriptorSetLayoutSupport * pSupport); -typedef void (GLAD_API_PTR *PFN_vkGetDeviceGroupPeerMemoryFeatures)(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags * pPeerMemoryFeatures); -typedef VkResult (GLAD_API_PTR *PFN_vkGetDeviceGroupPresentCapabilitiesKHR)(VkDevice device, VkDeviceGroupPresentCapabilitiesKHR * pDeviceGroupPresentCapabilities); -typedef VkResult (GLAD_API_PTR *PFN_vkGetDeviceGroupSurfacePresentModesKHR)(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHR * pModes); -typedef void (GLAD_API_PTR *PFN_vkGetDeviceMemoryCommitment)(VkDevice device, VkDeviceMemory memory, VkDeviceSize * pCommittedMemoryInBytes); -typedef PFN_vkVoidFunction (GLAD_API_PTR *PFN_vkGetDeviceProcAddr)(VkDevice device, const char * pName); -typedef void (GLAD_API_PTR *PFN_vkGetDeviceQueue)(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue * pQueue); -typedef void (GLAD_API_PTR *PFN_vkGetDeviceQueue2)(VkDevice device, const VkDeviceQueueInfo2 * pQueueInfo, VkQueue * pQueue); -typedef VkResult (GLAD_API_PTR *PFN_vkGetEventStatus)(VkDevice device, VkEvent event); -typedef VkResult (GLAD_API_PTR *PFN_vkGetFenceStatus)(VkDevice device, VkFence fence); -typedef void (GLAD_API_PTR *PFN_vkGetImageMemoryRequirements)(VkDevice device, VkImage image, VkMemoryRequirements * pMemoryRequirements); -typedef void (GLAD_API_PTR *PFN_vkGetImageMemoryRequirements2)(VkDevice device, const VkImageMemoryRequirementsInfo2 * pInfo, VkMemoryRequirements2 * pMemoryRequirements); -typedef void (GLAD_API_PTR *PFN_vkGetImageSparseMemoryRequirements)(VkDevice device, VkImage image, uint32_t * pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements * pSparseMemoryRequirements); -typedef void (GLAD_API_PTR *PFN_vkGetImageSparseMemoryRequirements2)(VkDevice device, const VkImageSparseMemoryRequirementsInfo2 * pInfo, uint32_t * pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 * pSparseMemoryRequirements); -typedef void (GLAD_API_PTR *PFN_vkGetImageSubresourceLayout)(VkDevice device, VkImage image, const VkImageSubresource * pSubresource, VkSubresourceLayout * pLayout); -typedef PFN_vkVoidFunction (GLAD_API_PTR *PFN_vkGetInstanceProcAddr)(VkInstance instance, const char * pName); -typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceExternalBufferProperties)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo * pExternalBufferInfo, VkExternalBufferProperties * pExternalBufferProperties); -typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceExternalFenceProperties)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo * pExternalFenceInfo, VkExternalFenceProperties * pExternalFenceProperties); -typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceExternalSemaphoreProperties)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo * pExternalSemaphoreInfo, VkExternalSemaphoreProperties * pExternalSemaphoreProperties); -typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceFeatures)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures * pFeatures); -typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceFeatures2)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2 * pFeatures); -typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties * pFormatProperties); -typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceFormatProperties2)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2 * pFormatProperties); -typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties * pImageFormatProperties); -typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties2)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 * pImageFormatInfo, VkImageFormatProperties2 * pImageFormatProperties); -typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceMemoryProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties * pMemoryProperties); -typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceMemoryProperties2)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2 * pMemoryProperties); -typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDevicePresentRectanglesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t * pRectCount, VkRect2D * pRects); -typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties * pProperties); -typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceProperties2)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 * pProperties); -typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties)(VkPhysicalDevice physicalDevice, uint32_t * pQueueFamilyPropertyCount, VkQueueFamilyProperties * pQueueFamilyProperties); -typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties2)(VkPhysicalDevice physicalDevice, uint32_t * pQueueFamilyPropertyCount, VkQueueFamilyProperties2 * pQueueFamilyProperties); -typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t * pPropertyCount, VkSparseImageFormatProperties * pProperties); -typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties2)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 * pFormatInfo, uint32_t * pPropertyCount, VkSparseImageFormatProperties2 * pProperties); -typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR * pSurfaceCapabilities); -typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t * pSurfaceFormatCount, VkSurfaceFormatKHR * pSurfaceFormats); -typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t * pPresentModeCount, VkPresentModeKHR * pPresentModes); -typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32 * pSupported); -typedef VkResult (GLAD_API_PTR *PFN_vkGetPipelineCacheData)(VkDevice device, VkPipelineCache pipelineCache, size_t * pDataSize, void * pData); -typedef VkResult (GLAD_API_PTR *PFN_vkGetQueryPoolResults)(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void * pData, VkDeviceSize stride, VkQueryResultFlags flags); -typedef void (GLAD_API_PTR *PFN_vkGetRenderAreaGranularity)(VkDevice device, VkRenderPass renderPass, VkExtent2D * pGranularity); -typedef VkResult (GLAD_API_PTR *PFN_vkGetSwapchainImagesKHR)(VkDevice device, VkSwapchainKHR swapchain, uint32_t * pSwapchainImageCount, VkImage * pSwapchainImages); -typedef VkResult (GLAD_API_PTR *PFN_vkInvalidateMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange * pMemoryRanges); -typedef VkResult (GLAD_API_PTR *PFN_vkMapMemory)(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void ** ppData); -typedef VkResult (GLAD_API_PTR *PFN_vkMergePipelineCaches)(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache * pSrcCaches); -typedef VkResult (GLAD_API_PTR *PFN_vkQueueBindSparse)(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo * pBindInfo, VkFence fence); -typedef VkResult (GLAD_API_PTR *PFN_vkQueuePresentKHR)(VkQueue queue, const VkPresentInfoKHR * pPresentInfo); -typedef VkResult (GLAD_API_PTR *PFN_vkQueueSubmit)(VkQueue queue, uint32_t submitCount, const VkSubmitInfo * pSubmits, VkFence fence); -typedef VkResult (GLAD_API_PTR *PFN_vkQueueWaitIdle)(VkQueue queue); -typedef VkResult (GLAD_API_PTR *PFN_vkResetCommandBuffer)(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags); -typedef VkResult (GLAD_API_PTR *PFN_vkResetCommandPool)(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags); -typedef VkResult (GLAD_API_PTR *PFN_vkResetDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags); -typedef VkResult (GLAD_API_PTR *PFN_vkResetEvent)(VkDevice device, VkEvent event); -typedef VkResult (GLAD_API_PTR *PFN_vkResetFences)(VkDevice device, uint32_t fenceCount, const VkFence * pFences); -typedef VkResult (GLAD_API_PTR *PFN_vkSetEvent)(VkDevice device, VkEvent event); -typedef void (GLAD_API_PTR *PFN_vkTrimCommandPool)(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags); -typedef void (GLAD_API_PTR *PFN_vkUnmapMemory)(VkDevice device, VkDeviceMemory memory); -typedef void (GLAD_API_PTR *PFN_vkUpdateDescriptorSetWithTemplate)(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void * pData); -typedef void (GLAD_API_PTR *PFN_vkUpdateDescriptorSets)(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet * pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet * pDescriptorCopies); -typedef VkResult (GLAD_API_PTR *PFN_vkWaitForFences)(VkDevice device, uint32_t fenceCount, const VkFence * pFences, VkBool32 waitAll, uint64_t timeout); +typedef VkResult (GLAD_API_PTR *PFN_vkAcquireNextImage2KHR)(VkDevice device, const VkAcquireNextImageInfoKHR * pAcquireInfo, uint32_t * pImageIndex); +typedef VkResult (GLAD_API_PTR *PFN_vkAcquireNextImageKHR)(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t * pImageIndex); +typedef VkResult (GLAD_API_PTR *PFN_vkAllocateCommandBuffers)(VkDevice device, const VkCommandBufferAllocateInfo * pAllocateInfo, VkCommandBuffer * pCommandBuffers); +typedef VkResult (GLAD_API_PTR *PFN_vkAllocateDescriptorSets)(VkDevice device, const VkDescriptorSetAllocateInfo * pAllocateInfo, VkDescriptorSet * pDescriptorSets); +typedef VkResult (GLAD_API_PTR *PFN_vkAllocateMemory)(VkDevice device, const VkMemoryAllocateInfo * pAllocateInfo, const VkAllocationCallbacks * pAllocator, VkDeviceMemory * pMemory); +typedef VkResult (GLAD_API_PTR *PFN_vkBeginCommandBuffer)(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo * pBeginInfo); +typedef VkResult (GLAD_API_PTR *PFN_vkBindBufferMemory)(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset); +typedef VkResult (GLAD_API_PTR *PFN_vkBindBufferMemory2)(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo * pBindInfos); +typedef VkResult (GLAD_API_PTR *PFN_vkBindImageMemory)(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset); +typedef VkResult (GLAD_API_PTR *PFN_vkBindImageMemory2)(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo * pBindInfos); +typedef void (GLAD_API_PTR *PFN_vkCmdBeginQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags); +typedef void (GLAD_API_PTR *PFN_vkCmdBeginRenderPass)(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo * pRenderPassBegin, VkSubpassContents contents); +typedef void (GLAD_API_PTR *PFN_vkCmdBeginRenderPass2)(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo * pRenderPassBegin, const VkSubpassBeginInfo * pSubpassBeginInfo); +typedef void (GLAD_API_PTR *PFN_vkCmdBeginRendering)(VkCommandBuffer commandBuffer, const VkRenderingInfo * pRenderingInfo); +typedef void (GLAD_API_PTR *PFN_vkCmdBindDescriptorSets)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet * pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t * pDynamicOffsets); +typedef void (GLAD_API_PTR *PFN_vkCmdBindIndexBuffer)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType); +typedef void (GLAD_API_PTR *PFN_vkCmdBindPipeline)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline); +typedef void (GLAD_API_PTR *PFN_vkCmdBindVertexBuffers)(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer * pBuffers, const VkDeviceSize * pOffsets); +typedef void (GLAD_API_PTR *PFN_vkCmdBindVertexBuffers2)(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer * pBuffers, const VkDeviceSize * pOffsets, const VkDeviceSize * pSizes, const VkDeviceSize * pStrides); +typedef void (GLAD_API_PTR *PFN_vkCmdBlitImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit * pRegions, VkFilter filter); +typedef void (GLAD_API_PTR *PFN_vkCmdBlitImage2)(VkCommandBuffer commandBuffer, const VkBlitImageInfo2 * pBlitImageInfo); +typedef void (GLAD_API_PTR *PFN_vkCmdClearAttachments)(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment * pAttachments, uint32_t rectCount, const VkClearRect * pRects); +typedef void (GLAD_API_PTR *PFN_vkCmdClearColorImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue * pColor, uint32_t rangeCount, const VkImageSubresourceRange * pRanges); +typedef void (GLAD_API_PTR *PFN_vkCmdClearDepthStencilImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue * pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange * pRanges); +typedef void (GLAD_API_PTR *PFN_vkCmdCopyBuffer)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy * pRegions); +typedef void (GLAD_API_PTR *PFN_vkCmdCopyBuffer2)(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2 * pCopyBufferInfo); +typedef void (GLAD_API_PTR *PFN_vkCmdCopyBufferToImage)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy * pRegions); +typedef void (GLAD_API_PTR *PFN_vkCmdCopyBufferToImage2)(VkCommandBuffer commandBuffer, const VkCopyBufferToImageInfo2 * pCopyBufferToImageInfo); +typedef void (GLAD_API_PTR *PFN_vkCmdCopyImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy * pRegions); +typedef void (GLAD_API_PTR *PFN_vkCmdCopyImage2)(VkCommandBuffer commandBuffer, const VkCopyImageInfo2 * pCopyImageInfo); +typedef void (GLAD_API_PTR *PFN_vkCmdCopyImageToBuffer)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy * pRegions); +typedef void (GLAD_API_PTR *PFN_vkCmdCopyImageToBuffer2)(VkCommandBuffer commandBuffer, const VkCopyImageToBufferInfo2 * pCopyImageToBufferInfo); +typedef void (GLAD_API_PTR *PFN_vkCmdCopyQueryPoolResults)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags); +typedef void (GLAD_API_PTR *PFN_vkCmdDispatch)(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); +typedef void (GLAD_API_PTR *PFN_vkCmdDispatchBase)(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); +typedef void (GLAD_API_PTR *PFN_vkCmdDispatchIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset); +typedef void (GLAD_API_PTR *PFN_vkCmdDraw)(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance); +typedef void (GLAD_API_PTR *PFN_vkCmdDrawIndexed)(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance); +typedef void (GLAD_API_PTR *PFN_vkCmdDrawIndexedIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); +typedef void (GLAD_API_PTR *PFN_vkCmdDrawIndexedIndirectCount)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); +typedef void (GLAD_API_PTR *PFN_vkCmdDrawIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); +typedef void (GLAD_API_PTR *PFN_vkCmdDrawIndirectCount)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); +typedef void (GLAD_API_PTR *PFN_vkCmdEndQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query); +typedef void (GLAD_API_PTR *PFN_vkCmdEndRenderPass)(VkCommandBuffer commandBuffer); +typedef void (GLAD_API_PTR *PFN_vkCmdEndRenderPass2)(VkCommandBuffer commandBuffer, const VkSubpassEndInfo * pSubpassEndInfo); +typedef void (GLAD_API_PTR *PFN_vkCmdEndRendering)(VkCommandBuffer commandBuffer); +typedef void (GLAD_API_PTR *PFN_vkCmdExecuteCommands)(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer * pCommandBuffers); +typedef void (GLAD_API_PTR *PFN_vkCmdFillBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data); +typedef void (GLAD_API_PTR *PFN_vkCmdNextSubpass)(VkCommandBuffer commandBuffer, VkSubpassContents contents); +typedef void (GLAD_API_PTR *PFN_vkCmdNextSubpass2)(VkCommandBuffer commandBuffer, const VkSubpassBeginInfo * pSubpassBeginInfo, const VkSubpassEndInfo * pSubpassEndInfo); +typedef void (GLAD_API_PTR *PFN_vkCmdPipelineBarrier)(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier * pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier * pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier * pImageMemoryBarriers); +typedef void (GLAD_API_PTR *PFN_vkCmdPipelineBarrier2)(VkCommandBuffer commandBuffer, const VkDependencyInfo * pDependencyInfo); +typedef void (GLAD_API_PTR *PFN_vkCmdPushConstants)(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void * pValues); +typedef void (GLAD_API_PTR *PFN_vkCmdResetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask); +typedef void (GLAD_API_PTR *PFN_vkCmdResetEvent2)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags2 stageMask); +typedef void (GLAD_API_PTR *PFN_vkCmdResetQueryPool)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount); +typedef void (GLAD_API_PTR *PFN_vkCmdResolveImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve * pRegions); +typedef void (GLAD_API_PTR *PFN_vkCmdResolveImage2)(VkCommandBuffer commandBuffer, const VkResolveImageInfo2 * pResolveImageInfo); +typedef void (GLAD_API_PTR *PFN_vkCmdSetBlendConstants)(VkCommandBuffer commandBuffer, const float blendConstants [4]); +typedef void (GLAD_API_PTR *PFN_vkCmdSetCullMode)(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode); +typedef void (GLAD_API_PTR *PFN_vkCmdSetDepthBias)(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor); +typedef void (GLAD_API_PTR *PFN_vkCmdSetDepthBiasEnable)(VkCommandBuffer commandBuffer, VkBool32 depthBiasEnable); +typedef void (GLAD_API_PTR *PFN_vkCmdSetDepthBounds)(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds); +typedef void (GLAD_API_PTR *PFN_vkCmdSetDepthBoundsTestEnable)(VkCommandBuffer commandBuffer, VkBool32 depthBoundsTestEnable); +typedef void (GLAD_API_PTR *PFN_vkCmdSetDepthCompareOp)(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp); +typedef void (GLAD_API_PTR *PFN_vkCmdSetDepthTestEnable)(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable); +typedef void (GLAD_API_PTR *PFN_vkCmdSetDepthWriteEnable)(VkCommandBuffer commandBuffer, VkBool32 depthWriteEnable); +typedef void (GLAD_API_PTR *PFN_vkCmdSetDeviceMask)(VkCommandBuffer commandBuffer, uint32_t deviceMask); +typedef void (GLAD_API_PTR *PFN_vkCmdSetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask); +typedef void (GLAD_API_PTR *PFN_vkCmdSetEvent2)(VkCommandBuffer commandBuffer, VkEvent event, const VkDependencyInfo * pDependencyInfo); +typedef void (GLAD_API_PTR *PFN_vkCmdSetFrontFace)(VkCommandBuffer commandBuffer, VkFrontFace frontFace); +typedef void (GLAD_API_PTR *PFN_vkCmdSetLineWidth)(VkCommandBuffer commandBuffer, float lineWidth); +typedef void (GLAD_API_PTR *PFN_vkCmdSetPrimitiveRestartEnable)(VkCommandBuffer commandBuffer, VkBool32 primitiveRestartEnable); +typedef void (GLAD_API_PTR *PFN_vkCmdSetPrimitiveTopology)(VkCommandBuffer commandBuffer, VkPrimitiveTopology primitiveTopology); +typedef void (GLAD_API_PTR *PFN_vkCmdSetRasterizerDiscardEnable)(VkCommandBuffer commandBuffer, VkBool32 rasterizerDiscardEnable); +typedef void (GLAD_API_PTR *PFN_vkCmdSetScissor)(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D * pScissors); +typedef void (GLAD_API_PTR *PFN_vkCmdSetScissorWithCount)(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D * pScissors); +typedef void (GLAD_API_PTR *PFN_vkCmdSetStencilCompareMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask); +typedef void (GLAD_API_PTR *PFN_vkCmdSetStencilOp)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, VkStencilOp failOp, VkStencilOp passOp, VkStencilOp depthFailOp, VkCompareOp compareOp); +typedef void (GLAD_API_PTR *PFN_vkCmdSetStencilReference)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference); +typedef void (GLAD_API_PTR *PFN_vkCmdSetStencilTestEnable)(VkCommandBuffer commandBuffer, VkBool32 stencilTestEnable); +typedef void (GLAD_API_PTR *PFN_vkCmdSetStencilWriteMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask); +typedef void (GLAD_API_PTR *PFN_vkCmdSetViewport)(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport * pViewports); +typedef void (GLAD_API_PTR *PFN_vkCmdSetViewportWithCount)(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport * pViewports); +typedef void (GLAD_API_PTR *PFN_vkCmdUpdateBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void * pData); +typedef void (GLAD_API_PTR *PFN_vkCmdWaitEvents)(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent * pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier * pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier * pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier * pImageMemoryBarriers); +typedef void (GLAD_API_PTR *PFN_vkCmdWaitEvents2)(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent * pEvents, const VkDependencyInfo * pDependencyInfos); +typedef void (GLAD_API_PTR *PFN_vkCmdWriteTimestamp)(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query); +typedef void (GLAD_API_PTR *PFN_vkCmdWriteTimestamp2)(VkCommandBuffer commandBuffer, VkPipelineStageFlags2 stage, VkQueryPool queryPool, uint32_t query); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateBuffer)(VkDevice device, const VkBufferCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkBuffer * pBuffer); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateBufferView)(VkDevice device, const VkBufferViewCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkBufferView * pView); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateCommandPool)(VkDevice device, const VkCommandPoolCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkCommandPool * pCommandPool); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateComputePipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo * pCreateInfos, const VkAllocationCallbacks * pAllocator, VkPipeline * pPipelines); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateDebugReportCallbackEXT)(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkDebugReportCallbackEXT * pCallback); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateDescriptorPool)(VkDevice device, const VkDescriptorPoolCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkDescriptorPool * pDescriptorPool); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateDescriptorSetLayout)(VkDevice device, const VkDescriptorSetLayoutCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkDescriptorSetLayout * pSetLayout); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateDescriptorUpdateTemplate)(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkDescriptorUpdateTemplate * pDescriptorUpdateTemplate); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateDevice)(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkDevice * pDevice); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateEvent)(VkDevice device, const VkEventCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkEvent * pEvent); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateFence)(VkDevice device, const VkFenceCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkFence * pFence); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateFramebuffer)(VkDevice device, const VkFramebufferCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkFramebuffer * pFramebuffer); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateGraphicsPipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo * pCreateInfos, const VkAllocationCallbacks * pAllocator, VkPipeline * pPipelines); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateImage)(VkDevice device, const VkImageCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkImage * pImage); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateImageView)(VkDevice device, const VkImageViewCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkImageView * pView); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateInstance)(const VkInstanceCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkInstance * pInstance); +typedef VkResult (GLAD_API_PTR *PFN_vkCreatePipelineCache)(VkDevice device, const VkPipelineCacheCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkPipelineCache * pPipelineCache); +typedef VkResult (GLAD_API_PTR *PFN_vkCreatePipelineLayout)(VkDevice device, const VkPipelineLayoutCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkPipelineLayout * pPipelineLayout); +typedef VkResult (GLAD_API_PTR *PFN_vkCreatePrivateDataSlot)(VkDevice device, const VkPrivateDataSlotCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkPrivateDataSlot * pPrivateDataSlot); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateQueryPool)(VkDevice device, const VkQueryPoolCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkQueryPool * pQueryPool); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateRenderPass)(VkDevice device, const VkRenderPassCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkRenderPass * pRenderPass); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateRenderPass2)(VkDevice device, const VkRenderPassCreateInfo2 * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkRenderPass * pRenderPass); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateSampler)(VkDevice device, const VkSamplerCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkSampler * pSampler); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateSamplerYcbcrConversion)(VkDevice device, const VkSamplerYcbcrConversionCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkSamplerYcbcrConversion * pYcbcrConversion); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateSemaphore)(VkDevice device, const VkSemaphoreCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkSemaphore * pSemaphore); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateShaderModule)(VkDevice device, const VkShaderModuleCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkShaderModule * pShaderModule); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateSwapchainKHR)(VkDevice device, const VkSwapchainCreateInfoKHR * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkSwapchainKHR * pSwapchain); +typedef void (GLAD_API_PTR *PFN_vkDebugReportMessageEXT)(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char * pLayerPrefix, const char * pMessage); +typedef void (GLAD_API_PTR *PFN_vkDestroyBuffer)(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyBufferView)(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyCommandPool)(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyDescriptorSetLayout)(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyDescriptorUpdateTemplate)(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyDevice)(VkDevice device, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyEvent)(VkDevice device, VkEvent event, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyFence)(VkDevice device, VkFence fence, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyFramebuffer)(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyImage)(VkDevice device, VkImage image, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyImageView)(VkDevice device, VkImageView imageView, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyInstance)(VkInstance instance, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyPipeline)(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyPipelineCache)(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyPipelineLayout)(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyPrivateDataSlot)(VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyQueryPool)(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyRenderPass)(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroySampler)(VkDevice device, VkSampler sampler, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroySamplerYcbcrConversion)(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroySemaphore)(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyShaderModule)(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroySurfaceKHR)(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroySwapchainKHR)(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks * pAllocator); +typedef VkResult (GLAD_API_PTR *PFN_vkDeviceWaitIdle)(VkDevice device); +typedef VkResult (GLAD_API_PTR *PFN_vkEndCommandBuffer)(VkCommandBuffer commandBuffer); +typedef VkResult (GLAD_API_PTR *PFN_vkEnumerateDeviceExtensionProperties)(VkPhysicalDevice physicalDevice, const char * pLayerName, uint32_t * pPropertyCount, VkExtensionProperties * pProperties); +typedef VkResult (GLAD_API_PTR *PFN_vkEnumerateDeviceLayerProperties)(VkPhysicalDevice physicalDevice, uint32_t * pPropertyCount, VkLayerProperties * pProperties); +typedef VkResult (GLAD_API_PTR *PFN_vkEnumerateInstanceExtensionProperties)(const char * pLayerName, uint32_t * pPropertyCount, VkExtensionProperties * pProperties); +typedef VkResult (GLAD_API_PTR *PFN_vkEnumerateInstanceLayerProperties)(uint32_t * pPropertyCount, VkLayerProperties * pProperties); +typedef VkResult (GLAD_API_PTR *PFN_vkEnumerateInstanceVersion)(uint32_t * pApiVersion); +typedef VkResult (GLAD_API_PTR *PFN_vkEnumeratePhysicalDeviceGroups)(VkInstance instance, uint32_t * pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties * pPhysicalDeviceGroupProperties); +typedef VkResult (GLAD_API_PTR *PFN_vkEnumeratePhysicalDevices)(VkInstance instance, uint32_t * pPhysicalDeviceCount, VkPhysicalDevice * pPhysicalDevices); +typedef VkResult (GLAD_API_PTR *PFN_vkFlushMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange * pMemoryRanges); +typedef void (GLAD_API_PTR *PFN_vkFreeCommandBuffers)(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer * pCommandBuffers); +typedef VkResult (GLAD_API_PTR *PFN_vkFreeDescriptorSets)(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet * pDescriptorSets); +typedef void (GLAD_API_PTR *PFN_vkFreeMemory)(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks * pAllocator); +typedef VkDeviceAddress (GLAD_API_PTR *PFN_vkGetBufferDeviceAddress)(VkDevice device, const VkBufferDeviceAddressInfo * pInfo); +typedef void (GLAD_API_PTR *PFN_vkGetBufferMemoryRequirements)(VkDevice device, VkBuffer buffer, VkMemoryRequirements * pMemoryRequirements); +typedef void (GLAD_API_PTR *PFN_vkGetBufferMemoryRequirements2)(VkDevice device, const VkBufferMemoryRequirementsInfo2 * pInfo, VkMemoryRequirements2 * pMemoryRequirements); +typedef uint64_t (GLAD_API_PTR *PFN_vkGetBufferOpaqueCaptureAddress)(VkDevice device, const VkBufferDeviceAddressInfo * pInfo); +typedef void (GLAD_API_PTR *PFN_vkGetDescriptorSetLayoutSupport)(VkDevice device, const VkDescriptorSetLayoutCreateInfo * pCreateInfo, VkDescriptorSetLayoutSupport * pSupport); +typedef void (GLAD_API_PTR *PFN_vkGetDeviceBufferMemoryRequirements)(VkDevice device, const VkDeviceBufferMemoryRequirements * pInfo, VkMemoryRequirements2 * pMemoryRequirements); +typedef void (GLAD_API_PTR *PFN_vkGetDeviceGroupPeerMemoryFeatures)(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags * pPeerMemoryFeatures); +typedef VkResult (GLAD_API_PTR *PFN_vkGetDeviceGroupPresentCapabilitiesKHR)(VkDevice device, VkDeviceGroupPresentCapabilitiesKHR * pDeviceGroupPresentCapabilities); +typedef VkResult (GLAD_API_PTR *PFN_vkGetDeviceGroupSurfacePresentModesKHR)(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHR * pModes); +typedef void (GLAD_API_PTR *PFN_vkGetDeviceImageMemoryRequirements)(VkDevice device, const VkDeviceImageMemoryRequirements * pInfo, VkMemoryRequirements2 * pMemoryRequirements); +typedef void (GLAD_API_PTR *PFN_vkGetDeviceImageSparseMemoryRequirements)(VkDevice device, const VkDeviceImageMemoryRequirements * pInfo, uint32_t * pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 * pSparseMemoryRequirements); +typedef void (GLAD_API_PTR *PFN_vkGetDeviceMemoryCommitment)(VkDevice device, VkDeviceMemory memory, VkDeviceSize * pCommittedMemoryInBytes); +typedef uint64_t (GLAD_API_PTR *PFN_vkGetDeviceMemoryOpaqueCaptureAddress)(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo * pInfo); +typedef PFN_vkVoidFunction (GLAD_API_PTR *PFN_vkGetDeviceProcAddr)(VkDevice device, const char * pName); +typedef void (GLAD_API_PTR *PFN_vkGetDeviceQueue)(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue * pQueue); +typedef void (GLAD_API_PTR *PFN_vkGetDeviceQueue2)(VkDevice device, const VkDeviceQueueInfo2 * pQueueInfo, VkQueue * pQueue); +typedef VkResult (GLAD_API_PTR *PFN_vkGetEventStatus)(VkDevice device, VkEvent event); +typedef VkResult (GLAD_API_PTR *PFN_vkGetFenceStatus)(VkDevice device, VkFence fence); +typedef void (GLAD_API_PTR *PFN_vkGetImageMemoryRequirements)(VkDevice device, VkImage image, VkMemoryRequirements * pMemoryRequirements); +typedef void (GLAD_API_PTR *PFN_vkGetImageMemoryRequirements2)(VkDevice device, const VkImageMemoryRequirementsInfo2 * pInfo, VkMemoryRequirements2 * pMemoryRequirements); +typedef void (GLAD_API_PTR *PFN_vkGetImageSparseMemoryRequirements)(VkDevice device, VkImage image, uint32_t * pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements * pSparseMemoryRequirements); +typedef void (GLAD_API_PTR *PFN_vkGetImageSparseMemoryRequirements2)(VkDevice device, const VkImageSparseMemoryRequirementsInfo2 * pInfo, uint32_t * pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 * pSparseMemoryRequirements); +typedef void (GLAD_API_PTR *PFN_vkGetImageSubresourceLayout)(VkDevice device, VkImage image, const VkImageSubresource * pSubresource, VkSubresourceLayout * pLayout); +typedef PFN_vkVoidFunction (GLAD_API_PTR *PFN_vkGetInstanceProcAddr)(VkInstance instance, const char * pName); +typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceExternalBufferProperties)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo * pExternalBufferInfo, VkExternalBufferProperties * pExternalBufferProperties); +typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceExternalFenceProperties)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo * pExternalFenceInfo, VkExternalFenceProperties * pExternalFenceProperties); +typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceExternalSemaphoreProperties)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo * pExternalSemaphoreInfo, VkExternalSemaphoreProperties * pExternalSemaphoreProperties); +typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceFeatures)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures * pFeatures); +typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceFeatures2)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2 * pFeatures); +typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties * pFormatProperties); +typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceFormatProperties2)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2 * pFormatProperties); +typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties * pImageFormatProperties); +typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties2)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 * pImageFormatInfo, VkImageFormatProperties2 * pImageFormatProperties); +typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceMemoryProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties * pMemoryProperties); +typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceMemoryProperties2)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2 * pMemoryProperties); +typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDevicePresentRectanglesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t * pRectCount, VkRect2D * pRects); +typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties * pProperties); +typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceProperties2)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 * pProperties); +typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties)(VkPhysicalDevice physicalDevice, uint32_t * pQueueFamilyPropertyCount, VkQueueFamilyProperties * pQueueFamilyProperties); +typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties2)(VkPhysicalDevice physicalDevice, uint32_t * pQueueFamilyPropertyCount, VkQueueFamilyProperties2 * pQueueFamilyProperties); +typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t * pPropertyCount, VkSparseImageFormatProperties * pProperties); +typedef void (GLAD_API_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties2)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 * pFormatInfo, uint32_t * pPropertyCount, VkSparseImageFormatProperties2 * pProperties); +typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR * pSurfaceCapabilities); +typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t * pSurfaceFormatCount, VkSurfaceFormatKHR * pSurfaceFormats); +typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t * pPresentModeCount, VkPresentModeKHR * pPresentModes); +typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32 * pSupported); +typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDeviceToolProperties)(VkPhysicalDevice physicalDevice, uint32_t * pToolCount, VkPhysicalDeviceToolProperties * pToolProperties); +typedef VkResult (GLAD_API_PTR *PFN_vkGetPipelineCacheData)(VkDevice device, VkPipelineCache pipelineCache, size_t * pDataSize, void * pData); +typedef void (GLAD_API_PTR *PFN_vkGetPrivateData)(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t * pData); +typedef VkResult (GLAD_API_PTR *PFN_vkGetQueryPoolResults)(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void * pData, VkDeviceSize stride, VkQueryResultFlags flags); +typedef void (GLAD_API_PTR *PFN_vkGetRenderAreaGranularity)(VkDevice device, VkRenderPass renderPass, VkExtent2D * pGranularity); +typedef VkResult (GLAD_API_PTR *PFN_vkGetSemaphoreCounterValue)(VkDevice device, VkSemaphore semaphore, uint64_t * pValue); +typedef VkResult (GLAD_API_PTR *PFN_vkGetSwapchainImagesKHR)(VkDevice device, VkSwapchainKHR swapchain, uint32_t * pSwapchainImageCount, VkImage * pSwapchainImages); +typedef VkResult (GLAD_API_PTR *PFN_vkInvalidateMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange * pMemoryRanges); +typedef VkResult (GLAD_API_PTR *PFN_vkMapMemory)(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void ** ppData); +typedef VkResult (GLAD_API_PTR *PFN_vkMergePipelineCaches)(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache * pSrcCaches); +typedef VkResult (GLAD_API_PTR *PFN_vkQueueBindSparse)(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo * pBindInfo, VkFence fence); +typedef VkResult (GLAD_API_PTR *PFN_vkQueuePresentKHR)(VkQueue queue, const VkPresentInfoKHR * pPresentInfo); +typedef VkResult (GLAD_API_PTR *PFN_vkQueueSubmit)(VkQueue queue, uint32_t submitCount, const VkSubmitInfo * pSubmits, VkFence fence); +typedef VkResult (GLAD_API_PTR *PFN_vkQueueSubmit2)(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2 * pSubmits, VkFence fence); +typedef VkResult (GLAD_API_PTR *PFN_vkQueueWaitIdle)(VkQueue queue); +typedef VkResult (GLAD_API_PTR *PFN_vkResetCommandBuffer)(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags); +typedef VkResult (GLAD_API_PTR *PFN_vkResetCommandPool)(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags); +typedef VkResult (GLAD_API_PTR *PFN_vkResetDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags); +typedef VkResult (GLAD_API_PTR *PFN_vkResetEvent)(VkDevice device, VkEvent event); +typedef VkResult (GLAD_API_PTR *PFN_vkResetFences)(VkDevice device, uint32_t fenceCount, const VkFence * pFences); +typedef void (GLAD_API_PTR *PFN_vkResetQueryPool)(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount); +typedef VkResult (GLAD_API_PTR *PFN_vkSetEvent)(VkDevice device, VkEvent event); +typedef VkResult (GLAD_API_PTR *PFN_vkSetPrivateData)(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data); +typedef VkResult (GLAD_API_PTR *PFN_vkSignalSemaphore)(VkDevice device, const VkSemaphoreSignalInfo * pSignalInfo); +typedef void (GLAD_API_PTR *PFN_vkTrimCommandPool)(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags); +typedef void (GLAD_API_PTR *PFN_vkUnmapMemory)(VkDevice device, VkDeviceMemory memory); +typedef void (GLAD_API_PTR *PFN_vkUpdateDescriptorSetWithTemplate)(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void * pData); +typedef void (GLAD_API_PTR *PFN_vkUpdateDescriptorSets)(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet * pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet * pDescriptorCopies); +typedef VkResult (GLAD_API_PTR *PFN_vkWaitForFences)(VkDevice device, uint32_t fenceCount, const VkFence * pFences, VkBool32 waitAll, uint64_t timeout); +typedef VkResult (GLAD_API_PTR *PFN_vkWaitSemaphores)(VkDevice device, const VkSemaphoreWaitInfo * pWaitInfo, uint64_t timeout); GLAD_API_CALL PFN_vkAcquireNextImage2KHR glad_vkAcquireNextImage2KHR; #define vkAcquireNextImage2KHR glad_vkAcquireNextImage2KHR @@ -3124,6 +5052,10 @@ GLAD_API_CALL PFN_vkCmdBeginQuery glad_vkCmdBeginQuery; #define vkCmdBeginQuery glad_vkCmdBeginQuery GLAD_API_CALL PFN_vkCmdBeginRenderPass glad_vkCmdBeginRenderPass; #define vkCmdBeginRenderPass glad_vkCmdBeginRenderPass +GLAD_API_CALL PFN_vkCmdBeginRenderPass2 glad_vkCmdBeginRenderPass2; +#define vkCmdBeginRenderPass2 glad_vkCmdBeginRenderPass2 +GLAD_API_CALL PFN_vkCmdBeginRendering glad_vkCmdBeginRendering; +#define vkCmdBeginRendering glad_vkCmdBeginRendering GLAD_API_CALL PFN_vkCmdBindDescriptorSets glad_vkCmdBindDescriptorSets; #define vkCmdBindDescriptorSets glad_vkCmdBindDescriptorSets GLAD_API_CALL PFN_vkCmdBindIndexBuffer glad_vkCmdBindIndexBuffer; @@ -3132,8 +5064,12 @@ GLAD_API_CALL PFN_vkCmdBindPipeline glad_vkCmdBindPipeline; #define vkCmdBindPipeline glad_vkCmdBindPipeline GLAD_API_CALL PFN_vkCmdBindVertexBuffers glad_vkCmdBindVertexBuffers; #define vkCmdBindVertexBuffers glad_vkCmdBindVertexBuffers +GLAD_API_CALL PFN_vkCmdBindVertexBuffers2 glad_vkCmdBindVertexBuffers2; +#define vkCmdBindVertexBuffers2 glad_vkCmdBindVertexBuffers2 GLAD_API_CALL PFN_vkCmdBlitImage glad_vkCmdBlitImage; #define vkCmdBlitImage glad_vkCmdBlitImage +GLAD_API_CALL PFN_vkCmdBlitImage2 glad_vkCmdBlitImage2; +#define vkCmdBlitImage2 glad_vkCmdBlitImage2 GLAD_API_CALL PFN_vkCmdClearAttachments glad_vkCmdClearAttachments; #define vkCmdClearAttachments glad_vkCmdClearAttachments GLAD_API_CALL PFN_vkCmdClearColorImage glad_vkCmdClearColorImage; @@ -3142,12 +5078,20 @@ GLAD_API_CALL PFN_vkCmdClearDepthStencilImage glad_vkCmdClearDepthStencilImage; #define vkCmdClearDepthStencilImage glad_vkCmdClearDepthStencilImage GLAD_API_CALL PFN_vkCmdCopyBuffer glad_vkCmdCopyBuffer; #define vkCmdCopyBuffer glad_vkCmdCopyBuffer +GLAD_API_CALL PFN_vkCmdCopyBuffer2 glad_vkCmdCopyBuffer2; +#define vkCmdCopyBuffer2 glad_vkCmdCopyBuffer2 GLAD_API_CALL PFN_vkCmdCopyBufferToImage glad_vkCmdCopyBufferToImage; #define vkCmdCopyBufferToImage glad_vkCmdCopyBufferToImage +GLAD_API_CALL PFN_vkCmdCopyBufferToImage2 glad_vkCmdCopyBufferToImage2; +#define vkCmdCopyBufferToImage2 glad_vkCmdCopyBufferToImage2 GLAD_API_CALL PFN_vkCmdCopyImage glad_vkCmdCopyImage; #define vkCmdCopyImage glad_vkCmdCopyImage +GLAD_API_CALL PFN_vkCmdCopyImage2 glad_vkCmdCopyImage2; +#define vkCmdCopyImage2 glad_vkCmdCopyImage2 GLAD_API_CALL PFN_vkCmdCopyImageToBuffer glad_vkCmdCopyImageToBuffer; #define vkCmdCopyImageToBuffer glad_vkCmdCopyImageToBuffer +GLAD_API_CALL PFN_vkCmdCopyImageToBuffer2 glad_vkCmdCopyImageToBuffer2; +#define vkCmdCopyImageToBuffer2 glad_vkCmdCopyImageToBuffer2 GLAD_API_CALL PFN_vkCmdCopyQueryPoolResults glad_vkCmdCopyQueryPoolResults; #define vkCmdCopyQueryPoolResults glad_vkCmdCopyQueryPoolResults GLAD_API_CALL PFN_vkCmdDispatch glad_vkCmdDispatch; @@ -3162,56 +5106,106 @@ GLAD_API_CALL PFN_vkCmdDrawIndexed glad_vkCmdDrawIndexed; #define vkCmdDrawIndexed glad_vkCmdDrawIndexed GLAD_API_CALL PFN_vkCmdDrawIndexedIndirect glad_vkCmdDrawIndexedIndirect; #define vkCmdDrawIndexedIndirect glad_vkCmdDrawIndexedIndirect +GLAD_API_CALL PFN_vkCmdDrawIndexedIndirectCount glad_vkCmdDrawIndexedIndirectCount; +#define vkCmdDrawIndexedIndirectCount glad_vkCmdDrawIndexedIndirectCount GLAD_API_CALL PFN_vkCmdDrawIndirect glad_vkCmdDrawIndirect; #define vkCmdDrawIndirect glad_vkCmdDrawIndirect +GLAD_API_CALL PFN_vkCmdDrawIndirectCount glad_vkCmdDrawIndirectCount; +#define vkCmdDrawIndirectCount glad_vkCmdDrawIndirectCount GLAD_API_CALL PFN_vkCmdEndQuery glad_vkCmdEndQuery; #define vkCmdEndQuery glad_vkCmdEndQuery GLAD_API_CALL PFN_vkCmdEndRenderPass glad_vkCmdEndRenderPass; #define vkCmdEndRenderPass glad_vkCmdEndRenderPass +GLAD_API_CALL PFN_vkCmdEndRenderPass2 glad_vkCmdEndRenderPass2; +#define vkCmdEndRenderPass2 glad_vkCmdEndRenderPass2 +GLAD_API_CALL PFN_vkCmdEndRendering glad_vkCmdEndRendering; +#define vkCmdEndRendering glad_vkCmdEndRendering GLAD_API_CALL PFN_vkCmdExecuteCommands glad_vkCmdExecuteCommands; #define vkCmdExecuteCommands glad_vkCmdExecuteCommands GLAD_API_CALL PFN_vkCmdFillBuffer glad_vkCmdFillBuffer; #define vkCmdFillBuffer glad_vkCmdFillBuffer GLAD_API_CALL PFN_vkCmdNextSubpass glad_vkCmdNextSubpass; #define vkCmdNextSubpass glad_vkCmdNextSubpass +GLAD_API_CALL PFN_vkCmdNextSubpass2 glad_vkCmdNextSubpass2; +#define vkCmdNextSubpass2 glad_vkCmdNextSubpass2 GLAD_API_CALL PFN_vkCmdPipelineBarrier glad_vkCmdPipelineBarrier; #define vkCmdPipelineBarrier glad_vkCmdPipelineBarrier +GLAD_API_CALL PFN_vkCmdPipelineBarrier2 glad_vkCmdPipelineBarrier2; +#define vkCmdPipelineBarrier2 glad_vkCmdPipelineBarrier2 GLAD_API_CALL PFN_vkCmdPushConstants glad_vkCmdPushConstants; #define vkCmdPushConstants glad_vkCmdPushConstants GLAD_API_CALL PFN_vkCmdResetEvent glad_vkCmdResetEvent; #define vkCmdResetEvent glad_vkCmdResetEvent +GLAD_API_CALL PFN_vkCmdResetEvent2 glad_vkCmdResetEvent2; +#define vkCmdResetEvent2 glad_vkCmdResetEvent2 GLAD_API_CALL PFN_vkCmdResetQueryPool glad_vkCmdResetQueryPool; #define vkCmdResetQueryPool glad_vkCmdResetQueryPool GLAD_API_CALL PFN_vkCmdResolveImage glad_vkCmdResolveImage; #define vkCmdResolveImage glad_vkCmdResolveImage +GLAD_API_CALL PFN_vkCmdResolveImage2 glad_vkCmdResolveImage2; +#define vkCmdResolveImage2 glad_vkCmdResolveImage2 GLAD_API_CALL PFN_vkCmdSetBlendConstants glad_vkCmdSetBlendConstants; #define vkCmdSetBlendConstants glad_vkCmdSetBlendConstants +GLAD_API_CALL PFN_vkCmdSetCullMode glad_vkCmdSetCullMode; +#define vkCmdSetCullMode glad_vkCmdSetCullMode GLAD_API_CALL PFN_vkCmdSetDepthBias glad_vkCmdSetDepthBias; #define vkCmdSetDepthBias glad_vkCmdSetDepthBias +GLAD_API_CALL PFN_vkCmdSetDepthBiasEnable glad_vkCmdSetDepthBiasEnable; +#define vkCmdSetDepthBiasEnable glad_vkCmdSetDepthBiasEnable GLAD_API_CALL PFN_vkCmdSetDepthBounds glad_vkCmdSetDepthBounds; #define vkCmdSetDepthBounds glad_vkCmdSetDepthBounds +GLAD_API_CALL PFN_vkCmdSetDepthBoundsTestEnable glad_vkCmdSetDepthBoundsTestEnable; +#define vkCmdSetDepthBoundsTestEnable glad_vkCmdSetDepthBoundsTestEnable +GLAD_API_CALL PFN_vkCmdSetDepthCompareOp glad_vkCmdSetDepthCompareOp; +#define vkCmdSetDepthCompareOp glad_vkCmdSetDepthCompareOp +GLAD_API_CALL PFN_vkCmdSetDepthTestEnable glad_vkCmdSetDepthTestEnable; +#define vkCmdSetDepthTestEnable glad_vkCmdSetDepthTestEnable +GLAD_API_CALL PFN_vkCmdSetDepthWriteEnable glad_vkCmdSetDepthWriteEnable; +#define vkCmdSetDepthWriteEnable glad_vkCmdSetDepthWriteEnable GLAD_API_CALL PFN_vkCmdSetDeviceMask glad_vkCmdSetDeviceMask; #define vkCmdSetDeviceMask glad_vkCmdSetDeviceMask GLAD_API_CALL PFN_vkCmdSetEvent glad_vkCmdSetEvent; #define vkCmdSetEvent glad_vkCmdSetEvent +GLAD_API_CALL PFN_vkCmdSetEvent2 glad_vkCmdSetEvent2; +#define vkCmdSetEvent2 glad_vkCmdSetEvent2 +GLAD_API_CALL PFN_vkCmdSetFrontFace glad_vkCmdSetFrontFace; +#define vkCmdSetFrontFace glad_vkCmdSetFrontFace GLAD_API_CALL PFN_vkCmdSetLineWidth glad_vkCmdSetLineWidth; #define vkCmdSetLineWidth glad_vkCmdSetLineWidth +GLAD_API_CALL PFN_vkCmdSetPrimitiveRestartEnable glad_vkCmdSetPrimitiveRestartEnable; +#define vkCmdSetPrimitiveRestartEnable glad_vkCmdSetPrimitiveRestartEnable +GLAD_API_CALL PFN_vkCmdSetPrimitiveTopology glad_vkCmdSetPrimitiveTopology; +#define vkCmdSetPrimitiveTopology glad_vkCmdSetPrimitiveTopology +GLAD_API_CALL PFN_vkCmdSetRasterizerDiscardEnable glad_vkCmdSetRasterizerDiscardEnable; +#define vkCmdSetRasterizerDiscardEnable glad_vkCmdSetRasterizerDiscardEnable GLAD_API_CALL PFN_vkCmdSetScissor glad_vkCmdSetScissor; #define vkCmdSetScissor glad_vkCmdSetScissor +GLAD_API_CALL PFN_vkCmdSetScissorWithCount glad_vkCmdSetScissorWithCount; +#define vkCmdSetScissorWithCount glad_vkCmdSetScissorWithCount GLAD_API_CALL PFN_vkCmdSetStencilCompareMask glad_vkCmdSetStencilCompareMask; #define vkCmdSetStencilCompareMask glad_vkCmdSetStencilCompareMask +GLAD_API_CALL PFN_vkCmdSetStencilOp glad_vkCmdSetStencilOp; +#define vkCmdSetStencilOp glad_vkCmdSetStencilOp GLAD_API_CALL PFN_vkCmdSetStencilReference glad_vkCmdSetStencilReference; #define vkCmdSetStencilReference glad_vkCmdSetStencilReference +GLAD_API_CALL PFN_vkCmdSetStencilTestEnable glad_vkCmdSetStencilTestEnable; +#define vkCmdSetStencilTestEnable glad_vkCmdSetStencilTestEnable GLAD_API_CALL PFN_vkCmdSetStencilWriteMask glad_vkCmdSetStencilWriteMask; #define vkCmdSetStencilWriteMask glad_vkCmdSetStencilWriteMask GLAD_API_CALL PFN_vkCmdSetViewport glad_vkCmdSetViewport; #define vkCmdSetViewport glad_vkCmdSetViewport +GLAD_API_CALL PFN_vkCmdSetViewportWithCount glad_vkCmdSetViewportWithCount; +#define vkCmdSetViewportWithCount glad_vkCmdSetViewportWithCount GLAD_API_CALL PFN_vkCmdUpdateBuffer glad_vkCmdUpdateBuffer; #define vkCmdUpdateBuffer glad_vkCmdUpdateBuffer GLAD_API_CALL PFN_vkCmdWaitEvents glad_vkCmdWaitEvents; #define vkCmdWaitEvents glad_vkCmdWaitEvents +GLAD_API_CALL PFN_vkCmdWaitEvents2 glad_vkCmdWaitEvents2; +#define vkCmdWaitEvents2 glad_vkCmdWaitEvents2 GLAD_API_CALL PFN_vkCmdWriteTimestamp glad_vkCmdWriteTimestamp; #define vkCmdWriteTimestamp glad_vkCmdWriteTimestamp +GLAD_API_CALL PFN_vkCmdWriteTimestamp2 glad_vkCmdWriteTimestamp2; +#define vkCmdWriteTimestamp2 glad_vkCmdWriteTimestamp2 GLAD_API_CALL PFN_vkCreateBuffer glad_vkCreateBuffer; #define vkCreateBuffer glad_vkCreateBuffer GLAD_API_CALL PFN_vkCreateBufferView glad_vkCreateBufferView; @@ -3248,10 +5242,14 @@ GLAD_API_CALL PFN_vkCreatePipelineCache glad_vkCreatePipelineCache; #define vkCreatePipelineCache glad_vkCreatePipelineCache GLAD_API_CALL PFN_vkCreatePipelineLayout glad_vkCreatePipelineLayout; #define vkCreatePipelineLayout glad_vkCreatePipelineLayout +GLAD_API_CALL PFN_vkCreatePrivateDataSlot glad_vkCreatePrivateDataSlot; +#define vkCreatePrivateDataSlot glad_vkCreatePrivateDataSlot GLAD_API_CALL PFN_vkCreateQueryPool glad_vkCreateQueryPool; #define vkCreateQueryPool glad_vkCreateQueryPool GLAD_API_CALL PFN_vkCreateRenderPass glad_vkCreateRenderPass; #define vkCreateRenderPass glad_vkCreateRenderPass +GLAD_API_CALL PFN_vkCreateRenderPass2 glad_vkCreateRenderPass2; +#define vkCreateRenderPass2 glad_vkCreateRenderPass2 GLAD_API_CALL PFN_vkCreateSampler glad_vkCreateSampler; #define vkCreateSampler glad_vkCreateSampler GLAD_API_CALL PFN_vkCreateSamplerYcbcrConversion glad_vkCreateSamplerYcbcrConversion; @@ -3298,6 +5296,8 @@ GLAD_API_CALL PFN_vkDestroyPipelineCache glad_vkDestroyPipelineCache; #define vkDestroyPipelineCache glad_vkDestroyPipelineCache GLAD_API_CALL PFN_vkDestroyPipelineLayout glad_vkDestroyPipelineLayout; #define vkDestroyPipelineLayout glad_vkDestroyPipelineLayout +GLAD_API_CALL PFN_vkDestroyPrivateDataSlot glad_vkDestroyPrivateDataSlot; +#define vkDestroyPrivateDataSlot glad_vkDestroyPrivateDataSlot GLAD_API_CALL PFN_vkDestroyQueryPool glad_vkDestroyQueryPool; #define vkDestroyQueryPool glad_vkDestroyQueryPool GLAD_API_CALL PFN_vkDestroyRenderPass glad_vkDestroyRenderPass; @@ -3340,20 +5340,32 @@ GLAD_API_CALL PFN_vkFreeDescriptorSets glad_vkFreeDescriptorSets; #define vkFreeDescriptorSets glad_vkFreeDescriptorSets GLAD_API_CALL PFN_vkFreeMemory glad_vkFreeMemory; #define vkFreeMemory glad_vkFreeMemory +GLAD_API_CALL PFN_vkGetBufferDeviceAddress glad_vkGetBufferDeviceAddress; +#define vkGetBufferDeviceAddress glad_vkGetBufferDeviceAddress GLAD_API_CALL PFN_vkGetBufferMemoryRequirements glad_vkGetBufferMemoryRequirements; #define vkGetBufferMemoryRequirements glad_vkGetBufferMemoryRequirements GLAD_API_CALL PFN_vkGetBufferMemoryRequirements2 glad_vkGetBufferMemoryRequirements2; #define vkGetBufferMemoryRequirements2 glad_vkGetBufferMemoryRequirements2 +GLAD_API_CALL PFN_vkGetBufferOpaqueCaptureAddress glad_vkGetBufferOpaqueCaptureAddress; +#define vkGetBufferOpaqueCaptureAddress glad_vkGetBufferOpaqueCaptureAddress GLAD_API_CALL PFN_vkGetDescriptorSetLayoutSupport glad_vkGetDescriptorSetLayoutSupport; #define vkGetDescriptorSetLayoutSupport glad_vkGetDescriptorSetLayoutSupport +GLAD_API_CALL PFN_vkGetDeviceBufferMemoryRequirements glad_vkGetDeviceBufferMemoryRequirements; +#define vkGetDeviceBufferMemoryRequirements glad_vkGetDeviceBufferMemoryRequirements GLAD_API_CALL PFN_vkGetDeviceGroupPeerMemoryFeatures glad_vkGetDeviceGroupPeerMemoryFeatures; #define vkGetDeviceGroupPeerMemoryFeatures glad_vkGetDeviceGroupPeerMemoryFeatures GLAD_API_CALL PFN_vkGetDeviceGroupPresentCapabilitiesKHR glad_vkGetDeviceGroupPresentCapabilitiesKHR; #define vkGetDeviceGroupPresentCapabilitiesKHR glad_vkGetDeviceGroupPresentCapabilitiesKHR GLAD_API_CALL PFN_vkGetDeviceGroupSurfacePresentModesKHR glad_vkGetDeviceGroupSurfacePresentModesKHR; #define vkGetDeviceGroupSurfacePresentModesKHR glad_vkGetDeviceGroupSurfacePresentModesKHR +GLAD_API_CALL PFN_vkGetDeviceImageMemoryRequirements glad_vkGetDeviceImageMemoryRequirements; +#define vkGetDeviceImageMemoryRequirements glad_vkGetDeviceImageMemoryRequirements +GLAD_API_CALL PFN_vkGetDeviceImageSparseMemoryRequirements glad_vkGetDeviceImageSparseMemoryRequirements; +#define vkGetDeviceImageSparseMemoryRequirements glad_vkGetDeviceImageSparseMemoryRequirements GLAD_API_CALL PFN_vkGetDeviceMemoryCommitment glad_vkGetDeviceMemoryCommitment; #define vkGetDeviceMemoryCommitment glad_vkGetDeviceMemoryCommitment +GLAD_API_CALL PFN_vkGetDeviceMemoryOpaqueCaptureAddress glad_vkGetDeviceMemoryOpaqueCaptureAddress; +#define vkGetDeviceMemoryOpaqueCaptureAddress glad_vkGetDeviceMemoryOpaqueCaptureAddress GLAD_API_CALL PFN_vkGetDeviceProcAddr glad_vkGetDeviceProcAddr; #define vkGetDeviceProcAddr glad_vkGetDeviceProcAddr GLAD_API_CALL PFN_vkGetDeviceQueue glad_vkGetDeviceQueue; @@ -3420,12 +5432,18 @@ GLAD_API_CALL PFN_vkGetPhysicalDeviceSurfacePresentModesKHR glad_vkGetPhysicalDe #define vkGetPhysicalDeviceSurfacePresentModesKHR glad_vkGetPhysicalDeviceSurfacePresentModesKHR GLAD_API_CALL PFN_vkGetPhysicalDeviceSurfaceSupportKHR glad_vkGetPhysicalDeviceSurfaceSupportKHR; #define vkGetPhysicalDeviceSurfaceSupportKHR glad_vkGetPhysicalDeviceSurfaceSupportKHR +GLAD_API_CALL PFN_vkGetPhysicalDeviceToolProperties glad_vkGetPhysicalDeviceToolProperties; +#define vkGetPhysicalDeviceToolProperties glad_vkGetPhysicalDeviceToolProperties GLAD_API_CALL PFN_vkGetPipelineCacheData glad_vkGetPipelineCacheData; #define vkGetPipelineCacheData glad_vkGetPipelineCacheData +GLAD_API_CALL PFN_vkGetPrivateData glad_vkGetPrivateData; +#define vkGetPrivateData glad_vkGetPrivateData GLAD_API_CALL PFN_vkGetQueryPoolResults glad_vkGetQueryPoolResults; #define vkGetQueryPoolResults glad_vkGetQueryPoolResults GLAD_API_CALL PFN_vkGetRenderAreaGranularity glad_vkGetRenderAreaGranularity; #define vkGetRenderAreaGranularity glad_vkGetRenderAreaGranularity +GLAD_API_CALL PFN_vkGetSemaphoreCounterValue glad_vkGetSemaphoreCounterValue; +#define vkGetSemaphoreCounterValue glad_vkGetSemaphoreCounterValue GLAD_API_CALL PFN_vkGetSwapchainImagesKHR glad_vkGetSwapchainImagesKHR; #define vkGetSwapchainImagesKHR glad_vkGetSwapchainImagesKHR GLAD_API_CALL PFN_vkInvalidateMappedMemoryRanges glad_vkInvalidateMappedMemoryRanges; @@ -3440,6 +5458,8 @@ GLAD_API_CALL PFN_vkQueuePresentKHR glad_vkQueuePresentKHR; #define vkQueuePresentKHR glad_vkQueuePresentKHR GLAD_API_CALL PFN_vkQueueSubmit glad_vkQueueSubmit; #define vkQueueSubmit glad_vkQueueSubmit +GLAD_API_CALL PFN_vkQueueSubmit2 glad_vkQueueSubmit2; +#define vkQueueSubmit2 glad_vkQueueSubmit2 GLAD_API_CALL PFN_vkQueueWaitIdle glad_vkQueueWaitIdle; #define vkQueueWaitIdle glad_vkQueueWaitIdle GLAD_API_CALL PFN_vkResetCommandBuffer glad_vkResetCommandBuffer; @@ -3452,8 +5472,14 @@ GLAD_API_CALL PFN_vkResetEvent glad_vkResetEvent; #define vkResetEvent glad_vkResetEvent GLAD_API_CALL PFN_vkResetFences glad_vkResetFences; #define vkResetFences glad_vkResetFences +GLAD_API_CALL PFN_vkResetQueryPool glad_vkResetQueryPool; +#define vkResetQueryPool glad_vkResetQueryPool GLAD_API_CALL PFN_vkSetEvent glad_vkSetEvent; #define vkSetEvent glad_vkSetEvent +GLAD_API_CALL PFN_vkSetPrivateData glad_vkSetPrivateData; +#define vkSetPrivateData glad_vkSetPrivateData +GLAD_API_CALL PFN_vkSignalSemaphore glad_vkSignalSemaphore; +#define vkSignalSemaphore glad_vkSignalSemaphore GLAD_API_CALL PFN_vkTrimCommandPool glad_vkTrimCommandPool; #define vkTrimCommandPool glad_vkTrimCommandPool GLAD_API_CALL PFN_vkUnmapMemory glad_vkUnmapMemory; @@ -3464,13 +5490,15 @@ GLAD_API_CALL PFN_vkUpdateDescriptorSets glad_vkUpdateDescriptorSets; #define vkUpdateDescriptorSets glad_vkUpdateDescriptorSets GLAD_API_CALL PFN_vkWaitForFences glad_vkWaitForFences; #define vkWaitForFences glad_vkWaitForFences +GLAD_API_CALL PFN_vkWaitSemaphores glad_vkWaitSemaphores; +#define vkWaitSemaphores glad_vkWaitSemaphores -GLAD_API_CALL int gladLoadVulkanUserPtr( VkPhysicalDevice physical_device, GLADuserptrloadfunc load, void *userptr); -GLAD_API_CALL int gladLoadVulkan( VkPhysicalDevice physical_device, GLADloadfunc load); +GLAD_API_CALL int gladLoadVulkanUserPtr( VkPhysicalDevice physical_device, GLADuserptrloadfunc load, void *userptr); +GLAD_API_CALL int gladLoadVulkan( VkPhysicalDevice physical_device, GLADloadfunc load); diff --git a/third_party/penumbra/vendor/glfw/deps/glad_vulkan.c b/third_party/penumbra/vendor/glfw/deps/glad_vulkan.c index 5adfbbbe8b2..6559df8b53b 100644 --- a/third_party/penumbra/vendor/glfw/deps/glad_vulkan.c +++ b/third_party/penumbra/vendor/glfw/deps/glad_vulkan.c @@ -14,10 +14,18 @@ #endif /* GLAD_IMPL_UTIL_C_ */ +#ifdef __cplusplus +extern "C" { +#endif + + int GLAD_VK_VERSION_1_0 = 0; int GLAD_VK_VERSION_1_1 = 0; +int GLAD_VK_VERSION_1_2 = 0; +int GLAD_VK_VERSION_1_3 = 0; int GLAD_VK_EXT_debug_report = 0; +int GLAD_VK_KHR_portability_enumeration = 0; int GLAD_VK_KHR_surface = 0; int GLAD_VK_KHR_swapchain = 0; @@ -35,18 +43,26 @@ PFN_vkBindImageMemory glad_vkBindImageMemory = NULL; PFN_vkBindImageMemory2 glad_vkBindImageMemory2 = NULL; PFN_vkCmdBeginQuery glad_vkCmdBeginQuery = NULL; PFN_vkCmdBeginRenderPass glad_vkCmdBeginRenderPass = NULL; +PFN_vkCmdBeginRenderPass2 glad_vkCmdBeginRenderPass2 = NULL; +PFN_vkCmdBeginRendering glad_vkCmdBeginRendering = NULL; PFN_vkCmdBindDescriptorSets glad_vkCmdBindDescriptorSets = NULL; PFN_vkCmdBindIndexBuffer glad_vkCmdBindIndexBuffer = NULL; PFN_vkCmdBindPipeline glad_vkCmdBindPipeline = NULL; PFN_vkCmdBindVertexBuffers glad_vkCmdBindVertexBuffers = NULL; +PFN_vkCmdBindVertexBuffers2 glad_vkCmdBindVertexBuffers2 = NULL; PFN_vkCmdBlitImage glad_vkCmdBlitImage = NULL; +PFN_vkCmdBlitImage2 glad_vkCmdBlitImage2 = NULL; PFN_vkCmdClearAttachments glad_vkCmdClearAttachments = NULL; PFN_vkCmdClearColorImage glad_vkCmdClearColorImage = NULL; PFN_vkCmdClearDepthStencilImage glad_vkCmdClearDepthStencilImage = NULL; PFN_vkCmdCopyBuffer glad_vkCmdCopyBuffer = NULL; +PFN_vkCmdCopyBuffer2 glad_vkCmdCopyBuffer2 = NULL; PFN_vkCmdCopyBufferToImage glad_vkCmdCopyBufferToImage = NULL; +PFN_vkCmdCopyBufferToImage2 glad_vkCmdCopyBufferToImage2 = NULL; PFN_vkCmdCopyImage glad_vkCmdCopyImage = NULL; +PFN_vkCmdCopyImage2 glad_vkCmdCopyImage2 = NULL; PFN_vkCmdCopyImageToBuffer glad_vkCmdCopyImageToBuffer = NULL; +PFN_vkCmdCopyImageToBuffer2 glad_vkCmdCopyImageToBuffer2 = NULL; PFN_vkCmdCopyQueryPoolResults glad_vkCmdCopyQueryPoolResults = NULL; PFN_vkCmdDispatch glad_vkCmdDispatch = NULL; PFN_vkCmdDispatchBase glad_vkCmdDispatchBase = NULL; @@ -54,31 +70,56 @@ PFN_vkCmdDispatchIndirect glad_vkCmdDispatchIndirect = NULL; PFN_vkCmdDraw glad_vkCmdDraw = NULL; PFN_vkCmdDrawIndexed glad_vkCmdDrawIndexed = NULL; PFN_vkCmdDrawIndexedIndirect glad_vkCmdDrawIndexedIndirect = NULL; +PFN_vkCmdDrawIndexedIndirectCount glad_vkCmdDrawIndexedIndirectCount = NULL; PFN_vkCmdDrawIndirect glad_vkCmdDrawIndirect = NULL; +PFN_vkCmdDrawIndirectCount glad_vkCmdDrawIndirectCount = NULL; PFN_vkCmdEndQuery glad_vkCmdEndQuery = NULL; PFN_vkCmdEndRenderPass glad_vkCmdEndRenderPass = NULL; +PFN_vkCmdEndRenderPass2 glad_vkCmdEndRenderPass2 = NULL; +PFN_vkCmdEndRendering glad_vkCmdEndRendering = NULL; PFN_vkCmdExecuteCommands glad_vkCmdExecuteCommands = NULL; PFN_vkCmdFillBuffer glad_vkCmdFillBuffer = NULL; PFN_vkCmdNextSubpass glad_vkCmdNextSubpass = NULL; +PFN_vkCmdNextSubpass2 glad_vkCmdNextSubpass2 = NULL; PFN_vkCmdPipelineBarrier glad_vkCmdPipelineBarrier = NULL; +PFN_vkCmdPipelineBarrier2 glad_vkCmdPipelineBarrier2 = NULL; PFN_vkCmdPushConstants glad_vkCmdPushConstants = NULL; PFN_vkCmdResetEvent glad_vkCmdResetEvent = NULL; +PFN_vkCmdResetEvent2 glad_vkCmdResetEvent2 = NULL; PFN_vkCmdResetQueryPool glad_vkCmdResetQueryPool = NULL; PFN_vkCmdResolveImage glad_vkCmdResolveImage = NULL; +PFN_vkCmdResolveImage2 glad_vkCmdResolveImage2 = NULL; PFN_vkCmdSetBlendConstants glad_vkCmdSetBlendConstants = NULL; +PFN_vkCmdSetCullMode glad_vkCmdSetCullMode = NULL; PFN_vkCmdSetDepthBias glad_vkCmdSetDepthBias = NULL; +PFN_vkCmdSetDepthBiasEnable glad_vkCmdSetDepthBiasEnable = NULL; PFN_vkCmdSetDepthBounds glad_vkCmdSetDepthBounds = NULL; +PFN_vkCmdSetDepthBoundsTestEnable glad_vkCmdSetDepthBoundsTestEnable = NULL; +PFN_vkCmdSetDepthCompareOp glad_vkCmdSetDepthCompareOp = NULL; +PFN_vkCmdSetDepthTestEnable glad_vkCmdSetDepthTestEnable = NULL; +PFN_vkCmdSetDepthWriteEnable glad_vkCmdSetDepthWriteEnable = NULL; PFN_vkCmdSetDeviceMask glad_vkCmdSetDeviceMask = NULL; PFN_vkCmdSetEvent glad_vkCmdSetEvent = NULL; +PFN_vkCmdSetEvent2 glad_vkCmdSetEvent2 = NULL; +PFN_vkCmdSetFrontFace glad_vkCmdSetFrontFace = NULL; PFN_vkCmdSetLineWidth glad_vkCmdSetLineWidth = NULL; +PFN_vkCmdSetPrimitiveRestartEnable glad_vkCmdSetPrimitiveRestartEnable = NULL; +PFN_vkCmdSetPrimitiveTopology glad_vkCmdSetPrimitiveTopology = NULL; +PFN_vkCmdSetRasterizerDiscardEnable glad_vkCmdSetRasterizerDiscardEnable = NULL; PFN_vkCmdSetScissor glad_vkCmdSetScissor = NULL; +PFN_vkCmdSetScissorWithCount glad_vkCmdSetScissorWithCount = NULL; PFN_vkCmdSetStencilCompareMask glad_vkCmdSetStencilCompareMask = NULL; +PFN_vkCmdSetStencilOp glad_vkCmdSetStencilOp = NULL; PFN_vkCmdSetStencilReference glad_vkCmdSetStencilReference = NULL; +PFN_vkCmdSetStencilTestEnable glad_vkCmdSetStencilTestEnable = NULL; PFN_vkCmdSetStencilWriteMask glad_vkCmdSetStencilWriteMask = NULL; PFN_vkCmdSetViewport glad_vkCmdSetViewport = NULL; +PFN_vkCmdSetViewportWithCount glad_vkCmdSetViewportWithCount = NULL; PFN_vkCmdUpdateBuffer glad_vkCmdUpdateBuffer = NULL; PFN_vkCmdWaitEvents glad_vkCmdWaitEvents = NULL; +PFN_vkCmdWaitEvents2 glad_vkCmdWaitEvents2 = NULL; PFN_vkCmdWriteTimestamp glad_vkCmdWriteTimestamp = NULL; +PFN_vkCmdWriteTimestamp2 glad_vkCmdWriteTimestamp2 = NULL; PFN_vkCreateBuffer glad_vkCreateBuffer = NULL; PFN_vkCreateBufferView glad_vkCreateBufferView = NULL; PFN_vkCreateCommandPool glad_vkCreateCommandPool = NULL; @@ -97,8 +138,10 @@ PFN_vkCreateImageView glad_vkCreateImageView = NULL; PFN_vkCreateInstance glad_vkCreateInstance = NULL; PFN_vkCreatePipelineCache glad_vkCreatePipelineCache = NULL; PFN_vkCreatePipelineLayout glad_vkCreatePipelineLayout = NULL; +PFN_vkCreatePrivateDataSlot glad_vkCreatePrivateDataSlot = NULL; PFN_vkCreateQueryPool glad_vkCreateQueryPool = NULL; PFN_vkCreateRenderPass glad_vkCreateRenderPass = NULL; +PFN_vkCreateRenderPass2 glad_vkCreateRenderPass2 = NULL; PFN_vkCreateSampler glad_vkCreateSampler = NULL; PFN_vkCreateSamplerYcbcrConversion glad_vkCreateSamplerYcbcrConversion = NULL; PFN_vkCreateSemaphore glad_vkCreateSemaphore = NULL; @@ -122,6 +165,7 @@ PFN_vkDestroyInstance glad_vkDestroyInstance = NULL; PFN_vkDestroyPipeline glad_vkDestroyPipeline = NULL; PFN_vkDestroyPipelineCache glad_vkDestroyPipelineCache = NULL; PFN_vkDestroyPipelineLayout glad_vkDestroyPipelineLayout = NULL; +PFN_vkDestroyPrivateDataSlot glad_vkDestroyPrivateDataSlot = NULL; PFN_vkDestroyQueryPool glad_vkDestroyQueryPool = NULL; PFN_vkDestroyRenderPass glad_vkDestroyRenderPass = NULL; PFN_vkDestroySampler glad_vkDestroySampler = NULL; @@ -143,13 +187,19 @@ PFN_vkFlushMappedMemoryRanges glad_vkFlushMappedMemoryRanges = NULL; PFN_vkFreeCommandBuffers glad_vkFreeCommandBuffers = NULL; PFN_vkFreeDescriptorSets glad_vkFreeDescriptorSets = NULL; PFN_vkFreeMemory glad_vkFreeMemory = NULL; +PFN_vkGetBufferDeviceAddress glad_vkGetBufferDeviceAddress = NULL; PFN_vkGetBufferMemoryRequirements glad_vkGetBufferMemoryRequirements = NULL; PFN_vkGetBufferMemoryRequirements2 glad_vkGetBufferMemoryRequirements2 = NULL; +PFN_vkGetBufferOpaqueCaptureAddress glad_vkGetBufferOpaqueCaptureAddress = NULL; PFN_vkGetDescriptorSetLayoutSupport glad_vkGetDescriptorSetLayoutSupport = NULL; +PFN_vkGetDeviceBufferMemoryRequirements glad_vkGetDeviceBufferMemoryRequirements = NULL; PFN_vkGetDeviceGroupPeerMemoryFeatures glad_vkGetDeviceGroupPeerMemoryFeatures = NULL; PFN_vkGetDeviceGroupPresentCapabilitiesKHR glad_vkGetDeviceGroupPresentCapabilitiesKHR = NULL; PFN_vkGetDeviceGroupSurfacePresentModesKHR glad_vkGetDeviceGroupSurfacePresentModesKHR = NULL; +PFN_vkGetDeviceImageMemoryRequirements glad_vkGetDeviceImageMemoryRequirements = NULL; +PFN_vkGetDeviceImageSparseMemoryRequirements glad_vkGetDeviceImageSparseMemoryRequirements = NULL; PFN_vkGetDeviceMemoryCommitment glad_vkGetDeviceMemoryCommitment = NULL; +PFN_vkGetDeviceMemoryOpaqueCaptureAddress glad_vkGetDeviceMemoryOpaqueCaptureAddress = NULL; PFN_vkGetDeviceProcAddr glad_vkGetDeviceProcAddr = NULL; PFN_vkGetDeviceQueue glad_vkGetDeviceQueue = NULL; PFN_vkGetDeviceQueue2 glad_vkGetDeviceQueue2 = NULL; @@ -183,9 +233,12 @@ PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR glad_vkGetPhysicalDeviceSurfaceCap PFN_vkGetPhysicalDeviceSurfaceFormatsKHR glad_vkGetPhysicalDeviceSurfaceFormatsKHR = NULL; PFN_vkGetPhysicalDeviceSurfacePresentModesKHR glad_vkGetPhysicalDeviceSurfacePresentModesKHR = NULL; PFN_vkGetPhysicalDeviceSurfaceSupportKHR glad_vkGetPhysicalDeviceSurfaceSupportKHR = NULL; +PFN_vkGetPhysicalDeviceToolProperties glad_vkGetPhysicalDeviceToolProperties = NULL; PFN_vkGetPipelineCacheData glad_vkGetPipelineCacheData = NULL; +PFN_vkGetPrivateData glad_vkGetPrivateData = NULL; PFN_vkGetQueryPoolResults glad_vkGetQueryPoolResults = NULL; PFN_vkGetRenderAreaGranularity glad_vkGetRenderAreaGranularity = NULL; +PFN_vkGetSemaphoreCounterValue glad_vkGetSemaphoreCounterValue = NULL; PFN_vkGetSwapchainImagesKHR glad_vkGetSwapchainImagesKHR = NULL; PFN_vkInvalidateMappedMemoryRanges glad_vkInvalidateMappedMemoryRanges = NULL; PFN_vkMapMemory glad_vkMapMemory = NULL; @@ -193,216 +246,277 @@ PFN_vkMergePipelineCaches glad_vkMergePipelineCaches = NULL; PFN_vkQueueBindSparse glad_vkQueueBindSparse = NULL; PFN_vkQueuePresentKHR glad_vkQueuePresentKHR = NULL; PFN_vkQueueSubmit glad_vkQueueSubmit = NULL; +PFN_vkQueueSubmit2 glad_vkQueueSubmit2 = NULL; PFN_vkQueueWaitIdle glad_vkQueueWaitIdle = NULL; PFN_vkResetCommandBuffer glad_vkResetCommandBuffer = NULL; PFN_vkResetCommandPool glad_vkResetCommandPool = NULL; PFN_vkResetDescriptorPool glad_vkResetDescriptorPool = NULL; PFN_vkResetEvent glad_vkResetEvent = NULL; PFN_vkResetFences glad_vkResetFences = NULL; +PFN_vkResetQueryPool glad_vkResetQueryPool = NULL; PFN_vkSetEvent glad_vkSetEvent = NULL; +PFN_vkSetPrivateData glad_vkSetPrivateData = NULL; +PFN_vkSignalSemaphore glad_vkSignalSemaphore = NULL; PFN_vkTrimCommandPool glad_vkTrimCommandPool = NULL; PFN_vkUnmapMemory glad_vkUnmapMemory = NULL; PFN_vkUpdateDescriptorSetWithTemplate glad_vkUpdateDescriptorSetWithTemplate = NULL; PFN_vkUpdateDescriptorSets glad_vkUpdateDescriptorSets = NULL; PFN_vkWaitForFences glad_vkWaitForFences = NULL; +PFN_vkWaitSemaphores glad_vkWaitSemaphores = NULL; static void glad_vk_load_VK_VERSION_1_0( GLADuserptrloadfunc load, void* userptr) { if(!GLAD_VK_VERSION_1_0) return; - vkAllocateCommandBuffers = (PFN_vkAllocateCommandBuffers) load("vkAllocateCommandBuffers", userptr); - vkAllocateDescriptorSets = (PFN_vkAllocateDescriptorSets) load("vkAllocateDescriptorSets", userptr); - vkAllocateMemory = (PFN_vkAllocateMemory) load("vkAllocateMemory", userptr); - vkBeginCommandBuffer = (PFN_vkBeginCommandBuffer) load("vkBeginCommandBuffer", userptr); - vkBindBufferMemory = (PFN_vkBindBufferMemory) load("vkBindBufferMemory", userptr); - vkBindImageMemory = (PFN_vkBindImageMemory) load("vkBindImageMemory", userptr); - vkCmdBeginQuery = (PFN_vkCmdBeginQuery) load("vkCmdBeginQuery", userptr); - vkCmdBeginRenderPass = (PFN_vkCmdBeginRenderPass) load("vkCmdBeginRenderPass", userptr); - vkCmdBindDescriptorSets = (PFN_vkCmdBindDescriptorSets) load("vkCmdBindDescriptorSets", userptr); - vkCmdBindIndexBuffer = (PFN_vkCmdBindIndexBuffer) load("vkCmdBindIndexBuffer", userptr); - vkCmdBindPipeline = (PFN_vkCmdBindPipeline) load("vkCmdBindPipeline", userptr); - vkCmdBindVertexBuffers = (PFN_vkCmdBindVertexBuffers) load("vkCmdBindVertexBuffers", userptr); - vkCmdBlitImage = (PFN_vkCmdBlitImage) load("vkCmdBlitImage", userptr); - vkCmdClearAttachments = (PFN_vkCmdClearAttachments) load("vkCmdClearAttachments", userptr); - vkCmdClearColorImage = (PFN_vkCmdClearColorImage) load("vkCmdClearColorImage", userptr); - vkCmdClearDepthStencilImage = (PFN_vkCmdClearDepthStencilImage) load("vkCmdClearDepthStencilImage", userptr); - vkCmdCopyBuffer = (PFN_vkCmdCopyBuffer) load("vkCmdCopyBuffer", userptr); - vkCmdCopyBufferToImage = (PFN_vkCmdCopyBufferToImage) load("vkCmdCopyBufferToImage", userptr); - vkCmdCopyImage = (PFN_vkCmdCopyImage) load("vkCmdCopyImage", userptr); - vkCmdCopyImageToBuffer = (PFN_vkCmdCopyImageToBuffer) load("vkCmdCopyImageToBuffer", userptr); - vkCmdCopyQueryPoolResults = (PFN_vkCmdCopyQueryPoolResults) load("vkCmdCopyQueryPoolResults", userptr); - vkCmdDispatch = (PFN_vkCmdDispatch) load("vkCmdDispatch", userptr); - vkCmdDispatchIndirect = (PFN_vkCmdDispatchIndirect) load("vkCmdDispatchIndirect", userptr); - vkCmdDraw = (PFN_vkCmdDraw) load("vkCmdDraw", userptr); - vkCmdDrawIndexed = (PFN_vkCmdDrawIndexed) load("vkCmdDrawIndexed", userptr); - vkCmdDrawIndexedIndirect = (PFN_vkCmdDrawIndexedIndirect) load("vkCmdDrawIndexedIndirect", userptr); - vkCmdDrawIndirect = (PFN_vkCmdDrawIndirect) load("vkCmdDrawIndirect", userptr); - vkCmdEndQuery = (PFN_vkCmdEndQuery) load("vkCmdEndQuery", userptr); - vkCmdEndRenderPass = (PFN_vkCmdEndRenderPass) load("vkCmdEndRenderPass", userptr); - vkCmdExecuteCommands = (PFN_vkCmdExecuteCommands) load("vkCmdExecuteCommands", userptr); - vkCmdFillBuffer = (PFN_vkCmdFillBuffer) load("vkCmdFillBuffer", userptr); - vkCmdNextSubpass = (PFN_vkCmdNextSubpass) load("vkCmdNextSubpass", userptr); - vkCmdPipelineBarrier = (PFN_vkCmdPipelineBarrier) load("vkCmdPipelineBarrier", userptr); - vkCmdPushConstants = (PFN_vkCmdPushConstants) load("vkCmdPushConstants", userptr); - vkCmdResetEvent = (PFN_vkCmdResetEvent) load("vkCmdResetEvent", userptr); - vkCmdResetQueryPool = (PFN_vkCmdResetQueryPool) load("vkCmdResetQueryPool", userptr); - vkCmdResolveImage = (PFN_vkCmdResolveImage) load("vkCmdResolveImage", userptr); - vkCmdSetBlendConstants = (PFN_vkCmdSetBlendConstants) load("vkCmdSetBlendConstants", userptr); - vkCmdSetDepthBias = (PFN_vkCmdSetDepthBias) load("vkCmdSetDepthBias", userptr); - vkCmdSetDepthBounds = (PFN_vkCmdSetDepthBounds) load("vkCmdSetDepthBounds", userptr); - vkCmdSetEvent = (PFN_vkCmdSetEvent) load("vkCmdSetEvent", userptr); - vkCmdSetLineWidth = (PFN_vkCmdSetLineWidth) load("vkCmdSetLineWidth", userptr); - vkCmdSetScissor = (PFN_vkCmdSetScissor) load("vkCmdSetScissor", userptr); - vkCmdSetStencilCompareMask = (PFN_vkCmdSetStencilCompareMask) load("vkCmdSetStencilCompareMask", userptr); - vkCmdSetStencilReference = (PFN_vkCmdSetStencilReference) load("vkCmdSetStencilReference", userptr); - vkCmdSetStencilWriteMask = (PFN_vkCmdSetStencilWriteMask) load("vkCmdSetStencilWriteMask", userptr); - vkCmdSetViewport = (PFN_vkCmdSetViewport) load("vkCmdSetViewport", userptr); - vkCmdUpdateBuffer = (PFN_vkCmdUpdateBuffer) load("vkCmdUpdateBuffer", userptr); - vkCmdWaitEvents = (PFN_vkCmdWaitEvents) load("vkCmdWaitEvents", userptr); - vkCmdWriteTimestamp = (PFN_vkCmdWriteTimestamp) load("vkCmdWriteTimestamp", userptr); - vkCreateBuffer = (PFN_vkCreateBuffer) load("vkCreateBuffer", userptr); - vkCreateBufferView = (PFN_vkCreateBufferView) load("vkCreateBufferView", userptr); - vkCreateCommandPool = (PFN_vkCreateCommandPool) load("vkCreateCommandPool", userptr); - vkCreateComputePipelines = (PFN_vkCreateComputePipelines) load("vkCreateComputePipelines", userptr); - vkCreateDescriptorPool = (PFN_vkCreateDescriptorPool) load("vkCreateDescriptorPool", userptr); - vkCreateDescriptorSetLayout = (PFN_vkCreateDescriptorSetLayout) load("vkCreateDescriptorSetLayout", userptr); - vkCreateDevice = (PFN_vkCreateDevice) load("vkCreateDevice", userptr); - vkCreateEvent = (PFN_vkCreateEvent) load("vkCreateEvent", userptr); - vkCreateFence = (PFN_vkCreateFence) load("vkCreateFence", userptr); - vkCreateFramebuffer = (PFN_vkCreateFramebuffer) load("vkCreateFramebuffer", userptr); - vkCreateGraphicsPipelines = (PFN_vkCreateGraphicsPipelines) load("vkCreateGraphicsPipelines", userptr); - vkCreateImage = (PFN_vkCreateImage) load("vkCreateImage", userptr); - vkCreateImageView = (PFN_vkCreateImageView) load("vkCreateImageView", userptr); - vkCreateInstance = (PFN_vkCreateInstance) load("vkCreateInstance", userptr); - vkCreatePipelineCache = (PFN_vkCreatePipelineCache) load("vkCreatePipelineCache", userptr); - vkCreatePipelineLayout = (PFN_vkCreatePipelineLayout) load("vkCreatePipelineLayout", userptr); - vkCreateQueryPool = (PFN_vkCreateQueryPool) load("vkCreateQueryPool", userptr); - vkCreateRenderPass = (PFN_vkCreateRenderPass) load("vkCreateRenderPass", userptr); - vkCreateSampler = (PFN_vkCreateSampler) load("vkCreateSampler", userptr); - vkCreateSemaphore = (PFN_vkCreateSemaphore) load("vkCreateSemaphore", userptr); - vkCreateShaderModule = (PFN_vkCreateShaderModule) load("vkCreateShaderModule", userptr); - vkDestroyBuffer = (PFN_vkDestroyBuffer) load("vkDestroyBuffer", userptr); - vkDestroyBufferView = (PFN_vkDestroyBufferView) load("vkDestroyBufferView", userptr); - vkDestroyCommandPool = (PFN_vkDestroyCommandPool) load("vkDestroyCommandPool", userptr); - vkDestroyDescriptorPool = (PFN_vkDestroyDescriptorPool) load("vkDestroyDescriptorPool", userptr); - vkDestroyDescriptorSetLayout = (PFN_vkDestroyDescriptorSetLayout) load("vkDestroyDescriptorSetLayout", userptr); - vkDestroyDevice = (PFN_vkDestroyDevice) load("vkDestroyDevice", userptr); - vkDestroyEvent = (PFN_vkDestroyEvent) load("vkDestroyEvent", userptr); - vkDestroyFence = (PFN_vkDestroyFence) load("vkDestroyFence", userptr); - vkDestroyFramebuffer = (PFN_vkDestroyFramebuffer) load("vkDestroyFramebuffer", userptr); - vkDestroyImage = (PFN_vkDestroyImage) load("vkDestroyImage", userptr); - vkDestroyImageView = (PFN_vkDestroyImageView) load("vkDestroyImageView", userptr); - vkDestroyInstance = (PFN_vkDestroyInstance) load("vkDestroyInstance", userptr); - vkDestroyPipeline = (PFN_vkDestroyPipeline) load("vkDestroyPipeline", userptr); - vkDestroyPipelineCache = (PFN_vkDestroyPipelineCache) load("vkDestroyPipelineCache", userptr); - vkDestroyPipelineLayout = (PFN_vkDestroyPipelineLayout) load("vkDestroyPipelineLayout", userptr); - vkDestroyQueryPool = (PFN_vkDestroyQueryPool) load("vkDestroyQueryPool", userptr); - vkDestroyRenderPass = (PFN_vkDestroyRenderPass) load("vkDestroyRenderPass", userptr); - vkDestroySampler = (PFN_vkDestroySampler) load("vkDestroySampler", userptr); - vkDestroySemaphore = (PFN_vkDestroySemaphore) load("vkDestroySemaphore", userptr); - vkDestroyShaderModule = (PFN_vkDestroyShaderModule) load("vkDestroyShaderModule", userptr); - vkDeviceWaitIdle = (PFN_vkDeviceWaitIdle) load("vkDeviceWaitIdle", userptr); - vkEndCommandBuffer = (PFN_vkEndCommandBuffer) load("vkEndCommandBuffer", userptr); - vkEnumerateDeviceExtensionProperties = (PFN_vkEnumerateDeviceExtensionProperties) load("vkEnumerateDeviceExtensionProperties", userptr); - vkEnumerateDeviceLayerProperties = (PFN_vkEnumerateDeviceLayerProperties) load("vkEnumerateDeviceLayerProperties", userptr); - vkEnumerateInstanceExtensionProperties = (PFN_vkEnumerateInstanceExtensionProperties) load("vkEnumerateInstanceExtensionProperties", userptr); - vkEnumerateInstanceLayerProperties = (PFN_vkEnumerateInstanceLayerProperties) load("vkEnumerateInstanceLayerProperties", userptr); - vkEnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices) load("vkEnumeratePhysicalDevices", userptr); - vkFlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges) load("vkFlushMappedMemoryRanges", userptr); - vkFreeCommandBuffers = (PFN_vkFreeCommandBuffers) load("vkFreeCommandBuffers", userptr); - vkFreeDescriptorSets = (PFN_vkFreeDescriptorSets) load("vkFreeDescriptorSets", userptr); - vkFreeMemory = (PFN_vkFreeMemory) load("vkFreeMemory", userptr); - vkGetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements) load("vkGetBufferMemoryRequirements", userptr); - vkGetDeviceMemoryCommitment = (PFN_vkGetDeviceMemoryCommitment) load("vkGetDeviceMemoryCommitment", userptr); - vkGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr) load("vkGetDeviceProcAddr", userptr); - vkGetDeviceQueue = (PFN_vkGetDeviceQueue) load("vkGetDeviceQueue", userptr); - vkGetEventStatus = (PFN_vkGetEventStatus) load("vkGetEventStatus", userptr); - vkGetFenceStatus = (PFN_vkGetFenceStatus) load("vkGetFenceStatus", userptr); - vkGetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements) load("vkGetImageMemoryRequirements", userptr); - vkGetImageSparseMemoryRequirements = (PFN_vkGetImageSparseMemoryRequirements) load("vkGetImageSparseMemoryRequirements", userptr); - vkGetImageSubresourceLayout = (PFN_vkGetImageSubresourceLayout) load("vkGetImageSubresourceLayout", userptr); - vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr) load("vkGetInstanceProcAddr", userptr); - vkGetPhysicalDeviceFeatures = (PFN_vkGetPhysicalDeviceFeatures) load("vkGetPhysicalDeviceFeatures", userptr); - vkGetPhysicalDeviceFormatProperties = (PFN_vkGetPhysicalDeviceFormatProperties) load("vkGetPhysicalDeviceFormatProperties", userptr); - vkGetPhysicalDeviceImageFormatProperties = (PFN_vkGetPhysicalDeviceImageFormatProperties) load("vkGetPhysicalDeviceImageFormatProperties", userptr); - vkGetPhysicalDeviceMemoryProperties = (PFN_vkGetPhysicalDeviceMemoryProperties) load("vkGetPhysicalDeviceMemoryProperties", userptr); - vkGetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties) load("vkGetPhysicalDeviceProperties", userptr); - vkGetPhysicalDeviceQueueFamilyProperties = (PFN_vkGetPhysicalDeviceQueueFamilyProperties) load("vkGetPhysicalDeviceQueueFamilyProperties", userptr); - vkGetPhysicalDeviceSparseImageFormatProperties = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties) load("vkGetPhysicalDeviceSparseImageFormatProperties", userptr); - vkGetPipelineCacheData = (PFN_vkGetPipelineCacheData) load("vkGetPipelineCacheData", userptr); - vkGetQueryPoolResults = (PFN_vkGetQueryPoolResults) load("vkGetQueryPoolResults", userptr); - vkGetRenderAreaGranularity = (PFN_vkGetRenderAreaGranularity) load("vkGetRenderAreaGranularity", userptr); - vkInvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges) load("vkInvalidateMappedMemoryRanges", userptr); - vkMapMemory = (PFN_vkMapMemory) load("vkMapMemory", userptr); - vkMergePipelineCaches = (PFN_vkMergePipelineCaches) load("vkMergePipelineCaches", userptr); - vkQueueBindSparse = (PFN_vkQueueBindSparse) load("vkQueueBindSparse", userptr); - vkQueueSubmit = (PFN_vkQueueSubmit) load("vkQueueSubmit", userptr); - vkQueueWaitIdle = (PFN_vkQueueWaitIdle) load("vkQueueWaitIdle", userptr); - vkResetCommandBuffer = (PFN_vkResetCommandBuffer) load("vkResetCommandBuffer", userptr); - vkResetCommandPool = (PFN_vkResetCommandPool) load("vkResetCommandPool", userptr); - vkResetDescriptorPool = (PFN_vkResetDescriptorPool) load("vkResetDescriptorPool", userptr); - vkResetEvent = (PFN_vkResetEvent) load("vkResetEvent", userptr); - vkResetFences = (PFN_vkResetFences) load("vkResetFences", userptr); - vkSetEvent = (PFN_vkSetEvent) load("vkSetEvent", userptr); - vkUnmapMemory = (PFN_vkUnmapMemory) load("vkUnmapMemory", userptr); - vkUpdateDescriptorSets = (PFN_vkUpdateDescriptorSets) load("vkUpdateDescriptorSets", userptr); - vkWaitForFences = (PFN_vkWaitForFences) load("vkWaitForFences", userptr); + glad_vkAllocateCommandBuffers = (PFN_vkAllocateCommandBuffers) load(userptr, "vkAllocateCommandBuffers"); + glad_vkAllocateDescriptorSets = (PFN_vkAllocateDescriptorSets) load(userptr, "vkAllocateDescriptorSets"); + glad_vkAllocateMemory = (PFN_vkAllocateMemory) load(userptr, "vkAllocateMemory"); + glad_vkBeginCommandBuffer = (PFN_vkBeginCommandBuffer) load(userptr, "vkBeginCommandBuffer"); + glad_vkBindBufferMemory = (PFN_vkBindBufferMemory) load(userptr, "vkBindBufferMemory"); + glad_vkBindImageMemory = (PFN_vkBindImageMemory) load(userptr, "vkBindImageMemory"); + glad_vkCmdBeginQuery = (PFN_vkCmdBeginQuery) load(userptr, "vkCmdBeginQuery"); + glad_vkCmdBeginRenderPass = (PFN_vkCmdBeginRenderPass) load(userptr, "vkCmdBeginRenderPass"); + glad_vkCmdBindDescriptorSets = (PFN_vkCmdBindDescriptorSets) load(userptr, "vkCmdBindDescriptorSets"); + glad_vkCmdBindIndexBuffer = (PFN_vkCmdBindIndexBuffer) load(userptr, "vkCmdBindIndexBuffer"); + glad_vkCmdBindPipeline = (PFN_vkCmdBindPipeline) load(userptr, "vkCmdBindPipeline"); + glad_vkCmdBindVertexBuffers = (PFN_vkCmdBindVertexBuffers) load(userptr, "vkCmdBindVertexBuffers"); + glad_vkCmdBlitImage = (PFN_vkCmdBlitImage) load(userptr, "vkCmdBlitImage"); + glad_vkCmdClearAttachments = (PFN_vkCmdClearAttachments) load(userptr, "vkCmdClearAttachments"); + glad_vkCmdClearColorImage = (PFN_vkCmdClearColorImage) load(userptr, "vkCmdClearColorImage"); + glad_vkCmdClearDepthStencilImage = (PFN_vkCmdClearDepthStencilImage) load(userptr, "vkCmdClearDepthStencilImage"); + glad_vkCmdCopyBuffer = (PFN_vkCmdCopyBuffer) load(userptr, "vkCmdCopyBuffer"); + glad_vkCmdCopyBufferToImage = (PFN_vkCmdCopyBufferToImage) load(userptr, "vkCmdCopyBufferToImage"); + glad_vkCmdCopyImage = (PFN_vkCmdCopyImage) load(userptr, "vkCmdCopyImage"); + glad_vkCmdCopyImageToBuffer = (PFN_vkCmdCopyImageToBuffer) load(userptr, "vkCmdCopyImageToBuffer"); + glad_vkCmdCopyQueryPoolResults = (PFN_vkCmdCopyQueryPoolResults) load(userptr, "vkCmdCopyQueryPoolResults"); + glad_vkCmdDispatch = (PFN_vkCmdDispatch) load(userptr, "vkCmdDispatch"); + glad_vkCmdDispatchIndirect = (PFN_vkCmdDispatchIndirect) load(userptr, "vkCmdDispatchIndirect"); + glad_vkCmdDraw = (PFN_vkCmdDraw) load(userptr, "vkCmdDraw"); + glad_vkCmdDrawIndexed = (PFN_vkCmdDrawIndexed) load(userptr, "vkCmdDrawIndexed"); + glad_vkCmdDrawIndexedIndirect = (PFN_vkCmdDrawIndexedIndirect) load(userptr, "vkCmdDrawIndexedIndirect"); + glad_vkCmdDrawIndirect = (PFN_vkCmdDrawIndirect) load(userptr, "vkCmdDrawIndirect"); + glad_vkCmdEndQuery = (PFN_vkCmdEndQuery) load(userptr, "vkCmdEndQuery"); + glad_vkCmdEndRenderPass = (PFN_vkCmdEndRenderPass) load(userptr, "vkCmdEndRenderPass"); + glad_vkCmdExecuteCommands = (PFN_vkCmdExecuteCommands) load(userptr, "vkCmdExecuteCommands"); + glad_vkCmdFillBuffer = (PFN_vkCmdFillBuffer) load(userptr, "vkCmdFillBuffer"); + glad_vkCmdNextSubpass = (PFN_vkCmdNextSubpass) load(userptr, "vkCmdNextSubpass"); + glad_vkCmdPipelineBarrier = (PFN_vkCmdPipelineBarrier) load(userptr, "vkCmdPipelineBarrier"); + glad_vkCmdPushConstants = (PFN_vkCmdPushConstants) load(userptr, "vkCmdPushConstants"); + glad_vkCmdResetEvent = (PFN_vkCmdResetEvent) load(userptr, "vkCmdResetEvent"); + glad_vkCmdResetQueryPool = (PFN_vkCmdResetQueryPool) load(userptr, "vkCmdResetQueryPool"); + glad_vkCmdResolveImage = (PFN_vkCmdResolveImage) load(userptr, "vkCmdResolveImage"); + glad_vkCmdSetBlendConstants = (PFN_vkCmdSetBlendConstants) load(userptr, "vkCmdSetBlendConstants"); + glad_vkCmdSetDepthBias = (PFN_vkCmdSetDepthBias) load(userptr, "vkCmdSetDepthBias"); + glad_vkCmdSetDepthBounds = (PFN_vkCmdSetDepthBounds) load(userptr, "vkCmdSetDepthBounds"); + glad_vkCmdSetEvent = (PFN_vkCmdSetEvent) load(userptr, "vkCmdSetEvent"); + glad_vkCmdSetLineWidth = (PFN_vkCmdSetLineWidth) load(userptr, "vkCmdSetLineWidth"); + glad_vkCmdSetScissor = (PFN_vkCmdSetScissor) load(userptr, "vkCmdSetScissor"); + glad_vkCmdSetStencilCompareMask = (PFN_vkCmdSetStencilCompareMask) load(userptr, "vkCmdSetStencilCompareMask"); + glad_vkCmdSetStencilReference = (PFN_vkCmdSetStencilReference) load(userptr, "vkCmdSetStencilReference"); + glad_vkCmdSetStencilWriteMask = (PFN_vkCmdSetStencilWriteMask) load(userptr, "vkCmdSetStencilWriteMask"); + glad_vkCmdSetViewport = (PFN_vkCmdSetViewport) load(userptr, "vkCmdSetViewport"); + glad_vkCmdUpdateBuffer = (PFN_vkCmdUpdateBuffer) load(userptr, "vkCmdUpdateBuffer"); + glad_vkCmdWaitEvents = (PFN_vkCmdWaitEvents) load(userptr, "vkCmdWaitEvents"); + glad_vkCmdWriteTimestamp = (PFN_vkCmdWriteTimestamp) load(userptr, "vkCmdWriteTimestamp"); + glad_vkCreateBuffer = (PFN_vkCreateBuffer) load(userptr, "vkCreateBuffer"); + glad_vkCreateBufferView = (PFN_vkCreateBufferView) load(userptr, "vkCreateBufferView"); + glad_vkCreateCommandPool = (PFN_vkCreateCommandPool) load(userptr, "vkCreateCommandPool"); + glad_vkCreateComputePipelines = (PFN_vkCreateComputePipelines) load(userptr, "vkCreateComputePipelines"); + glad_vkCreateDescriptorPool = (PFN_vkCreateDescriptorPool) load(userptr, "vkCreateDescriptorPool"); + glad_vkCreateDescriptorSetLayout = (PFN_vkCreateDescriptorSetLayout) load(userptr, "vkCreateDescriptorSetLayout"); + glad_vkCreateDevice = (PFN_vkCreateDevice) load(userptr, "vkCreateDevice"); + glad_vkCreateEvent = (PFN_vkCreateEvent) load(userptr, "vkCreateEvent"); + glad_vkCreateFence = (PFN_vkCreateFence) load(userptr, "vkCreateFence"); + glad_vkCreateFramebuffer = (PFN_vkCreateFramebuffer) load(userptr, "vkCreateFramebuffer"); + glad_vkCreateGraphicsPipelines = (PFN_vkCreateGraphicsPipelines) load(userptr, "vkCreateGraphicsPipelines"); + glad_vkCreateImage = (PFN_vkCreateImage) load(userptr, "vkCreateImage"); + glad_vkCreateImageView = (PFN_vkCreateImageView) load(userptr, "vkCreateImageView"); + glad_vkCreateInstance = (PFN_vkCreateInstance) load(userptr, "vkCreateInstance"); + glad_vkCreatePipelineCache = (PFN_vkCreatePipelineCache) load(userptr, "vkCreatePipelineCache"); + glad_vkCreatePipelineLayout = (PFN_vkCreatePipelineLayout) load(userptr, "vkCreatePipelineLayout"); + glad_vkCreateQueryPool = (PFN_vkCreateQueryPool) load(userptr, "vkCreateQueryPool"); + glad_vkCreateRenderPass = (PFN_vkCreateRenderPass) load(userptr, "vkCreateRenderPass"); + glad_vkCreateSampler = (PFN_vkCreateSampler) load(userptr, "vkCreateSampler"); + glad_vkCreateSemaphore = (PFN_vkCreateSemaphore) load(userptr, "vkCreateSemaphore"); + glad_vkCreateShaderModule = (PFN_vkCreateShaderModule) load(userptr, "vkCreateShaderModule"); + glad_vkDestroyBuffer = (PFN_vkDestroyBuffer) load(userptr, "vkDestroyBuffer"); + glad_vkDestroyBufferView = (PFN_vkDestroyBufferView) load(userptr, "vkDestroyBufferView"); + glad_vkDestroyCommandPool = (PFN_vkDestroyCommandPool) load(userptr, "vkDestroyCommandPool"); + glad_vkDestroyDescriptorPool = (PFN_vkDestroyDescriptorPool) load(userptr, "vkDestroyDescriptorPool"); + glad_vkDestroyDescriptorSetLayout = (PFN_vkDestroyDescriptorSetLayout) load(userptr, "vkDestroyDescriptorSetLayout"); + glad_vkDestroyDevice = (PFN_vkDestroyDevice) load(userptr, "vkDestroyDevice"); + glad_vkDestroyEvent = (PFN_vkDestroyEvent) load(userptr, "vkDestroyEvent"); + glad_vkDestroyFence = (PFN_vkDestroyFence) load(userptr, "vkDestroyFence"); + glad_vkDestroyFramebuffer = (PFN_vkDestroyFramebuffer) load(userptr, "vkDestroyFramebuffer"); + glad_vkDestroyImage = (PFN_vkDestroyImage) load(userptr, "vkDestroyImage"); + glad_vkDestroyImageView = (PFN_vkDestroyImageView) load(userptr, "vkDestroyImageView"); + glad_vkDestroyInstance = (PFN_vkDestroyInstance) load(userptr, "vkDestroyInstance"); + glad_vkDestroyPipeline = (PFN_vkDestroyPipeline) load(userptr, "vkDestroyPipeline"); + glad_vkDestroyPipelineCache = (PFN_vkDestroyPipelineCache) load(userptr, "vkDestroyPipelineCache"); + glad_vkDestroyPipelineLayout = (PFN_vkDestroyPipelineLayout) load(userptr, "vkDestroyPipelineLayout"); + glad_vkDestroyQueryPool = (PFN_vkDestroyQueryPool) load(userptr, "vkDestroyQueryPool"); + glad_vkDestroyRenderPass = (PFN_vkDestroyRenderPass) load(userptr, "vkDestroyRenderPass"); + glad_vkDestroySampler = (PFN_vkDestroySampler) load(userptr, "vkDestroySampler"); + glad_vkDestroySemaphore = (PFN_vkDestroySemaphore) load(userptr, "vkDestroySemaphore"); + glad_vkDestroyShaderModule = (PFN_vkDestroyShaderModule) load(userptr, "vkDestroyShaderModule"); + glad_vkDeviceWaitIdle = (PFN_vkDeviceWaitIdle) load(userptr, "vkDeviceWaitIdle"); + glad_vkEndCommandBuffer = (PFN_vkEndCommandBuffer) load(userptr, "vkEndCommandBuffer"); + glad_vkEnumerateDeviceExtensionProperties = (PFN_vkEnumerateDeviceExtensionProperties) load(userptr, "vkEnumerateDeviceExtensionProperties"); + glad_vkEnumerateDeviceLayerProperties = (PFN_vkEnumerateDeviceLayerProperties) load(userptr, "vkEnumerateDeviceLayerProperties"); + glad_vkEnumerateInstanceExtensionProperties = (PFN_vkEnumerateInstanceExtensionProperties) load(userptr, "vkEnumerateInstanceExtensionProperties"); + glad_vkEnumerateInstanceLayerProperties = (PFN_vkEnumerateInstanceLayerProperties) load(userptr, "vkEnumerateInstanceLayerProperties"); + glad_vkEnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices) load(userptr, "vkEnumeratePhysicalDevices"); + glad_vkFlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges) load(userptr, "vkFlushMappedMemoryRanges"); + glad_vkFreeCommandBuffers = (PFN_vkFreeCommandBuffers) load(userptr, "vkFreeCommandBuffers"); + glad_vkFreeDescriptorSets = (PFN_vkFreeDescriptorSets) load(userptr, "vkFreeDescriptorSets"); + glad_vkFreeMemory = (PFN_vkFreeMemory) load(userptr, "vkFreeMemory"); + glad_vkGetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements) load(userptr, "vkGetBufferMemoryRequirements"); + glad_vkGetDeviceMemoryCommitment = (PFN_vkGetDeviceMemoryCommitment) load(userptr, "vkGetDeviceMemoryCommitment"); + glad_vkGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr) load(userptr, "vkGetDeviceProcAddr"); + glad_vkGetDeviceQueue = (PFN_vkGetDeviceQueue) load(userptr, "vkGetDeviceQueue"); + glad_vkGetEventStatus = (PFN_vkGetEventStatus) load(userptr, "vkGetEventStatus"); + glad_vkGetFenceStatus = (PFN_vkGetFenceStatus) load(userptr, "vkGetFenceStatus"); + glad_vkGetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements) load(userptr, "vkGetImageMemoryRequirements"); + glad_vkGetImageSparseMemoryRequirements = (PFN_vkGetImageSparseMemoryRequirements) load(userptr, "vkGetImageSparseMemoryRequirements"); + glad_vkGetImageSubresourceLayout = (PFN_vkGetImageSubresourceLayout) load(userptr, "vkGetImageSubresourceLayout"); + glad_vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr) load(userptr, "vkGetInstanceProcAddr"); + glad_vkGetPhysicalDeviceFeatures = (PFN_vkGetPhysicalDeviceFeatures) load(userptr, "vkGetPhysicalDeviceFeatures"); + glad_vkGetPhysicalDeviceFormatProperties = (PFN_vkGetPhysicalDeviceFormatProperties) load(userptr, "vkGetPhysicalDeviceFormatProperties"); + glad_vkGetPhysicalDeviceImageFormatProperties = (PFN_vkGetPhysicalDeviceImageFormatProperties) load(userptr, "vkGetPhysicalDeviceImageFormatProperties"); + glad_vkGetPhysicalDeviceMemoryProperties = (PFN_vkGetPhysicalDeviceMemoryProperties) load(userptr, "vkGetPhysicalDeviceMemoryProperties"); + glad_vkGetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties) load(userptr, "vkGetPhysicalDeviceProperties"); + glad_vkGetPhysicalDeviceQueueFamilyProperties = (PFN_vkGetPhysicalDeviceQueueFamilyProperties) load(userptr, "vkGetPhysicalDeviceQueueFamilyProperties"); + glad_vkGetPhysicalDeviceSparseImageFormatProperties = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties) load(userptr, "vkGetPhysicalDeviceSparseImageFormatProperties"); + glad_vkGetPipelineCacheData = (PFN_vkGetPipelineCacheData) load(userptr, "vkGetPipelineCacheData"); + glad_vkGetQueryPoolResults = (PFN_vkGetQueryPoolResults) load(userptr, "vkGetQueryPoolResults"); + glad_vkGetRenderAreaGranularity = (PFN_vkGetRenderAreaGranularity) load(userptr, "vkGetRenderAreaGranularity"); + glad_vkInvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges) load(userptr, "vkInvalidateMappedMemoryRanges"); + glad_vkMapMemory = (PFN_vkMapMemory) load(userptr, "vkMapMemory"); + glad_vkMergePipelineCaches = (PFN_vkMergePipelineCaches) load(userptr, "vkMergePipelineCaches"); + glad_vkQueueBindSparse = (PFN_vkQueueBindSparse) load(userptr, "vkQueueBindSparse"); + glad_vkQueueSubmit = (PFN_vkQueueSubmit) load(userptr, "vkQueueSubmit"); + glad_vkQueueWaitIdle = (PFN_vkQueueWaitIdle) load(userptr, "vkQueueWaitIdle"); + glad_vkResetCommandBuffer = (PFN_vkResetCommandBuffer) load(userptr, "vkResetCommandBuffer"); + glad_vkResetCommandPool = (PFN_vkResetCommandPool) load(userptr, "vkResetCommandPool"); + glad_vkResetDescriptorPool = (PFN_vkResetDescriptorPool) load(userptr, "vkResetDescriptorPool"); + glad_vkResetEvent = (PFN_vkResetEvent) load(userptr, "vkResetEvent"); + glad_vkResetFences = (PFN_vkResetFences) load(userptr, "vkResetFences"); + glad_vkSetEvent = (PFN_vkSetEvent) load(userptr, "vkSetEvent"); + glad_vkUnmapMemory = (PFN_vkUnmapMemory) load(userptr, "vkUnmapMemory"); + glad_vkUpdateDescriptorSets = (PFN_vkUpdateDescriptorSets) load(userptr, "vkUpdateDescriptorSets"); + glad_vkWaitForFences = (PFN_vkWaitForFences) load(userptr, "vkWaitForFences"); } static void glad_vk_load_VK_VERSION_1_1( GLADuserptrloadfunc load, void* userptr) { if(!GLAD_VK_VERSION_1_1) return; - vkBindBufferMemory2 = (PFN_vkBindBufferMemory2) load("vkBindBufferMemory2", userptr); - vkBindImageMemory2 = (PFN_vkBindImageMemory2) load("vkBindImageMemory2", userptr); - vkCmdDispatchBase = (PFN_vkCmdDispatchBase) load("vkCmdDispatchBase", userptr); - vkCmdSetDeviceMask = (PFN_vkCmdSetDeviceMask) load("vkCmdSetDeviceMask", userptr); - vkCreateDescriptorUpdateTemplate = (PFN_vkCreateDescriptorUpdateTemplate) load("vkCreateDescriptorUpdateTemplate", userptr); - vkCreateSamplerYcbcrConversion = (PFN_vkCreateSamplerYcbcrConversion) load("vkCreateSamplerYcbcrConversion", userptr); - vkDestroyDescriptorUpdateTemplate = (PFN_vkDestroyDescriptorUpdateTemplate) load("vkDestroyDescriptorUpdateTemplate", userptr); - vkDestroySamplerYcbcrConversion = (PFN_vkDestroySamplerYcbcrConversion) load("vkDestroySamplerYcbcrConversion", userptr); - vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load("vkEnumerateInstanceVersion", userptr); - vkEnumeratePhysicalDeviceGroups = (PFN_vkEnumeratePhysicalDeviceGroups) load("vkEnumeratePhysicalDeviceGroups", userptr); - vkGetBufferMemoryRequirements2 = (PFN_vkGetBufferMemoryRequirements2) load("vkGetBufferMemoryRequirements2", userptr); - vkGetDescriptorSetLayoutSupport = (PFN_vkGetDescriptorSetLayoutSupport) load("vkGetDescriptorSetLayoutSupport", userptr); - vkGetDeviceGroupPeerMemoryFeatures = (PFN_vkGetDeviceGroupPeerMemoryFeatures) load("vkGetDeviceGroupPeerMemoryFeatures", userptr); - vkGetDeviceQueue2 = (PFN_vkGetDeviceQueue2) load("vkGetDeviceQueue2", userptr); - vkGetImageMemoryRequirements2 = (PFN_vkGetImageMemoryRequirements2) load("vkGetImageMemoryRequirements2", userptr); - vkGetImageSparseMemoryRequirements2 = (PFN_vkGetImageSparseMemoryRequirements2) load("vkGetImageSparseMemoryRequirements2", userptr); - vkGetPhysicalDeviceExternalBufferProperties = (PFN_vkGetPhysicalDeviceExternalBufferProperties) load("vkGetPhysicalDeviceExternalBufferProperties", userptr); - vkGetPhysicalDeviceExternalFenceProperties = (PFN_vkGetPhysicalDeviceExternalFenceProperties) load("vkGetPhysicalDeviceExternalFenceProperties", userptr); - vkGetPhysicalDeviceExternalSemaphoreProperties = (PFN_vkGetPhysicalDeviceExternalSemaphoreProperties) load("vkGetPhysicalDeviceExternalSemaphoreProperties", userptr); - vkGetPhysicalDeviceFeatures2 = (PFN_vkGetPhysicalDeviceFeatures2) load("vkGetPhysicalDeviceFeatures2", userptr); - vkGetPhysicalDeviceFormatProperties2 = (PFN_vkGetPhysicalDeviceFormatProperties2) load("vkGetPhysicalDeviceFormatProperties2", userptr); - vkGetPhysicalDeviceImageFormatProperties2 = (PFN_vkGetPhysicalDeviceImageFormatProperties2) load("vkGetPhysicalDeviceImageFormatProperties2", userptr); - vkGetPhysicalDeviceMemoryProperties2 = (PFN_vkGetPhysicalDeviceMemoryProperties2) load("vkGetPhysicalDeviceMemoryProperties2", userptr); - vkGetPhysicalDeviceProperties2 = (PFN_vkGetPhysicalDeviceProperties2) load("vkGetPhysicalDeviceProperties2", userptr); - vkGetPhysicalDeviceQueueFamilyProperties2 = (PFN_vkGetPhysicalDeviceQueueFamilyProperties2) load("vkGetPhysicalDeviceQueueFamilyProperties2", userptr); - vkGetPhysicalDeviceSparseImageFormatProperties2 = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2) load("vkGetPhysicalDeviceSparseImageFormatProperties2", userptr); - vkTrimCommandPool = (PFN_vkTrimCommandPool) load("vkTrimCommandPool", userptr); - vkUpdateDescriptorSetWithTemplate = (PFN_vkUpdateDescriptorSetWithTemplate) load("vkUpdateDescriptorSetWithTemplate", userptr); + glad_vkBindBufferMemory2 = (PFN_vkBindBufferMemory2) load(userptr, "vkBindBufferMemory2"); + glad_vkBindImageMemory2 = (PFN_vkBindImageMemory2) load(userptr, "vkBindImageMemory2"); + glad_vkCmdDispatchBase = (PFN_vkCmdDispatchBase) load(userptr, "vkCmdDispatchBase"); + glad_vkCmdSetDeviceMask = (PFN_vkCmdSetDeviceMask) load(userptr, "vkCmdSetDeviceMask"); + glad_vkCreateDescriptorUpdateTemplate = (PFN_vkCreateDescriptorUpdateTemplate) load(userptr, "vkCreateDescriptorUpdateTemplate"); + glad_vkCreateSamplerYcbcrConversion = (PFN_vkCreateSamplerYcbcrConversion) load(userptr, "vkCreateSamplerYcbcrConversion"); + glad_vkDestroyDescriptorUpdateTemplate = (PFN_vkDestroyDescriptorUpdateTemplate) load(userptr, "vkDestroyDescriptorUpdateTemplate"); + glad_vkDestroySamplerYcbcrConversion = (PFN_vkDestroySamplerYcbcrConversion) load(userptr, "vkDestroySamplerYcbcrConversion"); + glad_vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load(userptr, "vkEnumerateInstanceVersion"); + glad_vkEnumeratePhysicalDeviceGroups = (PFN_vkEnumeratePhysicalDeviceGroups) load(userptr, "vkEnumeratePhysicalDeviceGroups"); + glad_vkGetBufferMemoryRequirements2 = (PFN_vkGetBufferMemoryRequirements2) load(userptr, "vkGetBufferMemoryRequirements2"); + glad_vkGetDescriptorSetLayoutSupport = (PFN_vkGetDescriptorSetLayoutSupport) load(userptr, "vkGetDescriptorSetLayoutSupport"); + glad_vkGetDeviceGroupPeerMemoryFeatures = (PFN_vkGetDeviceGroupPeerMemoryFeatures) load(userptr, "vkGetDeviceGroupPeerMemoryFeatures"); + glad_vkGetDeviceQueue2 = (PFN_vkGetDeviceQueue2) load(userptr, "vkGetDeviceQueue2"); + glad_vkGetImageMemoryRequirements2 = (PFN_vkGetImageMemoryRequirements2) load(userptr, "vkGetImageMemoryRequirements2"); + glad_vkGetImageSparseMemoryRequirements2 = (PFN_vkGetImageSparseMemoryRequirements2) load(userptr, "vkGetImageSparseMemoryRequirements2"); + glad_vkGetPhysicalDeviceExternalBufferProperties = (PFN_vkGetPhysicalDeviceExternalBufferProperties) load(userptr, "vkGetPhysicalDeviceExternalBufferProperties"); + glad_vkGetPhysicalDeviceExternalFenceProperties = (PFN_vkGetPhysicalDeviceExternalFenceProperties) load(userptr, "vkGetPhysicalDeviceExternalFenceProperties"); + glad_vkGetPhysicalDeviceExternalSemaphoreProperties = (PFN_vkGetPhysicalDeviceExternalSemaphoreProperties) load(userptr, "vkGetPhysicalDeviceExternalSemaphoreProperties"); + glad_vkGetPhysicalDeviceFeatures2 = (PFN_vkGetPhysicalDeviceFeatures2) load(userptr, "vkGetPhysicalDeviceFeatures2"); + glad_vkGetPhysicalDeviceFormatProperties2 = (PFN_vkGetPhysicalDeviceFormatProperties2) load(userptr, "vkGetPhysicalDeviceFormatProperties2"); + glad_vkGetPhysicalDeviceImageFormatProperties2 = (PFN_vkGetPhysicalDeviceImageFormatProperties2) load(userptr, "vkGetPhysicalDeviceImageFormatProperties2"); + glad_vkGetPhysicalDeviceMemoryProperties2 = (PFN_vkGetPhysicalDeviceMemoryProperties2) load(userptr, "vkGetPhysicalDeviceMemoryProperties2"); + glad_vkGetPhysicalDeviceProperties2 = (PFN_vkGetPhysicalDeviceProperties2) load(userptr, "vkGetPhysicalDeviceProperties2"); + glad_vkGetPhysicalDeviceQueueFamilyProperties2 = (PFN_vkGetPhysicalDeviceQueueFamilyProperties2) load(userptr, "vkGetPhysicalDeviceQueueFamilyProperties2"); + glad_vkGetPhysicalDeviceSparseImageFormatProperties2 = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2) load(userptr, "vkGetPhysicalDeviceSparseImageFormatProperties2"); + glad_vkTrimCommandPool = (PFN_vkTrimCommandPool) load(userptr, "vkTrimCommandPool"); + glad_vkUpdateDescriptorSetWithTemplate = (PFN_vkUpdateDescriptorSetWithTemplate) load(userptr, "vkUpdateDescriptorSetWithTemplate"); +} +static void glad_vk_load_VK_VERSION_1_2( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_VK_VERSION_1_2) return; + glad_vkCmdBeginRenderPass2 = (PFN_vkCmdBeginRenderPass2) load(userptr, "vkCmdBeginRenderPass2"); + glad_vkCmdDrawIndexedIndirectCount = (PFN_vkCmdDrawIndexedIndirectCount) load(userptr, "vkCmdDrawIndexedIndirectCount"); + glad_vkCmdDrawIndirectCount = (PFN_vkCmdDrawIndirectCount) load(userptr, "vkCmdDrawIndirectCount"); + glad_vkCmdEndRenderPass2 = (PFN_vkCmdEndRenderPass2) load(userptr, "vkCmdEndRenderPass2"); + glad_vkCmdNextSubpass2 = (PFN_vkCmdNextSubpass2) load(userptr, "vkCmdNextSubpass2"); + glad_vkCreateRenderPass2 = (PFN_vkCreateRenderPass2) load(userptr, "vkCreateRenderPass2"); + glad_vkGetBufferDeviceAddress = (PFN_vkGetBufferDeviceAddress) load(userptr, "vkGetBufferDeviceAddress"); + glad_vkGetBufferOpaqueCaptureAddress = (PFN_vkGetBufferOpaqueCaptureAddress) load(userptr, "vkGetBufferOpaqueCaptureAddress"); + glad_vkGetDeviceMemoryOpaqueCaptureAddress = (PFN_vkGetDeviceMemoryOpaqueCaptureAddress) load(userptr, "vkGetDeviceMemoryOpaqueCaptureAddress"); + glad_vkGetSemaphoreCounterValue = (PFN_vkGetSemaphoreCounterValue) load(userptr, "vkGetSemaphoreCounterValue"); + glad_vkResetQueryPool = (PFN_vkResetQueryPool) load(userptr, "vkResetQueryPool"); + glad_vkSignalSemaphore = (PFN_vkSignalSemaphore) load(userptr, "vkSignalSemaphore"); + glad_vkWaitSemaphores = (PFN_vkWaitSemaphores) load(userptr, "vkWaitSemaphores"); +} +static void glad_vk_load_VK_VERSION_1_3( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_VK_VERSION_1_3) return; + glad_vkCmdBeginRendering = (PFN_vkCmdBeginRendering) load(userptr, "vkCmdBeginRendering"); + glad_vkCmdBindVertexBuffers2 = (PFN_vkCmdBindVertexBuffers2) load(userptr, "vkCmdBindVertexBuffers2"); + glad_vkCmdBlitImage2 = (PFN_vkCmdBlitImage2) load(userptr, "vkCmdBlitImage2"); + glad_vkCmdCopyBuffer2 = (PFN_vkCmdCopyBuffer2) load(userptr, "vkCmdCopyBuffer2"); + glad_vkCmdCopyBufferToImage2 = (PFN_vkCmdCopyBufferToImage2) load(userptr, "vkCmdCopyBufferToImage2"); + glad_vkCmdCopyImage2 = (PFN_vkCmdCopyImage2) load(userptr, "vkCmdCopyImage2"); + glad_vkCmdCopyImageToBuffer2 = (PFN_vkCmdCopyImageToBuffer2) load(userptr, "vkCmdCopyImageToBuffer2"); + glad_vkCmdEndRendering = (PFN_vkCmdEndRendering) load(userptr, "vkCmdEndRendering"); + glad_vkCmdPipelineBarrier2 = (PFN_vkCmdPipelineBarrier2) load(userptr, "vkCmdPipelineBarrier2"); + glad_vkCmdResetEvent2 = (PFN_vkCmdResetEvent2) load(userptr, "vkCmdResetEvent2"); + glad_vkCmdResolveImage2 = (PFN_vkCmdResolveImage2) load(userptr, "vkCmdResolveImage2"); + glad_vkCmdSetCullMode = (PFN_vkCmdSetCullMode) load(userptr, "vkCmdSetCullMode"); + glad_vkCmdSetDepthBiasEnable = (PFN_vkCmdSetDepthBiasEnable) load(userptr, "vkCmdSetDepthBiasEnable"); + glad_vkCmdSetDepthBoundsTestEnable = (PFN_vkCmdSetDepthBoundsTestEnable) load(userptr, "vkCmdSetDepthBoundsTestEnable"); + glad_vkCmdSetDepthCompareOp = (PFN_vkCmdSetDepthCompareOp) load(userptr, "vkCmdSetDepthCompareOp"); + glad_vkCmdSetDepthTestEnable = (PFN_vkCmdSetDepthTestEnable) load(userptr, "vkCmdSetDepthTestEnable"); + glad_vkCmdSetDepthWriteEnable = (PFN_vkCmdSetDepthWriteEnable) load(userptr, "vkCmdSetDepthWriteEnable"); + glad_vkCmdSetEvent2 = (PFN_vkCmdSetEvent2) load(userptr, "vkCmdSetEvent2"); + glad_vkCmdSetFrontFace = (PFN_vkCmdSetFrontFace) load(userptr, "vkCmdSetFrontFace"); + glad_vkCmdSetPrimitiveRestartEnable = (PFN_vkCmdSetPrimitiveRestartEnable) load(userptr, "vkCmdSetPrimitiveRestartEnable"); + glad_vkCmdSetPrimitiveTopology = (PFN_vkCmdSetPrimitiveTopology) load(userptr, "vkCmdSetPrimitiveTopology"); + glad_vkCmdSetRasterizerDiscardEnable = (PFN_vkCmdSetRasterizerDiscardEnable) load(userptr, "vkCmdSetRasterizerDiscardEnable"); + glad_vkCmdSetScissorWithCount = (PFN_vkCmdSetScissorWithCount) load(userptr, "vkCmdSetScissorWithCount"); + glad_vkCmdSetStencilOp = (PFN_vkCmdSetStencilOp) load(userptr, "vkCmdSetStencilOp"); + glad_vkCmdSetStencilTestEnable = (PFN_vkCmdSetStencilTestEnable) load(userptr, "vkCmdSetStencilTestEnable"); + glad_vkCmdSetViewportWithCount = (PFN_vkCmdSetViewportWithCount) load(userptr, "vkCmdSetViewportWithCount"); + glad_vkCmdWaitEvents2 = (PFN_vkCmdWaitEvents2) load(userptr, "vkCmdWaitEvents2"); + glad_vkCmdWriteTimestamp2 = (PFN_vkCmdWriteTimestamp2) load(userptr, "vkCmdWriteTimestamp2"); + glad_vkCreatePrivateDataSlot = (PFN_vkCreatePrivateDataSlot) load(userptr, "vkCreatePrivateDataSlot"); + glad_vkDestroyPrivateDataSlot = (PFN_vkDestroyPrivateDataSlot) load(userptr, "vkDestroyPrivateDataSlot"); + glad_vkGetDeviceBufferMemoryRequirements = (PFN_vkGetDeviceBufferMemoryRequirements) load(userptr, "vkGetDeviceBufferMemoryRequirements"); + glad_vkGetDeviceImageMemoryRequirements = (PFN_vkGetDeviceImageMemoryRequirements) load(userptr, "vkGetDeviceImageMemoryRequirements"); + glad_vkGetDeviceImageSparseMemoryRequirements = (PFN_vkGetDeviceImageSparseMemoryRequirements) load(userptr, "vkGetDeviceImageSparseMemoryRequirements"); + glad_vkGetPhysicalDeviceToolProperties = (PFN_vkGetPhysicalDeviceToolProperties) load(userptr, "vkGetPhysicalDeviceToolProperties"); + glad_vkGetPrivateData = (PFN_vkGetPrivateData) load(userptr, "vkGetPrivateData"); + glad_vkQueueSubmit2 = (PFN_vkQueueSubmit2) load(userptr, "vkQueueSubmit2"); + glad_vkSetPrivateData = (PFN_vkSetPrivateData) load(userptr, "vkSetPrivateData"); } static void glad_vk_load_VK_EXT_debug_report( GLADuserptrloadfunc load, void* userptr) { if(!GLAD_VK_EXT_debug_report) return; - vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT) load("vkCreateDebugReportCallbackEXT", userptr); - vkDebugReportMessageEXT = (PFN_vkDebugReportMessageEXT) load("vkDebugReportMessageEXT", userptr); - vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT) load("vkDestroyDebugReportCallbackEXT", userptr); + glad_vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT) load(userptr, "vkCreateDebugReportCallbackEXT"); + glad_vkDebugReportMessageEXT = (PFN_vkDebugReportMessageEXT) load(userptr, "vkDebugReportMessageEXT"); + glad_vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT) load(userptr, "vkDestroyDebugReportCallbackEXT"); } static void glad_vk_load_VK_KHR_surface( GLADuserptrloadfunc load, void* userptr) { if(!GLAD_VK_KHR_surface) return; - vkDestroySurfaceKHR = (PFN_vkDestroySurfaceKHR) load("vkDestroySurfaceKHR", userptr); - vkGetPhysicalDeviceSurfaceCapabilitiesKHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR) load("vkGetPhysicalDeviceSurfaceCapabilitiesKHR", userptr); - vkGetPhysicalDeviceSurfaceFormatsKHR = (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR) load("vkGetPhysicalDeviceSurfaceFormatsKHR", userptr); - vkGetPhysicalDeviceSurfacePresentModesKHR = (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR) load("vkGetPhysicalDeviceSurfacePresentModesKHR", userptr); - vkGetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR) load("vkGetPhysicalDeviceSurfaceSupportKHR", userptr); + glad_vkDestroySurfaceKHR = (PFN_vkDestroySurfaceKHR) load(userptr, "vkDestroySurfaceKHR"); + glad_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR) load(userptr, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR"); + glad_vkGetPhysicalDeviceSurfaceFormatsKHR = (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR) load(userptr, "vkGetPhysicalDeviceSurfaceFormatsKHR"); + glad_vkGetPhysicalDeviceSurfacePresentModesKHR = (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR) load(userptr, "vkGetPhysicalDeviceSurfacePresentModesKHR"); + glad_vkGetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR) load(userptr, "vkGetPhysicalDeviceSurfaceSupportKHR"); } static void glad_vk_load_VK_KHR_swapchain( GLADuserptrloadfunc load, void* userptr) { if(!GLAD_VK_KHR_swapchain) return; - vkAcquireNextImage2KHR = (PFN_vkAcquireNextImage2KHR) load("vkAcquireNextImage2KHR", userptr); - vkAcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) load("vkAcquireNextImageKHR", userptr); - vkCreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) load("vkCreateSwapchainKHR", userptr); - vkDestroySwapchainKHR = (PFN_vkDestroySwapchainKHR) load("vkDestroySwapchainKHR", userptr); - vkGetDeviceGroupPresentCapabilitiesKHR = (PFN_vkGetDeviceGroupPresentCapabilitiesKHR) load("vkGetDeviceGroupPresentCapabilitiesKHR", userptr); - vkGetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR) load("vkGetDeviceGroupSurfacePresentModesKHR", userptr); - vkGetPhysicalDevicePresentRectanglesKHR = (PFN_vkGetPhysicalDevicePresentRectanglesKHR) load("vkGetPhysicalDevicePresentRectanglesKHR", userptr); - vkGetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR) load("vkGetSwapchainImagesKHR", userptr); - vkQueuePresentKHR = (PFN_vkQueuePresentKHR) load("vkQueuePresentKHR", userptr); + glad_vkAcquireNextImage2KHR = (PFN_vkAcquireNextImage2KHR) load(userptr, "vkAcquireNextImage2KHR"); + glad_vkAcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) load(userptr, "vkAcquireNextImageKHR"); + glad_vkCreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) load(userptr, "vkCreateSwapchainKHR"); + glad_vkDestroySwapchainKHR = (PFN_vkDestroySwapchainKHR) load(userptr, "vkDestroySwapchainKHR"); + glad_vkGetDeviceGroupPresentCapabilitiesKHR = (PFN_vkGetDeviceGroupPresentCapabilitiesKHR) load(userptr, "vkGetDeviceGroupPresentCapabilitiesKHR"); + glad_vkGetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR) load(userptr, "vkGetDeviceGroupSurfacePresentModesKHR"); + glad_vkGetPhysicalDevicePresentRectanglesKHR = (PFN_vkGetPhysicalDevicePresentRectanglesKHR) load(userptr, "vkGetPhysicalDevicePresentRectanglesKHR"); + glad_vkGetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR) load(userptr, "vkGetSwapchainImagesKHR"); + glad_vkQueuePresentKHR = (PFN_vkQueuePresentKHR) load(userptr, "vkQueuePresentKHR"); } @@ -411,47 +525,49 @@ static int glad_vk_get_extensions( VkPhysicalDevice physical_device, uint32_t *o uint32_t i; uint32_t instance_extension_count = 0; uint32_t device_extension_count = 0; - uint32_t max_extension_count; - uint32_t total_extension_count; - char **extensions; - VkExtensionProperties *ext_properties; + uint32_t max_extension_count = 0; + uint32_t total_extension_count = 0; + char **extensions = NULL; + VkExtensionProperties *ext_properties = NULL; VkResult result; - if (vkEnumerateInstanceExtensionProperties == NULL || (physical_device != NULL && vkEnumerateDeviceExtensionProperties == NULL)) { + if (glad_vkEnumerateInstanceExtensionProperties == NULL || (physical_device != NULL && glad_vkEnumerateDeviceExtensionProperties == NULL)) { return 0; } - result = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, NULL); + result = glad_vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, NULL); if (result != VK_SUCCESS) { return 0; } if (physical_device != NULL) { - result = vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, NULL); + result = glad_vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, NULL); if (result != VK_SUCCESS) { return 0; } } total_extension_count = instance_extension_count + device_extension_count; + if (total_extension_count <= 0) { + return 0; + } + max_extension_count = instance_extension_count > device_extension_count ? instance_extension_count : device_extension_count; ext_properties = (VkExtensionProperties*) malloc(max_extension_count * sizeof(VkExtensionProperties)); if (ext_properties == NULL) { - return 0; + goto glad_vk_get_extensions_error; } - result = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, ext_properties); + result = glad_vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, ext_properties); if (result != VK_SUCCESS) { - free((void*) ext_properties); - return 0; + goto glad_vk_get_extensions_error; } extensions = (char**) calloc(total_extension_count, sizeof(char*)); if (extensions == NULL) { - free((void*) ext_properties); - return 0; + goto glad_vk_get_extensions_error; } for (i = 0; i < instance_extension_count; ++i) { @@ -459,17 +575,16 @@ static int glad_vk_get_extensions( VkPhysicalDevice physical_device, uint32_t *o size_t extension_name_length = strlen(ext.extensionName) + 1; extensions[i] = (char*) malloc(extension_name_length * sizeof(char)); + if (extensions[i] == NULL) { + goto glad_vk_get_extensions_error; + } memcpy(extensions[i], ext.extensionName, extension_name_length * sizeof(char)); } if (physical_device != NULL) { - result = vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, ext_properties); + result = glad_vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, ext_properties); if (result != VK_SUCCESS) { - for (i = 0; i < instance_extension_count; ++i) { - free((void*) extensions[i]); - } - free(extensions); - return 0; + goto glad_vk_get_extensions_error; } for (i = 0; i < device_extension_count; ++i) { @@ -477,6 +592,9 @@ static int glad_vk_get_extensions( VkPhysicalDevice physical_device, uint32_t *o size_t extension_name_length = strlen(ext.extensionName) + 1; extensions[instance_extension_count + i] = (char*) malloc(extension_name_length * sizeof(char)); + if (extensions[instance_extension_count + i] == NULL) { + goto glad_vk_get_extensions_error; + } memcpy(extensions[instance_extension_count + i], ext.extensionName, extension_name_length * sizeof(char)); } } @@ -487,6 +605,16 @@ static int glad_vk_get_extensions( VkPhysicalDevice physical_device, uint32_t *o *out_extensions = extensions; return 1; + +glad_vk_get_extensions_error: + free((void*) ext_properties); + if (extensions != NULL) { + for (i = 0; i < total_extension_count; ++i) { + free((void*) extensions[i]); + } + free(extensions); + } + return 0; } static void glad_vk_free_extensions(uint32_t extension_count, char **extensions) { @@ -503,7 +631,7 @@ static int glad_vk_has_extension(const char *name, uint32_t extension_count, cha uint32_t i; for (i = 0; i < extension_count; ++i) { - if(strcmp(name, extensions[i]) == 0) { + if(extensions[i] != NULL && strcmp(name, extensions[i]) == 0) { return 1; } } @@ -511,7 +639,7 @@ static int glad_vk_has_extension(const char *name, uint32_t extension_count, cha return 0; } -static GLADapiproc glad_vk_get_proc_from_userptr(const char* name, void *userptr) { +static GLADapiproc glad_vk_get_proc_from_userptr(void *userptr, const char* name) { return (GLAD_GNUC_EXTENSION (GLADapiproc (*)(const char *name)) userptr)(name); } @@ -521,9 +649,12 @@ static int glad_vk_find_extensions_vulkan( VkPhysicalDevice physical_device) { if (!glad_vk_get_extensions(physical_device, &extension_count, &extensions)) return 0; GLAD_VK_EXT_debug_report = glad_vk_has_extension("VK_EXT_debug_report", extension_count, extensions); + GLAD_VK_KHR_portability_enumeration = glad_vk_has_extension("VK_KHR_portability_enumeration", extension_count, extensions); GLAD_VK_KHR_surface = glad_vk_has_extension("VK_KHR_surface", extension_count, extensions); GLAD_VK_KHR_swapchain = glad_vk_has_extension("VK_KHR_swapchain", extension_count, extensions); + (void) glad_vk_has_extension; + glad_vk_free_extensions(extension_count, extensions); return 1; @@ -534,11 +665,11 @@ static int glad_vk_find_core_vulkan( VkPhysicalDevice physical_device) { int minor = 0; #ifdef VK_VERSION_1_1 - if (vkEnumerateInstanceVersion != NULL) { + if (glad_vkEnumerateInstanceVersion != NULL) { uint32_t version; VkResult result; - result = vkEnumerateInstanceVersion(&version); + result = glad_vkEnumerateInstanceVersion(&version); if (result == VK_SUCCESS) { major = (int) VK_VERSION_MAJOR(version); minor = (int) VK_VERSION_MINOR(version); @@ -546,9 +677,9 @@ static int glad_vk_find_core_vulkan( VkPhysicalDevice physical_device) { } #endif - if (physical_device != NULL && vkGetPhysicalDeviceProperties != NULL) { + if (physical_device != NULL && glad_vkGetPhysicalDeviceProperties != NULL) { VkPhysicalDeviceProperties properties; - vkGetPhysicalDeviceProperties(physical_device, &properties); + glad_vkGetPhysicalDeviceProperties(physical_device, &properties); major = (int) VK_VERSION_MAJOR(properties.apiVersion); minor = (int) VK_VERSION_MINOR(properties.apiVersion); @@ -556,6 +687,8 @@ static int glad_vk_find_core_vulkan( VkPhysicalDevice physical_device) { GLAD_VK_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1; GLAD_VK_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1; + GLAD_VK_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1; + GLAD_VK_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1; return GLAD_MAKE_VERSION(major, minor); } @@ -564,7 +697,7 @@ int gladLoadVulkanUserPtr( VkPhysicalDevice physical_device, GLADuserptrloadfunc int version; #ifdef VK_VERSION_1_1 - vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load("vkEnumerateInstanceVersion", userptr); + glad_vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load(userptr, "vkEnumerateInstanceVersion"); #endif version = glad_vk_find_core_vulkan( physical_device); if (!version) { @@ -573,6 +706,8 @@ int gladLoadVulkanUserPtr( VkPhysicalDevice physical_device, GLADuserptrloadfunc glad_vk_load_VK_VERSION_1_0(load, userptr); glad_vk_load_VK_VERSION_1_1(load, userptr); + glad_vk_load_VK_VERSION_1_2(load, userptr); + glad_vk_load_VK_VERSION_1_3(load, userptr); if (!glad_vk_find_extensions_vulkan( physical_device)) return 0; glad_vk_load_VK_EXT_debug_report(load, userptr); @@ -590,4 +725,9 @@ int gladLoadVulkan( VkPhysicalDevice physical_device, GLADloadfunc load) { + + +#ifdef __cplusplus +} +#endif diff --git a/third_party/penumbra/vendor/glfw/deps/linmath.h b/third_party/penumbra/vendor/glfw/deps/linmath.h index 9c2e2a0abf2..0ab7a414b42 100644 --- a/third_party/penumbra/vendor/glfw/deps/linmath.h +++ b/third_party/penumbra/vendor/glfw/deps/linmath.h @@ -237,9 +237,9 @@ static inline void mat4x4_rotate_Y(mat4x4 Q, mat4x4 M, float angle) float s = sinf(angle); float c = cosf(angle); mat4x4 R = { - { c, 0.f, s, 0.f}, + { c, 0.f, -s, 0.f}, { 0.f, 1.f, 0.f, 0.f}, - { -s, 0.f, c, 0.f}, + { s, 0.f, c, 0.f}, { 0.f, 0.f, 0.f, 1.f} }; mat4x4_mul(Q, M, R); diff --git a/third_party/penumbra/vendor/glfw/deps/stb_image_write.h b/third_party/penumbra/vendor/glfw/deps/stb_image_write.h index 4319c0de1d9..e4b32ed1bc3 100644 --- a/third_party/penumbra/vendor/glfw/deps/stb_image_write.h +++ b/third_party/penumbra/vendor/glfw/deps/stb_image_write.h @@ -1,5 +1,5 @@ -/* stb_image_write - v1.02 - public domain - http://nothings.org/stb/stb_image_write.h - writes out PNG/BMP/TGA images to C stdio - Sean Barrett 2010-2015 +/* stb_image_write - v1.16 - public domain - http://nothings.org/stb + writes out PNG/BMP/TGA/JPEG/HDR images to C stdio - Sean Barrett 2010-2015 no warranty implied; use at your own risk Before #including, @@ -12,41 +12,64 @@ ABOUT: - This header file is a library for writing images to C stdio. It could be - adapted to write to memory or a general streaming interface; let me know. + This header file is a library for writing images to C stdio or a callback. The PNG output is not optimal; it is 20-50% larger than the file - written by a decent optimizing implementation. This library is designed - for source code compactness and simplicity, not optimal image file size - or run-time performance. + written by a decent optimizing implementation; though providing a custom + zlib compress function (see STBIW_ZLIB_COMPRESS) can mitigate that. + This library is designed for source code compactness and simplicity, + not optimal image file size or run-time performance. BUILDING: You can #define STBIW_ASSERT(x) before the #include to avoid using assert.h. You can #define STBIW_MALLOC(), STBIW_REALLOC(), and STBIW_FREE() to replace malloc,realloc,free. - You can define STBIW_MEMMOVE() to replace memmove() + You can #define STBIW_MEMMOVE() to replace memmove() + You can #define STBIW_ZLIB_COMPRESS to use a custom zlib-style compress function + for PNG compression (instead of the builtin one), it must have the following signature: + unsigned char * my_compress(unsigned char *data, int data_len, int *out_len, int quality); + The returned data will be freed with STBIW_FREE() (free() by default), + so it must be heap allocated with STBIW_MALLOC() (malloc() by default), + +UNICODE: + + If compiling for Windows and you wish to use Unicode filenames, compile + with + #define STBIW_WINDOWS_UTF8 + and pass utf8-encoded filenames. Call stbiw_convert_wchar_to_utf8 to convert + Windows wchar_t filenames to utf8. USAGE: - There are four functions, one for each image file format: + There are five functions, one for each image file format: int stbi_write_png(char const *filename, int w, int h, int comp, const void *data, int stride_in_bytes); int stbi_write_bmp(char const *filename, int w, int h, int comp, const void *data); int stbi_write_tga(char const *filename, int w, int h, int comp, const void *data); + int stbi_write_jpg(char const *filename, int w, int h, int comp, const void *data, int quality); int stbi_write_hdr(char const *filename, int w, int h, int comp, const float *data); - There are also four equivalent functions that use an arbitrary write function. You are + void stbi_flip_vertically_on_write(int flag); // flag is non-zero to flip data vertically + + There are also five equivalent functions that use an arbitrary write function. You are expected to open/close your file-equivalent before and after calling these: int stbi_write_png_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data, int stride_in_bytes); int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data); int stbi_write_tga_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data); int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const float *data); + int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality); where the callback is: void stbi_write_func(void *context, void *data, int size); + You can configure it with these global variables: + int stbi_write_tga_with_rle; // defaults to true; set to 0 to disable RLE + int stbi_write_png_compression_level; // defaults to 8; set to higher for more compression + int stbi_write_force_png_filter; // defaults to -1; set to 0..5 to force a filter mode + + You can define STBI_WRITE_NO_STDIO to disable the file variant of these functions, so the library will not use stdio.h at all. However, this will also disable HDR writing, because it requires stdio for formatted output. @@ -73,6 +96,9 @@ writer, both because it is in BGR order and because it may have padding at the end of the line.) + PNG allows you to set the deflate compression level by setting the global + variable 'stbi_write_png_compression_level' (it defaults to 8). + HDR expects linear float data. Since the format is always 32-bit rgb(e) data, alpha (if provided) is discarded, and for monochrome data it is replicated across all three channels. @@ -80,20 +106,23 @@ TGA supports RLE or non-RLE compressed data. To use non-RLE-compressed data, set the global variable 'stbi_write_tga_with_rle' to 0. + JPEG does ignore alpha channels in input data; quality is between 1 and 100. + Higher quality looks better but results in a bigger image. + JPEG baseline (no JPEG progressive). + CREDITS: - PNG/BMP/TGA - Sean Barrett - HDR - Baldur Karlsson - TGA monochrome: - Jean-Sebastien Guay - misc enhancements: - Tim Kelsey - TGA RLE - Alan Hickman - initial file IO callback implementation - Emmanuel Julien + + Sean Barrett - PNG/BMP/TGA + Baldur Karlsson - HDR + Jean-Sebastien Guay - TGA monochrome + Tim Kelsey - misc enhancements + Alan Hickman - TGA RLE + Emmanuel Julien - initial file IO callback implementation + Jon Olick - original jo_jpeg.cpp code + Daniel Gibson - integrate JPEG, allow external zlib + Aarni Koskela - allow choosing PNG filter + bugfixes: github:Chribba Guillaume Chereau @@ -103,27 +132,44 @@ Jonas Karlsson Filip Wasil Thatcher Ulrich - + github:poppolopoppo + Patrick Boettcher + github:xeekworx + Cap Petschulat + Simon Rodriguez + Ivan Tikhonov + github:ignotion + Adam Schackart + Andrew Kensler + LICENSE -This software is dual-licensed to the public domain and under the following -license: you are granted a perpetual, irrevocable license to copy, modify, -publish, and distribute this file as you see fit. + See end of file for license information. */ #ifndef INCLUDE_STB_IMAGE_WRITE_H #define INCLUDE_STB_IMAGE_WRITE_H -#ifdef __cplusplus -extern "C" { -#endif +#include +// if STB_IMAGE_WRITE_STATIC causes problems, try defining STBIWDEF to 'inline' or 'static inline' +#ifndef STBIWDEF #ifdef STB_IMAGE_WRITE_STATIC -#define STBIWDEF static +#define STBIWDEF static +#else +#ifdef __cplusplus +#define STBIWDEF extern "C" #else -#define STBIWDEF extern -extern int stbi_write_tga_with_rle; +#define STBIWDEF extern +#endif +#endif +#endif + +#ifndef STB_IMAGE_WRITE_STATIC // C++ forbids static forward declarations +STBIWDEF int stbi_write_tga_with_rle; +STBIWDEF int stbi_write_png_compression_level; +STBIWDEF int stbi_write_force_png_filter; #endif #ifndef STBI_WRITE_NO_STDIO @@ -131,6 +177,11 @@ STBIWDEF int stbi_write_png(char const *filename, int w, int h, int comp, const STBIWDEF int stbi_write_bmp(char const *filename, int w, int h, int comp, const void *data); STBIWDEF int stbi_write_tga(char const *filename, int w, int h, int comp, const void *data); STBIWDEF int stbi_write_hdr(char const *filename, int w, int h, int comp, const float *data); +STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const void *data, int quality); + +#ifdef STBIW_WINDOWS_UTF8 +STBIWDEF int stbiw_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input); +#endif #endif typedef void stbi_write_func(void *context, void *data, int size); @@ -139,10 +190,9 @@ STBIWDEF int stbi_write_png_to_func(stbi_write_func *func, void *context, int w, STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data); STBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data); STBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const float *data); +STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality); -#ifdef __cplusplus -} -#endif +STBIWDEF void stbi_flip_vertically_on_write(int flip_boolean); #endif//INCLUDE_STB_IMAGE_WRITE_H @@ -197,10 +247,29 @@ STBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int w, #define STBIW_UCHAR(x) (unsigned char) ((x) & 0xff) +#ifdef STB_IMAGE_WRITE_STATIC +static int stbi_write_png_compression_level = 8; +static int stbi_write_tga_with_rle = 1; +static int stbi_write_force_png_filter = -1; +#else +int stbi_write_png_compression_level = 8; +int stbi_write_tga_with_rle = 1; +int stbi_write_force_png_filter = -1; +#endif + +static int stbi__flip_vertically_on_write = 0; + +STBIWDEF void stbi_flip_vertically_on_write(int flag) +{ + stbi__flip_vertically_on_write = flag; +} + typedef struct { stbi_write_func *func; void *context; + unsigned char buffer[64]; + int buf_used; } stbi__write_context; // initialize a callback-based context @@ -217,9 +286,52 @@ static void stbi__stdio_write(void *context, void *data, int size) fwrite(data,1,size,(FILE*) context); } +#if defined(_WIN32) && defined(STBIW_WINDOWS_UTF8) +#ifdef __cplusplus +#define STBIW_EXTERN extern "C" +#else +#define STBIW_EXTERN extern +#endif +STBIW_EXTERN __declspec(dllimport) int __stdcall MultiByteToWideChar(unsigned int cp, unsigned long flags, const char *str, int cbmb, wchar_t *widestr, int cchwide); +STBIW_EXTERN __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int cp, unsigned long flags, const wchar_t *widestr, int cchwide, char *str, int cbmb, const char *defchar, int *used_default); + +STBIWDEF int stbiw_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input) +{ + return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL); +} +#endif + +static FILE *stbiw__fopen(char const *filename, char const *mode) +{ + FILE *f; +#if defined(_WIN32) && defined(STBIW_WINDOWS_UTF8) + wchar_t wMode[64]; + wchar_t wFilename[1024]; + if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename)/sizeof(*wFilename))) + return 0; + + if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode)/sizeof(*wMode))) + return 0; + +#if defined(_MSC_VER) && _MSC_VER >= 1400 + if (0 != _wfopen_s(&f, wFilename, wMode)) + f = 0; +#else + f = _wfopen(wFilename, wMode); +#endif + +#elif defined(_MSC_VER) && _MSC_VER >= 1400 + if (0 != fopen_s(&f, filename, mode)) + f=0; +#else + f = fopen(filename, mode); +#endif + return f; +} + static int stbi__start_write_file(stbi__write_context *s, const char *filename) { - FILE *f = fopen(filename, "wb"); + FILE *f = stbiw__fopen(filename, "wb"); stbi__start_write_callbacks(s, stbi__stdio_write, (void *) f); return f != NULL; } @@ -234,12 +346,6 @@ static void stbi__end_write_file(stbi__write_context *s) typedef unsigned int stbiw_uint32; typedef int stb_image_write_test[sizeof(stbiw_uint32)==4 ? 1 : -1]; -#ifdef STB_IMAGE_WRITE_STATIC -static int stbi_write_tga_with_rle = 1; -#else -int stbi_write_tga_with_rle = 1; -#endif - static void stbiw__writefv(stbi__write_context *s, const char *fmt, va_list v) { while (*fmt) { @@ -277,11 +383,36 @@ static void stbiw__writef(stbi__write_context *s, const char *fmt, ...) va_end(v); } +static void stbiw__write_flush(stbi__write_context *s) +{ + if (s->buf_used) { + s->func(s->context, &s->buffer, s->buf_used); + s->buf_used = 0; + } +} + +static void stbiw__putc(stbi__write_context *s, unsigned char c) +{ + s->func(s->context, &c, 1); +} + +static void stbiw__write1(stbi__write_context *s, unsigned char a) +{ + if ((size_t)s->buf_used + 1 > sizeof(s->buffer)) + stbiw__write_flush(s); + s->buffer[s->buf_used++] = a; +} + static void stbiw__write3(stbi__write_context *s, unsigned char a, unsigned char b, unsigned char c) { - unsigned char arr[3]; - arr[0] = a, arr[1] = b, arr[2] = c; - s->func(s->context, arr, 3); + int n; + if ((size_t)s->buf_used + 3 > sizeof(s->buffer)) + stbiw__write_flush(s); + n = s->buf_used; + s->buf_used = n+3; + s->buffer[n+0] = a; + s->buffer[n+1] = b; + s->buffer[n+2] = c; } static void stbiw__write_pixel(stbi__write_context *s, int rgb_dir, int comp, int write_alpha, int expand_mono, unsigned char *d) @@ -290,17 +421,15 @@ static void stbiw__write_pixel(stbi__write_context *s, int rgb_dir, int comp, in int k; if (write_alpha < 0) - s->func(s->context, &d[comp - 1], 1); + stbiw__write1(s, d[comp - 1]); switch (comp) { + case 2: // 2 pixels = mono + alpha, alpha is written separately, so same as 1-channel case case 1: - s->func(s->context,d,1); - break; - case 2: if (expand_mono) stbiw__write3(s, d[0], d[0], d[0]); // monochrome bmp else - s->func(s->context, d, 1); // monochrome TGA + stbiw__write1(s, d[0]); // monochrome TGA break; case 4: if (!write_alpha) { @@ -316,7 +445,7 @@ static void stbiw__write_pixel(stbi__write_context *s, int rgb_dir, int comp, in break; } if (write_alpha > 0) - s->func(s->context, &d[comp - 1], 1); + stbiw__write1(s, d[comp - 1]); } static void stbiw__write_pixels(stbi__write_context *s, int rgb_dir, int vdir, int x, int y, int comp, void *data, int write_alpha, int scanline_pad, int expand_mono) @@ -327,16 +456,21 @@ static void stbiw__write_pixels(stbi__write_context *s, int rgb_dir, int vdir, i if (y <= 0) return; - if (vdir < 0) - j_end = -1, j = y-1; - else - j_end = y, j = 0; + if (stbi__flip_vertically_on_write) + vdir *= -1; + + if (vdir < 0) { + j_end = -1; j = y-1; + } else { + j_end = y; j = 0; + } for (; j != j_end; j += vdir) { for (i=0; i < x; ++i) { unsigned char *d = (unsigned char *) data + (j*x+i)*comp; stbiw__write_pixel(s, rgb_dir, comp, write_alpha, expand_mono, d); } + stbiw__write_flush(s); s->func(s->context, &zero, scanline_pad); } } @@ -357,16 +491,27 @@ static int stbiw__outfile(stbi__write_context *s, int rgb_dir, int vdir, int x, static int stbi_write_bmp_core(stbi__write_context *s, int x, int y, int comp, const void *data) { - int pad = (-x*3) & 3; - return stbiw__outfile(s,-1,-1,x,y,comp,1,(void *) data,0,pad, - "11 4 22 4" "4 44 22 444444", - 'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header - 40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header + if (comp != 4) { + // write RGB bitmap + int pad = (-x*3) & 3; + return stbiw__outfile(s,-1,-1,x,y,comp,1,(void *) data,0,pad, + "11 4 22 4" "4 44 22 444444", + 'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header + 40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header + } else { + // RGBA bitmaps need a v4 header + // use BI_BITFIELDS mode with 32bpp and alpha mask + // (straight BI_RGB with alpha mask doesn't work in most readers) + return stbiw__outfile(s,-1,-1,x,y,comp,1,(void *)data,1,0, + "11 4 22 4" "4 44 22 444444 4444 4 444 444 444 444", + 'B', 'M', 14+108+x*y*4, 0, 0, 14+108, // file header + 108, x,y, 1,32, 3,0,0,0,0,0, 0xff0000,0xff00,0xff,0xff000000u, 0, 0,0,0, 0,0,0, 0,0,0, 0,0,0); // bitmap V4 header + } } STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data) { - stbi__write_context s; + stbi__write_context s = { 0 }; stbi__start_write_callbacks(&s, func, context); return stbi_write_bmp_core(&s, x, y, comp, data); } @@ -374,7 +519,7 @@ STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int x, #ifndef STBI_WRITE_NO_STDIO STBIWDEF int stbi_write_bmp(char const *filename, int x, int y, int comp, const void *data) { - stbi__write_context s; + stbi__write_context s = { 0 }; if (stbi__start_write_file(&s,filename)) { int r = stbi_write_bmp_core(&s, x, y, comp, data); stbi__end_write_file(&s); @@ -398,11 +543,21 @@ static int stbi_write_tga_core(stbi__write_context *s, int x, int y, int comp, v "111 221 2222 11", 0, 0, format, 0, 0, 0, 0, 0, x, y, (colorbytes + has_alpha) * 8, has_alpha * 8); } else { int i,j,k; + int jend, jdir; stbiw__writef(s, "111 221 2222 11", 0,0,format+8, 0,0,0, 0,0,x,y, (colorbytes + has_alpha) * 8, has_alpha * 8); - for (j = y - 1; j >= 0; --j) { - unsigned char *row = (unsigned char *) data + j * x * comp; + if (stbi__flip_vertically_on_write) { + j = 0; + jend = y; + jdir = 1; + } else { + j = y-1; + jend = -1; + jdir = -1; + } + for (; j != jend; j += jdir) { + unsigned char *row = (unsigned char *) data + j * x * comp; int len; for (i = 0; i < x; i += len) { @@ -437,32 +592,33 @@ static int stbi_write_tga_core(stbi__write_context *s, int x, int y, int comp, v if (diff) { unsigned char header = STBIW_UCHAR(len - 1); - s->func(s->context, &header, 1); + stbiw__write1(s, header); for (k = 0; k < len; ++k) { stbiw__write_pixel(s, -1, comp, has_alpha, 0, begin + k * comp); } } else { unsigned char header = STBIW_UCHAR(len - 129); - s->func(s->context, &header, 1); + stbiw__write1(s, header); stbiw__write_pixel(s, -1, comp, has_alpha, 0, begin); } } } + stbiw__write_flush(s); } return 1; } -int stbi_write_tga_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data) +STBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data) { - stbi__write_context s; + stbi__write_context s = { 0 }; stbi__start_write_callbacks(&s, func, context); return stbi_write_tga_core(&s, x, y, comp, (void *) data); } #ifndef STBI_WRITE_NO_STDIO -int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data) +STBIWDEF int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data) { - stbi__write_context s; + stbi__write_context s = { 0 }; if (stbi__start_write_file(&s,filename)) { int r = stbi_write_tga_core(&s, x, y, comp, (void *) data); stbi__end_write_file(&s); @@ -475,11 +631,12 @@ int stbi_write_tga(char const *filename, int x, int y, int comp, const void *dat // ************************************************************************************************* // Radiance RGBE HDR writer // by Baldur Karlsson -#ifndef STBI_WRITE_NO_STDIO #define stbiw__max(a, b) ((a) > (b) ? (a) : (b)) -void stbiw__linear_to_rgbe(unsigned char *rgbe, float *linear) +#ifndef STBI_WRITE_NO_STDIO + +static void stbiw__linear_to_rgbe(unsigned char *rgbe, float *linear) { int exponent; float maxcomp = stbiw__max(linear[0], stbiw__max(linear[1], linear[2])); @@ -496,7 +653,7 @@ void stbiw__linear_to_rgbe(unsigned char *rgbe, float *linear) } } -void stbiw__write_run_data(stbi__write_context *s, int length, unsigned char databyte) +static void stbiw__write_run_data(stbi__write_context *s, int length, unsigned char databyte) { unsigned char lengthbyte = STBIW_UCHAR(length+128); STBIW_ASSERT(length+128 <= 255); @@ -504,7 +661,7 @@ void stbiw__write_run_data(stbi__write_context *s, int length, unsigned char dat s->func(s->context, &databyte, 1); } -void stbiw__write_dump_data(stbi__write_context *s, int length, unsigned char *data) +static void stbiw__write_dump_data(stbi__write_context *s, int length, unsigned char *data) { unsigned char lengthbyte = STBIW_UCHAR(length); STBIW_ASSERT(length <= 128); // inconsistent with spec but consistent with official code @@ -512,7 +669,7 @@ void stbiw__write_dump_data(stbi__write_context *s, int length, unsigned char *d s->func(s->context, data, length); } -void stbiw__write_hdr_scanline(stbi__write_context *s, int width, int ncomp, unsigned char *scratch, float *scanline) +static void stbiw__write_hdr_scanline(stbi__write_context *s, int width, int ncomp, unsigned char *scratch, float *scanline) { unsigned char scanlineheader[4] = { 2, 2, 0, 0 }; unsigned char rgbe[4]; @@ -613,26 +770,30 @@ static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, f char header[] = "#?RADIANCE\n# Written by stb_image_write.h\nFORMAT=32-bit_rle_rgbe\n"; s->func(s->context, header, sizeof(header)-1); +#ifdef __STDC_LIB_EXT1__ + len = sprintf_s(buffer, sizeof(buffer), "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x); +#else len = sprintf(buffer, "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x); +#endif s->func(s->context, buffer, len); for(i=0; i < y; i++) - stbiw__write_hdr_scanline(s, x, comp, scratch, data + comp*i*x); + stbiw__write_hdr_scanline(s, x, comp, scratch, data + comp*x*(stbi__flip_vertically_on_write ? y-1-i : i)); STBIW_FREE(scratch); return 1; } } -int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const float *data) +STBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const float *data) { - stbi__write_context s; + stbi__write_context s = { 0 }; stbi__start_write_callbacks(&s, func, context); return stbi_write_hdr_core(&s, x, y, comp, (float *) data); } -int stbi_write_hdr(char const *filename, int x, int y, int comp, const float *data) +STBIWDEF int stbi_write_hdr(char const *filename, int x, int y, int comp, const float *data) { - stbi__write_context s; + stbi__write_context s = { 0 }; if (stbi__start_write_file(&s,filename)) { int r = stbi_write_hdr_core(&s, x, y, comp, (float *) data); stbi__end_write_file(&s); @@ -648,8 +809,9 @@ int stbi_write_hdr(char const *filename, int x, int y, int comp, const float *da // PNG writer // +#ifndef STBIW_ZLIB_COMPRESS // stretchy buffer; stbiw__sbpush() == vector<>::push_back() -- stbiw__sbcount() == vector<>::size() -#define stbiw__sbraw(a) ((int *) (a) - 2) +#define stbiw__sbraw(a) ((int *) (void *) (a) - 2) #define stbiw__sbm(a) stbiw__sbraw(a)[0] #define stbiw__sbn(a) stbiw__sbraw(a)[1] @@ -728,8 +890,14 @@ static unsigned int stbiw__zhash(unsigned char *data) #define stbiw__ZHASH 16384 -unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_len, int quality) +#endif // STBIW_ZLIB_COMPRESS + +STBIWDEF unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_len, int quality) { +#ifdef STBIW_ZLIB_COMPRESS + // user provided a zlib compress implementation, use that + return STBIW_ZLIB_COMPRESS(data, data_len, out_len, quality); +#else // use builtin static unsigned short lengthc[] = { 3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258, 259 }; static unsigned char lengtheb[]= { 0,0,0,0,0,0,0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0 }; static unsigned short distc[] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577, 32768 }; @@ -737,7 +905,9 @@ unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_l unsigned int bitbuf=0; int i,j, bitcount=0; unsigned char *out = NULL; - unsigned char ***hash_table = (unsigned char***) STBIW_MALLOC(stbiw__ZHASH * sizeof(char**)); + unsigned char ***hash_table = (unsigned char***) STBIW_MALLOC(stbiw__ZHASH * sizeof(unsigned char**)); + if (hash_table == NULL) + return NULL; if (quality < 5) quality = 5; stbiw__sbpush(out, 0x78); // DEFLATE 32K window @@ -758,7 +928,7 @@ unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_l for (j=0; j < n; ++j) { if (hlist[j]-data > i-32768) { // if entry lies within window int d = stbiw__zlib_countm(hlist[j], data+i, data_len-i); - if (d >= best) best=d,bestloc=hlist[j]; + if (d >= best) { best=d; bestloc=hlist[j]; } } } // when hash table entry is too long, delete half the entries @@ -811,14 +981,31 @@ unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_l (void) stbiw__sbfree(hash_table[i]); STBIW_FREE(hash_table); + // store uncompressed instead if compression was worse + if (stbiw__sbn(out) > data_len + 2 + ((data_len+32766)/32767)*5) { + stbiw__sbn(out) = 2; // truncate to DEFLATE 32K window and FLEVEL = 1 + for (j = 0; j < data_len;) { + int blocklen = data_len - j; + if (blocklen > 32767) blocklen = 32767; + stbiw__sbpush(out, data_len - j == blocklen); // BFINAL = ?, BTYPE = 0 -- no compression + stbiw__sbpush(out, STBIW_UCHAR(blocklen)); // LEN + stbiw__sbpush(out, STBIW_UCHAR(blocklen >> 8)); + stbiw__sbpush(out, STBIW_UCHAR(~blocklen)); // NLEN + stbiw__sbpush(out, STBIW_UCHAR(~blocklen >> 8)); + memcpy(out+stbiw__sbn(out), data+j, blocklen); + stbiw__sbn(out) += blocklen; + j += blocklen; + } + } + { // compute adler32 on input unsigned int s1=1, s2=0; int blocklen = (int) (data_len % 5552); j=0; while (j < data_len) { - for (i=0; i < blocklen; ++i) s1 += data[j+i], s2 += s1; - s1 %= 65521, s2 %= 65521; + for (i=0; i < blocklen; ++i) { s1 += data[j+i]; s2 += s1; } + s1 %= 65521; s2 %= 65521; j += blocklen; blocklen = 5552; } @@ -831,10 +1018,14 @@ unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_l // make returned pointer freeable STBIW_MEMMOVE(stbiw__sbraw(out), out, *out_len); return (unsigned char *) stbiw__sbraw(out); +#endif // STBIW_ZLIB_COMPRESS } static unsigned int stbiw__crc32(unsigned char *buffer, int len) { +#ifdef STBIW_CRC32 + return STBIW_CRC32(buffer, len); +#else static unsigned int crc_table[256] = { 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, @@ -876,6 +1067,7 @@ static unsigned int stbiw__crc32(unsigned char *buffer, int len) for (i=0; i < len; ++i) crc = (crc >> 8) ^ crc_table[buffer[i] ^ (crc & 0xff)]; return ~crc; +#endif } #define stbiw__wpng4(o,a,b,c,d) ((o)[0]=STBIW_UCHAR(a),(o)[1]=STBIW_UCHAR(b),(o)[2]=STBIW_UCHAR(c),(o)[3]=STBIW_UCHAR(d),(o)+=4) @@ -896,61 +1088,92 @@ static unsigned char stbiw__paeth(int a, int b, int c) return STBIW_UCHAR(c); } -unsigned char *stbi_write_png_to_mem(unsigned char *pixels, int stride_bytes, int x, int y, int n, int *out_len) +// @OPTIMIZE: provide an option that always forces left-predict or paeth predict +static void stbiw__encode_png_line(unsigned char *pixels, int stride_bytes, int width, int height, int y, int n, int filter_type, signed char *line_buffer) +{ + static int mapping[] = { 0,1,2,3,4 }; + static int firstmap[] = { 0,1,0,5,6 }; + int *mymap = (y != 0) ? mapping : firstmap; + int i; + int type = mymap[filter_type]; + unsigned char *z = pixels + stride_bytes * (stbi__flip_vertically_on_write ? height-1-y : y); + int signed_stride = stbi__flip_vertically_on_write ? -stride_bytes : stride_bytes; + + if (type==0) { + memcpy(line_buffer, z, width*n); + return; + } + + // first loop isn't optimized since it's just one pixel + for (i = 0; i < n; ++i) { + switch (type) { + case 1: line_buffer[i] = z[i]; break; + case 2: line_buffer[i] = z[i] - z[i-signed_stride]; break; + case 3: line_buffer[i] = z[i] - (z[i-signed_stride]>>1); break; + case 4: line_buffer[i] = (signed char) (z[i] - stbiw__paeth(0,z[i-signed_stride],0)); break; + case 5: line_buffer[i] = z[i]; break; + case 6: line_buffer[i] = z[i]; break; + } + } + switch (type) { + case 1: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - z[i-n]; break; + case 2: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - z[i-signed_stride]; break; + case 3: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - ((z[i-n] + z[i-signed_stride])>>1); break; + case 4: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - stbiw__paeth(z[i-n], z[i-signed_stride], z[i-signed_stride-n]); break; + case 5: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - (z[i-n]>>1); break; + case 6: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - stbiw__paeth(z[i-n], 0,0); break; + } +} + +STBIWDEF unsigned char *stbi_write_png_to_mem(const unsigned char *pixels, int stride_bytes, int x, int y, int n, int *out_len) { + int force_filter = stbi_write_force_png_filter; int ctype[5] = { -1, 0, 4, 2, 6 }; unsigned char sig[8] = { 137,80,78,71,13,10,26,10 }; unsigned char *out,*o, *filt, *zlib; signed char *line_buffer; - int i,j,k,p,zlen; + int j,zlen; if (stride_bytes == 0) stride_bytes = x * n; + if (force_filter >= 5) { + force_filter = -1; + } + filt = (unsigned char *) STBIW_MALLOC((x*n+1) * y); if (!filt) return 0; line_buffer = (signed char *) STBIW_MALLOC(x * n); if (!line_buffer) { STBIW_FREE(filt); return 0; } for (j=0; j < y; ++j) { - static int mapping[] = { 0,1,2,3,4 }; - static int firstmap[] = { 0,1,0,5,6 }; - int *mymap = j ? mapping : firstmap; - int best = 0, bestval = 0x7fffffff; - for (p=0; p < 2; ++p) { - for (k= p?best:0; k < 5; ++k) { - int type = mymap[k],est=0; - unsigned char *z = pixels + stride_bytes*j; - for (i=0; i < n; ++i) - switch (type) { - case 0: line_buffer[i] = z[i]; break; - case 1: line_buffer[i] = z[i]; break; - case 2: line_buffer[i] = z[i] - z[i-stride_bytes]; break; - case 3: line_buffer[i] = z[i] - (z[i-stride_bytes]>>1); break; - case 4: line_buffer[i] = (signed char) (z[i] - stbiw__paeth(0,z[i-stride_bytes],0)); break; - case 5: line_buffer[i] = z[i]; break; - case 6: line_buffer[i] = z[i]; break; - } - for (i=n; i < x*n; ++i) { - switch (type) { - case 0: line_buffer[i] = z[i]; break; - case 1: line_buffer[i] = z[i] - z[i-n]; break; - case 2: line_buffer[i] = z[i] - z[i-stride_bytes]; break; - case 3: line_buffer[i] = z[i] - ((z[i-n] + z[i-stride_bytes])>>1); break; - case 4: line_buffer[i] = z[i] - stbiw__paeth(z[i-n], z[i-stride_bytes], z[i-stride_bytes-n]); break; - case 5: line_buffer[i] = z[i] - (z[i-n]>>1); break; - case 6: line_buffer[i] = z[i] - stbiw__paeth(z[i-n], 0,0); break; - } - } - if (p) break; - for (i=0; i < x*n; ++i) + int filter_type; + if (force_filter > -1) { + filter_type = force_filter; + stbiw__encode_png_line((unsigned char*)(pixels), stride_bytes, x, y, j, n, force_filter, line_buffer); + } else { // Estimate the best filter by running through all of them: + int best_filter = 0, best_filter_val = 0x7fffffff, est, i; + for (filter_type = 0; filter_type < 5; filter_type++) { + stbiw__encode_png_line((unsigned char*)(pixels), stride_bytes, x, y, j, n, filter_type, line_buffer); + + // Estimate the entropy of the line using this filter; the less, the better. + est = 0; + for (i = 0; i < x*n; ++i) { est += abs((signed char) line_buffer[i]); - if (est < bestval) { bestval = est; best = k; } + } + if (est < best_filter_val) { + best_filter_val = est; + best_filter = filter_type; + } + } + if (filter_type != best_filter) { // If the last iteration already got us the best filter, don't redo it + stbiw__encode_png_line((unsigned char*)(pixels), stride_bytes, x, y, j, n, best_filter, line_buffer); + filter_type = best_filter; } } - // when we get here, best contains the filter type, and line_buffer contains the data - filt[j*(x*n+1)] = (unsigned char) best; + // when we get here, filter_type contains the filter type, and line_buffer contains the data + filt[j*(x*n+1)] = (unsigned char) filter_type; STBIW_MEMMOVE(filt+j*(x*n+1)+1, line_buffer, x*n); } STBIW_FREE(line_buffer); - zlib = stbi_zlib_compress(filt, y*( x*n+1), &zlen, 8); // increase 8 to get smaller but use more memory + zlib = stbi_zlib_compress(filt, y*( x*n+1), &zlen, stbi_write_png_compression_level); STBIW_FREE(filt); if (!zlib) return 0; @@ -993,9 +1216,10 @@ STBIWDEF int stbi_write_png(char const *filename, int x, int y, int comp, const { FILE *f; int len; - unsigned char *png = stbi_write_png_to_mem((unsigned char *) data, stride_bytes, x, y, comp, &len); + unsigned char *png = stbi_write_png_to_mem((const unsigned char *) data, stride_bytes, x, y, comp, &len); if (png == NULL) return 0; - f = fopen(filename, "wb"); + + f = stbiw__fopen(filename, "wb"); if (!f) { STBIW_FREE(png); return 0; } fwrite(png, 1, len, f); fclose(f); @@ -1007,16 +1231,426 @@ STBIWDEF int stbi_write_png(char const *filename, int x, int y, int comp, const STBIWDEF int stbi_write_png_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int stride_bytes) { int len; - unsigned char *png = stbi_write_png_to_mem((unsigned char *) data, stride_bytes, x, y, comp, &len); + unsigned char *png = stbi_write_png_to_mem((const unsigned char *) data, stride_bytes, x, y, comp, &len); if (png == NULL) return 0; func(context, png, len); STBIW_FREE(png); return 1; } + +/* *************************************************************************** + * + * JPEG writer + * + * This is based on Jon Olick's jo_jpeg.cpp: + * public domain Simple, Minimalistic JPEG writer - http://www.jonolick.com/code.html + */ + +static const unsigned char stbiw__jpg_ZigZag[] = { 0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18, + 24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63 }; + +static void stbiw__jpg_writeBits(stbi__write_context *s, int *bitBufP, int *bitCntP, const unsigned short *bs) { + int bitBuf = *bitBufP, bitCnt = *bitCntP; + bitCnt += bs[1]; + bitBuf |= bs[0] << (24 - bitCnt); + while(bitCnt >= 8) { + unsigned char c = (bitBuf >> 16) & 255; + stbiw__putc(s, c); + if(c == 255) { + stbiw__putc(s, 0); + } + bitBuf <<= 8; + bitCnt -= 8; + } + *bitBufP = bitBuf; + *bitCntP = bitCnt; +} + +static void stbiw__jpg_DCT(float *d0p, float *d1p, float *d2p, float *d3p, float *d4p, float *d5p, float *d6p, float *d7p) { + float d0 = *d0p, d1 = *d1p, d2 = *d2p, d3 = *d3p, d4 = *d4p, d5 = *d5p, d6 = *d6p, d7 = *d7p; + float z1, z2, z3, z4, z5, z11, z13; + + float tmp0 = d0 + d7; + float tmp7 = d0 - d7; + float tmp1 = d1 + d6; + float tmp6 = d1 - d6; + float tmp2 = d2 + d5; + float tmp5 = d2 - d5; + float tmp3 = d3 + d4; + float tmp4 = d3 - d4; + + // Even part + float tmp10 = tmp0 + tmp3; // phase 2 + float tmp13 = tmp0 - tmp3; + float tmp11 = tmp1 + tmp2; + float tmp12 = tmp1 - tmp2; + + d0 = tmp10 + tmp11; // phase 3 + d4 = tmp10 - tmp11; + + z1 = (tmp12 + tmp13) * 0.707106781f; // c4 + d2 = tmp13 + z1; // phase 5 + d6 = tmp13 - z1; + + // Odd part + tmp10 = tmp4 + tmp5; // phase 2 + tmp11 = tmp5 + tmp6; + tmp12 = tmp6 + tmp7; + + // The rotator is modified from fig 4-8 to avoid extra negations. + z5 = (tmp10 - tmp12) * 0.382683433f; // c6 + z2 = tmp10 * 0.541196100f + z5; // c2-c6 + z4 = tmp12 * 1.306562965f + z5; // c2+c6 + z3 = tmp11 * 0.707106781f; // c4 + + z11 = tmp7 + z3; // phase 5 + z13 = tmp7 - z3; + + *d5p = z13 + z2; // phase 6 + *d3p = z13 - z2; + *d1p = z11 + z4; + *d7p = z11 - z4; + + *d0p = d0; *d2p = d2; *d4p = d4; *d6p = d6; +} + +static void stbiw__jpg_calcBits(int val, unsigned short bits[2]) { + int tmp1 = val < 0 ? -val : val; + val = val < 0 ? val-1 : val; + bits[1] = 1; + while(tmp1 >>= 1) { + ++bits[1]; + } + bits[0] = val & ((1<0)&&(DU[end0pos]==0); --end0pos) { + } + // end0pos = first element in reverse order !=0 + if(end0pos == 0) { + stbiw__jpg_writeBits(s, bitBuf, bitCnt, EOB); + return DU[0]; + } + for(i = 1; i <= end0pos; ++i) { + int startpos = i; + int nrzeroes; + unsigned short bits[2]; + for (; DU[i]==0 && i<=end0pos; ++i) { + } + nrzeroes = i-startpos; + if ( nrzeroes >= 16 ) { + int lng = nrzeroes>>4; + int nrmarker; + for (nrmarker=1; nrmarker <= lng; ++nrmarker) + stbiw__jpg_writeBits(s, bitBuf, bitCnt, M16zeroes); + nrzeroes &= 15; + } + stbiw__jpg_calcBits(DU[i], bits); + stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTAC[(nrzeroes<<4)+bits[1]]); + stbiw__jpg_writeBits(s, bitBuf, bitCnt, bits); + } + if(end0pos != 63) { + stbiw__jpg_writeBits(s, bitBuf, bitCnt, EOB); + } + return DU[0]; +} + +static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, int comp, const void* data, int quality) { + // Constants that don't pollute global namespace + static const unsigned char std_dc_luminance_nrcodes[] = {0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0}; + static const unsigned char std_dc_luminance_values[] = {0,1,2,3,4,5,6,7,8,9,10,11}; + static const unsigned char std_ac_luminance_nrcodes[] = {0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d}; + static const unsigned char std_ac_luminance_values[] = { + 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12,0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07,0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08, + 0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0,0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16,0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28, + 0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59, + 0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89, + 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6, + 0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2, + 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa + }; + static const unsigned char std_dc_chrominance_nrcodes[] = {0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0}; + static const unsigned char std_dc_chrominance_values[] = {0,1,2,3,4,5,6,7,8,9,10,11}; + static const unsigned char std_ac_chrominance_nrcodes[] = {0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77}; + static const unsigned char std_ac_chrominance_values[] = { + 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21,0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71,0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91, + 0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0,0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34,0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26, + 0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38,0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58, + 0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87, + 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4, + 0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda, + 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa + }; + // Huffman tables + static const unsigned short YDC_HT[256][2] = { {0,2},{2,3},{3,3},{4,3},{5,3},{6,3},{14,4},{30,5},{62,6},{126,7},{254,8},{510,9}}; + static const unsigned short UVDC_HT[256][2] = { {0,2},{1,2},{2,2},{6,3},{14,4},{30,5},{62,6},{126,7},{254,8},{510,9},{1022,10},{2046,11}}; + static const unsigned short YAC_HT[256][2] = { + {10,4},{0,2},{1,2},{4,3},{11,4},{26,5},{120,7},{248,8},{1014,10},{65410,16},{65411,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {12,4},{27,5},{121,7},{502,9},{2038,11},{65412,16},{65413,16},{65414,16},{65415,16},{65416,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {28,5},{249,8},{1015,10},{4084,12},{65417,16},{65418,16},{65419,16},{65420,16},{65421,16},{65422,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {58,6},{503,9},{4085,12},{65423,16},{65424,16},{65425,16},{65426,16},{65427,16},{65428,16},{65429,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {59,6},{1016,10},{65430,16},{65431,16},{65432,16},{65433,16},{65434,16},{65435,16},{65436,16},{65437,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {122,7},{2039,11},{65438,16},{65439,16},{65440,16},{65441,16},{65442,16},{65443,16},{65444,16},{65445,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {123,7},{4086,12},{65446,16},{65447,16},{65448,16},{65449,16},{65450,16},{65451,16},{65452,16},{65453,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {250,8},{4087,12},{65454,16},{65455,16},{65456,16},{65457,16},{65458,16},{65459,16},{65460,16},{65461,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {504,9},{32704,15},{65462,16},{65463,16},{65464,16},{65465,16},{65466,16},{65467,16},{65468,16},{65469,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {505,9},{65470,16},{65471,16},{65472,16},{65473,16},{65474,16},{65475,16},{65476,16},{65477,16},{65478,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {506,9},{65479,16},{65480,16},{65481,16},{65482,16},{65483,16},{65484,16},{65485,16},{65486,16},{65487,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {1017,10},{65488,16},{65489,16},{65490,16},{65491,16},{65492,16},{65493,16},{65494,16},{65495,16},{65496,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {1018,10},{65497,16},{65498,16},{65499,16},{65500,16},{65501,16},{65502,16},{65503,16},{65504,16},{65505,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {2040,11},{65506,16},{65507,16},{65508,16},{65509,16},{65510,16},{65511,16},{65512,16},{65513,16},{65514,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {65515,16},{65516,16},{65517,16},{65518,16},{65519,16},{65520,16},{65521,16},{65522,16},{65523,16},{65524,16},{0,0},{0,0},{0,0},{0,0},{0,0}, + {2041,11},{65525,16},{65526,16},{65527,16},{65528,16},{65529,16},{65530,16},{65531,16},{65532,16},{65533,16},{65534,16},{0,0},{0,0},{0,0},{0,0},{0,0} + }; + static const unsigned short UVAC_HT[256][2] = { + {0,2},{1,2},{4,3},{10,4},{24,5},{25,5},{56,6},{120,7},{500,9},{1014,10},{4084,12},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {11,4},{57,6},{246,8},{501,9},{2038,11},{4085,12},{65416,16},{65417,16},{65418,16},{65419,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {26,5},{247,8},{1015,10},{4086,12},{32706,15},{65420,16},{65421,16},{65422,16},{65423,16},{65424,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {27,5},{248,8},{1016,10},{4087,12},{65425,16},{65426,16},{65427,16},{65428,16},{65429,16},{65430,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {58,6},{502,9},{65431,16},{65432,16},{65433,16},{65434,16},{65435,16},{65436,16},{65437,16},{65438,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {59,6},{1017,10},{65439,16},{65440,16},{65441,16},{65442,16},{65443,16},{65444,16},{65445,16},{65446,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {121,7},{2039,11},{65447,16},{65448,16},{65449,16},{65450,16},{65451,16},{65452,16},{65453,16},{65454,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {122,7},{2040,11},{65455,16},{65456,16},{65457,16},{65458,16},{65459,16},{65460,16},{65461,16},{65462,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {249,8},{65463,16},{65464,16},{65465,16},{65466,16},{65467,16},{65468,16},{65469,16},{65470,16},{65471,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {503,9},{65472,16},{65473,16},{65474,16},{65475,16},{65476,16},{65477,16},{65478,16},{65479,16},{65480,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {504,9},{65481,16},{65482,16},{65483,16},{65484,16},{65485,16},{65486,16},{65487,16},{65488,16},{65489,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {505,9},{65490,16},{65491,16},{65492,16},{65493,16},{65494,16},{65495,16},{65496,16},{65497,16},{65498,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {506,9},{65499,16},{65500,16},{65501,16},{65502,16},{65503,16},{65504,16},{65505,16},{65506,16},{65507,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {2041,11},{65508,16},{65509,16},{65510,16},{65511,16},{65512,16},{65513,16},{65514,16},{65515,16},{65516,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {16352,14},{65517,16},{65518,16},{65519,16},{65520,16},{65521,16},{65522,16},{65523,16},{65524,16},{65525,16},{0,0},{0,0},{0,0},{0,0},{0,0}, + {1018,10},{32707,15},{65526,16},{65527,16},{65528,16},{65529,16},{65530,16},{65531,16},{65532,16},{65533,16},{65534,16},{0,0},{0,0},{0,0},{0,0},{0,0} + }; + static const int YQT[] = {16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22, + 37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99}; + static const int UVQT[] = {17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99, + 99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99}; + static const float aasf[] = { 1.0f * 2.828427125f, 1.387039845f * 2.828427125f, 1.306562965f * 2.828427125f, 1.175875602f * 2.828427125f, + 1.0f * 2.828427125f, 0.785694958f * 2.828427125f, 0.541196100f * 2.828427125f, 0.275899379f * 2.828427125f }; + + int row, col, i, k, subsample; + float fdtbl_Y[64], fdtbl_UV[64]; + unsigned char YTable[64], UVTable[64]; + + if(!data || !width || !height || comp > 4 || comp < 1) { + return 0; + } + + quality = quality ? quality : 90; + subsample = quality <= 90 ? 1 : 0; + quality = quality < 1 ? 1 : quality > 100 ? 100 : quality; + quality = quality < 50 ? 5000 / quality : 200 - quality * 2; + + for(i = 0; i < 64; ++i) { + int uvti, yti = (YQT[i]*quality+50)/100; + YTable[stbiw__jpg_ZigZag[i]] = (unsigned char) (yti < 1 ? 1 : yti > 255 ? 255 : yti); + uvti = (UVQT[i]*quality+50)/100; + UVTable[stbiw__jpg_ZigZag[i]] = (unsigned char) (uvti < 1 ? 1 : uvti > 255 ? 255 : uvti); + } + + for(row = 0, k = 0; row < 8; ++row) { + for(col = 0; col < 8; ++col, ++k) { + fdtbl_Y[k] = 1 / (YTable [stbiw__jpg_ZigZag[k]] * aasf[row] * aasf[col]); + fdtbl_UV[k] = 1 / (UVTable[stbiw__jpg_ZigZag[k]] * aasf[row] * aasf[col]); + } + } + + // Write Headers + { + static const unsigned char head0[] = { 0xFF,0xD8,0xFF,0xE0,0,0x10,'J','F','I','F',0,1,1,0,0,1,0,1,0,0,0xFF,0xDB,0,0x84,0 }; + static const unsigned char head2[] = { 0xFF,0xDA,0,0xC,3,1,0,2,0x11,3,0x11,0,0x3F,0 }; + const unsigned char head1[] = { 0xFF,0xC0,0,0x11,8,(unsigned char)(height>>8),STBIW_UCHAR(height),(unsigned char)(width>>8),STBIW_UCHAR(width), + 3,1,(unsigned char)(subsample?0x22:0x11),0,2,0x11,1,3,0x11,1,0xFF,0xC4,0x01,0xA2,0 }; + s->func(s->context, (void*)head0, sizeof(head0)); + s->func(s->context, (void*)YTable, sizeof(YTable)); + stbiw__putc(s, 1); + s->func(s->context, UVTable, sizeof(UVTable)); + s->func(s->context, (void*)head1, sizeof(head1)); + s->func(s->context, (void*)(std_dc_luminance_nrcodes+1), sizeof(std_dc_luminance_nrcodes)-1); + s->func(s->context, (void*)std_dc_luminance_values, sizeof(std_dc_luminance_values)); + stbiw__putc(s, 0x10); // HTYACinfo + s->func(s->context, (void*)(std_ac_luminance_nrcodes+1), sizeof(std_ac_luminance_nrcodes)-1); + s->func(s->context, (void*)std_ac_luminance_values, sizeof(std_ac_luminance_values)); + stbiw__putc(s, 1); // HTUDCinfo + s->func(s->context, (void*)(std_dc_chrominance_nrcodes+1), sizeof(std_dc_chrominance_nrcodes)-1); + s->func(s->context, (void*)std_dc_chrominance_values, sizeof(std_dc_chrominance_values)); + stbiw__putc(s, 0x11); // HTUACinfo + s->func(s->context, (void*)(std_ac_chrominance_nrcodes+1), sizeof(std_ac_chrominance_nrcodes)-1); + s->func(s->context, (void*)std_ac_chrominance_values, sizeof(std_ac_chrominance_values)); + s->func(s->context, (void*)head2, sizeof(head2)); + } + + // Encode 8x8 macroblocks + { + static const unsigned short fillBits[] = {0x7F, 7}; + int DCY=0, DCU=0, DCV=0; + int bitBuf=0, bitCnt=0; + // comp == 2 is grey+alpha (alpha is ignored) + int ofsG = comp > 2 ? 1 : 0, ofsB = comp > 2 ? 2 : 0; + const unsigned char *dataR = (const unsigned char *)data; + const unsigned char *dataG = dataR + ofsG; + const unsigned char *dataB = dataR + ofsB; + int x, y, pos; + if(subsample) { + for(y = 0; y < height; y += 16) { + for(x = 0; x < width; x += 16) { + float Y[256], U[256], V[256]; + for(row = y, pos = 0; row < y+16; ++row) { + // row >= height => use last input row + int clamped_row = (row < height) ? row : height - 1; + int base_p = (stbi__flip_vertically_on_write ? (height-1-clamped_row) : clamped_row)*width*comp; + for(col = x; col < x+16; ++col, ++pos) { + // if col >= width => use pixel from last input column + int p = base_p + ((col < width) ? col : (width-1))*comp; + float r = dataR[p], g = dataG[p], b = dataB[p]; + Y[pos]= +0.29900f*r + 0.58700f*g + 0.11400f*b - 128; + U[pos]= -0.16874f*r - 0.33126f*g + 0.50000f*b; + V[pos]= +0.50000f*r - 0.41869f*g - 0.08131f*b; + } + } + DCY = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, Y+0, 16, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCY = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, Y+8, 16, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCY = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, Y+128, 16, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCY = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, Y+136, 16, fdtbl_Y, DCY, YDC_HT, YAC_HT); + + // subsample U,V + { + float subU[64], subV[64]; + int yy, xx; + for(yy = 0, pos = 0; yy < 8; ++yy) { + for(xx = 0; xx < 8; ++xx, ++pos) { + int j = yy*32+xx*2; + subU[pos] = (U[j+0] + U[j+1] + U[j+16] + U[j+17]) * 0.25f; + subV[pos] = (V[j+0] + V[j+1] + V[j+16] + V[j+17]) * 0.25f; + } + } + DCU = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, subU, 8, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); + DCV = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, subV, 8, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); + } + } + } + } else { + for(y = 0; y < height; y += 8) { + for(x = 0; x < width; x += 8) { + float Y[64], U[64], V[64]; + for(row = y, pos = 0; row < y+8; ++row) { + // row >= height => use last input row + int clamped_row = (row < height) ? row : height - 1; + int base_p = (stbi__flip_vertically_on_write ? (height-1-clamped_row) : clamped_row)*width*comp; + for(col = x; col < x+8; ++col, ++pos) { + // if col >= width => use pixel from last input column + int p = base_p + ((col < width) ? col : (width-1))*comp; + float r = dataR[p], g = dataG[p], b = dataB[p]; + Y[pos]= +0.29900f*r + 0.58700f*g + 0.11400f*b - 128; + U[pos]= -0.16874f*r - 0.33126f*g + 0.50000f*b; + V[pos]= +0.50000f*r - 0.41869f*g - 0.08131f*b; + } + } + + DCY = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, Y, 8, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCU = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, U, 8, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); + DCV = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, V, 8, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); + } + } + } + + // Do the bit alignment of the EOI marker + stbiw__jpg_writeBits(s, &bitBuf, &bitCnt, fillBits); + } + + // EOI + stbiw__putc(s, 0xFF); + stbiw__putc(s, 0xD9); + + return 1; +} + +STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality) +{ + stbi__write_context s = { 0 }; + stbi__start_write_callbacks(&s, func, context); + return stbi_write_jpg_core(&s, x, y, comp, (void *) data, quality); +} + + +#ifndef STBI_WRITE_NO_STDIO +STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const void *data, int quality) +{ + stbi__write_context s = { 0 }; + if (stbi__start_write_file(&s,filename)) { + int r = stbi_write_jpg_core(&s, x, y, comp, data, quality); + stbi__end_write_file(&s); + return r; + } else + return 0; +} +#endif + #endif // STB_IMAGE_WRITE_IMPLEMENTATION /* Revision history + 1.16 (2021-07-11) + make Deflate code emit uncompressed blocks when it would otherwise expand + support writing BMPs with alpha channel + 1.15 (2020-07-13) unknown + 1.14 (2020-02-02) updated JPEG writer to downsample chroma channels + 1.13 + 1.12 + 1.11 (2019-08-11) + + 1.10 (2019-02-07) + support utf8 filenames in Windows; fix warnings and platform ifdefs + 1.09 (2018-02-11) + fix typo in zlib quality API, improve STB_I_W_STATIC in C++ + 1.08 (2018-01-29) + add stbi__flip_vertically_on_write, external zlib, zlib quality, choose PNG filter + 1.07 (2017-07-24) + doc fix + 1.06 (2017-07-23) + writing JPEG (using Jon Olick's code) + 1.05 ??? + 1.04 (2017-03-03) + monochrome BMP expansion + 1.03 ??? 1.02 (2016-04-02) avoid allocating large structures on the stack 1.01 (2016-01-16) @@ -1035,7 +1669,7 @@ STBIWDEF int stbi_write_png_to_func(stbi_write_func *func, void *context, int x, add HDR output fix monochrome BMP 0.95 (2014-08-17) - add monochrome TGA output + add monochrome TGA output 0.94 (2014-05-31) rename private functions to avoid conflicts with stb_image.h 0.93 (2014-05-27) @@ -1046,3 +1680,45 @@ STBIWDEF int stbi_write_png_to_func(stbi_write_func *func, void *context, int x, first public release 0.90 first internal release */ + +/* +------------------------------------------------------------------------------ +This software is available under 2 licenses -- choose whichever you prefer. +------------------------------------------------------------------------------ +ALTERNATIVE A - MIT License +Copyright (c) 2017 Sean Barrett +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +------------------------------------------------------------------------------ +ALTERNATIVE B - Public Domain (www.unlicense.org) +This is free and unencumbered software released into the public domain. +Anyone is free to copy, modify, publish, use, compile, sell, or distribute this +software, either in source code form or as a compiled binary, for any purpose, +commercial or non-commercial, and by any means. +In jurisdictions that recognize copyright laws, the author or authors of this +software dedicate any and all copyright interest in the software to the public +domain. We make this dedication for the benefit of the public at large and to +the detriment of our heirs and successors. We intend this dedication to be an +overt act of relinquishment in perpetuity of all present and future rights to +this software under copyright law. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------ +*/ diff --git a/third_party/penumbra/vendor/glfw/docs/CMakeLists.txt b/third_party/penumbra/vendor/glfw/docs/CMakeLists.txt deleted file mode 100644 index df9e214720b..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ - -# NOTE: The order of this list determines the order of items in the Guides -# (i.e. Pages) list in the generated documentation -set(GLFW_DOXYGEN_SOURCES - "include/GLFW/glfw3.h" - "include/GLFW/glfw3native.h" - "docs/main.dox" - "docs/news.dox" - "docs/quick.dox" - "docs/moving.dox" - "docs/compile.dox" - "docs/build.dox" - "docs/intro.dox" - "docs/context.dox" - "docs/monitor.dox" - "docs/window.dox" - "docs/input.dox" - "docs/vulkan.dox" - "docs/compat.dox" - "docs/internal.dox") - -# Format the source list into a Doxyfile INPUT value that Doxygen can parse -foreach(path IN LISTS GLFW_DOXYGEN_SOURCES) - set(GLFW_DOXYGEN_INPUT "${GLFW_DOXYGEN_INPUT} \\\n\"${GLFW_SOURCE_DIR}/${path}\"") -endforeach() - -configure_file(Doxyfile.in Doxyfile @ONLY) - -add_custom_target(docs ALL "${DOXYGEN_EXECUTABLE}" - WORKING_DIRECTORY "${GLFW_BINARY_DIR}/docs" - COMMENT "Generating HTML documentation" VERBATIM) - diff --git a/third_party/penumbra/vendor/glfw/docs/CODEOWNERS b/third_party/penumbra/vendor/glfw/docs/CODEOWNERS deleted file mode 100644 index ec174185f1f..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/CODEOWNERS +++ /dev/null @@ -1,10 +0,0 @@ - -* @elmindreda - -src/wl_* @linkmauve - -docs/*.css @glfw/webdev -docs/*.less @glfw/webdev -docs/*.html @glfw/webdev -docs/*.xml @glfw/webdev - diff --git a/third_party/penumbra/vendor/glfw/docs/CONTRIBUTING.md b/third_party/penumbra/vendor/glfw/docs/CONTRIBUTING.md deleted file mode 100644 index 070cff958e2..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/CONTRIBUTING.md +++ /dev/null @@ -1,391 +0,0 @@ -# Contribution Guide - -## Contents - -- [Asking a question](#asking-a-question) -- [Reporting a bug](#reporting-a-bug) - - [Reporting a compile or link bug](#reporting-a-compile-or-link-bug) - - [Reporting a segfault or other crash bug](#reporting-a-segfault-or-other-crash-bug) - - [Reporting a context creation bug](#reporting-a-context-creation-bug) - - [Reporting a monitor or video mode bug](#reporting-a-monitor-or-video-mode-bug) - - [Reporting a window, input or event bug](#reporting-a-window-input-or-event-bug) - - [Reporting some other library bug](#reporting-some-other-library-bug) - - [Reporting a documentation bug](#reporting-a-documentation-bug) - - [Reporting a website bug](#reporting-a-website-bug) -- [Requesting a feature](#requesting-a-feature) -- [Contributing a bug fix](#contributing-a-bug-fix) -- [Contributing a feature](#contributing-a-feature) - - -## Asking a question - -Questions about how to use GLFW should be asked either in the [support -section](https://discourse.glfw.org/c/support) of the forum, under the [Stack -Overflow tag](https://stackoverflow.com/questions/tagged/glfw) or [Game -Development tag](https://gamedev.stackexchange.com/questions/tagged/glfw) on -Stack Exchange or in the IRC channel `#glfw` on -[Freenode](http://freenode.net/). - -Questions about the design or implementation of GLFW or about future plans -should be asked in the [dev section](https://discourse.glfw.org/c/dev) of the -forum or in the IRC channel. Please don't open a GitHub issue to discuss design -questions without first checking with a maintainer. - - -## Reporting a bug - -If GLFW is behaving unexpectedly at run-time, start by setting an [error -callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling). -GLFW will often tell you the cause of an error via this callback. If it -doesn't, that might be a separate bug. - -If GLFW is crashing or triggering asserts, make sure that all your object -handles and other pointers are valid. - -For bugs where it makes sense, a short, self contained example is absolutely -invaluable. Just put it inline in the body text. Note that if the bug is -reproducible with one of the test programs that come with GLFW, just mention -that instead. - -__Don't worry about adding too much information__. Unimportant information can -be abbreviated or removed later, but missing information can stall bug fixing, -especially when your schedule doesn't align with that of the maintainer. - -__Please provide text as text, not as images__. This includes code, error -messages and any other text. Text in images cannot be found by other users -searching for the same problem and may have to be re-typed by maintainers when -debugging. - -You don't need to manually indent your code or other text to quote it with -GitHub Markdown; just surround it with triple backticks: - - ``` - Some quoted text. - ``` - -You can also add syntax highlighting by appending the common file extension: - - ```c - int five(void) - { - return 5; - } - ``` - -There are issue labels for both platforms and GPU manufacturers, so there is no -need to mention these in the subject line. If you do, it will be removed when -the issue is labeled. - -If your bug is already reported, please add any new information you have, or if -it already has everything, give it a :+1:. - - -### Reporting a compile or link bug - -__Note:__ GLFW needs many system APIs to do its job, which on some platforms -means linking to many system libraries. If you are using GLFW as a static -library, that means your application needs to link to these in addition to GLFW. - -__Note:__ Check the [Compiling -GLFW](https://www.glfw.org/docs/latest/compile.html) guide and or [Building -applications](https://www.glfw.org/docs/latest/build.html) guide for before -opening an issue of this kind. Most issues are caused by a missing package or -linker flag. - -Always include the __operating system name and version__ (e.g. `Windows -7 64-bit` or `Ubuntu 15.10`) and the __compiler name and version__ (e.g. `Visual -C++ 2015 Update 2`). If you are using an official release of GLFW, -include the __GLFW release version__ (e.g. `3.1.2`), otherwise include the -__GLFW commit ID__ (e.g. `3795d78b14ef06008889cc422a1fb8d642597751`) from Git. - -Please also include the __complete build log__ from your compiler and linker, -even if it's long. It can always be shortened later, if necessary. - - -#### Quick template - -``` -OS and version: -Compiler version: -Release or commit: -Build log: -``` - - -### Reporting a segfault or other crash bug - -Always include the __operating system name and version__ (e.g. `Windows -7 64-bit` or `Ubuntu 15.10`). If you are using an official release of GLFW, -include the __GLFW release version__ (e.g. `3.1.2`), otherwise include the -__GLFW commit ID__ (e.g. `3795d78b14ef06008889cc422a1fb8d642597751`) from Git. - -Please also include any __error messages__ provided to your application via the -[error -callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling) and -the __full call stack__ of the crash, or if the crash does not occur in debug -mode, mention that instead. - - -#### Quick template - -``` -OS and version: -Release or commit: -Error messages: -Call stack: -``` - - -### Reporting a context creation bug - -__Note:__ Windows ships with graphics drivers that do not support OpenGL. If -GLFW says that your machine lacks support for OpenGL, it very likely does. -Install drivers from the computer manufacturer or graphics card manufacturer -([Nvidia](https://www.geforce.com/drivers), -[AMD](https://www.amd.com/en/support), -[Intel](https://www-ssl.intel.com/content/www/us/en/support/detect.html)) to -fix this. - -__Note:__ AMD only supports OpenGL ES on Windows via EGL. See the -[GLFW\_CONTEXT\_CREATION\_API](https://www.glfw.org/docs/latest/window_guide.html#window_hints_ctx) -hint for how to select EGL. - -Please verify that context creation also fails with the `glfwinfo` tool before -reporting it as a bug. This tool is included in the GLFW source tree as -`tests/glfwinfo.c` and is built along with the library. It has switches for all -GLFW context and framebuffer hints. Run `glfwinfo -h` for a complete list. - -Always include the __operating system name and version__ (e.g. `Windows -7 64-bit` or `Ubuntu 15.10`). If you are using an official release of GLFW, -include the __GLFW release version__ (e.g. `3.1.2`), otherwise include the -__GLFW commit ID__ (e.g. `3795d78b14ef06008889cc422a1fb8d642597751`) from Git. - -If you are running your program in a virtual machine, please mention this and -include the __VM name and version__ (e.g. `VirtualBox 5.1`). - -Please also include the __GLFW version string__ (`3.2.0 X11 EGL clock_gettime -/dev/js`), as described -[here](https://www.glfw.org/docs/latest/intro.html#intro_version_string), the -__GPU model and driver version__ (e.g. `GeForce GTX660 with 352.79`), and the -__output of `glfwinfo`__ (with switches matching any hints you set in your -code) when reporting this kind of bug. If this tool doesn't run on the machine, -mention that instead. - - -#### Quick template - -``` -OS and version: -GPU and driver: -Release or commit: -Version string: -glfwinfo output: -``` - - -### Reporting a monitor or video mode bug - -__Note:__ On headless systems on some platforms, no monitors are reported. This -causes glfwGetPrimaryMonitor to return `NULL`, which not all applications are -prepared for. - -__Note:__ Some third-party tools report more video modes than are approved of -by the OS. For safety and compatibility, GLFW only reports video modes the OS -wants programs to use. This is not a bug. - -The `monitors` tool is included in the GLFW source tree as `tests/monitors.c` -and is built along with the library. It lists all information GLFW provides -about monitors it detects. - -Always include the __operating system name and version__ (e.g. `Windows -7 64-bit` or `Ubuntu 15.10`). If you are using an official release of GLFW, -include the __GLFW release version__ (e.g. `3.1.2`), otherwise include the -__GLFW commit ID__ (e.g. `3795d78b14ef06008889cc422a1fb8d642597751`) from Git. - -If you are running your program in a virtual machine, please mention this and -include the __VM name and version__ (e.g. `VirtualBox 5.1`). - -Please also include any __error messages__ provided to your application via the -[error -callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling) and -the __output of `monitors`__ when reporting this kind of bug. If this tool -doesn't run on the machine, mention this instead. - - -#### Quick template - -``` -OS and version: -Release or commit: -Error messages: -monitors output: -``` - - -### Reporting a window, input or event bug - -__Note:__ The exact ordering of related window events will sometimes differ. - -__Note:__ Window moving and resizing (by the user) will block the main thread on -some platforms. This is not a bug. Set a [refresh -callback](https://www.glfw.org/docs/latest/window.html#window_refresh) if you -want to keep the window contents updated during a move or size operation. - -The `events` tool is included in the GLFW source tree as `tests/events.c` and is -built along with the library. It prints all information provided to every -callback supported by GLFW as events occur. Each event is listed with the time -and a unique number to make discussions about event logs easier. The tool has -command-line options for creating multiple windows and full screen windows. - -Always include the __operating system name and version__ (e.g. `Windows -7 64-bit` or `Ubuntu 15.10`). If you are using an official release of GLFW, -include the __GLFW release version__ (e.g. `3.1.2`), otherwise include the -__GLFW commit ID__ (e.g. `3795d78b14ef06008889cc422a1fb8d642597751`) from Git. - -If you are running your program in a virtual machine, please mention this and -include the __VM name and version__ (e.g. `VirtualBox 5.1`). - -Please also include any __error messages__ provided to your application via the -[error -callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling) and -if relevant, the __output of `events`__ when reporting this kind of bug. If -this tool doesn't run on the machine, mention this instead. - -__X11:__ If possible, please include what desktop environment (e.g. GNOME, -Unity, KDE) and/or window manager (e.g. Openbox, dwm, Window Maker) you are -running. If the bug is related to keyboard input, please include any input -method (e.g. ibus, SCIM) you are using. - - -#### Quick template - -``` -OS and version: -Release or commit: -Error messages: -events output: -``` - - -### Reporting some other library bug - -Always include the __operating system name and version__ (e.g. `Windows -7 64-bit` or `Ubuntu 15.10`). If you are using an official release of GLFW, -include the __GLFW release version__ (e.g. `3.1.2`), otherwise include the -__GLFW commit ID__ (e.g. `3795d78b14ef06008889cc422a1fb8d642597751`) from Git. - -Please also include any __error messages__ provided to your application via the -[error -callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling), if -relevant. - - -#### Quick template - -``` -OS and version: -Release or commit: -Error messages: -``` - - -### Reporting a documentation bug - -If you found a bug in the documentation, including this file, then it's fine to -just link to that web page or mention that source file. You don't need to match -the source to the output or vice versa. - - -### Reporting a website bug - -If the bug is in the documentation (anything under `/docs/`) then please see the -section above. Bugs in the rest of the site are reported to the [website -source repository](https://github.com/glfw/website/issues). - - -## Requesting a feature - -Please explain why you need the feature and how you intend to use it. If you -have a specific API design in mind, please add that as well. If you have or are -planning to write code for the feature, see the section below. - -If there already is a request for the feature you need, add your specific use -case unless it is already mentioned. If it is, give it a :+1:. - - -## Contributing a bug fix - -__Note:__ You must have all necessary [intellectual -property rights](https://en.wikipedia.org/wiki/Intellectual_property) to any -code you contribute. If you did not write the code yourself, you must explain -where it came from and under what license you received it. Even code using the -same license as GLFW may not be copied without attribution. - -__There is no preferred patch size__. A one character fix is just as welcome as -a thousand line one, if that is the appropriate size for the fix. - -In addition to the code, a complete bug fix includes: - -- Change log entry in `README.md`, describing the incorrect behavior -- Credits entries for all authors of the bug fix - -Bug fixes will not be rejected because they don't include all the above parts, -but please keep in mind that maintainer time is finite and that there are many -other bugs and features to work on. - -If the patch fixes a bug introduced after the last release, it should not get -a change log entry. - -If you haven't already, read the excellent article [How to Write a Git Commit -Message](https://chris.beams.io/posts/git-commit/). - - -## Contributing a feature - -__Note:__ You must have all necessary rights to any code you contribute. If you -did not write the code yourself, you must explain where it came from and under -what license. Even code using the same license as GLFW may not be copied -without attribution. - -__Note:__ If you haven't already implemented the feature, check first if there -already is an open issue for it and if it's already being developed in an -[experimental branch](https://github.com/glfw/glfw/branches/all). - -__There is no preferred patch size__. A one character change is just as welcome -as one adding a thousand line one, if that is the appropriate size for the -feature. - -In addition to the code, a complete feature includes: - -- Change log entry in `README.md`, listing all new symbols -- News page entry, briefly describing the feature -- Guide documentation, with minimal examples, in the relevant guide -- Reference documentation, with all applicable tags -- Cross-references and mentions in appropriate places -- Credits entries for all authors of the feature - -If the feature requires platform-specific code, at minimum stubs must be added -for the new platform function to all supported and experimental platforms. - -If it adds a new callback, support for it must be added to `tests/event.c`. - -If it adds a new monitor property, support for it must be added to -`tests/monitor.c`. - -If it adds a new OpenGL, OpenGL ES or Vulkan option or extension, support -for it must be added to `tests/glfwinfo.c` and the behavior of the library when -the extension is missing documented in `docs/compat.dox`. - -If you haven't already, read the excellent article [How to Write a Git Commit -Message](https://chris.beams.io/posts/git-commit/). - -Features will not be rejected because they don't include all the above parts, -but please keep in mind that maintainer time is finite and that there are many -other features and bugs to work on. - -Please also keep in mind that any part of the public API that has been included -in a release cannot be changed until the next _major_ version. Features can be -added and existing parts can sometimes be overloaded (in the general sense of -doing more things, not in the C++ sense), but code written to the API of one -minor release should both compile and run on subsequent minor releases. - diff --git a/third_party/penumbra/vendor/glfw/docs/Doxyfile.in b/third_party/penumbra/vendor/glfw/docs/Doxyfile.in deleted file mode 100644 index 825356d92fb..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/Doxyfile.in +++ /dev/null @@ -1,1848 +0,0 @@ -# Doxyfile 1.8.3.1 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" "). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or sequence of words) that should -# identify the project. Note that if you do not use Doxywizard you need -# to put quotes around the project name if it contains spaces. - -PROJECT_NAME = "GLFW" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = @GLFW_VERSION@ - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer -# a quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = "A multi-platform library for OpenGL, window and input" - -# With the PROJECT_LOGO tag one can specify an logo or icon that is -# included in the documentation. The maximum height of the logo should not -# exceed 55 pixels and the maximum width should not exceed 200 pixels. -# Doxygen will copy the logo to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = "@GLFW_BINARY_DIR@/docs" - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = NO - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = YES - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = NO - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. Note that you specify absolute paths here, but also -# relative paths, which will be relative from the directory where doxygen is -# started. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful if your file system -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = "thread_safety=@par Thread safety^^" \ - "pointer_lifetime=@par Pointer lifetime^^" \ - "analysis=@par Analysis^^" \ - "reentrancy=@par Reentrancy^^" \ - "errors=@par Errors^^" \ - "callback_signature=@par Callback signature^^" \ - "glfw3=__GLFW 3:__" \ - "x11=__X11:__" \ - "wayland=__Wayland:__" \ - "win32=__Windows:__" \ - "macos=__macOS:__" \ - "linux=__Linux:__" - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding -# "class=itcl::class" will allow you to use the command class in the -# itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, -# and language is one of the parsers supported by doxygen: IDL, Java, -# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, -# C++. For instance to make doxygen treat .inc files as Fortran files (default -# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note -# that for custom extensions you also need to set FILE_PATTERNS otherwise the -# files are not read by doxygen. - -EXTENSION_MAPPING = - -# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all -# comments according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you -# can mix doxygen, HTML, and XML commands with Markdown formatting. -# Disable only in case of backward compatibilities issues. - -MARKDOWN_SUPPORT = YES - -# When enabled doxygen tries to link words that correspond to documented classes, -# or namespaces to their corresponding documentation. Such a link can be -# prevented in individual cases by putting a % sign in front of the word or -# globally by setting AUTOLINK_SUPPORT to NO. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also makes the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES (the -# default) will make doxygen replace the get and set methods by a property in -# the documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = NO - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and -# unions are shown inside the group in which they are included (e.g. using -# @ingroup) instead of on a separate page (for HTML and Man pages) or -# section (for LaTeX and RTF). - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and -# unions with only public data fields will be shown inline in the documentation -# of the scope in which they are defined (i.e. file, namespace, or group -# documentation), provided this scope is documented. If set to NO (the default), -# structs, classes, and unions are shown on a separate page (for HTML and Man -# pages) or section (for LaTeX and RTF). - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = NO - -# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be -# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given -# their name and scope. Since this can be an expensive process and often the -# same symbol appear multiple times in the code, doxygen keeps a cache of -# pre-resolved symbols. If the cache is too small doxygen will become slower. -# If the cache is too large, memory is wasted. The cache size is given by this -# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal -# scope will be included in the documentation. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespaces are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen -# will list include files with double quotes in the documentation -# rather than with sharp brackets. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = NO - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = YES - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to -# do proper type resolution of all parameters of a function it will reject a -# match between the prototype and the implementation of a member function even -# if there is only one candidate or it is obvious which candidate to choose -# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen -# will still accept a match between prototype and implementation in such cases. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if section-label ... \endif -# and \cond section-label ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or macro consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and macros in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. -# This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = NO - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. -# You can optionally specify a file name after the option, if omitted -# DoxygenLayout.xml will be used as the name of the layout file. - -LAYOUT_FILE = "@GLFW_SOURCE_DIR@/docs/DoxygenLayout.xml" - -# The CITE_BIB_FILES tag can be used to specify one or more bib files -# containing the references data. This must be a list of .bib files. The -# .bib extension is automatically appended if omitted. Using this command -# requires the bibtex tool to be installed. See also -# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style -# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this -# feature you need bibtex and perl available in the search path. Do not use -# file names with spaces, bibtex cannot handle them. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = YES - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# The WARN_NO_PARAMDOC option can be enabled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = "@GLFW_BINARY_DIR@/docs/warnings.txt" - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = @GLFW_DOXYGEN_INPUT@ - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh -# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py -# *.f90 *.f *.for *.vhd *.vhdl - -FILE_PATTERNS = *.h *.dox - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = APIENTRY GLFWAPI - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = "@GLFW_SOURCE_DIR@/examples" - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. -# If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. -# Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. -# The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty or if -# non of the patterns match the file name, INPUT_FILTER is applied. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) -# and it is also possible to disable source filtering for a specific pattern -# using *.ext= (so without naming a filter). This option only has effect when -# FILTER_SOURCE_FILES is enabled. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page (index.html). -# This can be useful if you have a project on for instance GitHub and want reuse -# the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C, C++ and Fortran comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. -# Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = glfw GLFW_ - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. Note that when using a custom header you are responsible -# for the proper inclusion of any scripts and style sheets that doxygen -# needs, which is dependent on the configuration options used. -# It is advised to generate a default header using "doxygen -w html -# header.html footer.html stylesheet.css YourConfigFile" and then modify -# that header. Note that the header is subject to change so you typically -# have to redo this when upgrading to a newer version of doxygen or when -# changing the value of configuration settings such as GENERATE_TREEVIEW! - -HTML_HEADER = "@GLFW_SOURCE_DIR@/docs/header.html" - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = "@GLFW_SOURCE_DIR@/docs/footer.html" - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If left blank doxygen will -# generate a default style sheet. Note that it is recommended to use -# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this -# tag will in the future become obsolete. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional -# user-defined cascading style sheet that is included after the standard -# style sheets created by doxygen. Using this option one can overrule -# certain style aspects. This is preferred over using HTML_STYLESHEET -# since it does not replace the standard style sheet and is therefor more -# robust against future updates. Doxygen will copy the style sheet file to -# the output directory. - -HTML_EXTRA_STYLESHEET = "@GLFW_SOURCE_DIR@/docs/extra.css" - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that -# the files will be copied as-is; there are no commands or markers available. - -HTML_EXTRA_FILES = "@GLFW_SOURCE_DIR@/docs/spaces.svg" - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. -# Doxygen will adjust the colors in the style sheet and background images -# according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. -# For instance the value 0 represents red, 60 is yellow, 120 is green, -# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. -# The allowed range is 0 to 359. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of -# the colors in the HTML output. For a value of 0 the output will use -# grayscales only. A value of 255 will produce the most vivid colors. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to -# the luminance component of the colors in the HTML output. Values below -# 100 gradually make the output lighter, whereas values above 100 make -# the output darker. The value divided by 100 is the actual gamma applied, -# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, -# and 100 does not change the gamma. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting -# this to NO can help when comparing the output of multiple runs. - -HTML_TIMESTAMP = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of -# entries shown in the various tree structured indices initially; the user -# can expand and collapse entries dynamically later on. Doxygen will expand -# the tree to such a level that at most the specified number of entries are -# visible (unless a fully collapsed tree already exceeds this amount). -# So setting the number of entries 1 will produce a full collapsed tree by -# default. 0 is a special value representing an infinite number of entries -# and will result in a full expanded tree by default. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely -# identify the documentation publisher. This should be a reverse domain-name -# style string, e.g. com.mycompany.MyDocSet.documentation. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated -# that can be used as input for Qt's qhelpgenerator to generate a -# Qt Compressed Help (.qch) of the generated HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to -# add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see -# -# Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's -# filter section matches. -# -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files -# will be generated, which together with the HTML files, form an Eclipse help -# plugin. To install this plugin and make it available under the help contents -# menu in Eclipse, the contents of the directory containing the HTML and XML -# files needs to be copied into the plugins directory of eclipse. The name of -# the directory within the plugins directory should be the same as -# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before -# the help appears. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have -# this name. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) -# at top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. Since the tabs have the same information as the -# navigation tree you can set this option to NO if you already set -# GENERATE_TREEVIEW to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. -# Since the tree basically has the same information as the tab index you -# could consider to set DISABLE_INDEX to NO when enabling this option. - -GENERATE_TREEVIEW = NO - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values -# (range [0,1..20]) that doxygen will group on one line in the generated HTML -# documentation. Note that a value of 0 will completely suppress the enum -# values from appearing in the overview section. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 300 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open -# links to external symbols imported via tag files in a separate window. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are -# not supported properly for IE 6.0, but are supported on all modern browsers. -# Note that when changing this option you need to delete any form_*.png files -# in the HTML output before the changes have effect. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax -# (see http://www.mathjax.org) which uses client side Javascript for the -# rendering instead of using prerendered bitmaps. Use this if you do not -# have LaTeX installed or if you want to formulas look prettier in the HTML -# output. When enabled you may also need to install MathJax separately and -# configure the path to it using the MATHJAX_RELPATH option. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and -# SVG. The default value is HTML-CSS, which is slower, but has the best -# compatibility. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the -# HTML output directory using the MATHJAX_RELPATH option. The destination -# directory should contain the MathJax.js script. For instance, if the mathjax -# directory is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to -# the MathJax Content Delivery Network so you can quickly see the result without -# installing MathJax. -# However, it is strongly recommended to install a local -# copy of MathJax from http://www.mathjax.org before deployment. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension -# names that should be enabled during MathJax rendering. - -MATHJAX_EXTENSIONS = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets -# (GENERATE_DOCSET) there is already a search function so this one should -# typically be disabled. For large projects the javascript based search engine -# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. - -SEARCHENGINE = YES - -# When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a web server instead of a web client using Javascript. -# There are two flavours of web server based search depending on the -# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for -# searching and an index file used by the script. When EXTERNAL_SEARCH is -# enabled the indexing and searching needs to be provided by external tools. -# See the manual for details. - -SERVER_BASED_SEARCH = NO - -# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP -# script for searching. Instead the search results are written to an XML file -# which needs to be processed by an external indexer. Doxygen will invoke an -# external search engine pointed to by the SEARCHENGINE_URL option to obtain -# the search results. Doxygen ships with an example indexer (doxyindexer) and -# search engine (doxysearch.cgi) which are based on the open source search engine -# library Xapian. See the manual for configuration details. - -EXTERNAL_SEARCH = NO - -# The SEARCHENGINE_URL should point to a search engine hosted by a web server -# which will returned the search results when EXTERNAL_SEARCH is enabled. -# Doxygen ships with an example search engine (doxysearch) which is based on -# the open source search engine library Xapian. See the manual for configuration -# details. - -SEARCHENGINE_URL = - -# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed -# search data is written to a file for indexing by an external tool. With the -# SEARCHDATA_FILE tag the name of this file can be specified. - -SEARCHDATA_FILE = searchdata.xml - -# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the -# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is -# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple -# projects and redirect the results back to the right project. - -EXTERNAL_SEARCH_ID = - -# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen -# projects other than the one defined by this configuration file, but that are -# all added to the same external search index. Each project needs to have a -# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id -# of to a relative location where the documentation can be found. -# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... - -EXTRA_SEARCH_MAPPINGS = - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. -# Note that when enabling USE_PDFLATEX this option is only used for -# generating bitmaps for formulas in the HTML output, but not in the -# Makefile that is written to the output directory. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4 - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for -# the generated latex document. The footer should contain everything after -# the last chapter. If it is left blank doxygen will generate a -# standard footer. Notice: only use this tag if you know what you are doing! - -LATEX_FOOTER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -# The LATEX_BIB_STYLE tag can be used to specify the style to use for the -# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See -# http://en.wikipedia.org/wiki/BibTeX for more info. - -LATEX_BIB_STYLE = plain - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load style sheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. -# This is useful -# if you want to understand what is going on. -# On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = YES - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# pointed to by INCLUDE_PATH will be searched when a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = GLFWAPI= \ - GLFW_EXPOSE_NATIVE_WIN32 \ - GLFW_EXPOSE_NATIVE_WGL \ - GLFW_EXPOSE_NATIVE_X11 \ - GLFW_EXPOSE_NATIVE_WAYLAND \ - GLFW_EXPOSE_NATIVE_GLX \ - GLFW_EXPOSE_NATIVE_COCOA \ - GLFW_EXPOSE_NATIVE_NSGL \ - GLFW_EXPOSE_NATIVE_EGL \ - GLFW_EXPOSE_NATIVE_OSMESA \ - VK_VERSION_1_0 - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition that -# overrules the definition found in the source code. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all references to function-like macros -# that are alone on a line, have an all uppercase name, and do not end with a -# semicolon, because these will confuse the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. For each -# tag file the location of the external documentation should be added. The -# format of a tag file without this location is as follows: -# -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths -# or URLs. Note that each tag file must have a unique name (where the name does -# NOT include the path). If a tag file is not located in the directory in which -# doxygen is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option also works with HAVE_DOT disabled, but it is recommended to -# install and use dot, since it yields more powerful graphs. - -CLASS_DIAGRAMS = YES - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is -# allowed to run in parallel. When set to 0 (the default) doxygen will -# base this on the number of processors available in the system. You can set it -# explicitly to a value larger than 0 to get control over the balance -# between CPU load and processing speed. - -DOT_NUM_THREADS = 0 - -# By default doxygen will use the Helvetica font for all dot files that -# doxygen generates. When you want a differently looking font you can specify -# the font name using DOT_FONTNAME. You need to make sure dot is able to find -# the font, which can be done by putting it in a standard location or by setting -# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the -# directory containing the font. - -DOT_FONTNAME = Helvetica - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the Helvetica font. -# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to -# set the path where dot can find it. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If the UML_LOOK tag is enabled, the fields and methods are shown inside -# the class node. If there are many fields or methods and many nodes the -# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS -# threshold limits the number of items for each type to make the size more -# manageable. Set this to 0 for no limit. Note that the threshold may be -# exceeded by 50% before the limit is enforced. - -UML_LIMIT_NUM_FIELDS = 10 - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will generate a graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are svg, png, jpg, or gif. -# If left blank png will be used. If you choose svg you need to set -# HTML_FILE_EXTENSION to xhtml in order to make the SVG files -# visible in IE 9+ (other browsers do not have this requirement). - -DOT_IMAGE_FORMAT = png - -# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to -# enable generation of interactive SVG images that allow zooming and panning. -# Note that this requires a modern browser other than Internet Explorer. -# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you -# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files -# visible. Older versions of IE do not have SVG support. - -INTERACTIVE_SVG = NO - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MSCFILE_DIRS tag can be used to specify one or more directories that -# contain msc files that are included in the documentation (see the -# \mscfile command). - -MSCFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES diff --git a/third_party/penumbra/vendor/glfw/docs/DoxygenLayout.xml b/third_party/penumbra/vendor/glfw/docs/DoxygenLayout.xml deleted file mode 100644 index ab971721860..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/DoxygenLayout.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/third_party/penumbra/vendor/glfw/docs/SUPPORT.md b/third_party/penumbra/vendor/glfw/docs/SUPPORT.md deleted file mode 100644 index 604957d0660..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/SUPPORT.md +++ /dev/null @@ -1,14 +0,0 @@ -# Support resources - -See the [latest documentation](http://www.glfw.org/docs/latest/) for tutorials, -guides and the API reference. - -If you have questions about using GLFW, we have a -[forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on -[Freenode](http://freenode.net/). - -Bugs are reported to our [issue tracker](https://github.com/glfw/glfw/issues). -Please check the [contribution -guide](https://github.com/glfw/glfw/blob/master/docs/CONTRIBUTING.md) for -information on what to include when reporting a bug. - diff --git a/third_party/penumbra/vendor/glfw/docs/build.dox b/third_party/penumbra/vendor/glfw/docs/build.dox deleted file mode 100644 index 5aeb136abca..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/build.dox +++ /dev/null @@ -1,342 +0,0 @@ -/*! - -@page build_guide Building applications - -@tableofcontents - -This is about compiling and linking applications that use GLFW. For information on -how to write such applications, start with the -[introductory tutorial](@ref quick_guide). For information on how to compile -the GLFW library itself, see @ref compile_guide. - -This is not a tutorial on compilation or linking. It assumes basic -understanding of how to compile and link a C program as well as how to use the -specific compiler of your chosen development environment. The compilation -and linking process should be explained in your C programming material and in -the documentation for your development environment. - - -@section build_include Including the GLFW header file - -You should include the GLFW header in the source files where you use OpenGL or -GLFW. - -@code -#include -@endcode - -This header declares the GLFW API and by default also includes the OpenGL header -from your development environment. See below for how to control this. - -The GLFW header also defines any platform-specific macros needed by your OpenGL -header, so it can be included without needing any window system headers. - -For example, under Windows you are normally required to include `windows.h` -before the OpenGL header, which would bring in the whole Win32 API. The GLFW -header duplicates the small number of macros needed. - -It does this only when needed, so if `windows.h` _is_ included, the GLFW header -does not try to redefine those symbols. The reverse is not true, i.e. -`windows.h` cannot cope if any of its symbols have already been defined. - -In other words: - - - Do _not_ include the OpenGL headers yourself, as GLFW does this for you - - Do _not_ include `windows.h` or other platform-specific headers unless you - plan on using those APIs directly - - If you _do_ need to include such headers, do it _before_ including - the GLFW header and it will handle this - -If you are using an OpenGL extension loading library such as -[glad](https://github.com/Dav1dde/glad), the extension loader header should -be included _before_ the GLFW one. - -@code -#include -#include -@endcode - -Alternatively the @ref GLFW_INCLUDE_NONE macro (described below) can be used to -prevent the GLFW header from including the OpenGL header. - -@code -#define GLFW_INCLUDE_NONE -#include -#include -@endcode - - -@subsection build_macros GLFW header option macros - -These macros may be defined before the inclusion of the GLFW header and affect -its behavior. - -@anchor GLFW_DLL -__GLFW_DLL__ is required on Windows when using the GLFW DLL, to tell the -compiler that the GLFW functions are defined in a DLL. - -The following macros control which OpenGL or OpenGL ES API header is included. -Only one of these may be defined at a time. - -@note GLFW does not provide any of the API headers mentioned below. They are -provided by your development environment or your OpenGL, OpenGL ES or Vulkan -SDK, and most of them can be downloaded from the -[Khronos Registry](https://www.khronos.org/registry/). - -@anchor GLFW_INCLUDE_GLCOREARB -__GLFW_INCLUDE_GLCOREARB__ makes the GLFW header include the modern -`GL/glcorearb.h` header (`OpenGL/gl3.h` on macOS) instead of the regular OpenGL -header. - -@anchor GLFW_INCLUDE_ES1 -__GLFW_INCLUDE_ES1__ makes the GLFW header include the OpenGL ES 1.x `GLES/gl.h` -header instead of the regular OpenGL header. - -@anchor GLFW_INCLUDE_ES2 -__GLFW_INCLUDE_ES2__ makes the GLFW header include the OpenGL ES 2.0 -`GLES2/gl2.h` header instead of the regular OpenGL header. - -@anchor GLFW_INCLUDE_ES3 -__GLFW_INCLUDE_ES3__ makes the GLFW header include the OpenGL ES 3.0 -`GLES3/gl3.h` header instead of the regular OpenGL header. - -@anchor GLFW_INCLUDE_ES31 -__GLFW_INCLUDE_ES31__ makes the GLFW header include the OpenGL ES 3.1 -`GLES3/gl31.h` header instead of the regular OpenGL header. - -@anchor GLFW_INCLUDE_ES32 -__GLFW_INCLUDE_ES31__ makes the GLFW header include the OpenGL ES 3.2 -`GLES3/gl32.h` header instead of the regular OpenGL header. - -@anchor GLFW_INCLUDE_NONE -__GLFW_INCLUDE_NONE__ makes the GLFW header not include any OpenGL or OpenGL ES -API header. This is useful in combination with an extension loading library. - -If none of the above inclusion macros are defined, the standard OpenGL `GL/gl.h` -header (`OpenGL/gl.h` on macOS) is included. - -The following macros control the inclusion of additional API headers. Any -number of these may be defined simultaneously, and/or together with one of the -above macros. - -@anchor GLFW_INCLUDE_VULKAN -__GLFW_INCLUDE_VULKAN__ makes the GLFW header include the Vulkan -`vulkan/vulkan.h` header in addition to any selected OpenGL or OpenGL ES header. - -@anchor GLFW_INCLUDE_GLEXT -__GLFW_INCLUDE_GLEXT__ makes the GLFW header include the appropriate extension -header for the OpenGL or OpenGL ES header selected above after and in addition -to that header. - -@anchor GLFW_INCLUDE_GLU -__GLFW_INCLUDE_GLU__ makes the header include the GLU header in addition to the -header selected above. This should only be used with the standard OpenGL header -and only for compatibility with legacy code. GLU has been deprecated and should -not be used in new code. - -@note None of these macros may be defined during the compilation of GLFW itself. -If your build includes GLFW and you define any these in your build files, make -sure they are not applied to the GLFW sources. - - -@section build_link Link with the right libraries - -GLFW is essentially a wrapper of various platform-specific APIs and therefore -needs to link against many different system libraries. If you are using GLFW as -a shared library / dynamic library / DLL then it takes care of these links. -However, if you are using GLFW as a static library then your executable will -need to link against these libraries. - -On Windows and macOS, the list of system libraries is static and can be -hard-coded into your build environment. See the section for your development -environment below. On Linux and other Unix-like operating systems, the list -varies but can be retrieved in various ways as described below. - -A good general introduction to linking is -[Beginner's Guide to Linkers](https://www.lurklurk.org/linkers/linkers.html) by -David Drysdale. - - -@subsection build_link_win32 With MinGW or Visual C++ on Windows - -The static version of the GLFW library is named `glfw3`. When using this -version, it is also necessary to link with some libraries that GLFW uses. - -When using MinGW to link an application with the static version of GLFW, you -must also explicitly link with `gdi32`. Other toolchains including MinGW-w64 -include it in the set of default libraries along with other dependencies like -`user32` and `kernel32`. - -The link library for the GLFW DLL is named `glfw3dll`. When compiling an -application that uses the DLL version of GLFW, you need to define the @ref -GLFW_DLL macro _before_ any inclusion of the GLFW header. This can be done -either with a compiler switch or by defining it in your source code. - - -@subsection build_link_cmake_source With CMake and GLFW source - -This section is about using CMake to compile and link GLFW along with your -application. If you want to use an installed binary instead, see @ref -build_link_cmake_package. - -With a few changes to your `CMakeLists.txt` you can have the GLFW source tree -built along with your application. - -When including GLFW as part of your build, you probably don't want to build the -GLFW tests, examples and documentation. To disable these, set the corresponding -cache variables before adding the GLFW source tree. - -@code -set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) -set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) -set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) -@endcode - -Add the root directory of the GLFW source tree to your project. This will add -the `glfw` target to your project. - -@code{.cmake} -add_subdirectory(path/to/glfw) -@endcode - -Once GLFW has been added, link your application against the `glfw` target. -This adds the GLFW library and its link-time dependencies as it is currently -configured, the include directory for the GLFW header and, when applicable, the -@ref GLFW_DLL macro. - -@code{.cmake} -target_link_libraries(myapp glfw) -@endcode - -Note that the `glfw` target does not depend on OpenGL, as GLFW loads any OpenGL, -OpenGL ES or Vulkan libraries it needs at runtime. If your application calls -OpenGL directly, instead of using a modern -[extension loader library](@ref context_glext_auto), use the OpenGL CMake -package. - -@code{.cmake} -find_package(OpenGL REQUIRED) -@endcode - -If OpenGL is found, the `OpenGL::GL` target is added to your project, containing -library and include directory paths. Link against this like above. - -@code{.cmake} -target_link_libraries(myapp OpenGL::GL) -@endcode - - -@subsection build_link_cmake_package With CMake and installed GLFW binaries - -This section is about using CMake to link GLFW after it has been built and -installed. If you want to build it along with your application instead, see -@ref build_link_cmake_source. - -With a few changes to your `CMakeLists.txt` you can locate the package and -target files generated when GLFW is installed. - -@code{.cmake} -find_package(glfw3 3.3 REQUIRED) -@endcode - -Once GLFW has been added to the project, link against it with the `glfw` target. -This adds the GLFW library and its link-time dependencies, the include directory -for the GLFW header and, when applicable, the @ref GLFW_DLL macro. - -@code{.cmake} -target_link_libraries(myapp glfw) -@endcode - -Note that the `glfw` target does not depend on OpenGL, as GLFW loads any OpenGL, -OpenGL ES or Vulkan libraries it needs at runtime. If your application calls -OpenGL directly, instead of using a modern -[extension loader library](@ref context_glext_auto), use the OpenGL CMake -package. - -@code{.cmake} -find_package(OpenGL REQUIRED) -@endcode - -If OpenGL is found, the `OpenGL::GL` target is added to your project, containing -library and include directory paths. Link against this like above. - -@code{.cmake} -target_link_libraries(myapp OpenGL::GL) -@endcode - - -@subsection build_link_pkgconfig With makefiles and pkg-config on Unix - -GLFW supports [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/), -and the `glfw3.pc` pkg-config file is generated when the GLFW library is built -and is installed along with it. A pkg-config file describes all necessary -compile-time and link-time flags and dependencies needed to use a library. When -they are updated or if they differ between systems, you will get the correct -ones automatically. - -A typical compile and link command-line when using the static version of the -GLFW library may look like this: - -@code{.sh} -cc $(pkg-config --cflags glfw3) -o myprog myprog.c $(pkg-config --static --libs glfw3) -@endcode - -If you are using the shared version of the GLFW library, omit the `--static` -flag. - -@code{.sh} -cc $(pkg-config --cflags glfw3) -o myprog myprog.c $(pkg-config --libs glfw3) -@endcode - -You can also use the `glfw3.pc` file without installing it first, by using the -`PKG_CONFIG_PATH` environment variable. - -@code{.sh} -env PKG_CONFIG_PATH=path/to/glfw/src cc $(pkg-config --cflags glfw3) -o myprog myprog.c $(pkg-config --libs glfw3) -@endcode - -The dependencies do not include OpenGL, as GLFW loads any OpenGL, OpenGL ES or -Vulkan libraries it needs at runtime. If your application calls OpenGL -directly, instead of using a modern -[extension loader library](@ref context_glext_auto), you should add the `gl` -pkg-config package. - -@code{.sh} -cc $(pkg-config --cflags glfw3 gl) -o myprog myprog.c $(pkg-config --libs glfw3 gl) -@endcode - - -@subsection build_link_xcode With Xcode on macOS - -If you are using the dynamic library version of GLFW, add it to the project -dependencies. - -If you are using the static library version of GLFW, add it and the Cocoa, -OpenGL and IOKit frameworks to the project as dependencies. They can all be -found in `/System/Library/Frameworks`. - - -@subsection build_link_osx With command-line on macOS - -It is recommended that you use [pkg-config](@ref build_link_pkgconfig) when -building from the command line on macOS. That way you will get any new -dependencies added automatically. If you still wish to build manually, you need -to add the required frameworks and libraries to your command-line yourself using -the `-l` and `-framework` switches. - -If you are using the dynamic GLFW library, which is named `libglfw.3.dylib`, do: - -@code{.sh} -cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit -@endcode - -If you are using the static library, named `libglfw3.a`, substitute `-lglfw3` -for `-lglfw`. - -Note that you do not add the `.framework` extension to a framework when linking -against it from the command-line. - -@note Your machine may have `libGL.*.dylib` style OpenGL library, but that is -for the X Window System and will not work with the macOS native version of GLFW. - -*/ diff --git a/third_party/penumbra/vendor/glfw/docs/compat.dox b/third_party/penumbra/vendor/glfw/docs/compat.dox deleted file mode 100644 index fea7ab180b5..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/compat.dox +++ /dev/null @@ -1,285 +0,0 @@ -/*! - -@page compat_guide Standards conformance - -@tableofcontents - -This guide describes the various API extensions used by this version of GLFW. -It lists what are essentially implementation details, but which are nonetheless -vital knowledge for developers intending to deploy their applications on a wide -range of machines. - -The information in this guide is not a part of GLFW API, but merely -preconditions for some parts of the library to function on a given machine. Any -part of this information may change in future versions of GLFW and that will not -be considered a breaking API change. - - -@section compat_x11 X11 extensions, protocols and IPC standards - -As GLFW uses Xlib directly, without any intervening toolkit -library, it has sole responsibility for interacting well with the many and -varied window managers in use on Unix-like systems. In order for applications -and window managers to work well together, a number of standards and -conventions have been developed that regulate behavior outside the scope of the -X11 API; most importantly the -[Inter-Client Communication Conventions Manual](https://www.tronche.com/gui/x/icccm/) -(ICCCM) and -[Extended Window Manager Hints](https://standards.freedesktop.org/wm-spec/wm-spec-latest.html) -(EWMH) standards. - -GLFW uses the `_MOTIF_WM_HINTS` window property to support borderless windows. -If the running window manager does not support this property, the -`GLFW_DECORATED` hint will have no effect. - -GLFW uses the ICCCM `WM_DELETE_WINDOW` protocol to intercept the user -attempting to close the GLFW window. If the running window manager does not -support this protocol, the close callback will never be called. - -GLFW uses the EWMH `_NET_WM_PING` protocol, allowing the window manager notify -the user when the application has stopped responding, i.e. when it has ceased to -process events. If the running window manager does not support this protocol, -the user will not be notified if the application locks up. - -GLFW uses the EWMH `_NET_WM_STATE_FULLSCREEN` window state to tell the window -manager to make the GLFW window full screen. If the running window manager does -not support this state, full screen windows may not work properly. GLFW has -a fallback code path in case this state is unavailable, but every window manager -behaves slightly differently in this regard. - -GLFW uses the EWMH `_NET_WM_BYPASS_COMPOSITOR` window property to tell a -compositing window manager to un-redirect full screen GLFW windows. If the -running window manager uses compositing but does not support this property then -additional copying may be performed for each buffer swap of full screen windows. - -GLFW uses the -[clipboard manager protocol](https://www.freedesktop.org/wiki/ClipboardManager/) -to push a clipboard string (i.e. selection) owned by a GLFW window about to be -destroyed to the clipboard manager. If there is no running clipboard manager, -the clipboard string will be unavailable once the window has been destroyed. - -GLFW uses the -[X drag-and-drop protocol](https://www.freedesktop.org/wiki/Specifications/XDND/) -to provide file drop events. If the application originating the drag does not -support this protocol, drag and drop will not work. - -GLFW uses the XRandR 1.3 extension to provide multi-monitor support. If the -running X server does not support this version of this extension, multi-monitor -support will not function and only a single, desktop-spanning monitor will be -reported. - -GLFW uses the XRandR 1.3 and Xf86vidmode extensions to provide gamma ramp -support. If the running X server does not support either or both of these -extensions, gamma ramp support will not function. - -GLFW uses the Xkb extension and detectable auto-repeat to provide keyboard -input. If the running X server does not support this extension, a non-Xkb -fallback path is used. - -GLFW uses the XInput2 extension to provide raw, non-accelerated mouse motion -when the cursor is disabled. If the running X server does not support this -extension, regular accelerated mouse motion will be used. - -GLFW uses both the XRender extension and the compositing manager to support -transparent window framebuffers. If the running X server does not support this -extension or there is no running compositing manager, the -`GLFW_TRANSPARENT_FRAMEBUFFER` framebuffer hint will have no effect. - - -@section compat_wayland Wayland protocols and IPC standards - -As GLFW uses libwayland directly, without any intervening toolkit library, it -has sole responsibility for interacting well with every compositor in use on -Unix-like systems. Most of the features are provided by the core protocol, -while cursor support is provided by the libwayland-cursor helper library, EGL -integration by libwayland-egl, and keyboard handling by -[libxkbcommon](https://xkbcommon.org/). In addition, GLFW uses some protocols -from wayland-protocols to provide additional features if the compositor -supports them. - -GLFW uses xkbcommon 0.5.0 to provide compose key support. When it has been -built against an older xkbcommon, the compose key will be disabled even if it -has been configured in the compositor. - -GLFW uses the [xdg-shell -protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/xdg-shell/xdg-shell.xml) -to provide better window management. This protocol is part of -wayland-protocols 1.12, and mandatory at build time. If the running compositor -does not support this protocol, the older [wl_shell -interface](https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml#n972) -will be used instead. This will result in a worse integration with the -desktop, especially on tiling compositors. - -GLFW uses the [relative pointer -protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/relative-pointer/relative-pointer-unstable-v1.xml) -alongside the [pointer constraints -protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml) -to implement disabled cursor. These two protocols are part of -wayland-protocols 1.1, and mandatory at build time. If the running compositor -does not support both of these protocols, disabling the cursor will have no -effect. - -GLFW uses the [idle inhibit -protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml) -to prohibit the screensaver from starting. This protocol is part of -wayland-protocols 1.6, and mandatory at build time. If the running compositor -does not support this protocol, the screensaver may start even for full screen -windows. - -GLFW uses the [xdg-decoration -protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml) -to request decorations to be drawn around its windows. This protocol is part -of wayland-protocols 1.15, and mandatory at build time. If the running -compositor does not support this protocol, a very simple frame will be drawn by -GLFW itself, using the [viewporter -protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/viewporter/viewporter.xml) -alongside -[subsurfaces](https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml#n2598). -This protocol is part of wayland-protocols 1.4, and mandatory at build time. -If the running compositor does not support this protocol either, no decorations -will be drawn around windows. - - -@section compat_glx GLX extensions - -The GLX API is the default API used to create OpenGL contexts on Unix-like -systems using the X Window System. - -GLFW uses the GLX 1.3 `GLXFBConfig` functions to enumerate and select framebuffer pixel -formats. If GLX 1.3 is not supported, @ref glfwInit will fail. - -GLFW uses the `GLX_MESA_swap_control,` `GLX_EXT_swap_control` and -`GLX_SGI_swap_control` extensions to provide vertical retrace synchronization -(or _vsync_), in that order of preference. Where none of these extension are -available, calling @ref glfwSwapInterval will have no effect. - -GLFW uses the `GLX_ARB_multisample` extension to create contexts with -multisampling anti-aliasing. Where this extension is unavailable, the -`GLFW_SAMPLES` hint will have no effect. - -GLFW uses the `GLX_ARB_create_context` extension when available, even when -creating OpenGL contexts of version 2.1 and below. Where this extension is -unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR` -hints will only be partially supported, the `GLFW_OPENGL_DEBUG_CONTEXT` hint -will have no effect, and setting the `GLFW_OPENGL_PROFILE` or -`GLFW_OPENGL_FORWARD_COMPAT` hints to `GLFW_TRUE` will cause @ref -glfwCreateWindow to fail. - -GLFW uses the `GLX_ARB_create_context_profile` extension to provide support for -context profiles. Where this extension is unavailable, setting the -`GLFW_OPENGL_PROFILE` hint to anything but `GLFW_OPENGL_ANY_PROFILE`, or setting -`GLFW_CLIENT_API` to anything but `GLFW_OPENGL_API` or `GLFW_NO_API` will cause -@ref glfwCreateWindow to fail. - -GLFW uses the `GLX_ARB_context_flush_control` extension to provide control over -whether a context is flushed when it is released (made non-current). Where this -extension is unavailable, the `GLFW_CONTEXT_RELEASE_BEHAVIOR` hint will have no -effect and the context will always be flushed when released. - -GLFW uses the `GLX_ARB_framebuffer_sRGB` and `GLX_EXT_framebuffer_sRGB` -extensions to provide support for sRGB framebuffers. Where both of these -extensions are unavailable, the `GLFW_SRGB_CAPABLE` hint will have no effect. - - -@section compat_wgl WGL extensions - -The WGL API is used to create OpenGL contexts on Microsoft Windows and other -implementations of the Win32 API, such as Wine. - -GLFW uses either the `WGL_EXT_extension_string` or the -`WGL_ARB_extension_string` extension to check for the presence of all other WGL -extensions listed below. If both are available, the EXT one is preferred. If -neither is available, no other extensions are used and many GLFW features -related to context creation will have no effect or cause errors when used. - -GLFW uses the `WGL_EXT_swap_control` extension to provide vertical retrace -synchronization (or _vsync_). Where this extension is unavailable, calling @ref -glfwSwapInterval will have no effect. - -GLFW uses the `WGL_ARB_pixel_format` and `WGL_ARB_multisample` extensions to -create contexts with multisampling anti-aliasing. Where these extensions are -unavailable, the `GLFW_SAMPLES` hint will have no effect. - -GLFW uses the `WGL_ARB_create_context` extension when available, even when -creating OpenGL contexts of version 2.1 and below. Where this extension is -unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR` -hints will only be partially supported, the `GLFW_OPENGL_DEBUG_CONTEXT` hint -will have no effect, and setting the `GLFW_OPENGL_PROFILE` or -`GLFW_OPENGL_FORWARD_COMPAT` hints to `GLFW_TRUE` will cause @ref -glfwCreateWindow to fail. - -GLFW uses the `WGL_ARB_create_context_profile` extension to provide support for -context profiles. Where this extension is unavailable, setting the -`GLFW_OPENGL_PROFILE` hint to anything but `GLFW_OPENGL_ANY_PROFILE` will cause -@ref glfwCreateWindow to fail. - -GLFW uses the `WGL_ARB_context_flush_control` extension to provide control over -whether a context is flushed when it is released (made non-current). Where this -extension is unavailable, the `GLFW_CONTEXT_RELEASE_BEHAVIOR` hint will have no -effect and the context will always be flushed when released. - -GLFW uses the `WGL_ARB_framebuffer_sRGB` and `WGL_EXT_framebuffer_sRGB` -extensions to provide support for sRGB framebuffers. Where both of these -extension are unavailable, the `GLFW_SRGB_CAPABLE` hint will have no effect. - - -@section compat_osx OpenGL on macOS - -Support for OpenGL 3.2 and above was introduced with OS X 10.7 and even then -only forward-compatible, core profile contexts are supported. Support for -OpenGL 4.1 was introduced with OS X 10.9, also limited to forward-compatible, -core profile contexts. There is also still no mechanism for requesting debug -contexts or no-error contexts. Versions of Mac OS X earlier than 10.7 support -at most OpenGL version 2.1. - -Because of this, on OS X 10.7 and later, the `GLFW_CONTEXT_VERSION_MAJOR` and -`GLFW_CONTEXT_VERSION_MINOR` hints will cause @ref glfwCreateWindow to fail if -given version 3.0 or 3.1. The `GLFW_OPENGL_FORWARD_COMPAT` hint must be set to -`GLFW_TRUE` and the `GLFW_OPENGL_PROFILE` hint must be set to -`GLFW_OPENGL_CORE_PROFILE` when creating OpenGL 3.2 and later contexts. The -`GLFW_OPENGL_DEBUG_CONTEXT` and `GLFW_CONTEXT_NO_ERROR` hints are ignored. - -Also, on Mac OS X 10.6 and below, the `GLFW_CONTEXT_VERSION_MAJOR` and -`GLFW_CONTEXT_VERSION_MINOR` hints will fail if given a version above 2.1, -setting the `GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT` hints to -a non-default value will cause @ref glfwCreateWindow to fail and the -`GLFW_OPENGL_DEBUG_CONTEXT` hint is ignored. - - -@section compat_vulkan Vulkan loader and API - -By default, GLFW uses the standard system-wide Vulkan loader to access the -Vulkan API on all platforms except macOS. This is installed by both graphics -drivers and Vulkan SDKs. If either the loader or at least one minimally -functional ICD is missing, @ref glfwVulkanSupported will return `GLFW_FALSE` and -all other Vulkan-related functions will fail with an @ref GLFW_API_UNAVAILABLE -error. - - -@section compat_wsi Vulkan WSI extensions - -The Vulkan WSI extensions are used to create Vulkan surfaces for GLFW windows on -all supported platforms. - -GLFW uses the `VK_KHR_surface` and `VK_KHR_win32_surface` extensions to create -surfaces on Microsoft Windows. If any of these extensions are not available, -@ref glfwGetRequiredInstanceExtensions will return an empty list and window -surface creation will fail. - -GLFW uses the `VK_KHR_surface` and either the `VK_MVK_macos_surface` or -`VK_EXT_metal_surface` extensions to create surfaces on macOS. If any of these -extensions are not available, @ref glfwGetRequiredInstanceExtensions will -return an empty list and window surface creation will fail. - -GLFW uses the `VK_KHR_surface` and either the `VK_KHR_xlib_surface` or -`VK_KHR_xcb_surface` extensions to create surfaces on X11. If `VK_KHR_surface` -or both `VK_KHR_xlib_surface` and `VK_KHR_xcb_surface` are not available, @ref -glfwGetRequiredInstanceExtensions will return an empty list and window surface -creation will fail. - -GLFW uses the `VK_KHR_surface` and `VK_KHR_wayland_surface` extensions to create -surfaces on Wayland. If any of these extensions are not available, @ref -glfwGetRequiredInstanceExtensions will return an empty list and window surface -creation will fail. - -*/ diff --git a/third_party/penumbra/vendor/glfw/docs/compile.dox b/third_party/penumbra/vendor/glfw/docs/compile.dox deleted file mode 100644 index 8a4fb583b4a..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/compile.dox +++ /dev/null @@ -1,290 +0,0 @@ -/*! - -@page compile_guide Compiling GLFW - -@tableofcontents - -This is about compiling the GLFW library itself. For information on how to -build applications that use GLFW, see @ref build_guide. - - -@section compile_cmake Using CMake - -GLFW uses [CMake](https://cmake.org/) to generate project files or makefiles -for a particular development environment. If you are on a Unix-like system such -as Linux or FreeBSD or have a package system like Fink, MacPorts, Cygwin or -Homebrew, you can install its CMake package. If not, you can download -installers for Windows and macOS from the -[CMake website](https://cmake.org/). - -@note CMake only generates project files or makefiles. It does not compile the -actual GLFW library. To compile GLFW, first generate these files for your -chosen development environment and then use them to compile the actual GLFW -library. - - -@subsection compile_deps Dependencies - -Once you have installed CMake, make sure that all other dependencies are -available. On some platforms, GLFW needs a few additional packages to be -installed. See the section for your chosen platform and development environment -below. - - -@subsubsection compile_deps_msvc Dependencies for Visual C++ on Windows - -The Windows SDK bundled with Visual C++ already contains all the necessary -headers, link libraries and tools except for CMake. Move on to @ref -compile_generate. - - -@subsubsection compile_deps_mingw Dependencies for MinGW or MinGW-w64 on Windows - -Both the MinGW and the MinGW-w64 packages already contain all the necessary -headers, link libraries and tools except for CMake. Move on to @ref -compile_generate. - - -@subsubsection compile_deps_mingw_cross Dependencies for MinGW or MinGW-w64 cross-compilation - -Both Cygwin and many Linux distributions have MinGW or MinGW-w64 packages. For -example, Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages -for 32- and 64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives -like Ubuntu have the `mingw-w64` package for both. - -GLFW has CMake toolchain files in the `CMake/` directory that set up -cross-compilation of Windows binaries. To use these files you add an option -when running `cmake` to generate the project files or makefiles: - -@code{.sh} -cmake -DCMAKE_TOOLCHAIN_FILE= . -@endcode - -The exact toolchain file to use depends on the prefix used by the MinGW or -MinGW-w64 binaries on your system. You can usually see this in the /usr -directory. For example, both the Debian/Ubuntu and Cygwin MinGW-w64 packages -have `/usr/x86_64-w64-mingw32` for the 64-bit compilers, so the correct -invocation would be: - -@code{.sh} -cmake -DCMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake . -@endcode - -For more details see the article -[CMake Cross Compiling](https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/CrossCompiling) on -the CMake wiki. - -Once you have this set up, move on to @ref compile_generate. - - -@subsubsection compile_deps_xcode Dependencies for Xcode on macOS - -Xcode comes with all necessary tools except for CMake. The required headers -and libraries are included in the core macOS frameworks. Xcode can be -downloaded from the Mac App Store or from the ADC Member Center. - -Once you have Xcode installed, move on to @ref compile_generate. - - -@subsubsection compile_deps_x11 Dependencies for Linux and X11 - -To compile GLFW for X11, you need to have the X11 packages installed, as well as -the basic development tools like GCC and make. For example, on Ubuntu and other -distributions based on Debian GNU/Linux, you need to install the `xorg-dev` -package, which pulls in all X.org header packages. - -Once you have installed the necessary packages, move on to @ref -compile_generate. - - -@subsubsection compile_deps_wayland Dependencies for Linux and Wayland - -To compile GLFW for Wayland, you need to have the Wayland packages installed, -as well as the basic development tools like GCC and make. For example, on -Ubuntu and other distributions based on Debian GNU/Linux, you need to install -the `libwayland-dev` package, which contains all Wayland headers and pulls in -wayland-scanner, as well as the `wayland-protocols` and `extra-cmake-modules` -packages. - -Once you have installed the necessary packages, move on to @ref -compile_generate. - - -@subsection compile_deps_osmesa Dependencies for Linux and OSMesa - -To compile GLFW for OSMesa, you need to install the OSMesa library and header -packages. For example, on Ubuntu and other distributions based on Debian -GNU/Linux, you need to install the `libosmesa6-dev` package. The OSMesa library -is required at runtime for context creation and is loaded on demand. - -Once you have installed the necessary packages, move on to @ref -compile_generate. - - -@subsection compile_generate Generating build files with CMake - -Once you have all necessary dependencies it is time to generate the project -files or makefiles for your development environment. CMake needs to know two -paths for this: the path to the _root_ directory of the GLFW source tree (i.e. -_not_ the `src` subdirectory) and the target path for the generated files and -compiled binaries. If these are the same, it is called an in-tree build, -otherwise it is called an out-of-tree build. - -One of several advantages of out-of-tree builds is that you can generate files -and compile for different development environments using a single source tree. - -@note This section is about generating the project files or makefiles necessary -to compile the GLFW library, not about compiling the actual library. - - -@subsubsection compile_generate_cli Generating files with the CMake command-line tool - -To make an in-tree build, enter the _root_ directory of the GLFW source tree -(i.e. _not_ the `src` subdirectory) and run CMake. The current directory is -used as target path, while the path provided as an argument is used to find the -source tree. - -@code{.sh} -cd -cmake . -@endcode - -To make an out-of-tree build, make a directory outside of the source tree, enter -it and run CMake with the (relative or absolute) path to the root of the source -tree as an argument. - -@code{.sh} -mkdir glfw-build -cd glfw-build -cmake -@endcode - -Once you have generated the project files or makefiles for your chosen -development environment, move on to @ref compile_compile. - - -@subsubsection compile_generate_gui Generating files with the CMake GUI - -If you are using the GUI version, choose the root of the GLFW source tree as -source location and the same directory or another, empty directory as the -destination for binaries. Choose _Configure_, change any options you wish to, -_Configure_ again to let the changes take effect and then _Generate_. - -Once you have generated the project files or makefiles for your chosen -development environment, move on to @ref compile_compile. - - -@subsection compile_compile Compiling the library - -You should now have all required dependencies and the project files or makefiles -necessary to compile GLFW. Go ahead and compile the actual GLFW library with -these files, as you would with any other project. - -Once the GLFW library is compiled, you are ready to build your applications, -linking it to the GLFW library. See @ref build_guide for more information. - - -@subsection compile_options CMake options - -The CMake files for GLFW provide a number of options, although not all are -available on all supported platforms. Some of these are de facto standards -among projects using CMake and so have no `GLFW_` prefix. - -If you are using the GUI version of CMake, these are listed and can be changed -from there. If you are using the command-line version of CMake you can use the -`ccmake` ncurses GUI to set options. Some package systems like Ubuntu and other -distributions based on Debian GNU/Linux have this tool in a separate -`cmake-curses-gui` package. - -Finally, if you don't want to use any GUI, you can set options from the `cmake` -command-line with the `-D` flag. - -@code{.sh} -cmake -DBUILD_SHARED_LIBS=ON . -@endcode - - -@subsubsection compile_options_shared Shared CMake options - -@anchor BUILD_SHARED_LIBS -__BUILD_SHARED_LIBS__ determines whether GLFW is built as a static -library or as a DLL / shared library / dynamic library. - -@anchor GLFW_BUILD_EXAMPLES -__GLFW_BUILD_EXAMPLES__ determines whether the GLFW examples are built -along with the library. - -@anchor GLFW_BUILD_TESTS -__GLFW_BUILD_TESTS__ determines whether the GLFW test programs are -built along with the library. - -@anchor GLFW_BUILD_DOCS -__GLFW_BUILD_DOCS__ determines whether the GLFW documentation is built along -with the library. - -@anchor GLFW_VULKAN_STATIC -__GLFW_VULKAN_STATIC__ determines whether to use the Vulkan loader linked -directly with the application. - - -@subsubsection compile_options_win32 Windows specific CMake options - -@anchor USE_MSVC_RUNTIME_LIBRARY_DLL -__USE_MSVC_RUNTIME_LIBRARY_DLL__ determines whether to use the DLL version or the -static library version of the Visual C++ runtime library. If set to `ON`, the -DLL version of the Visual C++ library is used. - -@anchor GLFW_USE_HYBRID_HPG -__GLFW_USE_HYBRID_HPG__ determines whether to export the `NvOptimusEnablement` and -`AmdPowerXpressRequestHighPerformance` symbols, which force the use of the -high-performance GPU on Nvidia Optimus and AMD PowerXpress systems. These symbols -need to be exported by the EXE to be detected by the driver, so the override -will not work if GLFW is built as a DLL. - - -@section compile_manual Compiling GLFW manually - -If you wish to compile GLFW without its CMake build environment then you will -have to do at least some of the platform detection yourself. GLFW needs -a configuration macro to be defined in order to know what window system it's -being compiled for and also has optional, platform-specific ones for various -features. - -When building with CMake, the `glfw_config.h` configuration header is generated -based on the current platform and CMake options. The GLFW CMake environment -defines @b GLFW_USE_CONFIG_H, which causes this header to be included by -`internal.h`. Without this macro, GLFW will expect the necessary configuration -macros to be defined on the command-line. - -The window creation API is used to create windows, handle input, monitors, gamma -ramps and clipboard. The options are: - - - @b _GLFW_COCOA to use the Cocoa frameworks - - @b _GLFW_WIN32 to use the Win32 API - - @b _GLFW_X11 to use the X Window System - - @b _GLFW_WAYLAND to use the Wayland API (experimental and incomplete) - - @b _GLFW_OSMESA to use the OSMesa API (headless and non-interactive) - -If you are building GLFW as a shared library / dynamic library / DLL then you -must also define @b _GLFW_BUILD_DLL. Otherwise, you must not define it. - -If you are linking the Vulkan loader directly with your application then you -must also define @b _GLFW_VULKAN_STATIC. Otherwise, GLFW will attempt to use the -external version. - -If you are using a custom name for the Vulkan, EGL, GLX, OSMesa, OpenGL, GLESv1 -or GLESv2 library, you can override the default names by defining those you need -of @b _GLFW_VULKAN_LIBRARY, @b _GLFW_EGL_LIBRARY, @b _GLFW_GLX_LIBRARY, @b -_GLFW_OSMESA_LIBRARY, @b _GLFW_OPENGL_LIBRARY, @b _GLFW_GLESV1_LIBRARY and @b -_GLFW_GLESV2_LIBRARY. Otherwise, GLFW will use the built-in default names. - -For the EGL context creation API, the following options are available: - - - @b _GLFW_USE_EGLPLATFORM_H to use an existing `EGL/eglplatform.h` header file - for native handle types (fallback) - -@note None of the @ref build_macros may be defined during the compilation of -GLFW. If you define any of these in your build files, make sure they are not -applied to the GLFW sources. - -*/ diff --git a/third_party/penumbra/vendor/glfw/docs/context.dox b/third_party/penumbra/vendor/glfw/docs/context.dox deleted file mode 100644 index 69b8fa7fdf2..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/context.dox +++ /dev/null @@ -1,346 +0,0 @@ -/*! - -@page context_guide Context guide - -@tableofcontents - -This guide introduces the OpenGL and OpenGL ES context related functions of -GLFW. For details on a specific function in this category, see the @ref -context. There are also guides for the other areas of the GLFW API. - - - @ref intro_guide - - @ref window_guide - - @ref vulkan_guide - - @ref monitor_guide - - @ref input_guide - - -@section context_object Context objects - -A window object encapsulates both a top-level window and an OpenGL or OpenGL ES -context. It is created with @ref glfwCreateWindow and destroyed with @ref -glfwDestroyWindow or @ref glfwTerminate. See @ref window_creation for more -information. - -As the window and context are inseparably linked, the window object also serves -as the context handle. - -To test the creation of various kinds of contexts and see their properties, run -the `glfwinfo` test program. - -@note Vulkan does not have a context and the Vulkan instance is created via the -Vulkan API itself. If you will be using Vulkan to render to a window, disable -context creation by setting the [GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) -hint to `GLFW_NO_API`. For more information, see the @ref vulkan_guide. - - -@subsection context_hints Context creation hints - -There are a number of hints, specified using @ref glfwWindowHint, related to -what kind of context is created. See -[context related hints](@ref window_hints_ctx) in the window guide. - - -@subsection context_sharing Context object sharing - -When creating a window and its OpenGL or OpenGL ES context with @ref -glfwCreateWindow, you can specify another window whose context the new one -should share its objects (textures, vertex and element buffers, etc.) with. - -@code -GLFWwindow* second_window = glfwCreateWindow(640, 480, "Second Window", NULL, first_window); -@endcode - -Object sharing is implemented by the operating system and graphics driver. On -platforms where it is possible to choose which types of objects are shared, GLFW -requests that all types are shared. - -See the relevant chapter of the [OpenGL](https://www.opengl.org/registry/) or -[OpenGL ES](https://www.khronos.org/opengles/) reference documents for more -information. The name and number of this chapter unfortunately varies between -versions and APIs, but has at times been named _Shared Objects and Multiple -Contexts_. - -GLFW comes with a barebones object sharing example program called `sharing`. - - -@subsection context_offscreen Offscreen contexts - -GLFW doesn't support creating contexts without an associated window. However, -contexts with hidden windows can be created with the -[GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window hint. - -@code -glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); - -GLFWwindow* offscreen_context = glfwCreateWindow(640, 480, "", NULL, NULL); -@endcode - -The window never needs to be shown and its context can be used as a plain -offscreen context. Depending on the window manager, the size of a hidden -window's framebuffer may not be usable or modifiable, so framebuffer -objects are recommended for rendering with such contexts. - -You should still [process events](@ref events) as long as you have at least one -window, even if none of them are visible. - -@macos The first time a window is created the menu bar is created. This is not -desirable for example when writing a command-line only application. Menu bar -creation can be disabled with the @ref GLFW_COCOA_MENUBAR init hint. - - -@subsection context_less Windows without contexts - -You can disable context creation by setting the -[GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_NO_API`. Windows -without contexts must not be passed to @ref glfwMakeContextCurrent or @ref -glfwSwapBuffers. - - -@section context_current Current context - -Before you can make OpenGL or OpenGL ES calls, you need to have a current -context of the correct type. A context can only be current for a single thread -at a time, and a thread can only have a single context current at a time. - -When moving a context between threads, you must make it non-current on the old -thread before making it current on the new one. - -The context of a window is made current with @ref glfwMakeContextCurrent. - -@code -glfwMakeContextCurrent(window); -@endcode - -The window of the current context is returned by @ref glfwGetCurrentContext. - -@code -GLFWwindow* window = glfwGetCurrentContext(); -@endcode - -The following GLFW functions require a context to be current. Calling any these -functions without a current context will generate a @ref GLFW_NO_CURRENT_CONTEXT -error. - - - @ref glfwSwapInterval - - @ref glfwExtensionSupported - - @ref glfwGetProcAddress - - -@section context_swap Buffer swapping - -See @ref buffer_swap in the window guide. - - -@section context_glext OpenGL and OpenGL ES extensions - -One of the benefits of OpenGL and OpenGL ES is their extensibility. -Hardware vendors may include extensions in their implementations that extend the -API before that functionality is included in a new version of the OpenGL or -OpenGL ES specification, and some extensions are never included and remain -as extensions until they become obsolete. - -An extension is defined by: - -- An extension name (e.g. `GL_ARB_debug_output`) -- New OpenGL tokens (e.g. `GL_DEBUG_SEVERITY_HIGH_ARB`) -- New OpenGL functions (e.g. `glGetDebugMessageLogARB`) - -Note the `ARB` affix, which stands for Architecture Review Board and is used -for official extensions. The extension above was created by the ARB, but there -are many different affixes, like `NV` for Nvidia and `AMD` for, well, AMD. Any -group may also use the generic `EXT` affix. Lists of extensions, together with -their specifications, can be found at the -[OpenGL Registry](https://www.opengl.org/registry/) and -[OpenGL ES Registry](https://www.khronos.org/registry/gles/). - - -@subsection context_glext_auto Loading extension with a loader library - -An extension loader library is the easiest and best way to access both OpenGL and -OpenGL ES extensions and modern versions of the core OpenGL or OpenGL ES APIs. -They will take care of all the details of declaring and loading everything you -need. One such library is [glad](https://github.com/Dav1dde/glad) and there are -several others. - -The following example will use glad but all extension loader libraries work -similarly. - -First you need to generate the source files using the glad Python script. This -example generates a loader for any version of OpenGL, which is the default for -both GLFW and glad, but loaders for OpenGL ES, as well as loaders for specific -API versions and extension sets can be generated. The generated files are -written to the `output` directory. - -@code{.sh} -python main.py --generator c --no-loader --out-path output -@endcode - -The `--no-loader` option is added because GLFW already provides a function for -loading OpenGL and OpenGL ES function pointers, one that automatically uses the -selected context creation API, and glad can call this instead of having to -implement its own. There are several other command-line options as well. See -the glad documentation for details. - -Add the generated `output/src/glad.c`, `output/include/glad/glad.h` and -`output/include/KHR/khrplatform.h` files to your build. Then you need to -include the glad header file, which will replace the OpenGL header of your -development environment. By including the glad header before the GLFW header, -it suppresses the development environment's OpenGL or OpenGL ES header. - -@code -#include -#include -@endcode - -Finally you need to initialize glad once you have a suitable current context. - -@code -window = glfwCreateWindow(640, 480, "My Window", NULL, NULL); -if (!window) -{ - ... -} - -glfwMakeContextCurrent(window); - -gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); -@endcode - -Once glad has been loaded, you have access to all OpenGL core and extension -functions supported by both the context you created and the glad loader you -generated and you are ready to start rendering. - -You can specify a minimum required OpenGL or OpenGL ES version with -[context hints](@ref window_hints_ctx). If your needs are more complex, you can -check the actual OpenGL or OpenGL ES version with -[context attributes](@ref window_attribs_ctx), or you can check whether -a specific version is supported by the current context with the -`GLAD_GL_VERSION_x_x` booleans. - -@code -if (GLAD_GL_VERSION_3_2) -{ - // Call OpenGL 3.2+ specific code -} -@endcode - -To check whether a specific extension is supported, use the `GLAD_GL_xxx` -booleans. - -@code -if (GLAD_GL_ARB_debug_output) -{ - // Use GL_ARB_debug_output -} -@endcode - - -@subsection context_glext_manual Loading extensions manually - -__Do not use this technique__ unless it is absolutely necessary. An -[extension loader library](@ref context_glext_auto) will save you a ton of -tedious, repetitive, error prone work. - -To use a certain extension, you must first check whether the context supports -that extension and then, if it introduces new functions, retrieve the pointers -to those functions. GLFW provides @ref glfwExtensionSupported and @ref -glfwGetProcAddress for manual loading of extensions and new API functions. - -This section will demonstrate manual loading of OpenGL extensions. The loading -of OpenGL ES extensions is identical except for the name of the extension header. - - -@subsubsection context_glext_header The glext.h header - -The `glext.h` extension header is a continually updated file that defines the -interfaces for all OpenGL extensions. The latest version of this can always be -found at the [OpenGL Registry](https://www.opengl.org/registry/). There are also -extension headers for the various versions of OpenGL ES at the -[OpenGL ES Registry](https://www.khronos.org/registry/gles/). It it strongly -recommended that you use your own copy of the extension header, as the one -included in your development environment may be several years out of date and -may not include the extensions you wish to use. - -The header defines function pointer types for all functions of all extensions it -supports. These have names like `PFNGLGETDEBUGMESSAGELOGARBPROC` (for -`glGetDebugMessageLogARB`), i.e. the name is made uppercase and `PFN` (pointer -to function) and `PROC` (procedure) are added to the ends. - -To include the extension header, define @ref GLFW_INCLUDE_GLEXT before including -the GLFW header. - -@code -#define GLFW_INCLUDE_GLEXT -#include -@endcode - - -@subsubsection context_glext_string Checking for extensions - -A given machine may not actually support the extension (it may have older -drivers or a graphics card that lacks the necessary hardware features), so it -is necessary to check at run-time whether the context supports the extension. -This is done with @ref glfwExtensionSupported. - -@code -if (glfwExtensionSupported("GL_ARB_debug_output")) -{ - // The extension is supported by the current context -} -@endcode - -The argument is a null terminated ASCII string with the extension name. If the -extension is supported, @ref glfwExtensionSupported returns `GLFW_TRUE`, -otherwise it returns `GLFW_FALSE`. - - -@subsubsection context_glext_proc Fetching function pointers - -Many extensions, though not all, require the use of new OpenGL functions. -These functions often do not have entry points in the client API libraries of -your operating system, making it necessary to fetch them at run time. You can -retrieve pointers to these functions with @ref glfwGetProcAddress. - -@code -PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog = glfwGetProcAddress("glGetDebugMessageLogARB"); -@endcode - -In general, you should avoid giving the function pointer variables the (exact) -same name as the function, as this may confuse your linker. Instead, you can -use a different prefix, like above, or some other naming scheme. - -Now that all the pieces have been introduced, here is what they might look like -when used together. - -@code -#define GLFW_INCLUDE_GLEXT -#include - -#define glGetDebugMessageLogARB pfnGetDebugMessageLog -PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog; - -// Flag indicating whether the extension is supported -int has_ARB_debug_output = 0; - -void load_extensions(void) -{ - if (glfwExtensionSupported("GL_ARB_debug_output")) - { - pfnGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGARBPROC) - glfwGetProcAddress("glGetDebugMessageLogARB"); - has_ARB_debug_output = 1; - } -} - -void some_function(void) -{ - if (has_ARB_debug_output) - { - // Now the extension function can be called as usual - glGetDebugMessageLogARB(...); - } -} -@endcode - -*/ diff --git a/third_party/penumbra/vendor/glfw/docs/extra.css b/third_party/penumbra/vendor/glfw/docs/extra.css deleted file mode 100644 index 03a7f259a9a..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/extra.css +++ /dev/null @@ -1 +0,0 @@ -.sm-dox,.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted,.sm-dox ul a:hover{background:none;text-shadow:none}.sm-dox a span.sub-arrow{border-color:#f2f2f2 transparent transparent transparent}.sm-dox a span.sub-arrow:active,.sm-dox a span.sub-arrow:focus,.sm-dox a span.sub-arrow:hover,.sm-dox a:hover span.sub-arrow{border-color:#f60 transparent transparent transparent}.sm-dox ul a span.sub-arrow:active,.sm-dox ul a span.sub-arrow:focus,.sm-dox ul a span.sub-arrow:hover,.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent #f60}.sm-dox ul a:hover{background:#666;text-shadow:none}.sm-dox ul.sm-nowrap a{color:#4d4d4d;text-shadow:none}#main-nav,#main-menu,#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.memdoc,dl.reflist dd,div.toc li,.ah,span.lineno,span.lineno a,span.lineno a:hover,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,.doxtable code,.markdownTable code{background:none}#titlearea,.footer,.contents,div.header,.memdoc,table.doxtable td,table.doxtable th,table.markdownTable td,table.markdownTable th,hr,.memSeparator{border:none}#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.reflist dt a.el,.levels span,.directory .levels span{text-shadow:none}.memdoc,dl.reflist dd{box-shadow:none}div.headertitle,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,table.doxtable code,table.markdownTable code{padding:0}#nav-path,.directory .levels,span.lineno{display:none}html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),tr.markdownTableBody:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code,.markdownTableRowEven{background:#f2f2f2}body{color:#4d4d4d}h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em{color:#1a1a1a;border-bottom:none}h1{padding-top:0.5em;font-size:180%}h2{padding-top:0.5em;margin-bottom:0;font-size:140%}h3{padding-top:0.5em;margin-bottom:0;font-size:110%}.glfwheader{font-size:16px;height:64px;max-width:920px;min-width:800px;padding:0 32px;margin:0 auto}#glfwhome{line-height:64px;padding-right:48px;color:#666;font-size:2.5em;background:url("https://www.glfw.org/css/arrow.png") no-repeat right}.glfwnavbar{list-style-type:none;margin:0 auto;float:right}#glfwhome,.glfwnavbar li{float:left}.glfwnavbar a,.glfwnavbar a:visited{line-height:64px;margin-left:2em;display:block;color:#666}#glfwhome,.glfwnavbar a,.glfwnavbar a:visited{transition:.35s ease}#titlearea,.footer{color:#666}address.footer{text-align:center;padding:2em;margin-top:3em}#top{background:#666}#main-nav{max-width:960px;min-width:800px;margin:0 auto;font-size:13px}#main-menu{max-width:920px;min-width:800px;margin:0 auto;font-size:13px}.memtitle{display:none}.memproto,.memname{font-weight:bold;text-shadow:none}#main-menu{height:36px;display:block;position:relative}#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li{color:#f2f2f2}#main-menu li ul.sm-nowrap li a{color:#4d4d4d}#main-menu li ul.sm-nowrap li a:hover{color:#f60}.contents{min-height:590px}div.contents,div.header{max-width:920px;margin:0 auto;padding:0 32px;background:#fff none}table.doxtable th,table.markdownTable th,dl.reflist dt{background:linear-gradient(to bottom, #ffa733 0, #f60 100%);box-shadow:inset 0 0 32px #f60;text-shadow:0 -1px 1px #b34700;text-align:left;color:#fff}dl.reflist dt a.el{color:#f60;padding:.2em;border-radius:4px;background-color:#ffe0cc}div.toc{float:none;width:auto}div.toc h3{font-size:1.17em}div.toc ul{padding-left:1.5em}div.toc li{font-size:1em;padding-left:0;list-style-type:disc}div.toc,.memproto,div.qindex,div.ah{background:linear-gradient(to bottom, #f2f2f2 0, #e6e6e6 100%);box-shadow:inset 0 0 32px #e6e6e6;text-shadow:0 1px 1px #fff;color:#1a1a1a;border:2px solid #e6e6e6;border-radius:4px}.paramname{color:#803300}dl.reflist dt{border:2px solid #f60;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom:none}dl.reflist dd{border:2px solid #f60;border-bottom-right-radius:4px;border-bottom-left-radius:4px;border-top:none}table.doxtable,table.markdownTable{border-collapse:inherit;border-spacing:0;border:2px solid #f60;border-radius:4px}a,a:hover,a:visited,a:visited:hover,.contents a:visited,.el,a.el:visited,#glfwhome:hover,#main-menu a:hover,span.lineno a:hover{color:#f60;text-decoration:none}div.directory{border-collapse:inherit;border-spacing:0;border:2px solid #f60;border-radius:4px}hr,.memSeparator{height:2px;background:linear-gradient(to right, #f2f2f2 0, #d9d9d9 50%, #f2f2f2 100%)}dl.note,dl.pre,dl.post,dl.invariant{background:linear-gradient(to bottom, #ddfad1 0, #cbf7ba 100%);box-shadow:inset 0 0 32px #baf5a3;color:#1e5309;border:2px solid #afe599}dl.warning,dl.attention{background:linear-gradient(to bottom, #fae8d1 0, #f7ddba 100%);box-shadow:inset 0 0 32px #f5d1a3;color:#533309;border:2px solid #e5c499}dl.deprecated,dl.bug{background:linear-gradient(to bottom, #fad1e3 0, #f7bad6 100%);box-shadow:inset 0 0 32px #f5a3c8;color:#53092a;border:2px solid #e599bb}dl.todo,dl.test{background:linear-gradient(to bottom, #d1ecfa 0, #bae3f7 100%);box-shadow:inset 0 0 32px #a3daf5;color:#093a53;border:2px solid #99cce5}dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test{border-radius:4px;padding:1em;text-shadow:0 1px 1px #fff;margin:1em 0}.note a,.pre a,.post a,.invariant a,.warning a,.attention a,.deprecated a,.bug a,.todo a,.test a,.note a:visited,.pre a:visited,.post a:visited,.invariant a:visited,.warning a:visited,.attention a:visited,.deprecated a:visited,.bug a:visited,.todo a:visited,.test a:visited{color:inherit}div.line{line-height:inherit}div.fragment,pre.fragment{background:#f2f2f2;border-radius:4px;border:none;padding:1em;overflow:auto;border-left:4px solid #ccc;margin:1em 0}.lineno a,.lineno a:visited,.line,pre.fragment{color:#4d4d4d}span.preprocessor,span.comment{color:#007899}a.code,a.code:visited{color:#e64500}span.keyword,span.keywordtype,span.keywordflow{color:#404040;font-weight:bold}span.stringliteral{color:#360099}code{padding:.1em;border-radius:4px} diff --git a/third_party/penumbra/vendor/glfw/docs/extra.less b/third_party/penumbra/vendor/glfw/docs/extra.less deleted file mode 100644 index 6d82b346c6f..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/extra.less +++ /dev/null @@ -1,414 +0,0 @@ -// NOTE: Please use this file to perform modifications on default style sheets. -// -// You need to install a few Ruby gems to generate extra.css from this file: -// gem install less therubyracer -// -// Run this command to regenerate extra.css after you're finished with changes: -// lessc --compress extra.less > extra.css -// -// Alternatively you can use online services to regenerate extra.css. - - -// Default text color for page contents -@default-text-color: hsl(0,0%,30%); - -// Page header, footer, table rows, inline codes and definition lists -@header-footer-background-color: hsl(0,0%,95%); - -// Page header, footer links and navigation bar background -@header-footer-link-color: hsl(0,0%,40%); - -// Doxygen navigation bar links -@navbar-link-color: @header-footer-background-color; - -// Page content background color -@content-background-color: hsl(0,0%,100%); - -// Bold, italic, h1, h2, ... and table of contents -@heading-color: hsl(0,0%,10%); - -// Function, enum and macro definition separator -@def-separator-color: @header-footer-background-color; - -// Base color hue -@base-hue: 24; - -// Default color used for links -@default-link-color: hsl(@base-hue,100%,50%); - -// Doxygen navigation bar active tab -@tab-text-color: hsl(0,0%,100%); -@tab-background-color1: @default-link-color; -@tab-background-color2: lighten(spin(@tab-background-color1, 10), 10%); - -// Table borders -@default-border-color: @default-link-color; - -// Table header -@table-text-color: @tab-text-color; -@table-background-color1: @tab-background-color1; -@table-background-color2: @tab-background-color2; - -// Table of contents, data structure index and prototypes -@toc-background-color1: hsl(0,0%,90%); -@toc-background-color2: lighten(@toc-background-color1, 5%); - -// Function prototype parameters color -@prototype-param-color: darken(@default-link-color, 25%); - -// Message box color: note, pre, post and invariant -@box-note-color: hsl(103,80%,85%); - -// Message box color: warning and attention -@box-warning-color: hsl(34,80%,85%); - -// Message box color: deprecated and bug -@box-bug-color: hsl(333,80%,85%); - -// Message box color: todo and test -@box-todo-color: hsl(200,80%,85%); - -// Message box helper function -.message-box(@base-color) { - background:linear-gradient(to bottom,lighten(@base-color, 5%) 0%,@base-color 100%); - box-shadow:inset 0 0 32px darken(@base-color, 5%); - color:darken(@base-color, 67%); - border:2px solid desaturate(darken(@base-color, 10%), 20%); -} - -.sm-dox,.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted,.sm-dox ul a:hover { - background:none; - text-shadow:none; -} - -.sm-dox a span.sub-arrow { - border-color:@navbar-link-color transparent transparent transparent; -} - -.sm-dox a span.sub-arrow:active,.sm-dox a span.sub-arrow:focus,.sm-dox a span.sub-arrow:hover,.sm-dox a:hover span.sub-arrow { - border-color:@default-link-color transparent transparent transparent; -} - -.sm-dox ul a span.sub-arrow:active,.sm-dox ul a span.sub-arrow:focus,.sm-dox ul a span.sub-arrow:hover,.sm-dox ul a:hover span.sub-arrow { - border-color:transparent transparent transparent @default-link-color; -} - -.sm-dox ul a:hover { - background:@header-footer-link-color; - text-shadow:none; -} - -.sm-dox ul.sm-nowrap a { - color:@default-text-color; - text-shadow:none; -} - -#main-nav,#main-menu,#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.memdoc,dl.reflist dd,div.toc li,.ah,span.lineno,span.lineno a,span.lineno a:hover,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,.doxtable code,.markdownTable code { - background:none; -} - -#titlearea,.footer,.contents,div.header,.memdoc,table.doxtable td,table.doxtable th,table.markdownTable td,table.markdownTable th,hr,.memSeparator { - border:none; -} - -#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.reflist dt a.el,.levels span,.directory .levels span { - text-shadow:none; -} - -.memdoc,dl.reflist dd { - box-shadow:none; -} - -div.headertitle,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,table.doxtable code,table.markdownTable code { - padding:0; -} - -#nav-path,.directory .levels,span.lineno { - display:none; -} - -html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),tr.markdownTableBody:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code,.markdownTableRowEven { - background:@header-footer-background-color; -} - -body { - color:@default-text-color; -} - -h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em { - color:@heading-color; - border-bottom:none; -} - -h1 { - padding-top:0.5em; - font-size:180%; -} - -h2 { - padding-top:0.5em; - margin-bottom:0; - font-size:140%; -} - -h3 { - padding-top:0.5em; - margin-bottom:0; - font-size:110%; -} - -.glfwheader { - font-size:16px; - height:64px; - max-width:920px; - min-width:800px; - padding:0 32px; - margin:0 auto; -} - -#glfwhome { - line-height:64px; - padding-right:48px; - color:@header-footer-link-color; - font-size:2.5em; - background:url("https://www.glfw.org/css/arrow.png") no-repeat right; -} - -.glfwnavbar { - list-style-type:none; - margin:0 auto; - float:right; -} - -#glfwhome,.glfwnavbar li { - float:left; -} - -.glfwnavbar a,.glfwnavbar a:visited { - line-height:64px; - margin-left:2em; - display:block; - color:@header-footer-link-color; -} - -#glfwhome,.glfwnavbar a,.glfwnavbar a:visited { - transition:.35s ease; -} - -#titlearea,.footer { - color:@header-footer-link-color; -} - -address.footer { - text-align:center; - padding:2em; - margin-top:3em; -} - -#top { - background:@header-footer-link-color; -} - -#main-nav { - max-width:960px; - min-width:800px; - margin:0 auto; - font-size:13px; -} - -#main-menu { - max-width:920px; - min-width:800px; - margin:0 auto; - font-size:13px; -} - -.memtitle { - display:none; -} - -.memproto,.memname { - font-weight:bold; - text-shadow:none; -} - -#main-menu { - height:36px; - display:block; - position:relative; -} - -#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li { - color:@navbar-link-color; -} - -#main-menu li ul.sm-nowrap li a { - color:@default-text-color; -} - -#main-menu li ul.sm-nowrap li a:hover { - color:@default-link-color; -} - -.contents { - min-height:590px; -} - -div.contents,div.header { - max-width:920px; - margin:0 auto; - padding:0 32px; - background:@content-background-color none; -} - -table.doxtable th,table.markdownTable th,dl.reflist dt { - background:linear-gradient(to bottom,@table-background-color2 0%,@table-background-color1 100%); - box-shadow:inset 0 0 32px @table-background-color1; - text-shadow:0 -1px 1px darken(@table-background-color1, 15%); - text-align:left; - color:@table-text-color; -} - -dl.reflist dt a.el { - color:@default-link-color; - padding:.2em; - border-radius:4px; - background-color:lighten(@default-link-color, 40%); -} - -div.toc { - float:none; - width:auto; -} - -div.toc h3 { - font-size:1.17em; -} - -div.toc ul { - padding-left:1.5em; -} - -div.toc li { - font-size:1em; - padding-left:0; - list-style-type:disc; -} - -div.toc,.memproto,div.qindex,div.ah { - background:linear-gradient(to bottom,@toc-background-color2 0%,@toc-background-color1 100%); - box-shadow:inset 0 0 32px @toc-background-color1; - text-shadow:0 1px 1px lighten(@toc-background-color2, 10%); - color:@heading-color; - border:2px solid @toc-background-color1; - border-radius:4px; -} - -.paramname { - color:@prototype-param-color; -} - -dl.reflist dt { - border:2px solid @default-border-color; - border-top-left-radius:4px; - border-top-right-radius:4px; - border-bottom:none; -} - -dl.reflist dd { - border:2px solid @default-border-color; - border-bottom-right-radius:4px; - border-bottom-left-radius:4px; - border-top:none; -} - -table.doxtable,table.markdownTable { - border-collapse:inherit; - border-spacing:0; - border:2px solid @default-border-color; - border-radius:4px; -} - -a,a:hover,a:visited,a:visited:hover,.contents a:visited,.el,a.el:visited,#glfwhome:hover,#main-menu a:hover,span.lineno a:hover { - color:@default-link-color; - text-decoration:none; -} - -div.directory { - border-collapse:inherit; - border-spacing:0; - border:2px solid @default-border-color; - border-radius:4px; -} - -hr,.memSeparator { - height:2px; - background:linear-gradient(to right,@def-separator-color 0%,darken(@def-separator-color, 10%) 50%,@def-separator-color 100%); -} - -dl.note,dl.pre,dl.post,dl.invariant { - .message-box(@box-note-color); -} - -dl.warning,dl.attention { - .message-box(@box-warning-color); -} - -dl.deprecated,dl.bug { - .message-box(@box-bug-color); -} - -dl.todo,dl.test { - .message-box(@box-todo-color); -} - -dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test { - border-radius:4px; - padding:1em; - text-shadow:0 1px 1px hsl(0,0%,100%); - margin:1em 0; -} - -.note a,.pre a,.post a,.invariant a,.warning a,.attention a,.deprecated a,.bug a,.todo a,.test a,.note a:visited,.pre a:visited,.post a:visited,.invariant a:visited,.warning a:visited,.attention a:visited,.deprecated a:visited,.bug a:visited,.todo a:visited,.test a:visited { - color:inherit; -} - -div.line { - line-height:inherit; -} - -div.fragment,pre.fragment { - background:hsl(0,0%,95%); - border-radius:4px; - border:none; - padding:1em; - overflow:auto; - border-left:4px solid hsl(0,0%,80%); - margin:1em 0; -} - -.lineno a,.lineno a:visited,.line,pre.fragment { - color:@default-text-color; -} - -span.preprocessor,span.comment { - color:hsl(193,100%,30%); -} - -a.code,a.code:visited { - color:hsl(18,100%,45%); -} - -span.keyword,span.keywordtype,span.keywordflow { - color:darken(@default-text-color, 5%); - font-weight:bold; -} - -span.stringliteral { - color:hsl(261,100%,30%); -} - -code { - padding:.1em; - border-radius:4px; -} diff --git a/third_party/penumbra/vendor/glfw/docs/footer.html b/third_party/penumbra/vendor/glfw/docs/footer.html deleted file mode 100644 index b0434ca1839..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/footer.html +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/third_party/penumbra/vendor/glfw/docs/header.html b/third_party/penumbra/vendor/glfw/docs/header.html deleted file mode 100644 index f42f49ee4e5..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/header.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - -$projectname: $title -$title - - - -$treeview -$search -$mathjax - -$extrastylesheet - - -
- - - - - diff --git a/third_party/penumbra/vendor/glfw/docs/input.dox b/third_party/penumbra/vendor/glfw/docs/input.dox deleted file mode 100644 index dea64877491..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/input.dox +++ /dev/null @@ -1,945 +0,0 @@ -/*! - -@page input_guide Input guide - -@tableofcontents - -This guide introduces the input related functions of GLFW. For details on -a specific function in this category, see the @ref input. There are also guides -for the other areas of GLFW. - - - @ref intro_guide - - @ref window_guide - - @ref context_guide - - @ref vulkan_guide - - @ref monitor_guide - -GLFW provides many kinds of input. While some can only be polled, like time, or -only received via callbacks, like scrolling, many provide both callbacks and -polling. Callbacks are more work to use than polling but is less CPU intensive -and guarantees that you do not miss state changes. - -All input callbacks receive a window handle. By using the -[window user pointer](@ref window_userptr), you can access non-global structures -or objects from your callbacks. - -To get a better feel for how the various events callbacks behave, run the -`events` test program. It register every callback supported by GLFW and prints -out all arguments provided for every event, along with time and sequence -information. - - -@section events Event processing - -GLFW needs to poll the window system for events both to provide input to the -application and to prove to the window system that the application hasn't locked -up. Event processing is normally done each frame after -[buffer swapping](@ref buffer_swap). Even when you have no windows, event -polling needs to be done in order to receive monitor and joystick connection -events. - -There are three functions for processing pending events. @ref glfwPollEvents, -processes only those events that have already been received and then returns -immediately. - -@code -glfwPollEvents(); -@endcode - -This is the best choice when rendering continuously, like most games do. - -If you only need to update the contents of the window when you receive new -input, @ref glfwWaitEvents is a better choice. - -@code -glfwWaitEvents(); -@endcode - -It puts the thread to sleep until at least one event has been received and then -processes all received events. This saves a great deal of CPU cycles and is -useful for, for example, editing tools. - -If you want to wait for events but have UI elements or other tasks that need -periodic updates, @ref glfwWaitEventsTimeout lets you specify a timeout. - -@code -glfwWaitEventsTimeout(0.7); -@endcode - -It puts the thread to sleep until at least one event has been received, or until -the specified number of seconds have elapsed. It then processes any received -events. - -If the main thread is sleeping in @ref glfwWaitEvents, you can wake it from -another thread by posting an empty event to the event queue with @ref -glfwPostEmptyEvent. - -@code -glfwPostEmptyEvent(); -@endcode - -Do not assume that callbacks will _only_ be called in response to the above -functions. While it is necessary to process events in one or more of the ways -above, window systems that require GLFW to register callbacks of its own can -pass events to GLFW in response to many window system function calls. GLFW will -pass those events on to the application callbacks before returning. - -For example, on Windows the system function that @ref glfwSetWindowSize is -implemented with will send window size events directly to the event callback -that every window has and that GLFW implements for its windows. If you have set -a [window size callback](@ref window_size) GLFW will call it in turn with the -new size before everything returns back out of the @ref glfwSetWindowSize call. - - -@section input_keyboard Keyboard input - -GLFW divides keyboard input into two categories; key events and character -events. Key events relate to actual physical keyboard keys, whereas character -events relate to the Unicode code points generated by pressing some of them. - -Keys and characters do not map 1:1. A single key press may produce several -characters, and a single character may require several keys to produce. This -may not be the case on your machine, but your users are likely not all using the -same keyboard layout, input method or even operating system as you. - - -@subsection input_key Key input - -If you wish to be notified when a physical key is pressed or released or when it -repeats, set a key callback. - -@code -glfwSetKeyCallback(window, key_callback); -@endcode - -The callback function receives the [keyboard key](@ref keys), platform-specific -scancode, key action and [modifier bits](@ref mods). - -@code -void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (key == GLFW_KEY_E && action == GLFW_PRESS) - activate_airship(); -} -@endcode - -The action is one of `GLFW_PRESS`, `GLFW_REPEAT` or `GLFW_RELEASE`. The key -will be `GLFW_KEY_UNKNOWN` if GLFW lacks a key token for it, for example -_E-mail_ and _Play_ keys. - -The scancode is unique for every key, regardless of whether it has a key token. -Scancodes are platform-specific but consistent over time, so keys will have -different scancodes depending on the platform but they are safe to save to disk. -You can query the scancode for any [named key](@ref keys) on the current -platform with @ref glfwGetKeyScancode. - -@code -const int scancode = glfwGetKeyScancode(GLFW_KEY_X); -set_key_mapping(scancode, swap_weapons); -@endcode - -The last reported state for every [named key](@ref keys) is also saved in -per-window state arrays that can be polled with @ref glfwGetKey. - -@code -int state = glfwGetKey(window, GLFW_KEY_E); -if (state == GLFW_PRESS) -{ - activate_airship(); -} -@endcode - -The returned state is one of `GLFW_PRESS` or `GLFW_RELEASE`. - -This function only returns cached key event state. It does not poll the -system for the current physical state of the key. - -@anchor GLFW_STICKY_KEYS -Whenever you poll state, you risk missing the state change you are looking for. -If a pressed key is released again before you poll its state, you will have -missed the key press. The recommended solution for this is to use a -key callback, but there is also the `GLFW_STICKY_KEYS` input mode. - -@code -glfwSetInputMode(window, GLFW_STICKY_KEYS, GLFW_TRUE); -@endcode - -When sticky keys mode is enabled, the pollable state of a key will remain -`GLFW_PRESS` until the state of that key is polled with @ref glfwGetKey. Once -it has been polled, if a key release event had been processed in the meantime, -the state will reset to `GLFW_RELEASE`, otherwise it will remain `GLFW_PRESS`. - -@anchor GLFW_LOCK_KEY_MODS -If you wish to know what the state of the Caps Lock and Num Lock keys was when -input events were generated, set the `GLFW_LOCK_KEY_MODS` input mode. - -@code -glfwSetInputMode(window, GLFW_LOCK_KEY_MODS, GLFW_TRUE); -@endcode - -When this input mode is enabled, any callback that receives -[modifier bits](@ref mods) will have the @ref GLFW_MOD_CAPS_LOCK bit set if Caps -Lock was on when the event occurred and the @ref GLFW_MOD_NUM_LOCK bit set if -Num Lock was on. - -The `GLFW_KEY_LAST` constant holds the highest value of any -[named key](@ref keys). - - -@subsection input_char Text input - -GLFW supports text input in the form of a stream of -[Unicode code points](https://en.wikipedia.org/wiki/Unicode), as produced by the -operating system text input system. Unlike key input, text input obeys keyboard -layouts and modifier keys and supports composing characters using -[dead keys](https://en.wikipedia.org/wiki/Dead_key). Once received, you can -encode the code points into UTF-8 or any other encoding you prefer. - -Because an `unsigned int` is 32 bits long on all platforms supported by GLFW, -you can treat the code point argument as native endian UTF-32. - -If you wish to offer regular text input, set a character callback. - -@code -glfwSetCharCallback(window, character_callback); -@endcode - -The callback function receives Unicode code points for key events that would -have led to regular text input and generally behaves as a standard text field on -that platform. - -@code -void character_callback(GLFWwindow* window, unsigned int codepoint) -{ -} -@endcode - - -@subsection input_key_name Key names - -If you wish to refer to keys by name, you can query the keyboard layout -dependent name of printable keys with @ref glfwGetKeyName. - -@code -const char* key_name = glfwGetKeyName(GLFW_KEY_W, 0); -show_tutorial_hint("Press %s to move forward", key_name); -@endcode - -This function can handle both [keys and scancodes](@ref input_key). If the -specified key is `GLFW_KEY_UNKNOWN` then the scancode is used, otherwise it is -ignored. This matches the behavior of the key callback, meaning the callback -arguments can always be passed unmodified to this function. - - -@section input_mouse Mouse input - -Mouse input comes in many forms, including mouse motion, button presses and -scrolling offsets. The cursor appearance can also be changed, either to -a custom image or a standard cursor shape from the system theme. - - -@subsection cursor_pos Cursor position - -If you wish to be notified when the cursor moves over the window, set a cursor -position callback. - -@code -glfwSetCursorPosCallback(window, cursor_position_callback); -@endcode - -The callback functions receives the cursor position, measured in screen -coordinates but relative to the top-left corner of the window content area. On -platforms that provide it, the full sub-pixel cursor position is passed on. - -@code -static void cursor_position_callback(GLFWwindow* window, double xpos, double ypos) -{ -} -@endcode - -The cursor position is also saved per-window and can be polled with @ref -glfwGetCursorPos. - -@code -double xpos, ypos; -glfwGetCursorPos(window, &xpos, &ypos); -@endcode - - -@subsection cursor_mode Cursor mode - -@anchor GLFW_CURSOR -The `GLFW_CURSOR` input mode provides several cursor modes for special forms of -mouse motion input. By default, the cursor mode is `GLFW_CURSOR_NORMAL`, -meaning the regular arrow cursor (or another cursor set with @ref glfwSetCursor) -is used and cursor motion is not limited. - -If you wish to implement mouse motion based camera controls or other input -schemes that require unlimited mouse movement, set the cursor mode to -`GLFW_CURSOR_DISABLED`. - -@code -glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); -@endcode - -This will hide the cursor and lock it to the specified window. GLFW will then -take care of all the details of cursor re-centering and offset calculation and -providing the application with a virtual cursor position. This virtual position -is provided normally via both the cursor position callback and through polling. - -@note You should not implement your own version of this functionality using -other features of GLFW. It is not supported and will not work as robustly as -`GLFW_CURSOR_DISABLED`. - -If you only wish the cursor to become hidden when it is over a window but still -want it to behave normally, set the cursor mode to `GLFW_CURSOR_HIDDEN`. - -@code -glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); -@endcode - -This mode puts no limit on the motion of the cursor. - -To exit out of either of these special modes, restore the `GLFW_CURSOR_NORMAL` -cursor mode. - -@code -glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); -@endcode - - -@anchor GLFW_RAW_MOUSE_MOTION -@subsection raw_mouse_motion Raw mouse motion - -When the cursor is disabled, raw (unscaled and unaccelerated) mouse motion can -be enabled if available. - -Raw mouse motion is closer to the actual motion of the mouse across a surface. -It is not affected by the scaling and acceleration applied to the motion of the -desktop cursor. That processing is suitable for a cursor while raw motion is -better for controlling for example a 3D camera. Because of this, raw mouse -motion is only provided when the cursor is disabled. - -Call @ref glfwRawMouseMotionSupported to check if the current machine provides -raw motion and set the `GLFW_RAW_MOUSE_MOTION` input mode to enable it. It is -disabled by default. - -@code -if (glfwRawMouseMotionSupported()) - glfwSetInputMode(window, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE); -@endcode - -If supported, raw mouse motion can be enabled or disabled per-window and at any -time but it will only be provided when the cursor is disabled. - - -@subsection cursor_object Cursor objects - -GLFW supports creating both custom and system theme cursor images, encapsulated -as @ref GLFWcursor objects. They are created with @ref glfwCreateCursor or @ref -glfwCreateStandardCursor and destroyed with @ref glfwDestroyCursor, or @ref -glfwTerminate, if any remain. - - -@subsubsection cursor_custom Custom cursor creation - -A custom cursor is created with @ref glfwCreateCursor, which returns a handle to -the created cursor object. For example, this creates a 16x16 white square -cursor with the hot-spot in the upper-left corner: - -@code -unsigned char pixels[16 * 16 * 4]; -memset(pixels, 0xff, sizeof(pixels)); - -GLFWimage image; -image.width = 16; -image.height = 16; -image.pixels = pixels; - -GLFWcursor* cursor = glfwCreateCursor(&image, 0, 0); -@endcode - -If cursor creation fails, `NULL` will be returned, so it is necessary to check -the return value. - -The image data is 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits -per channel with the red channel first. The pixels are arranged canonically as -sequential rows, starting from the top-left corner. - - -@subsubsection cursor_standard Standard cursor creation - -A cursor with a [standard shape](@ref shapes) from the current system cursor -theme can be can be created with @ref glfwCreateStandardCursor. - -@code -GLFWcursor* cursor = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR); -@endcode - -These cursor objects behave in the exact same way as those created with @ref -glfwCreateCursor except that the system cursor theme provides the actual image. - - -@subsubsection cursor_destruction Cursor destruction - -When a cursor is no longer needed, destroy it with @ref glfwDestroyCursor. - -@code -glfwDestroyCursor(cursor); -@endcode - -Cursor destruction always succeeds. If the cursor is current for any window, -that window will revert to the default cursor. This does not affect the cursor -mode. All remaining cursors are destroyed when @ref glfwTerminate is called. - - -@subsubsection cursor_set Cursor setting - -A cursor can be set as current for a window with @ref glfwSetCursor. - -@code -glfwSetCursor(window, cursor); -@endcode - -Once set, the cursor image will be used as long as the system cursor is over the -content area of the window and the [cursor mode](@ref cursor_mode) is set -to `GLFW_CURSOR_NORMAL`. - -A single cursor may be set for any number of windows. - -To revert to the default cursor, set the cursor of that window to `NULL`. - -@code -glfwSetCursor(window, NULL); -@endcode - -When a cursor is destroyed, any window that has it set will revert to the -default cursor. This does not affect the cursor mode. - - -@subsection cursor_enter Cursor enter/leave events - -If you wish to be notified when the cursor enters or leaves the content area of -a window, set a cursor enter/leave callback. - -@code -glfwSetCursorEnterCallback(window, cursor_enter_callback); -@endcode - -The callback function receives the new classification of the cursor. - -@code -void cursor_enter_callback(GLFWwindow* window, int entered) -{ - if (entered) - { - // The cursor entered the content area of the window - } - else - { - // The cursor left the content area of the window - } -} -@endcode - -You can query whether the cursor is currently inside the content area of the -window with the [GLFW_HOVERED](@ref GLFW_HOVERED_attrib) window attribute. - -@code -if (glfwGetWindowAttrib(window, GLFW_HOVERED)) -{ - highlight_interface(); -} -@endcode - - -@subsection input_mouse_button Mouse button input - -If you wish to be notified when a mouse button is pressed or released, set -a mouse button callback. - -@code -glfwSetMouseButtonCallback(window, mouse_button_callback); -@endcode - -The callback function receives the [mouse button](@ref buttons), button action -and [modifier bits](@ref mods). - -@code -void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) -{ - if (button == GLFW_MOUSE_BUTTON_RIGHT && action == GLFW_PRESS) - popup_menu(); -} -@endcode - -The action is one of `GLFW_PRESS` or `GLFW_RELEASE`. - -Mouse button states for [named buttons](@ref buttons) are also saved in -per-window state arrays that can be polled with @ref glfwGetMouseButton. - -@code -int state = glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT); -if (state == GLFW_PRESS) -{ - upgrade_cow(); -} -@endcode - -The returned state is one of `GLFW_PRESS` or `GLFW_RELEASE`. - -This function only returns cached mouse button event state. It does not poll -the system for the current state of the mouse button. - -@anchor GLFW_STICKY_MOUSE_BUTTONS -Whenever you poll state, you risk missing the state change you are looking for. -If a pressed mouse button is released again before you poll its state, you will have -missed the button press. The recommended solution for this is to use a -mouse button callback, but there is also the `GLFW_STICKY_MOUSE_BUTTONS` -input mode. - -@code -glfwSetInputMode(window, GLFW_STICKY_MOUSE_BUTTONS, GLFW_TRUE); -@endcode - -When sticky mouse buttons mode is enabled, the pollable state of a mouse button -will remain `GLFW_PRESS` until the state of that button is polled with @ref -glfwGetMouseButton. Once it has been polled, if a mouse button release event -had been processed in the meantime, the state will reset to `GLFW_RELEASE`, -otherwise it will remain `GLFW_PRESS`. - -The `GLFW_MOUSE_BUTTON_LAST` constant holds the highest value of any -[named button](@ref buttons). - - -@subsection scrolling Scroll input - -If you wish to be notified when the user scrolls, whether with a mouse wheel or -touchpad gesture, set a scroll callback. - -@code -glfwSetScrollCallback(window, scroll_callback); -@endcode - -The callback function receives two-dimensional scroll offsets. - -@code -void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) -{ -} -@endcode - -A normal mouse wheel, being vertical, provides offsets along the Y-axis. - - -@section joystick Joystick input - -The joystick functions expose connected joysticks and controllers, with both -referred to as joysticks. It supports up to sixteen joysticks, ranging from -`GLFW_JOYSTICK_1`, `GLFW_JOYSTICK_2` up to and including `GLFW_JOYSTICK_16` or -`GLFW_JOYSTICK_LAST`. You can test whether a [joystick](@ref joysticks) is -present with @ref glfwJoystickPresent. - -@code -int present = glfwJoystickPresent(GLFW_JOYSTICK_1); -@endcode - -Each joystick has zero or more axes, zero or more buttons, zero or more hats, -a human-readable name, a user pointer and an SDL compatible GUID. - -When GLFW is initialized, detected joysticks are added to the beginning of -the array. Once a joystick is detected, it keeps its assigned ID until it is -disconnected or the library is terminated, so as joysticks are connected and -disconnected, there may appear gaps in the IDs. - -Joystick axis, button and hat state is updated when polled and does not require -a window to be created or events to be processed. However, if you want joystick -connection and disconnection events reliably delivered to the -[joystick callback](@ref joystick_event) then you must -[process events](@ref events). - -To see all the properties of all connected joysticks in real-time, run the -`joysticks` test program. - - -@subsection joystick_axis Joystick axis states - -The positions of all axes of a joystick are returned by @ref -glfwGetJoystickAxes. See the reference documentation for the lifetime of the -returned array. - -@code -int count; -const float* axes = glfwGetJoystickAxes(GLFW_JOYSTICK_5, &count); -@endcode - -Each element in the returned array is a value between -1.0 and 1.0. - - -@subsection joystick_button Joystick button states - -The states of all buttons of a joystick are returned by @ref -glfwGetJoystickButtons. See the reference documentation for the lifetime of the -returned array. - -@code -int count; -const unsigned char* buttons = glfwGetJoystickButtons(GLFW_JOYSTICK_3, &count); -@endcode - -Each element in the returned array is either `GLFW_PRESS` or `GLFW_RELEASE`. - -For backward compatibility with earlier versions that did not have @ref -glfwGetJoystickHats, the button array by default also includes all hats. See -the reference documentation for @ref glfwGetJoystickButtons for details. - - -@subsection joystick_hat Joystick hat states - -The states of all hats are returned by @ref glfwGetJoystickHats. See the -reference documentation for the lifetime of the returned array. - -@code -int count; -const unsigned char* hats = glfwGetJoystickHats(GLFW_JOYSTICK_7, &count); -@endcode - -Each element in the returned array is one of the following: - -Name | Value ----- | ----- -`GLFW_HAT_CENTERED` | 0 -`GLFW_HAT_UP` | 1 -`GLFW_HAT_RIGHT` | 2 -`GLFW_HAT_DOWN` | 4 -`GLFW_HAT_LEFT` | 8 -`GLFW_HAT_RIGHT_UP` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_UP` -`GLFW_HAT_RIGHT_DOWN` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_DOWN` -`GLFW_HAT_LEFT_UP` | `GLFW_HAT_LEFT` \| `GLFW_HAT_UP` -`GLFW_HAT_LEFT_DOWN` | `GLFW_HAT_LEFT` \| `GLFW_HAT_DOWN` - -The diagonal directions are bitwise combinations of the primary (up, right, down -and left) directions and you can test for these individually by ANDing it with -the corresponding direction. - -@code -if (hats[2] & GLFW_HAT_RIGHT) -{ - // State of hat 2 could be right-up, right or right-down -} -@endcode - -For backward compatibility with earlier versions that did not have @ref -glfwGetJoystickHats, all hats are by default also included in the button array. -See the reference documentation for @ref glfwGetJoystickButtons for details. - - -@subsection joystick_name Joystick name - -The human-readable, UTF-8 encoded name of a joystick is returned by @ref -glfwGetJoystickName. See the reference documentation for the lifetime of the -returned string. - -@code -const char* name = glfwGetJoystickName(GLFW_JOYSTICK_4); -@endcode - -Joystick names are not guaranteed to be unique. Two joysticks of the same model -and make may have the same name. Only the [joystick token](@ref joysticks) is -guaranteed to be unique, and only until that joystick is disconnected. - - -@subsection joystick_userptr Joystick user pointer - -Each joystick has a user pointer that can be set with @ref -glfwSetJoystickUserPointer and queried with @ref glfwGetJoystickUserPointer. -This can be used for any purpose you need and will not be modified by GLFW. The -value will be kept until the joystick is disconnected or until the library is -terminated. - -The initial value of the pointer is `NULL`. - - -@subsection joystick_event Joystick configuration changes - -If you wish to be notified when a joystick is connected or disconnected, set -a joystick callback. - -@code -glfwSetJoystickCallback(joystick_callback); -@endcode - -The callback function receives the ID of the joystick that has been connected -and disconnected and the event that occurred. - -@code -void joystick_callback(int jid, int event) -{ - if (event == GLFW_CONNECTED) - { - // The joystick was connected - } - else if (event == GLFW_DISCONNECTED) - { - // The joystick was disconnected - } -} -@endcode - -For joystick connection and disconnection events to be delivered on all -platforms, you need to call one of the [event processing](@ref events) -functions. Joystick disconnection may also be detected and the callback -called by joystick functions. The function will then return whatever it -returns for a disconnected joystick. - -Only @ref glfwGetJoystickName and @ref glfwGetJoystickUserPointer will return -useful values for a disconnected joystick and only before the monitor callback -returns. - - -@subsection gamepad Gamepad input - -The joystick functions provide unlabeled axes, buttons and hats, with no -indication of where they are located on the device. Their order may also vary -between platforms even with the same device. - -To solve this problem the SDL community crowdsourced the -[SDL_GameControllerDB](https://github.com/gabomdq/SDL_GameControllerDB) project, -a database of mappings from many different devices to an Xbox-like gamepad. - -GLFW supports this mapping format and contains a copy of the mappings -available at the time of release. See @ref gamepad_mapping for how to update -this at runtime. Mappings will be assigned to joysticks automatically any time -a joystick is connected or the mappings are updated. - -You can check whether a joystick is both present and has a gamepad mapping with -@ref glfwJoystickIsGamepad. - -@code -if (glfwJoystickIsGamepad(GLFW_JOYSTICK_2)) -{ - // Use as gamepad -} -@endcode - -If you are only interested in gamepad input you can use this function instead of -@ref glfwJoystickPresent. - -You can query the human-readable name provided by the gamepad mapping with @ref -glfwGetGamepadName. This may or may not be the same as the -[joystick name](@ref joystick_name). - -@code -const char* name = glfwGetGamepadName(GLFW_JOYSTICK_7); -@endcode - -To retrieve the gamepad state of a joystick, call @ref glfwGetGamepadState. - -@code -GLFWgamepadstate state; - -if (glfwGetGamepadState(GLFW_JOYSTICK_3, &state)) -{ - if (state.buttons[GLFW_GAMEPAD_BUTTON_A]) - { - input_jump(); - } - - input_speed(state.axes[GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER]); -} -@endcode - -The @ref GLFWgamepadstate struct has two arrays; one for button states and one -for axis states. The values for each button and axis are the same as for the -@ref glfwGetJoystickButtons and @ref glfwGetJoystickAxes functions, i.e. -`GLFW_PRESS` or `GLFW_RELEASE` for buttons and -1.0 to 1.0 inclusive for axes. - -The sizes of the arrays and the positions within each array are fixed. - -The [button indices](@ref gamepad_buttons) are `GLFW_GAMEPAD_BUTTON_A`, -`GLFW_GAMEPAD_BUTTON_B`, `GLFW_GAMEPAD_BUTTON_X`, `GLFW_GAMEPAD_BUTTON_Y`, -`GLFW_GAMEPAD_BUTTON_LEFT_BUMPER`, `GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER`, -`GLFW_GAMEPAD_BUTTON_BACK`, `GLFW_GAMEPAD_BUTTON_START`, -`GLFW_GAMEPAD_BUTTON_GUIDE`, `GLFW_GAMEPAD_BUTTON_LEFT_THUMB`, -`GLFW_GAMEPAD_BUTTON_RIGHT_THUMB`, `GLFW_GAMEPAD_BUTTON_DPAD_UP`, -`GLFW_GAMEPAD_BUTTON_DPAD_RIGHT`, `GLFW_GAMEPAD_BUTTON_DPAD_DOWN` and -`GLFW_GAMEPAD_BUTTON_DPAD_LEFT`. - -For those who prefer, there are also the `GLFW_GAMEPAD_BUTTON_CROSS`, -`GLFW_GAMEPAD_BUTTON_CIRCLE`, `GLFW_GAMEPAD_BUTTON_SQUARE` and -`GLFW_GAMEPAD_BUTTON_TRIANGLE` aliases for the A, B, X and Y button indices. - -The [axis indices](@ref gamepad_axes) are `GLFW_GAMEPAD_AXIS_LEFT_X`, -`GLFW_GAMEPAD_AXIS_LEFT_Y`, `GLFW_GAMEPAD_AXIS_RIGHT_X`, -`GLFW_GAMEPAD_AXIS_RIGHT_Y`, `GLFW_GAMEPAD_AXIS_LEFT_TRIGGER` and -`GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER`. - -The `GLFW_GAMEPAD_BUTTON_LAST` and `GLFW_GAMEPAD_AXIS_LAST` constants equal -the largest available index for each array. - - -@subsection gamepad_mapping Gamepad mappings - -GLFW contains a copy of the mappings available in -[SDL_GameControllerDB](https://github.com/gabomdq/SDL_GameControllerDB) at the -time of release. Newer ones can be added at runtime with @ref -glfwUpdateGamepadMappings. - -@code -const char* mappings = load_file_contents("game/data/gamecontrollerdb.txt"); - -glfwUpdateGamepadMappings(mappings); -@endcode - -This function supports everything from single lines up to and including the -unmodified contents of the whole `gamecontrollerdb.txt` file. - -Below is a description of the mapping format. Please keep in mind that __this -description is not authoritative__. The format is defined by the SDL and -SDL_GameControllerDB projects and their documentation and code takes precedence. - -Each mapping is a single line of comma-separated values describing the GUID, -name and layout of the gamepad. Lines that do not begin with a hexadecimal -digit are ignored. - -The first value is always the gamepad GUID, a 32 character long hexadecimal -string that typically identifies its make, model, revision and the type of -connection to the computer. When this information is not available, the GUID is -generated using the gamepad name. GLFW uses the SDL 2.0.5+ GUID format but can -convert from the older formats. - -The second value is always the human-readable name of the gamepad. - -All subsequent values are in the form `:` and describe the layout -of the mapping. These fields may not all be present and may occur in any order. - -The button fields are `a`, `b`, `c`, `d`, `back`, `start`, `guide`, `dpup`, -`dpright`, `dpdown`, `dpleft`, `leftshoulder`, `rightshoulder`, `leftstick` and -`rightstick`. - -The axis fields are `leftx`, `lefty`, `rightx`, `righty`, `lefttrigger` and -`righttrigger`. - -The value of an axis or button field can be a joystick button, a joystick axis, -a hat bitmask or empty. Joystick buttons are specified as `bN`, for example -`b2` for the third button. Joystick axes are specified as `aN`, for example -`a7` for the eighth button. Joystick hat bit masks are specified as `hN.N`, for -example `h0.8` for left on the first hat. More than one bit may be set in the -mask. - -Before an axis there may be a `+` or `-` range modifier, for example `+a3` for -the positive half of the fourth axis. This restricts input to only the positive -or negative halves of the joystick axis. After an axis or half-axis there may -be the `~` inversion modifier, for example `a2~` or `-a7~`. This negates the -values of the gamepad axis. - -The hat bit mask match the [hat states](@ref hat_state) in the joystick -functions. - -There is also the special `platform` field that specifies which platform the -mapping is valid for. Possible values are `Windows`, `Mac OS X` and `Linux`. - -Below is an example of what a gamepad mapping might look like. It is the -one built into GLFW for Xbox controllers accessed via the XInput API on Windows. -This example has been broken into several lines to fit on the page, but real -gamepad mappings must be a single line. - -@code{.unparsed} -78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0, -b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8, -rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4, -righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8, -@endcode - -@note GLFW does not yet support the output range and modifiers `+` and `-` that -were recently added to SDL. The input modifiers `+`, `-` and `~` are supported -and described above. - - -@section time Time input - -GLFW provides high-resolution time input, in seconds, with @ref glfwGetTime. - -@code -double seconds = glfwGetTime(); -@endcode - -It returns the number of seconds since the library was initialized with @ref -glfwInit. The platform-specific time sources used typically have micro- or -nanosecond resolution. - -You can modify the base time with @ref glfwSetTime. - -@code -glfwSetTime(4.0); -@endcode - -This sets the time to the specified time, in seconds, and it continues to count -from there. - -You can also access the raw timer used to implement the functions above, -with @ref glfwGetTimerValue. - -@code -uint64_t value = glfwGetTimerValue(); -@endcode - -This value is in 1 / frequency seconds. The frequency of the raw -timer varies depending on the operating system and hardware. You can query the -frequency, in Hz, with @ref glfwGetTimerFrequency. - -@code -uint64_t frequency = glfwGetTimerFrequency(); -@endcode - - -@section clipboard Clipboard input and output - -If the system clipboard contains a UTF-8 encoded string or if it can be -converted to one, you can retrieve it with @ref glfwGetClipboardString. See the -reference documentation for the lifetime of the returned string. - -@code -const char* text = glfwGetClipboardString(NULL); -if (text) -{ - insert_text(text); -} -@endcode - -If the clipboard is empty or if its contents could not be converted, `NULL` is -returned. - -The contents of the system clipboard can be set to a UTF-8 encoded string with -@ref glfwSetClipboardString. - -@code -glfwSetClipboardString(NULL, "A string with words in it"); -@endcode - - -@section path_drop Path drop input - -If you wish to receive the paths of files and/or directories dropped on -a window, set a file drop callback. - -@code -glfwSetDropCallback(window, drop_callback); -@endcode - -The callback function receives an array of paths encoded as UTF-8. - -@code -void drop_callback(GLFWwindow* window, int count, const char** paths) -{ - int i; - for (i = 0; i < count; i++) - handle_dropped_file(paths[i]); -} -@endcode - -The path array and its strings are only valid until the file drop callback -returns, as they may have been generated specifically for that event. You need -to make a deep copy of the array if you want to keep the paths. - -*/ diff --git a/third_party/penumbra/vendor/glfw/docs/internal.dox b/third_party/penumbra/vendor/glfw/docs/internal.dox deleted file mode 100644 index 685c6d131c9..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/internal.dox +++ /dev/null @@ -1,115 +0,0 @@ -/*! - -@page internals_guide Internal structure - -@tableofcontents - -There are several interfaces inside GLFW. Each interface has its own area of -responsibility and its own naming conventions. - - -@section internals_public Public interface - -The most well-known is the public interface, described in the glfw3.h header -file. This is implemented in source files shared by all platforms and these -files contain no platform-specific code. This code usually ends up calling the -platform and internal interfaces to do the actual work. - -The public interface uses the OpenGL naming conventions except with GLFW and -glfw instead of GL and gl. For struct members, where OpenGL sets no precedent, -it use headless camel case. - -Examples: `glfwCreateWindow`, `GLFWwindow`, `GLFW_RED_BITS` - - -@section internals_native Native interface - -The [native interface](@ref native) is a small set of publicly available -but platform-specific functions, described in the glfw3native.h header file and -used to gain access to the underlying window, context and (on some platforms) -display handles used by the platform interface. - -The function names of the native interface are similar to those of the public -interface, but embeds the name of the interface that the returned handle is -from. - -Examples: `glfwGetX11Window`, `glfwGetWGLContext` - - -@section internals_internal Internal interface - -The internal interface consists of utility functions used by all other -interfaces. It is shared code implemented in the same shared source files as -the public and event interfaces. The internal interface is described in the -internal.h header file. - -The internal interface is in charge of GLFW's global data, which it stores in -a `_GLFWlibrary` struct named `_glfw`. - -The internal interface uses the same style as the public interface, except all -global names have a leading underscore. - -Examples: `_glfwIsValidContextConfig`, `_GLFWwindow`, `_glfw.monitorCount` - - -@section internals_platform Platform interface - -The platform interface implements all platform-specific operations as a service -to the public interface. This includes event processing. The platform -interface is never directly called by application code and never directly calls -application-provided callbacks. It is also prohibited from modifying the -platform-independent part of the internal structs. Instead, it calls the event -interface when events interesting to GLFW are received. - -The platform interface mirrors those parts of the public interface that needs to -perform platform-specific operations on some or all platforms. The are also -named the same except that the glfw function prefix is replaced by -_glfwPlatform. - -Examples: `_glfwPlatformCreateWindow` - -The platform interface also defines structs that contain platform-specific -global and per-object state. Their names mirror those of the internal -interface, except that an interface-specific suffix is added. - -Examples: `_GLFWwindowX11`, `_GLFWcontextWGL` - -These structs are incorporated as members into the internal interface structs -using special macros that name them after the specific interface used. This -prevents shared code from accidentally using these members. - -Examples: `window->win32.handle`, `_glfw.x11.display` - - -@section internals_event Event interface - -The event interface is implemented in the same shared source files as the public -interface and is responsible for delivering the events it receives to the -application, either via callbacks, via window state changes or both. - -The function names of the event interface use a `_glfwInput` prefix and the -ObjectEvent pattern. - -Examples: `_glfwInputWindowFocus`, `_glfwInputCursorPos` - - -@section internals_static Static functions - -Static functions may be used by any interface and have no prefixes or suffixes. -These use headless camel case. - -Examples: `isValidElementForJoystick` - - -@section internals_config Configuration macros - -GLFW uses a number of configuration macros to select at compile time which -interfaces and code paths to use. They are defined in the glfw_config.h header file, -which is generated from the `glfw_config.h.in` file by CMake. - -Configuration macros the same style as tokens in the public interface, except -with a leading underscore. - -Examples: `_GLFW_WIN32`, `_GLFW_BUILD_DLL` - -*/ diff --git a/third_party/penumbra/vendor/glfw/docs/intro.dox b/third_party/penumbra/vendor/glfw/docs/intro.dox deleted file mode 100644 index a72b620e1b6..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/intro.dox +++ /dev/null @@ -1,454 +0,0 @@ -/*! - -@page intro_guide Introduction to the API - -@tableofcontents - -This guide introduces the basic concepts of GLFW and describes initialization, -error handling and API guarantees and limitations. For a broad but shallow -tutorial, see @ref quick_guide instead. For details on a specific function in -this category, see the @ref init. - -There are also guides for the other areas of GLFW. - - - @ref window_guide - - @ref context_guide - - @ref vulkan_guide - - @ref monitor_guide - - @ref input_guide - - -@section intro_init Initialization and termination - -Before most GLFW functions may be called, the library must be initialized. -This initialization checks what features are available on the machine, -enumerates monitors and joysticks, initializes the timer and performs any -required platform-specific initialization. - -Only the following functions may be called before the library has been -successfully initialized, and only from the main thread. - - - @ref glfwGetVersion - - @ref glfwGetVersionString - - @ref glfwGetError - - @ref glfwSetErrorCallback - - @ref glfwInitHint - - @ref glfwInit - - @ref glfwTerminate - -Calling any other function before successful initialization will cause a @ref -GLFW_NOT_INITIALIZED error. - - -@subsection intro_init_init Initializing GLFW - -The library is initialized with @ref glfwInit, which returns `GLFW_FALSE` if an -error occurred. - -@code -if (!glfwInit()) -{ - // Handle initialization failure -} -@endcode - -If any part of initialization fails, any parts that succeeded are terminated as -if @ref glfwTerminate had been called. The library only needs to be initialized -once and additional calls to an already initialized library will return -`GLFW_TRUE` immediately. - -Once the library has been successfully initialized, it should be terminated -before the application exits. Modern systems are very good at freeing resources -allocated by programs that exit, but GLFW sometimes has to change global system -settings and these might not be restored without termination. - - -@subsection init_hints Initialization hints - -Initialization hints are set before @ref glfwInit and affect how the library -behaves until termination. Hints are set with @ref glfwInitHint. - -@code -glfwInitHint(GLFW_JOYSTICK_HAT_BUTTONS, GLFW_FALSE); -@endcode - -The values you set hints to are never reset by GLFW, but they only take effect -during initialization. Once GLFW has been initialized, any values you set will -be ignored until the library is terminated and initialized again. - -Some hints are platform specific. These may be set on any platform but they -will only affect their specific platform. Other platforms will ignore them. -Setting these hints requires no platform specific headers or functions. - - -@subsubsection init_hints_shared Shared init hints - -@anchor GLFW_JOYSTICK_HAT_BUTTONS -__GLFW_JOYSTICK_HAT_BUTTONS__ specifies whether to also expose joystick hats as -buttons, for compatibility with earlier versions of GLFW that did not have @ref -glfwGetJoystickHats. Set this with @ref glfwInitHint. - - -@subsubsection init_hints_osx macOS specific init hints - -@anchor GLFW_COCOA_CHDIR_RESOURCES_hint -__GLFW_COCOA_CHDIR_RESOURCES__ specifies whether to set the current directory to -the application to the `Contents/Resources` subdirectory of the application's -bundle, if present. Set this with @ref glfwInitHint. - -@anchor GLFW_COCOA_MENUBAR_hint -__GLFW_COCOA_MENUBAR__ specifies whether to create a basic menu bar, either from -a nib or manually, when the first window is created, which is when AppKit is -initialized. Set this with @ref glfwInitHint. - - -@subsubsection init_hints_values Supported and default values - -Initialization hint | Default value | Supported values -------------------------------- | ------------- | ---------------- -@ref GLFW_JOYSTICK_HAT_BUTTONS | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` -@ref GLFW_COCOA_CHDIR_RESOURCES | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` -@ref GLFW_COCOA_MENUBAR | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` - - -@subsection intro_init_terminate Terminating GLFW - -Before your application exits, you should terminate the GLFW library if it has -been initialized. This is done with @ref glfwTerminate. - -@code -glfwTerminate(); -@endcode - -This will destroy any remaining window, monitor and cursor objects, restore any -modified gamma ramps, re-enable the screensaver if it had been disabled and free -any other resources allocated by GLFW. - -Once the library is terminated, it is as if it had never been initialized and -you will need to initialize it again before being able to use GLFW. If the -library was not initialized or had already been terminated, it return -immediately. - - -@section error_handling Error handling - -Some GLFW functions have return values that indicate an error, but this is often -not very helpful when trying to figure out what happened or why it occurred. -Other functions have no return value reserved for errors, so error notification -needs a separate channel. Finally, far from all GLFW functions have return -values. - -The last [error code](@ref errors) for the calling thread can be queried at any -time with @ref glfwGetError. - -@code -int code = glfwGetError(NULL); - -if (code != GLFW_NO_ERROR) - handle_error(code); -@endcode - -If no error has occurred since the last call, @ref GLFW_NO_ERROR (zero) is -returned. The error is cleared before the function returns. - -The error code indicates the general category of the error. Some error codes, -such as @ref GLFW_NOT_INITIALIZED has only a single meaning, whereas others like -@ref GLFW_PLATFORM_ERROR are used for many different errors. - -GLFW often has more information about an error than its general category. You -can retrieve a UTF-8 encoded human-readable description along with the error -code. If no error has occurred since the last call, the description is set to -`NULL`. - -@code -const char* description; -int code = glfwGetError(&description); - -if (description) - display_error_message(code, description); -@endcode - -The retrieved description string is only valid until the next error occurs. -This means you must make a copy of it if you want to keep it. - -You can also set an error callback, which will be called each time an error -occurs. It is set with @ref glfwSetErrorCallback. - -@code -glfwSetErrorCallback(error_callback); -@endcode - -The error callback receives the same error code and human-readable description -returned by @ref glfwGetError. - -@code -void error_callback(int code, const char* description) -{ - display_error_message(code, description); -} -@endcode - -The error callback is called after the error is stored, so calling @ref -glfwGetError from within the error callback returns the same values as the -callback argument. - -The description string passed to the callback is only valid until the error -callback returns. This means you must make a copy of it if you want to keep it. - -__Reported errors are never fatal.__ As long as GLFW was successfully -initialized, it will remain initialized and in a safe state until terminated -regardless of how many errors occur. If an error occurs during initialization -that causes @ref glfwInit to fail, any part of the library that was initialized -will be safely terminated. - -Do not rely on a currently invalid call to generate a specific error, as in the -future that same call may generate a different error or become valid. - - -@section coordinate_systems Coordinate systems - -GLFW has two primary coordinate systems: the _virtual screen_ and the window -_content area_ or _content area_. Both use the same unit: _virtual screen -coordinates_, or just _screen coordinates_, which don't necessarily correspond -to pixels. - - - -Both the virtual screen and the content area coordinate systems have the X-axis -pointing to the right and the Y-axis pointing down. - -Window and monitor positions are specified as the position of the upper-left -corners of their content areas relative to the virtual screen, while cursor -positions are specified relative to a window's content area. - -Because the origin of the window's content area coordinate system is also the -point from which the window position is specified, you can translate content -area coordinates to the virtual screen by adding the window position. The -window frame, when present, extends out from the content area but does not -affect the window position. - -Almost all positions and sizes in GLFW are measured in screen coordinates -relative to one of the two origins above. This includes cursor positions, -window positions and sizes, window frame sizes, monitor positions and video mode -resolutions. - -Two exceptions are the [monitor physical size](@ref monitor_size), which is -measured in millimetres, and [framebuffer size](@ref window_fbsize), which is -measured in pixels. - -Pixels and screen coordinates may map 1:1 on your machine, but they won't on -every other machine, for example on a Mac with a Retina display. The ratio -between screen coordinates and pixels may also change at run-time depending on -which monitor the window is currently considered to be on. - - -@section guarantees_limitations Guarantees and limitations - -This section describes the conditions under which GLFW can be expected to -function, barring bugs in the operating system or drivers. Use of GLFW outside -of these limits may work on some platforms, or on some machines, or some of the -time, or on some versions of GLFW, but it may break at any time and this will -not be considered a bug. - - -@subsection lifetime Pointer lifetimes - -GLFW will never free any pointer you provide to it and you must never free any -pointer it provides to you. - -Many GLFW functions return pointers to dynamically allocated structures, strings -or arrays, and some callbacks are provided with strings or arrays. These are -always managed by GLFW and should never be freed by the application. The -lifetime of these pointers is documented for each GLFW function and callback. -If you need to keep this data, you must copy it before its lifetime expires. - -Many GLFW functions accept pointers to structures or strings allocated by the -application. These are never freed by GLFW and are always the responsibility of -the application. If GLFW needs to keep the data in these structures or strings, -it is copied before the function returns. - -Pointer lifetimes are guaranteed not to be shortened in future minor or patch -releases. - - -@subsection reentrancy Reentrancy - -GLFW event processing and object destruction are not reentrant. This means that -the following functions must not be called from any callback function: - - - @ref glfwDestroyWindow - - @ref glfwDestroyCursor - - @ref glfwPollEvents - - @ref glfwWaitEvents - - @ref glfwWaitEventsTimeout - - @ref glfwTerminate - -These functions may be made reentrant in future minor or patch releases, but -functions not on this list will not be made non-reentrant. - - -@subsection thread_safety Thread safety - -Most GLFW functions must only be called from the main thread (the thread that -calls main), but some may be called from any thread once the library has been -initialized. Before initialization the whole library is thread-unsafe. - -The reference documentation for every GLFW function states whether it is limited -to the main thread. - -Initialization, termination, event processing and the creation and -destruction of windows, cursors and OpenGL and OpenGL ES contexts are all -restricted to the main thread due to limitations of one or several platforms. - -Because event processing must be performed on the main thread, all callbacks -except for the error callback will only be called on that thread. The error -callback may be called on any thread, as any GLFW function may generate errors. - -The error code and description may be queried from any thread. - - - @ref glfwGetError - -Empty events may be posted from any thread. - - - @ref glfwPostEmptyEvent - -The window user pointer and close flag may be read and written from any thread, -but this is not synchronized by GLFW. - - - @ref glfwGetWindowUserPointer - - @ref glfwSetWindowUserPointer - - @ref glfwWindowShouldClose - - @ref glfwSetWindowShouldClose - -These functions for working with OpenGL and OpenGL ES contexts may be called -from any thread, but the window object is not synchronized by GLFW. - - - @ref glfwMakeContextCurrent - - @ref glfwGetCurrentContext - - @ref glfwSwapBuffers - - @ref glfwSwapInterval - - @ref glfwExtensionSupported - - @ref glfwGetProcAddress - -The raw timer functions may be called from any thread. - - - @ref glfwGetTimerFrequency - - @ref glfwGetTimerValue - -The regular timer may be used from any thread, but reading and writing the timer -offset is not synchronized by GLFW. - - - @ref glfwGetTime - - @ref glfwSetTime - -Library version information may be queried from any thread. - - - @ref glfwGetVersion - - @ref glfwGetVersionString - -All Vulkan related functions may be called from any thread. - - - @ref glfwVulkanSupported - - @ref glfwGetRequiredInstanceExtensions - - @ref glfwGetInstanceProcAddress - - @ref glfwGetPhysicalDevicePresentationSupport - - @ref glfwCreateWindowSurface - -GLFW uses synchronization objects internally only to manage the per-thread -context and error states. Additional synchronization is left to the -application. - -Functions that may currently be called from any thread will always remain so, -but functions that are currently limited to the main thread may be updated to -allow calls from any thread in future releases. - - -@subsection compatibility Version compatibility - -GLFW uses [Semantic Versioning](https://semver.org/). This guarantees source -and binary backward compatibility with earlier minor versions of the API. This -means that you can drop in a newer version of the library and existing programs -will continue to compile and existing binaries will continue to run. - -Once a function or constant has been added, the signature of that function or -value of that constant will remain unchanged until the next major version of -GLFW. No compatibility of any kind is guaranteed between major versions. - -Undocumented behavior, i.e. behavior that is not described in the documentation, -may change at any time until it is documented. - -If the reference documentation and the implementation differ, the reference -documentation will almost always take precedence and the implementation will be -fixed in the next release. The reference documentation will also take -precedence over anything stated in a guide. - - -@subsection event_order Event order - -The order of arrival of related events is not guaranteed to be consistent -across platforms. The exception is synthetic key and mouse button release -events, which are always delivered after the window defocus event. - - -@section intro_version Version management - -GLFW provides mechanisms for identifying what version of GLFW your application -was compiled against as well as what version it is currently running against. -If you are loading GLFW dynamically (not just linking dynamically), you can use -this to verify that the library binary is compatible with your application. - - -@subsection intro_version_compile Compile-time version - -The compile-time version of GLFW is provided by the GLFW header with the -`GLFW_VERSION_MAJOR`, `GLFW_VERSION_MINOR` and `GLFW_VERSION_REVISION` macros. - -@code -printf("Compiled against GLFW %i.%i.%i\n", - GLFW_VERSION_MAJOR, - GLFW_VERSION_MINOR, - GLFW_VERSION_REVISION); -@endcode - - -@subsection intro_version_runtime Run-time version - -The run-time version can be retrieved with @ref glfwGetVersion, a function that -may be called regardless of whether GLFW is initialized. - -@code -int major, minor, revision; -glfwGetVersion(&major, &minor, &revision); - -printf("Running against GLFW %i.%i.%i\n", major, minor, revision); -@endcode - - -@subsection intro_version_string Version string - -GLFW 3 also provides a compile-time generated version string that describes the -version, platform, compiler and any platform-specific compile-time options. -This is primarily intended for submitting bug reports, to allow developers to -see which code paths are enabled in a binary. - -The version string is returned by @ref glfwGetVersionString, a function that may -be called regardless of whether GLFW is initialized. - -__Do not use the version string__ to parse the GLFW library version. The @ref -glfwGetVersion function already provides the version of the running library -binary. - -The format of the string is as follows: - - The version of GLFW - - The name of the window system API - - The name of the context creation API - - Any additional options or APIs - -For example, when compiling GLFW 3.0 with MinGW using the Win32 and WGL -back ends, the version string may look something like this: - -@code -3.0.0 Win32 WGL MinGW -@endcode - -*/ diff --git a/third_party/penumbra/vendor/glfw/docs/main.dox b/third_party/penumbra/vendor/glfw/docs/main.dox deleted file mode 100644 index bd563d98843..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/main.dox +++ /dev/null @@ -1,46 +0,0 @@ -/*! - -@mainpage notitle - -@section main_intro Introduction - -GLFW is a free, Open Source, multi-platform library for OpenGL, OpenGL ES and -Vulkan application development. It provides a simple, platform-independent API -for creating windows, contexts and surfaces, reading input, handling events, etc. - -@ref news_33 list new features, caveats and deprecations. - -@ref quick_guide is a guide for users new to GLFW. It takes you through how to -write a small but complete program. - -There are guides for each section of the API: - - - @ref intro_guide – initialization, error handling and high-level design - - @ref window_guide – creating and working with windows and framebuffers - - @ref context_guide – working with OpenGL and OpenGL ES contexts - - @ref vulkan_guide - working with Vulkan objects and extensions - - @ref monitor_guide – enumerating and working with monitors and video modes - - @ref input_guide – receiving events, polling and processing input - -Once you have written a program, see @ref compile_guide and @ref build_guide. - -The [reference documentation](modules.html) provides more detailed information -about specific functions. - -@ref moving_guide explains what has changed and how to update existing code to -use the new API. - -There is a section on @ref guarantees_limitations for pointer lifetimes, -reentrancy, thread safety, event order and backward and forward compatibility. - -The [FAQ](https://www.glfw.org/faq.html) answers many common questions about the -design, implementation and use of GLFW. - -Finally, @ref compat_guide explains what APIs, standards and protocols GLFW uses -and what happens when they are not present on a given machine. - -This documentation was generated with Doxygen. The sources for it are available -in both the [source distribution](https://www.glfw.org/download.html) and -[GitHub repository](https://github.com/glfw/glfw). - -*/ diff --git a/third_party/penumbra/vendor/glfw/docs/monitor.dox b/third_party/penumbra/vendor/glfw/docs/monitor.dox deleted file mode 100644 index 86eb4540b08..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/monitor.dox +++ /dev/null @@ -1,268 +0,0 @@ -/*! - -@page monitor_guide Monitor guide - -@tableofcontents - -This guide introduces the monitor related functions of GLFW. For details on -a specific function in this category, see the @ref monitor. There are also -guides for the other areas of GLFW. - - - @ref intro_guide - - @ref window_guide - - @ref context_guide - - @ref vulkan_guide - - @ref input_guide - - -@section monitor_object Monitor objects - -A monitor object represents a currently connected monitor and is represented as -a pointer to the [opaque](https://en.wikipedia.org/wiki/Opaque_data_type) type -@ref GLFWmonitor. Monitor objects cannot be created or destroyed by the -application and retain their addresses until the monitors they represent are -disconnected or until the library is [terminated](@ref intro_init_terminate). - -Each monitor has a current video mode, a list of supported video modes, -a virtual position, a human-readable name, an estimated physical size and -a gamma ramp. One of the monitors is the primary monitor. - -The virtual position of a monitor is in -[screen coordinates](@ref coordinate_systems) and, together with the current -video mode, describes the viewports that the connected monitors provide into the -virtual desktop that spans them. - -To see how GLFW views your monitor setup and its available video modes, run the -`monitors` test program. - - -@subsection monitor_monitors Retrieving monitors - -The primary monitor is returned by @ref glfwGetPrimaryMonitor. It is the user's -preferred monitor and is usually the one with global UI elements like task bar -or menu bar. - -@code -GLFWmonitor* primary = glfwGetPrimaryMonitor(); -@endcode - -You can retrieve all currently connected monitors with @ref glfwGetMonitors. -See the reference documentation for the lifetime of the returned array. - -@code -int count; -GLFWmonitor** monitors = glfwGetMonitors(&count); -@endcode - -The primary monitor is always the first monitor in the returned array, but other -monitors may be moved to a different index when a monitor is connected or -disconnected. - - -@subsection monitor_event Monitor configuration changes - -If you wish to be notified when a monitor is connected or disconnected, set -a monitor callback. - -@code -glfwSetMonitorCallback(monitor_callback); -@endcode - -The callback function receives the handle for the monitor that has been -connected or disconnected and the event that occurred. - -@code -void monitor_callback(GLFWmonitor* monitor, int event) -{ - if (event == GLFW_CONNECTED) - { - // The monitor was connected - } - else if (event == GLFW_DISCONNECTED) - { - // The monitor was disconnected - } -} -@endcode - -If a monitor is disconnected, all windows that are full screen on it will be -switched to windowed mode before the callback is called. Only @ref -glfwGetMonitorName and @ref glfwGetMonitorUserPointer will return useful values -for a disconnected monitor and only before the monitor callback returns. - - -@section monitor_properties Monitor properties - -Each monitor has a current video mode, a list of supported video modes, -a virtual position, a content scale, a human-readable name, a user pointer, an -estimated physical size and a gamma ramp. - - -@subsection monitor_modes Video modes - -GLFW generally does a good job selecting a suitable video mode when you create -a full screen window, change its video mode or make a windowed one full -screen, but it is sometimes useful to know exactly which video modes are -supported. - -Video modes are represented as @ref GLFWvidmode structures. You can get an -array of the video modes supported by a monitor with @ref glfwGetVideoModes. -See the reference documentation for the lifetime of the returned array. - -@code -int count; -GLFWvidmode* modes = glfwGetVideoModes(monitor, &count); -@endcode - -To get the current video mode of a monitor call @ref glfwGetVideoMode. See the -reference documentation for the lifetime of the returned pointer. - -@code -const GLFWvidmode* mode = glfwGetVideoMode(monitor); -@endcode - -The resolution of a video mode is specified in -[screen coordinates](@ref coordinate_systems), not pixels. - - -@subsection monitor_size Physical size - -The physical size of a monitor in millimetres, or an estimation of it, can be -retrieved with @ref glfwGetMonitorPhysicalSize. This has no relation to its -current _resolution_, i.e. the width and height of its current -[video mode](@ref monitor_modes). - -@code -int width_mm, height_mm; -glfwGetMonitorPhysicalSize(monitor, &width_mm, &height_mm); -@endcode - -While this can be used to calculate the raw DPI of a monitor, this is often not -useful. Instead use the [monitor content scale](@ref monitor_scale) and -[window content scale](@ref window_scale) to scale your content. - - -@subsection monitor_scale Content scale - -The content scale for a monitor can be retrieved with @ref -glfwGetMonitorContentScale. - -@code -float xscale, yscale; -glfwGetMonitorContentScale(monitor, &xscale, &yscale); -@endcode - -The content scale is the ratio between the current DPI and the platform's -default DPI. This is especially important for text and any UI elements. If the -pixel dimensions of your UI scaled by this look appropriate on your machine then -it should appear at a reasonable size on other machines regardless of their DPI -and scaling settings. This relies on the system DPI and scaling settings being -somewhat correct. - -The content scale may depend on both the monitor resolution and pixel density -and on user settings. It may be very different from the raw DPI calculated from -the physical size and current resolution. - - -@subsection monitor_pos Virtual position - -The position of the monitor on the virtual desktop, in -[screen coordinates](@ref coordinate_systems), can be retrieved with @ref -glfwGetMonitorPos. - -@code -int xpos, ypos; -glfwGetMonitorPos(monitor, &xpos, &ypos); -@endcode - - -@subsection monitor_workarea Work area - -The area of a monitor not occupied by global task bars or menu bars is the work -area. This is specified in [screen coordinates](@ref coordinate_systems) and -can be retrieved with @ref glfwGetMonitorWorkarea. - -@code -int xpos, ypos, width, height; -glfwGetMonitorWorkarea(monitor, &xpos, &ypos, &width, &height); -@endcode - - -@subsection monitor_name Human-readable name - -The human-readable, UTF-8 encoded name of a monitor is returned by @ref -glfwGetMonitorName. See the reference documentation for the lifetime of the -returned string. - -@code -const char* name = glfwGetMonitorName(monitor); -@endcode - -Monitor names are not guaranteed to be unique. Two monitors of the same model -and make may have the same name. Only the monitor handle is guaranteed to be -unique, and only until that monitor is disconnected. - - -@subsection monitor_userptr User pointer - -Each monitor has a user pointer that can be set with @ref -glfwSetMonitorUserPointer and queried with @ref glfwGetMonitorUserPointer. This -can be used for any purpose you need and will not be modified by GLFW. The -value will be kept until the monitor is disconnected or until the library is -terminated. - -The initial value of the pointer is `NULL`. - - -@subsection monitor_gamma Gamma ramp - -The gamma ramp of a monitor can be set with @ref glfwSetGammaRamp, which accepts -a monitor handle and a pointer to a @ref GLFWgammaramp structure. - -@code -GLFWgammaramp ramp; -unsigned short red[256], green[256], blue[256]; - -ramp.size = 256; -ramp.red = red; -ramp.green = green; -ramp.blue = blue; - -for (i = 0; i < ramp.size; i++) -{ - // Fill out gamma ramp arrays as desired -} - -glfwSetGammaRamp(monitor, &ramp); -@endcode - -The gamma ramp data is copied before the function returns, so there is no need -to keep it around once the ramp has been set. - -It is recommended that your gamma ramp have the same size as the current gamma -ramp for that monitor. - -The current gamma ramp for a monitor is returned by @ref glfwGetGammaRamp. See -the reference documentation for the lifetime of the returned structure. - -@code -const GLFWgammaramp* ramp = glfwGetGammaRamp(monitor); -@endcode - -If you wish to set a regular gamma ramp, you can have GLFW calculate it for you -from the desired exponent with @ref glfwSetGamma, which in turn calls @ref -glfwSetGammaRamp with the resulting ramp. - -@code -glfwSetGamma(monitor, 1.0); -@endcode - -To experiment with gamma correction via the @ref glfwSetGamma function, run the -`gamma` test program. - -@note The software controlled gamma ramp is applied _in addition_ to the -hardware gamma correction, which today is usually an approximation of sRGB -gamma. This means that setting a perfectly linear ramp, or gamma 1.0, will -produce the default (usually sRGB-like) behavior. - -*/ diff --git a/third_party/penumbra/vendor/glfw/docs/moving.dox b/third_party/penumbra/vendor/glfw/docs/moving.dox deleted file mode 100644 index 85ba0a70c07..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/moving.dox +++ /dev/null @@ -1,513 +0,0 @@ -/*! - -@page moving_guide Moving from GLFW 2 to 3 - -@tableofcontents - -This is a transition guide for moving from GLFW 2 to 3. It describes what has -changed or been removed, but does _not_ include -[new features](@ref news) unless they are required when moving an existing code -base onto the new API. For example, the new multi-monitor functions are -required to create full screen windows with GLFW 3. - - -@section moving_removed Changed and removed features - -@subsection moving_renamed_files Renamed library and header file - -The GLFW 3 header is named @ref glfw3.h and moved to the `GLFW` directory, to -avoid collisions with the headers of other major versions. Similarly, the GLFW -3 library is named `glfw3,` except when it's installed as a shared library on -Unix-like systems, where it uses the -[soname](https://en.wikipedia.org/wiki/soname) `libglfw.so.3`. - -@par Old syntax -@code -#include -@endcode - -@par New syntax -@code -#include -@endcode - - -@subsection moving_threads Removal of threading functions - -The threading functions have been removed, including the per-thread sleep -function. They were fairly primitive, under-used, poorly integrated and took -time away from the focus of GLFW (i.e. context, input and window). There are -better threading libraries available and native threading support is available -in both [C++11](https://en.cppreference.com/w/cpp/thread) and -[C11](https://en.cppreference.com/w/c/thread), both of which are gaining -traction. - -If you wish to use the C++11 or C11 facilities but your compiler doesn't yet -support them, see the -[TinyThread++](https://gitorious.org/tinythread/tinythreadpp) and -[TinyCThread](https://github.com/tinycthread/tinycthread) projects created by -the original author of GLFW. These libraries implement a usable subset of the -threading APIs in C++11 and C11, and in fact some GLFW 3 test programs use -TinyCThread. - -However, GLFW 3 has better support for _use from multiple threads_ than GLFW -2 had. Contexts can be made current on any thread, although only a single -thread at a time, and the documentation explicitly states which functions may be -used from any thread and which must only be used from the main thread. - -@par Removed functions -`glfwSleep`, `glfwCreateThread`, `glfwDestroyThread`, `glfwWaitThread`, -`glfwGetThreadID`, `glfwCreateMutex`, `glfwDestroyMutex`, `glfwLockMutex`, -`glfwUnlockMutex`, `glfwCreateCond`, `glfwDestroyCond`, `glfwWaitCond`, -`glfwSignalCond`, `glfwBroadcastCond` and `glfwGetNumberOfProcessors`. - -@par Removed types -`GLFWthreadfun` - - -@subsection moving_image Removal of image and texture loading - -The image and texture loading functions have been removed. They only supported -the Targa image format, making them mostly useful for beginner level examples. -To become of sufficiently high quality to warrant keeping them in GLFW 3, they -would need not only to support other formats, but also modern extensions to -OpenGL texturing. This would either add a number of external -dependencies (libjpeg, libpng, etc.), or force GLFW to ship with inline versions -of these libraries. - -As there already are libraries doing this, it is unnecessary both to duplicate -the work and to tie the duplicate to GLFW. The resulting library would also be -platform-independent, as both OpenGL and stdio are available wherever GLFW is. - -@par Removed functions -`glfwReadImage`, `glfwReadMemoryImage`, `glfwFreeImage`, `glfwLoadTexture2D`, -`glfwLoadMemoryTexture2D` and `glfwLoadTextureImage2D`. - - -@subsection moving_stdcall Removal of GLFWCALL macro - -The `GLFWCALL` macro, which made callback functions use -[__stdcall](https://msdn.microsoft.com/en-us/library/zxk0tw93.aspx) on Windows, -has been removed. GLFW is written in C, not Pascal. Removing this macro means -there's one less thing for application programmers to remember, i.e. the -requirement to mark all callback functions with `GLFWCALL`. It also simplifies -the creation of DLLs and DLL link libraries, as there's no need to explicitly -disable `@n` entry point suffixes. - -@par Old syntax -@code -void GLFWCALL callback_function(...); -@endcode - -@par New syntax -@code -void callback_function(...); -@endcode - - -@subsection moving_window_handles Window handle parameters - -Because GLFW 3 supports multiple windows, window handle parameters have been -added to all window-related GLFW functions and callbacks. The handle of -a newly created window is returned by @ref glfwCreateWindow (formerly -`glfwOpenWindow`). Window handles are pointers to the -[opaque](https://en.wikipedia.org/wiki/Opaque_data_type) type @ref GLFWwindow. - -@par Old syntax -@code -glfwSetWindowTitle("New Window Title"); -@endcode - -@par New syntax -@code -glfwSetWindowTitle(window, "New Window Title"); -@endcode - - -@subsection moving_monitor Explicit monitor selection - -GLFW 3 provides support for multiple monitors. To request a full screen mode window, -instead of passing `GLFW_FULLSCREEN` you specify which monitor you wish the -window to use. The @ref glfwGetPrimaryMonitor function returns the monitor that -GLFW 2 would have selected, but there are many other -[monitor functions](@ref monitor_guide). Monitor handles are pointers to the -[opaque](https://en.wikipedia.org/wiki/Opaque_data_type) type @ref GLFWmonitor. - -@par Old basic full screen -@code -glfwOpenWindow(640, 480, 8, 8, 8, 0, 24, 0, GLFW_FULLSCREEN); -@endcode - -@par New basic full screen -@code -window = glfwCreateWindow(640, 480, "My Window", glfwGetPrimaryMonitor(), NULL); -@endcode - -@note The framebuffer bit depth parameters of `glfwOpenWindow` have been turned -into [window hints](@ref window_hints), but as they have been given -[sane defaults](@ref window_hints_values) you rarely need to set these hints. - - -@subsection moving_autopoll Removal of automatic event polling - -GLFW 3 does not automatically poll for events in @ref glfwSwapBuffers, meaning -you need to call @ref glfwPollEvents or @ref glfwWaitEvents yourself. Unlike -buffer swap, which acts on a single window, the event processing functions act -on all windows at once. - -@par Old basic main loop -@code -while (...) -{ - // Process input - // Render output - glfwSwapBuffers(); -} -@endcode - -@par New basic main loop -@code -while (...) -{ - // Process input - // Render output - glfwSwapBuffers(window); - glfwPollEvents(); -} -@endcode - - -@subsection moving_context Explicit context management - -Each GLFW 3 window has its own OpenGL context and only you, the application -programmer, can know which context should be current on which thread at any -given time. Therefore, GLFW 3 leaves that decision to you. - -This means that you need to call @ref glfwMakeContextCurrent after creating -a window before you can call any OpenGL functions. - - -@subsection moving_hidpi Separation of window and framebuffer sizes - -Window positions and sizes now use screen coordinates, which may not be the same -as pixels on machines with high-DPI monitors. This is important as OpenGL uses -pixels, not screen coordinates. For example, the rectangle specified with -`glViewport` needs to use pixels. Therefore, framebuffer size functions have -been added. You can retrieve the size of the framebuffer of a window with @ref -glfwGetFramebufferSize function. A framebuffer size callback has also been -added, which can be set with @ref glfwSetFramebufferSizeCallback. - -@par Old basic viewport setup -@code -glfwGetWindowSize(&width, &height); -glViewport(0, 0, width, height); -@endcode - -@par New basic viewport setup -@code -glfwGetFramebufferSize(window, &width, &height); -glViewport(0, 0, width, height); -@endcode - - -@subsection moving_window_close Window closing changes - -The `GLFW_OPENED` window parameter has been removed. As long as the window has -not been destroyed, whether through @ref glfwDestroyWindow or @ref -glfwTerminate, the window is "open". - -A user attempting to close a window is now just an event like any other. Unlike -GLFW 2, windows and contexts created with GLFW 3 will never be destroyed unless -you choose them to be. Each window now has a close flag that is set to -`GLFW_TRUE` when the user attempts to close that window. By default, nothing else -happens and the window stays visible. It is then up to you to either destroy -the window, take some other action or ignore the request. - -You can query the close flag at any time with @ref glfwWindowShouldClose and set -it at any time with @ref glfwSetWindowShouldClose. - -@par Old basic main loop -@code -while (glfwGetWindowParam(GLFW_OPENED)) -{ - ... -} -@endcode - -@par New basic main loop -@code -while (!glfwWindowShouldClose(window)) -{ - ... -} -@endcode - -The close callback no longer returns a value. Instead, it is called after the -close flag has been set so it can override its value, if it chooses to, before -event processing completes. You may however not call @ref glfwDestroyWindow -from the close callback (or any other window related callback). - -@par Old syntax -@code -int GLFWCALL window_close_callback(void); -@endcode - -@par New syntax -@code -void window_close_callback(GLFWwindow* window); -@endcode - -@note GLFW never clears the close flag to `GLFW_FALSE`, meaning you can use it -for other reasons to close the window as well, for example the user choosing -Quit from an in-game menu. - - -@subsection moving_hints Persistent window hints - -The `glfwOpenWindowHint` function has been renamed to @ref glfwWindowHint. - -Window hints are no longer reset to their default values on window creation, but -instead retain their values until modified by @ref glfwWindowHint or @ref -glfwDefaultWindowHints, or until the library is terminated and re-initialized. - - -@subsection moving_video_modes Video mode enumeration - -Video mode enumeration is now per-monitor. The @ref glfwGetVideoModes function -now returns all available modes for a specific monitor instead of requiring you -to guess how large an array you need. The `glfwGetDesktopMode` function, which -had poorly defined behavior, has been replaced by @ref glfwGetVideoMode, which -returns the current mode of a monitor. - - -@subsection moving_char_up Removal of character actions - -The action parameter of the [character callback](@ref GLFWcharfun) has been -removed. This was an artefact of the origin of GLFW, i.e. being developed in -English by a Swede. However, many keyboard layouts require more than one key to -produce characters with diacritical marks. Even the Swedish keyboard layout -requires this for uncommon cases like ü. - -@par Old syntax -@code -void GLFWCALL character_callback(int character, int action); -@endcode - -@par New syntax -@code -void character_callback(GLFWwindow* window, int character); -@endcode - - -@subsection moving_cursorpos Cursor position changes - -The `glfwGetMousePos` function has been renamed to @ref glfwGetCursorPos, -`glfwSetMousePos` to @ref glfwSetCursorPos and `glfwSetMousePosCallback` to @ref -glfwSetCursorPosCallback. - -The cursor position is now `double` instead of `int`, both for the direct -functions and for the callback. Some platforms can provide sub-pixel cursor -movement and this data is now passed on to the application where available. On -platforms where this is not provided, the decimal part is zero. - -GLFW 3 only allows you to position the cursor within a window using @ref -glfwSetCursorPos (formerly `glfwSetMousePos`) when that window is active. -Unless the window is active, the function fails silently. - - -@subsection moving_wheel Wheel position replaced by scroll offsets - -The `glfwGetMouseWheel` function has been removed. Scrolling is the input of -offsets and has no absolute position. The mouse wheel callback has been -replaced by a [scroll callback](@ref GLFWscrollfun) that receives -two-dimensional floating point scroll offsets. This allows you to receive -precise scroll data from for example modern touchpads. - -@par Old syntax -@code -void GLFWCALL mouse_wheel_callback(int position); -@endcode - -@par New syntax -@code -void scroll_callback(GLFWwindow* window, double xoffset, double yoffset); -@endcode - -@par Removed functions -`glfwGetMouseWheel` - - -@subsection moving_repeat Key repeat action - -The `GLFW_KEY_REPEAT` enable has been removed and key repeat is always enabled -for both keys and characters. A new key action, `GLFW_REPEAT`, has been added -to allow the [key callback](@ref GLFWkeyfun) to distinguish an initial key press -from a repeat. Note that @ref glfwGetKey still returns only `GLFW_PRESS` or -`GLFW_RELEASE`. - - -@subsection moving_keys Physical key input - -GLFW 3 key tokens map to physical keys, unlike in GLFW 2 where they mapped to -the values generated by the current keyboard layout. The tokens are named -according to the values they would have using the standard US layout, but this -is only a convenience, as most programmers are assumed to know that layout. -This means that (for example) `GLFW_KEY_LEFT_BRACKET` is always a single key and -is the same key in the same place regardless of what keyboard layouts the users -of your program has. - -The key input facility was never meant for text input, although using it that -way worked slightly better in GLFW 2. If you were using it to input text, you -should be using the character callback instead, on both GLFW 2 and 3. This will -give you the characters being input, as opposed to the keys being pressed. - -GLFW 3 has key tokens for all keys on a standard 105 key keyboard, so instead of -having to remember whether to check for `'a'` or `'A'`, you now check for -`GLFW_KEY_A`. - - -@subsection moving_joystick Joystick function changes - -The `glfwGetJoystickPos` function has been renamed to @ref glfwGetJoystickAxes. - -The `glfwGetJoystickParam` function and the `GLFW_PRESENT`, `GLFW_AXES` and -`GLFW_BUTTONS` tokens have been replaced by the @ref glfwJoystickPresent -function as well as axis and button counts returned by the @ref -glfwGetJoystickAxes and @ref glfwGetJoystickButtons functions. - - -@subsection moving_mbcs Win32 MBCS support - -The Win32 port of GLFW 3 will not compile in -[MBCS mode](https://msdn.microsoft.com/en-us/library/5z097dxa.aspx). -However, because the use of the Unicode version of the Win32 API doesn't affect -the process as a whole, but only those windows created using it, it's perfectly -possible to call MBCS functions from other parts of the same application. -Therefore, even if an application using GLFW has MBCS mode code, there's no need -for GLFW itself to support it. - - -@subsection moving_windows Support for versions of Windows older than XP - -All explicit support for version of Windows older than XP has been removed. -There is no code that actively prevents GLFW 3 from running on these earlier -versions, but it uses Win32 functions that those versions lack. - -Windows XP was released in 2001, and by now (January 2015) it has not only -replaced almost all earlier versions of Windows, but is itself rapidly being -replaced by Windows 7 and 8. The MSDN library doesn't even provide -documentation for version older than Windows 2000, making it difficult to -maintain compatibility with these versions even if it was deemed worth the -effort. - -The Win32 API has also not stood still, and GLFW 3 uses many functions only -present on Windows XP or later. Even supporting an OS as new as XP (new -from the perspective of GLFW 2, which still supports Windows 95) requires -runtime checking for a number of functions that are present only on modern -version of Windows. - - -@subsection moving_syskeys Capture of system-wide hotkeys - -The ability to disable and capture system-wide hotkeys like Alt+Tab has been -removed. Modern applications, whether they're games, scientific visualisations -or something else, are nowadays expected to be good desktop citizens and allow -these hotkeys to function even when running in full screen mode. - - -@subsection moving_terminate Automatic termination - -GLFW 3 does not register @ref glfwTerminate with `atexit` at initialization, -because `exit` calls registered functions from the calling thread and while it -is permitted to call `exit` from any thread, @ref glfwTerminate must only be -called from the main thread. - -To release all resources allocated by GLFW, you should call @ref glfwTerminate -yourself, from the main thread, before the program terminates. Note that this -destroys all windows not already destroyed with @ref glfwDestroyWindow, -invalidating any window handles you may still have. - - -@subsection moving_glu GLU header inclusion - -GLFW 3 does not by default include the GLU header and GLU itself has been -deprecated by [Khronos](https://en.wikipedia.org/wiki/Khronos_Group). __New -projects should not use GLU__, but if you need it for legacy code that -has been moved to GLFW 3, you can request that the GLFW header includes it by -defining @ref GLFW_INCLUDE_GLU before the inclusion of the GLFW header. - -@par Old syntax -@code -#include -@endcode - -@par New syntax -@code -#define GLFW_INCLUDE_GLU -#include -@endcode - -There are many libraries that offer replacements for the functionality offered -by GLU. For the matrix helper functions, see math libraries like -[GLM](https://github.com/g-truc/glm) (for C++), -[linmath.h](https://github.com/datenwolf/linmath.h) (for C) and others. For the -tessellation functions, see for example -[libtess2](https://github.com/memononen/libtess2). - - -@section moving_tables Name change tables - - -@subsection moving_renamed_functions Renamed functions - -| GLFW 2 | GLFW 3 | Notes | -| --------------------------- | ----------------------------- | ----- | -| `glfwOpenWindow` | @ref glfwCreateWindow | All channel bit depths are now hints -| `glfwCloseWindow` | @ref glfwDestroyWindow | | -| `glfwOpenWindowHint` | @ref glfwWindowHint | Now accepts all `GLFW_*_BITS` tokens | -| `glfwEnable` | @ref glfwSetInputMode | | -| `glfwDisable` | @ref glfwSetInputMode | | -| `glfwGetMousePos` | @ref glfwGetCursorPos | | -| `glfwSetMousePos` | @ref glfwSetCursorPos | | -| `glfwSetMousePosCallback` | @ref glfwSetCursorPosCallback | | -| `glfwSetMouseWheelCallback` | @ref glfwSetScrollCallback | Accepts two-dimensional scroll offsets as doubles | -| `glfwGetJoystickPos` | @ref glfwGetJoystickAxes | | -| `glfwGetWindowParam` | @ref glfwGetWindowAttrib | | -| `glfwGetGLVersion` | @ref glfwGetWindowAttrib | Use `GLFW_CONTEXT_VERSION_MAJOR`, `GLFW_CONTEXT_VERSION_MINOR` and `GLFW_CONTEXT_REVISION` | -| `glfwGetDesktopMode` | @ref glfwGetVideoMode | Returns the current mode of a monitor | -| `glfwGetJoystickParam` | @ref glfwJoystickPresent | The axis and button counts are provided by @ref glfwGetJoystickAxes and @ref glfwGetJoystickButtons | - - -@subsection moving_renamed_types Renamed types - -| GLFW 2 | GLFW 3 | Notes | -| ------------------- | --------------------- | | -| `GLFWmousewheelfun` | @ref GLFWscrollfun | | -| `GLFWmouseposfun` | @ref GLFWcursorposfun | | - - -@subsection moving_renamed_tokens Renamed tokens - -| GLFW 2 | GLFW 3 | Notes | -| --------------------------- | ---------------------------- | ----- | -| `GLFW_OPENGL_VERSION_MAJOR` | `GLFW_CONTEXT_VERSION_MAJOR` | Renamed as it applies to OpenGL ES as well | -| `GLFW_OPENGL_VERSION_MINOR` | `GLFW_CONTEXT_VERSION_MINOR` | Renamed as it applies to OpenGL ES as well | -| `GLFW_FSAA_SAMPLES` | `GLFW_SAMPLES` | Renamed to match the OpenGL API | -| `GLFW_ACTIVE` | `GLFW_FOCUSED` | Renamed to match the window focus callback | -| `GLFW_WINDOW_NO_RESIZE` | `GLFW_RESIZABLE` | The default has been inverted | -| `GLFW_MOUSE_CURSOR` | `GLFW_CURSOR` | Used with @ref glfwSetInputMode | -| `GLFW_KEY_ESC` | `GLFW_KEY_ESCAPE` | | -| `GLFW_KEY_DEL` | `GLFW_KEY_DELETE` | | -| `GLFW_KEY_PAGEUP` | `GLFW_KEY_PAGE_UP` | | -| `GLFW_KEY_PAGEDOWN` | `GLFW_KEY_PAGE_DOWN` | | -| `GLFW_KEY_KP_NUM_LOCK` | `GLFW_KEY_NUM_LOCK` | | -| `GLFW_KEY_LCTRL` | `GLFW_KEY_LEFT_CONTROL` | | -| `GLFW_KEY_LSHIFT` | `GLFW_KEY_LEFT_SHIFT` | | -| `GLFW_KEY_LALT` | `GLFW_KEY_LEFT_ALT` | | -| `GLFW_KEY_LSUPER` | `GLFW_KEY_LEFT_SUPER` | | -| `GLFW_KEY_RCTRL` | `GLFW_KEY_RIGHT_CONTROL` | | -| `GLFW_KEY_RSHIFT` | `GLFW_KEY_RIGHT_SHIFT` | | -| `GLFW_KEY_RALT` | `GLFW_KEY_RIGHT_ALT` | | -| `GLFW_KEY_RSUPER` | `GLFW_KEY_RIGHT_SUPER` | | - -*/ diff --git a/third_party/penumbra/vendor/glfw/docs/news.dox b/third_party/penumbra/vendor/glfw/docs/news.dox deleted file mode 100644 index da97215c8ee..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/news.dox +++ /dev/null @@ -1,856 +0,0 @@ -/*! - -@page news Release notes - -@tableofcontents - - -@section news_33 Release notes for version 3.3 - -These are the release notes for version 3.3. For a more detailed view including -all fixed bugs see the [version history](https://www.glfw.org/changelog.html). - -Please review the caveats, deprecations and removals if your project was written -against an earlier version of GLFW 3. - - -@subsection features_33 New features in version 3.3 - -@subsubsection gamepad_33 Gamepad input via SDL_GameControllerDB - -GLFW can now remap game controllers to a standard Xbox-like layout using -a built-in copy of SDL_GameControllerDB. Call @ref glfwJoystickIsGamepad to -check if a joystick has a mapping, @ref glfwGetGamepadState to retrieve its -input state, @ref glfwUpdateGamepadMappings to add newer mappings and @ref -glfwGetGamepadName and @ref glfwGetJoystickGUID for mapping related information. - -For more information see @ref gamepad. - - -@subsubsection moltenvk_33 Support for Vulkan on macOS via MoltenVK - -GLFW now supports [MoltenVK](https://moltengl.com/moltenvk/), a Vulkan -implementation on top of the Metal API, and its `VK_MVK_macos_surface` window -surface creation extension. MoltenVK is included in the [macOS Vulkan -SDK](https://vulkan.lunarg.com/). - -For more information see @ref vulkan_guide. - - -@subsubsection content_scale_33 Content scale queries for DPI-aware rendering - -GLFW now provides content scales for windows and monitors, i.e. the ratio -between their current DPI and the platform's default DPI, with @ref -glfwGetWindowContentScale and @ref glfwGetMonitorContentScale. - -Changes of the content scale of a window can be received with the window content -scale callback, set with @ref glfwSetWindowContentScaleCallback. - -The @ref GLFW_SCALE_TO_MONITOR window hint enables automatic resizing of a -window by the content scale of the monitor it is placed, on platforms like -Windows where this is necessary. This takes effect both on creation and when -the window is moved between monitors. It is related to but different from -[GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint). - -For more information see @ref window_scale. - - -@subsubsection setwindowattrib_33 Support for updating window attributes - -GLFW now supports changing the [GLFW_DECORATED](@ref GLFW_DECORATED_attrib), -[GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib), -[GLFW_FLOATING](@ref GLFW_FLOATING_attrib), -[GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and -[GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib) attributes for existing -windows with @ref glfwSetWindowAttrib. - -For more information see @ref window_attribs. - - -@subsubsection raw_motion_33 Support for raw mouse motion - -GLFW now supports raw (unscaled and unaccelerated) mouse motion in disabled -cursor mode with the [GLFW_RAW_MOUSE_MOTION](@ref GLFW_RAW_MOUSE_MOTION) input -mode. Raw mouse motion input is not yet implemented on macOS. Call @ref -glfwRawMouseMotionSupported to check if GLFW can provide raw mouse motion on the -current system. - -For more information see @ref raw_mouse_motion. - - -@subsubsection joysticks_33 Joystick hats - -GLFW can now return the state of hats (i.e. POVs or D-pads) of a joystick with -@ref glfwGetJoystickHats. For compatibility, hats are also exposed as buttons. -This can be disabled with the @ref GLFW_JOYSTICK_HAT_BUTTONS initialization -hint. - -For more information see @ref joystick_hat. - - -@subsubsection geterror_33 Error query - -GLFW now supports querying the last error code for the calling thread and its -human-readable description with @ref glfwGetError. This can be used instead of -or together with the error callback. - -For more information see @ref error_handling. - - -@subsubsection init_hints_33 Support for initialization hints - -GLFW now supports setting library initialization hints with @ref glfwInitHint. -These must be set before initialization to take effect. Some of these hints are -platform specific but are safe to set on any platform. - -For more information see @ref init_hints. - - -@subsubsection attention_33 User attention request - -GLFW now supports requesting user attention with @ref -glfwRequestWindowAttention. Where possible this calls attention to the -specified window. On platforms like macOS it calls attention to the whole -application. - -For more information see @ref window_attention. - - -@subsubsection maximize_33 Window maximization callback - -GLFW now supports notifying the application that the window has been maximized -@ref glfwSetWindowMaximizeCallback. This is called both when the window was -maximized by the user and when it was done with @ref glfwMaximizeWindow. - -For more information see @ref window_maximize. - - -@subsubsection workarea_33 Query for the monitor work area - -GLFW now supports querying the work area of a monitor, i.e. the area not -occupied by task bars or global menu bars, with @ref glfwGetMonitorWorkarea. On -platforms that lack this concept, the whole area of the monitor is returned. - -For more information see @ref monitor_workarea. - - -@subsubsection transparency_33 Transparent windows and framebuffers - -GLFW now supports the creation of windows with transparent framebuffers on -systems with desktop compositing enabled with the @ref -GLFW_TRANSPARENT_FRAMEBUFFER window hint and attribute. This hint must be set -before window creation and leaves any window decorations opaque. - -GLFW now also supports whole window transparency with @ref glfwGetWindowOpacity -and @ref glfwSetWindowOpacity. This value controls the opacity of the whole -window including decorations and unlike framebuffer transparency can be changed -at any time after window creation. - -For more information see @ref window_transparency. - - -@subsubsection key_scancode_33 Query for the scancode of a key - -GLFW now supports querying the platform dependent scancode of any physical key -with @ref glfwGetKeyScancode. - -For more information see @ref input_key. - - -@subsubsection center_cursor_33 Cursor centering window hint - -GLFW now supports controlling whether the cursor is centered over newly created -full screen windows with the [GLFW_CENTER_CURSOR](@ref GLFW_CENTER_CURSOR_hint) -window hint. It is enabled by default. - - -@subsubsection cursor_hover_33 Mouse cursor hover window attribute - -GLFW now supports polling whether the cursor is hovering over the window content -area with the [GLFW_HOVERED](@ref GLFW_HOVERED_attrib) window attribute. This -attribute corresponds to the [cursor enter/leave](@ref cursor_enter) event. - - -@subsubsection focusonshow_33 Window hint and attribute for input focus on show - -GLFW now has the [GLFW_FOCUS_ON_SHOW](@ref GLFW_DECORATED_hint) window hint and -attribute for controlling whether a window gets input focus when shown. It is -enabled by default. It applies both when creating an visible window with @ref -glfwCreateWindow and when showing it with @ref glfwShowWindow. - -This is a workaround for GLFW 3.0 lacking @ref glfwFocusWindow and will be -corrected in the next major version. - -For more information see @ref window_hide. - - -@subsubsection device_userptr_33 Monitor and joystick user pointers - -GLFW now supports setting and querying user pointers for connected monitors and -joysticks with @ref glfwSetMonitorUserPointer, @ref glfwGetMonitorUserPointer, -@ref glfwSetJoystickUserPointer and @ref glfwGetJoystickUserPointer. - -For more information see @ref monitor_userptr and @ref joystick_userptr. - - -@subsubsection macos_nib_33 macOS menu bar from nib file - -GLFW will now load a `MainMenu.nib` file if found in the `Contents/Resources` -directory of the application bundle, as a way to replace the GLFW menu bar -without recompiling GLFW. This behavior can be disabled with the -[GLFW_COCOA_MENUBAR](@ref GLFW_COCOA_MENUBAR_hint) initialization hint. - - -@subsubsection glext_33 Support for more context creation extensions - -The context hint @ref GLFW_SRGB_CAPABLE now supports OpenGL ES via -`WGL_EXT_colorspace`, the context hint @ref GLFW_CONTEXT_NO_ERROR now supports -`WGL_ARB_create_context_no_error` and `GLX_ARB_create_context_no_error`, the -context hint @ref GLFW_CONTEXT_RELEASE_BEHAVIOR now supports -`EGL_KHR_context_flush_control` and @ref glfwGetProcAddress now supports -`EGL_KHR_get_all_proc_addresses`. - - -@subsubsection osmesa_33 OSMesa off-screen context creation support - -GLFW now supports creating off-screen OpenGL contexts using -[OSMesa](https://www.mesa3d.org/osmesa.html) by setting -[GLFW_CONTEXT_CREATION_API](@ref GLFW_CONTEXT_CREATION_API_hint) to -`GLFW_OSMESA_CONTEXT_API`. Native access function have been added to retrieve -the OSMesa color and depth buffers. - -There is also a new null backend that uses OSMesa as its native context -creation API, intended for automated testing. This backend does not provide -input. - - -@subsection caveats_33 Caveats for version 3.3 - -@subsubsection joystick_layout_33 Layout of joysticks have changed - -The way joystick elements are arranged have changed to match SDL2 in order to -support SDL_GameControllerDB mappings. The layout of joysticks may -change again if required for compatibility with SDL2. If you need a known and -stable layout for game controllers, see if you can switch to @ref gamepad. - -Existing code that depends on a specific joystick layout will likely have to be -updated. - - -@subsubsection wait_events_33 No window required to wait for events - -The @ref glfwWaitEvents and @ref glfwWaitEventsTimeout functions no longer need -a window to be created to wait for events. Before version 3.3 these functions -would return immediately if there were no user-created windows. On platforms -where only windows can receive events, an internal helper window is used. - -Existing code that depends on the earlier behavior will likely have to be -updated. - - -@subsubsection gamma_ramp_size_33 Gamma ramp size of 256 may be rejected - -The documentation for versions before 3.3 stated that a gamma ramp size of 256 -would always be accepted. This was never the case on X11 and could lead to -artifacts on macOS. The @ref glfwSetGamma function has been updated to always -generate a ramp of the correct size. - -Existing code that hardcodes a size of 256 should be updated to use the size of -the current ramp of a monitor when setting a new ramp for that monitor. - - -@subsubsection xinput_deadzone_33 Windows XInput deadzone removed - -GLFW no longer applies any deadzone to the input state received from the XInput -API. This was never done for any other platform joystick API so this change -makes the behavior more consistent but you will need to apply your own deadzone -if desired. - - -@subsubsection x11_clipboard_33 X11 clipboard transfer limits - -GLFW now supports reading clipboard text via the `INCR` method, which removes -the limit on how much text can be read with @ref glfwGetClipboardString. -However, writing via this method is not yet supported, so you may not be able to -write a very large string with @ref glfwSetClipboardString even if you read it -from the clipboard earlier. - -The exact size limit for writing to the clipboard is negotiated with each -receiving application but is at least several tens of kilobytes. Note that only -the read limit has changed. Any string that could be written before still can -be. - - -@subsubsection x11_linking_33 X11 extension libraries are loaded dynamically - -GLFW now loads all X11 extension libraries at initialization. The only X11 -library you need to link against is `libX11`. The header files for the -extension libraries are still required for compilation. - -Existing projects and makefiles that link GLFW directly against the extension -libraries should still build correctly but will add these libraries as load-time -dependencies. - - -@subsubsection cmake_version_33 CMake 3.0 or later is required - -The minimum CMake version has been raised from 2.8.12 to 3.0. This is only -a requirement of the GLFW CMake files. The GLFW source files do not depend on -CMake. - - -@subsection deprecations_33 Deprecations in version 3.3 - -@subsubsection charmods_callback_33 Character with modifiers callback - -The character with modifiers callback set with @ref glfwSetCharModsCallback has -been deprecated and should if possible not be used. - -Existing code should still work but further bug fixes will likely not be made. -The callback will be removed in the next major version. - - -@subsubsection clipboard_window_33 Window parameter to clipboard functions - -The window parameter of the clipboard functions @ref glfwGetClipboardString and -@ref glfwSetClipboardString has been deprecated and is no longer used on any -platform. On platforms where the clipboard must be owned by a specific window, -an internal helper window is used. - -Existing code should still work unless it depends on a specific window owning -the clipboard. New code may pass `NULL` as the window argument. The parameter -will be removed in a future release. - - -@subsection removals_33 Removals in 3.3 - -@subsubsection macos_options_33 macOS specific CMake options and macros - -The `GLFW_USE_RETINA`, `GLFW_USE_CHDIR` and `GLFW_USE_MENUBAR` CMake options and -the `_GLFW_USE_RETINA`, `_GLFW_USE_CHDIR` and `_GLFW_USE_MENUBAR` compile-time -macros have been removed. - -These options and macros are replaced by the window hint -[GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint) -and the init hints -[GLFW_COCOA_CHDIR_RESOURCES](@ref GLFW_COCOA_CHDIR_RESOURCES_hint) and -[GLFW_COCOA_MENUBAR](@ref GLFW_COCOA_MENUBAR_hint). - -Existing projects and makefiles that set these options or define these macros -during compilation of GLFW will still build but it will have no effect and the -default behaviors will be used. - - -@subsubsection vulkan_sdk_33 LunarG Vulkan SDK dependency - -The GLFW test programs that previously depended on the LunarG Vulkan SDK now -instead uses a Vulkan loader generated by -[glad2](https://github.com/Dav1dde/glad). This means the GLFW CMake files no -longer look for the Vulkan SDK. - -Existing CMake projects that depended on the Vulkan SDK cache variables from -GLFW will need to call `find_package(Vulkan)` themselves. CMake 3.7 and later -already comes with a -[Vulkan find module](https://cmake.org/cmake/help/latest/module/FindVulkan.html) -similar to the one GLFW previously included. - - -@subsubsection lib_suffix_33 CMake option LIB_SUFFIX - -The `LIB_SUFFIX` CMake option has been removed. GLFW now uses the -GNUInstallDirs CMake package to handle platform specific details like the -library directory suffix and the `LIB_SUFFIX` CMake option has been removed. - -Existing projects and makefiles that set the `LIB_SUFFIX` option will use the -suffix chosen by the GNUInstallDirs package and the option will be ignored. - - -@subsubsection mir_removed_33 Mir support - -The experimental Mir support has been completely removed as the Mir project has -implemented support for the Wayland protocol and is recommending that -applications use that instead. - -Existing projects and makefiles that select Mir when compiling GLFW will fail. -Use Wayland or X11 instead. - - -@subsection symbols_33 New symbols in version 3.3 - -@subsubsection functions_33 New functions in version 3.3 - - - @ref glfwInitHint - - @ref glfwGetError - - @ref glfwGetMonitorWorkarea - - @ref glfwGetMonitorContentScale - - @ref glfwGetMonitorUserPointer - - @ref glfwSetMonitorUserPointer - - @ref glfwWindowHintString - - @ref glfwGetWindowContentScale - - @ref glfwGetWindowOpacity - - @ref glfwSetWindowOpacity - - @ref glfwRequestWindowAttention - - @ref glfwSetWindowAttrib - - @ref glfwSetWindowMaximizeCallback - - @ref glfwSetWindowContentScaleCallback - - @ref glfwRawMouseMotionSupported - - @ref glfwGetKeyScancode - - @ref glfwGetJoystickHats - - @ref glfwGetJoystickGUID - - @ref glfwGetJoystickUserPointer - - @ref glfwSetJoystickUserPointer - - @ref glfwJoystickIsGamepad - - @ref glfwUpdateGamepadMappings - - @ref glfwGetGamepadName - - @ref glfwGetGamepadState - - -@subsubsection types_33 New types in version 3.3 - - - @ref GLFWwindowmaximizefun - - @ref GLFWwindowcontentscalefun - - @ref GLFWgamepadstate - - -@subsubsection constants_33 New constants in version 3.3 - - - @ref GLFW_NO_ERROR - - @ref GLFW_JOYSTICK_HAT_BUTTONS - - @ref GLFW_COCOA_CHDIR_RESOURCES - - @ref GLFW_COCOA_MENUBAR - - @ref GLFW_CENTER_CURSOR - - @ref GLFW_TRANSPARENT_FRAMEBUFFER - - @ref GLFW_HOVERED - - @ref GLFW_FOCUS_ON_SHOW - - @ref GLFW_SCALE_TO_MONITOR - - @ref GLFW_COCOA_RETINA_FRAMEBUFFER - - @ref GLFW_COCOA_FRAME_NAME - - @ref GLFW_COCOA_GRAPHICS_SWITCHING - - @ref GLFW_X11_CLASS_NAME - - @ref GLFW_X11_INSTANCE_NAME - - @ref GLFW_OSMESA_CONTEXT_API - - @ref GLFW_HAT_CENTERED - - @ref GLFW_HAT_UP - - @ref GLFW_HAT_RIGHT - - @ref GLFW_HAT_DOWN - - @ref GLFW_HAT_LEFT - - @ref GLFW_HAT_RIGHT_UP - - @ref GLFW_HAT_RIGHT_DOWN - - @ref GLFW_HAT_LEFT_UP - - @ref GLFW_HAT_LEFT_DOWN - - @ref GLFW_MOD_CAPS_LOCK - - @ref GLFW_MOD_NUM_LOCK - - @ref GLFW_LOCK_KEY_MODS - - @ref GLFW_RAW_MOUSE_MOTION - - @ref GLFW_GAMEPAD_BUTTON_A - - @ref GLFW_GAMEPAD_BUTTON_B - - @ref GLFW_GAMEPAD_BUTTON_X - - @ref GLFW_GAMEPAD_BUTTON_Y - - @ref GLFW_GAMEPAD_BUTTON_LEFT_BUMPER - - @ref GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER - - @ref GLFW_GAMEPAD_BUTTON_BACK - - @ref GLFW_GAMEPAD_BUTTON_START - - @ref GLFW_GAMEPAD_BUTTON_GUIDE - - @ref GLFW_GAMEPAD_BUTTON_LEFT_THUMB - - @ref GLFW_GAMEPAD_BUTTON_RIGHT_THUMB - - @ref GLFW_GAMEPAD_BUTTON_DPAD_UP - - @ref GLFW_GAMEPAD_BUTTON_DPAD_RIGHT - - @ref GLFW_GAMEPAD_BUTTON_DPAD_DOWN - - @ref GLFW_GAMEPAD_BUTTON_DPAD_LEFT - - @ref GLFW_GAMEPAD_BUTTON_LAST - - @ref GLFW_GAMEPAD_BUTTON_CROSS - - @ref GLFW_GAMEPAD_BUTTON_CIRCLE - - @ref GLFW_GAMEPAD_BUTTON_SQUARE - - @ref GLFW_GAMEPAD_BUTTON_TRIANGLE - - @ref GLFW_GAMEPAD_AXIS_LEFT_X - - @ref GLFW_GAMEPAD_AXIS_LEFT_Y - - @ref GLFW_GAMEPAD_AXIS_RIGHT_X - - @ref GLFW_GAMEPAD_AXIS_RIGHT_Y - - @ref GLFW_GAMEPAD_AXIS_LEFT_TRIGGER - - @ref GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER - - @ref GLFW_GAMEPAD_AXIS_LAST - - -@section news_32 Release notes for 3.2 - -These are the release notes for version 3.2. For a more detailed view including -all fixed bugs see the [version history](https://www.glfw.org/changelog.html). - - -@subsection features_32 New features in version 3.2 - -@subsubsection news_32_vulkan Support for Vulkan - -GLFW now supports basic integration with Vulkan with @ref glfwVulkanSupported, -@ref glfwGetRequiredInstanceExtensions, @ref glfwGetInstanceProcAddress, @ref -glfwGetPhysicalDevicePresentationSupport and @ref glfwCreateWindowSurface. -Vulkan header inclusion can be selected with -@ref GLFW_INCLUDE_VULKAN. - - -@subsubsection news_32_setwindowmonitor Window mode switching - -GLFW now supports switching between windowed and full screen modes and updating -the monitor and desired resolution and refresh rate of full screen windows with -@ref glfwSetWindowMonitor. - - -@subsubsection news_32_maximize Window maxmimization support - -GLFW now supports window maximization with @ref glfwMaximizeWindow and the -@ref GLFW_MAXIMIZED window hint and attribute. - - -@subsubsection news_32_focus Window input focus control - -GLFW now supports giving windows input focus with @ref glfwFocusWindow. - - -@subsubsection news_32_sizelimits Window size limit support - -GLFW now supports setting both absolute and relative window size limits with -@ref glfwSetWindowSizeLimits and @ref glfwSetWindowAspectRatio. - - -@subsubsection news_32_keyname Localized key names - -GLFW now supports querying the localized name of printable keys with @ref -glfwGetKeyName, either by key token or by scancode. - - -@subsubsection news_32_waittimeout Wait for events with timeout - -GLFW now supports waiting for events for a set amount of time with @ref -glfwWaitEventsTimeout. - - -@subsubsection news_32_icon Window icon support - -GLFW now supports setting the icon of windows with @ref glfwSetWindowIcon. - - -@subsubsection news_32_timer Raw timer access - -GLFW now supports raw timer values with @ref glfwGetTimerValue and @ref -glfwGetTimerFrequency. - - -@subsubsection news_32_joystick Joystick connection callback - -GLFW now supports notifying when a joystick has been connected or disconnected -with @ref glfwSetJoystickCallback. - - -@subsubsection news_32_noapi Context-less windows - -GLFW now supports creating windows without a OpenGL or OpenGL ES context by -setting the [GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_NO_API`. - - -@subsubsection news_32_contextapi Run-time context creation API selection - -GLFW now supports selecting and querying the context creation API at run-time -with the @ref GLFW_CONTEXT_CREATION_API hint and attribute. - - -@subsubsection news_32_noerror Error-free context creation - -GLFW now supports creating and querying OpenGL and OpenGL ES contexts that do -not emit errors with the @ref GLFW_CONTEXT_NO_ERROR hint, provided the machine -supports the `GL_KHR_no_error` extension. - - -@subsubsection news_32_cmake CMake config-file package support - -GLFW now supports being used as a -[config-file package](@ref build_link_cmake_package) from other projects for -easy linking with the library and its dependencies. - - -@section news_31 Release notes for 3.1 - -These are the release notes for version 3.1. For a more detailed view including -all fixed bugs see the [version history](https://www.glfw.org/changelog.html). - - -@subsection features_31 New features in version 3.1 - -@subsubsection news_31_cursor Custom mouse cursor images - -GLFW now supports creating and setting both custom cursor images and standard -cursor shapes. They are created with @ref glfwCreateCursor or @ref -glfwCreateStandardCursor, set with @ref glfwSetCursor and destroyed with @ref -glfwDestroyCursor. - -@see @ref cursor_object - - -@subsubsection news_31_drop Path drop event - -GLFW now provides a callback for receiving the paths of files and directories -dropped onto GLFW windows. The callback is set with @ref glfwSetDropCallback. - -@see @ref path_drop - - -@subsubsection news_31_emptyevent Main thread wake-up - -GLFW now provides the @ref glfwPostEmptyEvent function for posting an empty -event from another thread to the main thread event queue, causing @ref -glfwWaitEvents to return. - -@see @ref events - - -@subsubsection news_31_framesize Window frame size query - -GLFW now supports querying the size, on each side, of the frame around the -content area of a window, with @ref glfwGetWindowFrameSize. - -@see [Window size](@ref window_size) - - -@subsubsection news_31_autoiconify Simultaneous multi-monitor rendering - -GLFW now supports disabling auto-iconification of full screen windows with -the [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_hint) window hint. This is -intended for people building multi-monitor installations, where you need windows -to stay in full screen despite losing input focus. - - -@subsubsection news_31_floating Floating windows - -GLFW now supports floating windows, also called topmost or always on top, for -easier debugging with the @ref GLFW_FLOATING window hint and attribute. - - -@subsubsection news_31_focused Initially unfocused windows - -GLFW now supports preventing a windowed mode window from gaining input focus on -creation, with the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) window hint. - - -@subsubsection news_31_direct Direct access for window attributes and cursor position - -GLFW now queries the window input focus, visibility and iconification attributes -and the cursor position directly instead of returning cached data. - - -@subsubsection news_31_charmods Character with modifiers callback - -GLFW now provides a callback for character events with modifier key bits. The -callback is set with @ref glfwSetCharModsCallback. Unlike the regular character -callback, this will report character events that will not result in a character -being input, for example if the Control key is held down. - -@see @ref input_char - - -@subsubsection news_31_single Single buffered framebuffers - -GLFW now supports the creation of single buffered windows, with the @ref -GLFW_DOUBLEBUFFER hint. - - -@subsubsection news_31_glext Macro for including extension header - -GLFW now includes the extension header appropriate for the chosen OpenGL or -OpenGL ES header when @ref GLFW_INCLUDE_GLEXT is defined. GLFW does not provide -these headers. They must be provided by your development environment or your -OpenGL or OpenGL ES SDK. - - -@subsubsection news_31_release Context release behaviors - -GLFW now supports controlling and querying whether the pipeline is flushed when -a context is made non-current, with the @ref GLFW_CONTEXT_RELEASE_BEHAVIOR hint -and attribute, provided the machine supports the `GL_KHR_context_flush_control` -extension. - - -@subsubsection news_31_wayland (Experimental) Wayland support - -GLFW now has an _experimental_ Wayland display protocol backend that can be -selected on Linux with a CMake option. - - -@subsubsection news_31_mir (Experimental) Mir support - -GLFW now has an _experimental_ Mir display server backend that can be selected -on Linux with a CMake option. - - -@section news_30 Release notes for 3.0 - -These are the release notes for version 3.0. For a more detailed view including -all fixed bugs see the [version history](https://www.glfw.org/changelog.html). - - -@subsection features_30 New features in version 3.0 - -@subsubsection news_30_cmake CMake build system - -GLFW now uses the CMake build system instead of the various makefiles and -project files used by earlier versions. CMake is available for all platforms -supported by GLFW, is present in most package systems and can generate -makefiles and/or project files for most popular development environments. - -For more information on how to use CMake, see the -[CMake manual](https://cmake.org/cmake/help/documentation.html). - - -@subsubsection news_30_multiwnd Multi-window support - -GLFW now supports the creation of multiple windows, each with their own OpenGL -or OpenGL ES context, and all window functions now take a window handle. Event -callbacks are now per-window and are provided with the handle of the window that -received the event. The @ref glfwMakeContextCurrent function has been added to -select which context is current on a given thread. - - -@subsubsection news_30_multimon Multi-monitor support - -GLFW now explicitly supports multiple monitors. They can be enumerated with -@ref glfwGetMonitors, queried with @ref glfwGetVideoModes, @ref -glfwGetMonitorPos, @ref glfwGetMonitorName and @ref glfwGetMonitorPhysicalSize, -and specified at window creation to make the newly created window full screen on -that specific monitor. - - -@subsubsection news_30_unicode Unicode support - -All string arguments to GLFW functions and all strings returned by GLFW now use -the UTF-8 encoding. This includes the window title, error string, clipboard -text, monitor and joystick names as well as the extension function arguments (as -ASCII is a subset of UTF-8). - - -@subsubsection news_30_clipboard Clipboard text I/O - -GLFW now supports reading and writing plain text to and from the system -clipboard, with the @ref glfwGetClipboardString and @ref glfwSetClipboardString -functions. - - -@subsubsection news_30_gamma Gamma ramp support - -GLFW now supports setting and reading back the gamma ramp of monitors, with the -@ref glfwGetGammaRamp and @ref glfwSetGammaRamp functions. There is also @ref -glfwSetGamma, which generates a ramp from a gamma value and then sets it. - - -@subsubsection news_30_gles OpenGL ES support - -GLFW now supports the creation of OpenGL ES contexts, by setting the -[GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_OPENGL_ES_API`, where -creation of such contexts are supported. Note that GLFW _does not implement_ -OpenGL ES, so your driver must provide support in a way usable by GLFW. Modern -Nvidia and Intel drivers support creation of OpenGL ES context using the GLX and -WGL APIs, while AMD provides an EGL implementation instead. - - -@subsubsection news_30_egl (Experimental) EGL support - -GLFW now has an experimental EGL context creation back end that can be selected -through CMake options. - - -@subsubsection news_30_hidpi High-DPI support - -GLFW now supports high-DPI monitors on both Windows and macOS, giving windows -full resolution framebuffers where other UI elements are scaled up. To achieve -this, @ref glfwGetFramebufferSize and @ref glfwSetFramebufferSizeCallback have -been added. These work with pixels, while the rest of the GLFW API works with -screen coordinates. This is important as OpenGL uses pixels, not screen -coordinates. - - -@subsubsection news_30_error Error callback - -GLFW now has an error callback, which can provide your application with much -more detailed diagnostics than was previously possible. The callback is passed -an error code and a description string. - - -@subsubsection news_30_wndptr Per-window user pointer - -Each window now has a user-defined pointer, retrieved with @ref -glfwGetWindowUserPointer and set with @ref glfwSetWindowUserPointer, to make it -easier to integrate GLFW into C++ code. - - -@subsubsection news_30_iconifyfun Window iconification callback - -Each window now has a callback for iconification and restoration events, -which is set with @ref glfwSetWindowIconifyCallback. - - -@subsubsection news_30_wndposfun Window position callback - -Each window now has a callback for position events, which is set with @ref -glfwSetWindowPosCallback. - - -@subsubsection news_30_wndpos Window position query - -The position of a window can now be retrieved using @ref glfwGetWindowPos. - - -@subsubsection news_30_focusfun Window focus callback - -Each windows now has a callback for focus events, which is set with @ref -glfwSetWindowFocusCallback. - - -@subsubsection news_30_enterleave Cursor enter/leave callback - -Each window now has a callback for when the mouse cursor enters or leaves its -content area, which is set with @ref glfwSetCursorEnterCallback. - - -@subsubsection news_30_wndtitle Initial window title - -The title of a window is now specified at creation time, as one of the arguments -to @ref glfwCreateWindow. - - -@subsubsection news_30_hidden Hidden windows - -Windows can now be hidden with @ref glfwHideWindow, shown using @ref -glfwShowWindow and created initially hidden with the @ref GLFW_VISIBLE window -hint and attribute. This allows for off-screen rendering in a way compatible -with most drivers, as well as moving a window to a specific position before -showing it. - - -@subsubsection news_30_undecorated Undecorated windows - -Windowed mode windows can now be created without decorations, e.g. things like -a frame, a title bar, with the @ref GLFW_DECORATED window hint and attribute. -This allows for the creation of things like splash screens. - - -@subsubsection news_30_keymods Modifier key bit masks - -[Modifier key bit mask](@ref mods) parameters have been added to the -[mouse button](@ref GLFWmousebuttonfun) and [key](@ref GLFWkeyfun) callbacks. - - -@subsubsection news_30_scancode Platform-specific scancodes - -A scancode parameter has been added to the [key callback](@ref GLFWkeyfun). Keys -that don't have a [key token](@ref keys) still get passed on with the key -parameter set to `GLFW_KEY_UNKNOWN`. These scancodes will vary between machines -and are intended to be used for key bindings. - - -@subsubsection news_30_jsname Joystick names - -The name of a joystick can now be retrieved using @ref glfwGetJoystickName. - - -@subsubsection news_30_doxygen Doxygen documentation - -You are reading it. - -*/ diff --git a/third_party/penumbra/vendor/glfw/docs/quick.dox b/third_party/penumbra/vendor/glfw/docs/quick.dox deleted file mode 100644 index 73070f4a9ee..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/quick.dox +++ /dev/null @@ -1,362 +0,0 @@ -/*! - -@page quick_guide Getting started - -@tableofcontents - -This guide takes you through writing a simple application using GLFW 3. The -application will create a window and OpenGL context, render a rotating triangle -and exit when the user closes the window or presses _Escape_. This guide will -introduce a few of the most commonly used functions, but there are many more. - -This guide assumes no experience with earlier versions of GLFW. If you -have used GLFW 2 in the past, read @ref moving_guide, as some functions -behave differently in GLFW 3. - - -@section quick_steps Step by step - -@subsection quick_include Including the GLFW header - -In the source files of your application where you use OpenGL or GLFW, you need -to include the GLFW 3 header file. - -@code -#include -@endcode - -This defines all the constants, types and function prototypes of the GLFW API. -It also includes the OpenGL header from your development environment and -defines all the constants and types necessary for it to work on your platform -without including any platform-specific headers. - -In other words: - -- Do _not_ include the OpenGL header yourself, as GLFW does this for you in - a platform-independent way -- Do _not_ include `windows.h` or other platform-specific headers unless - you plan on using those APIs yourself -- If you _do_ need to include such headers, include them _before_ the GLFW - header and it will detect this - -On some platforms supported by GLFW the OpenGL header and link library only -expose older versions of OpenGL. The most extreme case is Windows, which only -exposes OpenGL 1.2. The easiest way to work around this is to use an -[extension loader library](@ref context_glext_auto). - -If you are using such a library then you should include its header _before_ the -GLFW header. This lets it replace the OpenGL header included by GLFW without -conflicts. This example uses -[glad2](https://github.com/Dav1dde/glad), but the same rule applies to all such -libraries. - -@code -#include -#include -@endcode - - -@subsection quick_init_term Initializing and terminating GLFW - -Before you can use most GLFW functions, the library must be initialized. On -successful initialization, `GLFW_TRUE` is returned. If an error occurred, -`GLFW_FALSE` is returned. - -@code -if (!glfwInit()) -{ - // Initialization failed -} -@endcode - -Note that `GLFW_TRUE` and `GLFW_FALSE` are and will always be one and zero. - -When you are done using GLFW, typically just before the application exits, you -need to terminate GLFW. - -@code -glfwTerminate(); -@endcode - -This destroys any remaining windows and releases any other resources allocated by -GLFW. After this call, you must initialize GLFW again before using any GLFW -functions that require it. - - -@subsection quick_capture_error Setting an error callback - -Most events are reported through callbacks, whether it's a key being pressed, -a GLFW window being moved, or an error occurring. Callbacks are C functions (or -C++ static methods) that are called by GLFW with arguments describing the event. - -In case a GLFW function fails, an error is reported to the GLFW error callback. -You can receive these reports with an error callback. This function must have -the signature below but may do anything permitted in other callbacks. - -@code -void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} -@endcode - -Callback functions must be set, so GLFW knows to call them. The function to set -the error callback is one of the few GLFW functions that may be called before -initialization, which lets you be notified of errors both during and after -initialization. - -@code -glfwSetErrorCallback(error_callback); -@endcode - - -@subsection quick_create_window Creating a window and context - -The window and its OpenGL context are created with a single call to @ref -glfwCreateWindow, which returns a handle to the created combined window and -context object - -@code -GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL); -if (!window) -{ - // Window or OpenGL context creation failed -} -@endcode - -This creates a 640 by 480 windowed mode window with an OpenGL context. If -window or OpenGL context creation fails, `NULL` will be returned. You should -always check the return value. While window creation rarely fails, context -creation depends on properly installed drivers and may fail even on machines -with the necessary hardware. - -By default, the OpenGL context GLFW creates may have any version. You can -require a minimum OpenGL version by setting the `GLFW_CONTEXT_VERSION_MAJOR` and -`GLFW_CONTEXT_VERSION_MINOR` hints _before_ creation. If the required minimum -version is not supported on the machine, context (and window) creation fails. - -@code -glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); -glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); -GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL); -if (!window) -{ - // Window or context creation failed -} -@endcode - -The window handle is passed to all window related functions and is provided to -along to all window related callbacks, so they can tell which window received -the event. - -When a window and context is no longer needed, destroy it. - -@code -glfwDestroyWindow(window); -@endcode - -Once this function is called, no more events will be delivered for that window -and its handle becomes invalid. - - -@subsection quick_context_current Making the OpenGL context current - -Before you can use the OpenGL API, you must have a current OpenGL context. - -@code -glfwMakeContextCurrent(window); -@endcode - -The context will remain current until you make another context current or until -the window owning the current context is destroyed. - -If you are using an [extension loader library](@ref context_glext_auto) to -access modern OpenGL then this is when to initialize it, as the loader needs -a current context to load from. This example uses -[glad](https://github.com/Dav1dde/glad), but the same rule applies to all such -libraries. - -@code -gladLoadGL(glfwGetProcAddress); -@endcode - - -@subsection quick_window_close Checking the window close flag - -Each window has a flag indicating whether the window should be closed. - -When the user attempts to close the window, either by pressing the close widget -in the title bar or using a key combination like Alt+F4, this flag is set to 1. -Note that __the window isn't actually closed__, so you are expected to monitor -this flag and either destroy the window or give some kind of feedback to the -user. - -@code -while (!glfwWindowShouldClose(window)) -{ - // Keep running -} -@endcode - -You can be notified when the user is attempting to close the window by setting -a close callback with @ref glfwSetWindowCloseCallback. The callback will be -called immediately after the close flag has been set. - -You can also set it yourself with @ref glfwSetWindowShouldClose. This can be -useful if you want to interpret other kinds of input as closing the window, like -for example pressing the _Escape_ key. - - -@subsection quick_key_input Receiving input events - -Each window has a large number of callbacks that can be set to receive all the -various kinds of events. To receive key press and release events, create a key -callback function. - -@code -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) - glfwSetWindowShouldClose(window, GLFW_TRUE); -} -@endcode - -The key callback, like other window related callbacks, are set per-window. - -@code -glfwSetKeyCallback(window, key_callback); -@endcode - -In order for event callbacks to be called when events occur, you need to process -events as described below. - - -@subsection quick_render Rendering with OpenGL - -Once you have a current OpenGL context, you can use OpenGL normally. In this -tutorial, a multi-colored rotating triangle will be rendered. The framebuffer -size needs to be retrieved for `glViewport`. - -@code -int width, height; -glfwGetFramebufferSize(window, &width, &height); -glViewport(0, 0, width, height); -@endcode - -You can also set a framebuffer size callback using @ref -glfwSetFramebufferSizeCallback and be notified when the size changes. - -Actual rendering with OpenGL is outside the scope of this tutorial, but there -are [many](https://open.gl/) [excellent](https://learnopengl.com/) -[tutorial](http://openglbook.com/) [sites](http://ogldev.atspace.co.uk/) that -teach modern OpenGL. Some of them use GLFW to create the context and window -while others use GLUT or SDL, but remember that OpenGL itself always works the -same. - - -@subsection quick_timer Reading the timer - -To create smooth animation, a time source is needed. GLFW provides a timer that -returns the number of seconds since initialization. The time source used is the -most accurate on each platform and generally has micro- or nanosecond -resolution. - -@code -double time = glfwGetTime(); -@endcode - - -@subsection quick_swap_buffers Swapping buffers - -GLFW windows by default use double buffering. That means that each window has -two rendering buffers; a front buffer and a back buffer. The front buffer is -the one being displayed and the back buffer the one you render to. - -When the entire frame has been rendered, the buffers need to be swapped with one -another, so the back buffer becomes the front buffer and vice versa. - -@code -glfwSwapBuffers(window); -@endcode - -The swap interval indicates how many frames to wait until swapping the buffers, -commonly known as _vsync_. By default, the swap interval is zero, meaning -buffer swapping will occur immediately. On fast machines, many of those frames -will never be seen, as the screen is still only updated typically 60-75 times -per second, so this wastes a lot of CPU and GPU cycles. - -Also, because the buffers will be swapped in the middle the screen update, -leading to [screen tearing](https://en.wikipedia.org/wiki/Screen_tearing). - -For these reasons, applications will typically want to set the swap interval to -one. It can be set to higher values, but this is usually not recommended, -because of the input latency it leads to. - -@code -glfwSwapInterval(1); -@endcode - -This function acts on the current context and will fail unless a context is -current. - - -@subsection quick_process_events Processing events - -GLFW needs to communicate regularly with the window system both in order to -receive events and to show that the application hasn't locked up. Event -processing must be done regularly while you have visible windows and is normally -done each frame after buffer swapping. - -There are two methods for processing pending events; polling and waiting. This -example will use event polling, which processes only those events that have -already been received and then returns immediately. - -@code -glfwPollEvents(); -@endcode - -This is the best choice when rendering continually, like most games do. If -instead you only need to update your rendering once you have received new input, -@ref glfwWaitEvents is a better choice. It waits until at least one event has -been received, putting the thread to sleep in the meantime, and then processes -all received events. This saves a great deal of CPU cycles and is useful for, -for example, many kinds of editing tools. - - -@section quick_example Putting it together - -Now that you know how to initialize GLFW, create a window and poll for -keyboard input, it's possible to create a simple program. - -This program creates a 640 by 480 windowed mode window and starts a loop that -clears the screen, renders a triangle and processes events until the user either -presses _Escape_ or closes the window. - -@snippet simple.c code - -The program above can be found in the -[source package](https://www.glfw.org/download.html) as `examples/simple.c` -and is compiled along with all other examples when you build GLFW. If you -built GLFW from the source package then you already have this as `simple.exe` on -Windows, `simple` on Linux or `simple.app` on macOS. - -This tutorial used only a few of the many functions GLFW provides. There are -guides for each of the areas covered by GLFW. Each guide will introduce all the -functions for that category. - - - @ref intro_guide - - @ref window_guide - - @ref context_guide - - @ref monitor_guide - - @ref input_guide - -You can access reference documentation for any GLFW function by clicking it and -the reference for each function links to related functions and guide sections. - -The tutorial ends here. Once you have written a program that uses GLFW, you -will need to compile and link it. How to do that depends on the development -environment you are using and is best explained by the documentation for that -environment. To learn about the details that are specific to GLFW, see -@ref build_guide. - -*/ diff --git a/third_party/penumbra/vendor/glfw/docs/spaces.svg b/third_party/penumbra/vendor/glfw/docs/spaces.svg deleted file mode 100644 index 5b326460924..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/spaces.svg +++ /dev/null @@ -1,877 +0,0 @@ - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/third_party/penumbra/vendor/glfw/docs/vulkan.dox b/third_party/penumbra/vendor/glfw/docs/vulkan.dox deleted file mode 100644 index dc158d6dafd..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/vulkan.dox +++ /dev/null @@ -1,230 +0,0 @@ -/*! - -@page vulkan_guide Vulkan guide - -@tableofcontents - -This guide is intended to fill the gaps between the [Vulkan -documentation](https://www.khronos.org/vulkan/) and the rest of the GLFW -documentation and is not a replacement for either. It assumes some familiarity -with Vulkan concepts like loaders, devices, queues and surfaces and leaves it to -the Vulkan documentation to explain the details of Vulkan functions. - -To develop for Vulkan you should download the [LunarG Vulkan -SDK](https://vulkan.lunarg.com/) for your platform. Apart from headers and link -libraries, they also provide the validation layers necessary for development. - -For details on a specific function in this category, see the @ref vulkan. There -are also guides for the other areas of the GLFW API. - - - @ref intro_guide - - @ref window_guide - - @ref context_guide - - @ref monitor_guide - - @ref input_guide - - -@section vulkan_loader Linking against the Vulkan loader - -By default, GLFW will look for the Vulkan loader on demand at runtime via its -standard name (`vulkan-1.dll` on Windows, `libvulkan.so.1` on Linux and other -Unix-like systems and `libvulkan.1.dylib` on macOS). This means that GLFW does -not need to be linked against the loader. However, it also means that if you -are using the static library form of the Vulkan loader GLFW will either fail to -find it or (worse) use the wrong one. - -The @ref GLFW_VULKAN_STATIC CMake option makes GLFW call the Vulkan loader -directly instead of dynamically loading it at runtime. Not linking against the -Vulkan loader will then be a compile-time error. - -@macos Because the Vulkan loader and ICD are not installed globally on macOS, -you need to set up the application bundle according to the LunarG SDK -documentation. This is explained in more detail in the -[SDK documentation for macOS](https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html). - - -@section vulkan_include Including the Vulkan and GLFW header files - -To include the Vulkan header, define @ref GLFW_INCLUDE_VULKAN before including -the GLFW header. - -@code -#define GLFW_INCLUDE_VULKAN -#include -@endcode - -If you instead want to include the Vulkan header from a custom location or use -your own custom Vulkan header then do this before the GLFW header. - -@code -#include -#include -@endcode - -Unless a Vulkan header is included, either by the GLFW header or above it, any -GLFW functions that take or return Vulkan types will not be declared. - -The `VK_USE_PLATFORM_*_KHR` macros do not need to be defined for the Vulkan part -of GLFW to work. Define them only if you are using these extensions directly. - - -@section vulkan_support Querying for Vulkan support - -If you are linking directly against the Vulkan loader then you can skip this -section. The canonical desktop loader library exports all Vulkan core and -Khronos extension functions, allowing them to be called directly. - -If you are loading the Vulkan loader dynamically instead of linking directly -against it, you can check for the availability of a loader and ICD with @ref -glfwVulkanSupported. - -@code -if (glfwVulkanSupported()) -{ - // Vulkan is available, at least for compute -} -@endcode - -This function returns `GLFW_TRUE` if the Vulkan loader and any minimally -functional ICD was found. - -If if one or both were not found, calling any other Vulkan related GLFW function -will generate a @ref GLFW_API_UNAVAILABLE error. - - -@subsection vulkan_proc Querying Vulkan function pointers - -To load any Vulkan core or extension function from the found loader, call @ref -glfwGetInstanceProcAddress. To load functions needed for instance creation, -pass `NULL` as the instance. - -@code -PFN_vkCreateInstance pfnCreateInstance = (PFN_vkCreateInstance) - glfwGetInstanceProcAddress(NULL, "vkCreateInstance"); -@endcode - -Once you have created an instance, you can load from it all other Vulkan core -functions and functions from any instance extensions you enabled. - -@code -PFN_vkCreateDevice pfnCreateDevice = (PFN_vkCreateDevice) - glfwGetInstanceProcAddress(instance, "vkCreateDevice"); -@endcode - -This function in turn calls `vkGetInstanceProcAddr`. If that fails, the -function falls back to a platform-specific query of the Vulkan loader (i.e. -`dlsym` or `GetProcAddress`). If that also fails, the function returns `NULL`. -For more information about `vkGetInstanceProcAddr`, see the Vulkan -documentation. - -Vulkan also provides `vkGetDeviceProcAddr` for loading device-specific versions -of Vulkan function. This function can be retrieved from an instance with @ref -glfwGetInstanceProcAddress. - -@code -PFN_vkGetDeviceProcAddr pfnGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr) - glfwGetInstanceProcAddress(instance, "vkGetDeviceProcAddr"); -@endcode - -Device-specific functions may execute a little bit faster, due to not having to -dispatch internally based on the device passed to them. For more information -about `vkGetDeviceProcAddr`, see the Vulkan documentation. - - -@section vulkan_ext Querying required Vulkan extensions - -To do anything useful with Vulkan you need to create an instance. If you want -to use Vulkan to render to a window, you must enable the instance extensions -GLFW requires to create Vulkan surfaces. - -To query the instance extensions required, call @ref -glfwGetRequiredInstanceExtensions. - -@code -uint32_t count; -const char** extensions = glfwGetRequiredInstanceExtensions(&count); -@endcode - -These extensions must all be enabled when creating instances that are going to -be passed to @ref glfwGetPhysicalDevicePresentationSupport and @ref -glfwCreateWindowSurface. The set of extensions will vary depending on platform -and may also vary depending on graphics drivers and other factors. - -If it fails it will return `NULL` and GLFW will not be able to create Vulkan -window surfaces. You can still use Vulkan for off-screen rendering and compute -work. - -If successful the returned array will always include `VK_KHR_surface`, so if -you don't require any additional extensions you can pass this list directly to -the `VkInstanceCreateInfo` struct. - -@code -VkInstanceCreateInfo ici; - -memset(&ici, 0, sizeof(ici)); -ici.enabledExtensionCount = count; -ici.ppEnabledExtensionNames = extensions; -... -@endcode - -Additional extensions may be required by future versions of GLFW. You should -check whether any extensions you wish to enable are already in the returned -array, as it is an error to specify an extension more than once in the -`VkInstanceCreateInfo` struct. - - -@section vulkan_present Querying for Vulkan presentation support - -Not every queue family of every Vulkan device can present images to surfaces. -To check whether a specific queue family of a physical device supports image -presentation without first having to create a window and surface, call @ref -glfwGetPhysicalDevicePresentationSupport. - -@code -if (glfwGetPhysicalDevicePresentationSupport(instance, physical_device, queue_family_index)) -{ - // Queue family supports image presentation -} -@endcode - -The `VK_KHR_surface` extension additionally provides the -`vkGetPhysicalDeviceSurfaceSupportKHR` function, which performs the same test on -an existing Vulkan surface. - - -@section vulkan_window Creating the window - -Unless you will be using OpenGL or OpenGL ES with the same window as Vulkan, -there is no need to create a context. You can disable context creation with the -[GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint. - -@code -glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); -GLFWwindow* window = glfwCreateWindow(640, 480, "Window Title", NULL, NULL); -@endcode - -See @ref context_less for more information. - - -@section vulkan_surface Creating a Vulkan window surface - -You can create a Vulkan surface (as defined by the `VK_KHR_surface` extension) -for a GLFW window with @ref glfwCreateWindowSurface. - -@code -VkSurfaceKHR surface; -VkResult err = glfwCreateWindowSurface(instance, window, NULL, &surface); -if (err) -{ - // Window surface creation failed -} -@endcode - -If an OpenGL or OpenGL ES context was created on the window, the context has -ownership of the presentation on the window and a Vulkan surface cannot be -created. - -It is your responsibility to destroy the surface. GLFW does not destroy it for -you. Call `vkDestroySurfaceKHR` function from the same extension to destroy it. - -*/ diff --git a/third_party/penumbra/vendor/glfw/docs/window.dox b/third_party/penumbra/vendor/glfw/docs/window.dox deleted file mode 100644 index 6109fbf55aa..00000000000 --- a/third_party/penumbra/vendor/glfw/docs/window.dox +++ /dev/null @@ -1,1434 +0,0 @@ -/*! - -@page window_guide Window guide - -@tableofcontents - -This guide introduces the window related functions of GLFW. For details on -a specific function in this category, see the @ref window. There are also -guides for the other areas of GLFW. - - - @ref intro_guide - - @ref context_guide - - @ref vulkan_guide - - @ref monitor_guide - - @ref input_guide - - -@section window_object Window objects - -The @ref GLFWwindow object encapsulates both a window and a context. They are -created with @ref glfwCreateWindow and destroyed with @ref glfwDestroyWindow, or -@ref glfwTerminate, if any remain. As the window and context are inseparably -linked, the object pointer is used as both a context and window handle. - -To see the event stream provided to the various window related callbacks, run -the `events` test program. - - -@subsection window_creation Window creation - -A window and its OpenGL or OpenGL ES context are created with @ref -glfwCreateWindow, which returns a handle to the created window object. For -example, this creates a 640 by 480 windowed mode window: - -@code -GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL); -@endcode - -If window creation fails, `NULL` will be returned, so it is necessary to check -the return value. - -The window handle is passed to all window related functions and is provided to -along with all input events, so event handlers can tell which window received -the event. - - -@subsubsection window_full_screen Full screen windows - -To create a full screen window, you need to specify which monitor the window -should use. In most cases, the user's primary monitor is a good choice. -For more information about retrieving monitors, see @ref monitor_monitors. - -@code -GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", glfwGetPrimaryMonitor(), NULL); -@endcode - -Full screen windows cover the entire display area of a monitor, have no border -or decorations. - -Windowed mode windows can be made full screen by setting a monitor with @ref -glfwSetWindowMonitor, and full screen ones can be made windowed by unsetting it -with the same function. - -Each field of the @ref GLFWvidmode structure corresponds to a function parameter -or window hint and combine to form the _desired video mode_ for that window. -The supported video mode most closely matching the desired video mode will be -set for the chosen monitor as long as the window has input focus. For more -information about retrieving video modes, see @ref monitor_modes. - -Video mode field | Corresponds to ----------------- | -------------- -GLFWvidmode.width | `width` parameter of @ref glfwCreateWindow -GLFWvidmode.height | `height` parameter of @ref glfwCreateWindow -GLFWvidmode.redBits | @ref GLFW_RED_BITS hint -GLFWvidmode.greenBits | @ref GLFW_GREEN_BITS hint -GLFWvidmode.blueBits | @ref GLFW_BLUE_BITS hint -GLFWvidmode.refreshRate | @ref GLFW_REFRESH_RATE hint - -Once you have a full screen window, you can change its resolution, refresh rate -and monitor with @ref glfwSetWindowMonitor. If you only need change its -resolution you can also call @ref glfwSetWindowSize. In all cases, the new -video mode will be selected the same way as the video mode chosen by @ref -glfwCreateWindow. If the window has an OpenGL or OpenGL ES context, it will be -unaffected. - -By default, the original video mode of the monitor will be restored and the -window iconified if it loses input focus, to allow the user to switch back to -the desktop. This behavior can be disabled with the -[GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_hint) window hint, for example if you -wish to simultaneously cover multiple monitors with full screen windows. - -If a monitor is disconnected, all windows that are full screen on that monitor -will be switched to windowed mode. See @ref monitor_event for more information. - - -@subsubsection window_windowed_full_screen "Windowed full screen" windows - -If the closest match for the desired video mode is the current one, the video -mode will not be changed, making window creation faster and application -switching much smoother. This is sometimes called _windowed full screen_ or -_borderless full screen_ window and counts as a full screen window. To create -such a window, request the current video mode. - -@code -const GLFWvidmode* mode = glfwGetVideoMode(monitor); - -glfwWindowHint(GLFW_RED_BITS, mode->redBits); -glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); -glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits); -glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate); - -GLFWwindow* window = glfwCreateWindow(mode->width, mode->height, "My Title", monitor, NULL); -@endcode - -This also works for windowed mode windows that are made full screen. - -@code -const GLFWvidmode* mode = glfwGetVideoMode(monitor); - -glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, mode->refreshRate); -@endcode - -Note that @ref glfwGetVideoMode returns the _current_ video mode of a monitor, -so if you already have a full screen window on that monitor that you want to -make windowed full screen, you need to have saved the desktop resolution before. - - -@subsection window_destruction Window destruction - -When a window is no longer needed, destroy it with @ref glfwDestroyWindow. - -@code -glfwDestroyWindow(window); -@endcode - -Window destruction always succeeds. Before the actual destruction, all -callbacks are removed so no further events will be delivered for the window. -All windows remaining when @ref glfwTerminate is called are destroyed as well. - -When a full screen window is destroyed, the original video mode of its monitor -is restored, but the gamma ramp is left untouched. - - -@subsection window_hints Window creation hints - -There are a number of hints that can be set before the creation of a window and -context. Some affect the window itself, others affect the framebuffer or -context. These hints are set to their default values each time the library is -initialized with @ref glfwInit. Integer value hints can be set individually -with @ref glfwWindowHint and string value hints with @ref glfwWindowHintString. -You can reset all at once to their defaults with @ref glfwDefaultWindowHints. - -Some hints are platform specific. These are always valid to set on any -platform but they will only affect their specific platform. Other platforms -will ignore them. Setting these hints requires no platform specific headers or -calls. - -@note Window hints need to be set before the creation of the window and context -you wish to have the specified attributes. They function as additional -arguments to @ref glfwCreateWindow. - - -@subsubsection window_hints_hard Hard and soft constraints - -Some window hints are hard constraints. These must match the available -capabilities _exactly_ for window and context creation to succeed. Hints -that are not hard constraints are matched as closely as possible, but the -resulting context and framebuffer may differ from what these hints requested. - -The following hints are always hard constraints: -- @ref GLFW_STEREO -- @ref GLFW_DOUBLEBUFFER -- [GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) -- [GLFW_CONTEXT_CREATION_API](@ref GLFW_CONTEXT_CREATION_API_hint) - -The following additional hints are hard constraints when requesting an OpenGL -context, but are ignored when requesting an OpenGL ES context: -- [GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) -- [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) - - -@subsubsection window_hints_wnd Window related hints - -@anchor GLFW_RESIZABLE_hint -__GLFW_RESIZABLE__ specifies whether the windowed mode window will be resizable -_by the user_. The window will still be resizable using the @ref -glfwSetWindowSize function. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. -This hint is ignored for full screen and undecorated windows. - -@anchor GLFW_VISIBLE_hint -__GLFW_VISIBLE__ specifies whether the windowed mode window will be initially -visible. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This hint is -ignored for full screen windows. - -@anchor GLFW_DECORATED_hint -__GLFW_DECORATED__ specifies whether the windowed mode window will have window -decorations such as a border, a close widget, etc. An undecorated window will -not be resizable by the user but will still allow the user to generate close -events on some platforms. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. -This hint is ignored for full screen windows. - -@anchor GLFW_FOCUSED_hint -__GLFW_FOCUSED__ specifies whether the windowed mode window will be given input -focus when created. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This -hint is ignored for full screen and initially hidden windows. - -@anchor GLFW_AUTO_ICONIFY_hint -__GLFW_AUTO_ICONIFY__ specifies whether the full screen window will -automatically iconify and restore the previous video mode on input focus loss. -Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This hint is ignored for -windowed mode windows. - -@anchor GLFW_FLOATING_hint -__GLFW_FLOATING__ specifies whether the windowed mode window will be floating -above other regular windows, also called topmost or always-on-top. This is -intended primarily for debugging purposes and cannot be used to implement proper -full screen windows. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This -hint is ignored for full screen windows. - -@anchor GLFW_MAXIMIZED_hint -__GLFW_MAXIMIZED__ specifies whether the windowed mode window will be maximized -when created. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This hint is -ignored for full screen windows. - -@anchor GLFW_CENTER_CURSOR_hint -__GLFW_CENTER_CURSOR__ specifies whether the cursor should be centered over -newly created full screen windows. Possible values are `GLFW_TRUE` and -`GLFW_FALSE`. This hint is ignored for windowed mode windows. - -@anchor GLFW_TRANSPARENT_FRAMEBUFFER_hint -__GLFW_TRANSPARENT_FRAMEBUFFER__ specifies whether the window framebuffer will -be transparent. If enabled and supported by the system, the window framebuffer -alpha channel will be used to combine the framebuffer with the background. This -does not affect window decorations. Possible values are `GLFW_TRUE` and -`GLFW_FALSE`. - -@par -@win32 GLFW sets a color key for the window to work around repainting issues -with a transparent framebuffer. The chosen color value is RGB 255,0,255 -(magenta). This will make pixels with that exact color fully transparent -regardless of their alpha values. If this is a problem, make these pixels any -other color before buffer swap. - -@anchor GLFW_FOCUS_ON_SHOW_hint -__GLFW_FOCUS_ON_SHOW__ specifies whether the window will be given input -focus when @ref glfwShowWindow is called. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. - -@anchor GLFW_SCALE_TO_MONITOR -__GLFW_SCALE_TO_MONITOR__ specified whether the window content area should be -resized based on the [monitor content scale](@ref monitor_scale) of any monitor -it is placed on. This includes the initial placement when the window is -created. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. - -This hint only has an effect on platforms where screen coordinates and pixels -always map 1:1 such as Windows and X11. On platforms like macOS the resolution -of the framebuffer is changed independently of the window size. - - -@subsubsection window_hints_fb Framebuffer related hints - -@anchor GLFW_RED_BITS -@anchor GLFW_GREEN_BITS -@anchor GLFW_BLUE_BITS -@anchor GLFW_ALPHA_BITS -@anchor GLFW_DEPTH_BITS -@anchor GLFW_STENCIL_BITS -__GLFW_RED_BITS__, __GLFW_GREEN_BITS__, __GLFW_BLUE_BITS__, __GLFW_ALPHA_BITS__, -__GLFW_DEPTH_BITS__ and __GLFW_STENCIL_BITS__ specify the desired bit depths of -the various components of the default framebuffer. A value of `GLFW_DONT_CARE` -means the application has no preference. - -@anchor GLFW_ACCUM_RED_BITS -@anchor GLFW_ACCUM_GREEN_BITS -@anchor GLFW_ACCUM_BLUE_BITS -@anchor GLFW_ACCUM_ALPHA_BITS -__GLFW_ACCUM_RED_BITS__, __GLFW_ACCUM_GREEN_BITS__, __GLFW_ACCUM_BLUE_BITS__ and -__GLFW_ACCUM_ALPHA_BITS__ specify the desired bit depths of the various -components of the accumulation buffer. A value of `GLFW_DONT_CARE` means the -application has no preference. - -@par -Accumulation buffers are a legacy OpenGL feature and should not be used in new -code. - -@anchor GLFW_AUX_BUFFERS -__GLFW_AUX_BUFFERS__ specifies the desired number of auxiliary buffers. A value -of `GLFW_DONT_CARE` means the application has no preference. - -@par -Auxiliary buffers are a legacy OpenGL feature and should not be used in new -code. - -@anchor GLFW_STEREO -__GLFW_STEREO__ specifies whether to use OpenGL stereoscopic rendering. -Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This is a hard constraint. - -@anchor GLFW_SAMPLES -__GLFW_SAMPLES__ specifies the desired number of samples to use for -multisampling. Zero disables multisampling. A value of `GLFW_DONT_CARE` means -the application has no preference. - -@anchor GLFW_SRGB_CAPABLE -__GLFW_SRGB_CAPABLE__ specifies whether the framebuffer should be sRGB capable. -Possible values are `GLFW_TRUE` and `GLFW_FALSE`. - -@par -__OpenGL:__ If enabled and supported by the system, the `GL_FRAMEBUFFER_SRGB` -enable will control sRGB rendering. By default, sRGB rendering will be -disabled. - -@par -__OpenGL ES:__ If enabled and supported by the system, the context will always -have sRGB rendering enabled. - -@anchor GLFW_DOUBLEBUFFER -__GLFW_DOUBLEBUFFER__ specifies whether the framebuffer should be double -buffered. You nearly always want to use double buffering. This is a hard -constraint. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. - - -@subsubsection window_hints_mtr Monitor related hints - -@anchor GLFW_REFRESH_RATE -__GLFW_REFRESH_RATE__ specifies the desired refresh rate for full screen -windows. A value of `GLFW_DONT_CARE` means the highest available refresh rate -will be used. This hint is ignored for windowed mode windows. - - -@subsubsection window_hints_ctx Context related hints - -@anchor GLFW_CLIENT_API_hint -__GLFW_CLIENT_API__ specifies which client API to create the context for. -Possible values are `GLFW_OPENGL_API`, `GLFW_OPENGL_ES_API` and `GLFW_NO_API`. -This is a hard constraint. - -@anchor GLFW_CONTEXT_CREATION_API_hint -__GLFW_CONTEXT_CREATION_API__ specifies which context creation API to use to -create the context. Possible values are `GLFW_NATIVE_CONTEXT_API`, -`GLFW_EGL_CONTEXT_API` and `GLFW_OSMESA_CONTEXT_API`. This is a hard -constraint. If no client API is requested, this hint is ignored. - -@par -@macos The EGL API is not available on this platform and requests to use it -will fail. - -@par -__Wayland:__ The EGL API _is_ the native context creation API, so this hint -will have no effect. - -@par -__OSMesa:__ As its name implies, an OpenGL context created with OSMesa does not -update the window contents when its buffers are swapped. Use OpenGL functions -or the OSMesa native access functions @ref glfwGetOSMesaColorBuffer and @ref -glfwGetOSMesaDepthBuffer to retrieve the framebuffer contents. - -@note An OpenGL extension loader library that assumes it knows which context -creation API is used on a given platform may fail if you change this hint. This -can be resolved by having it load via @ref glfwGetProcAddress, which always uses -the selected API. - -@bug On some Linux systems, creating contexts via both the native and EGL APIs -in a single process will cause the application to segfault. Stick to one API or -the other on Linux for now. - -@anchor GLFW_CONTEXT_VERSION_MAJOR_hint -@anchor GLFW_CONTEXT_VERSION_MINOR_hint -__GLFW_CONTEXT_VERSION_MAJOR__ and __GLFW_CONTEXT_VERSION_MINOR__ specify the -client API version that the created context must be compatible with. The exact -behavior of these hints depend on the requested client API. - -@note Do not confuse these hints with `GLFW_VERSION_MAJOR` and -`GLFW_VERSION_MINOR`, which provide the API version of the GLFW header. - -@par -__OpenGL:__ These hints are not hard constraints, but creation will fail if the -OpenGL version of the created context is less than the one requested. It is -therefore perfectly safe to use the default of version 1.0 for legacy code and -you will still get backwards-compatible contexts of version 3.0 and above when -available. - -@par -While there is no way to ask the driver for a context of the highest supported -version, GLFW will attempt to provide this when you ask for a version 1.0 -context, which is the default for these hints. - -@par -__OpenGL ES:__ These hints are not hard constraints, but creation will fail if -the OpenGL ES version of the created context is less than the one requested. -Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was requested, -and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0, -but OpenGL ES 2.0 is not backward compatible with 1.x. - -@note @macos The OS only supports forward-compatible core profile contexts for -OpenGL versions 3.2 and later. Before creating an OpenGL context of version -3.2 or later you must set the -[GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) and -[GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hints accordingly. OpenGL -3.0 and 3.1 contexts are not supported at all on macOS. - -@anchor GLFW_OPENGL_FORWARD_COMPAT_hint -__GLFW_OPENGL_FORWARD_COMPAT__ specifies whether the OpenGL context should be -forward-compatible, i.e. one where all functionality deprecated in the requested -version of OpenGL is removed. This must only be used if the requested OpenGL -version is 3.0 or above. If OpenGL ES is requested, this hint is ignored. - -@par -Forward-compatibility is described in detail in the -[OpenGL Reference Manual](https://www.opengl.org/registry/). - -@anchor GLFW_OPENGL_DEBUG_CONTEXT_hint -__GLFW_OPENGL_DEBUG_CONTEXT__ specifies whether to create a debug OpenGL -context, which may have additional error and performance issue reporting -functionality. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. If OpenGL ES -is requested, this hint is ignored. - -@anchor GLFW_OPENGL_PROFILE_hint -__GLFW_OPENGL_PROFILE__ specifies which OpenGL profile to create the context -for. Possible values are one of `GLFW_OPENGL_CORE_PROFILE` or -`GLFW_OPENGL_COMPAT_PROFILE`, or `GLFW_OPENGL_ANY_PROFILE` to not request -a specific profile. If requesting an OpenGL version below 3.2, -`GLFW_OPENGL_ANY_PROFILE` must be used. If OpenGL ES is requested, this hint -is ignored. - -@par -OpenGL profiles are described in detail in the -[OpenGL Reference Manual](https://www.opengl.org/registry/). - -@anchor GLFW_CONTEXT_ROBUSTNESS_hint -__GLFW_CONTEXT_ROBUSTNESS__ specifies the robustness strategy to be used by the -context. This can be one of `GLFW_NO_RESET_NOTIFICATION` or -`GLFW_LOSE_CONTEXT_ON_RESET`, or `GLFW_NO_ROBUSTNESS` to not request -a robustness strategy. - -@anchor GLFW_CONTEXT_RELEASE_BEHAVIOR_hint -__GLFW_CONTEXT_RELEASE_BEHAVIOR__ specifies the release behavior to be -used by the context. Possible values are one of `GLFW_ANY_RELEASE_BEHAVIOR`, -`GLFW_RELEASE_BEHAVIOR_FLUSH` or `GLFW_RELEASE_BEHAVIOR_NONE`. If the -behavior is `GLFW_ANY_RELEASE_BEHAVIOR`, the default behavior of the context -creation API will be used. If the behavior is `GLFW_RELEASE_BEHAVIOR_FLUSH`, -the pipeline will be flushed whenever the context is released from being the -current one. If the behavior is `GLFW_RELEASE_BEHAVIOR_NONE`, the pipeline will -not be flushed on release. - -@par -Context release behaviors are described in detail by the -[GL_KHR_context_flush_control](https://www.opengl.org/registry/specs/KHR/context_flush_control.txt) -extension. - -@anchor GLFW_CONTEXT_NO_ERROR_hint -__GLFW_CONTEXT_NO_ERROR__ specifies whether errors should be generated by the -context. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. If enabled, -situations that would have generated errors instead cause undefined behavior. - -@par -The no error mode for OpenGL and OpenGL ES is described in detail by the -[GL_KHR_no_error](https://www.opengl.org/registry/specs/KHR/no_error.txt) -extension. - - -@subsubsection window_hints_osx macOS specific window hints - -@anchor GLFW_COCOA_RETINA_FRAMEBUFFER_hint -__GLFW_COCOA_RETINA_FRAMEBUFFER__ specifies whether to use full resolution -framebuffers on Retina displays. Possible values are `GLFW_TRUE` and -`GLFW_FALSE`. This is ignored on other platforms. - -@anchor GLFW_COCOA_FRAME_NAME_hint -__GLFW_COCOA_FRAME_NAME__ specifies the UTF-8 encoded name to use for autosaving -the window frame, or if empty disables frame autosaving for the window. This is -ignored on other platforms. This is set with @ref glfwWindowHintString. - -@anchor GLFW_COCOA_GRAPHICS_SWITCHING_hint -__GLFW_COCOA_GRAPHICS_SWITCHING__ specifies whether to in Automatic Graphics -Switching, i.e. to allow the system to choose the integrated GPU for the OpenGL -context and move it between GPUs if necessary or whether to force it to always -run on the discrete GPU. This only affects systems with both integrated and -discrete GPUs. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This is -ignored on other platforms. - -@par -Simpler programs and tools may want to enable this to save power, while games -and other applications performing advanced rendering will want to leave it -disabled. - -@par -A bundled application that wishes to participate in Automatic Graphics Switching -should also declare this in its `Info.plist` by setting the -`NSSupportsAutomaticGraphicsSwitching` key to `true`. - - -@subsubsection window_hints_x11 X11 specific window hints - -@anchor GLFW_X11_CLASS_NAME_hint -@anchor GLFW_X11_INSTANCE_NAME_hint -__GLFW_X11_CLASS_NAME__ and __GLFW_X11_INSTANCE_NAME__ specifies the desired -ASCII encoded class and instance parts of the ICCCM `WM_CLASS` window property. -These are set with @ref glfwWindowHintString. - - -@subsubsection window_hints_values Supported and default values - -Window hint | Default value | Supported values ------------------------------ | --------------------------- | ---------------- -GLFW_RESIZABLE | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_VISIBLE | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_DECORATED | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_FOCUSED | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_AUTO_ICONIFY | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_FLOATING | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_MAXIMIZED | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_CENTER_CURSOR | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_TRANSPARENT_FRAMEBUFFER | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_FOCUS_ON_SHOW | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_SCALE_TO_MONITOR | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_RED_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE` -GLFW_GREEN_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE` -GLFW_BLUE_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE` -GLFW_ALPHA_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE` -GLFW_DEPTH_BITS | 24 | 0 to `INT_MAX` or `GLFW_DONT_CARE` -GLFW_STENCIL_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE` -GLFW_ACCUM_RED_BITS | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE` -GLFW_ACCUM_GREEN_BITS | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE` -GLFW_ACCUM_BLUE_BITS | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE` -GLFW_ACCUM_ALPHA_BITS | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE` -GLFW_AUX_BUFFERS | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE` -GLFW_SAMPLES | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE` -GLFW_REFRESH_RATE | `GLFW_DONT_CARE` | 0 to `INT_MAX` or `GLFW_DONT_CARE` -GLFW_STEREO | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_SRGB_CAPABLE | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_DOUBLEBUFFER | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_CLIENT_API | `GLFW_OPENGL_API` | `GLFW_OPENGL_API`, `GLFW_OPENGL_ES_API` or `GLFW_NO_API` -GLFW_CONTEXT_CREATION_API | `GLFW_NATIVE_CONTEXT_API` | `GLFW_NATIVE_CONTEXT_API`, `GLFW_EGL_CONTEXT_API` or `GLFW_OSMESA_CONTEXT_API` -GLFW_CONTEXT_VERSION_MAJOR | 1 | Any valid major version number of the chosen client API -GLFW_CONTEXT_VERSION_MINOR | 0 | Any valid minor version number of the chosen client API -GLFW_CONTEXT_ROBUSTNESS | `GLFW_NO_ROBUSTNESS` | `GLFW_NO_ROBUSTNESS`, `GLFW_NO_RESET_NOTIFICATION` or `GLFW_LOSE_CONTEXT_ON_RESET` -GLFW_CONTEXT_RELEASE_BEHAVIOR | `GLFW_ANY_RELEASE_BEHAVIOR` | `GLFW_ANY_RELEASE_BEHAVIOR`, `GLFW_RELEASE_BEHAVIOR_FLUSH` or `GLFW_RELEASE_BEHAVIOR_NONE` -GLFW_OPENGL_FORWARD_COMPAT | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_OPENGL_DEBUG_CONTEXT | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_OPENGL_PROFILE | `GLFW_OPENGL_ANY_PROFILE` | `GLFW_OPENGL_ANY_PROFILE`, `GLFW_OPENGL_COMPAT_PROFILE` or `GLFW_OPENGL_CORE_PROFILE` -GLFW_COCOA_RETINA_FRAMEBUFFER | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_COCOA_FRAME_NAME | `""` | A UTF-8 encoded frame autosave name -GLFW_COCOA_GRAPHICS_SWITCHING | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_X11_CLASS_NAME | `""` | An ASCII encoded `WM_CLASS` class name -GLFW_X11_INSTANCE_NAME | `""` | An ASCII encoded `WM_CLASS` instance name - - -@section window_events Window event processing - -See @ref events. - - -@section window_properties Window properties and events - -@subsection window_userptr User pointer - -Each window has a user pointer that can be set with @ref -glfwSetWindowUserPointer and queried with @ref glfwGetWindowUserPointer. This -can be used for any purpose you need and will not be modified by GLFW throughout -the life-time of the window. - -The initial value of the pointer is `NULL`. - - -@subsection window_close Window closing and close flag - -When the user attempts to close the window, for example by clicking the close -widget or using a key chord like Alt+F4, the _close flag_ of the window is set. -The window is however not actually destroyed and, unless you watch for this -state change, nothing further happens. - -The current state of the close flag is returned by @ref glfwWindowShouldClose -and can be set or cleared directly with @ref glfwSetWindowShouldClose. A common -pattern is to use the close flag as a main loop condition. - -@code -while (!glfwWindowShouldClose(window)) -{ - render(window); - - glfwSwapBuffers(window); - glfwPollEvents(); -} -@endcode - -If you wish to be notified when the user attempts to close a window, set a close -callback. - -@code -glfwSetWindowCloseCallback(window, window_close_callback); -@endcode - -The callback function is called directly _after_ the close flag has been set. -It can be used for example to filter close requests and clear the close flag -again unless certain conditions are met. - -@code -void window_close_callback(GLFWwindow* window) -{ - if (!time_to_close) - glfwSetWindowShouldClose(window, GLFW_FALSE); -} -@endcode - - -@subsection window_size Window size - -The size of a window can be changed with @ref glfwSetWindowSize. For windowed -mode windows, this sets the size, in -[screen coordinates](@ref coordinate_systems) of the _content area_ or _content -area_ of the window. The window system may impose limits on window size. - -@code -glfwSetWindowSize(window, 640, 480); -@endcode - -For full screen windows, the specified size becomes the new resolution of the -window's desired video mode. The video mode most closely matching the new -desired video mode is set immediately. The window is resized to fit the -resolution of the set video mode. - -If you wish to be notified when a window is resized, whether by the user, the -system or your own code, set a size callback. - -@code -glfwSetWindowSizeCallback(window, window_size_callback); -@endcode - -The callback function receives the new size, in screen coordinates, of the -content area of the window when the window is resized. - -@code -void window_size_callback(GLFWwindow* window, int width, int height) -{ -} -@endcode - -There is also @ref glfwGetWindowSize for directly retrieving the current size of -a window. - -@code -int width, height; -glfwGetWindowSize(window, &width, &height); -@endcode - -@note Do not pass the window size to `glViewport` or other pixel-based OpenGL -calls. The window size is in screen coordinates, not pixels. Use the -[framebuffer size](@ref window_fbsize), which is in pixels, for pixel-based -calls. - -The above functions work with the size of the content area, but decorated -windows typically have title bars and window frames around this rectangle. You -can retrieve the extents of these with @ref glfwGetWindowFrameSize. - -@code -int left, top, right, bottom; -glfwGetWindowFrameSize(window, &left, &top, &right, &bottom); -@endcode - -The returned values are the distances, in screen coordinates, from the edges of -the content area to the corresponding edges of the full window. As they are -distances and not coordinates, they are always zero or positive. - - -@subsection window_fbsize Framebuffer size - -While the size of a window is measured in screen coordinates, OpenGL works with -pixels. The size you pass into `glViewport`, for example, should be in pixels. -On some machines screen coordinates and pixels are the same, but on others they -will not be. There is a second set of functions to retrieve the size, in -pixels, of the framebuffer of a window. - -If you wish to be notified when the framebuffer of a window is resized, whether -by the user or the system, set a size callback. - -@code -glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); -@endcode - -The callback function receives the new size of the framebuffer when it is -resized, which can for example be used to update the OpenGL viewport. - -@code -void framebuffer_size_callback(GLFWwindow* window, int width, int height) -{ - glViewport(0, 0, width, height); -} -@endcode - -There is also @ref glfwGetFramebufferSize for directly retrieving the current -size of the framebuffer of a window. - -@code -int width, height; -glfwGetFramebufferSize(window, &width, &height); -glViewport(0, 0, width, height); -@endcode - -The size of a framebuffer may change independently of the size of a window, for -example if the window is dragged between a regular monitor and a high-DPI one. - - -@subsection window_scale Window content scale - -The content scale for a window can be retrieved with @ref -glfwGetWindowContentScale. - -@code -float xscale, yscale; -glfwGetWindowContentScale(window, &xscale, &yscale); -@endcode - -The content scale is the ratio between the current DPI and the platform's -default DPI. This is especially important for text and any UI elements. If the -pixel dimensions of your UI scaled by this look appropriate on your machine then -it should appear at a reasonable size on other machines regardless of their DPI -and scaling settings. This relies on the system DPI and scaling settings being -somewhat correct. - -On systems where each monitors can have its own content scale, the window -content scale will depend on which monitor the system considers the window to be -on. - -If you wish to be notified when the content scale of a window changes, whether -because of a system setting change or because it was moved to a monitor with -a different scale, set a content scale callback. - -@code -glfwSetWindowContentScaleCallback(window, window_content_scale_callback); -@endcode - -The callback function receives the new content scale of the window. - -@code -void window_content_scale_callback(GLFWwindow* window, float xscale, float yscale) -{ - set_interface_scale(xscale, yscale); -} -@endcode - -On platforms where pixels and screen coordinates always map 1:1, the window -will need to be resized to appear the same size when it is moved to a monitor -with a different content scale. To have this done automatically both when the -window is created and when its content scale later changes, set the @ref -GLFW_SCALE_TO_MONITOR window hint. - - -@subsection window_sizelimits Window size limits - -The minimum and maximum size of the content area of a windowed mode window can -be enforced with @ref glfwSetWindowSizeLimits. The user may resize the window -to any size and aspect ratio within the specified limits, unless the aspect -ratio is also set. - -@code -glfwSetWindowSizeLimits(window, 200, 200, 400, 400); -@endcode - -To specify only a minimum size or only a maximum one, set the other pair to -`GLFW_DONT_CARE`. - -@code -glfwSetWindowSizeLimits(window, 640, 480, GLFW_DONT_CARE, GLFW_DONT_CARE); -@endcode - -To disable size limits for a window, set them all to `GLFW_DONT_CARE`. - -The aspect ratio of the content area of a windowed mode window can be enforced -with @ref glfwSetWindowAspectRatio. The user may resize the window freely -unless size limits are also set, but the size will be constrained to maintain -the aspect ratio. - -@code -glfwSetWindowAspectRatio(window, 16, 9); -@endcode - -The aspect ratio is specified as a numerator and denominator, corresponding to -the width and height, respectively. If you want a window to maintain its -current aspect ratio, use its current size as the ratio. - -@code -int width, height; -glfwGetWindowSize(window, &width, &height); -glfwSetWindowAspectRatio(window, width, height); -@endcode - -To disable the aspect ratio limit for a window, set both terms to -`GLFW_DONT_CARE`. - -You can have both size limits and aspect ratio set for a window, but the results -are undefined if they conflict. - - -@subsection window_pos Window position - -The position of a windowed-mode window can be changed with @ref -glfwSetWindowPos. This moves the window so that the upper-left corner of its -content area has the specified [screen coordinates](@ref coordinate_systems). -The window system may put limitations on window placement. - -@code -glfwSetWindowPos(window, 100, 100); -@endcode - -If you wish to be notified when a window is moved, whether by the user, the -system or your own code, set a position callback. - -@code -glfwSetWindowPosCallback(window, window_pos_callback); -@endcode - -The callback function receives the new position, in screen coordinates, of the -upper-left corner of the content area when the window is moved. - -@code -void window_pos_callback(GLFWwindow* window, int xpos, int ypos) -{ -} -@endcode - -There is also @ref glfwGetWindowPos for directly retrieving the current position -of the content area of the window. - -@code -int xpos, ypos; -glfwGetWindowPos(window, &xpos, &ypos); -@endcode - - -@subsection window_title Window title - -All GLFW windows have a title, although undecorated or full screen windows may -not display it or only display it in a task bar or similar interface. You can -set a UTF-8 encoded window title with @ref glfwSetWindowTitle. - -@code -glfwSetWindowTitle(window, "My Window"); -@endcode - -The specified string is copied before the function returns, so there is no need -to keep it around. - -As long as your source file is encoded as UTF-8, you can use any Unicode -characters directly in the source. - -@code -glfwSetWindowTitle(window, "ラストエグザイル"); -@endcode - -If you are using C++11 or C11, you can use a UTF-8 string literal. - -@code -glfwSetWindowTitle(window, u8"This is always a UTF-8 string"); -@endcode - - -@subsection window_icon Window icon - -Decorated windows have icons on some platforms. You can set this icon by -specifying a list of candidate images with @ref glfwSetWindowIcon. - -@code -GLFWimage images[2]; -images[0] = load_icon("my_icon.png"); -images[1] = load_icon("my_icon_small.png"); - -glfwSetWindowIcon(window, 2, images); -@endcode - -The image data is 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits -per channel with the red channel first. The pixels are arranged canonically as -sequential rows, starting from the top-left corner. - -To revert to the default window icon, pass in an empty image array. - -@code -glfwSetWindowIcon(window, 0, NULL); -@endcode - - -@subsection window_monitor Window monitor - -Full screen windows are associated with a specific monitor. You can get the -handle for this monitor with @ref glfwGetWindowMonitor. - -@code -GLFWmonitor* monitor = glfwGetWindowMonitor(window); -@endcode - -This monitor handle is one of those returned by @ref glfwGetMonitors. - -For windowed mode windows, this function returns `NULL`. This is how to tell -full screen windows from windowed mode windows. - -You can move windows between monitors or between full screen and windowed mode -with @ref glfwSetWindowMonitor. When making a window full screen on the same or -on a different monitor, specify the desired monitor, resolution and refresh -rate. The position arguments are ignored. - -@code -const GLFWvidmode* mode = glfwGetVideoMode(monitor); - -glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, mode->refreshRate); -@endcode - -When making the window windowed, specify the desired position and size. The -refresh rate argument is ignored. - -@code -glfwSetWindowMonitor(window, NULL, xpos, ypos, width, height, 0); -@endcode - -This restores any previous window settings such as whether it is decorated, -floating, resizable, has size or aspect ratio limits, etc.. To restore a window -that was originally windowed to its original size and position, save these -before making it full screen and then pass them in as above. - - -@subsection window_iconify Window iconification - -Windows can be iconified (i.e. minimized) with @ref glfwIconifyWindow. - -@code -glfwIconifyWindow(window); -@endcode - -When a full screen window is iconified, the original video mode of its monitor -is restored until the user or application restores the window. - -Iconified windows can be restored with @ref glfwRestoreWindow. This function -also restores windows from maximization. - -@code -glfwRestoreWindow(window); -@endcode - -When a full screen window is restored, the desired video mode is restored to its -monitor as well. - -If you wish to be notified when a window is iconified or restored, whether by -the user, system or your own code, set an iconify callback. - -@code -glfwSetWindowIconifyCallback(window, window_iconify_callback); -@endcode - -The callback function receives changes in the iconification state of the window. - -@code -void window_iconify_callback(GLFWwindow* window, int iconified) -{ - if (iconified) - { - // The window was iconified - } - else - { - // The window was restored - } -} -@endcode - -You can also get the current iconification state with @ref glfwGetWindowAttrib. - -@code -int iconified = glfwGetWindowAttrib(window, GLFW_ICONIFIED); -@endcode - - -@subsection window_maximize Window maximization - -Windows can be maximized (i.e. zoomed) with @ref glfwMaximizeWindow. - -@code -glfwMaximizeWindow(window); -@endcode - -Full screen windows cannot be maximized and passing a full screen window to this -function does nothing. - -Maximized windows can be restored with @ref glfwRestoreWindow. This function -also restores windows from iconification. - -@code -glfwRestoreWindow(window); -@endcode - -If you wish to be notified when a window is maximized or restored, whether by -the user, system or your own code, set a maximize callback. - -@code -glfwSetWindowMaximizeCallback(window, window_maximize_callback); -@endcode - -The callback function receives changes in the maximization state of the window. - -@code -void window_maximize_callback(GLFWwindow* window, int maximized) -{ - if (maximized) - { - // The window was maximized - } - else - { - // The window was restored - } -} -@endcode - -You can also get the current maximization state with @ref glfwGetWindowAttrib. - -@code -int maximized = glfwGetWindowAttrib(window, GLFW_MAXIMIZED); -@endcode - -By default, newly created windows are not maximized. You can change this -behavior by setting the [GLFW_MAXIMIZED](@ref GLFW_MAXIMIZED_hint) window hint -before creating the window. - -@code -glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE); -@endcode - - -@subsection window_hide Window visibility - -Windowed mode windows can be hidden with @ref glfwHideWindow. - -@code -glfwHideWindow(window); -@endcode - -This makes the window completely invisible to the user, including removing it -from the task bar, dock or window list. Full screen windows cannot be hidden -and calling @ref glfwHideWindow on a full screen window does nothing. - -Hidden windows can be shown with @ref glfwShowWindow. - -@code -glfwShowWindow(window); -@endcode - -By default, this function will also set the input focus to that window. Set -the [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) window hint to change -this behavior for all newly created windows, or change the behavior for an -existing window with @ref glfwSetWindowAttrib. - -You can also get the current visibility state with @ref glfwGetWindowAttrib. - -@code -int visible = glfwGetWindowAttrib(window, GLFW_VISIBLE); -@endcode - -By default, newly created windows are visible. You can change this behavior by -setting the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window hint before creating -the window. - -@code -glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); -@endcode - -Windows created hidden are completely invisible to the user until shown. This -can be useful if you need to set up your window further before showing it, for -example moving it to a specific location. - - -@subsection window_focus Window input focus - -Windows can be given input focus and brought to the front with @ref -glfwFocusWindow. - -@code -glfwFocusWindow(window); -@endcode - -Keep in mind that it can be very disruptive to the user when a window is forced -to the top. For a less disruptive way of getting the user's attention, see -[attention requests](@ref window_attention). - -If you wish to be notified when a window gains or loses input focus, whether by -the user, system or your own code, set a focus callback. - -@code -glfwSetWindowFocusCallback(window, window_focus_callback); -@endcode - -The callback function receives changes in the input focus state of the window. - -@code -void window_focus_callback(GLFWwindow* window, int focused) -{ - if (focused) - { - // The window gained input focus - } - else - { - // The window lost input focus - } -} -@endcode - -You can also get the current input focus state with @ref glfwGetWindowAttrib. - -@code -int focused = glfwGetWindowAttrib(window, GLFW_FOCUSED); -@endcode - -By default, newly created windows are given input focus. You can change this -behavior by setting the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) window hint -before creating the window. - -@code -glfwWindowHint(GLFW_FOCUSED, GLFW_FALSE); -@endcode - - -@subsection window_attention Window attention request - -If you wish to notify the user of an event without interrupting, you can request -attention with @ref glfwRequestWindowAttention. - -@code -glfwRequestWindowAttention(window); -@endcode - -The system will highlight the specified window, or on platforms where this is -not supported, the application as a whole. Once the user has given it -attention, the system will automatically end the request. - - -@subsection window_refresh Window damage and refresh - -If you wish to be notified when the contents of a window is damaged and needs -to be refreshed, set a window refresh callback. - -@code -glfwSetWindowRefreshCallback(m_handle, window_refresh_callback); -@endcode - -The callback function is called when the contents of the window needs to be -refreshed. - -@code -void window_refresh_callback(GLFWwindow* window) -{ - draw_editor_ui(window); - glfwSwapBuffers(window); -} -@endcode - -@note On compositing window systems such as Aero, Compiz or Aqua, where the -window contents are saved off-screen, this callback might only be called when -the window or framebuffer is resized. - - -@subsection window_transparency Window transparency - -GLFW supports two kinds of transparency for windows; framebuffer transparency -and whole window transparency. A single window may not use both methods. The -results of doing this are undefined. - -Both methods require the platform to support it and not every version of every -platform GLFW supports does this, so there are mechanisms to check whether the -window really is transparent. - -Window framebuffers can be made transparent on a per-pixel per-frame basis with -the [GLFW_TRANSPARENT_FRAMEBUFFER](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) -window hint. - -@code -glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); -@endcode - -If supported by the system, the window content area will be composited with the -background using the framebuffer per-pixel alpha channel. This requires desktop -compositing to be enabled on the system. It does not affect window decorations. - -You can check whether the window framebuffer was successfully made transparent -with the -[GLFW_TRANSPARENT_FRAMEBUFFER](@ref GLFW_TRANSPARENT_FRAMEBUFFER_attrib) -window attribute. - -@code -if (glfwGetWindowAttrib(window, GLFW_TRANSPARENT_FRAMEBUFFER)) -{ - // window framebuffer is currently transparent -} -@endcode - -GLFW comes with an example that enabled framebuffer transparency called `gears`. - -The opacity of the whole window, including any decorations, can be set with @ref -glfwSetWindowOpacity. - -@code -glfwSetWindowOpacity(window, 0.5f); -@endcode - -The opacity (or alpha) value is a positive finite number between zero and one, -where 0 (zero) is fully transparent and 1 (one) is fully opaque. The initial -opacity value for newly created windows is 1. - -The current opacity of a window can be queried with @ref glfwGetWindowOpacity. - -@code -float opacity = glfwGetWindowOpacity(window); -@endcode - -If the system does not support whole window transparency, this function always -returns one. - -GLFW comes with a test program that lets you control whole window transparency -at run-time called `opacity`. - - -@subsection window_attribs Window attributes - -Windows have a number of attributes that can be returned using @ref -glfwGetWindowAttrib. Some reflect state that may change as a result of user -interaction, (e.g. whether it has input focus), while others reflect inherent -properties of the window (e.g. what kind of border it has). Some are related to -the window and others to its OpenGL or OpenGL ES context. - -@code -if (glfwGetWindowAttrib(window, GLFW_FOCUSED)) -{ - // window has input focus -} -@endcode - -The [GLFW_DECORATED](@ref GLFW_DECORATED_attrib), -[GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib), -[GLFW_FLOATING](@ref GLFW_FLOATING_attrib), -[GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and -[GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib) window attributes can be -changed with @ref glfwSetWindowAttrib. - -@code -glfwSetWindowAttrib(window, GLFW_RESIZABLE, GLFW_FALSE); -@endcode - - - -@subsubsection window_attribs_wnd Window related attributes - -@anchor GLFW_FOCUSED_attrib -__GLFW_FOCUSED__ indicates whether the specified window has input focus. See -@ref window_focus for details. - -@anchor GLFW_ICONIFIED_attrib -__GLFW_ICONIFIED__ indicates whether the specified window is iconified. -See @ref window_iconify for details. - -@anchor GLFW_MAXIMIZED_attrib -__GLFW_MAXIMIZED__ indicates whether the specified window is maximized. See -@ref window_maximize for details. - -@anchor GLFW_HOVERED_attrib -__GLFW_HOVERED__ indicates whether the cursor is currently directly over the -content area of the window, with no other windows between. See @ref -cursor_enter for details. - -@anchor GLFW_VISIBLE_attrib -__GLFW_VISIBLE__ indicates whether the specified window is visible. See @ref -window_hide for details. - -@anchor GLFW_RESIZABLE_attrib -__GLFW_RESIZABLE__ indicates whether the specified window is resizable _by the -user_. This can be set before creation with the -[GLFW_RESIZABLE](@ref GLFW_RESIZABLE_hint) window hint or after with @ref -glfwSetWindowAttrib. - -@anchor GLFW_DECORATED_attrib -__GLFW_DECORATED__ indicates whether the specified window has decorations such -as a border, a close widget, etc. This can be set before creation with the -[GLFW_DECORATED](@ref GLFW_DECORATED_hint) window hint or after with @ref -glfwSetWindowAttrib. - -@anchor GLFW_AUTO_ICONIFY_attrib -__GLFW_AUTO_ICONIFY__ indicates whether the specified full screen window is -iconified on focus loss, a close widget, etc. This can be set before creation -with the [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_hint) window hint or after -with @ref glfwSetWindowAttrib. - -@anchor GLFW_FLOATING_attrib -__GLFW_FLOATING__ indicates whether the specified window is floating, also -called topmost or always-on-top. This can be set before creation with the -[GLFW_FLOATING](@ref GLFW_FLOATING_hint) window hint or after with @ref -glfwSetWindowAttrib. - -@anchor GLFW_TRANSPARENT_FRAMEBUFFER_attrib -__GLFW_TRANSPARENT_FRAMEBUFFER__ indicates whether the specified window has -a transparent framebuffer, i.e. the window contents is composited with the -background using the window framebuffer alpha channel. See @ref -window_transparency for details. - -@anchor GLFW_FOCUS_ON_SHOW_attrib -__GLFW_FOCUS_ON_SHOW__ specifies whether the window will be given input -focus when @ref glfwShowWindow is called. This can be set before creation -with the [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) window hint or -after with @ref glfwSetWindowAttrib. - -@subsubsection window_attribs_ctx Context related attributes - -@anchor GLFW_CLIENT_API_attrib -__GLFW_CLIENT_API__ indicates the client API provided by the window's context; -either `GLFW_OPENGL_API`, `GLFW_OPENGL_ES_API` or `GLFW_NO_API`. - -@anchor GLFW_CONTEXT_CREATION_API_attrib -__GLFW_CONTEXT_CREATION_API__ indicates the context creation API used to create -the window's context; either `GLFW_NATIVE_CONTEXT_API`, `GLFW_EGL_CONTEXT_API` -or `GLFW_OSMESA_CONTEXT_API`. - -@anchor GLFW_CONTEXT_VERSION_MAJOR_attrib -@anchor GLFW_CONTEXT_VERSION_MINOR_attrib -@anchor GLFW_CONTEXT_REVISION_attrib -__GLFW_CONTEXT_VERSION_MAJOR__, __GLFW_CONTEXT_VERSION_MINOR__ and -__GLFW_CONTEXT_REVISION__ indicate the client API version of the window's -context. - -@note Do not confuse these attributes with `GLFW_VERSION_MAJOR`, -`GLFW_VERSION_MINOR` and `GLFW_VERSION_REVISION` which provide the API version -of the GLFW header. - -@anchor GLFW_OPENGL_FORWARD_COMPAT_attrib -__GLFW_OPENGL_FORWARD_COMPAT__ is `GLFW_TRUE` if the window's context is an -OpenGL forward-compatible one, or `GLFW_FALSE` otherwise. - -@anchor GLFW_OPENGL_DEBUG_CONTEXT_attrib -__GLFW_OPENGL_DEBUG_CONTEXT__ is `GLFW_TRUE` if the window's context is an -OpenGL debug context, or `GLFW_FALSE` otherwise. - -@anchor GLFW_OPENGL_PROFILE_attrib -__GLFW_OPENGL_PROFILE__ indicates the OpenGL profile used by the context. This -is `GLFW_OPENGL_CORE_PROFILE` or `GLFW_OPENGL_COMPAT_PROFILE` if the context -uses a known profile, or `GLFW_OPENGL_ANY_PROFILE` if the OpenGL profile is -unknown or the context is an OpenGL ES context. Note that the returned profile -may not match the profile bits of the context flags, as GLFW will try other -means of detecting the profile when no bits are set. - -@anchor GLFW_CONTEXT_RELEASE_BEHAVIOR_attrib -__GLFW_CONTEXT_RELEASE_BEHAVIOR__ indicates the release used by the context. -Possible values are one of `GLFW_ANY_RELEASE_BEHAVIOR`, -`GLFW_RELEASE_BEHAVIOR_FLUSH` or `GLFW_RELEASE_BEHAVIOR_NONE`. If the -behavior is `GLFW_ANY_RELEASE_BEHAVIOR`, the default behavior of the context -creation API will be used. If the behavior is `GLFW_RELEASE_BEHAVIOR_FLUSH`, -the pipeline will be flushed whenever the context is released from being the -current one. If the behavior is `GLFW_RELEASE_BEHAVIOR_NONE`, the pipeline will -not be flushed on release. - -@anchor GLFW_CONTEXT_NO_ERROR_attrib -__GLFW_CONTEXT_NO_ERROR__ indicates whether errors are generated by the context. -Possible values are `GLFW_TRUE` and `GLFW_FALSE`. If enabled, situations that -would have generated errors instead cause undefined behavior. - -@anchor GLFW_CONTEXT_ROBUSTNESS_attrib -__GLFW_CONTEXT_ROBUSTNESS__ indicates the robustness strategy used by the -context. This is `GLFW_LOSE_CONTEXT_ON_RESET` or `GLFW_NO_RESET_NOTIFICATION` -if the window's context supports robustness, or `GLFW_NO_ROBUSTNESS` otherwise. - - -@subsubsection window_attribs_fb Framebuffer related attributes - -GLFW does not expose attributes of the default framebuffer (i.e. the framebuffer -attached to the window) as these can be queried directly with either OpenGL, -OpenGL ES or Vulkan. - -If you are using version 3.0 or later of OpenGL or OpenGL ES, the -`glGetFramebufferAttachmentParameteriv` function can be used to retrieve the -number of bits for the red, green, blue, alpha, depth and stencil buffer -channels. Otherwise, the `glGetIntegerv` function can be used. - -The number of MSAA samples are always retrieved with `glGetIntegerv`. For -contexts supporting framebuffer objects, the number of samples of the currently -bound framebuffer is returned. - -Attribute | glGetIntegerv | glGetFramebufferAttachmentParameteriv ------------- | ----------------- | ------------------------------------- -Red bits | `GL_RED_BITS` | `GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE` -Green bits | `GL_GREEN_BITS` | `GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE` -Blue bits | `GL_BLUE_BITS` | `GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE` -Alpha bits | `GL_ALPHA_BITS` | `GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE` -Depth bits | `GL_DEPTH_BITS` | `GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE` -Stencil bits | `GL_STENCIL_BITS` | `GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE` -MSAA samples | `GL_SAMPLES` | _Not provided by this function_ - -When calling `glGetFramebufferAttachmentParameteriv`, the red, green, blue and -alpha sizes are queried from the `GL_BACK_LEFT`, while the depth and stencil -sizes are queried from the `GL_DEPTH` and `GL_STENCIL` attachments, -respectively. - - -@section buffer_swap Buffer swapping - -GLFW windows are by default double buffered. That means that you have two -rendering buffers; a front buffer and a back buffer. The front buffer is -the one being displayed and the back buffer the one you render to. - -When the entire frame has been rendered, it is time to swap the back and the -front buffers in order to display what has been rendered and begin rendering -a new frame. This is done with @ref glfwSwapBuffers. - -@code -glfwSwapBuffers(window); -@endcode - -Sometimes it can be useful to select when the buffer swap will occur. With the -function @ref glfwSwapInterval it is possible to select the minimum number of -monitor refreshes the driver should wait from the time @ref glfwSwapBuffers was -called before swapping the buffers: - -@code -glfwSwapInterval(1); -@endcode - -If the interval is zero, the swap will take place immediately when @ref -glfwSwapBuffers is called without waiting for a refresh. Otherwise at least -interval retraces will pass between each buffer swap. Using a swap interval of -zero can be useful for benchmarking purposes, when it is not desirable to -measure the time it takes to wait for the vertical retrace. However, a swap -interval of one lets you avoid tearing. - -Note that this may not work on all machines, as some drivers have -user-controlled settings that override any swap interval the application -requests. - -A context that supports either the `WGL_EXT_swap_control_tear` or the -`GLX_EXT_swap_control_tear` extension also accepts _negative_ swap intervals, -which allows the driver to swap immediately even if a frame arrives a little bit -late. This trades the risk of visible tears for greater framerate stability. -You can check for these extensions with @ref glfwExtensionSupported. - -*/ diff --git a/third_party/penumbra/vendor/glfw/examples/CMakeLists.txt b/third_party/penumbra/vendor/glfw/examples/CMakeLists.txt deleted file mode 100644 index a884e6bc1d2..00000000000 --- a/third_party/penumbra/vendor/glfw/examples/CMakeLists.txt +++ /dev/null @@ -1,88 +0,0 @@ - -link_libraries(glfw) - -include_directories("${GLFW_SOURCE_DIR}/deps") - -if (MATH_LIBRARY) - link_libraries("${MATH_LIBRARY}") -endif() - -if (MSVC) - add_definitions(-D_CRT_SECURE_NO_WARNINGS) -endif() - -if (WIN32) - set(ICON glfw.rc) -elseif (APPLE) - set(ICON glfw.icns) -endif() - -if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR - ${CMAKE_VERSION} VERSION_GREATER "3.1.0") - set(CMAKE_C_STANDARD 99) -else() - # Remove this fallback when removing support for CMake version less than 3.1 - add_compile_options("$<$:-std=c99>" - "$<$:-std=c99>" - "$<$:-std=c99>") - -endif() - -set(GLAD_GL "${GLFW_SOURCE_DIR}/deps/glad/gl.h" - "${GLFW_SOURCE_DIR}/deps/glad_gl.c") -set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h" - "${GLFW_SOURCE_DIR}/deps/getopt.c") -set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h" - "${GLFW_SOURCE_DIR}/deps/tinycthread.c") - -add_executable(boing WIN32 MACOSX_BUNDLE boing.c ${ICON} ${GLAD_GL}) -add_executable(gears WIN32 MACOSX_BUNDLE gears.c ${ICON} ${GLAD_GL}) -add_executable(heightmap WIN32 MACOSX_BUNDLE heightmap.c ${ICON} ${GLAD_GL}) -add_executable(offscreen offscreen.c ${ICON} ${GLAD_GL}) -add_executable(particles WIN32 MACOSX_BUNDLE particles.c ${ICON} ${TINYCTHREAD} ${GETOPT} ${GLAD_GL}) -add_executable(sharing WIN32 MACOSX_BUNDLE sharing.c ${ICON} ${GLAD_GL}) -add_executable(simple WIN32 MACOSX_BUNDLE simple.c ${ICON} ${GLAD_GL}) -add_executable(splitview WIN32 MACOSX_BUNDLE splitview.c ${ICON} ${GLAD_GL}) -add_executable(wave WIN32 MACOSX_BUNDLE wave.c ${ICON} ${GLAD_GL}) - -target_link_libraries(particles "${CMAKE_THREAD_LIBS_INIT}") -if (RT_LIBRARY) - target_link_libraries(particles "${RT_LIBRARY}") -endif() - -set(GUI_ONLY_BINARIES boing gears heightmap particles sharing simple splitview - wave) -set(CONSOLE_BINARIES offscreen) - -set_target_properties(${GUI_ONLY_BINARIES} ${CONSOLE_BINARIES} PROPERTIES - FOLDER "GLFW3/Examples") - -if (GLFW_USE_OSMESA) - target_compile_definitions(offscreen PRIVATE USE_NATIVE_OSMESA) -endif() - -if (MSVC) - # Tell MSVC to use main instead of WinMain for Windows subsystem executables - set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES - LINK_FLAGS "/ENTRY:mainCRTStartup") -endif() - -if (APPLE) - set_target_properties(boing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Boing") - set_target_properties(gears PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Gears") - set_target_properties(heightmap PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Heightmap") - set_target_properties(particles PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Particles") - set_target_properties(sharing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Sharing") - set_target_properties(simple PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Simple") - set_target_properties(splitview PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "SplitView") - set_target_properties(wave PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Wave") - - set_source_files_properties(glfw.icns PROPERTIES - MACOSX_PACKAGE_LOCATION "Resources") - set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES - MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION} - MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION} - MACOSX_BUNDLE_ICON_FILE glfw.icns - MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/MacOSXBundleInfo.plist.in") -endif() - diff --git a/third_party/penumbra/vendor/glfw/examples/boing.c b/third_party/penumbra/vendor/glfw/examples/boing.c deleted file mode 100644 index ca389086a1a..00000000000 --- a/third_party/penumbra/vendor/glfw/examples/boing.c +++ /dev/null @@ -1,679 +0,0 @@ -/***************************************************************************** - * Title: GLBoing - * Desc: Tribute to Amiga Boing. - * Author: Jim Brooks - * Original Amiga authors were R.J. Mical and Dale Luck. - * GLFW conversion by Marcus Geelnard - * Notes: - 360' = 2*PI [radian] - * - * - Distances between objects are created by doing a relative - * Z translations. - * - * - Although OpenGL enticingly supports alpha-blending, - * the shadow of the original Boing didn't affect the color - * of the grid. - * - * - [Marcus] Changed timing scheme from interval driven to frame- - * time based animation steps (which results in much smoother - * movement) - * - * History of Amiga Boing: - * - * Boing was demonstrated on the prototype Amiga (codenamed "Lorraine") in - * 1985. According to legend, it was written ad-hoc in one night by - * R. J. Mical and Dale Luck. Because the bouncing ball animation was so fast - * and smooth, attendees did not believe the Amiga prototype was really doing - * the rendering. Suspecting a trick, they began looking around the booth for - * a hidden computer or VCR. - *****************************************************************************/ - -#if defined(_MSC_VER) - // Make MS math.h define M_PI - #define _USE_MATH_DEFINES -#endif - -#include -#include -#include - -#include -#define GLFW_INCLUDE_NONE -#include - -#include - - -/***************************************************************************** - * Various declarations and macros - *****************************************************************************/ - -/* Prototypes */ -void init( void ); -void display( void ); -void reshape( GLFWwindow* window, int w, int h ); -void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods ); -void mouse_button_callback( GLFWwindow* window, int button, int action, int mods ); -void cursor_position_callback( GLFWwindow* window, double x, double y ); -void DrawBoingBall( void ); -void BounceBall( double dt ); -void DrawBoingBallBand( GLfloat long_lo, GLfloat long_hi ); -void DrawGrid( void ); - -#define RADIUS 70.f -#define STEP_LONGITUDE 22.5f /* 22.5 makes 8 bands like original Boing */ -#define STEP_LATITUDE 22.5f - -#define DIST_BALL (RADIUS * 2.f + RADIUS * 0.1f) - -#define VIEW_SCENE_DIST (DIST_BALL * 3.f + 200.f)/* distance from viewer to middle of boing area */ -#define GRID_SIZE (RADIUS * 4.5f) /* length (width) of grid */ -#define BOUNCE_HEIGHT (RADIUS * 2.1f) -#define BOUNCE_WIDTH (RADIUS * 2.1f) - -#define SHADOW_OFFSET_X -20.f -#define SHADOW_OFFSET_Y 10.f -#define SHADOW_OFFSET_Z 0.f - -#define WALL_L_OFFSET 0.f -#define WALL_R_OFFSET 5.f - -/* Animation speed (50.0 mimics the original GLUT demo speed) */ -#define ANIMATION_SPEED 50.f - -/* Maximum allowed delta time per physics iteration */ -#define MAX_DELTA_T 0.02f - -/* Draw ball, or its shadow */ -typedef enum { DRAW_BALL, DRAW_BALL_SHADOW } DRAW_BALL_ENUM; - -/* Vertex type */ -typedef struct {float x; float y; float z;} vertex_t; - -/* Global vars */ -int windowed_xpos, windowed_ypos, windowed_width, windowed_height; -int width, height; -GLfloat deg_rot_y = 0.f; -GLfloat deg_rot_y_inc = 2.f; -int override_pos = GLFW_FALSE; -GLfloat cursor_x = 0.f; -GLfloat cursor_y = 0.f; -GLfloat ball_x = -RADIUS; -GLfloat ball_y = -RADIUS; -GLfloat ball_x_inc = 1.f; -GLfloat ball_y_inc = 2.f; -DRAW_BALL_ENUM drawBallHow; -double t; -double t_old = 0.f; -double dt; - -/* Random number generator */ -#ifndef RAND_MAX - #define RAND_MAX 4095 -#endif - - -/***************************************************************************** - * Truncate a degree. - *****************************************************************************/ -GLfloat TruncateDeg( GLfloat deg ) -{ - if ( deg >= 360.f ) - return (deg - 360.f); - else - return deg; -} - -/***************************************************************************** - * Convert a degree (360-based) into a radian. - * 360' = 2 * PI - *****************************************************************************/ -double deg2rad( double deg ) -{ - return deg / 360 * (2 * M_PI); -} - -/***************************************************************************** - * 360' sin(). - *****************************************************************************/ -double sin_deg( double deg ) -{ - return sin( deg2rad( deg ) ); -} - -/***************************************************************************** - * 360' cos(). - *****************************************************************************/ -double cos_deg( double deg ) -{ - return cos( deg2rad( deg ) ); -} - -/***************************************************************************** - * Compute a cross product (for a normal vector). - * - * c = a x b - *****************************************************************************/ -void CrossProduct( vertex_t a, vertex_t b, vertex_t c, vertex_t *n ) -{ - GLfloat u1, u2, u3; - GLfloat v1, v2, v3; - - u1 = b.x - a.x; - u2 = b.y - a.y; - u3 = b.y - a.z; - - v1 = c.x - a.x; - v2 = c.y - a.y; - v3 = c.z - a.z; - - n->x = u2 * v3 - v2 * u3; - n->y = u3 * v1 - v3 * u1; - n->z = u1 * v2 - v1 * u2; -} - - -#define BOING_DEBUG 0 - - -/***************************************************************************** - * init() - *****************************************************************************/ -void init( void ) -{ - /* - * Clear background. - */ - glClearColor( 0.55f, 0.55f, 0.55f, 0.f ); - - glShadeModel( GL_FLAT ); -} - - -/***************************************************************************** - * display() - *****************************************************************************/ -void display(void) -{ - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - glPushMatrix(); - - drawBallHow = DRAW_BALL_SHADOW; - DrawBoingBall(); - - DrawGrid(); - - drawBallHow = DRAW_BALL; - DrawBoingBall(); - - glPopMatrix(); - glFlush(); -} - - -/***************************************************************************** - * reshape() - *****************************************************************************/ -void reshape( GLFWwindow* window, int w, int h ) -{ - mat4x4 projection, view; - - glViewport( 0, 0, (GLsizei)w, (GLsizei)h ); - - glMatrixMode( GL_PROJECTION ); - mat4x4_perspective( projection, - 2.f * (float) atan2( RADIUS, 200.f ), - (float)w / (float)h, - 1.f, VIEW_SCENE_DIST ); - glLoadMatrixf((const GLfloat*) projection); - - glMatrixMode( GL_MODELVIEW ); - { - vec3 eye = { 0.f, 0.f, VIEW_SCENE_DIST }; - vec3 center = { 0.f, 0.f, 0.f }; - vec3 up = { 0.f, -1.f, 0.f }; - mat4x4_look_at( view, eye, center, up ); - } - glLoadMatrixf((const GLfloat*) view); -} - -void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods ) -{ - if (action != GLFW_PRESS) - return; - - if (key == GLFW_KEY_ESCAPE && mods == 0) - glfwSetWindowShouldClose(window, GLFW_TRUE); - if ((key == GLFW_KEY_ENTER && mods == GLFW_MOD_ALT) || - (key == GLFW_KEY_F11 && mods == GLFW_MOD_ALT)) - { - if (glfwGetWindowMonitor(window)) - { - glfwSetWindowMonitor(window, NULL, - windowed_xpos, windowed_ypos, - windowed_width, windowed_height, 0); - } - else - { - GLFWmonitor* monitor = glfwGetPrimaryMonitor(); - if (monitor) - { - const GLFWvidmode* mode = glfwGetVideoMode(monitor); - glfwGetWindowPos(window, &windowed_xpos, &windowed_ypos); - glfwGetWindowSize(window, &windowed_width, &windowed_height); - glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, mode->refreshRate); - } - } - } -} - -static void set_ball_pos ( GLfloat x, GLfloat y ) -{ - ball_x = (width / 2) - x; - ball_y = y - (height / 2); -} - -void mouse_button_callback( GLFWwindow* window, int button, int action, int mods ) -{ - if (button != GLFW_MOUSE_BUTTON_LEFT) - return; - - if (action == GLFW_PRESS) - { - override_pos = GLFW_TRUE; - set_ball_pos(cursor_x, cursor_y); - } - else - { - override_pos = GLFW_FALSE; - } -} - -void cursor_position_callback( GLFWwindow* window, double x, double y ) -{ - cursor_x = (float) x; - cursor_y = (float) y; - - if ( override_pos ) - set_ball_pos(cursor_x, cursor_y); -} - -/***************************************************************************** - * Draw the Boing ball. - * - * The Boing ball is sphere in which each facet is a rectangle. - * Facet colors alternate between red and white. - * The ball is built by stacking latitudinal circles. Each circle is composed - * of a widely-separated set of points, so that each facet is noticeably large. - *****************************************************************************/ -void DrawBoingBall( void ) -{ - GLfloat lon_deg; /* degree of longitude */ - double dt_total, dt2; - - glPushMatrix(); - glMatrixMode( GL_MODELVIEW ); - - /* - * Another relative Z translation to separate objects. - */ - glTranslatef( 0.0, 0.0, DIST_BALL ); - - /* Update ball position and rotation (iterate if necessary) */ - dt_total = dt; - while( dt_total > 0.0 ) - { - dt2 = dt_total > MAX_DELTA_T ? MAX_DELTA_T : dt_total; - dt_total -= dt2; - BounceBall( dt2 ); - deg_rot_y = TruncateDeg( deg_rot_y + deg_rot_y_inc*((float)dt2*ANIMATION_SPEED) ); - } - - /* Set ball position */ - glTranslatef( ball_x, ball_y, 0.0 ); - - /* - * Offset the shadow. - */ - if ( drawBallHow == DRAW_BALL_SHADOW ) - { - glTranslatef( SHADOW_OFFSET_X, - SHADOW_OFFSET_Y, - SHADOW_OFFSET_Z ); - } - - /* - * Tilt the ball. - */ - glRotatef( -20.0, 0.0, 0.0, 1.0 ); - - /* - * Continually rotate ball around Y axis. - */ - glRotatef( deg_rot_y, 0.0, 1.0, 0.0 ); - - /* - * Set OpenGL state for Boing ball. - */ - glCullFace( GL_FRONT ); - glEnable( GL_CULL_FACE ); - glEnable( GL_NORMALIZE ); - - /* - * Build a faceted latitude slice of the Boing ball, - * stepping same-sized vertical bands of the sphere. - */ - for ( lon_deg = 0; - lon_deg < 180; - lon_deg += STEP_LONGITUDE ) - { - /* - * Draw a latitude circle at this longitude. - */ - DrawBoingBallBand( lon_deg, - lon_deg + STEP_LONGITUDE ); - } - - glPopMatrix(); - - return; -} - - -/***************************************************************************** - * Bounce the ball. - *****************************************************************************/ -void BounceBall( double delta_t ) -{ - GLfloat sign; - GLfloat deg; - - if ( override_pos ) - return; - - /* Bounce on walls */ - if ( ball_x > (BOUNCE_WIDTH/2 + WALL_R_OFFSET ) ) - { - ball_x_inc = -0.5f - 0.75f * (GLfloat)rand() / (GLfloat)RAND_MAX; - deg_rot_y_inc = -deg_rot_y_inc; - } - if ( ball_x < -(BOUNCE_HEIGHT/2 + WALL_L_OFFSET) ) - { - ball_x_inc = 0.5f + 0.75f * (GLfloat)rand() / (GLfloat)RAND_MAX; - deg_rot_y_inc = -deg_rot_y_inc; - } - - /* Bounce on floor / roof */ - if ( ball_y > BOUNCE_HEIGHT/2 ) - { - ball_y_inc = -0.75f - 1.f * (GLfloat)rand() / (GLfloat)RAND_MAX; - } - if ( ball_y < -BOUNCE_HEIGHT/2*0.85 ) - { - ball_y_inc = 0.75f + 1.f * (GLfloat)rand() / (GLfloat)RAND_MAX; - } - - /* Update ball position */ - ball_x += ball_x_inc * ((float)delta_t*ANIMATION_SPEED); - ball_y += ball_y_inc * ((float)delta_t*ANIMATION_SPEED); - - /* - * Simulate the effects of gravity on Y movement. - */ - if ( ball_y_inc < 0 ) sign = -1.0; else sign = 1.0; - - deg = (ball_y + BOUNCE_HEIGHT/2) * 90 / BOUNCE_HEIGHT; - if ( deg > 80 ) deg = 80; - if ( deg < 10 ) deg = 10; - - ball_y_inc = sign * 4.f * (float) sin_deg( deg ); -} - - -/***************************************************************************** - * Draw a faceted latitude band of the Boing ball. - * - * Parms: long_lo, long_hi - * Low and high longitudes of slice, resp. - *****************************************************************************/ -void DrawBoingBallBand( GLfloat long_lo, - GLfloat long_hi ) -{ - vertex_t vert_ne; /* "ne" means south-east, so on */ - vertex_t vert_nw; - vertex_t vert_sw; - vertex_t vert_se; - vertex_t vert_norm; - GLfloat lat_deg; - static int colorToggle = 0; - - /* - * Iterate through the points of a latitude circle. - * A latitude circle is a 2D set of X,Z points. - */ - for ( lat_deg = 0; - lat_deg <= (360 - STEP_LATITUDE); - lat_deg += STEP_LATITUDE ) - { - /* - * Color this polygon with red or white. - */ - if ( colorToggle ) - glColor3f( 0.8f, 0.1f, 0.1f ); - else - glColor3f( 0.95f, 0.95f, 0.95f ); -#if 0 - if ( lat_deg >= 180 ) - if ( colorToggle ) - glColor3f( 0.1f, 0.8f, 0.1f ); - else - glColor3f( 0.5f, 0.5f, 0.95f ); -#endif - colorToggle = ! colorToggle; - - /* - * Change color if drawing shadow. - */ - if ( drawBallHow == DRAW_BALL_SHADOW ) - glColor3f( 0.35f, 0.35f, 0.35f ); - - /* - * Assign each Y. - */ - vert_ne.y = vert_nw.y = (float) cos_deg(long_hi) * RADIUS; - vert_sw.y = vert_se.y = (float) cos_deg(long_lo) * RADIUS; - - /* - * Assign each X,Z with sin,cos values scaled by latitude radius indexed by longitude. - * Eg, long=0 and long=180 are at the poles, so zero scale is sin(longitude), - * while long=90 (sin(90)=1) is at equator. - */ - vert_ne.x = (float) cos_deg( lat_deg ) * (RADIUS * (float) sin_deg( long_lo + STEP_LONGITUDE )); - vert_se.x = (float) cos_deg( lat_deg ) * (RADIUS * (float) sin_deg( long_lo )); - vert_nw.x = (float) cos_deg( lat_deg + STEP_LATITUDE ) * (RADIUS * (float) sin_deg( long_lo + STEP_LONGITUDE )); - vert_sw.x = (float) cos_deg( lat_deg + STEP_LATITUDE ) * (RADIUS * (float) sin_deg( long_lo )); - - vert_ne.z = (float) sin_deg( lat_deg ) * (RADIUS * (float) sin_deg( long_lo + STEP_LONGITUDE )); - vert_se.z = (float) sin_deg( lat_deg ) * (RADIUS * (float) sin_deg( long_lo )); - vert_nw.z = (float) sin_deg( lat_deg + STEP_LATITUDE ) * (RADIUS * (float) sin_deg( long_lo + STEP_LONGITUDE )); - vert_sw.z = (float) sin_deg( lat_deg + STEP_LATITUDE ) * (RADIUS * (float) sin_deg( long_lo )); - - /* - * Draw the facet. - */ - glBegin( GL_POLYGON ); - - CrossProduct( vert_ne, vert_nw, vert_sw, &vert_norm ); - glNormal3f( vert_norm.x, vert_norm.y, vert_norm.z ); - - glVertex3f( vert_ne.x, vert_ne.y, vert_ne.z ); - glVertex3f( vert_nw.x, vert_nw.y, vert_nw.z ); - glVertex3f( vert_sw.x, vert_sw.y, vert_sw.z ); - glVertex3f( vert_se.x, vert_se.y, vert_se.z ); - - glEnd(); - -#if BOING_DEBUG - printf( "----------------------------------------------------------- \n" ); - printf( "lat = %f long_lo = %f long_hi = %f \n", lat_deg, long_lo, long_hi ); - printf( "vert_ne x = %.8f y = %.8f z = %.8f \n", vert_ne.x, vert_ne.y, vert_ne.z ); - printf( "vert_nw x = %.8f y = %.8f z = %.8f \n", vert_nw.x, vert_nw.y, vert_nw.z ); - printf( "vert_se x = %.8f y = %.8f z = %.8f \n", vert_se.x, vert_se.y, vert_se.z ); - printf( "vert_sw x = %.8f y = %.8f z = %.8f \n", vert_sw.x, vert_sw.y, vert_sw.z ); -#endif - - } - - /* - * Toggle color so that next band will opposite red/white colors than this one. - */ - colorToggle = ! colorToggle; - - /* - * This circular band is done. - */ - return; -} - - -/***************************************************************************** - * Draw the purple grid of lines, behind the Boing ball. - * When the Workbench is dropped to the bottom, Boing shows 12 rows. - *****************************************************************************/ -void DrawGrid( void ) -{ - int row, col; - const int rowTotal = 12; /* must be divisible by 2 */ - const int colTotal = rowTotal; /* must be same as rowTotal */ - const GLfloat widthLine = 2.0; /* should be divisible by 2 */ - const GLfloat sizeCell = GRID_SIZE / rowTotal; - const GLfloat z_offset = -40.0; - GLfloat xl, xr; - GLfloat yt, yb; - - glPushMatrix(); - glDisable( GL_CULL_FACE ); - - /* - * Another relative Z translation to separate objects. - */ - glTranslatef( 0.0, 0.0, DIST_BALL ); - - /* - * Draw vertical lines (as skinny 3D rectangles). - */ - for ( col = 0; col <= colTotal; col++ ) - { - /* - * Compute co-ords of line. - */ - xl = -GRID_SIZE / 2 + col * sizeCell; - xr = xl + widthLine; - - yt = GRID_SIZE / 2; - yb = -GRID_SIZE / 2 - widthLine; - - glBegin( GL_POLYGON ); - - glColor3f( 0.6f, 0.1f, 0.6f ); /* purple */ - - glVertex3f( xr, yt, z_offset ); /* NE */ - glVertex3f( xl, yt, z_offset ); /* NW */ - glVertex3f( xl, yb, z_offset ); /* SW */ - glVertex3f( xr, yb, z_offset ); /* SE */ - - glEnd(); - } - - /* - * Draw horizontal lines (as skinny 3D rectangles). - */ - for ( row = 0; row <= rowTotal; row++ ) - { - /* - * Compute co-ords of line. - */ - yt = GRID_SIZE / 2 - row * sizeCell; - yb = yt - widthLine; - - xl = -GRID_SIZE / 2; - xr = GRID_SIZE / 2 + widthLine; - - glBegin( GL_POLYGON ); - - glColor3f( 0.6f, 0.1f, 0.6f ); /* purple */ - - glVertex3f( xr, yt, z_offset ); /* NE */ - glVertex3f( xl, yt, z_offset ); /* NW */ - glVertex3f( xl, yb, z_offset ); /* SW */ - glVertex3f( xr, yb, z_offset ); /* SE */ - - glEnd(); - } - - glPopMatrix(); - - return; -} - - -/*======================================================================* - * main() - *======================================================================*/ - -int main( void ) -{ - GLFWwindow* window; - - /* Init GLFW */ - if( !glfwInit() ) - exit( EXIT_FAILURE ); - - window = glfwCreateWindow( 400, 400, "Boing (classic Amiga demo)", NULL, NULL ); - if (!window) - { - glfwTerminate(); - exit( EXIT_FAILURE ); - } - - glfwSetWindowAspectRatio(window, 1, 1); - - glfwSetFramebufferSizeCallback(window, reshape); - glfwSetKeyCallback(window, key_callback); - glfwSetMouseButtonCallback(window, mouse_button_callback); - glfwSetCursorPosCallback(window, cursor_position_callback); - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - glfwSwapInterval( 1 ); - - glfwGetFramebufferSize(window, &width, &height); - reshape(window, width, height); - - glfwSetTime( 0.0 ); - - init(); - - /* Main loop */ - for (;;) - { - /* Timing */ - t = glfwGetTime(); - dt = t - t_old; - t_old = t; - - /* Draw one frame */ - display(); - - /* Swap buffers */ - glfwSwapBuffers(window); - glfwPollEvents(); - - /* Check if we are still running */ - if (glfwWindowShouldClose(window)) - break; - } - - glfwTerminate(); - exit( EXIT_SUCCESS ); -} - diff --git a/third_party/penumbra/vendor/glfw/examples/gears.c b/third_party/penumbra/vendor/glfw/examples/gears.c deleted file mode 100644 index 292f44b5918..00000000000 --- a/third_party/penumbra/vendor/glfw/examples/gears.c +++ /dev/null @@ -1,360 +0,0 @@ -/* - * 3-D gear wheels. This program is in the public domain. - * - * Command line options: - * -info print GL implementation information - * -exit automatically exit after 30 seconds - * - * - * Brian Paul - * - * - * Marcus Geelnard: - * - Conversion to GLFW - * - Time based rendering (frame rate independent) - * - Slightly modified camera that should work better for stereo viewing - * - * - * Camilla Löwy: - * - Removed FPS counter (this is not a benchmark) - * - Added a few comments - * - Enabled vsync - */ - -#if defined(_MSC_VER) - // Make MS math.h define M_PI - #define _USE_MATH_DEFINES -#endif - -#include -#include -#include -#include - -#include -#define GLFW_INCLUDE_NONE -#include - -/** - - Draw a gear wheel. You'll probably want to call this function when - building a display list since we do a lot of trig here. - - Input: inner_radius - radius of hole at center - outer_radius - radius at center of teeth - width - width of gear teeth - number of teeth - tooth_depth - depth of tooth - - **/ - -static void -gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, - GLint teeth, GLfloat tooth_depth) -{ - GLint i; - GLfloat r0, r1, r2; - GLfloat angle, da; - GLfloat u, v, len; - - r0 = inner_radius; - r1 = outer_radius - tooth_depth / 2.f; - r2 = outer_radius + tooth_depth / 2.f; - - da = 2.f * (float) M_PI / teeth / 4.f; - - glShadeModel(GL_FLAT); - - glNormal3f(0.f, 0.f, 1.f); - - /* draw front face */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= teeth; i++) { - angle = i * 2.f * (float) M_PI / teeth; - glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), width * 0.5f); - glVertex3f(r1 * (float) cos(angle), r1 * (float) sin(angle), width * 0.5f); - if (i < teeth) { - glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), width * 0.5f); - glVertex3f(r1 * (float) cos(angle + 3 * da), r1 * (float) sin(angle + 3 * da), width * 0.5f); - } - } - glEnd(); - - /* draw front sides of teeth */ - glBegin(GL_QUADS); - da = 2.f * (float) M_PI / teeth / 4.f; - for (i = 0; i < teeth; i++) { - angle = i * 2.f * (float) M_PI / teeth; - - glVertex3f(r1 * (float) cos(angle), r1 * (float) sin(angle), width * 0.5f); - glVertex3f(r2 * (float) cos(angle + da), r2 * (float) sin(angle + da), width * 0.5f); - glVertex3f(r2 * (float) cos(angle + 2 * da), r2 * (float) sin(angle + 2 * da), width * 0.5f); - glVertex3f(r1 * (float) cos(angle + 3 * da), r1 * (float) sin(angle + 3 * da), width * 0.5f); - } - glEnd(); - - glNormal3f(0.0, 0.0, -1.0); - - /* draw back face */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= teeth; i++) { - angle = i * 2.f * (float) M_PI / teeth; - glVertex3f(r1 * (float) cos(angle), r1 * (float) sin(angle), -width * 0.5f); - glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), -width * 0.5f); - if (i < teeth) { - glVertex3f(r1 * (float) cos(angle + 3 * da), r1 * (float) sin(angle + 3 * da), -width * 0.5f); - glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), -width * 0.5f); - } - } - glEnd(); - - /* draw back sides of teeth */ - glBegin(GL_QUADS); - da = 2.f * (float) M_PI / teeth / 4.f; - for (i = 0; i < teeth; i++) { - angle = i * 2.f * (float) M_PI / teeth; - - glVertex3f(r1 * (float) cos(angle + 3 * da), r1 * (float) sin(angle + 3 * da), -width * 0.5f); - glVertex3f(r2 * (float) cos(angle + 2 * da), r2 * (float) sin(angle + 2 * da), -width * 0.5f); - glVertex3f(r2 * (float) cos(angle + da), r2 * (float) sin(angle + da), -width * 0.5f); - glVertex3f(r1 * (float) cos(angle), r1 * (float) sin(angle), -width * 0.5f); - } - glEnd(); - - /* draw outward faces of teeth */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i < teeth; i++) { - angle = i * 2.f * (float) M_PI / teeth; - - glVertex3f(r1 * (float) cos(angle), r1 * (float) sin(angle), width * 0.5f); - glVertex3f(r1 * (float) cos(angle), r1 * (float) sin(angle), -width * 0.5f); - u = r2 * (float) cos(angle + da) - r1 * (float) cos(angle); - v = r2 * (float) sin(angle + da) - r1 * (float) sin(angle); - len = (float) sqrt(u * u + v * v); - u /= len; - v /= len; - glNormal3f(v, -u, 0.0); - glVertex3f(r2 * (float) cos(angle + da), r2 * (float) sin(angle + da), width * 0.5f); - glVertex3f(r2 * (float) cos(angle + da), r2 * (float) sin(angle + da), -width * 0.5f); - glNormal3f((float) cos(angle), (float) sin(angle), 0.f); - glVertex3f(r2 * (float) cos(angle + 2 * da), r2 * (float) sin(angle + 2 * da), width * 0.5f); - glVertex3f(r2 * (float) cos(angle + 2 * da), r2 * (float) sin(angle + 2 * da), -width * 0.5f); - u = r1 * (float) cos(angle + 3 * da) - r2 * (float) cos(angle + 2 * da); - v = r1 * (float) sin(angle + 3 * da) - r2 * (float) sin(angle + 2 * da); - glNormal3f(v, -u, 0.f); - glVertex3f(r1 * (float) cos(angle + 3 * da), r1 * (float) sin(angle + 3 * da), width * 0.5f); - glVertex3f(r1 * (float) cos(angle + 3 * da), r1 * (float) sin(angle + 3 * da), -width * 0.5f); - glNormal3f((float) cos(angle), (float) sin(angle), 0.f); - } - - glVertex3f(r1 * (float) cos(0), r1 * (float) sin(0), width * 0.5f); - glVertex3f(r1 * (float) cos(0), r1 * (float) sin(0), -width * 0.5f); - - glEnd(); - - glShadeModel(GL_SMOOTH); - - /* draw inside radius cylinder */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= teeth; i++) { - angle = i * 2.f * (float) M_PI / teeth; - glNormal3f(-(float) cos(angle), -(float) sin(angle), 0.f); - glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), -width * 0.5f); - glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), width * 0.5f); - } - glEnd(); - -} - - -static GLfloat view_rotx = 20.f, view_roty = 30.f, view_rotz = 0.f; -static GLint gear1, gear2, gear3; -static GLfloat angle = 0.f; - -/* OpenGL draw function & timing */ -static void draw(void) -{ - glClearColor(0.0, 0.0, 0.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glPushMatrix(); - glRotatef(view_rotx, 1.0, 0.0, 0.0); - glRotatef(view_roty, 0.0, 1.0, 0.0); - glRotatef(view_rotz, 0.0, 0.0, 1.0); - - glPushMatrix(); - glTranslatef(-3.0, -2.0, 0.0); - glRotatef(angle, 0.0, 0.0, 1.0); - glCallList(gear1); - glPopMatrix(); - - glPushMatrix(); - glTranslatef(3.1f, -2.f, 0.f); - glRotatef(-2.f * angle - 9.f, 0.f, 0.f, 1.f); - glCallList(gear2); - glPopMatrix(); - - glPushMatrix(); - glTranslatef(-3.1f, 4.2f, 0.f); - glRotatef(-2.f * angle - 25.f, 0.f, 0.f, 1.f); - glCallList(gear3); - glPopMatrix(); - - glPopMatrix(); -} - - -/* update animation parameters */ -static void animate(void) -{ - angle = 100.f * (float) glfwGetTime(); -} - - -/* change view angle, exit upon ESC */ -void key( GLFWwindow* window, int k, int s, int action, int mods ) -{ - if( action != GLFW_PRESS ) return; - - switch (k) { - case GLFW_KEY_Z: - if( mods & GLFW_MOD_SHIFT ) - view_rotz -= 5.0; - else - view_rotz += 5.0; - break; - case GLFW_KEY_ESCAPE: - glfwSetWindowShouldClose(window, GLFW_TRUE); - break; - case GLFW_KEY_UP: - view_rotx += 5.0; - break; - case GLFW_KEY_DOWN: - view_rotx -= 5.0; - break; - case GLFW_KEY_LEFT: - view_roty += 5.0; - break; - case GLFW_KEY_RIGHT: - view_roty -= 5.0; - break; - default: - return; - } -} - - -/* new window size */ -void reshape( GLFWwindow* window, int width, int height ) -{ - GLfloat h = (GLfloat) height / (GLfloat) width; - GLfloat xmax, znear, zfar; - - znear = 5.0f; - zfar = 30.0f; - xmax = znear * 0.5f; - - glViewport( 0, 0, (GLint) width, (GLint) height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -xmax, xmax, -xmax*h, xmax*h, znear, zfar ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -20.0 ); -} - - -/* program & OpenGL initialization */ -static void init(void) -{ - static GLfloat pos[4] = {5.f, 5.f, 10.f, 0.f}; - static GLfloat red[4] = {0.8f, 0.1f, 0.f, 1.f}; - static GLfloat green[4] = {0.f, 0.8f, 0.2f, 1.f}; - static GLfloat blue[4] = {0.2f, 0.2f, 1.f, 1.f}; - - glLightfv(GL_LIGHT0, GL_POSITION, pos); - glEnable(GL_CULL_FACE); - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - glEnable(GL_DEPTH_TEST); - - /* make the gears */ - gear1 = glGenLists(1); - glNewList(gear1, GL_COMPILE); - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red); - gear(1.f, 4.f, 1.f, 20, 0.7f); - glEndList(); - - gear2 = glGenLists(1); - glNewList(gear2, GL_COMPILE); - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green); - gear(0.5f, 2.f, 2.f, 10, 0.7f); - glEndList(); - - gear3 = glGenLists(1); - glNewList(gear3, GL_COMPILE); - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue); - gear(1.3f, 2.f, 0.5f, 10, 0.7f); - glEndList(); - - glEnable(GL_NORMALIZE); -} - - -/* program entry */ -int main(int argc, char *argv[]) -{ - GLFWwindow* window; - int width, height; - - if( !glfwInit() ) - { - fprintf( stderr, "Failed to initialize GLFW\n" ); - exit( EXIT_FAILURE ); - } - - glfwWindowHint(GLFW_DEPTH_BITS, 16); - glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); - - window = glfwCreateWindow( 300, 300, "Gears", NULL, NULL ); - if (!window) - { - fprintf( stderr, "Failed to open GLFW window\n" ); - glfwTerminate(); - exit( EXIT_FAILURE ); - } - - // Set callback functions - glfwSetFramebufferSizeCallback(window, reshape); - glfwSetKeyCallback(window, key); - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - glfwSwapInterval( 1 ); - - glfwGetFramebufferSize(window, &width, &height); - reshape(window, width, height); - - // Parse command-line options - init(); - - // Main loop - while( !glfwWindowShouldClose(window) ) - { - // Draw gears - draw(); - - // Update animation - animate(); - - // Swap buffers - glfwSwapBuffers(window); - glfwPollEvents(); - } - - // Terminate GLFW - glfwTerminate(); - - // Exit program - exit( EXIT_SUCCESS ); -} - diff --git a/third_party/penumbra/vendor/glfw/examples/glfw.icns b/third_party/penumbra/vendor/glfw/examples/glfw.icns deleted file mode 100644 index ad98f39752132003199572e951ee6d99dcceb823..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 27988 zcmeI)`CC(08VB%`#c-tog0dGS$YQIq6hwk$35!Z9A`(Q9U6h)#FKSo{0YP8@6^j%V z8`?nysw^TF5FrS~TD2gHRA@m>5d~SpXp|zo$qdiKbpC-(dAUE_b9nB_C7MLj z=W+tWq7e#pbK7Z8M+iA`qD@Wkvr;r8G#DWQ#tD)386na>8RNuA`Xow>w9mvifyNAk zWKZB{3xw3?7sk)e&Cbp9W_k12EVl4k^Gp0^!E%0X@iBorEj}i2v&F{*wqU=+`QYt? zz>*eNsJ(c7MvE)RQfnvwsbVg!o`3&#@}Jg+#cRdiznzRNB#$Ls3gFFy00@8p2!H?x zfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=9 z00@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2!Oy}L}1~`Lzynl+vH?5Wbub$$gvz9 zT=AzC;Y|XCh96*SXle7ER@P0QXo6K9x#{b8=a3nnABs-E8yL%i$U^r_Y>?FTVBWj=9PxdxAcYS^Jqdt<3QD>x!u#_Vvz69yR`Mk{p6!*4-Kl_ezVSWxLMT39PhoAK zSg0N4W#VIcT*>a;sX$6~MqREb%>GJh;rnOL-Ho>S&AMjY*X`ZqW%&ngu5w6FJFd5} z$iIa;zS*OaU{Z22o!Yo6Vi%i4a>{e*cFj}Eyc8gRU@Ufs*Am%UAa}X*=IDx&MUW>)*YUmwkgtT%S77p^*bukNd@ zeo7OU<2ySll4f431kdIca@O;?GJ+QQYXzjKw-ttSmFuUg>7#(DLa?6~2}HolO3%`1-e<0nRr6^`Hk!0$GYV+D4u?tVF7`5m``Yd|R! z-0bOjRmG@C*-LU>rp&cXH(*qUzOxVR+ip+mWoBU~~ZX#jwv)R{ENj~Zg=fcd+DNHtwh{^s!VUUPF6cjDo zKGQ^rxbwTJCyL~*sCjY>A&M)@!PbpS80&79L)tV_mC!eDhY-{4Qwx`gbXSkRFR~z# zPZ5($YC6c6C4ux<5ldZ0W!5G!%BTSOWw}=$FcjI$1m8V6gsTiXt(_7a1qu)_-C69o8X|x%? zg$&#RpkPM9=K>1I|6!$#Ah_-!r)o9Ci12`kSX-PO%I*A979N24zj2g^Uq$?P9G&5I zzlAsoaTMa{QjMd^xBe4HA67}@X!Eenj~64!D?(p-%dGZ$T-9sI*J1Jyfk<{GCat?t zNycb&CQpFJOiLpEON@res-fo2E&9@nD0s${Hf#wbx<~yF(yIjs4_A_5^bhJnq6D3$ic`2=D=;K{Y@y4KSDn_~HrG z0Hy&<14*`oMFFY-OasYRFIW_y8o)GweFNB$f$byMnEUJRA_|t-?xUo-Utj+7fB*X@ M%pLDj?WqX;0VcM~e*gdg diff --git a/third_party/penumbra/vendor/glfw/examples/glfw.ico b/third_party/penumbra/vendor/glfw/examples/glfw.ico deleted file mode 100644 index 882a66051e351ce313238ca673bd11812ea77fd6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21630 zcmeI4ze{9S6vvOrWSIpM)N!y z<+8}P+}hln`D-FC-W7TBWbpUj7WsKYeVrJ|vn7$wJ{0ah_`kd*^3_M`YyMbXjzzxs zShqLC_aBKo`oy+R{5_E`Keg?TW&a(K)z3wqaqkHbqQ0lB8Ps-flqT^L3WNfoKqwFj zgaV;JC=d#S0t=$Ry@p`E6WXV2!XCWoQ{Kn%V?ho_Jj_ra6bJ=Eflwe62n9lcP#_ct z1ww&PAQT7%LV-{q6bJ=Eflwe62n9lc1yR6X4-0>;3g~r8{RZX)-dv~TyPWsNf;=7L zVTJ;KsKC7!#9y1Z`#Kx-J5O(ILSKW*Fs35>$aFdw*4&h{voov)TK|#O^cJw_6ssR* z%70-yW9G?pk4neKfd}+ z&fC}hJn+*8-^lal-)p9fMk5)I$FjVIS8yk{RlC7;R+1}ok zot+)o-QAVFy*hj*Vor_b92+rLx~zP6sXYaXOi7Yh5{8DXkr3(Ed?qx&^sr{KnYTzfo?ECh60o# z4Rj|7GH?!;3VL2-wlA4=feH<@m<$CfG|=J_WGGOfffk$~LxBnn^g$%ZP@qBseP9VP z6sXXE9kA!zm%_S20~H`ah5{8Ds3-{vRA`_gCCE^qLIV{pL52bq8mO2FG8CxLfDKWL zR#Ey=S@Tyj)WSSuC{Uq+9*6`P3RGyI2PZ*>3JsPxSP3!|sL((UV1f({hYSTOG++bN!aNkH(149n3-kJc0xC3MN7TYR6sXXEowEz(p+JS#F+zb*U||*D zWb~jzKc{TM9xTc50cCpYbIO19dHl~lx7p`6i+gKvZ+)KmKF@rMduwrTeV+L~&wPt} zYjJOVp7}n{e2aT)ac_N|`99Bli+gKvZ+)KmKF@rMduwrTeV+L~&wPt}YjJOVp7}n{ ze2aT)ac_N|`99Bli+gKvZ+)KmKF@rMduwrTeV+L~&wPt}YjJOVp7}n{e2aT)ac?=j z#dtsk?!M2=`r*g73W|PM+cj;?v<=gii+-ZFQ`$Odo1`s~wm;hHXltWwjJ7P=o@gtg zZHKlP40=-*x$Gv*mTRm0 VVj`~F&hZW6f3mCD+3;_h-vJ|L*B$@> diff --git a/third_party/penumbra/vendor/glfw/examples/glfw.rc b/third_party/penumbra/vendor/glfw/examples/glfw.rc deleted file mode 100644 index f2b62f6c40b..00000000000 --- a/third_party/penumbra/vendor/glfw/examples/glfw.rc +++ /dev/null @@ -1,3 +0,0 @@ - -GLFW_ICON ICON "glfw.ico" - diff --git a/third_party/penumbra/vendor/glfw/examples/heightmap.c b/third_party/penumbra/vendor/glfw/examples/heightmap.c deleted file mode 100644 index 13a3c1e147f..00000000000 --- a/third_party/penumbra/vendor/glfw/examples/heightmap.c +++ /dev/null @@ -1,512 +0,0 @@ -//======================================================================== -// Heightmap example program using OpenGL 3 core profile -// Copyright (c) 2010 Olivier Delannoy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== - -#include -#include -#include -#include -#include - -#include -#define GLFW_INCLUDE_NONE -#include - -/* Map height updates */ -#define MAX_CIRCLE_SIZE (5.0f) -#define MAX_DISPLACEMENT (1.0f) -#define DISPLACEMENT_SIGN_LIMIT (0.3f) -#define MAX_ITER (200) -#define NUM_ITER_AT_A_TIME (1) - -/* Map general information */ -#define MAP_SIZE (10.0f) -#define MAP_NUM_VERTICES (80) -#define MAP_NUM_TOTAL_VERTICES (MAP_NUM_VERTICES*MAP_NUM_VERTICES) -#define MAP_NUM_LINES (3* (MAP_NUM_VERTICES - 1) * (MAP_NUM_VERTICES - 1) + \ - 2 * (MAP_NUM_VERTICES - 1)) - - -/********************************************************************** - * Default shader programs - *********************************************************************/ - -static const char* vertex_shader_text = -"#version 150\n" -"uniform mat4 project;\n" -"uniform mat4 modelview;\n" -"in float x;\n" -"in float y;\n" -"in float z;\n" -"\n" -"void main()\n" -"{\n" -" gl_Position = project * modelview * vec4(x, y, z, 1.0);\n" -"}\n"; - -static const char* fragment_shader_text = -"#version 150\n" -"out vec4 color;\n" -"void main()\n" -"{\n" -" color = vec4(0.2, 1.0, 0.2, 1.0); \n" -"}\n"; - -/********************************************************************** - * Values for shader uniforms - *********************************************************************/ - -/* Frustum configuration */ -static GLfloat view_angle = 45.0f; -static GLfloat aspect_ratio = 4.0f/3.0f; -static GLfloat z_near = 1.0f; -static GLfloat z_far = 100.f; - -/* Projection matrix */ -static GLfloat projection_matrix[16] = { - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f -}; - -/* Model view matrix */ -static GLfloat modelview_matrix[16] = { - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f -}; - -/********************************************************************** - * Heightmap vertex and index data - *********************************************************************/ - -static GLfloat map_vertices[3][MAP_NUM_TOTAL_VERTICES]; -static GLuint map_line_indices[2*MAP_NUM_LINES]; - -/* Store uniform location for the shaders - * Those values are setup as part of the process of creating - * the shader program. They should not be used before creating - * the program. - */ -static GLuint mesh; -static GLuint mesh_vbo[4]; - -/********************************************************************** - * OpenGL helper functions - *********************************************************************/ - -/* Creates a shader object of the specified type using the specified text - */ -static GLuint make_shader(GLenum type, const char* text) -{ - GLuint shader; - GLint shader_ok; - GLsizei log_length; - char info_log[8192]; - - shader = glCreateShader(type); - if (shader != 0) - { - glShaderSource(shader, 1, (const GLchar**)&text, NULL); - glCompileShader(shader); - glGetShaderiv(shader, GL_COMPILE_STATUS, &shader_ok); - if (shader_ok != GL_TRUE) - { - fprintf(stderr, "ERROR: Failed to compile %s shader\n", (type == GL_FRAGMENT_SHADER) ? "fragment" : "vertex" ); - glGetShaderInfoLog(shader, 8192, &log_length,info_log); - fprintf(stderr, "ERROR: \n%s\n\n", info_log); - glDeleteShader(shader); - shader = 0; - } - } - return shader; -} - -/* Creates a program object using the specified vertex and fragment text - */ -static GLuint make_shader_program(const char* vs_text, const char* fs_text) -{ - GLuint program = 0u; - GLint program_ok; - GLuint vertex_shader = 0u; - GLuint fragment_shader = 0u; - GLsizei log_length; - char info_log[8192]; - - vertex_shader = make_shader(GL_VERTEX_SHADER, vs_text); - if (vertex_shader != 0u) - { - fragment_shader = make_shader(GL_FRAGMENT_SHADER, fs_text); - if (fragment_shader != 0u) - { - /* make the program that connect the two shader and link it */ - program = glCreateProgram(); - if (program != 0u) - { - /* attach both shader and link */ - glAttachShader(program, vertex_shader); - glAttachShader(program, fragment_shader); - glLinkProgram(program); - glGetProgramiv(program, GL_LINK_STATUS, &program_ok); - - if (program_ok != GL_TRUE) - { - fprintf(stderr, "ERROR, failed to link shader program\n"); - glGetProgramInfoLog(program, 8192, &log_length, info_log); - fprintf(stderr, "ERROR: \n%s\n\n", info_log); - glDeleteProgram(program); - glDeleteShader(fragment_shader); - glDeleteShader(vertex_shader); - program = 0u; - } - } - } - else - { - fprintf(stderr, "ERROR: Unable to load fragment shader\n"); - glDeleteShader(vertex_shader); - } - } - else - { - fprintf(stderr, "ERROR: Unable to load vertex shader\n"); - } - return program; -} - -/********************************************************************** - * Geometry creation functions - *********************************************************************/ - -/* Generate vertices and indices for the heightmap - */ -static void init_map(void) -{ - int i; - int j; - int k; - GLfloat step = MAP_SIZE / (MAP_NUM_VERTICES - 1); - GLfloat x = 0.0f; - GLfloat z = 0.0f; - /* Create a flat grid */ - k = 0; - for (i = 0 ; i < MAP_NUM_VERTICES ; ++i) - { - for (j = 0 ; j < MAP_NUM_VERTICES ; ++j) - { - map_vertices[0][k] = x; - map_vertices[1][k] = 0.0f; - map_vertices[2][k] = z; - z += step; - ++k; - } - x += step; - z = 0.0f; - } -#if DEBUG_ENABLED - for (i = 0 ; i < MAP_NUM_TOTAL_VERTICES ; ++i) - { - printf ("Vertice %d (%f, %f, %f)\n", - i, map_vertices[0][i], map_vertices[1][i], map_vertices[2][i]); - - } -#endif - /* create indices */ - /* line fan based on i - * i+1 - * | / i + n + 1 - * | / - * |/ - * i --- i + n - */ - - /* close the top of the square */ - k = 0; - for (i = 0 ; i < MAP_NUM_VERTICES -1 ; ++i) - { - map_line_indices[k++] = (i + 1) * MAP_NUM_VERTICES -1; - map_line_indices[k++] = (i + 2) * MAP_NUM_VERTICES -1; - } - /* close the right of the square */ - for (i = 0 ; i < MAP_NUM_VERTICES -1 ; ++i) - { - map_line_indices[k++] = (MAP_NUM_VERTICES - 1) * MAP_NUM_VERTICES + i; - map_line_indices[k++] = (MAP_NUM_VERTICES - 1) * MAP_NUM_VERTICES + i + 1; - } - - for (i = 0 ; i < (MAP_NUM_VERTICES - 1) ; ++i) - { - for (j = 0 ; j < (MAP_NUM_VERTICES - 1) ; ++j) - { - int ref = i * (MAP_NUM_VERTICES) + j; - map_line_indices[k++] = ref; - map_line_indices[k++] = ref + 1; - - map_line_indices[k++] = ref; - map_line_indices[k++] = ref + MAP_NUM_VERTICES; - - map_line_indices[k++] = ref; - map_line_indices[k++] = ref + MAP_NUM_VERTICES + 1; - } - } - -#ifdef DEBUG_ENABLED - for (k = 0 ; k < 2 * MAP_NUM_LINES ; k += 2) - { - int beg, end; - beg = map_line_indices[k]; - end = map_line_indices[k+1]; - printf ("Line %d: %d -> %d (%f, %f, %f) -> (%f, %f, %f)\n", - k / 2, beg, end, - map_vertices[0][beg], map_vertices[1][beg], map_vertices[2][beg], - map_vertices[0][end], map_vertices[1][end], map_vertices[2][end]); - } -#endif -} - -static void generate_heightmap__circle(float* center_x, float* center_y, - float* size, float* displacement) -{ - float sign; - /* random value for element in between [0-1.0] */ - *center_x = (MAP_SIZE * rand()) / (1.0f * RAND_MAX); - *center_y = (MAP_SIZE * rand()) / (1.0f * RAND_MAX); - *size = (MAX_CIRCLE_SIZE * rand()) / (1.0f * RAND_MAX); - sign = (1.0f * rand()) / (1.0f * RAND_MAX); - sign = (sign < DISPLACEMENT_SIGN_LIMIT) ? -1.0f : 1.0f; - *displacement = (sign * (MAX_DISPLACEMENT * rand())) / (1.0f * RAND_MAX); -} - -/* Run the specified number of iterations of the generation process for the - * heightmap - */ -static void update_map(int num_iter) -{ - assert(num_iter > 0); - while(num_iter) - { - /* center of the circle */ - float center_x; - float center_z; - float circle_size; - float disp; - size_t ii; - generate_heightmap__circle(¢er_x, ¢er_z, &circle_size, &disp); - disp = disp / 2.0f; - for (ii = 0u ; ii < MAP_NUM_TOTAL_VERTICES ; ++ii) - { - GLfloat dx = center_x - map_vertices[0][ii]; - GLfloat dz = center_z - map_vertices[2][ii]; - GLfloat pd = (2.0f * (float) sqrt((dx * dx) + (dz * dz))) / circle_size; - if (fabs(pd) <= 1.0f) - { - /* tx,tz is within the circle */ - GLfloat new_height = disp + (float) (cos(pd*3.14f)*disp); - map_vertices[1][ii] += new_height; - } - } - --num_iter; - } -} - -/********************************************************************** - * OpenGL helper functions - *********************************************************************/ - -/* Create VBO, IBO and VAO objects for the heightmap geometry and bind them to - * the specified program object - */ -static void make_mesh(GLuint program) -{ - GLuint attrloc; - - glGenVertexArrays(1, &mesh); - glGenBuffers(4, mesh_vbo); - glBindVertexArray(mesh); - /* Prepare the data for drawing through a buffer inidices */ - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh_vbo[3]); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint)* MAP_NUM_LINES * 2, map_line_indices, GL_STATIC_DRAW); - - /* Prepare the attributes for rendering */ - attrloc = glGetAttribLocation(program, "x"); - glBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[0]); - glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[0][0], GL_STATIC_DRAW); - glEnableVertexAttribArray(attrloc); - glVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0); - - attrloc = glGetAttribLocation(program, "z"); - glBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[2]); - glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[2][0], GL_STATIC_DRAW); - glEnableVertexAttribArray(attrloc); - glVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0); - - attrloc = glGetAttribLocation(program, "y"); - glBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[1]); - glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[1][0], GL_DYNAMIC_DRAW); - glEnableVertexAttribArray(attrloc); - glVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0); -} - -/* Update VBO vertices from source data - */ -static void update_mesh(void) -{ - glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[1][0]); -} - -/********************************************************************** - * GLFW callback functions - *********************************************************************/ - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - switch(key) - { - case GLFW_KEY_ESCAPE: - /* Exit program on Escape */ - glfwSetWindowShouldClose(window, GLFW_TRUE); - break; - } -} - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -int main(int argc, char** argv) -{ - GLFWwindow* window; - int iter; - double dt; - double last_update_time; - int frame; - float f; - GLint uloc_modelview; - GLint uloc_project; - int width, height; - - GLuint shader_program; - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); - glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); - glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); - - window = glfwCreateWindow(800, 600, "GLFW OpenGL3 Heightmap demo", NULL, NULL); - if (! window ) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - /* Register events callback */ - glfwSetKeyCallback(window, key_callback); - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - - /* Prepare opengl resources for rendering */ - shader_program = make_shader_program(vertex_shader_text, fragment_shader_text); - - if (shader_program == 0u) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glUseProgram(shader_program); - uloc_project = glGetUniformLocation(shader_program, "project"); - uloc_modelview = glGetUniformLocation(shader_program, "modelview"); - - /* Compute the projection matrix */ - f = 1.0f / tanf(view_angle / 2.0f); - projection_matrix[0] = f / aspect_ratio; - projection_matrix[5] = f; - projection_matrix[10] = (z_far + z_near)/ (z_near - z_far); - projection_matrix[11] = -1.0f; - projection_matrix[14] = 2.0f * (z_far * z_near) / (z_near - z_far); - glUniformMatrix4fv(uloc_project, 1, GL_FALSE, projection_matrix); - - /* Set the camera position */ - modelview_matrix[12] = -5.0f; - modelview_matrix[13] = -5.0f; - modelview_matrix[14] = -20.0f; - glUniformMatrix4fv(uloc_modelview, 1, GL_FALSE, modelview_matrix); - - /* Create mesh data */ - init_map(); - make_mesh(shader_program); - - /* Create vao + vbo to store the mesh */ - /* Create the vbo to store all the information for the grid and the height */ - - /* setup the scene ready for rendering */ - glfwGetFramebufferSize(window, &width, &height); - glViewport(0, 0, width, height); - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - - /* main loop */ - frame = 0; - iter = 0; - last_update_time = glfwGetTime(); - - while (!glfwWindowShouldClose(window)) - { - ++frame; - /* render the next frame */ - glClear(GL_COLOR_BUFFER_BIT); - glDrawElements(GL_LINES, 2* MAP_NUM_LINES , GL_UNSIGNED_INT, 0); - - /* display and process events through callbacks */ - glfwSwapBuffers(window); - glfwPollEvents(); - /* Check the frame rate and update the heightmap if needed */ - dt = glfwGetTime(); - if ((dt - last_update_time) > 0.2) - { - /* generate the next iteration of the heightmap */ - if (iter < MAX_ITER) - { - update_map(NUM_ITER_AT_A_TIME); - update_mesh(); - iter += NUM_ITER_AT_A_TIME; - } - last_update_time = dt; - frame = 0; - } - } - - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/examples/offscreen.c b/third_party/penumbra/vendor/glfw/examples/offscreen.c deleted file mode 100644 index eca37c48108..00000000000 --- a/third_party/penumbra/vendor/glfw/examples/offscreen.c +++ /dev/null @@ -1,176 +0,0 @@ -//======================================================================== -// Offscreen rendering example -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#if USE_NATIVE_OSMESA - #define GLFW_EXPOSE_NATIVE_OSMESA - #include -#endif - -#include "linmath.h" - -#include -#include - -#define STB_IMAGE_WRITE_IMPLEMENTATION -#include - -static const struct -{ - float x, y; - float r, g, b; -} vertices[3] = -{ - { -0.6f, -0.4f, 1.f, 0.f, 0.f }, - { 0.6f, -0.4f, 0.f, 1.f, 0.f }, - { 0.f, 0.6f, 0.f, 0.f, 1.f } -}; - -static const char* vertex_shader_text = -"#version 110\n" -"uniform mat4 MVP;\n" -"attribute vec3 vCol;\n" -"attribute vec2 vPos;\n" -"varying vec3 color;\n" -"void main()\n" -"{\n" -" gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n" -" color = vCol;\n" -"}\n"; - -static const char* fragment_shader_text = -"#version 110\n" -"varying vec3 color;\n" -"void main()\n" -"{\n" -" gl_FragColor = vec4(color, 1.0);\n" -"}\n"; - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -int main(void) -{ - GLFWwindow* window; - GLuint vertex_buffer, vertex_shader, fragment_shader, program; - GLint mvp_location, vpos_location, vcol_location; - float ratio; - int width, height; - mat4x4 mvp; - char* buffer; - - glfwSetErrorCallback(error_callback); - - glfwInitHint(GLFW_COCOA_MENUBAR, GLFW_FALSE); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); - glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); - - window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL); - if (!window) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - - // NOTE: OpenGL error checks have been omitted for brevity - - glGenBuffers(1, &vertex_buffer); - glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); - glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); - - vertex_shader = glCreateShader(GL_VERTEX_SHADER); - glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL); - glCompileShader(vertex_shader); - - fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); - glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL); - glCompileShader(fragment_shader); - - program = glCreateProgram(); - glAttachShader(program, vertex_shader); - glAttachShader(program, fragment_shader); - glLinkProgram(program); - - mvp_location = glGetUniformLocation(program, "MVP"); - vpos_location = glGetAttribLocation(program, "vPos"); - vcol_location = glGetAttribLocation(program, "vCol"); - - glEnableVertexAttribArray(vpos_location); - glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE, - sizeof(vertices[0]), (void*) 0); - glEnableVertexAttribArray(vcol_location); - glVertexAttribPointer(vcol_location, 3, GL_FLOAT, GL_FALSE, - sizeof(vertices[0]), (void*) (sizeof(float) * 2)); - - glfwGetFramebufferSize(window, &width, &height); - ratio = width / (float) height; - - glViewport(0, 0, width, height); - glClear(GL_COLOR_BUFFER_BIT); - - mat4x4_ortho(mvp, -ratio, ratio, -1.f, 1.f, 1.f, -1.f); - - glUseProgram(program); - glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); - glDrawArrays(GL_TRIANGLES, 0, 3); - -#if USE_NATIVE_OSMESA - glfwGetOSMesaColorBuffer(window, &width, &height, NULL, (void**) &buffer); -#else - buffer = calloc(4, width * height); - glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); -#endif - - // Write image Y-flipped because OpenGL - stbi_write_png("offscreen.png", - width, height, 4, - buffer + (width * 4 * (height - 1)), - -width * 4); - -#if USE_NATIVE_OSMESA - // Here is where there's nothing -#else - free(buffer); -#endif - - glfwDestroyWindow(window); - - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/examples/particles.c b/third_party/penumbra/vendor/glfw/examples/particles.c deleted file mode 100644 index 9556ccac0f0..00000000000 --- a/third_party/penumbra/vendor/glfw/examples/particles.c +++ /dev/null @@ -1,1073 +0,0 @@ -//======================================================================== -// A simple particle engine with threaded physics -// Copyright (c) Marcus Geelnard -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== - -#if defined(_MSC_VER) - // Make MS math.h define M_PI - #define _USE_MATH_DEFINES -#endif - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#define GLFW_INCLUDE_NONE -#include - -// Define tokens for GL_EXT_separate_specular_color if not already defined -#ifndef GL_EXT_separate_specular_color -#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 -#define GL_SINGLE_COLOR_EXT 0x81F9 -#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA -#endif // GL_EXT_separate_specular_color - - -//======================================================================== -// Type definitions -//======================================================================== - -typedef struct -{ - float x, y, z; -} Vec3; - -// This structure is used for interleaved vertex arrays (see the -// draw_particles function) -// -// NOTE: This structure SHOULD be packed on most systems. It uses 32-bit fields -// on 32-bit boundaries, and is a multiple of 64 bits in total (6x32=3x64). If -// it does not work, try using pragmas or whatever to force the structure to be -// packed. -typedef struct -{ - GLfloat s, t; // Texture coordinates - GLuint rgba; // Color (four ubytes packed into an uint) - GLfloat x, y, z; // Vertex coordinates -} Vertex; - - -//======================================================================== -// Program control global variables -//======================================================================== - -// Window dimensions -float aspect_ratio; - -// "wireframe" flag (true if we use wireframe view) -int wireframe; - -// Thread synchronization -struct { - double t; // Time (s) - float dt; // Time since last frame (s) - int p_frame; // Particle physics frame number - int d_frame; // Particle draw frame number - cnd_t p_done; // Condition: particle physics done - cnd_t d_done; // Condition: particle draw done - mtx_t particles_lock; // Particles data sharing mutex -} thread_sync; - - -//======================================================================== -// Texture declarations (we hard-code them into the source code, since -// they are so simple) -//======================================================================== - -#define P_TEX_WIDTH 8 // Particle texture dimensions -#define P_TEX_HEIGHT 8 -#define F_TEX_WIDTH 16 // Floor texture dimensions -#define F_TEX_HEIGHT 16 - -// Texture object IDs -GLuint particle_tex_id, floor_tex_id; - -// Particle texture (a simple spot) -const unsigned char particle_texture[ P_TEX_WIDTH * P_TEX_HEIGHT ] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x11, 0x22, 0x22, 0x11, 0x00, 0x00, - 0x00, 0x11, 0x33, 0x88, 0x77, 0x33, 0x11, 0x00, - 0x00, 0x22, 0x88, 0xff, 0xee, 0x77, 0x22, 0x00, - 0x00, 0x22, 0x77, 0xee, 0xff, 0x88, 0x22, 0x00, - 0x00, 0x11, 0x33, 0x77, 0x88, 0x33, 0x11, 0x00, - 0x00, 0x00, 0x11, 0x33, 0x22, 0x11, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -// Floor texture (your basic checkered floor) -const unsigned char floor_texture[ F_TEX_WIDTH * F_TEX_HEIGHT ] = { - 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, - 0xff, 0xf0, 0xcc, 0xf0, 0xf0, 0xf0, 0xff, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, - 0xf0, 0xcc, 0xee, 0xff, 0xf0, 0xf0, 0xf0, 0xf0, 0x30, 0x66, 0x30, 0x30, 0x30, 0x20, 0x30, 0x30, - 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xee, 0xf0, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, - 0xf0, 0xf0, 0xf0, 0xf0, 0xcc, 0xf0, 0xf0, 0xf0, 0x30, 0x30, 0x55, 0x30, 0x30, 0x44, 0x30, 0x30, - 0xf0, 0xdd, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x33, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, - 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xff, 0xf0, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x60, 0x30, - 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x33, 0x33, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, - 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x33, 0x30, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, - 0x30, 0x30, 0x30, 0x30, 0x30, 0x20, 0x30, 0x30, 0xf0, 0xff, 0xf0, 0xf0, 0xdd, 0xf0, 0xf0, 0xff, - 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x55, 0x33, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xff, 0xf0, 0xf0, - 0x30, 0x44, 0x66, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, - 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0xf0, 0xf0, 0xaa, 0xf0, 0xf0, 0xcc, 0xf0, - 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xff, 0xf0, 0xf0, 0xf0, 0xff, 0xf0, 0xdd, 0xf0, - 0x30, 0x30, 0x30, 0x77, 0x30, 0x30, 0x30, 0x30, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, - 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, -}; - - -//======================================================================== -// These are fixed constants that control the particle engine. In a -// modular world, these values should be variables... -//======================================================================== - -// Maximum number of particles -#define MAX_PARTICLES 3000 - -// Life span of a particle (in seconds) -#define LIFE_SPAN 8.f - -// A new particle is born every [BIRTH_INTERVAL] second -#define BIRTH_INTERVAL (LIFE_SPAN/(float)MAX_PARTICLES) - -// Particle size (meters) -#define PARTICLE_SIZE 0.7f - -// Gravitational constant (m/s^2) -#define GRAVITY 9.8f - -// Base initial velocity (m/s) -#define VELOCITY 8.f - -// Bounce friction (1.0 = no friction, 0.0 = maximum friction) -#define FRICTION 0.75f - -// "Fountain" height (m) -#define FOUNTAIN_HEIGHT 3.f - -// Fountain radius (m) -#define FOUNTAIN_RADIUS 1.6f - -// Minimum delta-time for particle phisics (s) -#define MIN_DELTA_T (BIRTH_INTERVAL * 0.5f) - - -//======================================================================== -// Particle system global variables -//======================================================================== - -// This structure holds all state for a single particle -typedef struct { - float x,y,z; // Position in space - float vx,vy,vz; // Velocity vector - float r,g,b; // Color of particle - float life; // Life of particle (1.0 = newborn, < 0.0 = dead) - int active; // Tells if this particle is active -} PARTICLE; - -// Global vectors holding all particles. We use two vectors for double -// buffering. -static PARTICLE particles[MAX_PARTICLES]; - -// Global variable holding the age of the youngest particle -static float min_age; - -// Color of latest born particle (used for fountain lighting) -static float glow_color[4]; - -// Position of latest born particle (used for fountain lighting) -static float glow_pos[4]; - - -//======================================================================== -// Object material and fog configuration constants -//======================================================================== - -const GLfloat fountain_diffuse[4] = { 0.7f, 1.f, 1.f, 1.f }; -const GLfloat fountain_specular[4] = { 1.f, 1.f, 1.f, 1.f }; -const GLfloat fountain_shininess = 12.f; -const GLfloat floor_diffuse[4] = { 1.f, 0.6f, 0.6f, 1.f }; -const GLfloat floor_specular[4] = { 0.6f, 0.6f, 0.6f, 1.f }; -const GLfloat floor_shininess = 18.f; -const GLfloat fog_color[4] = { 0.1f, 0.1f, 0.1f, 1.f }; - - -//======================================================================== -// Print usage information -//======================================================================== - -static void usage(void) -{ - printf("Usage: particles [-bfhs]\n"); - printf("Options:\n"); - printf(" -f Run in full screen\n"); - printf(" -h Display this help\n"); - printf(" -s Run program as single thread (default is to use two threads)\n"); - printf("\n"); - printf("Program runtime controls:\n"); - printf(" W Toggle wireframe mode\n"); - printf(" Esc Exit program\n"); -} - - -//======================================================================== -// Initialize a new particle -//======================================================================== - -static void init_particle(PARTICLE *p, double t) -{ - float xy_angle, velocity; - - // Start position of particle is at the fountain blow-out - p->x = 0.f; - p->y = 0.f; - p->z = FOUNTAIN_HEIGHT; - - // Start velocity is up (Z)... - p->vz = 0.7f + (0.3f / 4096.f) * (float) (rand() & 4095); - - // ...and a randomly chosen X/Y direction - xy_angle = (2.f * (float) M_PI / 4096.f) * (float) (rand() & 4095); - p->vx = 0.4f * (float) cos(xy_angle); - p->vy = 0.4f * (float) sin(xy_angle); - - // Scale velocity vector according to a time-varying velocity - velocity = VELOCITY * (0.8f + 0.1f * (float) (sin(0.5 * t) + sin(1.31 * t))); - p->vx *= velocity; - p->vy *= velocity; - p->vz *= velocity; - - // Color is time-varying - p->r = 0.7f + 0.3f * (float) sin(0.34 * t + 0.1); - p->g = 0.6f + 0.4f * (float) sin(0.63 * t + 1.1); - p->b = 0.6f + 0.4f * (float) sin(0.91 * t + 2.1); - - // Store settings for fountain glow lighting - glow_pos[0] = 0.4f * (float) sin(1.34 * t); - glow_pos[1] = 0.4f * (float) sin(3.11 * t); - glow_pos[2] = FOUNTAIN_HEIGHT + 1.f; - glow_pos[3] = 1.f; - glow_color[0] = p->r; - glow_color[1] = p->g; - glow_color[2] = p->b; - glow_color[3] = 1.f; - - // The particle is new-born and active - p->life = 1.f; - p->active = 1; -} - - -//======================================================================== -// Update a particle -//======================================================================== - -#define FOUNTAIN_R2 (FOUNTAIN_RADIUS+PARTICLE_SIZE/2)*(FOUNTAIN_RADIUS+PARTICLE_SIZE/2) - -static void update_particle(PARTICLE *p, float dt) -{ - // If the particle is not active, we need not do anything - if (!p->active) - return; - - // The particle is getting older... - p->life -= dt * (1.f / LIFE_SPAN); - - // Did the particle die? - if (p->life <= 0.f) - { - p->active = 0; - return; - } - - // Apply gravity - p->vz = p->vz - GRAVITY * dt; - - // Update particle position - p->x = p->x + p->vx * dt; - p->y = p->y + p->vy * dt; - p->z = p->z + p->vz * dt; - - // Simple collision detection + response - if (p->vz < 0.f) - { - // Particles should bounce on the fountain (with friction) - if ((p->x * p->x + p->y * p->y) < FOUNTAIN_R2 && - p->z < (FOUNTAIN_HEIGHT + PARTICLE_SIZE / 2)) - { - p->vz = -FRICTION * p->vz; - p->z = FOUNTAIN_HEIGHT + PARTICLE_SIZE / 2 + - FRICTION * (FOUNTAIN_HEIGHT + - PARTICLE_SIZE / 2 - p->z); - } - - // Particles should bounce on the floor (with friction) - else if (p->z < PARTICLE_SIZE / 2) - { - p->vz = -FRICTION * p->vz; - p->z = PARTICLE_SIZE / 2 + - FRICTION * (PARTICLE_SIZE / 2 - p->z); - } - } -} - - -//======================================================================== -// The main frame for the particle engine. Called once per frame. -//======================================================================== - -static void particle_engine(double t, float dt) -{ - int i; - float dt2; - - // Update particles (iterated several times per frame if dt is too large) - while (dt > 0.f) - { - // Calculate delta time for this iteration - dt2 = dt < MIN_DELTA_T ? dt : MIN_DELTA_T; - - for (i = 0; i < MAX_PARTICLES; i++) - update_particle(&particles[i], dt2); - - min_age += dt2; - - // Should we create any new particle(s)? - while (min_age >= BIRTH_INTERVAL) - { - min_age -= BIRTH_INTERVAL; - - // Find a dead particle to replace with a new one - for (i = 0; i < MAX_PARTICLES; i++) - { - if (!particles[i].active) - { - init_particle(&particles[i], t + min_age); - update_particle(&particles[i], min_age); - break; - } - } - } - - dt -= dt2; - } -} - - -//======================================================================== -// Draw all active particles. We use OpenGL 1.1 vertex -// arrays for this in order to accelerate the drawing. -//======================================================================== - -#define BATCH_PARTICLES 70 // Number of particles to draw in each batch - // (70 corresponds to 7.5 KB = will not blow - // the L1 data cache on most CPUs) -#define PARTICLE_VERTS 4 // Number of vertices per particle - -static void draw_particles(GLFWwindow* window, double t, float dt) -{ - int i, particle_count; - Vertex vertex_array[BATCH_PARTICLES * PARTICLE_VERTS]; - Vertex* vptr; - float alpha; - GLuint rgba; - Vec3 quad_lower_left, quad_lower_right; - GLfloat mat[16]; - PARTICLE* pptr; - - // Here comes the real trick with flat single primitive objects (s.c. - // "billboards"): We must rotate the textured primitive so that it - // always faces the viewer (is coplanar with the view-plane). - // We: - // 1) Create the primitive around origo (0,0,0) - // 2) Rotate it so that it is coplanar with the view plane - // 3) Translate it according to the particle position - // Note that 1) and 2) is the same for all particles (done only once). - - // Get modelview matrix. We will only use the upper left 3x3 part of - // the matrix, which represents the rotation. - glGetFloatv(GL_MODELVIEW_MATRIX, mat); - - // 1) & 2) We do it in one swift step: - // Although not obvious, the following six lines represent two matrix/ - // vector multiplications. The matrix is the inverse 3x3 rotation - // matrix (i.e. the transpose of the same matrix), and the two vectors - // represent the lower left corner of the quad, PARTICLE_SIZE/2 * - // (-1,-1,0), and the lower right corner, PARTICLE_SIZE/2 * (1,-1,0). - // The upper left/right corners of the quad is always the negative of - // the opposite corners (regardless of rotation). - quad_lower_left.x = (-PARTICLE_SIZE / 2) * (mat[0] + mat[1]); - quad_lower_left.y = (-PARTICLE_SIZE / 2) * (mat[4] + mat[5]); - quad_lower_left.z = (-PARTICLE_SIZE / 2) * (mat[8] + mat[9]); - quad_lower_right.x = (PARTICLE_SIZE / 2) * (mat[0] - mat[1]); - quad_lower_right.y = (PARTICLE_SIZE / 2) * (mat[4] - mat[5]); - quad_lower_right.z = (PARTICLE_SIZE / 2) * (mat[8] - mat[9]); - - // Don't update z-buffer, since all particles are transparent! - glDepthMask(GL_FALSE); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE); - - // Select particle texture - if (!wireframe) - { - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, particle_tex_id); - } - - // Set up vertex arrays. We use interleaved arrays, which is easier to - // handle (in most situations) and it gives a linear memory access - // access pattern (which may give better performance in some - // situations). GL_T2F_C4UB_V3F means: 2 floats for texture coords, - // 4 ubytes for color and 3 floats for vertex coord (in that order). - // Most OpenGL cards / drivers are optimized for this format. - glInterleavedArrays(GL_T2F_C4UB_V3F, 0, vertex_array); - - // Wait for particle physics thread to be done - mtx_lock(&thread_sync.particles_lock); - while (!glfwWindowShouldClose(window) && - thread_sync.p_frame <= thread_sync.d_frame) - { - struct timespec ts; - clock_gettime(CLOCK_REALTIME, &ts); - ts.tv_nsec += 100 * 1000 * 1000; - ts.tv_sec += ts.tv_nsec / (1000 * 1000 * 1000); - ts.tv_nsec %= 1000 * 1000 * 1000; - cnd_timedwait(&thread_sync.p_done, &thread_sync.particles_lock, &ts); - } - - // Store the frame time and delta time for the physics thread - thread_sync.t = t; - thread_sync.dt = dt; - - // Update frame counter - thread_sync.d_frame++; - - // Loop through all particles and build vertex arrays. - particle_count = 0; - vptr = vertex_array; - pptr = particles; - - for (i = 0; i < MAX_PARTICLES; i++) - { - if (pptr->active) - { - // Calculate particle intensity (we set it to max during 75% - // of its life, then it fades out) - alpha = 4.f * pptr->life; - if (alpha > 1.f) - alpha = 1.f; - - // Convert color from float to 8-bit (store it in a 32-bit - // integer using endian independent type casting) - ((GLubyte*) &rgba)[0] = (GLubyte)(pptr->r * 255.f); - ((GLubyte*) &rgba)[1] = (GLubyte)(pptr->g * 255.f); - ((GLubyte*) &rgba)[2] = (GLubyte)(pptr->b * 255.f); - ((GLubyte*) &rgba)[3] = (GLubyte)(alpha * 255.f); - - // 3) Translate the quad to the correct position in modelview - // space and store its parameters in vertex arrays (we also - // store texture coord and color information for each vertex). - - // Lower left corner - vptr->s = 0.f; - vptr->t = 0.f; - vptr->rgba = rgba; - vptr->x = pptr->x + quad_lower_left.x; - vptr->y = pptr->y + quad_lower_left.y; - vptr->z = pptr->z + quad_lower_left.z; - vptr ++; - - // Lower right corner - vptr->s = 1.f; - vptr->t = 0.f; - vptr->rgba = rgba; - vptr->x = pptr->x + quad_lower_right.x; - vptr->y = pptr->y + quad_lower_right.y; - vptr->z = pptr->z + quad_lower_right.z; - vptr ++; - - // Upper right corner - vptr->s = 1.f; - vptr->t = 1.f; - vptr->rgba = rgba; - vptr->x = pptr->x - quad_lower_left.x; - vptr->y = pptr->y - quad_lower_left.y; - vptr->z = pptr->z - quad_lower_left.z; - vptr ++; - - // Upper left corner - vptr->s = 0.f; - vptr->t = 1.f; - vptr->rgba = rgba; - vptr->x = pptr->x - quad_lower_right.x; - vptr->y = pptr->y - quad_lower_right.y; - vptr->z = pptr->z - quad_lower_right.z; - vptr ++; - - // Increase count of drawable particles - particle_count ++; - } - - // If we have filled up one batch of particles, draw it as a set - // of quads using glDrawArrays. - if (particle_count >= BATCH_PARTICLES) - { - // The first argument tells which primitive type we use (QUAD) - // The second argument tells the index of the first vertex (0) - // The last argument is the vertex count - glDrawArrays(GL_QUADS, 0, PARTICLE_VERTS * particle_count); - particle_count = 0; - vptr = vertex_array; - } - - // Next particle - pptr++; - } - - // We are done with the particle data - mtx_unlock(&thread_sync.particles_lock); - cnd_signal(&thread_sync.d_done); - - // Draw final batch of particles (if any) - glDrawArrays(GL_QUADS, 0, PARTICLE_VERTS * particle_count); - - // Disable vertex arrays (Note: glInterleavedArrays implicitly called - // glEnableClientState for vertex, texture coord and color arrays) - glDisableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - glDepthMask(GL_TRUE); -} - - -//======================================================================== -// Fountain geometry specification -//======================================================================== - -#define FOUNTAIN_SIDE_POINTS 14 -#define FOUNTAIN_SWEEP_STEPS 32 - -static const float fountain_side[FOUNTAIN_SIDE_POINTS * 2] = -{ - 1.2f, 0.f, 1.f, 0.2f, 0.41f, 0.3f, 0.4f, 0.35f, - 0.4f, 1.95f, 0.41f, 2.f, 0.8f, 2.2f, 1.2f, 2.4f, - 1.5f, 2.7f, 1.55f,2.95f, 1.6f, 3.f, 1.f, 3.f, - 0.5f, 3.f, 0.f, 3.f -}; - -static const float fountain_normal[FOUNTAIN_SIDE_POINTS * 2] = -{ - 1.0000f, 0.0000f, 0.6428f, 0.7660f, 0.3420f, 0.9397f, 1.0000f, 0.0000f, - 1.0000f, 0.0000f, 0.3420f,-0.9397f, 0.4226f,-0.9063f, 0.5000f,-0.8660f, - 0.7660f,-0.6428f, 0.9063f,-0.4226f, 0.0000f,1.00000f, 0.0000f,1.00000f, - 0.0000f,1.00000f, 0.0000f,1.00000f -}; - - -//======================================================================== -// Draw a fountain -//======================================================================== - -static void draw_fountain(void) -{ - static GLuint fountain_list = 0; - double angle; - float x, y; - int m, n; - - // The first time, we build the fountain display list - if (!fountain_list) - { - fountain_list = glGenLists(1); - glNewList(fountain_list, GL_COMPILE_AND_EXECUTE); - - glMaterialfv(GL_FRONT, GL_DIFFUSE, fountain_diffuse); - glMaterialfv(GL_FRONT, GL_SPECULAR, fountain_specular); - glMaterialf(GL_FRONT, GL_SHININESS, fountain_shininess); - - // Build fountain using triangle strips - for (n = 0; n < FOUNTAIN_SIDE_POINTS - 1; n++) - { - glBegin(GL_TRIANGLE_STRIP); - for (m = 0; m <= FOUNTAIN_SWEEP_STEPS; m++) - { - angle = (double) m * (2.0 * M_PI / (double) FOUNTAIN_SWEEP_STEPS); - x = (float) cos(angle); - y = (float) sin(angle); - - // Draw triangle strip - glNormal3f(x * fountain_normal[n * 2 + 2], - y * fountain_normal[n * 2 + 2], - fountain_normal[n * 2 + 3]); - glVertex3f(x * fountain_side[n * 2 + 2], - y * fountain_side[n * 2 + 2], - fountain_side[n * 2 +3 ]); - glNormal3f(x * fountain_normal[n * 2], - y * fountain_normal[n * 2], - fountain_normal[n * 2 + 1]); - glVertex3f(x * fountain_side[n * 2], - y * fountain_side[n * 2], - fountain_side[n * 2 + 1]); - } - - glEnd(); - } - - glEndList(); - } - else - glCallList(fountain_list); -} - - -//======================================================================== -// Recursive function for building variable tessellated floor -//======================================================================== - -static void tessellate_floor(float x1, float y1, float x2, float y2, int depth) -{ - float delta, x, y; - - // Last recursion? - if (depth >= 5) - delta = 999999.f; - else - { - x = (float) (fabs(x1) < fabs(x2) ? fabs(x1) : fabs(x2)); - y = (float) (fabs(y1) < fabs(y2) ? fabs(y1) : fabs(y2)); - delta = x*x + y*y; - } - - // Recurse further? - if (delta < 0.1f) - { - x = (x1 + x2) * 0.5f; - y = (y1 + y2) * 0.5f; - tessellate_floor(x1, y1, x, y, depth + 1); - tessellate_floor(x, y1, x2, y, depth + 1); - tessellate_floor(x1, y, x, y2, depth + 1); - tessellate_floor(x, y, x2, y2, depth + 1); - } - else - { - glTexCoord2f(x1 * 30.f, y1 * 30.f); - glVertex3f( x1 * 80.f, y1 * 80.f, 0.f); - glTexCoord2f(x2 * 30.f, y1 * 30.f); - glVertex3f( x2 * 80.f, y1 * 80.f, 0.f); - glTexCoord2f(x2 * 30.f, y2 * 30.f); - glVertex3f( x2 * 80.f, y2 * 80.f, 0.f); - glTexCoord2f(x1 * 30.f, y2 * 30.f); - glVertex3f( x1 * 80.f, y2 * 80.f, 0.f); - } -} - - -//======================================================================== -// Draw floor. We build the floor recursively and let the tessellation in the -// center (near x,y=0,0) be high, while the tessellation around the edges be -// low. -//======================================================================== - -static void draw_floor(void) -{ - static GLuint floor_list = 0; - - if (!wireframe) - { - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, floor_tex_id); - } - - // The first time, we build the floor display list - if (!floor_list) - { - floor_list = glGenLists(1); - glNewList(floor_list, GL_COMPILE_AND_EXECUTE); - - glMaterialfv(GL_FRONT, GL_DIFFUSE, floor_diffuse); - glMaterialfv(GL_FRONT, GL_SPECULAR, floor_specular); - glMaterialf(GL_FRONT, GL_SHININESS, floor_shininess); - - // Draw floor as a bunch of triangle strips (high tessellation - // improves lighting) - glNormal3f(0.f, 0.f, 1.f); - glBegin(GL_QUADS); - tessellate_floor(-1.f, -1.f, 0.f, 0.f, 0); - tessellate_floor( 0.f, -1.f, 1.f, 0.f, 0); - tessellate_floor( 0.f, 0.f, 1.f, 1.f, 0); - tessellate_floor(-1.f, 0.f, 0.f, 1.f, 0); - glEnd(); - - glEndList(); - } - else - glCallList(floor_list); - - glDisable(GL_TEXTURE_2D); - -} - - -//======================================================================== -// Position and configure light sources -//======================================================================== - -static void setup_lights(void) -{ - float l1pos[4], l1amb[4], l1dif[4], l1spec[4]; - float l2pos[4], l2amb[4], l2dif[4], l2spec[4]; - - // Set light source 1 parameters - l1pos[0] = 0.f; l1pos[1] = -9.f; l1pos[2] = 8.f; l1pos[3] = 1.f; - l1amb[0] = 0.2f; l1amb[1] = 0.2f; l1amb[2] = 0.2f; l1amb[3] = 1.f; - l1dif[0] = 0.8f; l1dif[1] = 0.4f; l1dif[2] = 0.2f; l1dif[3] = 1.f; - l1spec[0] = 1.f; l1spec[1] = 0.6f; l1spec[2] = 0.2f; l1spec[3] = 0.f; - - // Set light source 2 parameters - l2pos[0] = -15.f; l2pos[1] = 12.f; l2pos[2] = 1.5f; l2pos[3] = 1.f; - l2amb[0] = 0.f; l2amb[1] = 0.f; l2amb[2] = 0.f; l2amb[3] = 1.f; - l2dif[0] = 0.2f; l2dif[1] = 0.4f; l2dif[2] = 0.8f; l2dif[3] = 1.f; - l2spec[0] = 0.2f; l2spec[1] = 0.6f; l2spec[2] = 1.f; l2spec[3] = 0.f; - - glLightfv(GL_LIGHT1, GL_POSITION, l1pos); - glLightfv(GL_LIGHT1, GL_AMBIENT, l1amb); - glLightfv(GL_LIGHT1, GL_DIFFUSE, l1dif); - glLightfv(GL_LIGHT1, GL_SPECULAR, l1spec); - glLightfv(GL_LIGHT2, GL_POSITION, l2pos); - glLightfv(GL_LIGHT2, GL_AMBIENT, l2amb); - glLightfv(GL_LIGHT2, GL_DIFFUSE, l2dif); - glLightfv(GL_LIGHT2, GL_SPECULAR, l2spec); - glLightfv(GL_LIGHT3, GL_POSITION, glow_pos); - glLightfv(GL_LIGHT3, GL_DIFFUSE, glow_color); - glLightfv(GL_LIGHT3, GL_SPECULAR, glow_color); - - glEnable(GL_LIGHT1); - glEnable(GL_LIGHT2); - glEnable(GL_LIGHT3); -} - - -//======================================================================== -// Main rendering function -//======================================================================== - -static void draw_scene(GLFWwindow* window, double t) -{ - double xpos, ypos, zpos, angle_x, angle_y, angle_z; - static double t_old = 0.0; - float dt; - mat4x4 projection; - - // Calculate frame-to-frame delta time - dt = (float) (t - t_old); - t_old = t; - - mat4x4_perspective(projection, - 65.f * (float) M_PI / 180.f, - aspect_ratio, - 1.0, 60.0); - - glClearColor(0.1f, 0.1f, 0.1f, 1.f); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glMatrixMode(GL_PROJECTION); - glLoadMatrixf((const GLfloat*) projection); - - // Setup camera - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - // Rotate camera - angle_x = 90.0 - 10.0; - angle_y = 10.0 * sin(0.3 * t); - angle_z = 10.0 * t; - glRotated(-angle_x, 1.0, 0.0, 0.0); - glRotated(-angle_y, 0.0, 1.0, 0.0); - glRotated(-angle_z, 0.0, 0.0, 1.0); - - // Translate camera - xpos = 15.0 * sin((M_PI / 180.0) * angle_z) + - 2.0 * sin((M_PI / 180.0) * 3.1 * t); - ypos = -15.0 * cos((M_PI / 180.0) * angle_z) + - 2.0 * cos((M_PI / 180.0) * 2.9 * t); - zpos = 4.0 + 2.0 * cos((M_PI / 180.0) * 4.9 * t); - glTranslated(-xpos, -ypos, -zpos); - - glFrontFace(GL_CCW); - glCullFace(GL_BACK); - glEnable(GL_CULL_FACE); - - setup_lights(); - glEnable(GL_LIGHTING); - - glEnable(GL_FOG); - glFogi(GL_FOG_MODE, GL_EXP); - glFogf(GL_FOG_DENSITY, 0.05f); - glFogfv(GL_FOG_COLOR, fog_color); - - draw_floor(); - - glEnable(GL_DEPTH_TEST); - glDepthFunc(GL_LEQUAL); - glDepthMask(GL_TRUE); - - draw_fountain(); - - glDisable(GL_LIGHTING); - glDisable(GL_FOG); - - // Particles must be drawn after all solid objects have been drawn - draw_particles(window, t, dt); - - // Z-buffer not needed anymore - glDisable(GL_DEPTH_TEST); -} - - -//======================================================================== -// Window resize callback function -//======================================================================== - -static void resize_callback(GLFWwindow* window, int width, int height) -{ - glViewport(0, 0, width, height); - aspect_ratio = height ? width / (float) height : 1.f; -} - - -//======================================================================== -// Key callback functions -//======================================================================== - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (action == GLFW_PRESS) - { - switch (key) - { - case GLFW_KEY_ESCAPE: - glfwSetWindowShouldClose(window, GLFW_TRUE); - break; - case GLFW_KEY_W: - wireframe = !wireframe; - glPolygonMode(GL_FRONT_AND_BACK, - wireframe ? GL_LINE : GL_FILL); - break; - default: - break; - } - } -} - - -//======================================================================== -// Thread for updating particle physics -//======================================================================== - -static int physics_thread_main(void* arg) -{ - GLFWwindow* window = arg; - - for (;;) - { - mtx_lock(&thread_sync.particles_lock); - - // Wait for particle drawing to be done - while (!glfwWindowShouldClose(window) && - thread_sync.p_frame > thread_sync.d_frame) - { - struct timespec ts; - clock_gettime(CLOCK_REALTIME, &ts); - ts.tv_nsec += 100 * 1000 * 1000; - ts.tv_sec += ts.tv_nsec / (1000 * 1000 * 1000); - ts.tv_nsec %= 1000 * 1000 * 1000; - cnd_timedwait(&thread_sync.d_done, &thread_sync.particles_lock, &ts); - } - - if (glfwWindowShouldClose(window)) - break; - - // Update particles - particle_engine(thread_sync.t, thread_sync.dt); - - // Update frame counter - thread_sync.p_frame++; - - // Unlock mutex and signal drawing thread - mtx_unlock(&thread_sync.particles_lock); - cnd_signal(&thread_sync.p_done); - } - - return 0; -} - - -//======================================================================== -// main -//======================================================================== - -int main(int argc, char** argv) -{ - int ch, width, height; - thrd_t physics_thread = 0; - GLFWwindow* window; - GLFWmonitor* monitor = NULL; - - if (!glfwInit()) - { - fprintf(stderr, "Failed to initialize GLFW\n"); - exit(EXIT_FAILURE); - } - - while ((ch = getopt(argc, argv, "fh")) != -1) - { - switch (ch) - { - case 'f': - monitor = glfwGetPrimaryMonitor(); - break; - case 'h': - usage(); - exit(EXIT_SUCCESS); - } - } - - if (monitor) - { - const GLFWvidmode* mode = glfwGetVideoMode(monitor); - - glfwWindowHint(GLFW_RED_BITS, mode->redBits); - glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); - glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits); - glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate); - - width = mode->width; - height = mode->height; - } - else - { - width = 640; - height = 480; - } - - window = glfwCreateWindow(width, height, "Particle Engine", monitor, NULL); - if (!window) - { - fprintf(stderr, "Failed to create GLFW window\n"); - glfwTerminate(); - exit(EXIT_FAILURE); - } - - if (monitor) - glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - glfwSwapInterval(1); - - glfwSetFramebufferSizeCallback(window, resize_callback); - glfwSetKeyCallback(window, key_callback); - - // Set initial aspect ratio - glfwGetFramebufferSize(window, &width, &height); - resize_callback(window, width, height); - - // Upload particle texture - glGenTextures(1, &particle_tex_id); - glBindTexture(GL_TEXTURE_2D, particle_tex_id); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, P_TEX_WIDTH, P_TEX_HEIGHT, - 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, particle_texture); - - // Upload floor texture - glGenTextures(1, &floor_tex_id); - glBindTexture(GL_TEXTURE_2D, floor_tex_id); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, F_TEX_WIDTH, F_TEX_HEIGHT, - 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, floor_texture); - - if (glfwExtensionSupported("GL_EXT_separate_specular_color")) - { - glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL_EXT, - GL_SEPARATE_SPECULAR_COLOR_EXT); - } - - // Set filled polygon mode as default (not wireframe) - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - wireframe = 0; - - // Set initial times - thread_sync.t = 0.0; - thread_sync.dt = 0.001f; - thread_sync.p_frame = 0; - thread_sync.d_frame = 0; - - mtx_init(&thread_sync.particles_lock, mtx_timed); - cnd_init(&thread_sync.p_done); - cnd_init(&thread_sync.d_done); - - if (thrd_create(&physics_thread, physics_thread_main, window) != thrd_success) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwSetTime(0.0); - - while (!glfwWindowShouldClose(window)) - { - draw_scene(window, glfwGetTime()); - - glfwSwapBuffers(window); - glfwPollEvents(); - } - - thrd_join(physics_thread, NULL); - - glfwDestroyWindow(window); - glfwTerminate(); - - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/examples/sharing.c b/third_party/penumbra/vendor/glfw/examples/sharing.c deleted file mode 100644 index 4a1a2323dad..00000000000 --- a/third_party/penumbra/vendor/glfw/examples/sharing.c +++ /dev/null @@ -1,234 +0,0 @@ -//======================================================================== -// Context sharing example -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#include -#include - -#include "getopt.h" -#include "linmath.h" - -static const char* vertex_shader_text = -"#version 110\n" -"uniform mat4 MVP;\n" -"attribute vec2 vPos;\n" -"varying vec2 texcoord;\n" -"void main()\n" -"{\n" -" gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n" -" texcoord = vPos;\n" -"}\n"; - -static const char* fragment_shader_text = -"#version 110\n" -"uniform sampler2D texture;\n" -"uniform vec3 color;\n" -"varying vec2 texcoord;\n" -"void main()\n" -"{\n" -" gl_FragColor = vec4(color * texture2D(texture, texcoord).rgb, 1.0);\n" -"}\n"; - -static const vec2 vertices[4] = -{ - { 0.f, 0.f }, - { 1.f, 0.f }, - { 1.f, 1.f }, - { 0.f, 1.f } -}; - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (action == GLFW_PRESS && key == GLFW_KEY_ESCAPE) - glfwSetWindowShouldClose(window, GLFW_TRUE); -} - -int main(int argc, char** argv) -{ - GLFWwindow* windows[2]; - GLuint texture, program, vertex_buffer; - GLint mvp_location, vpos_location, color_location, texture_location; - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); - - windows[0] = glfwCreateWindow(400, 400, "First", NULL, NULL); - if (!windows[0]) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwSetKeyCallback(windows[0], key_callback); - - glfwMakeContextCurrent(windows[0]); - - // Only enable vsync for the first of the windows to be swapped to - // avoid waiting out the interval for each window - glfwSwapInterval(1); - - // The contexts are created with the same APIs so the function - // pointers should be re-usable between them - gladLoadGL(glfwGetProcAddress); - - // Create the OpenGL objects inside the first context, created above - // All objects will be shared with the second context, created below - { - int x, y; - char pixels[16 * 16]; - GLuint vertex_shader, fragment_shader; - - glGenTextures(1, &texture); - glBindTexture(GL_TEXTURE_2D, texture); - - srand((unsigned int) glfwGetTimerValue()); - - for (y = 0; y < 16; y++) - { - for (x = 0; x < 16; x++) - pixels[y * 16 + x] = rand() % 256; - } - - glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 16, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, pixels); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - vertex_shader = glCreateShader(GL_VERTEX_SHADER); - glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL); - glCompileShader(vertex_shader); - - fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); - glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL); - glCompileShader(fragment_shader); - - program = glCreateProgram(); - glAttachShader(program, vertex_shader); - glAttachShader(program, fragment_shader); - glLinkProgram(program); - - mvp_location = glGetUniformLocation(program, "MVP"); - color_location = glGetUniformLocation(program, "color"); - texture_location = glGetUniformLocation(program, "texture"); - vpos_location = glGetAttribLocation(program, "vPos"); - - glGenBuffers(1, &vertex_buffer); - glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); - glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); - } - - glUseProgram(program); - glUniform1i(texture_location, 0); - - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, texture); - - glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); - glEnableVertexAttribArray(vpos_location); - glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE, - sizeof(vertices[0]), (void*) 0); - - windows[1] = glfwCreateWindow(400, 400, "Second", NULL, windows[0]); - if (!windows[1]) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - // Place the second window to the right of the first - { - int xpos, ypos, left, right, width; - - glfwGetWindowSize(windows[0], &width, NULL); - glfwGetWindowFrameSize(windows[0], &left, NULL, &right, NULL); - glfwGetWindowPos(windows[0], &xpos, &ypos); - - glfwSetWindowPos(windows[1], xpos + width + left + right, ypos); - } - - glfwSetKeyCallback(windows[1], key_callback); - - glfwMakeContextCurrent(windows[1]); - - // While objects are shared, the global context state is not and will - // need to be set up for each context - - glUseProgram(program); - - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, texture); - - glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); - glEnableVertexAttribArray(vpos_location); - glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE, - sizeof(vertices[0]), (void*) 0); - - while (!glfwWindowShouldClose(windows[0]) && - !glfwWindowShouldClose(windows[1])) - { - int i; - const vec3 colors[2] = - { - { 0.8f, 0.4f, 1.f }, - { 0.3f, 0.4f, 1.f } - }; - - for (i = 0; i < 2; i++) - { - int width, height; - mat4x4 mvp; - - glfwGetFramebufferSize(windows[i], &width, &height); - glfwMakeContextCurrent(windows[i]); - - glViewport(0, 0, width, height); - - mat4x4_ortho(mvp, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f); - glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); - glUniform3fv(color_location, 1, colors[i]); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - - glfwSwapBuffers(windows[i]); - } - - glfwWaitEvents(); - } - - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/examples/simple.c b/third_party/penumbra/vendor/glfw/examples/simple.c deleted file mode 100644 index 95d8fe63486..00000000000 --- a/third_party/penumbra/vendor/glfw/examples/simple.c +++ /dev/null @@ -1,166 +0,0 @@ -//======================================================================== -// Simple GLFW example -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -//! [code] - -#include -#define GLFW_INCLUDE_NONE -#include - -#include "linmath.h" - -#include -#include - -static const struct -{ - float x, y; - float r, g, b; -} vertices[3] = -{ - { -0.6f, -0.4f, 1.f, 0.f, 0.f }, - { 0.6f, -0.4f, 0.f, 1.f, 0.f }, - { 0.f, 0.6f, 0.f, 0.f, 1.f } -}; - -static const char* vertex_shader_text = -"#version 110\n" -"uniform mat4 MVP;\n" -"attribute vec3 vCol;\n" -"attribute vec2 vPos;\n" -"varying vec3 color;\n" -"void main()\n" -"{\n" -" gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n" -" color = vCol;\n" -"}\n"; - -static const char* fragment_shader_text = -"#version 110\n" -"varying vec3 color;\n" -"void main()\n" -"{\n" -" gl_FragColor = vec4(color, 1.0);\n" -"}\n"; - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) - glfwSetWindowShouldClose(window, GLFW_TRUE); -} - -int main(void) -{ - GLFWwindow* window; - GLuint vertex_buffer, vertex_shader, fragment_shader, program; - GLint mvp_location, vpos_location, vcol_location; - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); - - window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL); - if (!window) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwSetKeyCallback(window, key_callback); - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - glfwSwapInterval(1); - - // NOTE: OpenGL error checks have been omitted for brevity - - glGenBuffers(1, &vertex_buffer); - glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); - glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); - - vertex_shader = glCreateShader(GL_VERTEX_SHADER); - glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL); - glCompileShader(vertex_shader); - - fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); - glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL); - glCompileShader(fragment_shader); - - program = glCreateProgram(); - glAttachShader(program, vertex_shader); - glAttachShader(program, fragment_shader); - glLinkProgram(program); - - mvp_location = glGetUniformLocation(program, "MVP"); - vpos_location = glGetAttribLocation(program, "vPos"); - vcol_location = glGetAttribLocation(program, "vCol"); - - glEnableVertexAttribArray(vpos_location); - glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE, - sizeof(vertices[0]), (void*) 0); - glEnableVertexAttribArray(vcol_location); - glVertexAttribPointer(vcol_location, 3, GL_FLOAT, GL_FALSE, - sizeof(vertices[0]), (void*) (sizeof(float) * 2)); - - while (!glfwWindowShouldClose(window)) - { - float ratio; - int width, height; - mat4x4 m, p, mvp; - - glfwGetFramebufferSize(window, &width, &height); - ratio = width / (float) height; - - glViewport(0, 0, width, height); - glClear(GL_COLOR_BUFFER_BIT); - - mat4x4_identity(m); - mat4x4_rotate_Z(m, m, (float) glfwGetTime()); - mat4x4_ortho(p, -ratio, ratio, -1.f, 1.f, 1.f, -1.f); - mat4x4_mul(mvp, p, m); - - glUseProgram(program); - glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); - glDrawArrays(GL_TRIANGLES, 0, 3); - - glfwSwapBuffers(window); - glfwPollEvents(); - } - - glfwDestroyWindow(window); - - glfwTerminate(); - exit(EXIT_SUCCESS); -} - -//! [code] diff --git a/third_party/penumbra/vendor/glfw/examples/splitview.c b/third_party/penumbra/vendor/glfw/examples/splitview.c deleted file mode 100644 index 58441dbb110..00000000000 --- a/third_party/penumbra/vendor/glfw/examples/splitview.c +++ /dev/null @@ -1,546 +0,0 @@ -//======================================================================== -// This is an example program for the GLFW library -// -// The program uses a "split window" view, rendering four views of the -// same scene in one window (e.g. uesful for 3D modelling software). This -// demo uses scissors to separate the four different rendering areas from -// each other. -// -// (If the code seems a little bit strange here and there, it may be -// because I am not a friend of orthogonal projections) -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#if defined(_MSC_VER) - // Make MS math.h define M_PI - #define _USE_MATH_DEFINES -#endif - -#include -#include -#include - -#include - - -//======================================================================== -// Global variables -//======================================================================== - -// Mouse position -static double xpos = 0, ypos = 0; - -// Window size -static int width, height; - -// Active view: 0 = none, 1 = upper left, 2 = upper right, 3 = lower left, -// 4 = lower right -static int active_view = 0; - -// Rotation around each axis -static int rot_x = 0, rot_y = 0, rot_z = 0; - -// Do redraw? -static int do_redraw = 1; - - -//======================================================================== -// Draw a solid torus (use a display list for the model) -//======================================================================== - -#define TORUS_MAJOR 1.5 -#define TORUS_MINOR 0.5 -#define TORUS_MAJOR_RES 32 -#define TORUS_MINOR_RES 32 - -static void drawTorus(void) -{ - static GLuint torus_list = 0; - int i, j, k; - double s, t, x, y, z, nx, ny, nz, scale, twopi; - - if (!torus_list) - { - // Start recording displaylist - torus_list = glGenLists(1); - glNewList(torus_list, GL_COMPILE_AND_EXECUTE); - - // Draw torus - twopi = 2.0 * M_PI; - for (i = 0; i < TORUS_MINOR_RES; i++) - { - glBegin(GL_QUAD_STRIP); - for (j = 0; j <= TORUS_MAJOR_RES; j++) - { - for (k = 1; k >= 0; k--) - { - s = (i + k) % TORUS_MINOR_RES + 0.5; - t = j % TORUS_MAJOR_RES; - - // Calculate point on surface - x = (TORUS_MAJOR + TORUS_MINOR * cos(s * twopi / TORUS_MINOR_RES)) * cos(t * twopi / TORUS_MAJOR_RES); - y = TORUS_MINOR * sin(s * twopi / TORUS_MINOR_RES); - z = (TORUS_MAJOR + TORUS_MINOR * cos(s * twopi / TORUS_MINOR_RES)) * sin(t * twopi / TORUS_MAJOR_RES); - - // Calculate surface normal - nx = x - TORUS_MAJOR * cos(t * twopi / TORUS_MAJOR_RES); - ny = y; - nz = z - TORUS_MAJOR * sin(t * twopi / TORUS_MAJOR_RES); - scale = 1.0 / sqrt(nx*nx + ny*ny + nz*nz); - nx *= scale; - ny *= scale; - nz *= scale; - - glNormal3f((float) nx, (float) ny, (float) nz); - glVertex3f((float) x, (float) y, (float) z); - } - } - - glEnd(); - } - - // Stop recording displaylist - glEndList(); - } - else - { - // Playback displaylist - glCallList(torus_list); - } -} - - -//======================================================================== -// Draw the scene (a rotating torus) -//======================================================================== - -static void drawScene(void) -{ - const GLfloat model_diffuse[4] = {1.0f, 0.8f, 0.8f, 1.0f}; - const GLfloat model_specular[4] = {0.6f, 0.6f, 0.6f, 1.0f}; - const GLfloat model_shininess = 20.0f; - - glPushMatrix(); - - // Rotate the object - glRotatef((GLfloat) rot_x * 0.5f, 1.0f, 0.0f, 0.0f); - glRotatef((GLfloat) rot_y * 0.5f, 0.0f, 1.0f, 0.0f); - glRotatef((GLfloat) rot_z * 0.5f, 0.0f, 0.0f, 1.0f); - - // Set model color (used for orthogonal views, lighting disabled) - glColor4fv(model_diffuse); - - // Set model material (used for perspective view, lighting enabled) - glMaterialfv(GL_FRONT, GL_DIFFUSE, model_diffuse); - glMaterialfv(GL_FRONT, GL_SPECULAR, model_specular); - glMaterialf(GL_FRONT, GL_SHININESS, model_shininess); - - // Draw torus - drawTorus(); - - glPopMatrix(); -} - - -//======================================================================== -// Draw a 2D grid (used for orthogonal views) -//======================================================================== - -static void drawGrid(float scale, int steps) -{ - int i; - float x, y; - mat4x4 view; - - glPushMatrix(); - - // Set background to some dark bluish grey - glClearColor(0.05f, 0.05f, 0.2f, 0.0f); - glClear(GL_COLOR_BUFFER_BIT); - - // Setup modelview matrix (flat XY view) - { - vec3 eye = { 0.f, 0.f, 1.f }; - vec3 center = { 0.f, 0.f, 0.f }; - vec3 up = { 0.f, 1.f, 0.f }; - mat4x4_look_at(view, eye, center, up); - } - glLoadMatrixf((const GLfloat*) view); - - // We don't want to update the Z-buffer - glDepthMask(GL_FALSE); - - // Set grid color - glColor3f(0.0f, 0.5f, 0.5f); - - glBegin(GL_LINES); - - // Horizontal lines - x = scale * 0.5f * (float) (steps - 1); - y = -scale * 0.5f * (float) (steps - 1); - for (i = 0; i < steps; i++) - { - glVertex3f(-x, y, 0.0f); - glVertex3f(x, y, 0.0f); - y += scale; - } - - // Vertical lines - x = -scale * 0.5f * (float) (steps - 1); - y = scale * 0.5f * (float) (steps - 1); - for (i = 0; i < steps; i++) - { - glVertex3f(x, -y, 0.0f); - glVertex3f(x, y, 0.0f); - x += scale; - } - - glEnd(); - - // Enable Z-buffer writing again - glDepthMask(GL_TRUE); - - glPopMatrix(); -} - - -//======================================================================== -// Draw all views -//======================================================================== - -static void drawAllViews(void) -{ - const GLfloat light_position[4] = {0.0f, 8.0f, 8.0f, 1.0f}; - const GLfloat light_diffuse[4] = {1.0f, 1.0f, 1.0f, 1.0f}; - const GLfloat light_specular[4] = {1.0f, 1.0f, 1.0f, 1.0f}; - const GLfloat light_ambient[4] = {0.2f, 0.2f, 0.3f, 1.0f}; - float aspect; - mat4x4 view, projection; - - // Calculate aspect of window - if (height > 0) - aspect = (float) width / (float) height; - else - aspect = 1.f; - - // Clear screen - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - // Enable scissor test - glEnable(GL_SCISSOR_TEST); - - // Enable depth test - glEnable(GL_DEPTH_TEST); - glDepthFunc(GL_LEQUAL); - - // ** ORTHOGONAL VIEWS ** - - // For orthogonal views, use wireframe rendering - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - // Enable line anti-aliasing - glEnable(GL_LINE_SMOOTH); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - // Setup orthogonal projection matrix - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-3.0 * aspect, 3.0 * aspect, -3.0, 3.0, 1.0, 50.0); - - // Upper left view (TOP VIEW) - glViewport(0, height / 2, width / 2, height / 2); - glScissor(0, height / 2, width / 2, height / 2); - glMatrixMode(GL_MODELVIEW); - { - vec3 eye = { 0.f, 10.f, 1e-3f }; - vec3 center = { 0.f, 0.f, 0.f }; - vec3 up = { 0.f, 1.f, 0.f }; - mat4x4_look_at( view, eye, center, up ); - } - glLoadMatrixf((const GLfloat*) view); - drawGrid(0.5, 12); - drawScene(); - - // Lower left view (FRONT VIEW) - glViewport(0, 0, width / 2, height / 2); - glScissor(0, 0, width / 2, height / 2); - glMatrixMode(GL_MODELVIEW); - { - vec3 eye = { 0.f, 0.f, 10.f }; - vec3 center = { 0.f, 0.f, 0.f }; - vec3 up = { 0.f, 1.f, 0.f }; - mat4x4_look_at( view, eye, center, up ); - } - glLoadMatrixf((const GLfloat*) view); - drawGrid(0.5, 12); - drawScene(); - - // Lower right view (SIDE VIEW) - glViewport(width / 2, 0, width / 2, height / 2); - glScissor(width / 2, 0, width / 2, height / 2); - glMatrixMode(GL_MODELVIEW); - { - vec3 eye = { 10.f, 0.f, 0.f }; - vec3 center = { 0.f, 0.f, 0.f }; - vec3 up = { 0.f, 1.f, 0.f }; - mat4x4_look_at( view, eye, center, up ); - } - glLoadMatrixf((const GLfloat*) view); - drawGrid(0.5, 12); - drawScene(); - - // Disable line anti-aliasing - glDisable(GL_LINE_SMOOTH); - glDisable(GL_BLEND); - - // ** PERSPECTIVE VIEW ** - - // For perspective view, use solid rendering - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - - // Enable face culling (faster rendering) - glEnable(GL_CULL_FACE); - glCullFace(GL_BACK); - glFrontFace(GL_CW); - - // Setup perspective projection matrix - glMatrixMode(GL_PROJECTION); - mat4x4_perspective(projection, - 65.f * (float) M_PI / 180.f, - aspect, - 1.f, 50.f); - glLoadMatrixf((const GLfloat*) projection); - - // Upper right view (PERSPECTIVE VIEW) - glViewport(width / 2, height / 2, width / 2, height / 2); - glScissor(width / 2, height / 2, width / 2, height / 2); - glMatrixMode(GL_MODELVIEW); - { - vec3 eye = { 3.f, 1.5f, 3.f }; - vec3 center = { 0.f, 0.f, 0.f }; - vec3 up = { 0.f, 1.f, 0.f }; - mat4x4_look_at( view, eye, center, up ); - } - glLoadMatrixf((const GLfloat*) view); - - // Configure and enable light source 1 - glLightfv(GL_LIGHT1, GL_POSITION, light_position); - glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient); - glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse); - glLightfv(GL_LIGHT1, GL_SPECULAR, light_specular); - glEnable(GL_LIGHT1); - glEnable(GL_LIGHTING); - - // Draw scene - drawScene(); - - // Disable lighting - glDisable(GL_LIGHTING); - - // Disable face culling - glDisable(GL_CULL_FACE); - - // Disable depth test - glDisable(GL_DEPTH_TEST); - - // Disable scissor test - glDisable(GL_SCISSOR_TEST); - - // Draw a border around the active view - if (active_view > 0 && active_view != 2) - { - glViewport(0, 0, width, height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0.0, 2.0, 0.0, 2.0, 0.0, 1.0); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef((GLfloat) ((active_view - 1) & 1), (GLfloat) (1 - (active_view - 1) / 2), 0.0f); - - glColor3f(1.0f, 1.0f, 0.6f); - - glBegin(GL_LINE_STRIP); - glVertex2i(0, 0); - glVertex2i(1, 0); - glVertex2i(1, 1); - glVertex2i(0, 1); - glVertex2i(0, 0); - glEnd(); - } -} - - -//======================================================================== -// Framebuffer size callback function -//======================================================================== - -static void framebufferSizeFun(GLFWwindow* window, int w, int h) -{ - width = w; - height = h > 0 ? h : 1; - do_redraw = 1; -} - - -//======================================================================== -// Window refresh callback function -//======================================================================== - -static void windowRefreshFun(GLFWwindow* window) -{ - drawAllViews(); - glfwSwapBuffers(window); - do_redraw = 0; -} - - -//======================================================================== -// Mouse position callback function -//======================================================================== - -static void cursorPosFun(GLFWwindow* window, double x, double y) -{ - int wnd_width, wnd_height, fb_width, fb_height; - double scale; - - glfwGetWindowSize(window, &wnd_width, &wnd_height); - glfwGetFramebufferSize(window, &fb_width, &fb_height); - - scale = (double) fb_width / (double) wnd_width; - - x *= scale; - y *= scale; - - // Depending on which view was selected, rotate around different axes - switch (active_view) - { - case 1: - rot_x += (int) (y - ypos); - rot_z += (int) (x - xpos); - do_redraw = 1; - break; - case 3: - rot_x += (int) (y - ypos); - rot_y += (int) (x - xpos); - do_redraw = 1; - break; - case 4: - rot_y += (int) (x - xpos); - rot_z += (int) (y - ypos); - do_redraw = 1; - break; - default: - // Do nothing for perspective view, or if no view is selected - break; - } - - // Remember cursor position - xpos = x; - ypos = y; -} - - -//======================================================================== -// Mouse button callback function -//======================================================================== - -static void mouseButtonFun(GLFWwindow* window, int button, int action, int mods) -{ - if ((button == GLFW_MOUSE_BUTTON_LEFT) && action == GLFW_PRESS) - { - // Detect which of the four views was clicked - active_view = 1; - if (xpos >= width / 2) - active_view += 1; - if (ypos >= height / 2) - active_view += 2; - } - else if (button == GLFW_MOUSE_BUTTON_LEFT) - { - // Deselect any previously selected view - active_view = 0; - } - - do_redraw = 1; -} - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) - glfwSetWindowShouldClose(window, GLFW_TRUE); -} - - -//======================================================================== -// main -//======================================================================== - -int main(void) -{ - GLFWwindow* window; - - // Initialise GLFW - if (!glfwInit()) - { - fprintf(stderr, "Failed to initialize GLFW\n"); - exit(EXIT_FAILURE); - } - - glfwWindowHint(GLFW_SAMPLES, 4); - - // Open OpenGL window - window = glfwCreateWindow(500, 500, "Split view demo", NULL, NULL); - if (!window) - { - fprintf(stderr, "Failed to open GLFW window\n"); - - glfwTerminate(); - exit(EXIT_FAILURE); - } - - // Set callback functions - glfwSetFramebufferSizeCallback(window, framebufferSizeFun); - glfwSetWindowRefreshCallback(window, windowRefreshFun); - glfwSetCursorPosCallback(window, cursorPosFun); - glfwSetMouseButtonCallback(window, mouseButtonFun); - glfwSetKeyCallback(window, key_callback); - - // Enable vsync - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - glfwSwapInterval(1); - - if (GLAD_GL_ARB_multisample || GLAD_GL_VERSION_1_3) - glEnable(GL_MULTISAMPLE_ARB); - - glfwGetFramebufferSize(window, &width, &height); - framebufferSizeFun(window, width, height); - - // Main loop - for (;;) - { - // Only redraw if we need to - if (do_redraw) - windowRefreshFun(window); - - // Wait for new events - glfwWaitEvents(); - - // Check if the window should be closed - if (glfwWindowShouldClose(window)) - break; - } - - // Close OpenGL window and terminate GLFW - glfwTerminate(); - - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/examples/wave.c b/third_party/penumbra/vendor/glfw/examples/wave.c deleted file mode 100644 index 7acb8b9290c..00000000000 --- a/third_party/penumbra/vendor/glfw/examples/wave.c +++ /dev/null @@ -1,462 +0,0 @@ -/***************************************************************************** - * Wave Simulation in OpenGL - * (C) 2002 Jakob Thomsen - * http://home.in.tum.de/~thomsen - * Modified for GLFW by Sylvain Hellegouarch - sh@programmationworld.com - * Modified for variable frame rate by Marcus Geelnard - * 2003-Jan-31: Minor cleanups and speedups / MG - * 2010-10-24: Formatting and cleanup - Camilla Löwy - *****************************************************************************/ - -#if defined(_MSC_VER) - // Make MS math.h define M_PI - #define _USE_MATH_DEFINES -#endif - -#include -#include -#include - -#include -#define GLFW_INCLUDE_NONE -#include - -#include - -// Maximum delta T to allow for differential calculations -#define MAX_DELTA_T 0.01 - -// Animation speed (10.0 looks good) -#define ANIMATION_SPEED 10.0 - -GLfloat alpha = 210.f, beta = -70.f; -GLfloat zoom = 2.f; - -double cursorX; -double cursorY; - -struct Vertex -{ - GLfloat x, y, z; - GLfloat r, g, b; -}; - -#define GRIDW 50 -#define GRIDH 50 -#define VERTEXNUM (GRIDW*GRIDH) - -#define QUADW (GRIDW - 1) -#define QUADH (GRIDH - 1) -#define QUADNUM (QUADW*QUADH) - -GLuint quad[4 * QUADNUM]; -struct Vertex vertex[VERTEXNUM]; - -/* The grid will look like this: - * - * 3 4 5 - * *---*---* - * | | | - * | 0 | 1 | - * | | | - * *---*---* - * 0 1 2 - */ - -//======================================================================== -// Initialize grid geometry -//======================================================================== - -void init_vertices(void) -{ - int x, y, p; - - // Place the vertices in a grid - for (y = 0; y < GRIDH; y++) - { - for (x = 0; x < GRIDW; x++) - { - p = y * GRIDW + x; - - vertex[p].x = (GLfloat) (x - GRIDW / 2) / (GLfloat) (GRIDW / 2); - vertex[p].y = (GLfloat) (y - GRIDH / 2) / (GLfloat) (GRIDH / 2); - vertex[p].z = 0; - - if ((x % 4 < 2) ^ (y % 4 < 2)) - vertex[p].r = 0.0; - else - vertex[p].r = 1.0; - - vertex[p].g = (GLfloat) y / (GLfloat) GRIDH; - vertex[p].b = 1.f - ((GLfloat) x / (GLfloat) GRIDW + (GLfloat) y / (GLfloat) GRIDH) / 2.f; - } - } - - for (y = 0; y < QUADH; y++) - { - for (x = 0; x < QUADW; x++) - { - p = 4 * (y * QUADW + x); - - quad[p + 0] = y * GRIDW + x; // Some point - quad[p + 1] = y * GRIDW + x + 1; // Neighbor at the right side - quad[p + 2] = (y + 1) * GRIDW + x + 1; // Upper right neighbor - quad[p + 3] = (y + 1) * GRIDW + x; // Upper neighbor - } - } -} - -double dt; -double p[GRIDW][GRIDH]; -double vx[GRIDW][GRIDH], vy[GRIDW][GRIDH]; -double ax[GRIDW][GRIDH], ay[GRIDW][GRIDH]; - -//======================================================================== -// Initialize grid -//======================================================================== - -void init_grid(void) -{ - int x, y; - double dx, dy, d; - - for (y = 0; y < GRIDH; y++) - { - for (x = 0; x < GRIDW; x++) - { - dx = (double) (x - GRIDW / 2); - dy = (double) (y - GRIDH / 2); - d = sqrt(dx * dx + dy * dy); - if (d < 0.1 * (double) (GRIDW / 2)) - { - d = d * 10.0; - p[x][y] = -cos(d * (M_PI / (double)(GRIDW * 4))) * 100.0; - } - else - p[x][y] = 0.0; - - vx[x][y] = 0.0; - vy[x][y] = 0.0; - } - } -} - - -//======================================================================== -// Draw scene -//======================================================================== - -void draw_scene(GLFWwindow* window) -{ - // Clear the color and depth buffers - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - // We don't want to modify the projection matrix - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - // Move back - glTranslatef(0.0, 0.0, -zoom); - // Rotate the view - glRotatef(beta, 1.0, 0.0, 0.0); - glRotatef(alpha, 0.0, 0.0, 1.0); - - glDrawElements(GL_QUADS, 4 * QUADNUM, GL_UNSIGNED_INT, quad); - - glfwSwapBuffers(window); -} - - -//======================================================================== -// Initialize Miscellaneous OpenGL state -//======================================================================== - -void init_opengl(void) -{ - // Use Gouraud (smooth) shading - glShadeModel(GL_SMOOTH); - - // Switch on the z-buffer - glEnable(GL_DEPTH_TEST); - - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_COLOR_ARRAY); - glVertexPointer(3, GL_FLOAT, sizeof(struct Vertex), vertex); - glColorPointer(3, GL_FLOAT, sizeof(struct Vertex), &vertex[0].r); // Pointer to the first color - - glPointSize(2.0); - - // Background color is black - glClearColor(0, 0, 0, 0); -} - - -//======================================================================== -// Modify the height of each vertex according to the pressure -//======================================================================== - -void adjust_grid(void) -{ - int pos; - int x, y; - - for (y = 0; y < GRIDH; y++) - { - for (x = 0; x < GRIDW; x++) - { - pos = y * GRIDW + x; - vertex[pos].z = (float) (p[x][y] * (1.0 / 50.0)); - } - } -} - - -//======================================================================== -// Calculate wave propagation -//======================================================================== - -void calc_grid(void) -{ - int x, y, x2, y2; - double time_step = dt * ANIMATION_SPEED; - - // Compute accelerations - for (x = 0; x < GRIDW; x++) - { - x2 = (x + 1) % GRIDW; - for(y = 0; y < GRIDH; y++) - ax[x][y] = p[x][y] - p[x2][y]; - } - - for (y = 0; y < GRIDH; y++) - { - y2 = (y + 1) % GRIDH; - for(x = 0; x < GRIDW; x++) - ay[x][y] = p[x][y] - p[x][y2]; - } - - // Compute speeds - for (x = 0; x < GRIDW; x++) - { - for (y = 0; y < GRIDH; y++) - { - vx[x][y] = vx[x][y] + ax[x][y] * time_step; - vy[x][y] = vy[x][y] + ay[x][y] * time_step; - } - } - - // Compute pressure - for (x = 1; x < GRIDW; x++) - { - x2 = x - 1; - for (y = 1; y < GRIDH; y++) - { - y2 = y - 1; - p[x][y] = p[x][y] + (vx[x2][y] - vx[x][y] + vy[x][y2] - vy[x][y]) * time_step; - } - } -} - - -//======================================================================== -// Print errors -//======================================================================== - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - - -//======================================================================== -// Handle key strokes -//======================================================================== - -void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (action != GLFW_PRESS) - return; - - switch (key) - { - case GLFW_KEY_ESCAPE: - glfwSetWindowShouldClose(window, GLFW_TRUE); - break; - case GLFW_KEY_SPACE: - init_grid(); - break; - case GLFW_KEY_LEFT: - alpha += 5; - break; - case GLFW_KEY_RIGHT: - alpha -= 5; - break; - case GLFW_KEY_UP: - beta -= 5; - break; - case GLFW_KEY_DOWN: - beta += 5; - break; - case GLFW_KEY_PAGE_UP: - zoom -= 0.25f; - if (zoom < 0.f) - zoom = 0.f; - break; - case GLFW_KEY_PAGE_DOWN: - zoom += 0.25f; - break; - default: - break; - } -} - - -//======================================================================== -// Callback function for mouse button events -//======================================================================== - -void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) -{ - if (button != GLFW_MOUSE_BUTTON_LEFT) - return; - - if (action == GLFW_PRESS) - { - glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); - glfwGetCursorPos(window, &cursorX, &cursorY); - } - else - glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); -} - - -//======================================================================== -// Callback function for cursor motion events -//======================================================================== - -void cursor_position_callback(GLFWwindow* window, double x, double y) -{ - if (glfwGetInputMode(window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED) - { - alpha += (GLfloat) (x - cursorX) / 10.f; - beta += (GLfloat) (y - cursorY) / 10.f; - - cursorX = x; - cursorY = y; - } -} - - -//======================================================================== -// Callback function for scroll events -//======================================================================== - -void scroll_callback(GLFWwindow* window, double x, double y) -{ - zoom += (float) y / 4.f; - if (zoom < 0) - zoom = 0; -} - - -//======================================================================== -// Callback function for framebuffer resize events -//======================================================================== - -void framebuffer_size_callback(GLFWwindow* window, int width, int height) -{ - float ratio = 1.f; - mat4x4 projection; - - if (height > 0) - ratio = (float) width / (float) height; - - // Setup viewport - glViewport(0, 0, width, height); - - // Change to the projection matrix and set our viewing volume - glMatrixMode(GL_PROJECTION); - mat4x4_perspective(projection, - 60.f * (float) M_PI / 180.f, - ratio, - 1.f, 1024.f); - glLoadMatrixf((const GLfloat*) projection); -} - - -//======================================================================== -// main -//======================================================================== - -int main(int argc, char* argv[]) -{ - GLFWwindow* window; - double t, dt_total, t_old; - int width, height; - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - window = glfwCreateWindow(640, 480, "Wave Simulation", NULL, NULL); - if (!window) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwSetKeyCallback(window, key_callback); - glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); - glfwSetMouseButtonCallback(window, mouse_button_callback); - glfwSetCursorPosCallback(window, cursor_position_callback); - glfwSetScrollCallback(window, scroll_callback); - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - glfwSwapInterval(1); - - glfwGetFramebufferSize(window, &width, &height); - framebuffer_size_callback(window, width, height); - - // Initialize OpenGL - init_opengl(); - - // Initialize simulation - init_vertices(); - init_grid(); - adjust_grid(); - - // Initialize timer - t_old = glfwGetTime() - 0.01; - - while (!glfwWindowShouldClose(window)) - { - t = glfwGetTime(); - dt_total = t - t_old; - t_old = t; - - // Safety - iterate if dt_total is too large - while (dt_total > 0.f) - { - // Select iteration time step - dt = dt_total > MAX_DELTA_T ? MAX_DELTA_T : dt_total; - dt_total -= dt; - - // Calculate wave propagation - calc_grid(); - } - - // Compute height of each vertex - adjust_grid(); - - // Draw wave grid to OpenGL display - draw_scene(window); - - glfwPollEvents(); - } - - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/include/GLFW/glfw3.h b/third_party/penumbra/vendor/glfw/include/GLFW/glfw3.h index 66dff649050..31b201ae5ee 100644 --- a/third_party/penumbra/vendor/glfw/include/GLFW/glfw3.h +++ b/third_party/penumbra/vendor/glfw/include/GLFW/glfw3.h @@ -52,7 +52,7 @@ extern "C" { * This is the reference documentation for OpenGL and OpenGL ES context related * functions. For more task-oriented information, see the @ref context_guide. */ -/*! @defgroup vulkan Vulkan reference +/*! @defgroup vulkan Vulkan support reference * @brief Functions and types related to Vulkan. * * This is the reference documentation for Vulkan related functions and types. @@ -190,10 +190,44 @@ extern "C" { #else /*__APPLE__*/ #include + #if defined(GLFW_INCLUDE_GLEXT) + #include + #endif #endif /*__APPLE__*/ -#elif !defined(GLFW_INCLUDE_NONE) +#elif defined(GLFW_INCLUDE_GLU) + + #if defined(__APPLE__) + + #if defined(GLFW_INCLUDE_GLU) + #include + #endif + + #else /*__APPLE__*/ + + #if defined(GLFW_INCLUDE_GLU) + #include + #endif + + #endif /*__APPLE__*/ + +#elif !defined(GLFW_INCLUDE_NONE) && \ + !defined(__gl_h_) && \ + !defined(__gles1_gl_h_) && \ + !defined(__gles2_gl2_h_) && \ + !defined(__gles2_gl3_h_) && \ + !defined(__gles2_gl31_h_) && \ + !defined(__gles2_gl32_h_) && \ + !defined(__gl_glcorearb_h_) && \ + !defined(__gl2_h_) /*legacy*/ && \ + !defined(__gl3_h_) /*legacy*/ && \ + !defined(__gl31_h_) /*legacy*/ && \ + !defined(__gl32_h_) /*legacy*/ && \ + !defined(__glcorearb_h_) /*legacy*/ && \ + !defined(__GL_H__) /*non-standard*/ && \ + !defined(__gltypes_h_) /*non-standard*/ && \ + !defined(__glee_h_) /*non-standard*/ #if defined(__APPLE__) @@ -201,9 +235,6 @@ extern "C" { #define GL_GLEXT_LEGACY #endif #include - #if defined(GLFW_INCLUDE_GLU) - #include - #endif #else /*__APPLE__*/ @@ -211,9 +242,6 @@ extern "C" { #if defined(GLFW_INCLUDE_GLEXT) #include #endif - #if defined(GLFW_INCLUDE_GLU) - #include - #endif #endif /*__APPLE__*/ @@ -234,13 +262,12 @@ extern "C" { /* We are building GLFW as a Win32 DLL */ #define GLFWAPI __declspec(dllexport) #elif defined(_WIN32) && defined(GLFW_DLL) - /* We are calling GLFW as a Win32 DLL */ + /* We are calling a GLFW Win32 DLL */ #define GLFWAPI __declspec(dllimport) #elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL) - /* We are building GLFW as a shared / dynamic library */ + /* We are building GLFW as a Unix shared library */ #define GLFWAPI __attribute__((visibility("default"))) #else - /* We are building or calling GLFW as a static library */ #define GLFWAPI #endif @@ -251,26 +278,27 @@ extern "C" { /*! @name GLFW version macros * @{ */ -/*! @brief The major version number of the GLFW library. +/*! @brief The major version number of the GLFW header. * - * This is incremented when the API is changed in non-compatible ways. + * The major version number of the GLFW header. This is incremented when the + * API is changed in non-compatible ways. * @ingroup init */ #define GLFW_VERSION_MAJOR 3 -/*! @brief The minor version number of the GLFW library. +/*! @brief The minor version number of the GLFW header. * - * This is incremented when features are added to the API but it remains - * backward-compatible. + * The minor version number of the GLFW header. This is incremented when + * features are added to the API but it remains backward-compatible. * @ingroup init */ #define GLFW_VERSION_MINOR 3 -/*! @brief The revision number of the GLFW library. +/*! @brief The revision number of the GLFW header. * - * This is incremented when a bug fix release is made that does not contain any - * API changes. + * The revision number of the GLFW header. This is incremented when a bug fix + * release is made that does not contain any API changes. * @ingroup init */ -#define GLFW_VERSION_REVISION 2 +#define GLFW_VERSION_REVISION 8 /*! @} */ /*! @brief One. @@ -931,7 +959,7 @@ extern "C" { * and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib). */ #define GLFW_CONTEXT_VERSION_MINOR 0x00022003 -/*! @brief Context client API revision number hint and attribute. +/*! @brief Context client API revision number attribute. * * Context client API revision number * [attribute](@ref GLFW_CONTEXT_REVISION_attrib). @@ -949,9 +977,9 @@ extern "C" { * and [attribute](@ref GLFW_OPENGL_FORWARD_COMPAT_attrib). */ #define GLFW_OPENGL_FORWARD_COMPAT 0x00022006 -/*! @brief OpenGL debug context hint and attribute. +/*! @brief Debug mode context hint and attribute. * - * OpenGL debug context [hint](@ref GLFW_OPENGL_DEBUG_CONTEXT_hint) and + * Debug mode context [hint](@ref GLFW_OPENGL_DEBUG_CONTEXT_hint) and * [attribute](@ref GLFW_OPENGL_DEBUG_CONTEXT_attrib). */ #define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007 @@ -1190,7 +1218,7 @@ typedef struct GLFWcursor GLFWcursor; * * @ingroup init */ -typedef void (* GLFWerrorfun)(int,const char*); +typedef void (* GLFWerrorfun)(int error_code, const char* description); /*! @brief The function pointer type for window position callbacks. * @@ -1213,7 +1241,7 @@ typedef void (* GLFWerrorfun)(int,const char*); * * @ingroup window */ -typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int); +typedef void (* GLFWwindowposfun)(GLFWwindow* window, int xpos, int ypos); /*! @brief The function pointer type for window size callbacks. * @@ -1235,7 +1263,7 @@ typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int); * * @ingroup window */ -typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int); +typedef void (* GLFWwindowsizefun)(GLFWwindow* window, int width, int height); /*! @brief The function pointer type for window close callbacks. * @@ -1255,7 +1283,7 @@ typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int); * * @ingroup window */ -typedef void (* GLFWwindowclosefun)(GLFWwindow*); +typedef void (* GLFWwindowclosefun)(GLFWwindow* window); /*! @brief The function pointer type for window content refresh callbacks. * @@ -1275,7 +1303,7 @@ typedef void (* GLFWwindowclosefun)(GLFWwindow*); * * @ingroup window */ -typedef void (* GLFWwindowrefreshfun)(GLFWwindow*); +typedef void (* GLFWwindowrefreshfun)(GLFWwindow* window); /*! @brief The function pointer type for window focus callbacks. * @@ -1296,7 +1324,7 @@ typedef void (* GLFWwindowrefreshfun)(GLFWwindow*); * * @ingroup window */ -typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int); +typedef void (* GLFWwindowfocusfun)(GLFWwindow* window, int focused); /*! @brief The function pointer type for window iconify callbacks. * @@ -1317,7 +1345,7 @@ typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int); * * @ingroup window */ -typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int); +typedef void (* GLFWwindowiconifyfun)(GLFWwindow* window, int iconified); /*! @brief The function pointer type for window maximize callbacks. * @@ -1328,7 +1356,7 @@ typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int); * @endcode * * @param[in] window The window that was maximized or restored. - * @param[in] iconified `GLFW_TRUE` if the window was maximized, or + * @param[in] maximized `GLFW_TRUE` if the window was maximized, or * `GLFW_FALSE` if it was restored. * * @sa @ref window_maximize @@ -1338,7 +1366,7 @@ typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int); * * @ingroup window */ -typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int); +typedef void (* GLFWwindowmaximizefun)(GLFWwindow* window, int maximized); /*! @brief The function pointer type for framebuffer size callbacks. * @@ -1359,7 +1387,7 @@ typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int); * * @ingroup window */ -typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int); +typedef void (* GLFWframebuffersizefun)(GLFWwindow* window, int width, int height); /*! @brief The function pointer type for window content scale callbacks. * @@ -1380,7 +1408,7 @@ typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int); * * @ingroup window */ -typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float); +typedef void (* GLFWwindowcontentscalefun)(GLFWwindow* window, float xscale, float yscale); /*! @brief The function pointer type for mouse button callbacks. * @@ -1406,7 +1434,7 @@ typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float); * * @ingroup input */ -typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int); +typedef void (* GLFWmousebuttonfun)(GLFWwindow* window, int button, int action, int mods); /*! @brief The function pointer type for cursor position callbacks. * @@ -1429,7 +1457,7 @@ typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int); * * @ingroup input */ -typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double); +typedef void (* GLFWcursorposfun)(GLFWwindow* window, double xpos, double ypos); /*! @brief The function pointer type for cursor enter/leave callbacks. * @@ -1450,7 +1478,7 @@ typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double); * * @ingroup input */ -typedef void (* GLFWcursorenterfun)(GLFWwindow*,int); +typedef void (* GLFWcursorenterfun)(GLFWwindow* window, int entered); /*! @brief The function pointer type for scroll callbacks. * @@ -1471,7 +1499,7 @@ typedef void (* GLFWcursorenterfun)(GLFWwindow*,int); * * @ingroup input */ -typedef void (* GLFWscrollfun)(GLFWwindow*,double,double); +typedef void (* GLFWscrollfun)(GLFWwindow* window, double xoffset, double yoffset); /*! @brief The function pointer type for keyboard key callbacks. * @@ -1497,7 +1525,7 @@ typedef void (* GLFWscrollfun)(GLFWwindow*,double,double); * * @ingroup input */ -typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int); +typedef void (* GLFWkeyfun)(GLFWwindow* window, int key, int scancode, int action, int mods); /*! @brief The function pointer type for Unicode character callbacks. * @@ -1518,7 +1546,7 @@ typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int); * * @ingroup input */ -typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int); +typedef void (* GLFWcharfun)(GLFWwindow* window, unsigned int codepoint); /*! @brief The function pointer type for Unicode character with modifiers * callbacks. @@ -1545,7 +1573,7 @@ typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int); * * @ingroup input */ -typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int); +typedef void (* GLFWcharmodsfun)(GLFWwindow* window, unsigned int codepoint, int mods); /*! @brief The function pointer type for path drop callbacks. * @@ -1569,7 +1597,7 @@ typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int); * * @ingroup input */ -typedef void (* GLFWdropfun)(GLFWwindow*,int,const char*[]); +typedef void (* GLFWdropfun)(GLFWwindow* window, int path_count, const char* paths[]); /*! @brief The function pointer type for monitor configuration callbacks. * @@ -1590,7 +1618,7 @@ typedef void (* GLFWdropfun)(GLFWwindow*,int,const char*[]); * * @ingroup monitor */ -typedef void (* GLFWmonitorfun)(GLFWmonitor*,int); +typedef void (* GLFWmonitorfun)(GLFWmonitor* monitor, int event); /*! @brief The function pointer type for joystick configuration callbacks. * @@ -1611,7 +1639,7 @@ typedef void (* GLFWmonitorfun)(GLFWmonitor*,int); * * @ingroup input */ -typedef void (* GLFWjoystickfun)(int,int); +typedef void (* GLFWjoystickfun)(int jid, int event); /*! @brief Video mode type. * @@ -1753,6 +1781,10 @@ typedef struct GLFWgamepadstate * bundle, if present. This can be disabled with the @ref * GLFW_COCOA_CHDIR_RESOURCES init hint. * + * @remark @x11 This function will set the `LC_CTYPE` category of the + * application locale according to the current environment if that category is + * still "C". This is because the "C" locale breaks Unicode text input. + * * @thread_safety This function must only be called from the main thread. * * @sa @ref intro_init @@ -1776,6 +1808,8 @@ GLFWAPI int glfwInit(void); * call this function, as it is called by @ref glfwInit before it returns * failure. * + * This function has no effect if GLFW is not initialized. + * * @errors Possible errors include @ref GLFW_PLATFORM_ERROR. * * @remark This function may be called before @ref glfwInit. @@ -2093,8 +2127,8 @@ GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos, * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * - * @remark @win32 calculates the returned physical size from the - * current resolution and system DPI instead of querying the monitor EDID data. + * @remark @win32 On Windows 8 and earlier the physical size is calculated from + * the current resolution and system DPI instead of querying the monitor EDID data. * * @thread_safety This function must only be called from the main thread. * @@ -2248,8 +2282,9 @@ GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback); * * This function returns an array of all video modes supported by the specified * monitor. The returned array is sorted in ascending order, first by color - * bit depth (the sum of all channel depths) and then by resolution area (the - * product of width and height). + * bit depth (the sum of all channel depths), then by resolution area (the + * product of width and height), then resolution width and finally by refresh + * rate. * * @param[in] monitor The monitor to query. * @param[out] count Where to store the number of video modes in the returned @@ -2772,8 +2807,8 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title); * @param[in] images The images to create the icon from. This is ignored if * count is zero. * - * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref - * GLFW_PLATFORM_ERROR. + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref + * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. * * @pointer_lifetime The specified image data is copied before this function * returns. @@ -3183,18 +3218,15 @@ GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity); * previously restored. If the window is already iconified, this function does * nothing. * - * If the specified window is a full screen window, the original monitor - * resolution is restored until the window is restored. + * If the specified window is a full screen window, GLFW restores the original + * video mode of the monitor. The window's desired video mode is set again + * when the window is restored. * * @param[in] window The window to iconify. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * - * @remark @wayland There is no concept of iconification in wl_shell, this - * function will emit @ref GLFW_PLATFORM_ERROR when using this deprecated - * protocol. - * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_iconify @@ -3214,8 +3246,8 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow* window); * (minimized) or maximized. If the window is already restored, this function * does nothing. * - * If the specified window is a full screen window, the resolution chosen for - * the window is restored on the selected monitor. + * If the specified window is an iconified full screen window, its desired + * video mode is set again for its monitor when the window is restored. * * @param[in] window The window to restore. * @@ -3276,6 +3308,11 @@ GLFWAPI void glfwMaximizeWindow(GLFWwindow* window); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * + * @remark @wayland Because Wayland wants every frame of the desktop to be + * complete, this function does not immediately make the window visible. + * Instead it will become visible the next time the window framebuffer is + * updated after this call. + * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_hide @@ -3478,6 +3515,9 @@ GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int * errors. However, this function should not fail as long as it is passed * valid arguments and the library has been [initialized](@ref intro_init). * + * @remark @wayland The Wayland protocol provides no way to check whether a + * window is iconfied, so @ref GLFW_ICONIFIED always returns `GLFW_FALSE`. + * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_attribs @@ -3769,8 +3809,8 @@ GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwi * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * - * @remark @wayland The wl_shell protocol has no concept of iconification, - * this callback will never be called when using this deprecated protocol. + * @remark @wayland The XDG-shell protocol has no event for iconification, so + * this callback will never be called. * * @thread_safety This function must only be called from the main thread. * @@ -4238,8 +4278,7 @@ GLFWAPI int glfwGetKeyScancode(int key); * * This function returns the last state reported for the specified key to the * specified window. The returned state is one of `GLFW_PRESS` or - * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to - * the key callback. + * `GLFW_RELEASE`. The action `GLFW_REPEAT` is only reported to the key callback. * * If the @ref GLFW_STICKY_KEYS input mode is enabled, this function returns * `GLFW_PRESS` the first time you call it for a key that was pressed, even if @@ -4400,8 +4439,8 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos); * @return The handle of the created cursor, or `NULL` if an * [error](@ref error_handling) occurred. * - * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref - * GLFW_PLATFORM_ERROR. + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref + * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. * * @pointer_lifetime The specified image data is copied before this function * returns. @@ -5191,6 +5230,8 @@ GLFWAPI int glfwUpdateGamepadMappings(const char* string); * joystick is not present, does not have a mapping or an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref GLFW_INVALID_ENUM. + * * @pointer_lifetime The returned string is allocated and freed by GLFW. You * should not free it yourself. It is valid until the specified joystick is * disconnected, the gamepad mappings are updated or the library is terminated. @@ -5280,8 +5321,8 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string); * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL` * if an [error](@ref error_handling) occurred. * - * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref - * GLFW_PLATFORM_ERROR. + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref + * GLFW_FORMAT_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. * * @pointer_lifetime The returned string is allocated and freed by GLFW. You * should not free it yourself. It is valid until the next call to @ref @@ -5625,13 +5666,11 @@ GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname); * This function returns whether the Vulkan loader and any minimally functional * ICD have been found. * - * The availability of a Vulkan loader and even an ICD does not by itself - * guarantee that surface creation or even instance creation is possible. - * For example, on Fermi systems Nvidia will install an ICD that provides no - * actual Vulkan support. Call @ref glfwGetRequiredInstanceExtensions to check - * whether the extensions necessary for Vulkan surface creation are available - * and @ref glfwGetPhysicalDevicePresentationSupport to check whether a queue - * family of a physical device supports image presentation. + * The availability of a Vulkan loader and even an ICD does not by itself guarantee that + * surface creation or even instance creation is possible. Call @ref + * glfwGetRequiredInstanceExtensions to check whether the extensions necessary for Vulkan + * surface creation are available and @ref glfwGetPhysicalDevicePresentationSupport to + * check whether a queue family of a physical device supports image presentation. * * @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE` * otherwise. @@ -5677,10 +5716,6 @@ GLFWAPI int glfwVulkanSupported(void); * returned array, as it is an error to specify an extension more than once in * the `VkInstanceCreateInfo` struct. * - * @remark @macos This function currently supports either the - * `VK_MVK_macos_surface` extension from MoltenVK or `VK_EXT_metal_surface` - * extension. - * * @pointer_lifetime The returned array is allocated and freed by GLFW. You * should not free it yourself. It is guaranteed to be valid only until the * library is terminated. @@ -5762,7 +5797,7 @@ GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* p * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. * * @remark @macos This function currently always returns `GLFW_TRUE`, as the - * `VK_MVK_macos_surface` extension does not provide + * `VK_MVK_macos_surface` and `VK_EXT_metal_surface` extensions do not provide * a `vkGetPhysicalDevice*PresentationSupport` type function. * * @thread_safety This function may be called from any thread. For @@ -5819,8 +5854,10 @@ GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhys * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should * eliminate almost all occurrences of these errors. * - * @remark @macos This function currently only supports the - * `VK_MVK_macos_surface` extension from MoltenVK. + * @remark @macos GLFW prefers the `VK_EXT_metal_surface` extension, with the + * `VK_MVK_macos_surface` extension as a fallback. The name of the selected + * extension, if any, is included in the array returned by @ref + * glfwGetRequiredInstanceExtensions. * * @remark @macos This function creates and sets a `CAMetalLayer` instance for * the window content view, which is required for MoltenVK to function. @@ -5861,6 +5898,7 @@ GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window */ #ifndef GLAPIENTRY #define GLAPIENTRY APIENTRY + #define GLFW_GLAPIENTRY_DEFINED #endif /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ diff --git a/third_party/penumbra/vendor/glfw/include/GLFW/glfw3native.h b/third_party/penumbra/vendor/glfw/include/GLFW/glfw3native.h index 267e75ca9e0..7be0227d5e2 100644 --- a/third_party/penumbra/vendor/glfw/include/GLFW/glfw3native.h +++ b/third_party/penumbra/vendor/glfw/include/GLFW/glfw3native.h @@ -74,6 +74,16 @@ extern "C" { * and which platform-specific headers to include. It is then up your (by * definition platform-specific) code to handle which of these should be * defined. + * + * If you do not want the platform-specific headers to be included, define + * `GLFW_NATIVE_INCLUDE_NONE` before including the @ref glfw3native.h header. + * + * @code + * #define GLFW_EXPOSE_NATIVE_WIN32 + * #define GLFW_EXPOSE_NATIVE_WGL + * #define GLFW_NATIVE_INCLUDE_NONE + * #include + * @endcode */ @@ -81,44 +91,65 @@ extern "C" { * System headers and types *************************************************************************/ -#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL) - // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for - // example to allow applications to correctly declare a GL_ARB_debug_output - // callback) but windows.h assumes no one will define APIENTRY before it does - #if defined(GLFW_APIENTRY_DEFINED) - #undef APIENTRY - #undef GLFW_APIENTRY_DEFINED +#if !defined(GLFW_NATIVE_INCLUDE_NONE) + + #if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL) + /* This is a workaround for the fact that glfw3.h needs to export APIENTRY (for + * example to allow applications to correctly declare a GL_KHR_debug callback) + * but windows.h assumes no one will define APIENTRY before it does + */ + #if defined(GLFW_APIENTRY_DEFINED) + #undef APIENTRY + #undef GLFW_APIENTRY_DEFINED + #endif + #include + #elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL) + #if defined(__OBJC__) + #import + #else + #include + #include + #endif + #elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX) + #include + #include + #elif defined(GLFW_EXPOSE_NATIVE_WAYLAND) + #include + #endif + + #if defined(GLFW_EXPOSE_NATIVE_WGL) + /* WGL is declared by windows.h */ #endif - #include -#elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL) - #if defined(__OBJC__) - #import - #else - #include - typedef void* id; + #if defined(GLFW_EXPOSE_NATIVE_NSGL) + /* NSGL is declared by Cocoa.h */ + #endif + #if defined(GLFW_EXPOSE_NATIVE_GLX) + /* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by + * default it also acts as an OpenGL header + * However, glx.h will include gl.h, which will define it unconditionally + */ + #if defined(GLFW_GLAPIENTRY_DEFINED) + #undef GLAPIENTRY + #undef GLFW_GLAPIENTRY_DEFINED + #endif + #include + #endif + #if defined(GLFW_EXPOSE_NATIVE_EGL) + #include + #endif + #if defined(GLFW_EXPOSE_NATIVE_OSMESA) + /* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by + * default it also acts as an OpenGL header + * However, osmesa.h will include gl.h, which will define it unconditionally + */ + #if defined(GLFW_GLAPIENTRY_DEFINED) + #undef GLAPIENTRY + #undef GLFW_GLAPIENTRY_DEFINED + #endif + #include #endif -#elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX) - #include - #include -#elif defined(GLFW_EXPOSE_NATIVE_WAYLAND) - #include -#endif -#if defined(GLFW_EXPOSE_NATIVE_WGL) - /* WGL is declared by windows.h */ -#endif -#if defined(GLFW_EXPOSE_NATIVE_NSGL) - /* NSGL is declared by Cocoa.h */ -#endif -#if defined(GLFW_EXPOSE_NATIVE_GLX) - #include -#endif -#if defined(GLFW_EXPOSE_NATIVE_EGL) - #include -#endif -#if defined(GLFW_EXPOSE_NATIVE_OSMESA) - #include -#endif +#endif /*GLFW_NATIVE_INCLUDE_NONE*/ /************************************************************************* @@ -132,6 +163,8 @@ extern "C" { * of the specified monitor, or `NULL` if an [error](@ref error_handling) * occurred. * + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -147,6 +180,8 @@ GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor); * `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -161,6 +196,16 @@ GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor); * @return The `HWND` of the specified window, or `NULL` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. + * + * @remark The `HDC` associated with the window can be queried with the + * [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc) + * function. + * @code + * HDC dc = GetDC(glfwGetWin32Window(window)); + * @endcode + * This DC is private and does not need to be released. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -177,6 +222,17 @@ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window); * @return The `HGLRC` of the specified window, or `NULL` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref + * GLFW_NOT_INITIALIZED. + * + * @remark The `HDC` associated with the window can be queried with the + * [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc) + * function. + * @code + * HDC dc = GetDC(glfwGetWin32Window(window)); + * @endcode + * This DC is private and does not need to be released. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -193,6 +249,8 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window); * @return The `CGDirectDisplayID` of the specified monitor, or * `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -207,6 +265,8 @@ GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor); * @return The `NSWindow` of the specified window, or `nil` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -223,6 +283,9 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window); * @return The `NSOpenGLContext` of the specified window, or `nil` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref + * GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -239,6 +302,8 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* window); * @return The `Display` used by GLFW, or `NULL` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -253,6 +318,8 @@ GLFWAPI Display* glfwGetX11Display(void); * @return The `RRCrtc` of the specified monitor, or `None` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -267,6 +334,8 @@ GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor); * @return The `RROutput` of the specified monitor, or `None` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -281,6 +350,8 @@ GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor); * @return The `Window` of the specified window, or `None` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -347,6 +418,9 @@ GLFWAPI const char* glfwGetX11SelectionString(void); * @return The `GLXContext` of the specified window, or `NULL` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref + * GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -361,6 +435,9 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window); * @return The `GLXWindow` of the specified window, or `None` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref + * GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -377,6 +454,8 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window); * @return The `struct wl_display*` used by GLFW, or `NULL` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -391,6 +470,8 @@ GLFWAPI struct wl_display* glfwGetWaylandDisplay(void); * @return The `struct wl_output*` of the specified monitor, or `NULL` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -405,6 +486,8 @@ GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor); * @return The main `struct wl_surface*` of the specified window, or `NULL` if * an [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -421,6 +504,11 @@ GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window); * @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. + * + * @remark Because EGL is initialized on demand, this function will return + * `EGL_NO_DISPLAY` until the first context has been created via EGL. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -435,6 +523,9 @@ GLFWAPI EGLDisplay glfwGetEGLDisplay(void); * @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref + * GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -449,6 +540,9 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window); * @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref + * GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -472,6 +566,9 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window); * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref + * GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -493,6 +590,9 @@ GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref + * GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -507,6 +607,9 @@ GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height * @return The `OSMesaContext` of the specified window, or `NULL` if an * [error](@ref error_handling) occurred. * + * @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref + * GLFW_NOT_INITIALIZED. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * diff --git a/third_party/penumbra/vendor/glfw/src/CMakeLists.txt b/third_party/penumbra/vendor/glfw/src/CMakeLists.txt index 891302edad3..b6dd86c5451 100644 --- a/third_party/penumbra/vendor/glfw/src/CMakeLists.txt +++ b/third_party/penumbra/vendor/glfw/src/CMakeLists.txt @@ -5,6 +5,15 @@ set(common_HEADERS internal.h mappings.h "${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h") set(common_SOURCES context.c init.c input.c monitor.c vulkan.c window.c) +add_custom_target(update_mappings + COMMAND "${CMAKE_COMMAND}" -P "${GLFW_SOURCE_DIR}/CMake/GenerateMappings.cmake" mappings.h.in mappings.h + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT "Updating gamepad mappings from upstream repository" + SOURCES mappings.h.in "${GLFW_SOURCE_DIR}/CMake/GenerateMappings.cmake" + VERBATIM) + +set_target_properties(update_mappings PROPERTIES FOLDER "GLFW3") + if (_GLFW_COCOA) set(glfw_HEADERS ${common_HEADERS} cocoa_platform.h cocoa_joystick.h posix_thread.h nsgl_context.h egl_context.h osmesa_context.h) @@ -63,7 +72,7 @@ elseif (_GLFW_OSMESA) endif() if (_GLFW_X11 OR _GLFW_WAYLAND) - if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") set(glfw_HEADERS ${glfw_HEADERS} linux_joystick.h) set(glfw_SOURCES ${glfw_SOURCES} linux_joystick.c) else() @@ -72,8 +81,8 @@ if (_GLFW_X11 OR _GLFW_WAYLAND) endif() endif() -if (APPLE) - # For some reason CMake didn't know about .m until version 3.16 +# Workaround for CMake not knowing about .m files before version 3.16 +if (CMAKE_VERSION VERSION_LESS "3.16" AND APPLE) set_source_files_properties(cocoa_init.m cocoa_joystick.m cocoa_monitor.m cocoa_window.m nsgl_context.m PROPERTIES LANGUAGE C) @@ -87,8 +96,8 @@ set_target_properties(glfw PROPERTIES POSITION_INDEPENDENT_CODE ON FOLDER "GLFW3") -if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR - ${CMAKE_VERSION} VERSION_GREATER "3.1.0") +if (CMAKE_VERSION VERSION_EQUAL "3.1.0" OR + CMAKE_VERSION VERSION_GREATER "3.1.0") set_target_properties(glfw PROPERTIES C_STANDARD 99) else() @@ -109,25 +118,30 @@ target_include_directories(glfw PRIVATE ${glfw_INCLUDE_DIRS}) target_link_libraries(glfw PRIVATE ${glfw_LIBRARIES}) -if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR - "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR - "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang") - - # Make GCC and Clang warn about declarations that VS 2010 and 2012 won't - # accept for all source files that VS will build +# Make GCC warn about declarations that VS 2010 and 2012 won't accept for all +# source files that VS will build (Clang ignores this because we set -std=c99) +if (CMAKE_C_COMPILER_ID STREQUAL "GNU") set_source_files_properties(context.c init.c input.c monitor.c vulkan.c window.c win32_init.c win32_joystick.c win32_monitor.c win32_time.c win32_thread.c win32_window.c wgl_context.c egl_context.c osmesa_context.c PROPERTIES COMPILE_FLAGS -Wdeclaration-after-statement) +endif() + +# Enable a reasonable set of warnings +# NOTE: The order matters here, Clang-CL matches both MSVC and Clang +if (MSVC) + target_compile_options(glfw PRIVATE "/W3") +elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR + CMAKE_C_COMPILER_ID STREQUAL "Clang" OR + CMAKE_C_COMPILER_ID STREQUAL "AppleClang") - # Enable a reasonable set of warnings (no, -Wextra is not reasonable) target_compile_options(glfw PRIVATE "-Wall") endif() -if (WIN32) - target_compile_definitions(glfw PRIVATE _UNICODE) +if (_GLFW_WIN32) + target_compile_definitions(glfw PRIVATE UNICODE _UNICODE) endif() # HACK: When building on MinGW, WINVER and UNICODE need to be defined before @@ -135,7 +149,7 @@ endif() # win32_platform.h. We define them here until a saner solution can be found # NOTE: MinGW-w64 and Visual C++ do /not/ need this hack. if (MINGW) - target_compile_definitions(glfw PRIVATE UNICODE WINVER=0x0501) + target_compile_definitions(glfw PRIVATE WINVER=0x0501) endif() if (BUILD_SHARED_LIBS) @@ -159,9 +173,6 @@ if (BUILD_SHARED_LIBS) elseif (APPLE) # Add -fno-common to work around a bug in Apple's GCC target_compile_options(glfw PRIVATE "-fno-common") - - set_target_properties(glfw PROPERTIES - INSTALL_NAME_DIR "${CMAKE_INSTALL_LIBDIR}") endif() if (UNIX) @@ -170,14 +181,14 @@ if (BUILD_SHARED_LIBS) endif() endif() -if (MSVC) +if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC") target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS) endif() if (GLFW_INSTALL) install(TARGETS glfw EXPORT glfwTargets - RUNTIME DESTINATION "bin" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") endif() diff --git a/third_party/penumbra/vendor/glfw/src/cocoa_init.m b/third_party/penumbra/vendor/glfw/src/cocoa_init.m index 579b6e6ce48..f5273129812 100644 --- a/third_party/penumbra/vendor/glfw/src/cocoa_init.m +++ b/third_party/penumbra/vendor/glfw/src/cocoa_init.m @@ -428,9 +428,6 @@ - (void)applicationWillFinishLaunching:(NSNotification *)notification { if (_glfw.hints.init.ns.menubar) { - // In case we are unbundled, make us a proper UI application - [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; - // Menu bar setup must go between sharedApplication and finishLaunching // in order to properly emulate the behavior of NSApplicationMain @@ -449,6 +446,11 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification { _glfw.ns.finishedLaunching = GLFW_TRUE; _glfwPlatformPostEmptyEvent(); + + // In case we are unbundled, make us a proper UI application + if (_glfw.hints.init.ns.menubar) + [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; + [NSApp stop:nil]; } @@ -473,18 +475,26 @@ - (void)applicationDidHide:(NSNotification *)notification if (!bundle) return NULL; - CFURLRef url = - CFBundleCopyAuxiliaryExecutableURL(bundle, CFSTR("libvulkan.1.dylib")); - if (!url) + CFURLRef frameworksUrl = CFBundleCopyPrivateFrameworksURL(bundle); + if (!frameworksUrl) return NULL; + CFURLRef loaderUrl = CFURLCreateCopyAppendingPathComponent( + kCFAllocatorDefault, frameworksUrl, CFSTR("libvulkan.1.dylib"), false); + if (!loaderUrl) + { + CFRelease(frameworksUrl); + return NULL; + } + char path[PATH_MAX]; void* handle = NULL; - if (CFURLGetFileSystemRepresentation(url, true, (UInt8*) path, sizeof(path) - 1)) + if (CFURLGetFileSystemRepresentation(loaderUrl, true, (UInt8*) path, sizeof(path) - 1)) handle = _glfw_dlopen(path); - CFRelease(url); + CFRelease(loaderUrl); + CFRelease(frameworksUrl); return handle; } @@ -605,6 +615,8 @@ void _glfwPlatformTerminate(void) free(_glfw.ns.clipboardString); _glfwTerminateNSGL(); + _glfwTerminateEGL(); + _glfwTerminateOSMesa(); _glfwTerminateJoysticksNS(); } // autoreleasepool diff --git a/third_party/penumbra/vendor/glfw/src/cocoa_joystick.h b/third_party/penumbra/vendor/glfw/src/cocoa_joystick.h index b4448778188..0de867856d8 100644 --- a/third_party/penumbra/vendor/glfw/src/cocoa_joystick.h +++ b/third_party/penumbra/vendor/glfw/src/cocoa_joystick.h @@ -33,6 +33,7 @@ #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyJoystick; } #define _GLFW_PLATFORM_MAPPING_NAME "Mac OS X" +#define GLFW_BUILD_COCOA_MAPPINGS // Cocoa-specific per-joystick data // diff --git a/third_party/penumbra/vendor/glfw/src/cocoa_joystick.m b/third_party/penumbra/vendor/glfw/src/cocoa_joystick.m index 2c8d82d94c6..3d306777a3b 100644 --- a/third_party/penumbra/vendor/glfw/src/cocoa_joystick.m +++ b/third_party/penumbra/vendor/glfw/src/cocoa_joystick.m @@ -98,8 +98,7 @@ static void closeJoystick(_GLFWjoystick* js) { int i; - if (!js->present) - return; + _glfwInputJoystick(js, GLFW_DISCONNECTED); for (i = 0; i < CFArrayGetCount(js->ns.axes); i++) free((void*) CFArrayGetValueAtIndex(js->ns.axes, i)); @@ -114,7 +113,6 @@ static void closeJoystick(_GLFWjoystick* js) CFRelease(js->ns.hats); _glfwFreeJoystick(js); - _glfwInputJoystick(js, GLFW_DISCONNECTED); } // Callback for user-initiated joystick addition @@ -294,9 +292,9 @@ static void removeCallback(void* context, for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { - if (_glfw.joysticks[jid].ns.device == device) + if (_glfw.joysticks[jid].connected && _glfw.joysticks[jid].ns.device == device) { - closeJoystick(_glfw.joysticks + jid); + closeJoystick(&_glfw.joysticks[jid]); break; } } @@ -392,7 +390,10 @@ void _glfwTerminateJoysticksNS(void) int jid; for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) - closeJoystick(_glfw.joysticks + jid); + { + if (_glfw.joysticks[jid].connected) + closeJoystick(&_glfw.joysticks[jid]); + } CFRelease(_glfw.ns.hidManager); _glfw.ns.hidManager = NULL; @@ -470,7 +471,7 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode) } } - return js->present; + return js->connected; } void _glfwPlatformUpdateGamepadGUID(char* guid) diff --git a/third_party/penumbra/vendor/glfw/src/cocoa_monitor.m b/third_party/penumbra/vendor/glfw/src/cocoa_monitor.m index 8ef94a3b0ff..7769bb7e99e 100644 --- a/third_party/penumbra/vendor/glfw/src/cocoa_monitor.m +++ b/third_party/penumbra/vendor/glfw/src/cocoa_monitor.m @@ -39,18 +39,31 @@ // Get the name of the specified display, or NULL // -static char* getDisplayName(CGDirectDisplayID displayID) +static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen) { + // IOKit doesn't work on Apple Silicon anymore + // Luckily, 10.15 introduced -[NSScreen localizedName]. + // Use it if available, and fall back to IOKit otherwise. + if (screen) + { + if ([screen respondsToSelector:@selector(localizedName)]) + { + NSString* name = [screen valueForKey:@"localizedName"]; + if (name) + return _glfw_strdup([name UTF8String]); + } + } + io_iterator_t it; io_service_t service; CFDictionaryRef info; - if (IOServiceGetMatchingServices(kIOMasterPortDefault, + if (IOServiceGetMatchingServices(MACH_PORT_NULL, IOServiceMatching("IODisplayConnect"), &it) != 0) { // This may happen if a desktop Mac is running headless - return NULL; + return _glfw_strdup("Display"); } while ((service = IOIteratorNext(it)) != 0) @@ -85,11 +98,7 @@ IOObjectRelease(it); if (!service) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Cocoa: Failed to find service port for display"); - return NULL; - } + return _glfw_strdup("Display"); CFDictionaryRef names = CFDictionaryGetValue(info, CFSTR(kDisplayProductName)); @@ -101,7 +110,7 @@ { // This may happen if a desktop Mac is running headless CFRelease(info); - return NULL; + return _glfw_strdup("Display"); } const CFIndex size = @@ -209,31 +218,6 @@ static void endFadeReservation(CGDisplayFadeReservationToken token) } } -// Finds and caches the NSScreen corresponding to the specified monitor -// -static GLFWbool refreshMonitorScreen(_GLFWmonitor* monitor) -{ - if (monitor->ns.screen) - return GLFW_TRUE; - - for (NSScreen* screen in [NSScreen screens]) - { - NSNumber* displayID = [screen deviceDescription][@"NSScreenNumber"]; - - // HACK: Compare unit numbers instead of display IDs to work around - // display replacement on machines with automatic graphics - // switching - if (monitor->ns.unitNumber == CGDisplayUnitNumber([displayID unsignedIntValue])) - { - monitor->ns.screen = screen; - return GLFW_TRUE; - } - } - - _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to find a screen for monitor"); - return GLFW_FALSE; -} - // Returns the display refresh rate queried from the I/O registry // static double getFallbackRefreshRate(CGDirectDisplayID displayID) @@ -243,7 +227,7 @@ static double getFallbackRefreshRate(CGDirectDisplayID displayID) io_iterator_t it; io_service_t service; - if (IOServiceGetMatchingServices(kIOMasterPortDefault, + if (IOServiceGetMatchingServices(MACH_PORT_NULL, IOServiceMatching("IOFramebuffer"), &it) != 0) { @@ -277,14 +261,20 @@ static double getFallbackRefreshRate(CGDirectDisplayID displayID) CFSTR("IOFBCurrentPixelCount"), kCFAllocatorDefault, kNilOptions); - if (!clockRef || !countRef) - break; uint32_t clock = 0, count = 0; - CFNumberGetValue(clockRef, kCFNumberIntType, &clock); - CFNumberGetValue(countRef, kCFNumberIntType, &count); - CFRelease(clockRef); - CFRelease(countRef); + + if (clockRef) + { + CFNumberGetValue(clockRef, kCFNumberIntType, &clock); + CFRelease(clockRef); + } + + if (countRef) + { + CFNumberGetValue(countRef, kCFNumberIntType, &count); + CFRelease(countRef); + } if (clock > 0 && count > 0) refreshRate = clock / (double) count; @@ -328,27 +318,46 @@ void _glfwPollMonitorsNS(void) if (CGDisplayIsAsleep(displays[i])) continue; + const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]); + NSScreen* screen = nil; + + for (screen in [NSScreen screens]) + { + NSNumber* screenNumber = [screen deviceDescription][@"NSScreenNumber"]; + + // HACK: Compare unit numbers instead of display IDs to work around + // display replacement on machines with automatic graphics + // switching + if (CGDisplayUnitNumber([screenNumber unsignedIntValue]) == unitNumber) + break; + } + // HACK: Compare unit numbers instead of display IDs to work around // display replacement on machines with automatic graphics // switching - const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]); - for (uint32_t j = 0; j < disconnectedCount; j++) + uint32_t j; + for (j = 0; j < disconnectedCount; j++) { if (disconnected[j] && disconnected[j]->ns.unitNumber == unitNumber) { + disconnected[j]->ns.screen = screen; disconnected[j] = NULL; break; } } + if (j < disconnectedCount) + continue; + const CGSize size = CGDisplayScreenSize(displays[i]); - char* name = getDisplayName(displays[i]); + char* name = getMonitorName(displays[i], screen); if (!name) - name = _glfw_strdup("Unknown"); + continue; _GLFWmonitor* monitor = _glfwAllocMonitor(name, size.width, size.height); monitor->ns.displayID = displays[i]; monitor->ns.unitNumber = unitNumber; + monitor->ns.screen = screen; free(name); @@ -457,8 +466,11 @@ void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor, { @autoreleasepool { - if (!refreshMonitorScreen(monitor)) - return; + if (!monitor->ns.screen) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Cocoa: Cannot query content scale without screen"); + } const NSRect points = [monitor->ns.screen frame]; const NSRect pixels = [monitor->ns.screen convertRectToBacking:points]; @@ -477,8 +489,11 @@ void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, { @autoreleasepool { - if (!refreshMonitorScreen(monitor)) - return; + if (!monitor->ns.screen) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Cocoa: Cannot query workarea without screen"); + } const NSRect frameRect = [monitor->ns.screen visibleFrame]; @@ -521,7 +536,7 @@ void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, } // Skip duplicate modes - if (i < *count) + if (j < *count) continue; (*count)++; diff --git a/third_party/penumbra/vendor/glfw/src/cocoa_platform.h b/third_party/penumbra/vendor/glfw/src/cocoa_platform.h index 15c2169619e..bb677033a15 100644 --- a/third_party/penumbra/vendor/glfw/src/cocoa_platform.h +++ b/third_party/penumbra/vendor/glfw/src/cocoa_platform.h @@ -31,7 +31,9 @@ // NOTE: All of NSGL was deprecated in the 10.14 SDK // This disables the pointless warnings for every symbol we use +#ifndef GL_SILENCE_DEPRECATION #define GL_SILENCE_DEPRECATION +#endif #if defined(__OBJC__) #import @@ -40,8 +42,10 @@ typedef void* id; #endif // NOTE: Many Cocoa enum values have been renamed and we need to build across -// SDK versions where one is unavailable or the other deprecated -// We use the newer names in code and these macros to handle compatibility +// SDK versions where one is unavailable or deprecated. +// We use the newer names in code and replace them with the older names if +// the base SDK does not provide the newer names. + #if MAC_OS_X_VERSION_MAX_ALLOWED < 101200 #define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat #define NSEventMaskAny NSAnyEventMask @@ -60,6 +64,15 @@ typedef void* id; #define NSWindowStyleMaskTitled NSTitledWindowMask #endif +// NOTE: Many Cocoa dynamically linked constants have been renamed and we need +// to build across SDK versions where one is unavailable or deprecated. +// We use the newer names in code and replace them with the older names if +// the deployment target is older than the newer names. + +#if MAC_OS_X_VERSION_MIN_REQUIRED < 101300 + #define NSPasteboardTypeURL NSURLPboardType +#endif + typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; typedef VkFlags VkMetalSurfaceCreateFlagsEXT; @@ -92,7 +105,7 @@ typedef VkResult (APIENTRY *PFN_vkCreateMetalSurfaceEXT)(VkInstance,const VkMeta #define _glfw_dlclose(handle) dlclose(handle) #define _glfw_dlsym(handle, name) dlsym(handle, name) -#define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->ns.view) +#define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->ns.layer) #define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNS ns @@ -121,6 +134,7 @@ typedef struct _GLFWwindowNS id layer; GLFWbool maximized; + GLFWbool occluded; GLFWbool retina; // Cached window properties to filter out duplicate events @@ -132,7 +146,6 @@ typedef struct _GLFWwindowNS // since the last cursor motion event was processed // This is kept to counteract Cocoa doing the same internally double cursorWarpDeltaX, cursorWarpDeltaY; - } _GLFWwindowNS; // Cocoa-specific global data @@ -167,7 +180,6 @@ typedef struct _GLFWlibraryNS PFN_LMGetKbdType GetKbdType; CFStringRef kPropertyUnicodeKeyLayoutData; } tis; - } _GLFWlibraryNS; // Cocoa-specific per-monitor data @@ -179,7 +191,6 @@ typedef struct _GLFWmonitorNS uint32_t unitNumber; id screen; double fallbackRefreshRate; - } _GLFWmonitorNS; // Cocoa-specific per-cursor data @@ -187,7 +198,6 @@ typedef struct _GLFWmonitorNS typedef struct _GLFWcursorNS { id object; - } _GLFWcursorNS; // Cocoa-specific global timer data @@ -195,7 +205,6 @@ typedef struct _GLFWcursorNS typedef struct _GLFWtimerNS { uint64_t frequency; - } _GLFWtimerNS; diff --git a/third_party/penumbra/vendor/glfw/src/cocoa_window.m b/third_party/penumbra/vendor/glfw/src/cocoa_window.m index 129e975e556..bbab6c4f087 100644 --- a/third_party/penumbra/vendor/glfw/src/cocoa_window.m +++ b/third_party/penumbra/vendor/glfw/src/cocoa_window.m @@ -31,25 +31,9 @@ #include #include -// Returns the style mask corresponding to the window settings -// -static NSUInteger getStyleMask(_GLFWwindow* window) -{ - NSUInteger styleMask = NSWindowStyleMaskMiniaturizable; - - if (window->monitor || !window->decorated) - styleMask |= NSWindowStyleMaskBorderless; - else - { - styleMask |= NSWindowStyleMaskTitled | - NSWindowStyleMaskClosable; - - if (window->resizable) - styleMask |= NSWindowStyleMaskResizable; - } - - return styleMask; -} +// HACK: This enum value is missing from framework headers on OS X 10.11 despite +// having been (according to documentation) added in Mac OS X 10.7 +#define NSWindowCollectionBehaviorFullScreenNone (1 << 9) // Returns whether the cursor is in the content area of the specified window // @@ -114,10 +98,11 @@ static void updateCursorMode(_GLFWwindow* window) else if (_glfw.ns.disabledCursorWindow == window) { _glfw.ns.disabledCursorWindow = NULL; - CGAssociateMouseAndMouseCursorPosition(true); _glfwPlatformSetCursorPos(window, _glfw.ns.restoreCursorPosX, _glfw.ns.restoreCursorPosY); + // NOTE: The matching CGAssociateMouseAndMouseCursorPosition call is + // made in _glfwPlatformSetCursorPos as part of a workaround } if (cursorInContentArea(window)) @@ -243,7 +228,7 @@ - (BOOL)windowShouldClose:(id)sender - (void)windowDidResize:(NSNotification *)notification { - if (window->context.client != GLFW_NO_API) + if (window->context.source == GLFW_NATIVE_CONTEXT_API) [window->context.nsgl.object update]; if (_glfw.ns.disabledCursorWindow == window) @@ -278,7 +263,7 @@ - (void)windowDidResize:(NSNotification *)notification - (void)windowDidMove:(NSNotification *)notification { - if (window->context.client != GLFW_NO_API) + if (window->context.source == GLFW_NATIVE_CONTEXT_API) [window->context.nsgl.object update]; if (_glfw.ns.disabledCursorWindow == window) @@ -322,6 +307,14 @@ - (void)windowDidResignKey:(NSNotification *)notification _glfwInputWindowFocus(window, GLFW_FALSE); } +- (void)windowDidChangeOcclusionState:(NSNotification* )notification +{ + if ([window->ns.object occlusionState] & NSWindowOcclusionStateVisible) + window->ns.occluded = GLFW_FALSE; + else + window->ns.occluded = GLFW_TRUE; +} + @end @@ -352,9 +345,7 @@ - (instancetype)initWithGlfwWindow:(_GLFWwindow *)initWindow markedText = [[NSMutableAttributedString alloc] init]; [self updateTrackingAreas]; - // NOTE: kUTTypeURL corresponds to NSPasteboardTypeURL but is available - // on 10.7 without having been deprecated yet - [self registerForDraggedTypes:@[(__bridge NSString*) kUTTypeURL]]; + [self registerForDraggedTypes:@[NSPasteboardTypeURL]]; } return self; @@ -389,7 +380,7 @@ - (BOOL)wantsUpdateLayer - (void)updateLayer { - if (window->context.client != GLFW_NO_API) + if (window->context.source == GLFW_NATIVE_CONTEXT_API) [window->context.nsgl.object update]; _glfwInputWindowDamage(window); @@ -512,26 +503,25 @@ - (void)viewDidChangeBackingProperties { const NSRect contentRect = [window->ns.view frame]; const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect]; - - if (fbRect.size.width != window->ns.fbWidth || - fbRect.size.height != window->ns.fbHeight) - { - window->ns.fbWidth = fbRect.size.width; - window->ns.fbHeight = fbRect.size.height; - _glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height); - } - const float xscale = fbRect.size.width / contentRect.size.width; const float yscale = fbRect.size.height / contentRect.size.height; if (xscale != window->ns.xscale || yscale != window->ns.yscale) { + if (window->ns.retina && window->ns.layer) + [window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]]; + window->ns.xscale = xscale; window->ns.yscale = yscale; _glfwInputWindowContentScale(window, xscale, yscale); + } - if (window->ns.retina && window->ns.layer) - [window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]]; + if (fbRect.size.width != window->ns.fbWidth || + fbRect.size.height != window->ns.fbHeight) + { + window->ns.fbWidth = fbRect.size.width; + window->ns.fbHeight = fbRect.size.height; + _glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height); } } @@ -723,14 +713,24 @@ - (void)insertText:(id)string replacementRange:(NSRange)replacementRange else characters = (NSString*) string; - const NSUInteger length = [characters length]; - for (NSUInteger i = 0; i < length; i++) + NSRange range = NSMakeRange(0, [characters length]); + while (range.length) { - const unichar codepoint = [characters characterAtIndex:i]; - if ((codepoint & 0xff00) == 0xf700) - continue; + uint32_t codepoint = 0; + + if ([characters getBytes:&codepoint + maxLength:sizeof(codepoint) + usedLength:NULL + encoding:NSUTF32StringEncoding + options:0 + range:range + remainingRange:&range]) + { + if (codepoint >= 0xf700 && codepoint <= 0xf7ff) + continue; - _glfwInputChar(window, codepoint, mods, plain); + _glfwInputChar(window, codepoint, mods, plain); + } } } @@ -793,9 +793,21 @@ static GLFWbool createNativeWindow(_GLFWwindow* window, else contentRect = NSMakeRect(0, 0, wndconfig->width, wndconfig->height); + NSUInteger styleMask = NSWindowStyleMaskMiniaturizable; + + if (window->monitor || !window->decorated) + styleMask |= NSWindowStyleMaskBorderless; + else + { + styleMask |= (NSWindowStyleMaskTitled | NSWindowStyleMaskClosable); + + if (window->resizable) + styleMask |= NSWindowStyleMaskResizable; + } + window->ns.object = [[GLFWWindow alloc] initWithContentRect:contentRect - styleMask:getStyleMask(window) + styleMask:styleMask backing:NSBackingStoreBuffered defer:NO]; @@ -821,6 +833,12 @@ static GLFWbool createNativeWindow(_GLFWwindow* window, NSWindowCollectionBehaviorManaged; [window->ns.object setCollectionBehavior:behavior]; } + else + { + const NSWindowCollectionBehavior behavior = + NSWindowCollectionBehaviorFullScreenNone; + [window->ns.object setCollectionBehavior:behavior]; + } if (wndconfig->floating) [window->ns.object setLevel:NSFloatingWindowLevel]; @@ -901,6 +919,11 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, } else if (ctxconfig->source == GLFW_EGL_CONTEXT_API) { + // EGL implementation on macOS use CALayer* EGLNativeWindowType so we + // need to get the layer for EGL window surface creation. + [window->ns.view setWantsLayer:YES]; + window->ns.layer = [window->ns.view layer]; + if (!_glfwInitEGL()) return GLFW_FALSE; if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig)) @@ -913,6 +936,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) return GLFW_FALSE; } + + if (!_glfwRefreshContextAttribs(window, ctxconfig)) + return GLFW_FALSE; } if (window->monitor) @@ -920,6 +946,18 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, _glfwPlatformShowWindow(window); _glfwPlatformFocusWindow(window); acquireMonitor(window); + + if (wndconfig->centerCursor) + _glfwCenterCursorInContentArea(window); + } + else + { + if (wndconfig->visible) + { + _glfwPlatformShowWindow(window); + if (wndconfig->focused) + _glfwPlatformFocusWindow(window); + } } return GLFW_TRUE; @@ -1198,9 +1236,10 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, { const NSRect contentRect = NSMakeRect(xpos, _glfwTransformYNS(ypos + height - 1), width, height); + const NSUInteger styleMask = [window->ns.object styleMask]; const NSRect frameRect = [window->ns.object frameRectForContentRect:contentRect - styleMask:getStyleMask(window)]; + styleMask:styleMask]; [window->ns.object setFrame:frameRect display:YES]; } @@ -1217,7 +1256,27 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, // TODO: Solve this in a less terrible way _glfwPlatformPollEvents(); - const NSUInteger styleMask = getStyleMask(window); + NSUInteger styleMask = [window->ns.object styleMask]; + + if (window->monitor) + { + styleMask &= ~(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable); + styleMask |= NSWindowStyleMaskBorderless; + } + else + { + if (window->decorated) + { + styleMask &= ~NSWindowStyleMaskBorderless; + styleMask |= (NSWindowStyleMaskTitled | NSWindowStyleMaskClosable); + } + + if (window->resizable) + styleMask |= NSWindowStyleMaskResizable; + else + styleMask &= ~NSWindowStyleMaskResizable; + } + [window->ns.object setStyleMask:styleMask]; // HACK: Changing the style mask can cause the first responder to be cleared [window->ns.object makeFirstResponder:window->ns.view]; @@ -1263,6 +1322,20 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, else [window->ns.object setLevel:NSNormalWindowLevel]; + if (window->resizable) + { + const NSWindowCollectionBehavior behavior = + NSWindowCollectionBehaviorFullScreenPrimary | + NSWindowCollectionBehaviorManaged; + [window->ns.object setCollectionBehavior:behavior]; + } + else + { + const NSWindowCollectionBehavior behavior = + NSWindowCollectionBehaviorFullScreenNone; + [window->ns.object setCollectionBehavior:behavior]; + } + [window->ns.object setHasShadow:YES]; // HACK: Clearing NSWindowStyleMaskTitled resets and disables the window // title property but the miniwindow title property is unaffected @@ -1296,7 +1369,12 @@ int _glfwPlatformWindowVisible(_GLFWwindow* window) int _glfwPlatformWindowMaximized(_GLFWwindow* window) { @autoreleasepool { - return [window->ns.object isZoomed]; + + if (window->resizable) + return [window->ns.object isZoomed]; + else + return GLFW_FALSE; + } // autoreleasepool } @@ -1328,15 +1406,46 @@ int _glfwPlatformFramebufferTransparent(_GLFWwindow* window) void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled) { @autoreleasepool { - [window->ns.object setStyleMask:getStyleMask(window)]; + + const NSUInteger styleMask = [window->ns.object styleMask]; + if (enabled) + { + [window->ns.object setStyleMask:(styleMask | NSWindowStyleMaskResizable)]; + const NSWindowCollectionBehavior behavior = + NSWindowCollectionBehaviorFullScreenPrimary | + NSWindowCollectionBehaviorManaged; + [window->ns.object setCollectionBehavior:behavior]; + } + else + { + [window->ns.object setStyleMask:(styleMask & ~NSWindowStyleMaskResizable)]; + const NSWindowCollectionBehavior behavior = + NSWindowCollectionBehaviorFullScreenNone; + [window->ns.object setCollectionBehavior:behavior]; + } + } // autoreleasepool } void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) { @autoreleasepool { - [window->ns.object setStyleMask:getStyleMask(window)]; + + NSUInteger styleMask = [window->ns.object styleMask]; + if (enabled) + { + styleMask |= (NSWindowStyleMaskTitled | NSWindowStyleMaskClosable); + styleMask &= ~NSWindowStyleMaskBorderless; + } + else + { + styleMask |= NSWindowStyleMaskBorderless; + styleMask &= ~(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable); + } + + [window->ns.object setStyleMask:styleMask]; [window->ns.object makeFirstResponder:window->ns.view]; + } // autoreleasepool } @@ -1501,6 +1610,11 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y) _glfwTransformYNS(globalPoint.y))); } + // HACK: Calling this right after setting the cursor position prevents macOS + // from freezing the cursor for a fraction of a second afterwards + if (window->cursorMode != GLFW_CURSOR_DISABLED) + CGAssociateMouseAndMouseCursorPosition(true); + } // autoreleasepool } @@ -1519,7 +1633,7 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode) if (scancode < 0 || scancode > 0xff || _glfw.ns.keycodes[scancode] == GLFW_KEY_UNKNOWN) { - _glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode"); + _glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode); return NULL; } diff --git a/third_party/penumbra/vendor/glfw/src/context.c b/third_party/penumbra/vendor/glfw/src/context.c index 867e399f231..d86e0faec49 100644 --- a/third_party/penumbra/vendor/glfw/src/context.c +++ b/third_party/penumbra/vendor/glfw/src/context.c @@ -196,12 +196,6 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, continue; } - if (desired->doublebuffer != current->doublebuffer) - { - // Double buffering is a hard constraint - continue; - } - // Count number of missing buffers { missing = 0; @@ -570,7 +564,9 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window, PFNGLCLEARPROC glClear = (PFNGLCLEARPROC) window->context.getProcAddress("glClear"); glClear(GL_COLOR_BUFFER_BIT); - window->context.swapBuffers(window); + + if (window->doublebuffer) + window->context.swapBuffers(window); } glfwMakeContextCurrent((GLFWwindow*) previous); @@ -613,10 +609,12 @@ GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; - _GLFWwindow* previous = _glfwPlatformGetTls(&_glfw.contextSlot); + _GLFWwindow* previous; _GLFW_REQUIRE_INIT(); + previous = _glfwPlatformGetTls(&_glfw.contextSlot); + if (window && window->context.client == GLFW_NO_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, diff --git a/third_party/penumbra/vendor/glfw/src/egl_context.c b/third_party/penumbra/vendor/glfw/src/egl_context.c index e458bfb87e3..58d9557b0e2 100644 --- a/third_party/penumbra/vendor/glfw/src/egl_context.c +++ b/third_party/penumbra/vendor/glfw/src/egl_context.c @@ -173,7 +173,7 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig, u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE); u->samples = getEGLConfigAttrib(n, EGL_SAMPLES); - u->doublebuffer = GLFW_TRUE; + u->doublebuffer = desired->doublebuffer; u->handle = (uintptr_t) n; usableCount++; @@ -230,6 +230,12 @@ static void swapBuffersEGL(_GLFWwindow* window) return; } +#if defined(_GLFW_WAYLAND) + // NOTE: Swapping buffers on a hidden window on Wayland makes it visible + if (!window->wl.visible) + return; +#endif + eglSwapBuffers(_glfw.egl.display, window->context.egl.surface); } @@ -314,6 +320,8 @@ GLFWbool _glfwInitEGL(void) "libEGL.dylib", #elif defined(__CYGWIN__) "libEGL-1.so", +#elif defined(__OpenBSD__) || defined(__NetBSD__) + "libEGL.so", #else "libEGL.so.1", #endif @@ -426,6 +434,8 @@ GLFWbool _glfwInitEGL(void) extensionSupportedEGL("EGL_KHR_get_all_proc_addresses"); _glfw.egl.KHR_context_flush_control = extensionSupportedEGL("EGL_KHR_context_flush_control"); + _glfw.egl.EXT_present_opaque = + extensionSupportedEGL("EGL_EXT_present_opaque"); return GLFW_TRUE; } @@ -588,17 +598,21 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, } // Set up attributes for surface creation + index = 0; + + if (fbconfig->sRGB) { - int index = 0; + if (_glfw.egl.KHR_gl_colorspace) + setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR); + } - if (fbconfig->sRGB) - { - if (_glfw.egl.KHR_gl_colorspace) - setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR); - } + if (!fbconfig->doublebuffer) + setAttrib(EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER); - setAttrib(EGL_NONE, EGL_NONE); - } + if (_glfw.egl.EXT_present_opaque) + setAttrib(EGL_PRESENT_OPAQUE_EXT, !fbconfig->transparent); + + setAttrib(EGL_NONE, EGL_NONE); window->context.egl.surface = eglCreateWindowSurface(_glfw.egl.display, @@ -629,6 +643,8 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, "libGLES_CM.dll", #elif defined(_GLFW_COCOA) "libGLESv1_CM.dylib", +#elif defined(__OpenBSD__) || defined(__NetBSD__) + "libGLESv1_CM.so", #else "libGLESv1_CM.so.1", "libGLES_CM.so.1", @@ -646,6 +662,8 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, "libGLESv2.dylib", #elif defined(__CYGWIN__) "libGLESv2-2.so", +#elif defined(__OpenBSD__) || defined(__NetBSD__) + "libGLESv2.so", #else "libGLESv2.so.2", #endif @@ -657,6 +675,8 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, _GLFW_OPENGL_LIBRARY, #elif defined(_GLFW_WIN32) #elif defined(_GLFW_COCOA) +#elif defined(__OpenBSD__) || defined(__NetBSD__) + "libGL.so", #else "libGL.so.1", #endif @@ -764,7 +784,7 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* handle) _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_CONTEXT); - if (window->context.client == GLFW_NO_API) + if (window->context.source != GLFW_EGL_CONTEXT_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); return EGL_NO_CONTEXT; @@ -778,7 +798,7 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle) _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_SURFACE); - if (window->context.client == GLFW_NO_API) + if (window->context.source != GLFW_EGL_CONTEXT_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); return EGL_NO_SURFACE; diff --git a/third_party/penumbra/vendor/glfw/src/egl_context.h b/third_party/penumbra/vendor/glfw/src/egl_context.h index 6d42e11c976..47493a6fa5d 100644 --- a/third_party/penumbra/vendor/glfw/src/egl_context.h +++ b/third_party/penumbra/vendor/glfw/src/egl_context.h @@ -80,6 +80,8 @@ typedef struct wl_egl_window* EGLNativeWindowType; #define EGL_OPENGL_ES_API 0x30a0 #define EGL_OPENGL_API 0x30a2 #define EGL_NONE 0x3038 +#define EGL_RENDER_BUFFER 0x3086 +#define EGL_SINGLE_BUFFER 0x3085 #define EGL_EXTENSIONS 0x3055 #define EGL_CONTEXT_CLIENT_VERSION 0x3098 #define EGL_NATIVE_VISUAL_ID 0x302e @@ -106,6 +108,7 @@ typedef struct wl_egl_window* EGLNativeWindowType; #define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097 #define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0 #define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098 +#define EGL_PRESENT_OPAQUE_EXT 0x31df typedef int EGLint; typedef unsigned int EGLBoolean; @@ -162,7 +165,6 @@ typedef struct _GLFWcontextEGL EGLSurface surface; void* client; - } _GLFWcontextEGL; // EGL-specific global data @@ -178,6 +180,7 @@ typedef struct _GLFWlibraryEGL GLFWbool KHR_gl_colorspace; GLFWbool KHR_get_all_proc_addresses; GLFWbool KHR_context_flush_control; + GLFWbool EXT_present_opaque; void* handle; @@ -197,7 +200,6 @@ typedef struct _GLFWlibraryEGL PFN_eglSwapInterval SwapInterval; PFN_eglQueryString QueryString; PFN_eglGetProcAddress GetProcAddress; - } _GLFWlibraryEGL; diff --git a/third_party/penumbra/vendor/glfw/src/glfw_config.h.in b/third_party/penumbra/vendor/glfw/src/glfw_config.h.in index f418c995071..e30c9c1bee1 100644 --- a/third_party/penumbra/vendor/glfw/src/glfw_config.h.in +++ b/third_party/penumbra/vendor/glfw/src/glfw_config.h.in @@ -53,8 +53,6 @@ // Define this to 1 to force use of high-performance GPU on hybrid systems #cmakedefine _GLFW_USE_HYBRID_HPG -// Define this to 1 if xkbcommon supports the compose key -#cmakedefine HAVE_XKBCOMMON_COMPOSE_H // Define this to 1 if the libc supports memfd_create() #cmakedefine HAVE_MEMFD_CREATE diff --git a/third_party/penumbra/vendor/glfw/src/glx_context.c b/third_party/penumbra/vendor/glfw/src/glx_context.c index fbbb897727f..1b1b3f90dc6 100644 --- a/third_party/penumbra/vendor/glfw/src/glx_context.c +++ b/third_party/penumbra/vendor/glfw/src/glx_context.c @@ -92,6 +92,9 @@ static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired, continue; } + if (getGLXFBConfigAttrib(n, GLX_DOUBLEBUFFER) != desired->doublebuffer) + continue; + if (desired->transparent) { XVisualInfo* vi = glXGetVisualFromFBConfig(_glfw.x11.display, n); @@ -119,8 +122,6 @@ static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired, if (getGLXFBConfigAttrib(n, GLX_STEREO)) u->stereo = GLFW_TRUE; - if (getGLXFBConfigAttrib(n, GLX_DOUBLEBUFFER)) - u->doublebuffer = GLFW_TRUE; if (_glfw.glx.ARB_multisample) u->samples = getGLXFBConfigAttrib(n, GLX_SAMPLES); @@ -259,6 +260,8 @@ GLFWbool _glfwInitGLX(void) _GLFW_GLX_LIBRARY, #elif defined(__CYGWIN__) "libGL-1.so", +#elif defined(__OpenBSD__) || defined(__NetBSD__) + "libGL.so", #else "libGL.so.1", "libGL.so", @@ -306,10 +309,6 @@ GLFWbool _glfwInitGLX(void) _glfw_dlsym(_glfw.glx.handle, "glXCreateWindow"); _glfw.glx.DestroyWindow = _glfw_dlsym(_glfw.glx.handle, "glXDestroyWindow"); - _glfw.glx.GetProcAddress = - _glfw_dlsym(_glfw.glx.handle, "glXGetProcAddress"); - _glfw.glx.GetProcAddressARB = - _glfw_dlsym(_glfw.glx.handle, "glXGetProcAddressARB"); _glfw.glx.GetVisualFromFBConfig = _glfw_dlsym(_glfw.glx.handle, "glXGetVisualFromFBConfig"); @@ -325,8 +324,6 @@ GLFWbool _glfwInitGLX(void) !_glfw.glx.CreateNewContext || !_glfw.glx.CreateWindow || !_glfw.glx.DestroyWindow || - !_glfw.glx.GetProcAddress || - !_glfw.glx.GetProcAddressARB || !_glfw.glx.GetVisualFromFBConfig) { _glfwInputError(GLFW_PLATFORM_ERROR, @@ -334,6 +331,12 @@ GLFWbool _glfwInitGLX(void) return GLFW_FALSE; } + // NOTE: Unlike GLX 1.3 entry points these are not required to be present + _glfw.glx.GetProcAddress = (PFNGLXGETPROCADDRESSPROC) + _glfw_dlsym(_glfw.glx.handle, "glXGetProcAddress"); + _glfw.glx.GetProcAddressARB = (PFNGLXGETPROCADDRESSPROC) + _glfw_dlsym(_glfw.glx.handle, "glXGetProcAddressARB"); + if (!glXQueryExtension(_glfw.x11.display, &_glfw.glx.errorBase, &_glfw.glx.eventBase)) @@ -673,7 +676,7 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* handle) _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); - if (window->context.client == GLFW_NO_API) + if (window->context.source != GLFW_NATIVE_CONTEXT_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); return NULL; @@ -687,7 +690,7 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* handle) _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(None); - if (window->context.client == GLFW_NO_API) + if (window->context.source != GLFW_NATIVE_CONTEXT_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); return None; diff --git a/third_party/penumbra/vendor/glfw/src/glx_context.h b/third_party/penumbra/vendor/glfw/src/glx_context.h index 12af20ef41d..df0233ebaf6 100644 --- a/third_party/penumbra/vendor/glfw/src/glx_context.h +++ b/third_party/penumbra/vendor/glfw/src/glx_context.h @@ -117,7 +117,6 @@ typedef struct _GLFWcontextGLX { GLXContext handle; GLXWindow window; - } _GLFWcontextGLX; // GLX-specific global data @@ -165,7 +164,6 @@ typedef struct _GLFWlibraryGLX GLFWbool EXT_create_context_es2_profile; GLFWbool ARB_create_context_no_error; GLFWbool ARB_context_flush_control; - } _GLFWlibraryGLX; GLFWbool _glfwInitGLX(void); diff --git a/third_party/penumbra/vendor/glfw/src/init.c b/third_party/penumbra/vendor/glfw/src/init.c index e44d0ca2263..cfdd512d8ab 100644 --- a/third_party/penumbra/vendor/glfw/src/init.c +++ b/third_party/penumbra/vendor/glfw/src/init.c @@ -28,7 +28,6 @@ //======================================================================== #include "internal.h" -#include "mappings.h" #include #include @@ -37,16 +36,15 @@ #include -// The global variables below comprise all mutable global data in GLFW -// -// Any other global variable is a bug +// NOTE: The global variables below comprise all mutable global data in GLFW +// Any other mutable global variable is a bug -// Global state shared between compilation units of GLFW +// This contains all mutable state shared between compilation units of GLFW // _GLFWlibrary _glfw = { GLFW_FALSE }; // These are outside of _glfw so they can be used before initialization and -// after termination +// after termination without special handling when _glfw is cleared to zero // static _GLFWerror _glfwMainThreadError; static GLFWerrorfun _glfwErrorCallback; @@ -113,6 +111,90 @@ static void terminate(void) ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// +// Encode a Unicode code point to a UTF-8 stream +// Based on cutef8 by Jeff Bezanson (Public Domain) +// +size_t _glfwEncodeUTF8(char* s, uint32_t codepoint) +{ + size_t count = 0; + + if (codepoint < 0x80) + s[count++] = (char) codepoint; + else if (codepoint < 0x800) + { + s[count++] = (codepoint >> 6) | 0xc0; + s[count++] = (codepoint & 0x3f) | 0x80; + } + else if (codepoint < 0x10000) + { + s[count++] = (codepoint >> 12) | 0xe0; + s[count++] = ((codepoint >> 6) & 0x3f) | 0x80; + s[count++] = (codepoint & 0x3f) | 0x80; + } + else if (codepoint < 0x110000) + { + s[count++] = (codepoint >> 18) | 0xf0; + s[count++] = ((codepoint >> 12) & 0x3f) | 0x80; + s[count++] = ((codepoint >> 6) & 0x3f) | 0x80; + s[count++] = (codepoint & 0x3f) | 0x80; + } + + return count; +} + +// Splits and translates a text/uri-list into separate file paths +// NOTE: This function destroys the provided string +// +char** _glfwParseUriList(char* text, int* count) +{ + const char* prefix = "file://"; + char** paths = NULL; + char* line; + + *count = 0; + + while ((line = strtok(text, "\r\n"))) + { + char* path; + + text = NULL; + + if (line[0] == '#') + continue; + + if (strncmp(line, prefix, strlen(prefix)) == 0) + { + line += strlen(prefix); + // TODO: Validate hostname + while (*line != '/') + line++; + } + + (*count)++; + + path = calloc(strlen(line) + 1, 1); + paths = realloc(paths, *count * sizeof(char*)); + paths[*count - 1] = path; + + while (*line) + { + if (line[0] == '%' && line[1] && line[2]) + { + const char digits[3] = { line[1], line[2], '\0' }; + *path = (char) strtol(digits, NULL, 16); + line += 2; + } + else + *path = *line; + + path++; + line++; + } + } + + return paths; +} + char* _glfw_strdup(const char* source) { const size_t length = strlen(source); @@ -121,6 +203,16 @@ char* _glfw_strdup(const char* source) return result; } +int _glfw_min(int a, int b) +{ + return a < b ? a : b; +} + +int _glfw_max(int a, int b) +{ + return a > b ? a : b; +} + float _glfw_fminf(float a, float b) { if (a != a) @@ -245,24 +337,12 @@ GLFWAPI int glfwInit(void) _glfwPlatformSetTls(&_glfw.errorSlot, &_glfwMainThreadError); + _glfwInitGamepadMappings(); + _glfw.initialized = GLFW_TRUE; _glfw.timer.offset = _glfwPlatformGetTimerValue(); glfwDefaultWindowHints(); - - { - int i; - - for (i = 0; _glfwDefaultMappings[i]; i++) - { - if (!glfwUpdateGamepadMappings(_glfwDefaultMappings[i])) - { - terminate(); - return GLFW_FALSE; - } - } - } - return GLFW_TRUE; } diff --git a/third_party/penumbra/vendor/glfw/src/input.c b/third_party/penumbra/vendor/glfw/src/input.c index 337d5cf0fc3..7ea1222c5e8 100644 --- a/third_party/penumbra/vendor/glfw/src/input.c +++ b/third_party/penumbra/vendor/glfw/src/input.c @@ -28,6 +28,7 @@ //======================================================================== #include "internal.h" +#include "mappings.h" #include #include @@ -85,25 +86,13 @@ static _GLFWmapping* findValidMapping(const _GLFWjoystick* js) for (i = 0; i <= GLFW_GAMEPAD_BUTTON_LAST; i++) { if (!isValidElementForJoystick(mapping->buttons + i, js)) - { - _glfwInputError(GLFW_INVALID_VALUE, - "Invalid button in gamepad mapping %s (%s)", - mapping->guid, - mapping->name); return NULL; - } } for (i = 0; i <= GLFW_GAMEPAD_AXIS_LAST; i++) { if (!isValidElementForJoystick(mapping->axes + i, js)) - { - _glfwInputError(GLFW_INVALID_VALUE, - "Invalid axis in gamepad mapping %s (%s)", - mapping->guid, - mapping->name); return NULL; - } } } @@ -289,7 +278,7 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m // Notifies shared code of a Unicode codepoint input event // The 'plain' parameter determines whether to emit a regular character event // -void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint, int mods, GLFWbool plain) +void _glfwInputChar(_GLFWwindow* window, uint32_t codepoint, int mods, GLFWbool plain) { if (codepoint < 32 || (codepoint > 126 && codepoint < 160)) return; @@ -371,6 +360,11 @@ void _glfwInputJoystick(_GLFWjoystick* js, int event) { const int jid = (int) (js - _glfw.joysticks); + if (event == GLFW_CONNECTED) + js->connected = GLFW_TRUE; + else if (event == GLFW_DISCONNECTED) + js->connected = GLFW_FALSE; + if (_glfw.callbacks.joystick) _glfw.callbacks.joystick(jid, event); } @@ -408,6 +402,29 @@ void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value) ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// +// Adds the built-in set of gamepad mappings +// +void _glfwInitGamepadMappings(void) +{ + int jid; + size_t i; + const size_t count = sizeof(_glfwDefaultMappings) / sizeof(char*); + _glfw.mappings = calloc(count, sizeof(_GLFWmapping)); + + for (i = 0; i < count; i++) + { + if (parseMapping(&_glfw.mappings[_glfw.mappingCount], _glfwDefaultMappings[i])) + _glfw.mappingCount++; + } + + for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) + { + _GLFWjoystick* js = _glfw.joysticks + jid; + if (js->connected) + js->mapping = findValidMapping(js); + } +} + // Returns an available joystick object with arrays and name allocated // _GLFWjoystick* _glfwAllocJoystick(const char* name, @@ -421,7 +438,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name, for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { - if (!_glfw.joysticks[jid].present) + if (!_glfw.joysticks[jid].allocated) break; } @@ -429,8 +446,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name, return NULL; js = _glfw.joysticks + jid; - js->present = GLFW_TRUE; - js->name = _glfw_strdup(name); + js->allocated = GLFW_TRUE; js->axes = calloc(axisCount, sizeof(float)); js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1); js->hats = calloc(hatCount, 1); @@ -438,6 +454,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name, js->buttonCount = buttonCount; js->hatCount = hatCount; + strncpy(js->name, name, sizeof(js->name) - 1); strncpy(js->guid, guid, sizeof(js->guid) - 1); js->mapping = findValidMapping(js); @@ -448,7 +465,6 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name, // void _glfwFreeJoystick(_GLFWjoystick* js) { - free(js->name); free(js->axes); free(js->buttons); free(js->hats); @@ -732,9 +748,16 @@ GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot) _GLFWcursor* cursor; assert(image != NULL); + assert(image->pixels != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL); + if (image->width <= 0 || image->height <= 0) + { + _glfwInputError(GLFW_INVALID_VALUE, "Invalid image dimensions for cursor"); + return NULL; + } + cursor = calloc(1, sizeof(_GLFWcursor)); cursor->next = _glfw.cursorListHead; _glfw.cursorListHead = cursor; @@ -926,7 +949,7 @@ GLFWAPI int glfwJoystickPresent(int jid) } js = _glfw.joysticks + jid; - if (!js->present) + if (!js->connected) return GLFW_FALSE; return _glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE); @@ -951,7 +974,7 @@ GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count) } js = _glfw.joysticks + jid; - if (!js->present) + if (!js->connected) return NULL; if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_AXES)) @@ -980,7 +1003,7 @@ GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count) } js = _glfw.joysticks + jid; - if (!js->present) + if (!js->connected) return NULL; if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_BUTTONS)) @@ -1013,7 +1036,7 @@ GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count) } js = _glfw.joysticks + jid; - if (!js->present) + if (!js->connected) return NULL; if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_BUTTONS)) @@ -1039,7 +1062,7 @@ GLFWAPI const char* glfwGetJoystickName(int jid) } js = _glfw.joysticks + jid; - if (!js->present) + if (!js->connected) return NULL; if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE)) @@ -1064,7 +1087,7 @@ GLFWAPI const char* glfwGetJoystickGUID(int jid) } js = _glfw.joysticks + jid; - if (!js->present) + if (!js->connected) return NULL; if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE)) @@ -1083,7 +1106,7 @@ GLFWAPI void glfwSetJoystickUserPointer(int jid, void* pointer) _GLFW_REQUIRE_INIT(); js = _glfw.joysticks + jid; - if (!js->present) + if (!js->allocated) return; js->userPointer = pointer; @@ -1099,7 +1122,7 @@ GLFWAPI void* glfwGetJoystickUserPointer(int jid) _GLFW_REQUIRE_INIT_OR_RETURN(NULL); js = _glfw.joysticks + jid; - if (!js->present) + if (!js->allocated) return NULL; return js->userPointer; @@ -1165,7 +1188,7 @@ GLFWAPI int glfwUpdateGamepadMappings(const char* string) for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { _GLFWjoystick* js = _glfw.joysticks + jid; - if (js->present) + if (js->connected) js->mapping = findValidMapping(js); } @@ -1188,7 +1211,7 @@ GLFWAPI int glfwJoystickIsGamepad(int jid) } js = _glfw.joysticks + jid; - if (!js->present) + if (!js->connected) return GLFW_FALSE; if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE)) @@ -1213,7 +1236,7 @@ GLFWAPI const char* glfwGetGamepadName(int jid) } js = _glfw.joysticks + jid; - if (!js->present) + if (!js->connected) return NULL; if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE)) @@ -1245,7 +1268,7 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state) } js = _glfw.joysticks + jid; - if (!js->present) + if (!js->connected) return GLFW_FALSE; if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_ALL)) @@ -1354,3 +1377,4 @@ GLFWAPI uint64_t glfwGetTimerFrequency(void) _GLFW_REQUIRE_INIT_OR_RETURN(0); return _glfwPlatformGetTimerFrequency(); } + diff --git a/third_party/penumbra/vendor/glfw/src/internal.h b/third_party/penumbra/vendor/glfw/src/internal.h index 92b9497abbd..7734caa3a7b 100644 --- a/third_party/penumbra/vendor/glfw/src/internal.h +++ b/third_party/penumbra/vendor/glfw/src/internal.h @@ -342,9 +342,9 @@ struct _GLFWcontext int robustness; int release; - PFNGLGETSTRINGIPROC GetStringi; + PFNGLGETSTRINGIPROC GetStringi; PFNGLGETINTEGERVPROC GetIntegerv; - PFNGLGETSTRINGPROC GetString; + PFNGLGETSTRINGPROC GetString; _GLFWmakecontextcurrentfun makeCurrent; _GLFWswapbuffersfun swapBuffers; @@ -375,6 +375,7 @@ struct _GLFWwindow GLFWbool focusOnShow; GLFWbool shouldClose; void* userPointer; + GLFWbool doublebuffer; GLFWvidmode videoMode; _GLFWmonitor* monitor; _GLFWcursor* cursor; @@ -396,23 +397,23 @@ struct _GLFWwindow _GLFWcontext context; struct { - GLFWwindowposfun pos; - GLFWwindowsizefun size; - GLFWwindowclosefun close; - GLFWwindowrefreshfun refresh; - GLFWwindowfocusfun focus; - GLFWwindowiconifyfun iconify; - GLFWwindowmaximizefun maximize; - GLFWframebuffersizefun fbsize; + GLFWwindowposfun pos; + GLFWwindowsizefun size; + GLFWwindowclosefun close; + GLFWwindowrefreshfun refresh; + GLFWwindowfocusfun focus; + GLFWwindowiconifyfun iconify; + GLFWwindowmaximizefun maximize; + GLFWframebuffersizefun fbsize; GLFWwindowcontentscalefun scale; - GLFWmousebuttonfun mouseButton; - GLFWcursorposfun cursorPos; - GLFWcursorenterfun cursorEnter; - GLFWscrollfun scroll; - GLFWkeyfun key; - GLFWcharfun character; - GLFWcharmodsfun charmods; - GLFWdropfun drop; + GLFWmousebuttonfun mouseButton; + GLFWcursorposfun cursorPos; + GLFWcursorenterfun cursorEnter; + GLFWscrollfun scroll; + GLFWkeyfun key; + GLFWcharfun character; + GLFWcharmodsfun charmods; + GLFWdropfun drop; } callbacks; // This is defined in the window API's platform.h @@ -423,7 +424,7 @@ struct _GLFWwindow // struct _GLFWmonitor { - char* name; + char name[128]; void* userPointer; // Physical dimensions in millimeters. @@ -477,14 +478,15 @@ struct _GLFWmapping // struct _GLFWjoystick { - GLFWbool present; + GLFWbool allocated; + GLFWbool connected; float* axes; int axisCount; unsigned char* buttons; int buttonCount; unsigned char* hats; int hatCount; - char* name; + char name[128]; void* userPointer; char guid[33]; _GLFWmapping* mapping; @@ -717,7 +719,7 @@ void _glfwInputWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor); void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int mods); void _glfwInputChar(_GLFWwindow* window, - unsigned int codepoint, int mods, GLFWbool plain); + uint32_t codepoint, int mods, GLFWbool plain); void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset); void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods); void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos); @@ -760,6 +762,7 @@ void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size); void _glfwFreeGammaArrays(GLFWgammaramp* ramp); void _glfwSplitBPP(int bpp, int* red, int* green, int* blue); +void _glfwInitGamepadMappings(void); _GLFWjoystick* _glfwAllocJoystick(const char* name, const char* guid, int axisCount, @@ -772,7 +775,12 @@ GLFWbool _glfwInitVulkan(int mode); void _glfwTerminateVulkan(void); const char* _glfwGetVulkanResultString(VkResult result); +size_t _glfwEncodeUTF8(char* s, uint32_t codepoint); +char** _glfwParseUriList(char* text, int* count); + char* _glfw_strdup(const char* source); +int _glfw_min(int a, int b); +int _glfw_max(int a, int b); float _glfw_fminf(float a, float b); float _glfw_fmaxf(float a, float b); diff --git a/third_party/penumbra/vendor/glfw/src/linux_joystick.c b/third_party/penumbra/vendor/glfw/src/linux_joystick.c index 5a3b806c5ec..0894a726354 100644 --- a/third_party/penumbra/vendor/glfw/src/linux_joystick.c +++ b/third_party/penumbra/vendor/glfw/src/linux_joystick.c @@ -128,7 +128,7 @@ static GLFWbool openJoystickDevice(const char* path) { for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { - if (!_glfw.joysticks[jid].present) + if (!_glfw.joysticks[jid].connected) continue; if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0) return GLFW_FALSE; @@ -245,9 +245,9 @@ static GLFWbool openJoystickDevice(const char* path) // static void closeJoystick(_GLFWjoystick* js) { + _glfwInputJoystick(js, GLFW_DISCONNECTED); close(js->linjs.fd); _glfwFreeJoystick(js); - _glfwInputJoystick(js, GLFW_DISCONNECTED); } // Lexically compare joysticks by name; used by qsort @@ -329,7 +329,7 @@ void _glfwTerminateJoysticksLinux(void) for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { _GLFWjoystick* js = _glfw.joysticks + jid; - if (js->present) + if (js->connected) closeJoystick(js); } @@ -424,7 +424,7 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode) handleAbsEvent(js, e.code, e.value); } - return js->present; + return js->connected; } void _glfwPlatformUpdateGamepadGUID(char* guid) diff --git a/third_party/penumbra/vendor/glfw/src/linux_joystick.h b/third_party/penumbra/vendor/glfw/src/linux_joystick.h index 2eabfa134e0..25a2a2eeb1b 100644 --- a/third_party/penumbra/vendor/glfw/src/linux_joystick.h +++ b/third_party/penumbra/vendor/glfw/src/linux_joystick.h @@ -32,6 +32,7 @@ #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE _GLFWlibraryLinux linjs #define _GLFW_PLATFORM_MAPPING_NAME "Linux" +#define GLFW_BUILD_LINUX_MAPPINGS // Linux-specific joystick data // diff --git a/third_party/penumbra/vendor/glfw/src/mappings.h b/third_party/penumbra/vendor/glfw/src/mappings.h index 606824a6257..11853a0ae10 100644 --- a/third_party/penumbra/vendor/glfw/src/mappings.h +++ b/third_party/penumbra/vendor/glfw/src/mappings.h @@ -31,7 +31,7 @@ // all available in SDL_GameControllerDB. Do not edit this file. Any gamepad // mappings not specific to GLFW should be submitted to SDL_GameControllerDB. // This file can be re-generated from mappings.h.in and the upstream -// gamecontrollerdb.txt with the GenerateMappings.cmake script. +// gamecontrollerdb.txt with the 'update_mappings' CMake target. //======================================================================== // All gamepad mappings not labeled GLFW are copied from the @@ -60,95 +60,262 @@ const char* _glfwDefaultMappings[] = { +#if defined(GLFW_BUILD_WIN32_MAPPINGS) "03000000fa2d00000100000000000000,3DRUDDER,leftx:a0,lefty:a1,rightx:a5,righty:a2,platform:Windows,", +"03000000c82d00002038000000000000,8bitdo,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00000951000000000000,8BitDo Dogbone Modkit,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,start:b11,platform:Windows,", +"03000000c82d000011ab000000000000,8BitDo F30,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00001038000000000000,8BitDo F30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a5,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00000090000000000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00000650000000000000,8BitDo M30,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:a4,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,start:b11,x:b3,y:b4,platform:Windows,", +"03000000c82d00005106000000000000,8BitDo M30 Gamepad,a:b1,b:b0,back:b10,guide:b2,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00000151000000000000,8BitDo M30 ModKit,a:b0,b:b1,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,rightshoulder:b6,righttrigger:b7,start:b11,x:b3,y:b4,platform:Windows,", +"03000000c82d00000310000000000000,8BitDo N30,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Windows,", +"03000000c82d00002028000000000000,8BitDo N30,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a5,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00008010000000000000,8BitDo N30,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Windows,", +"03000000c82d00000451000000000000,8BitDo N30 Modkit,a:b1,b:b0,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,start:b11,platform:Windows,", +"03000000c82d00000190000000000000,8BitDo N30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00001590000000000000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a5,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00006528000000000000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,", "03000000022000000090000000000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,", "03000000203800000900000000000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00000360000000000000,8BitDo Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00002867000000000000,8BitDo S30 Modkit,a:b0,b:b1,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b8,lefttrigger:b9,rightshoulder:b6,righttrigger:b7,start:b11,x:b3,y:b4,platform:Windows,", +"03000000c82d00000130000000000000,8BitDo SF30,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a5,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00000060000000000000,8Bitdo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00000061000000000000,8Bitdo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d000021ab000000000000,8BitDo SFC30,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,", "03000000102800000900000000000000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00003028000000000000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00000030000000000000,8BitDo SN30,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00001290000000000000,8BitDo SN30,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d000020ab000000000000,8BitDo SN30,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a5,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00004028000000000000,8BitDo SN30,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a5,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00006228000000000000,8BitDo SN30,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00000351000000000000,8BitDo SN30 Modkit,a:b1,b:b0,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00000160000000000000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00000161000000000000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00000121000000000000,8BitDo SN30 Pro for Android,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", +"03000000c82d00000260000000000000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00000261000000000000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00000031000000000000,8BitDo Wireless Adapter,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", +"03000000c82d00001890000000000000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,", +"03000000c82d00003032000000000000,8BitDo Zero 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Windows,", "03000000a00500003232000000000000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Windows,", -"030000008f0e00001200000000000000,Acme,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Windows,", +"03000000a30c00002700000000000000,Astro City Mini,a:b2,b:b1,back:b8,leftx:a3,lefty:a4,rightshoulder:b4,righttrigger:b5,start:b9,x:b3,y:b0,platform:Windows,", +"03000000a30c00002800000000000000,Astro City Mini,a:b2,b:b1,back:b8,leftx:a3,lefty:a4,rightshoulder:b4,righttrigger:b5,start:b9,x:b3,y:b0,platform:Windows,", +"030000008f0e00001200000000000000,Acme GA-02,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Windows,", +"03000000c01100000355000011010000,ACRUX USB GAME PAD,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"03000000fa190000f0ff000000000000,Acteck AGJ-3200,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"030000006f0e00001413000000000000,Afterglow,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000341a00003608000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000006f0e00000263000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000006f0e00001101000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000006f0e00001401000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000006f0e00001402000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000006f0e00001901000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000006f0e00001a01000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"03000000d62000001d57000000000000,Airflo PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"03000000491900001904000000000000,Amazon Luna Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b7,x:b2,y:b3,platform:Windows,", +"03000000710100001904000000000000,Amazon Luna Controller,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b8,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b4,rightstick:b7,rightx:a3,righty:a4,start:b6,x:b3,y:b2,platform:Windows,", +"03000000ef0500000300000000000000,AxisPad,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,start:b11,x:b0,y:b1,platform:Windows,", +"03000000d6200000e557000000000000,Batarang,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000c01100001352000000000000,Battalife Joystick,a:b6,b:b7,back:b2,leftshoulder:b0,leftx:a0,lefty:a1,rightshoulder:b1,start:b3,x:b4,y:b5,platform:Windows,", -"030000006b1400000055000000000000,bigben ps3padstreetnew,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", +"030000006f0e00003201000000000000,Battlefield 4 PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"03000000d62000002a79000000000000,BDA PS4 Fightpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"03000000bc2000006012000000000000,Betop 2126F,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"03000000bc2000000055000000000000,Betop BFM Gamepad,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", +"03000000bc2000006312000000000000,Betop Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"03000000bc2000006321000000000000,BETOP CONTROLLER,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"03000000bc2000006412000000000000,Betop Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"03000000c01100000555000000000000,Betop Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"03000000c01100000655000000000000,Betop Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"03000000790000000700000000000000,Betop Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,platform:Windows,", +"03000000808300000300000000000000,Betop Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,platform:Windows,", +"030000006b1400000055000000000000,Bigben PS3 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", +"030000006b1400000103000000000000,Bigben PS3 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Windows,", +"03000000120c0000210e000000000000,Brook Mars,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "0300000066f700000500000000000000,BrutalLegendTest,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,platform:Windows,", "03000000d81d00000b00000000000000,BUFFALO BSGP1601 Series ,a:b5,b:b3,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b13,x:b4,y:b2,platform:Windows,", "03000000e82000006058000000000000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", -"030000005e0400008e02000000000000,Controller (XBOX 360 For Windows),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,", +"03000000457500000401000000000000,Cobra,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"030000005e0400008e02000000000000,Controller (XBOX 360 For Windows),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:-a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,", +"030000005e040000a102000000000000,Controller (Xbox 360 Wireless Receiver for Windows),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:-a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,", +"030000005e040000ff02000000000000,Controller (Xbox One For Windows) - Wired,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:-a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,", +"030000005e040000ea02000000000000,Controller (Xbox One For Windows) - Wireless,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:-a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,", "03000000260900008888000000000000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a4,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,platform:Windows,", "03000000a306000022f6000000000000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Windows,", +"03000000451300000830000000000000,Defender Game Racer X7,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", +"030000007d0400000840000000000000,Destroyer Tiltpad,+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b1,b:b2,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,x:b0,y:b3,platform:Windows,", "03000000791d00000103000000000000,Dual Box WII,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", -"030000004f04000023b3000000000000,Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"03000000bd12000002e0000000000000,Dual USB Vibration Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a3,righty:a2,start:b11,x:b3,y:b0,platform:Windows,", +"030000008f0e00000910000000000000,DualShock 2,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a3,righty:a2,start:b11,x:b3,y:b0,platform:Windows,", +"030000006f0e00003001000000000000,EA SPORTS PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"03000000b80500000410000000000000,Elecom Gamepad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b1,platform:Windows,", +"03000000b80500000610000000000000,Elecom Gamepad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b1,platform:Windows,", +"03000000120c0000f61c000000000000,Elite,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"030000008f0e00000f31000000000000,EXEQ,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Windows,", "03000000341a00000108000000000000,EXEQ RF USB Gamepad 8206,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", +"030000006f0e00008401000000000000,Faceoff Deluxe+ Audio Wired Controller for Nintendo Switch,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000006f0e00008001000000000000,Faceoff Wired Pro Controller for Nintendo Switch,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"03000000852100000201000000000000,FF-GP1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00008500000000000000,Fighting Commander 2016 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00008400000000000000,Fighting Commander 5,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", -"030000000d0f00008800000000000000,Fighting Stick mini 4,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,platform:Windows,", "030000000d0f00008700000000000000,Fighting Stick mini 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", +"030000000d0f00008800000000000000,Fighting Stick mini 4,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,platform:Windows,", "030000000d0f00002700000000000000,FIGHTING STICK V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", "78696e70757403000000000000000000,Fightstick TES,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b2,y:b3,platform:Windows,", +"03000000790000002201000000000000,Game Controller for PC,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"0300000066f700000100000000000000,Game VIB Joystick,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,start:b11,x:b0,y:b1,platform:Windows,", "03000000260900002625000000000000,Gamecube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,lefttrigger:a4,leftx:a0,lefty:a1,righttrigger:a5,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Windows,", +"03000000790000004618000000000000,GameCube Controller Adapter,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Windows,", "030000008f0e00000d31000000000000,GAMEPAD 3 TURBO,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000280400000140000000000000,GamePad Pro USB,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", +"03000000ac0500003d03000000000000,GameSir,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", +"03000000ac0500004d04000000000000,GameSir,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", "03000000ffff00000000000000000000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", -"03000000451300000010000000000000,Generic USB Joystick,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", +"03000000c01100000140000000000000,GameStop PS4 Fun Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"030000009b2800003200000000000000,GC/N64 to USB v3.4,a:b0,b:b7,dpdown:b11,dpleft:b12,dpright:b13,dpup:b10,lefttrigger:+a5,leftx:a0,lefty:a1,rightshoulder:b2,righttrigger:+a2,rightx:a3,righty:a4,start:b3,x:b1,y:b8,platform:Windows,", +"030000009b2800006000000000000000,GC/N64 to USB v3.6,a:b0,b:b7,dpdown:b11,dpleft:b12,dpright:b13,dpup:b10,lefttrigger:+a5,leftx:a0,lefty:a1,rightshoulder:b2,righttrigger:+a2,rightx:a3,righty:a4,start:b3,x:b1,y:b8,platform:Windows,", +"030000008305000009a0000000000000,Genius,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", +"030000008305000031b0000000000000,Genius Maxfire Blaze 3,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", +"03000000451300000010000000000000,Genius Maxfire Grandias 12,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", +"030000005c1a00003330000000000000,Genius MaxFire Grandias 12V,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b4,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Windows,", +"03000000300f00000b01000000000000,GGE909 Recoil Pad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,", +"03000000f0250000c283000000000000,Gioteck,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"03000000f025000021c1000000000000,Gioteck PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"03000000f0250000c383000000000000,Gioteck VX2 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"03000000f0250000c483000000000000,Gioteck VX2 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"030000007d0400000540000000000000,Gravis Eliminator GamePad Pro,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", "03000000341a00000302000000000000,Hama Scorpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00004900000000000000,Hatsune Miku Sho Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000001008000001e1000000000000,Havit HV-G60,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b3,y:b0,platform:Windows,", "03000000d81400000862000000000000,HitBox Edition Cthulhu+,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b4,rightshoulder:b7,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,", +"03000000632500002605000000000000,HJD-X,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", +"030000000d0f00002d00000000000000,Hori Fighting Commander 3 Pro,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00005f00000000000000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00005e00000000000000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00004000000000000000,Hori Fighting Stick Mini 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b4,rightshoulder:b7,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,", +"030000000d0f00005400000000000000,Hori Pad 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000000d0f00000900000000000000,Hori Pad 3 Turbo,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000000d0f00004d00000000000000,Hori Pad A,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000000d0f00009200000000000000,Hori Pokken Tournament DX Pro Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", +"030000000d0f00001600000000007803,HORI Real Arcade Pro EX-SE (Xbox 360),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b2,y:b3,platform:Windows,", +"030000000d0f00009c00000000000000,Hori TAC Pro,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"030000000d0f0000c100000000000000,Horipad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00006e00000000000000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00006600000000000000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"030000000d0f00005500000000000000,Horipad 4 FPS,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f0000ee00000000000000,HORIPAD mini4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", -"030000000d0f00004d00000000000000,HORIPAD3 A,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000250900000017000000000000,HRAP2 on PS/SS/N64 Joypad to USB BOX,a:b2,b:b1,back:b9,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b8,x:b3,y:b0,platform:Windows,", "030000008f0e00001330000000000000,HuiJia SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b9,x:b3,y:b0,platform:Windows,", "03000000d81d00000f00000000000000,iBUFFALO BSGP1204 Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", "03000000d81d00001000000000000000,iBUFFALO BSGP1204P Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", "03000000830500006020000000000000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Windows,", -"03000000b50700001403000000000000,IMPACT BLACK,a:b2,b:b3,back:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,", -"030000006f0e00002401000000000000,INJUSTICE FightStick for PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", +"03000000b50700001403000000000000,Impact Black,a:b2,b:b3,back:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,", +"030000006f0e00002401000000000000,INJUSTICE FightStick PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", +"03000000ac0500002c02000000000000,IPEGA,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,leftstick:b13,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b14,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", "03000000491900000204000000000000,Ipega PG-9023,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", +"03000000491900000304000000000000,Ipega PG-9087 - Bluetooth Gamepad,+righty:+a5,-righty:-a4,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,start:b11,x:b3,y:b4,platform:Windows,", +"030000006e0500000a20000000000000,JC-DUX60 ELECOM MMO Gamepad,a:b2,b:b3,back:b17,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,leftstick:b14,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b15,righttrigger:b13,rightx:a3,righty:a4,start:b20,x:b0,y:b1,platform:Windows,", +"030000006e0500000520000000000000,JC-P301U,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b11,x:b0,y:b1,platform:Windows,", +"030000006e0500000320000000000000,JC-U3613M (DInput),a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b11,x:b0,y:b1,platform:Windows,", +"030000006e0500000720000000000000,JC-W01U,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b1,platform:Windows,", +"030000007e0500000620000000000000,Joy-Con (L),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b1,back:b13,leftshoulder:b4,leftstick:b10,rightshoulder:b5,start:b8,x:b2,y:b3,platform:Windows,", +"030000007e0500000620000001000000,Joy-Con (L),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b1,back:b13,leftshoulder:b4,leftstick:b10,rightshoulder:b5,start:b8,x:b2,y:b3,platform:Windows,", +"030000007e0500000720000000000000,Joy-Con (R),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b1,back:b12,leftshoulder:b4,leftstick:b11,rightshoulder:b5,start:b9,x:b2,y:b3,platform:Windows,", +"030000007e0500000720000001000000,Joy-Con (R),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b1,back:b12,leftshoulder:b4,leftstick:b11,rightshoulder:b5,start:b9,x:b2,y:b3,platform:Windows,", +"03000000bd12000003c0000010010000,Joypad Alpha Shock,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"03000000bd12000003c0000000000000,JY-P70UR,a:b1,b:b0,back:b5,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b8,rightstick:b11,righttrigger:b9,rightx:a3,righty:a2,start:b4,x:b3,y:b2,platform:Windows,", +"03000000242f00002d00000000000000,JYS Wireless Adapter,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"03000000242f00008a00000000000000,JYS Wireless Adapter,a:b1,b:b4,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b0,y:b3,platform:Windows,", +"03000000790000000200000000000000,King PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,platform:Windows,", +"030000006d040000d1ca000000000000,Logitech ChillStream,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000006d040000d2ca000000000000,Logitech Cordless Precision,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000006d04000011c2000000000000,Logitech Cordless Wingman,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b5,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b2,righttrigger:b7,rightx:a3,righty:a4,x:b4,platform:Windows,", "030000006d04000016c2000000000000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000006d04000018c2000000000000,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000006d04000019c2000000000000,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000006d0400001ac2000000000000,Logitech Precision Gamepad,a:b1,b:b2,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", +"030000006d0400000ac2000000000000,Logitech WingMan RumblePad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b2,rightx:a3,righty:a4,x:b3,y:b4,platform:Windows,", +"03000000380700006652000000000000,Mad Catz C.T.R.L.R,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700005032000000000000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700005082000000000000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", -"03000000380700008433000000000000,Mad Catz FightStick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", -"03000000380700008483000000000000,Mad Catz FightStick TE S+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b6,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"03000000380700008433000000000000,Mad Catz FightStick TE S+ (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"03000000380700008483000000000000,Mad Catz FightStick TE S+ (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700008134000000000000,Mad Catz FightStick TE2+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b7,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b4,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700008184000000000000,Mad Catz FightStick TE2+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,leftstick:b10,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b4,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"03000000380700006252000000000000,Mad Catz Micro C.T.R.L.R,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700008034000000000000,Mad Catz TE2 PS3 Fightstick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700008084000000000000,Mad Catz TE2 PS4 Fightstick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700008532000000000000,Madcatz Arcade Fightstick TE S PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700003888000000000000,Madcatz Arcade Fightstick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000380700001888000000000000,MadCatz SFIV FightStick PS3,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b4,righttrigger:b6,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", "03000000380700008081000000000000,MADCATZ SFV Arcade FightStick Alpha PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", -"030000008305000031b0000000000000,MaxfireBlaze3,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", +"030000002a0600001024000000000000,Matricom,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b2,y:b3,platform:Windows,", +"030000009f000000adbb000000000000,MaxJoypad Virtual Controller,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,", "03000000250900000128000000000000,Mayflash Arcade Stick,a:b1,b:b2,back:b8,leftshoulder:b0,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b3,righttrigger:b7,start:b9,x:b5,y:b6,platform:Windows,", "03000000790000004418000000000000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Windows,", "03000000790000004318000000000000,Mayflash GameCube Controller Adapter,a:b1,b:b2,back:b0,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b0,leftshoulder:b4,leftstick:b0,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b0,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Windows,", +"03000000242f00007300000000000000,Mayflash Magic NS,a:b1,b:b4,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b0,y:b3,platform:Windows,", +"0300000079000000d218000000000000,Mayflash Magic NS,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"03000000d620000010a7000000000000,Mayflash Magic NS,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000008f0e00001030000000000000,Mayflash USB Adapter for original Sega Saturn controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b5,rightshoulder:b2,righttrigger:b7,start:b9,x:b3,y:b4,platform:Windows,", "0300000025090000e803000000000000,Mayflash Wii Classic Controller,a:b1,b:b0,back:b8,dpdown:b13,dpleft:b12,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Windows,", "03000000790000000018000000000000,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", -"030000001008000001e5000000000000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,platform:Windows,", +"03000000790000002418000000000000,Mega Drive,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,rightshoulder:b2,start:b9,x:b3,y:b4,platform:Windows,", +"03000000380700006382000000000000,MLG GamePad PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"03000000c62400002a89000000000000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", +"03000000c62400002b89000000000000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", +"03000000c62400001a89000000000000,MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", +"03000000c62400001b89000000000000,MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", +"03000000efbe0000edfe000000000000,Monect Virtual Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b0,platform:Windows,", +"03000000250900006688000000000000,MP-8866 Super Dual Box,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,", +"030000006b140000010c000000000000,NACON GC-400ES,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", +"03000000921200004b46000000000000,NES 2-port Adapter,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,start:b11,platform:Windows,", +"03000000790000004518000000000000,NEXILUX GAMECUBE Controller Adapter,platform:Windows,a:b1,b:b0,x:b2,y:b3,start:b9,rightshoulder:b7,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a5,righty:a2,lefttrigger:a3,righttrigger:a4,", +"030000001008000001e5000000000000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,righttrigger:b6,start:b9,x:b3,y:b0,platform:Windows,", +"03000000152000000182000000000000,NGDS,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,platform:Windows,", "03000000bd12000015d0000000000000,Nintendo Retrolink USB Super SNES Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Windows,", "030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", -"030000004b120000014d000000000000,NYKO AIRFLO,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:a3,leftstick:a0,lefttrigger:b6,leftx:h0.6,lefty:h0.12,rightshoulder:b5,rightstick:a2,righttrigger:b7,rightx:h0.9,righty:h0.4,start:b9,x:b2,y:b3,platform:Windows,", +"030000000d0500000308000000000000,Nostromo N45,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b12,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b2,y:b3,platform:Windows,", +"03000000550900001472000000000000,NVIDIA Controller v01.04,a:b11,b:b10,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b7,leftstick:b5,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b4,righttrigger:a5,rightx:a3,righty:a6,start:b3,x:b9,y:b8,platform:Windows,", +"030000004b120000014d000000000000,NYKO AIRFLO,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:a3,leftstick:a0,lefttrigger:b6,rightshoulder:b5,rightstick:a2,righttrigger:b7,start:b9,x:b2,y:b3,platform:Windows,", +"03000000d620000013a7000000000000,NSW wired controller,platform:Windows,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,", +"03000000782300000a10000000000000,Onlive Wireless Controller,a:b15,b:b14,back:b7,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b11,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b13,y:b12,platform:Windows,", +"03000000d62000006d57000000000000,OPP PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000006b14000001a1000000000000,Orange Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b2,y:b3,platform:Windows,", "03000000362800000100000000000000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a3,righty:a4,x:b1,y:b2,platform:Windows,", "03000000120c0000f60e000000000000,P4 Wired Gamepad,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b7,rightshoulder:b4,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,", +"030000006f0e00000901000000000000,PDP Versus Fighting Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", "030000008f0e00000300000000000000,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,", +"030000004c050000da0c000000000000,PlayStation Classic Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,platform:Windows,", +"030000004c0500003713000000000000,PlayStation Vita,a:b1,b:b2,back:b8,dpdown:b13,dpleft:b15,dpright:b14,dpup:b12,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Windows,", "03000000d62000006dca000000000000,PowerA Pro Ex,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", -"030000008f0e00007530000000000000,PS (R) Gamepad,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b1,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"03000000d62000009557000000000000,Pro Elite PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"03000000d62000009f31000000000000,Pro Ex mini PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"03000000d6200000c757000000000000,Pro Ex mini PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"03000000632500002306000000000000,PS Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Windows,", "03000000e30500009605000000000000,PS to USB convert cable,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,", -"03000000100800000100000000000000,PS1 USB,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,", -"03000000100800000300000000000000,PS2 USB,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a4,righty:a2,start:b9,x:b3,y:b0,platform:Windows,", +"03000000100800000100000000000000,PS1 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,", +"030000008f0e00007530000000000000,PS1 Controller,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b1,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"03000000100800000300000000000000,PS2 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a4,righty:a2,start:b9,x:b3,y:b0,platform:Windows,", +"03000000250900008888000000000000,PS2 Controller,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,", +"03000000666600006706000000000000,PS2 Controller,a:b2,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,platform:Windows,", +"030000006b1400000303000000000000,PS2 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", +"030000009d0d00001330000000000000,PS2 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", +"03000000250900000500000000000000,PS3 Controller,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,platform:Windows,", +"030000004c0500006802000000000000,PS3 Controller,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b10,lefttrigger:a3~,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:a4~,rightx:a2,righty:a5,start:b8,x:b3,y:b0,platform:Windows,", +"03000000632500007505000000000000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", "03000000888800000803000000000000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,platform:Windows,", -"030000004c0500006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Windows,", -"03000000250900000500000000000000,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,platform:Windows,", +"030000008f0e00001431000000000000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000003807000056a8000000000000,PS3 RF pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000100000008200000000000000,PS360+ v1.66,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:h0.4,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", "030000004c050000a00b000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "030000004c050000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "030000004c050000cc09000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"030000004c050000e60c000000000000,PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"03000000ff000000cb01000000000000,PSP,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b2,y:b3,platform:Windows,", "03000000300f00000011000000000000,QanBa Arcade JoyStick 1008,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b10,x:b0,y:b3,platform:Windows,", "03000000300f00001611000000000000,QanBa Arcade JoyStick 4018,a:b1,b:b2,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,platform:Windows,", "03000000222c00000020000000000000,QANBA DRONE ARCADE JOYSTICK,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,rightshoulder:b5,righttrigger:a4,start:b9,x:b0,y:b3,platform:Windows,", @@ -157,320 +324,678 @@ const char* _glfwDefaultMappings[] = "03000000222c00000223000000000000,Qanba Obsidian Arcade Joystick PS3 Mode,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000222c00000023000000000000,Qanba Obsidian Arcade Joystick PS4 Mode,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "03000000321500000003000000000000,Razer Hydra,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,", +"03000000321500000204000000000000,Razer Panthera (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"03000000321500000104000000000000,Razer Panthera (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"03000000321500000507000000000000,Razer Raiju Mobile,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", +"03000000321500000707000000000000,Razer Raiju Mobile,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", +"03000000321500000011000000000000,Razer Raion Fightpad for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"03000000321500000009000000000000,Razer Serval,+lefty:+a2,-lefty:-a1,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,leftx:a0,rightshoulder:b5,rightstick:b9,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,", "030000000d0f00001100000000000000,REAL ARCADE PRO.3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", -"030000000d0f00008b00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", -"030000000d0f00008a00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", -"030000000d0f00006b00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00006a00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"030000000d0f00006b00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000000d0f00008a00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"030000000d0f00008b00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00007000000000000000,REAL ARCADE PRO.4 VLX,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00002200000000000000,REAL ARCADE Pro.V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", -"030000000d0f00005c00000000000000,Real Arcade Pro.V4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000000d0f00005b00000000000000,Real Arcade Pro.V4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"030000000d0f00005c00000000000000,Real Arcade Pro.V4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000790000001100000000000000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Windows,", +"03000000bd12000013d0000000000000,Retrolink USB SEGA Saturn Classic,a:b0,b:b1,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b5,lefttrigger:b6,rightshoulder:b2,righttrigger:b7,start:b8,x:b3,y:b4,platform:Windows,", "0300000000f000000300000000000000,RetroUSB.com RetroPad,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Windows,", "0300000000f00000f100000000000000,RetroUSB.com Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Windows,", "030000006b140000010d000000000000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", -"030000006f0e00001e01000000000000,Rock Candy Gamepad for PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000006b140000020d000000000000,Revolution Pro Controller 2(1/2),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"030000006b140000130d000000000000,Revolution Pro Controller 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"030000006f0e00001e01000000000000,Rock Candy PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000006f0e00002801000000000000,Rock Candy PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000006f0e00002f01000000000000,Rock Candy PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "030000004f04000003d0000000000000,run'n'drive,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b7,leftshoulder:a3,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:a4,rightstick:b11,righttrigger:b5,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "03000000a30600001af5000000000000,Saitek Cyborg,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Windows,", "03000000a306000023f6000000000000,Saitek Cyborg V.1 Game pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Windows,", "03000000300f00001201000000000000,Saitek Dual Analog Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,", -"03000000a30600000cff000000000000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,x:b0,y:b1,platform:Windows,", +"03000000a30600000701000000000000,Saitek P220,a:b2,b:b3,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,lefttrigger:b7,rightshoulder:b4,righttrigger:b5,x:b0,y:b1,platform:Windows,", +"03000000a30600000cff000000000000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b0,y:b1,platform:Windows,", "03000000a30600000c04000000000000,Saitek P2900,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,platform:Windows,", "03000000300f00001001000000000000,Saitek P480 Rumble Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,", "03000000a30600000b04000000000000,Saitek P990,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,platform:Windows,", "03000000a30600000b04000000010000,Saitek P990 Dual Analog Pad,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b8,x:b0,y:b3,platform:Windows,", -"03000000300f00001101000000000000,saitek rumble pad,a:b2,b:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,", +"03000000a30600002106000000000000,Saitek PS1000,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Windows,", +"03000000a306000020f6000000000000,Saitek PS2700,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Windows,", +"03000000300f00001101000000000000,Saitek Rumble Pad,a:b2,b:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,", +"03000000730700000401000000000000,Sanwa PlayOnline Mobile,a:b0,b:b1,back:b2,leftx:a0,lefty:a1,start:b3,platform:Windows,", "0300000000050000289b000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,platform:Windows,", "030000009b2800000500000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,platform:Windows,", +"03000000a30c00002500000000000000,Sega Genesis Mini 3B controller,a:b2,b:b1,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,righttrigger:b5,start:b9,platform:Windows,", +"03000000a30c00002400000000000000,Sega Mega Drive Mini 6B controller,a:b2,b:b1,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,rightshoulder:b4,righttrigger:b5,start:b9,x:b3,y:b0,platform:Windows,", "03000000341a00000208000000000000,SL-6555-SBK,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:-a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a3,righty:a2,start:b7,x:b2,y:b3,platform:Windows,", -"030000008f0e00000800000000000000,SpeedLink Strike FX Wireless,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"03000000341a00000908000000000000,SL-6566,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", +"030000008f0e00000800000000000000,SpeedLink Strike FX,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"03000000c01100000591000000000000,Speedlink Torid,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"03000000d11800000094000000000000,Stadia Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b11,rightx:a3,righty:a4,start:b9,x:b2,y:b3,platform:Windows,", +"03000000110100001914000000000000,SteelSeries,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftstick:b13,lefttrigger:b6,leftx:a0,lefty:a1,rightstick:b14,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", +"03000000381000001214000000000000,SteelSeries Free,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Windows,", +"03000000110100003114000000000000,SteelSeries Stratus Duo,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", +"03000000381000001814000000000000,SteelSeries Stratus XL,a:b0,b:b1,back:b18,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b19,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b2,y:b3,platform:Windows,", +"03000000790000001c18000000000000,STK-7024X,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", "03000000ff1100003133000000000000,SVEN X-PAD,a:b2,b:b3,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a2,righty:a4,start:b5,x:b0,y:b1,platform:Windows,", +"03000000d620000011a7000000000000,Switch,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"03000000457500002211000000000000,SZMY-POWER PC Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000004f04000007d0000000000000,T Mini Wireless,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000004f0400000ab1000000000000,T.16000M,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b4,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,start:b10,x:b2,y:b3,platform:Windows,", "03000000fa1900000706000000000000,Team 5,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", "03000000b50700001203000000000000,Techmobility X6-38V,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,", -"030000004f04000015b3000000000000,Thrustmaster Dual Analog 2,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Windows,", +"030000004f04000015b3000000000000,Thrustmaster Dual Analog 4,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Windows,", +"030000004f04000023b3000000000000,Thrustmaster Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"030000004f0400000ed0000000000000,ThrustMaster eSwap PRO Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", "030000004f04000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,platform:Windows,", "030000004f04000004b3000000000000,Thrustmaster Firestorm Dual Power 3,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Windows,", "03000000666600000488000000000000,TigerGame PS/PS2 Game Controller Adapter,a:b2,b:b1,back:b9,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,", +"03000000d62000006000000000000000,Tournament PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"030000005f140000c501000000000000,Trust Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"03000000b80500000210000000000000,Trust Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"030000004f04000087b6000000000000,TWCS Throttle,dpdown:b8,dpleft:b9,dpright:b7,dpup:b6,leftstick:b5,lefttrigger:-a5,leftx:a0,lefty:a1,righttrigger:+a5,platform:Windows,", "03000000d90400000200000000000000,TwinShock PS2,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,", -"03000000380700006652000000000000,UnKnown,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Windows,", +"030000006e0500001320000000000000,U4113,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"03000000101c0000171c000000000000,uRage Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"03000000300f00000701000000000000,USB 4-Axis 12-Button Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,", +"03000000341a00002308000000000000,USB gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", +"030000005509000000b4000000000000,USB gamepad,a:b10,b:b11,back:b5,dpdown:b1,dpleft:b2,dpright:b3,dpup:b0,guide:b14,leftshoulder:b8,leftstick:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b7,righttrigger:a5,rightx:a2,righty:a3,start:b4,x:b12,y:b13,platform:Windows,", +"030000006b1400000203000000000000,USB gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", +"03000000790000000a00000000000000,USB gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,platform:Windows,", +"03000000f0250000c183000000000000,USB gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", +"03000000ff1100004133000000000000,USB gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a4,righty:a2,start:b9,x:b3,y:b0,platform:Windows,", "03000000632500002305000000000000,USB Vibration Joystick (BM),a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", +"03000000790000001a18000000000000,Venom,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,", "03000000790000001b18000000000000,Venom Arcade Joystick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", +"030000006f0e00000302000000000000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", +"030000006f0e00000702000000000000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,", +"0300000034120000adbe000000000000,vJoy Device,a:b0,b:b1,back:b15,dpdown:b6,dpleft:b7,dpright:b8,dpup:b5,guide:b16,leftshoulder:b9,leftstick:b13,lefttrigger:b11,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b14,righttrigger:b12,rightx:a3,righty:a4,start:b4,x:b2,y:b3,platform:Windows,", +"030000005e0400000a0b000000000000,Xbox Adaptive Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:-a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,", +"030000005e040000130b000000000000,Xbox Series Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,", +"03000000341a00000608000000000000,Xeox,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", "03000000450c00002043000000000000,XEOX Gamepad SL-6556-BK,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,", +"03000000ac0500005b05000000000000,Xiaoji Gamesir-G3w,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,", "03000000172700004431000000000000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a7,rightx:a2,righty:a5,start:b11,x:b3,y:b4,platform:Windows,", "03000000786901006e70000000000000,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,", -"03000000203800000900000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,", +"03000000790000004f18000000000000,ZD-T Android,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,", +"03000000120c0000101e000000000000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,", +"78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", +"78696e70757402000000000000000000,XInput Wheel (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", +"78696e70757403000000000000000000,XInput Arcade Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", +"78696e70757404000000000000000000,XInput Flight Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", +"78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", +"78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", +"78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", +#endif // GLFW_BUILD_WIN32_MAPPINGS + +#if defined(GLFW_BUILD_COCOA_MAPPINGS) +"030000008f0e00000300000009010000,2In1 USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Mac OS X,", +"03000000c82d00000090000001000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,", +"03000000c82d00001038000000010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,", +"03000000c82d00000650000001000000,8BitDo M30,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,start:b11,x:b3,y:b4,platform:Mac OS X,", +"03000000c82d00005106000000010000,8BitDo M30 Gamepad,a:b1,b:b0,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,start:b11,x:b4,y:b3,platform:Mac OS X,", +"03000000c82d00001590000001000000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,", +"03000000c82d00006528000000010000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,", +"030000003512000012ab000001000000,8BitDo NES30 Gamepad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,", "03000000022000000090000001000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,", +"03000000203800000900000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,", +"03000000c82d00000190000001000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,", "03000000102800000900000000000000,8Bitdo SFC30 GamePad Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,", +"03000000c82d00001290000001000000,8BitDo SN30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,", +"03000000c82d00004028000000010000,8Bitdo SN30 GamePad,a:b1,b:b0,x:b4,y:b3,back:b10,start:b11,leftshoulder:b6,rightshoulder:b7,dpup:-a1,dpdown:+a1,dpleft:-a0,dpright:+a0,platform:Mac OS X,", +"03000000c82d00000160000001000000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,", +"03000000c82d00000161000000010000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a5,start:b11,x:b4,y:b3,platform:Mac OS X,", +"03000000c82d00000260000001000000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,", +"03000000c82d00000261000000010000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,", +"03000000c82d00000031000001000000,8BitDo Wireless Adapter,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,", +"03000000c82d00001890000001000000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,", +"03000000c82d00003032000000010000,8BitDo Zero 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,rightx:a2,righty:a31,start:b11,x:b4,y:b3,platform:Mac OS X,", "03000000a00500003232000008010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Mac OS X,", +"03000000a00500003232000009010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Mac OS X,", +"03000000a30c00002700000003030000,Astro City Mini,a:b2,b:b1,back:b8,leftx:a3,lefty:a4,rightshoulder:b4,righttrigger:b5,start:b9,x:b3,y:b0,platform:Mac OS X,", +"03000000a30c00002800000003030000,Astro City Mini,a:b2,b:b1,back:b8,leftx:a3,lefty:a4,rightshoulder:b4,righttrigger:b5,start:b9,x:b3,y:b0,platform:Mac OS X,", +"03000000050b00000045000031000000,ASUS Gamepad,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,", +"03000000ef0500000300000000020000,AxisPad,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,start:b11,x:b0,y:b1,platform:Mac OS X,", +"03000000491900001904000001010000,Amazon Luna Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b7,x:b2,y:b3,platform:Mac OS X,", +"03000000710100001904000000010000,Amazon Luna Controller,a:b0,b:b1,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Mac OS X,", +"03000000c62400001a89000000010000,BDA MOGA XP5-X Plus,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b14,leftshoulder:b6,leftstick:b15,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b16,righttrigger:a4,rightx:a2,righty:a3,start:b13,x:b3,y:b4,platform:Mac OS X,", +"03000000c62400001b89000000010000,BDA MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,", +"03000000d62000002a79000000010000,BDA PS4 Fightpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", +"03000000120c0000200e000000010000,Brook Mars,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", +"03000000120c0000210e000000010000,Brook Mars,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000008305000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "03000000260900008888000088020000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,platform:Mac OS X,", "03000000a306000022f6000001030000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Mac OS X,", +"03000000790000004618000000010000,GameCube Controller Adapter,a:b4,b:b0,dpdown:b56,dpleft:b60,dpright:b52,dpup:b48,lefttrigger:a12,leftx:a0,lefty:a4,rightshoulder:b28,righttrigger:a16,rightx:a20,righty:a8,start:b36,x:b8,y:b12,platform:Mac OS X,", "03000000ad1b000001f9000000000000,Gamestop BB-070 X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,", +"03000000c01100000140000000010000,GameStop PS4 Fun Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", +"030000006f0e00000102000000000000,GameStop Xbox 360 Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", +"030000007d0400000540000001010000,Gravis Eliminator GamePad Pro,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X,", +"03000000280400000140000000020000,Gravis Gamepad Pro,a:b1,b:b2,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X,", +"030000008f0e00000300000007010000,GreenAsia Inc. USB Joystick,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Mac OS X,", +"030000000d0f00002d00000000100000,Hori Fighting Commander 3 Pro,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000000d0f00005f00000000010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000000d0f00005e00000000010000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000000d0f00005f00000000000000,HORI Fighting Commander 4 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000000d0f00005e00000000000000,HORI Fighting Commander 4 PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000000d0f00004d00000000000000,HORI Gem Pad 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", +"030000000d0f00009200000000010000,Hori Pokken Tournament DX Pro Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000000d0f00006e00000000010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000000d0f00006600000000010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000000d0f00006600000000000000,HORIPAD FPS PLUS 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", +"030000000d0f0000ee00000000010000,HORIPAD mini4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000008f0e00001330000011010000,HuiJia SNES Controller,a:b4,b:b2,back:b16,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b12,rightshoulder:b14,start:b18,x:b6,y:b0,platform:Mac OS X,", "03000000830500006020000000010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Mac OS X,", "03000000830500006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Mac OS X,", +"030000007e0500000620000001000000,Joy-Con (L),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b1,back:b13,leftshoulder:b4,leftstick:b10,rightshoulder:b5,start:b8,x:b2,y:b3,platform:Mac OS X,", +"030000007e0500000720000001000000,Joy-Con (R),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b1,back:b12,leftshoulder:b4,leftstick:b11,rightshoulder:b5,start:b9,x:b2,y:b3,platform:Mac OS X,", +"03000000242f00002d00000007010000,JYS Wireless Adapter,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Mac OS X,", "030000006d04000016c2000000020000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000006d04000016c2000000030000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000006d04000016c2000014040000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000006d04000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000006d04000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", +"030000006d04000019c2000005030000,Logitech F710,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000006d0400001fc2000000000000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", +"030000006d04000018c2000000010000,Logitech RumblePad 2 USB,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3~,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000006d04000019c2000000000000,Logitech Wireless Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "03000000380700005032000000010000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "03000000380700005082000000010000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", +"03000000380700008433000000010000,Mad Catz FightStick TE S+ (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", +"03000000380700008483000000010000,Mad Catz FightStick TE S+ (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", +"03000000790000000600000007010000,Marvo GT-004,a:b2,b:b1,x:b3,y:b0,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Mac OS X,", "03000000790000004418000000010000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Mac OS X,", +"03000000242f00007300000000020000,Mayflash Magic NS,a:b1,b:b4,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b0,y:b3,platform:Mac OS X,", +"0300000079000000d218000026010000,Mayflash Magic NS,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Mac OS X,", +"03000000d620000010a7000003010000,Mayflash Magic NS,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "0300000025090000e803000000000000,Mayflash Wii Classic Controller,a:b1,b:b0,back:b8,dpdown:b13,dpleft:b12,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Mac OS X,", +"03000000790000000018000000010000,Mayflash Wii U Pro Controller Adapter,a:b4,b:b8,back:b32,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b16,leftstick:b40,lefttrigger:b24,leftx:a0,lefty:a4,rightshoulder:b20,rightstick:b44,righttrigger:b28,rightx:a8,righty:a12,start:b36,x:b0,y:b12,platform:Mac OS X,", "03000000790000000018000000000000,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b4,b:b8,back:b32,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b16,leftstick:b40,lefttrigger:b24,leftx:a0,lefty:a4,rightshoulder:b20,rightstick:b44,righttrigger:b28,rightx:a8,righty:a12,start:b36,x:b0,y:b12,platform:Mac OS X,", "03000000d8140000cecf000000000000,MC Cthulhu,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X,", -"030000001008000001e5000006010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,platform:Mac OS X,", +"030000005e0400002700000001010000,Microsoft SideWinder Plug & Play Game Pad,a:b0,b:b1,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,lefttrigger:b4,leftx:a0,lefty:a1,righttrigger:b5,x:b2,y:b3,platform:Mac OS X,", +"03000000d62000007162000001000000,Moga Pro 2 HID,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Mac OS X,", +"03000000c62400002a89000000010000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b21,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,", +"03000000c62400002b89000000010000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,", +"03000000632500007505000000020000,NEOGEO mini PAD Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,start:b9,x:b2,y:b3,platform:Mac OS X,", +"03000000921200004b46000003020000,NES 2-port Adapter,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,start:b11,platform:Mac OS X,", +"030000001008000001e5000006010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,righttrigger:b6,start:b9,x:b3,y:b0,platform:Mac OS X,", +"03000000d620000011a7000000020000,Nintendo Switch Core (Plus) Wired Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", +"03000000d620000011a7000010050000,Nintendo Switch PowerA Wired Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,", +"030000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,", +"03000000550900001472000025050000,NVIDIA Controller v01.04,a:b0,b:b1,back:b17,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b4,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a5,start:b6,x:b2,y:b3,platform:Mac OS X,", +"030000006f0e00000901000002010000,PDP Versus Fighting Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000008f0e00000300000000000000,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Mac OS X,", -"030000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Mac OS X,", +"030000004c050000da0c000000010000,Playstation Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,platform:Mac OS X,", +"030000004c0500003713000000010000,PlayStation Vita,a:b1,b:b2,back:b8,dpdown:b13,dpleft:b15,dpright:b14,dpup:b12,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Mac OS X,", +"03000000d62000006dca000000010000,PowerA Pro Ex,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", +"03000000100800000300000006010000,PS2 Adapter,a:b2,b:b1,back:b8,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a4,righty:a3,start:b9,x:b3,y:b0,platform:Mac OS X,", "030000004c0500006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Mac OS X,", +"030000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Mac OS X,", "030000004c050000a00b000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", -"030000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000004c050000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", +"030000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", +"050000004c050000e60c000000010000,PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000008916000000fd000000000000,Razer Onza TE,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", +"03000000321500000204000000010000,Razer Panthera (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", +"03000000321500000104000000010000,Razer Panthera (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "03000000321500000010000000010000,Razer RAIJU,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", +"03000000321500000507000001010000,Razer Raiju Mobile,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b21,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,", +"03000000321500000011000000010000,Razer Raion Fightpad for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", +"03000000321500000009000000020000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Mac OS X,", +"030000003215000000090000163a0000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Mac OS X,", "0300000032150000030a000000000000,Razer Wildcat,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", "03000000790000001100000000000000,Retrolink Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a3,lefty:a4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,", "03000000790000001100000006010000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,", "030000006b140000010d000000010000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", +"030000006b140000130d000000010000,Revolution Pro Controller 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", +"03000000c6240000fefa000000000000,Rock Candy Gamepad for PS3,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", +"03000000730700000401000000010000,Sanwa PlayOnline Mobile,a:b0,b:b1,back:b2,leftx:a0,lefty:a1,start:b3,platform:Mac OS X,", "03000000811700007e05000000000000,Sega Saturn,a:b2,b:b4,dpdown:b16,dpleft:b15,dpright:b14,dpup:b17,leftshoulder:b8,lefttrigger:a5,leftx:a0,lefty:a2,rightshoulder:b9,righttrigger:a4,start:b13,x:b0,y:b6,platform:Mac OS X,", "03000000b40400000a01000000000000,Sega Saturn USB Gamepad,a:b0,b:b1,back:b5,guide:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,x:b3,y:b4,platform:Mac OS X,", "030000003512000021ab000000000000,SFC30 Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,", +"0300000000f00000f100000000000000,SNES RetroPort,a:b2,b:b3,back:b4,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b5,rightshoulder:b7,start:b6,x:b0,y:b1,platform:Mac OS X,", +"030000004c050000e60c000000010000,Sony DualSense,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000004c050000cc09000000000000,Sony DualShock 4 V2,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000004c050000a00b000000000000,Sony DualShock 4 Wireless Adaptor,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", -"030000005e0400008e02000001000000,Steam Virtual GamePad,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", +"03000000d11800000094000000010000,Stadia Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Mac OS X,", +"030000005e0400008e02000001000000,Steam Virtual Gamepad,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", "03000000110100002014000000000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,platform:Mac OS X,", "03000000110100002014000001000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,x:b2,y:b3,platform:Mac OS X,", "03000000381000002014000001000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,x:b2,y:b3,platform:Mac OS X,", +"050000004e696d6275732b0000000000,SteelSeries Nimbus Plus,a:b0,b:b1,back:b15,dpdown:b11,dpleft:b13,dpright:b12,dpup:b10,guide:b16,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3~,start:b14,x:b2,y:b3,platform:Mac OS X,", "03000000110100001714000000000000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,platform:Mac OS X,", "03000000110100001714000020010000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,platform:Mac OS X,", +"03000000457500002211000000010000,SZMY-POWER PC Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000004f04000015b3000000000000,Thrustmaster Dual Analog 3.2,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Mac OS X,", +"030000004f0400000ed0000000020000,ThrustMaster eSwap PRO Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "030000004f04000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,platform:Mac OS X,", -"03000000bd12000015d0000000010000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,", "03000000bd12000015d0000000000000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,", +"03000000bd12000015d0000000010000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,", "03000000100800000100000000000000,Twin USB Joystick,a:b4,b:b2,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b12,leftstick:b20,lefttrigger:b8,leftx:a0,lefty:a2,rightshoulder:b14,rightstick:b22,righttrigger:b10,rightx:a6,righty:a4,start:b18,x:b6,y:b0,platform:Mac OS X,", +"030000006f0e00000302000025040000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X,", +"030000006f0e00000702000003060000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X,", +"03000000791d00000103000009010000,Wii Classic Controller,a:b2,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b10,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Mac OS X,", "050000005769696d6f74652028303000,Wii Remote,a:b4,b:b5,back:b7,dpdown:b3,dpleft:b0,dpright:b1,dpup:b2,guide:b8,leftshoulder:b11,lefttrigger:b12,leftx:a0,lefty:a1,start:b6,x:b10,y:b9,platform:Mac OS X,", "050000005769696d6f74652028313800,Wii U Pro Controller,a:b16,b:b15,back:b7,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b8,leftshoulder:b19,leftstick:b23,lefttrigger:b21,leftx:a0,lefty:a1,rightshoulder:b20,rightstick:b24,righttrigger:b22,rightx:a2,righty:a3,start:b6,x:b18,y:b17,platform:Mac OS X,", "030000005e0400008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", +"030000006f0e00000104000000000000,Xbox 360 Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", "03000000c6240000045d000000000000,Xbox 360 Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", -"030000005e040000e302000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", +"030000005e0400000a0b000000000000,Xbox Adaptive Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", +"030000005e040000050b000003090000,Xbox Elite Wireless Controller Series 2,a:b0,b:b1,back:b31,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b53,leftshoulder:b6,leftstick:b13,lefttrigger:a6,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,", +"03000000c62400003a54000000000000,Xbox One PowerA Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", "030000005e040000d102000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", "030000005e040000dd02000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", +"030000005e040000e302000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", +"030000005e040000130b000001050000,Xbox Series Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,", +"030000005e040000130b000005050000,Xbox Series Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,", "030000005e040000e002000000000000,Xbox Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Mac OS X,", -"030000005e040000fd02000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,", -"030000005e040000ea02000000000000,Xbox Wireless Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", "030000005e040000e002000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Mac OS X,", +"030000005e040000ea02000000000000,Xbox Wireless Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,", +"030000005e040000fd02000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,", "03000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,platform:Mac OS X,", "03000000120c0000100e000000010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", -"05000000203800000900000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", +"03000000120c0000101e000000010000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", +#endif // GLFW_BUILD_COCOA_MAPPINGS + +#if defined(GLFW_BUILD_LINUX_MAPPINGS) +"03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", +"05000000c82d00001038000000010000,8Bitdo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", +"05000000c82d00005106000000010000,8BitDo M30,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,start:b11,x:b3,y:b4,platform:Linux,", +"03000000c82d00001590000011010000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", +"05000000c82d00006528000000010000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", +"03000000c82d00000310000011010000,8BitDo NES30,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b7,lefttrigger:b6,rightshoulder:b9,righttrigger:b8,start:b11,x:b3,y:b4,platform:Linux,", +"05000000c82d00008010000000010000,8BitDo NES30,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b7,lefttrigger:b6,rightshoulder:b9,righttrigger:b8,start:b11,x:b3,y:b4,platform:Linux,", "03000000022000000090000011010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", +"05000000203800000900000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", "05000000c82d00002038000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", "03000000c82d00000190000011010000,8Bitdo NES30 Pro 8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", -"05000000c82d00003028000000010000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Linux,", +"05000000c82d00000060000000010000,8BitDo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", +"05000000c82d00000061000000010000,8Bitdo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", +"03000000c82d000021ab000010010000,8BitDo SFC30,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Linux,", +"030000003512000012ab000010010000,8Bitdo SFC30 GamePad,a:b2,b:b1,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b0,platform:Linux,", "05000000102800000900000000010000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Linux,", -"05000000a00500003232000008010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Linux,", +"05000000c82d00003028000000010000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Linux,", +"03000000c82d00000160000000000000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Linux,", +"03000000c82d00000160000011010000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", +"03000000c82d00000161000000000000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Linux,", +"03000000c82d00001290000011010000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Linux,", +"05000000c82d00000161000000010000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", +"05000000c82d00006228000000010000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", +"03000000c82d00000260000011010000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", +"05000000c82d00000261000000010000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", +"05000000202800000900000000010000,8BitDo SNES30 Gamepad,a:b1,b:b0,back:b10,dpdown:b122,dpleft:b119,dpright:b120,dpup:b117,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Linux,", +"03000000c82d00000031000011010000,8BitDo Wireless Adapter (DInput),a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"030000005e0400008e02000020010000,8BitDo Wireless Adapter (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"03000000c82d00001890000011010000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Linux,", +"05000000c82d00003032000000010000,8BitDo Zero 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", +"050000005e040000e002000030110000,8BitDo Zero 2 (XInput),a:b0,b:b1,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b2,y:b3,platform:Linux,", "05000000a00500003232000001000000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Linux,", -"030000006f0e00003901000020060000,Afterglow Wired Controller for Xbox One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"05000000a00500003232000008010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Linux,", +"03000000c01100000355000011010000,ACRUX USB GAME PAD,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", +"030000006f0e00001302000000010000,Afterglow,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000006f0e00003901000020060000,Afterglow Controller for Xbox One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000006f0e00003901000000430000,Afterglow Prismatic Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000006f0e00003901000013020000,Afterglow Prismatic Wired Controller 048-007-NA,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000100000008200000011010000,Akishop Customs PS360+ v1.66,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,", +"030000007c1800000006000010010000,Alienware Dual Compatible Game Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,platform:Linux,", +"05000000491900000204000021000000,Amazon Fire Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b17,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b12,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"03000000491900001904000011010000,Amazon Luna Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b7,x:b2,y:b3,platform:Linux,", +"05000000710100001904000000010000,Amazon Luna Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b11,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Linux,", +"03000000790000003018000011010000,Arcade Fightstick F300,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,", +"03000000a30c00002700000011010000,Astro City Mini,a:b2,b:b1,back:b8,leftx:a0,lefty:a1,rightshoulder:b4,righttrigger:b5,start:b9,x:b3,y:b0,platform:Linux,", +"03000000a30c00002800000011010000,Astro City Mini,a:b2,b:b1,back:b8,leftx:a0,lefty:a1,rightshoulder:b4,righttrigger:b5,start:b9,x:b3,y:b0,platform:Linux,", "05000000050b00000045000031000000,ASUS Gamepad,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b10,x:b2,y:b3,platform:Linux,", +"05000000050b00000045000040000000,ASUS Gamepad,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b10,x:b2,y:b3,platform:Linux,", +"03000000503200000110000000000000,Atari Classic Controller,a:b0,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,x:b1,platform:Linux,", +"05000000503200000110000000000000,Atari Classic Controller,a:b0,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,x:b1,platform:Linux,", +"03000000503200000210000000000000,Atari Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,platform:Linux,", +"05000000503200000210000000000000,Atari Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,platform:Linux,", +"03000000120c00000500000010010000,AxisPad,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,start:b11,x:b0,y:b1,platform:Linux,", +"03000000ef0500000300000000010000,AxisPad,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,start:b11,x:b0,y:b1,platform:Linux,", +"03000000c62400001b89000011010000,BDA MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"03000000d62000002a79000011010000,BDA PS4 Fightpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"03000000c21100000791000011010000,Be1 GC101 Controller 1.03 mode,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", +"03000000c31100000791000011010000,Be1 GC101 GAMEPAD 1.03 mode,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"030000005e0400008e02000003030000,Be1 GC101 Xbox 360 Controller mode,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"05000000bc2000000055000001000000,BETOP AX1 BFM,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", "03000000666600006706000000010000,boom PSX to PC Converter,a:b2,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,platform:Linux,", +"03000000120c0000200e000011010000,Brook Mars,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"03000000120c0000210e000011010000,Brook Mars,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", +"03000000120c0000f70e000011010000,Brook Universal Fighting Board,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,", +"03000000ffff0000ffff000000010000,Chinese-made Xbox Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,platform:Linux,", "03000000e82000006058000001010000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", +"030000000b0400003365000000010000,Competition Pro,a:b0,b:b1,back:b2,leftx:a0,lefty:a1,start:b3,platform:Linux,", "03000000260900008888000000010000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,platform:Linux,", "03000000a306000022f6000011010000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Linux,", "03000000b40400000a01000000010000,CYPRESS USB Gamepad,a:b0,b:b1,back:b5,guide:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,x:b3,y:b4,platform:Linux,", "03000000790000000600000010010000,DragonRise Inc. Generic USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,platform:Linux,", +"030000004f04000004b3000010010000,Dual Power 2,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Linux,", "030000006f0e00003001000001010000,EA Sports PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "03000000341a000005f7000010010000,GameCube {HuiJia USB box},a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Linux,", +"03000000bc2000000055000011010000,GameSir G3w,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", "030000006f0e00000104000000010000,Gamestop Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", -"030000006f0e00001304000000010000,Generic X-Box pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:a0,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:a3,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", -"030000006f0e00001f01000000010000,Generic X-Box pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000008f0e00000800000010010000,Gasia Co. Ltd PS(R) Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", +"030000006f0e00001304000000010000,Generic X-Box pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"03000000451300000010000010010000,Genius Maxfire Grandias 12,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", "03000000f0250000c183000010010000,Goodbetterbest Ltd USB Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", +"0300000079000000d418000000010000,GPD Win 2 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000007d0400000540000000010000,Gravis Eliminator GamePad Pro,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,", "03000000280400000140000000010000,Gravis GamePad Pro USB ,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,", "030000008f0e00000610000000010000,GreenAsia Electronics 4Axes 12Keys GamePad ,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a3,righty:a2,start:b11,x:b3,y:b0,platform:Linux,", "030000008f0e00001200000010010000,GreenAsia Inc. USB Joystick,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Linux,", -"030000008f0e00000300000010010000,GreenAsia Inc. USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,", "0500000047532067616d657061640000,GS gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", +"03000000f0250000c383000010010000,GT VX2,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", "06000000adde0000efbe000002010000,Hidromancer Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000d81400000862000011010000,HitBox (PS3/PC) Analog Mode,a:b1,b:b2,back:b8,guide:b9,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b12,x:b0,y:b3,platform:Linux,", "03000000c9110000f055000011010000,HJC Game GAMEPAD,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", +"03000000632500002605000010010000,HJD-X,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", "030000000d0f00000d00000000010000,hori,a:b0,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b3,leftx:b4,lefty:b5,rightshoulder:b7,start:b9,x:b1,y:b2,platform:Linux,", "030000000d0f00001000000011010000,HORI CO. LTD. FIGHTING STICK 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,", +"030000000d0f0000c100000011010000,HORI CO. LTD. HORIPAD S,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b13,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000000d0f00006a00000011010000,HORI CO. LTD. Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "030000000d0f00006b00000011010000,HORI CO. LTD. Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000000d0f00002200000011010000,HORI CO. LTD. REAL ARCADE Pro.V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,", +"030000000d0f00008500000010010000,HORI Fighting Commander,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", +"030000000d0f00008600000002010000,Hori Fighting Commander,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", "030000000d0f00005f00000011010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000000d0f00005e00000011010000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "03000000ad1b000001f5000033050000,Hori Pad EX Turbo 2,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000000d0f00009200000011010000,Hori Pokken Tournament DX Pro Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,", +"030000000d0f0000aa00000011010000,HORI Real Arcade Pro,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", +"030000000d0f0000d800000072056800,HORI Real Arcade Pro S,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Linux,", +"030000000d0f00001600000000010000,Hori Real Arcade Pro.EX-SE (Xbox 360),a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b2,y:b3,platform:Linux,", "030000000d0f00006e00000011010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000000d0f00006600000011010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"030000000d0f0000ee00000011010000,HORIPAD mini4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "030000000d0f00006700000001010000,HORIPAD ONE,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000008f0e00001330000010010000,HuiJia SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b9,x:b3,y:b0,platform:Linux,", +"03000000242e00008816000001010000,Hyperkin X91,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000830500006020000010010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Linux,", "050000006964726f69643a636f6e0000,idroid:con,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "03000000b50700001503000010010000,impact,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Linux,", +"03000000d80400008200000003000000,IMS PCU#0 Gamepad Interface,a:b1,b:b0,back:b4,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,start:b5,x:b3,y:b2,platform:Linux,", "03000000fd0500000030000000010000,InterAct GoPad I-73000 (Fighting Game Layout),a:b3,b:b4,back:b6,leftx:a0,lefty:a1,rightshoulder:b2,righttrigger:b5,start:b7,x:b0,y:b1,platform:Linux,", +"0500000049190000020400001b010000,Ipega PG-9069 - Bluetooth Gamepad,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b161,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"03000000632500007505000011010000,Ipega PG-9099 - Bluetooth Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", "030000006e0500000320000010010000,JC-U3613M - DirectInput Mode,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b11,x:b0,y:b1,platform:Linux,", "03000000300f00001001000010010000,Jess Tech Dual Analog Rumble Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Linux,", +"03000000300f00000b01000010010000,Jess Tech GGE909 PC Recoil Pad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,", "03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,", +"030000007e0500000620000001000000,Joy-Con (L),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b1,back:b13,leftshoulder:b4,leftstick:b10,rightshoulder:b5,start:b8,x:b2,y:b3,platform:Linux,", +"050000007e0500000620000001000000,Joy-Con (L),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b1,back:b13,leftshoulder:b4,leftstick:b10,rightshoulder:b5,start:b8,x:b2,y:b3,platform:Linux,", +"030000007e0500000720000001000000,Joy-Con (R),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b1,back:b12,leftshoulder:b4,leftstick:b11,rightshoulder:b5,start:b9,x:b2,y:b3,platform:Linux,", +"050000007e0500000720000001000000,Joy-Con (R),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b1,back:b12,leftshoulder:b4,leftstick:b11,rightshoulder:b5,start:b9,x:b2,y:b3,platform:Linux,", +"03000000bd12000003c0000010010000,Joypad Alpha Shock,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", +"03000000242f00002d00000011010000,JYS Wireless Adapter,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", +"03000000242f00008a00000011010000,JYS Wireless Adapter,a:b1,b:b4,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b0,y:b3,platform:Linux,", "030000006f0e00000103000000020000,Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000006d040000d1ca000000000000,Logitech ChillStream,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", -"030000006d04000016c2000011010000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000006d04000016c2000010010000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", +"030000006d04000016c2000011010000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000006d0400001ec2000019200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", -"030000006d04000015c2000010010000,Logitech Logitech Extreme 3D,a:b0,b:b4,back:b6,guide:b8,leftshoulder:b9,leftstick:h0.8,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:h0.2,start:b7,x:b2,y:b5,platform:Linux,", +"030000006d0400000ac2000010010000,Logitech Inc. WingMan RumblePad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b2,rightx:a3,righty:a4,x:b3,y:b4,platform:Linux,", "030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000006d04000011c2000010010000,Logitech WingMan Cordless RumblePad,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b6,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b10,rightx:a3,righty:a4,start:b8,x:b3,y:b4,platform:Linux,", +"050000004d4f435554452d3035305800,M54-PC,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", "05000000380700006652000025010000,Mad Catz C.T.R.L.R ,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "03000000380700005032000011010000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "03000000380700005082000011010000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "03000000ad1b00002ef0000090040000,Mad Catz Fightpad SFxT,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b2,y:b3,platform:Linux,", "03000000380700008034000011010000,Mad Catz fightstick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "03000000380700008084000011010000,Mad Catz fightstick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", -"03000000380700008433000011010000,Mad Catz FightStick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", -"03000000380700008483000011010000,Mad Catz FightStick TE S+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"03000000380700008433000011010000,Mad Catz FightStick TE S+ (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", +"03000000380700008483000011010000,Mad Catz FightStick TE S+ (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "03000000380700001647000010040000,Mad Catz Wired Xbox 360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000380700003847000090040000,Mad Catz Wired Xbox 360 Controller (SFIV),a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", "03000000ad1b000016f0000090040000,Mad Catz Xbox 360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000380700001888000010010000,MadCatz PC USB Wired Stick 8818,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "03000000380700003888000010010000,MadCatz PC USB Wired Stick 8838,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:a0,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", -"03000000790000004418000010010000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Linux,", +"03000000242f0000f700000001010000,Magic-S Pro,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"03000000120c00000500000000010000,Manta Dualshock 2,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Linux,", +"03000000790000004418000010010000,Mayflash GameCube Controller,a:b1,b:b0,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b2,y:b3,platform:Linux,", +"03000000790000004318000010010000,Mayflash GameCube Controller Adapter,a:b1,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Linux,", +"03000000242f00007300000011010000,Mayflash Magic NS,a:b1,b:b4,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b0,y:b3,platform:Linux,", +"0300000079000000d218000011010000,Mayflash Magic NS,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", +"03000000d620000010a7000011010000,Mayflash Magic NS,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", +"0300000025090000e803000001010000,Mayflash Wii Classic Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:a4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:a5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Linux,", "03000000780000000600000010010000,Microntek USB Joystick,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,platform:Linux,", +"030000005e0400000e00000000010000,Microsoft SideWinder,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,rightshoulder:b7,start:b8,x:b3,y:b4,platform:Linux,", "030000005e0400008e02000004010000,Microsoft X-Box 360 pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000005e0400008e02000062230000,Microsoft X-Box 360 pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"050000005e040000050b000003090000,Microsoft X-Box One Elite 2 pad,a:b0,b:b1,back:b17,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a6,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"030000005e040000e302000003020000,Microsoft X-Box One Elite pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000005e040000d102000001010000,Microsoft X-Box One pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000005e040000dd02000003020000,Microsoft X-Box One pad (Firmware 2015),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000005e040000d102000003020000,Microsoft X-Box One pad v2,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000005e0400008502000000010000,Microsoft X-Box pad (Japan),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,platform:Linux,", "030000005e0400008902000021010000,Microsoft X-Box pad v2 (US),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,platform:Linux,", +"030000005e040000000b000008040000,Microsoft Xbox One Elite 2 pad - Wired,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000005e040000ea02000008040000,Microsoft Xbox One S pad - Wired,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"03000000c62400001a53000000010000,Mini PE,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"03000000030000000300000002000000,Miroof,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Linux,", +"05000000d6200000e589000001000000,Moga 2 HID,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Linux,", "05000000d6200000ad0d000001000000,Moga Pro,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Linux,", -"030000001008000001e5000010010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,platform:Linux,", +"05000000d62000007162000001000000,Moga Pro 2 HID,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Linux,", +"03000000c62400002b89000011010000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"05000000c62400002a89000000010000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b22,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"05000000c62400001a89000000010000,MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"03000000250900006688000000010000,MP-8866 Super Dual Box,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Linux,", +"030000006b140000010c000010010000,NACON GC-400ES,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", +"030000000d0f00000900000010010000,Natec Genesis P44,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", +"03000000790000004518000010010000,NEXILUX GAMECUBE Controller Adapter,a:b1,b:b0,x:b2,y:b3,start:b9,rightshoulder:b7,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a5,righty:a2,lefttrigger:a3,righttrigger:a4,platform:Linux,", +"030000001008000001e5000010010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,righttrigger:b6,start:b9,x:b3,y:b0,platform:Linux,", +"060000007e0500003713000000000000,Nintendo 3DS,a:b0,b:b1,back:b8,dpdown:b11,dpleft:b12,dpright:b13,dpup:b10,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Linux,", +"060000007e0500000820000000000000,Nintendo Combined Joy-Cons (joycond),a:b0,b:b1,back:b9,dpdown:b15,dpleft:b16,dpright:b17,dpup:b14,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,platform:Linux,", +"030000007e0500003703000000016800,Nintendo GameCube Controller,a:b0,b:b2,dpdown:b6,dpleft:b4,dpright:b5,dpup:b7,lefttrigger:a4,leftx:a0,lefty:a1~,rightshoulder:b9,righttrigger:a5,rightx:a2,righty:a3~,start:b8,x:b1,y:b3,platform:Linux,", +"03000000790000004618000010010000,Nintendo GameCube Controller Adapter,a:b1,b:b0,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,rightx:a5~,righty:a2~,start:b9,x:b2,y:b3,platform:Linux,", +"050000007e0500000620000001800000,Nintendo Switch Left Joy-Con,a:b9,b:b8,back:b5,leftshoulder:b2,leftstick:b6,leftx:a1,lefty:a0~,rightshoulder:b4,start:b0,x:b7,y:b10,platform:Linux,", +"030000007e0500000920000011810000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,platform:Linux,", "050000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", +"050000007e0500000920000001800000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,platform:Linux,", +"050000007e0500000720000001800000,Nintendo Switch Right Joy-Con,a:b1,b:b2,back:b9,leftshoulder:b4,leftstick:b10,leftx:a1~,lefty:a0~,rightshoulder:b6,start:b8,x:b0,y:b3,platform:Linux,", +"050000007e0500001720000001000000,Nintendo Switch SNES Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b2,y:b3,platform:Linux,", "050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Linux,", "05000000010000000100000003000000,Nintendo Wiimote,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", "030000000d0500000308000010010000,Nostromo n45 Dual Analog Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b12,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b2,y:b3,platform:Linux,", "03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b13,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,", +"03000000550900001472000011010000,NVIDIA Controller v01.04,a:b0,b:b1,back:b14,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b16,leftshoulder:b4,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a5,start:b6,x:b2,y:b3,platform:Linux,", +"05000000550900001472000001000000,NVIDIA Controller v01.04,a:b0,b:b1,back:b14,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b16,leftshoulder:b4,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a5,start:b6,x:b2,y:b3,platform:Linux,", "03000000451300000830000010010000,NYKO CORE,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"19000000010000000100000001010000,odroidgo2_joypad,a:b1,b:b0,dpdown:b7,dpleft:b8,dpright:b9,dpup:b6,guide:b10,leftshoulder:b4,leftstick:b12,lefttrigger:b11,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b13,righttrigger:b14,start:b15,x:b2,y:b3,platform:Linux,", +"19000000010000000200000011000000,odroidgo2_joypad_v11,a:b1,b:b0,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b12,leftshoulder:b4,leftstick:b14,lefttrigger:b13,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b15,righttrigger:b16,start:b17,x:b2,y:b3,platform:Linux,", "030000005e0400000202000000010000,Old Xbox pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,platform:Linux,", +"03000000c0160000dc27000001010000,OnyxSoft Dual JoyDivision,a:b0,b:b1,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b6,x:b2,y:b3,platform:Linux,", "05000000362800000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,platform:Linux,", "05000000362800000100000003010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,platform:Linux,", +"03000000830500005020000010010000,Padix Co. Ltd. Rockfire PSX/USB Bridge,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b11,x:b2,y:b3,platform:Linux,", +"03000000790000001c18000011010000,PC Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", "03000000ff1100003133000010010000,PC Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", +"030000006f0e0000b802000001010000,PDP AFTERGLOW Wired Xbox One Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000006f0e0000b802000013020000,PDP AFTERGLOW Wired Xbox One Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000006f0e00006401000001010000,PDP Battlefield One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000006f0e00008001000011010000,PDP CO. LTD. Faceoff Wired Pro Controller for Nintendo Switch,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", +"030000006f0e00003101000000010000,PDP EA Sports Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000006f0e0000c802000012010000,PDP Kingdom Hearts Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000006f0e00008701000011010000,PDP Rock Candy Wired Controller for Nintendo Switch,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b13,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", +"030000006f0e00000901000011010000,PDP Versus Fighting Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,", +"030000006f0e0000a802000023020000,PDP Wired Controller for Xbox One,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", +"030000006f0e00008501000011010000,PDP Wired Fight Pad Pro for Nintendo Switch,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", +"0500000049190000030400001b010000,PG-9099,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"05000000491900000204000000000000,PG-9118,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"030000004c050000da0c000011010000,Playstation Controller,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,platform:Linux,", +"030000004c0500003713000011010000,PlayStation Vita,a:b1,b:b2,back:b8,dpdown:b13,dpleft:b15,dpright:b14,dpup:b12,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Linux,", +"03000000c62400000053000000010000,PowerA,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"03000000c62400003a54000001010000,PowerA 1428124-01,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"03000000d62000006dca000011010000,PowerA Pro Ex,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", +"03000000d62000000228000001010000,PowerA Wired Controller for Xbox One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"03000000c62400001a58000001010000,PowerA Xbox One Cabled,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"03000000c62400001a54000001010000,PowerA Xbox One Mini Wired Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000006d040000d2ca000011010000,Precision Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "03000000ff1100004133000010010000,PS2 Controller,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,platform:Linux,", -"030000004c0500006802000010010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,", -"050000004c0500006802000000810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", "03000000341a00003608000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", -"030000004c0500006802000011810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", -"050000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:a12,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:a13,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,", +"030000004c0500006802000010010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,", "030000004c0500006802000010810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", "030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,", -"060000004c0500006802000000010000,PS3 Controller (Bluetooth),a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,", -"05000000504c415953544154494f4e00,PS3 Controller (Bluetooth),a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,", -"050000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"030000004c0500006802000011810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", +"030000006f0e00001402000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", +"030000008f0e00000300000010010000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", +"050000004c0500006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,", +"050000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:a12,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:a13,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,", +"050000004c0500006802000000800000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", +"050000004c0500006802000000810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", +"05000000504c415953544154494f4e00,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,", +"060000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,", "030000004c050000a00b000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", -"050000004c050000cc09000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", -"050000004c050000c405000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", +"030000004c050000a00b000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", +"030000004c050000c405000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "030000004c050000c405000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", -"050000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"030000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "030000004c050000cc09000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", -"030000004c050000a00b000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", "030000004c050000cc09000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", -"030000004c050000c405000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"03000000c01100000140000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"050000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"050000004c050000c405000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", +"050000004c050000c405000001800000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", +"050000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"050000004c050000cc09000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", +"050000004c050000cc09000001800000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", +"030000004c050000e60c000011010000,PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"050000004c050000e60c000000010000,PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"03000000ff000000cb01000010010000,PSP,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b2,y:b3,platform:Linux,", "03000000300f00001211000011010000,QanBa Arcade JoyStick,a:b2,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b9,x:b1,y:b3,platform:Linux,", +"030000009b2800004200000001010000,Raphnet Technologies Dual NES to USB v2.0,a:b0,b:b1,back:b2,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,start:b3,platform:Linux,", +"030000009b2800003200000001010000,Raphnet Technologies GC/N64 to USB v3.4,a:b0,b:b7,dpdown:b11,dpleft:b12,dpright:b13,dpup:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b2,righttrigger:b5,rightx:a3,righty:a4,start:b3,x:b1,y:b8,platform:Linux,", +"030000009b2800006000000001010000,Raphnet Technologies GC/N64 to USB v3.6,a:b0,b:b7,dpdown:b11,dpleft:b12,dpright:b13,dpup:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b2,righttrigger:b5,rightx:a3,righty:a4,start:b3,x:b1,y:b8,platform:Linux,", "030000009b2800000300000001010000,raphnet.net 4nes4snes v1.5,a:b0,b:b4,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b1,y:b5,platform:Linux,", "030000008916000001fd000024010000,Razer Onza Classic Edition,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", -"030000008916000000fd000024010000,Razer Onza Tournament,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000008916000000fd000024010000,Razer Onza Tournament Edition,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"03000000321500000204000011010000,Razer Panthera (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", +"03000000321500000104000011010000,Razer Panthera (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"03000000321500000810000011010000,Razer Panthera Evo Arcade Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b13,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "03000000321500000010000011010000,Razer RAIJU,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"03000000321500000507000000010000,Razer Raiju Mobile,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b21,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"03000000321500000011000011010000,Razer Raion Fightpad for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"030000008916000000fe000024010000,Razer Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"03000000c6240000045d000024010000,Razer Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000c6240000045d000025010000,Razer Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000321500000009000011010000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,", "050000003215000000090000163a0000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,", "0300000032150000030a000001010000,Razer Wildcat,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000790000001100000010010000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Linux,", -"0300000000f000000300000000010000,RetroUSB.com RetroPad,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Linux,", -"0300000000f00000f100000000010000,RetroUSB.com Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Linux,", +"0300000081170000990a000001010000,Retronic Adapter,a:b0,leftx:a0,lefty:a1,platform:Linux,", +"0300000000f000000300000000010000,RetroPad,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Linux,", "030000006b140000010d000011010000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", -"030000006f0e00001e01000011010000,Rock Candy Gamepad for PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", -"030000006f0e00004601000001010000,Rock Candy Wired Controller for Xbox One,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000006b140000130d000011010000,Revolution Pro Controller 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"030000006f0e00001f01000000010000,Rock Candy,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000006f0e00001e01000011010000,Rock Candy PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", +"030000006f0e00004601000001010000,Rock Candy Xbox One Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000a306000023f6000011010000,Saitek Cyborg V.1 Game Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Linux,", -"03000000a30600000cff000010010000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,x:b0,y:b1,platform:Linux,", +"03000000a30600001005000000010000,Saitek P150,a:b0,b:b1,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b7,lefttrigger:b6,rightshoulder:b2,righttrigger:b5,x:b3,y:b4,platform:Linux,", +"03000000a30600000701000000010000,Saitek P220,a:b2,b:b3,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,lefttrigger:b7,rightshoulder:b4,righttrigger:b5,x:b0,y:b1,platform:Linux,", +"03000000a30600000cff000010010000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b0,y:b1,platform:Linux,", "03000000a30600000c04000011010000,Saitek P2900 Wireless Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b12,x:b0,y:b3,platform:Linux,", +"03000000300f00001201000010010000,Saitek P380,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Linux,", "03000000a30600000901000000010000,Saitek P880,a:b2,b:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,x:b0,y:b1,platform:Linux,", "03000000a30600000b04000000010000,Saitek P990 Dual Analog Pad,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b8,x:b0,y:b3,platform:Linux,", "03000000a306000018f5000010010000,Saitek PLC Saitek P3200 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Linux,", -"03000000c01600008704000011010000,Serial/Keyboard/Mouse/Joystick,a:b12,b:b10,back:b4,dpdown:b2,dpleft:b3,dpright:b1,dpup:b0,leftshoulder:b9,leftstick:b14,lefttrigger:b6,leftx:a1,lefty:a0,rightshoulder:b8,rightstick:b15,righttrigger:b7,rightx:a2,righty:a3,start:b5,x:b13,y:b11,platform:Linux,", +"03000000a306000020f6000011010000,Saitek PS2700 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Linux,", +"03000000d81d00000e00000010010000,Savior,a:b0,b:b1,back:b8,leftshoulder:b6,leftstick:b10,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b11,righttrigger:b3,start:b9,x:b4,y:b5,platform:Linux,", "03000000f025000021c1000010010000,ShanWan Gioteck PS3 Wired Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", +"03000000632500007505000010010000,SHANWAN PS3/PC Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", +"03000000bc2000000055000010010000,ShanWan PS3/PC Wired GamePad,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"030000005f140000c501000010010000,SHANWAN Trust Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", +"03000000632500002305000010010000,ShanWan USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", +"03000000341a00000908000010010000,SL-6566,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", +"030000004c050000e60c000011810000,Sony DualSense,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", +"050000004c050000e60c000000810000,Sony DualSense ,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,", "03000000250900000500000000010000,Sony PS2 pad with SmartJoy adapter,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Linux,", "030000005e0400008e02000073050000,Speedlink TORID Wireless Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000005e0400008e02000020200000,SpeedLink XEOX Pro Analog Gamepad pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", -"03000000de2800000211000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,", -"05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,", -"03000000de2800000112000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,", -"05000000de2800000212000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,", -"03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", -"03000000de2800004211000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,", +"03000000d11800000094000011010000,Stadia Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,", +"03000000de2800000112000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,", +"03000000de2800000211000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,", +"03000000de2800000211000011010000,Steam Controller,a:b2,b:b3,back:b10,dpdown:b18,dpleft:b19,dpright:b20,dpup:b17,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,paddle1:b15,paddle2:b16,rightshoulder:b7,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b5,platform:Linux,", +"03000000de2800004211000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,", +"03000000de2800004211000011010000,Steam Controller,a:b2,b:b3,back:b10,dpdown:b18,dpleft:b19,dpright:b20,dpup:b17,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,paddle1:b15,paddle2:b16,rightshoulder:b7,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b5,platform:Linux,", +"03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"05000000de2800000212000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,", +"05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,", +"05000000de2800000611000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,", "03000000de280000ff11000001000000,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"03000000381000003014000075010000,SteelSeries Stratus Duo,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"03000000381000003114000075010000,SteelSeries Stratus Duo,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"0500000011010000311400001b010000,SteelSeries Stratus Duo,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b32,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"05000000110100001914000009010000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"03000000ad1b000038f0000090040000,Street Fighter IV FightStick TE,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000003b07000004a1000000010000,Suncom SFX Plus for USB,a:b0,b:b2,back:b7,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b9,righttrigger:b5,start:b8,x:b1,y:b3,platform:Linux,", "03000000666600000488000000010000,Super Joy Box 5 Pro,a:b2,b:b1,back:b9,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Linux,", +"0300000000f00000f100000000010000,Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Linux,", +"03000000457500002211000010010000,SZMY-POWER CO. LTD. GAMEPAD,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", +"030000008f0e00000d31000010010000,SZMY-POWER CO. LTD. GAMEPAD 3 TURBO,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", +"030000008f0e00001431000010010000,SZMY-POWER CO. LTD. PS3 gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", "030000004f04000020b3000010010000,Thrustmaster 2 in 1 DT,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Linux,", "030000004f04000015b3000010010000,Thrustmaster Dual Analog 4,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Linux,", "030000004f04000023b3000000010000,Thrustmaster Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"030000004f0400000ed0000011010000,ThrustMaster eSwap PRO Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +"03000000b50700000399000000010000,Thrustmaster Firestorm Digital 2,a:b2,b:b4,back:b11,leftshoulder:b6,leftstick:b10,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b8,rightstick:b0,righttrigger:b9,start:b1,x:b3,y:b5,platform:Linux,", +"030000004f04000003b3000010010000,Thrustmaster Firestorm Dual Analog 2,a:b0,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b9,rightx:a2,righty:a3,x:b1,y:b3,platform:Linux,", "030000004f04000000b3000010010000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,platform:Linux,", +"030000004f04000026b3000002040000,Thrustmaster Gamepad GP XID,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"03000000c6240000025b000002020000,Thrustmaster GPX Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000004f04000008d0000000010000,Thrustmaster Run N Drive Wireless,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "030000004f04000009d0000000010000,Thrustmaster Run N Drive Wireless PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", +"030000004f04000007d0000000010000,Thrustmaster T Mini Wireless,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,", +"030000004f04000012b3000010010000,Thrustmaster vibrating gamepad,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Linux,", "03000000bd12000015d0000010010000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Linux,", "03000000d814000007cd000011010000,Toodles 2008 Chimp PC/PS3,a:b0,b:b1,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b3,y:b2,platform:Linux,", +"030000005e0400008e02000070050000,Torid,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"03000000c01100000591000011010000,Torid,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", "03000000100800000100000010010000,Twin USB PS2 Adapter,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,", "03000000100800000300000010010000,USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,", +"03000000790000000600000007010000,USB gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,platform:Linux,", "03000000790000001100000000010000,USB Gamepad1,a:b2,b:b1,back:b8,dpdown:a0,dpleft:a1,dpright:a2,dpup:a4,start:b9,platform:Linux,", +"030000006f0e00000302000011010000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,", +"030000006f0e00000702000011010000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,", "05000000ac0500003232000001000000,VR-BOX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Linux,", -"030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"03000000791d00000103000010010000,Wii Classic Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", +"050000000d0f0000f600000001000000,Wireless HORIPAD Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", "030000005e0400008e02000010010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000005e0400009102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", -"030000005e040000a102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "030000005e040000a102000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000005e040000a102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "0000000058626f782033363020576900,Xbox 360 Wireless Controller,a:b0,b:b1,back:b14,dpdown:b11,dpleft:b12,dpright:b13,dpup:b10,guide:b7,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,platform:Linux,", +"030000005e040000a102000014010000,Xbox 360 Wireless Receiver (XBOX),a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "0000000058626f782047616d65706100,Xbox Gamepad (userspace driver),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,", +"030000005e040000d102000002010000,Xbox One Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"050000005e040000fd02000030110000,Xbox One Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"050000005e040000050b000002090000,Xbox One Elite Series 2,a:b0,b:b1,back:b136,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a6,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"030000005e040000ea02000000000000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "050000005e040000e002000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "050000005e040000fd02000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b16,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"030000005e040000ea02000001030000,Xbox One Wireless Controller (Model 1708),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000005e040000120b000001050000,Xbox Series Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000005e040000130b000005050000,Xbox Series Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"050000005e040000130b000001050000,Xbox Series Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"050000005e040000130b000005050000,Xbox Series Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,", +"030000005e040000120b000005050000,XBox Series pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", +"030000005e0400008e02000000010000,xbox360 Wireless EasySMX,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,", "03000000450c00002043000010010000,XEOX Gamepad SL-6556-BK,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,", +"03000000ac0500005b05000010010000,Xiaoji Gamesir-G3w,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,", "05000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,platform:Linux,", "03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,platform:Linux,", "03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", -"64633436313965656664373634323364,Microsoft X-Box 360 pad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,x:b2,y:b3,platform:Android,", -"61363931656135336130663561616264,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android,", -"4e564944494120436f72706f72617469,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android,", -"37336435666338653565313731303834,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android,", -"35643031303033326130316330353564,PS4 Controller,a:b1,b:b17,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:+a4,rightx:a2,righty:a5,start:b16,x:b0,y:b2,platform:Android,", -"05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Android,", -"5477696e20555342204a6f7973746963,Twin USB Joystick,a:b22,b:b21,back:b28,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b26,leftstick:b30,lefttrigger:b24,leftx:a0,lefty:a1,rightshoulder:b27,rightstick:b31,righttrigger:b25,rightx:a3,righty:a2,start:b29,x:b23,y:b20,platform:Android,", -"34356136633366613530316338376136,Xbox Wireless Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b3,leftstick:b15,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b16,righttrigger:a5,rightx:a3,righty:a4,x:b17,y:b2,platform:Android,", -"4d466947616d65706164010000000000,MFi Extended Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,platform:iOS,", -"4d466947616d65706164020000000000,MFi Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b6,x:b2,y:b3,platform:iOS,", -"05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:iOS,", - -"78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", -"78696e70757402000000000000000000,XInput Wheel (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", -"78696e70757403000000000000000000,XInput Arcade Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", -"78696e70757404000000000000000000,XInput Flight Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", -"78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", -"78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", -"78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", -NULL +"03000000120c0000101e000011010000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", +#endif // GLFW_BUILD_LINUX_MAPPINGS }; diff --git a/third_party/penumbra/vendor/glfw/src/mappings.h.in b/third_party/penumbra/vendor/glfw/src/mappings.h.in index 72460b0d941..26b544bd391 100644 --- a/third_party/penumbra/vendor/glfw/src/mappings.h.in +++ b/third_party/penumbra/vendor/glfw/src/mappings.h.in @@ -31,7 +31,7 @@ // all available in SDL_GameControllerDB. Do not edit this file. Any gamepad // mappings not specific to GLFW should be submitted to SDL_GameControllerDB. // This file can be re-generated from mappings.h.in and the upstream -// gamecontrollerdb.txt with the GenerateMappings.cmake script. +// gamecontrollerdb.txt with the 'update_mappings' CMake target. //======================================================================== // All gamepad mappings not labeled GLFW are copied from the @@ -60,7 +60,8 @@ const char* _glfwDefaultMappings[] = { -@GLFW_GAMEPAD_MAPPINGS@ +#if defined(GLFW_BUILD_WIN32_MAPPINGS) +@GLFW_WIN32_MAPPINGS@ "78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757402000000000000000000,XInput Wheel (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757403000000000000000000,XInput Arcade Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", @@ -68,6 +69,14 @@ const char* _glfwDefaultMappings[] = "78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", -NULL +#endif // GLFW_BUILD_WIN32_MAPPINGS + +#if defined(GLFW_BUILD_COCOA_MAPPINGS) +@GLFW_COCOA_MAPPINGS@ +#endif // GLFW_BUILD_COCOA_MAPPINGS + +#if defined(GLFW_BUILD_LINUX_MAPPINGS) +@GLFW_LINUX_MAPPINGS@ +#endif // GLFW_BUILD_LINUX_MAPPINGS }; diff --git a/third_party/penumbra/vendor/glfw/src/monitor.c b/third_party/penumbra/vendor/glfw/src/monitor.c index c6bcfd395a9..2601d11b330 100644 --- a/third_party/penumbra/vendor/glfw/src/monitor.c +++ b/third_party/penumbra/vendor/glfw/src/monitor.c @@ -170,8 +170,7 @@ _GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM) monitor->widthMM = widthMM; monitor->heightMM = heightMM; - if (name) - monitor->name = _glfw_strdup(name); + strncpy(monitor->name, name, sizeof(monitor->name) - 1); return monitor; } @@ -189,7 +188,6 @@ void _glfwFreeMonitor(_GLFWmonitor* monitor) _glfwFreeGammaArrays(&monitor->currentRamp); free(monitor->modes); - free(monitor->name); free(monitor); } @@ -523,6 +521,8 @@ GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp) assert(ramp->green != NULL); assert(ramp->blue != NULL); + _GLFW_REQUIRE_INIT(); + if (ramp->size <= 0) { _glfwInputError(GLFW_INVALID_VALUE, @@ -531,8 +531,6 @@ GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp) return; } - _GLFW_REQUIRE_INIT(); - if (!monitor->originalRamp.size) { if (!_glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp)) diff --git a/third_party/penumbra/vendor/glfw/src/nsgl_context.h b/third_party/penumbra/vendor/glfw/src/nsgl_context.h index a772b51117b..010ce4dc8cf 100644 --- a/third_party/penumbra/vendor/glfw/src/nsgl_context.h +++ b/third_party/penumbra/vendor/glfw/src/nsgl_context.h @@ -25,8 +25,10 @@ //======================================================================== // NOTE: Many Cocoa enum values have been renamed and we need to build across -// SDK versions where one is unavailable or the other deprecated -// We use the newer names in code and these macros to handle compatibility +// SDK versions where one is unavailable or deprecated. +// We use the newer names in code and replace them with the older names if +// the base SDK does not provide the newer names. + #if MAC_OS_X_VERSION_MAX_ALLOWED < 101400 #define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval #define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity @@ -44,7 +46,6 @@ typedef struct _GLFWcontextNSGL { id pixelFormat; id object; - } _GLFWcontextNSGL; // NSGL-specific global data @@ -53,7 +54,6 @@ typedef struct _GLFWlibraryNSGL { // dlopen handle for OpenGL.framework (for glfwGetProcAddress) CFBundleRef framework; - } _GLFWlibraryNSGL; diff --git a/third_party/penumbra/vendor/glfw/src/nsgl_context.m b/third_party/penumbra/vendor/glfw/src/nsgl_context.m index 3bcfafcc7a0..78d688c496a 100644 --- a/third_party/penumbra/vendor/glfw/src/nsgl_context.m +++ b/third_party/penumbra/vendor/glfw/src/nsgl_context.m @@ -51,7 +51,7 @@ static void swapBuffersNSGL(_GLFWwindow* window) // HACK: Simulate vsync with usleep as NSGL swap interval does not apply to // windows with a non-visible occlusion state - if (!([window->ns.object occlusionState] & NSWindowOcclusionStateVisible)) + if (window->ns.occluded) { int interval = 0; [window->context.nsgl.object getValues:&interval @@ -365,7 +365,7 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* handle) _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(nil); - if (window->context.client == GLFW_NO_API) + if (window->context.source != GLFW_NATIVE_CONTEXT_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); return nil; diff --git a/third_party/penumbra/vendor/glfw/src/null_window.c b/third_party/penumbra/vendor/glfw/src/null_window.c index 045c76a200d..e61c2bdd372 100644 --- a/third_party/penumbra/vendor/glfw/src/null_window.c +++ b/third_party/penumbra/vendor/glfw/src/null_window.c @@ -67,6 +67,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, _glfwInputError(GLFW_API_UNAVAILABLE, "Null: EGL not available"); return GLFW_FALSE; } + + if (!_glfwRefreshContextAttribs(window, ctxconfig)) + return GLFW_FALSE; } return GLFW_TRUE; diff --git a/third_party/penumbra/vendor/glfw/src/osmesa_context.c b/third_party/penumbra/vendor/glfw/src/osmesa_context.c index c2fa49d4bcd..4072728bc61 100644 --- a/third_party/penumbra/vendor/glfw/src/osmesa_context.c +++ b/third_party/penumbra/vendor/glfw/src/osmesa_context.c @@ -124,6 +124,8 @@ GLFWbool _glfwInitOSMesa(void) "libOSMesa.8.dylib", #elif defined(__CYGWIN__) "libOSMesa-8.so", +#elif defined(__OpenBSD__) || defined(__NetBSD__) + "libOSMesa.so", #else "libOSMesa.so.8", "libOSMesa.so.6", @@ -302,6 +304,12 @@ GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* handle, int* width, _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); + if (window->context.source != GLFW_OSMESA_CONTEXT_API) + { + _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); + return GLFW_FALSE; + } + if (!OSMesaGetColorBuffer(window->context.osmesa.handle, &mesaWidth, &mesaHeight, &mesaFormat, &mesaBuffer)) @@ -335,6 +343,12 @@ GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* handle, _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); + if (window->context.source != GLFW_OSMESA_CONTEXT_API) + { + _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); + return GLFW_FALSE; + } + if (!OSMesaGetDepthBuffer(window->context.osmesa.handle, &mesaWidth, &mesaHeight, &mesaBytes, &mesaBuffer)) @@ -361,7 +375,7 @@ GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* handle) _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); - if (window->context.client == GLFW_NO_API) + if (window->context.source != GLFW_OSMESA_CONTEXT_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); return NULL; diff --git a/third_party/penumbra/vendor/glfw/src/osmesa_context.h b/third_party/penumbra/vendor/glfw/src/osmesa_context.h index 2413188da53..6462637f4c4 100644 --- a/third_party/penumbra/vendor/glfw/src/osmesa_context.h +++ b/third_party/penumbra/vendor/glfw/src/osmesa_context.h @@ -66,7 +66,6 @@ typedef struct _GLFWcontextOSMesa int width; int height; void* buffer; - } _GLFWcontextOSMesa; // OSMesa-specific global data @@ -82,7 +81,6 @@ typedef struct _GLFWlibraryOSMesa PFN_OSMesaGetColorBuffer GetColorBuffer; PFN_OSMesaGetDepthBuffer GetDepthBuffer; PFN_OSMesaGetProcAddress GetProcAddress; - } _GLFWlibraryOSMesa; diff --git a/third_party/penumbra/vendor/glfw/src/posix_thread.h b/third_party/penumbra/vendor/glfw/src/posix_thread.h index 24452ba060d..1c6a5c4390f 100644 --- a/third_party/penumbra/vendor/glfw/src/posix_thread.h +++ b/third_party/penumbra/vendor/glfw/src/posix_thread.h @@ -37,7 +37,6 @@ typedef struct _GLFWtlsPOSIX { GLFWbool allocated; pthread_key_t key; - } _GLFWtlsPOSIX; // POSIX-specific mutex data @@ -46,6 +45,5 @@ typedef struct _GLFWmutexPOSIX { GLFWbool allocated; pthread_mutex_t handle; - } _GLFWmutexPOSIX; diff --git a/third_party/penumbra/vendor/glfw/src/posix_time.h b/third_party/penumbra/vendor/glfw/src/posix_time.h index 08cf4fcfd60..911399eff76 100644 --- a/third_party/penumbra/vendor/glfw/src/posix_time.h +++ b/third_party/penumbra/vendor/glfw/src/posix_time.h @@ -36,7 +36,6 @@ typedef struct _GLFWtimerPOSIX { GLFWbool monotonic; uint64_t frequency; - } _GLFWtimerPOSIX; diff --git a/third_party/penumbra/vendor/glfw/src/vulkan.c b/third_party/penumbra/vendor/glfw/src/vulkan.c index 22c54e4adcc..1b96579cad7 100644 --- a/third_party/penumbra/vendor/glfw/src/vulkan.c +++ b/third_party/penumbra/vendor/glfw/src/vulkan.c @@ -59,6 +59,8 @@ GLFWbool _glfwInitVulkan(int mode) _glfw.vk.handle = _glfw_dlopen("libvulkan.1.dylib"); if (!_glfw.vk.handle) _glfw.vk.handle = _glfwLoadLocalVulkanLoaderNS(); +#elif defined(__OpenBSD__) || defined(__NetBSD__) + _glfw.vk.handle = _glfw_dlopen("libvulkan.so"); #else _glfw.vk.handle = _glfw_dlopen("libvulkan.so.1"); #endif diff --git a/third_party/penumbra/vendor/glfw/src/wgl_context.c b/third_party/penumbra/vendor/glfw/src/wgl_context.c index b7d1c4d4691..72ad11dedb0 100644 --- a/third_party/penumbra/vendor/glfw/src/wgl_context.c +++ b/third_party/penumbra/vendor/glfw/src/wgl_context.c @@ -165,6 +165,9 @@ static int choosePixelFormat(_GLFWwindow* window, if (findAttribValue(WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB) continue; + if (findAttribValue(WGL_DOUBLE_BUFFER_ARB) != fbconfig->doublebuffer) + continue; + u->redBits = findAttribValue(WGL_RED_BITS_ARB); u->greenBits = findAttribValue(WGL_GREEN_BITS_ARB); u->blueBits = findAttribValue(WGL_BLUE_BITS_ARB); @@ -182,8 +185,6 @@ static int choosePixelFormat(_GLFWwindow* window, if (findAttribValue(WGL_STEREO_ARB)) u->stereo = GLFW_TRUE; - if (findAttribValue(WGL_DOUBLE_BUFFER_ARB)) - u->doublebuffer = GLFW_TRUE; if (_glfw.wgl.ARB_multisample) u->samples = findAttribValue(WGL_SAMPLES_ARB); @@ -239,6 +240,9 @@ static int choosePixelFormat(_GLFWwindow* window, if (pfd.iPixelType != PFD_TYPE_RGBA) continue; + if (!!(pfd.dwFlags & PFD_DOUBLEBUFFER) != fbconfig->doublebuffer) + continue; + u->redBits = pfd.cRedBits; u->greenBits = pfd.cGreenBits; u->blueBits = pfd.cBlueBits; @@ -256,8 +260,6 @@ static int choosePixelFormat(_GLFWwindow* window, if (pfd.dwFlags & PFD_STEREO) u->stereo = GLFW_TRUE; - if (pfd.dwFlags & PFD_DOUBLEBUFFER) - u->doublebuffer = GLFW_TRUE; } u->handle = pixelFormat; @@ -785,7 +787,7 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* handle) _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); - if (window->context.client == GLFW_NO_API) + if (window->context.source != GLFW_NATIVE_CONTEXT_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); return NULL; diff --git a/third_party/penumbra/vendor/glfw/src/wgl_context.h b/third_party/penumbra/vendor/glfw/src/wgl_context.h index d982118809c..47f045927a0 100644 --- a/third_party/penumbra/vendor/glfw/src/wgl_context.h +++ b/third_party/penumbra/vendor/glfw/src/wgl_context.h @@ -104,10 +104,6 @@ typedef BOOL (WINAPI * PFN_wglShareLists)(HGLRC,HGLRC); #define wglMakeCurrent _glfw.wgl.MakeCurrent #define wglShareLists _glfw.wgl.ShareLists -#define _GLFW_RECREATION_NOT_NEEDED 0 -#define _GLFW_RECREATION_REQUIRED 1 -#define _GLFW_RECREATION_IMPOSSIBLE 2 - #define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL wgl #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryWGL wgl @@ -119,7 +115,6 @@ typedef struct _GLFWcontextWGL HDC dc; HGLRC handle; int interval; - } _GLFWcontextWGL; // WGL-specific global data @@ -152,7 +147,6 @@ typedef struct _GLFWlibraryWGL GLFWbool ARB_create_context_robustness; GLFWbool ARB_create_context_no_error; GLFWbool ARB_context_flush_control; - } _GLFWlibraryWGL; diff --git a/third_party/penumbra/vendor/glfw/src/win32_init.c b/third_party/penumbra/vendor/glfw/src/win32_init.c index b2aa0a3d51e..885f32fa973 100644 --- a/third_party/penumbra/vendor/glfw/src/win32_init.c +++ b/third_party/penumbra/vendor/glfw/src/win32_init.c @@ -39,6 +39,10 @@ static const GUID _glfw_GUID_DEVINTERFACE_HID = #if defined(_GLFW_USE_HYBRID_HPG) || defined(_GLFW_USE_OPTIMUS_HPG) +#if defined(_GLFW_BUILD_DLL) + #pragma message("These symbols must be exported by the executable and have no effect in a DLL") +#endif + // Executables (but not DLLs) exporting this symbol with this value will be // automatically directed to the high-performance GPU on Nvidia Optimus systems // with up-to-date drivers @@ -68,17 +72,16 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) // static GLFWbool loadLibraries(void) { - _glfw.win32.winmm.instance = LoadLibraryA("winmm.dll"); - if (!_glfw.win32.winmm.instance) + if (!GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | + GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, + (const WCHAR*) &_glfw, + (HMODULE*) &_glfw.win32.instance)) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, - "Win32: Failed to load winmm.dll"); + "Win32: Failed to retrieve own module handle"); return GLFW_FALSE; } - _glfw.win32.winmm.GetTime = (PFN_timeGetTime) - GetProcAddress(_glfw.win32.winmm.instance, "timeGetTime"); - _glfw.win32.user32.instance = LoadLibraryA("user32.dll"); if (!_glfw.win32.user32.instance) { @@ -99,6 +102,8 @@ static GLFWbool loadLibraries(void) GetProcAddress(_glfw.win32.user32.instance, "GetDpiForWindow"); _glfw.win32.user32.AdjustWindowRectExForDpi_ = (PFN_AdjustWindowRectExForDpi) GetProcAddress(_glfw.win32.user32.instance, "AdjustWindowRectExForDpi"); + _glfw.win32.user32.GetSystemMetricsForDpi_ = (PFN_GetSystemMetricsForDpi) + GetProcAddress(_glfw.win32.user32.instance, "GetSystemMetricsForDpi"); _glfw.win32.dinput8.instance = LoadLibraryA("dinput8.dll"); if (_glfw.win32.dinput8.instance) @@ -143,6 +148,8 @@ static GLFWbool loadLibraries(void) GetProcAddress(_glfw.win32.dwmapi.instance, "DwmFlush"); _glfw.win32.dwmapi.EnableBlurBehindWindow = (PFN_DwmEnableBlurBehindWindow) GetProcAddress(_glfw.win32.dwmapi.instance, "DwmEnableBlurBehindWindow"); + _glfw.win32.dwmapi.GetColorizationColor = (PFN_DwmGetColorizationColor) + GetProcAddress(_glfw.win32.dwmapi.instance, "DwmGetColorizationColor"); } _glfw.win32.shcore.instance = LoadLibraryA("shcore.dll"); @@ -174,9 +181,6 @@ static void freeLibraries(void) if (_glfw.win32.dinput8.instance) FreeLibrary(_glfw.win32.dinput8.instance); - if (_glfw.win32.winmm.instance) - FreeLibrary(_glfw.win32.winmm.instance); - if (_glfw.win32.user32.instance) FreeLibrary(_glfw.win32.user32.instance); @@ -260,7 +264,6 @@ static void createKeyTables(void) _glfw.win32.keycodes[0x151] = GLFW_KEY_PAGE_DOWN; _glfw.win32.keycodes[0x149] = GLFW_KEY_PAGE_UP; _glfw.win32.keycodes[0x045] = GLFW_KEY_PAUSE; - _glfw.win32.keycodes[0x146] = GLFW_KEY_PAUSE; _glfw.win32.keycodes[0x039] = GLFW_KEY_SPACE; _glfw.win32.keycodes[0x00F] = GLFW_KEY_TAB; _glfw.win32.keycodes[0x03A] = GLFW_KEY_CAPS_LOCK; @@ -342,7 +345,7 @@ static GLFWbool createHelperWindow(void) WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, 1, 1, NULL, NULL, - GetModuleHandleW(NULL), + _glfw.win32.instance, NULL); if (!_glfw.win32.helperWindowHandle) @@ -492,7 +495,7 @@ void _glfwUpdateKeyNamesWin32(void) vk = vks[key - GLFW_KEY_KP_0]; } else - vk = MapVirtualKey(scancode, MAPVK_VSC_TO_VK); + vk = MapVirtualKeyW(scancode, MAPVK_VSC_TO_VK); length = ToUnicode(vk, scancode, state, chars, sizeof(chars) / sizeof(WCHAR), @@ -500,6 +503,8 @@ void _glfwUpdateKeyNamesWin32(void) if (length == -1) { + // This is a dead key, so we need a second simulated key press + // to make it output its own character (usually a diacritic) length = ToUnicode(vk, scancode, state, chars, sizeof(chars) / sizeof(WCHAR), 0); @@ -515,7 +520,8 @@ void _glfwUpdateKeyNamesWin32(void) } } -// Replacement for IsWindowsVersionOrGreater as MinGW lacks versionhelpers.h +// Replacement for IsWindowsVersionOrGreater, as we cannot rely on the +// application having a correct embedded manifest // BOOL _glfwIsWindowsVersionOrGreaterWin32(WORD major, WORD minor, WORD sp) { @@ -606,6 +612,7 @@ void _glfwPlatformTerminate(void) _glfwTerminateWGL(); _glfwTerminateEGL(); + _glfwTerminateOSMesa(); _glfwTerminateJoysticksWin32(); diff --git a/third_party/penumbra/vendor/glfw/src/win32_joystick.c b/third_party/penumbra/vendor/glfw/src/win32_joystick.c index 4ffc9fbf404..f471f0a9353 100644 --- a/third_party/penumbra/vendor/glfw/src/win32_joystick.c +++ b/third_party/penumbra/vendor/glfw/src/win32_joystick.c @@ -256,6 +256,8 @@ static GLFWbool supportsXInput(const GUID* guid) // static void closeJoystick(_GLFWjoystick* js) { + _glfwInputJoystick(js, GLFW_DISCONNECTED); + if (js->win32.device) { IDirectInputDevice8_Unacquire(js->win32.device); @@ -263,9 +265,7 @@ static void closeJoystick(_GLFWjoystick* js) } free(js->win32.objects); - _glfwFreeJoystick(js); - _glfwInputJoystick(js, GLFW_DISCONNECTED); } // DirectInput device object enumeration callback @@ -356,8 +356,8 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user) for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { - _GLFWjoystick* js = _glfw.joysticks + jid; - if (js->present) + js = _glfw.joysticks + jid; + if (js->connected) { if (memcmp(&js->win32.guid, &di->guidInstance, sizeof(GUID)) == 0) return DIENUM_CONTINUE; @@ -497,7 +497,7 @@ void _glfwInitJoysticksWin32(void) { if (_glfw.win32.dinput8.instance) { - if (FAILED(DirectInput8Create(GetModuleHandle(NULL), + if (FAILED(DirectInput8Create(_glfw.win32.instance, DIRECTINPUT_VERSION, &IID_IDirectInput8W, (void**) &_glfw.win32.dinput8.api, @@ -541,7 +541,7 @@ void _glfwDetectJoystickConnectionWin32(void) for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { - if (_glfw.joysticks[jid].present && + if (_glfw.joysticks[jid].connected && _glfw.joysticks[jid].win32.device == NULL && _glfw.joysticks[jid].win32.index == index) { @@ -593,7 +593,7 @@ void _glfwDetectJoystickDisconnectionWin32(void) for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { _GLFWjoystick* js = _glfw.joysticks + jid; - if (js->present) + if (js->connected) _glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE); } } @@ -609,7 +609,7 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode) { int i, ai = 0, bi = 0, pi = 0; HRESULT result; - DIJOYSTATE state; + DIJOYSTATE state = {0}; IDirectInputDevice8_Poll(js->win32.device); result = IDirectInputDevice8_GetDeviceState(js->win32.device, @@ -672,11 +672,11 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode) }; // Screams of horror are appropriate at this point - int state = LOWORD(*(DWORD*) data) / (45 * DI_DEGREES); - if (state < 0 || state > 8) - state = 8; + int stateIndex = LOWORD(*(DWORD*) data) / (45 * DI_DEGREES); + if (stateIndex < 0 || stateIndex > 8) + stateIndex = 8; - _glfwInputJoystickHat(js, pi, states[state]); + _glfwInputJoystickHat(js, pi, states[stateIndex]); pi++; break; } diff --git a/third_party/penumbra/vendor/glfw/src/win32_joystick.h b/third_party/penumbra/vendor/glfw/src/win32_joystick.h index 9ba46d906a6..d591a826288 100644 --- a/third_party/penumbra/vendor/glfw/src/win32_joystick.h +++ b/third_party/penumbra/vendor/glfw/src/win32_joystick.h @@ -28,6 +28,7 @@ #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; } #define _GLFW_PLATFORM_MAPPING_NAME "Windows" +#define GLFW_BUILD_WIN32_MAPPINGS // Joystick element (axis, button or slider) // diff --git a/third_party/penumbra/vendor/glfw/src/win32_monitor.c b/third_party/penumbra/vendor/glfw/src/win32_monitor.c index 4f5af36a4c8..67337fd81b2 100644 --- a/third_party/penumbra/vendor/glfw/src/win32_monitor.c +++ b/third_party/penumbra/vendor/glfw/src/win32_monitor.c @@ -185,6 +185,8 @@ void _glfwPollMonitorsWin32(void) display.DeviceName) == 0) { disconnected[i] = NULL; + // handle may have changed, update + EnumDisplayMonitors(NULL, NULL, monitorCallback, (LPARAM) _glfw.monitors[i]); break; } } @@ -316,8 +318,19 @@ void _glfwGetMonitorContentScaleWin32(HMONITOR handle, float* xscale, float* ysc { UINT xdpi, ydpi; + if (xscale) + *xscale = 0.f; + if (yscale) + *yscale = 0.f; + if (IsWindows8Point1OrGreater()) - GetDpiForMonitor(handle, MDT_EFFECTIVE_DPI, &xdpi, &ydpi); + { + if (GetDpiForMonitor(handle, MDT_EFFECTIVE_DPI, &xdpi, &ydpi) != S_OK) + { + _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to query monitor DPI"); + return; + } + } else { const HDC dc = GetDC(NULL); @@ -369,7 +382,7 @@ void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* width, int* height) { MONITORINFO mi = { sizeof(mi) }; - GetMonitorInfo(monitor->win32.handle, &mi); + GetMonitorInfoW(monitor->win32.handle, &mi); if (xpos) *xpos = mi.rcWork.left; diff --git a/third_party/penumbra/vendor/glfw/src/win32_platform.h b/third_party/penumbra/vendor/glfw/src/win32_platform.h index be1dc54491a..bf703d7e607 100644 --- a/third_party/penumbra/vendor/glfw/src/win32_platform.h +++ b/third_party/penumbra/vendor/glfw/src/win32_platform.h @@ -39,8 +39,8 @@ #endif // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for -// example to allow applications to correctly declare a GL_ARB_debug_output -// callback) but windows.h assumes no one will define APIENTRY before it does +// example to allow applications to correctly declare a GL_KHR_debug callback) +// but windows.h assumes no one will define APIENTRY before it does #undef APIENTRY // GLFW on Windows is Unicode only and does not work in MBCS mode @@ -77,6 +77,9 @@ #ifndef WM_DWMCOMPOSITIONCHANGED #define WM_DWMCOMPOSITIONCHANGED 0x031E #endif +#ifndef WM_DWMCOLORIZATIONCOLORCHANGED + #define WM_DWMCOLORIZATIONCOLORCHANGED 0x0320 +#endif #ifndef WM_COPYGLOBALDATA #define WM_COPYGLOBALDATA 0x0049 #endif @@ -99,7 +102,7 @@ #define DISPLAY_DEVICE_ACTIVE 0x00000001 #endif #ifndef _WIN32_WINNT_WINBLUE - #define _WIN32_WINNT_WINBLUE 0x0602 + #define _WIN32_WINNT_WINBLUE 0x0603 #endif #ifndef _WIN32_WINNT_WIN8 #define _WIN32_WINNT_WIN8 0x0602 @@ -159,7 +162,9 @@ typedef enum #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((HANDLE) -4) #endif /*DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2*/ -// HACK: Define versionhelpers.h functions manually as MinGW lacks the header +// Replacement for versionhelpers.h macros, as we cannot rely on the +// application having a correct embedded manifest +// #define IsWindowsXPOrGreater() \ _glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WINXP), \ LOBYTE(_WIN32_WINNT_WINXP), 0) @@ -215,10 +220,6 @@ typedef enum #define DIDFT_OPTIONAL 0x80000000 #endif -// winmm.dll function pointer typedefs -typedef DWORD (WINAPI * PFN_timeGetTime)(void); -#define timeGetTime _glfw.win32.winmm.GetTime - // xinput.dll function pointer typedefs typedef DWORD (WINAPI * PFN_XInputGetCapabilities)(DWORD,DWORD,XINPUT_CAPABILITIES*); typedef DWORD (WINAPI * PFN_XInputGetState)(DWORD,XINPUT_STATE*); @@ -236,20 +237,24 @@ typedef BOOL (WINAPI * PFN_EnableNonClientDpiScaling)(HWND); typedef BOOL (WINAPI * PFN_SetProcessDpiAwarenessContext)(HANDLE); typedef UINT (WINAPI * PFN_GetDpiForWindow)(HWND); typedef BOOL (WINAPI * PFN_AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT); +typedef int (WINAPI * PFN_GetSystemMetricsForDpi)(int,UINT); #define SetProcessDPIAware _glfw.win32.user32.SetProcessDPIAware_ #define ChangeWindowMessageFilterEx _glfw.win32.user32.ChangeWindowMessageFilterEx_ #define EnableNonClientDpiScaling _glfw.win32.user32.EnableNonClientDpiScaling_ #define SetProcessDpiAwarenessContext _glfw.win32.user32.SetProcessDpiAwarenessContext_ #define GetDpiForWindow _glfw.win32.user32.GetDpiForWindow_ #define AdjustWindowRectExForDpi _glfw.win32.user32.AdjustWindowRectExForDpi_ +#define GetSystemMetricsForDpi _glfw.win32.user32.GetSystemMetricsForDpi_ // dwmapi.dll function pointer typedefs typedef HRESULT (WINAPI * PFN_DwmIsCompositionEnabled)(BOOL*); typedef HRESULT (WINAPI * PFN_DwmFlush)(VOID); typedef HRESULT(WINAPI * PFN_DwmEnableBlurBehindWindow)(HWND,const DWM_BLURBEHIND*); +typedef HRESULT (WINAPI * PFN_DwmGetColorizationColor)(DWORD*,BOOL*); #define DwmIsCompositionEnabled _glfw.win32.dwmapi.IsCompositionEnabled #define DwmFlush _glfw.win32.dwmapi.Flush #define DwmEnableBlurBehindWindow _glfw.win32.dwmapi.EnableBlurBehindWindow +#define DwmGetColorizationColor _glfw.win32.dwmapi.GetColorizationColor // shcore.dll function pointer typedefs typedef HRESULT (WINAPI * PFN_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS); @@ -316,15 +321,20 @@ typedef struct _GLFWwindowWin32 GLFWbool transparent; GLFWbool scaleToMonitor; + // Cached size used to filter out duplicate events + int width, height; + // The last received cursor position, regardless of source int lastCursorPosX, lastCursorPosY; - + // The last recevied high surrogate when decoding pairs of UTF-16 messages + WCHAR highSurrogate; } _GLFWwindowWin32; // Win32-specific global data // typedef struct _GLFWlibraryWin32 { + HINSTANCE instance; HWND helperWindowHandle; HDEVNOTIFY deviceNotificationHandle; DWORD foregroundLockTimeout; @@ -341,11 +351,6 @@ typedef struct _GLFWlibraryWin32 int rawInputSize; UINT mouseTrailSize; - struct { - HINSTANCE instance; - PFN_timeGetTime GetTime; - } winmm; - struct { HINSTANCE instance; PFN_DirectInput8Create Create; @@ -366,6 +371,7 @@ typedef struct _GLFWlibraryWin32 PFN_SetProcessDpiAwarenessContext SetProcessDpiAwarenessContext_; PFN_GetDpiForWindow GetDpiForWindow_; PFN_AdjustWindowRectExForDpi AdjustWindowRectExForDpi_; + PFN_GetSystemMetricsForDpi GetSystemMetricsForDpi_; } user32; struct { @@ -373,6 +379,7 @@ typedef struct _GLFWlibraryWin32 PFN_DwmIsCompositionEnabled IsCompositionEnabled; PFN_DwmFlush Flush; PFN_DwmEnableBlurBehindWindow EnableBlurBehindWindow; + PFN_DwmGetColorizationColor GetColorizationColor; } dwmapi; struct { @@ -385,7 +392,6 @@ typedef struct _GLFWlibraryWin32 HINSTANCE instance; PFN_RtlVerifyVersionInfo RtlVerifyVersionInfo_; } ntdll; - } _GLFWlibraryWin32; // Win32-specific per-monitor data @@ -400,7 +406,6 @@ typedef struct _GLFWmonitorWin32 char publicDisplayName[32]; GLFWbool modesPruned; GLFWbool modeChanged; - } _GLFWmonitorWin32; // Win32-specific per-cursor data @@ -408,16 +413,13 @@ typedef struct _GLFWmonitorWin32 typedef struct _GLFWcursorWin32 { HCURSOR handle; - } _GLFWcursorWin32; // Win32-specific global timer data // typedef struct _GLFWtimerWin32 { - GLFWbool hasPC; uint64_t frequency; - } _GLFWtimerWin32; // Win32-specific thread local storage data @@ -426,7 +428,6 @@ typedef struct _GLFWtlsWin32 { GLFWbool allocated; DWORD index; - } _GLFWtlsWin32; // Win32-specific mutex data @@ -435,7 +436,6 @@ typedef struct _GLFWmutexWin32 { GLFWbool allocated; CRITICAL_SECTION section; - } _GLFWmutexWin32; diff --git a/third_party/penumbra/vendor/glfw/src/win32_time.c b/third_party/penumbra/vendor/glfw/src/win32_time.c index 75594637cd8..b4e31ab2765 100644 --- a/third_party/penumbra/vendor/glfw/src/win32_time.c +++ b/third_party/penumbra/vendor/glfw/src/win32_time.c @@ -38,18 +38,7 @@ // void _glfwInitTimerWin32(void) { - uint64_t frequency; - - if (QueryPerformanceFrequency((LARGE_INTEGER*) &frequency)) - { - _glfw.timer.win32.hasPC = GLFW_TRUE; - _glfw.timer.win32.frequency = frequency; - } - else - { - _glfw.timer.win32.hasPC = GLFW_FALSE; - _glfw.timer.win32.frequency = 1000; - } + QueryPerformanceFrequency((LARGE_INTEGER*) &_glfw.timer.win32.frequency); } @@ -59,14 +48,9 @@ void _glfwInitTimerWin32(void) uint64_t _glfwPlatformGetTimerValue(void) { - if (_glfw.timer.win32.hasPC) - { - uint64_t value; - QueryPerformanceCounter((LARGE_INTEGER*) &value); - return value; - } - else - return (uint64_t) timeGetTime(); + uint64_t value; + QueryPerformanceCounter((LARGE_INTEGER*) &value); + return value; } uint64_t _glfwPlatformGetTimerFrequency(void) diff --git a/third_party/penumbra/vendor/glfw/src/win32_window.c b/third_party/penumbra/vendor/glfw/src/win32_window.c index 0ce22ee7ad2..073ceee918e 100644 --- a/third_party/penumbra/vendor/glfw/src/win32_window.c +++ b/third_party/penumbra/vendor/glfw/src/win32_window.c @@ -377,12 +377,17 @@ static void updateWindowStyles(const _GLFWwindow* window) // static void updateFramebufferTransparency(const _GLFWwindow* window) { - BOOL enabled; + BOOL composition, opaque; + DWORD color; if (!IsWindowsVistaOrGreater()) return; - if (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled) + if (FAILED(DwmIsCompositionEnabled(&composition)) || !composition) + return; + + if (IsWindows8OrGreater() || + (SUCCEEDED(DwmGetColorizationColor(&color, &opaque)) && !opaque)) { HRGN region = CreateRectRgn(0, 0, -1, -1); DWM_BLURBEHIND bb = {0}; @@ -390,37 +395,18 @@ static void updateFramebufferTransparency(const _GLFWwindow* window) bb.hRgnBlur = region; bb.fEnable = TRUE; - if (SUCCEEDED(DwmEnableBlurBehindWindow(window->win32.handle, &bb))) - { - // Decorated windows don't repaint the transparent background - // leaving a trail behind animations - // HACK: Making the window layered with a transparency color key - // seems to fix this. Normally, when specifying - // a transparency color key to be used when composing the - // layered window, all pixels painted by the window in this - // color will be transparent. That doesn't seem to be the - // case anymore, at least when used with blur behind window - // plus negative region. - LONG exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE); - exStyle |= WS_EX_LAYERED; - SetWindowLongW(window->win32.handle, GWL_EXSTYLE, exStyle); - - // Using a color key not equal to black to fix the trailing - // issue. When set to black, something is making the hit test - // not resize with the window frame. - SetLayeredWindowAttributes(window->win32.handle, - RGB(255, 0, 255), 255, LWA_COLORKEY); - } - + DwmEnableBlurBehindWindow(window->win32.handle, &bb); DeleteObject(region); } else { - LONG exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE); - exStyle &= ~WS_EX_LAYERED; - SetWindowLongW(window->win32.handle, GWL_EXSTYLE, exStyle); - RedrawWindow(window->win32.handle, NULL, NULL, - RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); + // HACK: Disable framebuffer transparency on Windows 7 when the + // colorization color is opaque, because otherwise the window + // contents is blended additively with the previous frame instead + // of replacing it + DWM_BLURBEHIND bb = {0}; + bb.dwFlags = DWM_BB_ENABLE; + DwmEnableBlurBehindWindow(window->win32.handle, &bb); } } @@ -449,7 +435,7 @@ static int getKeyMods(void) static void fitToMonitor(_GLFWwindow* window) { MONITORINFO mi = { sizeof(mi) }; - GetMonitorInfo(window->monitor->win32.handle, &mi); + GetMonitorInfoW(window->monitor->win32.handle, &mi); SetWindowPos(window->win32.handle, HWND_TOPMOST, mi.rcMonitor.left, mi.rcMonitor.top, @@ -470,8 +456,8 @@ static void acquireMonitor(_GLFWwindow* window) // the OpenGL ICD switches to page flipping if (IsWindowsXPOrGreater()) { - SystemParametersInfo(SPI_GETMOUSETRAILS, 0, &_glfw.win32.mouseTrailSize, 0); - SystemParametersInfo(SPI_SETMOUSETRAILS, 0, 0, 0); + SystemParametersInfoW(SPI_GETMOUSETRAILS, 0, &_glfw.win32.mouseTrailSize, 0); + SystemParametersInfoW(SPI_SETMOUSETRAILS, 0, 0, 0); } } @@ -496,13 +482,63 @@ static void releaseMonitor(_GLFWwindow* window) // HACK: Restore mouse trail length saved in acquireMonitor if (IsWindowsXPOrGreater()) - SystemParametersInfo(SPI_SETMOUSETRAILS, _glfw.win32.mouseTrailSize, 0, 0); + SystemParametersInfoW(SPI_SETMOUSETRAILS, _glfw.win32.mouseTrailSize, 0, 0); } _glfwInputMonitorWindow(window->monitor, NULL); _glfwRestoreVideoModeWin32(window->monitor); } +// Manually maximize the window, for when SW_MAXIMIZE cannot be used +// +static void maximizeWindowManually(_GLFWwindow* window) +{ + RECT rect; + DWORD style; + MONITORINFO mi = { sizeof(mi) }; + + GetMonitorInfoW(MonitorFromWindow(window->win32.handle, + MONITOR_DEFAULTTONEAREST), &mi); + + rect = mi.rcWork; + + if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE) + { + rect.right = _glfw_min(rect.right, rect.left + window->maxwidth); + rect.bottom = _glfw_min(rect.bottom, rect.top + window->maxheight); + } + + style = GetWindowLongW(window->win32.handle, GWL_STYLE); + style |= WS_MAXIMIZE; + SetWindowLongW(window->win32.handle, GWL_STYLE, style); + + if (window->decorated) + { + const DWORD exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE); + + if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) + { + const UINT dpi = GetDpiForWindow(window->win32.handle); + AdjustWindowRectExForDpi(&rect, style, FALSE, exStyle, dpi); + OffsetRect(&rect, 0, GetSystemMetricsForDpi(SM_CYCAPTION, dpi)); + } + else + { + AdjustWindowRectEx(&rect, style, FALSE, exStyle); + OffsetRect(&rect, 0, GetSystemMetrics(SM_CYCAPTION)); + } + + rect.bottom = _glfw_min(rect.bottom, mi.rcWork.bottom); + } + + SetWindowPos(window->win32.handle, HWND_TOP, + rect.left, + rect.top, + rect.right - rect.left, + rect.bottom - rect.top, + SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED); +} + // Window callback function (handles window messages) // static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, @@ -519,7 +555,17 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, case WM_NCCREATE: { if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) - EnableNonClientDpiScaling(hWnd); + { + const CREATESTRUCTW* cs = (const CREATESTRUCTW*) lParam; + const _GLFWwndconfig* wndconfig = cs->lpCreateParams; + + // On per-monitor DPI aware V1 systems, only enable + // non-client scaling for windows that scale the client area + // We need WM_GETDPISCALEDSIZE from V2 to keep the client + // area static when the non-client area is scaled + if (wndconfig && wndconfig->scaleToMonitor) + EnableNonClientDpiScaling(hWnd); + } break; } @@ -645,11 +691,35 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, case WM_CHAR: case WM_SYSCHAR: - case WM_UNICHAR: { - const GLFWbool plain = (uMsg != WM_SYSCHAR); + if (wParam >= 0xd800 && wParam <= 0xdbff) + window->win32.highSurrogate = (WCHAR) wParam; + else + { + uint32_t codepoint = 0; - if (uMsg == WM_UNICHAR && wParam == UNICODE_NOCHAR) + if (wParam >= 0xdc00 && wParam <= 0xdfff) + { + if (window->win32.highSurrogate) + { + codepoint += (window->win32.highSurrogate - 0xd800) << 10; + codepoint += (WCHAR) wParam - 0xdc00; + codepoint += 0x10000; + } + } + else + codepoint = (WCHAR) wParam; + + window->win32.highSurrogate = 0; + _glfwInputChar(window, codepoint, getKeyMods(), uMsg != WM_SYSCHAR); + } + + return 0; + } + + case WM_UNICHAR: + { + if (wParam == UNICODE_NOCHAR) { // WM_UNICHAR is not sent by Windows, but is sent by some // third-party input method engine @@ -657,7 +727,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, return TRUE; } - _glfwInputChar(window, (unsigned int) wParam, getKeyMods(), plain); + _glfwInputChar(window, (uint32_t) wParam, getKeyMods(), GLFW_TRUE); return 0; } @@ -678,6 +748,18 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, scancode = MapVirtualKeyW((UINT) wParam, MAPVK_VK_TO_VSC); } + // HACK: Alt+PrtSc has a different scancode than just PrtSc + if (scancode == 0x54) + scancode = 0x137; + + // HACK: Ctrl+Pause has a different scancode than just Pause + if (scancode == 0x146) + scancode = 0x45; + + // HACK: CJK IME sets the extended bit for right Shift + if (scancode == 0x136) + scancode = 0x36; + key = _glfw.win32.keycodes[scancode]; // The Ctrl keys require special handling @@ -944,6 +1026,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, case WM_SIZE: { + const int width = LOWORD(lParam); + const int height = HIWORD(lParam); const GLFWbool iconified = wParam == SIZE_MINIMIZED; const GLFWbool maximized = wParam == SIZE_MAXIMIZED || (window->win32.maximized && @@ -958,8 +1042,14 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, if (window->win32.maximized != maximized) _glfwInputWindowMaximize(window, maximized); - _glfwInputFramebufferSize(window, LOWORD(lParam), HIWORD(lParam)); - _glfwInputWindowSize(window, LOWORD(lParam), HIWORD(lParam)); + if (width != window->win32.width || height != window->win32.height) + { + window->win32.width = width; + window->win32.height = height; + + _glfwInputFramebufferSize(window, width, height); + _glfwInputWindowSize(window, width, height); + } if (window->monitor && window->win32.iconified != iconified) { @@ -1039,7 +1129,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, ZeroMemory(&mi, sizeof(mi)); mi.cbSize = sizeof(mi); - GetMonitorInfo(mh, &mi); + GetMonitorInfoW(mh, &mi); mmi->ptMaxPosition.x = mi.rcWork.left - mi.rcMonitor.left; mmi->ptMaxPosition.y = mi.rcWork.top - mi.rcMonitor.top; @@ -1073,6 +1163,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, } case WM_DWMCOMPOSITIONCHANGED: + case WM_DWMCOLORIZATIONCOLORCHANGED: { if (window->win32.transparent) updateFramebufferTransparency(window); @@ -1112,9 +1203,11 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, const float xscale = HIWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI; const float yscale = LOWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI; - // Only apply the suggested size if the OS is new enough to have - // sent a WM_GETDPISCALEDSIZE before this - if (_glfwIsWindows10CreatorsUpdateOrGreaterWin32()) + // Resize windowed mode windows that either permit rescaling or that + // need it to compensate for non-client area scaling + if (!window->monitor && + (window->win32.scaleToMonitor || + _glfwIsWindows10CreatorsUpdateOrGreaterWin32())) { RECT* suggested = (RECT*) lParam; SetWindowPos(window->win32.handle, HWND_TOP, @@ -1191,15 +1284,16 @@ static int createNativeWindow(_GLFWwindow* window, if (window->monitor) { - GLFWvidmode mode; + MONITORINFO mi = { sizeof(mi) }; + GetMonitorInfoW(window->monitor->win32.handle, &mi); // NOTE: This window placement is temporary and approximate, as the // correct position and size cannot be known until the monitor // video mode has been picked in _glfwSetVideoModeWin32 - _glfwPlatformGetMonitorPos(window->monitor, &xpos, &ypos); - _glfwPlatformGetVideoMode(window->monitor, &mode); - fullWidth = mode.width; - fullHeight = mode.height; + xpos = mi.rcMonitor.left; + ypos = mi.rcMonitor.top; + fullWidth = mi.rcMonitor.right - mi.rcMonitor.left; + fullHeight = mi.rcMonitor.bottom - mi.rcMonitor.top; } else { @@ -1228,8 +1322,8 @@ static int createNativeWindow(_GLFWwindow* window, fullWidth, fullHeight, NULL, // No parent window NULL, // No window menu - GetModuleHandleW(NULL), - NULL); + _glfw.win32.instance, + (LPVOID) wndconfig); free(wideTitle); @@ -1254,24 +1348,29 @@ static int createNativeWindow(_GLFWwindow* window, window->win32.scaleToMonitor = wndconfig->scaleToMonitor; - // Adjust window rect to account for DPI scaling of the window frame and - // (if enabled) DPI scaling of the content area - // This cannot be done until we know what monitor the window was placed on if (!window->monitor) { RECT rect = { 0, 0, wndconfig->width, wndconfig->height }; WINDOWPLACEMENT wp = { sizeof(wp) }; + const HMONITOR mh = MonitorFromWindow(window->win32.handle, + MONITOR_DEFAULTTONEAREST); + + // Adjust window rect to account for DPI scaling of the window frame and + // (if enabled) DPI scaling of the content area + // This cannot be done until we know what monitor the window was placed on + // Only update the restored window rect as the window may be maximized if (wndconfig->scaleToMonitor) { float xscale, yscale; - _glfwPlatformGetWindowContentScale(window, &xscale, &yscale); - rect.right = (int) (rect.right * xscale); - rect.bottom = (int) (rect.bottom * yscale); - } + _glfwGetMonitorContentScaleWin32(mh, &xscale, &yscale); - ClientToScreen(window->win32.handle, (POINT*) &rect.left); - ClientToScreen(window->win32.handle, (POINT*) &rect.right); + if (xscale > 0.f && yscale > 0.f) + { + rect.right = (int) (rect.right * xscale); + rect.bottom = (int) (rect.bottom * yscale); + } + } if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) { @@ -1281,11 +1380,30 @@ static int createNativeWindow(_GLFWwindow* window, else AdjustWindowRectEx(&rect, style, FALSE, exStyle); - // Only update the restored window rect as the window may be maximized GetWindowPlacement(window->win32.handle, &wp); + OffsetRect(&rect, + wp.rcNormalPosition.left - rect.left, + wp.rcNormalPosition.top - rect.top); + wp.rcNormalPosition = rect; wp.showCmd = SW_HIDE; SetWindowPlacement(window->win32.handle, &wp); + + // Adjust rect of maximized undecorated window, because by default Windows will + // make such a window cover the whole monitor instead of its workarea + + if (wndconfig->maximized && !wndconfig->decorated) + { + MONITORINFO mi = { sizeof(mi) }; + GetMonitorInfoW(mh, &mi); + + SetWindowPos(window->win32.handle, HWND_TOP, + mi.rcWork.left, + mi.rcWork.top, + mi.rcWork.right - mi.rcWork.left, + mi.rcWork.bottom - mi.rcWork.top, + SWP_NOACTIVATE | SWP_NOZORDER); + } } DragAcceptFiles(window->win32.handle, TRUE); @@ -1296,6 +1414,8 @@ static int createNativeWindow(_GLFWwindow* window, window->win32.transparent = GLFW_TRUE; } + _glfwPlatformGetWindowSize(window, &window->win32.width, &window->win32.height); + return GLFW_TRUE; } @@ -1313,8 +1433,8 @@ GLFWbool _glfwRegisterWindowClassWin32(void) ZeroMemory(&wc, sizeof(wc)); wc.cbSize = sizeof(wc); wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; - wc.lpfnWndProc = (WNDPROC) windowProc; - wc.hInstance = GetModuleHandleW(NULL); + wc.lpfnWndProc = windowProc; + wc.hInstance = _glfw.win32.instance; wc.hCursor = LoadCursorW(NULL, IDC_ARROW); wc.lpszClassName = _GLFW_WNDCLASSNAME; @@ -1344,7 +1464,7 @@ GLFWbool _glfwRegisterWindowClassWin32(void) // void _glfwUnregisterWindowClassWin32(void) { - UnregisterClassW(_GLFW_WNDCLASSNAME, GetModuleHandleW(NULL)); + UnregisterClassW(_GLFW_WNDCLASSNAME, _glfw.win32.instance); } @@ -1383,6 +1503,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) return GLFW_FALSE; } + + if (!_glfwRefreshContextAttribs(window, ctxconfig)) + return GLFW_FALSE; } if (window->monitor) @@ -1391,6 +1514,18 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, _glfwPlatformFocusWindow(window); acquireMonitor(window); fitToMonitor(window); + + if (wndconfig->centerCursor) + _glfwCenterCursorInContentArea(window); + } + else + { + if (wndconfig->visible) + { + _glfwPlatformShowWindow(window); + if (wndconfig->focused) + _glfwPlatformFocusWindow(window); + } } return GLFW_TRUE; @@ -1454,8 +1589,8 @@ void _glfwPlatformSetWindowIcon(_GLFWwindow* window, smallIcon = (HICON) GetClassLongPtrW(window->win32.handle, GCLP_HICONSM); } - SendMessage(window->win32.handle, WM_SETICON, ICON_BIG, (LPARAM) bigIcon); - SendMessage(window->win32.handle, WM_SETICON, ICON_SMALL, (LPARAM) smallIcon); + SendMessageW(window->win32.handle, WM_SETICON, ICON_BIG, (LPARAM) bigIcon); + SendMessageW(window->win32.handle, WM_SETICON, ICON_SMALL, (LPARAM) smallIcon); if (window->win32.bigIcon) DestroyIcon(window->win32.bigIcon); @@ -1635,7 +1770,10 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window) void _glfwPlatformMaximizeWindow(_GLFWwindow* window) { - ShowWindow(window->win32.handle, SW_MAXIMIZE); + if (IsWindowVisible(window->win32.handle)) + ShowWindow(window->win32.handle, SW_MAXIMIZE); + else + maximizeWindowManually(window); } void _glfwPlatformShowWindow(_GLFWwindow* window) @@ -1722,7 +1860,7 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, acquireMonitor(window); - GetMonitorInfo(window->monitor->win32.handle, &mi); + GetMonitorInfoW(window->monitor->win32.handle, &mi); SetWindowPos(window->win32.handle, HWND_TOPMOST, mi.rcMonitor.left, mi.rcMonitor.top, @@ -1797,7 +1935,8 @@ int _glfwPlatformWindowHovered(_GLFWwindow* window) int _glfwPlatformFramebufferTransparent(_GLFWwindow* window) { - BOOL enabled; + BOOL composition, opaque; + DWORD color; if (!window->win32.transparent) return GLFW_FALSE; @@ -1805,7 +1944,20 @@ int _glfwPlatformFramebufferTransparent(_GLFWwindow* window) if (!IsWindowsVistaOrGreater()) return GLFW_FALSE; - return SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled; + if (FAILED(DwmIsCompositionEnabled(&composition)) || !composition) + return GLFW_FALSE; + + if (!IsWindows8OrGreater()) + { + // HACK: Disable framebuffer transparency on Windows 7 when the + // colorization color is opaque, because otherwise the window + // contents is blended additively with the previous frame instead + // of replacing it + if (FAILED(DwmGetColorizationColor(&color, &opaque)) || opaque) + return GLFW_FALSE; + } + + return GLFW_TRUE; } void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled) @@ -1972,7 +2124,7 @@ void _glfwPlatformWaitEventsTimeout(double timeout) void _glfwPlatformPostEmptyEvent(void) { - PostMessage(_glfw.win32.helperWindowHandle, WM_NULL, 0, 0); + PostMessageW(_glfw.win32.helperWindowHandle, WM_NULL, 0, 0); } void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos) @@ -2020,7 +2172,7 @@ const char* _glfwPlatformGetScancodeName(int scancode) if (scancode < 0 || scancode > (KF_EXTENDED | 0xff) || _glfw.win32.keycodes[scancode] == GLFW_KEY_UNKNOWN) { - _glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode"); + _glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode); return NULL; } @@ -2216,7 +2368,7 @@ VkResult _glfwPlatformCreateWindowSurface(VkInstance instance, memset(&sci, 0, sizeof(sci)); sci.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; - sci.hinstance = GetModuleHandle(NULL); + sci.hinstance = _glfw.win32.instance; sci.hwnd = window->win32.handle; err = vkCreateWin32SurfaceKHR(instance, &sci, allocator, surface); diff --git a/third_party/penumbra/vendor/glfw/src/window.c b/third_party/penumbra/vendor/glfw/src/window.c index 4b356b21677..5d80e43656c 100644 --- a/third_party/penumbra/vendor/glfw/src/window.c +++ b/third_party/penumbra/vendor/glfw/src/window.c @@ -205,6 +205,8 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, window->focusOnShow = wndconfig.focusOnShow; window->cursorMode = GLFW_CURSOR_NORMAL; + window->doublebuffer = fbconfig.doublebuffer; + window->minwidth = GLFW_DONT_CARE; window->minheight = GLFW_DONT_CARE; window->maxwidth = GLFW_DONT_CARE; @@ -219,30 +221,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, return NULL; } - if (ctxconfig.client != GLFW_NO_API) - { - if (!_glfwRefreshContextAttribs(window, &ctxconfig)) - { - glfwDestroyWindow((GLFWwindow*) window); - return NULL; - } - } - - if (window->monitor) - { - if (wndconfig.centerCursor) - _glfwCenterCursorInContentArea(window); - } - else - { - if (wndconfig.visible) - { - _glfwPlatformShowWindow(window); - if (wndconfig.focused) - _glfwPlatformFocusWindow(window); - } - } - return (GLFWwindow*) window; } @@ -502,12 +480,33 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* handle, const char* title) GLFWAPI void glfwSetWindowIcon(GLFWwindow* handle, int count, const GLFWimage* images) { + int i; _GLFWwindow* window = (_GLFWwindow*) handle; + assert(window != NULL); assert(count >= 0); assert(count == 0 || images != NULL); _GLFW_REQUIRE_INIT(); + + if (count < 0) + { + _glfwInputError(GLFW_INVALID_VALUE, "Invalid image count for window icon"); + return; + } + + for (i = 0; i < count; i++) + { + assert(images[i].pixels != NULL); + + if (images[i].width <= 0 || images[i].height <= 0) + { + _glfwInputError(GLFW_INVALID_VALUE, + "Invalid image dimensions for window icon"); + return; + } + } + _glfwPlatformSetWindowIcon(window, count, images); } @@ -1099,3 +1098,4 @@ GLFWAPI void glfwPostEmptyEvent(void) _GLFW_REQUIRE_INIT(); _glfwPlatformPostEmptyEvent(); } + diff --git a/third_party/penumbra/vendor/glfw/src/wl_init.c b/third_party/penumbra/vendor/glfw/src/wl_init.c index 97b53673f17..e041d261400 100644 --- a/third_party/penumbra/vendor/glfw/src/wl_init.c +++ b/third_party/penumbra/vendor/glfw/src/wl_init.c @@ -26,9 +26,10 @@ // It is fine to use C99 in this file because it will not be built with VS //======================================================================== +#define _POSIX_C_SOURCE 200809L + #include "internal.h" -#include #include #include #include @@ -40,753 +41,19 @@ #include #include - -static inline int min(int n1, int n2) -{ - return n1 < n2 ? n1 : n2; -} - -static _GLFWwindow* findWindowFromDecorationSurface(struct wl_surface* surface, - int* which) -{ - int focus; - _GLFWwindow* window = _glfw.windowListHead; - if (!which) - which = &focus; - while (window) - { - if (surface == window->wl.decorations.top.surface) - { - *which = topDecoration; - break; - } - if (surface == window->wl.decorations.left.surface) - { - *which = leftDecoration; - break; - } - if (surface == window->wl.decorations.right.surface) - { - *which = rightDecoration; - break; - } - if (surface == window->wl.decorations.bottom.surface) - { - *which = bottomDecoration; - break; - } - window = window->next; - } - return window; -} - -static void pointerHandleEnter(void* data, - struct wl_pointer* pointer, - uint32_t serial, - struct wl_surface* surface, - wl_fixed_t sx, - wl_fixed_t sy) -{ - // Happens in the case we just destroyed the surface. - if (!surface) - return; - - int focus = 0; - _GLFWwindow* window = wl_surface_get_user_data(surface); - if (!window) - { - window = findWindowFromDecorationSurface(surface, &focus); - if (!window) - return; - } - - window->wl.decorations.focus = focus; - _glfw.wl.serial = serial; - _glfw.wl.pointerFocus = window; - - window->wl.hovered = GLFW_TRUE; - - _glfwPlatformSetCursor(window, window->wl.currentCursor); - _glfwInputCursorEnter(window, GLFW_TRUE); -} - -static void pointerHandleLeave(void* data, - struct wl_pointer* pointer, - uint32_t serial, - struct wl_surface* surface) -{ - _GLFWwindow* window = _glfw.wl.pointerFocus; - - if (!window) - return; - - window->wl.hovered = GLFW_FALSE; - - _glfw.wl.serial = serial; - _glfw.wl.pointerFocus = NULL; - _glfwInputCursorEnter(window, GLFW_FALSE); - _glfw.wl.cursorPreviousName = NULL; -} - -static void setCursor(_GLFWwindow* window, const char* name) -{ - struct wl_buffer* buffer; - struct wl_cursor* cursor; - struct wl_cursor_image* image; - struct wl_surface* surface = _glfw.wl.cursorSurface; - struct wl_cursor_theme* theme = _glfw.wl.cursorTheme; - int scale = 1; - - if (window->wl.scale > 1 && _glfw.wl.cursorThemeHiDPI) - { - // We only support up to scale=2 for now, since libwayland-cursor - // requires us to load a different theme for each size. - scale = 2; - theme = _glfw.wl.cursorThemeHiDPI; - } - - cursor = wl_cursor_theme_get_cursor(theme, name); - if (!cursor) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Standard cursor not found"); - return; - } - // TODO: handle animated cursors too. - image = cursor->images[0]; - - if (!image) - return; - - buffer = wl_cursor_image_get_buffer(image); - if (!buffer) - return; - wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, - surface, - image->hotspot_x / scale, - image->hotspot_y / scale); - wl_surface_set_buffer_scale(surface, scale); - wl_surface_attach(surface, buffer, 0, 0); - wl_surface_damage(surface, 0, 0, - image->width, image->height); - wl_surface_commit(surface); - _glfw.wl.cursorPreviousName = name; -} - -static void pointerHandleMotion(void* data, - struct wl_pointer* pointer, - uint32_t time, - wl_fixed_t sx, - wl_fixed_t sy) -{ - _GLFWwindow* window = _glfw.wl.pointerFocus; - const char* cursorName = NULL; - double x, y; - - if (!window) - return; - - if (window->cursorMode == GLFW_CURSOR_DISABLED) - return; - x = wl_fixed_to_double(sx); - y = wl_fixed_to_double(sy); - - switch (window->wl.decorations.focus) - { - case mainWindow: - window->wl.cursorPosX = x; - window->wl.cursorPosY = y; - _glfwInputCursorPos(window, x, y); - _glfw.wl.cursorPreviousName = NULL; - return; - case topDecoration: - if (y < _GLFW_DECORATION_WIDTH) - cursorName = "n-resize"; - else - cursorName = "left_ptr"; - break; - case leftDecoration: - if (y < _GLFW_DECORATION_WIDTH) - cursorName = "nw-resize"; - else - cursorName = "w-resize"; - break; - case rightDecoration: - if (y < _GLFW_DECORATION_WIDTH) - cursorName = "ne-resize"; - else - cursorName = "e-resize"; - break; - case bottomDecoration: - if (x < _GLFW_DECORATION_WIDTH) - cursorName = "sw-resize"; - else if (x > window->wl.width + _GLFW_DECORATION_WIDTH) - cursorName = "se-resize"; - else - cursorName = "s-resize"; - break; - default: - assert(0); - } - if (_glfw.wl.cursorPreviousName != cursorName) - setCursor(window, cursorName); -} - -static void pointerHandleButton(void* data, - struct wl_pointer* pointer, - uint32_t serial, - uint32_t time, - uint32_t button, - uint32_t state) -{ - _GLFWwindow* window = _glfw.wl.pointerFocus; - int glfwButton; - - // Both xdg-shell and wl_shell use the same values. - uint32_t edges = WL_SHELL_SURFACE_RESIZE_NONE; - - if (!window) - return; - if (button == BTN_LEFT) - { - switch (window->wl.decorations.focus) - { - case mainWindow: - break; - case topDecoration: - if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH) - edges = WL_SHELL_SURFACE_RESIZE_TOP; - else - { - if (window->wl.xdg.toplevel) - xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial); - else - wl_shell_surface_move(window->wl.shellSurface, _glfw.wl.seat, serial); - } - break; - case leftDecoration: - if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH) - edges = WL_SHELL_SURFACE_RESIZE_TOP_LEFT; - else - edges = WL_SHELL_SURFACE_RESIZE_LEFT; - break; - case rightDecoration: - if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH) - edges = WL_SHELL_SURFACE_RESIZE_TOP_RIGHT; - else - edges = WL_SHELL_SURFACE_RESIZE_RIGHT; - break; - case bottomDecoration: - if (window->wl.cursorPosX < _GLFW_DECORATION_WIDTH) - edges = WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT; - else if (window->wl.cursorPosX > window->wl.width + _GLFW_DECORATION_WIDTH) - edges = WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT; - else - edges = WL_SHELL_SURFACE_RESIZE_BOTTOM; - break; - default: - assert(0); - } - if (edges != WL_SHELL_SURFACE_RESIZE_NONE) - { - if (window->wl.xdg.toplevel) - xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat, - serial, edges); - else - wl_shell_surface_resize(window->wl.shellSurface, _glfw.wl.seat, - serial, edges); - } - } - else if (button == BTN_RIGHT) - { - if (window->wl.decorations.focus != mainWindow && window->wl.xdg.toplevel) - { - xdg_toplevel_show_window_menu(window->wl.xdg.toplevel, - _glfw.wl.seat, serial, - window->wl.cursorPosX, - window->wl.cursorPosY); - return; - } - } - - // Don’t pass the button to the user if it was related to a decoration. - if (window->wl.decorations.focus != mainWindow) - return; - - _glfw.wl.serial = serial; - - /* Makes left, right and middle 0, 1 and 2. Overall order follows evdev - * codes. */ - glfwButton = button - BTN_LEFT; - - _glfwInputMouseClick(window, - glfwButton, - state == WL_POINTER_BUTTON_STATE_PRESSED - ? GLFW_PRESS - : GLFW_RELEASE, - _glfw.wl.xkb.modifiers); -} - -static void pointerHandleAxis(void* data, - struct wl_pointer* pointer, - uint32_t time, - uint32_t axis, - wl_fixed_t value) -{ - _GLFWwindow* window = _glfw.wl.pointerFocus; - double x = 0.0, y = 0.0; - // Wayland scroll events are in pointer motion coordinate space (think two - // finger scroll). The factor 10 is commonly used to convert to "scroll - // step means 1.0. - const double scrollFactor = 1.0 / 10.0; - - if (!window) - return; - - assert(axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL || - axis == WL_POINTER_AXIS_VERTICAL_SCROLL); - - if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) - x = wl_fixed_to_double(value) * scrollFactor; - else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL) - y = wl_fixed_to_double(value) * scrollFactor; - - _glfwInputScroll(window, x, y); -} - -static const struct wl_pointer_listener pointerListener = { - pointerHandleEnter, - pointerHandleLeave, - pointerHandleMotion, - pointerHandleButton, - pointerHandleAxis, -}; - -static void keyboardHandleKeymap(void* data, - struct wl_keyboard* keyboard, - uint32_t format, - int fd, - uint32_t size) -{ - struct xkb_keymap* keymap; - struct xkb_state* state; - -#ifdef HAVE_XKBCOMMON_COMPOSE_H - struct xkb_compose_table* composeTable; - struct xkb_compose_state* composeState; -#endif - - char* mapStr; - const char* locale; - - if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) - { - close(fd); - return; - } - - mapStr = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); - if (mapStr == MAP_FAILED) { - close(fd); - return; - } - - keymap = xkb_keymap_new_from_string(_glfw.wl.xkb.context, - mapStr, - XKB_KEYMAP_FORMAT_TEXT_V1, - 0); - munmap(mapStr, size); - close(fd); - - if (!keymap) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Failed to compile keymap"); - return; - } - - state = xkb_state_new(keymap); - if (!state) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Failed to create XKB state"); - xkb_keymap_unref(keymap); - return; - } - - // Look up the preferred locale, falling back to "C" as default. - locale = getenv("LC_ALL"); - if (!locale) - locale = getenv("LC_CTYPE"); - if (!locale) - locale = getenv("LANG"); - if (!locale) - locale = "C"; - -#ifdef HAVE_XKBCOMMON_COMPOSE_H - composeTable = - xkb_compose_table_new_from_locale(_glfw.wl.xkb.context, locale, - XKB_COMPOSE_COMPILE_NO_FLAGS); - if (composeTable) - { - composeState = - xkb_compose_state_new(composeTable, XKB_COMPOSE_STATE_NO_FLAGS); - xkb_compose_table_unref(composeTable); - if (composeState) - _glfw.wl.xkb.composeState = composeState; - else - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Failed to create XKB compose state"); - } - else - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Failed to create XKB compose table"); - } -#endif - - xkb_keymap_unref(_glfw.wl.xkb.keymap); - xkb_state_unref(_glfw.wl.xkb.state); - _glfw.wl.xkb.keymap = keymap; - _glfw.wl.xkb.state = state; - - _glfw.wl.xkb.controlMask = - 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Control"); - _glfw.wl.xkb.altMask = - 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod1"); - _glfw.wl.xkb.shiftMask = - 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Shift"); - _glfw.wl.xkb.superMask = - 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod4"); - _glfw.wl.xkb.capsLockMask = - 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Lock"); - _glfw.wl.xkb.numLockMask = - 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod2"); -} - -static void keyboardHandleEnter(void* data, - struct wl_keyboard* keyboard, - uint32_t serial, - struct wl_surface* surface, - struct wl_array* keys) -{ - // Happens in the case we just destroyed the surface. - if (!surface) - return; - - _GLFWwindow* window = wl_surface_get_user_data(surface); - if (!window) - { - window = findWindowFromDecorationSurface(surface, NULL); - if (!window) - return; - } - - _glfw.wl.serial = serial; - _glfw.wl.keyboardFocus = window; - _glfwInputWindowFocus(window, GLFW_TRUE); -} - -static void keyboardHandleLeave(void* data, - struct wl_keyboard* keyboard, - uint32_t serial, - struct wl_surface* surface) -{ - _GLFWwindow* window = _glfw.wl.keyboardFocus; - - if (!window) - return; - - _glfw.wl.serial = serial; - _glfw.wl.keyboardFocus = NULL; - _glfwInputWindowFocus(window, GLFW_FALSE); -} - -static int toGLFWKeyCode(uint32_t key) -{ - if (key < sizeof(_glfw.wl.keycodes) / sizeof(_glfw.wl.keycodes[0])) - return _glfw.wl.keycodes[key]; - - return GLFW_KEY_UNKNOWN; -} - -#ifdef HAVE_XKBCOMMON_COMPOSE_H -static xkb_keysym_t composeSymbol(xkb_keysym_t sym) -{ - if (sym == XKB_KEY_NoSymbol || !_glfw.wl.xkb.composeState) - return sym; - if (xkb_compose_state_feed(_glfw.wl.xkb.composeState, sym) - != XKB_COMPOSE_FEED_ACCEPTED) - return sym; - switch (xkb_compose_state_get_status(_glfw.wl.xkb.composeState)) - { - case XKB_COMPOSE_COMPOSED: - return xkb_compose_state_get_one_sym(_glfw.wl.xkb.composeState); - case XKB_COMPOSE_COMPOSING: - case XKB_COMPOSE_CANCELLED: - return XKB_KEY_NoSymbol; - case XKB_COMPOSE_NOTHING: - default: - return sym; - } -} -#endif - -static GLFWbool inputChar(_GLFWwindow* window, uint32_t key) -{ - uint32_t code, numSyms; - long cp; - const xkb_keysym_t *syms; - xkb_keysym_t sym; - - code = key + 8; - numSyms = xkb_state_key_get_syms(_glfw.wl.xkb.state, code, &syms); - - if (numSyms == 1) - { -#ifdef HAVE_XKBCOMMON_COMPOSE_H - sym = composeSymbol(syms[0]); -#else - sym = syms[0]; -#endif - cp = _glfwKeySym2Unicode(sym); - if (cp != -1) - { - const int mods = _glfw.wl.xkb.modifiers; - const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT)); - _glfwInputChar(window, cp, mods, plain); - } - } - - return xkb_keymap_key_repeats(_glfw.wl.xkb.keymap, syms[0]); -} - -static void keyboardHandleKey(void* data, - struct wl_keyboard* keyboard, - uint32_t serial, - uint32_t time, - uint32_t key, - uint32_t state) -{ - int keyCode; - int action; - _GLFWwindow* window = _glfw.wl.keyboardFocus; - GLFWbool shouldRepeat; - struct itimerspec timer = {}; - - if (!window) - return; - - keyCode = toGLFWKeyCode(key); - action = state == WL_KEYBOARD_KEY_STATE_PRESSED - ? GLFW_PRESS : GLFW_RELEASE; - - _glfw.wl.serial = serial; - _glfwInputKey(window, keyCode, key, action, - _glfw.wl.xkb.modifiers); - - if (action == GLFW_PRESS) - { - shouldRepeat = inputChar(window, key); - - if (shouldRepeat && _glfw.wl.keyboardRepeatRate > 0) - { - _glfw.wl.keyboardLastKey = keyCode; - _glfw.wl.keyboardLastScancode = key; - if (_glfw.wl.keyboardRepeatRate > 1) - timer.it_interval.tv_nsec = 1000000000 / _glfw.wl.keyboardRepeatRate; - else - timer.it_interval.tv_sec = 1; - timer.it_value.tv_sec = _glfw.wl.keyboardRepeatDelay / 1000; - timer.it_value.tv_nsec = (_glfw.wl.keyboardRepeatDelay % 1000) * 1000000; - } - } - timerfd_settime(_glfw.wl.timerfd, 0, &timer, NULL); -} - -static void keyboardHandleModifiers(void* data, - struct wl_keyboard* keyboard, - uint32_t serial, - uint32_t modsDepressed, - uint32_t modsLatched, - uint32_t modsLocked, - uint32_t group) -{ - xkb_mod_mask_t mask; - unsigned int modifiers = 0; - - _glfw.wl.serial = serial; - - if (!_glfw.wl.xkb.keymap) - return; - - xkb_state_update_mask(_glfw.wl.xkb.state, - modsDepressed, - modsLatched, - modsLocked, - 0, - 0, - group); - - mask = xkb_state_serialize_mods(_glfw.wl.xkb.state, - XKB_STATE_MODS_DEPRESSED | - XKB_STATE_LAYOUT_DEPRESSED | - XKB_STATE_MODS_LATCHED | - XKB_STATE_LAYOUT_LATCHED); - if (mask & _glfw.wl.xkb.controlMask) - modifiers |= GLFW_MOD_CONTROL; - if (mask & _glfw.wl.xkb.altMask) - modifiers |= GLFW_MOD_ALT; - if (mask & _glfw.wl.xkb.shiftMask) - modifiers |= GLFW_MOD_SHIFT; - if (mask & _glfw.wl.xkb.superMask) - modifiers |= GLFW_MOD_SUPER; - if (mask & _glfw.wl.xkb.capsLockMask) - modifiers |= GLFW_MOD_CAPS_LOCK; - if (mask & _glfw.wl.xkb.numLockMask) - modifiers |= GLFW_MOD_NUM_LOCK; - _glfw.wl.xkb.modifiers = modifiers; -} - -#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION -static void keyboardHandleRepeatInfo(void* data, - struct wl_keyboard* keyboard, - int32_t rate, - int32_t delay) -{ - if (keyboard != _glfw.wl.keyboard) - return; - - _glfw.wl.keyboardRepeatRate = rate; - _glfw.wl.keyboardRepeatDelay = delay; -} -#endif - -static const struct wl_keyboard_listener keyboardListener = { - keyboardHandleKeymap, - keyboardHandleEnter, - keyboardHandleLeave, - keyboardHandleKey, - keyboardHandleModifiers, -#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION - keyboardHandleRepeatInfo, -#endif -}; - -static void seatHandleCapabilities(void* data, - struct wl_seat* seat, - enum wl_seat_capability caps) -{ - if ((caps & WL_SEAT_CAPABILITY_POINTER) && !_glfw.wl.pointer) - { - _glfw.wl.pointer = wl_seat_get_pointer(seat); - wl_pointer_add_listener(_glfw.wl.pointer, &pointerListener, NULL); - } - else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && _glfw.wl.pointer) - { - wl_pointer_destroy(_glfw.wl.pointer); - _glfw.wl.pointer = NULL; - } - - if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !_glfw.wl.keyboard) - { - _glfw.wl.keyboard = wl_seat_get_keyboard(seat); - wl_keyboard_add_listener(_glfw.wl.keyboard, &keyboardListener, NULL); - } - else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && _glfw.wl.keyboard) - { - wl_keyboard_destroy(_glfw.wl.keyboard); - _glfw.wl.keyboard = NULL; - } -} - -static void seatHandleName(void* data, - struct wl_seat* seat, - const char* name) -{ -} - -static const struct wl_seat_listener seatListener = { - seatHandleCapabilities, - seatHandleName, -}; - -static void dataOfferHandleOffer(void* data, - struct wl_data_offer* dataOffer, - const char* mimeType) -{ -} - -static const struct wl_data_offer_listener dataOfferListener = { - dataOfferHandleOffer, -}; - -static void dataDeviceHandleDataOffer(void* data, - struct wl_data_device* dataDevice, - struct wl_data_offer* id) -{ - if (_glfw.wl.dataOffer) - wl_data_offer_destroy(_glfw.wl.dataOffer); - - _glfw.wl.dataOffer = id; - wl_data_offer_add_listener(_glfw.wl.dataOffer, &dataOfferListener, NULL); -} - -static void dataDeviceHandleEnter(void* data, - struct wl_data_device* dataDevice, - uint32_t serial, - struct wl_surface *surface, - wl_fixed_t x, - wl_fixed_t y, - struct wl_data_offer *id) -{ -} - -static void dataDeviceHandleLeave(void* data, - struct wl_data_device* dataDevice) -{ -} - -static void dataDeviceHandleMotion(void* data, - struct wl_data_device* dataDevice, - uint32_t time, - wl_fixed_t x, - wl_fixed_t y) -{ -} - -static void dataDeviceHandleDrop(void* data, - struct wl_data_device* dataDevice) -{ -} - -static void dataDeviceHandleSelection(void* data, - struct wl_data_device* dataDevice, - struct wl_data_offer* id) -{ -} - -static const struct wl_data_device_listener dataDeviceListener = { - dataDeviceHandleDataOffer, - dataDeviceHandleEnter, - dataDeviceHandleLeave, - dataDeviceHandleMotion, - dataDeviceHandleDrop, - dataDeviceHandleSelection, -}; - -static void wmBaseHandlePing(void* data, +static void wmBaseHandlePing(void* userData, struct xdg_wm_base* wmBase, uint32_t serial) { xdg_wm_base_pong(wmBase, serial); } -static const struct xdg_wm_base_listener wmBaseListener = { +static const struct xdg_wm_base_listener wmBaseListener = +{ wmBaseHandlePing }; -static void registryHandleGlobal(void* data, +static void registryHandleGlobal(void* userData, struct wl_registry* registry, uint32_t name, const char* interface, @@ -794,7 +61,7 @@ static void registryHandleGlobal(void* data, { if (strcmp(interface, "wl_compositor") == 0) { - _glfw.wl.compositorVersion = min(3, version); + _glfw.wl.compositorVersion = _glfw_min(3, version); _glfw.wl.compositor = wl_registry_bind(registry, name, &wl_compositor_interface, _glfw.wl.compositorVersion); @@ -809,11 +76,6 @@ static void registryHandleGlobal(void* data, _glfw.wl.shm = wl_registry_bind(registry, name, &wl_shm_interface, 1); } - else if (strcmp(interface, "wl_shell") == 0) - { - _glfw.wl.shell = - wl_registry_bind(registry, name, &wl_shell_interface, 1); - } else if (strcmp(interface, "wl_output") == 0) { _glfwAddOutputWayland(name, version); @@ -822,11 +84,11 @@ static void registryHandleGlobal(void* data, { if (!_glfw.wl.seat) { - _glfw.wl.seatVersion = min(4, version); + _glfw.wl.seatVersion = _glfw_min(4, version); _glfw.wl.seat = wl_registry_bind(registry, name, &wl_seat_interface, _glfw.wl.seatVersion); - wl_seat_add_listener(_glfw.wl.seat, &seatListener, NULL); + _glfwAddSeatListenerWayland(_glfw.wl.seat); } } else if (strcmp(interface, "wl_data_device_manager") == 0) @@ -879,16 +141,15 @@ static void registryHandleGlobal(void* data, } } -static void registryHandleGlobalRemove(void *data, - struct wl_registry *registry, +static void registryHandleGlobalRemove(void* userData, + struct wl_registry* registry, uint32_t name) { int i; - _GLFWmonitor* monitor; for (i = 0; i < _glfw.monitorCount; ++i) { - monitor = _glfw.monitors[i]; + _GLFWmonitor* monitor = _glfw.monitors[i]; if (monitor->wl.name == name) { _glfwInputMonitor(monitor, GLFW_DISCONNECTED, 0); @@ -898,7 +159,8 @@ static void registryHandleGlobalRemove(void *data, } -static const struct wl_registry_listener registryListener = { +static const struct wl_registry_listener registryListener = +{ registryHandleGlobal, registryHandleGlobalRemove }; @@ -970,7 +232,7 @@ static void createKeyTables(void) _glfw.wl.keycodes[KEY_RIGHTALT] = GLFW_KEY_RIGHT_ALT; _glfw.wl.keycodes[KEY_LEFTMETA] = GLFW_KEY_LEFT_SUPER; _glfw.wl.keycodes[KEY_RIGHTMETA] = GLFW_KEY_RIGHT_SUPER; - _glfw.wl.keycodes[KEY_MENU] = GLFW_KEY_MENU; + _glfw.wl.keycodes[KEY_COMPOSE] = GLFW_KEY_MENU; _glfw.wl.keycodes[KEY_NUMLOCK] = GLFW_KEY_NUM_LOCK; _glfw.wl.keycodes[KEY_CAPSLOCK] = GLFW_KEY_CAPS_LOCK; _glfw.wl.keycodes[KEY_PRINT] = GLFW_KEY_PRINT_SCREEN; @@ -1013,7 +275,7 @@ static void createKeyTables(void) _glfw.wl.keycodes[KEY_F23] = GLFW_KEY_F23; _glfw.wl.keycodes[KEY_F24] = GLFW_KEY_F24; _glfw.wl.keycodes[KEY_KPSLASH] = GLFW_KEY_KP_DIVIDE; - _glfw.wl.keycodes[KEY_KPDOT] = GLFW_KEY_KP_MULTIPLY; + _glfw.wl.keycodes[KEY_KPASTERISK] = GLFW_KEY_KP_MULTIPLY; _glfw.wl.keycodes[KEY_KPMINUS] = GLFW_KEY_KP_SUBTRACT; _glfw.wl.keycodes[KEY_KPPLUS] = GLFW_KEY_KP_ADD; _glfw.wl.keycodes[KEY_KP0] = GLFW_KEY_KP_0; @@ -1026,9 +288,10 @@ static void createKeyTables(void) _glfw.wl.keycodes[KEY_KP7] = GLFW_KEY_KP_7; _glfw.wl.keycodes[KEY_KP8] = GLFW_KEY_KP_8; _glfw.wl.keycodes[KEY_KP9] = GLFW_KEY_KP_9; - _glfw.wl.keycodes[KEY_KPCOMMA] = GLFW_KEY_KP_DECIMAL; + _glfw.wl.keycodes[KEY_KPDOT] = GLFW_KEY_KP_DECIMAL; _glfw.wl.keycodes[KEY_KPEQUAL] = GLFW_KEY_KP_EQUAL; _glfw.wl.keycodes[KEY_KPENTER] = GLFW_KEY_KP_ENTER; + _glfw.wl.keycodes[KEY_102ND] = GLFW_KEY_WORLD_2; for (scancode = 0; scancode < 256; scancode++) { @@ -1044,17 +307,21 @@ static void createKeyTables(void) int _glfwPlatformInit(void) { - const char *cursorTheme; - const char *cursorSizeStr; - char *cursorSizeEnd; + const char* cursorTheme; + const char* cursorSizeStr; + char* cursorSizeEnd; long cursorSizeLong; int cursorSize; + // These must be set before any failure checks + _glfw.wl.timerfd = -1; + _glfw.wl.cursorTimerfd = -1; + _glfw.wl.cursor.handle = _glfw_dlopen("libwayland-cursor.so.0"); if (!_glfw.wl.cursor.handle) { _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Failed to open libwayland-cursor"); + "Wayland: Failed to load libwayland-cursor"); return GLFW_FALSE; } @@ -1071,7 +338,7 @@ int _glfwPlatformInit(void) if (!_glfw.wl.egl.handle) { _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Failed to open libwayland-egl"); + "Wayland: Failed to load libwayland-egl"); return GLFW_FALSE; } @@ -1086,7 +353,7 @@ int _glfwPlatformInit(void) if (!_glfw.wl.xkb.handle) { _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Failed to open libxkbcommon"); + "Wayland: Failed to load libxkbcommon"); return GLFW_FALSE; } @@ -1102,6 +369,8 @@ int _glfwPlatformInit(void) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_mod_get_index"); _glfw.wl.xkb.keymap_key_repeats = (PFN_xkb_keymap_key_repeats) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_key_repeats"); + _glfw.wl.xkb.keymap_key_get_syms_by_level = (PFN_xkb_keymap_key_get_syms_by_level) + _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_key_get_syms_by_level"); _glfw.wl.xkb.state_new = (PFN_xkb_state_new) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_new"); _glfw.wl.xkb.state_unref = (PFN_xkb_state_unref) @@ -1110,10 +379,11 @@ int _glfwPlatformInit(void) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_key_get_syms"); _glfw.wl.xkb.state_update_mask = (PFN_xkb_state_update_mask) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_update_mask"); - _glfw.wl.xkb.state_serialize_mods = (PFN_xkb_state_serialize_mods) - _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_serialize_mods"); + _glfw.wl.xkb.state_key_get_layout = (PFN_xkb_state_key_get_layout) + _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_key_get_layout"); + _glfw.wl.xkb.state_mod_index_is_active = (PFN_xkb_state_mod_index_is_active) + _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_mod_index_is_active"); -#ifdef HAVE_XKBCOMMON_COMPOSE_H _glfw.wl.xkb.compose_table_new_from_locale = (PFN_xkb_compose_table_new_from_locale) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_table_new_from_locale"); _glfw.wl.xkb.compose_table_unref = (PFN_xkb_compose_table_unref) @@ -1128,7 +398,6 @@ int _glfwPlatformInit(void) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_get_status"); _glfw.wl.xkb.compose_state_get_one_sym = (PFN_xkb_compose_state_get_one_sym) _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_get_one_sym"); -#endif _glfw.wl.display = wl_display_connect(NULL); if (!_glfw.wl.display) @@ -1164,9 +433,17 @@ int _glfwPlatformInit(void) _glfwInitTimerPOSIX(); - _glfw.wl.timerfd = -1; - if (_glfw.wl.seatVersion >= 4) - _glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC); +#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION + if (_glfw.wl.seatVersion >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) + _glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK); +#endif + + if (!_glfw.wl.wmBase) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to find xdg-shell in your compositor"); + return GLFW_FALSE; + } if (_glfw.wl.pointer && _glfw.wl.shm) { @@ -1185,7 +462,7 @@ int _glfwPlatformInit(void) if (!_glfw.wl.cursorTheme) { _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Unable to load default cursor theme"); + "Wayland: Failed to load default cursor theme"); return GLFW_FALSE; } // If this happens to be NULL, we just fallback to the scale=1 version. @@ -1193,7 +470,7 @@ int _glfwPlatformInit(void) wl_cursor_theme_load(cursorTheme, 2 * cursorSize, _glfw.wl.shm); _glfw.wl.cursorSurface = wl_compositor_create_surface(_glfw.wl.compositor); - _glfw.wl.cursorTimerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC); + _glfw.wl.cursorTimerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK); } if (_glfw.wl.seat && _glfw.wl.dataDeviceManager) @@ -1201,15 +478,7 @@ int _glfwPlatformInit(void) _glfw.wl.dataDevice = wl_data_device_manager_get_data_device(_glfw.wl.dataDeviceManager, _glfw.wl.seat); - wl_data_device_add_listener(_glfw.wl.dataDevice, &dataDeviceListener, NULL); - _glfw.wl.clipboardString = malloc(4096); - if (!_glfw.wl.clipboardString) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Unable to allocate clipboard memory"); - return GLFW_FALSE; - } - _glfw.wl.clipboardSize = 4096; + _glfwAddDataDeviceListenerWayland(_glfw.wl.dataDevice); } return GLFW_TRUE; @@ -1221,16 +490,16 @@ void _glfwPlatformTerminate(void) _glfwTerminateJoysticksLinux(); #endif _glfwTerminateEGL(); + _glfwTerminateOSMesa(); + if (_glfw.wl.egl.handle) { _glfw_dlclose(_glfw.wl.egl.handle); _glfw.wl.egl.handle = NULL; } -#ifdef HAVE_XKBCOMMON_COMPOSE_H if (_glfw.wl.xkb.composeState) xkb_compose_state_unref(_glfw.wl.xkb.composeState); -#endif if (_glfw.wl.xkb.keymap) xkb_keymap_unref(_glfw.wl.xkb.keymap); if (_glfw.wl.xkb.state) @@ -1253,6 +522,11 @@ void _glfwPlatformTerminate(void) _glfw.wl.cursor.handle = NULL; } + for (unsigned int i = 0; i < _glfw.wl.offerCount; i++) + wl_data_offer_destroy(_glfw.wl.offers[i].offer); + + free(_glfw.wl.offers); + if (_glfw.wl.cursorSurface) wl_surface_destroy(_glfw.wl.cursorSurface); if (_glfw.wl.subcompositor) @@ -1261,20 +535,20 @@ void _glfwPlatformTerminate(void) wl_compositor_destroy(_glfw.wl.compositor); if (_glfw.wl.shm) wl_shm_destroy(_glfw.wl.shm); - if (_glfw.wl.shell) - wl_shell_destroy(_glfw.wl.shell); if (_glfw.wl.viewporter) wp_viewporter_destroy(_glfw.wl.viewporter); if (_glfw.wl.decorationManager) zxdg_decoration_manager_v1_destroy(_glfw.wl.decorationManager); if (_glfw.wl.wmBase) xdg_wm_base_destroy(_glfw.wl.wmBase); - if (_glfw.wl.dataSource) - wl_data_source_destroy(_glfw.wl.dataSource); + if (_glfw.wl.selectionOffer) + wl_data_offer_destroy(_glfw.wl.selectionOffer); + if (_glfw.wl.dragOffer) + wl_data_offer_destroy(_glfw.wl.dragOffer); + if (_glfw.wl.selectionSource) + wl_data_source_destroy(_glfw.wl.selectionSource); if (_glfw.wl.dataDevice) wl_data_device_destroy(_glfw.wl.dataDevice); - if (_glfw.wl.dataOffer) - wl_data_offer_destroy(_glfw.wl.dataOffer); if (_glfw.wl.dataDeviceManager) wl_data_device_manager_destroy(_glfw.wl.dataDeviceManager); if (_glfw.wl.pointer) @@ -1302,10 +576,7 @@ void _glfwPlatformTerminate(void) if (_glfw.wl.cursorTimerfd >= 0) close(_glfw.wl.cursorTimerfd); - if (_glfw.wl.clipboardString) - free(_glfw.wl.clipboardString); - if (_glfw.wl.clipboardSendString) - free(_glfw.wl.clipboardSendString); + free(_glfw.wl.clipboardString); } const char* _glfwPlatformGetVersionString(void) diff --git a/third_party/penumbra/vendor/glfw/src/wl_monitor.c b/third_party/penumbra/vendor/glfw/src/wl_monitor.c index 48b25b9ff6e..99de89333cf 100644 --- a/third_party/penumbra/vendor/glfw/src/wl_monitor.c +++ b/third_party/penumbra/vendor/glfw/src/wl_monitor.c @@ -35,7 +35,7 @@ #include -static void outputHandleGeometry(void* data, +static void outputHandleGeometry(void* userData, struct wl_output* output, int32_t x, int32_t y, @@ -46,26 +46,25 @@ static void outputHandleGeometry(void* data, const char* model, int32_t transform) { - struct _GLFWmonitor *monitor = data; - char name[1024]; + struct _GLFWmonitor* monitor = userData; monitor->wl.x = x; monitor->wl.y = y; monitor->widthMM = physicalWidth; monitor->heightMM = physicalHeight; - snprintf(name, sizeof(name), "%s %s", make, model); - monitor->name = _glfw_strdup(name); + if (strlen(monitor->name) == 0) + snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model); } -static void outputHandleMode(void* data, +static void outputHandleMode(void* userData, struct wl_output* output, uint32_t flags, int32_t width, int32_t height, int32_t refresh) { - struct _GLFWmonitor *monitor = data; + struct _GLFWmonitor* monitor = userData; GLFWvidmode mode; mode.width = width; @@ -84,27 +83,75 @@ static void outputHandleMode(void* data, monitor->wl.currentMode = monitor->modeCount - 1; } -static void outputHandleDone(void* data, struct wl_output* output) +static void outputHandleDone(void* userData, struct wl_output* output) { - struct _GLFWmonitor *monitor = data; + struct _GLFWmonitor* monitor = userData; + + if (monitor->widthMM <= 0 || monitor->heightMM <= 0) + { + // If Wayland does not provide a physical size, assume the default 96 DPI + const GLFWvidmode* mode = &monitor->modes[monitor->wl.currentMode]; + monitor->widthMM = (int) (mode->width * 25.4f / 96.f); + monitor->heightMM = (int) (mode->height * 25.4f / 96.f); + } + + for (int i = 0; i < _glfw.monitorCount; i++) + { + if (_glfw.monitors[i] == monitor) + return; + } _glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST); } -static void outputHandleScale(void* data, +static void outputHandleScale(void* userData, struct wl_output* output, int32_t factor) { - struct _GLFWmonitor *monitor = data; + struct _GLFWmonitor* monitor = userData; monitor->wl.scale = factor; + + for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next) + { + for (int i = 0; i < window->wl.monitorsCount; i++) + { + if (window->wl.monitors[i] == monitor) + { + _glfwUpdateContentScaleWayland(window); + break; + } + } + } +} + +#ifdef WL_OUTPUT_NAME_SINCE_VERSION + +void outputHandleName(void* userData, struct wl_output* wl_output, const char* name) +{ + struct _GLFWmonitor* monitor = userData; + + strncpy(monitor->name, name, sizeof(monitor->name) - 1); +} + +void outputHandleDescription(void* userData, + struct wl_output* wl_output, + const char* description) +{ } -static const struct wl_output_listener outputListener = { +#endif // WL_OUTPUT_NAME_SINCE_VERSION + +static const struct wl_output_listener outputListener = +{ outputHandleGeometry, outputHandleMode, outputHandleDone, outputHandleScale, +#ifdef WL_OUTPUT_NAME_SINCE_VERSION + outputHandleName, + outputHandleDescription, +#endif }; @@ -114,9 +161,6 @@ static const struct wl_output_listener outputListener = { void _glfwAddOutputWayland(uint32_t name, uint32_t version) { - _GLFWmonitor *monitor; - struct wl_output *output; - if (version < 2) { _glfwInputError(GLFW_PLATFORM_ERROR, @@ -124,19 +168,21 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version) return; } - // The actual name of this output will be set in the geometry handler. - monitor = _glfwAllocMonitor(NULL, 0, 0); +#ifdef WL_OUTPUT_NAME_SINCE_VERSION + version = _glfw_min(version, WL_OUTPUT_NAME_SINCE_VERSION); +#else + version = 2; +#endif - output = wl_registry_bind(_glfw.wl.registry, - name, - &wl_output_interface, - 2); + struct wl_output* output = wl_registry_bind(_glfw.wl.registry, + name, + &wl_output_interface, + version); if (!output) - { - _glfwFreeMonitor(monitor); return; - } + // The actual name of this output will be set in the geometry handler + _GLFWmonitor* monitor = _glfwAllocMonitor("", 0, 0); monitor->wl.scale = 1; monitor->wl.output = output; monitor->wl.name = name; diff --git a/third_party/penumbra/vendor/glfw/src/wl_platform.h b/third_party/penumbra/vendor/glfw/src/wl_platform.h index 41a7fdfa7a5..2146e2ad0cb 100644 --- a/third_party/penumbra/vendor/glfw/src/wl_platform.h +++ b/third_party/penumbra/vendor/glfw/src/wl_platform.h @@ -26,9 +26,7 @@ #include #include -#ifdef HAVE_XKBCOMMON_COMPOSE_H #include -#endif #include typedef VkFlags VkWaylandSurfaceCreateFlagsKHR; @@ -67,7 +65,7 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR #define _glfw_dlclose(handle) dlclose(handle) #define _glfw_dlsym(handle, name) dlsym(handle, name) -#define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->wl.native) +#define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->wl.egl.window) #define _GLFW_EGL_NATIVE_DISPLAY ((EGLNativeDisplayType) _glfw.wl.display) #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWayland wl @@ -112,24 +110,27 @@ typedef struct xkb_keymap* (* PFN_xkb_keymap_new_from_string)(struct xkb_context typedef void (* PFN_xkb_keymap_unref)(struct xkb_keymap*); typedef xkb_mod_index_t (* PFN_xkb_keymap_mod_get_index)(struct xkb_keymap*, const char*); typedef int (* PFN_xkb_keymap_key_repeats)(struct xkb_keymap*, xkb_keycode_t); +typedef int (* PFN_xkb_keymap_key_get_syms_by_level)(struct xkb_keymap*,xkb_keycode_t,xkb_layout_index_t,xkb_level_index_t,const xkb_keysym_t**); typedef struct xkb_state* (* PFN_xkb_state_new)(struct xkb_keymap*); typedef void (* PFN_xkb_state_unref)(struct xkb_state*); typedef int (* PFN_xkb_state_key_get_syms)(struct xkb_state*, xkb_keycode_t, const xkb_keysym_t**); typedef enum xkb_state_component (* PFN_xkb_state_update_mask)(struct xkb_state*, xkb_mod_mask_t, xkb_mod_mask_t, xkb_mod_mask_t, xkb_layout_index_t, xkb_layout_index_t, xkb_layout_index_t); -typedef xkb_mod_mask_t (* PFN_xkb_state_serialize_mods)(struct xkb_state*, enum xkb_state_component); +typedef xkb_layout_index_t (* PFN_xkb_state_key_get_layout)(struct xkb_state*,xkb_keycode_t); +typedef int (* PFN_xkb_state_mod_index_is_active)(struct xkb_state*,xkb_mod_index_t,enum xkb_state_component); #define xkb_context_new _glfw.wl.xkb.context_new #define xkb_context_unref _glfw.wl.xkb.context_unref #define xkb_keymap_new_from_string _glfw.wl.xkb.keymap_new_from_string #define xkb_keymap_unref _glfw.wl.xkb.keymap_unref #define xkb_keymap_mod_get_index _glfw.wl.xkb.keymap_mod_get_index #define xkb_keymap_key_repeats _glfw.wl.xkb.keymap_key_repeats +#define xkb_keymap_key_get_syms_by_level _glfw.wl.xkb.keymap_key_get_syms_by_level #define xkb_state_new _glfw.wl.xkb.state_new #define xkb_state_unref _glfw.wl.xkb.state_unref #define xkb_state_key_get_syms _glfw.wl.xkb.state_key_get_syms #define xkb_state_update_mask _glfw.wl.xkb.state_update_mask -#define xkb_state_serialize_mods _glfw.wl.xkb.state_serialize_mods +#define xkb_state_key_get_layout _glfw.wl.xkb.state_key_get_layout +#define xkb_state_mod_index_is_active _glfw.wl.xkb.state_mod_index_is_active -#ifdef HAVE_XKBCOMMON_COMPOSE_H typedef struct xkb_compose_table* (* PFN_xkb_compose_table_new_from_locale)(struct xkb_context*, const char*, enum xkb_compose_compile_flags); typedef void (* PFN_xkb_compose_table_unref)(struct xkb_compose_table*); typedef struct xkb_compose_state* (* PFN_xkb_compose_state_new)(struct xkb_compose_table*, enum xkb_compose_state_flags); @@ -144,12 +145,6 @@ typedef xkb_keysym_t (* PFN_xkb_compose_state_get_one_sym)(struct xkb_compose_st #define xkb_compose_state_feed _glfw.wl.xkb.compose_state_feed #define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status #define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym -#endif - -#define _GLFW_DECORATION_WIDTH 4 -#define _GLFW_DECORATION_TOP 24 -#define _GLFW_DECORATION_VERTICAL (_GLFW_DECORATION_TOP + _GLFW_DECORATION_WIDTH) -#define _GLFW_DECORATION_HORIZONTAL (2 * _GLFW_DECORATION_WIDTH) typedef enum _GLFWdecorationSideWayland { @@ -158,7 +153,6 @@ typedef enum _GLFWdecorationSideWayland leftDecoration, rightDecoration, bottomDecoration, - } _GLFWdecorationSideWayland; typedef struct _GLFWdecorationWayland @@ -166,9 +160,15 @@ typedef struct _GLFWdecorationWayland struct wl_surface* surface; struct wl_subsurface* subsurface; struct wp_viewport* viewport; - } _GLFWdecorationWayland; +typedef struct _GLFWofferWayland +{ + struct wl_data_offer* offer; + GLFWbool text_plain_utf8; + GLFWbool text_uri_list; +} _GLFWofferWayland; + // Wayland-specific per-window data // typedef struct _GLFWwindowWayland @@ -176,17 +176,30 @@ typedef struct _GLFWwindowWayland int width, height; GLFWbool visible; GLFWbool maximized; + GLFWbool activated; + GLFWbool fullscreen; GLFWbool hovered; GLFWbool transparent; struct wl_surface* surface; - struct wl_egl_window* native; - struct wl_shell_surface* shellSurface; struct wl_callback* callback; + struct { + struct wl_egl_window* window; + } egl; + + struct { + int width, height; + GLFWbool maximized; + GLFWbool iconified; + GLFWbool activated; + GLFWbool fullscreen; + } pending; + struct { struct xdg_surface* surface; struct xdg_toplevel* toplevel; struct zxdg_toplevel_decoration_v1* decoration; + uint32_t decorationMode; } xdg; _GLFWcursor* currentCursor; @@ -208,15 +221,11 @@ typedef struct _GLFWwindowWayland struct zwp_idle_inhibitor_v1* idleInhibitor; - GLFWbool wasFullscreen; - struct { - GLFWbool serverSide; struct wl_buffer* buffer; _GLFWdecorationWayland top, left, right, bottom; - int focus; + _GLFWdecorationSideWayland focus; } decorations; - } _GLFWwindowWayland; // Wayland-specific global data @@ -227,15 +236,12 @@ typedef struct _GLFWlibraryWayland struct wl_registry* registry; struct wl_compositor* compositor; struct wl_subcompositor* subcompositor; - struct wl_shell* shell; struct wl_shm* shm; struct wl_seat* seat; struct wl_pointer* pointer; struct wl_keyboard* keyboard; struct wl_data_device_manager* dataDeviceManager; struct wl_data_device* dataDevice; - struct wl_data_offer* dataOffer; - struct wl_data_source* dataSource; struct xdg_wm_base* wmBase; struct zxdg_decoration_manager_v1* decorationManager; struct wp_viewporter* viewporter; @@ -243,6 +249,16 @@ typedef struct _GLFWlibraryWayland struct zwp_pointer_constraints_v1* pointerConstraints; struct zwp_idle_inhibit_manager_v1* idleInhibitManager; + _GLFWofferWayland* offers; + unsigned int offerCount; + + struct wl_data_offer* selectionOffer; + struct wl_data_source* selectionSource; + + struct wl_data_offer* dragOffer; + _GLFWwindow* dragFocus; + uint32_t dragSerial; + int compositorVersion; int seatVersion; @@ -252,35 +268,31 @@ typedef struct _GLFWlibraryWayland const char* cursorPreviousName; int cursorTimerfd; uint32_t serial; + uint32_t pointerEnterSerial; int32_t keyboardRepeatRate; int32_t keyboardRepeatDelay; int keyboardLastKey; int keyboardLastScancode; char* clipboardString; - size_t clipboardSize; - char* clipboardSendString; - size_t clipboardSendSize; int timerfd; short int keycodes[256]; short int scancodes[GLFW_KEY_LAST + 1]; + char keynames[GLFW_KEY_LAST + 1][5]; struct { void* handle; struct xkb_context* context; struct xkb_keymap* keymap; struct xkb_state* state; - -#ifdef HAVE_XKBCOMMON_COMPOSE_H struct xkb_compose_state* composeState; -#endif - xkb_mod_mask_t controlMask; - xkb_mod_mask_t altMask; - xkb_mod_mask_t shiftMask; - xkb_mod_mask_t superMask; - xkb_mod_mask_t capsLockMask; - xkb_mod_mask_t numLockMask; + xkb_mod_index_t controlIndex; + xkb_mod_index_t altIndex; + xkb_mod_index_t shiftIndex; + xkb_mod_index_t superIndex; + xkb_mod_index_t capsLockIndex; + xkb_mod_index_t numLockIndex; unsigned int modifiers; PFN_xkb_context_new context_new; @@ -289,13 +301,14 @@ typedef struct _GLFWlibraryWayland PFN_xkb_keymap_unref keymap_unref; PFN_xkb_keymap_mod_get_index keymap_mod_get_index; PFN_xkb_keymap_key_repeats keymap_key_repeats; + PFN_xkb_keymap_key_get_syms_by_level keymap_key_get_syms_by_level; PFN_xkb_state_new state_new; PFN_xkb_state_unref state_unref; PFN_xkb_state_key_get_syms state_key_get_syms; PFN_xkb_state_update_mask state_update_mask; - PFN_xkb_state_serialize_mods state_serialize_mods; + PFN_xkb_state_key_get_layout state_key_get_layout; + PFN_xkb_state_mod_index_is_active state_mod_index_is_active; -#ifdef HAVE_XKBCOMMON_COMPOSE_H PFN_xkb_compose_table_new_from_locale compose_table_new_from_locale; PFN_xkb_compose_table_unref compose_table_unref; PFN_xkb_compose_state_new compose_state_new; @@ -303,7 +316,6 @@ typedef struct _GLFWlibraryWayland PFN_xkb_compose_state_feed compose_state_feed; PFN_xkb_compose_state_get_status compose_state_get_status; PFN_xkb_compose_state_get_one_sym compose_state_get_one_sym; -#endif } xkb; _GLFWwindow* pointerFocus; @@ -325,7 +337,6 @@ typedef struct _GLFWlibraryWayland PFN_wl_egl_window_destroy window_destroy; PFN_wl_egl_window_resize window_resize; } egl; - } _GLFWlibraryWayland; // Wayland-specific per-monitor data @@ -339,7 +350,6 @@ typedef struct _GLFWmonitorWayland int x; int y; int scale; - } _GLFWmonitorWayland; // Wayland-specific per-cursor data @@ -354,6 +364,10 @@ typedef struct _GLFWcursorWayland int currentImage; } _GLFWcursorWayland; - void _glfwAddOutputWayland(uint32_t name, uint32_t version); +void _glfwUpdateContentScaleWayland(_GLFWwindow* window); +GLFWbool _glfwInputTextWayland(_GLFWwindow* window, uint32_t scancode); + +void _glfwAddSeatListenerWayland(struct wl_seat* seat); +void _glfwAddDataDeviceListenerWayland(struct wl_data_device* device); diff --git a/third_party/penumbra/vendor/glfw/src/wl_window.c b/third_party/penumbra/vendor/glfw/src/wl_window.c index a90257189c6..53cbd33b179 100644 --- a/third_party/penumbra/vendor/glfw/src/wl_window.c +++ b/third_party/penumbra/vendor/glfw/src/wl_window.c @@ -33,79 +33,18 @@ #include #include #include +#include #include #include #include #include #include #include +#include +#include - -static void shellSurfaceHandlePing(void* data, - struct wl_shell_surface* shellSurface, - uint32_t serial) -{ - wl_shell_surface_pong(shellSurface, serial); -} - -static void shellSurfaceHandleConfigure(void* data, - struct wl_shell_surface* shellSurface, - uint32_t edges, - int32_t width, - int32_t height) -{ - _GLFWwindow* window = data; - float aspectRatio; - float targetRatio; - - if (!window->monitor) - { - if (_glfw.wl.viewporter && window->decorated) - { - width -= _GLFW_DECORATION_HORIZONTAL; - height -= _GLFW_DECORATION_VERTICAL; - } - if (width < 1) - width = 1; - if (height < 1) - height = 1; - - if (window->numer != GLFW_DONT_CARE && window->denom != GLFW_DONT_CARE) - { - aspectRatio = (float)width / (float)height; - targetRatio = (float)window->numer / (float)window->denom; - if (aspectRatio < targetRatio) - height = width / targetRatio; - else if (aspectRatio > targetRatio) - width = height * targetRatio; - } - - if (window->minwidth != GLFW_DONT_CARE && width < window->minwidth) - width = window->minwidth; - else if (window->maxwidth != GLFW_DONT_CARE && width > window->maxwidth) - width = window->maxwidth; - - if (window->minheight != GLFW_DONT_CARE && height < window->minheight) - height = window->minheight; - else if (window->maxheight != GLFW_DONT_CARE && height > window->maxheight) - height = window->maxheight; - } - - _glfwInputWindowSize(window, width, height); - _glfwPlatformSetWindowSize(window, width, height); - _glfwInputWindowDamage(window); -} - -static void shellSurfaceHandlePopupDone(void* data, - struct wl_shell_surface* shellSurface) -{ -} - -static const struct wl_shell_surface_listener shellSurfaceListener = { - shellSurfaceHandlePing, - shellSurfaceHandleConfigure, - shellSurfaceHandlePopupDone -}; +#define GLFW_BORDER_SIZE 4 +#define GLFW_CAPTION_HEIGHT 24 static int createTmpfileCloexec(char* tmpname) { @@ -208,8 +147,8 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image) if (fd < 0) { _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Creating a buffer file for %d B failed: %m", - length); + "Wayland: Failed to create buffer file of size %d: %s", + length, strerror(errno)); return NULL; } @@ -217,7 +156,7 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image) if (data == MAP_FAILED) { _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: mmap failed: %m"); + "Wayland: Failed to map file: %s", strerror(errno)); close(fd); return NULL; } @@ -248,14 +187,59 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image) return buffer; } -static void createDecoration(_GLFWdecorationWayland* decoration, - struct wl_surface* parent, - struct wl_buffer* buffer, GLFWbool opaque, - int x, int y, - int width, int height) +// Wait for data to arrive on any of the specified file descriptors +// +static GLFWbool waitForData(struct pollfd* fds, nfds_t count, double* timeout) { - struct wl_region* region; + for (;;) + { + if (timeout) + { + const uint64_t base = _glfwPlatformGetTimerValue(); + +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) + const time_t seconds = (time_t) *timeout; + const long nanoseconds = (long) ((*timeout - seconds) * 1e9); + const struct timespec ts = { seconds, nanoseconds }; + const int result = ppoll(fds, count, &ts, NULL); +#elif defined(__NetBSD__) + const time_t seconds = (time_t) *timeout; + const long nanoseconds = (long) ((*timeout - seconds) * 1e9); + const struct timespec ts = { seconds, nanoseconds }; + const int result = pollts(fds, count, &ts, NULL); +#else + const int milliseconds = (int) (*timeout * 1e3); + const int result = poll(fds, count, milliseconds); +#endif + const int error = errno; // clock_gettime may overwrite our error + + *timeout -= (_glfwPlatformGetTimerValue() - base) / + (double) _glfwPlatformGetTimerFrequency(); + + if (result > 0) + return GLFW_TRUE; + else if (result == -1 && error != EINTR && error != EAGAIN) + return GLFW_FALSE; + else if (*timeout <= 0.0) + return GLFW_FALSE; + } + else + { + const int result = poll(fds, count, -1); + if (result > 0) + return GLFW_TRUE; + else if (result == -1 && errno != EINTR && errno != EAGAIN) + return GLFW_FALSE; + } + } +} +static void createFallbackDecoration(_GLFWdecorationWayland* decoration, + struct wl_surface* parent, + struct wl_buffer* buffer, + int x, int y, + int width, int height) +{ decoration->surface = wl_compositor_create_surface(_glfw.wl.compositor); decoration->subsurface = wl_subcompositor_get_subsurface(_glfw.wl.subcompositor, @@ -266,25 +250,19 @@ static void createDecoration(_GLFWdecorationWayland* decoration, wp_viewport_set_destination(decoration->viewport, width, height); wl_surface_attach(decoration->surface, buffer, 0, 0); - if (opaque) - { - region = wl_compositor_create_region(_glfw.wl.compositor); - wl_region_add(region, 0, 0, width, height); - wl_surface_set_opaque_region(decoration->surface, region); - wl_surface_commit(decoration->surface); - wl_region_destroy(region); - } - else - wl_surface_commit(decoration->surface); + struct wl_region* region = wl_compositor_create_region(_glfw.wl.compositor); + wl_region_add(region, 0, 0, width, height); + wl_surface_set_opaque_region(decoration->surface, region); + wl_surface_commit(decoration->surface); + wl_region_destroy(region); } -static void createDecorations(_GLFWwindow* window) +static void createFallbackDecorations(_GLFWwindow* window) { unsigned char data[] = { 224, 224, 224, 255 }; const GLFWimage image = { 1, 1, data }; - GLFWbool opaque = (data[3] == 255); - if (!_glfw.wl.viewporter || !window->decorated || window->wl.decorations.serverSide) + if (!_glfw.wl.viewporter) return; if (!window->wl.decorations.buffer) @@ -292,30 +270,30 @@ static void createDecorations(_GLFWwindow* window) if (!window->wl.decorations.buffer) return; - createDecoration(&window->wl.decorations.top, window->wl.surface, - window->wl.decorations.buffer, opaque, - 0, -_GLFW_DECORATION_TOP, - window->wl.width, _GLFW_DECORATION_TOP); - createDecoration(&window->wl.decorations.left, window->wl.surface, - window->wl.decorations.buffer, opaque, - -_GLFW_DECORATION_WIDTH, -_GLFW_DECORATION_TOP, - _GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP); - createDecoration(&window->wl.decorations.right, window->wl.surface, - window->wl.decorations.buffer, opaque, - window->wl.width, -_GLFW_DECORATION_TOP, - _GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP); - createDecoration(&window->wl.decorations.bottom, window->wl.surface, - window->wl.decorations.buffer, opaque, - -_GLFW_DECORATION_WIDTH, window->wl.height, - window->wl.width + _GLFW_DECORATION_HORIZONTAL, _GLFW_DECORATION_WIDTH); -} - -static void destroyDecoration(_GLFWdecorationWayland* decoration) + createFallbackDecoration(&window->wl.decorations.top, window->wl.surface, + window->wl.decorations.buffer, + 0, -GLFW_CAPTION_HEIGHT, + window->wl.width, GLFW_CAPTION_HEIGHT); + createFallbackDecoration(&window->wl.decorations.left, window->wl.surface, + window->wl.decorations.buffer, + -GLFW_BORDER_SIZE, -GLFW_CAPTION_HEIGHT, + GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT); + createFallbackDecoration(&window->wl.decorations.right, window->wl.surface, + window->wl.decorations.buffer, + window->wl.width, -GLFW_CAPTION_HEIGHT, + GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT); + createFallbackDecoration(&window->wl.decorations.bottom, window->wl.surface, + window->wl.decorations.buffer, + -GLFW_BORDER_SIZE, window->wl.height, + window->wl.width + GLFW_BORDER_SIZE * 2, GLFW_BORDER_SIZE); +} + +static void destroyFallbackDecoration(_GLFWdecorationWayland* decoration) { - if (decoration->surface) - wl_surface_destroy(decoration->surface); if (decoration->subsurface) wl_subsurface_destroy(decoration->subsurface); + if (decoration->surface) + wl_surface_destroy(decoration->surface); if (decoration->viewport) wp_viewport_destroy(decoration->viewport); decoration->surface = NULL; @@ -323,32 +301,38 @@ static void destroyDecoration(_GLFWdecorationWayland* decoration) decoration->viewport = NULL; } -static void destroyDecorations(_GLFWwindow* window) +static void destroyFallbackDecorations(_GLFWwindow* window) { - destroyDecoration(&window->wl.decorations.top); - destroyDecoration(&window->wl.decorations.left); - destroyDecoration(&window->wl.decorations.right); - destroyDecoration(&window->wl.decorations.bottom); + destroyFallbackDecoration(&window->wl.decorations.top); + destroyFallbackDecoration(&window->wl.decorations.left); + destroyFallbackDecoration(&window->wl.decorations.right); + destroyFallbackDecoration(&window->wl.decorations.bottom); } -static void xdgDecorationHandleConfigure(void* data, +static void xdgDecorationHandleConfigure(void* userData, struct zxdg_toplevel_decoration_v1* decoration, uint32_t mode) { - _GLFWwindow* window = data; + _GLFWwindow* window = userData; - window->wl.decorations.serverSide = (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); + window->wl.xdg.decorationMode = mode; - if (!window->wl.decorations.serverSide) - createDecorations(window); + if (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE) + { + if (window->decorated && !window->monitor) + createFallbackDecorations(window); + } + else + destroyFallbackDecorations(window); } -static const struct zxdg_toplevel_decoration_v1_listener xdgDecorationListener = { +static const struct zxdg_toplevel_decoration_v1_listener xdgDecorationListener = +{ xdgDecorationHandleConfigure, }; // Makes the surface considered as XRGB instead of ARGB. -static void setOpaqueRegion(_GLFWwindow* window) +static void setContentAreaOpaque(_GLFWwindow* window) { struct wl_region* region; @@ -358,7 +342,6 @@ static void setOpaqueRegion(_GLFWwindow* window) wl_region_add(region, 0, 0, window->wl.width, window->wl.height); wl_surface_set_opaque_region(window->wl.surface, region); - wl_surface_commit(window->wl.surface); wl_region_destroy(region); } @@ -368,72 +351,63 @@ static void resizeWindow(_GLFWwindow* window) int scale = window->wl.scale; int scaledWidth = window->wl.width * scale; int scaledHeight = window->wl.height * scale; - wl_egl_window_resize(window->wl.native, scaledWidth, scaledHeight, 0, 0); + + if (window->wl.egl.window) + wl_egl_window_resize(window->wl.egl.window, scaledWidth, scaledHeight, 0, 0); if (!window->wl.transparent) - setOpaqueRegion(window); + setContentAreaOpaque(window); _glfwInputFramebufferSize(window, scaledWidth, scaledHeight); - _glfwInputWindowContentScale(window, scale, scale); if (!window->wl.decorations.top.surface) return; - // Top decoration. wp_viewport_set_destination(window->wl.decorations.top.viewport, - window->wl.width, _GLFW_DECORATION_TOP); + window->wl.width, GLFW_CAPTION_HEIGHT); wl_surface_commit(window->wl.decorations.top.surface); - // Left decoration. wp_viewport_set_destination(window->wl.decorations.left.viewport, - _GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP); + GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT); wl_surface_commit(window->wl.decorations.left.surface); - // Right decoration. wl_subsurface_set_position(window->wl.decorations.right.subsurface, - window->wl.width, -_GLFW_DECORATION_TOP); + window->wl.width, -GLFW_CAPTION_HEIGHT); wp_viewport_set_destination(window->wl.decorations.right.viewport, - _GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP); + GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT); wl_surface_commit(window->wl.decorations.right.surface); - // Bottom decoration. wl_subsurface_set_position(window->wl.decorations.bottom.subsurface, - -_GLFW_DECORATION_WIDTH, window->wl.height); + -GLFW_BORDER_SIZE, window->wl.height); wp_viewport_set_destination(window->wl.decorations.bottom.viewport, - window->wl.width + _GLFW_DECORATION_HORIZONTAL, _GLFW_DECORATION_WIDTH); + window->wl.width + GLFW_BORDER_SIZE * 2, GLFW_BORDER_SIZE); wl_surface_commit(window->wl.decorations.bottom.surface); } -static void checkScaleChange(_GLFWwindow* window) +void _glfwUpdateContentScaleWayland(_GLFWwindow* window) { - int scale = 1; - int i; - int monitorScale; - - // Check if we will be able to set the buffer scale or not. - if (_glfw.wl.compositorVersion < 3) + if (_glfw.wl.compositorVersion < WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION) return; // Get the scale factor from the highest scale monitor. - for (i = 0; i < window->wl.monitorsCount; ++i) - { - monitorScale = window->wl.monitors[i]->wl.scale; - if (scale < monitorScale) - scale = monitorScale; - } + int maxScale = 1; + + for (int i = 0; i < window->wl.monitorsCount; i++) + maxScale = _glfw_max(window->wl.monitors[i]->wl.scale, maxScale); // Only change the framebuffer size if the scale changed. - if (scale != window->wl.scale) + if (window->wl.scale != maxScale) { - window->wl.scale = scale; - wl_surface_set_buffer_scale(window->wl.surface, scale); + window->wl.scale = maxScale; + wl_surface_set_buffer_scale(window->wl.surface, maxScale); + _glfwInputWindowContentScale(window, maxScale, maxScale); resizeWindow(window); } } -static void surfaceHandleEnter(void *data, - struct wl_surface *surface, - struct wl_output *output) +static void surfaceHandleEnter(void* userData, + struct wl_surface* surface, + struct wl_output* output) { - _GLFWwindow* window = data; + _GLFWwindow* window = userData; _GLFWmonitor* monitor = wl_output_get_user_data(output); if (window->wl.monitorsCount + 1 > window->wl.monitorsSize) @@ -446,14 +420,14 @@ static void surfaceHandleEnter(void *data, window->wl.monitors[window->wl.monitorsCount++] = monitor; - checkScaleChange(window); + _glfwUpdateContentScaleWayland(window); } -static void surfaceHandleLeave(void *data, - struct wl_surface *surface, - struct wl_output *output) +static void surfaceHandleLeave(void* userData, + struct wl_surface* surface, + struct wl_output* output) { - _GLFWwindow* window = data; + _GLFWwindow* window = userData; _GLFWmonitor* monitor = wl_output_get_user_data(output); GLFWbool found; int i; @@ -467,10 +441,11 @@ static void surfaceHandleLeave(void *data, } window->wl.monitors[--window->wl.monitorsCount] = NULL; - checkScaleChange(window); + _glfwUpdateContentScaleWayland(window); } -static const struct wl_surface_listener surfaceListener = { +static const struct wl_surface_listener surfaceListener = +{ surfaceHandleEnter, surfaceHandleLeave }; @@ -484,7 +459,7 @@ static void setIdleInhibitor(_GLFWwindow* window, GLFWbool enable) _glfw.wl.idleInhibitManager, window->wl.surface); if (!window->wl.idleInhibitor) _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Idle inhibitor creation failed"); + "Wayland: Failed to create idle inhibitor"); } else if (!enable && window->wl.idleInhibitor) { @@ -493,266 +468,263 @@ static void setIdleInhibitor(_GLFWwindow* window, GLFWbool enable) } } -static GLFWbool createSurface(_GLFWwindow* window, - const _GLFWwndconfig* wndconfig) -{ - window->wl.surface = wl_compositor_create_surface(_glfw.wl.compositor); - if (!window->wl.surface) - return GLFW_FALSE; - - wl_surface_add_listener(window->wl.surface, - &surfaceListener, - window); - - wl_surface_set_user_data(window->wl.surface, window); - - window->wl.native = wl_egl_window_create(window->wl.surface, - wndconfig->width, - wndconfig->height); - if (!window->wl.native) - return GLFW_FALSE; - - window->wl.width = wndconfig->width; - window->wl.height = wndconfig->height; - window->wl.scale = 1; - - if (!window->wl.transparent) - setOpaqueRegion(window); - - return GLFW_TRUE; -} - -static void setFullscreen(_GLFWwindow* window, _GLFWmonitor* monitor, - int refreshRate) +// Make the specified window and its video mode active on its monitor +// +static void acquireMonitor(_GLFWwindow* window) { if (window->wl.xdg.toplevel) { - xdg_toplevel_set_fullscreen( - window->wl.xdg.toplevel, - monitor->wl.output); - } - else if (window->wl.shellSurface) - { - wl_shell_surface_set_fullscreen( - window->wl.shellSurface, - WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, - refreshRate * 1000, // Convert Hz to mHz. - monitor->wl.output); + xdg_toplevel_set_fullscreen(window->wl.xdg.toplevel, + window->monitor->wl.output); } + setIdleInhibitor(window, GLFW_TRUE); - if (!window->wl.decorations.serverSide) - destroyDecorations(window); + + if (window->wl.decorations.top.surface) + destroyFallbackDecorations(window); } -static GLFWbool createShellSurface(_GLFWwindow* window) +// Remove the window and restore the original video mode +// +static void releaseMonitor(_GLFWwindow* window) { - if (!_glfw.wl.shell) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: wl_shell protocol not available"); - return GLFW_FALSE; - } - - window->wl.shellSurface = wl_shell_get_shell_surface(_glfw.wl.shell, - window->wl.surface); - if (!window->wl.shellSurface) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Shell surface creation failed"); - return GLFW_FALSE; - } - - wl_shell_surface_add_listener(window->wl.shellSurface, - &shellSurfaceListener, - window); + if (window->wl.xdg.toplevel) + xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel); - if (window->wl.title) - wl_shell_surface_set_title(window->wl.shellSurface, window->wl.title); + setIdleInhibitor(window, GLFW_FALSE); - if (window->monitor) - { - setFullscreen(window, window->monitor, 0); - } - else if (window->wl.maximized) + if (window->wl.xdg.decorationMode != ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE) { - wl_shell_surface_set_maximized(window->wl.shellSurface, NULL); - setIdleInhibitor(window, GLFW_FALSE); - createDecorations(window); - } - else - { - wl_shell_surface_set_toplevel(window->wl.shellSurface); - setIdleInhibitor(window, GLFW_FALSE); - createDecorations(window); + if (window->decorated) + createFallbackDecorations(window); } - - wl_surface_commit(window->wl.surface); - - return GLFW_TRUE; } -static void xdgToplevelHandleConfigure(void* data, +static void xdgToplevelHandleConfigure(void* userData, struct xdg_toplevel* toplevel, int32_t width, int32_t height, struct wl_array* states) { - _GLFWwindow* window = data; - float aspectRatio; - float targetRatio; + _GLFWwindow* window = userData; uint32_t* state; - GLFWbool maximized = GLFW_FALSE; - GLFWbool fullscreen = GLFW_FALSE; - GLFWbool activated = GLFW_FALSE; + + window->wl.pending.activated = GLFW_FALSE; + window->wl.pending.maximized = GLFW_FALSE; + window->wl.pending.fullscreen = GLFW_FALSE; wl_array_for_each(state, states) { switch (*state) { case XDG_TOPLEVEL_STATE_MAXIMIZED: - maximized = GLFW_TRUE; + window->wl.pending.maximized = GLFW_TRUE; break; case XDG_TOPLEVEL_STATE_FULLSCREEN: - fullscreen = GLFW_TRUE; + window->wl.pending.fullscreen = GLFW_TRUE; break; case XDG_TOPLEVEL_STATE_RESIZING: break; case XDG_TOPLEVEL_STATE_ACTIVATED: - activated = GLFW_TRUE; + window->wl.pending.activated = GLFW_TRUE; break; } } - if (width != 0 && height != 0) + if (width && height) { - if (!maximized && !fullscreen) + if (window->wl.decorations.top.surface) { - if (window->numer != GLFW_DONT_CARE && window->denom != GLFW_DONT_CARE) - { - aspectRatio = (float)width / (float)height; - targetRatio = (float)window->numer / (float)window->denom; - if (aspectRatio < targetRatio) - height = width / targetRatio; - else if (aspectRatio > targetRatio) - width = height * targetRatio; - } + window->wl.pending.width = _glfw_max(0, width - GLFW_BORDER_SIZE * 2); + window->wl.pending.height = + _glfw_max(0, height - GLFW_BORDER_SIZE - GLFW_CAPTION_HEIGHT); } - - _glfwInputWindowSize(window, width, height); - _glfwPlatformSetWindowSize(window, width, height); - _glfwInputWindowDamage(window); - } - - if (window->wl.wasFullscreen && window->autoIconify) - { - if (!activated || !fullscreen) + else { - _glfwPlatformIconifyWindow(window); - window->wl.wasFullscreen = GLFW_FALSE; + window->wl.pending.width = width; + window->wl.pending.height = height; } } - if (fullscreen && activated) - window->wl.wasFullscreen = GLFW_TRUE; - _glfwInputWindowFocus(window, activated); + else + { + window->wl.pending.width = window->wl.width; + window->wl.pending.height = window->wl.height; + } } -static void xdgToplevelHandleClose(void* data, +static void xdgToplevelHandleClose(void* userData, struct xdg_toplevel* toplevel) { - _GLFWwindow* window = data; + _GLFWwindow* window = userData; _glfwInputWindowCloseRequest(window); } -static const struct xdg_toplevel_listener xdgToplevelListener = { +static const struct xdg_toplevel_listener xdgToplevelListener = +{ xdgToplevelHandleConfigure, xdgToplevelHandleClose }; -static void xdgSurfaceHandleConfigure(void* data, +static void xdgSurfaceHandleConfigure(void* userData, struct xdg_surface* surface, uint32_t serial) { + _GLFWwindow* window = userData; + xdg_surface_ack_configure(surface, serial); -} -static const struct xdg_surface_listener xdgSurfaceListener = { - xdgSurfaceHandleConfigure -}; + if (window->wl.activated != window->wl.pending.activated) + { + window->wl.activated = window->wl.pending.activated; + if (!window->wl.activated) + { + if (window->monitor && window->autoIconify) + xdg_toplevel_set_minimized(window->wl.xdg.toplevel); + } + } -static void setXdgDecorations(_GLFWwindow* window) -{ - if (_glfw.wl.decorationManager) + if (window->wl.maximized != window->wl.pending.maximized) { - window->wl.xdg.decoration = - zxdg_decoration_manager_v1_get_toplevel_decoration( - _glfw.wl.decorationManager, window->wl.xdg.toplevel); - zxdg_toplevel_decoration_v1_add_listener(window->wl.xdg.decoration, - &xdgDecorationListener, - window); - zxdg_toplevel_decoration_v1_set_mode( - window->wl.xdg.decoration, - ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); + window->wl.maximized = window->wl.pending.maximized; + _glfwInputWindowMaximize(window, window->wl.maximized); } - else + + window->wl.fullscreen = window->wl.pending.fullscreen; + + int width = window->wl.pending.width; + int height = window->wl.pending.height; + + if (!window->wl.maximized && !window->wl.fullscreen) + { + if (window->numer != GLFW_DONT_CARE && window->denom != GLFW_DONT_CARE) + { + const float aspectRatio = (float) width / (float) height; + const float targetRatio = (float) window->numer / (float) window->denom; + if (aspectRatio < targetRatio) + height = width / targetRatio; + else if (aspectRatio > targetRatio) + width = height * targetRatio; + } + } + + if (width != window->wl.width || height != window->wl.height) + { + window->wl.width = width; + window->wl.height = height; + resizeWindow(window); + + _glfwInputWindowSize(window, width, height); + + if (window->wl.visible) + _glfwInputWindowDamage(window); + } + + if (!window->wl.visible) { - window->wl.decorations.serverSide = GLFW_FALSE; - createDecorations(window); + // Allow the window to be mapped only if it either has no XDG + // decorations or they have already received a configure event + if (!window->wl.xdg.decoration || window->wl.xdg.decorationMode) + { + window->wl.visible = GLFW_TRUE; + _glfwInputWindowDamage(window); + } } } -static GLFWbool createXdgSurface(_GLFWwindow* window) +static const struct xdg_surface_listener xdgSurfaceListener = +{ + xdgSurfaceHandleConfigure +}; + +static GLFWbool createShellObjects(_GLFWwindow* window) { window->wl.xdg.surface = xdg_wm_base_get_xdg_surface(_glfw.wl.wmBase, window->wl.surface); if (!window->wl.xdg.surface) { _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: xdg-surface creation failed"); + "Wayland: Failed to create xdg-surface for window"); return GLFW_FALSE; } - xdg_surface_add_listener(window->wl.xdg.surface, - &xdgSurfaceListener, - window); + xdg_surface_add_listener(window->wl.xdg.surface, &xdgSurfaceListener, window); window->wl.xdg.toplevel = xdg_surface_get_toplevel(window->wl.xdg.surface); if (!window->wl.xdg.toplevel) { _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: xdg-toplevel creation failed"); + "Wayland: Failed to create xdg-toplevel for window"); return GLFW_FALSE; } - xdg_toplevel_add_listener(window->wl.xdg.toplevel, - &xdgToplevelListener, - window); + xdg_toplevel_add_listener(window->wl.xdg.toplevel, &xdgToplevelListener, window); if (window->wl.title) xdg_toplevel_set_title(window->wl.xdg.toplevel, window->wl.title); - if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE) - xdg_toplevel_set_min_size(window->wl.xdg.toplevel, - window->minwidth, window->minheight); - if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE) - xdg_toplevel_set_max_size(window->wl.xdg.toplevel, - window->maxwidth, window->maxheight); - if (window->monitor) { - xdg_toplevel_set_fullscreen(window->wl.xdg.toplevel, - window->monitor->wl.output); + xdg_toplevel_set_fullscreen(window->wl.xdg.toplevel, window->monitor->wl.output); setIdleInhibitor(window, GLFW_TRUE); } - else if (window->wl.maximized) + else { - xdg_toplevel_set_maximized(window->wl.xdg.toplevel); + if (window->wl.maximized) + xdg_toplevel_set_maximized(window->wl.xdg.toplevel); + setIdleInhibitor(window, GLFW_FALSE); - setXdgDecorations(window); + + if (_glfw.wl.decorationManager) + { + window->wl.xdg.decoration = + zxdg_decoration_manager_v1_get_toplevel_decoration( + _glfw.wl.decorationManager, window->wl.xdg.toplevel); + zxdg_toplevel_decoration_v1_add_listener(window->wl.xdg.decoration, + &xdgDecorationListener, + window); + + uint32_t mode; + + if (window->decorated) + mode = ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE; + else + mode = ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE; + + zxdg_toplevel_decoration_v1_set_mode(window->wl.xdg.decoration, mode); + } + else + { + if (window->decorated) + createFallbackDecorations(window); + } } - else + + if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE) { - setIdleInhibitor(window, GLFW_FALSE); - setXdgDecorations(window); + int minwidth = window->minwidth; + int minheight = window->minheight; + + if (window->wl.decorations.top.surface) + { + minwidth += GLFW_BORDER_SIZE * 2; + minheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE; + } + + xdg_toplevel_set_min_size(window->wl.xdg.toplevel, minwidth, minheight); + } + + if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE) + { + int maxwidth = window->maxwidth; + int maxheight = window->maxheight; + + if (window->wl.decorations.top.surface) + { + maxwidth += GLFW_BORDER_SIZE * 2; + maxheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE; + } + + xdg_toplevel_set_max_size(window->wl.xdg.toplevel, maxwidth, maxheight); } wl_surface_commit(window->wl.surface); @@ -761,6 +733,56 @@ static GLFWbool createXdgSurface(_GLFWwindow* window) return GLFW_TRUE; } +static void destroyShellObjects(_GLFWwindow* window) +{ + destroyFallbackDecorations(window); + + if (window->wl.xdg.decoration) + zxdg_toplevel_decoration_v1_destroy(window->wl.xdg.decoration); + + if (window->wl.xdg.toplevel) + xdg_toplevel_destroy(window->wl.xdg.toplevel); + + if (window->wl.xdg.surface) + xdg_surface_destroy(window->wl.xdg.surface); + + window->wl.xdg.decoration = NULL; + window->wl.xdg.decorationMode = 0; + window->wl.xdg.toplevel = NULL; + window->wl.xdg.surface = NULL; +} + +static GLFWbool createNativeSurface(_GLFWwindow* window, + const _GLFWwndconfig* wndconfig, + const _GLFWfbconfig* fbconfig) +{ + window->wl.surface = wl_compositor_create_surface(_glfw.wl.compositor); + if (!window->wl.surface) + { + _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Failed to create window surface"); + return GLFW_FALSE; + } + + wl_surface_add_listener(window->wl.surface, + &surfaceListener, + window); + + wl_surface_set_user_data(window->wl.surface, window); + + window->wl.width = wndconfig->width; + window->wl.height = wndconfig->height; + window->wl.scale = 1; + window->wl.title = _glfw_strdup(wndconfig->title); + + window->wl.maximized = wndconfig->maximized; + + window->wl.transparent = fbconfig->transparent; + if (!window->wl.transparent) + setContentAreaOpaque(window); + + return GLFW_TRUE; +} + static void setCursorImage(_GLFWwindow* window, _GLFWcursorWayland* cursorWayland) { @@ -796,7 +818,7 @@ static void setCursorImage(_GLFWwindow* window, cursorWayland->yhot = image->hotspot_y; } - wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, + wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial, surface, cursorWayland->xhot / scale, cursorWayland->yhot / scale); @@ -823,74 +845,979 @@ static void incrementCursorImage(_GLFWwindow* window) } } -static void handleEvents(int timeout) +static GLFWbool flushDisplay(void) +{ + while (wl_display_flush(_glfw.wl.display) == -1) + { + if (errno != EAGAIN) + return GLFW_FALSE; + + struct pollfd fd = { wl_display_get_fd(_glfw.wl.display), POLLOUT }; + + while (poll(&fd, 1, -1) == -1) + { + if (errno != EINTR && errno != EAGAIN) + return GLFW_FALSE; + } + } + + return GLFW_TRUE; +} + +static void handleEvents(double* timeout) +{ + GLFWbool event = GLFW_FALSE; + struct pollfd fds[] = + { + { wl_display_get_fd(_glfw.wl.display), POLLIN }, + { _glfw.wl.timerfd, POLLIN }, + { _glfw.wl.cursorTimerfd, POLLIN }, + }; + + while (!event) + { + while (wl_display_prepare_read(_glfw.wl.display) != 0) + wl_display_dispatch_pending(_glfw.wl.display); + + // If an error other than EAGAIN happens, we have likely been disconnected + // from the Wayland session; try to handle that the best we can. + if (!flushDisplay()) + { + wl_display_cancel_read(_glfw.wl.display); + + _GLFWwindow* window = _glfw.windowListHead; + while (window) + { + _glfwInputWindowCloseRequest(window); + window = window->next; + } + + return; + } + + if (!waitForData(fds, 3, timeout)) + { + wl_display_cancel_read(_glfw.wl.display); + return; + } + + if (fds[0].revents & POLLIN) + { + wl_display_read_events(_glfw.wl.display); + if (wl_display_dispatch_pending(_glfw.wl.display) > 0) + event = GLFW_TRUE; + } + else + wl_display_cancel_read(_glfw.wl.display); + + if (fds[1].revents & POLLIN) + { + uint64_t repeats; + + if (read(_glfw.wl.timerfd, &repeats, sizeof(repeats)) == 8) + { + for (uint64_t i = 0; i < repeats; i++) + { + _glfwInputKey(_glfw.wl.keyboardFocus, + _glfw.wl.keyboardLastKey, + _glfw.wl.keyboardLastScancode, + GLFW_PRESS, + _glfw.wl.xkb.modifiers); + _glfwInputTextWayland(_glfw.wl.keyboardFocus, + _glfw.wl.keyboardLastScancode); + } + + event = GLFW_TRUE; + } + } + + if (fds[2].revents & POLLIN) + { + uint64_t repeats; + + if (read(_glfw.wl.cursorTimerfd, &repeats, sizeof(repeats)) == 8) + { + incrementCursorImage(_glfw.wl.pointerFocus); + event = GLFW_TRUE; + } + } + } +} + +// Reads the specified data offer as the specified MIME type +// +static char* readDataOfferAsString(struct wl_data_offer* offer, const char* mimeType) +{ + int fds[2]; + + if (pipe2(fds, O_CLOEXEC) == -1) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to create pipe for data offer: %s", + strerror(errno)); + return NULL; + } + + wl_data_offer_receive(offer, mimeType, fds[1]); + flushDisplay(); + close(fds[1]); + + char* string = NULL; + size_t size = 0; + size_t length = 0; + + for (;;) + { + const size_t readSize = 4096; + const size_t requiredSize = length + readSize + 1; + if (requiredSize > size) + { + char* longer = realloc(string, requiredSize); + if (!longer) + { + _glfwInputError(GLFW_OUT_OF_MEMORY, NULL); + close(fds[0]); + return NULL; + } + + string = longer; + size = requiredSize; + } + + const ssize_t result = read(fds[0], string + length, readSize); + if (result == 0) + break; + else if (result == -1) + { + if (errno == EINTR) + continue; + + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to read from data offer pipe: %s", + strerror(errno)); + close(fds[0]); + return NULL; + } + + length += result; + } + + close(fds[0]); + + string[length] = '\0'; + return string; +} + +static _GLFWwindow* findWindowFromDecorationSurface(struct wl_surface* surface, + _GLFWdecorationSideWayland* which) +{ + _GLFWdecorationSideWayland focus; + _GLFWwindow* window = _glfw.windowListHead; + if (!which) + which = &focus; + while (window) + { + if (surface == window->wl.decorations.top.surface) + { + *which = topDecoration; + break; + } + if (surface == window->wl.decorations.left.surface) + { + *which = leftDecoration; + break; + } + if (surface == window->wl.decorations.right.surface) + { + *which = rightDecoration; + break; + } + if (surface == window->wl.decorations.bottom.surface) + { + *which = bottomDecoration; + break; + } + window = window->next; + } + return window; +} + +static void pointerHandleEnter(void* userData, + struct wl_pointer* pointer, + uint32_t serial, + struct wl_surface* surface, + wl_fixed_t sx, + wl_fixed_t sy) +{ + // Happens in the case we just destroyed the surface. + if (!surface) + return; + + _GLFWdecorationSideWayland focus = mainWindow; + _GLFWwindow* window = wl_surface_get_user_data(surface); + if (!window) + { + window = findWindowFromDecorationSurface(surface, &focus); + if (!window) + return; + } + + window->wl.decorations.focus = focus; + _glfw.wl.serial = serial; + _glfw.wl.pointerEnterSerial = serial; + _glfw.wl.pointerFocus = window; + + window->wl.hovered = GLFW_TRUE; + + _glfwPlatformSetCursor(window, window->wl.currentCursor); + _glfwInputCursorEnter(window, GLFW_TRUE); +} + +static void pointerHandleLeave(void* userData, + struct wl_pointer* pointer, + uint32_t serial, + struct wl_surface* surface) +{ + _GLFWwindow* window = _glfw.wl.pointerFocus; + + if (!window) + return; + + window->wl.hovered = GLFW_FALSE; + + _glfw.wl.serial = serial; + _glfw.wl.pointerFocus = NULL; + _glfwInputCursorEnter(window, GLFW_FALSE); + _glfw.wl.cursorPreviousName = NULL; +} + +static void setCursor(_GLFWwindow* window, const char* name) +{ + struct wl_buffer* buffer; + struct wl_cursor* cursor; + struct wl_cursor_image* image; + struct wl_surface* surface = _glfw.wl.cursorSurface; + struct wl_cursor_theme* theme = _glfw.wl.cursorTheme; + int scale = 1; + + if (window->wl.scale > 1 && _glfw.wl.cursorThemeHiDPI) + { + // We only support up to scale=2 for now, since libwayland-cursor + // requires us to load a different theme for each size. + scale = 2; + theme = _glfw.wl.cursorThemeHiDPI; + } + + cursor = wl_cursor_theme_get_cursor(theme, name); + if (!cursor) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Standard cursor shape unavailable"); + return; + } + // TODO: handle animated cursors too. + image = cursor->images[0]; + + if (!image) + return; + + buffer = wl_cursor_image_get_buffer(image); + if (!buffer) + return; + wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial, + surface, + image->hotspot_x / scale, + image->hotspot_y / scale); + wl_surface_set_buffer_scale(surface, scale); + wl_surface_attach(surface, buffer, 0, 0); + wl_surface_damage(surface, 0, 0, + image->width, image->height); + wl_surface_commit(surface); + _glfw.wl.cursorPreviousName = name; +} + +static void pointerHandleMotion(void* userData, + struct wl_pointer* pointer, + uint32_t time, + wl_fixed_t sx, + wl_fixed_t sy) +{ + _GLFWwindow* window = _glfw.wl.pointerFocus; + const char* cursorName = NULL; + double x, y; + + if (!window) + return; + + if (window->cursorMode == GLFW_CURSOR_DISABLED) + return; + x = wl_fixed_to_double(sx); + y = wl_fixed_to_double(sy); + window->wl.cursorPosX = x; + window->wl.cursorPosY = y; + + switch (window->wl.decorations.focus) + { + case mainWindow: + _glfwInputCursorPos(window, x, y); + _glfw.wl.cursorPreviousName = NULL; + return; + case topDecoration: + if (y < GLFW_BORDER_SIZE) + cursorName = "n-resize"; + else + cursorName = "left_ptr"; + break; + case leftDecoration: + if (y < GLFW_BORDER_SIZE) + cursorName = "nw-resize"; + else + cursorName = "w-resize"; + break; + case rightDecoration: + if (y < GLFW_BORDER_SIZE) + cursorName = "ne-resize"; + else + cursorName = "e-resize"; + break; + case bottomDecoration: + if (x < GLFW_BORDER_SIZE) + cursorName = "sw-resize"; + else if (x > window->wl.width + GLFW_BORDER_SIZE) + cursorName = "se-resize"; + else + cursorName = "s-resize"; + break; + default: + assert(0); + } + if (_glfw.wl.cursorPreviousName != cursorName) + setCursor(window, cursorName); +} + +static void pointerHandleButton(void* userData, + struct wl_pointer* pointer, + uint32_t serial, + uint32_t time, + uint32_t button, + uint32_t state) +{ + _GLFWwindow* window = _glfw.wl.pointerFocus; + int glfwButton; + + uint32_t edges = XDG_TOPLEVEL_RESIZE_EDGE_NONE; + + if (!window) + return; + if (button == BTN_LEFT) + { + switch (window->wl.decorations.focus) + { + case mainWindow: + break; + case topDecoration: + if (window->wl.cursorPosY < GLFW_BORDER_SIZE) + edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP; + else + { + xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial); + } + break; + case leftDecoration: + if (window->wl.cursorPosY < GLFW_BORDER_SIZE) + edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT; + else + edges = XDG_TOPLEVEL_RESIZE_EDGE_LEFT; + break; + case rightDecoration: + if (window->wl.cursorPosY < GLFW_BORDER_SIZE) + edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT; + else + edges = XDG_TOPLEVEL_RESIZE_EDGE_RIGHT; + break; + case bottomDecoration: + if (window->wl.cursorPosX < GLFW_BORDER_SIZE) + edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT; + else if (window->wl.cursorPosX > window->wl.width + GLFW_BORDER_SIZE) + edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT; + else + edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM; + break; + default: + assert(0); + } + if (edges != XDG_TOPLEVEL_RESIZE_EDGE_NONE) + { + xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat, + serial, edges); + return; + } + } + else if (button == BTN_RIGHT) + { + if (window->wl.decorations.focus != mainWindow && window->wl.xdg.toplevel) + { + xdg_toplevel_show_window_menu(window->wl.xdg.toplevel, + _glfw.wl.seat, serial, + window->wl.cursorPosX, + window->wl.cursorPosY); + return; + } + } + + // Don’t pass the button to the user if it was related to a decoration. + if (window->wl.decorations.focus != mainWindow) + return; + + _glfw.wl.serial = serial; + + /* Makes left, right and middle 0, 1 and 2. Overall order follows evdev + * codes. */ + glfwButton = button - BTN_LEFT; + + _glfwInputMouseClick(window, + glfwButton, + state == WL_POINTER_BUTTON_STATE_PRESSED + ? GLFW_PRESS + : GLFW_RELEASE, + _glfw.wl.xkb.modifiers); +} + +static void pointerHandleAxis(void* userData, + struct wl_pointer* pointer, + uint32_t time, + uint32_t axis, + wl_fixed_t value) +{ + _GLFWwindow* window = _glfw.wl.pointerFocus; + double x = 0.0, y = 0.0; + // Wayland scroll events are in pointer motion coordinate space (think two + // finger scroll). The factor 10 is commonly used to convert to "scroll + // step means 1.0. + const double scrollFactor = 1.0 / 10.0; + + if (!window) + return; + + assert(axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL || + axis == WL_POINTER_AXIS_VERTICAL_SCROLL); + + if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) + x = -wl_fixed_to_double(value) * scrollFactor; + else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL) + y = -wl_fixed_to_double(value) * scrollFactor; + + _glfwInputScroll(window, x, y); +} + +static const struct wl_pointer_listener pointerListener = +{ + pointerHandleEnter, + pointerHandleLeave, + pointerHandleMotion, + pointerHandleButton, + pointerHandleAxis, +}; + +static void keyboardHandleKeymap(void* userData, + struct wl_keyboard* keyboard, + uint32_t format, + int fd, + uint32_t size) +{ + struct xkb_keymap* keymap; + struct xkb_state* state; + struct xkb_compose_table* composeTable; + struct xkb_compose_state* composeState; + char* mapStr; + const char* locale; + + if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) + { + close(fd); + return; + } + + mapStr = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); + if (mapStr == MAP_FAILED) { + close(fd); + return; + } + + keymap = xkb_keymap_new_from_string(_glfw.wl.xkb.context, + mapStr, + XKB_KEYMAP_FORMAT_TEXT_V1, + 0); + munmap(mapStr, size); + close(fd); + + if (!keymap) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to compile keymap"); + return; + } + + state = xkb_state_new(keymap); + if (!state) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to create XKB state"); + xkb_keymap_unref(keymap); + return; + } + + // Look up the preferred locale, falling back to "C" as default. + locale = getenv("LC_ALL"); + if (!locale) + locale = getenv("LC_CTYPE"); + if (!locale) + locale = getenv("LANG"); + if (!locale) + locale = "C"; + + composeTable = + xkb_compose_table_new_from_locale(_glfw.wl.xkb.context, locale, + XKB_COMPOSE_COMPILE_NO_FLAGS); + if (composeTable) + { + composeState = + xkb_compose_state_new(composeTable, XKB_COMPOSE_STATE_NO_FLAGS); + xkb_compose_table_unref(composeTable); + if (composeState) + _glfw.wl.xkb.composeState = composeState; + else + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to create XKB compose state"); + } + else + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to create XKB compose table"); + } + + xkb_keymap_unref(_glfw.wl.xkb.keymap); + xkb_state_unref(_glfw.wl.xkb.state); + _glfw.wl.xkb.keymap = keymap; + _glfw.wl.xkb.state = state; + + _glfw.wl.xkb.controlIndex = xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Control"); + _glfw.wl.xkb.altIndex = xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod1"); + _glfw.wl.xkb.shiftIndex = xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Shift"); + _glfw.wl.xkb.superIndex = xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod4"); + _glfw.wl.xkb.capsLockIndex = xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Lock"); + _glfw.wl.xkb.numLockIndex = xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod2"); +} + +static void keyboardHandleEnter(void* userData, + struct wl_keyboard* keyboard, + uint32_t serial, + struct wl_surface* surface, + struct wl_array* keys) +{ + // Happens in the case we just destroyed the surface. + if (!surface) + return; + + _GLFWwindow* window = wl_surface_get_user_data(surface); + if (!window) + { + window = findWindowFromDecorationSurface(surface, NULL); + if (!window) + return; + } + + _glfw.wl.serial = serial; + _glfw.wl.keyboardFocus = window; + _glfwInputWindowFocus(window, GLFW_TRUE); +} + +static void keyboardHandleLeave(void* userData, + struct wl_keyboard* keyboard, + uint32_t serial, + struct wl_surface* surface) +{ + _GLFWwindow* window = _glfw.wl.keyboardFocus; + + if (!window) + return; + + struct itimerspec timer = {}; + timerfd_settime(_glfw.wl.timerfd, 0, &timer, NULL); + + _glfw.wl.serial = serial; + _glfw.wl.keyboardFocus = NULL; + _glfwInputWindowFocus(window, GLFW_FALSE); +} + +static int translateKey(uint32_t scancode) +{ + if (scancode < sizeof(_glfw.wl.keycodes) / sizeof(_glfw.wl.keycodes[0])) + return _glfw.wl.keycodes[scancode]; + + return GLFW_KEY_UNKNOWN; +} + +static xkb_keysym_t composeSymbol(xkb_keysym_t sym) +{ + if (sym == XKB_KEY_NoSymbol || !_glfw.wl.xkb.composeState) + return sym; + if (xkb_compose_state_feed(_glfw.wl.xkb.composeState, sym) + != XKB_COMPOSE_FEED_ACCEPTED) + return sym; + switch (xkb_compose_state_get_status(_glfw.wl.xkb.composeState)) + { + case XKB_COMPOSE_COMPOSED: + return xkb_compose_state_get_one_sym(_glfw.wl.xkb.composeState); + case XKB_COMPOSE_COMPOSING: + case XKB_COMPOSE_CANCELLED: + return XKB_KEY_NoSymbol; + case XKB_COMPOSE_NOTHING: + default: + return sym; + } +} + +GLFWbool _glfwInputTextWayland(_GLFWwindow* window, uint32_t scancode) +{ + const xkb_keysym_t* keysyms; + const xkb_keycode_t keycode = scancode + 8; + + if (xkb_state_key_get_syms(_glfw.wl.xkb.state, keycode, &keysyms) == 1) + { + const xkb_keysym_t keysym = composeSymbol(keysyms[0]); + const uint32_t codepoint = _glfwKeySym2Unicode(keysym); + if (codepoint != GLFW_INVALID_CODEPOINT) + { + const int mods = _glfw.wl.xkb.modifiers; + const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT)); + _glfwInputChar(window, codepoint, mods, plain); + } + } + + return xkb_keymap_key_repeats(_glfw.wl.xkb.keymap, keycode); +} + +static void keyboardHandleKey(void* userData, + struct wl_keyboard* keyboard, + uint32_t serial, + uint32_t time, + uint32_t scancode, + uint32_t state) +{ + _GLFWwindow* window = _glfw.wl.keyboardFocus; + if (!window) + return; + + const int key = translateKey(scancode); + const int action = + state == WL_KEYBOARD_KEY_STATE_PRESSED ? GLFW_PRESS : GLFW_RELEASE; + + _glfw.wl.serial = serial; + _glfwInputKey(window, key, scancode, action, _glfw.wl.xkb.modifiers); + + struct itimerspec timer = {}; + + if (action == GLFW_PRESS) + { + const GLFWbool shouldRepeat = _glfwInputTextWayland(window, scancode); + + if (shouldRepeat && _glfw.wl.keyboardRepeatRate > 0) + { + _glfw.wl.keyboardLastKey = key; + _glfw.wl.keyboardLastScancode = scancode; + if (_glfw.wl.keyboardRepeatRate > 1) + timer.it_interval.tv_nsec = 1000000000 / _glfw.wl.keyboardRepeatRate; + else + timer.it_interval.tv_sec = 1; + + timer.it_value.tv_sec = _glfw.wl.keyboardRepeatDelay / 1000; + timer.it_value.tv_nsec = (_glfw.wl.keyboardRepeatDelay % 1000) * 1000000; + } + } + + timerfd_settime(_glfw.wl.timerfd, 0, &timer, NULL); +} + +static void keyboardHandleModifiers(void* userData, + struct wl_keyboard* keyboard, + uint32_t serial, + uint32_t modsDepressed, + uint32_t modsLatched, + uint32_t modsLocked, + uint32_t group) +{ + _glfw.wl.serial = serial; + + if (!_glfw.wl.xkb.keymap) + return; + + xkb_state_update_mask(_glfw.wl.xkb.state, + modsDepressed, + modsLatched, + modsLocked, + 0, + 0, + group); + + _glfw.wl.xkb.modifiers = 0; + + struct + { + xkb_mod_index_t index; + unsigned int bit; + } modifiers[] = + { + { _glfw.wl.xkb.controlIndex, GLFW_MOD_CONTROL }, + { _glfw.wl.xkb.altIndex, GLFW_MOD_ALT }, + { _glfw.wl.xkb.shiftIndex, GLFW_MOD_SHIFT }, + { _glfw.wl.xkb.superIndex, GLFW_MOD_SUPER }, + { _glfw.wl.xkb.capsLockIndex, GLFW_MOD_CAPS_LOCK }, + { _glfw.wl.xkb.numLockIndex, GLFW_MOD_NUM_LOCK } + }; + + for (size_t i = 0; i < sizeof(modifiers) / sizeof(modifiers[0]); i++) + { + if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state, + modifiers[i].index, + XKB_STATE_MODS_EFFECTIVE) == 1) + { + _glfw.wl.xkb.modifiers |= modifiers[i].bit; + } + } +} + +#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION +static void keyboardHandleRepeatInfo(void* userData, + struct wl_keyboard* keyboard, + int32_t rate, + int32_t delay) +{ + if (keyboard != _glfw.wl.keyboard) + return; + + _glfw.wl.keyboardRepeatRate = rate; + _glfw.wl.keyboardRepeatDelay = delay; +} +#endif + +static const struct wl_keyboard_listener keyboardListener = +{ + keyboardHandleKeymap, + keyboardHandleEnter, + keyboardHandleLeave, + keyboardHandleKey, + keyboardHandleModifiers, +#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION + keyboardHandleRepeatInfo, +#endif +}; + +static void seatHandleCapabilities(void* userData, + struct wl_seat* seat, + enum wl_seat_capability caps) +{ + if ((caps & WL_SEAT_CAPABILITY_POINTER) && !_glfw.wl.pointer) + { + _glfw.wl.pointer = wl_seat_get_pointer(seat); + wl_pointer_add_listener(_glfw.wl.pointer, &pointerListener, NULL); + } + else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && _glfw.wl.pointer) + { + wl_pointer_destroy(_glfw.wl.pointer); + _glfw.wl.pointer = NULL; + } + + if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !_glfw.wl.keyboard) + { + _glfw.wl.keyboard = wl_seat_get_keyboard(seat); + wl_keyboard_add_listener(_glfw.wl.keyboard, &keyboardListener, NULL); + } + else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && _glfw.wl.keyboard) + { + wl_keyboard_destroy(_glfw.wl.keyboard); + _glfw.wl.keyboard = NULL; + } +} + +static void seatHandleName(void* userData, + struct wl_seat* seat, + const char* name) +{ +} + +static const struct wl_seat_listener seatListener = +{ + seatHandleCapabilities, + seatHandleName, +}; + +static void dataOfferHandleOffer(void* userData, + struct wl_data_offer* offer, + const char* mimeType) +{ + for (unsigned int i = 0; i < _glfw.wl.offerCount; i++) + { + if (_glfw.wl.offers[i].offer == offer) + { + if (strcmp(mimeType, "text/plain;charset=utf-8") == 0) + _glfw.wl.offers[i].text_plain_utf8 = GLFW_TRUE; + else if (strcmp(mimeType, "text/uri-list") == 0) + _glfw.wl.offers[i].text_uri_list = GLFW_TRUE; + + break; + } + } +} + +static const struct wl_data_offer_listener dataOfferListener = +{ + dataOfferHandleOffer +}; + +static void dataDeviceHandleDataOffer(void* userData, + struct wl_data_device* device, + struct wl_data_offer* offer) +{ + _GLFWofferWayland* offers = + realloc(_glfw.wl.offers, _glfw.wl.offerCount + 1); + if (!offers) + { + _glfwInputError(GLFW_OUT_OF_MEMORY, NULL); + return; + } + + _glfw.wl.offers = offers; + _glfw.wl.offerCount++; + + _glfw.wl.offers[_glfw.wl.offerCount - 1] = (_GLFWofferWayland) { offer }; + wl_data_offer_add_listener(offer, &dataOfferListener, NULL); +} + +static void dataDeviceHandleEnter(void* userData, + struct wl_data_device* device, + uint32_t serial, + struct wl_surface* surface, + wl_fixed_t x, + wl_fixed_t y, + struct wl_data_offer* offer) +{ + if (_glfw.wl.dragOffer) + { + wl_data_offer_destroy(_glfw.wl.dragOffer); + _glfw.wl.dragOffer = NULL; + _glfw.wl.dragFocus = NULL; + } + + for (unsigned int i = 0; i < _glfw.wl.offerCount; i++) + { + if (_glfw.wl.offers[i].offer == offer) + { + _GLFWwindow* window = NULL; + + if (surface) + window = wl_surface_get_user_data(surface); + + if (window && _glfw.wl.offers[i].text_uri_list) + { + _glfw.wl.dragOffer = offer; + _glfw.wl.dragFocus = window; + _glfw.wl.dragSerial = serial; + } + + _glfw.wl.offers[i] = _glfw.wl.offers[_glfw.wl.offerCount - 1]; + _glfw.wl.offerCount--; + break; + } + } + + if (_glfw.wl.dragOffer) + wl_data_offer_accept(offer, serial, "text/uri-list"); + else + { + wl_data_offer_accept(offer, serial, NULL); + wl_data_offer_destroy(offer); + } +} + +static void dataDeviceHandleLeave(void* userData, + struct wl_data_device* device) +{ + if (_glfw.wl.dragOffer) + { + wl_data_offer_destroy(_glfw.wl.dragOffer); + _glfw.wl.dragOffer = NULL; + _glfw.wl.dragFocus = NULL; + } +} + +static void dataDeviceHandleMotion(void* userData, + struct wl_data_device* device, + uint32_t time, + wl_fixed_t x, + wl_fixed_t y) { - struct wl_display* display = _glfw.wl.display; - struct pollfd fds[] = { - { wl_display_get_fd(display), POLLIN }, - { _glfw.wl.timerfd, POLLIN }, - { _glfw.wl.cursorTimerfd, POLLIN }, - }; - ssize_t read_ret; - uint64_t repeats, i; - - while (wl_display_prepare_read(display) != 0) - wl_display_dispatch_pending(display); +} - // If an error different from EAGAIN happens, we have likely been - // disconnected from the Wayland session, try to handle that the best we - // can. - if (wl_display_flush(display) < 0 && errno != EAGAIN) - { - _GLFWwindow* window = _glfw.windowListHead; - while (window) - { - _glfwInputWindowCloseRequest(window); - window = window->next; - } - wl_display_cancel_read(display); +static void dataDeviceHandleDrop(void* userData, + struct wl_data_device* device) +{ + if (!_glfw.wl.dragOffer) return; - } - if (poll(fds, 3, timeout) > 0) + char* string = readDataOfferAsString(_glfw.wl.dragOffer, "text/uri-list"); + if (string) { - if (fds[0].revents & POLLIN) - { - wl_display_read_events(display); - wl_display_dispatch_pending(display); - } - else - { - wl_display_cancel_read(display); - } + int count; + char** paths = _glfwParseUriList(string, &count); + if (paths) + _glfwInputDrop(_glfw.wl.dragFocus, count, (const char**) paths); - if (fds[1].revents & POLLIN) - { - read_ret = read(_glfw.wl.timerfd, &repeats, sizeof(repeats)); - if (read_ret != 8) - return; + for (int i = 0; i < count; i++) + free(paths[i]); - for (i = 0; i < repeats; ++i) - _glfwInputKey(_glfw.wl.keyboardFocus, _glfw.wl.keyboardLastKey, - _glfw.wl.keyboardLastScancode, GLFW_REPEAT, - _glfw.wl.xkb.modifiers); - } + free(paths); + } - if (fds[2].revents & POLLIN) - { - read_ret = read(_glfw.wl.cursorTimerfd, &repeats, sizeof(repeats)); - if (read_ret != 8) - return; + free(string); +} - incrementCursorImage(_glfw.wl.pointerFocus); - } +static void dataDeviceHandleSelection(void* userData, + struct wl_data_device* device, + struct wl_data_offer* offer) +{ + if (_glfw.wl.selectionOffer) + { + wl_data_offer_destroy(_glfw.wl.selectionOffer); + _glfw.wl.selectionOffer = NULL; } - else + + for (unsigned int i = 0; i < _glfw.wl.offerCount; i++) { - wl_display_cancel_read(display); + if (_glfw.wl.offers[i].offer == offer) + { + if (_glfw.wl.offers[i].text_plain_utf8) + _glfw.wl.selectionOffer = offer; + else + wl_data_offer_destroy(offer); + + _glfw.wl.offers[i] = _glfw.wl.offers[_glfw.wl.offerCount - 1]; + _glfw.wl.offerCount--; + break; + } } } +const struct wl_data_device_listener dataDeviceListener = +{ + dataDeviceHandleDataOffer, + dataDeviceHandleEnter, + dataDeviceHandleLeave, + dataDeviceHandleMotion, + dataDeviceHandleDrop, + dataDeviceHandleSelection, +}; + // Translates a GLFW standard cursor to a theme cursor name // static char *translateCursorShape(int shape) @@ -913,6 +1840,17 @@ static char *translateCursorShape(int shape) return NULL; } +void _glfwAddSeatListenerWayland(struct wl_seat* seat) +{ + wl_seat_add_listener(seat, &seatListener, NULL); +} + +void _glfwAddDataDeviceListenerWayland(struct wl_data_device* device) +{ + wl_data_device_add_listener(device, &dataDeviceListener, NULL); +} + + ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// @@ -922,9 +1860,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { - window->wl.transparent = fbconfig->transparent; - - if (!createSurface(window, wndconfig)) + if (!createNativeSurface(window, wndconfig, fbconfig)) return GLFW_FALSE; if (ctxconfig->client != GLFW_NO_API) @@ -932,6 +1868,16 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, if (ctxconfig->source == GLFW_EGL_CONTEXT_API || ctxconfig->source == GLFW_NATIVE_CONTEXT_API) { + window->wl.egl.window = wl_egl_window_create(window->wl.surface, + wndconfig->width, + wndconfig->height); + if (!window->wl.egl.window) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to create EGL window"); + return GLFW_FALSE; + } + if (!_glfwInitEGL()) return GLFW_FALSE; if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig)) @@ -944,40 +1890,17 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) return GLFW_FALSE; } - } - - if (wndconfig->title) - window->wl.title = _glfw_strdup(wndconfig->title); - - if (wndconfig->visible) - { - if (_glfw.wl.wmBase) - { - if (!createXdgSurface(window)) - return GLFW_FALSE; - } - else - { - if (!createShellSurface(window)) - return GLFW_FALSE; - } - window->wl.visible = GLFW_TRUE; + if (!_glfwRefreshContextAttribs(window, ctxconfig)) + return GLFW_FALSE; } - else + + if (window->monitor || wndconfig->visible) { - window->wl.xdg.surface = NULL; - window->wl.xdg.toplevel = NULL; - window->wl.shellSurface = NULL; - window->wl.visible = GLFW_FALSE; + if (!createShellObjects(window)) + return GLFW_FALSE; } - window->wl.currentCursor = NULL; - - window->wl.monitors = calloc(1, sizeof(_GLFWmonitor*)); - window->wl.monitorsCount = 0; - window->wl.monitorsSize = 1; - return GLFW_TRUE; } @@ -1000,24 +1923,13 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window) if (window->context.destroy) window->context.destroy(window); - destroyDecorations(window); - if (window->wl.xdg.decoration) - zxdg_toplevel_decoration_v1_destroy(window->wl.xdg.decoration); + destroyShellObjects(window); if (window->wl.decorations.buffer) wl_buffer_destroy(window->wl.decorations.buffer); - if (window->wl.native) - wl_egl_window_destroy(window->wl.native); - - if (window->wl.shellSurface) - wl_shell_surface_destroy(window->wl.shellSurface); - - if (window->wl.xdg.toplevel) - xdg_toplevel_destroy(window->wl.xdg.toplevel); - - if (window->wl.xdg.surface) - xdg_surface_destroy(window->wl.xdg.surface); + if (window->wl.egl.window) + wl_egl_window_destroy(window->wl.egl.window); if (window->wl.surface) wl_surface_destroy(window->wl.surface); @@ -1033,8 +1945,6 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) window->wl.title = _glfw_strdup(title); if (window->wl.xdg.toplevel) xdg_toplevel_set_title(window->wl.xdg.toplevel, title); - else if (window->wl.shellSurface) - wl_shell_surface_set_title(window->wl.shellSurface, title); } void _glfwPlatformSetWindowIcon(_GLFWwindow* window, @@ -1071,64 +1981,95 @@ void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height) void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) { - window->wl.width = width; - window->wl.height = height; - resizeWindow(window); + if (window->monitor) + { + // Video mode setting is not available on Wayland + } + else + { + window->wl.width = width; + window->wl.height = height; + resizeWindow(window); + } } void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight) { - if (_glfw.wl.wmBase) + if (window->wl.xdg.toplevel) { - if (window->wl.xdg.toplevel) + if (minwidth == GLFW_DONT_CARE || minheight == GLFW_DONT_CARE) + minwidth = minheight = 0; + else { - if (minwidth == GLFW_DONT_CARE || minheight == GLFW_DONT_CARE) - minwidth = minheight = 0; - if (maxwidth == GLFW_DONT_CARE || maxheight == GLFW_DONT_CARE) - maxwidth = maxheight = 0; - xdg_toplevel_set_min_size(window->wl.xdg.toplevel, minwidth, minheight); - xdg_toplevel_set_max_size(window->wl.xdg.toplevel, maxwidth, maxheight); - wl_surface_commit(window->wl.surface); + if (window->wl.decorations.top.surface) + { + minwidth += GLFW_BORDER_SIZE * 2; + minheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE; + } } - } - else - { - // TODO: find out how to trigger a resize. - // The actual limits are checked in the wl_shell_surface::configure handler. + + if (maxwidth == GLFW_DONT_CARE || maxheight == GLFW_DONT_CARE) + maxwidth = maxheight = 0; + else + { + if (window->wl.decorations.top.surface) + { + maxwidth += GLFW_BORDER_SIZE * 2; + maxheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE; + } + } + + xdg_toplevel_set_min_size(window->wl.xdg.toplevel, minwidth, minheight); + xdg_toplevel_set_max_size(window->wl.xdg.toplevel, maxwidth, maxheight); + wl_surface_commit(window->wl.surface); } } void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom) { - // TODO: find out how to trigger a resize. - // The actual limits are checked in the wl_shell_surface::configure handler. + if (window->wl.maximized || window->wl.fullscreen) + return; + + if (numer != GLFW_DONT_CARE && denom != GLFW_DONT_CARE) + { + const float aspectRatio = (float) window->wl.width / (float) window->wl.height; + const float targetRatio = (float) numer / (float) denom; + if (aspectRatio < targetRatio) + window->wl.height = window->wl.width / targetRatio; + else if (aspectRatio > targetRatio) + window->wl.width = window->wl.height * targetRatio; + + resizeWindow(window); + } } void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height) { _glfwPlatformGetWindowSize(window, width, height); - *width *= window->wl.scale; - *height *= window->wl.scale; + if (width) + *width *= window->wl.scale; + if (height) + *height *= window->wl.scale; } void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, int* left, int* top, int* right, int* bottom) { - if (window->decorated && !window->monitor && !window->wl.decorations.serverSide) + if (window->decorated && !window->monitor && window->wl.decorations.top.surface) { if (top) - *top = _GLFW_DECORATION_TOP; + *top = GLFW_CAPTION_HEIGHT; if (left) - *left = _GLFW_DECORATION_WIDTH; + *left = GLFW_BORDER_SIZE; if (right) - *right = _GLFW_DECORATION_WIDTH; + *right = GLFW_BORDER_SIZE; if (bottom) - *bottom = _GLFW_DECORATION_WIDTH; + *bottom = GLFW_BORDER_SIZE; } } @@ -1143,79 +2084,59 @@ void _glfwPlatformGetWindowContentScale(_GLFWwindow* window, void _glfwPlatformIconifyWindow(_GLFWwindow* window) { - if (_glfw.wl.wmBase) - { - if (window->wl.xdg.toplevel) - xdg_toplevel_set_minimized(window->wl.xdg.toplevel); - } - else - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Iconify window not supported on wl_shell"); - } + if (window->wl.xdg.toplevel) + xdg_toplevel_set_minimized(window->wl.xdg.toplevel); } void _glfwPlatformRestoreWindow(_GLFWwindow* window) { - if (window->wl.xdg.toplevel) + if (window->monitor) { - if (window->monitor) - xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel); - if (window->wl.maximized) - xdg_toplevel_unset_maximized(window->wl.xdg.toplevel); // There is no way to unset minimized, or even to know if we are // minimized, so there is nothing to do here. } - else if (window->wl.shellSurface) + else { - if (window->monitor || window->wl.maximized) - wl_shell_surface_set_toplevel(window->wl.shellSurface); + // We assume we are not minimized and act only on maximization + + if (window->wl.maximized) + { + if (window->wl.xdg.toplevel) + xdg_toplevel_unset_maximized(window->wl.xdg.toplevel); + else + window->wl.maximized = GLFW_FALSE; + } } - _glfwInputWindowMonitor(window, NULL); - window->wl.maximized = GLFW_FALSE; } void _glfwPlatformMaximizeWindow(_GLFWwindow* window) { if (window->wl.xdg.toplevel) - { xdg_toplevel_set_maximized(window->wl.xdg.toplevel); - } - else if (window->wl.shellSurface) - { - // Let the compositor select the best output. - wl_shell_surface_set_maximized(window->wl.shellSurface, NULL); - } - window->wl.maximized = GLFW_TRUE; + else + window->wl.maximized = GLFW_TRUE; } void _glfwPlatformShowWindow(_GLFWwindow* window) { - if (!window->wl.visible) + if (!window->wl.xdg.toplevel) { - if (_glfw.wl.wmBase) - createXdgSurface(window); - else if (!window->wl.shellSurface) - createShellSurface(window); - window->wl.visible = GLFW_TRUE; + // NOTE: The XDG/shell surface is created here so command-line applications + // with off-screen windows do not appear in for example the Unity dock + createShellObjects(window); } } void _glfwPlatformHideWindow(_GLFWwindow* window) { - if (window->wl.xdg.toplevel) - { - xdg_toplevel_destroy(window->wl.xdg.toplevel); - xdg_surface_destroy(window->wl.xdg.surface); - window->wl.xdg.toplevel = NULL; - window->wl.xdg.surface = NULL; - } - else if (window->wl.shellSurface) + if (window->wl.visible) { - wl_shell_surface_destroy(window->wl.shellSurface); - window->wl.shellSurface = NULL; + window->wl.visible = GLFW_FALSE; + destroyShellObjects(window); + + wl_surface_attach(window->wl.surface, NULL, 0, 0); + wl_surface_commit(window->wl.surface); } - window->wl.visible = GLFW_FALSE; } void _glfwPlatformRequestWindowAttention(_GLFWwindow* window) @@ -1237,21 +2158,23 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, int width, int height, int refreshRate) { - if (monitor) - { - setFullscreen(window, monitor, refreshRate); - } - else + if (window->monitor == monitor) { - if (window->wl.xdg.toplevel) - xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel); - else if (window->wl.shellSurface) - wl_shell_surface_set_toplevel(window->wl.shellSurface); - setIdleInhibitor(window, GLFW_FALSE); - if (!_glfw.wl.decorationManager) - createDecorations(window); + if (!monitor) + _glfwPlatformSetWindowSize(window, width, height); + + return; } + + if (window->monitor) + releaseMonitor(window); + _glfwInputWindowMonitor(window, monitor); + + if (window->monitor) + acquireMonitor(window); + else + _glfwPlatformSetWindowSize(window, width, height); } int _glfwPlatformWindowFocused(_GLFWwindow* window) @@ -1261,8 +2184,7 @@ int _glfwPlatformWindowFocused(_GLFWwindow* window) int _glfwPlatformWindowIconified(_GLFWwindow* window) { - // wl_shell doesn't have any iconified concept, and xdg-shell doesn’t give - // any way to request whether a surface is iconified. + // xdg-shell doesn’t give any way to request whether a surface is iconified return GLFW_FALSE; } @@ -1295,12 +2217,23 @@ void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled) void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) { - if (!window->monitor) + if (window->wl.xdg.decoration) + { + uint32_t mode; + + if (enabled) + mode = ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE; + else + mode = ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE; + + zxdg_toplevel_decoration_v1_set_mode(window->wl.xdg.decoration, mode); + } + else { if (enabled) - createDecorations(window); + createFallbackDecorations(window); else - destroyDecorations(window); + destroyFallbackDecorations(window); } } @@ -1320,7 +2253,7 @@ void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity) { } -void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled) +void _glfwPlatformSetRawMouseMotion(_GLFWwindow* window, GLFWbool enabled) { // This is handled in relativePointerHandleRelativeMotion } @@ -1332,22 +2265,24 @@ GLFWbool _glfwPlatformRawMouseMotionSupported(void) void _glfwPlatformPollEvents(void) { - handleEvents(0); + double timeout = 0.0; + handleEvents(&timeout); } void _glfwPlatformWaitEvents(void) { - handleEvents(-1); + handleEvents(NULL); } void _glfwPlatformWaitEventsTimeout(double timeout) { - handleEvents((int) (timeout * 1e3)); + handleEvents(&timeout); } void _glfwPlatformPostEmptyEvent(void) { wl_display_sync(_glfw.wl.display); + flushDisplay(); } void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos) @@ -1367,7 +2302,6 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y) zwp_locked_pointer_v1_set_cursor_position_hint( window->wl.pointerLock.lockedPointer, wl_fixed_from_double(x), wl_fixed_from_double(y)); - wl_surface_commit(window->wl.surface); } } @@ -1378,8 +2312,57 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode) const char* _glfwPlatformGetScancodeName(int scancode) { - // TODO - return NULL; + if (scancode < 0 || scancode > 255 || + _glfw.wl.keycodes[scancode] == GLFW_KEY_UNKNOWN) + { + _glfwInputError(GLFW_INVALID_VALUE, + "Wayland: Invalid scancode %i", + scancode); + return NULL; + } + + const int key = _glfw.wl.keycodes[scancode]; + const xkb_keycode_t keycode = scancode + 8; + const xkb_layout_index_t layout = + xkb_state_key_get_layout(_glfw.wl.xkb.state, keycode); + if (layout == XKB_LAYOUT_INVALID) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to retrieve layout for key name"); + return NULL; + } + + const xkb_keysym_t* keysyms = NULL; + xkb_keymap_key_get_syms_by_level(_glfw.wl.xkb.keymap, + keycode, + layout, + 0, + &keysyms); + if (keysyms == NULL) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to retrieve keysym for key name"); + return NULL; + } + + const uint32_t codepoint = _glfwKeySym2Unicode(keysyms[0]); + if (codepoint == GLFW_INVALID_CODEPOINT) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to retrieve codepoint for key name"); + return NULL; + } + + const size_t count = _glfwEncodeUTF8(_glfw.wl.keynames[key], codepoint); + if (count == 0) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to encode codepoint for key name"); + return NULL; + } + + _glfw.wl.keynames[key][count] = '\0'; + return _glfw.wl.keynames[key]; } int _glfwPlatformGetKeyScancode(int key) @@ -1439,7 +2422,7 @@ void _glfwPlatformDestroyCursor(_GLFWcursor* cursor) wl_buffer_destroy(cursor->wl.buffer); } -static void relativePointerHandleRelativeMotion(void* data, +static void relativePointerHandleRelativeMotion(void* userData, struct zwp_relative_pointer_v1* pointer, uint32_t timeHi, uint32_t timeLo, @@ -1448,7 +2431,7 @@ static void relativePointerHandleRelativeMotion(void* data, wl_fixed_t dxUnaccel, wl_fixed_t dyUnaccel) { - _GLFWwindow* window = data; + _GLFWwindow* window = userData; double xpos = window->virtualCursorPosX; double ypos = window->virtualCursorPosY; @@ -1469,11 +2452,12 @@ static void relativePointerHandleRelativeMotion(void* data, _glfwInputCursorPos(window, xpos, ypos); } -static const struct zwp_relative_pointer_v1_listener relativePointerListener = { +static const struct zwp_relative_pointer_v1_listener relativePointerListener = +{ relativePointerHandleRelativeMotion }; -static void lockedPointerHandleLocked(void* data, +static void lockedPointerHandleLocked(void* userData, struct zwp_locked_pointer_v1* lockedPointer) { } @@ -1494,12 +2478,13 @@ static void unlockPointer(_GLFWwindow* window) static void lockPointer(_GLFWwindow* window); -static void lockedPointerHandleUnlocked(void* data, +static void lockedPointerHandleUnlocked(void* userData, struct zwp_locked_pointer_v1* lockedPointer) { } -static const struct zwp_locked_pointer_v1_listener lockedPointerListener = { +static const struct zwp_locked_pointer_v1_listener lockedPointerListener = +{ lockedPointerHandleLocked, lockedPointerHandleUnlocked }; @@ -1538,7 +2523,7 @@ static void lockPointer(_GLFWwindow* window) window->wl.pointerLock.relativePointer = relativePointer; window->wl.pointerLock.lockedPointer = lockedPointer; - wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, + wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial, NULL, 0, 0); } @@ -1602,15 +2587,15 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) } else if (window->cursorMode == GLFW_CURSOR_HIDDEN) { - wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, NULL, 0, 0); + wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial, NULL, 0, 0); } } -static void dataSourceHandleTarget(void* data, - struct wl_data_source* dataSource, +static void dataSourceHandleTarget(void* userData, + struct wl_data_source* source, const char* mimeType) { - if (_glfw.wl.dataSource != dataSource) + if (_glfw.wl.selectionSource != source) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Unknown clipboard data source"); @@ -1618,71 +2603,56 @@ static void dataSourceHandleTarget(void* data, } } -static void dataSourceHandleSend(void* data, - struct wl_data_source* dataSource, +static void dataSourceHandleSend(void* userData, + struct wl_data_source* source, const char* mimeType, int fd) { - const char* string = _glfw.wl.clipboardSendString; - size_t len = _glfw.wl.clipboardSendSize; - int ret; - - if (_glfw.wl.dataSource != dataSource) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Unknown clipboard data source"); - return; - } - - if (!string) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Copy requested from an invalid string"); - return; - } - - if (strcmp(mimeType, "text/plain;charset=utf-8") != 0) + // Ignore it if this is an outdated or invalid request + if (_glfw.wl.selectionSource != source || + strcmp(mimeType, "text/plain;charset=utf-8") != 0) { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Wrong MIME type asked from clipboard"); close(fd); return; } - while (len > 0) + char* string = _glfw.wl.clipboardString; + size_t length = strlen(string); + + while (length > 0) { - ret = write(fd, string, len); - if (ret == -1 && errno == EINTR) - continue; - if (ret == -1) + const ssize_t result = write(fd, string, length); + if (result == -1) { - // TODO: also report errno maybe. + if (errno == EINTR) + continue; + _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Error while writing the clipboard"); - close(fd); - return; + "Wayland: Error while writing the clipboard: %s", + strerror(errno)); + break; } - len -= ret; + + length -= result; + string += result; } + close(fd); } -static void dataSourceHandleCancelled(void* data, - struct wl_data_source* dataSource) +static void dataSourceHandleCancelled(void* userData, + struct wl_data_source* source) { - wl_data_source_destroy(dataSource); + wl_data_source_destroy(source); - if (_glfw.wl.dataSource != dataSource) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Unknown clipboard data source"); + if (_glfw.wl.selectionSource != source) return; - } - _glfw.wl.dataSource = NULL; + _glfw.wl.selectionSource = NULL; } -static const struct wl_data_source_listener dataSourceListener = { +static const struct wl_data_source_listener dataSourceListener = +{ dataSourceHandleTarget, dataSourceHandleSend, dataSourceHandleCancelled, @@ -1690,124 +2660,54 @@ static const struct wl_data_source_listener dataSourceListener = { void _glfwPlatformSetClipboardString(const char* string) { - if (_glfw.wl.dataSource) + if (_glfw.wl.selectionSource) { - wl_data_source_destroy(_glfw.wl.dataSource); - _glfw.wl.dataSource = NULL; + wl_data_source_destroy(_glfw.wl.selectionSource); + _glfw.wl.selectionSource = NULL; } - if (_glfw.wl.clipboardSendString) + char* copy = _glfw_strdup(string); + if (!copy) { - free(_glfw.wl.clipboardSendString); - _glfw.wl.clipboardSendString = NULL; - } - - _glfw.wl.clipboardSendString = strdup(string); - if (!_glfw.wl.clipboardSendString) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Impossible to allocate clipboard string"); + _glfwInputError(GLFW_OUT_OF_MEMORY, NULL); return; } - _glfw.wl.clipboardSendSize = strlen(string); - _glfw.wl.dataSource = + + free(_glfw.wl.clipboardString); + _glfw.wl.clipboardString = copy; + + _glfw.wl.selectionSource = wl_data_device_manager_create_data_source(_glfw.wl.dataDeviceManager); - if (!_glfw.wl.dataSource) + if (!_glfw.wl.selectionSource) { _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Impossible to create clipboard source"); - free(_glfw.wl.clipboardSendString); + "Wayland: Failed to create clipboard data source"); return; } - wl_data_source_add_listener(_glfw.wl.dataSource, + wl_data_source_add_listener(_glfw.wl.selectionSource, &dataSourceListener, NULL); - wl_data_source_offer(_glfw.wl.dataSource, "text/plain;charset=utf-8"); + wl_data_source_offer(_glfw.wl.selectionSource, "text/plain;charset=utf-8"); wl_data_device_set_selection(_glfw.wl.dataDevice, - _glfw.wl.dataSource, + _glfw.wl.selectionSource, _glfw.wl.serial); } -static GLFWbool growClipboardString(void) -{ - char* clipboard = _glfw.wl.clipboardString; - - clipboard = realloc(clipboard, _glfw.wl.clipboardSize * 2); - if (!clipboard) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Impossible to grow clipboard string"); - return GLFW_FALSE; - } - _glfw.wl.clipboardString = clipboard; - _glfw.wl.clipboardSize = _glfw.wl.clipboardSize * 2; - return GLFW_TRUE; -} - const char* _glfwPlatformGetClipboardString(void) { - int fds[2]; - int ret; - size_t len = 0; - - if (!_glfw.wl.dataOffer) + if (!_glfw.wl.selectionOffer) { _glfwInputError(GLFW_FORMAT_UNAVAILABLE, - "No clipboard data has been sent yet"); - return NULL; - } - - ret = pipe2(fds, O_CLOEXEC); - if (ret < 0) - { - // TODO: also report errno maybe? - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Impossible to create clipboard pipe fds"); + "Wayland: No clipboard data available"); return NULL; } - wl_data_offer_receive(_glfw.wl.dataOffer, "text/plain;charset=utf-8", fds[1]); - close(fds[1]); - - // XXX: this is a huge hack, this function shouldn’t be synchronous! - handleEvents(-1); - - while (1) - { - // Grow the clipboard if we need to paste something bigger, there is no - // shrink operation yet. - if (len + 4096 > _glfw.wl.clipboardSize) - { - if (!growClipboardString()) - { - close(fds[0]); - return NULL; - } - } + if (_glfw.wl.selectionSource) + return _glfw.wl.clipboardString; - // Then read from the fd to the clipboard, handling all known errors. - ret = read(fds[0], _glfw.wl.clipboardString + len, 4096); - if (ret == 0) - break; - if (ret == -1 && errno == EINTR) - continue; - if (ret == -1) - { - // TODO: also report errno maybe. - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Impossible to read from clipboard fd"); - close(fds[0]); - return NULL; - } - len += ret; - } - close(fds[0]); - if (len + 1 > _glfw.wl.clipboardSize) - { - if (!growClipboardString()) - return NULL; - } - _glfw.wl.clipboardString[len] = '\0'; + free(_glfw.wl.clipboardString); + _glfw.wl.clipboardString = + readDataOfferAsString(_glfw.wl.selectionOffer, "text/plain;charset=utf-8"); return _glfw.wl.clipboardString; } diff --git a/third_party/penumbra/vendor/glfw/src/x11_init.c b/third_party/penumbra/vendor/glfw/src/x11_init.c index 2f220ec5087..6049904ae41 100644 --- a/third_party/penumbra/vendor/glfw/src/x11_init.c +++ b/third_party/penumbra/vendor/glfw/src/x11_init.c @@ -36,26 +36,21 @@ #include #include #include +#include +#include +#include +#include -// Translate an X11 key code to a GLFW key code. +// Translate the X11 KeySyms for a key to a GLFW key code +// NOTE: This is only used as a fallback, in case the XKB method fails +// It is layout-dependent and will fail partially on most non-US layouts // -static int translateKeyCode(int scancode) +static int translateKeySyms(const KeySym* keysyms, int width) { - int keySym; - - // Valid key code range is [8,255], according to the Xlib manual - if (scancode < 8 || scancode > 255) - return GLFW_KEY_UNKNOWN; - - if (_glfw.x11.xkb.available) + if (width > 1) { - // Try secondary keysym, for numeric keypad keys - // Note: This way we always force "NumLock = ON", which is intentional - // since the returned key code should correspond to a physical - // location. - keySym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, _glfw.x11.xkb.group, 1); - switch (keySym) + switch (keysyms[1]) { case XK_KP_0: return GLFW_KEY_KP_0; case XK_KP_1: return GLFW_KEY_KP_1; @@ -73,22 +68,9 @@ static int translateKeyCode(int scancode) case XK_KP_Enter: return GLFW_KEY_KP_ENTER; default: break; } - - // Now try primary keysym for function keys (non-printable keys) - // These should not depend on the current keyboard layout - keySym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, _glfw.x11.xkb.group, 0); } - else - { - int dummy; - KeySym* keySyms; - keySyms = XGetKeyboardMapping(_glfw.x11.display, scancode, 1, &dummy); - keySym = keySyms[0]; - XFree(keySyms); - } - - switch (keySym) + switch (keysyms[0]) { case XK_Escape: return GLFW_KEY_ESCAPE; case XK_Tab: return GLFW_KEY_TAB; @@ -232,7 +214,7 @@ static int translateKeyCode(int scancode) // static void createKeyTables(void) { - int scancode, key; + int scancode, scancodeMin, scancodeMax; memset(_glfw.x11.keycodes, -1, sizeof(_glfw.x11.keycodes)); memset(_glfw.x11.scancodes, -1, sizeof(_glfw.x11.scancodes)); @@ -242,89 +224,217 @@ static void createKeyTables(void) // Use XKB to determine physical key locations independently of the // current keyboard layout - char name[XkbKeyNameLength + 1]; XkbDescPtr desc = XkbGetMap(_glfw.x11.display, 0, XkbUseCoreKbd); - XkbGetNames(_glfw.x11.display, XkbKeyNamesMask, desc); + XkbGetNames(_glfw.x11.display, XkbKeyNamesMask | XkbKeyAliasesMask, desc); + + scancodeMin = desc->min_key_code; + scancodeMax = desc->max_key_code; + + const struct + { + int key; + char* name; + } keymap[] = + { + { GLFW_KEY_GRAVE_ACCENT, "TLDE" }, + { GLFW_KEY_1, "AE01" }, + { GLFW_KEY_2, "AE02" }, + { GLFW_KEY_3, "AE03" }, + { GLFW_KEY_4, "AE04" }, + { GLFW_KEY_5, "AE05" }, + { GLFW_KEY_6, "AE06" }, + { GLFW_KEY_7, "AE07" }, + { GLFW_KEY_8, "AE08" }, + { GLFW_KEY_9, "AE09" }, + { GLFW_KEY_0, "AE10" }, + { GLFW_KEY_MINUS, "AE11" }, + { GLFW_KEY_EQUAL, "AE12" }, + { GLFW_KEY_Q, "AD01" }, + { GLFW_KEY_W, "AD02" }, + { GLFW_KEY_E, "AD03" }, + { GLFW_KEY_R, "AD04" }, + { GLFW_KEY_T, "AD05" }, + { GLFW_KEY_Y, "AD06" }, + { GLFW_KEY_U, "AD07" }, + { GLFW_KEY_I, "AD08" }, + { GLFW_KEY_O, "AD09" }, + { GLFW_KEY_P, "AD10" }, + { GLFW_KEY_LEFT_BRACKET, "AD11" }, + { GLFW_KEY_RIGHT_BRACKET, "AD12" }, + { GLFW_KEY_A, "AC01" }, + { GLFW_KEY_S, "AC02" }, + { GLFW_KEY_D, "AC03" }, + { GLFW_KEY_F, "AC04" }, + { GLFW_KEY_G, "AC05" }, + { GLFW_KEY_H, "AC06" }, + { GLFW_KEY_J, "AC07" }, + { GLFW_KEY_K, "AC08" }, + { GLFW_KEY_L, "AC09" }, + { GLFW_KEY_SEMICOLON, "AC10" }, + { GLFW_KEY_APOSTROPHE, "AC11" }, + { GLFW_KEY_Z, "AB01" }, + { GLFW_KEY_X, "AB02" }, + { GLFW_KEY_C, "AB03" }, + { GLFW_KEY_V, "AB04" }, + { GLFW_KEY_B, "AB05" }, + { GLFW_KEY_N, "AB06" }, + { GLFW_KEY_M, "AB07" }, + { GLFW_KEY_COMMA, "AB08" }, + { GLFW_KEY_PERIOD, "AB09" }, + { GLFW_KEY_SLASH, "AB10" }, + { GLFW_KEY_BACKSLASH, "BKSL" }, + { GLFW_KEY_WORLD_1, "LSGT" }, + { GLFW_KEY_SPACE, "SPCE" }, + { GLFW_KEY_ESCAPE, "ESC" }, + { GLFW_KEY_ENTER, "RTRN" }, + { GLFW_KEY_TAB, "TAB" }, + { GLFW_KEY_BACKSPACE, "BKSP" }, + { GLFW_KEY_INSERT, "INS" }, + { GLFW_KEY_DELETE, "DELE" }, + { GLFW_KEY_RIGHT, "RGHT" }, + { GLFW_KEY_LEFT, "LEFT" }, + { GLFW_KEY_DOWN, "DOWN" }, + { GLFW_KEY_UP, "UP" }, + { GLFW_KEY_PAGE_UP, "PGUP" }, + { GLFW_KEY_PAGE_DOWN, "PGDN" }, + { GLFW_KEY_HOME, "HOME" }, + { GLFW_KEY_END, "END" }, + { GLFW_KEY_CAPS_LOCK, "CAPS" }, + { GLFW_KEY_SCROLL_LOCK, "SCLK" }, + { GLFW_KEY_NUM_LOCK, "NMLK" }, + { GLFW_KEY_PRINT_SCREEN, "PRSC" }, + { GLFW_KEY_PAUSE, "PAUS" }, + { GLFW_KEY_F1, "FK01" }, + { GLFW_KEY_F2, "FK02" }, + { GLFW_KEY_F3, "FK03" }, + { GLFW_KEY_F4, "FK04" }, + { GLFW_KEY_F5, "FK05" }, + { GLFW_KEY_F6, "FK06" }, + { GLFW_KEY_F7, "FK07" }, + { GLFW_KEY_F8, "FK08" }, + { GLFW_KEY_F9, "FK09" }, + { GLFW_KEY_F10, "FK10" }, + { GLFW_KEY_F11, "FK11" }, + { GLFW_KEY_F12, "FK12" }, + { GLFW_KEY_F13, "FK13" }, + { GLFW_KEY_F14, "FK14" }, + { GLFW_KEY_F15, "FK15" }, + { GLFW_KEY_F16, "FK16" }, + { GLFW_KEY_F17, "FK17" }, + { GLFW_KEY_F18, "FK18" }, + { GLFW_KEY_F19, "FK19" }, + { GLFW_KEY_F20, "FK20" }, + { GLFW_KEY_F21, "FK21" }, + { GLFW_KEY_F22, "FK22" }, + { GLFW_KEY_F23, "FK23" }, + { GLFW_KEY_F24, "FK24" }, + { GLFW_KEY_F25, "FK25" }, + { GLFW_KEY_KP_0, "KP0" }, + { GLFW_KEY_KP_1, "KP1" }, + { GLFW_KEY_KP_2, "KP2" }, + { GLFW_KEY_KP_3, "KP3" }, + { GLFW_KEY_KP_4, "KP4" }, + { GLFW_KEY_KP_5, "KP5" }, + { GLFW_KEY_KP_6, "KP6" }, + { GLFW_KEY_KP_7, "KP7" }, + { GLFW_KEY_KP_8, "KP8" }, + { GLFW_KEY_KP_9, "KP9" }, + { GLFW_KEY_KP_DECIMAL, "KPDL" }, + { GLFW_KEY_KP_DIVIDE, "KPDV" }, + { GLFW_KEY_KP_MULTIPLY, "KPMU" }, + { GLFW_KEY_KP_SUBTRACT, "KPSU" }, + { GLFW_KEY_KP_ADD, "KPAD" }, + { GLFW_KEY_KP_ENTER, "KPEN" }, + { GLFW_KEY_KP_EQUAL, "KPEQ" }, + { GLFW_KEY_LEFT_SHIFT, "LFSH" }, + { GLFW_KEY_LEFT_CONTROL, "LCTL" }, + { GLFW_KEY_LEFT_ALT, "LALT" }, + { GLFW_KEY_LEFT_SUPER, "LWIN" }, + { GLFW_KEY_RIGHT_SHIFT, "RTSH" }, + { GLFW_KEY_RIGHT_CONTROL, "RCTL" }, + { GLFW_KEY_RIGHT_ALT, "RALT" }, + { GLFW_KEY_RIGHT_ALT, "LVL3" }, + { GLFW_KEY_RIGHT_ALT, "MDSW" }, + { GLFW_KEY_RIGHT_SUPER, "RWIN" }, + { GLFW_KEY_MENU, "MENU" } + }; // Find the X11 key code -> GLFW key code mapping - for (scancode = desc->min_key_code; scancode <= desc->max_key_code; scancode++) + for (scancode = scancodeMin; scancode <= scancodeMax; scancode++) { - memcpy(name, desc->names->keys[scancode].name, XkbKeyNameLength); - name[XkbKeyNameLength] = '\0'; - - // Map the key name to a GLFW key code. Note: We only map printable - // keys here, and we use the US keyboard layout. The rest of the - // keys (function keys) are mapped using traditional KeySym - // translations. - if (strcmp(name, "TLDE") == 0) key = GLFW_KEY_GRAVE_ACCENT; - else if (strcmp(name, "AE01") == 0) key = GLFW_KEY_1; - else if (strcmp(name, "AE02") == 0) key = GLFW_KEY_2; - else if (strcmp(name, "AE03") == 0) key = GLFW_KEY_3; - else if (strcmp(name, "AE04") == 0) key = GLFW_KEY_4; - else if (strcmp(name, "AE05") == 0) key = GLFW_KEY_5; - else if (strcmp(name, "AE06") == 0) key = GLFW_KEY_6; - else if (strcmp(name, "AE07") == 0) key = GLFW_KEY_7; - else if (strcmp(name, "AE08") == 0) key = GLFW_KEY_8; - else if (strcmp(name, "AE09") == 0) key = GLFW_KEY_9; - else if (strcmp(name, "AE10") == 0) key = GLFW_KEY_0; - else if (strcmp(name, "AE11") == 0) key = GLFW_KEY_MINUS; - else if (strcmp(name, "AE12") == 0) key = GLFW_KEY_EQUAL; - else if (strcmp(name, "AD01") == 0) key = GLFW_KEY_Q; - else if (strcmp(name, "AD02") == 0) key = GLFW_KEY_W; - else if (strcmp(name, "AD03") == 0) key = GLFW_KEY_E; - else if (strcmp(name, "AD04") == 0) key = GLFW_KEY_R; - else if (strcmp(name, "AD05") == 0) key = GLFW_KEY_T; - else if (strcmp(name, "AD06") == 0) key = GLFW_KEY_Y; - else if (strcmp(name, "AD07") == 0) key = GLFW_KEY_U; - else if (strcmp(name, "AD08") == 0) key = GLFW_KEY_I; - else if (strcmp(name, "AD09") == 0) key = GLFW_KEY_O; - else if (strcmp(name, "AD10") == 0) key = GLFW_KEY_P; - else if (strcmp(name, "AD11") == 0) key = GLFW_KEY_LEFT_BRACKET; - else if (strcmp(name, "AD12") == 0) key = GLFW_KEY_RIGHT_BRACKET; - else if (strcmp(name, "AC01") == 0) key = GLFW_KEY_A; - else if (strcmp(name, "AC02") == 0) key = GLFW_KEY_S; - else if (strcmp(name, "AC03") == 0) key = GLFW_KEY_D; - else if (strcmp(name, "AC04") == 0) key = GLFW_KEY_F; - else if (strcmp(name, "AC05") == 0) key = GLFW_KEY_G; - else if (strcmp(name, "AC06") == 0) key = GLFW_KEY_H; - else if (strcmp(name, "AC07") == 0) key = GLFW_KEY_J; - else if (strcmp(name, "AC08") == 0) key = GLFW_KEY_K; - else if (strcmp(name, "AC09") == 0) key = GLFW_KEY_L; - else if (strcmp(name, "AC10") == 0) key = GLFW_KEY_SEMICOLON; - else if (strcmp(name, "AC11") == 0) key = GLFW_KEY_APOSTROPHE; - else if (strcmp(name, "AB01") == 0) key = GLFW_KEY_Z; - else if (strcmp(name, "AB02") == 0) key = GLFW_KEY_X; - else if (strcmp(name, "AB03") == 0) key = GLFW_KEY_C; - else if (strcmp(name, "AB04") == 0) key = GLFW_KEY_V; - else if (strcmp(name, "AB05") == 0) key = GLFW_KEY_B; - else if (strcmp(name, "AB06") == 0) key = GLFW_KEY_N; - else if (strcmp(name, "AB07") == 0) key = GLFW_KEY_M; - else if (strcmp(name, "AB08") == 0) key = GLFW_KEY_COMMA; - else if (strcmp(name, "AB09") == 0) key = GLFW_KEY_PERIOD; - else if (strcmp(name, "AB10") == 0) key = GLFW_KEY_SLASH; - else if (strcmp(name, "BKSL") == 0) key = GLFW_KEY_BACKSLASH; - else if (strcmp(name, "LSGT") == 0) key = GLFW_KEY_WORLD_1; - else key = GLFW_KEY_UNKNOWN; - - if ((scancode >= 0) && (scancode < 256)) - _glfw.x11.keycodes[scancode] = key; + int key = GLFW_KEY_UNKNOWN; + + // Map the key name to a GLFW key code. Note: We use the US + // keyboard layout. Because function keys aren't mapped correctly + // when using traditional KeySym translations, they are mapped + // here instead. + for (int i = 0; i < sizeof(keymap) / sizeof(keymap[0]); i++) + { + if (strncmp(desc->names->keys[scancode].name, + keymap[i].name, + XkbKeyNameLength) == 0) + { + key = keymap[i].key; + break; + } + } + + // Fall back to key aliases in case the key name did not match + for (int i = 0; i < desc->names->num_key_aliases; i++) + { + if (key != GLFW_KEY_UNKNOWN) + break; + + if (strncmp(desc->names->key_aliases[i].real, + desc->names->keys[scancode].name, + XkbKeyNameLength) != 0) + { + continue; + } + + for (int j = 0; j < sizeof(keymap) / sizeof(keymap[0]); j++) + { + if (strncmp(desc->names->key_aliases[i].alias, + keymap[j].name, + XkbKeyNameLength) == 0) + { + key = keymap[j].key; + break; + } + } + } + + _glfw.x11.keycodes[scancode] = key; } XkbFreeNames(desc, XkbKeyNamesMask, True); XkbFreeKeyboard(desc, 0, True); } + else + XDisplayKeycodes(_glfw.x11.display, &scancodeMin, &scancodeMax); - for (scancode = 0; scancode < 256; scancode++) + int width; + KeySym* keysyms = XGetKeyboardMapping(_glfw.x11.display, + scancodeMin, + scancodeMax - scancodeMin + 1, + &width); + + for (scancode = scancodeMin; scancode <= scancodeMax; scancode++) { // Translate the un-translated key codes using traditional X11 KeySym // lookups if (_glfw.x11.keycodes[scancode] < 0) - _glfw.x11.keycodes[scancode] = translateKeyCode(scancode); + { + const size_t base = (scancode - scancodeMin) * width; + _glfw.x11.keycodes[scancode] = translateKeySyms(&keysyms[base], width); + } // Store the reverse translation for faster key name lookup if (_glfw.x11.keycodes[scancode] > 0) _glfw.x11.scancodes[_glfw.x11.keycodes[scancode]] = scancode; } + + XFree(keysyms); } // Check whether the IM has a usable style @@ -352,13 +462,13 @@ static GLFWbool hasUsableInputMethodStyle(void) // Check whether the specified atom is supported // -static Atom getSupportedAtom(Atom* supportedAtoms, - unsigned long atomCount, - const char* atomName) +static Atom getAtomIfSupported(Atom* supportedAtoms, + unsigned long atomCount, + const char* atomName) { const Atom atom = XInternAtom(_glfw.x11.display, atomName, False); - for (unsigned int i = 0; i < atomCount; i++) + for (unsigned long i = 0; i < atomCount; i++) { if (supportedAtoms[i] == atom) return atom; @@ -426,33 +536,33 @@ static void detectEWMH(void) // See which of the atoms we support that are supported by the WM _glfw.x11.NET_WM_STATE = - getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE"); + getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE"); _glfw.x11.NET_WM_STATE_ABOVE = - getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_ABOVE"); + getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_ABOVE"); _glfw.x11.NET_WM_STATE_FULLSCREEN = - getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_FULLSCREEN"); + getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_FULLSCREEN"); _glfw.x11.NET_WM_STATE_MAXIMIZED_VERT = - getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_VERT"); + getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_VERT"); _glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ = - getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_HORZ"); + getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_MAXIMIZED_HORZ"); _glfw.x11.NET_WM_STATE_DEMANDS_ATTENTION = - getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_DEMANDS_ATTENTION"); + getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_DEMANDS_ATTENTION"); _glfw.x11.NET_WM_FULLSCREEN_MONITORS = - getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_FULLSCREEN_MONITORS"); + getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_FULLSCREEN_MONITORS"); _glfw.x11.NET_WM_WINDOW_TYPE = - getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE"); + getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE"); _glfw.x11.NET_WM_WINDOW_TYPE_NORMAL = - getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE_NORMAL"); + getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE_NORMAL"); _glfw.x11.NET_WORKAREA = - getSupportedAtom(supportedAtoms, atomCount, "_NET_WORKAREA"); + getAtomIfSupported(supportedAtoms, atomCount, "_NET_WORKAREA"); _glfw.x11.NET_CURRENT_DESKTOP = - getSupportedAtom(supportedAtoms, atomCount, "_NET_CURRENT_DESKTOP"); + getAtomIfSupported(supportedAtoms, atomCount, "_NET_CURRENT_DESKTOP"); _glfw.x11.NET_ACTIVE_WINDOW = - getSupportedAtom(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW"); + getAtomIfSupported(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW"); _glfw.x11.NET_FRAME_EXTENTS = - getSupportedAtom(supportedAtoms, atomCount, "_NET_FRAME_EXTENTS"); + getAtomIfSupported(supportedAtoms, atomCount, "_NET_FRAME_EXTENTS"); _glfw.x11.NET_REQUEST_FRAME_EXTENTS = - getSupportedAtom(supportedAtoms, atomCount, "_NET_REQUEST_FRAME_EXTENTS"); + getAtomIfSupported(supportedAtoms, atomCount, "_NET_REQUEST_FRAME_EXTENTS"); if (supportedAtoms) XFree(supportedAtoms); @@ -462,7 +572,11 @@ static void detectEWMH(void) // static GLFWbool initExtensions(void) { +#if defined(__OpenBSD__) || defined(__NetBSD__) + _glfw.x11.vidmode.handle = _glfw_dlopen("libXxf86vm.so"); +#else _glfw.x11.vidmode.handle = _glfw_dlopen("libXxf86vm.so.1"); +#endif if (_glfw.x11.vidmode.handle) { _glfw.x11.vidmode.QueryExtension = (PFN_XF86VidModeQueryExtension) @@ -482,6 +596,8 @@ static GLFWbool initExtensions(void) #if defined(__CYGWIN__) _glfw.x11.xi.handle = _glfw_dlopen("libXi-6.so"); +#elif defined(__OpenBSD__) || defined(__NetBSD__) + _glfw.x11.xi.handle = _glfw_dlopen("libXi.so"); #else _glfw.x11.xi.handle = _glfw_dlopen("libXi.so.6"); #endif @@ -512,6 +628,8 @@ static GLFWbool initExtensions(void) #if defined(__CYGWIN__) _glfw.x11.randr.handle = _glfw_dlopen("libXrandr-2.so"); +#elif defined(__OpenBSD__) || defined(__NetBSD__) + _glfw.x11.randr.handle = _glfw_dlopen("libXrandr.so"); #else _glfw.x11.randr.handle = _glfw_dlopen("libXrandr.so.2"); #endif @@ -604,6 +722,8 @@ static GLFWbool initExtensions(void) #if defined(__CYGWIN__) _glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor-1.so"); +#elif defined(__OpenBSD__) || defined(__NetBSD__) + _glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor.so"); #else _glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor.so.1"); #endif @@ -619,6 +739,8 @@ static GLFWbool initExtensions(void) #if defined(__CYGWIN__) _glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama-1.so"); +#elif defined(__OpenBSD__) || defined(__NetBSD__) + _glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama.so"); #else _glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama.so.1"); #endif @@ -660,17 +782,18 @@ static GLFWbool initExtensions(void) _glfw.x11.xkb.detectable = GLFW_TRUE; } - _glfw.x11.xkb.group = 0; XkbStateRec state; if (XkbGetState(_glfw.x11.display, XkbUseCoreKbd, &state) == Success) - { - XkbSelectEventDetails(_glfw.x11.display, XkbUseCoreKbd, XkbStateNotify, XkbAllStateComponentsMask, XkbGroupStateMask); _glfw.x11.xkb.group = (unsigned int)state.group; - } + + XkbSelectEventDetails(_glfw.x11.display, XkbUseCoreKbd, XkbStateNotify, + XkbGroupStateMask, XkbGroupStateMask); } #if defined(__CYGWIN__) _glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb-1.so"); +#elif defined(__OpenBSD__) || defined(__NetBSD__) + _glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb.so"); #else _glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb.so.1"); #endif @@ -682,6 +805,8 @@ static GLFWbool initExtensions(void) #if defined(__CYGWIN__) _glfw.x11.xrender.handle = _glfw_dlopen("libXrender-1.so"); +#elif defined(__OpenBSD__) || defined(__NetBSD__) + _glfw.x11.xrender.handle = _glfw_dlopen("libXrender.so"); #else _glfw.x11.xrender.handle = _glfw_dlopen("libXrender.so.1"); #endif @@ -847,10 +972,44 @@ static Window createHelperWindow(void) CWEventMask, &wa); } +// Create the pipe for empty events without assumuing the OS has pipe2(2) +// +static GLFWbool createEmptyEventPipe(void) +{ + if (pipe(_glfw.x11.emptyEventPipe) != 0) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "X11: Failed to create empty event pipe: %s", + strerror(errno)); + return GLFW_FALSE; + } + + for (int i = 0; i < 2; i++) + { + const int sf = fcntl(_glfw.x11.emptyEventPipe[i], F_GETFL, 0); + const int df = fcntl(_glfw.x11.emptyEventPipe[i], F_GETFD, 0); + + if (sf == -1 || df == -1 || + fcntl(_glfw.x11.emptyEventPipe[i], F_SETFL, sf | O_NONBLOCK) == -1 || + fcntl(_glfw.x11.emptyEventPipe[i], F_SETFD, df | FD_CLOEXEC) == -1) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "X11: Failed to set flags for empty event pipe: %s", + strerror(errno)); + return GLFW_FALSE; + } + } + + return GLFW_TRUE; +} + // X error handler // static int errorHandler(Display *display, XErrorEvent* event) { + if (_glfw.x11.display != display) + return 0; + _glfw.x11.errorCode = event->error_code; return 0; } @@ -864,8 +1023,9 @@ static int errorHandler(Display *display, XErrorEvent* event) // void _glfwGrabErrorHandlerX11(void) { + assert(_glfw.x11.errorHandler == NULL); _glfw.x11.errorCode = Success; - XSetErrorHandler(errorHandler); + _glfw.x11.errorHandler = XSetErrorHandler(errorHandler); } // Clears the X error handler callback @@ -874,7 +1034,8 @@ void _glfwReleaseErrorHandlerX11(void) { // Synchronize to make sure all commands are processed XSync(_glfw.x11.display, False); - XSetErrorHandler(NULL); + XSetErrorHandler(_glfw.x11.errorHandler); + _glfw.x11.errorHandler = NULL; } // Reports the specified error, appending information about the last X error @@ -931,15 +1092,12 @@ Cursor _glfwCreateCursorX11(const GLFWimage* image, int xhot, int yhot) int _glfwPlatformInit(void) { -#if !defined(X_HAVE_UTF8_STRING) - // HACK: If the current locale is "C" and the Xlib UTF-8 functions are - // unavailable, apply the environment's locale in the hope that it's - // both available and not "C" - // This is done because the "C" locale breaks wide character input, - // which is what we fall back on when UTF-8 support is missing + // HACK: If the application has left the locale as "C" then both wide + // character text input and explicit UTF-8 input via XIM will break + // This sets the CTYPE part of the current locale from the environment + // in the hope that it is set to something more sane than "C" if (strcmp(setlocale(LC_CTYPE, NULL), "C") == 0) setlocale(LC_CTYPE, ""); -#endif XInitThreads(); XrmInitialize(); @@ -968,6 +1126,9 @@ int _glfwPlatformInit(void) getSystemContentScale(&_glfw.x11.contentScaleX, &_glfw.x11.contentScaleY); + if (!createEmptyEventPipe()) + return GLFW_FALSE; + if (!initExtensions()) return GLFW_FALSE; @@ -1077,6 +1238,7 @@ void _glfwPlatformTerminate(void) _glfw.x11.xi.handle = NULL; } + _glfwTerminateOSMesa(); // NOTE: These need to be unloaded after XCloseDisplay, as they register // cleanup callbacks that get called by that function _glfwTerminateEGL(); @@ -1085,6 +1247,12 @@ void _glfwPlatformTerminate(void) #if defined(__linux__) _glfwTerminateJoysticksLinux(); #endif + + if (_glfw.x11.emptyEventPipe[0] || _glfw.x11.emptyEventPipe[1]) + { + close(_glfw.x11.emptyEventPipe[0]); + close(_glfw.x11.emptyEventPipe[1]); + } } const char* _glfwPlatformGetVersionString(void) diff --git a/third_party/penumbra/vendor/glfw/src/x11_monitor.c b/third_party/penumbra/vendor/glfw/src/x11_monitor.c index 1f804aeb409..fb3a67baceb 100644 --- a/third_party/penumbra/vendor/glfw/src/x11_monitor.c +++ b/third_party/penumbra/vendor/glfw/src/x11_monitor.c @@ -164,7 +164,7 @@ void _glfwPollMonitorsX11(void) if (widthMM <= 0 || heightMM <= 0) { // HACK: If RandR does not provide a physical size, assume the - // X11 default 96 DPI and calcuate from the CRTC viewport + // X11 default 96 DPI and calculate from the CRTC viewport // NOTE: These members are affected by rotation, unlike the mode // info and output info members widthMM = (int) (ci->width * 25.4f / 96.f); diff --git a/third_party/penumbra/vendor/glfw/src/x11_platform.h b/third_party/penumbra/vendor/glfw/src/x11_platform.h index 7377b2c0827..03ff9d242ad 100644 --- a/third_party/penumbra/vendor/glfw/src/x11_platform.h +++ b/third_party/penumbra/vendor/glfw/src/x11_platform.h @@ -199,9 +199,9 @@ typedef struct _GLFWwindowX11 // The last position the cursor was warped to by GLFW int warpCursorPosX, warpCursorPosY; - // The time of the last KeyPress event - Time lastKeyTime; - + // The time of the last KeyPress event per keycode, for discarding + // duplicate key events generated for some keys by ibus + Time keyPressTimes[256]; } _GLFWwindowX11; // X11-specific global data @@ -222,6 +222,8 @@ typedef struct _GLFWlibraryX11 XContext context; // XIM input method XIM im; + // The previous X error handler, to be restored later + XErrorHandler errorHandler; // Most recent error code received by X error handler int errorCode; // Primary selection string (while the primary selection is owned) @@ -238,6 +240,7 @@ typedef struct _GLFWlibraryX11 double restoreCursorPosX, restoreCursorPosY; // The window whose disabled cursor mode is active _GLFWwindow* disabledCursorWindow; + int emptyEventPipe[2]; // Window manager atoms Atom NET_SUPPORTED; @@ -404,7 +407,6 @@ typedef struct _GLFWlibraryX11 PFN_XRenderQueryVersion QueryVersion; PFN_XRenderFindVisualFormat FindVisualFormat; } xrender; - } _GLFWlibraryX11; // X11-specific per-monitor data @@ -418,7 +420,6 @@ typedef struct _GLFWmonitorX11 // Index of corresponding Xinerama screen, // for EWMH full screen window placement int index; - } _GLFWmonitorX11; // X11-specific per-cursor data @@ -426,7 +427,6 @@ typedef struct _GLFWmonitorX11 typedef struct _GLFWcursorX11 { Cursor handle; - } _GLFWcursorX11; diff --git a/third_party/penumbra/vendor/glfw/src/x11_window.c b/third_party/penumbra/vendor/glfw/src/x11_window.c index 271e1080945..ddda48d7766 100644 --- a/third_party/penumbra/vendor/glfw/src/x11_window.c +++ b/third_party/penumbra/vendor/glfw/src/x11_window.c @@ -27,12 +27,16 @@ // It is fine to use C99 in this file because it will not be built with VS //======================================================================== +#define _GNU_SOURCE + #include "internal.h" #include #include -#include +#include +#include +#include #include #include @@ -56,50 +60,126 @@ #define _GLFW_XDND_VERSION 5 - -// Wait for data to arrive using select -// This avoids blocking other threads via the per-display Xlib lock that also -// covers GLX functions +// Wait for data to arrive on any of the specified file descriptors // -static GLFWbool waitForEvent(double* timeout) +static GLFWbool waitForData(struct pollfd* fds, nfds_t count, double* timeout) { - fd_set fds; - const int fd = ConnectionNumber(_glfw.x11.display); - int count = fd + 1; - -#if defined(__linux__) - if (_glfw.linjs.inotify > fd) - count = _glfw.linjs.inotify + 1; -#endif for (;;) { - FD_ZERO(&fds); - FD_SET(fd, &fds); -#if defined(__linux__) - if (_glfw.linjs.inotify > 0) - FD_SET(_glfw.linjs.inotify, &fds); -#endif - if (timeout) { - const long seconds = (long) *timeout; - const long microseconds = (long) ((*timeout - seconds) * 1e6); - struct timeval tv = { seconds, microseconds }; const uint64_t base = _glfwPlatformGetTimerValue(); - const int result = select(count, &fds, NULL, NULL, &tv); - const int error = errno; +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) + const time_t seconds = (time_t) *timeout; + const long nanoseconds = (long) ((*timeout - seconds) * 1e9); + const struct timespec ts = { seconds, nanoseconds }; + const int result = ppoll(fds, count, &ts, NULL); +#elif defined(__NetBSD__) + const time_t seconds = (time_t) *timeout; + const long nanoseconds = (long) ((*timeout - seconds) * 1e9); + const struct timespec ts = { seconds, nanoseconds }; + const int result = pollts(fds, count, &ts, NULL); +#else + const int milliseconds = (int) (*timeout * 1e3); + const int result = poll(fds, count, milliseconds); +#endif + const int error = errno; // clock_gettime may overwrite our error *timeout -= (_glfwPlatformGetTimerValue() - base) / (double) _glfwPlatformGetTimerFrequency(); if (result > 0) return GLFW_TRUE; - if ((result == -1 && error == EINTR) || *timeout <= 0.0) + else if (result == -1 && error != EINTR && error != EAGAIN) + return GLFW_FALSE; + else if (*timeout <= 0.0) return GLFW_FALSE; } - else if (select(count, &fds, NULL, NULL, NULL) != -1 || errno != EINTR) - return GLFW_TRUE; + else + { + const int result = poll(fds, count, -1); + if (result > 0) + return GLFW_TRUE; + else if (result == -1 && errno != EINTR && errno != EAGAIN) + return GLFW_FALSE; + } + } +} + +// Wait for event data to arrive on the X11 display socket +// This avoids blocking other threads via the per-display Xlib lock that also +// covers GLX functions +// +static GLFWbool waitForX11Event(double* timeout) +{ + struct pollfd fd = { ConnectionNumber(_glfw.x11.display), POLLIN }; + + while (!XPending(_glfw.x11.display)) + { + if (!waitForData(&fd, 1, timeout)) + return GLFW_FALSE; + } + + return GLFW_TRUE; +} + +// Wait for event data to arrive on any event file descriptor +// This avoids blocking other threads via the per-display Xlib lock that also +// covers GLX functions +// +static GLFWbool waitForAnyEvent(double* timeout) +{ + nfds_t count = 2; + struct pollfd fds[3] = + { + { ConnectionNumber(_glfw.x11.display), POLLIN }, + { _glfw.x11.emptyEventPipe[0], POLLIN } + }; + +#if defined(__linux__) + if (_glfw.linjs.inotify > 0) + fds[count++] = (struct pollfd) { _glfw.linjs.inotify, POLLIN }; +#endif + + while (!XPending(_glfw.x11.display)) + { + if (!waitForData(fds, count, timeout)) + return GLFW_FALSE; + + for (int i = 1; i < count; i++) + { + if (fds[i].revents & POLLIN) + return GLFW_TRUE; + } + } + + return GLFW_TRUE; +} + +// Writes a byte to the empty event pipe +// +static void writeEmptyEvent(void) +{ + for (;;) + { + const char byte = 0; + const ssize_t result = write(_glfw.x11.emptyEventPipe[1], &byte, 1); + if (result == 1 || (result == -1 && errno != EINTR)) + break; + } +} + +// Drains available data from the empty event pipe +// +static void drainEmptyEvents(void) +{ + for (;;) + { + char dummy[64]; + const ssize_t result = read(_glfw.x11.emptyEventPipe[0], dummy, sizeof(dummy)); + if (result == -1 && errno != EINTR) + break; } } @@ -116,7 +196,7 @@ static GLFWbool waitForVisibilityNotify(_GLFWwindow* window) VisibilityNotify, &dummy)) { - if (!waitForEvent(&timeout)) + if (!waitForX11Event(&timeout)) return GLFW_FALSE; } @@ -378,96 +458,14 @@ static void updateWindowMode(_GLFWwindow* window) } } -// Splits and translates a text/uri-list into separate file paths -// NOTE: This function destroys the provided string -// -static char** parseUriList(char* text, int* count) -{ - const char* prefix = "file://"; - char** paths = NULL; - char* line; - - *count = 0; - - while ((line = strtok(text, "\r\n"))) - { - text = NULL; - - if (line[0] == '#') - continue; - - if (strncmp(line, prefix, strlen(prefix)) == 0) - { - line += strlen(prefix); - // TODO: Validate hostname - while (*line != '/') - line++; - } - - (*count)++; - - char* path = calloc(strlen(line) + 1, 1); - paths = realloc(paths, *count * sizeof(char*)); - paths[*count - 1] = path; - - while (*line) - { - if (line[0] == '%' && line[1] && line[2]) - { - const char digits[3] = { line[1], line[2], '\0' }; - *path = strtol(digits, NULL, 16); - line += 2; - } - else - *path = *line; - - path++; - line++; - } - } - - return paths; -} - -// Encode a Unicode code point to a UTF-8 stream -// Based on cutef8 by Jeff Bezanson (Public Domain) -// -static size_t encodeUTF8(char* s, unsigned int ch) -{ - size_t count = 0; - - if (ch < 0x80) - s[count++] = (char) ch; - else if (ch < 0x800) - { - s[count++] = (ch >> 6) | 0xc0; - s[count++] = (ch & 0x3f) | 0x80; - } - else if (ch < 0x10000) - { - s[count++] = (ch >> 12) | 0xe0; - s[count++] = ((ch >> 6) & 0x3f) | 0x80; - s[count++] = (ch & 0x3f) | 0x80; - } - else if (ch < 0x110000) - { - s[count++] = (ch >> 18) | 0xf0; - s[count++] = ((ch >> 12) & 0x3f) | 0x80; - s[count++] = ((ch >> 6) & 0x3f) | 0x80; - s[count++] = (ch & 0x3f) | 0x80; - } - - return count; -} - // Decode a Unicode code point from a UTF-8 stream // Based on cutef8 by Jeff Bezanson (Public Domain) // #if defined(X_HAVE_UTF8_STRING) -static unsigned int decodeUTF8(const char** s) +static uint32_t decodeUTF8(const char** s) { - unsigned int ch = 0, count = 0; - static const unsigned int offsets[] = + uint32_t codepoint = 0, count = 0; + static const uint32_t offsets[] = { 0x00000000u, 0x00003080u, 0x000e2080u, 0x03c82080u, 0xfa082080u, 0x82082080u @@ -475,13 +473,13 @@ static unsigned int decodeUTF8(const char** s) do { - ch = (ch << 6) + (unsigned char) **s; + codepoint = (codepoint << 6) + (unsigned char) **s; (*s)++; count++; } while ((**s & 0xc0) == 0x80); assert(count <= 6); - return ch - offsets[count - 1]; + return codepoint - offsets[count - 1]; } #endif /*X_HAVE_UTF8_STRING*/ @@ -499,7 +497,7 @@ static char* convertLatin1toUTF8(const char* source) char* tp = target; for (sp = source; *sp; sp++) - tp += encodeUTF8(tp, *sp); + tp += _glfwEncodeUTF8(tp, *sp); return target; } @@ -931,20 +929,6 @@ static Atom writeTargetToProperty(const XSelectionRequestEvent* request) return None; } -static void handleSelectionClear(XEvent* event) -{ - if (event->xselectionclear.selection == _glfw.x11.PRIMARY) - { - free(_glfw.x11.primarySelectionString); - _glfw.x11.primarySelectionString = NULL; - } - else - { - free(_glfw.x11.clipboardString); - _glfw.x11.clipboardString = NULL; - } -} - static void handleSelectionRequest(XEvent* event) { const XSelectionRequestEvent* request = &event->xselectionrequest; @@ -1002,7 +986,7 @@ static const char* getSelectionString(Atom selection) SelectionNotify, ¬ification)) { - waitForEvent(NULL); + waitForX11Event(NULL); } if (notification.xselection.property == None) @@ -1038,7 +1022,7 @@ static const char* getSelectionString(Atom selection) isSelPropNewValueNotify, (XPointer) ¬ification)) { - waitForEvent(NULL); + waitForX11Event(NULL); } XFree(data); @@ -1065,13 +1049,16 @@ static const char* getSelectionString(Atom selection) if (!itemCount) { - if (targets[i] == XA_STRING) + if (string) { - *selectionString = convertLatin1toUTF8(string); - free(string); + if (targets[i] == XA_STRING) + { + *selectionString = convertLatin1toUTF8(string); + free(string); + } + else + *selectionString = string; } - else - *selectionString = string; break; } @@ -1195,6 +1182,8 @@ static void processEvent(XEvent *event) { _glfw.x11.xkb.group = ((XkbEvent*) event)->state.group; } + + return; } } @@ -1236,12 +1225,7 @@ static void processEvent(XEvent *event) return; } - if (event->type == SelectionClear) - { - handleSelectionClear(event); - return; - } - else if (event->type == SelectionRequest) + if (event->type == SelectionRequest) { handleSelectionRequest(event); return; @@ -1273,16 +1257,20 @@ static void processEvent(XEvent *event) if (window->x11.ic) { - // HACK: Ignore duplicate key press events generated by ibus - // These have the same timestamp as the original event - // Corresponding release events are filtered out - // implicitly by the GLFW key repeat logic - if (window->x11.lastKeyTime < event->xkey.time) + // HACK: Do not report the key press events duplicated by XIM + // Duplicate key releases are filtered out implicitly by + // the GLFW key repeat logic in _glfwInputKey + // A timestamp per key is used to handle simultaneous keys + // NOTE: Always allow the first event for each key through + // (the server never sends a timestamp of zero) + // NOTE: Timestamp difference is compared to handle wrap-around + Time diff = event->xkey.time - window->x11.keyPressTimes[keycode]; + if (diff == event->xkey.time || (diff > 0 && diff < ((Time)1 << 31))) { if (keycode) _glfwInputKey(window, key, keycode, GLFW_PRESS, mods); - window->x11.lastKeyTime = event->xkey.time; + window->x11.keyPressTimes[keycode] = event->xkey.time; } if (!filtered) @@ -1353,9 +1341,9 @@ static void processEvent(XEvent *event) _glfwInputKey(window, key, keycode, GLFW_PRESS, mods); - const long character = _glfwKeySym2Unicode(keysym); - if (character != -1) - _glfwInputChar(window, character, mods, plain); + const uint32_t codepoint = _glfwKeySym2Unicode(keysym); + if (codepoint != GLFW_INVALID_CODEPOINT) + _glfwInputChar(window, codepoint, mods, plain); } return; @@ -1557,6 +1545,8 @@ static void processEvent(XEvent *event) // the position into root (screen) coordinates if (!event->xany.send_event && window->x11.parent != _glfw.x11.root) { + _glfwGrabErrorHandlerX11(); + Window dummy; XTranslateCoordinates(_glfw.x11.display, window->x11.parent, @@ -1564,6 +1554,10 @@ static void processEvent(XEvent *event) xpos, ypos, &xpos, &ypos, &dummy); + + _glfwReleaseErrorHandlerX11(); + if (_glfw.x11.errorCode == BadWindow) + return; } if (xpos != window->x11.xpos || ypos != window->x11.ypos) @@ -1747,7 +1741,7 @@ static void processEvent(XEvent *event) if (result) { int i, count; - char** paths = parseUriList(data, &count); + char** paths = _glfwParseUriList(data, &count); _glfwInputDrop(window, count, (const char**) paths); @@ -1936,10 +1930,6 @@ void _glfwPushSelectionToManagerX11(void) handleSelectionRequest(&event); break; - case SelectionClear: - handleSelectionClear(&event); - break; - case SelectionNotify: { if (event.xselection.target == _glfw.x11.SAVE_TARGETS) @@ -1957,7 +1947,7 @@ void _glfwPushSelectionToManagerX11(void) } } - waitForEvent(NULL); + waitForX11Event(NULL); } } @@ -1971,7 +1961,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { - Visual* visual; + Visual* visual = NULL; int depth; if (ctxconfig->client != GLFW_NO_API) @@ -1997,8 +1987,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, } } - if (ctxconfig->client == GLFW_NO_API || - ctxconfig->source == GLFW_OSMESA_CONTEXT_API) + if (!visual) { visual = DefaultVisual(_glfw.x11.display, _glfw.x11.screen); depth = DefaultDepth(_glfw.x11.display, _glfw.x11.screen); @@ -2024,6 +2013,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) return GLFW_FALSE; } + + if (!_glfwRefreshContextAttribs(window, ctxconfig)) + return GLFW_FALSE; } if (window->monitor) @@ -2031,6 +2023,18 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, _glfwPlatformShowWindow(window); updateWindowMode(window); acquireMonitor(window); + + if (wndconfig->centerCursor) + _glfwCenterCursorInContentArea(window); + } + else + { + if (wndconfig->visible) + { + _glfwPlatformShowWindow(window); + if (wndconfig->focused) + _glfwPlatformFocusWindow(window); + } } XFlush(_glfw.x11.display); @@ -2112,8 +2116,8 @@ void _glfwPlatformSetWindowIcon(_GLFWwindow* window, for (i = 0; i < count; i++) longCount += 2 + images[i].width * images[i].height; - long* icon = calloc(longCount, sizeof(long)); - long* target = icon; + unsigned long* icon = calloc(longCount, sizeof(unsigned long)); + unsigned long* target = icon; for (i = 0; i < count; i++) { @@ -2122,13 +2126,19 @@ void _glfwPlatformSetWindowIcon(_GLFWwindow* window, for (j = 0; j < images[i].width * images[i].height; j++) { - *target++ = (images[i].pixels[j * 4 + 0] << 16) | - (images[i].pixels[j * 4 + 1] << 8) | - (images[i].pixels[j * 4 + 2] << 0) | - (images[i].pixels[j * 4 + 3] << 24); + *target++ = (((unsigned long) images[i].pixels[j * 4 + 0]) << 16) | + (((unsigned long) images[i].pixels[j * 4 + 1]) << 8) | + (((unsigned long) images[i].pixels[j * 4 + 2]) << 0) | + (((unsigned long) images[i].pixels[j * 4 + 3]) << 24); } } + // NOTE: XChangeProperty expects 32-bit values like the image data above to be + // placed in the 32 least significant bits of individual longs. This is + // true even if long is 64-bit and a WM protocol calls for "packed" data. + // This is because of a historical mistake that then became part of the Xlib + // ABI. Xlib will pack these values into a regular array of 32-bit values + // before sending it over the wire. XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_ICON, XA_CARDINAL, 32, @@ -2270,7 +2280,7 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, isFrameExtentsEvent, (XPointer) window)) { - if (!waitForEvent(&timeout)) + if (!waitForX11Event(&timeout)) { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: The window manager has a broken _NET_REQUEST_FRAME_EXTENTS implementation; please report this issue"); @@ -2489,7 +2499,11 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, } if (window->monitor) + { + _glfwPlatformSetWindowDecorated(window, window->decorated); + _glfwPlatformSetWindowFloating(window, window->floating); releaseMonitor(window); + } _glfwInputWindowMonitor(window, monitor); updateNormalHints(window, width, height); @@ -2580,13 +2594,19 @@ int _glfwPlatformWindowHovered(_GLFWwindow* window) int rootX, rootY, childX, childY; unsigned int mask; - if (!XQueryPointer(_glfw.x11.display, w, - &root, &w, &rootX, &rootY, &childX, &childY, &mask)) - { - return GLFW_FALSE; - } + _glfwGrabErrorHandlerX11(); + + const Bool result = XQueryPointer(_glfw.x11.display, w, + &root, &w, &rootX, &rootY, + &childX, &childY, &mask); + + _glfwReleaseErrorHandlerX11(); - if (w == window->x11.handle) + if (_glfw.x11.errorCode == BadWindow) + w = _glfw.x11.root; + else if (!result) + return GLFW_FALSE; + else if (w == window->x11.handle) return GLFW_TRUE; } @@ -2665,14 +2685,14 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled) break; } - if (i < count) - return; - - XChangeProperty(_glfw.x11.display, window->x11.handle, - _glfw.x11.NET_WM_STATE, XA_ATOM, 32, - PropModeAppend, - (unsigned char*) &_glfw.x11.NET_WM_STATE_ABOVE, - 1); + if (i == count) + { + XChangeProperty(_glfw.x11.display, window->x11.handle, + _glfw.x11.NET_WM_STATE, XA_ATOM, 32, + PropModeAppend, + (unsigned char*) &_glfw.x11.NET_WM_STATE_ABOVE, + 1); + } } else if (states) { @@ -2682,15 +2702,15 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled) break; } - if (i == count) - return; - - states[i] = states[count - 1]; - count--; + if (i < count) + { + states[i] = states[count - 1]; + count--; - XChangeProperty(_glfw.x11.display, window->x11.handle, - _glfw.x11.NET_WM_STATE, XA_ATOM, 32, - PropModeReplace, (unsigned char*) states, count); + XChangeProperty(_glfw.x11.display, window->x11.handle, + _glfw.x11.NET_WM_STATE, XA_ATOM, 32, + PropModeReplace, (unsigned char*) states, count); + } } if (states) @@ -2752,7 +2772,7 @@ GLFWbool _glfwPlatformRawMouseMotionSupported(void) void _glfwPlatformPollEvents(void) { - _GLFWwindow* window; + drainEmptyEvents(); #if defined(__linux__) _glfwDetectJoystickConnectionLinux(); @@ -2766,7 +2786,7 @@ void _glfwPlatformPollEvents(void) processEvent(&event); } - window = _glfw.x11.disabledCursorWindow; + _GLFWwindow* window = _glfw.x11.disabledCursorWindow; if (window) { int width, height; @@ -2786,32 +2806,19 @@ void _glfwPlatformPollEvents(void) void _glfwPlatformWaitEvents(void) { - while (!XPending(_glfw.x11.display)) - waitForEvent(NULL); - + waitForAnyEvent(NULL); _glfwPlatformPollEvents(); } void _glfwPlatformWaitEventsTimeout(double timeout) { - while (!XPending(_glfw.x11.display)) - { - if (!waitForEvent(&timeout)) - break; - } - + waitForAnyEvent(&timeout); _glfwPlatformPollEvents(); } void _glfwPlatformPostEmptyEvent(void) { - XEvent event = { ClientMessage }; - event.xclient.window = _glfw.x11.helperWindowHandle; - event.xclient.format = 32; // Data is 32-bit longs - event.xclient.message_type = _glfw.x11.NULL_; - - XSendEvent(_glfw.x11.display, _glfw.x11.helperWindowHandle, False, 0, &event); - XFlush(_glfw.x11.display); + writeEmptyEvent(); } void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos) @@ -2865,7 +2872,7 @@ const char* _glfwPlatformGetScancodeName(int scancode) if (scancode < 0 || scancode > 0xff || _glfw.x11.keycodes[scancode] == GLFW_KEY_UNKNOWN) { - _glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode"); + _glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode); return NULL; } @@ -2875,11 +2882,11 @@ const char* _glfwPlatformGetScancodeName(int scancode) if (keysym == NoSymbol) return NULL; - const long ch = _glfwKeySym2Unicode(keysym); - if (ch == -1) + const uint32_t codepoint = _glfwKeySym2Unicode(keysym); + if (codepoint == GLFW_INVALID_CODEPOINT) return NULL; - const size_t count = encodeUTF8(_glfw.x11.keynames[key], (unsigned int) ch); + const size_t count = _glfwEncodeUTF8(_glfw.x11.keynames[key], codepoint); if (count == 0) return NULL; @@ -2950,8 +2957,9 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) void _glfwPlatformSetClipboardString(const char* string) { + char* copy = _glfw_strdup(string); free(_glfw.x11.clipboardString); - _glfw.x11.clipboardString = _glfw_strdup(string); + _glfw.x11.clipboardString = copy; XSetSelectionOwner(_glfw.x11.display, _glfw.x11.CLIPBOARD, diff --git a/third_party/penumbra/vendor/glfw/src/xkb_unicode.c b/third_party/penumbra/vendor/glfw/src/xkb_unicode.c index f30c4cd7176..859bedcaef1 100644 --- a/third_party/penumbra/vendor/glfw/src/xkb_unicode.c +++ b/third_party/penumbra/vendor/glfw/src/xkb_unicode.c @@ -907,7 +907,7 @@ static const struct codepair { // Convert XKB KeySym to Unicode // -long _glfwKeySym2Unicode(unsigned int keysym) +uint32_t _glfwKeySym2Unicode(unsigned int keysym) { int min = 0; int max = sizeof(keysymtab) / sizeof(struct codepair) - 1; @@ -937,6 +937,6 @@ long _glfwKeySym2Unicode(unsigned int keysym) } // No matching Unicode value found - return -1; + return GLFW_INVALID_CODEPOINT; } diff --git a/third_party/penumbra/vendor/glfw/src/xkb_unicode.h b/third_party/penumbra/vendor/glfw/src/xkb_unicode.h index f95e14f106c..be97cdcb8cf 100644 --- a/third_party/penumbra/vendor/glfw/src/xkb_unicode.h +++ b/third_party/penumbra/vendor/glfw/src/xkb_unicode.h @@ -24,5 +24,7 @@ // //======================================================================== -long _glfwKeySym2Unicode(unsigned int keysym); +#define GLFW_INVALID_CODEPOINT 0xffffffffu + +uint32_t _glfwKeySym2Unicode(unsigned int keysym); diff --git a/third_party/penumbra/vendor/glfw/tests/CMakeLists.txt b/third_party/penumbra/vendor/glfw/tests/CMakeLists.txt deleted file mode 100644 index 5232720f2a9..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/CMakeLists.txt +++ /dev/null @@ -1,94 +0,0 @@ - -link_libraries(glfw) - -include_directories("${GLFW_SOURCE_DIR}/deps") - -if (MATH_LIBRARY) - link_libraries("${MATH_LIBRARY}") -endif() - -if (MSVC) - add_definitions(-D_CRT_SECURE_NO_WARNINGS) -endif() - -set(GLAD_GL "${GLFW_SOURCE_DIR}/deps/glad/gl.h" - "${GLFW_SOURCE_DIR}/deps/glad_gl.c") -set(GLAD_VULKAN "${GLFW_SOURCE_DIR}/deps/glad/vulkan.h" - "${GLFW_SOURCE_DIR}/deps/glad_vulkan.c") -set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h" - "${GLFW_SOURCE_DIR}/deps/getopt.c") -set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h" - "${GLFW_SOURCE_DIR}/deps/tinycthread.c") - -if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR - ${CMAKE_VERSION} VERSION_GREATER "3.1.0") - set(CMAKE_C_STANDARD 99) -else() - # Remove this fallback when removing support for CMake version less than 3.1 - add_compile_options("$<$:-std=c99>" - "$<$:-std=c99>" - "$<$:-std=c99>") - -endif() - -add_executable(clipboard clipboard.c ${GETOPT} ${GLAD_GL}) -add_executable(events events.c ${GETOPT} ${GLAD_GL}) -add_executable(msaa msaa.c ${GETOPT} ${GLAD_GL}) -add_executable(glfwinfo glfwinfo.c ${GETOPT} ${GLAD_GL} ${GLAD_VULKAN}) -add_executable(iconify iconify.c ${GETOPT} ${GLAD_GL}) -add_executable(monitors monitors.c ${GETOPT} ${GLAD_GL}) -add_executable(reopen reopen.c ${GLAD_GL}) -add_executable(cursor cursor.c ${GLAD_GL}) - -add_executable(empty WIN32 MACOSX_BUNDLE empty.c ${TINYCTHREAD} ${GLAD_GL}) -add_executable(gamma WIN32 MACOSX_BUNDLE gamma.c ${GLAD_GL}) -add_executable(icon WIN32 MACOSX_BUNDLE icon.c ${GLAD_GL}) -add_executable(inputlag WIN32 MACOSX_BUNDLE inputlag.c ${GETOPT} ${GLAD_GL}) -add_executable(joysticks WIN32 MACOSX_BUNDLE joysticks.c ${GLAD_GL}) -add_executable(opacity WIN32 MACOSX_BUNDLE opacity.c ${GLAD_GL}) -add_executable(tearing WIN32 MACOSX_BUNDLE tearing.c ${GLAD_GL}) -add_executable(threads WIN32 MACOSX_BUNDLE threads.c ${TINYCTHREAD} ${GLAD_GL}) -add_executable(timeout WIN32 MACOSX_BUNDLE timeout.c ${GLAD_GL}) -add_executable(title WIN32 MACOSX_BUNDLE title.c ${GLAD_GL}) -add_executable(triangle-vulkan WIN32 triangle-vulkan.c ${GLAD_VULKAN}) -add_executable(windows WIN32 MACOSX_BUNDLE windows.c ${GETOPT} ${GLAD_GL}) - -target_link_libraries(empty "${CMAKE_THREAD_LIBS_INIT}") -target_link_libraries(threads "${CMAKE_THREAD_LIBS_INIT}") -if (RT_LIBRARY) - target_link_libraries(empty "${RT_LIBRARY}") - target_link_libraries(threads "${RT_LIBRARY}") -endif() - -set(GUI_ONLY_BINARIES empty gamma icon inputlag joysticks opacity tearing - threads timeout title triangle-vulkan windows) -set(CONSOLE_BINARIES clipboard events msaa glfwinfo iconify monitors reopen - cursor) - -set_target_properties(${GUI_ONLY_BINARIES} ${CONSOLE_BINARIES} PROPERTIES - FOLDER "GLFW3/Tests") - -if (MSVC) - # Tell MSVC to use main instead of WinMain for Windows subsystem executables - set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES - LINK_FLAGS "/ENTRY:mainCRTStartup") -endif() - -if (APPLE) - set_target_properties(empty PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Empty Event") - set_target_properties(gamma PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Gamma") - set_target_properties(inputlag PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Input Lag") - set_target_properties(joysticks PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Joysticks") - set_target_properties(opacity PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Opacity") - set_target_properties(tearing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Tearing") - set_target_properties(threads PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Threads") - set_target_properties(timeout PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Timeout") - set_target_properties(title PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Title") - set_target_properties(windows PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Windows") - - set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES - MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION} - MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION} - MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/MacOSXBundleInfo.plist.in") -endif() - diff --git a/third_party/penumbra/vendor/glfw/tests/clipboard.c b/third_party/penumbra/vendor/glfw/tests/clipboard.c deleted file mode 100644 index 41454a3ca71..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/clipboard.c +++ /dev/null @@ -1,145 +0,0 @@ -//======================================================================== -// Clipboard test program -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// -// This program is used to test the clipboard functionality. -// -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#include -#include - -#include "getopt.h" - -#if defined(__APPLE__) - #define MODIFIER GLFW_MOD_SUPER -#else - #define MODIFIER GLFW_MOD_CONTROL -#endif - -static void usage(void) -{ - printf("Usage: clipboard [-h]\n"); -} - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (action != GLFW_PRESS) - return; - - switch (key) - { - case GLFW_KEY_ESCAPE: - glfwSetWindowShouldClose(window, GLFW_TRUE); - break; - - case GLFW_KEY_V: - if (mods == MODIFIER) - { - const char* string; - - string = glfwGetClipboardString(NULL); - if (string) - printf("Clipboard contains \"%s\"\n", string); - else - printf("Clipboard does not contain a string\n"); - } - break; - - case GLFW_KEY_C: - if (mods == MODIFIER) - { - const char* string = "Hello GLFW World!"; - glfwSetClipboardString(NULL, string); - printf("Setting clipboard to \"%s\"\n", string); - } - break; - } -} - -int main(int argc, char** argv) -{ - int ch; - GLFWwindow* window; - - while ((ch = getopt(argc, argv, "h")) != -1) - { - switch (ch) - { - case 'h': - usage(); - exit(EXIT_SUCCESS); - - default: - usage(); - exit(EXIT_FAILURE); - } - } - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - { - fprintf(stderr, "Failed to initialize GLFW\n"); - exit(EXIT_FAILURE); - } - - window = glfwCreateWindow(200, 200, "Clipboard Test", NULL, NULL); - if (!window) - { - glfwTerminate(); - - fprintf(stderr, "Failed to open GLFW window\n"); - exit(EXIT_FAILURE); - } - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - glfwSwapInterval(1); - - glfwSetKeyCallback(window, key_callback); - - glClearColor(0.5f, 0.5f, 0.5f, 0); - - while (!glfwWindowShouldClose(window)) - { - glClear(GL_COLOR_BUFFER_BIT); - - glfwSwapBuffers(window); - glfwWaitEvents(); - } - - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/tests/cursor.c b/third_party/penumbra/vendor/glfw/tests/cursor.c deleted file mode 100644 index b6288f6ac8a..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/cursor.c +++ /dev/null @@ -1,493 +0,0 @@ -//======================================================================== -// Cursor & input mode tests -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// -// This test provides an interface to the cursor image and cursor mode -// parts of the API. -// -// Custom cursor image generation by urraka. -// -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#if defined(_MSC_VER) - // Make MS math.h define M_PI - #define _USE_MATH_DEFINES -#endif - -#include -#include -#include - -#include "linmath.h" - -#define CURSOR_FRAME_COUNT 60 - -static const char* vertex_shader_text = -"#version 110\n" -"uniform mat4 MVP;\n" -"attribute vec2 vPos;\n" -"void main()\n" -"{\n" -" gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n" -"}\n"; - -static const char* fragment_shader_text = -"#version 110\n" -"void main()\n" -"{\n" -" gl_FragColor = vec4(1.0);\n" -"}\n"; - -static double cursor_x; -static double cursor_y; -static int swap_interval = 1; -static int wait_events = GLFW_TRUE; -static int animate_cursor = GLFW_FALSE; -static int track_cursor = GLFW_FALSE; -static GLFWcursor* standard_cursors[6]; -static GLFWcursor* tracking_cursor = NULL; - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -static float star(int x, int y, float t) -{ - const float c = 64 / 2.f; - - const float i = (0.25f * (float) sin(2.f * M_PI * t) + 0.75f); - const float k = 64 * 0.046875f * i; - - const float dist = (float) sqrt((x - c) * (x - c) + (y - c) * (y - c)); - - const float salpha = 1.f - dist / c; - const float xalpha = (float) x == c ? c : k / (float) fabs(x - c); - const float yalpha = (float) y == c ? c : k / (float) fabs(y - c); - - return (float) fmax(0.f, fmin(1.f, i * salpha * 0.2f + salpha * xalpha * yalpha)); -} - -static GLFWcursor* create_cursor_frame(float t) -{ - int i = 0, x, y; - unsigned char buffer[64 * 64 * 4]; - const GLFWimage image = { 64, 64, buffer }; - - for (y = 0; y < image.width; y++) - { - for (x = 0; x < image.height; x++) - { - buffer[i++] = 255; - buffer[i++] = 255; - buffer[i++] = 255; - buffer[i++] = (unsigned char) (255 * star(x, y, t)); - } - } - - return glfwCreateCursor(&image, image.width / 2, image.height / 2); -} - -static GLFWcursor* create_tracking_cursor(void) -{ - int i = 0, x, y; - unsigned char buffer[32 * 32 * 4]; - const GLFWimage image = { 32, 32, buffer }; - - for (y = 0; y < image.width; y++) - { - for (x = 0; x < image.height; x++) - { - if (x == 7 || y == 7) - { - buffer[i++] = 255; - buffer[i++] = 0; - buffer[i++] = 0; - buffer[i++] = 255; - } - else - { - buffer[i++] = 0; - buffer[i++] = 0; - buffer[i++] = 0; - buffer[i++] = 0; - } - } - } - - return glfwCreateCursor(&image, 7, 7); -} - -static void cursor_position_callback(GLFWwindow* window, double x, double y) -{ - printf("%0.3f: Cursor position: %f %f (%+f %+f)\n", - glfwGetTime(), - x, y, x - cursor_x, y - cursor_y); - - cursor_x = x; - cursor_y = y; -} - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (action != GLFW_PRESS) - return; - - switch (key) - { - case GLFW_KEY_A: - { - animate_cursor = !animate_cursor; - if (!animate_cursor) - glfwSetCursor(window, NULL); - - break; - } - - case GLFW_KEY_ESCAPE: - { - if (glfwGetInputMode(window, GLFW_CURSOR) != GLFW_CURSOR_DISABLED) - { - glfwSetWindowShouldClose(window, GLFW_TRUE); - break; - } - - /* FALLTHROUGH */ - } - - case GLFW_KEY_N: - glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); - glfwGetCursorPos(window, &cursor_x, &cursor_y); - printf("(( cursor is normal ))\n"); - break; - - case GLFW_KEY_D: - glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); - printf("(( cursor is disabled ))\n"); - break; - - case GLFW_KEY_H: - glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); - printf("(( cursor is hidden ))\n"); - break; - - case GLFW_KEY_R: - if (!glfwRawMouseMotionSupported()) - break; - - if (glfwGetInputMode(window, GLFW_RAW_MOUSE_MOTION)) - { - glfwSetInputMode(window, GLFW_RAW_MOUSE_MOTION, GLFW_FALSE); - printf("(( raw input is disabled ))\n"); - } - else - { - glfwSetInputMode(window, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE); - printf("(( raw input is enabled ))\n"); - } - break; - - case GLFW_KEY_SPACE: - swap_interval = 1 - swap_interval; - printf("(( swap interval: %i ))\n", swap_interval); - glfwSwapInterval(swap_interval); - break; - - case GLFW_KEY_W: - wait_events = !wait_events; - printf("(( %sing for events ))\n", wait_events ? "wait" : "poll"); - break; - - case GLFW_KEY_T: - track_cursor = !track_cursor; - if (track_cursor) - glfwSetCursor(window, tracking_cursor); - else - glfwSetCursor(window, NULL); - - break; - - case GLFW_KEY_P: - { - double x, y; - glfwGetCursorPos(window, &x, &y); - - printf("Query before set: %f %f (%+f %+f)\n", - x, y, x - cursor_x, y - cursor_y); - cursor_x = x; - cursor_y = y; - - glfwSetCursorPos(window, cursor_x, cursor_y); - glfwGetCursorPos(window, &x, &y); - - printf("Query after set: %f %f (%+f %+f)\n", - x, y, x - cursor_x, y - cursor_y); - cursor_x = x; - cursor_y = y; - break; - } - - case GLFW_KEY_UP: - glfwSetCursorPos(window, 0, 0); - glfwGetCursorPos(window, &cursor_x, &cursor_y); - break; - - case GLFW_KEY_DOWN: - { - int width, height; - glfwGetWindowSize(window, &width, &height); - glfwSetCursorPos(window, width - 1, height - 1); - glfwGetCursorPos(window, &cursor_x, &cursor_y); - break; - } - - case GLFW_KEY_0: - glfwSetCursor(window, NULL); - break; - - case GLFW_KEY_1: - glfwSetCursor(window, standard_cursors[0]); - break; - - case GLFW_KEY_2: - glfwSetCursor(window, standard_cursors[1]); - break; - - case GLFW_KEY_3: - glfwSetCursor(window, standard_cursors[2]); - break; - - case GLFW_KEY_4: - glfwSetCursor(window, standard_cursors[3]); - break; - - case GLFW_KEY_5: - glfwSetCursor(window, standard_cursors[4]); - break; - - case GLFW_KEY_6: - glfwSetCursor(window, standard_cursors[5]); - break; - - case GLFW_KEY_F11: - case GLFW_KEY_ENTER: - { - static int x, y, width, height; - - if (mods != GLFW_MOD_ALT) - return; - - if (glfwGetWindowMonitor(window)) - glfwSetWindowMonitor(window, NULL, x, y, width, height, 0); - else - { - GLFWmonitor* monitor = glfwGetPrimaryMonitor(); - const GLFWvidmode* mode = glfwGetVideoMode(monitor); - glfwGetWindowPos(window, &x, &y); - glfwGetWindowSize(window, &width, &height); - glfwSetWindowMonitor(window, monitor, - 0, 0, mode->width, mode->height, - mode->refreshRate); - } - - glfwGetCursorPos(window, &cursor_x, &cursor_y); - break; - } - } -} - -int main(void) -{ - int i; - GLFWwindow* window; - GLFWcursor* star_cursors[CURSOR_FRAME_COUNT]; - GLFWcursor* current_frame = NULL; - GLuint vertex_buffer, vertex_shader, fragment_shader, program; - GLint mvp_location, vpos_location; - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - tracking_cursor = create_tracking_cursor(); - if (!tracking_cursor) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - for (i = 0; i < CURSOR_FRAME_COUNT; i++) - { - star_cursors[i] = create_cursor_frame(i / (float) CURSOR_FRAME_COUNT); - if (!star_cursors[i]) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - } - - for (i = 0; i < sizeof(standard_cursors) / sizeof(standard_cursors[0]); i++) - { - const int shapes[] = { - GLFW_ARROW_CURSOR, - GLFW_IBEAM_CURSOR, - GLFW_CROSSHAIR_CURSOR, - GLFW_HAND_CURSOR, - GLFW_HRESIZE_CURSOR, - GLFW_VRESIZE_CURSOR - }; - - standard_cursors[i] = glfwCreateStandardCursor(shapes[i]); - if (!standard_cursors[i]) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - } - - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); - - window = glfwCreateWindow(640, 480, "Cursor Test", NULL, NULL); - if (!window) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - - glGenBuffers(1, &vertex_buffer); - glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); - - vertex_shader = glCreateShader(GL_VERTEX_SHADER); - glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL); - glCompileShader(vertex_shader); - - fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); - glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL); - glCompileShader(fragment_shader); - - program = glCreateProgram(); - glAttachShader(program, vertex_shader); - glAttachShader(program, fragment_shader); - glLinkProgram(program); - - mvp_location = glGetUniformLocation(program, "MVP"); - vpos_location = glGetAttribLocation(program, "vPos"); - - glEnableVertexAttribArray(vpos_location); - glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE, - sizeof(vec2), (void*) 0); - glUseProgram(program); - - glfwGetCursorPos(window, &cursor_x, &cursor_y); - printf("Cursor position: %f %f\n", cursor_x, cursor_y); - - glfwSetCursorPosCallback(window, cursor_position_callback); - glfwSetKeyCallback(window, key_callback); - - while (!glfwWindowShouldClose(window)) - { - glClear(GL_COLOR_BUFFER_BIT); - - if (track_cursor) - { - int wnd_width, wnd_height, fb_width, fb_height; - float scale; - vec2 vertices[4]; - mat4x4 mvp; - - glfwGetWindowSize(window, &wnd_width, &wnd_height); - glfwGetFramebufferSize(window, &fb_width, &fb_height); - - glViewport(0, 0, fb_width, fb_height); - - scale = (float) fb_width / (float) wnd_width; - vertices[0][0] = 0.5f; - vertices[0][1] = (float) (fb_height - floor(cursor_y * scale) - 1.f + 0.5f); - vertices[1][0] = (float) fb_width + 0.5f; - vertices[1][1] = (float) (fb_height - floor(cursor_y * scale) - 1.f + 0.5f); - vertices[2][0] = (float) floor(cursor_x * scale) + 0.5f; - vertices[2][1] = 0.5f; - vertices[3][0] = (float) floor(cursor_x * scale) + 0.5f; - vertices[3][1] = (float) fb_height + 0.5f; - - glBufferData(GL_ARRAY_BUFFER, - sizeof(vertices), - vertices, - GL_STREAM_DRAW); - - mat4x4_ortho(mvp, 0.f, (float) fb_width, 0.f, (float) fb_height, 0.f, 1.f); - glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); - - glDrawArrays(GL_LINES, 0, 4); - } - - glfwSwapBuffers(window); - - if (animate_cursor) - { - const int i = (int) (glfwGetTime() * 30.0) % CURSOR_FRAME_COUNT; - if (current_frame != star_cursors[i]) - { - glfwSetCursor(window, star_cursors[i]); - current_frame = star_cursors[i]; - } - } - else - current_frame = NULL; - - if (wait_events) - { - if (animate_cursor) - glfwWaitEventsTimeout(1.0 / 30.0); - else - glfwWaitEvents(); - } - else - glfwPollEvents(); - - // Workaround for an issue with msvcrt and mintty - fflush(stdout); - } - - glfwDestroyWindow(window); - - for (i = 0; i < CURSOR_FRAME_COUNT; i++) - glfwDestroyCursor(star_cursors[i]); - - for (i = 0; i < sizeof(standard_cursors) / sizeof(standard_cursors[0]); i++) - glfwDestroyCursor(standard_cursors[i]); - - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/tests/empty.c b/third_party/penumbra/vendor/glfw/tests/empty.c deleted file mode 100644 index c3877a715f1..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/empty.c +++ /dev/null @@ -1,132 +0,0 @@ -//======================================================================== -// Empty event test -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// -// This test is intended to verify that posting of empty events works -// -//======================================================================== - -#include "tinycthread.h" - -#include -#define GLFW_INCLUDE_NONE -#include - -#include -#include -#include - -static volatile int running = GLFW_TRUE; - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -static int thread_main(void* data) -{ - struct timespec time; - - while (running) - { - clock_gettime(CLOCK_REALTIME, &time); - time.tv_sec += 1; - thrd_sleep(&time, NULL); - - glfwPostEmptyEvent(); - } - - return 0; -} - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) - glfwSetWindowShouldClose(window, GLFW_TRUE); -} - -static float nrand(void) -{ - return (float) rand() / (float) RAND_MAX; -} - -int main(void) -{ - int result; - thrd_t thread; - GLFWwindow* window; - - srand((unsigned int) time(NULL)); - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - window = glfwCreateWindow(640, 480, "Empty Event Test", NULL, NULL); - if (!window) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - glfwSetKeyCallback(window, key_callback); - - if (thrd_create(&thread, thread_main, NULL) != thrd_success) - { - fprintf(stderr, "Failed to create secondary thread\n"); - - glfwTerminate(); - exit(EXIT_FAILURE); - } - - while (running) - { - int width, height; - float r = nrand(), g = nrand(), b = nrand(); - float l = (float) sqrt(r * r + g * g + b * b); - - glfwGetFramebufferSize(window, &width, &height); - - glViewport(0, 0, width, height); - glClearColor(r / l, g / l, b / l, 1.f); - glClear(GL_COLOR_BUFFER_BIT); - glfwSwapBuffers(window); - - glfwWaitEvents(); - - if (glfwWindowShouldClose(window)) - running = GLFW_FALSE; - } - - glfwHideWindow(window); - thrd_join(thread, &result); - glfwDestroyWindow(window); - - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/tests/events.c b/third_party/penumbra/vendor/glfw/tests/events.c deleted file mode 100644 index f29dfbb034c..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/events.c +++ /dev/null @@ -1,650 +0,0 @@ -//======================================================================== -// Event linter (event spewer) -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// -// This test hooks every available callback and outputs their arguments -// -// Log messages go to stdout, error messages to stderr -// -// Every event also gets a (sequential) number to aid discussion of logs -// -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#include -#include -#include -#include -#include - -#include "getopt.h" - -// Event index -static unsigned int counter = 0; - -typedef struct -{ - GLFWwindow* window; - int number; - int closeable; -} Slot; - -static void usage(void) -{ - printf("Usage: events [-f] [-h] [-n WINDOWS]\n"); - printf("Options:\n"); - printf(" -f use full screen\n"); - printf(" -h show this help\n"); - printf(" -n the number of windows to create\n"); -} - -static const char* get_key_name(int key) -{ - switch (key) - { - // Printable keys - case GLFW_KEY_A: return "A"; - case GLFW_KEY_B: return "B"; - case GLFW_KEY_C: return "C"; - case GLFW_KEY_D: return "D"; - case GLFW_KEY_E: return "E"; - case GLFW_KEY_F: return "F"; - case GLFW_KEY_G: return "G"; - case GLFW_KEY_H: return "H"; - case GLFW_KEY_I: return "I"; - case GLFW_KEY_J: return "J"; - case GLFW_KEY_K: return "K"; - case GLFW_KEY_L: return "L"; - case GLFW_KEY_M: return "M"; - case GLFW_KEY_N: return "N"; - case GLFW_KEY_O: return "O"; - case GLFW_KEY_P: return "P"; - case GLFW_KEY_Q: return "Q"; - case GLFW_KEY_R: return "R"; - case GLFW_KEY_S: return "S"; - case GLFW_KEY_T: return "T"; - case GLFW_KEY_U: return "U"; - case GLFW_KEY_V: return "V"; - case GLFW_KEY_W: return "W"; - case GLFW_KEY_X: return "X"; - case GLFW_KEY_Y: return "Y"; - case GLFW_KEY_Z: return "Z"; - case GLFW_KEY_1: return "1"; - case GLFW_KEY_2: return "2"; - case GLFW_KEY_3: return "3"; - case GLFW_KEY_4: return "4"; - case GLFW_KEY_5: return "5"; - case GLFW_KEY_6: return "6"; - case GLFW_KEY_7: return "7"; - case GLFW_KEY_8: return "8"; - case GLFW_KEY_9: return "9"; - case GLFW_KEY_0: return "0"; - case GLFW_KEY_SPACE: return "SPACE"; - case GLFW_KEY_MINUS: return "MINUS"; - case GLFW_KEY_EQUAL: return "EQUAL"; - case GLFW_KEY_LEFT_BRACKET: return "LEFT BRACKET"; - case GLFW_KEY_RIGHT_BRACKET: return "RIGHT BRACKET"; - case GLFW_KEY_BACKSLASH: return "BACKSLASH"; - case GLFW_KEY_SEMICOLON: return "SEMICOLON"; - case GLFW_KEY_APOSTROPHE: return "APOSTROPHE"; - case GLFW_KEY_GRAVE_ACCENT: return "GRAVE ACCENT"; - case GLFW_KEY_COMMA: return "COMMA"; - case GLFW_KEY_PERIOD: return "PERIOD"; - case GLFW_KEY_SLASH: return "SLASH"; - case GLFW_KEY_WORLD_1: return "WORLD 1"; - case GLFW_KEY_WORLD_2: return "WORLD 2"; - - // Function keys - case GLFW_KEY_ESCAPE: return "ESCAPE"; - case GLFW_KEY_F1: return "F1"; - case GLFW_KEY_F2: return "F2"; - case GLFW_KEY_F3: return "F3"; - case GLFW_KEY_F4: return "F4"; - case GLFW_KEY_F5: return "F5"; - case GLFW_KEY_F6: return "F6"; - case GLFW_KEY_F7: return "F7"; - case GLFW_KEY_F8: return "F8"; - case GLFW_KEY_F9: return "F9"; - case GLFW_KEY_F10: return "F10"; - case GLFW_KEY_F11: return "F11"; - case GLFW_KEY_F12: return "F12"; - case GLFW_KEY_F13: return "F13"; - case GLFW_KEY_F14: return "F14"; - case GLFW_KEY_F15: return "F15"; - case GLFW_KEY_F16: return "F16"; - case GLFW_KEY_F17: return "F17"; - case GLFW_KEY_F18: return "F18"; - case GLFW_KEY_F19: return "F19"; - case GLFW_KEY_F20: return "F20"; - case GLFW_KEY_F21: return "F21"; - case GLFW_KEY_F22: return "F22"; - case GLFW_KEY_F23: return "F23"; - case GLFW_KEY_F24: return "F24"; - case GLFW_KEY_F25: return "F25"; - case GLFW_KEY_UP: return "UP"; - case GLFW_KEY_DOWN: return "DOWN"; - case GLFW_KEY_LEFT: return "LEFT"; - case GLFW_KEY_RIGHT: return "RIGHT"; - case GLFW_KEY_LEFT_SHIFT: return "LEFT SHIFT"; - case GLFW_KEY_RIGHT_SHIFT: return "RIGHT SHIFT"; - case GLFW_KEY_LEFT_CONTROL: return "LEFT CONTROL"; - case GLFW_KEY_RIGHT_CONTROL: return "RIGHT CONTROL"; - case GLFW_KEY_LEFT_ALT: return "LEFT ALT"; - case GLFW_KEY_RIGHT_ALT: return "RIGHT ALT"; - case GLFW_KEY_TAB: return "TAB"; - case GLFW_KEY_ENTER: return "ENTER"; - case GLFW_KEY_BACKSPACE: return "BACKSPACE"; - case GLFW_KEY_INSERT: return "INSERT"; - case GLFW_KEY_DELETE: return "DELETE"; - case GLFW_KEY_PAGE_UP: return "PAGE UP"; - case GLFW_KEY_PAGE_DOWN: return "PAGE DOWN"; - case GLFW_KEY_HOME: return "HOME"; - case GLFW_KEY_END: return "END"; - case GLFW_KEY_KP_0: return "KEYPAD 0"; - case GLFW_KEY_KP_1: return "KEYPAD 1"; - case GLFW_KEY_KP_2: return "KEYPAD 2"; - case GLFW_KEY_KP_3: return "KEYPAD 3"; - case GLFW_KEY_KP_4: return "KEYPAD 4"; - case GLFW_KEY_KP_5: return "KEYPAD 5"; - case GLFW_KEY_KP_6: return "KEYPAD 6"; - case GLFW_KEY_KP_7: return "KEYPAD 7"; - case GLFW_KEY_KP_8: return "KEYPAD 8"; - case GLFW_KEY_KP_9: return "KEYPAD 9"; - case GLFW_KEY_KP_DIVIDE: return "KEYPAD DIVIDE"; - case GLFW_KEY_KP_MULTIPLY: return "KEYPAD MULTIPLY"; - case GLFW_KEY_KP_SUBTRACT: return "KEYPAD SUBTRACT"; - case GLFW_KEY_KP_ADD: return "KEYPAD ADD"; - case GLFW_KEY_KP_DECIMAL: return "KEYPAD DECIMAL"; - case GLFW_KEY_KP_EQUAL: return "KEYPAD EQUAL"; - case GLFW_KEY_KP_ENTER: return "KEYPAD ENTER"; - case GLFW_KEY_PRINT_SCREEN: return "PRINT SCREEN"; - case GLFW_KEY_NUM_LOCK: return "NUM LOCK"; - case GLFW_KEY_CAPS_LOCK: return "CAPS LOCK"; - case GLFW_KEY_SCROLL_LOCK: return "SCROLL LOCK"; - case GLFW_KEY_PAUSE: return "PAUSE"; - case GLFW_KEY_LEFT_SUPER: return "LEFT SUPER"; - case GLFW_KEY_RIGHT_SUPER: return "RIGHT SUPER"; - case GLFW_KEY_MENU: return "MENU"; - - default: return "UNKNOWN"; - } -} - -static const char* get_action_name(int action) -{ - switch (action) - { - case GLFW_PRESS: - return "pressed"; - case GLFW_RELEASE: - return "released"; - case GLFW_REPEAT: - return "repeated"; - } - - return "caused unknown action"; -} - -static const char* get_button_name(int button) -{ - switch (button) - { - case GLFW_MOUSE_BUTTON_LEFT: - return "left"; - case GLFW_MOUSE_BUTTON_RIGHT: - return "right"; - case GLFW_MOUSE_BUTTON_MIDDLE: - return "middle"; - default: - { - static char name[16]; - snprintf(name, sizeof(name), "%i", button); - return name; - } - } -} - -static const char* get_mods_name(int mods) -{ - static char name[512]; - - if (mods == 0) - return " no mods"; - - name[0] = '\0'; - - if (mods & GLFW_MOD_SHIFT) - strcat(name, " shift"); - if (mods & GLFW_MOD_CONTROL) - strcat(name, " control"); - if (mods & GLFW_MOD_ALT) - strcat(name, " alt"); - if (mods & GLFW_MOD_SUPER) - strcat(name, " super"); - if (mods & GLFW_MOD_CAPS_LOCK) - strcat(name, " capslock-on"); - if (mods & GLFW_MOD_NUM_LOCK) - strcat(name, " numlock-on"); - - return name; -} - -static size_t encode_utf8(char* s, unsigned int ch) -{ - size_t count = 0; - - if (ch < 0x80) - s[count++] = (char) ch; - else if (ch < 0x800) - { - s[count++] = (ch >> 6) | 0xc0; - s[count++] = (ch & 0x3f) | 0x80; - } - else if (ch < 0x10000) - { - s[count++] = (ch >> 12) | 0xe0; - s[count++] = ((ch >> 6) & 0x3f) | 0x80; - s[count++] = (ch & 0x3f) | 0x80; - } - else if (ch < 0x110000) - { - s[count++] = (ch >> 18) | 0xf0; - s[count++] = ((ch >> 12) & 0x3f) | 0x80; - s[count++] = ((ch >> 6) & 0x3f) | 0x80; - s[count++] = (ch & 0x3f) | 0x80; - } - - return count; -} - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -static void window_pos_callback(GLFWwindow* window, int x, int y) -{ - Slot* slot = glfwGetWindowUserPointer(window); - printf("%08x to %i at %0.3f: Window position: %i %i\n", - counter++, slot->number, glfwGetTime(), x, y); -} - -static void window_size_callback(GLFWwindow* window, int width, int height) -{ - Slot* slot = glfwGetWindowUserPointer(window); - printf("%08x to %i at %0.3f: Window size: %i %i\n", - counter++, slot->number, glfwGetTime(), width, height); -} - -static void framebuffer_size_callback(GLFWwindow* window, int width, int height) -{ - Slot* slot = glfwGetWindowUserPointer(window); - printf("%08x to %i at %0.3f: Framebuffer size: %i %i\n", - counter++, slot->number, glfwGetTime(), width, height); -} - -static void window_content_scale_callback(GLFWwindow* window, float xscale, float yscale) -{ - Slot* slot = glfwGetWindowUserPointer(window); - printf("%08x to %i at %0.3f: Window content scale: %0.3f %0.3f\n", - counter++, slot->number, glfwGetTime(), xscale, yscale); -} - -static void window_close_callback(GLFWwindow* window) -{ - Slot* slot = glfwGetWindowUserPointer(window); - printf("%08x to %i at %0.3f: Window close\n", - counter++, slot->number, glfwGetTime()); - - glfwSetWindowShouldClose(window, slot->closeable); -} - -static void window_refresh_callback(GLFWwindow* window) -{ - Slot* slot = glfwGetWindowUserPointer(window); - printf("%08x to %i at %0.3f: Window refresh\n", - counter++, slot->number, glfwGetTime()); - - glfwMakeContextCurrent(window); - glClear(GL_COLOR_BUFFER_BIT); - glfwSwapBuffers(window); -} - -static void window_focus_callback(GLFWwindow* window, int focused) -{ - Slot* slot = glfwGetWindowUserPointer(window); - printf("%08x to %i at %0.3f: Window %s\n", - counter++, slot->number, glfwGetTime(), - focused ? "focused" : "defocused"); -} - -static void window_iconify_callback(GLFWwindow* window, int iconified) -{ - Slot* slot = glfwGetWindowUserPointer(window); - printf("%08x to %i at %0.3f: Window was %s\n", - counter++, slot->number, glfwGetTime(), - iconified ? "iconified" : "uniconified"); -} - -static void window_maximize_callback(GLFWwindow* window, int maximized) -{ - Slot* slot = glfwGetWindowUserPointer(window); - printf("%08x to %i at %0.3f: Window was %s\n", - counter++, slot->number, glfwGetTime(), - maximized ? "maximized" : "unmaximized"); -} - -static void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) -{ - Slot* slot = glfwGetWindowUserPointer(window); - printf("%08x to %i at %0.3f: Mouse button %i (%s) (with%s) was %s\n", - counter++, slot->number, glfwGetTime(), button, - get_button_name(button), - get_mods_name(mods), - get_action_name(action)); -} - -static void cursor_position_callback(GLFWwindow* window, double x, double y) -{ - Slot* slot = glfwGetWindowUserPointer(window); - printf("%08x to %i at %0.3f: Cursor position: %f %f\n", - counter++, slot->number, glfwGetTime(), x, y); -} - -static void cursor_enter_callback(GLFWwindow* window, int entered) -{ - Slot* slot = glfwGetWindowUserPointer(window); - printf("%08x to %i at %0.3f: Cursor %s window\n", - counter++, slot->number, glfwGetTime(), - entered ? "entered" : "left"); -} - -static void scroll_callback(GLFWwindow* window, double x, double y) -{ - Slot* slot = glfwGetWindowUserPointer(window); - printf("%08x to %i at %0.3f: Scroll: %0.3f %0.3f\n", - counter++, slot->number, glfwGetTime(), x, y); -} - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - Slot* slot = glfwGetWindowUserPointer(window); - const char* name = glfwGetKeyName(key, scancode); - - if (name) - { - printf("%08x to %i at %0.3f: Key 0x%04x Scancode 0x%04x (%s) (%s) (with%s) was %s\n", - counter++, slot->number, glfwGetTime(), key, scancode, - get_key_name(key), - name, - get_mods_name(mods), - get_action_name(action)); - } - else - { - printf("%08x to %i at %0.3f: Key 0x%04x Scancode 0x%04x (%s) (with%s) was %s\n", - counter++, slot->number, glfwGetTime(), key, scancode, - get_key_name(key), - get_mods_name(mods), - get_action_name(action)); - } - - if (action != GLFW_PRESS) - return; - - switch (key) - { - case GLFW_KEY_C: - { - slot->closeable = !slot->closeable; - - printf("(( closing %s ))\n", slot->closeable ? "enabled" : "disabled"); - break; - } - - case GLFW_KEY_L: - { - const int state = glfwGetInputMode(window, GLFW_LOCK_KEY_MODS); - glfwSetInputMode(window, GLFW_LOCK_KEY_MODS, !state); - - printf("(( lock key mods %s ))\n", !state ? "enabled" : "disabled"); - break; - } - } -} - -static void char_callback(GLFWwindow* window, unsigned int codepoint) -{ - Slot* slot = glfwGetWindowUserPointer(window); - char string[5] = ""; - - encode_utf8(string, codepoint); - printf("%08x to %i at %0.3f: Character 0x%08x (%s) input\n", - counter++, slot->number, glfwGetTime(), codepoint, string); -} - -static void drop_callback(GLFWwindow* window, int count, const char* paths[]) -{ - int i; - Slot* slot = glfwGetWindowUserPointer(window); - - printf("%08x to %i at %0.3f: Drop input\n", - counter++, slot->number, glfwGetTime()); - - for (i = 0; i < count; i++) - printf(" %i: \"%s\"\n", i, paths[i]); -} - -static void monitor_callback(GLFWmonitor* monitor, int event) -{ - if (event == GLFW_CONNECTED) - { - int x, y, widthMM, heightMM; - const GLFWvidmode* mode = glfwGetVideoMode(monitor); - - glfwGetMonitorPos(monitor, &x, &y); - glfwGetMonitorPhysicalSize(monitor, &widthMM, &heightMM); - - printf("%08x at %0.3f: Monitor %s (%ix%i at %ix%i, %ix%i mm) was connected\n", - counter++, - glfwGetTime(), - glfwGetMonitorName(monitor), - mode->width, mode->height, - x, y, - widthMM, heightMM); - } - else if (event == GLFW_DISCONNECTED) - { - printf("%08x at %0.3f: Monitor %s was disconnected\n", - counter++, - glfwGetTime(), - glfwGetMonitorName(monitor)); - } -} - -static void joystick_callback(int jid, int event) -{ - if (event == GLFW_CONNECTED) - { - int axisCount, buttonCount, hatCount; - - glfwGetJoystickAxes(jid, &axisCount); - glfwGetJoystickButtons(jid, &buttonCount); - glfwGetJoystickHats(jid, &hatCount); - - printf("%08x at %0.3f: Joystick %i (%s) was connected with %i axes, %i buttons, and %i hats\n", - counter++, glfwGetTime(), - jid, - glfwGetJoystickName(jid), - axisCount, - buttonCount, - hatCount); - } - else - { - printf("%08x at %0.3f: Joystick %i was disconnected\n", - counter++, glfwGetTime(), jid); - } -} - -int main(int argc, char** argv) -{ - Slot* slots; - GLFWmonitor* monitor = NULL; - int ch, i, width, height, count = 1; - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - printf("Library initialized\n"); - - glfwSetMonitorCallback(monitor_callback); - glfwSetJoystickCallback(joystick_callback); - - while ((ch = getopt(argc, argv, "hfn:")) != -1) - { - switch (ch) - { - case 'h': - usage(); - exit(EXIT_SUCCESS); - - case 'f': - monitor = glfwGetPrimaryMonitor(); - break; - - case 'n': - count = (int) strtoul(optarg, NULL, 10); - break; - - default: - usage(); - exit(EXIT_FAILURE); - } - } - - if (monitor) - { - const GLFWvidmode* mode = glfwGetVideoMode(monitor); - - glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate); - glfwWindowHint(GLFW_RED_BITS, mode->redBits); - glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); - glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits); - - width = mode->width; - height = mode->height; - } - else - { - width = 640; - height = 480; - } - - slots = calloc(count, sizeof(Slot)); - - for (i = 0; i < count; i++) - { - char title[128]; - - slots[i].closeable = GLFW_TRUE; - slots[i].number = i + 1; - - snprintf(title, sizeof(title), "Event Linter (Window %i)", slots[i].number); - - if (monitor) - { - printf("Creating full screen window %i (%ix%i on %s)\n", - slots[i].number, - width, height, - glfwGetMonitorName(monitor)); - } - else - { - printf("Creating windowed mode window %i (%ix%i)\n", - slots[i].number, - width, height); - } - - slots[i].window = glfwCreateWindow(width, height, title, monitor, NULL); - if (!slots[i].window) - { - free(slots); - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwSetWindowUserPointer(slots[i].window, slots + i); - - glfwSetWindowPosCallback(slots[i].window, window_pos_callback); - glfwSetWindowSizeCallback(slots[i].window, window_size_callback); - glfwSetFramebufferSizeCallback(slots[i].window, framebuffer_size_callback); - glfwSetWindowContentScaleCallback(slots[i].window, window_content_scale_callback); - glfwSetWindowCloseCallback(slots[i].window, window_close_callback); - glfwSetWindowRefreshCallback(slots[i].window, window_refresh_callback); - glfwSetWindowFocusCallback(slots[i].window, window_focus_callback); - glfwSetWindowIconifyCallback(slots[i].window, window_iconify_callback); - glfwSetWindowMaximizeCallback(slots[i].window, window_maximize_callback); - glfwSetMouseButtonCallback(slots[i].window, mouse_button_callback); - glfwSetCursorPosCallback(slots[i].window, cursor_position_callback); - glfwSetCursorEnterCallback(slots[i].window, cursor_enter_callback); - glfwSetScrollCallback(slots[i].window, scroll_callback); - glfwSetKeyCallback(slots[i].window, key_callback); - glfwSetCharCallback(slots[i].window, char_callback); - glfwSetDropCallback(slots[i].window, drop_callback); - - glfwMakeContextCurrent(slots[i].window); - gladLoadGL(glfwGetProcAddress); - glfwSwapInterval(1); - } - - printf("Main loop starting\n"); - - for (;;) - { - for (i = 0; i < count; i++) - { - if (glfwWindowShouldClose(slots[i].window)) - break; - } - - if (i < count) - break; - - glfwWaitEvents(); - - // Workaround for an issue with msvcrt and mintty - fflush(stdout); - } - - free(slots); - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/tests/gamma.c b/third_party/penumbra/vendor/glfw/tests/gamma.c deleted file mode 100644 index aa4c8b7833e..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/gamma.c +++ /dev/null @@ -1,179 +0,0 @@ -//======================================================================== -// Gamma correction test program -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// -// This program is used to test the gamma correction functionality for -// both full screen and windowed mode windows -// -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#define NK_IMPLEMENTATION -#define NK_INCLUDE_FIXED_TYPES -#define NK_INCLUDE_FONT_BAKING -#define NK_INCLUDE_DEFAULT_FONT -#define NK_INCLUDE_DEFAULT_ALLOCATOR -#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT -#define NK_INCLUDE_STANDARD_VARARGS -#define NK_BUTTON_TRIGGER_ON_RELEASE -#include - -#define NK_GLFW_GL2_IMPLEMENTATION -#include - -#include -#include -#include - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (action == GLFW_PRESS && key == GLFW_KEY_ESCAPE) - glfwSetWindowShouldClose(window, GLFW_TRUE); -} - -static void chart_ramp_array(struct nk_context* nk, - struct nk_color color, - int count, unsigned short int* values) -{ - if (nk_chart_begin_colored(nk, NK_CHART_LINES, - color, nk_rgb(255, 255, 255), - count, 0, 65535)) - { - int i; - for (i = 0; i < count; i++) - { - char buffer[1024]; - if (nk_chart_push(nk, values[i])) - { - snprintf(buffer, sizeof(buffer), "#%u: %u (%0.5f) ", - i, values[i], values[i] / 65535.f); - nk_tooltip(nk, buffer); - } - } - - nk_chart_end(nk); - } -} - -int main(int argc, char** argv) -{ - GLFWmonitor* monitor = NULL; - GLFWwindow* window; - GLFWgammaramp orig_ramp; - struct nk_context* nk; - struct nk_font_atlas* atlas; - float gamma_value = 1.f; - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - monitor = glfwGetPrimaryMonitor(); - - glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); - - window = glfwCreateWindow(800, 400, "Gamma Test", NULL, NULL); - if (!window) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - { - const GLFWgammaramp* ramp = glfwGetGammaRamp(monitor); - const size_t array_size = ramp->size * sizeof(short); - orig_ramp.size = ramp->size; - orig_ramp.red = malloc(array_size); - orig_ramp.green = malloc(array_size); - orig_ramp.blue = malloc(array_size); - memcpy(orig_ramp.red, ramp->red, array_size); - memcpy(orig_ramp.green, ramp->green, array_size); - memcpy(orig_ramp.blue, ramp->blue, array_size); - } - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - glfwSwapInterval(1); - - nk = nk_glfw3_init(window, NK_GLFW3_INSTALL_CALLBACKS); - nk_glfw3_font_stash_begin(&atlas); - nk_glfw3_font_stash_end(); - - glfwSetKeyCallback(window, key_callback); - - while (!glfwWindowShouldClose(window)) - { - int width, height; - struct nk_rect area; - - glfwGetWindowSize(window, &width, &height); - area = nk_rect(0.f, 0.f, (float) width, (float) height); - nk_window_set_bounds(nk, "", area); - - glClear(GL_COLOR_BUFFER_BIT); - nk_glfw3_new_frame(); - if (nk_begin(nk, "", area, 0)) - { - const GLFWgammaramp* ramp; - - nk_layout_row_dynamic(nk, 30, 3); - if (nk_slider_float(nk, 0.1f, &gamma_value, 5.f, 0.1f)) - glfwSetGamma(monitor, gamma_value); - nk_labelf(nk, NK_TEXT_LEFT, "%0.1f", gamma_value); - if (nk_button_label(nk, "Revert")) - glfwSetGammaRamp(monitor, &orig_ramp); - - ramp = glfwGetGammaRamp(monitor); - - nk_layout_row_dynamic(nk, height - 60.f, 3); - chart_ramp_array(nk, nk_rgb(255, 0, 0), ramp->size, ramp->red); - chart_ramp_array(nk, nk_rgb(0, 255, 0), ramp->size, ramp->green); - chart_ramp_array(nk, nk_rgb(0, 0, 255), ramp->size, ramp->blue); - } - - nk_end(nk); - nk_glfw3_render(NK_ANTI_ALIASING_ON); - - glfwSwapBuffers(window); - glfwWaitEventsTimeout(1.0); - } - - free(orig_ramp.red); - free(orig_ramp.green); - free(orig_ramp.blue); - - nk_glfw3_shutdown(); - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/tests/glfwinfo.c b/third_party/penumbra/vendor/glfw/tests/glfwinfo.c deleted file mode 100644 index 074bcbd6f1e..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/glfwinfo.c +++ /dev/null @@ -1,920 +0,0 @@ -//======================================================================== -// Context creation and information tool -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== - -#include -#include -#define GLFW_INCLUDE_NONE -#include - -#include -#include -#include - -#include "getopt.h" - -#ifdef _MSC_VER -#define strcasecmp(x, y) _stricmp(x, y) -#endif - -#define API_NAME_OPENGL "gl" -#define API_NAME_OPENGL_ES "es" - -#define API_NAME_NATIVE "native" -#define API_NAME_EGL "egl" -#define API_NAME_OSMESA "osmesa" - -#define PROFILE_NAME_CORE "core" -#define PROFILE_NAME_COMPAT "compat" - -#define STRATEGY_NAME_NONE "none" -#define STRATEGY_NAME_LOSE "lose" - -#define BEHAVIOR_NAME_NONE "none" -#define BEHAVIOR_NAME_FLUSH "flush" - -static void usage(void) -{ - printf("Usage: glfwinfo [OPTION]...\n"); - printf("Options:\n"); - printf(" -a, --client-api=API the client API to use (" - API_NAME_OPENGL " or " - API_NAME_OPENGL_ES ")\n"); - printf(" -b, --behavior=BEHAVIOR the release behavior to use (" - BEHAVIOR_NAME_NONE " or " - BEHAVIOR_NAME_FLUSH ")\n"); - printf(" -c, --context-api=API the context creation API to use (" - API_NAME_NATIVE " or " - API_NAME_EGL " or " - API_NAME_OSMESA ")\n"); - printf(" -d, --debug request a debug context\n"); - printf(" -f, --forward require a forward-compatible context\n"); - printf(" -h, --help show this help\n"); - printf(" -l, --list-extensions list all Vulkan and client API extensions\n"); - printf(" --list-layers list all Vulkan layers\n"); - printf(" -m, --major=MAJOR the major number of the required " - "client API version\n"); - printf(" -n, --minor=MINOR the minor number of the required " - "client API version\n"); - printf(" -p, --profile=PROFILE the OpenGL profile to use (" - PROFILE_NAME_CORE " or " - PROFILE_NAME_COMPAT ")\n"); - printf(" -s, --robustness=STRATEGY the robustness strategy to use (" - STRATEGY_NAME_NONE " or " - STRATEGY_NAME_LOSE ")\n"); - printf(" -v, --version print version information\n"); - printf(" --red-bits=N the number of red bits to request\n"); - printf(" --green-bits=N the number of green bits to request\n"); - printf(" --blue-bits=N the number of blue bits to request\n"); - printf(" --alpha-bits=N the number of alpha bits to request\n"); - printf(" --depth-bits=N the number of depth bits to request\n"); - printf(" --stencil-bits=N the number of stencil bits to request\n"); - printf(" --accum-red-bits=N the number of red bits to request\n"); - printf(" --accum-green-bits=N the number of green bits to request\n"); - printf(" --accum-blue-bits=N the number of blue bits to request\n"); - printf(" --accum-alpha-bits=N the number of alpha bits to request\n"); - printf(" --aux-buffers=N the number of aux buffers to request\n"); - printf(" --samples=N the number of MSAA samples to request\n"); - printf(" --stereo request stereo rendering\n"); - printf(" --srgb request an sRGB capable framebuffer\n"); - printf(" --singlebuffer request single-buffering\n"); - printf(" --no-error request a context that does not emit errors\n"); - printf(" --graphics-switching request macOS graphics switching\n"); -} - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -static const char* get_device_type_name(VkPhysicalDeviceType type) -{ - if (type == VK_PHYSICAL_DEVICE_TYPE_OTHER) - return "other"; - else if (type == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU) - return "integrated GPU"; - else if (type == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) - return "discrete GPU"; - else if (type == VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU) - return "virtual GPU"; - else if (type == VK_PHYSICAL_DEVICE_TYPE_CPU) - return "CPU"; - - return "unknown"; -} - -static const char* get_api_name(int api) -{ - if (api == GLFW_OPENGL_API) - return "OpenGL"; - else if (api == GLFW_OPENGL_ES_API) - return "OpenGL ES"; - - return "Unknown API"; -} - -static const char* get_profile_name_gl(GLint mask) -{ - if (mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) - return PROFILE_NAME_COMPAT; - if (mask & GL_CONTEXT_CORE_PROFILE_BIT) - return PROFILE_NAME_CORE; - - return "unknown"; -} - -static const char* get_profile_name_glfw(int profile) -{ - if (profile == GLFW_OPENGL_COMPAT_PROFILE) - return PROFILE_NAME_COMPAT; - if (profile == GLFW_OPENGL_CORE_PROFILE) - return PROFILE_NAME_CORE; - - return "unknown"; -} - -static const char* get_strategy_name_gl(GLint strategy) -{ - if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB) - return STRATEGY_NAME_LOSE; - if (strategy == GL_NO_RESET_NOTIFICATION_ARB) - return STRATEGY_NAME_NONE; - - return "unknown"; -} - -static const char* get_strategy_name_glfw(int strategy) -{ - if (strategy == GLFW_LOSE_CONTEXT_ON_RESET) - return STRATEGY_NAME_LOSE; - if (strategy == GLFW_NO_RESET_NOTIFICATION) - return STRATEGY_NAME_NONE; - - return "unknown"; -} - -static void list_context_extensions(int client, int major, int minor) -{ - int i; - GLint count; - const GLubyte* extensions; - - printf("%s context extensions:\n", get_api_name(client)); - - if (client == GLFW_OPENGL_API && major > 2) - { - glGetIntegerv(GL_NUM_EXTENSIONS, &count); - - for (i = 0; i < count; i++) - printf(" %s\n", (const char*) glGetStringi(GL_EXTENSIONS, i)); - } - else - { - extensions = glGetString(GL_EXTENSIONS); - while (*extensions != '\0') - { - putchar(' '); - - while (*extensions != '\0' && *extensions != ' ') - { - putchar(*extensions); - extensions++; - } - - while (*extensions == ' ') - extensions++; - - putchar('\n'); - } - } -} - -static void list_vulkan_instance_extensions(void) -{ - uint32_t i, ep_count = 0; - VkExtensionProperties* ep; - - printf("Vulkan instance extensions:\n"); - - if (vkEnumerateInstanceExtensionProperties(NULL, &ep_count, NULL) != VK_SUCCESS) - return; - - ep = calloc(ep_count, sizeof(VkExtensionProperties)); - - if (vkEnumerateInstanceExtensionProperties(NULL, &ep_count, ep) != VK_SUCCESS) - { - free(ep); - return; - } - - for (i = 0; i < ep_count; i++) - printf(" %s (v%u)\n", ep[i].extensionName, ep[i].specVersion); - - free(ep); -} - -static void list_vulkan_instance_layers(void) -{ - uint32_t i, lp_count = 0; - VkLayerProperties* lp; - - printf("Vulkan instance layers:\n"); - - if (vkEnumerateInstanceLayerProperties(&lp_count, NULL) != VK_SUCCESS) - return; - - lp = calloc(lp_count, sizeof(VkLayerProperties)); - - if (vkEnumerateInstanceLayerProperties(&lp_count, lp) != VK_SUCCESS) - { - free(lp); - return; - } - - for (i = 0; i < lp_count; i++) - { - printf(" %s (v%u) \"%s\"\n", - lp[i].layerName, - lp[i].specVersion >> 22, - lp[i].description); - } - - free(lp); -} - -static void list_vulkan_device_extensions(VkInstance instance, VkPhysicalDevice device) -{ - uint32_t i, ep_count; - VkExtensionProperties* ep; - - printf("Vulkan device extensions:\n"); - - if (vkEnumerateDeviceExtensionProperties(device, NULL, &ep_count, NULL) != VK_SUCCESS) - return; - - ep = calloc(ep_count, sizeof(VkExtensionProperties)); - - if (vkEnumerateDeviceExtensionProperties(device, NULL, &ep_count, ep) != VK_SUCCESS) - { - free(ep); - return; - } - - for (i = 0; i < ep_count; i++) - printf(" %s (v%u)\n", ep[i].extensionName, ep[i].specVersion); - - free(ep); -} - -static void list_vulkan_device_layers(VkInstance instance, VkPhysicalDevice device) -{ - uint32_t i, lp_count; - VkLayerProperties* lp; - - printf("Vulkan device layers:\n"); - - if (vkEnumerateDeviceLayerProperties(device, &lp_count, NULL) != VK_SUCCESS) - return; - - lp = calloc(lp_count, sizeof(VkLayerProperties)); - - if (vkEnumerateDeviceLayerProperties(device, &lp_count, lp) != VK_SUCCESS) - { - free(lp); - return; - } - - for (i = 0; i < lp_count; i++) - { - printf(" %s (v%u) \"%s\"\n", - lp[i].layerName, - lp[i].specVersion >> 22, - lp[i].description); - } - - free(lp); -} - -static int valid_version(void) -{ - int major, minor, revision; - glfwGetVersion(&major, &minor, &revision); - - if (major != GLFW_VERSION_MAJOR) - { - printf("*** ERROR: GLFW major version mismatch! ***\n"); - return GLFW_FALSE; - } - - if (minor != GLFW_VERSION_MINOR || revision != GLFW_VERSION_REVISION) - printf("*** WARNING: GLFW version mismatch! ***\n"); - - return GLFW_TRUE; -} - -static void print_version(void) -{ - int major, minor, revision; - glfwGetVersion(&major, &minor, &revision); - - printf("GLFW header version: %u.%u.%u\n", - GLFW_VERSION_MAJOR, - GLFW_VERSION_MINOR, - GLFW_VERSION_REVISION); - printf("GLFW library version: %u.%u.%u\n", major, minor, revision); - printf("GLFW library version string: \"%s\"\n", glfwGetVersionString()); -} - -static GLADapiproc glad_vulkan_callback(const char* name, void* user) -{ - return glfwGetInstanceProcAddress((VkInstance) user, name); -} - -int main(int argc, char** argv) -{ - int ch, client, major, minor, revision, profile; - GLint redbits, greenbits, bluebits, alphabits, depthbits, stencilbits; - int list_extensions = GLFW_FALSE, list_layers = GLFW_FALSE; - GLenum error; - GLFWwindow* window; - - enum { CLIENT, CONTEXT, BEHAVIOR, DEBUG_CONTEXT, FORWARD, HELP, - EXTENSIONS, LAYERS, - MAJOR, MINOR, PROFILE, ROBUSTNESS, VERSION, - REDBITS, GREENBITS, BLUEBITS, ALPHABITS, DEPTHBITS, STENCILBITS, - ACCUMREDBITS, ACCUMGREENBITS, ACCUMBLUEBITS, ACCUMALPHABITS, - AUXBUFFERS, SAMPLES, STEREO, SRGB, SINGLEBUFFER, NOERROR_SRSLY, - GRAPHICS_SWITCHING }; - const struct option options[] = - { - { "behavior", 1, NULL, BEHAVIOR }, - { "client-api", 1, NULL, CLIENT }, - { "context-api", 1, NULL, CONTEXT }, - { "debug", 0, NULL, DEBUG_CONTEXT }, - { "forward", 0, NULL, FORWARD }, - { "help", 0, NULL, HELP }, - { "list-extensions", 0, NULL, EXTENSIONS }, - { "list-layers", 0, NULL, LAYERS }, - { "major", 1, NULL, MAJOR }, - { "minor", 1, NULL, MINOR }, - { "profile", 1, NULL, PROFILE }, - { "robustness", 1, NULL, ROBUSTNESS }, - { "version", 0, NULL, VERSION }, - { "red-bits", 1, NULL, REDBITS }, - { "green-bits", 1, NULL, GREENBITS }, - { "blue-bits", 1, NULL, BLUEBITS }, - { "alpha-bits", 1, NULL, ALPHABITS }, - { "depth-bits", 1, NULL, DEPTHBITS }, - { "stencil-bits", 1, NULL, STENCILBITS }, - { "accum-red-bits", 1, NULL, ACCUMREDBITS }, - { "accum-green-bits", 1, NULL, ACCUMGREENBITS }, - { "accum-blue-bits", 1, NULL, ACCUMBLUEBITS }, - { "accum-alpha-bits", 1, NULL, ACCUMALPHABITS }, - { "aux-buffers", 1, NULL, AUXBUFFERS }, - { "samples", 1, NULL, SAMPLES }, - { "stereo", 0, NULL, STEREO }, - { "srgb", 0, NULL, SRGB }, - { "singlebuffer", 0, NULL, SINGLEBUFFER }, - { "no-error", 0, NULL, NOERROR_SRSLY }, - { "graphics-switching", 0, NULL, GRAPHICS_SWITCHING }, - { NULL, 0, NULL, 0 } - }; - - // Initialize GLFW and create window - - if (!valid_version()) - exit(EXIT_FAILURE); - - glfwSetErrorCallback(error_callback); - - glfwInitHint(GLFW_COCOA_MENUBAR, GLFW_FALSE); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - while ((ch = getopt_long(argc, argv, "a:b:c:dfhlm:n:p:s:v", options, NULL)) != -1) - { - switch (ch) - { - case 'a': - case CLIENT: - if (strcasecmp(optarg, API_NAME_OPENGL) == 0) - glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API); - else if (strcasecmp(optarg, API_NAME_OPENGL_ES) == 0) - glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); - else - { - usage(); - exit(EXIT_FAILURE); - } - break; - case 'b': - case BEHAVIOR: - if (strcasecmp(optarg, BEHAVIOR_NAME_NONE) == 0) - { - glfwWindowHint(GLFW_CONTEXT_RELEASE_BEHAVIOR, - GLFW_RELEASE_BEHAVIOR_NONE); - } - else if (strcasecmp(optarg, BEHAVIOR_NAME_FLUSH) == 0) - { - glfwWindowHint(GLFW_CONTEXT_RELEASE_BEHAVIOR, - GLFW_RELEASE_BEHAVIOR_FLUSH); - } - else - { - usage(); - exit(EXIT_FAILURE); - } - break; - case 'c': - case CONTEXT: - if (strcasecmp(optarg, API_NAME_NATIVE) == 0) - glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_NATIVE_CONTEXT_API); - else if (strcasecmp(optarg, API_NAME_EGL) == 0) - glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API); - else if (strcasecmp(optarg, API_NAME_OSMESA) == 0) - glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_OSMESA_CONTEXT_API); - else - { - usage(); - exit(EXIT_FAILURE); - } - break; - case 'd': - case DEBUG_CONTEXT: - glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE); - break; - case 'f': - case FORWARD: - glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); - break; - case 'h': - case HELP: - usage(); - exit(EXIT_SUCCESS); - case 'l': - case EXTENSIONS: - list_extensions = GLFW_TRUE; - break; - case LAYERS: - list_layers = GLFW_TRUE; - break; - case 'm': - case MAJOR: - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, atoi(optarg)); - break; - case 'n': - case MINOR: - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, atoi(optarg)); - break; - case 'p': - case PROFILE: - if (strcasecmp(optarg, PROFILE_NAME_CORE) == 0) - { - glfwWindowHint(GLFW_OPENGL_PROFILE, - GLFW_OPENGL_CORE_PROFILE); - } - else if (strcasecmp(optarg, PROFILE_NAME_COMPAT) == 0) - { - glfwWindowHint(GLFW_OPENGL_PROFILE, - GLFW_OPENGL_COMPAT_PROFILE); - } - else - { - usage(); - exit(EXIT_FAILURE); - } - break; - case 's': - case ROBUSTNESS: - if (strcasecmp(optarg, STRATEGY_NAME_NONE) == 0) - { - glfwWindowHint(GLFW_CONTEXT_ROBUSTNESS, - GLFW_NO_RESET_NOTIFICATION); - } - else if (strcasecmp(optarg, STRATEGY_NAME_LOSE) == 0) - { - glfwWindowHint(GLFW_CONTEXT_ROBUSTNESS, - GLFW_LOSE_CONTEXT_ON_RESET); - } - else - { - usage(); - exit(EXIT_FAILURE); - } - break; - case 'v': - case VERSION: - print_version(); - exit(EXIT_SUCCESS); - case REDBITS: - if (strcmp(optarg, "-") == 0) - glfwWindowHint(GLFW_RED_BITS, GLFW_DONT_CARE); - else - glfwWindowHint(GLFW_RED_BITS, atoi(optarg)); - break; - case GREENBITS: - if (strcmp(optarg, "-") == 0) - glfwWindowHint(GLFW_GREEN_BITS, GLFW_DONT_CARE); - else - glfwWindowHint(GLFW_GREEN_BITS, atoi(optarg)); - break; - case BLUEBITS: - if (strcmp(optarg, "-") == 0) - glfwWindowHint(GLFW_BLUE_BITS, GLFW_DONT_CARE); - else - glfwWindowHint(GLFW_BLUE_BITS, atoi(optarg)); - break; - case ALPHABITS: - if (strcmp(optarg, "-") == 0) - glfwWindowHint(GLFW_ALPHA_BITS, GLFW_DONT_CARE); - else - glfwWindowHint(GLFW_ALPHA_BITS, atoi(optarg)); - break; - case DEPTHBITS: - if (strcmp(optarg, "-") == 0) - glfwWindowHint(GLFW_DEPTH_BITS, GLFW_DONT_CARE); - else - glfwWindowHint(GLFW_DEPTH_BITS, atoi(optarg)); - break; - case STENCILBITS: - if (strcmp(optarg, "-") == 0) - glfwWindowHint(GLFW_STENCIL_BITS, GLFW_DONT_CARE); - else - glfwWindowHint(GLFW_STENCIL_BITS, atoi(optarg)); - break; - case ACCUMREDBITS: - if (strcmp(optarg, "-") == 0) - glfwWindowHint(GLFW_ACCUM_RED_BITS, GLFW_DONT_CARE); - else - glfwWindowHint(GLFW_ACCUM_RED_BITS, atoi(optarg)); - break; - case ACCUMGREENBITS: - if (strcmp(optarg, "-") == 0) - glfwWindowHint(GLFW_ACCUM_GREEN_BITS, GLFW_DONT_CARE); - else - glfwWindowHint(GLFW_ACCUM_GREEN_BITS, atoi(optarg)); - break; - case ACCUMBLUEBITS: - if (strcmp(optarg, "-") == 0) - glfwWindowHint(GLFW_ACCUM_BLUE_BITS, GLFW_DONT_CARE); - else - glfwWindowHint(GLFW_ACCUM_BLUE_BITS, atoi(optarg)); - break; - case ACCUMALPHABITS: - if (strcmp(optarg, "-") == 0) - glfwWindowHint(GLFW_ACCUM_ALPHA_BITS, GLFW_DONT_CARE); - else - glfwWindowHint(GLFW_ACCUM_ALPHA_BITS, atoi(optarg)); - break; - case AUXBUFFERS: - if (strcmp(optarg, "-") == 0) - glfwWindowHint(GLFW_AUX_BUFFERS, GLFW_DONT_CARE); - else - glfwWindowHint(GLFW_AUX_BUFFERS, atoi(optarg)); - break; - case SAMPLES: - if (strcmp(optarg, "-") == 0) - glfwWindowHint(GLFW_SAMPLES, GLFW_DONT_CARE); - else - glfwWindowHint(GLFW_SAMPLES, atoi(optarg)); - break; - case STEREO: - glfwWindowHint(GLFW_STEREO, GLFW_TRUE); - break; - case SRGB: - glfwWindowHint(GLFW_SRGB_CAPABLE, GLFW_TRUE); - break; - case SINGLEBUFFER: - glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_FALSE); - break; - case NOERROR_SRSLY: - glfwWindowHint(GLFW_CONTEXT_NO_ERROR, GLFW_TRUE); - break; - case GRAPHICS_SWITCHING: - glfwWindowHint(GLFW_COCOA_GRAPHICS_SWITCHING, GLFW_TRUE); - break; - default: - usage(); - exit(EXIT_FAILURE); - } - } - - print_version(); - - glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); - - window = glfwCreateWindow(200, 200, "Version", NULL, NULL); - if (!window) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - - error = glGetError(); - if (error != GL_NO_ERROR) - printf("*** OpenGL error after make current: 0x%08x ***\n", error); - - // Report client API version - - client = glfwGetWindowAttrib(window, GLFW_CLIENT_API); - major = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MAJOR); - minor = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MINOR); - revision = glfwGetWindowAttrib(window, GLFW_CONTEXT_REVISION); - profile = glfwGetWindowAttrib(window, GLFW_OPENGL_PROFILE); - - printf("%s context version string: \"%s\"\n", - get_api_name(client), - glGetString(GL_VERSION)); - - printf("%s context version parsed by GLFW: %u.%u.%u\n", - get_api_name(client), - major, minor, revision); - - // Report client API context properties - - if (client == GLFW_OPENGL_API) - { - if (major >= 3) - { - GLint flags; - - glGetIntegerv(GL_CONTEXT_FLAGS, &flags); - printf("%s context flags (0x%08x):", get_api_name(client), flags); - - if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) - printf(" forward-compatible"); - if (flags & 2/*GL_CONTEXT_FLAG_DEBUG_BIT*/) - printf(" debug"); - if (flags & GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB) - printf(" robustness"); - if (flags & 8/*GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR*/) - printf(" no-error"); - putchar('\n'); - - printf("%s context flags parsed by GLFW:", get_api_name(client)); - - if (glfwGetWindowAttrib(window, GLFW_OPENGL_FORWARD_COMPAT)) - printf(" forward-compatible"); - if (glfwGetWindowAttrib(window, GLFW_OPENGL_DEBUG_CONTEXT)) - printf(" debug"); - if (glfwGetWindowAttrib(window, GLFW_CONTEXT_ROBUSTNESS) == GLFW_LOSE_CONTEXT_ON_RESET) - printf(" robustness"); - if (glfwGetWindowAttrib(window, GLFW_CONTEXT_NO_ERROR)) - printf(" no-error"); - putchar('\n'); - } - - if (major >= 4 || (major == 3 && minor >= 2)) - { - GLint mask; - glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask); - - printf("%s profile mask (0x%08x): %s\n", - get_api_name(client), - mask, - get_profile_name_gl(mask)); - - printf("%s profile mask parsed by GLFW: %s\n", - get_api_name(client), - get_profile_name_glfw(profile)); - } - - if (GLAD_GL_ARB_robustness) - { - const int robustness = glfwGetWindowAttrib(window, GLFW_CONTEXT_ROBUSTNESS); - GLint strategy; - glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy); - - printf("%s robustness strategy (0x%08x): %s\n", - get_api_name(client), - strategy, - get_strategy_name_gl(strategy)); - - printf("%s robustness strategy parsed by GLFW: %s\n", - get_api_name(client), - get_strategy_name_glfw(robustness)); - } - } - - printf("%s context renderer string: \"%s\"\n", - get_api_name(client), - glGetString(GL_RENDERER)); - printf("%s context vendor string: \"%s\"\n", - get_api_name(client), - glGetString(GL_VENDOR)); - - if (major >= 2) - { - printf("%s context shading language version: \"%s\"\n", - get_api_name(client), - glGetString(GL_SHADING_LANGUAGE_VERSION)); - } - - printf("%s framebuffer:\n", get_api_name(client)); - - if (client == GLFW_OPENGL_API && profile == GLFW_OPENGL_CORE_PROFILE) - { - glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, - GL_BACK_LEFT, - GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, - &redbits); - glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, - GL_BACK_LEFT, - GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, - &greenbits); - glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, - GL_BACK_LEFT, - GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, - &bluebits); - glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, - GL_BACK_LEFT, - GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, - &alphabits); - glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, - GL_DEPTH, - GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, - &depthbits); - glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, - GL_STENCIL, - GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, - &stencilbits); - } - else - { - glGetIntegerv(GL_RED_BITS, &redbits); - glGetIntegerv(GL_GREEN_BITS, &greenbits); - glGetIntegerv(GL_BLUE_BITS, &bluebits); - glGetIntegerv(GL_ALPHA_BITS, &alphabits); - glGetIntegerv(GL_DEPTH_BITS, &depthbits); - glGetIntegerv(GL_STENCIL_BITS, &stencilbits); - } - - printf(" red: %u green: %u blue: %u alpha: %u depth: %u stencil: %u\n", - redbits, greenbits, bluebits, alphabits, depthbits, stencilbits); - - if (client == GLFW_OPENGL_ES_API || - GLAD_GL_ARB_multisample || - major > 1 || minor >= 3) - { - GLint samples, samplebuffers; - glGetIntegerv(GL_SAMPLES, &samples); - glGetIntegerv(GL_SAMPLE_BUFFERS, &samplebuffers); - - printf(" samples: %u sample buffers: %u\n", samples, samplebuffers); - } - - if (client == GLFW_OPENGL_API && profile != GLFW_OPENGL_CORE_PROFILE) - { - GLint accumredbits, accumgreenbits, accumbluebits, accumalphabits; - GLint auxbuffers; - - glGetIntegerv(GL_ACCUM_RED_BITS, &accumredbits); - glGetIntegerv(GL_ACCUM_GREEN_BITS, &accumgreenbits); - glGetIntegerv(GL_ACCUM_BLUE_BITS, &accumbluebits); - glGetIntegerv(GL_ACCUM_ALPHA_BITS, &accumalphabits); - glGetIntegerv(GL_AUX_BUFFERS, &auxbuffers); - - printf(" accum red: %u accum green: %u accum blue: %u accum alpha: %u aux buffers: %u\n", - accumredbits, accumgreenbits, accumbluebits, accumalphabits, auxbuffers); - } - - if (list_extensions) - list_context_extensions(client, major, minor); - - printf("Vulkan loader: %s\n", - glfwVulkanSupported() ? "available" : "missing"); - - if (glfwVulkanSupported()) - { - uint32_t loader_version = VK_API_VERSION_1_0; - uint32_t i, re_count, pd_count; - const char** re; - VkApplicationInfo ai = {0}; - VkInstanceCreateInfo ici = {0}; - VkInstance instance; - VkPhysicalDevice* pd; - - gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, NULL); - - if (vkEnumerateInstanceVersion) - { - uint32_t version; - if (vkEnumerateInstanceVersion(&version) == VK_SUCCESS) - loader_version = version; - } - - printf("Vulkan loader API version: %i.%i\n", - VK_VERSION_MAJOR(loader_version), - VK_VERSION_MINOR(loader_version)); - - re = glfwGetRequiredInstanceExtensions(&re_count); - - printf("Vulkan required instance extensions:"); - if (re) - { - for (i = 0; i < re_count; i++) - printf(" %s", re[i]); - putchar('\n'); - } - else - printf(" missing\n"); - - if (list_extensions) - list_vulkan_instance_extensions(); - - if (list_layers) - list_vulkan_instance_layers(); - - ai.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; - ai.pApplicationName = "glfwinfo"; - ai.applicationVersion = VK_MAKE_VERSION(GLFW_VERSION_MAJOR, - GLFW_VERSION_MINOR, - GLFW_VERSION_REVISION); - - if (loader_version >= VK_API_VERSION_1_1) - ai.apiVersion = VK_API_VERSION_1_1; - else - ai.apiVersion = VK_API_VERSION_1_0; - - ici.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; - ici.pApplicationInfo = &ai; - ici.enabledExtensionCount = re_count; - ici.ppEnabledExtensionNames = re; - - if (vkCreateInstance(&ici, NULL, &instance) != VK_SUCCESS) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, instance); - - if (vkEnumeratePhysicalDevices(instance, &pd_count, NULL) != VK_SUCCESS) - { - vkDestroyInstance(instance, NULL); - glfwTerminate(); - exit(EXIT_FAILURE); - } - - pd = calloc(pd_count, sizeof(VkPhysicalDevice)); - - if (vkEnumeratePhysicalDevices(instance, &pd_count, pd) != VK_SUCCESS) - { - free(pd); - vkDestroyInstance(instance, NULL); - glfwTerminate(); - exit(EXIT_FAILURE); - } - - for (i = 0; i < pd_count; i++) - { - VkPhysicalDeviceProperties pdp; - - vkGetPhysicalDeviceProperties(pd[i], &pdp); - - printf("Vulkan %s device: \"%s\" API version %i.%i\n", - get_device_type_name(pdp.deviceType), - pdp.deviceName, - VK_VERSION_MAJOR(pdp.apiVersion), - VK_VERSION_MINOR(pdp.apiVersion)); - - if (list_extensions) - list_vulkan_device_extensions(instance, pd[i]); - - if (list_layers) - list_vulkan_device_layers(instance, pd[i]); - } - - free(pd); - vkDestroyInstance(instance, NULL); - } - - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/tests/icon.c b/third_party/penumbra/vendor/glfw/tests/icon.c deleted file mode 100644 index aa7ee18174f..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/icon.c +++ /dev/null @@ -1,149 +0,0 @@ -//======================================================================== -// Window icon test program -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// -// This program is used to test the icon feature. -// -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#include -#include -#include - -// a simple glfw logo -const char* const logo[] = -{ - "................", - "................", - "...0000..0......", - "...0.....0......", - "...0.00..0......", - "...0..0..0......", - "...0000..0000...", - "................", - "................", - "...000..0...0...", - "...0....0...0...", - "...000..0.0.0...", - "...0....0.0.0...", - "...0....00000...", - "................", - "................" -}; - -const unsigned char icon_colors[5][4] = -{ - { 0, 0, 0, 255 }, // black - { 255, 0, 0, 255 }, // red - { 0, 255, 0, 255 }, // green - { 0, 0, 255, 255 }, // blue - { 255, 255, 255, 255 } // white -}; - -static int cur_icon_color = 0; - -static void set_icon(GLFWwindow* window, int icon_color) -{ - int x, y; - unsigned char pixels[16 * 16 * 4]; - unsigned char* target = pixels; - GLFWimage img = { 16, 16, pixels }; - - for (y = 0; y < img.width; y++) - { - for (x = 0; x < img.height; x++) - { - if (logo[y][x] == '0') - memcpy(target, icon_colors[icon_color], 4); - else - memset(target, 0, 4); - - target += 4; - } - } - - glfwSetWindowIcon(window, 1, &img); -} - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (action != GLFW_PRESS) - return; - - switch (key) - { - case GLFW_KEY_ESCAPE: - glfwSetWindowShouldClose(window, GLFW_TRUE); - break; - case GLFW_KEY_SPACE: - cur_icon_color = (cur_icon_color + 1) % 5; - set_icon(window, cur_icon_color); - break; - case GLFW_KEY_X: - glfwSetWindowIcon(window, 0, NULL); - break; - } -} - -int main(int argc, char** argv) -{ - GLFWwindow* window; - - if (!glfwInit()) - { - fprintf(stderr, "Failed to initialize GLFW\n"); - exit(EXIT_FAILURE); - } - - window = glfwCreateWindow(200, 200, "Window Icon", NULL, NULL); - if (!window) - { - glfwTerminate(); - - fprintf(stderr, "Failed to open GLFW window\n"); - exit(EXIT_FAILURE); - } - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - - glfwSetKeyCallback(window, key_callback); - set_icon(window, cur_icon_color); - - while (!glfwWindowShouldClose(window)) - { - glClear(GL_COLOR_BUFFER_BIT); - glfwSwapBuffers(window); - glfwWaitEvents(); - } - - glfwDestroyWindow(window); - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/tests/iconify.c b/third_party/penumbra/vendor/glfw/tests/iconify.c deleted file mode 100644 index ff446d2d8c3..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/iconify.c +++ /dev/null @@ -1,297 +0,0 @@ -//======================================================================== -// Iconify/restore test program -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// -// This program is used to test the iconify/restore functionality for -// both full screen and windowed mode windows -// -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#include -#include - -#include "getopt.h" - -static int windowed_xpos, windowed_ypos, windowed_width, windowed_height; - -static void usage(void) -{ - printf("Usage: iconify [-h] [-f [-a] [-n]]\n"); - printf("Options:\n"); - printf(" -a create windows for all monitors\n"); - printf(" -f create full screen window(s)\n"); - printf(" -h show this help\n"); -} - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - printf("%0.2f Key %s\n", - glfwGetTime(), - action == GLFW_PRESS ? "pressed" : "released"); - - if (action != GLFW_PRESS) - return; - - switch (key) - { - case GLFW_KEY_I: - glfwIconifyWindow(window); - break; - case GLFW_KEY_M: - glfwMaximizeWindow(window); - break; - case GLFW_KEY_R: - glfwRestoreWindow(window); - break; - case GLFW_KEY_ESCAPE: - glfwSetWindowShouldClose(window, GLFW_TRUE); - break; - case GLFW_KEY_A: - glfwSetWindowAttrib(window, GLFW_AUTO_ICONIFY, !glfwGetWindowAttrib(window, GLFW_AUTO_ICONIFY)); - break; - case GLFW_KEY_B: - glfwSetWindowAttrib(window, GLFW_RESIZABLE, !glfwGetWindowAttrib(window, GLFW_RESIZABLE)); - break; - case GLFW_KEY_D: - glfwSetWindowAttrib(window, GLFW_DECORATED, !glfwGetWindowAttrib(window, GLFW_DECORATED)); - break; - case GLFW_KEY_F: - glfwSetWindowAttrib(window, GLFW_FLOATING, !glfwGetWindowAttrib(window, GLFW_FLOATING)); - break; - case GLFW_KEY_F11: - case GLFW_KEY_ENTER: - { - if (mods != GLFW_MOD_ALT) - return; - - if (glfwGetWindowMonitor(window)) - { - glfwSetWindowMonitor(window, NULL, - windowed_xpos, windowed_ypos, - windowed_width, windowed_height, - 0); - } - else - { - GLFWmonitor* monitor = glfwGetPrimaryMonitor(); - if (monitor) - { - const GLFWvidmode* mode = glfwGetVideoMode(monitor); - glfwGetWindowPos(window, &windowed_xpos, &windowed_ypos); - glfwGetWindowSize(window, &windowed_width, &windowed_height); - glfwSetWindowMonitor(window, monitor, - 0, 0, mode->width, mode->height, - mode->refreshRate); - } - } - - break; - } - } -} - -static void window_size_callback(GLFWwindow* window, int width, int height) -{ - printf("%0.2f Window resized to %ix%i\n", glfwGetTime(), width, height); -} - -static void framebuffer_size_callback(GLFWwindow* window, int width, int height) -{ - printf("%0.2f Framebuffer resized to %ix%i\n", glfwGetTime(), width, height); -} - -static void window_focus_callback(GLFWwindow* window, int focused) -{ - printf("%0.2f Window %s\n", - glfwGetTime(), - focused ? "focused" : "defocused"); -} - -static void window_iconify_callback(GLFWwindow* window, int iconified) -{ - printf("%0.2f Window %s\n", - glfwGetTime(), - iconified ? "iconified" : "uniconified"); -} - -static void window_maximize_callback(GLFWwindow* window, int maximized) -{ - printf("%0.2f Window %s\n", - glfwGetTime(), - maximized ? "maximized" : "unmaximized"); -} - -static void window_refresh_callback(GLFWwindow* window) -{ - printf("%0.2f Window refresh\n", glfwGetTime()); - - glfwMakeContextCurrent(window); - - glClear(GL_COLOR_BUFFER_BIT); - glfwSwapBuffers(window); -} - -static GLFWwindow* create_window(GLFWmonitor* monitor) -{ - int width, height; - GLFWwindow* window; - - if (monitor) - { - const GLFWvidmode* mode = glfwGetVideoMode(monitor); - - glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate); - glfwWindowHint(GLFW_RED_BITS, mode->redBits); - glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); - glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits); - - width = mode->width; - height = mode->height; - } - else - { - width = 640; - height = 480; - } - - window = glfwCreateWindow(width, height, "Iconify", monitor, NULL); - if (!window) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - - return window; -} - -int main(int argc, char** argv) -{ - int ch, i, window_count; - int fullscreen = GLFW_FALSE, all_monitors = GLFW_FALSE; - GLFWwindow** windows; - - while ((ch = getopt(argc, argv, "afhn")) != -1) - { - switch (ch) - { - case 'a': - all_monitors = GLFW_TRUE; - break; - - case 'h': - usage(); - exit(EXIT_SUCCESS); - - case 'f': - fullscreen = GLFW_TRUE; - break; - - default: - usage(); - exit(EXIT_FAILURE); - } - } - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - if (fullscreen && all_monitors) - { - int monitor_count; - GLFWmonitor** monitors = glfwGetMonitors(&monitor_count); - - window_count = monitor_count; - windows = calloc(window_count, sizeof(GLFWwindow*)); - - for (i = 0; i < monitor_count; i++) - { - windows[i] = create_window(monitors[i]); - if (!windows[i]) - break; - } - } - else - { - GLFWmonitor* monitor = NULL; - - if (fullscreen) - monitor = glfwGetPrimaryMonitor(); - - window_count = 1; - windows = calloc(window_count, sizeof(GLFWwindow*)); - windows[0] = create_window(monitor); - } - - for (i = 0; i < window_count; i++) - { - glfwSetKeyCallback(windows[i], key_callback); - glfwSetFramebufferSizeCallback(windows[i], framebuffer_size_callback); - glfwSetWindowSizeCallback(windows[i], window_size_callback); - glfwSetWindowFocusCallback(windows[i], window_focus_callback); - glfwSetWindowIconifyCallback(windows[i], window_iconify_callback); - glfwSetWindowMaximizeCallback(windows[i], window_maximize_callback); - glfwSetWindowRefreshCallback(windows[i], window_refresh_callback); - - window_refresh_callback(windows[i]); - - printf("Window is %s and %s\n", - glfwGetWindowAttrib(windows[i], GLFW_ICONIFIED) ? "iconified" : "restored", - glfwGetWindowAttrib(windows[i], GLFW_FOCUSED) ? "focused" : "defocused"); - } - - for (;;) - { - glfwWaitEvents(); - - for (i = 0; i < window_count; i++) - { - if (glfwWindowShouldClose(windows[i])) - break; - } - - if (i < window_count) - break; - - // Workaround for an issue with msvcrt and mintty - fflush(stdout); - } - - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/tests/inputlag.c b/third_party/penumbra/vendor/glfw/tests/inputlag.c deleted file mode 100644 index 269a0c8f979..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/inputlag.c +++ /dev/null @@ -1,308 +0,0 @@ -//======================================================================== -// Input lag test -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// -// This test renders a marker at the cursor position reported by GLFW to -// check how much it lags behind the hardware mouse cursor -// -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#define NK_IMPLEMENTATION -#define NK_INCLUDE_FIXED_TYPES -#define NK_INCLUDE_FONT_BAKING -#define NK_INCLUDE_DEFAULT_FONT -#define NK_INCLUDE_DEFAULT_ALLOCATOR -#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT -#define NK_INCLUDE_STANDARD_VARARGS -#include - -#define NK_GLFW_GL2_IMPLEMENTATION -#include - -#include -#include -#include - -#include "getopt.h" - -void usage(void) -{ - printf("Usage: inputlag [-h] [-f]\n"); - printf("Options:\n"); - printf(" -f create full screen window\n"); - printf(" -h show this help\n"); -} - -struct nk_vec2 cursor_new, cursor_pos, cursor_vel; -enum { cursor_sync_query, cursor_input_message } cursor_method = cursor_sync_query; - -void sample_input(GLFWwindow* window) -{ - float a = .25; // exponential smoothing factor - - if (cursor_method == cursor_sync_query) { - double x, y; - glfwGetCursorPos(window, &x, &y); - cursor_new.x = (float) x; - cursor_new.y = (float) y; - } - - cursor_vel.x = (cursor_new.x - cursor_pos.x) * a + cursor_vel.x * (1 - a); - cursor_vel.y = (cursor_new.y - cursor_pos.y) * a + cursor_vel.y * (1 - a); - cursor_pos = cursor_new; -} - -void cursor_pos_callback(GLFWwindow* window, double xpos, double ypos) -{ - cursor_new.x = (float) xpos; - cursor_new.y = (float) ypos; -} - -int enable_vsync = nk_true; - -void update_vsync() -{ - glfwSwapInterval(enable_vsync == nk_true ? 1 : 0); -} - -int swap_clear = nk_false; -int swap_finish = nk_true; -int swap_occlusion_query = nk_false; -int swap_read_pixels = nk_false; -GLuint occlusion_query; - -void swap_buffers(GLFWwindow* window) -{ - glfwSwapBuffers(window); - - if (swap_clear) - glClear(GL_COLOR_BUFFER_BIT); - - if (swap_finish) - glFinish(); - - if (swap_occlusion_query) { - GLint occlusion_result; - if (!occlusion_query) - glGenQueries(1, &occlusion_query); - glBeginQuery(GL_SAMPLES_PASSED, occlusion_query); - glBegin(GL_POINTS); - glVertex2f(0, 0); - glEnd(); - glEndQuery(GL_SAMPLES_PASSED); - glGetQueryObjectiv(occlusion_query, GL_QUERY_RESULT, &occlusion_result); - } - - if (swap_read_pixels) { - unsigned char rgba[4]; - glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, rgba); - } -} - -void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (action != GLFW_PRESS) - return; - - switch (key) - { - case GLFW_KEY_ESCAPE: - glfwSetWindowShouldClose(window, 1); - break; - } -} - -void draw_marker(struct nk_command_buffer* canvas, int lead, struct nk_vec2 pos) -{ - struct nk_color colors[4] = { nk_rgb(255,0,0), nk_rgb(255,255,0), nk_rgb(0,255,0), nk_rgb(0,96,255) }; - struct nk_rect rect = { -5 + pos.x, -5 + pos.y, 10, 10 }; - nk_fill_circle(canvas, rect, colors[lead]); -} - -int main(int argc, char** argv) -{ - int ch, width, height; - unsigned long frame_count = 0; - double last_time, current_time; - double frame_rate = 0; - int fullscreen = GLFW_FALSE; - GLFWmonitor* monitor = NULL; - GLFWwindow* window; - struct nk_context* nk; - struct nk_font_atlas* atlas; - - int show_forecasts = nk_true; - - while ((ch = getopt(argc, argv, "fh")) != -1) - { - switch (ch) - { - case 'h': - usage(); - exit(EXIT_SUCCESS); - - case 'f': - fullscreen = GLFW_TRUE; - break; - } - } - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - if (fullscreen) - { - const GLFWvidmode* mode; - - monitor = glfwGetPrimaryMonitor(); - mode = glfwGetVideoMode(monitor); - - width = mode->width; - height = mode->height; - } - else - { - width = 640; - height = 480; - } - - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); - - glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); - - window = glfwCreateWindow(width, height, "Input lag test", monitor, NULL); - if (!window) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - update_vsync(); - - last_time = glfwGetTime(); - - nk = nk_glfw3_init(window, NK_GLFW3_INSTALL_CALLBACKS); - nk_glfw3_font_stash_begin(&atlas); - nk_glfw3_font_stash_end(); - - glfwSetKeyCallback(window, key_callback); - glfwSetCursorPosCallback(window, cursor_pos_callback); - - while (!glfwWindowShouldClose(window)) - { - int width, height; - struct nk_rect area; - - glfwPollEvents(); - sample_input(window); - - glfwGetWindowSize(window, &width, &height); - area = nk_rect(0.f, 0.f, (float) width, (float) height); - - glClear(GL_COLOR_BUFFER_BIT); - nk_glfw3_new_frame(); - if (nk_begin(nk, "", area, 0)) - { - nk_flags align_left = NK_TEXT_ALIGN_LEFT | NK_TEXT_ALIGN_MIDDLE; - struct nk_command_buffer *canvas = nk_window_get_canvas(nk); - int lead; - - for (lead = show_forecasts ? 3 : 0; lead >= 0; lead--) - draw_marker(canvas, lead, nk_vec2(cursor_pos.x + cursor_vel.x * lead, - cursor_pos.y + cursor_vel.y * lead)); - - // print instructions - nk_layout_row_dynamic(nk, 20, 1); - nk_label(nk, "Move mouse uniformly and check marker under cursor:", align_left); - for (lead = 0; lead <= 3; lead++) { - nk_layout_row_begin(nk, NK_STATIC, 12, 2); - nk_layout_row_push(nk, 25); - draw_marker(canvas, lead, nk_layout_space_to_screen(nk, nk_vec2(20, 5))); - nk_label(nk, "", 0); - nk_layout_row_push(nk, 500); - if (lead == 0) - nk_label(nk, "- current cursor position (no input lag)", align_left); - else - nk_labelf(nk, align_left, "- %d-frame forecast (input lag is %d frame)", lead, lead); - nk_layout_row_end(nk); - } - - nk_layout_row_dynamic(nk, 20, 1); - - nk_checkbox_label(nk, "Show forecasts", &show_forecasts); - nk_label(nk, "Input method:", align_left); - if (nk_option_label(nk, "glfwGetCursorPos (sync query)", cursor_method == cursor_sync_query)) - cursor_method = cursor_sync_query; - if (nk_option_label(nk, "glfwSetCursorPosCallback (latest input message)", cursor_method == cursor_input_message)) - cursor_method = cursor_input_message; - - nk_label(nk, "", 0); // separator - - nk_value_float(nk, "FPS", (float) frame_rate); - if (nk_checkbox_label(nk, "Enable vsync", &enable_vsync)) - update_vsync(); - - nk_label(nk, "", 0); // separator - - nk_label(nk, "After swap:", align_left); - nk_checkbox_label(nk, "glClear", &swap_clear); - nk_checkbox_label(nk, "glFinish", &swap_finish); - nk_checkbox_label(nk, "draw with occlusion query", &swap_occlusion_query); - nk_checkbox_label(nk, "glReadPixels", &swap_read_pixels); - } - - nk_end(nk); - nk_glfw3_render(NK_ANTI_ALIASING_ON); - - swap_buffers(window); - - frame_count++; - - current_time = glfwGetTime(); - if (current_time - last_time > 1.0) - { - frame_rate = frame_count / (current_time - last_time); - frame_count = 0; - last_time = current_time; - } - } - - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/tests/joysticks.c b/third_party/penumbra/vendor/glfw/tests/joysticks.c deleted file mode 100644 index 8eae021e4b9..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/joysticks.c +++ /dev/null @@ -1,344 +0,0 @@ -//======================================================================== -// Joystick input test -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// -// This test displays the state of every button and axis of every connected -// joystick and/or gamepad -// -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#define NK_IMPLEMENTATION -#define NK_INCLUDE_FIXED_TYPES -#define NK_INCLUDE_FONT_BAKING -#define NK_INCLUDE_DEFAULT_FONT -#define NK_INCLUDE_DEFAULT_ALLOCATOR -#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT -#define NK_INCLUDE_STANDARD_VARARGS -#define NK_BUTTON_TRIGGER_ON_RELEASE -#include - -#define NK_GLFW_GL2_IMPLEMENTATION -#include - -#include -#include -#include - -#ifdef _MSC_VER -#define strdup(x) _strdup(x) -#endif - -static GLFWwindow* window; -static int joysticks[GLFW_JOYSTICK_LAST + 1]; -static int joystick_count = 0; - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -static void joystick_callback(int jid, int event) -{ - if (event == GLFW_CONNECTED) - joysticks[joystick_count++] = jid; - else if (event == GLFW_DISCONNECTED) - { - int i; - - for (i = 0; i < joystick_count; i++) - { - if (joysticks[i] == jid) - break; - } - - for (i = i + 1; i < joystick_count; i++) - joysticks[i - 1] = joysticks[i]; - - joystick_count--; - } - - if (!glfwGetWindowAttrib(window, GLFW_FOCUSED)) - glfwRequestWindowAttention(window); -} - -static void drop_callback(GLFWwindow* window, int count, const char* paths[]) -{ - int i; - - for (i = 0; i < count; i++) - { - long size; - char* text; - FILE* stream = fopen(paths[i], "rb"); - if (!stream) - continue; - - fseek(stream, 0, SEEK_END); - size = ftell(stream); - fseek(stream, 0, SEEK_SET); - - text = malloc(size + 1); - text[size] = '\0'; - if (fread(text, 1, size, stream) == size) - glfwUpdateGamepadMappings(text); - - free(text); - fclose(stream); - } -} - -static const char* joystick_label(int jid) -{ - static char label[1024]; - snprintf(label, sizeof(label), "%i: %s", jid + 1, glfwGetJoystickName(jid)); - return label; -} - -static void hat_widget(struct nk_context* nk, unsigned char state) -{ - float radius; - struct nk_rect area; - struct nk_vec2 center; - - if (nk_widget(&area, nk) == NK_WIDGET_INVALID) - return; - - center = nk_vec2(area.x + area.w / 2.f, area.y + area.h / 2.f); - radius = NK_MIN(area.w, area.h) / 2.f; - - nk_stroke_circle(nk_window_get_canvas(nk), - nk_rect(center.x - radius, - center.y - radius, - radius * 2.f, - radius * 2.f), - 1.f, - nk_rgb(175, 175, 175)); - - if (state) - { - const float angles[] = - { - 0.f, 0.f, - NK_PI * 1.5f, NK_PI * 1.75f, - NK_PI, 0.f, - NK_PI * 1.25f, 0.f, - NK_PI * 0.5f, NK_PI * 0.25f, - 0.f, 0.f, - NK_PI * 0.75f, 0.f, - }; - const float cosa = nk_cos(angles[state]); - const float sina = nk_sin(angles[state]); - const struct nk_vec2 p0 = nk_vec2(0.f, -radius); - const struct nk_vec2 p1 = nk_vec2( radius / 2.f, -radius / 3.f); - const struct nk_vec2 p2 = nk_vec2(-radius / 2.f, -radius / 3.f); - - nk_fill_triangle(nk_window_get_canvas(nk), - center.x + cosa * p0.x + sina * p0.y, - center.y + cosa * p0.y - sina * p0.x, - center.x + cosa * p1.x + sina * p1.y, - center.y + cosa * p1.y - sina * p1.x, - center.x + cosa * p2.x + sina * p2.y, - center.y + cosa * p2.y - sina * p2.x, - nk_rgb(175, 175, 175)); - } -} - -int main(void) -{ - int jid, hat_buttons = GLFW_FALSE; - struct nk_context* nk; - struct nk_font_atlas* atlas; - - memset(joysticks, 0, sizeof(joysticks)); - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); - - window = glfwCreateWindow(800, 600, "Joystick Test", NULL, NULL); - if (!window) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - glfwSwapInterval(1); - - nk = nk_glfw3_init(window, NK_GLFW3_INSTALL_CALLBACKS); - nk_glfw3_font_stash_begin(&atlas); - nk_glfw3_font_stash_end(); - - for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++) - { - if (glfwJoystickPresent(jid)) - joysticks[joystick_count++] = jid; - } - - glfwSetJoystickCallback(joystick_callback); - glfwSetDropCallback(window, drop_callback); - - while (!glfwWindowShouldClose(window)) - { - int i, width, height; - - glfwGetWindowSize(window, &width, &height); - - glClear(GL_COLOR_BUFFER_BIT); - nk_glfw3_new_frame(); - - if (nk_begin(nk, - "Joysticks", - nk_rect(width - 200.f, 0.f, 200.f, (float) height), - NK_WINDOW_MINIMIZABLE | - NK_WINDOW_TITLE)) - { - nk_layout_row_dynamic(nk, 30, 1); - - nk_checkbox_label(nk, "Hat buttons", &hat_buttons); - - if (joystick_count) - { - for (i = 0; i < joystick_count; i++) - { - if (nk_button_label(nk, joystick_label(joysticks[i]))) - nk_window_set_focus(nk, joystick_label(joysticks[i])); - } - } - else - nk_label(nk, "No joysticks connected", NK_TEXT_LEFT); - } - - nk_end(nk); - - for (i = 0; i < joystick_count; i++) - { - if (nk_begin(nk, - joystick_label(joysticks[i]), - nk_rect(i * 20.f, i * 20.f, 550.f, 570.f), - NK_WINDOW_BORDER | - NK_WINDOW_MOVABLE | - NK_WINDOW_SCALABLE | - NK_WINDOW_MINIMIZABLE | - NK_WINDOW_TITLE)) - { - int j, axis_count, button_count, hat_count; - const float* axes; - const unsigned char* buttons; - const unsigned char* hats; - GLFWgamepadstate state; - - nk_layout_row_dynamic(nk, 30, 1); - nk_labelf(nk, NK_TEXT_LEFT, "Hardware GUID %s", - glfwGetJoystickGUID(joysticks[i])); - nk_label(nk, "Joystick state", NK_TEXT_LEFT); - - axes = glfwGetJoystickAxes(joysticks[i], &axis_count); - buttons = glfwGetJoystickButtons(joysticks[i], &button_count); - hats = glfwGetJoystickHats(joysticks[i], &hat_count); - - if (!hat_buttons) - button_count -= hat_count * 4; - - for (j = 0; j < axis_count; j++) - nk_slide_float(nk, -1.f, axes[j], 1.f, 0.1f); - - nk_layout_row_dynamic(nk, 30, 12); - - for (j = 0; j < button_count; j++) - { - char name[16]; - snprintf(name, sizeof(name), "%i", j + 1); - nk_select_label(nk, name, NK_TEXT_CENTERED, buttons[j]); - } - - nk_layout_row_dynamic(nk, 30, 8); - - for (j = 0; j < hat_count; j++) - hat_widget(nk, hats[j]); - - nk_layout_row_dynamic(nk, 30, 1); - - if (glfwGetGamepadState(joysticks[i], &state)) - { - int hat = 0; - const char* names[GLFW_GAMEPAD_BUTTON_LAST + 1 - 4] = - { - "A", "B", "X", "Y", - "LB", "RB", - "Back", "Start", "Guide", - "LT", "RT", - }; - - nk_labelf(nk, NK_TEXT_LEFT, - "Gamepad state: %s", - glfwGetGamepadName(joysticks[i])); - - nk_layout_row_dynamic(nk, 30, 2); - - for (j = 0; j <= GLFW_GAMEPAD_AXIS_LAST; j++) - nk_slide_float(nk, -1.f, state.axes[j], 1.f, 0.1f); - - nk_layout_row_dynamic(nk, 30, GLFW_GAMEPAD_BUTTON_LAST + 1 - 4); - - for (j = 0; j <= GLFW_GAMEPAD_BUTTON_LAST - 4; j++) - nk_select_label(nk, names[j], NK_TEXT_CENTERED, state.buttons[j]); - - if (state.buttons[GLFW_GAMEPAD_BUTTON_DPAD_UP]) - hat |= GLFW_HAT_UP; - if (state.buttons[GLFW_GAMEPAD_BUTTON_DPAD_RIGHT]) - hat |= GLFW_HAT_RIGHT; - if (state.buttons[GLFW_GAMEPAD_BUTTON_DPAD_DOWN]) - hat |= GLFW_HAT_DOWN; - if (state.buttons[GLFW_GAMEPAD_BUTTON_DPAD_LEFT]) - hat |= GLFW_HAT_LEFT; - - nk_layout_row_dynamic(nk, 30, 8); - hat_widget(nk, hat); - } - else - nk_label(nk, "Joystick has no gamepad mapping", NK_TEXT_LEFT); - } - - nk_end(nk); - } - - nk_glfw3_render(NK_ANTI_ALIASING_ON); - - glfwSwapBuffers(window); - glfwPollEvents(); - } - - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/tests/monitors.c b/third_party/penumbra/vendor/glfw/tests/monitors.c deleted file mode 100644 index 2b75d7b1ec5..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/monitors.c +++ /dev/null @@ -1,260 +0,0 @@ -//======================================================================== -// Monitor information tool -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// -// This test prints monitor and video mode information or verifies video -// modes -// -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#include -#include -#include - -#include "getopt.h" - -enum Mode -{ - LIST_MODE, - TEST_MODE -}; - -static void usage(void) -{ - printf("Usage: monitors [-t]\n"); - printf(" monitors -h\n"); -} - -static int euclid(int a, int b) -{ - return b ? euclid(b, a % b) : a; -} - -static const char* format_mode(const GLFWvidmode* mode) -{ - static char buffer[512]; - const int gcd = euclid(mode->width, mode->height); - - snprintf(buffer, - sizeof(buffer), - "%i x %i x %i (%i:%i) (%i %i %i) %i Hz", - mode->width, mode->height, - mode->redBits + mode->greenBits + mode->blueBits, - mode->width / gcd, mode->height / gcd, - mode->redBits, mode->greenBits, mode->blueBits, - mode->refreshRate); - - buffer[sizeof(buffer) - 1] = '\0'; - return buffer; -} - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -static void framebuffer_size_callback(GLFWwindow* window, int width, int height) -{ - printf("Framebuffer resized to %ix%i\n", width, height); - - glViewport(0, 0, width, height); -} - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (key == GLFW_KEY_ESCAPE) - glfwSetWindowShouldClose(window, GLFW_TRUE); -} - -static void list_modes(GLFWmonitor* monitor) -{ - int count, x, y, width_mm, height_mm, i; - int workarea_x, workarea_y, workarea_width, workarea_height; - float xscale, yscale; - - const GLFWvidmode* mode = glfwGetVideoMode(monitor); - const GLFWvidmode* modes = glfwGetVideoModes(monitor, &count); - - glfwGetMonitorPos(monitor, &x, &y); - glfwGetMonitorPhysicalSize(monitor, &width_mm, &height_mm); - glfwGetMonitorContentScale(monitor, &xscale, &yscale); - glfwGetMonitorWorkarea(monitor, &workarea_x, &workarea_y, &workarea_width, &workarea_height); - - printf("Name: %s (%s)\n", - glfwGetMonitorName(monitor), - glfwGetPrimaryMonitor() == monitor ? "primary" : "secondary"); - printf("Current mode: %s\n", format_mode(mode)); - printf("Virtual position: %i, %i\n", x, y); - printf("Content scale: %f x %f\n", xscale, yscale); - - printf("Physical size: %i x %i mm (%0.2f dpi at %i x %i)\n", - width_mm, height_mm, mode->width * 25.4f / width_mm, mode->width, mode->height); - printf("Monitor work area: %i x %i starting at %i, %i\n", - workarea_width, workarea_height, workarea_x, workarea_y); - - printf("Modes:\n"); - - for (i = 0; i < count; i++) - { - printf("%3u: %s", (unsigned int) i, format_mode(modes + i)); - - if (memcmp(mode, modes + i, sizeof(GLFWvidmode)) == 0) - printf(" (current mode)"); - - putchar('\n'); - } -} - -static void test_modes(GLFWmonitor* monitor) -{ - int i, count; - GLFWwindow* window; - const GLFWvidmode* modes = glfwGetVideoModes(monitor, &count); - - for (i = 0; i < count; i++) - { - const GLFWvidmode* mode = modes + i; - GLFWvidmode current; - - glfwWindowHint(GLFW_RED_BITS, mode->redBits); - glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); - glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits); - glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate); - - printf("Testing mode %u on monitor %s: %s\n", - (unsigned int) i, - glfwGetMonitorName(monitor), - format_mode(mode)); - - window = glfwCreateWindow(mode->width, mode->height, - "Video Mode Test", - glfwGetPrimaryMonitor(), - NULL); - if (!window) - { - printf("Failed to enter mode %u: %s\n", - (unsigned int) i, - format_mode(mode)); - continue; - } - - glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); - glfwSetKeyCallback(window, key_callback); - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - glfwSwapInterval(1); - - glfwSetTime(0.0); - - while (glfwGetTime() < 5.0) - { - glClear(GL_COLOR_BUFFER_BIT); - glfwSwapBuffers(window); - glfwPollEvents(); - - if (glfwWindowShouldClose(window)) - { - printf("User terminated program\n"); - - glfwTerminate(); - exit(EXIT_SUCCESS); - } - } - - glGetIntegerv(GL_RED_BITS, ¤t.redBits); - glGetIntegerv(GL_GREEN_BITS, ¤t.greenBits); - glGetIntegerv(GL_BLUE_BITS, ¤t.blueBits); - - glfwGetWindowSize(window, ¤t.width, ¤t.height); - - if (current.redBits != mode->redBits || - current.greenBits != mode->greenBits || - current.blueBits != mode->blueBits) - { - printf("*** Color bit mismatch: (%i %i %i) instead of (%i %i %i)\n", - current.redBits, current.greenBits, current.blueBits, - mode->redBits, mode->greenBits, mode->blueBits); - } - - if (current.width != mode->width || current.height != mode->height) - { - printf("*** Size mismatch: %ix%i instead of %ix%i\n", - current.width, current.height, - mode->width, mode->height); - } - - printf("Closing window\n"); - - glfwDestroyWindow(window); - window = NULL; - - glfwPollEvents(); - } -} - -int main(int argc, char** argv) -{ - int ch, i, count, mode = LIST_MODE; - GLFWmonitor** monitors; - - while ((ch = getopt(argc, argv, "th")) != -1) - { - switch (ch) - { - case 'h': - usage(); - exit(EXIT_SUCCESS); - case 't': - mode = TEST_MODE; - break; - default: - usage(); - exit(EXIT_FAILURE); - } - } - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - monitors = glfwGetMonitors(&count); - - for (i = 0; i < count; i++) - { - if (mode == LIST_MODE) - list_modes(monitors[i]); - else if (mode == TEST_MODE) - test_modes(monitors[i]); - } - - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/tests/msaa.c b/third_party/penumbra/vendor/glfw/tests/msaa.c deleted file mode 100644 index 33e2ccc3bab..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/msaa.c +++ /dev/null @@ -1,220 +0,0 @@ -//======================================================================== -// Multisample anti-aliasing test -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// -// This test renders two high contrast, slowly rotating quads, one aliased -// and one (hopefully) anti-aliased, thus allowing for visual verification -// of whether MSAA is indeed enabled -// -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#if defined(_MSC_VER) - // Make MS math.h define M_PI - #define _USE_MATH_DEFINES -#endif - -#include "linmath.h" - -#include -#include - -#include "getopt.h" - -static const vec2 vertices[4] = -{ - { -0.6f, -0.6f }, - { 0.6f, -0.6f }, - { 0.6f, 0.6f }, - { -0.6f, 0.6f } -}; - -static const char* vertex_shader_text = -"#version 110\n" -"uniform mat4 MVP;\n" -"attribute vec2 vPos;\n" -"void main()\n" -"{\n" -" gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n" -"}\n"; - -static const char* fragment_shader_text = -"#version 110\n" -"void main()\n" -"{\n" -" gl_FragColor = vec4(1.0);\n" -"}\n"; - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (action != GLFW_PRESS) - return; - - switch (key) - { - case GLFW_KEY_SPACE: - glfwSetTime(0.0); - break; - case GLFW_KEY_ESCAPE: - glfwSetWindowShouldClose(window, GLFW_TRUE); - break; - } -} - -static void usage(void) -{ - printf("Usage: msaa [-h] [-s SAMPLES]\n"); -} - -int main(int argc, char** argv) -{ - int ch, samples = 4; - GLFWwindow* window; - GLuint vertex_buffer, vertex_shader, fragment_shader, program; - GLint mvp_location, vpos_location; - - while ((ch = getopt(argc, argv, "hs:")) != -1) - { - switch (ch) - { - case 'h': - usage(); - exit(EXIT_SUCCESS); - case 's': - samples = atoi(optarg); - break; - default: - usage(); - exit(EXIT_FAILURE); - } - } - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - if (samples) - printf("Requesting MSAA with %i samples\n", samples); - else - printf("Requesting that MSAA not be available\n"); - - glfwWindowHint(GLFW_SAMPLES, samples); - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); - - window = glfwCreateWindow(800, 400, "Aliasing Detector", NULL, NULL); - if (!window) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwSetKeyCallback(window, key_callback); - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - glfwSwapInterval(1); - - glGetIntegerv(GL_SAMPLES, &samples); - if (samples) - printf("Context reports MSAA is available with %i samples\n", samples); - else - printf("Context reports MSAA is unavailable\n"); - - glGenBuffers(1, &vertex_buffer); - glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); - glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); - - vertex_shader = glCreateShader(GL_VERTEX_SHADER); - glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL); - glCompileShader(vertex_shader); - - fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); - glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL); - glCompileShader(fragment_shader); - - program = glCreateProgram(); - glAttachShader(program, vertex_shader); - glAttachShader(program, fragment_shader); - glLinkProgram(program); - - mvp_location = glGetUniformLocation(program, "MVP"); - vpos_location = glGetAttribLocation(program, "vPos"); - - glEnableVertexAttribArray(vpos_location); - glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE, - sizeof(vertices[0]), (void*) 0); - - while (!glfwWindowShouldClose(window)) - { - float ratio; - int width, height; - mat4x4 m, p, mvp; - const double angle = glfwGetTime() * M_PI / 180.0; - - glfwGetFramebufferSize(window, &width, &height); - ratio = width / (float) height; - - glViewport(0, 0, width, height); - glClear(GL_COLOR_BUFFER_BIT); - - glUseProgram(program); - - mat4x4_ortho(p, -ratio, ratio, -1.f, 1.f, 0.f, 1.f); - - mat4x4_translate(m, -1.f, 0.f, 0.f); - mat4x4_rotate_Z(m, m, (float) angle); - mat4x4_mul(mvp, p, m); - - glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); - glDisable(GL_MULTISAMPLE); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - - mat4x4_translate(m, 1.f, 0.f, 0.f); - mat4x4_rotate_Z(m, m, (float) angle); - mat4x4_mul(mvp, p, m); - - glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); - glEnable(GL_MULTISAMPLE); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - - glfwSwapBuffers(window); - glfwPollEvents(); - } - - glfwDestroyWindow(window); - - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/tests/opacity.c b/third_party/penumbra/vendor/glfw/tests/opacity.c deleted file mode 100644 index 47f28b16bc1..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/opacity.c +++ /dev/null @@ -1,108 +0,0 @@ -//======================================================================== -// Window opacity test program -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#define NK_IMPLEMENTATION -#define NK_INCLUDE_FIXED_TYPES -#define NK_INCLUDE_FONT_BAKING -#define NK_INCLUDE_DEFAULT_FONT -#define NK_INCLUDE_DEFAULT_ALLOCATOR -#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT -#define NK_INCLUDE_STANDARD_VARARGS -#include - -#define NK_GLFW_GL2_IMPLEMENTATION -#include - -#include -#include - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -int main(int argc, char** argv) -{ - GLFWwindow* window; - struct nk_context* nk; - struct nk_font_atlas* atlas; - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); - - window = glfwCreateWindow(400, 400, "Opacity", NULL, NULL); - if (!window) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - glfwSwapInterval(1); - - nk = nk_glfw3_init(window, NK_GLFW3_INSTALL_CALLBACKS); - nk_glfw3_font_stash_begin(&atlas); - nk_glfw3_font_stash_end(); - - while (!glfwWindowShouldClose(window)) - { - int width, height; - struct nk_rect area; - - glfwGetWindowSize(window, &width, &height); - area = nk_rect(0.f, 0.f, (float) width, (float) height); - - glClear(GL_COLOR_BUFFER_BIT); - nk_glfw3_new_frame(); - if (nk_begin(nk, "", area, 0)) - { - float opacity = glfwGetWindowOpacity(window); - nk_layout_row_dynamic(nk, 30, 2); - if (nk_slider_float(nk, 0.f, &opacity, 1.f, 0.001f)) - glfwSetWindowOpacity(window, opacity); - nk_labelf(nk, NK_TEXT_LEFT, "%0.3f", opacity); - } - - nk_end(nk); - nk_glfw3_render(NK_ANTI_ALIASING_ON); - - glfwSwapBuffers(window); - glfwWaitEventsTimeout(1.0); - } - - nk_glfw3_shutdown(); - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/tests/reopen.c b/third_party/penumbra/vendor/glfw/tests/reopen.c deleted file mode 100644 index 10d22b28b99..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/reopen.c +++ /dev/null @@ -1,240 +0,0 @@ -//======================================================================== -// Window re-opener (open/close stress test) -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// -// This test came about as the result of bug #1262773 -// -// It closes and re-opens the GLFW window every five seconds, alternating -// between windowed and full screen mode -// -// It also times and logs opening and closing actions and attempts to separate -// user initiated window closing from its own -// -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#include -#include -#include - -#include "linmath.h" - -static const char* vertex_shader_text = -"#version 110\n" -"uniform mat4 MVP;\n" -"attribute vec2 vPos;\n" -"void main()\n" -"{\n" -" gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n" -"}\n"; - -static const char* fragment_shader_text = -"#version 110\n" -"void main()\n" -"{\n" -" gl_FragColor = vec4(1.0);\n" -"}\n"; - -static const vec2 vertices[4] = -{ - { -0.5f, -0.5f }, - { 0.5f, -0.5f }, - { 0.5f, 0.5f }, - { -0.5f, 0.5f } -}; - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -static void window_close_callback(GLFWwindow* window) -{ - printf("Close callback triggered\n"); -} - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (action != GLFW_PRESS) - return; - - switch (key) - { - case GLFW_KEY_Q: - case GLFW_KEY_ESCAPE: - glfwSetWindowShouldClose(window, GLFW_TRUE); - break; - } -} - -static void close_window(GLFWwindow* window) -{ - double base = glfwGetTime(); - glfwDestroyWindow(window); - printf("Closing window took %0.3f seconds\n", glfwGetTime() - base); -} - -int main(int argc, char** argv) -{ - int count = 0; - double base; - GLFWwindow* window; - - srand((unsigned int) time(NULL)); - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); - - for (;;) - { - int width, height; - GLFWmonitor* monitor = NULL; - GLuint vertex_shader, fragment_shader, program, vertex_buffer; - GLint mvp_location, vpos_location; - - if (count & 1) - { - int monitorCount; - GLFWmonitor** monitors = glfwGetMonitors(&monitorCount); - monitor = monitors[rand() % monitorCount]; - } - - if (monitor) - { - const GLFWvidmode* mode = glfwGetVideoMode(monitor); - width = mode->width; - height = mode->height; - } - else - { - width = 640; - height = 480; - } - - base = glfwGetTime(); - - window = glfwCreateWindow(width, height, "Window Re-opener", monitor, NULL); - if (!window) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - if (monitor) - { - printf("Opening full screen window on monitor %s took %0.3f seconds\n", - glfwGetMonitorName(monitor), - glfwGetTime() - base); - } - else - { - printf("Opening regular window took %0.3f seconds\n", - glfwGetTime() - base); - } - - glfwSetWindowCloseCallback(window, window_close_callback); - glfwSetKeyCallback(window, key_callback); - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - glfwSwapInterval(1); - - vertex_shader = glCreateShader(GL_VERTEX_SHADER); - glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL); - glCompileShader(vertex_shader); - - fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); - glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL); - glCompileShader(fragment_shader); - - program = glCreateProgram(); - glAttachShader(program, vertex_shader); - glAttachShader(program, fragment_shader); - glLinkProgram(program); - - mvp_location = glGetUniformLocation(program, "MVP"); - vpos_location = glGetAttribLocation(program, "vPos"); - - glGenBuffers(1, &vertex_buffer); - glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); - glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); - - glEnableVertexAttribArray(vpos_location); - glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE, - sizeof(vertices[0]), (void*) 0); - - glfwSetTime(0.0); - - while (glfwGetTime() < 5.0) - { - float ratio; - int width, height; - mat4x4 m, p, mvp; - - glfwGetFramebufferSize(window, &width, &height); - ratio = width / (float) height; - - glViewport(0, 0, width, height); - glClear(GL_COLOR_BUFFER_BIT); - - mat4x4_ortho(p, -ratio, ratio, -1.f, 1.f, 0.f, 1.f); - - mat4x4_identity(m); - mat4x4_rotate_Z(m, m, (float) glfwGetTime()); - mat4x4_mul(mvp, p, m); - - glUseProgram(program); - glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - - glfwSwapBuffers(window); - glfwPollEvents(); - - if (glfwWindowShouldClose(window)) - { - close_window(window); - printf("User closed window\n"); - - glfwTerminate(); - exit(EXIT_SUCCESS); - } - } - - printf("Closing window\n"); - close_window(window); - - count++; - } - - glfwTerminate(); -} - diff --git a/third_party/penumbra/vendor/glfw/tests/tearing.c b/third_party/penumbra/vendor/glfw/tests/tearing.c deleted file mode 100644 index 17601219b47..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/tearing.c +++ /dev/null @@ -1,250 +0,0 @@ -//======================================================================== -// Vsync enabling test -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// -// This test renders a high contrast, horizontally moving bar, allowing for -// visual verification of whether the set swap interval is indeed obeyed -// -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#include -#include -#include - -#include "linmath.h" - -static const struct -{ - float x, y; -} vertices[4] = -{ - { -0.25f, -1.f }, - { 0.25f, -1.f }, - { 0.25f, 1.f }, - { -0.25f, 1.f } -}; - -static const char* vertex_shader_text = -"#version 110\n" -"uniform mat4 MVP;\n" -"attribute vec2 vPos;\n" -"void main()\n" -"{\n" -" gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n" -"}\n"; - -static const char* fragment_shader_text = -"#version 110\n" -"void main()\n" -"{\n" -" gl_FragColor = vec4(1.0);\n" -"}\n"; - -static int swap_tear; -static int swap_interval; -static double frame_rate; - -static void update_window_title(GLFWwindow* window) -{ - char title[256]; - - snprintf(title, sizeof(title), "Tearing detector (interval %i%s, %0.1f Hz)", - swap_interval, - (swap_tear && swap_interval < 0) ? " (swap tear)" : "", - frame_rate); - - glfwSetWindowTitle(window, title); -} - -static void set_swap_interval(GLFWwindow* window, int interval) -{ - swap_interval = interval; - glfwSwapInterval(swap_interval); - update_window_title(window); -} - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (action != GLFW_PRESS) - return; - - switch (key) - { - case GLFW_KEY_UP: - { - if (swap_interval + 1 > swap_interval) - set_swap_interval(window, swap_interval + 1); - break; - } - - case GLFW_KEY_DOWN: - { - if (swap_tear) - { - if (swap_interval - 1 < swap_interval) - set_swap_interval(window, swap_interval - 1); - } - else - { - if (swap_interval - 1 >= 0) - set_swap_interval(window, swap_interval - 1); - } - break; - } - - case GLFW_KEY_ESCAPE: - glfwSetWindowShouldClose(window, 1); - break; - - case GLFW_KEY_F11: - case GLFW_KEY_ENTER: - { - static int x, y, width, height; - - if (mods != GLFW_MOD_ALT) - return; - - if (glfwGetWindowMonitor(window)) - glfwSetWindowMonitor(window, NULL, x, y, width, height, 0); - else - { - GLFWmonitor* monitor = glfwGetPrimaryMonitor(); - const GLFWvidmode* mode = glfwGetVideoMode(monitor); - glfwGetWindowPos(window, &x, &y); - glfwGetWindowSize(window, &width, &height); - glfwSetWindowMonitor(window, monitor, - 0, 0, mode->width, mode->height, - mode->refreshRate); - } - - break; - } - } -} - -int main(int argc, char** argv) -{ - unsigned long frame_count = 0; - double last_time, current_time; - GLFWwindow* window; - GLuint vertex_buffer, vertex_shader, fragment_shader, program; - GLint mvp_location, vpos_location; - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); - - window = glfwCreateWindow(640, 480, "Tearing detector", NULL, NULL); - if (!window) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - set_swap_interval(window, 0); - - last_time = glfwGetTime(); - frame_rate = 0.0; - swap_tear = (glfwExtensionSupported("WGL_EXT_swap_control_tear") || - glfwExtensionSupported("GLX_EXT_swap_control_tear")); - - glfwSetKeyCallback(window, key_callback); - - glGenBuffers(1, &vertex_buffer); - glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); - glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); - - vertex_shader = glCreateShader(GL_VERTEX_SHADER); - glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL); - glCompileShader(vertex_shader); - - fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); - glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL); - glCompileShader(fragment_shader); - - program = glCreateProgram(); - glAttachShader(program, vertex_shader); - glAttachShader(program, fragment_shader); - glLinkProgram(program); - - mvp_location = glGetUniformLocation(program, "MVP"); - vpos_location = glGetAttribLocation(program, "vPos"); - - glEnableVertexAttribArray(vpos_location); - glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE, - sizeof(vertices[0]), (void*) 0); - - while (!glfwWindowShouldClose(window)) - { - int width, height; - mat4x4 m, p, mvp; - float position = cosf((float) glfwGetTime() * 4.f) * 0.75f; - - glfwGetFramebufferSize(window, &width, &height); - - glViewport(0, 0, width, height); - glClear(GL_COLOR_BUFFER_BIT); - - mat4x4_ortho(p, -1.f, 1.f, -1.f, 1.f, 0.f, 1.f); - mat4x4_translate(m, position, 0.f, 0.f); - mat4x4_mul(mvp, p, m); - - glUseProgram(program); - glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - - glfwSwapBuffers(window); - glfwPollEvents(); - - frame_count++; - - current_time = glfwGetTime(); - if (current_time - last_time > 1.0) - { - frame_rate = frame_count / (current_time - last_time); - frame_count = 0; - last_time = current_time; - update_window_title(window); - } - } - - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/tests/threads.c b/third_party/penumbra/vendor/glfw/tests/threads.c deleted file mode 100644 index 98294933657..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/threads.c +++ /dev/null @@ -1,152 +0,0 @@ -//======================================================================== -// Multi-threading test -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// -// This test is intended to verify whether the OpenGL context part of -// the GLFW API is able to be used from multiple threads -// -//======================================================================== - -#include "tinycthread.h" - -#include -#define GLFW_INCLUDE_NONE -#include - -#include -#include -#include - -typedef struct -{ - GLFWwindow* window; - const char* title; - float r, g, b; - thrd_t id; -} Thread; - -static volatile int running = GLFW_TRUE; - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) - glfwSetWindowShouldClose(window, GLFW_TRUE); -} - -static int thread_main(void* data) -{ - const Thread* thread = data; - - glfwMakeContextCurrent(thread->window); - glfwSwapInterval(1); - - while (running) - { - const float v = (float) fabs(sin(glfwGetTime() * 2.f)); - glClearColor(thread->r * v, thread->g * v, thread->b * v, 0.f); - - glClear(GL_COLOR_BUFFER_BIT); - glfwSwapBuffers(thread->window); - } - - glfwMakeContextCurrent(NULL); - return 0; -} - -int main(void) -{ - int i, result; - Thread threads[] = - { - { NULL, "Red", 1.f, 0.f, 0.f, 0 }, - { NULL, "Green", 0.f, 1.f, 0.f, 0 }, - { NULL, "Blue", 0.f, 0.f, 1.f, 0 } - }; - const int count = sizeof(threads) / sizeof(Thread); - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); - - for (i = 0; i < count; i++) - { - threads[i].window = glfwCreateWindow(200, 200, - threads[i].title, - NULL, NULL); - if (!threads[i].window) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwSetKeyCallback(threads[i].window, key_callback); - - glfwSetWindowPos(threads[i].window, 200 + 250 * i, 200); - glfwShowWindow(threads[i].window); - } - - glfwMakeContextCurrent(threads[0].window); - gladLoadGL(glfwGetProcAddress); - glfwMakeContextCurrent(NULL); - - for (i = 0; i < count; i++) - { - if (thrd_create(&threads[i].id, thread_main, threads + i) != - thrd_success) - { - fprintf(stderr, "Failed to create secondary thread\n"); - - glfwTerminate(); - exit(EXIT_FAILURE); - } - } - - while (running) - { - glfwWaitEvents(); - - for (i = 0; i < count; i++) - { - if (glfwWindowShouldClose(threads[i].window)) - running = GLFW_FALSE; - } - } - - for (i = 0; i < count; i++) - glfwHideWindow(threads[i].window); - - for (i = 0; i < count; i++) - thrd_join(threads[i].id, &result); - - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/tests/timeout.c b/third_party/penumbra/vendor/glfw/tests/timeout.c deleted file mode 100644 index bda2560c7ac..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/timeout.c +++ /dev/null @@ -1,98 +0,0 @@ -//======================================================================== -// Event wait timeout test -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// -// This test is intended to verify that waiting for events with timeout works -// -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#include -#include -#include -#include - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) - glfwSetWindowShouldClose(window, GLFW_TRUE); -} - -static float nrand(void) -{ - return (float) rand() / (float) RAND_MAX; -} - -int main(void) -{ - GLFWwindow* window; - - srand((unsigned int) time(NULL)); - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - window = glfwCreateWindow(640, 480, "Event Wait Timeout Test", NULL, NULL); - if (!window) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - glfwSetKeyCallback(window, key_callback); - - while (!glfwWindowShouldClose(window)) - { - int width, height; - float r = nrand(), g = nrand(), b = nrand(); - float l = (float) sqrt(r * r + g * g + b * b); - - glfwGetFramebufferSize(window, &width, &height); - - glViewport(0, 0, width, height); - glClearColor(r / l, g / l, b / l, 1.f); - glClear(GL_COLOR_BUFFER_BIT); - glfwSwapBuffers(window); - - glfwWaitEventsTimeout(1.0); - } - - glfwDestroyWindow(window); - - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/tests/title.c b/third_party/penumbra/vendor/glfw/tests/title.c deleted file mode 100644 index a5bad342294..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/title.c +++ /dev/null @@ -1,72 +0,0 @@ -//======================================================================== -// UTF-8 window title test -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// -// This test sets a UTF-8 window title -// -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#include -#include - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -int main(void) -{ - GLFWwindow* window; - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - window = glfwCreateWindow(400, 400, "English 日本語 русский язык 官話", NULL, NULL); - if (!window) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwMakeContextCurrent(window); - gladLoadGL(glfwGetProcAddress); - glfwSwapInterval(1); - - while (!glfwWindowShouldClose(window)) - { - glClear(GL_COLOR_BUFFER_BIT); - glfwSwapBuffers(window); - glfwWaitEvents(); - } - - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/glfw/tests/triangle-vulkan.c b/third_party/penumbra/vendor/glfw/tests/triangle-vulkan.c deleted file mode 100644 index 33442968c2a..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/triangle-vulkan.c +++ /dev/null @@ -1,2229 +0,0 @@ -/* - * Copyright (c) 2015-2016 The Khronos Group Inc. - * Copyright (c) 2015-2016 Valve Corporation - * Copyright (c) 2015-2016 LunarG, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Author: Chia-I Wu - * Author: Cody Northrop - * Author: Courtney Goeltzenleuchter - * Author: Ian Elliott - * Author: Jon Ashburn - * Author: Piers Daniell - * Author: Gwan-gyeong Mun - * Porter: Camilla Löwy - */ -/* - * Draw a textured triangle with depth testing. This is written against Intel - * ICD. It does not do state transition nor object memory binding like it - * should. It also does no error checking. - */ - -#include -#include -#include -#include -#include -#include - -#ifdef _WIN32 -#include -#endif - -#include -#define GLFW_INCLUDE_NONE -#include - -#define DEMO_TEXTURE_COUNT 1 -#define VERTEX_BUFFER_BIND_ID 0 -#define APP_SHORT_NAME "tri" -#define APP_LONG_NAME "The Vulkan Triangle Demo Program" - -#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) - -#if defined(NDEBUG) && defined(__GNUC__) -#define U_ASSERT_ONLY __attribute__((unused)) -#else -#define U_ASSERT_ONLY -#endif - -#define ERR_EXIT(err_msg, err_class) \ - do { \ - printf(err_msg); \ - fflush(stdout); \ - exit(1); \ - } while (0) - -static GLADapiproc glad_vulkan_callback(const char* name, void* user) -{ - return glfwGetInstanceProcAddress((VkInstance) user, name); -} - -static const char fragShaderCode[] = { - 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, - 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x04, 0x00, 0x09, 0x00, - 0x47, 0x4c, 0x5f, 0x41, 0x52, 0x42, 0x5f, 0x73, 0x65, 0x70, 0x61, 0x72, - 0x61, 0x74, 0x65, 0x5f, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x00, 0x00, 0x04, 0x00, 0x09, 0x00, - 0x47, 0x4c, 0x5f, 0x41, 0x52, 0x42, 0x5f, 0x73, 0x68, 0x61, 0x64, 0x69, - 0x6e, 0x67, 0x5f, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x5f, - 0x34, 0x32, 0x30, 0x70, 0x61, 0x63, 0x6b, 0x00, 0x05, 0x00, 0x04, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x46, 0x72, 0x61, - 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x00, 0x05, 0x00, 0x05, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x11, 0x00, 0x00, 0x00, - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x0a, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0x0b, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x04, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x0f, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, - 0x57, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, - 0x38, 0x00, 0x01, 0x00 -}; - -static const char vertShaderCode[] = { - 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, - 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, - 0x04, 0x00, 0x09, 0x00, 0x47, 0x4c, 0x5f, 0x41, 0x52, 0x42, 0x5f, 0x73, - 0x65, 0x70, 0x61, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x68, 0x61, 0x64, - 0x65, 0x72, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x00, 0x00, - 0x04, 0x00, 0x09, 0x00, 0x47, 0x4c, 0x5f, 0x41, 0x52, 0x42, 0x5f, 0x73, - 0x68, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6c, 0x61, 0x6e, 0x67, 0x75, - 0x61, 0x67, 0x65, 0x5f, 0x34, 0x32, 0x30, 0x70, 0x61, 0x63, 0x6b, 0x00, - 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x61, 0x74, 0x74, 0x72, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x11, 0x00, 0x00, 0x00, - 0x67, 0x6c, 0x5f, 0x50, 0x65, 0x72, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x11, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x07, 0x00, 0x11, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x69, 0x6e, 0x74, - 0x53, 0x69, 0x7a, 0x65, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x43, - 0x6c, 0x69, 0x70, 0x44, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x17, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x00, - 0x05, 0x00, 0x05, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x56, - 0x65, 0x72, 0x74, 0x65, 0x78, 0x49, 0x44, 0x00, 0x05, 0x00, 0x06, 0x00, - 0x1d, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x49, 0x6e, 0x73, 0x74, 0x61, - 0x6e, 0x63, 0x65, 0x49, 0x44, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x11, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x48, 0x00, 0x05, 0x00, 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x11, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, - 0x1c, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x47, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x15, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, - 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x1e, 0x00, 0x05, 0x00, 0x11, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, - 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, - 0x3b, 0x00, 0x04, 0x00, 0x12, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x16, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, - 0x19, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, - 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, - 0x1b, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, - 0x0d, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x05, 0x00, 0x19, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, - 0x13, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, - 0x1a, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, - 0x38, 0x00, 0x01, 0x00 -}; - -struct texture_object { - VkSampler sampler; - - VkImage image; - VkImageLayout imageLayout; - - VkDeviceMemory mem; - VkImageView view; - int32_t tex_width, tex_height; -}; - -static int validation_error = 0; - -VKAPI_ATTR VkBool32 VKAPI_CALL -BreakCallback(VkFlags msgFlags, VkDebugReportObjectTypeEXT objType, - uint64_t srcObject, size_t location, int32_t msgCode, - const char *pLayerPrefix, const char *pMsg, - void *pUserData) { -#ifdef _WIN32 - DebugBreak(); -#else - raise(SIGTRAP); -#endif - - return false; -} - -typedef struct { - VkImage image; - VkCommandBuffer cmd; - VkImageView view; -} SwapchainBuffers; - -struct demo { - GLFWwindow* window; - VkSurfaceKHR surface; - bool use_staging_buffer; - - VkInstance inst; - VkPhysicalDevice gpu; - VkDevice device; - VkQueue queue; - VkPhysicalDeviceProperties gpu_props; - VkPhysicalDeviceFeatures gpu_features; - VkQueueFamilyProperties *queue_props; - uint32_t graphics_queue_node_index; - - uint32_t enabled_extension_count; - uint32_t enabled_layer_count; - const char *extension_names[64]; - const char *enabled_layers[64]; - - int width, height; - VkFormat format; - VkColorSpaceKHR color_space; - - uint32_t swapchainImageCount; - VkSwapchainKHR swapchain; - SwapchainBuffers *buffers; - - VkCommandPool cmd_pool; - - struct { - VkFormat format; - - VkImage image; - VkDeviceMemory mem; - VkImageView view; - } depth; - - struct texture_object textures[DEMO_TEXTURE_COUNT]; - - struct { - VkBuffer buf; - VkDeviceMemory mem; - - VkPipelineVertexInputStateCreateInfo vi; - VkVertexInputBindingDescription vi_bindings[1]; - VkVertexInputAttributeDescription vi_attrs[2]; - } vertices; - - VkCommandBuffer setup_cmd; // Command Buffer for initialization commands - VkCommandBuffer draw_cmd; // Command Buffer for drawing commands - VkPipelineLayout pipeline_layout; - VkDescriptorSetLayout desc_layout; - VkPipelineCache pipelineCache; - VkRenderPass render_pass; - VkPipeline pipeline; - - VkShaderModule vert_shader_module; - VkShaderModule frag_shader_module; - - VkDescriptorPool desc_pool; - VkDescriptorSet desc_set; - - VkFramebuffer *framebuffers; - - VkPhysicalDeviceMemoryProperties memory_properties; - - int32_t curFrame; - int32_t frameCount; - bool validate; - bool use_break; - VkDebugReportCallbackEXT msg_callback; - - float depthStencil; - float depthIncrement; - - uint32_t current_buffer; - uint32_t queue_count; -}; - -VKAPI_ATTR VkBool32 VKAPI_CALL -dbgFunc(VkFlags msgFlags, VkDebugReportObjectTypeEXT objType, - uint64_t srcObject, size_t location, int32_t msgCode, - const char *pLayerPrefix, const char *pMsg, void *pUserData) { - char *message = (char *)malloc(strlen(pMsg) + 100); - - assert(message); - - validation_error = 1; - - if (msgFlags & VK_DEBUG_REPORT_ERROR_BIT_EXT) { - sprintf(message, "ERROR: [%s] Code %d : %s", pLayerPrefix, msgCode, - pMsg); - } else if (msgFlags & VK_DEBUG_REPORT_WARNING_BIT_EXT) { - sprintf(message, "WARNING: [%s] Code %d : %s", pLayerPrefix, msgCode, - pMsg); - } else { - return false; - } - - printf("%s\n", message); - fflush(stdout); - free(message); - - /* - * false indicates that layer should not bail-out of an - * API call that had validation failures. This may mean that the - * app dies inside the driver due to invalid parameter(s). - * That's what would happen without validation layers, so we'll - * keep that behavior here. - */ - return false; -} - -// Forward declaration: -static void demo_resize(struct demo *demo); - -static bool memory_type_from_properties(struct demo *demo, uint32_t typeBits, - VkFlags requirements_mask, - uint32_t *typeIndex) { - uint32_t i; - // Search memtypes to find first index with those properties - for (i = 0; i < VK_MAX_MEMORY_TYPES; i++) { - if ((typeBits & 1) == 1) { - // Type is available, does it match user properties? - if ((demo->memory_properties.memoryTypes[i].propertyFlags & - requirements_mask) == requirements_mask) { - *typeIndex = i; - return true; - } - } - typeBits >>= 1; - } - // No memory types matched, return failure - return false; -} - -static void demo_flush_init_cmd(struct demo *demo) { - VkResult U_ASSERT_ONLY err; - - if (demo->setup_cmd == VK_NULL_HANDLE) - return; - - err = vkEndCommandBuffer(demo->setup_cmd); - assert(!err); - - const VkCommandBuffer cmd_bufs[] = {demo->setup_cmd}; - VkFence nullFence = {VK_NULL_HANDLE}; - VkSubmitInfo submit_info = {.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO, - .pNext = NULL, - .waitSemaphoreCount = 0, - .pWaitSemaphores = NULL, - .pWaitDstStageMask = NULL, - .commandBufferCount = 1, - .pCommandBuffers = cmd_bufs, - .signalSemaphoreCount = 0, - .pSignalSemaphores = NULL}; - - err = vkQueueSubmit(demo->queue, 1, &submit_info, nullFence); - assert(!err); - - err = vkQueueWaitIdle(demo->queue); - assert(!err); - - vkFreeCommandBuffers(demo->device, demo->cmd_pool, 1, cmd_bufs); - demo->setup_cmd = VK_NULL_HANDLE; -} - -static void demo_set_image_layout(struct demo *demo, VkImage image, - VkImageAspectFlags aspectMask, - VkImageLayout old_image_layout, - VkImageLayout new_image_layout, - VkAccessFlagBits srcAccessMask) { - - VkResult U_ASSERT_ONLY err; - - if (demo->setup_cmd == VK_NULL_HANDLE) { - const VkCommandBufferAllocateInfo cmd = { - .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, - .pNext = NULL, - .commandPool = demo->cmd_pool, - .level = VK_COMMAND_BUFFER_LEVEL_PRIMARY, - .commandBufferCount = 1, - }; - - err = vkAllocateCommandBuffers(demo->device, &cmd, &demo->setup_cmd); - assert(!err); - - VkCommandBufferBeginInfo cmd_buf_info = { - .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, - .pNext = NULL, - .flags = 0, - .pInheritanceInfo = NULL, - }; - err = vkBeginCommandBuffer(demo->setup_cmd, &cmd_buf_info); - assert(!err); - } - - VkImageMemoryBarrier image_memory_barrier = { - .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, - .pNext = NULL, - .srcAccessMask = srcAccessMask, - .dstAccessMask = 0, - .oldLayout = old_image_layout, - .newLayout = new_image_layout, - .image = image, - .subresourceRange = {aspectMask, 0, 1, 0, 1}}; - - if (new_image_layout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) { - /* Make sure anything that was copying from this image has completed */ - image_memory_barrier.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; - } - - if (new_image_layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) { - image_memory_barrier.dstAccessMask = - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; - } - - if (new_image_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL) { - image_memory_barrier.dstAccessMask = - VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT; - } - - if (new_image_layout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) { - /* Make sure any Copy or CPU writes to image are flushed */ - image_memory_barrier.dstAccessMask = - VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_INPUT_ATTACHMENT_READ_BIT; - } - - VkImageMemoryBarrier *pmemory_barrier = &image_memory_barrier; - - VkPipelineStageFlags src_stages = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; - VkPipelineStageFlags dest_stages = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; - - vkCmdPipelineBarrier(demo->setup_cmd, src_stages, dest_stages, 0, 0, NULL, - 0, NULL, 1, pmemory_barrier); -} - -static void demo_draw_build_cmd(struct demo *demo) { - const VkCommandBufferBeginInfo cmd_buf_info = { - .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, - .pNext = NULL, - .flags = 0, - .pInheritanceInfo = NULL, - }; - const VkClearValue clear_values[2] = { - [0] = {.color.float32 = {0.2f, 0.2f, 0.2f, 0.2f}}, - [1] = {.depthStencil = {demo->depthStencil, 0}}, - }; - const VkRenderPassBeginInfo rp_begin = { - .sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, - .pNext = NULL, - .renderPass = demo->render_pass, - .framebuffer = demo->framebuffers[demo->current_buffer], - .renderArea.offset.x = 0, - .renderArea.offset.y = 0, - .renderArea.extent.width = demo->width, - .renderArea.extent.height = demo->height, - .clearValueCount = 2, - .pClearValues = clear_values, - }; - VkResult U_ASSERT_ONLY err; - - err = vkBeginCommandBuffer(demo->draw_cmd, &cmd_buf_info); - assert(!err); - - // We can use LAYOUT_UNDEFINED as a wildcard here because we don't care what - // happens to the previous contents of the image - VkImageMemoryBarrier image_memory_barrier = { - .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, - .pNext = NULL, - .srcAccessMask = 0, - .dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, - .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED, - .newLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, - .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, - .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, - .image = demo->buffers[demo->current_buffer].image, - .subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}}; - - vkCmdPipelineBarrier(demo->draw_cmd, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, - VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, NULL, 0, - NULL, 1, &image_memory_barrier); - vkCmdBeginRenderPass(demo->draw_cmd, &rp_begin, VK_SUBPASS_CONTENTS_INLINE); - vkCmdBindPipeline(demo->draw_cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, - demo->pipeline); - vkCmdBindDescriptorSets(demo->draw_cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, - demo->pipeline_layout, 0, 1, &demo->desc_set, 0, - NULL); - - VkViewport viewport; - memset(&viewport, 0, sizeof(viewport)); - viewport.height = (float)demo->height; - viewport.width = (float)demo->width; - viewport.minDepth = (float)0.0f; - viewport.maxDepth = (float)1.0f; - vkCmdSetViewport(demo->draw_cmd, 0, 1, &viewport); - - VkRect2D scissor; - memset(&scissor, 0, sizeof(scissor)); - scissor.extent.width = demo->width; - scissor.extent.height = demo->height; - scissor.offset.x = 0; - scissor.offset.y = 0; - vkCmdSetScissor(demo->draw_cmd, 0, 1, &scissor); - - VkDeviceSize offsets[1] = {0}; - vkCmdBindVertexBuffers(demo->draw_cmd, VERTEX_BUFFER_BIND_ID, 1, - &demo->vertices.buf, offsets); - - vkCmdDraw(demo->draw_cmd, 3, 1, 0, 0); - vkCmdEndRenderPass(demo->draw_cmd); - - VkImageMemoryBarrier prePresentBarrier = { - .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, - .pNext = NULL, - .srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, - .dstAccessMask = VK_ACCESS_MEMORY_READ_BIT, - .oldLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, - .newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, - .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, - .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, - .subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}}; - - prePresentBarrier.image = demo->buffers[demo->current_buffer].image; - VkImageMemoryBarrier *pmemory_barrier = &prePresentBarrier; - vkCmdPipelineBarrier(demo->draw_cmd, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, - VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, NULL, 0, - NULL, 1, pmemory_barrier); - - err = vkEndCommandBuffer(demo->draw_cmd); - assert(!err); -} - -static void demo_draw(struct demo *demo) { - VkResult U_ASSERT_ONLY err; - VkSemaphore imageAcquiredSemaphore, drawCompleteSemaphore; - VkSemaphoreCreateInfo semaphoreCreateInfo = { - .sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, - .pNext = NULL, - .flags = 0, - }; - - err = vkCreateSemaphore(demo->device, &semaphoreCreateInfo, - NULL, &imageAcquiredSemaphore); - assert(!err); - - err = vkCreateSemaphore(demo->device, &semaphoreCreateInfo, - NULL, &drawCompleteSemaphore); - assert(!err); - - // Get the index of the next available swapchain image: - err = vkAcquireNextImageKHR(demo->device, demo->swapchain, UINT64_MAX, - imageAcquiredSemaphore, - (VkFence)0, // TODO: Show use of fence - &demo->current_buffer); - if (err == VK_ERROR_OUT_OF_DATE_KHR) { - // demo->swapchain is out of date (e.g. the window was resized) and - // must be recreated: - demo_resize(demo); - demo_draw(demo); - vkDestroySemaphore(demo->device, imageAcquiredSemaphore, NULL); - vkDestroySemaphore(demo->device, drawCompleteSemaphore, NULL); - return; - } else if (err == VK_SUBOPTIMAL_KHR) { - // demo->swapchain is not as optimal as it could be, but the platform's - // presentation engine will still present the image correctly. - } else { - assert(!err); - } - - demo_flush_init_cmd(demo); - - // Wait for the present complete semaphore to be signaled to ensure - // that the image won't be rendered to until the presentation - // engine has fully released ownership to the application, and it is - // okay to render to the image. - - demo_draw_build_cmd(demo); - VkFence nullFence = VK_NULL_HANDLE; - VkPipelineStageFlags pipe_stage_flags = - VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; - VkSubmitInfo submit_info = {.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO, - .pNext = NULL, - .waitSemaphoreCount = 1, - .pWaitSemaphores = &imageAcquiredSemaphore, - .pWaitDstStageMask = &pipe_stage_flags, - .commandBufferCount = 1, - .pCommandBuffers = &demo->draw_cmd, - .signalSemaphoreCount = 1, - .pSignalSemaphores = &drawCompleteSemaphore}; - - err = vkQueueSubmit(demo->queue, 1, &submit_info, nullFence); - assert(!err); - - VkPresentInfoKHR present = { - .sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR, - .pNext = NULL, - .waitSemaphoreCount = 1, - .pWaitSemaphores = &drawCompleteSemaphore, - .swapchainCount = 1, - .pSwapchains = &demo->swapchain, - .pImageIndices = &demo->current_buffer, - }; - - err = vkQueuePresentKHR(demo->queue, &present); - if (err == VK_ERROR_OUT_OF_DATE_KHR) { - // demo->swapchain is out of date (e.g. the window was resized) and - // must be recreated: - demo_resize(demo); - } else if (err == VK_SUBOPTIMAL_KHR) { - // demo->swapchain is not as optimal as it could be, but the platform's - // presentation engine will still present the image correctly. - } else { - assert(!err); - } - - err = vkQueueWaitIdle(demo->queue); - assert(err == VK_SUCCESS); - - vkDestroySemaphore(demo->device, imageAcquiredSemaphore, NULL); - vkDestroySemaphore(demo->device, drawCompleteSemaphore, NULL); -} - -static void demo_prepare_buffers(struct demo *demo) { - VkResult U_ASSERT_ONLY err; - VkSwapchainKHR oldSwapchain = demo->swapchain; - - // Check the surface capabilities and formats - VkSurfaceCapabilitiesKHR surfCapabilities; - err = vkGetPhysicalDeviceSurfaceCapabilitiesKHR( - demo->gpu, demo->surface, &surfCapabilities); - assert(!err); - - uint32_t presentModeCount; - err = vkGetPhysicalDeviceSurfacePresentModesKHR( - demo->gpu, demo->surface, &presentModeCount, NULL); - assert(!err); - VkPresentModeKHR *presentModes = - (VkPresentModeKHR *)malloc(presentModeCount * sizeof(VkPresentModeKHR)); - assert(presentModes); - err = vkGetPhysicalDeviceSurfacePresentModesKHR( - demo->gpu, demo->surface, &presentModeCount, presentModes); - assert(!err); - - VkExtent2D swapchainExtent; - // width and height are either both 0xFFFFFFFF, or both not 0xFFFFFFFF. - if (surfCapabilities.currentExtent.width == 0xFFFFFFFF) { - // If the surface size is undefined, the size is set to the size - // of the images requested, which must fit within the minimum and - // maximum values. - swapchainExtent.width = demo->width; - swapchainExtent.height = demo->height; - - if (swapchainExtent.width < surfCapabilities.minImageExtent.width) { - swapchainExtent.width = surfCapabilities.minImageExtent.width; - } else if (swapchainExtent.width > surfCapabilities.maxImageExtent.width) { - swapchainExtent.width = surfCapabilities.maxImageExtent.width; - } - - if (swapchainExtent.height < surfCapabilities.minImageExtent.height) { - swapchainExtent.height = surfCapabilities.minImageExtent.height; - } else if (swapchainExtent.height > surfCapabilities.maxImageExtent.height) { - swapchainExtent.height = surfCapabilities.maxImageExtent.height; - } - } else { - // If the surface size is defined, the swap chain size must match - swapchainExtent = surfCapabilities.currentExtent; - demo->width = surfCapabilities.currentExtent.width; - demo->height = surfCapabilities.currentExtent.height; - } - - VkPresentModeKHR swapchainPresentMode = VK_PRESENT_MODE_FIFO_KHR; - - // Determine the number of VkImage's to use in the swap chain. - // Application desires to only acquire 1 image at a time (which is - // "surfCapabilities.minImageCount"). - uint32_t desiredNumOfSwapchainImages = surfCapabilities.minImageCount; - // If maxImageCount is 0, we can ask for as many images as we want; - // otherwise we're limited to maxImageCount - if ((surfCapabilities.maxImageCount > 0) && - (desiredNumOfSwapchainImages > surfCapabilities.maxImageCount)) { - // Application must settle for fewer images than desired: - desiredNumOfSwapchainImages = surfCapabilities.maxImageCount; - } - - VkSurfaceTransformFlagsKHR preTransform; - if (surfCapabilities.supportedTransforms & - VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR) { - preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR; - } else { - preTransform = surfCapabilities.currentTransform; - } - - const VkSwapchainCreateInfoKHR swapchain = { - .sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR, - .pNext = NULL, - .surface = demo->surface, - .minImageCount = desiredNumOfSwapchainImages, - .imageFormat = demo->format, - .imageColorSpace = demo->color_space, - .imageExtent = - { - .width = swapchainExtent.width, .height = swapchainExtent.height, - }, - .imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, - .preTransform = preTransform, - .compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR, - .imageArrayLayers = 1, - .imageSharingMode = VK_SHARING_MODE_EXCLUSIVE, - .queueFamilyIndexCount = 0, - .pQueueFamilyIndices = NULL, - .presentMode = swapchainPresentMode, - .oldSwapchain = oldSwapchain, - .clipped = true, - }; - uint32_t i; - - err = vkCreateSwapchainKHR(demo->device, &swapchain, NULL, &demo->swapchain); - assert(!err); - - // If we just re-created an existing swapchain, we should destroy the old - // swapchain at this point. - // Note: destroying the swapchain also cleans up all its associated - // presentable images once the platform is done with them. - if (oldSwapchain != VK_NULL_HANDLE) { - vkDestroySwapchainKHR(demo->device, oldSwapchain, NULL); - } - - err = vkGetSwapchainImagesKHR(demo->device, demo->swapchain, - &demo->swapchainImageCount, NULL); - assert(!err); - - VkImage *swapchainImages = - (VkImage *)malloc(demo->swapchainImageCount * sizeof(VkImage)); - assert(swapchainImages); - err = vkGetSwapchainImagesKHR(demo->device, demo->swapchain, - &demo->swapchainImageCount, - swapchainImages); - assert(!err); - - demo->buffers = (SwapchainBuffers *)malloc(sizeof(SwapchainBuffers) * - demo->swapchainImageCount); - assert(demo->buffers); - - for (i = 0; i < demo->swapchainImageCount; i++) { - VkImageViewCreateInfo color_attachment_view = { - .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, - .pNext = NULL, - .format = demo->format, - .components = - { - .r = VK_COMPONENT_SWIZZLE_R, - .g = VK_COMPONENT_SWIZZLE_G, - .b = VK_COMPONENT_SWIZZLE_B, - .a = VK_COMPONENT_SWIZZLE_A, - }, - .subresourceRange = {.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, - .baseMipLevel = 0, - .levelCount = 1, - .baseArrayLayer = 0, - .layerCount = 1}, - .viewType = VK_IMAGE_VIEW_TYPE_2D, - .flags = 0, - }; - - demo->buffers[i].image = swapchainImages[i]; - - color_attachment_view.image = demo->buffers[i].image; - - err = vkCreateImageView(demo->device, &color_attachment_view, NULL, - &demo->buffers[i].view); - assert(!err); - } - - demo->current_buffer = 0; - - if (NULL != presentModes) { - free(presentModes); - } -} - -static void demo_prepare_depth(struct demo *demo) { - const VkFormat depth_format = VK_FORMAT_D16_UNORM; - const VkImageCreateInfo image = { - .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - .pNext = NULL, - .imageType = VK_IMAGE_TYPE_2D, - .format = depth_format, - .extent = {demo->width, demo->height, 1}, - .mipLevels = 1, - .arrayLayers = 1, - .samples = VK_SAMPLE_COUNT_1_BIT, - .tiling = VK_IMAGE_TILING_OPTIMAL, - .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, - .flags = 0, - }; - VkMemoryAllocateInfo mem_alloc = { - .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, - .pNext = NULL, - .allocationSize = 0, - .memoryTypeIndex = 0, - }; - VkImageViewCreateInfo view = { - .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, - .pNext = NULL, - .image = VK_NULL_HANDLE, - .format = depth_format, - .subresourceRange = {.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT, - .baseMipLevel = 0, - .levelCount = 1, - .baseArrayLayer = 0, - .layerCount = 1}, - .flags = 0, - .viewType = VK_IMAGE_VIEW_TYPE_2D, - }; - - VkMemoryRequirements mem_reqs; - VkResult U_ASSERT_ONLY err; - bool U_ASSERT_ONLY pass; - - demo->depth.format = depth_format; - - /* create image */ - err = vkCreateImage(demo->device, &image, NULL, &demo->depth.image); - assert(!err); - - /* get memory requirements for this object */ - vkGetImageMemoryRequirements(demo->device, demo->depth.image, &mem_reqs); - - /* select memory size and type */ - mem_alloc.allocationSize = mem_reqs.size; - pass = memory_type_from_properties(demo, mem_reqs.memoryTypeBits, - 0, /* No requirements */ - &mem_alloc.memoryTypeIndex); - assert(pass); - - /* allocate memory */ - err = vkAllocateMemory(demo->device, &mem_alloc, NULL, &demo->depth.mem); - assert(!err); - - /* bind memory */ - err = - vkBindImageMemory(demo->device, demo->depth.image, demo->depth.mem, 0); - assert(!err); - - demo_set_image_layout(demo, demo->depth.image, VK_IMAGE_ASPECT_DEPTH_BIT, - VK_IMAGE_LAYOUT_UNDEFINED, - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, - 0); - - /* create image view */ - view.image = demo->depth.image; - err = vkCreateImageView(demo->device, &view, NULL, &demo->depth.view); - assert(!err); -} - -static void -demo_prepare_texture_image(struct demo *demo, const uint32_t *tex_colors, - struct texture_object *tex_obj, VkImageTiling tiling, - VkImageUsageFlags usage, VkFlags required_props) { - const VkFormat tex_format = VK_FORMAT_B8G8R8A8_UNORM; - const int32_t tex_width = 2; - const int32_t tex_height = 2; - VkResult U_ASSERT_ONLY err; - bool U_ASSERT_ONLY pass; - - tex_obj->tex_width = tex_width; - tex_obj->tex_height = tex_height; - - const VkImageCreateInfo image_create_info = { - .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - .pNext = NULL, - .imageType = VK_IMAGE_TYPE_2D, - .format = tex_format, - .extent = {tex_width, tex_height, 1}, - .mipLevels = 1, - .arrayLayers = 1, - .samples = VK_SAMPLE_COUNT_1_BIT, - .tiling = tiling, - .usage = usage, - .flags = 0, - .initialLayout = VK_IMAGE_LAYOUT_PREINITIALIZED - }; - VkMemoryAllocateInfo mem_alloc = { - .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, - .pNext = NULL, - .allocationSize = 0, - .memoryTypeIndex = 0, - }; - - VkMemoryRequirements mem_reqs; - - err = - vkCreateImage(demo->device, &image_create_info, NULL, &tex_obj->image); - assert(!err); - - vkGetImageMemoryRequirements(demo->device, tex_obj->image, &mem_reqs); - - mem_alloc.allocationSize = mem_reqs.size; - pass = - memory_type_from_properties(demo, mem_reqs.memoryTypeBits, - required_props, &mem_alloc.memoryTypeIndex); - assert(pass); - - /* allocate memory */ - err = vkAllocateMemory(demo->device, &mem_alloc, NULL, &tex_obj->mem); - assert(!err); - - /* bind memory */ - err = vkBindImageMemory(demo->device, tex_obj->image, tex_obj->mem, 0); - assert(!err); - - if (required_props & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) { - const VkImageSubresource subres = { - .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, - .mipLevel = 0, - .arrayLayer = 0, - }; - VkSubresourceLayout layout; - void *data; - int32_t x, y; - - vkGetImageSubresourceLayout(demo->device, tex_obj->image, &subres, - &layout); - - err = vkMapMemory(demo->device, tex_obj->mem, 0, - mem_alloc.allocationSize, 0, &data); - assert(!err); - - for (y = 0; y < tex_height; y++) { - uint32_t *row = (uint32_t *)((char *)data + layout.rowPitch * y); - for (x = 0; x < tex_width; x++) - row[x] = tex_colors[(x & 1) ^ (y & 1)]; - } - - vkUnmapMemory(demo->device, tex_obj->mem); - } - - tex_obj->imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; - demo_set_image_layout(demo, tex_obj->image, VK_IMAGE_ASPECT_COLOR_BIT, - VK_IMAGE_LAYOUT_PREINITIALIZED, tex_obj->imageLayout, - VK_ACCESS_HOST_WRITE_BIT); - /* setting the image layout does not reference the actual memory so no need - * to add a mem ref */ -} - -static void demo_destroy_texture_image(struct demo *demo, - struct texture_object *tex_obj) { - /* clean up staging resources */ - vkDestroyImage(demo->device, tex_obj->image, NULL); - vkFreeMemory(demo->device, tex_obj->mem, NULL); -} - -static void demo_prepare_textures(struct demo *demo) { - const VkFormat tex_format = VK_FORMAT_B8G8R8A8_UNORM; - VkFormatProperties props; - const uint32_t tex_colors[DEMO_TEXTURE_COUNT][2] = { - {0xffff0000, 0xff00ff00}, - }; - uint32_t i; - VkResult U_ASSERT_ONLY err; - - vkGetPhysicalDeviceFormatProperties(demo->gpu, tex_format, &props); - - for (i = 0; i < DEMO_TEXTURE_COUNT; i++) { - if ((props.linearTilingFeatures & - VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) && - !demo->use_staging_buffer) { - /* Device can texture using linear textures */ - demo_prepare_texture_image( - demo, tex_colors[i], &demo->textures[i], VK_IMAGE_TILING_LINEAR, - VK_IMAGE_USAGE_SAMPLED_BIT, - VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | - VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); - } else if (props.optimalTilingFeatures & - VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) { - /* Must use staging buffer to copy linear texture to optimized */ - struct texture_object staging_texture; - - memset(&staging_texture, 0, sizeof(staging_texture)); - demo_prepare_texture_image( - demo, tex_colors[i], &staging_texture, VK_IMAGE_TILING_LINEAR, - VK_IMAGE_USAGE_TRANSFER_SRC_BIT, - VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | - VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); - - demo_prepare_texture_image( - demo, tex_colors[i], &demo->textures[i], - VK_IMAGE_TILING_OPTIMAL, - (VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT), - VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); - - demo_set_image_layout(demo, staging_texture.image, - VK_IMAGE_ASPECT_COLOR_BIT, - staging_texture.imageLayout, - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, - 0); - - demo_set_image_layout(demo, demo->textures[i].image, - VK_IMAGE_ASPECT_COLOR_BIT, - demo->textures[i].imageLayout, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - 0); - - VkImageCopy copy_region = { - .srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, - .srcOffset = {0, 0, 0}, - .dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, - .dstOffset = {0, 0, 0}, - .extent = {staging_texture.tex_width, - staging_texture.tex_height, 1}, - }; - vkCmdCopyImage( - demo->setup_cmd, staging_texture.image, - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, demo->textures[i].image, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ©_region); - - demo_set_image_layout(demo, demo->textures[i].image, - VK_IMAGE_ASPECT_COLOR_BIT, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - demo->textures[i].imageLayout, - 0); - - demo_flush_init_cmd(demo); - - demo_destroy_texture_image(demo, &staging_texture); - } else { - /* Can't support VK_FORMAT_B8G8R8A8_UNORM !? */ - assert(!"No support for B8G8R8A8_UNORM as texture image format"); - } - - const VkSamplerCreateInfo sampler = { - .sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, - .pNext = NULL, - .magFilter = VK_FILTER_NEAREST, - .minFilter = VK_FILTER_NEAREST, - .mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST, - .addressModeU = VK_SAMPLER_ADDRESS_MODE_REPEAT, - .addressModeV = VK_SAMPLER_ADDRESS_MODE_REPEAT, - .addressModeW = VK_SAMPLER_ADDRESS_MODE_REPEAT, - .mipLodBias = 0.0f, - .anisotropyEnable = VK_FALSE, - .maxAnisotropy = 1, - .compareOp = VK_COMPARE_OP_NEVER, - .minLod = 0.0f, - .maxLod = 0.0f, - .borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE, - .unnormalizedCoordinates = VK_FALSE, - }; - VkImageViewCreateInfo view = { - .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, - .pNext = NULL, - .image = VK_NULL_HANDLE, - .viewType = VK_IMAGE_VIEW_TYPE_2D, - .format = tex_format, - .components = - { - VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, - VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A, - }, - .subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}, - .flags = 0, - }; - - /* create sampler */ - err = vkCreateSampler(demo->device, &sampler, NULL, - &demo->textures[i].sampler); - assert(!err); - - /* create image view */ - view.image = demo->textures[i].image; - err = vkCreateImageView(demo->device, &view, NULL, - &demo->textures[i].view); - assert(!err); - } -} - -static void demo_prepare_vertices(struct demo *demo) { - // clang-format off - const float vb[3][5] = { - /* position texcoord */ - { -1.0f, -1.0f, 0.25f, 0.0f, 0.0f }, - { 1.0f, -1.0f, 0.25f, 1.0f, 0.0f }, - { 0.0f, 1.0f, 1.0f, 0.5f, 1.0f }, - }; - // clang-format on - const VkBufferCreateInfo buf_info = { - .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, - .pNext = NULL, - .size = sizeof(vb), - .usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, - .flags = 0, - }; - VkMemoryAllocateInfo mem_alloc = { - .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, - .pNext = NULL, - .allocationSize = 0, - .memoryTypeIndex = 0, - }; - VkMemoryRequirements mem_reqs; - VkResult U_ASSERT_ONLY err; - bool U_ASSERT_ONLY pass; - void *data; - - memset(&demo->vertices, 0, sizeof(demo->vertices)); - - err = vkCreateBuffer(demo->device, &buf_info, NULL, &demo->vertices.buf); - assert(!err); - - vkGetBufferMemoryRequirements(demo->device, demo->vertices.buf, &mem_reqs); - assert(!err); - - mem_alloc.allocationSize = mem_reqs.size; - pass = memory_type_from_properties(demo, mem_reqs.memoryTypeBits, - VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | - VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, - &mem_alloc.memoryTypeIndex); - assert(pass); - - err = vkAllocateMemory(demo->device, &mem_alloc, NULL, &demo->vertices.mem); - assert(!err); - - err = vkMapMemory(demo->device, demo->vertices.mem, 0, - mem_alloc.allocationSize, 0, &data); - assert(!err); - - memcpy(data, vb, sizeof(vb)); - - vkUnmapMemory(demo->device, demo->vertices.mem); - - err = vkBindBufferMemory(demo->device, demo->vertices.buf, - demo->vertices.mem, 0); - assert(!err); - - demo->vertices.vi.sType = - VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; - demo->vertices.vi.pNext = NULL; - demo->vertices.vi.vertexBindingDescriptionCount = 1; - demo->vertices.vi.pVertexBindingDescriptions = demo->vertices.vi_bindings; - demo->vertices.vi.vertexAttributeDescriptionCount = 2; - demo->vertices.vi.pVertexAttributeDescriptions = demo->vertices.vi_attrs; - - demo->vertices.vi_bindings[0].binding = VERTEX_BUFFER_BIND_ID; - demo->vertices.vi_bindings[0].stride = sizeof(vb[0]); - demo->vertices.vi_bindings[0].inputRate = VK_VERTEX_INPUT_RATE_VERTEX; - - demo->vertices.vi_attrs[0].binding = VERTEX_BUFFER_BIND_ID; - demo->vertices.vi_attrs[0].location = 0; - demo->vertices.vi_attrs[0].format = VK_FORMAT_R32G32B32_SFLOAT; - demo->vertices.vi_attrs[0].offset = 0; - - demo->vertices.vi_attrs[1].binding = VERTEX_BUFFER_BIND_ID; - demo->vertices.vi_attrs[1].location = 1; - demo->vertices.vi_attrs[1].format = VK_FORMAT_R32G32_SFLOAT; - demo->vertices.vi_attrs[1].offset = sizeof(float) * 3; -} - -static void demo_prepare_descriptor_layout(struct demo *demo) { - const VkDescriptorSetLayoutBinding layout_binding = { - .binding = 0, - .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, - .descriptorCount = DEMO_TEXTURE_COUNT, - .stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT, - .pImmutableSamplers = NULL, - }; - const VkDescriptorSetLayoutCreateInfo descriptor_layout = { - .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, - .pNext = NULL, - .bindingCount = 1, - .pBindings = &layout_binding, - }; - VkResult U_ASSERT_ONLY err; - - err = vkCreateDescriptorSetLayout(demo->device, &descriptor_layout, NULL, - &demo->desc_layout); - assert(!err); - - const VkPipelineLayoutCreateInfo pPipelineLayoutCreateInfo = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, - .pNext = NULL, - .setLayoutCount = 1, - .pSetLayouts = &demo->desc_layout, - }; - - err = vkCreatePipelineLayout(demo->device, &pPipelineLayoutCreateInfo, NULL, - &demo->pipeline_layout); - assert(!err); -} - -static void demo_prepare_render_pass(struct demo *demo) { - const VkAttachmentDescription attachments[2] = { - [0] = - { - .format = demo->format, - .samples = VK_SAMPLE_COUNT_1_BIT, - .loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR, - .storeOp = VK_ATTACHMENT_STORE_OP_STORE, - .stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE, - .stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE, - .initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, - .finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, - }, - [1] = - { - .format = demo->depth.format, - .samples = VK_SAMPLE_COUNT_1_BIT, - .loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR, - .storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE, - .stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE, - .stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE, - .initialLayout = - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, - .finalLayout = - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, - }, - }; - const VkAttachmentReference color_reference = { - .attachment = 0, .layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, - }; - const VkAttachmentReference depth_reference = { - .attachment = 1, - .layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, - }; - const VkSubpassDescription subpass = { - .pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS, - .flags = 0, - .inputAttachmentCount = 0, - .pInputAttachments = NULL, - .colorAttachmentCount = 1, - .pColorAttachments = &color_reference, - .pResolveAttachments = NULL, - .pDepthStencilAttachment = &depth_reference, - .preserveAttachmentCount = 0, - .pPreserveAttachments = NULL, - }; - const VkRenderPassCreateInfo rp_info = { - .sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, - .pNext = NULL, - .attachmentCount = 2, - .pAttachments = attachments, - .subpassCount = 1, - .pSubpasses = &subpass, - .dependencyCount = 0, - .pDependencies = NULL, - }; - VkResult U_ASSERT_ONLY err; - - err = vkCreateRenderPass(demo->device, &rp_info, NULL, &demo->render_pass); - assert(!err); -} - -static VkShaderModule -demo_prepare_shader_module(struct demo *demo, const void *code, size_t size) { - VkShaderModuleCreateInfo moduleCreateInfo; - VkShaderModule module; - VkResult U_ASSERT_ONLY err; - - moduleCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; - moduleCreateInfo.pNext = NULL; - - moduleCreateInfo.codeSize = size; - moduleCreateInfo.pCode = code; - moduleCreateInfo.flags = 0; - err = vkCreateShaderModule(demo->device, &moduleCreateInfo, NULL, &module); - assert(!err); - - return module; -} - -static VkShaderModule demo_prepare_vs(struct demo *demo) { - size_t size = sizeof(vertShaderCode); - - demo->vert_shader_module = - demo_prepare_shader_module(demo, vertShaderCode, size); - - return demo->vert_shader_module; -} - -static VkShaderModule demo_prepare_fs(struct demo *demo) { - size_t size = sizeof(fragShaderCode); - - demo->frag_shader_module = - demo_prepare_shader_module(demo, fragShaderCode, size); - - return demo->frag_shader_module; -} - -static void demo_prepare_pipeline(struct demo *demo) { - VkGraphicsPipelineCreateInfo pipeline; - VkPipelineCacheCreateInfo pipelineCache; - - VkPipelineVertexInputStateCreateInfo vi; - VkPipelineInputAssemblyStateCreateInfo ia; - VkPipelineRasterizationStateCreateInfo rs; - VkPipelineColorBlendStateCreateInfo cb; - VkPipelineDepthStencilStateCreateInfo ds; - VkPipelineViewportStateCreateInfo vp; - VkPipelineMultisampleStateCreateInfo ms; - VkDynamicState dynamicStateEnables[VK_DYNAMIC_STATE_RANGE_SIZE]; - VkPipelineDynamicStateCreateInfo dynamicState; - - VkResult U_ASSERT_ONLY err; - - memset(dynamicStateEnables, 0, sizeof dynamicStateEnables); - memset(&dynamicState, 0, sizeof dynamicState); - dynamicState.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO; - dynamicState.pDynamicStates = dynamicStateEnables; - - memset(&pipeline, 0, sizeof(pipeline)); - pipeline.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; - pipeline.layout = demo->pipeline_layout; - - vi = demo->vertices.vi; - - memset(&ia, 0, sizeof(ia)); - ia.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; - ia.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; - - memset(&rs, 0, sizeof(rs)); - rs.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; - rs.polygonMode = VK_POLYGON_MODE_FILL; - rs.cullMode = VK_CULL_MODE_BACK_BIT; - rs.frontFace = VK_FRONT_FACE_CLOCKWISE; - rs.depthClampEnable = VK_FALSE; - rs.rasterizerDiscardEnable = VK_FALSE; - rs.depthBiasEnable = VK_FALSE; - rs.lineWidth = 1.0f; - - memset(&cb, 0, sizeof(cb)); - cb.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; - VkPipelineColorBlendAttachmentState att_state[1]; - memset(att_state, 0, sizeof(att_state)); - att_state[0].colorWriteMask = 0xf; - att_state[0].blendEnable = VK_FALSE; - cb.attachmentCount = 1; - cb.pAttachments = att_state; - - memset(&vp, 0, sizeof(vp)); - vp.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; - vp.viewportCount = 1; - dynamicStateEnables[dynamicState.dynamicStateCount++] = - VK_DYNAMIC_STATE_VIEWPORT; - vp.scissorCount = 1; - dynamicStateEnables[dynamicState.dynamicStateCount++] = - VK_DYNAMIC_STATE_SCISSOR; - - memset(&ds, 0, sizeof(ds)); - ds.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO; - ds.depthTestEnable = VK_TRUE; - ds.depthWriteEnable = VK_TRUE; - ds.depthCompareOp = VK_COMPARE_OP_LESS_OR_EQUAL; - ds.depthBoundsTestEnable = VK_FALSE; - ds.back.failOp = VK_STENCIL_OP_KEEP; - ds.back.passOp = VK_STENCIL_OP_KEEP; - ds.back.compareOp = VK_COMPARE_OP_ALWAYS; - ds.stencilTestEnable = VK_FALSE; - ds.front = ds.back; - - memset(&ms, 0, sizeof(ms)); - ms.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; - ms.pSampleMask = NULL; - ms.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; - - // Two stages: vs and fs - pipeline.stageCount = 2; - VkPipelineShaderStageCreateInfo shaderStages[2]; - memset(&shaderStages, 0, 2 * sizeof(VkPipelineShaderStageCreateInfo)); - - shaderStages[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; - shaderStages[0].stage = VK_SHADER_STAGE_VERTEX_BIT; - shaderStages[0].module = demo_prepare_vs(demo); - shaderStages[0].pName = "main"; - - shaderStages[1].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; - shaderStages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT; - shaderStages[1].module = demo_prepare_fs(demo); - shaderStages[1].pName = "main"; - - pipeline.pVertexInputState = &vi; - pipeline.pInputAssemblyState = &ia; - pipeline.pRasterizationState = &rs; - pipeline.pColorBlendState = &cb; - pipeline.pMultisampleState = &ms; - pipeline.pViewportState = &vp; - pipeline.pDepthStencilState = &ds; - pipeline.pStages = shaderStages; - pipeline.renderPass = demo->render_pass; - pipeline.pDynamicState = &dynamicState; - - memset(&pipelineCache, 0, sizeof(pipelineCache)); - pipelineCache.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO; - - err = vkCreatePipelineCache(demo->device, &pipelineCache, NULL, - &demo->pipelineCache); - assert(!err); - err = vkCreateGraphicsPipelines(demo->device, demo->pipelineCache, 1, - &pipeline, NULL, &demo->pipeline); - assert(!err); - - vkDestroyPipelineCache(demo->device, demo->pipelineCache, NULL); - - vkDestroyShaderModule(demo->device, demo->frag_shader_module, NULL); - vkDestroyShaderModule(demo->device, demo->vert_shader_module, NULL); -} - -static void demo_prepare_descriptor_pool(struct demo *demo) { - const VkDescriptorPoolSize type_count = { - .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, - .descriptorCount = DEMO_TEXTURE_COUNT, - }; - const VkDescriptorPoolCreateInfo descriptor_pool = { - .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, - .pNext = NULL, - .maxSets = 1, - .poolSizeCount = 1, - .pPoolSizes = &type_count, - }; - VkResult U_ASSERT_ONLY err; - - err = vkCreateDescriptorPool(demo->device, &descriptor_pool, NULL, - &demo->desc_pool); - assert(!err); -} - -static void demo_prepare_descriptor_set(struct demo *demo) { - VkDescriptorImageInfo tex_descs[DEMO_TEXTURE_COUNT]; - VkWriteDescriptorSet write; - VkResult U_ASSERT_ONLY err; - uint32_t i; - - VkDescriptorSetAllocateInfo alloc_info = { - .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO, - .pNext = NULL, - .descriptorPool = demo->desc_pool, - .descriptorSetCount = 1, - .pSetLayouts = &demo->desc_layout}; - err = vkAllocateDescriptorSets(demo->device, &alloc_info, &demo->desc_set); - assert(!err); - - memset(&tex_descs, 0, sizeof(tex_descs)); - for (i = 0; i < DEMO_TEXTURE_COUNT; i++) { - tex_descs[i].sampler = demo->textures[i].sampler; - tex_descs[i].imageView = demo->textures[i].view; - tex_descs[i].imageLayout = VK_IMAGE_LAYOUT_GENERAL; - } - - memset(&write, 0, sizeof(write)); - write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - write.dstSet = demo->desc_set; - write.descriptorCount = DEMO_TEXTURE_COUNT; - write.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; - write.pImageInfo = tex_descs; - - vkUpdateDescriptorSets(demo->device, 1, &write, 0, NULL); -} - -static void demo_prepare_framebuffers(struct demo *demo) { - VkImageView attachments[2]; - attachments[1] = demo->depth.view; - - const VkFramebufferCreateInfo fb_info = { - .sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, - .pNext = NULL, - .renderPass = demo->render_pass, - .attachmentCount = 2, - .pAttachments = attachments, - .width = demo->width, - .height = demo->height, - .layers = 1, - }; - VkResult U_ASSERT_ONLY err; - uint32_t i; - - demo->framebuffers = (VkFramebuffer *)malloc(demo->swapchainImageCount * - sizeof(VkFramebuffer)); - assert(demo->framebuffers); - - for (i = 0; i < demo->swapchainImageCount; i++) { - attachments[0] = demo->buffers[i].view; - err = vkCreateFramebuffer(demo->device, &fb_info, NULL, - &demo->framebuffers[i]); - assert(!err); - } -} - -static void demo_prepare(struct demo *demo) { - VkResult U_ASSERT_ONLY err; - - const VkCommandPoolCreateInfo cmd_pool_info = { - .sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, - .pNext = NULL, - .queueFamilyIndex = demo->graphics_queue_node_index, - .flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, - }; - err = vkCreateCommandPool(demo->device, &cmd_pool_info, NULL, - &demo->cmd_pool); - assert(!err); - - const VkCommandBufferAllocateInfo cmd = { - .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, - .pNext = NULL, - .commandPool = demo->cmd_pool, - .level = VK_COMMAND_BUFFER_LEVEL_PRIMARY, - .commandBufferCount = 1, - }; - err = vkAllocateCommandBuffers(demo->device, &cmd, &demo->draw_cmd); - assert(!err); - - demo_prepare_buffers(demo); - demo_prepare_depth(demo); - demo_prepare_textures(demo); - demo_prepare_vertices(demo); - demo_prepare_descriptor_layout(demo); - demo_prepare_render_pass(demo); - demo_prepare_pipeline(demo); - - demo_prepare_descriptor_pool(demo); - demo_prepare_descriptor_set(demo); - - demo_prepare_framebuffers(demo); -} - -static void demo_error_callback(int error, const char* description) { - printf("GLFW error: %s\n", description); - fflush(stdout); -} - -static void demo_key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { - if (key == GLFW_KEY_ESCAPE && action == GLFW_RELEASE) - glfwSetWindowShouldClose(window, GLFW_TRUE); -} - -static void demo_refresh_callback(GLFWwindow* window) { - struct demo* demo = glfwGetWindowUserPointer(window); - demo_draw(demo); -} - -static void demo_resize_callback(GLFWwindow* window, int width, int height) { - struct demo* demo = glfwGetWindowUserPointer(window); - demo->width = width; - demo->height = height; - demo_resize(demo); -} - -static void demo_run(struct demo *demo) { - while (!glfwWindowShouldClose(demo->window)) { - glfwPollEvents(); - - demo_draw(demo); - - if (demo->depthStencil > 0.99f) - demo->depthIncrement = -0.001f; - if (demo->depthStencil < 0.8f) - demo->depthIncrement = 0.001f; - - demo->depthStencil += demo->depthIncrement; - - // Wait for work to finish before updating MVP. - vkDeviceWaitIdle(demo->device); - demo->curFrame++; - if (demo->frameCount != INT32_MAX && demo->curFrame == demo->frameCount) - glfwSetWindowShouldClose(demo->window, GLFW_TRUE); - } -} - -static void demo_create_window(struct demo *demo) { - glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); - - demo->window = glfwCreateWindow(demo->width, - demo->height, - APP_LONG_NAME, - NULL, - NULL); - if (!demo->window) { - // It didn't work, so try to give a useful error: - printf("Cannot create a window in which to draw!\n"); - fflush(stdout); - exit(1); - } - - glfwSetWindowUserPointer(demo->window, demo); - glfwSetWindowRefreshCallback(demo->window, demo_refresh_callback); - glfwSetFramebufferSizeCallback(demo->window, demo_resize_callback); - glfwSetKeyCallback(demo->window, demo_key_callback); -} - -/* - * Return 1 (true) if all layer names specified in check_names - * can be found in given layer properties. - */ -static VkBool32 demo_check_layers(uint32_t check_count, const char **check_names, - uint32_t layer_count, - VkLayerProperties *layers) { - uint32_t i, j; - for (i = 0; i < check_count; i++) { - VkBool32 found = 0; - for (j = 0; j < layer_count; j++) { - if (!strcmp(check_names[i], layers[j].layerName)) { - found = 1; - break; - } - } - if (!found) { - fprintf(stderr, "Cannot find layer: %s\n", check_names[i]); - return 0; - } - } - return 1; -} - -static void demo_init_vk(struct demo *demo) { - VkResult err; - uint32_t i = 0; - uint32_t required_extension_count = 0; - uint32_t instance_extension_count = 0; - uint32_t instance_layer_count = 0; - uint32_t validation_layer_count = 0; - const char **required_extensions = NULL; - const char **instance_validation_layers = NULL; - demo->enabled_extension_count = 0; - demo->enabled_layer_count = 0; - - char *instance_validation_layers_alt1[] = { - "VK_LAYER_LUNARG_standard_validation" - }; - - char *instance_validation_layers_alt2[] = { - "VK_LAYER_GOOGLE_threading", "VK_LAYER_LUNARG_parameter_validation", - "VK_LAYER_LUNARG_object_tracker", "VK_LAYER_LUNARG_image", - "VK_LAYER_LUNARG_core_validation", "VK_LAYER_LUNARG_swapchain", - "VK_LAYER_GOOGLE_unique_objects" - }; - - /* Look for validation layers */ - VkBool32 validation_found = 0; - if (demo->validate) { - - err = vkEnumerateInstanceLayerProperties(&instance_layer_count, NULL); - assert(!err); - - instance_validation_layers = (const char**) instance_validation_layers_alt1; - if (instance_layer_count > 0) { - VkLayerProperties *instance_layers = - malloc(sizeof (VkLayerProperties) * instance_layer_count); - err = vkEnumerateInstanceLayerProperties(&instance_layer_count, - instance_layers); - assert(!err); - - - validation_found = demo_check_layers( - ARRAY_SIZE(instance_validation_layers_alt1), - instance_validation_layers, instance_layer_count, - instance_layers); - if (validation_found) { - demo->enabled_layer_count = ARRAY_SIZE(instance_validation_layers_alt1); - demo->enabled_layers[0] = "VK_LAYER_LUNARG_standard_validation"; - validation_layer_count = 1; - } else { - // use alternative set of validation layers - instance_validation_layers = - (const char**) instance_validation_layers_alt2; - demo->enabled_layer_count = ARRAY_SIZE(instance_validation_layers_alt2); - validation_found = demo_check_layers( - ARRAY_SIZE(instance_validation_layers_alt2), - instance_validation_layers, instance_layer_count, - instance_layers); - validation_layer_count = - ARRAY_SIZE(instance_validation_layers_alt2); - for (i = 0; i < validation_layer_count; i++) { - demo->enabled_layers[i] = instance_validation_layers[i]; - } - } - free(instance_layers); - } - - if (!validation_found) { - ERR_EXIT("vkEnumerateInstanceLayerProperties failed to find " - "required validation layer.\n\n" - "Please look at the Getting Started guide for additional " - "information.\n", - "vkCreateInstance Failure"); - } - } - - /* Look for instance extensions */ - required_extensions = glfwGetRequiredInstanceExtensions(&required_extension_count); - if (!required_extensions) { - ERR_EXIT("glfwGetRequiredInstanceExtensions failed to find the " - "platform surface extensions.\n\nDo you have a compatible " - "Vulkan installable client driver (ICD) installed?\nPlease " - "look at the Getting Started guide for additional " - "information.\n", - "vkCreateInstance Failure"); - } - - for (i = 0; i < required_extension_count; i++) { - demo->extension_names[demo->enabled_extension_count++] = required_extensions[i]; - assert(demo->enabled_extension_count < 64); - } - - err = vkEnumerateInstanceExtensionProperties( - NULL, &instance_extension_count, NULL); - assert(!err); - - if (instance_extension_count > 0) { - VkExtensionProperties *instance_extensions = - malloc(sizeof(VkExtensionProperties) * instance_extension_count); - err = vkEnumerateInstanceExtensionProperties( - NULL, &instance_extension_count, instance_extensions); - assert(!err); - for (i = 0; i < instance_extension_count; i++) { - if (!strcmp(VK_EXT_DEBUG_REPORT_EXTENSION_NAME, - instance_extensions[i].extensionName)) { - if (demo->validate) { - demo->extension_names[demo->enabled_extension_count++] = - VK_EXT_DEBUG_REPORT_EXTENSION_NAME; - } - } - assert(demo->enabled_extension_count < 64); - } - - free(instance_extensions); - } - - const VkApplicationInfo app = { - .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, - .pNext = NULL, - .pApplicationName = APP_SHORT_NAME, - .applicationVersion = 0, - .pEngineName = APP_SHORT_NAME, - .engineVersion = 0, - .apiVersion = VK_API_VERSION_1_0, - }; - VkInstanceCreateInfo inst_info = { - .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, - .pNext = NULL, - .pApplicationInfo = &app, - .enabledLayerCount = demo->enabled_layer_count, - .ppEnabledLayerNames = (const char *const *)instance_validation_layers, - .enabledExtensionCount = demo->enabled_extension_count, - .ppEnabledExtensionNames = (const char *const *)demo->extension_names, - }; - - uint32_t gpu_count; - - err = vkCreateInstance(&inst_info, NULL, &demo->inst); - if (err == VK_ERROR_INCOMPATIBLE_DRIVER) { - ERR_EXIT("Cannot find a compatible Vulkan installable client driver " - "(ICD).\n\nPlease look at the Getting Started guide for " - "additional information.\n", - "vkCreateInstance Failure"); - } else if (err == VK_ERROR_EXTENSION_NOT_PRESENT) { - ERR_EXIT("Cannot find a specified extension library" - ".\nMake sure your layers path is set appropriately\n", - "vkCreateInstance Failure"); - } else if (err) { - ERR_EXIT("vkCreateInstance failed.\n\nDo you have a compatible Vulkan " - "installable client driver (ICD) installed?\nPlease look at " - "the Getting Started guide for additional information.\n", - "vkCreateInstance Failure"); - } - - gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, demo->inst); - - /* Make initial call to query gpu_count, then second call for gpu info*/ - err = vkEnumeratePhysicalDevices(demo->inst, &gpu_count, NULL); - assert(!err && gpu_count > 0); - - if (gpu_count > 0) { - VkPhysicalDevice *physical_devices = - malloc(sizeof(VkPhysicalDevice) * gpu_count); - err = vkEnumeratePhysicalDevices(demo->inst, &gpu_count, - physical_devices); - assert(!err); - /* For tri demo we just grab the first physical device */ - demo->gpu = physical_devices[0]; - free(physical_devices); - } else { - ERR_EXIT("vkEnumeratePhysicalDevices reported zero accessible devices." - "\n\nDo you have a compatible Vulkan installable client" - " driver (ICD) installed?\nPlease look at the Getting Started" - " guide for additional information.\n", - "vkEnumeratePhysicalDevices Failure"); - } - - gladLoadVulkanUserPtr(demo->gpu, glad_vulkan_callback, demo->inst); - - /* Look for device extensions */ - uint32_t device_extension_count = 0; - VkBool32 swapchainExtFound = 0; - demo->enabled_extension_count = 0; - - err = vkEnumerateDeviceExtensionProperties(demo->gpu, NULL, - &device_extension_count, NULL); - assert(!err); - - if (device_extension_count > 0) { - VkExtensionProperties *device_extensions = - malloc(sizeof(VkExtensionProperties) * device_extension_count); - err = vkEnumerateDeviceExtensionProperties( - demo->gpu, NULL, &device_extension_count, device_extensions); - assert(!err); - - for (i = 0; i < device_extension_count; i++) { - if (!strcmp(VK_KHR_SWAPCHAIN_EXTENSION_NAME, - device_extensions[i].extensionName)) { - swapchainExtFound = 1; - demo->extension_names[demo->enabled_extension_count++] = - VK_KHR_SWAPCHAIN_EXTENSION_NAME; - } - assert(demo->enabled_extension_count < 64); - } - - free(device_extensions); - } - - if (!swapchainExtFound) { - ERR_EXIT("vkEnumerateDeviceExtensionProperties failed to find " - "the " VK_KHR_SWAPCHAIN_EXTENSION_NAME - " extension.\n\nDo you have a compatible " - "Vulkan installable client driver (ICD) installed?\nPlease " - "look at the Getting Started guide for additional " - "information.\n", - "vkCreateInstance Failure"); - } - - if (demo->validate) { - VkDebugReportCallbackCreateInfoEXT dbgCreateInfo; - dbgCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT; - dbgCreateInfo.flags = - VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT; - dbgCreateInfo.pfnCallback = demo->use_break ? BreakCallback : dbgFunc; - dbgCreateInfo.pUserData = demo; - dbgCreateInfo.pNext = NULL; - err = vkCreateDebugReportCallbackEXT(demo->inst, &dbgCreateInfo, NULL, - &demo->msg_callback); - switch (err) { - case VK_SUCCESS: - break; - case VK_ERROR_OUT_OF_HOST_MEMORY: - ERR_EXIT("CreateDebugReportCallback: out of host memory\n", - "CreateDebugReportCallback Failure"); - break; - default: - ERR_EXIT("CreateDebugReportCallback: unknown failure\n", - "CreateDebugReportCallback Failure"); - break; - } - } - - vkGetPhysicalDeviceProperties(demo->gpu, &demo->gpu_props); - - // Query with NULL data to get count - vkGetPhysicalDeviceQueueFamilyProperties(demo->gpu, &demo->queue_count, - NULL); - - demo->queue_props = (VkQueueFamilyProperties *)malloc( - demo->queue_count * sizeof(VkQueueFamilyProperties)); - vkGetPhysicalDeviceQueueFamilyProperties(demo->gpu, &demo->queue_count, - demo->queue_props); - assert(demo->queue_count >= 1); - - vkGetPhysicalDeviceFeatures(demo->gpu, &demo->gpu_features); - - // Graphics queue and MemMgr queue can be separate. - // TODO: Add support for separate queues, including synchronization, - // and appropriate tracking for QueueSubmit -} - -static void demo_init_device(struct demo *demo) { - VkResult U_ASSERT_ONLY err; - - float queue_priorities[1] = {0.0}; - const VkDeviceQueueCreateInfo queue = { - .sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, - .pNext = NULL, - .queueFamilyIndex = demo->graphics_queue_node_index, - .queueCount = 1, - .pQueuePriorities = queue_priorities}; - - - VkPhysicalDeviceFeatures features; - memset(&features, 0, sizeof(features)); - if (demo->gpu_features.shaderClipDistance) { - features.shaderClipDistance = VK_TRUE; - } - - VkDeviceCreateInfo device = { - .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, - .pNext = NULL, - .queueCreateInfoCount = 1, - .pQueueCreateInfos = &queue, - .enabledLayerCount = 0, - .ppEnabledLayerNames = NULL, - .enabledExtensionCount = demo->enabled_extension_count, - .ppEnabledExtensionNames = (const char *const *)demo->extension_names, - .pEnabledFeatures = &features, - }; - - err = vkCreateDevice(demo->gpu, &device, NULL, &demo->device); - assert(!err); -} - -static void demo_init_vk_swapchain(struct demo *demo) { - VkResult U_ASSERT_ONLY err; - uint32_t i; - - // Create a WSI surface for the window: - glfwCreateWindowSurface(demo->inst, demo->window, NULL, &demo->surface); - - // Iterate over each queue to learn whether it supports presenting: - VkBool32 *supportsPresent = - (VkBool32 *)malloc(demo->queue_count * sizeof(VkBool32)); - for (i = 0; i < demo->queue_count; i++) { - vkGetPhysicalDeviceSurfaceSupportKHR(demo->gpu, i, demo->surface, - &supportsPresent[i]); - } - - // Search for a graphics and a present queue in the array of queue - // families, try to find one that supports both - uint32_t graphicsQueueNodeIndex = UINT32_MAX; - uint32_t presentQueueNodeIndex = UINT32_MAX; - for (i = 0; i < demo->queue_count; i++) { - if ((demo->queue_props[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) != 0) { - if (graphicsQueueNodeIndex == UINT32_MAX) { - graphicsQueueNodeIndex = i; - } - - if (supportsPresent[i] == VK_TRUE) { - graphicsQueueNodeIndex = i; - presentQueueNodeIndex = i; - break; - } - } - } - if (presentQueueNodeIndex == UINT32_MAX) { - // If didn't find a queue that supports both graphics and present, then - // find a separate present queue. - for (i = 0; i < demo->queue_count; ++i) { - if (supportsPresent[i] == VK_TRUE) { - presentQueueNodeIndex = i; - break; - } - } - } - free(supportsPresent); - - // Generate error if could not find both a graphics and a present queue - if (graphicsQueueNodeIndex == UINT32_MAX || - presentQueueNodeIndex == UINT32_MAX) { - ERR_EXIT("Could not find a graphics and a present queue\n", - "Swapchain Initialization Failure"); - } - - // TODO: Add support for separate queues, including presentation, - // synchronization, and appropriate tracking for QueueSubmit. - // NOTE: While it is possible for an application to use a separate graphics - // and a present queues, this demo program assumes it is only using - // one: - if (graphicsQueueNodeIndex != presentQueueNodeIndex) { - ERR_EXIT("Could not find a common graphics and a present queue\n", - "Swapchain Initialization Failure"); - } - - demo->graphics_queue_node_index = graphicsQueueNodeIndex; - - demo_init_device(demo); - - vkGetDeviceQueue(demo->device, demo->graphics_queue_node_index, 0, - &demo->queue); - - // Get the list of VkFormat's that are supported: - uint32_t formatCount; - err = vkGetPhysicalDeviceSurfaceFormatsKHR(demo->gpu, demo->surface, - &formatCount, NULL); - assert(!err); - VkSurfaceFormatKHR *surfFormats = - (VkSurfaceFormatKHR *)malloc(formatCount * sizeof(VkSurfaceFormatKHR)); - err = vkGetPhysicalDeviceSurfaceFormatsKHR(demo->gpu, demo->surface, - &formatCount, surfFormats); - assert(!err); - // If the format list includes just one entry of VK_FORMAT_UNDEFINED, - // the surface has no preferred format. Otherwise, at least one - // supported format will be returned. - if (formatCount == 1 && surfFormats[0].format == VK_FORMAT_UNDEFINED) { - demo->format = VK_FORMAT_B8G8R8A8_UNORM; - } else { - assert(formatCount >= 1); - demo->format = surfFormats[0].format; - } - demo->color_space = surfFormats[0].colorSpace; - - demo->curFrame = 0; - - // Get Memory information and properties - vkGetPhysicalDeviceMemoryProperties(demo->gpu, &demo->memory_properties); -} - -static void demo_init_connection(struct demo *demo) { - glfwSetErrorCallback(demo_error_callback); - - if (!glfwInit()) { - printf("Cannot initialize GLFW.\nExiting ...\n"); - fflush(stdout); - exit(1); - } - - if (!glfwVulkanSupported()) { - printf("GLFW failed to find the Vulkan loader.\nExiting ...\n"); - fflush(stdout); - exit(1); - } - - gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, NULL); -} - -static void demo_init(struct demo *demo, const int argc, const char *argv[]) -{ - int i; - memset(demo, 0, sizeof(*demo)); - demo->frameCount = INT32_MAX; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "--use_staging") == 0) { - demo->use_staging_buffer = true; - continue; - } - if (strcmp(argv[i], "--break") == 0) { - demo->use_break = true; - continue; - } - if (strcmp(argv[i], "--validate") == 0) { - demo->validate = true; - continue; - } - if (strcmp(argv[i], "--c") == 0 && demo->frameCount == INT32_MAX && - i < argc - 1 && sscanf(argv[i + 1], "%d", &demo->frameCount) == 1 && - demo->frameCount >= 0) { - i++; - continue; - } - - fprintf(stderr, "Usage:\n %s [--use_staging] [--validate] [--break] " - "[--c ]\n", - APP_SHORT_NAME); - fflush(stderr); - exit(1); - } - - demo_init_connection(demo); - demo_init_vk(demo); - - demo->width = 300; - demo->height = 300; - demo->depthStencil = 1.0; - demo->depthIncrement = -0.01f; -} - -static void demo_cleanup(struct demo *demo) { - uint32_t i; - - for (i = 0; i < demo->swapchainImageCount; i++) { - vkDestroyFramebuffer(demo->device, demo->framebuffers[i], NULL); - } - free(demo->framebuffers); - vkDestroyDescriptorPool(demo->device, demo->desc_pool, NULL); - - if (demo->setup_cmd) { - vkFreeCommandBuffers(demo->device, demo->cmd_pool, 1, &demo->setup_cmd); - } - vkFreeCommandBuffers(demo->device, demo->cmd_pool, 1, &demo->draw_cmd); - vkDestroyCommandPool(demo->device, demo->cmd_pool, NULL); - - vkDestroyPipeline(demo->device, demo->pipeline, NULL); - vkDestroyRenderPass(demo->device, demo->render_pass, NULL); - vkDestroyPipelineLayout(demo->device, demo->pipeline_layout, NULL); - vkDestroyDescriptorSetLayout(demo->device, demo->desc_layout, NULL); - - vkDestroyBuffer(demo->device, demo->vertices.buf, NULL); - vkFreeMemory(demo->device, demo->vertices.mem, NULL); - - for (i = 0; i < DEMO_TEXTURE_COUNT; i++) { - vkDestroyImageView(demo->device, demo->textures[i].view, NULL); - vkDestroyImage(demo->device, demo->textures[i].image, NULL); - vkFreeMemory(demo->device, demo->textures[i].mem, NULL); - vkDestroySampler(demo->device, demo->textures[i].sampler, NULL); - } - - for (i = 0; i < demo->swapchainImageCount; i++) { - vkDestroyImageView(demo->device, demo->buffers[i].view, NULL); - } - - vkDestroyImageView(demo->device, demo->depth.view, NULL); - vkDestroyImage(demo->device, demo->depth.image, NULL); - vkFreeMemory(demo->device, demo->depth.mem, NULL); - - vkDestroySwapchainKHR(demo->device, demo->swapchain, NULL); - free(demo->buffers); - - vkDestroyDevice(demo->device, NULL); - if (demo->validate) { - vkDestroyDebugReportCallbackEXT(demo->inst, demo->msg_callback, NULL); - } - vkDestroySurfaceKHR(demo->inst, demo->surface, NULL); - vkDestroyInstance(demo->inst, NULL); - - free(demo->queue_props); - - glfwDestroyWindow(demo->window); - glfwTerminate(); -} - -static void demo_resize(struct demo *demo) { - uint32_t i; - - // In order to properly resize the window, we must re-create the swapchain - // AND redo the command buffers, etc. - // - // First, perform part of the demo_cleanup() function: - - for (i = 0; i < demo->swapchainImageCount; i++) { - vkDestroyFramebuffer(demo->device, demo->framebuffers[i], NULL); - } - free(demo->framebuffers); - vkDestroyDescriptorPool(demo->device, demo->desc_pool, NULL); - - if (demo->setup_cmd) { - vkFreeCommandBuffers(demo->device, demo->cmd_pool, 1, &demo->setup_cmd); - demo->setup_cmd = VK_NULL_HANDLE; - } - vkFreeCommandBuffers(demo->device, demo->cmd_pool, 1, &demo->draw_cmd); - vkDestroyCommandPool(demo->device, demo->cmd_pool, NULL); - - vkDestroyPipeline(demo->device, demo->pipeline, NULL); - vkDestroyRenderPass(demo->device, demo->render_pass, NULL); - vkDestroyPipelineLayout(demo->device, demo->pipeline_layout, NULL); - vkDestroyDescriptorSetLayout(demo->device, demo->desc_layout, NULL); - - vkDestroyBuffer(demo->device, demo->vertices.buf, NULL); - vkFreeMemory(demo->device, demo->vertices.mem, NULL); - - for (i = 0; i < DEMO_TEXTURE_COUNT; i++) { - vkDestroyImageView(demo->device, demo->textures[i].view, NULL); - vkDestroyImage(demo->device, demo->textures[i].image, NULL); - vkFreeMemory(demo->device, demo->textures[i].mem, NULL); - vkDestroySampler(demo->device, demo->textures[i].sampler, NULL); - } - - for (i = 0; i < demo->swapchainImageCount; i++) { - vkDestroyImageView(demo->device, demo->buffers[i].view, NULL); - } - - vkDestroyImageView(demo->device, demo->depth.view, NULL); - vkDestroyImage(demo->device, demo->depth.image, NULL); - vkFreeMemory(demo->device, demo->depth.mem, NULL); - - free(demo->buffers); - - // Second, re-perform the demo_prepare() function, which will re-create the - // swapchain: - demo_prepare(demo); -} - -int main(const int argc, const char *argv[]) { - struct demo demo; - - demo_init(&demo, argc, argv); - demo_create_window(&demo); - demo_init_vk_swapchain(&demo); - - demo_prepare(&demo); - demo_run(&demo); - - demo_cleanup(&demo); - - return validation_error; -} - diff --git a/third_party/penumbra/vendor/glfw/tests/windows.c b/third_party/penumbra/vendor/glfw/tests/windows.c deleted file mode 100644 index 6669856f1e0..00000000000 --- a/third_party/penumbra/vendor/glfw/tests/windows.c +++ /dev/null @@ -1,174 +0,0 @@ -//======================================================================== -// Simple multi-window test -// Copyright (c) Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// -// This test creates four windows and clears each in a different color -// -//======================================================================== - -#include -#define GLFW_INCLUDE_NONE -#include - -#include -#include - -#include "getopt.h" - -static const char* titles[] = -{ - "Red", - "Green", - "Blue", - "Yellow" -}; - -static const struct -{ - float r, g, b; -} colors[] = -{ - { 0.95f, 0.32f, 0.11f }, - { 0.50f, 0.80f, 0.16f }, - { 0.f, 0.68f, 0.94f }, - { 0.98f, 0.74f, 0.04f } -}; - -static void usage(void) -{ - printf("Usage: windows [-h] [-b] [-f] \n"); - printf("Options:\n"); - printf(" -b create decorated windows\n"); - printf(" -f set focus on show off for all but first window\n"); - printf(" -h show this help\n"); -} - -static void error_callback(int error, const char* description) -{ - fprintf(stderr, "Error: %s\n", description); -} - -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (action != GLFW_PRESS) - return; - - switch (key) - { - case GLFW_KEY_SPACE: - { - int xpos, ypos; - glfwGetWindowPos(window, &xpos, &ypos); - glfwSetWindowPos(window, xpos, ypos); - break; - } - - case GLFW_KEY_ESCAPE: - glfwSetWindowShouldClose(window, GLFW_TRUE); - break; - } -} - -int main(int argc, char** argv) -{ - int i, ch; - int decorated = GLFW_FALSE; - int focusOnShow = GLFW_TRUE; - int running = GLFW_TRUE; - GLFWwindow* windows[4]; - - while ((ch = getopt(argc, argv, "bfh")) != -1) - { - switch (ch) - { - case 'b': - decorated = GLFW_TRUE; - break; - case 'f': - focusOnShow = GLFW_FALSE; - break; - case 'h': - usage(); - exit(EXIT_SUCCESS); - default: - usage(); - exit(EXIT_FAILURE); - } - } - - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - glfwWindowHint(GLFW_DECORATED, decorated); - glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); - - for (i = 0; i < 4; i++) - { - int left, top, right, bottom; - if (i) - glfwWindowHint(GLFW_FOCUS_ON_SHOW, focusOnShow); - - windows[i] = glfwCreateWindow(200, 200, titles[i], NULL, NULL); - if (!windows[i]) - { - glfwTerminate(); - exit(EXIT_FAILURE); - } - - glfwSetKeyCallback(windows[i], key_callback); - - glfwMakeContextCurrent(windows[i]); - gladLoadGL(glfwGetProcAddress); - glClearColor(colors[i].r, colors[i].g, colors[i].b, 1.f); - - glfwGetWindowFrameSize(windows[i], &left, &top, &right, &bottom); - glfwSetWindowPos(windows[i], - 100 + (i & 1) * (200 + left + right), - 100 + (i >> 1) * (200 + top + bottom)); - } - - for (i = 0; i < 4; i++) - glfwShowWindow(windows[i]); - - while (running) - { - for (i = 0; i < 4; i++) - { - glfwMakeContextCurrent(windows[i]); - glClear(GL_COLOR_BUFFER_BIT); - glfwSwapBuffers(windows[i]); - - if (glfwWindowShouldClose(windows[i])) - running = GLFW_FALSE; - } - - glfwWaitEvents(); - } - - glfwTerminate(); - exit(EXIT_SUCCESS); -} - diff --git a/third_party/penumbra/vendor/libtess2/Include/tesselator.h b/third_party/penumbra/vendor/libtess2/Include/tesselator.h index 3d431559a1b..cf56287d848 100755 --- a/third_party/penumbra/vendor/libtess2/Include/tesselator.h +++ b/third_party/penumbra/vendor/libtess2/Include/tesselator.h @@ -136,7 +136,7 @@ typedef struct TESSalloc TESSalloc; #define TESS_UNDEF (~(TESSindex)0) -#define TESS_NOTUSED(v) do { (void)(1 ? (void)0 : ( (void)(v) ) ); } while(0) +#define TESS_NOTUSED(v) (void)(v) // Custom memory allocator interface. // The internal memory allocator allocates mesh edges, vertices and faces @@ -236,7 +236,7 @@ int tessGetElementCount( TESStesselator *tess ); const TESSindex* tessGetElements( TESStesselator *tess ); #ifdef __cplusplus -}; +} #endif #endif // TESSELATOR_H diff --git a/third_party/penumbra/vendor/libtess2/Source/bucketalloc.c b/third_party/penumbra/vendor/libtess2/Source/bucketalloc.c index 79e419f6aa0..7d79ae6926e 100755 --- a/third_party/penumbra/vendor/libtess2/Source/bucketalloc.c +++ b/third_party/penumbra/vendor/libtess2/Source/bucketalloc.c @@ -55,15 +55,15 @@ struct BucketAlloc static int CreateBucket( struct BucketAlloc* ba ) { - unsigned int size; + size_t size; Bucket* bucket; void* freelist; unsigned char* head; unsigned char* it; // Allocate memory for the bucket - size = (unsigned int)sizeof(Bucket) + ba->itemSize * ba->bucketSize; - bucket = (Bucket*)ba->alloc->memalloc( ba->alloc->userData, size ); + size = sizeof(Bucket) + (size_t) (ba->itemSize * ba->bucketSize); + bucket = (Bucket*)ba->alloc->memalloc( ba->alloc->userData, (unsigned int) size ); if ( !bucket ) return 0; bucket->next = 0; diff --git a/third_party/penumbra/vendor/libtess2/Source/geom.c b/third_party/penumbra/vendor/libtess2/Source/geom.c index 66005540d48..6d918e1c0ab 100755 --- a/third_party/penumbra/vendor/libtess2/Source/geom.c +++ b/third_party/penumbra/vendor/libtess2/Source/geom.c @@ -216,9 +216,9 @@ void tesedgeIntersect( TESSvertex *o1, TESSvertex *d1, * using the TransLeq ordering to find the intersection t-value. */ - if( ! VertLeq( o1, d1 )) { Swap( o1, d1 ); } - if( ! VertLeq( o2, d2 )) { Swap( o2, d2 ); } - if( ! VertLeq( o1, o2 )) { Swap( o1, o2 ); Swap( d1, d2 ); } + if( ! VertLeq( o1, d1 )) { Swap( o1, d1 ) {}; } + if( ! VertLeq( o2, d2 )) { Swap( o2, d2 ) {}; } + if( ! VertLeq( o1, o2 )) { Swap( o1, o2 ) {}; Swap( d1, d2 ) {}; } if( ! VertLeq( o2, d1 )) { /* Technically, no intersection -- do our best */ @@ -239,9 +239,9 @@ void tesedgeIntersect( TESSvertex *o1, TESSvertex *d1, /* Now repeat the process for t */ - if( ! TransLeq( o1, d1 )) { Swap( o1, d1 ); } - if( ! TransLeq( o2, d2 )) { Swap( o2, d2 ); } - if( ! TransLeq( o1, o2 )) { Swap( o1, o2 ); Swap( d1, d2 ); } + if( ! TransLeq( o1, d1 )) { Swap( o1, d1 ) {}; } + if( ! TransLeq( o2, d2 )) { Swap( o2, d2 ) {}; } + if( ! TransLeq( o1, o2 )) { Swap( o1, o2 ) {}; Swap( d1, d2 ) {}; } if( ! TransLeq( o2, d1 )) { /* Technically, no intersection -- do our best */ @@ -260,34 +260,34 @@ void tesedgeIntersect( TESSvertex *o1, TESSvertex *d1, v->t = Interpolate( z1, o2->t, z2, d2->t ); } } - -TESSreal inCircle( TESSvertex *v, TESSvertex *v0, TESSvertex *v1, TESSvertex *v2 ) { - TESSreal adx, ady, bdx, bdy, cdx, cdy; - TESSreal abdet, bcdet, cadet; - TESSreal alift, blift, clift; - - adx = v0->s - v->s; - ady = v0->t - v->t; - bdx = v1->s - v->s; - bdy = v1->t - v->t; - cdx = v2->s - v->s; - cdy = v2->t - v->t; - - abdet = adx * bdy - bdx * ady; - bcdet = bdx * cdy - cdx * bdy; - cadet = cdx * ady - adx * cdy; - - alift = adx * adx + ady * ady; - blift = bdx * bdx + bdy * bdy; - clift = cdx * cdx + cdy * cdy; - - return alift * bcdet + blift * cadet + clift * abdet; -} + +TESSreal inCircle( TESSvertex *v, TESSvertex *v0, TESSvertex *v1, TESSvertex *v2 ) { + TESSreal adx, ady, bdx, bdy, cdx, cdy; + TESSreal abdet, bcdet, cadet; + TESSreal alift, blift, clift; + + adx = v0->s - v->s; + ady = v0->t - v->t; + bdx = v1->s - v->s; + bdy = v1->t - v->t; + cdx = v2->s - v->s; + cdy = v2->t - v->t; + + abdet = adx * bdy - bdx * ady; + bcdet = bdx * cdy - cdx * bdy; + cadet = cdx * ady - adx * cdy; + + alift = adx * adx + ady * ady; + blift = bdx * bdx + bdy * bdy; + clift = cdx * cdx + cdy * cdy; + + return alift * bcdet + blift * cadet + clift * abdet; +} /* Returns 1 is edge is locally delaunay */ int tesedgeIsLocallyDelaunay( TESShalfEdge *e ) -{ - return inCircle(e->Sym->Lnext->Lnext->Org, e->Lnext->Org, e->Lnext->Lnext->Org, e->Org) < 0; +{ + return inCircle(e->Sym->Lnext->Lnext->Org, e->Lnext->Org, e->Lnext->Lnext->Org, e->Org) < 0; } diff --git a/third_party/penumbra/vendor/libtess2/Source/mesh.c b/third_party/penumbra/vendor/libtess2/Source/mesh.c index a0fa08e577f..16c8a76616d 100755 --- a/third_party/penumbra/vendor/libtess2/Source/mesh.c +++ b/third_party/penumbra/vendor/libtess2/Source/mesh.c @@ -748,7 +748,7 @@ int tessMeshMergeConvexFaces( TESSmesh *mesh, int maxVertsPerFace ) return 1; } -void tessMeshFlipEdge( TESSmesh *mesh, TESShalfEdge *edge ) +void tessMeshFlipEdge( TESShalfEdge *edge ) { TESShalfEdge *a0 = edge; TESShalfEdge *a1 = a0->Lnext; diff --git a/third_party/penumbra/vendor/libtess2/Source/mesh.h b/third_party/penumbra/vendor/libtess2/Source/mesh.h index 479c66f369e..36ab087b444 100755 --- a/third_party/penumbra/vendor/libtess2/Source/mesh.h +++ b/third_party/penumbra/vendor/libtess2/Source/mesh.h @@ -258,7 +258,7 @@ int tessMeshMergeConvexFaces( TESSmesh *mesh, int maxVertsPerFace ); void tessMeshDeleteMesh( TESSalloc* alloc, TESSmesh *mesh ); void tessMeshZapFace( TESSmesh *mesh, TESSface *fZap ); -void tessMeshFlipEdge( TESSmesh *mesh, TESShalfEdge *edge ); +void tessMeshFlipEdge( TESShalfEdge *edge ); #ifdef NDEBUG #define tessMeshCheckMesh( mesh ) diff --git a/third_party/penumbra/vendor/libtess2/Source/priorityq.c b/third_party/penumbra/vendor/libtess2/Source/priorityq.c index 62a6654535e..095e95b6049 100755 --- a/third_party/penumbra/vendor/libtess2/Source/priorityq.c +++ b/third_party/penumbra/vendor/libtess2/Source/priorityq.c @@ -334,7 +334,7 @@ void pqDeletePriorityQ( TESSalloc* alloc, PriorityQ *pq ) #define LT(x,y) (! LEQ(y,x)) #define GT(x,y) (! LEQ(x,y)) -#define Swap(a,b) if(1){PQkey *tmp = *a; *a = *b; *b = tmp;}else +#define Swap(a,b) if(1){PQkey *tmp = *a; *a = *b; *b = tmp;} else /* really tessPqSortInit */ int pqInit( TESSalloc* alloc, PriorityQ *pq ) @@ -382,9 +382,9 @@ int pqInit( TESSalloc* alloc, PriorityQ *pq ) do { do { ++i; } while( GT( **i, *piv )); do { --j; } while( LT( **j, *piv )); - Swap( i, j ); + Swap( i, j ) {}; } while( i < j ); - Swap( i, j ); /* Undo last swap */ + Swap( i, j ) {}; /* Undo last swap */ if( i - p < r - j ) { top->p = j+1; top->r = r; ++top; r = i-1; diff --git a/third_party/penumbra/vendor/libtess2/Source/sweep.c b/third_party/penumbra/vendor/libtess2/Source/sweep.c index 32a56bf4060..5b901ec786f 100755 --- a/third_party/penumbra/vendor/libtess2/Source/sweep.c +++ b/third_party/penumbra/vendor/libtess2/Source/sweep.c @@ -263,7 +263,7 @@ static void FinishRegion( TESStesselator *tess, ActiveRegion *reg ) TESShalfEdge *e = reg->eUp; TESSface *f = e->Lface; - f->inside = reg->inside; + f->inside = (char)reg->inside; f->anEdge = e; /* optimization for tessMeshTessellateMonoRegion() */ DeleteRegion( tess, reg ); } @@ -538,7 +538,7 @@ static int CheckForLeftSplice( TESStesselator *tess, ActiveRegion *regUp ) e = tessMeshSplitEdge( tess->mesh, eUp ); if (e == NULL) longjmp(tess->env,1); if ( !tessMeshSplice( tess->mesh, eLo->Sym, e ) ) longjmp(tess->env,1); - e->Lface->inside = regUp->inside; + e->Lface->inside = (char)regUp->inside; } else { if( EdgeSign( eLo->Dst, eUp->Dst, eLo->Org ) > 0 ) return FALSE; @@ -547,7 +547,7 @@ static int CheckForLeftSplice( TESStesselator *tess, ActiveRegion *regUp ) e = tessMeshSplitEdge( tess->mesh, eLo ); if (e == NULL) longjmp(tess->env,1); if ( !tessMeshSplice( tess->mesh, eUp->Lnext, eLo->Sym ) ) longjmp(tess->env,1); - e->Rface->inside = regUp->inside; + e->Rface->inside = (char)regUp->inside; } return TRUE; } @@ -1135,7 +1135,9 @@ static void InitEdgeDict( TESStesselator *tess ) static void DoneEdgeDict( TESStesselator *tess ) { ActiveRegion *reg; +#ifndef NDEBUG int fixedEdges = 0; +#endif while( (reg = (ActiveRegion *)dictKey( dictMin( tess->dict ))) != NULL ) { /* diff --git a/third_party/penumbra/vendor/libtess2/Source/tess.c b/third_party/penumbra/vendor/libtess2/Source/tess.c index 5f47f8de066..f5e7d755fa5 100755 --- a/third_party/penumbra/vendor/libtess2/Source/tess.c +++ b/third_party/penumbra/vendor/libtess2/Source/tess.c @@ -83,8 +83,8 @@ static void ComputeNormal( TESStesselator *tess, TESSreal norm[3] ) { TESSvertex *v, *v1, *v2; TESSreal c, tLen2, maxLen2; - TESSreal maxVal[3], minVal[3], d1[3], d2[3], tNorm[3]; - TESSvertex *maxVert[3], *minVert[3]; + TESSreal maxVal[3] = {0}, minVal[3] = {0}, d1[3] = {0}, d2[3] = {0}, tNorm[3] = {0}; + TESSvertex *maxVert[3] = {NULL}, *minVert[3] = {NULL}; TESSvertex *vHead = &tess->mesh->vHead; int i; @@ -210,7 +210,7 @@ extern int RandomSweep; void tessProjectPolygon( TESStesselator *tess ) { TESSvertex *v, *vHead = &tess->mesh->vHead; - TESSreal norm[3]; + TESSreal norm[3] = {0}; TESSreal *sUnit, *tUnit; int i, first, computedNormal = FALSE; @@ -380,7 +380,7 @@ int tessMeshTessellateMonoRegion( TESSmesh *mesh, TESSface *face ) */ int tessMeshTessellateInterior( TESSmesh *mesh ) { - TESSface *f, *next; + TESSface *f, *next = {NULL}; /*LINTED*/ for( f = mesh->fHead.next; f != &mesh->fHead; f = next ) { @@ -487,9 +487,9 @@ void tessMeshRefineDelaunay( TESSmesh *mesh, TESSalloc *alloc ) e = stackPop(&stack); e->mark = e->Sym->mark = 0; if (!tesedgeIsLocallyDelaunay(e)) { - TESShalfEdge *edges[4]; + TESShalfEdge *edges[4] = {NULL}; int i; - tessMeshFlipEdge(mesh, e); + tessMeshFlipEdge(e); // for each opposite edge edges[0] = e->Lnext; edges[1] = e->Lprev; @@ -516,7 +516,7 @@ void tessMeshRefineDelaunay( TESSmesh *mesh, TESSalloc *alloc ) */ void tessMeshDiscardExterior( TESSmesh *mesh ) { - TESSface *f, *next; + TESSface *f, *next = {NULL}; /*LINTED*/ for( f = mesh->fHead.next; f != &mesh->fHead; f = next ) { @@ -539,7 +539,7 @@ void tessMeshDiscardExterior( TESSmesh *mesh ) int tessMeshSetWindingNumber( TESSmesh *mesh, int value, int keepOnlyBoundary ) { - TESShalfEdge *e, *eNext; + TESShalfEdge *e, *eNext = {NULL}; for( e = mesh->eHead.next; e != &mesh->eHead; e = eNext ) { eNext = e->next; diff --git a/third_party/penumbra/vendor/libtess2/Source/tess.h b/third_party/penumbra/vendor/libtess2/Source/tess.h index 30fda27bc28..994cef3a92e 100755 --- a/third_party/penumbra/vendor/libtess2/Source/tess.h +++ b/third_party/penumbra/vendor/libtess2/Source/tess.h @@ -46,6 +46,7 @@ extern "C" { //typedef struct TESStesselator TESStesselator; struct TESStesselator { + jmp_buf env; /* place to jump to when memAllocs fail */ /*** state needed for collecting the input data ***/ TESSmesh *mesh; /* stores the input contours, and eventually @@ -83,7 +84,6 @@ struct TESStesselator { TESSalloc alloc; - jmp_buf env; /* place to jump to when memAllocs fail */ }; #ifdef __cplusplus From 0bf6ef5862e84193d86bc55d5eb608f88cf67954 Mon Sep 17 00:00:00 2001 From: Neal Kruis Date: Fri, 1 Sep 2023 15:11:29 -0600 Subject: [PATCH 13/34] Update use of Penumbra in EnergyPlus source. --- src/EnergyPlus/SolarShading.cc | 77 +++++++++++++++++++++------------- src/EnergyPlus/SolarShading.hh | 12 +++++- 2 files changed, 59 insertions(+), 30 deletions(-) diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index c9eb0f0376f..aa5a9a44835 100644 --- a/src/EnergyPlus/SolarShading.cc +++ b/src/EnergyPlus/SolarShading.cc @@ -492,18 +492,10 @@ void GetShadowingInput(EnergyPlusData &state) state.dataSysVars->shadingMethod = ShadingMethod::PolygonClipping; state.dataIPShortCut->cAlphaArgs(aNum) = "PolygonClipping"; #else - auto error_callback = [](const int messageType, const std::string &message, void *contextPtr) { - auto *state = reinterpret_cast(contextPtr); - if (messageType == Pumbra::MSG_ERR) { - ShowSevereError(*state, message); - } else if (messageType == Pumbra::MSG_WARN) { - ShowWarningError(*state, message); - } else { // if (messageType == MSG_INFO) - ShowMessage(*state, message); - } - }; - if (Pumbra::Penumbra::isValidContext()) { - state.dataSolarShading->penumbra = std::make_unique(error_callback, &state, pixelRes); + if (Penumbra::Penumbra::is_valid_context()) { + std::shared_ptr penumbra_logger = std::make_shared(); + penumbra_logger->set_message_context(&state); + state.dataSolarShading->penumbra = std::make_unique(pixelRes, penumbra_logger); } else { ShowWarningError(state, "No GPU found (required for PixelCounting)"); ShowContinueError(state, "PolygonClipping will be used instead"); @@ -5271,7 +5263,7 @@ void DetermineShadowingCombinations(EnergyPlusData &state) if (!skipSurface) { // Add surfaces to penumbra... - Pumbra::Polygon poly; + Penumbra::Polygon poly; if (state.dataSurface->Surface(GRSNR).Reveal > 0.0) { Real64 R = state.dataSurface->Surface(GRSNR).Reveal; @@ -5289,7 +5281,7 @@ void DetermineShadowingCombinations(EnergyPlusData &state) vPrev = v[i - 1]; } - Pumbra::Polygon rPoly; // Reveal surface + Penumbra::Polygon rPoly; // Reveal surface rPoly.push_back(v[i].x); rPoly.push_back(v[i].y); rPoly.push_back(v[i].z); @@ -5306,8 +5298,8 @@ void DetermineShadowingCombinations(EnergyPlusData &state) rPoly.push_back(vPrev.y); rPoly.push_back(vPrev.z); - Pumbra::Surface rSurf(rPoly); - state.dataSolarShading->penumbra->addSurface(rSurf); + Penumbra::Surface rSurf(rPoly, fmt::format("{} reveal {}", state.dataSurface->Surface(GRSNR).Name, i)); + state.dataSolarShading->penumbra->add_surface(rSurf); } } else { for (auto const &v : state.dataSurface->Surface(GRSNR).Vertex) { @@ -5316,7 +5308,7 @@ void DetermineShadowingCombinations(EnergyPlusData &state) poly.push_back(v.z); } } - Pumbra::Surface pSurf(poly); + Penumbra::Surface pSurf(poly, state.dataSurface->Surface(GRSNR).Name); // Punch holes for subsurfaces if (state.dataSurface->Surface(GRSNR).BaseSurf == GRSNR) { // Only look for subsurfaces on base surfaces @@ -5325,7 +5317,7 @@ void DetermineShadowingCombinations(EnergyPlusData &state) if (!state.dataSurface->Surface(subSurface).HeatTransSurf) continue; // Skip non heat transfer subsurfaces if (subSurface == GRSNR) continue; // Surface itself cannot be its own subsurface - Pumbra::Polygon subPoly; + Penumbra::Polygon subPoly; if (state.dataSurface->Surface(subSurface).Reveal > 0.0) { Real64 R = state.dataSurface->Surface(subSurface).Reveal; auto &norm = state.dataSurface->Surface(subSurface).NewellSurfaceNormalVector; @@ -5342,10 +5334,10 @@ void DetermineShadowingCombinations(EnergyPlusData &state) } } - pSurf.addHole(subPoly); + pSurf.add_hole(subPoly); } } - state.dataSurface->SurfPenumbraID(GRSNR) = state.dataSolarShading->penumbra->addSurface(pSurf); + state.dataSurface->SurfPenumbraID(GRSNR) = state.dataSolarShading->penumbra->add_surface(pSurf); state.dataSolarShading->penumbraIDs.push_back(state.dataSurface->SurfPenumbraID(GRSNR)); } } @@ -5618,8 +5610,8 @@ void DetermineShadowingCombinations(EnergyPlusData &state) CastingSurface.deallocate(); #ifndef EP_NO_OPENGL - if (state.dataSolarShading->penumbra && state.dataSolarShading->penumbra->getNumSurfaces() > 0) { - state.dataSolarShading->penumbra->setModel(); + if (state.dataSolarShading->penumbra && state.dataSolarShading->penumbra->get_number_of_surfaces() > 0) { + state.dataSolarShading->penumbra->set_model(); } #endif } @@ -5681,8 +5673,8 @@ void SHADOW(EnergyPlusData &state, if (state.dataSolarShading->penumbra) { Real64 ElevSun = Constant::PiOvr2 - std::acos(state.dataSolarShading->SUNCOS(3)); Real64 AzimSun = std::atan2(state.dataSolarShading->SUNCOS(1), state.dataSolarShading->SUNCOS(2)); - state.dataSolarShading->penumbra->setSunPosition(AzimSun, ElevSun); - state.dataSolarShading->penumbra->submitPSSA(); + state.dataSolarShading->penumbra->set_sun_position(AzimSun, ElevSun); + state.dataSolarShading->penumbra->submit_pssa(); } #endif @@ -5718,7 +5710,7 @@ void SHADOW(EnergyPlusData &state, if (state.dataSolarShading->penumbra && id >= 0) { // SurfSunlitArea(HTS) = buildingPSSF.at(id) / SurfSunCosTheta(HTS); state.dataSolarShading->SurfSunlitArea(HTS) = - state.dataSolarShading->penumbra->fetchPSSA(id) / state.dataSolarShading->SurfSunCosTheta(HTS); + state.dataSolarShading->penumbra->retrieve_pssa(id) / state.dataSolarShading->SurfSunCosTheta(HTS); // SurfSunlitArea(HTS) = penumbra->fetchPSSA(Surface(HTS).PenumbraID)/SurfSunCosTheta(HTS); for (int SS = 1; SS <= NSBS; ++SS) { int HTSS = state.dataShadowComb->ShadowComb(HTS).SubSurf(SS); @@ -5726,7 +5718,7 @@ void SHADOW(EnergyPlusData &state, if (id >= 0) { // SurfSunlitArea(HTSS) = buildingPSSF.at(id) / SurfSunCosTheta(HTSS); state.dataSolarShading->SurfSunlitArea(HTSS) = - state.dataSolarShading->penumbra->fetchPSSA(id) / state.dataSolarShading->SurfSunCosTheta(HTSS); + state.dataSolarShading->penumbra->retrieve_pssa(id) / state.dataSolarShading->SurfSunCosTheta(HTSS); // SurfSunlitArea(HTSS) = penumbra->fetchPSSA(Surface(HTSS).PenumbraID)/SurfSunCosTheta(HTSS); if (state.dataSolarShading->SurfSunlitArea(HTSS) > 0.0) { if (iHour > 0 && TS > 0) @@ -6269,7 +6261,7 @@ void CalcInteriorSolarOverlaps(EnergyPlusData &state, if (!UseSimpleDistribution) { // Compute overlaps - std::map pssas; + std::unordered_map pssas; #ifndef EP_NO_OPENGL if (state.dataSolarShading->penumbra) { @@ -6281,8 +6273,9 @@ void CalcInteriorSolarOverlaps(EnergyPlusData &state, pbBackSurfaces.push_back(state.dataSurface->SurfPenumbraID(bkSurfNum)); } } - pssas = state.dataSolarShading->penumbra->calculateInteriorPSSAs({(unsigned)state.dataSurface->SurfPenumbraID(HTSS)}, pbBackSurfaces); - // penumbra->renderInteriorScene({(unsigned)Surface(HTSS).PenumbraID}, pbBackSurfaces); + pssas = + state.dataSolarShading->penumbra->calculate_interior_pssas({(unsigned)state.dataSurface->SurfPenumbraID(HTSS)}, pbBackSurfaces); + // penumbra->render_interior_scene({(unsigned)Surface(HTSS).PenumbraID}, pbBackSurfaces); JBKS = 0; for (int bkSurfNum : state.dataShadowComb->ShadowComb(GRSNR).BackSurf) { @@ -12925,3 +12918,29 @@ void TimestepInitComplexFenestration(EnergyPlusData &state) } } // namespace EnergyPlus::SolarShading + +namespace EnergyPlus { + +void EnergyPlusLogger::error(const std::string_view message) +{ + auto *state = reinterpret_cast(message_context); + std::string message_string(message); + ShowSevereError(*state, message_string); +} +void EnergyPlusLogger::warning(const std::string_view message) +{ + auto *state = reinterpret_cast(message_context); + std::string message_string(message); + ShowWarningError(*state, message_string); +} +void EnergyPlusLogger::info(const std::string_view message) +{ + auto *state = reinterpret_cast(message_context); + std::string message_string(message); + ShowMessage(*state, message_string); +} +void EnergyPlusLogger::debug(const std::string_view message) +{ + info(message); +} +} // namespace EnergyPlus diff --git a/src/EnergyPlus/SolarShading.hh b/src/EnergyPlus/SolarShading.hh index 0d0bd6ca9b0..6d98ecfd325 100644 --- a/src/EnergyPlus/SolarShading.hh +++ b/src/EnergyPlus/SolarShading.hh @@ -430,7 +430,7 @@ struct SolarShadingData : BaseGlobalStruct #ifdef EP_NO_OPENGL bool penumbra = false; #else - std::unique_ptr penumbra = nullptr; + std::unique_ptr penumbra = nullptr; #endif bool GetInputFlag = true; @@ -642,6 +642,16 @@ struct SolarShadingData : BaseGlobalStruct { } }; + +class EnergyPlusLogger : public Courierr::Courierr +{ +public: + void error(const std::string_view message) override; + void warning(const std::string_view message) override; + void info(const std::string_view message) override; + void debug(const std::string_view message) override; +}; + } // namespace EnergyPlus #endif From 7fe6676db345e8fc8dae108e2564eac0feeffc35 Mon Sep 17 00:00:00 2001 From: Neal Kruis Date: Tue, 5 Sep 2023 12:19:09 -0600 Subject: [PATCH 14/34] Update penumbra unit test. --- tst/EnergyPlus/unit/SolarShading.unit.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tst/EnergyPlus/unit/SolarShading.unit.cc b/tst/EnergyPlus/unit/SolarShading.unit.cc index e1c5f293b9e..8d9634acf9c 100644 --- a/tst/EnergyPlus/unit/SolarShading.unit.cc +++ b/tst/EnergyPlus/unit/SolarShading.unit.cc @@ -3889,7 +3889,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_Warn_Pixel_Count_and_TM_Schedule) EXPECT_EQ(state->dataErrTracking->TotalSevereErrors, 0); EXPECT_EQ(state->dataErrTracking->LastSevereError, ""); #else - if (!Pumbra::Penumbra::isValidContext()) { + if (!Penumbra::Penumbra::is_valid_context()) { EXPECT_EQ(state->dataErrTracking->TotalWarningErrors, 1); EXPECT_EQ(state->dataErrTracking->TotalSevereErrors, 0); EXPECT_EQ(state->dataErrTracking->LastSevereError, ""); From b030f530a9161375397e03faa526983d9c1fd28b Mon Sep 17 00:00:00 2001 From: Neal Kruis Date: Tue, 5 Sep 2023 12:24:01 -0600 Subject: [PATCH 15/34] Update to latest penumbra changes. --- third_party/penumbra/src/gl/context.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/third_party/penumbra/src/gl/context.cpp b/third_party/penumbra/src/gl/context.cpp index 9fe66dbe833..9eac598a15d 100644 --- a/third_party/penumbra/src/gl/context.cpp +++ b/third_party/penumbra/src/gl/context.cpp @@ -544,7 +544,7 @@ std::vector Context::retrieve_pssas(const std::vector &surf std::vector pssas; pssas.reserve(surface_indices.size()); for (const unsigned int surface_index : surface_indices) { - pssas.emplace_back(retrieve_pssa(surface_index)); + pssas.push_back(retrieve_pssa(surface_index)); } return pssas; } @@ -553,7 +553,7 @@ std::vector Context::retrieve_pssa() { std::vector pssas; pssas.reserve(model.surface_buffers.size()); for (auto const &surface_buffer : model.surface_buffers) { - pssas.emplace_back(retrieve_pssa(surface_buffer.index)); + pssas.push_back(retrieve_pssa(surface_buffer.index)); } return pssas; } From cd412678574babbae85ca80e6e5d160f950540d0 Mon Sep 17 00:00:00 2001 From: Neal Kruis Date: Fri, 8 Sep 2023 10:53:56 -0600 Subject: [PATCH 16/34] Do not make logger for penumbra if OpenGL is not used. --- src/EnergyPlus/SolarShading.cc | 2 ++ src/EnergyPlus/SolarShading.hh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index aa5a9a44835..1f7947f1a52 100644 --- a/src/EnergyPlus/SolarShading.cc +++ b/src/EnergyPlus/SolarShading.cc @@ -12919,6 +12919,7 @@ void TimestepInitComplexFenestration(EnergyPlusData &state) } // namespace EnergyPlus::SolarShading +#ifndef EP_NO_OPENGL namespace EnergyPlus { void EnergyPlusLogger::error(const std::string_view message) @@ -12944,3 +12945,4 @@ void EnergyPlusLogger::debug(const std::string_view message) info(message); } } // namespace EnergyPlus +#endif diff --git a/src/EnergyPlus/SolarShading.hh b/src/EnergyPlus/SolarShading.hh index 6d98ecfd325..e19713a72d9 100644 --- a/src/EnergyPlus/SolarShading.hh +++ b/src/EnergyPlus/SolarShading.hh @@ -643,6 +643,7 @@ struct SolarShadingData : BaseGlobalStruct } }; +#ifndef EP_NO_OPENGL class EnergyPlusLogger : public Courierr::Courierr { public: @@ -651,6 +652,7 @@ public: void info(const std::string_view message) override; void debug(const std::string_view message) override; }; +#endif } // namespace EnergyPlus From 00abc23fca829a7dc7e1cfa25c2e3c014e7ef81a Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Tue, 12 Sep 2023 22:24:49 +0200 Subject: [PATCH 17/34] Fix #10210 - add Calendar Year to ERL, C and Python API * ERL: CalendarYear * C: calendarYear * python: calendar_year --- .../energyplus-runtime-language/variables.tex | 3 ++- src/EnergyPlus/RuntimeLanguageProcessor.cc | 3 +++ src/EnergyPlus/RuntimeLanguageProcessor.hh | 2 ++ src/EnergyPlus/api/datatransfer.cc | 6 ++++++ src/EnergyPlus/api/datatransfer.h | 12 ++++++++++-- src/EnergyPlus/api/datatransfer.py | 18 +++++++++++++++++- src/EnergyPlus/api/plugin_tester.py | 1 + 7 files changed, 41 insertions(+), 4 deletions(-) diff --git a/doc/ems-application-guide/src/energyplus-runtime-language/variables.tex b/doc/ems-application-guide/src/energyplus-runtime-language/variables.tex index 19fe10f8d28..10c4fd9fedc 100644 --- a/doc/ems-application-guide/src/energyplus-runtime-language/variables.tex +++ b/doc/ems-application-guide/src/energyplus-runtime-language/variables.tex @@ -79,7 +79,8 @@ \subsection{Built-In Variables}\label{built-in-variables} \midrule \endhead -Year & 1900--2100 \tabularnewline +Year & 1900--2100 (Read from EPW) \tabularnewline +CalendarYear & 1900--2100 (Assigned from RunPeriod - only valid for Weather File Run Periods) \tabularnewline Month & 1--12 \tabularnewline DayOfMonth & 1--31 \tabularnewline DayOfWeek & 1--7 (1 = Sun, 2 = Mon, \ldots) \tabularnewline diff --git a/src/EnergyPlus/RuntimeLanguageProcessor.cc b/src/EnergyPlus/RuntimeLanguageProcessor.cc index 9b7f581d62c..a1786069fd3 100644 --- a/src/EnergyPlus/RuntimeLanguageProcessor.cc +++ b/src/EnergyPlus/RuntimeLanguageProcessor.cc @@ -138,6 +138,7 @@ void InitializeRuntimeLanguage(EnergyPlusData &state) // Create dynamic built-in variables state.dataRuntimeLangProcessor->YearVariableNum = NewEMSVariable(state, "YEAR", 0); + state.dataRuntimeLangProcessor->CalendarYearVariableNum = NewEMSVariable(state, "CALENDARYEAR", 0); state.dataRuntimeLangProcessor->MonthVariableNum = NewEMSVariable(state, "MONTH", 0); state.dataRuntimeLangProcessor->DayOfMonthVariableNum = NewEMSVariable(state, "DAYOFMONTH", 0); // 'DAYOFMONTH'? state.dataRuntimeLangProcessor->DayOfWeekVariableNum = NewEMSVariable(state, "DAYOFWEEK", 0); @@ -180,6 +181,8 @@ void InitializeRuntimeLanguage(EnergyPlusData &state) // Update built-in variables state.dataRuntimeLang->ErlVariable(state.dataRuntimeLangProcessor->YearVariableNum).Value = SetErlValueNumber(double(state.dataEnvrn->Year)); + state.dataRuntimeLang->ErlVariable(state.dataRuntimeLangProcessor->CalendarYearVariableNum).Value = + SetErlValueNumber(double(state.dataGlobal->CalendarYear)); state.dataRuntimeLang->ErlVariable(state.dataRuntimeLangProcessor->MonthVariableNum).Value = SetErlValueNumber(double(state.dataEnvrn->Month)); state.dataRuntimeLang->ErlVariable(state.dataRuntimeLangProcessor->DayOfMonthVariableNum).Value = SetErlValueNumber(double(state.dataEnvrn->DayOfMonth)); diff --git a/src/EnergyPlus/RuntimeLanguageProcessor.hh b/src/EnergyPlus/RuntimeLanguageProcessor.hh index 53cb57beb52..45c740a960a 100644 --- a/src/EnergyPlus/RuntimeLanguageProcessor.hh +++ b/src/EnergyPlus/RuntimeLanguageProcessor.hh @@ -218,6 +218,7 @@ struct RuntimeLanguageProcessorData : BaseGlobalStruct Array1D_int CurveIndexVariableNums; Array1D_int ConstructionIndexVariableNums; int YearVariableNum = 0; + int CalendarYearVariableNum = 0; int MonthVariableNum = 0; int DayOfMonthVariableNum = 0; int DayOfWeekVariableNum = 0; @@ -259,6 +260,7 @@ struct RuntimeLanguageProcessorData : BaseGlobalStruct this->CurveIndexVariableNums.clear(); this->ConstructionIndexVariableNums.clear(); this->YearVariableNum = 0; + this->CalendarYearVariableNum = 0; this->MonthVariableNum = 0; this->DayOfMonthVariableNum = 0; this->DayOfWeekVariableNum = 0; diff --git a/src/EnergyPlus/api/datatransfer.cc b/src/EnergyPlus/api/datatransfer.cc index ca11e2f7a2c..a9ab50b3b85 100644 --- a/src/EnergyPlus/api/datatransfer.cc +++ b/src/EnergyPlus/api/datatransfer.cc @@ -784,6 +784,12 @@ int year(EnergyPlusState state) return thisState->dataEnvrn->Year; } +int calendarYear(EnergyPlusState state) +{ + auto *thisState = reinterpret_cast(state); + return thisState->dataGlobal->CalendarYear; +} + int month(EnergyPlusState state) { auto *thisState = reinterpret_cast(state); diff --git a/src/EnergyPlus/api/datatransfer.h b/src/EnergyPlus/api/datatransfer.h index 4f3566779c5..3a3a532ef7a 100644 --- a/src/EnergyPlus/api/datatransfer.h +++ b/src/EnergyPlus/api/datatransfer.h @@ -423,13 +423,21 @@ ENERGYPLUSLIB_API Real64 getPluginTrendVariableDirection(EnergyPlusState state, // ----- FUNCTIONS RELATED TO MISC CURRENT SIMULATION STATE -/// \brief Returns the current year of the simulation. +/// \brief Returns the current year of the simulation, taken from the EPW. +/// \details This is directly read from the EPW, and as such, if the EPW is for example a TMY3 file +/// the year could be set to an abritrary number and change from one timestep to the next. See calendarYear for an alternative +/// \param[in] state An active EnergyPlusState instance created with `stateNew`. +/// \remark The behavior of this function is not well-defined until the `apiDataFullyReady` function returns true. +/// \see apiDataFullyReady +ENERGYPLUSLIB_API int year(EnergyPlusState state); + +/// \brief Returns the Calendar Year of the simulation (based on the RunPeriod object). Only valid for weather file run periods. /// \details A simulation can span multiple years and will always have a "meaningful" year that is either user-defined explicitly, /// determined based on other inputs in the input file, or chosen as the current year. /// \param[in] state An active EnergyPlusState instance created with `stateNew`. /// \remark The behavior of this function is not well-defined until the `apiDataFullyReady` function returns true. /// \see apiDataFullyReady -ENERGYPLUSLIB_API int year(EnergyPlusState state); +ENERGYPLUSLIB_API int calendarYear(EnergyPlusState state); /// \brief Returns the current month of the simulation, from 1 for January to 12 for December. /// \param[in] state An active EnergyPlusState instance created with `stateNew`. diff --git a/src/EnergyPlus/api/datatransfer.py b/src/EnergyPlus/api/datatransfer.py index c6cde478ba1..b8098520e6d 100644 --- a/src/EnergyPlus/api/datatransfer.py +++ b/src/EnergyPlus/api/datatransfer.py @@ -162,6 +162,8 @@ def __init__(self, api: cdll, running_as_python_plugin: bool = False): # some simulation data values are available for plugins or regular runtime calls self.api.year.argtypes = [c_void_p] self.api.year.restype = c_int + self.api.calendarYear.argtypes = [c_void_p] + self.api.calendarYear.restype = c_int self.api.month.argtypes = [c_void_p] self.api.month.restype = c_int self.api.dayOfMonth.argtypes = [c_void_p] @@ -992,7 +994,7 @@ def get_trend_direction(self, state: c_void_p, trend_handle: int, count: int) -> def year(self, state: c_void_p) -> int: """ - Get the "current" calendar year of the simulation. All simulations operate at a real year, either user + Get the "current" year of the simulation, read from the EPW. All simulations operate at a real year, either user specified or automatically selected by EnergyPlus based on other data (start day of week + leap year option). :param state: An active EnergyPlus "state" that is returned from a call to `api.state_manager.new_state()`. @@ -1000,6 +1002,20 @@ def year(self, state: c_void_p) -> int: """ return self.api.year(state) + def calendar_year(self, state: c_void_p) -> int: + """ + Get the "current" calendar year of the simulation. + + Only valid for weather file run periods. + + All simulations operate at a real year, either user + specified or automatically selected by EnergyPlus based on other data (start day of week + leap year option). + + :param state: An active EnergyPlus "state" that is returned from a call to `api.state_manager.new_state()`. + :return: An integer year (2020, for example) + """ + return self.api.calendarYear(state) + def month(self, state: c_void_p) -> int: """ Get the current month of the simulation (1-12) diff --git a/src/EnergyPlus/api/plugin_tester.py b/src/EnergyPlus/api/plugin_tester.py index 1312a86432a..cbe963cc029 100644 --- a/src/EnergyPlus/api/plugin_tester.py +++ b/src/EnergyPlus/api/plugin_tester.py @@ -143,6 +143,7 @@ def generate_mock_api(bare_mock_api_instance: Mock) -> Mock: bare_mock_api_instance.exchange.get_global_value.return_value = 3.14 bare_mock_api_instance.exchange.set_global_value.return_value = None bare_mock_api_instance.exchange.year.return_value = 1 + bare_mock_api_instance.exchange.calendarYear.return_value = 1 bare_mock_api_instance.exchange.month.return_value = 1 bare_mock_api_instance.exchange.day_of_month.return_value = 1 bare_mock_api_instance.exchange.hour.return_value = 1 From b76d869e1748467443f42bce5fba89a469c2432f Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 15 Sep 2023 00:10:23 +0200 Subject: [PATCH 18/34] Add test --- tst/EnergyPlus/api/TestDataTransfer.c | 3 +++ tst/EnergyPlus/api/TestDataTransfer.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/tst/EnergyPlus/api/TestDataTransfer.c b/tst/EnergyPlus/api/TestDataTransfer.c index ce89b62bc61..674615c1a61 100644 --- a/tst/EnergyPlus/api/TestDataTransfer.c +++ b/tst/EnergyPlus/api/TestDataTransfer.c @@ -109,6 +109,9 @@ void afterZoneTimeStepHandler(EnergyPlusState state) printf("Actuated Dew Point temp value is: %8.4f \n", dp_temp); Real64 simTime = currentSimTime(state); printf("Current Sim Time: %0.2f \n", simTime); + const int epwYear = year(state); + const int runPeriodYear = calendarYear(state); + printf("year: %i, calendarYear: %i\n", epwYear, runPeriodYear); if (oa_temp > 10) { printf("Setting Zn001:Wall001 construction (%d) to R13WALL (%d)", zone1_wall1Actuator, wallConstruction); diff --git a/tst/EnergyPlus/api/TestDataTransfer.py b/tst/EnergyPlus/api/TestDataTransfer.py index 64e3c75aac6..4e011195e93 100644 --- a/tst/EnergyPlus/api/TestDataTransfer.py +++ b/tst/EnergyPlus/api/TestDataTransfer.py @@ -126,6 +126,10 @@ def time_step_handler(state): print("Actuated Dew Point temp value is: %s" % dp_temp) sim_time = api.exchange.current_sim_time(state) print("Current sim time is: %f" % sim_time) + epwYear = api.exchange.year(state) + runPeriodYear = api.exchange.calendar_year(state) + print("year: %i, calendarYear: %i\n", epwYear, runPeriodYear) + if api.exchange.zone_time_step_number(state) == 1: n = api.exchange.num_time_steps_in_hour(state) tomorrow_db = api.exchange.tomorrow_weather_outdoor_dry_bulb_at_time(state, 3, 2) From 25b762bfd8a12626ba1c746a10e120f6a67eebbe Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 15 Sep 2023 00:11:46 +0200 Subject: [PATCH 19/34] Unbrick read the docs (IDD moved + Jinja3.1 is not compatible) --- doc/readthedocs/requirements.txt | 3 ++- doc/readthedocs/sphinx/conf.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/readthedocs/requirements.txt b/doc/readthedocs/requirements.txt index 3b1f6efa3ad..00bd730e07b 100644 --- a/doc/readthedocs/requirements.txt +++ b/doc/readthedocs/requirements.txt @@ -1,3 +1,4 @@ sphinx-rtd-theme sphinx>3 -urllib3==1.26.15 \ No newline at end of file +Jinja2<3.1 # cannot import name 'environmentfilter' from 'jinja2' +urllib3==1.26.15 diff --git a/doc/readthedocs/sphinx/conf.py b/doc/readthedocs/sphinx/conf.py index 8e6709a3613..005f886f1c3 100644 --- a/doc/readthedocs/sphinx/conf.py +++ b/doc/readthedocs/sphinx/conf.py @@ -134,7 +134,7 @@ # # OK, now we need to make sure the epJSON schema is generated so we can process it # Since this will primarily just be run by readthedocs, I'm just going to re-run the schema generator try: - check_call(['python3', 'scripts/dev/generate_epJSON_schema/generate_epJSON_schema.py', 'idd'], cwd=repo_root) + check_call(['python3', 'idd/schema/generate_epJSON_schema.py', 'idd'], cwd=repo_root) except CalledProcessError as e: raise Exception(f"Schema Generation failed! Exception string: {str(e)}") from None except FileNotFoundError as e: From c75dd92789c23380b6d821e0afe7c91f5b5bc191 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 15 Sep 2023 09:33:30 +0200 Subject: [PATCH 20/34] Adjust EMS test now that there is one more built-in variable --- tst/EnergyPlus/unit/EMSManager.unit.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tst/EnergyPlus/unit/EMSManager.unit.cc b/tst/EnergyPlus/unit/EMSManager.unit.cc index 39346bef648..b2d415bb963 100644 --- a/tst/EnergyPlus/unit/EMSManager.unit.cc +++ b/tst/EnergyPlus/unit/EMSManager.unit.cc @@ -1114,12 +1114,11 @@ TEST_F(EnergyPlusFixture, EMSManager_TestFuntionCall) ObjexxFCL::Optional_int_const()); // process trend functions again using above data EXPECT_TRUE(anyRan); - int index(0); - int offset(27); // first 26 values in ErlExpression() are key words + 1 EMS global variable + int offset = 28; // first 27 values in ErlExpression() are constant and built-in variables EXPECT_TRUE(compare_enums(state->dataRuntimeLang->ErlExpression(1).Operator, ErlFunc::Round)); EXPECT_EQ(state->dataRuntimeLang->ErlExpression(1).NumOperands, 1); EXPECT_EQ(state->dataRuntimeLang->ErlExpression(1).Operand.size(), 1u); - index = 1 + offset; + int index = 1 + offset; EXPECT_EQ(state->dataRuntimeLang->ErlVariable(index).Name, "VAR1"); EXPECT_EQ(state->dataRuntimeLang->ErlVariable(index).Value.Number, 2.0); // round(2.1) From 1c847c7119fa762456e0ea03c2a86e1d1c4104c2 Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Fri, 15 Sep 2023 10:34:38 -0600 Subject: [PATCH 21/34] clarify CMake messages around use of CMAKE_OSX_DEPLOYMENT_TARGET --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c2bd82fd62..240c821fbbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,8 +12,12 @@ cmake_policy(SET CMP0048 NEW) # handling project_version_* variables project(EnergyPlus) # Raise an error if attempting to compile on macOS older than 10.15 - it does not work -if (APPLE AND CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS "10.15") - message(FATAL_ERROR "The minimum required version for macOS is 10.15, however CMAKE_OSX_DEPLOYMENT_TARGET is set to ${CMAKE_OSX_DEPLOYMENT_TARGET}. Please set CMAKE_OSX_DEPLOYMENT_TARGET to 10.15 or greater and try again.") +if (APPLE) + if ("${CMAKE_OSX_DEPLOYMENT_TARGET}" STREQUAL "") + message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET not set. Please set CMAKE_OSX_DEPLOYMENT_TARGET to 10.15 or greater and try again.") + elseif (CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS "10.15") + message(FATAL_ERROR "The minimum required version for macOS is 10.15, however CMAKE_OSX_DEPLOYMENT_TARGET is set to ${CMAKE_OSX_DEPLOYMENT_TARGET}.") + endif() endif() if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER "3.0") From 5f3de84d75428caf6d82d406c8060e52909e5354 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 15 Sep 2023 16:28:21 +0200 Subject: [PATCH 22/34] (meta) unit test for #10220 --- .../unit/EconomicLifeCycleCost.unit.cc | 68 +++++++++++++++++++ .../unit/Fixtures/EnergyPlusFixture.cc | 7 ++ .../unit/Fixtures/EnergyPlusFixture.hh | 4 ++ 3 files changed, 79 insertions(+) diff --git a/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc b/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc index 36d7b794c43..1b0aaeaccaa 100644 --- a/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc +++ b/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc @@ -58,6 +58,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -585,3 +586,70 @@ TEST_F(EnergyPlusFixture, EconomicLifeCycleCost_ExpressAsCashFlows) EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow[CostCategory::TotGrand].yrAmount(4), 1278. + 123456., 0.001); EXPECT_NEAR(state->dataEconLifeCycleCost->CashFlow[CostCategory::TotGrand].yrAmount(5), 1278., 0.001); } + +TEST_F(EnergyPlusFixture, EconomicLifeCycleCost_GetInput_EnsureFuelTypesAllRecognized) +{ + + const auto &schema = EnergyPlusFixture::schema(); + const auto &lcc_useprice = schema["properties"]["LifeCycleCost:UsePriceEscalation"]; + const auto &resource_field = lcc_useprice["patternProperties"][".*"]["properties"]["resource"]; + const auto &enum_values = resource_field["enum"]; + + // Should support all fuels + Water + ElectricityXXX (Purchased, Produced, SurplusSold, Net) + constexpr size_t numResources = static_cast(Constant::eFuel::Num) + 5; + EXPECT_EQ(numResources, enum_values.size()); + std::string idf_objects = delimited_string({ + "LifeCycleCost:Parameters,", + " TypicalLCC, !- Name", + " EndOfYear, !- Discounting Convention", + " ConstantDollar, !- Inflation Approach", + " 0.03, !- Real Discount Rate", + " , !- Nominal Discount Rate", + " , !- Inflation", + " January, !- Base Date Month", + " 2012, !- Base Date Year", + " January, !- Service Date Month", + " 2014, !- Service Date Year", + " 100, !- Length of Study Period in Years", + " 0, !- Tax rate", + " ; !- Depreciation Method", + }); + // All should be valid resources + for (const auto &enum_value : enum_values) { + const std::string enum_string = enum_value.get(); + + const auto resource = static_cast(getEnumValue(Constant::eResourceNamesUC, enum_string)); + EXPECT_TRUE(compare_enums(Constant::eResource::Invalid, resource)) << "Failed for " << enum_string; + + idf_objects += fmt::format(R"idf( +LifeCycleCost:UsePriceEscalation, + LCCUsePriceEscalation {0}, !- Name + {0}, !- Resource + 2009, !- Escalation Start Year + January, !- Escalation Start Month + 1, !- Year Escalation 1 + 1.01, !- Year Escalation 2 + 1.02; !- Year Escalation 3 + +LifeCycleCost:UseAdjustment, + LCCUseAdjustment {0}, !- Name + {0}, !- Resource + 1, !- Year Multiplier 1 + 1.005, !- Year Multiplier 2 + 1.01; !- Year Multiplier 3 + )idf", + enum_string); + } + ASSERT_TRUE(process_idf(idf_objects)); + + GetInputForLifeCycleCost(*state); + + EXPECT_EQ(numResources, state->dataEconLifeCycleCost->numUsePriceEscalation); + EXPECT_TRUE(std::all_of(state->dataEconLifeCycleCost->UsePriceEscalation.begin(), + state->dataEconLifeCycleCost->UsePriceEscalation.end(), + [](auto &lcc) { return lcc.resource != Constant::eResource::Invalid; })); + EXPECT_EQ(numResources, state->dataEconLifeCycleCost->numUseAdjustment); + EXPECT_TRUE(std::all_of(state->dataEconLifeCycleCost->UseAdjustment.begin(), state->dataEconLifeCycleCost->UseAdjustment.end(), [](auto &lcc) { + return lcc.resource != Constant::eResource::Invalid; + })); +} diff --git a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc index e3bb5751746..e8902423fb0 100644 --- a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc +++ b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc @@ -64,6 +64,8 @@ #include #include #include +#include + #include #include #include @@ -359,4 +361,9 @@ bool EnergyPlusFixture::process_idf(std::string_view const idf_snippet, bool use return successful_processing; } +const nlohmann::json &EnergyPlusFixture::schema() +{ + return InputProcessor::schema(); +} + } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh index 1a5fef76138..0ae2db54a6c 100644 --- a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh +++ b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh @@ -59,6 +59,7 @@ #include #include +#include #include namespace EnergyPlus { @@ -281,6 +282,9 @@ protected: std::replace(stringLiteral.begin(), stringLiteral.end(), '|', ' '); // replace the trailing || with spaces } + // InputProcessor::schema is private, so re-expose it to the tests deriving EnergyPlusFixture + static const nlohmann::json &schema(); + public: EnergyPlusData *state; From 8c6cbf08f384e8ecbf9d72efd020cc5911d2bfd6 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Mon, 18 Sep 2023 09:44:09 +0200 Subject: [PATCH 23/34] Don't expose the schema() to EnergyPlusFixture, just use the public `getObjectSchemaProps` --- tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc | 11 ++++++----- tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc | 6 ------ tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh | 4 ---- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc b/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc index 1b0aaeaccaa..4db041513e8 100644 --- a/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc +++ b/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc @@ -62,6 +62,8 @@ #include "Fixtures/EnergyPlusFixture.hh" +#include + using namespace EnergyPlus; using namespace EnergyPlus::EconomicLifeCycleCost; using namespace EnergyPlus::EconomicTariff; @@ -589,11 +591,10 @@ TEST_F(EnergyPlusFixture, EconomicLifeCycleCost_ExpressAsCashFlows) TEST_F(EnergyPlusFixture, EconomicLifeCycleCost_GetInput_EnsureFuelTypesAllRecognized) { - - const auto &schema = EnergyPlusFixture::schema(); - const auto &lcc_useprice = schema["properties"]["LifeCycleCost:UsePriceEscalation"]; - const auto &resource_field = lcc_useprice["patternProperties"][".*"]["properties"]["resource"]; - const auto &enum_values = resource_field["enum"]; + using json = nlohmann::json; + const json &lcc_useprice_props = state->dataInputProcessing->inputProcessor->getObjectSchemaProps(*state, "LifeCycleCost:UsePriceEscalation"); + const json &resource_field = lcc_useprice_props.at("resource"); + const json &enum_values = resource_field.at("enum"); // Should support all fuels + Water + ElectricityXXX (Purchased, Produced, SurplusSold, Net) constexpr size_t numResources = static_cast(Constant::eFuel::Num) + 5; diff --git a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc index e8902423fb0..41540ba49c0 100644 --- a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc +++ b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc @@ -64,7 +64,6 @@ #include #include #include -#include #include #include @@ -361,9 +360,4 @@ bool EnergyPlusFixture::process_idf(std::string_view const idf_snippet, bool use return successful_processing; } -const nlohmann::json &EnergyPlusFixture::schema() -{ - return InputProcessor::schema(); -} - } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh index 0ae2db54a6c..1a5fef76138 100644 --- a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh +++ b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh @@ -59,7 +59,6 @@ #include #include -#include #include namespace EnergyPlus { @@ -282,9 +281,6 @@ protected: std::replace(stringLiteral.begin(), stringLiteral.end(), '|', ' '); // replace the trailing || with spaces } - // InputProcessor::schema is private, so re-expose it to the tests deriving EnergyPlusFixture - static const nlohmann::json &schema(); - public: EnergyPlusData *state; From 37b2b4bc39af83055847b3185545903580b66bf5 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Mon, 18 Sep 2023 10:50:51 +0200 Subject: [PATCH 24/34] Use a range-based for loop so I can print which are failing (instead of std::all_of) ``` [ RUN ] EnergyPlusFixture.EconomicLifeCycleCost_GetInput_EnsureFuelTypesAllRecognized /home/julien/Software/Others/EnergyPlus/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc:601: Failure Expected equality of these values: numResources Which is: 18 enum_values.size() Which is: 16 /home/julien/Software/Others/EnergyPlus/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc:648: Failure Expected equality of these values: numResources Which is: 18 state->dataEconLifeCycleCost->numUsePriceEscalation Which is: 16 /home/julien/Software/Others/EnergyPlus/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh:137: Failure Expected: (static_cast>(expected)) != (static_cast>(actual)), actual: -1 vs -1 /home/julien/Software/Others/EnergyPlus/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc:650: Failure Value of: compare_enums(lcc.resource, Constant::eResource::Invalid, false) Actual: true Expected: false Failed for LCCUSEPRICEESCALATION STEAM /home/julien/Software/Others/EnergyPlus/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc:652: Failure Expected equality of these values: numResources Which is: 18 state->dataEconLifeCycleCost->numUseAdjustment Which is: 16 /home/julien/Software/Others/EnergyPlus/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh:137: Failure Expected: (static_cast>(expected)) != (static_cast>(actual)), actual: -1 vs -1 /home/julien/Software/Others/EnergyPlus/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc:654: Failure Value of: compare_enums(lcc.resource, Constant::eResource::Invalid, false) Actual: true Expected: false Failed for LCCUSEADJUSTMENT STEAM ``` --- tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc b/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc index 4db041513e8..844b434c6f7 100644 --- a/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc +++ b/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc @@ -646,11 +646,11 @@ LifeCycleCost:UseAdjustment, GetInputForLifeCycleCost(*state); EXPECT_EQ(numResources, state->dataEconLifeCycleCost->numUsePriceEscalation); - EXPECT_TRUE(std::all_of(state->dataEconLifeCycleCost->UsePriceEscalation.begin(), - state->dataEconLifeCycleCost->UsePriceEscalation.end(), - [](auto &lcc) { return lcc.resource != Constant::eResource::Invalid; })); + for (const auto &lcc : state->dataEconLifeCycleCost->UsePriceEscalation) { + EXPECT_FALSE(compare_enums(lcc.resource, Constant::eResource::Invalid, false)) << "Failed for " << lcc.name; + } EXPECT_EQ(numResources, state->dataEconLifeCycleCost->numUseAdjustment); - EXPECT_TRUE(std::all_of(state->dataEconLifeCycleCost->UseAdjustment.begin(), state->dataEconLifeCycleCost->UseAdjustment.end(), [](auto &lcc) { - return lcc.resource != Constant::eResource::Invalid; - })); + for (const auto &lcc : state->dataEconLifeCycleCost->UseAdjustment) { + EXPECT_FALSE(compare_enums(lcc.resource, Constant::eResource::Invalid, false)) << "Failed for " << lcc.name; + } } From 7ae61a9a15437d59fb77deda011bb54d6591e14d Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Mon, 18 Sep 2023 10:34:53 +0200 Subject: [PATCH 25/34] For #10220 - Replace Steam with DistrictHeatingSteam in LCC objects --- idd/Energy+.idd.in | 4 ++-- src/Transition/CreateNewIDFUsingRulesV23_2_0.f90 | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/idd/Energy+.idd.in b/idd/Energy+.idd.in index da646e0d22a..95a566e1cd9 100644 --- a/idd/Energy+.idd.in +++ b/idd/Energy+.idd.in @@ -100940,7 +100940,7 @@ LifeCycleCost:UsePriceEscalation, \key ElectricitySurplusSold \key ElectricityNet \key NaturalGas - \key Steam + \key DistrictHeatingSteam \key Gasoline \key Diesel \key Coal @@ -101028,7 +101028,7 @@ LifeCycleCost:UseAdjustment, \key ElectricitySurplusSold \key ElectricityNet \key NaturalGas - \key Steam + \key DistrictHeatingSteam \key Gasoline \key Diesel \key Coal diff --git a/src/Transition/CreateNewIDFUsingRulesV23_2_0.f90 b/src/Transition/CreateNewIDFUsingRulesV23_2_0.f90 index 679059adc99..150f268ac1f 100644 --- a/src/Transition/CreateNewIDFUsingRulesV23_2_0.f90 +++ b/src/Transition/CreateNewIDFUsingRulesV23_2_0.f90 @@ -916,6 +916,22 @@ SUBROUTINE CreateNewIDFUsingRules(EndOfFile,DiffOnly,InLfn,AskForInput,InputFile ! If your original object starts with L, insert the rules here + CASE('LIFECYCLECOST:USEPRICEESCALATION') + CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits) + nodiff=.false. + OutArgs(1:CurArgs)=InArgs(1:CurArgs) + IF (SameString(OutArgs(2), "STEAM")) THEN + OutArgs(2) = "DistrictHeatingSteam" + END IF + + CASE('LIFECYCLECOST:USEADJUSTMENT') + CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits) + nodiff=.false. + OutArgs(1:CurArgs)=InArgs(1:CurArgs) + IF (SameString(OutArgs(2), "STEAM")) THEN + OutArgs(2) = "DistrictHeatingSteam" + END IF + ! If your original object starts with M, insert the rules here ! If your original object starts with N, insert the rules here From 1f4897919c67995a84c3cd604eabbb45bec82fe0 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 15 Sep 2023 14:23:56 +0200 Subject: [PATCH 26/34] Add DistrictCooling and DistrictHeatingWater to LCC --- idd/Energy+.idd.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/idd/Energy+.idd.in b/idd/Energy+.idd.in index 95a566e1cd9..f57537c70d2 100644 --- a/idd/Energy+.idd.in +++ b/idd/Energy+.idd.in @@ -100940,6 +100940,8 @@ LifeCycleCost:UsePriceEscalation, \key ElectricitySurplusSold \key ElectricityNet \key NaturalGas + \key DistrictCooling + \key DistrictHeatingWater \key DistrictHeatingSteam \key Gasoline \key Diesel @@ -101028,6 +101030,8 @@ LifeCycleCost:UseAdjustment, \key ElectricitySurplusSold \key ElectricityNet \key NaturalGas + \key DistrictCooling + \key DistrictHeatingWater \key DistrictHeatingSteam \key Gasoline \key Diesel From afe8486cb27cabfc51176baba38b35d11a4f69f4 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Mon, 18 Sep 2023 11:02:46 +0200 Subject: [PATCH 27/34] Update InputRules --- .../InputRulesFiles/Rules23-1-0-to-23-2-0.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Transition/InputRulesFiles/Rules23-1-0-to-23-2-0.md b/src/Transition/InputRulesFiles/Rules23-1-0-to-23-2-0.md index 48fb959a7e5..7756f248e0d 100644 --- a/src/Transition/InputRulesFiles/Rules23-1-0-to-23-2-0.md +++ b/src/Transition/InputRulesFiles/Rules23-1-0-to-23-2-0.md @@ -606,4 +606,18 @@ Fields 2, 4, 5, and 6 remain the same. Field 1 has a name change from "District Heating Efficiency" to "District Heating Water Efficiency". Field 3 has a name change from "Steam Conversion Efficiency" to "District Heating Steam Conversion Efficiency". -See [PR#9260](https://github.com/NREL/EnergyPlus/pull/9260 \ No newline at end of file +See [PR#9260](https://github.com/NREL/EnergyPlus/pull/9260) + +# Object Change: LifeCycleCost:UsePriceEscalation + +Field 2 remains the same. + - Choice key *Steam* has been replaced with *DistrictHeatingSteam*. + +See [PR#9260](https://github.com/NREL/EnergyPlus/pull/9260) + +# Object Change: LifeCycleCost:UseAdjustment + +Field 2 remains the same. + - Choice key *Steam* has been replaced with *DistrictHeatingSteam*. + +See [PR#10229](https://github.com/NREL/EnergyPlus/pull/10229) From c916b09a4c7f0220d6224aef92494db61205e92e Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Mon, 18 Sep 2023 13:07:55 +0200 Subject: [PATCH 28/34] #9878 - Adjust existing unit test to highlight the issues and make it clearer --- .../unit/ChillerExhaustAbsorption.unit.cc | 69 ++++++++++++++----- 1 file changed, 53 insertions(+), 16 deletions(-) diff --git a/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc b/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc index 62f18e16c40..c35b55ab15c 100644 --- a/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc +++ b/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc @@ -55,7 +55,8 @@ #include #include #include -// #include +#include +#include #include #include "Fixtures/EnergyPlusFixture.hh" @@ -637,29 +638,61 @@ TEST_F(EnergyPlusFixture, ExhAbsorption_calcHeater_Fix_Test) auto &thisChillerHeater = state->dataChillerExhaustAbsorption->ExhaustAbsorber(1); - Real64 loadinput = 5000.0; - bool runflaginput = true; - - thisChillerHeater.CoolingLoad = 100000.0; + thisChillerHeater.CoolingLoad = 100'000.0; thisChillerHeater.CoolPartLoadRatio = 1.0; state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); thisChillerHeater.HWPlantLoc.loopNum = 1; thisChillerHeater.HWPlantLoc.loopSideNum = DataPlant::LoopSideLocation::Demand; - state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; - state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; - state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).FlowLock = DataPlant::FlowLock::Locked; - state->dataLoopNodes->Node(3).Temp = 60.0; - state->dataLoopNodes->Node(3).MassFlowRate = 0.5; - state->dataLoopNodes->Node(4).TempSetPoint = 70.0; - state->dataLoopNodes->Node(7).Temp = 350.0; - state->dataLoopNodes->Node(7).MassFlowRate = 0.5; + auto &hwPlantLoop = state->dataPlnt->PlantLoop(1); + hwPlantLoop.FluidName = "WATER"; + hwPlantLoop.FluidIndex = 1; + hwPlantLoop.LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; + hwPlantLoop.LoopSide(DataPlant::LoopSideLocation::Demand).FlowLock = DataPlant::FlowLock::Locked; + + EXPECT_EQ(1, thisChillerHeater.ChillReturnNodeNum); + EXPECT_EQ("EXH CHILLER INLET NODE", state->dataLoopNodes->NodeID(1)); + EXPECT_EQ(2, thisChillerHeater.ChillSupplyNodeNum); + EXPECT_EQ("EXH CHILLER OUTLET NODE", state->dataLoopNodes->NodeID(2)); + EXPECT_EQ(3, thisChillerHeater.HeatReturnNodeNum); + EXPECT_EQ("EXH CHILLER HEATING INLET NODE", state->dataLoopNodes->NodeID(3)); + EXPECT_EQ(4, thisChillerHeater.HeatSupplyNodeNum); + EXPECT_EQ("EXH CHILLER HEATING OUTLET NODE", state->dataLoopNodes->NodeID(4)); + EXPECT_EQ(5, thisChillerHeater.CondReturnNodeNum); + EXPECT_EQ("EXH CHILLER CONDENSER INLET NODE", state->dataLoopNodes->NodeID(5)); + EXPECT_EQ("CAPSTONE C65 COMBUSTION AIR INLET NODE", state->dataLoopNodes->NodeID(6)); + EXPECT_EQ(7, thisChillerHeater.ExhaustAirInletNodeNum); + EXPECT_EQ("CAPSTONE C65 COMBUSTION AIR OUTLET NODE", state->dataLoopNodes->NodeID(7)); + + constexpr Real64 hwSupplySetpoint = 70.0; + constexpr Real64 hwReturnTemp = 60.0; + constexpr Real64 hwMassFlow = 0.5; + state->dataLoopNodes->Node(thisChillerHeater.HeatReturnNodeNum).Temp = hwReturnTemp; + state->dataLoopNodes->Node(thisChillerHeater.HeatReturnNodeNum).MassFlowRate = hwMassFlow; + state->dataLoopNodes->Node(thisChillerHeater.HeatSupplyNodeNum).TempSetPoint = hwSupplySetpoint; + + // Minimum temperature leaving the Chiller absorber is 176.6 C (350 F) + constexpr Real64 exhaustInTemp = 350.0; + constexpr Real64 absLeavingTemp = 176.667; + constexpr Real64 exhaustInMassFlowRate = 0.5; + constexpr Real64 exhaustInHumRate = 0.000; // FIXME: use a non zero one + state->dataLoopNodes->Node(thisChillerHeater.ExhaustAirInletNodeNum).Temp = exhaustInTemp; + state->dataLoopNodes->Node(thisChillerHeater.ExhaustAirInletNodeNum).MassFlowRate = exhaustInMassFlowRate; + state->dataLoopNodes->Node(thisChillerHeater.ExhaustAirInletNodeNum).HumRat = exhaustInHumRate; + Real64 loadinput = 5000.0; + bool const runflaginput = true; thisChillerHeater.calcHeater(*state, loadinput, runflaginput); - EXPECT_NEAR(thisChillerHeater.HeatingLoad, 21085.0, 1e-6); + // FIXME: this shouldn't be zero + const Real64 CpHW = FluidProperties::GetSpecificHeatGlycol(*state, hwPlantLoop.FluidName, 0.0, hwPlantLoop.FluidIndex, "UnitTest"); + EXPECT_EQ(4217.0, CpHW); + const Real64 expectedHeatingLoad = (hwSupplySetpoint - hwReturnTemp) * hwMassFlow * CpHW; + + EXPECT_NEAR(21085.0, expectedHeatingLoad, 1e-6); + + EXPECT_NEAR(thisChillerHeater.HeatingLoad, expectedHeatingLoad, 1e-6); EXPECT_NEAR(thisChillerHeater.HeatElectricPower, 400.0, 1e-6); EXPECT_NEAR(thisChillerHeater.HotWaterReturnTemp, 60.0, 1e-6); EXPECT_NEAR(thisChillerHeater.HotWaterSupplyTemp, 70.0, 1e-6); @@ -669,7 +702,11 @@ TEST_F(EnergyPlusFixture, ExhAbsorption_calcHeater_Fix_Test) EXPECT_NEAR(thisChillerHeater.ElectricPower, 400.0, 1e-6); EXPECT_NEAR(thisChillerHeater.ExhaustInTemp, 350.0, 1e-6); EXPECT_NEAR(thisChillerHeater.ExhaustInFlow, 0.5, 1e-6); - EXPECT_NEAR(thisChillerHeater.ExhHeatRecPotentialHeat, 87087.5769469, 1e-6); + + Real64 const CpAir = Psychrometrics::PsyCpAirFnW(exhaustInHumRate); + Real64 const epectedExhHeatRecPotentialHeat = exhaustInMassFlowRate * CpAir * (exhaustInTemp - absLeavingTemp); + EXPECT_NEAR(87087.5769469, epectedExhHeatRecPotentialHeat, 1e-6); + EXPECT_NEAR(epectedExhHeatRecPotentialHeat, thisChillerHeater.ExhHeatRecPotentialHeat, 1e-6); } TEST_F(EnergyPlusFixture, ExhAbsorption_GetInput_Multiple_Objects_Test) From 0fbe564be31363e7ee827704c1a7b140486a34c9 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Mon, 18 Sep 2023 13:12:12 +0200 Subject: [PATCH 29/34] For #9878 - Update Unit test with proper behavior --- .../unit/ChillerExhaustAbsorption.unit.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc b/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc index c35b55ab15c..b5f52e7a6d9 100644 --- a/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc +++ b/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc @@ -676,7 +676,7 @@ TEST_F(EnergyPlusFixture, ExhAbsorption_calcHeater_Fix_Test) constexpr Real64 exhaustInTemp = 350.0; constexpr Real64 absLeavingTemp = 176.667; constexpr Real64 exhaustInMassFlowRate = 0.5; - constexpr Real64 exhaustInHumRate = 0.000; // FIXME: use a non zero one + constexpr Real64 exhaustInHumRate = 0.005; state->dataLoopNodes->Node(thisChillerHeater.ExhaustAirInletNodeNum).Temp = exhaustInTemp; state->dataLoopNodes->Node(thisChillerHeater.ExhaustAirInletNodeNum).MassFlowRate = exhaustInMassFlowRate; state->dataLoopNodes->Node(thisChillerHeater.ExhaustAirInletNodeNum).HumRat = exhaustInHumRate; @@ -685,12 +685,11 @@ TEST_F(EnergyPlusFixture, ExhAbsorption_calcHeater_Fix_Test) bool const runflaginput = true; thisChillerHeater.calcHeater(*state, loadinput, runflaginput); - // FIXME: this shouldn't be zero - const Real64 CpHW = FluidProperties::GetSpecificHeatGlycol(*state, hwPlantLoop.FluidName, 0.0, hwPlantLoop.FluidIndex, "UnitTest"); - EXPECT_EQ(4217.0, CpHW); + const Real64 CpHW = FluidProperties::GetSpecificHeatGlycol(*state, hwPlantLoop.FluidName, hwReturnTemp, hwPlantLoop.FluidIndex, "UnitTest"); + EXPECT_EQ(4185.0, CpHW); const Real64 expectedHeatingLoad = (hwSupplySetpoint - hwReturnTemp) * hwMassFlow * CpHW; - EXPECT_NEAR(21085.0, expectedHeatingLoad, 1e-6); + EXPECT_NEAR(20925.0, expectedHeatingLoad, 1e-6); EXPECT_NEAR(thisChillerHeater.HeatingLoad, expectedHeatingLoad, 1e-6); EXPECT_NEAR(thisChillerHeater.HeatElectricPower, 400.0, 1e-6); @@ -705,8 +704,8 @@ TEST_F(EnergyPlusFixture, ExhAbsorption_calcHeater_Fix_Test) Real64 const CpAir = Psychrometrics::PsyCpAirFnW(exhaustInHumRate); Real64 const epectedExhHeatRecPotentialHeat = exhaustInMassFlowRate * CpAir * (exhaustInTemp - absLeavingTemp); - EXPECT_NEAR(87087.5769469, epectedExhHeatRecPotentialHeat, 1e-6); - EXPECT_NEAR(epectedExhHeatRecPotentialHeat, thisChillerHeater.ExhHeatRecPotentialHeat, 1e-6); + EXPECT_NEAR(87891.51, epectedExhHeatRecPotentialHeat, 0.01); + EXPECT_NEAR(epectedExhHeatRecPotentialHeat, thisChillerHeater.ExhHeatRecPotentialHeat, 0.01); } TEST_F(EnergyPlusFixture, ExhAbsorption_GetInput_Multiple_Objects_Test) From 5fa8a0b10f950c2f4de76cb3929850108d6a07ce Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Mon, 18 Sep 2023 13:17:21 +0200 Subject: [PATCH 30/34] Minimal Fix for #9878 --- src/EnergyPlus/ChillerExhaustAbsorption.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/EnergyPlus/ChillerExhaustAbsorption.cc b/src/EnergyPlus/ChillerExhaustAbsorption.cc index c018498e238..59a8ee0657d 100644 --- a/src/EnergyPlus/ChillerExhaustAbsorption.cc +++ b/src/EnergyPlus/ChillerExhaustAbsorption.cc @@ -1909,6 +1909,7 @@ void ExhaustAbsorberSpecs::calcHeater(EnergyPlusData &state, Real64 &MyLoad, boo int LoopNum = this->HWPlantLoc.loopNum; DataPlant::LoopSideLocation LoopSideNum = this->HWPlantLoc.loopSideNum; + lHotWaterReturnTemp = state.dataLoopNodes->Node(lHeatReturnNodeNum).Temp; Real64 Cp_HW = FluidProperties::GetSpecificHeatGlycol( state, state.dataPlnt->PlantLoop(LoopNum).FluidName, lHotWaterReturnTemp, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName); @@ -1917,7 +1918,6 @@ void ExhaustAbsorberSpecs::calcHeater(EnergyPlusData &state, Real64 &MyLoad, boo Real64 lCoolPartLoadRatio = this->CoolPartLoadRatio; // initialize entering conditions - lHotWaterReturnTemp = state.dataLoopNodes->Node(lHeatReturnNodeNum).Temp; lHotWaterMassFlowRate = state.dataLoopNodes->Node(lHeatReturnNodeNum).MassFlowRate; switch (state.dataPlnt->PlantLoop(LoopNum).LoopDemandCalcScheme) { case DataPlant::LoopDemandCalcScheme::SingleSetPoint: { @@ -2007,6 +2007,7 @@ void ExhaustAbsorberSpecs::calcHeater(EnergyPlusData &state, Real64 &MyLoad, boo lExhaustInTemp = state.dataLoopNodes->Node(lExhaustAirInletNodeNum).Temp; lExhaustInFlow = state.dataLoopNodes->Node(lExhaustAirInletNodeNum).MassFlowRate; + lExhaustAirHumRat = state.dataLoopNodes->Node(this->ExhaustAirInletNodeNum).HumRat; Real64 CpAir = Psychrometrics::PsyCpAirFnW(lExhaustAirHumRat); lExhHeatRecPotentialHeat = lExhaustInFlow * CpAir * (lExhaustInTemp - AbsLeavingTemp); if (lExhHeatRecPotentialHeat < lHeatThermalEnergyUseRate) { From aace45c46cc547ce8414689b4414d6d4ca6ec2e8 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Mon, 18 Sep 2023 13:18:42 +0200 Subject: [PATCH 31/34] Improve fix for #9878 - Refactor ExhaustAbsorberSpecs::calcHeater --- src/EnergyPlus/ChillerExhaustAbsorption.cc | 113 ++++++++------------- 1 file changed, 45 insertions(+), 68 deletions(-) diff --git a/src/EnergyPlus/ChillerExhaustAbsorption.cc b/src/EnergyPlus/ChillerExhaustAbsorption.cc index 59a8ee0657d..f3c0d0b235e 100644 --- a/src/EnergyPlus/ChillerExhaustAbsorption.cc +++ b/src/EnergyPlus/ChillerExhaustAbsorption.cc @@ -1874,86 +1874,64 @@ void ExhaustAbsorberSpecs::calcHeater(EnergyPlusData &state, Real64 &MyLoad, boo // all variables that are local copies of data structure // variables are prefaced with an "l" for local. // Local copies of ExhaustAbsorberReportVars Type - Real64 lHotWaterReturnTemp(0.0); Real64 lHeatingLoad(0.0); // heating load on the chiller Real64 lHeatThermalEnergyUseRate(0.0); // instantaneous use of thermal energy for period for heating Real64 lHeatElectricPower(0.0); // parasitic electric power used for heating Real64 lHotWaterSupplyTemp(0.0); // reporting: hot water supply (outlet) temperature - Real64 lHotWaterMassFlowRate(0.0); // reporting: hot water mass flow rate Real64 lHeatPartLoadRatio(0.0); // operating part load ratio (load/capacity for heating) Real64 lAvailableHeatingCapacity(0.0); // current heating capacity Real64 lFractionOfPeriodRunning(0.0); Real64 lExhaustInTemp(0.0); // Exhaust inlet temperature Real64 lExhaustInFlow(0.0); // Exhaust inlet flow rate Real64 lExhHeatRecPotentialHeat(0.0); // Exhaust heat recovery potential - Real64 lExhaustAirHumRat(0.0); - // other local variables - Real64 HeatSupplySetPointTemp(0.0); - - // set node values to data structure values for nodes - - int lHeatReturnNodeNum = this->HeatReturnNodeNum; - int lHeatSupplyNodeNum = this->HeatSupplyNodeNum; - int lExhaustAirInletNodeNum = this->ExhaustAirInletNodeNum; - - // set local copies of data from rest of input structure - - Real64 lNomCoolingCap = this->NomCoolingCap; // W - design nominal capacity of Absorber - Real64 lNomHeatCoolRatio = this->NomHeatCoolRatio; // ratio of heating to cooling capacity - Real64 lThermalEnergyHeatRatio = this->ThermalEnergyHeatRatio; // ratio of ThermalEnergy input to heating output - Real64 lElecHeatRatio = this->ElecHeatRatio; // ratio of electricity input to heating output - Real64 lMinPartLoadRat = this->MinPartLoadRat; // min allowed operating frac full load - Real64 lMaxPartLoadRat = this->MaxPartLoadRat; // max allowed operating frac full load - int lHeatCapFCoolCurve = this->HeatCapFCoolCurve; // Heating Capacity Function of Cooling Capacity Curve - int lThermalEnergyHeatFHPLRCurve = this->ThermalEnergyHeatFHPLRCurve; // ThermalEnergy Input to heat output ratio during heating only function - int LoopNum = this->HWPlantLoc.loopNum; - DataPlant::LoopSideLocation LoopSideNum = this->HWPlantLoc.loopSideNum; - - lHotWaterReturnTemp = state.dataLoopNodes->Node(lHeatReturnNodeNum).Temp; - Real64 Cp_HW = FluidProperties::GetSpecificHeatGlycol( - state, state.dataPlnt->PlantLoop(LoopNum).FluidName, lHotWaterReturnTemp, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName); - - Real64 lCoolElectricPower = this->CoolElectricPower; // parasitic electric power used for cooling - Real64 lCoolThermalEnergyUseRate = this->CoolThermalEnergyUseRate; // instantaneous use of thermal energy for period for cooling - Real64 lCoolPartLoadRatio = this->CoolPartLoadRatio; // initialize entering conditions - lHotWaterMassFlowRate = state.dataLoopNodes->Node(lHeatReturnNodeNum).MassFlowRate; - switch (state.dataPlnt->PlantLoop(LoopNum).LoopDemandCalcScheme) { - case DataPlant::LoopDemandCalcScheme::SingleSetPoint: { - HeatSupplySetPointTemp = state.dataLoopNodes->Node(lHeatSupplyNodeNum).TempSetPoint; - } break; - case DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand: { - HeatSupplySetPointTemp = state.dataLoopNodes->Node(lHeatSupplyNodeNum).TempSetPointLo; - } break; - default: { - assert(false); - } break; - } - Real64 HeatDeltaTemp = std::abs(lHotWaterReturnTemp - HeatSupplySetPointTemp); + auto &hwPlantLoop = state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum); + const Real64 HeatSupplySetPointTemp = [this, &hwPlantLoop, &state]() { + switch (hwPlantLoop.LoopDemandCalcScheme) { + case DataPlant::LoopDemandCalcScheme::SingleSetPoint: { + return state.dataLoopNodes->Node(this->HeatSupplyNodeNum).TempSetPoint; + } + case DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand: { + return state.dataLoopNodes->Node(this->HeatSupplyNodeNum).TempSetPointLo; + } + default: { + assert(false); + return 0.0; + } + } + }(); + + auto const &heatReturnNode = state.dataLoopNodes->Node(this->HeatReturnNodeNum); + Real64 const HeatDeltaTemp = std::abs(heatReturnNode.Temp - HeatSupplySetPointTemp); + // reporting: hot water mass flow rate + Real64 lHotWaterMassFlowRate = heatReturnNode.MassFlowRate; // If no loop demand or Absorber OFF, return // will need to modify when absorber can act as a boiler if (MyLoad <= 0 || !RunFlag) { // set node temperatures - lHotWaterSupplyTemp = lHotWaterReturnTemp; - lFractionOfPeriodRunning = min(1.0, max(lHeatPartLoadRatio, lCoolPartLoadRatio) / lMinPartLoadRat); + lHotWaterSupplyTemp = heatReturnNode.Temp; + lFractionOfPeriodRunning = min(1.0, max(lHeatPartLoadRatio, this->CoolPartLoadRatio) / this->MinPartLoadRat); } else { + Real64 const Cp_HW = + FluidProperties::GetSpecificHeatGlycol(state, hwPlantLoop.FluidName, heatReturnNode.Temp, hwPlantLoop.FluidIndex, RoutineName); + // Determine available heating capacity using the current cooling load - lAvailableHeatingCapacity = - this->NomHeatCoolRatio * this->NomCoolingCap * Curve::CurveValue(state, lHeatCapFCoolCurve, (this->CoolingLoad / this->NomCoolingCap)); + lAvailableHeatingCapacity = this->NomHeatCoolRatio * this->NomCoolingCap * + Curve::CurveValue(state, this->HeatCapFCoolCurve, (this->CoolingLoad / this->NomCoolingCap)); // Calculate current load for heating - MyLoad = sign(max(std::abs(MyLoad), this->HeatingCapacity * lMinPartLoadRat), MyLoad); - MyLoad = sign(min(std::abs(MyLoad), this->HeatingCapacity * lMaxPartLoadRat), MyLoad); + MyLoad = sign(max(std::abs(MyLoad), this->HeatingCapacity * this->MinPartLoadRat), MyLoad); + MyLoad = sign(min(std::abs(MyLoad), this->HeatingCapacity * this->MaxPartLoadRat), MyLoad); // Determine the following variables depending on if the flow has been set in // the nodes (flowlock=1 to 2) or if the amount of load is still be determined (flowlock=0) // chilled water flow, // cooling load taken by the chiller, and // supply temperature - switch (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).FlowLock) { + switch (hwPlantLoop.LoopSide(this->HWPlantLoc.loopSideNum).FlowLock) { case DataPlant::FlowLock::Unlocked: { // mass flow rates may be changed by loop components lHeatingLoad = std::abs(MyLoad); if (HeatDeltaTemp != 0) { @@ -1989,26 +1967,25 @@ void ExhaustAbsorberSpecs::calcHeater(EnergyPlusData &state, Real64 &MyLoad, boo // Calculate ThermalEnergy consumption for heating // ThermalEnergy used for heating availCap * HIR * HIR-FT * HIR-FPLR - - lHeatThermalEnergyUseRate = - lAvailableHeatingCapacity * lThermalEnergyHeatRatio * Curve::CurveValue(state, lThermalEnergyHeatFHPLRCurve, lHeatPartLoadRatio); + lHeatThermalEnergyUseRate = lAvailableHeatingCapacity * this->ThermalEnergyHeatRatio * + Curve::CurveValue(state, this->ThermalEnergyHeatFHPLRCurve, lHeatPartLoadRatio); // calculate the fraction of the time period that the chiller would be running // use maximum from heating and cooling sides - lFractionOfPeriodRunning = min(1.0, max(lHeatPartLoadRatio, lCoolPartLoadRatio) / lMinPartLoadRat); + lFractionOfPeriodRunning = min(1.0, max(lHeatPartLoadRatio, this->CoolPartLoadRatio) / this->MinPartLoadRat); // Calculate electric parasitics used // for heating based on nominal capacity not available capacity - lHeatElectricPower = lNomCoolingCap * lNomHeatCoolRatio * lElecHeatRatio * lFractionOfPeriodRunning; + lHeatElectricPower = this->NomCoolingCap * this->NomHeatCoolRatio * this->ElecHeatRatio * lFractionOfPeriodRunning; // Coodinate electric parasitics for heating and cooling to avoid double counting // Total electric is the max of heating electric or cooling electric // If heating electric is greater, leave cooling electric and subtract if off of heating elec // If cooling electric is greater, set heating electric to zero - lExhaustInTemp = state.dataLoopNodes->Node(lExhaustAirInletNodeNum).Temp; - lExhaustInFlow = state.dataLoopNodes->Node(lExhaustAirInletNodeNum).MassFlowRate; - lExhaustAirHumRat = state.dataLoopNodes->Node(this->ExhaustAirInletNodeNum).HumRat; - Real64 CpAir = Psychrometrics::PsyCpAirFnW(lExhaustAirHumRat); + lExhaustInTemp = state.dataLoopNodes->Node(this->ExhaustAirInletNodeNum).Temp; + lExhaustInFlow = state.dataLoopNodes->Node(this->ExhaustAirInletNodeNum).MassFlowRate; + Real64 const lExhaustAirHumRat = state.dataLoopNodes->Node(this->ExhaustAirInletNodeNum).HumRat; + Real64 const CpAir = Psychrometrics::PsyCpAirFnW(lExhaustAirHumRat); lExhHeatRecPotentialHeat = lExhaustInFlow * CpAir * (lExhaustInTemp - AbsLeavingTemp); if (lExhHeatRecPotentialHeat < lHeatThermalEnergyUseRate) { if (this->ExhTempLTAbsLeavingHeatingTempIndex == 0) { @@ -2033,14 +2010,14 @@ void ExhaustAbsorberSpecs::calcHeater(EnergyPlusData &state, Real64 &MyLoad, boo // If exhaust is not available, it means the avilable thermal energy is 0.0 and Chiller is not available lHeatThermalEnergyUseRate = 0.0; lHeatElectricPower = 0.0; - lHotWaterSupplyTemp = lHotWaterReturnTemp; - lFractionOfPeriodRunning = min(1.0, max(lHeatPartLoadRatio, lCoolPartLoadRatio) / lMinPartLoadRat); + lHotWaterSupplyTemp = heatReturnNode.Temp; + lFractionOfPeriodRunning = min(1.0, max(lHeatPartLoadRatio, this->CoolPartLoadRatio) / this->MinPartLoadRat); } - if (lHeatElectricPower <= lCoolElectricPower) { + if (lHeatElectricPower <= this->CoolElectricPower) { lHeatElectricPower = 0.0; } else { - lHeatElectricPower -= lCoolElectricPower; + lHeatElectricPower -= this->CoolElectricPower; } } // IF(MyLoad==0 .OR. .NOT. RunFlag) @@ -2048,7 +2025,7 @@ void ExhaustAbsorberSpecs::calcHeater(EnergyPlusData &state, Real64 &MyLoad, boo this->HeatingLoad = lHeatingLoad; this->HeatThermalEnergyUseRate = lHeatThermalEnergyUseRate; this->HeatElectricPower = lHeatElectricPower; - this->HotWaterReturnTemp = lHotWaterReturnTemp; + this->HotWaterReturnTemp = heatReturnNode.Temp; this->HotWaterSupplyTemp = lHotWaterSupplyTemp; this->HotWaterFlowRate = lHotWaterMassFlowRate; this->HeatPartLoadRatio = lHeatPartLoadRatio; @@ -2056,8 +2033,8 @@ void ExhaustAbsorberSpecs::calcHeater(EnergyPlusData &state, Real64 &MyLoad, boo this->FractionOfPeriodRunning = lFractionOfPeriodRunning; // write the combined heating and cooling ThermalEnergy used and electric used - this->ThermalEnergyUseRate = lCoolThermalEnergyUseRate + lHeatThermalEnergyUseRate; - this->ElectricPower = lCoolElectricPower + lHeatElectricPower; + this->ThermalEnergyUseRate = this->CoolThermalEnergyUseRate + lHeatThermalEnergyUseRate; + this->ElectricPower = this->CoolElectricPower + lHeatElectricPower; this->ExhaustInTemp = lExhaustInTemp; this->ExhaustInFlow = lExhaustInFlow; this->ExhHeatRecPotentialHeat = lExhHeatRecPotentialHeat; From 6ee584b839e55cf96a5611c057e3d4fb975bdb5d Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Mon, 18 Sep 2023 13:32:27 +0200 Subject: [PATCH 32/34] Fix typo in unit test --- tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc b/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc index b5f52e7a6d9..8a230483e1e 100644 --- a/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc +++ b/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc @@ -703,9 +703,9 @@ TEST_F(EnergyPlusFixture, ExhAbsorption_calcHeater_Fix_Test) EXPECT_NEAR(thisChillerHeater.ExhaustInFlow, 0.5, 1e-6); Real64 const CpAir = Psychrometrics::PsyCpAirFnW(exhaustInHumRate); - Real64 const epectedExhHeatRecPotentialHeat = exhaustInMassFlowRate * CpAir * (exhaustInTemp - absLeavingTemp); - EXPECT_NEAR(87891.51, epectedExhHeatRecPotentialHeat, 0.01); - EXPECT_NEAR(epectedExhHeatRecPotentialHeat, thisChillerHeater.ExhHeatRecPotentialHeat, 0.01); + Real64 const expectedExhHeatRecPotentialHeat = exhaustInMassFlowRate * CpAir * (exhaustInTemp - absLeavingTemp); + EXPECT_NEAR(87891.51, expectedExhHeatRecPotentialHeat, 0.01); + EXPECT_NEAR(expectedExhHeatRecPotentialHeat, thisChillerHeater.ExhHeatRecPotentialHeat, 0.01); } TEST_F(EnergyPlusFixture, ExhAbsorption_GetInput_Multiple_Objects_Test) From f75044027c63c52d666697a358cb1f3f2b77a8cb Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Mon, 18 Sep 2023 09:45:26 -0600 Subject: [PATCH 33/34] Update CMakeLists.txt Co-authored-by: Julien Marrec --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 240c821fbbb..0ca2f9e753c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ project(EnergyPlus) # Raise an error if attempting to compile on macOS older than 10.15 - it does not work if (APPLE) - if ("${CMAKE_OSX_DEPLOYMENT_TARGET}" STREQUAL "") + if(NOT CMAKE_OSX_DEPLOYMENT_TARGET) message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET not set. Please set CMAKE_OSX_DEPLOYMENT_TARGET to 10.15 or greater and try again.") elseif (CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS "10.15") message(FATAL_ERROR "The minimum required version for macOS is 10.15, however CMAKE_OSX_DEPLOYMENT_TARGET is set to ${CMAKE_OSX_DEPLOYMENT_TARGET}.") From ba405f2e2561968977bc083531258aa6fc09d426 Mon Sep 17 00:00:00 2001 From: Edwin Lee Date: Tue, 19 Sep 2023 09:04:01 -0500 Subject: [PATCH 34/34] Clang format --- src/EnergyPlus/OutputReportTabular.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 34363e4136b..e7565922a9b 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -3138,7 +3138,8 @@ void OpenOutputTabularFile(EnergyPlusData &state) open_tbl_stream(state, iStyle, state.dataStrGlobals->outputTblXmlFilePath, state.files.outputControl.tabular); tbl_stream << "\n"; tbl_stream << "\n"; - tbl_stream << " BuildingName>" << ConvertToEscaped(state.dataHeatBal->BuildingName) << "BuildingName>\n"; + tbl_stream << " BuildingName>" << ConvertToEscaped(state.dataHeatBal->BuildingName) + << "BuildingName>\n"; tbl_stream << " " << state.dataEnvrn->EnvironmentName << "\n"; tbl_stream << " " << state.dataEnvrn->WeatherFileLocationTitle << "\n"; tbl_stream << " " << state.dataStrGlobals->VerStringVar << "\n";