Merge changes from topic "make-displayid-opaque" into main
* changes:
SF: Remove PhysicalDisplayId::getPort()
SF: Remove *DisplayId::tryCast and DisplayId::isVirtual()
SF: Remove *DisplayId::tryCast usage from ScreenCaptureOutput
SF: Remove *DisplayId::tryCast usage from VirtualDisplaySurface
SF: Remove *DisplayId::tryCast usage from Output
diff --git a/include/input/DisplayTopologyGraph.h b/include/input/DisplayTopologyGraph.h
index 3ae865a..9fc080d 100644
--- a/include/input/DisplayTopologyGraph.h
+++ b/include/input/DisplayTopologyGraph.h
@@ -46,6 +46,8 @@
DisplayTopologyPosition position;
// The offset in DP of the adjacent display, relative to the source display.
float offsetDp;
+
+ std::string dump() const;
};
/**
@@ -55,6 +57,9 @@
ui::LogicalDisplayId primaryDisplayId = ui::LogicalDisplayId::INVALID;
std::unordered_map<ui::LogicalDisplayId, std::vector<DisplayTopologyAdjacentDisplay>> graph;
std::unordered_map<ui::LogicalDisplayId, int> displaysDensity;
+
+ bool isValid() const;
+ std::string dump() const;
};
} // namespace android
diff --git a/libs/binder/Android.bp b/libs/binder/Android.bp
index ea5343a..a3499c1 100644
--- a/libs/binder/Android.bp
+++ b/libs/binder/Android.bp
@@ -277,15 +277,6 @@
"-fvisibility=hidden",
"-DBUILDING_LIBBINDER",
],
-
- target: {
- vendor: {
- // Trimming the exported symbols reveals a bug in vendor code, so
- // disable it for the vendor variant for now. http://b/349657329
- // TODO: Fix the issue and remove this override.
- cflags: ["-fvisibility=default"],
- },
- },
}
cc_defaults {
diff --git a/libs/binder/rust/rpcbinder/src/lib.rs b/libs/binder/rust/rpcbinder/src/lib.rs
index 7e5c9dd..774bb21 100644
--- a/libs/binder/rust/rpcbinder/src/lib.rs
+++ b/libs/binder/rust/rpcbinder/src/lib.rs
@@ -20,6 +20,8 @@
mod session;
pub use server::RpcServer;
+#[cfg(target_os = "trusty")]
+pub use server::RpcServerConnection;
#[cfg(not(target_os = "trusty"))]
pub use server::RpcServerRef;
pub use session::{FileDescriptorTransportMode, RpcSession, RpcSessionRef};
diff --git a/libs/graphicsenv/GraphicsEnv.cpp b/libs/graphicsenv/GraphicsEnv.cpp
index 626581c..03e6456 100644
--- a/libs/graphicsenv/GraphicsEnv.cpp
+++ b/libs/graphicsenv/GraphicsEnv.cpp
@@ -639,7 +639,7 @@
// List of ANGLE features to override (enabled or disable).
// The list of overrides is loaded and parsed by GpuService.
void GraphicsEnv::updateAngleFeatureOverrides() {
- if (!graphicsenv_flags::feature_overrides()) {
+ if (!graphicsenv_flags::angle_feature_overrides()) {
return;
}
@@ -654,7 +654,7 @@
void GraphicsEnv::getAngleFeatureOverrides(std::vector<const char*>& enabled,
std::vector<const char*>& disabled) {
- if (!graphicsenv_flags::feature_overrides()) {
+ if (!graphicsenv_flags::angle_feature_overrides()) {
return;
}
diff --git a/libs/graphicsenv/graphicsenv_flags.aconfig b/libs/graphicsenv/graphicsenv_flags.aconfig
index ac66362..efa4bca 100644
--- a/libs/graphicsenv/graphicsenv_flags.aconfig
+++ b/libs/graphicsenv/graphicsenv_flags.aconfig
@@ -2,8 +2,8 @@
container: "system"
flag {
- name: "feature_overrides"
- namespace: "core_graphics"
- description: "This flag controls the Feature Overrides in GraphicsEnv."
+ name: "angle_feature_overrides"
+ namespace: "gpu"
+ description: "This flag controls the ANGLE Feature Overrides in GraphicsEnv."
bug: "372694741"
}
diff --git a/libs/gui/BufferItemConsumer.cpp b/libs/gui/BufferItemConsumer.cpp
index 1585aae..4926ceb 100644
--- a/libs/gui/BufferItemConsumer.cpp
+++ b/libs/gui/BufferItemConsumer.cpp
@@ -17,6 +17,7 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "BufferItemConsumer"
//#define ATRACE_TAG ATRACE_TAG_GRAPHICS
+#include <utils/Errors.h>
#include <utils/Log.h>
#include <inttypes.h>
@@ -132,13 +133,36 @@
return OK;
}
+status_t BufferItemConsumer::attachBuffer(const sp<GraphicBuffer>& buffer) {
+ if (!buffer) {
+ BI_LOGE("BufferItemConsumer::attachBuffer no input buffer specified.");
+ return BAD_VALUE;
+ }
+
+ Mutex::Autolock _l(mMutex);
+
+ int slot = INVALID_BUFFER_SLOT;
+ status_t status = mConsumer->attachBuffer(&slot, buffer);
+ if (status != OK) {
+ BI_LOGE("BufferItemConsumer::attachBuffer unable to attach buffer %d", status);
+ return status;
+ }
+
+ mSlots[slot] = {
+ .mGraphicBuffer = buffer,
+ .mFence = nullptr,
+ .mFrameNumber = 0,
+ };
+
+ return OK;
+}
+
status_t BufferItemConsumer::releaseBuffer(const BufferItem &item,
const sp<Fence>& releaseFence) {
Mutex::Autolock _l(mMutex);
return releaseBufferSlotLocked(item.mSlot, item.mGraphicBuffer, releaseFence);
}
-#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_PLATFORM_API_IMPROVEMENTS)
status_t BufferItemConsumer::releaseBuffer(const sp<GraphicBuffer>& buffer,
const sp<Fence>& releaseFence) {
Mutex::Autolock _l(mMutex);
@@ -154,7 +178,6 @@
return releaseBufferSlotLocked(slotIndex, buffer, releaseFence);
}
-#endif // COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_PLATFORM_API_IMPROVEMENTS)
status_t BufferItemConsumer::releaseBufferSlotLocked(int slotIndex, const sp<GraphicBuffer>& buffer,
const sp<Fence>& releaseFence) {
diff --git a/libs/gui/BufferQueueConsumer.cpp b/libs/gui/BufferQueueConsumer.cpp
index 270bfbd..4681c9e 100644
--- a/libs/gui/BufferQueueConsumer.cpp
+++ b/libs/gui/BufferQueueConsumer.cpp
@@ -14,10 +14,6 @@
* limitations under the License.
*/
-#include <inttypes.h>
-#include <pwd.h>
-#include <sys/types.h>
-
#define LOG_TAG "BufferQueueConsumer"
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
//#define LOG_NDEBUG 0
@@ -48,6 +44,11 @@
#include <com_android_graphics_libgui_flags.h>
+#include <inttypes.h>
+#include <pwd.h>
+#include <sys/types.h>
+#include <optional>
+
namespace android {
// Macros for include BufferQueueCore information in log messages
@@ -767,11 +768,15 @@
return NO_ERROR;
}
+status_t BufferQueueConsumer::setMaxAcquiredBufferCount(int maxAcquiredBuffers) {
+ return setMaxAcquiredBufferCount(maxAcquiredBuffers, std::nullopt);
+}
+
status_t BufferQueueConsumer::setMaxAcquiredBufferCount(
- int maxAcquiredBuffers) {
+ int maxAcquiredBuffers, std::optional<OnBufferReleasedCallback> onBuffersReleasedCallback) {
ATRACE_FORMAT("%s(%d)", __func__, maxAcquiredBuffers);
- sp<IConsumerListener> listener;
+ std::optional<OnBufferReleasedCallback> callback;
{ // Autolock scope
std::unique_lock<std::mutex> lock(mCore->mMutex);
@@ -833,13 +838,20 @@
BQ_LOGV("setMaxAcquiredBufferCount: %d", maxAcquiredBuffers);
mCore->mMaxAcquiredBufferCount = maxAcquiredBuffers;
VALIDATE_CONSISTENCY();
- if (delta < 0 && mCore->mBufferReleasedCbEnabled) {
- listener = mCore->mConsumerListener;
+ if (delta < 0) {
+ if (onBuffersReleasedCallback) {
+ callback = std::move(onBuffersReleasedCallback);
+ } else if (mCore->mBufferReleasedCbEnabled) {
+ callback = [listener = mCore->mConsumerListener]() {
+ listener->onBuffersReleased();
+ };
+ }
}
}
+
// Call back without lock held
- if (listener != nullptr) {
- listener->onBuffersReleased();
+ if (callback) {
+ (*callback)();
}
return NO_ERROR;
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index 5961b41..bcf61e4 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -364,8 +364,10 @@
// Producers are not allowed to dequeue more than
// mMaxDequeuedBufferCount buffers.
// This check is only done if a buffer has already been queued
- if (mCore->mBufferHasBeenQueued &&
- dequeuedCount >= mCore->mMaxDequeuedBufferCount) {
+ using namespace com::android::graphics::libgui::flags;
+ bool flagGatedBufferHasBeenQueued =
+ bq_always_use_max_dequeued_buffer_count() || mCore->mBufferHasBeenQueued;
+ if (flagGatedBufferHasBeenQueued && dequeuedCount >= mCore->mMaxDequeuedBufferCount) {
// Supress error logs when timeout is non-negative.
if (mDequeueTimeout < 0) {
BQ_LOGE("%s: attempting to exceed the max dequeued buffer "
diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp
index 117a362..5b89c6e 100644
--- a/libs/gui/ConsumerBase.cpp
+++ b/libs/gui/ConsumerBase.cpp
@@ -264,7 +264,10 @@
void ConsumerBase::onBuffersReleased() {
Mutex::Autolock lock(mMutex);
+ onBuffersReleasedLocked();
+}
+void ConsumerBase::onBuffersReleasedLocked() {
CB_LOGV("onBuffersReleased");
if (mAbandoned) {
@@ -481,7 +484,8 @@
CB_LOGE("setMaxAcquiredBufferCount: ConsumerBase is abandoned!");
return NO_INIT;
}
- return mConsumer->setMaxAcquiredBufferCount(maxAcquiredBuffers);
+ return mConsumer->setMaxAcquiredBufferCount(maxAcquiredBuffers,
+ {[this]() { onBuffersReleasedLocked(); }});
}
status_t ConsumerBase::setConsumerIsProtected(bool isProtected) {
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index 2699368..ae4b74e 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -26,6 +26,7 @@
#include <gui/ISurfaceComposer.h>
#include <gui/LayerState.h>
#include <gui/SchedulingPolicy.h>
+#include <gui/TransactionState.h>
#include <private/gui/ParcelUtils.h>
#include <stdint.h>
#include <sys/types.h>
@@ -60,54 +61,12 @@
virtual ~BpSurfaceComposer();
- status_t setTransactionState(
- const FrameTimelineInfo& frameTimelineInfo, Vector<ComposerState>& state,
- Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken,
- InputWindowCommands commands, int64_t desiredPresentTime, bool isAutoTimestamp,
- const std::vector<client_cache_t>& uncacheBuffers, bool hasListenerCallbacks,
- const std::vector<ListenerCallbacks>& listenerCallbacks, uint64_t transactionId,
- const std::vector<uint64_t>& mergedTransactionIds) override {
+ status_t setTransactionState(TransactionState&& state) override {
Parcel data, reply;
data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
+ SAFE_PARCEL(state.writeToParcel, &data);
- frameTimelineInfo.writeToParcel(&data);
-
- SAFE_PARCEL(data.writeUint32, static_cast<uint32_t>(state.size()));
- for (const auto& s : state) {
- SAFE_PARCEL(s.write, data);
- }
-
- SAFE_PARCEL(data.writeUint32, static_cast<uint32_t>(displays.size()));
- for (const auto& d : displays) {
- SAFE_PARCEL(d.write, data);
- }
-
- SAFE_PARCEL(data.writeUint32, flags);
- SAFE_PARCEL(data.writeStrongBinder, applyToken);
- SAFE_PARCEL(commands.write, data);
- SAFE_PARCEL(data.writeInt64, desiredPresentTime);
- SAFE_PARCEL(data.writeBool, isAutoTimestamp);
- SAFE_PARCEL(data.writeUint32, static_cast<uint32_t>(uncacheBuffers.size()));
- for (const client_cache_t& uncacheBuffer : uncacheBuffers) {
- SAFE_PARCEL(data.writeStrongBinder, uncacheBuffer.token.promote());
- SAFE_PARCEL(data.writeUint64, uncacheBuffer.id);
- }
- SAFE_PARCEL(data.writeBool, hasListenerCallbacks);
-
- SAFE_PARCEL(data.writeVectorSize, listenerCallbacks);
- for (const auto& [listener, callbackIds] : listenerCallbacks) {
- SAFE_PARCEL(data.writeStrongBinder, listener);
- SAFE_PARCEL(data.writeParcelableVector, callbackIds);
- }
-
- SAFE_PARCEL(data.writeUint64, transactionId);
-
- SAFE_PARCEL(data.writeUint32, static_cast<uint32_t>(mergedTransactionIds.size()));
- for (auto mergedTransactionId : mergedTransactionIds) {
- SAFE_PARCEL(data.writeUint64, mergedTransactionId);
- }
-
- if (flags & ISurfaceComposer::eOneWay) {
+ if (state.mFlags & ISurfaceComposer::eOneWay) {
return remote()->transact(BnSurfaceComposer::SET_TRANSACTION_STATE,
data, &reply, IBinder::FLAG_ONEWAY);
} else {
@@ -132,75 +91,9 @@
case SET_TRANSACTION_STATE: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
- FrameTimelineInfo frameTimelineInfo;
- frameTimelineInfo.readFromParcel(&data);
-
- uint32_t count = 0;
- SAFE_PARCEL_READ_SIZE(data.readUint32, &count, data.dataSize());
- Vector<ComposerState> state;
- state.setCapacity(count);
- for (size_t i = 0; i < count; i++) {
- ComposerState s;
- SAFE_PARCEL(s.read, data);
- state.add(s);
- }
-
- SAFE_PARCEL_READ_SIZE(data.readUint32, &count, data.dataSize());
- DisplayState d;
- Vector<DisplayState> displays;
- displays.setCapacity(count);
- for (size_t i = 0; i < count; i++) {
- SAFE_PARCEL(d.read, data);
- displays.add(d);
- }
-
- uint32_t stateFlags = 0;
- SAFE_PARCEL(data.readUint32, &stateFlags);
- sp<IBinder> applyToken;
- SAFE_PARCEL(data.readStrongBinder, &applyToken);
- InputWindowCommands inputWindowCommands;
- SAFE_PARCEL(inputWindowCommands.read, data);
-
- int64_t desiredPresentTime = 0;
- bool isAutoTimestamp = true;
- SAFE_PARCEL(data.readInt64, &desiredPresentTime);
- SAFE_PARCEL(data.readBool, &isAutoTimestamp);
-
- SAFE_PARCEL_READ_SIZE(data.readUint32, &count, data.dataSize());
- std::vector<client_cache_t> uncacheBuffers(count);
- sp<IBinder> tmpBinder;
- for (size_t i = 0; i < count; i++) {
- SAFE_PARCEL(data.readNullableStrongBinder, &tmpBinder);
- uncacheBuffers[i].token = tmpBinder;
- SAFE_PARCEL(data.readUint64, &uncacheBuffers[i].id);
- }
-
- bool hasListenerCallbacks = false;
- SAFE_PARCEL(data.readBool, &hasListenerCallbacks);
-
- std::vector<ListenerCallbacks> listenerCallbacks;
- int32_t listenersSize = 0;
- SAFE_PARCEL_READ_SIZE(data.readInt32, &listenersSize, data.dataSize());
- for (int32_t i = 0; i < listenersSize; i++) {
- SAFE_PARCEL(data.readStrongBinder, &tmpBinder);
- std::vector<CallbackId> callbackIds;
- SAFE_PARCEL(data.readParcelableVector, &callbackIds);
- listenerCallbacks.emplace_back(tmpBinder, callbackIds);
- }
-
- uint64_t transactionId = -1;
- SAFE_PARCEL(data.readUint64, &transactionId);
-
- SAFE_PARCEL_READ_SIZE(data.readUint32, &count, data.dataSize());
- std::vector<uint64_t> mergedTransactions(count);
- for (size_t i = 0; i < count; i++) {
- SAFE_PARCEL(data.readUint64, &mergedTransactions[i]);
- }
-
- return setTransactionState(frameTimelineInfo, state, displays, stateFlags, applyToken,
- std::move(inputWindowCommands), desiredPresentTime,
- isAutoTimestamp, uncacheBuffers, hasListenerCallbacks,
- listenerCallbacks, transactionId, mergedTransactions);
+ TransactionState state;
+ SAFE_PARCEL(state.readFromParcel, &data);
+ return setTransactionState(std::move(state));
}
case GET_SCHEDULING_POLICY: {
gui::SchedulingPolicy policy;
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 9854274..b0650d5 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -824,34 +824,25 @@
// ---------------------------------------------------------------------------
SurfaceComposerClient::Transaction::Transaction() {
- mId = generateId();
+ mState.mId = generateId();
mTransactionCompletedListener = TransactionCompletedListener::getInstance();
}
-SurfaceComposerClient::Transaction::Transaction(const Transaction& other)
- : mId(other.mId),
- mFlags(other.mFlags),
- mMayContainBuffer(other.mMayContainBuffer),
- mDesiredPresentTime(other.mDesiredPresentTime),
- mIsAutoTimestamp(other.mIsAutoTimestamp),
- mFrameTimelineInfo(other.mFrameTimelineInfo),
- mApplyToken(other.mApplyToken) {
- mDisplayStates = other.mDisplayStates;
- mComposerStates = other.mComposerStates;
- mInputWindowCommands = other.mInputWindowCommands;
+SurfaceComposerClient::Transaction::Transaction(const Transaction& other) {
+ mState = other.mState;
mListenerCallbacks = other.mListenerCallbacks;
mTransactionCompletedListener = TransactionCompletedListener::getInstance();
}
void SurfaceComposerClient::Transaction::sanitize(int pid, int uid) {
uint32_t permissions = LayerStatePermissions::getTransactionPermissions(pid, uid);
- for (auto& composerState : mComposerStates) {
+ for (auto& composerState : mState.mComposerStates) {
composerState.state.sanitize(permissions);
}
- if (!mInputWindowCommands.empty() &&
+ if (!mState.mInputWindowCommands.empty() &&
(permissions & layer_state_t::Permission::ACCESS_SURFACE_FLINGER) == 0) {
ALOGE("Only privileged callers are allowed to send input commands.");
- mInputWindowCommands.clear();
+ mState.mInputWindowCommands.clear();
}
}
@@ -866,34 +857,13 @@
status_t SurfaceComposerClient::Transaction::readFromParcel(const Parcel* parcel) {
- const uint64_t transactionId = parcel->readUint64();
- const uint32_t flags = parcel->readUint32();
- const int64_t desiredPresentTime = parcel->readInt64();
- const bool isAutoTimestamp = parcel->readBool();
- const bool logCallPoints = parcel->readBool();
- FrameTimelineInfo frameTimelineInfo;
- frameTimelineInfo.readFromParcel(parcel);
+ TransactionState tmpState;
+ SAFE_PARCEL(tmpState.readFromParcel, parcel);
- sp<IBinder> applyToken;
- parcel->readNullableStrongBinder(&applyToken);
size_t count = static_cast<size_t>(parcel->readUint32());
if (count > parcel->dataSize()) {
return BAD_VALUE;
}
- Vector<DisplayState> displayStates;
- displayStates.setCapacity(count);
- for (size_t i = 0; i < count; i++) {
- DisplayState displayState;
- if (displayState.read(*parcel) == BAD_VALUE) {
- return BAD_VALUE;
- }
- displayStates.add(displayState);
- }
-
- count = static_cast<size_t>(parcel->readUint32());
- if (count > parcel->dataSize()) {
- return BAD_VALUE;
- }
std::unordered_map<sp<ITransactionCompletedListener>, CallbackInfo, TCLHash> listenerCallbacks;
listenerCallbacks.reserve(count);
for (size_t i = 0; i < count; i++) {
@@ -919,57 +889,8 @@
}
}
- count = static_cast<size_t>(parcel->readUint32());
- if (count > parcel->dataSize()) {
- return BAD_VALUE;
- }
- Vector<ComposerState> composerStates;
- composerStates.setCapacity(count);
- for (size_t i = 0; i < count; i++) {
- ComposerState composerState;
- if (composerState.read(*parcel) == BAD_VALUE) {
- return BAD_VALUE;
- }
- composerStates.add(composerState);
- }
-
- InputWindowCommands inputWindowCommands;
- inputWindowCommands.read(*parcel);
-
- count = static_cast<size_t>(parcel->readUint32());
- if (count > parcel->dataSize()) {
- return BAD_VALUE;
- }
- std::vector<client_cache_t> uncacheBuffers(count);
- for (size_t i = 0; i < count; i++) {
- sp<IBinder> tmpBinder;
- SAFE_PARCEL(parcel->readStrongBinder, &tmpBinder);
- uncacheBuffers[i].token = tmpBinder;
- SAFE_PARCEL(parcel->readUint64, &uncacheBuffers[i].id);
- }
-
- count = static_cast<size_t>(parcel->readUint32());
- if (count > parcel->dataSize()) {
- return BAD_VALUE;
- }
- std::vector<uint64_t> mergedTransactionIds(count);
- for (size_t i = 0; i < count; i++) {
- SAFE_PARCEL(parcel->readUint64, &mergedTransactionIds[i]);
- }
-
- // Parsing was successful. Update the object.
- mId = transactionId;
- mFlags = flags;
- mDesiredPresentTime = desiredPresentTime;
- mIsAutoTimestamp = isAutoTimestamp;
- mFrameTimelineInfo = frameTimelineInfo;
- mDisplayStates = std::move(displayStates);
- mListenerCallbacks = listenerCallbacks;
- mComposerStates = std::move(composerStates);
- mInputWindowCommands = inputWindowCommands;
- mApplyToken = applyToken;
- mUncacheBuffers = std::move(uncacheBuffers);
- mMergedTransactionIds = std::move(mergedTransactionIds);
+ mState = std::move(tmpState);
+ mListenerCallbacks = std::move(listenerCallbacks);
return NO_ERROR;
}
@@ -987,17 +908,7 @@
const_cast<SurfaceComposerClient::Transaction*>(this)->cacheBuffers();
- parcel->writeUint64(mId);
- parcel->writeUint32(mFlags);
- parcel->writeInt64(mDesiredPresentTime);
- parcel->writeBool(mIsAutoTimestamp);
- parcel->writeBool(mLogCallPoints);
- mFrameTimelineInfo.writeToParcel(parcel);
- parcel->writeStrongBinder(mApplyToken);
- parcel->writeUint32(static_cast<uint32_t>(mDisplayStates.size()));
- for (auto const& displayState : mDisplayStates) {
- displayState.write(*parcel);
- }
+ SAFE_PARCEL(mState.writeToParcel, parcel);
parcel->writeUint32(static_cast<uint32_t>(mListenerCallbacks.size()));
for (auto const& [listener, callbackInfo] : mListenerCallbacks) {
@@ -1012,24 +923,6 @@
}
}
- parcel->writeUint32(static_cast<uint32_t>(mComposerStates.size()));
- for (auto const& composerState : mComposerStates) {
- composerState.write(*parcel);
- }
-
- mInputWindowCommands.write(*parcel);
-
- SAFE_PARCEL(parcel->writeUint32, static_cast<uint32_t>(mUncacheBuffers.size()));
- for (const client_cache_t& uncacheBuffer : mUncacheBuffers) {
- SAFE_PARCEL(parcel->writeStrongBinder, uncacheBuffer.token.promote());
- SAFE_PARCEL(parcel->writeUint64, uncacheBuffer.id);
- }
-
- SAFE_PARCEL(parcel->writeUint32, static_cast<uint32_t>(mMergedTransactionIds.size()));
- for (auto mergedTransactionId : mMergedTransactionIds) {
- SAFE_PARCEL(parcel->writeUint64, mergedTransactionId);
- }
-
return NO_ERROR;
}
@@ -1054,50 +947,8 @@
}
SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::merge(Transaction&& other) {
- while (mMergedTransactionIds.size() + other.mMergedTransactionIds.size() >
- MAX_MERGE_HISTORY_LENGTH - 1 &&
- mMergedTransactionIds.size() > 0) {
- mMergedTransactionIds.pop_back();
- }
- if (other.mMergedTransactionIds.size() == MAX_MERGE_HISTORY_LENGTH) {
- mMergedTransactionIds.insert(mMergedTransactionIds.begin(),
- other.mMergedTransactionIds.begin(),
- other.mMergedTransactionIds.end() - 1);
- } else if (other.mMergedTransactionIds.size() > 0u) {
- mMergedTransactionIds.insert(mMergedTransactionIds.begin(),
- other.mMergedTransactionIds.begin(),
- other.mMergedTransactionIds.end());
- }
- mMergedTransactionIds.insert(mMergedTransactionIds.begin(), other.mId);
-
- for (auto const& otherState : other.mComposerStates) {
- if (auto it = std::find_if(mComposerStates.begin(), mComposerStates.end(),
- [&otherState](const auto& composerState) {
- return composerState.state.surface ==
- otherState.state.surface;
- });
- it != mComposerStates.end()) {
- if (otherState.state.what & layer_state_t::eBufferChanged) {
- releaseBufferIfOverwriting(it->state);
- }
- it->state.merge(otherState.state);
- } else {
- mComposerStates.add(otherState);
- }
- }
-
- for (auto const& state : other.mDisplayStates) {
- if (auto it = std::find_if(mDisplayStates.begin(), mDisplayStates.end(),
- [&state](const auto& displayState) {
- return displayState.token == state.token;
- });
- it != mDisplayStates.end()) {
- it->merge(state);
- } else {
- mDisplayStates.add(state);
- }
- }
-
+ mState.merge(std::move(other.mState),
+ std::bind(&Transaction::releaseBufferIfOverwriting, this, std::placeholders::_1));
for (const auto& [listener, callbackInfo] : other.mListenerCallbacks) {
auto& [callbackIds, surfaceControls] = callbackInfo;
mListenerCallbacks[listener].callbackIds.insert(std::make_move_iterator(
@@ -1121,50 +972,21 @@
}
}
- for (const auto& cacheId : other.mUncacheBuffers) {
- mUncacheBuffers.push_back(cacheId);
- }
-
- mInputWindowCommands.merge(other.mInputWindowCommands);
-
- mMayContainBuffer |= other.mMayContainBuffer;
- mFlags |= other.mFlags;
- mApplyToken = other.mApplyToken;
-
- mergeFrameTimelineInfo(mFrameTimelineInfo, other.mFrameTimelineInfo);
-
- mLogCallPoints |= other.mLogCallPoints;
- if (mLogCallPoints) {
- ALOG(LOG_DEBUG, LOG_SURFACE_CONTROL_REGISTRY,
- "Transaction %" PRIu64 " merged with transaction %" PRIu64, other.getId(), mId);
- }
-
other.clear();
return *this;
}
void SurfaceComposerClient::Transaction::clear() {
- mComposerStates.clear();
- mDisplayStates.clear();
+ mState.clear();
mListenerCallbacks.clear();
- mInputWindowCommands.clear();
- mUncacheBuffers.clear();
- mMayContainBuffer = false;
- mDesiredPresentTime = 0;
- mIsAutoTimestamp = true;
- mFrameTimelineInfo = {};
- mApplyToken = nullptr;
- mMergedTransactionIds.clear();
- mLogCallPoints = false;
- mFlags = 0;
}
-uint64_t SurfaceComposerClient::Transaction::getId() {
- return mId;
+uint64_t SurfaceComposerClient::Transaction::getId() const {
+ return mState.mId;
}
std::vector<uint64_t> SurfaceComposerClient::Transaction::getMergedTransactionIds() {
- return mMergedTransactionIds;
+ return mState.mMergedTransactionIds;
}
void SurfaceComposerClient::doUncacheBufferTransaction(uint64_t cacheId) {
@@ -1173,12 +995,13 @@
client_cache_t uncacheBuffer;
uncacheBuffer.token = BufferCache::getInstance().getToken();
uncacheBuffer.id = cacheId;
- Vector<ComposerState> composerStates;
- Vector<DisplayState> displayStates;
- status_t status = sf->setTransactionState(FrameTimelineInfo{}, composerStates, displayStates,
- ISurfaceComposer::eOneWay,
- Transaction::getDefaultApplyToken(), {}, systemTime(),
- true, {uncacheBuffer}, false, {}, generateId(), {});
+ TransactionState state;
+ state.mId = generateId();
+ state.mApplyToken = Transaction::getDefaultApplyToken();
+ state.mUncacheBuffers.emplace_back(std::move(uncacheBuffer));
+ state.mFlags = ISurfaceComposer::eOneWay;
+ state.mDesiredPresentTime = systemTime();
+ status_t status = sf->setTransactionState(std::move(state));
if (status != NO_ERROR) {
ALOGE_AND_TRACE("SurfaceComposerClient::doUncacheBufferTransaction - %s",
strerror(-status));
@@ -1186,12 +1009,12 @@
}
void SurfaceComposerClient::Transaction::cacheBuffers() {
- if (!mMayContainBuffer) {
+ if (!mState.mMayContainBuffer) {
return;
}
size_t count = 0;
- for (auto& cs : mComposerStates) {
+ for (auto& cs : mState.mComposerStates) {
layer_state_t* s = &cs.state;
if (!(s->what & layer_state_t::eBufferChanged)) {
continue;
@@ -1219,7 +1042,7 @@
std::optional<client_cache_t> uncacheBuffer;
cacheId = BufferCache::getInstance().cache(s->bufferData->buffer, uncacheBuffer);
if (uncacheBuffer) {
- mUncacheBuffers.push_back(*uncacheBuffer);
+ mState.mUncacheBuffers.emplace_back(*uncacheBuffer);
}
}
s->bufferData->flags |= BufferData::BufferDataChange::cachedBufferChanged;
@@ -1288,8 +1111,7 @@
/*callbackContext=*/nullptr);
}
- bool hasListenerCallbacks = !mListenerCallbacks.empty();
- std::vector<ListenerCallbacks> listenerCallbacks;
+ mState.mHasListenerCallbacks = !mListenerCallbacks.empty();
// For every listener with registered callbacks
for (const auto& [listener, callbackInfo] : mListenerCallbacks) {
auto& [callbackIds, surfaceControls] = callbackInfo;
@@ -1298,7 +1120,8 @@
}
if (surfaceControls.empty()) {
- listenerCallbacks.emplace_back(IInterface::asBinder(listener), std::move(callbackIds));
+ mState.mListenerCallbacks.emplace_back(IInterface::asBinder(listener),
+ std::move(callbackIds));
} else {
// If the listener has any SurfaceControls set on this Transaction update the surface
// state
@@ -1310,7 +1133,7 @@
}
std::vector<CallbackId> callbacks(callbackIds.begin(), callbackIds.end());
s->what |= layer_state_t::eHasListenerCallbacksChanged;
- s->listeners.emplace_back(IInterface::asBinder(listener), callbacks);
+ s->listeners.emplace_back(IInterface::asBinder(listener), std::move(callbacks));
}
}
}
@@ -1322,25 +1145,21 @@
ALOGE("Transaction attempted to set synchronous and one way at the same time"
" this is an invalid request. Synchronous will win for safety");
} else {
- mFlags |= ISurfaceComposer::eOneWay;
+ mState.mFlags |= ISurfaceComposer::eOneWay;
}
}
// If both ISurfaceComposer::eEarlyWakeupStart and ISurfaceComposer::eEarlyWakeupEnd are set
// it is equivalent for none
uint32_t wakeupFlags = ISurfaceComposer::eEarlyWakeupStart | ISurfaceComposer::eEarlyWakeupEnd;
- if ((mFlags & wakeupFlags) == wakeupFlags) {
- mFlags &= ~(wakeupFlags);
+ if ((mState.mFlags & wakeupFlags) == wakeupFlags) {
+ mState.mFlags &= ~(wakeupFlags);
}
- sp<IBinder> applyToken = mApplyToken ? mApplyToken : getDefaultApplyToken();
+ if (!mState.mApplyToken) mState.mApplyToken = getDefaultApplyToken();
sp<ISurfaceComposer> sf(ComposerService::getComposerService());
- status_t binderStatus =
- sf->setTransactionState(mFrameTimelineInfo, mComposerStates, mDisplayStates, mFlags,
- applyToken, mInputWindowCommands, mDesiredPresentTime,
- mIsAutoTimestamp, mUncacheBuffers, hasListenerCallbacks,
- listenerCallbacks, mId, mMergedTransactionIds);
- mId = generateId();
+ status_t binderStatus = sf->setTransactionState(std::move(mState));
+ mState.mId = generateId();
// Clear the current states and flags
clear();
@@ -1349,8 +1168,8 @@
syncCallback->wait();
}
- if (mLogCallPoints) {
- ALOG(LOG_DEBUG, LOG_SURFACE_CONTROL_REGISTRY, "Transaction %" PRIu64 " applied", mId);
+ if (mState.mLogCallPoints) {
+ ALOG(LOG_DEBUG, LOG_SURFACE_CONTROL_REGISTRY, "Transaction %" PRIu64 " applied", getId());
}
mStatus = NO_ERROR;
@@ -1385,7 +1204,7 @@
}
void SurfaceComposerClient::Transaction::enableDebugLogCallPoints() {
- mLogCallPoints = true;
+ mState.mLogCallPoints = true;
}
// ---------------------------------------------------------------------------
@@ -1443,34 +1262,19 @@
}
void SurfaceComposerClient::Transaction::setAnimationTransaction() {
- mFlags |= ISurfaceComposer::eAnimation;
+ mState.mFlags |= ISurfaceComposer::eAnimation;
}
void SurfaceComposerClient::Transaction::setEarlyWakeupStart() {
- mFlags |= ISurfaceComposer::eEarlyWakeupStart;
+ mState.mFlags |= ISurfaceComposer::eEarlyWakeupStart;
}
void SurfaceComposerClient::Transaction::setEarlyWakeupEnd() {
- mFlags |= ISurfaceComposer::eEarlyWakeupEnd;
+ mState.mFlags |= ISurfaceComposer::eEarlyWakeupEnd;
}
layer_state_t* SurfaceComposerClient::Transaction::getLayerState(const sp<SurfaceControl>& sc) {
- auto handle = sc->getLayerStateHandle();
- if (auto it = std::find_if(mComposerStates.begin(), mComposerStates.end(),
- [&handle](const auto& composerState) {
- return composerState.state.surface == handle;
- });
- it != mComposerStates.end()) {
- return &it->state;
- }
-
- // we don't have it, add an initialized layer_state to our list
- ComposerState s;
- s.state.surface = handle;
- s.state.layerId = sc->getLayerId();
- mComposerStates.add(s);
-
- return &mComposerStates.editItemAt(mComposerStates.size() - 1).state;
+ return mState.getLayerState(sc);
}
void SurfaceComposerClient::Transaction::registerSurfaceControlForCallback(
@@ -1846,8 +1650,8 @@
setReleaseBufferCallback(bufferData.get(), callback);
}
- if (mIsAutoTimestamp) {
- mDesiredPresentTime = systemTime();
+ if (mState.mIsAutoTimestamp) {
+ mState.mDesiredPresentTime = systemTime();
}
s->what |= layer_state_t::eBufferChanged;
s->bufferData = std::move(bufferData);
@@ -1865,7 +1669,7 @@
const std::vector<SurfaceControlStats>&) {},
nullptr);
- mMayContainBuffer = true;
+ mState.mMayContainBuffer = true;
return *this;
}
@@ -2041,8 +1845,8 @@
SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setDesiredPresentTime(
nsecs_t desiredPresentTime) {
- mDesiredPresentTime = desiredPresentTime;
- mIsAutoTimestamp = false;
+ mState.mDesiredPresentTime = desiredPresentTime;
+ mState.mIsAutoTimestamp = false;
return *this;
}
@@ -2131,14 +1935,14 @@
SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setFocusedWindow(
const FocusRequest& request) {
- mInputWindowCommands.addFocusRequest(request);
+ mState.mInputWindowCommands.addFocusRequest(request);
return *this;
}
SurfaceComposerClient::Transaction&
SurfaceComposerClient::Transaction::addWindowInfosReportedListener(
sp<gui::IWindowInfosReportedListener> windowInfosReportedListener) {
- mInputWindowCommands.addWindowInfosReportedListener(windowInfosReportedListener);
+ mState.mInputWindowCommands.addWindowInfosReportedListener(windowInfosReportedListener);
return *this;
}
@@ -2302,7 +2106,7 @@
SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setFrameTimelineInfo(
const FrameTimelineInfo& frameTimelineInfo) {
- mergeFrameTimelineInfo(mFrameTimelineInfo, frameTimelineInfo);
+ mState.mergeFrameTimelineInfo(frameTimelineInfo);
return *this;
}
@@ -2341,7 +2145,7 @@
SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setApplyToken(
const sp<IBinder>& applyToken) {
- mApplyToken = applyToken;
+ mState.mApplyToken = applyToken;
return *this;
}
@@ -2469,17 +2273,7 @@
// ---------------------------------------------------------------------------
DisplayState& SurfaceComposerClient::Transaction::getDisplayState(const sp<IBinder>& token) {
- if (auto it = std::find_if(mDisplayStates.begin(), mDisplayStates.end(),
- [token](const auto& display) { return display.token == token; });
- it != mDisplayStates.end()) {
- return *it;
- }
-
- // If display state doesn't exist, add a new one.
- DisplayState s;
- s.token = token;
- mDisplayStates.add(s);
- return mDisplayStates.editItemAt(mDisplayStates.size() - 1);
+ return mState.getDisplayState(token);
}
status_t SurfaceComposerClient::Transaction::setDisplaySurface(const sp<IBinder>& token,
@@ -2532,20 +2326,6 @@
s.what |= DisplayState::eDisplaySizeChanged;
}
-// copied from FrameTimelineInfo::merge()
-void SurfaceComposerClient::Transaction::mergeFrameTimelineInfo(FrameTimelineInfo& t,
- const FrameTimelineInfo& other) {
- // When merging vsync Ids we take the oldest valid one
- if (t.vsyncId != FrameTimelineInfo::INVALID_VSYNC_ID &&
- other.vsyncId != FrameTimelineInfo::INVALID_VSYNC_ID) {
- if (other.vsyncId > t.vsyncId) {
- t = other;
- }
- } else if (t.vsyncId == FrameTimelineInfo::INVALID_VSYNC_ID) {
- t = other;
- }
-}
-
SurfaceComposerClient::Transaction&
SurfaceComposerClient::Transaction::setTrustedPresentationCallback(
const sp<SurfaceControl>& sc, TrustedPresentationCallback cb,
diff --git a/libs/gui/include/gui/BufferItemConsumer.h b/libs/gui/include/gui/BufferItemConsumer.h
index 0bfa7b2..fc31f46 100644
--- a/libs/gui/include/gui/BufferItemConsumer.h
+++ b/libs/gui/include/gui/BufferItemConsumer.h
@@ -96,6 +96,14 @@
status_t acquireBuffer(BufferItem* item, nsecs_t presentWhen,
bool waitForFence = true);
+ // Transfer ownership of a buffer to the BufferQueue. On NO_ERROR, the buffer
+ // is considered as if it were acquired. Buffer must not be null.
+ //
+ // Returns
+ // - BAD_VALUE if buffer is null
+ // - INVALID_OPERATION if too many buffers have already been acquired
+ status_t attachBuffer(const sp<GraphicBuffer>& buffer);
+
// Returns an acquired buffer to the queue, allowing it to be reused. Since
// only a fixed number of buffers may be acquired at a time, old buffers
// must be released by calling releaseBuffer to ensure new buffers can be
@@ -105,10 +113,8 @@
status_t releaseBuffer(const BufferItem &item,
const sp<Fence>& releaseFence = Fence::NO_FENCE);
-#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_PLATFORM_API_IMPROVEMENTS)
status_t releaseBuffer(const sp<GraphicBuffer>& buffer,
const sp<Fence>& releaseFence = Fence::NO_FENCE);
-#endif // COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_PLATFORM_API_IMPROVEMENTS)
protected:
#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)
diff --git a/libs/gui/include/gui/BufferQueueConsumer.h b/libs/gui/include/gui/BufferQueueConsumer.h
index ab1231a..ba6a6a7 100644
--- a/libs/gui/include/gui/BufferQueueConsumer.h
+++ b/libs/gui/include/gui/BufferQueueConsumer.h
@@ -122,7 +122,10 @@
// setMaxAcquiredBufferCount sets the maximum number of buffers that can
// be acquired by the consumer at one time (default 1). This call will
// fail if a producer is connected to the BufferQueue.
- virtual status_t setMaxAcquiredBufferCount(int maxAcquiredBuffers);
+ virtual status_t setMaxAcquiredBufferCount(int maxAcquiredBuffers) override;
+ virtual status_t setMaxAcquiredBufferCount(
+ int maxAcquiredBuffers,
+ std::optional<OnBufferReleasedCallback> onBuffersReleasedCallback) override;
// setConsumerName sets the name used in logging
status_t setConsumerName(const String8& name) override;
diff --git a/libs/gui/include/gui/ConsumerBase.h b/libs/gui/include/gui/ConsumerBase.h
index fd67f09..d2215ef 100644
--- a/libs/gui/include/gui/ConsumerBase.h
+++ b/libs/gui/include/gui/ConsumerBase.h
@@ -191,6 +191,8 @@
#endif
virtual int getSlotForBufferLocked(const sp<GraphicBuffer>& buffer);
+ virtual void onBuffersReleasedLocked();
+
virtual status_t detachBufferLocked(int slotIndex);
// freeBufferLocked frees up the given buffer slot. If the slot has been
diff --git a/libs/gui/include/gui/IGraphicBufferConsumer.h b/libs/gui/include/gui/IGraphicBufferConsumer.h
index 8272a59..8066b07 100644
--- a/libs/gui/include/gui/IGraphicBufferConsumer.h
+++ b/libs/gui/include/gui/IGraphicBufferConsumer.h
@@ -243,6 +243,9 @@
// maxAcquiredBuffers must be (inclusive) between 1 and MAX_MAX_ACQUIRED_BUFFERS. It also cannot
// cause the maxBufferCount value to be exceeded.
//
+ // If called with onBuffersReleasedCallback, that call back will be called in lieu of
+ // IConsumerListener::onBuffersReleased.
+ //
// Return of a value other than NO_ERROR means an error has occurred:
// * NO_INIT - the BufferQueue has been abandoned
// * BAD_VALUE - one of the below conditions occurred:
@@ -253,6 +256,11 @@
// * INVALID_OPERATION - attempting to call this after a producer connected.
virtual status_t setMaxAcquiredBufferCount(int maxAcquiredBuffers) = 0;
+ using OnBufferReleasedCallback = std::function<void(void)>;
+ virtual status_t setMaxAcquiredBufferCount(
+ int maxAcquiredBuffers,
+ std::optional<OnBufferReleasedCallback> onBuffersReleasedCallback) = 0;
+
// setConsumerName sets the name used in logging
virtual status_t setConsumerName(const String8& name) = 0;
diff --git a/libs/gui/include/gui/ISurfaceComposer.h b/libs/gui/include/gui/ISurfaceComposer.h
index 9a422fd..de553ae 100644
--- a/libs/gui/include/gui/ISurfaceComposer.h
+++ b/libs/gui/include/gui/ISurfaceComposer.h
@@ -65,6 +65,7 @@
struct InputWindowCommands;
class HdrCapabilities;
class Rect;
+class TransactionState;
using gui::FrameTimelineInfo;
using gui::IDisplayEventConnection;
@@ -105,13 +106,7 @@
};
/* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */
- virtual status_t setTransactionState(
- const FrameTimelineInfo& frameTimelineInfo, Vector<ComposerState>& state,
- Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken,
- InputWindowCommands inputWindowCommands, int64_t desiredPresentTime,
- bool isAutoTimestamp, const std::vector<client_cache_t>& uncacheBuffer,
- bool hasListenerCallbacks, const std::vector<ListenerCallbacks>& listenerCallbacks,
- uint64_t transactionId, const std::vector<uint64_t>& mergedTransactionIds) = 0;
+ virtual status_t setTransactionState(TransactionState&& state) = 0;
};
// ----------------------------------------------------------------------------
diff --git a/libs/gui/include/gui/InputTransferToken.h b/libs/gui/include/gui/InputTransferToken.h
index fb4aaa7..b83f245 100644
--- a/libs/gui/include/gui/InputTransferToken.h
+++ b/libs/gui/include/gui/InputTransferToken.h
@@ -39,15 +39,9 @@
return NO_ERROR;
};
+ bool operator==(const InputTransferToken& other) const { return mToken == other.mToken; }
+
sp<IBinder> mToken;
};
-static inline bool operator==(const sp<InputTransferToken>& token1,
- const sp<InputTransferToken>& token2) {
- if (token1.get() == token2.get()) {
- return true;
- }
- return token1->mToken == token2->mToken;
-}
-
} // namespace android
diff --git a/libs/gui/include/gui/SurfaceComposerClient.h b/libs/gui/include/gui/SurfaceComposerClient.h
index 4fda8de..15e3341 100644
--- a/libs/gui/include/gui/SurfaceComposerClient.h
+++ b/libs/gui/include/gui/SurfaceComposerClient.h
@@ -52,6 +52,7 @@
#include <gui/ITransactionCompletedListener.h>
#include <gui/LayerState.h>
#include <gui/SurfaceControl.h>
+#include <gui/TransactionState.h>
#include <gui/WindowInfosListenerReporter.h>
#include <math/vec3.h>
@@ -447,56 +448,11 @@
static sp<IBinder> sApplyToken;
static std::mutex sApplyTokenMutex;
void releaseBufferIfOverwriting(const layer_state_t& state);
- static void mergeFrameTimelineInfo(FrameTimelineInfo& t, const FrameTimelineInfo& other);
// Tracks registered callbacks
sp<TransactionCompletedListener> mTransactionCompletedListener = nullptr;
- // Prints debug logs when enabled.
- bool mLogCallPoints = false;
- protected:
- Vector<ComposerState> mComposerStates;
- Vector<DisplayState> mDisplayStates;
- std::unordered_map<sp<ITransactionCompletedListener>, CallbackInfo, TCLHash>
- mListenerCallbacks;
- std::vector<client_cache_t> mUncacheBuffers;
+ TransactionState mState;
- // We keep track of the last MAX_MERGE_HISTORY_LENGTH merged transaction ids.
- // Ordered most recently merged to least recently merged.
- static const size_t MAX_MERGE_HISTORY_LENGTH = 10u;
- std::vector<uint64_t> mMergedTransactionIds;
-
- uint64_t mId;
- uint32_t mFlags = 0;
-
- // Indicates that the Transaction may contain buffers that should be cached. The reason this
- // is only a guess is that buffers can be removed before cache is called. This is only a
- // hint that at some point a buffer was added to this transaction before apply was called.
- bool mMayContainBuffer = false;
-
- // mDesiredPresentTime is the time in nanoseconds that the client would like the transaction
- // to be presented. When it is not possible to present at exactly that time, it will be
- // presented after the time has passed.
- //
- // If the client didn't pass a desired presentation time, mDesiredPresentTime will be
- // populated to the time setBuffer was called, and mIsAutoTimestamp will be set to true.
- //
- // Desired present times that are more than 1 second in the future may be ignored.
- // When a desired present time has already passed, the transaction will be presented as soon
- // as possible.
- //
- // Transactions from the same process are presented in the same order that they are applied.
- // The desired present time does not affect this ordering.
- int64_t mDesiredPresentTime = 0;
- bool mIsAutoTimestamp = true;
-
- // The vsync id provided by Choreographer.getVsyncId and the input event id
- FrameTimelineInfo mFrameTimelineInfo;
-
- // If not null, transactions will be queued up using this token otherwise a common token
- // per process will be used.
- sp<IBinder> mApplyToken = nullptr;
-
- InputWindowCommands mInputWindowCommands;
int mStatus = NO_ERROR;
layer_state_t* getLayerState(const sp<SurfaceControl>& sc);
@@ -506,6 +462,11 @@
void registerSurfaceControlForCallback(const sp<SurfaceControl>& sc);
void setReleaseBufferCallback(BufferData*, ReleaseBufferCallback);
+ protected:
+ // Accessed in tests.
+ std::unordered_map<sp<ITransactionCompletedListener>, CallbackInfo, TCLHash>
+ mListenerCallbacks;
+
public:
Transaction();
virtual ~Transaction() = default;
@@ -522,7 +483,7 @@
// Returns the current id of the transaction.
// The id is updated every time the transaction is applied.
- uint64_t getId();
+ uint64_t getId() const;
std::vector<uint64_t> getMergedTransactionIds();
diff --git a/libs/gui/include/gui/mock/GraphicBufferConsumer.h b/libs/gui/include/gui/mock/GraphicBufferConsumer.h
index 24d26b1..18a7e12 100644
--- a/libs/gui/include/gui/mock/GraphicBufferConsumer.h
+++ b/libs/gui/include/gui/mock/GraphicBufferConsumer.h
@@ -47,6 +47,7 @@
MOCK_METHOD2(setDefaultBufferSize, status_t(uint32_t, uint32_t));
MOCK_METHOD1(setMaxBufferCount, status_t(int));
MOCK_METHOD1(setMaxAcquiredBufferCount, status_t(int));
+ MOCK_METHOD2(setMaxAcquiredBufferCount, status_t(int, std::optional<OnBufferReleasedCallback>));
MOCK_METHOD1(setConsumerName, status_t(const String8&));
MOCK_METHOD1(setDefaultBufferFormat, status_t(PixelFormat));
MOCK_METHOD1(setDefaultBufferDataSpace, status_t(android_dataspace));
diff --git a/libs/gui/libgui_flags.aconfig b/libs/gui/libgui_flags.aconfig
index 2c3222d..a893b84 100644
--- a/libs/gui/libgui_flags.aconfig
+++ b/libs/gui/libgui_flags.aconfig
@@ -153,3 +153,14 @@
}
is_fixed_read_only: true
} # allocate_buffer_priority
+
+flag {
+ name: "bq_always_use_max_dequeued_buffer_count"
+ namespace: "core_graphics"
+ description: "BufferQueueProducer::dequeue's respects setMaxDequeuedBufferCount even before a buffer is dequeued."
+ bug: "399328309"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+ is_fixed_read_only: true
+} # bq_always_use_max_dequeued_buffer_count
diff --git a/libs/gui/tests/BufferItemConsumer_test.cpp b/libs/gui/tests/BufferItemConsumer_test.cpp
index b980f88..80eea26 100644
--- a/libs/gui/tests/BufferItemConsumer_test.cpp
+++ b/libs/gui/tests/BufferItemConsumer_test.cpp
@@ -24,6 +24,7 @@
#include <gui/Surface.h>
#include <ui/BufferQueueDefs.h>
#include <ui/GraphicBuffer.h>
+#include <utils/Errors.h>
#include <unordered_set>
@@ -235,6 +236,38 @@
ASSERT_EQ(1, GetFreedBufferCount());
}
+TEST_F(BufferItemConsumerTest, ResizeAcquireCount) {
+ EXPECT_EQ(OK, mBIC->setMaxAcquiredBufferCount(kMaxLockedBuffers + 1));
+ EXPECT_EQ(OK, mBIC->setMaxAcquiredBufferCount(kMaxLockedBuffers + 2));
+ EXPECT_EQ(OK, mBIC->setMaxAcquiredBufferCount(kMaxLockedBuffers - 1));
+ EXPECT_EQ(OK, mBIC->setMaxAcquiredBufferCount(kMaxLockedBuffers - 2));
+ EXPECT_EQ(OK, mBIC->setMaxAcquiredBufferCount(kMaxLockedBuffers + 1));
+ EXPECT_EQ(OK, mBIC->setMaxAcquiredBufferCount(kMaxLockedBuffers - 1));
+}
+
+TEST_F(BufferItemConsumerTest, AttachBuffer) {
+ ASSERT_EQ(OK, mBIC->setMaxAcquiredBufferCount(1));
+
+ int slot;
+ DequeueBuffer(&slot);
+ QueueBuffer(slot);
+ AcquireBuffer(&slot);
+
+ sp<GraphicBuffer> newBuffer1 = sp<GraphicBuffer>::make(kWidth, kHeight, kFormat, kUsage);
+ sp<GraphicBuffer> newBuffer2 = sp<GraphicBuffer>::make(kWidth, kHeight, kFormat, kUsage);
+
+ // For some reason, you can attach an extra buffer?
+ // b/400973991 to investigate
+ EXPECT_EQ(OK, mBIC->attachBuffer(newBuffer1));
+ EXPECT_EQ(INVALID_OPERATION, mBIC->attachBuffer(newBuffer2));
+
+ ReleaseBuffer(slot);
+
+ EXPECT_EQ(OK, mBIC->attachBuffer(newBuffer2));
+ EXPECT_EQ(OK, mBIC->releaseBuffer(newBuffer1, Fence::NO_FENCE));
+ EXPECT_EQ(OK, mBIC->releaseBuffer(newBuffer2, Fence::NO_FENCE));
+}
+
#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_PLATFORM_API_IMPROVEMENTS)
// Test that delete BufferItemConsumer triggers onBufferFreed.
TEST_F(BufferItemConsumerTest, DetachBufferWithBuffer) {
diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp
index e7690e2..c4dcba8 100644
--- a/libs/gui/tests/Surface_test.cpp
+++ b/libs/gui/tests/Surface_test.cpp
@@ -648,16 +648,7 @@
mSupportsPresent = supportsPresent;
}
- status_t setTransactionState(
- const FrameTimelineInfo& /*frameTimelineInfo*/, Vector<ComposerState>& /*state*/,
- Vector<DisplayState>& /*displays*/, uint32_t /*flags*/,
- const sp<IBinder>& /*applyToken*/, InputWindowCommands /*inputWindowCommands*/,
- int64_t /*desiredPresentTime*/, bool /*isAutoTimestamp*/,
- const std::vector<client_cache_t>& /*cachedBuffer*/, bool /*hasListenerCallbacks*/,
- const std::vector<ListenerCallbacks>& /*listenerCallbacks*/, uint64_t /*transactionId*/,
- const std::vector<uint64_t>& /*mergedTransactionIds*/) override {
- return NO_ERROR;
- }
+ status_t setTransactionState(TransactionState&&) override { return NO_ERROR; }
protected:
IBinder* onAsBinder() override { return nullptr; }
@@ -2246,6 +2237,52 @@
ASSERT_EQ(NO_ERROR, surface->disconnect(NATIVE_WINDOW_API_CPU));
}
+TEST_F(SurfaceTest, setMaxDequeuedBufferCount_setMaxAcquiredBufferCount_allocations) {
+ //
+ // Set up the consumer and producer--nothing fancy.
+ //
+ auto [consumer, surface] =
+ BufferItemConsumer::create(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_HW_RENDER);
+ sp<SurfaceListener> surfaceListener = sp<StubSurfaceListener>::make();
+ surface->connect(NATIVE_WINDOW_API_CPU, surfaceListener);
+ sp<GraphicBuffer> buffer;
+ sp<Fence> fence;
+
+ //
+ // These values are independent. The consumer can dequeue 3 and the consumer can acquire 3 at
+ // the same time.
+ //
+ ASSERT_EQ(OK, consumer->setMaxAcquiredBufferCount(3));
+ ASSERT_EQ(OK, surface->setMaxDequeuedBufferCount(3));
+
+ //
+ // Take all three buffers out of the queue--a fourth can't be retrieved. Then queue them.
+ //
+ std::vector<Surface::BatchBuffer> dequeuedBuffers(3);
+ EXPECT_EQ(OK, surface->dequeueBuffers(&dequeuedBuffers));
+ if (::com::android::graphics::libgui::flags::bq_always_use_max_dequeued_buffer_count()) {
+ EXPECT_EQ(INVALID_OPERATION, surface->dequeueBuffer(&buffer, &fence));
+ }
+
+ for (auto& batchBuffer : dequeuedBuffers) {
+ EXPECT_EQ(OK,
+ surface->queueBuffer(GraphicBuffer::from(batchBuffer.buffer),
+ sp<Fence>::make(batchBuffer.fenceFd)));
+ }
+ dequeuedBuffers.assign(3, {});
+
+ //
+ // Acquire all three, then we should be able to dequeue 3 more.
+ //
+ std::vector<BufferItem> acquiredBuffers(3);
+ for (auto& bufferItem : acquiredBuffers) {
+ EXPECT_EQ(OK, consumer->acquireBuffer(&bufferItem, 0));
+ }
+
+ EXPECT_EQ(OK, surface->dequeueBuffers(&dequeuedBuffers));
+ EXPECT_EQ(INVALID_OPERATION, surface->dequeueBuffer(&buffer, &fence));
+}
+
#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_PLATFORM_API_IMPROVEMENTS)
TEST_F(SurfaceTest, PlatformBufferMethods) {
diff --git a/libs/input/Android.bp b/libs/input/Android.bp
index dc03878..52e0276 100644
--- a/libs/input/Android.bp
+++ b/libs/input/Android.bp
@@ -225,6 +225,7 @@
srcs: [
"AccelerationCurve.cpp",
"CoordinateFilter.cpp",
+ "DisplayTopologyGraph.cpp",
"Input.cpp",
"InputConsumer.cpp",
"InputConsumerNoResampling.cpp",
diff --git a/libs/input/DisplayTopologyGraph.cpp b/libs/input/DisplayTopologyGraph.cpp
new file mode 100644
index 0000000..934f2e8
--- /dev/null
+++ b/libs/input/DisplayTopologyGraph.cpp
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2025 The Android Open Source Project
+ *
+ * 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.
+ */
+
+#define LOG_TAG "DisplayTopologyValidator"
+
+#include <android-base/logging.h>
+#include <android-base/stringprintf.h>
+#include <ftl/enum.h>
+#include <input/DisplayTopologyGraph.h>
+#include <input/PrintTools.h>
+#include <ui/LogicalDisplayId.h>
+
+#include <algorithm>
+
+#define INDENT " "
+
+namespace android {
+
+namespace {
+
+DisplayTopologyPosition getOppositePosition(DisplayTopologyPosition position) {
+ switch (position) {
+ case DisplayTopologyPosition::LEFT:
+ return DisplayTopologyPosition::RIGHT;
+ case DisplayTopologyPosition::TOP:
+ return DisplayTopologyPosition::BOTTOM;
+ case DisplayTopologyPosition::RIGHT:
+ return DisplayTopologyPosition::LEFT;
+ case DisplayTopologyPosition::BOTTOM:
+ return DisplayTopologyPosition::TOP;
+ }
+}
+
+bool validatePrimaryDisplay(const android::DisplayTopologyGraph& displayTopologyGraph) {
+ return displayTopologyGraph.primaryDisplayId != ui::LogicalDisplayId::INVALID &&
+ displayTopologyGraph.graph.contains(displayTopologyGraph.primaryDisplayId);
+}
+
+bool validateTopologyGraph(const android::DisplayTopologyGraph& displayTopologyGraph) {
+ for (const auto& [sourceDisplay, adjacentDisplays] : displayTopologyGraph.graph) {
+ for (const DisplayTopologyAdjacentDisplay& adjacentDisplay : adjacentDisplays) {
+ const auto adjacentGraphIt = displayTopologyGraph.graph.find(adjacentDisplay.displayId);
+ if (adjacentGraphIt == displayTopologyGraph.graph.end()) {
+ LOG(ERROR) << "Missing adjacent display in topology graph: "
+ << adjacentDisplay.displayId << " for source " << sourceDisplay;
+ return false;
+ }
+ const auto reverseEdgeIt =
+ std::find_if(adjacentGraphIt->second.begin(), adjacentGraphIt->second.end(),
+ [sourceDisplay](const DisplayTopologyAdjacentDisplay&
+ reverseAdjacentDisplay) {
+ return sourceDisplay == reverseAdjacentDisplay.displayId;
+ });
+ if (reverseEdgeIt == adjacentGraphIt->second.end()) {
+ LOG(ERROR) << "Missing reverse edge in topology graph for: " << sourceDisplay
+ << " -> " << adjacentDisplay.displayId;
+ return false;
+ }
+ DisplayTopologyPosition expectedPosition =
+ getOppositePosition(adjacentDisplay.position);
+ if (reverseEdgeIt->position != expectedPosition) {
+ LOG(ERROR) << "Unexpected reverse edge for: " << sourceDisplay << " -> "
+ << adjacentDisplay.displayId
+ << " expected position: " << ftl::enum_string(expectedPosition)
+ << " actual " << ftl::enum_string(reverseEdgeIt->position);
+ return false;
+ }
+ if (reverseEdgeIt->offsetDp != -adjacentDisplay.offsetDp) {
+ LOG(ERROR) << "Unexpected reverse edge offset: " << sourceDisplay << " -> "
+ << adjacentDisplay.displayId
+ << " expected offset: " << -adjacentDisplay.offsetDp << " actual "
+ << reverseEdgeIt->offsetDp;
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+bool validateDensities(const android::DisplayTopologyGraph& displayTopologyGraph) {
+ for (const auto& [sourceDisplay, adjacentDisplays] : displayTopologyGraph.graph) {
+ if (!displayTopologyGraph.displaysDensity.contains(sourceDisplay)) {
+ LOG(ERROR) << "Missing density value in topology graph for display: " << sourceDisplay;
+ return false;
+ }
+ }
+ return true;
+}
+
+std::string logicalDisplayIdToString(const ui::LogicalDisplayId& displayId) {
+ return base::StringPrintf("displayId(%d)", displayId.val());
+}
+
+std::string adjacentDisplayToString(const DisplayTopologyAdjacentDisplay& adjacentDisplay) {
+ return adjacentDisplay.dump();
+}
+
+std::string adjacentDisplayVectorToString(
+ const std::vector<DisplayTopologyAdjacentDisplay>& adjacentDisplays) {
+ return dumpVector(adjacentDisplays, adjacentDisplayToString);
+}
+
+} // namespace
+
+std::string DisplayTopologyAdjacentDisplay::dump() const {
+ std::string dump;
+ dump += base::StringPrintf("DisplayTopologyAdjacentDisplay: {displayId: %d, position: %s, "
+ "offsetDp: %f}",
+ displayId.val(), ftl::enum_string(position).c_str(), offsetDp);
+ return dump;
+}
+
+bool DisplayTopologyGraph::isValid() const {
+ return validatePrimaryDisplay(*this) && validateTopologyGraph(*this) &&
+ validateDensities(*this);
+}
+
+std::string DisplayTopologyGraph::dump() const {
+ std::string dump;
+ dump += base::StringPrintf("PrimaryDisplayId: %d\n", primaryDisplayId.val());
+ dump += base::StringPrintf("TopologyGraph:\n");
+ dump += addLinePrefix(dumpMap(graph, logicalDisplayIdToString, adjacentDisplayVectorToString),
+ INDENT);
+ dump += "\n";
+ dump += base::StringPrintf("DisplaysDensity:\n");
+ dump += addLinePrefix(dumpMap(displaysDensity, logicalDisplayIdToString), INDENT);
+ dump += "\n";
+ return dump;
+}
+
+} // namespace android
diff --git a/libs/input/input_flags.aconfig b/libs/input/input_flags.aconfig
index 1c0c9e7..983bbde 100644
--- a/libs/input/input_flags.aconfig
+++ b/libs/input/input_flags.aconfig
@@ -239,3 +239,13 @@
purpose: PURPOSE_BUGFIX
}
}
+
+flag {
+ name: "enable_display_topology_validation"
+ namespace: "input"
+ description: "Set to true to enable display topology validation"
+ bug: "401219231"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
diff --git a/libs/renderengine/skia/SkiaRenderEngine.cpp b/libs/renderengine/skia/SkiaRenderEngine.cpp
index 5f2d1b1..25afc7b 100644
--- a/libs/renderengine/skia/SkiaRenderEngine.cpp
+++ b/libs/renderengine/skia/SkiaRenderEngine.cpp
@@ -347,6 +347,7 @@
if (useProtectedContextImpl(
useProtectedContext ? GrProtected::kYes : GrProtected::kNo)) {
mInProtectedContext = useProtectedContext;
+ SFTRACE_INT("RE inProtectedContext", mInProtectedContext);
// given that we are sharing the same thread between two contexts we need to
// make sure that the thread state is reset when switching between the two.
if (getActiveContext()) {
diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp
index 0dd9f19..efc34f6 100644
--- a/opengl/libs/EGL/egl_display.cpp
+++ b/opengl/libs/EGL/egl_display.cpp
@@ -146,7 +146,7 @@
}
}
- if (graphicsenv_flags::feature_overrides()) {
+ if (graphicsenv_flags::angle_feature_overrides()) {
// Get the list of ANGLE features to enable from Global.Settings.
const auto& eglFeatures = GraphicsEnv::getInstance().getAngleEglFeatures();
for (const std::string& eglFeature : eglFeatures) {
diff --git a/services/gpuservice/GpuService.cpp b/services/gpuservice/GpuService.cpp
index 25ee21f..46327df 100644
--- a/services/gpuservice/GpuService.cpp
+++ b/services/gpuservice/GpuService.cpp
@@ -147,7 +147,7 @@
}
FeatureOverrides GpuService::getFeatureOverrides() {
- if (!graphicsenv_flags::feature_overrides()) {
+ if (!graphicsenv_flags::angle_feature_overrides()) {
FeatureOverrides featureOverrides;
return featureOverrides;
}
@@ -183,7 +183,7 @@
ALOGV(" arg[%zu]: '%s'", i, String8(args[i]).c_str());
if (!args.empty()) {
- if (graphicsenv_flags::feature_overrides()) {
+ if (graphicsenv_flags::angle_feature_overrides()) {
if (args[0] == String16("featureOverrides"))
return cmdFeatureOverrides(out, err);
}
@@ -267,7 +267,7 @@
"GPU Service commands:\n"
" vkjson dump Vulkan properties as JSON\n"
" vkprofiles print support for select Vulkan profiles\n");
- if (graphicsenv_flags::feature_overrides()) {
+ if (graphicsenv_flags::angle_feature_overrides()) {
fprintf(outs,
" featureOverrides update and output gpuservice's feature overrides\n");
}
diff --git a/services/inputflinger/PointerChoreographer.cpp b/services/inputflinger/PointerChoreographer.cpp
index f8ab830..98f0f34 100644
--- a/services/inputflinger/PointerChoreographer.cpp
+++ b/services/inputflinger/PointerChoreographer.cpp
@@ -31,6 +31,7 @@
#include "PointerChoreographer.h"
#define INDENT " "
+#define INDENT2 " "
namespace android {
@@ -647,6 +648,8 @@
std::string pointerControllerDump = addLinePrefix(drawingTabletController->dump(), INDENT);
dump += INDENT + std::to_string(deviceId) + " : " + pointerControllerDump;
}
+ dump += INDENT "DisplayTopologyGraph:\n";
+ dump += addLinePrefix(mTopology.dump(), INDENT2);
dump += "\n";
}
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index ef50fc0..888fcfb 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -5222,6 +5222,11 @@
} else {
dump += "Displays: <none>\n";
}
+ dump += StringPrintf("mMaximumObscuringOpacityForTouch: %f\n",
+ mMaximumObscuringOpacityForTouch);
+ dump += "DisplayTopologyGraph:\n";
+ dump += addLinePrefix(mTopology.dump(), INDENT);
+ dump += "\n";
return dump;
}
diff --git a/services/inputflinger/tests/Android.bp b/services/inputflinger/tests/Android.bp
index 18d47f6..677cf1e 100644
--- a/services/inputflinger/tests/Android.bp
+++ b/services/inputflinger/tests/Android.bp
@@ -52,6 +52,7 @@
"AnrTracker_test.cpp",
"CapturedTouchpadEventConverter_test.cpp",
"CursorInputMapper_test.cpp",
+ "DisplayTopologyGraph_test.cpp",
"EventHub_test.cpp",
"FakeEventHub.cpp",
"FakeInputReaderPolicy.cpp",
diff --git a/services/inputflinger/tests/DisplayTopologyGraph_test.cpp b/services/inputflinger/tests/DisplayTopologyGraph_test.cpp
new file mode 100644
index 0000000..fd2f21c
--- /dev/null
+++ b/services/inputflinger/tests/DisplayTopologyGraph_test.cpp
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2025 The Android Open Source Project
+ *
+ * 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.
+ */
+
+#include <gtest/gtest.h>
+#include <input/DisplayTopologyGraph.h>
+
+#include <string>
+#include <string_view>
+#include <tuple>
+
+namespace android {
+
+namespace {
+
+constexpr ui::LogicalDisplayId DISPLAY_ID_1{1};
+constexpr ui::LogicalDisplayId DISPLAY_ID_2{2};
+constexpr int DENSITY_MEDIUM = 160;
+
+} // namespace
+
+using DisplayTopologyGraphTestFixtureParam =
+ std::tuple<std::string_view /*name*/, DisplayTopologyGraph, bool /*isValid*/>;
+
+class DisplayTopologyGraphTestFixture
+ : public testing::Test,
+ public testing::WithParamInterface<DisplayTopologyGraphTestFixtureParam> {};
+
+TEST_P(DisplayTopologyGraphTestFixture, DisplayTopologyGraphTest) {
+ const auto& [_, displayTopology, isValid] = GetParam();
+ EXPECT_EQ(isValid, displayTopology.isValid());
+}
+
+INSTANTIATE_TEST_SUITE_P(
+ DisplayTopologyGraphTest, DisplayTopologyGraphTestFixture,
+ testing::Values(
+ std::make_tuple(
+ "InvalidPrimaryDisplay",
+ DisplayTopologyGraph{.primaryDisplayId = ui::LogicalDisplayId::INVALID,
+ .graph = {},
+ .displaysDensity = {}},
+ false),
+ std::make_tuple("PrimaryDisplayNotInGraph",
+ DisplayTopologyGraph{.primaryDisplayId = DISPLAY_ID_1,
+ .graph = {},
+ .displaysDensity = {}},
+ false),
+ std::make_tuple("DisplayDensityMissing",
+ DisplayTopologyGraph{.primaryDisplayId = DISPLAY_ID_1,
+ .graph = {{DISPLAY_ID_1, {}}},
+ .displaysDensity = {}},
+ false),
+ std::make_tuple("ValidSingleDisplayTopology",
+ DisplayTopologyGraph{.primaryDisplayId = DISPLAY_ID_1,
+ .graph = {{DISPLAY_ID_1, {}}},
+ .displaysDensity = {{DISPLAY_ID_1,
+ DENSITY_MEDIUM}}},
+ true),
+ std::make_tuple(
+ "MissingReverseEdge",
+ DisplayTopologyGraph{.primaryDisplayId = DISPLAY_ID_1,
+ .graph = {{DISPLAY_ID_1,
+ {{DISPLAY_ID_2,
+ DisplayTopologyPosition::TOP, 0}}}},
+ .displaysDensity = {{DISPLAY_ID_1, DENSITY_MEDIUM},
+ {DISPLAY_ID_2, DENSITY_MEDIUM}}},
+ false),
+ std::make_tuple(
+ "IncorrectReverseEdgeDirection",
+ DisplayTopologyGraph{.primaryDisplayId = DISPLAY_ID_1,
+ .graph = {{DISPLAY_ID_1,
+ {{DISPLAY_ID_2,
+ DisplayTopologyPosition::TOP, 0}}},
+ {DISPLAY_ID_2,
+ {{DISPLAY_ID_1,
+ DisplayTopologyPosition::TOP, 0}}}},
+ .displaysDensity = {{DISPLAY_ID_1, DENSITY_MEDIUM},
+ {DISPLAY_ID_2, DENSITY_MEDIUM}}},
+ false),
+ std::make_tuple(
+ "IncorrectReverseEdgeOffset",
+ DisplayTopologyGraph{.primaryDisplayId = DISPLAY_ID_1,
+ .graph = {{DISPLAY_ID_1,
+ {{DISPLAY_ID_2,
+ DisplayTopologyPosition::TOP, 10}}},
+ {DISPLAY_ID_2,
+ {{DISPLAY_ID_1,
+ DisplayTopologyPosition::BOTTOM, 20}}}},
+ .displaysDensity = {{DISPLAY_ID_1, DENSITY_MEDIUM},
+ {DISPLAY_ID_2, DENSITY_MEDIUM}}},
+ false),
+ std::make_tuple(
+ "ValidMultiDisplayTopology",
+ DisplayTopologyGraph{.primaryDisplayId = DISPLAY_ID_1,
+ .graph = {{DISPLAY_ID_1,
+ {{DISPLAY_ID_2,
+ DisplayTopologyPosition::TOP, 10}}},
+ {DISPLAY_ID_2,
+ {{DISPLAY_ID_1,
+ DisplayTopologyPosition::BOTTOM, -10}}}},
+ .displaysDensity = {{DISPLAY_ID_1, DENSITY_MEDIUM},
+ {DISPLAY_ID_2, DENSITY_MEDIUM}}},
+ true)),
+ [](const testing::TestParamInfo<DisplayTopologyGraphTestFixtureParam>& p) {
+ return std::string{std::get<0>(p.param)};
+ });
+
+} // namespace android
diff --git a/services/stats/Android.bp b/services/stats/Android.bp
index f698515..d588017 100644
--- a/services/stats/Android.bp
+++ b/services/stats/Android.bp
@@ -29,10 +29,15 @@
"libexpresslog",
"libhidlbase",
"liblog",
- "libstatslog",
"libstatssocket",
"libutils",
],
+ generated_sources: [
+ "statslog_hidl.cpp",
+ ],
+ generated_headers: [
+ "statslog_hidl.h",
+ ],
export_include_dirs: [
"include/",
],
@@ -47,3 +52,28 @@
"android.frameworks.stats-service.xml",
],
}
+
+genrule {
+ name: "statslog_hidl.h",
+ tools: ["stats-log-api-gen"],
+ cmd: "$(location stats-log-api-gen)" +
+ " --header $(genDir)/statslog_hidl.h" +
+ " --module statshidl" +
+ " --namespace android,util,statshidl",
+ out: [
+ "statslog_hidl.h",
+ ],
+}
+
+genrule {
+ name: "statslog_hidl.cpp",
+ tools: ["stats-log-api-gen"],
+ cmd: "$(location stats-log-api-gen)" +
+ " --cpp $(genDir)/statslog_hidl.cpp" +
+ " --module statshidl" +
+ " --namespace android,util,statshidl" +
+ " --importHeader statslog_hidl.h",
+ out: [
+ "statslog_hidl.cpp",
+ ],
+}
diff --git a/services/stats/StatsAidl.cpp b/services/stats/StatsAidl.cpp
index b22f903..66f7682 100644
--- a/services/stats/StatsAidl.cpp
+++ b/services/stats/StatsAidl.cpp
@@ -26,9 +26,8 @@
#include <log/log.h>
#include <stats_annotations.h>
#include <stats_event.h>
-#include <statslog.h>
-#include <unordered_map>
+#include <map>
namespace {
static const char* g_AtomErrorMetricName =
@@ -118,8 +117,8 @@
}
}
- // populate map for quickier access for VendorAtomValue associated annotations by value index
- std::unordered_map<int, int> fieldIndexToAnnotationSetMap;
+ // populate map for quicker access for VendorAtomValue associated annotations by value index
+ std::map<int, int> fieldIndexToAnnotationSetMap;
if (vendorAtom.valuesAnnotations) {
const std::vector<std::optional<AnnotationSet>>& valuesAnnotations =
*vendorAtom.valuesAnnotations;
diff --git a/services/stats/StatsHal.cpp b/services/stats/StatsHal.cpp
index 19176d9..0ffa4c3 100644
--- a/services/stats/StatsHal.cpp
+++ b/services/stats/StatsHal.cpp
@@ -20,7 +20,7 @@
#include "StatsHal.h"
#include <log/log.h>
-#include <statslog.h>
+#include <statslog_hidl.h>
namespace android {
namespace frameworks {
@@ -32,24 +32,27 @@
}
hardware::Return<void> StatsHal::reportSpeakerImpedance(const SpeakerImpedance& speakerImpedance) {
- android::util::stats_write(android::util::SPEAKER_IMPEDANCE_REPORTED,
- speakerImpedance.speakerLocation, speakerImpedance.milliOhms);
+ android::util::statshidl::stats_write(android::util::statshidl::SPEAKER_IMPEDANCE_REPORTED,
+ speakerImpedance.speakerLocation,
+ speakerImpedance.milliOhms);
return hardware::Void();
}
hardware::Return<void> StatsHal::reportHardwareFailed(const HardwareFailed& hardwareFailed) {
- android::util::stats_write(android::util::HARDWARE_FAILED, int32_t(hardwareFailed.hardwareType),
- hardwareFailed.hardwareLocation, int32_t(hardwareFailed.errorCode));
+ android::util::statshidl::stats_write(
+ android::util::statshidl::HARDWARE_FAILED, int32_t(hardwareFailed.hardwareType),
+ hardwareFailed.hardwareLocation, int32_t(hardwareFailed.errorCode));
return hardware::Void();
}
hardware::Return<void> StatsHal::reportPhysicalDropDetected(
const PhysicalDropDetected& physicalDropDetected) {
- android::util::stats_write(
- android::util::PHYSICAL_DROP_DETECTED, int32_t(physicalDropDetected.confidencePctg),
- physicalDropDetected.accelPeak, physicalDropDetected.freefallDuration);
+ android::util::statshidl::stats_write(android::util::statshidl::PHYSICAL_DROP_DETECTED,
+ int32_t(physicalDropDetected.confidencePctg),
+ physicalDropDetected.accelPeak,
+ physicalDropDetected.freefallDuration);
return hardware::Void();
}
@@ -60,19 +63,19 @@
for (int i = 0; i < 10 - initialSize; i++) {
buckets.push_back(0); // Push 0 for buckets that do not exist.
}
- android::util::stats_write(android::util::CHARGE_CYCLES_REPORTED, buckets[0], buckets[1],
- buckets[2], buckets[3], buckets[4], buckets[5], buckets[6],
- buckets[7], buckets[8], buckets[9]);
+ android::util::statshidl::stats_write(
+ android::util::statshidl::CHARGE_CYCLES_REPORTED, buckets[0], buckets[1], buckets[2],
+ buckets[3], buckets[4], buckets[5], buckets[6], buckets[7], buckets[8], buckets[9]);
return hardware::Void();
}
hardware::Return<void> StatsHal::reportBatteryHealthSnapshot(
const BatteryHealthSnapshotArgs& batteryHealthSnapshotArgs) {
- android::util::stats_write(
- android::util::BATTERY_HEALTH_SNAPSHOT, int32_t(batteryHealthSnapshotArgs.type),
- batteryHealthSnapshotArgs.temperatureDeciC, batteryHealthSnapshotArgs.voltageMicroV,
- batteryHealthSnapshotArgs.currentMicroA,
+ android::util::statshidl::stats_write(
+ android::util::statshidl::BATTERY_HEALTH_SNAPSHOT,
+ int32_t(batteryHealthSnapshotArgs.type), batteryHealthSnapshotArgs.temperatureDeciC,
+ batteryHealthSnapshotArgs.voltageMicroV, batteryHealthSnapshotArgs.currentMicroA,
batteryHealthSnapshotArgs.openCircuitVoltageMicroV,
batteryHealthSnapshotArgs.resistanceMicroOhm, batteryHealthSnapshotArgs.levelPercent);
@@ -80,23 +83,24 @@
}
hardware::Return<void> StatsHal::reportSlowIo(const SlowIo& slowIo) {
- android::util::stats_write(android::util::SLOW_IO, int32_t(slowIo.operation), slowIo.count);
+ android::util::statshidl::stats_write(android::util::statshidl::SLOW_IO,
+ int32_t(slowIo.operation), slowIo.count);
return hardware::Void();
}
hardware::Return<void> StatsHal::reportBatteryCausedShutdown(
const BatteryCausedShutdown& batteryCausedShutdown) {
- android::util::stats_write(android::util::BATTERY_CAUSED_SHUTDOWN,
- batteryCausedShutdown.voltageMicroV);
+ android::util::statshidl::stats_write(android::util::statshidl::BATTERY_CAUSED_SHUTDOWN,
+ batteryCausedShutdown.voltageMicroV);
return hardware::Void();
}
hardware::Return<void> StatsHal::reportUsbPortOverheatEvent(
const UsbPortOverheatEvent& usbPortOverheatEvent) {
- android::util::stats_write(
- android::util::USB_PORT_OVERHEAT_EVENT_REPORTED,
+ android::util::statshidl::stats_write(
+ android::util::statshidl::USB_PORT_OVERHEAT_EVENT_REPORTED,
usbPortOverheatEvent.plugTemperatureDeciC, usbPortOverheatEvent.maxTemperatureDeciC,
usbPortOverheatEvent.timeToOverheat, usbPortOverheatEvent.timeToHysteresis,
usbPortOverheatEvent.timeToInactive);
@@ -105,9 +109,10 @@
}
hardware::Return<void> StatsHal::reportSpeechDspStat(const SpeechDspStat& speechDspStat) {
- android::util::stats_write(android::util::SPEECH_DSP_STAT_REPORTED,
- speechDspStat.totalUptimeMillis, speechDspStat.totalDowntimeMillis,
- speechDspStat.totalCrashCount, speechDspStat.totalRecoverCount);
+ android::util::statshidl::stats_write(
+ android::util::statshidl::SPEECH_DSP_STAT_REPORTED, speechDspStat.totalUptimeMillis,
+ speechDspStat.totalDowntimeMillis, speechDspStat.totalCrashCount,
+ speechDspStat.totalRecoverCount);
return hardware::Void();
}
diff --git a/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp b/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp
index d7d8b7c..ab2a03c 100644
--- a/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp
@@ -91,7 +91,7 @@
namespace {
void offloadOutputs(Outputs& outputs) {
- if (!FlagManager::getInstance().multithreaded_present() || outputs.size() < 2) {
+ if (outputs.size() < 2) {
return;
}
diff --git a/services/surfaceflinger/CompositionEngine/tests/CompositionEngineTest.cpp b/services/surfaceflinger/CompositionEngine/tests/CompositionEngineTest.cpp
index 882da18..48d0242 100644
--- a/services/surfaceflinger/CompositionEngine/tests/CompositionEngineTest.cpp
+++ b/services/surfaceflinger/CompositionEngine/tests/CompositionEngineTest.cpp
@@ -43,6 +43,10 @@
using ::testing::SaveArg;
using ::testing::StrictMock;
+static constexpr PhysicalDisplayId kDisplayId1 = PhysicalDisplayId::fromPort(123u);
+static constexpr PhysicalDisplayId kDisplayId2 = PhysicalDisplayId::fromPort(234u);
+static constexpr PhysicalDisplayId kDisplayId3 = PhysicalDisplayId::fromPort(567u);
+
struct CompositionEngineTest : public testing::Test {
std::shared_ptr<TimeStats> mTimeStats;
@@ -52,6 +56,26 @@
std::shared_ptr<mock::Output> mOutput1{std::make_shared<StrictMock<mock::Output>>()};
std::shared_ptr<mock::Output> mOutput2{std::make_shared<StrictMock<mock::Output>>()};
std::shared_ptr<mock::Output> mOutput3{std::make_shared<StrictMock<mock::Output>>()};
+
+ std::array<impl::OutputCompositionState, 3> mOutputStates;
+
+ void SetUp() override {
+ EXPECT_CALL(*mOutput1, getDisplayId)
+ .WillRepeatedly(Return(std::make_optional<DisplayId>(kDisplayId1)));
+ EXPECT_CALL(*mOutput2, getDisplayId)
+ .WillRepeatedly(Return(std::make_optional<DisplayId>(kDisplayId2)));
+ EXPECT_CALL(*mOutput3, getDisplayId)
+ .WillRepeatedly(Return(std::make_optional<DisplayId>(kDisplayId3)));
+
+ // Most tests will depend on the outputs being enabled.
+ for (auto& state : mOutputStates) {
+ state.isEnabled = true;
+ }
+
+ EXPECT_CALL(*mOutput1, getState).WillRepeatedly(ReturnRef(mOutputStates[0]));
+ EXPECT_CALL(*mOutput2, getState).WillRepeatedly(ReturnRef(mOutputStates[1]));
+ EXPECT_CALL(*mOutput3, getState).WillRepeatedly(ReturnRef(mOutputStates[2]));
+ }
};
TEST_F(CompositionEngineTest, canInstantiateCompositionEngine) {
@@ -94,7 +118,7 @@
StrictMock<CompositionEnginePartialMock> mEngine;
};
-TEST_F(CompositionEnginePresentTest, worksWithEmptyRequest) {
+TEST_F(CompositionEnginePresentTest, zeroOutputs) {
// present() always calls preComposition() and postComposition()
EXPECT_CALL(mEngine, preComposition(Ref(mRefreshArgs)));
EXPECT_CALL(mEngine, postComposition(Ref(mRefreshArgs)));
@@ -102,7 +126,7 @@
mEngine.present(mRefreshArgs);
}
-TEST_F(CompositionEnginePresentTest, worksAsExpected) {
+TEST_F(CompositionEnginePresentTest, threeOutputs) {
// Expect calls to in a certain sequence
InSequence seq;
@@ -114,9 +138,7 @@
EXPECT_CALL(*mOutput2, prepare(Ref(mRefreshArgs), _));
EXPECT_CALL(*mOutput3, prepare(Ref(mRefreshArgs), _));
- // All of mOutput<i> are StrictMocks. If the flag is true, it will introduce
- // calls to getDisplayId, which are not relevant to this test.
- SET_FLAG_FOR_TEST(flags::multithreaded_present, false);
+ EXPECT_CALL(*mOutput1, supportsOffloadPresent).WillOnce(Return(false));
// The last step is to actually present each output.
EXPECT_CALL(*mOutput1, present(Ref(mRefreshArgs)))
@@ -284,8 +306,6 @@
std::shared_ptr<mock::Output> mVirtualDisplay{std::make_shared<StrictMock<mock::Output>>()};
std::shared_ptr<mock::Output> mHalVirtualDisplay{std::make_shared<StrictMock<mock::Output>>()};
- static constexpr PhysicalDisplayId kDisplayId1 = PhysicalDisplayId::fromPort(123u);
- static constexpr PhysicalDisplayId kDisplayId2 = PhysicalDisplayId::fromPort(234u);
static constexpr GpuVirtualDisplayId kGpuVirtualDisplayId{789u};
static constexpr HalVirtualDisplayId kHalVirtualDisplayId{456u};
@@ -343,7 +363,6 @@
EXPECT_CALL(*mDisplay1, offloadPresentNextFrame).Times(1);
EXPECT_CALL(*mDisplay2, offloadPresentNextFrame).Times(0);
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
setOutputs({mDisplay1, mDisplay2});
mEngine.present(mRefreshArgs);
@@ -356,7 +375,6 @@
EXPECT_CALL(*mDisplay1, offloadPresentNextFrame).Times(0);
EXPECT_CALL(*mDisplay2, offloadPresentNextFrame).Times(0);
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
setOutputs({mDisplay1, mDisplay2});
mEngine.present(mRefreshArgs);
@@ -369,20 +387,6 @@
EXPECT_CALL(*mDisplay1, offloadPresentNextFrame).Times(0);
EXPECT_CALL(*mDisplay2, offloadPresentNextFrame).Times(0);
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
- setOutputs({mDisplay1, mDisplay2});
-
- mEngine.present(mRefreshArgs);
-}
-
-TEST_F(CompositionEngineOffloadTest, dependsOnFlag) {
- EXPECT_CALL(*mDisplay1, supportsOffloadPresent).Times(0);
- EXPECT_CALL(*mDisplay2, supportsOffloadPresent).Times(0);
-
- EXPECT_CALL(*mDisplay1, offloadPresentNextFrame).Times(0);
- EXPECT_CALL(*mDisplay2, offloadPresentNextFrame).Times(0);
-
- SET_FLAG_FOR_TEST(flags::multithreaded_present, false);
setOutputs({mDisplay1, mDisplay2});
mEngine.present(mRefreshArgs);
@@ -393,7 +397,6 @@
EXPECT_CALL(*mDisplay1, offloadPresentNextFrame).Times(0);
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
setOutputs({mDisplay1});
mEngine.present(mRefreshArgs);
@@ -408,7 +411,6 @@
EXPECT_CALL(*mDisplay2, offloadPresentNextFrame).Times(0);
EXPECT_CALL(*mVirtualDisplay, offloadPresentNextFrame).Times(0);
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
setOutputs({mDisplay1, mDisplay2, mVirtualDisplay});
mEngine.present(mRefreshArgs);
@@ -421,7 +423,6 @@
EXPECT_CALL(*mDisplay1, offloadPresentNextFrame).Times(0);
EXPECT_CALL(*mVirtualDisplay, offloadPresentNextFrame).Times(0);
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
setOutputs({mDisplay1, mVirtualDisplay});
mEngine.present(mRefreshArgs);
@@ -434,7 +435,6 @@
EXPECT_CALL(*mDisplay1, offloadPresentNextFrame).Times(1);
EXPECT_CALL(*mHalVirtualDisplay, offloadPresentNextFrame).Times(0);
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
setOutputs({mDisplay1, mHalVirtualDisplay});
mEngine.present(mRefreshArgs);
@@ -451,7 +451,6 @@
EXPECT_CALL(*mDisplay1, offloadPresentNextFrame).Times(1);
EXPECT_CALL(*mDisplay2, offloadPresentNextFrame).Times(0);
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
setOutputs({mVirtualDisplay, mHalVirtualDisplay, mDisplay1, mDisplay2});
mEngine.present(mRefreshArgs);
@@ -469,7 +468,6 @@
EXPECT_CALL(*mDisplay1, offloadPresentNextFrame).Times(0);
EXPECT_CALL(*mDisplay2, offloadPresentNextFrame).Times(0);
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
setOutputs({mDisplay1, mDisplay2});
mEngine.present(mRefreshArgs);
@@ -489,7 +487,6 @@
EXPECT_CALL(*mDisplay2, offloadPresentNextFrame).Times(0);
EXPECT_CALL(*mHalVirtualDisplay, offloadPresentNextFrame).Times(0);
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
setOutputs({mDisplay1, mDisplay2, mHalVirtualDisplay});
mEngine.present(mRefreshArgs);
diff --git a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp
index bb6bebe..d547af9 100644
--- a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp
+++ b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp
@@ -1773,7 +1773,6 @@
}
bool AidlComposer::hasMultiThreadedPresentSupport(Display display) {
- if (!FlagManager::getInstance().multithreaded_present()) return false;
const auto displayId = translate<int64_t>(display);
std::vector<AidlDisplayCapability> capabilities;
const auto status = mAidlComposerClient->getDisplayCapabilities(displayId, &capabilities);
diff --git a/services/surfaceflinger/FrontEnd/RequestedLayerState.cpp b/services/surfaceflinger/FrontEnd/RequestedLayerState.cpp
index d322a61..621fd6c 100644
--- a/services/surfaceflinger/FrontEnd/RequestedLayerState.cpp
+++ b/services/surfaceflinger/FrontEnd/RequestedLayerState.cpp
@@ -150,6 +150,7 @@
}
void RequestedLayerState::merge(const ResolvedComposerState& resolvedComposerState) {
+ bool transformWasValid = transformIsValid;
const uint32_t oldFlags = flags;
const half oldAlpha = color.a;
const bool hadBuffer = externalTexture != nullptr;
@@ -357,6 +358,14 @@
clientDrawnCornerRadius = clientState.clientDrawnCornerRadius;
changes |= RequestedLayerState::Changes::Geometry;
}
+
+ // We can't just check requestedTransform here because LayerSnapshotBuilder uses
+ // getTransform which reads destinationFrame or buffer dimensions.
+ // Display rotation does not affect validity so just use ROT_0.
+ transformIsValid = LayerSnapshot::isTransformValid(getTransform(ui::Transform::ROT_0));
+ if (!transformWasValid && transformIsValid) {
+ changes |= RequestedLayerState::Changes::Visibility;
+ }
}
ui::Size RequestedLayerState::getUnrotatedBufferSize(uint32_t displayRotationFlags) const {
diff --git a/services/surfaceflinger/FrontEnd/RequestedLayerState.h b/services/surfaceflinger/FrontEnd/RequestedLayerState.h
index 7232379..b8310be 100644
--- a/services/surfaceflinger/FrontEnd/RequestedLayerState.h
+++ b/services/surfaceflinger/FrontEnd/RequestedLayerState.h
@@ -115,6 +115,7 @@
const gui::Pid ownerPid;
bool dataspaceRequested;
bool hasColorTransform;
+ bool transformIsValid = true;
bool premultipliedAlpha{true};
// This layer can be a cursor on some displays.
bool potentialCursor{false};
diff --git a/services/surfaceflinger/QueuedTransactionState.h b/services/surfaceflinger/QueuedTransactionState.h
index 86683da..6a17a0d 100644
--- a/services/surfaceflinger/QueuedTransactionState.h
+++ b/services/surfaceflinger/QueuedTransactionState.h
@@ -25,6 +25,7 @@
#include <common/FlagManager.h>
#include <ftl/flags.h>
#include <gui/LayerState.h>
+#include <gui/TransactionState.h>
#include <system/window.h>
namespace android {
@@ -50,33 +51,26 @@
struct QueuedTransactionState {
QueuedTransactionState() = default;
- QueuedTransactionState(const FrameTimelineInfo& frameTimelineInfo,
- std::vector<ResolvedComposerState>& composerStates,
- const Vector<DisplayState>& displayStates, uint32_t transactionFlags,
- const sp<IBinder>& applyToken,
- const InputWindowCommands& inputWindowCommands,
- int64_t desiredPresentTime, bool isAutoTimestamp,
- std::vector<uint64_t> uncacheBufferIds, int64_t postTime,
- bool hasListenerCallbacks,
- std::vector<ListenerCallbacks> listenerCallbacks, int originPid,
- int originUid, uint64_t transactionId,
- std::vector<uint64_t> mergedTransactionIds)
- : frameTimelineInfo(frameTimelineInfo),
- states(std::move(composerStates)),
- displays(displayStates),
- flags(transactionFlags),
- applyToken(applyToken),
- inputWindowCommands(inputWindowCommands),
- desiredPresentTime(desiredPresentTime),
- isAutoTimestamp(isAutoTimestamp),
+ QueuedTransactionState(TransactionState&& transactionState,
+ std::vector<ResolvedComposerState>&& composerStates,
+ std::vector<uint64_t>&& uncacheBufferIds, int64_t postTime,
+ int originPid, int originUid)
+ : frameTimelineInfo(std::move(transactionState.mFrameTimelineInfo)),
+ states(composerStates),
+ displays(std::move(transactionState.mDisplayStates)),
+ flags(transactionState.mFlags),
+ applyToken(transactionState.mApplyToken),
+ inputWindowCommands(std::move(transactionState.mInputWindowCommands)),
+ desiredPresentTime(transactionState.mDesiredPresentTime),
+ isAutoTimestamp(transactionState.mIsAutoTimestamp),
uncacheBufferIds(std::move(uncacheBufferIds)),
postTime(postTime),
- hasListenerCallbacks(hasListenerCallbacks),
- listenerCallbacks(listenerCallbacks),
+ hasListenerCallbacks(transactionState.mHasListenerCallbacks),
+ listenerCallbacks(std::move(transactionState.mListenerCallbacks)),
originPid(originPid),
originUid(originUid),
- id(transactionId),
- mergedTransactionIds(std::move(mergedTransactionIds)) {}
+ id(transactionState.getId()),
+ mergedTransactionIds(std::move(transactionState.mMergedTransactionIds)) {}
// Invokes `void(const layer_state_t&)` visitor for matching layers.
template <typename Visitor>
@@ -135,7 +129,7 @@
FrameTimelineInfo frameTimelineInfo;
std::vector<ResolvedComposerState> states;
- Vector<DisplayState> displays;
+ std::vector<DisplayState> displays;
uint32_t flags;
sp<IBinder> applyToken;
InputWindowCommands inputWindowCommands;
diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp
index e587178..911d489 100644
--- a/services/surfaceflinger/Scheduler/Scheduler.cpp
+++ b/services/surfaceflinger/Scheduler/Scheduler.cpp
@@ -554,8 +554,7 @@
ftl::FakeGuard guard(kMainThreadContext);
for (const auto& [id, display] : mDisplays) {
- if (display.powerMode != hal::PowerMode::OFF ||
- !FlagManager::getInstance().multithreaded_present()) {
+ if (display.powerMode != hal::PowerMode::OFF) {
resyncToHardwareVsyncLocked(id, allowToEnable);
}
}
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index ab7e546..780b897 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -4078,6 +4078,10 @@
incRefreshableDisplays();
}
+ if (FlagManager::getInstance().correct_virtual_display_power_state()) {
+ applyOptimizationPolicy(__func__);
+ }
+
mDisplays.try_emplace(displayToken, std::move(display));
// For an external display, loadDisplayModes already attempted to select the same mode
@@ -4134,6 +4138,10 @@
// not be accessible.
}));
}
+
+ if (FlagManager::getInstance().correct_virtual_display_power_state()) {
+ applyOptimizationPolicy(__func__);
+ }
}
void SurfaceFlinger::processDisplayChanged(const wp<IBinder>& displayToken,
@@ -5010,13 +5018,7 @@
return true;
}
-status_t SurfaceFlinger::setTransactionState(
- const FrameTimelineInfo& frameTimelineInfo, Vector<ComposerState>& states,
- Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken,
- InputWindowCommands inputWindowCommands, int64_t desiredPresentTime, bool isAutoTimestamp,
- const std::vector<client_cache_t>& uncacheBuffers, bool hasListenerCallbacks,
- const std::vector<ListenerCallbacks>& listenerCallbacks, uint64_t transactionId,
- const std::vector<uint64_t>& mergedTransactionIds) {
+status_t SurfaceFlinger::setTransactionState(TransactionState&& transactionState) {
SFTRACE_CALL();
IPCThreadState* ipc = IPCThreadState::self();
@@ -5024,7 +5026,7 @@
const int originUid = ipc->getCallingUid();
uint32_t permissions = LayerStatePermissions::getTransactionPermissions(originPid, originUid);
ftl::Flags<adpf::Workload> queuedWorkload;
- for (auto& composerState : states) {
+ for (auto& composerState : transactionState.mComposerStates) {
composerState.state.sanitize(permissions);
if (composerState.state.what & layer_state_t::COMPOSITION_EFFECTS) {
queuedWorkload |= adpf::Workload::EFFECTS;
@@ -5034,27 +5036,27 @@
}
}
- for (DisplayState& display : displays) {
+ for (DisplayState& display : transactionState.mDisplayStates) {
display.sanitize(permissions);
}
- if (!inputWindowCommands.empty() &&
+ if (!transactionState.mInputWindowCommands.empty() &&
(permissions & layer_state_t::Permission::ACCESS_SURFACE_FLINGER) == 0) {
ALOGE("Only privileged callers are allowed to send input commands.");
- inputWindowCommands.clear();
+ transactionState.mInputWindowCommands.clear();
}
- if (flags & (eEarlyWakeupStart | eEarlyWakeupEnd)) {
+ if (transactionState.mFlags & (eEarlyWakeupStart | eEarlyWakeupEnd)) {
const bool hasPermission =
(permissions & layer_state_t::Permission::ACCESS_SURFACE_FLINGER) ||
callingThreadHasPermission(sWakeupSurfaceFlinger);
if (!hasPermission) {
ALOGE("Caller needs permission android.permission.WAKEUP_SURFACE_FLINGER to use "
"eEarlyWakeup[Start|End] flags");
- flags &= ~(eEarlyWakeupStart | eEarlyWakeupEnd);
+ transactionState.mFlags &= ~(eEarlyWakeupStart | eEarlyWakeupEnd);
}
}
- if (flags & eEarlyWakeupStart) {
+ if (transactionState.mFlags & eEarlyWakeupStart) {
queuedWorkload |= adpf::Workload::WAKEUP;
}
mPowerAdvisor->setQueuedWorkload(queuedWorkload);
@@ -5062,8 +5064,8 @@
const int64_t postTime = systemTime();
std::vector<uint64_t> uncacheBufferIds;
- uncacheBufferIds.reserve(uncacheBuffers.size());
- for (const auto& uncacheBuffer : uncacheBuffers) {
+ uncacheBufferIds.reserve(transactionState.mUncacheBuffers.size());
+ for (const auto& uncacheBuffer : transactionState.mUncacheBuffers) {
sp<GraphicBuffer> buffer = ClientCache::getInstance().erase(uncacheBuffer);
if (buffer != nullptr) {
uncacheBufferIds.push_back(buffer->getId());
@@ -5071,8 +5073,8 @@
}
std::vector<ResolvedComposerState> resolvedStates;
- resolvedStates.reserve(states.size());
- for (auto& state : states) {
+ resolvedStates.reserve(transactionState.mComposerStates.size());
+ for (auto& state : transactionState.mComposerStates) {
resolvedStates.emplace_back(std::move(state));
auto& resolvedState = resolvedStates.back();
resolvedState.layerId = LayerHandle::getLayerId(resolvedState.state.surface);
@@ -5083,7 +5085,7 @@
layer->getDebugName() : std::to_string(resolvedState.state.layerId);
resolvedState.externalTexture =
getExternalTextureFromBufferData(*resolvedState.state.bufferData,
- layerName.c_str(), transactionId);
+ layerName.c_str(), transactionState.getId());
if (resolvedState.externalTexture) {
resolvedState.state.bufferData->buffer = resolvedState.externalTexture->getBuffer();
}
@@ -5105,22 +5107,12 @@
}
}
- QueuedTransactionState state{frameTimelineInfo,
- resolvedStates,
- displays,
- flags,
- applyToken,
- std::move(inputWindowCommands),
- desiredPresentTime,
- isAutoTimestamp,
+ QueuedTransactionState state{std::move(transactionState),
+ std::move(resolvedStates),
std::move(uncacheBufferIds),
postTime,
- hasListenerCallbacks,
- listenerCallbacks,
originPid,
- originUid,
- transactionId,
- mergedTransactionIds};
+ originUid};
state.workloadHint = queuedWorkload;
if (mTransactionTracing) {
@@ -5143,16 +5135,16 @@
for (const auto& [displayId, data] : mNotifyExpectedPresentMap) {
if (data.hintStatus.load() == NotifyExpectedPresentHintStatus::ScheduleOnTx) {
- scheduleNotifyExpectedPresentHint(displayId, VsyncId{frameTimelineInfo.vsyncId});
+ scheduleNotifyExpectedPresentHint(displayId, VsyncId{state.frameTimelineInfo.vsyncId});
}
}
- setTransactionFlags(eTransactionFlushNeeded, schedule, applyToken, frameHint);
+ setTransactionFlags(eTransactionFlushNeeded, schedule, state.applyToken, frameHint);
return NO_ERROR;
}
bool SurfaceFlinger::applyTransactionState(
const FrameTimelineInfo& frameTimelineInfo, std::vector<ResolvedComposerState>& states,
- Vector<DisplayState>& displays, uint32_t flags,
+ std::span<DisplayState> displays, uint32_t flags,
const InputWindowCommands& inputWindowCommands, const int64_t desiredPresentTime,
bool isAutoTimestamp, const std::vector<uint64_t>& uncacheBufferIds, const int64_t postTime,
bool hasListenerCallbacks, const std::vector<ListenerCallbacks>& listenerCallbacks,
@@ -5642,7 +5634,8 @@
auto layerStack = ui::DEFAULT_LAYER_STACK.id;
for (const auto& [id, display] : FTL_FAKE_GUARD(mStateLock, mPhysicalDisplays)) {
- state.displays.push(DisplayState(display.token(), ui::LayerStack::fromValue(layerStack++)));
+ state.displays.emplace_back(
+ DisplayState(display.token(), ui::LayerStack::fromValue(layerStack++)));
}
std::vector<QueuedTransactionState> transactions;
@@ -5683,7 +5676,7 @@
}
const auto displayId = display->getPhysicalId();
- ALOGD("Setting power mode %d on display %s", mode, to_string(displayId).c_str());
+ ALOGD("Setting power mode %d on physical display %s", mode, to_string(displayId).c_str());
const auto currentMode = display->getPowerMode();
if (currentMode == mode) {
@@ -5726,16 +5719,15 @@
}
if (displayId == mActiveDisplayId) {
- // TODO: b/281692563 - Merge the syscalls. For now, keep uclamp in a separate syscall
- // and set it before SCHED_FIFO due to b/190237315.
- constexpr const char* kWhence = "setPowerMode(ON)";
- setSchedAttr(true, kWhence);
- setSchedFifo(true, kWhence);
+ if (FlagManager::getInstance().correct_virtual_display_power_state()) {
+ applyOptimizationPolicy("setPhysicalDisplayPowerMode(ON)");
+ } else {
+ disablePowerOptimizations("setPhysicalDisplayPowerMode(ON)");
+ }
}
getHwComposer().setPowerMode(displayId, mode);
- if (mode != hal::PowerMode::DOZE_SUSPEND &&
- (displayId == mActiveDisplayId || FlagManager::getInstance().multithreaded_present())) {
+ if (mode != hal::PowerMode::DOZE_SUSPEND) {
const bool enable =
mScheduler->getVsyncSchedule(displayId)->getPendingHardwareVsyncState();
requestHardwareVsync(displayId, enable);
@@ -5757,19 +5749,18 @@
if (const auto display = getActivatableDisplay()) {
onActiveDisplayChangedLocked(activeDisplay.get(), *display);
} else {
- constexpr const char* kWhence = "setPowerMode(OFF)";
- setSchedFifo(false, kWhence);
- setSchedAttr(false, kWhence);
+ if (FlagManager::getInstance().correct_virtual_display_power_state()) {
+ applyOptimizationPolicy("setPhysicalDisplayPowerMode(OFF)");
+ } else {
+ enablePowerOptimizations("setPhysicalDisplayPowerMode(OFF)");
+ }
if (currentModeNotDozeSuspend) {
- if (!FlagManager::getInstance().multithreaded_present()) {
- mScheduler->disableHardwareVsync(displayId, true);
- }
mScheduler->enableSyntheticVsync();
}
}
}
- if (currentModeNotDozeSuspend && FlagManager::getInstance().multithreaded_present()) {
+ if (currentModeNotDozeSuspend) {
constexpr bool kDisallow = true;
mScheduler->disableHardwareVsync(displayId, kDisallow);
}
@@ -5787,8 +5778,7 @@
} else if (mode == hal::PowerMode::DOZE || mode == hal::PowerMode::ON) {
// Update display while dozing
getHwComposer().setPowerMode(displayId, mode);
- if (currentMode == hal::PowerMode::DOZE_SUSPEND &&
- (displayId == mActiveDisplayId || FlagManager::getInstance().multithreaded_present())) {
+ if (currentMode == hal::PowerMode::DOZE_SUSPEND) {
if (displayId == mActiveDisplayId) {
ALOGI("Force repainting for DOZE_SUSPEND -> DOZE or ON.");
mVisibleRegionsDirty = true;
@@ -5800,10 +5790,9 @@
}
} else if (mode == hal::PowerMode::DOZE_SUSPEND) {
// Leave display going to doze
- if (displayId == mActiveDisplayId || FlagManager::getInstance().multithreaded_present()) {
- constexpr bool kDisallow = true;
- mScheduler->disableHardwareVsync(displayId, kDisallow);
- }
+ constexpr bool kDisallow = true;
+ mScheduler->disableHardwareVsync(displayId, kDisallow);
+
if (displayId == mActiveDisplayId) {
mScheduler->enableSyntheticVsync();
}
@@ -5820,7 +5809,67 @@
mScheduler->setDisplayPowerMode(displayId, mode);
- ALOGD("Finished setting power mode %d on display %s", mode, to_string(displayId).c_str());
+ ALOGD("Finished setting power mode %d on physical display %s", mode,
+ to_string(displayId).c_str());
+}
+
+void SurfaceFlinger::setVirtualDisplayPowerMode(const sp<DisplayDevice>& display,
+ hal::PowerMode mode) {
+ if (!display->isVirtual()) {
+ ALOGE("%s: Invalid operation on physical display", __func__);
+ return;
+ }
+
+ const auto displayId = display->getVirtualId();
+ ALOGD("Setting power mode %d on virtual display %s %s", mode, to_string(displayId).c_str(),
+ display->getDisplayName().c_str());
+
+ display->setPowerMode(static_cast<hal::PowerMode>(mode));
+
+ applyOptimizationPolicy(__func__);
+
+ ALOGD("Finished setting power mode %d on virtual display %s", mode,
+ to_string(displayId).c_str());
+}
+
+bool SurfaceFlinger::shouldOptimizeForPerformance() {
+ for (const auto& [_, display] : mDisplays) {
+ // Displays that are optimized for power are always powered on and should not influence
+ // whether there is an active display for the purpose of power optimization, etc. If these
+ // displays are being shown somewhere, a different (physical or virtual) display that is
+ // optimized for performance will be powered on in addition. Displays optimized for
+ // performance will change power mode, so if they are off then they are not active.
+ if (display->isPoweredOn() &&
+ display->getOptimizationPolicy() ==
+ gui::ISurfaceComposer::OptimizationPolicy::optimizeForPerformance) {
+ return true;
+ }
+ }
+ return false;
+}
+
+void SurfaceFlinger::enablePowerOptimizations(const char* whence) {
+ ALOGD("%s: Enabling power optimizations", whence);
+
+ setSchedAttr(false, whence);
+ setSchedFifo(false, whence);
+}
+
+void SurfaceFlinger::disablePowerOptimizations(const char* whence) {
+ ALOGD("%s: Disabling power optimizations", whence);
+
+ // TODO: b/281692563 - Merge the syscalls. For now, keep uclamp in a separate syscall
+ // and set it before SCHED_FIFO due to b/190237315.
+ setSchedAttr(true, whence);
+ setSchedFifo(true, whence);
+}
+
+void SurfaceFlinger::applyOptimizationPolicy(const char* whence) {
+ if (shouldOptimizeForPerformance()) {
+ disablePowerOptimizations(whence);
+ } else {
+ enablePowerOptimizations(whence);
+ }
}
void SurfaceFlinger::setPowerMode(const sp<IBinder>& displayToken, int mode) {
@@ -5842,9 +5891,8 @@
ALOGE("Failed to set power mode %d for display token %p", mode, displayToken.get());
} else if (display->isVirtual()) {
if (FlagManager::getInstance().correct_virtual_display_power_state()) {
- ALOGD("Setting power mode %d on virtual display %s", mode,
- display->getDisplayName().c_str());
- display->setPowerMode(static_cast<hal::PowerMode>(mode));
+ ftl::FakeGuard guard(mStateLock);
+ setVirtualDisplayPowerMode(display, static_cast<hal::PowerMode>(mode));
} else {
ALOGW("Attempt to set power mode %d for virtual display", mode);
}
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 8b0935d..9cf0c6a 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -545,13 +545,7 @@
}
sp<IBinder> getPhysicalDisplayToken(PhysicalDisplayId displayId) const;
- status_t setTransactionState(
- const FrameTimelineInfo& frameTimelineInfo, Vector<ComposerState>& state,
- Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken,
- InputWindowCommands inputWindowCommands, int64_t desiredPresentTime,
- bool isAutoTimestamp, const std::vector<client_cache_t>& uncacheBuffers,
- bool hasListenerCallbacks, const std::vector<ListenerCallbacks>& listenerCallbacks,
- uint64_t transactionId, const std::vector<uint64_t>& mergedTransactionIds) override;
+ status_t setTransactionState(TransactionState&&) override;
void bootFinished();
status_t getSupportedFrameTimestamps(std::vector<FrameEvent>* outSupported) const;
sp<IDisplayEventConnection> createDisplayEventConnection(
@@ -736,6 +730,22 @@
// Called on the main thread in response to setPowerMode()
void setPhysicalDisplayPowerMode(const sp<DisplayDevice>& display, hal::PowerMode mode)
REQUIRES(mStateLock, kMainThreadContext);
+ void setVirtualDisplayPowerMode(const sp<DisplayDevice>& display, hal::PowerMode mode)
+ REQUIRES(mStateLock, kMainThreadContext);
+
+ // Returns whether to optimize globally for performance instead of power.
+ bool shouldOptimizeForPerformance() REQUIRES(mStateLock);
+
+ // Turns on power optimizations, for example when there are no displays to be optimized for
+ // performance.
+ static void enablePowerOptimizations(const char* whence);
+
+ // Turns off power optimizations.
+ static void disablePowerOptimizations(const char* whence);
+
+ // Enables or disables power optimizations depending on whether there are displays that should
+ // be optimized for performance.
+ void applyOptimizationPolicy(const char* whence) REQUIRES(mStateLock);
// Returns the preferred mode for PhysicalDisplayId if the Scheduler has selected one for that
// display. Falls back to the display's defaultModeId otherwise.
@@ -782,7 +792,7 @@
*/
bool applyTransactionState(const FrameTimelineInfo& info,
std::vector<ResolvedComposerState>& state,
- Vector<DisplayState>& displays, uint32_t flags,
+ std::span<DisplayState> displays, uint32_t flags,
const InputWindowCommands& inputWindowCommands,
const int64_t desiredPresentTime, bool isAutoTimestamp,
const std::vector<uint64_t>& uncacheBufferIds,
diff --git a/services/surfaceflinger/Tracing/TransactionProtoParser.cpp b/services/surfaceflinger/Tracing/TransactionProtoParser.cpp
index 3297c16..6bbc04c 100644
--- a/services/surfaceflinger/Tracing/TransactionProtoParser.cpp
+++ b/services/surfaceflinger/Tracing/TransactionProtoParser.cpp
@@ -321,7 +321,7 @@
int32_t displayCount = proto.display_changes_size();
t.displays.reserve(static_cast<size_t>(displayCount));
for (int i = 0; i < displayCount; i++) {
- t.displays.add(fromProto(proto.display_changes(i)));
+ t.displays.emplace_back(fromProto(proto.display_changes(i)));
}
return t;
}
diff --git a/services/surfaceflinger/common/FlagManager.cpp b/services/surfaceflinger/common/FlagManager.cpp
index 42fa436..5ff3d82 100644
--- a/services/surfaceflinger/common/FlagManager.cpp
+++ b/services/surfaceflinger/common/FlagManager.cpp
@@ -164,7 +164,6 @@
DUMP_ACONFIG_FLAG(latch_unsignaled_with_auto_refresh_changed);
DUMP_ACONFIG_FLAG(local_tonemap_screenshots);
DUMP_ACONFIG_FLAG(misc1);
- DUMP_ACONFIG_FLAG(multithreaded_present);
DUMP_ACONFIG_FLAG(no_vsyncs_on_screen_off);
DUMP_ACONFIG_FLAG(override_trusted_overlay);
DUMP_ACONFIG_FLAG(protected_if_client);
@@ -259,7 +258,6 @@
FLAG_MANAGER_ACONFIG_FLAG(misc1, "")
FLAG_MANAGER_ACONFIG_FLAG(vrr_config, "debug.sf.enable_vrr_config")
FLAG_MANAGER_ACONFIG_FLAG(hdcp_level_hal, "")
-FLAG_MANAGER_ACONFIG_FLAG(multithreaded_present, "debug.sf.multithreaded_present")
FLAG_MANAGER_ACONFIG_FLAG(add_sf_skipped_frames_to_trace, "")
FLAG_MANAGER_ACONFIG_FLAG(use_known_refresh_rate_for_fps_consistency, "")
FLAG_MANAGER_ACONFIG_FLAG(cache_when_source_crop_layer_only_moved,
diff --git a/services/surfaceflinger/common/include/common/FlagManager.h b/services/surfaceflinger/common/include/common/FlagManager.h
index dd7042d..419e92b 100644
--- a/services/surfaceflinger/common/include/common/FlagManager.h
+++ b/services/surfaceflinger/common/include/common/FlagManager.h
@@ -99,7 +99,6 @@
bool local_tonemap_screenshots() const;
bool luts_api() const;
bool misc1() const;
- bool multithreaded_present() const;
bool no_vsyncs_on_screen_off() const;
bool override_trusted_overlay() const;
bool protected_if_client() const;
diff --git a/services/surfaceflinger/tests/benchmarks/LayerLifecycleManager_benchmarks.cpp b/services/surfaceflinger/tests/benchmarks/LayerLifecycleManager_benchmarks.cpp
index 0925118..fec6242 100644
--- a/services/surfaceflinger/tests/benchmarks/LayerLifecycleManager_benchmarks.cpp
+++ b/services/surfaceflinger/tests/benchmarks/LayerLifecycleManager_benchmarks.cpp
@@ -90,5 +90,46 @@
}
BENCHMARK(updateClientStatesNoChanges);
+static void propagateManyHiddenChildren(benchmark::State& state) {
+ LayerLifecycleManager lifecycleManager;
+ LayerLifecycleManagerHelper helper(lifecycleManager);
+
+ helper.createRootLayer(0);
+ for (uint32_t i = 1; i < 50; ++i) {
+ helper.createLayer(i, i - 1);
+ }
+
+ helper.hideLayer(0);
+
+ LayerHierarchyBuilder hierarchyBuilder;
+ DisplayInfo info;
+ info.info.logicalHeight = 100;
+ info.info.logicalWidth = 100;
+ DisplayInfos displayInfos;
+ displayInfos.emplace_or_replace(ui::LayerStack::fromValue(1), info);
+ ShadowSettings globalShadowSettings;
+
+ LayerSnapshotBuilder snapshotBuilder;
+
+ int i = 1;
+ for (auto _ : state) {
+ i++;
+ helper.setAlpha(0, (1 + (i % 255)) / 255.0f);
+
+ if (lifecycleManager.getGlobalChanges().test(RequestedLayerState::Changes::Hierarchy)) {
+ hierarchyBuilder.update(lifecycleManager);
+ }
+ LayerSnapshotBuilder::Args args{.root = hierarchyBuilder.getHierarchy(),
+ .layerLifecycleManager = lifecycleManager,
+ .displays = displayInfos,
+ .globalShadowSettings = globalShadowSettings,
+ .supportedLayerGenericMetadata = {},
+ .genericLayerMetadataKeyMap = {}};
+ snapshotBuilder.update(args);
+ lifecycleManager.commitChanges();
+ }
+}
+BENCHMARK(propagateManyHiddenChildren);
+
} // namespace
} // namespace android::surfaceflinger
diff --git a/services/surfaceflinger/tests/unittests/FlagManagerTest.cpp b/services/surfaceflinger/tests/unittests/FlagManagerTest.cpp
index a5b347a..c6da1a1 100644
--- a/services/surfaceflinger/tests/unittests/FlagManagerTest.cpp
+++ b/services/surfaceflinger/tests/unittests/FlagManagerTest.cpp
@@ -125,13 +125,13 @@
TEST_F(FlagManagerTest, ignoresOverrideInUnitTestMode) {
mFlagManager.setUnitTestMode();
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
+ SET_FLAG_FOR_TEST(flags::no_vsyncs_on_screen_off, true);
// If this has not been called in this process, it will be called.
// Regardless, the result is ignored.
EXPECT_CALL(mFlagManager, getBoolProperty).WillRepeatedly(Return(false));
- EXPECT_EQ(true, mFlagManager.multithreaded_present());
+ EXPECT_EQ(true, mFlagManager.no_vsyncs_on_screen_off());
}
TEST_F(FlagManagerTest, returnsValue) {
diff --git a/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp b/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp
index 3ed038b..07356b9 100644
--- a/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp
+++ b/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp
@@ -261,6 +261,40 @@
EXPECT_EQ(getSnapshot(1221)->alpha, 0.25f);
}
+TEST_F(LayerSnapshotTest, AlphaInheritedByChildWhenParentIsHiddenByInvalidTransform) {
+ setMatrix(1, 0, 0, 0, 0);
+ update(mSnapshotBuilder);
+ mLifecycleManager.commitChanges();
+
+ setAlpha(1, 0.5);
+ update(mSnapshotBuilder);
+ mLifecycleManager.commitChanges();
+
+ setMatrix(1, 1, 0, 0, 1);
+ update(mSnapshotBuilder);
+ mLifecycleManager.commitChanges();
+
+ EXPECT_EQ(getSnapshot(1)->alpha, 0.5f);
+ EXPECT_EQ(getSnapshot(11)->alpha, 0.5f);
+}
+
+TEST_F(LayerSnapshotTest, AlphaInheritedByChildWhenParentIsHidden) {
+ hideLayer(1);
+ update(mSnapshotBuilder);
+ mLifecycleManager.commitChanges();
+
+ setAlpha(1, 0.5);
+ update(mSnapshotBuilder);
+ mLifecycleManager.commitChanges();
+
+ showLayer(1);
+ update(mSnapshotBuilder);
+ mLifecycleManager.commitChanges();
+
+ EXPECT_EQ(getSnapshot(1)->alpha, 0.5f);
+ EXPECT_EQ(getSnapshot(11)->alpha, 0.5f);
+}
+
// Change states
TEST_F(LayerSnapshotTest, UpdateClearsPreviousChangeStates) {
setCrop(1, Rect(1, 2, 3, 4));
diff --git a/services/surfaceflinger/tests/unittests/SchedulerTest.cpp b/services/surfaceflinger/tests/unittests/SchedulerTest.cpp
index 49c35e2..116fcd9 100644
--- a/services/surfaceflinger/tests/unittests/SchedulerTest.cpp
+++ b/services/surfaceflinger/tests/unittests/SchedulerTest.cpp
@@ -741,8 +741,6 @@
}
TEST_F(SchedulerTest, resyncAllSkipsOffDisplays) FTL_FAKE_GUARD(kMainThreadContext) {
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
-
// resyncAllToHardwareVsync will result in requesting hardware VSYNC on display 1, which is on,
// but not on display 2, which is off.
EXPECT_CALL(mScheduler->mockRequestHardwareVsync, Call(kDisplayId1, true)).Times(1);
@@ -763,28 +761,6 @@
mScheduler->resyncAllToHardwareVsync(kAllowToEnable);
}
-TEST_F(SchedulerTest, resyncAllLegacyAppliesToOffDisplays) FTL_FAKE_GUARD(kMainThreadContext) {
- SET_FLAG_FOR_TEST(flags::multithreaded_present, false);
-
- // In the legacy code, prior to the flag, resync applied to OFF displays.
- EXPECT_CALL(mScheduler->mockRequestHardwareVsync, Call(kDisplayId1, true)).Times(1);
- EXPECT_CALL(mScheduler->mockRequestHardwareVsync, Call(kDisplayId2, true)).Times(1);
-
- mScheduler->setDisplayPowerMode(kDisplayId1, hal::PowerMode::ON);
-
- mScheduler->registerDisplay(kDisplayId2,
- std::make_shared<RefreshRateSelector>(kDisplay2Modes,
- kDisplay2Mode60->getId()));
- ASSERT_EQ(hal::PowerMode::OFF, mScheduler->getDisplayPowerMode(kDisplayId2));
-
- static constexpr bool kDisallow = true;
- mScheduler->disableHardwareVsync(kDisplayId1, kDisallow);
- mScheduler->disableHardwareVsync(kDisplayId2, kDisallow);
-
- static constexpr bool kAllowToEnable = true;
- mScheduler->resyncAllToHardwareVsync(kAllowToEnable);
-}
-
class AttachedChoreographerTest : public SchedulerTest {
protected:
void frameRateTestScenario(Fps layerFps, int8_t frameRateCompatibility, Fps displayFps,
diff --git a/services/surfaceflinger/tests/unittests/SurfaceFlinger_FoldableTest.cpp b/services/surfaceflinger/tests/unittests/SurfaceFlinger_FoldableTest.cpp
index fde2749..8972840 100644
--- a/services/surfaceflinger/tests/unittests/SurfaceFlinger_FoldableTest.cpp
+++ b/services/surfaceflinger/tests/unittests/SurfaceFlinger_FoldableTest.cpp
@@ -167,7 +167,6 @@
}
TEST_F(FoldableTest, requestVsyncOnPowerOn) {
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
EXPECT_CALL(mFlinger.scheduler()->mockRequestHardwareVsync, Call(kInnerDisplayId, true))
.Times(1);
EXPECT_CALL(mFlinger.scheduler()->mockRequestHardwareVsync, Call(kOuterDisplayId, true))
@@ -178,7 +177,6 @@
}
TEST_F(FoldableTest, disableVsyncOnPowerOffPacesetter) {
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
// When the device boots, the inner display should be the pacesetter.
ASSERT_EQ(mFlinger.scheduler()->pacesetterDisplayId(), kInnerDisplayId);
diff --git a/services/surfaceflinger/tests/unittests/SurfaceFlinger_NotifyExpectedPresentTest.cpp b/services/surfaceflinger/tests/unittests/SurfaceFlinger_NotifyExpectedPresentTest.cpp
index 6cc6322..9c143fd 100644
--- a/services/surfaceflinger/tests/unittests/SurfaceFlinger_NotifyExpectedPresentTest.cpp
+++ b/services/surfaceflinger/tests/unittests/SurfaceFlinger_NotifyExpectedPresentTest.cpp
@@ -45,28 +45,15 @@
void setTransactionState() {
ASSERT_TRUE(mFlinger.getTransactionQueue().isEmpty());
TransactionInfo transaction;
- mFlinger.setTransactionState(FrameTimelineInfo{}, transaction.states, transaction.displays,
- transaction.flags, transaction.applyToken,
- transaction.inputWindowCommands,
- TimePoint::now().ns() + s2ns(1), transaction.isAutoTimestamp,
- transaction.unCachedBuffers,
- /*HasListenerCallbacks=*/false, transaction.callbacks,
- transaction.id, transaction.mergedTransactionIds);
+ mFlinger.setTransactionState(std::move(transaction));
}
- struct TransactionInfo {
- Vector<ComposerState> states;
- Vector<DisplayState> displays;
- uint32_t flags = 0;
- sp<IBinder> applyToken = IInterface::asBinder(TransactionCompletedListener::getIInstance());
- InputWindowCommands inputWindowCommands;
- int64_t desiredPresentTime = 0;
- bool isAutoTimestamp = false;
- FrameTimelineInfo frameTimelineInfo{};
- std::vector<client_cache_t> unCachedBuffers;
- uint64_t id = static_cast<uint64_t>(-1);
- std::vector<uint64_t> mergedTransactionIds;
- std::vector<ListenerCallbacks> callbacks;
+ struct TransactionInfo : public TransactionState {
+ TransactionInfo() {
+ mApplyToken = IInterface::asBinder(TransactionCompletedListener::getIInstance());
+ mIsAutoTimestamp = false;
+ mId = static_cast<uint64_t>(-1);
+ }
};
struct Compositor final : ICompositor {
@@ -383,4 +370,4 @@
}
}
}
-} // namespace android
\ No newline at end of file
+} // namespace android
diff --git a/services/surfaceflinger/tests/unittests/SurfaceFlinger_SetPhysicalDisplayPowerModeTest.cpp b/services/surfaceflinger/tests/unittests/SurfaceFlinger_SetPhysicalDisplayPowerModeTest.cpp
index 322efb7..d5c22a9 100644
--- a/services/surfaceflinger/tests/unittests/SurfaceFlinger_SetPhysicalDisplayPowerModeTest.cpp
+++ b/services/surfaceflinger/tests/unittests/SurfaceFlinger_SetPhysicalDisplayPowerModeTest.cpp
@@ -456,7 +456,6 @@
}
TEST_F(SetPhysicalDisplayPowerModeTest, transitionsDisplayFromOffToOnExternalDisplay) {
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
transitionDisplayCommon<ExternalDisplayPowerCase<TransitionOffToOnVariant>>();
}
@@ -465,7 +464,6 @@
}
TEST_F(SetPhysicalDisplayPowerModeTest, transitionsDisplayFromOnToOffExternalDisplay) {
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
transitionDisplayCommon<ExternalDisplayPowerCase<TransitionOnToOffVariant>>();
}
@@ -478,7 +476,6 @@
}
TEST_F(SetPhysicalDisplayPowerModeTest, transitionsDisplayFromDozeSuspendToDozeExternalDisplay) {
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
transitionDisplayCommon<ExternalDisplayPowerCase<TransitionDozeSuspendToDozeVariant>>();
}
@@ -487,12 +484,10 @@
}
TEST_F(SetPhysicalDisplayPowerModeTest, transitionsDisplayFromDozeSuspendToOnExternalDisplay) {
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
transitionDisplayCommon<ExternalDisplayPowerCase<TransitionDozeSuspendToOnVariant>>();
}
TEST_F(SetPhysicalDisplayPowerModeTest, transitionsDisplayFromOnToDozeSuspendExternalDisplay) {
- SET_FLAG_FOR_TEST(flags::multithreaded_present, true);
transitionDisplayCommon<ExternalDisplayPowerCase<TransitionOnToDozeSuspendVariant>>();
}
diff --git a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
index c5973db..13c32bd 100644
--- a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
+++ b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
@@ -519,18 +519,8 @@
return mFlinger->mTransactionHandler.mPendingTransactionCount.load();
}
- auto setTransactionState(
- const FrameTimelineInfo& frameTimelineInfo, Vector<ComposerState>& states,
- Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken,
- const InputWindowCommands& inputWindowCommands, int64_t desiredPresentTime,
- bool isAutoTimestamp, const std::vector<client_cache_t>& uncacheBuffers,
- bool hasListenerCallbacks, std::vector<ListenerCallbacks>& listenerCallbacks,
- uint64_t transactionId, const std::vector<uint64_t>& mergedTransactionIds) {
- return mFlinger->setTransactionState(frameTimelineInfo, states, displays, flags, applyToken,
- inputWindowCommands, desiredPresentTime,
- isAutoTimestamp, uncacheBuffers, hasListenerCallbacks,
- listenerCallbacks, transactionId,
- mergedTransactionIds);
+ auto setTransactionState(TransactionState&& state) {
+ return mFlinger->setTransactionState(std::move(state));
}
auto setTransactionStateInternal(QueuedTransactionState& transaction) {
diff --git a/services/surfaceflinger/tests/unittests/TransactionApplicationTest.cpp b/services/surfaceflinger/tests/unittests/TransactionApplicationTest.cpp
index 69dfcc4..6a5ac2a 100644
--- a/services/surfaceflinger/tests/unittests/TransactionApplicationTest.cpp
+++ b/services/surfaceflinger/tests/unittests/TransactionApplicationTest.cpp
@@ -17,6 +17,8 @@
#undef LOG_TAG
#define LOG_TAG "TransactionApplicationTest"
+#include <cstdint>
+
#include <binder/Binder.h>
#include <common/test/FlagUtils.h>
#include <compositionengine/Display.h>
@@ -69,38 +71,32 @@
TestableSurfaceFlinger mFlinger;
renderengine::mock::RenderEngine* mRenderEngine = new renderengine::mock::RenderEngine();
- struct TransactionInfo {
- Vector<ComposerState> states;
- Vector<DisplayState> displays;
- uint32_t flags = 0;
- sp<IBinder> applyToken = IInterface::asBinder(TransactionCompletedListener::getIInstance());
- InputWindowCommands inputWindowCommands;
- int64_t desiredPresentTime = 0;
- bool isAutoTimestamp = true;
- FrameTimelineInfo frameTimelineInfo;
- std::vector<client_cache_t> uncacheBuffers;
- uint64_t id = static_cast<uint64_t>(-1);
- std::vector<uint64_t> mergedTransactionIds;
- static_assert(0xffffffffffffffff == static_cast<uint64_t>(-1));
+ struct TransactionInfo : public TransactionState {
+ TransactionInfo() {
+ mApplyToken = IInterface::asBinder(TransactionCompletedListener::getIInstance());
+ mId = static_cast<uint64_t>(-1);
+ }
};
void checkEqual(TransactionInfo info, QueuedTransactionState state) {
- EXPECT_EQ(0u, info.states.size());
+ EXPECT_EQ(0u, info.mComposerStates.size());
EXPECT_EQ(0u, state.states.size());
- EXPECT_EQ(0u, info.displays.size());
+ EXPECT_EQ(0u, info.mDisplayStates.size());
EXPECT_EQ(0u, state.displays.size());
- EXPECT_EQ(info.flags, state.flags);
- EXPECT_EQ(info.desiredPresentTime, state.desiredPresentTime);
+ EXPECT_EQ(info.mFlags, state.flags);
+ EXPECT_EQ(info.mDesiredPresentTime, state.desiredPresentTime);
}
void setupSingle(TransactionInfo& transaction, uint32_t flags, int64_t desiredPresentTime,
bool isAutoTimestamp, const FrameTimelineInfo& frameTimelineInfo) {
mTransactionNumber++;
- transaction.flags |= flags;
- transaction.desiredPresentTime = desiredPresentTime;
- transaction.isAutoTimestamp = isAutoTimestamp;
- transaction.frameTimelineInfo = frameTimelineInfo;
+ transaction.mFlags |= flags;
+ transaction.mDesiredPresentTime = desiredPresentTime;
+ transaction.mIsAutoTimestamp = isAutoTimestamp;
+ transaction.mFrameTimelineInfo = frameTimelineInfo;
+ transaction.mHasListenerCallbacks = mHasListenerCallbacks;
+ transaction.mListenerCallbacks = mCallbacks;
}
void NotPlacedOnTransactionQueue(uint32_t flags) {
@@ -111,12 +107,7 @@
/*desiredPresentTime*/ systemTime(), /*isAutoTimestamp*/ true,
FrameTimelineInfo{});
nsecs_t applicationTime = systemTime();
- mFlinger.setTransactionState(transaction.frameTimelineInfo, transaction.states,
- transaction.displays, transaction.flags,
- transaction.applyToken, transaction.inputWindowCommands,
- transaction.desiredPresentTime, transaction.isAutoTimestamp,
- transaction.uncacheBuffers, mHasListenerCallbacks, mCallbacks,
- transaction.id, transaction.mergedTransactionIds);
+ mFlinger.setTransactionState(std::move(transaction));
// If transaction is synchronous, SF applyTransactionState should time out (5s) wating for
// SF to commit the transaction. If this is animation, it should not time out waiting.
@@ -138,12 +129,7 @@
setupSingle(transaction, flags, /*desiredPresentTime*/ time + s2ns(1), false,
FrameTimelineInfo{});
nsecs_t applicationSentTime = systemTime();
- mFlinger.setTransactionState(transaction.frameTimelineInfo, transaction.states,
- transaction.displays, transaction.flags,
- transaction.applyToken, transaction.inputWindowCommands,
- transaction.desiredPresentTime, transaction.isAutoTimestamp,
- transaction.uncacheBuffers, mHasListenerCallbacks, mCallbacks,
- transaction.id, transaction.mergedTransactionIds);
+ mFlinger.setTransactionState(std::move(transaction));
nsecs_t returnedTime = systemTime();
EXPECT_LE(returnedTime, applicationSentTime + TRANSACTION_TIMEOUT);
@@ -169,12 +155,7 @@
/*isAutoTimestamp*/ true, FrameTimelineInfo{});
nsecs_t applicationSentTime = systemTime();
- mFlinger.setTransactionState(transactionA.frameTimelineInfo, transactionA.states,
- transactionA.displays, transactionA.flags,
- transactionA.applyToken, transactionA.inputWindowCommands,
- transactionA.desiredPresentTime, transactionA.isAutoTimestamp,
- transactionA.uncacheBuffers, mHasListenerCallbacks, mCallbacks,
- transactionA.id, transactionA.mergedTransactionIds);
+ mFlinger.setTransactionState(std::move(transactionA));
// This thread should not have been blocked by the above transaction
// (5s is the timeout period that applyTransactionState waits for SF to
@@ -184,12 +165,7 @@
mFlinger.flushTransactionQueues();
applicationSentTime = systemTime();
- mFlinger.setTransactionState(transactionB.frameTimelineInfo, transactionB.states,
- transactionB.displays, transactionB.flags,
- transactionB.applyToken, transactionB.inputWindowCommands,
- transactionB.desiredPresentTime, transactionB.isAutoTimestamp,
- transactionB.uncacheBuffers, mHasListenerCallbacks, mCallbacks,
- transactionB.id, transactionB.mergedTransactionIds);
+ mFlinger.setTransactionState(std::move(transactionB));
// this thread should have been blocked by the above transaction
// if this is an animation, this thread should be blocked for 5s
@@ -222,12 +198,7 @@
TransactionInfo transactionA; // transaction to go on pending queue
setupSingle(transactionA, /*flags*/ 0, /*desiredPresentTime*/ s2ns(1), false,
FrameTimelineInfo{});
- mFlinger.setTransactionState(transactionA.frameTimelineInfo, transactionA.states,
- transactionA.displays, transactionA.flags, transactionA.applyToken,
- transactionA.inputWindowCommands, transactionA.desiredPresentTime,
- transactionA.isAutoTimestamp, transactionA.uncacheBuffers,
- mHasListenerCallbacks, mCallbacks, transactionA.id,
- transactionA.mergedTransactionIds);
+ mFlinger.setTransactionState(std::move(transactionA));
auto& transactionQueue = mFlinger.getTransactionQueue();
ASSERT_FALSE(transactionQueue.isEmpty());
@@ -243,12 +214,7 @@
TransactionInfo transactionA; // transaction to go on pending queue
setupSingle(transactionA, /*flags*/ 0, /*desiredPresentTime*/ s2ns(1), false,
FrameTimelineInfo{});
- mFlinger.setTransactionState(transactionA.frameTimelineInfo, transactionA.states,
- transactionA.displays, transactionA.flags, transactionA.applyToken,
- transactionA.inputWindowCommands, transactionA.desiredPresentTime,
- transactionA.isAutoTimestamp, transactionA.uncacheBuffers,
- mHasListenerCallbacks, mCallbacks, transactionA.id,
- transactionA.mergedTransactionIds);
+ mFlinger.setTransactionState(std::move(transactionA));
auto& transactionQueue = mFlinger.getTransactionQueue();
ASSERT_FALSE(transactionQueue.isEmpty());
@@ -257,12 +223,10 @@
// transaction here (sending a null applyToken to fake it as from a
// different process) to re-query and reset the cached expected present time
TransactionInfo empty;
- empty.applyToken = sp<IBinder>();
- mFlinger.setTransactionState(empty.frameTimelineInfo, empty.states, empty.displays, empty.flags,
- empty.applyToken, empty.inputWindowCommands,
- empty.desiredPresentTime, empty.isAutoTimestamp,
- empty.uncacheBuffers, mHasListenerCallbacks, mCallbacks, empty.id,
- empty.mergedTransactionIds);
+ empty.mApplyToken = sp<IBinder>();
+ empty.mHasListenerCallbacks = mHasListenerCallbacks;
+ empty.mListenerCallbacks = mCallbacks;
+ mFlinger.setTransactionState(std::move(empty));
// flush transaction queue should flush as desiredPresentTime has
// passed
@@ -406,9 +370,9 @@
const auto kFrameTimelineInfo = FrameTimelineInfo{};
setupSingle(transaction, kFlags, kDesiredPresentTime, kIsAutoTimestamp, kFrameTimelineInfo);
- transaction.applyToken = applyToken;
+ transaction.mApplyToken = applyToken;
for (const auto& state : states) {
- transaction.states.push_back(state);
+ transaction.mComposerStates.push_back(state);
}
return transaction;
@@ -420,7 +384,7 @@
EXPECT_EQ(0u, mFlinger.getPendingTransactionQueue().size());
std::unordered_set<uint32_t> createdLayers;
for (auto transaction : transactions) {
- for (auto& state : transaction.states) {
+ for (auto& state : transaction.mComposerStates) {
auto layerId = static_cast<uint32_t>(state.state.layerId);
if (createdLayers.find(layerId) == createdLayers.end()) {
mFlinger.addLayer(layerId);
@@ -434,8 +398,8 @@
for (auto transaction : transactions) {
std::vector<ResolvedComposerState> resolvedStates;
- resolvedStates.reserve(transaction.states.size());
- for (auto& state : transaction.states) {
+ resolvedStates.reserve(transaction.mComposerStates.size());
+ for (auto& state : transaction.mComposerStates) {
ResolvedComposerState resolvedState;
resolvedState.state = std::move(state.state);
resolvedState.externalTexture =
@@ -446,15 +410,9 @@
resolvedStates.emplace_back(resolvedState);
}
- QueuedTransactionState transactionState(transaction.frameTimelineInfo, resolvedStates,
- transaction.displays, transaction.flags,
- transaction.applyToken,
- transaction.inputWindowCommands,
- transaction.desiredPresentTime,
- transaction.isAutoTimestamp, {}, systemTime(),
- mHasListenerCallbacks, mCallbacks, getpid(),
- static_cast<int>(getuid()), transaction.id,
- transaction.mergedTransactionIds);
+ QueuedTransactionState transactionState(std::move(transaction),
+ std::move(resolvedStates), {}, systemTime(),
+ getpid(), static_cast<int>(getuid()));
mFlinger.setTransactionStateInternal(transactionState);
}
mFlinger.flushTransactionQueues();
diff --git a/services/surfaceflinger/tests/unittests/TransactionProtoParserTest.cpp b/services/surfaceflinger/tests/unittests/TransactionProtoParserTest.cpp
index d3eec5c..b36ad21 100644
--- a/services/surfaceflinger/tests/unittests/TransactionProtoParserTest.cpp
+++ b/services/surfaceflinger/tests/unittests/TransactionProtoParserTest.cpp
@@ -66,7 +66,7 @@
display.token = nullptr;
}
display.width = 85;
- t1.displays.add(display);
+ t1.displays.push_back(display);
}
class TestMapper : public TransactionProtoParser::FlingerDataMapper {
diff --git a/vulkan/scripts/code_generator.py b/vulkan/scripts/code_generator.py
index 2a017d2..051816d 100755
--- a/vulkan/scripts/code_generator.py
+++ b/vulkan/scripts/code_generator.py
@@ -21,6 +21,7 @@
import driver_generator
import generator_common
import null_generator
+import vkjson_generator
if __name__ == '__main__':
generator_common.parse_vulkan_registry()
@@ -30,3 +31,6 @@
driver_generator.gen_cpp()
null_generator.gen_h()
null_generator.gen_cpp()
+ vkjson_generator.gen_h()
+ vkjson_generator.gen_cc()
+ vkjson_generator.gen_instance_cc()
diff --git a/vulkan/scripts/vk.py b/vulkan/scripts/vk.py
new file mode 100644
index 0000000..983e0dc
--- /dev/null
+++ b/vulkan/scripts/vk.py
@@ -0,0 +1,968 @@
+import ctypes
+import dataclasses
+import enum
+from typing import List
+
+dataclass = dataclasses.dataclass
+Enum = enum.Enum
+
+# TODO(b/401184058): Automate this file for generating the vulkan structs graph from vk.xml
+VK_UUID_SIZE = 16
+VK_LUID_SIZE = 16
+
+VkImageLayout = Enum
+uint8_t = ctypes.c_uint8
+uint32_t = ctypes.c_uint32
+VkFlags = uint32_t
+VkMemoryPropertyFlags = VkFlags
+VkMemoryHeapFlags = VkFlags
+int32_t = int
+uint64_t = ctypes.c_uint64
+VkBool32 = bool
+VkDeviceSize = ctypes.c_uint64
+size_t = int
+VkSampleCountFlags = ctypes.c_uint32
+VkFormatFeatureFlags = ctypes.c_uint32
+VkQueueFlags = ctypes.c_uint32
+VkShaderStageFlags = ctypes.c_uint32
+VkSubgroupFeatureFlags = ctypes.c_uint32
+VkResolveModeFlags = ctypes.c_uint32
+float_t = ctypes.c_float
+VkShaderFloatControlsIndependence = Enum
+VkPointClippingBehavior = Enum
+VkPhysicalDeviceType = Enum
+VkDriverId = Enum
+VkPipelineRobustnessBufferBehavior = Enum
+
+
+@dataclass
+class ConformanceVersion:
+ major: uint8_t
+ minor: uint8_t
+ subminor: uint8_t
+ patch: uint8_t
+
+
+@dataclass
+class VkExtent3D:
+ width: uint32_t
+ height: uint32_t
+ depth: uint32_t
+
+
+@dataclass
+class VkPhysicalDeviceLimits:
+ maxImageDimension1D: uint32_t
+ maxImageDimension2D: uint32_t
+ maxImageDimension3D: uint32_t
+ maxImageDimensionCube: uint32_t
+ maxImageArrayLayers: uint32_t
+ maxTexelBufferElements: uint32_t
+ maxUniformBufferRange: uint32_t
+ maxStorageBufferRange: uint32_t
+ maxPushConstantsSize: uint32_t
+ maxMemoryAllocationCount: uint32_t
+ maxSamplerAllocationCount: uint32_t
+ bufferImageGranularity: VkDeviceSize
+ sparseAddressSpaceSize: VkDeviceSize
+ maxBoundDescriptorSets: uint32_t
+ maxPerStageDescriptorSamplers: uint32_t
+ maxPerStageDescriptorUniformBuffers: uint32_t
+ maxPerStageDescriptorStorageBuffers: uint32_t
+ maxPerStageDescriptorSampledImages: uint32_t
+ maxPerStageDescriptorStorageImages: uint32_t
+ maxPerStageDescriptorInputAttachments: uint32_t
+ maxPerStageResources: uint32_t
+ maxDescriptorSetSamplers: uint32_t
+ maxDescriptorSetUniformBuffers: uint32_t
+ maxDescriptorSetUniformBuffersDynamic: uint32_t
+ maxDescriptorSetStorageBuffers: uint32_t
+ maxDescriptorSetStorageBuffersDynamic: uint32_t
+ maxDescriptorSetSampledImages: uint32_t
+ maxDescriptorSetStorageImages: uint32_t
+ maxDescriptorSetInputAttachments: uint32_t
+ maxVertexInputAttributes: uint32_t
+ maxVertexInputBindings: uint32_t
+ maxVertexInputAttributeOffset: uint32_t
+ maxVertexInputBindingStride: uint32_t
+ maxVertexOutputComponents: uint32_t
+ maxTessellationGenerationLevel: uint32_t
+ maxTessellationPatchSize: uint32_t
+ maxTessellationControlPerVertexInputComponents: uint32_t
+ maxTessellationControlPerVertexOutputComponents: uint32_t
+ maxTessellationControlPerPatchOutputComponents: uint32_t
+ maxTessellationControlTotalOutputComponents: uint32_t
+ maxTessellationEvaluationInputComponents: uint32_t
+ maxTessellationEvaluationOutputComponents: uint32_t
+ maxGeometryShaderInvocations: uint32_t
+ maxGeometryInputComponents: uint32_t
+ maxGeometryOutputComponents: uint32_t
+ maxGeometryOutputVertices: uint32_t
+ maxGeometryTotalOutputComponents: uint32_t
+ maxFragmentInputComponents: uint32_t
+ maxFragmentOutputAttachments: uint32_t
+ maxFragmentDualSrcAttachments: uint32_t
+ maxFragmentCombinedOutputResources: uint32_t
+ maxComputeSharedMemorySize: uint32_t
+ maxComputeWorkGroupCount: uint32_t*3
+ maxComputeWorkGroupInvocations: uint32_t
+ maxComputeWorkGroupSize: uint32_t*3
+ subPixelPrecisionBits: uint32_t
+ subTexelPrecisionBits: uint32_t
+ mipmapPrecisionBits: uint32_t
+ maxDrawIndexedIndexValue: uint32_t
+ maxDrawIndirectCount: uint32_t
+ maxSamplerLodBias: float
+ maxSamplerAnisotropy: float
+ maxViewports: uint32_t
+ maxViewportDimensions: uint32_t*2
+ viewportBoundsRange: float_t*2
+ viewportSubPixelBits: uint32_t
+ minMemoryMapAlignment: size_t
+ minTexelBufferOffsetAlignment: VkDeviceSize
+ minUniformBufferOffsetAlignment: VkDeviceSize
+ minStorageBufferOffsetAlignment: VkDeviceSize
+ minTexelOffset: int32_t
+ maxTexelOffset: uint32_t
+ minTexelGatherOffset: int32_t
+ maxTexelGatherOffset: uint32_t
+ minInterpolationOffset: float
+ maxInterpolationOffset: float
+ subPixelInterpolationOffsetBits: uint32_t
+ maxFramebufferWidth: uint32_t
+ maxFramebufferHeight: uint32_t
+ maxFramebufferLayers: uint32_t
+ framebufferColorSampleCounts: VkSampleCountFlags
+ framebufferDepthSampleCounts: VkSampleCountFlags
+ framebufferStencilSampleCounts: VkSampleCountFlags
+ framebufferNoAttachmentsSampleCounts: VkSampleCountFlags
+ maxColorAttachments: uint32_t
+ sampledImageColorSampleCounts: VkSampleCountFlags
+ sampledImageIntegerSampleCounts: VkSampleCountFlags
+ sampledImageDepthSampleCounts: VkSampleCountFlags
+ sampledImageStencilSampleCounts: VkSampleCountFlags
+ storageImageSampleCounts: VkSampleCountFlags
+ maxSampleMaskWords: uint32_t
+ timestampComputeAndGraphics: VkBool32
+ timestampPeriod: float
+ maxClipDistances: uint32_t
+ maxCullDistances: uint32_t
+ maxCombinedClipAndCullDistances: uint32_t
+ discreteQueuePriorities: uint32_t
+ pointSizeRange: float_t*2
+ lineWidthRange: float_t*2
+ pointSizeGranularity: float
+ lineWidthGranularity: float
+ strictLines: VkBool32
+ standardSampleLocations: VkBool32
+ optimalBufferCopyOffsetAlignment: VkDeviceSize
+ optimalBufferCopyRowPitchAlignment: VkDeviceSize
+ nonCoherentAtomSize: VkDeviceSize
+
+
+@dataclass
+class VkPhysicalDeviceShaderDrawParameterFeatures:
+ shaderDrawParameters: VkBool32
+
+
+@dataclass
+class VkExtensionProperties:
+ extensionName: str
+ specVersion: uint32_t
+
+
+@dataclass
+class VkFormatProperties:
+ linearTilingFeatures: VkFormatFeatureFlags
+ optimalTilingFeatures: VkFormatFeatureFlags
+ bufferFeatures: VkFormatFeatureFlags
+
+
+@dataclass
+class VkLayerProperties:
+ layerName: str
+ specVersion: uint32_t
+ implementationVersion: uint32_t
+ description: str
+
+
+@dataclass
+class VkQueueFamilyProperties:
+ queueFlags: VkQueueFlags
+ queueCount: uint32_t
+ timestampValidBits: uint32_t
+ minImageTransferGranularity: VkExtent3D
+
+
+@dataclass
+class VkPhysicalDeviceSparseProperties:
+ residencyStandard2DBlockShape: VkBool32
+ residencyStandard2DMultisampleBlockShape: VkBool32
+ residencyStandard3DBlockShape: VkBool32
+ residencyAlignedMipSize: VkBool32
+ residencyNonResidentStrict: VkBool32
+
+
+@dataclass
+class VkImageFormatProperties:
+ maxExtent: VkExtent3D
+ maxMipLevels: uint32_t
+ maxArrayLayers: uint32_t
+ sampleCounts: VkSampleCountFlags
+ maxResourceSize: VkDeviceSize
+
+
+@dataclass
+class VkPhysicalDeviceSamplerYcbcrConversionFeatures:
+ samplerYcbcrConversion: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceIDProperties:
+ deviceUUID: uint8_t*VK_UUID_SIZE
+ driverUUID: uint8_t*VK_UUID_SIZE
+ deviceLUID: uint8_t*VK_LUID_SIZE
+ deviceNodeMask: uint32_t
+ deviceLUIDValid: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceMaintenance3Properties:
+ maxPerSetDescriptors: uint32_t
+ maxMemoryAllocationSize: VkDeviceSize
+
+
+@dataclass
+class VkPhysicalDevice16BitStorageFeatures:
+ storageBuffer16BitAccess: VkBool32
+ uniformAndStorageBuffer16BitAccess: VkBool32
+ storagePushConstant16: VkBool32
+ storageInputOutput16: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceMultiviewFeatures:
+ multiview: VkBool32
+ multiviewGeometryShader: VkBool32
+ multiviewTessellationShader: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceSubgroupProperties:
+ subgroupSize: uint32_t
+ supportedStages: VkShaderStageFlags
+ supportedOperations: VkSubgroupFeatureFlags
+ quadOperationsInAllStages: VkBool32
+
+
+@dataclass
+class VkPhysicalDevicePointClippingProperties:
+ pointClippingBehavior: VkPointClippingBehavior
+
+
+@dataclass
+class VkPhysicalDeviceMultiviewProperties:
+ maxMultiviewViewCount: uint32_t
+ maxMultiviewInstanceIndex: uint32_t
+
+
+@dataclass
+class VkMemoryType:
+ propertyFlags: VkMemoryPropertyFlags
+ heapIndex: uint32_t
+
+
+@dataclass
+class VkMemoryHeap:
+ size: VkDeviceSize
+ flags: VkMemoryHeapFlags
+
+
+@dataclass
+class VkPhysicalDeviceMemoryProperties:
+ memoryTypeCount: uint32_t
+ memoryTypes: List[VkMemoryType]
+ memoryHeapCount: uint32_t
+ memoryHeaps: List[VkMemoryHeap]
+
+
+@dataclass
+class VkPhysicalDeviceProperties:
+ apiVersion: uint32_t
+ driverVersion: uint32_t
+ vendorID: uint32_t
+ deviceID: uint32_t
+ deviceType: VkPhysicalDeviceType
+ deviceName: str
+ pipelineCacheUUID: uint8_t
+ limits: VkPhysicalDeviceLimits
+ sparseProperties: VkPhysicalDeviceSparseProperties
+
+
+@dataclass
+class VkPhysicalDeviceFeatures:
+ robustBufferAccess: VkBool32
+ fullDrawIndexUint32: VkBool32
+ imageCubeArray: VkBool32
+ independentBlend: VkBool32
+ geometryShader: VkBool32
+ tessellationShader: VkBool32
+ sampleRateShading: VkBool32
+ dualSrcBlend: VkBool32
+ logicOp: VkBool32
+ multiDrawIndirect: VkBool32
+ drawIndirectFirstInstance: VkBool32
+ depthClamp: VkBool32
+ depthBiasClamp: VkBool32
+ fillModeNonSolid: VkBool32
+ depthBounds: VkBool32
+ wideLines: VkBool32
+ largePoints: VkBool32
+ alphaToOne: VkBool32
+ multiViewport: VkBool32
+ samplerAnisotropy: VkBool32
+ textureCompressionETC2: VkBool32
+ textureCompressionASTC_LDR: VkBool32
+ textureCompressionBC: VkBool32
+ occlusionQueryPrecise: VkBool32
+ pipelineStatisticsQuery: VkBool32
+ vertexPipelineStoresAndAtomics: VkBool32
+ fragmentStoresAndAtomics: VkBool32
+ shaderTessellationAndGeometryPointSize: VkBool32
+ shaderImageGatherExtended: VkBool32
+ shaderStorageImageExtendedFormats: VkBool32
+ shaderStorageImageMultisample: VkBool32
+ shaderStorageImageReadWithoutFormat: VkBool32
+ shaderStorageImageWriteWithoutFormat: VkBool32
+ shaderUniformBufferArrayDynamicIndexing: VkBool32
+ shaderSampledImageArrayDynamicIndexing: VkBool32
+ shaderStorageBufferArrayDynamicIndexing: VkBool32
+ shaderStorageImageArrayDynamicIndexing: VkBool32
+ shaderClipDistance: VkBool32
+ shaderCullDistance: VkBool32
+ shaderFloat64: VkBool32
+ shaderInt64: VkBool32
+ shaderInt16: VkBool32
+ shaderResourceResidency: VkBool32
+ shaderResourceMinLod: VkBool32
+ sparseBinding: VkBool32
+ sparseResidencyBuffer: VkBool32
+ sparseResidencyImage2D: VkBool32
+ sparseResidencyImage3D: VkBool32
+ sparseResidency2Samples: VkBool32
+ sparseResidency4Samples: VkBool32
+ sparseResidency8Samples: VkBool32
+ sparseResidency16Samples: VkBool32
+ sparseResidencyAliased: VkBool32
+ variableMultisampleRate: VkBool32
+ inheritedQueries: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceShaderFloat16Int8Features:
+ shaderFloat16: VkBool32
+ shaderInt8: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceProtectedMemoryFeatures:
+ protectedMemory: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceVariablePointersFeatures:
+ variablePointersStorageBuffer: VkBool32
+ variablePointers: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceImage2DViewOf3DFeaturesEXT:
+ image2DViewOf3D: VkBool32
+ sampler2DViewOf3D: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceCustomBorderColorFeaturesEXT:
+ customBorderColors: VkBool32
+ customBorderColorWithoutFormat: VkBool32
+
+
+@dataclass
+class VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT:
+ primitiveTopologyListRestart: VkBool32
+ primitiveTopologyPatchListRestart: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceProvokingVertexFeaturesEXT:
+ provokingVertexLast: VkBool32
+ transformFeedbackPreservesProvokingVertex: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceIndexTypeUint8Features:
+ indexTypeUint8: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceVertexAttributeDivisorFeatures:
+ vertexAttributeInstanceRateDivisor: VkBool32
+ vertexAttributeInstanceRateZeroDivisor: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceTransformFeedbackFeaturesEXT:
+ transformFeedback: VkBool32
+ geometryStreams: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR:
+ shaderSubgroupUniformControlFlow: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures:
+ shaderSubgroupExtendedTypes: VkBool32
+
+
+@dataclass
+class VkPhysicalDevice8BitStorageFeatures:
+ storageBuffer8BitAccess: VkBool32
+ uniformAndStorageBuffer8BitAccess: VkBool32
+ storagePushConstant8: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceShaderIntegerDotProductFeatures:
+ shaderIntegerDotProduct: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG:
+ relaxedLineRasterization: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceLineRasterizationFeatures:
+ rectangularLines: VkBool32
+ bresenhamLines: VkBool32
+ smoothLines: VkBool32
+ stippledRectangularLines: VkBool32
+ stippledBresenhamLines: VkBool32
+ stippledSmoothLines: VkBool32
+
+
+@dataclass
+class VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT:
+ primitivesGeneratedQuery: VkBool32
+ primitivesGeneratedQueryWithRasterizerDiscard: VkBool32
+ primitivesGeneratedQueryWithNonZeroStreams: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceFloatControlsProperties:
+ denormBehaviorIndependence : VkShaderFloatControlsIndependence
+ roundingModeIndependence : VkShaderFloatControlsIndependence
+ 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 : VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceVulkan11Properties:
+ deviceUUID : uint8_t*VK_UUID_SIZE
+ driverUUID : uint8_t*VK_UUID_SIZE
+ deviceLUID : uint8_t*VK_LUID_SIZE
+ deviceNodeMask : uint32_t
+ deviceLUIDValid : VkBool32
+ subgroupSize : uint32_t
+ subgroupSupportedStages : VkShaderStageFlags
+ subgroupSupportedOperations : VkSubgroupFeatureFlags
+ subgroupQuadOperationsInAllStages : VkBool32
+ pointClippingBehavior : VkPointClippingBehavior
+ maxMultiviewViewCount : uint32_t
+ maxMultiviewInstanceIndex :uint32_t
+ protectedNoFault : VkBool32
+ maxPerSetDescriptors : uint32_t
+ maxMemoryAllocationSize : VkDeviceSize
+
+
+@dataclass
+class VkPhysicalDeviceVulkan11Features:
+ storageBuffer16BitAccess: VkBool32
+ uniformAndStorageBuffer16BitAccess: VkBool32
+ storagePushConstant16: VkBool32
+ storageInputOutput16: VkBool32
+ multiview: VkBool32
+ multiviewGeometryShader: VkBool32
+ multiviewTessellationShader: VkBool32
+ variablePointersStorageBuffer: VkBool32
+ variablePointers: VkBool32
+ protectedMemory: VkBool32
+ samplerYcbcrConversion: VkBool32
+ shaderDrawParameters: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceVulkan12Properties:
+ driverID: VkDriverId
+ driverName: str
+ driverInfo: str
+ conformanceVersion: ConformanceVersion
+ denormBehaviorIndependence: VkShaderFloatControlsIndependence
+ roundingModeIndependence: VkShaderFloatControlsIndependence
+ 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: VkBool32
+ maxUpdateAfterBindDescriptorsInAllPools: uint32_t
+ shaderUniformBufferArrayNonUniformIndexingNative: VkBool32
+ shaderSampledImageArrayNonUniformIndexingNative: VkBool32
+ shaderStorageBufferArrayNonUniformIndexingNative: VkBool32
+ shaderStorageImageArrayNonUniformIndexingNative: VkBool32
+ shaderInputAttachmentArrayNonUniformIndexingNative: VkBool32
+ robustBufferAccessUpdateAfterBind: VkBool32
+ quadDivergentImplicitLod: VkBool32
+ 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: uint32_t
+ supportedDepthResolveModes: VkResolveModeFlags
+ supportedStencilResolveModes: VkResolveModeFlags
+ independentResolveNone: VkBool32
+ independentResolve: VkBool32
+ filterMinmaxSingleComponentFormats: VkBool32
+ filterMinmaxImageComponentMapping: VkBool32
+ maxTimelineSemaphoreValueDifference: uint64_t
+ framebufferIntegerColorSampleCounts: VkSampleCountFlags
+
+
+@dataclass
+class VkPhysicalDeviceVulkan12Features:
+ 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: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceVulkan13Properties:
+ minSubgroupSize: uint32_t
+ maxSubgroupSize: uint32_t
+ maxComputeWorkgroupSubgroups: uint32_t
+ requiredSubgroupSizeStages: VkShaderStageFlags
+ maxInlineUniformBlockSize: uint32_t
+ maxPerStageDescriptorInlineUniformBlocks: uint32_t
+ maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks: uint32_t
+ maxDescriptorSetInlineUniformBlocks: uint32_t
+ maxDescriptorSetUpdateAfterBindInlineUniformBlocks: uint32_t
+ maxInlineUniformTotalSize: uint32_t
+ 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: VkBool32
+ storageTexelBufferOffsetAlignmentBytes: VkDeviceSize
+ storageTexelBufferOffsetSingleTexelAlignment: VkBool32
+ uniformTexelBufferOffsetAlignmentBytes: VkDeviceSize
+ uniformTexelBufferOffsetSingleTexelAlignment: VkBool32
+ maxBufferSize: VkDeviceSize
+
+
+@dataclass
+class VkPhysicalDeviceVulkan13Features:
+ 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: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceVulkan14Properties:
+ lineSubPixelPrecisionBits: uint32_t
+ maxVertexAttribDivisor: uint32_t
+ supportsNonZeroFirstInstance: VkBool32
+ maxPushDescriptors: uint32_t
+ dynamicRenderingLocalReadDepthStencilAttachments: VkBool32
+ dynamicRenderingLocalReadMultisampledAttachments: VkBool32
+ earlyFragmentMultisampleCoverageAfterSampleCounting: VkBool32
+ earlyFragmentSampleMaskTestBeforeSampleCounting: VkBool32
+ depthStencilSwizzleOneSupport: VkBool32
+ polygonModePointSize: VkBool32
+ nonStrictSinglePixelWideLinesUseParallelogram: VkBool32
+ nonStrictWideLinesUseParallelogram: VkBool32
+ blockTexelViewCompatibleMultipleLayers: VkBool32
+ maxCombinedImageSamplerDescriptorCount: uint32_t
+ fragmentShadingRateClampCombinerInputs: VkBool32
+ defaultRobustnessStorageBuffers: VkPipelineRobustnessBufferBehavior
+ defaultRobustnessUniformBuffers: VkPipelineRobustnessBufferBehavior
+ defaultRobustnessVertexInputs: VkPipelineRobustnessBufferBehavior
+ defaultRobustnessImages: VkPipelineRobustnessBufferBehavior
+ copySrcLayoutCount: uint32_t
+ pCopySrcLayouts: List[VkImageLayout]
+ copyDstLayoutCount: uint32_t
+ pCopyDstLayouts: List[VkImageLayout]
+ optimalTilingLayoutUUID: uint8_t
+ identicalMemoryTypeRequirements: VkBool32
+
+
+@dataclass
+class VkPhysicalDeviceVulkan14Features:
+ globalPriorityQuery: VkBool32
+ shaderSubgroupRotate: VkBool32
+ shaderSubgroupRotateClustered: VkBool32
+ shaderFloatControls2: VkBool32
+ shaderExpectAssume: VkBool32
+ rectangularLines: VkBool32
+ bresenhamLines: VkBool32
+ smoothLines: VkBool32
+ stippledRectangularLines: VkBool32
+ stippledBresenhamLines: VkBool32
+ stippledSmoothLines: VkBool32
+ vertexAttributeInstanceRateDivisor: VkBool32
+ vertexAttributeInstanceRateZeroDivisor: VkBool32
+ indexTypeUint8: VkBool32
+ dynamicRenderingLocalRead: VkBool32
+ maintenance5: VkBool32
+ maintenance6: VkBool32
+ pipelineProtectedAccess: VkBool32
+ pipelineRobustness: VkBool32
+ hostImageCopy: VkBool32
+ # pushDescriptor: bool
+
+
+@dataclass
+class VkPhysicalDeviceDriverProperties:
+ driverID: VkDriverId
+ driverName: str
+ driverInfo: str
+ conformanceVersion: ConformanceVersion
+
+# Defining alias for structures
+VkPhysicalDeviceLineRasterizationFeaturesEXT = VkPhysicalDeviceLineRasterizationFeatures
+VkPhysicalDeviceLineRasterizationFeaturesKHR = VkPhysicalDeviceLineRasterizationFeatures
+VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR = VkPhysicalDeviceShaderIntegerDotProductFeatures
+VkPhysicalDevice8BitStorageFeaturesKHR = VkPhysicalDevice8BitStorageFeatures
+VkPhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR = VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures
+VkPhysicalDeviceVertexAttributeDivisorFeaturesKHR = VkPhysicalDeviceVertexAttributeDivisorFeatures
+VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT = VkPhysicalDeviceVertexAttributeDivisorFeatures
+VkPhysicalDeviceIndexTypeUint8FeaturesKHR = VkPhysicalDeviceIndexTypeUint8Features
+VkPhysicalDeviceIndexTypeUint8FeaturesEXT = VkPhysicalDeviceIndexTypeUint8Features
+VkPhysicalDeviceVariablePointerFeatures = VkPhysicalDeviceVariablePointersFeatures
+VkPhysicalDeviceVariablePointersFeaturesKHR = VkPhysicalDeviceVariablePointersFeatures
+VkPhysicalDeviceVariablePointerFeaturesKHR = VkPhysicalDeviceVariablePointersFeatures
+VkPhysicalDeviceFloat16Int8FeaturesKHR = VkPhysicalDeviceShaderFloat16Int8Features
+VkPhysicalDeviceShaderFloat16Int8FeaturesKHR = VkPhysicalDeviceShaderFloat16Int8Features
+VkPhysicalDeviceFloatControlsPropertiesKHR = VkPhysicalDeviceFloatControlsProperties
+VkPhysicalDeviceShaderDrawParametersFeatures = VkPhysicalDeviceShaderDrawParameterFeatures
+VkPhysicalDeviceDriverPropertiesKHR = VkPhysicalDeviceDriverProperties
+
+# Defining dependency of structures on extensions
+VULKAN_EXTENSIONS_AND_STRUCTS_MAPPING = {
+ "extensions": {
+ "VK_KHR_variable_pointers": [
+ { "VkPhysicalDeviceVariablePointerFeaturesKHR": "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES" },
+ { "VkPhysicalDeviceVariablePointersFeaturesKHR" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES"},
+ ],
+ "VK_KHR_shader_float16_int8": [
+ { "VkPhysicalDeviceShaderFloat16Int8FeaturesKHR": "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES" },
+ {"VkPhysicalDeviceFloat16Int8FeaturesKHR" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES"},
+ ],
+ "VK_EXT_image_2d_view_of_3d" : [
+ {"VkPhysicalDeviceImage2DViewOf3DFeaturesEXT" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT"},
+ ],
+ "VK_EXT_custom_border_color" : [
+ {"VkPhysicalDeviceCustomBorderColorFeaturesEXT" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_PROPERTIES_EXT"},
+ ],
+ "VK_EXT_primitive_topology_list_restart": [
+ {"VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT"},
+ ],
+ "VK_EXT_provoking_vertex" : [
+ {"VkPhysicalDeviceProvokingVertexFeaturesEXT" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT"},
+ ],
+ "VK_KHR_index_type_uint8" : [
+ {"VkPhysicalDeviceIndexTypeUint8FeaturesKHR" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES"},
+ ],
+ "VK_EXT_index_type_uint8" : [
+ {"VkPhysicalDeviceIndexTypeUint8FeaturesEXT" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES"},
+ ],
+ "VK_KHR_vertex_attribute_divisor" : [
+ {"VkPhysicalDeviceVertexAttributeDivisorFeaturesKHR" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES"},
+ ],
+ "VK_EXT_vertex_attribute_divisor" : [
+ {"VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES"},
+ ],
+ "VK_EXT_transform_feedback" : [
+ {"VkPhysicalDeviceTransformFeedbackFeaturesEXT" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT"},
+ ],
+ "VK_KHR_shader_subgroup_uniform_control_flow" : [
+ {"VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_FEATURES_KHR"},
+ ],
+ "VK_KHR_shader_subgroup_extended_types" : [
+ {"VkPhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES"},
+ ],
+ "VK_KHR_8bit_storage" : [
+ {"VkPhysicalDevice8BitStorageFeaturesKHR" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES"},
+ ],
+ "VK_KHR_shader_integer_dot_product" : [
+ {"VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES"},
+ ],
+ "VK_IMG_relaxed_line_rasterization" : [
+ {"VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RELAXED_LINE_RASTERIZATION_FEATURES_IMG"},
+ ],
+ "VK_KHR_line_rasterization" : [
+ {"VkPhysicalDeviceLineRasterizationFeaturesKHR" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES"},
+ ],
+ "VK_EXT_line_rasterization" : [
+ {"VkPhysicalDeviceLineRasterizationFeaturesEXT" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES"},
+ ],
+ "VK_EXT_primitives_generated_query" : [
+ {"VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVES_GENERATED_QUERY_FEATURES_EXT"},
+ ],
+ "VK_KHR_shader_float_controls" : [
+ {"VkPhysicalDeviceFloatControlsPropertiesKHR" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES"},
+ ],
+ "VK_KHR_driver_properties" : [
+ {"VkPhysicalDeviceDriverPropertiesKHR" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES"},
+ ]
+ }
+}
+
+# Defining dependency of structures on vulkan cores
+VULKAN_CORES_AND_STRUCTS_MAPPING = {
+ "versions" : {
+ "Core11" : [
+ {"VkPhysicalDeviceVulkan11Properties" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES"},
+ {"VkPhysicalDeviceVulkan11Features" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES"},
+ ],
+ "Core12" : [
+ {"VkPhysicalDeviceVulkan12Properties" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES"},
+ {"VkPhysicalDeviceVulkan12Features" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES"},
+ ],
+ "Core13" : [
+ {"VkPhysicalDeviceVulkan13Properties" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES"},
+ {"VkPhysicalDeviceVulkan13Features" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES"},
+ ],
+ "Core14" : [
+ {"VkPhysicalDeviceVulkan14Properties" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_4_PROPERTIES"},
+ {"VkPhysicalDeviceVulkan14Features" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_4_FEATURES"},
+ ]
+ }
+}
+
+# Defining map for list type members mapped to its size
+LIST_TYPE_FIELD_AND_SIZE_MAPPING = {
+ "pCopySrcLayouts": "copySrcLayoutCount",
+ "pCopyDstLayouts": "copyDstLayoutCount",
+ "memoryTypes": "memoryTypeCount",
+ "memoryHeaps": "memoryHeapCount",
+}
+
+# Defining dependency of structures on vulkan api version
+VULKAN_VERSIONS_AND_STRUCTS_MAPPING = {
+ "VK_VERSION_1_0" : [
+ {"VkPhysicalDeviceProperties" : "" },
+ {"VkPhysicalDeviceFeatures" : ""},
+ {"VkPhysicalDeviceMemoryProperties" : ""},
+ ],
+ "VK_VERSION_1_1" : [
+ {"VkPhysicalDeviceSubgroupProperties" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES"},
+ {"VkPhysicalDevicePointClippingProperties" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES"},
+ {"VkPhysicalDeviceMultiviewProperties" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES"},
+ {"VkPhysicalDeviceIDProperties" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES"},
+ {"VkPhysicalDeviceMaintenance3Properties" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES"},
+ {"VkPhysicalDeviceMultiviewFeatures" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES"},
+ {"VkPhysicalDeviceVariablePointersFeatures" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES"},
+ {"VkPhysicalDeviceProtectedMemoryFeatures" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES"},
+ {"VkPhysicalDeviceSamplerYcbcrConversionFeatures" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES"},
+ {"VkPhysicalDeviceShaderDrawParameterFeatures" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES"},
+ {"VkPhysicalDevice16BitStorageFeatures" : "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES"},
+ ]
+}
+
+# List of structures that are not dependent on extensions
+EXTENSION_INDEPENDENT_STRUCTS = [
+ VkPhysicalDeviceProperties,
+ VkPhysicalDeviceFeatures,
+ VkPhysicalDeviceMemoryProperties,
+ VkPhysicalDeviceSubgroupProperties,
+ VkPhysicalDevicePointClippingProperties,
+ VkPhysicalDeviceMultiviewProperties,
+ VkPhysicalDeviceIDProperties,
+ VkPhysicalDeviceMaintenance3Properties,
+ VkPhysicalDevice16BitStorageFeatures,
+ VkPhysicalDeviceMultiviewFeatures,
+ VkPhysicalDeviceVariablePointersFeatures,
+ VkPhysicalDeviceProtectedMemoryFeatures,
+ VkPhysicalDeviceSamplerYcbcrConversionFeatures,
+ VkPhysicalDeviceShaderDrawParameterFeatures,
+]
+
+# List of all the structures for vkjson
+ALL_STRUCTS = [
+ VkPhysicalDeviceFloatControlsPropertiesKHR,
+ VkPhysicalDeviceProperties,
+ VkPhysicalDeviceMemoryProperties,
+ VkPhysicalDeviceSubgroupProperties,
+ VkPhysicalDevicePointClippingProperties,
+ VkPhysicalDeviceMultiviewProperties,
+ VkPhysicalDeviceIDProperties,
+ VkPhysicalDeviceMaintenance3Properties,
+ VkPhysicalDeviceSparseProperties,
+ VkImageFormatProperties,
+ VkQueueFamilyProperties,
+ VkExtensionProperties,
+ VkLayerProperties,
+ VkFormatProperties,
+ VkPhysicalDeviceVariablePointerFeaturesKHR,
+ VkPhysicalDeviceVariablePointersFeaturesKHR,
+ VkPhysicalDeviceShaderFloat16Int8FeaturesKHR,
+ VkPhysicalDeviceFloat16Int8FeaturesKHR,
+ VkPhysicalDeviceImage2DViewOf3DFeaturesEXT,
+ VkPhysicalDeviceCustomBorderColorFeaturesEXT,
+ VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT,
+ VkPhysicalDeviceProvokingVertexFeaturesEXT,
+ VkPhysicalDeviceIndexTypeUint8FeaturesKHR,
+ VkPhysicalDeviceIndexTypeUint8FeaturesEXT,
+ VkPhysicalDeviceVertexAttributeDivisorFeaturesKHR,
+ VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT,
+ VkPhysicalDeviceTransformFeedbackFeaturesEXT,
+ VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR,
+ VkPhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR,
+ VkPhysicalDevice8BitStorageFeaturesKHR,
+ VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR,
+ VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG,
+ VkPhysicalDeviceLineRasterizationFeaturesKHR,
+ VkPhysicalDeviceLineRasterizationFeaturesEXT,
+ VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT,
+ VkPhysicalDevice16BitStorageFeatures,
+ VkPhysicalDeviceMultiviewFeatures,
+ VkPhysicalDeviceProtectedMemoryFeatures,
+ VkPhysicalDeviceSamplerYcbcrConversionFeatures,
+ VkPhysicalDeviceShaderDrawParameterFeatures,
+ VkPhysicalDeviceLimits,
+ VkPhysicalDeviceFeatures,
+ VkPhysicalDeviceVulkan11Properties,
+ VkPhysicalDeviceVulkan11Features,
+ VkPhysicalDeviceVulkan12Properties,
+ VkPhysicalDeviceVulkan12Features,
+ VkPhysicalDeviceVulkan13Properties,
+ VkPhysicalDeviceVulkan13Features,
+ VkPhysicalDeviceVulkan14Properties,
+ VkPhysicalDeviceVulkan14Features,
+ VkPhysicalDeviceDriverProperties,
+]
diff --git a/vulkan/scripts/vkjson_generator.py b/vulkan/scripts/vkjson_generator.py
new file mode 100644
index 0000000..7dc55d9
--- /dev/null
+++ b/vulkan/scripts/vkjson_generator.py
@@ -0,0 +1,1882 @@
+#!/usr/bin/env python3
+#
+# Copyright 2025 The Android Open Source Project
+#
+# 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.
+
+"""Generates the vkjson files.
+"""
+import dataclasses
+import os
+import re
+from typing import get_origin
+
+import generator_common as gencom
+import vk as VK
+
+dataclass_field = dataclasses.field
+
+
+COPYRIGHT_WARNINGS = """///////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2015-2016 The Khronos Group Inc.
+// Copyright (c) 2015-2016 Valve Corporation
+// Copyright (c) 2015-2016 LunarG, Inc.
+// Copyright (c) 2015-2016 Google, 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.
+///////////////////////////////////////////////////////////////////////////////
+"""
+
+
+def get_copyright_warnings():
+ return COPYRIGHT_WARNINGS
+
+
+def get_vkjson_struct_name(extension_name):
+ """Gets the corresponding structure name from a Vulkan extension name.
+ Example: "VK_KHR_shader_float16_int8" → "VkJsonKHRShaderFloat16Int8"
+ """
+ prefix_map = {
+ "VK_KHR": "VkJsonKHR",
+ "VK_EXT": "VkJsonExt",
+ "VK_IMG": "VkJsonIMG"
+ }
+
+ for prefix, replacement in prefix_map.items():
+ if extension_name.startswith(prefix):
+ struct_name = replacement + extension_name[len(prefix):]
+ break
+ else:
+ struct_name = f"VkJsonExt{extension_name}"
+
+ # Convert underscores to camel case
+ # Example: "VK_KHR_shader_float16_int8" → "VkJsonKHRShaderFloat16Int8"
+ struct_name = re.sub(r"_(.)", lambda m: m.group(1).upper(), struct_name)
+
+ return struct_name
+
+
+def get_vkjson_struct_variable_name(extension_name):
+ """Gets corresponding instance name from a Vulkan extension name.
+ Example: "VK_KHR_shader_float16_int8" → "khr_shader_float16_int8"
+ """
+ prefix_map = {
+ "VK_KHR_": "khr_",
+ "VK_EXT_": "ext_",
+ "VK_IMG_": "img_"
+ }
+
+ for prefix, replacement in prefix_map.items():
+ if extension_name.startswith(prefix):
+ return replacement + extension_name[len(prefix):]
+
+ return extension_name.lower() # Default case if no known prefix matches
+
+
+def get_struct_name(struct_name):
+ """Gets corresponding instance name
+ Example: "VkPhysicalDeviceShaderFloat16Int8FeaturesKHR" → "shader_float16_int8_features_khr"
+ """
+ # Remove "VkPhysicalDevice" prefix and any of the known suffixes
+ base_name = struct_name.removeprefix("VkPhysicalDevice").removesuffix("KHR").removesuffix("EXT").removesuffix("IMG")
+
+ # Convert CamelCase to snake_case
+ # Example: "ShaderFloat16Int8Features" → "shader_float16_int8_features"
+ variable_name = re.sub(r"(?<!^)(?=[A-Z])", "_", base_name).lower()
+
+ # Fix special cases
+ variable_name = variable_name.replace("2_d_", "_2d_").replace("3_d_", "_3d_")
+
+ # Add back the correct suffix if it was removed
+ suffix_map = {"KHR": "_khr", "EXT": "_ext", "IMG": "_img"}
+ for suffix, replacement in suffix_map.items():
+ if struct_name.endswith(suffix):
+ variable_name += replacement
+ break
+
+ # Handle specific exceptions
+ special_cases = {
+ "8_bit_storage_features_khr": "bit8_storage_features_khr",
+ "memory_properties": "memory",
+ "16_bit_storage_features": "bit16_storage_features",
+ "i_d_properties": "id_properties"
+ }
+
+ return special_cases.get(variable_name, variable_name)
+
+
+def generate_extension_struct_definition(f):
+ """Generates struct definition code for extension based structs
+ Example:
+ struct VkJsonKHRShaderFloatControls {
+ VkJsonKHRShaderFloatControls() {
+ reported = false;
+ memset(&float_controls_properties_khr, 0,
+ sizeof(VkPhysicalDeviceFloatControlsPropertiesKHR));
+ }
+ bool reported;
+ VkPhysicalDeviceFloatControlsPropertiesKHR float_controls_properties_khr;
+ };
+ """
+ vkJson_entries = []
+
+ for extension_name, struct_list in VK.VULKAN_EXTENSIONS_AND_STRUCTS_MAPPING["extensions"].items():
+ vkjson_struct_name = get_vkjson_struct_name(extension_name)
+ vkjson_struct_variable_name = get_vkjson_struct_variable_name(extension_name)
+ vkJson_entries.append(f"{vkjson_struct_name} {vkjson_struct_variable_name}")
+
+ struct_entries = []
+
+ f.write(f"struct {vkjson_struct_name} {{\n")
+ f.write(f" {vkjson_struct_name}() {{\n")
+ f.write(" reported = false;\n")
+
+ for struct_map in struct_list:
+ for struct_name, _ in struct_map.items():
+ variable_name = get_struct_name(struct_name)
+ f.write(f" memset(&{variable_name}, 0, sizeof({struct_name}));\n")
+ struct_entries.append(f"{struct_name} {variable_name}")
+
+ f.write(" }\n") # End of constructor
+ f.write(" bool reported;\n")
+
+ for entry in struct_entries:
+ f.write(f" {entry};\n")
+
+ f.write("};\n\n") # End of struct
+
+ return vkJson_entries
+
+
+def generate_vk_core_struct_definition(f):
+ """Generates struct definition code for vulkan cores
+ Example:
+ struct VkJsonCore11 {
+ VkPhysicalDeviceVulkan11Properties properties;
+ VkPhysicalDeviceVulkan11Features features;
+ };
+ """
+ vkJson_core_entries = []
+
+ for version, items in VK.VULKAN_CORES_AND_STRUCTS_MAPPING["versions"].items():
+ struct_name = f"VkJson{version}"
+ vkJson_core_entries.append(f"{struct_name} {version.lower()}")
+
+ f.write(f"struct {struct_name} {{\n")
+
+ for item in items:
+ for struct_type, _ in item.items():
+ field_name = "properties" if "Properties" in struct_type else "features"
+ f.write(f" {struct_type} {field_name};\n")
+
+ f.write("};\n\n")
+
+ return vkJson_core_entries
+
+
+def generate_memset_statements(f):
+ """Generates memset statements for all independent Vulkan structs and core Vulkan versions.
+ This initializes struct instances to zero before use.
+
+ Example:
+ memset(&properties, 0, sizeof(VkPhysicalDeviceProperties));
+ VkPhysicalDeviceProperties properties;
+ """
+ entries = []
+
+ # Process independent structs
+ for dataclass_type in VK.EXTENSION_INDEPENDENT_STRUCTS:
+ class_name = dataclass_type.__name__
+ variable_name = get_struct_name(class_name)
+ f.write(f"memset(&{variable_name}, 0, sizeof({class_name}));\n")
+ entries.append(f"{class_name} {variable_name}")
+
+ # Process vulkan core structs
+ for version in VK.VULKAN_CORES_AND_STRUCTS_MAPPING["versions"]:
+ struct_name = f"VkJson{version}"
+ f.write(f"memset(&{version.lower()}, 0, sizeof({struct_name}));\n")
+
+ return entries
+
+
+def gen_h():
+ """Generates vkjson.h file.
+ """
+ genfile = os.path.join(os.path.dirname(__file__),
+ "..", "vkjson", "vkjson.h")
+
+ with open(genfile, "w") as f:
+ f.write(f'{get_copyright_warnings()}\n')
+
+ f.write("""\
+#ifndef VKJSON_H_
+#define VKJSON_H_
+
+#include <string.h>
+#include <vulkan/vulkan.h>
+
+#include <map>
+#include <string>
+#include <vector>
+
+#ifdef WIN32
+#undef min
+#undef max
+#endif
+
+/*
+ * This file is autogenerated by vkjson_generator.py. Do not edit directly.
+ */
+struct VkJsonLayer {
+ VkLayerProperties properties;
+ std::vector<VkExtensionProperties> extensions;
+};
+
+\n""")
+
+ vkjson_extension_structs = generate_extension_struct_definition(f)
+ vkjson_core_structs = generate_vk_core_struct_definition(f)
+
+ f.write("""\
+struct VkJsonDevice {
+ VkJsonDevice() {""")
+
+ feature_property_structs = generate_memset_statements(f)
+
+ f.write("""\
+ }\n""")
+ for struct_entries in (vkjson_extension_structs, vkjson_core_structs, feature_property_structs):
+ for entry in struct_entries:
+ f.write(entry + ";\n")
+
+ f.write("""\
+ std::vector<VkQueueFamilyProperties> queues;
+ std::vector<VkExtensionProperties> extensions;
+ std::vector<VkLayerProperties> layers;
+ std::map<VkFormat, VkFormatProperties> formats;
+ std::map<VkExternalFenceHandleTypeFlagBits, VkExternalFenceProperties>
+ external_fence_properties;
+ std::map<VkExternalSemaphoreHandleTypeFlagBits, VkExternalSemaphoreProperties>
+ external_semaphore_properties;
+};
+
+struct VkJsonDeviceGroup {
+ VkJsonDeviceGroup() {
+ memset(&properties, 0, sizeof(VkPhysicalDeviceGroupProperties));
+ }
+ VkPhysicalDeviceGroupProperties properties;
+ std::vector<uint32_t> device_inds;
+};
+
+struct VkJsonInstance {
+ VkJsonInstance() : api_version(0) {}
+ uint32_t api_version;
+ std::vector<VkJsonLayer> layers;
+ std::vector<VkExtensionProperties> extensions;
+ std::vector<VkJsonDevice> devices;
+ std::vector<VkJsonDeviceGroup> device_groups;
+};
+
+VkJsonInstance VkJsonGetInstance();
+std::string VkJsonInstanceToJson(const VkJsonInstance& instance);
+bool VkJsonInstanceFromJson(const std::string& json,
+ VkJsonInstance* instance,
+ std::string* errors);
+
+VkJsonDevice VkJsonGetDevice(VkPhysicalDevice device);
+std::string VkJsonDeviceToJson(const VkJsonDevice& device);
+bool VkJsonDeviceFromJson(const std::string& json,
+ VkJsonDevice* device,
+ std::string* errors);
+
+std::string VkJsonImageFormatPropertiesToJson(
+ const VkImageFormatProperties& properties);
+bool VkJsonImageFormatPropertiesFromJson(const std::string& json,
+ VkImageFormatProperties* properties,
+ std::string* errors);
+
+// Backward-compatibility aliases
+typedef VkJsonDevice VkJsonAllProperties;
+inline VkJsonAllProperties VkJsonGetAllProperties(
+ VkPhysicalDevice physicalDevice) {
+ return VkJsonGetDevice(physicalDevice);
+}
+inline std::string VkJsonAllPropertiesToJson(
+ const VkJsonAllProperties& properties) {
+ return VkJsonDeviceToJson(properties);
+}
+inline bool VkJsonAllPropertiesFromJson(const std::string& json,
+ VkJsonAllProperties* properties,
+ std::string* errors) {
+ return VkJsonDeviceFromJson(json, properties, errors);
+}
+
+#endif // VKJSON_H_""")
+
+ f.close()
+ gencom.run_clang_format(genfile)
+
+
+def generate_extension_struct_template():
+ """Generates templates for extensions
+ Example:
+ template <typename Visitor>
+ inline bool Iterate(Visitor* visitor, VkJsonKHRVariablePointers* structs) {
+ return visitor->Visit("variablePointerFeaturesKHR",
+ &structs->variable_pointer_features_khr) &&
+ visitor->Visit("variablePointersFeaturesKHR",
+ &structs->variable_pointers_features_khr);
+ }
+ """
+ template_code = []
+
+ for extension, struct_mappings in VK.VULKAN_EXTENSIONS_AND_STRUCTS_MAPPING["extensions"].items():
+ struct_type = get_vkjson_struct_name(extension)
+
+ template_code.append(f"template <typename Visitor>")
+ template_code.append(f"inline bool Iterate(Visitor* visitor, {struct_type}* structs) {{")
+ template_code.append(" return ")
+
+ visitor_calls = []
+ for struct_map in struct_mappings:
+ for struct_name in struct_map:
+ json_field_name = struct_name.replace("VkPhysicalDevice", "")
+ json_field_name = json_field_name[0].lower() + json_field_name[1:]
+
+ # Special case renaming
+ if json_field_name == "8BitStorageFeaturesKHR":
+ json_field_name = "bit8StorageFeaturesKHR"
+
+ visitor_calls.append(
+ f'visitor->Visit("{json_field_name}", &structs->{get_struct_name(struct_name)})'
+ )
+
+ template_code.append(" &&\n ".join(visitor_calls) + ";")
+ template_code.append("}\n")
+
+ return "\n".join(template_code)
+
+
+def generate_core_template():
+ """Generates templates for vulkan cores.
+ template <typename Visitor>
+ inline bool Iterate(Visitor* visitor, VkJsonCore11* core) {
+ return visitor->Visit("properties", &core->properties) &&
+ visitor->Visit("features", &core->features);
+ }
+ """
+ template_code = []
+
+ for version, struct_list in VK.VULKAN_CORES_AND_STRUCTS_MAPPING["versions"].items():
+ struct_type = f"VkJson{version}"
+
+ template_code.append(f"template <typename Visitor>")
+ template_code.append(f"inline bool Iterate(Visitor* visitor, {struct_type}* core) {{")
+ template_code.append(" return")
+
+ visitor_calls = []
+ for struct_map in struct_list:
+ for struct_name in struct_map:
+ member_name = "properties" if "Properties" in struct_name else "features"
+ visitor_calls.append(f'visitor->Visit("{member_name}", &core->{member_name})')
+
+ template_code.append(" &&\n ".join(visitor_calls) + ";")
+ template_code.append("}\n")
+
+ return "\n".join(template_code)
+
+
+def generate_struct_template(data_classes):
+ """Generates templates for all the structs
+ template <typename Visitor>
+ inline bool Iterate(Visitor* visitor,
+ VkPhysicalDevicePointClippingProperties* properties) {
+ return visitor->Visit("pointClippingBehavior",
+ &properties->pointClippingBehavior);
+ }
+ """
+ template_code = []
+ processed_classes = set() # Track processed class names
+
+ for dataclass_type in data_classes:
+ struct_name = dataclass_type.__name__
+
+ if struct_name in processed_classes:
+ continue # Skip already processed struct
+ processed_classes.add(struct_name)
+
+ struct_fields = dataclasses.fields(dataclass_type)
+ template_code.append("template <typename Visitor>")
+
+ # Determine the correct variable name based on the struct type
+ struct_var = "properties" if "Properties" in struct_name else "features" if "Features" in struct_name else "limits" if "Limits" in struct_name else None
+
+ if not struct_var:
+ continue # Skip structs that don't match expected patterns
+
+ template_code.append(f"inline bool Iterate(Visitor* visitor, {struct_name}* {struct_var}) {{")
+ template_code.append(f"return\n")
+
+ visitor_calls = []
+ for struct_field in struct_fields:
+ field_name = struct_field.name
+ field_type = struct_field.type
+
+ if get_origin(field_type) is list:
+ # Handle list types (VisitArray)
+ size_field_name = VK.LIST_TYPE_FIELD_AND_SIZE_MAPPING[field_name]
+ visitor_calls.append(f'visitor->VisitArray("{field_name}", {struct_var}->{size_field_name}, &{struct_var}->{field_name})')
+ else:
+ # Handle other types (Visit)
+ visitor_calls.append(f'visitor->Visit("{field_name}", &{struct_var}->{field_name})')
+
+ template_code.append(" &&\n ".join(visitor_calls) + ";")
+ template_code.append("}\n\n")
+
+ return "\n".join(template_code)
+
+
+def emit_struct_visits_by_vk_version(f, version):
+ """Emits visitor calls for Vulkan version structs
+ """
+ for struct_map in VK.VULKAN_VERSIONS_AND_STRUCTS_MAPPING[version]:
+ for struct_name, _ in struct_map.items():
+ struct_var = get_struct_name(struct_name)
+ # Converts struct_var from snake_case (e.g., point_clipping_properties)
+ # to camelCase (e.g., pointClippingProperties) for struct_display_name.
+ struct_display_name = re.sub(r"_([a-z])", lambda match: match.group(1).upper(), struct_var)
+ f.write(f'visitor->Visit("{struct_display_name}", &device->{struct_var}) &&\n')
+
+
+def gen_cc():
+ """Generates vkjson.cc file.
+ """
+ genfile = os.path.join(os.path.dirname(__file__),
+ "..", "vkjson", "vkjson.cc")
+
+ with open(genfile, "w") as f:
+
+ f.write(get_copyright_warnings())
+ f.write("\n")
+
+ f.write("""\
+#include "vkjson.h"
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <json/json.h>
+
+#include <algorithm>
+#include <cinttypes>
+#include <cmath>
+#include <cstdio>
+#include <limits>
+#include <memory>
+#include <sstream>
+#include <type_traits>
+#include <utility>
+
+/*
+ * This file is autogenerated by vkjson_generator.py. Do not edit directly.
+ */
+namespace {
+
+/*
+ * Annotation to tell clang that we intend to fall through from one case to
+ * another in a switch. Sourced from android-base/macros.h.
+ */
+#define FALLTHROUGH_INTENDED [[clang::fallthrough]]
+
+inline bool IsIntegral(double value) {
+#if defined(ANDROID)
+ // Android NDK doesn't provide std::trunc yet
+ return trunc(value) == value;
+#else
+ return std::trunc(value) == value;
+#endif
+}
+
+// Floating point fields of Vulkan structure use single precision. The string
+// output of max double value in c++ will be larger than Java double's infinity
+// value. Below fake double max/min values are only to serve the safe json text
+// parsing in between C++ and Java, because Java json library simply cannot
+// handle infinity.
+static const double SAFE_DOUBLE_MAX = 0.99 * std::numeric_limits<double>::max();
+static const double SAFE_DOUBLE_MIN = -SAFE_DOUBLE_MAX;
+
+template <typename T> struct EnumTraits;
+template <> struct EnumTraits<VkPhysicalDeviceType> {
+ static bool exist(uint32_t e) {
+ switch (e) {
+ case VK_PHYSICAL_DEVICE_TYPE_OTHER:
+ case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU:
+ case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU:
+ case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU:
+ case VK_PHYSICAL_DEVICE_TYPE_CPU:
+ return true;
+ }
+ return false;
+ }
+};
+
+template <> struct EnumTraits<VkFormat> {
+ static bool exist(uint32_t e) {
+ switch (e) {
+ case VK_FORMAT_UNDEFINED:
+ case VK_FORMAT_R4G4_UNORM_PACK8:
+ case VK_FORMAT_R4G4B4A4_UNORM_PACK16:
+ case VK_FORMAT_B4G4R4A4_UNORM_PACK16:
+ case VK_FORMAT_R5G6B5_UNORM_PACK16:
+ case VK_FORMAT_B5G6R5_UNORM_PACK16:
+ case VK_FORMAT_R5G5B5A1_UNORM_PACK16:
+ case VK_FORMAT_B5G5R5A1_UNORM_PACK16:
+ case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
+ case VK_FORMAT_R8_UNORM:
+ case VK_FORMAT_R8_SNORM:
+ case VK_FORMAT_R8_USCALED:
+ case VK_FORMAT_R8_SSCALED:
+ case VK_FORMAT_R8_UINT:
+ case VK_FORMAT_R8_SINT:
+ case VK_FORMAT_R8_SRGB:
+ case VK_FORMAT_R8G8_UNORM:
+ case VK_FORMAT_R8G8_SNORM:
+ case VK_FORMAT_R8G8_USCALED:
+ case VK_FORMAT_R8G8_SSCALED:
+ case VK_FORMAT_R8G8_UINT:
+ case VK_FORMAT_R8G8_SINT:
+ case VK_FORMAT_R8G8_SRGB:
+ case VK_FORMAT_R8G8B8_UNORM:
+ case VK_FORMAT_R8G8B8_SNORM:
+ case VK_FORMAT_R8G8B8_USCALED:
+ case VK_FORMAT_R8G8B8_SSCALED:
+ case VK_FORMAT_R8G8B8_UINT:
+ case VK_FORMAT_R8G8B8_SINT:
+ case VK_FORMAT_R8G8B8_SRGB:
+ case VK_FORMAT_B8G8R8_UNORM:
+ case VK_FORMAT_B8G8R8_SNORM:
+ case VK_FORMAT_B8G8R8_USCALED:
+ case VK_FORMAT_B8G8R8_SSCALED:
+ case VK_FORMAT_B8G8R8_UINT:
+ case VK_FORMAT_B8G8R8_SINT:
+ case VK_FORMAT_B8G8R8_SRGB:
+ case VK_FORMAT_R8G8B8A8_UNORM:
+ case VK_FORMAT_R8G8B8A8_SNORM:
+ case VK_FORMAT_R8G8B8A8_USCALED:
+ case VK_FORMAT_R8G8B8A8_SSCALED:
+ case VK_FORMAT_R8G8B8A8_UINT:
+ case VK_FORMAT_R8G8B8A8_SINT:
+ case VK_FORMAT_R8G8B8A8_SRGB:
+ case VK_FORMAT_B8G8R8A8_UNORM:
+ case VK_FORMAT_B8G8R8A8_SNORM:
+ case VK_FORMAT_B8G8R8A8_USCALED:
+ case VK_FORMAT_B8G8R8A8_SSCALED:
+ case VK_FORMAT_B8G8R8A8_UINT:
+ case VK_FORMAT_B8G8R8A8_SINT:
+ case VK_FORMAT_B8G8R8A8_SRGB:
+ case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
+ case VK_FORMAT_A8B8G8R8_SNORM_PACK32:
+ case VK_FORMAT_A8B8G8R8_USCALED_PACK32:
+ case VK_FORMAT_A8B8G8R8_SSCALED_PACK32:
+ case VK_FORMAT_A8B8G8R8_UINT_PACK32:
+ case VK_FORMAT_A8B8G8R8_SINT_PACK32:
+ case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
+ case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
+ case VK_FORMAT_A2R10G10B10_SNORM_PACK32:
+ case VK_FORMAT_A2R10G10B10_USCALED_PACK32:
+ case VK_FORMAT_A2R10G10B10_SSCALED_PACK32:
+ case VK_FORMAT_A2R10G10B10_UINT_PACK32:
+ case VK_FORMAT_A2R10G10B10_SINT_PACK32:
+ case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
+ case VK_FORMAT_A2B10G10R10_SNORM_PACK32:
+ case VK_FORMAT_A2B10G10R10_USCALED_PACK32:
+ case VK_FORMAT_A2B10G10R10_SSCALED_PACK32:
+ case VK_FORMAT_A2B10G10R10_UINT_PACK32:
+ case VK_FORMAT_A2B10G10R10_SINT_PACK32:
+ case VK_FORMAT_R16_UNORM:
+ case VK_FORMAT_R16_SNORM:
+ case VK_FORMAT_R16_USCALED:
+ case VK_FORMAT_R16_SSCALED:
+ case VK_FORMAT_R16_UINT:
+ case VK_FORMAT_R16_SINT:
+ case VK_FORMAT_R16_SFLOAT:
+ case VK_FORMAT_R16G16_UNORM:
+ case VK_FORMAT_R16G16_SNORM:
+ case VK_FORMAT_R16G16_USCALED:
+ case VK_FORMAT_R16G16_SSCALED:
+ case VK_FORMAT_R16G16_UINT:
+ case VK_FORMAT_R16G16_SINT:
+ case VK_FORMAT_R16G16_SFLOAT:
+ case VK_FORMAT_R16G16B16_UNORM:
+ case VK_FORMAT_R16G16B16_SNORM:
+ case VK_FORMAT_R16G16B16_USCALED:
+ case VK_FORMAT_R16G16B16_SSCALED:
+ case VK_FORMAT_R16G16B16_UINT:
+ case VK_FORMAT_R16G16B16_SINT:
+ case VK_FORMAT_R16G16B16_SFLOAT:
+ case VK_FORMAT_R16G16B16A16_UNORM:
+ case VK_FORMAT_R16G16B16A16_SNORM:
+ case VK_FORMAT_R16G16B16A16_USCALED:
+ case VK_FORMAT_R16G16B16A16_SSCALED:
+ case VK_FORMAT_R16G16B16A16_UINT:
+ case VK_FORMAT_R16G16B16A16_SINT:
+ case VK_FORMAT_R16G16B16A16_SFLOAT:
+ case VK_FORMAT_R32_UINT:
+ case VK_FORMAT_R32_SINT:
+ case VK_FORMAT_R32_SFLOAT:
+ case VK_FORMAT_R32G32_UINT:
+ case VK_FORMAT_R32G32_SINT:
+ case VK_FORMAT_R32G32_SFLOAT:
+ case VK_FORMAT_R32G32B32_UINT:
+ case VK_FORMAT_R32G32B32_SINT:
+ case VK_FORMAT_R32G32B32_SFLOAT:
+ case VK_FORMAT_R32G32B32A32_UINT:
+ case VK_FORMAT_R32G32B32A32_SINT:
+ case VK_FORMAT_R32G32B32A32_SFLOAT:
+ case VK_FORMAT_R64_UINT:
+ case VK_FORMAT_R64_SINT:
+ case VK_FORMAT_R64_SFLOAT:
+ case VK_FORMAT_R64G64_UINT:
+ case VK_FORMAT_R64G64_SINT:
+ case VK_FORMAT_R64G64_SFLOAT:
+ case VK_FORMAT_R64G64B64_UINT:
+ case VK_FORMAT_R64G64B64_SINT:
+ case VK_FORMAT_R64G64B64_SFLOAT:
+ case VK_FORMAT_R64G64B64A64_UINT:
+ case VK_FORMAT_R64G64B64A64_SINT:
+ case VK_FORMAT_R64G64B64A64_SFLOAT:
+ case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
+ case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
+ case VK_FORMAT_D16_UNORM:
+ case VK_FORMAT_X8_D24_UNORM_PACK32:
+ case VK_FORMAT_D32_SFLOAT:
+ case VK_FORMAT_S8_UINT:
+ case VK_FORMAT_D16_UNORM_S8_UINT:
+ case VK_FORMAT_D24_UNORM_S8_UINT:
+ case VK_FORMAT_D32_SFLOAT_S8_UINT:
+ case VK_FORMAT_BC1_RGB_UNORM_BLOCK:
+ case VK_FORMAT_BC1_RGB_SRGB_BLOCK:
+ case VK_FORMAT_BC1_RGBA_UNORM_BLOCK:
+ case VK_FORMAT_BC1_RGBA_SRGB_BLOCK:
+ case VK_FORMAT_BC2_UNORM_BLOCK:
+ case VK_FORMAT_BC2_SRGB_BLOCK:
+ case VK_FORMAT_BC3_UNORM_BLOCK:
+ case VK_FORMAT_BC3_SRGB_BLOCK:
+ case VK_FORMAT_BC4_UNORM_BLOCK:
+ case VK_FORMAT_BC4_SNORM_BLOCK:
+ case VK_FORMAT_BC5_UNORM_BLOCK:
+ case VK_FORMAT_BC5_SNORM_BLOCK:
+ case VK_FORMAT_BC6H_UFLOAT_BLOCK:
+ case VK_FORMAT_BC6H_SFLOAT_BLOCK:
+ case VK_FORMAT_BC7_UNORM_BLOCK:
+ case VK_FORMAT_BC7_SRGB_BLOCK:
+ case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:
+ case VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK:
+ case VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK:
+ case VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK:
+ case VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK:
+ case VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK:
+ case VK_FORMAT_EAC_R11_UNORM_BLOCK:
+ case VK_FORMAT_EAC_R11_SNORM_BLOCK:
+ case VK_FORMAT_EAC_R11G11_UNORM_BLOCK:
+ case VK_FORMAT_EAC_R11G11_SNORM_BLOCK:
+ case VK_FORMAT_ASTC_4x4_UNORM_BLOCK:
+ case VK_FORMAT_ASTC_4x4_SRGB_BLOCK:
+ case VK_FORMAT_ASTC_5x4_UNORM_BLOCK:
+ case VK_FORMAT_ASTC_5x4_SRGB_BLOCK:
+ case VK_FORMAT_ASTC_5x5_UNORM_BLOCK:
+ case VK_FORMAT_ASTC_5x5_SRGB_BLOCK:
+ case VK_FORMAT_ASTC_6x5_UNORM_BLOCK:
+ case VK_FORMAT_ASTC_6x5_SRGB_BLOCK:
+ case VK_FORMAT_ASTC_6x6_UNORM_BLOCK:
+ case VK_FORMAT_ASTC_6x6_SRGB_BLOCK:
+ case VK_FORMAT_ASTC_8x5_UNORM_BLOCK:
+ case VK_FORMAT_ASTC_8x5_SRGB_BLOCK:
+ case VK_FORMAT_ASTC_8x6_UNORM_BLOCK:
+ case VK_FORMAT_ASTC_8x6_SRGB_BLOCK:
+ case VK_FORMAT_ASTC_8x8_UNORM_BLOCK:
+ case VK_FORMAT_ASTC_8x8_SRGB_BLOCK:
+ case VK_FORMAT_ASTC_10x5_UNORM_BLOCK:
+ case VK_FORMAT_ASTC_10x5_SRGB_BLOCK:
+ case VK_FORMAT_ASTC_10x6_UNORM_BLOCK:
+ case VK_FORMAT_ASTC_10x6_SRGB_BLOCK:
+ case VK_FORMAT_ASTC_10x8_UNORM_BLOCK:
+ case VK_FORMAT_ASTC_10x8_SRGB_BLOCK:
+ case VK_FORMAT_ASTC_10x10_UNORM_BLOCK:
+ case VK_FORMAT_ASTC_10x10_SRGB_BLOCK:
+ case VK_FORMAT_ASTC_12x10_UNORM_BLOCK:
+ case VK_FORMAT_ASTC_12x10_SRGB_BLOCK:
+ case VK_FORMAT_ASTC_12x12_UNORM_BLOCK:
+ case VK_FORMAT_ASTC_12x12_SRGB_BLOCK:
+ case VK_FORMAT_G8B8G8R8_422_UNORM:
+ case VK_FORMAT_B8G8R8G8_422_UNORM:
+ case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM:
+ case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:
+ case VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM:
+ case VK_FORMAT_G8_B8R8_2PLANE_422_UNORM:
+ case VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM:
+ case VK_FORMAT_R10X6_UNORM_PACK16:
+ case VK_FORMAT_R10X6G10X6_UNORM_2PACK16:
+ case VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16:
+ case VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16:
+ case VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16:
+ case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16:
+ case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16:
+ case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16:
+ case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16:
+ case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16:
+ case VK_FORMAT_R12X4_UNORM_PACK16:
+ case VK_FORMAT_R12X4G12X4_UNORM_2PACK16:
+ case VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16:
+ case VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16:
+ case VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16:
+ case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16:
+ case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16:
+ case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16:
+ case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16:
+ case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16:
+ case VK_FORMAT_G16B16G16R16_422_UNORM:
+ case VK_FORMAT_B16G16R16G16_422_UNORM:
+ case VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM:
+ case VK_FORMAT_G16_B16R16_2PLANE_420_UNORM:
+ case VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM:
+ case VK_FORMAT_G16_B16R16_2PLANE_422_UNORM:
+ case VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM:
+ case VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG:
+ case VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG:
+ case VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG:
+ case VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG:
+ case VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG:
+ case VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG:
+ case VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG:
+ case VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG:
+ case VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT:
+ case VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT:
+ case VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT:
+ case VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT:
+ case VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT:
+ case VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT:
+ case VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT:
+ case VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT:
+ case VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT:
+ case VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT:
+ case VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT:
+ case VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT:
+ case VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT:
+ case VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT:
+ case VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT:
+ case VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT:
+ return true;
+ }
+ return false;
+ }
+};
+
+template <>
+struct EnumTraits<VkPointClippingBehavior> {
+ static bool exist(uint32_t e) {
+ switch (e) {
+ case VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES:
+ case VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY:
+ return true;
+ }
+ return false;
+ }
+};
+
+template <>
+struct EnumTraits<VkExternalFenceHandleTypeFlagBits> {
+ static bool exist(uint32_t e) {
+ switch (e) {
+ case VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT:
+ case VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT:
+ case VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT:
+ case VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT:
+ return true;
+ }
+ return false;
+ }
+};
+
+template <>
+struct EnumTraits<VkExternalSemaphoreHandleTypeFlagBits> {
+ static bool exist(uint32_t e) {
+ switch (e) {
+ case VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT:
+ case VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT:
+ case VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT:
+ case VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT:
+ case VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT:
+ return true;
+ }
+ return false;
+ }
+};
+
+template <>
+struct EnumTraits<VkDriverIdKHR> {
+ static bool exist(uint32_t e) {
+ switch (e) {
+ case VK_DRIVER_ID_AMD_PROPRIETARY:
+ case VK_DRIVER_ID_AMD_OPEN_SOURCE:
+ case VK_DRIVER_ID_MESA_RADV:
+ case VK_DRIVER_ID_NVIDIA_PROPRIETARY:
+ case VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS:
+ case VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA:
+ case VK_DRIVER_ID_IMAGINATION_PROPRIETARY:
+ case VK_DRIVER_ID_QUALCOMM_PROPRIETARY:
+ case VK_DRIVER_ID_ARM_PROPRIETARY:
+ case VK_DRIVER_ID_GOOGLE_SWIFTSHADER:
+ case VK_DRIVER_ID_GGP_PROPRIETARY:
+ case VK_DRIVER_ID_BROADCOM_PROPRIETARY:
+ case VK_DRIVER_ID_MESA_LLVMPIPE:
+ case VK_DRIVER_ID_MOLTENVK:
+ return true;
+ }
+ return false;
+ }
+};
+
+template <>
+struct EnumTraits<VkShaderFloatControlsIndependence> {
+ static bool exist(uint32_t e) {
+ switch (e) {
+ case VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY:
+ case VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL:
+ case VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE:
+ return true;
+ }
+ return false;
+ }
+};
+
+template <>
+struct EnumTraits<VkPipelineRobustnessBufferBehavior> {
+ static bool exist(uint32_t e) {
+ switch (e) {
+ case VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DEVICE_DEFAULT:
+ case VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DISABLED:
+ case VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS:
+ case VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_2:
+ return true;
+ }
+ return false;
+ }
+};
+
+template <>
+struct EnumTraits<VkPipelineRobustnessImageBehavior> {
+ static bool exist(uint32_t e) {
+ switch (e) {
+ case VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_DEVICE_DEFAULT:
+ case VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_DISABLED:
+ case VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_ROBUST_IMAGE_ACCESS:
+ case VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_ROBUST_IMAGE_ACCESS_2:
+ return true;
+ }
+ return false;
+ }
+};
+
+template <>
+struct EnumTraits<VkImageLayout> {
+ static bool exist(uint32_t e) {
+ switch (e) {
+ case VK_IMAGE_LAYOUT_UNDEFINED:
+ case VK_IMAGE_LAYOUT_GENERAL:
+ case VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL:
+ case VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL:
+ case VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL:
+ case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL:
+ case VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL:
+ case VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL:
+ case VK_IMAGE_LAYOUT_PREINITIALIZED:
+ case VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL:
+ case VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL:
+ case VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL:
+ case VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL:
+ case VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL:
+ case VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL:
+ case VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL:
+ case VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL:
+ case VK_IMAGE_LAYOUT_PRESENT_SRC_KHR:
+ case VK_IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR:
+ case VK_IMAGE_LAYOUT_VIDEO_DECODE_SRC_KHR:
+ case VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR:
+ case VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR:
+ case VK_IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL_EXT:
+ case VK_IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR:
+#ifdef VK_ENABLE_BETA_EXTENSIONS
+ case VK_IMAGE_LAYOUT_VIDEO_ENCODE_DST_KHR:
+#endif
+#ifdef VK_ENABLE_BETA_EXTENSIONS
+ case VK_IMAGE_LAYOUT_VIDEO_ENCODE_SRC_KHR:
+#endif
+#ifdef VK_ENABLE_BETA_EXTENSIONS
+ case VK_IMAGE_LAYOUT_VIDEO_ENCODE_DPB_KHR:
+#endif
+ case VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT:
+ return true;
+ }
+ return false;
+ }
+};
+
+// VkSparseImageFormatProperties
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkExtent3D* extents) {
+ return
+ visitor->Visit("width", &extents->width) &&
+ visitor->Visit("height", &extents->height) &&
+ visitor->Visit("depth", &extents->depth);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkConformanceVersionKHR* version) {
+ return visitor->Visit("major", &version->major) &&
+ visitor->Visit("minor", &version->minor) &&
+ visitor->Visit("subminor", &version->subminor) &&
+ visitor->Visit("patch", &version->patch);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkMemoryType* type) {
+ return
+ visitor->Visit("propertyFlags", &type->propertyFlags) &&
+ visitor->Visit("heapIndex", &type->heapIndex);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkMemoryHeap* heap) {
+ return
+ visitor->Visit("size", &heap->size) &&
+ visitor->Visit("flags", &heap->flags);
+}\n\n""")
+
+ f.write(f"{generate_core_template()}\n\n{generate_extension_struct_template()}\n\n")
+ f.write(generate_struct_template(VK.ALL_STRUCTS))
+
+ f.write("""\
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkExternalFenceProperties* properties) {
+ return visitor->Visit("exportFromImportedHandleTypes",
+ &properties->exportFromImportedHandleTypes) &&
+ visitor->Visit("compatibleHandleTypes",
+ &properties->compatibleHandleTypes) &&
+ visitor->Visit("externalFenceFeatures",
+ &properties->externalFenceFeatures);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkExternalSemaphoreProperties* properties) {
+ return visitor->Visit("exportFromImportedHandleTypes",
+ &properties->exportFromImportedHandleTypes) &&
+ visitor->Visit("compatibleHandleTypes",
+ &properties->compatibleHandleTypes) &&
+ visitor->Visit("externalSemaphoreFeatures",
+ &properties->externalSemaphoreFeatures);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonLayer* layer) {
+ return visitor->Visit("properties", &layer->properties) &&
+ visitor->Visit("extensions", &layer->extensions);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonDeviceGroup* device_group) {
+ return visitor->Visit("devices", &device_group->device_inds) &&
+ visitor->Visit("subsetAllocation",
+ &device_group->properties.subsetAllocation);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonDevice* device) {
+ bool ret = true;
+ switch (device->properties.apiVersion ^
+ VK_API_VERSION_PATCH(device->properties.apiVersion)) {
+ case VK_API_VERSION_1_4:
+ ret &= visitor->Visit("core14", &device->core14);
+ FALLTHROUGH_INTENDED;
+ case VK_API_VERSION_1_3:
+ ret &= visitor->Visit("core13", &device->core13);
+ FALLTHROUGH_INTENDED;
+ case VK_API_VERSION_1_2:
+ ret &= visitor->Visit("core11", &device->core11);
+ ret &= visitor->Visit("core12", &device->core12);
+ FALLTHROUGH_INTENDED;
+ case VK_API_VERSION_1_1:
+ ret &=\n""")
+
+ emit_struct_visits_by_vk_version(f, "VK_VERSION_1_1")
+
+ f.write("""\
+ visitor->Visit("externalFenceProperties",
+ &device->external_fence_properties) &&
+ visitor->Visit("externalSemaphoreProperties",
+ &device->external_semaphore_properties);
+ FALLTHROUGH_INTENDED;
+ case VK_API_VERSION_1_0:
+ ret &=\n""")
+
+ emit_struct_visits_by_vk_version(f, "VK_VERSION_1_0")
+
+ f.write("""\
+ visitor->Visit("queues", &device->queues) &&
+ visitor->Visit("extensions", &device->extensions) &&
+ visitor->Visit("layers", &device->layers) &&
+ visitor->Visit("formats", &device->formats);\n\n""")
+
+ for extension_name, _ in VK.VULKAN_EXTENSIONS_AND_STRUCTS_MAPPING["extensions"].items():
+ struct_var = get_vkjson_struct_variable_name(extension_name)
+ f.write(f" if (device->{struct_var}.reported) {{\n")
+ f.write(f" ret &= visitor->Visit(\"{extension_name}\", &device->{struct_var});\n")
+ f.write(" }\n")
+
+ f.write("""\
+ } return ret; }
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonInstance* instance) {
+ bool ret = true;
+ switch (instance->api_version ^ VK_API_VERSION_PATCH(instance->api_version)) {
+ case VK_API_VERSION_1_4:
+ FALLTHROUGH_INTENDED;
+ case VK_API_VERSION_1_3:
+ FALLTHROUGH_INTENDED;
+ case VK_API_VERSION_1_2:
+ ret &= visitor->Visit("apiVersion", &instance->api_version);
+ FALLTHROUGH_INTENDED;
+ case VK_API_VERSION_1_1:
+ ret &= visitor->Visit("deviceGroups", &instance->device_groups);
+ FALLTHROUGH_INTENDED;
+ case VK_API_VERSION_1_0:
+ char depString[] =
+ "vkjson is deprecated, and will be replaced in a future release";
+ ret &= visitor->Visit("layers", &instance->layers) &&
+ visitor->Visit("extensions", &instance->extensions) &&
+ visitor->Visit("devices", &instance->devices) &&
+ visitor->Visit("_comment", &depString);
+ }
+ return ret;
+}
+
+template <typename T>
+using EnableForArithmetic =
+ typename std::enable_if<std::is_arithmetic<T>::value, void>::type;
+
+template <typename T>
+using EnableForStruct =
+ typename std::enable_if<std::is_class<T>::value, void>::type;
+
+template <typename T>
+using EnableForEnum =
+ typename std::enable_if<std::is_enum<T>::value, void>::type;
+
+template <typename T, typename = EnableForStruct<T>, typename = void>
+Json::Value ToJsonValue(const T& value);
+
+template <typename T, typename = EnableForArithmetic<T>>
+inline Json::Value ToJsonValue(const T& value) {
+ return Json::Value(
+ std::clamp(static_cast<double>(value), SAFE_DOUBLE_MIN, SAFE_DOUBLE_MAX));
+}
+
+inline Json::Value ToJsonValue(const uint64_t& value) {
+ char string[19] = {0}; // "0x" + 16 digits + terminal \\0
+ snprintf(string, sizeof(string), "0x%016" PRIx64, value);
+ return Json::Value(string);
+}
+
+template <typename T, typename = EnableForEnum<T>, typename = void,
+ typename = void>
+inline Json::Value ToJsonValue(const T& value) {
+ return Json::Value(static_cast<double>(value));
+}
+
+template <typename T>
+inline Json::Value ArrayToJsonValue(uint32_t count, const T* values) {
+ Json::Value array(Json::arrayValue);
+ for (unsigned int i = 0; i < count; ++i) array.append(ToJsonValue(values[i]));
+ return array;
+}
+
+template <typename T, size_t N>
+inline Json::Value ToJsonValue(const T (&value)[N]) {
+ return ArrayToJsonValue(N, value);
+}
+
+template <size_t N>
+inline Json::Value ToJsonValue(const char (&value)[N]) {
+ assert(strlen(value) < N);
+ return Json::Value(value);
+}
+
+template <typename T>
+inline Json::Value ToJsonValue(const std::vector<T>& value) {
+ assert(value.size() <= std::numeric_limits<uint32_t>::max());
+ return ArrayToJsonValue(static_cast<uint32_t>(value.size()), value.data());
+}
+
+template <typename F, typename S>
+inline Json::Value ToJsonValue(const std::pair<F, S>& value) {
+ Json::Value array(Json::arrayValue);
+ array.append(ToJsonValue(value.first));
+ array.append(ToJsonValue(value.second));
+ return array;
+}
+
+template <typename F, typename S>
+inline Json::Value ToJsonValue(const std::map<F, S>& value) {
+ Json::Value array(Json::arrayValue);
+ for (auto& kv : value) array.append(ToJsonValue(kv));
+ return array;
+}
+
+class JsonWriterVisitor {
+ public:
+ JsonWriterVisitor() : object_(Json::objectValue) {}
+
+ ~JsonWriterVisitor() {}
+
+ template <typename T> bool Visit(const char* key, const T* value) {
+ object_[key] = ToJsonValue(*value);
+ return true;
+ }
+
+ template <typename T, uint32_t N>
+ bool VisitArray(const char* key, uint32_t count, const T (*value)[N]) {
+ assert(count <= N);
+ object_[key] = ArrayToJsonValue(count, *value);
+ return true;
+ }
+
+ template <typename T>
+ bool VisitArray(const char* key, uint32_t count, const T *value) {
+ object_[key] = ArrayToJsonValue(count, *value);
+ return true;
+ }
+
+ Json::Value get_object() const { return object_; }
+
+ private:
+ Json::Value object_;
+};
+
+template <typename Visitor, typename T>
+inline void VisitForWrite(Visitor* visitor, const T& t) {
+ Iterate(visitor, const_cast<T*>(&t));
+}
+
+template <typename T, typename /*= EnableForStruct<T>*/, typename /*= void*/>
+Json::Value ToJsonValue(const T& value) {
+ JsonWriterVisitor visitor;
+ VisitForWrite(&visitor, value);
+ return visitor.get_object();
+}
+
+template <typename T, typename = EnableForStruct<T>>
+bool AsValue(Json::Value* json_value, T* t);
+
+inline bool AsValue(Json::Value* json_value, int32_t* value) {
+ if (json_value->type() != Json::realValue) return false;
+ double d = json_value->asDouble();
+ if (!IsIntegral(d) ||
+ d < static_cast<double>(std::numeric_limits<int32_t>::min()) ||
+ d > static_cast<double>(std::numeric_limits<int32_t>::max()))
+ return false;
+ *value = static_cast<int32_t>(d);
+ return true;
+}
+
+inline bool AsValue(Json::Value* json_value, uint64_t* value) {
+ if (json_value->type() != Json::stringValue) return false;
+ int result =
+ std::sscanf(json_value->asString().c_str(), "0x%016" PRIx64, value);
+ return result == 1;
+}
+
+inline bool AsValue(Json::Value* json_value, uint32_t* value) {
+ if (json_value->type() != Json::realValue) return false;
+ double d = json_value->asDouble();
+ if (!IsIntegral(d) || d < 0.0 ||
+ d > static_cast<double>(std::numeric_limits<uint32_t>::max()))
+ return false;
+ *value = static_cast<uint32_t>(d);
+ return true;
+}
+
+inline bool AsValue(Json::Value* json_value, uint8_t* value) {
+ uint32_t value32 = 0;
+ AsValue(json_value, &value32);
+ if (value32 > std::numeric_limits<uint8_t>::max())
+ return false;
+ *value = static_cast<uint8_t>(value32);
+ return true;
+}
+
+inline bool AsValue(Json::Value* json_value, float* value) {
+ if (json_value->type() != Json::realValue) return false;
+ *value = static_cast<float>(json_value->asDouble());
+ return true;
+}
+
+inline bool AsValue(Json::Value* json_value, VkImageLayout* t) {
+ uint32_t value = 0;
+ if (!AsValue(json_value, &value))
+ return false;
+ if (!EnumTraits<VkImageLayout>::exist(value)) return false;
+ *t = static_cast<VkImageLayout>(value);
+ return true;
+}
+
+template <typename T>
+inline bool AsArray(Json::Value* json_value, uint32_t count, T* values) {
+ if (json_value->type() != Json::arrayValue || json_value->size() != count)
+ return false;
+ for (uint32_t i = 0; i < count; ++i) {
+ if (!AsValue(&(*json_value)[i], values + i)) return false;
+ }
+ return true;
+}
+
+template <typename T, size_t N>
+inline bool AsValue(Json::Value* json_value, T (*value)[N]) {
+ return AsArray(json_value, N, *value);
+}
+
+template <size_t N>
+inline bool AsValue(Json::Value* json_value, char (*value)[N]) {
+ if (json_value->type() != Json::stringValue) return false;
+ size_t len = json_value->asString().length();
+ if (len >= N)
+ return false;
+ memcpy(*value, json_value->asString().c_str(), len);
+ memset(*value + len, 0, N-len);
+ return true;
+}
+
+template <typename T, typename = EnableForEnum<T>, typename = void>
+inline bool AsValue(Json::Value* json_value, T* t) {
+ uint32_t value = 0;
+ if (!AsValue(json_value, &value))
+ return false;
+ if (!EnumTraits<T>::exist(value)) return false;
+ *t = static_cast<T>(value);
+ return true;
+}
+
+template <typename T>
+inline bool AsValue(Json::Value* json_value, std::vector<T>* value) {
+ if (json_value->type() != Json::arrayValue) return false;
+ int size = json_value->size();
+ value->resize(size);
+ return AsArray(json_value, size, value->data());
+}
+
+template <typename F, typename S>
+inline bool AsValue(Json::Value* json_value, std::pair<F, S>* value) {
+ if (json_value->type() != Json::arrayValue || json_value->size() != 2)
+ return false;
+ return AsValue(&(*json_value)[0], &value->first) &&
+ AsValue(&(*json_value)[1], &value->second);
+}
+
+template <typename F, typename S>
+inline bool AsValue(Json::Value* json_value, std::map<F, S>* value) {
+ if (json_value->type() != Json::arrayValue) return false;
+ int size = json_value->size();
+ for (int i = 0; i < size; ++i) {
+ std::pair<F, S> elem;
+ if (!AsValue(&(*json_value)[i], &elem)) return false;
+ if (!value->insert(elem).second)
+ return false;
+ }
+ return true;
+}
+
+template <typename T>
+bool ReadValue(Json::Value* object, const char* key, T* value,
+ std::string* errors) {
+ Json::Value json_value = (*object)[key];
+ if (!json_value) {
+ if (errors)
+ *errors = std::string(key) + " missing.";
+ return false;
+ }
+ if (AsValue(&json_value, value)) return true;
+ if (errors)
+ *errors = std::string("Wrong type for ") + std::string(key) + ".";
+ return false;
+}
+
+template <typename Visitor, typename T>
+inline bool VisitForRead(Visitor* visitor, T* t) {
+ return Iterate(visitor, t);
+}
+
+class JsonReaderVisitor {
+ public:
+ JsonReaderVisitor(Json::Value* object, std::string* errors)
+ : object_(object), errors_(errors) {}
+
+ template <typename T> bool Visit(const char* key, T* value) const {
+ return ReadValue(object_, key, value, errors_);
+ }
+
+ template <typename T, uint32_t N>
+ bool VisitArray(const char* key, uint32_t count, T (*value)[N]) {
+ if (count > N)
+ return false;
+ Json::Value json_value = (*object_)[key];
+ if (!json_value) {
+ if (errors_)
+ *errors_ = std::string(key) + " missing.";
+ return false;
+ }
+ if (AsArray(&json_value, count, *value)) return true;
+ if (errors_)
+ *errors_ = std::string("Wrong type for ") + std::string(key) + ".";
+ return false;
+ }
+
+ template <typename T>
+ bool VisitArray(const char* key, uint32_t count, T *value) {
+ Json::Value json_value = (*object_)[key];
+ if (!json_value) {
+ if (errors_)
+ *errors_ = std::string(key) + " missing.";
+ return false;
+ }
+ if (AsArray(&json_value, count, *value)) return true;
+ if (errors_)
+ *errors_ = std::string("Wrong type for ") + std::string(key) + ".";
+ return false;
+ }
+
+
+ private:
+ Json::Value* object_;
+ std::string* errors_;
+};
+
+template <typename T, typename /*= EnableForStruct<T>*/>
+bool AsValue(Json::Value* json_value, T* t) {
+ if (json_value->type() != Json::objectValue) return false;
+ JsonReaderVisitor visitor(json_value, nullptr);
+ return VisitForRead(&visitor, t);
+}
+
+
+template <typename T> std::string VkTypeToJson(const T& t) {
+ JsonWriterVisitor visitor;
+ VisitForWrite(&visitor, t);
+ return visitor.get_object().toStyledString();
+}
+
+template <typename T> bool VkTypeFromJson(const std::string& json,
+ T* t,
+ std::string* errors) {
+ *t = T();
+ Json::Value object(Json::objectValue);
+ Json::CharReaderBuilder builder;
+ builder["collectComments"] = false;
+ std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
+ if (!reader->parse(json.data(), json.data() + json.size(), &object, errors)) {
+ return false;
+ }
+ return AsValue(&object, t);
+}
+
+} // anonymous namespace
+
+std::string VkJsonInstanceToJson(const VkJsonInstance& instance) {
+ return VkTypeToJson(instance);
+}
+
+bool VkJsonInstanceFromJson(const std::string& json,
+ VkJsonInstance* instance,
+ std::string* errors) {
+ return VkTypeFromJson(json, instance, errors);
+}
+
+std::string VkJsonDeviceToJson(const VkJsonDevice& device) {
+ return VkTypeToJson(device);
+}
+
+bool VkJsonDeviceFromJson(const std::string& json,
+ VkJsonDevice* device,
+ std::string* errors) {
+ return VkTypeFromJson(json, device, errors);
+};
+
+std::string VkJsonImageFormatPropertiesToJson(
+ const VkImageFormatProperties& properties) {
+ return VkTypeToJson(properties);
+}
+
+bool VkJsonImageFormatPropertiesFromJson(const std::string& json,
+ VkImageFormatProperties* properties,
+ std::string* errors) {
+ return VkTypeFromJson(json, properties, errors);
+};
+""")
+ f.close()
+ gencom.run_clang_format(genfile)
+
+
+def generate_vk_core_structs_init_code(version):
+ """Generates code to initialize properties and features
+ for structs based on its vulkan API version dependency.
+ """
+ properties_code, features_code = [], []
+
+ for item in VK.VULKAN_CORES_AND_STRUCTS_MAPPING["versions"].get(version, []):
+ for struct_name, struct_type in item.items():
+ version_lower = version.lower()
+
+ if "Properties" in struct_name:
+ properties_code.extend([
+ f"device.{version_lower}.properties.sType = {struct_type};",
+ f"device.{version_lower}.properties.pNext = properties.pNext;",
+ f"properties.pNext = &device.{version_lower}.properties;\n\n"
+ ])
+
+ elif "Features" in struct_name:
+ features_code.extend([
+ f"device.{version_lower}.features.sType = {struct_type};",
+ f"device.{version_lower}.features.pNext = features.pNext;",
+ f"features.pNext = &device.{version_lower}.features;\n\n"
+ ])
+
+ return "\n".join(properties_code), "\n".join(features_code)
+
+
+def generate_vk_extension_structs_init_code(mapping, struct_category, next_pointer):
+ """Generates Vulkan struct initialization code for given struct category (Properties/Features)
+ based on its extension dependency.
+ """
+ generated_code = []
+
+ for extension, struct_mappings in mapping.items():
+ struct_var_name = get_vkjson_struct_variable_name(extension)
+ extension_code = [
+ f" if (HasExtension(\"{extension}\", device.extensions)) {{",
+ f" device.{struct_var_name}.reported = true;"
+ ]
+
+ struct_count = 0
+ for struct_mapping in struct_mappings:
+ for struct_name, struct_type in struct_mapping.items():
+ if struct_category in struct_name:
+ struct_count += 1
+ struct_instance = get_struct_name(struct_name)
+ extension_code.extend([
+ f" device.{struct_var_name}.{struct_instance}.sType = {struct_type};",
+ f" device.{struct_var_name}.{struct_instance}.pNext = {next_pointer}.pNext;",
+ f" {next_pointer}.pNext = &device.{struct_var_name}.{struct_instance};"
+ ])
+
+ extension_code.append(" }\n")
+
+ if struct_count > 0:
+ generated_code.extend(extension_code)
+
+ return "\n".join(generated_code)
+
+
+def generate_vk_version_structs_initialization(version_data, struct_type_keyword, next_pointer):
+ """Generates Vulkan struct initialization code for given struct category (Properties/Features)
+ of vulkan api version s.
+ """
+ struct_initialization_code = []
+
+ for struct_mapping in version_data:
+ for struct_name, struct_type in struct_mapping.items():
+ if struct_type_keyword in struct_name:
+ struct_variable = get_struct_name(struct_name)
+ struct_initialization_code.extend([
+ f"device.{struct_variable}.sType = {struct_type};",
+ f"device.{struct_variable}.pNext = {next_pointer}.pNext;",
+ f"{next_pointer}.pNext = &device.{struct_variable};\n"
+ ])
+
+ return "\n".join(struct_initialization_code)
+
+
+def gen_instance_cc():
+ """Generates vkjson_instance.cc file.
+ """
+ genfile = os.path.join(os.path.dirname(__file__),
+ "..", "vkjson", "vkjson_instance.cc")
+
+ with open(genfile, "w") as f:
+ f.write(get_copyright_warnings())
+ f.write("\n")
+
+ f.write("""\
+#ifndef VK_PROTOTYPES
+#define VK_PROTOTYPES
+#endif
+
+#include "vkjson.h"
+
+#include <algorithm>
+#include <utility>
+
+/*
+ * This file is autogenerated by vkjson_generator.py. Do not edit directly.
+ */
+namespace {
+
+bool EnumerateExtensions(const char* layer_name,
+ std::vector<VkExtensionProperties>* extensions) {
+ VkResult result;
+ uint32_t count = 0;
+ result = vkEnumerateInstanceExtensionProperties(layer_name, &count, nullptr);
+ if (result != VK_SUCCESS)
+ return false;
+ extensions->resize(count);
+ result = vkEnumerateInstanceExtensionProperties(layer_name, &count,
+ extensions->data());
+ if (result != VK_SUCCESS)
+ return false;
+ return true;
+}
+
+bool HasExtension(const char* extension_name,
+ const std::vector<VkExtensionProperties>& extensions) {
+ return std::find_if(extensions.cbegin(), extensions.cend(),
+ [extension_name](const VkExtensionProperties& extension) {
+ return strcmp(extension.extensionName,
+ extension_name) == 0;
+ }) != extensions.cend();
+}
+} // anonymous namespace
+
+VkJsonDevice VkJsonGetDevice(VkPhysicalDevice physical_device) {
+ VkJsonDevice device;
+
+ uint32_t extension_count = 0;
+ vkEnumerateDeviceExtensionProperties(physical_device, nullptr,
+ &extension_count, nullptr);
+ if (extension_count > 0) {
+ device.extensions.resize(extension_count);
+ vkEnumerateDeviceExtensionProperties(
+ physical_device, nullptr, &extension_count, device.extensions.data());
+ }
+
+ uint32_t layer_count = 0;
+ vkEnumerateDeviceLayerProperties(physical_device, &layer_count, nullptr);
+ if (layer_count > 0) {
+ device.layers.resize(layer_count);
+ vkEnumerateDeviceLayerProperties(physical_device, &layer_count,
+ device.layers.data());
+ }
+
+ VkPhysicalDeviceProperties2 properties = {
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2,
+ nullptr,
+ {},
+ };\n\n""")
+
+ cc_code_properties = generate_vk_extension_structs_init_code(
+ VK.VULKAN_EXTENSIONS_AND_STRUCTS_MAPPING["extensions"], "Properties", "properties"
+ )
+ f.write(f'{cc_code_properties}\n')
+
+ f.write("""\
+
+ vkGetPhysicalDeviceProperties2(physical_device, &properties);
+ device.properties = properties.properties;
+
+ VkPhysicalDeviceFeatures2 features = {
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
+ nullptr,
+ {},
+ };\n\n""")
+
+ cc_code_features = generate_vk_extension_structs_init_code(
+ VK.VULKAN_EXTENSIONS_AND_STRUCTS_MAPPING["extensions"], "Features", "features"
+ )
+ f.write(f'{cc_code_features}\n')
+
+ f.write("""\
+
+ vkGetPhysicalDeviceFeatures2(physical_device, &features);
+ device.features = features.features;
+
+ vkGetPhysicalDeviceMemoryProperties(physical_device, &device.memory);
+
+ uint32_t queue_family_count = 0;
+ vkGetPhysicalDeviceQueueFamilyProperties(physical_device, &queue_family_count,
+ nullptr);
+ if (queue_family_count > 0) {
+ device.queues.resize(queue_family_count);
+ vkGetPhysicalDeviceQueueFamilyProperties(
+ physical_device, &queue_family_count, device.queues.data());
+ }
+
+ VkFormatProperties format_properties = {};
+ for (VkFormat format = VK_FORMAT_R4G4_UNORM_PACK8;
+ // TODO(http://b/171403054): avoid hard-coding last value in the
+ // contiguous range
+ format <= VK_FORMAT_ASTC_12x12_SRGB_BLOCK;
+ format = static_cast<VkFormat>(format + 1)) {
+ vkGetPhysicalDeviceFormatProperties(physical_device, format,
+ &format_properties);
+ if (format_properties.linearTilingFeatures ||
+ format_properties.optimalTilingFeatures ||
+ format_properties.bufferFeatures) {
+ device.formats.insert(std::make_pair(format, format_properties));
+ }
+ }
+
+ if (device.properties.apiVersion >= VK_API_VERSION_1_1) {
+ for (VkFormat format = VK_FORMAT_G8B8G8R8_422_UNORM;
+ // TODO(http://b/171403054): avoid hard-coding last value in the
+ // contiguous range
+ format <= VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM;
+ format = static_cast<VkFormat>(format + 1)) {
+ vkGetPhysicalDeviceFormatProperties(physical_device, format,
+ &format_properties);
+ if (format_properties.linearTilingFeatures ||
+ format_properties.optimalTilingFeatures ||
+ format_properties.bufferFeatures) {
+ device.formats.insert(std::make_pair(format, format_properties));
+ }
+ }\n\n""")
+
+ # Vulkan version data for VK_VERSION_1_1
+ vk_version_data = VK.VULKAN_VERSIONS_AND_STRUCTS_MAPPING["VK_VERSION_1_1"]
+ f.write(generate_vk_version_structs_initialization(vk_version_data, "Properties", "properties") + "\n")
+
+ f.write("""\
+ vkGetPhysicalDeviceProperties2(physical_device, &properties);\n\n""")
+
+ features_initialization_code = generate_vk_version_structs_initialization(vk_version_data, "Features", "features")
+ f.write(features_initialization_code)
+
+ f.write("""\
+
+ vkGetPhysicalDeviceFeatures2(physical_device, &features);
+
+ VkPhysicalDeviceExternalFenceInfo external_fence_info = {
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO, nullptr,
+ VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT};
+ VkExternalFenceProperties external_fence_properties = {};
+
+ for (VkExternalFenceHandleTypeFlagBits handle_type =
+ VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT;
+ handle_type <= VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT;
+ handle_type =
+ static_cast<VkExternalFenceHandleTypeFlagBits>(handle_type << 1)) {
+ external_fence_info.handleType = handle_type;
+ vkGetPhysicalDeviceExternalFenceProperties(
+ physical_device, &external_fence_info, &external_fence_properties);
+ if (external_fence_properties.exportFromImportedHandleTypes ||
+ external_fence_properties.compatibleHandleTypes ||
+ external_fence_properties.externalFenceFeatures) {
+ device.external_fence_properties.insert(
+ std::make_pair(handle_type, external_fence_properties));
+ }
+ }
+
+ VkPhysicalDeviceExternalSemaphoreInfo external_semaphore_info = {
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO, nullptr,
+ VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT};
+ VkExternalSemaphoreProperties external_semaphore_properties = {};
+
+ for (VkExternalSemaphoreHandleTypeFlagBits handle_type =
+ VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT;
+ handle_type <= VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT;
+ handle_type = static_cast<VkExternalSemaphoreHandleTypeFlagBits>(
+ handle_type << 1)) {
+ external_semaphore_info.handleType = handle_type;
+ vkGetPhysicalDeviceExternalSemaphoreProperties(
+ physical_device, &external_semaphore_info,
+ &external_semaphore_properties);
+ if (external_semaphore_properties.exportFromImportedHandleTypes ||
+ external_semaphore_properties.compatibleHandleTypes ||
+ external_semaphore_properties.externalSemaphoreFeatures) {
+ device.external_semaphore_properties.insert(
+ std::make_pair(handle_type, external_semaphore_properties));
+ }
+ }
+ }
+
+ if (device.properties.apiVersion >= VK_API_VERSION_1_2) {\n""")
+
+ cc_code_properties_11, cc_code_features_11 = generate_vk_core_structs_init_code("Core11")
+ cc_code_properties_12, cc_code_features_12 = generate_vk_core_structs_init_code("Core12")
+ cc_code_properties_13, cc_code_features_13 = generate_vk_core_structs_init_code("Core13")
+ cc_code_properties_14, cc_code_features_14 = generate_vk_core_structs_init_code("Core14")
+
+ f.write(cc_code_properties_11)
+ f.write(cc_code_properties_12)
+ f.write(f"vkGetPhysicalDeviceProperties2(physical_device, &properties);\n\n")
+ f.write(cc_code_features_11)
+ f.write(cc_code_features_12)
+ f.write(f"vkGetPhysicalDeviceFeatures2(physical_device, &features);\n\n")
+ f.write("""\
+ }
+
+ if (device.properties.apiVersion >= VK_API_VERSION_1_3) {\n""")
+ f.write(cc_code_properties_13)
+ f.write(f"vkGetPhysicalDeviceProperties2(physical_device, &properties);\n\n")
+ f.write(cc_code_features_13)
+ f.write(f"vkGetPhysicalDeviceFeatures2(physical_device, &features);\n\n")
+ f.write("""\
+ }
+
+ if (device.properties.apiVersion >= VK_API_VERSION_1_4) {\n""")
+ f.write(cc_code_properties_14)
+ f.write(f"vkGetPhysicalDeviceProperties2(physical_device, &properties);\n\n")
+ f.write(cc_code_features_14)
+ f.write(f"vkGetPhysicalDeviceFeatures2(physical_device, &features);\n\n")
+ f.write("""\
+ }
+
+ return device;
+}
+
+VkJsonInstance VkJsonGetInstance() {
+ VkJsonInstance instance;
+ VkResult result;
+ uint32_t count;
+
+ count = 0;
+ result = vkEnumerateInstanceLayerProperties(&count, nullptr);
+ if (result != VK_SUCCESS)
+ return VkJsonInstance();
+ if (count > 0) {
+ std::vector<VkLayerProperties> layers(count);
+ result = vkEnumerateInstanceLayerProperties(&count, layers.data());
+ if (result != VK_SUCCESS)
+ return VkJsonInstance();
+ instance.layers.reserve(count);
+ for (auto& layer : layers) {
+ instance.layers.push_back(VkJsonLayer{layer, std::vector<VkExtensionProperties>()});
+ if (!EnumerateExtensions(layer.layerName,
+ &instance.layers.back().extensions))
+ return VkJsonInstance();
+ }
+ }
+
+ if (!EnumerateExtensions(nullptr, &instance.extensions))
+ return VkJsonInstance();
+
+ const VkApplicationInfo app_info = {
+ VK_STRUCTURE_TYPE_APPLICATION_INFO,
+ nullptr,
+ "vkjson_info",
+ 1,
+ "",
+ 0,
+ VK_API_VERSION_1_1,
+ };
+ VkInstanceCreateInfo instance_info = {
+ VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
+ nullptr,
+ 0,
+ &app_info,
+ 0,
+ nullptr,
+ 0,
+ nullptr,
+ };
+ VkInstance vkinstance;
+ result = vkCreateInstance(&instance_info, nullptr, &vkinstance);
+ if (result != VK_SUCCESS)
+ return VkJsonInstance();
+
+ count = 0;
+ result = vkEnumeratePhysicalDevices(vkinstance, &count, nullptr);
+ if (result != VK_SUCCESS) {
+ vkDestroyInstance(vkinstance, nullptr);
+ return VkJsonInstance();
+ }
+
+ std::vector<VkPhysicalDevice> devices(count, VK_NULL_HANDLE);
+ result = vkEnumeratePhysicalDevices(vkinstance, &count, devices.data());
+ if (result != VK_SUCCESS) {
+ vkDestroyInstance(vkinstance, nullptr);
+ return VkJsonInstance();
+ }
+
+ std::map<VkPhysicalDevice, uint32_t> device_map;
+ const uint32_t sz = devices.size();
+ instance.devices.reserve(sz);
+ for (uint32_t i = 0; i < sz; ++i) {
+ device_map.insert(std::make_pair(devices[i], i));
+ instance.devices.emplace_back(VkJsonGetDevice(devices[i]));
+ }
+
+ result = vkEnumerateInstanceVersion(&instance.api_version);
+ if (result != VK_SUCCESS) {
+ vkDestroyInstance(vkinstance, nullptr);
+ return VkJsonInstance();
+ }
+
+ count = 0;
+ result = vkEnumeratePhysicalDeviceGroups(vkinstance, &count, nullptr);
+ if (result != VK_SUCCESS) {
+ vkDestroyInstance(vkinstance, nullptr);
+ return VkJsonInstance();
+ }
+
+ VkJsonDeviceGroup device_group;
+ std::vector<VkPhysicalDeviceGroupProperties> group_properties;
+ group_properties.resize(count);
+ for (auto& properties : group_properties) {
+ properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES;
+ properties.pNext = nullptr;
+ }
+ result = vkEnumeratePhysicalDeviceGroups(vkinstance, &count,
+ group_properties.data());
+ if (result != VK_SUCCESS) {
+ vkDestroyInstance(vkinstance, nullptr);
+ return VkJsonInstance();
+ }
+ for (auto properties : group_properties) {
+ device_group.properties = properties;
+ for (uint32_t i = 0; i < properties.physicalDeviceCount; ++i) {
+ device_group.device_inds.push_back(
+ device_map[properties.physicalDevices[i]]);
+ }
+ instance.device_groups.push_back(device_group);
+ }
+
+ vkDestroyInstance(vkinstance, nullptr);
+ return instance;
+}
+
+\n""")
+
+ f.close()
+ gencom.run_clang_format(genfile)
\ No newline at end of file
diff --git a/vulkan/vkjson/vkjson.cc b/vulkan/vkjson/vkjson.cc
index 18fef2b..531a623 100644
--- a/vulkan/vkjson/vkjson.cc
+++ b/vulkan/vkjson/vkjson.cc
@@ -56,13 +56,15 @@
// Floating point fields of Vulkan structure use single precision. The string
// output of max double value in c++ will be larger than Java double's infinity
// value. Below fake double max/min values are only to serve the safe json text
-// parsing in between C++ and Java, becasue Java json library simply cannot
+// parsing in between C++ and Java, because Java json library simply cannot
// handle infinity.
static const double SAFE_DOUBLE_MAX = 0.99 * std::numeric_limits<double>::max();
static const double SAFE_DOUBLE_MIN = -SAFE_DOUBLE_MAX;
-template <typename T> struct EnumTraits;
-template <> struct EnumTraits<VkPhysicalDeviceType> {
+template <typename T>
+struct EnumTraits;
+template <>
+struct EnumTraits<VkPhysicalDeviceType> {
static bool exist(uint32_t e) {
switch (e) {
case VK_PHYSICAL_DEVICE_TYPE_OTHER:
@@ -76,7 +78,8 @@
}
};
-template <> struct EnumTraits<VkFormat> {
+template <>
+struct EnumTraits<VkFormat> {
static bool exist(uint32_t e) {
switch (e) {
case VK_FORMAT_UNDEFINED:
@@ -482,495 +485,13 @@
template <typename Visitor>
inline bool Iterate(Visitor* visitor, VkExtent3D* extents) {
- return
- visitor->Visit("width", &extents->width) &&
- visitor->Visit("height", &extents->height) &&
- visitor->Visit("depth", &extents->depth);
+ return visitor->Visit("width", &extents->width) &&
+ visitor->Visit("height", &extents->height) &&
+ visitor->Visit("depth", &extents->depth);
}
template <typename Visitor>
-inline bool Iterate(Visitor* visitor, VkImageFormatProperties* properties) {
- return
- visitor->Visit("maxExtent", &properties->maxExtent) &&
- visitor->Visit("maxMipLevels", &properties->maxMipLevels) &&
- visitor->Visit("maxArrayLayers", &properties->maxArrayLayers) &&
- visitor->Visit("sampleCounts", &properties->sampleCounts) &&
- visitor->Visit("maxResourceSize", &properties->maxResourceSize);
-}
-
-// clang-format off
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor, VkPhysicalDeviceLimits* limits) {
- return
- visitor->Visit("maxImageDimension1D", &limits->maxImageDimension1D) &&
- visitor->Visit("maxImageDimension2D", &limits->maxImageDimension2D) &&
- visitor->Visit("maxImageDimension3D", &limits->maxImageDimension3D) &&
- visitor->Visit("maxImageDimensionCube", &limits->maxImageDimensionCube) &&
- visitor->Visit("maxImageArrayLayers", &limits->maxImageArrayLayers) &&
- visitor->Visit("maxTexelBufferElements", &limits->maxTexelBufferElements) &&
- visitor->Visit("maxUniformBufferRange", &limits->maxUniformBufferRange) &&
- visitor->Visit("maxStorageBufferRange", &limits->maxStorageBufferRange) &&
- visitor->Visit("maxPushConstantsSize", &limits->maxPushConstantsSize) &&
- visitor->Visit("maxMemoryAllocationCount", &limits->maxMemoryAllocationCount) &&
- visitor->Visit("maxSamplerAllocationCount", &limits->maxSamplerAllocationCount) &&
- visitor->Visit("bufferImageGranularity", &limits->bufferImageGranularity) &&
- visitor->Visit("sparseAddressSpaceSize", &limits->sparseAddressSpaceSize) &&
- visitor->Visit("maxBoundDescriptorSets", &limits->maxBoundDescriptorSets) &&
- visitor->Visit("maxPerStageDescriptorSamplers", &limits->maxPerStageDescriptorSamplers) &&
- visitor->Visit("maxPerStageDescriptorUniformBuffers", &limits->maxPerStageDescriptorUniformBuffers) &&
- visitor->Visit("maxPerStageDescriptorStorageBuffers", &limits->maxPerStageDescriptorStorageBuffers) &&
- visitor->Visit("maxPerStageDescriptorSampledImages", &limits->maxPerStageDescriptorSampledImages) &&
- visitor->Visit("maxPerStageDescriptorStorageImages", &limits->maxPerStageDescriptorStorageImages) &&
- visitor->Visit("maxPerStageDescriptorInputAttachments", &limits->maxPerStageDescriptorInputAttachments) &&
- visitor->Visit("maxPerStageResources", &limits->maxPerStageResources) &&
- visitor->Visit("maxDescriptorSetSamplers", &limits->maxDescriptorSetSamplers) &&
- visitor->Visit("maxDescriptorSetUniformBuffers", &limits->maxDescriptorSetUniformBuffers) &&
- visitor->Visit("maxDescriptorSetUniformBuffersDynamic", &limits->maxDescriptorSetUniformBuffersDynamic) &&
- visitor->Visit("maxDescriptorSetStorageBuffers", &limits->maxDescriptorSetStorageBuffers) &&
- visitor->Visit("maxDescriptorSetStorageBuffersDynamic", &limits->maxDescriptorSetStorageBuffersDynamic) &&
- visitor->Visit("maxDescriptorSetSampledImages", &limits->maxDescriptorSetSampledImages) &&
- visitor->Visit("maxDescriptorSetStorageImages", &limits->maxDescriptorSetStorageImages) &&
- visitor->Visit("maxDescriptorSetInputAttachments", &limits->maxDescriptorSetInputAttachments) &&
- visitor->Visit("maxVertexInputAttributes", &limits->maxVertexInputAttributes) &&
- visitor->Visit("maxVertexInputBindings", &limits->maxVertexInputBindings) &&
- visitor->Visit("maxVertexInputAttributeOffset", &limits->maxVertexInputAttributeOffset) &&
- visitor->Visit("maxVertexInputBindingStride", &limits->maxVertexInputBindingStride) &&
- visitor->Visit("maxVertexOutputComponents", &limits->maxVertexOutputComponents) &&
- visitor->Visit("maxTessellationGenerationLevel", &limits->maxTessellationGenerationLevel) &&
- visitor->Visit("maxTessellationPatchSize", &limits->maxTessellationPatchSize) &&
- visitor->Visit("maxTessellationControlPerVertexInputComponents", &limits->maxTessellationControlPerVertexInputComponents) &&
- visitor->Visit("maxTessellationControlPerVertexOutputComponents", &limits->maxTessellationControlPerVertexOutputComponents) &&
- visitor->Visit("maxTessellationControlPerPatchOutputComponents", &limits->maxTessellationControlPerPatchOutputComponents) &&
- visitor->Visit("maxTessellationControlTotalOutputComponents", &limits->maxTessellationControlTotalOutputComponents) &&
- visitor->Visit("maxTessellationEvaluationInputComponents", &limits->maxTessellationEvaluationInputComponents) &&
- visitor->Visit("maxTessellationEvaluationOutputComponents", &limits->maxTessellationEvaluationOutputComponents) &&
- visitor->Visit("maxGeometryShaderInvocations", &limits->maxGeometryShaderInvocations) &&
- visitor->Visit("maxGeometryInputComponents", &limits->maxGeometryInputComponents) &&
- visitor->Visit("maxGeometryOutputComponents", &limits->maxGeometryOutputComponents) &&
- visitor->Visit("maxGeometryOutputVertices", &limits->maxGeometryOutputVertices) &&
- visitor->Visit("maxGeometryTotalOutputComponents", &limits->maxGeometryTotalOutputComponents) &&
- visitor->Visit("maxFragmentInputComponents", &limits->maxFragmentInputComponents) &&
- visitor->Visit("maxFragmentOutputAttachments", &limits->maxFragmentOutputAttachments) &&
- visitor->Visit("maxFragmentDualSrcAttachments", &limits->maxFragmentDualSrcAttachments) &&
- visitor->Visit("maxFragmentCombinedOutputResources", &limits->maxFragmentCombinedOutputResources) &&
- visitor->Visit("maxComputeSharedMemorySize", &limits->maxComputeSharedMemorySize) &&
- visitor->Visit("maxComputeWorkGroupCount", &limits->maxComputeWorkGroupCount) &&
- visitor->Visit("maxComputeWorkGroupInvocations", &limits->maxComputeWorkGroupInvocations) &&
- visitor->Visit("maxComputeWorkGroupSize", &limits->maxComputeWorkGroupSize) &&
- visitor->Visit("subPixelPrecisionBits", &limits->subPixelPrecisionBits) &&
- visitor->Visit("subTexelPrecisionBits", &limits->subTexelPrecisionBits) &&
- visitor->Visit("mipmapPrecisionBits", &limits->mipmapPrecisionBits) &&
- visitor->Visit("maxDrawIndexedIndexValue", &limits->maxDrawIndexedIndexValue) &&
- visitor->Visit("maxDrawIndirectCount", &limits->maxDrawIndirectCount) &&
- visitor->Visit("maxSamplerLodBias", &limits->maxSamplerLodBias) &&
- visitor->Visit("maxSamplerAnisotropy", &limits->maxSamplerAnisotropy) &&
- visitor->Visit("maxViewports", &limits->maxViewports) &&
- visitor->Visit("maxViewportDimensions", &limits->maxViewportDimensions) &&
- visitor->Visit("viewportBoundsRange", &limits->viewportBoundsRange) &&
- visitor->Visit("viewportSubPixelBits", &limits->viewportSubPixelBits) &&
- visitor->Visit("minMemoryMapAlignment", &limits->minMemoryMapAlignment) &&
- visitor->Visit("minTexelBufferOffsetAlignment", &limits->minTexelBufferOffsetAlignment) &&
- visitor->Visit("minUniformBufferOffsetAlignment", &limits->minUniformBufferOffsetAlignment) &&
- visitor->Visit("minStorageBufferOffsetAlignment", &limits->minStorageBufferOffsetAlignment) &&
- visitor->Visit("minTexelOffset", &limits->minTexelOffset) &&
- visitor->Visit("maxTexelOffset", &limits->maxTexelOffset) &&
- visitor->Visit("minTexelGatherOffset", &limits->minTexelGatherOffset) &&
- visitor->Visit("maxTexelGatherOffset", &limits->maxTexelGatherOffset) &&
- visitor->Visit("minInterpolationOffset", &limits->minInterpolationOffset) &&
- visitor->Visit("maxInterpolationOffset", &limits->maxInterpolationOffset) &&
- visitor->Visit("subPixelInterpolationOffsetBits", &limits->subPixelInterpolationOffsetBits) &&
- visitor->Visit("maxFramebufferWidth", &limits->maxFramebufferWidth) &&
- visitor->Visit("maxFramebufferHeight", &limits->maxFramebufferHeight) &&
- visitor->Visit("maxFramebufferLayers", &limits->maxFramebufferLayers) &&
- visitor->Visit("framebufferColorSampleCounts", &limits->framebufferColorSampleCounts) &&
- visitor->Visit("framebufferDepthSampleCounts", &limits->framebufferDepthSampleCounts) &&
- visitor->Visit("framebufferStencilSampleCounts", &limits->framebufferStencilSampleCounts) &&
- visitor->Visit("framebufferNoAttachmentsSampleCounts", &limits->framebufferNoAttachmentsSampleCounts) &&
- visitor->Visit("maxColorAttachments", &limits->maxColorAttachments) &&
- visitor->Visit("sampledImageColorSampleCounts", &limits->sampledImageColorSampleCounts) &&
- visitor->Visit("sampledImageIntegerSampleCounts", &limits->sampledImageIntegerSampleCounts) &&
- visitor->Visit("sampledImageDepthSampleCounts", &limits->sampledImageDepthSampleCounts) &&
- visitor->Visit("sampledImageStencilSampleCounts", &limits->sampledImageStencilSampleCounts) &&
- visitor->Visit("storageImageSampleCounts", &limits->storageImageSampleCounts) &&
- visitor->Visit("maxSampleMaskWords", &limits->maxSampleMaskWords) &&
- visitor->Visit("timestampComputeAndGraphics", &limits->timestampComputeAndGraphics) &&
- visitor->Visit("timestampPeriod", &limits->timestampPeriod) &&
- visitor->Visit("maxClipDistances", &limits->maxClipDistances) &&
- visitor->Visit("maxCullDistances", &limits->maxCullDistances) &&
- visitor->Visit("maxCombinedClipAndCullDistances", &limits->maxCombinedClipAndCullDistances) &&
- visitor->Visit("discreteQueuePriorities", &limits->discreteQueuePriorities) &&
- visitor->Visit("pointSizeRange", &limits->pointSizeRange) &&
- visitor->Visit("lineWidthRange", &limits->lineWidthRange) &&
- visitor->Visit("pointSizeGranularity", &limits->pointSizeGranularity) &&
- visitor->Visit("lineWidthGranularity", &limits->lineWidthGranularity) &&
- visitor->Visit("strictLines", &limits->strictLines) &&
- visitor->Visit("standardSampleLocations", &limits->standardSampleLocations) &&
- visitor->Visit("optimalBufferCopyOffsetAlignment", &limits->optimalBufferCopyOffsetAlignment) &&
- visitor->Visit("optimalBufferCopyRowPitchAlignment", &limits->optimalBufferCopyRowPitchAlignment) &&
- visitor->Visit("nonCoherentAtomSize", &limits->nonCoherentAtomSize);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor,
- VkPhysicalDeviceSparseProperties* properties) {
- return
- visitor->Visit("residencyStandard2DBlockShape", &properties->residencyStandard2DBlockShape) &&
- visitor->Visit("residencyStandard2DMultisampleBlockShape", &properties->residencyStandard2DMultisampleBlockShape) &&
- visitor->Visit("residencyStandard3DBlockShape", &properties->residencyStandard3DBlockShape) &&
- visitor->Visit("residencyAlignedMipSize", &properties->residencyAlignedMipSize) &&
- visitor->Visit("residencyNonResidentStrict", &properties->residencyNonResidentStrict);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor,
- VkPhysicalDeviceProperties* properties) {
- return
- visitor->Visit("apiVersion", &properties->apiVersion) &&
- visitor->Visit("driverVersion", &properties->driverVersion) &&
- visitor->Visit("vendorID", &properties->vendorID) &&
- visitor->Visit("deviceID", &properties->deviceID) &&
- visitor->Visit("deviceType", &properties->deviceType) &&
- visitor->Visit("deviceName", &properties->deviceName) &&
- visitor->Visit("pipelineCacheUUID", &properties->pipelineCacheUUID) &&
- visitor->Visit("limits", &properties->limits) &&
- visitor->Visit("sparseProperties", &properties->sparseProperties);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor, VkPhysicalDeviceFeatures* features) {
- return
- visitor->Visit("robustBufferAccess", &features->robustBufferAccess) &&
- visitor->Visit("fullDrawIndexUint32", &features->fullDrawIndexUint32) &&
- visitor->Visit("imageCubeArray", &features->imageCubeArray) &&
- visitor->Visit("independentBlend", &features->independentBlend) &&
- visitor->Visit("geometryShader", &features->geometryShader) &&
- visitor->Visit("tessellationShader", &features->tessellationShader) &&
- visitor->Visit("sampleRateShading", &features->sampleRateShading) &&
- visitor->Visit("dualSrcBlend", &features->dualSrcBlend) &&
- visitor->Visit("logicOp", &features->logicOp) &&
- visitor->Visit("multiDrawIndirect", &features->multiDrawIndirect) &&
- visitor->Visit("drawIndirectFirstInstance", &features->drawIndirectFirstInstance) &&
- visitor->Visit("depthClamp", &features->depthClamp) &&
- visitor->Visit("depthBiasClamp", &features->depthBiasClamp) &&
- visitor->Visit("fillModeNonSolid", &features->fillModeNonSolid) &&
- visitor->Visit("depthBounds", &features->depthBounds) &&
- visitor->Visit("wideLines", &features->wideLines) &&
- visitor->Visit("largePoints", &features->largePoints) &&
- visitor->Visit("alphaToOne", &features->alphaToOne) &&
- visitor->Visit("multiViewport", &features->multiViewport) &&
- visitor->Visit("samplerAnisotropy", &features->samplerAnisotropy) &&
- visitor->Visit("textureCompressionETC2", &features->textureCompressionETC2) &&
- visitor->Visit("textureCompressionASTC_LDR", &features->textureCompressionASTC_LDR) &&
- visitor->Visit("textureCompressionBC", &features->textureCompressionBC) &&
- visitor->Visit("occlusionQueryPrecise", &features->occlusionQueryPrecise) &&
- visitor->Visit("pipelineStatisticsQuery", &features->pipelineStatisticsQuery) &&
- visitor->Visit("vertexPipelineStoresAndAtomics", &features->vertexPipelineStoresAndAtomics) &&
- visitor->Visit("fragmentStoresAndAtomics", &features->fragmentStoresAndAtomics) &&
- visitor->Visit("shaderTessellationAndGeometryPointSize", &features->shaderTessellationAndGeometryPointSize) &&
- visitor->Visit("shaderImageGatherExtended", &features->shaderImageGatherExtended) &&
- visitor->Visit("shaderStorageImageExtendedFormats", &features->shaderStorageImageExtendedFormats) &&
- visitor->Visit("shaderStorageImageMultisample", &features->shaderStorageImageMultisample) &&
- visitor->Visit("shaderStorageImageReadWithoutFormat", &features->shaderStorageImageReadWithoutFormat) &&
- visitor->Visit("shaderStorageImageWriteWithoutFormat", &features->shaderStorageImageWriteWithoutFormat) &&
- visitor->Visit("shaderUniformBufferArrayDynamicIndexing", &features->shaderUniformBufferArrayDynamicIndexing) &&
- visitor->Visit("shaderSampledImageArrayDynamicIndexing", &features->shaderSampledImageArrayDynamicIndexing) &&
- visitor->Visit("shaderStorageBufferArrayDynamicIndexing", &features->shaderStorageBufferArrayDynamicIndexing) &&
- visitor->Visit("shaderStorageImageArrayDynamicIndexing", &features->shaderStorageImageArrayDynamicIndexing) &&
- visitor->Visit("shaderClipDistance", &features->shaderClipDistance) &&
- visitor->Visit("shaderCullDistance", &features->shaderCullDistance) &&
- visitor->Visit("shaderFloat64", &features->shaderFloat64) &&
- visitor->Visit("shaderInt64", &features->shaderInt64) &&
- visitor->Visit("shaderInt16", &features->shaderInt16) &&
- visitor->Visit("shaderResourceResidency", &features->shaderResourceResidency) &&
- visitor->Visit("shaderResourceMinLod", &features->shaderResourceMinLod) &&
- visitor->Visit("sparseBinding", &features->sparseBinding) &&
- visitor->Visit("sparseResidencyBuffer", &features->sparseResidencyBuffer) &&
- visitor->Visit("sparseResidencyImage2D", &features->sparseResidencyImage2D) &&
- visitor->Visit("sparseResidencyImage3D", &features->sparseResidencyImage3D) &&
- visitor->Visit("sparseResidency2Samples", &features->sparseResidency2Samples) &&
- visitor->Visit("sparseResidency4Samples", &features->sparseResidency4Samples) &&
- visitor->Visit("sparseResidency8Samples", &features->sparseResidency8Samples) &&
- visitor->Visit("sparseResidency16Samples", &features->sparseResidency16Samples) &&
- visitor->Visit("sparseResidencyAliased", &features->sparseResidencyAliased) &&
- visitor->Visit("variableMultisampleRate", &features->variableMultisampleRate) &&
- visitor->Visit("inheritedQueries", &features->inheritedQueries);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor, VkJsonCore12* core) {
- return
- visitor->Visit("features", &core->features) &&
- visitor->Visit("properties", &core->properties);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor, VkPhysicalDeviceVulkan12Properties* properties) {
- return
- visitor->Visit("driverID", &properties->driverID) &&
- visitor->Visit("driverName", &properties->driverName) &&
- visitor->Visit("driverInfo", &properties->driverInfo) &&
- visitor->Visit("conformanceVersion", &properties->conformanceVersion) &&
- visitor->Visit("denormBehaviorIndependence", &properties->denormBehaviorIndependence) &&
- visitor->Visit("roundingModeIndependence", &properties->roundingModeIndependence) &&
- visitor->Visit("shaderSignedZeroInfNanPreserveFloat16", &properties->shaderSignedZeroInfNanPreserveFloat16) &&
- visitor->Visit("shaderSignedZeroInfNanPreserveFloat32", &properties->shaderSignedZeroInfNanPreserveFloat32) &&
- visitor->Visit("shaderSignedZeroInfNanPreserveFloat64", &properties->shaderSignedZeroInfNanPreserveFloat64) &&
- visitor->Visit("shaderDenormPreserveFloat16", &properties->shaderDenormPreserveFloat16) &&
- visitor->Visit("shaderDenormPreserveFloat32", &properties->shaderDenormPreserveFloat32) &&
- visitor->Visit("shaderDenormPreserveFloat64", &properties->shaderDenormPreserveFloat64) &&
- visitor->Visit("shaderDenormFlushToZeroFloat16", &properties->shaderDenormFlushToZeroFloat16) &&
- visitor->Visit("shaderDenormFlushToZeroFloat32", &properties->shaderDenormFlushToZeroFloat32) &&
- visitor->Visit("shaderDenormFlushToZeroFloat64", &properties->shaderDenormFlushToZeroFloat64) &&
- visitor->Visit("shaderRoundingModeRTEFloat16", &properties->shaderRoundingModeRTEFloat16) &&
- visitor->Visit("shaderRoundingModeRTEFloat32", &properties->shaderRoundingModeRTEFloat32) &&
- visitor->Visit("shaderRoundingModeRTEFloat64", &properties->shaderRoundingModeRTEFloat64) &&
- visitor->Visit("shaderRoundingModeRTZFloat16", &properties->shaderRoundingModeRTZFloat16) &&
- visitor->Visit("shaderRoundingModeRTZFloat32", &properties->shaderRoundingModeRTZFloat32) &&
- visitor->Visit("shaderRoundingModeRTZFloat64", &properties->shaderRoundingModeRTZFloat64) &&
- visitor->Visit("maxUpdateAfterBindDescriptorsInAllPools", &properties->maxUpdateAfterBindDescriptorsInAllPools) &&
- visitor->Visit("shaderUniformBufferArrayNonUniformIndexingNative", &properties->shaderUniformBufferArrayNonUniformIndexingNative) &&
- visitor->Visit("shaderSampledImageArrayNonUniformIndexingNative", &properties->shaderSampledImageArrayNonUniformIndexingNative) &&
- visitor->Visit("shaderStorageBufferArrayNonUniformIndexingNative", &properties->shaderStorageBufferArrayNonUniformIndexingNative) &&
- visitor->Visit("shaderStorageImageArrayNonUniformIndexingNative", &properties->shaderStorageImageArrayNonUniformIndexingNative) &&
- visitor->Visit("shaderInputAttachmentArrayNonUniformIndexingNative", &properties->shaderInputAttachmentArrayNonUniformIndexingNative) &&
- visitor->Visit("robustBufferAccessUpdateAfterBind", &properties->robustBufferAccessUpdateAfterBind) &&
- visitor->Visit("quadDivergentImplicitLod", &properties->quadDivergentImplicitLod) &&
- visitor->Visit("maxPerStageDescriptorUpdateAfterBindSamplers", &properties->maxPerStageDescriptorUpdateAfterBindSamplers) &&
- visitor->Visit("maxPerStageDescriptorUpdateAfterBindUniformBuffers", &properties->maxPerStageDescriptorUpdateAfterBindUniformBuffers) &&
- visitor->Visit("maxPerStageDescriptorUpdateAfterBindStorageBuffers", &properties->maxPerStageDescriptorUpdateAfterBindStorageBuffers) &&
- visitor->Visit("maxPerStageDescriptorUpdateAfterBindSampledImages", &properties->maxPerStageDescriptorUpdateAfterBindSampledImages) &&
- visitor->Visit("maxPerStageDescriptorUpdateAfterBindStorageImages", &properties->maxPerStageDescriptorUpdateAfterBindStorageImages) &&
- visitor->Visit("maxPerStageDescriptorUpdateAfterBindInputAttachments", &properties->maxPerStageDescriptorUpdateAfterBindInputAttachments) &&
- visitor->Visit("maxPerStageUpdateAfterBindResources", &properties->maxPerStageUpdateAfterBindResources) &&
- visitor->Visit("maxDescriptorSetUpdateAfterBindSamplers", &properties->maxDescriptorSetUpdateAfterBindSamplers) &&
- visitor->Visit("maxDescriptorSetUpdateAfterBindUniformBuffers", &properties->maxDescriptorSetUpdateAfterBindUniformBuffers) &&
- visitor->Visit("maxDescriptorSetUpdateAfterBindUniformBuffersDynamic", &properties->maxDescriptorSetUpdateAfterBindUniformBuffersDynamic) &&
- visitor->Visit("maxDescriptorSetUpdateAfterBindStorageBuffers", &properties->maxDescriptorSetUpdateAfterBindStorageBuffers) &&
- visitor->Visit("maxDescriptorSetUpdateAfterBindStorageBuffersDynamic", &properties->maxDescriptorSetUpdateAfterBindStorageBuffersDynamic) &&
- visitor->Visit("maxDescriptorSetUpdateAfterBindSampledImages", &properties->maxDescriptorSetUpdateAfterBindSampledImages) &&
- visitor->Visit("maxDescriptorSetUpdateAfterBindStorageImages", &properties->maxDescriptorSetUpdateAfterBindStorageImages) &&
- visitor->Visit("maxDescriptorSetUpdateAfterBindInputAttachments", &properties->maxDescriptorSetUpdateAfterBindInputAttachments) &&
- visitor->Visit("supportedDepthResolveModes", &properties->supportedDepthResolveModes) &&
- visitor->Visit("supportedStencilResolveModes", &properties->supportedStencilResolveModes) &&
- visitor->Visit("independentResolveNone", &properties->independentResolveNone) &&
- visitor->Visit("independentResolve", &properties->independentResolve) &&
- visitor->Visit("filterMinmaxSingleComponentFormats", &properties->filterMinmaxSingleComponentFormats) &&
- visitor->Visit("filterMinmaxImageComponentMapping", &properties->filterMinmaxImageComponentMapping) &&
- visitor->Visit("maxTimelineSemaphoreValueDifference", &properties->maxTimelineSemaphoreValueDifference) &&
- visitor->Visit("framebufferIntegerColorSampleCounts", &properties->framebufferIntegerColorSampleCounts);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor, VkPhysicalDeviceVulkan12Features* features) {
- return
- visitor->Visit("samplerMirrorClampToEdge", &features->samplerMirrorClampToEdge) &&
- visitor->Visit("drawIndirectCount", &features->drawIndirectCount) &&
- visitor->Visit("storageBuffer8BitAccess", &features->storageBuffer8BitAccess) &&
- visitor->Visit("uniformAndStorageBuffer8BitAccess", &features->uniformAndStorageBuffer8BitAccess) &&
- visitor->Visit("storagePushConstant8", &features->storagePushConstant8) &&
- visitor->Visit("shaderBufferInt64Atomics", &features->shaderBufferInt64Atomics) &&
- visitor->Visit("shaderSharedInt64Atomics", &features->shaderSharedInt64Atomics) &&
- visitor->Visit("shaderFloat16", &features->shaderFloat16) &&
- visitor->Visit("shaderInt8", &features->shaderInt8) &&
- visitor->Visit("descriptorIndexing", &features->descriptorIndexing) &&
- visitor->Visit("shaderInputAttachmentArrayDynamicIndexing", &features->shaderInputAttachmentArrayDynamicIndexing) &&
- visitor->Visit("shaderUniformTexelBufferArrayDynamicIndexing", &features->shaderUniformTexelBufferArrayDynamicIndexing) &&
- visitor->Visit("shaderStorageTexelBufferArrayDynamicIndexing", &features->shaderStorageTexelBufferArrayDynamicIndexing) &&
- visitor->Visit("shaderUniformBufferArrayNonUniformIndexing", &features->shaderUniformBufferArrayNonUniformIndexing) &&
- visitor->Visit("shaderSampledImageArrayNonUniformIndexing", &features->shaderSampledImageArrayNonUniformIndexing) &&
- visitor->Visit("shaderStorageBufferArrayNonUniformIndexing", &features->shaderStorageBufferArrayNonUniformIndexing) &&
- visitor->Visit("shaderStorageImageArrayNonUniformIndexing", &features->shaderStorageImageArrayNonUniformIndexing) &&
- visitor->Visit("shaderInputAttachmentArrayNonUniformIndexing", &features->shaderInputAttachmentArrayNonUniformIndexing) &&
- visitor->Visit("shaderUniformTexelBufferArrayNonUniformIndexing", &features->shaderUniformTexelBufferArrayNonUniformIndexing) &&
- visitor->Visit("shaderStorageTexelBufferArrayNonUniformIndexing", &features->shaderStorageTexelBufferArrayNonUniformIndexing) &&
- visitor->Visit("descriptorBindingUniformBufferUpdateAfterBind", &features->descriptorBindingUniformBufferUpdateAfterBind) &&
- visitor->Visit("descriptorBindingSampledImageUpdateAfterBind", &features->descriptorBindingSampledImageUpdateAfterBind) &&
- visitor->Visit("descriptorBindingStorageImageUpdateAfterBind", &features->descriptorBindingStorageImageUpdateAfterBind) &&
- visitor->Visit("descriptorBindingStorageBufferUpdateAfterBind", &features->descriptorBindingStorageBufferUpdateAfterBind) &&
- visitor->Visit("descriptorBindingUniformTexelBufferUpdateAfterBind", &features->descriptorBindingUniformTexelBufferUpdateAfterBind) &&
- visitor->Visit("descriptorBindingStorageTexelBufferUpdateAfterBind", &features->descriptorBindingStorageTexelBufferUpdateAfterBind) &&
- visitor->Visit("descriptorBindingUpdateUnusedWhilePending", &features->descriptorBindingUpdateUnusedWhilePending) &&
- visitor->Visit("descriptorBindingPartiallyBound", &features->descriptorBindingPartiallyBound) &&
- visitor->Visit("descriptorBindingVariableDescriptorCount", &features->descriptorBindingVariableDescriptorCount) &&
- visitor->Visit("runtimeDescriptorArray", &features->runtimeDescriptorArray) &&
- visitor->Visit("samplerFilterMinmax", &features->samplerFilterMinmax) &&
- visitor->Visit("scalarBlockLayout", &features->scalarBlockLayout) &&
- visitor->Visit("imagelessFramebuffer", &features->imagelessFramebuffer) &&
- visitor->Visit("uniformBufferStandardLayout", &features->uniformBufferStandardLayout) &&
- visitor->Visit("shaderSubgroupExtendedTypes", &features->shaderSubgroupExtendedTypes) &&
- visitor->Visit("separateDepthStencilLayouts", &features->separateDepthStencilLayouts) &&
- visitor->Visit("hostQueryReset", &features->hostQueryReset) &&
- visitor->Visit("timelineSemaphore", &features->timelineSemaphore) &&
- visitor->Visit("bufferDeviceAddress", &features->bufferDeviceAddress) &&
- visitor->Visit("bufferDeviceAddressCaptureReplay", &features->bufferDeviceAddressCaptureReplay) &&
- visitor->Visit("bufferDeviceAddressMultiDevice", &features->bufferDeviceAddressMultiDevice) &&
- visitor->Visit("vulkanMemoryModel", &features->vulkanMemoryModel) &&
- visitor->Visit("vulkanMemoryModelDeviceScope", &features->vulkanMemoryModelDeviceScope) &&
- visitor->Visit("vulkanMemoryModelAvailabilityVisibilityChains", &features->vulkanMemoryModelAvailabilityVisibilityChains) &&
- visitor->Visit("shaderOutputViewportIndex", &features->shaderOutputViewportIndex) &&
- visitor->Visit("shaderOutputLayer", &features->shaderOutputLayer) &&
- visitor->Visit("subgroupBroadcastDynamicId", &features->subgroupBroadcastDynamicId);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor, VkJsonCore13* core) {
- return
- visitor->Visit("features", &core->features) &&
- visitor->Visit("properties", &core->properties);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor, VkPhysicalDeviceVulkan13Properties* properties) {
- return
- visitor->Visit("minSubgroupSize", &properties->minSubgroupSize) &&
- visitor->Visit("maxSubgroupSize", &properties->maxSubgroupSize) &&
- visitor->Visit("maxComputeWorkgroupSubgroups", &properties->maxComputeWorkgroupSubgroups) &&
- visitor->Visit("requiredSubgroupSizeStages", &properties->requiredSubgroupSizeStages) &&
- visitor->Visit("maxInlineUniformBlockSize", &properties->maxInlineUniformBlockSize) &&
- visitor->Visit("maxPerStageDescriptorInlineUniformBlocks", &properties->maxPerStageDescriptorInlineUniformBlocks) &&
- visitor->Visit("maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks", &properties->maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks) &&
- visitor->Visit("maxDescriptorSetInlineUniformBlocks", &properties->maxDescriptorSetInlineUniformBlocks) &&
- visitor->Visit("maxDescriptorSetUpdateAfterBindInlineUniformBlocks", &properties->maxDescriptorSetUpdateAfterBindInlineUniformBlocks) &&
- visitor->Visit("maxInlineUniformTotalSize", &properties->maxInlineUniformTotalSize) &&
- visitor->Visit("integerDotProduct8BitUnsignedAccelerated", &properties->integerDotProduct8BitUnsignedAccelerated) &&
- visitor->Visit("integerDotProduct8BitSignedAccelerated", &properties->integerDotProduct8BitSignedAccelerated) &&
- visitor->Visit("integerDotProduct8BitMixedSignednessAccelerated", &properties->integerDotProduct8BitMixedSignednessAccelerated) &&
- visitor->Visit("integerDotProduct4x8BitPackedUnsignedAccelerated", &properties->integerDotProduct4x8BitPackedUnsignedAccelerated) &&
- visitor->Visit("integerDotProduct4x8BitPackedSignedAccelerated", &properties->integerDotProduct4x8BitPackedSignedAccelerated) &&
- visitor->Visit("integerDotProduct4x8BitPackedMixedSignednessAccelerated", &properties->integerDotProduct4x8BitPackedMixedSignednessAccelerated) &&
- visitor->Visit("integerDotProduct16BitUnsignedAccelerated", &properties->integerDotProduct16BitUnsignedAccelerated) &&
- visitor->Visit("integerDotProduct16BitSignedAccelerated", &properties->integerDotProduct16BitSignedAccelerated) &&
- visitor->Visit("integerDotProduct16BitMixedSignednessAccelerated", &properties->integerDotProduct16BitMixedSignednessAccelerated) &&
- visitor->Visit("integerDotProduct32BitUnsignedAccelerated", &properties->integerDotProduct32BitUnsignedAccelerated) &&
- visitor->Visit("integerDotProduct32BitSignedAccelerated", &properties->integerDotProduct32BitSignedAccelerated) &&
- visitor->Visit("integerDotProduct32BitMixedSignednessAccelerated", &properties->integerDotProduct32BitMixedSignednessAccelerated) &&
- visitor->Visit("integerDotProduct64BitUnsignedAccelerated", &properties->integerDotProduct64BitUnsignedAccelerated) &&
- visitor->Visit("integerDotProduct64BitSignedAccelerated", &properties->integerDotProduct64BitSignedAccelerated) &&
- visitor->Visit("integerDotProduct64BitMixedSignednessAccelerated", &properties->integerDotProduct64BitMixedSignednessAccelerated) &&
- visitor->Visit("integerDotProductAccumulatingSaturating8BitUnsignedAccelerated", &properties->integerDotProductAccumulatingSaturating8BitUnsignedAccelerated) &&
- visitor->Visit("integerDotProductAccumulatingSaturating8BitSignedAccelerated", &properties->integerDotProductAccumulatingSaturating8BitSignedAccelerated) &&
- visitor->Visit("integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated", &properties->integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated) &&
- visitor->Visit("integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated", &properties->integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated) &&
- visitor->Visit("integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated", &properties->integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated) &&
- visitor->Visit("integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated", &properties->integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated) &&
- visitor->Visit("integerDotProductAccumulatingSaturating16BitUnsignedAccelerated", &properties->integerDotProductAccumulatingSaturating16BitUnsignedAccelerated) &&
- visitor->Visit("integerDotProductAccumulatingSaturating16BitSignedAccelerated", &properties->integerDotProductAccumulatingSaturating16BitSignedAccelerated) &&
- visitor->Visit("integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated", &properties->integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated) &&
- visitor->Visit("integerDotProductAccumulatingSaturating32BitUnsignedAccelerated", &properties->integerDotProductAccumulatingSaturating32BitUnsignedAccelerated) &&
- visitor->Visit("integerDotProductAccumulatingSaturating32BitSignedAccelerated", &properties->integerDotProductAccumulatingSaturating32BitSignedAccelerated) &&
- visitor->Visit("integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated", &properties->integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated) &&
- visitor->Visit("integerDotProductAccumulatingSaturating64BitUnsignedAccelerated", &properties->integerDotProductAccumulatingSaturating64BitUnsignedAccelerated) &&
- visitor->Visit("integerDotProductAccumulatingSaturating64BitSignedAccelerated", &properties->integerDotProductAccumulatingSaturating64BitSignedAccelerated) &&
- visitor->Visit("integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated", &properties->integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated) &&
- visitor->Visit("storageTexelBufferOffsetAlignmentBytes", &properties->storageTexelBufferOffsetAlignmentBytes) &&
- visitor->Visit("storageTexelBufferOffsetSingleTexelAlignment", &properties->storageTexelBufferOffsetSingleTexelAlignment) &&
- visitor->Visit("uniformTexelBufferOffsetAlignmentBytes", &properties->uniformTexelBufferOffsetAlignmentBytes) &&
- visitor->Visit("uniformTexelBufferOffsetSingleTexelAlignment", &properties->uniformTexelBufferOffsetSingleTexelAlignment) &&
- visitor->Visit("maxBufferSize", &properties->maxBufferSize);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor, VkPhysicalDeviceVulkan13Features* features) {
- return
- visitor->Visit("robustImageAccess", &features->robustImageAccess) &&
- visitor->Visit("inlineUniformBlock", &features->inlineUniformBlock) &&
- visitor->Visit("descriptorBindingInlineUniformBlockUpdateAfterBind", &features->descriptorBindingInlineUniformBlockUpdateAfterBind) &&
- visitor->Visit("pipelineCreationCacheControl", &features->pipelineCreationCacheControl) &&
- visitor->Visit("privateData", &features->privateData) &&
- visitor->Visit("shaderDemoteToHelperInvocation", &features->shaderDemoteToHelperInvocation) &&
- visitor->Visit("shaderTerminateInvocation", &features->shaderTerminateInvocation) &&
- visitor->Visit("subgroupSizeControl", &features->subgroupSizeControl) &&
- visitor->Visit("computeFullSubgroups", &features->computeFullSubgroups) &&
- visitor->Visit("synchronization2", &features->synchronization2) &&
- visitor->Visit("textureCompressionASTC_HDR", &features->textureCompressionASTC_HDR) &&
- visitor->Visit("shaderZeroInitializeWorkgroupMemory", &features->shaderZeroInitializeWorkgroupMemory) &&
- visitor->Visit("dynamicRendering", &features->dynamicRendering) &&
- visitor->Visit("shaderIntegerDotProduct", &features->shaderIntegerDotProduct) &&
- visitor->Visit("maintenance4", &features->maintenance4);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor, VkJsonCore14* core) {
- return
- visitor->Visit("features", &core->features) &&
- visitor->Visit("properties", &core->properties);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor, VkPhysicalDeviceVulkan14Properties* properties) {
- return
- visitor->Visit("lineSubPixelPrecisionBits", &properties->lineSubPixelPrecisionBits) &&
- visitor->Visit("maxVertexAttribDivisor", &properties->maxVertexAttribDivisor) &&
- visitor->Visit("supportsNonZeroFirstInstance", &properties->supportsNonZeroFirstInstance) &&
- visitor->Visit("maxPushDescriptors", &properties->maxPushDescriptors) &&
- visitor->Visit("dynamicRenderingLocalReadDepthStencilAttachments", &properties->dynamicRenderingLocalReadDepthStencilAttachments) &&
- visitor->Visit("dynamicRenderingLocalReadMultisampledAttachments", &properties->dynamicRenderingLocalReadMultisampledAttachments) &&
- visitor->Visit("earlyFragmentMultisampleCoverageAfterSampleCounting", &properties->earlyFragmentMultisampleCoverageAfterSampleCounting) &&
- visitor->Visit("earlyFragmentSampleMaskTestBeforeSampleCounting", &properties->earlyFragmentSampleMaskTestBeforeSampleCounting) &&
- visitor->Visit("depthStencilSwizzleOneSupport", &properties->depthStencilSwizzleOneSupport) &&
- visitor->Visit("polygonModePointSize", &properties->polygonModePointSize) &&
- visitor->Visit("nonStrictSinglePixelWideLinesUseParallelogram", &properties->nonStrictSinglePixelWideLinesUseParallelogram) &&
- visitor->Visit("nonStrictWideLinesUseParallelogram", &properties->nonStrictWideLinesUseParallelogram) &&
- visitor->Visit("blockTexelViewCompatibleMultipleLayers", &properties->blockTexelViewCompatibleMultipleLayers) &&
- visitor->Visit("maxCombinedImageSamplerDescriptorCount", &properties->maxCombinedImageSamplerDescriptorCount) &&
- visitor->Visit("fragmentShadingRateClampCombinerInputs", &properties->fragmentShadingRateClampCombinerInputs) &&
- visitor->Visit("defaultRobustnessStorageBuffers", &properties->defaultRobustnessStorageBuffers) &&
- visitor->Visit("defaultRobustnessUniformBuffers", &properties->defaultRobustnessUniformBuffers) &&
- visitor->Visit("defaultRobustnessVertexInputs", &properties->defaultRobustnessVertexInputs) &&
- visitor->Visit("defaultRobustnessImages", &properties->defaultRobustnessImages) &&
- visitor->Visit("copySrcLayoutCount", &properties->copySrcLayoutCount) &&
- visitor->VisitArray("pCopySrcLayouts", properties->copySrcLayoutCount, &properties->pCopySrcLayouts) &&
- visitor->Visit("copyDstLayoutCount", &properties->copyDstLayoutCount) &&
- visitor->VisitArray("pCopyDstLayouts", properties->copyDstLayoutCount, &properties->pCopyDstLayouts) &&
- visitor->Visit("optimalTilingLayoutUUID", &properties->optimalTilingLayoutUUID) &&
- visitor->Visit("identicalMemoryTypeRequirements", &properties->identicalMemoryTypeRequirements);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor, VkPhysicalDeviceVulkan14Features* features) {
- return
- visitor->Visit("globalPriorityQuery", &features->globalPriorityQuery) &&
- visitor->Visit("shaderSubgroupRotate", &features->shaderSubgroupRotate) &&
- visitor->Visit("shaderSubgroupRotateClustered", &features->shaderSubgroupRotateClustered) &&
- visitor->Visit("shaderFloatControls2", &features->shaderFloatControls2) &&
- visitor->Visit("shaderExpectAssume", &features->shaderExpectAssume) &&
- visitor->Visit("rectangularLines", &features->rectangularLines) &&
- visitor->Visit("bresenhamLines", &features->bresenhamLines) &&
- visitor->Visit("smoothLines", &features->smoothLines) &&
- visitor->Visit("stippledRectangularLines", &features->stippledRectangularLines) &&
- visitor->Visit("stippledBresenhamLines", &features->stippledBresenhamLines) &&
- visitor->Visit("stippledSmoothLines", &features->stippledSmoothLines) &&
- visitor->Visit("vertexAttributeInstanceRateDivisor", &features->vertexAttributeInstanceRateDivisor) &&
- visitor->Visit("vertexAttributeInstanceRateZeroDivisor", &features->vertexAttributeInstanceRateZeroDivisor) &&
- visitor->Visit("indexTypeUint8", &features->indexTypeUint8) &&
- visitor->Visit("dynamicRenderingLocalRead", &features->dynamicRenderingLocalRead) &&
- visitor->Visit("maintenance5", &features->maintenance5) &&
- visitor->Visit("maintenance6", &features->maintenance6) &&
- visitor->Visit("pipelineProtectedAccess", &features->pipelineProtectedAccess) &&
- visitor->Visit("pipelineRobustness", &features->pipelineRobustness) &&
- visitor->Visit("hostImageCopy", &features->hostImageCopy);
-}
-// clang-format on
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor,
- VkJsonExtDriverProperties* properties) {
- return visitor->Visit("driverPropertiesKHR",
- &properties->driver_properties_khr);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor,
- VkPhysicalDeviceDriverPropertiesKHR* properties) {
- return visitor->Visit("driverID", &properties->driverID) &&
- visitor->Visit("driverName", &properties->driverName) &&
- visitor->Visit("driverInfo", &properties->driverInfo) &&
- visitor->Visit("conformanceVersion", &properties->conformanceVersion);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor,
- VkConformanceVersionKHR* version) {
+inline bool Iterate(Visitor* visitor, VkConformanceVersionKHR* version) {
return visitor->Visit("major", &version->major) &&
visitor->Visit("minor", &version->minor) &&
visitor->Visit("subminor", &version->subminor) &&
@@ -978,158 +499,1412 @@
}
template <typename Visitor>
-inline bool Iterate(Visitor* visitor,
- VkJsonExtVariablePointerFeatures* features) {
- return visitor->Visit("variablePointerFeaturesKHR",
- &features->variable_pointer_features_khr);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor,
- VkJsonExtImage2DViewOf3DFeatures* features) {
- return visitor->Visit("image2DViewOf3DFeaturesEXT",
- &features->image_2D_view_of_3D_features_EXT);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor,
- VkJsonExtShaderFloat16Int8Features* features) {
- return visitor->Visit("shaderFloat16Int8FeaturesKHR",
- &features->shader_float16_int8_features_khr);
-}
-
-template <typename Visitor>
inline bool Iterate(Visitor* visitor, VkMemoryType* type) {
- return
- visitor->Visit("propertyFlags", &type->propertyFlags) &&
- visitor->Visit("heapIndex", &type->heapIndex);
+ return visitor->Visit("propertyFlags", &type->propertyFlags) &&
+ visitor->Visit("heapIndex", &type->heapIndex);
}
template <typename Visitor>
inline bool Iterate(Visitor* visitor, VkMemoryHeap* heap) {
- return
- visitor->Visit("size", &heap->size) &&
- visitor->Visit("flags", &heap->flags);
+ return visitor->Visit("size", &heap->size) &&
+ visitor->Visit("flags", &heap->flags);
}
template <typename Visitor>
-inline bool Iterate(Visitor* visitor, VkPhysicalDeviceMemoryProperties* properties) {
+inline bool Iterate(Visitor* visitor, VkJsonCore11* core) {
+ return visitor->Visit("properties", &core->properties) &&
+ visitor->Visit("features", &core->features);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonCore12* core) {
+ return visitor->Visit("properties", &core->properties) &&
+ visitor->Visit("features", &core->features);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonCore13* core) {
+ return visitor->Visit("properties", &core->properties) &&
+ visitor->Visit("features", &core->features);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonCore14* core) {
+ return visitor->Visit("properties", &core->properties) &&
+ visitor->Visit("features", &core->features);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonKHRVariablePointers* structs) {
+ return visitor->Visit("variablePointerFeaturesKHR",
+ &structs->variable_pointer_features_khr) &&
+ visitor->Visit("variablePointersFeaturesKHR",
+ &structs->variable_pointers_features_khr);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonKHRShaderFloat16Int8* structs) {
+ return visitor->Visit("shaderFloat16Int8FeaturesKHR",
+ &structs->shader_float16_int8_features_khr) &&
+ visitor->Visit("float16Int8FeaturesKHR",
+ &structs->float16_int8_features_khr);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonExtImage2dViewOf3d* structs) {
+ return visitor->Visit("image2DViewOf3DFeaturesEXT",
+ &structs->image_2d_view_of_3d_features_ext);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonExtCustomBorderColor* structs) {
+ return visitor->Visit("customBorderColorFeaturesEXT",
+ &structs->custom_border_color_features_ext);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkJsonExtPrimitiveTopologyListRestart* structs) {
+ return visitor->Visit("primitiveTopologyListRestartFeaturesEXT",
+ &structs->primitive_topology_list_restart_features_ext);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonExtProvokingVertex* structs) {
+ return visitor->Visit("provokingVertexFeaturesEXT",
+ &structs->provoking_vertex_features_ext);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonKHRIndexTypeUint8* structs) {
+ return visitor->Visit("indexTypeUint8FeaturesKHR",
+ &structs->index_type_uint8_features_khr);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonExtIndexTypeUint8* structs) {
+ return visitor->Visit("indexTypeUint8FeaturesEXT",
+ &structs->index_type_uint8_features_ext);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkJsonKHRVertexAttributeDivisor* structs) {
+ return visitor->Visit("vertexAttributeDivisorFeaturesKHR",
+ &structs->vertex_attribute_divisor_features_khr);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkJsonExtVertexAttributeDivisor* structs) {
+ return visitor->Visit("vertexAttributeDivisorFeaturesEXT",
+ &structs->vertex_attribute_divisor_features_ext);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonExtTransformFeedback* structs) {
+ return visitor->Visit("transformFeedbackFeaturesEXT",
+ &structs->transform_feedback_features_ext);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkJsonKHRShaderSubgroupUniformControlFlow* structs) {
+ return visitor->Visit(
+ "shaderSubgroupUniformControlFlowFeaturesKHR",
+ &structs->shader_subgroup_uniform_control_flow_features_khr);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkJsonKHRShaderSubgroupExtendedTypes* structs) {
+ return visitor->Visit("shaderSubgroupExtendedTypesFeaturesKHR",
+ &structs->shader_subgroup_extended_types_features_khr);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonKHR8bitStorage* structs) {
+ return visitor->Visit("bit8StorageFeaturesKHR",
+ &structs->bit8_storage_features_khr);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkJsonKHRShaderIntegerDotProduct* structs) {
+ return visitor->Visit("shaderIntegerDotProductFeaturesKHR",
+ &structs->shader_integer_dot_product_features_khr);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkJsonIMGRelaxedLineRasterization* structs) {
+ return visitor->Visit("relaxedLineRasterizationFeaturesIMG",
+ &structs->relaxed_line_rasterization_features_img);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonKHRLineRasterization* structs) {
+ return visitor->Visit("lineRasterizationFeaturesKHR",
+ &structs->line_rasterization_features_khr);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonExtLineRasterization* structs) {
+ return visitor->Visit("lineRasterizationFeaturesEXT",
+ &structs->line_rasterization_features_ext);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkJsonExtPrimitivesGeneratedQuery* structs) {
+ return visitor->Visit("primitivesGeneratedQueryFeaturesEXT",
+ &structs->primitives_generated_query_features_ext);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonKHRShaderFloatControls* structs) {
+ return visitor->Visit("floatControlsPropertiesKHR",
+ &structs->float_controls_properties_khr);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkJsonKHRDriverProperties* structs) {
+ return visitor->Visit("driverPropertiesKHR", &structs->driver_properties_khr);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDeviceFloatControlsProperties* properties) {
return
- visitor->Visit("memoryTypeCount", &properties->memoryTypeCount) &&
- visitor->VisitArray("memoryTypes", properties->memoryTypeCount, &properties->memoryTypes) &&
- visitor->Visit("memoryHeapCount", &properties->memoryHeapCount) &&
- visitor->VisitArray("memoryHeaps", properties->memoryHeapCount, &properties->memoryHeaps);
+
+ visitor->Visit("denormBehaviorIndependence",
+ &properties->denormBehaviorIndependence) &&
+ visitor->Visit("roundingModeIndependence",
+ &properties->roundingModeIndependence) &&
+ visitor->Visit("shaderSignedZeroInfNanPreserveFloat16",
+ &properties->shaderSignedZeroInfNanPreserveFloat16) &&
+ visitor->Visit("shaderSignedZeroInfNanPreserveFloat32",
+ &properties->shaderSignedZeroInfNanPreserveFloat32) &&
+ visitor->Visit("shaderSignedZeroInfNanPreserveFloat64",
+ &properties->shaderSignedZeroInfNanPreserveFloat64) &&
+ visitor->Visit("shaderDenormPreserveFloat16",
+ &properties->shaderDenormPreserveFloat16) &&
+ visitor->Visit("shaderDenormPreserveFloat32",
+ &properties->shaderDenormPreserveFloat32) &&
+ visitor->Visit("shaderDenormPreserveFloat64",
+ &properties->shaderDenormPreserveFloat64) &&
+ visitor->Visit("shaderDenormFlushToZeroFloat16",
+ &properties->shaderDenormFlushToZeroFloat16) &&
+ visitor->Visit("shaderDenormFlushToZeroFloat32",
+ &properties->shaderDenormFlushToZeroFloat32) &&
+ visitor->Visit("shaderDenormFlushToZeroFloat64",
+ &properties->shaderDenormFlushToZeroFloat64) &&
+ visitor->Visit("shaderRoundingModeRTEFloat16",
+ &properties->shaderRoundingModeRTEFloat16) &&
+ visitor->Visit("shaderRoundingModeRTEFloat32",
+ &properties->shaderRoundingModeRTEFloat32) &&
+ visitor->Visit("shaderRoundingModeRTEFloat64",
+ &properties->shaderRoundingModeRTEFloat64) &&
+ visitor->Visit("shaderRoundingModeRTZFloat16",
+ &properties->shaderRoundingModeRTZFloat16) &&
+ visitor->Visit("shaderRoundingModeRTZFloat32",
+ &properties->shaderRoundingModeRTZFloat32) &&
+ visitor->Visit("shaderRoundingModeRTZFloat64",
+ &properties->shaderRoundingModeRTZFloat64);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkPhysicalDeviceProperties* properties) {
+ return
+
+ visitor->Visit("apiVersion", &properties->apiVersion) &&
+ visitor->Visit("driverVersion", &properties->driverVersion) &&
+ visitor->Visit("vendorID", &properties->vendorID) &&
+ visitor->Visit("deviceID", &properties->deviceID) &&
+ visitor->Visit("deviceType", &properties->deviceType) &&
+ visitor->Visit("deviceName", &properties->deviceName) &&
+ visitor->Visit("pipelineCacheUUID", &properties->pipelineCacheUUID) &&
+ visitor->Visit("limits", &properties->limits) &&
+ visitor->Visit("sparseProperties", &properties->sparseProperties);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDeviceMemoryProperties* properties) {
+ return
+
+ visitor->Visit("memoryTypeCount", &properties->memoryTypeCount) &&
+ visitor->VisitArray("memoryTypes", properties->memoryTypeCount,
+ &properties->memoryTypes) &&
+ visitor->Visit("memoryHeapCount", &properties->memoryHeapCount) &&
+ visitor->VisitArray("memoryHeaps", properties->memoryHeapCount,
+ &properties->memoryHeaps);
}
template <typename Visitor>
inline bool Iterate(Visitor* visitor,
VkPhysicalDeviceSubgroupProperties* properties) {
- return visitor->Visit("subgroupSize", &properties->subgroupSize) &&
- visitor->Visit("supportedStages", &properties->supportedStages) &&
- visitor->Visit("supportedOperations",
- &properties->supportedOperations) &&
- visitor->Visit("quadOperationsInAllStages",
- &properties->quadOperationsInAllStages);
+ return
+
+ visitor->Visit("subgroupSize", &properties->subgroupSize) &&
+ visitor->Visit("supportedStages", &properties->supportedStages) &&
+ visitor->Visit("supportedOperations", &properties->supportedOperations) &&
+ visitor->Visit("quadOperationsInAllStages",
+ &properties->quadOperationsInAllStages);
}
template <typename Visitor>
inline bool Iterate(Visitor* visitor,
VkPhysicalDevicePointClippingProperties* properties) {
- return visitor->Visit("pointClippingBehavior",
- &properties->pointClippingBehavior);
+ return
+
+ visitor->Visit("pointClippingBehavior",
+ &properties->pointClippingBehavior);
}
template <typename Visitor>
inline bool Iterate(Visitor* visitor,
VkPhysicalDeviceMultiviewProperties* properties) {
- return visitor->Visit("maxMultiviewViewCount",
- &properties->maxMultiviewViewCount) &&
- visitor->Visit("maxMultiviewInstanceIndex",
- &properties->maxMultiviewInstanceIndex);
+ return
+
+ visitor->Visit("maxMultiviewViewCount",
+ &properties->maxMultiviewViewCount) &&
+ visitor->Visit("maxMultiviewInstanceIndex",
+ &properties->maxMultiviewInstanceIndex);
}
template <typename Visitor>
inline bool Iterate(Visitor* visitor,
VkPhysicalDeviceIDProperties* properties) {
- return visitor->Visit("deviceUUID", &properties->deviceUUID) &&
- visitor->Visit("driverUUID", &properties->driverUUID) &&
- visitor->Visit("deviceLUID", &properties->deviceLUID) &&
- visitor->Visit("deviceNodeMask", &properties->deviceNodeMask) &&
- visitor->Visit("deviceLUIDValid", &properties->deviceLUIDValid);
+ return
+
+ visitor->Visit("deviceUUID", &properties->deviceUUID) &&
+ visitor->Visit("driverUUID", &properties->driverUUID) &&
+ visitor->Visit("deviceLUID", &properties->deviceLUID) &&
+ visitor->Visit("deviceNodeMask", &properties->deviceNodeMask) &&
+ visitor->Visit("deviceLUIDValid", &properties->deviceLUIDValid);
}
template <typename Visitor>
inline bool Iterate(Visitor* visitor,
VkPhysicalDeviceMaintenance3Properties* properties) {
- return visitor->Visit("maxPerSetDescriptors",
- &properties->maxPerSetDescriptors) &&
- visitor->Visit("maxMemoryAllocationSize",
- &properties->maxMemoryAllocationSize);
+ return
+
+ visitor->Visit("maxPerSetDescriptors",
+ &properties->maxPerSetDescriptors) &&
+ visitor->Visit("maxMemoryAllocationSize",
+ &properties->maxMemoryAllocationSize);
}
template <typename Visitor>
inline bool Iterate(Visitor* visitor,
- VkPhysicalDevice16BitStorageFeatures* features) {
- return visitor->Visit("storageBuffer16BitAccess",
- &features->storageBuffer16BitAccess) &&
- visitor->Visit("uniformAndStorageBuffer16BitAccess",
- &features->uniformAndStorageBuffer16BitAccess) &&
- visitor->Visit("storagePushConstant16",
- &features->storagePushConstant16) &&
- visitor->Visit("storageInputOutput16",
- &features->storageInputOutput16);
+ VkPhysicalDeviceSparseProperties* properties) {
+ return
+
+ visitor->Visit("residencyStandard2DBlockShape",
+ &properties->residencyStandard2DBlockShape) &&
+ visitor->Visit("residencyStandard2DMultisampleBlockShape",
+ &properties->residencyStandard2DMultisampleBlockShape) &&
+ visitor->Visit("residencyStandard3DBlockShape",
+ &properties->residencyStandard3DBlockShape) &&
+ visitor->Visit("residencyAlignedMipSize",
+ &properties->residencyAlignedMipSize) &&
+ visitor->Visit("residencyNonResidentStrict",
+ &properties->residencyNonResidentStrict);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkImageFormatProperties* properties) {
+ return
+
+ visitor->Visit("maxExtent", &properties->maxExtent) &&
+ visitor->Visit("maxMipLevels", &properties->maxMipLevels) &&
+ visitor->Visit("maxArrayLayers", &properties->maxArrayLayers) &&
+ visitor->Visit("sampleCounts", &properties->sampleCounts) &&
+ visitor->Visit("maxResourceSize", &properties->maxResourceSize);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkQueueFamilyProperties* properties) {
+ return
+
+ visitor->Visit("queueFlags", &properties->queueFlags) &&
+ visitor->Visit("queueCount", &properties->queueCount) &&
+ visitor->Visit("timestampValidBits", &properties->timestampValidBits) &&
+ visitor->Visit("minImageTransferGranularity",
+ &properties->minImageTransferGranularity);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkExtensionProperties* properties) {
+ return
+
+ visitor->Visit("extensionName", &properties->extensionName) &&
+ visitor->Visit("specVersion", &properties->specVersion);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkLayerProperties* properties) {
+ return
+
+ visitor->Visit("layerName", &properties->layerName) &&
+ visitor->Visit("specVersion", &properties->specVersion) &&
+ visitor->Visit("implementationVersion",
+ &properties->implementationVersion) &&
+ visitor->Visit("description", &properties->description);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkFormatProperties* properties) {
+ return
+
+ visitor->Visit("linearTilingFeatures",
+ &properties->linearTilingFeatures) &&
+ visitor->Visit("optimalTilingFeatures",
+ &properties->optimalTilingFeatures) &&
+ visitor->Visit("bufferFeatures", &properties->bufferFeatures);
}
template <typename Visitor>
inline bool Iterate(Visitor* visitor,
- VkPhysicalDeviceMultiviewFeatures* features) {
- return visitor->Visit("multiview", &features->multiview) &&
- visitor->Visit("multiviewGeometryShader",
- &features->multiviewGeometryShader) &&
- visitor->Visit("multiviewTessellationShader",
- &features->multiviewTessellationShader);
+ VkPhysicalDeviceVariablePointersFeatures* features) {
+ return
+
+ visitor->Visit("variablePointersStorageBuffer",
+ &features->variablePointersStorageBuffer) &&
+ visitor->Visit("variablePointers", &features->variablePointers);
}
template <typename Visitor>
inline bool Iterate(Visitor* visitor,
- VkPhysicalDeviceVariablePointerFeatures* features) {
- return visitor->Visit("variablePointersStorageBuffer",
- &features->variablePointersStorageBuffer) &&
- visitor->Visit("variablePointers", &features->variablePointers);
+ VkPhysicalDeviceShaderFloat16Int8Features* features) {
+ return
+
+ visitor->Visit("shaderFloat16", &features->shaderFloat16) &&
+ visitor->Visit("shaderInt8", &features->shaderInt8);
}
template <typename Visitor>
inline bool Iterate(Visitor* visitor,
VkPhysicalDeviceImage2DViewOf3DFeaturesEXT* features) {
- return visitor->Visit("image2DViewOf3D", &features->image2DViewOf3D) &&
- visitor->Visit("sampler2DViewOf3D", &features->sampler2DViewOf3D);
+ return
+
+ visitor->Visit("image2DViewOf3D", &features->image2DViewOf3D) &&
+ visitor->Visit("sampler2DViewOf3D", &features->sampler2DViewOf3D);
}
template <typename Visitor>
inline bool Iterate(Visitor* visitor,
- VkPhysicalDeviceShaderFloat16Int8FeaturesKHR* features) {
- return visitor->Visit("shaderFloat16", &features->shaderFloat16) &&
- visitor->Visit("shaderInt8", &features->shaderInt8);
+ VkPhysicalDeviceCustomBorderColorFeaturesEXT* features) {
+ return
+
+ visitor->Visit("customBorderColors", &features->customBorderColors) &&
+ visitor->Visit("customBorderColorWithoutFormat",
+ &features->customBorderColorWithoutFormat);
+}
+
+template <typename Visitor>
+inline bool Iterate(
+ Visitor* visitor,
+ VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT* features) {
+ return
+
+ visitor->Visit("primitiveTopologyListRestart",
+ &features->primitiveTopologyListRestart) &&
+ visitor->Visit("primitiveTopologyPatchListRestart",
+ &features->primitiveTopologyPatchListRestart);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDeviceProvokingVertexFeaturesEXT* features) {
+ return
+
+ visitor->Visit("provokingVertexLast", &features->provokingVertexLast) &&
+ visitor->Visit("transformFeedbackPreservesProvokingVertex",
+ &features->transformFeedbackPreservesProvokingVertex);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDeviceIndexTypeUint8Features* features) {
+ return
+
+ visitor->Visit("indexTypeUint8", &features->indexTypeUint8);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDeviceVertexAttributeDivisorFeatures* features) {
+ return
+
+ visitor->Visit("vertexAttributeInstanceRateDivisor",
+ &features->vertexAttributeInstanceRateDivisor) &&
+ visitor->Visit("vertexAttributeInstanceRateZeroDivisor",
+ &features->vertexAttributeInstanceRateZeroDivisor);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDeviceTransformFeedbackFeaturesEXT* features) {
+ return
+
+ visitor->Visit("transformFeedback", &features->transformFeedback) &&
+ visitor->Visit("geometryStreams", &features->geometryStreams);
+}
+
+template <typename Visitor>
+inline bool Iterate(
+ Visitor* visitor,
+ VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR* features) {
+ return
+
+ visitor->Visit("shaderSubgroupUniformControlFlow",
+ &features->shaderSubgroupUniformControlFlow);
+}
+
+template <typename Visitor>
+inline bool Iterate(
+ Visitor* visitor,
+ VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures* features) {
+ return
+
+ visitor->Visit("shaderSubgroupExtendedTypes",
+ &features->shaderSubgroupExtendedTypes);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDevice8BitStorageFeatures* features) {
+ return
+
+ visitor->Visit("storageBuffer8BitAccess",
+ &features->storageBuffer8BitAccess) &&
+ visitor->Visit("uniformAndStorageBuffer8BitAccess",
+ &features->uniformAndStorageBuffer8BitAccess) &&
+ visitor->Visit("storagePushConstant8", &features->storagePushConstant8);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDeviceShaderIntegerDotProductFeatures* features) {
+ return
+
+ visitor->Visit("shaderIntegerDotProduct",
+ &features->shaderIntegerDotProduct);
+}
+
+template <typename Visitor>
+inline bool Iterate(
+ Visitor* visitor,
+ VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG* features) {
+ return
+
+ visitor->Visit("relaxedLineRasterization",
+ &features->relaxedLineRasterization);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDeviceLineRasterizationFeatures* features) {
+ return
+
+ visitor->Visit("rectangularLines", &features->rectangularLines) &&
+ visitor->Visit("bresenhamLines", &features->bresenhamLines) &&
+ visitor->Visit("smoothLines", &features->smoothLines) &&
+ visitor->Visit("stippledRectangularLines",
+ &features->stippledRectangularLines) &&
+ visitor->Visit("stippledBresenhamLines",
+ &features->stippledBresenhamLines) &&
+ visitor->Visit("stippledSmoothLines", &features->stippledSmoothLines);
+}
+
+template <typename Visitor>
+inline bool Iterate(
+ Visitor* visitor,
+ VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT* features) {
+ return
+
+ visitor->Visit("primitivesGeneratedQuery",
+ &features->primitivesGeneratedQuery) &&
+ visitor->Visit(
+ "primitivesGeneratedQueryWithRasterizerDiscard",
+ &features->primitivesGeneratedQueryWithRasterizerDiscard) &&
+ visitor->Visit("primitivesGeneratedQueryWithNonZeroStreams",
+ &features->primitivesGeneratedQueryWithNonZeroStreams);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDevice16BitStorageFeatures* features) {
+ return
+
+ visitor->Visit("storageBuffer16BitAccess",
+ &features->storageBuffer16BitAccess) &&
+ visitor->Visit("uniformAndStorageBuffer16BitAccess",
+ &features->uniformAndStorageBuffer16BitAccess) &&
+ visitor->Visit("storagePushConstant16",
+ &features->storagePushConstant16) &&
+ visitor->Visit("storageInputOutput16", &features->storageInputOutput16);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDeviceMultiviewFeatures* features) {
+ return
+
+ visitor->Visit("multiview", &features->multiview) &&
+ visitor->Visit("multiviewGeometryShader",
+ &features->multiviewGeometryShader) &&
+ visitor->Visit("multiviewTessellationShader",
+ &features->multiviewTessellationShader);
}
template <typename Visitor>
inline bool Iterate(Visitor* visitor,
VkPhysicalDeviceProtectedMemoryFeatures* features) {
- return visitor->Visit("protectedMemory", &features->protectedMemory);
+ return
+
+ visitor->Visit("protectedMemory", &features->protectedMemory);
}
template <typename Visitor>
inline bool Iterate(Visitor* visitor,
VkPhysicalDeviceSamplerYcbcrConversionFeatures* features) {
- return visitor->Visit("samplerYcbcrConversion",
- &features->samplerYcbcrConversion);
+ return
+
+ visitor->Visit("samplerYcbcrConversion",
+ &features->samplerYcbcrConversion);
}
template <typename Visitor>
inline bool Iterate(Visitor* visitor,
VkPhysicalDeviceShaderDrawParameterFeatures* features) {
- return visitor->Visit("shaderDrawParameters",
- &features->shaderDrawParameters);
+ return
+
+ visitor->Visit("shaderDrawParameters", &features->shaderDrawParameters);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkPhysicalDeviceLimits* limits) {
+ return
+
+ visitor->Visit("maxImageDimension1D", &limits->maxImageDimension1D) &&
+ visitor->Visit("maxImageDimension2D", &limits->maxImageDimension2D) &&
+ visitor->Visit("maxImageDimension3D", &limits->maxImageDimension3D) &&
+ visitor->Visit("maxImageDimensionCube", &limits->maxImageDimensionCube) &&
+ visitor->Visit("maxImageArrayLayers", &limits->maxImageArrayLayers) &&
+ visitor->Visit("maxTexelBufferElements",
+ &limits->maxTexelBufferElements) &&
+ visitor->Visit("maxUniformBufferRange", &limits->maxUniformBufferRange) &&
+ visitor->Visit("maxStorageBufferRange", &limits->maxStorageBufferRange) &&
+ visitor->Visit("maxPushConstantsSize", &limits->maxPushConstantsSize) &&
+ visitor->Visit("maxMemoryAllocationCount",
+ &limits->maxMemoryAllocationCount) &&
+ visitor->Visit("maxSamplerAllocationCount",
+ &limits->maxSamplerAllocationCount) &&
+ visitor->Visit("bufferImageGranularity",
+ &limits->bufferImageGranularity) &&
+ visitor->Visit("sparseAddressSpaceSize",
+ &limits->sparseAddressSpaceSize) &&
+ visitor->Visit("maxBoundDescriptorSets",
+ &limits->maxBoundDescriptorSets) &&
+ visitor->Visit("maxPerStageDescriptorSamplers",
+ &limits->maxPerStageDescriptorSamplers) &&
+ visitor->Visit("maxPerStageDescriptorUniformBuffers",
+ &limits->maxPerStageDescriptorUniformBuffers) &&
+ visitor->Visit("maxPerStageDescriptorStorageBuffers",
+ &limits->maxPerStageDescriptorStorageBuffers) &&
+ visitor->Visit("maxPerStageDescriptorSampledImages",
+ &limits->maxPerStageDescriptorSampledImages) &&
+ visitor->Visit("maxPerStageDescriptorStorageImages",
+ &limits->maxPerStageDescriptorStorageImages) &&
+ visitor->Visit("maxPerStageDescriptorInputAttachments",
+ &limits->maxPerStageDescriptorInputAttachments) &&
+ visitor->Visit("maxPerStageResources", &limits->maxPerStageResources) &&
+ visitor->Visit("maxDescriptorSetSamplers",
+ &limits->maxDescriptorSetSamplers) &&
+ visitor->Visit("maxDescriptorSetUniformBuffers",
+ &limits->maxDescriptorSetUniformBuffers) &&
+ visitor->Visit("maxDescriptorSetUniformBuffersDynamic",
+ &limits->maxDescriptorSetUniformBuffersDynamic) &&
+ visitor->Visit("maxDescriptorSetStorageBuffers",
+ &limits->maxDescriptorSetStorageBuffers) &&
+ visitor->Visit("maxDescriptorSetStorageBuffersDynamic",
+ &limits->maxDescriptorSetStorageBuffersDynamic) &&
+ visitor->Visit("maxDescriptorSetSampledImages",
+ &limits->maxDescriptorSetSampledImages) &&
+ visitor->Visit("maxDescriptorSetStorageImages",
+ &limits->maxDescriptorSetStorageImages) &&
+ visitor->Visit("maxDescriptorSetInputAttachments",
+ &limits->maxDescriptorSetInputAttachments) &&
+ visitor->Visit("maxVertexInputAttributes",
+ &limits->maxVertexInputAttributes) &&
+ visitor->Visit("maxVertexInputBindings",
+ &limits->maxVertexInputBindings) &&
+ visitor->Visit("maxVertexInputAttributeOffset",
+ &limits->maxVertexInputAttributeOffset) &&
+ visitor->Visit("maxVertexInputBindingStride",
+ &limits->maxVertexInputBindingStride) &&
+ visitor->Visit("maxVertexOutputComponents",
+ &limits->maxVertexOutputComponents) &&
+ visitor->Visit("maxTessellationGenerationLevel",
+ &limits->maxTessellationGenerationLevel) &&
+ visitor->Visit("maxTessellationPatchSize",
+ &limits->maxTessellationPatchSize) &&
+ visitor->Visit("maxTessellationControlPerVertexInputComponents",
+ &limits->maxTessellationControlPerVertexInputComponents) &&
+ visitor->Visit(
+ "maxTessellationControlPerVertexOutputComponents",
+ &limits->maxTessellationControlPerVertexOutputComponents) &&
+ visitor->Visit("maxTessellationControlPerPatchOutputComponents",
+ &limits->maxTessellationControlPerPatchOutputComponents) &&
+ visitor->Visit("maxTessellationControlTotalOutputComponents",
+ &limits->maxTessellationControlTotalOutputComponents) &&
+ visitor->Visit("maxTessellationEvaluationInputComponents",
+ &limits->maxTessellationEvaluationInputComponents) &&
+ visitor->Visit("maxTessellationEvaluationOutputComponents",
+ &limits->maxTessellationEvaluationOutputComponents) &&
+ visitor->Visit("maxGeometryShaderInvocations",
+ &limits->maxGeometryShaderInvocations) &&
+ visitor->Visit("maxGeometryInputComponents",
+ &limits->maxGeometryInputComponents) &&
+ visitor->Visit("maxGeometryOutputComponents",
+ &limits->maxGeometryOutputComponents) &&
+ visitor->Visit("maxGeometryOutputVertices",
+ &limits->maxGeometryOutputVertices) &&
+ visitor->Visit("maxGeometryTotalOutputComponents",
+ &limits->maxGeometryTotalOutputComponents) &&
+ visitor->Visit("maxFragmentInputComponents",
+ &limits->maxFragmentInputComponents) &&
+ visitor->Visit("maxFragmentOutputAttachments",
+ &limits->maxFragmentOutputAttachments) &&
+ visitor->Visit("maxFragmentDualSrcAttachments",
+ &limits->maxFragmentDualSrcAttachments) &&
+ visitor->Visit("maxFragmentCombinedOutputResources",
+ &limits->maxFragmentCombinedOutputResources) &&
+ visitor->Visit("maxComputeSharedMemorySize",
+ &limits->maxComputeSharedMemorySize) &&
+ visitor->Visit("maxComputeWorkGroupCount",
+ &limits->maxComputeWorkGroupCount) &&
+ visitor->Visit("maxComputeWorkGroupInvocations",
+ &limits->maxComputeWorkGroupInvocations) &&
+ visitor->Visit("maxComputeWorkGroupSize",
+ &limits->maxComputeWorkGroupSize) &&
+ visitor->Visit("subPixelPrecisionBits", &limits->subPixelPrecisionBits) &&
+ visitor->Visit("subTexelPrecisionBits", &limits->subTexelPrecisionBits) &&
+ visitor->Visit("mipmapPrecisionBits", &limits->mipmapPrecisionBits) &&
+ visitor->Visit("maxDrawIndexedIndexValue",
+ &limits->maxDrawIndexedIndexValue) &&
+ visitor->Visit("maxDrawIndirectCount", &limits->maxDrawIndirectCount) &&
+ visitor->Visit("maxSamplerLodBias", &limits->maxSamplerLodBias) &&
+ visitor->Visit("maxSamplerAnisotropy", &limits->maxSamplerAnisotropy) &&
+ visitor->Visit("maxViewports", &limits->maxViewports) &&
+ visitor->Visit("maxViewportDimensions", &limits->maxViewportDimensions) &&
+ visitor->Visit("viewportBoundsRange", &limits->viewportBoundsRange) &&
+ visitor->Visit("viewportSubPixelBits", &limits->viewportSubPixelBits) &&
+ visitor->Visit("minMemoryMapAlignment", &limits->minMemoryMapAlignment) &&
+ visitor->Visit("minTexelBufferOffsetAlignment",
+ &limits->minTexelBufferOffsetAlignment) &&
+ visitor->Visit("minUniformBufferOffsetAlignment",
+ &limits->minUniformBufferOffsetAlignment) &&
+ visitor->Visit("minStorageBufferOffsetAlignment",
+ &limits->minStorageBufferOffsetAlignment) &&
+ visitor->Visit("minTexelOffset", &limits->minTexelOffset) &&
+ visitor->Visit("maxTexelOffset", &limits->maxTexelOffset) &&
+ visitor->Visit("minTexelGatherOffset", &limits->minTexelGatherOffset) &&
+ visitor->Visit("maxTexelGatherOffset", &limits->maxTexelGatherOffset) &&
+ visitor->Visit("minInterpolationOffset",
+ &limits->minInterpolationOffset) &&
+ visitor->Visit("maxInterpolationOffset",
+ &limits->maxInterpolationOffset) &&
+ visitor->Visit("subPixelInterpolationOffsetBits",
+ &limits->subPixelInterpolationOffsetBits) &&
+ visitor->Visit("maxFramebufferWidth", &limits->maxFramebufferWidth) &&
+ visitor->Visit("maxFramebufferHeight", &limits->maxFramebufferHeight) &&
+ visitor->Visit("maxFramebufferLayers", &limits->maxFramebufferLayers) &&
+ visitor->Visit("framebufferColorSampleCounts",
+ &limits->framebufferColorSampleCounts) &&
+ visitor->Visit("framebufferDepthSampleCounts",
+ &limits->framebufferDepthSampleCounts) &&
+ visitor->Visit("framebufferStencilSampleCounts",
+ &limits->framebufferStencilSampleCounts) &&
+ visitor->Visit("framebufferNoAttachmentsSampleCounts",
+ &limits->framebufferNoAttachmentsSampleCounts) &&
+ visitor->Visit("maxColorAttachments", &limits->maxColorAttachments) &&
+ visitor->Visit("sampledImageColorSampleCounts",
+ &limits->sampledImageColorSampleCounts) &&
+ visitor->Visit("sampledImageIntegerSampleCounts",
+ &limits->sampledImageIntegerSampleCounts) &&
+ visitor->Visit("sampledImageDepthSampleCounts",
+ &limits->sampledImageDepthSampleCounts) &&
+ visitor->Visit("sampledImageStencilSampleCounts",
+ &limits->sampledImageStencilSampleCounts) &&
+ visitor->Visit("storageImageSampleCounts",
+ &limits->storageImageSampleCounts) &&
+ visitor->Visit("maxSampleMaskWords", &limits->maxSampleMaskWords) &&
+ visitor->Visit("timestampComputeAndGraphics",
+ &limits->timestampComputeAndGraphics) &&
+ visitor->Visit("timestampPeriod", &limits->timestampPeriod) &&
+ visitor->Visit("maxClipDistances", &limits->maxClipDistances) &&
+ visitor->Visit("maxCullDistances", &limits->maxCullDistances) &&
+ visitor->Visit("maxCombinedClipAndCullDistances",
+ &limits->maxCombinedClipAndCullDistances) &&
+ visitor->Visit("discreteQueuePriorities",
+ &limits->discreteQueuePriorities) &&
+ visitor->Visit("pointSizeRange", &limits->pointSizeRange) &&
+ visitor->Visit("lineWidthRange", &limits->lineWidthRange) &&
+ visitor->Visit("pointSizeGranularity", &limits->pointSizeGranularity) &&
+ visitor->Visit("lineWidthGranularity", &limits->lineWidthGranularity) &&
+ visitor->Visit("strictLines", &limits->strictLines) &&
+ visitor->Visit("standardSampleLocations",
+ &limits->standardSampleLocations) &&
+ visitor->Visit("optimalBufferCopyOffsetAlignment",
+ &limits->optimalBufferCopyOffsetAlignment) &&
+ visitor->Visit("optimalBufferCopyRowPitchAlignment",
+ &limits->optimalBufferCopyRowPitchAlignment) &&
+ visitor->Visit("nonCoherentAtomSize", &limits->nonCoherentAtomSize);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor, VkPhysicalDeviceFeatures* features) {
+ return
+
+ visitor->Visit("robustBufferAccess", &features->robustBufferAccess) &&
+ visitor->Visit("fullDrawIndexUint32", &features->fullDrawIndexUint32) &&
+ visitor->Visit("imageCubeArray", &features->imageCubeArray) &&
+ visitor->Visit("independentBlend", &features->independentBlend) &&
+ visitor->Visit("geometryShader", &features->geometryShader) &&
+ visitor->Visit("tessellationShader", &features->tessellationShader) &&
+ visitor->Visit("sampleRateShading", &features->sampleRateShading) &&
+ visitor->Visit("dualSrcBlend", &features->dualSrcBlend) &&
+ visitor->Visit("logicOp", &features->logicOp) &&
+ visitor->Visit("multiDrawIndirect", &features->multiDrawIndirect) &&
+ visitor->Visit("drawIndirectFirstInstance",
+ &features->drawIndirectFirstInstance) &&
+ visitor->Visit("depthClamp", &features->depthClamp) &&
+ visitor->Visit("depthBiasClamp", &features->depthBiasClamp) &&
+ visitor->Visit("fillModeNonSolid", &features->fillModeNonSolid) &&
+ visitor->Visit("depthBounds", &features->depthBounds) &&
+ visitor->Visit("wideLines", &features->wideLines) &&
+ visitor->Visit("largePoints", &features->largePoints) &&
+ visitor->Visit("alphaToOne", &features->alphaToOne) &&
+ visitor->Visit("multiViewport", &features->multiViewport) &&
+ visitor->Visit("samplerAnisotropy", &features->samplerAnisotropy) &&
+ visitor->Visit("textureCompressionETC2",
+ &features->textureCompressionETC2) &&
+ visitor->Visit("textureCompressionASTC_LDR",
+ &features->textureCompressionASTC_LDR) &&
+ visitor->Visit("textureCompressionBC", &features->textureCompressionBC) &&
+ visitor->Visit("occlusionQueryPrecise",
+ &features->occlusionQueryPrecise) &&
+ visitor->Visit("pipelineStatisticsQuery",
+ &features->pipelineStatisticsQuery) &&
+ visitor->Visit("vertexPipelineStoresAndAtomics",
+ &features->vertexPipelineStoresAndAtomics) &&
+ visitor->Visit("fragmentStoresAndAtomics",
+ &features->fragmentStoresAndAtomics) &&
+ visitor->Visit("shaderTessellationAndGeometryPointSize",
+ &features->shaderTessellationAndGeometryPointSize) &&
+ visitor->Visit("shaderImageGatherExtended",
+ &features->shaderImageGatherExtended) &&
+ visitor->Visit("shaderStorageImageExtendedFormats",
+ &features->shaderStorageImageExtendedFormats) &&
+ visitor->Visit("shaderStorageImageMultisample",
+ &features->shaderStorageImageMultisample) &&
+ visitor->Visit("shaderStorageImageReadWithoutFormat",
+ &features->shaderStorageImageReadWithoutFormat) &&
+ visitor->Visit("shaderStorageImageWriteWithoutFormat",
+ &features->shaderStorageImageWriteWithoutFormat) &&
+ visitor->Visit("shaderUniformBufferArrayDynamicIndexing",
+ &features->shaderUniformBufferArrayDynamicIndexing) &&
+ visitor->Visit("shaderSampledImageArrayDynamicIndexing",
+ &features->shaderSampledImageArrayDynamicIndexing) &&
+ visitor->Visit("shaderStorageBufferArrayDynamicIndexing",
+ &features->shaderStorageBufferArrayDynamicIndexing) &&
+ visitor->Visit("shaderStorageImageArrayDynamicIndexing",
+ &features->shaderStorageImageArrayDynamicIndexing) &&
+ visitor->Visit("shaderClipDistance", &features->shaderClipDistance) &&
+ visitor->Visit("shaderCullDistance", &features->shaderCullDistance) &&
+ visitor->Visit("shaderFloat64", &features->shaderFloat64) &&
+ visitor->Visit("shaderInt64", &features->shaderInt64) &&
+ visitor->Visit("shaderInt16", &features->shaderInt16) &&
+ visitor->Visit("shaderResourceResidency",
+ &features->shaderResourceResidency) &&
+ visitor->Visit("shaderResourceMinLod", &features->shaderResourceMinLod) &&
+ visitor->Visit("sparseBinding", &features->sparseBinding) &&
+ visitor->Visit("sparseResidencyBuffer",
+ &features->sparseResidencyBuffer) &&
+ visitor->Visit("sparseResidencyImage2D",
+ &features->sparseResidencyImage2D) &&
+ visitor->Visit("sparseResidencyImage3D",
+ &features->sparseResidencyImage3D) &&
+ visitor->Visit("sparseResidency2Samples",
+ &features->sparseResidency2Samples) &&
+ visitor->Visit("sparseResidency4Samples",
+ &features->sparseResidency4Samples) &&
+ visitor->Visit("sparseResidency8Samples",
+ &features->sparseResidency8Samples) &&
+ visitor->Visit("sparseResidency16Samples",
+ &features->sparseResidency16Samples) &&
+ visitor->Visit("sparseResidencyAliased",
+ &features->sparseResidencyAliased) &&
+ visitor->Visit("variableMultisampleRate",
+ &features->variableMultisampleRate) &&
+ visitor->Visit("inheritedQueries", &features->inheritedQueries);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDeviceVulkan11Properties* properties) {
+ return
+
+ visitor->Visit("deviceUUID", &properties->deviceUUID) &&
+ visitor->Visit("driverUUID", &properties->driverUUID) &&
+ visitor->Visit("deviceLUID", &properties->deviceLUID) &&
+ visitor->Visit("deviceNodeMask", &properties->deviceNodeMask) &&
+ visitor->Visit("deviceLUIDValid", &properties->deviceLUIDValid) &&
+ visitor->Visit("subgroupSize", &properties->subgroupSize) &&
+ visitor->Visit("subgroupSupportedStages",
+ &properties->subgroupSupportedStages) &&
+ visitor->Visit("subgroupSupportedOperations",
+ &properties->subgroupSupportedOperations) &&
+ visitor->Visit("subgroupQuadOperationsInAllStages",
+ &properties->subgroupQuadOperationsInAllStages) &&
+ visitor->Visit("pointClippingBehavior",
+ &properties->pointClippingBehavior) &&
+ visitor->Visit("maxMultiviewViewCount",
+ &properties->maxMultiviewViewCount) &&
+ visitor->Visit("maxMultiviewInstanceIndex",
+ &properties->maxMultiviewInstanceIndex) &&
+ visitor->Visit("protectedNoFault", &properties->protectedNoFault) &&
+ visitor->Visit("maxPerSetDescriptors",
+ &properties->maxPerSetDescriptors) &&
+ visitor->Visit("maxMemoryAllocationSize",
+ &properties->maxMemoryAllocationSize);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDeviceVulkan11Features* features) {
+ return
+
+ visitor->Visit("storageBuffer16BitAccess",
+ &features->storageBuffer16BitAccess) &&
+ visitor->Visit("uniformAndStorageBuffer16BitAccess",
+ &features->uniformAndStorageBuffer16BitAccess) &&
+ visitor->Visit("storagePushConstant16",
+ &features->storagePushConstant16) &&
+ visitor->Visit("storageInputOutput16", &features->storageInputOutput16) &&
+ visitor->Visit("multiview", &features->multiview) &&
+ visitor->Visit("multiviewGeometryShader",
+ &features->multiviewGeometryShader) &&
+ visitor->Visit("multiviewTessellationShader",
+ &features->multiviewTessellationShader) &&
+ visitor->Visit("variablePointersStorageBuffer",
+ &features->variablePointersStorageBuffer) &&
+ visitor->Visit("variablePointers", &features->variablePointers) &&
+ visitor->Visit("protectedMemory", &features->protectedMemory) &&
+ visitor->Visit("samplerYcbcrConversion",
+ &features->samplerYcbcrConversion) &&
+ visitor->Visit("shaderDrawParameters", &features->shaderDrawParameters);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDeviceVulkan12Properties* properties) {
+ return
+
+ visitor->Visit("driverID", &properties->driverID) &&
+ visitor->Visit("driverName", &properties->driverName) &&
+ visitor->Visit("driverInfo", &properties->driverInfo) &&
+ visitor->Visit("conformanceVersion", &properties->conformanceVersion) &&
+ visitor->Visit("denormBehaviorIndependence",
+ &properties->denormBehaviorIndependence) &&
+ visitor->Visit("roundingModeIndependence",
+ &properties->roundingModeIndependence) &&
+ visitor->Visit("shaderSignedZeroInfNanPreserveFloat16",
+ &properties->shaderSignedZeroInfNanPreserveFloat16) &&
+ visitor->Visit("shaderSignedZeroInfNanPreserveFloat32",
+ &properties->shaderSignedZeroInfNanPreserveFloat32) &&
+ visitor->Visit("shaderSignedZeroInfNanPreserveFloat64",
+ &properties->shaderSignedZeroInfNanPreserveFloat64) &&
+ visitor->Visit("shaderDenormPreserveFloat16",
+ &properties->shaderDenormPreserveFloat16) &&
+ visitor->Visit("shaderDenormPreserveFloat32",
+ &properties->shaderDenormPreserveFloat32) &&
+ visitor->Visit("shaderDenormPreserveFloat64",
+ &properties->shaderDenormPreserveFloat64) &&
+ visitor->Visit("shaderDenormFlushToZeroFloat16",
+ &properties->shaderDenormFlushToZeroFloat16) &&
+ visitor->Visit("shaderDenormFlushToZeroFloat32",
+ &properties->shaderDenormFlushToZeroFloat32) &&
+ visitor->Visit("shaderDenormFlushToZeroFloat64",
+ &properties->shaderDenormFlushToZeroFloat64) &&
+ visitor->Visit("shaderRoundingModeRTEFloat16",
+ &properties->shaderRoundingModeRTEFloat16) &&
+ visitor->Visit("shaderRoundingModeRTEFloat32",
+ &properties->shaderRoundingModeRTEFloat32) &&
+ visitor->Visit("shaderRoundingModeRTEFloat64",
+ &properties->shaderRoundingModeRTEFloat64) &&
+ visitor->Visit("shaderRoundingModeRTZFloat16",
+ &properties->shaderRoundingModeRTZFloat16) &&
+ visitor->Visit("shaderRoundingModeRTZFloat32",
+ &properties->shaderRoundingModeRTZFloat32) &&
+ visitor->Visit("shaderRoundingModeRTZFloat64",
+ &properties->shaderRoundingModeRTZFloat64) &&
+ visitor->Visit("maxUpdateAfterBindDescriptorsInAllPools",
+ &properties->maxUpdateAfterBindDescriptorsInAllPools) &&
+ visitor->Visit(
+ "shaderUniformBufferArrayNonUniformIndexingNative",
+ &properties->shaderUniformBufferArrayNonUniformIndexingNative) &&
+ visitor->Visit(
+ "shaderSampledImageArrayNonUniformIndexingNative",
+ &properties->shaderSampledImageArrayNonUniformIndexingNative) &&
+ visitor->Visit(
+ "shaderStorageBufferArrayNonUniformIndexingNative",
+ &properties->shaderStorageBufferArrayNonUniformIndexingNative) &&
+ visitor->Visit(
+ "shaderStorageImageArrayNonUniformIndexingNative",
+ &properties->shaderStorageImageArrayNonUniformIndexingNative) &&
+ visitor->Visit(
+ "shaderInputAttachmentArrayNonUniformIndexingNative",
+ &properties->shaderInputAttachmentArrayNonUniformIndexingNative) &&
+ visitor->Visit("robustBufferAccessUpdateAfterBind",
+ &properties->robustBufferAccessUpdateAfterBind) &&
+ visitor->Visit("quadDivergentImplicitLod",
+ &properties->quadDivergentImplicitLod) &&
+ visitor->Visit(
+ "maxPerStageDescriptorUpdateAfterBindSamplers",
+ &properties->maxPerStageDescriptorUpdateAfterBindSamplers) &&
+ visitor->Visit(
+ "maxPerStageDescriptorUpdateAfterBindUniformBuffers",
+ &properties->maxPerStageDescriptorUpdateAfterBindUniformBuffers) &&
+ visitor->Visit(
+ "maxPerStageDescriptorUpdateAfterBindStorageBuffers",
+ &properties->maxPerStageDescriptorUpdateAfterBindStorageBuffers) &&
+ visitor->Visit(
+ "maxPerStageDescriptorUpdateAfterBindSampledImages",
+ &properties->maxPerStageDescriptorUpdateAfterBindSampledImages) &&
+ visitor->Visit(
+ "maxPerStageDescriptorUpdateAfterBindStorageImages",
+ &properties->maxPerStageDescriptorUpdateAfterBindStorageImages) &&
+ visitor->Visit(
+ "maxPerStageDescriptorUpdateAfterBindInputAttachments",
+ &properties->maxPerStageDescriptorUpdateAfterBindInputAttachments) &&
+ visitor->Visit("maxPerStageUpdateAfterBindResources",
+ &properties->maxPerStageUpdateAfterBindResources) &&
+ visitor->Visit("maxDescriptorSetUpdateAfterBindSamplers",
+ &properties->maxDescriptorSetUpdateAfterBindSamplers) &&
+ visitor->Visit(
+ "maxDescriptorSetUpdateAfterBindUniformBuffers",
+ &properties->maxDescriptorSetUpdateAfterBindUniformBuffers) &&
+ visitor->Visit(
+ "maxDescriptorSetUpdateAfterBindUniformBuffersDynamic",
+ &properties->maxDescriptorSetUpdateAfterBindUniformBuffersDynamic) &&
+ visitor->Visit(
+ "maxDescriptorSetUpdateAfterBindStorageBuffers",
+ &properties->maxDescriptorSetUpdateAfterBindStorageBuffers) &&
+ visitor->Visit(
+ "maxDescriptorSetUpdateAfterBindStorageBuffersDynamic",
+ &properties->maxDescriptorSetUpdateAfterBindStorageBuffersDynamic) &&
+ visitor->Visit(
+ "maxDescriptorSetUpdateAfterBindSampledImages",
+ &properties->maxDescriptorSetUpdateAfterBindSampledImages) &&
+ visitor->Visit(
+ "maxDescriptorSetUpdateAfterBindStorageImages",
+ &properties->maxDescriptorSetUpdateAfterBindStorageImages) &&
+ visitor->Visit(
+ "maxDescriptorSetUpdateAfterBindInputAttachments",
+ &properties->maxDescriptorSetUpdateAfterBindInputAttachments) &&
+ visitor->Visit("supportedDepthResolveModes",
+ &properties->supportedDepthResolveModes) &&
+ visitor->Visit("supportedStencilResolveModes",
+ &properties->supportedStencilResolveModes) &&
+ visitor->Visit("independentResolveNone",
+ &properties->independentResolveNone) &&
+ visitor->Visit("independentResolve", &properties->independentResolve) &&
+ visitor->Visit("filterMinmaxSingleComponentFormats",
+ &properties->filterMinmaxSingleComponentFormats) &&
+ visitor->Visit("filterMinmaxImageComponentMapping",
+ &properties->filterMinmaxImageComponentMapping) &&
+ visitor->Visit("maxTimelineSemaphoreValueDifference",
+ &properties->maxTimelineSemaphoreValueDifference) &&
+ visitor->Visit("framebufferIntegerColorSampleCounts",
+ &properties->framebufferIntegerColorSampleCounts);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDeviceVulkan12Features* features) {
+ return
+
+ visitor->Visit("samplerMirrorClampToEdge",
+ &features->samplerMirrorClampToEdge) &&
+ visitor->Visit("drawIndirectCount", &features->drawIndirectCount) &&
+ visitor->Visit("storageBuffer8BitAccess",
+ &features->storageBuffer8BitAccess) &&
+ visitor->Visit("uniformAndStorageBuffer8BitAccess",
+ &features->uniformAndStorageBuffer8BitAccess) &&
+ visitor->Visit("storagePushConstant8", &features->storagePushConstant8) &&
+ visitor->Visit("shaderBufferInt64Atomics",
+ &features->shaderBufferInt64Atomics) &&
+ visitor->Visit("shaderSharedInt64Atomics",
+ &features->shaderSharedInt64Atomics) &&
+ visitor->Visit("shaderFloat16", &features->shaderFloat16) &&
+ visitor->Visit("shaderInt8", &features->shaderInt8) &&
+ visitor->Visit("descriptorIndexing", &features->descriptorIndexing) &&
+ visitor->Visit("shaderInputAttachmentArrayDynamicIndexing",
+ &features->shaderInputAttachmentArrayDynamicIndexing) &&
+ visitor->Visit("shaderUniformTexelBufferArrayDynamicIndexing",
+ &features->shaderUniformTexelBufferArrayDynamicIndexing) &&
+ visitor->Visit("shaderStorageTexelBufferArrayDynamicIndexing",
+ &features->shaderStorageTexelBufferArrayDynamicIndexing) &&
+ visitor->Visit("shaderUniformBufferArrayNonUniformIndexing",
+ &features->shaderUniformBufferArrayNonUniformIndexing) &&
+ visitor->Visit("shaderSampledImageArrayNonUniformIndexing",
+ &features->shaderSampledImageArrayNonUniformIndexing) &&
+ visitor->Visit("shaderStorageBufferArrayNonUniformIndexing",
+ &features->shaderStorageBufferArrayNonUniformIndexing) &&
+ visitor->Visit("shaderStorageImageArrayNonUniformIndexing",
+ &features->shaderStorageImageArrayNonUniformIndexing) &&
+ visitor->Visit("shaderInputAttachmentArrayNonUniformIndexing",
+ &features->shaderInputAttachmentArrayNonUniformIndexing) &&
+ visitor->Visit(
+ "shaderUniformTexelBufferArrayNonUniformIndexing",
+ &features->shaderUniformTexelBufferArrayNonUniformIndexing) &&
+ visitor->Visit(
+ "shaderStorageTexelBufferArrayNonUniformIndexing",
+ &features->shaderStorageTexelBufferArrayNonUniformIndexing) &&
+ visitor->Visit(
+ "descriptorBindingUniformBufferUpdateAfterBind",
+ &features->descriptorBindingUniformBufferUpdateAfterBind) &&
+ visitor->Visit("descriptorBindingSampledImageUpdateAfterBind",
+ &features->descriptorBindingSampledImageUpdateAfterBind) &&
+ visitor->Visit("descriptorBindingStorageImageUpdateAfterBind",
+ &features->descriptorBindingStorageImageUpdateAfterBind) &&
+ visitor->Visit(
+ "descriptorBindingStorageBufferUpdateAfterBind",
+ &features->descriptorBindingStorageBufferUpdateAfterBind) &&
+ visitor->Visit(
+ "descriptorBindingUniformTexelBufferUpdateAfterBind",
+ &features->descriptorBindingUniformTexelBufferUpdateAfterBind) &&
+ visitor->Visit(
+ "descriptorBindingStorageTexelBufferUpdateAfterBind",
+ &features->descriptorBindingStorageTexelBufferUpdateAfterBind) &&
+ visitor->Visit("descriptorBindingUpdateUnusedWhilePending",
+ &features->descriptorBindingUpdateUnusedWhilePending) &&
+ visitor->Visit("descriptorBindingPartiallyBound",
+ &features->descriptorBindingPartiallyBound) &&
+ visitor->Visit("descriptorBindingVariableDescriptorCount",
+ &features->descriptorBindingVariableDescriptorCount) &&
+ visitor->Visit("runtimeDescriptorArray",
+ &features->runtimeDescriptorArray) &&
+ visitor->Visit("samplerFilterMinmax", &features->samplerFilterMinmax) &&
+ visitor->Visit("scalarBlockLayout", &features->scalarBlockLayout) &&
+ visitor->Visit("imagelessFramebuffer", &features->imagelessFramebuffer) &&
+ visitor->Visit("uniformBufferStandardLayout",
+ &features->uniformBufferStandardLayout) &&
+ visitor->Visit("shaderSubgroupExtendedTypes",
+ &features->shaderSubgroupExtendedTypes) &&
+ visitor->Visit("separateDepthStencilLayouts",
+ &features->separateDepthStencilLayouts) &&
+ visitor->Visit("hostQueryReset", &features->hostQueryReset) &&
+ visitor->Visit("timelineSemaphore", &features->timelineSemaphore) &&
+ visitor->Visit("bufferDeviceAddress", &features->bufferDeviceAddress) &&
+ visitor->Visit("bufferDeviceAddressCaptureReplay",
+ &features->bufferDeviceAddressCaptureReplay) &&
+ visitor->Visit("bufferDeviceAddressMultiDevice",
+ &features->bufferDeviceAddressMultiDevice) &&
+ visitor->Visit("vulkanMemoryModel", &features->vulkanMemoryModel) &&
+ visitor->Visit("vulkanMemoryModelDeviceScope",
+ &features->vulkanMemoryModelDeviceScope) &&
+ visitor->Visit(
+ "vulkanMemoryModelAvailabilityVisibilityChains",
+ &features->vulkanMemoryModelAvailabilityVisibilityChains) &&
+ visitor->Visit("shaderOutputViewportIndex",
+ &features->shaderOutputViewportIndex) &&
+ visitor->Visit("shaderOutputLayer", &features->shaderOutputLayer) &&
+ visitor->Visit("subgroupBroadcastDynamicId",
+ &features->subgroupBroadcastDynamicId);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDeviceVulkan13Properties* properties) {
+ return
+
+ visitor->Visit("minSubgroupSize", &properties->minSubgroupSize) &&
+ visitor->Visit("maxSubgroupSize", &properties->maxSubgroupSize) &&
+ visitor->Visit("maxComputeWorkgroupSubgroups",
+ &properties->maxComputeWorkgroupSubgroups) &&
+ visitor->Visit("requiredSubgroupSizeStages",
+ &properties->requiredSubgroupSizeStages) &&
+ visitor->Visit("maxInlineUniformBlockSize",
+ &properties->maxInlineUniformBlockSize) &&
+ visitor->Visit("maxPerStageDescriptorInlineUniformBlocks",
+ &properties->maxPerStageDescriptorInlineUniformBlocks) &&
+ visitor->Visit(
+ "maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks",
+ &properties
+ ->maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks) &&
+ visitor->Visit("maxDescriptorSetInlineUniformBlocks",
+ &properties->maxDescriptorSetInlineUniformBlocks) &&
+ visitor->Visit(
+ "maxDescriptorSetUpdateAfterBindInlineUniformBlocks",
+ &properties->maxDescriptorSetUpdateAfterBindInlineUniformBlocks) &&
+ visitor->Visit("maxInlineUniformTotalSize",
+ &properties->maxInlineUniformTotalSize) &&
+ visitor->Visit("integerDotProduct8BitUnsignedAccelerated",
+ &properties->integerDotProduct8BitUnsignedAccelerated) &&
+ visitor->Visit("integerDotProduct8BitSignedAccelerated",
+ &properties->integerDotProduct8BitSignedAccelerated) &&
+ visitor->Visit(
+ "integerDotProduct8BitMixedSignednessAccelerated",
+ &properties->integerDotProduct8BitMixedSignednessAccelerated) &&
+ visitor->Visit(
+ "integerDotProduct4x8BitPackedUnsignedAccelerated",
+ &properties->integerDotProduct4x8BitPackedUnsignedAccelerated) &&
+ visitor->Visit(
+ "integerDotProduct4x8BitPackedSignedAccelerated",
+ &properties->integerDotProduct4x8BitPackedSignedAccelerated) &&
+ visitor->Visit(
+ "integerDotProduct4x8BitPackedMixedSignednessAccelerated",
+ &properties
+ ->integerDotProduct4x8BitPackedMixedSignednessAccelerated) &&
+ visitor->Visit("integerDotProduct16BitUnsignedAccelerated",
+ &properties->integerDotProduct16BitUnsignedAccelerated) &&
+ visitor->Visit("integerDotProduct16BitSignedAccelerated",
+ &properties->integerDotProduct16BitSignedAccelerated) &&
+ visitor->Visit(
+ "integerDotProduct16BitMixedSignednessAccelerated",
+ &properties->integerDotProduct16BitMixedSignednessAccelerated) &&
+ visitor->Visit("integerDotProduct32BitUnsignedAccelerated",
+ &properties->integerDotProduct32BitUnsignedAccelerated) &&
+ visitor->Visit("integerDotProduct32BitSignedAccelerated",
+ &properties->integerDotProduct32BitSignedAccelerated) &&
+ visitor->Visit(
+ "integerDotProduct32BitMixedSignednessAccelerated",
+ &properties->integerDotProduct32BitMixedSignednessAccelerated) &&
+ visitor->Visit("integerDotProduct64BitUnsignedAccelerated",
+ &properties->integerDotProduct64BitUnsignedAccelerated) &&
+ visitor->Visit("integerDotProduct64BitSignedAccelerated",
+ &properties->integerDotProduct64BitSignedAccelerated) &&
+ visitor->Visit(
+ "integerDotProduct64BitMixedSignednessAccelerated",
+ &properties->integerDotProduct64BitMixedSignednessAccelerated) &&
+ visitor->Visit(
+ "integerDotProductAccumulatingSaturating8BitUnsignedAccelerated",
+ &properties
+ ->integerDotProductAccumulatingSaturating8BitUnsignedAccelerated) &&
+ visitor->Visit(
+ "integerDotProductAccumulatingSaturating8BitSignedAccelerated",
+ &properties
+ ->integerDotProductAccumulatingSaturating8BitSignedAccelerated) &&
+ visitor->Visit(
+ "integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerate"
+ "d",
+ &properties
+ ->integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated) &&
+ visitor->Visit(
+ "integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerat"
+ "ed",
+ &properties
+ ->integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated) &&
+ visitor->Visit(
+ "integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerate"
+ "d",
+ &properties
+ ->integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated) &&
+ visitor->Visit(
+ "integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAc"
+ "celerated",
+ &properties
+ ->integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated) &&
+ visitor->Visit(
+ "integerDotProductAccumulatingSaturating16BitUnsignedAccelerated",
+ &properties
+ ->integerDotProductAccumulatingSaturating16BitUnsignedAccelerated) &&
+ visitor->Visit(
+ "integerDotProductAccumulatingSaturating16BitSignedAccelerated",
+ &properties
+ ->integerDotProductAccumulatingSaturating16BitSignedAccelerated) &&
+ visitor->Visit(
+ "integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerat"
+ "ed",
+ &properties
+ ->integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated) &&
+ visitor->Visit(
+ "integerDotProductAccumulatingSaturating32BitUnsignedAccelerated",
+ &properties
+ ->integerDotProductAccumulatingSaturating32BitUnsignedAccelerated) &&
+ visitor->Visit(
+ "integerDotProductAccumulatingSaturating32BitSignedAccelerated",
+ &properties
+ ->integerDotProductAccumulatingSaturating32BitSignedAccelerated) &&
+ visitor->Visit(
+ "integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerat"
+ "ed",
+ &properties
+ ->integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated) &&
+ visitor->Visit(
+ "integerDotProductAccumulatingSaturating64BitUnsignedAccelerated",
+ &properties
+ ->integerDotProductAccumulatingSaturating64BitUnsignedAccelerated) &&
+ visitor->Visit(
+ "integerDotProductAccumulatingSaturating64BitSignedAccelerated",
+ &properties
+ ->integerDotProductAccumulatingSaturating64BitSignedAccelerated) &&
+ visitor->Visit(
+ "integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerat"
+ "ed",
+ &properties
+ ->integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated) &&
+ visitor->Visit("storageTexelBufferOffsetAlignmentBytes",
+ &properties->storageTexelBufferOffsetAlignmentBytes) &&
+ visitor->Visit(
+ "storageTexelBufferOffsetSingleTexelAlignment",
+ &properties->storageTexelBufferOffsetSingleTexelAlignment) &&
+ visitor->Visit("uniformTexelBufferOffsetAlignmentBytes",
+ &properties->uniformTexelBufferOffsetAlignmentBytes) &&
+ visitor->Visit(
+ "uniformTexelBufferOffsetSingleTexelAlignment",
+ &properties->uniformTexelBufferOffsetSingleTexelAlignment) &&
+ visitor->Visit("maxBufferSize", &properties->maxBufferSize);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDeviceVulkan13Features* features) {
+ return
+
+ visitor->Visit("robustImageAccess", &features->robustImageAccess) &&
+ visitor->Visit("inlineUniformBlock", &features->inlineUniformBlock) &&
+ visitor->Visit(
+ "descriptorBindingInlineUniformBlockUpdateAfterBind",
+ &features->descriptorBindingInlineUniformBlockUpdateAfterBind) &&
+ visitor->Visit("pipelineCreationCacheControl",
+ &features->pipelineCreationCacheControl) &&
+ visitor->Visit("privateData", &features->privateData) &&
+ visitor->Visit("shaderDemoteToHelperInvocation",
+ &features->shaderDemoteToHelperInvocation) &&
+ visitor->Visit("shaderTerminateInvocation",
+ &features->shaderTerminateInvocation) &&
+ visitor->Visit("subgroupSizeControl", &features->subgroupSizeControl) &&
+ visitor->Visit("computeFullSubgroups", &features->computeFullSubgroups) &&
+ visitor->Visit("synchronization2", &features->synchronization2) &&
+ visitor->Visit("textureCompressionASTC_HDR",
+ &features->textureCompressionASTC_HDR) &&
+ visitor->Visit("shaderZeroInitializeWorkgroupMemory",
+ &features->shaderZeroInitializeWorkgroupMemory) &&
+ visitor->Visit("dynamicRendering", &features->dynamicRendering) &&
+ visitor->Visit("shaderIntegerDotProduct",
+ &features->shaderIntegerDotProduct) &&
+ visitor->Visit("maintenance4", &features->maintenance4);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDeviceVulkan14Properties* properties) {
+ return
+
+ visitor->Visit("lineSubPixelPrecisionBits",
+ &properties->lineSubPixelPrecisionBits) &&
+ visitor->Visit("maxVertexAttribDivisor",
+ &properties->maxVertexAttribDivisor) &&
+ visitor->Visit("supportsNonZeroFirstInstance",
+ &properties->supportsNonZeroFirstInstance) &&
+ visitor->Visit("maxPushDescriptors", &properties->maxPushDescriptors) &&
+ visitor->Visit(
+ "dynamicRenderingLocalReadDepthStencilAttachments",
+ &properties->dynamicRenderingLocalReadDepthStencilAttachments) &&
+ visitor->Visit(
+ "dynamicRenderingLocalReadMultisampledAttachments",
+ &properties->dynamicRenderingLocalReadMultisampledAttachments) &&
+ visitor->Visit(
+ "earlyFragmentMultisampleCoverageAfterSampleCounting",
+ &properties->earlyFragmentMultisampleCoverageAfterSampleCounting) &&
+ visitor->Visit(
+ "earlyFragmentSampleMaskTestBeforeSampleCounting",
+ &properties->earlyFragmentSampleMaskTestBeforeSampleCounting) &&
+ visitor->Visit("depthStencilSwizzleOneSupport",
+ &properties->depthStencilSwizzleOneSupport) &&
+ visitor->Visit("polygonModePointSize",
+ &properties->polygonModePointSize) &&
+ visitor->Visit(
+ "nonStrictSinglePixelWideLinesUseParallelogram",
+ &properties->nonStrictSinglePixelWideLinesUseParallelogram) &&
+ visitor->Visit("nonStrictWideLinesUseParallelogram",
+ &properties->nonStrictWideLinesUseParallelogram) &&
+ visitor->Visit("blockTexelViewCompatibleMultipleLayers",
+ &properties->blockTexelViewCompatibleMultipleLayers) &&
+ visitor->Visit("maxCombinedImageSamplerDescriptorCount",
+ &properties->maxCombinedImageSamplerDescriptorCount) &&
+ visitor->Visit("fragmentShadingRateClampCombinerInputs",
+ &properties->fragmentShadingRateClampCombinerInputs) &&
+ visitor->Visit("defaultRobustnessStorageBuffers",
+ &properties->defaultRobustnessStorageBuffers) &&
+ visitor->Visit("defaultRobustnessUniformBuffers",
+ &properties->defaultRobustnessUniformBuffers) &&
+ visitor->Visit("defaultRobustnessVertexInputs",
+ &properties->defaultRobustnessVertexInputs) &&
+ visitor->Visit("defaultRobustnessImages",
+ &properties->defaultRobustnessImages) &&
+ visitor->Visit("copySrcLayoutCount", &properties->copySrcLayoutCount) &&
+ visitor->VisitArray("pCopySrcLayouts", properties->copySrcLayoutCount,
+ &properties->pCopySrcLayouts) &&
+ visitor->Visit("copyDstLayoutCount", &properties->copyDstLayoutCount) &&
+ visitor->VisitArray("pCopyDstLayouts", properties->copyDstLayoutCount,
+ &properties->pCopyDstLayouts) &&
+ visitor->Visit("optimalTilingLayoutUUID",
+ &properties->optimalTilingLayoutUUID) &&
+ visitor->Visit("identicalMemoryTypeRequirements",
+ &properties->identicalMemoryTypeRequirements);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDeviceVulkan14Features* features) {
+ return
+
+ visitor->Visit("globalPriorityQuery", &features->globalPriorityQuery) &&
+ visitor->Visit("shaderSubgroupRotate", &features->shaderSubgroupRotate) &&
+ visitor->Visit("shaderSubgroupRotateClustered",
+ &features->shaderSubgroupRotateClustered) &&
+ visitor->Visit("shaderFloatControls2", &features->shaderFloatControls2) &&
+ visitor->Visit("shaderExpectAssume", &features->shaderExpectAssume) &&
+ visitor->Visit("rectangularLines", &features->rectangularLines) &&
+ visitor->Visit("bresenhamLines", &features->bresenhamLines) &&
+ visitor->Visit("smoothLines", &features->smoothLines) &&
+ visitor->Visit("stippledRectangularLines",
+ &features->stippledRectangularLines) &&
+ visitor->Visit("stippledBresenhamLines",
+ &features->stippledBresenhamLines) &&
+ visitor->Visit("stippledSmoothLines", &features->stippledSmoothLines) &&
+ visitor->Visit("vertexAttributeInstanceRateDivisor",
+ &features->vertexAttributeInstanceRateDivisor) &&
+ visitor->Visit("vertexAttributeInstanceRateZeroDivisor",
+ &features->vertexAttributeInstanceRateZeroDivisor) &&
+ visitor->Visit("indexTypeUint8", &features->indexTypeUint8) &&
+ visitor->Visit("dynamicRenderingLocalRead",
+ &features->dynamicRenderingLocalRead) &&
+ visitor->Visit("maintenance5", &features->maintenance5) &&
+ visitor->Visit("maintenance6", &features->maintenance6) &&
+ visitor->Visit("pipelineProtectedAccess",
+ &features->pipelineProtectedAccess) &&
+ visitor->Visit("pipelineRobustness", &features->pipelineRobustness) &&
+ visitor->Visit("hostImageCopy", &features->hostImageCopy);
+}
+
+template <typename Visitor>
+inline bool Iterate(Visitor* visitor,
+ VkPhysicalDeviceDriverProperties* properties) {
+ return
+
+ visitor->Visit("driverID", &properties->driverID) &&
+ visitor->Visit("driverName", &properties->driverName) &&
+ visitor->Visit("driverInfo", &properties->driverInfo) &&
+ visitor->Visit("conformanceVersion", &properties->conformanceVersion);
}
template <typename Visitor>
@@ -1154,39 +1929,6 @@
}
template <typename Visitor>
-inline bool Iterate(Visitor* visitor, VkQueueFamilyProperties* properties) {
- return
- visitor->Visit("queueFlags", &properties->queueFlags) &&
- visitor->Visit("queueCount", &properties->queueCount) &&
- visitor->Visit("timestampValidBits", &properties->timestampValidBits) &&
- visitor->Visit("minImageTransferGranularity", &properties->minImageTransferGranularity);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor, VkExtensionProperties* properties) {
- return
- visitor->Visit("extensionName", &properties->extensionName) &&
- visitor->Visit("specVersion", &properties->specVersion);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor, VkLayerProperties* properties) {
- return
- visitor->Visit("layerName", &properties->layerName) &&
- visitor->Visit("specVersion", &properties->specVersion) &&
- visitor->Visit("implementationVersion", &properties->implementationVersion) &&
- visitor->Visit("description", &properties->description);
-}
-
-template <typename Visitor>
-inline bool Iterate(Visitor* visitor, VkFormatProperties* properties) {
- return
- visitor->Visit("linearTilingFeatures", &properties->linearTilingFeatures) &&
- visitor->Visit("optimalTilingFeatures", &properties->optimalTilingFeatures) &&
- visitor->Visit("bufferFeatures", &properties->bufferFeatures);
-}
-
-template <typename Visitor>
inline bool Iterate(Visitor* visitor, VkJsonLayer* layer) {
return visitor->Visit("properties", &layer->properties) &&
visitor->Visit("extensions", &layer->extensions);
@@ -1211,6 +1953,7 @@
ret &= visitor->Visit("core13", &device->core13);
FALLTHROUGH_INTENDED;
case VK_API_VERSION_1_2:
+ ret &= visitor->Visit("core11", &device->core11);
ret &= visitor->Visit("core12", &device->core12);
FALLTHROUGH_INTENDED;
case VK_API_VERSION_1_1:
@@ -1223,17 +1966,17 @@
visitor->Visit("idProperties", &device->id_properties) &&
visitor->Visit("maintenance3Properties",
&device->maintenance3_properties) &&
- visitor->Visit("16bitStorageFeatures",
- &device->bit16_storage_features) &&
visitor->Visit("multiviewFeatures", &device->multiview_features) &&
- visitor->Visit("variablePointerFeatures",
- &device->variable_pointer_features) &&
+ visitor->Visit("variablePointersFeatures",
+ &device->variable_pointers_features) &&
visitor->Visit("protectedMemoryFeatures",
&device->protected_memory_features) &&
visitor->Visit("samplerYcbcrConversionFeatures",
&device->sampler_ycbcr_conversion_features) &&
visitor->Visit("shaderDrawParameterFeatures",
&device->shader_draw_parameter_features) &&
+ visitor->Visit("bit16StorageFeatures",
+ &device->bit16_storage_features) &&
visitor->Visit("externalFenceProperties",
&device->external_fence_properties) &&
visitor->Visit("externalSemaphoreProperties",
@@ -1247,21 +1990,90 @@
visitor->Visit("extensions", &device->extensions) &&
visitor->Visit("layers", &device->layers) &&
visitor->Visit("formats", &device->formats);
- if (device->ext_driver_properties.reported) {
- ret &= visitor->Visit("VK_KHR_driver_properties",
- &device->ext_driver_properties);
- }
- if (device->ext_variable_pointer_features.reported) {
+
+ if (device->khr_variable_pointers.reported) {
ret &= visitor->Visit("VK_KHR_variable_pointers",
- &device->ext_variable_pointer_features);
+ &device->khr_variable_pointers);
}
- if (device->ext_image_2d_view_of_3d_features.reported) {
- ret &= visitor->Visit("VK_EXT_image_2d_view_of_3d",
- &device->ext_image_2d_view_of_3d_features);
- }
- if (device->ext_shader_float16_int8_features.reported) {
+ if (device->khr_shader_float16_int8.reported) {
ret &= visitor->Visit("VK_KHR_shader_float16_int8",
- &device->ext_shader_float16_int8_features);
+ &device->khr_shader_float16_int8);
+ }
+ if (device->ext_image_2d_view_of_3d.reported) {
+ ret &= visitor->Visit("VK_EXT_image_2d_view_of_3d",
+ &device->ext_image_2d_view_of_3d);
+ }
+ if (device->ext_custom_border_color.reported) {
+ ret &= visitor->Visit("VK_EXT_custom_border_color",
+ &device->ext_custom_border_color);
+ }
+ if (device->ext_primitive_topology_list_restart.reported) {
+ ret &= visitor->Visit("VK_EXT_primitive_topology_list_restart",
+ &device->ext_primitive_topology_list_restart);
+ }
+ if (device->ext_provoking_vertex.reported) {
+ ret &= visitor->Visit("VK_EXT_provoking_vertex",
+ &device->ext_provoking_vertex);
+ }
+ if (device->khr_index_type_uint8.reported) {
+ ret &= visitor->Visit("VK_KHR_index_type_uint8",
+ &device->khr_index_type_uint8);
+ }
+ if (device->ext_index_type_uint8.reported) {
+ ret &= visitor->Visit("VK_EXT_index_type_uint8",
+ &device->ext_index_type_uint8);
+ }
+ if (device->khr_vertex_attribute_divisor.reported) {
+ ret &= visitor->Visit("VK_KHR_vertex_attribute_divisor",
+ &device->khr_vertex_attribute_divisor);
+ }
+ if (device->ext_vertex_attribute_divisor.reported) {
+ ret &= visitor->Visit("VK_EXT_vertex_attribute_divisor",
+ &device->ext_vertex_attribute_divisor);
+ }
+ if (device->ext_transform_feedback.reported) {
+ ret &= visitor->Visit("VK_EXT_transform_feedback",
+ &device->ext_transform_feedback);
+ }
+ if (device->khr_shader_subgroup_uniform_control_flow.reported) {
+ ret &=
+ visitor->Visit("VK_KHR_shader_subgroup_uniform_control_flow",
+ &device->khr_shader_subgroup_uniform_control_flow);
+ }
+ if (device->khr_shader_subgroup_extended_types.reported) {
+ ret &= visitor->Visit("VK_KHR_shader_subgroup_extended_types",
+ &device->khr_shader_subgroup_extended_types);
+ }
+ if (device->khr_8bit_storage.reported) {
+ ret &= visitor->Visit("VK_KHR_8bit_storage", &device->khr_8bit_storage);
+ }
+ if (device->khr_shader_integer_dot_product.reported) {
+ ret &= visitor->Visit("VK_KHR_shader_integer_dot_product",
+ &device->khr_shader_integer_dot_product);
+ }
+ if (device->img_relaxed_line_rasterization.reported) {
+ ret &= visitor->Visit("VK_IMG_relaxed_line_rasterization",
+ &device->img_relaxed_line_rasterization);
+ }
+ if (device->khr_line_rasterization.reported) {
+ ret &= visitor->Visit("VK_KHR_line_rasterization",
+ &device->khr_line_rasterization);
+ }
+ if (device->ext_line_rasterization.reported) {
+ ret &= visitor->Visit("VK_EXT_line_rasterization",
+ &device->ext_line_rasterization);
+ }
+ if (device->ext_primitives_generated_query.reported) {
+ ret &= visitor->Visit("VK_EXT_primitives_generated_query",
+ &device->ext_primitives_generated_query);
+ }
+ if (device->khr_shader_float_controls.reported) {
+ ret &= visitor->Visit("VK_KHR_shader_float_controls",
+ &device->khr_shader_float_controls);
+ }
+ if (device->khr_driver_properties.reported) {
+ ret &= visitor->Visit("VK_KHR_driver_properties",
+ &device->khr_driver_properties);
}
}
return ret;
@@ -1319,7 +2131,9 @@
return Json::Value(string);
}
-template <typename T, typename = EnableForEnum<T>, typename = void,
+template <typename T,
+ typename = EnableForEnum<T>,
+ typename = void,
typename = void>
inline Json::Value ToJsonValue(const T& value) {
return Json::Value(static_cast<double>(value));
@@ -1328,7 +2142,8 @@
template <typename T>
inline Json::Value ArrayToJsonValue(uint32_t count, const T* values) {
Json::Value array(Json::arrayValue);
- for (unsigned int i = 0; i < count; ++i) array.append(ToJsonValue(values[i]));
+ for (unsigned int i = 0; i < count; ++i)
+ array.append(ToJsonValue(values[i]));
return array;
}
@@ -1360,7 +2175,8 @@
template <typename F, typename S>
inline Json::Value ToJsonValue(const std::map<F, S>& value) {
Json::Value array(Json::arrayValue);
- for (auto& kv : value) array.append(ToJsonValue(kv));
+ for (auto& kv : value)
+ array.append(ToJsonValue(kv));
return array;
}
@@ -1370,7 +2186,8 @@
~JsonWriterVisitor() {}
- template <typename T> bool Visit(const char* key, const T* value) {
+ template <typename T>
+ bool Visit(const char* key, const T* value) {
object_[key] = ToJsonValue(*value);
return true;
}
@@ -1383,7 +2200,7 @@
}
template <typename T>
- bool VisitArray(const char* key, uint32_t count, const T *value) {
+ bool VisitArray(const char* key, uint32_t count, const T* value) {
object_[key] = ArrayToJsonValue(count, *value);
return true;
}
@@ -1410,7 +2227,8 @@
bool AsValue(Json::Value* json_value, T* t);
inline bool AsValue(Json::Value* json_value, int32_t* value) {
- if (json_value->type() != Json::realValue) return false;
+ if (json_value->type() != Json::realValue)
+ return false;
double d = json_value->asDouble();
if (!IsIntegral(d) ||
d < static_cast<double>(std::numeric_limits<int32_t>::min()) ||
@@ -1421,14 +2239,16 @@
}
inline bool AsValue(Json::Value* json_value, uint64_t* value) {
- if (json_value->type() != Json::stringValue) return false;
+ if (json_value->type() != Json::stringValue)
+ return false;
int result =
std::sscanf(json_value->asString().c_str(), "0x%016" PRIx64, value);
return result == 1;
}
inline bool AsValue(Json::Value* json_value, uint32_t* value) {
- if (json_value->type() != Json::realValue) return false;
+ if (json_value->type() != Json::realValue)
+ return false;
double d = json_value->asDouble();
if (!IsIntegral(d) || d < 0.0 ||
d > static_cast<double>(std::numeric_limits<uint32_t>::max()))
@@ -1447,7 +2267,8 @@
}
inline bool AsValue(Json::Value* json_value, float* value) {
- if (json_value->type() != Json::realValue) return false;
+ if (json_value->type() != Json::realValue)
+ return false;
*value = static_cast<float>(json_value->asDouble());
return true;
}
@@ -1456,7 +2277,8 @@
uint32_t value = 0;
if (!AsValue(json_value, &value))
return false;
- if (!EnumTraits<VkImageLayout>::exist(value)) return false;
+ if (!EnumTraits<VkImageLayout>::exist(value))
+ return false;
*t = static_cast<VkImageLayout>(value);
return true;
}
@@ -1466,7 +2288,8 @@
if (json_value->type() != Json::arrayValue || json_value->size() != count)
return false;
for (uint32_t i = 0; i < count; ++i) {
- if (!AsValue(&(*json_value)[i], values + i)) return false;
+ if (!AsValue(&(*json_value)[i], values + i))
+ return false;
}
return true;
}
@@ -1478,12 +2301,13 @@
template <size_t N>
inline bool AsValue(Json::Value* json_value, char (*value)[N]) {
- if (json_value->type() != Json::stringValue) return false;
+ if (json_value->type() != Json::stringValue)
+ return false;
size_t len = json_value->asString().length();
if (len >= N)
return false;
memcpy(*value, json_value->asString().c_str(), len);
- memset(*value + len, 0, N-len);
+ memset(*value + len, 0, N - len);
return true;
}
@@ -1491,15 +2315,17 @@
inline bool AsValue(Json::Value* json_value, T* t) {
uint32_t value = 0;
if (!AsValue(json_value, &value))
- return false;
- if (!EnumTraits<T>::exist(value)) return false;
+ return false;
+ if (!EnumTraits<T>::exist(value))
+ return false;
*t = static_cast<T>(value);
return true;
}
template <typename T>
inline bool AsValue(Json::Value* json_value, std::vector<T>* value) {
- if (json_value->type() != Json::arrayValue) return false;
+ if (json_value->type() != Json::arrayValue)
+ return false;
int size = json_value->size();
value->resize(size);
return AsArray(json_value, size, value->data());
@@ -1515,11 +2341,13 @@
template <typename F, typename S>
inline bool AsValue(Json::Value* json_value, std::map<F, S>* value) {
- if (json_value->type() != Json::arrayValue) return false;
+ if (json_value->type() != Json::arrayValue)
+ return false;
int size = json_value->size();
for (int i = 0; i < size; ++i) {
std::pair<F, S> elem;
- if (!AsValue(&(*json_value)[i], &elem)) return false;
+ if (!AsValue(&(*json_value)[i], &elem))
+ return false;
if (!value->insert(elem).second)
return false;
}
@@ -1527,7 +2355,9 @@
}
template <typename T>
-bool ReadValue(Json::Value* object, const char* key, T* value,
+bool ReadValue(Json::Value* object,
+ const char* key,
+ T* value,
std::string* errors) {
Json::Value json_value = (*object)[key];
if (!json_value) {
@@ -1535,7 +2365,8 @@
*errors = std::string(key) + " missing.";
return false;
}
- if (AsValue(&json_value, value)) return true;
+ if (AsValue(&json_value, value))
+ return true;
if (errors)
*errors = std::string("Wrong type for ") + std::string(key) + ".";
return false;
@@ -1551,7 +2382,8 @@
JsonReaderVisitor(Json::Value* object, std::string* errors)
: object_(object), errors_(errors) {}
- template <typename T> bool Visit(const char* key, T* value) const {
+ template <typename T>
+ bool Visit(const char* key, T* value) const {
return ReadValue(object_, key, value, errors_);
}
@@ -1565,27 +2397,28 @@
*errors_ = std::string(key) + " missing.";
return false;
}
- if (AsArray(&json_value, count, *value)) return true;
+ if (AsArray(&json_value, count, *value))
+ return true;
if (errors_)
*errors_ = std::string("Wrong type for ") + std::string(key) + ".";
return false;
}
template <typename T>
- bool VisitArray(const char* key, uint32_t count, T *value) {
+ bool VisitArray(const char* key, uint32_t count, T* value) {
Json::Value json_value = (*object_)[key];
if (!json_value) {
if (errors_)
*errors_ = std::string(key) + " missing.";
return false;
}
- if (AsArray(&json_value, count, *value)) return true;
+ if (AsArray(&json_value, count, *value))
+ return true;
if (errors_)
*errors_ = std::string("Wrong type for ") + std::string(key) + ".";
return false;
}
-
private:
Json::Value* object_;
std::string* errors_;
@@ -1593,21 +2426,21 @@
template <typename T, typename /*= EnableForStruct<T>*/>
bool AsValue(Json::Value* json_value, T* t) {
- if (json_value->type() != Json::objectValue) return false;
+ if (json_value->type() != Json::objectValue)
+ return false;
JsonReaderVisitor visitor(json_value, nullptr);
return VisitForRead(&visitor, t);
}
-
-template <typename T> std::string VkTypeToJson(const T& t) {
+template <typename T>
+std::string VkTypeToJson(const T& t) {
JsonWriterVisitor visitor;
VisitForWrite(&visitor, t);
return visitor.get_object().toStyledString();
}
-template <typename T> bool VkTypeFromJson(const std::string& json,
- T* t,
- std::string* errors) {
+template <typename T>
+bool VkTypeFromJson(const std::string& json, T* t, std::string* errors) {
*t = T();
Json::Value object(Json::objectValue);
Json::CharReaderBuilder builder;
diff --git a/vulkan/vkjson/vkjson.h b/vulkan/vkjson/vkjson.h
index 87a76c1..d74644c 100644
--- a/vulkan/vkjson/vkjson.h
+++ b/vulkan/vkjson/vkjson.h
@@ -21,8 +21,8 @@
#ifndef VKJSON_H_
#define VKJSON_H_
-#include <vulkan/vulkan.h>
#include <string.h>
+#include <vulkan/vulkan.h>
#include <map>
#include <string>
@@ -38,8 +38,222 @@
std::vector<VkExtensionProperties> extensions;
};
-struct VkJsonExtDriverProperties {
- VkJsonExtDriverProperties() {
+struct VkJsonKHRVariablePointers {
+ VkJsonKHRVariablePointers() {
+ reported = false;
+ memset(&variable_pointer_features_khr, 0,
+ sizeof(VkPhysicalDeviceVariablePointerFeaturesKHR));
+ memset(&variable_pointers_features_khr, 0,
+ sizeof(VkPhysicalDeviceVariablePointersFeaturesKHR));
+ }
+ bool reported;
+ VkPhysicalDeviceVariablePointerFeaturesKHR variable_pointer_features_khr;
+ VkPhysicalDeviceVariablePointersFeaturesKHR variable_pointers_features_khr;
+};
+
+struct VkJsonKHRShaderFloat16Int8 {
+ VkJsonKHRShaderFloat16Int8() {
+ reported = false;
+ memset(&shader_float16_int8_features_khr, 0,
+ sizeof(VkPhysicalDeviceShaderFloat16Int8FeaturesKHR));
+ memset(&float16_int8_features_khr, 0,
+ sizeof(VkPhysicalDeviceFloat16Int8FeaturesKHR));
+ }
+ bool reported;
+ VkPhysicalDeviceShaderFloat16Int8FeaturesKHR shader_float16_int8_features_khr;
+ VkPhysicalDeviceFloat16Int8FeaturesKHR float16_int8_features_khr;
+};
+
+struct VkJsonExtImage2dViewOf3d {
+ VkJsonExtImage2dViewOf3d() {
+ reported = false;
+ memset(&image_2d_view_of_3d_features_ext, 0,
+ sizeof(VkPhysicalDeviceImage2DViewOf3DFeaturesEXT));
+ }
+ bool reported;
+ VkPhysicalDeviceImage2DViewOf3DFeaturesEXT image_2d_view_of_3d_features_ext;
+};
+
+struct VkJsonExtCustomBorderColor {
+ VkJsonExtCustomBorderColor() {
+ reported = false;
+ memset(&custom_border_color_features_ext, 0,
+ sizeof(VkPhysicalDeviceCustomBorderColorFeaturesEXT));
+ }
+ bool reported;
+ VkPhysicalDeviceCustomBorderColorFeaturesEXT custom_border_color_features_ext;
+};
+
+struct VkJsonExtPrimitiveTopologyListRestart {
+ VkJsonExtPrimitiveTopologyListRestart() {
+ reported = false;
+ memset(&primitive_topology_list_restart_features_ext, 0,
+ sizeof(VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT));
+ }
+ bool reported;
+ VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT
+ primitive_topology_list_restart_features_ext;
+};
+
+struct VkJsonExtProvokingVertex {
+ VkJsonExtProvokingVertex() {
+ reported = false;
+ memset(&provoking_vertex_features_ext, 0,
+ sizeof(VkPhysicalDeviceProvokingVertexFeaturesEXT));
+ }
+ bool reported;
+ VkPhysicalDeviceProvokingVertexFeaturesEXT provoking_vertex_features_ext;
+};
+
+struct VkJsonKHRIndexTypeUint8 {
+ VkJsonKHRIndexTypeUint8() {
+ reported = false;
+ memset(&index_type_uint8_features_khr, 0,
+ sizeof(VkPhysicalDeviceIndexTypeUint8FeaturesKHR));
+ }
+ bool reported;
+ VkPhysicalDeviceIndexTypeUint8FeaturesKHR index_type_uint8_features_khr;
+};
+
+struct VkJsonExtIndexTypeUint8 {
+ VkJsonExtIndexTypeUint8() {
+ reported = false;
+ memset(&index_type_uint8_features_ext, 0,
+ sizeof(VkPhysicalDeviceIndexTypeUint8FeaturesEXT));
+ }
+ bool reported;
+ VkPhysicalDeviceIndexTypeUint8FeaturesEXT index_type_uint8_features_ext;
+};
+
+struct VkJsonKHRVertexAttributeDivisor {
+ VkJsonKHRVertexAttributeDivisor() {
+ reported = false;
+ memset(&vertex_attribute_divisor_features_khr, 0,
+ sizeof(VkPhysicalDeviceVertexAttributeDivisorFeaturesKHR));
+ }
+ bool reported;
+ VkPhysicalDeviceVertexAttributeDivisorFeaturesKHR
+ vertex_attribute_divisor_features_khr;
+};
+
+struct VkJsonExtVertexAttributeDivisor {
+ VkJsonExtVertexAttributeDivisor() {
+ reported = false;
+ memset(&vertex_attribute_divisor_features_ext, 0,
+ sizeof(VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT));
+ }
+ bool reported;
+ VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT
+ vertex_attribute_divisor_features_ext;
+};
+
+struct VkJsonExtTransformFeedback {
+ VkJsonExtTransformFeedback() {
+ reported = false;
+ memset(&transform_feedback_features_ext, 0,
+ sizeof(VkPhysicalDeviceTransformFeedbackFeaturesEXT));
+ }
+ bool reported;
+ VkPhysicalDeviceTransformFeedbackFeaturesEXT transform_feedback_features_ext;
+};
+
+struct VkJsonKHRShaderSubgroupUniformControlFlow {
+ VkJsonKHRShaderSubgroupUniformControlFlow() {
+ reported = false;
+ memset(&shader_subgroup_uniform_control_flow_features_khr, 0,
+ sizeof(VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR));
+ }
+ bool reported;
+ VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR
+ shader_subgroup_uniform_control_flow_features_khr;
+};
+
+struct VkJsonKHRShaderSubgroupExtendedTypes {
+ VkJsonKHRShaderSubgroupExtendedTypes() {
+ reported = false;
+ memset(&shader_subgroup_extended_types_features_khr, 0,
+ sizeof(VkPhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR));
+ }
+ bool reported;
+ VkPhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR
+ shader_subgroup_extended_types_features_khr;
+};
+
+struct VkJsonKHR8bitStorage {
+ VkJsonKHR8bitStorage() {
+ reported = false;
+ memset(&bit8_storage_features_khr, 0,
+ sizeof(VkPhysicalDevice8BitStorageFeaturesKHR));
+ }
+ bool reported;
+ VkPhysicalDevice8BitStorageFeaturesKHR bit8_storage_features_khr;
+};
+
+struct VkJsonKHRShaderIntegerDotProduct {
+ VkJsonKHRShaderIntegerDotProduct() {
+ reported = false;
+ memset(&shader_integer_dot_product_features_khr, 0,
+ sizeof(VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR));
+ }
+ bool reported;
+ VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR
+ shader_integer_dot_product_features_khr;
+};
+
+struct VkJsonIMGRelaxedLineRasterization {
+ VkJsonIMGRelaxedLineRasterization() {
+ reported = false;
+ memset(&relaxed_line_rasterization_features_img, 0,
+ sizeof(VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG));
+ }
+ bool reported;
+ VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG
+ relaxed_line_rasterization_features_img;
+};
+
+struct VkJsonKHRLineRasterization {
+ VkJsonKHRLineRasterization() {
+ reported = false;
+ memset(&line_rasterization_features_khr, 0,
+ sizeof(VkPhysicalDeviceLineRasterizationFeaturesKHR));
+ }
+ bool reported;
+ VkPhysicalDeviceLineRasterizationFeaturesKHR line_rasterization_features_khr;
+};
+
+struct VkJsonExtLineRasterization {
+ VkJsonExtLineRasterization() {
+ reported = false;
+ memset(&line_rasterization_features_ext, 0,
+ sizeof(VkPhysicalDeviceLineRasterizationFeaturesEXT));
+ }
+ bool reported;
+ VkPhysicalDeviceLineRasterizationFeaturesEXT line_rasterization_features_ext;
+};
+
+struct VkJsonExtPrimitivesGeneratedQuery {
+ VkJsonExtPrimitivesGeneratedQuery() {
+ reported = false;
+ memset(&primitives_generated_query_features_ext, 0,
+ sizeof(VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT));
+ }
+ bool reported;
+ VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT
+ primitives_generated_query_features_ext;
+};
+
+struct VkJsonKHRShaderFloatControls {
+ VkJsonKHRShaderFloatControls() {
+ reported = false;
+ memset(&float_controls_properties_khr, 0,
+ sizeof(VkPhysicalDeviceFloatControlsPropertiesKHR));
+ }
+ bool reported;
+ VkPhysicalDeviceFloatControlsPropertiesKHR float_controls_properties_khr;
+};
+
+struct VkJsonKHRDriverProperties {
+ VkJsonKHRDriverProperties() {
reported = false;
memset(&driver_properties_khr, 0,
sizeof(VkPhysicalDeviceDriverPropertiesKHR));
@@ -48,34 +262,9 @@
VkPhysicalDeviceDriverPropertiesKHR driver_properties_khr;
};
-struct VkJsonExtVariablePointerFeatures {
- VkJsonExtVariablePointerFeatures() {
- reported = false;
- memset(&variable_pointer_features_khr, 0,
- sizeof(VkPhysicalDeviceVariablePointerFeaturesKHR));
- }
- bool reported;
- VkPhysicalDeviceVariablePointerFeaturesKHR variable_pointer_features_khr;
-};
-
-struct VkJsonExtImage2DViewOf3DFeatures {
- VkJsonExtImage2DViewOf3DFeatures() {
- reported = false;
- memset(&image_2D_view_of_3D_features_EXT, 0,
- sizeof(VkPhysicalDeviceImage2DViewOf3DFeaturesEXT));
- }
- bool reported;
- VkPhysicalDeviceImage2DViewOf3DFeaturesEXT image_2D_view_of_3D_features_EXT;
-};
-
-struct VkJsonExtShaderFloat16Int8Features {
- VkJsonExtShaderFloat16Int8Features() {
- reported = false;
- memset(&shader_float16_int8_features_khr, 0,
- sizeof(VkPhysicalDeviceShaderFloat16Int8FeaturesKHR));
- }
- bool reported;
- VkPhysicalDeviceShaderFloat16Int8FeaturesKHR shader_float16_int8_features_khr;
+struct VkJsonCore11 {
+ VkPhysicalDeviceVulkan11Properties properties;
+ VkPhysicalDeviceVulkan11Features features;
};
struct VkJsonCore12 {
@@ -109,29 +298,48 @@
memset(&bit16_storage_features, 0,
sizeof(VkPhysicalDevice16BitStorageFeatures));
memset(&multiview_features, 0, sizeof(VkPhysicalDeviceMultiviewFeatures));
- memset(&variable_pointer_features, 0,
- sizeof(VkPhysicalDeviceVariablePointerFeatures));
+ memset(&variable_pointers_features, 0,
+ sizeof(VkPhysicalDeviceVariablePointersFeatures));
memset(&protected_memory_features, 0,
sizeof(VkPhysicalDeviceProtectedMemoryFeatures));
memset(&sampler_ycbcr_conversion_features, 0,
sizeof(VkPhysicalDeviceSamplerYcbcrConversionFeatures));
memset(&shader_draw_parameter_features, 0,
sizeof(VkPhysicalDeviceShaderDrawParameterFeatures));
+ memset(&core11, 0, sizeof(VkJsonCore11));
memset(&core12, 0, sizeof(VkJsonCore12));
memset(&core13, 0, sizeof(VkJsonCore13));
memset(&core14, 0, sizeof(VkJsonCore14));
}
+ VkJsonKHRVariablePointers khr_variable_pointers;
+ VkJsonKHRShaderFloat16Int8 khr_shader_float16_int8;
+ VkJsonExtImage2dViewOf3d ext_image_2d_view_of_3d;
+ VkJsonExtCustomBorderColor ext_custom_border_color;
+ VkJsonExtPrimitiveTopologyListRestart ext_primitive_topology_list_restart;
+ VkJsonExtProvokingVertex ext_provoking_vertex;
+ VkJsonKHRIndexTypeUint8 khr_index_type_uint8;
+ VkJsonExtIndexTypeUint8 ext_index_type_uint8;
+ VkJsonKHRVertexAttributeDivisor khr_vertex_attribute_divisor;
+ VkJsonExtVertexAttributeDivisor ext_vertex_attribute_divisor;
+ VkJsonExtTransformFeedback ext_transform_feedback;
+ VkJsonKHRShaderSubgroupUniformControlFlow
+ khr_shader_subgroup_uniform_control_flow;
+ VkJsonKHRShaderSubgroupExtendedTypes khr_shader_subgroup_extended_types;
+ VkJsonKHR8bitStorage khr_8bit_storage;
+ VkJsonKHRShaderIntegerDotProduct khr_shader_integer_dot_product;
+ VkJsonIMGRelaxedLineRasterization img_relaxed_line_rasterization;
+ VkJsonKHRLineRasterization khr_line_rasterization;
+ VkJsonExtLineRasterization ext_line_rasterization;
+ VkJsonExtPrimitivesGeneratedQuery ext_primitives_generated_query;
+ VkJsonKHRShaderFloatControls khr_shader_float_controls;
+ VkJsonKHRDriverProperties khr_driver_properties;
+ VkJsonCore11 core11;
+ VkJsonCore12 core12;
+ VkJsonCore13 core13;
+ VkJsonCore14 core14;
VkPhysicalDeviceProperties properties;
VkPhysicalDeviceFeatures features;
- VkJsonExtDriverProperties ext_driver_properties;
- VkJsonExtVariablePointerFeatures ext_variable_pointer_features;
- VkJsonExtImage2DViewOf3DFeatures ext_image_2d_view_of_3d_features;
- VkJsonExtShaderFloat16Int8Features ext_shader_float16_int8_features;
VkPhysicalDeviceMemoryProperties memory;
- std::vector<VkQueueFamilyProperties> queues;
- std::vector<VkExtensionProperties> extensions;
- std::vector<VkLayerProperties> layers;
- std::map<VkFormat, VkFormatProperties> formats;
VkPhysicalDeviceSubgroupProperties subgroup_properties;
VkPhysicalDevicePointClippingProperties point_clipping_properties;
VkPhysicalDeviceMultiviewProperties multiview_properties;
@@ -139,18 +347,19 @@
VkPhysicalDeviceMaintenance3Properties maintenance3_properties;
VkPhysicalDevice16BitStorageFeatures bit16_storage_features;
VkPhysicalDeviceMultiviewFeatures multiview_features;
- VkPhysicalDeviceVariablePointerFeatures variable_pointer_features;
+ VkPhysicalDeviceVariablePointersFeatures variable_pointers_features;
VkPhysicalDeviceProtectedMemoryFeatures protected_memory_features;
VkPhysicalDeviceSamplerYcbcrConversionFeatures
sampler_ycbcr_conversion_features;
VkPhysicalDeviceShaderDrawParameterFeatures shader_draw_parameter_features;
+ std::vector<VkQueueFamilyProperties> queues;
+ std::vector<VkExtensionProperties> extensions;
+ std::vector<VkLayerProperties> layers;
+ std::map<VkFormat, VkFormatProperties> formats;
std::map<VkExternalFenceHandleTypeFlagBits, VkExternalFenceProperties>
external_fence_properties;
std::map<VkExternalSemaphoreHandleTypeFlagBits, VkExternalSemaphoreProperties>
external_semaphore_properties;
- VkJsonCore12 core12;
- VkJsonCore13 core13;
- VkJsonCore14 core14;
};
struct VkJsonDeviceGroup {
@@ -204,4 +413,4 @@
return VkJsonDeviceFromJson(json, properties, errors);
}
-#endif // VKJSON_H_
+#endif // VKJSON_H_
\ No newline at end of file
diff --git a/vulkan/vkjson/vkjson_instance.cc b/vulkan/vkjson/vkjson_instance.cc
index 04bb446..22b3204 100644
--- a/vulkan/vkjson/vkjson_instance.cc
+++ b/vulkan/vkjson/vkjson_instance.cc
@@ -79,13 +79,25 @@
nullptr,
{},
};
- if (HasExtension("VK_KHR_driver_properties", device.extensions)) {
- device.ext_driver_properties.reported = true;
- device.ext_driver_properties.driver_properties_khr.sType =
- VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR;
- device.ext_driver_properties.driver_properties_khr.pNext = properties.pNext;
- properties.pNext = &device.ext_driver_properties.driver_properties_khr;
+
+ if (HasExtension("VK_KHR_shader_float_controls", device.extensions)) {
+ device.khr_shader_float_controls.reported = true;
+ device.khr_shader_float_controls.float_controls_properties_khr.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES;
+ device.khr_shader_float_controls.float_controls_properties_khr.pNext =
+ properties.pNext;
+ properties.pNext =
+ &device.khr_shader_float_controls.float_controls_properties_khr;
}
+
+ if (HasExtension("VK_KHR_driver_properties", device.extensions)) {
+ device.khr_driver_properties.reported = true;
+ device.khr_driver_properties.driver_properties_khr.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES;
+ device.khr_driver_properties.driver_properties_khr.pNext = properties.pNext;
+ properties.pNext = &device.khr_driver_properties.driver_properties_khr;
+ }
+
vkGetPhysicalDeviceProperties2(physical_device, &properties);
device.properties = properties.properties;
@@ -94,35 +106,215 @@
nullptr,
{},
};
+
if (HasExtension("VK_KHR_variable_pointers", device.extensions)) {
- device.ext_variable_pointer_features.reported = true;
- device.ext_variable_pointer_features.variable_pointer_features_khr.sType =
- VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR;
- device.ext_variable_pointer_features.variable_pointer_features_khr.pNext =
+ device.khr_variable_pointers.reported = true;
+ device.khr_variable_pointers.variable_pointer_features_khr.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES;
+ device.khr_variable_pointers.variable_pointer_features_khr.pNext =
features.pNext;
features.pNext =
- &device.ext_variable_pointer_features.variable_pointer_features_khr;
+ &device.khr_variable_pointers.variable_pointer_features_khr;
+ device.khr_variable_pointers.variable_pointers_features_khr.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES;
+ device.khr_variable_pointers.variable_pointers_features_khr.pNext =
+ features.pNext;
+ features.pNext =
+ &device.khr_variable_pointers.variable_pointers_features_khr;
}
- if (HasExtension("VK_EXT_image_2d_view_of_3d", device.extensions)) {
- device.ext_image_2d_view_of_3d_features.reported = true;
- device.ext_image_2d_view_of_3d_features.image_2D_view_of_3D_features_EXT
- .sType =
- VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT;
- device.ext_image_2d_view_of_3d_features.image_2D_view_of_3D_features_EXT
- .pNext = features.pNext;
- features.pNext = &device.ext_image_2d_view_of_3d_features
- .image_2D_view_of_3D_features_EXT;
- }
+
if (HasExtension("VK_KHR_shader_float16_int8", device.extensions)) {
- device.ext_shader_float16_int8_features.reported = true;
- device.ext_shader_float16_int8_features.shader_float16_int8_features_khr
- .sType =
- VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES_KHR;
- device.ext_shader_float16_int8_features.shader_float16_int8_features_khr
- .pNext = features.pNext;
- features.pNext = &device.ext_shader_float16_int8_features
- .shader_float16_int8_features_khr;
+ device.khr_shader_float16_int8.reported = true;
+ device.khr_shader_float16_int8.shader_float16_int8_features_khr.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES;
+ device.khr_shader_float16_int8.shader_float16_int8_features_khr.pNext =
+ features.pNext;
+ features.pNext =
+ &device.khr_shader_float16_int8.shader_float16_int8_features_khr;
+ device.khr_shader_float16_int8.float16_int8_features_khr.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES;
+ device.khr_shader_float16_int8.float16_int8_features_khr.pNext =
+ features.pNext;
+ features.pNext = &device.khr_shader_float16_int8.float16_int8_features_khr;
}
+
+ if (HasExtension("VK_EXT_image_2d_view_of_3d", device.extensions)) {
+ device.ext_image_2d_view_of_3d.reported = true;
+ device.ext_image_2d_view_of_3d.image_2d_view_of_3d_features_ext.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT;
+ device.ext_image_2d_view_of_3d.image_2d_view_of_3d_features_ext.pNext =
+ features.pNext;
+ features.pNext =
+ &device.ext_image_2d_view_of_3d.image_2d_view_of_3d_features_ext;
+ }
+
+ if (HasExtension("VK_EXT_custom_border_color", device.extensions)) {
+ device.ext_custom_border_color.reported = true;
+ device.ext_custom_border_color.custom_border_color_features_ext.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_PROPERTIES_EXT;
+ device.ext_custom_border_color.custom_border_color_features_ext.pNext =
+ features.pNext;
+ features.pNext =
+ &device.ext_custom_border_color.custom_border_color_features_ext;
+ }
+
+ if (HasExtension("VK_EXT_primitive_topology_list_restart",
+ device.extensions)) {
+ device.ext_primitive_topology_list_restart.reported = true;
+ device.ext_primitive_topology_list_restart
+ .primitive_topology_list_restart_features_ext.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT;
+ device.ext_primitive_topology_list_restart
+ .primitive_topology_list_restart_features_ext.pNext = features.pNext;
+ features.pNext = &device.ext_primitive_topology_list_restart
+ .primitive_topology_list_restart_features_ext;
+ }
+
+ if (HasExtension("VK_EXT_provoking_vertex", device.extensions)) {
+ device.ext_provoking_vertex.reported = true;
+ device.ext_provoking_vertex.provoking_vertex_features_ext.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT;
+ device.ext_provoking_vertex.provoking_vertex_features_ext.pNext =
+ features.pNext;
+ features.pNext = &device.ext_provoking_vertex.provoking_vertex_features_ext;
+ }
+
+ if (HasExtension("VK_KHR_index_type_uint8", device.extensions)) {
+ device.khr_index_type_uint8.reported = true;
+ device.khr_index_type_uint8.index_type_uint8_features_khr.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES;
+ device.khr_index_type_uint8.index_type_uint8_features_khr.pNext =
+ features.pNext;
+ features.pNext = &device.khr_index_type_uint8.index_type_uint8_features_khr;
+ }
+
+ if (HasExtension("VK_EXT_index_type_uint8", device.extensions)) {
+ device.ext_index_type_uint8.reported = true;
+ device.ext_index_type_uint8.index_type_uint8_features_ext.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES;
+ device.ext_index_type_uint8.index_type_uint8_features_ext.pNext =
+ features.pNext;
+ features.pNext = &device.ext_index_type_uint8.index_type_uint8_features_ext;
+ }
+
+ if (HasExtension("VK_KHR_vertex_attribute_divisor", device.extensions)) {
+ device.khr_vertex_attribute_divisor.reported = true;
+ device.khr_vertex_attribute_divisor.vertex_attribute_divisor_features_khr
+ .sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES;
+ device.khr_vertex_attribute_divisor.vertex_attribute_divisor_features_khr
+ .pNext = features.pNext;
+ features.pNext = &device.khr_vertex_attribute_divisor
+ .vertex_attribute_divisor_features_khr;
+ }
+
+ if (HasExtension("VK_EXT_vertex_attribute_divisor", device.extensions)) {
+ device.ext_vertex_attribute_divisor.reported = true;
+ device.ext_vertex_attribute_divisor.vertex_attribute_divisor_features_ext
+ .sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES;
+ device.ext_vertex_attribute_divisor.vertex_attribute_divisor_features_ext
+ .pNext = features.pNext;
+ features.pNext = &device.ext_vertex_attribute_divisor
+ .vertex_attribute_divisor_features_ext;
+ }
+
+ if (HasExtension("VK_EXT_transform_feedback", device.extensions)) {
+ device.ext_transform_feedback.reported = true;
+ device.ext_transform_feedback.transform_feedback_features_ext.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT;
+ device.ext_transform_feedback.transform_feedback_features_ext.pNext =
+ features.pNext;
+ features.pNext =
+ &device.ext_transform_feedback.transform_feedback_features_ext;
+ }
+
+ if (HasExtension("VK_KHR_shader_subgroup_uniform_control_flow",
+ device.extensions)) {
+ device.khr_shader_subgroup_uniform_control_flow.reported = true;
+ device.khr_shader_subgroup_uniform_control_flow
+ .shader_subgroup_uniform_control_flow_features_khr.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_FEATURES_KHR;
+ device.khr_shader_subgroup_uniform_control_flow
+ .shader_subgroup_uniform_control_flow_features_khr.pNext =
+ features.pNext;
+ features.pNext = &device.khr_shader_subgroup_uniform_control_flow
+ .shader_subgroup_uniform_control_flow_features_khr;
+ }
+
+ if (HasExtension("VK_KHR_shader_subgroup_extended_types",
+ device.extensions)) {
+ device.khr_shader_subgroup_extended_types.reported = true;
+ device.khr_shader_subgroup_extended_types
+ .shader_subgroup_extended_types_features_khr.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES;
+ device.khr_shader_subgroup_extended_types
+ .shader_subgroup_extended_types_features_khr.pNext = features.pNext;
+ features.pNext = &device.khr_shader_subgroup_extended_types
+ .shader_subgroup_extended_types_features_khr;
+ }
+
+ if (HasExtension("VK_KHR_8bit_storage", device.extensions)) {
+ device.khr_8bit_storage.reported = true;
+ device.khr_8bit_storage.bit8_storage_features_khr.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES;
+ device.khr_8bit_storage.bit8_storage_features_khr.pNext = features.pNext;
+ features.pNext = &device.khr_8bit_storage.bit8_storage_features_khr;
+ }
+
+ if (HasExtension("VK_KHR_shader_integer_dot_product", device.extensions)) {
+ device.khr_shader_integer_dot_product.reported = true;
+ device.khr_shader_integer_dot_product
+ .shader_integer_dot_product_features_khr.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES;
+ device.khr_shader_integer_dot_product
+ .shader_integer_dot_product_features_khr.pNext = features.pNext;
+ features.pNext = &device.khr_shader_integer_dot_product
+ .shader_integer_dot_product_features_khr;
+ }
+
+ if (HasExtension("VK_IMG_relaxed_line_rasterization", device.extensions)) {
+ device.img_relaxed_line_rasterization.reported = true;
+ device.img_relaxed_line_rasterization
+ .relaxed_line_rasterization_features_img.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RELAXED_LINE_RASTERIZATION_FEATURES_IMG;
+ device.img_relaxed_line_rasterization
+ .relaxed_line_rasterization_features_img.pNext = features.pNext;
+ features.pNext = &device.img_relaxed_line_rasterization
+ .relaxed_line_rasterization_features_img;
+ }
+
+ if (HasExtension("VK_KHR_line_rasterization", device.extensions)) {
+ device.khr_line_rasterization.reported = true;
+ device.khr_line_rasterization.line_rasterization_features_khr.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES;
+ device.khr_line_rasterization.line_rasterization_features_khr.pNext =
+ features.pNext;
+ features.pNext =
+ &device.khr_line_rasterization.line_rasterization_features_khr;
+ }
+
+ if (HasExtension("VK_EXT_line_rasterization", device.extensions)) {
+ device.ext_line_rasterization.reported = true;
+ device.ext_line_rasterization.line_rasterization_features_ext.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES;
+ device.ext_line_rasterization.line_rasterization_features_ext.pNext =
+ features.pNext;
+ features.pNext =
+ &device.ext_line_rasterization.line_rasterization_features_ext;
+ }
+
+ if (HasExtension("VK_EXT_primitives_generated_query", device.extensions)) {
+ device.ext_primitives_generated_query.reported = true;
+ device.ext_primitives_generated_query
+ .primitives_generated_query_features_ext.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVES_GENERATED_QUERY_FEATURES_EXT;
+ device.ext_primitives_generated_query
+ .primitives_generated_query_features_ext.pNext = features.pNext;
+ features.pNext = &device.ext_primitives_generated_query
+ .primitives_generated_query_features_ext;
+ }
+
vkGetPhysicalDeviceFeatures2(physical_device, &features);
device.features = features.features;
@@ -194,20 +386,15 @@
vkGetPhysicalDeviceProperties2(physical_device, &properties);
- device.bit16_storage_features.sType =
- VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES;
- device.bit16_storage_features.pNext = features.pNext;
- features.pNext = &device.bit16_storage_features;
-
device.multiview_features.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES;
device.multiview_features.pNext = features.pNext;
features.pNext = &device.multiview_features;
- device.variable_pointer_features.sType =
- VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES;
- device.variable_pointer_features.pNext = features.pNext;
- features.pNext = &device.variable_pointer_features;
+ device.variable_pointers_features.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES;
+ device.variable_pointers_features.pNext = features.pNext;
+ features.pNext = &device.variable_pointers_features;
device.protected_memory_features.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES;
@@ -220,10 +407,15 @@
features.pNext = &device.sampler_ycbcr_conversion_features;
device.shader_draw_parameter_features.sType =
- VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES;
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES;
device.shader_draw_parameter_features.pNext = features.pNext;
features.pNext = &device.shader_draw_parameter_features;
+ device.bit16_storage_features.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES;
+ device.bit16_storage_features.pNext = features.pNext;
+ features.pNext = &device.bit16_storage_features;
+
vkGetPhysicalDeviceFeatures2(physical_device, &features);
VkPhysicalDeviceExternalFenceInfo external_fence_info = {
@@ -271,6 +463,11 @@
}
if (device.properties.apiVersion >= VK_API_VERSION_1_2) {
+ device.core11.properties.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES;
+ device.core11.properties.pNext = properties.pNext;
+ properties.pNext = &device.core11.properties;
+
device.core12.properties.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES;
device.core12.properties.pNext = properties.pNext;
@@ -278,6 +475,11 @@
vkGetPhysicalDeviceProperties2(physical_device, &properties);
+ device.core11.features.sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES;
+ device.core11.features.pNext = features.pNext;
+ features.pNext = &device.core11.features;
+
device.core12.features.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES;
device.core12.features.pNext = features.pNext;
@@ -337,7 +539,8 @@
return VkJsonInstance();
instance.layers.reserve(count);
for (auto& layer : layers) {
- instance.layers.push_back(VkJsonLayer{layer, std::vector<VkExtensionProperties>()});
+ instance.layers.push_back(
+ VkJsonLayer{layer, std::vector<VkExtensionProperties>()});
if (!EnumerateExtensions(layer.layerName,
&instance.layers.back().extensions))
return VkJsonInstance();