Merge "Added OWNERS to moar bugreport-related projects..."
diff --git a/cmds/installd/Android.bp b/cmds/installd/Android.bp
index 94c3102..9d0d8ba 100644
--- a/cmds/installd/Android.bp
+++ b/cmds/installd/Android.bp
@@ -108,10 +108,8 @@
"-Wall",
"-Werror"
],
- clang: true,
- srcs: [
- "otapreopt_parameters.cpp"],
+ srcs: ["otapreopt_parameters.cpp"],
export_include_dirs: ["."],
@@ -123,4 +121,39 @@
],
}
-subdirs = ["tests"]
+//
+// OTA Executable
+//
+
+cc_binary {
+ name: "otapreopt",
+ cflags: [
+ "-Wall",
+ "-Werror"
+ ],
+
+ srcs: [
+ "dexopt.cpp",
+ "globals.cpp",
+ "otapreopt.cpp",
+ "utils.cpp",
+ ],
+
+ header_libs: ["dex2oat_headers"],
+
+ static_libs: [
+ "libartimagevalues",
+ "libdiskusage",
+ "libotapreoptparameters",
+ ],
+
+ shared_libs: [
+ "libbase",
+ "libcrypto",
+ "libcutils",
+ "liblog",
+ "liblogwrap",
+ "libselinux",
+ "libutils",
+ ],
+}
diff --git a/cmds/installd/Android.mk b/cmds/installd/Android.mk
index a4f95da..30de0b3 100644
--- a/cmds/installd/Android.mk
+++ b/cmds/installd/Android.mk
@@ -1,43 +1,5 @@
LOCAL_PATH := $(call my-dir)
-#
-# OTA Executable
-#
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := otapreopt
-LOCAL_CFLAGS := -Wall -Werror
-
-# Base & ASLR boundaries for boot image creation.
-ifndef LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA
- LOCAL_LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA := -0x1000000
-else
- LOCAL_LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA := $(LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA)
-endif
-ifndef LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA
- LOCAL_LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA := 0x1000000
-else
- LOCAL_LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA := $(LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA)
-endif
-LOCAL_CFLAGS += -DART_BASE_ADDRESS=$(LIBART_IMG_HOST_BASE_ADDRESS)
-LOCAL_CFLAGS += -DART_BASE_ADDRESS_MIN_DELTA=$(LOCAL_LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA)
-LOCAL_CFLAGS += -DART_BASE_ADDRESS_MAX_DELTA=$(LOCAL_LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA)
-
-LOCAL_SRC_FILES := otapreopt.cpp otapreopt_parameters.cpp globals.cpp utils.cpp dexopt.cpp
-LOCAL_HEADER_LIBRARIES := dex2oat_headers
-LOCAL_SHARED_LIBRARIES := \
- libbase \
- libcrypto \
- libcutils \
- liblog \
- liblogwrap \
- libselinux \
- libutils \
-
-LOCAL_STATIC_LIBRARIES := libdiskusage
-LOCAL_CLANG := true
-include $(BUILD_EXECUTABLE)
-
# OTA slot script
include $(CLEAR_VARS)
diff --git a/cmds/installd/art_helper/Android.bp b/cmds/installd/art_helper/Android.bp
new file mode 100644
index 0000000..c47dd72
--- /dev/null
+++ b/cmds/installd/art_helper/Android.bp
@@ -0,0 +1,12 @@
+// Inherit image values.
+art_global_defaults {
+ name: "libartimagevalues_defaults",
+}
+
+cc_library_static {
+ name: "libartimagevalues",
+ defaults: ["libartimagevalues_defaults"],
+ srcs: ["art_image_values.cpp"],
+ export_include_dirs: ["."],
+ cflags: ["-Wconversion"],
+}
diff --git a/cmds/installd/art_helper/art_image_values.cpp b/cmds/installd/art_helper/art_image_values.cpp
new file mode 100644
index 0000000..a139049
--- /dev/null
+++ b/cmds/installd/art_helper/art_image_values.cpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2018 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 "art_image_values.h"
+
+namespace android {
+namespace installd {
+namespace art {
+
+uint32_t GetImageBaseAddress() {
+ return ART_BASE_ADDRESS;
+}
+int32_t GetImageMinBaseAddressDelta() {
+ return ART_BASE_ADDRESS_MIN_DELTA;
+}
+int32_t GetImageMaxBaseAddressDelta() {
+ return ART_BASE_ADDRESS_MAX_DELTA;
+}
+
+static_assert(ART_BASE_ADDRESS_MIN_DELTA < ART_BASE_ADDRESS_MAX_DELTA, "Inconsistent setup");
+
+} // namespace art
+} // namespace installd
+} // namespace android
diff --git a/cmds/installd/art_helper/art_image_values.h b/cmds/installd/art_helper/art_image_values.h
new file mode 100644
index 0000000..20c44c9
--- /dev/null
+++ b/cmds/installd/art_helper/art_image_values.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+#ifndef FRAMEWORKS_NATIVE_CMDS_INSTALLD_ART_HELPER_ART_IMAGE_VALUES_H
+#define FRAMEWORKS_NATIVE_CMDS_INSTALLD_ART_HELPER_ART_IMAGE_VALUES_H
+
+#include <cstdint>
+
+namespace android {
+namespace installd {
+namespace art {
+
+uint32_t GetImageBaseAddress();
+int32_t GetImageMinBaseAddressDelta();
+int32_t GetImageMaxBaseAddressDelta();
+
+} // namespace art
+} // namespace installd
+} // namespace android
+
+#endif // FRAMEWORKS_NATIVE_CMDS_INSTALLD_ART_HELPER_ART_IMAGE_VALUES_H
diff --git a/cmds/installd/otapreopt.cpp b/cmds/installd/otapreopt.cpp
index 7291ef3..73098f8 100644
--- a/cmds/installd/otapreopt.cpp
+++ b/cmds/installd/otapreopt.cpp
@@ -32,6 +32,7 @@
#include <android-base/macros.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
+#include <art_image_values.h>
#include <cutils/fs.h>
#include <cutils/properties.h>
#include <dex2oat_return_codes.h>
@@ -441,8 +442,8 @@
cmd.push_back(StringPrintf("--instruction-set=%s", isa));
- int32_t base_offset = ChooseRelocationOffsetDelta(ART_BASE_ADDRESS_MIN_DELTA,
- ART_BASE_ADDRESS_MAX_DELTA);
+ int32_t base_offset = ChooseRelocationOffsetDelta(art::GetImageMinBaseAddressDelta(),
+ art::GetImageMaxBaseAddressDelta());
cmd.push_back(StringPrintf("--base-offset-delta=%d", base_offset));
std::string error_msg;
@@ -466,9 +467,9 @@
}
cmd.push_back(StringPrintf("--oat-file=%s", oat_path.c_str()));
- int32_t base_offset = ChooseRelocationOffsetDelta(ART_BASE_ADDRESS_MIN_DELTA,
- ART_BASE_ADDRESS_MAX_DELTA);
- cmd.push_back(StringPrintf("--base=0x%x", ART_BASE_ADDRESS + base_offset));
+ int32_t base_offset = ChooseRelocationOffsetDelta(art::GetImageMinBaseAddressDelta(),
+ art::GetImageMaxBaseAddressDelta());
+ cmd.push_back(StringPrintf("--base=0x%x", art::GetImageBaseAddress() + base_offset));
cmd.push_back(StringPrintf("--instruction-set=%s", isa));
@@ -610,7 +611,7 @@
// If the dexopt failed, we may have a stale boot image from a previous OTA run.
// Then regenerate and retry.
if (WEXITSTATUS(dexopt_result) ==
- static_cast<int>(art::dex2oat::ReturnCode::kCreateRuntime)) {
+ static_cast<int>(::art::dex2oat::ReturnCode::kCreateRuntime)) {
if (!PrepareBootImage(/* force */ true)) {
LOG(ERROR) << "Forced boot image creating failed. Original error return was "
<< dexopt_result;
diff --git a/cmds/installd/otapreopt_parameters.cpp b/cmds/installd/otapreopt_parameters.cpp
index cf3de01..b1ad8db 100644
--- a/cmds/installd/otapreopt_parameters.cpp
+++ b/cmds/installd/otapreopt_parameters.cpp
@@ -16,6 +16,8 @@
#include "otapreopt_parameters.h"
+#include <cstring>
+
#include <android-base/logging.h>
#include "dexopt.h"
@@ -248,6 +250,8 @@
case 8: num_args_expected = 16; break;
// Version 9 adds a new dexopt flag: DEXOPT_GENERATE_APP_IMAGE
case 9: num_args_expected = 16; break;
+ // Version 10 is a compatibility bump.
+ case 10: num_args_expected = 16; break;
default:
LOG(ERROR) << "Don't know how to read arguments for version " << version;
return false;
@@ -360,6 +364,15 @@
}
}
+ if (version < 10) {
+ // Do not accept '&' as shared libraries from versions prior to 10. These may lead
+ // to runtime crashes. The server side of version 10+ should send the correct
+ // context in almost all cases (e.g., only for actual shared packages).
+ if (shared_libraries != nullptr && std::string("&") == shared_libraries) {
+ return false;
+ }
+ }
+
return true;
}
diff --git a/cmds/installd/tests/installd_otapreopt_test.cpp b/cmds/installd/tests/installd_otapreopt_test.cpp
index b518507..66dd51e 100644
--- a/cmds/installd/tests/installd_otapreopt_test.cpp
+++ b/cmds/installd/tests/installd_otapreopt_test.cpp
@@ -114,11 +114,14 @@
case 7: return "7";
case 8: return "8";
case 9: return "9";
+ case 10: return "10";
}
return nullptr;
}
- std::vector<const char*> getArgs(uint32_t version, bool versioned) {
+ std::vector<const char*> getArgs(uint32_t version,
+ bool versioned,
+ const char* shared_libs = "shared.lib") {
std::vector<const char*> args;
args.push_back("otapreopt"); // "otapreopt"
args.push_back("a"); // slot
@@ -135,7 +138,7 @@
args.push_back("0"); // dexopt_flags
args.push_back("speed"); // filter
args.push_back("!"); // volume
- args.push_back("shared.lib"); // libs
+ args.push_back(shared_libs); // libs
if (version > 1) {
args.push_back("!"); // seinfo
@@ -159,9 +162,11 @@
return args;
}
- void VerifyReadArguments(uint32_t version, bool versioned) {
+ void VerifyReadArguments(uint32_t version,
+ bool versioned,
+ const char* shared_libs = "shared.lib") {
OTAPreoptParameters params;
- std::vector<const char*> args = getArgs(version, versioned);
+ std::vector<const char*> args = getArgs(version, versioned, shared_libs);
ASSERT_TRUE(params.ReadArguments(args.size() - 1, args.data()));
verifyPackageParameters(params, version, versioned, args.data());
}
@@ -199,6 +204,18 @@
VerifyReadArguments(7, true);
}
+TEST_F(OTAPreoptTest, ReadArgumentsV9SharedLibsAmpersand) {
+ OTAPreoptParameters params;
+ std::vector<const char*> args = getArgs(9, true, "&");
+ ASSERT_FALSE(params.ReadArguments(args.size() - 1, args.data()));
+}
+
+TEST_F(OTAPreoptTest, ReadArgumentsV10SharedLibsAmpersand) {
+ OTAPreoptParameters params;
+ std::vector<const char*> args = getArgs(10, true, "&");
+ ASSERT_TRUE(params.ReadArguments(args.size() - 1, args.data()));
+}
+
TEST_F(OTAPreoptTest, ReadArgumentsFailToManyArgs) {
OTAPreoptParameters params;
std::vector<const char*> args = getArgs(5, true);
diff --git a/libs/binder/Status.cpp b/libs/binder/Status.cpp
index a9d5055..e318a7f 100644
--- a/libs/binder/Status.cpp
+++ b/libs/binder/Status.cpp
@@ -136,7 +136,7 @@
// Something really bad has happened, and we're not going to even
// try returning rich error data.
if (mException == EX_TRANSACTION_FAILED) {
- return mErrorCode;
+ return mErrorCode == OK ? FAILED_TRANSACTION : mErrorCode;
}
status_t status = parcel->writeInt32(mException);
diff --git a/libs/binder/include/binder/IBinder.h b/libs/binder/include/binder/IBinder.h
index 318070a..3f0dad0 100644
--- a/libs/binder/include/binder/IBinder.h
+++ b/libs/binder/include/binder/IBinder.h
@@ -151,11 +151,31 @@
typedef void (*object_cleanup_func)(const void* id, void* obj, void* cleanupCookie);
+ /**
+ * This object is attached for the lifetime of this binder object. When
+ * this binder object is destructed, the cleanup function of all attached
+ * objects are invoked with their respective objectID, object, and
+ * cleanupCookie. Access to these APIs can be made from multiple threads,
+ * but calls from different threads are allowed to be interleaved.
+ */
virtual void attachObject( const void* objectID,
void* object,
void* cleanupCookie,
object_cleanup_func func) = 0;
+ /**
+ * Returns object attached with attachObject.
+ */
virtual void* findObject(const void* objectID) const = 0;
+ /**
+ * WARNING: this API does not call the cleanup function for legacy reasons.
+ * It also does not return void* for legacy reasons. If you need to detach
+ * an object and destroy it, there are two options:
+ * - if you can, don't call detachObject and instead wait for the destructor
+ * to clean it up.
+ * - manually retrieve and destruct the object (if multiple of your threads
+ * are accessing these APIs, you must guarantee that attachObject isn't
+ * called after findObject and before detachObject is called).
+ */
virtual void detachObject(const void* objectID) = 0;
virtual BBinder* localBinder();
diff --git a/libs/binder/ndk/Android.bp b/libs/binder/ndk/Android.bp
index e5c68b5..5461b4f 100644
--- a/libs/binder/ndk/Android.bp
+++ b/libs/binder/ndk/Android.bp
@@ -25,14 +25,33 @@
srcs: [
"ibinder.cpp",
+ "ibinder_jni.cpp",
"parcel.cpp",
"process.cpp",
+ "status.cpp",
"service_manager.cpp",
],
shared_libs: [
+ "libandroid_runtime",
"libbase",
"libbinder",
"libutils",
],
}
+
+ndk_headers {
+ name: "libbinder_ndk_headers",
+ from: "include_ndk/android",
+ to: "android",
+ srcs: [
+ "include_ndk/android/*.h",
+ ],
+ license: "NOTICE",
+}
+
+ndk_library {
+ name: "libbinder_ndk",
+ symbol_file: "libbinder_ndk.map.txt",
+ first_version: "29",
+}
diff --git a/libs/binder/ndk/NOTICE b/libs/binder/ndk/NOTICE
new file mode 100644
index 0000000..d1ab54c
--- /dev/null
+++ b/libs/binder/ndk/NOTICE
@@ -0,0 +1,189 @@
+
+ Copyright (c) 2018, 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.
+
+ 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.
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/libs/binder/ndk/ibinder.cpp b/libs/binder/ndk/ibinder.cpp
index 8a1ec05..896c5c1 100644
--- a/libs/binder/ndk/ibinder.cpp
+++ b/libs/binder/ndk/ibinder.cpp
@@ -19,6 +19,7 @@
#include <android/binder_status.h>
#include "parcel_internal.h"
+#include "status_internal.h"
#include <android-base/logging.h>
@@ -27,6 +28,7 @@
using ::android::IBinder;
using ::android::Parcel;
using ::android::sp;
+using ::android::status_t;
using ::android::String16;
using ::android::wp;
@@ -116,17 +118,18 @@
return getClass()->getInterfaceDescriptor();
}
-binder_status_t ABBinder::onTransact(transaction_code_t code, const Parcel& data, Parcel* reply,
- binder_flags_t flags) {
+status_t ABBinder::onTransact(transaction_code_t code, const Parcel& data, Parcel* reply,
+ binder_flags_t flags) {
if (isUserCommand(code)) {
if (!data.checkInterface(this)) {
- return EX_ILLEGAL_STATE;
+ return STATUS_BAD_TYPE;
}
const AParcel in = AParcel::readOnly(this, &data);
AParcel out = AParcel(this, reply, false /*owns*/);
- return getClass()->onTransact(this, code, &in, &out);
+ binder_status_t status = getClass()->onTransact(this, code, &in, &out);
+ return PruneStatusT(status);
} else {
return BBinder::onTransact(code, data, reply, flags);
}
@@ -195,13 +198,8 @@
return new AIBinder_Weak{wp<AIBinder>(binder)};
}
-void AIBinder_Weak_delete(AIBinder_Weak** weakBinder) {
- if (weakBinder == nullptr) {
- return;
- }
-
- delete *weakBinder;
- *weakBinder = nullptr;
+void AIBinder_Weak_delete(AIBinder_Weak* weakBinder) {
+ delete weakBinder;
}
AIBinder* AIBinder_Weak_promote(AIBinder_Weak* weakBinder) {
if (weakBinder == nullptr) {
@@ -253,13 +251,13 @@
sp<TransferDeathRecipient> recipient =
new TransferDeathRecipient(binder->getBinder(), cookie, mOnDied);
- binder_status_t status = binder->getBinder()->linkToDeath(recipient, cookie, 0 /*flags*/);
- if (status != EX_NONE) {
- return status;
+ status_t status = binder->getBinder()->linkToDeath(recipient, cookie, 0 /*flags*/);
+ if (status != STATUS_OK) {
+ return PruneStatusT(status);
}
mDeathRecipients.push_back(recipient);
- return EX_NONE;
+ return STATUS_OK;
}
binder_status_t AIBinder_DeathRecipient::unlinkToDeath(AIBinder* binder, void* cookie) {
@@ -270,22 +268,19 @@
for (auto it = mDeathRecipients.rbegin(); it != mDeathRecipients.rend(); ++it) {
sp<TransferDeathRecipient> recipient = *it;
- if (recipient->getCookie() == cookie &&
-
- recipient->getWho() == binder->getBinder()) {
+ if (recipient->getCookie() == cookie && recipient->getWho() == binder->getBinder()) {
mDeathRecipients.erase(it.base() - 1);
- binder_status_t status =
- binder->getBinder()->unlinkToDeath(recipient, cookie, 0 /*flags*/);
- if (status != EX_NONE) {
+ status_t status = binder->getBinder()->unlinkToDeath(recipient, cookie, 0 /*flags*/);
+ if (status != ::android::OK) {
LOG(ERROR) << __func__
<< ": removed reference to death recipient but unlink failed.";
}
- return status;
+ return PruneStatusT(status);
}
}
- return -ENOENT;
+ return STATUS_NAME_NOT_FOUND;
}
// start of C-API methods
@@ -323,19 +318,20 @@
binder_status_t AIBinder_ping(AIBinder* binder) {
if (binder == nullptr) {
- return EX_NULL_POINTER;
+ return STATUS_UNEXPECTED_NULL;
}
- return binder->getBinder()->pingBinder();
+ return PruneStatusT(binder->getBinder()->pingBinder());
}
binder_status_t AIBinder_linkToDeath(AIBinder* binder, AIBinder_DeathRecipient* recipient,
void* cookie) {
if (binder == nullptr || recipient == nullptr) {
LOG(ERROR) << __func__ << ": Must provide binder and recipient.";
- return EX_NULL_POINTER;
+ return STATUS_UNEXPECTED_NULL;
}
+ // returns binder_status_t
return recipient->linkToDeath(binder, cookie);
}
@@ -343,9 +339,10 @@
void* cookie) {
if (binder == nullptr || recipient == nullptr) {
LOG(ERROR) << __func__ << ": Must provide binder and recipient.";
- return EX_NULL_POINTER;
+ return STATUS_UNEXPECTED_NULL;
}
+ // returns binder_status_t
return recipient->unlinkToDeath(binder, cookie);
}
@@ -406,14 +403,14 @@
binder_status_t AIBinder_prepareTransaction(AIBinder* binder, AParcel** in) {
if (binder == nullptr || in == nullptr) {
LOG(ERROR) << __func__ << ": requires non-null parameters.";
- return EX_NULL_POINTER;
+ return STATUS_UNEXPECTED_NULL;
}
const AIBinder_Class* clazz = binder->getClass();
if (clazz == nullptr) {
LOG(ERROR) << __func__
<< ": Class must be defined for a remote binder transaction. See "
"AIBinder_associateClass.";
- return EX_ILLEGAL_STATE;
+ return STATUS_INVALID_OPERATION;
}
if (!binder->isRemote()) {
@@ -424,59 +421,66 @@
}
*in = new AParcel(binder);
- binder_status_t status = (**in)->writeInterfaceToken(clazz->getInterfaceDescriptor());
- if (status != EX_NONE) {
+ status_t status = (*in)->get()->writeInterfaceToken(clazz->getInterfaceDescriptor());
+ binder_status_t ret = PruneStatusT(status);
+
+ if (ret != STATUS_OK) {
delete *in;
*in = nullptr;
}
- return status;
+ return ret;
+}
+
+static void DestroyParcel(AParcel** parcel) {
+ delete *parcel;
+ *parcel = nullptr;
}
binder_status_t AIBinder_transact(AIBinder* binder, transaction_code_t code, AParcel** in,
AParcel** out, binder_flags_t flags) {
if (in == nullptr) {
LOG(ERROR) << __func__ << ": requires non-null in parameter";
- return EX_NULL_POINTER;
+ return STATUS_UNEXPECTED_NULL;
}
using AutoParcelDestroyer = std::unique_ptr<AParcel*, void (*)(AParcel**)>;
// This object is the input to the transaction. This function takes ownership of it and deletes
// it.
- AutoParcelDestroyer forIn(in, AParcel_delete);
+ AutoParcelDestroyer forIn(in, DestroyParcel);
if (!isUserCommand(code)) {
LOG(ERROR) << __func__ << ": Only user-defined transactions can be made from the NDK.";
- return EX_UNSUPPORTED_OPERATION;
+ return STATUS_UNKNOWN_TRANSACTION;
}
if ((flags & ~FLAG_ONEWAY) != 0) {
LOG(ERROR) << __func__ << ": Unrecognized flags sent: " << flags;
- return EX_ILLEGAL_ARGUMENT;
+ return STATUS_BAD_VALUE;
}
if (binder == nullptr || *in == nullptr || out == nullptr) {
LOG(ERROR) << __func__ << ": requires non-null parameters.";
- return EX_NULL_POINTER;
+ return STATUS_UNEXPECTED_NULL;
}
if ((*in)->getBinder() != binder) {
LOG(ERROR) << __func__ << ": parcel is associated with binder object " << binder
<< " but called with " << (*in)->getBinder();
- return EX_ILLEGAL_STATE;
+ return STATUS_BAD_VALUE;
}
*out = new AParcel(binder);
- binder_status_t parcelStatus =
- binder->getBinder()->transact(code, *(*in)->operator->(), (*out)->operator->(), flags);
+ status_t status = binder->getBinder()->transact(code, *(*in)->get(), (*out)->get(), flags);
+ binder_status_t ret = PruneStatusT(status);
- if (parcelStatus != EX_NONE) {
+ if (ret != STATUS_OK) {
delete *out;
*out = nullptr;
}
- return parcelStatus;
+ return ret;
}
AIBinder_DeathRecipient* AIBinder_DeathRecipient_new(
@@ -488,11 +492,6 @@
return new AIBinder_DeathRecipient(onBinderDied);
}
-void AIBinder_DeathRecipient_delete(AIBinder_DeathRecipient** recipient) {
- if (recipient == nullptr) {
- return;
- }
-
- delete *recipient;
- *recipient = nullptr;
+void AIBinder_DeathRecipient_delete(AIBinder_DeathRecipient* recipient) {
+ delete recipient;
}
diff --git a/libs/binder/ndk/ibinder_internal.h b/libs/binder/ndk/ibinder_internal.h
index fcf1b0b..5b6bc94 100644
--- a/libs/binder/ndk/ibinder_internal.h
+++ b/libs/binder/ndk/ibinder_internal.h
@@ -66,8 +66,8 @@
ABBinder* asABBinder() override { return this; }
const ::android::String16& getInterfaceDescriptor() const override;
- binder_status_t onTransact(uint32_t code, const ::android::Parcel& data,
- ::android::Parcel* reply, binder_flags_t flags) override;
+ ::android::status_t onTransact(uint32_t code, const ::android::Parcel& data,
+ ::android::Parcel* reply, binder_flags_t flags) override;
private:
ABBinder(const AIBinder_Class* clazz, void* userData);
diff --git a/libs/binder/ndk/ibinder_jni.cpp b/libs/binder/ndk/ibinder_jni.cpp
new file mode 100644
index 0000000..baea2e8
--- /dev/null
+++ b/libs/binder/ndk/ibinder_jni.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2018 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 <android/binder_ibinder_jni.h>
+#include "ibinder_internal.h"
+
+#include <android_util_Binder.h>
+
+using ::android::IBinder;
+using ::android::ibinderForJavaObject;
+using ::android::javaObjectForIBinder;
+using ::android::sp;
+
+AIBinder* AIBinder_fromJavaBinder(JNIEnv* env, jobject binder) {
+ sp<IBinder> ibinder = ibinderForJavaObject(env, binder);
+
+ sp<AIBinder> cbinder = ABpBinder::lookupOrCreateFromBinder(ibinder);
+ AIBinder_incStrong(cbinder.get());
+
+ return cbinder.get();
+}
+
+jobject AIBinder_toJavaBinder(JNIEnv* env, AIBinder* binder) {
+ if (binder == nullptr) {
+ return nullptr;
+ }
+
+ return javaObjectForIBinder(env, binder->getBinder());
+}
diff --git a/libs/binder/ndk/include_ndk/android/binder_ibinder.h b/libs/binder/ndk/include_ndk/android/binder_ibinder.h
index 7dca5a4..f237e69 100644
--- a/libs/binder/ndk/include_ndk/android/binder_ibinder.h
+++ b/libs/binder/ndk/include_ndk/android/binder_ibinder.h
@@ -33,6 +33,7 @@
#include <android/binder_status.h>
__BEGIN_DECLS
+#if __ANDROID_API__ >= __ANDROID_API_Q__
// Also see TF_* in kernel's binder.h
typedef uint32_t binder_flags_t;
@@ -97,7 +98,7 @@
*
* If the process containing an AIBinder dies, it is possible to be holding a strong reference to
* an object which does not exist. In this case, transactions to this binder will return
- * EX_DEAD_OBJECT. See also AIBinder_linkToDeath, AIBinder_unlinkToDeath, and AIBinder_isAlive.
+ * STATUS_DEAD_OBJECT. See also AIBinder_linkToDeath, AIBinder_unlinkToDeath, and AIBinder_isAlive.
*
* Once an AIBinder is created, anywhere it is passed (remotely or locally), there is a 1-1
* correspondence between the address of an AIBinder and the object it represents. This means that
@@ -154,7 +155,8 @@
*/
__attribute__((warn_unused_result)) AIBinder_Class* AIBinder_Class_define(
const char* interfaceDescriptor, AIBinder_Class_onCreate onCreate,
- AIBinder_Class_onDestroy onDestroy, AIBinder_Class_onTransact onTransact);
+ AIBinder_Class_onDestroy onDestroy, AIBinder_Class_onTransact onTransact)
+ __INTRODUCED_IN(29);
/**
* Creates a new binder object of the appropriate class.
@@ -173,12 +175,13 @@
* these two objects are actually equal using the AIBinder pointer alone (which they should be able
* to do). Also see the suggested memory ownership model suggested above.
*/
-__attribute__((warn_unused_result)) AIBinder* AIBinder_new(const AIBinder_Class* clazz, void* args);
+__attribute__((warn_unused_result)) AIBinder* AIBinder_new(const AIBinder_Class* clazz, void* args)
+ __INTRODUCED_IN(29);
/**
* If this is hosted in a process other than the current one.
*/
-bool AIBinder_isRemote(const AIBinder* binder);
+bool AIBinder_isRemote(const AIBinder* binder) __INTRODUCED_IN(29);
/**
* If this binder is known to be alive. This will not send a transaction to a remote process and
@@ -187,14 +190,14 @@
* updated as the result of a transaction made using AIBinder_transact, but it will also be updated
* based on the results of bookkeeping or other transactions made internally.
*/
-bool AIBinder_isAlive(const AIBinder* binder);
+bool AIBinder_isAlive(const AIBinder* binder) __INTRODUCED_IN(29);
/**
* Built-in transaction for all binder objects. This sends a transaction which will immediately
* return. Usually this is used to make sure that a binder is alive, as a placeholder call, or as a
* sanity check.
*/
-binder_status_t AIBinder_ping(AIBinder* binder);
+binder_status_t AIBinder_ping(AIBinder* binder) __INTRODUCED_IN(29);
/**
* Registers for notifications that the associated binder is dead. The same death recipient may be
@@ -206,30 +209,30 @@
* identification and holding user data.
*/
binder_status_t AIBinder_linkToDeath(AIBinder* binder, AIBinder_DeathRecipient* recipient,
- void* cookie);
+ void* cookie) __INTRODUCED_IN(29);
/**
* Stops registration for the associated binder dying. Does not delete the recipient. This function
* may return a binder transaction failure and in case the death recipient cannot be found, it
- * returns -ENOENT.
+ * returns STATUS_NAME_NOT_FOUND.
*/
binder_status_t AIBinder_unlinkToDeath(AIBinder* binder, AIBinder_DeathRecipient* recipient,
- void* cookie);
+ void* cookie) __INTRODUCED_IN(29);
/**
* This can only be called if a strong reference to this object already exists in process.
*/
-void AIBinder_incStrong(AIBinder* binder);
+void AIBinder_incStrong(AIBinder* binder) __INTRODUCED_IN(29);
/**
* This will delete the object and call onDestroy once the refcount reaches zero.
*/
-void AIBinder_decStrong(AIBinder* binder);
+void AIBinder_decStrong(AIBinder* binder) __INTRODUCED_IN(29);
/**
* For debugging only!
*/
-int32_t AIBinder_debugGetRefCount(AIBinder* binder);
+int32_t AIBinder_debugGetRefCount(AIBinder* binder) __INTRODUCED_IN(29);
/**
* This sets the class of an AIBinder object. This checks to make sure the remote object is of
@@ -240,18 +243,18 @@
* This returns true if the class association succeeds. If it fails, no change is made to the
* binder object.
*/
-bool AIBinder_associateClass(AIBinder* binder, const AIBinder_Class* clazz);
+bool AIBinder_associateClass(AIBinder* binder, const AIBinder_Class* clazz) __INTRODUCED_IN(29);
/**
* Returns the class that this binder was constructed with or associated with.
*/
-const AIBinder_Class* AIBinder_getClass(AIBinder* binder);
+const AIBinder_Class* AIBinder_getClass(AIBinder* binder) __INTRODUCED_IN(29);
/**
* Value returned by onCreate for a local binder. For stateless classes (if onCreate returns
* nullptr), this also returns nullptr. For a remote binder, this will always return nullptr.
*/
-void* AIBinder_getUserData(AIBinder* binder);
+void* AIBinder_getUserData(AIBinder* binder) __INTRODUCED_IN(29);
/**
* A transaction is a series of calls to these functions which looks this
@@ -274,7 +277,7 @@
* AIBinder_transact. Alternatively, if there is an error while filling out the parcel, it can be
* deleted with AParcel_delete.
*/
-binder_status_t AIBinder_prepareTransaction(AIBinder* binder, AParcel** in);
+binder_status_t AIBinder_prepareTransaction(AIBinder* binder, AParcel** in) __INTRODUCED_IN(29);
/**
* Transact using a parcel created from AIBinder_prepareTransaction. This actually communicates with
@@ -289,42 +292,45 @@
* and must be released with AParcel_delete when finished reading.
*/
binder_status_t AIBinder_transact(AIBinder* binder, transaction_code_t code, AParcel** in,
- AParcel** out, binder_flags_t flags);
+ AParcel** out, binder_flags_t flags) __INTRODUCED_IN(29);
/**
* This does not take any ownership of the input binder, but it can be used to retrieve it if
* something else in some process still holds a reference to it.
*/
-__attribute__((warn_unused_result)) AIBinder_Weak* AIBinder_Weak_new(AIBinder* binder);
+__attribute__((warn_unused_result)) AIBinder_Weak* AIBinder_Weak_new(AIBinder* binder)
+ __INTRODUCED_IN(29);
/**
* Deletes the weak reference. This will have no impact on the lifetime of the binder.
*/
-void AIBinder_Weak_delete(AIBinder_Weak** weakBinder);
+void AIBinder_Weak_delete(AIBinder_Weak* weakBinder) __INTRODUCED_IN(29);
/**
* If promotion succeeds, result will have one strong refcount added to it. Otherwise, this returns
* nullptr.
*/
-__attribute__((warn_unused_result)) AIBinder* AIBinder_Weak_promote(AIBinder_Weak* weakBinder);
+__attribute__((warn_unused_result)) AIBinder* AIBinder_Weak_promote(AIBinder_Weak* weakBinder)
+ __INTRODUCED_IN(29);
/**
* This function is executed on death receipt. See AIBinder_linkToDeath/AIBinder_unlinkToDeath.
*/
-typedef void (*AIBinder_DeathRecipient_onBinderDied)(void* cookie);
+typedef void (*AIBinder_DeathRecipient_onBinderDied)(void* cookie) __INTRODUCED_IN(29);
/**
* Creates a new binder death recipient. This can be attached to multiple different binder objects.
*/
__attribute__((warn_unused_result)) AIBinder_DeathRecipient* AIBinder_DeathRecipient_new(
- AIBinder_DeathRecipient_onBinderDied onBinderDied);
+ AIBinder_DeathRecipient_onBinderDied onBinderDied) __INTRODUCED_IN(29);
/**
* Deletes a binder death recipient. It is not necessary to call AIBinder_unlinkToDeath before
* calling this as these will all be automatically unlinked.
*/
-void AIBinder_DeathRecipient_delete(AIBinder_DeathRecipient** recipient);
+void AIBinder_DeathRecipient_delete(AIBinder_DeathRecipient* recipient) __INTRODUCED_IN(29);
+#endif //__ANDROID_API__ >= __ANDROID_API_Q__
__END_DECLS
/** @} */
diff --git a/libs/binder/ndk/include_ndk/android/binder_ibinder_jni.h b/libs/binder/ndk/include_ndk/android/binder_ibinder_jni.h
new file mode 100644
index 0000000..81fb3c5
--- /dev/null
+++ b/libs/binder/ndk/include_ndk/android/binder_ibinder_jni.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+/**
+ * @addtogroup NdkBinder
+ * @{
+ */
+
+/**
+ * @file binder_ibinder_jni.h
+ * @brief Conversions between AIBinder and android.os.IBinder
+ */
+
+#pragma once
+
+#include <android/binder_ibinder.h>
+
+#include <jni.h>
+
+__BEGIN_DECLS
+#if __ANDROID_API__ >= __ANDROID_API_Q__
+
+/**
+ * Converts an android.os.IBinder object into an AIBinder* object.
+ *
+ * If either env or the binder is null, null is returned. If this binder object was originally an
+ * AIBinder object, the original object is returned. The returned object has one refcount
+ * associated with it, and so this should be accompanied with an AIBinder_decStrong call.
+ */
+__attribute__((warn_unused_result)) AIBinder* AIBinder_fromJavaBinder(JNIEnv* env, jobject binder)
+ __INTRODUCED_IN(29);
+
+/**
+ * Converts an AIBinder* object into an android.os.IBinder object.
+ *
+ * If either env or the binder is null, null is returned. If this binder object was originally an
+ * IBinder object, the original java object will be returned.
+ */
+__attribute__((warn_unused_result)) jobject AIBinder_toJavaBinder(JNIEnv* env, AIBinder* binder)
+ __INTRODUCED_IN(29);
+
+#endif //__ANDROID_API__ >= __ANDROID_API_Q__
+__END_DECLS
+
+/** @} */
diff --git a/libs/binder/ndk/include_ndk/android/binder_parcel.h b/libs/binder/ndk/include_ndk/android/binder_parcel.h
index e871ed1..a3800da 100644
--- a/libs/binder/ndk/include_ndk/android/binder_parcel.h
+++ b/libs/binder/ndk/include_ndk/android/binder_parcel.h
@@ -34,6 +34,7 @@
typedef struct AIBinder AIBinder;
__BEGIN_DECLS
+#if __ANDROID_API__ >= __ANDROID_API_Q__
/**
* This object represents a package of data that can be sent between processes. When transacting, an
@@ -45,120 +46,142 @@
typedef struct AParcel AParcel;
/**
- * Cleans up a parcel and sets it to nullptr.
+ * Cleans up a parcel.
*/
-void AParcel_delete(AParcel** parcel);
+void AParcel_delete(AParcel* parcel) __INTRODUCED_IN(29);
/**
* Writes an AIBinder to the next location in a non-null parcel. Can be null.
*/
-binder_status_t AParcel_writeStrongBinder(AParcel* parcel, AIBinder* binder);
+binder_status_t AParcel_writeStrongBinder(AParcel* parcel, AIBinder* binder) __INTRODUCED_IN(29);
/**
* Reads an AIBinder from the next location in a non-null parcel. This will fail if the binder is
* non-null. One strong ref-count of ownership is passed to the caller of this function.
*/
-binder_status_t AParcel_readStrongBinder(const AParcel* parcel, AIBinder** binder);
+binder_status_t AParcel_readStrongBinder(const AParcel* parcel, AIBinder** binder)
+ __INTRODUCED_IN(29);
/**
* Reads an AIBinder from the next location in a non-null parcel. This may read a null. One strong
* ref-count of ownership is passed to the caller of this function.
*/
-binder_status_t AParcel_readNullableStrongBinder(const AParcel* parcel, AIBinder** binder);
+binder_status_t AParcel_readNullableStrongBinder(const AParcel* parcel, AIBinder** binder)
+ __INTRODUCED_IN(29);
+
+/**
+ * Writes an AStatus object to the next location in a non-null parcel.
+ *
+ * If the status is considered to be a low-level status and has no additional information other
+ * than a binder_status_t (for instance, if it is created with AStatus_fromStatus), then that
+ * status will be returned from this method and nothing will be written to the parcel. If either
+ * this happens or if writing the status object itself fails, the return value from this function
+ * should be propagated to the client, and AParcel_readStatusHeader shouldn't be called.
+ */
+binder_status_t AParcel_writeStatusHeader(AParcel* parcel, const AStatus* status)
+ __INTRODUCED_IN(29);
+
+/**
+ * Reads an AStatus from the next location in a non-null parcel. Ownership is passed to the caller
+ * of this function.
+ */
+binder_status_t AParcel_readStatusHeader(const AParcel* parcel, AStatus** status)
+ __INTRODUCED_IN(29);
// @START
/**
* Writes int32_t value to the next location in a non-null parcel.
*/
-binder_status_t AParcel_writeInt32(AParcel* parcel, int32_t value);
+binder_status_t AParcel_writeInt32(AParcel* parcel, int32_t value) __INTRODUCED_IN(29);
/**
* Writes uint32_t value to the next location in a non-null parcel.
*/
-binder_status_t AParcel_writeUint32(AParcel* parcel, uint32_t value);
+binder_status_t AParcel_writeUint32(AParcel* parcel, uint32_t value) __INTRODUCED_IN(29);
/**
* Writes int64_t value to the next location in a non-null parcel.
*/
-binder_status_t AParcel_writeInt64(AParcel* parcel, int64_t value);
+binder_status_t AParcel_writeInt64(AParcel* parcel, int64_t value) __INTRODUCED_IN(29);
/**
* Writes uint64_t value to the next location in a non-null parcel.
*/
-binder_status_t AParcel_writeUint64(AParcel* parcel, uint64_t value);
+binder_status_t AParcel_writeUint64(AParcel* parcel, uint64_t value) __INTRODUCED_IN(29);
/**
* Writes float value to the next location in a non-null parcel.
*/
-binder_status_t AParcel_writeFloat(AParcel* parcel, float value);
+binder_status_t AParcel_writeFloat(AParcel* parcel, float value) __INTRODUCED_IN(29);
/**
* Writes double value to the next location in a non-null parcel.
*/
-binder_status_t AParcel_writeDouble(AParcel* parcel, double value);
+binder_status_t AParcel_writeDouble(AParcel* parcel, double value) __INTRODUCED_IN(29);
/**
* Writes bool value to the next location in a non-null parcel.
*/
-binder_status_t AParcel_writeBool(AParcel* parcel, bool value);
+binder_status_t AParcel_writeBool(AParcel* parcel, bool value) __INTRODUCED_IN(29);
/**
* Writes char16_t value to the next location in a non-null parcel.
*/
-binder_status_t AParcel_writeChar(AParcel* parcel, char16_t value);
+binder_status_t AParcel_writeChar(AParcel* parcel, char16_t value) __INTRODUCED_IN(29);
/**
* Writes int8_t value to the next location in a non-null parcel.
*/
-binder_status_t AParcel_writeByte(AParcel* parcel, int8_t value);
+binder_status_t AParcel_writeByte(AParcel* parcel, int8_t value) __INTRODUCED_IN(29);
/**
* Reads into int32_t value from the next location in a non-null parcel.
*/
-binder_status_t AParcel_readInt32(const AParcel* parcel, int32_t* value);
+binder_status_t AParcel_readInt32(const AParcel* parcel, int32_t* value) __INTRODUCED_IN(29);
/**
* Reads into uint32_t value from the next location in a non-null parcel.
*/
-binder_status_t AParcel_readUint32(const AParcel* parcel, uint32_t* value);
+binder_status_t AParcel_readUint32(const AParcel* parcel, uint32_t* value) __INTRODUCED_IN(29);
/**
* Reads into int64_t value from the next location in a non-null parcel.
*/
-binder_status_t AParcel_readInt64(const AParcel* parcel, int64_t* value);
+binder_status_t AParcel_readInt64(const AParcel* parcel, int64_t* value) __INTRODUCED_IN(29);
/**
* Reads into uint64_t value from the next location in a non-null parcel.
*/
-binder_status_t AParcel_readUint64(const AParcel* parcel, uint64_t* value);
+binder_status_t AParcel_readUint64(const AParcel* parcel, uint64_t* value) __INTRODUCED_IN(29);
/**
* Reads into float value from the next location in a non-null parcel.
*/
-binder_status_t AParcel_readFloat(const AParcel* parcel, float* value);
+binder_status_t AParcel_readFloat(const AParcel* parcel, float* value) __INTRODUCED_IN(29);
/**
* Reads into double value from the next location in a non-null parcel.
*/
-binder_status_t AParcel_readDouble(const AParcel* parcel, double* value);
+binder_status_t AParcel_readDouble(const AParcel* parcel, double* value) __INTRODUCED_IN(29);
/**
* Reads into bool value from the next location in a non-null parcel.
*/
-binder_status_t AParcel_readBool(const AParcel* parcel, bool* value);
+binder_status_t AParcel_readBool(const AParcel* parcel, bool* value) __INTRODUCED_IN(29);
/**
* Reads into char16_t value from the next location in a non-null parcel.
*/
-binder_status_t AParcel_readChar(const AParcel* parcel, char16_t* value);
+binder_status_t AParcel_readChar(const AParcel* parcel, char16_t* value) __INTRODUCED_IN(29);
/**
* Reads into int8_t value from the next location in a non-null parcel.
*/
-binder_status_t AParcel_readByte(const AParcel* parcel, int8_t* value);
+binder_status_t AParcel_readByte(const AParcel* parcel, int8_t* value) __INTRODUCED_IN(29);
// @END
+#endif //__ANDROID_API__ >= __ANDROID_API_Q__
__END_DECLS
/** @} */
diff --git a/libs/binder/ndk/include_ndk/android/binder_status.h b/libs/binder/ndk/include_ndk/android/binder_status.h
index e97e181..2d8b7fa 100644
--- a/libs/binder/ndk/include_ndk/android/binder_status.h
+++ b/libs/binder/ndk/include_ndk/android/binder_status.h
@@ -25,12 +25,43 @@
#pragma once
+#include <errno.h>
#include <stdint.h>
#include <sys/cdefs.h>
__BEGIN_DECLS
+#if __ANDROID_API__ >= __ANDROID_API_Q__
-// Keep the exception codes in sync with android/os/Parcel.java.
+enum {
+ STATUS_OK = 0,
+
+ STATUS_UNKNOWN_ERROR = (-2147483647 - 1), // INT32_MIN value
+ STATUS_NO_MEMORY = -ENOMEM,
+ STATUS_INVALID_OPERATION = -ENOSYS,
+ STATUS_BAD_VALUE = -EINVAL,
+ STATUS_BAD_TYPE = (STATUS_UNKNOWN_ERROR + 1),
+ STATUS_NAME_NOT_FOUND = -ENOENT,
+ STATUS_PERMISSION_DENIED = -EPERM,
+ STATUS_NO_INIT = -ENODEV,
+ STATUS_ALREADY_EXISTS = -EEXIST,
+ STATUS_DEAD_OBJECT = -EPIPE,
+ STATUS_FAILED_TRANSACTION = (STATUS_UNKNOWN_ERROR + 2),
+ STATUS_BAD_INDEX = -EOVERFLOW,
+ STATUS_NOT_ENOUGH_DATA = -ENODATA,
+ STATUS_WOULD_BLOCK = -EWOULDBLOCK,
+ STATUS_TIMED_OUT = -ETIMEDOUT,
+ STATUS_UNKNOWN_TRANSACTION = -EBADMSG,
+ STATUS_FDS_NOT_ALLOWED = (STATUS_UNKNOWN_ERROR + 7),
+ STATUS_UNEXPECTED_NULL = (STATUS_UNKNOWN_ERROR + 8),
+};
+
+/**
+ * One of the STATUS_* values.
+ *
+ * All unrecognized values are coerced into STATUS_UNKNOWN_ERROR.
+ */
+typedef int32_t binder_status_t;
+
enum {
EX_NONE = 0,
EX_SECURITY = -1,
@@ -44,12 +75,6 @@
EX_PARCELABLE = -9,
/**
- * This is special and Java specific; see Parcel.java.
- * This should be considered a success, and the next readInt32 bytes can be ignored.
- */
- EX_HAS_REPLY_HEADER = -128,
-
- /**
* This is special, and indicates to native binder proxies that the
* transaction has failed at a low level.
*/
@@ -57,11 +82,106 @@
};
/**
- * One of the above values or -errno.
- * By convention, positive values are considered to mean service-specific exceptions.
+ * One of the EXCEPTION_* types.
+ *
+ * All unrecognized values are coerced into EXCEPTION_TRANSACTION_FAILED.
+ *
+ * These exceptions values are used by the SDK for parcelables. Also see Parcel.java.
*/
-typedef int32_t binder_status_t;
+typedef int32_t binder_exception_t;
+/**
+ * This is a helper class that encapsulates a standard way to keep track of and chain binder errors
+ * along with service specific errors.
+ *
+ * It is not required to be used in order to parcel/receive transactions, but it is required in
+ * order to be compatible with standard AIDL transactions.
+ */
+struct AStatus;
+typedef struct AStatus AStatus;
+
+/**
+ * New status which is considered a success.
+ */
+__attribute__((warn_unused_result)) AStatus* AStatus_newOk() __INTRODUCED_IN(29);
+
+/**
+ * New status with exception code.
+ */
+__attribute__((warn_unused_result)) AStatus* AStatus_fromExceptionCode(binder_exception_t exception)
+ __INTRODUCED_IN(29);
+
+/**
+ * New status with exception code and message.
+ */
+__attribute__((warn_unused_result)) AStatus* AStatus_fromExceptionCodeWithMessage(
+ binder_exception_t exception, const char* message) __INTRODUCED_IN(29);
+
+/**
+ * New status with a service speciic error.
+ *
+ * This is considered to be EX_TRANSACTION_FAILED with extra information.
+ */
+__attribute__((warn_unused_result)) AStatus* AStatus_fromServiceSpecificError(
+ int32_t serviceSpecific) __INTRODUCED_IN(29);
+
+/**
+ * New status with a service specific error and message.
+ *
+ * This is considered to be EX_TRANSACTION_FAILED with extra information.
+ */
+__attribute__((warn_unused_result)) AStatus* AStatus_fromServiceSpecificErrorWithMessage(
+ int32_t serviceSpecific, const char* message) __INTRODUCED_IN(29);
+
+/**
+ * New status with binder_status_t. This is typically for low level failures when a binder_status_t
+ * is returned by an API on AIBinder or AParcel, and that is to be returned from a method returning
+ * an AStatus instance.
+ */
+__attribute__((warn_unused_result)) AStatus* AStatus_fromStatus(binder_status_t status)
+ __INTRODUCED_IN(29);
+
+/**
+ * Whether this object represents a successful transaction. If this function returns true, then
+ * AStatus_getExceptionCode will return EX_NONE.
+ */
+bool AStatus_isOk(const AStatus* status) __INTRODUCED_IN(29);
+
+/**
+ * The exception that this status object represents.
+ */
+binder_exception_t AStatus_getExceptionCode(const AStatus* status) __INTRODUCED_IN(29);
+
+/**
+ * The service specific error if this object represents one. This function will only ever return a
+ * non-zero result if AStatus_getExceptionCode returns EX_SERVICE_SPECIFIC. If this function returns
+ * 0, the status object may still represent a different exception or status. To find out if this
+ * transaction as a whole is okay, use AStatus_isOk instead.
+ */
+int32_t AStatus_getServiceSpecificError(const AStatus* status) __INTRODUCED_IN(29);
+
+/**
+ * The status if this object represents one. This function will only ever return a non-zero result
+ * if AStatus_getExceptionCode returns EX_TRANSACTION_FAILED. If this function return 0, the status
+ * object may represent a different exception or a service specific error. To find out if this
+ * transaction as a whole is okay, use AStatus_isOk instead.
+ */
+binder_status_t AStatus_getStatus(const AStatus* status) __INTRODUCED_IN(29);
+
+/**
+ * If there is a message associated with this status, this will return that message. If there is no
+ * message, this will return an empty string.
+ *
+ * The returned string has the lifetime of the status object passed into this function.
+ */
+const char* AStatus_getMessage(const AStatus* status) __INTRODUCED_IN(29);
+
+/**
+ * Deletes memory associated with the status instance.
+ */
+void AStatus_delete(AStatus* status) __INTRODUCED_IN(29);
+
+#endif //__ANDROID_API__ >= __ANDROID_API_Q__
__END_DECLS
/** @} */
diff --git a/libs/binder/ndk/libbinder_ndk.map.txt b/libs/binder/ndk/libbinder_ndk.map.txt
new file mode 100644
index 0000000..4f486c9
--- /dev/null
+++ b/libs/binder/ndk/libbinder_ndk.map.txt
@@ -0,0 +1,63 @@
+LIBBINDER_NDK { # introduced=29
+ global:
+ AIBinder_associateClass;
+ AIBinder_Class_define;
+ AIBinder_DeathRecipient_delete;
+ AIBinder_DeathRecipient_new;
+ AIBinder_debugGetRefCount;
+ AIBinder_decStrong;
+ AIBinder_fromJavaBinder;
+ AIBinder_getClass;
+ AIBinder_getUserData;
+ AIBinder_incStrong;
+ AIBinder_isAlive;
+ AIBinder_isRemote;
+ AIBinder_linkToDeath;
+ AIBinder_new;
+ AIBinder_ping;
+ AIBinder_prepareTransaction;
+ AIBinder_toJavaBinder;
+ AIBinder_transact;
+ AIBinder_unlinkToDeath;
+ AIBinder_Weak_delete;
+ AIBinder_Weak_new;
+ AIBinder_Weak_promote;
+ AParcel_delete;
+ AParcel_readBool;
+ AParcel_readByte;
+ AParcel_readChar;
+ AParcel_readDouble;
+ AParcel_readFloat;
+ AParcel_readInt32;
+ AParcel_readInt64;
+ AParcel_readNullableStrongBinder;
+ AParcel_readStatusHeader;
+ AParcel_readStrongBinder;
+ AParcel_readUint32;
+ AParcel_readUint64;
+ AParcel_writeBool;
+ AParcel_writeByte;
+ AParcel_writeChar;
+ AParcel_writeDouble;
+ AParcel_writeFloat;
+ AParcel_writeInt32;
+ AParcel_writeInt64;
+ AParcel_writeStatusHeader;
+ AParcel_writeStrongBinder;
+ AParcel_writeUint32;
+ AParcel_writeUint64;
+ AStatus_delete;
+ AStatus_fromExceptionCode;
+ AStatus_fromExceptionCodeWithMessage;
+ AStatus_fromServiceSpecificError;
+ AStatus_fromServiceSpecificErrorWithMessage;
+ AStatus_fromStatus;
+ AStatus_getExceptionCode;
+ AStatus_getMessage;
+ AStatus_getServiceSpecificError;
+ AStatus_getStatus;
+ AStatus_isOk;
+ AStatus_newOk;
+ local:
+ *;
+};
diff --git a/libs/binder/ndk/parcel.cpp b/libs/binder/ndk/parcel.cpp
index ccdfc7b..385e898 100644
--- a/libs/binder/ndk/parcel.cpp
+++ b/libs/binder/ndk/parcel.cpp
@@ -18,122 +18,148 @@
#include "parcel_internal.h"
#include "ibinder_internal.h"
+#include "status_internal.h"
#include <binder/Parcel.h>
using ::android::IBinder;
using ::android::Parcel;
using ::android::sp;
+using ::android::status_t;
-void AParcel_delete(AParcel** parcel) {
- if (parcel == nullptr) {
- return;
- }
-
- delete *parcel;
- *parcel = nullptr;
+void AParcel_delete(AParcel* parcel) {
+ delete parcel;
}
binder_status_t AParcel_writeStrongBinder(AParcel* parcel, AIBinder* binder) {
sp<IBinder> writeBinder = binder != nullptr ? binder->getBinder() : nullptr;
- return (*parcel)->writeStrongBinder(writeBinder);
+ return parcel->get()->writeStrongBinder(writeBinder);
}
binder_status_t AParcel_readStrongBinder(const AParcel* parcel, AIBinder** binder) {
sp<IBinder> readBinder = nullptr;
- binder_status_t status = (*parcel)->readStrongBinder(&readBinder);
- if (status != EX_NONE) {
- return status;
+ status_t status = parcel->get()->readStrongBinder(&readBinder);
+ if (status != STATUS_OK) {
+ return PruneStatusT(status);
}
sp<AIBinder> ret = ABpBinder::lookupOrCreateFromBinder(readBinder);
AIBinder_incStrong(ret.get());
*binder = ret.get();
- return status;
+ return PruneStatusT(status);
}
binder_status_t AParcel_readNullableStrongBinder(const AParcel* parcel, AIBinder** binder) {
sp<IBinder> readBinder = nullptr;
- binder_status_t status = (*parcel)->readNullableStrongBinder(&readBinder);
- if (status != EX_NONE) {
- return status;
+ status_t status = parcel->get()->readNullableStrongBinder(&readBinder);
+ if (status != STATUS_OK) {
+ return PruneStatusT(status);
}
sp<AIBinder> ret = ABpBinder::lookupOrCreateFromBinder(readBinder);
AIBinder_incStrong(ret.get());
*binder = ret.get();
- return status;
+ return PruneStatusT(status);
+}
+binder_status_t AParcel_writeStatusHeader(AParcel* parcel, const AStatus* status) {
+ return PruneStatusT(status->get()->writeToParcel(parcel->get()));
+}
+binder_status_t AParcel_readStatusHeader(const AParcel* parcel, AStatus** status) {
+ ::android::binder::Status bstatus;
+ binder_status_t ret = PruneStatusT(bstatus.readFromParcel(*parcel->get()));
+ if (ret == EX_NONE) {
+ *status = new AStatus(std::move(bstatus));
+ }
+ return ret;
}
// See gen_parcel_helper.py. These auto-generated read/write methods use the same types for
// libbinder and this library.
// @START
binder_status_t AParcel_writeInt32(AParcel* parcel, int32_t value) {
- return (*parcel)->writeInt32(value);
+ status_t status = parcel->get()->writeInt32(value);
+ return PruneStatusT(status);
}
binder_status_t AParcel_writeUint32(AParcel* parcel, uint32_t value) {
- return (*parcel)->writeUint32(value);
+ status_t status = parcel->get()->writeUint32(value);
+ return PruneStatusT(status);
}
binder_status_t AParcel_writeInt64(AParcel* parcel, int64_t value) {
- return (*parcel)->writeInt64(value);
+ status_t status = parcel->get()->writeInt64(value);
+ return PruneStatusT(status);
}
binder_status_t AParcel_writeUint64(AParcel* parcel, uint64_t value) {
- return (*parcel)->writeUint64(value);
+ status_t status = parcel->get()->writeUint64(value);
+ return PruneStatusT(status);
}
binder_status_t AParcel_writeFloat(AParcel* parcel, float value) {
- return (*parcel)->writeFloat(value);
+ status_t status = parcel->get()->writeFloat(value);
+ return PruneStatusT(status);
}
binder_status_t AParcel_writeDouble(AParcel* parcel, double value) {
- return (*parcel)->writeDouble(value);
+ status_t status = parcel->get()->writeDouble(value);
+ return PruneStatusT(status);
}
binder_status_t AParcel_writeBool(AParcel* parcel, bool value) {
- return (*parcel)->writeBool(value);
+ status_t status = parcel->get()->writeBool(value);
+ return PruneStatusT(status);
}
binder_status_t AParcel_writeChar(AParcel* parcel, char16_t value) {
- return (*parcel)->writeChar(value);
+ status_t status = parcel->get()->writeChar(value);
+ return PruneStatusT(status);
}
binder_status_t AParcel_writeByte(AParcel* parcel, int8_t value) {
- return (*parcel)->writeByte(value);
+ status_t status = parcel->get()->writeByte(value);
+ return PruneStatusT(status);
}
binder_status_t AParcel_readInt32(const AParcel* parcel, int32_t* value) {
- return (*parcel)->readInt32(value);
+ status_t status = parcel->get()->readInt32(value);
+ return PruneStatusT(status);
}
binder_status_t AParcel_readUint32(const AParcel* parcel, uint32_t* value) {
- return (*parcel)->readUint32(value);
+ status_t status = parcel->get()->readUint32(value);
+ return PruneStatusT(status);
}
binder_status_t AParcel_readInt64(const AParcel* parcel, int64_t* value) {
- return (*parcel)->readInt64(value);
+ status_t status = parcel->get()->readInt64(value);
+ return PruneStatusT(status);
}
binder_status_t AParcel_readUint64(const AParcel* parcel, uint64_t* value) {
- return (*parcel)->readUint64(value);
+ status_t status = parcel->get()->readUint64(value);
+ return PruneStatusT(status);
}
binder_status_t AParcel_readFloat(const AParcel* parcel, float* value) {
- return (*parcel)->readFloat(value);
+ status_t status = parcel->get()->readFloat(value);
+ return PruneStatusT(status);
}
binder_status_t AParcel_readDouble(const AParcel* parcel, double* value) {
- return (*parcel)->readDouble(value);
+ status_t status = parcel->get()->readDouble(value);
+ return PruneStatusT(status);
}
binder_status_t AParcel_readBool(const AParcel* parcel, bool* value) {
- return (*parcel)->readBool(value);
+ status_t status = parcel->get()->readBool(value);
+ return PruneStatusT(status);
}
binder_status_t AParcel_readChar(const AParcel* parcel, char16_t* value) {
- return (*parcel)->readChar(value);
+ status_t status = parcel->get()->readChar(value);
+ return PruneStatusT(status);
}
binder_status_t AParcel_readByte(const AParcel* parcel, int8_t* value) {
- return (*parcel)->readByte(value);
+ status_t status = parcel->get()->readByte(value);
+ return PruneStatusT(status);
}
// @END
diff --git a/libs/binder/ndk/parcel_internal.h b/libs/binder/ndk/parcel_internal.h
index b6a9110..d69971f 100644
--- a/libs/binder/ndk/parcel_internal.h
+++ b/libs/binder/ndk/parcel_internal.h
@@ -24,8 +24,8 @@
#include "ibinder_internal.h"
struct AParcel {
- const ::android::Parcel* operator->() const { return mParcel; }
- ::android::Parcel* operator->() { return mParcel; }
+ const ::android::Parcel* get() const { return mParcel; }
+ ::android::Parcel* get() { return mParcel; }
AParcel(const AIBinder* binder) : AParcel(binder, new ::android::Parcel, true /*owns*/) {}
AParcel(const AIBinder* binder, ::android::Parcel* parcel, bool owns)
diff --git a/libs/binder/ndk/runtests.sh b/libs/binder/ndk/runtests.sh
index 6c8527d..2257eb2 100755
--- a/libs/binder/ndk/runtests.sh
+++ b/libs/binder/ndk/runtests.sh
@@ -37,4 +37,7 @@
adb wait-for-device
adb sync data
+# very simple unit tests, tests things outside of the NDK as well
run_libbinder_ndk_test
+
+atest android.binder.cts.NdkBinderTest
diff --git a/libs/binder/ndk/scripts/gen_parcel_helper.py b/libs/binder/ndk/scripts/gen_parcel_helper.py
index 794afe2..bbd3e5d 100755
--- a/libs/binder/ndk/scripts/gen_parcel_helper.py
+++ b/libs/binder/ndk/scripts/gen_parcel_helper.py
@@ -66,18 +66,20 @@
header += "/**\n"
header += " * Writes " + cpp + " value to the next location in a non-null parcel.\n"
header += " */\n"
- header += "binder_status_t AParcel_write" + pretty + "(AParcel* parcel, " + cpp + " value);\n\n"
+ header += "binder_status_t AParcel_write" + pretty + "(AParcel* parcel, " + cpp + " value) __INTRODUCED_IN(29);\n\n"
source += "binder_status_t AParcel_write" + pretty + "(AParcel* parcel, " + cpp + " value) {\n"
- source += " return (*parcel)->write" + pretty + "(value);\n"
+ source += " status_t status = parcel->get()->write" + pretty + "(value);\n"
+ source += " return PruneStatusT(status);\n"
source += "}\n\n"
for pretty, cpp in data_types:
header += "/**\n"
header += " * Reads into " + cpp + " value from the next location in a non-null parcel.\n"
header += " */\n"
- header += "binder_status_t AParcel_read" + pretty + "(const AParcel* parcel, " + cpp + "* value);\n\n"
+ header += "binder_status_t AParcel_read" + pretty + "(const AParcel* parcel, " + cpp + "* value) __INTRODUCED_IN(29);\n\n"
source += "binder_status_t AParcel_read" + pretty + "(const AParcel* parcel, " + cpp + "* value) {\n"
- source += " return (*parcel)->read" + pretty + "(value);\n"
+ source += " status_t status = parcel->get()->read" + pretty + "(value);\n"
+ source += " return PruneStatusT(status);\n"
source += "}\n\n"
replaceFileTags(ROOT + "include_ndk/android/binder_parcel.h", header)
diff --git a/libs/binder/ndk/scripts/init_map.sh b/libs/binder/ndk/scripts/init_map.sh
new file mode 100755
index 0000000..1f74e43
--- /dev/null
+++ b/libs/binder/ndk/scripts/init_map.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+# Simple helper for ease of development until this API is frozen.
+
+echo "LIBBINDER_NDK { # introduced=29"
+echo " global:"
+{
+ grep -oP "AIBinder_[a-zA-Z0-9_]+(?=\()" include_ndk/android/binder_ibinder.h;
+ grep -oP "AIBinder_[a-zA-Z0-9_]+(?=\()" include_ndk/android/binder_ibinder_jni.h;
+ grep -oP "AParcel_[a-zA-Z0-9_]+(?=\()" include_ndk/android/binder_parcel.h;
+ grep -oP "AStatus_[a-zA-Z0-9_]+(?=\()" include_ndk/android/binder_status.h;
+} | sort | uniq | awk '{ print " " $0 ";"; }'
+echo " local:"
+echo " *;"
+echo "};"
diff --git a/libs/binder/ndk/service_manager.cpp b/libs/binder/ndk/service_manager.cpp
index 5bc69b0..9ddc555 100644
--- a/libs/binder/ndk/service_manager.cpp
+++ b/libs/binder/ndk/service_manager.cpp
@@ -15,7 +15,9 @@
*/
#include <android/binder_manager.h>
+
#include "ibinder_internal.h"
+#include "status_internal.h"
#include <binder/IServiceManager.h>
@@ -23,15 +25,17 @@
using ::android::IBinder;
using ::android::IServiceManager;
using ::android::sp;
+using ::android::status_t;
using ::android::String16;
binder_status_t AServiceManager_addService(AIBinder* binder, const char* instance) {
if (binder == nullptr || instance == nullptr) {
- return EX_NULL_POINTER;
+ return STATUS_UNEXPECTED_NULL;
}
sp<IServiceManager> sm = defaultServiceManager();
- return sm->addService(String16(instance), binder->getBinder());
+ status_t status = sm->addService(String16(instance), binder->getBinder());
+ return PruneStatusT(status);
}
AIBinder* AServiceManager_getService(const char* instance) {
if (instance == nullptr) {
diff --git a/libs/binder/ndk/status.cpp b/libs/binder/ndk/status.cpp
new file mode 100644
index 0000000..e0ae469
--- /dev/null
+++ b/libs/binder/ndk/status.cpp
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2018 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 <android/binder_status.h>
+#include "status_internal.h"
+
+#include <android-base/logging.h>
+
+using ::android::status_t;
+using ::android::binder::Status;
+
+AStatus* AStatus_newOk() {
+ return new AStatus();
+}
+
+AStatus* AStatus_fromExceptionCode(binder_exception_t exception) {
+ return new AStatus(Status::fromExceptionCode(exception));
+}
+
+AStatus* AStatus_fromExceptionCodeWithMessage(binder_exception_t exception, const char* message) {
+ return new AStatus(Status::fromExceptionCode(exception, message));
+}
+
+AStatus* AStatus_fromServiceSpecificError(int32_t serviceSpecific) {
+ return new AStatus(Status::fromServiceSpecificError(serviceSpecific));
+}
+
+AStatus* AStatus_fromServiceSpecificErrorWithMessage(int32_t serviceSpecific, const char* message) {
+ return new AStatus(Status::fromServiceSpecificError(serviceSpecific, message));
+}
+
+AStatus* AStatus_fromStatus(binder_status_t status) {
+ return new AStatus(Status::fromStatusT(status));
+}
+
+bool AStatus_isOk(const AStatus* status) {
+ return status->get()->isOk();
+}
+
+binder_exception_t AStatus_getExceptionCode(const AStatus* status) {
+ return PruneException(status->get()->exceptionCode());
+}
+
+int32_t AStatus_getServiceSpecificError(const AStatus* status) {
+ return status->get()->serviceSpecificErrorCode();
+}
+
+binder_status_t AStatus_getStatus(const AStatus* status) {
+ return PruneStatusT(status->get()->transactionError());
+}
+
+const char* AStatus_getMessage(const AStatus* status) {
+ return status->get()->exceptionMessage().c_str();
+}
+
+void AStatus_delete(AStatus* status) {
+ delete status;
+}
+
+binder_status_t PruneStatusT(status_t status) {
+ switch (status) {
+ case ::android::OK:
+ return STATUS_OK;
+ case ::android::NO_MEMORY:
+ return STATUS_NO_MEMORY;
+ case ::android::INVALID_OPERATION:
+ return STATUS_INVALID_OPERATION;
+ case ::android::BAD_VALUE:
+ return STATUS_BAD_VALUE;
+ case ::android::BAD_TYPE:
+ return STATUS_BAD_TYPE;
+ case ::android::NAME_NOT_FOUND:
+ return STATUS_NAME_NOT_FOUND;
+ case ::android::PERMISSION_DENIED:
+ return STATUS_PERMISSION_DENIED;
+ case ::android::NO_INIT:
+ return STATUS_NO_INIT;
+ case ::android::ALREADY_EXISTS:
+ return STATUS_ALREADY_EXISTS;
+ case ::android::DEAD_OBJECT:
+ return STATUS_DEAD_OBJECT;
+ case ::android::FAILED_TRANSACTION:
+ return STATUS_FAILED_TRANSACTION;
+ case ::android::BAD_INDEX:
+ return STATUS_BAD_INDEX;
+ case ::android::NOT_ENOUGH_DATA:
+ return STATUS_NOT_ENOUGH_DATA;
+ case ::android::WOULD_BLOCK:
+ return STATUS_WOULD_BLOCK;
+ case ::android::TIMED_OUT:
+ return STATUS_TIMED_OUT;
+ case ::android::UNKNOWN_TRANSACTION:
+ return STATUS_UNKNOWN_TRANSACTION;
+ case ::android::FDS_NOT_ALLOWED:
+ return STATUS_FDS_NOT_ALLOWED;
+ case ::android::UNEXPECTED_NULL:
+ return STATUS_UNEXPECTED_NULL;
+ case ::android::UNKNOWN_ERROR:
+ return STATUS_UNKNOWN_ERROR;
+
+ default:
+ LOG(WARNING) << __func__
+ << ": Unknown status_t pruned into STATUS_UNKNOWN_ERROR: " << status;
+ return STATUS_UNKNOWN_ERROR;
+ }
+}
+
+binder_exception_t PruneException(int32_t exception) {
+ switch (exception) {
+ case Status::EX_NONE:
+ return EX_NONE;
+ case Status::EX_SECURITY:
+ return EX_SECURITY;
+ case Status::EX_BAD_PARCELABLE:
+ return EX_BAD_PARCELABLE;
+ case Status::EX_ILLEGAL_ARGUMENT:
+ return EX_ILLEGAL_ARGUMENT;
+ case Status::EX_NULL_POINTER:
+ return EX_NULL_POINTER;
+ case Status::EX_ILLEGAL_STATE:
+ return EX_ILLEGAL_STATE;
+ case Status::EX_NETWORK_MAIN_THREAD:
+ return EX_NETWORK_MAIN_THREAD;
+ case Status::EX_UNSUPPORTED_OPERATION:
+ return EX_UNSUPPORTED_OPERATION;
+ case Status::EX_SERVICE_SPECIFIC:
+ return EX_SERVICE_SPECIFIC;
+ case Status::EX_PARCELABLE:
+ return EX_PARCELABLE;
+ case Status::EX_TRANSACTION_FAILED:
+ return EX_TRANSACTION_FAILED;
+
+ default:
+ LOG(WARNING) << __func__
+ << ": Unknown status_t pruned into EX_TRANSACTION_FAILED: " << exception;
+ return EX_TRANSACTION_FAILED;
+ }
+}
diff --git a/libs/binder/ndk/status_internal.h b/libs/binder/ndk/status_internal.h
new file mode 100644
index 0000000..8c32baf
--- /dev/null
+++ b/libs/binder/ndk/status_internal.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+#pragma once
+
+#include <android/binder_status.h>
+
+#include <binder/Status.h>
+#include <utils/Errors.h>
+
+struct AStatus {
+ AStatus() {} // ok
+ AStatus(::android::binder::Status&& status) : mStatus(std::move(status)) {}
+
+ ::android::binder::Status* get() { return &mStatus; }
+ const ::android::binder::Status* get() const { return &mStatus; }
+
+private:
+ ::android::binder::Status mStatus;
+};
+
+// This collapses the statuses into the declared range.
+binder_status_t PruneStatusT(android::status_t status);
+
+// This collapses the exception into the declared range.
+binder_exception_t PruneException(int32_t exception);
diff --git a/libs/binder/ndk/test/Android.bp b/libs/binder/ndk/test/Android.bp
index d242138..8e40a01 100644
--- a/libs/binder/ndk/test/Android.bp
+++ b/libs/binder/ndk/test/Android.bp
@@ -44,6 +44,7 @@
name: "test_libbinder_ndk_test_defaults",
defaults: ["test_libbinder_ndk_defaults"],
shared_libs: [
+ "libandroid_runtime",
"libbase",
"libbinder",
"libutils",
diff --git a/libs/binder/ndk/test/iface.cpp b/libs/binder/ndk/test/iface.cpp
index a1aa0fa..0dc3cc4 100644
--- a/libs/binder/ndk/test/iface.cpp
+++ b/libs/binder/ndk/test/iface.cpp
@@ -41,7 +41,7 @@
binder_status_t IFoo_Class_onTransact(AIBinder* binder, transaction_code_t code, const AParcel* in,
AParcel* out) {
- binder_status_t stat = EX_UNSUPPORTED_OPERATION;
+ binder_status_t stat = STATUS_FAILED_TRANSACTION;
sp<IFoo> foo = static_cast<IFoo_Class_Data*>(AIBinder_getUserData(binder))->foo;
CHECK(foo != nullptr) << "Transaction made on already deleted object";
@@ -50,7 +50,7 @@
case IFoo::DOFOO: {
int32_t valueIn;
stat = AParcel_readInt32(in, &valueIn);
- if (stat != EX_NONE) break;
+ if (stat != STATUS_OK) break;
int32_t valueOut = foo->doubleNumber(valueIn);
stat = AParcel_writeInt32(out, valueOut);
break;
@@ -70,18 +70,18 @@
virtual int32_t doubleNumber(int32_t in) {
AParcel* parcelIn;
- CHECK(EX_NONE == AIBinder_prepareTransaction(mBinder, &parcelIn));
+ CHECK(STATUS_OK == AIBinder_prepareTransaction(mBinder, &parcelIn));
- CHECK(EX_NONE == AParcel_writeInt32(parcelIn, in));
+ CHECK(STATUS_OK == AParcel_writeInt32(parcelIn, in));
AParcel* parcelOut;
- CHECK(EX_NONE ==
+ CHECK(STATUS_OK ==
AIBinder_transact(mBinder, IFoo::DOFOO, &parcelIn, &parcelOut, 0 /*flags*/));
int32_t out;
- CHECK(EX_NONE == AParcel_readInt32(parcelOut, &out));
+ CHECK(STATUS_OK == AParcel_readInt32(parcelOut, &out));
- AParcel_delete(&parcelOut);
+ AParcel_delete(parcelOut);
return out;
}
@@ -92,7 +92,7 @@
};
IFoo::~IFoo() {
- AIBinder_Weak_delete(&mWeakBinder);
+ AIBinder_Weak_delete(mWeakBinder);
}
binder_status_t IFoo::addService(const char* instance) {
@@ -106,7 +106,7 @@
// or one strong refcount here
binder = AIBinder_new(IFoo::kClass, static_cast<void*>(new IFoo_Class_Data{this}));
if (mWeakBinder != nullptr) {
- AIBinder_Weak_delete(&mWeakBinder);
+ AIBinder_Weak_delete(mWeakBinder);
}
mWeakBinder = AIBinder_Weak_new(binder);
}
diff --git a/libs/binder/ndk/test/main_client.cpp b/libs/binder/ndk/test/main_client.cpp
index b8518d7..3fc096a 100644
--- a/libs/binder/ndk/test/main_client.cpp
+++ b/libs/binder/ndk/test/main_client.cpp
@@ -15,6 +15,7 @@
*/
#include <android-base/logging.h>
+#include <android/binder_ibinder_jni.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <gtest/gtest.h>
@@ -41,7 +42,7 @@
ASSERT_NE(nullptr, binder);
EXPECT_TRUE(AIBinder_isRemote(binder));
EXPECT_TRUE(AIBinder_isAlive(binder));
- EXPECT_EQ(EX_NONE, AIBinder_ping(binder));
+ EXPECT_EQ(STATUS_OK, AIBinder_ping(binder));
AIBinder_decStrong(binder);
}
@@ -60,11 +61,13 @@
AIBinder_DeathRecipient* recipient = AIBinder_DeathRecipient_new(OnBinderDeath);
ASSERT_NE(nullptr, recipient);
- EXPECT_EQ(EX_NONE, AIBinder_linkToDeath(binder, recipient, nullptr));
- EXPECT_EQ(EX_NONE, AIBinder_unlinkToDeath(binder, recipient, nullptr));
- EXPECT_EQ(-ENOENT, AIBinder_unlinkToDeath(binder, recipient, nullptr));
+ EXPECT_EQ(STATUS_OK, AIBinder_linkToDeath(binder, recipient, nullptr));
+ EXPECT_EQ(STATUS_OK, AIBinder_linkToDeath(binder, recipient, nullptr));
+ EXPECT_EQ(STATUS_OK, AIBinder_unlinkToDeath(binder, recipient, nullptr));
+ EXPECT_EQ(STATUS_OK, AIBinder_unlinkToDeath(binder, recipient, nullptr));
+ EXPECT_EQ(STATUS_NAME_NOT_FOUND, AIBinder_unlinkToDeath(binder, recipient, nullptr));
- AIBinder_DeathRecipient_delete(&recipient);
+ AIBinder_DeathRecipient_delete(recipient);
AIBinder_decStrong(binder);
}
@@ -79,7 +82,7 @@
static const char* kInstanceName = "test-get-service-in-process";
sp<IFoo> foo = new MyTestFoo;
- EXPECT_EQ(EX_NONE, foo->addService(kInstanceName));
+ EXPECT_EQ(STATUS_OK, foo->addService(kInstanceName));
sp<IFoo> getFoo = IFoo::getService(kInstanceName);
EXPECT_EQ(foo.get(), getFoo.get());
@@ -100,6 +103,11 @@
AIBinder_decStrong(binderB);
}
+TEST(NdkBinder, ToFromJavaNullptr) {
+ EXPECT_EQ(nullptr, AIBinder_toJavaBinder(nullptr, nullptr));
+ EXPECT_EQ(nullptr, AIBinder_fromJavaBinder(nullptr, nullptr));
+}
+
TEST(NdkBinder, ABpBinderRefCount) {
AIBinder* binder = AServiceManager_getService(kExistingNonNdkService);
AIBinder_Weak* wBinder = AIBinder_Weak_new(binder);
@@ -112,14 +120,14 @@
// assert because would need to decStrong if non-null and we shouldn't need to add a no-op here
ASSERT_NE(nullptr, AIBinder_Weak_promote(wBinder));
- AIBinder_Weak_delete(&wBinder);
+ AIBinder_Weak_delete(wBinder);
}
TEST(NdkBinder, AddServiceMultipleTimes) {
static const char* kInstanceName1 = "test-multi-1";
static const char* kInstanceName2 = "test-multi-2";
sp<IFoo> foo = new MyTestFoo;
- EXPECT_EQ(EX_NONE, foo->addService(kInstanceName1));
- EXPECT_EQ(EX_NONE, foo->addService(kInstanceName2));
+ EXPECT_EQ(STATUS_OK, foo->addService(kInstanceName1));
+ EXPECT_EQ(STATUS_OK, foo->addService(kInstanceName2));
EXPECT_EQ(IFoo::getService(kInstanceName1), IFoo::getService(kInstanceName2));
}
diff --git a/libs/binder/ndk/test/main_server.cpp b/libs/binder/ndk/test/main_server.cpp
index f3da7da..0718a69 100644
--- a/libs/binder/ndk/test/main_server.cpp
+++ b/libs/binder/ndk/test/main_server.cpp
@@ -33,7 +33,7 @@
// Strong reference to MyFoo kept by service manager.
binder_status_t status = (new MyFoo)->addService(IFoo::kSomeInstanceName);
- if (status != EX_NONE) {
+ if (status != STATUS_OK) {
LOG(FATAL) << "Could not register: " << status;
}
diff --git a/libs/binder/ndk/update.sh b/libs/binder/ndk/update.sh
index 1eba892..49b4730 100755
--- a/libs/binder/ndk/update.sh
+++ b/libs/binder/ndk/update.sh
@@ -18,5 +18,6 @@
set -ex
# This script makes sure that the source code is in sync with the various scripts
+./scripts/init_map.sh > libbinder_ndk.map.txt
./scripts/gen_parcel_helper.py
./scripts/format.sh
diff --git a/libs/input/Android.bp b/libs/input/Android.bp
index 2f39976..a2d6a8a 100644
--- a/libs/input/Android.bp
+++ b/libs/input/Android.bp
@@ -16,6 +16,7 @@
cc_library {
name: "libinput",
+ cpp_std: "c++17",
host_supported: true,
cflags: [
"-Wall",
diff --git a/libs/input/VelocityTracker.cpp b/libs/input/VelocityTracker.cpp
index c07a812..f72e49b 100644
--- a/libs/input/VelocityTracker.cpp
+++ b/libs/input/VelocityTracker.cpp
@@ -23,9 +23,11 @@
// Log debug messages about the progress of the algorithm itself.
#define DEBUG_STRATEGY 0
+#include <array>
#include <inttypes.h>
#include <limits.h>
#include <math.h>
+#include <optional>
#include <android-base/stringprintf.h>
#include <cutils/properties.h>
@@ -564,7 +566,9 @@
* Optimized unweighted second-order least squares fit. About 2x speed improvement compared to
* the default implementation
*/
-static float solveUnweightedLeastSquaresDeg2(const float* x, const float* y, size_t count) {
+static std::optional<std::array<float, 3>> solveUnweightedLeastSquaresDeg2(
+ const float* x, const float* y, size_t count) {
+ // Solving y = a*x^2 + b*x + c
float sxi = 0, sxiyi = 0, syi = 0, sxi2 = 0, sxi3 = 0, sxi2yi = 0, sxi4 = 0;
for (size_t i = 0; i < count; i++) {
@@ -573,8 +577,8 @@
float xi2 = xi*xi;
float xi3 = xi2*xi;
float xi4 = xi3*xi;
- float xi2yi = xi2*yi;
float xiyi = xi*yi;
+ float xi2yi = xi2*yi;
sxi += xi;
sxi2 += xi2;
@@ -591,13 +595,23 @@
float Sx2y = sxi2yi - sxi2*syi / count;
float Sx2x2 = sxi4 - sxi2*sxi2 / count;
- float numerator = Sxy*Sx2x2 - Sx2y*Sxx2;
float denominator = Sxx*Sx2x2 - Sxx2*Sxx2;
if (denominator == 0) {
ALOGW("division by 0 when computing velocity, Sxx=%f, Sx2x2=%f, Sxx2=%f", Sxx, Sx2x2, Sxx2);
- return 0;
+ return std::nullopt;
}
- return numerator/denominator;
+ // Compute a
+ float numerator = Sx2y*Sxx - Sxy*Sxx2;
+ float a = numerator / denominator;
+
+ // Compute b
+ numerator = Sxy*Sx2x2 - Sx2y*Sxx2;
+ float b = numerator / denominator;
+
+ // Compute c
+ float c = syi/count - b * sxi/count - a * sxi2/count;
+
+ return std::make_optional(std::array<float, 3>({c, b, a}));
}
bool LeastSquaresVelocityTrackerStrategy::getEstimator(uint32_t id,
@@ -640,20 +654,23 @@
if (degree > m - 1) {
degree = m - 1;
}
- if (degree >= 1) {
- if (degree == 2 && mWeighting == WEIGHTING_NONE) { // optimize unweighted, degree=2 fit
+
+ if (degree == 2 && mWeighting == WEIGHTING_NONE) {
+ // Optimize unweighted, quadratic polynomial fit
+ std::optional<std::array<float, 3>> xCoeff = solveUnweightedLeastSquaresDeg2(time, x, m);
+ std::optional<std::array<float, 3>> yCoeff = solveUnweightedLeastSquaresDeg2(time, y, m);
+ if (xCoeff && yCoeff) {
outEstimator->time = newestMovement.eventTime;
outEstimator->degree = 2;
outEstimator->confidence = 1;
- outEstimator->xCoeff[0] = 0; // only slope is calculated, set rest of coefficients = 0
- outEstimator->yCoeff[0] = 0;
- outEstimator->xCoeff[1] = solveUnweightedLeastSquaresDeg2(time, x, m);
- outEstimator->yCoeff[1] = solveUnweightedLeastSquaresDeg2(time, y, m);
- outEstimator->xCoeff[2] = 0;
- outEstimator->yCoeff[2] = 0;
+ for (size_t i = 0; i <= outEstimator->degree; i++) {
+ outEstimator->xCoeff[i] = (*xCoeff)[i];
+ outEstimator->yCoeff[i] = (*yCoeff)[i];
+ }
return true;
}
-
+ } else if (degree >= 1) {
+ // General case for an Nth degree polynomial fit
float xdet, ydet;
uint32_t n = degree + 1;
if (solveLeastSquares(time, x, w, m, n, outEstimator->xCoeff, &xdet)
diff --git a/libs/vr/libpdx/private/pdx/rpc/variant.h b/libs/vr/libpdx/private/pdx/rpc/variant.h
index bdcb293..0a4802e 100644
--- a/libs/vr/libpdx/private/pdx/rpc/variant.h
+++ b/libs/vr/libpdx/private/pdx/rpc/variant.h
@@ -553,7 +553,7 @@
template <typename T>
constexpr std::int32_t index_of() const {
static_assert(HasType<T>::value, "T is not an element type of Variant.");
- return value_.template index(DecayedTypeTag<T>{});
+ return value_.index(DecayedTypeTag<T>{});
}
// Returns the index of the active type. If the Variant is empty -1 is
@@ -575,7 +575,7 @@
template <typename T>
T* get() {
if (is<T>())
- return &value_.template get(DecayedTypeTag<T>{});
+ return &value_.get(DecayedTypeTag<T>{});
else
return nullptr;
}
@@ -589,7 +589,7 @@
template <std::size_t I>
TypeForIndex<I>* get() {
if (is<TypeForIndex<I>>())
- return &value_.template get(TypeTagForIndex<I>{});
+ return &value_.get(TypeTagForIndex<I>{});
else
return nullptr;
}
diff --git a/libs/vr/libpdx_default_transport/Android.bp b/libs/vr/libpdx_default_transport/Android.bp
index 74b8c8b..1176abf 100644
--- a/libs/vr/libpdx_default_transport/Android.bp
+++ b/libs/vr/libpdx_default_transport/Android.bp
@@ -40,6 +40,7 @@
"liblog",
"libutils",
"libcrypto",
+ "libselinux",
],
}
diff --git a/libs/vr/libpdx_uds/Android.bp b/libs/vr/libpdx_uds/Android.bp
index d640950..1d6eea2 100644
--- a/libs/vr/libpdx_uds/Android.bp
+++ b/libs/vr/libpdx_uds/Android.bp
@@ -26,8 +26,6 @@
],
shared_libs: [
"libbinder",
- ],
- whole_static_libs: [
"libselinux",
],
}
@@ -57,5 +55,6 @@
"liblog",
"libutils",
"libbinder",
+ "libselinux",
],
}
diff --git a/services/vr/performanced/task.cpp b/services/vr/performanced/task.cpp
index c2f078e..bda1682 100644
--- a/services/vr/performanced/task.cpp
+++ b/services/vr/performanced/task.cpp
@@ -115,7 +115,7 @@
std::istream file_stream(&filebuf);
for (std::string line; std::getline(file_stream, line);) {
- auto offset = line.find(":");
+ auto offset = line.find(':');
if (offset == std::string::npos) {
ALOGW("ReadStatusFields: Failed to find delimiter \":\" in line=\"%s\"",
line.c_str());
diff --git a/vulkan/api/vulkan.api b/vulkan/api/vulkan.api
index 8817e8d..fa63fbd 100644
--- a/vulkan/api/vulkan.api
+++ b/vulkan/api/vulkan.api
@@ -28,7 +28,7 @@
// API version (major.minor.patch)
define VERSION_MAJOR 1
define VERSION_MINOR 1
-define VERSION_PATCH 84
+define VERSION_PATCH 85
// API limits
define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256
@@ -173,6 +173,10 @@
@extension("VK_AMD_shader_image_load_store_lod") define VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_SPEC_VERSION 1
@extension("VK_AMD_shader_image_load_store_lod") define VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_EXTENSION_NAME "VK_AMD_shader_image_load_store_lod"
+// 51
+@extension("VK_NV_corner_sampled_image") define VK_NV_CORNER_SAMPLED_IMAGE_SPEC_VERSION 2
+@extension("VK_NV_corner_sampled_image") define VK_NV_CORNER_SAMPLED_IMAGE_EXTENSION_NAME "VK_NV_corner_sampled_image"
+
// 54
@extension("VK_KHR_multiview") define VK_KHR_MULTIVIEW_SPEC_VERSION 1
@extension("VK_KHR_multiview") define VK_KHR_MULTIVIEW_EXTENSION_NAME "VK_KHR_multiview"
@@ -501,10 +505,22 @@
@extension("VK_EXT_descriptor_indexing") define VK_EXT_DESCRIPTOR_INDEXING_SPEC_VERSION 2
@extension("VK_EXT_descriptor_indexing") define VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME "VK_EXT_descriptor_indexing"
-// 165
+// 163
@extension("VK_EXT_shader_viewport_index_layer") define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_SPEC_VERSION 1
@extension("VK_EXT_shader_viewport_index_layer") define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME "VK_EXT_shader_viewport_index_layer"
+// 165
+@extension("VK_NV_shading_rate_image") define VK_NV_SHADING_RATE_IMAGE_SPEC_VERSION 3
+@extension("VK_NV_shading_rate_image") define VK_NV_SHADING_RATE_IMAGE_EXTENSION_NAME "VK_NV_shading_rate_image"
+
+// 166
+@extension("VK_NVX_raytracing") define VK_NVX_RAYTRACING_SPEC_VERSION 1
+@extension("VK_NVX_raytracing") define VK_NVX_RAYTRACING_EXTENSION_NAME "VK_NVX_raytracing"
+
+// 167
+@extension("VK_NV_representative_fragment_test") define VK_NV_REPRESENTATIVE_FRAGMENT_TEST_SPEC_VERSION 1
+@extension("VK_NV_representative_fragment_test") define VK_NV_REPRESENTATIVE_FRAGMENT_TEST_EXTENSION_NAME "VK_NV_representative_fragment_test"
+
// 169
@extension("VK_KHR_maintenance3") define VK_KHR_MAINTENANCE3_SPEC_VERSION 1
@extension("VK_KHR_maintenance3") define VK_KHR_MAINTENANCE3_EXTENSION_NAME "VK_KHR_maintenance3"
@@ -541,6 +557,26 @@
@extension("VK_NV_shader_subgroup_partitioned") define VK_NV_SHADER_SUBGROUP_PARTITIONED_SPEC_VERSION 1
@extension("VK_NV_shader_subgroup_partitioned") define VK_NV_SHADER_SUBGROUP_PARTITIONED_EXTENSION_NAME "VK_NV_shader_subgroup_partitioned"
+// 202
+@extension("VK_NV_compute_shader_derivatives") define VK_NV_COMPUTE_SHADER_DERIVATIVES_SPEC_VERSION 1
+@extension("VK_NV_compute_shader_derivatives") define VK_NV_COMPUTE_SHADER_DERIVATIVES_EXTENSION_NAME "VK_NV_compute_shader_derivatives"
+
+// 203
+@extension("VK_NV_mesh_shader") define VK_NV_MESH_SHADER_SPEC_VERSION 1
+@extension("VK_NV_mesh_shader") define VK_NV_MESH_SHADER_EXTENSION_NAME "VK_NV_mesh_shader"
+
+// 204
+@extension("VK_NV_fragment_shader_barycentric") define VK_NV_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION 1
+@extension("VK_NV_fragment_shader_barycentric") define VK_NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME "VK_NV_fragment_shader_barycentric"
+
+// 205
+@extension("VK_NV_shader_image_footprint") define VK_NV_SHADER_IMAGE_FOOTPRINT_SPEC_VERSION 1
+@extension("VK_NV_shader_image_footprint") define VK_NV_SHADER_IMAGE_FOOTPRINT_EXTENSION_NAME "VK_NV_shader_image_footprint"
+
+// 206
+@extension("VK_NV_scissor_exclusive") define VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION 1
+@extension("VK_NV_scissor_exclusive") define VK_NV_SCISSOR_EXCLUSIVE_EXTENSION_NAME "VK_NV_scissor_exclusive"
+
// 207
@extension("VK_NV_device_diagnostic_checkpoints") define VK_NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_SPEC_VERSION 2
@extension("VK_NV_device_diagnostic_checkpoints") define VK_NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_EXTENSION_NAME "VK_NV_device_diagnostic_checkpoints"
@@ -620,6 +656,9 @@
// 161
@extension("VK_EXT_validation_cache") @nonDispatchHandle type u64 VkValidationCacheEXT
+// 166
+@extension("VK_NVX_raytracing") @nonDispatchHandle type u64 VkAccelerationStructureNVX
+
/////////////
// Enums //
/////////////
@@ -648,6 +687,9 @@
//@extension("VK_KHR_maintenance2") // 118
VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL_KHR = 1000117000,
VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL_KHR = 1000117001,
+
+ //@extension("VK_NV_shading_rate_image") // 165
+ VK_IMAGE_LAYOUT_SHADING_RATE_OPTIMAL_NV = 1000164003,
}
enum VkAttachmentLoadOp {
@@ -712,12 +754,18 @@
//@extension("VK_EXT_inline_uniform_block") // 139
VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT = 1000138000,
+
+ //@extension("VK_NVX_raytracing") // 166
+ VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NVX = 1000165000,
}
enum VkQueryType {
VK_QUERY_TYPE_OCCLUSION = 0x00000000,
VK_QUERY_TYPE_PIPELINE_STATISTICS = 0x00000001, /// Optional
VK_QUERY_TYPE_TIMESTAMP = 0x00000002,
+
+ //@extension("VK_NVX_raytracing") // 166
+ VK_QUERY_TYPE_COMPACTED_SIZE_NVX = 1000165000,
}
enum VkBorderColor {
@@ -732,6 +780,9 @@
enum VkPipelineBindPoint {
VK_PIPELINE_BIND_POINT_GRAPHICS = 0x00000000,
VK_PIPELINE_BIND_POINT_COMPUTE = 0x00000001,
+
+ //@extension("VK_NVX_raytracing") // 166
+ VK_PIPELINE_BIND_POINT_RAYTRACING_NVX = 1000165000,
}
enum VkPrimitiveTopology {
@@ -1387,6 +1438,9 @@
//@extension("VK_AMD_texture_gather_bias_lod") // 42
VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD = 1000041000,
+ //@extension("VK_NV_corner_sampled_image") // 51
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CORNER_SAMPLED_IMAGE_FEATURES_NV = 1000050000,
+
//@extension("VK_KHR_multiview") // 54
VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO_KHR = 1000053000,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHR = 1000053001,
@@ -1671,6 +1725,29 @@
VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO_EXT = 1000161003,
VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT_EXT = 1000161004,
+ //@extension("VK_NV_shading_rate_image") // 165
+ VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SHADING_RATE_IMAGE_STATE_CREATE_INFO_NV = 1000164000,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_FEATURES_NV = 1000164001,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_PROPERTIES_NV = 1000164002,
+ VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_COARSE_SAMPLE_ORDER_STATE_CREATE_INFO_NV = 1000164005,
+
+ //@extension("VK_NVX_raytracing") // 166
+ VK_STRUCTURE_TYPE_RAYTRACING_PIPELINE_CREATE_INFO_NVX = 1000165000,
+ VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_NVX = 1000165001,
+ VK_STRUCTURE_TYPE_GEOMETRY_INSTANCE_NVX = 1000165002,
+ VK_STRUCTURE_TYPE_GEOMETRY_NVX = 1000165003,
+ VK_STRUCTURE_TYPE_GEOMETRY_TRIANGLES_NVX = 1000165004,
+ VK_STRUCTURE_TYPE_GEOMETRY_AABB_NVX = 1000165005,
+ VK_STRUCTURE_TYPE_BIND_ACCELERATION_STRUCTURE_MEMORY_INFO_NVX = 1000165006,
+ VK_STRUCTURE_TYPE_DESCRIPTOR_ACCELERATION_STRUCTURE_INFO_NVX = 1000165007,
+ VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_INFO_NVX = 1000165008,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAYTRACING_PROPERTIES_NVX = 1000165009,
+ VK_STRUCTURE_TYPE_HIT_SHADER_MODULE_CREATE_INFO_NVX = 1000165010,
+
+ //@extension("VK_NV_representative_fragment_test") // 167
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_REPRESENTATIVE_FRAGMENT_TEST_FEATURES_NV = 1000166000,
+ VK_STRUCTURE_TYPE_PIPELINE_REPRESENTATIVE_FRAGMENT_TEST_STATE_CREATE_INFO_NV = 1000166001,
+
//@extension("VK_KHR_maintenance3") // 169
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES_KHR = 1000168000,
VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT_KHR = 1000168001,
@@ -1791,6 +1868,13 @@
//@extension("VK_EXT_sample_locations") // 144
VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT = 1000143000,
+
+ //@extension("VK_NV_shading_rate_image") // 165
+ VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV = 1000164004,
+ VK_DYNAMIC_STATE_VIEWPORT_COARSE_SAMPLE_ORDER_NV = 1000164006,
+
+ //@extension("VK_NV_scissor_exclusive") // 206
+ VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV = 1000205001,
}
enum VkObjectType {
@@ -1853,6 +1937,9 @@
//@extension("VK_EXT_validation_cache") // 161
VK_OBJECT_TYPE_VALIDATION_CACHE_EXT = 1000160000,
+
+ //@extension("VK_NVX_raytracing") // 166
+ VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_NVX = 1000165000,
}
@@ -1974,6 +2061,9 @@
//@extension("VK_KHR_sampler_ycbcr_conversion") // 157
VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR_EXT = 1000156000,
+
+ //@extension("VK_NVX_raytracing") // 166
+ VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NVX_EXT = 1000165000,
}
@extension("VK_AMD_rasterization_order") // 19
@@ -2124,6 +2214,48 @@
VK_VALIDATION_CACHE_HEADER_VERSION_ONE_EXT = 1,
}
+@extension("VK_NV_shading_rate_image") // 165
+enum VkShadingRatePaletteEntryNV {
+ VK_SHADING_RATE_PALETTE_ENTRY_NO_INVOCATIONS_NV = 0,
+ VK_SHADING_RATE_PALETTE_ENTRY_16_INVOCATIONS_PER_PIXEL_NV = 1,
+ VK_SHADING_RATE_PALETTE_ENTRY_8_INVOCATIONS_PER_PIXEL_NV = 2,
+ VK_SHADING_RATE_PALETTE_ENTRY_4_INVOCATIONS_PER_PIXEL_NV = 3,
+ VK_SHADING_RATE_PALETTE_ENTRY_2_INVOCATIONS_PER_PIXEL_NV = 4,
+ VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_PIXEL_NV = 5,
+ VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X1_PIXELS_NV = 6,
+ VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_1X2_PIXELS_NV = 7,
+ VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X2_PIXELS_NV = 8,
+ VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X2_PIXELS_NV = 9,
+ VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X4_PIXELS_NV = 10,
+ VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X4_PIXELS_NV = 11,
+}
+
+@extension("VK_NV_shading_rate_image") // 165
+enum VkCoarseSampleOrderTypeNV {
+ VK_COARSE_SAMPLE_ORDER_TYPE_DEFAULT_NV = 0,
+ VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV = 1,
+ VK_COARSE_SAMPLE_ORDER_TYPE_PIXEL_MAJOR_NV = 2,
+ VK_COARSE_SAMPLE_ORDER_TYPE_SAMPLE_MAJOR_NV = 3,
+}
+
+@extension("VK_NVX_raytracing") // 166
+enum VkGeometryTypeNVX {
+ VK_GEOMETRY_TYPE_TRIANGLES_NVX = 0,
+ VK_GEOMETRY_TYPE_AABBS_NVX = 1,
+}
+
+@extension("VK_NVX_raytracing") // 166
+enum VkAccelerationStructureTypeNVX {
+ VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NVX = 0,
+ VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NVX = 1,
+}
+
+@extension("VK_NVX_raytracing") // 166
+enum VkCopyAccelerationStructureModeNVX {
+ VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_NVX = 0,
+ VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NVX = 1,
+}
+
@extension("VK_EXT_global_priority") // 175
enum VkQueueGlobalPriorityEXT {
VK_QUEUE_GLOBAL_PRIORITY_LOW_EXT = 128,
@@ -2203,6 +2335,13 @@
//@extension("VK_EXT_conditional_rendering") // 82
VK_ACCESS_CONDITIONAL_RENDERING_READ_BIT_EXT = 0x00100000,
+
+ //@extension("VK_NV_shading_rate_image") // 165
+ VK_ACCESS_SHADING_RATE_IMAGE_READ_BIT_NV = 0x00800000,
+
+ //@extension("VK_NVX_raytracing") // 166
+ VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_NVX = 0x00200000,
+ VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_NVX = 0x00400000,
}
/// Buffer usage flags
@@ -2220,6 +2359,9 @@
//@extension("VK_EXT_conditional_rendering") // 82
VK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT_EXT = 0x00000200,
+
+ //@extension("VK_NVX_raytracing") // 166
+ VK_BUFFER_USAGE_RAYTRACING_BIT_NVX = 0x00000400,
}
/// Buffer creation flags
@@ -2245,6 +2387,18 @@
VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F,
VK_SHADER_STAGE_ALL = 0x7FFFFFFF,
+
+ //@extension("VK_NVX_raytracing") // 166
+ VK_SHADER_STAGE_RAYGEN_BIT_NVX = 0x00000100,
+ VK_SHADER_STAGE_ANY_HIT_BIT_NVX = 0x00000200,
+ VK_SHADER_STAGE_CLOSEST_HIT_BIT_NVX = 0x00000400,
+ VK_SHADER_STAGE_MISS_BIT_NVX = 0x00000800,
+ VK_SHADER_STAGE_INTERSECTION_BIT_NVX = 0x00001000,
+ VK_SHADER_STAGE_CALLABLE_BIT_NVX = 0x00002000,
+
+ //@extension("VK_NV_mesh_shader") // 203
+ VK_SHADER_STAGE_TASK_BIT_NV = 0x00000040,
+ VK_SHADER_STAGE_MESH_BIT_NV = 0x00000080,
}
/// Descriptor pool create flags
@@ -2272,6 +2426,9 @@
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, /// Can be used as framebuffer depth/stencil attachment
VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, /// Image data not needed outside of rendering
VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, /// Can be used as framebuffer input attachment
+
+ //@extension("VK_NV_shading_rate_image") // 165
+ VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV = 0x00000100,
}
/// Image creation flags
@@ -2310,6 +2467,9 @@
//@extension("VK_EXT_sample_locations") // 144
VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT = 0x00001000,
+
+ //@extension("VK_NV_corner_sampled_image") // 51
+ VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV = 0x00002000,
}
/// Image view creation flags
@@ -2331,6 +2491,9 @@
//@extension("VK_KHR_device_group") // 61
VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHR = 0x00000008,
VK_PIPELINE_CREATE_DISPATCH_BASE_KHR = 0x00000010,
+
+ //@extension("VK_NVX_raytracing") // 166
+ VK_PIPELINE_CREATE_DEFER_COMPILE_BIT_NVX = 0x00000020,
}
/// Color component flags
@@ -2515,6 +2678,16 @@
//@extension("VK_EXT_conditional_rendering") // 82
VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT = 0x00040000,
+
+ //@extension("VK_NV_shading_rate_image") // 165
+ VK_PIPELINE_STAGE_SHADING_RATE_IMAGE_BIT_NV = 0x00400000,
+
+ //@extension("VK_NVX_raytracing") // 166
+ VK_PIPELINE_STAGE_RAYTRACING_BIT_NVX = 0x00200000,
+
+ //@extension("VK_NV_mesh_shader") // 203
+ VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV = 0x00080000,
+ VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV = 0x00100000,
}
/// Render pass attachment description flags
@@ -3193,6 +3366,35 @@
VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT = 0x00000008,
}
+@extension("VK_NVX_raytracing") // 166
+type VkFlags VkGeometryFlagsNVX
+@extension("VK_NVX_raytracing") // 166
+bitfield VkGeometryFlagBitsNVX {
+ VK_GEOMETRY_OPAQUE_BIT_NVX = 0x00000001,
+ VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_NVX = 0x00000002,
+}
+
+@extension("VK_NVX_raytracing") // 166
+type VkFlags VkGeometryInstanceFlagsNVX
+@extension("VK_NVX_raytracing") // 166
+bitfield VkGeometryInstanceFlagBitsNVX {
+ VK_GEOMETRY_INSTANCE_TRIANGLE_CULL_DISABLE_BIT_NVX = 0x00000001,
+ VK_GEOMETRY_INSTANCE_TRIANGLE_CULL_FLIP_WINDING_BIT_NVX = 0x00000002,
+ VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_NVX = 0x00000004,
+ VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_NVX = 0x00000008,
+}
+
+@extension("VK_NVX_raytracing") // 166
+type VkFlags VkBuildAccelerationStructureFlagsNVX
+@extension("VK_NVX_raytracing") // 166
+bitfield VkBuildAccelerationStructureFlagBitsNVX {
+ VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_NVX = 0x00000001,
+ VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NVX = 0x00000002,
+ VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NVX = 0x00000004,
+ VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_NVX = 0x00000008,
+ VK_BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_NVX = 0x00000010,
+}
+
//////////////////
// Structures //
//////////////////
@@ -5154,6 +5356,13 @@
u32[3] computeWorkGroupSize
}
+@extension("VK_NV_corner_sampled_image") // 51
+class VkPhysicalDeviceCornerSampledImageFeaturesNV {
+ VkStructureType sType
+ void* pNext
+ VkBool32 cornerSampledImage
+}
+
@extension("VK_KHR_multiview") // 54
class VkRenderPassMultiviewCreateInfoKHR {
VkStructureType sType
@@ -6779,6 +6988,179 @@
u32 maxVariableDescriptorCount
}
+@extension("VK_NV_shading_rate_image") // 165
+class VkShadingRatePaletteNV {
+ u32 shadingRatePaletteEntryCount
+ const VkShadingRatePaletteEntryNV* pShadingRatePaletteEntries
+}
+
+@extension("VK_NV_shading_rate_image") // 165
+class VkPipelineViewportShadingRateImageStateCreateInfoNV {
+ VkStructureType sType
+ const void* pNext
+ VkBool32 shadingRateImageEnable
+ u32 viewportCount
+ const VkShadingRatePaletteNV* pShadingRatePalettes
+}
+
+@extension("VK_NV_shading_rate_image") // 165
+class VkPhysicalDeviceShadingRateImageFeaturesNV {
+ VkStructureType sType
+ void* pNext
+ VkBool32 shadingRateImage
+ VkBool32 shadingRateCoarseSampleOrder
+}
+
+@extension("VK_NV_shading_rate_image") // 165
+class VkPhysicalDeviceShadingRateImagePropertiesNV {
+ VkStructureType sType
+ void* pNext
+ VkExtent2D shadingRateTexelSize
+ u32 shadingRatePaletteSize
+ u32 shadingRateMaxCoarseSamples
+}
+
+@extension("VK_NV_shading_rate_image") // 165
+class VkCoarseSampleLocationNV {
+ u32 pixelX
+ u32 pixelY
+ u32 sample
+}
+
+@extension("VK_NV_shading_rate_image") // 165
+class VkCoarseSampleOrderCustomNV {
+ VkShadingRatePaletteEntryNV shadingRate
+ u32 sampleCount
+ u32 sampleLocationCount
+ const VkCoarseSampleLocationNV* pSampleLocations
+}
+
+@extension("VK_NV_shading_rate_image") // 165
+class VkPipelineViewportCoarseSampleOrderStateCreateInfoNV {
+ VkStructureType sType
+ const void* pNext
+ VkCoarseSampleOrderTypeNV sampleOrderType
+ u32 customSampleOrderCount
+ const VkCoarseSampleOrderCustomNV* pCustomSampleOrders
+}
+
+@extension("VK_NVX_raytracing") // 166
+class VkRaytracingPipelineCreateInfoNVX {
+ VkStructureType sType
+ const void* pNext
+ VkPipelineCreateFlags flags
+ u32 stageCount
+ const VkPipelineShaderStageCreateInfo* pStages
+ const u32* pGroupNumbers
+ u32 maxRecursionDepth
+ VkPipelineLayout layout
+ VkPipeline basePipelineHandle
+ s32 basePipelineIndex
+}
+
+@extension("VK_NVX_raytracing") // 166
+class VkGeometryTrianglesNVX {
+ VkStructureType sType
+ const void* pNext
+ VkBuffer vertexData
+ VkDeviceSize vertexOffset
+ u32 vertexCount
+ VkDeviceSize vertexStride
+ VkFormat vertexFormat
+ VkBuffer indexData
+ VkDeviceSize indexOffset
+ u32 indexCount
+ VkIndexType indexType
+ VkBuffer transformData
+ VkDeviceSize transformOffset
+}
+
+@extension("VK_NVX_raytracing") // 166
+class VkGeometryAABBNVX {
+ VkStructureType sType
+ const void* pNext
+ VkBuffer aabbData
+ u32 numAABBs
+ u32 stride
+ VkDeviceSize offset
+}
+
+@extension("VK_NVX_raytracing") // 166
+class VkGeometryDataNVX {
+ VkGeometryTrianglesNVX triangles
+ VkGeometryAABBNVX aabbs
+}
+
+@extension("VK_NVX_raytracing") // 166
+class VkGeometryNVX {
+ VkStructureType sType
+ const void* pNext
+ VkGeometryTypeNVX geometryType
+ VkGeometryDataNVX geometry
+ VkGeometryFlagsNVX flags
+}
+
+@extension("VK_NVX_raytracing") // 166
+class VkAccelerationStructureCreateInfoNVX {
+ VkStructureType sType
+ const void* pNext
+ VkAccelerationStructureTypeNVX type
+ VkBuildAccelerationStructureFlagsNVX flags
+ VkDeviceSize compactedSize
+ u32 instanceCount
+ u32 geometryCount
+ const VkGeometryNVX* pGeometries
+}
+
+@extension("VK_NVX_raytracing") // 166
+class VkBindAccelerationStructureMemoryInfoNVX {
+ VkStructureType sType
+ const void* pNext
+ VkAccelerationStructureNVX accelerationStructure
+ VkDeviceMemory memory
+ VkDeviceSize memoryOffset
+ u32 deviceIndexCount
+ const u32* pDeviceIndices
+}
+
+@extension("VK_NVX_raytracing") // 166
+class VkDescriptorAccelerationStructureInfoNVX {
+ VkStructureType sType
+ const void* pNext
+ u32 accelerationStructureCount
+ const VkAccelerationStructureNVX* pAccelerationStructures
+}
+
+@extension("VK_NVX_raytracing") // 166
+class VkAccelerationStructureMemoryRequirementsInfoNVX {
+ VkStructureType sType
+ const void* pNext
+ VkAccelerationStructureNVX accelerationStructure
+}
+
+@extension("VK_NVX_raytracing") // 166
+class VkPhysicalDeviceRaytracingPropertiesNVX {
+ VkStructureType sType
+ void* pNext
+ u32 shaderHeaderSize
+ u32 maxRecursionDepth
+ u32 maxGeometryCount
+}
+
+@extension("VK_NV_representative_fragment_test") // 167
+class VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV {
+ VkStructureType sType
+ void* pNext
+ VkBool32 representativeFragmentTest
+}
+
+@extension("VK_NV_representative_fragment_test") // 167
+class VkPipelineRepresentativeFragmentTestStateCreateInfoNV {
+ VkStructureType sType
+ const void* pNext
+ VkBool32 representativeFragmentTestEnable
+}
+
@extension("VK_KHR_maintenance3") // 169
class VkPhysicalDeviceMaintenance3PropertiesKHR {
VkStructureType sType
@@ -6881,6 +7263,76 @@
VkBool32 vertexAttributeInstanceRateZeroDivisor
}
+@extension("VK_NV_compute_shader_derivatives") // 202
+class VkPhysicalDeviceComputeShaderDerivativesFeaturesNV {
+ VkStructureType sType
+ void* pNext
+ VkBool32 computeDerivativeGroupQuads
+ VkBool32 computeDerivativeGroupLinear
+}
+
+@extension("VK_NV_mesh_shader") // 203
+class VkPhysicalDeviceMeshShaderFeaturesNV {
+ VkStructureType sType
+ void* pNext
+ VkBool32 taskShader
+ VkBool32 meshShader
+}
+
+@extension("VK_NV_mesh_shader") // 203
+class VkPhysicalDeviceMeshShaderPropertiesNV {
+ VkStructureType sType
+ void* pNext
+ u32 maxDrawMeshTasksCount
+ u32 maxTaskWorkGroupInvocations
+ u32[3] maxTaskWorkGroupSize
+ u32 maxTaskTotalMemorySize
+ u32 maxTaskOutputCount
+ u32 maxMeshWorkGroupInvocations
+ u32[3] maxMeshWorkGroupSize
+ u32 maxMeshTotalMemorySize
+ u32 maxMeshOutputVertices
+ u32 maxMeshOutputPrimitives
+ u32 maxMeshMultiviewViewCount
+ u32 meshOutputPerVertexGranularity
+ u32 meshOutputPerPrimitiveGranularity
+}
+
+@extension("VK_NV_mesh_shader") // 203
+class VkDrawMeshTasksIndirectCommandNV {
+ u32 taskCount
+ u32 firstTask
+}
+
+@extension("VK_NV_fragment_shader_barycentric") // 204
+class VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV {
+ VkStructureType sType
+ void* pNext
+ VkBool32 fragmentShaderBarycentric
+}
+
+@extension("VK_NV_shader_image_footprint") // 205
+class VkPhysicalDeviceShaderImageFootprintFeaturesNV {
+ VkStructureType sType
+ void* pNext
+ VkBool32 imageFootprint
+}
+
+@extension("VK_NV_scissor_exclusive") // 206
+class VkPipelineViewportExclusiveScissorStateCreateInfoNV {
+ VkStructureType sType
+ const void* pNext
+ u32 exclusiveScissorCount
+ const VkRect2D* pExclusiveScissors
+}
+
+@extension("VK_NV_scissor_exclusive") // 206
+class VkPhysicalDeviceExclusiveScissorFeaturesNV {
+ VkStructureType sType
+ void* pNext
+ VkBool32 exclusiveScissor
+}
+
@extension("VK_NV_device_diagnostic_checkpoints") // 207
class VkQueueFamilyCheckpointPropertiesNV {
VkStructureType sType
@@ -10653,6 +11105,155 @@
return ?
}
+@extension("VK_NV_shading_rate_image") // 165
+cmd void vkCmdBindShadingRateImageNV(
+ VkCommandBuffer commandBuffer,
+ VkImageView imageView,
+ VkImageLayout imageLayout) {
+}
+
+@extension("VK_NV_shading_rate_image") // 165
+cmd void vkCmdSetViewportShadingRatePaletteNV(
+ VkCommandBuffer commandBuffer,
+ u32 firstViewport,
+ u32 viewportCount,
+ const VkShadingRatePaletteNV* pShadingRatePalettes) {
+}
+
+@extension("VK_NV_shading_rate_image") // 165
+cmd void vkCmdSetCoarseSampleOrderNV(
+ VkCommandBuffer commandBuffer,
+ VkCoarseSampleOrderTypeNV sampleOrderType,
+ u32 customSampleOrderCount,
+ const VkCoarseSampleOrderCustomNV* pCustomSampleOrders) {
+}
+
+@extension("VK_NVX_raytracing") // 166
+cmd VkResult vkCreateAccelerationStructureNVX(
+ VkDevice device,
+ const VkAccelerationStructureCreateInfoNVX* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkAccelerationStructureNVX* pAccelerationStructure) {
+ return ?
+}
+
+@extension("VK_NVX_raytracing") // 166
+cmd void vkDestroyAccelerationStructureNVX(
+ VkDevice device,
+ VkAccelerationStructureNVX accelerationStructure,
+ const VkAllocationCallbacks* pAllocator) {
+}
+
+@extension("VK_NVX_raytracing") // 166
+cmd void vkGetAccelerationStructureMemoryRequirementsNVX(
+ VkDevice device,
+ const VkAccelerationStructureMemoryRequirementsInfoNVX* pInfo,
+ VkMemoryRequirements2KHR* pMemoryRequirements) {
+}
+
+@extension("VK_NVX_raytracing") // 166
+cmd void vkGetAccelerationStructureScratchMemoryRequirementsNVX(
+ VkDevice device,
+ const VkAccelerationStructureMemoryRequirementsInfoNVX* pInfo,
+ VkMemoryRequirements2KHR* pMemoryRequirements) {
+}
+
+@extension("VK_NVX_raytracing") // 166
+cmd VkResult vkBindAccelerationStructureMemoryNVX(
+ VkDevice device,
+ u32 bindInfoCount,
+ const VkBindAccelerationStructureMemoryInfoNVX* pBindInfos) {
+ return ?
+}
+
+@extension("VK_NVX_raytracing") // 166
+cmd void vkCmdBuildAccelerationStructureNVX(
+ VkCommandBuffer cmdBuf,
+ VkAccelerationStructureTypeNVX type,
+ u32 instanceCount,
+ VkBuffer instanceData,
+ VkDeviceSize instanceOffset,
+ u32 geometryCount,
+ const VkGeometryNVX* pGeometries,
+ VkBuildAccelerationStructureFlagsNVX flags,
+ VkBool32 update,
+ VkAccelerationStructureNVX dst,
+ VkAccelerationStructureNVX src,
+ VkBuffer scratch,
+ VkDeviceSize scratchOffset) {
+}
+
+@extension("VK_NVX_raytracing") // 166
+cmd void vkCmdCopyAccelerationStructureNVX(
+ VkCommandBuffer cmdBuf,
+ VkAccelerationStructureNVX dst,
+ VkAccelerationStructureNVX src,
+ VkCopyAccelerationStructureModeNVX mode) {
+}
+
+@extension("VK_NVX_raytracing") // 166
+cmd void vkCmdTraceRaysNVX(
+ VkCommandBuffer cmdBuf,
+ VkBuffer raygenShaderBindingTableBuffer,
+ VkDeviceSize raygenShaderBindingOffset,
+ VkBuffer missShaderBindingTableBuffer,
+ VkDeviceSize missShaderBindingOffset,
+ VkDeviceSize missShaderBindingStride,
+ VkBuffer hitShaderBindingTableBuffer,
+ VkDeviceSize hitShaderBindingOffset,
+ VkDeviceSize hitShaderBindingStride,
+ u32 width,
+ u32 height) {
+}
+
+@extension("VK_NVX_raytracing") // 166
+cmd VkResult vkCreateRaytracingPipelinesNVX(
+ VkDevice device,
+ VkPipelineCache pipelineCache,
+ u32 createInfoCount,
+ const VkRaytracingPipelineCreateInfoNVX* pCreateInfos,
+ const VkAllocationCallbacks* pAllocator,
+ VkPipeline* pPipelines) {
+ return ?
+}
+
+@extension("VK_NVX_raytracing") // 166
+cmd VkResult vkGetRaytracingShaderHandlesNVX(
+ VkDevice device,
+ VkPipeline pipeline,
+ u32 firstGroup,
+ u32 groupCount,
+ platform.size_t dataSize,
+ void* pData) {
+ return ?
+}
+
+@extension("VK_NVX_raytracing") // 166
+cmd VkResult vkGetAccelerationStructureHandleNVX(
+ VkDevice device,
+ VkAccelerationStructureNVX accelerationStructure,
+ platform.size_t dataSize,
+ void* pData) {
+ return ?
+}
+
+@extension("VK_NVX_raytracing") // 166
+cmd void vkCmdWriteAccelerationStructurePropertiesNVX(
+ VkCommandBuffer cmdBuf,
+ VkAccelerationStructureNVX accelerationStructure,
+ VkQueryType queryType,
+ VkQueryPool queryPool,
+ u32 query) {
+}
+
+@extension("VK_NVX_raytracing") // 166
+cmd VkResult vkCompileDeferredNVX(
+ VkDevice device,
+ VkPipeline pipeline,
+ u32 shader) {
+ return ?
+}
+
@extension("VK_KHR_maintenance3") // 169
cmd void vkGetDescriptorSetLayoutSupportKHR(
VkDevice device,
@@ -10700,6 +11301,41 @@
u32 marker) {
}
+@extension("VK_NV_mesh_shader") // 203
+cmd void vkCmdDrawMeshTasksNV(
+ VkCommandBuffer commandBuffer,
+ u32 taskCount,
+ u32 firstTask) {
+}
+
+@extension("VK_NV_mesh_shader") // 203
+cmd void vkCmdDrawMeshTasksIndirectNV(
+ VkCommandBuffer commandBuffer,
+ VkBuffer buffer,
+ VkDeviceSize offset,
+ u32 drawCount,
+ u32 stride) {
+}
+
+@extension("VK_NV_mesh_shader") // 203
+cmd void vkCmdDrawMeshTasksIndirectCountNV(
+ VkCommandBuffer commandBuffer,
+ VkBuffer buffer,
+ VkDeviceSize offset,
+ VkBuffer countBuffer,
+ VkDeviceSize countBufferOffset,
+ u32 maxDrawCount,
+ u32 stride) {
+}
+
+@extension("VK_NV_scissor_exclusive") // 206
+cmd void vkCmdSetExclusiveScissorNV(
+ VkCommandBuffer commandBuffer,
+ u32 firstExclusiveScissor,
+ u32 exclusiveScissorCount,
+ const VkRect2D* pExclusiveScissors) {
+}
+
@extension("VK_NV_device_diagnostic_checkpoints") // 207
cmd void vkCmdSetCheckpointNV(
VkCommandBuffer commandBuffer,
diff --git a/vulkan/include/vulkan/vulkan_core.h b/vulkan/include/vulkan/vulkan_core.h
index fe45014..2d1b3f5 100644
--- a/vulkan/include/vulkan/vulkan_core.h
+++ b/vulkan/include/vulkan/vulkan_core.h
@@ -43,7 +43,7 @@
#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff)
#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff)
// Version of this file
-#define VK_HEADER_VERSION 84
+#define VK_HEADER_VERSION 85
#define VK_NULL_HANDLE 0
@@ -298,6 +298,7 @@
VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = 1000026001,
VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = 1000026002,
VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD = 1000041000,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CORNER_SAMPLED_IMAGE_FEATURES_NV = 1000050000,
VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV = 1000056000,
VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV = 1000056001,
VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057000,
@@ -404,6 +405,23 @@
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES_EXT = 1000161002,
VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO_EXT = 1000161003,
VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT_EXT = 1000161004,
+ VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SHADING_RATE_IMAGE_STATE_CREATE_INFO_NV = 1000164000,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_FEATURES_NV = 1000164001,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_PROPERTIES_NV = 1000164002,
+ VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_COARSE_SAMPLE_ORDER_STATE_CREATE_INFO_NV = 1000164005,
+ VK_STRUCTURE_TYPE_RAYTRACING_PIPELINE_CREATE_INFO_NVX = 1000165000,
+ VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_NVX = 1000165001,
+ VK_STRUCTURE_TYPE_GEOMETRY_INSTANCE_NVX = 1000165002,
+ VK_STRUCTURE_TYPE_GEOMETRY_NVX = 1000165003,
+ VK_STRUCTURE_TYPE_GEOMETRY_TRIANGLES_NVX = 1000165004,
+ VK_STRUCTURE_TYPE_GEOMETRY_AABB_NVX = 1000165005,
+ VK_STRUCTURE_TYPE_BIND_ACCELERATION_STRUCTURE_MEMORY_INFO_NVX = 1000165006,
+ VK_STRUCTURE_TYPE_DESCRIPTOR_ACCELERATION_STRUCTURE_INFO_NVX = 1000165007,
+ VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_INFO_NVX = 1000165008,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAYTRACING_PROPERTIES_NVX = 1000165009,
+ VK_STRUCTURE_TYPE_HIT_SHADER_MODULE_CREATE_INFO_NVX = 1000165010,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_REPRESENTATIVE_FRAGMENT_TEST_FEATURES_NV = 1000166000,
+ VK_STRUCTURE_TYPE_PIPELINE_REPRESENTATIVE_FRAGMENT_TEST_STATE_CREATE_INFO_NV = 1000166001,
VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_EXT = 1000174000,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR = 1000177000,
VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT = 1000178000,
@@ -413,6 +431,13 @@
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT = 1000190000,
VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT = 1000190001,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT = 1000190002,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV = 1000201000,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV = 1000202000,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_NV = 1000202001,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_NV = 1000203000,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_FOOTPRINT_FEATURES_NV = 1000204000,
+ VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_EXCLUSIVE_SCISSOR_STATE_CREATE_INFO_NV = 1000205000,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXCLUSIVE_SCISSOR_FEATURES_NV = 1000205002,
VK_STRUCTURE_TYPE_CHECKPOINT_DATA_NV = 1000206000,
VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_NV = 1000206001,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES_KHR = 1000211000,
@@ -806,6 +831,7 @@
VK_QUERY_TYPE_OCCLUSION = 0,
VK_QUERY_TYPE_PIPELINE_STATISTICS = 1,
VK_QUERY_TYPE_TIMESTAMP = 2,
+ VK_QUERY_TYPE_COMPACTED_SIZE_NVX = 1000165000,
VK_QUERY_TYPE_BEGIN_RANGE = VK_QUERY_TYPE_OCCLUSION,
VK_QUERY_TYPE_END_RANGE = VK_QUERY_TYPE_TIMESTAMP,
VK_QUERY_TYPE_RANGE_SIZE = (VK_QUERY_TYPE_TIMESTAMP - VK_QUERY_TYPE_OCCLUSION + 1),
@@ -835,6 +861,7 @@
VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL = 1000117001,
VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002,
VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR = 1000111000,
+ VK_IMAGE_LAYOUT_SHADING_RATE_OPTIMAL_NV = 1000164003,
VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL_KHR = VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL,
VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL_KHR = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL,
VK_IMAGE_LAYOUT_BEGIN_RANGE = VK_IMAGE_LAYOUT_UNDEFINED,
@@ -1068,6 +1095,9 @@
VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV = 1000087000,
VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT = 1000099000,
VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT = 1000143000,
+ VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV = 1000164004,
+ VK_DYNAMIC_STATE_VIEWPORT_COARSE_SAMPLE_ORDER_NV = 1000164006,
+ VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV = 1000205001,
VK_DYNAMIC_STATE_BEGIN_RANGE = VK_DYNAMIC_STATE_VIEWPORT,
VK_DYNAMIC_STATE_END_RANGE = VK_DYNAMIC_STATE_STENCIL_REFERENCE,
VK_DYNAMIC_STATE_RANGE_SIZE = (VK_DYNAMIC_STATE_STENCIL_REFERENCE - VK_DYNAMIC_STATE_VIEWPORT + 1),
@@ -1131,6 +1161,7 @@
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9,
VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10,
VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT = 1000138000,
+ VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NVX = 1000165000,
VK_DESCRIPTOR_TYPE_BEGIN_RANGE = VK_DESCRIPTOR_TYPE_SAMPLER,
VK_DESCRIPTOR_TYPE_END_RANGE = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT,
VK_DESCRIPTOR_TYPE_RANGE_SIZE = (VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT - VK_DESCRIPTOR_TYPE_SAMPLER + 1),
@@ -1159,6 +1190,7 @@
typedef enum VkPipelineBindPoint {
VK_PIPELINE_BIND_POINT_GRAPHICS = 0,
VK_PIPELINE_BIND_POINT_COMPUTE = 1,
+ VK_PIPELINE_BIND_POINT_RAYTRACING_NVX = 1000165000,
VK_PIPELINE_BIND_POINT_BEGIN_RANGE = VK_PIPELINE_BIND_POINT_GRAPHICS,
VK_PIPELINE_BIND_POINT_END_RANGE = VK_PIPELINE_BIND_POINT_COMPUTE,
VK_PIPELINE_BIND_POINT_RANGE_SIZE = (VK_PIPELINE_BIND_POINT_COMPUTE - VK_PIPELINE_BIND_POINT_GRAPHICS + 1),
@@ -1230,6 +1262,7 @@
VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX = 1000086001,
VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT = 1000128000,
VK_OBJECT_TYPE_VALIDATION_CACHE_EXT = 1000160000,
+ VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_NVX = 1000165000,
VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR = VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE,
VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR = VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION,
VK_OBJECT_TYPE_BEGIN_RANGE = VK_OBJECT_TYPE_UNKNOWN,
@@ -1297,6 +1330,7 @@
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020,
VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040,
VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080,
+ VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV = 0x00000100,
VK_IMAGE_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkImageUsageFlagBits;
typedef VkFlags VkImageUsageFlags;
@@ -1314,6 +1348,7 @@
VK_IMAGE_CREATE_EXTENDED_USAGE_BIT = 0x00000100,
VK_IMAGE_CREATE_PROTECTED_BIT = 0x00000800,
VK_IMAGE_CREATE_DISJOINT_BIT = 0x00000200,
+ VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV = 0x00002000,
VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT = 0x00001000,
VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR = VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT,
VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR = VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT,
@@ -1393,6 +1428,10 @@
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00010000,
VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT = 0x00040000,
VK_PIPELINE_STAGE_COMMAND_PROCESS_BIT_NVX = 0x00020000,
+ VK_PIPELINE_STAGE_SHADING_RATE_IMAGE_BIT_NV = 0x00400000,
+ VK_PIPELINE_STAGE_RAYTRACING_BIT_NVX = 0x00200000,
+ VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV = 0x00080000,
+ VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV = 0x00100000,
VK_PIPELINE_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkPipelineStageFlagBits;
typedef VkFlags VkPipelineStageFlags;
@@ -1481,6 +1520,7 @@
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080,
VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100,
VK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT_EXT = 0x00000200,
+ VK_BUFFER_USAGE_RAYTRACING_BIT_NVX = 0x00000400,
VK_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkBufferUsageFlagBits;
typedef VkFlags VkBufferUsageFlags;
@@ -1495,6 +1535,7 @@
VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004,
VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT = 0x00000008,
VK_PIPELINE_CREATE_DISPATCH_BASE = 0x00000010,
+ VK_PIPELINE_CREATE_DEFER_COMPILE_BIT_NVX = 0x00000020,
VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHR = VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT,
VK_PIPELINE_CREATE_DISPATCH_BASE_KHR = VK_PIPELINE_CREATE_DISPATCH_BASE,
VK_PIPELINE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
@@ -1511,6 +1552,14 @@
VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020,
VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F,
VK_SHADER_STAGE_ALL = 0x7FFFFFFF,
+ VK_SHADER_STAGE_RAYGEN_BIT_NVX = 0x00000100,
+ VK_SHADER_STAGE_ANY_HIT_BIT_NVX = 0x00000200,
+ VK_SHADER_STAGE_CLOSEST_HIT_BIT_NVX = 0x00000400,
+ VK_SHADER_STAGE_MISS_BIT_NVX = 0x00000800,
+ VK_SHADER_STAGE_INTERSECTION_BIT_NVX = 0x00001000,
+ VK_SHADER_STAGE_CALLABLE_BIT_NVX = 0x00002000,
+ VK_SHADER_STAGE_TASK_BIT_NV = 0x00000040,
+ VK_SHADER_STAGE_MESH_BIT_NV = 0x00000080,
VK_SHADER_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkShaderStageFlagBits;
typedef VkFlags VkPipelineVertexInputStateCreateFlags;
@@ -1596,6 +1645,9 @@
VK_ACCESS_COMMAND_PROCESS_READ_BIT_NVX = 0x00020000,
VK_ACCESS_COMMAND_PROCESS_WRITE_BIT_NVX = 0x00040000,
VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT = 0x00080000,
+ VK_ACCESS_SHADING_RATE_IMAGE_READ_BIT_NV = 0x00800000,
+ VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_NVX = 0x00200000,
+ VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_NVX = 0x00400000,
VK_ACCESS_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkAccessFlagBits;
typedef VkFlags VkAccessFlags;
@@ -4062,6 +4114,8 @@
VkMemoryRequirements memoryRequirements;
} VkMemoryRequirements2;
+typedef VkMemoryRequirements2 VkMemoryRequirements2KHR;
+
typedef struct VkSparseImageMemoryRequirements2 {
VkStructureType sType;
void* pNext;
@@ -5826,8 +5880,6 @@
typedef VkImageSparseMemoryRequirementsInfo2 VkImageSparseMemoryRequirementsInfo2KHR;
-typedef VkMemoryRequirements2 VkMemoryRequirements2KHR;
-
typedef VkSparseImageMemoryRequirements2 VkSparseImageMemoryRequirements2KHR;
@@ -6049,6 +6101,7 @@
VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT = 33,
VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_EXT = 1000156000,
VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT = 1000085000,
+ VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NVX_EXT = 1000165000,
VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT,
@@ -6355,6 +6408,18 @@
#define VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_EXTENSION_NAME "VK_AMD_shader_image_load_store_lod"
+#define VK_NV_corner_sampled_image 1
+#define VK_NV_CORNER_SAMPLED_IMAGE_SPEC_VERSION 2
+#define VK_NV_CORNER_SAMPLED_IMAGE_EXTENSION_NAME "VK_NV_corner_sampled_image"
+
+typedef struct VkPhysicalDeviceCornerSampledImageFeaturesNV {
+ VkStructureType sType;
+ void* pNext;
+ VkBool32 cornerSampledImage;
+} VkPhysicalDeviceCornerSampledImageFeaturesNV;
+
+
+
#define VK_IMG_format_pvrtc 1
#define VK_IMG_FORMAT_PVRTC_SPEC_VERSION 1
#define VK_IMG_FORMAT_PVRTC_EXTENSION_NAME "VK_IMG_format_pvrtc"
@@ -7711,6 +7776,397 @@
#define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME "VK_EXT_shader_viewport_index_layer"
+#define VK_NV_shading_rate_image 1
+#define VK_NV_SHADING_RATE_IMAGE_SPEC_VERSION 3
+#define VK_NV_SHADING_RATE_IMAGE_EXTENSION_NAME "VK_NV_shading_rate_image"
+
+
+typedef enum VkShadingRatePaletteEntryNV {
+ VK_SHADING_RATE_PALETTE_ENTRY_NO_INVOCATIONS_NV = 0,
+ VK_SHADING_RATE_PALETTE_ENTRY_16_INVOCATIONS_PER_PIXEL_NV = 1,
+ VK_SHADING_RATE_PALETTE_ENTRY_8_INVOCATIONS_PER_PIXEL_NV = 2,
+ VK_SHADING_RATE_PALETTE_ENTRY_4_INVOCATIONS_PER_PIXEL_NV = 3,
+ VK_SHADING_RATE_PALETTE_ENTRY_2_INVOCATIONS_PER_PIXEL_NV = 4,
+ VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_PIXEL_NV = 5,
+ VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X1_PIXELS_NV = 6,
+ VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_1X2_PIXELS_NV = 7,
+ VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X2_PIXELS_NV = 8,
+ VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X2_PIXELS_NV = 9,
+ VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X4_PIXELS_NV = 10,
+ VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X4_PIXELS_NV = 11,
+ VK_SHADING_RATE_PALETTE_ENTRY_BEGIN_RANGE_NV = VK_SHADING_RATE_PALETTE_ENTRY_NO_INVOCATIONS_NV,
+ VK_SHADING_RATE_PALETTE_ENTRY_END_RANGE_NV = VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X4_PIXELS_NV,
+ VK_SHADING_RATE_PALETTE_ENTRY_RANGE_SIZE_NV = (VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X4_PIXELS_NV - VK_SHADING_RATE_PALETTE_ENTRY_NO_INVOCATIONS_NV + 1),
+ VK_SHADING_RATE_PALETTE_ENTRY_MAX_ENUM_NV = 0x7FFFFFFF
+} VkShadingRatePaletteEntryNV;
+
+typedef enum VkCoarseSampleOrderTypeNV {
+ VK_COARSE_SAMPLE_ORDER_TYPE_DEFAULT_NV = 0,
+ VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV = 1,
+ VK_COARSE_SAMPLE_ORDER_TYPE_PIXEL_MAJOR_NV = 2,
+ VK_COARSE_SAMPLE_ORDER_TYPE_SAMPLE_MAJOR_NV = 3,
+ VK_COARSE_SAMPLE_ORDER_TYPE_BEGIN_RANGE_NV = VK_COARSE_SAMPLE_ORDER_TYPE_DEFAULT_NV,
+ VK_COARSE_SAMPLE_ORDER_TYPE_END_RANGE_NV = VK_COARSE_SAMPLE_ORDER_TYPE_SAMPLE_MAJOR_NV,
+ VK_COARSE_SAMPLE_ORDER_TYPE_RANGE_SIZE_NV = (VK_COARSE_SAMPLE_ORDER_TYPE_SAMPLE_MAJOR_NV - VK_COARSE_SAMPLE_ORDER_TYPE_DEFAULT_NV + 1),
+ VK_COARSE_SAMPLE_ORDER_TYPE_MAX_ENUM_NV = 0x7FFFFFFF
+} VkCoarseSampleOrderTypeNV;
+
+typedef struct VkShadingRatePaletteNV {
+ uint32_t shadingRatePaletteEntryCount;
+ const VkShadingRatePaletteEntryNV* pShadingRatePaletteEntries;
+} VkShadingRatePaletteNV;
+
+typedef struct VkPipelineViewportShadingRateImageStateCreateInfoNV {
+ VkStructureType sType;
+ const void* pNext;
+ VkBool32 shadingRateImageEnable;
+ uint32_t viewportCount;
+ const VkShadingRatePaletteNV* pShadingRatePalettes;
+} VkPipelineViewportShadingRateImageStateCreateInfoNV;
+
+typedef struct VkPhysicalDeviceShadingRateImageFeaturesNV {
+ VkStructureType sType;
+ void* pNext;
+ VkBool32 shadingRateImage;
+ VkBool32 shadingRateCoarseSampleOrder;
+} VkPhysicalDeviceShadingRateImageFeaturesNV;
+
+typedef struct VkPhysicalDeviceShadingRateImagePropertiesNV {
+ VkStructureType sType;
+ void* pNext;
+ VkExtent2D shadingRateTexelSize;
+ uint32_t shadingRatePaletteSize;
+ uint32_t shadingRateMaxCoarseSamples;
+} VkPhysicalDeviceShadingRateImagePropertiesNV;
+
+typedef struct VkCoarseSampleLocationNV {
+ uint32_t pixelX;
+ uint32_t pixelY;
+ uint32_t sample;
+} VkCoarseSampleLocationNV;
+
+typedef struct VkCoarseSampleOrderCustomNV {
+ VkShadingRatePaletteEntryNV shadingRate;
+ uint32_t sampleCount;
+ uint32_t sampleLocationCount;
+ const VkCoarseSampleLocationNV* pSampleLocations;
+} VkCoarseSampleOrderCustomNV;
+
+typedef struct VkPipelineViewportCoarseSampleOrderStateCreateInfoNV {
+ VkStructureType sType;
+ const void* pNext;
+ VkCoarseSampleOrderTypeNV sampleOrderType;
+ uint32_t customSampleOrderCount;
+ const VkCoarseSampleOrderCustomNV* pCustomSampleOrders;
+} VkPipelineViewportCoarseSampleOrderStateCreateInfoNV;
+
+
+typedef void (VKAPI_PTR *PFN_vkCmdBindShadingRateImageNV)(VkCommandBuffer commandBuffer, VkImageView imageView, VkImageLayout imageLayout);
+typedef void (VKAPI_PTR *PFN_vkCmdSetViewportShadingRatePaletteNV)(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkShadingRatePaletteNV* pShadingRatePalettes);
+typedef void (VKAPI_PTR *PFN_vkCmdSetCoarseSampleOrderNV)(VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType, uint32_t customSampleOrderCount, const VkCoarseSampleOrderCustomNV* pCustomSampleOrders);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkCmdBindShadingRateImageNV(
+ VkCommandBuffer commandBuffer,
+ VkImageView imageView,
+ VkImageLayout imageLayout);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetViewportShadingRatePaletteNV(
+ VkCommandBuffer commandBuffer,
+ uint32_t firstViewport,
+ uint32_t viewportCount,
+ const VkShadingRatePaletteNV* pShadingRatePalettes);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetCoarseSampleOrderNV(
+ VkCommandBuffer commandBuffer,
+ VkCoarseSampleOrderTypeNV sampleOrderType,
+ uint32_t customSampleOrderCount,
+ const VkCoarseSampleOrderCustomNV* pCustomSampleOrders);
+#endif
+
+#define VK_NVX_raytracing 1
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureNVX)
+
+#define VK_NVX_RAYTRACING_SPEC_VERSION 1
+#define VK_NVX_RAYTRACING_EXTENSION_NAME "VK_NVX_raytracing"
+
+
+typedef enum VkGeometryTypeNVX {
+ VK_GEOMETRY_TYPE_TRIANGLES_NVX = 0,
+ VK_GEOMETRY_TYPE_AABBS_NVX = 1,
+ VK_GEOMETRY_TYPE_BEGIN_RANGE_NVX = VK_GEOMETRY_TYPE_TRIANGLES_NVX,
+ VK_GEOMETRY_TYPE_END_RANGE_NVX = VK_GEOMETRY_TYPE_AABBS_NVX,
+ VK_GEOMETRY_TYPE_RANGE_SIZE_NVX = (VK_GEOMETRY_TYPE_AABBS_NVX - VK_GEOMETRY_TYPE_TRIANGLES_NVX + 1),
+ VK_GEOMETRY_TYPE_MAX_ENUM_NVX = 0x7FFFFFFF
+} VkGeometryTypeNVX;
+
+typedef enum VkAccelerationStructureTypeNVX {
+ VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NVX = 0,
+ VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NVX = 1,
+ VK_ACCELERATION_STRUCTURE_TYPE_BEGIN_RANGE_NVX = VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NVX,
+ VK_ACCELERATION_STRUCTURE_TYPE_END_RANGE_NVX = VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NVX,
+ VK_ACCELERATION_STRUCTURE_TYPE_RANGE_SIZE_NVX = (VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NVX - VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NVX + 1),
+ VK_ACCELERATION_STRUCTURE_TYPE_MAX_ENUM_NVX = 0x7FFFFFFF
+} VkAccelerationStructureTypeNVX;
+
+typedef enum VkCopyAccelerationStructureModeNVX {
+ VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_NVX = 0,
+ VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NVX = 1,
+ VK_COPY_ACCELERATION_STRUCTURE_MODE_BEGIN_RANGE_NVX = VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_NVX,
+ VK_COPY_ACCELERATION_STRUCTURE_MODE_END_RANGE_NVX = VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NVX,
+ VK_COPY_ACCELERATION_STRUCTURE_MODE_RANGE_SIZE_NVX = (VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NVX - VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_NVX + 1),
+ VK_COPY_ACCELERATION_STRUCTURE_MODE_MAX_ENUM_NVX = 0x7FFFFFFF
+} VkCopyAccelerationStructureModeNVX;
+
+
+typedef enum VkGeometryFlagBitsNVX {
+ VK_GEOMETRY_OPAQUE_BIT_NVX = 0x00000001,
+ VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_NVX = 0x00000002,
+ VK_GEOMETRY_FLAG_BITS_MAX_ENUM_NVX = 0x7FFFFFFF
+} VkGeometryFlagBitsNVX;
+typedef VkFlags VkGeometryFlagsNVX;
+
+typedef enum VkGeometryInstanceFlagBitsNVX {
+ VK_GEOMETRY_INSTANCE_TRIANGLE_CULL_DISABLE_BIT_NVX = 0x00000001,
+ VK_GEOMETRY_INSTANCE_TRIANGLE_CULL_FLIP_WINDING_BIT_NVX = 0x00000002,
+ VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_NVX = 0x00000004,
+ VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_NVX = 0x00000008,
+ VK_GEOMETRY_INSTANCE_FLAG_BITS_MAX_ENUM_NVX = 0x7FFFFFFF
+} VkGeometryInstanceFlagBitsNVX;
+typedef VkFlags VkGeometryInstanceFlagsNVX;
+
+typedef enum VkBuildAccelerationStructureFlagBitsNVX {
+ VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_NVX = 0x00000001,
+ VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NVX = 0x00000002,
+ VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NVX = 0x00000004,
+ VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_NVX = 0x00000008,
+ VK_BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_NVX = 0x00000010,
+ VK_BUILD_ACCELERATION_STRUCTURE_FLAG_BITS_MAX_ENUM_NVX = 0x7FFFFFFF
+} VkBuildAccelerationStructureFlagBitsNVX;
+typedef VkFlags VkBuildAccelerationStructureFlagsNVX;
+
+typedef struct VkRaytracingPipelineCreateInfoNVX {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineCreateFlags flags;
+ uint32_t stageCount;
+ const VkPipelineShaderStageCreateInfo* pStages;
+ const uint32_t* pGroupNumbers;
+ uint32_t maxRecursionDepth;
+ VkPipelineLayout layout;
+ VkPipeline basePipelineHandle;
+ int32_t basePipelineIndex;
+} VkRaytracingPipelineCreateInfoNVX;
+
+typedef struct VkGeometryTrianglesNVX {
+ VkStructureType sType;
+ const void* pNext;
+ VkBuffer vertexData;
+ VkDeviceSize vertexOffset;
+ uint32_t vertexCount;
+ VkDeviceSize vertexStride;
+ VkFormat vertexFormat;
+ VkBuffer indexData;
+ VkDeviceSize indexOffset;
+ uint32_t indexCount;
+ VkIndexType indexType;
+ VkBuffer transformData;
+ VkDeviceSize transformOffset;
+} VkGeometryTrianglesNVX;
+
+typedef struct VkGeometryAABBNVX {
+ VkStructureType sType;
+ const void* pNext;
+ VkBuffer aabbData;
+ uint32_t numAABBs;
+ uint32_t stride;
+ VkDeviceSize offset;
+} VkGeometryAABBNVX;
+
+typedef struct VkGeometryDataNVX {
+ VkGeometryTrianglesNVX triangles;
+ VkGeometryAABBNVX aabbs;
+} VkGeometryDataNVX;
+
+typedef struct VkGeometryNVX {
+ VkStructureType sType;
+ const void* pNext;
+ VkGeometryTypeNVX geometryType;
+ VkGeometryDataNVX geometry;
+ VkGeometryFlagsNVX flags;
+} VkGeometryNVX;
+
+typedef struct VkAccelerationStructureCreateInfoNVX {
+ VkStructureType sType;
+ const void* pNext;
+ VkAccelerationStructureTypeNVX type;
+ VkBuildAccelerationStructureFlagsNVX flags;
+ VkDeviceSize compactedSize;
+ uint32_t instanceCount;
+ uint32_t geometryCount;
+ const VkGeometryNVX* pGeometries;
+} VkAccelerationStructureCreateInfoNVX;
+
+typedef struct VkBindAccelerationStructureMemoryInfoNVX {
+ VkStructureType sType;
+ const void* pNext;
+ VkAccelerationStructureNVX accelerationStructure;
+ VkDeviceMemory memory;
+ VkDeviceSize memoryOffset;
+ uint32_t deviceIndexCount;
+ const uint32_t* pDeviceIndices;
+} VkBindAccelerationStructureMemoryInfoNVX;
+
+typedef struct VkDescriptorAccelerationStructureInfoNVX {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t accelerationStructureCount;
+ const VkAccelerationStructureNVX* pAccelerationStructures;
+} VkDescriptorAccelerationStructureInfoNVX;
+
+typedef struct VkAccelerationStructureMemoryRequirementsInfoNVX {
+ VkStructureType sType;
+ const void* pNext;
+ VkAccelerationStructureNVX accelerationStructure;
+} VkAccelerationStructureMemoryRequirementsInfoNVX;
+
+typedef struct VkPhysicalDeviceRaytracingPropertiesNVX {
+ VkStructureType sType;
+ void* pNext;
+ uint32_t shaderHeaderSize;
+ uint32_t maxRecursionDepth;
+ uint32_t maxGeometryCount;
+} VkPhysicalDeviceRaytracingPropertiesNVX;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateAccelerationStructureNVX)(VkDevice device, const VkAccelerationStructureCreateInfoNVX* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkAccelerationStructureNVX* pAccelerationStructure);
+typedef void (VKAPI_PTR *PFN_vkDestroyAccelerationStructureNVX)(VkDevice device, VkAccelerationStructureNVX accelerationStructure, const VkAllocationCallbacks* pAllocator);
+typedef void (VKAPI_PTR *PFN_vkGetAccelerationStructureMemoryRequirementsNVX)(VkDevice device, const VkAccelerationStructureMemoryRequirementsInfoNVX* pInfo, VkMemoryRequirements2KHR* pMemoryRequirements);
+typedef void (VKAPI_PTR *PFN_vkGetAccelerationStructureScratchMemoryRequirementsNVX)(VkDevice device, const VkAccelerationStructureMemoryRequirementsInfoNVX* pInfo, VkMemoryRequirements2KHR* pMemoryRequirements);
+typedef VkResult (VKAPI_PTR *PFN_vkBindAccelerationStructureMemoryNVX)(VkDevice device, uint32_t bindInfoCount, const VkBindAccelerationStructureMemoryInfoNVX* pBindInfos);
+typedef void (VKAPI_PTR *PFN_vkCmdBuildAccelerationStructureNVX)(VkCommandBuffer cmdBuf, VkAccelerationStructureTypeNVX type, uint32_t instanceCount, VkBuffer instanceData, VkDeviceSize instanceOffset, uint32_t geometryCount, const VkGeometryNVX* pGeometries, VkBuildAccelerationStructureFlagsNVX flags, VkBool32 update, VkAccelerationStructureNVX dst, VkAccelerationStructureNVX src, VkBuffer scratch, VkDeviceSize scratchOffset);
+typedef void (VKAPI_PTR *PFN_vkCmdCopyAccelerationStructureNVX)(VkCommandBuffer cmdBuf, VkAccelerationStructureNVX dst, VkAccelerationStructureNVX src, VkCopyAccelerationStructureModeNVX mode);
+typedef void (VKAPI_PTR *PFN_vkCmdTraceRaysNVX)(VkCommandBuffer cmdBuf, VkBuffer raygenShaderBindingTableBuffer, VkDeviceSize raygenShaderBindingOffset, VkBuffer missShaderBindingTableBuffer, VkDeviceSize missShaderBindingOffset, VkDeviceSize missShaderBindingStride, VkBuffer hitShaderBindingTableBuffer, VkDeviceSize hitShaderBindingOffset, VkDeviceSize hitShaderBindingStride, uint32_t width, uint32_t height);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateRaytracingPipelinesNVX)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkRaytracingPipelineCreateInfoNVX* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines);
+typedef VkResult (VKAPI_PTR *PFN_vkGetRaytracingShaderHandlesNVX)(VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void* pData);
+typedef VkResult (VKAPI_PTR *PFN_vkGetAccelerationStructureHandleNVX)(VkDevice device, VkAccelerationStructureNVX accelerationStructure, size_t dataSize, void* pData);
+typedef void (VKAPI_PTR *PFN_vkCmdWriteAccelerationStructurePropertiesNVX)(VkCommandBuffer cmdBuf, VkAccelerationStructureNVX accelerationStructure, VkQueryType queryType, VkQueryPool queryPool, uint32_t query);
+typedef VkResult (VKAPI_PTR *PFN_vkCompileDeferredNVX)(VkDevice device, VkPipeline pipeline, uint32_t shader);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateAccelerationStructureNVX(
+ VkDevice device,
+ const VkAccelerationStructureCreateInfoNVX* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkAccelerationStructureNVX* pAccelerationStructure);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyAccelerationStructureNVX(
+ VkDevice device,
+ VkAccelerationStructureNVX accelerationStructure,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR void VKAPI_CALL vkGetAccelerationStructureMemoryRequirementsNVX(
+ VkDevice device,
+ const VkAccelerationStructureMemoryRequirementsInfoNVX* pInfo,
+ VkMemoryRequirements2KHR* pMemoryRequirements);
+
+VKAPI_ATTR void VKAPI_CALL vkGetAccelerationStructureScratchMemoryRequirementsNVX(
+ VkDevice device,
+ const VkAccelerationStructureMemoryRequirementsInfoNVX* pInfo,
+ VkMemoryRequirements2KHR* pMemoryRequirements);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkBindAccelerationStructureMemoryNVX(
+ VkDevice device,
+ uint32_t bindInfoCount,
+ const VkBindAccelerationStructureMemoryInfoNVX* pBindInfos);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdBuildAccelerationStructureNVX(
+ VkCommandBuffer cmdBuf,
+ VkAccelerationStructureTypeNVX type,
+ uint32_t instanceCount,
+ VkBuffer instanceData,
+ VkDeviceSize instanceOffset,
+ uint32_t geometryCount,
+ const VkGeometryNVX* pGeometries,
+ VkBuildAccelerationStructureFlagsNVX flags,
+ VkBool32 update,
+ VkAccelerationStructureNVX dst,
+ VkAccelerationStructureNVX src,
+ VkBuffer scratch,
+ VkDeviceSize scratchOffset);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdCopyAccelerationStructureNVX(
+ VkCommandBuffer cmdBuf,
+ VkAccelerationStructureNVX dst,
+ VkAccelerationStructureNVX src,
+ VkCopyAccelerationStructureModeNVX mode);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdTraceRaysNVX(
+ VkCommandBuffer cmdBuf,
+ VkBuffer raygenShaderBindingTableBuffer,
+ VkDeviceSize raygenShaderBindingOffset,
+ VkBuffer missShaderBindingTableBuffer,
+ VkDeviceSize missShaderBindingOffset,
+ VkDeviceSize missShaderBindingStride,
+ VkBuffer hitShaderBindingTableBuffer,
+ VkDeviceSize hitShaderBindingOffset,
+ VkDeviceSize hitShaderBindingStride,
+ uint32_t width,
+ uint32_t height);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateRaytracingPipelinesNVX(
+ VkDevice device,
+ VkPipelineCache pipelineCache,
+ uint32_t createInfoCount,
+ const VkRaytracingPipelineCreateInfoNVX* pCreateInfos,
+ const VkAllocationCallbacks* pAllocator,
+ VkPipeline* pPipelines);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetRaytracingShaderHandlesNVX(
+ VkDevice device,
+ VkPipeline pipeline,
+ uint32_t firstGroup,
+ uint32_t groupCount,
+ size_t dataSize,
+ void* pData);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetAccelerationStructureHandleNVX(
+ VkDevice device,
+ VkAccelerationStructureNVX accelerationStructure,
+ size_t dataSize,
+ void* pData);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdWriteAccelerationStructurePropertiesNVX(
+ VkCommandBuffer cmdBuf,
+ VkAccelerationStructureNVX accelerationStructure,
+ VkQueryType queryType,
+ VkQueryPool queryPool,
+ uint32_t query);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCompileDeferredNVX(
+ VkDevice device,
+ VkPipeline pipeline,
+ uint32_t shader);
+#endif
+
+#define VK_NV_representative_fragment_test 1
+#define VK_NV_REPRESENTATIVE_FRAGMENT_TEST_SPEC_VERSION 1
+#define VK_NV_REPRESENTATIVE_FRAGMENT_TEST_EXTENSION_NAME "VK_NV_representative_fragment_test"
+
+typedef struct VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV {
+ VkStructureType sType;
+ void* pNext;
+ VkBool32 representativeFragmentTest;
+} VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV;
+
+typedef struct VkPipelineRepresentativeFragmentTestStateCreateInfoNV {
+ VkStructureType sType;
+ const void* pNext;
+ VkBool32 representativeFragmentTestEnable;
+} VkPipelineRepresentativeFragmentTestStateCreateInfoNV;
+
+
+
#define VK_EXT_global_priority 1
#define VK_EXT_GLOBAL_PRIORITY_SPEC_VERSION 2
#define VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME "VK_EXT_global_priority"
@@ -7845,6 +8301,133 @@
#define VK_NV_SHADER_SUBGROUP_PARTITIONED_EXTENSION_NAME "VK_NV_shader_subgroup_partitioned"
+#define VK_NV_compute_shader_derivatives 1
+#define VK_NV_COMPUTE_SHADER_DERIVATIVES_SPEC_VERSION 1
+#define VK_NV_COMPUTE_SHADER_DERIVATIVES_EXTENSION_NAME "VK_NV_compute_shader_derivatives"
+
+typedef struct VkPhysicalDeviceComputeShaderDerivativesFeaturesNV {
+ VkStructureType sType;
+ void* pNext;
+ VkBool32 computeDerivativeGroupQuads;
+ VkBool32 computeDerivativeGroupLinear;
+} VkPhysicalDeviceComputeShaderDerivativesFeaturesNV;
+
+
+
+#define VK_NV_mesh_shader 1
+#define VK_NV_MESH_SHADER_SPEC_VERSION 1
+#define VK_NV_MESH_SHADER_EXTENSION_NAME "VK_NV_mesh_shader"
+
+typedef struct VkPhysicalDeviceMeshShaderFeaturesNV {
+ VkStructureType sType;
+ void* pNext;
+ VkBool32 taskShader;
+ VkBool32 meshShader;
+} VkPhysicalDeviceMeshShaderFeaturesNV;
+
+typedef struct VkPhysicalDeviceMeshShaderPropertiesNV {
+ VkStructureType sType;
+ void* pNext;
+ uint32_t maxDrawMeshTasksCount;
+ uint32_t maxTaskWorkGroupInvocations;
+ uint32_t maxTaskWorkGroupSize[3];
+ uint32_t maxTaskTotalMemorySize;
+ uint32_t maxTaskOutputCount;
+ uint32_t maxMeshWorkGroupInvocations;
+ uint32_t maxMeshWorkGroupSize[3];
+ uint32_t maxMeshTotalMemorySize;
+ uint32_t maxMeshOutputVertices;
+ uint32_t maxMeshOutputPrimitives;
+ uint32_t maxMeshMultiviewViewCount;
+ uint32_t meshOutputPerVertexGranularity;
+ uint32_t meshOutputPerPrimitiveGranularity;
+} VkPhysicalDeviceMeshShaderPropertiesNV;
+
+typedef struct VkDrawMeshTasksIndirectCommandNV {
+ uint32_t taskCount;
+ uint32_t firstTask;
+} VkDrawMeshTasksIndirectCommandNV;
+
+
+typedef void (VKAPI_PTR *PFN_vkCmdDrawMeshTasksNV)(VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask);
+typedef void (VKAPI_PTR *PFN_vkCmdDrawMeshTasksIndirectNV)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride);
+typedef void (VKAPI_PTR *PFN_vkCmdDrawMeshTasksIndirectCountNV)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkCmdDrawMeshTasksNV(
+ VkCommandBuffer commandBuffer,
+ uint32_t taskCount,
+ uint32_t firstTask);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDrawMeshTasksIndirectNV(
+ VkCommandBuffer commandBuffer,
+ VkBuffer buffer,
+ VkDeviceSize offset,
+ uint32_t drawCount,
+ uint32_t stride);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDrawMeshTasksIndirectCountNV(
+ VkCommandBuffer commandBuffer,
+ VkBuffer buffer,
+ VkDeviceSize offset,
+ VkBuffer countBuffer,
+ VkDeviceSize countBufferOffset,
+ uint32_t maxDrawCount,
+ uint32_t stride);
+#endif
+
+#define VK_NV_fragment_shader_barycentric 1
+#define VK_NV_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION 1
+#define VK_NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME "VK_NV_fragment_shader_barycentric"
+
+typedef struct VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV {
+ VkStructureType sType;
+ void* pNext;
+ VkBool32 fragmentShaderBarycentric;
+} VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV;
+
+
+
+#define VK_NV_shader_image_footprint 1
+#define VK_NV_SHADER_IMAGE_FOOTPRINT_SPEC_VERSION 1
+#define VK_NV_SHADER_IMAGE_FOOTPRINT_EXTENSION_NAME "VK_NV_shader_image_footprint"
+
+typedef struct VkPhysicalDeviceShaderImageFootprintFeaturesNV {
+ VkStructureType sType;
+ void* pNext;
+ VkBool32 imageFootprint;
+} VkPhysicalDeviceShaderImageFootprintFeaturesNV;
+
+
+
+#define VK_NV_scissor_exclusive 1
+#define VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION 1
+#define VK_NV_SCISSOR_EXCLUSIVE_EXTENSION_NAME "VK_NV_scissor_exclusive"
+
+typedef struct VkPipelineViewportExclusiveScissorStateCreateInfoNV {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t exclusiveScissorCount;
+ const VkRect2D* pExclusiveScissors;
+} VkPipelineViewportExclusiveScissorStateCreateInfoNV;
+
+typedef struct VkPhysicalDeviceExclusiveScissorFeaturesNV {
+ VkStructureType sType;
+ void* pNext;
+ VkBool32 exclusiveScissor;
+} VkPhysicalDeviceExclusiveScissorFeaturesNV;
+
+
+typedef void (VKAPI_PTR *PFN_vkCmdSetExclusiveScissorNV)(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, uint32_t exclusiveScissorCount, const VkRect2D* pExclusiveScissors);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkCmdSetExclusiveScissorNV(
+ VkCommandBuffer commandBuffer,
+ uint32_t firstExclusiveScissor,
+ uint32_t exclusiveScissorCount,
+ const VkRect2D* pExclusiveScissors);
+#endif
+
#define VK_NV_device_diagnostic_checkpoints 1
#define VK_NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_SPEC_VERSION 2
#define VK_NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_EXTENSION_NAME "VK_NV_device_diagnostic_checkpoints"
diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp
index 56bc35e..fdbd969 100644
--- a/vulkan/libvulkan/driver.cpp
+++ b/vulkan/libvulkan/driver.cpp
@@ -1165,27 +1165,28 @@
result = EnumeratePhysicalDevices(instance, &device_count, nullptr);
if (result < 0)
return result;
+
if (!pPhysicalDeviceGroupProperties) {
*pPhysicalDeviceGroupCount = device_count;
return result;
}
- device_count = std::min(device_count, *pPhysicalDeviceGroupCount);
if (!device_count) {
*pPhysicalDeviceGroupCount = 0;
return result;
}
+ device_count = std::min(device_count, *pPhysicalDeviceGroupCount);
+ if (!device_count)
+ return VK_INCOMPLETE;
android::Vector<VkPhysicalDevice> devices;
devices.resize(device_count);
-
+ *pPhysicalDeviceGroupCount = device_count;
result = EnumeratePhysicalDevices(instance, &device_count,
devices.editArray());
if (result < 0)
return result;
- devices.resize(device_count);
- *pPhysicalDeviceGroupCount = device_count;
for (uint32_t i = 0; i < device_count; ++i) {
pPhysicalDeviceGroupProperties[i].physicalDeviceCount = 1;
pPhysicalDeviceGroupProperties[i].physicalDevices[0] = devices[i];